PageSourceSearch

https://longtermemory.com/assets/vendor-mux-MQivGizc.js

js longtermemory.com collected 2026-09-24 10:34:53 UTC 1,039,934 bytes, 3,391 lines download raw bytes

vendor: 9,626 bytes, line 1
1import{m as ja,r as za}from"./vendor-react-CO4_mtH0.js";var r_=Object.create,Ev=Object.defineProperty,n_=Object.getOwnPropertyDescriptor,a_=Object.getOwnPropertyNames,o_=Object.getPrototypeOf,l_=Object.prototype.hasOwnProperty,yv=function(i,e){return function(){return i&&(e=i(i=0)),e}},Mt=function(i,e){return function(){return e||i((e={exports:{}}).exports,e),e.exports}},d_=function(i,e,t,s){if(e&&typeof e=="object"||typeof e=="function")for(var r=a_(e),n=0,a=r.length,o;n<a;n++)o=r[n],!l_.call(i,o)&&o!==t&&Ev(i,o,{get:(function(l){return e[l]}).bind(null,o),enumerable:!(s=n_(e,o))||s.enumerable});return i},Yt=function(i,e,t){return t=i!=null?r_(o_(i)):{},d_(!i||!i.__esModule?Ev(t,"default",{value:i,enumerable:!0}):t,i)},Ti=Mt(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 kr(i,e){return e!=null&&typeof Symbol<"u"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](i):kr(i,e)}var Dr=yv(function(){Dr()});function Tv(i){"@swc/helpers - typeof";return i&&typeof Symbol<"u"&&i.constructor===Symbol?"symbol":typeof i}var bv=yv(function(){}),_v=Mt(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))}}}),u_=Mt(function(i,e){Dr(),e.exports=t;function t(s,r){if(!kr(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]"}}),c_=Mt(function(i,e){Dr(),e.exports=t;function t(s,r){if(!kr(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}}),Av=Mt(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)}}),Sv=Mt(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)}}),Iv=Mt(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)}}}),h_=Mt(function(i,e){bv(),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=Tv(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;")}}),Lv=Mt(function(i,e){Dr();var t=_v(),s=Av(),r=Sv(),n=Iv(),a=h_(),o="http://www.w3.org/1999/xhtml";e.exports=l;function l(d,u,c){if(!kr(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}}),f_=Mt(function(i,e){Dr();var t=Lv();e.exports=s;function s(r){if(!kr(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("")}}),m_=Mt(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(){}}),p_=Mt(function(i,e){Dr();var t=_v(),s=u_(),r=c_(),n=Lv(),a=f_(),o=m_(),l=Av(),d=Sv(),u=Iv();e.exports=c;function c(){if(!kr(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}),g_=Mt(function(i,e){var t=p_();e.exports=new t}),Rv=Mt(function(i,e){var t=typeof global<"u"?global:typeof window<"u"?window:{},s=g_(),r;typeof document<"u"?r=document:(r=t["__GLOBAL_DOCUMENT_CACHE@4"],r||(r=t["__GLOBAL_DOCUMENT_CACHE@4"]=s)),e.exports=r});function v_(i){if(Array.isArray(i))return i}function E_(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}}
vendor: 4,332 bytes, lines 1-3
1function y_(){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 wc(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 xv(i,e){if(i){if(typeof i=="string")return wc(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 wc(i,e)}}function ms(i,e){return v_(i)||E_(i,e)||xv(i,e)||y_()}var Oa=Yt(Ti()),yp=Yt(Ti()),T_=Yt(Ti()),b_={now:function(){var i=T_.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)}},st=b_,Qa=function(){var i,e,t;if(typeof((i=yp.default.crypto)===null||i===void 0?void 0:i.getRandomValues)=="function"){t=new Uint8Array(32),yp.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=st.now(),o=a?.toString(16).substring(3);return o?e.substring(0,28)+o:e},kv=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},ui=function(i){if(i&&typeof i.nodeName<"u")return i.muxId||(i.muxId=kv()),i.muxId;var e;try{e=document.querySelector(i)}catch{}return e&&!e.muxId&&(e.muxId=i),e?.muxId||i},Ad=function(i){var e;i&&typeof i.nodeName<"u"?(e=i,i=ui(e)):e=document.querySelector(i);var t=e&&e.nodeName?e.nodeName.toLowerCase():"";return[e,i,t]};function __(i){if(Array.isArray(i))return wc(i)}function A_(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function S_(){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 ci(i){return __(i)||A_(i)||xv(i)||S_()}var cr={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4},I_=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,ci(o)),d=(s=console.info).bind.apply(s,ci(o)),u=(r=console.debug).bind.apply(r,ci(o)),c=(n=console.warn).bind.apply(n,ci(o)),h=(a=console.error).bind.apply(a,ci(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>cr.TRACE))return l.apply(void 0,ci(p))},debug:function(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];if(!(f>cr.DEBUG))return u.apply(void 0,ci(p))},info:function(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];if(!(f>cr.INFO))return d.apply(void 0,ci(p))},warn:function(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];if(!(f>cr.WARN))return c.apply(void 0,ci(p))},error:function(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];if(!(f>cr.ERROR))return h.apply(void 0,ci(p))},get level(){return f},set level(m){m!==this.level&&(f=m??e)}}},Ce=I_("[mux]"),$u=Yt(Ti());function Mc(){var i=$u.default.doNotTrack||$u.default.navigator&&$u.default.navigator.doNotTrack;return i==="1"}function oe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}Dr();function pt(i,e){if(!kr(i,e))throw new TypeError("Cannot call a class as a function")}function L_(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 es(i,e,t){return e&&L_(i.prototype,e),i}function K(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function $n(i){return $n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},$n(i)}function R_(i,e){for(;!Object.prototype.hasOwnProperty.call(i,e)&&(i=$n(i),i!==null););return i}function ol(i,e,t){return typeof Reflect<"u"&&Reflect.get?ol=Reflect.get:ol=function(s,r,n){var a=R_(s,r);if(a){var o=Object.getOwnPropertyDescriptor(a,r);return o.get?o.get.call(n||s):o.value}},ol(i,e,t||i)}
vendor: 2,053 bytes, line 3
3function Pc(i,e){return Pc=Object.setPrototypeOf||function(t,s){return t.__proto__=s,t},Pc(i,e)}function x_(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&&Pc(i,e)}function k_(){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}}bv();function D_(i,e){return e&&(Tv(e)==="object"||typeof e=="function")?e:oe(i)}function C_(i){var e=k_();return function(){var t=$n(i),s;if(e){var r=$n(this).constructor;s=Reflect.construct(t,arguments,r)}else s=t.apply(this,arguments);return D_(this,s)}}var vi=function(i){return Xa(i)[0]},Xa=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]},Fu=Yt(Ti()),w_={exists:function(){var i=Fu.default.performance,e=i&&i.timing;return e!==void 0},domContentLoadedEventEnd:function(){var i=Fu.default.performance,e=i&&i.timing;return e&&e.domContentLoadedEventEnd},navigationStart:function(){var i=Fu.default.performance,e=i&&i.timing;return e&&e.navigationStart}},Sd=w_;function it(i,e,t){t=t===void 0?1:t,i[e]=i[e]||0,i[e]+=t}function Id(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{},s=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(t).filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),s.forEach(function(r){K(i,r,t[r])})}return i}function M_(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);t.push.apply(t,s)}return t}function If(i,e){return e=e??{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):M_(Object(e)).forEac
vendor: 8,204 bytes, lines 3-12
3h(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(e,t))}),i}var P_=["x-cdn","content-type"],Dv=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],O_=P_.concat(Dv);function Lf(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&&(O_.indexOf(n.toLowerCase())>=0||n.toLowerCase().indexOf("x-litix-")===0)&&(e[n]=r.join(": "))}}),e}function Ld(i){if(i){var e=Dv.find(function(t){return i[t]!==void 0});return e?i[e]:void 0}}var N_=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},Cv=N_,Lo=function(i){if(!i)return{};var e=Sd.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)}},Zn=function(i){if(!(!i||typeof i.getAllResponseHeaders!="function"))return Lf(i.getAllResponseHeaders())},U_=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(!Sd.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,b=v.url,A=v.stats,L=v.networkDetails,S=v.sessionData,R={},x={};T.forEach(function(H,N){R[N]={width:H.width,height:H.height,bitrate:H.bitrate,attrs:H.attrs}}),y.forEach(function(H,N){x[N]={name:H.name,language:H.lang,bitrate:H.bitrate}});var I=Lo(A),M=I.bytesLoaded,F=I.requestStart,V=I.responseStart,Y=I.responseEnd;o("requestcompleted",If(Id({},Cv(S)),{request_event_type:g,request_bytes_loaded:M,request_start:F,request_response_start:V,request_response_end:Y,request_type:"manifest",request_hostname:vi(b),request_response_headers:Zn(L),request_rendition_lists:{media:R,audio:x,video:{}}}))};t.on(s.Events.MANIFEST_LOADED,l);var d=function(g,v){var T=v.details,y=v.level,b=v.networkDetails,A=v.stats,L=Lo(A),S=L.bytesLoaded,R=L.requestStart,x=L.responseStart,I=L.responseEnd,M=T.fragments[T.fragments.length-1],F=a(M)+n(M.duration);o("requestcompleted",{request_event_type:g,request_bytes_loaded:S,request_start:R,request_response_start:x,request_response_end:I,request_current_level:y,request_type:"manifest",request_hostname:vi(T.url),request_response_headers:Zn(b),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(F)?void 0:F})};t.on(s.Events.LEVEL_LOADED,d);var u=function(g,v){var T=v.details,y=v.networkDetails,b=v.stats,A=Lo(b),L=A.bytesLoaded,S=A.requestStart,R=A.responseStart,x=A.responseEnd;o("requestcompleted",{request_event_type:g,request_bytes_loaded:L,request_start:S,request_response_start:R,request_response_end:x,request_type:"manifest",request_hostname:vi(T.url),request_response_headers:Zn(y)})};t.on(s.Events.AUDIO_TRACK_LOADED,u);var c=function(g,v){var T=v.stats,y=v.networkDetails,b=v.frag;T=T||b.stats;var A=Lo(T),L=A.bytesLoaded,S=A.requestStart,R=A.responseStart,x=A.responseEnd,I=y?Zn(y):void 0,M={request_event_type:g,request_bytes_loaded:L,request_start:S,request_response_start:R,request_response_end:x,request_hostname:y?vi(y.responseURL):void 0,request_id:I?Ld(I):void 0,request_response_headers:I,request_media_duration:b.duration,request_url:y?.responseURL};b.type==="main"?(M.request_type="media",M.request_current_level=b.level,M.request_video_width=(t.levels[b.level]||{}).width,M.request_video_height=(t.levels[b.level]||{}).height,M.request_labeled_bitrate=(t.levels[b.level]||{}).bitrate):M.request_type=b.type,o("requestcompleted",M)};t.on(s.Events.FRAG_LOADED,c);var h=function(g,v){var T=v.frag,y=T.start,b=a(T),A={currentFragmentPDT:b,currentFragmentStart:n(y)};o("fragmentchange",A)};t.on(s.Events.FRAG_CHANGED,h);var f=function(g,v){var T=v.type,y=v.details,b=v.response,A=v.fatal,L=v.frag,S=v.networkDetails,R=L?.url||v.url||"",x=S?Zn(S):void 0;if((y===s.ErrorDetails.MANIFEST_LOAD_ERROR||y===s.ErrorDetails.MANIFEST_LOAD_TIMEOUT||y===s.ErrorDetails.FRAG_LOAD_ERROR||y===s.ErrorDetails.FRAG_LOAD_TIMEOUT||y===s.ErrorDetails.LEVEL_LOAD_ERROR||y===s.ErrorDetails.LEVEL_LOAD_TIMEOUT||y===s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||y===s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT||y===s.ErrorDetails.SUBTITLE_LOAD_ERROR||y===s.ErrorDetails.SUBTITLE_LOAD_TIMEOUT||y===s.ErrorDetails.KEY_LOAD_ERROR||y===s.ErrorDetails.KEY_LOAD_TIMEOUT)&&o("requestfailed",{request_error:y,request_url:R,request_hostname:vi(R),request_id:x?Ld(x):void 0,request_type:y===s.ErrorDetails.FRAG_LOAD_ERROR||y===s.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":y===s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||y===s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":y===s.ErrorDetails.SUBTITLE_LOAD_ERROR||y===s.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":y===s.ErrorDetails.KEY_LOAD_ERROR||y===s.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:b?.code,request_error_text:b?.text}),A){var I,M="".concat(R?"url: ".concat(R,`
4`):"")+"".concat(b&&(b.code||b.text)?"response: ".concat(b.code,", ").concat(b.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((I=v.err)===null||I===void 0?void 0:I.message,`
12`):"");o("error",{player_error_code:T,player_error_message:y,player_error_context:M})}};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:vi(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 b=y.attrs.BANDWIDTH,A,L=parseFloat(y.attrs["FRAME-RATE"]);isNaN(L)||(A=L),b?o("renditionchange",{video_source_fps:A,video_source_bitrate:b,video_source_width:y.width,video_source_height:y.height,video_source_rendition_name:y.name,video_source_codec:y?.videoCodec}):r.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};t.on(s.Events.LEVEL_SWITCHED,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)},$_=function(i){i&&typeof i._stopMuxMonitor=="function"&&i._stopMuxMonitor()},Tp=function(i,e){if(!i||!i.requestEndDate)return{};var t=vi(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=Lf(d[d.length-1]._responseHeaders||""));var c=u?Ld(u):void 0;return{requestStart:n,requestResponseStart:a,requestResponseEnd:o,requestBytesLoaded:r,requestResponseHeaders:u,requestMediaDuration:l,requestHostname:t,requestUrl:s,requestId:c}},F_=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}:{}},B_=function(i){var e;return(e=i.match(/.*codecs\*?="(.*)"/))===null||e===void 0?void 0:e[1]},H_=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,510 bytes, lines 12-14
12)[0];return s}catch{return!1}},G_=function(i,e,t){var s=i.log;if(!t||!t.on){s.warn("Invalid dash.js player reference. Monitoring blocked.");return}var r=H_(t),n=function(T,y){return i.emit(e,T,y)},a=function(T){var y=T.type,b=T.data,A=(b||{}).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:vi(A),request_url:A})};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,b=T.fragmentModel,A=T.chunk,L=l(b);u({type:y,request:L,chunk:A})},u=function(T){var y=T.type,b=T.chunk,A=T.request,L=(b||{}).mediaInfo,S=L||{},R=S.type,x=S.bitrateList;x=x||[];var I={};x.forEach(function(ee,U){I[U]={},I[U].width=ee.width,I[U].height=ee.height,I[U].bitrate=ee.bandwidth,I[U].attrs={}}),R==="video"?o.video=I:R==="audio"?o.audio=I:o.media=I;var M=Tp(A,t),F=M.requestStart,V=M.requestResponseStart,Y=M.requestResponseEnd,H=M.requestResponseHeaders,N=M.requestMediaDuration,W=M.requestHostname,B=M.requestUrl,j=M.requestId;n("requestcompleted",{request_event_type:y,request_start:F,request_response_start:V,request_response_end:Y,request_bytes_loaded:-1,request_type:R+"_init",request_response_headers:H,request_hostname:W,request_id:j,request_url:B,request_media_duration:N,request_rendition_lists:o})};r>=4?t.on("initFragmentLoaded",u):t.on("initFragmentLoaded",d);var c=function(T){var y=T.type,b=T.fragmentModel,A=T.chunk,L=l(b);h({type:y,request:L,chunk:A})},h=function(T){var y=T.type,b=T.chunk,A=T.request,L=b||{},S=L.mediaInfo,R=L.start,x=S||{},I=x.type,M=Tp(A,t),F=M.requestStart,V=M.requestResponseStart,Y=M.requestResponseEnd,H=M.requestBytesLoaded,N=M.requestResponseHeaders,W=M.requestMediaDuration,B=M.requestHostname,j=M.requestUrl,ee=M.requestId,U=F_(I,t),$=U.currentLevel,ne=U.renditionWidth,pe=U.renditionHeight,ue=U.renditionBitrate;n("requestcompleted",{request_event_type:y,request_start:F,request_response_start:V,request_response_end:Y,request_bytes_loaded:H,request_type:I,request_response_headers:N,request_hostname:B,request_id:ee,request_url:j,request_media_start_time:R,request_media_duration:W,request_current_level:$,request_labeled_bitrate:ue,request_video_width:ne,request_video_height:pe})};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:B_(f.video.codec)}}},p=function(T,y,b){if(typeof T.newQuality!="number"){s.warn("missing evt.newQuality in qualityChangeRendered event",T);return}var A=T.mediaType;if(A==="audio"||A==="video"){var L=t.getBitrateInfoListFor(A).find(function(R){var x=R.qualityIndex;return x===T.newQuality});if(!(L&&typeof L.bitrate=="number")){s.warn("missing bitrate info for ".concat(A));return}f[A]=If(Id({},L),{codec:t.getCurrentTrackFor(A).codec});var S=m();S&&n("renditionchange",S)}};t.on("qualityChangeRendered",p);var g=function(T){var y=T.request,b=T.mediaType;y=y||{},n("requestcanceled",{request_event_type:y.type+"_"+y.action,request_url:y.url,request_type:b,request_hostname:vi(y.url)})};t.on("fragmentLoadingAbandoned",g);var v=function(T){var y=T.error,b,A,L=(y==null||(b=y.data)===null||b===void 0?void 0:b.request)||{},S=(y==null||(A=y.data)===null||A===void 0?void 0:A.response)||{};y?.code===27&&n("requestfailed",{request_error:L.type+"_"+L.action,request_url:L.url,request_hostname:vi(L.url),request_type:L.mediaType,request_error_code:S.status,request_error_text:S.statusText});var R="".concat(L!=null&&L.url?"url: ".concat(L.url,`
13`):"")+"".concat(S!=null&&S.status||S!=null&&S.statusText?"response: ".concat(S?.status,", ").concat(S?.statusText,`
14`):"");n("error",{player_error_code:y?.code,player_error_message:y?.message,player_error_context:R})};t.on("error",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}},K_=function(i){i&&typeof i._stopMuxMonitor=="function"&&i._stopMuxMonitor()},bp=0,V_=(function(){function i(){pt(this,i),K(this,"_listeners",void 0)}return es(i,[{key:"on",value:function(e,t,s){return t._eventEmitterGuid=t._eventEmitterGuid||++bp,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||++bp;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*"]||[],n=this._listeners[e]||[],a=this._listeners["after"+e]||[],o=function(l,d){l=l.slice(),l.forEach(function(u){u.call(s,{type:e},d)})};o(r,t),o(n,t),o(a,t)}}}]),i})(),W_=V_,Bu=Yt(Ti()),q_=(function(){function i(e){var t=this;pt(this,i),K(this,"_playbackHeartbeatInterval",void 0),K(this,"_playheadShouldBeProgressing",void 0),K(this,"pm",void 0),this.pm=e,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,e.on("playing",function(){t._playheadShouldBeProgressing=!0}),e.on("play",this._startPlaybackHeartbeatInterval.bind(this)),e.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),e.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),e.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("seeked",function(){e.data.player_is_paused?t._stopPlaybackHeartbeatInterval():t._startPlaybackHeartbeatInterval()}),e.on("timeupdate",function(){t._playbackHeartbeatInterval!==null&&e.emit("playbackheartbeat")}),e.on("devicesleep",function(s,r){t._playbackHeartbeatInterval!==null&&(Bu.default.clearInterval(t._playbackHeartbeatInterval),e.emit("playbackheartbeatend",{viewer_time:r.viewer_time}),t._playbackHeartbeatInterval=null)})}return es(i,[{key:"_startPlaybackHeartbeatInterval",value:function(){var e=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=Bu.default.setInterval(function(){e.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(Bu.default.clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}]),i})(),Y_=q_,j_=function i(e){var t=this;pt(this,i),K(this,"viewErrored",void 0),e.on("viewinit",function(){t.viewErrored=!1}),e.on("error",function(s,r){try{var n=e.errorTranslator({player_error_code:r.player_error_code,player_error_message:r.player_error_message,player_error_context:r.player_error_context,player_error_severity:r.player_error_severity,player_error_business_exception:r.player_error_business_exception});n&&(e.data.player_error_code=n.player_error_code||r.player_error_code,e.data.player_error_message=n.player_error_message||r.player_error_message,e.data.player_error_context=n.player_error_context||r.player_error_context,e.data.player_error_severity=n.player_error_severity||r.player_error_severity,e.data.player_error_business_exception=n.player_error_business_exception||r.player_error_business_exception,t.viewErrored=!0)}catch(a){e.mux.log.warn("Exception in error translator callback.",a),t.viewErrored=!0}}),e.on("aftererror",function(){var s,r,n,a,o;(s=e.data)===null||s===void 0||delete s.player_error_code,(r=e.data)===null||r===void 0||delete r.player_error_message,(n=e.data)===null||n===void 0||delete n.player_error_context,(a=e.data)===null||a===void 0||delete a.player_error_severity,(o=e.data)===null||o===void 0||delete o.player_error_business_exception})},z_=j_,Q_=(function(){function i(e){pt(this,i),K(this,"_watchTimeTrackerLastCheckedTime",void 0),K(this,"pm",void 0),this.pm=e,this._watchTimeTrackerLastCheckedTime=null,e.on("playbackheartbeat",this._updateWatchTime.bind(this)),e.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}return es(i,[{key:"_updateWatchTime",value:function(e,t){var s=t.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=s),it(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})(),X_=Q_,Z_=(function(){function i(e){var t=this;pt(this,i),K(this,"_playbackTimeTrackerLastPlayheadPosition",void 0),K(this,"_lastTime",void 0),K(this,"_isAdPlaying",void 0),K(this,"_callbackUpdatePlaybackTime",void 0),K(this,"pm",void 0),this.pm=e,this._playbackTimeTrackerLastPlayheadPosition=-1,this._lastTime=st.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=st.now(),t._isAdPlaying=!1,t._callbackUpdatePlaybackTime=null})}return es(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=st.now(),s=-1;this._playbackTimeTrackerLastPlayheadPosition>=0&&e>this._playbackTimeTrackerLastPlayheadPosition?s=e-this._playbackTimeTrackerLastPlayheadPosition:this._isAdPlaying&&(s=t-this._lastTime),s>0&&s<=1e3&&it(this.pm.data,"view_content_playback_time",s),this._playbackTimeTrackerLastPlayheadPosition=e,this._lastTime=t}}]),i})(),J_=Z_,eA=(function(){function i(e){pt(this,i),K(this,"pm",void 0),this.pm=e;var t=this._updatePlayheadTime.bind(this);e.on("playbackheartbeat",t),e.on("playbackheartbeatend",t),e.on("timeupdate",t),e.on("destroy",function(){e.off("timeupdate",t)})}return es(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})(),tA=eA,_p=300*1e3,iA=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;it(e.data,"view_rebuffer_duration",a),t=n.viewer_time,e.data.view_rebuffer_duration>_p&&(e.emit("viewend"),e.send("viewend"),e.mux.log.warn("Ending view after rebuffering for longer than ".concat(_p,"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||(it(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)})}},sA=iA,rA=(function(){function i(e){var t=this;pt(this,i),K(this,"_lastCheckedTime",void 0),K(this,"_lastPlayheadTime",void 0),K(this,"_lastPlayheadTimeUpdatedTime",void 0),K(this,"_rebuffering",void 0),K(this,"pm",void 0),this.pm=e,!(e.disableRebufferTracking||e.disablePlayheadRebufferTracking)&&(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,e.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),e.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),e.on("seeking",function(){t._cleanupRebufferTracker(null,{viewer_time:st.now()})}))}return es(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})(),nA=rA,aA=(function(){function i(e){var t=this;pt(this,i),K(this,"NAVIGATION_START",void 0),K(this,"pm",void 0),this.pm=e,e.on("viewinit",function(){var s=e.data,r=s.view_id;if(!s.view_program_changed){var n=function(a,o){var l=o.viewer_time;(a.type==="playing"&&typeof e.data.view_time_to_first_frame>"u"||a.type==="adplaying"&&(typeof e.data.view_time_to_first_frame>"u"||t._inPrerollPosition()))&&t.calculateTimeToFirstFrame(l||st.now(),r)};e.one("playing",n),e.one("adplaying",n),e.one("viewend",function(){e.off("playing",n),e.off("adplaying",n)})}})}return es(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.NAVIGATION_START&&(this.pm.data.view_aggregate_startup_time=this.pm.data.view_start+this.pm.data.view_watch_time-this.NAVIGATION_START))}}]),i})(),oA=aA,lA=function i(e){var t=this;pt(this,i),K(this,"_lastPlayerHeight",void 0),K(this,"_lastPlayerWidth",void 0),K(this,"_lastPlayheadPosition",void 0),K(this,"_lastSourceHeight",void 0),K(this,"_lastSourceWidth",void 0),e.on("viewinit",function(){t._lastPlayheadPosition=-1});var s=["pause","rebufferstart","seeking","error","adbreakstart","hb","renditionchange","orientationchange","viewend"],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),it(e.data,"view_total_content_playback_time",a),it(e.data,"view_total_upscaling",l*a),it(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})})},dA=lA,uA=2e3,cA=function i(e){var t=this;pt(this,i),K(this,"isSeeking",void 0),this.isSeeking=!1;var s=-1,r=function(){var n=st.now(),a=(e.data.viewer_time||n)-(s||n);it(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<=uA){s=a.viewer_time;return}t.isSeeking&&r(),t.isSeeking=!0,s=a.viewer_time,it(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})},hA=cA,Ap=function(i,e){i.push(e),i.sort(function(t,s){return t.viewer_time-s.viewer_time})},fA=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror","adclicked","adskipped"],mA=(function(){function i(e){var t=this;pt(this,i),K(this,"_adHasPlayed",void 0),K(this,"_adRequests",void 0),K(this,"_adResponses",void 0),K(this,"_currentAdRequestNumber",void 0),K(this,"_currentAdResponseNumber",void 0),K(this,"_prerollPlayTime",void 0),K(this,"_wouldBeNewAdPlay",void 0),K(this,"isAdBreak",void 0),K(this,"pm",void 0),this.pm=e,e.on("viewinit",function(){t.isAdBreak=!1,t._currentAdRequestNumber=0,t._currentAdResponseNumber=0,t._adRequests=[],t._adResponses=[],t._adHasPlayed=!1,t._wouldBeNewAdPlay=!0,t._prerollPlayTime=void 0}),fA.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),Ap(t._adRequests,n),it(e.data,"view_ad_request_count"),t.inPrerollPosition()&&(e.data.view_preroll_requested=!0,t._adHasPlayed||it(e.data,"view_preroll_request_count"))}),e.on("adresponse",function(r,n){n=Object.assign({ad_request_id:"generatedAdRequestId"+t._currentAdResponseNumber++},n),Ap(t._adResponses,n);var a=t.findAdRequest(n.ad_request_id);a&&it(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,it(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||it(e.data,"view_ad_clicked_count")}),e.on("adskipped",function(r,n){t._wouldBeNewAdPlay||it(e.data,"view_ad_skipped_count")}),e.on("adended",function(){t._wouldBeNewAdPlay=!0}),e.on("aderror",function(){t._wouldBeNewAdPlay=!0})}return es(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=ms(Xa(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=ms(Xa(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?.ad_asset_url,this.pm.data.ad_tag_url=t?.ad_tag_url,this.pm.data.ad_creative_id=t?.ad_creative_id,this.pm.data.ad_id=t?.ad_id,this.pm.data.ad_universal_id=t?.ad_universal_id}}]),i})(),pA=mA,Sp=Yt(Ti()),gA=function i(e){pt(this,i);var t,s,r=function(){e.disableRebufferTracking||(it(e.data,"view_waiting_rebuffer_count",1),t=st.now(),s=Sp.default.setInterval(function(){if(t){var d=st.now();it(e.data,"view_waiting_rebuffer_duration",d-t),t=d}},250))},n=function(){e.disableRebufferTracking||t&&(it(e.data,"view_waiting_rebuffer_duration",st.now()-t),t=!1,Sp.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)},vA=gA,EA=function i(e){var t=this;pt(this,i),K(this,"lastWallClockTime",void 0);var s=function(){t.lastWallClockTime=st.now(),e.on("before*",r)},r=function(n){var a=st.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)})},yA=EA,Hu=Yt(Ti()),wv=(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: 16,910 bytes, line 14
14,s.remove=function(r,n){s(r,"",i(n,{expires:-1}))},s.withConverter=e,s}return e(function(){})}),Mv="muxData",TA=function(i){return Object.entries(i).map(function(e){var t=ms(e,2),s=t[0],r=t[1];return"".concat(s,"=").concat(r)}).join("&")},bA=function(i){return i.split("&").reduce(function(e,t){var s=ms(t.split("="),2),r=s[0],n=s[1],a=+n,o=n&&a==n?a:n;return e[r]=o,e},{})},Pv=function(){var i;try{i=bA(wv.get(Mv)||"")}catch{i={}}return i},Ov=function(i){try{wv.set(Mv,TA(i),{expires:365})}catch{}},_A=function(){var i=Pv();return i.mux_viewer_id=i.mux_viewer_id||Qa(),i.msn=i.msn||Math.random(),Ov(i),{mux_viewer_id:i.mux_viewer_id,mux_sample_number:i.msn}},AA=function(){var i=Pv(),e=st.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=Qa(),i.sst=e),i.sex=e+1500*1e3,Ov(i),{session_id:i.sid,session_start:i.sst,session_expires:i.sex}};function SA(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 IA=Yt(Ti()),Nv=function(){var i;switch(Uv()){case"cellular":i="cellular";break;case"ethernet":i="wired";break;case"wifi":i="wifi";break;case void 0:break;default:i="other"}return i},Uv=function(){var i=IA.default.navigator,e=i&&(i.connection||i.mozConnection||i.webkitConnection);return e&&e.type};Nv.getConnectionFromAPI=Uv;var LA=Nv,RA={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"},xA=$v(RA),kA={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",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",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"},Ip=$v(kA);function $v(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function Oc(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=xA[a];o||(Ce.info("Data key word `"+n[0]+"` not expected in "+s),o=a+"_"),n.splice(1).forEach(function(l){l==="url"&&(r=!0),Ip[l]?o+=Ip[l]:Number.isInteger(Number(l))?o+=l:(Ce.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 fr=Yt(Ti()),DA=Yt(Rv()),CA={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},wA=56*1024,MA=["hb","requestcompleted","requestfailed","requestcanceled"],PA="https://img.litix.io",gs=function(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=i||PA,this._eventQueue=[],this._postInFlight=!1,this._resendAfterPost=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},CA,e)};gs.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};gs.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()};gs.prototype.destroy=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.destroyed=!0,i?this._clearBeaconQueue():this.flushEvents(),fr.default.clearTimeout(this._sendTimeout)};gs.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],Oc({mux_view_message:"event queue truncated"}));var t=this._createPayload(e);Fv(this._beaconUrl,t,!0,function(){})};gs.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=st.now();Fv(this._beaconUrl,t,!1,function(r,n){n?(i._eventQueue=e.concat(i._eventQueue),i._failureCount+=1,Ce.info("Error sending beacon: "+n)):i._failureCount=0,i._roundTripTime=st.now()-s,i._postInFlight=!1,i._resendAfterPost&&(i._resendAfterPost=!1,i._eventQueue.length>0&&i._sendBeaconQueue())})};gs.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};gs.prototype._startBeaconSending=function(){var i=this;fr.default.clearTimeout(this._sendTimeout),!this.destroyed&&(this._sendTimeout=fr.default.setTimeout(function(){i._eventQueue.length&&i._sendBeaconQueue(),i._startBeaconSending()},this._getNextBeaconTime()))};gs.prototype._createPayload=function(i){var e=this,t={transmission_timestamp:Math.round(st.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()||(Ce.info("Payload size is too big ("+n+" kb). Removing unnecessary events."),r=i.filter(function(l){return MA.indexOf(l.e)===-1}),a()),o()||(Ce.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 OA=typeof DA.default.exitPictureInPicture=="function"?function(i){return i.length<=wA}:function(i){return!1},Fv=function(i,e,t,s){if(t&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(i,e)){s();return}if(fr.default.fetch){fr.default.fetch(i,{method:"POST",body:e,headers:{"Content-Type":"text/plain"},keepalive:OA(e)}).then(function(n){return s(null,n.ok?null:"Error")}).catch(function(n){return s(null,n)});return}if(fr.default.XMLHttpRequest){var r=new fr.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()},NA=gs,UA=["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"],$A=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended","adresponse","adrequest"],FA=["ad_id","ad_creative_id","ad_universal_id"],BA=["viewstart","error","ended","viewend"],HA=600*1e3,GA=(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;K(this,"mux",void 0),K(this,"envKey",void 0),K(this,"options",void 0),K(this,"eventQueue",void 0),K(this,"sampleRate",void 0),K(this,"disableCookies",void 0),K(this,"respectDoNotTrack",void 0),K(this,"previousBeaconData",void 0),K(this,"lastEventTime",void 0),K(this,"rateLimited",void 0),K(this,"pageLevelData",void 0),K(this,"viewerData",void 0),this.mux=e,this.envKey=t,this.options=s,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.eventQueue=new NA(SA(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:LA(),page_url:Hu.default===null||Hu.default===void 0||(p=Hu.default.location)===null||p===void 0?void 0:p.href},this.viewerData=this.disableCookies?{}:_A()}return es(i,[{key:"send",value:function(e,t){if(!(!e||!(t!=null&&t.view_id))){if(this.respectDoNotTrack&&Mc())return Ce.info("Not sending `"+e+"` because Do Not Track is enabled");if(!t||typeof t!="object")return Ce.error("A data object was expected in send() but was not provided");var s=this.disableCookies?{}:AA(),r=If(Id({},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=Oc(o);if(this.lastEventTime=this.mux.utils.now(),a)return Ce.info("Not sending event due to sample rate restriction",e,r,l);if(this.envKey||Ce.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(Ce.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):BA.indexOf(e)>=0&&this.eventQueue.flushEvents(),this.rateLimited)return r.event="eventrateexceeded",l=Oc(r),this.eventQueue.queueEvent(r.event,l),Ce.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>=HA)r=Id({},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=ms(o,2),d=l[0],u=l[1];s.previousBeaconData&&(u!==s.previousBeaconData[d]||UA.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||FA.includes(t)&&$A.includes(e))}}]),i})(),KA=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 b=v/y*8e3;a++,s+=v,r+=y,e.data.view_min_request_throughput=Math.min(e.data.view_min_request_throughput||1/0,b),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)},VA=KA,WA=3600*1e3,qA=function i(e){var t=this;pt(this,i),K(this,"_lastEventTime",void 0),e.on("before*",function(s,r){var n=r.viewer_time,a=st.now(),o=t._lastEventTime;if(t._lastEventTime=a,o&&a-o>WA){var l=Object.keys(e.data).reduce(function(u,c){return c.indexOf("video_")===0?Object.assign(u,K({},c,e.data[c])):u},{});e.mux.log.info("Received event after at least an hour inactivity, creating a new view");var d=e.playbackHeartbeat._playheadShouldBeProgressing;e._resetView(Object.assign({viewer_time:n},l)),e.playbackHeartbeat._playheadShouldBeProgressing=d,e.playbackHeartbeat._playheadShouldBeProgressing&&s.type!=="play"&&s.type!=="adbreakstart"&&(e.emit("play",{viewer_time:n}),s.type!=="playing"&&e.emit("playing",{viewer_time:n}))}})},YA=qA,jA=["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"],zA=new Set(["requestcompleted","requestfailed","requestcanceled"]),QA=(function(i){x_(t,i);var e=C_(t);function t(s,r,n){pt(this,t);var a;a=e.call(this),K(oe(a),"DOM_CONTENT_LOADED_EVENT_END",void 0),K(oe(a),"NAVIGATION_START",void 0),K(oe(a),"_destroyed",void 0),K(oe(a),"_heartBeatTimeout",void 0),K(oe(a),"adTracker",void 0),K(oe(a),"dashjs",void 0),K(oe(a),"data",void 0),K(oe(a),"disablePlayheadRebufferTracking",void 0),K(oe(a),"disableRebufferTracking",void 0),K(oe(a),"errorTracker",void 0),K(oe(a),"errorTranslator",void 0),K(oe(a),"emitTranslator",void 0),K(oe(a),"getAdData",void 0),K(oe(a),"getPlayheadTime",void 0),K(oe(a),"getStateData",void 0),K(oe(a),"stateDataTranslator",void 0),K(oe(a),"hlsjs",void 0),K(oe(a),"id",void 0),K(oe(a),"longResumeTracker",void 0),K(oe(a),"minimumRebufferDuration",void 0),K(oe(a),"mux",void 0),K(oe(a),"playbackEventDispatcher",void 0),K(oe(a),"playbackHeartbeat",void 0),K(oe(a),"playbackHeartbeatTime",void 0),K(oe(a),"playheadTime",void 0),K(oe(a),"seekingTracker",void 0),K(oe(a),"sustainedRebufferThreshold",void 0),K(oe(a),"watchTimeTracker",void 0),K(oe(a),"currentFragmentPDT",void 0),K(oe(a),"currentFragmentStart",void 0),a.DOM_CONTENT_LOADED_EVENT_END=Sd.domContentLoadedEventEnd(),a.NAVIGATION_START=Sd.navigationStart();var o={debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(h){return h},emitTranslator:function(){for(var h=arguments.length,f=new Array(h),m=0;m<h;m++)f[m]=arguments[m];return f},stateDataTranslator:function(h){return h}};a.mux=s,a.id=r,n!=null&&n.beaconDomain&&a.mux.log.warn("The `beaconDomain` setting has been deprecated 
14in favor of `beaconCollectionDomain`. Please change your integration to use `beaconCollectionDomain` instead of `beaconDomain`."),n=Object.assign(o,n),n.data=n.data||{},n.data.property_key&&(n.data.env_key=n.data.property_key,delete n.data.property_key),Ce.level=n.debug?cr.DEBUG:cr.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 GA(s,n.data.env_key,n),a.data={player_instance_id:Qa(),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(oe(a));if(a.on("viewinit",function(h,f){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,f),this._initializeViewData(),this.one("play",l),this.one("adbreakstart",l)}),a.on("videochange",function(h,f){this._resetView(f)}),a.on("programchange",function(h,f){this.data.player_is_paused&&this.mux.log.warn("The `programchange` event is intended to be used when the content changes mid playback without the video source changing, however the video is not currently playing. If the video source is changing please use the videochange event otherwise you will lose startup time information."),this._resetView(Object.assign(f,{view_program_changed:!0})),l(),this.emit("play"),this.emit("playing")}),a.on("fragmentchange",function(h,f){this.currentFragmentPDT=f.currentFragmentPDT,this.currentFragmentStart=f.currentFragmentStart}),a.on("destroy",a.destroy),typeof window<"u"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var d=function(){var h=typeof a.data.view_start<"u";a.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",h&&a.mux.WINDOW_HIDDEN&&(a.data.player_is_paused||a.emit("hb"))};window.addEventListener("visibilitychange",d,!1);var u=function(h){h.persisted||a.destroy()};window.addEventListener("pagehide",u,!1),a.on("destroy",function(){window.removeEventListener("visibilitychange",d),window.removeEventListener("pagehide",u)})}a.on("playerready",function(h,f){Object.assign(this.data,f)}),jA.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.mux.PLAYER_TRACKED&&this.NAVIGATION_START&&(this.mux.PLAYER_TRACKED=!0,(this.data.player_init_time||this.DOM_CONTENT_LOADED_EVENT_END)&&(this.data.page_load_time=Math.min(this.data.player_init_time||1/0,this.DOM_CONTENT_LOADED_EVENT_END||1/0)-this.NAVIGATION_START)),this.send("playerready"),delete this.data.player_startup_time,delete this.data.page_load_time};return a.one("playerready",c),a.longResumeTracker=new YA(oe(a)),a.errorTracker=new z_(oe(a)),new yA(oe(a)),a.seekingTracker=new hA(oe(a)),a.playheadTime=new tA(oe(a)),a.playbackHeartbeat=new Y_(oe(a)),new dA(oe(a)),a.watchTimeTracker=new X_(oe(a)),new J_(oe(a)),a.adTracker=new pA(oe(a)),new nA(oe(a)),new sA(oe(a)),new oA(oe(a)),new vA(oe(a)),new VA(oe(a)),n.hlsjs&&a.addHLSJS(n),n.dashjs&&a.addDashJS(n),a.emit("viewinit",n.data),a}return es(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=ol($n(t.prototype),"emit",this)).call.apply(n,[this].concat(ci(o)))}},{key:"destroy",value:function(){this._destroyed||(this._destroyed=!0,typeof this.data.view_start<"u"&&(this.emit
vendor: 17,487 bytes, lines 14-22
14("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=ms(Xa(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++,zA.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=this.getStateData();if(typeof this.stateDataTranslator=="function")try{s=this.stateDataTranslator(s)}catch(r){this.mux.log.warn("Exception in stateDataTranslator translator callback.",r)}Object.assign(this.data,s),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=Qa(),n=function(){r===s.data.view_id&&it(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,U_(this.mux,this.id,s.hlsjs,{},s.Hls||window.Hls)}},{key:"removeHLSJS",value:function(){this.hlsjs&&($_(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,G_(this.mux,this.id,s.dashjs)}},{key:"removeDashJS",value:function(){this.dashjs&&(K_(this.dashjs),this.dashjs=void 0)}}]),t})(W_),XA=QA,Jn=Yt(Rv());function ZA(){return Jn.default&&!!(Jn.default.fullscreenElement||Jn.default.webkitFullscreenElement||Jn.default.mozFullScreenElement||Jn.default.msFullscreenElement)}var JA=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],eS={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};function tS(i,e,t){var s=ms(Ad(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:ZA(),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 b=r.getStartDate();if(b&&typeof b.getTime=="function"&&b.getTime()){var A=b.getTime();if(y.player_program_time=A+g,r.seekable.length>0){var L=A+r.seekable.end(r.seekable.length-1);y.player_live_edge_program_time=L}}}return y}};t=Object.assign(u,t,c),t.data=Object.assign({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:i.VERSION},t.data),r.mux=r.mux||{},r.mux.deleted=!1,r.mux.emit=function(f,m){i.emit(n,f,m)},r.mux.updateData=function(f){r.mux.emit("hb",f)};var h=function(){o.error("The monitor for this video element has already been destroyed.")};r.mux.destroy=function(){Object.keys(r.mux.listeners).forEach(function(f){r.removeEventListener(f,r.mux.listeners[f],!1)}),delete r.mux.listeners,r.mux.destroy=h,r.mux.swapElement=h,r.mux.emit=h,r.mux.addHLSJS=h,r.mux.addDashJS=h,r.mux.removeHLSJS=h,r.mux.removeDashJS=h,r.mux.updateData=h,r.mux.setEmitTranslator=h,r.mux.setStateDataTranslator=h,r.mux.setGetPlayheadTime=h,r.mux.deleted=!0,i.emit(n,"destroy")},r.mux.swapElement=function(f){var m=ms(Ad(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={},JA.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=eS[r.error.code]||r.error.message}i.emit(n,f,m)},r.addEventListener(f,r.mux.listeners[f],!1))})}function iS(i,e,t,s){var r=s;if(i&&typeof i[e]=="function")try{r=i[e].apply(i,t)}catch(n){Ce.info("safeCall error",n)}return r}var Na=Yt(Ti()),qr;Na.default&&Na.default.WeakMap&&(qr=new WeakMap);function sS(i,e){if(!i||!e||!Na.default||typeof Na.default.getComputedStyle!="function")return"";var t;return qr&&qr.has(i)&&(t=qr.get(i)),t||(t=Na.default.getComputedStyle(i,null),qr&&qr.set(i,t)),t.getPropertyValue(e)}function rS(i){return Math.floor(i*1e3)}var zs={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"},cu=function(i){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(i),this.manifest};cu.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)};cu.prototype.processLine=function(i){var e=i.indexOf(":"),t=lS(i,e),s=t[0],r=t.length===2?Rf(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 zs.TARGET_DURATION:{if(!isFinite(r)||r<0)return;this.manifest.targetDuration=r,this.setHoldBack();break}case zs.PART_INF:{Gu(this.manifest,t),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break}case zs.SERVER_CONTROL:{Gu(this.manifest,t),this.setHoldBack();break}case zs.INF:{r===0?this.currentUri.duration=.01:r>0&&(this.currentUri.duration=r);break}case zs.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 zs.VERSION:{Gu(this.manifest,t);break}case zs.SESSION_DATA:{var o=dS(t[1]),l=Cv(o);Object.assign(this.manifest.sessionData,l)}}};cu.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 Gu=function(i,e){var t=Bv(e[0].replace("#EXT-X-","")),s;oS(e[1])?(s={},s=Object.assign(aS(e[1]),s)):s=Rf(e[1]),i[t]=s},Bv=function(i){return i.toLowerCase().replace(/-(\w)/g,function(e){return e[1].toUpperCase()})},Rf=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},nS=function(i){var e={},t=i.split("=");if(t.length>1){var s=Bv(t[0]);e[s]=Rf(t[1])}return e},aS=function(i){for(var e=i.split(","),t={},s=0;e.length>s;s++){var r=e[s],n=nS(r);t=Object.assign(n,t)}return t},oS=function(i){return i.indexOf("=")>-1},lS=function(i,e){return e===-1?[i]:[i.substring(0,e),i.substring(e+1)]},dS=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}}},uS=cu,cS={safeCall:iS,safeIncrement:it,getComputedStyle:sS,secondsToMs:rS,assign:Object.assign,headersStringToObject:Lf,cdnHeadersToRequestId:Ld,extractHostnameAndDomain:Xa,extractHostname:vi,manifestParser:uS,generateShortID:kv,generateUUID:Qa,now:st.now,findMediaElement:Ad},hS=cS,fS={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"},mS=fS,pS="mux-embed",gS="5.9.0",vS="2.1",Ze={},Bs=function(i){var e=arguments;typeof i=="string"?Bs.hasOwnProperty(i)?Oa.default.setTimeout(function(){e=Array.prototype.splice.call(e,1),Bs[i].apply(null,e)},0):Ce.warn("`"+i+"` is an unknown task"):typeof i=="function"?Oa.default.setTimeout(function(){i(Bs)},0):Ce.warn("`"+i+"` is invalid.")},ES={loaded:st.now(),NAME:pS,VERSION:gS,API_VERSION:vS,PLAYER_TRACKED:!1,monitor:function(i,e){return tS(Bs,i,e)},destroyMonitor:function(i){var e=ms(Ad(i),1),t=e[0];t&&t.mux&&typeof t.mux.destroy=="function"?t.mux.destroy():Ce.error("A video element monitor for `"+i+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(i,e){var t=ui(i);Ze[t]?Ze[t].addHLSJS(e):Ce.error("A monitor for `"+t+"` has not been initialized.")},addDashJS:function(i,e){var t=ui(i);Ze[t]?Ze[t].addDashJS(e):Ce.error("A monitor for `"+t+"` has not been initialized.")},removeHLSJS:function(i){var e=ui(i);Ze[e]?Ze[e].removeHLSJS():Ce.error("A monitor for `"+e+"` has not been initialized.")},removeDashJS:function(i){var e=ui(i);Ze[e]?Ze[e].removeDashJS():Ce.error("A monitor for `"+e+"` has not been initialized.")},init:function(i,e){Mc()&&e&&e.respectDoNotTrack&&Ce.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var t=ui(i);Ze[t]=new XA(Bs,t,e)},emit:function(i,e,t){var s=ui(i);Ze[s]?(Ze[s].emit(e,t),e==="destroy"&&delete Ze[s]):Ce.error("A monitor for `"+s+"` has not been initialized.")},updateData:function(i,e){var t=ui(i);Ze[t]?Ze[t].emit("hb",e):Ce.error("A monitor for `"+t+"` has not been initialized.")},setEmitTranslator:function(i,e){var t=ui(i);Ze[t]?Ze[t].emitTranslator=e:Ce.error("A monitor for `"+t+"` has not been initialized.")},setStateDataTranslator:function(i,e){var t=ui(i);Ze[t]?Ze[t].stateDataTranslator=e:Ce.error("A monitor for `"+t+"` has not been initialized.")},setGetPlayheadTime:function(i,e){var t=ui(i);Ze[t]?Ze[t].getPlayheadTime=e:Ce.error("A monitor for `"+t+"` has not been initialized.")},checkDoNotTrack:Mc,log:Ce,utils:hS,events:mS,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(Bs,ES);typeof Oa.default<"u"&&typeof Oa.default.addEventListener=="function"&&Oa.default.addEventListener("pagehide",function(i){i.persisted||(Bs.WINDOW_UNLOADING=!0)},!1);var xf=Bs;/*!
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 z=Number.isFinite||function(i){return typeof i=="number"&&isFinite(i)},yS=Number.isSafeInteger||function(i){return typeof i=="number"&&Math.abs(i)<=TS},TS=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: 7,918 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 me={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},X={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class Pr{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 bS{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 Pr(e),this.fast_=new Pr(t),this.defaultTTFB_=r,this.ttfb_=new Pr(e)}update(e,t){const{slow_:s,fast_:r,ttfb_:n}=this;s.halfLife!==e&&(this.slow_=new Pr(e,s.getEstimate(),s.getTotalWeight())),r.halfLife!==t&&(this.fast_=new Pr(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new Pr(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 _S(i,e,t){return(e=SS(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function De(){return De=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},De.apply(null,arguments)}function Lp(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 Le(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Lp(Object(t),!0).forEach(function(s){_S(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Lp(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function AS(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 SS(i){var e=AS(i,"string");return typeof e=="symbol"?e:e+""}class ri{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=Ms,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 Ms=function(){},IS={trace:Ms,debug:Ms,log:Ms,warn:Ms,info:Ms,error:Ms};function Nc(){return De({},IS)}function LS(i,e){const t=self.console[i];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${i}] >`):Ms}function Rp(i,e,t){return e[i]?e[i].bind(e):LS(i,t)}const Uc=Nc();function RS(i,e,t){const s=Nc();if(typeof console=="object"&&i===!0||typeof i=="object"){const r=["debug","log","info","warn","error"];r.forEach(n=>{s[n]=Rp(n,i,t)});try{s.log(`Debug logs enabled for "${e}" in hls.js version 1.6.15`)}catch{return Nc()}r.forEach(n=>{Uc[n]=Rp(n,i)})}else De(Uc,s);return s}const Re=Uc;function Ks(i=!0){return typeof self>"u"?void 0:(i||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function xS(i){return typeof self<"u"&&i===self.ManagedMediaSource}function Hv(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 qt(i,e=!1){if(typeof TextDecoder<"u"){const d=new TextDecoder("utf-8").decode(i);if(e){const u=d.indexOf("\0");return u!==-1?d.substring(0,u):d}return d.replace(/\0/g,"")}const t=i.length;let s,r,n,a="",o=0;for(;o<t;){if(s=i[o++],s===0&&e)return a;
vendor: 5,508 bytes, line 22
22if(s===0||s===3)continue;switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(s);break;case 12:case 13:r=i[o++],a+=String.fromCharCode((s&31)<<6|r&63);break;case 14:r=i[o++],n=i[o++],a+=String.fromCharCode((s&15)<<12|(r&63)<<6|(n&63)<<0);break}}return a}function Tt(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 Gv(i){return Uint8Array.from(i.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function kS(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ku={exports:{}},xp;function DS(){return xp||(xp=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})()})(Ku)),Ku.exports}var kf=DS();class Df{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 we={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class Kv{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,wS(this,"stats")}setByteRange(e,t){const s=e.split("@",2);let r;s.length===1?r=t?.byteRangeEndOffset||0:r=parseInt(s[1]),this._byteRange=[r,parseInt(s[0])+r]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[we.AUDIO]:null,[we.VIDEO]:null,[we.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 Df),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=kf.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[we.AUDIO]=null,e[we.VIDEO]=null,e[we.AUDIOVIDEO]=null}}function ze(i){return i.sn!=="initSegment"}class Vu extends Kv{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],t=this.byteRange[1];if(z(e)&&z(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const s=Object.keys(t);if(s.length===1){const r=this._decryptdata=t[s[0]]||null;r&&(this._decryptdata=r.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=z(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;
vendor: 3,930 bytes, line 22
22if(this.levelkeys){var t;const s=Object.keys(this.levelkeys),r=s.length;if(r>1||r===1&&(t=this.levelkeys[s[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!z(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return ze(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var s;const r=t[e];r&&!((s=this._decryptdata)!=null&&s.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,s,r,n,a=!1){const{elementaryStreams:o}=this,l=o[e];if(!l){o[e]={startPTS:t,endPTS:s,startDTS:r,endDTS:n,partial:a};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,s),l.startDTS=Math.min(l.startDTS,r),l.endDTS=Math.max(l.endDTS,n)}}let CS=class extends Kv{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 Vv(i,e){const t=Object.getPrototypeOf(i);if(t){const s=Object.getOwnPropertyDescriptor(t,e);return s||Vv(t,e)}}function wS(i,e){const t=Vv(i,e);t&&(t.enumerable=!0,Object.defineProperty(i,e,t))}const kp=Math.pow(2,32)-1,MS=[].push,Wv={video:1,audio:2,id3:3,text:4};function dt(i){return String.fromCharCode.apply(null,i)}function qv(i,e){const t=i[e]<<8|i[e+1];return t<0?65536+t:t}function le(i,e){const t=Yv(i,e);return t<0?4294967296+t:t}function Dp(i,e){let t=le(i,e);return t*=Math.pow(2,32),t+=le(i,e+4),t}function Yv(i,e){return i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3]}function PS(i){const e=i.byteLength;for(let t=0;t<e;){const s=le(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 he(i,e){const t=[];if(!e.length)return t;const s=i.byteLength;for(let r=0;r<s;){const n=le(i,r),a=dt(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=he(i.subarray(r+8,o),e.slice(1));l.length&&MS.apply(t,l)}r=o}return t}function OS(i){const e=[],t=i[0];let s=8;const r=le(i,s);s+=4;let n=0,a=0;t===0?(n=le(i,s),a=le(i,s+4),s+=8):(n=Dp(i,s),a=Dp(i,s+8),s+=16),s+=2;let o=i.length+a;const l=qv(i,s);s+=2;for(let d=0;d<l;d++){let u=s;const c=le(i,u);u+=4;const h=c&2147483647;if((c&2147483648)>>>31===1)return Re.warn("SIDX has hierarchical references (not supported)"),null;const m=le(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 jv(i){const e=[],t=he(i,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],a=he(n,["tkhd"])[0];if(a){let o=a[0];const l=le(a,o===0?12:20),d=he(n,["mdia","mdhd"])[0];if(d){o=d[0];const u=le(d,o===0?12:20),c=he(n,["mdia","hdlr"])[0];if(c){const h=dt(c.subarray(8,12)),f={soun:we.AUDIO,vide:we.VIDEO}[h],m=he(n,["mdia","minf","stbl","stsd"])[0],p=NS(m);f?(e[l]={timescale:u,type:f,stsd:p}
vendor: 4,174 bytes, line 22
22,e[f]=Le({timescale:u,id:l},p)):e[l]={timescale:u,type:h,stsd:p}}}}}return he(i,["moov","mvex","trex"]).forEach(r=>{const n=le(r,4),a=e[n];a&&(a.default={duration:le(r,12),flags:le(r,20)})}),e}function NS(i){const e=i.subarray(8),t=e.subarray(86),s=dt(e.subarray(4,8));let r=s,n;const a=s==="enca"||s==="encv";if(a){const d=he(e,[s])[0].subarray(s==="enca"?28:78);he(d,["sinf"]).forEach(c=>{const h=he(c,["schm"])[0];if(h){const f=dt(h.subarray(4,8));if(f==="cbcs"||f==="cenc"){const m=he(c,["frma"])[0];m&&(r=dt(m))}}})}const o=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const l=he(t,["avcC"])[0];l&&l.length>3&&(r+="."+xo(l[1])+xo(l[2])+xo(l[3]),n=Ro(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const l=he(e,[s])[0],d=he(l.subarray(28),["esds"])[0];if(d&&d.length>7){let u=4;if(d[u++]!==3)break;u=Wu(d,u),u+=2;const c=d[u++];if(c&128&&(u+=2),c&64&&(u+=d[u++]),d[u++]!==4)break;u=Wu(d,u);const h=d[u++];if(h===64)r+="."+xo(h);else break;if(u+=12,d[u++]!==5)break;u=Wu(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=he(t,["hvcC"])[0];if(l&&l.length>12){const d=l[1],u=["","A","B","C"][d>>6],c=d&31,h=le(l,2),f=(d&32)>>5?"H":"L",m=l[12],p=l.subarray(6,12);r+="."+u+c,r+="."+US(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=Ro(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{r=Ro(r,t)||r;break}case"vp09":{const l=he(t,["vpcC"])[0];if(l&&l.length>6){const d=l[4],u=l[5],c=l[6]>>4&15;r+="."+Fi(d)+"."+Fi(u)+"."+Fi(c)}break}case"av01":{const l=he(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+"."+Fi(u)+c+"."+Fi(m)+"."+p+"."+g+v+T+"."+Fi(1)+"."+Fi(1)+"."+Fi(1)+"."+0,n=Ro("dav1",t)}break}}return{codec:r,encrypted:a,supplemental:n}}function Ro(i,e){const t=he(e,["dvvC"]),s=t.length?t[0]:he(e,["dvcC"])[0];if(s){const r=s[2]>>1&127,n=s[2]<<5&32|s[3]>>3&31;return i+"."+Fi(r)+"."+Fi(n)}}function US(i){let e=0;for(let t=0;t<32;t++)e|=(i>>t&1)<<31-t;return e>>>0}function Wu(i,e){const t=e+5;for(;i[e++]&128&&e<t;);return e}function xo(i){return("0"+i.toString(16).toUpperCase()).slice(-2)}function Fi(i){return(i<10?"0":"")+i}function $S(i,e){if(!i||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&zv(i,(s,r)=>{const n=s.subarray(8,24);n.some(a=>a!==0)||(Re.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${Tt(n)} -> ${Tt(t)}`),s.set(t,8))})}function FS(i){const e=[];return zv(i,t=>e.push(t.subarray(8,24))),e}function zv(i,e){he(i,["moov","trak"]).forEach(s=>{const r=he(s,["mdia","minf","stbl","stsd"])[0];if(!r)return;const n=r.subarray(8);let a=he(n,["enca"]);const o=a.length>0;o||(a=he(n,["encv"])),a.forEach(l=>{const d=o?l.subarray(28):l.subarray(78);he(d,["sinf"]).forEach(c=>{const h=Qv(c);h&&e(h,o)})})})}function Qv(i){const e=he(i,["schm"])[0];if(e){const t=dt(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const s=he(i,["schi","tenc"])[0];if(s)return s}}}function BS(i,e,t){const s={},r=he(i,["moof","traf"]);for(let n=0;n<r.length;n++){const a=r[n],o=he(a,["tfhd"])[0],l=le(o,4),d=e[l];if(!d)continue;s[l]||(s[l]={start:NaN,duration:0,sampleCount:0,timescale:d.timescale,type:d.type});const u=s[l],c=he(a,["tfdt"])[0];if(c){const y=c[0];let b=le(c,4);y===1&&(b===kp?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(b*=kp+1,b+=le(c,8))),z(b)&&(!z(u.start)||b<u.start)&&(u.start=b)}const h=d.default,f=le(o,0)|h?.flags;let m=h?.duration||0;f&8&&(f&2?m=le(o,12):m=le(o,8));const p=he(a,["trun"]);let g=u.start||0,v=0,T=m;for(let y=0;y<p.length;y++){const b=p[y],A=le(b,4),L=u.sampleCount;u.sampleCount+=A;const S=b[3]&1,R=b[3]&4,x=b[2]&1,I=b[2]&2,M=b[2]&4,F=b[2]&8;let V=8,Y=A;for(S&&(V+=4),R&&A&&(!(b[V+1]&1)&&u.keyFrameIndex===void 0&&(u.keyFrameIndex=L),V+=4,x?(T=le(b,V),V+=4):T=m,I&&(V+=4),F&&(V+=4),g+=T,v+=T,Y--);Y--;)x?(T=le(b,V),V+=4):T=m,I&&(V+=4),M&&(b[V+1]&1||u.keyFrameIndex===void 0&&(u.keyFrameIndex=u.sampleC
vendor: 4,817 bytes, line 22
22ount-(Y+1),u.keyFrameStart=g),V+=4),F&&(V+=4),g+=T,v+=T;!v&&m&&(v+=m*A)}u.duration+=v}if(!Object.keys(s).some(n=>s[n].duration)){let n=1/0,a=0;const o=he(i,["sidx"]);for(let l=0;l<o.length;l++){const d=OS(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&&z(a)&&Object.keys(s).forEach(l=>{s[l].duration||(s[l].duration=a*s[l].timescale-s[l].start)})}return s}function HS(i){const e={valid:null,remainder:null},t=he(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 Cp(i,e){const t=[],s=e.samples,r=e.timescale,n=e.id;let a=!1;return he(s,["moof"]).map(l=>{const d=l.byteOffset-8;he(l,["traf"]).map(c=>{const h=he(c,["tfdt"]).map(f=>{const m=f[0];let p=le(f,4);return m===1&&(p*=Math.pow(2,32),p+=le(f,8)),p/r})[0];return h!==void 0&&(i=h),he(c,["tfhd"]).map(f=>{const m=le(f,4),p=le(f,0)&16777215,g=(p&1)!==0,v=(p&2)!==0,T=(p&8)!==0;let y=0;const b=(p&16)!==0;let A=0;const L=(p&32)!==0;let S=8;m===n&&(g&&(S+=8),v&&(S+=4),T&&(y=le(f,S),S+=4),b&&(A=le(f,S),S+=4),L&&(S+=4),e.type==="video"&&(a=hu(e.codec)),he(c,["trun"]).map(R=>{const x=R[0],I=le(R,0)&16777215,M=(I&1)!==0;let F=0;const V=(I&4)!==0,Y=(I&256)!==0;let H=0;const N=(I&512)!==0;let W=0;const B=(I&1024)!==0,j=(I&2048)!==0;let ee=0;const U=le(R,4);let $=8;M&&(F=le(R,$),$+=4),V&&($+=4);let ne=F+d;for(let pe=0;pe<U;pe++){if(Y?(H=le(R,$),$+=4):H=y,N?(W=le(R,$),$+=4):W=A,B&&($+=4),j&&(x===0?ee=le(R,$):ee=Yv(R,$),$+=4),e.type===we.VIDEO){let ue=0;for(;ue<W;){const fe=le(s,ne);if(ne+=4,GS(a,s[ne])){const nt=s.subarray(ne,ne+fe);Cf(nt,a?2:1,i+ee/r,t)}ne+=fe,ue+=fe+4}}i+=H/r}}))})})}),t}function hu(i){if(!i)return!1;const e=i.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function GS(i,e){if(i){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Cf(i,e,t,s){const r=Xv(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){Re.error(`Malformed SEI payload. ${o} is too small, only ${d} bytes left to parse.`);break}if(a===4){if(r[u++]===181){const h=qv(r,u);if(u+=2,h===49){const f=le(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 b=1;b<T;b++)y[b]=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:qt(f),userDataBytes:f})}}}function Xv(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 KS(i){const e=i[0];let t="",s="",r=0,n=0,a=0,o=0,l=0,d=0;if(e===0){for(;dt(i.subarray(d,d+1))!=="\0";)t+=dt(i.subarray(d,d+1)),d+=1;for(t+=dt(i.subarray(d,d+1)),d+=1;dt(i.subarray(d,d+1))!=="\0";)s+=dt(i.subarray(d,d+1)),d+=1;s+=dt(i.subarray(d,d+1)),d+=1,r=le(i,12),n=le(i,16),o=le(i,20),l=le(i,24),d=28}else if(e===1){d+=4,r=le(i,d),d+=4;const c=le(i,d);d+=4;const h=le(i,d);for(d+=4,a=2**32*c+h,yS(a)||(a=Number.MAX_SAFE_INTEGER,Re.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=le(i,d),d+=4,l=le(i,d),d+=4;dt(i.subarray(d,d+1))!=="\0";)t+=dt(i.subarray(d,d+1)),d+=1;for(t+=dt(i.subarray(d,d+1)),d+=1;dt(i.subarray(d,d+1))!=="\0";)s+=dt(i.subarray(d,d+1)),d+=1;s+=dt(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 VS(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 WS(i,e,t){if(i.byteLength!==16)throw new RangeError("Invalid system id");let s,r;s=0,r=new Uint8Array;let n;s>0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const a=new Uint8Array(4);return t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),VS([112,115,115,104],new Uint8Array([s,0,0,0]),i,n,r,a,t)}function qS(i){const e=[];
vendor: 14,181 bytes, line 22
22if(i instanceof ArrayBuffer){const t=i.byteLength;let s=0;for(;s+32<t;){const r=new DataView(i,s),n=YS(r);e.push(n),s+=n.size}}return e}function YS(i){const e=i.getUint32(0),t=i.byteOffset,s=i.byteLength;if(s<e)return{offset:t,size:s};if(i.getUint32(4)!==1886614376)return{offset:t,size:e};const n=i.getUint32(8)>>>24;if(n!==0&&n!==1)return{offset:t,size:e};const a=i.buffer,o=Tt(new Uint8Array(a,t+12,16));let l=null,d=null,u=0;if(n===0)u=28;else{const h=i.getUint32(28);if(!h||s<32+h*16)return{offset:t,size:e};l=[];for(let f=0;f<h;f++)l.push(new Uint8Array(a,t+32+f*16,16));u=32+h*16}if(!u)return{offset:t,size:e};const c=i.getUint32(u);return e-32<c?{offset:t,size:e}:(d=new Uint8Array(a,t+u+4,c),{version:n,systemId:o,kids:l,data:d,offset:t,size:e})}const Zv=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Fn={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function wf(i,e){const t=Fn[e];return!!t&&!!t[i.slice(0,4)]}function Za(i,e,t=!0){return!i.split(",").some(s=>!Mf(s,e,t))}function Mf(i,e,t=!0){var s;const r=Ks(t);return(s=r?.isTypeSupported(Ja(i,e)))!=null?s:!1}function Ja(i,e){return`${e}/mp4;codecs=${i}`}function wp(i){if(i){const e=i.substring(0,4);return Fn.video[e]}return 2}function Rd(i){const e=Zv();return i.split(",").reduce((t,s)=>{const n=e&&hu(s)?9:Fn.video[s];return n?(n*2+t)/(t?3:2):(Fn.audio[s]+t)/(t?2:1)},0)}const qu={};function jS(i,e=!0){if(qu[i])return qu[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(Mf(t[r],"audio",e))return qu[i]=t[r],t[r];if(t[r]==="mp3"&&(s=Ks(e))!=null&&s.isTypeSupported("audio/mpeg"))return""}return i}const zS=/flac|opus|mp4a\.40\.34/i;function xd(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++)wf(s[r],"video")||t.push(s[r])}return e&&t.push(e),t.join(",")}function ll(i,e){if(i&&(i.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(i)!==-1)&&(Mp(i,"audio")||Mp(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 Mp(i,e){return wf(i,e)&&Mf(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 Pp(i){const e=Ks(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 $c(i){return i.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const JS={supported:!0,powerEfficient:!0,smooth:!0},e1={supported:!1,smooth:!1,powerEfficient:!1},Jv={supported:!0,configurations:[],decodingInfoResults:[JS]};function eE(i,e){return{supported:!1,configurations:e,decodingInfoResults:[e1],error:i}}function t1(i,e,t,s,r,n){const a=i.videoCodec,o=i.audioCodec?i.audioGroups:null,l=n?.audioCodec,d=n?.channels,u=d?parseInt(d):l?1/0:2;let c=null;if(o!=null&&o.length)try{o.length===1&&o[0]?c=e.groups[o[0]].channels:c=o.reduce((h,f)=>{if(f){const m=e.groups[f];if(!m)throw new Error(`Audio track group ${f} not found`);Object.keys(m.channels).forEach(p=>{h[p]=(h[p]||0)+m.channels[p]})}return h},{2:0})}catch{return!0}return a!==void 0&&(a.split(",").some(h=>hu(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&&z(u)&&Object.keys(c).some(h=>parseInt(h)>u)}function tE(i,e,t,s={}){const r=i.videoCodec;if(!r&&!i.audioCodec||!t)return Promise.resolve(Jv);const n=[],a=i1(i),o=a.length,l=s1(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=>hu(c))&&Zv())return Promise.resolve(eE(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${u})`),n))}return Promise.all(n.map(u=>{const c=n1(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 i1(i){var e;const t=(e=i.videoCodec)==null?void 0:e.split(","),s=iE(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:Ja(ZS(l),"video"),width:r,height:n,bitrate:s,framerate:a};return o!=="sdr"&&(d.transferFunction=o),d}):[]}function s1(i,e,t){var s;const r=(s=i.audioCodec)==null?void 0:s.split(","),n=iE(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:Ja(f,"audio"),bitrate:t?r1(f,n):n};h&&(m.channels=""+h),u.push(m)})}return u},a):a},[]):[]}function r1(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 iE(i){return Math.ceil(Math.max(i.bitrate*.9,i.averageBitrate)/1e3)*1e3||1}function n1(i){let e="";const{audio:t,video:s}=i;if(s){const r=$c(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=$c(t.contentType);e+=`${s?"_":""}${r}_c${t.channels}`}return e}const Fc=["NONE","TYPE-0","TYPE-1",null];function a1(i){return Fc.indexOf(i)>-1}const kd=["SDR","PQ","HLG"];function o1(i){return!!i&&kd.indexOf(i)>-1}var dl={No:"",Yes:"YES",v2:"v2"};function Op(i){const{canSkipUntil:e,canSkipDateRanges:t,age:s}=i,r=s<e/2;return e&&r?t?dl.v2:dl.Yes:dl.No}class Np{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 eo{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 Up(this._audioGroups,e)}hasSubtitleGroup(e){return Up(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 Up(i,e){return!e||!i?!1:i.indexOf(e)!==-1}function l1(){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 d1(i,e){let t=!1,s=[];if(i&&(t=i!=="SDR",s=[i]),e){s=e.allowedVideoRanges||kd.slice(0);const r=s.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:r&&l1(),t||(s=["SDR"])}return{preferHDR:t,allowedVideoRanges:s}}const u1=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}},Me=(i,e)=>JSON.stringify(i,u1(e));function c1(i,e,t,s,r){const n=Object.keys(i),a=s?.channels,o=s?.audioCodec,l=r?.videoCodec,d=a&&parseInt(a)===2;let u=!1,c=!1,h=1/0,f=1/0,m=1/0,p=1/0,g=0,v=[];const{preferHDR:T,allowedVideoRanges:y}=d1(e,r);for(let R=n.length;R--;){const x=i[n[R]];u||(u=x.channels[2]>0),h=Math.min(h,x.minHeight),f=Math.min(f,x.minFramerate),m=Math.min(m,x.minBitrate),y.filter(M=>x.videoRanges[M]>0).length>0&&(c=!0)}h=z(h)?h:0,f=z(f)?f:0;const b=Math.max(1080,h),A=Math.max(30,f);m=z(m)?m:t,t=Math.max(m,t),c||(e=void 0);const L=n.length>1;return{codecSet:n.reduce((R,x)=>{const I=i[x];if(x===R)return R;if(v=c?y.filter(M=>I.videoRanges[M]>0):[],L){if(I.minBitrate>t)return _i(x,`min bitrate of ${I.minBitrate} > current estimate of ${t}`),R;if(!I.hasDefaultAudio)return _i(x,"no renditions with default or auto-select sound found"),R;if(o&&x.indexOf(o.substring(0,4))%5!==0)return _i(x,`audio codec preference "${o}" not found`),R;if(a&&!d){if(!I.channels[a])return _i(x,`no renditions with ${a} channel sound found (channels options: ${Object.keys(I.channels)})`),R}else if((!o||d)&&u&&I.channels[2]===0)return _i(x,"no renditions with stereo sound found"),R;if(I.minHeight>b)return _i(x,`min resolution of ${I.minHeight} > maximum of ${b}`),R;if(I.minFramerate>A)return _i(x,`min framerate of ${I.minFramerate} > maximum of ${A}`),R;if(!v.some(M=>I.videoRanges[M]>0))return _i(x,`no variants with VIDEO-RANGE of ${Me(v)} found`),R;if(l&&x.indexOf(l.substring(0,4))%5!==0)return _i(x,`video codec preference "${l}" not found`),R;if(I.maxScore<g)return _i(x,`max score of ${I.maxScore} < selected max of ${g}`),R}return R&&(Rd(x)>=Rd(R)||I.fragmentError>i[R].fragmentError)?R:(p=I.minIndex,g=I.maxScore,x)},void 0),videoRanges:v,preferHDR:T,minFramerate:f,minBitrate:m,minIndex:p}}function _i(i,e){Re.log(`[abr] start candidates with "${i}" ignored because ${e}`)}function sE(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 h1(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 $p(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 Wi(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(yr(i,r,t))return s}return-1}function yr(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||f1(n,e.lang))&&(n===void 0||e.assocLang===a)&&(o===void 0||e.default===o)&&(l===void 0||e.forced===l)&&(!("characteristics"in i)||m1(i.characteristics||"",e.characteristics))&&(t===void 0||t(i,e))}function f1(i,e="--"){return i.length===e.length?i===e:i.startsWith(e)||e.startsWith(i)}function m1(i,e=""){const t=i.split(","),s=e.split(",");return t.length===s.length&&!t.some(r=>s.indexOf(r)===-1)}function tr(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 p1(i,e,t,s,r){const n=e[s],o=e.reduce((h,f,m)=>{const p=f.uri;
vendor: 8,951 bytes, lines 22-32
22return(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=Fp(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 Wi(i,m,r)>-1});return c>-1?c:Fp(e,s,h=>{const f=h.audioGroups,m=t.filter(p=>!f||f.indexOf(p.groupId)!==-1);return Wi(i,m,r)>-1})}function Fp(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 Dd(i,e){var t;return!!i&&i!==((t=e.loadLevelObj)==null?void 0:t.uri)}class g1 extends ri{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var s;const{fragCurrent:r,partCurrent:n,hls:a}=this,{autoLevelEnabled:o,media:l}=a;if(!r||!l)return;const d=performance.now(),u=n?n.stats:r.stats,c=n?n.duration:r.duration,h=d-u.loading.start,f=a.minAutoLevel,m=r.level,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(),b=Math.abs(l.playbackRate);if(h<=Math.max(y,1e3*(c/(b*2))))return;const A=T?T.len/b:0,L=u.loading.first?u.loading.first-u.loading.start:-1,S=u.loaded&&L>-1,R=this.getBwEstimate(),x=a.levels,I=x[m],M=Math.max(u.loaded,Math.round(c*(r.bitrate||I.averageBitrate)/8));let F=S?h-L:h;F<1&&S&&(F=Math.min(h,u.loaded*8/R));const V=S?u.loaded*1e3/F:0,Y=y/1e3,H=V?(M-u.loaded)/V:M*8/R+Y;if(H<=A)return;const N=V?V*8:R,W=((s=t?.details||this.hls.latestLevelDetails)==null?void 0:s.live)===!0,B=this.hls.config.abrBandWidthUpFactor;let j=Number.POSITIVE_INFINITY,ee;for(ee=m-1;ee>f;ee--){const pe=x[ee].maxBitrate,ue=!x[ee].details||W;if(j=this.getTimeToLoadFrag(Y,N,c*pe,ue),j<Math.min(A,c+Y))break}if(j>=H||j>c*10)return;S?this.bwEstimator.sample(h-Math.min(y,L),u.loaded):this.bwEstimator.sampleTTFB(h);const U=x[ee].maxBitrate;this.getBwEstimate()*B>U&&this.resetEstimator(U);const $=this.findBestLevel(U,f,ee,0,A,1,1);$>-1&&(ee=$),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: ${A.toFixed(3)} s
25      Estimated load time for current fragment: ${H.toFixed(3)} s
26      Estimated load time for down switch fragment: ${j.toFixed(3)} s
27      TTFB estimate: ${L|0} ms
28      Current BW estimate: ${z(R)?R|0:"Unknown"} bps
29      New BW estimate: ${this.getBwEstimate()|0} bps
30      Switching to level ${ee} @ ${U|0} bps`),a.nextLoadLevel=a.nextAutoLevel=ee,this.clearTimer();const ne=()=>{if(this.clearTimer(),this.fragCurrent===r&&this.hls.loadLevel===ee&&ee>0){const pe=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: ${pe.toFixed(3)} s`),r.abortRequests(),this.fragCurrent=this.partCurrent=null,ee>f){let ue=this.findBestLevel(this.hls.levels[f].bitrate,f,ee,0,pe,1,1);ue===-1&&(ue=f),this.hls.nextLoadLevel=this.hls.nextAutoLevel=ue,this.resetEstimator(this.hls.levels[ue].bitrate)}}};g||H>j*2?ne():this.timer=self.setInterval(ne,j*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 bS(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;if(!this.ignoreFragment(s)){if(!s.bitrateTest){var r;this.fragCurrent=s,this.partCurrent=(r=t.part)!=null?r:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case 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;z(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?.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),b=g===-1||u===-1;let A,L="SDR",S=T?.frameRate||0;const{audioPreference:R,videoPreference:x}=v,I=this.audioTracksByGroup||(this.audioTracksByGroup=sE(p));let M=-1;if(b){if(this.firstSelection!==-1)return this.firstSelection;const N=this.codecTiers||(this.codecTiers=h1(m,I,t,s)),W=c1(N,L,e,R,x),{codecSet:B,videoRanges:j,minFramerate:ee,minBitrate:U,minIndex:$,preferHDR:ne}=W;M=$,A=B,L=ne?j[j.length-1]:j[0],S=ee,e=Math.max(e,U),this.log(`picked start tier ${Me(W)}`)}else A=T?.codecSet,L=T?.videoRange;const F=f?f.duration:h?h.duration:0,V=this.bwEstimator.getEstimateTTFB()/1e3,Y=[];for(let N=s;N>=t;N--){var H;const W=m[N],B=N>c;if(!W)continue;if(v.useMediaCapabilities&&!W.supportedResult&&!W.supportedPromise){const ue=navigator.mediaCapabilities;typeof ue?.decodingInfo=="function"&&t1(W,I,L,S,e,R)?(W.supportedPromise=tE(W,I,ue,this.supportedCache),W.supportedPromise.then(fe=>{if(!this.hls)return;W.supportedResult=fe;const nt=this.hls.levels,Qe=nt.indexOf(W);fe.error?this.warn(`MediaCapabilities decodingInfo error: "${fe.error}" for level ${Qe} ${Me(fe)}`):fe.supported?fe.decodingInfoResults.some(It=>It.smooth===!1||It.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${Qe} not smooth or powerEfficient: ${Me(fe)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Qe} ${Me(fe)}`),Qe>-1&&nt.length>1&&(this.log(`Removing unsupported level ${Qe}`),this.hls.removeLevel(Qe),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(fe=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${fe}`)})):W.supportedResult=Jv}if((A&&W.codecSet!==A||L&&W.videoRange!==L||B&&S>W.frameRate||!B&&S>0&&S<W.frameRate||(H=W.supportedResult)!=null&&(H=H.decodingInfoResults)!=null&&H.some(ue=>ue.smooth===!1))&&(!b||N!==M)){Y.push(N);continue}const j=W.details,ee=(f?j?.partTarget:j?.averagetargetduration)||F;let U;B?U=o*e:U=a*e;const $=F&&r>=F*2&&n===0?W.averageBitrate:W.maxBitrate,ne=this.getTimeToLoadFrag(V,U,$*ee,j===void 0);if(U>=$&&(N===u||W.loadError===0&&W.fragmentError===0)&&(ne<=V||!z(ne)||y&&!this.bitrateTestDelay||ne<d)){const ue=this.forcedAutoLevel;return N!==g&&(ue===-1||ue!==g)&&(Y.length&&this.trace(`Skipped level(s) ${Y.join(",")} of ${s} max with CODECS and VIDEO-RANGE:"${m[Y[0]].codecs}" ${m[Y[0]].videoRange}; not compatible with "${A}" ${L}`),this.info(`switch candidate:${c}->${N} adjustedbw(${Math.round(U)})-bitrate=${Math.round(U-$)} ttfb:${V.toFixed(1)} avgDuration:${ee.toFixed(1)} maxFetchDuration:${d.toFixed(1)} fetchDuration:${ne.toFixed(1)}
32 firstSelection:${b} codecSet:${W.codecSet} videoRange:${W.videoRange} hls.loadLevel:${g}`)),b&&(this.firstSelection=N),N}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:s}=this.hls;return Math.min(Math.max(e,s),t)}}const rE={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 v1(i,e,t){if(e===null||!Array.isArray(i)||!i.length||!z(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(y1(e,t,a))return a}return null}function Rr(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)&&Bp(t,s,n)===0||E1(n,i,Math.min(r,s))))return n;const a=rE.search(e,Bp.bind(null,t,s));return a&&(a!==i||!n)?a:n}function E1(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 Bp(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 y1(i,e,t){const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-s>i}function nE(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 rE.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 Cd(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 aE(i){return i.details.startsWith("key")}function oE(i){return aE(i)&&!!i.frag&&!i.frag.decryptdata}function Hp(i,e){const t=Cd(e);return i.default[`${t?"timeout":"error"}Retry`]}function Pf(i,e){const t=i.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*i.retryDelayMs,i.maxRetryDelayMs)}function Gp(i){return Le(Le({},i),{errorRetry:null,timeoutRetry:null})}function wd(i,e,t,s){if(!i)return!1;const r=s?.code,n=e<i.maxNumRetry&&(T1(r)||!!t);return i.shouldRetry?i.shouldRetry(i,e,t,s,n):n}function T1(i){return Bc(i)||!!i&&(i<400||i>499)}function Bc(i){return i===0&&navigator.onLine===!1}var yt={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},Bt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4};class b1 extends ri{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(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}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===X.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,s=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||s===-1?t.loadLevel:s}variantHasKey(e,t){if(e){var s;if((s=e.details)!=null&&s.hasKey(t))return!0;const r=e.audioGroups;if(r)return this.hls.allAudioTracks.filter(a=>r.indexOf(a.groupId)>=0).some(a=>{var o;return(o=a.details)==null?void 0:o.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var s;if(t.fatal)return;const r=this.hls,n=t.context;switch(t.details){case 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=In();return}case w.FRAG_GAP:case w.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=yt.SendAlternateToPenaltyBox;return}case w.LEVEL_EMPTY_ERROR:case w.LEVEL_PARSING_ERROR:{var a;const l=t.parent===X.MAIN?t.level:r.loadLevel;t.details===w.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(a=a.levelDetails)!=null&&a.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,l):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,l))}return;case w.LEVEL_LOAD_ERROR:case w.LEVEL_LOAD_TIMEOUT:typeof 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 l=r.loadLevelObj;if(l&&(n.type===me.AUDIO_TRACK&&l.hasAudioGroup(n.groupId)||n.type===me.SUBTITLE_TRACK&&l.hasSubtitleGroup(n.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=yt.SendAlternateToPenaltyBox,t.errorAction.flags=Bt.MoveAllAlternatesMatchingHost;return}}return;case w.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:yt.SendAlternateToPenaltyBox,flags:Bt.MoveAllAlternatesMatchingHDCP};return;case w.KEY_SYSTEM_SESSION_UPDATE_FAILED:case w.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case w.KEY_SYSTEM_NO_SESSION:t.errorAction={action:yt.SendAlternateToPenaltyBox,flags:Bt.MoveAllAlternatesMatchingKey};return;
vendor: 6,528 bytes, line 32
32case w.BUFFER_ADD_CODEC_ERROR:case w.REMUX_ALLOC_ERROR:case w.BUFFER_APPEND_ERROR:if(!t.errorAction){var o;t.errorAction=this.getLevelSwitchAction(t,(o=t.level)!=null?o: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=In();return}t.type===te.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=In())}getPlaylistRetryOrSwitchAction(e,t){const s=this.hls,r=Hp(s.config.playlistLoadPolicy,e),n=this.playlistError++;if(wd(r,n,Cd(e),e.response))return{action:yt.RetryRequest,flags:Bt.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=Hp(aE(e)?a:n,e),l=t.levels.reduce((u,c)=>u+c.fragmentError,0);if(r&&(e.details!==w.FRAG_GAP&&r.fragmentError++,!oE(e)&&wd(o,l,Cd(e),e.response)))return{action:yt.RetryRequest,flags:Bt.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:L})=>r.audioCodec!==L),y=e.sourceBufferName==="video"&&(d===w.BUFFER_ADD_CODEC_ERROR||d===w.BUFFER_APPEND_ERROR)&&c.some(({codecSet:L,audioCodec:S})=>r.codecSet!==L&&r.audioCodec===S),{type:b,groupId:A}=(a=e.context)!=null?a:{};for(let L=c.length;L--;){const S=(L+h)%c.length;if(S!==h&&S>=f&&S<=m&&c[S].loadError===0){var o,l;const R=c[S];if(d===w.FRAG_GAP&&p===X.MAIN&&e.frag){const x=c[S].details;if(x){const I=Rr(e.frag,x.fragments,e.frag.start);if(I!=null&&I.gap)continue}}else{if(b===me.AUDIO_TRACK&&R.hasAudioGroup(A)||b===me.SUBTITLE_TRACK&&R.hasSubtitleGroup(A))continue;if(p===X.AUDIO&&(o=r.audioGroups)!=null&&o.some(x=>R.hasAudioGroup(x))||p===X.SUBTITLE&&(l=r.subtitleGroups)!=null&&l.some(x=>R.hasSubtitleGroup(x))||v&&r.audioCodec===R.audioCodec||y&&r.codecSet===R.codecSet||!v&&r.codecSet!==R.codecSet)continue}u=S;break}}if(u>-1&&s.loadLevel!==u)return e.levelRetry=!0,this.playlistError=0,{action:yt.SendAlternateToPenaltyBox,flags:Bt.None,nextAutoLevel:u}}return{action:yt.SendAlternateToPenaltyBox,flags:Bt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var s;switch((s=t.errorAction)==null?void 0:s.action){case yt.DoNothing:break;case yt.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}=s,n=s.nextAutoLevel;switch(r){case Bt.None:this.switchLevel(e,n);break;case Bt.MoveAllAlternatesMatchingHDCP:{const l=this.getVariantLevelIndex(e.frag),d=t.levels[l],u=d?.attrs["HDCP-LEVEL"];if(s.hdcpLevel=u,u==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(u){t.maxHdcpLevel=Fc[Fc.indexOf(u)-1],s.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case Bt.MoveAllAlternatesMatchingKey:{const l=e.decryptdata;if(l){const d=this.hls.levels,u=d.length;for(let h=u;h--;)if(this.variantHasKey(d[h],l)){var a,o;this.log(`Banned key found in level ${h} (${d[h].bitrate}bps) or audio group "${(a=d[h].audioGroups)==null?void 0:a.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${Tt(l.keyId||[])}`),d[h].fragmentError++,d[h].loadError++,this.log(`Removing level ${h} with key error (${e.error})`),this.hls.removeLevel(h)}const c=e.frag;if(this.hls.levels.length<u)s.resolved=!0;else if(c&&c.type!==X.MAIN){const h=c.decryptdata;h&&!l.matches(h)&&(s.resolved=!0)}}break}}s.resolved||this.switchLevel(e,n)}switchLevel(e,t){if(t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===w.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const s=$c(e.mimeType),r=this.hls.levels;for(let n=r.length;n--;)r[n][`${e.sourceBufferName}Codec`]===s&&(this.log(`Removing level ${n} for ${e.details} ("${s}" not supported)`),this.hls.removeLevel(n))}}}function In(i){const e={action:yt.DoNothing,flags:Bt.None};return i&&(e.resolved=!0),e}var ut={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class _1{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e&&(e.on(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&&(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.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const s=this.activePartLists[t];if(s)for(let r=s.length;r--;){const n=s[r];if(!n)break;if(n.start<=e&&e<=n.end&&n.loaded)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,s){const{fragments:r}=this,n=Object.keys(r);for(let a=n.length;a--;){const o=r[n[a]];if(o?.body.type===t&&(!s||o.buffered)){const l=o.body;if(l.start<=e&&e<=l.end)return l}}return null}detectEvictedFragments(e,t,s,r,n){this.timeRanges&&(this.timeRanges[e]=t);const a=r?.fragment.sn||-1;
vendor: 24,065 bytes, line 32
32Object.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=Or(s),n=this.fragments[r];if(!n||n.buffered&&s.gap)return;const a=!s.relurl;Object.keys(t).forEach(o=>{const l=s.elementaryStreams[o];if(!l)return;const d=t[o],u=a||l.partial===!0;n.range[o]=this.getBufferedTimes(s,e.part,u,d)}),n.loaded=null,Object.keys(n.range).length?(this.bufferedEnd(n,s),ko(n)||this.removeParts(s.sn-1,s.type)):this.removeFragment(n.body)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){const s=this.activePartLists[t];s&&(this.activePartLists[t]=Kp(s,r=>r.fragment.sn>=e))}fragBuffered(e,t){const s=Or(e);let r=this.fragments[s];!r&&t&&(r=this.fragments[s]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,this.bufferedEnd(r,e))}getBufferedTimes(e,t,s,r){const n={time:[],partial:s},a=e.start,o=e.end,l=e.minEndPTS||o,d=e.maxStartPTS||a;for(let u=0;u<r.length;u++){const c=r.start(u)-this.bufferPadding,h=r.end(u)+this.bufferPadding;if(d>=c&&l<=h){n.time.push({startPTS:Math.max(a,r.start(u)),endPTS:Math.min(o,r.end(u))});break}else if(a<h&&o>c){const f=Math.max(a,r.start(u)),m=Math.min(o,r.end(u));m>f&&(n.partial=!0,n.time.push({startPTS:f,endPTS:m}))}else if(o<=c)break}return n}getPartialFragment(e){let t=null,s,r,n,a=0;const{bufferPadding:o,fragments:l}=this;return Object.keys(l).forEach(d=>{const u=l[d];u&&ko(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||ko(t))}getState(e){const t=Or(e),s=this.fragments[t];return s?s.buffered?ko(s)?ut.PARTIAL:ut.OK:ut.APPENDING:ut.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=Or(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=Or(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,s=Object.keys(t);if(!e)return s.length>0;for(let r=s.length;r--;){const n=t[s[r]];if(n?.body.type===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,s,r,n){r&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o)return;const l=o.body;l.type!==s||r&&!l.gap||l.start<t&&l.end>e&&(o.buffered||n)&&this.removeFragment(l)})}removeFragment(e){const t=Or(e);e.clearElementaryStreamInfo();const s=this.activePartLists[e.type];if(s){const r=e.sn;this.activePartLists[e.type]=Kp(s,n=>n.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(s=>s.clearElementaryStreamInfo())}}function ko(i){var e,t,s;return i.buffered&&!!(i.body.gap||(e=i.range.video)!=null&&e.partial||(t=i.range.audio)!=null&&t.partial||(s=i.range.audiovideo)!=null&&s.partial)}function Or(i){return`${i.type}_${i.level}_${i.sn}`}function Kp(i,e){return i.filter(t=>{const s=e(t);return s||t.clearElementaryStreamInfo(),s})}var Vs={cbc:0,ctr:1};class A1{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 Vs.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Vs.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 S1(i){const e=i.byteLength,t=e&&new DataView(i.buffer).getUint8(e-1);return t?i.slice(0,e-t):i}class I1{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],b=f[y];let A=f[v]*257^v*16843008;r[m]=A<<24|A>>>8,n[m]=A<<16|A>>>16,a[m]=A<<8|A>>>24,o[m]=A,A=b*16843009^y*65537^T*257^m*16843008,d[v]=A<<24|A>>>8,u[v]=A<<16|A>>>16,c[v]=A<<8|A>>>24,h[v]=A,m?(m=T^f[f[f[b^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,b,A,L,S,R,x,I,M,F,V,Y,H,N;const W=this.networkToHostOrderSwap;for(;t<v.length;){for(M=W(v[t]),F=W(v[t+1]),V=W(v[t+2]),Y=W(v[t+3]),S=M^n[0],R=Y^n[1],x=V^n[2],I=F^n[3],H=4,N=1;N<r;N++)y=l[S>>>24]^d[R>>16&255]^u[x>>8&255]^c[I&255]^n[H],b=l[R>>>24]^d[x>>16&255]^u[I>>8&255]^c[S&255]^n[H+1],A=l[x>>>24]^d[I>>16&255]^u[S>>8&255]^c[R&255]^n[H+2],L=l[I>>>24]^d[S>>16&255]^u[R>>8&255]^c[x&255]^n[H+3],S=y,R=b,x=A,I=L,H=H+4;y=a[S>>>24]<<24^a[R>>16&255]<<16^a[x>>8&255]<<8^a[I&255]^n[H],b=a[R>>>24]<<24^a[x>>16&255]<<16^a[I>>8&255]<<8^a[S&255]^n[H+1],A=a[x>>>24]<<24^a[I>>16&255]<<16^a[S>>8&255]<<8^a[R&255]^n[H+2],L=a[I>>>24]<<24^a[S>>16&255]<<16^a[R>>8&255]<<8^a[x&255]^n[H+3],T[t]=W(y^f),T[t+1]=W(L^m),T[t+2]=W(A^p),T[t+3]=W(b^g),f=M,m=F,p=V,g=Y,t=t+4}return T.buffer}}class L1{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=R1(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function R1(i){switch(i){case Vs.cbc:return"AES-CBC";case Vs.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${i}`)}}const x1=16;class Of{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?S1(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!==Vs.cbc||t.byteLength!==16)return Re.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 I1),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 L1(this.subtle,t,r)}return this.fastAesKey.expandKey().then(n=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new A1(this.subtle,new Uint8Array(s),r).decrypt(e.buffer,n)):Promise.reject(new Error("web crypto not initialized"))).catch(n=>(Re.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%x1;return s!==e.length&&(t=e.slice(0,s),this.remainderData=e.slice(s)),t}logOnce(e){this.logEnabled&&(Re.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Vp=Math.pow(2,17);class k1{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 os({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(qp(e));return}else e.gap=!1;const d=this.loader=n?new n(r):new a(r),u=Wp(e);e.loader=d;const c=Gp(r.fragLoadPolicy.default),h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Vp};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 os({type:te.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Le({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 os({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 os({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(qp(e,t));return}const d=this.loader=n?new n(r):new a(r),u=Wp(e,t);e.loader=d;const c=Gp(r.fragLoadPolicy.default),h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Vp};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 os({type:te.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Le({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 os({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 os({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 Wp(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(z(r)&&z(n)){var a;let o=r,l=n;if(i.sn==="initSegment"&&D1((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 qp(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 os(s)}function D1(i){return i==="AES-128"||i==="AES-256"}class os extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class lE extends ri{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 Nf{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=Do(),this.buffering={audio:Do(),video:Do(),audiovideo:Do()},this.level=e,this.sn=t,this.id=s,this.size=r,this.part=n,this.partial=a}}function Do(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Yp={length:0,start:()=>0,end:()=>0};class de{static isBuffered(e,t){if(e){const s=de.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=de.getBuffered(e);return de.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=de.bufferedRanges(e);if(r.length)return de.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||Yp}catch(t){return Re.log("failed to get media.buffered",t),Yp}}}const dE=/\{\$([a-zA-Z0-9-_]+)\}/g;function jp(i){return dE.test(i)}function Hc(i,e){if(i.variableList!==null||i.hasVariableRefs){const t=i.variableList;return e.replace(dE,s=>{const r=s.substring(2,s.length-1),n=t?.[r];return n===void 0?(i.playlistParsingError||(i.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),s):n})}return e}function zp(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 C1(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 w1=/^(\d+)x(\d+)$/,Qp=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Ge{constructor(e,t){typeof e=="string"&&(e=Ge.parseAttrList(e,t)),De(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=w1.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let s;const r={};for(Qp.lastIndex=0;(s=Qp.exec(e))!==null;){const a=s[1].trim();let o=s[2];const l=o.indexOf('"')===0&&o.lastIndexOf('"')===o.length-1;let d=!1;if(l)o=o.slice(1,-1);else switch(a){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":d=!0}if(t&&(l||d))o=Hc(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":Re.warn(`${e}: attribute ${a} is missing quotes`)}r[a]=o}return r}}const M1="com.apple.hls.interstitial";function P1(i){return i!=="ID"&&i!=="CLASS"&&i!=="CUE"&&i!=="START-DATE"&&i!=="DURATION"&&i!=="END-DATE"&&i!=="END-ON-NEXT"}function O1(i){return i==="SCTE35-OUT"||i==="SCTE35-IN"||i==="SCTE35-CMD"}class uE{constructor(e,t,s=0){var r;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=t?.tagAnchor||null,this.tagOrder=(r=t?.tagOrder)!=null?r:s,t){const n=t.attr;for(const a in n)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==n[a]){Re.warn(`DATERANGE tag attribute: "${a}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=a;break}e=De(new Ge({}),n,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const n=t?.endDate||new Date(this.attr["END-DATE"]);z(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?(Re.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(z(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===M1}get isValid(){return!!this.id&&!this._badValueForSameId&&z(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 N1=10;class U1{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.drift
vendor: 4,537 bytes, line 32
32StartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,s=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!s||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&s>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let s=t.decryptdata;return s||(t.setKeyFormat(e.keyFormat),s=t.decryptdata),!!s&&e.matches(s)})}get hasProgramDateTime(){return this.fragments.length?z(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||N1}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let s=e.length;s--;)if(e[s].index>t)return e[s].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function Md(i,e){return i.length===e.length?!i.some((t,s)=>t!==e[s]):!1}function Xp(i,e){return!i&&!e?!0:!i||!e?!1:Md(i,e)}function Ln(i){return i==="AES-128"||i==="AES-256"||i==="AES-256-CTR"}function Uf(i){switch(i){case"AES-128":case"AES-256":return Vs.cbc;case"AES-256-CTR":return Vs.ctr;default:throw new Error(`invalid full segment method ${i}`)}}function $f(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0))}function Gc(i){return Uint8Array.from(unescape(encodeURIComponent(i)),e=>e.charCodeAt(0))}function $1(i){const e=Gc(i).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function cE(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 hE(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=$f(a)):t=$1(a)}}return t}const Pd=typeof self<"u"?self:void 0;var Ke={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},bt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function ul(i){switch(i){case bt.FAIRPLAY:return Ke.FAIRPLAY;case bt.PLAYREADY:return Ke.PLAYREADY;case bt.WIDEVINE:return Ke.WIDEVINE;case bt.CLEARKEY:return Ke.CLEARKEY}}function Yu(i){switch(i){case Ke.FAIRPLAY:return bt.FAIRPLAY;case Ke.PLAYREADY:return bt.PLAYREADY;case Ke.WIDEVINE:return bt.WIDEVINE;case Ke.CLEARKEY:return bt.CLEARKEY}}function ca(i){const{drmSystems:e,widevineLicenseUrl:t}=i,s=e?[Ke.FAIRPLAY,Ke.WIDEVINE,Ke.PLAYREADY,Ke.CLEARKEY].filter(r=>!!e[r]):[];return!s[Ke.WIDEVINE]&&t&&s.push(Ke.WIDEVINE),s}const fE=(function(i){return Pd!=null&&(i=Pd.navigator)!=null&&i.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null})();function F1(i,e,t,s){let r;switch(i){case Ke.FAIRPLAY:r=["cenc","sinf"];break;case Ke.WIDEVINE:case Ke.PLAYREADY:r=["cenc"];break;case Ke.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&&(i.sessionType==="persistent-license"||!!((e=i.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function mE(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=$f(o).subarray(0,16);return cE(l),l}}return null}let Nr={};class Hs{static clearKeyUriToKeyIdMap(){Nr={}}static setKeyIdForUri(e,t){Nr[e]=t}static addKeyIdForUri(e){const t=Object.keys(Nr).length%Number.MAX_SAFE_INTEGER,s=new Uint8Array(16);return new DataView(s.buffer,12,4).setUint32(0,t),Nr[e]=s,s}constructor(e,t,s,r=[1],n=null,a){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=s,this.keyFormatVersions=r,this.iv=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Ln(e),a!=null&&a.startsWith("0x")&&(this.keyId=new Uint8Array(Gv(a)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&Md(e.keyFormatVersions,this.keyFormatVersions)&&Xp(e.iv,this.iv)&&Xp(e.keyId,this.keyId)}isSupported(){if(this.method){if(Ln(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case bt.FAIRPLAY:case bt.WIDEVINE:case bt.PLAYREADY:case bt.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(Ln(this.method)){let n=this.iv;return n||(typeof e!="number"&&(Re.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),n=K1(e)),new Hs(this.method,this.uri,"identity",this.keyFormatVersions,n)}if(this.keyId){const n=Nr[this.uri];if(n&&!Md(this.keyId,n)&&Hs.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const s=hE(this.uri);if(s)switch(this.keyFormat){case bt.WIDEVINE:if(this.pssh=s,!this.keyId){const n=qS(s.buffer);if(n.length){var r;const a=n[0];this.keyId=(r=a.kids)!=null&&r.length?a.kids[0]:null}}this.keyId||(this.keyId=Zp(t));break;case bt.PLAYREADY:{const n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=WS(n,null,s),this.keyId=mE(s);break}default:{let n=s.subarray(0,16);if(n.length!==16){const a=new Uint8Array(16);a.set(n,16-n.length),n=a}this.keyId=n;break}}if(!this.keyId||this.keyId.byteLength!==16){let n;n=G1(t),n||(n=Zp(t),n||(n=Nr[this.uri])),n&&(this.keyId=n,Hs.setKeyIdForUri(this.uri,n))}return this}}function G1(i){const e=i?.[bt.WIDEVINE];return e?e.keyId:null}function Zp(i){const e=i?.[bt.PLAYREADY];if(e){const t=hE(e.uri);if(t)return mE(t)}return null}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 Jp=/#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,eg=/#EXT-X-MEDIA:(.*)/g,V1=/^#EXT(?:INF|-X-TARGETDURATION):/m,ju=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 qi{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 kf.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return V1.test(e)}static parseMasterPlaylist(e,t){const s=jp(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:s},n=[];if(Jp.lastIndex=0,!e.startsWith("#EXTM3U"))return r.playlistParsingError=new Error("no EXTM3U delimiter"),r;let a;for(;(a=Jp.exec(e))!=null;)if(a[1]){var o;const d=new Ge(a[1],r),u=Hc(r,a[2]),c={attrs:d,bitrate:d.decimalInteger("BANDWIDTH")||d.decimalInteger("AVERAGE-BANDWIDTH"),name:d.NAME,url:qi.resolve(u,t)},h=d.decimalResolution("RESOLUTION");h&&(c.width=h.width,c.height=h.height),sg(d.CODECS,c);const f=d["SUPPLEMENTAL-CODECS"];f&&(c.supplemental={},sg(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 Ge(u,r),h=c["DATA-ID"];h&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[h]=c);break}case"SESSION-KEY":{const c=tg(u,t,r);c.encrypted&&c.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(c)):Re.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${u}"`);break}case"DEFINE":{{const c=new Ge(u,r);zp(r,c,t)}break}case"CONTENT-STEERING":{const c=new Ge(u,r);r.contentSteering={uri:qi.resolve(c["SERVER-URI"],t),pathwayId:c["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=ig(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(eg.lastIndex=0;(r=eg.exec(e))!==null;){const d=new Ge(r[1],s),u=d.TYPE;if(u){const c=o[u],h=n[u]||[];n[u]=h;
vendor: 9,403 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?qi.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=qi.findGroup(c,T.groupId)||c[0];rg(T,y,"audioCodec"),rg(T,y,"textCodec")}h.push(T)}}return n}static parseLevelPlaylist(e,t,s,r,n,a){var o;const l={url:t},d=new U1(t),u=d.fragments,c=[];let h=null,f=0,m=0,p=0,g=0,v=0,T=null,y=new Vu(r,l),b,A,L,S=-1,R=!1,x=null,I;if(ju.lastIndex=0,d.m3u8=e,d.hasVariableRefs=jp(e),((o=ju.exec(e))==null?void 0:o[0])!=="#EXTM3U")return d.playlistParsingError=new Error("Missing format identifier #EXTM3U"),d;for(;(b=ju.exec(e))!==null;){R&&(R=!1,y=new Vu(r,l),y.playlistOffset=p,y.setStart(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),x&&(y.setByteRange(x),x=null)));const Y=b[1];if(Y){y.duration=parseFloat(Y);const H=(" "+b[2]).slice(1);y.title=H||null,y.tagList.push(H?["INF",Y,H]:["INF",Y])}else if(b[3]){if(z(y.duration)){y.playlistOffset=p,y.setStart(p),L&&ag(y,L,d),y.sn=f,y.level=s,y.cc=g,u.push(y);const H=(" "+b[3]).slice(1);y.relurl=Hc(d,H),Kc(y,T,c),T=y,p+=y.duration,f++,m=0,R=!0}}else{if(b=b[0].match(W1),!b){Re.warn("No matches on slow regex match for level playlist!");continue}for(A=1;A<b.length&&b[A]===void 0;A++);const H=(" "+b[A]).slice(1),N=(" "+b[A+1]).slice(1),W=b[A+2]?(" "+b[A+2]).slice(1):null;switch(H){case"BYTERANGE":T?y.setByteRange(N,T):y.setByteRange(N);break;case"PROGRAM-DATE-TIME":y.rawProgramDateTime=N,y.tagList.push(["PROGRAM-DATE-TIME",N]),S===-1&&(S=u.length);break;case"PLAYLIST-TYPE":d.type&&ts(d,H,b),d.type=N.toUpperCase();break;case"MEDIA-SEQUENCE":d.startSN!==0?ts(d,H,b):u.length>0&&og(d,H,b),f=d.startSN=parseInt(N);break;case"SKIP":{d.skippedSegments&&ts(d,H,b);const B=new Ge(N,d),j=B.decimalInteger("SKIPPED-SEGMENTS");if(z(j)){d.skippedSegments+=j;for(let U=j;U--;)u.push(null);f+=j}const ee=B.enumeratedString("RECENTLY-REMOVED-DATERANGES");ee&&(d.recentlyRemovedDateranges=(d.recentlyRemovedDateranges||[]).concat(ee.split("	")));break}case"TARGETDURATION":d.targetduration!==0&&ts(d,H,b),d.targetduration=Math.max(parseInt(N),1);break;case"VERSION":d.version!==null&&ts(d,H,b),d.version=parseInt(N);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":d.live||ts(d,H,b),d.live=!1;break;case"#":(N||W)&&y.tagList.push(W?[N,W]:[N]);break;case"DISCONTINUITY":g++,y.tagList.push(["DIS"]);break;case"GAP":y.gap=!0,y.tagList.push([H]);break;case"BITRATE":y.tagList.push([H,N]),v=parseInt(N)*1e3,z(v)?y.bitrate=v:v=0;break;case"DATERANGE":{const B=new Ge(N,d),j=new uE(B,d.dateRanges[B.ID],d.dateRangeTagCount);d.dateRangeTagCount++,j.isValid||d.skippedSegments?d.dateRanges[j.id]=j:Re.warn(`Ignoring invalid DATERANGE tag: "${N}"`),y.tagList.push(["EXT-X-DATERANGE",N]);break}case"DEFINE":{{const B=new Ge(N,d);"IMPORT"in B?C1(d,B,a):zp(d,B,t)}break}case"DISCONTINUITY-SEQUENCE":d.startCC!==0?ts(d,H,b):u.length>0&&og(d,H,b),d.startCC=g=parseInt(N);break;case"KEY":{const B=tg(N,t,d);if(B.isSupported()){if(B.method==="NONE"){L=void 0;break}L||(L={});const j=L[B.keyFormat];j!=null&&j.matches(B)||(j&&(L=De({},L)),L[B.keyFormat]=B)}else Re.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${N}"`);break}case"START":d.startTimeOffset=ig(N);break;case"MAP":{const B=new Ge(N,d);if(y.duration){const j=new Vu(r,l);ng(j,B,s,L),h=j,y.initSegment=h,h.rawProgramDateTime&&!y.rawProgramDateTime&&(y.rawProgramDateTime=h.rawProgramDateTime)}else{const j=y.byteRangeEndOffset;if(j){const ee=y.byteRangeStartOffset;x=`${j-ee}@${ee}`}else x=null;ng(y,B,s,L),h=y,R=!0}h.cc=g;break}case"SERVER-CONTROL":{I&&ts(d,H,b),I=new Ge(N),d.canBlockReload=I.bool("CAN-BLOCK-RELOAD"),d.canSkipUntil=I.optionalFloat("CAN-SKIP-UNTIL",0),d.canSkipDateRanges=d.canSkipUntil>0&&I.bool("CAN-SKIP-DATERANGES"),d.partHoldBack=I.optionalFloat("PART-HOLD-BACK",0),d.holdBack=I.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{d.partTarget&&ts(d,H,b);const B=new Ge(N);d.partTarget=B.decimalFloatingPoint("PART-TARGET");break}case"PART":{let B=d.partList;B||(B=d.partList=[]);const j=m>0?B[B.length-1]:void 0,ee=m++,U=new Ge(N,d),$=new CS(U,y,l,ee,j);B.push($),y.duration+=$.duration;break}case"PRELOAD-HINT":{const B=new Ge(N,d);d.preloadHint=B;break}case"RENDITION-REPORT":{const B=new Ge(N,d);d.renditionReports=d.renditionReports||[],d.renditionReports.push(B);break}default:Re.warn(`line parsed but not handled: ${b}`);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,L&&ag(y,L,d)),d.targetduration||(d.playlistParsingError=new Error("Missing Target Duration"));const M=u.length,F=u[0],V=u[M-1];if(p+=d.skippedSegments*d.targetduration,p>0&&M&&V){d.averagetargetduration=p/M;const Y=V.sn;d.endSN=Y!=="initSegment"?Y:0,d.live||(V.endList=!0),S>0&&(Y1(u,S),F&&c.unshift(F))}return d.fragmentHint&&(p+=d.fragmentHint.duration),d.totalduration=p,c.length&&d.dateRangeTagCount&&F&&pE(c,d),d.endCC=g,d}}function pE(i,e){let t=i.length;if(!t)if(e.hasProgramDateTime){const o=e.fragments[e.fragments.length-1];i.push(o),t++}else return;const s=i[t-1],r=e.live?1/0:e.totalduration,n=Object.keys(e.dateRanges);for(let o=n.length;o--;){const l=e.dateRanges[n[o]],d=l.startDate.getTime();l.tagAnchor=s.ref;for(let u=t;u--;){var a;if(((a=i[u])==null?void 0:a.sn)<e.startSN)break;const c=q1(e,d,i,u,r);if(c!==-1){l.tagAnchor=e.fragments[c].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;if(d<0)return-1;const u=i.fragments;if(u.length>t.length){const h=(t[s+1]||u[u.length-1]).sn-i.startSN;for(let f=h;f>d;f--){const m=u[f].programDateTime;if(e>=m&&e<m+u[f].duration*1e3)return f}}return d}}}return-1}function tg(i,e,t){var s,r;const n=new Ge(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&&Re.error(`Invalid IV: ${n.IV}`);const c=o?qi.resolve(o,e):"",h=(d||"1").split("/").map(Number).filter(Number.isFinite);return new Hs(a,c,u,h,l,n.KEYID)}function ig(i){const t=new Ge(i).decimalFloatingPoint("TIME-OFFSET");return z(t)?t:null}function sg(i,e){let t=(i||"").split(/[ ,]+/).filter(s=>s);["video","audio","text"].forEach(s=>{const r=t.filter(n=>wf(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 rg(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 ng(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 ag(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 ts(i,e,t){i.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function og(i,e,t){i.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function zu(i,e){const t=e.startPTS;if(z(t)){let s=0,r;e.sn>i.sn?(s=t-i.start,r=i):(s=i.start-t,r=e),r.duration!==s&&r.setDuration(s)}else e.sn>i.sn?i.cc===e.cc&&i.minEndPTS?e.setStart(i.start+(i.minEndPTS-i.start)):e.setStart(i.start+i.duration):e.setStart(Math.max(i.start-e.duration,0))}function gE(i,e,t,s,r,n,a){s-t<=0&&(a.warn("Fragment should have a positive duration",e),s=t+e.duration,n=r+e.duration);let l=t,d=s;const u=e.startPTS,c=e.endPTS;if(z(u)){const v=Math.abs(u-t);i&&v>i.totalduration?a.warn(`media timestamps and playlist times differ by ${v}s for level ${e.level} ${i.url}`):z(e.deltaPTS)?e.deltaPTS=Math.max(v,e.deltaPTS):e.deltaPTS=v,l=Math.max(t,u),t=Math.min(t,u),r=e.startDTS!==void 0?Math.min(r,e.startDTS):r,d=Math.min(s,c),s=Math.max(s,c),n=e.endDTS!==void 0?Math.max(n,e.endDTS):n}const h=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(s-e.start),e.startPTS=t,e.maxStartPTS=l,e.startDTS=r,e.endPTS=s,e.minEndPTS=d,e.endDTS=n;const f=e.sn;if(!i||f<i.startSN||f>i.endSN)return 0;let m;const p=f-i.startSN,g=i.fragments;for(g[p]=e,m=p;m>0;m--)zu(g[m],g[m-1]);for(m=p;m<g.length-1;m++)zu(g[m],g[m+1]);return i.fragmentHint&&zu(g[g.length-1],i.fragmentHint),i.PTSKnown=i.alignedSliding=!0,h}function j1(i,e,t){if(i===e)return;let s=null;const r=i.fragments;for(let u=r.length-1;u>=0;u--){const c=r[u].initSegment;if(c){s=c;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;let n;X1(i,e,(u,c,h,f)=>{if((!e.startCC||e.skippedSegments)&&c.cc!==u.cc){const m=u.cc-c.cc;for(let p=h;p<f.length;p++)f[p].cc+=m;e.endCC=f[f.length-1].cc}z(u.startPTS)&&z(u.endPTS)&&(c.setStart(c.startPTS=u.startPTS),c.startDTS=u.startDTS,c.maxStartPTS=u.maxStartPTS,c.endPTS=u.endPTS,c.endDTS=u.endDTS,c.minEndPTS=u.minEndPTS,c.setDuration(u.endPTS-u.startPTS),c.duration&&(n=c),e.PTSKnown=e.alignedSliding=!0),u.hasStream
vendor: 4,569 bytes, lines 32-37
32s&&(c.elementaryStreams=u.elementaryStreams),c.loader=u.loader,u.hasStats&&(c.stats=u.stats),u.initSegment&&(c.initSegment=u.initSegment,s=u.initSegment)});const a=e.fragments,o=e.fragmentHint?a.concat(e.fragmentHint):a;if(s&&o.forEach(u=>{var c;u&&(!u.initSegment||u.initSegment.relurl===((c=s)==null?void 0:c.relurl))&&(u.initSegment=s)}),e.skippedSegments){if(e.deltaUpdateFailed=a.some(u=>!u),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let u=e.skippedSegments;u--;)a.shift();e.startSN=a[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=z1(i.dateRanges,e,t));const u=i.fragments.filter(c=>c.rawProgramDateTime);if(i.hasProgramDateTime&&!e.hasProgramDateTime)for(let c=1;c<o.length;c++)o[c].programDateTime===null&&Kc(o[c],o[c-1],u);pE(u,e)}e.endCC=a[a.length-1].cc}if(!e.startCC){var l;const u=yE(i,e.startSN-1);e.startCC=(l=u?.cc)!=null?l:a[0].cc}Q1(i.partList,e.partList,(u,c)=>{c.elementaryStreams=u.elementaryStreams,c.stats=u.stats}),n?gE(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS,t):vE(i,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=i.driftStartTime,e.driftStart=i.driftStart;const d=e.advancedDateTime;if(e.advanced&&d){const u=e.edge;e.driftStart||(e.driftStartTime=d,e.driftStart=u),e.driftEndTime=d,e.driftEnd=u}else e.driftEndTime=i.driftEndTime,e.driftEnd=i.driftEnd,e.advancedDateTime=i.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=i.requestScheduled)}function z1(i,e,t){const{dateRanges:s,recentlyRemovedDateranges:r}=e,n=De({},i);r&&r.forEach(l=>{delete n[l]});const o=Object.keys(n).length;return o?(Object.keys(s).forEach(l=>{const d=n[l],u=new uE(s[l].attr,d);u.isValid?(n[l]=u,d||(u.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Me(s[l].attr)}"`)}),n):s}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){t(u,c,d,o);const h=u.relurl,f=c.relurl;if(h&&Z1(h,f)){e.playlistParsingError=lg(`media sequence mismatch ${c.sn}:`,i,e,u,c);return}else if(u.cc!==c.cc){e.playlistParsingError=lg(`discontinuity sequence mismatch (${u.cc}!=${c.cc})`,i,e,u,c);return}}}}function lg(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 vE(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 EE(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 yE(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 dg(i,e,t){return i?TE(i.partList,e,t):null}function TE(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 bE(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 Z1(i,e){return i!==e&&e?ug(i)!==ug(e):!1}function ug(i){return i.replace(/\?[^?]*$/,"")}function Ua(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 J1(i,e){return!!(i&&e.startCC<i.endCC&&e.endCC>i.startCC)}function cg(i,e){const t=i.start+e;i.startPTS=t,i.setStart(t),i.endPTS=t+i.duration}function _E(i,e){const t=e.fragments;for(let s=0,r=t.length;s<r;s++)cg(t[s],i);e.fragmentHint&&cg(e.fragmentHint,i),e.alignedSliding=!0}function eI(i,e){i&&(AE(e,i),e.alignedSliding||Od(e,i),!e.alignedSliding&&!e.skippedSegments&&vE(i,e,!1))}function AE(i,e){if(!J1(e,i))return;const t=Math.min(e.endCC,i.endCC),s=Ua(e.fragments,t),r=Ua(i.fragments,t);
vendor: 19,185 bytes, line 37
37if(!s||!r)return;Re.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const n=s.start-r.start;_E(n,i)}function Od(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=Ua(s,a),n=Ua(t,a)),(!r||!n)&&(r=s[Math.floor(s.length/2)],n=Ua(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);_E(d,i)}function Rt(i,e,t){Ct(i,e,t),i.addEventListener(e,t)}function Ct(i,e,t){i.removeEventListener(e,t)}const tI={toString:function(i){let e="";const t=i.length;for(let s=0;s<t;s++)e+=`[${i.start(s).toFixed(3)}-${i.end(s).toFixed(3)}]`;return e}},P={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class Ff extends lE{constructor(e,t,s,r,n){super(r,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=P.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:a,fragCurrent:o,media:l,mediaBuffer:d,state:u}=this,c=l?l.currentTime:0,h=de.bufferInfo(d||l,c,a.maxBufferHole),f=!h.len;if(this.log(`Media seeking to ${z(c)?c.toFixed(3):c}, state: ${u}, ${f?"out of":"in"} buffer`),this.state===P.ENDED)this.resetLoadingState();else if(o){const m=a.maxFragLookUpTolerance,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)),f&&this.state===P.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=n,this.hls=e,this.fragmentLoader=new k1(e.config),this.keyLoader=s,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Of(e.config)}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_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===P.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=P.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const s=e.end||0,r=this.config.timelineOffset||0;if(s<=r)return!1;const n=e.buffered;this.config.maxBufferHole&&n&&n.length>1&&(e=de.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 de.isBuffered(this.media,u.start+u.duration/2)}const d=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(d)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){const s=this.media=this.mediaBuffer=t.media;Rt(s,"seeking",this.onMediaSeeking),Rt(s,"ended",this.onMediaEnded);const r=this.config;this.levels&&r.autoStartLoad&&this.state===P.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(e,t){const s=!!t.transferMedia,r=this.media;if(r!==null){if(r.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),Ct(r,"seeking",this.onMediaSeeking),Ct(r,"ended",this.onMediaEnded),this.keyLoader&&!s&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,s){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=P.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,s){this.startFragRequested=!0,this._loadFragForPlayback(e,t,s)}_loadFragForPlayback(e,t,s){const r=n=>{const a=n.frag;if(this.fragContextChanged(a)){this.warn(`${a.type} sn: ${a.sn}${n.part?" part: "+n.part.index:""} of ${this.fragInfo(a,!1,n.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(a);return}a.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,s,r).then(n=>{if(!n)return;const a=this.state,o=n.frag;if(this.fragContextChanged(o)){(a===P.FRAG_LOADING||!this.fragCurrent&&a===P.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=P.IDLE);return}"payload"in n&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(E.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===P.STOPPED||this.state===P.ERROR||(this.warn(`Frag error: ${n?.message||n}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:s}=this;if(s.getState(e)===ut.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)===ut.PARTIAL&&s.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return t?.live&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,s=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:s};this.hls.trigger(E.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(s=>{const r=s?.frag;if(!r||this.fragContextChanged(r)||!this.levels)throw new Error("init load aborted");return s}).then(s=>{const{hls:r}=this,{frag:n,payload:a}=s,o=n.decryptdata;if(a&&a.byteLength>0&&o!=null&&o.key&&o.iv&&Ln(o.method)){const l=self.performance.now();return this.decrypter.decrypt(new Uint8Array(a),o.key.buffer,o.iv.buffer,Uf(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===P.STOPPED||this.state===P.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const s=e.frag.stats;this.state!==P.STOPPED&&(this.state=P.IDLE),e.frag.data=new Uint8Array(e.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var s,r;const n=e.tracks;if(n&&!t.encrypted&&((s=n.audio)!=null&&s.encrypted||(r=n.video)!=null&&r.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const a=this.media,o=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${a?"attached mediaKeys: "+a.mediaKeys:"detached"})`);return this.warn(o.message),!a||a.mediaKeys?!1:(this.hls.trigger(E.ERROR,{type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_KEYS,fatal:!1,error:o,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const s=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${s?tI.toString(de.getBuffered(s)):"(detached)"})`),ze(e)){var r;if(e.type!==X.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(o=>!!a[o])){this.state=P.IDLE;return}}const n=(r=this.levels)==null?void 0:r[e.level];n!=null&&n.fragmentError&&(this.log(`Resetting level fragment error count of ${n.fragmentError} on frag buffered`),n.fragmentError=0)}this.state=P.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:s,part:r,partsLoaded:n}=e,a=!n||n.length===0||n.some(l=>!l),o=new Nf(s.level,s.sn,s.stats.chunkCount+1,0,r?r.index:-1,!a);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,s=null,r){var n;this.fragCurrent=e;const a=t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)){if(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=P.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(h=>{if(!this.fragContextChanged(h.frag))return this.hls.trigger(E.KEY_LOADED,h),this.state===P.KEY_LOADING&&(this.state=P.IDLE),h}),this.hls.trigger(E.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(o=this.keyLoader.loadClear(e,a.encryptedFragments,this.startFragRequested),o&&this.log("[eme] blocking frag load until media-keys acquired"));const l=this.fragPrevious;if(ze(e)&&(!l||e.sn!==l.sn)){const h=this.shouldLoadParts(t.details,e.end);h!==this.loadingParts&&(this.log(`LL-Part loading ${h?"ON":"OFF"} loading sn ${l?.sn}->${e.sn}`),this.loadingParts=h)}if(s=Math.max(e.start,s||0),this.loadingParts&&ze(e)){const h=a.partList;if(h&&r){s>a.fragmentEnd&&a.fragmentHint&&(e=a.fragmentHint);const f=this.getNextPart(h,e,s);if(f>-1){const m=h[f];e=this.fragCurrent=m.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${m.index} (${f}/${h.length-1}) of ${this.fragInfo(e,!1,m)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=m.start+m.duration,this.state=P.FRAG_LOADING;let p;return o?p=o.then(g=>!g||this.fragContextChanged(g.frag)?null:this.doFragPartsLoad(e,m,t,r)).catch(g=>this.handleFragLoadError(g)):p=this.doFragPartsLoad(e,m,t,r).catch(g=>this.handleFragLoadError(g)),this.hls.trigger(E.FRAG_LOADING,{frag:e,part:m,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):p}else if(!e.url||this.loadedEndOfParts(h,s))return Promise.resolve(null)}}if(ze(e)&&this.loadingParts){var d;this.log(`LL-Part loading OFF after next part miss @${s.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(d=a.partList)==null?void 0:d.filter(h=>h.loaded).map(h=>`[${h.start}-${h.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+a.startSN+"-"+a.endSN+"]"}, target: ${parseFloat(s.toFixed(3))}`),z(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=P.FRAG_LOADING;const u=this.config.progressive&&e.type!==X.SUBTITLE;let c;return u&&o?c=o.then(h=>!h||this.fragContextChanged(h.frag)?null:this.fragmentLoader.load(e,r)).catch(h=>this.handleFragLoadError(h)):c=Promise.all([this.fragmentLoader.load(e,u?r:void 0),o]).then(([h])=>(!u&&r&&r(h),h)).catch(h=>this.handleFragLoadError(h)),this.hls.trigger(E.FRAG_LOADING,{frag:e,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):c}doFragPartsLoad(e,t,s,r){return new Promise((n,a)=>{var o;const l=[],d=(o=s.details)==null?void 0:o.partList,u=c=>{this.fragmentLoader.loadPart(e,c,r).then(h=>{l[c.index]=h;const f=h.part;this.hls.trigger(E.FRAG_LOADED,h);const m=dg(s.details,e.sn,c.index+1)||TE(d,e.sn,c.index+1);if(m)u(m);else return n({frag:e,part:f,partsLoaded:l})}).catch(a)};u(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===w.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===te.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):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!==P.PARSING){!this.fragCurrent&&this.state!==P.STOPPED&&this.state!==P.ERROR&&(this.state=P.IDLE);return}const{frag:s,part:r,level:n}=t,a=self.performance.now();s.stats.parsing.end=a,r&&(r.stats.parsing.end=a);const o=this.getLevelDetails(),d=o&&s.sn>o.endSN||this.shouldLoadParts(o,s.end);d!==this.loadingParts&&(this.log(`LL-Part loading ${d?"ON":"OFF"} after parsing segment ending @${s.end.toFixed(2)}`),this.loadingParts=d),this.updateLevelTiming(s,r,n,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var s;const n=e.partList[0];if(n.fragment.type===X.SUBTITLE)return!1;const a=n.end+(((s=e.fragmentHint)==null?void 0:s.duration)||0);if(t>=a){var r;if((this.hls.hasEnoughToStart?((r=this.media)==null?void 0:r.currentTime)||this.lastCurrentTime:this.getLoadPosition())>n.start-n.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:s}=this,{level:r,sn:n,part:a}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${n} of ${this.playlistLabel()} ${r}. The current chunk will not be buffered.`),null;const o=t[r],l=o.details,d=a>-1?dg(l,n,a):null,u=d?d.fragment:yE(l,n,s);return u?(s&&s!==u&&(u.stats=s.stats),{frag:u,part:d,level:o}):null}bufferFragmentData(e,t,s,r,n){if(this.state!==P.PARSING)return;const{data1:a,data2:o}=e;let l=a;if(o&&(l=si(a,o)),!l.length)return;const d=this.initPTS[t.cc],u=d?-d.baseTime/d.timescale:void 0,c={type:e.type,frag:t,part:s,chunkMeta:r,offset:u,parent:t.type,data:l};if(this.hls.trigger(E.BUFFER_APPENDING,c),e.dropped&&e.independent&&!s){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!de.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const s=t.currentTime,r=de.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(!z(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=de.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 de.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){const s=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return s&&"fragment"in s?s.fragment:s}getNextFragment(e,t){const s=t.fragments,r=s.length;if(!r)return null;const{config:n}=this,a=s[0].start,o=n.lowLatencyMode&&!!t.partList;let l=null;if(t.live){const c=n.initialLiveManifestSize;if(r<c)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${c})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a){var d;o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),l=this.getInitialLiveFragment(t);const h=this.hls.startPosition,f=this.hls.liveSyncPosition,m=l?(h!==-1&&h>=a?h:f)||l.start:e;this.log(`Setting startPosition to ${m} to match start frag at live edge. mainStart: ${h} liveSyncPosition: ${f} frag.start: ${(d=l)==null?void 0:d.start}`),this.startPosition=this.nextLoadPosition=m}}else e<=a&&(l=s[0]);if(!l){const c=this.loadingParts?t.partEnd:t.fragmentEnd;l=this.getFragmentAtPosition(e,c,t)}let u=this.filterReplacedPrimary(l,t);if(!u&&l){const c=l.sn-t.startSN;u=this.filterReplacedPrimary(s[c+1]||null,t)}return this.mapToInitFragWhenRequired(u)}isLoopLoading(e,t){const s=this.fragmentTracker.getState(e);return(s===ut.OK||s===ut.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,s,r,n){let a=null;
37if(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(hg(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(hg(this.config)&&e.type!==X.SUBTITLE){const s=this.hls.interstitialsManager,r=s?.bufferingItem;if(r){const a=r.event;if(a){if(a.appendInPlace||Math.abs(e.start-r.start)>1||r.start===0)return null}else if(e.end<=r.start&&t?.live===!1||e.start>r.end&&r.nextEvent&&(r.nextEvent.appendInPlace||e.start-r.end>1))return null}const n=s?.playerQueue;if(n)for(let a=n.length;a--;){const o=n[a].interstitial;if(o.appendInPlace&&e.start>=o.startTime&&e.end<=o.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,s){let r=-1,n=!1,a=!0;for(let o=0,l=e.length;o<l;o++){const d=e[o];if(a=a&&!d.independent,r>-1&&s<d.start)break;const u=d.loaded;u?r=-1:(n||(d.independent||a)&&d.fragment===t)&&(d.fragment!==t&&this.warn(`Need buffer at ${s} but next unloaded part starts at ${d.start}`),r=o),n=u}return r}loadedEndOfParts(e,t){let s;for(let r=e.length;r--;){if(s=e[r],!s.loaded)return!1;if(t>s.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,s=this.fragPrevious;let r=null;if(s){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),r=v1(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=nE(e,s.cc,s.end),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(r=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,s){const{config:r}=this;let{fragPrevious:n}=this,{fragments:a,endSN:o}=s;const{fragmentHint:l}=s,{maxFragLookUpTolerance:d}=r,u=s.partList,c=!!(this.loadingParts&&u!=null&&u.length&&l);c&&!this.bitrateTest&&u[u.length-1].fragment.sn===l.sn&&(a=a.concat(l),o=l.sn);let h;if(e<t){var f;const p=e<this.lastCurrentTime||e>t-d||(f=this.media)!=null&&f.paused||!this.startFragRequested?0:d;h=Rr(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===ut.OK||p===ut.PARTIAL&&h.gap)&&(n=h),n&&h.sn===n.sn&&(!c||u[0].fragment.sn>h.sn||!s.live)&&h.level===n.level){const v=a[m+1];h.sn<o&&this.fragmentTracker.getState(v)!==ut.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&&z(n);if(a||!o&&!n){eI(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&&z(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&&ze(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==P.FRAG_LOADING_WAITING_RETRY)&&(this.state=P.IDLE)}onFragmentOrKeyLoadError(e,t){var s;if(t.chunkMeta&&!t.frag){const v=this.getCurrentContext(t.chunkMeta);v&&(t.frag=v.frag)}const r=t.frag;if(!r||r.type!==e||!this.levels)return;if(this.fragContextChanged(r)){var n;this.warn(`Frag load error must match current frag to retry ${r.url} > ${(n=this.fragCurrent)==null?void 0:n.url}`);return}const a=t.details===w.FRAG_GAP;a&&this.fragmentTracker.fragBuffered(r,!0);const o=t.errorAction;if(!o){this.state=P.ERROR;return}const{action:l,flags:d,retryCount:u=0,retryConfig:c}=o,h=!!c,f=h&&l===yt.RetryRequest,m=h&&!o.resolved&&d===Bt.MoveAllAlternatesMatchingHost,p=(s=this.hls.latestLevelDetails)==null?void 0:s.live;if(!f&&m&&ze(r)&&!r.endList&&p&&!oE(t))this.resetFragmentErrors(e),this.treatAsGap(r),o.resolved=!0;else if((f||m)&&u<c.maxNumRetry){var g;const v=Bc((g=t.response)==null?void 0:g.code),T=Pf(c,u);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+T,this.state=P.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,v){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn(`Fragment ${r.sn} of ${e} ${r.level} errored with ${t.details}, retrying loading ${u+1}/${c.maxNumRetry} in ${T}ms`)}else if(c)if(this.resetFragmentErrors(e),u<c.maxNumRetry)!a&&l!==yt.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${u})`);return}else l===yt.SendAlternateToPenaltyBox?this.state=P.WAITING_LEVEL:this.state=P.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,s=t===1/0;(!t||e>=t||s&&!Bc(0))&&(s&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=P.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===P.PARSING||this.state===P.PARSED){const t=e.frag,s=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,s),n=r&&r.len>.5;n&&this.reduceMaxBufferLength(r.len,t?.duration||10);const a=!n;return a&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${s} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===X.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==P.STOPPED&&(this.state=P.IDLE)}afterBufferFlushed(e,t,s){if(!e)return;const r=de.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,s),this.state===P.ENDED&&this.resetLoadingState()}
vendor: 55,522 bytes, line 37
37resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==P.STOPPED&&(this.state=P.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,s,r){const n=s.details;if(!n){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,d)=>{const u=e.elementaryStreams[d];if(u){const c=u.endPTS-u.startPTS;if(c<=0)return this.warn(`Could not parse fragment ${e.sn} ${d} duration reliably (${c})`),l||!1;const h=r?0:gE(n,e,u.startPTS,u.endPTS,u.startDTS,u.endDTS,this);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;const l=((o=this.transmuxer)==null?void 0:o.error)===null;if((s.fragmentError===0||l&&(s.fragmentError<2||e.endList))&&this.treatAsGap(e,s),l){const d=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(d.message),this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,error:d,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=P.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(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.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function hg(i){return!!i.interstitialsController&&i.enableInterstitialPlayback!==!1}class SE{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=iI(e,t);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function iI(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 Qu={exports:{}},fg;function sI(){return fg||(fg=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[];if(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 b=g.length,A;for(y=0;y<b;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(A=1,T=new Array(v-1);A<v;A++)T[A-1]=arguments[A];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})(Qu)),Qu.exports}var rI=sI(),Bf=kS(rI);const to="1.6.15",Bn={};function nI(){return typeof __HLS_WORKER_BUNDLE__=="function"}function aI(){const i=Bn[to];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 Bn[to]=r,r}function oI(i){const e=Bn[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 Bn[i]=r,r}function lI(i){const e=Bn[i||to];if(e&&e.clientCount--===1){const{worker:s,objectURL:r}=e;delete Bn[i||to],r&&self.URL.revokeObjectURL(r),s.terminate()}}function IE(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 Hf(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 fu(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 io(i,e){const t=e;let s=0;for(;Hf(i,e);){s+=10;const r=fu(i,e+6);s+=r,IE(i,e+10)&&(s+=10),e+=s}if(s>0)return i.subarray(t,t+s)}function dI(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 Re.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 LE(i,e){return i[e]===255&&(i[e+1]&246)===240}function RE(i,e){return i[e+1]&1?7:9}function Gf(i,e){return(i[e+3]&3)<<11|i[e+4]<<3|(i[e+5]&224)>>>5}function uI(i,e){return e+5<i.length}function Nd(i,e){return e+1<i.length&&LE(i,e)}function cI(i,e){return uI(i,e)&&LE(i,e)&&Gf(i,e)<=i.length-e}function hI(i,e){if(Nd(i,e)){const t=RE(i,e);if(e+t>=i.length)return!1;const s=Gf(i,e);if(s<=t)return!1;const r=e+s;return r===i.length||Nd(i,r)}return!1}function xE(i,e,t,s,r){if(!i.samplerate){const n=dI(e,t,s,r);if(!n)return;De(i,n)}}function kE(i){return 1024*9e4/i}function fI(i,e){const t=RE(i,e);if(e+t<=i.length){const s=Gf(i,e)-t;if(s>0)return{headerLength:t,frameLength:s}}}function DE(i,e,t,s,r){const n=kE(i.samplerate),a=s+r*n,o=fI(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 mI(i,e){return Hf(i,e)&&fu(i,e+6)+10<=i.length-e}function pI(i){return i instanceof ArrayBuffer?i:i.byteOffset==0&&i.byteLength==i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer}function Xu(i,e=0,t=1/0){return gI(i,e,t,Uint8Array)}function gI(i,e,t,s){const r=vI(i);let n=1;"BYTES_PER_ELEMENT"in s&&(n=s.BYTES_PER_ELEMENT);const a=EI(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 vI(i){return i instanceof ArrayBuffer?i:i.buffer}function EI(i){return i&&i.buffer instanceof ArrayBuffer&&i.byteLength!==void 0&&i.byteOffset!==void 0}function yI(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=qt(Xu(i.data,1,s)),n=i.data[2+s],a=i.data.subarray(3+s).indexOf(0);if(a===-1)return;const o=qt(Xu(i.data,3+s,a));let l;return r==="-->"?l=qt(Xu(i.data,4+s+a)):l=pI(i.data.subarray(4+s+a)),e.mimeType=r,e.pictureType=n,e.description=o,e.data=l,e}function TI(i){if(i.size<2)return;const e=qt(i.data,!0),t=new Uint8Array(i.data.subarray(e.length+1));return{key:i.type,info:e,data:t.buffer}}function bI(i){if(i.size<2)return;if(i.type==="TXXX"){let t=1;const s=qt(i.data.subarray(t),!0);t+=s.length+1;const r=qt(i.data.subarray(t));return{key:i.type,info:s,data:r}}const e=qt(i.data.subarray(1));return{key:i.type,info:"",data:e}}function _I(i){if(i.type==="WXXX"){if(i.size<2)return;let t=1;const s=qt(i.data.subarray(t),!0);t+=s.length+1;const r=qt(i.data.subarray(t));return{key:i.type,info:s,data:r}}const e=qt(i.data);return{key:i.type,info:"",data:e}}function AI(i){return i.type==="PRIV"?TI(i):i.type[0]==="W"?_I(i):i.type==="APIC"?yI(i):bI(i)}function SI(i){const e=String.fromCharCode(i[0],i[1],i[2],i[3]),t=fu(i,4),s=10;return{type:e,size:t,data:i.subarray(s,s+t)}}const Co=10,II=10;function CE(i){let e=0;const t=[];for(;Hf(i,e);){const s=fu(i,e+6);i[e+5]>>6&1&&(e+=Co),e+=Co;const r=e+s;for(;e+II<r;){const n=SI(i.subarray(e)),a=AI(n);a&&t.push(a),e+=n.size+Co}IE(i,e)&&(e+=Co)}return t}function wE(i){return i&&i.key==="PRIV"&&i.info==="com.apple.streaming.transportStreamTimestamp"}function LI(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 Kf(i){const e=CE(i);for(let t=0;t<e.length;t++){const s=e[t];if(wE(s))return LI(s)}}let Vt=(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 Hi(i="",e=9e4){return{type:i,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Vf{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);let s=io(e,0),r=s?s.length:0,n;const a=this._audioTrack,o=this._id3Track,l=s?Kf(s):void 0,d=e.length;for((this.basePTS===null||this.frameIndex===0&&z(l))&&(this.basePTS=RI(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:Vt.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 mI(e,r)?(s=io(e,r),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:Vt.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:Hi(),id3Track:o,textTrack:Hi()}}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:Hi(),id3Track:this._id3Track,textTrack:Hi()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const RI=(i,e,t)=>{if(z(i))return i*90;const s=t?t.baseTime*9e4/t.timescale:0;return e*9e4+s};let wo=null;const xI=[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],kI=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],DI=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],CI=[0,1,1,4];function ME(i,e,t,s,r){if(t+24>e.length)return;const n=PE(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 PE(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=xI[l*14+r-1]*1e3,c=kI[(t===3?0:t===2?1:2)*3+n],h=o===3?1:2,f=DI[t][s],m=CI[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 Wf(i,e){return i[e]===255&&(i[e+1]&224)===224&&(i[e+1]&6)!==0}function OE(i,e){return e+1<i.length&&Wf(i,e)}function wI(i,e){return Wf(i,e)&&4<=i.length-e}function NE(i,e){if(e+1<i.length&&Wf(i,e)){const s=PE(i,e);let r=4;s!=null&&s.frameLength&&(r=s.frameLength);const n=e+r;return n===i.length||OE(i,n)}return!1}class MI extends Vf{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=io(e,0);let r=s?.length||0;if(NE(e,r))return!1;for(let n=e.length;r<n;r++)if(hI(e,r))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return cI(e,t)}appendFrame(e,t,s){xE(e,this.observer,t,s,e.manifestCodec);const r=DE(e,t,s,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const UE=(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 PI extends Vf{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=$E(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=io(e,0);if(!t)return!1;const s=t.length;return e[s]===11&&e[s+1]===119&&Kf(t)!==void 0&&UE(e,s)<16}}function $E(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,b=s+r*y,A=e.subarray(t,t+u);return i.config=T,i.channelCount=p,i.samplerate=o,i.samples.push({unit:A,pts:b}),u}class OI extends Vf{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=io(e,0);let s=t?.length||0;if(t&&e[s]===11&&e[s+1]===119&&Kf(t)!==void 0&&UE(e,s)<=16)return!1;for(let r=e.length;s<r;s++)if(NE(e,s))return Re.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return wI(e,t)}appendFrame(e,t,s){if(this.basePTS!==null)return ME(e,t,s,this.basePTS,this.frameIndex)}}const NI=/\/emsg[-/]ID3/i;class UI{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=Hi("video",1),a=this.audioTrack=Hi("audio",1),o=this.txtTrack=Hi("text",1);if(this.id3Track=Hi("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=jv(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=Wv.text,n.sampleDuration=0,n.duration=a.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return PS(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=HS(s);this.remainderData=o.remainder,r.samples=o.valid||new Uint8Array}else r.samples=s;const a=this.extractID3Track(r,t);return n.samples=Cp(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=Cp(e,t),{videoTrack:t,audioTrack:Hi(),id3Track:r,textTrack:Hi()}}extractID3Track(e,t){const s=this.id3Track;if(e.samples.length){const r=he(e.samples,["emsg"]);r&&r.forEach(n=>{const a=KS(n);if(NI.test(a.schemeIdUri)){const o=mg(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:Vt.emsg,duration:l})}else if(this.config.enableEmsgKLVMetadata&&a.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=mg(a,t);s.samples.push({data:a.payload,len:a.payload.byteLength,dts:o,pts:o,type:Vt.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 mg(i,e){return z(i.presentationTime)?i.presentationTime/i.timeScale:e+i.presentationTimeDelta/i.timeScale}class $I{constructor(e,t,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new Of(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Vs.cbc)}decryptAacSample(e,t,s){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),a=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(a).then(o=>{const l=new Uint8Array(o);r.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,s)}).catch(s)}decryptAacSamples(e,t,s){for(;;t++){if(t>=e.length){s();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,s=new Int8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)s.set(e.subarray(n,n+16),r);return s}getAvcDecryptedUnit(e,t){const s=new Uint8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)e.set(s.subarray(r,r+16),n);return e}decryptAvcSample(e,t,s,r,n){const a=Xv(n.data),o=this.getAvcEncryptedData(a);this.decryptBuffer(o.buffer).then(l=>{n.data=this.getAvcDecryptedUnit(a,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,s+1,r)}).catch(r)}decryptAvcSamples(e,t,s,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,s=0){if(t>=e.length){r();return}const n=e[t].units;for(;!(s>=n.length);s++){const a=n[s];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,s,r,a),!this.decrypter.isSync()))return}}}}class FE{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 $a{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&&Re.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 FI extends FE{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,Cf(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 b=v[y].toString(16);b.length<2&&(b="0"+b),T+=b}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 $a(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 $a(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 R=h();if(R===3&&m(1),g(),g(),m(1),f())for(l=R!==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 b=h(),A=h(),L=c(1);L===0&&m(1),m(1),f()&&(s=h(),r=h(),n=h(),a=h());let S=[1,1];if(f()&&f())switch(u()){case 1:S=[1,1];break;case 2:S=[12,11];break;case 3:S=[10,11];break;case 4:S=[16,11];break;case 5:S=[40,33];break;case 6:S=[24,11];break;case 7:S=[20,11];break;case 8:S=[32,11];break;case 9:S=[80,33];break;case 10:S=[18,11];break;case 11:S=[15,11];break;case 12:S=[64,33];break;case 13:S=[160,99];break;case 14:S=[4,3];break;case 15:S=[3,2];break;case 16:S=[2,1];break;case 255:{S=[u()<<8|u(),u()<<8|u()];break}}return{width:Math.ceil((b+1)*16-s*2-r*2),height:(2-L)*(A+1)*16-(L?2:4)*(n+a),pixelRatio:S}}}class BI extends FE{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,Cf(d.data,2,s.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=De(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 $a(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 $a(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 ye=0;ye<s;ye++)T.push(t.readBoolean()),y.push(t.readBoolean());if(s>0)for(let ye=s;ye<8;ye++)t.readBits(2);for(let ye=0;ye<s;ye++)T[ye]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),y[ye]&&t.readUByte();t.readUEG();const b=t.readUEG();b==3&&t.skipBits(1);const A=t.readUEG(),L=t.readUEG(),S=t.readBoolean();let R=0,x=0,I=0,M=0;S&&(R+=t.readUEG(),x+=t.readUEG(),I+=t.readUEG(),M+=t.readUEG());const F=t.readUEG(),V=t.readUEG(),Y=t.readUEG(),H=t.readBoolean();for(let ye=H?0:s;ye<=s;ye++)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 at=0;at<4;at++)for(let Lt=0;Lt<(at===3?2:6);Lt++)if(!t.readBoolean())t.readUEG();else{const zt=Math.min(64,1<<4+(at<<1));at>1&&t.readEG();for(let Te=0;Te<zt;Te++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const B=t.readUEG();let j=0;for(let ye=0;ye<B;ye++){let at=!1;if(ye!==0&&(at=t.readBoolean()),at){ye===B&&t.readUEG(),t.readBoolean(),t.readUEG();let Lt=0;for(let bi=0;bi<=j;bi++){const zt=t.readBoolean();let Te=!1;zt||(Te=t.readBoolean()),(zt||Te)&&Lt++}j=Lt}else{const Lt=t.readUEG(),bi=t.readUEG();j=Lt+bi;for(let zt=0;zt<Lt;zt++)t.readUEG(),t.readBoolean();for(let zt=0;zt<bi;zt++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const ye=t.readUEG();for(let at=0;at<ye;at++){for(let Lt=0;Lt<Y+4;Lt++)t.readBits(1);t.readBits(1)}}let U=0,$=1,ne=1,pe=!0,ue=1,fe=0;t.readBoolean(),t.readBoolean();let nt=!1;if(t.readBoolean()){if(t.readBoolean()){const Ot=t.readUByte(),bo=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Mr=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Ot>0&&Ot<16?($=bo[Ot-1],ne=Mr[Ot-1]):Ot===255&&($=t.readBits(16),ne=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(),nt=t.readBoolean(),nt&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(ue=t.readBits(32),fe=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Mr=t.readBoolean(),_o=t.readBoolean();let js=!1;(Mr||_o)&&(js=t.readBoolean(),js&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),js&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Ao=0;Ao<=s;Ao++){pe=t.readBoolean();const Uu=pe||t.readBoolean();let So=!1;Uu?t.readEG():So=t.readBoolean();const _t=So?1:t.readUEG()+1;if(Mr)for(let Fe=0;Fe<_t;Fe++)t.readUEG(),t.readUEG(),js&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(_o)for(let Fe=0;Fe<_t;Fe++)t.readUEG(),t.readUEG(),js&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),U=t.readUEG())}let It=A,Pt=L;if(S){let ye=1,at=1;b===1?ye=at=2:b==2&&(ye=2),It=A-ye*x-ye*R,Pt=L-at*M-at*I}const ai=r?["A","B","C"][r]:"",Es=o<<24|l<<16|d<<8|u;let Cr=0;for(let ye=0;ye<32;ye++)Cr=(Cr|(Es>>ye&1)<<31-ye)>>>0;let wr=Cr.toString(16);return a===1&&wr==="2"&&(wr="6"),{codecString:`hvc1.${ai}${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:F+8,bit_depth_luma_minus8:F,bit_depth_chroma_minus8:V,min_spatial_segmentation_idc:U,chroma_format_idc:b,frame_rate:{fixed:pe,fps:fe/ue}},width:It,height:Pt,pixelRatio:[$,ne]}}readPPS(e){const t=new $a(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 ht=188;class Ps{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=Ps.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(ht*5,t-ht)+1,r=0;for(;r<s;){let n=!1,a=-1,o=0;for(let l=r;l<t;l+=ht)if(e[l]===71&&(t-l===ht||e[l+ht]===71)){if(o++,a===-1&&(a=l,a!==0&&(s=Math.min(a+ht*99,e.length-ht)+1)),n||(n=Wc(e,l)===0),n&&o>1&&(a===0&&o>2||l+ht>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:Wv[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=Ps.createTrack("video"),this._videoTrack.duration=r,this._audioTrack=Ps.createTrack("audio",r),this._id3Track=Ps.createTrack("id3"),this._txtTrack=Ps.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=s}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:s}=this;e&&(e.pesData=null),t&&(t.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,s=!1,r=!1){s||(this.sampleAes=null);let n;const a=this._videoTrack,o=this._audioTrack,l=this._id3Track,d=this._txtTrack;let u=a.pid,c=a.pesData,h=o.pid,f=l.pid,m=o.pesData,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<ht&&!r)return this.remainderData=e,{audioTrack:o,videoTrack:a,id3Track:l,textTrack:d};const b=Math.max(0,Ps.syncOffset(e));y-=(y-b)%ht,y<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,y,e.buffer.byteLength-y));let A=0;for(let S=b;S<y;S+=ht)if(e[S]===71){const R=!!(e[S+1]&64),x=Wc(e,S),I=(e[S+3]&48)>>4;let M;if(I>1){if(M=S+5+e[S+4],M===S+ht)continue}else M=S+4;switch(x){case u:R&&(c&&(n=Ur(c,this.logger))&&(this.readyVideoParser(a.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(a,d,n,!1)),c={data:[],size:0}),c&&(c.data.push(e.subarray(M,S+ht)),c.size+=S+ht-M);break;case h:if(R){if(m&&(n=Ur(m,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,n);break;case"mp3":this.parseMPEGPES(o,n);break;case"ac3":this.parseAC3PES(o,n);break}m={data:[],size:0}}m&&(m.data.push(e.subarray(M,S+ht)),m.size+=S+ht-M);break;case f:R&&(p&&(n=Ur(p,this.logger))&&this.parseID3PES(l,n),p={data:[],size:0}),p&&(p.data.push(e.subarray(M,S+ht)),p.size+=S+ht-M);break;case 0:R&&(M+=e[M]+1),T=this._pmtId=HI(e,M);break;case T:{R&&(M+=e[M]+1);const F=GI(e,M,this.typeSupported,s,this.observer,this.logger);u=F.videoPid,u>0&&(a.pid=u,a.segmentCodec=F.segmentVideoCodec),h=F.audioPid,h>0&&(o.pid=h,o.segmentCodec=F.segmentAudioCodec),f=F.id3Pid,f>0&&(l.pid=f),g!==null&&!v&&(this.logger.warn(`MPEG-TS PMT found at ${S} after unknown PID '${g}'. Backtracking to sync byte @${b} to parse all TS packets.`),g=null,S=b-188),v=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=x;break}}else A++;A>0&&qc(this.observer,new Error(`Found ${A} TS packet/s that do not start with 0x47`),void 0,this.logger),a.pesData=c,o.pesData=m,l.pesData=p;const L={audioTrack:o,videoTrack:a,id3Track:l,textTrack:d};return r&&this.extractRemainingSamples(L),L}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:s,id3Track:r,textTrack:n}=e,a=s.pesData,o=t.pesData,l=r.pesData;let d;if(a&&(d=Ur(a,this.logger))?(this.readyVideoParser(s.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(s,n,d,!0),s.pesData=null)):s.pesData=a,o&&(d=Ur(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=Ur(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 $I(this.observer,this.config,t);return this.decrypt(r,n)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new FI:e==="hevc"&&(this.videoParser=new BI))}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&&!Nd(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}xE(e,this.observer,n,a,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(r){const c=kE(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=DE(e,n,a,l,d),a+=u.length,u.missing){this.aacOverFlow=u;break}else for(d++;a<o-1&&!Nd(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(OE(s,a)){const l=ME(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=$E(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=De({},t,{type:this._videoTrack?Vt.emsg:Vt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(s)}}function Wc(i,e){return((i[e+1]&31)<<8)+i[e+2]}function HI(i,e){return(i[e+10]&31)<<8|i[e+11]}function GI(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){Zu("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){Zu("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){Zu("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 Zu(i,e){e.log(`${i} with AES-128-CBC encryption found in unencrypted stream`)}function Ur(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 KI{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 ys=Math.pow(2,32)-1;class D{static init(){D.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in D.types)D.types.hasOwnProperty(e)&&(D.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),s=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);D.HDLR_TYPES={video:t,audio:s};const r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);D.STTS=D.STSC=D.STCO=n,D.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),D.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),D.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),D.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);D.FTYP=D.box(D.types.ftyp,a,l,a,o),D.DINF=D.box(D.types.dinf,D.box(D.types.dref,r))}static box(e,...t){let s=8,r=t.length;const n=r;for(;r--;)s+=t[r].byteLength;const a=new Uint8Array(s);for(a[0]=s>>24&255,a[1]=s>>16&255,a[2]=s>>8&255,a[3]=s&255,a.set(e,4),r=0,s=8;r<n;r++)a.set(t[r],s),s+=t[r].byteLength;return a}static hdlr(e){return D.box(D.types.hdlr,D.HDLR_TYPES[e])}static mdat(e){return D.box(D.types.mdat,e)}static mdhd(e,t){t*=e;const s=Math.floor(t/(ys+1)),r=Math.floor(t%(ys+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/(ys+1)),r=Math.floor(t%(ys+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return D.box(D.types.mvhd,n)}static sdtp(e){const t=e.samples||[],s=new Uint8Array(4+t.length);let r,n;for(r=0;r<t.length;r++)n=t[r].flags,s[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return D.box(D.types.sdtp,s)}static stbl(e){return D.box(D.types.stbl,D.stsd(e),D.box(D.types.stts,D.STTS),D.box(D.types.stsc,D.STSC),D.box(D.types.stsz,D.STSZ),D.box(D.types.stco,D.STCO))}static avc1(e){let t=[],s=[],r,n,a;for(r=0;r<e.sps.length;r++)n=e.sps[r],a=n.byteLength,t.push(a>>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(n));for(r=0;r<e.pps.length;r++)n=e.pps[r],a=n.byteLength,s.push(a>>>8&255),s.push(a&255),s=s.concat(Array.prototype.slice.call(n));const o=D.box(D.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(s))),l=e.width,d=e.height,u=e.pixelRatio[0],c=e.pixelRatio[1];return D.box(D.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,D.box(D.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),D.box(D.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,c>>24,c>>16&255,c>>8&255,c&255])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return D.box(D.types.mp4a,D.audioStsd(e),D.box(D.types.esds,D.esds(e)))}static mp3(e){return D.box(D.types[".mp3"],D.audioStsd(e))}static ac3(e){return D.box(D.types["ac-3"],D.audioStsd(e),D.box(D.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return D.box(D.types.stsd,D.STSD,D.mp4a(e));if(t==="ac3"&&e.config)return D.box(D.types.stsd,D.STSD,D.ac3(e));if(t==="mp3"&&e.codec==="mp3")return D.box(D.types.stsd,D.STSD,D.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return D.box(D.types.stsd,D.STSD,D.avc1(e));if(t==="hevc"&&e.vps)return D.box(D.types.stsd,D.STSD,D.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,s=(e.duration||0)*(e.timescale||0),r=e.width||0,n=e.height||0,a=Math.floor(s/(ys+1)),o=Math.floor(s%(ys+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/(ys+1)),a=Math.floor(t%(ys+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 BE=9e4;function qf(i,e,t=1,s=!1){const r=i*e*t;return s?Math.round(r):r}function VI(i,e,t=1,s=!1){return qf(i,e,1/t,s)}function ea(i,e=!1){return qf(i,1e3,1/BE,e)}function WI(i,e=1){return qf(i,BE,1/e)}function pg(i){const{baseTime:e,timescale:t,trackId:s}=i;return`${e/t} (${e}/${t}) trackId: ${s}`}const qI=10*1e3,YI=1024,jI=1152,zI=1536;let $r=null,Ju=null;function gg(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 cl extends ri{constructor(e,t,s,r){if(super("mp4-remuxer",r),this.observer=void 0,this.config=void 0,this.typeSupp
vendor: 6,328 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,$r===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);$r=a?parseInt(a[1]):0}if(Ju===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);Ju=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&pg(t)} > ${e&&pg(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const s=e[0].pts,r=e.reduce((n,a)=>{let o=a.pts,l=o-n;return l<-4294967296&&(t=!0,o=Gt(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,b=e.samples.length>0,A=o&&y>0||y>1;if((!v||b)&&(!T||A)||this.ISGenerated||o){if(this.ISGenerated){var S,R,x,I;const Y=this.videoTrackConfig;(Y&&(t.width!==Y.width||t.height!==Y.height||((S=t.pixelRatio)==null?void 0:S[0])!==((R=Y.pixelRatio)==null?void 0:R[0])||((x=t.pixelRatio)==null?void 0:x[1])!==((I=Y.pixelRatio)==null?void 0:I[1]))||!Y&&A||this.nextAudioTs===null&&b)&&this.resetInitSegment()}this.ISGenerated||(c=this.generateIS(e,t,n,a));const M=this.isVideoContiguous;let F=-1,V;if(A&&(F=QI(t.samples),!M&&this.config.forceKeyFrameOnDiscontinuity))if(m=!0,F>0){this.warn(`Dropped ${F} out of ${y} video samples due to a missing keyframe`);const Y=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(F),t.dropped+=F,g+=(t.samples[0].pts-Y)/t.inputTimeScale,V=g}else F===-1&&(this.warn(`No keyframe found out of ${y} video samples`),m=!1);if(this.ISGenerated){if(b&&A){const Y=this.getVideoStartPts(t.samples),N=(Gt(e.samples[0].pts,Y)-Y)/t.inputTimeScale;p+=Math.max(0,N),g+=Math.max(0,-N)}if(b){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||A||l===X.AUDIO?g:void 0),A){const Y=u?u.endPTS-u.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),c=this.generateIS(e,t,n,a)),d=this.remuxVideo(t,g,M,Y)}}else A&&(d=this.remuxVideo(t,g,M,0));d&&(d.firstKeyFrame=F,d.independent=F!==-1,d.firstKeyFramePTS=V)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(f=HE(s,n,this._initPTS,this._initDTS)),r.samples.length&&(h=GE(r,n,this._initPTS))),{audio:u,video:d,initSegment:c,independent:m,text:h,id3:f}}computeInitPts(e,t,s,r){const n=Math.round(s*t);let a=Gt(e,n);if(a<n+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(n-a)/t} ${r}`);a<n+t;)a+=8589934592;return a-n}generateIS(e,t,s,r){const n=e.samples,a=t.samples,o=this.typeSupported,l={},d=this._initPTS;let u=!d||r,c="audio/mp4",h,f,m,p=-1;if(u&&(h=f=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(c="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}l.audio={id:"audio",container:c,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):D.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(p=e.id,m=e.inputTimeScale,!d||m!==d.timescale?h=f=this.computeInitPts(n[0].pts,m,s,"audio"):u=!1)}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:D.initSegment([t]),metadata:{width:t.width,height:t.height}},u)if(p=t.id,m=t.inputTimeScale,!d||m!==d.timescale){const g=this.getVideoStartPts(a),v=Gt(a[0].dts,g),T=this.computeInitPts(v,m,s,"video"),y=this.computeInitPts(g,m,s,"video");f=Math.min(f,T),h=Math.min(h,y)}else u=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,u?(d&&this.warn(`Timestamps at playlist time: ${r?"":"~"}${s} ${h/m} != initPTS: ${d.baseTime/d.timescale} (${d.baseTime}/${d.timescale}) trackId: ${d.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${h/m} (${h}/${m}) trackId: ${p}`),this._initPTS={baseTime:h,timescale:m,trackId:p},this._initDTS={baseTime:f,timescale:m,trackId:p}):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=u+t*n,$=a[0].pts-Gt(a[0].dts,a[0].pts);$r&&c!==null&&Math.abs(U-$-(c+u))<15e3?s=!0:c=U-$-u}const y=c+u;for(let U=0;U<l;U++){const $=a[U];$.pts=Gt($.pts,y),$.dts=Gt($.dts,y),$.dts<a[U>0?U-1:U].dts&&(T=!0)}T&&a.sort(function(U,$){const ne=U.dts-$.dts,pe=U.pts-$.pts;return ne||pe}),m=a[0].dts,p=a[a.length-1].dts;const b=p-m,A=b?Math.round(b/(l-1)):f||e.inputTimeScale/30;if(s){const U=m-y,$=U>A,ne=U<-1;if(($||ne)&&($?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${ea(U,!0)} ms (${U}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${ea(-U,!0)} ms (${U}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!ne||y>=a[0].pts||$r)){m=y;const pe=a[0].pts-U;if($)a[0].dts=m,a[0].pts=pe;else{let ue=!0;for(let fe=0;fe<a.length&&!(a[fe].dts>pe&&ue);fe++){const nt=a[fe].pts;if(a[fe].dts-=U,a[fe].pts-=U,fe<a.length-1){const Qe=a[fe+1].pts,It=a[fe].pts,Pt=Qe<=It,ai=Qe<=nt;ue=Pt==ai}}}this.log(`Video: Initial PTS/DTS adjusted: ${ea(pe,!0)}/${ea(m,!0)}, delta: ${ea(U,!0)} ms`)}}m=Math.max(0,m);let L=0,S=0,R=m;for(let U=0;U<l;U++){const $=a[U],ne=$.units,pe=ne.length;let ue=0;for(let fe=0;fe<pe;fe++)ue+=ne[fe].data.length;S+=ue,L+=pe,$.length=ue,$.dts<R?($.dts=R,R+=A/4|0||1):R=$.dts,g=Math.min($.pts,g),v=Math.max($.pts,v)}p=a[l-1].dts;const x=S+4*L+8;let I;try{I=new Uint8Array(x)}catch(U){this.observer.emit(E.ERROR,E.ERROR,{type:te.MUX_ERROR,details:w.REMUX_ALLOC_ER
vendor: 8,057 bytes, line 37
37ROR,fatal:!1,error:U,bytes:x,reason:`fail allocating video mdat ${x}`});return}const M=new DataView(I.buffer);M.setUint32(0,x),I.set(D.types.mdat,4);let F=!1,V=Number.POSITIVE_INFINITY,Y=Number.POSITIVE_INFINITY,H=Number.NEGATIVE_INFINITY,N=Number.NEGATIVE_INFINITY;for(let U=0;U<l;U++){const $=a[U],ne=$.units;let pe=0;for(let nt=0,Qe=ne.length;nt<Qe;nt++){const It=ne[nt],Pt=It.data,ai=It.data.byteLength;M.setUint32(h,ai),h+=4,I.set(Pt,h),h+=ai,pe+=4+ai}let ue;if(U<l-1)f=a[U+1].dts-$.dts,ue=a[U+1].pts-$.pts;else{const nt=this.config,Qe=U>0?$.dts-a[U-1].dts:A;if(ue=U>0?$.pts-a[U-1].pts:A,nt.stretchShortVideoTrack&&this.nextAudioTs!==null){const It=Math.floor(nt.maxBufferHole*n),Pt=(r?g+r*n:this.nextAudioTs+u)-$.pts;Pt>It?(f=Pt-Qe,f<0?f=Qe:F=!0,this.log(`It is approximately ${Pt/90} ms to the next segment; using duration ${f/90} ms for the last video frame.`)):f=Qe}else f=Qe}const fe=Math.round($.pts-$.dts);V=Math.min(V,f),H=Math.max(H,f),Y=Math.min(Y,ue),N=Math.max(N,ue),o.push(gg($.key,f,pe,fe))}if(o.length){if($r){if($r<70){const U=o[0].flags;U.dependsOn=2,U.isNonSync=0}}else if(Ju&&N-Y<H-V&&A/H<.025&&o[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let U=m;for(let $=0,ne=o.length;$<ne;$++){const pe=U+o[$].duration,ue=U+o[$].cts;if($<ne-1){const fe=pe+o[$+1].cts;o[$].duration=fe-ue}else o[$].duration=$?o[$-1].duration:A;o[$].cts=0,U=pe}}}f=F||!f?A:f;const W=p+f;this.nextVideoTs=c=W-u,this.videoSampleDuration=f,this.isVideoContiguous=!0;const ee={data1:D.moof(e.sequenceNumber++,m,De(e,{samples:o})),data2:I,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 jI;case"ac3":return zI;default:return YI}}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(Gt(p[0].pts,y)-(v+T))<20*u),p.forEach(function(N){N.pts=Gt(N.pts,y)}),!s||v<0){const N=p.length;if(p=p.filter(W=>W.pts>=0),N!==p.length&&this.warn(`Removed ${p.length-N} of ${N} samples (initPTS ${T} / ${a})`),!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 N=this.config.maxAudioFramesDrift;for(let W=0,B=v+T;W<p.length;W++){const j=p[W],ee=j.pts,U=ee-B,$=Math.abs(1e3*U/a);if(U<=-N*u&&m)W===0&&(this.warn(`Audio frame @ ${(ee/a).toFixed(3)}s overlaps marker by ${Math.round(1e3*U/a)} ms.`),this.nextAudioTs=v=ee-T,B=ee);else if(U>=N*u&&$<qI&&m){let ne=Math.round(U/u);for(B=ee-ne*u;B<0&&ne&&u;)ne--,B+=u;W===0&&(this.nextAudioTs=v=B-T),this.warn(`Injecting ${ne} audio frames @ ${((B-T)/a).toFixed(3)}s due to ${Math.round(1e3*U/a)} ms gap.`);for(let pe=0;pe<ne;pe++){let ue=KI.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);ue||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),ue=j.unit.subarray()),p.splice(W,0,{unit:ue,pts:B}),B+=u,W++}}j.pts=B,B+=u}}let b=null,A=null,L,S=0,R=p.length;for(;R--;)S+=p[R].unit.byteLength;for(let N=0,W=p.length;N<W;N++){const B=p[N],j=B.unit;let ee=B.pts;if(A!==null){const $=f[N-1];$.duration=Math.round((ee-A)/l)}else if(s&&e.segmentCodec==="aac"&&(ee=v+T),b=ee,S>0){S+=g;try{L=new Uint8Array(S)}catch($){this.observer.emit(E.ERROR,E.ERROR,{type:te.MUX_ERROR,details:w.REMUX_ALLOC_ERROR,fatal:!1,error:$,bytes:S,reason:`fail allocating audio mdat ${S}`});return}h||(new DataView(L.buffer).setUint32(0,S),L.set(D.types.mdat,4))}else return;L.set(j,g);const U=j.byteLength;g+=U,f.push(gg(!0,d,U,0)),A=ee}const x=f.length;if(!x)return;const I=f[f.length-1];v=A-T,this.nextAudioTs=v+l*I.duration;const M=h?new Uint8Array(0):D.moof(e.sequenceNumber++,b/l,De({},e,{samples:f}));e.samples=[];const F=(b-T)/a,V=this.nextAudioTs/a,H={data1:M,data2:L,startPTS:F,endPTS:V,startDTS:F,endDTS:V,type:"audio",hasAudio:!0,hasVideo:!1,nb:x};return this.isAudioContiguous=!0,H}}function Gt(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 QI(i){for(let e=0;e<i.length;e++)if(i[e].key)return e;return-1}function HE(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=Gt(l.pts-t.baseTime*n/t.timescale,e*n)/n,l.dts=Gt(l.dts-s.baseTime*n/s.timescale,e*n)/n}const a=i.samples;return i.samples=[],{samples:a}}function GE(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=Gt(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 XI extends ri{constructor(e,t,s,r){super("passthrough-remuxer",r),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,s,r){this.audioCodec=t,this.videoCodec=s,this.generateInitSegment(e,r),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:s,videoCodec:r}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:n,video:a}=this.initData=jv(e);if(t)$S(e,t);else{const l=n||a;l!=null&&l.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${l.codec}")!`)}n&&(s=vg(n,we.AUDIO,this)),a&&(r=vg(a,we.VIDEO,this));const o={};n&&a?o.audiovideo={container:"video/mp4",codec:s+","+r,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:n?o.audio={container:"audio/mp4",codec:s,encrypted:n.encrypted,initSegment:e,id:"audio"}:a?o.video={container:"video/mp4",codec:r,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=o}remux(e,t,s,r,n,a){var o,l;let{initPTS:d,lastEndTime:u}=this;const c={audio:void 0,video:void 0,text:r,id3:s,initSegment:void 0};z(u)||(u=this.lastEndTime=n||0);const h=t.samples;if(!h.length)return c;const f={initPTS:void 0,timescale:void 0,trackId:void 0};let m=this.initData;if((o=m)!=null&&o.length||(this.generateInitSegment(h),m=this.initData),!((l=m)!=null&&l.length))return this.warn("Failed to generate initSegment."),c;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1);const p=BS(h,m,this),g=m.audio?p[m.audio.id]:null,v=m.video?p[m.video.id]:null,T=Mo(v,1/0),y=Mo(g,1/0),b=Mo(v,0,!0),A=Mo(g,0,!0);let L=n,S=0;const R=g&&(!v||!d&&y<T||d&&d.trackId===m.audio.id),x=R?g:v;if(x){const B=x.timescale,j=x.start-n*B,ee=R?m.audio.id:m.video.id;L=x.start/B,S=R?A-y:b-T,(a||!d)&&(ZI(d,L,n,S)||B!==d.timescale)&&(d&&this.warn(`Timestamps at playlist time: ${a?"":"~"}${n} ${j/B} != initPTS: ${d.baseTime/d.timescale} (${d.baseTime}/${d.timescale}) trackId: ${d.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${L-n} (${j}/${B}) trackId: ${ee}`),d=null,f.initPTS=j,f.timescale=B,f.trackId=ee)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${n}`);d?(f.initPTS=d.baseTime,f.timescale=d.timescale,f.trackId=d.trackId):((!f.timescale||f.trackId===void 0||f.initPTS===void 0)&&(this.warn("Could not set initPTS"),f.initPTS=L,f.timescale=1,f.trackId=-1),this.initPTS=d={baseTime:f.initPTS,timescale:f.timescale,trackId:f.trackId});const I=L-d.baseTime/d.timescale,M=I+S;S>0?this.lastEndTime=M:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const F=!!m.audio,V=!!m.video;let Y="";
vendor: 43,021 bytes, lines 37-46
37F&&(Y+="audio"),V&&(Y+="video");const H=(m.audio?m.audio.encrypted:!1)||(m.video?m.video.encrypted:!1),N={data1:h,startPTS:I,startDTS:I,endPTS:M,endDTS:M,type:Y,hasAudio:F,hasVideo:V,nb:1,dropped:0,encrypted:H};c.audio=F&&!V?N:void 0,c.video=V?N:void 0;const W=v?.sampleCount;if(W){const B=v.keyFrameIndex,j=B!==-1;N.nb=W,N.dropped=B===0||this.isVideoContiguous?0:j?B:W,N.independent=j,N.firstKeyFrame=B,j&&v.keyFrameStart&&(N.firstKeyFramePTS=(v.keyFrameStart-d.baseTime)/d.timescale),this.isVideoContiguous||(c.independent=j),this.isVideoContiguous||(this.isVideoContiguous=j),N.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${B}/${W} dropped: ${N.dropped} start: ${N.firstKeyFramePTS||"NA"}`)}return c.initSegment=f,c.id3=HE(s,n,d,d),r.samples.length&&(c.text=GE(r,n,d)),c}}function Mo(i,e,t=!1){return 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 vg(i,e,t){const s=i.codec;return s&&s.length>4?s:e===we.AUDIO?s==="ec-3"||s==="ac-3"||s==="alac"?s:s==="fLaC"||s==="Opus"?xd(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 ls;try{ls=self.performance.now.bind(self.performance)}catch{ls=Date.now}const hl=[{demux:UI,remux:XI},{demux:Ps,remux:cl},{demux:MI,remux:cl},{demux:OI,remux:cl}];hl.splice(2,0,{demux:PI,remux:cl});class Eg{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=ls();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,b=JI(a,t);if(b&&Ln(b.method)){const R=this.getDecrypter(),x=Uf(b.method);if(R.isSync()){let I=R.softwareDecrypt(a,b.key.buffer,b.iv.buffer,x);if(s.part>-1){const F=R.flush();I=F&&F.buffer}if(!I)return n.executeEnd=ls(),ec(s);a=new Uint8Array(I)}else return this.asyncResult=!0,this.decryptionPromise=R.webCryptoDecrypt(a,b.key.buffer,b.iv.buffer,x).then(I=>{const M=this.push(I,null,s);return this.decryptionPromise=null,M}),this.decryptionPromise}const A=this.needsProbing(u,c);if(A){const R=this.configureTransmuxer(a);if(R)return this.logger.warn(`[transmuxer] ${R.message}`),this.observer.emit(E.ERROR,E.ERROR,{type:te.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,error:R,reason:R.message}),n.executeEnd=ls(),ec(s)}(u||c||m||A)&&this.resetInitSegment(y,p,g,T,t),(u||m||A)&&this.resetInitialTimestamp(v),d||this.resetContiguity();const L=this.transmux(a,b,f,h,s);this.asyncResult=so(L);const S=this.currentTransmuxState;return S.contiguous=!0,S.discontinuity=!1,S.trackSwitch=!1,n.executeEnd=ls(),L}flush(e){const t=e.transmuxing;t.executeStart=ls();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=ls();const c=[ec(e)];return this.asyncResult?Promise.resolve(c):c}const u=l.flush(o);return so(u)?(this.asyncResult=!0,u.then(c=>(this.flushRemux(a,c,e),a))):(this.flushRemux(a,u,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,t,s){const{audioTrack:r,videoTrack:n,id3Track:a,textTrack:o}=t,{accurateTimeOffset:l,timeOffset:d}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${s.sn}${s.part>-1?" part: "+s.part:""} of ${this.id===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=ls()}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=hl.length;c<h;c++){var a;if((a=hl[c].demux)!=null&&a.probe(e,this.logger)){n=hl[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 Of(this.config)),e}}function JI(i,e){let t=null;return i.byteLength>0&&e?.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const ec=i=>({remuxResult:{},chunkMeta:i});function so(i){return"then"in i&&i.then instanceof Function}class eL{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 tL{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 yg=0;class KE{constructor(e,t,s,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=yg++,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 Bf,this.observer.on(E.FRAG_DECRYPTED,a),this.observer.on(E.ERROR,a);const o=Pp(n.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const l=this.hls.logger;if(n.workerPath||nI()){try{n.workerPath?(l.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=oI(n.workerPath)):(l.log(`injecting Web Worker for "${t}"`),this.workerContext=aI());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:Me(n)})}catch(u){l.warn(`Error setting up "${t}" Web Worker, fallback to inline`,u),this.terminateWorker(),this.error=null,this.transmuxer=new Eg(this.observer,o,n,"",t,e.logger)}return}}this.transmuxer=new Eg(this.observer,o,n,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=yg++;const t=this.hls.config,s=Pp(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:s,id:this.id,config:Me(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),lI(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),b=v?d.sn-v.sn:-1,A=this.part?d.part-this.part.index:-1,L=b===0&&d.id>1&&d.id===v?.stats.chunkCount,S=!y&&(b===1||b===0&&(A===1||L&&A<=0)),R=self.performance.now();(y||b||n.stats.parsing.start===0)&&(n.stats.parsing.start=R),a&&(A||!S)&&(a.stats.parsing.start=R);const x=!(v&&((c=n.initSegment)==null?void 0:c.url)===((h=v.initSegment)==null?void 0:h.url)),I=new tL(T,S,l,y,p,x);if(!S||T||x){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${n.type} sn: ${d.sn}${d.part>-1?" part: "+d.part:""} ${this.id===X.MAIN?"level":"track"}: ${d.level} id: ${d.id}
38        discontinuity: ${T}
39        trackSwitch: ${y}
40        contiguous: ${S}
41        accurateTimeOffset: ${l}
42        timeOffset: ${p}
43        initSegmentChange: ${x}`);const M=new eL(s,r,t,o,u);this.configureTransmuxer(M)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:f,cmd:"demux",data:e,decryptdata:g,chunkMeta:d,state:I},e instanceof ArrayBuffer?[e]:[]);else if(m){const M=m.push(e,g,d,I);so(M)?M.then(F=>{this.handleTransmuxComplete(F)}).catch(F=>{this.transmuxerError(F,d,"transmuxer-interface push error")}):this.handleTransmuxComplete(M)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:s}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(s){const r=s.flush(e);so(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 Tg=100;class iL extends Ff{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.AUDIO_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,trackId:a}){if(s===X.MAIN){const o=t.cc,l=this.fragCurrent;if(this.initPTS[o]={baseTime:r,timescale:n,trackId:a},this.log(`InitPTS for cc: ${o} found from main: ${r/n} (${r}/${n}) trackId: ${a}`),this.mainAnchor=t,this.state===P.WAITING_INIT_PTS){const d=this.waitingData;(!d&&!this.loadingParts||d&&d.frag.cc!==o)&&this.syncWithAnchor(t,d?.frag)}else!this.hls.hasEnoughToStart&&l&&l.cc!==o?(l.abortRequests(),this.syncWithAnchor(t,l)):this.state===P.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var s;const r=((s=this.mainFragLoading)==null?void 0:s.frag)||null;if(t&&r?.cc===t.cc)return;const n=(r||e).cc,a=this.getLevelDetails(),o=this.getLoadPosition(),l=nE(a,n,o);l&&(this.log(`Syncing with main frag at ${l.start} cc ${l.cc}`),this.startFragRequested=!1,this.nextLoadPosition=l.start,this.resetLoadingState(),this.state===P.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=P.STOPPED;return}const s=this.lastCurrentTime;this.stopLoad(),this.setInterval(Tg),s>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s,this.state=P.IDLE):this.state=P.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case P.IDLE:this.doTickIdle();break;case P.WAITING_TRACK:{const{levels:e,trackId:t}=this,s=e?.[t],r=s?.details;if(r&&!this.waitForLive(s)){if(this.waitForCdnTuneIn(r))break;this.state=P.WAITING_INIT_PTS}break}case P.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case P.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:s,cache:r,complete:n}=e,a=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=P.FRAG_LOADING;const o=r.flush().buffer,l={frag:t,part:s,payload:o,networkDetails:null};this._handleFragmentLoadProgress(l),n&&super._handleFragmentLoadComplete(l)}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag)}else this.state=P.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:s,media:r,trackId:n}=this,a=t.config;if(!this.buffering||!r&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(s!=null&&s[n]))return;const o=s[n],l=o.details;if(!l||this.waitForLive(o)||this.waitForCdnTuneIn(l)){this.state=P.WAITING_TRACK,this.startFragRequested=!1;return}const d=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&d&&(this.bufferFlushed=!1,this.afterBufferFlushed(d,we.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=P.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&&ze(v)&&!v.endList&&(!l.live||!this.loadingParts&&g<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(T)===ut.OK&&(this.mainFragLoading=T=null),T&&ze(T))){if(v.start>T.end){const b=this.fragmentTracker.getFragAtPos(g,X.MAIN);b&&b.end>T.end&&(T=b,this.mainFragLoading={frag:b,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 eo(s))}onAudioTrackSwitching(e,t){const s=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),s?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==P.STOPPED&&(this.setInterval(Tg),this.state=P.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const s=this.cachedTrackLoadedData;s&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(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!==P.STOPPED&&(this.state=P.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${l.name}" of "${o}" loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const u=r[a];let c=0;if(n.live||(s=u.details)!=null&&s.live){if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;if(u.details){var h;c=this.alignPlaylists(n,u.details,(h=this.levelLastLoaded)==null?void 0:h.details)}n.alignedSliding||(AE(n,d),n.alignedSliding||Od(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===P.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=P.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const s=e.frag,{part:r,payload:n}=e,{config:a,trackId:o,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const d=l[o];if(!d){this.warn("Audio track is undefined on fragment load progress");return}const u=d.details;if(!u){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(s.start);return}const c=a.defaultAudioCodec||d.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new KE(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 Nf(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 SE,complete:!1};p.push(new Uint8Array(n)),this.state!==P.STOPPED&&(this.state=P.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const s=t.tracks.audio;s&&(this.mediaBuffer=s.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===X.MAIN&&ze(t.frag)&&(this.mainFragLoading=t,this.state===P.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(ze(s)){this.fragPrevious=s;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(E.AUDIO_TRACK_SWITCHED,Le({},n)))}this.fragBufferedComplete(s,r),this.media&&this.tick()}onError(e,t){var s;if(t.fatal){this.state=P.ERROR;return}switch(t.details){case 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===P.WAITING_TRACK&&((s=t.context)==null?void 0:s.type)===me.AUDIO_TRACK&&(this.state=P.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!==we.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==we.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===P.ENDED&&(this.state=P.IDLE);const s=this.mediaBuffer||this.media;s&&(this.afterBufferFlushed(s,t,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=P.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),p!=null&&p.tracks){const g=l.initSegment||l;if(this.unhandledEncryptionError(p,l))return;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[we.AUDIO]={startPTS:g,endPTS:v,startDTS:T,endDTS:y}),l.setElementaryStreamInfo(we.AUDIO,g,v,T,y),this.bufferFragmentData(h,l,d,a)}if(m!=null&&(t=m.samples)!=null&&t.length){const g=De({id:s,frag:l,details:c},m);r.trigger(E.FRAG_PARSING_METADATA,g)}if(f){const g=De({id:s,frag:l,details:c},f);r.trigger(E.FRAG_PARSING_USERDATA,g)}}_bufferInitSegment(e,t,s,r){if(this.state!==P.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const n=t.audio;n.id=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===ut.NOT_LOADED||r===ut.PARTIAL){var n;if(!ze(e))this._loadInitSegment(e,t);else if((n=t.details)!=null&&n.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=P.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==t.details.fragmentStart&&Od(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;yr({name:t,lang:s,assocLang:r,characteristics:n,audioCodec:a,channels:o},e,tr)||(Dd(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,Le({},e))}}class Yf extends ri{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,s){const r=t?.renditionReports;if(r){let n=-1;for(let a=0;a<r.length;a++){const o=r[a];let l;try{l=new self.URL(o.URI,t.url).href}catch(d){this.warn(`Could not construct new URL for Rendition Report: ${d}`),l=o.URI||""}if(l===e){n=a;break}else l===e.substring(0,l.length)&&(n=a)}if(n!==-1){const a=r[n],o=parseInt(a["LAST-MSN"])||t.lastPartSn;let l=parseInt(a["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const u=Math.min(t.age-t.partTarget,t.targetduration);l>=0&&u>t.partTarget&&(l+=1)}const d=s&&Op(s);return new Np(o,l>=0?l:void 0,d)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(s){this.warn(`Could not construct new URL with HLS Delivery Directives: ${s}`)}return e}playlistLoaded(e,t,s){const{details:r,stats:n}=t,a=self.performance.now(),o=n.loading.first?Math.max(0,a-n.loading.first):0;r.advancedDateTime=Date.now()-o;const l=this.hls.config.timelineOffset;if(l!==r.appliedTimelineOffset){const u=Math.max(l||0,0);r.appliedTimelineOffset=u,r.fragments.forEach(c=>{c.setStart(c.playlistOffset+u)})}if(r.live||s!=null&&s.live){const u="levelInfo"in t?t.levelInfo:t.track;if(r.reloaded(s),s&&r.fragments.length>0){j1(s,r,this);const T=r.playlistParsingError;if(T){this.warn(T);const y=this.hls;if(!y.config.ignorePlaylistParsingErrors){var d;const{networkDetails:b}=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:b,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=EE(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,b=r.endSN,A=r.lastPartIndex,L=A!==-1,S=y===b;L?S?(g=b+1,v=T?0:A):(g=y,v=T?A+1:r.maxPartIndex):g=b+1;const R=r.age,x=R+r.ageHeader;let I=Math.min(x-r.partTarget,r.targetduration*1.5);if(I>0){if(x>r.targetduration*3)this.log(`Playlist last advanced ${R.toFixed(2)}s ago. Omitting segment and part directives.`),g=void 0,v=void 0;else if(s!=null&&s.tuneInGoal&&x-r.partTarget>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${I} with playlist age: ${r.age}`),I=0;else{const M=Math.floor(I/r.targetduration);if(g+=M,v!==void 0){const F=Math.round(I%r.targetduration/r.partTarget);v+=F}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${R.toFixed(2)}s goal: ${I} skip sn ${M} to part ${v}`)}r.tuneInGoal=I}if(p=this.getDeliveryDirectives(r,t.deliveryDirectives,g,v),T||!S){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=Op(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(s=t.msn,r=t.part,n=dl.No),new Np(s,r,n)}checkRetry(e){const t=e.details,s=Cd(e),r=e.errorAction,{action:n,retryCount:a=0,retryConfig:o}=r||{},l=!!r&&!!o&&(n===yt.RetryRequest||!r.resolved&&n===yt.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=Pf(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 VE(i,e){if(i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(!ro(i[t].attrs,e[t].attrs))return!1;return!0}function ro(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 sL extends Yf{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?.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Audio track ${s} "${a.name}" lang:${a.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.audioGroups||null,r=this.groupIds;let n=this.currentTrack;if(!s||r?.length!==s?.length||s!=null&&s.some(o=>r?.indexOf(o)===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(h=>!s||s.indexOf(h.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(h=>h.default)&&(this.selectDefaultTrack=!1),o.forEach((h,f)=>{h.id=f});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.audioPreference;if(!n&&l){const h=Wi(l,o,tr);if(h>-1)n=o[h];else{const f=Wi(l,this.tracks);n=this.tracks[f]}}let d=this.findTrackId(n);d===-1&&n&&(d=this.findTrackId(null));const u={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${s?.join(",")}`),this.hls.trigger(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===me.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&&yr(e,r,tr))return r;const n=Wi(e,this.tracksInGroup,tr);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=p1(e,t.levels,s,a,tr);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const a=Wi(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,Le({},r)),n))return;const a=this.switchParams(r.url,s?.details,r.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let s=0;s<t.length;s++){const r=t[s];if(!(this.selectDefaultTrack&&!r.default)&&(!e||yr(e,r,tr)))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(yr({name:s,lang:r,assocLang:n,characteristics:a,audioCodec:o,channels:l},u,tr))return d}for(let d=0;d<t.length;d++){const u=t[d];if(ro(e.attrs,u.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return d}for(let d=0;d<t.length;d++){const u=t[d];if(ro(e.attrs,u.attrs,["LANGUAGE"]))return d}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&Dd(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const s=e.id,r=e.groupId,n=this.getUrlWithDirectives(e.url,t),a=e.details,o=a?.age;this.log(`Loading audio-track ${s} "${e.name}" lang:${e.lang} group:${r}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${n}`),this.hls.trigger(E.AUDIO_TRACK_LOADING,{url:n,id:s,groupId:r,deliveryDirectives:t||null,track:e})}}class rL{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?.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 bg=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,WE="HlsJsTrackRemovedError";class nL extends Error{constructor(e){super(e),this.name=WE}}class aL extends ri{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=xS(Ks(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?De(s,r.tracks):this.sourceBuffers.forEach(n=>{const[a]=n;a&&(s[a]=De({},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;this.transferData=this.overrides=void 0;const r=Ks(this.appendSource);if(r){const n=!!t.mediaSource;(n||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const a=this.mediaSource=t.mediaSource||new r;if(this.assignMediaSource(a),n)this._objectUrl=s.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{s.removeAttribute("src");const l=self.ManagedMediaSource;s.disableRemotePlayback=s.disableRemotePlayback||l&&a instanceof l,_g(s),oL(s,o),s.load()}catch{s.src=o}else s.src=o}s.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,s;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(s=e.constructor)==null?void 0:s.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const s=this.tracks,r=t.tracks,n=r?Object.keys(r):null,a=n?n.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(r&&n&&a){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
47required tracks: ${Me(s,(l,d)=>l==="initSegment"?void 0:d)};
48transfer tracks: ${Me(r,(l,d)=>l==="initSegment"?void 0:d)}}`),!Hv(r,s)){t.mediaSource=null,t.tracks=void 0;const l=e.currentTime,d=this.details,u=Math.max(l,d?.fragments[0].start||0);if(u-l>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${l} -> ${u}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(r)}"->"${Object.keys(s)}") start time: ${u} currentTime: ${l}`),this.onMediaDetaching(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=de.getBuffered(c);h.detectEvictedFragments(d,g,f,null,!0)}const m=tc(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&&_g(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: 15,020 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[tc(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new rL(this.tracks)}onBufferCodecs(e,t){var s;const r=this.tracks,n=Object.keys(t);this.log(`BUFFER_CODECS: "${n}" (current SB count ${this.sourceBufferCount})`);const a="audiovideo"in t&&(r.audio||r.video)||r.audiovideo&&("audio"in t||"video"in t),o=!a&&this.sourceBufferCount&&this.media&&n.some(l=>!r[l]);if(a||o){this.warn(`Unsupported transition between "${Object.keys(r)}" and "${n}" SourceBuffers`);return}n.forEach(l=>{var d,u;const c=t[l],{id:h,codec:f,levelCodec:m,container:p,metadata:g,supplemental:v}=c;let T=r[l];const y=(d=this.transferData)==null||(d=d.tracks)==null?void 0:d[l],b=y!=null&&y.buffer?y:T,A=b?.pendingCodec||b?.codec,L=b?.levelCodec;T||(T=r[l]={buffer:void 0,listeners:[],codec:f,supplemental:v,container:p,levelCodec:m,metadata:g,id:h});const S=ll(A,L),R=S?.replace(bg,"$1");let x=ll(f,m);const I=(u=x)==null?void 0:u.replace(bg,"$1");x&&S&&R!==I&&(l.slice(0,5)==="audio"&&(x=xd(x,this.appendSource)),this.log(`switching codec ${A} to ${x}`),x!==(T.pendingCodec||T.codec)&&(T.pendingCodec=x),T.container=p,this.appendChangeType(l,p,x))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((s=t.audio)==null?void 0:s.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const s=this.tracks[t];return e[t]={id:s.id,container:s.container,codec:s.codec,levelCodec:s.levelCodec},e},{})}appendChangeType(e,t,s){const r=`${t};codecs=${s}`,n={label:`change-type=${r}`,execute:()=>{const a=this.tracks[e];if(a){const o=a.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${r}`),o.changeType(r),a.codec=s,a.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn(`Failed to change ${e} SourceBuffer type`,a)}};this.append(n,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const s=e.start,r=s+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(s,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&&de.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?.container==="audio/mpeg"&&(T=!this.lastMpegAudioChunk||d.id===1||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const y=s.video,b=y?.buffer;if(b&&h!=="initSegment"){const S=l||o,R=this.blockedAudioAppend;if(n==="audio"&&a!=="main"&&!this.blockedAudioAppend&&!(y.ending||y.ended)){const I=S.start+S.duration*.05,M=b.buffered,F=this.currentOp("video");!M.length&&!F?this.blockAudio(S):!F&&!de.isBuffered(b,I)&&this.lastVideoAppendEnd<I&&this.blockAudio(S)}else if(n==="video"){const x=S.end;if(R){const I=R.frag.start;(x>I||x<this.lastVideoAppendEnd||de.isBuffered(b,I))&&this.unblockAudio()}this.lastVideoAppendEnd=x}}const A=(l||o).start,L={label:`append-${n}`,execute:()=>{var S;c.executeStart=self.performance.now();const R=(S=this.tracks[n])==null?void 0:S.buffer;R&&(T?this.updateTimestampOffset(R,A,.1,n,h,f):u!==void 0&&z(u)&&this.updateTimestampOffset(R,u,1e-6,n,h,f)),this.appendExecutor(r,n)},onStart:()=>{},onComplete:()=>{const S=self.performance.now();c.executeEnd=c.end=S,p.first===0&&(p.first=S),g&&g.first===0&&(g.first=S);const R={};this.sourceBuffers.forEach(([x,I])=>{x&&(R[x]=de.getBuffered(I))}),this.appendErrors[n]=0,n==="audio"||n==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(E.BUFFER_APPENDED,{type:n,frag:o,part:l,chunkMeta:d,parent:o.type,timeRanges:R})},onError:S=>{var R;const x={type:te.MEDIA_ERROR,parent:o.type,details:w.BUFFER_APPEND_ERROR,sourceBufferName:n,frag:o,part:l,chunkMeta:d,error:S,err:S,fatal:!1},I=(R=this.media)==null?void 0:R.error;if(S.code===DOMException.QUOTA_EXCEEDED_ERR||S.name=="QuotaExceededError"||"quota"in S)x.details=w.BUFFER_FULL_ERROR;else if(S.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!I)x.errorAction=In(!0);else if(S.name===WE&&this.sourceBufferCount===0)x.errorAction=In(!0);else{const M=++this.appendErrors[n];this.warn(`Failed ${M}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${n}" sourceBuffer (${I||"no media error"})`),(M>=this.hls.config.appendErrorMaxRetry||I)&&(x.fatal=!0)}this.hls.trigger(E.ERROR,x)}};this.log(`queuing "${n}" append sn: ${h}${l?" p: "+l.index:""} of ${o.type===X.MAIN?"level":"track"} ${o.level} cc: ${f}`),this.append(L,n,this.isPending(this.tracks[n]))}getFlushOp(e,t,s){return this.log(`queuing "${e}" remove ${t}-${s}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,s)},onStart:()=>{},onComplete:()=>{this.hls.trigger(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[we.AUDIOVIDEO]?n.push("audiovideo"):(a[we.AUDIO]&&n.push("audio"),a[we.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])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var s;this.sourceBuffers.forEach(([a])=>{if(a){const o=this.tracks[a];(!t.type||t.type===a)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${a} buffer reached EOS`)))}});const r=((s=this.overrides)==null?void 0:s.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([a])=>{var o;return a&&!((o=this.tracks[a])!=null&&o.ended)})?r?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:a}=this;if(!a||a.readyState!=="open"){a&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${a.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),a.endOfStream(),this.hls.trigger(E.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(E.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===w.BUFFER_APPEND_ERROR&&t.frag){var s;const r=(s=t.errorAction)==null?void 0:s.nextAutoLevel;z(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(z(o)&&o>=0){const d=Math.max(o,a),u=Math.floor(n/a)*a-d;this.flushBackBuffer(n,a,u)}const l=r.frontBufferFlushThreshold;if(z(l)&&l>0){const d=Math.max(r.maxBufferLength,l),u=Math.max(d,a),c=Math.floor(n/a)*a+u;this.flushFrontBuffer(n,a,c)}}flushBackBuffer(e,t,s){this.sourceBuffers.forEach(([r,n])=>{if(n){const o=de.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=de.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?.readyState!=="open")return null;const r=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&s.setLiveSeekableRange){const d=Math.max(0,t.fragmentStart),u=Math.max(d,r);return{duration:1/0,start:d,end:u}}return{duration:1/0}}const n=(e=this.overrides)==null?void 0:e.duration;if(n)return z(n)?{duration:n}:null;const a=this.media.duration,o=z(s.duration)?s.duration:0;return r>o&&r>a||!z(a)?{duration:r}:null}updateMediaSource({duration:e,start:t,end:s}){const r=this.mediaSource;!this.media||!r||r.readyState!=="open"||(r.duration!==e&&(z(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}) ${Me(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":""} ${Me(o)}`);try{const u=s.addSourceBuffer(d),c=tc(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")&&Za(s,"video")&&(r=QS(r,s));const n=ll(r,e.levelCodec);return n?t.slice(0,5)==="audio"?xd(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?.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?.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=z(r.duration)?r.duration:1/0,d=z(n.duration)?n.duration:1/0,u=Math.max(0,t),c=Math.min(s,l,d);c>u&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${u},${c}] from the ${e} SourceBuffer`),o.remove(u,c)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const s=this.tracks[t],r=s?.buffer;if(!r)throw new nL(`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 _g(i){const e=i.querySelectorAll("source");[].slice.call(e).forEach(t=>{i.removeChild(t)})}function oL(i,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,i.appendChild(t)}function tc(i){return i==="audio"?1:0}class jf{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&&z(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,jf.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,885 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 lL={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},xt=lL,dL={HLS:"h"},uL=dL;class Zi{constructor(e,t){Array.isArray(e)&&(e=e.map(s=>s instanceof Zi?s:new Zi(s))),this.value=e,this.params=t}}const cL="Dict";function hL(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 fL(i,e,t,s){return new Error(`failed to ${i} "${hL(e)}" as ${t}`,{cause:s})}function Ji(i,e,t){return fL("serialize",i,e,t)}class qE{constructor(e){this.description=e}}const Ag="Bare Item",mL="Boolean";function pL(i){if(typeof i!="boolean")throw Ji(i,mL);return i?"?1":"?0"}function gL(i){return btoa(String.fromCharCode(...i))}const vL="Byte Sequence";function EL(i){if(ArrayBuffer.isView(i)===!1)throw Ji(i,vL);return`:${gL(i)}:`}const yL="Integer";function TL(i){return i<-999999999999999||999999999999999<i}function YE(i){if(TL(i))throw Ji(i,yL);return i.toString()}function bL(i){return`@${YE(i.getTime()/1e3)}`}function jE(i,e){if(i<0)return-jE(-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 _L="Decimal";function AL(i){const e=jE(i,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Ji(i,_L);const t=e.toString();return t.includes(".")?t:`${t}.0`}const SL="String",IL=/[\x00-\x1f\x7f]+/;function LL(i){if(IL.test(i))throw Ji(i,SL);return`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function RL(i){return i.description||i.toString().slice(7,-1)}const xL="Token";function Sg(i){const e=RL(i);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Ji(e,xL);return e}function jc(i){switch(typeof i){case"number":if(!z(i))throw Ji(i,Ag);return Number.isInteger(i)?YE(i):AL(i);case"string":return LL(i);case"symbol":return Sg(i);case"boolean":return pL(i);case"object":if(i instanceof Date)return bL(i);if(i instanceof Uint8Array)return EL(i);if(i instanceof qE)return Sg(i);default:throw Ji(i,Ag)}}const kL="Key";function zc(i){if(/^[a-z*][a-z0-9\-_.*]*$/.test(i)===!1)throw Ji(i,kL);return i}function zf(i){return i==null?"":Object.entries(i).map(([e,t])=>t===!0?`;${zc(e)}`:`;${zc(e)}=${jc(t)}`).join("")}function zE(i){return i instanceof Zi?`${jc(i.value)}${zf(i.params)}`:jc(i)}function DL(i){return`(${i.value.map(zE).join(" ")})${zf(i.params)}`}function CL(i,e={whitespace:!0}){if(typeof i!="object"||i==null)throw Ji(i,cL);const t=i instanceof Map?i.entries():Object.entries(i),s=e?.whitespace?" ":"";return Array.from(t).map(([r,n])=>{n instanceof Zi||(n=new Zi(n));let a=zc(r);return n.value===!0?a+=zf(n.params):(a+="=",Array.isArray(n.value)?a+=DL(n):a+=zE(n)),a}).join(`,${s}`)}function QE(i,e){return CL(i,e)}const Ai="CMCD-Object",Ve="CMCD-Request",Qs="CMCD-Session",Ts="CMCD-Status",wL={br:Ai,ab:Ai,d:Ai,ot:Ai,tb:Ai,tpb:Ai,lb:Ai,tab:Ai,lab:Ai,url:Ai,pb:Ve,bl:Ve,tbl:Ve,dl:Ve,ltc:Ve,mtp:Ve,nor:Ve,nrr:Ve,rc:Ve,sn:Ve,sta:Ve,su:Ve,ttfb:Ve,ttfbb:Ve,ttlb:Ve,cmsdd:Ve,cmsds:Ve,smrt:Ve,df:Ve,cs:Ve,ts:Ve,cid:Qs,pr:Qs,sf:Qs,sid:Qs,st:Qs,v:Qs,msd:Qs,bs:Ts,bsd:Ts,cdn:Ts,rtp:Ts,bg:Ts,pt:Ts,ec:Ts,e:Ts},ML={REQUEST:Ve};function PL(i){return Object.keys(i).reduce((e,t)=>{var s;return(s=i[t])===null||s===void 0||s.forEach(r=>e[r]=t),e},{})}function OL(i,e){const t={};if(!i)return t;const s=Object.keys(i),r=e?PL(e):{};return s.reduce((n,a)=>{var o;const l=wL[a]||r[a]||ML.REQUEST,d=(o=n[l])!==null&&o!==void 0?o:n[l]={};return d[a]=i[a],n},t)}function NL(i){return["ot","sf","st","e","sta"].includes(i)}function UL(i){return typeof i=="number"?z(i):i!=null&&i!==""&&i!==!1}const XE="event";function $L(i,e){const t=new URL(i),s=new URL(e);if(t.origin!==s.origin)return i;const r=t.pathname.split("/").slice(1),n=s.pathname.split("/").slice(1,-1);for(;r[0]===n[0];)r.shift(),n.shift();for(;n.length;)n.shift(),r.unshift("..");return r.join("/")+t.search+t.hash}const fl=i=>Math.round(i),Qc=(i,e)=>Array.isArray(i)?i.map(t=>Qc(t,e)):i instanceof Zi&&typeof i.value=="string"?new Zi(Qc(i.value,e),i.params):(e.baseUrl&&(i=$L(i,e.baseUrl)),e.ver
48sion===1?encodeURIComponent(i):i),Po=i=>fl(i/100)*100,FL=(i,e)=>{let t=i;return e.version>=2&&(i instanceof Zi&&typeof i.value=="string"?t=new Zi([i]):typeof i=="string"&&(t=[i])),Qc(t,e)},BL={br:fl,d:fl,bl:Po,dl:Po,mtp:Po,nor:FL,rtp:Po,tb:fl},ZE="request",JE="response",Qf=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],HL=["e"],GL=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function mu(i){return GL.test(i)}function KL(i){return Qf.includes(i)||HL.includes(i)||mu(i)}const ey=["d","dl","nor","ot","rtp","su"];function VL(i){return Qf.includes(i)||ey.includes(i)||mu(i)}const WL=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function qL(i){return Qf.includes(i)||ey.includes(i)||WL.includes(i)||mu(i)}const YL=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function jL(i){return YL.includes(i)||mu(i)}const zL={[JE]:qL,[XE]:KL,[ZE]:VL};function ty(i,e={}){const t={};if(i==null||typeof i!="object")return t;const s=e.version||i.v||1,r=e.reportingMode||ZE,n=s===1?jL:zL[r];let a=Object.keys(i).filter(n);const o=e.filter;typeof o=="function"&&(a=a.filter(o));const l=r===JE||r===XE;l&&!a.includes("ts")&&a.push("ts"),s>1&&!a.includes("v")&&a.push("v");const d=De({},BL,e.formatters),u={version:s,reportingMode:r,baseUrl:e.baseUrl};return a.sort().forEach(c=>{let h=i[c];const f=d[c];if(typeof f=="function"&&(h=f(h,u)),c==="v"){if(s===1)return;h=s}c=="pr"&&h===1||(l&&c==="ts"&&!z(h)&&(h=Date.now()),UL(h)&&(NL(c)&&typeof h=="string"&&(h=new qE(h)),t[c]=h))}),t}function QL(i,e={}){const t={};if(!i)return t;const s=ty(i,e),r=OL(s,e?.customHeaderMap);return Object.entries(r).reduce((n,[a,o])=>{const l=QE(o,{whitespace:!1});return l&&(n[a]=l),n},t)}function XL(i,e,t){return De(i,QL(e,t))}const ZL="CMCD";function JL(i,e={}){return i?QE(ty(i,e),{whitespace:!1}):""}function eR(i,e={}){if(!i)return"";const t=JL(i,e);return encodeURIComponent(t)}function tR(i,e={}){if(!i)return"";const t=eR(i,e);return`${ZL}=${t}`}const Ig=/CMCD=[^&#]+/;function iR(i,e,t){const s=tR(e,t);if(!s)return i;if(Ig.test(i))return i.replace(Ig,s);const r=i.includes("?")?"&":"?";return`${i}${r}${s}`}class sR{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:xt.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===xt.VIDEO||l===xt.AUDIO||l==xt.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:uL.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){De(t,this.createData());const s=t.ot===xt.INIT||t.ot===xt.VIDEO||t.ot===xt.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={}),XL(e.headers,t,n)):e.url=iR(e.url,t,n)}getNextFrag(e){var t;const s=(t=this.hls.levels[e.level])==null?void 0:t.details;if(s){const r=e.sn-s.startSN;return s.fragments[r+1]}}getNextPart(e){var t;const{index:s,fragment:r}=e,n=(t=this.hls.levels[r.level])==null||(t=t.details)==null?void 0:t.partList;if(n){const{sn:a}=r;for(let o=n.length-1;o>=0;o--){const l=n[o];if(l.index===s&&l.fragment.sn===a)return n[o+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return xt.TIMED_TEXT;if(e.sn==="initSegment")return xt.INIT;if(t==="audio")return xt.AUDIO;if(t==="main")return this.hls.audioTracks.length?xt.VIDEO:xt.MUXED}getTopBandwidth(e){let t=0,s;const r=this.hls;if(e===xt.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===xt.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!t?NaN:de.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 rR=3e5;class nR extends ri{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?.action===yt.SendAlternateToPenaltyBox&&s.flags===Bt.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: ${Me(n)} penalized: ${Me(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,346 bytes, line 48
48Object.keys(s).forEach(n=>{r-s[n]>rR&&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,bE(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===me.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===me.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 Ge(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=iy(u.uri,c["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),p=new eo({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),Lg(this.audioTracks,s,l,a),Lg(this.subtitleTracks,r,l,a)})}loadSteeringManifest(e){const t=this.hls.config,s=t.loader;this.loader&&this.loader.destroy(),this.loader=new s(t);let r;try{r=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const u=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+u)}const n={responseType:"json",url:r.href},a=t.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},l={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},d={onSuccess:(u,c,h,f)=>{this.log(`Loaded steering manifest: "${r}"`);const m=u.data;if(m?.VERSION!==1){this.log(`Steering VERSION ${m.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=m.TTL;const{"RELOAD-URI":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?.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 Lg(i,e,t,s){i&&Object.keys(e).forEach(r=>{const n=i.filter(a=>a.groupId===r).map(a=>{const o=De({},a);return o.details=void 0,o.attrs=new Ge(o.attrs),o.url=o.attrs.URI=iy(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 iy(i,e,t,s){const{HOST:r,PARAMS:n,[t]:a}=s;let o;e&&(o=a?.[e],o&&(i=o));const l=new self.URL(i);
48return r&&!o&&(l.host=r),n&&Object.keys(n).sort().forEach(d=>{d&&l.searchParams.set(d,n[d])}),l.href}class Rn extends ri{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=Rn.CDMCleanupPromise?[Rn.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:s,initData:r}=t,n=`"${t.type}" event: init data type: "${s}"`;if(this.debug(n),r!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=ca(this.config));const o=a.map(Yu).filter(l=>!!l);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(a=>{const o=ul(a);if(s!=="sinf"||o!==Ke.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${s}" for selected key-system ${o}`);return}let l;try{const f=dt(new Uint8Array(r)),m=$f(JSON.parse(f).sinf),p=Qv(m);if(!p)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");l=new Uint8Array(p.subarray(8,24))}catch(f){this.warn(`${n} Failed to parse sinf: ${f}`);return}const d=Tt(l),{keyIdToKeySessionPromise:u,mediaKeySessions:c}=this;let h=u[d];for(let f=0;f<c.length;f++){const m=c[f],p=m.decryptdata;if(!p.keyId)continue;const g=Tt(p.keyId);if(Md(l,p.keyId)||p.uri.replace(/-/g,"").indexOf(d)!==-1){if(h=u[g],!h)continue;if(p.pssh)break;delete u[g],p.pssh=new Uint8Array(r),p.keyId=l,h=u[d]=h.then(()=>this.generateRequestWithPreferredKeySession(m,s,r,"encrypted-event-key-match")),h.catch(v=>this.handleError(v));break}}h||this.handleError(new Error(`Key ID ${d} not encountered in playlist. Key-system sessions ${c.length}.`))}).catch(a=>this.handleError(a))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}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===Ke.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 $t?o(c):o(new $t({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 fE===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return s(e,t)}getMediaKeysPromise(e,t,s){var r;const n=F1(e,t,s,this.config.drmSystemOptions||{});let a=this.keySystemAccessPromises[e],o=(r=a)==null?void 0:r.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Me(n)}`),o=this.requestMediaKeySystemAccess(e,n);const l=a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(d=>{this.log(`Failed to obtain access to key-system "${e}": ${d}`)}),o.then(d=>{this.log(`Access for key-system "${d.keySystem}" obtained`);const u=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const c=l.mediaKeys=d.createMediaKeys().then(h=>(this.log(`Media-keys created for "${e}"`),l.hasMediaKeys=!0,u.then(f=>f?this.setMediaKeysServerCertificate(h,e,f):h)));return c.catch(h=>{this.error(`Failed to create media-keys for "${e}"}: ${h}`)}),c})}return o.then(()=>a.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:s}){this.log(`Creating key-system session "${t}" keyId: ${Tt(e.keyId||[])} keyUri: ${e.uri}`);const r=s.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:s,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const s=this.createMediaKeySessionContext(e),r=Oo(t),n="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(s,n,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyId ${Tt(e.decryptdata.keyId||[])}
49      } (data length: ${t.byteLength})`),s.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>Yu(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=Yu(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=ca(this.config),s=e.map(ul).filter(r=>!!r&&t.indexOf(r)!==-1);return this.selectKeySystem(s)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let s=0;s<t.length;s++){const r=aR(e,t[s]);if(r)return r}}loadKey(e){const t=e.keyInfo.decryptdata,s=Oo(t),r=this.bannedKeyIds[s];if(r||this.getKeyStatus(t)==="internal-error"){const o=Rg(r||"internal-error",t);return this.handleError(o,e.frag),Promise.reject(o)}const n=`(keyId: ${s} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${n}`);const a=this.keyIdToKeySessionPromise[s];if(!a){const o=this.getKeySystemForKeyPromise(t).then(({keySystem:l,mediaKeys:d})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${n}`),this.attemptSetMediaKeys(l,d).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:l,mediaKeys:d,decryptdata:t}))))).then(l=>{const d="cenc",u=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(l,d,u,"playlist-key")});return o.catch(l=>this.handleError(l,e.frag)),this.keyIdToKeySessionPromise[s]=o,o}return a.catch(o=>{if(o instanceof $t){const l=Le({},o.data);this.getKeyStatus(t)==="internal-error"&&(l.decryptdata=t);const d=new $t(l,o.message);this.handleError(d,e.frag)}}),a}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof $t){t&&(e.data.frag=t);const s=e.data.decryptdata;this.error(`${e.message}${s?` (${Tt(s.keyId||[])})`:""}`),this.hls.trigger(E.ERROR,e.data)}else this.error(e.message),this.hls.trigger(E.ERROR,{type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}
49getKeySystemForKeyPromise(e){const t=Oo(e),s=this.keyIdToKeySessionPromise[t];if(!s){const r=ul(e.keyFormat),n=r?[r]:ca(this.config);return this.attemptKeySystemAccess(n)}return s}getKeySystemSelectionPromise(e){if(e.length||(e=ca(this.config)),e.length===0)throw new $t({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Me({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(s).then(()=>this.media?this.media.setMediaKeys(t):new Promise((n,a)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return a(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(n).catch(a)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),s.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>s.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,s,r){var n;const a=(n=this.config.drmSystems)==null||(n=n[e.keySystem])==null?void 0:n.generateRequest;if(a)try{const m=a.call(this.hls,t,s,e);if(!m)throw new Error("Invalid response from configured generateRequest filter");t=m.initDataType,s=m.initData?m.initData:null,e.decryptdata.pssh=s?new Uint8Array(s):null}catch(m){if(this.warn(m.message),this.hls&&this.hls.config.debug)throw m}if(s===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const o=Oo(e.decryptdata),l=e.decryptdata.uri;this.log(`Generating key-session request for "${r}" keyId: ${o} URI: ${l} (init data type: ${t} length: ${s.byteLength})`);const d=new Bf,u=e._onmessage=m=>{const p=e.mediaKeysSession;if(!p){d.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=>{d.eventNames().length?d.emit("error",T):this.handleError(T)}):g==="license-release"?e.keySystem===Ke.FAIRPLAY&&this.updateKeySession(e,Gc("acknowledged")).then(()=>this.removeSession(e)).catch(T=>this.handleError(T)):this.warn(`unhandled media key message type "${g}"`)},c=(m,p)=>{p.keyStatus=m;let g;m.startsWith("usable")?d.emit("resolved"):m==="internal-error"||m==="output-restricted"||m==="output-downscaled"?g=Rg(m,p.decryptdata):m==="expired"?g=new Error(`key expired (keyId: ${o})`):m==="released"?g=new Error("key released"):m==="status-pending"||this.warn(`unhandled key status change "${m}" (keyId: ${o})`),g&&(d.eventNames().length?d.emit("error",g):this.handleError(g))},h=e._onkeystatuseschange=m=>{if(!e.mediaKeysSession){d.emit("error",new Error("invalid state"));return}const g=this.getKeyStatuses(e);if(!Object.keys(g).some(b=>g[b]!=="status-pending"))return;if(g[o]==="expired"){this.log(`Expired key ${Me(g)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let T=g[o];if(T)c(T,e);else{var y;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(y=e.keyStatusTimeouts)[o]||(y[o]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const A=this.getKeyStatus(e.decryptdata);if(A&&A!=="status-pending")return this.log(`No status for keyId ${o} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${A} from other session.`),c(A,e);this.log(`key status for ${o} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),T="internal-error",c(T,e)},1e3)),this.log(`No status for keyId ${o} (${Me(g)}).`)}};Rt(e.mediaKeysSession,"message",u),Rt(e.mediaKeysSession,"keystatuseschange",h);const f=new Promise((m,p)=>{d.on("error",p),d.on("resolved",m)});return e.mediaKeysSession.generateRequest(t,s).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o} URI: ${l}`)}).catch(m=>{throw new $t({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_SESSION,error:m,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${m}`)}).then(()=>f).catch(m=>(d.removeAllListeners(),this.removeSession(e).then(()=>{throw m}))).then(()=>(d.removeAllListeners(),e))}getKeyStatuses(e){const t={};
vendor: 9,878 bytes, line 49
49return e.mediaKeysSession.keyStatuses.forEach((s,r)=>{if(typeof r=="string"&&typeof s=="object"){const o=r;r=s,s=o}const n="buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r);if(e.keySystem===Ke.PLAYREADY&&n.length===16){const o=Tt(n);t[o]=s,cE(n)}const a=Tt(n);s==="internal-error"&&(this.bannedKeyIds[a]=s),this.log(`key status change "${s}" for keyStatuses keyId: ${a} key-session "${e.mediaKeysSession.sessionId}"`),t[a]=s}),t}fetchServerCertificate(e){const t=this.config,s=t.loader,r=new s(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,o)=>{const l={responseType:"arraybuffer",url:n},d=t.certLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(h,f,m,p)=>{a(h.data)},onError:(h,f,m,p)=>{o(new $t({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:Le({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${n}). Status: ${h.code} (${h.text})`))},onTimeout:(h,f,m)=>{o(new $t({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()}setMediaKeysServerCertificate(e,t,s){return new Promise((r,n)=>{e.setServerCertificate(s).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${s.byteLength}) on "${t}"`),r(e)}).catch(a=>{n(new $t({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 $t({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:r,fatal:!1},r.message)}))}unpackPlayReadyKeyMessage(e,t){const s=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!s.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const r=new DOMParser().parseFromString(s,"application/xml"),n=r.querySelectorAll("HttpHeader");if(n.length>0){let u;for(let c=0,h=n.length;c<h;c++){var a,o;u=n[c];const f=(a=u.querySelector("name"))==null?void 0:a.textContent,m=(o=u.querySelector("value"))==null?void 0:o.textContent;f&&m&&e.setRequestHeader(f,m)}}const l=r.querySelector("Challenge"),d=l?.textContent;if(!d)throw new Error("Cannot find <Challenge> in key message");return Gc(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 $t({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{const u=d-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${u} attempts left`),this.requestLicense(e,t).then(r,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then(({xhr:l,licenseChallenge:d})=>{e.keySystem==Ke.PLAYREADY&&(d=this.unpackPlayReadyKeyMessage(l,d)),l.send(d)}).catch(n)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const s=t.media;this.media=s,Rt(s,"encrypted",this.onMediaEncrypted),Rt(s,"waitingforkey",this.onWaitingForKey);const r=this.mediaResolved;r?r():this.mediaKeys=s.mediaKeys}onMediaDetached(){const e=this.media;e&&(Ct(e,"encrypted",this.onMediaEncrypted),Ct(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const s=this.media,r=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Hs.clearKeyUriToKeyIdMap();const n=r.length;Rn.CDMCleanupPromise=Promise.all(r.map(a=>this.removeSession(a)).concat((s==null||(e=s.setMediaKeys(null))==null?void 0:e.catch(a=>{this.log(`Could not clear media keys: ${a}`),this.hls&&this.hls.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: ${a}`)})}))||Promise.resolve())).catch(a=>{this.log(`Could not close sessions and clear media keys: ${a}`),this.hls&&this.hls.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 keys: ${a}`)})}).then(()=>{n&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const s=t.reduce((r,n)=>(r.indexOf(n.keyFormat)===-1&&r.push(n.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${s.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(s)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:s,decryptdata:r}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${Tt(r?.keyId||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(e);n>-1&&this.mediaKeySessions.splice(n,1);const{keyStatusTimeouts:a}=e;a&&Object.keys(a).forEach(d=>self.clearTimeout(a[d]));const{drmSystemOptions:o}=this.config;return(H1(o)?new Promise((d,u)=>{self.setTimeout(()=>u(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(d).catch(u)}):Promise.resolve()).catch(d=>{this.log(`Could not remove session: ${d}`),this.hls&&this.hls.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${d}`)})}).then(()=>t.close()).catch(d=>{this.log(`Could not close session: ${d}`),this.hls&&this.hls.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${d}`)})})}return Promise.resolve()}}Rn.CDMCleanupPromise=void 0;function Oo(i){if(!i)throw new Error("Could not read keyId of undefined decryptdata");if(i.keyId===null)throw new Error("keyId is null");return Tt(i.keyId)}function aR(i,e){if(i.keyId&&e.mediaKeysSession.keyStatuses.has(i.keyId))return e.mediaKeysSession.keyStatuses.get(i.keyId);if(i.matches(e.decryptdata))return e.keyStatus}class $t extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}function Rg(i,e){const t=i==="output-restricted",s=t?w.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:w.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new $t({type:te.KEY_SYSTEM_ERROR,details:s,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${i}"`)}class oR{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>
vendor: 9,979 bytes, line 49
490&&(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 sy(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 ry(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){Re.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){Re.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(i.mode=t)}function yn(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 Xc(i,e,t,s){const r=i.mode;if(r==="disabled"&&(i.mode="hidden"),i.cues&&i.cues.length>0){const n=dR(i.cues,e,t);for(let a=0;a<n.length;a++)(!s||s(n[a]))&&i.removeCue(n[a])}r==="disabled"&&(i.mode=r)}function lR(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 dR(i,e,t){const s=[],r=lR(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 ml(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 uR extends Yf{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=ml(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;ml(s.textTracks).forEach(a=>{yn(a)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:s,groupId:r,details:n}=t,a=this.tracksInGroup[s];if(!a||a.groupId!==r){this.warn(`Subtitle track with id:${s} and group:${r} not found in active group ${a?.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Subtitle track ${s} "${a.name}" lang:${a.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.subtitleGroups||null,r=this.groupIds;let n=this.currentTrack;if(!s||r?.length!==s?.length||s!=null&&s.some(a=>r?.indexOf(a)===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(u=>!s||s.indexOf(u.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(u=>u.default)&&(this.selectDefaultTrack=!1),a.forEach((u,c)=>{u.id=c});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const o=this.hls.config.subtitlePreference;if(!n&&o){this.selectDefaultTrack=!1;const u=Wi(o,a);if(u>-1)n=a[u];else{const c=Wi(o,this.tracks);n=this.tracks[c]}}let l=this.findTrackId(n);l===-1&&n&&(l=this.findTrackId(null));const d={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${s?.join(",")}" group-id`),this.hls.trigger(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||yr(n,e)))return r}if(e){for(let r=0;r<t.length;r++){const n=t[r];if(ro(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const n=t[r];if(ro(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===me.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&&yr(e,s))return s;const r=Wi(e,this.tracksInGroup);if(r>-1){const n=this.tracksInGroup[r];return this.setSubtitleTrack(r),n}else{if(s)return null;{const n=Wi(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const s=e.id,r=e.groupId,n=this.getUrlWithDirectives(e.url,t),a=e.details,o=a?.age;this.log(`Loading subtitle ${s} "${e.name}" lang:${e.lang} group:${r}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${n}`),this.hls.trigger(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=ml(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||!z(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?.details,r.details);this.loadPlaylist(c)}}function cR(){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 Fa(i){let e=5381,t=i.length;for(;t;
vendor: 8,464 bytes, line 49
49)e=e*33^i.charCodeAt(--t);return(e>>>0).toString()}const xn=.025;let Ud=(function(i){return i[i.Point=0]="Point",i[i.Range=1]="Range",i})({});function hR(i,e,t){return`${i.identifier}-${t+1}-${Fa(e)}`}class fR{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 ic(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=ic(t,e);return t-s<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=z(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 ic(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)<xn))}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"?Ud.Range:Ud.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 mR(this)}}function ic(i,e){return i-e.start<e.duration/2&&!(Math.abs(i-(e.start+e.duration))<xn)?e.start:e.start+e.duration}function ny(i,e,t){const s=new self.URL(i,t);return s.protocol!=="data:"&&s.searchParams.set("_HLS_primary_id",e),s}function sc(i,e){for(;(t=i.assetList[++e])!=null&&t.error;)var t;return e}function mR(i){return`["${i.identifier}" ${i.cue.pre?"<pre>":i.cue.post?"<post>":""}${i.timelineStart.toFixed(2)}-${i.resumeTime.toFixed(2)}]`}function Yr(i){const e=i.timelineStart,t=i.duration||0;return`["${i.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class pR{constructor(e,t,s,r){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(E.PLAYOUT_LIMIT_REACHED,{})};const n=this.hls=new e(t);this.interstitial=s,this.assetItem=r;const a=()=>{this.hasDetails=!0};n.once(E.LEVEL_LOADED,a),n.once(E.AUDIO_TRACK_LOADED,a),n.once(E.SUBTITLE_TRACK_LOADED,a),n.on(E.MEDIA_ATTACHING,(o,{media:l})=>{this.removeMediaListeners(),this.mediaAttached=l,this.interstitial.playoutLimit&&(l.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&n.on(E.BUFFER_APPENDED,()=>{const u=this.bufferedEnd;this.reachedPlayout(u)&&(this._bufferedEosTime=u,n.trigger(E.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=ny(t,e.config.primarySessionId||"").href}catch{}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;const s=Math.min(this._bufferedEosTime||1/0,this.duration),r=this.timelineOffset,n=de.bufferInfo(e,r,0);return this.getAssetTime(n.end)>=s-.02}reachedPlayout(e){const s=this.interstitial.playoutLimit;return this.startOffset+e>=s}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=de.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const s=t-this.startOffset;if(s>0&&s<e)return s}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const s=e-t;if(Math.abs(s)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,s=this.duration;return Math.min(Math.max(0,e-t),s)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=s=>delete s.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,s){var r;(r=this.hls)==null||r.on(e,t)}once(e,t,s){var r;(r=this.hls)==null||r.once(e,t)}off(e,t,s){var r;(r=this.hls)==null||r.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${Yr(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const xg=.033;class gR extends ri{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={}
vendor: 7,529 bytes, line 49
49,this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((s,r)=>e<=r.startOffset&&t>r.startOffset?(delete r.error,s+1):s,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let s=-1;e.nextEvent?s=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(s=this.findEventIndex(e.previousEvent.identifier)+1);const r=this.items;if(r)for(r[s]||(t===void 0&&(t=e.start),s=this.findItemIndexAtTime(t));s>=0&&(n=r[s])!=null&&n.event;){var n;s--}return s}findItemIndexAtTime(e,t){const s=this.items;if(s)for(let r=0;r<s.length;r++){let n=s[r];if(t&&t!=="primary"&&(n=n[t]),e===n.start||e>n.start&&e<n.end)return r}return-1}findJumpRestrictedIndex(e,t){const s=this.items;if(s)for(let r=e;r<=t&&s[r];r++){const n=s[r].event;if(n!=null&&n.restrictions.jump&&!n.appendInPlace)return r}return-1}findEventIndex(e){const t=this.items;if(t)for(let r=t.length;r--;){var s;if(((s=t[r].event)==null?void 0:s.identifier)===e)return r}return-1}findAssetIndex(e,t){const s=e.assetList,r=s.length;if(r>1)for(let n=0;n<r;n++){const a=s[n];if(!a.error){const o=a.timelineStart;if(t===o||t>o&&(t<o+(a.duration||0)||n===r-1))return n}}return 0}get assetIdAtEnd(){var e;const t=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(t){const s=t.assetList,r=s[s.length-1];if(r)return r.identifier}return null}parseInterstitialDateRanges(e,t){const s=e.main.details,{dateRanges:r}=s,n=this.events,a=this.parseDateRanges(r,{url:s.url},t),o=Object.keys(r),l=n?n.filter(d=>!o.includes(d.identifier)):[];a.length&&a.sort((d,u)=>{const c=d.cue.pre,h=d.cue.post,f=u.cue.pre,m=u.cue.post;if(c&&!f)return-1;if(f&&!c||h&&!m)return 1;if(m&&!h)return-1;if(!c&&!f&&!h&&!m){const 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=[],s=!1){const r=this.events||[];if(r.length||t.length||this.length<2){const n=this.items,a=this.parseSchedule(r,e);(s||t.length||n?.length!==a.length||a.some((l,d)=>Math.abs(l.playout.start-n[d].playout.start)>.005||Math.abs(l.playout.end-n[d].playout.end)>.005))&&(this.items=a,this.onScheduleUpdate(t,n))}}parseDateRanges(e,t,s){const r=[],n=Object.keys(e);for(let a=0;a<n.length;a++){const o=n[a],l=e[o];if(l.isInterstitial){let d=this.eventMap[o];d?d.setDateRange(l):(d=new fR(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===Ud.Range?v:0,y=u.resumptionOffset,b=m?.startTime===g,A=g+u.cumulativeDuration;let L=p?A+v:g+y;if(h||!f&&g<=0){const R=d;d+=T,u.timelineStart=A;const x=a;a+=v,s.push({event:u,start:A,end:L,playout:{start:x,end:a},integrated:{start:R,end:d}})}else if(g<=n){if(!b){const I=g-l;if(I>xg){const M=l,F=d;d+=I;const V=a;a+=I;const Y={previousEvent:e[c-1]||null,nextEvent:u,start:M,end:M+I,playout:{start:V,end:a},integrated:{start:F,end:d}};s.push(Y)}else I>0&&m&&(m.cumulativeDuration+=I,s[s.length-1].end=g)}f&&(L=A),u.timelineStart=A;const R=d;d+=T;const x=a;a+=v,s.push({event:u,start:A,end:L,playout:{start:x,end:a},integrated:{start:R,end:d}})}else return;const S=u.resumeTime;f||S>n?l=n:l=S}),l<n){var o;const u=l,c=d,h=n-l;d+=h;const f=a;a+=h,s.push({previousEvent:((o=s[s.length-1])==null?void 0:o.event)||null,nextEvent:null,start:l,end:u+h,playout:{start:f,end:a},integrated:{start:c,end:d}})}this.setDurations(n,a,d)}else s.push({previousEvent:null,nextEvent:null,start:0,end:n,playout:{start:0,end:n},integrated:{start:0,end:n}}),this.setDurations(n,n,n);return s}setDurations(e,t,s){this.durations={primary:e,playout:t,integrated:s}}resolveOffsets(e,t){const s=t.main.details,r=s.live?1/0:s.edge;let n=0,a=-1;e.forEach((o,l)=>{const d=o.cue.pre,u=o.cue.post,c=d?0:u?r:o.startTime;this.updateAssetDurations(o),a===c?o.cumulativeDuration=n:(n=0,a=c),!u&&o.snapOptions.in&&(o.resumeAnchor=Rr(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<xg&&(e[l+1].appendInPlace=!1,e[l+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const f=z(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)>xn?(this.log(`"${e.identifier}" resumption ${s} not aligned with estimated timeline end ${r}`),!1):!Object.keys(t).some(a=>{const o=t[a].details,l=o.edge;if(s>=l)return this.log(`"${e.identifier}" resumption ${s} past ${a} playlist end ${l}`),!1;const d=Rr(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)<xn+u||Math.abs(d.end-s)<xn+u?!1:(this.log(`"${e.identifier}" resumption ${s} not aligned with ${a} fragment bounds (${d.start}-${d.end} sn: ${d.sn} cc: ${d.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let s=0,r=!1,n=!1;for(let a=0;a<e.assetList.length;a++){const o=e.assetList[a],l=t+s;o.startOffset=s,o.timelineStart=l,r||(r=o.duration===null),n||(n=!!o.error);const d=o.error?0:o.duration||0;s+=d}r&&!n?e.duration=Math.max(s,e.duration):e.duration=s}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function li(i){return`[${i.event?'"'+i.event.identifier+'"':"primary"}: ${i.start.toFixed(2)}-${i.end.toFixed(2)}]`}class vR{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const s=e.assetListUrl;let r;try{r=ny(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?.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_E
vendor: 37,432 bytes, lines 49-50
49RROR,details:t,fatal:!1,interstitial:e,url:r,error:s,networkDetails:a,stats:n}}}function kg(i){var e;i==null||(e=i.play())==null||e.catch(()=>{})}function No(i,e){return`[${i}] Advancing timeline position to ${e}`}class ER extends ri{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled||!this.schedule)return;const r=s-this.timelinePos;if(Math.abs(r)<1/7056e5)return;const a=r<=-.01;this.timelinePos=s,this.bufferedPos=s;const o=this.playingItem;if(!o){this.checkBuffer();return}if(a&&this.schedule.resetErrorsInRange(s,s-r)&&this.updateSchedule(!0),this.checkBuffer(),a&&s<o.start||s>=o.end){var l;const f=this.findItemIndex(o);let m=this.schedule.findItemIndexAtTime(s);if(m===-1&&(m=f+(a?-1:1),this.log(`seeked ${a?"back ":""}to position not covered by schedule ${s} (resolving from ${f} to ${m})`)),!this.isInterstitial(o)&&(l=this.media)!=null&&l.paused&&(this.shouldPlay=!1),!a&&m>f){const p=this.schedule.findJumpRestrictedIndex(f+1,m);if(p>f){this.setSchedulePosition(p);return}}this.setSchedulePosition(m);return}const d=this.playingAsset;if(!d){if(this.playingLastItem&&this.isInterstitial(o)){const f=o.event.assetList[0];f&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(s,f))}return}const u=d.timelineStart,c=d.duration||0;if(a&&s<u||s>=u+c){var h;(h=o.event)!=null&&h.appendInPlace&&(this.clearAssetPlayers(o.event,o),this.flushFrontBuffer(s)),this.setScheduleToAssetAtTime(s,d)}},this.onTimeupdate=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled)return;if(s>this.timelinePos)this.timelinePos=s,s>this.bufferedPos&&this.checkBuffer();else return;const r=this.playingItem;if(!r||this.playingLastItem)return;if(s>=r.end){this.timelinePos=r.end;const o=this.findItemIndex(r);this.setSchedulePosition(o+1)}const n=this.playingAsset;if(!n)return;const a=n.timelineStart+(n.duration||0);s>=a&&this.setScheduleToAssetAtTime(s,n)},this.onScheduleUpdate=(s,r)=>{const n=this.schedule;if(!n)return;const a=this.playingItem,o=n.events||[],l=n.items||[],d=n.durations,u=s.map(p=>p.identifier),c=!!(o.length||u.length);(c||r)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
50Schedule: ${l.map(p=>li(p))} pos: ${this.timelinePos}`),u.length&&this.log(`Removed events ${u}`);let h=null,f=null;a&&(h=this.updateItem(a,this.timelinePos),this.itemsMatch(a,h)?this.playingItem=h:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const m=this.bufferingItem;if(m&&(f=this.updateItem(m,this.bufferedPos),this.itemsMatch(m,f)?this.bufferingItem=f:m.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(m.event,null))),s.forEach(p=>{p.assetList.forEach(g=>{this.clearAssetPlayer(g.identifier,null)})}),this.playerQueue.forEach(p=>{if(p.interstitial.appendInPlace){const g=p.assetItem.timelineStart,v=p.timelineOffset-g;if(v)try{p.timelineOffset=g}catch(T){Math.abs(v)>xn&&this.warn(`${T} ("${p.assetId}" ${p.timelineOffset}->${g})`)}}}),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}a&&this.trimInPlace(h,a),m&&f!==h&&this.trimInPlace(f,m),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new vR(e),this.schedule=new gR(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(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.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){Ct(e,"play",this.onPlay),Ct(e,"pause",this.onPause),Ct(e,"seeking",this.onSeeking),Ct(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const s=this.media=t.media;Rt(s,"seeking",this.onSeeking),Rt(s,"timeupdate",this.onTimeupdate),Rt(s,"play",this.onPlay),Rt(s,"pause",this.onPause)}onMediaAttached(e,t){const s=this.effectivePlayingItem,r=this.detachedData;if(this.detachedData=null,s===null)this.checkStart();else if(!r){this.clearScheduleState();const n=this.findItemIndex(s);this.setSchedulePosition(n)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const s=!!t.transferMedia,r=this.media;if(this.media=null,!s&&(r&&this.removeMediaListeners(r),this.detachedData)){const n=this.getBufferingPlayer();n&&(this.log(`Removing schedule state for detachedData and ${n}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,n.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,s=c=>c&&e.getAssetPlayer(c.identifier),r=(c,h,f,m,p)=>{if(c){let g=c[h].start;const v=c.event;if(v){if(h==="playout"||v.timelineOccupancy!==Ud.Point){const T=s(f);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)=>{var f;if(c!==0&&h!=="primary"&&(f=e.schedule)!=null&&f.length){var m;const p=e.schedule.findItemIndexAtTime(c),g=(m=e.schedule.items)==null?void 0:m[p];if(g){const v=g[h].start-g.start;return c+v}}return c},a=()=>{const c=e.bufferedPos;return c===Number.MAX_VALUE?o("primary"):Math.max(c,0)},o=c=>{var h,f;return(h=e.primaryDetails)!=null&&h.live?e.primaryDetails.edge:((f=e.schedule)==null?void 0:f.durations[c])||0},l=(c,h)=>{var f,m;const p=e.effectivePlayingItem;if(p!=null&&(f=p.event)!=null&&f.restrictions.skip||!e.schedule)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(),b=y?.interstitial,A=b?.appendInPlace,L=g&&e.itemsMatch(g,T);if(g&&(A||L)){const S=s(e.playingAsset),R=S?.media||e.primaryMedia;if(R){const x=h==="primary"?R.currentTime:r(g,h,e.playingAsset,"timelinePos","currentTime"),I=c-x,M=(A?x:R.currentTime)+I;if(M>=0&&(!S||A||M<=S.duration)){R.currentTime=M;return}}}if(T){let S=c;if(h!=="primary"){const x=T[h].start,I=c-x;S=T.start+I}const R=!e.isInterstitial(T);if((!e.isInterstitial(g)||g.event.appendInPlace)&&(R||T.event.appendInPlace)){const x=e.media||(A?y?.media:null);x&&(x.currentTime=S)}else if(g){const x=e.findItemIndex(g);if(v>x){const M=e.schedule.findJumpRestrictedIndex(x+1,v);if(M>x){e.setSchedulePosition(M);return}}let I=0;if(R)e.timelinePos=S,e.checkBuffer();else{const M=T.event.assetList,F=c-(T[h]||T).start;for(let V=M.length;V--;){const Y=M[V];if(Y.duration&&F>=Y.startOffset&&F<Y.startOffset+Y.duration){I=V;break}}}e.setSchedulePosition(v,I)}}},d=()=>{const c=e.effectivePlayingItem;if(e.isInterstitial(c))return c;const h=t();return e.isInterstitial(h)?h:null},u={get bufferedEnd(){const c=t(),h=e.bufferingItem;if(h&&h===c){var f;return r(h,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-h.playout.start||((f=e.bufferingAsset)==null?void 0:f.startOffset)||0}return 0},get currentTime(){const c=d(),h=e.effectivePlayingItem;return h&&h===c?r(h,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-h.playout.start:0},set currentTime(c){const h=d(),f=e.effectivePlayingItem;f&&f===h&&l(c+f.playout.start,"playout")},get duration(){const c=d();return c?c.playout.end-c.playout.start:0},get assetPlayers(){var c;const h=(c=d())==null?void 0:c.event.assetList;return h?h.map(f=>e.getAssetPlayer(f.identifier)):[]},get playingIndex(){var c;const h=(c=d())==null?void 0:c.event;return h&&e.effectivePlayingAsset?h.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return d()}};return this.manager={get events(){var c;return((c=e.schedule)==null||(c=c.events)==null?void 0:c.slice(0))||[]},get schedule(){var c;return((c=e.schedule)==null||(c=c.items)==null?void 0:c.slice(0))||[]},get interstitialPlayer(){return d()?u:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const c=t();return e.findItemIndex(c)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const c=e.effectivePlayingItem;return e.findItemIndex(c)},primary:{get bufferedEnd(){return a()},get currentTime(){const c=e.timelinePos;return c>0?c:0},set currentTime(c){l(c,"primary")},get duration(){return o("primary")},get seekableStart(){var c;return((c=e.primaryDetails)==null?void 0:c.fragmentStart)||0}},integrated:{get bufferedEnd(){return r(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return r(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(c){l(c,"integrated")},get duration(){return o("integrated")},get seekableStart(){var c;return n(((c=e.primaryDetails)==null?void 0:c.fragmentStart)||0,"integrated")}},skip:()=>{const c=e.effectivePlayingItem,h=c?.event;if(h&&!h.restrictions.skip){const f=e.findItemIndex(c);if(h.appendInPlace){const m=c.playout.start+c.event.duration;l(m+.001,"playout")}else e.advanceAfterAssetEnded(h,f,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,s=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!s?!1:this.findItemIndex(t)===s.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const s=this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&!s.event.appendInPlace)return;let r=this.media;!r&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(r=this.primaryMedia);const n=(t=r)==null?void 0:t.currentTime;if(!(n===void 0||!z(n)))return n}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const s=this.getAssetPlayer(e);s&&this.transferMediaFromPlayer(s,t)}transferMediaFromPlayer(e,t){const s=e.interstitial.appendInPlace,r=e.media;if(s&&r===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&r){this.detachedData={media:r};return}const n=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Me(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 m=this.getBufferingPlayer();m?(n=m.transferMedia(),u=`${m}`):u="detached MediaSource"}else u="detached media";if(!n){if(d)n=this.detachedData,this.log(`using detachedData: MediaSource ${Me(n)}`);else if(!this.detachedData||a.media===t){const m=this.playerQueue;m.length>1&&m.forEach(p=>{if(o&&p.interstitial.appendInPlace!==l){const g=p.interstitial;this.clearInterstitial(p.interstitial,null),g.appendInPlace=!1,g.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${g}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const c=n&&"mediaSource"in n&&((r=n.mediaSource)==null?void 0:r.readyState)!=="closed",h=c&&n?n:t;this.log(`${c?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${u} (media.currentTime: ${t.currentTime})`);const f=this.schedule;if(h===n&&f){const m=o&&e.assetId===f.assetIdAtEnd;h.overrides={duration:f.duration,endOfStream:!o||m,cueRemoval:!o}}e.attachMedia(h)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e?.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const s=this.timelinePos,r=this.effectivePlayingItem;if(s===-1){const n=this.hls.startPosition;if(this.log(No("checkStart",n)),this.timelinePos=n,t.length&&t[0].cue.pre){const a=e.findEventIndex(t[0].identifier);this.setSchedulePosition(a)}else if(n>=0||!this.primaryLive){const a=this.timelinePos=n>0?n:0,o=e.findItemIndexAtTime(a);this.setSchedulePosition(o)}}else if(r&&!this.playingItem){const n=e.findItemIndex(r);this.setSchedulePosition(n)}}advanceAssetBuffering(e,t){const s=e.event,r=s.findAssetIndex(t),n=sc(s,r);if(!s.isAssetPastPlayoutLimit(n))this.bufferedToEvent(e,n);else if(this.schedule){var a;const o=(a=this.schedule.items)==null?void 0:a[this.findItemIndex(e)+1];o&&this.bufferedToItem(o)}}advanceAfterAssetEnded(e,t,s){const r=sc(e,s);if(e.isAssetPastPlayoutLimit(r)){if(this.schedule){const n=this.schedule.items;if(n){const a=t+1,o=n.length;if(a>=o){this.setSchedulePosition(-1);return}const l=e.resumeTime;this.timelinePos<l&&(this.log(No("advanceAfterAssetEnded",l)),this.timelinePos=l,e.appendInPlace&&this.advanceInPlace(l),this.checkBuffer(this.bufferedPos<l)),this.setSchedulePosition(a)}}}else{if(e.appendInPlace){const n=e.assetList[r];n&&this.advanceInPlace(n.timelineStart)}this.setSchedulePosition(t,r)}}setScheduleToAssetAtTime(e,t){const s=this.schedule;if(!s)return;const r=t.parentIdentifier,n=s.getEvent(r);if(n){const a=s.findEventIndex(r),o=s.findAssetIndex(n,e);this.advanceAfterAssetEnded(n,a,o-1)}}setSchedulePosition(e,t){var s;const r=(s=this.schedule)==null?void 0:s.items;if(!r||this.playbackDisabled)return;const n=e>=0?r[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${n&&li(n)}) pos: ${this.timelinePos}`);const a=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(a)){const u=a.event,c=this.playingAsset,h=c?.identifier,f=h?this.getAssetPlayer(h):null;if(f&&h&&(!this.eventItemsMatch(a,n)||t!==void 0&&h!==u.assetList[t].identifier)){var l;const m=u.findAssetIndex(c);if(this.log(`INTERSTITIAL_ASSET_ENDED ${m+1}/${u.assetList.length} ${Yr(c)}`),this.endedAsset=c,this.playingAsset=null,this.hls.trigger(E.INTERSTITIAL_ASSET_ENDED,{asset:c,assetListIndex:m,event:u,schedule:r.slice(0),scheduleIndex:e,player:f}),a!==this.playingItem){this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(u,this.findItemIndex(this.playingItem),m);return}this.retreiveMediaSource(h,n),f.media&&!((l=this.detachedData)!=null&&l.mediaSource)&&f.detachMedia()}if(!this.eventItemsMatch(a,n)&&(this.endedItem=a,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${u} ${li(a)}`),u.hasPlayed=!0,this.hls.trigger(E.INTERSTITIAL_ENDED,{event:u,schedule:r.slice(0),scheduleIndex:e}),u.cue.once)){var d;this.updateSchedule();const m=(d=this.schedule)==null?void 0:d.items;if(n&&m){const p=this.findItemIndex(n);this.advanceSchedule(p,m,t,a,o)}return}}this.advanceSchedule(e,r,t,a,o)}advanceSchedule(e,t,s,r,n){const a=this.schedule;if(!a)return;const o=t[e]||null,l=this.primaryMedia,d=this.playerQueue;if(d.length&&d.forEach(u=>{const c=u.interstitial,h=a.findEventIndex(c.identifier);(h<e||h>e+1)&&this.clearInterstitial(c,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const u=o.event;if(s===void 0){s=a.findAssetIndex(u,this.timelinePos);const m=sc(u,s-1);if(u.isAssetPastPlayoutLimit(m)||u.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(u,e,s);return}s=m}const c=this.waitingItem;this.assetsBuffered(o,l)||this.setBufferingItem(o);let h=this.preloadAssets(u,s);if(this.eventItemsMatch(o,c||r)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${li(o)} ${u.appendInPlace?"append in place":""}`),this.hls.trigger(E.INTERSTITIAL_STARTED,{event:u,schedule:t.slice(0),scheduleIndex:e})),!u.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${u}`);return}if(u.assetListLoader&&(u.assetListLoader.destroy(),u.assetListLoader=void 0),!l){this.log(`Waiting for attachMedia to start Interstitial ${u}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const f=u.assetList[s];if(!f){this.advanceAfterAssetEnded(u,e,s||0);return}if(h||(h=this.getAssetPlayer(f.identifier)),h===null||h.destroyed){const m=u.assetList.length;this.warn(`asset ${s+1}/${m} player destroyed ${u}`),h=this.createAssetPlayer(u,f,s),h.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&u.appendInPlace&&this.isAssetBuffered(f))return;this.startAssetPlayer(h,s,t,e,l),this.shouldPlay&&kg(h.media)}else o?(this.resumePrimary(o,e,r),this.shouldPlay&&kg(this.hls.media)):n&&this.isInterstitial(r)&&(this.endedItem=null,this.playingItem=r,r.event.appendInPlace||this.attachPrimary(a.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,s){var r,n;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${li(e)}`),!((r=this.detachedData)!=null&&r.mediaSource)){let o=this.timelinePos;(o<e.start||o>=e.end)&&(o=this.getPrimaryResumption(e,t),this.log(No("resumePrimary",o)),this.timelinePos=o),this.attachPrimary(o,e)}if(!s)return;const a=(n=this.schedule)==null?void 0:n.items;a&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${li(e)}`),this.hls.trigger(E.INTERSTITIALS_PRIMARY_RESUMED,{schedule:a.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const s=e.start;if(this.primaryLive){const r=this.primaryDetails;if(t===0)return this.hls.startPosition;if(r&&(s<r.fragmentStart||s>r.edge))return this.hls.liveSyncPosition||-1}return s}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:de.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,s){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const r=this.primaryMedia;if(!r)return;const n=this.hls;n.media?this.checkBuffer():(this.transferMediaTo(n,r),s&&this.startLoadingPrimaryAt(e,s)),s||(this.log(No("attachPrimary",e)),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(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(E.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(E.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const s=this.hls.levels[t.level];if(!s.details)return;const r=Le(Le({},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=Le(Le({},this.altSelection),{},{audio:s});return}const n=Le(Le({},r),{},{audio:s});this.mediaSelection=n}onSubtitleTrackUpdated(e,t){const s=this.hls.subtitleTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=Le(Le({},this.altSelection),{},{subtitles:s});return}const n=Le(Le({},r),{},{subtitles:s});this.mediaSelection=n}onAudioTrackSwitching(e,t){const s=$p(t);this.playerQueue.forEach(({hls:r})=>r&&(r.setAudioOption(t)||r.setAudioOption(s)))}onSubtitleTrackSwitch(e,t){const s=$p(t);this.playerQueue.forEach(({hls:r})=>r&&(r.setSubtitleOption(t)||t.id!==-1&&r.setSubtitleOption(s)))}onBufferCodecs(e,t){const s=t.tracks;s&&(this.requiredTracks=s)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const s=this.playingItem;if(s&&!this.itemsMatch(s,this.bufferingItem)&&!this.isInterstitial(s)){const r=this.timelinePos;this.bufferedPos=r,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let r=0;r<t.length;r++){const n=t[r];if(n.cue.post){var s;const a=this.schedule.findEventIndex(n.identifier),o=(s=this.schedule.items)==null?void 0:s[a];this.isInterstitial(o)&&this.eventItemsMatch(o,this.bufferingItem)&&this.bufferedToItem(o,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const s=this.findItemIndex(t);this.setSchedulePosition(s+1)}else this.shouldPlay=!1}updateItem(e,t){var s;const r=(s=this.schedule)==null?void 0:s.items;if(e&&r){const n=this.findItemIndex(e,t);return r[n]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((n,a)=>{e.event.isAssetPastPlayoutLimit(a)&&this.clearAssetPlayer(n.identifier,null)});const s=e.end+.25,r=de.bufferInfo(this.primaryMedia,s,0);(r.end>s||(r.nextStart||0)>s)&&(this.log(`trim buffered interstitial ${li(e)} (was ${li(t)})`),this.attachPrimary(s,null,!0),this.flushFrontBuffer(s))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var s;return!!t&&(e===t||e.event.identifier===((s=t.event)==null?void 0:s.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const s=this.mediaSelection;s&&((t=this.schedule)==null||t.updateSchedule(s,[],e))}checkBuffer(e){var t;const s=(t=this.schedule)==null?void 0:t.items;if(!s)return;const r=de.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=r.len<1),this.updateBufferedPos(r.end,s,e)}updateBufferedPos(e,t,s){const r=this.schedule,n=this.bufferingItem;if(this.bufferedPos>e||!r)return;if(t.length===1&&this.itemsMatch(t[0],n)){this.bufferedPos=e;return}const a=this.playingItem,o=this.findItemIndex(a);let l=r.findItemIndexAtTime(e);if(this.bufferedPos<e){var d;const u=this.findItemIndex(n),c=Math.min(u+1,t.length-1),h=t[c];if((l===-1&&n&&e>=n.end||(d=h.event)!=null&&d.appendInPlace&&e+.01>=h.start)&&(l=c),this.isInterstitial(n)){const f=n.event;if(c-o>1&&f.appendInPlace===!1||f.assetList.length===0&&f.assetListLoader)return}if(this.bufferedPos=e,l>u&&l>o)this.bufferedToItem(h);else{const f=this.primaryDetails;this.primaryLive&&f&&e>f.edge-f.targetduration&&h.start<f.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(h)&&this.preloadAssets(h.event,0)}}else s&&a&&!this.itemsMatch(a,n)&&(l===o?this.bufferedToItem(a):l===o+1&&this.bufferedToItem(t[l]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(r=>{const n=this.getAssetPlayer(r.identifier);return!(n!=null&&n.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,s=this.schedule;if(!this.itemsMatch(e,t)&&s){const{items:r,events:n}=s;if(!r||!n)return t;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;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${li(e)}`+(t?` (${l.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(a){const d=s.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((u,c)=>{const h=this.getAssetPlayer(u.identifier);h&&(c===d&&h.loadSource(),h.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(d=>d.pauseBuffering());this.hls.trigger(E.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:n.slice(0),schedule:r.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const s=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(s!==null){this.bufferingAsset=null;const r=this.detachedData;r?r.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),s=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(s)}bufferedToEvent(e,t){const s=e.event,r=s.assetList.length===0&&!s.assetListLoader,n=s.cue.once;if(r||!n){const a=this.preloadAssets(s,t);if(a!=null&&a.interstitial.appendInPlace){const o=this.primaryMedia;o&&this.bufferAssetPlayer(a,o)}}}preloadAssets(e,t){const s=e.assetUrl,r=e.assetList.length,n=r===0&&!e.assetListLoader,a=e.cue.once;if(n){const l=e.timelineStart;if(e.appendInPlace){var o;const h=this.playingItem;!this.isInterstitial(h)&&(h==null||(o=h.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(l+.25)}let d,u=0;if(!this.playingItem&&this.primaryLive&&(u=this.hls.startPosition,u===-1&&(u=this.hls.liveSyncPosition||0)),u&&!(e.cue.pre||e.cue.post)){const h=u-l;h>0&&(d=Math.round(h*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${s?1:r} ${e}${d?` live-start: ${u} start-offset: ${d}`:""}`),s)return this.createAsset(e,0,0,l,e.duration,s);const c=this.assetListLoader.loadAssetList(e,d);c&&(e.assetListLoader=c)}else if(!a&&r){for(let d=t;d<r;d++){const u=e.assetList[d],c=this.getAssetPlayerQueueIndex(u.identifier);(c===-1||this.playerQueue[c].destroyed)&&!u.error&&this.createAssetPlayer(e,u,d)}const l=e.assetList[t];if(l){const d=this.getAssetPlayer(l.identifier);return d&&d.loadSource(),d}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(r=>{this.hls.trigger(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:hR(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=De({},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 b=this.timelinePos-t.timelineStart;if(b>1){const A=t.duration;A&&b<A&&(u=b)}}const c=t.identifier,h=Le(Le({},n),{},{maxMaxBufferLength:Math.min(180,r.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:r.sessionId,assetPlayerId:c,abrEwmaDefaultEstimate:r.bandwidthEstimate,interstitialsController:void 0,startPosition:u,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:a,audioPreference:l||n.audioPreference,subtitlePreference:d||n.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(h.timelineOffset=t.timelineStart));const f=h.cmcd;f!=null&&f.sessionId&&f.contentId&&(h.cmcd=De({},f,{contentId:Fa(t.uri)})),this.getAssetPlayer(c)&&this.warn(`Duplicate date range identifier ${e} and asset ${c}`);const m=new pR(this.HlsPlayerClass,h,e,t);this.playerQueue.push(m),e.assetList[s]=t;let p=!0;const g=b=>{if(b.live){var A;const R=new Error(`Interstitials MUST be VOD assets ${e}`),x={fatal:!0,type:te.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:R},I=((A=this.schedule)==null?void 0:A.findEventIndex(e.identifier))||-1;this.handleAssetItemError(x,e,I,s,R.message);return}const L=b.edge-b.fragmentStart,S=t.duration;(p||S===null||L>S)&&(p=!1,this.log(`Interstitial asset "${c}" duration change ${S} > ${L}`),t.duration=L,this.updateSchedule())};m.on(E.LEVEL_UPDATED,(b,{details:A})=>g(A)),m.on(E.LEVEL_PTS_UPDATED,(b,{details:A})=>g(A)),m.on(E.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const v=(b,A)=>{const L=this.getAssetPlayer(c);if(L&&A.tracks){L.off(E.BUFFER_CODECS,v),L.tracks=A.tracks;const S=this.primaryMedia;this.bufferingAsset===L.assetItem&&S&&!L.media&&this.bufferAssetPlayer(L,S)}};m.on(E.BUFFER_CODECS,v);const T=()=>{var b;const A=this.getAssetPlayer(c);if(this.log(`buffered to end of asset ${A}`),!A||!this.schedule)return;const L=this.schedule.findEventIndex(e.identifier),S=(b=this.schedule.items)==null?void 0:b[L];this.isInterstitial(S)&&this.advanceAssetBuffering(S,t)};m.on(E.BUFFERED_TO_END,T);const y=b=>()=>{if(!this.getAssetPlayer(c)||!this.schedule)return;this.shouldPlay=!0;const L=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,L,b)};return m.once(E.MEDIA_ENDED,y(s)),m.once(E.PLAYOUT_LIMIT_REACHED,y(1/0)),m.on(E.ERROR,(b,A)=>{if(!this.schedule)return;const L=this.getAssetPlayer(c);if(A.details===w.BUFFER_STALLED_ERROR){if(L!=null&&L.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(A,e,this.schedule.findEventIndex(e.identifier),s,`Asset player error ${A.error} ${e}`)}),m.on(E.DESTROYING,()=>{if(!this.getAssetPlayer(c)||!this.schedule)return;const A=new Error(`Asset player destroyed unexpectedly ${c}`),L={fatal:!0,type:te.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:A};this.handleAssetItemError(L,e,this.schedule.findEventIndex(e.identifier),s,A.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Yr(t)}`),this.hls.trigger(E.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:s,event:e,player:m}),m}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(s=>{this.clearAssetPlayer(s.identifier,t)})}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const s=this.playerQueue[t];this.transferMediaFromPlayer(s,null),s.resetDetails()}}clearAssetPlayer(e,t){const s=this.getAssetPlayerQueueIndex(e);if(s!==-1){const r=this.playerQueue[s];this.log(`clear ${r} toSegment: ${t&&li(t)}`),this.transferMediaFromPlayer(r,t),this.playerQueue.splice(s,1),r.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,s,r,n){const{interstitial:a,assetItem:o,assetId:l}=e,d=a.assetList.length,u=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!u||u.identifier!==l)&&(u&&(this.clearAssetPlayer(u.identifier,s[r]),delete u.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${d} ${Yr(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;if(!this.schedule)return;const{interstitial:n,assetItem:a}=e,o=this.schedule.findEventIndex(n.identifier),l=(s=this.schedule.items)==null?void 0:s[o];if(!l)return;e.loadSource(),this.setBufferingItem(l),this.bufferingAsset=a;const d=this.getBufferingPlayer();if(d===e)return;const u=n.appendInPlace;if(u&&d?.interstitial.appendInPlace===!1)return;const c=d?.tracks||((r=this.detachedData)==null?void 0:r.tracks)||this.requiredTracks;if(u&&a!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(c&&!Hv(c,e.tracks)){const h=new Error(`Asset ${Yr(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)}handleInPlaceStall(e){const t=this.schedule,s=this.primaryMedia;if(!t||!s)return;const r=s.currentTime,n=t.findAssetIndex(e,r),a=e.assetList[n];if(a){const o=this.getAssetPlayer(a.identifier);if(o){const l=o.currentTime||r-a.timelineStart,d=o.duration-l;if(this.warn(`Stalled at ${l} of ${l+d} in ${o} ${e} (media.currentTime: ${r})`),l&&(d/s.playbackRate<.5||o.bufferedInPlaceToEnd(s))&&o.hls){const u=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,u,n)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,s,r,n){if(e.details===w.BUFFER_STALLED_ERROR)return;const a=t.assetList[r]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${a&&Yr(a)} ${e.error}`),!this.schedule)return;const o=a?.identifier||"",l=this.getAssetPlayerQueueIndex(o),d=this.playerQueue[l]||null,u=this.schedule.items,c=De({},e,{fatal:!1,errorAction:In(!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=this.bufferingAsset,m=new Error(n);if(a&&(this.clearAssetPlayer(o,null),a.error=m),!t.assetList.some(p=>!p.error))t.error=m;else for(let p=r;p<t.assetList.length;p++)this.resetAssetPlayer(t.assetList[p].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):h&&h.identifier===o?this.advanceAfterAssetEnded(t,s,r):f&&f.identifier===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,f)}primaryFallback(e){const t=e.timelineStart,s=this.effectivePlayingItem;let r=this.timelinePos;if(s){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${r} playing: ${li(s)} error: ${e.error}`),r===-1&&(r=this.hls.startPosition);const a=this.updateItem(s,r);this.itemsMatch(s,a)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(r===-1){this.checkStart();return}if(!this.schedule)return;const n=this.schedule.findItemIndexAtTime(r);this.setSchedulePosition(n)}onAssetListLoaded(e,t){var s,r;const n=t.event,a=n.identifier,o=t.assetListResponse.ASSETS;if(!((s=this.schedule)!=null&&s.hasEvent(a)))return;const l=n.timelineStart,d=n.duration;let u=0;o.forEach((p,g)=>{const v=parseFloat(p.DURATION);this.createAsset(n,g,u,l+u,v,p.URI),u+=v}),n.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${d}) ${n}`);
vendor: 63,110 bytes, lines 50-61
50const c=this.waitingItem,h=c?.event.identifier===a;this.updateSchedule();const f=(r=this.bufferingItem)==null?void 0:r.event;if(h){var m;const p=this.schedule.findEventIndex(a),g=(m=this.schedule.items)==null?void 0:m[p];if(g){if(!this.playingItem&&this.timelinePos>g.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==p){n.error=new Error(`Interstitial ${o.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${n}`),this.log(n.error.message),this.updateSchedule(!0),this.primaryFallback(n);return}this.setBufferingItem(g)}this.setSchedulePosition(p)}else if(f?.identifier===a){const p=n.assetList[0];if(p){const g=this.getAssetPlayer(p.identifier);if(f.appendInPlace){const v=this.primaryMedia;g&&v&&this.bufferAssetPlayer(g,v)}else g&&g.loadSource()}}}onError(e,t){if(this.schedule)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.updateSchedule(!0),this.primaryFallback(s));break}case w.BUFFER_STALLED_ERROR:{const s=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&s.event.appendInPlace){this.handleInPlaceStall(s.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const Dg=500;class yR extends Ff{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=P.IDLE,this.setInterval(Dg),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)||(ze(s)&&(this.fragPrevious=s),this.state=P.IDLE),!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let a;const o=s.start;for(let d=0;d<n.length;d++)if(o>=n[d].start&&o<=n[d].end){a=n[d];break}const l=s.start+s.duration;a?a.end=l:(a={start:o,end:l},n.push(a)),this.fragmentTracker.fragBuffered(s),this.fragBufferedComplete(s,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:s,endOffset:r}=t;if(s===0&&r!==Number.POSITIVE_INFINITY){const n=r-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(a=>{for(let o=0;o<a.length;){if(a[o].end<=n){a.shift();continue}else if(a[o].start<n)a[o].start=n;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(s,n,X.SUBTITLE)}}onError(e,t){const s=t.frag;s?.type===X.SUBTITLE&&(t.details===w.FRAG_GAP&&this.fragmentTracker.fragBuffered(s,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==P.STOPPED&&(this.state=P.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&VE(this.levels,t)){this.levels=t.map(s=>new eo(s));return}this.tracksBuffered=[],this.levels=t.map(s=>{const r=new eo(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!==P.STOPPED&&this.setInterval(Dg)}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?(Od(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===P.IDLE&&(Rr(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&&Ln(r.method)){const a=performance.now();this.decrypter.decrypt(new Uint8Array(s),r.key.buffer,r.iv.buffer,Uf(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=P.IDLE})}}doTick(){if(!this.media){this.state=P.IDLE;return}if(this.state===P.IDLE){const{currentTrackId:e,levels:t}=this,s=t?.[e];if(!s||!t.length||!s.details||this.waitForLive(s))return;const{config:r}=this,n=this.getLoadPosition(),a=de.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=Rr(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)===ut.NOT_LOADED&&(m=v),this.fragmentTracker.getState(m)===ut.NOT_LOADED){const T=this.mapToInitFragWhenRequired(m);T&&this.loadFragment(T,s,o)}}}loadFragment(e,t,s){ze(e)?super.loadFragment(e,t,s):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new TR(this.tracksBuffered[this.currentTrackId]||[])}}class TR{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 bR={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},ay=i=>String.fromCharCode(bR[i]||i),fi=15,is=100,_R={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},AR={17:2,18:4,21:6,22:8,23:10,19:13,20:15},SR={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},IR={25:2,26:4,29:6,30:8,31:10,27:13,28:15},LR=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class RR{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const s=typeof t=="function"?t():t;Re.log(`${this.time} [${e}] ${s}`)}}}const Xs=function(e){const t=[];for(let s=0;s<e.length;s++)t.push(e[s].toString(16));return t};class oy{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 xR{constructor(){this.uchar=" ",this.penState=new oy}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 kR{constructor(e){this.chars=[],this.pos=0,this.currPenState=new oy,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<is;t++)this.chars.push(new xR);this.logger=e}equals(e){for(let t=0;t<is;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<is;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<is;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>is&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=is)}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=ay(e);if(this.pos>=is){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<is;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<is;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 rc{constructor(e){this.rows=[],this.currRow=fi-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<fi;t++)this.rows.push(new kR(e));this.logger=e}reset(){for(let e=0;e<fi;e++)this.rows[e].clear();this.currRow=fi-1}equals(e){let t=!0;for(let s=0;s<fi;s++)if(!this.rows[s].equals(e.rows[s])){t=!1;break}return t}copy(e){for(let t=0;t<fi;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<fi;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 = "+Me(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<fi;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 = "+Me(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<fi;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 Cg{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 rc(s),this.nonDisplayedMemory=new rc(s),this.lastOutputScreen=new rc(s),this.currRollUpRow=this.displayedMemory.rows[fi-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[fi-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: "+Me(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 wg{constructor(e,t,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=CR(),this.logger=void 0;const r=this.logger=new RR;this.channels=[null,new Cg(e,t,r),new Cg(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,()=>"["+Xs([t[s],t[s+1]])+"] -> ("+Xs([r,n])+")");const l=this.cmdHistory;if(r>=16&&r<=31){if(DR(r,n,l)){Uo(null,null,l),this.logger.log(3,()=>"Repeated command ("+Xs([r,n])+") is dropped");continue}Uo(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 Uo(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 "+Xs([r,n])+" orig: "+Xs([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 ("+Xs([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?_R[e]:SR[e]:s=a===1?AR[e]:IR[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 '"+ay(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 =  "+Xs(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=LR[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()}Uo(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 Uo(i,e,t){t.a=i,t.b=e}function DR(i,e,t){return t.a===i&&t.b===e}function CR(){return{a:null,b:null}}var Xf=(function(){if(Pd!=null&&Pd.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,b="auto",A="start",L=50,S="middle",R=50,x="middle";Object.defineProperty(u,"id",n({},c,{get:function(){return h},set:function(I){h=""+I}})),Object.defineProperty(u,"pauseOnExit",n({},c,{get:function(){return f},set:function(I){f=!!I}})),Object.defineProperty(u,"startTime",n({},c,{get:function(){return m},set:function(I){if(typeof I!="number")throw new TypeError("Start time must be set to a number.");m=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"endTime",n({},c,{get:function(){return p},set:function(I){if(typeof I!="number")throw new TypeError("End time must be set to a number.");p=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"text",n({},c,{get:function(){return g},set:function(I){g=""+I,this.hasBeenReset=!0}})),Object.defineProperty(u,"region",n({},c,{get:function(){return v},set:function(I){v=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"vertical",n({},c,{get:function(){return T},set:function(I){const M=s(I);if(M===!1)throw new SyntaxError("An invalid or illegal string was specified.");T=M,this.hasBeenReset=!0}})),Object.defineProperty(u,"snapToLines",n({},c,{get:function(){return y},set:function(I){y=!!I,this.hasBeenReset=!0}})),Object.defineProperty(u,"line",n({},c,{get:function(){return b},set:function(I){if(typeof I!="number"&&I!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");b=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"lineAlign",n({},c,{get:function(){return A},set:function(I){const M=r(I);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");A=M,this.hasBeenReset=!0}})),Object.defineProperty(u,"position",n({},c,{get:function(){return L},set:function(I){if(I<0||I>100)throw new Error("Position must be between 0 and 100.");L=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",n({},c,{get:function(){return S},set:function(I){const M=r(I);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");S=M,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",n({},c,{get:function(){return R},set:function(I){if(I<0||I>100)throw new Error("Size must be between 0 and 100.");R=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",n({},c,{get:function(){return x},set:function(I){const M=r(I);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");x=M,this.hasBeenReset=!0}})),u.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a})();class wR{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function ly(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 MR{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 dy(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 Zc=new Xf(0,0,""),$o=Zc.align==="middle"?"middle":"center";function PR(i,e,t){const s=i;function r(){const o=ly(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 MR;dy(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",$o,"end"]);break;case"position":m=f.split(","),d.percent(h,m[0]),m.length===2&&d.alt("positionAlign",m[1],["start",$o,"end","line-left","line-right","auto"]);break;case"size":d.percent(h,f);break;case"align":d.alt(h,f,["start",$o,"end","left","right"]);break}},/:/,/\s/),l.region=d.get("region",null),l.vertical=d.get("vertical","");let u=d.get("line","auto");u==="auto"&&Zc.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",$o);let c=d.get("position","auto");c==="auto"&&Zc.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 uy(i){return i.replace(/<br(?: \/)?>/gi,`
52`)}class OR{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new wR,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=uy(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){dy(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 Xf(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{PR(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 NR=/\r\n|\n\r|\n|\r/g,nc=function(e,t,s=0){return e.slice(s,s+t.length)===t},UR=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(!z(t)||!z(s)||!z(r)||!z(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*s,t+=60*1e3*r,t+=3600*1e3*n,t};function Zf(i,e,t){return Fa(i.toString())+Fa(e.toString())+Fa(t)}const $R=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 FR(i,e,t,s,r,n,a){const o=new OR,l=qt(new Uint8Array(i)).trim().replace(NR,`
58`).split(`
59`),d=[],u=e?WI(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:$R(t,s,y)),y){if(!e){m=new Error("Missing initPTS for VTT MPEGTS");return}T=y-t.presentationOffset}const b=g.endTime-g.startTime,A=Gt((g.startTime+T-f)*9e4,r*9e4)/9e4;g.startTime=Math.max(A,0),g.endTime=Math.max(A+b,0);const L=g.text.trim();g.text=decodeURIComponent(encodeURIComponent(L)),g.id||(g.id=Zf(g.startTime,g.endTime,L)),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(nc(g,"X-TIMESTAMP-MAP=")){p=!1,g.slice(16).split(",").forEach(v=>{nc(v,"LOCAL:")?c=v.slice(6):nc(v,"MPEGTS:")&&(h=parseInt(v.slice(7)))});try{f=UR(c)/1e3}catch(v){m=v}return}else g===""&&(p=!1);o.parse(g+`
60`)}),o.flush()}const ac="stpp.ttml.im1t",cy=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,hy=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,BR={left:"start",center:"center",right:"end",start:"start",end:"end"};function Mg(i,e,t,s){const r=he(new Uint8Array(i),["mdat"]);if(r.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(o=>qt(o)),a=VI(e.baseTime,1,e.timescale);try{n.forEach(o=>t(HR(o,a)))}catch(o){s(o)}}function HR(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=Pg(oc(r,"styling","style")),d=Pg(oc(r,"layout","region")),u=oc(r,"body","[begin]");return[].map.call(u,c=>{const h=fy(c,o);if(!h||!c.hasAttribute("begin"))return null;const f=dc(c.getAttribute("begin"),a),m=dc(c.getAttribute("dur"),a);let p=dc(c.getAttribute("end"),a);if(f===null)throw Og(c);if(p===null){if(m===null)throw Og(c);p=f+m}const g=new Xf(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=GR(v,T,l),{textAlign:b}=y;if(b){const A=BR[b];A&&(g.lineAlign=A),g.align=b}return De(g,y),g}).filter(c=>c!==null)}function oc(i,e,t){const s=i.getElementsByTagName(e)[0];return s?[].slice.call(s.querySelectorAll(t)):[]}function Pg(i){return i.reduce((e,t)=>{const s=t.getAttribute("xml:id");return s&&(e[s]=t),e},{})}function fy(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?fy(s,e):e?t+s.textContent.trim().replace(/\s+/g," "):t+s.textContent},"")}function GR(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=lc(e,s,l)||lc(i,s,l)||lc(r,s,l);return d&&(o[l]=d),o},{})}function lc(i,e,t){return i&&i.hasAttributeNS(e,t)?i.getAttributeNS(e,t):null}function Og(i){return new Error(`Could not parse ttml timestamp ${i}`)}function dc(i,e){if(!i)return null;let t=ly(i);return t===null&&(cy.test(i)?t=KR(i,e):hy.test(i)&&(t=VR(i,e))),t}function KR(i,e){const t=cy.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 VR(i,e){const t=hy.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 Fo{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 WR{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=Ug(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(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 Fo(this,"textTrack1"),t=new Fo(this,"textTrack2"),s=new Fo(this,"textTrack3"),r=new Fo(this,"textTrack4");this.cea608Parser1=new wg(1,e,t),this.cea608Parser2=new wg(3,s,r)}addCues(e,t,s,r,n){let a=!1;for(let o=n.length;o--;){const l=n[o],d=qR(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,trackId:a}){const{unparsedVttFrags:o}=this;s===X.MAIN&&(this.initPTS[t.cc]={baseTime:r,timescale:n,trackId:a}),o.length&&(this.unparsedVttFrags=[],o.forEach(l=>{this.initPTS[l.frag.cc]?this.onFragLoaded(E.FRAG_LOADED,l):this.hls.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:s}=this;if(s)for(let r=0;r<s.textTracks.length;r++){const n=s.textTracks[r];if(Ng(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,yn(s[e]),sy(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=>{yn(r[n]),delete r[n]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Ug(),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++)yn(t[s])}onSubtitleTracksUpdated(e,t){const s=t.subtitleTracks||[],r=s.some(n=>n.textCodec===ac);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(VE(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const a=this.media,o=a?ml(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]&&Ng(o[h],l)){c=o[h],o[h]=null;break}c&&(u=c)}if(u)yn(u);else{const c=my(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?.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===ac?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;Mg(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;FR(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||Mg(t,this.initPTS[e.cc],()=>{s.textCodec=ac,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=>ry(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=>Xc(o[l],t,s))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(l=>Xc(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 my(i){return i.characteristics&&/transcribes-spoken-dialog/gi.test(i.characteristics)&&/describes-music-and-sound/gi.test(i.characteristics)?"captions":"subtitles"}function Ng(i,e){return!!i&&i.kind===my(e)&&Yc(e,i)}function qR(i,e,t,s){return Math.min(e,s)-Math.max(i,t)}function Ug(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const YR=/\s/,jR={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++)YR.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=uy(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=>ry(i,h))),r}};function zR(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const QR=/(\d+)-(\d+)\/(\d+)/;class $g{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||ex,this.controller=new self.AbortController,this.stats=new Df}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=XR(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&&z(l)?l:d,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},t.timeout),(so(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 tx(g||"fetch, bad network response",p,c)}r.loading.first=f,r.total=JR(c.headers)||r.total;const m=(h=this.callbacks)==null?void 0:h.onProgress;return m&&z(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&&!z(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 SE,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 XR(i,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(De({},i.headers))};return i.rangeEnd&&t.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),t}function ZR(i){const e=QR.exec(i);if(e)return parseInt(e[2])-parseInt(e[1])+1}function JR(i){const e=i.get("Content-Range");if(e){const s=ZR(e);if(z(s))return s}const t=i.get("Content-Length");if(t)return parseInt(t)}function ex(i,e){return new self.Request(i.url,e)}class tx extends Error{constructor(e,t,s){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=s}}const ix=/^age:\s*[\d.]+\s*$/im;class py{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 Df,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&&z(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(wd(c,h,!1,f))this.retry(c);else{var l;Re.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(wd(e,t,!0))this.retry(e);else{var s;Re.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=Pf(e,s.retry),s.retry++,Re.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t?.url}, retrying ${s.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&ix.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 sx={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},rx=Le(Le({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:py,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:g1,bufferController:aL,capLevelController:jf,errorController:b1,fpsController:oR,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:fE,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:sx},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},nx()),{},{subtitleStreamController:yR,subtitleTrackController:uR,timelineController:WR,audioStreamController:iL,audioTrackController:sL,emeController:Rn,cmcdController:sR,contentSteeringController:nR,interstitialsController:ER});function nx(){return{cueHandler:jR,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 ax(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=Jc(i),r=["manifest","level","frag"],n=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(a=>{const o=`${a==="level"?"playlist":a}LoadPolicy`,l=e[o]===void 0,d=[];n.forEach(u=>{const c=`${a}Loading${u}`,h=e[c];if(h!==void 0&&l){d.push(c);const f=s[o].default;switch(e[o]={default:f},u){case"TimeOut":f.maxLoadTimeMs=h,f.maxTimeToFirstByteMs=h;break;case"MaxRetry":f.errorRetry.maxNumRetry=h,f.timeoutRetry.maxNumRetry=h;break;case"RetryDelay":f.errorRetry.retryDelayMs=h,f.timeoutRetry.retryDelayMs=h;break;case"MaxRetryTimeout":f.errorRetry.maxRetryDelayMs=h,f.timeoutRetry.maxRetryDelayMs=h;break}}}),d.length&&t.warn(`hls.js config: "${d.join('", "')}" setting(s) are deprecated, use "${o}": ${Me(e[o])}`)}),Le(Le({},s),e)}function Jc(i){return i&&typeof i=="object"?Array.isArray(i)?i.map(Jc):Object.keys(i).reduce((e,t)=>(e[t]=Jc(i[t]),e),{}):i}function ox(i,e){const t=i.loader;t!==$g&&t!==py?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1):zR()&&(i.loader=$g,i.progressive=!0,i.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const pl=2,lx=.1,dx=.05,ux=100;class cx extends lE{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var s;(s=this.media)!=null&&s.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var s;this.ended=((s=this.media)==null?void 0:s.currentTime)||1,this.hls.trigger(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(ux),this.mediaSource=t.mediaSource;const s=this.media=t.media;Rt(s,"playing",this.onMediaPlaying),Rt(s,"waiting",this.onMediaWaiting),Rt(s,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:s}=this;s&&(Ct(s,"playing",this.onMediaPlaying),Ct(s,"waiting",this.onMediaWaiting),Ct(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(!de.getBuffered(a).length){this.nudgeRetry=0;return}const c=de.bufferInfo(a,e,0),h=c.nextStart||0,f=this.fragmentTracker;if(o&&f&&this.hls){const L=Fg(this.hls.inFlightFragments,e),S=c.len>pl,R=!h||L||h-e>pl&&!f.getPartialFragment(e);if(S||R)return;this.moved=!1}const m=(r=this.hls)==null?void 0:r.latestLevelDetails;if(!this.moved&&this.stalled!==null&&f){if(!(c.len>0)&&!h)return;const S=Math.max(h,c.start||0)-e,x=!!(m!=null&&m.live)?m.targetduration*2:pl,I=Bo(e,f);if(S>0&&(S<=x||I)){a.paused||this._trySkipBufferHole(I);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 b;if(((b=this.mediaSource)==null?void 0:b.readyState)==="ended"&&!(m!=null&&m.live)&&Math.abs(e-(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 A=de.bufferInfo(a,e,n.maxBufferHole);this._tryFixBufferStall(A,y,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const s=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(s)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(E.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var s;const r=this.buffered.video;
vendor: 14,790 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=de.bufferedInfo(de.timeRangesToArray(this.buffered.audio),e,0);if(n.len>1&&t>=n.start){const a=de.timeRangesToArray(r),o=de.bufferedInfo(a,t,0).bufferedIndex;if(o>-1&&o<a.length-1){const l=de.bufferedInfo(a,e,0).bufferedIndex,d=a[o].end,u=a[o+1].start;if((l===-1||l>o)&&u-d<1&&e-d<2){const c=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${d} -> ${u} buffered index: ${l}`);this.warn(c.message),this.media.currentTime+=1e-6;let h=Bo(e,this.fragmentTracker);h&&"fragment"in h?h=h.fragment:h||(h=void 0);const f=de.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=Bo(s,a);if((u||d!=null&&d.live&&s<d.fragmentStart)&&(this._trySkipBufferHole(u)||!this.media))return;const c=e.buffered,h=this.adjacentTraversal(e,s);(c&&c.length>1&&e.len>l.maxBufferHole||e.nextStart&&(e.nextStart-s<l.maxBufferHole||h))&&(t>l.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const s=this.fragmentTracker,r=e.nextStart;if(s&&r){const n=s.getFragAtPos(t,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 (${Me(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=de.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&&e){var d;if(!((d=this.hls.loadLevelObj)!=null&&d.details)||Fg(this.hls.inFlightFragments,l))return 0;let g=!1,v=e.end;for(;v<l;){const T=Bo(v,s);if(T)v+=T.duration;else{g=!0;break}}if(g)return 0}}const f=Math.max(l+dx,a+lx);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}`),p={type:te.MEDIA_ERROR,details:w.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:m,reason:m.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?p.part=e:p.frag=e),this.hls.trigger(E.ERROR,p)}return f}}return 0}_tryNudgeBuffer(e){const{hls:t,media:s,nudgeRetry:r}=this,n=t?.config;if(!s||!n)return 0;const a=s.currentTime;if(this.nudgeRetry++,r<n.nudgeMaxRetry){const o=a+(r+1)*n.nudgeOffset,l=new Error(`Nudging 'currentTime' from ${a} to ${o}`);this.warn(l.message),s.currentTime=o,t.trigger(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 Fg(i,e){const t=Bg(i.main);if(t&&t.start<=e)return t;const s=Bg(i.audio);return s&&s.start<=e?s:null}function Bg(i){if(!i)return null;switch(i.state){case P.IDLE:case P.STOPPED:case P.ENDED:case P.ERROR:return null}return i.frag}function Bo(i,e){return e.getAppendedFrag(i,X.MAIN)||e.getPartialFragment(i)}const hx=.25;function eh(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function uc(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,Me(r?Le({type:r},s):s))}return n}const Ho=(()=>{const i=eh();try{i&&new i(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class fx{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(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&&(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&&(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(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&yn(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 sy(s,this.media),s}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:s,enableID3MetadataCues:r}=this.hls.config;if(!s&&!r)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=eh();if(a)for(let o=0;o<n.length;o++){const l=n[o].type;if(l===Vt.emsg&&!s||!r)continue;const d=CE(n[o].data),u=n[o].pts;let c=u+n[o].duration;c>Ho&&(c=Ho),c-u<=0&&(c=u+hx);for(let f=0;f<d.length;f++){const m=d[f];if(!wE(m)){this.updateId3CueEnds(u,l);const p=uc(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===Ho&&(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===Vt.audioId3&&l:r==="video"?d=u=>u.type===Vt.emsg&&o:d=u=>u.type===Vt.audioId3&&l||u.type===Vt.emsg&&o,Xc(n,t,s,d)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:s,timelineOffset:r,enableDateRangeMetadataCues:n,interstitialsController:a}=this.hls.config;if(!n)return;const o=eh();if(s&&r&&!a){const{fragmentStart:p,fragmentEnd:g}=e;let v=this.assetCue;v?(v.startTime=p,v.endTime=g):o&&(v=this.assetCue=uc(o,p,g,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),v&&(v.id=s,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(v),v.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:l}=this,{dateRanges:d}=e,u=Object.keys(d);let c=this.dateRangeCuesAppended;if(l&&t){var h;if((h=l.cues)!=null&&h.length){const p=Object.keys(c).filter(g=>!u.includes(g));for(let g=p.length;g--;){var f;const v=p[g],T=(f=c[v])==null?void 0:f.cues;delete c[v],T&&Object.keys(T).forEach(y=>{const b=T[y];if(b){b.removeEventListener("enter",this.onEventCueEnter);try{l.removeCue(b)}catch{}}})}}else c=this.dateRangeCuesAppended={}}const m=e.fragments[e.fragments.length-1];if(!(u.length===0||!z(m?.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let p=0;p<u.length;p++){const g=u[p],v=d[g],T=v.startTime,y=c[g],b=y?.cues||{};let A=y?.durationKnown||!1,L=Ho;const{duration:S,endDate:R}=v;if(R&&S!==null)L=T+S,A=!0;else if(v.endOnNext&&!A){const I=u.reduce((M,F)=>{if(F!==v.id){const V=d[F];if(V.class===v.class&&V.startDate>v.startDate&&(!M||v.startDate<M.startDate))return V}return M},null);I&&(L=I.startTime,A=!0)}const x=Object.keys(v.attr);for(let I=0;I<x.length;I++){const M=x[I];if(!P1(M))continue;const F=b[M];if(F)A&&!(y!=null&&y.durationKnown)?F.endTime=L:Math.abs(F.startTime-T)>.01&&(F.startTime=T,F.endTime=L);else if(o){let V=v.attr[M];O1(M)&&(V=Gv(V));const H=uc(o,T,L,{key:M,data:V},Vt.dateRange);H&&(H.id=g,this.id3Track.addCue(H),b[M]=H,a&&(M==="X-ASSET-LIST"||M==="X-ASSET-URL")&&H.addEventListener("enter",this.onEventCueEnter))}}c[g]={cues:b,dateRange:v,durationKnown:A}}}}}class mx{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 px extends Yf{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()}
vendor: 4,545 bytes, line 61
61stopLoad(){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=xd(h,s)||void 0),f&&(f=u.videoCodec=XS(f));const{width:m,height:p,unknownCodecs:g}=u,v=g?.length||0;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":b,"PATHWAY-ID":A,RESOLUTION:L,"VIDEO-RANGE":S}=c,x=`${`${A||"."}-`}${u.bitrate}-${L}-${y}-${T}-${S}-${b}`;if(n[x])if(n[x].uri!==u.url&&!u.attrs["PATHWAY-ID"]){const I=a[x]+=1;u.attrs["PATHWAY-ID"]=new Array(I+1).join(".");const M=this.createLevel(u);n[x]=M,r.push(M)}else n[x].addGroupId("audio",c.AUDIO),n[x].addGroupId("text",c.SUBTITLES);else{const I=this.createLevel(u);n[x]=I,a[x]=1,r.push(I)}}),this.filterAndSortMediaOptions(r,t,o,l,d)}createLevel(e){const t=new eo(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=eE(r,[])}return t}isAudioSupported(e){return Za(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Za(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,s,r,n){var a;let o=[],l=[],d=e;const u=((a=t.stats)==null?void 0:a.parsing)||{};if((s||r)&&n&&(d=d.filter(({videoCodec:T,videoRange:y,width:b,height:A})=>(!!T||!!(b&&A))&&o1(y))),d.length===0){Promise.resolve().then(()=>{if(this.hls){let T="no level with compatible codecs found in manifest",y=T;t.levels.length&&(y=`one or more CODECS in variant not supported: ${Me(t.levels.map(A=>A.attrs.CODECS).filter((A,L,S)=>S.indexOf(A)===L))}`,this.warn(y),T+=` (${y})`);const b=new Error(T);this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:b,reason:y})}}),u.end=performance.now();return}t.audioTracks&&(o=t.audioTracks.filter(T=>!T.audioCodec||this.isAudioSupported(T.audioCodec)),Hg(o)),t.subtitles&&(l=t.subtitles,Hg(l));const c=d.slice(0);d.sort((T,y)=>{if(T.attrs["HDCP-LEVEL"]!==y.attrs["HDCP-LEVEL"])return(T.attrs["HDCP-LEVEL"]||"")>(y.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&T.height!==y.height)return T.height-y.height;if(T.frameRate!==y.frameRate)return T.frameRate-y.frameRate;if(T.videoRange!==y.videoRange)return kd.indexOf(T.videoRange)-kd.indexOf(y.videoRange);if(T.videoCodec!==y.videoCodec){const b=wp(T.videoCodec),A=wp(y.videoCodec);if(b!==A)return A-b}if(T.uri===y.uri&&T.codecSet!==y.codecSet){const b=Rd(T.codecSet),A=Rd(y.codecSet);if(b!==A)return A-b}return T.averageBitrate!==y.averageBitrate?T.averageBitrate-y.averageBitrate:0});let h=c[0];if(this.steering&&(d=this.steering.filterParsedLevels(d),d.length!==c.length)){for(let T=0;T<c.length;T++)if(c[T].pathwayId===d[0].pathwayId){h=c[T];break}}this._levels=d;for(let T=0;T<d.length;T++)if(d[T]===h){var f;this._firstLevel=T;const y=h.bitrate,b=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${d.length} level(s) found, first bitrate: ${y}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const A=Math.min(y,this.hls.config.abrEwmaDefaultEstimateMax);A>b&&b===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=A)}break}const m=n&&!r,p=this.hls.config,g=!!(p.audioStreamController&&p.audioTrackController),v={levels:d,audioTracks:o,subtitleTracks:l,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:g&&!m&&o.some(T=>!!T.url)};u.end=performance.now(),this.hls.trigger(E.MANIFEST_PARSED,v)}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"];
vendor: 4,342 bytes, line 61
61if(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?.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===me.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?.age;this.log(`Loading level index ${r}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${n?" Pathway "+n:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${s}`),this.hls.trigger(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));bE(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 Hg(i){const e={};
vendor: 16,125 bytes, line 61
61i.forEach(t=>{const s=t.groupId||"";t.id=e[s]=e[s]||0,e[s]++})}function gy(){return self.SourceBuffer||self.WebKitSourceBuffer}function vy(){if(!Ks())return!1;const e=gy();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function gx(){if(!vy())return!1;const i=Ks();return typeof i?.isTypeSupported=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>i.isTypeSupported(Ja(e,"video")))||["mp4a.40.2","fLaC"].some(e=>i.isTypeSupported(Ja(e,"audio"))))}function vx(){var i;const e=gy();return typeof(e==null||(i=e.prototype)==null?void 0:i.changeType)=="function"}const Ex=100;class yx extends Ff{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||!z(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(Ex),this.level=-1,!this.startFragRequested){let n=r.startLevel;n===-1&&(r.config.testBandwidth&&this.levels.length>1?(n=0,this.bitrateTest=!0):n=r.firstAutoLevel),r.nextLoadLevel=n,this.level=r.loadLevel,this._hasEnoughToStart=!!t}s>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s),this.state=P.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=P.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case P.WAITING_LEVEL:{const{levels:e,level:t}=this,s=e?.[t],r=s?.details;if(r&&(!r.live||this.levelLastLoaded===s&&!this.waitForLive(s))){if(this.waitForCdnTuneIn(r))break;this.state=P.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=P.IDLE;break}break}case P.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===P.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:s,media:r}=this;if(t===null||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(s!=null&&s[n]))return;const a=s[n],o=this.getMainFwdBufferInfo();if(o===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){const p={};this.altAudio===2&&(p.type="video"),this.hls.trigger(E.BUFFER_EOS,p),this.state=P.ENDED;return}if(!this.buffering)return;e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const d=a.details;if(!d||this.state===P.WAITING_LEVEL||this.waitForLive(a)){this.level=n,this.state=P.WAITING_LEVEL,this.startFragRequested=!1;return}const u=o.len,c=this.getMaxBufferLength(a.maxBitrate);if(u>=c)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const h=this.backtrackFragment?this.backtrackFragment.start:o.end;let f=this.getNextFragment(h,d);if(this.couldBacktrack&&!this.fragPrevious&&f&&ze(f)&&this.fragmentTracker.getState(f)!==ut.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?we.AUDIO:we.VIDEO,v=(g===we.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===ut.NOT_LOADED||r===ut.PARTIAL?ze(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 P.KEY_LOADING:case P.FRAG_LOADING:case P.FRAG_LOADING_WAITING_RETRY:case P.PARSING:case P.PARSED:this.state=P.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const s=t.media;Rt(s,"playing",this.onMediaPlaying),Rt(s,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:s}=this;s&&(Ct(s,"playing",this.onMediaPlaying),Ct(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;for(let n=0;n<t.levels.length;n++){const a=t.levels[n].audioCodec;a&&(s=s||a.indexOf("mp4a.40.2")!==-1,r=r||a.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=s&&r&&!vx(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:s}=this;if(!s||this.state!==P.IDLE)return;const r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=P.WAITING_LEVEL)}onLevelLoaded(e,t){var s;const{levels:r,startFragRequested:n}=this,a=t.level,o=t.details,l=o.totalduration;if(!r){this.warn(`Levels were reset while loading level ${a}`);return}this.log(`Level ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${l}`);const d=t.levelInfo,u=this.fragCurrent;u&&(this.state===P.FRAG_LOADING||this.state===P.FRAG_LOADING_WAITING_RETRY)&&u.level!==t.level&&u.loader&&this.abortCurrentFrag();let c=0;if(o.live||(s=d.details)!=null&&s.live){var h;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;c=this.alignPlaylists(o,d.details,(h=this.levelLastLoaded)==null?void 0:h.details)}if(d.details=o,this.levelLastLoaded=d,n||this.setStartPosition(o,c),this.hls.trigger(E.LEVEL_UPDATED,{details:o,level:a}),this.state===P.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=P.IDLE}n&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:s}=this;if(!s)return;const r=this.hls.liveSyncPosition,n=this.getLoadPosition(),a=e.fragmentStart,o=e.edge,l=n>=a-t.maxFragLookUpTolerance&&n<=o;if(r!==null&&s.duration>r&&(n<r||!l)){const u=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!l&&s.readyState<4||n<o-u)&&(this._hasEnoughToStart||(this.nextLoadPosition=r),s.readyState))if(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${r.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var d;const c=de.bufferInfo(s,r,0);if(!((d=c.buffered)!=null&&d.length)){s.currentTime=r;return}if(c.start<=n){s.currentTime=r;return}const{nextStart:f}=de.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 KE(this.hls,X.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=r?r.index:-1,p=m!==-1,g=new Nf(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!==0;if(Dd(t.url,s))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(r){this.altAudio=0,this.fragmentTracker.removeAllFragments(),s.once(E.BUFFER_FLUSHED,()=>{this.hls&&this.hls.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=Dd(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===P.PARSED&&(this.state=P.IDLE);return}const o=r?r.stats:s.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),ze(s)&&(this.fragPrevious=s),this.fragBufferedComplete(s,r)}const a=this.media;a&&(!this._hasEnoughToStart&&de.getBuffered(a).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),n&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var s;if(t.fatal){this.state=P.ERROR;return}switch(t.details){case 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===P.WAITING_LEVEL&&((s=t.context)==null?void 0:s.type)===me.LEVEL&&(this.state=P.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.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case w.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=P.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==we.AUDIO||!this.altAudio){const s=(t===we.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=de.getBuffered(e),o=a.length?a.start(0):0,l=o-s,d=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||l>0&&(l<d||this.loadingParts&&l<2*(n?.partTarget||0)))&&(this.log(`adjusting start position by ${l} to match buffer start`),s+=l,this.startPosition=s),t<s&&(this.log(`seek to target start position ${s} from current time ${t} buffer start ${o}`),e.currentTime=s)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(s=>{const{hls:r}=this,n=s?.frag;if(!n||this.fragContextChanged(n))return;t.fragmentError=0,this.state=P.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const a=n.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),r.trigger(E.FRAG_LOADED,s),n.bitrateTest=!1}
vendor: 4,820 bytes, line 61
61).catch(s=>{this.state===P.STOPPED||this.state===P.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:s}=this,{remuxResult:r,chunkMeta:n}=e,a=this.getCurrentContext(n);if(!a){this.resetWhenMissingContext(n);return}const{frag:o,part:l,level:d}=a,{video:u,text:c,id3:h,initSegment:f}=r,{details:m}=d,p=this.altAudio?void 0:r.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=P.PARSING,f){const g=f.tracks;if(g){const b=o.initSegment||o;if(this.unhandledEncryptionError(f,o))return;this._bufferInitSegment(d,g,b,n),s.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:b,id:t,tracks:g})}const v=f.initPTS,T=f.timescale,y=this.initPTS[o.cc];if(z(v)&&(!y||y.baseTime!==v||y.timescale!==T)){const b=f.trackId;this.initPTS[o.cc]={baseTime:v,timescale:T,trackId:b},s.trigger(E.INIT_PTS_FOUND,{frag:o,id:t,initPTS:v,timescale:T,trackId:b})}}if(u&&m){p&&u.type==="audiovideo"&&this.logMuxedErr(o);const g=m.fragments[o.sn-1-m.startSN],v=o.sn===m.startSN,T=!g||o.cc>g.cc;if(r.independent!==!1){const{startPTS:y,endPTS:b,startDTS:A,endDTS:L}=u;if(l)l.elementaryStreams[u.type]={startPTS:y,endPTS:b,startDTS:A,endDTS:L};else if(u.firstKeyFrame&&u.independent&&n.id===1&&!T&&(this.couldBacktrack=!0),u.dropped&&u.independent){const S=this.getMainFwdBufferInfo(),R=(S?S.end:this.getLoadPosition())+this.config.maxBufferHole,x=u.firstKeyFramePTS?u.firstKeyFramePTS:y;if(!v&&R<x-this.config.maxBufferHole&&!T){this.backtrack(o);return}else T&&(o.gap=!0);o.setElementaryStreamInfo(u.type,o.start,b,o.start,L,!0)}else v&&y-(m.appliedTimelineOffset||0)>pl&&(o.gap=!0);o.setElementaryStreamInfo(u.type,y,b,A,L),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(u,o,l,n,v||T)}else if(v||T)o.gap=!0;else{this.backtrack(o);return}}if(p){const{startPTS:g,endPTS:v,startDTS:T,endDTS:y}=p;l&&(l.elementaryStreams[we.AUDIO]={startPTS:g,endPTS:v,startDTS:T,endDTS:y}),o.setElementaryStreamInfo(we.AUDIO,g,v,T,y),this.bufferFragmentData(p,o,l,n)}if(m&&h!=null&&h.samples.length){const g={id:t,frag:o,details:m,samples:h.samples};s.trigger(E.FRAG_PARSING_METADATA,g)}if(m&&c){const g={id:t,frag:o,details:m,samples:c.samples};s.trigger(E.FRAG_PARSING_USERDATA,g)}}logMuxedErr(e){this.warn(`${ze(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,s,r){if(this.state!==P.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(s));const{audio:n,video:a,audiovideo:o}=t;if(n){const d=e.audioCodec;let u=ll(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?.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?.[t];return s?this.getMaxBufferLength(s.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=P.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const s=e.currentTime;if(de.isBuffered(e,s)?t=this.getAppendedFrag(s):de.isBuffered(e,s+.1)&&
61(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 z(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(z(t)){const s=this.getLevelDetails(),r=this.currentFrag||(s?Rr(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 Tx extends ri{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const s in this.keyIdToKeyInfo){const r=this.keyIdToKeyInfo[s].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=w.KEY_LOAD_ERROR,s,r,n){return new os({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&&(!ze(e)||!ze(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=ul(o);if(l)return this.emeController.getKeySystemAccess([l])})}if(this.config.requireKeySystemAccessOnStart){const r=ca(this.config);if(r.length)return this.emeController.getKeySystemAccess(r)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var s,r;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const d=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,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}"`)));const o=cc(n);let l=this.keyIdToKeyInfo[o];if((s=l)!=null&&s.decryptdata.key)return n.key=l.decryptdata.key,Promise.resolve({frag:e,keyInfo:l});if(this.emeController&&(r=l)!=null&&r.keyLoadPromise)switch(this.emeController.getKeyStatus(l.decryptdata)){case"usable":case"usable-in-future":return l.keyLoadPromise.then(u=>{const{keyInfo:c}=u;return n.key=c.decryptdata.key,{frag:e,keyInfo:c}})}switch(this.log(`${this.keyIdToKeyInfo[o]?"Rel":"L"}oading${n.keyId?" keyId: "+Tt(n.keyId):""} URI: ${n.uri} from ${e.type} ${e.level}`),l=this.keyIdToKeyInfo[o]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(l,e):this.loadKeyEME(l,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(l,e);default:return Promise.reject(this.createKeyLoadError(e,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){var r;if(!e.decryptdata.keyId&&(r=t.initSegment)!=null&&r.data){const a=FS(t.initSegment.data);if(a.length){let o=a[0];o.some(l=>l!==0)?(this.log(`Using keyId found in init segment ${Tt(o)}`),Hs.setKeyIdForUri(e.decryptdata.uri,o)):(o=Hs.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${Tt(o)}`)),e.decryptdata.keyId=o}}if(!e.decryptdata.keyId&&!ze(t))return Promise.resolve(s);const n=this.emeController.loadKey(s);
vendor: 5,692 bytes, line 61
61return(e.keyLoadPromise=n.then(a=>(e.mediaKeySessionContext=a,s))).catch(a=>{throw e.keyLoadPromise=null,"data"in a&&(a.data.frag=t),a})}return Promise.resolve(s)}loadKeyHTTP(e,t){const s=this.config,r=s.loader,n=new r(s);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((a,o)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},d=s.keyLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(h,f,m,p)=>{const{frag:g,keyInfo:v}=m,T=cc(v.decryptdata);if(!g.decryptdata||v!==this.keyIdToKeyInfo[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,Le({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);const a=cc(s.decryptdata)||r;delete this.keyIdToKeyInfo[a],n&&n.destroy()}}function cc(i){if(i.keyFormat!==bt.FAIRPLAY){const e=i.keyId;if(e)return Tt(e)}return i.uri}function Gg(i){const{type:e}=i;switch(e){case me.AUDIO_TRACK:return X.AUDIO;case me.SUBTITLE_TRACK:return X.SUBTITLE;default:return X.MAIN}}function hc(i,e){let t=i.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class bx{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.AUDIO_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:me.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:me.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:me.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:me.SUBTITLE_TRACK,url:n,deliveryDirectives:a,levelOrTrack:o})}onLevelsUpdated(e,t){const s=this.loaders[me.LEVEL];if(s){const r=s.context;r&&!t.levels.some(n=>n===r.levelOrTrack)&&(s.abort(),delete this.loaders[me.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===me.MANIFEST?n=s.manifestLoadPolicy.default:n=De({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),z((t=e.deliveryDirectives)==null?void 0:t.part)){let d;if(e.type===me.LEVEL&&e.level!==null?d=this.hls.levels[e.level].details:e.type===me.AUDIO_TRACK&&e.id!==null?d=this.hls.audioTracks[e.id].details:e.type===me.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=De({},n,{maxTimeToFirstByteMs:Math.min(h,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,n.maxTimeToFirstByteMs)})}}}const a=n.errorRetry||n.timeoutRetry||{},o={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(d,u,c,h)=>{const f=this.getInternalLoader(c);this.resetInternalLoader(c.type);const m=d.data;u.parsing.start=performance.now(),qi.isMediaPlaylist(m)||c.type!==me.MANIFEST?this.handleTrackOrLevelPlaylist(d,u,c,h||null,f):this.handleMasterPlaylist(d,u,c,h)},onError:(d,u,c,h)=>{this.handleNetworkError(u,c,!1,d,h)},onTimeout:(d,u,c)=>{this.handleNetworkError(u,c,!0,void 0,d)}};r.load(e,o,l)}
vendor: 7,902 bytes, line 61
61checkAutostartLoad(){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=hc(e,s),l=qi.parseMasterPlaylist(a,o);if(l.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,s,l.playlistParsingError,r,t);return}const{contentSteering:d,levels:u,sessionData:c,sessionKeys:h,startTimeOffset:f,variableList:m}=l;this.variableList=m,u.forEach(T=>{const{unknownCodecs:y}=T;if(y){const{preferManagedMediaSource:b}=this.hls.config;let{audioCodec:A,videoCodec:L}=T;for(let S=y.length;S--;){const R=y[S];Za(R,"audio",b)?(T.audioCodec=A=A?`${A},${R}`:R,Fn.audio[A.substring(0,4)]=2,y.splice(S,1)):Za(R,"video",b)&&(T.videoCodec=L=L?`${L},${R}`:R,Fn.video[L.substring(0,4)]=2,y.splice(S,1))}}});const{AUDIO:p=[],SUBTITLES:g,"CLOSED-CAPTIONS":v}=qi.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 Ge({}),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=hc(e,s),c=z(l)?l:z(o)?o:0,h=Gg(s),f=qi.parseLevelPlaylist(e.data,u,c,h,0,this.variableList);if(d===me.MANIFEST){const m={attrs:new Ge({}),bitrate:0,details:f,name:"",url:u};f.requestScheduled=t.loading.start+EE(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===me.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===me.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===me.AUDIO_TRACK||e.type===me.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 me.MANIFEST:l=s?w.MANIFEST_LOAD_TIMEOUT:w.MANIFEST_LOAD_ERROR,d=!0;break;case me.LEVEL:l=s?w.LEVEL_LOAD_TIMEOUT:w.LEVEL_LOAD_ERROR,d=!1;break;case me.AUDIO_TRACK:l=s?w.AUDIO_TRACK_LOAD_TIMEOUT:w.AUDIO_TRACK_LOAD_ERROR,d=!1;break;case me.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?.url||e.url;c.response=Le({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,levelOrTrack:u,id:c,groupId:h,deliveryDirectives:f}=r,m=hc(t,r),p=Gg(r);let g=typeof r.level=="number"&&p===X.MAIN?d:void 0;const v=e.playlistParsingError;if(v){if(this.hls.logger.warn(`${v} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(E.ERROR,{type:te.NETWORK_ERROR,details:w.LEVEL_PARSING_ERROR,fatal:!1,url:m,error:v,reason:v.message,response:t,context:r,level:g,parent:p,networkDetails:n,stats:s});return}e.playlistParsingError=null}if(!e.fragments.length){const T=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:m,error:T,reason:T.message,response:t,context:r,level:g,parent:p,networkDetails:n,stats:s});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case me.MANIFEST:case me.LEVEL:if(g){if(!u)g=0;else if(u!==o.levels[g]){const T=o.levels.indexOf(u);T>-1&&(g=T)}}o.trigger(E.LEVEL_LOADED,{details:e,levelInfo:u||o.levels[0],level:g||0,id:c||0,stats:s,networkDetails:n,deliveryDirectives:f,withoutMultiVariant:l===me.MANIFEST});break;case me.AUDIO_TRACK:o.trigger(E.AUDIO_TRACK_LOADED,{details:e,track:u,id:c||0,groupId:h||"",stats:s,networkDetails:n,deliveryDirectives:f});break;case me.SUBTITLE_TRACK:o.trigger(E.SUBTITLE_TRACK_LOADED,{details:e,track:u,id:c||0,groupId:h||"",stats:s,networkDetails:n,deliveryDirectives:f});break}}}class Ns{static get version(){return to}static isMSESupported(){return vy()}static isSupported(){return gx()}static getMediaSource(){return Ks()}static get Events(){return E}static get MetadataSchema(){return Vt}static get ErrorTypes(){return te}static get ErrorDetails(){return w}static get DefaultConfig(){return Ns.defaultConfig?Ns.defaultConfig:rx}static set DefaultConfig(e){Ns.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 Bf,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=RS(e.debug||!1,"Hls instance",e.assetPlayerId),s=this.config=ax(Ns.DefaultConfig,e,t);this.userConfig=e,s.progressive&&ox(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 _1(this),h=s.interstitialsController,f=h?this.interstitialsController=new h(this,Ns):null,m=this.bufferController=new n(this,c),p=this.capLevelController=new a(this),g=new l(this),v=new bx(this),T=s.contentSteeringController,y=T?new T(this):null,b=this.levelController=new px(this,y),A=new fx(this),L=new Tx(this.config,this.logger),S=this.streamController=new yx(this,c,L),R=this.gapController=new cx(this,c);p.setStreamController(S),g.setStreamController(S);const x=[v,b,S];f&&x.splice(1,0,f),y&&x.splice(1,0,y),this.networkControllers=x;const I=[u,m,R,p,g,A,c];this.audioTrackController=this.createController(s.audioTrackController,x);const M=s.audioStreamController;M&&x.push(this.audioStreamController=new M(this,c,L)),this.subtitleTrackController=this.createController(s.subtitleTrackController,x);const F=s.subtitleStreamController;F&&x.push(this.subtititleStreamController=new F(this,c,L)),this.createController(s.timelineController,I),L.emeController=this.emeController=this.createController(s.emeController,I),this.cmcdController=this.createController(s.cmcdController,I),this.latencyController=this.createController(mx,I),this.coreComponents=I,x.push(d);const V=d.onErrorOut;typeof V=="function"&&this.on(E.ERROR,V,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)}
vendor: 6,919 bytes, line 61
61trigger(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=kf.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?.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=cR()),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){a1(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}
vendor: 14,469 bytes, line 61
61setSubtitleOption(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=sE(t);return tE(e,s,navigator.mediaCapabilities)}}Ns.defaultConfig=void 0;var ge=Ns,Pe={VIDEO:"video",THUMBNAIL:"thumbnail",STORYBOARD:"storyboard",DRM:"drm"},re={NOT_AN_ERROR:0,NETWORK_OFFLINE:2000002,NETWORK_UNKNOWN_ERROR:2e6,NETWORK_NO_STATUS:2000001,NETWORK_INVALID_URL:24e5,NETWORK_NOT_FOUND:2404e3,NETWORK_NOT_READY:2412e3,NETWORK_GENERIC_SERVER_FAIL:25e5,NETWORK_TOKEN_MISSING:2403201,NETWORK_TOKEN_MALFORMED:2412202,NETWORK_TOKEN_EXPIRED:2403210,NETWORK_TOKEN_AUD_MISSING:2403221,NETWORK_TOKEN_AUD_MISMATCH:2403222,NETWORK_TOKEN_SUB_MISMATCH:2403232,ENCRYPTED_ERROR:5e6,ENCRYPTED_UNSUPPORTED_KEY_SYSTEM:5000001,ENCRYPTED_GENERATE_REQUEST_FAILED:5000002,ENCRYPTED_UPDATE_LICENSE_FAILED:5000003,ENCRYPTED_UPDATE_SERVER_CERT_FAILED:5000004,ENCRYPTED_CDM_ERROR:5000005,ENCRYPTED_OUTPUT_RESTRICTED:5000006,ENCRYPTED_MISSING_TOKEN:5000002},pu=i=>i===Pe.VIDEO?"playback":i,Is=class ha extends Error{constructor(e,t=ha.MEDIA_ERR_CUSTOM,s,r){var n;super(e),this.name="MediaError",this.code=t,this.context=r,this.fatal=s??(t>=ha.MEDIA_ERR_NETWORK&&t<=ha.MEDIA_ERR_ENCRYPTED),this.message||(this.message=(n=ha.defaultMessages[this.code])!=null?n:"")}};Is.MEDIA_ERR_ABORTED=1,Is.MEDIA_ERR_NETWORK=2,Is.MEDIA_ERR_DECODE=3,Is.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Is.MEDIA_ERR_ENCRYPTED=5,Is.MEDIA_ERR_CUSTOM=100,Is.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 Q=Is,_x=i=>i==null,Jf=(i,e)=>_x(e)?!1:i in e,th={ANY:"any",MUTED:"muted"},Se={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},Yi={MSE:"mse",NATIVE:"native"},fa={HEADER:"header",QUERY:"query",NONE:"none"},$d=Object.values(fa),hs={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},Kg={HLS:hs.M3U8};[...Object.values(hs)];var Ax="en",ih={code:Ax},et=(i,e,t,s,r=i)=>{r.addEventListener(e,t,s),i.addEventListener("teardown",()=>{r.removeEventListener(e,t)},{once:!0})};function Sx(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 em=i=>{let e=i.indexOf("?");if(e<0)return[i];let t=i.slice(0,e),s=i.slice(e);return[t,s]},gu=i=>{let{type:e}=i;if(e){let t=e.toUpperCase();return Jf(t,Kg)?Kg[t]:e}return Ix(i)},Ey=i=>i==="VOD"?Se.ON_DEMAND:Se.LIVE,yy=i=>i==="EVENT"?Number.POSITIVE_INFINITY:i==="VOD"?Number.NaN:0,Ix=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 Rx(i)?hs.M3U8:"";let r=t.slice(s+1).toUpperCase();return Jf(r,hs)?hs[r]:""},Lx="mux.com",Rx=({src:i,customDomain:e=Lx})=>{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},kn=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}},xx=({exp:i},e=Date.now())=>!i||i*1e3<e,kx=({sub:i},e)=>i!==e,Dx=({aud:i},e)=>!i,Cx=({aud:i},e)=>i!==e,Ty="en";function ie(i,e=!0){var t,s;let r=e&&(s=(t=ih)==null?void 0:t[i])!=null?s:i,n=e?ih.code:Ty;return new wx(r,n)}var wx=class{constructor(i,e=(t=>(t=ih)!=null?t:Ty)()){this.message=i,this.locale=e}format(i){return this.message.replace(/\{(\w+)\}/g,(e,t)=>{var s;return(s=i[t])!=null?s:""})}toString(){return this.message}},Mx=Object.values(th),Vg=i=>typeof i=="boolean"||typeof i=="string"&&Mx.includes(i),Px=(i,e,t)=>{let{autoplay:s}=i,r=!1,n=!1,a=Vg(s)?s:!!s,o=()=>{r||et(e,"playing",()=>{r=!0},{once:!0})};if(o(),et(e,"loadstart",()=>{r=!1,o(),fc(e,a)},{once:!0}),et(e,"loadstart",()=>{t||(i.streamType&&i.streamType!==Se.UNKNOWN?n=i.streamType===Se.LIVE:n=!Number.isFinite(e.duration)),fc(e,a)},{once:!0}),t&&t.once(ge.Events.LEVEL_LOADED,(l,d)=>{var u;i.streamType&&i.streamType!==Se.UNKNOWN?n=i.streamType===Se.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&&et(e,"play",()=>{e.preload==="metadata"?t.once(ge.Events.LEVEL_UPDATED,l):l()},{once:!0})}return l=>{r||(a=Vg(l)?l:!!l,fc(e,a))}},fc=(i,e)=>{if(!e)return;let t=i.muted,s=()=>i.muted=t;switch(e){case th.ANY:i.play().catch(()=>{i.muted=!0,i.play().catch(s)});break;case th.MUTED:i.muted=!0,i.play().catch(s);break;default:i.play().catch(()=>{});break}},Ox=({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 et(t,"play",()=>{a=!0,s.config.maxBufferLength=o,s.config.maxBufferSize=l,u()},{once:!0}),d(i),d};function Nx(i,e){var t;if(!("videoTracks"in i))return;let s=new WeakMap;e.on(ge.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(ge.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(ge.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(ge.Events.DESTROYING,o)}var mc=i=>"time"in i?i.time:i.startTime;function Ux(i,e){e.on(ge.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(r,{tracks:n})=>{n.forEach(a=>{var o,l;let d=(o=a.subtitleTrack)!=null?o:a.closedCaptions,u=e.subtitleTracks.findIndex(({lang:h,name:f,type:m})=>h==d?.lang&&f===a.label&&m.toLowerCase()===a.kind),c=((l=a._id)!=null?l:a.default)?"default":`${a.kind}${u}`;tm(i,a.kind,a.label,d?.lang,c,a.default)})});let t=()=>{if(!e.subtitleTracks.length)return;let r=Array.from(i.textTracks).find(o=>o.id&&o.mode==="showing"&&["subtitles","captions"].includes(o.kind));if(!r)return;let n=e.subtitleTracks[e.subtitleTrack],a=n?n.default?"default":`${e.subtitleTracks[e.subtitleTrack].type.toLowerCase()}${e.subtitleTrack}`:void 0;if(e.subtitleTrack<0||r?.id!==a){let o=e.subtitleTracks.findIndex(({lang:l,name:d,type:u,default:c})=>r.id==="default"&&c||l==r.language&&d===r.label&&u.toLowerCase()===r.kind);e.subtitleTrack=o}r?.id===a&&r.cues&&Array.from(r.cues).forEach(o=>{r.addCue(o)})};i.textTracks.addEventListener("change",t),e.on(ge.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(ge.Events.DESTROYING,()=>{i.textTracks.removeEventListener("change",t),i.querySelectorAll("track[data-removeondestroy]").forEach(r=>{r.remove()})});let s=()=>{Array.from(i.textTracks).forEach(r=>{var n,a;if(!["subtitles","caption"].includes(r.kind)&&(r.label==="thumbnails"||r.kind==="chapters")){if(!((n=r.cues)!=null&&n.length)){let o="track";r.kind&&(o+=`[kind="${r.kind}"]`),r.label&&(o+=`[label="${r.label}"]`);let l=i.querySelector(o),d=(a=l?.getAttribute("src"))!=null?a:"";l?.removeAttribute("src"),setTimeout(()=>{l?.setAttribute("src",d)},0)}r.mode!=="hidden"&&(r.mode="hidden")}})};e.once(ge.Events.MANIFEST_LOADED,s),e.once(ge.Events.MEDIA_ATTACHED,s)}function tm(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 $x(i,e){let t=Array.prototype.find.call(i.querySelectorAll("track"),s=>s.track===e);t?.remove()}function To(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 by(i,e,t,s){let r=To(i,t,s);return r||(r=tm(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)=>mc(a)-mc(n)).forEach(n=>{var a,o;let l=n.value,d=mc(n);if("endTime"in n&&n.endTime!=null)r?.addCue(new VTTCue(d,n.endTime,s==="chapters"?l:JSON.stringify(l??null)));else{let u=Array.prototype.findIndex.call(r?.cues,m=>m.startTime>=d),c=(a=r?.cues)==null?void 0:a[u],h=c?c.startTime:Number.isFinite(i.duration)?i.duration:Number.MAX_SAFE_INTEGER,f=(o=r?.cues)==null?void 0:o[u-1];f&&(f.endTime=d),r?.addCue(new VTTCue(d,h,s==="chapters"?l:JSON.stringify(l??null)))}}),i.textTracks.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),r}var im="cuepoints",_y=Object.freeze({label:im});async function Ay(i,e,t=_y){return by(i,e,t.label,"metadata")}var sh=i=>({time:i.startTime,value:JSON.parse(i.text)});function Fx(i,e={label:im}){let t=To(i,e.label,"metadata");return t!=null&&t.cues?Array.from(t.cues,s=>sh(s)):[]}function Sy(i,e={label:im}){var t,s;let r=To(i,e.label,"metadata");if(!((t=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 Bx(i,e=_y){return new Promise(t=>{et(i,"loadstart",async()=>{let s=await Ay(i,[],e);et(i,"cuechange",()=>{let r=Sy(i);if(r){let n=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:r});i.dispatchEvent(n)}},{},s),t(s)})})}var sm="chapters",Iy=Object.freeze({label:sm}),rh=i=>({startTime:i.startTime,endTime:i.endTime,value:i.text});async function Ly(i,e,t=Iy){return by(i,e,t.label,"chapters")}function Hx(i,e={label:sm}){var t;let s=To(i,e.label,"chapters");return(t=s?.cues)!=null&&t.length?Array.from(s.cues,r=>rh(r)):[]}function Ry(i,e={label:sm}){var t,s;let r=To(i,e.label,"chapters");if(!((t=r?.activeCues)!=null&&t.length))return;if(r.activeCues.length===1)return rh(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 rh(a||r.activeCues[0])}async function Gx(i,e=Iy){return new Promise(t=>{et(i,"loadstart",async()=>{let s=await Ly(i,[],e);et(i,"cuechange",()=>{let r=Ry(i);if(r){let n=new CustomEvent("chapterchange",{composed:!0,bubbles:!0,detail:r});i.dispatchEvent(n)}},{},s),t(s)})})}function Kx(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 Vx(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 Ba={VIDEO:"v",THUMBNAIL:"t",STORYBOARD:"s",DRM:"d"},Wx=i=>{if(i===Pe.VIDEO)return Ba.VIDEO;if(i===Pe.DRM)return Ba.DRM},qx=(i,e)=>{var t,s;let r=pu(i),n=`${r}Token`;return(t=e.tokens)!=null&&t[r]?(s=e.tokens)==null?void 0:s[r]:Jf(n,e)?e[n]:void 0},Fd=(i,e,t,s,r=!1,n=!(a=>(a=globalThis.navigator)==null?void 0:a.onLine)())=>{var a,o;if(n){let v=ie("Your device appears to be offline",r),T,y=Q.MEDIA_ERR_NETWORK,b=new Q(v,y,!1,T);return b.errorCategory=e,b.muxCode=re.NETWORK_OFFLINE,b.data=i,b}let l="status"in i?i.status:i.code,d=Date.now(),u=Q.MEDIA_ERR_NETWORK;if(l===200)return;let c=pu(e),h=qx(e,t),f=Wx(e),[m]=em((a=t.playbackId)!=null?a:"");if(!l||!m)return;let p=kn(h);if(h&&!p){let v=ie("The {tokenNamePrefix}
61-token provided is invalid or malformed.",r).format({tokenNamePrefix:c}),T=ie("Compact JWT string: {token}",r).format({token:h}),y=new Q(v,u,!0,T);return y.errorCategory=e,y.muxCode=re.NETWORK_TOKEN_MALFORMED,y.data=i,y}if(l>=500){let v=new Q("",u,s??!0);return v.errorCategory=e,v.muxCode=re.NETWORK_UNKNOWN_ERROR,v}if(l===403)if(p){if(xx(p,d)){let v={timeStyle:"medium",dateStyle:"medium"},T=ie("The video’s secured {tokenNamePrefix}-token has expired.",r).format({tokenNamePrefix:c}),y=ie("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)}),b=new Q(T,u,!0,y);return b.errorCategory=e,b.muxCode=re.NETWORK_TOKEN_EXPIRED,b.data=i,b}if(kx(p,m)){let v=ie("The video’s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",r).format({tokenNamePrefix:c}),T=ie("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 Q(v,u,!0,T);return y.errorCategory=e,y.muxCode=re.NETWORK_TOKEN_SUB_MISMATCH,y.data=i,y}if(Dx(p)){let v=ie("The {tokenNamePrefix}-token is formatted with incorrect information.",r).format({tokenNamePrefix:c}),T=ie("The {tokenNamePrefix}-token has no aud value. aud value should be {expectedAud}.",r).format({tokenNamePrefix:c,expectedAud:f}),y=new Q(v,u,!0,T);return y.errorCategory=e,y.muxCode=re.NETWORK_TOKEN_AUD_MISSING,y.data=i,y}if(Cx(p,f)){let v=ie("The {tokenNamePrefix}-token is formatted with incorrect information.",r).format({tokenNamePrefix:c}),T=ie("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 Q(v,u,!0,T);return y.errorCategory=e,y.muxCode=re.NETWORK_TOKEN_AUD_MISMATCH,y.data=i,y}}else{let v=ie("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=ie("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new Q(v,u,s??!0,T);return y.errorCategory=e,y.muxCode=re.NETWORK_TOKEN_MISSING,y.data=i,y}if(l===412){let v=ie("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),T=ie("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new Q(v,u,s??!0,T);return y.errorCategory=e,y.muxCode=re.NETWORK_NOT_READY,y.streamType=t.streamType===Se.LIVE?"live":t.streamType===Se.ON_DEMAND?"on-demand":"unknown",y.data=i,y}if(l===404){let v=ie("This URL or playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),T=ie("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new Q(v,u,s??!0,T);return y.errorCategory=e,y.muxCode=re.NETWORK_NOT_FOUND,y.data=i,y}if(l===400){let v=ie("The URL or playback-id was invalid. You may have used an invalid value as a playback-id."),T=ie("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new Q(v,u,s??!0,T);return y.errorCategory=e,y.muxCode=re.NETWORK_INVALID_URL,y.data=i,y}let g=new Q("",u,s??!0);return g.errorCategory=e,g.muxCode=re.NETWORK_UNKNOWN_ERROR,g.data=i,g},Wg=ge.DefaultConfig.capLevelController,Yx={"720p":921600,"1080p":2073600,"1440p":4194304,"2160p":8294400};function jx(i){let e=i.toLowerCase().trim();return Yx[e]}var nh=class ma extends Wg{constructor(e){super(e)}static setMaxAutoResolution(e,t){t?ma.maxAutoResolution.set(e,t):ma.maxAutoResolution.delete(e)}getMaxAutoResolution(){var e;let t=this.hls;return(e=ma.maxAutoResolution.get(t))!=null?e:void 0}get levels(){var e;return(e=this.hls.levels)!=null?e:[]}getValidLevels(e){return this.levels.filter((t,s)=>this.isLevelAllowed(t)&&s<=e)}getMaxLevelCapped(e){let t=this.getValidLevels(e),s=this.getMaxAutoResolution();if(!s)return super.getMaxLevel(e);let r=jx(s);if(!r)return super.getMaxLevel(e);let n=t.filter(l=>l.width*l.height<=r),a=n.findIndex(l=>l.width*l.height===r);if(a!==-1){let l=n[a];return t.findIndex(d=>d===l)}if(n.length===0)return 0;let o=n[n.length-1];return t.findIndex(l=>l===o)}getMaxLevel(e){if(this.getMaxAutoResolution()!==void 0)return this.getMaxLevelCapped(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=ma.minMaxResolution;return r>=n?t:Wg.getMaxLevelByMediaSize(s,n*(16/9),n)}};nh.minMaxResolution=720,nh.maxAutoResolution=new WeakMap;var zx=nh,pc=zx,gl={FAIRPLAY:"fairplay",PLAYREADY:"playready",WIDEVINE:"widevine"},Qx=i=>{if(i.includes("fps"))return gl.FAIRPLAY;if(i.includes("playready"))return gl.PLAYREADY;if(i.includes("widevine"))return gl.WIDEVINE},Xx=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())},Zx=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=ek(s),n=r["DATA-ID"];n&&(t[n]={...r})}return{sessionData:t}},Jx=/([A-Z0-9-]+)="?(.*?)"?(?:,|$)/g;function ek(i){let e=[...i.matchAll(Jx)];return Object.fromEntries(e.map(([,t,s])=>[t,s]))}var tk=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=yy(n),l;if(a===Se.LIVE){let d=r.find(u=>u.startsWith("#EXT-X-PART-INF"));if(d)l=+d.split(":")[1].split("=")[1]*2;else{let u=r.find(h=>h.startsWith("#EXT-X-TARGETDURATION")),c=(s=u?.split(":"))==null?void 0:s[1];l=+(c??6)*3}}return{streamType:a,targetLiveWindow:o,liveEdgeStartOffset:l}},ik=async(i,e)=>{if(e===hs.MP4)return{streamType:Se.ON_DEMAND,targetLiveWindow:Number.NaN,liveEdgeStartOffset:void 0,sessionData:void 0};if(e===hs.M3U8){let t=await fetch(i);if(!t.ok)return Promise.reject(t);let s=await t.text(),r=await Xx(s);return{...Zx(s),...tk(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}},sk=async(i,e,t=gu({src:i}))=>{var s,r,n,a;let{streamType:o,targetLiveWindow:l,liveEdgeStartOffset:d,sessionData:u}=await ik(i,t),c=u?.["com.apple.hls.chapters"];(c!=null&&c.URI||c!=null&&c.VALUE.toLocaleLowerCase().startsWith("http"))&&rm((s=c.URI)!=null?s:c.VALUE,e),((r=qe.get(e))!=null?r:{}).liveEdgeStartOffset=d,((n=qe.get(e))!=null?n:{}).targetLiveWindow=l,e.dispatchEvent(new CustomEvent("targetlivewindowch
64ange",{composed:!0,bubbles:!0})),((a=qe.get(e))!=null?a:{}).streamType=o,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},rm=async(i,e)=>{var t,s;try{let r=await fetch(i);if(!r.ok)throw new Error(`Failed to fetch Mux metadata: ${r.status} ${r.statusText}`);let n=await r.json(),a={};if(!((t=n?.[0])!=null&&t.metadata))return;for(let l of n[0].metadata)l.key&&l.value&&(a[l.key]=l.value);((s=qe.get(e))!=null?s:{}).metadata=a;let o=new CustomEvent("muxmetadata");e.dispatchEvent(o)}catch(r){console.error(r)}},rk=i=>{var e;let t=i.type,s=Ey(t),r=yy(t),n,a=!!((e=i.partList)!=null&&e.length);return s===Se.LIVE&&(n=a?i.partTarget*2:i.targetduration*3),{streamType:s,targetLiveWindow:r,liveEdgeStartOffset:n,lowLatency:a}},nk=(i,e,t)=>{var s,r,n,a,o,l,d,u;let{streamType:c,targetLiveWindow:h,liveEdgeStartOffset:f,lowLatency:m}=rk(i);if(c===Se.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=qe.get(e))!=null?o:{}).seekable=p}((l=qe.get(e))!=null?l:{}).liveEdgeStartOffset=f,((d=qe.get(e))!=null?d:{}).targetLiveWindow=h,e.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((u=qe.get(e))!=null?u:{}).streamType=c,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},qg,Yg,xy=(Yg=(qg=globalThis?.navigator)==null?void 0:qg.userAgent)!=null?Yg:"",jg,zg,Qg,ak=(Qg=(zg=(jg=globalThis?.navigator)==null?void 0:jg.userAgentData)==null?void 0:zg.platform)!=null?Qg:"",ok=xy.toLowerCase().includes("android")||["x11","android"].some(i=>ak.toLowerCase().includes(i)),lk=i=>/^((?!chrome|android).)*safari/i.test(xy)&&!!i.canPlayType("application/vnd.apple.mpegurl"),qe=new WeakMap,fs="mux.com",Xg,Zg,ky=(Zg=(Xg=ge).isSupported)==null?void 0:Zg.call(Xg),dk=i=>ok||!lk(i),nm=()=>{if(typeof window<"u")return xf.utils.now()},uk=xf.utils.generateUUID,ah=({playbackId:i,customDomain:e=fs,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=""]=em(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()},vu=i=>{if(!i)return;let[e]=i.split("?");return e||void 0},am=i=>{if(!i||!i.startsWith("https://stream."))return;let[e]=new URL(i).pathname.slice(1).split(/\.m3u8|\//);return e||void 0},ck=i=>{var e,t,s;return(e=i?.metadata)!=null&&e.video_id?i.metadata.video_id:Uy(i)&&(s=(t=vu(i.playbackId))!=null?t:am(i.src))!=null?s:i.src},Dy=i=>{var e;return(e=qe.get(i))==null?void 0:e.error},hk=i=>{var e;return(e=qe.get(i))==null?void 0:e.metadata},oh=i=>{var e,t;return(t=(e=qe.get(i))==null?void 0:e.streamType)!=null?t:Se.UNKNOWN},fk=i=>{var e,t;return(t=(e=qe.get(i))==null?void 0:e.targetLiveWindow)!=null?t:Number.NaN},om=i=>{var e,t;return(t=(e=qe.get(i))==null?void 0:e.seekable)!=null?t:i.seekable},mk=i=>{var e;let t=(e=qe.get(i))==null?void 0:e.liveEdgeStartOffset;if(typeof t!="number")return Number.NaN;let s=om(i);return s.length?s.end(s.length-1)-t:Number.NaN},lm=.034,pk=(i,e,t=lm)=>Math.abs(i-e)<=t,Cy=(i,e,t=lm)=>i>e||pk(i,e,t),gk=(i,e=lm)=>i.paused&&Cy(i.currentTime,i.duration,e),wy=(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},My=(i,e)=>i.ended||i.loop?i.ended:e&&wy(i,e)?!0:gk(i),vk=(i,e,t)=>{Py(e,t,i);let{metadata:s={}}=i,{view_session_id:r=uk()}=s,n=ck(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,qe.set(e,{retryCount:0});let o=Ek(i,e),l=Ox(i,e,o);i!=null&&i.muxDataKeepSession&&e!=null&&e.mux&&!e.mux.deleted?o&&e.mux.addHLSJS({hlsjs:o,Hls:o?ge:void 0}):Sk(i,e,o),Ik(i,e,o),Bx(e),Gx(e);let d=Px(i,e,o);return{engine:o,setAutoplay:d,setPreload:l}},Py=(i,e,t)=>{let s=e?.engine;i!=null&&i.mux&&!i.mux.deleted&&(t!=null&&t.muxDataKeepSession?s&&i.mux.removeHLSJS():(i.mux.destroy(),delete i.mux)),s&&(s.detachMedia(),s.destroy()),i&&(i.hasAttribute("src")&&(i.removeAttribute("src"),i.load()),i.removeEventListener("error",Fy),i.removeEventListener("error",lh),i.removeEventListener("durationchange",$y),qe.delete(i),i.dispatchEvent(new Event("teardown")))};function Oy(i,e){var t;let s=gu(i);if(s!==hs.M3U8)return!0;let r=!s||((t=e.canPlayType(s))!=null?t:!0),{preferPlayback:n}=i,a=n===Yi.MSE,o=n===Yi.NATIVE,l=ky&&(a||dk(e));return r&&(o||!l)}var Ek=(i,e)=>{let{debug:t,streamType:s,startTime:r=-1,metadata:n,preferCmcd:a,_hlsConfig:o={},maxAutoResolution:l}=i,d=gu(i)===hs.M3U8,u=Oy(i,e);if(d&&!u&&ky){let c={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},h=yk(s),f=Tk(i),m=[fa.QUERY,fa.HEADER].includes(a)?{useHeaders:a===fa.HEADER,sessionId:n?.view_session_id,contentId:n?.video_id}:void 0,p=o.capLevelToPlayerSize==null?{capLevelController:pc}:{},g=new ge({debug:t,startPosition:r,cmcd:m,xhrSetup:(v,T)=>{var y,b;if(a&&a!==fa.QUERY)return;let A=new URL(T);if(!A.searchParams.has("CMCD"))return;let L=((b=(y=A.searchParams.get("CMCD"))==null?void 0:y.split(","))!=null?b:[]).filter(S=>S.startsWith("sid")||S.startsWith("cid")).join(",");A.searchParams.set("CMCD",L),v.open("GET",A)},...p,...c,...h,...f,...o});return p.capLevelController===pc&&l!==void 0&&pc.setMaxAutoResolution(g,l),g.on(ge.Events.MANIFEST_PARSED,async function(v,T){var y,b;let A=(y=T.sessionData)==null?void 0:y["com.apple.hls.chapters"];(A!=null&&A.URI||A!=null&&A.VALUE.toLocaleLowerCase().startsWith("http"))&&rm((b=A?.URI)!=null?b:A?.VALUE,e)}),g}},yk=i=>i===Se.LIVE?{backBufferLength:8}:{},Tk=i=>{let{tokens:{drm:e}={},playbackId:t,drmTypeCb:s}=i,r=vu(t);return!e||!r?{}:{emeEnabled:!0,drmSystems:{"com.apple.fps":{licenseUrl:vl(i,"fairplay"),serverCertificateUrl:Ny(i,"fairplay")},"com.widevine.alpha":{licenseUrl:vl(i,"widevine")},"com.microsoft.playready":{licenseUrl:vl(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=Qx(n);return s?.(l),o}))}},bk=async i=>{let e=await fetch(i);return e.status!==200?Promise.reject(e):await e.arrayBuffer()},_k=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)},Ak=(i,e)=>{let t=async n=>{let a=await navigator.requestMediaKeySystemAccess("com.apple.fps",[{initDataTypes:[n],videoCapabilities:[{contentType:"application/vnd.apple.mpegurl",robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:"not-allowed",sessionTypes:["temporary"]}]).then(l=>{var d;return(d=i.drmTypeCb)==null||d.call(i,gl.FAIRPLAY),l}).catch(()=>{let l=ie("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),d=new Q(l,Q.MEDIA_ERR_ENCRYPTED,!0);
64d.errorCategory=Pe.DRM,d.muxCode=re.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM,Wt(e,d)});if(!a)return;let o=await a.createMediaKeys();try{let l=await bk(Ny(i,"fairplay")).catch(d=>{if(d instanceof Response){let u=Fd(d,Pe.DRM,i);return console.error("mediaError",u?.message,u?.context),u?Promise.reject(u):Promise.reject(new Error("Unexpected error in app cert request"))}return Promise.reject(d)});await o.setServerCertificate(l).catch(()=>{let d=ie("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate."),u=new Q(d,Q.MEDIA_ERR_ENCRYPTED,!0);return u.errorCategory=Pe.DRM,u.muxCode=re.ENCRYPTED_UPDATE_SERVER_CERT_FAILED,Promise.reject(u)})}catch(l){Wt(e,l);return}await e.setMediaKeys(o)},s=n=>{let a;if(n==="internal-error"){let o=ie("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");a=new Q(o,Q.MEDIA_ERR_ENCRYPTED,!0),a.errorCategory=Pe.DRM,a.muxCode=re.ENCRYPTED_CDM_ERROR}else if(n==="output-restricted"||n==="output-downscaled"){let o=ie("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");a=new Q(o,Q.MEDIA_ERR_ENCRYPTED,!1),a.errorCategory=Pe.DRM,a.muxCode=re.ENCRYPTED_OUTPUT_RESTRICTED}a&&Wt(e,a)},r=async(n,a)=>{let o=e.mediaKeys.createSession(),l=()=>{o.keyStatuses.forEach(u=>s(u))},d=async u=>{let c=u.message;try{let h=await _k(c,vl(i,"fairplay"));try{await o.update(h)}catch{let f=ie("Failed to update DRM license. This may be an issue with the player or your protected content."),m=new Q(f,Q.MEDIA_ERR_ENCRYPTED,!0);m.errorCategory=Pe.DRM,m.muxCode=re.ENCRYPTED_UPDATE_LICENSE_FAILED,Wt(e,m)}}
vendor: 9,082 bytes, line 64
64catch(h){if(h instanceof Response){let f=Fd(h,Pe.DRM,i);if(console.error("mediaError",f?.message,f?.context),f){Wt(e,f);return}console.error("Unexpected error in license key request",h);return}console.error(h)}};o.addEventListener("keystatuseschange",l),o.addEventListener("message",d),e.addEventListener("teardown",()=>{o.removeEventListener("keystatuseschange",l),o.removeEventListener("message",d),o.close()},{once:!0}),await o.generateRequest(n,a).catch(u=>{console.error("Failed to generate license request",u);let c=ie("Failed to generate a DRM license request. This may be an issue with the player or your protected content."),h=new Q(c,Q.MEDIA_ERR_ENCRYPTED,!0);return h.errorCategory=Pe.DRM,h.muxCode=re.ENCRYPTED_GENERATE_REQUEST_FAILED,Promise.reject(h)})};et(e,"encrypted",async n=>{try{let a=n.initDataType;if(a!=="skd"){console.error(`Received unexpected initialization data type "${a}"`);return}e.mediaKeys||await t(a);let o=n.initData;if(o==null){console.error(`Could not start encrypted playback due to missing initData in ${n.type} event`);return}await r(a,o)}catch(a){Wt(e,a);return}})},vl=({playbackId:i,tokens:{drm:e}={},customDomain:t=fs},s)=>{let r=vu(i);return`https://license.${t.toLocaleLowerCase().endsWith(fs)?t:fs}/license/${s}/${r}?token=${e}`},Ny=({playbackId:i,tokens:{drm:e}={},customDomain:t=fs},s)=>{let r=vu(i);return`https://license.${t.toLocaleLowerCase().endsWith(fs)?t:fs}/appcert/${s}/${r}?token=${e}`},Uy=({playbackId:i,src:e,customDomain:t})=>{if(i)return!0;if(typeof e!="string")return!1;let s=window?.location.href,r=new URL(e,s).hostname.toLocaleLowerCase();return r.includes(fs)||!!t&&r.includes(t.toLocaleLowerCase())},Sk=(i,e,t)=>{var s;let{envKey:r,disableTracking:n,muxDataSDK:a=xf,muxDataSDKOptions:o={}}=i,l=Uy(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?.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?ge: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}})}},Ik=(i,e,t)=>{var s,r;let n=Oy(i,e),{src:a,customDomain:o=fs}=i,l=()=>{e.ended||i.disablePseudoEnded||!My(e,t)||(wy(e,t)?e.currentTime=e.buffered.end(e.buffered.length-1):e.dispatchEvent(new Event("ended")))},d,u,c=()=>{let h=om(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(et(e,"durationchange",c),e&&n){let h=gu(i);if(typeof a=="string"){if(a.endsWith(".mp4")&&a.includes(o)){let p=am(a),g=new URL(`https://stream.${o}/${p}/metadata.json`);rm(g.toString(),e)}let f=()=>{if(oh(e)!==Se.LIVE||Number.isFinite(e.duration))return;let p=setInterval(c,1e3);e.addEventListener("teardown",()=>{clearInterval(p)},{once:!0}),et(e,"durationchange",()=>{Number.isFinite(e.duration)&&clearInterval(p)})},m=async()=>sk(a,e,h).then(f).catch(p=>{if(p instanceof Response){let g=Fd(p,Pe.VIDEO,i);if(g){Wt(e,g);return}}});if(e.preload==="none"){let p=()=>{m(),e.removeEventListener("loadedmetadata",g)},g=()=>{m(),e.removeEventListener("play",p)};et(e,"play",p,{once:!0}),et(e,"loadedmetadata",g,{once:!0})}else m();(s=i.tokens)!=null&&s.drm?Ak(i,e):et(e,"encrypted",()=>{let p=ie("Attempting to play DRM-protected content without providing a DRM token."),g=new Q(p,Q.MEDIA_ERR_ENCRYPTED,!0);g.errorCategory=Pe.DRM,g.muxCode=re.ENCRYPTED_MISSING_TOKEN,Wt(e,g)},{once:!0}),e.setAttribute("src",a),i.startTime&&(((r=qe.get(e))!=null?r:{}).startTime=i.startTime,e.addEventListener("durationchange",$y,{once:!0}))}else e.removeAttribute("src");e.addEventListener("error",Fy),e.addEventListener("error",lh),e.addEventListener("emptied",()=>{e.querySelectorAll("track[data-removeondestroy]").forEach(f=>{f.remove()})},{once:!0}),et(e,"pause",l),et(e,"seeked",l),et(e,"play",()=>{e.ended||Cy(e.currentTime,e.duration)&&(e.currentTime=e.seekable.length?e.seekable.start(0):0)})}else t&&a?(t.once(ge.Events.LEVEL_LOADED,(h,f)=>{nk(f.details,e,t),c(),oh(e)===Se.LIVE&&!Number.isFinite(e.duration)&&(t.on(ge.Events.LEVEL_UPDATED,c),et(e,"durationchange",()=>{Number.isFinite(e.duration)&&t.off(ge.Events.LEVELS_UPDATED,c)}))}),t.on(ge.Events.ERROR,(h,f)=>{var m,p;let g=Lk(f,i);if(g.muxCode===re.NETWORK_NOT_READY){let v=(m=qe.get(e))!=null?m:{},T=(p=v.retryCount)!=null?p:0;if(T<6){let y=T===0?5e3:6e4,b=new Q(`Retrying in ${y/1e3} seconds...`,g.code,g.fatal);Object.assign(b,g),Wt(e,b),setTimeout(()=>{v.retryCount=T+1,f.details==="manifestLoadError"&&f.url&&t.loadSource(f.url)},y);return}else{v.retryCount=0;let y=new Q('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),Wt(e,y);return}}Wt(e,g)}),t.on(ge.Events.MANIFEST_LOADED,()=>{let h=qe.get(e);h&&h.error&&(h.error=null,h.retryCount=0,e.dispatchEvent(new Event("emptied")),e.dispatchEvent(new Event("loadstart")))}),e.addEventListener("error",lh),et(e,"waiting",l),Nx(i,t),Ux(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=qe.get(t))==null?void 0:e.startTime;if(s&&Sx(t.seekable,t.duration,s)){let r=t.preload==="auto";r&&(t.preload="none"),t.currentTime=s,r&&(t.preload="auto")}}async function Fy(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 Q(t,s);if(e.src&&s===Q.MEDIA_ERR_SRC_NOT_SUPPORTED&&e.readyState===HTMLMediaElement.HAVE_NOTHING){setTimeout(()=>{var n;let a=(n=Dy(e))!=null?n:e.error;a?.code===Q.MEDIA_ERR_SRC_NOT_SUPPORTED&&Wt(e,r)},500);return}if(e.src&&(s!==Q.MEDIA_ERR_DECODE||s!==void 0))try{let{status:n}=await fetch(e.src);r.data={response:{code:n}}}catch{}Wt(e,r)}function Wt(i,e){var t;e.fatal&&(((t=qe.get(i))!=null?t:{}).error=e,i.dispatchEvent(new CustomEvent("error",{detail:e})))}function lh(i){var e,t;if(!(i instanceof CustomEvent)||!(i.detail instanceof Q))return;let s=i.target,r=i.detail;!r||!r.fatal||(((e=qe.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 Lk=(i,e)=>{var t,s,r;i.fatal?console.error("getErrorFromHlsErrorData()",i):e.debug&&console.warn("getErrorFromHlsErrorData() (non-fatal)",i);let n={[ge.ErrorTypes.NETWORK_ERROR]:Q.MEDIA_ERR_NETWORK,[ge.ErrorTypes.MEDIA_ERROR]:Q.MEDIA_ERR_DECODE,[ge.ErrorTypes.KEY_SYSTEM_ERROR]:Q.MEDIA_ERR_ENCRYPTED},a=u=>[ge.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,ge.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED].includes(u.details)?Q.MEDIA_ERR_NETWORK:n[u.type],o=u=>{if(u.type===ge.ErrorTypes.KEY_SYSTEM_ERROR)return Pe.DRM;if(u.type===ge.ErrorTypes.NETWORK_ERROR)return Pe.VIDEO},l,d=a(i);if(d===Q.MEDIA_ERR_NETWORK&&i.response){let u=(t=o(i))!=null?t:Pe.VIDEO;l=(s=Fd(i.response,u,e,i.fatal))!=null?s:new Q("",d,i.fatal)}else if(d===Q.MEDIA_ERR_ENCRYPTED)if(i.details===ge.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE){let u=ie("Attempting to play DRM-protected content without providing a DRM token.");l=new Q(u,Q.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Pe.DRM,l.muxCode=re.ENCRYPTED_MISSING_TOKEN}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_NO_ACCESS){let u=ie("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser.");l=new Q(u,Q.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Pe.DRM,l.muxCode=re.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_NO_SESSION){let u=ie("Failed to generate a DRM license request. This may be an issue with the player or your protected content.");l=new Q(u,Q.MEDIA_ERR_ENCRYPTED,!0),l.errorCategory=Pe.DRM,l.muxCode=re.ENCRYPTED_GENERATE_REQUEST_FAILED}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED){let u=ie("Failed to update DRM license. This may be an issue with the player or your protected content.");l=new Q(u,Q.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Pe.DRM,l.muxCode=re.ENCRYPTED_UPDATE_LICENSE_FAILED}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED){let u=ie("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate.");l=new Q(u,Q.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Pe.DRM,l.muxCode=re.ENCRYPTED_UPDATE_SERVER_CERT_FAILED}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR){let u=ie("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");l=new Q(u,Q.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Pe.DRM,l.muxCode=re.ENCRYPTED_CDM_ER
64ROR}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED){let u=ie("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");l=new Q(u,Q.MEDIA_ERR_ENCRYPTED,!1),l.errorCategory=Pe.DRM,l.muxCode=re.ENCRYPTED_OUTPUT_RESTRICTED}else l=new Q(i.error.message,Q.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Pe.DRM,l.muxCode=re.ENCRYPTED_ERROR;else l=new Q("",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 Rk=["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"],By=["autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"];function xk(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${Gy(i)}></audio>
88    </slot>
89    <slot></slot>
90  `}function kk(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${Gy(i)}></video>
113    </slot>
114    <slot></slot>
115  `}function Hy(i,{tag:e,is:t}){const s=globalThis.document?.createElement?.(e,{is:t}),r=s?Dk(s):[];return class dh extends i{static getTemplateHTML=e.endsWith("audio")?xk:kk;static shadowRootOptions={mode:"open"};static Events=Rk;static#e=!1;static get observedAttributes(){return dh.#s(),[...s?.constructor?.observedAttributes??[],...By]}static#s(){if(this.#e)return;this.#e=!0;const a=new Set(this.observedAttributes);a.delete("muted");for(const o of r)if(!(o in this.prototype))if(typeof s[o]=="function")this.prototype[o]=function(...l){return this.#n(),this.call?this.call(o,...l):this.nativeEl?.[o]?.apply(this.nativeEl,l)};else{const l={get(){this.#n();const d=o.toLowerCase();if(a.has(d)){const u=this.getAttribute(d);return u===null?!1:u===""?!0:u}return this.get?.(o)??this.nativeEl?.[o]}};o!==o.toUpperCase()&&(l.set=function(d){this.#n();const u=o.toLowerCase();if(a.has(u)){d===!0||d===!1||d==null?this.toggleAttribute(u,!!d):this.setAttribute(u,d);return}if(this.set){this.set(o,d);return}this.nativeEl&&(this.nativeEl[o]=d)}),Object.defineProperty(this.prototype,o,l)}}#i=!1;#r=null;#t=new Map;#a;get;set;call;get nativeEl(){return this.#n(),this.#r??this.querySelector(":scope > [slot=media]")??this.querySelector(e)??this.shadowRoot?.querySelector(e)??null}set nativeEl(a){this.#r=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(){return this.getAttribute("preload")??this.nativeEl?.preload}set preload(a){this.setAttribute("preload",`${a}`)}#n(){this.#i||(this.#i=!0,this.init())}init(){if(!this.shadowRoot){this.attachShadow({mode:"open"});const a=Ck(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)this.#c(a);this.#a=new MutationObserver(this.#o.bind(this)),this.shadowRoot.addEventListener("slotchange",()=>this.#l()),this.#l();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}))}#l(){const a=new Map(this.#t);(this.shadowRoot?.querySelector("slot:not([name])")?.assignedElements({flatten:!0}).filter(d=>
115["track","source"].includes(d.localName))).forEach(d=>{a.delete(d);let u=this.#t.get(d);u||(u=d.cloneNode(),this.#t.set(d,u),this.#a?.observe(d,{attributes:!0})),this.nativeEl?.append(u),this.#d(u)}),a.forEach((d,u)=>{d.remove(),this.#t.delete(u)})}#o(a){for(const o of a)if(o.type==="attributes"){const{target:l,attributeName:d}=o,u=this.#t.get(l);u&&d&&(u.setAttribute(d,l.getAttribute(d)??""),this.#d(u))}}#d(a){a&&a.localName==="track"&&a.default&&(a.kind==="chapters"||a.kind==="metadata")&&a.track.mode==="disabled"&&(a.track.mode="hidden")}#c(a){if(Object.prototype.hasOwnProperty.call(this,a)){const o=this[a];delete this[a],this[a]=o}}attributeChangedCallback(a,o,l){this.#n(),this.#u(a,o,l)}#u(a,o,l){["id","class"].includes(a)||!dh.observedAttributes.includes(a)&&this.constructor.observedAttributes.includes(a)||(l===null?this.nativeEl?.removeAttribute(a):this.nativeEl?.getAttribute(a)!==l&&this.nativeEl?.setAttribute(a,l))}connectedCallback(){this.#n()}}}function Dk(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 Gy(i){let e="";for(const t in i){if(!By.includes(t))continue;const s=i[t];s===""?e+=` ${t}`:e+=` ${t}="${s}"`}return e}function Ck(i){const e={};for(const t of i)e[t.name]=t.value;return e}const Go=Hy(globalThis.HTMLElement??class{},{tag:"video"});Hy(globalThis.HTMLElement??class{},{tag:"audio"});var Ky=i=>{throw TypeError(i)},dm=(i,e,t)=>e.has(i)||Ky("Cannot "+t),Et=(i,e,t)=>(dm(i,e,"read from private field"),t?t.call(i):e.get(i)),di=(i,e,t)=>e.has(i)?Ky("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),Jt=(i,e,t,s)=>(dm(i,e,"write to private field"),e.set(i,t),t),Ko=(i,e,t)=>(dm(i,e,"access private method"),t),wk=()=>{try{return"0.29.2"}catch{}return"UNKNOWN"},Mk=wk(),Pk=()=>Mk,Ok=`
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>`,C={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",DISABLE_PSEUDO_ENDED:"disable-pseudo-ended",DRM_TOKEN:"drm-token",PLAYBACK_TOKEN:"playback-token",ENV_KEY:"env-key",MAX_RESOLUTION:"max-resolution",MIN_RESOLUTION:"min-resolution",MAX_AUTO_RESOLUTION:"max-auto-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"}
vendor: 10,385 bytes, lines 116-144
116,Nk=Object.values(C),Jg=Pk(),e0="mux-video",xi,pa,El,ga,yl,Tl,bl,_l,Al,va,jr,Ea,Uk=class extends Go{constructor(){super(),di(this,jr),di(this,xi),di(this,pa),di(this,El),di(this,ga,{}),di(this,yl,{}),di(this,Tl),di(this,bl),di(this,_l),di(this,Al),di(this,va,""),Jt(this,El,nm()),this.nativeEl.addEventListener("muxmetadata",e=>{var t;let s=hk(this.nativeEl),r=(t=this.metadata)!=null?t:{};this.metadata={...s,...r},s?.["com.mux.video.branding"]==="mux-free-plan"&&(Jt(this,va,"default"),this.updateLogo())})}static get NAME(){return e0}static get VERSION(){return Jg}static get observedAttributes(){var e;return[...Nk,...(e=Go.observedAttributes)!=null?e:[]]}static getLogoHTML(e){return!e||e==="false"?"":e==="default"?Ok:`<img part="logo" src="${e}" />`}static getTemplateHTML(e={}){var t;return`
117      ${Go.getTemplateHTML(e)}
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((t=e[C.LOGO])!=null?t:"")}
143      </slot>
144    `}get preferCmcd(){var e;return(e=this.getAttribute(C.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?$d.includes(e)?this.setAttribute(C.PREFER_CMCD,e):console.warn(`Invalid value for preferCmcd. Must be one of ${$d.join()}`):this.removeAttribute(C.PREFER_CMCD))}get playerInitTime(){return this.hasAttribute(C.PLAYER_INIT_TIME)?+this.getAttribute(C.PLAYER_INIT_TIME):Et(this,El)}set playerInitTime(e){e!=this.playerInitTime&&(e==null?this.removeAttribute(C.PLAYER_INIT_TIME):this.setAttribute(C.PLAYER_INIT_TIME,`${+e}`))}get playerSoftwareName(){var e;return(e=Et(this,_l))!=null?e:e0}set playerSoftwareName(e){Jt(this,_l,e)}get playerSoftwareVersion(){var e;return(e=Et(this,bl))!=null?e:Jg}set playerSoftwareVersion(e){Jt(this,bl,e)}get _hls(){var e;return(e=Et(this,xi))==null?void 0:e.engine}get mux(){var e;return(e=this.nativeEl)==null?void 0:e.mux}get error(){var e;return(e=Dy(this.nativeEl))!=null?e:null}get errorTranslator(){return Et(this,Al)}set errorTranslator(e){Jt(this,Al,e)}get src(){return this.getAttribute("src")}set src(e){e!==this.src&&(e==null?this.removeAttribute("src"):this.setAttribute("src",e))}get type(){var e;return(e=this.getAttribute(C.TYPE))!=null?e:void 0}set type(e){e!==this.type&&(e?this.setAttribute(C.TYPE,e):this.removeAttribute(C.TYPE))}get preload(){let e=this.getAttribute("preload");return e===""?"auto":["none","metadata","auto"].includes(e)?e:super.preload}set preload(e){e!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(e)?this.setAttribute("preload",e):this.removeAttribute("preload"))}get debug(){return this.getAttribute(C.DEBUG)!=null}set debug(e){e!==this.debug&&(e?this.setAttribute(C.DEBUG,""):this.removeAttribute(C.DEBUG))}get disableTracking(){return this.hasAttribute(C.DISABLE_TRACKING)}set disableTracking(e){e!==this.disableTracking&&this.toggleAttribute(C.DISABLE_TRACKING,!!e)}get disableCookies(){return this.hasAttribute(C.DISABLE_COOKIES)}set disableCookies(e){e!==this.disableCookies&&(e?this.setAttribute(C.DISABLE_COOKIES,""):this.removeAttribute(C.DISABLE_COOKIES))}get disablePseudoEnded(){return this.hasAttribute(C.DISABLE_PSEUDO_ENDED)}set disablePseudoEnded(e){e!==this.disablePseudoEnded&&(e?this.setAttribute(C.DISABLE_PSEUDO_ENDED,""):this.removeAttribute(C.DISABLE_PSEUDO_ENDED))}get startTime(){let e=this.getAttribute(C.START_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set startTime(e){e!==this.startTime&&(e==null?this.removeAttribute(C.START_TIME):this.setAttribute(C.START_TIME,`${e}`))}get playbackId(){var e;return this.hasAttribute(C.PLAYBACK_ID)?this.getAttribute(C.PLAYBACK_ID):(e=am(this.src))!=null?e:void 0}set playbackId(e){e!==this.playbackId&&(e?this.setAttribute(C.PLAYBACK_ID,e):this.removeAttribute(C.PLAYBACK_ID))}get maxResolution(){var e;return(e=this.getAttribute(C.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(C.MAX_RESOLUTION,e):this.removeAttribute(C.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(C.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(C.MIN_RESOLUTION,e):this.removeAttribute(C.MIN_RESOLUTION))}get maxAutoResolution(){var e;return(e=this.getAttribute(C.MAX_AUTO_RESOLUTION))!=null?e:void 0}set maxAutoResolution(e){e==null?this.removeAttribute(C.MAX_AUTO_RESOLUTION):this.setAttribute(C.MAX_AUTO_RESOLUTION,e)}get renditionOrder(){var e;return(e=this.getAttribute(C.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(C.RENDITION_ORDER,e):this.removeAttribute(C.RENDITION_ORDER))}get programStartTime(){let e=this.getAttribute(C.PROGRAM_START_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set programStartTime(e){e==null?this.removeAttribute(C.PROGRAM_START_TIME):this.setAttribute(C.PROGRAM_START_TIME,`${e}`)}get programEndTime(){let e=this.getAttribute(C.PROGRAM_END_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set programEndTime(e){e==null?this.removeAttribute(C.PROGRAM_END_TIME):this.setAttribute(C.PROGRAM_END_TIME,`${e}`)}get assetStartTime(){let e=this.getAttribute(C.ASSET_START_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set assetStartTime(e){e==null?this.removeAttribute(C.ASSET_START_TIME):this.setAttribute(C.ASSET_START_TIME,`${e}`)}get assetEndTime(){let e=this.getAttribute(C.ASSET_END_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set assetEndTime(e){e==null?this.removeAttribute(C.ASSET_END_TIME):this.setAttribute(C.ASSET_END_TIME,`${e}`)}get customDomain(){var e;return(e=this.getAttribute(C.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(C.CUSTOM_DOMAIN,e):this.removeAttribute(C.CUSTOM_DOMAIN))}get drmToken(){var e;return(e=this.getAttribute(C.DRM_TOKEN))!=null?e:void 0}set drmToken(e){e!==this.drmToken&&(e?this.setAttribute(C.DRM_TOKEN,e):this.removeAttribute(C.DRM_TOKEN))}get playbackToken(){var e,t,s,r;if(this.hasAttribute(C.PLAYBACK_TOKEN))return(e=this.getAttribute(C.PLAYBACK_TOKEN))!=null?e:void 0;if(this.hasAttribute(C.PLAYBACK_ID)){let[,n]=em((t=this.playbackId)!=null?t:"");return(s=new URLSearchParams(n).get("token"))!=null?s:void 0}if(this.src)return(r=new URLSearchParams(this.src).get("token"))!=null?r:void 0}set playbackToken(e){e!==this.playbackToken&&(e?this.setAttribute(C.PLAYBACK_TOKEN,e):this.removeAttribute(C.PLAYBACK_TOKEN))}get tokens(){let e=this.getAttribute(C.PLAYBACK_TOKEN),t=this.getAttribute(C.DRM_TOKEN);return{...Et(this,yl),...e!=null?{playback:e}:{},...t!=null?{drm:t}:{}}}set tokens(e){Jt(this,yl,e??{})}get ended(){return My(this.nativeEl,this._hls)}get envKey(){var e;return(e=this.getAttribute(C.ENV_KEY))!=null?e:void 0}set envKey(e){e!==this.envKey&&(e?this.setAttribute(C.ENV_KEY,e):this.removeAttribute(C.ENV_KEY))}get beaconCollectionDomain(){var e;return(e=this.getAttribute(C.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(C.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(C.BEACON_COLLECTION_DOMAIN))}get streamType(){var e;return(e=this.getAttribute(C.STREAM_TYPE))!=null?e:oh(this.nativeEl)}set streamType(e){e!==this.streamType&&(e?this.setAttribute(C.STREAM_TYPE,e):this.removeAttribute(C.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(C.TARGET_LIVE_WINDOW)?+this.getAttribute(C.TARGET_LIVE_WINDOW):fk(this.nativeEl)}set targetLiveWindow(e){e!=this.targetLiveWindow&&(e==null?this.removeAttribute(C.TARGET_LIVE_WINDOW):this.setAttribute(C.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e,t;if(this.hasAttribute(C.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:s}=this,r=(e=this.nativeEl.seekable.end(0))!=null?e:0,n=(t=this.nativeEl.seekable.start(0))!=null?t:0;return Math.max(n,r-s)}return mk(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(C.LIVE_EDGE_OFFSET))return+this.getAttribute(C.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){e!=this.liveEdgeOffset&&(e==null?this.removeAttribute(C.LIVE_EDGE_OFFSET):this.setAttribute(C.LIVE_EDGE_OFFSET,`${+e}`))}get seekable(){return om(this.nativeEl)}async addCuePoints(e){return Ay(this.nativeEl,e)}get activeCuePoint(){return Sy(this.nativeEl)}get cuePoints(){return Fx(this.nativeEl)}async addChapters(e){return Ly(this.nativeEl,e)}get activeChapter(){return Ry(this.nativeEl)}get chapters(){return Hx(this.nativeEl)}getStartDate(){return Kx(this.nativeEl,this._hls)}get currentPdt(){return Vx(this.nativeEl,this._hls)}get preferPlayback(){let e=this.getAttribute(C.PREFER_PLAYBACK);if(e===Yi.MSE||e===Yi.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===Yi.MSE||e===Yi.NATIVE?this.setAttribute(C.PREFER_PLAYBACK,e):this.removeAttribute(C.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(e=>e.startsWith("metadata-")&&![C.METADATA_URL].includes(e)).reduce((e,t)=>{let s=this.getAttribute(t);return s!=null&&(e[t.replace(/^metadata-/,"").replace(/-/g,"_")]=s),e},{}),...Et(this,ga)}}set metadata(e){Jt(this,ga,e??{}),this.mux&&this.mux.emit("hb",Et(this,ga))}get _hlsConfig(){return Et(this,Tl)}set _hlsConfig(e){Jt(this,Tl,e)}get logo(){var e;return(e=this.getAttribute(C.LOGO))!=null?e:Et(this,va)}set logo(e){e?this.setAttribute(C.LOGO,e):this.removeAttribute(C.LOGO)}load(){Jt(this,xi,vk(this,this.nativeEl,Et(this,xi)))}unload(){Py(this.nativeEl,Et(this,xi),this),Jt(this,xi,void 0)}attributeChangedCallback(e,t,s){var r,n;switch(Go.observedAttributes.includes(e)&&!["src","autoplay","preload"].includes(e)&&super.attributeChangedCallback(e,t,s),e){case C.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=s??void 0;break;case C.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=s??void 0;break;case"src":{let a=!!t,o=!!s;!a&&o?Ko(this,jr,Ea).call(this):a&&!o?this.unload():a&&o&&(this.unload(),Ko(this,jr,Ea).call(this));break}
144case"autoplay":if(s===t)break;(r=Et(this,xi))==null||r.setAutoplay(this.autoplay);break;case"preload":if(s===t)break;(n=Et(this,xi))==null||n.setPreload(s);break;case C.PLAYBACK_ID:this.src=ah(this);break;case C.DEBUG:{let a=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=a);break}case C.METADATA_URL:s&&fetch(s).then(a=>a.json()).then(a=>this.metadata=a).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${s}!`));break;case C.STREAM_TYPE:(s==null||s!==t)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case C.TARGET_LIVE_WINDOW:(s==null||s!==t)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;case C.LOGO:(s==null||s!==t)&&this.updateLogo();break;case C.DISABLE_TRACKING:{if(s==null||s!==t){let a=this.currentTime,o=this.paused;this.unload(),Ko(this,jr,Ea).call(this).then(()=>{this.currentTime=a,o||this.play()})}break}case C.DISABLE_COOKIES:{(s==null||s!==t)&&this.disableCookies&&document.cookie.split(";").forEach(a=>{a.trim().startsWith("muxData")&&(document.cookie=a.replace(/^ +/,"").replace(/=.*/,"=;expires="+new Date().toUTCString()+";path=/"))});break}}}updateLogo(){if(!this.shadowRoot)return;let e=this.shadowRoot.querySelector('slot[name="logo"]');if(!e)return;let t=this.constructor.getLogoHTML(Et(this,va)||this.logo);e.innerHTML=t}connectedCallback(){var e;(e=super.connectedCallback)==null||e.call(this),this.nativeEl&&this.src&&!Et(this,xi)&&Ko(this,jr,Ea).call(this)}disconnectedCallback(){this.unload()}handleEvent(e){e.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(e.type,{composed:!0,detail:e.detail}))}};xi=new WeakMap,pa=new WeakMap,El=new WeakMap,ga=new WeakMap,yl=new WeakMap,Tl=new WeakMap,bl=new WeakMap,_l=new WeakMap,Al=new WeakMap,va=new WeakMap,jr=new WeakSet,Ea=async function(){Et(this,pa)||(await Jt(this,pa,Promise.resolve()),Jt(this,pa,null),this.load())};const Tr=new WeakMap;class gc extends Error{}class $k extends Error{}const Fk=["application/x-mpegURL","application/vnd.apple.mpegurl","audio/mpegurl"],Bk=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 Hk(i){globalThis.chrome?.cast?.isAvailable?globalThis.cast?.framework?i():customElements.whenDefined("google-cast-button").then(i):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(i)}}function Gk(){return globalThis.chrome}function Kk(){const i="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";if(globalThis.chrome?.cast||document.querySelector(`script[src="${i}"]`))return;const e=document.createElement("script");e.src=i,document.head.append(e)}function Fs(){return globalThis.cast?.framework?.CastContext.getInstance()}function um(){return Fs()?.getCurrentSession()}function cm(){return um()?.getSessionObj().media[0]}function Vk(i){return new Promise((e,t)=>{cm().editTracksInfo(i,e,t)})}function Wk(i){return new Promise((e,t)=>{cm().getStatus(i,e,t)})}function t0(i){return Fs().setOptions({...Vy(),...i})}function Vy(){return{receiverApplicationId:"CC1AD845",autoJoinPolicy:"origin_scoped",androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0}}function qk(i){if(!i)return;const e=/\.([a-zA-Z0-9]+)(?:\?.*)?$/,t=i.match(e);return t?t[1]:null}function Yk(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 jk(i){return i.split(`
146`).find(s=>!s.trim().startsWith("#")&&s.trim()!=="")}async function zk(i){try{const t=(await fetch(i,{method:"HEAD"})).headers.get("Content-Type");return Fk.some(s=>t===s)}catch(e){return console.error("Error while trying to get the Content-Type of the manifest",e),!1}}async function Qk(i){try{const e=await(await fetch(i)).text();let t=e;const s=Yk(e);if(s.length>0){const a=new URL(s[0],i).toString();
146t=await(await fetch(a)).text()}const r=jk(t);return qk(r)}catch(e){console.error("Error while trying to parse the manifest playlist",e);return}}const Sl=new Bk,bs=new WeakSet;let lt;Hk(()=>{if(!globalThis.chrome?.cast?.isAvailable){console.debug("chrome.cast.isAvailable",globalThis.chrome?.cast?.isAvailable);return}lt||(lt=cast.framework,Fs().addEventListener(lt.CastContextEventType.CAST_STATE_CHANGED,i=>{Sl.forEach(e=>Tr.get(e).onCastStateChanged?.(i))}),Fs().addEventListener(lt.CastContextEventType.SESSION_STATE_CHANGED,i=>{Sl.forEach(e=>Tr.get(e).onSessionStateChanged?.(i))}),Sl.forEach(i=>Tr.get(i).init?.()))});let i0=0;class Xk extends EventTarget{#e;#s;#i;#r;#t="disconnected";#a=!1;#n=new Set;#l=new WeakMap;constructor(e){super(),this.#e=e,Sl.add(this),Tr.set(this,{init:()=>this.#h(),onCastStateChanged:()=>this.#u(),onSessionStateChanged:()=>this.#m(),getCastPlayer:()=>this.#o}),this.#h()}get#o(){if(bs.has(this.#e))return this.#i}get state(){return this.#t}async watchAvailability(e){if(this.#e.disableRemotePlayback)throw new gc("disableRemotePlayback attribute is present.");return this.#l.set(e,++i0),this.#n.add(e),queueMicrotask(()=>e(this.#c())),i0}async cancelWatchAvailability(e){if(this.#e.disableRemotePlayback)throw new gc("disableRemotePlayback attribute is present.");e?this.#n.delete(e):this.#n.clear()}async prompt(){if(this.#e.disableRemotePlayback)throw new gc("disableRemotePlayback attribute is present.");if(!globalThis.chrome?.cast?.isAvailable)throw new $k("The RemotePlayback API is disabled on this platform.");const e=bs.has(this.#e);bs.add(this.#e),t0(this.#e.castOptions),Object.entries(this.#r).forEach(([t,s])=>{this.#i.controller.addEventListener(t,s)});try{await Fs().requestSession()}catch(t){if(e||bs.delete(this.#e),t==="cancel")return;throw new Error(t)}Tr.get(this.#e)?.loadOnPrompt?.()}#d(){bs.has(this.#e)&&(Object.entries(this.#r).forEach(([e,t])=>{this.#i.controller.removeEventListener(e,t)}),bs.delete(this.#e),this.#e.muted=this.#i.isMuted,this.#e.currentTime=this.#i.savedPlayerState.currentTime,this.#i.savedPlayerState.isPau
146sed===!1&&this.#e.play())}#c(){const e=Fs()?.getCastState();return e&&e!=="NO_DEVICES_AVAILABLE"}#u(){const e=Fs().getCastState();if(bs.has(this.#e)&&e==="CONNECTING"&&(this.#t="connecting",this.dispatchEvent(new Event("connecting"))),!this.#a&&e?.includes("CONNECT")){this.#a=!0;for(let t of this.#n)t(!0)}else if(this.#a&&(!e||e==="NO_DEVICES_AVAILABLE")){this.#a=!1;for(let t of this.#n)t(!1)}}async#m(){const{SESSION_RESUMED:e}=lt.SessionState;if(Fs().getSessionState()===e&&this.#e.castSrc===cm()?.media.contentId){bs.add(this.#e),Object.entries(this.#r).forEach(([t,s])=>{this.#i.controller.addEventListener(t,s)});try{await Wk(new chrome.cast.media.GetStatusRequest)}catch(t){console.error(t)}this.#r[lt.RemotePlayerEventType.IS_PAUSED_CHANGED](),this.#r[lt.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}}#h(){!lt||this.#s||(this.#s=!0,t0(this.#e.castOptions),this.#e.textTracks.addEventListener("change",()=>this.#f()),this.#u(),this.#i=new lt.RemotePlayer,new lt.RemotePlayerController(this.#i),this.#r={[lt.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:e})=>{e===!0?(this.#t="connected",this.dispatchEvent(new Event("connect"))):(this.#d(),this.#t="disconnected",this.dispatchEvent(new Event("disconnect")))},[lt.RemotePlayerEventType.DURATION_CHANGED]:()=>{this.#e.dispatchEvent(new Event("durationchange"))},[lt.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{this.#e.dispatchEvent(new Event("volumechange"))},[lt.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{this.#e.dispatchEvent(new Event("volumechange"))},[lt.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{this.#o?.isMediaLoaded&&this.#e.dispatchEvent(new Event("timeupdate"))},[lt.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{this.#e.dispatchEvent(new Event("resize"))},[lt.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{this.#e.dispatchEvent(new Event(this.paused?"pause":"play"))},[lt.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{this.#o?.playerState!==chrome.cast.media.PlayerState.PAUSED&&this.#e.dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[this.#o?.playerState]))},[lt.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{this.#o?.isMediaLoaded&&(await Promise.resolve(),this.#p())}})}#p(){this.#f()}async#f(){if(!this.#o)return;const t=(this.#i.mediaInfo?.tracks??[]).filter(({type:c})=>c===chrome.cast.media.TrackType.TEXT),s=[...this.#e.textTracks].filter(({kind:c})=>c==="subtitles"||c==="captions"),r=t.map(({language:c,name:h,trackId:f})=>{const{mode:m}=s.find(p=>p.language===c&&p.label===h)??{};return m?{mode:m,trackId:f}:!1}).filter(Boolean),a=r.filter(({mode:c})=>c!=="showing").map(({trackId:c})=>c),o=r.find(({mode:c})=>c==="showing"),l=um()?.getSessionObj().media[0]?.activeTrackIds??[];let d=l;if(l.length&&(d=d.filter(c=>!a.includes(c))),o?.trackId&&(d=[...d,o.trackId]),d=[...new Set(d)],!((c,h)=>c.length===h.length&&c.every(f=>h.includes(f)))(l,d))try{const c=new chrome.cast.media.EditTracksInfoRequest(d);await Vk(c)}catch(c){console.error(c)}}}const Zk=i=>class extends i{static observedAttributes=[...i.observedAttributes??[],"cast-src","cast-content-type","cast-stream-type","cast-receiver"];#e={paused:!1};#s=Vy();#i;#r;get remote(){return this.#r?this.#r:Gk()?(this.disableRemotePlayback||Kk(),Tr.set(this,{loadOnPrompt:()=>this.#a()}),this.#r=new Xk(this)):super.remote}get#t(){return Tr.get(this.remote)?.getCastPlayer?.()}attributeChangedCallback(t,s,r){if(super.attributeChangedCallback(t,s,r),t==="cast-receiver"&&r){this.#s.receiverApplicationId=r;return}if(this.#t)switch(t){case"cast-stream-type":case"cast-src":this.load();break}}async#a(){this.#e.paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(t){console.error(t)}}async load(){if(!this.#t)return super.load();const t=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType);t.customData=this.castCustomData;const s=[...this.querySelectorAll("track")].filter(({kind:o,src:l})=>l&&(o==="subtitles"||o==="captions")),r=[];let n=0;if(s.length&&(t.tracks=s.map(o=>{const l=++n;r.length===0&&o.track.mode==="showing"&&r.push(l);const d=new chrome.cast.media.Track(l,chrome.cast.media.TrackType.TEXT);return d.trackContentId=o.src,d.trackContentType="text/vtt",d.subtype=o.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,d.name=o.label,d.language=o.srclang,d})),this.castStreamType==="live"?t.streamType=chrome.cast.media.StreamType.LIVE:t.streamType=chrome.cast.media.StreamType.BUFFERED,t.metadata=new chrome.cast.media.GenericMediaMetadata,t.metadata.title=this.title,t.metadata.images=[{url:this.poster}],zk(this.castSrc)){const o=await Qk(this.castSrc);o?.includes("m4s")||o?.includes("mp4")?(t.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.FMP4,t.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.FMP4):o?.includes("ts")&&(t.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.TS,t.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.TS)}const a=new chrome.cast.media.LoadRequest(t);a.currentTime=super.currentTime??0,a.autoplay=!this.#e.paused,a.activeTrackIds=r,await um()?.loadMedia(a),this.dispatchEvent(new Event("volumechange"))}play(){if(this.#t){this.#t.isPaused&&this.#t.controller?.playOrPause();return}return super.play()}pause(){if(this.#t){this.#t.isPaused||this.#t.controller?.playOrPause();return}super.pause()}get castOptions(){return this.#s}get castReceiver(){return this.getAttribute("cast-receiver")??void 0}set castReceiver(t){this.castReceiver!=t&&this.setAttribute("cast-receiver",`${t}`)}get castSrc(){return this.getAttribute("cast-src")??this.querySelector("source")?.src??this.currentSrc}set castSrc(t){this.castSrc!=t&&this.setAttribute("cast-src",`${t}`)}get castContentType(){return this.getAttribute("cast-content-type")??void 0}set castContentType(t){this.setAttribute("cast-content-type",`${t}`)}get castStreamType(){return this.getAttribute("cast-stream-type")??this.streamType??void 0}set castStreamType(t){this.setAttribute("cast-stream-type",`${t}`)}get castCustomData(){return this.#i}set castCustomData(t){const s=typeof t;if(!["object","undefined"].includes(s)){console.error(`castCustomData must be nullish or an object but value was of type ${s}`);return}this.#i=t}get readyState(){if(this.#t)switch(this.#t.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 this.#t?this.#t.isPaused:super.paused}get muted(){return this.#t?this.#t?.isMuted:super.muted}set muted(t){if(this.#t){(t&&!this.#t.isMuted||!t&&this.#t.isMuted)&&this.#t.controller?.muteOr
146Unmute();return}super.muted=t}get volume(){return this.#t?this.#t?.volumeLevel??1:super.volume}set volume(t){if(this.#t){this.#t.volumeLevel=+t,this.#t.controller?.setVolumeLevel();return}super.volume=t}get duration(){return this.#t&&this.#t?.isMediaLoaded?this.#t?.duration??NaN:super.duration}get currentTime(){return this.#t&&this.#t?.isMediaLoaded?this.#t?.currentTime??0:super.currentTime}set currentTime(t){if(this.#t){this.#t.currentTime=t,this.#t.controller?.seek();return}super.currentTime=t}};class Eu extends Event{track;constructor(e,t){super(e),this.track=t.track}}const uh=new WeakMap;function Z(i){return uh.get(i)??Jk(i,{})}function Jk(i,e){let t=uh.get(i);return t||uh.set(i,t={}),Object.assign(t,e)}function ch(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 fh.prototype||Object.defineProperty(fh.prototype,r,{get(){return[...Z(this).trackSet][r]}}),queueMicrotask(()=>{t.dispatchEvent(new Eu("addtrack",{track:e}))})}function hh(i){const e=Z(i).media?.videoTracks;if(!e)return;Z(e).trackSet.delete(i),queueMicrotask(()=>{e.dispatchEvent(new Eu("removetrack",{track:i}))})}function eD(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"))})}}
146class fh extends EventTarget{#e;#s;#i;constructor(){super(),Z(this).trackSet=new Set}get#r(){return Z(this).trackSet}[Symbol.iterator](){return this.#r.values()}get length(){return this.#r.size}getTrackById(e){return[...this.#r].find(t=>t.id===e)??null}get selectedIndex(){return[...this.#r].findIndex(e=>e.selected)}get onaddtrack(){return this.#e}set onaddtrack(e){this.#e&&(this.removeEventListener("addtrack",this.#e),this.#e=void 0),typeof e=="function"&&(this.#e=e,this.addEventListener("addtrack",e))}get onremovetrack(){return this.#s}set onremovetrack(e){this.#s&&(this.removeEventListener("removetrack",this.#s),this.#s=void 0),typeof e=="function"&&(this.#s=e,this.addEventListener("removetrack",e))}get onchange(){return this.#i}set onchange(e){this.#i&&(this.removeEventListener("change",this.#i),this.#i=void 0),typeof e=="function"&&(this.#i=e,this.addEventListener("change",e))}}class yu extends Event{rendition;constructor(e,t){super(e),this.rendition=t.rendition}}function tD(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 mh.prototype||Object.defineProperty(mh.prototype,r,{get(){return zr(this)[r]}}),queueMicrotask(()=>{i.selected&&t.dispatchEvent(new yu("addrendition",{rendition:e}))})}function iD(i){const e=Z(i).media.videoRenditions,t=Z(i).track;Z(t).renditionSet.delete(i),queueMicrotask(()=>{Z(i).track.selected&&e.dispatchEvent(new yu("removerendition",{rendition:i}))})}function sD(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 zr(i){return[...Z(i).media.videoTracks].filter(t=>t.selected).flatMap(t=>[...Z(t).renditionSet])}class mh extends EventTarget{#e;#s;#i;[Symbol.iterator](){return zr(this).values()}get length(){return zr(this).length}getRenditionById(e){return zr(this).find(t=>`${t.id}`==`${e}`)??null}get selectedIndex(){return zr(this).findIndex(e=>e.selected)}set selectedIndex(e){for(const[t,s]of zr(this).entries())s.selected=t===e}get onaddrendition(){return this.#e}set onaddrendition(e){this.#e&&(this.removeEventListener("addrendition",this.#e),this.#e=void 0),typeof e=="function"&&(this.#e=e,this.addEventListener("addrendition",e))}get onremoverendition(){return this.#s}set onremoverendition(e){this.#s&&(this.removeEventListener("removerendition",this.#s),this.#s=void 0),typeof e=="function"&&(this.#s=e,this.addEventListener("removerendition",e))}get onchange(){return this.#i}set onchange(e){this.#i&&(this.removeEventListener("change",this.#i),this.#i=void 0),typeof e=="function"&&(this.#i=e,this.addEventListener("change",e))}}class rD{src;id;width;height;bitrate;frameRate;codec;#e=!1;get selected(){return this.#e}set selected(e){this.#e!==e&&(this.#e=e,sD(this))}}class Wy{id;kind;label="";language="";sourceBuffer;#e=!1;addRendition(e,t,s,r,n,a){const o=new rD;return o.src=e,o.width=t,o.height=s,o.frameRate=a,o.bitrate=n,o.codec=r,tD(this,o),o}removeRendition(e){iD(e)}get selected(){return this.#e}set selected(e){this.#e!==e&&(this.#e=e,e===!0&&eD(this))}}function nD(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 ph.prototype||Object.defineProperty(ph.prototype,r,{get(){return Qr(this)[r]}}),queueMicrotask(()=>{i.enabled&&t.dispatchEvent(new yu("addrendition",{rendition:e}))})}function aD(i){const e=Z(i).media.audioRenditions,t=Z(i).track;Z(t).renditionSet.delete(i),queueMicrotask(()=>{Z(i).track.enabled&&e.dispatchEvent(new yu("removerendition",{rendition:i}))})}function oD(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 Qr(i){return[...Z(i).media.audioTracks].filter(t=>t.enabled).flatMap(t=>[...Z(t).renditionSet])}class ph extends EventTarget{#e;#s;#i;[Symbol.iterator](){return Qr(this).values()}get length(){return Qr(this).length}getRenditionById(e){return Qr(this).find(t=>`${t.id}`==`${e}`)??null}get selectedIndex(){return Qr(this).findIndex(e=>e.selected)}set selectedIndex(e){for(const[t,s]of Qr(this).entries())s.selected=t===e}get onaddrendition(){return this.#e}set onaddrendition(e){this.#e&&(this.removeEventListener("addrendition",this.#e),this.#e=void 0),typeof e=="function"&&(this.#e=e,this.addEventListener("addrendition",e))}get onremoverendition(){return this.#s}set onremoverendition(e){this.#s&&(this.removeEventListener("removerendition",this.#s),this.#s=void 0),typeof e=="function"&&(this.#s=e,this.addEventListener("removerendition",e))}get onchange(){return this.#i}set onchange(e){this.#i&&(this.removeEventListener("change",this.#i),this.#i=void 0),typeof e=="function"&&(this.#i=e,this.addEventListener("change",e))}}class lD{src;id;bitrate;codec;#e=!1;get selected(){return this.#e}set selected(e){this.#e!==e&&(this.#e=e,oD(this))}}function gh(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;
146r in Eh.prototype||Object.defineProperty(Eh.prototype,r,{get(){return[...Z(this).trackSet][r]}}),queueMicrotask(()=>{t.dispatchEvent(new Eu("addtrack",{track:e}))})}function vh(i){const e=Z(i).media?.audioTracks;if(!e)return;Z(e).trackSet.delete(i),queueMicrotask(()=>{e.dispatchEvent(new Eu("removetrack",{track:i}))})}function dD(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"))}))}class Eh extends EventTarget{#e;#s;#i;constructor(){super(),Z(this).trackSet=new Set}get#r(){return Z(this).trackSet}[Symbol.iterator](){return this.#r.values()}get length(){return this.#r.size}getTrackById(e){return[...this.#r].find(t=>t.id===e)??null}get onaddtrack(){return this.#e}set onaddtrack(e){this.#e&&(this.removeEventListener("addtrack",this.#e),this.#e=void 0),typeof e=="function"&&(this.#e=e,this.addEventListener("addtrack",e))}get onremovetrack(){return this.#s}set onremovetrack(e){this.#s&&(this.removeEventListener("removetrack",this.#s),this.#s=void 0),typeof e=="function"&&(this.#s=e,this.addEventListener("removetrack",e))}get onchange(){return this.#i}set onchange(e){this.#i&&(this.removeEventListener("change",this.#i),this.#i=void 0),typeof e=="function"&&(this.#i=e,this.addEventListener("change",e))}}class qy{id;kind;label="";language="";sourceBuffer;#e=!1;addRendition(e,t,s){const r=new lD;return r.src=e,r.codec=t,r.bitrate=s,nD(this,r),r}removeRendition(e){aD(e)}get enabled(){return this.#e}set enabled(e){this.#e!==e&&(this.#e=e,dD(this))}}const s0=Bd(globalThis.HTMLMediaElement,"video"),r0=Bd(globalThis.HTMLMediaElement,"audio");function uD(i){if(!i?.prototype)return i;const e=Bd(i,"video");(!e||`${e}`.includes("[native code]"))&&Object.defineProperty(i.prototype,"videoTracks",{get(){return cD(this)}});const t=Bd(i,"audio");(!t||`${t}`.includes("[native code]"))&&Object.defineProperty(i.prototype,"audioTracks",{get(){return hD(this)}}),"addVideoTrack"in i.prototype||(i.prototype.addVideoTrack=function(n,a="",o=""){const l=new Wy;return l.kind=n,l.label=a,l.language=o,ch(this,l),l}),"removeVideoTrack"in i.prototype||(i.prototype.removeVideoTrack=hh),"addAudioTrack"in i.prototype||(i.prototype.addAudioTrack=function(n,a="",o=""){const l=new qy;return l.kind=n,l.label=a,l.language=o,gh(this,l),l}),"removeAudioTrack"in i.prototype||(i.prototype.removeAudioTrack=vh),"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 mh,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 ph,Z(a).media=n,Z(n).audioRenditions=a),a};return i}function Bd(i,e){if(i?.prototype)return Object.getOwnPropertyDescriptor(i.prototype,`${e}Tracks`)?.get}function cD(i){let e=Z(i).videoTracks;if(!e&&(e=new fh,Z(i).videoTracks=e,s0)){const t=s0.call(i.nativeEl??i);for(const s of t)ch(i,s);t.addEventListener("change",()=>{e.dispatchEvent(new Event("change"))}),t.addEventListener("addtrack",s=>{if([...e].some(r=>r instanceof Wy)){for(const r of t)hh(r);return}ch(i,s.track)}),t.addEventListener("removetrack",s=>{hh(s.track)})}return e}function hD(i){let e=Z(i).audioTracks;
146if(!e&&(e=new Eh,Z(i).audioTracks=e,r0)){const t=r0.call(i.nativeEl??i);for(const s of t)gh(i,s);t.addEventListener("change",()=>{e.dispatchEvent(new Event("change"))}),t.addEventListener("addtrack",s=>{if([...e].some(r=>r instanceof qy)){for(const r of t)vh(r);return}gh(i,s.track)}),t.addEventListener("removetrack",s=>{vh(s.track)})}return e}var Yy=i=>{throw TypeError(i)},jy=(i,e,t)=>e.has(i)||Yy("Cannot "+t),fD=(i,e,t)=>(jy(i,e,"read from private field"),t?t.call(i):e.get(i)),mD=(i,e,t)=>e.has(i)?Yy("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),pD=(i,e,t,s)=>(jy(i,e,"write to private field"),e.set(i,t),t),zy=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment>"u"){class i extends zy{}globalThis.DocumentFragment=i}var gD=class extends zy{},vD={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(gD)}},ED={customElements:vD},yD=typeof window>"u"||typeof globalThis.customElements>"u",vc=yD?ED:globalThis,Il,n0=class extends Zk(uD(Uk)){constructor(){super(...arguments),mD(this,Il)}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=fD(this,Il))!=null?i:this.muxCastCustomData}set castCustomData(i){pD(this,Il,i)}};Il=new WeakMap;vc.customElements.get("mux-video")||(vc.customElements.define("mux-video",n0),vc.MuxVideoElement=n0);const q={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_LOOP_REQUEST:"medialooprequest",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"},Ae={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},Qy={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_LOOP:"mediaLoop",MEDIA_PAUSED:"mediaPaused",MEDIA_PIP_UNAVAILABLE:"mediaPipUnavailable",MEDIA_PLAYBACK_RATE:"mediaPlaybackRate",MEDIA_PREVIEW_CHAPTER:"mediaPreviewChapter",MEDIA_PREVIEW_COORDS:"mediaPreviewCoords",MEDIA_PREVIEW_IMAGE:"mediaPreviewImage",MEDIA_PREVIEW_TIME:"mediaPreviewTime",MEDIA_RENDITION_LIST:"mediaRenditionList",MEDIA_RENDITION_SELECTED:"mediaRenditionSelected",MEDIA_RENDITION_UNAVAILABLE:"mediaRenditionUnavailable",MEDIA_SEEKABLE:"mediaSeekable",MEDIA_STREAM_TYPE:"mediaStreamType",MEDIA_SUBTITLES_LIST:"mediaSubtitlesList",MEDIA_SUBTITLES_SHOWING:"mediaSubtitlesShowing",MEDIA_TARGET_LIVE_WINDOW:"mediaTargetLiveWindow",MEDIA_TIME_IS_LIVE:"mediaTimeIsLive",MEDIA_VOLUME:"mediaVolume",MEDIA_VOLUME_LEVEL:"mediaVolumeLevel",MEDIA_VOLUME_UNAVAILABLE:"mediaVolumeUnavailable",MEDIA_LANG:"mediaLang",MEDIA_WIDTH:"mediaWidth"},Xy=Object.entries(Qy),_=Xy.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{}),TD={USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"},ps=Xy.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{...TD});Object.entries(ps).reduce((i,[e,t])=>{const s=_[e];return s&&(i[t]=s),i},{userinactivechange:"userinactive"});const bD=Object.entries(_).reduce((i,[e,t])=>{const s=ps[e];return s&&(i[t]=s),i},{userinactive:"userinactivechange"}),Qi={SUBTITLES:"subtitles",CAPTIONS:"captions",CHAPTERS:"chapters",METADATA:"metadata"},Dn={DISABLED:"disabled",SHOWING:"showing"},Ec={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},Nt={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},ds={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"},_D={FULLSCREEN:"fullscreen"};function AD(i){return i?.map(ID).join(" ")}function SD(i){return i?.split(/\s+/).map(LD)}function ID(i){if(i){const{id:e,width:t,height:s}=i;return[e,t,s].filter(r=>r!=null).join(":")}}function LD(i){if(i){const[e,t,s]=i.split(":");return{id:e,width:+t,height:+s}}}function RD(i){return i?.map(kD).join(" ")}function xD(i){return i?.split(/\s+/).map(DD)}function kD(i){if(i){const{id:e,kind:t,language:s,label:r}=i;return[e,t,s,r].filter(n=>n!=null).join(":")}}function DD(i){if(i){const[e,t,s,r]=i.split(":");return{id:e,kind:t,language:s,label:r}}}function CD(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function hm(i){return typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i)}function Zy(i){return typeof i!="string"?!1:!isNaN(i)&&!isNaN(parseFloat(i))}const Jy=i=>new Promise(e=>setTimeout(e,i)),a0=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],wD=(i,e)=>{const t=i===1?a0[e].singular:a0[e].plural;return`${i} ${t}`},Ha=i=>{if(!hm(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&&wD(o,l)).filter(o=>o).join(", ")}${t?" remaining":""}`};function Gs(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 MD={"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",Loop:"Loop","Enter picture in picture mode":"Enter picture in picture mode","Exit picture in picture mode":"Exit picture in picture mode",Play:"Play",Pause:"Pause","Playback rate":"Playback rate","Playback rate {playbackRate}":"Playback rate {playbackRate}",Quality:"Quality","Seek backward":"Seek backward","Seek forward":"Seek forward",Settings:"Settings",Auto:"Auto","audio player":"audio player","video player":"video player",volume:"volume",seek:"seek","closed captions":"closed captions","current playback rate":"current playback rate","playback time":"playback time","media loading":"media loading",settings:"settings","audio tracks":"audio tracks",quality:"quality",play:"play",pause:"pause",mute:"mute",unmute:"unmute","chapter: {chapterName}":"chapter: {chapterName}",live:"live",Off:"Off","start airplay":"start airplay","stop airplay":"stop airplay","start casting":"start casting","stop casting":"stop casting","enter fullscreen mode":"enter fullscreen mode","exit fullscreen mode":"exit fullscreen mode","enter picture in picture mode":"enter picture in picture mode","exit picture in picture mode":"exit picture in picture mode","seek to live":"seek to live","playing live":"playing live","seek back {seekOffset} seconds":"seek back {seekOffset} seconds","seek forward {seekOffset} seconds":"seek forward {seekOffset} seconds","Network Error":"Network Error","Decode Error":"Decode Error","S
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 o0;const yc={en:MD};let yh=((o0=globalThis.navigator)==null?void 0:o0.language)||"en";const PD=i=>{yh=i},OD=i=>{var e,t,s;const[r]=yh.split("-");return((e=yc[yh])==null?void 0:e[i])||((t=yc[r])==null?void 0:t[i])||((s=yc.en)==null?void 0:s[i])||i},J=(i,e={})=>OD(i).replace(/\{(\w+)\}/g,(t,s)=>s in e?String(e[s]):`{${s}}`);let eT=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}};class tT extends eT{}let l0=class extends tT{constructor(){super(...arguments),this.role=null}};class ND{observe(){}unobserve(){}disconnect(){}}const iT={createElement:function(){return new no.HTMLElement},createElementNS:function(){return new no.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent(i){return!1}},no={ResizeObserver:ND,document:iT,Node:tT,Element:l0,HTMLElement:class extends l0{constructor(){super(...arguments),this.innerHTML=""}get content(){return new no.DocumentFragment}},DocumentFragment:class extends eT{},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}}}}},sT="global"in globalThis&&globalThis?.global===globalThis||typeof window>"u"||typeof window.customElements>"u",rT=Object.keys(no).every(i=>i in globalThis),k=sT&&!rT?no:globalThis,rt=sT&&!rT?iT:globalThis.document,d0=new WeakMap,fm=i=>{let e=d0.get(i);return e||d0.set(i,e=new Set),e},nT=new k.ResizeObserver(i=>{for(const e of i)for(const t of fm(e.target))t(e)});function Hn(i,e){fm(i).add(e),nT.observe(i)}function Gn(i,e){const t=fm(i);t.delete(e),t.size||nT.unobserve(i)}function jt(i){const e={};for(const t of i)e[t.name]=t.value;return e}function wt(i){var e;return(e=Th(i))!=null?e:Yn(i,"media-controller")}function Th(i){var e;const{MEDIA_CONTROLLER:t}=Ae,s=i.getAttribute(t);if(s)return(e=Tu(i))==null?void 0:e.getElementById(s)}const aT=(i,e,t=".value")=>{const s=i.querySelector(t);s&&(s.textContent=e)},UD=(i,e)=>{const t=`slot[name="${e}"]`,s=i.shadowRoot.querySelector(t);return s?s.children:[]},oT=(i,e)=>UD(i,e)[0],vs=(i,e)=>!i||!e?!1:i?.contains(e)?!0:vs(i,e.getRootNode().host),Yn=(i,e)=>{if(!i)return null;const t=i.closest(e);return t||Yn(i.getRootNode().host,e)};function mm(i=document){var e;const t=i?.activeElement;return t?(e=mm(t.shadowRoot))!=null?e:t:null}function Tu(i){var e;const t=(e=i?.getRootNode)==null?void 0:e.call(i);return t instanceof ShadowRoot||t instanceof Document?t:null}function lT(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 $D(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 ct(i,e){const t=FD(i,s=>s===e);return t||pm(i,e)}function FD(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 pm(i,e){var t,s;const r=(t=i.querySelectorAll("style:not([media])"))!=null?t:[],n=r?.[r.length-1];return n?.sheet?(n?.sheet.insertRule(`${e}{}`,n.sheet.cssRules.length),(s=n.sheet.cssRules)==null?void 0:s[n.sheet.cssRules.length-1]):(console.warn("Media Chrome: No style sheet found on style tag of",i),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}})}function Oe(i,e,t=Number.NaN){const s=i.getAttribute(e);return s!=null?+s:t}function Ye(i,e,t){const s=+t;if(t==null||Number.isNaN(s)){i.hasAttribute(e)&&i.removeAttribute(e);return}Oe(i,e,void 0)!==s&&i.setAttribute(e,`${s}`)}function ve(i,e){return i.hasAttribute(e)}function Ee(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}ve(i,e)!=t&&i.toggleAttribute(e,t)}function Ne(i,e,t=null){var s;return(s=i.getAttribute(e))!=null?s:t}function Ue(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}const s=`${t}`;Ne(i,e,void 0)!==s&&i.setAttribute(e,s)}
vendor: 6,199 bytes, lines 146-252
146var dT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},_s=(i,e,t)=>(dT(i,e,"read from private field"),t?t.call(i):e.get(i)),BD=(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)},Vo=(i,e,t,s)=>(dT(i,e,"write to private field"),e.set(i,t),t),kt;function HD(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 bu extends k.HTMLElement{constructor(){if(super(),BD(this,kt,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=jt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Ae.MEDIA_CONTROLLER,_.MEDIA_PAUSED]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Ae.MEDIA_CONTROLLER&&(t&&((n=(r=_s(this,kt))==null?void 0:r.unassociateElement)==null||n.call(r,this),Vo(this,kt,null)),s&&this.isConnected&&(Vo(this,kt,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=_s(this,kt))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s,r;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),Vo(this,kt,GD(this)),this.getAttribute(Ae.MEDIA_CONTROLLER)&&((t=(e=_s(this,kt))==null?void 0:e.associateElement)==null||t.call(e,this)),(s=_s(this,kt))==null||s.addEventListener("pointerdown",this),(r=_s(this,kt))==null||r.addEventListener("click",this)}disconnectedCallback(){var e,t,s,r;this.getAttribute(Ae.MEDIA_CONTROLLER)&&((t=(e=_s(this,kt))==null?void 0:e.unassociateElement)==null||t.call(e,this)),(s=_s(this,kt))==null||s.removeEventListener("pointerdown",this),(r=_s(this,kt))==null||r.removeEventListener("click",this),Vo(this,kt,null)}handleEvent(e){var t;const s=(t=e.composedPath())==null?void 0:t[0];if(["video","media-controller"].includes(s?.localName)){if(e.type==="pointerdown")this._pointerType=e.pointerType;else if(e.type==="click"){const{clientX:n,clientY:a}=e,{left:o,top:l,width:d,height:u}=this.getBoundingClientRect(),c=n-o,h=a-l;if(c<0||h<0||c>d||h>u||d===0&&u===0)return;const f=this._pointerType||"mouse";if(this._pointerType=void 0,f===Ec.TOUCH){this.handleTap(e);return}else if(f===Ec.MOUSE||f===Ec.PEN){this.handleMouseClick(e);return}}}}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}handleTap(e){}handleMouseClick(e){const t=this.mediaPaused?q.MEDIA_PLAY_REQUEST:q.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new k.CustomEvent(t,{composed:!0,bubbles:!0}))}}kt=new WeakMap;bu.shadowRootOptions={mode:"open"};bu.getTemplateHTML=HD;function GD(i){var e;const t=i.getAttribute(Ae.MEDIA_CONTROLLER);return t?(e=i.getRootNode())==null?void 0:e.getElementById(t):Yn(i,"media-controller")}k.customElements.get("media-gesture-receiver")||k.customElements.define("media-gesture-receiver",bu);var u0=bu,gm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Kt=(i,e,t)=>(gm(i,e,"read from private field"),t?t.call(i):e.get(i)),Ut=(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)},ir=(i,e,t,s)=>(gm(i,e,"write to private field"),e.set(i,t),t),ii=(i,e,t)=>(gm(i,e,"access private method"),t),Hd,Xr,ao,Tn,Ll,bh,uT,ya,Rl,_h,cT,Ah,hT,oo,_u,Au,vm,Kn,lo;const se={AUDIO:"audio",AUTOHIDE:"autohide",BREAKPOINTS:"breakpoints",GESTURES_DISABLED:"gesturesdisabled",KEYBOARD_CONTROL:"keyboardcontrol",NO_AUTOHIDE:"noautohide",USER_INACTIVE:"userinactive",AUTOHIDE_OVER_CONTROLS:"autohideovercontrols"};function KD(i){return`
154    <style>
155      
156      :host([${_.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        overflow: hidden;
167      }
168
169      :host(:not([${se.AUDIO}])) [part~=layer]:not([part~=media-layer]) {
170        position: absolute;
171        top: 0;
172        left: 0;
173        bottom: 0;
174        right: 0;
175        display: flex;
176        flex-flow: column nowrap;
177        align-items: start;
178        pointer-events: none;
179        background: none;
180      }
181
182      slot[name=media] {
183        display: var(--media-slot-display, contents);
184      }
185
186      
187      :host([${se.AUDIO}]) slot[name=media] {
188        display: var(--media-slot-display, none);
189      }
190
191      
192      :host([${se.AUDIO}]) [part~=layer][part~=gesture-layer] {
193        height: 0;
194        display: block;
195      }
196
197      
198      :host(:not([${se.AUDIO}])[${se.GESTURES_DISABLED}]) ::slotted([slot=gestures-chrome]),
199          :host(:not([${se.AUDIO}])[${se.GESTURES_DISABLED}]) media-gesture-receiver[slot=gestures-chrome] {
200        display: none;
201      }
202
203      
204      ::slotted(:not([slot=media]):not([slot=poster]):not(media-loading-indicator):not([role=dialog]):not([hidden])) {
205        pointer-events: auto;
206      }
207
208      :host(:not([${se.AUDIO}])) *[part~=layer][part~=centered-layer] {
209        align-items: center;
210        justify-content: center;
211      }
212
213      :host(:not([${se.AUDIO}])) ::slotted(media-gesture-receiver[slot=gestures-chrome]),
214      :host(:not([${se.AUDIO}])) media-gesture-receiver[slot=gestures-chrome] {
215        align-self: stretch;
216        flex-grow: 1;
217      }
218
219      slot[name=middle-chrome] {
220        display: inline;
221        flex-grow: 1;
222        pointer-events: none;
223        background: none;
224      }
225
226      
227      ::slotted([slot=media]),
228      ::slotted([slot=poster]) {
229        width: 100%;
230        height: 100%;
231      }
232
233      
234      :host(:not([${se.AUDIO}])) .spacer {
235        flex-grow: 1;
236      }
237
238      
239      :host(:-webkit-full-screen) {
240        
241        width: 100% !important;
242        height: 100% !important;
243      }
244
245      
246      ::slotted(:not([slot=media]):not([slot=poster]):not([${se.NO_AUTOHIDE}]):not([hidden]):not([role=dialog])) {
247        opacity: 1;
248        transition: var(--media-control-transition-in, opacity 0.25s);
249      }
250
251      
252      :host([${se.USER_INACTIVE}]:not([${_.MEDIA_PAUSED}]):not([${_.MEDIA_IS_AIRPLAYING}
252]):not([${_.MEDIA_IS_CASTING}]):not([${se.AUDIO}])) ::slotted(:not([slot=media]):not([slot=poster]):not([${se.NO_AUTOHIDE}]):not([role=dialog])) {
253        opacity: 0;
254        transition: var(--media-control-transition-out, opacity 1s);
255      }
256
257      :host([${se.USER_INACTIVE}]:not([${se.NO_AUTOHIDE}]):not([${_.MEDIA_PAUSED}]):not([${_.MEDIA_IS_CASTING}]):not([${se.AUDIO}])) ::slotted([slot=media]) {
258        cursor: none;
259      }
260
261      :host([${se.USER_INACTIVE}][${se.AUTOHIDE_OVER_CONTROLS}]:not([${se.NO_AUTOHIDE}]):not([${_.MEDIA_PAUSED}]):not([${_.MEDIA_IS_CASTING}]):not([${se.AUDIO}])) * {
262        --media-cursor: none;
263        cursor: none;
264      }
265
266
267      ::slotted(media-control-bar)  {
268        align-self: stretch;
269      }
270
271      
272      :host(:not([${se.AUDIO}])[${_.MEDIA_HAS_PLAYED}]) slot[name=poster] {
273        display: none;
274      }
275
276      ::slotted([role=dialog]) {
277        width: 100%;
278        height: 100%;
279        align-self: center;
280      }
281
282      ::slotted([role=menu]) {
283        align-self: end;
284      }
285    </style>
286
287    <slot name="media" part="layer media-layer"></slot>
288    <slot name="poster" part="layer poster-layer"></slot>
289    <slot name="gestures-chrome" part="layer gesture-layer">
290      <media-gesture-receiver slot="gestures-chrome">
291        <template shadowrootmode="${u0.shadowRootOptions.mode}">
292          ${u0.getTemplateHTML({})}
293        </template>
294      </media-gesture-receiver>
295    </slot>
296    <span part="layer vertical-layer">
297      <slot name="top-chrome" part="top chrome"></slot>
298      <slot name="middle-chrome" part="middle chrome"></slot>
299      <slot name="centered-chrome" part="layer centered-layer center centered chrome"></slot>
300      
301      <slot part="bottom chrome"></slot>
302    </span>
303    <slot name="dialog" part="layer dialog-layer"></slot>
304  `}const VD=Object.values(_),WD="sm:384 md:576 lg:768 xl:960";function qD(i){fT(i.target,i.contentRect.width)}function fT(i,e){var t;if(!i.isConnected)return;const s=(t=i.getAttribute(se.BREAKPOINTS))!=null?t:WD,r=YD(s),n=jD(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(ps.BREAKPOINTS_CHANGE,{detail:n});i.dispatchEvent(o)}i.breakpointsComputed||(i.breakpointsComputed=!0,i.dispatchEvent(new CustomEvent(ps.BREAKPOINTS_COMPUTED,{bubbles:!0,composed:!0})))}function YD(i){const e=i.split(/\s+/);return Object.fromEntries(e.map(t=>t.split(":")))}function jD(i,e){return Object.keys(i).filter(t=>e>=parseInt(i[t]))}class Su extends k.HTMLElement{constructor(){if(super(),Ut(this,bh),Ut(this,_h),Ut(this,Ah),Ut(this,oo),Ut(this,Au),Ut(this,Kn),Ut(this,Hd,0),Ut(this,Xr,null),Ut(this,ao,null),Ut(this,Tn,void 0),this.breakpointsComputed=!1,Ut(this,Ll,new MutationObserver(ii(this,bh,uT).bind(this))),Ut(this,ya,!1),Ut(this,Rl,t=>{Kt(this,ya)||(setTimeout(()=>{qD(t),ir(this,ya,!1)},0),ir(this,ya,!0))}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const t=jt(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){Kt(this,Xr)&&this.mediaUnsetCallback(Kt(this,Xr));return}this.handleMediaUpdated(this.media)})}static get observedAttributes(){return[se.AUTOHIDE,se.GESTURES_DISABLED].concat(VD).filter(e=>![_.MEDIA_RENDITION_LIST,_.MEDIA_AUDIO_TRACK_LIST,_.MEDIA_CHAPTERS_CUES,_.MEDIA_WIDTH,_.MEDIA_HEIGHT,_.MEDIA_ERROR,_.MEDIA_ERROR_MESSAGE].includes(e))}attributeChangedCallback(e,t,s){e.toLowerCase()==se.AUTOHIDE&&(this.autohide=s)}get media(){let e=this.querySelector(":scope > [slot=media]");return e?.nodeName=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}async handleMediaUpdated(e){e&&(ir(this,Xr,e),e.localName.includes("-")&&await k.customElements.whenDefined(e.localName),this.mediaSetCallback(e))}connectedCallback(){var e;Kt(this,Ll).observe(this,{childList:!0,subtree:!0}),Hn(this,Kt(this,Rl));const t=this.getAttribute(se.AUDIO)!=null,s=J(t?"audio player":"video player");
vendor: 4,791 bytes, line 304
304this.setAttribute("role","region"),this.setAttribute("aria-label",s),this.handleMediaUpdated(this.media),this.setAttribute(se.USER_INACTIVE,""),fT(this,this.getBoundingClientRect().width),this.addEventListener("pointerdown",this),this.addEventListener("pointermove",this),this.addEventListener("pointerup",this),this.addEventListener("mouseleave",this),this.addEventListener("keyup",this),(e=k.window)==null||e.addEventListener("mouseup",this)}disconnectedCallback(){var e;Kt(this,Ll).disconnect(),Gn(this,Kt(this,Rl)),this.media&&this.mediaUnsetCallback(this.media),(e=k.window)==null||e.removeEventListener("mouseup",this)}mediaSetCallback(e){}mediaUnsetCallback(e){ir(this,Xr,null)}handleEvent(e){switch(e.type){case"pointerdown":ir(this,Hd,e.timeStamp);break;case"pointermove":ii(this,_h,cT).call(this,e);break;case"pointerup":ii(this,Ah,hT).call(this,e);break;case"mouseleave":ii(this,oo,_u).call(this);break;case"mouseup":this.removeAttribute(se.KEYBOARD_CONTROL);break;case"keyup":ii(this,Kn,lo).call(this),this.setAttribute(se.KEYBOARD_CONTROL,"");break}}set autohide(e){const t=Number(e);ir(this,Tn,isNaN(t)?0:t)}get autohide(){return(Kt(this,Tn)===void 0?2:Kt(this,Tn)).toString()}get breakpoints(){return Ne(this,se.BREAKPOINTS)}set breakpoints(e){Ue(this,se.BREAKPOINTS,e)}get audio(){return ve(this,se.AUDIO)}set audio(e){Ee(this,se.AUDIO,e)}get gesturesDisabled(){return ve(this,se.GESTURES_DISABLED)}set gesturesDisabled(e){Ee(this,se.GESTURES_DISABLED,e)}get keyboardControl(){return ve(this,se.KEYBOARD_CONTROL)}set keyboardControl(e){Ee(this,se.KEYBOARD_CONTROL,e)}get noAutohide(){return ve(this,se.NO_AUTOHIDE)}set noAutohide(e){Ee(this,se.NO_AUTOHIDE,e)}get autohideOverControls(){return ve(this,se.AUTOHIDE_OVER_CONTROLS)}set autohideOverControls(e){Ee(this,se.AUTOHIDE_OVER_CONTROLS,e)}get userInteractive(){return ve(this,se.USER_INACTIVE)}set userInteractive(e){Ee(this,se.USER_INACTIVE,e)}}Hd=new WeakMap;Xr=new WeakMap;ao=new WeakMap;Tn=new WeakMap;Ll=new WeakMap;bh=new WeakSet;uT=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)}};ya=new WeakMap;Rl=new WeakMap;_h=new WeakSet;cT=function(i){if(i.pointerType!=="mouse"&&i.timeStamp-Kt(this,Hd)<250)return;ii(this,Au,vm).call(this),clearTimeout(Kt(this,ao));const e=this.hasAttribute(se.AUTOHIDE_OVER_CONTROLS);([this,this.media].includes(i.target)||e)&&ii(this,Kn,lo).call(this)};Ah=new WeakSet;hT=function(i){if(i.pointerType==="touch"){const e=!this.hasAttribute(se.USER_INACTIVE);[this,this.media].includes(i.target)&&e?ii(this,oo,_u).call(this):ii(this,Kn,lo).call(this)}else i.composedPath().some(e=>["media-play-button","media-fullscreen-button"].includes(e?.localName))&&ii(this,Kn,lo).call(this)};oo=new WeakSet;_u=function(){if(Kt(this,Tn)<0||this.hasAttribute(se.USER_INACTIVE))return;this.setAttribute(se.USER_INACTIVE,"");const i=new k.CustomEvent(ps.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(i)};Au=new WeakSet;vm=function(){if(!this.hasAttribute(se.USER_INACTIVE))return;this.removeAttribute(se.USER_INACTIVE);const i=new k.CustomEvent(ps.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(i)};Kn=new WeakSet;lo=function(){ii(this,Au,vm).call(this),clearTimeout(Kt(this,ao));const i=parseInt(this.autohide);i<0||ir(this,ao,setTimeout(()=>{ii(this,oo,_u).call(this)},i*1e3))};Su.shadowRootOptions={mode:"open"};Su.getTemplateHTML=KD;k.customElements.get("media-container")||k.customElements.define("media-container",Su);var mT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},mt=(i,e,t)=>(mT(i,e,"read from private field"),t?t.call(i):e.get(i)),ta=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Wo=(i,e,t,s)=>(mT(i,e,"write to private field"),e.set(i,t),t),Zr,Jr,Gd,mr,ns,Ls;class Em{constructor(e,t,{defaultValue:s}={defaultValue:void 0}){ta(this,ns),ta(this,Zr,void 0),ta(this,Jr,void 0),ta(this,Gd,void 0),ta(this,mr,new Set),Wo(this,Zr,e),Wo(this,Jr,t),Wo(this,Gd,new Set(s))}[Symbol.iterator](){return mt(this,ns,Ls).values()}get length(){return mt(this,ns,Ls).size}get value(){var e;return(e=[...mt(this,ns,Ls)].join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(Wo(this,mr,new Set),this.add(...(t=e?.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return[...mt(this,ns,Ls)][e]}values(){return mt(this,ns,Ls).values()}
304forEach(e,t){mt(this,ns,Ls).forEach(e,t)}add(...e){var t,s;e.forEach(r=>mt(this,mr).add(r)),!(this.value===""&&!((t=mt(this,Zr))!=null&&t.hasAttribute(`${mt(this,Jr)}`)))&&((s=mt(this,Zr))==null||s.setAttribute(`${mt(this,Jr)}`,`${this.value}`))}remove(...e){var t;e.forEach(s=>mt(this,mr).delete(s)),(t=mt(this,Zr))==null||t.setAttribute(`${mt(this,Jr)}`,`${this.value}`)}contains(e){return mt(this,ns,Ls).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}}Zr=new WeakMap;Jr=new WeakMap;Gd=new WeakMap;mr=new WeakMap;ns=new WeakSet;Ls=function(){return mt(this,mr).size?mt(this,mr):mt(this,Gd)};const zD=(i="")=>i.split(/\s+/),pT=(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}},Iu=(i="",e={})=>zD(i).map(t=>{const s=pT(t);return{...e,...s}}),gT=i=>i?Array.isArray(i)?i.map(e=>typeof e=="string"?pT(e):e):typeof i=="string"?Iu(i):[i]:[],Sh=({kind:i,label:e,language:t}={kind:"subtitles"})=>e?`${i==="captions"?"cc":"sb"}:${t}:${encodeURIComponent(e)}`:t,uo=(i=[])=>Array.prototype.map.call(i,Sh).join(" "),QD=(i,e)=>t=>t[i]===e,vT=i=>{const e=Object.entries(i).map(([t,s])=>QD(t,s));return t=>e.every(s=>s(t))},Ga=(i,e=[],t=[])=>{const s=gT(t).map(vT),r=n=>s.some(a=>a(n));Array.from(e).filter(r).forEach(n=>{n.mode=i})},Lu=(i,e=()=>!0)=>{if(!i?.textTracks)return[];const t=typeof e=="function"?e:vT(e);return Array.from(i.textTracks).filter(t)},ET=i=>{var e;return!!((e=i.mediaSubtitlesShowing)!=null&&e.length)||i.hasAttribute(_.MEDIA_SUBTITLES_SHOWING)},XD=i=>{var e;const{media:t,fullscreenElement:s}=i;try{const r=s&&"requestFullscreen"in s?"requestFullscreen":s&&"webkitRequestFullScreen"in s?"webkitRequestFullScreen":void 0;if(r){const n=(e=s[r])==null?void 0:e.call(s);if(n instanceof Promise)return n.catch(()=>{})}else t?.webkitEnterFullscreen?t.webkitEnterFullscreen():t?.requestFullscreen&&t.requestFullscreen()}catch(r){console.error(r)}},c0="exitFullscreen"in rt?"exitFullscreen":"webkitExitFullscreen"in rt?"webkitExitFullscreen":"webkitCancelFullScreen"in rt?"webkitCancelFullScreen":void 0,ZD=i=>{var e;const{documentElement:t}=i;if(c0){const s=(e=t?.[c0])==null?void 0:e.call(t);if(s instanceof Promise)return s.catch(()=>{})}},Ta="fullscreenElement"in rt?"fullscreenElement":"webkitFullscreenElement"in rt?"webkitFullscreenElement":void 0,JD=i=>{const{documentElement:e,media:t}=i,s=e?.[Ta];return!s&&"webkitDisplayingFullscreen"in t&&"webkitPresentationMode"in t&&t.webkitDisplayingFullscreen&&t.webkitPresentationMode===_D.FULLSCREEN?t:s},eC=i=>{var e;const{media:t,documentElement:s,fullscreenElement:r=t}=i;if(!t||!s)return!1;const n=JD(i);if(!n)return!1;if(n===r||n===t)return!0;if(n.localName.includes("-")){let a=n.shadowRoot;if(!(Ta in a))return vs(n,r);for(;a?.[Ta];){if(a[Ta]===r)return!0;a=(e=a[Ta])==null?void 0:e.shadowRoot}}return!1},tC="fullscreenEnabled"in rt?"fullscreenEnabled":"webkitFullscreenEnabled"in rt?"webkitFullscreenEnabled":void 0,iC=i=>{const{documentElement:e,media:t}=i;return!!e?.[tC]||t&&"webkitSupportsFullscreen"in t};let qo;const ym=()=>{var i,e;return qo||(qo=(e=(i=rt)==null?void 0:i.createElement)==null?void 0:e.call(i,"video"),qo)},sC=async(i=ym())=>{if(!i)return!1;const e=i.volume;i.volume=e/2+.1;const t=new AbortController,s=await Promise.race([rC(i,t.signal),nC(i,e)]);return t.abort(),s},rC=(i,e)=>new Promise(t=>{i.addEventListener("volumechange",()=>t(!0),{signal:e})}),nC=async(i,e)=>{for(let t=0;t<10;t++){if(i.volume===e)return!1;await Jy(10)}return i.volume!==e},aC=/.*Version\/.*Safari\/.*/.test(k.navigator.userAgent),yT=(i=ym())=>k.matchMedia("(display-mode: standalone)").matches&&aC?!1:typeof i?.requestPictureInPicture=="function",TT=(i=ym())=>iC({documentElement:rt,media:i}),oC=TT(),lC=yT(),dC=!!k.WebKitPlaybackTargetAvailabilityEvent,uC=!!k.chrome,Kd=i=>Lu(i.media,e=>[Qi.SUBTITLES,Qi.CAPTIONS].includes(e.kind)).sort((e,t)=>e.kind>=t.kind?1:-1),bT=i=>Lu(i.media,e=>e.mode===Dn.SHOWING&&[Qi.SUBTITLES,Qi.CAPTIONS].includes(e.kind)),_T=(i,e)=>{const t=Kd(i),s=bT(i),r=!!s.length;if(t.length){if(e===!1||r&&e!==!0)Ga(Dn.DISABLED,t,s);else if(e===!0||!r&&e!==!1){let n=t[0];const{options:a}=i;if(!a?.noSubtitlesLangPref){const u=globalThis.localStorage.getItem("media-chrome-pref-subtitles-lang"),c=u?[u,...globalThis.navigator.languages]:globalThis.navigator.languages,h=t.filter(f=>c.some(m=>f.language.toLowerCase().startsWith(m.split("-")[0]))).sort((f,m)=>{const 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;Ga(Dn.DISABLED,t,s),Ga(Dn.SHOWING,t,[{language:o,label:l,kind:d}])}}},Tm=(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)?cC(i,e):Object.entries(i).every(([t,s])=>t in e&&Tm(s,e[t])),cC=(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)=>Tm(r,e[n])):!0},hC=Object.values(ds);let Vd;const fC=sC().then(i=>(Vd=i,Vd)),mC=async(...i)=>{await Promise.all(i.filter(e=>e).map(async e=>{if(!("localName"in e&&e instanceof k.HTMLElement))return;const t=e.localName;if(!t.includes("-"))return;const s=k.customElements.get(t);s&&e instanceof s||(await k.customElements.whenDefined(t),k.customElements.upgrade(e))}))},pC=new k.DOMParser,gC=i=>i&&(pC.parseFromString(i,"text/html").body.textContent||i),ba={mediaError:{get(i,e){const{media:t}=i;if(e?.type!=="playing")return t?.error},mediaEvents:["emptied","error","playing"]},mediaErrorCode:{get(i,e){var t;const{media:s}=i;
304if(e?.type!=="playing")return(t=s?.error)==null?void 0:t.code},mediaEvents:["emptied","error","playing"]},mediaErrorMessage:{get(i,e){var t,s;const{media:r}=i;if(e?.type!=="playing")return(s=(t=r?.error)==null?void 0:t.message)!=null?s:""},mediaEvents:["emptied","error","playing"]},mediaWidth:{get(i){var e;const{media:t}=i;return(e=t?.videoWidth)!=null?e:0},mediaEvents:["resize"]},mediaHeight:{get(i){var e;const{media:t}=i;return(e=t?.videoHeight)!=null?e:0},mediaEvents:["resize"]},mediaPaused:{get(i){var e;const{media:t}=i;return(e=t?.paused)!=null?e:!0},set(i,e){var t;const{media:s}=e;s&&(i?s.pause():(t=s.play())==null||t.catch(()=>{}))},mediaEvents:["play","playing","pause","emptied"]},mediaHasPlayed:{get(i,e){const{media:t}=i;return t?e?e.type==="playing":!t.paused:!1},mediaEvents:["playing","emptied"]},mediaEnded:{get(i){var e;const{media:t}=i;return(e=t?.ended)!=null?e:!1},mediaEvents:["seeked","ended","emptied"]},mediaPlaybackRate:{get(i){var e;const{media:t}=i;return(e=t?.playbackRate)!=null?e:1},set(i,e){const{media:t}=e;t&&Number.isFinite(+i)&&(t.playbackRate=+i)},mediaEvents:["ratechange","loadstart"]},mediaMuted:{get(i){var e;const{media:t}=i;return(e=t?.muted)!=null?e:!1},set(i,e){const{media:t,options:{noMutedPref:s}={}}=e;if(t){t.muted=i;try{const r=k.localStorage.getItem("media-chrome-pref-muted")!==null,n=t.hasAttribute("muted");if(s){r&&k.localStorage.removeItem("media-chrome-pref-muted");return}if(n&&!r)return;k.localStorage.setItem("media-chrome-pref-muted",i?"true":"false")}catch(r){console.debug("Error setting muted pref",r)}}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(i,e)=>{const{options:{noMutedPref:t}}=e,{media:s}=e;if(!(!s||s.muted||t))try{const r=k.localStorage.getItem("media-chrome-pref-muted")==="true";ba.mediaMuted.set(r,e),i(r)}catch(r){console.debug("Error getting muted pref",r)}}]},mediaLoop:{get(i){const{media:e}=i;return e?.loop},set(i,e){const{media:t}=e;t&&(t.loop=i)},mediaEvents:["medialooprequest"]},mediaVolume:{get(i){var e;const{media:t}=i;return(e=t?.volume)!=null?e:1},set(i,e){const{media:t,options:{noVolumePref:s}={}}=e;if(t){try{i==null?k.localStorage.removeItem("media-chrome-pref-volume"):!t.hasAttribute("muted")&&!s&&k.localStorage.setItem("media-chrome-pref-volume",i.toString())}catch(r){console.debug("Error setting volume pref",r)}Number.isFinite(+i)&&(t.volume=+i)}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(i,e)=>{const{options:{noVolumePref:t}}=e;if(!t)try{const{media:s}=e;if(!s)return;const r=k.localStorage.getItem("media-chrome-pref-volume");if(r==null)return;ba.mediaVolume.set(+r,e),i(+r)}catch(s){console.debug("Error getting volume pref",s)}}]},mediaVolumeLevel:{get(i){const{media:e}=i;return typeof e?.volume>"u"?"high":e.muted||e.volume===0?"off":e.volume<.5?"low":e.volume<.75?"medium":"high"},mediaEvents:["volumechange"]},mediaCurrentTime:{get(i){var e;const{media:t}=i;return(e=t?.currentTime)!=null?e:0},set(i,e){const{media:t}=e;!t||!hm(i)||(t.currentTime=i)},mediaEvents:["timeupdate","loadedmetadata"]},mediaDuration:{get(i){const{media:e,options:{defaultDuration:t}={}}=i;return t&&(!e||!e.duration||Number.isNaN(e.duration)||!Number.isFinite(e.duration))?t:Number.isFinite(e?.duration)?e.duration:Number.NaN},mediaEvents:["durationchange","loadedmetadata","emptied"]},mediaLoading:{get(i){const{media:e}=i;return e?.readyState<3},mediaEvents:["waiting","playing","emptied"]},mediaSeekable:{get(i){var e;const{media:t}=i;if(!((e=t?.seekable)!=null&&e.length))return;const s=t.seekable.start(0),r=t.seekable.end(t.seekable.length-1);if(!(!s&&!r))return[Number(s.toFixed(3)),Number(r.toFixed(3))]},mediaEvents:["loadedmetadata","emptied","progress","seekablechange"]},mediaBuffered:{get(i){var e;const{media:t}=i,s=(e=t?.buffered)!=null?e:[];return Array.from(s).map((r,n)=>[Number(s.start(n).toFixed(3)),Number(s.end(n).toFixed(3))])},mediaEvents:["progress","emptied"]},mediaStreamType:{get(i){const{media:e,options:{defaultStreamType:t}={}}=i,s=[ds.LIVE,ds.ON_DEMAND].includes(t)?t:void 0;if(!e)return s;const{streamType:r}=e;if(hC.includes(r))return r===ds.UNKNOWN?s:r;const n=e.duration;return n===1/0?ds.LIVE:Number.isFinite(n)?ds.ON_DEMAND:s}
304,mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},mediaTargetLiveWindow:{get(i){const{media:e}=i;if(!e)return Number.NaN;const{targetLiveWindow:t}=e,s=ba.mediaStreamType.get(i);return(t==null||Number.isNaN(t))&&s===ds.LIVE?0:t},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},mediaTimeIsLive:{get(i){const{media:e,options:{liveEdgeOffset:t=10}={}}=i;if(!e)return!1;if(typeof e.liveEdgeStart=="number")return Number.isNaN(e.liveEdgeStart)?!1:e.currentTime>=e.liveEdgeStart;if(!(ba.mediaStreamType.get(i)===ds.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 Kd(i).map(({kind:e,label:t,language:s})=>({kind:e,label:t,language:s}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},mediaSubtitlesShowing:{get(i){return bT(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?.track)==null?void 0:l.kind)||_T(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]=Lu(t,{kind:Qi.CHAPTERS});return Array.from((e=s?.cues)!=null?e:[]).map(({text:r,startTime:n,endTime:a})=>({text:gC(r),startTime:n,endTime:a}))},mediaEvents:["loadstart","loadedmetadata"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:s}=e;if(!s)return;const r=s.querySelector('track[kind="chapters"][default][src]'),n=(t=s.shadowRoot)==null?void 0:t.querySelector(':is(video,audio) > track[kind="chapters"][default][src]');return r?.addEventListener("load",i),n?.addEventListener("load",i),()=>{r?.removeEventListener("load",i),n?.removeEventListener("load",i)}}]},mediaIsPip:{get(i){var e,t;const{media:s,documentElement:r}=i;if(!s||!r||!r.pictureInPictureElement)return!1;if(r.pictureInPictureElement===s)return!0;if(r.pictureInPictureElement instanceof HTMLMediaElement)return(e=s.localName)!=null&&e.includes("-")?vs(s,r.pictureInPictureElement):!1;if(r.pictureInPictureElement.localName.includes("-")){let n=r.pictureInPictureElement.shadowRoot;for(;n?.pictureInPictureElement;){if(n.pictureInPictureElement===s)return!0;n=(t=n.pictureInPictureElement)==null?void 0:t.shadowRoot}}return!1},set(i,e){const{media:t}=e;if(t)if(i){if(!rt.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 rt.pictureInPictureElement&&rt.exitPictureInPicture()},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},mediaRenditionList:{get(i){var e;const{media:t}=i;return[...(e=t?.videoRenditions)!=null?e:[]].map(s=>({...s}))},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaRenditionSelected:{get(i){var e,t,s;const{media:r}=i;return(s=(t=r?.videoRenditions)==null?void 0:t[(e=r.videoRenditions)==null?void 0:e.selectedIndex])==null?void 0:s.id},set(i,e){const{media:t}=e;if(!t?.videoRenditions){console.warn("MediaController: Rendition selection not supported by this media.");return}const s=i,r=Array.prototype.findIndex.call(t.videoRenditions,n=>n.id==s);t.videoRenditions.selectedIndex!=r&&(t.videoRenditions.selectedIndex=r)},mediaEvents:["emptied"],videoRenditionsEvents:["addrendition","removerendition","change"]},mediaAudioTrackList:{get(i){var e;const{media:t}=i;return[...(e=t?.audioTracks)!=null?e:[]]},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaAudioTrackEnabled:{get(i){var e,t;const{media:s}=i;return(t=[...(e=s?.audioTracks)!=null?e:[]].find(r=>r.enabled))==null?void 0:t.id},set(i,e){const{media:t}=e;if(!t?.audioTracks){console.warn("MediaChrome: Audio track selection not supported by this media.");return}const s=i;for(const r of t.audioTracks)r.enabled=s==r.id},mediaEvents:["emptied"],audioTracksEvents:["addtrack","removetrack","change"]},mediaIsFullscreen:{get(i){return eC(i)},set(i,e,t){var s;i?(XD(e),t.detail&&((s=e.media)==null||s.focus())):ZD(e)},rootEvents:["fullscreenchange","webkitfullscreenchange"],mediaEvents:["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"]},mediaIsCasting:{get(i){var e;const{media:t}=i;return!t?.remote||((e=t.remote)==null?void 0:e.state)==="disconnected"?!1:!!t.remote.state},set(i,e){var t,s;const{media:r}=e;if(r&&!(i&&((t=r.remote)==null?void 0:t.state)!=="disconnected")&&!(!i&&((s=r.remote)==null?void 0:s.state)!=="connected")){if(typeof r.remote.prompt!="function"){console.warn("MediaChrome: Casting is not supported in this environment");return}r.remote.prompt().catch(()=>{})}},remoteEvents:["connect","connecting","disconnect"]},mediaIsAirplaying:{get(){return!1},set(i,e){const{media:t}=e;if(t){if(!(t.webkitShowPlaybackTargetPicker&&k.WebKitPlaybackTargetAvailabilityEvent)){console.error("MediaChrome: received a request to select AirPlay but AirPlay is not supported in this environment");return}t.webkitShowPlaybackTargetPicker()}},mediaEvents:["webkitcurrentplaybacktargetiswirelesschanged"]},mediaFullscreenUnavailable:{get(i){const{media:e}=i;
304if(!oC||!TT(e))return Nt.UNSUPPORTED}},mediaPipUnavailable:{get(i){const{media:e}=i;if(!lC||!yT(e))return Nt.UNSUPPORTED;if(e?.disablePictureInPicture)return Nt.UNAVAILABLE}},mediaVolumeUnavailable:{get(i){const{media:e}=i;if(Vd===!1||e?.volume==null)return Nt.UNSUPPORTED},stateOwnersUpdateHandlers:[i=>{Vd==null&&fC.then(e=>i(e?void 0:Nt.UNSUPPORTED))}]},mediaCastUnavailable:{get(i,{availability:e="not-available"}={}){var t;const{media:s}=i;if(!uC||!((t=s?.remote)!=null&&t.state))return Nt.UNSUPPORTED;if(!(e==null||e==="available"))return Nt.UNAVAILABLE},stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:s}=e;return s?(s.disableRemotePlayback||s.hasAttribute("disableremoteplayback")||(t=s?.remote)==null||t.watchAvailability(n=>{i({availability:n?"available":"not-available"})}).catch(n=>{n.name==="NotSupportedError"?i({availability:null}):i({availability:"not-available"})}),()=>{var n;(n=s?.remote)==null||n.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaAirplayUnavailable:{get(i,e){if(!dC)return Nt.UNSUPPORTED;if(e?.availability==="not-available")return Nt.UNAVAILABLE},mediaEvents:["webkitplaybacktargetavailabilitychanged"],stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:s}=e;return s?(s.disableRemotePlayback||s.hasAttribute("disableremoteplayback")||(t=s?.remote)==null||t.watchAvailability(n=>{i({availability:n?"available":"not-available"})}).catch(n=>{n.name==="NotSupportedError"?i({availability:null}):i({availability:"not-available"})}),()=>{var n;(n=s?.remote)==null||n.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaRenditionUnavailable:{get(i){var e;const{media:t}=i;if(!t?.videoRenditions)return Nt.UNSUPPORTED;if(!((e=t.videoRenditions)!=null&&e.length))return Nt.UNAVAILABLE},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaAudioTrackUnavailable:{get(i){var e,t;const{media:s}=i;if(!s?.audioTracks)return Nt.UNSUPPORTED;if(((t=(e=s.audioTracks)==null?void 0:e.length)!=null?t:0)<=1)return Nt.UNAVAILABLE},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaLang:{get(i){const{options:{mediaLang:e}={}}=i;return e??"en"}}},vC={[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]=Lu(a,{kind:Qi.METADATA,label:"thumbnails"}),m=Array.prototype.find.call((s=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?.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)===ds.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_LOOP_REQUEST](i,e,{detail:t}){const s="mediaLoop",r=!!t;return i[s].set(r,e),{mediaLoop:r}},[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=Kd(e),a=gT(t),o=(s=a[0])==null?void 0:s.language;o&&!r.noSubtitlesLangPref&&k.localStorage.setItem("media-chrome-pref-subtitles-lang",o),Ga(Dn.SHOWING,
304n,a)},[q.MEDIA_DISABLE_SUBTITLES_REQUEST](i,e,{detail:t}){const s=Kd(e),r=t??[];Ga(Dn.DISABLED,s,r)},[q.MEDIA_TOGGLE_SUBTITLES_REQUEST](i,e,{detail:t}){_T(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,t){const s="mediaIsFullscreen";i.mediaIsPip.get(e)&&i.mediaIsPip.set(!1,e),i[s].set(!0,e,t)},[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)}},EC=({media:i,fullscreenElement:e,documentElement:t,stateMediator:s=ba,requestMap:r=vC,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&&(Tm(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)=>{var v,T,y,b,A,L,S,R,x,I,M,F,V,Y,H,N;const W=!!f;if(f={...l,...f??{},...p},W)return;await mC(...Object.values(p));const B=o.length>0&&g===0&&a,j=l.media!==f.media,ee=((v=l.media)==null?void 0:v.textTracks)!==((T=f.media)==null?void 0:T.textTracks),U=((y=l.media)==null?void 0:y.videoRenditions)!==((b=f.media)==null?void 0:b.videoRenditions),$=((A=l.media)==null?void 0:A.audioTracks)!==((L=f.media)==null?void 0:L.audioTracks),ne=((S=l.media)==null?void 0:S.remote)!==((R=f.media)==null?void 0:R.remote),pe=l.documentElement!==f.documentElement,ue=!!l.media&&(j||B),fe=!!((x=l.media)!=null&&x.textTracks)&&(ee||B),nt=!!((I=l.media)!=null&&I.videoRenditions)&&(U||B),Qe=!!((M=l.media)!=null&&M.audioTracks)&&($||B),It=!!((F=l.media)!=null&&F.remote)&&(ne||B),Pt=!!l.documentElement&&(pe||B),ai=ue||fe||nt||Qe||It||Pt,Es=o.length===0&&g===1&&a,Cr=!!f.media&&(j||Es),wr=!!((V=f.media)!=null&&V.textTracks)&&(ee||Es),Nu=!!((Y=f.media)!=null&&Y.videoRenditions)&&(U||Es),ye=!!((H=f.media)!=null&&H.audioTracks)&&($||Es),at=!!((N=f.media)!=null&&N.remote)&&(ne||Es),Lt=!!f.documentElement&&(pe||Es),bi=Cr||wr||Nu||ye||at||Lt;if(!(ai||bi)){Object.entries(f).forEach(([Te,Ot])=>{l[Te]=Ot}),c(),f=void 0;return}Object.entries(s).forEach(([Te,{get:Ot,mediaEvents:bo=[],textTracksEvents:Mr=[],videoRenditionsEvents:_o=[],audioTracksEvents:js=[],remoteEvents:Ao=[],rootEvents:Uu=[],stateOwnersUpdateHandlers:So=[]}])=>{h[Te]||(h[Te]={});const _t=Be=>{const Xe=Ot(l,Be);u({[Te]:Xe})};let Fe;Fe=h[Te].mediaEvents,bo.forEach(Be=>{Fe&&ue&&(l.media.removeEventListener(Be,Fe),h[Te].mediaEvents=void 0),Cr&&(f.media.addEventListener(Be,_t),h[Te].mediaEvents=_t)}),Fe=h[Te].textTracksEvents,Mr.forEach(Be=>{var Xe,oi;Fe&&fe&&((Xe=l.media.textTracks)==null||Xe.removeEventListener(Be,Fe),h[Te].textTracksEvents=void 0),wr&&((oi=f.media.textTracks)==null||oi.addEventListener(Be,_t),h[Te].textTracksEvents=_t)}),Fe=h[Te].videoRenditionsEvents,_o.forEach(Be=>{var Xe,oi;Fe&&nt&&((Xe=l.media.videoRenditions)==null||Xe.removeEventListener(Be,Fe),h[Te].videoRenditionsEvents=void 0),Nu&&((oi=f.media.videoRenditions)==null||oi.addEventListener(Be,_t),h[Te].videoRenditionsEvents=_t)}),Fe=h[Te].audioTracksEvents,js.forEach(Be=>{var Xe,oi;Fe&&Qe&&((Xe=l.media.audioTracks)==null||Xe.removeEventListener(Be,Fe),h[Te].audioTracksEvents=void 0),ye&&((oi=f.media.audioTracks)==null||oi.addEventListener(Be,_t),h[Te].audioTracksEvents=_t)}),Fe=h[Te].remoteEvents,Ao.forEach(Be=>{var Xe,oi;Fe&&It&&((Xe=l.media.remote)==null||Xe.removeEventListener(Be,Fe),h[Te].remoteEvents=void 0),at&&((oi=f.media.remote)==null||oi.addEventListener(Be,_t),h[Te].remoteEvents=_t)}),Fe=h[Te].rootEvents,Uu.forEach(Be=>{Fe&&Pt&&(l.documentElement.removeEventListener(Be,Fe),h[Te].rootEvents=void 0),Lt&&(f.documentElement.addEventListener(Be,_t),h[Te].rootEvents=_t)});const Io=h[Te].stateOwnersUpdateHandlers;
vendor: 7,071 bytes, line 304
304if(Io&&ai&&(Array.isArray(Io)?Io:[Io]).forEach(Xe=>{typeof Xe=="function"&&Xe()}),bi){const Be=So.map(Xe=>Xe(_t,f)).filter(Xe=>typeof Xe=="function");h[Te].stateOwnersUpdateHandlers=Be.length===1?Be[0]:Be}else ai&&(h[Te].stateOwnersUpdateHandlers=void 0)}),Object.entries(f).forEach(([Te,Ot])=>{l[Te]=Ot}),c(),f=void 0};return m({media:i,fullscreenElement:e,documentElement:t,options:n}),{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}),c())},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 bm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ae=(i,e,t)=>(bm(i,e,"read from private field"),t?t.call(i):e.get(i)),Qt=(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)},ki=(i,e,t,s)=>(bm(i,e,"write to private field"),e.set(i,t),t),Gi=(i,e,t)=>(bm(i,e,"access private method"),t),Us,_a,be,pr,Aa,Di,xl,Sa,kl,Ih,br,Cn,Dl,Lh,Rh,AT;const ST=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Enter"," ","f","m","k","c","l","j",">","<","p"],h0=10,f0=.025,m0=.25,yC=.25,TC=2,G={DEFAULT_SUBTITLES:"defaultsubtitles",DEFAULT_STREAM_TYPE:"defaultstreamtype",DEFAULT_DURATION:"defaultduration",FULLSCREEN_ELEMENT:"fullscreenelement",HOTKEYS:"hotkeys",KEYBOARD_BACKWARD_SEEK_OFFSET:"keyboardbackwardseekoffset",KEYBOARD_FORWARD_SEEK_OFFSET:"keyboardforwardseekoffset",KEYBOARD_DOWN_VOLUME_STEP:"keyboarddownvolumestep",KEYBOARD_UP_VOLUME_STEP:"keyboardupvolumestep",KEYS_USED:"keysused",LANG:"lang",LOOP:"loop",LIVE_EDGE_OFFSET:"liveedgeoffset",NO_AUTO_SEEK_TO_LIVE:"noautoseektolive",NO_DEFAULT_STORE:"nodefaultstore",NO_HOTKEYS:"nohotkeys",NO_MUTED_PREF:"nomutedpref",NO_SUBTITLES_LANG_PREF:"nosubtitleslangpref",NO_VOLUME_PREF:"novolumepref",SEEK_TO_LIVE_OFFSET:"seektoliveoffset"};class IT extends Su{constructor(){super(),Qt(this,kl),Qt(this,br),Qt(this,Dl),Qt(this,Rh),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,Qt(this,Us,new Em(this,G.HOTKEYS)),Qt(this,_a,void 0),Qt(this,be,void 0),Qt(this,pr,null),Qt(this,Aa,void 0),Qt(this,Di,void 0),Qt(this,xl,t=>{var s;(s=ae(this,be))==null||s.dispatch(t)}),Qt(this,Sa,void 0),this.associateElement(this);let e={};ki(this,Aa,t=>{Object.entries(t).forEach(([s,r])=>{if(s in e&&e[s]===r)return;this.propagateMediaState(s,r);const n=s.toLowerCase(),a=new k.CustomEvent(bD[n],{composed:!0,detail:r});this.dispatchEvent(a)}),e=t}),this.hasAttribute(G.NO_HOTKEYS)?this.disableHotkeys():this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(G.NO_HOTKEYS,G.HOTKEYS,G.DEFAULT_STREAM_TYPE,G.DEFAULT_SUBTITLES,G.DEFAULT_DURATION,G.NO_MUTED_PREF,G.NO_VOLUME_PREF,G.LANG,G.LOOP)}get mediaStore(){return ae(this,be)}set mediaStore(e){var t,s;if(ae(this,be)&&((t=ae(this,Di))==null||t.call(this),ki(this,Di,void 0)),ki(this,be,e),!ae(this,be)&&!this.hasAttribute(G.NO_DEFAULT_STORE)){Gi(this,kl,Ih).call(this);return}ki(this,Di,(s=ae(this,be))==null?void 0:s.subscribe(ae(this,Aa)))}get fullscreenElement(){var e;return(e=ae(this,_a))!=null?e:this}set fullscreenElement(e){var t;this.hasAttribute(G.FULLSCREEN_ELEMENT)&&this.removeAttribute(G.FULLSCREEN_ELEMENT),ki(this,_a,e),(t=ae(this,be))==null||t.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}get defaultSubtitles(){return ve(this,G.DEFAULT_SUBTITLES)}set defaultSubtitles(e){Ee(this,G.DEFAULT_SUBTITLES,e)}get defaultStreamType(){return Ne(this,G.DEFAULT_STREAM_TYPE)}set defaultStreamType(e){Ue(this,G.DEFAULT_STREAM_TYPE,e)}get defaultDuration(){return Oe(this,G.DEFAULT_DURATION)}set defaultDuration(e){Ye(this,G.DEFAULT_DURATION,e)}get noHotkeys(){return ve(this,G.NO_HOTKEYS)}set noHotkeys(e){Ee(this,G.NO_HOTKEYS,e)}get keysUsed(){return Ne(this,G.KEYS_USED)}set keysUsed(e){Ue(this,G.KEYS_USED,e)}get liveEdgeOffset(){return Oe(this,G.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){Ye(this,G.LIVE_EDGE_OFFSET,e)}get noAutoSeekToLive(){return ve(this,G.NO_AUTO_SEEK_TO_LIVE)}set noAutoSeekToLive(e){Ee(this,G.NO_AUTO_SEEK_TO_LIVE,e)}get noVolumePref(){return ve(this,G.NO_VOLUME_PREF)}set noVolumePref(e){Ee(this,G.NO_VOLUME_PREF,e)}get noMutedPref(){return ve(this,G.NO_MUTED_PREF)}set noMutedPref(e){Ee(this,G.NO_MUTED_PREF,e)}get noSubtitlesLangPref(){return ve(this,G.NO_SUBTITLES_LANG_PREF)}set noSubtitlesLangPref(e){Ee(this,G.NO_SUBTITLES_LANG_PREF,e)}get noDefaultStore(){return ve(this,G.NO_DEFAULT_STORE)}set noDefaultStore(e){Ee(this,G.NO_DEFAULT_STORE,e)}attributeChangedCallback(e,t,s){var r,n,a,o,l,d,u,c,h,f,m,p;if(super.attributeChangedCallback(e,t,s),e===G.NO_HOTKEYS)s!==t&&s===""?(this.hasAttribute(G.HOTKEYS)&&console.warn("Media Chrome: Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):s!==t&&s===null&&this.enableHotkeys();else if(e===G.HOTKEYS)ae(this,Us).value=s;else if(e===G.DEFAULT_SUBTITLES&&s!==t)(r=ae(this,be))==null||r.dispatch({type:"optionschangerequest",detail:{defaultSubtitles:this.hasAttribute(G.DEFAULT_SUBTITLES)}});else if(e===G.DEFAULT_STREAM_TYPE)(a=ae(this,be))==null||a.dispatch({type:"optionschangerequest",detail:{defaultStreamType:(n=this.getAttribute(G.DEFAULT_STREAM_TYPE))!=null?n:void 0}});else if(e===G.LIVE_EDGE_OFFSET)(o=ae(this,be))==null||o.dispatch({type:"optionschangerequest",detail:{liveEdgeOffset:this.hasAttribute(G.LIVE_EDGE_OFFSET)?+this.getAttribute(G.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(G.SEEK_TO_LIVE_OFFSET)?void 0:+this.getAttribute(G.LIVE_EDGE_OFFSET)}});else if(e===G.SEEK_TO_LIVE_OFFSET)(l=ae(this,be))==null||l.dispatch({type:"optionschangerequest",detail:{seekToLiveOffset:this.hasAttribute(G.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(G.SEEK_TO_LIVE_OFFSET):void 0}});else if(e===G.NO_AUTO_SEEK_TO_LIVE)(d=ae(this,be))==null||d.dispatch({type:"optionschangerequest",detail:{noAutoSeekToLive:this.hasAttribute(G.NO_AUTO_SEEK_TO_LIVE)}});else if(e===G.FULLSCREEN_ELEMENT){const g=s?(u=this.getRootNode())==null?void 0:u.getElementById(s):void 0;ki(this,_a,g),(c=ae(this,be))==null||c.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}else e===G.LANG&&s!==t?(PD(s),(h=ae(this,be))==null||h.dispatch({type:"optionschangerequest",detail:{mediaLang:s}})):e===G.LOOP&&s!==t?(f=ae(this,be))==null||f.dispatch({type:q.MEDIA_LOOP_REQUEST,detail:s!=null}):e===G.NO_VOLUME_PREF&&s!==t?(m=ae(this,be))==null||m.dispatch({type:"optionschangerequest",detail:{noVolumePref:this.hasAttribute(G.NO_VOLUME_PREF)}}):e===G.NO_MUTED_PREF&&s!==t&&((p=ae(this,be))==null||p.dispatch({type:"optionschangerequest",detail:{noMutedPref:this.hasAttribute(G.NO_MUTED_PREF)}}))}connectedCallback(){var e,t;!ae(this,be)&&!this.hasAttribute(G.NO_DEFAULT_STORE)&&Gi(this,kl,I
vendor: 2,530 bytes, line 304
304h).call(this),(e=ae(this,be))==null||e.dispatch({type:"documentelementchangerequest",detail:rt}),super.connectedCallback(),ae(this,be)&&!ae(this,Di)&&ki(this,Di,(t=ae(this,be))==null?void 0:t.subscribe(ae(this,Aa))),ae(this,Sa)!==void 0&&ae(this,be)&&this.media&&setTimeout(()=>{var s,r,n;(r=(s=this.media)==null?void 0:s.textTracks)!=null&&r.length&&((n=ae(this,be))==null||n.dispatch({type:q.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:ae(this,Sa)}))},0),this.hasAttribute(G.NO_HOTKEYS)?this.disableHotkeys():this.enableHotkeys()}disconnectedCallback(){var e,t,s,r,n;if((e=super.disconnectedCallback)==null||e.call(this),ae(this,be)){const a=ae(this,be).getState();ki(this,Sa,!!((t=a.mediaSubtitlesShowing)!=null&&t.length)),(s=ae(this,be))==null||s.dispatch({type:"documentelementchangerequest",detail:void 0}),(r=ae(this,be))==null||r.dispatch({type:q.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:!1})}ae(this,Di)&&((n=ae(this,Di))==null||n.call(this),ki(this,Di,void 0))}mediaSetCallback(e){var t;super.mediaSetCallback(e),(t=ae(this,be))==null||t.dispatch({type:"mediaelementchangerequest",detail:e}),e.hasAttribute("tabindex")||(e.tabIndex=-1)}mediaUnsetCallback(e){var t;super.mediaUnsetCallback(e),(t=ae(this,be))==null||t.dispatch({type:"mediaelementchangerequest",detail:void 0})}propagateMediaState(e,t){v0(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=LC(e,s,r);Object.values(q).forEach(a=>{e.addEventListener(a,ae(this,xl))}),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,ae(this,xl))})}registerMediaStateReceiver(e){if(!e)return;const t=this.mediaStateReceivers;t.indexOf(e)>-1||(t.push(e),ae(this,be)&&Object.entries(ae(this,be).getState()).forEach(([r,n])=>{v0([e],r,n)}))}unregisterMediaStateReceiver(e){const t=this.mediaStateReceivers,s=t.indexOf(e);s<0||t.splice(s,1)}enableHotkeys(){this.addEventListener("keydown",Gi(this,Dl,Lh))}disableHotkeys(){this.removeEventListener("keydown",Gi(this,Dl,Lh)),this.removeEventListener("keyup",Gi(this,br,Cn))}get hotkeys(){return Ne(this,G.HOTKEYS)}set hotkeys(e){Ue(this,G.HOTKEYS,e)}keyboardShortcutHandler(e){var t,s,r,n,a,o,l,d,u;const c=e.target;if(((r=(s=(t=c.getAttribute(G.KEYS_USED))==null?void 0:t.split(" "))!=null?s:c?.keysUsed)!=null?r:[]).map(v=>
vendor: 4,095 bytes, line 304
304v==="Space"?" ":v).filter(Boolean).includes(e.key))return;let f,m,p;if(!(ae(this,Us).contains(`no${e.key.toLowerCase()}`)||e.key===" "&&ae(this,Us).contains("nospace")||e.shiftKey&&(e.key==="/"||e.key==="?")&&ae(this,Us).contains("noshift+/")))switch(e.key){case" ":case"k":f=ae(this,be).getState().mediaPaused?q.MEDIA_PLAY_REQUEST:q.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new k.CustomEvent(f,{composed:!0,bubbles:!0}));break;case"m":f=this.mediaStore.getState().mediaVolumeLevel==="off"?q.MEDIA_UNMUTE_REQUEST:q.MEDIA_MUTE_REQUEST,this.dispatchEvent(new k.CustomEvent(f,{composed:!0,bubbles:!0}));break;case"f":f=this.mediaStore.getState().mediaIsFullscreen?q.MEDIA_EXIT_FULLSCREEN_REQUEST:q.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new k.CustomEvent(f,{composed:!0,bubbles:!0}));break;case"c":this.dispatchEvent(new k.CustomEvent(q.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}));break;case"ArrowLeft":case"j":{const v=this.hasAttribute(G.KEYBOARD_BACKWARD_SEEK_OFFSET)?+this.getAttribute(G.KEYBOARD_BACKWARD_SEEK_OFFSET):h0;m=Math.max(((n=this.mediaStore.getState().mediaCurrentTime)!=null?n:0)-v,0),p=new k.CustomEvent(q.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case"ArrowRight":case"l":{const v=this.hasAttribute(G.KEYBOARD_FORWARD_SEEK_OFFSET)?+this.getAttribute(G.KEYBOARD_FORWARD_SEEK_OFFSET):h0;m=Math.max(((a=this.mediaStore.getState().mediaCurrentTime)!=null?a:0)+v,0),p=new k.CustomEvent(q.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case"ArrowUp":{const v=this.hasAttribute(G.KEYBOARD_UP_VOLUME_STEP)?+this.getAttribute(G.KEYBOARD_UP_VOLUME_STEP):f0;m=Math.min(((o=this.mediaStore.getState().mediaVolume)!=null?o:1)+v,1),p=new k.CustomEvent(q.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case"ArrowDown":{const v=this.hasAttribute(G.KEYBOARD_DOWN_VOLUME_STEP)?+this.getAttribute(G.KEYBOARD_DOWN_VOLUME_STEP):f0;m=Math.max(((l=this.mediaStore.getState().mediaVolume)!=null?l:1)-v,0),p=new k.CustomEvent(q.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case"<":{const v=(d=this.mediaStore.getState().mediaPlaybackRate)!=null?d:1;m=Math.max(v-m0,yC).toFixed(2),p=new k.CustomEvent(q.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case">":{const v=(u=this.mediaStore.getState().mediaPlaybackRate)!=null?u:1;m=Math.min(v+m0,TC).toFixed(2),p=new k.CustomEvent(q.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case"/":case"?":{e.shiftKey&&Gi(this,Rh,AT).call(this);break}case"p":{f=this.mediaStore.getState().mediaIsPip?q.MEDIA_EXIT_PIP_REQUEST:q.MEDIA_ENTER_PIP_REQUEST,p=new k.CustomEvent(f,{composed:!0,bubbles:!0}),this.dispatchEvent(p);break}}}}Us=new WeakMap;_a=new WeakMap;be=new WeakMap;pr=new WeakMap;Aa=new WeakMap;Di=new WeakMap;xl=new WeakMap;Sa=new WeakMap;kl=new WeakSet;Ih=function(){var i;this.mediaStore=EC({media:this.media,fullscreenElement:this.fullscreenElement,options:{defaultSubtitles:this.hasAttribute(G.DEFAULT_SUBTITLES),defaultDuration:this.hasAttribute(G.DEFAULT_DURATION)?+this.getAttribute(G.DEFAULT_DURATION):void 0,defaultStreamType:(i=this.getAttribute(G.DEFAULT_STREAM_TYPE))!=null?i:void 0,liveEdgeOffset:this.hasAttribute(G.LIVE_EDGE_OFFSET)?+this.getAttribute(G.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(G.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(G.SEEK_TO_LIVE_OFFSET):this.hasAttribute(G.LIVE_EDGE_OFFSET)?+this.getAttribute(G.LIVE_EDGE_OFFSET):void 0,noAutoSeekToLive:this.hasAttribute(G.NO_AUTO_SEEK_TO_LIVE),noVolumePref:this.hasAttribute(G.NO_VOLUME_PREF),noMutedPref:this.hasAttribute(G.NO_MUTED_PREF),noSubtitlesLangPref:this.hasAttribute(G.NO_SUBTITLES_LANG_PREF)}})};br=new WeakSet;Cn=function(i){const{key:e,shiftKey:t}=i;if(!(t&&(e==="/"||e==="?")||ST.includes(e))){this.removeEventListener("keyup",Gi(this,br,Cn));return}this.keyboardShortcutHandler(i)};Dl=new WeakSet;Lh=function(i){var e;const{metaKey:t,altKey:s,key:r,shiftKey:n}=i,a=n&&(r==="/"||r==="?");
304if(a&&((e=ae(this,pr))!=null&&e.open)){this.removeEventListener("keyup",Gi(this,br,Cn));return}if(t||s||!a&&!ST.includes(r)){this.removeEventListener("keyup",Gi(this,br,Cn));return}const o=i.target,l=o instanceof HTMLElement&&(o.tagName.toLowerCase()==="media-volume-range"||o.tagName.toLowerCase()==="media-time-range");[" ","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(r)&&!(ae(this,Us).contains(`no${r.toLowerCase()}`)||r===" "&&ae(this,Us).contains("nospace"))&&!l&&i.preventDefault(),this.addEventListener("keyup",Gi(this,br,Cn),{once:!0})};Rh=new WeakSet;AT=function(){ae(this,pr)||(ki(this,pr,rt.createElement("media-keyboard-shortcuts-dialog")),this.appendChild(ae(this,pr))),ae(this,pr).open=!0};const bC=Object.values(_),_C=Object.values(Qy),LT=i=>{var e,t,s,r;let{observedAttributes:n}=i.constructor;!n&&((e=i.nodeName)!=null&&e.includes("-"))&&(k.customElements.upgrade(i),{observedAttributes:n}=i.constructor);const a=(r=(s=(t=i?.getAttribute)==null?void 0:t.call(i,Ae.MEDIA_CHROME_ATTRIBUTES))==null?void 0:s.split)==null?void 0:r.call(s,/\s+/);return Array.isArray(n||a)?(n||a).filter(o=>bC.includes(o)):[]},AC=i=>{var e,t;return(e=i.nodeName)!=null&&e.includes("-")&&k.customElements.get((t=i.nodeName)==null?void 0:t.toLowerCase())&&!(i instanceof k.customElements.get(i.nodeName.toLowerCase()))&&k.customElements.upgrade(i),_C.some(s=>s in i)},xh=i=>AC(i)||!!LT(i).length,p0=i=>{var e;return(e=i?.join)==null?void 0:e.call(i,":")},g0={[_.MEDIA_SUBTITLES_LIST]:uo,[_.MEDIA_SUBTITLES_SHOWING]:uo,[_.MEDIA_SEEKABLE]:p0,[_.MEDIA_BUFFERED]:i=>i?.map(p0).join(" "),[_.MEDIA_PREVIEW_COORDS]:i=>i?.join(" "),[_.MEDIA_RENDITION_LIST]:AD,[_.MEDIA_AUDIO_TRACK_LIST]:RD},SC=async(i,e,t)=>{var s,r;if(i.isConnected||await Jy(0),typeof t=="boolean"||t==null)return Ee(i,e,t);if(typeof t=="number")return Ye(i,e,t);if(typeof t=="string")return Ue(i,e,t);if(Array.isArray(t)&&!t.length)return i.removeAttribute(e);const n=(r=(s=g0[e])==null?void 0:s.call(g0,t))!=null?r:t;return i.setAttribute(e,n)},IC=i=>{var e;return!!((e=i.closest)!=null&&e.call(i,'*[slot="media"]'))},sr=(i,e)=>{if(IC(i))return;const t=(r,n)=>{var a,o;xh(r)&&n(r);const{children:l=[]}=r??{},d=(o=(a=r?.shadowRoot)==null?void 0:a.children)!=null?o:[];[...l,...d].forEach(c=>sr(c,n))},s=i?.nodeName.toLowerCase();if(s.includes("-")&&!xh(i)){k.customElements.whenDefined(s).then(()=>{t(i,e)});return}t(i,e)},v0=(i,e,t)=>{i.forEach(s=>{if(e in s){s[e]=t;return}const r=LT(s),n=e.toLowerCase();r.includes(n)&&SC(s,n,t)})},LC=(i,e,t)=>{sr(i,e);const s=u=>{var c;const h=(c=u?.composedPath()[0])!=null?c:u.target;e(h)},r=u=>{var c;const h=(c=u?.composedPath()[0])!=null?c:u.target;t(h)};i.addEventListener(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=>sr(v,e)),Array.prototype.forEach.call(f,v=>sr(v,t))):m==="attributes"&&g===Ae.MEDIA_CHROME_ATTRIBUTES&&(xh(p)?e(p):t(p))})};let a=[];const o=u=>{const c=u.target;c.name!=="media"&&(a.forEach(h=>sr(h,t)),a=[...c.assignedElements({flatten:!0})],a.forEach(h=>sr(h,e)))};i.addEventListener("slotchange",o);const l=new MutationObserver(n);return l.observe(i,{childList:!0,attributes:!0,subtree:!0}),()=>{sr(i,t),i.removeEventListener("slotchange",o),l.disconnect(),i.removeEventListener(q.REGISTER_MEDIA_STATE_RECEIVER,s),i.removeEventListener(q.UNREGISTER_MEDIA_STATE_RECEIVER,r)}};k.customElements.get("media-controller")||k.customElements.define("media-controller",IT);var RC=IT;const Fr={PLACEMENT:"placement",BOUNDS:"bounds"};function xC(i){return`
305    <style>
306      :host {
307        --_tooltip-background-color: var(--media-tooltip-background-color, var(--media-secondary-color, rgba(20, 20, 30, .7)));
308        --_tooltip-background: var(--media-tooltip-background, var(--_tooltip-background-color));
309        --_tooltip-arrow-half-width: calc(var(--media-tooltip-arrow-width, 12px) / 2);
310        --_tooltip-arrow-height: var(--media-tooltip-arrow-height, 5px);
311        --_tooltip-arrow-background: var(--media-tooltip-arrow-color, var(--_tooltip-background-color));
312        position: relative;
313        pointer-events: none;
314        display: var(--media-tooltip-display, inline-flex);
315        justify-content: center;
316        align-items: center;
317        box-sizing: border-box;
318        z-index: var(--media-tooltip-z-index, 1);
319        background: var(--_tooltip-background);
320        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
321        font: var(--media-font,
322          var(--media-font-weight, 400)
323          var(--media-font-size, 13px) /
324          var(--media-text-content-height, var(--media-control-height, 18px))
325          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
326        padding: var(--media-tooltip-padding, .35em .7em);
327        border: var(--media-tooltip-border, none);
328        border-radius: var(--media-tooltip-border-radius, 5px);
329        filter: var(--media-tooltip-filter, drop-shadow(0 0 4px rgba(0, 0, 0, .2)));
330        white-space: var(--media-tooltip-white-space, nowrap);
331      }
332
333      :host([hidden]) {
334        display: none;
335      }
336
337      img, svg {
338        display: inline-block;
339      }
340
341      #arrow {
342        position: absolute;
343        width: 0px;
344        height: 0px;
345        border-style: solid;
346        display: var(--media-tooltip-arrow-display, block);
347      }
348
349      :host(:not([placement])),
350      :host([placement="top"]) {
351        position: absolute;
352        bottom: calc(100% + var(--media-tooltip-distance, 12px));
353        left: 50%;
354        transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0
354);
355      }
356      :host(:not([placement])) #arrow,
357      :host([placement="top"]) #arrow {
358        top: 100%;
359        left: 50%;
360        border-width: var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width);
361        border-color: var(--_tooltip-arrow-background) transparent transparent transparent;
362        transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0);
363      }
364
365      :host([placement="right"]) {
366        position: absolute;
367        left: calc(100% + var(--media-tooltip-distance, 12px));
368        top: 50%;
369        transform: translate(0, -50%);
370      }
371      :host([placement="right"]) #arrow {
372        top: 50%;
373        right: 100%;
374        border-width: var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0;
375        border-color: transparent var(--_tooltip-arrow-background) transparent transparent;
376        transform: translate(0, -50%);
377      }
378
379      :host([placement="bottom"]) {
380        position: absolute;
381        top: calc(100% + var(--media-tooltip-distance, 12px));
382        left: 50%;
383        transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0);
384      }
385      :host([placement="bottom"]) #arrow {
386        bottom: 100%;
387        left: 50%;
388        border-width: 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width);
389        border-color: transparent transparent var(--_tooltip-arrow-background) transparent;
390        transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0);
391      }
392
393      :host([placement="left"]) {
394        position: absolute;
395        right: calc(100% + var(--media-tooltip-distance, 12px));
396        top: 50%;
397        transform: translate(0, -50%);
398      }
399      :host([placement="left"]) #arrow {
400        top: 50%;
401        left: 100%;
402        border-width: var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height);
403        border-color: transparent transparent transparent var(--_tooltip-arrow-background);
404        transform: translate(0, -50%);
405      }
406      
407      :host([placement="none"]) #arrow {
408        display: none;
409      }
410    </style>
411    <slot></slot>
412    <div id="arrow"></div>
413  `}class Ru extends k.HTMLElement{constructor(){if(super(),this.updateXOffset=()=>{var e;if(!lT(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=Yn(this,"#"+this.bounds))!=null?e:wt(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=jt(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[Fr.PLACEMENT,Fr.BOUNDS]}get placement(){return Ne(this,Fr.PLACEMENT)}set placement(e){Ue(this,Fr.PLACEMENT,e)}get bounds(){return Ne(this,Fr.BOUNDS)}set bounds(e){Ue(this,Fr.BOUNDS,e)}}Ru.shadowRootOptions={mode:"open"};Ru.getTemplateHTML=xC;k.customElements.get("media-tooltip")||k.customElements.define("media-tooltip",Ru);var E0=Ru,_m=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Je=(i,e,t)=>(_m(i,e,"read from private field"),t?t.call(i):e.get(i)),Br=(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)},Yo=(i,e,t,s)=>(_m(i,e,"write to private field"),e.set(i,t),t),kC=(i,e,t)=>(_m(i,e,"access private method"),t),Ci,bn,$s,en,Cl,kh,RT;const As={TOOLTIP_PLACEMENT:"tooltipplacement",DISABLED:"disabled",NO_TOOLTIP:"notooltip"};function DC(i,e={}){return`
414    <style>
415      :host {
416        position: relative;
417        font: var(--media-font,
418          var(--media-font-weight, bold)
419          var(--media-font-size, 14px) /
420          var(--media-text-content-height, var(--media-control-height, 24px))
421          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
422        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
423        background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
424        padding: var(--media-button-padding, var(--media-control-padding, 10px));
425        justify-content: var(--media-button-justify-content, center);
426        display: inline-flex;
427        align-items: center;
428        vertical-align: middle;
429        box-sizing: border-box;
430        transition: background .15s linear;
431        pointer-events: auto;
432        cursor: var(--media-cursor, pointer);
433        -webkit-tap-highlight-color: transparent;
434      }
435
436      
437      :host(:focus-visible) {
438        box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9));
439        outline: 0;
440      }
441      
442      :host(:where(:focus)) {
443        box-shadow: none;
444        outline: 0;
445      }
446
447      :host(:hover) {
448        background: var(--media-control-hover-background, rgba(50 50 70 / .7));
449      }
450
451      svg, img, ::slotted(svg), ::slotted(img) {
452        width: var(--media-button-icon-width);
453        height: var(--media-button-icon-height, var(--media-control-height, 24px));
454        transform: var(--media-button-icon-transform);
455        transition: var(--media-button-icon-transition);
456        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
457        vertical-align: middle;
458        max-width: 100%;
459        max-height: 100%;
460        min-width: 100%;
461      }
462
463      media-tooltip {
464        
465        max-width: 0;
466        overflow-x: clip;
467        opacity: 0;
468        transition: opacity .3s, max-width 0s 9s;
469      }
470
471      :host(:hover) media-tooltip,
472      :host(:focus-visible) media-tooltip {
473        max-width: 100vw;
474        opacity: 1;
475        transition: opacity .3s;
476      }
477
478      :host([notooltip]) slot[name="tooltip"] {
479        display: none;
480      }
481    </style>
482
483    ${this.getSlotTemplateHTML(i,e)}
484
485    <slot name="tooltip">
486      <media-tooltip part="tooltip" aria-hidden="true">
487        <template shadowrootmode="${E0.shadowRootOptions.mode}">
488          ${E0.getTemplateHTML({})}
489        </template>
490        <slot name="tooltip-content">
491          ${this.getTooltipContentHTML(i)}
492        </slot>
493      </media-tooltip>
494    </slot>
495  `}function CC(i,e){return`
496    <slot></slot>
497  `}function wC(){return""}class gt extends k.HTMLElement{constructor(){if(super(),Br(this,kh),Br(this,Ci,void 0),this.preventClick=!1,this.tooltipEl=null,Br(this,bn,e=>{this.preventClick||this.handleClick(e),setTimeout(Je(this,$s),0)}),Br(this,$s,()=>{var e,t;(t=(e=this.tooltipEl)==null?void 0:e.updateXOffset)==null||t.call(e)}),Br(this,en,e=>{const{key:t}=e;if(!this.keysUsed.includes(t)){this.removeEventListener("keyup",Je(this,en));return}this.preventClick||this.handleClick(e)}),Br(this,Cl,e=>{const{metaKey:t,altKey:s,key:r}=e;if(t||s||!this.keysUsed.includes(r)){this.removeEventListener("keyup",Je(this,en));return}this.addEventListener("keyup",Je(this,en),{once:!0})}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=jt(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,Ae.MEDIA_CONTROLLER,_.MEDIA_LANG]}enable(){this.addEventListener("click",Je(this,bn)),this.addEventListener("keydown",Je(this,Cl)),this.tabIndex=0}disable(){this.removeEventListener("click",Je(this,bn)),this.removeEventListener("keydown",Je(this,Cl)),this.removeEventListener("keyup",Je(this,en)),this.tabIndex=-1}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Ae.MEDIA_CONTROLLER?(t&&((n=(r=Je(this,Ci))==null?void 0:r.unassociateElement)==null||n.call(r,this),Yo(this,Ci,null)),s&&this.isConnected&&(Yo(this,Ci,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=Je(this,Ci))==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:e===_.MEDIA_LANG&&(this.shadowRoot.querySelector('slot[name="tooltip-content"]').innerHTML=this.constructor.getTooltipContentHTML()),Je(this,$s).call(this)}connectedCallback(){var e,t,s;const{style:r}=ct(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(Ae.MEDIA_CONTROLLER);n&&(Yo(this,Ci,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(s=(t=Je(this,Ci))==null?void 0:t.associateElement)==null||s.call(t,this)),k.customElements.whenDefined("media-tooltip").then(()=>kC(this,kh,RT).call(this))}disconnectedCallback(){var e,t;this.disable(),(t=(e=Je(this,Ci))==null?void 0:e.unassociateElement)==null||t.call(e,this),Yo(this,Ci,null),this.removeEventListener("mouseenter",Je(this,$s)),this.removeEventListener("focus",Je(this,$s)),this.removeEventListener("click",Je(this,bn))}get keysUsed(){return["Enter"," "]}get tooltipPlacement(){return Ne(this,As.TOOLTIP_PLACEMENT)}set tooltipPlacement(e){Ue(this,As.TOOLTIP_PLACEMENT,e)}get mediaController(){return Ne(this,Ae.MEDIA_CONTROLLER)}set mediaController(e){Ue(this,Ae.MEDIA_CONTROLLER,e)}get disabled(){return ve(this,As.DISABLED)}set disabled(e){Ee(this,As.DISABLED,e)}get noTooltip(){return ve(this,As.NO_TOOLTIP)}set noTooltip(e){Ee(this,As.NO_TOOLTIP,e)}handleClick(e){}}Ci=new WeakMap;bn=new WeakMap;$s=new WeakMap;en=new WeakMap;Cl=new WeakMap;kh=new WeakSet;RT=function(){this.addEventListener("mouseenter",Je(this,$s)),this.addEventListener("focus",Je(this,$s)),this.addEventListener("click",Je(this,bn));const i=this.tooltipPlacement;i&&this.tooltipEl&&(this.tooltipEl.placement=i)};gt.shadowRootOptions={mode:"open"};gt.getTemplateHTML=DC;gt.getSlotTemplateHTML=CC;gt.getTooltipContentHTML=wC;k.customElements.get("media-chrome-button")||k.customElements.define("media-chrome-button",gt);const y0=`<svg aria-hidden="true" viewBox="0 0 26 24">
498  <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"/>
499</svg>
500`;function MC(i){return`
501    <style>
502      :host([${_.MEDIA_IS_AIRPLAYING}]) slot[name=icon] slot:not([name=exit]) {
503        display: none !important;
504      }
505
506      
507      :host(:not([${_.MEDIA_IS_AIRPLAYING}])) slot[name=icon] slot:not([name=enter]) {
508        display: none !important;
509      }
510
511      :host([${_.MEDIA_IS_AIRPLAYING}]) slot[name=tooltip-enter],
512      :host(:not([${_.MEDIA_IS_AIRPLAYING}])) slot[name=tooltip-exit] {
513        display: none;
514      }
515    </style>
516
517    <slot name="icon">
518      <slot name="enter">${y0}</slot>
519      <slot name="exit">${y0}</slot>
520    </slot>
521  `}function PC(){return`
522    <slot name="tooltip-enter">${J("start airplay")}</slot>
523    <slot name="tooltip-exit">${J("stop airplay")}</slot>
524  `}const T0=i=>{const e=i.mediaIsAirplaying?J("stop airplay"):J("start airplay");
524i.setAttribute("aria-label",e)};class Am extends gt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_IS_AIRPLAYING,_.MEDIA_AIRPLAY_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),T0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_IS_AIRPLAYING&&T0(this)}get mediaIsAirplaying(){return ve(this,_.MEDIA_IS_AIRPLAYING)}set mediaIsAirplaying(e){Ee(this,_.MEDIA_IS_AIRPLAYING,e)}get mediaAirplayUnavailable(){return Ne(this,_.MEDIA_AIRPLAY_UNAVAILABLE)}set mediaAirplayUnavailable(e){Ue(this,_.MEDIA_AIRPLAY_UNAVAILABLE,e)}handleClick(){const e=new k.CustomEvent(q.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(e)}}Am.getSlotTemplateHTML=MC;Am.getTooltipContentHTML=PC;k.customElements.get("media-airplay-button")||k.customElements.define("media-airplay-button",Am);const OC=`<svg aria-hidden="true" viewBox="0 0 26 24">
525  <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"/>
526</svg>`,NC=`<svg aria-hidden="true" viewBox="0 0 26 24">
527  <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"/>
528</svg>`;function UC(i){return`
529    <style>
530      :host([aria-checked="true"]) slot[name=off] {
531        display: none !important;
532      }
533
534      
535      :host(:not([aria-checked="true"])) slot[name=on] {
536        display: none !important;
537      }
538
539      :host([aria-checked="true"]) slot[name=tooltip-enable],
540      :host(:not([aria-checked="true"])) slot[name=tooltip-disable] {
541        display: none;
542      }
543    </style>
544
545    <slot name="icon">
546      <slot name="on">${OC}</slot>
547      <slot name="off">${NC}</slot>
548    </slot>
549  `}function $C(){return`
550    <slot name="tooltip-enable">${J("Enable captions")}</slot>
551    <slot name="tooltip-disable">${J("Disable captions")}</slot>
552  `}const b0=i=>{i.setAttribute("aria-checked",ET(i).toString())};class Sm extends gt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_SUBTITLES_LIST,_.MEDIA_SUBTITLES_SHOWING]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",J("closed captions")),b0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_SUBTITLES_SHOWING&&b0(this)}get mediaSubtitlesList(){return _0(this,_.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){A0(this,_.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return _0(this,_.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){A0(this,_.MEDIA_SUBTITLES_SHOWING,e)}handleClick(){this.dispatchEvent(new k.CustomEvent(q.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}))}}Sm.getSlotTemplateHTML=UC;Sm.getTooltipContentHTML=$C;const _0=(i,e)=>{const t=i.getAttribute(e);return t?Iu(t):[]},A0=(i,e,t)=>{if(!t?.length){i.removeAttribute(e);return}const s=uo(t);i.getAttribute(e)!==s&&i.setAttribute(e,s)};k.customElements.get("media-captions-button")||k.customElements.define("media-captions-button",Sm);const FC='<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>',BC='<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 HC(i){return`
553    <style>
554      :host([${_.MEDIA_IS_CASTING}]) slot[name=icon] slot:not([name=exit]) {
555        display: none !important;
556      }
557
558      
559      :host(:not([${_.MEDIA_IS_CASTING}])) slot[name=icon] slot:not([name=enter]) {
560        display: none !important;
561      }
562
563      :host([${_.MEDIA_IS_CASTING}]) slot[name=tooltip-enter],
564      :host(:not([${_.MEDIA_IS_CASTING}])) slot[name=tooltip-exit] {
565        display: none;
566      }
567    </style>
568
569    <slot name="icon">
570      <slot name="enter">${FC}</slot>
571      <slot name="exit">${BC}</slot>
572    </slot>
573  `}function GC(){return`
574    <slot name="tooltip-enter">${J("Start casting")}</slot>
575    <slot name="tooltip-exit">${J("Stop casting")}</slot>
576  `}const S0=i=>{const e=i.mediaIsCasting?J("stop casting"):J("start casting");i.setAttribute("aria-label",e)};class Im extends gt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_IS_CASTING,_.MEDIA_CAST_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),S0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_IS_CASTING&&S0(this)}get mediaIsCasting(){return ve(this,_.MEDIA_IS_CASTING)}set mediaIsCasting(e){Ee(this,_.MEDIA_IS_CASTING,e)}get mediaCastUnavailable(){return Ne(this,_.MEDIA_CAST_UNAVAILABLE)}set mediaCastUnavailable(e){Ue(this,_.MEDIA_CAST_UNAVAILABLE,e)}handleClick(){const e=this.mediaIsCasting?q.MEDIA_EXIT_CAST_REQUEST:q.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new k.CustomEvent(e,{composed:!0,bubbles:!0}))}}Im.getSlotTemplateHTML=HC;Im.getTooltipContentHTML=GC;k.customElements.get("media-cast-button")||k.customElements.define("media-cast-button",Im);var Lm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},_r=(i,e,t)=>(Lm(i,e,"read from private field"),e.get(i)),ss=(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)=>(Lm(i,e,"write to private field"),e.set(i,t),t),Zs=(i,e,t)=>(Lm(i,e,"access private method"),t),Wd,co,xr,wl,Dh,Ch,xT,wh,kT,Mh,DT,Ph,CT,Oh,wT;function KC(i){return`
577    <style>
578      :host {
579        font: var(--media-font,
580          var(--media-font-weight, normal)
581          var(--media-font-size, 14px) /
582          var(--media-text-content-height, var(--media-control-height, 24px))
583          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
584        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
585        display: var(--media-dialog-display, inline-flex);
586        justify-content: center;
587        align-items: center;
588        
589        transition-behavior: allow-discrete;
590        visibility: hidden;
591        opacity: 0;
592        transform: translateY(2px) scale(.99);
593        pointer-events: none;
594      }
595
596      :host([open]) {
597        transition: display .2s, visibility 0s, opacity .2s ease-out, transform .15s ease-out;
598        visibility: visible;
599        opacity: 1;
600        transform: translateY(0) scale(1);
601        pointer-events: auto;
602      }
603
604      #content {
605        display: flex;
606        position: relative;
607        box-sizing: border-box;
608        width: min(320px, 100%);
609        word-wrap: break-word;
610        max-height: 100%;
611        overflow: auto;
612        text-align: center;
613        line-height: 1.4;
614      }
615    </style>
616    ${this.getSlotTemplateHTML(i)}
617  `}function VC(i){return`
618    <slot id="content"></slot>
619  `}const ia={OPEN:"open",ANCHOR:"anchor"};class jn extends k.HTMLElement{constructor(){super(),ss(this,wl),ss(this,Ch),ss(this,wh),ss(this,Mh),ss(this,Ph),ss(this,Oh),ss(this,Wd,!1),ss(this,co,null),ss(this,xr,null),this.addEventListener("invoke",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this)}static get observedAttributes(){return[ia.OPEN,ia.ANCHOR]}get open(){return ve(this,ia.OPEN)}set open(e){Ee(this,ia.OPEN,e)}handleEvent(e){switch(e.type){case"invoke":Zs(this,Mh,DT).call(this,e);break;case"focusout":Zs(this,Ph,CT).call(this,e);break;case"keydown":Zs(this,Oh,wT).call(this,e);break}}connectedCallback(){Zs(this,wl,Dh).call(this),this.role||(this.role="dialog")}attributeChangedCallback(e,t,s){Zs(this,wl,Dh).call(this),e===ia.OPEN&&s!==t&&(this.open?Zs(this,Ch,xT).call(this):Zs(this,wh,kT).call(this))}focus(){Rm(this,co,mm());const e=!this.dispatchEvent(new Event("focus",{composed:!0,cancelable:!0})),t=!this.dispatchEvent(new Event("focusin",{composed:!0,bubbles:!0,cancelable:!0}));if(e||t)return;const s=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');s?.focus()}get keysUsed(){return["Escape","Tab"]}}Wd=new WeakMap;co=new WeakMap;xr=new WeakMap;wl=new WeakSet;Dh=function(){if(!_r(this,Wd)&&(Rm(this,Wd,!0),!this.shadowRoot)){this.attachShadow(this.constructor.shadowRootOptions);const i=jt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i),queueMicrotask(()=>{const{style:e}=ct(this.shadowRoot,":host");e.setProperty("transition","display .15s, visibility .15s, opacity .15s ease-in, transform .15s ease-in")})}};Ch=new WeakSet;xT=function(){var i;(i=_r(this,xr))==null||i.setAttribute("aria-expanded","true"),this.dispatchEvent(new Event("open",{composed:!0,bubbles:!0})),this.addEventListener("transitionend",()=>this.focus(),{once:!0})};wh=new WeakSet;kT=function(){var i;(i=_r(this,xr))==null||i.setAttribute("aria-expanded","false"),this.dispatchEvent(new Event("close",{composed:!0,bubbles:!0}))};Mh=new WeakSet;DT=function(i){Rm(this,xr,i.relatedTarget),vs(this,i.relatedTarget)||(this.open=!this.open)};Ph=new WeakSet;CT=function(i){var e;vs(this,i.relatedTarget)||((e=_r(this,co))==null||e.focus(),_r(this,xr)&&_r(this,xr)!==i.relatedTarget&&this.open&&(this.open=!1))};Oh=new WeakSet;wT=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=_r(this,co))==null||n.focus(),this.open=!1))};jn.shadowRootOptions={mode:"open"};jn.getTemplateHTML=KC;jn.getSlotTemplateHTML=VC;k.customElements.get("media-chrome-dialog")||k.customElements.define("media-chrome-dialog",jn);var xm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},He=(i,e,t)=>(xm(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)},Rs=(i,e,t,s)=>(xm(i,e,"write to private field"),e.set(i,t),t),mi=(i,e,t)=>(xm(i,e,"access private method"),t),wi,xu,Ml,Pl,pi,qd,Ol,Nl,Ul,km,MT,$l,Nh,Fl,Uh,Yd,Dm,$h,PT,Fh,OT,Bh,NT,Hh,UT;function WC(i){return`
620    <style>
621      :host {
622        --_focus-box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9));
623        --_media-range-padding: var(--media-range-padding, var(--media-control-padding, 10px));
624
625        box-shadow: var(--_focus-visible-box-shadow, none);
626        background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
627        height: calc(var(--media-control-height, 24px) + 2 * var(--_media-range-padding));
628        display: inline-flex;
629        align-items: center;
630        
631        vertical-align: middle;
632        box-sizing: border-box;
633        position: relative;
634        width: 100px;
635        transition: background .15s linear;
636        cursor: var(--media-cursor, pointer);
637        pointer-events: auto;
638        touch-action: none; 
639      }
640
641      
642      input[type=range]:focus {
643        outline: 0;
644      }
645      input[type=range]:focus::-webkit-slider-runnable-track {
646        outline: 0;
647      }
648
649      :host(:hover) {
650        background: var(--media-control-hover-background, rgb(50 50 70 / .7));
651      }
652
653      #leftgap {
654        padding-left: var(--media-range-padding-left, var(--_media-range-padding));
655      }
656
657      #rightgap {
658        padding-right: var(--media-range-padding-right, var(--_media-range-padding));
659      }
660
661      #startpoint,
662      #endpoint {
663        position: absolute;
664      }
665
666      #endpoint {
667        right: 0;
668      }
669
670      #container {
671        
672        width: var(--media-range-track-width, 100%);
673        transform: translate(var(--media-range-track-translate-x, 0px), var(--media-range-track-translate-y, 0px));
674        position: relative;
675        height: 100%;
676        display: flex;
677        align-items: center;
678        min-width: 40px;
679      }
680
681      #range {
682        
683        display: var(--media-time-range-hover-display, block);
684        bottom: var(--media-time-range-hover-bottom, -7px);
685        height: var(--media-time-range-hover-height, max(100% + 7px, 25px));
686        width: 100%;
687        position: absolute;
688        cursor: var(--media-cursor, pointer);
689
690        -webkit-appearance: none; 
691        -webkit-tap-highlight-color: transparent;
692        background: transparent; 
693        margin: 0;
694        z-index: 1;
695      }
696
697      @media (hover: hover) {
698        #range {
699          bottom: var(--media-time-range-hover-bottom, -5px);
700          height: var(--media-time-range-hover-height, max(100% + 5px, 20px));
701        }
702      }
703
704      
705      
706      #range::-webkit-slider-thumb {
707        -webkit-appearance: none;
708        background: transparent;
709        width: .1px;
710        height: .1px;
711      }
712
713      
714      #range::-moz-range-thumb {
715        background: transparent;
716        border: transparent;
717        width: .1px;
718        height: .1px;
719      }
720
721      #appearance {
722        height: var(--media-range-track-height, 4px);
723        display: flex;
724        flex-direction: column;
725        justify-content: center;
726        width: 100%;
727        position: absolute;
728        
729        will-change: transform;
730      }
731
732      #track {
733        background: var(--media-range-track-background, rgb(255 255 255 / .2));
734        border-radius: var(--media-range-track-border-radius, 1px);
735        border: var(--media-range-track-border, none);
736        outline: var(--media-range-track-outline);
737        outline-offset: var(--media-range-track-outline-offset);
738        backdrop-filter: var(--media-range-track-backdrop-filter);
739        -webkit-backdrop-filter: var(--media-range-track-backdrop-filter);
740        box-shadow: var(--media-range-track-box-shadow, none);
741        position: absolute;
742        width: 100%;
743        height: 100%;
744        overflow: hidden;
745      }
746
747      #progress,
748      #pointer {
749        position: absolute;
750        height: 100%;
751        will-change: width;
752      }
753
754      #progress {
755        background: var(--media-range-bar-color, var(--media-primary-color, rgb(238 238 238)));
756        transition: var(--media-range-track-transition);
757      }
758
759      #pointer {
760        background: var(--media-range-track-pointer-background);
761        border-right: var(--media-range-track-pointer-border-right);
762        transition: visibility .25s, opacity .25s;
763        visibility: hidden;
764        opacity: 0;
765      }
766
767      @media (hover: hover) {
768        :host(:hover) #pointer {
769          transition: visibility .5s, opacity .5s;
770          visibility: visible;
771          opacity: 1;
772        }
773      }
774
775      #thumb,
776      ::slotted([slot=thumb]) {
777        width: var(--media-range-thumb-width, 10px);
778        height: var(--media-range-thumb-height, 10px);
779        transition: var(--media-range-thumb-transition);
780        transform: var(--media-range-thumb-transform, none);
781        opacity: var(--media-range-thumb-opacity, 1);
782        translate: -50%;
783        position: absolute;
784        left: 0;
785        cursor: var(--media-cursor, pointer);
786      }
787
788      #thumb {
789        border-radius: var(--media-range-thumb-border-radius, 10px);
790        background: var(--media-range-thumb-background, var(--media-primary-color, rgb(238 238 238)));
791        box-shadow: var(--media-range-thumb-box-shadow, 1px 1px 1px transparent);
792        border: var(--media-range-thumb-border, none);
793      }
794
795      :host([disabled]) #thumb {
796        background-color: #777;
797      }
798
799      .segments #appearance {
800        height: var(--media-range-segment-hover-height, 7px);
801      }
802
803      #track {
804        clip-path: url(#segments-clipping);
805      }
806
807      #segments {
808        --segments-gap: var(--media-range-segments-gap, 2px);
809        position: absolute;
810        width: 100%;
811        height: 100%;
812      }
813
814      #segments-clipping {
815        transform: translateX(calc(var(--segments-gap) / 2));
816      }
817
818      #segments-clipping:empty {
819        display: none;
820      }
821
822      #segments-clipping rect {
823        height: var(--media-range-track-height, 4px);
824        y: calc((var(--media-range-segment-hover-height, 7px) - var(--media-range-track-height, 4px)) / 2);
825        transition: var(--media-range-segment-transition, transform .1s ease-in-out);
826        transform: var(--media-range-segment-transform, scaleY(1));
827        transform-origin: center;
828      }
829    </style>
830    <div id="leftgap"></div>
831    <div id="container">
832      <div id="startpoint"></div>
833      <div id="endpoint"></div>
834      <div id="appearance">
835        <div id="track" part="track">
836          <div id="pointer"></div>
837          <div id="progress" part="progress"></div>
838        </div>
839        <slot name="thumb">
840          <div id="thumb" part="thumb"></div>
841        </slot>
842        <svg id="segments"><clipPath id="segments-clipping"></clipPath></svg>
843      </div>
844      <input id="range" type="range" min="0" max="1" step="any" value="0">
845
846      ${this.getContainerTemplateHTML(i)}
847    </div>
848    <div id="rightgap"></div>
849  `}function qC(i){return""}class zn extends k.HTMLElement{constructor(){if(super(),vt(this,km),vt(this,$l),vt(this,Fl),vt(this,Yd),vt(this,$h),vt(this,Fh),vt(this,Bh),vt(this,Hh),vt(this,wi,void 0),vt(this,xu,void 0),vt(this,Ml,void 0),vt(this,Pl,void 0),vt(this,pi,{}),vt(this,qd,[]),vt(this,Ol,()=>{if(this.range.matches(":focus-visible")){const{style:e}=ct(this.shadowRoot,":host");e.setProperty("--_focus-visible-box-shadow","var(--_focus-box-shadow)")}}),vt(this,Nl,()=>{const{style:e}=ct(this.shadowRoot,":host");e.removeProperty("--_focus-visible-box-shadow")}),vt(this,Ul,()=>{const e=this.shadowRoot.querySelector("#segments-clipping");e&&e.parentNode.append(e)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=jt(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}this.container=this.shadowRoot.querySelector("#container"),Rs(this,Ml,this.shadowRoot.querySelector("#startpoint")),Rs(this,Pl,this.shadowRoot.querySelector("#endpoint")),this.range=this.shadowRoot.querySelector("#range"),this.appearance=this.shadowRoot.querySelector("#appearance")}static get observedAttributes(){return["disabled","aria-disabled",Ae.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Ae.MEDIA_CONTROLLER?(t&&((n=(r=He(this,wi))==null?void 0:r.unassociateElement)==null||n.call(r,this),Rs(this,wi,null)),s&&this.isConnected&&(Rs(this,wi,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=He(this,wi))==null?void 0:o.associateElement)==null||l.call(o,this))):(e==="disabled"||e==="aria-disabled"&&t!==s)&&(s==null?(this.range.removeAttribute(e),mi(this,$l,Nh).call(this)):(this.range.setAttribute(e,s),mi(this,Fl,Uh).call(this)))}connectedCallback(){var e,t,s;const{style:r}=ct(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),He(this,pi).pointer=ct(this.shadowRoot,"#pointer"),He(this,pi).progress=ct(this.shadowRoot,"#progress"),He(this,pi).thumb=ct(this.shadowRoot,'#thumb, ::slotted([slot="thumb"])'),He(this,pi).activeSegment=ct(this.shadowRoot,"#segments-clipping rect:nth-child(0)");const n=this.getAttribute(Ae.MEDIA_CONTROLLER);n&&(Rs(this,wi,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(s=(t=He(this,wi))==null?void 0:t.associateElement)==null||s.call(t,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",He(this,Ol)),this.shadowRoot.addEventListener("focusout",He(this,Nl)),mi(this,$l,Nh).call(this),Hn(this.container,He(this,Ul))}disconnectedCallback(){var e,t;mi(this,Fl,Uh).call(this),(t=(e=He(this,wi))==null?void 0:e.unassociateElement)==null||t.call(e,this),Rs(this,wi,null),this.shadowRoot.removeEventListener("focusin",He(this,Ol)),this.shadowRoot.removeEventListener("focusout",He(this,Nl)),Gn(this.container,He(this,Ul))}updatePointerBar(e){var t;(t=He(this,pi).pointer)==null||t.style.setProperty("width",`${this.getPointerRatio(e)*100}%`)}updateBar(){var e,t;const s=this.range.valueAsNumber*100;(e=He(this,pi).progress)==null||e.style.setProperty("width",`${s}%`),(t=He(this,pi).thumb)==null||t.style.setProperty("left",`${s}%`)}updateSegments(e){const t=this.shadowRoot.querySelector("#segments-clipping");if(t.textContent="",this.container.classList.toggle("segments",!!e?.length),!e?.length)return;const s=[...new Set([+this.range.min,...e.flatMap(n=>[n.start,n.end]),+this.range.max])];Rs(this,qd,[...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=rt.createElementNS("http://www.w3.org/2000/svg","rect"),f=pm(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 $D(e.clientX,e.clientY,He(this,Ml).getBoundingClientRect(),He(this,Pl).getBoundingClientRect())}get dragging(){return this.hasAttribute("dragging")}handleEvent(e){switch(e.type){case"pointermove":mi(this,Hh,UT).call(this,e);break;case"input":this.updateBar();break;case"pointerenter":mi(this,$h,PT).call(this,e);break;case"pointerdown":mi(this,Yd,Dm).call(this,e);break;case"pointerup":mi(this,Fh,OT).call(this);break;case"pointerleave":mi(this,Bh,NT).call(this);break}}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}}wi=new WeakMap;xu=new WeakMap;Ml=new WeakMap;Pl=new WeakMap;pi=new WeakMap;qd=new WeakMap;Ol=new WeakMap;Nl=new WeakMap;Ul=new WeakMap;km=new WeakSet;MT=function(i){const e=He(this,pi).activeSegment;if(!e)return;const t=this.getPointerRatio(i),r=`#segments-clipping rect:nth-child(${He(this,qd).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))"))};$l=new WeakSet;Nh=function(){this.hasAttribute("disabled")||(this.addEventListener("input",this),this.addEventListener("pointerdown",this),this.addEventListener("pointerenter",this))};Fl=new WeakSet;Uh=function(){var i,e;this.removeEventListener("input",this),this.removeEventListener("pointerdown",this),this.removeEventListener("pointerenter",this),(i=k.window)==null||i.removeEventListener("pointerup",this),(e=k.window)==null||e.removeEventListener("pointermove",this)};Yd=new WeakSet;Dm=function(i){var e;Rs(this,xu,i.composedPath().includes(this.range)),(e=k.window)==null||e.addEventListener("pointerup",this)};$h=new WeakSet;PT=function(i){var e;i.pointerType!=="mouse"&&mi(this,Yd,Dm).call(this,i),this.addEventListener("pointerleave",this),(e=k.window)==null||e.addEventListener("pointermove",this)};Fh=new WeakSet;OT=function(){var i;(i=k.window)==null||i.removeEventListener("pointerup",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled")};Bh=new WeakSet;NT=function(){var i,e;this.removeEventListener("pointerleave",this),(i=k.window)==null||i.removeEventListener("pointermove",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled"),(e=He(this,pi).activeSegment)==null||e.style.removeProperty("transform")};Hh=new WeakSet;UT=function(i){i.pointerType==="pen"&&i.buttons===0||(this.toggleAttribute("dragging",i.buttons===1||i.pointerType!=="mouse"),this.updatePointerBar(i),mi(this,km,MT).call(this,i),this.dragging&&(i.pointerType!=="mouse"||!He(this,xu))&&(this.range.disabled=!0,this.range.valueAsNumber=this.getPointerRatio(i),this.range.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))))};zn.shadowRootOptions={mode:"open"};zn.getTemplateHTML=WC;zn.getContainerTemplateHTML=qC;k.customElements.get("media-chrome-range")||k.customElements.define("media-chrome-range",zn);var $T=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},jo=(i,e,t)=>($T(i,e,"read from private field"),t?t.call(i):e.get(i)),YC=(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)},zo=(i,e,t,s)=>($T(i,e,"write to private field"),e.set(i,t),t),Mi;function jC(i){return`
850    <style>
851      :host {
852        
853        box-sizing: border-box;
854        display: var(--media-control-display, var(--media-control-bar-display, inline-flex));
855        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
856        --media-loading-indicator-icon-height: 44px;
857      }
858
859      ::slotted(media-time-range),
860      ::slotted(media-volume-range) {
861        min-height: 100%;
862      }
863
864      ::slotted(media-time-range),
865      ::slotted(media-clip-selector) {
866        flex-grow: 1;
867      }
868
869      ::slotted([role="menu"]) {
870        position: absolute;
871      }
872    </style>
873
874    <slot></slot>
875  `}class Cm extends k.HTMLElement{constructor(){if(super(),YC(this,Mi,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=jt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Ae.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Ae.MEDIA_CONTROLLER&&(t&&((n=(r=jo(this,Mi))==null?void 0:r.unassociateElement)==null||n.call(r,this),zo(this,Mi,null)),s&&this.isConnected&&(zo(this,Mi,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=jo(this,Mi))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s;const r=this.getAttribute(Ae.MEDIA_CONTROLLER);r&&(zo(this,Mi,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(s=(t=jo(this,Mi))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=jo(this,Mi))==null?void 0:e.unassociateElement)==null||t.call(e,this),zo(this,Mi,null)}}Mi=new WeakMap;Cm.shadowRootOptions={mode:"open"};Cm.getTemplateHTML=jC;k.customElements.get("media-control-bar")||k.customElements.define("media-control-bar",Cm);var FT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Qo=(i,e,t)=>(FT(i,e,"read from private field"),t?t.call(i):e.get(i)),zC=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Xo=(i,e,t,s)=>(FT(i,e,"write to private field"),e.set(i,t),t),Pi;function QC(i,e={}){return`
876    <style>
877      :host {
878        font: var(--media-font,
879          var(--media-font-weight, normal)
880          var(--media-font-size, 14px) /
881          var(--media-text-content-height, var(--media-control-height, 24px))
882          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
883        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
884        background: var(--media-text-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))));
885        padding: var(--media-control-padding, 10px);
886        display: inline-flex;
887        justify-content: center;
888        align-items: center;
889        vertical-align: middle;
890        box-sizing: border-box;
891        text-align: center;
892        pointer-events: auto;
893      }
894
895      
896      :host(:focus-visible) {
897        box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9);
898        outline: 0;
899      }
900
901      
902      :host(:where(:focus)) {
903        box-shadow: none;
904        outline: 0;
905      }
906    </style>
907
908    ${this.getSlotTemplateHTML(i,e)}
909  `}function XC(i,e){return`
910    <slot></slot>
911  `}class qs extends k.HTMLElement{constructor(){if(super(),zC(this,Pi,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=jt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Ae.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Ae.MEDIA_CONTROLLER&&(t&&((n=(r=Qo(this,Pi))==null?void 0:r.unassociateElement)==null||n.call(r,this),Xo(this,Pi,null)),s&&this.isConnected&&(Xo(this,Pi,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=Qo(this,Pi))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s;const{style:r}=ct(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`);const n=this.getAttribute(Ae.MEDIA_CONTROLLER);n&&(Xo(this,Pi,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(s=(t=Qo(this,Pi))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=Qo(this,Pi))==null?void 0:e.unassociateElement)==null||t.call(e,this),Xo(this,Pi,null)}}Pi=new WeakMap;qs.shadowRootOptions={mode:"open"};qs.getTemplateHTML=QC;qs.getSlotTemplateHTML=XC;k.customElements.get("media-text-display")||k.customElements.define("media-text-display",qs);var BT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},I0=(i,e,t)=>(BT(i,e,"read from private field"),t?t.call(i):e.get(i)),ZC=(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)},JC=(i,e,t,s)=>(BT(i,e,"write to private field"),e.set(i,t),t),Ia;function ew(i,e){return`
912    <slot>${Gs(e.mediaDuration)}</slot>
913  `}class HT extends qs{constructor(){var e;super(),ZC(this,Ia,void 0),JC(this,Ia,this.shadowRoot.querySelector("slot")),I0(this,Ia).textContent=Gs((e=this.mediaDuration)!=null?e:0)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_DURATION]}attributeChangedCallback(e,t,s){e===_.MEDIA_DURATION&&(I0(this,Ia).textContent=Gs(+s)),super.attributeChangedCallback(e,t,s)}get mediaDuration(){return Oe(this,_.MEDIA_DURATION)}set mediaDuration(e){Ye(this,_.MEDIA_DURATION,e)}}Ia=new WeakMap;HT.getSlotTemplateHTML=ew;k.customElements.get("media-duration-display")||k.customElements.define("media-duration-display",HT);const tw={2:J("Network Error"),3:J("Decode Error"),4:J("Source Not Supported"),5:J("Encryption 
913Error")},iw={2:J("A network error caused the media download to fail."),3:J("A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format."),4:J("An unsupported error occurred. The server or network failed, or your browser does not support this format."),5:J("The media is encrypted and there are no keys to decrypt it.")},GT=i=>{var e,t;return i.code===1?null:{title:(e=tw[i.code])!=null?e:`Error ${i.code}`,message:(t=iw[i.code])!=null?t:i.message}};var KT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},sw=(i,e,t)=>(KT(i,e,"read from private field"),t?t.call(i):e.get(i)),rw=(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)},nw=(i,e,t,s)=>(KT(i,e,"write to private field"),e.set(i,t),t),Bl;function aw(i){return`
914    <style>
915      :host {
916        background: rgb(20 20 30 / .8);
917      }
918
919      #content {
920        display: block;
921        padding: 1.2em 1.5em;
922      }
923
924      h3,
925      p {
926        margin-block: 0 .3em;
927      }
928    </style>
929    <slot name="error-${i.mediaerrorcode}" id="content">
930      ${VT({code:+i.mediaerrorcode,message:i.mediaerrormessage})}
931    </slot>
932  `}function ow(i){return i.code&&GT(i)!==null}function VT(i){var e;const{title:t,message:s}=(e=GT(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 L0=[_.MEDIA_ERROR_CODE,_.MEDIA_ERROR_MESSAGE];class ku extends jn{constructor(){super(...arguments),rw(this,Bl,null)}static get observedAttributes(){return[...super.observedAttributes,...L0]}formatErrorMessage(e){return this.constructor.formatErrorMessage(e)}attributeChangedCallback(e,t,s){var r;if(super.attributeChangedCallback(e,t,s),!L0.includes(e))return;const n=(r=this.mediaError)!=null?r:{code:this.mediaErrorCode,message:this.mediaErrorMessage};this.open=ow(n),this.open&&(this.shadowRoot.querySelector("slot").name=`error-${this.mediaErrorCode}`,this.shadowRoot.querySelector("#content").innerHTML=this.formatErrorMessage(n))}get mediaError(){return sw(this,Bl)}set mediaError(e){nw(this,Bl,e)}get mediaErrorCode(){return Oe(this,"mediaerrorcode")}set mediaErrorCode(e){Ye(this,"mediaerrorcode",e)}get mediaErrorMessage(){return Ne(this,"mediaerrormessage")}set mediaErrorMessage(e){Ue(this,"mediaerrormessage",e)}}Bl=new WeakMap;ku.getSlotTemplateHTML=aw;ku.formatErrorMessage=VT;k.customElements.get("media-error-dialog")||k.customElements.define("media-error-dialog",ku);var WT=ku,lw=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ss=(i,e,t)=>(lw(i,e,"read from private field"),t?t.call(i):e.get(i)),R0=(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)},tn,sn;function dw(i){return`
933    <style>
934      :host {
935        position: fixed;
936        top: 0;
937        left: 0;
938        z-index: 9999;
939        background: rgb(20 20 30 / .8);
940        backdrop-filter: blur(10px);
941      }
942
943      #content {
944        display: block;
945        width: clamp(400px, 40vw, 700px);
946        max-width: 90vw;
947        text-align: left;
948      }
949
950      h2 {
951        margin: 0 0 1.5rem 0;
952        font-size: 1.5rem;
953        font-weight: 500;
954        text-align: center;
955      }
956
957      .shortcuts-table {
958        width: 100%;
959        border-collapse: collapse;
960      }
961
962      .shortcuts-table tr {
963        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
964      }
965
966      .shortcuts-table tr:last-child {
967        border-bottom: none;
968      }
969
970      .shortcuts-table td {
971        padding: 0.75rem 0.5rem;
972      }
973
974      .shortcuts-table td:first-child {
975        text-align: right;
976        padding-right: 1rem;
977        width: 40%;
978        min-width: 120px;
979      }
980
981      .shortcuts-table td:last-child {
982        padding-left: 1rem;
983      }
984
985      .key {
986        display: inline-block;
987        background: rgba(255, 255, 255, 0.15);
988        border: 1px solid rgba(255, 255, 255, 0.2);
989        border-radius: 4px;
990        padding: 0.25rem 0.5rem;
991        font-family: 'Courier New', monospace;
992        font-size: 0.9rem;
993        font-weight: 500;
994        min-width: 1.5rem;
995        text-align: center;
996        margin: 0 0.2rem;
997      }
998
999      .description {
1000        color: rgba(255, 255, 255, 0.9);
1001        font-size: 0.95rem;
1002      }
1003
1004      .key-combo {
1005        display: flex;
1006        align-items: center;
1007        justify-content: flex-end;
1008        gap: 0.3rem;
1009      }
1010
1011      .key-separator {
1012        color: rgba(255, 255, 255, 0.5);
1013        font-size: 0.9rem;
1014      }
1015    </style>
1016    <slot id="content">
1017      ${uw()}
1018    </slot>
1019  `}function uw(){return`
1020    <h2>Keyboard Shortcuts</h2>
1021    <table class="shortcuts-table">${[{keys:["Space","k"],description:"Toggle Playback"},{keys:["m"],description:"Toggle mute"},{keys:["f"],description:"Toggle fullscreen"},{keys:["c"],description:"Toggle captions or subtitles, if available"},{keys:["p"],description:"Toggle Picture in Picture"},{keys:["←","j"],description:"Seek back 10s"},{keys:["→","l"],description:"Seek forward 10s"},{keys:["↑"],description:"Turn volume up"},{keys:["↓"],description:"Turn volume down"},{keys:["< (SHIFT+,)"],description:"Decrease playback rate"},{keys:["> (SHIFT+.)"],description:"Increase playback rate"}].map(({keys:t,description:s})=>`
1022      <tr>
1023        <td>
1024          <div class="key-combo">${t.map((n,a)=>a>0?`<span class="key-separator">or</span><span class="key">${n}</span>`:`<span class="key">${n}</span>`).join("")}</div>
1025        </td>
1026        <td class="description">${s}</td>
1027      </tr>
1028    `).join("")}</table>
1029  `}class qT extends jn{constructor(){super(...arguments),R0(this,tn,e=>{var t;if(!this.open)return;const s=(t=this.shadowRoot)==null?void 0:t.querySelector("#content");
vendor: 4,223 bytes, lines 1029-1069
1029if(!s)return;const r=e.composedPath(),n=r[0]===this||r.includes(this),a=r.includes(s);n&&!a&&(this.open=!1)}),R0(this,sn,e=>{if(!this.open)return;const t=e.shiftKey&&(e.key==="/"||e.key==="?");(e.key==="Escape"||t)&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&(this.open=!1,e.preventDefault(),e.stopPropagation())})}connectedCallback(){super.connectedCallback(),this.open&&(this.addEventListener("click",Ss(this,tn)),document.addEventListener("keydown",Ss(this,sn)))}disconnectedCallback(){this.removeEventListener("click",Ss(this,tn)),document.removeEventListener("keydown",Ss(this,sn))}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e==="open"&&(this.open?(this.addEventListener("click",Ss(this,tn)),document.addEventListener("keydown",Ss(this,sn))):(this.removeEventListener("click",Ss(this,tn)),document.removeEventListener("keydown",Ss(this,sn))))}}tn=new WeakMap;sn=new WeakMap;qT.getSlotTemplateHTML=dw;k.customElements.get("media-keyboard-shortcuts-dialog")||k.customElements.define("media-keyboard-shortcuts-dialog",qT);var YT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},cw=(i,e,t)=>(YT(i,e,"read from private field"),e.get(i)),hw=(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)},fw=(i,e,t,s)=>(YT(i,e,"write to private field"),e.set(i,t),t),Hl;const mw=`<svg aria-hidden="true" viewBox="0 0 26 24">
1030  <path d="M16 3v2.5h3.5V9H22V3h-6ZM4 9h2.5V5.5H10V3H4v6Zm15.5 9.5H16V21h6v-6h-2.5v3.5ZM6.5 15H4v6h6v-2.5H6.5V15Z"/>
1031</svg>`,pw=`<svg aria-hidden="true" viewBox="0 0 26 24">
1032  <path d="M18.5 6.5V3H16v6h6V6.5h-3.5ZM16 21h2.5v-3.5H22V15h-6v6ZM4 17.5h3.5V21H10v-6H4v2.5Zm3.5-11H4V9h6V3H7.5v3.5Z"/>
1033</svg>`;function gw(i){return`
1034    <style>
1035      :host([${_.MEDIA_IS_FULLSCREEN}]) slot[name=icon] slot:not([name=exit]) {
1036        display: none !important;
1037      }
1038
1039      
1040      :host(:not([${_.MEDIA_IS_FULLSCREEN}])) slot[name=icon] slot:not([name=enter]) {
1041        display: none !important;
1042      }
1043
1044      :host([${_.MEDIA_IS_FULLSCREEN}]) slot[name=tooltip-enter],
1045      :host(:not([${_.MEDIA_IS_FULLSCREEN}])) slot[name=tooltip-exit] {
1046        display: none;
1047      }
1048    </style>
1049
1050    <slot name="icon">
1051      <slot name="enter">${mw}</slot>
1052      <slot name="exit">${pw}</slot>
1053    </slot>
1054  `}function vw(){return`
1055    <slot name="tooltip-enter">${J("Enter fullscreen mode")}</slot>
1056    <slot name="tooltip-exit">${J("Exit fullscreen mode")}</slot>
1057  `}const x0=i=>{const e=i.mediaIsFullscreen?J("exit fullscreen mode"):J("enter fullscreen mode");i.setAttribute("aria-label",e)};class wm extends gt{constructor(){super(...arguments),hw(this,Hl,null)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_IS_FULLSCREEN,_.MEDIA_FULLSCREEN_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),x0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_IS_FULLSCREEN&&x0(this)}get mediaFullscreenUnavailable(){return Ne(this,_.MEDIA_FULLSCREEN_UNAVAILABLE)}set mediaFullscreenUnavailable(e){Ue(this,_.MEDIA_FULLSCREEN_UNAVAILABLE,e)}get mediaIsFullscreen(){return ve(this,_.MEDIA_IS_FULLSCREEN)}set mediaIsFullscreen(e){Ee(this,_.MEDIA_IS_FULLSCREEN,e)}handleClick(e){fw(this,Hl,e);const t=cw(this,Hl)instanceof PointerEvent,s=this.mediaIsFullscreen?new k.CustomEvent(q.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0}):new k.CustomEvent(q.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0,detail:t});this.dispatchEvent(s)}}Hl=new WeakMap;wm.getSlotTemplateHTML=gw;wm.getTooltipContentHTML=vw;k.customElements.get("media-fullscreen-button")||k.customElements.define("media-fullscreen-button",wm);const{MEDIA_TIME_IS_LIVE:Gl,MEDIA_PAUSED:Ka}=_,{MEDIA_SEEK_TO_LIVE_REQUEST:Ew,MEDIA_PLAY_REQUEST:yw}=q,Tw='<svg viewBox="0 0 6 12"><circle cx="3" cy="6" r="2"></circle></svg>';function bw(i){return`
1058    <style>
1059      :host { --media-tooltip-display: none; }
1060      
1061      slot[name=indicator] > *,
1062      :host ::slotted([slot=indicator]) {
1063        
1064        min-width: auto;
1065        fill: var(--media-live-button-icon-color, rgb(140, 140, 140));
1066        color: var(--media-live-button-icon-color, rgb(140, 140, 140));
1067      }
1068
1069      :host([${Gl}
1069]:not([${Ka}])) slot[name=indicator] > *,
1070      :host([${Gl}]:not([${Ka}])) ::slotted([slot=indicator]) {
1071        fill: var(--media-live-button-indicator-color, rgb(255, 0, 0));
1072        color: var(--media-live-button-indicator-color, rgb(255, 0, 0));
1073      }
1074
1075      :host([${Gl}]:not([${Ka}])) {
1076        cursor: var(--media-cursor, not-allowed);
1077      }
1078
1079      slot[name=text]{
1080        text-transform: uppercase;
1081      }
1082
1083    </style>
1084
1085    <slot name="indicator">${Tw}</slot>
1086    
1087    <slot name="spacer">&nbsp;</slot><slot name="text">${J("live")}</slot>
1088  `}const k0=i=>{var e;const t=i.mediaPaused||!i.mediaTimeIsLive,s=J(t?"seek to live":"playing live");i.setAttribute("aria-label",s);const r=(e=i.shadowRoot)==null?void 0:e.querySelector('slot[name="text"]');r&&(r.textContent=J("live")),t?i.removeAttribute("aria-disabled"):i.setAttribute("aria-disabled","true")};class jT extends gt{static get observedAttributes(){return[...super.observedAttributes,Gl,Ka]}connectedCallback(){super.connectedCallback(),k0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),k0(this)}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}get mediaTimeIsLive(){return ve(this,_.MEDIA_TIME_IS_LIVE)}set mediaTimeIsLive(e){Ee(this,_.MEDIA_TIME_IS_LIVE,e)}handleClick(){!this.mediaPaused&&this.mediaTimeIsLive||(this.dispatchEvent(new k.CustomEvent(Ew,{composed:!0,bubbles:!0})),this.hasAttribute(Ka)&&this.dispatchEvent(new k.CustomEvent(yw,{composed:!0,bubbles:!0})))}}jT.getSlotTemplateHTML=bw;k.customElements.get("media-live-button")||k.customElements.define("media-live-button",jT);var zT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},sa=(i,e,t)=>(zT(i,e,"read from private field"),t?t.call(i):e.get(i)),D0=(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)},ra=(i,e,t,s)=>(zT(i,e,"write to private field"),e.set(i,t),t),Oi,Kl;const Zo={LOADING_DELAY:"loadingdelay",NO_AUTOHIDE:"noautohide"},QT=500,_w=`
1089<svg aria-hidden="true" viewBox="0 0 100 100">
1090  <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">
1091    <animateTransform
1092       attributeName="transform"
1093       attributeType="XML"
1094       type="rotate"
1095       dur="1s"
1096       from="0 50 50"
1097       to="360 50 50"
1098       repeatCount="indefinite" />
1099  </path>
1100</svg>
1101`;function Aw(i){return`
1102    <style>
1103      :host {
1104        display: var(--media-control-display, var(--media-loading-indicator-display, inline-block));
1105        vertical-align: middle;
1106        box-sizing: border-box;
1107        --_loading-indicator-delay: var(--media-loading-indicator-transition-delay, ${QT}ms);
1108      }
1109
1110      #status {
1111        color: rgba(0,0,0,0);
1112        width: 0px;
1113        height: 0px;
1114      }
1115
1116      :host slot[name=icon] > *,
1117      :host ::slotted([slot=icon]) {
1118        opacity: var(--media-loading-indicator-opacity, 0);
1119        transition: opacity 0.15s;
1120      }
1121
1122      :host([${_.MEDIA_LOADING}]:not([${_.MEDIA_PAUSED}])) slot[name=icon] > *,
1123      :host([${_.MEDIA_LOADING}]:not([${_.MEDIA_PAUSED}])) ::slotted([slot=icon]) {
1124        opacity: var(--media-loading-indicator-opacity, 1);
1125        transition: opacity 0.15s var(--_loading-indicator-delay);
1126      }
1127
1128      :host #status {
1129        visibility: var(--media-loading-indicator-opacity, hidden);
1130        transition: visibility 0.15s;
1131      }
1132
1133      :host([${_.MEDIA_LOADING}]:not([${_.MEDIA_PAUSED}])) #status {
1134        visibility: var(--media-loading-indicator-opacity, visible);
1135        transition: visibility 0.15s var(--_loading-indicator-delay);
1136      }
1137
1138      svg, img, ::slotted(svg), ::slotted(img) {
1139        width: var(--media-loading-indicator-icon-width);
1140        height: var(--media-loading-indicator-icon-height, 100px);
1141        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
1142        vertical-align: middle;
1143      }
1144    </style>
1145
1146    <slot name="icon">${_w}</slot>
1147    <div id="status" role="status" aria-live="polite">${J("media loading")}</div>
1148  `}class Mm extends k.HTMLElement{constructor(){if(super(),D0(this,Oi,void 0),D0(this,Kl,QT),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=jt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Ae.MEDIA_CONTROLLER,_.MEDIA_PAUSED,_.MEDIA_LOADING,Zo.LOADING_DELAY]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Zo.LOADING_DELAY&&t!==s?this.loadingDelay=Number(s):e===Ae.MEDIA_CONTROLLER&&(t&&((n=(r=sa(this,Oi))==null?void 0:r.unassociateElement)==null||n.call(r,this),ra(this,Oi,null)),s&&this.isConnected&&(ra(this,Oi,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=sa(this,Oi))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s;const r=this.getAttribute(Ae.MEDIA_CONTROLLER);r&&(ra(this,Oi,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(s=(t=sa(this,Oi))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=sa(this,Oi))==null?void 0:e.unassociateElement)==null||t.call(e,this),ra(this,Oi,null)}get loadingDelay(){return sa(this,Kl)}set loadingDelay(e){ra(this,Kl,e);const{style:t}=ct(this.shadowRoot,":host");t.setProperty("--_loading-indicator-delay",`var(--media-loading-indicator-transition-delay, ${e}ms)`)}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}get mediaLoading(){return ve(this,_.MEDIA_LOADING)}set mediaLoading(e){Ee(this,_.MEDIA_LOADING,e)}get mediaController(){return Ne(this,Ae.MEDIA_CONTROLLER)}set mediaController(e){Ue(this,Ae.MEDIA_CONTROLLER,e)}get noAutohide(){return ve(this,Zo.NO_AUTOHIDE)}set noAutohide(e){Ee(this,Zo.NO_AUTOHIDE,e)}}Oi=new WeakMap;Kl=new WeakMap;Mm.shadowRootOptions={mode:"open"};Mm.getTemplateHTML=Aw;k.customElements.get("media-loading-indicator")||k.customElements.define("media-loading-indicator",Mm);const Sw=`<svg aria-hidden="true" viewBox="0 0 24 24">
1149  <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"/>
1150</svg>`,C0=`<svg aria-hidden="true" viewBox="0 0 24 24">
1151  <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"/>
1152</svg>`,Iw=`<svg aria-hidden="true" viewBox="0 0 24 24">
1153  <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"/>
1154</svg>`;function Lw(i){return`
1155    <style>
1156      :host(:not([${_.MEDIA_VOLUME_LEVEL}])) slot[name=icon] slot:not([name=high]),
1157      :host([${_.MEDIA_VOLUME_LEVEL}=high]) slot[name=icon] slot:not([name=high]) {
1158        display: none !important;
1159      }
1160
1161      :host([${_.MEDIA_VOLUME_LEVEL}=off]) slot[name=icon] slot:not([name=off]) {
1162        display: none !important;
1163      }
1164
1165      :host([${_.MEDIA_VOLUME_LEVEL}=low]) slot[name=icon] slot:not([name=low]) {
1166        display: none !important;
1167      }
1168
1169      :host([${_.MEDIA_VOLUME_LEVEL}=medium]) slot[name=icon] slot:not([name=medium]) {
1170        display: none !important;
1171      }
1172
1173      :host(:not([${_.MEDIA_VOLUME_LEVEL}=off])) slot[name=tooltip-unmute],
1174      :host([${_.MEDIA_VOLUME_LEVEL}=off]) slot[name=tooltip-mute] {
1175        display: none;
1176      }
1177    </style>
1178
1179    <slot name="icon">
1180      <slot name="off">${Sw}</slot>
1181      <slot name="low">${C0}</slot>
1182      <slot name="medium">${C0}</slot>
1183      <slot name="high">${Iw}</slot>
1184    </slot>
1185  `}function Rw(){return`
1186    <slot name="tooltip-mute">${J("Mute")}</slot>
1187    <slot name="tooltip-unmute">${J("Unmute")}</slot>
1188  `}const w0=i=>{const e=i.mediaVolumeLevel==="off",t=J(e?"unmute":"mute");i.setAttribute("aria-label",t)};class Pm extends gt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_VOLUME_LEVEL]}connectedCallback(){super.connectedCallback(),w0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_VOLUME_LEVEL&&w0(this)}get mediaVolumeLevel(){return Ne(this,_.MEDIA_VOLUME_LEVEL)}set mediaVolumeLevel(e){Ue(this,_.MEDIA_VOLUME_LEVEL,e)}handleClick(){const e=this.mediaVolumeLevel==="off"?q.MEDIA_UNMUTE_REQUEST:q.MEDIA_MUTE_REQUEST;this.dispatchEvent(new k.CustomEvent(e,{composed:!0,bubbles:!0}))}}Pm.getSlotTemplateHTML=Lw;Pm.getTooltipContentHTML=Rw;k.customElements.get("media-mute-button")||k.customElements.define("media-mute-button",Pm);const M0=`<svg aria-hidden="true" viewBox="0 0 28 24">
1189  <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"/>
1190</svg>`;function xw(i){return`
1191    <style>
1192      :host([${_.MEDIA_IS_PIP}]) slot[name=icon] slot:not([name=exit]) {
1193        display: none !important;
1194      }
1195
1196      :host(:not([${_.MEDIA_IS_PIP}])) slot[name=icon] slot:not([name=enter]) {
1197        display: none !important;
1198      }
1199
1200      :host([${_.MEDIA_IS_PIP}]) slot[name=tooltip-enter],
1201      :host(:not([${_.MEDIA_IS_PIP}])) slot[name=tooltip-exit] {
1202        display: none;
1203      }
1204    </style>
1205
1206    <slot name="icon">
1207      <slot name="enter">${M0}</slot>
1208      <slot name="exit">${M0}</slot>
1209    </slot>
1210  `}function kw(){return`
1211    <slot name="tooltip-enter">${J("Enter picture in picture mode")}</slot>
1212    <slot name="tooltip-exit">${J("Exit picture in picture mode")}</slot>
1213  `}const P0=i=>{const e=i.mediaIsPip?J("exit picture in picture mode"):J("enter picture in picture mode");i.setAttribute("aria-label",e)};class Om extends gt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_IS_PIP,_.MEDIA_PIP_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),P0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_IS_PIP&&P0(this)}get mediaPipUnavailable(){return Ne(this,_.MEDIA_PIP_UNAVAILABLE)}set mediaPipUnavailable(e){Ue(this,_.MEDIA_PIP_UNAVAILABLE,e)}get mediaIsPip(){return ve(this,_.MEDIA_IS_PIP)}set mediaIsPip(e){Ee(this,_.MEDIA_IS_PIP,e)}handleClick(){const e=this.mediaIsPip?q.MEDIA_EXIT_PIP_REQUEST:q.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new k.CustomEvent(e,{composed:!0,bubbles:!0}))}}Om.getSlotTemplateHTML=xw;Om.getTooltipContentHTML=kw;k.customElements.get("media-pip-button")||k.customElements.define("media-pip-button",Om);var Dw=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Hr=(i,e,t)=>(Dw(i,e,"read from private field"),t?t.call(i):e.get(i)),Cw=(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)},xs;const Tc={RATES:"rates"},XT=[1,1.2,1.5,1.7,2],_n=1;function ww(i){return`
1214    <style>
1215      :host {
1216        min-width: 5ch;
1217        padding: var(--media-button-padding, var(--media-control-padding, 10px 5px));
1218      }
1219    </style>
1220    <slot name="icon">${i.mediaplaybackrate||_n}x</slot>
1221  `}function Mw(){return J("Playback rate")}class Nm extends gt{constructor(){var e;super(),Cw(this,xs,new Em(this,Tc.RATES,{defaultValue:XT})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${(e=this.mediaPlaybackRate)!=null?e:_n}x`}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PLAYBACK_RATE,Tc.RATES]}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),e===Tc.RATES&&(Hr(this,xs).value=s),e===_.MEDIA_PLAYBACK_RATE){const r=s?+s:Number.NaN,n=Number.isNaN(r)?_n:r;this.container.innerHTML=`${n}x`,this.setAttribute("aria-label",J("Playback rate {playbackRate}",{playbackRate:n}))}}get rates(){return Hr(this,xs)}set rates(e){e?Array.isArray(e)?Hr(this,xs).value=e.join(" "):typeof e=="string"&&(Hr(this,xs).value=e):Hr(this,xs).value=""}get mediaPlaybackRate(){return Oe(this,_.MEDIA_PLAYBACK_RATE,_n)}set mediaPlaybackRate(e){Ye(this,_.MEDIA_PLAYBACK_RATE,e)}handleClick(){var e,t;const s=Array.from(Hr(this,xs).values(),a=>+a).sort((a,o)=>a-o),r=(t=(e=s.find(a=>a>this.mediaPlaybackRate))!=null?e:s[0])!=null?t:_n,n=new k.CustomEvent(q.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(n)}}xs=new WeakMap;Nm.getSlotTemplateHTML=ww;Nm.getTooltipContentHTML=Mw;k.customElements.get("media-playback-rate-button")||k.customElements.define("media-playback-rate-button",Nm);const Pw=`<svg aria-hidden="true" viewBox="0 0 24 24">
1222  <path d="m6 21 15-9L6 3v18Z"/>
1223</svg>`,Ow=`<svg aria-hidden="true" viewBox="0 0 24 24">
1224  <path d="M6 20h4V4H6v16Zm8-16v16h4V4h-4Z"/>
1225</svg>`;function Nw(i){return`
1226    <style>
1227      :host([${_.MEDIA_PAUSED}]) slot[name=pause],
1228      :host(:not([${_.MEDIA_PAUSED}])) slot[name=play] {
1229        display: none !important;
1230      }
1231
1232      :host([${_.MEDIA_PAUSED}]) slot[name=tooltip-pause],
1233      :host(:not([${_.MEDIA_PAUSED}
1233])) slot[name=tooltip-play] {
1234        display: none;
1235      }
1236    </style>
1237
1238    <slot name="icon">
1239      <slot name="play">${Pw}</slot>
1240      <slot name="pause">${Ow}</slot>
1241    </slot>
1242  `}function Uw(){return`
1243    <slot name="tooltip-play">${J("Play")}</slot>
1244    <slot name="tooltip-pause">${J("Pause")}</slot>
1245  `}const O0=i=>{const e=i.mediaPaused?J("play"):J("pause");i.setAttribute("aria-label",e)};class Um extends gt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PAUSED,_.MEDIA_ENDED]}connectedCallback(){super.connectedCallback(),O0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),(e===_.MEDIA_PAUSED||e===_.MEDIA_LANG)&&O0(this)}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}handleClick(){const e=this.mediaPaused?q.MEDIA_PLAY_REQUEST:q.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new k.CustomEvent(e,{composed:!0,bubbles:!0}))}}Um.getSlotTemplateHTML=Nw;Um.getTooltipContentHTML=Uw;k.customElements.get("media-play-button")||k.customElements.define("media-play-button",Um);const Si={PLACEHOLDER_SRC:"placeholdersrc",SRC:"src"};function $w(i){return`
1246    <style>
1247      :host {
1248        pointer-events: none;
1249        display: var(--media-poster-image-display, inline-block);
1250        box-sizing: border-box;
1251      }
1252
1253      img {
1254        max-width: 100%;
1255        max-height: 100%;
1256        min-width: 100%;
1257        min-height: 100%;
1258        background-repeat: no-repeat;
1259        background-position: var(--media-poster-image-background-position, var(--media-object-position, center));
1260        background-size: var(--media-poster-image-background-size, var(--media-object-fit, contain));
1261        object-fit: var(--media-object-fit, contain);
1262        object-position: var(--media-object-position, center);
1263      }
1264    </style>
1265
1266    <img part="poster img" aria-hidden="true" id="image"/>
1267  `}const Fw=i=>{i.style.removeProperty("background-image")},Bw=(i,e)=>{i.style["background-image"]=`url('${e}')`};class $m extends k.HTMLElement{static get observedAttributes(){return[Si.PLACEHOLDER_SRC,Si.SRC]}constructor(){if(super(),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=jt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(e,t,s){e===Si.SRC&&(s==null?this.image.removeAttribute(Si.SRC):this.image.setAttribute(Si.SRC,s)),e===Si.PLACEHOLDER_SRC&&(s==null?Fw(this.image):Bw(this.image,s))}get placeholderSrc(){return Ne(this,Si.PLACEHOLDER_SRC)}set placeholderSrc(e){Ue(this,Si.SRC,e)}get src(){return Ne(this,Si.SRC)}set src(e){Ue(this,Si.SRC,e)}}$m.shadowRootOptions={mode:"open"};$m.getTemplateHTML=$w;k.customElements.get("media-poster-image")||k.customElements.define("media-poster-image",$m);var ZT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Hw=(i,e,t)=>(ZT(i,e,"read from private field"),t?t.call(i):e.get(i)),Gw=(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)},Kw=(i,e,t,s)=>(ZT(i,e,"write to private field"),e.set(i,t),t),Vl;class Vw extends qs{constructor(){super(),Gw(this,Vl,void 0),Kw(this,Vl,this.shadowRoot.querySelector("slot"))}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PREVIEW_CHAPTER,_.MEDIA_LANG]}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),(e===_.MEDIA_PREVIEW_CHAPTER||e===_.MEDIA_LANG)&&s!==t&&s!=null)if(Hw(this,Vl).textContent=s,s!==""){const r=J("chapter: {chapterName}",{chapterName:s});this.setAttribute("aria-valuetext",r)}else this.removeAttribute("aria-valuetext")}get mediaPreviewChapter(){return Ne(this,_.MEDIA_PREVIEW_CHAPTER)}set mediaPreviewChapter(e){Ue(this,_.MEDIA_PREVIEW_CHAPTER,e)}}Vl=new WeakMap;k.customElements.get("media-preview-chapter-display")||k.customElements.define("media-preview-chapter-display",Vw);var JT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Jo=(i,e,t)=>(JT(i,e,"read from private field"),t?t.call(i):e.get(i)),Ww=(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)=>(JT(i,e,"write to private field"),e.set(i,t),t),Ni;function qw(i){return`
1268    <style>
1269      :host {
1270        box-sizing: border-box;
1271        display: var(--media-control-display, var(--media-preview-thumbn
1271ail-display, inline-block));
1272        overflow: hidden;
1273      }
1274
1275      img {
1276        display: none;
1277        position: relative;
1278      }
1279    </style>
1280    <img crossorigin loading="eager" decoding="async">
1281  `}class Du extends k.HTMLElement{constructor(){if(super(),Ww(this,Ni,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=jt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Ae.MEDIA_CONTROLLER,_.MEDIA_PREVIEW_IMAGE,_.MEDIA_PREVIEW_COORDS]}connectedCallback(){var e,t,s;const r=this.getAttribute(Ae.MEDIA_CONTROLLER);r&&(el(this,Ni,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(s=(t=Jo(this,Ni))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=Jo(this,Ni))==null?void 0:e.unassociateElement)==null||t.call(e,this),el(this,Ni,null)}attributeChangedCallback(e,t,s){var r,n,a,o,l;[_.MEDIA_PREVIEW_IMAGE,_.MEDIA_PREVIEW_COORDS].includes(e)&&this.update(),e===Ae.MEDIA_CONTROLLER&&(t&&((n=(r=Jo(this,Ni))==null?void 0:r.unassociateElement)==null||n.call(r,this),el(this,Ni,null)),s&&this.isConnected&&(el(this,Ni,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=Jo(this,Ni))==null?void 0:o.associateElement)==null||l.call(o,this)))}get mediaPreviewImage(){return Ne(this,_.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){Ue(this,_.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewCoords(){const e=this.getAttribute(_.MEDIA_PREVIEW_COORDS);if(e)return e.split(/\s+/).map(t=>+t)}set mediaPreviewCoords(e){if(!e){this.removeAttribute(_.MEDIA_PREVIEW_COORDS);return}this.setAttribute(_.MEDIA_PREVIEW_COORDS,e.join(" "))}update(){const e=this.mediaPreviewCoords,t=this.mediaPreviewImage;if(!(e&&t))return;const[s,r,n,a]=e,o=t.split("#")[0],l=getComputedStyle(this),{maxWidth:d,maxHeight:u,minWidth:c,minHeight:h}=l,f=Math.min(parseInt(d)/n,parseInt(u)/a),m=Math.max(parseInt(c)/n,parseInt(h)/a),p=f<1,g=p?f:m>1?m:1,{style:v}=ct(this.shadowRoot,":host"),T=ct(this.shadowRoot,"img").style,y=this.shadowRoot.querySelector("img"),b=p?"min":"max";v.setProperty(`${b}-width`,"initial","important"),v.setProperty(`${b}-height`,"initial","important"),v.width=`${n*g}px`,v.height=`${a*g}px`;const A=()=>{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,A()},y.src=o,A()),A(),T.transform=`translate(-${s*g}px, -${r*g}px)`}}Ni=new WeakMap;Du.shadowRootOptions={mode:"open"};Du.getTemplateHTML=qw;k.customElements.get("media-preview-thumbnail")||k.customElements.define("media-preview-thumbnail",Du);var N0=Du,eb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},U0=(i,e,t)=>(eb(i,e,"read from private field"),t?t.call(i):e.get(i)),Yw=(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)},jw=(i,e,t,s)=>(eb(i,e,"write to private field"),e.set(i,t),t),La;class zw extends qs{constructor(){super(),Yw(this,La,void 0),jw(this,La,this.shadowRoot.querySelector("slot")),U0(this,La).textContent=Gs(0)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PREVIEW_TIME]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_PREVIEW_TIME&&s!=null&&(U0(this,La).textContent=Gs(parseFloat(s)))}get mediaPreviewTime(){return Oe(this,_.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){Ye(this,_.MEDIA_PREVIEW_TIME,e)}}La=new WeakMap;k.customElements.get("media-preview-time-display")||k.customElements.define("media-preview-time-display",zw);const Gr={SEEK_OFFSET:"seekoffset"},bc=30,Qw=i=>`
1282  <svg aria-hidden="true" viewBox="0 0 20 24">
1283    <defs>
1284      <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style>
1285    </defs>
1286    <text class="text value" transform="translate(2.18 19.87)">${i}</text>
1287    <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"/>
1288  </svg>`;function Xw(i,e){return`
1289    <slot name="icon">${Qw(e.seekOffset)}</slot>
1290  `}function Zw(){return J("Seek backward")}const Jw=0;class Fm extends gt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_CURRENT_TIME,Gr.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=Oe(this,Gr.SEEK_OFFSET,bc)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===Gr.SEEK_OFFSET&&(this.seekOffset=Oe(this,Gr.SEEK_OFFSET,bc))}get seekOffset(){return Oe(this,Gr.SEEK_OFFSET,bc)}set seekOffset(e){Ye(this,Gr.SEEK_OFFSET,e),this.setAttribute("aria-label",J("seek back {seekOffset} seconds",{seekOffset:this.seekOffset})),aT(oT(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return Oe(this,_.MEDIA_CURRENT_TIME,Jw)}set mediaCurrentTime(e){Ye(this,_.MEDIA_CURRENT_TIME,e)}handleClick(){const e=Math.max(this.mediaCurrentTime-this.seekOffset,0),t=new k.CustomEvent(q.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}Fm.getSlotTemplateHTML=Xw;
1290Fm.getTooltipContentHTML=Zw;k.customElements.get("media-seek-backward-button")||k.customElements.define("media-seek-backward-button",Fm);const Kr={SEEK_OFFSET:"seekoffset"},_c=30,eM=i=>`
1291  <svg aria-hidden="true" viewBox="0 0 20 24">
1292    <defs>
1293      <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style>
1294    </defs>
1295    <text class="text value" transform="translate(8.9 19.87)">${i}</text>
1296    <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"/>
1297  </svg>`;function tM(i,e){return`
1298    <slot name="icon">${eM(e.seekOffset)}</slot>
1299  `}function iM(){return J("Seek forward")}const sM=0;class Bm extends gt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_CURRENT_TIME,Kr.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=Oe(this,Kr.SEEK_OFFSET,_c)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===Kr.SEEK_OFFSET&&(this.seekOffset=Oe(this,Kr.SEEK_OFFSET,_c))}get seekOffset(){return Oe(this,Kr.SEEK_OFFSET,_c)}set seekOffset(e){Ye(this,Kr.SEEK_OFFSET,e),this.setAttribute("aria-label",J("seek forward {seekOffset} seconds",{seekOffset:this.seekOffset})),aT(oT(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return Oe(this,_.MEDIA_CURRENT_TIME,sM)}set mediaCurrentTime(e){Ye(this,_.MEDIA_CURRENT_TIME,e)}handleClick(){const e=this.mediaCurrentTime+this.seekOffset,t=new k.CustomEvent(q.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}Bm.getSlotTemplateHTML=tM;Bm.getTooltipContentHTML=iM;k.customElements.get("media-seek-forward-button")||k.customElements.define("media-seek-forward-button",Bm);var tb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ac=(i,e,t)=>(tb(i,e,"read from private field"),t?t.call(i):e.get(i)),rM=(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)},nM=(i,e,t,s)=>(tb(i,e,"write to private field"),e.set(i,t),t),rn;const rr={REMAINING:"remaining",SHOW_DURATION:"showduration",NO_TOGGLE:"notoggle"},$0=[...Object.values(rr),_.MEDIA_CURRENT_TIME,_.MEDIA_DURATION,_.MEDIA_SEEKABLE],F0=["Enter"," "],aM="&nbsp;/&nbsp;",Gh=(i,{timesSep:e=aM}={})=>{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?Gs(0-(a-r)):Gs(r);return i.showDuration?`${o}${e}${Gs(a)}`:o},oM="video not loaded, unknown time.",lM=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",oM);return}const n=i.remaining?Ha(0-(r-t)):Ha(t);if(!i.showDuration){i.setAttribute("aria-valuetext",n);return}const a=Ha(r),o=`${n} of ${a}`;i.setAttribute("aria-valuetext",o)};function dM(i,e){return`
1300    <slot>${Gh(e)}</slot>
1301  `}class ib extends qs{constructor(){super(),rM(this,rn,void 0),nM(this,rn,this.shadowRoot.querySelector("slot")),Ac(this,rn).innerHTML=`${Gh(this)}`}static get observedAttributes(){return[...super.observedAttributes,...$0,"disabled"]}connectedCallback(){const{style:e}=ct(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",J("playback time"));const t=s=>{const{key:r}=s;if(!F0.includes(r)){this.removeEventListener("keyup",t);return}this.toggleTimeDisplay()};this.addEventListener("keydown",s=>{const{metaKey:r,altKey:n,key:a}=s;if(r||n||!F0.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){$0.includes(e)?this.update():e==="disabled"&&s!==t&&(s==null?this.enable():this.disable()),super.attributeChangedCallback(e,t,s)}enable(){this.tabIndex=0}disable(){this.tabIndex=-1}get remaining(){return ve(this,rr.REMAINING)}set remaining(e){Ee(this,rr.REMAINING,e)}get showDuration(){return ve(this,rr.SHOW_DURATION)}set showDuration(e){Ee(this,rr.SHOW_DURATION,e)}get noToggle(){return ve(this,rr.NO_TOGGLE)}set noToggle(e){Ee(this,rr.NO_TOGGLE,e)}get mediaDuration(){return Oe(this,_.MEDIA_DURATION)}set mediaDuration(e){Ye(this,_.MEDIA_DURATION,e)}get mediaCurrentTime(){return Oe(this,_.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){Ye(this,_.MEDIA_CURRENT_TIME,e)}get mediaSeekable(){const e=this.getAttribute(_.MEDIA_SEEKABLE);if(e)return e.split(":").map(t=>+t)}set mediaSeekable(e){if(e==null){this.removeAttribute(_.MEDIA_SEEKABLE);return}this.setAttribute(_.MEDIA_SEEKABLE,e.join(":"))}update(){const e=Gh(this);lM(this),e!==Ac(this,rn).innerHTML&&(Ac(this,rn).innerHTML=e)}}rn=new WeakMap;ib.getSlotTemplateHTML=dM;k.customElements.get("media-time-display")||k.customElements.define("media-time-display",ib);var sb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ft=(i,e,t)=>(sb(i,e,"read from private field"),e.get(i)),Ii=(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)},Ft=(i,e,t,s)=>(sb(i,e,"write to private field"),e.set(i,t),t),uM=(i,e,t,s)=>({set _(r){Ft(i,e,r)},get _(){return ft(i,e)}}),nn,Wl,an,Ra,ql,Yl,jl,on,nr,zl;class cM{constructor(e,t,s){Ii(this,nn,void 0),Ii(this,Wl,void 0),Ii(this,an,void 0),Ii(this,Ra,void 0),Ii(this,ql,void 0),Ii(this,Yl,void 0),Ii(this,jl,void 0),Ii(this,on,void 0),Ii(this,nr,0),Ii(this,zl,(r=performance.now())=>{Ft(this,nr,requestAnimationFrame(ft(this,zl))),Ft(this,Ra,performance.now()-ft(this,an));const n=1e3/this.fps;if(ft(this,Ra)>n){Ft(this,an,r-ft(this,Ra)%n);const a=1e3/((r-ft(this,Wl))/++uM(this,ql)._),o=(r-ft(this,Yl))/1e3/this.duration;let l=ft(this,jl)+o*this.playbackRate;l-ft(this,nn).valueAsNumber>0?Ft(this,on,this.playbackRate/this.duration/a):(Ft(this,on,.995*ft(this,on)),l=ft(this,nn).valueAsNumber+ft(this,on)),this.callback(l)}}),Ft(this,nn,e),this.callback=t,this.fps=s}start(){ft(this,nr)===0&&(Ft(this,an,performance.now()),Ft(this,Wl,ft(this,an)),Ft(this,ql,0),ft(this,zl).call(this))}stop(){ft(this,nr)!==0&&(cancelAnimationFrame(ft(this,nr)),Ft(this,nr,0))}update({start:e,duration:t,playbackRate:s}){const r=e-ft(this,nn).valueAsNumber,n=Math.abs(t-this.duration);(r>0||r<-.03||n>=.5)&&this.callback(e),Ft(this,jl,e),Ft(this,Yl,performance.now()),this.duration=t,this.playbackRate=s}}nn=new WeakMap;Wl=new WeakMap;an=new WeakMap;Ra=new WeakMap;ql=new WeakMap;Yl=new WeakMap;jl=new WeakMap;on=new WeakMap;nr=new WeakMap;zl=new WeakMap;var Hm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},je=(i,e,t)=>(Hm(i,e,"read from private field"),t?t.call(i):e.get(i)),ot=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Zt=(i,e,t,s)=>(Hm(i,e,"write to private field"),e.set(i,t),t),St=(i,e,t)=>(Hm(i,e,"access private method"),t),ln,Ar,jd,Va,zd,Ql,ho,fo,dn,un,cn,xa,Gm,rb,Kh,Qd,Km,Xd,Vm,Zd,Wm,Vh,nb,mo,Jd,Wh,ab;const hM="video not loaded, unknown time.",fM=i=>
1301{const e=i.range,t=Ha(+ob(i)),s=Ha(+i.mediaSeekableEnd),r=t&&s?`${t} of ${s}`:hM;e.setAttribute("aria-valuetext",r)};function mM(i){return`
1302    <style>
1303      :host {
1304        --media-box-border-radius: 4px;
1305        --media-box-padding-left: 10px;
1306        --media-box-padding-right: 10px;
1307        --media-preview-border-radius: var(--media-box-border-radius);
1308        --media-box-arrow-offset: var(--media-box-border-radius);
1309        --_control-background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
1310        --_preview-background: var(--media-preview-background, var(--_control-background));
1311
1312        
1313        contain: layout;
1314      }
1315
1316      #buffered {
1317        background: var(--media-time-range-buffered-color, rgb(255 255 255 / .4));
1318        position: absolute;
1319        height: 100%;
1320        will-change: width;
1321      }
1322
1323      #preview-rail,
1324      #current-rail {
1325        width: 100%;
1326        position: absolute;
1327        left: 0;
1328        bottom: 100%;
1329        pointer-events: none;
1330        will-change: transform;
1331      }
1332
1333      [part~="box"] {
1334        width: min-content;
1335        
1336        position: absolute;
1337        bottom: 100%;
1338        flex-direction: column;
1339        align-items: center;
1340        transform: translateX(-50%);
1341      }
1342
1343      [part~="current-box"] {
1344        display: var(--media-current-box-display, var(--media-box-display, flex));
1345        margin: var(--media-current-box-margin, var(--media-box-margin, 0 0 5px));
1346        visibility: hidden;
1347      }
1348
1349      [part~="preview-box"] {
1350        display: var(--media-preview-box-display, var(--media-box-display, flex));
1351        margin: var(--media-preview-box-margin, var(--media-box-margin, 0 0 5px));
1352        transition-property: var(--media-preview-transition-property, visibility, opacity);
1353        transition-duration: var(--media-preview-transition-duration-out, .25s);
1354        transition-delay: var(--media-preview-transition-delay-out, 0s);
1355        visibility: hidden;
1356        opacity: 0;
1357      }
1358
1359      :host(:is([${_.MEDIA_PREVIEW_IMAGE}], [${_.MEDIA_PREVIEW_TIME}])[dragging]) [part~="preview-box"] {
1360        transition-duration: var(--media-preview-transition-duration-in, .5s);
1361        transition-delay: var(--media-preview-transition-delay-in, .25s);
1362        visibility: visible;
1363        opacity: 1;
1364      }
1365
1366      @media (hover: hover) {
1367        :host(:is([${_.MEDIA_PREVIEW_IMAGE}], [${_.MEDIA_PREVIEW_TIME}]):hover) [part~="preview-box"] {
1368          transition-duration: var(--media-preview-transition-duration-in, .5s);
1369          transition-delay: var(--media-preview-transition-delay-in, .25s);
1370          visibility: visible;
1371          opacity: 1;
1372        }
1373      }
1374
1375      media-preview-thumbnail,
1376      ::slotted(media-preview-thumbnail) {
1377        visibility: hidden;
1378        
1379        transition: visibility 0s .25s;
1380        transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));
1381        background: var(--media-preview-thumbnail-background, var(--_preview-background));
1382        box-shadow: var(--media-preview-thumbnail-box-shadow, 0 0 4px rgb(0 0 0 / .2));
1383        max-width: var(--media-preview-thumbnail-max-width, 180px);
1384        max-height: var(--media-preview-thumbnail-max-height, 160px);
1385        min-width: var(--media-preview-thumbnail-min-width, 120px);
1386        min-height: var(--media-preview-thumbnail-min-height, 80px);
1387        border: var(--media-preview-thumbnail-border);
1388        border-radius: var(--media-preview-thumbnail-border-radius,
1389          var(--media-preview-border-radius) var(--media-preview-border-radius) 0 0);
1390      }
1391
1392      :host([${_.MEDIA_PREVIEW_IMAGE}][dragging]) media-preview-thumbnail,
1393      :host([${_.MEDIA_PREVIEW_IMAGE}][dragging]) ::slotted(media-preview-thumbnail) {
1394        transition-delay: var(--media-preview-transition-delay-in, .25s);
1395        visibility: visible;
1396      }
1397
1398      @media (hover: hover) {
1399        :host([${_.MEDIA_PREVIEW_IMAGE}]:hover) media-preview-thumbnail,
1400        :host([${_.MEDIA_PREVIEW_IMAGE}
1400]:hover) ::slotted(media-preview-thumbnail) {
1401          transition-delay: var(--media-preview-transition-delay-in, .25s);
1402          visibility: visible;
1403        }
1404
1405        :host([${_.MEDIA_PREVIEW_TIME}]:hover) {
1406          --media-time-range-hover-display: block;
1407        }
1408      }
1409
1410      media-preview-chapter-display,
1411      ::slotted(media-preview-chapter-display) {
1412        font-size: var(--media-font-size, 13px);
1413        line-height: 17px;
1414        min-width: 0;
1415        visibility: hidden;
1416        
1417        transition: min-width 0s, border-radius 0s, margin 0s, padding 0s, visibility 0s;
1418        transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));
1419        background: var(--media-preview-chapter-background, var(--_preview-background));
1420        border-radius: var(--media-preview-chapter-border-radius,
1421          var(--media-preview-border-radius) var(--media-preview-border-radius)
1422          var(--media-preview-border-radius) var(--media-preview-border-radius));
1423        padding: var(--media-preview-chapter-padding, 3.5px 9px);
1424        margin: var(--media-preview-chapter-margin, 0 0 5px);
1425        text-shadow: var(--media-preview-chapter-text-shadow, 0 0 4px rgb(0 0 0 / .75));
1426      }
1427
1428      :host([${_.MEDIA_PREVIEW_IMAGE}]) media-preview-chapter-display,
1429      :host([${_.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-chapter-display) {
1430        transition-delay: var(--media-preview-transition-delay-in, .25s);
1431        border-radius: var(--media-preview-chapter-border-radius, 0);
1432        padding: var(--media-preview-chapter-padding, 3.5px 9px 0);
1433        margin: var(--media-preview-chapter-margin, 0);
1434        min-width: 100%;
1435      }
1436
1437      media-preview-chapter-display[${_.MEDIA_PREVIEW_CHAPTER}],
1438      ::slotted(media-preview-chapter-display[${_.MEDIA_PREVIEW_CHAPTER}]) {
1439        visibility: visible;
1440      }
1441
1442      media-preview-chapter-display:not([aria-valuetext]),
1443      ::slotted(media-preview-chapter-display:not([aria-valuetext])) {
1444        display: none;
1445      }
1446
1447      media-preview-time-display,
1448      ::slotted(media-preview-time-display),
1449      media-time-display,
1450      ::slotted(media-time-display) {
1451        font-size: var(--media-font-size, 13px);
1452        line-height: 17px;
1453        min-width: 0;
1454        
1455        transition: min-width 0s, border-radius 0s;
1456        transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));
1457        background: var(--media-preview-time-background, var(--_preview-background));
1458        border-radius: var(--media-preview-time-border-radius,
1459          var(--media-preview-border-radius) var(--media-preview-border-radius)
1460          var(--media-preview-border-radius) var(--media-preview-border-radius));
1461        padding: var(--media-preview-time-padding, 3.5px 9px);
1462        margin: var(--media-preview-time-margin, 0);
1463        text-shadow: var(--media-preview-time-text-shadow, 0 0 4px rgb(0 0 0 / .75));
1464        transform: translateX(min(
1465          max(calc(50% - var(--_box-width) / 2),
1466          calc(var(--_box-shift, 0))),
1467          calc(var(--_box-width) / 2 - 50%)
1468        ));
1469      }
1470
1471      :host([${_.MEDIA_PREVIEW_IMAGE}]) media-preview-time-display,
1472      :host([${_.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-time-display) {
1473        transition-delay: var(--media-preview-transition-delay-in, .25s);
1474        border-radius: var(--media-preview-time-border-radius,
1475          0 0 var(--media-preview-border-radius) var(--media-preview-border-radius));
1476        min-width: 100%;
1477      }
1478
1479      :host([${_.MEDIA_PREVIEW_TIME}]:hover) {
1480        --media-time-range-hover-display: block;
1481      }
1482
1483      [part~="arrow"],
1484      ::slotted([part~="arrow"]) {
1485        display: var(--media-box-arrow-display, inline-block);
1486        transform: translateX(min(
1487          max(calc(50% - var(--_box-width) / 2 + var(--media-box-arrow-offset)),
1488          calc(var(--_box-shift, 0))),
1489          calc(var(--_box-width) / 2 - 50% - var(--media-box-arrow-offset))
1490        ));
1491        
1492        border-color: transparent;
1493        border-top-color: var(--media-box-arrow-background, var(--_control-background));
1494        border-width: var(--media-box-arrow-border-width,
1495          var(--media-box-arrow-height, 5px) var(--media-box-arrow-width, 6px) 0);
1496        border-style: solid;
1497        justify-content: center;
1498        height: 0;
1499      }
1500    </style>
1501    <div id="preview-rail">
1502      <slot name="preview" part="box preview-box">
1503        <media-preview-thumbnail>
1504          <template shadowrootmode="${N0.shadowRootOptions.mode}">
1505            ${N0.getTemplateHTML({})}
1506          </template>
1507        </media-preview-thumbnail>
1508        <media-preview-chapter-display></media-preview-chapter-display>
1509        <media-preview-time-display></media-preview-time-display>
1510        <slot name="preview-arrow"><div part="arrow"></div></slot>
1511      </slot>
1512    </div>
1513    <div id="current-rail">
1514      <slot name="current" part="box current-box">
1515        
1516      </slot>
1517    </div>
1518  `}const tl=(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))},ob=(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 qm extends zn{constructor(){super(),ot(this,cn),ot(this,Gm),ot(this,Qd),ot(this,Xd),ot(this,Zd),ot(this,Vh),ot(this,mo),ot(this,Wh),ot(this,ln,void 0),ot(this,Ar,void 0),ot(this,jd,void 0),ot(this,Va,void 0),ot(this,zd,void 0),ot(this,Ql,void 0),ot(this,ho,void 0),ot(this,fo,void 0),ot(this,dn,void 0),ot(this,un,void 0),ot(this,Kh,s=>{this.dragging||(hm(s)&&(this.range.valueAsNumber=s),je(this,un)||this.updateBar())}),this.shadowRoot.querySelector("#track").insertAdjacentHTML("afterbegin",'<div id="buffered" part="buffered"></div>'),Zt(this,jd,this.shadowRoot.querySelectorAll('[part~="box"]')),Zt(this,zd,this.shadowRoot.querySelector('[part~="preview-box"]')),Zt(this,Ql,this.shadowRoot.querySelector('[part~="current-box"]'));const t=getComputedStyle(this);Zt(this,ho,parseInt(t.getPropertyValue("--media-box-padding-left"))),Zt(this,fo,parseInt(t.getPropertyValue("--media-box-padding-right"))),Zt(this,Ar,new cM(this.range,je(this,Kh),60))}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PAUSED,_.MEDIA_DURATION,_.MEDIA_SEEKABLE,_.MEDIA_CURRENT_TIME,_.MEDIA_PREVIEW_IMAGE,_.MEDIA_PREVIEW_TIME,_.MEDIA_PREVIEW_CHAPTER,_.MEDIA_BUFFERED,_.MEDIA_PLAYBACK_RATE,_.MEDIA_LOADING,_.MEDIA_ENDED]}connectedCallback(){var e;super.connectedCallback(),this.range.setAttribute("aria-label",J("seek")),St(this,cn,xa).call(this),Zt(this,ln,this.getRootNode()),(e=je(this,ln))==null||e.addEventListener("transitionstart",this)}disconnectedCallback(){var e;super.disconnectedCallback(),St(this,cn,xa).call(this),(e=je(this,ln))==null||e.removeEventListener("transitionstart",this),Zt(this,ln,null)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),t!=s&&(e===_.MEDIA_CURRENT_TIME||e===_.MEDIA_PAUSED||e===_.MEDIA_ENDED||e===_.MEDIA_LOADING||e===_.MEDIA_DURATION||e===_.MEDIA_SEEKABLE?(je(this,Ar).update({start:tl(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),St(this,cn,xa).call(this),fM(this)):e===_.MEDIA_BUFFERED&&this.updateBufferedBar(),(e===_.MEDIA_DURATION||e===_.MEDIA_SEEKABLE)&&(this.mediaChaptersCues=je(this,dn),this.updateBar()))}get mediaChaptersCues(){return je(this,dn)}set mediaChaptersCues(e){var t;Zt(this,dn,e),this.updateSegments((t=je(this,dn))==null?void 0:t.map(s=>({start:tl(this,s.startTime),end:tl(this,s.endTime)})))}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}get mediaLoading(){return ve(this,_.MEDIA_LOADING)}set mediaLoading(e){Ee(this,_.MEDIA_LOADING,e)}get mediaDuration(){return Oe(this,_.MEDIA_DURATION)}set mediaDuration(e){Ye(this,_.MEDIA_DURATION,e)}get mediaCurrentTime(){return Oe(this,_.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){Ye(this,_.MEDIA_CURRENT_TIME,e)}get mediaPlaybackRate(){return Oe(this,_.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){Ye(this,_.MEDIA_PLAYBACK_RATE,e)}get mediaBuffered(){const e=this.getAttribute(_.MEDIA_BUFFERED);return e?e.split(" ").map(t=>t.split(":").map(s=>+s)):[]}set mediaBuffered(e){if(!e){this.removeAttribute(_.MEDIA_BUFFERED);return}const t=e.map(s=>s.join(":")).join(" ");this.setAttribute(_.MEDIA_BUFFERED,t)}get mediaSeekable(){const e=this.getAttribute(_.MEDIA_SEEKABLE);if(e)return e.split(":").map(t=>+t)}set mediaSeekable(e){if(e==null){this.removeAttribute(_.MEDIA_SEEKABLE);return}this.setAttribute(_.MEDIA_SEEKABLE,e.join(":"))}get mediaSeekableEnd(){var e;const[,t=this.mediaDuration]=(e=this.mediaSeekable)!=null?e:[];return t}get mediaSeekableStart(){var e;const[t=0]=(e=this.mediaSeekable)!=null?e:[];return t}get mediaPreviewImage(){return Ne(this,_.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){Ue(this,_.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewTime(){return Oe(this,_.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){Ye(this,_.MEDIA_PREVIEW_TIME,e)}get mediaEnded(){return ve(this,_.MEDIA_ENDED)}set mediaEnded(e){Ee(this,_.MEDIA_ENDED,e)}updateBar(){super.updateBar(),this.updateBufferedBar(),this.updateCurrentBox()}updateBufferedBar(){var e;const t=this.mediaBuffered;if(!t.length)return;let s;if(this.mediaEnded)s=1;else{const n=this.mediaCurrentTime,[,a=this.mediaSeekableStart]=(e=t.find(([o,l])=>o<=n&&n<=l))!=null?e:[];s=tl(this,a)}const{style:r}=ct(this.shadowRoot,"#buffered");r.setProperty("width",`${s*100}%`)}updateCurrentBox(){if(!this.shadowRoot.querySelector('slot[name="current"]').assignedElements().length)return;const t=ct(this.shadowRoot,"#current-rail"),s=ct(this.shadowRoot,'[part~="current-box"]'),r=St(this,Qd,Km).call(this,je(this,Ql)),n=St(this,Xd,Vm).
vendor: 5,049 bytes, lines 1518-1538
1518call(this,r,this.range.valueAsNumber),a=St(this,Zd,Wm).call(this,r,this.range.valueAsNumber);t.style.transform=`translateX(${n})`,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":St(this,Wh,ab).call(this);break;case"pointermove":St(this,Vh,nb).call(this,e);break;case"pointerup":je(this,un)&&Zt(this,un,!1);break;case"pointerdown":Zt(this,un,!0);break;case"pointerleave":St(this,mo,Jd).call(this,null);break;case"transitionstart":vs(e.target,this)&&setTimeout(()=>St(this,cn,xa).call(this),0);break}}}ln=new WeakMap;Ar=new WeakMap;jd=new WeakMap;Va=new WeakMap;zd=new WeakMap;Ql=new WeakMap;ho=new WeakMap;fo=new WeakMap;dn=new WeakMap;un=new WeakMap;cn=new WeakSet;xa=function(){St(this,Gm,rb).call(this)?je(this,Ar).start():je(this,Ar).stop()};Gm=new WeakSet;rb=function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaSeekableEnd>0&&lT(this)};Kh=new WeakMap;Qd=new WeakSet;Km=function(i){var e;const s=((e=this.getAttribute("bounds")?Yn(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}};Xd=new WeakSet;Vm=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};Zd=new WeakSet;Wm=function(i,e){const{width:t,min:s,max:r}=i.box,n=e*i.range.width;if(n<s+je(this,ho)){const a=i.range.left-i.bounds.left-je(this,ho);return`${n-t/2+a}px`}if(n>r-je(this,fo)){const a=i.bounds.right-i.range.right-je(this,fo);return`${n+t/2-a-i.range.width}px`}return 0};Vh=new WeakSet;nb=function(i){const e=[...je(this,jd)].some(u=>i.composedPath().includes(u));if(!this.dragging&&(e||!i.composedPath().includes(this))){St(this,mo,Jd).call(this,null);return}const t=this.mediaSeekableEnd;if(!t)return;const s=ct(this.shadowRoot,"#preview-rail"),r=ct(this.shadowRoot,'[part~="preview-box"]'),n=St(this,Qd,Km).call(this,je(this,zd));let a=(i.clientX-n.range.left)/n.range.width;a=Math.max(0,Math.min(1,a));const o=St(this,Xd,Vm).call(this,n,a),l=St(this,Zd,Wm).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(je(this,Va))-Math.round(a*t);Math.abs(d)<1&&a>.01&&a<.99||(Zt(this,Va,a*t),St(this,mo,Jd).call(this,je(this,Va)))};mo=new WeakSet;Jd=function(i){this.dispatchEvent(new k.CustomEvent(q.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:i}))};Wh=new WeakSet;ab=function(){je(this,Ar).stop();const i=ob(this);this.dispatchEvent(new k.CustomEvent(q.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:i}))};qm.shadowRootOptions={mode:"open"};qm.getContainerTemplateHTML=mM;k.customElements.get("media-time-range")||k.customElements.define("media-time-range",qm);const pM=1,gM=i=>i.mediaMuted?0:i.mediaVolume,vM=i=>`${Math.round(i*100)}%`;class EM extends zn{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_VOLUME,_.MEDIA_MUTED,_.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.addEventListener("input",()=>{const e=this.range.value,t=new k.CustomEvent(q.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)})}connectedCallback(){super.connectedCallback(),this.range.setAttribute("aria-label",J("volume"))}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),(e===_.MEDIA_VOLUME||e===_.MEDIA_MUTED)&&(this.range.valueAsNumber=gM(this),this.range.setAttribute("aria-valuetext",vM(this.range.valueAsNumber)),this.updateBar())}get mediaVolume(){return Oe(this,_.MEDIA_VOLUME,pM)}set mediaVolume(e){Ye(this,_.MEDIA_VOLUME,e)}get mediaMuted(){return ve(this,_.MEDIA_MUTED)}set mediaMuted(e){Ee(this,_.MEDIA_MUTED,e)}get mediaVolumeUnavailable(){return Ne(this,_.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(e){Ue(this,_.MEDIA_VOLUME_UNAVAILABLE,e)}}k.customElements.get("media-volume-range")||k.customElements.define("media-volume-range",EM);function yM(i){return`
1519      <style>
1520        :host {
1521          min-width: 4ch;
1522          padding: var(--media-button-padding, var(--media-control-padding, 10px 5px));
1523          width: 100%;
1524          display: grid;
1525          grid-template-columns: 1fr auto;
1526          gap: 1rem;
1527          font-weight: var(--media-button-font-weight, normal);
1528        }
1529
1530        #checked-indicator {
1531          display: none;
1532        }
1533
1534        :host([${_.MEDIA_LOOP}]) #checked-indicator {
1535          display: block;
1536        }
1537      </style>
1538      
1539      <span id="icon">
1540     </span>
1541
1542      <div id="checked-indicator">
1543        <svg aria-hidden="true" viewBox="0 1 24 24" part="checked-indicator indicator">
1544          <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"/>
1545        </svg>
1546      </div>
1547    `}function TM(){return J("Loop")}class Ym extends gt{constructor(){super(...arguments),this.container=null}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_LOOP]}connectedCallback(){var e;super.connectedCallback(),this.container=((e=this.shadowRoot)==null?void 0:e.querySelector("#icon"))||null,this.container&&(this.container.textContent=J("Loop"))}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_LOOP&&this.container&&this.setAttribute("aria-checked",this.mediaLoop?"true":"false")}get mediaLoop(){return ve(this,_.MEDIA_LOOP)}set mediaLoop(e){Ee(this,_.MEDIA_LOOP,e)}handleClick(){const e=!this.mediaLoop,t=new k.CustomEvent(q.MEDIA_LOOP_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}Ym.getSlotTemplateHTML=yM;Ym.getTooltipContentHTML=TM;k.customElements.get("media-loop-button")||k.customElements.define("media-loop-button",Ym);var lb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ce=(i,e,t)=>(lb(i,e,"read from private field"),t?t.call(i):e.get(i)),Ki=(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)},cs=(i,e,t,s)=>(lb(i,e,"write to private field"),e.set(i,t),t),hn,Xl,ar,ka,ks,Ds,Cs,or,fn,Zl,hi;const B0=1,H0=0,bM=1,_M={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 yi&&typeof r.element[r.attributeName]=="boolean"?r.booleanValue=n:typeof n=="function"&&r instanceof yi?r.element[r.attributeName]=n:r.value=n}}}};class Cu extends k.DocumentFragment{constructor(e,t,s=_M){var r;super(),Ki(this,hn,void 0),Ki(this,Xl,void 0),this.append(e.content.cloneNode(!0)),cs(this,hn,db(this)),cs(this,Xl,s),(r=s.createCallback)==null||r.call(s,this,ce(this,hn),t),s.processCallback(this,ce(this,hn),t)}update(e){ce(this,Xl).processCallback(this,ce(this,hn),e)}}hn=new WeakMap;Xl=new WeakMap;const db=(i,e=[])=>{let t,s;for(const r of i.attributes||[])if(r.value.includes("{{")){const n=new SM;for([t,s]of K0(r.value))if(!t)n.append(s);else{const a=new yi(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===B0&&!(r instanceof HTMLTemplateElement))db(r,e);else{const n=r.data;if(r.nodeType===B0||n.includes("{{")){const a=[];if(n)for([t,s]of K0(n))if(!t)a.push(new Text(s));else{const o=new Qn(i);a.push(o),e.push([s,o])}else if(r instanceof HTMLTemplateElement){const o=new hb(i,r);a.push(o),e.push([o.expression,o])}r.replaceWith(...a.flatMap(o=>o.replacementNodes||[o]))}}return e},G0={},K0=i=>{let e="",t=0,s=G0[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([H0,e]),e="",r++):n==="}"&&i[r+1]==="}"&&i[r-1]!=="\\"&&!--t?(s.push([bM,e.trim()]),e="",r++):e+=n||"";return e&&s.push([H0,(t>0?"{{":"")+e]),G0[i]=s},AM=11;class ub{get value(){return""}set value(e){}toString(){return this.value}}const cb=new WeakMap;class SM{constructor(){Ki(this,ar,[])}[Symbol.iterator](){return ce(this,ar).values()}get length(){return ce(this,ar).length}item(e){return ce(this,ar)[e]}append(...e){for(const t of e)t instanceof yi&&cb.set(t,this),ce(this,ar).push(t)}toString(){return ce(this,ar).join("")}}ar=new WeakMap;class yi extends ub{constructor(e,t,s){super(),Ki(this,or),Ki(this,ka,""),Ki(this,ks,void 0),Ki(this,Ds,void 0),Ki(this,Cs,void 0),cs(this,ks,e),cs(this,Ds,t),cs(this,Cs,s)}get attributeName(){return ce(this,Ds)}get attributeNamespace(){return ce(this,Cs)}get element(){return ce(this,ks)}get value(){return ce(this,ka)}set value(e){ce(this,ka)!==e&&(cs(this,ka,e),!ce(this,or,fn)||ce(this,or,fn).length===1?e==null?ce(this,ks).removeAttributeNS(ce(this,Cs),ce(this,Ds)):ce(this,ks).setAttributeNS(ce(this,Cs),ce(this,Ds),e):ce(this,ks).setAttributeNS(ce(this,Cs),ce(this,Ds),ce(this,or,fn).toString()))}get booleanValue(){return ce(this,ks).hasAttributeNS(ce(this,Cs),ce(this,Ds))}set booleanValue(e){if(!ce(this,or,fn)||ce(this,or,fn).length===1)this.value=e?"":null;else throw new DOMException("Value is not fully templatized")}}ka=new WeakMap;ks=new WeakMap;Ds=new WeakMap;Cs=new WeakMap;or=new WeakSet;fn=function(){return cb.get(this)};class Qn extends ub{constructor(e,t){super(),Ki(this,Zl,void 0),Ki(this,hi,void 0),cs(this,Zl,e),cs(this,hi,t?[...t]:[new Text])}get replacementNodes(){return ce(this,hi)}get parentNode(){return ce(this,Zl)}get nextSibling(){return ce(this,hi)[ce(this,hi).length-1].nextSibling}get previousSibling(){return ce(this,hi)[0].previousSibling}get value(){return ce(this,hi).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===AM?[...s.childNodes]:s.nodeType?[s]:[new Text(s)]);t.length||t.push(new Text),cs(this,hi,IM(ce(this,hi)[0].parentNode,ce(this,hi),t,this.nextSibling))}}Zl=new WeakMap;hi=new WeakMap;class hb extends Qn{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 IM(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 V0={string:i=>String(i)};class fb{constructor(e){this.template=e,this.state=void 0}}const gr=new WeakMap,vr=new WeakMap,qh={partial:(i,e)=>{e[i.expression]=new fb(i.template)},if:(i,e)=>{var t;if(mb(i.expression,e))if(gr.get(i)!==i.template){gr.set(i,i.template);const s=new Cu(i.template,e,jm);i.replace(s),vr.set(i,s)}else(t=vr.get(i))==null||t.update(e);else i.replace(""),gr.delete(i),vr.delete(i)}},LM=Object.keys(qh),jm={processCallback(i,e,t){var s,r;if(t)for(const[n,a]of e){if(a instanceof hb){if(!a.directive){const l=LM.find(d=>a.template.hasAttribute(d));l&&(a.directive=l,a.expression=a.template.getAttribute(l))}(s=qh[a.directive])==null||s.call(qh,a,t);continue}let o=mb(n,t);if(o instanceof fb){gr.get(a)!==o.template?(gr.set(a,o.template),o=new Cu(o.template,o.state,jm),a.value=o,vr.set(a,o)):(r=vr.get(a))==null||r.update(o.state);continue}o?(a instanceof yi&&a.attributeName.startsWith("aria-")&&(o=String(o)),a instanceof yi?typeof o=="boolean"?a.booleanValue=o:typeof o=="function"?a.element[a.attributeName]=o:a.value=o:(a.value=o,gr.delete(a),vr.delete(a))):a instanceof yi?a.value=void 0:(a.value=void 0,gr.delete(a),vr.delete(a))}}},W0={"!":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=V0[e])==null?void 0:t.call(V0,i)}};function RM(i){return xM(i,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:e})=>e!=="ws")}function mb(i,e={}){var t,s,r,n,a,o,l;const d=RM(i);if(d.length===0||d.some(({type:u})=>!u))return na(i);if(((t=d[0])==null?void 0:t.token)===">"){const u=e[(s=d[1])==null?void 0:s.token];if(!u)return na(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]=aa(g,e))}return u}if(d.length===1)return il(d[0])?aa(d[0].token,e):na(i);if(d.length===2){const u=(o=d[0])==null?void 0:o.token,c=W0[u];if(!c||!il(d[1]))return na(i);const h=aa(d[1].token,e);return c(h)}if(d.length===3){const u=(l=d[1])==null?void 0:l.token,c=W0[u];if(!c||!il(d[0])||!il(d[2]))return na(i);const h=aa(d[0].token,e);if(u==="|")return c(h,d[2].token);const f=aa(d[2].token,e);return c(h,f)}}function na(i){return console.warn(`Warning: invalid expression \`${i}\``),!1}function il({type:i}){return["number","boolean","string","param"].includes(i)}function aa(i,e){const t=i[0],s=i.slice(-1);return i==="true"||i==="false"?i==="true":t===s&&["'",'"'].includes(t)?
vendor: 5,551 bytes, lines 1547-1574
1547i.slice(1,-1):Zy(i)?parseFloat(i):e[i]}function xM(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 zm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Yh=(i,e,t)=>(zm(i,e,"read from private field"),t?t.call(i):e.get(i)),oa=(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)},Er=(i,e,t,s)=>(zm(i,e,"write to private field"),e.set(i,t),t),Sc=(i,e,t)=>(zm(i,e,"access private method"),t),wn,Jl,Mn,jh,pb,ed,zh;const Ic={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},gb=rt.createElement("template");gb.innerHTML=`
1548  <style>
1549    :host {
1550      display: inline-block;
1551      line-height: 0;
1552    }
1553
1554    media-controller {
1555      width: 100%;
1556      height: 100%;
1557    }
1558
1559    media-captions-button:not([mediasubtitleslist]),
1560    media-captions-menu:not([mediasubtitleslist]),
1561    media-captions-menu-button:not([mediasubtitleslist]),
1562    media-audio-track-menu[mediaaudiotrackunavailable],
1563    media-audio-track-menu-button[mediaaudiotrackunavailable],
1564    media-rendition-menu[mediarenditionunavailable],
1565    media-rendition-menu-button[mediarenditionunavailable],
1566    media-volume-range[mediavolumeunavailable],
1567    media-airplay-button[mediaairplayunavailable],
1568    media-fullscreen-button[mediafullscreenunavailable],
1569    media-cast-button[mediacastunavailable],
1570    media-pip-button[mediapipunavailable] {
1571      display: none;
1572    }
1573  </style>
1574`;class wu extends k.HTMLElement{constructor(){super(),oa(this,jh),oa(this,ed),oa(this,wn,void 0),oa(this,Jl,void 0),oa(this,Mn,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:!!(Ic[r.attributeName]||r.attributeName.startsWith("breakpoint"))})&&this.render()});e.observe(this,{attributes:!0}),e.observe(this.renderRoot,{attributes:!0,subtree:!0}),this.addEventListener(ps.BREAKPOINTS_COMPUTED,this.render),Sc(this,jh,pb).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var e;return(e=Yh(this,wn))!=null?e:this.constructor.template}set template(e){if(e===null){this.removeAttribute("template");return}typeof e=="string"?this.setAttribute("template",e):e instanceof HTMLTemplateElement&&(Er(this,wn,e),Er(this,Mn,null),this.createRenderer())}get props(){var e,t,s;const r=[...Array.from((t=(e=this.mediaController)==null?void 0:e.attributes)!=null?t:[]).filter(({name:a})=>Ic[a]||a.startsWith("breakpoint")),...Array.from(this.attributes)],n={};for(const a of r){const o=(s=Ic[a.name])!=null?s:CD(a.name);let{value:l}=a;l!=null?(Zy(l)&&(l=parseFloat(l)),n[o]=l===""?!0:l):n[o]=!1}return n}attributeChangedCallback(e,t,s){e==="template"&&t!=s&&Sc(this,ed,zh).call(this)}connectedCallback(){Sc(this,ed,zh).call(this)}createRenderer(){this.template instanceof HTMLTemplateElement&&this.template!==Yh(this,Jl)&&(Er(this,Jl,this.template),this.renderer=new Cu(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(gb.content.cloneNode(!0),this.renderer))}render(){var e;(e=this.renderer)==null||e.update(this.props)}}wn=new WeakMap;Jl=new WeakMap;Mn=new WeakMap;jh=new WeakSet;pb=function(i){if(Object.prototype.hasOwnProperty.call(this,i)){const e=this[i];delete this[i],this[i]=e}};ed=new WeakSet;zh=function(){var i;const e=this.getAttribute("template");if(!e||e===Yh(this,Mn))return;const t=this.getRootNode(),s=(i=t?.getElementById)==null?void 0:i.call(t,e);if(s){Er(this,Mn,e),Er(this,wn,s),this.createRenderer();return}kM(e)&&(Er(this,Mn,e),DM(e).then(r=>{const n=rt.createElement("template");n.innerHTML=r,Er(this,wn,n),this.createRenderer()}).catch(console.error))};wu.observedAttributes=["template"];wu.processor=jm;function kM(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 DM(i){const e=await fetch(i);if(e.status!==200)throw new Error(`Failed to load resource: the server responded with a status of ${e.status}`);return e.text()}k.customElements.get("media-theme")||k.customElements.define("media-theme",wu);function CM({anchor:i,floating:e,placement:t}){const s=wM({anchor:i,floating:e}),{x:r,y:n}=PM(s,t);return{x:r,y:n}}function wM({anchor:i,floating:e}){return{anchor:MM(i,e.offsetParent),floating:{x:0,y:0,width:e.offsetWidth,height:e.offsetHeight}}}function MM(i,e){var t;const s=i.getBoundingClientRect(),r=(t=e?.getBoundingClientRect())!=null?t:{x:0,y:0};return{x:s.x-r.x,y:s.y-r.y,width:s.width,height:s.height}}function PM({anchor:i,floating:e},t){const s=OM(t)==="x"?"y":"x",r=s==="y"?"height":"width",n=vb(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 vb(i){return i.split("-")[0]}function OM(i){return["top","bottom"].includes(vb(i))?"y":"x"}
vendor: 10,096 bytes, lines 1574-1749
1574class Qm extends Event{constructor({action:e="auto",relatedTarget:t,...s}){super("invoke",s),this.action=e,this.relatedTarget=t}}class NM extends Event{constructor({newState:e,oldState:t,...s}){super("toggle",s),this.newState=e,this.oldState=t}}var Xm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},_e=(i,e,t)=>(Xm(i,e,"read from private field"),t?t.call(i):e.get(i)),xe=(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)},Ui=(i,e,t,s)=>(Xm(i,e,"write to private field"),e.set(i,t),t),ke=(i,e,t)=>(Xm(i,e,"access private method"),t),$i,Sr,Ws,td,id,Ir,po,Qh,Eb,eu,Zm,tu,sd,Xh,Zh,yb,Jh,Tb,ef,bb,Pn,On,Nn,go,iu,Jm,tf,_b,ep,Ab,sf,Sb,tp,Ib,rf,Lb,nf,Rb,Wa,su,af,xb,qa,ru,rd,of;function Vn({type:i,text:e,value:t,checked:s}){const r=rt.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=rt.createElement("span");return n.textContent=e,r.append(n),r}function Lr(i,e){let t=i.querySelector(`:scope > [slot="${e}"]`);if(t?.nodeName=="SLOT"&&(t=t.assignedElements({flatten:!0})[0]),t)return t=t.cloneNode(!0),t;const s=i.shadowRoot.querySelector(`[name="${e}"] > svg`);return s?s.cloneNode(!0):""}function UM(i){return`
1575    <style>
1576      :host {
1577        font: var(--media-font,
1578          var(--media-font-weight, normal)
1579          var(--media-font-size, 14px) /
1580          var(--media-text-content-height, var(--media-control-height, 24px))
1581          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
1582        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
1583        --_menu-bg: rgb(20 20 30 / .8);
1584        background: var(--media-menu-background, var(--media-control-background, var(--media-secondary-color, var(--_menu-bg))));
1585        border-radius: var(--media-menu-border-radius);
1586        border: var(--media-menu-border, none);
1587        display: var(--media-menu-display, inline-flex) !important;
1588        
1589        transition: var(--media-menu-transition-in,
1590          visibility 0s,
1591          opacity .2s ease-out,
1592          transform .15s ease-out,
1593          left .2s ease-in-out,
1594          min-width .2s ease-in-out,
1595          min-height .2s ease-in-out
1596        ) !important;
1597        
1598        visibility: var(--media-menu-visibility, visible);
1599        opacity: var(--media-menu-opacity, 1);
1600        max-height: var(--media-menu-max-height, var(--_menu-max-height, 300px));
1601        transform: var(--media-menu-transform-in, translateY(0) scale(1));
1602        flex-direction: column;
1603        
1604        min-height: 0;
1605        position: relative;
1606        bottom: var(--_menu-bottom);
1607        box-sizing: border-box;
1608      } 
1609
1610      @-moz-document url-prefix() {
1611        :host{
1612          --_menu-bg: rgb(20 20 30);
1613        }
1614      }
1615
1616      :host([hidden]) {
1617        transition: var(--media-menu-transition-out,
1618          visibility .15s ease-in,
1619          opacity .15s ease-in,
1620          transform .15s ease-in
1621        ) !important;
1622        visibility: var(--media-menu-hidden-visibility, hidden);
1623        opacity: var(--media-menu-hidden-opacity, 0);
1624        max-height: var(--media-menu-hidden-max-height,
1625          var(--media-menu-max-height, var(--_menu-max-height, 300px)));
1626        transform: var(--media-menu-transform-out, translateY(2px) scale(.99));
1627        pointer-events: none;
1628      }
1629
1630      :host([slot="submenu"]) {
1631        background: none;
1632        width: 100%;
1633        min-height: 100%;
1634        position: absolute;
1635        bottom: 0;
1636        right: -100%;
1637      }
1638
1639      #container {
1640        display: flex;
1641        flex-direction: column;
1642        min-height: 0;
1643        transition: transform .2s ease-out;
1644        transform: translate(0, 0);
1645      }
1646
1647      #container.has-expanded {
1648        transition: transform .2s ease-in;
1649        transform: translate(-100%, 0);
1650      }
1651
1652      button {
1653        background: none;
1654        color: inherit;
1655        border: none;
1656        padding: 0;
1657        font: inherit;
1658        outline: inherit;
1659        display: inline-flex;
1660        align-items: center;
1661      }
1662
1663      slot[name="header"][hidden] {
1664        display: none;
1665      }
1666
1667      slot[name="header"] > *,
1668      slot[name="header"]::slotted(*) {
1669        padding: .4em .7em;
1670        border-bottom: 1px solid rgb(255 255 255 / .25);
1671        cursor: var(--media-cursor, default);
1672      }
1673
1674      slot[name="header"] > button[part~="back"],
1675      slot[name="header"]::slotted(button[part~="back"]) {
1676        cursor: var(--media-cursor, pointer);
1677      }
1678
1679      svg[part~="back"] {
1680        height: var(--media-menu-icon-height, var(--media-control-height, 24px));
1681        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
1682        display: block;
1683        margin-right: .5ch;
1684      }
1685
1686      slot:not([name]) {
1687        gap: var(--media-menu-gap);
1688        flex-direction: var(--media-menu-flex-direction, column);
1689        overflow: var(--media-menu-overflow, hidden auto);
1690        display: flex;
1691        min-height: 0;
1692      }
1693
1694      :host([role="menu"]) slot:not([name]) {
1695        padding-block: .4em;
1696      }
1697
1698      slot:not([name])::slotted([role="menu"]) {
1699        background: none;
1700      }
1701
1702      media-chrome-menu-item > span {
1703        margin-right: .5ch;
1704        max-width: var(--media-menu-item-max-width);
1705        text-overflow: ellipsis;
1706        overflow: hidden;
1707      }
1708    </style>
1709    <style id="layout-row" media="width:0">
1710
1711      slot[name="header"] > *,
1712      slot[name="header"]::slotted(*) {
1713        padding: .4em .5em;
1714      }
1715
1716      slot:not([name]) {
1717        gap: var(--media-menu-gap, .25em);
1718        flex-direction: var(--media-menu-flex-direction, row);
1719        padding-inline: .5em;
1720      }
1721
1722      media-chrome-menu-item {
1723        padding: .3em .5em;
1724      }
1725
1726      media-chrome-menu-item[aria-checked="true"] {
1727        background: var(--media-menu-item-checked-background, rgb(255 255 255 / .2));
1728      }
1729
1730      
1731      media-chrome-menu-item::part(checked-indicator) {
1732        display: var(--media-menu-item-checked-indicator-display, none);
1733      }
1734    </style>
1735    <div id="container" part="container">
1736      <slot name="header" hidden>
1737        <button part="back button" aria-label="Back to previous menu">
1738          <slot name="back-icon">
1739            <svg aria-hidden="true" viewBox="0 0 20 24" part="back indicator">
1740              <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"/>
1741            </svg>
1742          </slot>
1743          <slot name="title"></slot>
1744        </button>
1745      </slot>
1746      <slot></slot>
1747    </div>
1748    <slot name="checked-indicator" hidden></slot>
1749  `}const Js={STYLE:"style",HIDDEN:"hidden",DISABLED:"disabled",ANCHOR:"anchor"};class ni extends k.HTMLElement{constructor(){if(super(),xe(this,Qh),xe(this,eu),xe(this,sd),xe(this,Zh),xe(this,Jh),xe(this,ef),xe(this,Nn),xe(this,iu),xe(this,tf),xe(this,ep),xe(this,sf),xe(this,tp),xe(this,rf),xe(this,nf),xe(this,Wa),xe(this,af),xe(this,qa),xe(this,rd),xe(this,$i,null),xe(this,Sr,null),xe(this,Ws,null),xe(this,td,new Set),xe(this,id,void 0),xe(this,Ir,!1),xe(this,po,null),xe(this,tu,()=>{const e=_e(this,td),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}));Ui(this,td,t)}),xe(this,Pn,()=>{ke(this,Nn,go).call(this),ke(this,iu,Jm).call(this,!1)}),xe(this,On,()=>{ke(this,Nn,go).call(this)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=jt(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),Ui(this,id,new MutationObserver(_e(this,tu))),_e(this,id).observe(this.defaultSlot,{childList:!0})}static get observedAttributes(){return[Js.DISABLED,Js.HIDDEN,Js.STYLE,Js.ANCHOR,Ae.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":ke(this,Qh,Eb).call(this,e);break;case"invoke":ke(this,Zh,yb).call(this,e);break;case"click":ke(this,tf,_b).call(this,e);break;case"toggle":ke(this,sf,Sb).call(this,e);break;case"focusout":ke(this,rf,Lb).call(this,e);break;case"keydown":ke(this,nf,Rb).call(this,e);break}}connectedCallback(){var e,t;Ui(this,po,pm(this.shadowRoot,":host")),ke(this,sd,Xh).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),Ui(this,$i,Th(this)),(t=(e=_e(this,$i))==null?void 0:e.associateElement)==null||t.call(e,this),this.hidden||(Hn(vo(this),_e(this,Pn)),Hn(this,_e(this,On))),ke(this,eu,Zm).call(this)}disconnectedCallback(){var e,t;Gn(vo(this),_e(this,Pn)),Gn(this,_e(this,On)),this.disable(),(t=(e=_e(this,$i))==null?void 0:e.unassociateElement)==null||t.call(e,this),Ui(this,$i,null)}attributeChangedCallback(e,t,s){var r,n,a,o;e===Js.HIDDEN&&s!==t?(_e(this,Ir)||Ui(this,Ir,!0),this.hidden?ke(this,ef,bb).call(this):ke(this,Jh,Tb).call(this),this.dispatchEvent(new NM({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:!0}))):e===Ae.MEDIA_CONTROLLER?(t&&((n=(r=_e(this,$i))==null?void 0:r.unassociateElement)==null||n.call(r,this),Ui(this,$i,null)),s&&this.isConnected&&(Ui(this,$i,Th(this)),(o=(a=_e(this,$i))==null?void 0:a.associateElement)==null||o.call(a,this))):e===Js.DISABLED&&s!==t?s==null?this.enable():this.disable():e===Js.STYLE&&s!==t&&ke(this,sd,Xh).call(this)}formatMenuItemText(e,t){return this.constructor.formatMenuItemText(e,t)}get anchor(){return this.getAttribute("anchor")}
vendor: 5,931 bytes, line 1749
1749set anchor(e){this.setAttribute("anchor",`${e}`)}get anchorElement(){var e;return this.anchor?(e=Tu(this))==null?void 0:e.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:!0}).filter($M)}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&&ke(this,rd,of).call(this,t)}focus(){if(Ui(this,Sr,mm()),this.items.length){ke(this,qa,ru).call(this,this.items[0]),this.items[0].focus();return}const e=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');e?.focus()}handleSelect(e){var t;const s=ke(this,Wa,su).call(this,e);s&&(ke(this,rd,of).call(this,s,s.type==="checkbox"),_e(this,Ws)&&!this.hidden&&((t=_e(this,Sr))==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=ke(this,Wa,su).call(this,e))!=null?t:ke(this,af,xb).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),ke(this,qa,ru).call(this,n[l]),n[l].focus()}}$i=new WeakMap;Sr=new WeakMap;Ws=new WeakMap;td=new WeakMap;id=new WeakMap;Ir=new WeakMap;po=new WeakMap;Qh=new WeakSet;Eb=function(i){const e=i.target;for(const t of e.assignedNodes({flatten:!0}))t.nodeType===3&&t.textContent.trim()===""&&t.remove();["header","title"].includes(e.name)&&ke(this,eu,Zm).call(this),e.name||_e(this,tu).call(this)};eu=new WeakSet;Zm=function(){const i=this.shadowRoot.querySelector('slot[name="header"]'),e=this.shadowRoot.querySelector('slot[name="title"]');i.hidden=e.assignedNodes().length===0&&i.assignedNodes().length===0};tu=new WeakMap;sd=new WeakSet;Xh=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")};Zh=new WeakSet;yb=function(i){Ui(this,Ws,i.relatedTarget),vs(this,i.relatedTarget)||(this.hidden=!this.hidden)};Jh=new WeakSet;Tb=function(){var i;(i=_e(this,Ws))==null||i.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:!0}),Hn(vo(this),_e(this,Pn)),Hn(this,_e(this,On))};ef=new WeakSet;bb=function(){var i;(i=_e(this,Ws))==null||i.setAttribute("aria-expanded","false"),Gn(vo(this),_e(this,Pn)),Gn(this,_e(this,On))};Pn=new WeakMap;On=new WeakMap;Nn=new WeakSet;go=function(i){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;const{x:e,y:t}=CM({anchor:this.anchorElement,floating:this,placement:"top-start"});i??(i=this.offsetWidth);const r=vo(this).getBoundingClientRect(),n=r.width-e-i,a=r.height-t-this.offsetHeight,{style:o}=_e(this,po);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`)};iu=new WeakSet;Jm=function(i){const e=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),t=e?.querySelector('[role="menu"]'),{style:s}=_e(this,po);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`),ke(this,Nn,go).call(this,n)}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),ke(this,Nn,go).call(this);s.removeProperty("--media-menu-transition-in")};tf=new WeakSet;_b=function(i){var e;if(i.stopPropagation(),i.composedPath().includes(_e(this,ep,Ab))){(e=_e(this,Sr))==null||e.focus(),this.hidden=!0;return}const t=ke(this,Wa,su).call(this,i);!t||t.hasAttribute("disabled")||(ke(this,qa,ru).call(this,t),this.handleSelect(i))};ep=new WeakSet;Ab=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"]'))};sf=new WeakSet;Sb=function(i){if(i.target===this)return;ke(this,tp,Ib).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 Qm({relatedTarget:t}));for(const t of e)t.setAttribute("aria-expanded",`${!t.submenuElement.hidden}`);ke(this,iu,Jm).call(this,!0)};tp=new WeakSet;Ib=function(){const e=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!e)};rf=new WeakSet;Lb=function(i){var e;vs(this,i.relatedTarget)||(_e(this,Ir)&&((e=_e(this,Sr))==null||e.focus()),_e(this,Ws)&&_e(this,Ws)!==i.relatedTarget&&!this.hidden&&(this.hidden=!0))};nf=new WeakSet;Rb=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(_e(this,Ir)){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=_e(this,Sr))==null||n.focus(),_e(this,Ir)&&(this.hidden=!0)):a==="Enter"||a===" "?this.handleSelect(i):this.handleMove(i)};Wa=new WeakSet;su=function(i){return i.composedPath().find(e=>["menuitemradio","menuitemcheckbox"].includes(e.role))};af=new WeakSet;xb=function(){return this.items.find(i=>i.tabIndex===0)};qa=new WeakSet;
vendor: 4,685 bytes, lines 1749-1863
1749ru=function(i){for(const e of this.items)e.tabIndex=e===i?0:-1};rd=new WeakSet;of=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}))};ni.shadowRootOptions={mode:"open"};ni.getTemplateHTML=UM;function $M(i){return["menuitem","menuitemradio","menuitemcheckbox"].includes(i?.role)}function vo(i){var e;return(e=i.getAttribute("bounds")?Yn(i,`#${i.getAttribute("bounds")}`):wt(i)||i.parentElement)!=null?e:i}k.customElements.get("media-chrome-menu")||k.customElements.define("media-chrome-menu",ni);var ip=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ji=(i,e,t)=>(ip(i,e,"read from private field"),t?t.call(i):e.get(i)),rs=(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)},Lc=(i,e,t,s)=>(ip(i,e,"write to private field"),e.set(i,t),t),Ei=(i,e,t)=>(ip(i,e,"access private method"),t),nd,Ya,lf,kb,nu,sp,rp,Db,zi,Wn,Eo,df,Cb,ad,uf;function FM(i){return`
1750    <style>
1751      :host {
1752        transition: var(--media-menu-item-transition,
1753          background .15s linear,
1754          opacity .2s ease-in-out
1755        );
1756        outline: var(--media-menu-item-outline, 0);
1757        outline-offset: var(--media-menu-item-outline-offset, -1px);
1758        cursor: var(--media-cursor, pointer);
1759        display: flex;
1760        align-items: center;
1761        align-self: stretch;
1762        justify-self: stretch;
1763        white-space: nowrap;
1764        white-space-collapse: collapse;
1765        text-wrap: nowrap;
1766        padding: .4em .8em .4em 1em;
1767      }
1768
1769      :host(:focus-visible) {
1770        box-shadow: var(--media-menu-item-focus-shadow, inset 0 0 0 2px rgb(27 127 204 / .9));
1771        outline: var(--media-menu-item-hover-outline, 0);
1772        outline-offset: var(--media-menu-item-hover-outline-offset,  var(--media-menu-item-outline-offset, -1px));
1773      }
1774
1775      :host(:hover) {
1776        cursor: var(--media-cursor, pointer);
1777        background: var(--media-menu-item-hover-background, rgb(92 92 102 / .5));
1778        outline: var(--media-menu-item-hover-outline);
1779        outline-offset: var(--media-menu-item-hover-outline-offset,  var(--media-menu-item-outline-offset, -1px));
1780      }
1781
1782      :host([aria-checked="true"]) {
1783        background: var(--media-menu-item-checked-background);
1784      }
1785
1786      :host([hidden]) {
1787        display: none;
1788      }
1789
1790      :host([disabled]) {
1791        pointer-events: none;
1792        color: rgba(255, 255, 255, .3);
1793      }
1794
1795      slot:not([name]) {
1796        width: 100%;
1797      }
1798
1799      slot:not([name="submenu"]) {
1800        display: inline-flex;
1801        align-items: center;
1802        transition: inherit;
1803        opacity: var(--media-menu-item-opacity, 1);
1804      }
1805
1806      slot[name="description"] {
1807        justify-content: end;
1808      }
1809
1810      slot[name="description"] > span {
1811        display: inline-block;
1812        margin-inline: 1em .2em;
1813        max-width: var(--media-menu-item-description-max-width, 100px);
1814        text-overflow: ellipsis;
1815        overflow: hidden;
1816        font-size: .8em;
1817        font-weight: 400;
1818        text-align: right;
1819        position: relative;
1820        top: .04em;
1821      }
1822
1823      slot[name="checked-indicator"] {
1824        display: none;
1825      }
1826
1827      :host(:is([role="menuitemradio"],[role="menuitemcheckbox"])) slot[name="checked-indicator"] {
1828        display: var(--media-menu-item-checked-indicator-display, inline-block);
1829      }
1830
1831      
1832      svg, img, ::slotted(svg), ::slotted(img) {
1833        height: var(--media-menu-item-icon-height, var(--media-control-height, 24px));
1834        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
1835        display: block;
1836      }
1837
1838      
1839      [part~="indicator"],
1840      ::slotted([part~="indicator"]) {
1841        fill: var(--media-menu-item-indicator-fill,
1842          var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))));
1843        height: var(--media-menu-item-indicator-height, 1.25em);
1844        margin-right: .5ch;
1845      }
1846
1847      [part~="checked-indicator"] {
1848        visibility: hidden;
1849      }
1850
1851      :host([aria-checked="true"]) [part~="checked-indicator"] {
1852        visibility: visible;
1853      }
1854    </style>
1855    <slot name="checked-indicator">
1856      <svg aria-hidden="true" viewBox="0 1 24 24" part="checked-indicator indicator">
1857        <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"/>
1858      </svg>
1859    </slot>
1860    <slot name="prefix"></slot>
1861    <slot></slot>
1862    <slot name="description"></slot>
1863    <slot name="suffix">
1864      ${this.getSuffixSlotInnerHTML(i)}
1865    </slot>
1866    <slot name="submenu"></slot>
1867  `}function BM(i){return""}const Xt={TYPE:"type",VALUE:"value",CHECKED:"checked",DISABLED:"disabled"};class Ys extends k.HTMLElement{constructor(){if(super(),rs(this,lf),rs(this,nu),rs(this,rp),rs(this,Wn),rs(this,df),rs(this,ad),rs(this,nd,!1),rs(this,Ya,void 0),rs(this,zi,()=>{var e,t;this.submenuElement.items&&this.setAttribute("submenusize",`${this.submenuElement.items.length}`);const s=this.shadowRoot.querySelector('slot[name="description"]'),r=(e=this.submenuElement.checkedItems)==null?void 0:e[0],n=(t=r?.dataset.description)!=null?t:r?.text,a=rt.createElement("span");a.textContent=n??"",s.replaceChildren(a)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=jt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.shadowRoot.addEventListener("slotchange",this)}static get observedAttributes(){return[Xt.TYPE,Xt.DISABLED,Xt.CHECKED,Xt.VALUE]}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),la(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":Ei(this,lf,kb).call(this,e);break;case"click":this.handleClick(e);break;case"keydown":Ei(this,df,Cb).call(this,e);break;case"keyup":Ei(this,Wn,Eo).call(this,e);break}}attributeChangedCallback(e,t,s){e===Xt.CHECKED&&la(this)&&!ji(this,nd)?this.setAttribute("aria-checked",s!=null?"true":"false"):e===Xt.TYPE&&s!==t?this.role="menuitem"+s:e===Xt.DISABLED&&s!==t&&(s==null?this.enable():this.disable())}connectedCallback(){this.hasAttribute(Xt.DISABLED)||this.enable(),this.role="menuitem"+this.type,Lc(this,Ya,cf(this,this.parentNode)),Ei(this,ad,uf).call(this),this.submenuElement&&Ei(this,nu,sp).call(this)}disconnectedCallback(){this.disable(),Ei(this,ad,uf).call(this),Lc(this,Ya,null)}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(e){this.setAttribute("invoketarget",`${e}`)}get invokeTargetElement(){var e;return this.invokeTarget?(e=Tu(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(Xt.TYPE))!=null?e:""}set type(e){this.setAttribute(Xt.TYPE,`${e}`)}get value(){var e;return(e=this.getAttribute(Xt.VALUE))!=null?e:this.text}set value(e){this.setAttribute(Xt.VALUE,e)}get text(){var e;return((e=this.textContent)!=null?e:"").trim()}get checked(){if(la(this))return this.getAttribute("aria-checked")==="true"}set checked(e){la(this)&&(Lc(this,nd,!0),this.setAttribute("aria-checked",e?"true":"false"),e?this.part.add("checked"):this.part.remove("checked"))}handleClick(e){la(this)||this.invokeTargetElement&&vs(this,e.target)&&this.invokeTargetElement.dispatchEvent(new Qm({relatedTarget:this}))}get keysUsed(){return["Enter"," "]}}nd=new WeakMap;Ya=new WeakMap;lf=new WeakSet;kb=function(i){const e=i.target;if(!e?.name)for(const s of e.assignedNodes({flatten:!0}))s instanceof Text&&s.textContent.trim()===""&&s.remove();e.name==="submenu"&&(this.submenuElement?Ei(this,nu,sp).call(this):Ei(this,rp,Db).call(this))};nu=new WeakSet;sp=async function(){this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded",`${!this.submenuElement.hidden}`),this.submenuElement.addEventListener("change",ji(this,zi)),this.submenuElement.addEventListener("addmenuitem",ji(this,zi)),this.submenuElement.addEventListener("removemenuitem",ji(this,zi)),ji(this,zi).call(this)};rp=new WeakSet;Db=function(){this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.submenuElement.removeEventListener("change",ji(this,zi)),this.submenuElement.removeEventListener("addmenuitem",ji(this,zi)),this.submenuElement.removeEventListener("removemenuitem",ji(this,zi)),ji(this,zi).call(this)};zi=new WeakMap;Wn=new WeakSet;Eo=function(i){const{key:e}=i;if(!this.keysUsed.includes(e)){this.removeEventListener("keyup",Ei(this,Wn,Eo));return}this.handleClick(i)};df=new WeakSet;Cb=function(i){const{metaKey:e,altKey:t,key:s}=i;
1867if(e||t||!this.keysUsed.includes(s)){this.removeEventListener("keyup",Ei(this,Wn,Eo));return}this.addEventListener("keyup",Ei(this,Wn,Eo),{once:!0})};ad=new WeakSet;uf=function(){var i;const e=(i=ji(this,Ya))==null?void 0:i.radioGroupItems;if(!e)return;let t=e.filter(s=>s.getAttribute("aria-checked")==="true").pop();t||(t=e[0]);for(const s of e)s.setAttribute("aria-checked","false");t?.setAttribute("aria-checked","true")};Ys.shadowRootOptions={mode:"open"};Ys.getTemplateHTML=FM;Ys.getSuffixSlotInnerHTML=BM;function la(i){return i.type==="radio"||i.type==="checkbox"}function cf(i,e){if(!i)return null;const{host:t}=i.getRootNode();return!e&&t?cf(i,t):e?.items?e:cf(e,e?.parentNode)}k.customElements.get("media-chrome-menu-item")||k.customElements.define("media-chrome-menu-item",Ys);function HM(i){return`
1868    ${ni.getTemplateHTML(i)}
1869    <style>
1870      :host {
1871        --_menu-bg: rgb(20 20 30 / .8);
1872        background: var(--media-settings-menu-background,
1873            var(--media-menu-background,
1874              var(--media-control-background,
1875                var(--media-secondary-color, var(--_menu-bg)))));
1876        min-width: var(--media-settings-menu-min-width, 170px);
1877        border-radius: 2px 2px 0 0;
1878        overflow: hidden;
1879      }
1880
1881      @-moz-document url-prefix() {
1882        :host{
1883          --_menu-bg: rgb(20 20 30);
1884        }
1885      }
1886
1887      :host([role="menu"]) {
1888        
1889        justify-content: end;
1890      }
1891
1892      slot:not([name]) {
1893        justify-content: var(--media-settings-menu-justify-content);
1894        flex-direction: var(--media-settings-menu-flex-direction, column);
1895        overflow: visible;
1896      }
1897
1898      #container.has-expanded {
1899        --media-settings-menu-item-opacity: 0;
1900      }
1901    </style>
1902  `}class wb extends ni{get anchorElement(){return this.anchor!=="auto"?super.anchorElement:wt(this).querySelector("media-settings-menu-button")}}wb.getTemplateHTML=HM;k.customElements.get("media-settings-menu")||k.customElements.define("media-settings-menu",wb);function GM(i){return`
1903    ${Ys.getTemplateHTML.call(this,i)}
1904    <style>
1905      slot:not([name="submenu"]) {
1906        opacity: var(--media-settings-menu-item-opacity, var(--media-menu-item-opacity));
1907      }
1908
1909      :host([aria-expanded="true"]:hover) {
1910        background: transparent;
1911      }
1912    </style>
1913  `}function KM(i){return`
1914    <svg aria-hidden="true" viewBox="0 0 20 24">
1915      <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"/>
1916    </svg>
1917  `}class Mu extends Ys{}Mu.shadowRootOptions={mode:"open"};Mu.getTemplateHTML=GM;Mu.getSuffixSlotInnerHTML=KM;k.customElements.get("media-settings-menu-item")||k.customElements.define("media-settings-menu-item",Mu);class Xn extends gt{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=Tu(this))==null?void 0:e.querySelector(`#${this.invokeTarget}`):null}handleClick(){var e;(e=this.invokeTargetElement)==null||e.dispatchEvent(new Qm({relatedTarget:this}))}}k.customElements.get("media-chrome-menu-button")||k.customElements.define("media-chrome-menu-button",Xn);function VM(){return`
1918    <style>
1919      :host([aria-expanded="true"]) slot[name=tooltip] {
1920        display: none;
1921      }
1922    </style>
1923    <slot name="icon">
1924      <svg aria-hidden="true" viewBox="0 0 24 24">
1925        <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"/>
1926      </svg>
1927    </slot>
1928  `}function WM(){return J("Settings")}class np extends Xn{static get observedAttributes(){return[...super.observedAttributes,"target"]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",J("settings"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:wt(this).querySelector("media-settings-menu")}}np.getSlotTemplateHTML=VM;np.getTooltipContentHTML=WM;k.customElements.get("media-settings-menu-button")||k.customElements.define("media-settings-menu-button",np);var ap=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Mb=(i,e,t)=>(ap(i,e,"read from private field"),t?t.call(i):e.get(i)),sl=(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)},hf=(i,e,t,s)=>(ap(i,e,"write to private field"),e.set(i,t),t),rl=(i,e,t)=>(ap(i,e,"access private method"),t),Da,au,od,ff,ld,mf;class qM extends ni{constructor(){super(...arguments),sl(this,od),sl(this,ld),sl(this,Da,[]),sl(this,au,void 0)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_AUDIO_TRACK_LIST,_.MEDIA_AUDIO_TRACK_ENABLED,_.MEDIA_AUDIO_TRACK_UNAVAILABLE]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_AUDIO_TRACK_ENABLED&&t!==s?this.value=s:e===_.MEDIA_AUDIO_TRACK_LIST&&t!==s&&(hf(this,Da,xD(s??"")),rl(this,od,ff).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",rl(this,ld,mf))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",rl(this,ld,mf))}get anchorElement(){var e;return this.anchor!=="auto"?super.anchorElement:(e=wt(this))==null?void 0:e.querySelector("media-audio-track-menu-button")}get mediaAudioTrackList(){return Mb(this,Da)}set mediaAudioTrackList(e){hf(this,Da,e),rl(this,od,ff).call(this)}get mediaAudioTrackEnabled(){var e;return(e=Ne(this,_.MEDIA_AUDIO_TRACK_ENABLED))!=null?e:""}set mediaAudioTrackEnabled(e){Ue(this,_.MEDIA_AUDIO_TRACK_ENABLED,e)}}Da=new WeakMap;au=new WeakMap;od=new WeakSet;ff=function(){if(Mb(this,au)===JSON.stringify(this.mediaAudioTrackList))return;hf(this,au,JSON.stringify(this.mediaAudioTrackList));const i=this.mediaAudioTrackList;this.defaultSlot.textContent="",i.sort((e,t)=>
1928e.id.localeCompare(t.id,void 0,{numeric:!0}));for(const e of i){const t=this.formatMenuItemText(e.label,e),s=Vn({type:"radio",text:t,value:`${e.id}`,checked:e.enabled});s.prepend(Lr(this,"checked-indicator")),this.defaultSlot.append(s)}};ld=new WeakSet;mf=function(){if(this.value==null)return;const i=new k.CustomEvent(q.MEDIA_AUDIO_TRACK_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};k.customElements.get("media-audio-track-menu")||k.customElements.define("media-audio-track-menu",qM);const YM=`<svg aria-hidden="true" viewBox="0 0 24 24">
1929  <path d="M11 17H9.5V7H11v10Zm-3-3H6.5v-4H8v4Zm6-5h-1.5v6H14V9Zm3 7h-1.5V8H17v8Z"/>
1930  <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"/>
1931</svg>`;function jM(){return`
1932    <style>
1933      :host([aria-expanded="true"]) slot[name=tooltip] {
1934        display: none;
1935      }
1936    </style>
1937    <slot name="icon">${YM}</slot>
1938  `}function zM(){return J("Audio")}const q0=i=>{const e=J("Audio");i.setAttribute("aria-label",e)};class op extends Xn{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_AUDIO_TRACK_ENABLED,_.MEDIA_AUDIO_TRACK_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),q0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_LANG&&q0(this)}get invokeTargetElement(){var e;return this.invokeTarget!=null?super.invokeTargetElement:(e=wt(this))==null?void 0:e.querySelector("media-audio-track-menu")}get mediaAudioTrackEnabled(){var e;return(e=Ne(this,_.MEDIA_AUDIO_TRACK_ENABLED))!=null?e:""}set mediaAudioTrackEnabled(e){Ue(this,_.MEDIA_AUDIO_TRACK_ENABLED,e)}}op.getSlotTemplateHTML=jM;op.getTooltipContentHTML=zM;k.customElements.get("media-audio-track-menu-button")||k.customElements.define("media-audio-track-menu-button",op);var lp=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},QM=(i,e,t)=>(lp(i,e,"read from private field"),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)},XM=(i,e,t,s)=>(lp(i,e,"write to private field"),e.set(i,t),t),nl=(i,e,t)=>(lp(i,e,"access private method"),t),ou,dd,pf,ud,gf;const ZM=`
1939  <svg aria-hidden="true" viewBox="0 0 26 24" part="captions-indicator indicator">
1940    <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"/>
1941  </svg>`;function JM(i){return`
1942    ${ni.getTemplateHTML(i)}
1943    <slot name="captions-indicator" hidden>${ZM}</slot>
1944  `}class Pb extends ni{constructor(){super(...arguments),Rc(this,dd),Rc(this,ud),Rc(this,ou,void 0)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_SUBTITLES_LIST,_.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_SUBTITLES_LIST&&t!==s?nl(this,dd,pf).call(this):e===_.MEDIA_SUBTITLES_SHOWING&&t!==s&&(this.value=s||"",nl(this,dd,pf).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",nl(this,ud,gf))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",nl(this,ud,gf))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:wt(this).querySelector("media-captions-menu-button")}get mediaSubtitlesList(){return Y0(this,_.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){j0(this,_.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return Y0(this,_.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){j0(this,_.MEDIA_SUBTITLES_SHOWING,e)}}ou=new WeakMap;dd=new WeakSet;pf=function(){var i;const e=QM(this,ou)!==JSON.stringify(this.mediaSubtitlesList),t=this.value!==this.getAttribute(_.MEDIA_SUBTITLES_SHOWING);if(!e&&!t)return;XM(this,ou,JSON.stringify(this.mediaSubtitlesList)),this.defaultSlot.textContent="";const s=!this.value,r=Vn({type:"radio",text:this.formatMenuItemText(J("Off")),value:"off",checked:s});r.prepend(Lr(this,"checked-indicator")),this.defaultSlot.append(r);const n=this.mediaSubtitlesList;for(const a of n){const o=Vn({type:"radio",text:this.formatMenuItemText(a.label,a),value:Sh(a),checked:this.value==Sh(a)});o.prepend(Lr(this,"checked-indicator")),((i=a.kind)!=null?i:"subs")==="captions"&&o.append(Lr(this,"captions-indicator")),this.defaultSlot.append(o)}};ud=new WeakSet;gf=function(){const i=this.mediaSubtitlesShowing,e=this.getAttribute(_.MEDIA_SUBTITLES_SHOWING),t=this.value!==e;if(i?.length&&t&&this.dispatchEvent(new k.CustomEvent(q.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:i})),!this.value||!t)return;const s=new k.CustomEvent(q.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(s)};Pb.getTemplateHTML=JM;const Y0=(i,e)=>{const t=i.getAttribute(e);return t?Iu(t):[]},j0=(i,e,t)=>{if(!t?.length){i.removeAttribute(e);return}const s=uo(t);i.getAttribute(e)!==s&&i.setAttribute(e,s)};k.customElements.get("media-captions-menu")||k.customElements.define("media-captions-menu",Pb);const eP=`<svg aria-hidden="true" viewBox="0 0 26 24">
1945  <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 
19450 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"/>
1946</svg>`,tP=`<svg aria-hidden="true" viewBox="0 0 26 24">
1947  <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"/>
1948</svg>`;function iP(){return`
1949    <style>
1950      :host([data-captions-enabled="true"]) slot[name=off] {
1951        display: none !important;
1952      }
1953
1954      
1955      :host(:not([data-captions-enabled="true"])) slot[name=on] {
1956        display: none !important;
1957      }
1958
1959      :host([aria-expanded="true"]) slot[name=tooltip] {
1960        display: none;
1961      }
1962    </style>
1963
1964    <slot name="icon">
1965      <slot name="on">${eP}</slot>
1966      <slot name="off">${tP}</slot>
1967    </slot>
1968  `}function sP(){return J("Captions")}const z0=i=>{i.setAttribute("data-captions-enabled",ET(i).toString())},Q0=i=>{i.setAttribute("aria-label",J("closed captions"))};class dp extends Xn{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_SUBTITLES_LIST,_.MEDIA_SUBTITLES_SHOWING,_.MEDIA_LANG]}connectedCallback(){super.connectedCallback(),Q0(this),z0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_SUBTITLES_SHOWING?z0(this):e===_.MEDIA_LANG&&Q0(this)}get invokeTargetElement(){var e;return this.invokeTarget!=null?super.invokeTargetElement:(e=wt(this))==null?void 0:e.querySelector("media-captions-menu")}get mediaSubtitlesList(){return X0(this,_.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){Z0(this,_.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return X0(this,_.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){Z0(this,_.MEDIA_SUBTITLES_SHOWING,e)}}dp.getSlotTemplateHTML=iP;dp.getTooltipContentHTML=sP;const X0=(i,e)=>{const t=i.getAttribute(e);return t?Iu(t):[]},Z0=(i,e,t)=>{if(!t?.length){i.removeAttribute(e);return}const s=uo(t);i.getAttribute(e)!==s&&i.setAttribute(e,s)};k.customElements.get("media-captions-menu-button")||k.customElements.define("media-captions-menu-button",dp);var Ob=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},mn=(i,e,t)=>(Ob(i,e,"read from private field"),t?t.call(i):e.get(i)),xc=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Vr=(i,e,t)=>(Ob(i,e,"access private method"),t),Os,pn,Ca,cd,vf;const kc={RATES:"rates"};class rP extends ni{constructor(){super(),xc(this,pn),xc(this,cd),xc(this,Os,new Em(this,kc.RATES,{defaultValue:XT})),Vr(this,pn,Ca).call(this)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PLAYBACK_RATE,kc.RATES]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_PLAYBACK_RATE&&t!=s?(this.value=s,Vr(this,pn,Ca).call(this)):e===kc.RATES&&t!=s&&(mn(this,Os).value=s,Vr(this,pn,Ca).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Vr(this,cd,vf))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Vr(this,cd,vf))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:wt(this).querySelector("media-playback-rate-menu-button")}get rates(){return mn(this,Os)}set rates(e){e?Array.isArray(e)?mn(this,Os).value=e.join(" "):typeof e=="string"&&(mn(this,Os).value=e):mn(this,Os).value="",Vr(this,pn,Ca).call(this)}get mediaPlaybackRate(){return Oe(this,_.MEDIA_PLAYBACK_RATE,_n)}set mediaPlaybackRate(e){Ye(this,_.MEDIA_PLAYBACK_RATE,e)}}Os=new WeakMap;pn=new WeakSet;Ca=function(){this.defaultSlot.textContent="";const i=this.mediaPlaybackRate,e=new Set(Array.from(mn(this,Os)).map(s=>Number(s)));i>0&&!e.has(i)&&e.add(i);const t=Array.from(e).sort((s,r)=>s-r);for(const s of t){const r=Vn({type:"radio",text:this.formatMenuItemText(`${s}x`,s),value:s.toString(),checked:i===s});r.prepend(Lr(this,"checked-indicator")),this.defaultSlot.append(r)}};cd=new WeakSet;vf=function(){if(!this.value)return;const i=new k.CustomEvent(q.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};k.customElements.get("media-playback-rate-menu")||k.customElements.define("media-playback-rate-menu",rP);const hd=1;function nP(i){return`
1969    <style>
1970      :host {
1971        min-width: 5ch;
1972        padding: var(--media-button-padding, var(--media-control-padding, 10px 5px));
1973      }
1974      
1975      :host([aria-expanded="true"]) slot {
1976        display: block;
1977      }
1978
1979      :host([aria-expanded="true"]) slot[name=tooltip] {
1980        display: none;
1981      }
1982    </style>
1983    <slot name="icon">${i.mediaplaybackrate||hd}x</slot>
1984  `}function aP(){return J("Playback rate")}class up extends Xn{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PLAYBACK_RATE]}constructor(){var e;super(),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${(e=this.mediaPlaybackRate)!=null?e:hd}x`}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),e===_.MEDIA_PLAYBACK_RATE){const r=s?+s:Number.NaN,n=Number.isNaN(r)?hd:r;this.container.innerHTML=`${n}x`,this.setAttribute("aria-label",J("Playback rate {playbackRate}",{playbackRate:n}))}}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:wt(this).querySelector("media-playback-rate-menu")}get mediaPlaybackRate(){return Oe(this,_.MEDIA_PLAYBACK_RATE,hd)}set mediaPlaybackRate(e){Ye(this,_.MEDIA_PLAYBACK_RATE,e)}}up.getSlotTemplateHTML=nP;up.getTooltipContentHTML=aP;k.customElements.get("media-playback-rate-menu-button")||k.customElements.define("media-playback-rate-menu-button",up);var cp=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},wa=(i,e,t)=>(cp(i,e,"read from private field"),t?t.call(i):e.get(i)),al=(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)},J0=(i,e,t,s)=>(cp(i,e,"write to private field"),e.set(i,t),t),Wr=(i,e,t)=>(cp(i,e,"access private method"),t),Ma,An,gn,Pa,fd,Ef;class oP extends ni{constructor(){super(...arguments),al(this,gn),al(this,fd),al(this,Ma,[]),al(this,An,{})}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_RENDITION_LIST,_.MEDIA_RENDITION_SELECTED,_.MEDIA_RENDITION_UNAVAILABLE,_.MEDIA_HEIGHT]}static formatMenuItemText(e,t){return super.formatMenuItemText(e,t)}static formatRendition(e,{showBitrate:t=!1}={}){const s=`${Math.min(e.width,e.height)}p`;if(t&&e.bitrate){const r=e.bitrate/1e6,n=`${r.toFixed(r<1?1:0)} Mbps`;return`${s} (${n})`}return this.formatMenuItemText(s,e)}static compareRendition(e,t){var s,r;return t.height===e.height?((s=t.bitrate)!=null?s:0)-((r=e.bitrate)!=null?r:0):t.height-e.height}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_RENDITION_SELECTED&&t!==s?(this.value=s??"auto",Wr(this,gn,Pa).call(this)):e===_.MEDIA_RENDITION_LIST&&t!==s?(J0(this,Ma,SD(s)),Wr(this,gn,Pa).call(this)):e===_.MEDIA_HEIGHT&&t!==s&&Wr(this,gn,Pa).call(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Wr(this,fd,Ef))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Wr(this,fd,Ef))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:wt(this).querySelector("media-rendition-menu-button")}get mediaRenditionList(){return wa(this,Ma)}set mediaRenditionList(e){J0(this,Ma,e),Wr(this,gn,Pa).call(this)}get mediaRenditionSelected(){return Ne(this,_.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){Ue(this,_.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return Oe(this,_.MEDIA_HEIGHT)}set mediaHeight(e){Ye(this,_.MEDIA_HEIGHT,e)}compareRendition(e,t){return this.constructor.compareRendition(e,t)}formatMenuItemText(e,t){return this.constructor.formatMenuItemText(e,t)}formatRendition(e,t){return this.constructor.formatRendition(e,t)}showRenditionBitrate(e){return this.mediaRenditionList.some(t=>t!==e&&t.height===e.height&&t.bitrate!==e.bitrate)}}Ma=new WeakMap;An=new WeakMap;gn=new WeakSet;Pa=function(){if(wa(this,An).mediaRenditionList===JSON.stringify(this.mediaRenditionList)&&wa(this,An).mediaHeight===this.mediaHeight)return;wa(this,An).mediaRenditionList=JSON.stringify(this.mediaRenditionList),wa(this,An).mediaHeight=this.mediaHeight;const i=this.mediaRenditionList.sort(this.compareRendition.bind(this)),e=i.find(a=>a.id===this.mediaRenditionSelected);for(const a of i)a.selected=a===e;this.defaultSlot.textContent="";const t=!this.mediaRenditionSelected;for(const a of i){const o=this.formatRendition(a,{showBitrate:this.showRenditionBitrate(a)}),l=Vn({type:"radio",text:o,value:`${a.id}`,checked:a.selected&&!t});
1984l.prepend(Lr(this,"checked-indicator")),this.defaultSlot.append(l)}const s=e&&this.showRenditionBitrate(e),r=t?e?this.formatMenuItemText(`${J("Auto")} • ${this.formatRendition(e,{showBitrate:s})}`,e):this.formatMenuItemText(`${J("Auto")} (${this.mediaHeight}p)`):this.formatMenuItemText(J("Auto")),n=Vn({type:"radio",text:r,value:"auto",checked:t});n.dataset.description=r,n.prepend(Lr(this,"checked-indicator")),this.defaultSlot.append(n)};fd=new WeakSet;Ef=function(){if(this.value==null)return;const i=new k.CustomEvent(q.MEDIA_RENDITION_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};k.customElements.get("media-rendition-menu")||k.customElements.define("media-rendition-menu",oP);const lP=`<svg aria-hidden="true" viewBox="0 0 24 24">
1985  <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" />
1986</svg>`;function dP(){return`
1987    <style>
1988      :host([aria-expanded="true"]) slot[name=tooltip] {
1989        display: none;
1990      }
1991    </style>
1992    <slot name="icon">${lP}</slot>
1993  `}function uP(){return J("Quality")}class hp extends Xn{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_RENDITION_SELECTED,_.MEDIA_RENDITION_UNAVAILABLE,_.MEDIA_HEIGHT]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",J("quality"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:wt(this).querySelector("media-rendition-menu")}get mediaRenditionSelected(){return Ne(this,_.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){Ue(this,_.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return Oe(this,_.MEDIA_HEIGHT)}set mediaHeight(e){Ye(this,_.MEDIA_HEIGHT,e)}}hp.getSlotTemplateHTML=dP;hp.getTooltipContentHTML=uP;k.customElements.get("media-rendition-menu-button")||k.customElements.define("media-rendition-menu-button",hp);var fp=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Bi=(i,e,t)=>(fp(i,e,"read from private field"),t?t.call(i):e.get(i)),Li=(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)},Nb=(i,e,t,s)=>(fp(i,e,"write to private field"),e.set(i,t),t),ei=(i,e,t)=>(fp(i,e,"access private method"),t),qn,yo,Pu,hr,Sn,mp,Ub,md,yf,pd,Tf,$b,lu,du,gd;function cP(i){return`
1994      ${ni.getTemplateHTML(i)}
1995      <style>
1996        :host {
1997          --_menu-bg: rgb(20 20 30 / .8);
1998          background: var(--media-settings-menu-background,
1999            var(--media-menu-background,
2000              var(--media-control-background,
2001                var(--media-secondary-color, var(--_menu-bg)))));
2002          min-width: var(--media-settings-menu-min-width, 170px);
2003          border-radius: 2px;
2004          overflow: hidden;
2005        }
2006      </style>
2007    `}class Fb extends ni{constructor(){super(),Li(this,yo),Li(this,hr),Li(this,mp),Li(this,md),Li(this,Tf),Li(this,qn,!1),Li(this,pd,e=>{const t=e.target,s=t?.nodeName==="VIDEO",r=ei(this,md,yf).call(this,t);(s||r)&&(Bi(this,qn)?ei(this,hr,Sn).call(this):ei(this,Tf,$b).call(this,e))}),Li(this,lu,e=>{const t=e.target,s=this.contains(t),r=e.button===2,n=t?.nodeName==="VIDEO",a=ei(this,md,yf).call(this,t);s||r&&(n||a)||ei(this,hr,Sn).call(this)}),Li(this,du,e=>{e.key==="Escape"&&ei(this,hr,Sn).call(this)}),Li(this,gd,e=>{var t,s;const r=e.target;if((t=r.matches)!=null&&t.call(r,'button[invoke="copy"]')){const n=(s=r.closest("media-context-menu-item"))==null?void 0:s.querySelector('input[slot="copy"]');n&&navigator.clipboard.writeText(n.value)}ei(this,hr,Sn).call(this)}),this.setAttribute("noautohide",""),ei(this,yo,Pu).call(this)}connectedCallback(){super.connectedCallback(),wt(this).addEventListener("contextmenu",Bi(this,pd)),this.addEventListener("click",Bi(this,gd))}disconnectedCallback(){super.disconnectedCallback(),wt(this).removeEventListener("contextmenu",Bi(this,pd)),this.removeEventListener("click",Bi(this,gd)),document.removeEventListener("mousedown",Bi(this,lu)),document.removeEventListener("keydown",Bi(this,du))}}qn=new WeakMap;yo=new WeakSet;Pu=function(){this.hidden=!Bi(this,qn)};hr=new WeakSet;Sn=function(){Nb(this,qn,!1),ei(this,yo,Pu).call(this)};mp=new WeakSet;Ub=function(){document.querySelectorAll("media-context-menu").forEach(e
vendor: 4,740 bytes, lines 2007-2020
2007=>{var t;e!==this&&ei(t=e,hr,Sn).call(t)})};md=new WeakSet;yf=function(i){return i?i.hasAttribute("slot")&&i.getAttribute("slot")==="media"?!0:i.nodeName.includes("-")&&i.tagName.includes("-")?i.hasAttribute("src")||i.hasAttribute("poster")||i.hasAttribute("preload")||i.hasAttribute("playsinline"):!1:!1};pd=new WeakMap;Tf=new WeakSet;$b=function(i){i.preventDefault(),ei(this,mp,Ub).call(this),Nb(this,qn,!0),this.style.position="fixed",this.style.left=`${i.clientX}px`,this.style.top=`${i.clientY}px`,ei(this,yo,Pu).call(this),document.addEventListener("mousedown",Bi(this,lu),{once:!0}),document.addEventListener("keydown",Bi(this,du),{once:!0})};lu=new WeakMap;du=new WeakMap;gd=new WeakMap;Fb.getTemplateHTML=cP;k.customElements.get("media-context-menu")||k.customElements.define("media-context-menu",Fb);function hP(i){return`
2008    ${Ys.getTemplateHTML.call(this,i)}
2009    <style>
2010        ::slotted(*) {
2011            color: var(--media-text-color, white);
2012            text-decoration: none;
2013            border: none;
2014            background: none;
2015            cursor: pointer;
2016            padding: 0;
2017            min-height: var(--media-control-height, 24px);
2018        }
2019    </style>
2020  `}class pp extends Ys{}pp.shadowRootOptions={mode:"open"};pp.getTemplateHTML=hP;k.customElements.get("media-context-menu-item")||k.customElements.define("media-context-menu-item",pp);var Bb=i=>{throw TypeError(i)},gp=(i,e,t)=>e.has(i)||Bb("Cannot "+t),Ie=(i,e,t)=>(gp(i,e,"read from private field"),t?t.call(i):e.get(i)),gi=(i,e,t)=>e.has(i)?Bb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),Xi=(i,e,t,s)=>(gp(i,e,"write to private field"),e.set(i,t),t),tt=(i,e,t)=>(gp(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 vp=class extends Ou{},fP=class extends Ou{},mP={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(vp)}},vd,pP=class{constructor(e,t={}){gi(this,vd),Xi(this,vd,t?.detail)}get detail(){return Ie(this,vd)}initCustomEvent(){}};vd=new WeakMap;function gP(i,e){return new vp}var Hb={document:{createElement:gP},DocumentFragment,customElements:mP,CustomEvent:pP,EventTarget:Ou,HTMLElement:vp,HTMLVideoElement:fP},Gb=typeof window>"u"||typeof globalThis.customElements>"u",Vi=Gb?Hb:globalThis,uu=Gb?Hb.document:globalThis.document;function vP(i){let e="";return Object.entries(i).forEach(([t,s])=>{s!=null&&(e+=`${bf(t)}: ${s}; `)}),e?e.trim():void 0}function bf(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Kb(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function Ht(i){if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}function Vb(i){let e=EP(i).toString();return e?"?"+e:""}function EP(i){let e={};for(let t in i)i[t]!=null&&(e[t]=i[t]);return new URLSearchParams(e)}var Wb=(i,e)=>!i||!e?!1:i.contains(e)?!0:Wb(i,e.getRootNode().host),qb="mux.com",yP=()=>{try{return"3.10.2"}catch{}return"UNKNOWN"},TP=yP(),Yb=()=>TP,bP=(i,{token:e,customDomain:t=qb,thumbnailTime:s,programTime:r}={})=>{var n;let a=e==null?s:void 0,{aud:o}=(n=kn(e))!=null?n:{};if(!(e&&o!=="t"))return`https://image.${t}/${i}/thumbnail.webp${Vb({token:e,time:a,program_time:r})}`},_P=(i,{token:e,customDomain:t=qb,programStartTime:s,programEndTime:r}={})=>{var n;let{aud:a}=(n=kn(e))!=null?n:{};if(!(e&&a!=="s"))return`https://image.${t}/${i}/storyboard.vtt${Vb({token:e,format:"webp",program_start_time:s,program_end_time:r})}`},Ep=i=>{if(i){if([Se.LIVE,Se.ON_DEMAND].includes(i))return i;if(i!=null&&i.includes("live"))return Se.LIVE}},AP={crossorigin:"crossOrigin",playsinline:"playsInline"};function SP(i){var e;return(e=AP[i])!=null?e:Kb(i)}var vn,En,Dt,IP=class{constructor(e,t){gi(this,vn),gi(this,En),gi(this,Dt,[]),Xi(this,vn,e),Xi(this,En,t)}[Symbol.iterator](){return Ie(this,Dt).values()}get length(){return Ie(this,Dt).length}get value(){var e;return(e=Ie(this,Dt).join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(Xi(this,Dt,[]),this.add(...(t=e?.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return Ie(this,Dt)[e]}values(){return Ie(this,Dt).values()}keys(){return Ie(this,Dt).keys()}forEach(e){Ie(this,Dt).forEach(e)}add(...e){var t,s;e.forEach(r=>{this.contains(r)||Ie(this,Dt).push(r)}),!(this.value===""&&!((t=Ie(this,vn))!=null&&t.hasAttribute(`${Ie(this,En)}`)))&&((s=Ie(this,vn))==null||s.setAttribute(`${Ie(this,En)}`,`${this.value}`))}remove(...e){var t;e.forEach(s=>{Ie(this,Dt).splice(Ie(this,Dt).indexOf(s),1)}),(t=Ie(this,vn))==null||t.setAttribute(`${Ie(this,En)}`,`${this.value}`)}contains(e){return Ie(this,Dt).includes(e)}
vendor: 8,533 bytes, lines 2020-2108
2020toggle(e,t){return typeof t<"u"?t?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){this.remove(e),this.add(t)}};vn=new WeakMap,En=new WeakMap,Dt=new WeakMap;var jb=`[mux-player ${Yb()}]`;function us(...i){console.warn(jb,...i)}function ti(...i){console.error(jb,...i)}function zb(i){var e;let t=(e=i.message)!=null?e:"";i.context&&(t+=` ${i.context}`),i.file&&(t+=` ${ie("Read more: ")}
2021https://github.com/muxinc/elements/blob/main/errors/${i.file}`),us(t)}var At={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},lr={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},ev=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}}),LP=Object.values(At).filter(i=>At.PLAYSINLINE!==i),RP=Object.values(lr),xP=[...LP,...RP],kP=class extends Vi.HTMLElement{static get observedAttributes(){return xP}constructor(){super()}attributeChangedCallback(i,e,t){var s,r;switch(i){case lr.MUTED:{this.media&&(this.media.muted=t!=null,this.media.defaultMuted=t!=null);return}case lr.VOLUME:{let n=(s=Ht(t))!=null?s:1;this.media&&(this.media.volume=n);return}case lr.PLAYBACKRATE:{let n=(r=Ht(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:ev}get seekable(){var i,e;return(e=(i=this.media)==null?void 0:i.seekable)!=null?e:ev}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=Ht(this.getAttribute(lr.PLAYBACKRATE)))!=null?i:1}set defaultPlaybackRate(i){i!=null?this.setAttribute(lr.PLAYBACKRATE,`${i}`):this.removeAttribute(lr.PLAYBACKRATE)}get crossOrigin(){return da(this,At.CROSSORIGIN)}set crossOrigin(i){this.setAttribute(At.CROSSORIGIN,`${i}`)}get autoplay(){return da(this,At.AUTOPLAY)!=null}set autoplay(i){i?this.setAttribute(At.AUTOPLAY,typeof i=="string"?i:""):this.removeAttribute(At.AUTOPLAY)}get loop(){return da(this,At.LOOP)!=null}set loop(i){i?this.setAttribute(At.LOOP,""):this.removeAttribute(At.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 da(this,At.MUTED)!=null}set defaultMuted(i){i?this.setAttribute(At.MUTED,""):this.removeAttribute(At.MUTED)}get playsInline(){return da(this,At.PLAYSINLINE)!=null}set playsInline(i){ti("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(At.PRELOAD,i):this.removeAttribute(At.PRELOAD)}};function da(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var tv=kP,DP=`:host {
2022  --media-control-display: var(--controls);
2023  --media-loading-indicator-display: var(--loading-indicator);
2024  --media-dialog-display: var(--dialog);
2025  --media-play-button-display: var(--play-button);
2026  --media-live-button-display: var(--live-button);
2027  --media-seek-backward-button-display: var(--seek-backward-button);
2028  --media-seek-forward-button-display: var(--seek-forward-button);
2029  --media-mute-button-display: var(--mute-button);
2030  --media-captions-button-display: var(--captions-button);
2031  --media-captions-menu-button-display: var(--captions-menu-button, var(--media-captions-button-display));
2032  --media-rendition-menu-button-display: var(--rendition-menu-button);
2033  --media-audio-track-menu-button-display: var(--audio-track-menu-button);
2034  --media-airplay-button-display: var(--airplay-button);
2035  --media-pip-button-display: var(--pip-button);
2036  --media-fullscreen-button-display: var(--fullscreen-button);
2037  --media-cast-button-display: var(--cast-button, var(--_cast-button-drm-display));
2038  --media-playback-rate-button-display: var(--playback-rate-button);
2039  --media-playback-rate-menu-button-display: var(--playback-rate-menu-button);
2040  --media-volume-range-display: var(--volume-range);
2041  --media-time-range-display: var(--time-range);
2042  --media-time-display-display: var(--time-display);
2043  --media-duration-display-display: var(--duration-display);
2044  --media-title-display-display: var(--title-display);
2045
2046  display: inline-block;
2047  line-height: 0;
2048  width: 100%;
2049}
2050
2051a {
2052  color: #fff;
2053  font-size: 0.9em;
2054  text-decoration: underline;
2055}
2056
2057media-theme {
2058  display: inline-block;
2059  line-height: 0;
2060  width: 100%;
2061  height: 100%;
2062  direction: ltr;
2063}
2064
2065media-poster-image {
2066  display: inline-block;
2067  line-height: 0;
2068  width: 100%;
2069  height: 100%;
2070}
2071
2072media-poster-image:not([src]):not([placeholdersrc]) {
2073  display: none;
2074}
2075
2076::part(top),
2077[part~='top'] {
2078  --media-control-display: var(--controls, var(--top-controls));
2079  --media-play-button-display: var(--play-button, var(--top-play-button));
2080  --media-live-button-display: var(--live-button, var(--top-live-button));
2081  --media-seek-backward-button-display: var(--seek-backward-button, var(--top-seek-backward-button));
2082  --media-seek-forward-button-display: var(--seek-forward-button, var(--top-seek-forward-button));
2083  --media-mute-button-display: var(--mute-button, var(--top-mute-button));
2084  --media-captions-button-display: var(--captions-button, var(--top-captions-button));
2085  --media-captions-menu-button-display: var(
2086    --captions-menu-button,
2087    var(--media-captions-button-display, var(--top-captions-menu-button))
2088  );
2089  --media-rendition-menu-button-display: var(--rendition-menu-button, var(--top-rendition-menu-button));
2090  --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--top-audio-track-menu-button));
2091  --media-airplay-button-display: var(--airplay-button, var(--top-airplay-button));
2092  --media-pip-button-display: var(--pip-button, var(--top-pip-button));
2093  --media-fullscreen-button-display: var(--fullscreen-button, var(--top-fullscreen-button));
2094  --media-cast-button-display: var(--cast-button, var(--top-cast-button, var(--_cast-button-drm-display)));
2095  --media-playback-rate-button-display: var(--playback-rate-button, var(--top-playback-rate-button));
2096  --media-playback-rate-menu-button-display: var(
2097    --captions-menu-button,
2098    var(--media-playback-rate-button-display, var(--top-playback-rate-menu-button))
2099  );
2100  --media-volume-range-display: var(--volume-range, var(--top-volume-range));
2101  --media-time-range-display: var(--time-range, var(--top-time-range));
2102  --media-time-display-display: var(--time-display, var(--top-time-display));
2103  --media-duration-display-display: var(--duration-display, var(--top-duration-display));
2104  --media-title-display-display: var(--title-display, var(--top-title-display));
2105}
2106
2107::part(center),
2108[part~='center'] {
2109  --media-control-display: var(--controls, var(--center-controls));
2110  --media-play-button-display: var(--play-button, var(--center-play-button));
2111  --media-live-button-display: var(--live-button, var(--center-live-button));
2112  --media-seek-backward-button-display: var(--seek-backward-button, var(--center-seek-backward-button));
2113  --media-seek-forward-button-display: var(--seek-forward-button, var(--center-seek-forward-button));
2114  --media-mute-button-display: var(--mute-button, var(--center-mute-button));
2115  --media-captions-button-display: var(--captions-button, var(--center-captions-button));
2116  --media-captions-menu-button-display: var(
2117    --captions-menu-button,
2118    var(--media-captions-button-display, var(--center-captions-menu-button))
2119  );
2120  --media-rendition-menu-button-display: var(--rendition-menu-button, var(--center-rendition-menu-button));
2121  --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--center-audio-track-menu-button));
2122  --media-airplay-button-display: var(--airplay-button, var(--center-airplay-button));
2123  --media-pip-button-display: var(--pip-button, var(--center-pip-button));
2124  --media-fullscreen-button-display: var(--fullscreen-button, var(--center-fullscreen-button));
2125  --media-cast-button-display: var(--cast-button, var(--center-cast-button, var(--_cast-button-drm-display)));
2126  --media-playback-rate-button-display: var(--playback-rate-button, var(--center-playback-rate-button));
2127  --media-playback-rate-menu-button-display: var(
2128    --playback-rate-menu-button,
2129    var(--media-playback-rate-button-display, var(--center-playback-rate-menu-button))
2130  );
2131  --media-volume-range-display: var(--volume-range, var(--center-volume-range));
2132  --media-time-range-display: var(--time-range, var(--center-time-range));
2133  --media-time-display-display: var(--time-display, var(--center-time-display));
2134  --media-duration-display-display: var(--duration-display, var(--center-duration-display));
2135}
2136
2137::part(bottom),
2138[part~='bottom'] {
2139  --media-control-display: var(--controls, var(--bottom-controls));
2140  --media-play-button-display: var(--play-button, var(--bottom-play-button));
2141  --media-live-button-display: var(--live-button, var(--bottom-live-button));
2142  --media-seek-backward-button-display: var(--seek-backward-button, var(--bottom-seek-backward-button));
2143  --media-seek-forward-button-display: var(--seek-forward-button, var(--bottom-seek-forward-button));
2144  --media-mute-button-display: var(--mute-button, var(--bottom-mute-button));
2145  --media-captions-button-display: var(--captions-button, var(--bottom-captions-button));
2146  --media-captions-menu-button-display: var(
2147    --captions-menu-button,
2148    var(--media-captions-button-display, var(--bottom-captions-menu-button))
2149  );
2150  --media-rendition-menu-button-display: var(--rendition-menu-button, var(--bottom-rendition-menu-button));
2151  --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--bottom-audio-track-menu-button));
2152  --media-airplay-button-display: var(--airplay-button, var(--bottom-airplay-button));
2153  --media-pip-button-display: var(--pip-button, var(--bottom-pip-button));
2154  --media-fullscreen-button-display: var(--fullscreen-button, var(--bottom-fullscreen-button));
2155  --media-cast-button-display: var(--cast-button, var(--bottom-cast-button, var(--_cast-button-drm-display)));
2156  --media-playback-rate-button-display: var(--playback-rate-button, var(--bottom-playback-rate-button));
2157  --media-playback-rate-menu-button-display: var(
2158    --playback-rate-menu-button,
2159    var(--media-playback-rate-button-display, var(--bottom-playback-rate-menu-button))
2160  );
2161  --media-volume-range-display: var(--volume-range, var(--bottom-volume-range));
2162  --media-time-range-display: var(--time-range, var(--bottom-time-range));
2163  --media-time-display-display: var(--time-display, var(--bottom-time-display));
2164  --media-duration-display-display: var(--duration-display, var(--bottom-duration-display));
2165  --media-title-display-display: var(--title-display, var(--bottom-title-display));
2166}
2167
2168:host([no-tooltips]) {
2169  --media-tooltip-display: none;
2170}
2171`,ua=new WeakMap,CP=class Qb{constructor(e,t){this.element=e,this.type=t,this.element.addEventListener(this.type,this);let s=ua.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=ua.get(this.element);
vendor: 4,364 bytes, lines 2171-2197
2171t&&t.delete(this.type)}}static for(e){ua.has(e.element)||ua.set(e.element,new Map);let t=e.attributeName.slice(2),s=ua.get(e.element);return s&&s.has(t)?s.get(t):new Qb(e.element,t)}};function wP(i,e){return i instanceof yi&&i.attributeName.startsWith("on")?(CP.for(i).set(e),i.element.removeAttributeNS(i.attributeNamespace,i.attributeName),!0):!1}function MP(i,e){return e instanceof Xb&&i instanceof Qn?(e.renderInto(i),!0):!1}function PP(i,e){return e instanceof DocumentFragment&&i instanceof Qn?(e.childNodes.length&&i.replace(...e.childNodes),!0):!1}function OP(i,e){if(i instanceof yi){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 NP(i,e){if(i instanceof yi&&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 UP(i,e){if(typeof e=="boolean"&&i instanceof yi){let t=i.attributeNamespace,s=i.element.hasAttributeNS(t,i.attributeName);return e!==s&&(i.booleanValue=e),!0}return!1}function $P(i,e){return e===!1&&i instanceof Qn?(i.replace(""),!0):!1}function FP(i,e){NP(i,e)||UP(i,e)||wP(i,e)||$P(i,e)||MP(i,e)||PP(i,e)||OP(i,e)}var Dc=new Map,iv=new WeakMap,sv=new WeakMap,Xb=class{constructor(e,t,s){this.strings=e,this.values=t,this.processor=s,this.stringsKey=this.strings.join("�")}get template(){if(Dc.has(this.stringsKey))return Dc.get(this.stringsKey);{let e=uu.createElement("template"),t=this.strings.length-1;return e.innerHTML=this.strings.reduce((s,r,n)=>s+r+(n<t?`{{ ${n} }}`:""),""),Dc.set(this.stringsKey,e),e}}renderInto(e){var t;let s=this.template;if(iv.get(e)!==s){iv.set(e,s);let n=new Cu(s,this.values,this.processor);sv.set(e,n),e instanceof Qn?e.replace(...n.children):e.appendChild(n);return}let r=sv.get(e);(t=r?.update)==null||t.call(r,this.values)}},BP={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 Ed(i,...e){return new Xb(i,e,BP)}function HP(i,e){i.renderInto(e)}var GP=i=>{let{tokens:e}=i;return e.drm?":host(:not([cast-receiver])) { --_cast-button-drm-display: none; }":""},KP=i=>Ed`
2172  <style>
2173    ${GP(i)}
2174    ${DP}
2175  </style>
2176  ${YP(i)}
2177`,VP=i=>{let e=i.hotKeys?`${i.hotKeys}`:"";return Ep(i.streamType)==="live"&&(e+=" noarrowleft noarrowright"),e},WP={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",THUMB:"thumb",DISPLAY:"display",CONTROL_BAR:"control-bar",MENU_BUTTON:"menu-button",MENU:"menu",MENU_ITEM:"menu-item",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"},qP=Object.values(WP).join(", "),YP=i=>{var e,t,s,r,n,a,o,l,d,u,c,h,f,m,p,g,v,T,y,b,A,L,S,R,x,I,M,F,V,Y,H,N,W,B,j,ee,U,$;return Ed`
2178  <media-theme
2179    template="${i.themeTemplate||!1}"
2180    defaultstreamtype="${(e=i.defaultStreamType)!=null?e:!1}"
2181    hotkeys="${VP(i)||!1}"
2182    nohotkeys="${i.noHotKeys||!i.hasSrc||!1}"
2183    noautoseektolive="${!!((t=i.streamType)!=null&&t.includes(Se.LIVE))&&i.targetLiveWindow!==0}"
2184    novolumepref="${i.novolumepref||!1}"
2185    nomutedpref="${i.nomutedpref||!1}"
2186    disabled="${!i.hasSrc||i.isDialogOpen}"
2187    audio="${(s=i.audio)!=null?s:!1}"
2188    style="${(r=vP({"--media-primary-color":i.primaryColor,"--media-secondary-color":i.secondaryColor,"--media-accent-color":i.accentColor}))!=null?r:!1}"
2189    defaultsubtitles="${!i.defaultHiddenCaptions}"
2190    forwardseekoffset="${(n=i.forwardSeekOffset)!=null?n:!1}"
2191    backwardseekoffset="${(a=i.backwardSeekOffset)!=null?a:!1}"
2192    playbackrates="${(o=i.playbackRates)!=null?o:!1}"
2193    defaultshowremainingtime="${(l=i.defaultShowRemainingTime)!=null?l:!1}"
2194    defaultduration="${(d=i.defaultDuration)!=null?d:!1}"
2195    hideduration="${(u=i.hideDuration)!=null?u:!1}"
2196    title="${(c=i.title)!=null?c:!1}"
2197    videotitle="${(h=i.videoTitle)!=null?h:!1}
2197"
2198    proudlydisplaymuxbadge="${(f=i.proudlyDisplayMuxBadge)!=null?f:!1}"
2199    exportparts="${qP}"
2200    onclose="${i.onCloseErrorDialog}"
2201    onfocusin="${i.onFocusInErrorDialog}"
2202  >
2203    <mux-video
2204      slot="media"
2205      inert="${(m=i.noHotKeys)!=null?m:!1}"
2206      target-live-window="${(p=i.targetLiveWindow)!=null?p:!1}"
2207      stream-type="${(g=Ep(i.streamType))!=null?g:!1}"
2208      crossorigin="${(v=i.crossOrigin)!=null?v:""}"
2209      playsinline
2210      autoplay="${(T=i.autoplay)!=null?T:!1}"
2211      muted="${(y=i.muted)!=null?y:!1}"
2212      loop="${(b=i.loop)!=null?b:!1}"
2213      preload="${(A=i.preload)!=null?A:!1}"
2214      debug="${(L=i.debug)!=null?L:!1}"
2215      prefer-cmcd="${(S=i.preferCmcd)!=null?S:!1}"
2216      disable-tracking="${(R=i.disableTracking)!=null?R:!1}"
2217      disable-cookies="${(x=i.disableCookies)!=null?x:!1}"
2218      prefer-playback="${(I=i.preferPlayback)!=null?I:!1}"
2219      start-time="${i.startTime!=null?i.startTime:!1}"
2220      beacon-collection-domain="${(M=i.beaconCollectionDomain)!=null?M:!1}"
2221      player-init-time="${(F=i.playerInitTime)!=null?F:!1}"
2222      player-software-name="${(V=i.playerSoftwareName)!=null?V:!1}"
2223      player-software-version="${(Y=i.playerSoftwareVersion)!=null?Y:!1}"
2224      env-key="${(H=i.envKey)!=null?H:!1}"
2225      custom-domain="${(N=i.customDomain)!=null?N:!1}"
2226      src="${i.src?i.src:i.playbackId?ah(i):!1}"
2227      cast-src="${i.src?i.src:i.playbackId?ah(i):!1}"
2228      cast-receiver="${(W=i.castReceiver)!=null?W:!1}"
2229      drm-token="${(j=(B=i.tokens)==null?void 0:B.drm)!=null?j:!1}"
2230      exportparts="video"
2231      disable-pseudo-ended="${(ee=i.disablePseudoEnded)!=null?ee:!1}"
2232      max-auto-resolution="${(U=i.maxAutoResolution)!=null?U:!1}"
2233    >
2234      ${i.storyboard?Ed`<track label="thumbnails" default kind="metadata" src="${i.storyboard}" />`:Ed``}
2235      <slot></slot>
2236    </mux-video>
2237    <slot name="poster" slot="poster">
2238      <media-poster-image
2239        part="poster"
2240        exportparts="poster, img"
2241        src="${i.poster?i.poster:!1}"
2242        placeholdersrc="${($=i.placeholder)!=null?$:!1}"
2243      ></media-poster-image>
2244    </slot>
2245  </media-theme>
2246`},Zb=i=>i.charAt(0).toUpperCase()+i.slice(1),jP=(i,e=!1)=>{var t,s;if(i.muxCode){let r=Zb((t=i.errorCategory)!=null?t:"video"),n=pu((s=i.errorCategory)!=null?s:Pe.VIDEO);if(i.muxCode===re.NETWORK_OFFLINE)return ie("Your device appears to be offline",e);if(i.muxCode===re.NETWORK_TOKEN_EXPIRED)return ie("{category} URL has expired",e).format({category:r});if([re.NETWORK_TOKEN_SUB_MISMATCH,re.NETWORK_TOKEN_AUD_MISMATCH,re.NETWORK_TOKEN_AUD_MISSING,re.NETWORK_TOKEN_MALFORMED].includes(i.muxCode))return ie("{category} URL is formatted incorrectly",e).format({category:r});if(i.muxCode===re.NETWORK_TOKEN_MISSING)return ie("Invalid {categoryName} URL",e).format({categoryName:n});if(i.muxCode===re.NETWORK_NOT_FOUND)return ie("{category} does not exist",e).format({category:r});if(i.muxCode===re.NETWORK_NOT_READY){let a=i.streamType==="live"?"Live stream":"Video";return ie("{mediaType} is not currently available",e).format({mediaType:a})}}if(i.code){if(i.code===Q.MEDIA_ERR_NETWORK)return ie("Network Error",e);if(i.code===Q.MEDIA_ERR_DECODE)return ie("Media Error",e);if(i.code===Q.MEDIA_ERR_SRC_NOT_SUPPORTED)return ie("Source Not Supported",e)}return ie("Error",e)},zP=(i,e=!1)=>{var t,s;if(i.muxCode){let r=Zb((t=i.errorCategory)!=null?t:"video"),n=pu((s=i.errorCategory)!=null?s:Pe.VIDEO);return i.muxCode===re.NETWORK_OFFLINE?ie("Check your internet connection and try reloading this video.",e):i.muxCode===re.NETWORK_TOKEN_EXPIRED?ie("The video’s secured {tokenNamePrefix}-token has expired.",e).format({tokenNamePrefix:n}):i.muxCode===re.NETWORK_TOKEN_SUB_MISMATCH?ie("The video’s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",e).format({tokenNamePrefix:n}):i.muxCode===re.NETWORK_TOKEN_MALFORMED?ie("{category} URL is formatted incorrectly",e).format({category:r}):[re.NETWORK_TOKEN_AUD_MISMATCH,re.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode)?ie("The {tokenNamePrefix}-token is formatted with incorrect information.",e).format({tokenNamePrefix:n}):[re.NETWORK_TOKEN_MISSING,re.NETWORK_INVALID_URL].includes(i.muxCode)?ie("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",e).format({tokenNamePrefix:n}):i.muxCode===re.NETWORK_NOT_FOUND?"":i.message}return i.code&&(i.code===Q.MEDIA_ERR_NETWORK||i.code===Q.MEDIA_ERR_DECODE||(i.code,Q.MEDIA_ERR_SRC_NOT_SUPPORTED)),i.message},QP=(i,e=!1)=>{let t=jP(i,e).toString(),s=zP(i,e).toString();return{title:t,message:s}},XP=i=>{if(i.muxCode){if(i.muxCode===re.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(i.muxCode===re.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([re.NETWORK_TOKEN_AUD_MISMATCH,re.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode))return"403-incorrect-aud-value.md";if(i.muxCode===re.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(i.muxCode===re.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(i.muxCode===re.NETWORK_NOT_FOUND)return"404-not-found.md";if(i.muxCode===re.NETWORK_NOT_READY)return"412-not-playable.md"}if(i.code){if(i.code===Q.MEDIA_ERR_NETWORK)return"";if(i.code===Q.MEDIA_ERR_DECODE)return"media-decode-error.md";if(i.code===Q.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},rv=(i,e)=>{let t=XP(i);return{message:i.message,context:i.context,file:t}},ZP
vendor: 8,830 bytes, lines 2246-2546
2246=`<template id="media-theme-gerwig">
2247  <style>
2248    @keyframes pre-play-hide {
2249      0% {
2250        transform: scale(1);
2251        opacity: 1;
2252      }
2253
2254      30% {
2255        transform: scale(0.7);
2256      }
2257
2258      100% {
2259        transform: scale(1.5);
2260        opacity: 0;
2261      }
2262    }
2263
2264    :host {
2265      --_primary-color: var(--media-primary-color, #fff);
2266      --_secondary-color: var(--media-secondary-color, transparent);
2267      --_accent-color: var(--media-accent-color, #fa50b5);
2268      --_text-color: var(--media-text-color, #000);
2269
2270      --media-icon-color: var(--_primary-color);
2271      --media-control-background: var(--_secondary-color);
2272      --media-control-hover-background: var(--_accent-color);
2273      --media-time-buffered-color: rgba(255, 255, 255, 0.4);
2274      --media-preview-time-text-shadow: none;
2275      --media-control-height: 14px;
2276      --media-control-padding: 6px;
2277      --media-tooltip-container-margin: 6px;
2278      --media-tooltip-distance: 18px;
2279
2280      color: var(--_primary-color);
2281      display: inline-block;
2282      width: 100%;
2283      height: 100%;
2284    }
2285
2286    :host([audio]) {
2287      --_secondary-color: var(--media-secondary-color, black);
2288      --media-preview-time-text-shadow: none;
2289    }
2290
2291    :host([audio]) ::slotted([slot='media']) {
2292      height: 0px;
2293    }
2294
2295    :host([audio]) media-loading-indicator {
2296      display: none;
2297    }
2298
2299    :host([audio]) media-controller {
2300      background: transparent;
2301    }
2302
2303    :host([audio]) media-controller::part(vertical-layer) {
2304      background: transparent;
2305    }
2306
2307    :host([audio]) media-control-bar {
2308      width: 100%;
2309      background-color: var(--media-control-background);
2310    }
2311
2312    /*
2313     * 0.433s is the transition duration for VTT Regions.
2314     * Borrowed here, so the captions don't move too fast.
2315     */
2316    media-controller {
2317      --media-webkit-text-track-transform: translateY(0) scale(0.98);
2318      --media-webkit-text-track-transition: transform 0.433s ease-out 0.3s;
2319    }
2320    media-controller:is([mediapaused], :not([userinactive])) {
2321      --media-webkit-text-track-transform: translateY(-50px) scale(0.98);
2322      --media-webkit-text-track-transition: transform 0.15s ease;
2323    }
2324
2325    /*
2326     * CSS specific to iOS devices.
2327     * See: https://stackoverflow.com/questions/30102792/css-media-query-to-target-only-ios-devices/60220757#60220757
2328     */
2329    @supports (-webkit-touch-callout: none) {
2330      /* Disable subtitle adjusting for iOS Safari */
2331      media-controller[mediaisfullscreen] {
2332        --media-webkit-text-track-transform: unset;
2333        --media-webkit-text-track-transition: unset;
2334      }
2335    }
2336
2337    media-time-range {
2338      --media-box-padding-left: 6px;
2339      --media-box-padding-right: 6px;
2340      --media-range-bar-color: var(--_accent-color);
2341      --media-time-range-buffered-color: var(--_primary-color);
2342      --media-range-track-color: transparent;
2343      --media-range-track-background: rgba(255, 255, 255, 0.4);
2344      --media-range-thumb-background: radial-gradient(
2345        circle,
2346        #000 0%,
2347        #000 25%,
2348        var(--_accent-color) 25%,
2349        var(--_accent-color)
2350      );
2351      --media-range-thumb-width: 12px;
2352      --media-range-thumb-height: 12px;
2353      --media-range-thumb-transform: scale(0);
2354      --media-range-thumb-transition: transform 0.3s;
2355      --media-range-thumb-opacity: 1;
2356      --media-preview-background: var(--_primary-color);
2357      --media-box-arrow-background: var(--_primary-color);
2358      --media-preview-thumbnail-border: 5px solid var(--_primary-color);
2359      --media-preview-border-radius: 5px;
2360      --media-text-color: var(--_text-color);
2361      --media-control-hover-background: transparent;
2362      --media-preview-chapter-text-shadow: none;
2363      color: var(--_accent-color);
2364      padding: 0 6px;
2365    }
2366
2367    :host([audio]) media-time-range {
2368      --media-preview-time-padding: 1.5px 6px;
2369      --media-preview-box-margin: 0 0 -5px;
2370    }
2371
2372    media-time-range:hover {
2373      --media-range-thumb-transform: scale(1);
2374    }
2375
2376    media-preview-thumbnail {
2377      border-bottom-width: 0;
2378    }
2379
2380    [part~='menu'] {
2381      border-radius: 2px;
2382      border: 1px solid rgba(0, 0, 0, 0.1);
2383      bottom: 50px;
2384      padding: 2.5px 10px;
2385    }
2386
2387    [part~='menu']::part(indicator) {
2388      fill: var(--_accent-color);
2389    }
2390
2391    [part~='menu']::part(menu-item) {
2392      box-sizing: border-box;
2393      display: flex;
2394      align-items: center;
2395      padding: 6px 10px;
2396      min-height: 34px;
2397    }
2398
2399    [part~='menu']::part(checked) {
2400      font-weight: 700;
2401    }
2402
2403    media-captions-menu,
2404    media-rendition-menu,
2405    media-audio-track-menu,
2406    media-playback-rate-menu {
2407      position: absolute; /* ensure they don't take up space in DOM on load */
2408      --media-menu-background: var(--_primary-color);
2409      --media-menu-item-checked-background: transparent;
2410      --media-text-color: var(--_text-color);
2411      --media-menu-item-hover-background: transparent;
2412      --media-menu-item-hover-outline: var(--_accent-color) solid 1px;
2413    }
2414
2415    media-rendition-menu {
2416      min-width: 140px;
2417    }
2418
2419    /* The icon is a circle so make it 16px high instead of 14px for more balance. */
2420    media-audio-track-menu-button {
2421      --media-control-padding: 5px;
2422      --media-control-height: 16px;
2423    }
2424
2425    media-playback-rate-menu-button {
2426      --media-control-padding: 6px 3px;
2427      min-width: 4.4ch;
2428    }
2429
2430    media-playback-rate-menu {
2431      --media-menu-flex-direction: row;
2432      --media-menu-item-checked-background: var(--_accent-color);
2433      --media-menu-item-checked-indicator-display: none;
2434      margin-right: 6px;
2435      padding: 0;
2436      --media-menu-gap: 0.25em;
2437    }
2438
2439    media-playback-rate-menu[part~='menu']::part(menu-item) {
2440      padding: 6px 6px 6px 8px;
2441    }
2442
2443    media-playback-rate-menu[part~='menu']::part(checked) {
2444      color: #fff;
2445    }
2446
2447    :host(:not([audio])) media-time-range {
2448      /* Adding px is required here for calc() */
2449      --media-range-padding: 0px;
2450      background: transparent;
2451      z-index: 10;
2452      height: 10px;
2453      bottom: -3px;
2454      width: 100%;
2455    }
2456
2457    media-control-bar :is([role='button'], [role='switch'], button) {
2458      line-height: 0;
2459    }
2460
2461    media-control-bar :is([part*='button'], [part*='range'], [part*='display']) {
2462      border-radius: 3px;
2463    }
2464
2465    .spacer {
2466      flex-grow: 1;
2467      background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
2468    }
2469
2470    media-control-bar[slot~='top-chrome'] {
2471      min-height: 42px;
2472      pointer-events: none;
2473    }
2474
2475    media-control-bar {
2476      --gradient-steps:
2477        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%,
2478        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%,
2479        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%,
2480        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%;
2481    }
2482
2483    :host([title]) media-control-bar[slot='top-chrome']::before,
2484    :host([videotitle]) media-control-bar[slot='top-chrome']::before {
2485      content: '';
2486      position: absolute;
2487      width: 100%;
2488      padding-bottom: min(100px, 25%);
2489      background: linear-gradient(to top, var(--gradient-steps));
2490      opacity: 0.8;
2491      pointer-events: none;
2492    }
2493
2494    :host(:not([audio])) media-control-bar[part~='bottom']::before {
2495      content: '';
2496      position: absolute;
2497      width: 100%;
2498      bottom: 0;
2499      left: 0;
2500      padding-bottom: min(100px, 25%);
2501      background: linear-gradient(to bottom, var(--gradient-steps));
2502      opacity: 0.8;
2503      z-index: 1;
2504      pointer-events: none;
2505    }
2506
2507    media-control-bar[part~='bottom'] > * {
2508      z-index: 20;
2509    }
2510
2511    media-control-bar[part~='bottom'] {
2512      padding: 6px 6px;
2513    }
2514
2515    media-control-bar[slot~='top-chrome'] > * {
2516      --media-control-background: transparent;
2517      --media-control-hover-background: transparent;
2518      position: relative;
2519    }
2520
2521    media-controller::part(vertical-layer) {
2522      transition: background-color 1s;
2523    }
2524
2525    media-controller:is([mediapaused], :not([userinactive]))::part(vertical-layer) {
2526      background-color: var(--controls-backdrop-color, var(--controls, transparent));
2527      transition: background-color 0.25s;
2528    }
2529
2530    .center-controls {
2531      --media-button-icon-width: 100%;
2532      --media-button-icon-height: auto;
2533      --media-tooltip-display: none;
2534      pointer-events: none;
2535      width: 100%;
2536      display: flex;
2537      flex-flow: row;
2538      align-items: center;
2539      justify-content: center;
2540      paint-order: stroke;
2541      stroke: rgba(102, 102, 102, 1);
2542      stroke-width: 0.3px;
2543      text-shadow:
2544        0 0 2px rgb(0 0 0 / 0.25),
2545        0 0 6px rgb(0 0 0 / 0.25);
2546    
2546}
2547
2548    .center-controls media-play-button {
2549      --media-control-background: transparent;
2550      --media-control-hover-background: transparent;
2551      --media-control-padding: 0;
2552      width: 40px;
2553      filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25))
vendor: 38,939 bytes, lines 2553-3378
2553;
2554    }
2555
2556    [breakpointsm] .center-controls media-play-button {
2557      width: 90px;
2558      height: 90px;
2559      border-radius: 50%;
2560      transition: background 0.4s;
2561      padding: 24px;
2562      --media-control-background: #000;
2563      --media-control-hover-background: var(--_accent-color);
2564    }
2565
2566    .center-controls media-seek-backward-button,
2567    .center-controls media-seek-forward-button {
2568      --media-control-background: transparent;
2569      --media-control-hover-background: transparent;
2570      padding: 0;
2571      margin: 0 20px;
2572      width: max(33px, min(8%, 40px));
2573      text-shadow:
2574        0 0 2px rgb(0 0 0 / 0.25),
2575        0 0 6px rgb(0 0 0 / 0.25);
2576    }
2577
2578    [breakpointsm]:not([audio]) .center-controls.pre-playback {
2579      display: grid;
2580      align-items: initial;
2581      justify-content: initial;
2582      height: 100%;
2583      overflow: hidden;
2584    }
2585
2586    [breakpointsm]:not([audio]) .center-controls.pre-playback media-play-button {
2587      place-self: var(--_pre-playback-place, center);
2588      grid-area: 1 / 1;
2589      margin: 16px;
2590    }
2591
2592    /* Show and hide controls or pre-playback state */
2593
2594    [breakpointsm]:is([mediahasplayed], :not([mediapaused])):not([audio])
2595      .center-controls.pre-playback
2596      media-play-button {
2597      /* Using \`forwards\` would lead to a laggy UI after the animation got in the end state */
2598      animation: 0.3s linear pre-play-hide;
2599      opacity: 0;
2600      pointer-events: none;
2601    }
2602
2603    .autoplay-unmute {
2604      --media-control-hover-background: transparent;
2605      width: 100%;
2606      display: flex;
2607      align-items: center;
2608      justify-content: center;
2609      filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25));
2610    }
2611
2612    .autoplay-unmute-btn {
2613      --media-control-height: 16px;
2614      border-radius: 8px;
2615      background: #000;
2616      color: var(--_primary-color);
2617      display: flex;
2618      align-items: center;
2619      padding: 8px 16px;
2620      font-size: 18px;
2621      font-weight: 500;
2622      cursor: pointer;
2623    }
2624
2625    .autoplay-unmute-btn:hover {
2626      background: var(--_accent-color);
2627    }
2628
2629    [breakpointsm] .autoplay-unmute-btn {
2630      --media-control-height: 30px;
2631      padding: 14px 24px;
2632      font-size: 26px;
2633    }
2634
2635    .autoplay-unmute-btn svg {
2636      margin: 0 6px 0 0;
2637    }
2638
2639    [breakpointsm] .autoplay-unmute-btn svg {
2640      margin: 0 10px 0 0;
2641    }
2642
2643    media-controller:not([audio]):not([mediahasplayed]) *:is(media-control-bar, media-time-range) {
2644      display: none;
2645    }
2646
2647    media-error-dialog:not([mediaerrorcode]) {
2648      opacity: 0;
2649    }
2650
2651    media-loading-indicator {
2652      --media-loading-icon-width: 100%;
2653      --media-button-icon-height: auto;
2654      display: var(--media-control-display, var(--media-loading-indicator-display, flex));
2655      pointer-events: none;
2656      position: absolute;
2657      width: min(15%, 150px);
2658      flex-flow: row;
2659      align-items: center;
2660      justify-content: center;
2661    }
2662
2663    /* Intentionally don't target the div for transition but the children
2664     of the div. Prevents messing with media-chrome's autohide feature. */
2665    media-loading-indicator + div * {
2666      transition: opacity 0.15s;
2667      opacity: 1;
2668    }
2669
2670    media-loading-indicator[medialoading]:not([mediapaused]) ~ div > * {
2671      opacity: 0;
2672      transition-delay: 400ms;
2673    }
2674
2675    media-volume-range {
2676      width: min(100%, 100px);
2677      --media-range-padding-left: 10px;
2678      --media-range-padding-right: 10px;
2679      --media-range-thumb-width: 12px;
2680      --media-range-thumb-height: 12px;
2681      --media-range-thumb-background: radial-gradient(
2682        circle,
2683        #000 0%,
2684        #000 25%,
2685        var(--_primary-color) 25%,
2686        var(--_primary-color)
2687      );
2688      --media-control-hover-background: none;
2689    }
2690
2691    media-time-display {
2692      white-space: nowrap;
2693    }
2694
2695    /* Generic style for explicitly disabled controls */
2696    media-control-bar[part~='bottom'] [disabled],
2697    media-control-bar[part~='bottom'] [aria-disabled='true'] {
2698      opacity: 60%;
2699      cursor: not-allowed;
2700    }
2701
2702    media-text-display {
2703      --media-font-size: 16px;
2704      --media-control-padding: 14px;
2705      font-weight: 500;
2706    }
2707
2708    media-play-button.animated *:is(g, path) {
2709      transition: all 0.3s;
2710    }
2711
2712    media-play-button.animated[mediapaused] .pause-icon-pt1 {
2713      opacity: 0;
2714    }
2715
2716    media-play-button.animated[mediapaused] .pause-icon-pt2 {
2717      transform-origin: center center;
2718      transform: scaleY(0);
2719    }
2720
2721    media-play-button.animated[mediapaused] .play-icon {
2722      clip-path: inset(0 0 0 0);
2723    }
2724
2725    media-play-button.animated:not([mediapaused]) .play-icon {
2726      clip-path: inset(0 0 0 100%);
2727    }
2728
2729    media-seek-forward-button,
2730    media-seek-backward-button {
2731      --media-font-weight: 400;
2732    }
2733
2734    .mute-icon {
2735      display: inline-block;
2736    }
2737
2738    .mute-icon :is(path, g) {
2739      transition: opacity 0.5s;
2740    }
2741
2742    .muted {
2743      opacity: 0;
2744    }
2745
2746    media-mute-button[mediavolumelevel='low'] :is(.volume-medium, .volume-high),
2747    media-mute-button[mediavolumelevel='medium'] :is(.volume-high) {
2748      opacity: 0;
2749    }
2750
2751    media-mute-button[mediavolumelevel='off'] .unmuted {
2752      opacity: 0;
2753    }
2754
2755    media-mute-button[mediavolumelevel='off'] .muted {
2756      opacity: 1;
2757    }
2758
2759    /**
2760     * Our defaults for these buttons are to hide them at small sizes
2761     * users can override this with CSS
2762     */
2763    media-controller:not([breakpointsm]):not([audio]) {
2764      --bottom-play-button: none;
2765      --bottom-seek-backward-button: none;
2766      --bottom-seek-forward-button: none;
2767      --bottom-time-display: none;
2768      --bottom-playback-rate-menu-button: none;
2769      --bottom-pip-button: none;
2770    }
2771
2772    [part='mux-badge'] {
2773      position: absolute;
2774      bottom: 10px;
2775      right: 10px;
2776      z-index: 2;
2777      opacity: 0.6;
2778      transition:
2779        opacity 0.2s ease-in-out,
2780        bottom 0.2s ease-in-out;
2781    }
2782
2783    [part='mux-badge']:hover {
2784      opacity: 1;
2785    }
2786
2787    [part='mux-badge'] a {
2788      font-size: 14px;
2789      font-family: var(--_font-family);
2790      color: var(--_primary-color);
2791      text-decoration: none;
2792      display: flex;
2793      align-items: center;
2794      gap: 5px;
2795    }
2796
2797    [part='mux-badge'] .mux-badge-text {
2798      transition: opacity 0.5s ease-in-out;
2799      opacity: 0;
2800    }
2801
2802    [part='mux-badge'] .mux-badge-logo {
2803      width: 40px;
2804      height: auto;
2805      display: inline-block;
2806    }
2807
2808    [part='mux-badge'] .mux-badge-logo svg {
2809      width: 100%;
2810      height: 100%;
2811      fill: white;
2812    }
2813
2814    media-controller:not([userinactive]):not([mediahasplayed]) [part='mux-badge'],
2815    media-controller:not([userinactive]) [part='mux-badge'],
2816    media-controller[mediahasplayed][mediapaused] [part='mux-badge'] {
2817      transition: bottom 0.1s ease-in-out;
2818    }
2819
2820    media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] {
2821      transition: bottom 0.2s ease-in-out 0.62s;
2822    }
2823
2824    media-controller:not([userinactive]) [part='mux-badge'] .mux-badge-text,
2825    media-controller[mediahasplayed][mediapaused] [part='mux-badge'] .mux-badge-text {
2826      opacity: 1;
2827    }
2828
2829    media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] .mux-badge-text {
2830      opacity: 0;
2831    }
2832
2833    media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] {
2834      bottom: 10px;
2835    }
2836
2837    media-controller:not([userinactive]):not([mediahasplayed]) [part='mux-badge'] {
2838      bottom: 10px;
2839    }
2840
2841    media-controller:not([userinactive])[mediahasplayed] [part='mux-badge'],
2842    media-controller[mediahasplayed][mediapaused] [part='mux-badge'] {
2843      bottom: calc(28px + var(--media-control-height, 0px) + var(--media-control-padding, 0px) * 2);
2844    }
2845  </style>
2846
2847  <template partial="TitleDisplay">
2848    <template if="videotitle">
2849      <template if="videotitle != true">
2850        <media-text-display part="top title display" class="title-display">{{videotitle}}</media-text-display>
2851      </template>
2852    </template>
2853    <template if="!videotitle">
2854      <template if="title">
2855        <media-text-display part="top title display" class="title-display">{{title}}</media-text-display>
2856      </template>
2857    </template>
2858  </template>
2859
2860  <template partial="PlayButton">
2861    <media-play-button
2862      part="{{section ?? 'bottom'}} play button"
2863      disabled="{{disabled}}"
2864      aria-disabled="{{disabled}}"
2865      class="animated"
2866    >
2867      <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon">
2868        <g class="play-icon">
2869          <path
2870            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"
2871          />
2872        </g>
2873        <g class="pause-icon">
2874          <path
2875            class="pause-icon-pt1"
2876            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"
2877          />
2878          <path
2879            class="pause-icon-pt2"
2880            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"
2881          />
2882        </g>
2883      </svg>
2884    </media-play-button>
2885  </template>
2886
2887  <template partial="PrePlayButton">
2888    <media-play-button
2889      part="{{section ?? 'center'}} play button pre-play"
2890      disabled="{{disabled}}"
2891      aria-disabled="{{disabled}}"
2892    >
2893      <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon" style="transform: translate(3px, 0)">
2894        <path
2895          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"
2896        />
2897      </svg>
2898    </media-play-button>
2899  </template>
2900
2901  <template partial="SeekBackwardButton">
2902    <media-seek-backward-button
2903      seekoffset="{{backwardseekoffset}}"
2904      part="{{section ?? 'bottom'}} seek-backward button"
2905      disabled="{{disabled}}"
2906      aria-disabled="{{disabled}}"
2907    >
2908      <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon">
2909        <path
2910          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"
2911        />
2912        <text transform="translate(6 12)" style="font-size: 14px; font-family: 'ArialMT', 'Arial'">
2913          {{backwardseekoffset}}
2914        </text>
2915      </svg>
2916    </media-seek-backward-button>
2917  </template>
2918
2919  <template partial="SeekForwardButton">
2920    <media-seek-forward-button
2921      seekoffset="{{forwardseekoffset}}"
2922      part="{{section ?? 'bottom'}} seek-forward button"
2923      disabled="{{disabled}}"
2924      aria-disabled="{{disabled}}"
2925    >
2926      <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon">
2927        <g>
2928          <text transform="translate(-1 12)" style="font-size: 14px; font-family: 'ArialMT', 'Arial'">
2929            {{forwardseekoffset}}
2930          </text>
2931          <path
2932            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"
2933          />
2934        </g>
2935      </svg>
2936    </media-seek-forward-button>
2937  </template>
2938
2939  <template partial="MuteButton">
2940    <media-mute-button part="bottom mute button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
2941      <svg viewBox="0 0 18 14" slot="icon" class="mute-icon" aria-hidden="true">
2942        <g class="unmuted">
2943          <path
2944            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"
2945          />
2946          <path
2947            class="volume-low"
2948            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"
2949          />
2950          <path
2951            class="volume-medium"
2952            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"
2953          />
2954          <path
2955            class="volume-high"
2956            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"
2957          />
2958        </g>
2959        <g class="muted">
2960          <path
2961            fill-rule="evenodd"
2962            clip-rule="evenodd"
2963            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"
2964          />
2965          <path
2966            fill-rule="evenodd"
2967            clip-rule="evenodd"
2968            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"
2969          />
2970        </g>
2971      </svg>
2972    </media-mute-button>
2973  </template>
2974
2975  <template partial="PipButton">
2976    <media-pip-button part="bottom pip button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
2977      <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon">
2978        <path
2979          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"
2980        />
2981        <path
2982          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"
2983        />
2984      </svg>
2985    </media-pip-button>
2986  </template>
2987
2988  <template partial="CaptionsMenu">
2989    <media-captions-menu-button part="bottom captions button">
2990      <svg aria-hidden="true" viewBox="0 0 18 14" slot="on">
2991        <path
2992          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"
2993        />
2994      </svg>
2995      <svg aria-hidden="true" viewBox="0 0 18 14" slot="off">
2996        <path
2997          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"
2998        />
2999        <path
3000          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"
3001        />
3002        <path
3003          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"
3004        />
3005      </svg>
3006    </media-captions-menu-button>
3007    <media-captions-menu
3008      hidden
3009      anchor="auto"
3010      part="bottom captions menu"
3011      disabled="{{disabled}}"
3012      aria-disabled="{{disabled}}"
3013      exportparts="menu-item"
3014    >
3015      <div slot="checked-indicator">
3016        <style>
3017          .indicator {
3018            position: relative;
3019            top: 1px;
3020            width: 0.9em;
3021            height: auto;
3022            fill: var(--_accent-color);
3023            margin-right: 5px;
3024          }
3025
3026          [aria-checked='false'] .indicator {
3027            display: none;
3028          }
3029        </style>
3030        <svg viewBox="0 0 14 18" class="indicator">
3031          <path
3032            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"
3033            fill-rule="evenodd"
3034          />
3035        </svg></div
3036    ></media-captions-menu>
3037  </template>
3038
3039  <template partial="AirplayButton">
3040    <media-airplay-button part="bottom airplay button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
3041      <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon">
3042        <path
3043          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"
3044        />
3045        <path
3046          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"
3047        />
3048      </svg>
3049    </media-airplay-button>
3050  </template>
3051
3052  <template partial="FullscreenButton">
3053    <media-fullscreen-button part="bottom fullscreen button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
3054      <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter">
3055        <path
3056          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"
3057        />
3058        <path
3059          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"
3060        />
3061        <path
3062          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"
3063        />
3064        <path
3065          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"
3066        />
3067      </svg>
3068      <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit">
3069        <path
3070          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"
3071        />
3072        <path
3073          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"
3074        />
3075        <path
3076          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"
3077        />
3078        <path
3079          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"
3080        />
3081      </svg>
3082    </media-fullscreen-button>
3083  </template>
3084
3085  <template partial="CastButton">
3086    <media-cast-button part="bottom cast button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
3087      <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter">
3088        <path
3089          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"
3090        />
3091      </svg>
3092      <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit">
3093        <path
3094          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"
3095        />
3096        <path d="M2.15002 5.634C5.18352 6.4207 7.57252 8.8151 8.35282 11.8499H15.8501V2.1499H2.15002V5.634Z" />
3097      </svg>
3098    </media-cast-button>
3099  </template>
3100
3101  <template partial="LiveButton">
3102    <media-live-button part="{{section ?? 'top'}} live button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
3103      <span slot="text">Live</span>
3104    </media-live-button>
3105  </template>
3106
3107  <template partial="PlaybackRateMenu">
3108    <media-playback-rate-menu-button part="bottom playback-rate button"></media-playback-rate-menu-button>
3109    <media-playback-rate-menu
3110      hidden
3111      anchor="auto"
3112      rates="{{playbackrates}}"
3113      exportparts="menu-item"
3114      part="bottom playback-rate menu"
3115      disabled="{{disabled}}"
3116      aria-disabled="{{disabled}}"
3117    ></media-playback-rate-menu>
3118  </template>
3119
3120  <template partial="VolumeRange">
3121    <media-volume-range
3122      part="bottom volume range"
3123      disabled="{{disabled}}"
3124      aria-disabled="{{disabled}}"
3125    ></media-volume-range>
3126  </template>
3127
3128  <template partial="TimeDisplay">
3129    <media-time-display
3130      remaining="{{defaultshowremainingtime}}"
3131      showduration="{{!hideduration}}"
3132      part="bottom time display"
3133      disabled="{{disabled}}"
3134      aria-disabled="{{disabled}}"
3135    ></media-time-display>
3136  </template>
3137
3138  <template partial="TimeRange">
3139    <media-time-range part="bottom time range" disabled="{{disabled}}" aria-disabled="{{disabled}}" exportparts="thumb">
3140      <media-preview-thumbnail slot="preview"></media-preview-thumbnail>
3141      <media-preview-chapter-display slot="preview"></media-preview-chapter-display>
3142      <media-preview-time-display slot="preview"></media-preview-time-display>
3143      <div slot="preview" part="arrow"></div>
3144    </media-time-range>
3145  </template>
3146
3147  <template partial="AudioTrackMenu">
3148    <media-audio-track-menu-button part="bottom audio-track button">
3149      <svg aria-hidden="true" slot="icon" viewBox="0 0 18 16">
3150        <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" />
3151        <path
3152          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"
3153        />
3154      </svg>
3155    </media-audio-track-menu-button>
3156    <media-audio-track-menu
3157      hidden
3158      anchor="auto"
3159      part="bottom audio-track menu"
3160      disabled="{{disabled}}"
3161      aria-disabled="{{disabled}}"
3162      exportparts="menu-item"
3163    >
3164      <div slot="checked-indicator">
3165        <style>
3166          .indicator {
3167            position: relative;
3168            top: 1px;
3169            width: 0.9em;
3170            height: auto;
3171            fill: var(--_accent-color);
3172            margin-right: 5px;
3173          }
3174
3175          [aria-checked='false'] .indicator {
3176            display: none;
3177          }
3178        </style>
3179        <svg viewBox="0 0 14 18" class="indicator">
3180          <path
3181            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"
3182            fill-rule="evenodd"
3183          />
3184        </svg>
3185      </div>
3186    </media-audio-track-menu>
3187  </template>
3188
3189  <template partial="RenditionMenu">
3190    <media-rendition-menu-button part="bottom rendition button">
3191      <svg aria-hidden="true" slot="icon" viewBox="0 0 18 14">
3192        <path
3193          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"
3194        />
3195      </svg>
3196    </media-rendition-menu-button>
3197    <media-rendition-menu
3198      hidden
3199      anchor="auto"
3200      part="bottom rendition menu"
3201      disabled="{{disabled}}"
3202      aria-disabled="{{disabled}}"
3203    >
3204      <div slot="checked-indicator">
3205        <style>
3206          .indicator {
3207            position: relative;
3208            top: 1px;
3209            width: 0.9em;
3210            height: auto;
3211            fill: var(--_accent-color);
3212            margin-right: 5px;
3213          }
3214
3215          [aria-checked='false'] .indicator {
3216            opacity: 0;
3217          }
3218        </style>
3219        <svg viewBox="0 0 14 18" class="indicator">
3220          <path
3221            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"
3222            fill-rule="evenodd"
3223          />
3224        </svg>
3225      </div>
3226    </media-rendition-menu>
3227  </template>
3228
3229  <template partial="MuxBadge">
3230    <div part="mux-badge">
3231      <a href="https://www.mux.com/player" target="_blank">
3232        <span class="mux-badge-text">Powered by</span>
3233        <div class="mux-badge-logo">
3234          <svg
3235            viewBox="0 0 1600 500"
3236            style="fill-rule: evenodd; clip-rule: evenodd; stroke-linejoin: round; stroke-miterlimit: 2"
3237          >
3238            <g>
3239              <path
3240                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"
3241                style="fill-rule: nonzero"
3242              ></path>
3243              <path
3244                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"
3245                style="fill-rule: nonzero"
3246              ></path>
3247              <path
3248                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"
3249                style="fill-rule: nonzero"
3250              ></path>
3251            </g>
3252          </svg>
3253        </div>
3254      </a>
3255    </div>
3256  </template>
3257
3258  <media-controller
3259    part="controller"
3260    defaultstreamtype="{{defaultstreamtype ?? 'on-demand'}}"
3261    breakpoints="sm:470"
3262    gesturesdisabled="{{disabled}}"
3263    hotkeys="{{hotkeys}}"
3264    nohotkeys="{{nohotkeys}}"
3265    novolumepref="{{novolumepref}}"
3266    audio="{{audio}}"
3267    noautoseektolive="{{noautoseektolive}}"
3268    defaultsubtitles="{{defaultsubtitles}}"
3269    defaultduration="{{defaultduration ?? false}}"
3270    keyboardforwardseekoffset="{{forwardseekoffset}}"
3271    keyboardbackwardseekoffset="{{backwardseekoffset}}"
3272    exportparts="layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer"
3273    style="--_pre-playback-place:{{preplaybackplace ?? 'center'}}"
3274  >
3275    <slot name="media" slot="media"></slot>
3276    <slot name="poster" slot="poster"></slot>
3277
3278    <media-loading-indicator slot="centered-chrome" noautohide></media-loading-indicator>
3279
3280    <template if="!audio">
3281      <media-error-dialog slot="dialog" noautohide></media-error-dialog>
3282      <!-- Pre-playback UI -->
3283      <!-- same for both on-demand and live -->
3284      <div slot="centered-chrome" class="center-controls pre-playback">
3285        <template if="!breakpointsm">{{>PlayButton section="center"}}</template>
3286        <template if="breakpointsm">{{>PrePlayButton section="center"}}</template>
3287      </div>
3288
3289      <!-- Mux Badge -->
3290      <template if="proudlydisplaymuxbadge"> {{>MuxBadge}} </template>
3291
3292      <!-- Autoplay centered unmute button -->
3293      <!--
3294        todo: figure out how show this with available state variables
3295        needs to show when:
3296        - autoplay is enabled
3297        - playback has been successful
3298        - audio is muted
3299        - in place / instead of the pre-plaback play button
3300        - not to show again after user has interacted with this button
3301          - OR user has interacted with the mute button in the control bar
3302      -->
3303      <!--
3304        There should be a >MuteButton to the left of the "Unmute" text, but a templating bug
3305        makes it appear even if commented out in the markup, add it back when code is un-commented
3306      -->
3307      <!-- <div slot="centered-chrome" class="autoplay-unmute">
3308        <div role="button" class="autoplay-unmute-btn">Unmute</div>
3309      </div> -->
3310
3311      <template if="streamtype == 'on-demand'">
3312        <template if="breakpointsm">
3313          <media-control-bar part="control-bar top" slot="top-chrome">{{>TitleDisplay}} </media-control-bar>
3314        </template>
3315        {{>TimeRange}}
3316        <media-control-bar part="control-bar bottom">
3317          {{>PlayButton}} {{>SeekBackwardButton}} {{>SeekForwardButton}} {{>TimeDisplay}} {{>MuteButton}}
3318          {{>VolumeRange}}
3319          <div class="spacer"></div>
3320          {{>RenditionMenu}} {{>PlaybackRateMenu}} {{>AudioTrackMenu}} {{>CaptionsMenu}} {{>AirplayButton}}
3321          {{>CastButton}} {{>PipButton}} {{>FullscreenButton}}
3322        </media-control-bar>
3323      </template>
3324
3325      <template if="streamtype == 'live'">
3326        <media-control-bar part="control-bar top" slot="top-chrome">
3327          {{>LiveButton}}
3328          <template if="breakpointsm"> {{>TitleDisplay}} </template>
3329        </media-control-bar>
3330        <template if="targetlivewindow > 0">{{>TimeRange}}</template>
3331        <media-control-bar part="control-bar bottom">
3332          {{>PlayButton}}
3333          <template if="targetlivewindow > 0">{{>SeekBackwardButton}} {{>SeekForwardButton}}</template>
3334          {{>MuteButton}} {{>VolumeRange}}
3335          <div class="spacer"></div>
3336          {{>RenditionMenu}} {{>AudioTrackMenu}} {{>CaptionsMenu}} {{>AirplayButton}} {{>CastButton}} {{>PipButton}}
3337          {{>FullscreenButton}}
3338        </media-control-bar>
3339      </template>
3340    </template>
3341
3342    <template if="audio">
3343      <template if="streamtype == 'on-demand'">
3344        <template if="title">
3345          <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>
3346        </template>
3347        <media-control-bar part="control-bar bottom">
3348          {{>PlayButton}}
3349          <template if="breakpointsm"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template>
3350          {{>MuteButton}}
3351          <template if="breakpointsm">{{>VolumeRange}}</template>
3352          {{>TimeDisplay}} {{>TimeRange}}
3353          <template if="breakpointsm">{{>PlaybackRateMenu}}</template>
3354          {{>AirplayButton}} {{>CastButton}}
3355        </media-control-bar>
3356      </template>
3357
3358      <template if="streamtype == 'live'">
3359        <template if="title">
3360          <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>
3361        </template>
3362        <media-control-bar part="control-bar bottom">
3363          {{>PlayButton}} {{>LiveButton section="bottom"}} {{>MuteButton}}
3364          <template if="breakpointsm">
3365            {{>VolumeRange}}
3366            <template if="targetlivewindow > 0"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template>
3367          </template>
3368          <template if="targetlivewindow > 0"> {{>TimeDisplay}} {{>TimeRange}} </template>
3369          <template if="!targetlivewindow"><div class="spacer"></div></template>
3370          {{>AirplayButton}} {{>CastButton}}
3371        </media-control-bar>
3372      </template>
3373    </template>
3374
3375    <slot></slot>
3376  </media-controller>
3377</template>
3378`
3378,_f=uu.createElement("template");"innerHTML"in _f&&(_f.innerHTML=ZP);var nv,av,Jb=class extends wu{};Jb.template=(av=(nv=_f.content)==null?void 0:nv.children)==null?void 0:av[0];Vi.customElements.get("media-theme-gerwig")||Vi.customElements.define("media-theme-gerwig",Jb);var JP="gerwig",as={SRC:"src",POSTER:"poster"},O={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",P
vendor: 4,745 bytes, lines 3378-3390
3378LAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",FULLSCREEN_ELEMENT:"fullscreen-element",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",VIDEO_TITLE:"video-title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref",NO_MUTED_PREF:"no-muted-pref",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips",PROUDLY_DISPLAY_MUX_BADGE:"proudly-display-mux-badge",DISABLE_PSEUDO_ENDED:"disable-pseudo-ended"},Af=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","videotitle","novolumepref","nomutedpref","proudlydisplaymuxbadge"];function eO(i,e){var t,s,r;return{src:!i.playbackId&&i.src,playbackId:i.playbackId,hasSrc:!!i.playbackId||!!i.src||!!i.currentSrc,poster:i.poster,storyboard:((t=i.media)==null?void 0:t.currentSrc)&&i.storyboard,storyboardSrc:i.getAttribute(O.STORYBOARD_SRC),fullscreenElement:i.getAttribute(O.FULLSCREEN_ELEMENT),placeholder:i.getAttribute("placeholder"),themeTemplate:iO(i),thumbnailTime:!i.tokens.thumbnail&&i.thumbnailTime,autoplay:i.autoplay,crossOrigin:i.crossOrigin,loop:i.loop,noHotKeys:i.hasAttribute(O.NOHOTKEYS),hotKeys:i.getAttribute(O.HOTKEYS),muted:i.muted,paused:i.paused,preload:i.preload,envKey:i.envKey,preferCmcd:i.preferCmcd,debug:i.debug,disableTracking:i.disableTracking,disableCookies:i.disableCookies,tokens:i.tokens,beaconCollectionDomain:i.beaconCollectionDomain,maxResolution:i.maxResolution,minResolution:i.minResolution,maxAutoResolution:i.maxAutoResolution,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(C.TARGET_LIVE_WINDOW),streamType:Ep(i.getAttribute(C.STREAM_TYPE)),primaryColor:i.getAttribute(O.PRIMARY_COLOR),secondaryColor:i.getAttribute(O.SECONDARY_COLOR),accentColor:i.getAttribute(O.ACCENT_COLOR),forwardSeekOffset:i.forwardSeekOffset,backwardSeekOffset:i.backwardSeekOffset,defaultHiddenCaptions:i.defaultHiddenCaptions,defaultDuration:i.defaultDuration,defaultShowRemainingTime:i.defaultShowRemainingTime,hideDuration:sO(i),playbackRates:i.getAttribute(O.PLAYBACK_RATES),customDomain:(s=i.getAttribute(C.CUSTOM_DOMAIN))!=null?s:void 0,title:i.getAttribute(O.TITLE),videoTitle:(r=i.getAttribute(O.VIDEO_TITLE))!=null?r:i.getAttribute(O.TITLE),novolumepref:i.hasAttribute(O.NO_VOLUME_PREF),nomutedpref:i.hasAttribute(O.NO_MUTED_PREF),proudlyDisplayMuxBadge:i.hasAttribute(O.PROUDLY_DISPLAY_MUX_BADGE),castReceiver:i.castReceiver,disablePseudoEnded:i.hasAttribute(O.DISABLE_PSEUDO_ENDED),...e,extraSourceParams:i.extraSourceParams}}var tO=WT.formatErrorMessage;WT.formatErrorMessage=i=>{var e,t;if(i instanceof Q){let s=QP(i,!1);return`
3379      ${s!=null&&s.title?`<h3>${s.title}</h3>`:""}
3380      ${s!=null&&s.message||s!=null&&s.linkUrl?`<p>
3381        ${s?.message}
3382        ${s!=null&&s.linkUrl?`<a
3383              href="${s.linkUrl}"
3384              target="_blank"
3385              rel="external noopener"
3386              aria-label="${(e=s.linkText)!=null?e:""} ${ie("(opens in a new window)")}"
3387              >${(t=s.linkText)!=null?t:s.linkUrl}</a
3388            >`:""}
3389      </p>`:""}
3390    `}return tO(i)};function iO(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=Vi.customElements.get(s);if(n!=null&&n.template)return n.template}}function sO(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 ov(i){let e=i.videoTitle?{video_title:i.videoTitle}:{};return i.getAttributeNames().filter(t=>t.startsWith("metadata-")).reduce((t,s)=>{let r=i.getAttribute(s);return r!==null&&(t[s.replace(/^metadata-/,"").replace(/-/g,"_")
vendor: 4,468 bytes, line 3390
3390]=r),t},e)}var rO=Object.values(C),nO=Object.values(as),aO=Object.values(O),lv=Yb(),dv="mux-player",uv={isDialogOpen:!1},oO={redundant_streams:!0},yd,Td,bd,dr,_d,Un,We,ws,e_,Sf,ur,cv,hv,fv,mv,lO=class extends tv{constructor(){super(),gi(this,We),gi(this,yd),gi(this,Td,!1),gi(this,bd,{}),gi(this,dr,!0),gi(this,_d,new IP(this,"hotkeys")),gi(this,Un,{...uv,onCloseErrorDialog:i=>{var e;((e=i.composedPath()[0])==null?void 0:e.localName)==="media-error-dialog"&&tt(this,We,Sf).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:i=>{var e;((e=i.composedPath()[0])==null?void 0:e.localName)==="media-error-dialog"&&(Wb(this,uu.activeElement)||i.preventDefault())}}),Xi(this,yd,nm()),this.attachShadow({mode:"open"}),tt(this,We,e_).call(this),this.isConnected&&tt(this,We,ws).call(this)}static get NAME(){return dv}static get VERSION(){return lv}static get observedAttributes(){var i;return[...(i=tv.observedAttributes)!=null?i:[],...nO,...rO,...aO]}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=ov(this))}attributeChangedCallback(i,e,t){switch(tt(this,We,ws).call(this),super.attributeChangedCallback(i,e,t),i){case O.HOTKEYS:Ie(this,_d).value=t;break;case O.THUMBNAIL_TIME:{t!=null&&this.tokens.thumbnail&&us(ie("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").toString());break}case O.THUMBNAIL_TOKEN:{if(t){let s=kn(t);if(s){let{aud:r}=s,n=Ba.THUMBNAIL;r!==n&&us(ie("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:r,expectedAud:n,tokenNamePrefix:"thumbnail"}))}}break}case O.STORYBOARD_TOKEN:{if(t){let s=kn(t);if(s){let{aud:r}=s,n=Ba.STORYBOARD;r!==n&&us(ie("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:r,expectedAud:n,tokenNamePrefix:"storyboard"}))}}break}case O.DRM_TOKEN:{if(t){let s=kn(t);if(s){let{aud:r}=s,n=Ba.DRM;r!==n&&us(ie("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:r,expectedAud:n,tokenNamePrefix:"drm"}))}}break}case C.PLAYBACK_ID:{t!=null&&t.includes("?token")&&ti(ie("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:t}));break}case C.STREAM_TYPE:{t&&![Se.LIVE,Se.ON_DEMAND,Se.UNKNOWN].includes(t)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=t.includes("dvr")?Number.POSITIVE_INFINITY:0:zb({file:"invalid-stream-type.md",message:ie("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):t===Se.LIVE?this.getAttribute(O.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN;break}case O.FULLSCREEN_ELEMENT:{if(t!=null||t!==e){let s=uu.getElementById(t),r=s?.querySelector("mux-player");this.mediaController&&s&&r&&(this.mediaController.fullscreenElement=s)}break}}[C.PLAYBACK_ID,as.SRC,O.PLAYBACK_TOKEN].includes(i)&&e!==t&&Xi(this,Un,{...Ie(this,Un),...uv}),tt(this,We,ur).call(this,{[SP(i)]:t})}async requestFullscreen(i){var e;if(!(!this.mediaController||this.mediaController.hasAttribute(_.MEDIA_IS_FULLSCREEN)))return(e=this.mediaController)==null||e.dispatchEvent(new Vi.CustomEvent(q.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((t,s)=>{var r;(r=this.mediaController)==null||r.addEventListener(ps.MEDIA_IS_FULLSCREEN,()=>t(),{once:!0})})}async exitFullscreen(){var i;if(!(!this.mediaController||!this.mediaController.hasAttribute(_.MEDIA_IS_FULLSCREEN)))return(i=this.mediaController)==null||i.dispatchEvent(new Vi.CustomEvent(q.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((e,t)=>{var s;(s=this.mediaController)==null||s.addEventListener(ps.MEDIA_IS_FULLSCREEN,()=>e(),{once:!0})})}get preferCmcd(){var i;return(i=this.getAttribute(C.PREFER_CMCD))!=null?i:void 0}set preferCmcd(i){i!==this.preferCmcd&&(i?$d.includes(i)?this.setAttribute(C.PREFER_CMCD,i):us(`Invalid value for preferCmcd. Must be one of ${$d.join()}`):this.removeAttribute(C.PREFER_CMCD))}get hasPlayed(){var i,e;return(e=(i=this.mediaController)==null?void 0:i.hasAttribute(_.MEDIA_HAS_P
vendor: 10,518 bytes, line 3390
3390LAYED))!=null?e:!1}get inLiveWindow(){var i;return(i=this.mediaController)==null?void 0:i.hasAttribute(_.MEDIA_TIME_IS_LIVE)}get _hls(){var i;return(i=this.media)==null?void 0:i._hls}get mux(){var i;return(i=this.media)==null?void 0:i.mux}get theme(){var i;return(i=this.getAttribute(O.THEME))!=null?i:JP}set theme(i){this.setAttribute(O.THEME,`${i}`)}get themeProps(){let i=this.mediaTheme;if(!i)return;let e={};for(let t of i.getAttributeNames()){if(Af.includes(t))continue;let s=i.getAttribute(t);e[Kb(t)]=s===""?!0:s}return e}set themeProps(i){var e,t;tt(this,We,ws).call(this);let s={...this.themeProps,...i};for(let r in s){if(Af.includes(r))continue;let n=i?.[r];typeof n=="boolean"||n==null?(e=this.mediaTheme)==null||e.toggleAttribute(bf(r),!!n):(t=this.mediaTheme)==null||t.setAttribute(bf(r),n)}}get playbackId(){var i;return(i=this.getAttribute(C.PLAYBACK_ID))!=null?i:void 0}set playbackId(i){i?this.setAttribute(C.PLAYBACK_ID,i):this.removeAttribute(C.PLAYBACK_ID)}get src(){var i,e;return this.playbackId?(i=er(this,as.SRC))!=null?i:void 0:(e=this.getAttribute(as.SRC))!=null?e:void 0}set src(i){i?this.setAttribute(as.SRC,i):this.removeAttribute(as.SRC)}get poster(){var i;let e=this.getAttribute(as.POSTER);if(e!=null)return e;let{tokens:t}=this;if(t.playback&&!t.thumbnail){us("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return bP(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(as.POSTER,i):this.removeAttribute(as.POSTER)}get storyboardSrc(){var i;return(i=this.getAttribute(O.STORYBOARD_SRC))!=null?i:void 0}set storyboardSrc(i){i?this.setAttribute(O.STORYBOARD_SRC,i):this.removeAttribute(O.STORYBOARD_SRC)}get storyboard(){let{tokens:i}=this;if(this.storyboardSrc&&!i.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[Se.LIVE,Se.UNKNOWN].includes(this.streamType)||i.playback&&!i.storyboard))return _P(this.playbackId,{customDomain:this.customDomain,token:i.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(O.AUDIO)}set audio(i){if(!i){this.removeAttribute(O.AUDIO);return}this.setAttribute(O.AUDIO,"")}get hotkeys(){return Ie(this,_d)}get nohotkeys(){return this.hasAttribute(O.NOHOTKEYS)}set nohotkeys(i){if(!i){this.removeAttribute(O.NOHOTKEYS);return}this.setAttribute(O.NOHOTKEYS,"")}get thumbnailTime(){return Ht(this.getAttribute(O.THUMBNAIL_TIME))}set thumbnailTime(i){this.setAttribute(O.THUMBNAIL_TIME,`${i}`)}get videoTitle(){var i,e;return(e=(i=this.getAttribute(O.VIDEO_TITLE))!=null?i:this.getAttribute(O.TITLE))!=null?e:""}set videoTitle(i){i!==this.videoTitle&&(i?this.setAttribute(O.VIDEO_TITLE,i):this.removeAttribute(O.VIDEO_TITLE))}get placeholder(){var i;return(i=er(this,O.PLACEHOLDER))!=null?i:""}set placeholder(i){this.setAttribute(O.PLACEHOLDER,`${i}`)}get primaryColor(){var i,e;let t=this.getAttribute(O.PRIMARY_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=Vi.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:e.trim(),t))return t}set primaryColor(i){this.setAttribute(O.PRIMARY_COLOR,`${i}`)}get secondaryColor(){var i,e;let t=this.getAttribute(O.SECONDARY_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=Vi.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:e.trim(),t))return t}set secondaryColor(i){this.setAttribute(O.SECONDARY_COLOR,`${i}`)}get accentColor(){var i,e;let t=this.getAttribute(O.ACCENT_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=Vi.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:e.trim(),t))return t}set accentColor(i){this.setAttribute(O.ACCENT_COLOR,`${i}`)}get defaultShowRemainingTime(){return this.hasAttribute(O.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(i){i?this.setAttribute(O.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(O.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(O.PLAYBACK_RATES))return this.getAttribute(O.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(i=>Number(i)).filter(i=>!Number.isNaN(i)).sort((i,e)=>i-e)}set playbackRates(i){if(!i){this.removeAttribute(O.PLAYBACK_RATES);return}this.setAttribute(O.PLAYBACK_RATES,i.join(" "))}get forwardSeekOffset(){var i;return(i=Ht(this.getAttribute(O.FORWARD_SEEK_OFFSET)))!=null?i:10}set forwardSeekOffset(i){this.setAttribute(O.FORWARD_SEEK_OFFSET,`${i}`)}get backwardSeekOffset(){var i;return(i=Ht(this.getAttribute(O.BACKWARD_SEEK_OFFSET)))!=null?i:10}set backwardSeekOffset(i){this.setAttribute(O.BACKWARD_SEEK_OFFSET,`${i}`)}get defaultHiddenCaptions(){return this.hasAttribute(O.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(i){i?this.setAttribute(O.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(O.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return Ht(this.getAttribute(O.DEFAULT_DURATION))}set defaultDuration(i){i==null?this.removeAttribute(O.DEFAULT_DURATION):this.setAttribute(O.DEFAULT_DURATION,`${i}`)}get playerInitTime(){return this.hasAttribute(C.PLAYER_INIT_TIME)?Ht(this.getAttribute(C.PLAYER_INIT_TIME)):Ie(this,yd)}set playerInitTime(i){i!=this.playerInitTime&&(i==null?this.removeAttribute(C.PLAYER_INIT_TIME):this.setAttribute(C.PLAYER_INIT_TIME,`${+i}`))}get playerSoftwareName(){var i;return(i=this.getAttribute(C.PLAYER_SOFTWARE_NAME))!=null?i:dv}get playerSoftwareVersion(){var i;return(i=this.getAttribute(C.PLAYER_SOFTWARE_VERSION))!=null?i:lv}get beaconCollectionDomain(){var i;return(i=this.getAttribute(C.BEACON_COLLECTION_DOMAIN))!=null?i:void 0}set beaconCollectionDomain(i){i!==this.beaconCollectionDomain&&(i?this.setAttribute(C.BEACON_COLLECTION_DOMAIN,i):this.removeAttribute(C.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var i;return(i=this.getAttribute(C.MAX_RESOLUTION))!=null?i:void 0}set maxResolution(i){i!==this.maxResolution&&(i?this.setAttribute(C.MAX_RESOLUTION,i):this.removeAttribute(C.MAX_RESOLUTION))}get minResolution(){var i;return(i=this.getAttribute(C.MIN_RESOLUTION))!=null?i:void 0}set minResolution(i){i!==this.minResolution&&(i?this.setAttribute(C.MIN_RESOLUTION,i):this.removeAttribute(C.MIN_RESOLUTION))}get maxAutoResolution(){var i;return(i=this.getAttribute(C.MAX_AUTO_RESOLUTION))!=null?i:void 0}set maxAutoResolution(i){i==null?this.removeAttribute(C.MAX_AUTO_RESOLUTION):this.setAttribute(C.MAX_AUTO_RESOLUTION,i)}get renditionOrder(){var i;return(i=this.getAttribute(C.RENDITION_ORDER))!=null?i:void 0}set renditionOrder(i){i!==this.renditionOrder&&(i?this.setAttribute(C.RENDITION_ORDER,i):this.removeAttribute(C.RENDITION_ORDER))}get programStartTime(){return Ht(this.getAttribute(C.PROGRAM_START_TIME))}set programStartTime(i){i==null?this.removeAttribute(C.PROGRAM_START_TIME):this.setAttribute(C.PROGRAM_START_TIME,`${i}`)}get programEndTime(){return Ht(this.getAttribute(C.PROGRAM_END_TIME))}set programEndTime(i){i==null?this.removeAttribute(C.PROGRAM_END_TIME):this.setAttribute(C.PROGRAM_END_TIME,`${i}`)}get assetStartTime(){return Ht(this.getAttribute(C.ASSET_START_TIME))}set assetStartTime(i){i==null?this.removeAttribute(C.ASSET_START_TIME):this.setAttribute(C.ASSET_START_TIME,`${i}`)}get assetEndTime(){return Ht(this.getAttribute(C.ASSET_END_TIME))}set assetEndTime(i){i==null?this.removeAttribute(C.ASSET_END_TIME):this.setAttribute(C.ASSET_END_TIME,`${i}`)}get extraSourceParams(){return this.hasAttribute(O.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(O.EXTRA_SOURCE_PARAMS)).entries()].reduce((i,[e,t])=>(i[e]=t,i),{}):oO}set extraSourceParams(i){i==null?this.removeAttribute(O.EXTRA_SOURCE_PARAMS):this.setAttribute(O.EXTRA_SOURCE_PARAMS,new URLSearchParams(i).toString())}get customDomain(){var i;return(i=this.getAttribute(C.CUSTOM_DOMAIN))!=null?i:void 0}set customDomain(i){i!==this.customDomain&&(i?this.setAttribute(C.CUSTOM_DOMAIN,i):this.removeAttribute(C.CUSTOM_DOMAIN))}get envKey(){var i;return(i=er(this,C.ENV_KEY))!=null?i:void 0}set envKey(i){this.setAttribute(C.ENV_KEY,`${i}`)}get noVolumePref(){return this.hasAttribute(O.NO_VOLUME_PREF)}set noVolumePref(i){i?this.setAttribute(O.NO_VOLUME_PREF,""):this.removeAttribute(O.NO_VOLUME_PREF)}get noMutedPref(){return this.hasAttribute(O.NO_MUTED_PREF)}set noMutedPref(i){i?this.setAttribute(O.NO_MUTED_PREF,""):this.removeAttribute(O.NO_MUTED_PREF)}get debug(){return er(this,C.DEBUG)!=null}set debug(i){i?this.setAttribute(C.DEBUG,""):this.removeAttribute(C.DEBUG)}get disableTracking(){return er(this,C.DISABLE_TRACKING)!=null}set disableTracking(i){this.toggleAttribute(C.DISABLE_TRACKING,!!i)}get disableCookies(){return er(this,C.DISABLE_COOKIES)!=null}set disableCookies(i){i?this.setAttribute(C.DISABLE_COOKIES,""):this.removeAttribute(C.DISABLE_COOKIES)}get streamType(){var i,e,t;return(t=(e=this.getAttribute(C.STREAM_TYPE))!=null?e:(i=this.media)==null?void 0:i.streamType)!=null?t:Se.UNKNOWN}set streamType(i){this.setAttribute(C.STREAM_TYPE,`${i}`)}get defaultStreamType(){var i,e,t;return(t=(e=this.getAttribute(O.DEFAULT_STREAM_TYPE))!=null?e:(i=this.mediaController)==null?void 0:i.getAttribute(O.DEFAULT_STREAM_TYPE))!=null?t:Se.ON_DEMAND}set defaultStreamType(i){i?this.setAttribute(O.DEFAULT_STREAM_TYPE,i):this.removeAttribute(O.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var i,e;return this.hasAttribute(O.TARGET_LIVE_WINDOW)?+this.getAttribute(O.TARGET_LIVE_WINDOW):(e=(i=this.media)==null?void 0:i.targetLiveWindow)!=null?e:Number.NaN}set targetLiveWindow(i){i==this.targetLiveWindow||Number.isNaN(i)&&Number.isNaN(this.targetLiveWindow)||(i==null?this.removeAttribute(O.TARGET_LIVE_WINDOW):this.setAttribute(O.TARGET_LIVE_WINDOW,`${+i}`))}get liveEdgeStart(){var i;return(i=this.media)==null?void 0:i.liveEdgeStart}get startTime(){return Ht(er(this,C.START_TIME))}set startTime(i){this.setAttribute(C.START_TIME,`${i}`)}get preferPlayback(){let i=this.getAttribute(C.PREFER_PLAYBACK);if(i===Yi.MSE||i===Yi.NATIVE)return i}set preferPlayback(i){i!==this.preferPlayback&&(i===Yi.MSE||i===Yi.NATIVE?this.setAttribute(C.PREFER_PLAYBACK,i):this.removeAttribute(C.PREFER_PLAYBACK))}get metadata(){var i;return(i=this.media)==null?void 0:i.metadata}set metadata(i){if(tt(this,We,ws).call(this),!this.media){ti("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...ov(this),...i}}
vendor: 4,886 bytes, line 3390
3390get _hlsConfig(){var i;return(i=this.media)==null?void 0:i._hlsConfig}set _hlsConfig(i){if(tt(this,We,ws).call(this),!this.media){ti("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(tt(this,We,ws).call(this),!this.media){ti("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(tt(this,We,ws).call(this),!this.media){ti("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(e=this.media)==null?void 0:e.addChapters(i)}get activeChapter(){var i;return(i=this.media)==null?void 0:i.activeChapter}get chapters(){var i,e;return(e=(i=this.media)==null?void 0:i.chapters)!=null?e:[]}getStartDate(){var i;return(i=this.media)==null?void 0:i.getStartDate()}get currentPdt(){var i;return(i=this.media)==null?void 0:i.currentPdt}get tokens(){let i=this.getAttribute(O.PLAYBACK_TOKEN),e=this.getAttribute(O.DRM_TOKEN),t=this.getAttribute(O.THUMBNAIL_TOKEN),s=this.getAttribute(O.STORYBOARD_TOKEN);return{...Ie(this,bd),...i!=null?{playback:i}:{},...e!=null?{drm:e}:{},...t!=null?{thumbnail:t}:{},...s!=null?{storyboard:s}:{}}}set tokens(i){Xi(this,bd,i??{})}get playbackToken(){var i;return(i=this.getAttribute(O.PLAYBACK_TOKEN))!=null?i:void 0}set playbackToken(i){this.setAttribute(O.PLAYBACK_TOKEN,`${i}`)}get drmToken(){var i;return(i=this.getAttribute(O.DRM_TOKEN))!=null?i:void 0}set drmToken(i){this.setAttribute(O.DRM_TOKEN,`${i}`)}get thumbnailToken(){var i;return(i=this.getAttribute(O.THUMBNAIL_TOKEN))!=null?i:void 0}set thumbnailToken(i){this.setAttribute(O.THUMBNAIL_TOKEN,`${i}`)}get storyboardToken(){var i;return(i=this.getAttribute(O.STORYBOARD_TOKEN))!=null?i:void 0}set storyboardToken(i){this.setAttribute(O.STORYBOARD_TOKEN,`${i}`)}addTextTrack(i,e,t,s){var r;let n=(r=this.media)==null?void 0:r.nativeEl;if(n)return tm(n,i,e,t,s)}removeTextTrack(i){var e;let t=(e=this.media)==null?void 0:e.nativeEl;if(t)return $x(t,i)}get textTracks(){var i;return(i=this.media)==null?void 0:i.textTracks}get castReceiver(){var i;return(i=this.getAttribute(O.CAST_RECEIVER))!=null?i:void 0}set castReceiver(i){i!==this.castReceiver&&(i?this.setAttribute(O.CAST_RECEIVER,i):this.removeAttribute(O.CAST_RECEIVER))}get castCustomData(){var i;return(i=this.media)==null?void 0:i.castCustomData}set castCustomData(i){if(!this.media){ti("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=i}get noTooltips(){return this.hasAttribute(O.NO_TOOLTIPS)}set noTooltips(i){if(!i){this.removeAttribute(O.NO_TOOLTIPS);return}this.setAttribute(O.NO_TOOLTIPS,"")}get proudlyDisplayMuxBadge(){return this.hasAttribute(O.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(i){i?this.setAttribute(O.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(O.PROUDLY_DISPLAY_MUX_BADGE)}};yd=new WeakMap,Td=new WeakMap,bd=new WeakMap,dr=new WeakMap,_d=new WeakMap,Un=new WeakMap,We=new WeakSet,ws=function(){var i,e,t,s;if(!Ie(this,Td)){Xi(this,Td,!0),tt(this,We,ur).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof Vi.HTMLElement))throw""}catch{ti("<media-theme> failed to upgrade!")}try{customElements.upgrade(this.media)}catch{ti("underlying media element failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof RC))throw""}catch{ti("<media-controller> failed to upgrade!")}tt(this,We,cv).call(this),tt(this,We,hv).call(this),tt(this,We,fv).call(this),Xi(this,dr,(e=(i=this.mediaController)==null?void 0:i.hasAttribute(se.USER_INACTIVE))!=null?e:!0),tt(this,We,mv).call(this),(t=this.media)==null||t.addEventListener("streamtypechange",()=>tt(this,We,ur).call(this)),(s=this.media)==null||s.addEventListener("loadstart",()=>tt(this,We,ur).call(this))}},e_=function(){var i,e;try{(i=window?.CSS)==null||i.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(e=window?.CSS)==null||e.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},Sf=function(i){Object.assign(Ie(this,Un),i),tt(this,We,ur).call(this)},ur=function(i={}){HP(KP(eO(this,{...Ie(this,Un),...i})),this.shadowRoot)},cv=function(){let i=e=>{var t,s;if(!(e!=null&&e.startsWith("theme-")))return;let r=e.replace(/^theme-/,"");if(Af.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}
3390),this.getAttributeNames().forEach(i)},hv=function(){let i=e=>{var t;let s=(t=this.media)==null?void 0:t.error;if(!(s instanceof Q)){let{message:n,code:a}=s??{};s=new Q(n,a)}if(!(s!=null&&s.fatal)){us(s),s.data&&us(`${s.name} data:`,s.data);return}let r=rv(s);r.message&&zb(r),ti(s),s.data&&ti(`${s.name} data:`,s.data),tt(this,We,Sf).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 Q))return e;let n=rv((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}})},fv=function(){var i,e,t,s;let r=()=>tt(this,We,ur).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)},mv=function(){var i,e;if(!/Firefox/i.test(navigator.userAgent))return;let t,s=new WeakMap,r=()=>this.streamType===Se.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(`
3391`).length,f=-3;this.streamType===Se.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(se.USER_INACTIVE))!=null?d:!1)},o=()=>{var l,d;let u=Array.from(((d=(l=this.mediaController)==null?void 0:l.media)==null?void 0:d.textTracks)||[]).filter(c=>["subtitles","captions"].includes(c.kind)&&c.mode==="showing")[0];u!==t&&t?.removeEventListener("cuechange",a),t=u,t?.addEventListener("cuechange",a),n(t,Ie(this,dr))};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(se.USER_INACTIVE))!=null?d:!0;Ie(this,dr)!==u&&(Xi(this,dr,u),n(t,Ie(this,dr)))})};function er(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var pv=lO,t_=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment>"u"){class i extends t_{}globalThis.DocumentFragment=i}var dO=class extends t_{},uO={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(dO)}},cO={customElements:uO},hO=typeof window>"u"||typeof globalThis.customElements>"u",Cc=hO?cO:globalThis;Cc.customElements.get("mux-player")||(Cc.customElements.define("mux-player",pv),Cc.MuxPlayerElement=pv);var i_=parseInt(ja.version)>=19,gv={className:"class",classname:"class",htmlFor:"for",crossOrigin:"crossorigin",viewBox:"viewBox",playsInline:"playsinline",autoPlay:"autoplay",playbackRate:"playbackrate"},fO=i=>i==null,mO=(i,e)=>fO(e)?!1:i in e,pO=i=>i.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),gO=(i,e)=>{if(!(!i_&&typeof e=="boolean"&&!e)){if(mO(i,gv))return gv[i];if(typeof e<"u")return/[A-Z]/.test(i)?pO(i):i}},vO=(i,e)=>!i_&&typeof i=="boolean"?"":i,EO=(i={})=>{let{ref:e,...t}=i;return Object.entries(t).reduce((s,[r,n])=>{let a=gO(r,n);if(!a)return s;let o=vO(n);return s[a]=o,s},{})};function vv(i,e){if(typeof i=="function")return i(e);i!=null&&(i.current=e)}function yO(...i){return e=>{let t=!1,s=i.map(r=>{let n=vv(r,e);return!t&&typeof n=="function"&&(t=!0),n});if(t)return()=>{for(let r=0;r<s.length;r++){let n=s[r];typeof n=="function"?n():vv(i[r],null)}}}}function TO(...i){return za.useCallback(yO(...i),i)}var bO=Object.prototype.hasOwnProperty,_O=(i,e)=>{if(Object.is(i,e))return!0;if(typeof i!="object"||i===null||typeof e!="object"||e===null)return!1;if(Array.isArray(i))return!Array.isArray(e)||i.length!==e.length?!1:i.some((r,n)=>e[n]===r);let t=Object.keys(i),s=Object.keys(e);if(t.length!==s.length)return!1;for(let r=0;r<t.length;r++)if(!bO.call(e,t[r])||!Object.is(i[t[r]],e[t[r]]))return!1;return!0},s_=(i,e,t)=>!_O(e,i[t]),AO=(i,e,t)=>{i[t]=e},SO=(i,e,t,s=AO,r=s_)=>za.useEffect(()=>{let n=t?.current;n&&r(n,e,i)&&s(n,e,i)},[t?.current,e]),Ri=SO,IO=()=>{try{return"3.10.2"}catch{}return"UNKNOWN"},LO=IO(),RO=()=>LO,$e=(i,e,t)=>za.useEffect(()=>{let s=e?.current;if(!s||!t)return;let r=i,n=t;return s.addEventListener(r,n),()=>{s.removeEventListener(r,n)}},[e?.current,t,i]),xO=ja.forwardRef(({children:i,...e},t)=>ja.createElement("mux-player",{suppressHydrationWarning:!0,...EO(e),ref:t},i)),kO=(i,e)=>{let{onAbort:t,onCanPlay:s,onCanPlayThrough:r,onEmptied:n,onLoadStart:a,onLoadedData:o,onLoadedMetadata:l,onProgress:d,onDurationChange:u,onVolumeChange:c,onRateChange:h,onResize:f,onWaiting:m,onPlay:p,onPlaying:g,onTimeUpdate:v,onPause:T,onSeeking:y,onSeeked:b,onStalled:A,onSuspend:L,onEnded:S,onError:R,onCuePointChange:x,onChapterChange:I,metadata:M,tokens:F,paused:V,playbackId:Y,playbackRates:H,currentTime:N,themeProps:W,extraSourceParams:B,castCustomData:j,_hlsConfig:ee,...U}=e;return Ri("tokens",F,i),Ri("playbackId",Y,i),Ri("playbackRates",H,i),Ri("metadata",M,i),Ri("extraSourceParams",B,i),Ri("_hlsConfig",ee,i),Ri("themeProps",W,i),Ri("castCustomData",j,i),Ri("paused",V,i,($,ne)=>{ne!=null&&(ne?$.pause():$.play())},($,ne,pe)=>$.hasAttribute("autoplay")&&!$.hasPlayed?!1:s_($,ne,pe)),Ri("currentTime",N,i,($,ne)=>{ne!=null&&($.currentTime=ne)}),$e("abort",i,t),$e("canplay",i,s),$e("canplaythrough",i,r),$e("emptied",i,n),$e("loadstart",i,a),$e("loadeddata",i,o),$e("loadedmetadata",i,l),$e("progress",i,d),$e("durationchange",i,u),$e("volumechange",i,c),$e("ratechange",i,h),$e("resize",i,f),$e("waiting",i,m),$e("play",i,p),$e("playing",i,g),$e("timeupdate",i,v),$e("pause",i,T),$e("seeking",i,y),$e("seeked",i,b),$e("stalled",i,A),$e("suspend",
3391i,L),$e("ended",i,S),$e("error",i,R),$e("cuepointchange",i,x),$e("chapterchange",i,I),[U]},DO=RO(),CO="mux-player-react",wO=ja.forwardRef((i,e)=>{var t;let s=za.useRef(null),r=TO(s,e),[n]=kO(s,i),[a]=za.useState((t=i.playerInitTime)!=null?t:nm());return ja.createElement(xO,{ref:r,defaultHiddenCaptions:i.defaultHiddenCaptions,playerSoftwareName:CO,playerSoftwareVersion:DO,playerInitTime:a,...n})}),QO=wO;export{QO as z};

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.