1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,49652,e=>{"use strict";function t(e,t,i){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let r=document;t&&(r=t.current);let a=i?.[e]??r.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e).filter(e=>null!=e)}e.s(["resolveElements",()=>t])},68399,e=>{"use strict";let t,i,r,a;var s=e.i(71645),n=Object.create,o=Object.defineProperty,l=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyNames,u=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,c=function(e,t){return function(){return e&&(t=e(e=0)),t}},m=function(e,t){return function(){return t||e((t={exports:{}}).exports,t),t.exports}},f=function(e,t,i,r){if(t&&"object"==typeof t||"function"==typeof t)for(var a,s=d(t),n=0,u=s.length;n<u;n++)a=s[n],h.call(e,a)||a===i||o(e,a,{get:(function(e){return t[e]}).bind(null,a),enumerable:!(r=l(t,a))||r.enumerable});return e},g=function(e,t,i){return i=null!=e?n(u(e)):{},f(!t&&e&&e.__esModule?i:o(i,"default",{value:e,enumerable:!0}),e)},v=m(function(t,i){i.exports="u">typeof window?window:e.g});function y(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):y(e,t)}var E=c(function(){E()});function b(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var T=c(function(){}),A=m(function(e,t){var i=Array.prototype.slice;t.exports=function(e,t){for(("length"in e)||(e=[e]),e=i.call(e);e.length;){var r=e.shift(),a=t(r);if(a)return a;r.childNodes&&r.childNodes.length&&(e=i.call(r.childNodes).concat(e))}}}),_=m(function(e,t){function i(e,t){if(!y(this,i))return new i(e,t);this.data=e,this.nodeValue=e,this.length=e.length,this.ownerDocument=t||null}E(),t.exports=i,i.prototype.nodeType=8,i.prototype.nodeName="#comment",i.prototype.toString=function(){return"[object Comment]"}}),S=m(function(e,t){function i(e,t){if(!y(this,i))return new i(e);this.data=e||"",this.length=this.data.length,this.ownerDocument=t||null}E(),t.exports=i,i.prototype.type="DOMTextNode",i.prototype.nodeType=3,i.prototype.nodeName="#text",i.prototype.toString=function(){return this.data},i.prototype.replaceData=function(e,t,i){var r=this.data,a=r.substring(0,e),s=r.substring(e+t,r.length);this.data=a+i+s,this.length=this.data.length}}),k=m(function(e,t){t.exports=function(e){var t=this,i=e.type;e.target||(e.target=t),t.listeners||(t.listeners={});var r=t.listeners[i];if(r)return r.forEach(function(i){e.currentTarget=t,"function"==typeof i?i(e):i.handleEvent(e)});t.parentNode&&t.parentNode.dispatchEvent(e)}}),L=m(function(e,t){t.exports=function(e,t){this.listeners||(this.listeners={}),this.listeners[e]||(this.listeners[e]=[]),-1===this.listeners[e].indexOf(t)&&this.listeners[e].push(t)}}),w=m(function(e,t){t.exports=function(e,t){if(this.listeners&&this.listeners[e]){var i=this.listeners[e],r=i.indexOf(t);-1!==r&&i.splice(r,1)}}}),R=m(function(e,t){T(),t.exports=function e(t){switch(t.nodeType){case 3:return a(t.data);case 8:return"<!--"+t.data+"-->";default:var s,n,o;return n=[],o=(s=t).tagName,"http://www.w3.org/1999/xhtml"===s.namespaceURI&&(o=o.toLowerCase()),n.push("<"+o+function(e){var t=[];for(var i in e)(function(e,t){var i=b(e[t]);return"style"===t&&Object.keys(e.style).length>0||e.hasOwnProperty(t)&&("string"===i||"boolean"===i||"number"===i)&&"nodeName"!==t&&"className"!==t&&"tagName"!==t&&"textContent"!==t&&"innerText"!==t&&"namespaceURI"!==t&&"innerHTML"!==t})(e,i)&&t.push({name:i,value:e[i]});for(var a in e._attributes)for(var s in e._attributes[a]){var n=e._attributes[a][s],o=(n.prefix?n.prefix+":":"")+s;t.push({name:o,value:n.value})}return e.className&&t.push({name:"class",value:e.className}),t.length?r(t):""}(s)+function(e){var t=e.dataset,i=[];for(var a in t)i.push({name:"data-"+a,value:t[a]});return i.length?r(i):""}(s)),i.indexOf(o)>-1?n.push(" />"):(n.push(">"),s.childNodes.length?n.push.apply(n,s.childNodes.map(e)):s.textContent||s.innerText?n.push(a(s.textContent||s.innerText)):s.innerHTML&&n.push(s.innerHTML),n.push("</"+o+">")),n.join("")}};var i=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function r(e){var t=[];return e.forEach(function(e){var i=e.name,r=e.value;"style"===i&&(r=function(e){if("string"==typeof e)return e;var t="";return Object.keys(e).forEach(function(i){var r=e[i];i=i.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()}),t+=i+":"+r+";"}),t}(r)),t.push(i+'="'+a(r).replace(/"/g,""")+'"')}),t.length?" "+t.join(" "):""}function a(e){var t="";return"string"==typeof e?t=e:e&&(t=e.toString()),t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}}),I=m(function(e,t){E();var i=A(),r=k(),a=L(),s=w(),n=R(),o="http://www.w3.org/1999/xhtml";function l(e,t,i){if(!y(this,l))return new l(e);var r=void 0===i?o:i||null;this.tagName=r===o?String(e).toUpperCase():e,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=t||null,this.namespaceURI=r,this._attributes={}
1,"INPUT"===this.tagName&&(this.type="text")}t.exports=l,l.prototype.type="DOMElement",l.prototype.nodeType=1,l.prototype.appendChild=function(e){return e.parentNode&&e.parentNode.removeChild(e),this.childNodes.push(e),e.parentNode=this,e},l.prototype.replaceChild=function(e,t){e.parentNode&&e.parentNode.removeChild(e);var i=this.childNodes.indexOf(t);return t.parentNode=null,this.childNodes[i]=e,e.parentNode=this,t},l.prototype.removeChild=function(e){var t=this.childNodes.indexOf(e);return this.childNodes.splice(t,1),e.parentNode=null,e},l.prototype.insertBefore=function(e,t){e.parentNode&&e.parentNode.removeChild(e);var i=null==t?-1:this.childNodes.indexOf(t);return i>-1?this.childNodes.splice(i,0,e):this.childNodes.push(e),e.parentNode=this,e},l.prototype.setAttributeNS=function(e,t,i){var r=null,a=t,s=t.indexOf(":");(s>-1&&(r=t.substr(0,s),a=t.substr(s+1)),"INPUT"===this.tagName&&"type"===t)?this.type=i:(this._attributes[e]||(this._attributes[e]={}))[a]={value:i,prefix:r}},l.prototype.getAttributeNS=function(e,t){var i=this._attributes[e],r=i&&i[t]&&i[t].value;return"INPUT"===this.tagName&&"type"===t?this.type:"string"!=typeof r?null:r},l.prototype.removeAttributeNS=function(e,t){var i=this._attributes[e];i&&delete i[t]},l.prototype.hasAttributeNS=function(e,t){var i=this._attributes[e];return!!i&&t in i},l.prototype.setAttribute=function(e,t){return this.setAttributeNS(null,e,t)},l.prototype.getAttribute=function(e){return this.getAttributeNS(null,e)},l.prototype.removeAttribute=function(e){return this.removeAttributeNS(null,e)},l.prototype.hasAttribute=function(e){return this.hasAttributeNS(null,e)},l.prototype.removeEventListener=s,l.prototype.addEventListener=a,l.prototype.dispatchEvent=r,l.prototype.focus=function(){},l.prototype.toString=function(){return n(this)},l.prototype.getElementsByClassName=function(e){var t=e.split(" "),r=[];return i(this,function(e){if(1===e.nodeType){var i=(e.className||"").split(" ");t.every(function(e){return -1!==i.indexOf(e)})&&r.push(e)}}),r},l.prototype.getElementsByTagName=function(e){e=e.toLowerCase();var t=[];return i(this.childNodes,function(i){1===i.nodeType&&("*"===e||i.tagName.toLowerCase()===e)&&t.push(i)}),t},l.prototype.contains=function(e){return i(this,function(t){return e===t})||!1}}),C=m(function(e,t){E();var i=I();function r(e){if(!y(this,r))return new r;this.childNodes=[],this.parentNode=null,this.ownerDocument=e||null}t.exports=r,r.prototype.type="DocumentFragment",r.prototype.nodeType=11,r.prototype.nodeName="#document-fragment",r.prototype.appendChild=i.prototype.appendChild,r.prototype.replaceChild=i.prototype.replaceChild,r.prototype.removeChild=i.prototype.removeChild,r.prototype.toString=function(){return this.childNodes.map(function(e){return String(e)}).join("")}}),D=m(function(e,t){function i(e){}t.exports=i,i.prototype.initEvent=function(e,t,i){this.type=e,this.bubbles=t,this.cancelable=i},i.prototype.preventDefault=function(){}}),x=m(function(e,t){E();var i=A(),r=_(),a=S(),s=I(),n=C(),o=D(),l=k(),d=L(),u=w();function h(){if(!y(this,h))return new h;this.head=this.createElement("head"),this.body=this.createElement("body"),this.documentElement=this.createElement("html"),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body),this.childNodes=[this.documentElement],this.nodeType=9}t.exports=h;var c=h.prototype;c.createTextNode=function(e){return new a(e,this)},c.createElementNS=function(e,t){return new s(t,this,null===e?null:String(e))},c.createElement=function(e){return new s(e,this)},c.createDocumentFragment=function(){return new n(this)},c.createEvent=function(e){return new o(e)},c.createComment=function(e){return new r(e,this)},c.getElementById=function(e){return e=String(e),i(this.childNodes,function(t){if(String(t.id)===e)return t})||null},c.getElementsByClassName=s.prototype.getElementsByClassName,c.getElementsByTagName=s.prototype.getElementsByTagName,c.contains=s.prototype.contains,c.removeEventListener=u,c.addEventListener=d,c.dispatchEvent=l}),P=m(function(e,t){t.exports=new(x())}),M=m(function(t,i){var r,a=e.g,s=P();"u">typeof document?r=document:(r=a["__GLOBAL_DOCUMENT_CACHE@4"])||(r=a["__GLOBAL_DOCUMENT_CACHE@4"]=s),i.exports=r});function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function N(e,t){if(e){if("string"==typeof e)return O(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);if("Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return O(e,t)}}function U(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var r,a,s=[],n=!0,o=!1;try{for(i=i.call(e);!(n=(r=i.next()).done)&&(s.push(r.value),!(t&&s.length===t));n=!0);}catch(e){o=!0,a=e}finally{try{n||null==i.return||i.return()}finally{if(o)throw a}}return s}}(e,t)||N(e,t)||function(){throw TypeError("Invalid attempt to de
1structure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var F=g(v()),B=g(v()),$=g(v()),H=function(){var e=$.default.performance,t=e&&e.timing,i=t&&t.navigationStart;return Math.round("number"==typeof i&&"function"==typeof e.now?i+e.now():Date.now())},V=function(){if("function"==typeof(null==(e=B.default.crypto)?void 0:e.getRandomValues)){i=new Uint8Array(32),B.default.crypto.getRandomValues(i);for(var e,t,i,r=0;r<32;r++)i[r]=i[r]%16}else{i=[];for(var a=0;a<32;a++)i[a]=16*Math.random()|0}var s=0;t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t="x"===e?i[s]:3&i[s]|8;return s++,t.toString(16)});var n=H(),o=null==n?void 0:n.toString(16).substring(3);return o?t.substring(0,28)+o:t},G=function(){return("000000"+(0x81bf1000*Math.random()|0).toString(36)).slice(-6)},W=function(e){var t;if(e&&void 0!==e.nodeName)return e.muxId||(e.muxId=G()),e.muxId;try{t=document.querySelector(e)}catch(e){}return t&&!t.muxId&&(t.muxId=e),(null==t?void 0:t.muxId)||e},K=function(e){e&&void 0!==e.nodeName?e=W(t=e):t=document.querySelector(e);var t,i=t&&t.nodeName?t.nodeName.toLowerCase():"";return[t,e,i]};function q(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||N(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var j=function(e){var t,i,r,a,s,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,o=e?[console,e]:[console],l=(t=console.trace).bind.apply(t,q(o)),d=(i=console.info).bind.apply(i,q(o)),u=(r=console.debug).bind.apply(r,q(o)),h=(a=console.warn).bind.apply(a,q(o)),c=(s=console.error).bind.apply(s,q(o)),m=n;return{trace:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];if(!(m>0))return l.apply(void 0,q(t))},debug:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];if(!(m>1))return u.apply(void 0,q(t))},info:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];if(!(m>2))return d.apply(void 0,q(t))},warn:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];if(!(m>3))return h.apply(void 0,q(t))},error:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];if(!(m>4))return c.apply(void 0,q(t))},get level(){return m},set level(p){p!==this.level&&(m=null!=p?p:n)}}}("[mux]"),Y=g(v());function z(){return"1"===(Y.default.doNotTrack||Y.default.navigator&&Y.default.navigator.doNotTrack)}function X(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Q(e,t){if(!y(e,t))throw TypeError("Cannot call a class as a function")}function Z(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function J(e,t,i){return t&&Z(e.prototype,t),i&&Z(e,i),e}function ee(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function et(e){return(et=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ei(e,t,i){return(ei="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=et(e)););return e}(e,t);if(r){var a=Object.getOwnPropertyDescriptor(r,t);return a.get?a.get.call(i||e):a.value}})(e,t,i||e)}function er(e,t){return(er=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}E(),T();var ea=function(e){return es(e)[0]},es=function(e){if("string"!=typeof e||""===e)return["localhost"];var t,i=(e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return i&&(t=(i.match(/[^\.]+\.[^\.]+$/)||[])[0]),[i,t]},en=g(v()),eo=function(){var e=en.default.performance;return void 0!==(e&&e.timing)}
1,el=function(){var e=en.default.performance,t=e&&e.timing;return t&&t.domContentLoadedEventEnd},ed=function(){var e=en.default.performance,t=e&&e.timing;return t&&t.navigationStart};function eu(e,t,i){i=void 0===i?1:i,e[t]=e[t]||0,e[t]+=i}function eh(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{},r=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),r.forEach(function(t){ee(e,t,i[t])})}return e}function ec(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);i.push.apply(i,r)}return i})(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}),e}var em=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],ef=["x-cdn","content-type"].concat(em);function ep(e){var t={};return(e=e||"").trim().split(/[\r\n]+/).forEach(function(e){if(e){var i=e.split(": "),r=i.shift();r&&(ef.indexOf(r.toLowerCase())>=0||0===r.toLowerCase().indexOf("x-litix-"))&&(t[r]=i.join(": "))}}),t}function eg(e){if(e){var t=em.find(function(t){return void 0!==e[t]});return t?e[t]:void 0}}var ev=function(e){var t={};for(var i in e){var r=e[i];-1!==r["DATA-ID"].search("io.litix.data.")&&(t[r["DATA-ID"].replace("io.litix.data.","")]=r.VALUE)}return t},ey=function(e){if(!e)return{};var t=ed(),i=e.loading,r=i?i.start:e.trequest,a=i?i.first:e.tfirst,s=i?i.end:e.tload;return{bytesLoaded:e.total,requestStart:Math.round(t+r),responseStart:Math.round(t+a),responseEnd:Math.round(t+s)}},eE=function(e){if(!(!e||"function"!=typeof e.getAllResponseHeaders))return ep(e.getAllResponseHeaders())},eb=function(e,t,i){arguments.length>3&&void 0!==arguments[3]&&arguments[3];var r=arguments.length>4?arguments[4]:void 0,a=e.log,s=e.utils.secondsToMs,n=function(e){var t,i=parseInt(r.version);return 1===i&&null!==e.programDateTime&&(t=e.programDateTime),0===i&&null!==e.pdt&&(t=e.pdt),t};if(!eo())return void a.warn("performance timing not supported. Not tracking HLS.js.");var o=function(i,r){return e.emit(t,i,r)},l=function(e,t){var i=t.levels,r=t.audioTracks,a=t.url,s=t.stats,n=t.networkDetails,l=t.sessionData,d={},u={};i.forEach(function(e,t){d[t]={width:e.width,height:e.height,bitrate:e.bitrate,attrs:e.attrs}}),r.forEach(function(e,t){u[t]={name:e.name,language:e.lang,bitrate:e.bitrate}});var h=ey(s),c=h.bytesLoaded,m=h.requestStart,f=h.responseStart,g=h.responseEnd;o("requestcompleted",ec(eh({},ev(l)),{request_event_type:e,request_bytes_loaded:c,request_start:m,request_response_start:f,request_response_end:g,request_type:"manifest",request_hostname:ea(a),request_response_headers:eE(n),request_rendition_lists:{media:d,audio:u,video:{}}}))};i.on(r.Events.MANIFEST_LOADED,l);var d=function(e,t){var i=t.details,r=t.level,a=t.networkDetails,l=ey(t.stats),d=l.bytesLoaded,u=l.requestStart,h=l.responseStart,c=l.responseEnd,m=i.fragments[i.fragments.length-1],f=n(m)+s(m.duration);o("requestcompleted",{request_event_type:e,request_bytes_loaded:d,request_start:u,request_response_start:h,request_response_end:c,request_current_level:r,request_type:"manifest",request_hostname:ea(i.url),request_response_headers:eE(a),video_holdback:i.holdBack&&s(i.holdBack),video_part_holdback:i.partHoldBack&&s(i.partHoldBack),video_part_target_duration:i.partTarget&&s(i.partTarget),video_target_duration:i.targetduration&&s(i.targetduration),video_source_is_live:i.live,player_manifest_newest_program_time:isNaN(f)?void 0:f})};i.on(r.Events.LEVEL_LOADED,d);var u=function(e,t){var i=t.details,r=t.networkDetails,a=ey(t.stats);o("requestcompleted",{request_event_type:e,request_bytes_loaded:a.bytesLoaded,request_start:a.requestStart,request_response_start:a.responseStart,request_response_end:a.responseEnd,request_type:"manifest",request_hostname:ea(i.url),request_response_headers:eE(r)})};i.on(r.Events.AUDIO_TRACK_LOADED,u);var h=function(e,t){var r=t.stats,a=t.networkDetails,s=t.frag,n=ey(r=r||s.stats),l=n.bytesLoaded,d=n.requestStart,u=n.responseStart,h=n.responseEnd,c=a?eE(a):void 0,m={request_event_type:e,request_bytes_loaded:l,request_start:d,request_response_start:u,request_response_end:h,request_hostname:a?ea(a.responseURL):void 0,request_id:c?eg(c):void 0,request_response_headers:c,request_media_duration:s.duration,request_url:null==a?void 0:a.responseURL};"main"===s.type?(m.request_type="media",m.request_current_level=s.level,m.request_video_width=(i.levels[s.level]||{}).width,m.request_video_height=(i.levels[s.level]||{}).height,m.request_labeled_bitrate=(i.levels[s.level]||{}).bitrate):m.request_type=s.type,o("requestcompleted",m)};i.on(r.Events.FRAG_LOADED,h);var c=function(e,t){var i=t.frag,r=i.start;o("fragmentchange",{currentFragmentPDT:n(i),currentFragmentStart:s(r)})};i.on(r.Events.FRAG_CHANGED,c);var m=function(e,t){var i,a=t.type,s=t.details,n=t.response,l=t.fatal,d=t.frag,u=t.networkDetails,h=(null==d?void 0:d.url)||t.url||"",c=u?eE(u):void 0;(s===r.ErrorDetails.MANIFEST_LOAD_ERROR||s===r.ErrorDetails.MANIFEST_LOAD_TIMEOUT||s===r.ErrorDetails.FRAG_LOAD_ERROR||s===r.ErrorDetails.FRAG_LOAD_TIMEOUT||s===r.ErrorDetails.LEVEL_LOAD_ERROR||s===r.ErrorDetails.LEVEL_LOAD_TIMEOUT||s===r.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||s===r.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT||s===r.ErrorDetails.SUBTITLE_LOAD_ERROR||s===r.ErrorDetails.SUBTITLE_LOAD_TIMEOUT||s===r.ErrorDetails.KEY_LOAD_ERROR||s===r.ErrorDetails.KEY_LOAD_TIMEOUT)&&o("requestfailed",{request_error:s,request_url:h,request_hostname:ea(h),request_id:c?eg(c):void 0,request_type:s===r.ErrorDetails.FRAG_LOAD_ERROR||s===r.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":s===r.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||s===r.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":s===r.ErrorDetails.SUBTITLE_LOAD_ERROR||s===r.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":s===r.ErrorDetails.KEY_LOAD_ERROR||s===r.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:null==n?void 0:n.code,request_error_text:null==n?void 0:n.text}),l&&o("error",{player_error_code:a,player_error_message:s,player_error_context:"".concat(h?"url: ".concat(h,"\n"):"")+"".concat(n&&(n.code||n.text)?"response: ".concat(n.code,", ").concat(n.text,"\n"):"")+"".concat(t.reason?"failure reason: ".concat(t.reason,"\n"):"")+"".concat(t.level?"level: ".concat(t.level,"\n"):"")+"".concat(t.parent?"parent stream controller: ".concat(t.parent,"\n"):"")+"".concat(t.buffer?"buffer length: ".concat(t.buffer,"\n"):"")+"".concat(t.error?"error: ".concat(t.error,"\n"):"")+"".concat(t.event?"event: ".concat(t.event,"\n"):"")+"".concat(t.err?"error message: ".concat(null==(i=t.err)?void 0:i.message,"\n"):"")})};i.on(r.Events.ERROR,m);var f=function(e,t){var i=t.frag,r=i&&i._url||"";o("requestcanceled",{request_event_type:e,request_url:r,request_type:"media",request_hostname:ea(r)})};i.on(r.Events.FRAG_LOAD_EMERGENCY_ABORTED,f);var g=function(e,t){var r=t.level,s=i.levels[r];if(s&&s.attrs&&s.attrs.BANDWIDTH){var n,l=s.attrs.BANDWIDTH,d=parseFloat(s.attrs["FRAME-RATE"]);isNaN(d)||(n=d),l?o("renditionchange",{video_source_fps:n,video_source_bitrate:l,video_source_width:s.width,video_source_height:s.height,video_source_rendition_name:s.name,video_source_codec:null==s?void 0:s.videoCodec}):a.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};i.on(r.Events.LEVEL_SWITCHED,g),i._stopMuxMonitor=function(){i.off(r.Events.MANIFEST_LOADED,l),i.off(r.Events.LEVEL_LOADED,d),i.off(r.Events.AUDIO_TRACK_LOADED,u),i.off(r.Events.FRAG_LOADED,h),i.off(r.Events.FRAG_CHANGED,c),i.off(r.Events.ERROR,m),i.off(r.Events.FRAG_LOAD_EMERGENCY_ABORTED,f),i.off(r.Events.LEVEL_SWITCHED,g),i.off(r.Events.DESTROYING,i._stopMuxMonitor),delete i._stopMuxMonitor},i.on(r.Events.DESTROYING,i._stopMuxMonitor)},eT=function(e){e&&"function"==typeof e._stopMuxMonitor&&e._stopMuxMonitor()},eA=function(e,t){if(!e||!e.requestEndDate)return{};var i,r=ea(e.url),a=e.url,s=e.bytesLoaded,n=new Date(e.requestStartDate).getTime(),o=new Date(e.firstByteDate).getTime(),l=new Date(e.requestEndDate).getTime(),d=isNaN(e.duration)?0:e.duration,u="function"==typeof t.getMetricsFor?t.getMetricsFor(e.mediaType).HttpList:t.getDashMetrics().getHttpRequests(e.mediaType);u.length>0&&(i=ep(u[u.length-1]._responseHeaders||""));var h=i?eg(i):void 0;return{requestStart:n,requestResponseStart:o,requestResponseEnd:l,requestBytesLoaded:s,requestResponseHeaders:i,requestMediaDuration:d,requestHostname:r,requestUrl:a,requestId:h}},e_=function(e,t){if("function"==typeof t.getCurrentRepresentationForType){var i=t.getCurrentRepresentationForType(e);return i?{currentLevel:i.absoluteIndex,renditionWidth:i.width||null,renditionHeight:i.height||null,renditionBitrate:i.bandwidth}:{}}var r=t.getQualityFor(e),a=t.getCurrentTrackFor(e).bitrateList;return a?{currentLevel:r,renditionWidth:a[r].width||null,renditionHeight:a[r].height||null,renditionBitrate:a[r].bandwidth}:{}},eS=function(e){var t;return null==(t=e.match(/.*codecs\*?="(.*)"/))?void 0:t[1]},ek=function(e){try{var t,i;return null==(i=e.getVersion)||null==(t=i.call(e))?void 0:t.split(".").map(function(e){return parseInt(e)})[0]}catch(e){return!1}},eL=function(e,t,i){arguments.length>3&&void 0!==arguments[3]&&arguments[3];var r=e.log;if(!i||!i.on)return void r.warn("Invalid dash.js player reference. Monitoring blocked.");var a=ek(i),s=function(i,r){return e.emit(t,i,r)},n=function(e){var t=e.type,i=(e.data||{}).url;s("requestcompleted",{request_event_type:t,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:ea(i),request_url:i})};i.on("manifestLoaded",n);var o={},l=function(e){if("function"!=typeof e.getRequests)return null;var t=e.getRequests({state:"executed"});return 0===t.length?null:t[t.length-1]},d=function(e){var t=e.type,r=e.chunk,a=e.request,n=(r||{}).mediaInfo||{},l=n.type,d=n.bitrateList,u={};
1(d=d||[]).forEach(function(e,t){u[t]={},u[t].width=e.width,u[t].height=e.height,u[t].bitrate=e.bandwidth,u[t].attrs={}}),"video"===l?o.video=u:"audio"===l?o.audio=u:o.media=u;var h=eA(a,i),c=h.requestStart,m=h.requestResponseStart,f=h.requestResponseEnd,g=h.requestResponseHeaders,v=h.requestMediaDuration,y=h.requestHostname,E=h.requestUrl;s("requestcompleted",{request_event_type:t,request_start:c,request_response_start:m,request_response_end:f,request_bytes_loaded:-1,request_type:l+"_init",request_response_headers:g,request_hostname:y,request_id:h.requestId,request_url:E,request_media_duration:v,request_rendition_lists:o})};a>=4?i.on("initFragmentLoaded",d):i.on("initFragmentLoaded",function(e){var t=e.type,i=e.fragmentModel,r=e.chunk;d({type:t,request:l(i),chunk:r})});var u=function(e){var t=e.type,r=e.chunk,a=e.request,n=r||{},o=n.mediaInfo,l=n.start,d=(o||{}).type,u=eA(a,i),h=u.requestStart,c=u.requestResponseStart,m=u.requestResponseEnd,f=u.requestBytesLoaded,g=u.requestResponseHeaders,v=u.requestMediaDuration,y=u.requestHostname,E=u.requestUrl,b=u.requestId,T=e_(d,i),A=T.currentLevel,_=T.renditionWidth,S=T.renditionHeight;s("requestcompleted",{request_event_type:t,request_start:h,request_response_start:c,request_response_end:m,request_bytes_loaded:f,request_type:d,request_response_headers:g,request_hostname:y,request_id:b,request_url:E,request_media_start_time:l,request_media_duration:v,request_current_level:A,request_labeled_bitrate:T.renditionBitrate,request_video_width:_,request_video_height:S})};a>=4?i.on("mediaFragmentLoaded",u):i.on("mediaFragmentLoaded",function(e){var t=e.type,i=e.fragmentModel,r=e.chunk;u({type:t,request:l(i),chunk:r})});var h={video:void 0,audio:void 0,totalBitrate:void 0},c=function(){if(h.video&&"number"==typeof h.video.bitrate){if(!(h.video.width&&h.video.height))return void r.warn("have bitrate info for video but missing width/height");var e=h.video.bitrate;if(h.audio&&"number"==typeof h.audio.bitrate&&(e+=h.audio.bitrate),e!==h.totalBitrate)return h.totalBitrate=e,{video_source_bitrate:e,video_source_height:h.video.height,video_source_width:h.video.width,video_source_codec:eS(h.video.codec)}}},m=function(e,t,a){var n=e.mediaType;if("audio"===n||"video"===n){if("function"==typeof i.getRepresentationsByType)if(e.newRepresentation)o={bitrate:e.newRepresentation.bandwidth,width:e.newRepresentation.width,height:e.newRepresentation.height,qualityIndex:e.newRepresentation.absoluteIndex};else{var o,l=i.getRepresentationsByType(n);if(l&&"number"==typeof e.newQuality){var d=l.find(function(t){return t.absoluteIndex===e.newQuality||t.index===e.newQuality});d&&(o={bitrate:d.bandwidth,width:d.width,height:d.height,qualityIndex:e.newQuality})}}else{if("number"!=typeof e.newQuality)return void r.warn("missing evt.newQuality in qualityChangeRendered event",e);o=i.getBitrateInfoListFor(n).find(function(t){return t.qualityIndex===e.newQuality})}if(!(o&&"number"==typeof o.bitrate))return void r.warn("missing bitrate info for ".concat(n));h[n]=ec(eh({}
1,o),{codec:i.getCurrentTrackFor(n).codec});var u=c();u&&s("renditionchange",u)}};i.on("qualityChangeRendered",m);var f=function(e){var t=e.request,i=e.mediaType;s("requestcanceled",{request_event_type:(t=t||{}).type+"_"+t.action,request_url:t.url,request_type:i,request_hostname:ea(t.url)})};i.on("fragmentLoadingAbandoned",f);var g=function(e){var t,i,r=e.error,a=(null==r||null==(t=r.data)?void 0:t.request)||{},n=(null==r||null==(i=r.data)?void 0:i.response)||{};(null==r?void 0:r.code)===27&&s("requestfailed",{request_error:a.type+"_"+a.action,request_url:a.url,request_hostname:ea(a.url),request_type:a.mediaType,request_error_code:n.status,request_error_text:n.statusText});var o="".concat(null!=a&&a.url?"url: ".concat(a.url,"\n"):"")+"".concat(null!=n&&n.status||null!=n&&n.statusText?"response: ".concat(null==n?void 0:n.status,", ").concat(null==n?void 0:n.statusText,"\n"):"");s("error",{player_error_code:null==r?void 0:r.code,player_error_message:null==r?void 0:r.message,player_error_context:o})};i.on("error",g),i._stopMuxMonitor=function(){i.off("manifestLoaded",n),i.off("initFragmentLoaded",d),i.off("mediaFragmentLoaded",u),i.off("qualityChangeRendered",m),i.off("error",g),i.off("fragmentLoadingAbandoned",f),delete i._stopMuxMonitor}},ew=function(e){e&&"function"==typeof e._stopMuxMonitor&&e._stopMuxMonitor()},eR=0,eI=function(){function e(){Q(this,e),ee(this,"_listeners",void 0)}return J(e,[{key:"on",value:function(e,t,i){return t._eventEmitterGuid=t._eventEmitterGuid||++eR,this._listeners=this._listeners||{},this._listeners[e]=this._listeners[e]||[],i&&(t=t.bind(i)),this._listeners[e].push(t),t}},{key:"off",value:function(e,t){var i=this._listeners&&this._listeners[e];i&&i.forEach(function(e,r){e._eventEmitterGuid===t._eventEmitterGuid&&i.splice(r,1)})}},{key:"one",value:function(e,t,i){var r=this;t._eventEmitterGuid=t._eventEmitterGuid||++eR;var a=function(){r.off(e,a),t.apply(i||this,arguments)};a._eventEmitterGuid=t._eventEmitterGuid,this.on(e,a)}},{key:"emit",value:function(e,t){var i=this;if(this._listeners){t=t||{};var r=this._listeners["before"+e]||[],a=this._listeners["before*"]||[],s=this._listeners[e]||[],n=this._listeners["after"+e]||[],o=function(t,r){(t=t.slice()).forEach(function(t){t.call(i,{type:e},r)})};o(r,t),o(a,t),o(s,t),o(n,t)}}}]),e}(),eC=g(v()),eD=function(){function e(t){var i=this;Q(this,e),ee(this,"_playbackHeartbeatInterval",void 0),ee(this,"_playheadShouldBeProgressing",void 0),ee(this,"pm",void 0),this.pm=t,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,t.on("playing",function(){i._playheadShouldBeProgressing=!0}),t.on("play",this._startPlaybackHeartbeatInterval.bind(this)),t.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),t.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),t.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),t.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),t.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),t.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),t.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),t.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("seeked",function(){t.data.player_is_paused?i._stopPlaybackHeartbeatInterval():i._startPlaybackHeartbeatInterval()}),t.on("timeupdate",function(){null!==i._playbackHeartbeatInterval&&t.emit("playbackheartbeat")}),t.on("devicesleep",function(e,r){null!==i._playbackHeartbeatInterval&&(eC.default.clearInterval(i._playbackHeartbeatInterval),t.emit("playbackheartbeatend",{viewer_time:r.viewer_time}),i._playbackHeartbeatInterval=null)})}return J(e,[{key:"_startPlaybackHeartbeatInterval",value:function(){var e=this;null===this._playbackHeartbeatInterval&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=eC.default.setInterval(function(){e.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,null!==this._playbackHeartbeatInterval&&(eC.default.clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}]),e}(),ex=function e(t){var i=this;Q(this,e),ee(this,"viewErrored",void 0),t.on("viewinit",function(){i.viewErrored=!1}),t.on("error",function(e,r){try{var a=t.errorTranslator({player_error_code:r.player_error_code,player_error_message:r.player_error_message,player_error_context:r.player_error_context,player_error_severity:r.player_error_severity,player_error_business_exception:r.player_error_business_exception});a&&(t.data.player_error_code=a.player_error_code||r.player_error_code,t.data.player_error_message=a.player_error_message||r.player_error_message,t.data.player_error_context=a.player_error_context||r.player_error_context,t.data.player_error_severity=a.player_error_severity||r.player_error_severity,t.data.player_error_business_exception=a.player_error_business_exception||r.player_error_business_exception,i.viewErrored=!0)}catch(e){t.mux.log.warn("Exception in error translator callback.",e),i.viewErrored=!0}}),t.on("aftererror",function(){var e,i,r,a,s;null==(e=t.data)||delete e.player_error_code,null==(i=t.data)||delete i.player_error_message,null==(r=t.data)||delete r.player_error_context,null==(a=t.data)||delete a.player_error_severity,null==(s=t.data)||delete s.player_error_business_exception})},eP=function(){function e(t){Q(this,e),ee(this,"_watchTimeTrackerLastCheckedTime",void 0),ee(this,"pm",void 0),this.pm=t,this._watchTimeTrackerLastCheckedTime=null,t.on("playbackheartbeat",this._updateWatchTime.bind(this)),t.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}return J(e,[{key:"_updateWatchTime",value:function(e,t){var i=t.viewer_time;null===this._watchTimeTrackerLastCheckedTime&&(this._watchTimeTrackerLastCheckedTime=i),eu(this.pm.data,"view_watch_time",i-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=i}},{key:"_clearWatchTimeState",value:function(e,t){this._updateWatchTime(e,t),this._watchTimeTrackerLastCheckedTime=null}}]),e}(),eM=function(){function e(t){var i=this;Q(this,e),ee(this,"_playbackTimeTrackerLastPlayheadPosition",void 0),ee(this,"_lastTime",void 0),ee(this,"_isAdPlaying",void 0),ee(this,"_callbackUpdatePlaybackTime",void 0),ee(this,"pm",void 0),this.pm=t,this._playbackTimeTrackerLastPlayheadPosition=-1,this._lastTime=H(),this._isAdPlaying=!1,this._callbackUpdatePlaybackTime=null,t.on("viewinit",function(){i.pm.data.view_playing_time_ms_cumulative=0});var r=this._startPlaybackTimeTracking.bind(this);t.on("playing",r),t.on("adplaying",r);var a=function(){i.pm.data.player_is_paused||r()};t.on("seeked",a),t.on("rebufferend",a);var s=this._stopPlaybackTimeTracking.bind(this);t.on("playbackheartbeatend",s),t.on("seeking",s),t.on("rebufferstart",s),t.on("adplaying",function(){i._isAdPlaying=!0}),t.on("adended",function(){i._isAdPlaying=!1}),t.on("adpause",function(){i._isAdPlaying=!1}),t.on("adbreakstart",function(){i._isAdPlaying=!1}),t.on("adbreakend",function(){i._isAdPlaying=!1}),t.on("adplay",function(){i._isAdPlaying=!1}),t.on("viewinit",function(){i._playbackTimeTrackerLastPlayheadPosition=-1,i._lastTime=H(),i._isAdPlaying=!1,i._callbackUpdatePlaybackTime=null})}return J(e,[{key:"_startPlaybackTimeTracking",value:function(){null===this._callbackUpdatePlaybackTime&&(this._callbackUpdatePlaybackTime=this._updatePlaybackTime.bind(this),this._playbackTimeTrackerLastPlayheadPosition=this.pm.data.player_playhead_time,this._lastTime=H(),this.pm.on("playbackheartbeat",this._callbackUpdatePlaybackTime))}},{key:"_stopPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime&&(this._updatePlaybackTime(),this.pm.off("playbackheartbeat",this._callbackUpdatePlaybackTime),this._callbackUpdatePlaybackTime=null,this._playbackTimeTrackerLastPlayheadPosition=-1)}},{key:"_updatePlaybackTime",value:function(){var e=this.pm.data.player_playhead_time||0,t=H(),i=t-this._lastTime,r=-1;this._playbackTimeTrackerLastPlayheadPosition>=0&&e>
1this._playbackTimeTrackerLastPlayheadPosition?r=e-this._playbackTimeTrackerLastPlayheadPosition:this._isAdPlaying&&(r=i),r>0&&r<=1e3&&eu(this.pm.data,"view_content_playback_time",r),null!==this._callbackUpdatePlaybackTime&&i>0&&i<=1e3&&(this._isAdPlaying&&eu(this.pm.data,"ad_playing_time_ms_cumulative",i),eu(this.pm.data,"view_playing_time_ms_cumulative",i)),this._playbackTimeTrackerLastPlayheadPosition=e,this._lastTime=t}}]),e}(),eO=function(){function e(t){Q(this,e),ee(this,"pm",void 0),this.pm=t;var i=this._updatePlayheadTime.bind(this);t.on("playbackheartbeat",i),t.on("playbackheartbeatend",i),t.on("timeupdate",i),t.on("destroy",function(){t.off("timeupdate",i)})}return J(e,[{key:"_updateMaxPlayheadPosition",value:function(){this.pm.data.view_max_playhead_position=void 0===this.pm.data.view_max_playhead_position?this.pm.data.player_playhead_time:Math.max(this.pm.data.view_max_playhead_position,this.pm.data.player_playhead_time)}},{key:"_updatePlayheadTime",value:function(e,t){var i=this,r=function(){i.pm.currentFragmentPDT&&i.pm.currentFragmentStart&&(i.pm.data.player_program_time=i.pm.currentFragmentPDT+i.pm.data.player_playhead_time-i.pm.currentFragmentStart)};if(t&&t.player_playhead_time)this.pm.data.player_playhead_time=t.player_playhead_time,r(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var a=this.pm.getPlayheadTime();void 0!==a&&(this.pm.data.player_playhead_time=a,r(),this._updateMaxPlayheadPosition())}}}]),e}(),eN=function e(t){if(Q(this,e),!t.disableRebufferTracking){var i,r=function(e,t){a(t),i=void 0},a=function(e){if(i){var r=e.viewer_time-i;eu(t.data,"view_rebuffer_duration",r),i=e.viewer_time,t.data.view_rebuffer_duration>3e5&&(t.emit("viewend"),t.send("viewend"),t.mux.log.warn("Ending view after rebuffering for longer than ".concat(3e5,"ms, future events will be ignored unless a programchange or videochange occurs.")))}t.data.view_watch_time>=0&&t.data.view_rebuffer_count>0&&(t.data.view_rebuffer_frequency=t.data.view_rebuffer_count/t.data.view_watch_time,t.data.view_rebuffer_percentage=t.data.view_rebuffer_duration/t.data.view_watch_time)};t.on("playbackheartbeat",function(e,t){return a(t)}),t.on("rebufferstart",function(e,a){i||(eu(t.data,"view_rebuffer_count",1),i=a.viewer_time,t.one("rebufferend",r))}),t.on("viewinit",function(){i=void 0,t.off("rebufferend",r)})}},eU=function(){function e(t){var i=this;Q(this,e),ee(this,"_lastCheckedTime",void 0),ee(this,"_lastPlayheadTime",void 0),ee(this,"_lastPlayheadTimeUpdatedTime",void 0),ee(this,"_rebuffering",void 0),ee(this,"pm",void 0),this.pm=t,t.disableRebufferTracking||t.disablePlayheadRebufferTracking||(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,t.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),t.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),t.on("seeking",function(){i._cleanupRebufferTracker(null,{viewer_time:H()})}))}return J(e,[{key:"_checkIfRebuffering",value:function(e,t){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing)return void this._cleanupRebufferTracker(e,t);if(null===this._lastCheckedTime)return void this._prepareRebufferTrackerState(t.viewer_time);if(this._lastPlayheadTime!==this.pm.data.player_playhead_time)return void this._cleanupRebufferTracker(e,t,!0);var i=t.viewer_time-this._lastPlayheadTimeUpdatedTime;"number"==typeof this.pm.sustainedRebufferThreshold&&i>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=t.viewer_time}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(e){this._lastCheckedTime=e,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=e}},{key:"_cleanupRebufferTracker",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:t.viewer_time});else{if(null===this._lastCheckedTime)return;var r=this.pm.data.player_playhead_time-this._lastPlayheadTime,a=t.viewer_time-this._lastPlayheadTimeUpdatedTime;"number"==typeof this.pm.minimumRebufferDuration&&r>0&&a-r>this.pm.minimumRebufferDuration&&(this._lastCheckedTime=null,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+a-r}))}i?this._prepareRebufferTrackerState(t.viewer_time):this._clearRebufferTrackerState()}}]),e}(),eF=function(){function e(t){var i=this;Q(this,e),ee(this,"pm",void 0),this.pm=t,t.on("viewinit",function(){var e=t.data,r=e.view_id;if(!e.view_program_changed){var a=function(e,a){var s=a.viewer_time;"playing"===e.type&&void 0===t.data.view_time_to_first_frame?i.calculateTimeToFirstFrame(s||H(),r):"adplaying"===e.type&&(void 0===t.data.view_time_to_first_frame||i._inPrerollPosition())&&i.calculateTimeToFirstFrame(s||H(),r)};t.one("playing",a),t.one("adplaying",a),t.one("viewend",function(){t.off("playing",a),t.off("adplaying",a)})}})}return J(e,[{key:"_inPrerollPosition",value:function(){return void 0===this.pm.data.view_content_playback_time||this.pm.data.view_content_playback_time<=1e3}},{key:"calculateTimeToFirstFrame",value:function(e,t){t===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:e}),this.pm.data.view_time_to_first_frame=this.pm.data.view_watch_time,(this.pm.data.player_autoplay_on||this.pm.data.video_is_autoplay)&&this.pm.pageLoadInitTime&&(this.pm.data.view_aggregate_startup_time=this.pm.data.view_start+this.pm.data.view_watch_time-this.pm.pageLoadInitTime))}}]),e}(),eB=function e(t){var i=this;Q(this,e),ee(this,"_lastPlayerHeight",void 0),ee(this,"_lastPlayerWidth",void 0),ee(this,"_lastPlayheadPosition",void 0),ee(this,"_lastSourceHeight",void 0),ee(this,"_lastSourceWidth",void 0),t.on("viewinit",function(){i._lastPlayheadPosition=-1}),["pause","rebufferstart","seeking","error","adbreakstart","hb","renditionchange","orientationchange","viewend","playbackmodechange"].forEach(function(e){t.on(e,function(){if(i._lastPlayheadPosition>=0&&t.data.player_playhead_time>=0&&i._lastPlayerWidth>=0&&i._lastSourceWidth>0&&i._lastPlayerHeight>=0&&i._lastSourceHeight>0){var e=t.data.player_playhead_time-i._lastPlayheadPosition;if(e<0){i._lastPlayheadPosition=-1;return}var r=Math.min(i._lastPlayerWidth/i._lastSourceWidth,i._lastPlayerHeight/i._lastSourceHeight),a=Math.max(0,r-1),s=Math.max(0,1-r);t.data.view_max_upscale_percentage=Math.max(t.data.view_max_upscale_percentage||0,a),t.data.view_max_downscale_percentage=Math.max(t.data.view_max_downscale_percentage||0,s),eu(t.data,"view_total_content_playback_time",e),eu(t.data,"view_total_upscaling",a*e),eu(t.data,"view_total_downscaling",s*e)}i._lastPlayheadPosition=-1})}),["playing","hb","renditionchange","orientationchange","playbackmodechange"].forEach(function(e){t.on(e,function(){i._lastPlayheadPosition=t.data.player_playhead_time,i._lastPlayerWidth=t.data.player_width,i._lastPlayerHeight=t.data.player_height,i._lastSourceWidth=t.data.video_source_width,i._lastSourceHeight=t.data.video_source_height})})},e$=function e(t){var i=this;Q(this,e),ee(this,"isSeeking",void 0),this.isSeeking=!1;var r=-1,a=function(){var e=H(),a=(t.data.viewer_time||e)-(r||e);eu(t.data,"view_seek_duration",a),t.data.view_max_seek_time=Math.max(t.data.view_max_seek_time||0,a),i.isSeeking=!1,r=-1};t.on("seeking",function(e,s){if(Object.assign(t.data,s),i.isSeeking&&s.viewer_time-r<=2e3){r=s.viewer_time;return}i.isSeeking&&a(),i.isSeeking=!0,r=s.viewer_time,eu(t.data,"view_seek_count",1),t.send("seeking")}),t.on("seeked",function(){a()}),t.on("viewend",function(){i.isSeeking&&(a(),t.send("seeked")),i.isSeeking=!1,r=-1})},eH=function(e,t){e.push(t),e.sort(function(e,t){return e.viewer_time-t.viewer_time})},eV=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror","adclicked","adskipped"],eG=function(){function e(t){var i=this;Q(this,e),ee(this,"_adHasPlayed",void 0),ee(this,"_adRequests",void 0),ee(this,"_adResponses",void 0),ee(this,"_currentAdRequestNumber",void 0),ee(this,"_currentAdResponseNumber",void 0),ee(this,"_prerollPlayTime",void 0),ee(this,"_wouldBeNewAdPlay",void 0),ee(this,"isAdBreak",void 0),ee(this,"pm",void 0),this.pm=t,t.on("viewinit",function(){i.isAdBreak=!1,i._currentAdRequestNumber=0,i._currentAdResponseNumber=0,i._adRequests=[],i._adResponses=[],i._adHasPlayed=!1,i._wouldBeNewAdPlay=!0,i._prerollPlayTime=void 0}
1),eV.forEach(function(e){return t.on(e,i._updateAdData.bind(i))});var r=function(){i.isAdBreak=!1};t.on("adbreakstart",function(){i.isAdBreak=!0}),t.on("play",r),t.on("playing",r),t.on("viewend",r),t.on("adrequest",function(e,r){r=Object.assign({ad_request_id:"generatedAdRequestId"+i._currentAdRequestNumber++},r),eH(i._adRequests,r),eu(t.data,"view_ad_request_count"),i.inPrerollPosition()&&(t.data.view_preroll_requested=!0,i._adHasPlayed||eu(t.data,"view_preroll_request_count"))}),t.on("adresponse",function(e,r){r=Object.assign({ad_request_id:"generatedAdRequestId"+i._currentAdResponseNumber++},r),eH(i._adResponses,r);var a=i.findAdRequest(r.ad_request_id);a&&eu(t.data,"view_ad_request_time",Math.max(0,r.viewer_time-a.viewer_time))}),t.on("adplay",function(e,r){i._adHasPlayed=!0,i._wouldBeNewAdPlay&&(i._wouldBeNewAdPlay=!1,eu(t.data,"view_ad_played_count")),i.inPrerollPosition()&&!t.data.view_preroll_played&&(t.data.view_preroll_played=!0,i._adRequests.length>0&&(t.data.view_preroll_request_time=Math.max(0,r.viewer_time-i._adRequests[0].viewer_time)),t.data.view_start&&(t.data.view_startup_preroll_request_time=Math.max(0,r.viewer_time-t.data.view_start)),i._prerollPlayTime=r.viewer_time)}),t.on("adplaying",function(e,r){i.inPrerollPosition()&&void 0===t.data.view_preroll_load_time&&void 0!==i._prerollPlayTime&&(t.data.view_preroll_load_time=r.viewer_time-i._prerollPlayTime,t.data.view_startup_preroll_load_time=r.viewer_time-i._prerollPlayTime)}),t.on("adclicked",function(e,r){i._wouldBeNewAdPlay||eu(t.data,"view_ad_clicked_count")}),t.on("adskipped",function(e,r){i._wouldBeNewAdPlay||eu(t.data,"view_ad_skipped_count")}),t.on("adended",function(){i._wouldBeNewAdPlay=!0}),t.on("aderror",function(){i._wouldBeNewAdPlay=!0})}return J(e,[{key:"inPrerollPosition",value:function(){return void 0===this.pm.data.view_content_playback_time||this.pm.data.view_content_playback_time<=1e3}},{key:"findAdRequest",value:function(e){for(var t=0;t<this._adRequests.length;t++)if(this._adRequests[t].ad_request_id===e)return this._adRequests[t]}},{key:"_updateAdData",value:function(e,t){if(this.inPrerollPosition()){if(!this.pm.data.view_preroll_ad_tag_hostname&&t.ad_tag_url){var i=U(es(t.ad_tag_url),2),r=i[0],a=i[1];this.pm.data.view_preroll_ad_tag_domain=a,this.pm.data.view_preroll_ad_tag_hostname=r}if(!this.pm.data.view_preroll_ad_asset_hostname&&t.ad_asset_url){var s=U(es(t.ad_asset_url),2),n=s[0],o=s[1];this.pm.data.view_preroll_ad_asset_domain=o,this.pm.data.view_preroll_ad_asset_hostname=n}this.pm.data.ad_type="preroll"}this.pm.data.ad_asset_url=null==t?void 0:t.ad_asset_url,this.pm.data.ad_tag_url=null==t?void 0:t.ad_tag_url,this.pm.data.ad_creative_id=null==t?void 0:t.ad_creative_id,this.pm.data.ad_id=null==t?void 0:t.ad_id,this.pm.data.ad_universal_id=null==t?void 0:t.ad_universal_id,null!=t&&t.ad_type&&(this.pm.data.ad_type=null==t?void 0:t.ad_type)}}]),e}(),eW=function e(t){var i=this;Q(this,e),ee(this,"lastWallClockTime",void 0);var r=function(){i.lastWallClockTime=H(),t.on("before*",a)},a=function(e){var r=H(),a=i.lastWallClockTime;i.lastWallClockTime=r,r-a>3e4&&(t.emit("devicesleep",{viewer_time:a}),Object.assign(t.data,{viewer_time:a}),t.send("devicesleep"),t.emit("devicewake",{viewer_time:r}),Object.assign(t.data,{viewer_time:r}),t.send("devicewake"))};t.one("playbackheartbeat",r),t.on("playbackheartbeatend",function(){t.off("before*",a),t.one("playbackheartbeat",r)})},eK=g(v()),eq=(tE=function(){for(var e=0,t={};e<arguments.length;e++){var i=arguments[e];for(var r in i)t[r]=i[r]}return t},function e(t){function i(e,r,a){var s;if("u">typeof document){if(arguments.length>1){if("number"==typeof(a=tE({path:"/"},i.defaults,a)).expires){var n=new Date;n.setMilliseconds(n.getMilliseconds()+864e5*a.expires),a.expires=n}try{s=JSON.stringify(r),/^[\{\[]/.test(s)&&(r=s)}catch(e){}return r=t.write?t.write(r,e):encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=(e=(e=encodeURIComponent(String(e))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape),document.cookie=e+"="+r+(a.expires?"; expires="+a.expires.toUTCString():"")+(a.path?"; path="+a.path:"")+(a.domain?"; domain="+a.domain:"")+(a.secure?"; secure":"")}e||(s={});for(var o=document.cookie?document.cookie.split("; "):[],l=/(%[0-9A-Z]{2})+/g,d=0;d<o.length;d++){var u=o[d].split("="),h=u.slice(1).join("=");'"'===h.charAt(0)&&(h=h.slice(1,-1));try{var c=u[0].replace(l,decodeURIComponent);if(h=t.read?t.read(h,c):t(h,c)||h.replace(l,decodeURIComponent),this.json)try{h=JSON.parse(h)}catch(e){}if(e===c){s=h;break}e||(s[c]=h)}catch(e){}}return s}}return i.set=i,i.get=function(e){return i.call(i,e)},i.getJSON=function(){return i.apply({json:!0},[].slice.call(arguments))},i.defaults={},i.remove=function(e,t){i(e,"",tE(t,{expires:-1}))},i.withConverter=e,i}(function(){})),ej="muxData",eY=function(){var e;try{e=(eq.get(ej)||"").split("&").reduce(function(e,t){var i=U(t.split("="),2),r=i[0],a=i[1],s=+a;return e[r]=a&&s==a?s:a,e},{})}catch(t){e={}}return e},ez=function(e){try{eq.set(ej,Object.entries(e).map(function(e){var t=U(e,2),i=t[0],r=t[1];return"".concat(i,"=").concat(r)}).join("&"),{expires:365})}catch(e){}},eX=function(){var e=eY();return e.mux_viewer_id=e.mux_viewer_id||V(),e.msn=e.msn||Math.random(),ez(e),{mux_viewer_id:e.mux_viewer_id,mux_sample_number:e.msn}},eQ=function(){var e=eY(),t=H();return e.session_start&&(e.sst=e.session_start,delete e.session_start),e.session_id&&(e.sid=e.session_id,delete e.session_id),e.session_expires&&(e.sex=e.session_expires,delete e.session_expires),(!e.sex||e.sex<t)&&(e.sid=V(),e.sst=t),e.sex=t+15e5,ez(e),{session_id:e.sid,session_start:e.sst,session_expires:e.sex}},eZ=g(v()),eJ=function(){var e;switch(e0()){case"cellular":e="cellular";break;case"ethernet":e="wired";break;case"wifi":e="wifi";break;case void 0:break;default:e="other"}return e},e0=function(){var e=eZ.default.navigator,t=e&&(e.connection||e.mozConnection||e.webkitConnection);return t&&t.type};eJ.getConnectionFromAPI=e0;var e1=e3({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"}),e2=e3({ad:"ad",af:"affiliate",ag:"aggregate",ap:"api",al:"application",ao:"audio",ar:"architecture",as:"asset",au:"autoplay",av:"average",bi:"bitrate",bn:"brand",br:"break",bw:"browser",by:"bytes",bz:"business",ca:"cached",cb:"cancel",cc:"codec",cd:"code",cg:"category",ch:"changed",ci:"client",ck:"clicked",cl:"canceled",cm:"cmcd",cn:"config",co:"count",ce:"counter",cp:"complete",cq:"creator",cr:"creative",cs:"captions",ct:"content",cu:"current",cv:"cumulative",cx:"c
1onnection",cz:"context",da:"data",dg:"downscaling",dm:"domain",dn:"cdn",do:"downscale",dr:"drm",dp:"dropped",du:"duration",dv:"device",dy:"dynamic",eb:"enabled",ec:"encoding",ed:"edge",en:"end",eg:"engine",em:"embed",er:"error",ep:"experiments",es:"errorcode",et:"errortext",ee:"event",ev:"events",ex:"expires",ez:"exception",fa:"failed",fi:"first",fm:"family",ft:"format",fp:"fps",fq:"frequency",fr:"frame",fs:"fullscreen",ha:"has",hb:"holdback",he:"headers",ho:"host",hn:"hostname",ht:"height",id:"id",ii:"init",in:"instance",ip:"ip",is:"is",ke:"key",la:"language",lb:"labeled",le:"level",li:"live",ld:"loaded",lo:"load",ls:"lists",lt:"latency",ma:"max",md:"media",me:"message",mf:"manifest",mi:"mime",ml:"midroll",mm:"min",mn:"manufacturer",mo:"model",mp:"mode",ms:"ms",mx:"mux",ne:"newest",nm:"name",no:"number",on:"on",or:"origin",os:"os",pa:"paused",pb:"playback",pd:"producer",pe:"percentage",pf:"played",pg:"program",ph:"playhead",pi:"plugin",pl:"preroll",pn:"playing",po:"poster",pp:"pip",pr:"preload",ps:"position",pt:"part",pv:"previous",py:"property",px:"pop",pz:"plan",ra:"rate",rd:"requested",re:"rebuffer",rf:"rendition",rg:"range",rm:"remote",ro:"ratio",rp:"response",rq:"request",rs:"requests",sa:"sample",sd:"skipped",se:"session",sh:"shift",sk:"seek",sm:"stream",so:"source",sq:"sequence",sr:"series",ss:"status",st:"start",su:"startup",sv:"server",sw:"software",sy:"severity",ta:"tag",tc:"tech",te:"text",tg:"target",th:"throughput",ti:"time",tl:"total",to:"to",tt:"title",ty:"type",ug:"upscaling",un:"universal",up:"upscale",ur:"url",us:"user",va:"variant",vd:"viewed",vi:"video",ve:"version",vw:"view",vr:"viewer",wd:"width",wa:"watch",wt:"waiting"});function e3(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[e[i]]=i);return t}function e4(e){var t={},i={};return Object.keys(e).forEach(function(r){var a=!1;if(e.hasOwnProperty(r)&&void 0!==e[r]){var s=r.split("_"),n=s[0],o=e1[n];o||(j.info("Data key word `"+s[0]+"` not expected in "+r),o=n+"_"),s.splice(1).forEach(function(e){"url"===e&&(a=!0),e2[e]?o+=e2[e]:Number.isInteger(Number(e))?o+=e:(j.info("Data key word `"+e+"` not expected in "+r),o+="_"+e+"_")}),a?i[o]=e[r]:t[o]=e[r]}}),Object.assign(t,i)}var e5=g(v()),e8=g(M()),e9={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},e6=["hb","requestcompleted","requestfailed","requestcanceled"],e7=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._beaconUrl=e||"https://img.litix.io",this._eventQueue=[],this._postInFlight=!1,this._resendAfterPost=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},e9,t)};e7.prototype.queueEvent=function(e,t){var i=Object.assign({},t);return(this._eventQueue.length<=this._options.maxQueueLength||"eventrateexceeded"===e)&&(this._eventQueue.push(i),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength)},e7.prototype.flushEvents=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&1===this._eventQueue.length?this._eventQueue.pop():(this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending())},e7.prototype.destroy=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.destroyed=!0,e?this._clearBeaconQueue():this.flushEvents(),e5.default.clearTimeout(this._sendTimeout)},e7.prototype._clearBeaconQueue=function(){var e=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,t=this._eventQueue.slice(e);e>0&&Object.assign(t[t.length-1],e4({mux_view_message:"event queue truncated"}));var i=this._createPayload(t);tt(this._beaconUrl,i,!0,function(){})},e7.prototype._sendBeaconQueue=function(){var e=this;if(this._postInFlight){this._resendAfterPost=!0;return}var t=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var i=this._createPayload(t),r=H();tt(this._beaconUrl,i,!1,function(i,a){a?(e._eventQueue=t.concat(e._eventQueue),e._failureCount+=1,j.info("Error sending beacon: "+a)):e._failureCount=0,e._roundTripTime=H()-r,e._postInFlight=!1,e._resendAfterPost&&(e._resendAfterPost=!1,e._eventQueue.length>0&&e._sendBeaconQueue())})},e7.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var e=Math.pow(2,this._failureCount-1);return(1+(e*=Math.random()))*this._options.baseTimeBetweenBeacons},e7.prototype._startBeaconSending=function(){var e=this;e5.default.clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=e5.default.setTimeout(function(){e._eventQueue.length&&e._sendBeaconQueue(),e._startBeaconSending()},this._getNextBeaconTime()))},e7.prototype._createPayload=function(e){var t=this,i={transmission_timestamp:Math.round(H())};this._roundTripTime&&(i.rtt_ms=Math.round(this._roundTripTime));var r,a,s,n=function(){s=(r=JSON.stringify({metadata:i,events:a||e})).length/1024},o=function(){return s<=t._options.maxPayloadKBSize};return n(),o()||(j.info("Payload size is too big ("+s+" kb). Removing unnecessary events."),a=e.filter(function(e){return -1===e6.indexOf(e.e)}),n()),o()||(j.info("Payload size still too big ("+s+" kb). Cropping fields.."),a.forEach(function(e){for(var t in e){var i=e[t];"string"==typeof i&&i.length>51200&&(e[t]=i.substring(0,51200))}}),n()),r};var te="function"==typeof e8.default.exitPictureInPicture?function(e){return e.length<=57344}:function(e){return!1},tt=function(e,t,i,r){if(i&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(e,t))return void r();if(e5.default.fetch)return void e5.default.fetch(e,{method:"POST",body:t,headers:{"Content-Type":"text/plain"},keepalive:te(t)}).then(function(e){return r(null,e.ok?null:"Error")}).catch(function(e){return r(null,e)});if(e5.default.XMLHttpRequest){var a=new e5.default.XMLHttpRequest;a.onreadystatechange=function(){if(4===a.readyState)return r(null,200!==a.status?"error":void 0)},a.open("POST",e),a.setRequestHeader("Content-Type","text/plain"),a.send(t);return}r()},ti=["env_key","view_id","view_sequence_number","player_sequence_number","beacon_domain","player_playhead_time","viewer_time","mux_api_version","event","video_id","player_instance_id","player_error_code","player_error_message","player_error_context","player_error_severity","player_error_business_exception","view_playing_time_ms_cumulative","ad_playing_time_ms_cumulative"],tr=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended","adresponse","adrequest"],ta=["ad_id","ad_creative_id","ad_universal_id"],ts=["viewstart","error","ended","viewend"],tn=function(){function e(t,i){var r,a,s,n,o,l,d,u,h,c,m,f,g,v,y,E,b,T,A,_=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Q(this,e),ee(this,"mux",void 0),ee(this,"envKey",void 0),ee(this,"options",void 0),ee(this,"eventQueue",void 0),ee(this,"sampleRate",void 0),ee(this,"disableCookies",void 0),ee(this,"respectDoNotTrack",void 0),ee(this,"previousBeaconData",void 0),ee(this,"lastEventTime",void 0),ee(this,"rateLimited",void 0),ee(this,"pageLevelData",void 0),ee(this,"viewerData",void 0),this.mux=t,this.envKey=i,this.options=_,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.eventQueue=new e7((r=this.envKey,s=(a=this.options).beaconCollectionDomain,n=a.beaconDomain,s?"https://"+s:(r=r||"inferred").match(/^[a-z0-9]+$/)?"https://"+r+"."+(n||"litix.io"):"https://img.litix.io/a.gif")),this.sampleRate=null!=(b=this.options.sampleRate)?b:1,this.disableCookies=null!=(T=this.options.disableCookies)&&T,this.respectDoNotTrack=null!=(A=this.options.respectDoNotTrack)&&A,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.pageLevelData={mux_api_version:this.mux.API_VERSION,mux_embed:this.mux.NAME,mux_embed_version:this.mux.VERSION,viewer_application_name:null==(o=this.options.platform)?void 0:o.name,viewer_application_version:null==(l=this.options.platform)?void 0:l.version,viewer_application_engine:null==(d=this.options.platform)?void 0:d.layout,viewer_device_name:null==(u=this.options.platform)?void 0:u.product,viewer_device_category:"",viewer_device_manufacturer:null==(h=this.options.platform)?void 0:h.manufacturer,viewer_os_family:null==(m=this.options.platform)||null==(c=m.os)?void 0:c.family,viewer_os_architecture:null==(g=this.options.platform)||null==(f=g.os)?void 0:f.architecture,viewer_os_version:null==(y=this.options.platform)||null==(v=y.os)?void 0:v.version,viewer_connection_type:eJ(),page_url:null===eK.default||void 0===eK.default||null==(E=eK.default.location)?void 0:E.href},this.viewerData=this.disableCookies?{}:eX()}return J(e,[{key:"send",value:function(e,t){if(!(!e||!(null!=t&&t.view_id))){if(this.respectDoNotTrack&&z())return j.info("Not sending `"+e+"` because Do Not Track is enabled");if(!t||"object"!=typeof t)return j.error("A data object was expected in send() but was not provided");var i=this.disableCookies?{}:eQ(),r=ec(eh({},this.pageLevelData,t,i,this.viewerData),{event:e,env_key:this.envKey});r.user_id&&(r.viewer_user_id=r.user_id,delete r.user_id);var a,s=(null!=(a=r.mux_sample_number)?a:0)>=this.sampleRate,n=e4(this._deduplicateBeaconData(e,r));if(this.lastEventTime=this.mux.utils.now(),s)return j.info("Not sending event due to sample rate restriction",e,r,n);if(this.envKey||j.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",e,r,n),!this.rateLimited)if(j.info("Sending event",e,r,n),this.rateLimited=!this.eventQueue.queueEvent(e,n),this.mux.WINDOW_UNLOADING&&"viewend"===e)this.eventQueue.destroy(!0);else{if(this.mux.WINDOW_HIDDEN&&"hb"===e)this.eventQueue.flushEvents(!0);else if(ts.indexOf(e)>=0){if("error"===e&&"warning"===t.player_error_severity)return;this.eventQueue.flushEvents()}if(this.rateLimited)return r.event="eventrateexceeded",n=e4(r),this.eventQueue.queueEvent(r.event,n),j.error("Beaconing disabled due to rate limit.")}}}},{key:"destroy",value:function(){this.eventQueue.destroy(!1)}},{key:"_deduplicateBeaconData",value:function(e,t){var i=this,r={},a=t.view_id;if("-1"===a||"viewstart"===e||"viewend"===e||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=6e5)r=eh({},t),a&&(this.previousBeaconData=r),a&&"viewend"===e&&(this.previousBeaconData=null);else{var s=0===e.indexOf("request");Object.entries(t).forEach(function(t){var a=U(t,2),n=a[0],o=a[1];i.previousBeaconData&&(o!==i.previousBeaconData[n]||ti.indexOf(n)>-1||i.objectHasChanged(s,n,o,i.previousBeaconData[n])||i.eventRequiresKey(e,n))&&
1(r[n]=o,i.previousBeaconData[n]=o)})}return r}},{key:"objectHasChanged",value:function(e,t,i,r){return!!e&&0===t.indexOf("request_")&&("request_response_headers"===t||"object"!=typeof i||"object"!=typeof r||Object.keys(i||{}).length!==Object.keys(r||{}).length)}},{key:"eventRequiresKey",value:function(e,t){return!!("renditionchange"===e&&0===t.indexOf("video_source_")||ta.includes(t)&&tr.includes(e)||"playbackmodechange"===e&&0===t.indexOf("player_playback_mode"))}}]),e}(),to=function e(t){Q(this,e);var i=0,r=0,a=0,s=0,n=0,o=0,l=0;t.on("requestcompleted",function(e,o){var l,d,u=o.request_start,h=o.request_response_start,c=o.request_response_end,m=o.request_bytes_loaded;if(s++,h?(l=h-(null!=u?u:0),d=(null!=c?c:0)-h):d=(null!=c?c:0)-(null!=u?u:0),d>0&&m&&m>0){var f=m/d*8e3;n++,r+=m,a+=d,t.data.view_min_request_throughput=Math.min(t.data.view_min_request_throughput||1/0,f),t.data.view_average_request_throughput=r/a*8e3,t.data.view_request_count=s,l>0&&(i+=l,t.data.view_max_request_latency=Math.max(t.data.view_max_request_latency||0,l),t.data.view_average_request_latency=i/n)}}),t.on("requestfailed",function(e,i){s++,o++,t.data.view_request_count=s,t.data.view_request_failed_count=o}),t.on("requestcanceled",function(e,i){s++,l++,t.data.view_request_count=s,t.data.view_request_canceled_count=l})},tl=function e(t){var i=this;Q(this,e),ee(this,"_lastEventTime",void 0),t.on("before*",function(e,r){var a=r.viewer_time,s=H(),n=i._lastEventTime;if(i._lastEventTime=s,n&&s-n>36e5){var o=Object.keys(t.data).reduce(function(e,i){return 0===i.indexOf("video_")?Object.assign(e,ee({},i,t.data[i])):e},{});t.mux.log.info("Received event after at least an hour inactivity, creating a new view");var l=t.playbackHeartbeat._playheadShouldBeProgressing;t._resetView(Object.assign({viewer_time:a},o)),t.playbackHeartbeat._playheadShouldBeProgressing=l,t.playbackHeartbeat._playheadShouldBeProgressing&&"play"!==e.type&&"adbreakstart"!==e.type&&(t.emit("play",{viewer_time:a}),"playing"!==e.type&&t.emit("playing",{viewer_time:a}))}})};function td(e,t){return(null==e?void 0:e.toLowerCase())===(null==t?void 0:t.toLowerCase())}var tu=function e(t){Q(this,e);var i=function(e){var i,r,a,o=null!=(i=e)&&i.request_type&&("media"===i.request_type||"video"===i.request_type)&&null!=(r=i.request_response_headers)&&r["x-cdn"]?i.request_response_headers["x-cdn"]:null!=i&&i.video_cdn?i.video_cdn:null,l=null!=(a=e)&&a.request_start?a.request_start:null!=a&&a.viewer_time?a.viewer_time:Date.now();null!=o&&!td(o,s)&&n<=l&&(s=o,n=l,t.emit("cdnchange",{video_cdn:o}))},r=null,a=null,s=null,n=0;t.on("viewinit",function(){r=null,a=null,s=null,n=0}),t.on("beforecdnchange",function(e,t){var i=null==t?void 0:t.video_cdn;i&&(void 0===t.video_previous_cdn||null===t.video_previous_cdn)&&(td(i,a)?t.video_previous_cdn=null!=r?r:void 0:(t.video_previous_cdn=null!=a?a:void 0,r=a,a=i))}),t.on("requestcompleted",function(e,t){i(t)})},th=function(e){try{return JSON.parse(e),!0}catch(e){return!1}},tc=function e(t){var i=this;Q(this,e),ee(this,"_emittingAutomaticEvent",!1),ee(this,"_hasInitialized",!1),ee(this,"_currentMode","standard"),t.on("viewstart",function(){i._hasInitialized||(i._hasInitialized=!0,i._currentMode=t.data.player_playback_mode||"standard",i._emittingAutomaticEvent=!0,t.emit("playbackmodechange",{player_playback_mode:i._currentMode,player_playback_mode_data:"{}"}),i._emittingAutomaticEvent=!1)}),t.on("viewend",function(){i._hasInitialized=!1}),t.on("playbackmodechange",function(e,r){i._emittingAutomaticEvent||(r.player_playback_mode_data?th(r.player_playback_mode_data)||(t.mux.log.warn("Invalid JSON string for player_playback_mode_data"),r.player_playback_mode_data="{}"):r.player_playback_mode_data="{}",t.data.player_playback_mode_data=r.player_playback_mode_data,t.data.player_playback_mode=r.player_playback_mode,i._currentMode=r.player_playback_mode)})},tm=function(){function e(t){Q(this,e),ee(this,"pm",void 0),ee(this,"_currentRangeStart",void 0),ee(this,"_lastPlayheadTime",void 0),this.pm=t,this._currentRangeStart=null,this._lastPlayheadTime=null,t.on("playbackheartbeat",this._updatePlaybackRange.bind(this)),t.on("playbackheartbeatend",this._endPlaybackRange.bind(this))}return J(e,[{key:"_updateLastRangeEnd",value:function(){var e=this.pm.data.video_playback_ranges;if(e&&e.length>0){var t=this.pm.data.player_playhead_time||0;e[e.length-1][1]=t}}},{key:"_updatePlaybackRange",value:function(){var e,t=this.pm.data.player_playhead_time||0;if(!(!this.pm.disableAdPlaybackRangeFiltering&&null!=(e=this.pm.adTracker)&&e.isAdBreak&&null!==this._lastPlayheadTime&&t<this._lastPlayheadTime)){if(null!==this._lastPlayheadTime&&null!==this._currentRangeStart&&Math.abs(t-this._lastPlayheadTime)>1e3){var i=this.pm.data.video_playback_ranges;i&&i.length>0&&(i[i.length-1][1]=this._lastPlayheadTime),this._currentRangeStart=null}if(null===this._currentRangeStart){var r=this.pm.data.video_playback_ranges||[];r.length>0&&r[r.length-1][1]===t?this._currentRangeStart=r[r.length-1][0]:(this._currentRangeStart=t,r.push([t,t])),this.pm.data.video_playback_ranges=r}else this._updateLastRangeEnd();this._lastPlayheadTime=t}}},{key:"_endPlaybackRange",value:function(){null!==this._currentRangeStart&&(this._updateLastRangeEnd(),this._currentRangeStart=null,this._lastPlayheadTime=null)}}]),e}(),tf=["viewstart","ended","loadstart","pause","play","playing","ratechange","waiting","adplay","adpause","adended","aderror","adplaying","adrequest","adresponse","adbreakstart","adbreakend","adfirstquartile","admidpoint","adthirdquartile","rebufferstart","rebufferend","seeked","error","hb","requestcompleted","requestfailed","requestcanceled","renditionchange","cdnchange","playbackmodechange"],tp=new Set(["requestcompleted","requestfailed","requestcanceled"]),tg=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&er(r,e);var t,i=(t=function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,i=et(r);return e=t?Reflect.construct(i,arguments,et(this).constructor):i.apply(this,arguments),e&&("object"===b(e)||"function"==typeof e)?e:X(this)});function r(e,t,a){Q(this,r),ee(X(s=i.call(this)),"pageLoadEndTime",void 0),ee(X(s),"pageLoadInitTime",void 0),ee(X(s),"_destroyed",void 0),ee(X(s),"_heartBeatTimeout",void 0),ee(X(s),"adTracker",void 0),ee(X(s),"dashjs",void 0),ee(X(s),"data",void 0),ee(X(s),"disablePlayheadRebufferTracking",void 0),ee(X(s),"disableRebufferTracking",void 0),ee(X(s),"disableAdPlaybackRangeFiltering",void 0),ee(X(s),"errorTracker",void 0),ee(X(s),"errorTranslator",void 0),ee(X(s),"emitTranslator",void 0),ee(X(s),"getAdData",void 0),ee(X(s),"getPlayheadTime",void 0),ee(X(s),"getStateData",void 0),ee(X(s),"stateDataTranslator",void 0),ee(X(s),"hlsjs",void 0),ee(X(s),"id",void 0),ee(X(s),"longResumeTracker",void 0),ee(X(s),"minimumRebufferDuration",void 0),ee(X(s),"mux",void 0),ee(X(s),"playbackEventDispatcher",void 0),ee(X(s),"playbackHeartbeat",void 0),ee(X(s),"playbackHeartbeatTime",void 0),ee(X(s),"playheadTime",void 0),ee(X(s),"seekingTracker",void 0),ee(X(s),"sustainedRebufferThreshold",void 0),ee(X(s),"watchTimeTracker",void 0),ee(X(s),"currentFragmentPDT",void 0),ee(X(s),"currentFragmentStart",void 0),s.pageLoadInitTime=ed(),s.pageLoadEndTime=el(),s.mux=e,s.id=t,null!=a&&a.beaconDomain&&s.mux.log.warn("The `beaconDomain` setting has been deprecated
1in favor of `beaconCollectionDomain`. Please change your integration to use `beaconCollectionDomain` instead of `beaconDomain`."),(a=Object.assign({debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,disableAdPlaybackRangeFiltering:!1,errorTranslator:function(e){return e},emitTranslator:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return t},stateDataTranslator:function(e){return e}},a)).data=a.data||{},a.data.property_key&&(a.data.env_key=a.data.property_key,delete a.data.property_key),j.level=a.debug?1:3,s.getPlayheadTime=a.getPlayheadTime,s.getStateData=a.getStateData||function(){return{}},s.getAdData=a.getAdData||function(){},s.minimumRebufferDuration=a.minimumRebufferDuration,s.sustainedRebufferThreshold=a.sustainedRebufferThreshold,s.playbackHeartbeatTime=a.playbackHeartbeatTime,s.disableRebufferTracking=a.disableRebufferTracking,s.disableRebufferTracking&&s.mux.log.warn("Disabling rebuffer tracking. This should only be used in specific circumstances as a last resort when your player is known to unreliably track rebuffering."),s.disablePlayheadRebufferTracking=a.disablePlayheadRebufferTracking,s.disableAdPlaybackRangeFiltering=a.disableAdPlaybackRangeFiltering,s.errorTranslator=a.errorTranslator,s.emitTranslator=a.emitTranslator,s.stateDataTranslator=a.stateDataTranslator,s.playbackEventDispatcher=new tn(e,a.data.env_key,a),s.data={player_instance_id:V(),mux_sample_rate:a.sampleRate,beacon_domain:a.beaconCollectionDomain||a.beaconDomain},s.data.view_sequence_number=1,s.data.player_sequence_number=1;var s,n=(function(){void 0===this.data.view_start&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"),this.emit("renditionchange"))}).bind(X(s));if(s.on("viewinit",function(e,t){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,t),this._initializeViewData(),this.one("play",n),this.one("adbreakstart",n)}),s.on("videochange",function(e,t){this._resetView(t)}),s.on("programchange",function(e,t){this.data.player_is_paused&&this.mux.log.warn("The `programchange` event is intended to be used when the content changes mid playback without the video source changing, however the video is not currently playing. If the video source is changing please use the videochange event otherwise you will lose startup time information."),this._resetView(Object.assign(t,{view_program_changed:!0})),n(),this.emit("play"),this.emit("playing")}),s.on("fragmentchange",function(e,t){this.currentFragmentPDT=t.currentFragmentPDT,this.currentFragmentStart=t.currentFragmentStart}),s.on("destroy",s.destroy),"u">typeof window&&"function"==typeof window.addEventListener&&"function"==typeof window.removeEventListener){var o=function(){var e=void 0!==s.data.view_start;s.mux.WINDOW_HIDDEN="hidden"===document.visibilityState,e&&s.mux.WINDOW_HIDDEN&&(s.data.player_is_paused||s.emit("hb"))};window.addEventListener("visibilitychange",o,!1);var l=function(e){e.persisted||s.destroy()};window.addEventListener("pagehide",l,!1),s.on("destroy",function(){window.removeEventListener("visibilitychange",o),window.removeEventListener("pagehide",l)})}return s.on("playerready",function(e,t){Object.assign(this.data,t)}),tf.forEach(function(e){s.on(e,function(t,i){0!==e.indexOf("ad")&&this._updateStateData(),Object.assign(this.data,i),this._sanitizeData()}),s.on("after"+e,function(){("error"!==e||this.errorTracker.viewErrored)&&this.send(e)})}),s.on("viewend",function(e,t){Object.assign(s.data,t)}),s.one("playerready",function(e){var t=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=t-this.data.player_init_time),this.pageLoadInitTime=this.data.page_load_init_time||this.pageLoadInitTime,this.pageLoadEndTime=this.data.page_load_end_time||this.pageLoadEndTime,!this.mux.PLAYER_TRACKED&&this.pageLoadInitTime&&(this.mux.PLAYER_TRACKED=!0,(this.data.player_init_time||this.pageLoadEndTime)&&(this.data.page_load_time=Math.min(this.data.player_init_time||1/0,this.pageLoadEndTime||1/0)-this.pageLoadInitTime)),this.send("playerready"),delete this.data.player_startup_time,delete this.data.page_load_time}),s.longResumeTracker=new tl(X(s)),s.errorTracker=new ex(X(s)),new eW(X(s)),s.seekingTracker=new e$(X(s)),s.playheadTime=new eO(X(s)),s.playbackHeartbeat=new eD(X(s)),new eB(X(s)),s.watchTimeTracker=new eP(X(s)),new eM(X(s)),new tm(X(s)),s.adTracker=new eG(X(s)),new eU(X(s)),new eN(X(s)),new eF(X(s)),new to(X(s)),new tu(X(s)),new tc(X(s)),a.hlsjs&&s.addHLSJS(a),a.dashjs&&s.addDashJS(a),s.emit("viewinit",a.data),s}return J(r,[{key:"emit",value:function(e,t){var i,a=Object.assign({viewer_time:this.mux.utils.now()},t),s=[e,a];if(this.emitTranslator)try{s=this.emitTranslator(e,a)}catch(e){this.mux.log.warn("Exception in emit translator callback.",e)}null!=s&&s.length&&(i=ei(et(r.prototype),"emit",this)).call.apply(i,[this].concat(q(s)))}},{key:"destroy",value:function(){this._destroyed||(this._destroyed=!0,void 0!==this.data.view_start&&(this.emit
1("viewend"),this.send("viewend")),this.playbackEventDispatcher.destroy(),this.removeHLSJS(),this.removeDashJS(),window.clearTimeout(this._heartBeatTimeout))}},{key:"send",value:function(e){if(this.data.view_id){var t=Object.assign({},this.data);if(void 0===t.video_source_is_live&&(t.player_source_duration===1/0||t.video_source_duration===1/0?t.video_source_is_live=!0:(t.player_source_duration>0||t.video_source_duration>0)&&(t.video_source_is_live=!1)),t.video_source_is_live||["player_program_time","player_manifest_newest_program_time","player_live_edge_program_time","player_program_time","video_holdback","video_part_holdback","video_target_duration","video_part_target_duration"].forEach(function(e){t[e]=void 0}),t.video_source_url=t.video_source_url||t.player_source_url,t.video_source_url){var i=U(es(t.video_source_url),2),r=i[0];t.video_source_domain=i[1],t.video_source_hostname=r}delete t.ad_request_id,t.video_playback_ranges&&(t.video_playback_range=JSON.stringify(t.video_playback_ranges.filter(function(e){return e[0]!==e[1]}).map(function(e){return"".concat(e[0],":").concat(e[1])})),delete t.video_playback_ranges),this.playbackEventDispatcher.send(e,t),this.data.view_sequence_number++,this.data.player_sequence_number++,tp.has(e)||this._restartHeartBeat(),"viewend"===e&&delete this.data.view_id}}},{key:"_resetView",value:function(e){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",e)}},{key:"_updateStateData",value:function(){var e,t=this.getStateData();if("function"==typeof this.stateDataTranslator)try{t=this.stateDataTranslator(t)}catch(e){this.mux.log.warn("Exception in stateDataTranslator translator callback.",e)}null!=(e=this.data)&&e.video_cdn&&null!=t&&t.video_cdn&&(t.video_cdn,t=function(e,t){if(null==e)return{};var i,r,a=function(e,t){if(null==e)return{};var i,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)i=s[r],t.indexOf(i)>=0||(a[i]=e[i]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(a[i]=e[i])}return a}(t,["video_cdn"])),Object.assign(this.data,t),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var e=this;["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"].forEach(function(t){var i=parseInt(e.data[t],10);e.data[t]=isNaN(i)?void 0:i}),["player_source_url","video_source_url"].forEach(function(t){if(e.data[t]){var i=e.data[t].toLowerCase();(0===i.indexOf("data:")||0===i.indexOf("blob:"))&&(e.data[t]="MSE style URL")}})}},{key:"_resetVideoData",value:function(){var e=this;Object.keys(this.data).forEach(function(t){0===t.indexOf("video_")&&delete e.data[t]})}},{key:"_resetViewData",value:function(){var e=this;Object.keys(this.data).forEach(function(t){0===t.indexOf("view_")&&delete e.data[t]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(){delete this.data.player_error_code,delete this.data.player_error_message,delete this.data.player_error_context,delete this.data.player_error_severity,delete this.data.player_error_business_exception}},{key:"_initializeViewData",value:function(){var e=this,t=this.data.view_id=V(),i=function(){t===e.data.view_id&&eu(e.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",i):i()}},{key:"_restartHeartBeat",value:function(){var e=this;window.clearTimeout(this._heartBeatTimeout),this._heartBeatTimeout=window.setTimeout(function(){e.data.player_is_paused||e.emit("hb")},1e4)}},{key:"addHLSJS",value:function(e){e.hlsjs?this.hlsjs?this.mux.log.warn("An instance of HLS.js is already being monitored for this player."):(this.hlsjs=e.hlsjs,eb(this.mux,this.id,e.hlsjs,{},e.Hls||window.Hls)):this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.")}},{key:"removeHLSJS",value:function(){this.hlsjs&&(eT(this.hlsjs),this.hlsjs=void 0)}},{key:"addDashJS",value:function(e){e.dashjs?this.dashjs?this.mux.log.warn("An instance of Dash.js is already being monitored for this player."):(this.dashjs=e.dashjs,eL(this.mux,this.id,e.dashjs)):this.mux.log.warn("You must pass a valid dashjs instance in order to track it.")}},{key:"removeDashJS",value:function(){this.dashjs&&(ew(this.dashjs),this.dashjs=void 0)}}]),r}(eI),tv=g(M());function ty(){return tv.default&&!!(tv.default.fullscreenElement||tv.default.webkitFullscreenElement||tv.default.mozFullScreenElement||tv.default.msFullscreenElement)}var tE,tb,tT=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],tA={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"},t_=g(v());t_.default&&t_.default.WeakMap&&(tb=new WeakMap);var tS=function(e){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(e),this.manifest};tS.prototype.process=function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.processLine(this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}
1,tS.prototype.processLine=function(e){var t=e.indexOf(":"),i=tD(e,t),r=i[0],a=2===i.length?tw(i[1]):void 0;if("#"!==r[0])this.currentUri.uri=r,this.manifest.segments.push(this.currentUri),!this.manifest.targetDuration||"duration"in this.currentUri||(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(r){case"#EXT-X-TARGETDURATION":if(!isFinite(a)||a<0)return;this.manifest.targetDuration=a,this.setHoldBack();break;case"#EXT-X-PART-INF":tk(this.manifest,i),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case"#EXT-X-SERVER-CONTROL":tk(this.manifest,i),this.setHoldBack();break;case"#EXTINF":0===a?this.currentUri.duration=.01:a>0&&(this.currentUri.duration=a);break;case"#EXT-X-PROGRAM-DATE-TIME":var s=new Date(a);this.manifest.dateTimeString||(this.manifest.dateTimeString=a,this.manifest.dateTimeObject=s),this.currentUri.dateTimeString=a,this.currentUri.dateTimeObject=s;break;case"#EXT-X-VERSION":tk(this.manifest,i);break;case"#EXT-X-SESSION-DATA":var n=ev(tx(i[1]));Object.assign(this.manifest.sessionData,n)}},tS.prototype.setHoldBack=function(){var e=this.manifest,t=e.serverControl,i=e.targetDuration,r=e.partTargetDuration;if(t){var a="holdBack",s="partHoldBack",n=i&&3*i,o=r&&2*r;i&&!t.hasOwnProperty(a)&&(t[a]=n),n&&t[a]<n&&(t[a]=n),r&&!t.hasOwnProperty(s)&&(t[s]=3*r),r&&t[s]<o&&(t[s]=o)}};var tk=function(e,t){var i,r=tL(t[0].replace("#EXT-X-",""));tC(t[1])?(i={},i=Object.assign(tI(t[1]),i)):i=tw(t[1]),e[r]=i},tL=function(e){return e.toLowerCase().replace(/-(\w)/g,function(e){return e[1].toUpperCase()})},tw=function(e){if("yes"===e.toLowerCase()||"no"===e.toLowerCase())return"yes"===e.toLowerCase();var t=-1!==e.indexOf(":")?e:parseFloat(e);return isNaN(t)?e:t},tR=function(e){var t={},i=e.split("=");return i.length>1&&(t[tL(i[0])]=tw(i[1])),t},tI=function(e){for(var t=e.split(","),i={},r=0;t.length>r;r++)i=Object.assign(tR(t[r]),i);return i},tC=function(e){return e.indexOf("=")>-1},tD=function(e,t){return -1===t?[e]:[e.substring(0,t),e.substring(t+1)]},tx=function(e){var t={};if(e){var i=e.search(",");return[e.slice(0,i),e.slice(i+1)].forEach(function(e,i){for(var r=e.replace(/['"]+/g,"").split("="),a=0;a<r.length;a++)"DATA-ID"===r[a]&&(t["DATA-ID"]=r[1-a]),"VALUE"===r[a]&&(t.VALUE=r[1-a])}),{data:t}}},tP={safeCall:function(e,t,i,r){var a=r;if(e&&"function"==typeof e[t])try{a=e[t].apply(e,i)}catch(e){j.info("safeCall error",e)}return a},safeIncrement:eu,getComputedStyle:function(e,t){var i;return e&&t&&t_.default&&"function"==typeof t_.default.getComputedStyle?(tb&&tb.has(e)&&(i=tb.get(e)),i||(i=t_.default.getComputedStyle(e,null),tb&&tb.set(e,i)),i.getPropertyValue(t)):""},secondsToMs:function(e){return Math.floor(1e3*e)},assign:Object.assign,headersStringToObject:ep,cdnHeadersToRequestId:eg,extractHostnameAndDomain:es,extractHostname:ea,manifestParser:tS,generateShortID:G,generateUUID:V,now:H,findMediaElement:K},tM={},tO=function(e){var t=arguments;"string"==typeof e?tO.hasOwnProperty(e)?F.default.setTimeout(function(){t=Array.prototype.splice.call(t,1),tO[e].apply(null,t)},0):j.warn("`"+e+"` is an unknown task"):"function"==typeof e?F.default.setTimeout(function(){e(tO)},0):j.warn("`"+e+"` is invalid.")},tN={loaded:H(),NAME:"mux-embed",VERSION:"5.17.10",API_VERSION:"2.1",PLAYER_TRACKED:!1,monitor:function(e,t){return function(e,t,i){var r=U(K(t),3),a=r[0],s=r[1],n=r[2],o=e.log,l=e.utils.getComputedStyle,d=e.utils.secondsToMs;if(!a)return o.error("No element was found with the `"+s+"` query selector.");if("video"!==n&&"audio"!==n)return o.error("The element of `"+s+"` was not a media element.");a.mux&&(a.mux.destroy(),delete a.mux,o.warn("Already monitoring this video element, replacing existing event listeners")),(i=Object.assign({automaticErrorTracking:!0},i,{getPlayheadTime:function(){return d(a.currentTime)},getStateData:function(){var e,t,i=(null==(e=this.getPlayheadTime)?void 0:e.call(this))||d(a.currentTime),r=this.hlsjs&&this.hlsjs.url,s=this.dashjs&&"function"==typeof this.dashjs.getSource&&this.dashjs.getSource(),n={player_is_paused:a.paused,player_width:parseInt(l(a,"width")),player_height:parseInt(l(a,"he
1ight")),player_autoplay_on:a.autoplay,player_preload_on:a.preload,player_language_code:a.lang,player_is_fullscreen:ty(),video_poster_url:a.poster,video_source_url:r||s||a.currentSrc,video_source_duration:d(a.duration),video_source_height:a.videoHeight,video_source_width:a.videoWidth,view_dropped_frame_count:null==a||null==(t=a.getVideoPlaybackQuality)?void 0:t.call(a).droppedVideoFrames};if(a.getStartDate&&i>0){var o=a.getStartDate();if(o&&"function"==typeof o.getTime&&o.getTime()){var u=o.getTime();n.player_program_time=u+i,a.seekable.length>0&&(n.player_live_edge_program_time=u+a.seekable.end(a.seekable.length-1))}}return n}})).data=Object.assign({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:e.VERSION},i.data),a.mux=a.mux||{},a.mux.deleted=!1,a.mux.emit=function(t,i){e.emit(s,t,i)},a.mux.updateData=function(e){a.mux.emit("hb",e)};var u=function(){o.error("The monitor for this video element has already been destroyed.")};a.mux.destroy=function(){Object.keys(a.mux.listeners).forEach(function(e){a.removeEventListener(e,a.mux.listeners[e],!1)}),delete a.mux.listeners,a.mux.fullscreenChangeListener&&(document.removeEventListener("fullscreenchange",a.mux.fullscreenChangeListener,!1),delete a.mux.fullscreenChangeListener),a.mux.destroy=u,a.mux.swapElement=u,a.mux.emit=u,a.mux.addHLSJS=u,a.mux.addDashJS=u,a.mux.removeHLSJS=u,a.mux.removeDashJS=u,a.mux.updateData=u,a.mux.setEmitTranslator=u,a.mux.setStateDataTranslator=u,a.mux.setGetPlayheadTime=u,a.mux.deleted=!0,e.emit(s,"destroy")},a.mux.swapElement=function(t){var i=U(K(t),3),r=i[0],s=i[1],n=i[2];return r?"video"!==n&&"audio"!==n?e.log.error("The element of `"+s+"` was not a media element."):void(r.muxId=a.muxId,delete a.muxId,r.mux=r.mux||{},r.mux.listeners=Object.assign({},a.mux.listeners),delete a.mux.listeners,Object.keys(r.mux.listeners).forEach(function(e){a.removeEventListener(e,r.mux.listeners[e],!1),r.addEventListener(e,r.mux.listeners[e],!1)}),r.mux.fullscreenChangeListener=a.mux.fullscreenChangeListener,delete a.mux.fullscreenChangeListener,r.mux.swapElement=a.mux.swapElement,r.mux.destroy=a.mux.destroy,delete a.mux,a=r):e.log.error("No element was found with the `"+s+"` query selector.")},a.mux.addHLSJS=function(t){e.addHLSJS(s,t)},a.mux.addDashJS=function(t){e.addDashJS(s,t)},a.mux.removeHLSJS=function(){e.removeHLSJS(s)},a.mux.removeDashJS=function(){e.removeDashJS(s)},a.mux.setEmitTranslator=function(t){e.setEmitTranslator(s,t)},a.mux.setStateDataTranslator=function(t){e.setStateDataTranslator(s,t)},a.mux.setGetPlayheadTime=function(t){t||(t=i.getPlayheadTime),e.setGetPlayheadTime(s,t)},e.init(s,i),e.emit(s,"playerready"),a.paused||(e.emit(s,"play"),a.readyState>2&&e.emit(s,"playing")),a.mux.listeners={},tT.forEach(function(t){("error"!==t||i.automaticErrorTracking)&&(a.mux.listeners[t]=function(){var i={};if("error"===t){if(!a.error||1===a.error.code)return;i.player_error_code=a.error.code,i.player_error_message=tA[a.error.code]||a.error.message}e.emit(s,t,i)},a.addEventListener(t,a.mux.listeners[t],!1))}),a.mux.listeners.enterpictureinpicture=function(){e.emit(s,"playbackmodechange",{player_playback_mode:"pip",player_playback_mode_data:"{}"})},a.mux.listeners.leavepictureinpicture=function(){var t=ty()?"fullscreen":"standard";e.emit(s,"playbackmodechange",{player_playback_mode:t,player_playback_mode_data:"{}"})},a.addEventListener("enterpictureinpicture",a.mux.listeners.enterpictureinpicture,!1),a.addEventListener("leavepictureinpicture",a.mux.listeners.leavepictureinpicture,!1),a.mux.fullscreenChangeListener=function(){var t=ty(),i=document.fullscreenElement;if(t&&(i===a||null!=i&&i.contains(a)))e.emit(s,"playbackmodechange",{player_playback_mode:"fullscreen",player_playback_mode_data:"{}"});else if(!t){var r=document.pictureInPictureElement===a;e.emit(s,"playbackmodechange",{player_playback_mode:r?"pip":"standard",player_playback_mode_data:"{}"})}},document.addEventListener("fullscreenchange",a.mux.fullscreenChangeListener,!1)}(tO,e,t)},destroyMonitor:function(e){var t=U(K(e),1)[0];t&&t.mux&&"function"==typeof t.mux.destroy?t.mux.destroy():j.error("A video element monitor for `"+e+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(e,t){var i=W(e);tM[i]?tM[i].addHLSJS(t):j.error("A monitor for `"+i+"` has not been initialized.")},addDashJS:function(e,t){var i=W(e);tM[i]?tM[i].addDashJS(t):j.error("A monitor for `"+i+"` has not been initialized.")},removeHLSJS:function(e){var t=W(e);tM[t]?tM[t].removeHLSJS():j.error("A monitor for `"+t+"` has not been initialized.")},removeDashJS:function(e){var t=W(e);tM[t]?tM[t].removeDashJS():j.error("A monitor for `"+t+"` has not been initialized.")},init:function(e,t){z()&&t&&t.respectDoNotTrack&&j.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var i=W(e);tM[i]=new tg(tO,i,t)},emit:function(e,t,i){var r=W(e);tM[r]?(tM[r].emit(t,i),"destroy"===t&&delete tM[r]):j.error("A monitor for `"+r+"` has not been initialized.")},updateData:function(e,t){var i=W(e);tM[i]?tM[i].emit("hb",t):j.error("A monitor for `"+i+"` has not been initialized.")},setEmitTranslator:function(e,t){var i=W(e);tM[i]?tM[i].emitTranslator=t:j.error("A monitor for `"+i+"` has not been initialized.")},setStateDataTranslator:function(e,t){var i=W(e);tM[i]?tM[i].stateDataTranslator=t:j.error("A monitor for `"+i+"` has not been initialized.")},setGetPlayheadTime:function(e,t){var i=W(e);tM[i]?tM[i].getPlayheadTime=t:j.error("A monitor for `"+i+"` has not been initialized.")},checkDoNotTrack:z,log:j,utils:tP,events:{PLAYER_READY:"playerready",VIEW_INIT:"viewinit",VIDEO_CHANGE:"videochange",PLAY:"play",PAUSE:"pause",PLAYING:"playing",TIME_UPDATE:"timeupdate",SEEKING:"seeking",SEEKED:"seeked",REBUFFER_START:"rebufferstart",REBUFFER_END:"rebufferend",ERROR:"error",ENDED:"ended",RENDITION_CHANGE:"renditionchange",ORIENTATION_CHANGE:"orientationchange",PLAYBACK_MODE_CHANGE:"playbackmodechange",AD_REQUEST:"adrequest",AD_RESPONSE:"adresponse",AD_BREAK_START:"adbreakstart",AD_PLAY:"adplay",AD_PLAYING:"adplaying",AD_PAUSE:"adpause",AD_FIRST_QUARTILE:"adfirstquartile",AD_MID_POINT:"admidpoint",AD_THIRD_QUARTILE:"adthirdquartile",AD_ENDED:"adended",AD_BREAK_END:"adbreakend",AD_ERROR:"aderror",REQUEST_COMPLETED:"requestcompleted",REQUEST_FAILED:"requestfailed",REQUEST_CANCELLED:"requestcanceled",HEARTBEAT:"hb",DESTROY:"destroy"},WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(tO,tN),void 0!==F.default&&"function"==typeof F.default.addEventListener&&F.default.addEventListener("pagehide",function(e){e.persisted||(tO.WINDOW_UNLOADING=!0)},!1);let tU=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},tF=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=tB},tB=Number.MAX_SAFE_INTEGER||0x1fffffffffffff,t$=((de={}
1).NETWORK_ERROR="networkError",de.MEDIA_ERROR="mediaError",de.KEY_SYSTEM_ERROR="keySystemError",de.MUX_ERROR="muxError",de.OTHER_ERROR="otherError",de),tH=((dt={}).KEY_SYSTEM_NO_KEYS="keySystemNoKeys",dt.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",dt.KEY_SYSTEM_NO_SESSION="keySystemNoSession",dt.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",dt.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",dt.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",dt.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",dt.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",dt.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",dt.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",dt.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",dt.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",dt.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",dt.MANIFEST_LOAD_ERROR="manifestLoadError",dt.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",dt.MANIFEST_PARSING_ERROR="manifestParsingError",dt.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",dt.LEVEL_EMPTY_ERROR="levelEmptyError",dt.LEVEL_LOAD_ERROR="levelLoadError",dt.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",dt.LEVEL_PARSING_ERROR="levelParsingError",dt.LEVEL_SWITCH_ERROR="levelSwitchError",dt.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",dt.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",dt.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",dt.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",dt.FRAG_LOAD_ERROR="fragLoadError",dt.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",dt.FRAG_DECRYPT_ERROR="fragDecryptError",dt.FRAG_PARSING_ERROR="fragParsingError",dt.FRAG_GAP="fragGap",dt.REMUX_ALLOC_ERROR="remuxAllocError",dt.KEY_LOAD_ERROR="keyLoadError",dt.KEY_LOAD_TIMEOUT="keyLoadTimeOut",dt.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",dt.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",dt.BUFFER_APPEND_ERROR="bufferAppendError",dt.BUFFER_APPENDING_ERROR="bufferAppendingError",dt.BUFFER_STALLED_ERROR="bufferStalledError",dt.BUFFER_FULL_ERROR="bufferFullError",dt.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",dt.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",dt.ASSET_LIST_LOAD_ERROR="assetListLoadError",dt.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",dt.ASSET_LIST_PARSING_ERROR="assetListParsingError",dt.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",dt.INTERNAL_EXCEPTION="internalException",dt.INTERNAL_ABORTED="aborted",dt.ATTACH_MEDIA_ERROR="attachMediaError",dt.UNKNOWN="unknown",dt),tV=((di={}).MEDIA_ATTACHING="hlsMediaAttaching",di.MEDIA_ATTACHED="hlsMediaAttached",di.MEDIA_DETACHING="hlsMediaDetaching",di.MEDIA_DETACHED="hlsMediaDetached",di.MEDIA_ENDED="hlsMediaEnded",di.STALL_RESOLVED="hlsStallResolved",di.BUFFER_RESET="hlsBufferReset",di.BUFFER_CODECS="hlsBufferCodecs",di.BUFFER_CREATED="hlsBufferCreated",di.BUFFER_APPENDING="hlsBufferAppending",di.BUFFER_APPENDED="hlsBufferAppended",di.BUFFER_EOS="hlsBufferEos",di.BUFFERED_TO_END="hlsBufferedToEnd",di.BUFFER_FLUSHING="hlsBufferFlushing",di.BUFFER_FLUSHED="hlsBufferFlushed",di.MANIFEST_LOADING="hlsManifestLoading",di.MANIFEST_LOADED="hlsManifestLoaded",di.MANIFEST_PARSED="hlsManifestParsed",di.LEVEL_SWITCHING="hlsLevelSwitching",di.LEVEL_SWITCHED="hlsLevelSwitched",di.LEVEL_LOADING="hlsLevelLoading",di.LEVEL_LOADED="hlsLevelLoaded",di.LEVEL_UPDATED="hlsLevelUpdated",di.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",di.LEVELS_UPDATED="hlsLevelsUpdated",di.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",di.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",di.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",di.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",di.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",di.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",di.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",di.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",di.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",di.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",di.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",di.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",di.SUBTITLE_FRAG_PROCESSED="hl
1sSubtitleFragProcessed",di.CUES_PARSED="hlsCuesParsed",di.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",di.INIT_PTS_FOUND="hlsInitPtsFound",di.FRAG_LOADING="hlsFragLoading",di.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",di.FRAG_LOADED="hlsFragLoaded",di.FRAG_DECRYPTED="hlsFragDecrypted",di.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",di.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",di.FRAG_PARSING_METADATA="hlsFragParsingMetadata",di.FRAG_PARSED="hlsFragParsed",di.FRAG_BUFFERED="hlsFragBuffered",di.FRAG_CHANGED="hlsFragChanged",di.FPS_DROP="hlsFpsDrop",di.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",di.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",di.ERROR="hlsError",di.DESTROYING="hlsDestroying",di.KEY_LOADING="hlsKeyLoading",di.KEY_LOADED="hlsKeyLoaded",di.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",di.BACK_BUFFER_REACHED="hlsBackBufferReached",di.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",di.ASSET_LIST_LOADING="hlsAssetListLoading",di.ASSET_LIST_LOADED="hlsAssetListLoaded",di.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",di.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",di.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",di.INTERSTITIAL_STARTED="hlsInterstitialStarted",di.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",di.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",di.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",di.INTERSTITIAL_ENDED="hlsInterstitialEnded",di.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",di.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",di.EVENT_CUE_ENTER="hlsEventCueEnter",di);var tG="manifest",tW="level",tK="audioTrack",tq="subtitleTrack",tj="main",tY="audio",tz="subtitle";class tX{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){let i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){let e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class tQ{constructor(e,t,i,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_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_
1=new tX(e),this.fast_=new tX(t),this.defaultTTFB_=r,this.ttfb_=new tX(e)}update(e,t){let{slow_:i,fast_:r,ttfb_:a}=this;i.halfLife!==e&&(this.slow_=new tX(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new tX(t,r.getEstimate(),r.getTotalWeight())),a.halfLife!==e&&(this.ttfb_=new tX(e,a.getEstimate(),a.getTotalWeight()))}sample(e,t){let i=(e=Math.max(e,this.minDelayMs_))/1e3,r=8*t/i;this.fast_.sample(i,r),this.slow_.sample(i,r)}sampleTTFB(e){let t=Math.sqrt(2)*Math.exp(-Math.pow(e/1e3,2)/2);this.ttfb_.sample(t,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function tZ(){return(tZ=Object.assign.bind()).apply(null,arguments)}function tJ(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function t0(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?tJ(Object(i),!0).forEach(function(t){var r,a;r=t,a=i[t],(r=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t);if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(r))in e?Object.defineProperty(e,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[r]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):tJ(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}class t1{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 i=`[${e}]:`;this.trace=t2,this.debug=t.debug.bind(null,i),this.log=t.log.bind(null,i),this.warn=t.warn.bind(null,i),this.info=t.info.bind(null,i),this.error=t.error.bind(null,i)}}let t2=function(){},t3={trace:t2,debug:t2,log:t2,warn:t2,info:t2,error:t2};function t4(){return tZ({},t3)}function t5(e,t,i){let r;return t[e]?t[e].bind(t):(r=self.console[e])?r.bind(self.console,`${i?"["+i+"] ":""}[${e}] >`):t2}let t8=t4();function t9(e=!0){if(!("u"<typeof self))return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function t6(e,t){let i=Object.keys(e),r=Object.keys(t),a=i.length,s=r.length;return!a||!s||a===s&&!i.some(e=>-1===r.indexOf(e))}function t7(e,t=!1){let i,r;if("u">typeof TextDecoder){let i=new TextDecoder("utf-8").decode(e);if(t){let e=i.indexOf("\0");return -1!==e?i.substring(0,e):i}return i.replace(/\0/g,"")}let a=e.length,s="",n=0;for(;n<a&&(0!==(i=e[n++])||!t);)if(0!==i&&3!==i)switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:s+=String.fromCharCode(i);break;case 12:case 13:s+=String.fromCharCode((31&i)<<6|63&(r=e[n++]));break;case 14:s+=String.fromCharCode((15&i)<<12|(63&(r=e[n++]))<<6|63&e[n++])}return s}function ie(e){let t="";for(let i=0;i<e.length;i++){let r=e[i].toString(16);r.length<2&&(r="0"+r),t+=r}return t}function it(e){return Uint8Array.from(e.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}var ii={exports:{}},ir=dl?ii.exports:(dl=1,l5=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,l8=/^(?=([^\/?#]*))\1([^]*)$/,l9=/(?:\/|^)\.(?=\/)/g,l6=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,ii.exports=l7={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=l7.parseURL(e);if(!r)throw Error("Error trying to parse base URL.");return r.path=l7.normalizePath(r.path),l7.buildURLFromParts(r)}var a=l7.parseURL(t);if(!a)throw Error("Error trying to parse relative URL.");
vendor: 1,118 bytes, line 1
1if(a.scheme)return i.alwaysNormalize?(a.path=l7.normalizePath(a.path),l7.buildURLFromParts(a)):t;var s=l7.parseURL(e);if(!s)throw Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var n=l8.exec(s.path);s.netLoc=n[1],s.path=n[2]}s.netLoc&&!s.path&&(s.path="/");var o={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(o.netLoc=s.netLoc,"/"!==a.path[0]))if(a.path){var l=s.path,d=l.substring(0,l.lastIndexOf("/")+1)+a.path;o.path=l7.normalizePath(d)}else o.path=s.path,!a.params&&(o.params=s.params,a.query||(o.query=s.query));return null===o.path&&(o.path=i.alwaysNormalize?l7.normalizePath(a.path):a.path),l7.buildURLFromParts(o)},parseURL:function(e){var t=l5.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(l9,"");e.length!==(e=e.replace(l6,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}}
1,ii.exports);class ia{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 is="audio",io="video",il="audiovideo";class id{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,"string"==typeof e&&(e={url:e}),this.base=e,function(e,t){let i=function e(t,i){let r=Object.getPrototypeOf(t);if(r){let t=Object.getOwnPropertyDescriptor(r,i);return t||e(r,i)}}(e,t);i&&(i.enumerable=!0,Object.defineProperty(e,t,i))}(this,"stats")}setByteRange(e,t){let i,r=e.split("@",2);i=1===r.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(r[1]),this._byteRange=[i,parseInt(r[0])+i]}get baseurl(){return this.base.url}get byteRange(){return null===this._byteRange?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return null===this._streams&&(this._streams={[is]:null,[io]:null,[il]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return null!==this._stats}get hasStreams(){return null!==this._streams}get stats(){return null===this._stats&&(this._stats=new ia),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=ir.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){let{elementaryStreams:e}=this;e[is]=null,e[io]=null,e[il]=null}}function iu(e){return"initSegment"!==e.sn}class ih extends id{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){let e=this.stats.total;if(e)return e}if(this.byteRange.length){let e=this.byteRange[0],t=this.byteRange[1];if(tU(e)&&tU(t))return t-e}return null}get bitrate(){return this.byteLength?8*this.byteLength/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;let{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!(null!=(e=this._decryptdata)&&e.keyId)){let e=Object.keys(t);if(1===e.length){let i=this._decryptdata=t[e[0]]||null;i&&(this._decryptdata=i.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;let e=tU(this.duration)?this.duration:0;return this.programDateTime+1e3*e}get encrypted(){var e,t;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){let e=Object.keys(this.levelkeys),i=e.length;if(i>1||1===i&&null!=(t=this.levelkeys[e[0]])&&t.encrypted)return!0}return!1}get programDateTime(){return null===this._programDateTime&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!tU(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return iu(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){let t=this.levelkeys;if(t){var i;let r=t[e];r&&!(null!=(i=this._decryptdata)&&i.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,t))}}abortRequests(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}setElementaryStreamInfo(e,t,i,r,a,s=!1){let{elementaryStreams:n}=this,o=n[e];if(!o){n[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:a,partial:s};return}o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,i),o.startDTS=Math.min(o.startDTS,r),o.endDTS=Math.max(o.endDTS,a)}}class ic extends id{constructor(e,t,i,r,a){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;const s=e.enumeratedString("BYTERANGE");s&&this.setByteRange(s,a),a&&(this.fragOffset=a.fragOffset+a.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){let{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}let im=[].push,ip={video:1,audio:2,id3:3,text:4};function ig(e){return String.fromCharCode.apply(null,e)}function iv(e,t){let i=e[t]<<8|e[t+1];return i<0?65536+i:i}function iy(e,t){let i=ib(e,t);return i<0?0x100000000+i:i}function iE(e,t){let i=iy(e,t);return i*=0x100000000,i+=iy(e,t+4)}function ib(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function iT(e,t){let i=[];if(!t.length)return i;let r=e.byteLength;for(let a=0;a<r;){let s=iy(e,a),n=ig(e.subarray(a+4,a+8)),o=s>1?a+s:r;if(n===t[0])if(1===t.length)i.push(e.subarray(a+8,o));else{let r=iT(e.subarray(a+8,o),t.slice(1));r.length&&im.apply(i,r)}a=o}return i}function iA(e){let t=[],i=iT(e,["moov","trak"]);for(let e=0;e<i.length;e++){let r=i[e],a=iT(r,["tkhd"])[0];if(a){let e=a[0],i=iy(a,0===e?12:20),s=iT(r,["mdia","mdhd"])[0];if(s){e=s[0];let a=iy(s,0===e?12:20),n=iT(r,["mdia","hdlr"])[0];if(n){let e=ig(n.subarray(8,12)),s={soun:is,vide:io}[e],o=function(e){let t,i=e.subarray(8),r=i.subarray(86),a=ig(i.subarray(4,8)),s=a,n="enca"===a||"encv"===a;if(n){let e=iT(i,[a])[0].subarray("enca"===a?28:78);
1iT(e,["sinf"]).forEach(e=>{let t=iT(e,["schm"])[0];if(t){let i=ig(t.subarray(4,8));if("cbcs"===i||"cenc"===i){let t=iT(e,["frma"])[0];t&&(s=ig(t))}}})}let o=s;switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{let e=iT(r,["avcC"])[0];e&&e.length>3&&(s+="."+ik(e[1])+ik(e[2])+ik(e[3]),t=i_("avc1"===o?"dva1":"dvav",r));break}case"mp4a":{let e=iT(i,[a])[0],t=iT(e.subarray(28),["esds"])[0];if(t&&t.length>7){let e=4;if(3!==t[e++])break;e=iS(t,e)+2;let i=t[e++];if(128&i&&(e+=2),64&i&&(e+=t[e++]),4!==t[e++])break;e=iS(t,e);let r=t[e++];if(64===r)s+="."+ik(r);else break;if(e+=12,5!==t[e++])break;e=iS(t,e);let a=t[e++],n=(248&a)>>3;31===n&&(n+=1+((7&a)<<3)+((224&t[e])>>5)),s+="."+n}break}case"hvc1":case"hev1":{let e=iT(r,["hvcC"])[0];if(e&&e.length>12){let t=e[1],i=["","A","B","C"][t>>6],r=iy(e,2),a=e[12],n=e.subarray(6,12);s+="."+i+(31&t),s+="."+(function(e){let t=0;for(let i=0;i<32;i++)t|=(e>>i&1)<<31-i;return t>>>0})(r).toString(16).toUpperCase(),s+="."+((32&t)>>5?"H":"L")+a;let o="";for(let e=n.length;e--;){let t=n[e];(t||o)&&(o="."+t.toString(16).toUpperCase()+o)}s+=o}t=i_("hev1"==o?"dvhe":"dvh1",r);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":s=i_(s,r)||s;break;case"vp09":{let e=iT(r,["vpcC"])[0];if(e&&e.length>6){let t=e[4],i=e[5],r=e[6]>>4&15;s+="."+iL(t)+"."+iL(i)+"."+iL(r)}break}case"av01":{let e=iT(r,["av1C"])[0];if(e&&e.length>2){let i=e[1]>>>5,a=31&e[1],n=e[2]>>>7?"H":"M",o=(64&e[2])>>6,l=(32&e[2])>>5,d=(16&e[2])>>4,u=(8&e[2])>>3,h=(4&e[2])>>2,c=3&e[2];s+="."+i+"."+iL(a)+n+"."+iL(2===i&&o?l?12:10:o?10:8)+"."+d+"."+u+h+c+"."+iL(1)+"."+iL(1)+"."+iL(1)+".0",t=i_("dav1",r)}}}return{codec:s,encrypted:n,supplemental:t}}(iT(r,["mdia","minf","stbl","stsd"])[0]);s?(t[i]={timescale:a,type:s,stsd:o},t[s]=t0({timescale:a,id:i},o)):t[i]={timescale:a,type:e,stsd:o}}}}}return iT(e,["moov","mvex","trex"]).forEach(e=>{let i=t[iy(e,4)];i&&(i.default={duration:iy(e,12),flags:iy(e,20)})}),t}function i_(e,t){let i=iT(t,["dvvC"]),r=i.length?i[0]:iT(t,["dvcC"])[0];if(r){let t=r[2]>>1&127,i=r[2]<<5&32|r[3]>>3&31;return e+"."+iL(t)+"."+iL(i)}}function iS(e,t){let i=t+5;for(;128&e[t++]&&t<i;);return t}function ik(e){return("0"+e.toString(16).toUpperCase()).slice(-2)}function iL(e){return(e<10?"0":"")+e}function iw(e,t){iT(e,["moov","trak"]).forEach(e=>{let i=iT(e,["mdia","minf","stbl","stsd"])[0];if(!i)return;let r=i.subarray(8),a=iT(r,["enca"]),s=a.length>0;s||(a=iT(r,["encv"])),a.forEach(e=>{iT(s?e.subarray(28):e.subarray(78),["sinf"]).forEach(e=>{let i=iR(e);i&&t(i,s)})})})}function iR(e){let t=iT(e,["schm"])[0];if(t){let i=ig(t.subarray(4,8));if("cbcs"===i||"cenc"===i){let t=iT(e,["schi","tenc"])[0];if(t)return t}}}function iI(e,t){let i=new Uint8Array(e.length+t.length);return i.set(e),i.set(t,e.length),i}function iC(e,t){let i=[],r=t.samples,a=t.timescale,s=t.id,n=!1;return iT(r,["moof"]).map(o=>{let l=o.byteOffset-8;iT(o,["traf"]).map(o=>{let d=iT(o,["tfdt"]).map(e=>{let t=e[0],i=iy(e,4);return 1===t&&(i*=0x100000000,i+=iy(e,8)),i/a})[0];return void 0!==d&&(e=d),iT(o,["tfhd"]).map(d=>{let u=iy(d,4),h=0xffffff&iy(d,0),c=0,m=0,f=8;u===s&&((1&h)!=0&&(f+=8),(2&h)!=0&&(f+=4),(8&h)!=0&&(c=iy(d,f),f+=4),(16&h)!=0&&(m=iy(d,f),f+=4),(32&h)!=0&&(f+=4),"video"===t.type&&(n=iD(t.codec)),iT(o,["trun"]).map(s=>{let o=s[0],d=0xffffff&iy(s,0),u=0,h=(256&d)!=0,f=0,g=(512&d)!=0,v=0,y=(1024&d)!=0,E=(2048&d)!=0,b=0,T=iy(s,4),A=8;(1&d)!=0&&(u=iy(s,A),A+=4),(4&d)!=0&&(A+=4);let _=u+l;for(let l=0;l<T;l++){if(h?(f=iy(s,A),A+=4):f=c,g?(v=iy(s,A),A+=4):v=m,y&&(A+=4),E&&(b=0===o?iy(s,A):ib(s,A),A+=4),t.type===io){let t=0;for(;t<v;){let s=iy(r,_);_+=4,function(e,t){if(!e)return 6==(31&t);{let e=t>>1&63;return 39===e||40===e}}(n,r[_])&&ix(r.subarray(_,_+s),n?2:1,e+b/a,i),_+=s,t+=s+4}}e+=f/a}}))})})}),i}function iD(e){if(!e)return!1;let t=e.substring(0,4);return"hvc1"===t||"hev1"===t||"dvh1"===t||"dvhe"===t}function ix(e,t,i,r){let a,s=iP(e);a=0+t;let n=0,o=0,l=0;for(;a<s.length;){n=0;do{if(a>=s.length)break;n+=l=s[a++]}while(255===l)o=0;do{if(a>=s.length)break;o+=l=s[a++]}while(255===l)let e=s.length-a,t=a;if(o<e)a+=o;else if(o>e){t8.error(`Malformed SEI payload. ${o} is too small, only ${e} bytes left to parse.`);break}if(4===n){if(181===s[t++]){let e=iv(s,t);if(t+=2,49===e){let e=iy(s,t);if(t+=4,0x47413934===e){let e=s[t++];if(3===e){let a=s[t++],o=31&a,l=64&a,d=l?2+3*o:0,u=new Uint8Array(d);if(l){u[0]=a;for(let e=1;e<d;e++)u[e]=s[t++]}r.push({type:e,payloadType:n,pts:i,bytes:u})}}}}}else if(5===n&&o>16){let e=[];for(let i=0;i<16;i++){let r=s[t++].toString(16);e.push(1==r.length?"0"+r:r),(3===i||5===i||7===i||9===i)&&e.push("-")}let a=o-16,l=new Uint8Array(a);for(let e=0;e<a;e++)l[e]=s[t++];r.push({payloadType:n,pts:i,uuid:e.join(""),userData:t7(l),userDataBytes:l})}}}function iP(e){let t=e.byteLength,i=[],r=1;for(;r<t-2;)0===e[r]&&0===e[r+1]&&3===e[r+2]?(i.push(r+2),r+=2):r++;if(0===i.length)return e;let a=t-i.length,s=new Uint8Array(a),n=0;for(r=0;r<a;n++,r++)n===i[0]&&(n++,i.shift()),s[r]=e[n];return s}let iM={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv
160:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function iO(e,t){let i=iM[t];return!!i&&!!i[e.slice(0,4)]}function iN(e,t,i=!0){return!e.split(",").some(e=>!iU(e,t,i))}function iU(e,t,i=!0){var r;let a=t9(i);return null!=(r=null==a?void 0:a.isTypeSupported(iF(e,t)))&&r}function iF(e,t){return`${t}/mp4;codecs=${e}`}function iB(e){if(e){let t=e.substring(0,4);return iM.video[t]}return 2}function i$(e){let t=/\(Windows.+Firefox\//i.test(navigator.userAgent);return e.split(",").reduce((e,i)=>{let r=t&&iD(i)?9:iM.video[i];return r?(2*r+e)/(e?3:2):(iM.audio[i]+e)/(e?2:1)},0)}let iH={},iV=/flac|opus|mp4a\.40\.34/i;function iG(e,t=!0){return e.replace(iV,e=>(function(e,t=!0){if(iH[e])return iH[e];let i={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[e];for(let a=0;a<i.length;a++){var r;if(iU(i[a],"audio",t))return iH[e]=i[a],i[a];if("mp3"===i[a]&&null!=(r=t9(t))&&r.isTypeSupported("audio/mpeg"))return""}return e})(e.toLowerCase(),t))}function iW(e,t){if(e&&(e.length>4||-1!==["ac-3","ec-3","alac","fLaC","Opus"].indexOf(e))&&(iK(e,"audio")||iK(e,"video")))return e;if(t){let i=t.split(",");if(i.length>1){if(e){for(let t=i.length;t--;)if(i[t].substring(0,4)===e.substring(0,4))return i[t]}return i[0]}}return t||e}function iK(e,t){return iO(e,t)&&iU(e,t)}function iq(e){let t=t9(e)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported("audio/mpeg"),mp3:t.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:t.isTypeSupported('audio/mp4; codecs="ac-3"')}}function ij(e){return e.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}let iY={supported:!1,smooth:!1,powerEfficient:!1},iz={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function iX(e,t){return{supported:!1,configurations:t,decodingInfoResults:[iY],error:e}}function iQ(e,t,i,r={}){var a,s,n,o,l,d;let u,h,c,m,f,g,v,y,E=e.videoCodec;if(!E&&!e.audioCodec||!i)return Promise.resolve(iz);let b=[],T=(u=null==(s=(a=e).videoCodec)?void 0:s.split(","),h=iZ(a),c=a.width||640,m=a.height||480,f=a.frameRate||30,g=a.videoRange.toLowerCase(),u?u.map(e=>{let t={contentType:iF(function(e){if(e.startsWith("av01.")){let t=e.split("."),i=["0","111","01","01","01","0"];for(let e=t.length;e>4&&e<10;e++)t[e]=i[e-4];return t.join(".")}return e}(e),"video"),width:c,height:m,bitrate:h,framerate:f};return"sdr"!==g&&(t.transferFunction=g),t}):[]),A=T.length,_=(n=e,o=t,l=A>0,v=null==(d=n.audioCodec)?void 0:d.split(","),y=iZ(n),v&&n.audioGroups?n.audioGroups.reduce((e,t)=>{var i;let r=t?null==(i=o.groups[t])?void 0:i.tracks:null;return r?r.reduce((e,i)=>{if(i.groupId===t){let t=parseFloat(i.channels||"");v.forEach(i=>{let r={contentType:iF(i,"audio"),bitrate:l?function(e,t){if(t<=1)return 1;let i=128e3;return"ec-3"===e?i=768e3:"ac-3"===e&&(i=64e4),Math.min(t/2,i)}(i,y):y};t&&(r.channels=""+t),e.push(r)})}return e},e):e},[]):[]),S=_.length;for(let e=A||+S||1;e--;){let t={type:"media-source"};if(A&&(t.video=T[e%A]),S){t.audio=_[e%S];let i=t.audio.bitrate;t.video&&i&&(t.video.bitrate-=i)}b.push(t)}if(E){let e=navigator.userAgent;if(E.split(",").some(e=>iD(e))&&/\(Windows.+Firefox\//i.test(navigator.userAgent))return Promise.resolve(iX(Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${e})`),b))}return Promise.all(b.map(e=>{let t=function(e){let t="",{audio:i,video:r}=e;if(r){let e=ij(r.contentType);t+=`${e}_r${r.height}x${r.width}f${Math.ceil(r.framerate)}${r.transferFunction||"sd"}_${Math.ceil(r.bitrate/1e5)}`}if(i){let e=ij(i.contentType);t+=`${r?"_":""}${e}_c${i.channels}`}return t}(e);return r[t]||(r[t]=i.decodingInfo(e))})).then(e=>({supported:!e.some(e=>!e.supported),configurations:b,decodingInfoResults:e})).catch(e=>({supported:!1,configurations:b,decodingInfoResults:[],error:e}))}function iZ(e){return 1e3*Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)/1e3)||1}let iJ=["NONE","TYPE-0","TYPE-1",null],i0=["SDR","PQ","HLG"];function i1(e){let{canSkipUntil:t,canSkipDateRanges:i,age:r}=e;return t&&r<t/2?i?"v2":"YES":""}class i2{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){let t=new self.URL(e);return void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class i3{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(e=>!!e).map(e=>e.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const i=null==(t=e.supplemental)?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=`,${i.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 i4(this._audioGroups,e)}hasSubtitleGroup(e){return i4(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if("audio"===e){let e=this._audioGroups;e||(e=this._audioGroups=[]),-1===e.indexOf(t)&&e.push(t)}else if("text"===e){let e=this._subtitleGroups;e||(e=this._subtitleGroups=[]),-1===e.indexOf(t)&&e.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return null==(e=this.audioGroups)?void 0:e[0]}get textGroupId(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}addFallback(){}}function i4(e,t){return!!t&&!!e&&-1!==e.indexOf(t)}let i5=(e,t)=>{let i;return JSON.stringify(e,(i=new WeakSet,(e,r)=>{if(t&&(r=t(e,r)),"object"==typeof r&&null!==r){if(i.has(r))return;i.add(r)}return r}))};function i8(e,t){t8.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function i9(e){return e.reduce((e,t)=>
1{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);let r=t.channels||"2";return i.channels[r]=(i.channels[r]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function i6(e){if(!e)return e;let{lang:t,assocLang:i,characteristics:r,channels:a,audioCodec:s}=e;return{lang:t,assocLang:i,characteristics:r,channels:a,audioCodec:s}}function i7(e,t,i){if("attrs"in e){let i=t.indexOf(e);if(-1!==i)return i}for(let r=0;r<t.length;r++)if(re(e,t[r],i))return r;return -1}function re(e,t,i){let{groupId:r,name:a,lang:s,assocLang:n,default:o}=e,l=e.forced;return(void 0===r||t.groupId===r)&&(void 0===a||t.name===a)&&(void 0===s||function(e,t="--"){return e.length===t.length?e===t:e.startsWith(t)||t.startsWith(e)}(s,t.lang))&&(void 0===s||t.assocLang===n)&&(void 0===o||t.default===o)&&(void 0===l||t.forced===l)&&(!("characteristics"in e)||function(e,t=""){let i=e.split(","),r=t.split(",");return i.length===r.length&&!i.some(e=>-1===r.indexOf(e))}(e.characteristics||"",t.characteristics))&&(void 0===i||i(e,t))}function rt(e,t){let{audioCodec:i,channels:r}=e;return(void 0===i||(t.audioCodec||"").substring(0,4)===i.substring(0,4))&&(void 0===r||r===(t.channels||"2"))}function ri(e,t,i){for(let r=t;r>-1;r--)if(i(e[r]))return r;for(let r=t+1;r<e.length;r++)if(i(e[r]))return r;return -1}function rr(e,t){var i;return!!e&&e!==(null==(i=t.loadLevelObj)?void 0:i.uri)}let ra=function(e,t){let i=0,r=e.length-1,a=null,s=null;for(;i<=r;){let n=t(s=e[a=(i+r)/2|0]);if(n>0)i=a+1;else{if(!(n<0))return s;r=a-1}}return null};function rs(e,t,i=0,r=0,a=.005){let s=null;if(e){s=t[1+e.sn-t[0].sn]||null;let r=e.endDTS-i;r>0&&r<15e-7&&(i+=15e-7),s&&e.level!==s.level&&s.end<=e.end&&(s=t[2+e.sn-t[0].sn]||null)}else 0===i&&0===t[0].start&&(s=t[0]);if(s&&((!e||e.level===s.level)&&0===rn(i,r,s)||function(e,t,i){if(t&&0===t.start&&t.level<e.level&&(t.endPTS||0)>0){let r=t.tagList.reduce((e,t)=>("INF"===t[0]&&(e+=parseFloat(t[1])),e),i);return e.start<=r}return!1}(s,e,Math.min(a,r))))return s;let n=ra(t,rn.bind(null,i,r));return n&&(n!==e||!s)?n:s}function rn(e=0,t=0,i){if(i.start<=e&&i.start+i.duration>e)return 0;let r=Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return i.start+i.duration-r<=e?1:i.start-r>e&&i.start?-1:0}function ro(e,t,i){if(e&&e.startCC<=t&&e.endCC>=t){let r,a=e.fragments,{fragmentHint:s}=e;return s&&(a=a.concat(s)),ra(a,e=>e.cc<t?1:e.cc>t?-1:(r=e,e.end<=i)?1:e.start>i?-1:0),r||null}return null}function rl(e){switch(e.details){case tH.FRAG_LOAD_TIMEOUT:case tH.KEY_LOAD_TIMEOUT:case tH.LEVEL_LOAD_TIMEOUT:case tH.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function rd(e){return e.details.startsWith("key")}function ru(e){return rd(e)&&!!e.frag&&!e.frag.decryptdata}function rh(e,t){let i=rl(t);return e.default[`${i?"timeout":"error"}Retry`]}function rc(e,t){return Math.min(("linear"===e.backoff?1:Math.pow(2,t))*e.retryDelayMs,e.maxRetryDelayMs)}function rm(e){return t0(t0({},e),{errorRetry:null,timeoutRetry:null})}function rf(e,t,i,r){var a;if(!e)return!1;let s=null==r?void 0:r.code,n=t<e.maxNumRetry&&(rp(a=s)||!!a&&(a<400||a>499)||!!i);return e.shouldRetry?e.shouldRetry(e,t,i,r,n):n}function rp(e){return 0===e&&!1===navigator.onLine}function rg(e){let t={action:0,flags:0};return e&&(t.resolved=!0),t}var rv="NOT_LOADED",ry="APPENDING",rE="PARTIAL";class rb{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){let{hls:e}=this;e&&(e.on(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tV.BUFFER_APPENDED,this.onBufferAppended,this),e.on(tV.FRAG_BUFFERED,this.onFragBuffered,this),e.on(tV.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){let{hls:e}=this;e&&(e.off(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tV.BUFFER_APPENDED,this.onBufferAppended,this),e.off(tV.FRAG_BUFFERED,this.onFragBuffered,this),e.off(tV.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){let i=this.activePartLists[t];if(i)for(let t=i.length;t--;){let r=i[t];if(!r)break;
1if(r.start<=e&&e<=r.end&&r.loaded)return r}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,i){let{fragments:r}=this,a=Object.keys(r);for(let s=a.length;s--;){let n=r[a[s]];if((null==n?void 0:n.body.type)===t&&(!i||n.buffered)){let t=n.body;if(t.start<=e&&e<=t.end)return t}}return null}detectEvictedFragments(e,t,i,r,a){this.timeRanges&&(this.timeRanges[e]=t);let s=(null==r?void 0:r.fragment.sn)||-1;Object.keys(this.fragments).forEach(r=>{let n=this.fragments[r];if(!n||s>=n.body.sn)return;if(!n.buffered&&(!n.loaded||a)){n.body.type===i&&this.removeFragment(n.body);return}let o=n.range[e];if(o){if(0===o.time.length)return void this.removeFragment(n.body);o.time.some(e=>{let i=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return i&&this.removeFragment(n.body),i})}})}detectPartialFragments(e){let t=this.timeRanges;if(!t||"initSegment"===e.frag.sn)return;let i=e.frag,r=rA(i),a=this.fragments[r];if(!a||a.buffered&&i.gap)return;let s=!i.relurl;Object.keys(t).forEach(r=>{let n=i.elementaryStreams[r];if(!n)return;let o=t[r],l=s||!0===n.partial;a.range[r]=this.getBufferedTimes(i,e.part,l,o)}),a.loaded=null,Object.keys(a.range).length?(this.bufferedEnd(a,i),rT(a)||this.removeParts(i.sn-1,i.type)):this.removeFragment(a.body)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){let i=this.activePartLists[t];i&&(this.activePartLists[t]=r_(i,t=>t.fragment.sn>=e))}fragBuffered(e,t){let i=rA(e),r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,this.bufferedEnd(r,e))}getBufferedTimes(e,t,i,r){let a={time:[],partial:i},s=e.start,n=e.end,o=e.minEndPTS||n,l=e.maxStartPTS||s;for(let e=0;e<r.length;e++){let t=r.start(e)-this.bufferPadding,i=r.end(e)+this.bufferPadding;if(l>=t&&o<=i){a.time.push({startPTS:Math.max(s,r.start(e)),endPTS:Math.min(n,r.end(e))});break}if(s<i&&n>t){let t=Math.max(s,r.start(e)),i=Math.min(n,r.end(e));i>t&&(a.partial=!0,a.time.push({startPTS:t,endPTS:i}))}else if(n<=t)break}return a}getPartialFragment(e){let t,i,r,a=null,s=0,{bufferPadding:n,fragments:o}=this;return Object.keys(o).forEach(l=>{let d=o[l];d&&rT(d)&&(i=d.body.start-n,r=d.body.end+n,e>=i&&e<=r&&s<=(t=Math.min(e-i,r-e))&&(a=d.body,s=t))}),a}isEndListAppended(e){let t=this.endListFragments[e];return void 0!==t&&(t.buffered||rT(t))}getState(e){let t=rA(e),i=this.fragments[t];if(i)if(!i.buffered)return ry;else if(rT(i))return rE;else return"OK";return rv}isTimeBuffered(e,t,i){let r,a;for(let s=0;s<i.length;s++){if(r=i.start(s)-this.bufferPadding,a=i.end(s)+this.bufferPadding,e>=r&&t<=a)return!0;if(t<=r)break}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if("initSegment"===t.frag.sn||t.frag.bitrateTest)return;let i=t.frag,r=t.part?null:t,a=rA(i);this.fragments[a]={body:i,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){let{frag:i,part:r,timeRanges:a,type:s}=t;if("initSegment"===i.sn)return;let n=i.type;if(r){let e=this.activePartLists[n];e||(this.activePartLists[n]=e=[]),e.push(r)}this.timeRanges=a;let o=a[s];this.detectEvictedFragments(s,o,n,r)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){let t=rA(e);return!!this.fragments[t]}hasFragments(e){let{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let r=i.length;r--;){let a=t[i[r]];if((null==a?void 0:a.body.type)===e)return!0}return!1}hasParts(e){var t;return!!(null!=(t=this.activePartLists[e])&&t.length)}removeFragmentsInRange(e,t,i,r,a){(!r||this.hasGaps)&&Object.keys(this.fragments).forEach(s=>{let n=this.fragments[s];if(!n)return;let o=n.body;o.type===i&&(!r||o.gap)&&o.start<t&&o.end>e&&(n.buffered||a)&&this.removeFragment(o)})}removeFragment(e){let t=rA(e);e.clearElementaryStreamInfo();let i=this.activePartLists[e.type];if(i){let t=e.sn;this.activePartLists[e.type]=r_(i,e=>e.fragment.sn!==t)}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;let t=null==(e=this.hls)||null==(e=e.latestLevelDetails)?void 0:e.partList;
1t&&t.forEach(e=>e.clearElementaryStreamInfo())}}function rT(e){var t,i,r;return e.buffered&&!!(e.body.gap||null!=(t=e.range.video)&&t.partial||null!=(i=e.range.audio)&&i.partial||null!=(r=e.range.audiovideo)&&r.partial)}function rA(e){return`${e.type}_${e.level}_${e.sn}`}function r_(e,t){return e.filter(e=>{let i=t(e);return i||e.clearElementaryStreamInfo(),i})}class rS{constructor(e,t,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=i}decrypt(e,t){switch(this.aesMode){case 0:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case 1:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}class rk{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){let t=new DataView(e),i=new Uint32Array(4);for(let e=0;e<4;e++)i[e]=t.getUint32(4*e);return i}initTable(){let e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],a=i[1],s=i[2],n=i[3],o=this.invSubMix,l=o[0],d=o[1],u=o[2],h=o[3],c=new Uint32Array(256),m=0,f=0,g=0;for(g=0;g<256;g++)g<128?c[g]=g<<1:c[g]=g<<1^283;for(g=0;g<256;g++){let i=f^f<<1^f<<2^f<<3^f<<4;i=i>>>8^255&i^99,e[m]=i,t[i]=m;let o=c[m],g=c[o],v=c[g],y=257*c[i]^0x1010100*i;r[m]=y<<24|y>>>8,a[m]=y<<16|y>>>16,s[m]=y<<8|y>>>24,n[m]=y,y=0x1010101*v^65537*g^257*o^0x1010100*m,l[i]=y<<24|y>>>8,d[i]=y<<16|y>>>16,u[i]=y<<8|y>>>24,h[i]=y,m?(m=o^c[c[c[v^o]]],f^=c[c[f]]):m=f=1}}expandKey(e){let t,i,r,a,s=this.uint8ArrayToUint32Array_(e),n=!0,o=0;for(;o<s.length&&n;)n=s[o]===this.key[o],o++;if(n)return;this.key=s;let l=this.keySize=s.length;if(4!==l&&6!==l&&8!==l)throw Error("Invalid aes key size="+l);let d=this.ksRows=(l+6+1)*4,u=this.keySchedule=new Uint32Array(d),h=this.invKeySchedule=new Uint32Array(d),c=this.sBox,m=this.rcon,f=this.invSubMix,g=f[0],v=f[1],y=f[2],E=f[3];for(t=0;t<d;t++){if(t<l){r=u[t]=s[t];continue}a=r,t%l==0?a=(c[(a=a<<8|a>>>24)>>>24]<<24|c[a>>>16&255]<<16|c[a>>>8&255]<<8|c[255&a])^m[t/l|0]<<24:l>6&&t%l==4&&(a=c[a>>>24]<<24|c[a>>>16&255]<<16|c[a>>>8&255]<<8|c[255&a]),u[t]=r=(u[t-l]^a)>>>0}for(i=0;i<d;i++)t=d-i,a=3&i?u[t]:u[t-4],i<4||t<=4?h[i]=a:h[i]=g[c[a>>>24]]^v[c[a>>>16&255]]^y[c[a>>>8&255]]^E[c[255&a]],h[i]=h[i]>>>0}networkToHostOrderSwap(e){return e<<24|(65280&e)<<8|(0xff0000&e)>>8|e>>>24}decrypt(e,t,i){let r,a,s,n,o,l,d,u,h,c,m,f,g,v,y=this.keySize+6,E=this.invKeySchedule,b=this.invSBox,T=this.invSubMix,A=T[0],_=T[1],S=T[2],k=T[3],L=this.uint8ArrayToUint32Array_(i),w=L[0],R=L[1],I=L[2],C=L[3],D=new Int32Array(e),x=new Int32Array(D.length),P=this.networkToHostOrderSwap;for(;t<D.length;){for(v=1,h=P(D[t]),c=P(D[t+1]),m=P(D[t+2]),f=P(D[t+3]),o=h^E[0],l=f^E[1],d=m^E[2],u=c^E[3],g=4;v<y;v++)r=A[o>>>24]^_[l>>16&255]^S[d>>8&255]^k[255&u]^E[g],a=A[l>>>24]^_[d>>16&255]^S[u>>8&255]^k[255&o]^E[g+1],s=A[d>>>24]^_[u>>16&255]^S[o>>8&255]^k[255&l]^E[g+2],n=A[u>>>24]^_[o>>16&255]^S[l>>8&255]^k[255&d]^E[g+3],o=r,l=a,d=s,u=n,g+=4;r=b[o>>>24]<<24^b[l>>16&255]<<16^b[d>>8&255]<<8^b[255&u]^E[g],a=b[l>>>24]<<24^b[d>>16&255]<<16^b[u>>8&255]<<8^b[255&o]^E[g+1],s=b[d>>>24]<<24^b[u>>16&255]<<16^b[o>>8&255]<<8^b[255&l]^E[g+2],n=b[u>>>24]<<24^b[o>>16&255]<<16^b[l>>8&255]<<8^b[255&d]^E[g+3],x[t]=P(r^w),x[t+1]=P(n^R),x[t+2]=P(s^I),x[t+3]=P(a^C),w=h,R=c,I=m,C=f,t+=4}return x.buffer}}class rL{constructor(e,t,i){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=i}expandKey(){let e=function(e){switch(e){case 0:return"AES-CBC";case 1:return"AES-CTR";default:throw Error(`[FastAESKey] invalid aes mode ${e}`)}}(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}class rw{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.enableSoftw
1areAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const e=self.crypto;e&&(this.subtle=e.subtle||e.webkitSubtle)}catch(e){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){let{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;let i=new Uint8Array(e);if(this.reset(),this.removePKCS7Padding){let e,t;return(t=(e=i.byteLength)&&new DataView(i.buffer).getUint8(e-1))?i.slice(0,e-t):i}return i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i,r){return this.useSoftware?new Promise((a,s)=>{let n=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(n,t,i,r);let o=this.flush();o?a(o.buffer):s(Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i,r)}softwareDecrypt(e,t,i,r){let{currentIV:a,currentResult:s,remainderData:n}=this;if(0!==r||16!==t.byteLength)return t8.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),n&&(e=iI(n,e),this.remainderData=null);let o=this.getValidChunk(e);if(!o.length)return null;a&&(i=a);let l=this.softwareDecrypter;return(l||(l=this.softwareDecrypter=new rk),l.expandKey(t),this.currentResult=l.decrypt(o.buffer,0,i),this.currentIV=o.slice(-16).buffer,s)?s:null}webCryptoDecrypt(e,t,i,r){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,r));this.key=t,this.fastAesKey=new rL(this.subtle,t,r)}return this.fastAesKey.expandKey().then(t=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new rS(this.subtle,new Uint8Array(i),r).decrypt(e.buffer,t)):Promise.reject(Error("web crypto not initialized"))).catch(a=>(t8.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${a.name}: ${a.message}`),this.onWebCryptoError(e,t,i,r)))}onWebCryptoError(e,t,i,r){let a=this.enableSoftwareAES;if(a){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,r);let a=this.flush();if(a)return a.buffer}throw Error("WebCrypto"+(a?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e,i=e.length-e.length%16;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(t8.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}class rR{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){let i=e.url;if(!i)return Promise.reject(new rD({type:t$.NETWORK_ERROR,details:tH.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();let r=this.config,a=r.fLoader,s=r.loader;return new Promise((n,o)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(e=>"GAP"===e[0]))return void o(rC(e));else e.gap=!1;let l=this.loader=a?new a(r):new s(r),d=rI(e);e.loader=l;let u=rm(r.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:131072};e.stats=l.stats;let c={onSuccess:(t,i,r,a)=>{this.resetLoader(e,l);let s=t.data;r.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(s.slice(0,16)),s=s.slice(16)),n({frag:e,part:null,payload:s,networkDetails:a})},onError:(t,r,a,s)=>{this.resetLoader(e,l),o(new rD({type:t$.NETWORK_ERROR,details:tH.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:t0({url:i,data:void 0},t),error:Error(`HTTP Error ${t.code} ${t.text}`),networkDetails:a,stats:s}))},onAbort:(t,i,r)=>{this.resetLoader(e,l),o(new rD({type:t$.NETWORK_ERROR,details:tH.INTERNAL_ABORTED,fatal:!1,frag:e,error:Error("Aborted"),networkDetails:r,stats:t}))},onTimeout:(t,i,r)=>{this.resetLoader(e,l),o(new rD({type:t$.NETWORK_ERROR,details:tH.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:Error(`Timeout after ${h.timeout}ms`),networkDetails:r,stats:t}))}};t&&(c.onProgress=(i,r,a,s)=>t({frag:e,part:null,payload:a,networkDetails:s})),l.load(d,h,c)})}loadPart(e,t,i){this.abort();let r=this.config,a=r.fLoader,s=r.loader;return new Promise((n,o)=>
1{if(this.loader&&this.loader.destroy(),e.gap||t.gap)return void o(rC(e,t));let l=this.loader=a?new a(r):new s(r),d=rI(e,t);e.loader=l;let u=rm(r.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:131072};t.stats=l.stats,l.load(d,h,{onSuccess:(r,a,s,o)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);let d={frag:e,part:t,payload:r.data,networkDetails:o};i(d),n(d)},onError:(i,r,a,s)=>{this.resetLoader(e,l),o(new rD({type:t$.NETWORK_ERROR,details:tH.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:t0({url:d.url,data:void 0},i),error:Error(`HTTP Error ${i.code} ${i.text}`),networkDetails:a,stats:s}))},onAbort:(i,r,a)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),o(new rD({type:t$.NETWORK_ERROR,details:tH.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:Error("Aborted"),networkDetails:a,stats:i}))},onTimeout:(i,r,a)=>{this.resetLoader(e,l),o(new rD({type:t$.NETWORK_ERROR,details:tH.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:Error(`Timeout after ${h.timeout}ms`),networkDetails:a,stats:i}))}})})}updateStatsFromPart(e,t){let i=e.stats,r=t.stats,a=r.total;if(i.loaded+=r.loaded,a){let r=Math.round(e.duration/t.duration),s=Math.min(Math.round(i.loaded/a),r),n=(r-s)*Math.round(i.loaded/s);i.total=i.loaded+n}else i.total=Math.max(i.loaded,i.total);let s=i.loading,n=r.loading;s.start?s.first+=n.first-n.start:(s.start=n.start,s.first=n.first),s.end=n.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function rI(e,t=null){let i=t||e,r={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},a=i.byteRangeStartOffset,s=i.byteRangeEndOffset;if(tU(a)&&tU(s)){var n,o;let t=a,i=s;if("initSegment"===e.sn&&("AES-128"===(o=null==(n=e.decryptdata)?void 0:n.method)||"AES-256"===o)){let e=s-a;e%16&&(i=s+(16-e%16)),0!==a&&(r.resetIV=!0,t=a-16)}r.rangeStart=t,r.rangeEnd=i}return r}function rC(e,t){let i=Error(`GAP ${e.gap?"tag":"attribute"} found`),r={type:t$.MEDIA_ERROR,details:tH.FRAG_GAP,fatal:!1,frag:e,error:i,networkDetails:null};return t&&(r.part=t),(t||e).stats.aborted=!0,new rD(r)}class rD extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class rx extends t1{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&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)}clearNextTick(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)}tick(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class rP{constructor(e,t,i,r=0,a=-1,s=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=rM(),this.buffering={audio:rM(),video:rM(),audiovideo:rM()},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=a,this.partial=s}}function rM(){return{start:0,executeStart:0,executeEnd:0,end:0}}let rO={length:0,start:()=>0,end:()=>0};class rN{static isBuffered(e,t){if(e){let i=rN.getBuffered(e);for(let e=i.length;e--;)if(t>=i.start(e)&&t<=i.end(e))return!0}return!1}static bufferedRanges(e){if(e){let t=rN.getBuffered(e);return rN.timeRangesToArray(t)}return[]}static timeRangesToArray(e){let t=[];for(let i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}static bufferInfo(e,t,i){if(e){let r=rN.bufferedRanges(e);if(r.length)return rN.bufferedInfo(r,t,i)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,i){let r;t=Math.max(0,t),e.length>1&&e.sort((e,t)=>
1e.start-t.start||t.end-e.end);let a=-1,s=[];if(i)for(let r=0;r<e.length;r++){t>=e[r].start&&t<=e[r].end&&(a=r);let n=s.length;if(n){let t=s[n-1].end;e[r].start-t<i?e[r].end>t&&(s[n-1].end=e[r].end):s.push(e[r])}else s.push(e[r])}else s=e;let n=0,o=t,l=t;for(let e=0;e<s.length;e++){let d=s[e].start,u=s[e].end;if(-1===a&&t>=d&&t<=u&&(a=e),t+i>=d&&t<u)o=d,n=(l=u)-t;else if(t+i<d){r=d;break}}return{len:n,start:o||0,end:l||0,nextStart:r,buffered:e,bufferedIndex:a}}static getBuffered(e){try{return e.buffered||rO}catch(e){return t8.log("failed to get media.buffered",e),rO}}}let rU=/\{\$([a-zA-Z0-9-_]+)\}/g;function rF(e,t){if(null!==e.variableList||e.hasVariableRefs){let i=e.variableList;return t.replace(rU,t=>{let r=t.substring(2,t.length-1),a=null==i?void 0:i[r];return void 0===a?(e.playlistParsingError||(e.playlistParsingError=Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),t):a})}return t}function rB(e,t,i){let r,a,s=e.variableList;if(s||(e.variableList=s={}),"QUERYPARAM"in t){r=t.QUERYPARAM;try{let e=new self.URL(i).searchParams;if(e.has(r))a=e.get(r);else throw Error(`"${r}" does not match any query parameter in URI: "${i}"`)}catch(t){e.playlistParsingError||(e.playlistParsingError=Error(`EXT-X-DEFINE QUERYPARAM: ${t.message}`))}}else r=t.NAME,a=t.VALUE;r in s?e.playlistParsingError||(e.playlistParsingError=Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):s[r]=a||""}let r$=/^(\d+)x(\d+)$/,rH=/(.+?)=(".*?"|.*?)(?:,|$)/g;class rV{constructor(e,t){"string"==typeof e&&(e=rV.parseAttrList(e,t)),tZ(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>"X-"===e.substring(0,2))}decimalInteger(e){let t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2),i=new Uint8Array((t=(1&t.length?"0":"")+t).length/2);for(let e=0;e<t.length/2;e++)i[e]=parseInt(t.slice(2*e,2*e+2),16);return i}return null}hexadecimalIntegerAsNumber(e){let t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){let i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){let i=this[e];return(i?i.split(/[ ,]+/):[]).reduce((e,t)=>(e[t.toLowerCase()]=!0,e),t)}bool(e){return"YES"===this[e]}decimalResolution(e){let t=r$.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i,r={};for(rH.lastIndex=0;null!==(i=rH.exec(e));){let a=i[1].trim(),s=i[2],n=0===s.indexOf('"')&&s.lastIndexOf('"')===s.length-1,o=!1;if(n)s=s.slice(1,-1);else switch(a){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":o=!0}if(t&&(n||o))s=rF(t,s);else if(!o&&!n)switch(a){case"CLOSED-CAPTIONS":if("NONE"===s)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":t8.warn(`${e}: attribute ${a} is missing quotes`)}r[a]=s}return r}}class rG{constructor(e,t,i=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=(null==t?void 0:t.tagAnchor)||null,this.tagOrder=null!=(r=null==t?void 0:t.tagOrder)?r:i,t){const i=t.attr;for(const t in i)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==i[t]){t8.warn(`DATERANGE tag attribute: "${t}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=t;break}e=tZ(new rV({}),i,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 e=(null==t?void 0:t.endDate)||new Date(this.attr["END-DATE"]);tU(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){let e=this._cue;return void 0===e?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){let{tagAnchor:e}=this;return null===e||null===e.programDateTime?(t8.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(){let e=this._endDate||this._dateAtEnd;if(e)return e;let t=this.duration;return null!==t?this._dateAtEnd=new Date(this._startDate.getTime()+1e3*t):null}get duration(){if("DURATION"in this.attr){let e=this.attr.decimalFloatingPoint("DURATION");if(tU(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"com.apple.hls.interstitial"===this.class}get isValid(){return!!this.id&&!this._badValueForSameId&&tU(this.startDate.getTime())&&(null===this.duration||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)}}class rW{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
1StartTime=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}let t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let i=t.decryptdata;return i||(t.setKeyFormat(e.keyFormat),i=t.decryptdata),!!i&&e.matches(i)})}get hasProgramDateTime(){return!!this.fragments.length&&tU(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){let e=this.driftEndTime-this.driftStartTime;return e>0?1e3*(this.driftEnd-this.driftStart)/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){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 null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){let e=this.partList;if(e){let t=this.lastPartIndex;if(-1!==t){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){let e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function rK(e,t){return e.length===t.length&&!e.some((e,i)=>e!==t[i])}function rq(e,t){return!e&&!t||!!e&&!!t&&rK(e,t)}function rj(e){return"AES-128"===e||"AES-256"===e||"AES-256-CTR"===e}function rY(e){switch(e){case"AES-128":case"AES-256":return 0;case"AES-256-CTR":return 1;default:throw Error(`invalid full segment method ${e}`)}}function rz(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function rX(e){return Uint8Array.from(unescape(encodeURIComponent(e)),e=>e.charCodeAt(0))}function rQ(e){let t=function(e,t,i){let r=e[t];e[t]=e[i],e[i]=r};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}function rZ(e){let t=e.split(":"),i=null;if("data"===t[0]&&2===t.length){let e=t[1].split(";"),r=e[e.length-1].split(",");if(2===r.length){let t="base64"===r[0],a=r[1];if(t)e.splice(-1,1),i=rz(a);else{let e,t;e=rX(a).subarray(0,16),(t=new Uint8Array(16)).set(e,16-e.length),i=t}}}return i}let rJ="u">typeof self?self:void 0;var r0="org.w3.clearkey",r1="com.apple.fps",r2="com.microsoft.playready",r3="com.widevine.alpha",r4="org.w3.clearkey",r5="com.apple.streamingkeydelivery",r8="com.microsoft.playready",r9="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function r6(e){switch(e){case r5:return r1;case r8:return r2;case r9:return r3;case r4:return r0}}function r7(e){switch(e){case r1:return r5;case r2:return r8;case r3:return r9;case r0:return r4}}function ae(e){let{drmSystems:t,widevineLicenseUrl:i}=e,r=t?[r1,r3,r2,r0].filter(e=>!!t[e]):[];return!r[r3]&&i&&r.push(r3),r}let at=null!=rJ&&null!=(dr=rJ.navigator)&&dr.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function ai(e){let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=String.fromCharCode.apply(null,Array.from(t)),r=i.substring(i.indexOf("<"),i.length),a=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(a){let e=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(e){let t=rz(e).subarray(0,16);return rQ(t),t}}return null}let ar={};class aa{static clearKeyUriToKeyIdMap(){ar={}}static setKeyIdForUri(e,t){ar[e]=t}static addKeyIdForUri(e){let t=Object.keys(ar).length%Number.MAX_SAFE_INTEGER,i=new Uint8Array(16);return new DataView(i.buffer,12,4).setUint32(0,t),ar[e]=i,i}constructor(e,t,i,r=[1],a=null,s){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pss
1h=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=r,this.iv=a,this.encrypted=!!e&&"NONE"!==e,this.isCommonEncryption=this.encrypted&&!rj(e),null!=s&&s.startsWith("0x")&&(this.keyId=new Uint8Array(it(s)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&rK(e.keyFormatVersions,this.keyFormatVersions)&&rq(e.iv,this.iv)&&rq(e.keyId,this.keyId)}isSupported(){if(this.method){if(rj(this.method)||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case r5:case r9:case r8:case r4:return -1!==["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1}getDecryptData(e,t){var i,r;if(!this.encrypted||!this.uri)return null;if(rj(this.method)){let t=this.iv;return t||("number"!=typeof e&&(t8.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),t=function(e){let t=new Uint8Array(16);for(let i=12;i<16;i++)t[i]=e>>8*(15-i)&255;return t}(e)),new aa(this.method,this.uri,"identity",this.keyFormatVersions,t)}if(this.keyId){let e=ar[this.uri];if(e&&!rK(this.keyId,e)&&aa.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}let a=rZ(this.uri);if(a)switch(this.keyFormat){case r9:if(this.pssh=a,!this.keyId){let e=function(e){let t=[];if(e instanceof ArrayBuffer){let i=e.byteLength,r=0;for(;r+32<i;){let i=function(e){let t=e.getUint32(0),i=e.byteOffset,r=e.byteLength;if(r<t)return{offset:i,size:r};if(0x70737368!==e.getUint32(4))return{offset:i,size:t};let a=e.getUint32(8)>>>24;if(0!==a&&1!==a)return{offset:i,size:t};let s=e.buffer,n=ie(new Uint8Array(s,i+12,16)),o=null,l=0;if(0===a)l=28;else{let a=e.getUint32(28);if(!a||r<32+16*a)return{offset:i,size:t};o=[];for(let e=0;e<a;e++)o.push(new Uint8Array(s,i+32+16*e,16));l=32+16*a}if(!l)return{offset:i,size:t};let d=e.getUint32(l);return t-32<d?{offset:i,size:t}:{version:a,systemId:n,kids:o,data:new Uint8Array(s,i+l+4,d),offset:i,size:t}}(new DataView(e,r));t.push(i),r+=i.size}}return t}(a.buffer);if(e.length){let t=e[0];this.keyId=null!=(i=t.kids)&&i.length?t.kids[0]:null}}this.keyId||(this.keyId=as(t));break;case r8:{let e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=function(e,t,i){let r,a;if(16!==e.byteLength)throw RangeError("Invalid system id");r=new Uint8Array,a=new Uint8Array;let s=new Uint8Array(4);return i.byteLength>0&&new DataView(s.buffer).setUint32(0,i.byteLength,!1),function(e,...t){let i=t.length,r=8,a=i;for(;a--;)r+=t[a].byteLength;let s=new Uint8Array(r);for(s[0]=r>>24&255,s[1]=r>>16&255,s[2]=r>>8&255,s[3]=255&r,s.set(e,4),a=0,r=8;a<i;a++)s.set(t[a],r),r+=t[a].byteLength;return s}([112,115,115,104],new Uint8Array([0,0,0,0]),e,a,r,s,i)}(e,0,a),this.keyId=ai(a);break}default:{let e=a.subarray(0,16);if(16!==e.length){let t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e}}if(!this.keyId||16!==this.keyId.byteLength){let e,i;!(e=(i=null==(r=t)?void 0:r[r9])?i.keyId:null)&&((e=as(t))||(e=ar[this.uri])),e&&(this.keyId=e,aa.setKeyIdForUri(this.uri,e))}return this}}function as(e){let t=null==e?void 0:e[r8];if(t){let e=rZ(t.uri);if(e)return ai(e)}return null}let an=/#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,ao=/#EXT-X-MEDIA:(.*)/g,al=/^#EXT(?:INF|-X-TARGETDURATION):/m,ad=RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),au=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 ah{static findGroup(e,t){for(let i=0;i<e.length;i++){let r=e[i];if(r.id===t)return r}}static resolve(e,t){return ir.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return al.test(e)}static parseMasterPlaylist(e,t){var i;let r,a={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:rU.test(e)},s=[];if(an.lastIndex=0,!e.startsWith("#EXTM3U"))return a.playlistParsingError=Error("no EXTM3U delimiter"),a;for(;null!=(r=an.exec(e));)if(r[1]){let e=new rV(r[1],a),n=rF(a,r[2]),o={attrs:e,bitrate:e.decimalInteger("BANDWIDTH")||e.decimalInteger("AVERAGE-BANDWIDTH"),name:e.NAME,url:ah.resolve(n,t)},l=e.decimalResolution("RESOLUTION");l&&(o.width=l.width,o.height=l.height),ap(e.CODECS,o);let d=e["SUPPLEMENTAL-CODECS"];d&&(o.supplemental={},ap(d,o.supplemental)),null!=(i=o.unknownCodecs)&&i.length||s.push(o),a.levels.push(o)}else if(r[3]){let e=r[3],i=r[4];switch(e){case"SESSION-DATA":{let e=new rV(i,a),t=e["DATA-ID"];t&&(null===a.sessionData&&(a.sessionData={}),a.sessionData[t]=e);break}case"SESSION-KEY":{let e=am(i,t,a);e.encrypted&&e.isSupported()?(null===a.sessionKeys&&(a.sessionKeys=[]),a.sessionKeys.push(e)):t8.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${i}"`);break}case"DEFINE":{let e=new rV(i,a);rB(a,e,t)}break;case"CONTENT-STEERING":{let e=new rV(i,a);a.contentSteering={uri:ah.resolve(e["SERVER-URI"],t),pathwayId:e["PATHWAY-ID"]||"."};break}case"START":a.startTimeOffset=af(i)}}let n=s.length>0&&s.length<a.levels.length;return a.levels=n?s:a.levels,0===a.levels.length&&(a.playlistParsingError=Error("no levels found in manifest")),a}static parseMasterPlaylistMedia(e,t,i){let r,a={},s=i.levels,n={AUDIO:s.map(e=>({id:e.attrs.AUDIO,audioCodec:e.audioCodec})),SUBTITLES:s.map(e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec})),"CLOSED-CAPTIONS":[]},o=0;for(ao.lastIndex=0;null!==(r=ao.exec(e));){let e=new rV(r[1],i),s=e.TYPE;if(s){let i=n[s],r=a[s]||[];a[s]=r;let l=e.LANGUAGE,d=e["ASSOC-LANGUAGE"],u=e.CHANNELS,h=e.CHARACTERISTICS,c=e["INSTREAM-ID"],m={attrs:e,bitrate:0,id:o++,groupId:e["GROUP-ID"]||"",name:e.NAME||l||"",type:s,default:e.bool("DEFAULT"),autoselect:e.bool("AUTOSELECT"),forced:e.bool("FORCED"),lang:l,url:e.URI?ah.resolve(e.URI,t):""};if(d&&(m.assocLang=d),u&&(m.channels=u),h&&(m.characteristics=h),c&&(m.instreamId=c),null!=i&&i.length){let e=ah.findGroup(i,m.groupId)||i[0];ag(m,e,"audioCodec"),ag(m,e,"textCodec")}r.push(m)}}return a}static parseLevelPlaylist(e,t,i,r,a,s){var n;let o,l,d,u,h={url:t},c=new rW(t),m=c.fragments,f=[],g=null,v=0,y=0,E=0,b=0,T=0,A=null,_=new ih(r,h),S=-1,k=!1,L=null;if(ad.lastIndex=0,c.m3u8=e,c.hasVariableRefs=rU.test(e),(null==(n=ad.exec(e))?void 0:n[0])!=="#EXTM3U")return c.playlistParsingError=Error("Missing format identifier #EXTM3U"),c;for(;null!==(o=ad.exec(e));){k&&(k=!1,(_=new ih(r,h)).playlistOffset=E,_.setStart(E),_.sn=v,_.cc=b,T&&(_.bitrate=T),_.level=i,g&&(_.initSegment=g,g.rawProgramDateTime&&(_.rawProgramDateTime=g.rawProgramDateTime,g.rawProgramDateTime=null),L&&(_.setByteRange(L),L=null)));
1let e=o[1];if(e){_.duration=parseFloat(e);let t=(" "+o[2]).slice(1);_.title=t||null,_.tagList.push(t?["INF",e,t]:["INF",e])}else if(o[3]){if(tU(_.duration)){_.playlistOffset=E,_.setStart(E),d&&aE(_,d,c),_.sn=v,_.level=i,_.cc=b,m.push(_);let e=(" "+o[3]).slice(1);_.relurl=rF(c,e),av(_,A,f),A=_,E+=_.duration,v++,y=0,k=!0}}else{if(!(o=o[0].match(au))){t8.warn("No matches on slow regex match for level playlist!");continue}for(l=1;l<o.length&&void 0===o[l];l++);let e=(" "+o[l]).slice(1),a=(" "+o[l+1]).slice(1),n=o[l+2]?(" "+o[l+2]).slice(1):null;switch(e){case"BYTERANGE":A?_.setByteRange(a,A):_.setByteRange(a);break;case"PROGRAM-DATE-TIME":_.rawProgramDateTime=a,_.tagList.push(["PROGRAM-DATE-TIME",a]),-1===S&&(S=m.length);break;case"PLAYLIST-TYPE":c.type&&ab(c,e,o),c.type=a.toUpperCase();break;case"MEDIA-SEQUENCE":0!==c.startSN?ab(c,e,o):m.length>0&&aT(c,e,o),v=c.startSN=parseInt(a);break;case"SKIP":{c.skippedSegments&&ab(c,e,o);let t=new rV(a,c),i=t.decimalInteger("SKIPPED-SEGMENTS");if(tU(i)){c.skippedSegments+=i;for(let e=i;e--;)m.push(null);v+=i}let r=t.enumeratedString("RECENTLY-REMOVED-DATERANGES");r&&(c.recentlyRemovedDateranges=(c.recentlyRemovedDateranges||[]).concat(r.split(" ")));break}case"TARGETDURATION":0!==c.targetduration&&ab(c,e,o),c.targetduration=Math.max(parseInt(a),1);break;case"VERSION":null!==c.version&&ab(c,e,o),c.version=parseInt(a);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":c.live||ab(c,e,o),c.live=!1;break;case"#":(a||n)&&_.tagList.push(n?[a,n]:[a]);break;case"DISCONTINUITY":b++,_.tagList.push(["DIS"]);break;case"GAP":_.gap=!0,_.tagList.push([e]);break;case"BITRATE":_.tagList.push([e,a]),tU(T=1e3*parseInt(a))?_.bitrate=T:T=0;break;case"DATERANGE":{let e=new rV(a,c),t=new rG(e,c.dateRanges[e.ID],c.dateRangeTagCount);c.dateRangeTagCount++,t.isValid||c.skippedSegments?c.dateRanges[t.id]=t:t8.warn(`Ignoring invalid DATERANGE tag: "${a}"`),_.tagList.push(["EXT-X-DATERANGE",a]);break}case"DEFINE":{let e=new rV(a,c);"IMPORT"in e?function(e,t,i){let r=t.IMPORT;if(i&&r in i){let t=e.variableList;t||(e.variableList=t={}),t[r]=i[r]}else e.playlistParsingError||(e.playlistParsingError=Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${r}"`))}(c,e,s):rB(c,e,t)}break;case"DISCONTINUITY-SEQUENCE":0!==c.startCC?ab(c,e,o):m.length>0&&aT(c,e,o),c.startCC=b=parseInt(a);break;case"KEY":{let e=am(a,t,c);if(e.isSupported()){if("NONE"===e.method){d=void 0;break}d||(d={});let t=d[e.keyFormat];null!=t&&t.matches(e)||(t&&(d=tZ({},d)),d[e.keyFormat]=e)}else t8.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${a}"`);break}case"START":c.startTimeOffset=af(a);break;case"MAP":{let e=new rV(a,c);if(_.duration){let t=new ih(r,h);ay(t,e,i,d),g=t,_.initSegment=g,g.rawProgramDateTime&&!_.rawProgramDateTime&&(_.rawProgramDateTime=g.rawProgramDateTime)}else{let t=_.byteRangeEndOffset;if(t){let e=_.byteRangeStartOffset;L=`${t-e}@${e}`}else L=null;ay(_,e,i,d),g=_,k=!0}g.cc=b;break}case"SERVER-CONTROL":u&&ab(c,e,o),c.canBlockReload=(u=new rV(a)).bool("CAN-BLOCK-RELOAD"),c.canSkipUntil=u.optionalFloat("CAN-SKIP-UNTIL",0),c.canSkipDateRanges=c.canSkipUntil>0&&u.bool("CAN-SKIP-DATERANGES"),c.partHoldBack=u.optionalFloat("PART-HOLD-BACK",0),c.holdBack=u.optionalFloat("HOLD-BACK",0);break;case"PART-INF":c.partTarget&&ab(c,e,o),c.partTarget=new rV(a).decimalFloatingPoint("PART-TARGET");break;case"PART":{let e=c.partList;e||(e=c.partList=[]);let t=y>0?e[e.length-1]:void 0,i=y++,r=new ic(new rV(a,c),_,h,i,t);e.push(r),_.duration+=r.duration;break}case"PRELOAD-HINT":{let e=new rV(a,c);c.preloadHint=e;break}case"RENDITION-REPORT":{let e=new rV(a,c);c.renditionReports=c.renditionReports||[],c.renditionReports.push(e);break}default:t8.warn(`line parsed but not handled: ${o}`)}}}A&&!A.relurl?(m.pop(),E-=A.duration,c.partList&&(c.fragmentHint=A)):c.partList&&(av(_,A,f),_.cc=b,c.fragmentHint=_,d&&aE(_,d,c)),c.targetduration||(c.playlistParsingError=Error("Missing Target Duration"));let w=m.length,R=m[0],I=m[w-1];if((E+=c.skippedSegments*c.targetduration)>0&&w&&I){c.averagetargetduration=E/w;let e=I.sn;c.endSN="initSegment"!==e?e:0,c.live||(I.endList=!0),S>0&&(function(e,t){let i=e[t];for(let r=t;r--;){let t=e[r];if(!t)return;t.programDateTime=i.programDateTime-1e3*t.duration,i=t}}(m,S),R&&f.unshift(R))}return c.fragmentHint&&(E+=c.fragmentHint.duration),c.totalduration=E,f.length&&c.dateRangeTagCount&&R&&ac(f,c),c.endCC=b,c}}function ac(e,t){let i=e.length;if(!i)if(!t.hasProgramDateTime)return;else{let r=t.fragments[t.fragments.length-1];e.push(r),i++}let r=e[i-1],a=t.live?1/0:t.totalduration,s=Object.keys(t.dateRanges);for(let o=s.length;o--;){let l=t.dateRanges[s[o]],d=l.startDate.getTime();l.tagAnchor=r.ref;for(let r=i;r--;){var n;if((null==(n=e[r])?void 0:n.sn)<t.startSN)break;let i=function(e,t,i,r,a){let s=i[r];if(s){let o=s.programDateTime;if(t>=o||0===r){var n;if(t<=o+1e3*(((null==(n=i[r+1])?void 0:n.start)||a)-s.start)){let a=i[r].sn-e.startSN;if(a<0)return -1;let s=e.fragments;if(s.length>i.length){let n=(i[r+1]||s[s.length-1]).sn-e.startSN;for(let e=n;e>a;e--){let i=s[e].programDateTime;if(t>=i&&t<i+1e3*s[e].duration)return e}}return a}}}return -1}(t,d,e,r,a);if(-1!==i){l.tagAnchor=t.fragments[i].ref;break}}}}function am(e,t,i){var r,a;let s=new rV(e,i),n=null!=(r=s.METHOD)?r:"",o=s.URI,l=s.hexadecimalInteger("IV"),d=s.KEYFORMATVERSIONS,u=null!=(a=s.KEYFORMAT)?a:"identity";return o&&s.IV&&!l&&t8.error(`Invalid IV: ${s.IV}`),new aa(n,o?ah.resolve(o,t):"",u,(d||"1").split("/").map(Number).filter(Number.isFinite),l,s.KEYID)}function af(e){let t=new rV(e).decimalFloatingPoint("TIME-OFFSET");return tU(t)?t:null}function ap(e,t){let i=(e||"").split(/[ ,]+/).filter(e=>e);
1["video","audio","text"].forEach(e=>{let r=i.filter(t=>iO(t,e));r.length&&(t[`${e}Codec`]=r.map(e=>e.split("/")[0]).join(","),i=i.filter(e=>-1===r.indexOf(e)))}),t.unknownCodecs=i}function ag(e,t,i){let r=t[i];r&&(e[i]=r)}function av(e,t,i){e.rawProgramDateTime?i.push(e):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime)}function ay(e,t,i,r){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=i,e.sn="initSegment",r&&(e.levelkeys=r),e.initSegment=null}function aE(e,t,i){e.levelkeys=t;let{encryptedFragments:r}=i;(!r.length||r[r.length-1].levelkeys!==t)&&Object.keys(t).some(e=>t[e].isCommonEncryption)&&r.push(e)}function ab(e,t,i){e.playlistParsingError=Error(`#EXT-X-${t} must not appear more than once (${i[0]})`)}function aT(e,t,i){e.playlistParsingError=Error(`#EXT-X-${t} must appear before the first Media Segment (${i[0]})`)}function aA(e,t){let i=t.startPTS;if(tU(i)){let r,a=0;t.sn>e.sn?(a=i-e.start,r=e):(a=e.start-i,r=t),r.duration!==a&&r.setDuration(a)}else t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.setStart(e.start+(e.minEndPTS-e.start)):t.setStart(e.start+e.duration):t.setStart(Math.max(e.start-t.duration,0))}function a_(e,t,i,r,a,s,n){let o;r-i<=0&&(n.warn("Fragment should have a positive duration",t),r=i+t.duration,s=a+t.duration);let l=i,d=r,u=t.startPTS,h=t.endPTS;if(tU(u)){let o=Math.abs(u-i);e&&o>e.totalduration?n.warn(`media timestamps and playlist times differ by ${o}s for level ${t.level} ${e.url}`):tU(t.deltaPTS)?t.deltaPTS=Math.max(o,t.deltaPTS):t.deltaPTS=o,l=Math.max(i,u),i=Math.min(i,u),a=void 0!==t.startDTS?Math.min(a,t.startDTS):a,d=Math.min(r,h),r=Math.max(r,h),s=void 0!==t.endDTS?Math.max(s,t.endDTS):s}let c=i-t.start;0!==t.start&&t.setStart(i),t.setDuration(r-t.start),t.startPTS=i,t.maxStartPTS=l,t.startDTS=a,t.endPTS=r,t.minEndPTS=d,t.endDTS=s;let m=t.sn;if(!e||m<e.startSN||m>e.endSN)return 0;let f=m-e.startSN,g=e.fragments;for(g[f]=t,o=f;o>0;o--)aA(g[o],g[o-1]);for(o=f;o<g.length-1;o++)aA(g[o],g[o+1]);return e.fragmentHint&&aA(g[g.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,c}function aS(e,t,i,r,a){return Error(`${e} ${a.url} 2Playlist starting @${t.startSN} 3${t.m3u8} 4 5Playlist starting @${i.startSN} 6${i.m3u8}`)}function ak(e,t,i=!0){let r=t.startSN+t.skippedSegments-e.startSN,a=e.fragments,s=r>=0,n=0;if(s&&r<a.length)n=a[r].start;else if(s&&t.startSN===e.endSN+1)n=e.fragmentEnd;else if(s&&i)n=e.fragmentStart+r*t.levelTargetDuration;else{if(t.skippedSegments||0!==t.fragmentStart)return;n=e.fragmentStart}aL(t,n)}function aL(e,t){if(t){let i=e.fragments;for(let r=e.skippedSegments;r<i.length;r++)i[r].addStart(t);e.fragmentHint&&e.fragmentHint.addStart(t)}}function aw(e,t=1/0){let i=1e3*e.targetduration;if(e.updated){let r=e.fragments;if(r.length&&4*i>t){let e=1e3*r[r.length-1].duration;e<i&&(i=e)}}else i/=2;return Math.round(i)}function aR(e,t,i){if(!e)return null;let r=e.fragments[t-e.startSN];return r||(r=e.fragmentHint)&&r.sn===t?r:t<e.startSN&&i&&i.sn===t?i:null}function aI(e,t,i){return e?aC(e.partList,t,i):null}function aC(e,t,i){if(e)for(let r=e.length;r--;){let a=e[r];if(a.index===i&&a.fragment.sn===t)return a}return null}function aD(e){e.forEach((e,t)=>{var i;null==(i=e.details)||i.fragments.forEach(e=>{e.level=t,e.initSegment&&(e.initSegment.level=t)})})}function ax(e){return e.replace(/\?[^?]*$/,"")}function aP(e,t){for(let r=0,a=e.length;r<a;r++){var i;if((null==(i=e[r])?void 0:i.cc)===t)return e[r]}return null}function aM(e,t){let i=e.start+t;e.startPTS=i,e.setStart(i),e.endPTS=i+e.duration}function aO(e,t){let i=t.fragments;for(let t=0,r=i.length;t<r;t++)aM(i[t],e);t.fragmentHint&&aM(t.fragmentHint,e),t.alignedSliding=!0}function aN(e,t){if((!t||!(e.startCC<t.endCC)||!(e.endCC>t.startCC))&&1)return;let i=Math.min(t.endCC,e.endCC),r=aP(t.fragments,i),a=aP(e.fragments,i);r&&a&&(t8.log(`Aligning playlist at start of dicontinuity sequence ${i}`),aO(r.start-a.start,e))}function aU(e,t){let i,r;if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;let a=e.fragments,s=t.fragments;if(!a.length||!s.length)return;let n=Math.min(t.endCC,e.endCC);t.startCC<n&&e.startCC<n&&(i=aP(s,n),r=aP(a,n)),i&&r||(r=aP(a,(i=s[Math.floor(s.length/2)]).cc)||a[Math.floor(a.length/2)]);let o=i.programDateTime,l=r.programDateTime;o&&l&&aO((l-o)/1e3-(r.start-i.start),e)}function aF(e,t,i){aB(e,t,i),e.addEventListener(t,i)}function aB(e,t,i){e.removeEventListener(t,i)}let a$=function(e){let t="",i=e.length;for(let r=0;r<i;r++)t+=`[${e.start(r).toFixed(3)}-${e.end(r).toFixed(3)}]`;return t},aH="STOPPED",aV="IDLE",aG="KEY_LOADING",aW="FRAG_LOADING",aK="FRAG_LOADING_WAITING_RETRY",aq="WAITING_TRACK",aj="PARSING",aY="PARSED",az="ENDED",aX="ERROR",aQ="WAITING_INIT_PTS",aZ="WAITING_LEVEL";class aJ extends rx{constructor(e,t,i,r,a){super(r,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=aH,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=()=>{let{config:e,fragCurrent:t,media:i,mediaBuffer:r,state:a}=this,s=i?i.currentTime:0,n=rN.bufferInfo(r||i,s,e.maxBufferHole),o=!n.len;if(this.log(`Media seeking to ${tU(s)?s.toFixed(3):s}, state: ${a}, ${o?"out of":"in"} buffer`),this.state===az)this.resetLoadingState();else if(t){let i=e.maxFragLookUpTolerance,r=t.start-i,a=t.start+t.duration+i;if(o||a<n.start||r>n.end){let e=s>a;(s<r||e)&&(e&&t.loader&&(this.log(`Cancelling fragment load for seek (sn: ${t.sn})`),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(i&&(this.fragmentTracker.removeFragmentsInRange(s,1/0,this.playlistType,!0),s>this.lastCurrentTime&&(this.lastCurrentTime=s),!this.loadingParts)){let e=Math.max(n.end,s),t=this.shouldLoadParts(this.getLevelDetails(),e);t&&(this.log(`LL-Part loading ON after seeking to ${s.toFixed(2)} with buffer @${e.toFixed(2)}`),this.loadingParts=t)}!this.hls.hasEnoughToStart&&(this.log(`Setting ${o?"startPosition":"nextLoadPosition"} to ${s} for seek without enough to start`),this.nextLoadPosition=s,o&&(this.startPosition=s)),o&&this.state===aV&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=a,this.hls=e,this.fragmentLoader=new rR(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new rw(e.config)}registerListeners(){let{hls:e}=this;
6e.on(tV.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tV.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(tV.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(tV.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tV.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(tV.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===aH)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);let e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=aH}get startPositionValue(){let{nextLoadPosition:e,startPosition:t}=this;return -1===t&&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;let i=e.end||0,r=this.config.timelineOffset||0;if(i<=r)return!1;let a=e.buffered;this.config.maxBufferHole&&a&&a.length>1&&(e=rN.bufferedInfo(a,e.start,0));let s=e.nextStart;if(s&&s>r&&s<t.edge||this.media.currentTime<e.start)return!1;let n=t.partList;if(null!=n&&n.length){let e=n[n.length-1];return rN.isBuffered(this.media,e.start+e.duration/2)}let o=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(o)}getLevelDetails(){if(this.levels&&null!==this.levelLastLoaded)return this.levelLastLoaded.details}get timelineOffset(){let e=this.config.timelineOffset;if(e){var t;return(null==(t=this.getLevelDetails())?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){let i=this.media=this.mediaBuffer=t.media;aF(i,"seeking",this.onMediaSeeking),aF(i,"ended",this.onMediaEnded);let r=this.config;this.levels&&r.autoStartLoad&&this.state===aH&&this.startLoad(r.startPosition)}onMediaDetaching(e,t){let i=!!t.transferMedia,r=this.media;if(null!==r){if(r.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),aB(r,"seeking",this.onMediaSeeking),aB(r,"ended",this.onMediaEnded),this.keyLoader&&!i&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,i){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=aH,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this.startFragRequested=!0,this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){let r=e=>{let t=e.frag;if(this.fragContextChanged(t)){this.warn(`${t.type} sn: ${t.sn}${e.part?" part: "+e.part.index:""} of ${this.fragInfo(t,!1,e.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(t);return}t.stats.chunkCount++,this._handleFragmentLoadProgress(e)};this._doFragLoad(e,t,i,r).then(e=>{if(!e)return;let t=this.state,i=e.frag;if(this.fragContextChanged(i)){t!==aW&&(this.fragCurrent||t!==aj)||(this.fragmentTracker.removeFragment(i),this.state=aV);return}"payload"in e&&(this.log(`Loaded ${i.type} sn: ${i.sn} of ${this.playlistLabel()} ${i.level}`),this.hls.trigger(tV.FRAG_LOADED,e)),this._handleFragmentLoadComplete(e)}).catch(t=>{this.state!==aH&&this.state!==aX&&(this.warn(`Frag error: ${(null==t?void 0:t.message)||t}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;let{fragmentTracker:i}=this;if(i.getState(e)===ry){let t=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,t),a=Math.max(e.duration,r?r.len:this.config.maxBufferLength),s=this.backtrackFragment;(1==(s?e.sn-s.sn:0)||this.reduceMaxBufferLength(a,e.duration))&&i.removeFragment(e)}else(null==(t=this.mediaBuffer)?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===rE&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){let t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){let t=e.details;return(null==t?void 0:t.live)&&"EVENT"!==t.type&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,i=null){e-t&&this.hls.trigger(tV.BUFFER_FLUSHING,{startOffset:e,endOffset:t,type:i})}_loadInitSegment(e,t){this._doFragLoad(e,t).then(e=>{let t=null==e?void 0:e.frag;if(!t||this.fragContextChanged(t)||!this.levels)throw Error("init load aborted");return e}).then(e=>{let{hls:t}=this,{frag:i,payload:r}=e,a=i.decryptdata;if(r&&r.byteLength>0&&null!=a&&a.key&&a.iv&&rj(a.method)){let s=self.performance.now();
6return this.decrypter.decrypt(new Uint8Array(r),a.key.buffer,a.iv.buffer,rY(a.method)).catch(e=>{throw t.trigger(tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:i}),e}).then(r=>{let a=self.performance.now();return t.trigger(tV.FRAG_DECRYPTED,{frag:i,payload:r,stats:{tstart:s,tdecrypt:a}}),e.payload=r,this.completeInitSegmentLoad(e)})}return this.completeInitSegmentLoad(e)}).catch(t=>{this.state!==aH&&this.state!==aX&&(this.warn(t),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){let{levels:t}=this;if(!t)throw Error("init load aborted, missing levels");let i=e.frag.stats;this.state!==aH&&(this.state=aV),e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var i,r;let a=e.tracks;if(a&&!t.encrypted&&(null!=(i=a.audio)&&i.encrypted||null!=(r=a.video)&&r.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){let e=this.media,i=Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${e?"attached mediaKeys: "+e.mediaKeys:"detached"})`);return this.warn(i.message),!!e&&!e.mediaKeys&&(this.hls.trigger(tV.ERROR,{type:t$.KEY_SYSTEM_ERROR,details:tH.KEY_SYSTEM_NO_KEYS,fatal:!1,error:i,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){let{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){let i=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:${i?a$(rN.getBuffered(i)):"(detached)"})`),iu(e)){var r;if(e.type!==tz){let t=e.elementaryStreams;if(!Object.keys(t).some(e=>!!t[e])){this.state=aV;return}}let t=null==(r=this.levels)?void 0:r[e.level];null!=t&&t.fragmentError&&(this.log(`Resetting level fragment error count of ${t.fragmentError} on frag buffered`),t.fragmentError=0)}this.state=aV}_handleFragmentLoadComplete(e){let{transmuxer:t}=this;if(!t)return;let{frag:i,part:r,partsLoaded:a}=e,s=!a||0===a.length||a.some(e=>!e),n=new rP(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!s);t.flush(n)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,r){var a,s;let n;this.fragCurrent=e;let o=t.details;if(!this.levels||!o)throw Error(`frag load aborted, missing level${o?"":" detail"}s`);let l=null;if(e.encrypted&&!(null!=(a=e.decryptdata)&&a.key)){if(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=aG,this.fragCurrent=e,l=this.keyLoader.load(e).then(e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(tV.KEY_LOADED,e),this.state===aG&&(this.state=aV),e}),this.hls.trigger(tV.KEY_LOADING,{frag:e}),null===this.fragCurrent)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else!e.encrypted&&(l=this.keyLoader.loadClear(e,o.encryptedFragments,this.startFragRequested))&&this.log("[eme] blocking frag load until media-keys acquired");let d=this.fragPrevious;if(iu(e)&&(!d||e.sn!==d.sn)){let i=this.shouldLoadParts(t.details,e.end);i!==this.loadingParts&&(this.log(`LL-Part loading ${i?"ON":"OFF"} loading sn ${null==d?void 0:d.sn}->${e.sn}`),this.loadingParts=i)}if(i=Math.max(e.start,i||0),this.loadingParts&&iu(e)){let a=o.partList;if(a&&r){i>o.fragmentEnd&&o.fragmentHint&&(e=o.fragmentHint);let s=this.getNextPart(a,e,i);if(s>-1){let n,d=a[s];return(e=this.fragCurrent=d.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${d.index} (${s}/${a.length-1}) of ${this.fragInfo(e,!1,d)}) cc: ${e.cc} [${o.startSN}-${o.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=d.start+d.duration,this.state=aW,n=l?l.then(i=>!i||this.fragContextChanged(i.frag)?null:this.doFragPartsLoad(e,d,t,r)).catch(e=>this.handleFragLoadError(e)):this.doFragPartsLoad(e,d,t,r).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(tV.FRAG_LOADING,{frag:e,part:d,targetBufferTime:i}),null===this.fragCurrent)?Promise.reject(Error("frag load aborted, context changed in FRAG_LOADING parts")):n}if(!e.url||this.loadedEndOfParts(a,i))return Promise.resolve(null)}}if(iu(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${i.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${null==(s=o.partList)?void 0:s.filter(e=>e.loaded).map(e=>`[${e.start}-${e.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} ${"["+o.startSN+"-"+o.endSN+"]"}, target: ${parseFloat(i.toFixed(3))}`),tU(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=aW;let u=this.config.progressive&&e.type!==tz;return(n=u&&l?l.then(t=>!t||this.fragContextChanged(t.frag)?null:this.fragmentLoader.load(e,r)).catch(e=>this.handleFragLoadError(e)):Promise.all([this.fragmentLoader.load(e,u?r:void 0),l]).then(([e])=>(!u&&r&&r(e),e)).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(tV.FRAG_LOADING,{frag:e,targetBufferTime:i}),null===this.fragCurrent)?Promise.reject(Error("frag load aborted, context changed in FRAG_LOADING")):n}doFragPartsLoad(e,t,i,r){return new Promise((a,s)=>{var n;let o=[],l=null==(n=i.details)?void 0:n.partList,d=t=>{this.fragmentLoader.loadPart(e,t,r).then(r=>{o[t.index]=r;let s=r.part;this.hls.trigger(tV.FRAG_LOADED,r);let n=aI(i.details,e.sn,t.index+1)||aC(l,e.sn,t.index+1);if(!n)return a({frag:e,part:s,partsLoaded:o});d(n)}).catch(s)};d(t)})}handleFragLoadError(e){if("data"in e){let t=e.data;t.frag&&t.details===tH.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===t$.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(tV.ERROR,t)}else this.hls.trigger(tV.ERROR,{type:t$.OTHER_ERROR,details:tH.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){let t=this.getCurrentContext(e);if(!t||this.state!==aj){this.fragCurrent||this.state===aH||this.state===aX||(this.state=aV);return}let{frag:i,part:r,level:a}=t,s=self.performance.now();i.stats.parsing.end=s,r&&(r.stats.parsing.end=s);let n=this.getLevelDetails(),o=n&&i.sn>n.endSN||this.shouldLoadParts(n,i.end);o!==this.loadingParts&&(this.log(`LL-Part loading ${o?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=o),this.updateLevelTiming(i,r,a,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var i,r;let a=e.partList[0];if(a.fragment.type===tz)return!1;if(t>=a.end+((null==(i=e.fragmentHint)?void 0:i.duration)||0)&&(this.hls.hasEnoughToStart?(null==(r=this.media)?void 0:r.currentTime)||this.lastCurrentTime:this.getLoadPosition())>a.start-a.fragment.duration)return!0}}return!1}getCurrentContext(e){let{levels:t,fragCurrent:i}=this,{level:r,sn:a,part:s}=e;if(!(null!=t&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${a} of ${this.playlistLabel()} ${r}. The current chunk will not be buffered.`),null;let n=t[r],o=n.details,l=s>-1?aI(o,a,s):null,d=l?l.fragment:aR(o,a,i);return d?(i&&i!==d&&(d.stats=i.stats),{frag:d,part:l,level:n}):null}bufferFragmentData(e,t,i,r,a){if(this.state!==aj)return;let{data1:s,data2:n}=e,o=s;if(n&&(o=iI(s,n)),!o.length)return;let l=this.initPTS[t.cc],d=l?-l.baseTime/l.timescale:void 0,u={type:e.type,frag:t,part:i,chunkMeta:r,offset:d,parent:t.type,data:o};if(this.hls.trigger(tV.BUFFER_APPENDING,u),e.dropped&&e.independent&&!i){if(a)return;this.flushBufferGap(t)}}flushBufferGap(e){let t=this.media;if(!t)return;if(!rN.isBuffered(t,t.currentTime))return void this.flushMainBuffer(0,e.start);let i=t.currentTime,r=rN.bufferInfo(t,i,0),a=e.duration,s=Math.min(2*this.config.maxFragLookUpTolerance,.25*a),n=Math.max(Math.min(e.start-s,r.end-s),i+s);e.start-n>s&&this.flushMainBuffer(n,e.start)}getFwdBufferInfo(e,t){var i;let r=this.getLoadPosition();if(!tU(r))return null;let a=this.lastCurrentTime>r||null!=(i=this.media)&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,r,t,a)}getFwdBufferInfoAtPos(e,t,i,r){let a=rN.bufferInfo(e,t,r);if(0===a.len&&void 0!==a.nextStart){let s=this.fragmentTracker.getBufferedFrag(t,i);if(s&&(a.nextStart<=s.end||s.gap)){let i=Math.max(Math.min(a.nextStart,s.end)-t,r);return rN.bufferInfo(e,t,i)}}return a}
6getMaxBufferLength(e){let{config:t}=this;return Math.min(e?Math.max(8*t.maxBufferSize/e,t.maxBufferLength):t.maxBufferLength,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){let i=this.config,r=Math.max(Math.min(e-t,i.maxBufferLength),t),a=Math.max(e-3*t,i.maxMaxBufferLength/2,r);return a>=r&&(i.maxMaxBufferLength=a,this.warn(`Reduce max buffer length to ${a}s`),!0)}getAppendedFrag(e,t=tj){let i=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){let i=t.fragments,r=i.length;if(!r)return null;let{config:a}=this,s=i[0].start,n=a.lowLatencyMode&&!!t.partList,o=null;if(t.live){let i=a.initialLiveManifestSize;if(r<i)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${i})`),null;if(!t.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||e<s){var l;n&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),o=this.getInitialLiveFragment(t);let i=this.hls.startPosition,r=this.hls.liveSyncPosition,a=o?(-1!==i&&i>=s?i:r)||o.start:e;this.log(`Setting startPosition to ${a} to match start frag at live edge. mainStart: ${i} liveSyncPosition: ${r} frag.start: ${null==(l=o)?void 0:l.start}`),this.startPosition=this.nextLoadPosition=a}}else e<=s&&(o=i[0]);if(!o){let i=this.loadingParts?t.partEnd:t.fragmentEnd;o=this.getFragmentAtPosition(e,i,t)}let d=this.filterReplacedPrimary(o,t);if(!d&&o){let e=o.sn-t.startSN;d=this.filterReplacedPrimary(i[e+1]||null,t)}return this.mapToInitFragWhenRequired(d)}isLoopLoading(e,t){let i=this.fragmentTracker.getState(e);return("OK"===i||i===rE&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,r,a){let s=null;if(e.gap&&(s=this.getNextFragment(this.nextLoadPosition,t))&&!s.gap&&i.nextStart){let e=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,r,0);if(null!==e&&i.len+e.len>=a){let e=s.sn;return this.loopSn!==e&&(this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${e}`),this.loopSn=e),null}}return this.loopSn=void 0,s}get primaryPrefetch(){if(a0(this.config)){var e;if(null==(e=this.hls.interstitialsManager)||null==(e=e.playingItem)?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(a0(this.config)&&e.type!==tz){let i=this.hls.interstitialsManager,r=null==i?void 0:i.bufferingItem;if(r){let i=r.event;if(i){if(i.appendInPlace||Math.abs(e.start-r.start)>1||0===r.start)return null}else if(e.end<=r.start&&(null==t?void 0:t.live)===!1||e.start>r.end&&r.nextEvent&&(r.nextEvent.appendInPlace||e.start-r.end>1))return null}let a=null==i?void 0:i.playerQueue;if(a)for(let t=a.length;t--;){let i=a[t].interstitial;if(i.appendInPlace&&e.start>=i.startTime&&e.end<=i.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return null==e||!e.initSegment||e.initSegment.data||this.bitrateTest?e:e.initSegment}getNextPart(e,t,i){let r=-1,a=!1,s=!0;for(let n=0,o=e.length;n<o;n++){let o=e[n];if(s=s&&!o.independent,r>-1&&i<o.start)break;let l=o.loaded;l?r=-1:(a||(o.independent||s)&&o.fragment===t)&&(o.fragment!==t&&this.warn(`Need buffer at ${i} but next unloaded part starts at ${o.start}`),r=n),a=l}return r}loadedEndOfParts(e,t){let i;for(let r=e.length;r--&&(i=e[r]).loaded;)if(t>i.start)return!0;return!1}getInitialLiveFragment(e){let t=e.fragments,i=this.fragPrevious,r=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),r=function(e,t,i){if(null===t||!Array.isArray(e)||!e.length||!tU(t)||t<(e[0].programDateTime||0)||t>=(e[e.length-1].endProgramDateTime||0))return null;for(let r=0;r<e.length;++r){let a=e[r];if(function(e,t,i){let r=1e3*Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-r>e}(t,i,a))return a}return null}(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){let a=i.sn+1;if(a>=e.startSN&&a<=e.endSN){let s=t[a-e.startSN];i.cc===s.cc&&(r=s,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}!r&&(r=ro(e,i.cc,i.end))&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`)}}else{let t=this.hls.liveSyncPosition;null!==t&&(r=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,i){let r,{config:a}=this,{fragPrevious:s}=this,{fragments:n,endSN:o}=i,{fragmentHint:l}=i,{maxFragLookUpTolerance:d}=a,u=i.partList,h=!!(this.loadingParts&&null!=u&&u.length&&l);if(h&&!this.bitrateTest&&u[u.length-1].fragment.sn===l.sn&&(n=n.concat(l),o=l.sn),e<t){var c;let i=e<this.lastCurrentTime||e>t-d||null!=(c=this.media)&&c.paused||!this.startFragRequested?0:d;r=rs(s,n,e,i)}else r=n[n.length-1];if(r){let e=r.sn-i.startSN,t=this.fragmentTracker.getState(r);
6if(("OK"===t||t===rE&&r.gap)&&(s=r),s&&r.sn===s.sn&&(!h||u[0].fragment.sn>r.sn||!i.live)&&r.level===s.level){let t=n[e+1];r=r.sn<o&&"OK"!==this.fragmentTracker.getState(t)?t:null}}return r}alignPlaylists(e,t,i){let r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;let a=e.fragmentStart,s=!t,n=e.alignedSliding&&tU(a);if(s||!n&&!a){i&&(aN(e,i),e.alignedSliding||aU(e,i),e.alignedSliding||e.skippedSegments||ak(i,e,!1));let a=e.fragmentStart;return this.log(`Live playlist sliding: ${a.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${r}`),a}return a}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}setStartPosition(e,t){let i=this.startPosition;i<t&&(i=-1);let r=this.timelineOffset;if(-1===i){let a=null!==this.startTimeOffset,s=a?this.startTimeOffset:e.startTimeOffset;null!==s&&tU(s)?(i=t+s,s<0&&(i+=e.edge),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Setting startPosition to ${i} for start time offset ${s} found in ${a?"multivariant":"media"} playlist`),this.startPosition=i):e.live?(i=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${i}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=i=0),this.lastCurrentTime=i+r}this.nextLoadPosition=i+r}getLoadPosition(){var e;let{media:t}=this,i=0;return null!=(e=this.hls)&&e.hasEnoughToStart&&t?i=t.currentTime:this.nextLoadPosition>=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&iu(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===aK)||(this.state=aV)}onFragmentOrKeyLoadError(e,t){var i,r,a;if(t.chunkMeta&&!t.frag){let e=this.getCurrentContext(t.chunkMeta);e&&(t.frag=e.frag)}let s=t.frag;if(!s||s.type!==e||!this.levels)return;if(this.fragContextChanged(s))return void this.warn(`Frag load error must match current frag to retry ${s.url} > ${null==(r=this.fragCurrent)?void 0:r.url}`);let n=t.details===tH.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(s,!0);let o=t.errorAction;if(!o){this.state=aX;return}let{action:l,flags:d,retryCount:u=0,retryConfig:h}=o,c=!!h,m=c&&5===l,f=c&&!o.resolved&&1===d,g=null==(i=this.hls.latestLevelDetails)?void 0:i.live;if(!m&&f&&iu(s)&&!s.endList&&g&&!ru(t))this.resetFragmentErrors(e),this.treatAsGap(s),o.resolved=!0;else if((m||f)&&u<h.maxNumRetry){let i=rp(null==(a=t.response)?void 0:a.code),r=rc(h,u);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+r,this.state=aK,o.resolved=!0,i){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn(`Fragment ${s.sn} of ${e} ${s.level} errored with ${t.details}, retrying loading ${u+1}/${h.maxNumRetry} in ${r}ms`)}else if(h){if(this.resetFragmentErrors(e),!(u<h.maxNumRetry))return void this.warn(`${t.details} reached or exceeded max retry (${u})`);n||3===l||(o.resolved=!0)}else 2===l?this.state=aZ:this.state=aX;this.tickImmediate()}checkRetryDate(){let e=self.performance.now(),t=this.retryDate,i=t===1/0;(!t||e>=t||i&&!rp(0))&&(i&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=aV)}reduceLengthAndFlushBuffer(e){if(this.state===aj||this.state===aY){let t=e.frag,i=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,i),a=r&&r.len>.5;a&&this.reduceMaxBufferLength(r.len,(null==t?void 0:t.duration)||10);let s=!a;return s&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),s}return!1}resetFragmentErrors(e){e===tY&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==aH&&(this.state=aV)}afterBufferFlushed(e,t,i){if(!e)return;let r=rN.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===az&&this.resetLoadingState()}
6resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==aH&&(this.state=aV)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;let e=this.levelLastLoaded,t=e?e.details:null;null!=t&&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()} ${-1===e.level?"<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,i,r){let a=i.details;if(!a)return void this.warn("level.details undefined");if(!Object.keys(e.elementaryStreams).reduce((t,s)=>{let n=e.elementaryStreams[s];if(n){let o=n.endPTS-n.startPTS;if(o<=0)return this.warn(`Could not parse fragment ${e.sn} ${s} duration reliably (${o})`),t||!1;let l=r?0:a_(a,e,n.startPTS,n.endPTS,n.startDTS,n.endDTS,this);return this.hls.trigger(tV.LEVEL_PTS_UPDATED,{details:a,level:i,drift:l,type:s,frag:e,start:n.startPTS,end:n.endPTS}),!0}return t},!1)){var s;let t=(null==(s=this.transmuxer)?void 0:s.error)===null;if((0===i.fragmentError||t&&(i.fragmentError<2||e.endList))&&this.treatAsGap(e,i),t){let t=Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(t.message),this.hls.trigger(tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=aY,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(tV.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===tj?"level":"track"}fragInfo(e,t=!0,i){var r,a;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${(null!=(r=t&&!i?e.startPTS:(i||e).start)?r:NaN).toFixed(3)}-${(null!=(a=t&&!i?e.endPTS:(i||e).end)?a:NaN).toFixed(3)}]${i&&"main"===e.type?"INDEPENDENT="+(i.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;null==(e=this.transmuxer)||e.reset()}recoverWorkerError(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){let t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function a0(e){return!!e.interstitialsController&&!1!==e.enableInterstitialPlayback}class a1{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){let e,{chunks:t,dataLength:i}=this;return t.length?(e=1===t.length?t[0]:function(e,t){let i=new Uint8Array(t),r=0;for(let t=0;t<e.length;t++){let a=e[t];i.set(a,r),r+=a.length}return i}(t,i),this.reset(),e):new Uint8Array(0)}reset(){this.chunks.length=0,this.dataLength=0}}var a2={exports:{}},a3=(dd||(dd=1,!function(e){var t=Object.prototype.hasOwnProperty,i="~";function r(){}function a(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function s(e,t,r,s,n){if("function"!=typeof r)throw TypeError("The listener must be a function");var o=new a(r,s||e,n),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],o]:e._events[l].push(o):(e._events[l]=o,e._eventsCount++),e}function n(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function o(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(i=!1)),o.prototype.eventNames=function(){var e,r,a=[];if(0===this._eventsCount)return a;for(r in e=this._events)t.call(e,r)&&a.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(e)):a},o.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var a=0,s=r.length,n=Array(s);a<s;a++)n[a]=r[a].fn;return n},o.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},o.prototype.emit=function(e,t,r,a,s,n){var o=i?i+e:e;if(!this._events[o])return!1;var l,d,u=this._events[o],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,a),!0;case 5:return u.fn.call(u.context,t,r,a,s),!0;case 6:return u.fn.call(u.context,t,r,a,s,n),!0}for(d=1,l=Array(h-1);d<h;d++)l[d-1]=arguments[d];u.fn.apply(u.context,l)}else{var c,m=u.length;for(d=0;d<m;d++)switch(u[d].once&&this.removeListener(e,u[d].fn,void 0,!0),h){case 1:u[d].fn.call(u[d].context);break;case 2:u[d].fn.call(u[d].context,t);break;case 3:u[d].fn.call(u[d].context,t,r);break;case 4:u[d].fn.call(u[d].context,t,r,a);break;default:if(!l)for(c=1,l=Array(h-1);c<h;c++)l[c-1]=arguments[c];u[d].fn.apply(u[d].context,l)}}return!0},o.prototype.on=function(e,t,i){return s(this,e,t,i,!1)},o.prototype.once=function(e,t,i){return s(this,e,t,i,!0)},o.prototype.removeListener=function(e,t,r,a){var s=i?i+e:e;if(!this._events[s])return this;if(!t)return n(this,s),this;var o=this._events[s];if(o.fn)o.fn!==t||a&&!o.once||r&&o.context!==r||n(this,s);else{for(var l=0,d=[],u=o.length;l<u;l++)(o[l].fn!==t||a&&!o[l].once||r&&o[l].context!==r)&&d.push(o[l]);d.length?this._events[s]=1===d.length?d[0]:d:n(this,s)}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&n(this,t)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=i,o.EventEmitter=o,e.exports=o}(a2)),(da=a2.exports)&&da.__esModule&&Object.prototype.hasOwnProperty.call(da,"default"))?da.default:da;let a4="1.6.15",a5={};function a8(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128||!1}function a9(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128||!1}function a6(e,t){return(127&e[t])<<21|(127&e[t+1])<<14|(127&e[t+2])<<7|127&e[t+3]}function a7(e,t){let i=t,r=0;for(;a9(e,t);)r+=10,r+=a6(e,t+6),a8(e,t+10)&&(r+=10),t+=r;if(r>0)return e.subarray(i,i+r)}function se(e,t){return 255===e[t]&&(246&e[t+1])==240}function st(e,t){return 1&e[t+1]?7:9}function si(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function sr(e,t){return t+1<e.length&&se(e,t)}function sa(e,t,i,r,a){if(!e.samplerate){let s=function(e,t,i,r){let a=t[i+2],s=a>>2&15;if(s>12){let t=Error(`invalid ADTS sampling index:${s}`);e.emit(tV.ERROR,tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message});return}let n=(a>>6&3)+1,o=t[i+3]>>6&3|(1&a)<<2,l="mp4a.40."+n,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][s],u=s;(5===n||29===n)&&(u-=3);let h=[n<<3|(14&u)>>1,(1&u)<<7|o<<3];return t8.log(`manifest codec:${r}, parsed codec:${l}, channels:${o}, rate:${d} (ADTS object type:${n} sampling index:${s})`),{config:h,samplerate:d,channelCount:o,codec:l,parsedCodec:l,manifestCodec:r}}(t,i,r,a);s&&tZ(e,s)}}function ss(e,t,i,r,a){let s,n=r+a*(9216e4/e.samplerate),o=function(e,t){let i=st(e,t);if(t+i<=e.length){let r=si(e,t)-i;if(r>0)return{headerLength:i,frameLength:r}}}(t,i);if(o){let{frameLength:r,headerLength:a}=o,l=a+r,d=Math.max(0,i+l-t.length);d?(s=new Uint8Array(l-a)).set(t.subarray(i+a,t.length),0):s=t.subarray(i+a,i+l);let u={unit:s,pts:n};return d||e.samples.push(u),{sample:u,length:l,missing:d}}let l=t.length-i;return(s=new Uint8Array(l)).set(t.subarray(i,t.length),0),{sample:{unit:s,pts:n},length:l,missing:-1}}function sn(e,t=0,i=1/0){var r,a,s,n,o,l;let d,u,h,c,m,f;return r=e,a=t,s=i,n=Uint8Array,d=(o=r)instanceof ArrayBuffer?o:o.buffer,u=1,"BYTES_PER_ELEMENT"in n&&(u=n.BYTES_PER_ELEMENT),c=((h=(l=r)&&l.buffer instanceof ArrayBuffer&&void 0!==l.byteLength&&void 0!==l.byteOffset?r.byteOffset:0)+r.byteLength)/u,f=Math.floor(Math.min((m=Math.floor(Math.max(0,Math.min((h+a)/u,c))))+Math.max(s,0),c)),new n(d,m,f-m)}function so(e){let t=0,i=[];for(;a9(e,t);){let r=a6(e,t+6);e[t+5]>>6&1&&(t+=10);let a=(t+=10)+r;for(;t+10<a;){let r=function(e){let t=String.fromCharCode(e[0],e[1],e[2],e[3]),i=a6(e,4);return{type:t,size:i,data:e.subarray(10,10+i)}}(e.subarray(t)),a=function(e){if("PRIV"===e.type){if(e.size<2)return;let t=t7(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:i.buffer}}if("W"===e.type[0]){if("WXXX"===e.type){if(e.size<2)return;let t=1,i=t7(e.data.subarray(t),!0);t+=i.length+1;let r=t7(e.data.subarray(t));return{key:e.type,info:i,data:r}}let t=t7(e.data);return{key:e.type,info:"",data:t}}if("APIC"===e.type)return function(e){let t,i={key:e.type,description:"",data:"",mimeType:null,pictureType:null};if(e.size<2)return;if(3!==e.data[0])return void console.log("Ignore frame with unrecognized character encoding");let r=e.data.subarray(1).indexOf(0);if(-1===r)return;let a=t7(sn(e.data,1,r)),s=e.data[2+r],n=e.data.subarray(3+r).indexOf(0);if(-1===n)return;let o=t7(sn(e.data,3+r,n));if("-->"===a)t=t7(sn(e.data,4+r+n));else{var l;t=(l=e.data.subarray(4+r+n))instanceof ArrayBuffer?l:0==l.byteOffset&&l.byteLength==l.buffer.byteLength?l.buffer:new Uint8Array(l).buffer}return i.mimeType=a,i.pictureType=s,i.description=o,i.data=t,i}(e);if(e.size<2)return;if("TXXX"===e.type){let t=1,i=t7(e.data.subarray(t),!0);t+=i.length+1;let r=t7(e.data.subarray(t));return{key:e.type,info:i,data:r}}let t=t7(e.data.subarray(1));return{key:e.type,info:"",data:t}}(r);a&&i.push(a),t+=r.size+10}a8(e,t)&&(t+=10)}return i}function sl(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info}function sd(e){let t=so(e);for(let e=0;e<t.length;e++){let i=t[e];if(sl(i))return function(e){if(8===e.data.byteLength){let t=new Uint8Array(e.data),i=1&t[3],r=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return r/=45,i&&(r+=47721858.84),Math.round(r)}}(i)}}let su=((ds={}).audioId3="org.id3",ds.dateRange="com.apple.quicktime.HLS",ds.emsg="https://aomedia.org/emsg/ID3",ds.misbklv="urn:misb:KLV:bin:1910.1",ds);
6function sh(e="",t=9e4){return{type:e,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}class sc{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){let i;this.cachedData&&(e=iI(this.cachedData,e),this.cachedData=null);let r=a7(e,0),a=r?r.length:0,s=this._audioTrack,n=this._id3Track,o=r?sd(r):void 0,l=e.length;for((null===this.basePTS||0===this.frameIndex&&tU(o))&&(this.basePTS=sm(o,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),r&&r.length>0&&n.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:su.audioId3,duration:1/0});a<l;){if(this.canParse(e,a)){let t=this.appendFrame(s,e,a);t?(this.frameIndex++,this.lastPTS=t.sample.pts,a+=t.length,i=a):a=l}else{var d,u;a9(d=e,u=a)&&a6(d,u+6)+10<=d.length-u?(r=a7(e,a),n.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:su.audioId3,duration:1/0}),a+=r.length,i=a):a++}if(a===l&&i!==l){let t=e.slice(i);this.cachedData?this.cachedData=iI(this.cachedData,t):this.cachedData=t}}return{audioTrack:s,videoTrack:sh(),id3Track:n,textTrack:sh()}}demuxSampleAes(e,t,i){return Promise.reject(Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){let t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:sh(),id3Track:this._id3Track,textTrack:sh()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}let sm=(e,t,i)=>tU(e)?90*e:9e4*t+(i?9e4*i.baseTime/i.timescale:0),sf=null,sp=[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],sg=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],sv=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],sy=[0,1,1,4];function sE(e,t,i,r,a){if(i+24>t.length)return;let s=sb(t,i);if(s&&i+s.frameLength<=t.length){let n=r+a*(9e4*s.samplesPerFrame/s.sampleRate),o={unit:t.subarray(i,i+s.frameLength),pts:n,dts:n};return e.config=[],e.channelCount=s.channelCount,e.samplerate=s.sampleRate,e.samples.push(o),{sample:o,length:s.frameLength,missing:0}}}function sb(e,t){let i=e[t+1]>>3&3,r=e[t+1]>>1&3,a=e[t+2]>>4&15,s=e[t+2]>>2&3;if(1!==i&&0!==a&&15!==a&&3!==s){let n=e[t+2]>>1&1,o=e[t+3]>>6,l=1e3*sp[14*(3===i?3-r:3===r?3:4)+a-1],d=sg[3*(3===i?0:2===i?1:2)+s],u=sv[i][r],h=sy[r],c=Math.floor(u*l/d+n)*h;if(null===sf){let e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);sf=e?parseInt(e[1]):0}return sf&&sf<=87&&2===r&&l>=224e3&&0===o&&(e[t+3]=128|e[t+3]),{sampleRate:d,channelCount:3===o?1:2,frameLength:c,samplesPerFrame:8*u*h}}}function sT(e,t){return 255===e[t]&&(224&e[t+1])==224&&(6&e[t+1])!=0}function sA(e,t){return t+1<e.length&&sT(e,t)}function s_(e,t){if(t+1<e.length&&sT(e,t)){let i=sb(e,t),r=4;null!=i&&i.frameLength&&(r=i.frameLength);let a=t+r;return a===e.length||sA(e,a)}return!1}let sS=(e,t)=>{let i=0,r=5;t+=5;let a=new Uint32Array(1),s=new Uint32Array(1),n=new Uint8Array(1);for(;r>0;){n[0]=e[t];let o=Math.min(r,8),l=8-o;s[0]=0xff000000>>>24+l<<l,a[0]=(n[0]&s[0])>>l,i=i?i<<o|a[0]:a[0],t+=1,r-=o}return i};function sk(e,t,i,r,a){if(i+8>t.length||11!==t[i]||119!==t[i+1])return -1;let s=t[i+4]>>6;if(s>=3)return -1;let n=[48e3,44100,32e3][s],o=63&t[i+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*o+s];if(i+l>t.length)return -1;let d=t[i+6]>>5,u=0;2===d?u+=2:(1&d&&1!==d&&(u+=2),4&d&&(u+=2));let h=(t[i+6]<<8|t[i+7])>>12-u&1,c=[2,1,2,3,3,4,4,5][d]+h,m=t[i+5]>>3,f=7&t[i+5],g=new Uint8Array([s<<6|m<<1|f>>2,(3&f)<<6|d<<3|h<<2|o>>4,o<<4&224]),v=t.subarray(i,i+l);return e.config=g,e.channelCount=c,e.samplerate=n,e.samples.push({unit:v,pts:r+1536/n*9e4*a}),l}let sL=/\/emsg[-/]ID3/i;function sw(e,t){return tU(e.presentationTime)?e.presentationTime/e.timeScale:t+e.presentationTimeDelta/e.timeScale}class sR{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new rw(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,0)}decryptAacSample(e,t,i){let r=e[t].unit;if(r.length<=16)return;let a=r.subarray(16,r.length-r.length%16),s=a.buffer.slice(a.byteOffset,a.byteOffset+a.length);this.decryptBuffer(s).then(a=>{let s=new Uint8Array(a);r.set(s,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}).catch(i)}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){let t=new Int8Array(16*Math.floor((e.length-48)/160)+16),i=0;for(let r=32;r<e.length-16;r+=160,i+=16)t.set(e.subarray(r,r+16),i);return t}getAvcDecryptedUnit(e,t){let i=new Uint8Array(t),r=0;for(let t=32;t<e.length-16;t+=160,r+=16)e.set(i.subarray(r,r+16),t);return e}decryptAvcSample(e,t,i,r,a){let s=iP(a.data),n=this.getAvcEncryptedData(s);this.decryptBuffer(n.buffer).then(n=>{a.data=this.getAvcDecryptedUnit(s,n),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,r)}).catch(r)}decryptAvcSamples(e,t,i,r){if(e instanceof Uint8Array)throw Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void r();let a=e[t].units;for(;!(i>=a.length);i++){let s=a[i];
6if(!(s.data.length<=48)&&(1===s.type||5===s.type)&&(this.decryptAvcSample(e,t,i,r,s),!this.decrypter.isSync()))return}}}}class sI{constructor(){this.VideoSample=null}createVideoSample(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],length:0}}getLastNalUnit(e){var t;let i,r=this.VideoSample;if(r&&0!==r.units.length||(r=e[e.length-1]),null!=(t=r)&&t.units){let e=r.units;i=e[e.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){let i=t.samples,r=i.length;if(!r)return void t.dropped++;{let t=i[r-1];e.pts=t.pts,e.dts=t.dts}}t.samples.push(e)}}parseNALu(e,t,i){let r,a,s,n=t.byteLength,o=e.naluState||0,l=o,d=[],u=0,h=-1,c=0;for(-1===o&&(h=0,c=this.getNALuType(t,0),o=0,u=1);u<n;){if(r=t[u++],!o){o=+!r;continue}if(1===o){o=2*!r;continue}if(r)if(1===r){if(a=u-o-1,h>=0){let e={data:t.subarray(h,a),type:c};d.push(e)}else{let i=this.getLastNalUnit(e.samples);i&&(l&&u<=4-l&&i.state&&(i.data=i.data.subarray(0,i.data.byteLength-l)),a>0&&(i.data=iI(i.data,t.subarray(0,a)),i.state=0))}u<n?(s=this.getNALuType(t,u),h=u,c=s,o=0):o=-1}else o=0;else o=3}if(h>=0&&o>=0){let e={data:t.subarray(h,n),type:c,state:o};d.push(e)}if(0===d.length){let i=this.getLastNalUnit(e.samples);i&&(i.data=iI(i.data,t))}return e.naluState=o,d}}class sC{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){let e=this.data,t=this.bytesAvailable,i=e.byteLength-t,r=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw Error("no bytes available");r.set(e.subarray(i,i+a)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*a,this.bytesAvailable-=a}skipBits(e){let t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e||(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord()),this.word<<=e,this.bitsAvailable-=e}readBits(e){let t=Math.min(this.bitsAvailable,e),i=this.word>>>32-t;if(e>32&&t8.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw Error("no bits available");return(t=e-t)>0&&this.bitsAvailable?i<<t|this.readBits(t):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if((this.word&0x80000000>>>e)!=0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){let e=this.skipLZ();return this.readBits(e+1)-1}readEG(){let e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class sD extends sI{parsePES(e,t,i,r){let a,s=this.parseNALu(e,i.data,r),n=this.VideoSample,o=!1;i.data=null,n&&s.length&&!e.audFound&&(this.pushAccessUnit(n,e),n=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(r=>{var s,l,d,u,h;switch(r.type){case 1:{let t=!1;a=!0;let s=r.data;if(o&&s.length>4){let e=this.readSliceType(s);(2===e||4===e||7===e||9===e)&&(t=!0)}t&&null!=(d=n)&&d.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null),n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),n.frame=!0,n.key=t;break}case 5:a=!0,null!=(s=n)&&s.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null),n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),n.key=!0,n.frame=!0;break;case 6:a=!0,ix(r.data,1,i.pts,t.samples);break;case 7:{a=!0,o=!0;let t=r.data,i=this.readSPS(t);if(!e.sps||e.width!==i.width||e.height!==i.height||(null==(u=e.pixelRatio)?void 0:u[0])!==i.pixelRatio[0]||(null==(h=e.pixelRatio)?void 0:h[1])!==i.pixelRatio[1]){e.width=i.width,e.height=i.height,e.pixelRatio=i.pixelRatio,e.sps=[t];let r=t.subarray(1,4),a="avc1.";for(let e=0;e<3;e++){let t=r[e].toString(16);t.length<2&&(t="0"+t),a+=t}e.codec=a}break}case 8:a=!0,e.pps=[r.data];break;case 9:a=!0,e.audFound=!0,null!=(l=n)&&l.frame&&(this.pushAccessUnit(n,e),n=null),n||(n=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:a=!0;break;default:a=!1}n&&a&&n.units.push(r)}),r&&n&&(this.pushAccessUnit(n,e),this.VideoSample=null)}
6getNALuType(e,t){return 31&e[t]}readSliceType(e){let t=new sC(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i=8,r=8;for(let a=0;a<e;a++)0!==r&&(r=(i+t.readEG()+256)%256),i=0===r?i:r}readSPS(e){let t,i,r,a=new sC(e),s=0,n=0,o=0,l=0,d=a.readUByte.bind(a),u=a.readBits.bind(a),h=a.readUEG.bind(a),c=a.readBoolean.bind(a),m=a.skipBits.bind(a),f=a.skipEG.bind(a),g=a.skipUEG.bind(a),v=this.skipScalingList.bind(this);d();let y=d();if(u(5),m(3),d(),g(),100===y||110===y||122===y||244===y||44===y||83===y||86===y||118===y||128===y){let e=h();if(3===e&&m(1),g(),g(),m(1),c())for(r=0,i=3!==e?8:12;r<i;r++)c()&&v(r<6?16:64,a)}g();let E=h();if(0===E)h();else if(1===E)for(m(1),f(),f(),t=h(),r=0;r<t;r++)f();g(),m(1);let b=h(),T=h(),A=u(1);0===A&&m(1),m(1),c()&&(s=h(),n=h(),o=h(),l=h());let _=[1,1];if(c()&&c())switch(d()){case 1:_=[1,1];break;case 2:_=[12,11];break;case 3:_=[10,11];break;case 4:_=[16,11];break;case 5:_=[40,33];break;case 6:_=[24,11];break;case 7:_=[20,11];break;case 8:_=[32,11];break;case 9:_=[80,33];break;case 10:_=[18,11];break;case 11:_=[15,11];break;case 12:_=[64,33];break;case 13:_=[160,99];break;case 14:_=[4,3];break;case 15:_=[3,2];break;case 16:_=[2,1];break;case 255:_=[d()<<8|d(),d()<<8|d()]}return{width:Math.ceil((b+1)*16-2*s-2*n),height:(2-A)*(T+1)*16-(A?2:4)*(o+l),pixelRatio:_}}}class sx extends sI{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,i,r){let a,s=this.parseNALu(e,i.data,r),n=this.VideoSample,o=!1;i.data=null,n&&s.length&&!e.audFound&&(this.pushAccessUnit(n,e),n=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(r=>{var s,l,d;switch(r.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:n||(n=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),n.frame=!0,a=!0;break;case 16:case 17:case 18:case 21:a=!0,o&&null!=(d=n)&&d.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null),n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),n.key=!0,n.frame=!0;break;case 19:case 20:a=!0,null!=(s=n)&&s.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null),n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),n.key=!0,n.frame=!0;break;case 39:a=!0,ix(r.data,2,i.pts,t.samples);break;case 32:a=!0,e.vps||("object"!=typeof e.params&&(e.params={}),e.params=tZ(e.params,this.readVPS(r.data)),this.initVPS=r.data),e.vps=[r.data];break;case 33:if(a=!0,o=!0,void 0===e.vps||e.vps[0]===this.initVPS||void 0===e.sps||this.matchSPS(e.sps[0],r.data)||(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){let t=this.readSPS(r.data);for(let i in e.width=t.width,e.height=t.height,e.pixelRatio=t.pixelRatio,e.codec=t.codecString,e.sps=[],"object"!=typeof e.params&&(e.params={}),t.params)e.params[i]=t.params[i]}this.pushParameterSet(e.sps,r.data,e.vps),n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),n.key=!0;break;case 34:if(a=!0,"object"==typeof e.params){if(!e.pps){e.pps=[];let t=this.readPPS(r.data);for(let i in t)e.params[i]=t[i]}this.pushParameterSet(e.pps,r.data,e.vps)}break;case 35:a=!0,e.audFound=!0,null!=(l=n)&&l.frame&&(this.pushAccessUnit(n,e),n=null),n||(n=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:a=!1}n&&a&&n.units.push(r)}),r&&n&&(this.pushAccessUnit(n,e),this.VideoSample=null)}pushParameterSet(e,t,i){(!i||i[0]!==this.initVPS)&&(i||e.length)||e.push(t)}getNALuType(e,t){return(126&e[t])>>>1}ebsp2rbsp(e){let t=new Uint8Array(e.byteLength),i=0;for(let r=0;r<e.byteLength;r++)(!(r>=2)||3!==e[r]||0!==e[r-1]||0!==e[r-2])&&(t[i]=e[r],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){let t=new sC(e);return t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6),{numTemporalLayers:t.readBits(3)+1,temporalIdNested:t.readBoolean()}}readSPS(e){let t=new sC(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);let i=t.readBits(3);t.readBoolean();let r=t.readBits(2),a=t.readBoolean(),s=t.readBits(5),n=t.readUByte(),o=t.readUByte(),l=t.readUByte(),d=t.readUByte(),u=t.readUByte(),h=t.readUByte(),c=t.readUByte(),m=t.readUByte(),f=t.readUByte(),g=t.readUByte(),v=t.readUByte(),y=[],E=[];for(let e=0;e<i;e++)y.push(t.readBoolean()),E.push(t.readBoolean());if(i>0)for(let e=i;e<8;e++)t.readBits(2);for(let e=0;e<i;e++)y[e]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),E[e]&&t.readUByte();t.readUEG();let b=t.readUEG();3==b&&t.skipBits(1);let T=t.readUEG(),A=t.readUEG(),_=t.readBoolean(),S=0,k=0,L=0,w=0;_&&(S+=t.readUEG(),k+=t.readUEG(),L+=t.readUEG(),w+=t.readUEG());let R=t.readUEG(),I=t.readUEG(),C=t.readUEG(),D=t.readBoolean();for(let e=D?0:i;e<=i;e++)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 e=0;e<4;e++)for(let i=0;i<(3===e?2:6);i++)if(t.readBoolean()){let i=Math.min(64,1<<4+(e<<1));e>1&&t.readEG();for(let e=0;e<i;e++)t.readEG()}else t.readUEG();t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());let x=t.readUEG(),P=0;for(let e=0;e<x;e++){let i=!1;if(0!==e&&(i=t.readBoolean()),i){e===x&&t.readUEG(),t.readBoolean(),t.readUEG();let i=0;for(let e=0;e<=P;e++){let e=t.readBoolean(),r=!1;e||(r=t.readBoolean()),(e||r)&&i++}P=i}else{let e=t.readUEG(),i=t.readUEG();P=e+i;for(let i=0;i<e;i++)t.readUEG(),t.readBoolean();for(let e=0;e<i;e++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){let e=t.readUEG();for(let i=0;i<e;i++){for(let e=0;e<C+4;e++)t.readBits(1);t.readBits(1)}}let M=0,O=1,N=1,U=!0,F=1,B=0;t.readBoolean(),t.readBoolean();if(t.readBoolean()){if(t.readBoolean()){let e=t.readUByte();e>0&&e<16?(O=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][e-1],N=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][e-1]):255===e&&(O=t.readBits(16),N=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(),t.readBoolean()&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(F=t.readBits(32),B=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){let e=t.readBoolean(),r=t.readBoolean(),a=!1;(e||r)&&((a=t.readBoolean())&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),a&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let s=0;s<=i;s++){let i=(U=t.readBoolean())||t.readBoolean(),s=!1;i?t.readEG():s=t.readBoolean();let n=s?1:t.readUEG()+1;if(e)for(let e=0;e<n;e++)t.readUEG(),t.readUEG(),a&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(r)for(let e=0;e<n;e++)t.readUEG(),t.readUEG(),a&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),M=t.readUEG())}let $=T,H=A;if(_){let e=1,t=1;1===b?e=t=2:2==b&&(e=2),$=T-e*k-e*S,H=A-t*w-t*L}let V=r?["A","B","C"][r]:"",G=n<<24|o<<16|l<<8|d,W=0;for(let e=0;e<32;e++)W=(W|(G>>e&1)<<31-e)>>>0;let K=W.toString(16);return 1===s&&"2"===K&&(K="6"),{codecString:`hvc1.${V}${s}.${K}.${a?"H":"L"}${v}.B0`,params:{general_tier_flag:a,general_profile_idc:s,general_profile_space:r,general_profile_compatibility_flags:[n,o,l,d],general_constraint_indicator_flags:[u,h,c,m,f,g],general_level_idc:v,bit_depth:R+8,bit_depth_luma_minus8:R,bit_depth_chroma_minus8:I,min_spatial_segmentation_idc:M,chroma_format_idc:b,frame_rate:{fixed:U,fps:B/F}},width:$,height:H,pixelRatio:[O,N]}}readPPS(e){let t=new sC(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);let i=t.readBoolean(),r=t.readBoolean(),a=1;return r&&i?a=0:r?a=3:i&&(a=2),{parallelismType:a}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}class sP{constructor(e,t,i,r){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupp
6orted=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=i,this.logger=r,this.videoParser=null}static probe(e,t){let i=sP.syncOffset(e);return i>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),-1!==i}static syncOffset(e){let t=e.length,i=Math.min(940,t-188)+1,r=0;for(;r<i;){let a=!1,s=-1,n=0;for(let o=r;o<t;o+=188)if(71===e[o]&&(t-o==188||71===e[o+188])){if(n++,-1===s&&0!==(s=o)&&(i=Math.min(s+18612,e.length-188)+1),a||(a=0===sM(e,o)),a&&n>1&&(0===s&&n>2||o+188>i))return s}else if(n)return -1;else break;r++}return -1}static createTrack(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:ip[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}resetInitSegment(e,t,i,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=sP.createTrack("video"),this._videoTrack.duration=r,this._audioTrack=sP.createTrack("audio",r),this._id3Track=sP.createTrack("id3"),this._txtTrack=sP.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i}resetTimeStamp(){}resetContiguity(){let{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,r=!1){let a;i||(this.sampleAes=null);let s=this._videoTrack,n=this._audioTrack,o=this._id3Track,l=this._txtTrack,d=s.pid,u=s.pesData,h=n.pid,c=o.pid,m=n.pesData,f=o.pesData,g=null,v=this.pmtParsed,y=this._pmtId,E=e.length;if(this.remainderData&&(E=(e=iI(this.remainderData,e)).length,this.remainderData=null),E<188&&!r)return this.remainderData=e,{audioTrack:n,videoTrack:s,id3Track:o,textTrack:l};let b=Math.max(0,sP.syncOffset(e));(E-=(E-b)%188)<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,E,e.buffer.byteLength-E));let T=0;for(let t=b;t<E;t+=188)if(71===e[t]){let r,E=!!(64&e[t+1]),T=sM(e,t);if((48&e[t+3])>>4>1){if((r=t+5+e[t+4])===t+188)continue}else r=t+4;switch(T){case d:E&&(u&&(a=sU(u,this.logger))&&(this.readyVideoParser(s.segmentCodec),null!==this.videoParser&&this.videoParser.parsePES(s,l,a,!1)),u={data:[],size:0}),u&&(u.data.push(e.subarray(r,t+188)),u.size+=t+188-r);break;case h:if(E){if(m&&(a=sU(m,this.logger)))switch(n.segmentCodec){case"aac":this.parseAACPES(n,a);break;case"mp3":this.parseMPEGPES(n,a);break;case"ac3":this.parseAC3PES(n,a)}m={data:[],size:0}}m&&(m.data.push(e.subarray(r,t+188)),m.size+=t+188-r);break;case c:E&&(f&&(a=sU(f,this.logger))&&this.parseID3PES(o,a),f={data:[],size:0}),f&&(f.data.push(e.subarray(r,t+188)),f.size+=t+188-r);break;case 0:var A,_;E&&(r+=e[r]+1),y=this._pmtId=(31&(A=e)[(_=r)+10])<<8|A[_+11];break;case y:{E&&(r+=e[r]+1);let a=function(e,t,i,r,a,s){let n={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(15&e[t+1])<<8|e[t+2],l=t+3+o-4,d=(15&e[t+10])<<8|e[t+11];for(t+=12+d;t<l;){let o=sM(e,t),l=(15&e[t+3])<<8|e[t+4];switch(e[t]){case 207:if(!r){sN("ADTS AAC",s);break}case 15:-1===n.audioPid&&(n.audioPid=o);break;case 21:-1===n.id3Pid&&(n.id3Pid=o);break;case 219:if(!r){sN("H.264",s);break}case 27:-1===n.videoPid&&(n.videoPid=o);break;case 3:case 4:i.mpeg||i.mp3?-1===n.audioPid&&(n.audioPid=o,n.segmentAudioCodec="mp3"):s.log("MPEG audio found, not supported in this browser");break;case 193:if(!r){sN("AC-3",s);break}case 129:i.ac3?-1===n.audioPid&&(n.audioPid=o,n.segmentAudioCodec="ac3"):s.log("AC-3 audio found, not supported in this browser");break;case 6:if(-1===n.audioPid&&l>0){let r=t+5,a=l;for(;a>2;){106===e[r]&&(!0!==i.ac3?s.log("AC-3 audio found, not supported in this browser for now"):(n.audioPid=o,n.segmentAudioCodec="ac3"));let t=e[r+1]+2;r+=t,a-=t}}break;case 194:case 135:return sO(a,Error("Unsupported EC-3 in M2TS found"),void 0,s),n;case 36:-1===n.videoPid&&(n.videoPid=o,n.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"))}t+=l+5}return n}
6(e,r,this.typeSupported,i,this.observer,this.logger);(d=a.videoPid)>0&&(s.pid=d,s.segmentCodec=a.segmentVideoCodec),(h=a.audioPid)>0&&(n.pid=h,n.segmentCodec=a.segmentAudioCodec),(c=a.id3Pid)>0&&(o.pid=c),null===g||v||(this.logger.warn(`MPEG-TS PMT found at ${t} after unknown PID '${g}'. Backtracking to sync byte @${b} to parse all TS packets.`),g=null,t=b-188),v=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=T}}else T++;T>0&&sO(this.observer,Error(`Found ${T} TS packet/s that do not start with 0x47`),void 0,this.logger),s.pesData=u,n.pesData=m,o.pesData=f;let S={audioTrack:n,videoTrack:s,id3Track:o,textTrack:l};return r&&this.extractRemainingSamples(S),S}flush(){let e,{remainderData:t}=this;return(this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes)?this.decrypt(e,this.sampleAes):e}extractRemainingSamples(e){let t,{audioTrack:i,videoTrack:r,id3Track:a,textTrack:s}=e,n=r.pesData,o=i.pesData,l=a.pesData;if(n&&(t=sU(n,this.logger))?(this.readyVideoParser(r.segmentCodec),null!==this.videoParser&&(this.videoParser.parsePES(r,s,t,!0),r.pesData=null)):r.pesData=n,o&&(t=sU(o,this.logger))){switch(i.segmentCodec){case"aac":this.parseAACPES(i,t);break;case"mp3":this.parseMPEGPES(i,t);break;case"ac3":this.parseAC3PES(i,t)}i.pesData=null}else null!=o&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=o;l&&(t=sU(l,this.logger))?(this.parseID3PES(a,t),a.pesData=null):a.pesData=l}demuxSampleAes(e,t,i){let r=this.demux(e,i,!0,!this.config.progressive),a=this.sampleAes=new sR(this.observer,this.config,t);return this.decrypt(r,a)}readyVideoParser(e){null===this.videoParser&&("avc"===e?this.videoParser=new sD:"hevc"===e&&(this.videoParser=new sx))}decrypt(e,t){return new Promise(i=>{let{audioTrack:r,videoTrack:a}=e;r.samples&&"aac"===r.segmentCodec?t.decryptAacSamples(r.samples,0,()=>{a.samples?t.decryptAvcSamples(a.samples,0,0,()=>{i(e)}):i(e)}):a.samples&&t.decryptAvcSamples(a.samples,0,0,()=>{i(e)})})}destroy(){this.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 i,r,a,s,n=0,o=this.aacOverFlow,l=t.data;if(o){this.aacOverFlow=null;let t=o.missing,i=o.sample.unit.byteLength;-1===t?l=iI(o.sample.unit,l):(o.sample.unit.set(l.subarray(0,t),i-t),e.samples.push(o.sample),n=o.missing)}for(i=n,r=l.length;i<r-1&&!sr(l,i);i++);if(i!==n){let e,t=i<r-1;if(e=t?`AAC PES did not start with ADTS header,offset:${i}`:"No ADTS header found in AAC PES",sO(this.observer,Error(e),t,this.logger),!t)return}if(sa(e,this.observer,l,i,this.audioCodec),void 0!==t.pts)a=t.pts;else{if(!o)return void this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");let t=9216e4/e.samplerate;a=o.sample.pts+t}let d=0;for(;i<r;){if(s=ss(e,l,i,a,d),i+=s.length,s.missing){this.aacOverFlow=s;break}for(d++;i<r-1&&!sr(l,i);i++);}}parseMPEGPES(e,t){let i=t.data,r=i.length,a=0,s=0,n=t.pts;if(void 0===n)return void this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");for(;s<r;)if(sA(i,s)){let t=sE(e,i,s,n,a);if(t)s+=t.length,a++;else break}else s++}parseAC3PES(e,t){{let i,r=t.data,a=t.pts;if(void 0===a)return void this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");let s=r.length,n=0,o=0;for(;o<s&&(i=sk(e,r,o,a,n++))>0;)o+=i}}parseID3PES(e,t){if(void 0===t.pts)return void this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");let i=tZ({},t,{type:this._videoTrack?su.emsg:su.audioId3,duration:1/0});e.samples.push(i)}}function sM(e,t){return((31&e[t+1])<<8)+e[t+2]}function sO(e,t,i,r){r.warn(`parsing error: ${t.message}`),e.emit(tV.ERROR,tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.FRAG_PARSING_ERROR,fatal:!1,levelRetry:i,error:t,reason:t.message})}function sN(e,t){t.log(`${e} with AES-128-CBC encryption found in unencrypted stream`)}function sU(e,t){let i,r,a,s,n,o=0,l=e.data;if(!e||0===e.size)return null;for(;l[0].length<19&&l.length>1;)l[0]=iI(l[0],l[1]),l.splice(1,1);if(1===((i=l[0])[0]<<16)+(i[1]<<8)+i[2]){if((r=(i[4]<<8)+i[5])&&r>e.size-6)return null;let d=i[7];192&d&&(s=(14&i[9])*0x20000000+(255&i[10])*4194304+(254&i[11])*16384+(255&i[12])*128+(254&i[13])/2,64&d?s-(n=(14&i[14])*0x20000000+(255&i[15])*4194304+(254&i[16])*16384+(255&i[17])*128+(254&i[18])/2)>54e5&&(t.warn(`${Math.round((s-n)/9e4)}s delta between PTS and DTS, align them`),s=n):n=s);let u=(a=i[8])+9;if(e.size<=u)return null;e.size-=u;let h=new Uint8Array(e.size);for(let e=0,t=l.length;e<t;e++){let t=(i=l[e]).byteLength;if(u)if(u>t){u-=t;continue}else i=i.subarray(u),t-=u,u=0;h.set(i,o),o+=t}return r&&(r-=a+3),{data:h,pts:s,dts:n,len:r}}return null}class sF{static getSilentFrame(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);else if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);else if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);else if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}class sB{static init(){let e;for(e in sB.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:[]},sB.types)sB.types.hasOwnProperty(e)&&(sB.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);sB.HDLR_TYPES={video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])};let t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);sB.STTS=sB.STSC=sB.STCO=new Uint8Array([0,0,0,0,0,0,0,0]),sB.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),sB.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),sB.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),sB.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);
6let i=new Uint8Array([105,115,111,109]),r=new Uint8Array([97,118,99,49]),a=new Uint8Array([0,0,0,1]);sB.FTYP=sB.box(sB.types.ftyp,i,a,i,r),sB.DINF=sB.box(sB.types.dinf,sB.box(sB.types.dref,t))}static box(e,...t){let i=8,r=t.length,a=r;for(;r--;)i+=t[r].byteLength;let s=new Uint8Array(i);for(s[0]=i>>24&255,s[1]=i>>16&255,s[2]=i>>8&255,s[3]=255&i,s.set(e,4),r=0,i=8;r<a;r++)s.set(t[r],i),i+=t[r].byteLength;return s}static hdlr(e){return sB.box(sB.types.hdlr,sB.HDLR_TYPES[e])}static mdat(e){return sB.box(sB.types.mdat,e)}static mdhd(e,t){let i=Math.floor((t*=e)/0x100000000),r=Math.floor(t%0x100000000);return sB.box(sB.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,r>>24,r>>16&255,r>>8&255,255&r,85,196,0,0]))}static mdia(e){return sB.box(sB.types.mdia,sB.mdhd(e.timescale||0,e.duration||0),sB.hdlr(e.type),sB.minf(e))}static mfhd(e){return sB.box(sB.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}static minf(e){return"audio"===e.type?sB.box(sB.types.minf,sB.box(sB.types.smhd,sB.SMHD),sB.DINF,sB.stbl(e)):sB.box(sB.types.minf,sB.box(sB.types.vmhd,sB.VMHD),sB.DINF,sB.stbl(e))}static moof(e,t,i){return sB.box(sB.types.moof,sB.mfhd(e),sB.traf(i,t))}static moov(e){let t=e.length,i=[];for(;t--;)i[t]=sB.trak(e[t]);return sB.box.apply(null,[sB.types.moov,sB.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(sB.mvex(e)))}static mvex(e){let t=e.length,i=[];for(;t--;)i[t]=sB.trex(e[t]);return sB.box.apply(null,[sB.types.mvex,...i])}static mvhd(e,t){let i=Math.floor((t*=e)/0x100000000),r=Math.floor(t%0x100000000),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,r>>24,r>>16&255,r>>8&255,255&r,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return sB.box(sB.types.mvhd,a)}static sdtp(e){let t,i,r=e.samples||[],a=new Uint8Array(4+r.length);for(t=0;t<r.length;t++)i=r[t].flags,a[t+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return sB.box(sB.types.sdtp,a)}static stbl(e){return sB.box(sB.types.stbl,sB.stsd(e),sB.box(sB.types.stts,sB.STTS),sB.box(sB.types.stsc,sB.STSC),sB.box(sB.types.stsz,sB.STSZ),sB.box(sB.types.stco,sB.STCO))}static avc1(e){let t,i,r,a=[],s=[];for(t=0;t<e.sps.length;t++)r=(i=e.sps[t]).byteLength,a.push(r>>>8&255),a.push(255&r),a=a.concat(Array.prototype.slice.call(i));for(t=0;t<e.pps.length;t++)r=(i=e.pps[t]).byteLength,s.push(r>>>8&255),s.push(255&r),s=s.concat(Array.prototype.slice.call(i));let n=sB.box(sB.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|e.sps.length].concat(a).concat([e.pps.length]).concat(s))),o=e.width,l=e.height,d=e.pixelRatio[0],u=e.pixelRatio[1];return sB.box(sB.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,255&o,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),n,sB.box(sB.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),sB.box(sB.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,u>>24,u>>16&255,u>>8&255,255&u])))}static esds(e){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,...e.config,6,1,2])}static audioStsd(e){let 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,255&t,0,0])}static mp4a(e){return sB.box(sB.types.mp4a,sB.audioStsd(e),sB.box(sB.types.esds,sB.esds(e)))}static mp3(e){return sB.box(sB.types[".mp3"],sB.audioStsd(e))}static ac3(e){return sB.box(sB.types["ac-3"],sB.audioStsd(e),sB.box(sB.types.dac3,e.config))}static stsd(e){let{segmentCodec:t}=e;if("audio"===e.type){if("aac"===t)return sB.box(sB.types.stsd,sB.STSD,sB.mp4a(e));if("ac3"===t&&e.config)return sB.box(sB.types.stsd,sB.STSD,sB.ac3(e));if("mp3"===t&&"mp3"===e.codec)return sB.box(sB.types.stsd,sB.STSD,sB.mp3(e))}else if(e.pps&&e.sps){if("avc"===t)return sB.box(sB.types.stsd,sB.STSD,sB.avc1(e));if("hevc"===t&&e.vps)return sB.box(sB.types.stsd,sB.STSD,sB.hvc1(e))}
6else throw Error("video track missing pps or sps");throw Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){let t=e.id,i=(e.duration||0)*(e.timescale||0),r=e.width||0,a=e.height||0,s=Math.floor(i/0x100000000),n=Math.floor(i%0x100000000);return sB.box(sB.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,n>>24,n>>16&255,n>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,255&r,0,0,a>>8&255,255&a,0,0]))}static traf(e,t){let i=sB.sdtp(e),r=e.id,a=Math.floor(t/0x100000000),s=Math.floor(t%0x100000000);return sB.box(sB.types.traf,sB.box(sB.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),sB.box(sB.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,s>>24,s>>16&255,s>>8&255,255&s])),sB.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||0xffffffff,sB.box(sB.types.trak,sB.tkhd(e),sB.mdia(e))}static trex(e){let t=e.id;return sB.box(sB.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){let i,r,a,s,n,o,l=e.samples||[],d=l.length,u=12+16*d,h=new Uint8Array(u);for(t+=8+u,h.set([+("video"===e.type),0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,255&d,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),i=0;i<d;i++)a=(r=l[i]).duration,s=r.size,n=r.flags,o=r.cts,h.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.paddingValue<<1|n.isNonSync,61440&n.degradPrio,15&n.degradPrio,o>>>24&255,o>>>16&255,o>>>8&255,255&o],12+16*i);return sB.box(sB.types.trun,h)}static initSegment(e){sB.types||sB.init();let t=sB.moov(e);return iI(sB.FTYP,t)}static hvc1(e){let t=e.params,i=[e.vps,e.sps,e.pps],r=new Uint8Array([1,t.general_profile_space<<6|32*!!t.general_tier_flag|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),3|t.temporal_id_nested<<2|t.num_temporal_layers<<3|64*!!t.frame_rate.fixed,i.length]),a=r.length;for(let e=0;e<i.length;e+=1){a+=3;for(let t=0;t<i[e].length;t+=1)a+=2+i[e][t].length}let s=new Uint8Array(a);s.set(r,0),a=r.length;let n=i.length-1;for(let e=0;e<i.length;e+=1){s.set(new Uint8Array([32+e|128*(e===n),0,i[e].length]),a),a+=3;for(let t=0;t<i[e].length;t+=1)s.set(new Uint8Array([i[e][t].length>>8,255&i[e][t].length]),a),a+=2,s.set(i[e][t],a),a+=i[e][t].length}let o=sB.box(sB.types.hvcC,s),l=e.width,d=e.height,u=e.pixelRatio[0],h=e.pixelRatio[1];return sB.box(sB.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,l>>8&255,255&l,d>>8&255,255&d,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,sB.box(sB.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),sB.box(sB.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,h>>24,h>>16&255,h>>8&255,255&h])))}}function s$(e,t,i=1,r=!1){let a=e*t*i;return r?Math.round(a):a}function sH(e,t=!1){return s$(e,1e3,11111111111111112e-21,t)}function sV(e){let{baseTime:t,timescale:i,trackId:r}=e;return`${t/i} (${t}/${i}) trackId: ${r}`}sB.types=void 0,sB.HDLR_TYPES=void 0,sB.STTS=void 0,sB.STSC=void 0,sB.STCO=void 0,sB.STSZ=void 0,sB.VMHD=void 0,sB.SMHD=void 0,sB.STSD=void 0,sB.FTYP=void 0,sB.DINF=void 0;let sG=null,sW=null;function sK(e,t,i,r){return{duration:t,size:i,cts:r,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:+!e}}}class sq extends t1{constructor(e,t,i,r){if(super("mp4-remuxer",r),this.observer=void 0,this.config=void 0,this.typeSupp
6orted=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=i,this.ISGenerated=!1,null===sG){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);sG=e?parseInt(e[1]):0}if(null===sW){const e=navigator.userAgent.match(/Safari\/(\d+)/i);sW=e?parseInt(e[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){let t=this._initPTS;t&&e&&e.trackId===t.trackId&&e.baseTime===t.baseTime&&e.timescale===t.timescale||this.log(`Reset initPTS: ${t?sV(t):t} > ${e?sV(e):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,i=e[0].pts,r=e.reduce((e,r)=>{let a=r.pts,s=a-e;return(s<-0x100000000&&(t=!0,s=(a=sj(a,i))-e),s>0)?e:a},i);return t&&this.debug("PTS rollover detected"),r}remux(e,t,i,r,a,s,n,o){let l,d,u,h,c,m,f=a,g=a,v=e.pid>-1,y=t.pid>-1,E=t.samples.length,b=e.samples.length>0,T=n&&E>0||E>1;if((!v||b)&&(!y||T)||this.ISGenerated||n){let i;if(this.ISGenerated){var A,_,S,k;let e=this.videoTrackConfig;(e&&(t.width!==e.width||t.height!==e.height||(null==(A=t.pixelRatio)?void 0:A[0])!==(null==(_=e.pixelRatio)?void 0:_[0])||(null==(S=t.pixelRatio)?void 0:S[1])!==(null==(k=e.pixelRatio)?void 0:k[1]))||!e&&T||null===this.nextAudioTs&&b)&&this.resetInitSegment()}this.ISGenerated||(u=this.generateIS(e,t,a,s));let r=this.isVideoContiguous,n=-1;if(T&&(n=function(e){for(let t=0;t<e.length;t++)if(e[t].key)return t;return -1}(t.samples),!r&&this.config.forceKeyFrameOnDiscontinuity))if(m=!0,n>0){this.warn(`Dropped ${n} out of ${E} video samples due to a missing keyframe`);let e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(n),t.dropped+=n,g+=(t.samples[0].pts-e)/t.inputTimeScale,i=g}else -1===n&&(this.warn(`No keyframe found out of ${E} video samples`),m=!1);if(this.ISGenerated){if(b&&T){let i=this.getVideoStartPts(t.samples),r=(sj(e.samples[0].pts,i)-i)/t.inputTimeScale;f+=Math.max(0,r),g+=Math.max(0,-r)}if(b){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),u=this.generateIS(e,t,a,s)),d=this.remuxAudio(e,f,this.isAudioContiguous,s,y||T||o===tY?g:void 0),T){let i=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),u=this.generateIS(e,t,a,s)),l=this.remuxVideo(t,g,r,i)}}else T&&(l=this.remuxVideo(t,g,r,0));l&&(l.firstKeyFrame=n,l.independent=-1!==n,l.firstKeyFramePTS=i)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(c=sY(i,a,this._initPTS,this._initDTS)),r.samples.length&&(h=sz(r,a,this._initPTS))),{audio:d,video:l,initSegment:u,independent:m,text:h,id3:c}}computeInitPts(e,t,i,r){let a=Math.round(i*t),s=sj(e,a);if(s<a+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(a-s)/t} ${r}`);s<a+t;)s+=0x200000000;return s-a}generateIS(e,t,i,r){let a,s,n,o=e.samples,l=t.samples,d=this.typeSupported,u={},h=this._initPTS,c=!h||r,m="audio/mp4",f=-1;if(c&&(a=s=1/0),e.config&&o.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":d.mpeg?(m="audio/mpeg",e.codec=""):d.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}u.audio={id:"audio",container:m,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&d.mpeg?new Uint8Array(0):sB.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(f=e.id,n=e.inputTimeScale,h&&n===h.timescale?c=!1:a=s=this.computeInitPts(o[0].pts,n,i,"audio"))}if(t.sps&&t.pps&&l.length){if(t.timescale=t.inputTimeScale,u.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:sB.initSegment([t]),metadata:{width:t.width,height:t.height}},c)if(f=t.id,n=t.inputTimeScale,h&&n===h.timescale)c=!1;else{let e=this.getVideoStartPts(l),t=sj(l[0].dts,e),r=this.computeInitPts(t,n,i,"video"),o=this.computeInitPts(e,n,i,"video");s=Math.min(s,r),a=Math.min(a,o)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(u).length)return this.ISGenerated=!0,c?(h&&this.warn(`Timestamps at playlist time: ${r?"":"~"}${i} ${a/n} != initPTS: ${h.baseTime/h.timescale} (${h.baseTime}/${h.timescale}) trackId: ${h.trackId}`),this.log(`Found initPTS at playlist time: ${i} offset: ${a/n} (${a}/${n}) trackId: ${f}`),this._initPTS={baseTime:a,timescale:n,trackId:f},this._initDTS={baseTime:s,timescale:n,trackId:f}):a=n=void 0,{tracks:u,initPTS:a,timescale:n,trackId:f}}remuxVideo(e,t,i,r){let a,s,n,o=e.inputTimeScale,l=e.samples,d=[],u=l.length,h=this._initPTS,c=h.baseTime*o/h.timescale,m=this.nextVideoTs,f=8,g=this.videoSampleDuration,v=1/0,y=-1/0,E=!1;if(!i||null===m){let e=c+t*o,r=l[0].pts-sj(l[0].dts,l[0].pts);sG&&null!==m&&15e3>Math.abs(e-r-(m+c))?i=!0:m=e-r-c}let b=m+c;for(let e=0;e<u;e++){let t=l[e];t.pts=sj(t.pts,b),t.dts=sj(t.dts,b),t.dts<l[e>0?e-1:e].dts&&(E=!0)}E&&l.sort(function(e,t){let i=e.dts-t.dts,r=e.pts-t.pts;return i||r}),a=l[0].dts;let T=(s=l[l.length-1].dts)-a,A=T?Math.round(T/(u-1)):g||e.inputTimeScale/30;if(i){let i=a-b,r=i>A,s=i<-1;if((r||s)&&(r?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${sH(i,!0)} ms (${i}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${sH(-i,!0)} ms (${i}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!s||b>=l[0].pts||sG)){a=b;let e=l[0].pts-i;
6if(r)l[0].dts=a,l[0].pts=e;else{let t=!0;for(let r=0;r<l.length&&(!(l[r].dts>e)||!t);r++){let e=l[r].pts;if(l[r].dts-=i,l[r].pts-=i,r<l.length-1){let i=l[r+1].pts;t=i<=l[r].pts==i<=e}}}this.log(`Video: Initial PTS/DTS adjusted: ${sH(e,!0)}/${sH(a,!0)}, delta: ${sH(i,!0)} ms`)}}let _=0,S=0,k=a=Math.max(0,a);for(let e=0;e<u;e++){let t=l[e],i=t.units,r=i.length,a=0;for(let e=0;e<r;e++)a+=i[e].data.length;S+=a,_+=r,t.length=a,t.dts<k?(t.dts=k,k+=A/4|0||1):k=t.dts,v=Math.min(t.pts,v),y=Math.max(t.pts,y)}s=l[u-1].dts;let L=S+4*_+8;try{n=new Uint8Array(L)}catch(e){this.observer.emit(tV.ERROR,tV.ERROR,{type:t$.MUX_ERROR,details:tH.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:L,reason:`fail allocating video mdat ${L}`});return}let w=new DataView(n.buffer);w.setUint32(0,L),n.set(sB.types.mdat,4);let R=!1,I=1/0,C=1/0,D=-1/0,x=-1/0;for(let e=0;e<u;e++){let t,i=l[e],a=i.units,s=0;for(let e=0,t=a.length;e<t;e++){let t=a[e],i=t.data,r=t.data.byteLength;w.setUint32(f,r),f+=4,n.set(i,f),f+=r,s+=4+r}if(e<u-1)g=l[e+1].dts-i.dts,t=l[e+1].pts-i.pts;else{let a=this.config,s=e>0?i.dts-l[e-1].dts:A;if(t=e>0?i.pts-l[e-1].pts:A,a.stretchShortVideoTrack&&null!==this.nextAudioTs){let e=Math.floor(a.maxBufferHole*o),t=(r?v+r*o:this.nextAudioTs+c)-i.pts;t>e?((g=t-s)<0?g=s:R=!0,this.log(`It is approximately ${t/90} ms to the next segment; using duration ${g/90} ms for the last video frame.`)):g=s}else g=s}let h=Math.round(i.pts-i.dts);I=Math.min(I,g),D=Math.max(D,g),C=Math.min(C,t),x=Math.max(x,t),d.push(sK(i.key,g,s,h))}if(d.length){if(sG){if(sG<70){let e=d[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(sW&&x-C<D-I&&A/D<.025&&0===d[0].cts){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let e=a;for(let t=0,i=d.length;t<i;t++){let r=e+d[t].duration,a=e+d[t].cts;if(t<i-1){let e=r+d[t+1].cts;d[t].duration=e-a}else d[t].duration=t?d[t-1].duration:A;d[t].cts=0,e=r}}}let P=s+(g=R||!g?A:g);this.nextVideoTs=m=P-c,this.videoSampleDuration=g,this.isVideoContiguous=!0;let M={data1:sB.moof(e.sequenceNumber++,a,tZ(e,{samples:d})),data2:n,startPTS:(v-c)/o,endPTS:(y+g-c)/o,startDTS:(a-c)/o,endDTS:m/o,type:"video",hasAudio:!1,hasVideo:!0,nb:d.length,dropped:e.dropped};return e.samples=[],e.dropped=0,M}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}}remuxAudio(e,t,i,r,a){let s,n=e.inputTimeScale,o=e.samplerate?e.samplerate:n,l=n/o,d=this.getSamplesPerFrame(e),u=d*l,h=this._initPTS,c="mp3"===e.segmentCodec&&this.typeSupported.mpeg,m=[],f=void 0!==a,g=e.samples,v=8*!c,y=this.nextAudioTs||-1,E=h.baseTime*n/h.timescale,b=E+t*n;if(this.isAudioContiguous=i=i||g.length&&y>0&&(r&&9e3>Math.abs(b-(y+E))||Math.abs(sj(g[0].pts,b)-(y+E))<20*u),g.forEach(function(e){e.pts=sj(e.pts,b)}),!i||y<0){let e=g.length;if(e!==(g=g.filter(e=>e.pts>=0)).length&&this.warn(`Removed ${g.length-e} of ${e} samples (initPTS ${E} / ${n})`),!g.length)return;y=0===a?0:r&&!f?Math.max(0,b-E):g[0].pts-E}if("aac"===e.segmentCodec){let t=this.config.maxAudioFramesDrift;for(let i=0,r=y+E;i<g.length;i++){let a=g[i],s=a.pts,o=s-r,l=Math.abs(1e3*o/n);if(o<=-t*u&&f)0===i&&(this.warn(`Audio frame @ ${(s/n).toFixed(3)}s overlaps marker by ${Math.round(1e3*o/n)} ms.`),this.nextAudioTs=y=s-E,r=s);else if(o>=t*u&&l<1e4&&f){let t=Math.round(o/u);for(r=s-t*u;r<0&&t&&u;)t--,r+=u;0===i&&(this.nextAudioTs=y=r-E),this.warn(`Injecting ${t} audio frames @ ${((r-E)/n).toFixed(3)}s due to ${Math.round(1e3*o/n)} ms gap.`);for(let s=0;s<t;s++){let t=sF.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);t||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),t=a.unit.subarray()),g.splice(i,0,{unit:t,pts:r}),r+=u,i++}}a.pts=r,r+=u}}let T=null,A=null,_=0,S=g.length;for(;S--;)_+=g[S].unit.byteLength;for(let t=0,r=g.length;t<r;t++){let r=g[t],a=r.unit,n=r.pts;if(null!==A)m[t-1].duration=Math.round((n-A)/l);else{if(i&&"aac"===e.segmentCodec&&(n=y+E),T=n,!(_>0))return;_+=v;try{s=new Uint8Array(_)}catch(e){this.observer.emit(tV.ERROR,tV.ERROR,{type:t$.MUX_ERROR,details:tH.REMUX_ALLOC_ER
6ROR,fatal:!1,error:e,bytes:_,reason:`fail allocating audio mdat ${_}`});return}c||(new DataView(s.buffer).setUint32(0,_),s.set(sB.types.mdat,4))}s.set(a,v);let o=a.byteLength;v+=o,m.push(sK(!0,d,o,0)),A=n}let k=m.length;if(!k)return;let L=m[m.length-1];y=A-E,this.nextAudioTs=y+l*L.duration;let w=c?new Uint8Array(0):sB.moof(e.sequenceNumber++,T/l,tZ({},e,{samples:m}));e.samples=[];let R=(T-E)/n,I=this.nextAudioTs/n,C={data1:w,data2:s,startPTS:R,endPTS:I,startDTS:R,endDTS:I,type:"audio",hasAudio:!0,hasVideo:!1,nb:k};return this.isAudioContiguous=!0,C}}function sj(e,t){let i;if(null===t)return e;for(i=t<e?-0x200000000:0x200000000;Math.abs(e-t)>0x100000000;)e+=i;return e}function sY(e,t,i,r){let a=e.samples.length;if(!a)return;let s=e.inputTimeScale;for(let n=0;n<a;n++){let a=e.samples[n];a.pts=sj(a.pts-i.baseTime*s/i.timescale,t*s)/s,a.dts=sj(a.dts-r.baseTime*s/r.timescale,t*s)/s}let n=e.samples;return e.samples=[],{samples:n}}function sz(e,t,i){let r=e.samples.length;if(!r)return;let a=e.inputTimeScale;for(let s=0;s<r;s++){let r=e.samples[s];r.pts=sj(r.pts-i.baseTime*a/i.timescale,t*a)/a}e.samples.sort((e,t)=>e.pts-t.pts);let s=e.samples;return e.samples=[],{samples:s}}function sX(e,t,i=!1){return(null==e?void 0:e.start)!==void 0?(e.start+(i?e.duration:0))/e.timescale:t}function sQ(e,t,i){let r=e.codec;return r&&r.length>4?r:t===is?"ec-3"===r||"ac-3"===r||"alac"===r?r:"fLaC"===r||"Opus"===r?iG(r,!1):(i.warn(`Unhandled audio codec "${r}" in mp4 MAP`),r||"mp4a"):(i.warn(`Unhandled video codec "${r}" in mp4 MAP`),r||"avc1")}try{t=self.performance.now.bind(self.performance)}catch(e){t=Date.now}let sZ=[{demux:class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,r){let a=this.videoTrack=sh("video",1),s=this.audioTrack=sh("audio",1),n=this.txtTrack=sh("text",1);if(this.id3Track=sh("id3",1),this.timeOffset=0,!(null!=e&&e.byteLength))return;let o=iA(e);if(o.video){let{id:e,timescale:t,codec:i,supplemental:r}=o.video;a.id=e,a.timescale=n.timescale=t,a.codec=i,a.supplemental=r}if(o.audio){let{id:e,timescale:t,codec:i}=o.audio;s.id=e,s.timescale=t,s.codec=i}n.id=ip.text,a.sampleDuration=0,a.duration=s.duration=r}resetContiguity(){this.remainderData=null}static probe(e){let t=e.byteLength;for(let i=0;i<t;){let r=iy(e,i);if(r>8&&109===e[i+4]&&111===e[i+5]&&111===e[i+6]&&102===e[i+7])return!0;i=r>1?i+r:t}return!1}demux(e,t){this.timeOffset=t;let i=e,r=this.videoTrack,a=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=iI(this.remainderData,e));let t=function(e){let t={valid:null,remainder:null},i=iT(e,["moof"]);if(i.length<2)return t.remainder=e,t;let r=i[i.length-1];return t.valid=e.slice(0,r.byteOffset-8),t.remainder=e.slice(r.byteOffset-8),t}(i);this.remainderData=t.remainder,r.samples=t.valid||new Uint8Array}else r.samples=i;let s=this.extractID3Track(r,t);return a.samples=iC(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}}flush(){let e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;let r=this.extractID3Track(t,this.timeOffset);return i.samples=iC(e,t),{videoTrack:t,audioTrack:sh(),id3Track:r,textTrack:sh()}}extractID3Track(e,t){let i=this.id3Track;return e.samples.length&&iT(e.samples,["emsg"]).forEach(e=>{let r=function(e){let t=e[0],i="",r="",a=0,s=0,n=0,o=0,l=0,d=0;if(0===t){for(;"\0"!==ig(e.subarray(d,d+1));)i+=ig(e.subarray(d,d+1)),d+=1;for(i+=ig(e.subarray(d,d+1)),d+=1;"\0"!==ig(e.subarray(d,d+1));)r+=ig(e.subarray(d,d+1)),d+=1;r+=ig(e.subarray(d,d+1)),d+=1,a=iy(e,12),s=iy(e,16),o=iy(e,20),l=iy(e,24),d=28}else if(1===t){d+=4,a=iy(e,d);let t=iy(e,d+=4),s=iy(e,d+=4);for(d+=4,tF(n=0x100000000*t+s)||(n=Number.MAX_SAFE_INTEGER,t8.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=iy(e,d),d+=4,l=iy(e,d),d+=4;"\0"!==ig(e.subarray(d,d+1));)i+=ig(e.subarray(d,d+1)),d+=1;for(i+=ig(e.subarray(d,d+1)),d+=1;"\0"!==ig(e.subarray(d,d+1));)r+=ig(e.subarray(d,d+1)),d+=1;r+=ig(e.subarray(d,d+1)),d+=1}return{schemeIdUri:i,value:r,timeScale:a,presentationTime:n,presentationTimeDelta:s,eventDuration:o,id:l,payload:e.subarray(d,e.byteLength)}}(e);if(sL.test(r.schemeIdUri)){let e=sw(r,t),a=0xffffffff===r.eventDuration?1/0:r.eventDuration/r.timeScale;a<=.001&&(a=1/0);let s=r.payload;i.samples.push({data:s,len:s.byteLength,dts:e,pts:e,type:su.emsg,duration:a})}else if(this.config.enableEmsgKLVMetadata&&r.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){let e=sw(r,t);i.samples.push({data:r.payload,len:r.payload.byteLength,dts:e,pts:e,type:su.misbklv,duration:1/0})}}),i}demuxSampleAes(e,t,i){return Promise.reject(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}},remux:class extends t1{constructor(e,t,i,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;let 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,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(e,r),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:i,videoCodec:r}=this;if(!(null!=e&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}let{audio:a,video:s}=this.initData=iA(e);if(t)!function(e,t){if(!e||!t)return;let i=t.keyId;i&&t.isCommonEncryption&&iw(e,(e,t)=>{let r=e.subarray(8,24);r.some(e=>0!==e)||(t8.log(`[eme] Patching keyId in 'enc${t?"a":"v"}>sinf>>tenc' box: ${ie(r)} -> ${ie(i)}`),e.set(i,8))})}(e,t);else{let e=a||s;null!=e&&e.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${e.codec}")!`)}a&&(i=sQ(a,is,this)),s&&(r=sQ(s,io,this));let n={};a&&s?n.audiovideo={container:"video/mp4",codec:i+","+r,supplemental:s.supplemental,encrypted:s.encrypted,initSegment:e,id:"main"}:a?n.audio={container:"audio/mp4",codec:i,encrypted:a.encrypted,initSegment:e,id:"audio"}:s?n.video={container:"video/mp4",codec:r,supplemental:s.supplemental,encrypted:s.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=n}remux(e,t,i,r,a,s){var n,o;let{initPTS:l,lastEndTime:d}=this,u={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};tU(d)||(d=this.lastEndTime=a||0);let h=t.samples;if(!h.length)return u;let c={initPTS:void 0,timescale:void 0,trackId:void 0},m=this.initData;if(null!=(n=m)&&n.length||(this.generateInitSegment(h),m=this.initData),!(null!=(o=m)&&o.length))return this.warn("Failed to generate initSegment."),u;this.emitInitSegment&&(c.tracks=this.initTracks,this.emitInitSegment=!1);let f=function(e,t,i){let r={},a=iT(e,["moof","traf"]);for(let e=0;e<a.length;e++){let s=a[e],n=iT(s,["tfhd"])[0],o=iy(n,4),l=t[o];if(!l)continue;r[o]||(r[o]={start:NaN,duration:0,sampleCount:0,timescale:l.timescale,type:l.type});let d=r[o],u=iT(s,["tfdt"])[0];if(u){let e=u[0],t=iy(u,4);1===e&&(0xffffffff===t?i.warn("[mp4-demuxer]: Ignoring assumed invali
6d signed 64-bit track fragment decode time"):(t*=0x100000000,t+=iy(u,8))),tU(t)&&(!tU(d.start)||t<d.start)&&(d.start=t)}let h=l.default,c=iy(n,0)|(null==h?void 0:h.flags),m=(null==h?void 0:h.duration)||0;8&c&&(m=2&c?iy(n,12):iy(n,8));let f=iT(s,["trun"]),g=d.start||0,v=0,y=m;for(let e=0;e<f.length;e++){let t=f[e],i=iy(t,4),r=d.sampleCount;d.sampleCount+=i;let a=1&t[3],s=4&t[3],n=1&t[2],o=2&t[2],l=4&t[2],u=8&t[2],h=8,c=i;for(a&&(h+=4),s&&i&&(1&t[h+1]||void 0!==d.keyFrameIndex||(d.keyFrameIndex=r),h+=4,n?(y=iy(t,h),h+=4):y=m,o&&(h+=4),u&&(h+=4),g+=y,v+=y,c--);c--;)n?(y=iy(t,h),h+=4):y=m,o&&(h+=4),l&&(1&t[h+1]||void 0!==d.keyFrameIndex||(d.keyFrameIndex=d.sampleCount-(c+1),d.keyFrameStart=g),h+=4),u&&(h+=4),g+=y,v+=y;!v&&m&&(v+=m*i)}d.duration+=v}if(!Object.keys(r).some(e=>r[e].duration)){let t=1/0,i=0,a=iT(e,["sidx"]);for(let e=0;e<a.length;e++){let r=function(e){let t=[],i=e[0],r=8,a=iy(e,8);r+=4;let s=0,n=0;0===i?(s=iy(e,r),n=iy(e,r+4),r+=8):(s=iE(e,r),n=iE(e,r+8),r+=16),r+=2;let o=e.length+n,l=iv(e,r);r+=2;for(let i=0;i<l;i++){let i=r,s=iy(e,i);i+=4;let n=0x7fffffff&s;if(1==(0x80000000&s)>>>31)return t8.warn("SIDX has hierarchical references (not supported)"),null;let l=iy(e,i);i+=4,t.push({referenceSize:n,subsegmentDuration:l,info:{duration:l/a,start:o,end:o+n-1}}),o+=n,i+=4,r=i}return{earliestPresentationTime:s,timescale:a,version:i,referencesCount:l,references:t}}(a[e]);if(null!=r&&r.references){t=Math.min(t,r.earliestPresentationTime/r.timescale);let e=r.references.reduce((e,t)=>e+t.info.duration||0,0);i=Math.max(i,e+r.earliestPresentationTime/r.timescale)}}i&&tU(i)&&Object.keys(r).forEach(e=>{r[e].duration||(r[e].duration=i*r[e].timescale-r[e].start)})}return r}(h,m,this),g=m.audio?f[m.audio.id]:null,v=m.video?f[m.video.id]:null,y=sX(v,1/0),E=sX(g,1/0),b=sX(v,0,!0),T=sX(g,0,!0),A=a,_=0,S=g&&(!v||!l&&E<y||l&&l.trackId===m.audio.id),k=S?g:v;if(k){let e=k.timescale,t=k.start-a*e,i=S?m.audio.id:m.video.id;A=k.start/e,_=S?T-E:b-y,(s||!l)&&(function(e,t,i,r){if(null===e)return!0;let a=Math.max(r,1);return Math.abs(t-e.baseTime/e.timescale-i)>a}(l,A,a,_)||e!==l.timescale)&&(l&&this.warn(`Timestamps at playlist time: ${s?"":"~"}${a} ${t/e} != initPTS: ${l.baseTime/l.timescale} (${l.baseTime}/${l.timescale}) trackId: ${l.trackId}`),this.log(`Found initPTS at playlist time: ${a} offset: ${A-a} (${t}/${e}) trackId: ${i}`),l=null,c.initPTS=t,c.timescale=e,c.trackId=i)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${a}`);l?(c.initPTS=l.baseTime,c.timescale=l.timescale,c.trackId=l.trackId):(c.timescale&&void 0!==c.trackId&&void 0!==c.initPTS||(this.warn("Could not set initPTS"),c.initPTS=A,c.timescale=1,c.trackId=-1),this.initPTS=l={baseTime:c.initPTS,timescale:c.timescale,trackId:c.trackId});let L=A-l.baseTime/l.timescale,w=L+_;_>0?this.lastEndTime=w:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());let R=!!m.audio,I=!!m.video,C="";R&&(C+="audio"),I&&(C+="video");let D={data1:h,startPTS:L,startDTS:L,endPTS:w,endDTS:w,type:C,hasAudio:R,hasVideo:I,nb:1,dropped:0,encrypted:!!m.audio&&m.audio.encrypted||!!m.video&&m.video.encrypted};u.audio=R&&!I?D:void 0,u.video=I?D:void 0;let x=null==v?void 0:v.sampleCount;if(x){let e=v.keyFrameIndex,t=-1!==e;D.nb=x,D.dropped=0===e||this.isVideoContiguous?0:t?e:x,D.independent=t,D.firstKeyFrame=e,t&&v.keyFrameStart&&(D.firstKeyFramePTS=(v.keyFrameStart-l.baseTime)/l.timescale),this.isVideoContiguous||(u.independent=t),this.isVideoContiguous||(this.isVideoContiguous=t),D.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${e}/${x} dropped: ${D.dropped} start: ${D.firstKeyFramePTS||"NA"}`)}return u.initSegment=c,u.id3=sY(i,a,l,l),r.samples.length&&(u.text=sz(r,a,l)),u}}},{demux:sP,remux:sq},{demux:class extends sc{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;let i=a7(e,0),r=(null==i?void 0:i.length)||0;if(s_(e,r))return!1;for(let i=e.length;r<i;r++)if(function(e,t){if(sr(e,t)){let i=st(e,t);if(t+i>=e.length)return!1;let r=si(e,t);if(r<=i)return!1;let a=t+r;return a===e.length||sr(e,a)}return!1}(e,r))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return t+5<e.length&&se(e,t)&&si(e,t)<=e.length-t}appendFrame(e,t,i){sa(e,this.observer,t,i,e.manifestCodec);let r=ss(e,t,i,this.basePTS,this.frameIndex);if(r&&0===r.missing)return r}},remux:sq},{demux:class extends sc{resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let t=a7(e,0),i=(null==t?void 0:t.length)||0;
6if(t&&11===e[i]&&119===e[i+1]&&void 0!==sd(t)&&16>=sS(e,i))return!1;for(let t=e.length;i<t;i++)if(s_(e,i))return t8.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return sT(e,t)&&4<=e.length-t}appendFrame(e,t,i){if(null!==this.basePTS)return sE(e,t,i,this.basePTS,this.frameIndex)}},remux:sq}];sZ.splice(2,0,{demux:class extends sc{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){let r=sk(e,t,i,this.basePTS,this.frameIndex);if(-1!==r)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;let t=a7(e,0);if(!t)return!1;let i=t.length;return!!(11===e[i]&&119===e[i+1]&&void 0!==sd(t)&&16>sS(e,i))}},remux:sq});class sJ{constructor(e,t,i,r,a,s){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=i,this.id=a,this.logger=s}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,i,r,a){var s,n;let o,l=r.transmuxing;l.executeStart=t();let d=new Uint8Array(e),{currentTransmuxState:u,transmuxConfig:h}=this;a&&(this.currentTransmuxState=a);let{contiguous:c,discontinuity:m,trackSwitch:f,accurateTimeOffset:g,timeOffset:v,initSegmentChange:y}=a||u,{audioCodec:E,videoCodec:b,defaultInitPts:T,duration:A,initSegmentData:_}=h,S=(s=d,n=i,o=null,s.byteLength>0&&(null==n?void 0:n.key)!=null&&null!==n.iv&&null!=n.method&&(o=n),o);if(S&&rj(S.method)){let e=this.getDecrypter(),i=rY(S.method);if(!e.isSync())return this.asyncResult=!0,this.decryptionPromise=e.webCryptoDecrypt(d,S.key.buffer,S.iv.buffer,i).then(e=>{let t=this.push(e,null,r);return this.decryptionPromise=null,t}),this.decryptionPromise;{let a=e.softwareDecrypt(d,S.key.buffer,S.iv.buffer,i);if(r.part>-1){let t=e.flush();a=t?t.buffer:t}if(!a)return l.executeEnd=t(),s0(r);d=new Uint8Array(a)}}let k=this.needsProbing(m,f);if(k){let e=this.configureTransmuxer(d);if(e)return this.logger.warn(`[transmuxer] ${e.message}`),this.observer.emit(tV.ERROR,tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),l.executeEnd=t(),s0(r)}(m||f||y||k)&&this.resetInitSegment(_,E,b,A,i),(m||y||k)&&this.resetInitialTimestamp(T),c||this.resetContiguity();let L=this.transmux(d,S,v,g,r);this.asyncResult=s1(L);let w=this.currentTransmuxState;return w.contiguous=!0,w.discontinuity=!1,w.trackSwitch=!1,l.executeEnd=t(),L}flush(e){let i=e.transmuxing;i.executeStart=t();let{decrypter:r,currentTransmuxState:a,decryptionPromise:s}=this;if(s)return this.asyncResult=!0,s.then(()=>this.flush(e));let n=[],{timeOffset:o}=a;if(r){let t=r.flush();t&&n.push(this.push(t.buffer,null,e))}let{demuxer:l,remuxer:d}=this;if(!l||!d){i.executeEnd=t();let r=[s0(e)];return this.asyncResult?Promise.resolve(r):r}let u=l.flush(o);return s1(u)?(this.asyncResult=!0,u.then(t=>(this.flushRemux(n,t,e),n))):(this.flushRemux(n,u,e),this.asyncResult)?Promise.resolve(n):n}flushRemux(e,i,r){let{audioTrack:a,videoTrack:s,id3Track:n,textTrack:o}=i,{accurateTimeOffset:l,timeOffset:d}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${r.sn}${r.part>-1?" part: "+r.part:""} of ${this.id===tj?"level":"track"} ${r.level}`);let u=this.remuxer.remux(a,s,n,o,d,l,!0,this.id);e.push({remuxResult:u,chunkMeta:r}),r.transmuxing.executeEnd=t()}resetInitialTimestamp(e){let{demuxer:t,remuxer:i}=this;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){let{demuxer:e,remuxer:t}=this;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,r,a){let{demuxer:s,remuxer:n}=this;s&&n&&(s.resetInitSegment(e,t,i,r),n.resetInitSegment(e,t,i,a))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,r,a){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,r,a):this.transmuxUnencrypted(e,i,r,a)}transmuxUnencrypted(e,t,i,r){let{audioTrack:a,videoTrack:s,id3Track:n,textTrack:o}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(a,s,n,o,t,i,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,i,r,a){return this.demuxer.demuxSampleAes(e,t,i).then(e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,i,r,!1,this.id),chunkMeta:a}))}
6configureTransmuxer(e){let t,{config:i,observer:r,typeSupported:a}=this;for(let i=0,r=sZ.length;i<r;i++){var s;if(null!=(s=sZ[i].demux)&&s.probe(e,this.logger)){t=sZ[i];break}}if(!t)return Error("Failed to find demuxer by probing fragment data");let n=this.demuxer,o=this.remuxer,l=t.remux,d=t.demux;o&&o instanceof l||(this.remuxer=new l(r,i,a,this.logger)),n&&n instanceof d||(this.demuxer=new d(r,i,a,this.logger),this.probe=d.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new rw(this.config)),e}}let s0=e=>({remuxResult:{},chunkMeta:e});function s1(e){return"then"in e&&e.then instanceof Function}class s2{constructor(e,t,i,r,a){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=r,this.defaultInitPts=a||null}}class s3{constructor(e,t,i,r,a,s){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=r,this.timeOffset=a,this.initSegmentChange=s}}let s4=0;class s5{constructor(e,t,i,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=s4++,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=e=>{let t=e.data,i=this.hls;if(i&&null!=t&&t.event&&t.instanceNo===this.instanceNo)switch(t.event){case"init":{var r;let e=null==(r=this.workerContext)?void 0:r.objectURL;e&&self.URL.revokeObjectURL(e);break}case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":i.logger[t.data.logType]&&i.logger[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.part=this.part,t.data.id=this.id,i.trigger(t.event,t.data)}},this.onWorkerError=e=>{if(!this.hls)return;let t=Error(`${e.message} (${e.filename}:${e.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(tV.ERROR,{type:t$.OTHER_ERROR,details:tH.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:t})};const a=e.config;this.hls=e,this.id=t,this.useWorker=!!a.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;const s=(e,t)=>{(t=t||{}).frag=this.frag||void 0,e===tV.ERROR&&(t.parent=this.id,t.part=this.part,this.error=t.error),this.hls.trigger(e,t)};this.observer=new a3,this.observer.on(tV.FRAG_DECRYPTED,s),this.observer.on(tV.ERROR,s);const n=iq(a.preferManagedMediaSource);if(this.useWorker&&"u">typeof Worker){const i=this.hls.logger;if(a.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{a.workerPath?(i.log(`loading Web Worker ${a.workerPath} for "${t}"`),this.workerContext=function(e){let t=a5[e];if(t)return t.clientCount++,t;let i=new self.URL(e,self.location.href).href,r={worker:new self.Worker(i),scriptURL:i,clientCount:1};return a5[e]=r,r}(a.workerPath)):(i.log(`injecting Web Worker for "${t}"`),this.workerContext=function(){let e=a5[a4];if(e)return e.clientCount++,e;let t=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),i=self.URL.createObjectURL(t),r={worker:new self.Worker(i),objectURL:i,clientCount:1};return a5[a4]=r,r}());const{worker:e}=this.workerContext;e.addEventListener("message",this.onWorkerMessage),e.addEventListener("error",this.onWorkerError),e.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:n,id:t,config:i5(a)})}catch(r){i.warn(`Error setting up "${t}" Web Worker, fallback to inline`,r),this.terminateWorker(),this.error=null,this.transmuxer=new sJ(this.observer,n,a,"",t,e.logger)}return}}this.transmuxer=new sJ(this.observer,n,a,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){let e=this.instanceNo;this.instanceNo=s4++;let t=this.hls.config,i=iq(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupp
6orted:i,id:this.id,config:i5(t)})}}terminateWorker(){if(this.workerContext){let{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),function(e){let t=a5[e||a4];if(t&&1==t.clientCount--){let{worker:i,objectURL:r}=t;delete a5[e||a4],r&&self.URL.revokeObjectURL(r),i.terminate()}}(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{let e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}let e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,r,a,s,n,o,l,d){var u,h;l.transmuxing.start=self.performance.now();let{instanceNo:c,transmuxer:m}=this,f=s?s.start:a.start,g=a.decryptdata,v=this.frag,y=!(v&&a.cc===v.cc),E=!(v&&l.level===v.level),b=v?l.sn-v.sn:-1,T=this.part?l.part-this.part.index:-1,A=0===b&&l.id>1&&l.id===(null==v?void 0:v.stats.chunkCount),_=!E&&(1===b||0===b&&(1===T||A&&T<=0)),S=self.performance.now();(E||b||0===a.stats.parsing.start)&&(a.stats.parsing.start=S),s&&(T||!_)&&(s.stats.parsing.start=S);let k=!(v&&(null==(u=a.initSegment)?void 0:u.url)===(null==(h=v.initSegment)?void 0:h.url)),L=new s3(y,_,o,E,f,k);if(!_||y||k){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${a.type} sn: ${l.sn}${l.part>-1?" part: "+l.part:""} ${this.id===tj?"level":"track"}: ${l.level} id: ${l.id} 7 discontinuity: ${y} 8 trackSwitch: ${E} 9 contiguous: ${_} 10 accurateTimeOffset: ${o} 11 timeOffset: ${f} 12 initSegmentChange: ${k}`);let e=new s2(i,r,t,n,d);this.configureTransmuxer(e)}if(this.frag=a,this.part=s,this.workerContext)this.workerContext.worker.postMessage({instanceNo:c,cmd:"demux",data:e,decryptdata:g,chunkMeta:l,state:L},e instanceof ArrayBuffer?[e]:[]);else if(m){let t=m.push(e,g,l,L);s1(t)?t.then(e=>{this.handleTransmuxComplete(e)}).catch(e=>{this.transmuxerError(e,l,"transmuxer-interface push error")}):this.handleTransmuxComplete(t)}}flush(e){e.transmuxing.start=self.performance.now();let{instanceNo:t,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(i){let t=i.flush(e);s1(t)?t.then(t=>{this.handleFlushResult(t,e)}).catch(t=>{this.transmuxerError(t,e,"transmuxer-interface flush error")}):this.handleFlushResult(t,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(e=>{this.handleTransmuxComplete(e)}),this.onFlush(t)}configureTransmuxer(e){let{instanceNo:t,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):i&&i.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}class s8 extends t1{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(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){let r=null==t?void 0:t.renditionReports;if(r){let a=-1;for(let i=0;i<r.length;i++){let s,n=r[i];try{s=new self.URL(n.URI,t.url).href}catch(e){this.warn(`Could not construct new URL for Rendition Report: ${e}`),s=n.URI||""}if(s===e){a=i;break}s===e.substring(0,s.length)&&(a=i)}if(-1!==a){let e=r[a],s=parseInt(e["LAST-MSN"])||t.lastPartSn,n=parseInt(e["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){let e=Math.min(t.age-t.partTarget,t.targetduration);n>=0&&e>t.partTarget&&(n+=1)}return new i2(s,n>=0?n:void 0,i&&i1(i))}}}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(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}return e}playlistLoaded(e,t,i){let{details:r,stats:a}=t,s=self.performance.now(),n=a.loading.first?Math.max(0,s-a.loading.first):0;r.advancedDateTime=Date.now()-n;let o=this.hls.config.timelineOffset;
12if(o!==r.appliedTimelineOffset){let e=Math.max(o||0,0);r.appliedTimelineOffset=e,r.fragments.forEach(t=>{t.setStart(t.playlistOffset+e)})}if(r.live||null!=i&&i.live){let o,d,u,h="levelInfo"in t?t.levelInfo:t.track;if(r.reloaded(i),i&&r.fragments.length>0){!function(e,t,i){let r;if(e===t)return;let a=null,s=e.fragments;for(let e=s.length-1;e>=0;e--){let t=s[e].initSegment;if(t){a=t;break}}e.fragmentHint&&delete e.fragmentHint.endPTS,function(e,t,i){let r=t.skippedSegments,a=Math.max(e.startSN,t.startSN)-t.startSN,s=+!!e.fragmentHint+(r?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,n=t.startSN-e.startSN,o=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let h=a;h<=s;h++){let a=l[n+h],s=o[h];if(r&&!s&&a&&(s=t.fragments[h]=a),a&&s){var d,u;i(a,s,h,o);let r=a.relurl,n=s.relurl;if(r&&(d=r)!==(u=n)&&u&&ax(d)!==ax(u)){t.playlistParsingError=aS(`media sequence mismatch ${s.sn}:`,e,t,a,s);return}if(a.cc!==s.cc){t.playlistParsingError=aS(`discontinuity sequence mismatch (${a.cc}!=${s.cc})`,e,t,a,s);return}}}}(e,t,(e,i,s,n)=>{if((!t.startCC||t.skippedSegments)&&i.cc!==e.cc){let r=e.cc-i.cc;for(let e=s;e<n.length;e++)n[e].cc+=r;t.endCC=n[n.length-1].cc}tU(e.startPTS)&&tU(e.endPTS)&&(i.setStart(i.startPTS=e.startPTS),i.startDTS=e.startDTS,i.maxStartPTS=e.maxStartPTS,i.endPTS=e.endPTS,i.endDTS=e.endDTS,i.minEndPTS=e.minEndPTS,i.setDuration(e.endPTS-e.startPTS),i.duration&&(r=i),t.PTSKnown=t.alignedSliding=!0),e.hasStream
12s&&(i.elementaryStreams=e.elementaryStreams),i.loader=e.loader,e.hasStats&&(i.stats=e.stats),e.initSegment&&(i.initSegment=e.initSegment,a=e.initSegment)});let n=t.fragments,o=t.fragmentHint?n.concat(t.fragmentHint):n;if(a&&o.forEach(e=>{var t;e&&(!e.initSegment||e.initSegment.relurl===(null==(t=a)?void 0:t.relurl))&&(e.initSegment=a)}),t.skippedSegments){if(t.deltaUpdateFailed=n.some(e=>!e),t.deltaUpdateFailed){i.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let e=t.skippedSegments;e--;)n.shift();t.startSN=n[0].sn}else{t.canSkipDateRanges&&(t.dateRanges=function(e,t,i){let{dateRanges:r,recentlyRemovedDateranges:a}=t,s=tZ({},e);a&&a.forEach(e=>{delete s[e]});let n=Object.keys(s).length;return n?(Object.keys(r).forEach(e=>{let t=s[e],a=new rG(r[e].attr,t);a.isValid?(s[e]=a,t||(a.tagOrder+=n)):i.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${i5(r[e].attr)}"`)}),s):r}(e.dateRanges,t,i));let r=e.fragments.filter(e=>e.rawProgramDateTime);if(e.hasProgramDateTime&&!t.hasProgramDateTime)for(let e=1;e<o.length;e++)null===o[e].programDateTime&&av(o[e],o[e-1],r);ac(r,t)}t.endCC=n[n.length-1].cc}if(!t.startCC){var l;let i=aR(e,t.startSN-1);t.startCC=null!=(l=null==i?void 0:i.cc)?l:n[0].cc}(function(e,t,i){if(e&&t){let r=0;for(let a=0,s=e.length;a<=s;a++){let s=e[a],n=t[a+r];s&&n&&s.index===n.index&&s.fragment.sn===n.fragment.sn?i(s,n):r--}}})(e.partList,t.partList,(e,t)=>{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats}),r?a_(t,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS,i):ak(e,t),n.length&&(t.totalduration=t.edge-n[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;let d=t.advancedDateTime;if(t.advanced&&d){let e=t.edge;t.driftStart||(t.driftStartTime=d,t.driftStart=e),t.driftEndTime=d,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime;-1===t.requestScheduled&&(t.requestScheduled=e.requestScheduled)}(i,r,this);let e=r.playlistParsingError;if(e){this.warn(e);let i=this.hls;if(!i.config.ignorePlaylistParsingErrors){var l;let{networkDetails:s}=t;i.trigger(tV.ERROR,{type:t$.NETWORK_ERROR,details:tH.LEVEL_PARSING_ERROR,fatal:!1,url:r.url,error:e,reason:e.message,level:t.level||void 0,parent:null==(l=r.fragments[0])?void 0:l.type,networkDetails:s,stats:a});return}r.playlistParsingError=null}}-1===r.requestScheduled&&(r.requestScheduled=a.loading.start);let c=this.hls.mainForwardBufferInfo,m=c?c.end-c.len:0,f=(r.edge-m)*1e3,g=aw(r,f);if(r.requestScheduled+g<s?r.requestScheduled=s:r.requestScheduled+=g,this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),!this.canLoad||!r.live)return;if(r.canBlockReload&&r.endSN&&r.advanced){let e=this.hls.config.lowLatencyMode,a=r.lastPartSn,n=r.endSN,l=r.lastPartIndex,c=a===n;-1!==l?c?(d=n+1,u=e?0:l):(d=a,u=e?l+1:r.maxPartIndex):d=n+1;let m=r.age,f=m+r.ageHeader,g=Math.min(f-r.partTarget,1.5*r.targetduration);if(g>0){if(f>3*r.targetduration)this.log(`Playlist last advanced ${m.toFixed(2)}s ago. Omitting segment and part directives.`),d=void 0,u=void 0;else if(null!=i&&i.tuneInGoal&&f-r.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${g} with playlist age: ${r.age}`),g=0;else{let e=Math.floor(g/r.targetduration);d+=e,void 0!==u&&(u+=Math.round(g%r.targetduration/r.partTarget)),this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${m.toFixed(2)}s goal: ${g} skip sn ${e} to part ${u}`)}r.tuneInGoal=g}if(o=this.getDeliveryDirectives(r,t.deliveryDirectives,d,u),e||!c){r.requestScheduled=s,this.loadingPlaylist(h,o);return}}else(r.canBlockReload||r.canSkipUntil)&&(o=this.getDeliveryDirectives(r,t.deliveryDirectives,d,u));o&&void 0!==d&&r.canBlockReload&&(r.requestScheduled=a.loading.first+Math.max(g-2*n,g/2)),this.scheduleLoading(h,o,r)}else this.clearTimer()}scheduleLoading(e,t,i){let r=i||e.details;if(!r)return void this.loadingPlaylist(e,t);let a=self.performance.now(),s=r.requestScheduled;if(a>=s)return void this.loadingPlaylist(e,t);let n=s-a;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(n)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),n)}getDeliveryDirectives(e,t,i,r){let a=i1(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,a=""),new i2(i,r,a)}checkRetry(e){let t=e.details,i=rl(e),r=e.errorAction,{action:a,retryCount:s=0,retryConfig:n}=r||{},o=!!r&&!!n&&(5===a||!r.resolved&&2===a);if(o){var l;if(s>=n.maxNumRetry)return!1;if(i&&null!=(l=e.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${s+1}/${n.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{let e=rc(n,s);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),e),this.warn(`Retrying playlist loading ${s+1}/${n.maxNumRetry} after "${t}" in ${e}ms`)}e.levelRetry=!0,r.resolved=!0}return o}}function s9(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!s6(e[i].attrs,t[i].attrs))return!1;return!0}function s6(e,t,i){let r=e["STABLE-RENDITION-ID"];return r&&!i?r===t["STABLE-RENDITION-ID"]:!(i||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>e[i]!==t[i])}function s7(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}class ne{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,i){if(null===this.queues||null===this.tracks)return;let r=this.queues[t];r.push(e),1!==r.length||i||this.executeNext(t)}appendBlocker(e){return new Promise(t=>{this.append({label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}},e)})}prependBlocker(e){return new Promise(t=>{this.queues&&this.queues[e].unshift({label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}})})}removeBlockers(){null!==this.queues&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEac
12h(e=>{var t;let i=null==(t=e[0])?void 0:t.label;("async-blocker"===i||"async-blocker-prepend"===i)&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){null===this.queues||this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(null===this.queues||null===this.tracks)return;let t=this.queues[e];if(t.length){let r=t[0];try{r.execute()}catch(a){var i;if(r.onError(a),null===this.queues||null===this.tracks)return;let t=null==(i=this.tracks[e])?void 0:i.buffer;null!=t&&t.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){null!==this.queues&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return(null==(t=this.queues)?void 0:t[e][0])||null}toString(){let{queues:e,tracks:t}=this;return null===e||null===t?"<destroyed>":` 13${this.list("video")} 14${this.list("audio")} 15${this.list("audiovideo")}}`}list(e){var t,i;return null!=(t=this.queues)&&t[e]||null!=(i=this.tracks)&&i[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;let i=null==(t=this.tracks)?void 0:t[e],r=null==i?void 0:i.buffer;return r?`SourceBuffer${r.updating?" updating":""}${i.ended?" ended":""}${i.ending?" ending":""}`:"none"}listOps(e){var t;return(null==(t=this.queues)?void 0:t[e].map(e=>e.label).join(", "))||""}}let nt=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,ni="HlsJsTrackRemovedError";class nr extends Error{constructor(e){super(e),this.name=ni}}function na(e){let t=e.querySelectorAll("source");[].slice.call(t).forEach(t=>{e.removeChild(t)})}function ns(e){return+("audio"===e)}class nn{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=1/0,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){let{hls:e}=this;e.on(tV.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(tV.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(tV.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tV.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(tV.BUFFER_CODECS,this.onBufferCodecs,this),e.on(tV.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){let{hls:e}=this;e.off(tV.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(tV.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(tV.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tV.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(tV.BUFFER_CODECS,this.onBufferCodecs,this),e.off(tV.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){let i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){let i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&tU(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}let e=this.hls.levels;if(e.length){let t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){let t=this.hls.levels;if(!t.length)return -1;let i=t.filter((t,i)=>this.isLevelAllowed(t)&&i<=e);return this.clientRect=null,nn.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=1/0,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=1/0,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;let e=this.media,t={width:0,height:0};if(e){let i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.
15width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height)}static getMaxLevelByMediaSize(e,t,i){if(!(null!=e&&e.length))return -1;let r=(e,t)=>!t||e.width!==t.width||e.height!==t.height,a=e.length-1,s=Math.max(t,i);for(let t=0;t<e.length;t+=1){let i=e[t];if((i.width>=s||i.height>=s)&&r(i,e[t+1])){a=t;break}}return a}}class no{constructor(e,t){Array.isArray(e)&&(e=e.map(e=>e instanceof no?e:new no(e))),this.value=e,this.params=t}}function nl(e,t,i){return Error(`failed to serialize "${Array.isArray(e)?JSON.stringify(e):e instanceof Map?"Map{}":e instanceof Set?"Set{}":"object"==typeof e?JSON.stringify(e):String(e)}" as ${t}`,{cause:i})}class nd{constructor(e){this.description=e}}let nu="Bare Item";function nh(e){if(e<-0x38d7ea4c67fff||0x38d7ea4c67fff<e)throw nl(e,"Integer");return e.toString()}let nc=/[\x00-\x1f\x7f]+/;function nm(e){let t=e.description||e.toString().slice(7,-1);if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw nl(t,"Token");return t}function nf(e){switch(typeof e){case"number":if(!tU(e))throw nl(e,nu);if(Number.isInteger(e))return nh(e);let t=function e(t,i){if(t<0)return-e(-t,i);let r=Math.pow(10,i);if(!(Math.abs(t*r%1-.5)<Number.EPSILON))return Math.round(t*r)/r;{let e=Math.floor(t*r);return(e%2==0?e:e+1)/r}}(e,3);if(Math.floor(Math.abs(t)).toString().length>12)throw nl(e,"Decimal");let i=t.toString();return i.includes(".")?i:`${i}.0`;case"string":if(nc.test(e))throw nl(e,"String");return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`;case"symbol":return nm(e);case"boolean":if("boolean"!=typeof e)throw nl(e,"Boolean");return e?"?1":"?0";case"object":if(e instanceof Date)return`@${nh(e.getTime()/1e3)}`;if(e instanceof Uint8Array){if(!1===ArrayBuffer.isView(e))throw nl(e,"Byte Sequence");return`:${btoa(String.fromCharCode(...e))}:`}if(e instanceof nd)return nm(e);default:throw nl(e,nu)}}function np(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw nl(e,"Key");return e}function ng(e){return null==e?"":Object.entries(e).map(([e,t])=>!0===t?`;${np(e)}`:`;${np(e)}=${nf(t)}`).join("")}function nv(e){return e instanceof no?`${nf(e.value)}${ng(e.params)}`:nf(e)}function ny(e,t){return function(e,t={whitespace:!0}){if("object"!=typeof e||null==e)throw nl(e,"Dict");let i=e instanceof Map?e.entries():Object.entries(e),r=(null==t?void 0:t.whitespace)?" ":"";return Array.from(i).map(([e,t])=>{t instanceof no==!1&&(t=new no(t));let i=np(e);if(!0===t.value)i+=ng(t.params);else if(i+="=",Array.isArray(t.value)){var r;i+=(r=t,`(${r.value.map(nv).join(" ")})${ng(r.params)}`)}else i+=nv(t);return i}).join(`,${r}`)}(e,t)}let nE="CMCD-Object",nb="CMCD-Request",nT="CMCD-Session",nA="CMCD-Status",n_={br:nE,ab:nE,d:nE,ot:nE,tb:nE,tpb:nE,lb:nE,tab:nE,lab:nE,url:nE,pb:nb,bl:nb,tbl:nb,dl:nb,ltc:nb,mtp:nb,nor:nb,nrr:nb,rc:nb,sn:nb,sta:nb,su:nb,ttfb
15:nb,ttfbb:nb,ttlb:nb,cmsdd:nb,cmsds:nb,smrt:nb,df:nb,cs:nb,ts:nb,cid:nT,pr:nT,sf:nT,sid:nT,st:nT,v:nT,msd:nT,bs:nA,bsd:nA,cdn:nA,rtp:nA,bg:nA,pt:nA,ec:nA,e:nA},nS="event",nk=e=>Math.round(e),nL=(e,t)=>Array.isArray(e)?e.map(e=>nL(e,t)):e instanceof no&&"string"==typeof e.value?new no(nL(e.value,t),e.params):(t.baseUrl&&(e=function(e,t){let i=new URL(e),r=new URL(t);if(i.origin!==r.origin)return e;let a=i.pathname.split("/").slice(1),s=r.pathname.split("/").slice(1,-1);for(;a[0]===s[0];)a.shift(),s.shift();for(;s.length;)s.shift(),a.unshift("..");return a.join("/")+i.search+i.hash}(e,t.baseUrl)),1===t.version?encodeURIComponent(e):e),nw=e=>100*nk(e/100),nR={br:nk,d:nk,bl:nw,dl:nw,mtp:nw,nor:(e,t)=>{let i=e;return t.version>=2&&(e instanceof no&&"string"==typeof e.value?i=new no([e]):"string"==typeof e&&(i=[e])),nL(i,t)},rtp:nw,tb:nk},nI="request",nC="response",nD=["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"],nx=["e"],nP=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function nM(e){return nP.test(e)}let nO=["d","dl","nor","ot","rtp","su"],nN=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"],nU=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function nF(e){return nU.includes(e)||nM(e)}let nB={[nC]:function(e){return nD.includes(e)||nO.includes(e)||nN.includes(e)||nM(e)},[nS]:function(e){return nD.includes(e)||nx.includes(e)||nM(e)},[nI]:function(e){return nD.includes(e)||nO.includes(e)||nM(e)}};function n$(e,t={}){let i={};if(null==e||"object"!=typeof e)return i;let r=t.version||e.v||1,a=t.reportingMode||nI,s=1===r?nF:nB[a],n=Object.keys(e).filter(s),o=t.filter;"function"==typeof o&&(n=n.filter(o));let l=a===nC||a===nS;l&&!n.includes("ts")&&n.push("ts"),r>1&&!n.includes("v")&&n.push("v");let d=tZ({},nR,t.formatters),u={version:r,reportingMode:a,baseUrl:t.baseUrl};return n.sort().forEach(t=>{var a;let s=e[t],n=d[t];if("function"==typeof n&&(s=n(s,u)),"v"===t)if(1===r)return;else s=r;("pr"!=t||1!==s)&&(l&&"ts"===t&&!tU(s)&&(s=Date.now()),("number"==typeof(a=s)?tU(a):null!=a&&""!==a&&!1!==a)&&(["ot","sf","st","e","sta"].includes(t)&&"string"==typeof s&&(s=new nd(s)),i[t]=s))}),i}let nH=/CMCD=[^&#]+/;function nV(e,t,i,r){e&&Object.keys(t).forEach(a=>{let s=e.filter(e=>e.groupId===a).map(e=>{let s=tZ({},e);return s.details=void 0,s.attrs=new rV(s.attrs),s.url=s.attrs.URI=nG(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",i),s.groupId=s.attrs["GROUP-ID"]=t[a],s.attrs["PATHWAY-ID"]=r,s});e.push(...s)})}function nG(e,t,i,r){let a,{HOST:s,PARAMS:n,[i]:o}=r;t&&(a=null==o?void 0:o[t])&&(e=a);let l=new self.URL(e);return s&&!a&&(l.host=s),n&&Object.keys(n).sort().forEach(e=>{e&&l.searchParams.set(e,n[e])}),l.href}class nW extends t1{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=nW.CDMCleanupPromise?[nW.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=e=>{let{initDataType:t,initData:i}=e,r=`"${e.type}" event: init data type: "${t}"`;if(this.debug(r),null!==i){if(!this.keyFormatPromise){let e=Object.keys(this.keySystemAccessPromises);e.length||(e=ae(this.config));let t=e.map(r7).filter(e=>!!e);this.keyFormatPromise=this.getKeyFormatPromise(t)}this.keyFormatPromise.then(a=>{let s,n=r6(a);if("sinf"!==t||n!==r1)return void this.log(`Ignoring "${e.type}" event with init data type: "${t}" for selected key-system ${n}`);try{let e=ig(new Uint8Array(i)),t=rz(JSON.parse(e).sinf),r=iR(t);if(!r)throw Error("'schm' box missing or not cbcs/cenc with schi > tenc");s=new Uint8Array(r.subarray(8,24))}catch(e){this.warn(`${r} Failed to parse sinf: ${e}`);return}let o=ie(s),{keyIdToKeySessionPromise:l,mediaKeySessions:d}=this,u=l[o];for(let e=0;e<d.length;e++){let r=d[e],a=r.decryptdata;if(!a.keyId)continue;let n=ie(a.keyId);if(rK(s,a.keyId)||-1!==a.uri.replace(/-/g,"").indexOf(o)){if(!(u=l[n]))continue;if(a.pssh)break;delete l[n],a.pssh=new Uint8Array(i),a.keyId=s,(u=l[o]=u.then(()=>this.generateRequestWithPreferredKeySession(r,t,i,"encrypted-event-key-match"))).catch(e=>this.handleError(e));break}}u||this.handleError(Error(`Key ID ${o} not encountered in playlist. Key-system sessions ${d.length}.`))}).catch(e=>this.handleError(e))}},this.onWaitingForKey=e=>{this.log(`"${e.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();let e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}
15registerListeners(){this.hls.on(tV.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(tV.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(tV.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(tV.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(tV.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(tV.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(tV.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(tV.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(tV.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(tV.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){let{drmSystems:t,widevineLicenseUrl:i}=this.config,r=null==t?void 0:t[e];return r?r.licenseUrl:e===r3&&i?i:void 0}getLicenseServerUrlOrThrow(e){let t=this.getLicenseServerUrl(e);if(void 0===t)throw Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){let{drmSystems:t}=this.config,i=null==t?void 0:t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){let t=this.hls.levels,i=(e,t,i)=>!!e&&i.indexOf(e)===t,r=t.map(e=>e.audioCodec).filter(i),a=t.map(e=>e.videoCodec).filter(i);return r.length+a.length===0&&a.push("avc1.42e01e"),new Promise((t,i)=>{let s=e=>{let n=e.shift();this.getMediaKeysPromise(n,r,a).then(e=>t({keySystem:n,mediaKeys:e})).catch(t=>{e.length?s(e):t instanceof nq?i(t):i(new nq({type:t$.KEY_SYSTEM_ERROR,details:tH.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))})};s(e)})}requestMediaKeySystemAccess(e,t){let{requestMediaKeySystemAccessFunc:i}=this.config;if("function"!=typeof i){let e=`Configured requestMediaKeySystemAccess is not a function ${i}`;return null===at&&"http:"===self.location.protocol&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(Error(e))}return i(e,t)}getMediaKeysPromise(e,t,i){var r;let a=function(e,t,i,r){var a,s,n,o;let l;switch(e){case r1:l=["cenc","sinf"];break;case r3:case r2:l=["cenc"];break;case r0:l=["cenc","keyids"];break;default:throw Error(`Unknown key-system: ${e}`)}return a=l,s=t,n=i,[{initDataTypes:a,persistentState:(o=r).persistentState||"optional",distinctiveIdentifier:o.distinctiveIdentifier||"optional",sessionTypes:o.sessionTypes||[o.sessionType||"temporary"],audioCapabilities:s.map(e=>({contentType:`audio/mp4; codecs=${e}`,robustness:o.audioRobustness||"",encryptionScheme:o.audioEncryptionScheme||null})),videoCapabilities:n.map(e=>({contentType:`video/mp4; codecs=${e}`,robustness:o.videoRobustness||"",encryptionScheme:o.videoEncryptionScheme||null}))}]}(e,t,i,this.config.drmSystemOptions||{}),s=this.keySystemAccessPromises[e],n=null==(r=s)?void 0:r.keySystemAccess;if(!n){this.log(`Requesting encrypted media "${e}" key-system access with config: ${i5(a)}`),n=this.requestMediaKeySystemAccess(e,a);let t=s=this.keySystemAccessPromises[e]={keySystemAccess:n};return n.catch(t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)}),n.then(i=>{this.log(`Access for key-system "${i.keySystem}" obtained`);let r=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);let a=t.mediaKeys=i.createMediaKeys().then(i=>(this.log(`Media-keys created for "${e}"`),t.hasMediaKeys=!0,r.then(t=>t?this.setMediaKeysServerCertificate(i,e,t):i)));return a.catch(t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)}),a})}return n.then(()=>s.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${ie(e.keyId||[])} keyUri: ${e.uri}`);let r=i.createSession(),a={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(a),a}renewKeySession(e){let t=e.decryptdata;if(t.pssh){let i=this.createMediaKeySessionContext(e),r=nK(t);this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,"cenc",t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){let i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyId ${ie(e.decryptdata.keyId||[])} 16 } (data length: ${t.byteLength})`),i.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>r7(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:e,mediaKeys:t})=>this.attemptSetMediaKeys(e,t))}selectKeySystem(e){return new Promise((t,i)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:e})=>{let r=r7(e);r?t(r):i(Error(`Unable to find format for key-system "${e}"`))}).catch(i)})}selectKeySystemFormat(e){let t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){let t=ae(this.config),i=e.map(r6).filter(e=>!!e&&-1!==t.indexOf(e));return this.selectKeySystem(i)}getKeyStatus(e){let{mediaKeySessions:t}=this;for(let a=0;a<t.length;a++){var i,r;let s=(i=e,r=t[a],i.keyId&&r.mediaKeysSession.keyStatuses.has(i.keyId)?r.mediaKeysSession.keyStatuses.get(i.keyId):i.matches(r.decryptdata)?r.keyStatus:void 0);if(s)return s}}loadKey(e){let t=e.keyInfo.decryptdata,i=nK(t),r=this.bannedKeyIds[i];if(r||"internal-error"===this.getKeyStatus(t)){let i=nj(r||"internal-error",t);return this.handleError(i,e.frag),Promise.reject(i)}let a=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${a}`);let s=this.keyIdToKeySessionPromise[i];if(!s){let r=this.getKeySystemForKeyPromise(t).then(({keySystem:i,mediaKeys:r})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${a}`),this.attemptSetMediaKeys(i,r).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:i,mediaKeys:r,decryptdata:t}))))).then(e=>{let i=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(e,"cenc",i,"playlist-key")});return r.catch(t=>this.handleError(t,e.frag)),this.keyIdToKeySessionPromise[i]=r,r}return s.catch(i=>{if(i instanceof nq){let r=t0({},i.data);"internal-error"===this.getKeyStatus(t)&&(r.decryptdata=t);let a=new nq(r,i.message);this.handleError(a,e.frag)}}),s}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof nq){t&&(e.data.frag=t);let i=e.data.decryptdata;this.error(`${e.message}${i?` (${ie(i.keyId||[])})`:""}`),this.hls.trigger(tV.ERROR,e.data)}else this.error(e.message),this.hls.trigger(tV.ERROR,{type:t$.KEY_SYSTEM_ERROR,details:tH.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}
16getKeySystemForKeyPromise(e){let t=nK(e),i=this.keyIdToKeySessionPromise[t];if(!i){let t=r6(e.keyFormat),i=t?[t]:ae(this.config);return this.attemptKeySystemAccess(i)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=ae(this.config)),0===e.length)throw new nq({type:t$.KEY_SYSTEM_ERROR,details:tH.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${i5({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();let i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);let r=Promise.all(i).then(()=>this.media?this.media.setMediaKeys(t):new Promise((e,i)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return i(Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(e).catch(i)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(e=>-1===i.indexOf(e))})}generateRequestWithPreferredKeySession(e,t,i,r){var a;let s=null==(a=this.config.drmSystems)||null==(a=a[e.keySystem])?void 0:a.generateRequest;if(s)try{let r=s.call(this.hls,t,i,e);if(!r)throw Error("Invalid response from configured generateRequest filter");t=r.initDataType,i=r.initData?r.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(e){if(this.warn(e.message),this.hls&&this.hls.config.debug)throw e}if(null===i)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);let n=nK(e.decryptdata),o=e.decryptdata.uri;this.log(`Generating key-session request for "${r}" keyId: ${n} URI: ${o} (init data type: ${t} length: ${i.byteLength})`);let l=new a3,d=e._onmessage=t=>{let i=e.mediaKeysSession;if(!i)return void l.emit("error",Error("invalid state"));let{messageType:r,message:a}=t;this.log(`"${r}" message event for session "${i.sessionId}" message size: ${a.byteLength}`),"license-request"===r||"license-renewal"===r?this.renewLicense(e,a).catch(e=>{l.eventNames().length?l.emit("error",e):this.handleError(e)}):"license-release"===r?e.keySystem===r1&&this.updateKeySession(e,rX("acknowledged")).then(()=>this.removeSession(e)).catch(e=>this.handleError(e)):this.warn(`unhandled media key message type "${r}"`)},u=(e,t)=>{let i;t.keyStatus=e,e.startsWith("usable")?l.emit("resolved"):"internal-error"===e||"output-restricted"===e||"output-downscaled"===e?i=nj(e,t.decryptdata):"expired"===e?i=Error(`key expired (keyId: ${n})`):"released"===e?i=Error("key released"):"status-pending"===e||this.warn(`unhandled key status change "${e}" (keyId: ${n})`),i&&(l.eventNames().length?l.emit("error",i):this.handleError(i))},h=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession)return void l.emit("error",Error("invalid state"));let i=this.getKeyStatuses(e);if(!Object.keys(i).some(e=>"status-pending"!==i[e]))return;if("expired"===i[n]){this.log(`Expired key ${i5(i)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let r=i[n];if(r)u(r,e);else{var a;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(a=e.keyStatusTimeouts)[n]||(a[n]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;let t=this.getKeyStatus(e.decryptdata);if(t&&"status-pending"!==t)return this.log(`No status for keyId ${n} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${t} from other session.`),u(t,e);this.log(`key status for ${n} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),u(r="internal-error",e)},1e3)),this.log(`No status for keyId ${n} (${i5(i)}).`)}};aF(e.mediaKeysSession,"message",d),aF(e.mediaKeysSession,"keystatuseschange",h);let c=new Promise((e,t)=>{l.on("error",t),l.on("resolved",e)});return e.mediaKeysSession.generateRequest(t,i).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${n} URI: ${o}`)}).catch(t=>{throw new nq({type:t$.KEY_SYSTEM_ERROR,details:tH.KEY_SYSTEM_NO_SESSION,error:t,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${t}`)}).then(()=>c).catch(t=>(l.removeAllListeners(),this.removeSession(e).then(()=>{throw t}))).then(()=>(l.removeAllListeners(),e))}getKeyStatuses(e){let t={};
16return e.mediaKeysSession.keyStatuses.forEach((i,r)=>{if("string"==typeof r&&"object"==typeof i){let e=r;r=i,i=e}let a="buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r);e.keySystem===r2&&16===a.length&&(t[ie(a)]=i,rQ(a));let s=ie(a);"internal-error"===i&&(this.bannedKeyIds[s]=i),this.log(`key status change "${i}" for keyStatuses keyId: ${s} key-session "${e.mediaKeysSession.sessionId}"`),t[s]=i}),t}fetchServerCertificate(e){let t=this.config,i=new t.loader(t),r=this.getServerCertificateUrl(e);return r?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,s)=>{let n={responseType:"arraybuffer",url:r},o=t.certLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};i.load(n,l,{onSuccess:(e,t,i,r)=>{a(e.data)},onError:(t,i,a,o)=>{s(new nq({type:t$.KEY_SYSTEM_ERROR,details:tH.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:t0({url:n.url,data:void 0},t)},`"${e}" certificate request failed (${r}). Status: ${t.code} (${t.text})`))},onTimeout:(t,i,a)=>{s(new nq({type:t$.KEY_SYSTEM_ERROR,details:tH.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:n.url,data:void 0}},`"${e}" certificate request timed out (${r})`))},onAbort:(e,t,i)=>{s(Error("aborted"))}})})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((r,a)=>{e.setServerCertificate(i).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${i.byteLength}) on "${t}"`),r(e)}).catch(e=>{a(new nq({type:t$.KEY_SYSTEM_ERROR,details:tH.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(t=>this.updateKeySession(e,new Uint8Array(t)).catch(t=>{throw new nq({type:t$.KEY_SYSTEM_ERROR,details:tH.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:t,fatal:!1},t.message)}))}unpackPlayReadyKeyMessage(e,t){let i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;let r=new DOMParser().parseFromString(i,"application/xml"),a=r.querySelectorAll("HttpHeader");if(a.length>0){let t;for(let i=0,r=a.length;i<r;i++){var s,n;let r=null==(s=(t=a[i]).querySelector("name"))?void 0:s.textContent,o=null==(n=t.querySelector("value"))?void 0:n.textContent;r&&o&&e.setRequestHeader(r,o)}}let o=r.querySelector("Challenge"),l=null==o?void 0:o.textContent;if(!l)throw Error("Cannot find <Challenge> in key message");return rX(atob(l))}setupLicenseXHR(e,t,i,r){let a=this.config.licenseXhrSetup;return a?Promise.resolve().then(()=>{if(!i.decryptdata)throw Error("Key removed");return a.call(this.hls,e,t,i,r)}).catch(s=>{if(!i.decryptdata)throw s;return e.open("POST",t,!0),a.call(this.hls,e,t,i,r)}).then(i=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:i||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){let i=this.config.keyLoadPolicy.default;return new Promise((r,a)=>{let s=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${s}`);let n=new XMLHttpRequest;n.responseType="arraybuffer",n.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return a(Error("invalid state"));if(4===n.readyState)if(200===n.status){this._requestLicenseFailureCount=0;let t=n.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);let i=this.config.licenseResponseCallback;if(i)try{t=i.call(this.hls,n,s,e)}catch(e){this.error(e)}r(t)}else{let o=i.errorRetry,l=o?o.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||n.status>=400&&n.status<500)a(new nq({type:t$.KEY_SYSTEM_ERROR,details:tH.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:n,response:{url:s,data:void 0,code:n.status,text:n.statusText}},`License Request XHR failed (${s}). Status: ${n.status} (${n.statusText})`));else{let i=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${i} attempts left`),this.requestLicense(e,t).then(r,a)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=n,this.setupLicenseXHR(n,s,e,t).then(({xhr:t,licenseChallenge:i})=>{e.keySystem==r2&&(i=this.unpackPlayReadyKeyMessage(t,i)),t.send(i)}).catch(a)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;let i=t.media;this.media=i,aF(i,"encrypted",this.onMediaEncrypted),aF(i,"waitingforkey",this.onWaitingForKey);let r=this.mediaResolved;r?r():this.mediaKeys=i.mediaKeys}onMediaDetached(){let e=this.media;e&&(aB(e,"encrypted",this.onMediaEncrypted),aB(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};let t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;let i=this.media,r=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,aa.clearKeyUriToKeyIdMap();let a=r.length;nW.CDMCleanupPromise=Promise.all(r.map(e=>this.removeSession(e)).concat((null==i||null==(e=i.setMediaKeys(null))?void 0:e.catch(e=>
16{this.log(`Could not clear media keys: ${e}`),this.hls&&this.hls.trigger(tV.ERROR,{type:t$.OTHER_ERROR,details:tH.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:Error(`Could not clear media keys: ${e}`)})}))||Promise.resolve())).catch(e=>{this.log(`Could not close sessions and clear media keys: ${e}`),this.hls&&this.hls.trigger(tV.ERROR,{type:t$.OTHER_ERROR,details:tH.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:Error(`Could not close sessions and clear media keys: ${e}`)})}).then(()=>{a&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:t}){if(t&&this.config.emeEnabled&&!this.keyFormatPromise){let e=t.reduce((e,t)=>(-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e),[]);this.log(`Selecting key-system from session-keys ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){let{mediaKeysSession:t,licenseXhr:i,decryptdata:r}=e;if(t){var a;this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${ie((null==r?void 0:r.keyId)||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;let s=this.mediaKeySessions.indexOf(e);s>-1&&this.mediaKeySessions.splice(s,1);let{keyStatusTimeouts:n}=e;n&&Object.keys(n).forEach(e=>self.clearTimeout(n[e]));let{drmSystemOptions:o}=this.config;return(o&&("persistent-license"===o.sessionType||null!=(a=o.sessionTypes)&&a.some(e=>"persistent-license"===e))?new Promise((e,i)=>{self.setTimeout(()=>i(Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(e).catch(i)}):Promise.resolve()).catch(e=>{this.log(`Could not remove session: ${e}`),this.hls&&this.hls.trigger(tV.ERROR,{type:t$.OTHER_ERROR,details:tH.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:Error(`Could not remove session: ${e}`)})}).then(()=>t.close()).catch(e=>{this.log(`Could not close session: ${e}`),this.hls&&this.hls.trigger(tV.ERROR,{type:t$.OTHER_ERROR,details:tH.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:Error(`Could not close session: ${e}`)})})}return Promise.resolve()}}function nK(e){if(!e)throw Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw Error("keyId is null");return ie(e.keyId)}nW.CDMCleanupPromise=void 0;class nq extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=Error(t)),this.data=e,e.err=e.error}}function nj(e,t){let i="output-restricted"===e,r=i?tH.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:tH.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new nq({type:t$.KEY_SYSTEM_ERROR,details:r,fatal:!1,decryptdata:t},i?"HDCP level output restricted":`key status changed to "${e}"`)}function nY(e,t){let i;try{i=new Event("addtrack")}catch(e){(i=document.createEvent("Event")).initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function nz(e,t){let i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw Error(`addCue is failed for: ${t}`)}catch(i){t8.debug(`[texttrack-utils]: ${i}`);try{let i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(e){t8.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${e}`)}}"disabled"===i&&(e.mode=i)}function nX(e,t){let i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues)for(let i=e.cues.length;i--;)t&&e.cues[i].removeEventListener("enter",t),e.removeCue(e.cues[i]);"disabled"===i&&(e.mode=i)}function nQ(e,t,i,r){let a=e.mode;if("disabled"===a&&(e.mode="hidden"),e.cues&&e.cues.length>0){let a=function(e,t,i){let r=[],a=function(e,t){let i;if(t<=e[0].startTime)return 0;let r=e.length-1;if(t>e[r].endTime)return -1;let a=0,s=r;for(;a<=s;)if(t<e[i=Math.floor((s+a)/2)].startTime)s=i-1;else{if(!(t>e[i].startTime)||!(a<r))return i;a=i+1}return e[a].startTime-t<t-e[s].startTime?a:s}(e,t);if(a>-1)for(let s=a,n=e.length;s<n;s++){let a=e[s];if(a.startTime>=t&&a.endTime<=i)r.push(a);else if(a.startTime>i)break}return r}(e.cues,t,i);for(let t=0;t<a.length;t++)(!r||r(a[t]))&&e.removeCue(a[t])}"disabled"===a&&(e.mode=a)}function nZ(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i];("subtitles"===r.kind||"captions"===r.kind)&&r.label&&t.push(e[i])}return t}function nJ(e){let t=5381,i=e.length;for(;i;)t=33*t^e.charCodeAt(--i);return(t>>>0).toString()}let n0=((dn={})[dn.Point=0]="Point",dn[dn.Range=1]="Range",dn);
16class n1{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,null==(e=this.assetListLoader)||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;let i=this.playoutLimit;return!(e<=0||isNaN(i))&&(0===i||((null==(t=this.assetList[e])?void 0:t.startOffset)||0)>i)}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){let e=this.dateRange.startTime;if(this.snapOptions.out){let t=this.dateRange.tagAnchor;if(t)return n2(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(0===this.startTime||this.snapOptions.out)return!0;let e=this.dateRange.tagAnchor;if(e){let t=this.dateRange.startTime,i=n2(t,e);return t-i<.1}return!1}get resumptionOffset(){let e=this.resumeOffset,t=tU(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){let e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){let t=this.resumeAnchor;if(t)return n2(e,t)}return e}get appendInPlace(){return!!this.appendInPlaceStarted||!this.appendInPlaceDisabled&&!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&.025>Math.abs(this.resumeOffset-this.duration)))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return null!==this._timelineStart?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){let e,t=this.playoutLimit;return e=null!==this._duration?this._duration:this.dateRange.duration?this.dateRange.duration:this.dateRange.plannedDuration||0,!isNaN(t)&&t<e&&(e=t),e}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return"RANGE"===this.dateRange.attr["X-TIMELINE-OCCUPIES"]?n0.Range:n0.Point}get supplementsPrimary(){return"PRIMARY"===this.dateRange.attr["X-TIMELINE-STYLE"]}get contentMayVary(){return"NO"!==this.dateRange.attr["X-CONTENT-MAY-VARY"]}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||null!==this.assetListResponse}toString(){var e;return e=this,`["${e.identifier}" ${e.cue.pre?"<pre>":e.cue.post?"<post>":""}${e.timelineStart.toFixed(2)}-${e.resumeTime.toFixed(2)}]`}}function n2(e,t){return e-t.start<t.duration/2&&!(.025>Math.abs(e-(t.start+t.duration)))?t.start:t.start+t.duration}function n3(e,t,i){let r=new self.URL(e,i);return"data:"!==r.protocol&&r.searchParams.set("_HLS_primary_id",t),r}function n4(e,t){for(;null!=(i=e.assetList[++t])&&i.error;)var i;return t}function n5(e){let t=e.timelineStart,i=e.duration||0;return`["${e.identifier}" ${t.toFixed(2)}-${(t+i).toFixed(2)}]`}class n8{constructor(e,t,i,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(tV.PLAYOUT_LIMIT_REACHED,{})};const a=this.hls=new e(t);this.interstitial=i,this.assetItem=r;const s=()=>
16{this.hasDetails=!0};a.once(tV.LEVEL_LOADED,s),a.once(tV.AUDIO_TRACK_LOADED,s),a.once(tV.SUBTITLE_TRACK_LOADED,s),a.on(tV.MEDIA_ATTACHING,(e,{media:t})=>{this.removeMediaListeners(),this.mediaAttached=t,this.interstitial.playoutLimit&&(t.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&a.on(tV.BUFFER_APPENDED,()=>{let e=this.bufferedEnd;this.reachedPlayout(e)&&(this._bufferedEosTime=e,a.trigger(tV.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){let 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=n3(t,e.config.primarySessionId||"").href}catch(e){}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if(null!=(t=this.hls)&&t.bufferedToEnd)return!0;if(!e)return!1;let i=Math.min(this._bufferedEosTime||1/0,this.duration),r=this.timelineOffset,a=rN.bufferInfo(e,r,0);return this.getAssetTime(a.end)>=i-.02}reachedPlayout(e){let t=this.interstitial.playoutLimit;return this.startOffset+e>=t}get destroyed(){var e;return!(null!=(e=this.hls)&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return(null==(e=this.hls)?void 0:e.media)||null}get bufferedEnd(){let e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;let t=rN.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){let e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){let e=this.assetItem.duration;if(!e)return 0;let t=this.interstitial.playoutLimit;if(t){let i=t-this.startOffset;if(i>0&&i<e)return i}return e}get remaining(){let e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return(null==(e=this.hls)?void 0:e.config.timelineOffset)||0}set timelineOffset(e){let t=this.timelineOffset;if(e!==t&&Math.abs(e-t)>1/9e4&&this.hls){if(this.hasDetails)throw Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}getAssetTime(e){return Math.min(Math.max(0,e-this.timelineOffset),this.duration)}removeMediaListeners(){let e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;null!=(e=this.hls)&&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(),null==(t=this.hls)||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,null==(e=this.hls)||e.detachMedia()}resumeBuffering(){var e;null==(e=this.hls)||e.resumeBuffering()}pauseBuffering(){var e;null==(e=this.hls)||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),(null==(e=this.hls)?void 0:e.transferMedia())||null}resetDetails(){let e=this.hls;if(e&&this.hasDetails){e.stopLoad();let t=e=>delete e.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,i){var r;null==(r=this.hls)||r.on(e,t)}once(e,t,i){var r;null==(r=this.hls)||r.once(e,t)}off(e,t,i){var r;null==(r=this.hls)||r.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${n5(this.assetItem)} ${null==(e=this.hls)?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}class n9 extends t1{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((i,r)=>e<=r.startOffset&&t>r.startOffset?(delete r.error,i+1):i,0):0}get duration(){let e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.i
16dentifier);let i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);let r=this.items;if(r)for(r[i]||(void 0===t&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&null!=(a=r[i])&&a.event;){var a;i--}return i}findItemIndexAtTime(e,t){let i=this.items;if(i)for(let r=0;r<i.length;r++){let a=i[r];if(t&&"primary"!==t&&(a=a[t]),e===a.start||e>a.start&&e<a.end)return r}return -1}findJumpRestrictedIndex(e,t){let i=this.items;if(i)for(let r=e;r<=t&&i[r];r++){let e=i[r].event;if(null!=e&&e.restrictions.jump&&!e.appendInPlace)return r}return -1}findEventIndex(e){let t=this.items;if(t)for(let r=t.length;r--;){var i;if((null==(i=t[r].event)?void 0:i.identifier)===e)return r}return -1}findAssetIndex(e,t){let i=e.assetList,r=i.length;if(r>1)for(let e=0;e<r;e++){let a=i[e];if(!a.error){let i=a.timelineStart;if(t===i||t>i&&(t<i+(a.duration||0)||e===r-1))return e}}return 0}get assetIdAtEnd(){var e;let t=null==(e=this.items)||null==(e=e[this.length-1])?void 0:e.event;if(t){let e=t.assetList,i=e[e.length-1];if(i)return i.identifier}return null}parseInterstitialDateRanges(e,t){let i=e.main.details,{dateRanges:r}=i,a=this.events,s=this.parseDateRanges(r,{url:i.url},t),n=Object.keys(r),o=a?a.filter(e=>!n.includes(e.identifier)):[];s.length&&s.sort((e,t)=>{let i=e.cue.pre,r=e.cue.post,a=t.cue.pre,s=t.cue.post;if(i&&!a)return -1;if(a&&!i||r&&!s)return 1;if(s&&!r)return -1;if(!i&&!a&&!r&&!s){let i=e.startTime,r=t.startTime;if(i!==r)return i-r}return e.dateRange.tagOrder-t.dateRange.tagOrder}),this.events=s,o.forEach(e=>{this.removeEvent(e)}),this.updateSchedule(e,o)}updateSchedule(e,t=[],i=!1){let r=this.events||[];
16if(r.length||t.length||this.length<2){let a=this.items,s=this.parseSchedule(r,e);(i||t.length||(null==a?void 0:a.length)!==s.length||s.some((e,t)=>Math.abs(e.playout.start-a[t].playout.start)>.005||Math.abs(e.playout.end-a[t].playout.end)>.005))&&(this.items=s,this.onScheduleUpdate(t,a))}}parseDateRanges(e,t,i){let r=[],a=Object.keys(e);for(let s=0;s<a.length;s++){let n=a[s],o=e[n];if(o.isInterstitial){let e=this.eventMap[n];e?e.setDateRange(o):(e=new n1(o,t),this.eventMap[n]=e,!1===i&&(e.appendInPlace=i)),r.push(e)}}return r}parseSchedule(e,t){let i=[],r=t.main.details,a=r.live?1/0:r.edge,s=0;if((e=e.filter(e=>!e.error&&!(e.cue.once&&e.hasPlayed))).length){this.resolveOffsets(e,t);let r=0,o=0;if(e.forEach((t,n)=>{let l=t.cue.pre,d=t.cue.post,u=e[n-1]||null,h=t.appendInPlace,c=d?a:t.startOffset,m=t.duration,f=t.timelineOccupancy===n0.Range?m:0,g=t.resumptionOffset,v=(null==u?void 0:u.startTime)===c,y=c+t.cumulativeDuration,E=h?y+m:c+g;if(l||!d&&c<=0){let e=o;o+=f,t.timelineStart=y;let r=s;s+=m,i.push({event:t,start:y,end:E,playout:{start:r,end:s},integrated:{start:e,end:o}})}else{if(!(c<=a))return;if(!v){let a=c-r;if(a>.033){let l=r,d=o;o+=a;let u=s;s+=a;let h={previousEvent:e[n-1]||null,nextEvent:t,start:l,end:l+a,playout:{start:u,end:s},integrated:{start:d,end:o}};i.push(h)}else a>0&&u&&(u.cumulativeDuration+=a,i[i.length-1].end=c)}d&&(E=y),t.timelineStart=y;let l=o;o+=f;let h=s;s+=m,i.push({event:t,start:y,end:E,playout:{start:h,end:s},integrated:{start:l,end:o}})}let b=t.resumeTime;r=d||b>a?a:b}),r<a){var n;let e=r,t=o,l=a-r;o+=l;let d=s;s+=l,i.push({previousEvent:(null==(n=i[i.length-1])?void 0:n.event)||null,nextEvent:null,start:r,end:e+l,playout:{start:d,end:s},integrated:{start:t,end:o}})}this.setDurations(a,s,o)}else i.push({previousEvent:null,nextEvent:null,start:0,end:a,playout:{start:0,end:a},integrated:{start:0,end:a}}),this.setDurations(a,a,a);return i}setDurations(e,t,i){this.durations={primary:e,playout:t,integrated:i}}resolveOffsets(e,t){let i=t.main.details,r=i.live?1/0:i.edge,a=0,s=-1;e.forEach((n,o)=>{let l=n.cue.pre,d=n.cue.post,u=l?0:d?r:n.startTime;this.updateAssetDurations(n),s===u?n.cumulativeDuration=a:(a=0,s=u),!d&&n.snapOptions.in&&(n.resumeAnchor=rs(null,i.fragments,n.startOffset+n.resumptionOffset,0,0)||void 0),n.appendInPlace&&!n.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(n,t)||(n.appendInPlace=!1)),!n.appendInPlace&&o+1<e.length&&e[o+1].startTime-e[o].resumeTime<.033&&(e[o+1].appendInPlace=!1,e[o+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${n}`));let h=tU(n.resumeOffset)?n.resumeOffset:n.duration;a+=h})}primaryCanResumeInPlaceAt(e,t){let i=e.resumeTime,r=e.startTime+e.resumptionOffset;return Math.abs(i-r)>.025?(this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${r}`),!1):!Object.keys(t).some(r=>{let a=t[r].details,s=a.edge;if(i>=s)return this.log(`"${e.identifier}" resumption ${i} past ${r} playlist end ${s}`),!1;let n=rs(null,a.fragments,i);if(!n)return this.log(`"${e.identifier}" resumption ${i} does not align with any fragments in ${r} playlist (${a.fragStart}-${a.fragmentEnd})`),!0;let o=.175*("audio"===r);return!(Math.abs(n.start-i)<.025+o||Math.abs(n.end-i)<.025+o)&&(this.log(`"${e.identifier}" resumption ${i} not aligned with ${r} fragment bounds (${n.start}-${n.end} sn: ${n.sn} cc: ${n.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;let t=e.timelineStart,i=0,r=!1,a=!1;for(let s=0;s<e.assetList.length;s++){let n=e.assetList[s],o=t+i;n.startOffset=i,n.timelineStart=o,r||(r=null===n.duration),a||(a=!!n.error),i+=n.error?0:n.duration||0}r&&!a?e.duration=Math.max(i,e.duration):e.duration=i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function n6(e){return`[${e.event?'"'+e.event.identifier+'"':"primary"}: ${e.start.toFixed(2)}-${e.end.toFixed(2)}]`}class n7{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){let i,r=e.assetListUrl;try{i=n3(r,this.hls.sessionId,e.baseUrl)}catch(i){let t=this.assignAssetListError(e,tH.ASSET_LIST_LOAD_ERROR,i,r);this.hls.trigger(tV.ERROR,t);return}t&&"data:"!==i.protocol&&i.searchParams.set("_HLS_start_offset",""+t);let a=this.hls.config,s=new a.loader(a),n={responseType:"json",url:i.href},o=a.interstitialAssetListLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};return s.load(n,l,{onSuccess:(t,i,r,a)=>{let s=t.data;if(!Array.isArray(null==s?void 0:s.ASSETS)){let t=this.assignAssetListError(e,tH.ASSET_LIST_PARSING_ERROR,Error("Invalid interstitial asset list"),r.url,i,a);this.hls.trigger(tV.ERROR,t);return}e.assetListResponse=s,this.hls.trigger(tV.ASSET_LIST_LOADED,{event:e,assetListResponse:s,networkDetails:a})},onError:(t,i,r,a)=>{let s=this.assignAssetListError(e,tH.ASSET_LIST_LOAD_ERROR,Error(`Error loading X-ASSET-LIST: HTTP status ${t.code} ${t.text} (${i.url})`),i.url,a,r);this.hls.trigger(tV.ERROR,s)},onTimeout:(t,i,r)=>{let a=this.assignAssetListError(e,tH.ASSET_LIST_LOAD_TIMEOUT,Error(`Timeout loading X-ASSET-LIST (${i.url})`),i.url,t,r);this.hls.trigger(tV.ERROR,a)}}),this.hls.trigger(tV.ASSET_LIST_LOADING,{event:e}),s}assignAssetListError(e,t,i,r,a,s){return e.error=i,{type:t$.NETWORK_E
16RROR,details:t,fatal:!1,interstitial:e,url:r,error:i,networkDetails:s,stats:a}}}function oe(e){var t;null==e||null==(t=e.play())||t.catch(()=>{})}function ot(e,t){return`[${e}] Advancing timeline position to ${t}`}class oi{constructor(e){this.buffered=void 0;const t=(t,i,r)=>{if((i>>>=0)>r-1)throw new DOMException(`Failed to execute '${t}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${r})`);return e[i][t]};this.buffered={get length(){return e.length},end:i=>t("end",i,e.length),start:i=>t("start",i,e.length)}}}let or={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},oa=e=>String.fromCharCode(or[e]||e),os={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},on={17:2,18:4,21:6,22:8,23:10,19:13,20:15},oo={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},ol={25:2,26:4,29:6,30:8,31:10,27:13,28:15},od=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class ou{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){let i="function"==typeof t?t():t;t8.log(`${this.time} [${e}] ${i}`)}}}let oh=function(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class oc{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){let t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){let r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}}isDefault(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class om{constructor(){this.uchar=" ",this.penState=new oc}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 of{constructor(e){this.chars=[],this.pos=0,this.currPenState=new oc,this.cueStartTime=null,this.logger=void 0;for(let e=0;e<100;e++)this.chars.push(new om);this.logger=e}equals(e){for(let t=0;t<100;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<100;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<100;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>100&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=100)}moveCursor(e){let t=this.pos+e;if(e>1)for(let e=this.pos+1;e<t+1;e++)this.chars[e].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();let t=oa(e);this.pos>=100?this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))}clearFromPos(e){let t;for(t=e;t<100;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){let e=[],t=!0;for(let i=0;i<100;i++){let r=this.chars[i].uchar;" "!==r&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class op{constructor(e){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<15;t++)this.rows.push(new of(e));this.logger=e}reset(){for(let e=0;e<15;e++)this.rows[e].clear();this.currRow=14}equals(e){let t=!0;for(let i=0;i<15;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<15;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<15;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+i5(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let e=0;e<15;e++)this.rows[e].clear();let e=this.currRow+1-this.nrRollUpRows,i=this.lastOutputScreen;if(i){let r=i.rows[e].cueStartTime,a=this.logger.time;if(null!==r&&null!==a&&r<a)for(let r=0;r<this.nrRollUpRows;r++)this.rows[t-this.nrRollUpRows+r+1].copy(i.rows[e+r])}}this.currRow=t;let i=this.rows[this.currRow];if(null!==e.indent){let t=Math.max(e.indent-1,0);i.setCursor(e.indent),e.color=i.chars[t].penState.foreground}let r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+i5(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,()=>this.getDisplayText());let e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;let t=[],i="",r=-1;for(let i=0;i<15;i++){let a=this.rows[i].getTextString();a&&(r=i+1,e?t.push("Row "+r+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(i=e?"["+t.join(" | ")+"]":t.join("\n")),i}getTextAndFormat(){return this.rows}}class og{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new op(i),this.nonDisplayedMemory=new op(i),this.lastOutputScreen=new op(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);let t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),("MODE_PAINT-ON"===this.mode||"MODE_ROLL-UP"===this.mode)&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}
16ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){let e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){let t={flash:!1};(t.underline=e%2==1,t.italics=e>=46,t.italics)?t.foreground="white":t.foreground=["white","green","blue","cyan","red","yellow","magenta"][Math.floor(e/2)-16],this.logger.log(2,"MIDROW: "+i5(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){let t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&!this.displayedMemory.isEmpty()&&(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e)}}class ov{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const r=this.logger=new ou;this.channels=[null,new og(e,t,r),new og(e+1,i,r)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let e=0;e<t.length;e+=2){var i,r,a,s,n,o,l,d;let u=127&t[e],h=127&t[e+1],c=!1,m=null;if(0===u&&0===h)continue;this.logger.log(3,()=>"["+oh([t[e],t[e+1]])+"] -> ("+oh([u,h])+")");let f=this.cmdHistory;if(u>=16&&u<=31){if(i=u,r=h,(a=f).a===i&&a.b===r){(s=f).a=null,s.b=null,this.logger.log(3,()=>"Repeated command ("+oh([u,h])+") is dropped");continue}n=u,o=h,(l=this.cmdHistory).a=n,l.b=o,(c=this.parseCmd(u,h))||(c=this.parseMidrow(u,h)),c||(c=this.parsePAC(u,h)),c||(c=this.parseBackgroundAttributes(u,h))}else{(d=f).a=null,d.b=null}if(!c&&(m=this.parseChars(u,h))){let e=this.currentChannel;e&&e>0?this.channels[e].insertChars(m):this.logger.log(2,"No channel found yet. TEXT-MODE?")}c||m||this.logger.log(2,()=>"Couldn't parse cleaned data "+oh([u,h])+" orig: "+oh([t[e],t[e+1]]))}}parseCmd(e,t){if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=33&&t<=35))return!1;let i=20===e||21===e||23===e?1:2,r=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?r.ccRCL():33===t?r.ccBS():34===t?r.ccAOF():35===t?r.ccAON():36===t?r.ccDER():37===t?r.ccRU(2):38===t?r.ccRU(3):39===t?r.ccRU(4):40===t?r.ccFON():41===t?r.ccRDC():42===t?r.ccTR():43===t?r.ccRTD():44===t?r.ccEDM():45===t?r.ccCR():46===t?r.ccENM():47===t&&r.ccEOC():r.ccTO(t-32),this.currentChannel=i,!0}parseMidrow(e,t){let i=0;if((17===e||25===e)&&t>=32&&t<=47){if((i=17===e?1:2)!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;let r=this.channels[i];return!!r&&(r.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+oh([e,t])+")"),!0)}return!1}parsePAC(e,t){let i,r=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,a=(16===e||24===e)&&t>=64&&t<=95;if(!(r||a))return!1;let s=e<=23?1:2;i=t>=64&&t<=95?1===s?os[e]:oo[e]:1===s?on[e]:ol[e];let n=this.channels[s];return!!n&&(n.setPAC(this.interpretPAC(i,t)),this.currentChannel=s,!0)}interpretPAC(e,t){let i,r={color:null,italics:!1,indent:null,underline:!1,row:e};return r.underline=(1&(i=t>95?t-96:t-64))==1,i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((i-16)/2),r}parseChars(e,t){let i,r=null,a=null;if(e>=25?(i=2,a=e-8):(i=1,a=e),a>=17&&a<=19){let e;e=17===a?t+80:18===a?t+112:t+144,this.logger.log(2,()=>"Special char '"+oa(e)+"' in channel "+i),r=[e]}else e>=32&&e<=127&&(r=0===t?[e]:[e,t]);return r&&this.logger.log(3,()=>"Char codes = "+oh(r).join(",")),r}
16parseBackgroundAttributes(e,t){if(!((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47))return!1;let i={};return 16===e||24===e?(i.background=od[Math.floor((t-32)/2)],t%2==1&&(i.background=i.background+"_semi")):45===t?i.background="transparent":(i.foreground="black",47===t&&(i.underline=!0)),this.channels[e<=23?1:2].setBkgData(i),!0}reset(){var e;for(let e=0;e<Object.keys(this.channels).length;e++){let t=this.channels[e];t&&t.reset()}(e=this.cmdHistory).a=null,e.b=null}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){let i=this.channels[t];i&&i.cueSplitAtTime(e)}}}var oy=function(){if(null!=rJ&&rJ.VTTCue)return self.VTTCue;let e=["","lr","rl"],t=["start","middle","end","left","right"];function i(e,t){if("string"!=typeof t||!Array.isArray(e))return!1;let i=t.toLowerCase();return!!~e.indexOf(i)&&i}function r(e){let t=1;for(;t<arguments.length;t++){let i=arguments[t];for(let t in i)e[t]=i[t]}return e}function a(a,s,n){let o={enumerable:!0};this.hasBeenReset=!1;let l="",d=!1,u=a,h=s,c=n,m=null,f="",g=!0,v="auto",y="start",E=50,b="middle",T=50,A="middle";Object.defineProperty(this,"id",r({},o,{get:function(){return l},set:function(e){l=""+e}})),Object.defineProperty(this,"pauseOnExit",r({},o,{get:function(){return d},set:function(e){d=!!e}})),Object.defineProperty(this,"startTime",r({},o,{get:function(){return u},set:function(e){if("number"!=typeof e)throw TypeError("Start time must be set to a number.");u=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"endTime",r({},o,{get:function(){return h},set:function(e){if("number"!=typeof e)throw TypeError("End time must be set to a number.");h=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"text",r({},o,{get:function(){return c},set:function(e){c=""+e,this.hasBeenReset=!0}})),Object.defineProperty(this,"region",r({},o,{get:function(){return m},set:function(e){m=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"vertical",r({},o,{get:function(){return f},set:function(t){let r=i(e,t);if(!1===r)throw SyntaxError("An invalid or illegal string was specified.");f=r,this.hasBeenReset=!0}})),Object.defineProperty(this,"snapToLines",r({},o,{get:function(){return g},set:function(e){g=!!e,this.hasBeenReset=!0}})),Object.defineProperty(this,"line",r({},o,{get:function(){return v},set:function(e){if("number"!=typeof e&&"auto"!==e)throw SyntaxError("An invalid number or illegal string was specified.");v=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"lineAlign",r({},o,{get:function(){return y},set:function(e){let r=i(t,e);if(!r)throw SyntaxError("An invalid or illegal string was specified.");y=r,this.hasBeenReset=!0}})),Object.defineProperty(this,"position",r({},o,{get:function(){return E},set:function(e){if(e<0||e>100)throw Error("Position must be between 0 and 100.");E=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"positionAlign",r({},o,{get:function(){return b},set:function(e){let r=i(t,e);if(!r)throw SyntaxError("An invalid or illegal string was specified.");b=r,this.hasBeenReset=!0}})),Object.defineProperty(this,"size",r({},o,{get:function(){return T},set:function(e){if(e<0||e>100)throw Error("Size must be between 0 and 100.");T=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"align",r({},o,{get:function(){return A},set:function(e){let r=i(t,e);if(!r)throw SyntaxError("An invalid or illegal string was specified.");A=r,this.hasBeenReset=!0}})),this.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class oE{decode(e,t){if(!e)return"";if("string"!=typeof e)throw Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function ob(e){function t(e,t,i,r){return(0|e)*3600+(0|t)*60+(0|i)+parseFloat(r||0)}let i=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?t(i[2],i[3],0,i[4]):t(i[1],i[2],i[3],i[4]):null}class oT{constructor(){this.values=Object.create(null)}set(e,t){this.get(e)||""===t||(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let r=0;r<i.length;++r)if(t===i[r]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){let i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function oA(e,t,i,r){let a=r?e.split(r):[e];for(let e in a){if("string"!=typeof a[e])continue;let r=a[e].split(i);if(2===r.length)t(r[0],r[1])}}let o_=new oy(0,0,""),oS="middle"===o_.align?"middle":"center";function ok(e){return e.replace(/<br(?: \/)?>/gi,"\n")}class oL{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new oE,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){let t=this;function i(){let e=t.buffer,i=0;for(e=ok(e);i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;let r=e.slice(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.slice(i),r}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{let e="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;let r=(e=i()).match(/^()?WEBVTT([ \t].*)?$/);if(!(null!=r&&r[0]))throw Error("Malformed WebVTT signature.");t.state="HEADER"}let a=!1;for(;t.buffer&&/\r\n|\n/.test(t.buffer);)switch(a?a=!1:e=i(),t.state){case"HEADER":if(/:/.test(e)){var r;r=e,oA(r,function(e,t){},/:/)}else e||(t.state="ID");continue;case"NOTE":e||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(e)){t.state="NOTE";break}if(!e)continue;if(t.cue=new oy(0,0,""),t.state="CUE",-1===e.indexOf("-->")){t.cue.id=e;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{!function(e,t,i){var r;let a,s,n,o=e;
16function l(){let t=ob(e);if(null===t)throw Error("Malformed timestamp: "+o);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function d(){e=e.replace(/^\s+/,"")}if(d(),t.startTime=l(),d(),"-->"!==e.slice(0,3))throw Error("Malformed time stamp (time stamps must be separated by '-->'): "+o);e=e.slice(3),d(),t.endTime=l(),d(),r=e,a=new oT,oA(r,function(e,t){let r;switch(e){case"region":for(let r=i.length-1;r>=0;r--)if(i[r].id===t){a.set(e,i[r].region);break}break;case"vertical":a.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),a.integer(e,r[0]),a.percent(e,r[0])&&a.set("snapToLines",!1),a.alt(e,r[0],["auto"]),2===r.length&&a.alt("lineAlign",r[1],["start",oS,"end"]);break;case"position":r=t.split(","),a.percent(e,r[0]),2===r.length&&a.alt("positionAlign",r[1],["start",oS,"end","line-left","line-right","auto"]);break;case"size":a.percent(e,t);break;case"align":a.alt(e,t,["start",oS,"end","left","right"])}},/:/,/\s/),t.region=a.get("region",null),t.vertical=a.get("vertical",""),"auto"===(s=a.get("line","auto"))&&-1===o_.line&&(s=-1),t.line=s,t.lineAlign=a.get("lineAlign","start"),t.snapToLines=a.get("snapToLines",!0),t.size=a.get("size",100),t.align=a.get("align",oS),"auto"===(n=a.get("position","auto"))&&50===o_.position&&(n="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=n}(e,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{let i=-1!==e.indexOf("-->");if(!e||i&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(null===t.cue)continue;t.cue.text&&(t.cue.text+="\n"),t.cue.text+=e}continue;case"BADCUE":e||(t.state="ID")}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this}flush(){try{if((this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state||"BADWEBVTT"===this.state)throw Error("Malformed WebVTT signature.")}catch(e){this.onparsingerror&&this.onparsingerror(e)}return this.onflush&&this.onflush(),this}}let ow=/\r\n|\n\r|\n|\r/g,oR=function(e,t,i=0){return e.slice(i,i+t.length)===t},oI=function(e){let t=parseInt(e.slice(-3)),i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),a=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;
16if(!tU(t)||!tU(i)||!tU(r)||!tU(a))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=6e4*r,t+=36e5*a};function oC(e,t,i){return nJ(e.toString())+nJ(t.toString())+nJ(i)}let oD=function(e,t,i){let r=e[t],a=e[r.prevCC];if(!a||!a.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;null!=(s=a)&&s.new;){var s;e.ccOffset+=r.start-a.start,r.new=!1,a=e[(r=a).prevCC]}e.presentationOffset=i},ox="stpp.ttml.im1t",oP=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,oM=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,oO={left:"start",center:"center",right:"end",start:"start",end:"end"};function oN(e,t,i,r){let a=iT(new Uint8Array(e),["mdat"]);if(0===a.length)return void r(Error("Could not parse IMSC1 mdat"));let s=a.map(e=>t7(e)),n=function(e,t,i=1,r=!1){return s$(e,1,1/i,r)}(t.baseTime,0,t.timescale);try{s.forEach(e=>i(function(e,t){let i=new DOMParser().parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!i)throw Error("Invalid ttml");let r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(r).reduce((e,t)=>(e[t]=i.getAttribute(`ttp:${t}`)||r[t],e),{}),s="preserve"!==i.getAttribute("xml:space"),n=oF(oU(i,"styling","style")),o=oF(oU(i,"layout","region")),l=oU(i,"body","[begin]");return[].map.call(l,e=>{var i,r,l;let d,u,h,c=function e(t,i){return[].slice.call(t.childNodes).reduce((t,r,a)=>{var s;return"br"===r.nodeName&&a?t+"\n":null!=(s=r.childNodes)&&s.length?e(r,i):i?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent},"")}(e,s);if(!c||!e.hasAttribute("begin"))return null;let m=oH(e.getAttribute("begin"),a),f=oH(e.getAttribute("dur"),a),g=oH(e.getAttribute("end"),a);if(null===m)throw o$(e);if(null===g){if(null===f)throw o$(e);g=m+f}let v=new oy(m-t,g-t,c);v.id=oC(v.startTime,v.endTime,v.text);let y=(i=o[e.getAttribute("region")],r=n[e.getAttribute("style")],l=n,d="http://www.w3.org/ns/ttml#styling",u=null,(h=null!=i&&i.hasAttribute("style")?i.getAttribute("style"):null)&&l.hasOwnProperty(h)&&(u=l[h]),["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce((e,t)=>{let a=oB(r,d,t)||oB(i,d,t)||oB(u,d,t);return a&&(e[t]=a),e},{})),{textAlign:E}=y;if(E){let e=oO[E];e&&(v.lineAlign=e),v.align=E}return tZ(v,y),v}).filter(e=>null!==e)}(e,n)))}catch(e){r(e)}}function oU(e,t,i){let r=e.getElementsByTagName(t)[0];return r?[].slice.call(r.querySelectorAll(i)):[]}function oF(e){return e.reduce((e,t)=>{let i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function oB(e,t,i){return e&&e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function o$(e){return Error(`Could not parse ttml timestamp ${e}`)}function oH(e,t){var i,r;let a,s;if(!e)return null;let n=ob(e);return null===n&&(oP.test(e)?(i=e,r=t,s=(0|(a=oP.exec(i))[4])+(0|a[5])/r.subFrameRate,n=(0|a[1])*3600+(0|a[2])*60+(0|a[3])+s/r.frameRate):oM.test(e)&&(n=function(e,t){let i=oM.exec(e),r=Number(i[1]);switch(i[2]){case"h":return 3600*r;case"m":return 60*r;case"ms":return 1e3*r;case"f":return r/t.frameRate;case"t":return r/t.tickRate}return r}(e,t))),n}class oV{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}function oG(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function oW(e,t){return!!e&&e.kind===oG(t)&&s7(t,e)}function oK(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}let oq=/\s/,oj={newCue(e,t,i,r){let a,s,n,o,l,d=[],u=self.VTTCue||self.TextTrackCue;for(let c=0;c<r.rows.length;c++)if(a=r.rows[c],n=!0,o=0,l="",!a.isEmpty()){var h;for(let e=0;e<a.chars.length;e++)oq.test(a.chars[e].uchar)&&n?o++:(l+=a.chars[e].uchar,n=!1);a.cueStartTime=t,t===i&&(i+=1e-4),o>=16?o--:o++;let r=ok(l.trim()),m=oC(t,i,r);null!=e&&null!=(h=e.cues)&&h.getCueById(m)||((s=new u(t,i,r)).id=m,s.line=c+1,s.align="left",s.position=10+Math.min(80,10*Math.floor(8*o/32)),d.push(s))}return e&&d.length&&(d.sort((e,t)=>
16"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line),d.forEach(t=>nz(e,t))),d}},oY=/(\d+)-(\d+)\/(\d+)/;class oz{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||oX,this.controller=new self.AbortController,this.stats=new ia}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){var r;let a,s=this.stats;if(s.loading.start)throw Error("Loader can only be used once.");s.loading.start=self.performance.now();let n=(r=e,a={method:"GET",mode:"cors",credentials:"same-origin",signal:this.controller.signal,headers:new self.Headers(tZ({},r.headers))},r.rangeEnd&&a.headers.set("Range","bytes="+r.rangeStart+"-"+String(r.rangeEnd-1)),a),o="arraybuffer"===e.responseType,l=o?"byteLength":"length",{maxTimeToFirstByteMs:d,maxLoadTimeMs:u}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=d&&tU(d)?d:u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,e,this.response))},t.timeout),(s1(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(i=>{var r;this.response=this.loader=i;let a=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,e,this.response))},u-(a-s.loading.start)),!i.ok){let{status:e,statusText:t}=i;throw new oQ(t||"fetch, bad network response",e,i)}s.loading.first=a,s.total=function(e){let t=e.get("Content-Range");if(t){let e=function(e){let t=oY.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(tU(e))return e}let i=e.get("Content-Length");if(i)return parseInt(i)}(i.headers)||s.total;let n=null==(r=this.callbacks)?void 0:r.onProgress;return n&&tU(t.highWaterMark)?this.loadProgressively(i,s,e,t.highWaterMark,n):o?i.arrayBuffer():"json"===e.responseType?i.json():i.text()}).then(i=>{var r,a;let n=this.response;if(!n)throw Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);let o=i[l];o&&(s.loaded=s.total=o);let d={url:n.url,data:i,code:n.status},u=null==(r=this.callbacks)?void 0:r.onProgress;u&&!tU(t.highWaterMark)&&u(s,e,i,n),null==(a=this.callbacks)||a.onSuccess(d,s,e,n)}).catch(t=>{var i;if(self.clearTimeout(this.requestTimeout),s.aborted)return;let r=t&&t.code||0,a=t?t.message:null;null==(i=this.callbacks)||i.onError({code:r,text:a},e,t?t.details:null,s)})}getCacheAge(){let e=null;if(this.response){let t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,r=0,a){let s=new a1,n=e.body.getReader(),o=()=>n.read().then(n=>{if(n.done)return s.dataLength&&a(t,i,s.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));let l=n.value,d=l.length;return t.loaded+=d,d<r||s.dataLength?(s.push(l),s.dataLength>=r&&a(t,i,s.flush().buffer,e)):a(t,i,l.buffer,e),o()}).catch(()=>Promise.reject());return o()}}function oX(e,t){return new self.Request(e.url,t)}class oQ extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}let oZ=/^age:\s*[\d.]+\s*$/im;class oJ{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 ia,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){let e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){let{config:e,context:t}=this;if(!e||!t)return;let i=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;let a=this.xhrSetup;a?Promise.resolve().then(()=>
16{if(this.loader===i&&!this.stats.aborted)return a(i,t.url)}).catch(e=>{if(this.loader===i&&!this.stats.aborted)return i.open("GET",t.url,!0),a(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(e=>{var a;null==(a=this.callbacks)||a.onError({code:i.status,text:e.message},t,i,r)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);let r=t.headers,{maxTimeToFirstByteMs:a,maxLoadTimeMs:s}=i.loadPolicy;if(r)for(let t in r)e.setRequestHeader(t,r[t]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=a&&tU(a)?a:s,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){let{context:e,loader:t,stats:i}=this;if(!e||!t)return;let r=t.readyState,a=this.config;if(!i.aborted&&r>=2&&(0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),a.timeout!==a.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),a.timeout=a.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),4===r)){var s,n,o;self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;let r=t.status,l="text"===t.responseType?t.responseText:null;if(r>=200&&r<300){let a=null!=l?l:t.response;if(null!=a){i.loading.end=Math.max(self.performance.now(),i.loading.first),i.loaded=i.total="arraybuffer"===t.responseType?a.byteLength:a.length,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first);let o=null==(s=this.callbacks)?void 0:s.onProgress;o&&o(i,e,a,t);let l={url:t.responseURL,data:a,code:r};null==(n=this.callbacks)||n.onSuccess(l,i,e,t);return}}let d=a.loadPolicy.errorRetry;rf(d,i.retry,!1,{url:e.url,data:void 0,code:r})?this.retry(d):(t8.error(`${r} while loading ${e.url}`),null==(o=this.callbacks)||o.onError({code:r,text:t.statusText},e,t,i))}}loadtimeout(){if(!this.config)return;let e=this.config.loadPolicy.timeoutRetry;if(rf(e,this.stats.retry,!0))this.retry(e);else{var t;t8.warn(`timeout while loading ${null==(t=this.context)?void 0:t.url}`);let e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){let{context:t,stats:i}=this;this.retryDelay=rc(e,i.retry),i.retry++,t8.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==t?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){let t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&oZ.test(this.loader.getAllResponseHeaders())){let t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}let o0=t0(t0({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:1/0,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:6e7,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:oJ,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class extends t1{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.co
16decTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=e=>{var t;let i,{fragCurrent:r,partCurrent:a,hls:s}=this,{autoLevelEnabled:n,media:o}=s;if(!r||!o)return;let l=performance.now(),d=a?a.stats:r.stats,u=a?a.duration:r.duration,h=l-d.loading.start,c=s.minAutoLevel,m=r.level,f=this._nextAutoLevel;if(d.aborted||d.loaded&&d.loaded===d.total||m<=c){this.clearTimer(),this._nextAutoLevel=-1;return}if(!n)return;let g=f>-1&&f!==m,v=!!e||g;if(!v&&(o.paused||!o.playbackRate||!o.readyState))return;let y=s.mainForwardBufferInfo;if(!v&&null===y)return;let E=this.bwEstimator.getEstimateTTFB(),b=Math.abs(o.playbackRate);if(h<=Math.max(E,u/(2*b)*1e3))return;let T=y?y.len/b:0,A=d.loading.first?d.loading.first-d.loading.start:-1,_=d.loaded&&A>-1,S=this.getBwEstimate(),k=s.levels,L=k[m],w=Math.max(d.loaded,Math.round(u*(r.bitrate||L.averageBitrate)/8)),R=_?h-A:h;R<1&&_&&(R=Math.min(h,8*d.loaded/S));let I=_?1e3*d.loaded/R:0,C=E/1e3,D=I?(w-d.loaded)/I:8*w/S+C;if(D<=T)return;let x=I?8*I:S,P=(null==(t=(null==e?void 0:e.details)||this.hls.latestLevelDetails)?void 0:t.live)===!0,M=this.hls.config.abrBandWidthUpFactor,O=1/0;for(i=m-1;i>c;i--){let e=k[i].maxBitrate,t=!k[i].details||P;if((O=this.getTimeToLoadFrag(C,x,u*e,t))<Math.min(T,u+C))break}if(O>=D||O>10*u)return;_?this.bwEstimator.sample(h-Math.min(E,A),d.loaded):this.bwEstimator.sampleTTFB(h);let N=k[i].maxBitrate;this.getBwEstimate()*M>N&&this.resetEstimator(N);let U=this.findBestLevel(N,c,i,0,T,1,1);U>-1&&(i=U),this.warn(`Fragment ${r.sn}${a?" part "+a.index:""} of level ${m} is loading too slowly; 17 Fragment duration: ${r.duration.toFixed(3)} 18 Time to underbuffer: ${T.toFixed(3)} s 19 Estimated load time for current fragment: ${D.toFixed(3)} s 20 Estimated load time for down switch fragment: ${O.toFixed(3)} s 21 TTFB estimate: ${0|A} ms 22 Current BW estimate: ${tU(S)?0|S:"Unknown"} bps 23 New BW estimate: ${0|this.getBwEstimate()} bps 24 Switching to level ${i} @ ${0|N} bps`),s.nextLoadLevel=s.nextAutoLevel=i,this.clearTimer();let F=()=>{if(this.clearTimer(),this.fragCurrent===r&&this.hls.loadLevel===i&&i>0){let e=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${i>0?"and switching down":""} 25 Fragment duration: ${r.duration.toFixed(3)} s 26 Time to underbuffer: ${e.toFixed(3)} s`),r.abortRequests(),this.fragCurrent=this.partCurrent=null,i>c){let t=this.findBestLevel(this.hls.levels[c].bitrate,c,i,0,e,1,1);-1===t&&(t=c),this.hls.nextLoadLevel=this.hls.nextAutoLevel=t,this.resetEstimator(this.hls.levels[t].bitrate)}}};g||D>2*O?F():this.timer=self.setInterval(F,1e3*O),s.trigger(tV.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,part:a,stats:d})},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(){let e=this.hls.config;return new tQ(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){let{hls:e}=this;e.on(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tV.FRAG_LOADING,this.onFragLoading,this),e.on(tV.FRAG_LOADED,this.onFragLoaded,this),e.on(tV.FRAG_BUFFERED,this.onFragBuffered,this),e.on(tV.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(tV.LEVEL_LOADED,this.onLevelLoaded,this),e.on(tV.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(tV.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(tV.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e&&(e.off(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tV.FRAG_LOADING,this.onFragLoading,this),e.off(tV.FRAG_LOADED,this.onFragLoaded,this),e.off(tV.FRAG_BUFFERED,this.onFragBuffered,this),e.off(tV.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(tV.LEVEL_LOADED,this.onLevelLoaded,this),e.off(tV.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(tV.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(tV.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){let i=t.frag;
26if(!this.ignoreFragment(i)){if(!i.bitrateTest){var r;this.fragCurrent=i,this.partCurrent=null!=(r=t.part)?r:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case tH.BUFFER_ADD_CODEC_ERROR:case tH.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case tH.FRAG_LOAD_TIMEOUT:{let e=t.frag,{fragCurrent:i,partCurrent:r}=this;if(e&&i&&e.sn===i.sn&&e.level===i.level){let t=performance.now(),i=r?r.stats:e.stats,a=t-i.loading.start,s=i.loading.first?i.loading.first-i.loading.start:-1;if(i.loaded&&s>-1){let e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(a-Math.min(e,s),i.loaded)}else this.bwEstimator.sampleTTFB(a)}}}}getTimeToLoadFrag(e,t,i,r){let a=r?e+this.lastLevelLoadSec:0;return e+i/t+a}onLevelLoaded(e,t){let i=this.hls.config,{loading:r}=t.stats,a=r.end-r.first;tU(a)&&(this.lastLevelLoadSec=a/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:i}){let r=i?i.stats:t.stats;if(t.type===tj&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){let e=i?i.duration:t.duration,a=this.hls.levels[t.level],s=(a.loaded?a.loaded.bytes:0)+r.loaded,n=(a.loaded?a.loaded.duration:0)+e;a.loaded={bytes:s,duration:n},a.realBitrate=Math.round(8*s/n)}if(t.bitrateTest){let e={stats:r,frag:t,part:i,id:t.type};this.onFragBuffered(tV.FRAG_BUFFERED,e),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){let{frag:i,part:r}=t,a=null!=r&&r.stats.loaded?r.stats:i.stats;if(a.aborted||this.ignoreFragment(i))return;let s=a.parsing.end-a.loading.start-Math.min(a.loading.first-a.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(s,a.loaded),a.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=s/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==tj||"initSegment"===e.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){let{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,a=this.findBestLevel(i,t,e,0,r,1,1);if(a>-1)return a;let s=this.hls.firstLevel,n=Math.min(Math.max(s,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${s} clamped to ${n}`),n}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){let e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(-1!==e&&(!t||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;let r=t&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){let t=this.hls.levels;if(t.length>Math.max(e,r)&&t[e].loadError<=t[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return`${this.getBwEstimate()}
26_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){let{fragCurrent:e,partCurrent:t,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;let{maxAutoLevel:r,config:a,minAutoLevel:s}=i,n=t?t.duration:e?e.duration:0,o=this.getBwEstimate(),l=this.getStarvationDelay(),d=a.abrBandWidthFactor,u=a.abrBandWidthUpFactor;if(l){let e=this.findBestLevel(o,s,r,l,0,d,u);if(e>=0)return this.rebufferNotice=-1,e}let h=n?Math.min(n,a.maxStarvationDelay):a.maxStarvationDelay;if(!l){let e=this.bitrateTestDelay;e&&(h=(n?Math.min(n,a.maxLoadingDelay):a.maxLoadingDelay)-e,this.info(`bitrate test took ${Math.round(1e3*e)}ms, set first fragment max fetchDuration to ${Math.round(1e3*h)} ms`),d=u=1)}let c=this.findBestLevel(o,s,r,l,h,d,u);if(this.rebufferNotice!==c&&(this.rebufferNotice=c,this.info(`${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${c}`)),c>-1)return c;let m=i.levels[s],f=i.loadLevelObj;return f&&(null==m?void 0:m.bitrate)<f.bitrate?s:i.loadLevel}getStarvationDelay(){let e=this.hls,t=e.media;if(!t)return 1/0;let i=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,r,a,s,n){var o,l;let d,u=r+a,h=this.lastLoadedFragLevel,c=-1===h?this.hls.firstLevel:h,{fragCurrent:m,partCurrent:f}=this,{levels:g,allAudioTracks:v,loadLevel:y,config:E}=this.hls;if(1===g.length)return 0;let b=g[c],T=!!(null!=(o=this.hls.latestLevelDetails)&&o.live),A=-1===y||-1===h,_="SDR",S=(null==b?void 0:b.frameRate)||0,{audioPreference:k,videoPreference:L}=E,w=this.audioTracksByGroup||(this.audioTracksByGroup=i9(v)),R=-1;if(A){if(-1!==this.firstSelection)return this.firstSelection;let r=function(e,t,i,r,a){let s=Object.keys(e),n=null==r?void 0:r.channels,o=null==r?void 0:r.audioCodec,l=null==a?void 0:a.videoCodec,d=n&&2===parseInt(n),u=!1,h=!1,c=1/0,m=1/0,f=1/0,g=1/0,v=0,y=[],{preferHDR:E,allowedVideoRanges:b}=function(e,t){let i=!1,r=[];if(e&&(i="SDR"!==e,r=[e]),t){let e="SDR"!==(r=t.allowedVideoRanges||i0.slice(0)).join("")&&!t.videoCodec;(i=void 0!==t.preferHDR?t.preferHDR:e&&function(){if("function"==typeof matchMedia){let e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}())||(r=["SDR"])}return{preferHDR:i,allowedVideoRanges:r}}(t,a);for(let t=s.length;t--;){let i=e[s[t]];u||(u=i.channels[2]>0),c=Math.min(c,i.minHeight),m=Math.min(m,i.minFramerate),f=Math.min(f,i.minBitrate),b.filter(e=>i.videoRanges[e]>0).length>0&&(h=!0)}c=tU(c)?c:0,m=tU(m)?m:0;let T=Math.max(1080,c),A=Math.max(30,m);i=Math.max(f=tU(f)?f:i,i),h||(t=void 0);let _=s.length>1;return{codecSet:s.reduce((t,r)=>{let a=e[r];if(r===t)return t;if(y=h?b.filter(e=>a.videoRanges[e]>0):[],_){if(a.minBitrate>i)return i8(r,`min bitrate of ${a.minBitrate} > current estimate of ${i}`),t;if(!a.hasDefaultAudio)return i8(r,"no renditions with default or auto-select sound found"),t;if(o&&r.indexOf(o.substring(0,4))%5!=0)return i8(r,`audio codec preference "${o}" not found`),t;if(n&&!d){if(!a.channels[n])return i8(r,`no renditions with ${n} channel sound found (channels options: ${Object.keys(a.channels)})`),t}else if((!o||d)&&u&&0===a.channels["2"])return i8(r,"no renditions with stereo sound found"),t;if(a.minHeight>T)return i8(r,`min resolution of ${a.minHeight} > maximum of ${T}`),t;if(a.minFramerate>A)return i8(r,`min framerate of ${a.minFramerate} > maximum of ${A}`),t;if(!y.some(e=>a.videoRanges[e]>0))return i8(r,`no variants with VIDEO-RANGE of ${i5(y)} found`),t;if(l&&r.indexOf(l.substring(0,4))%5!=0)return i8(r,`video codec preference "${l}" not found`),t;if(a.maxScore<v)return i8(r,`max score of ${a.maxScore} < selected max of ${v}`),t}return t&&(i$(r)>=i$(t)||a.fragmentError>e[t].fragmentError)?t:(g=a.minIndex,v=a.maxScore,r)},void 0),videoRanges:y,preferHDR:E,minFramerate:m,minBitrate:f,minIndex:g}}(this.codecTiers||(this.codecTiers=g.slice(t,i+1).reduce((e,t,i)=>{if(!t.codecSet)return e;let r=t.audioGroups,a=e[t.codecSet];a||(e[t.codecSet]=a={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:i,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!r,fragmentError:0}
26),a.minBitrate=Math.min(a.minBitrate,t.bitrate);let s=Math.min(t.height,t.width);return a.minHeight=Math.min(a.minHeight,s),a.minFramerate=Math.min(a.minFramerate,t.frameRate),a.minIndex=Math.min(a.minIndex,i),a.maxScore=Math.max(a.maxScore,t.score),a.fragmentError+=t.fragmentError,a.videoRanges[t.videoRange]=(a.videoRanges[t.videoRange]||0)+1,r&&r.forEach(e=>{if(!e)return;let t=w.groups[e];t&&(a.hasDefaultAudio=a.hasDefaultAudio||w.hasDefaultAudio?t.hasDefault:t.hasAutoSelect||!w.hasDefaultAudio&&!w.hasAutoSelectAudio,Object.keys(t.channels).forEach(e=>{a.channels[e]=(a.channels[e]||0)+t.channels[e]}))}),e},{})),_,e,k,L),{codecSet:a,videoRanges:s,minFramerate:n,minBitrate:o,minIndex:l,preferHDR:u}=r;R=l,d=a,_=u?s[s.length-1]:s[0],S=n,e=Math.max(e,o),this.log(`picked start tier ${i5(r)}`)}else d=null==b?void 0:b.codecSet,_=null==b?void 0:b.videoRange;let I=f?f.duration:m?m.duration:0,C=this.bwEstimator.getEstimateTTFB()/1e3,D=[];for(let o=i;o>=t;o--){let t,m=g[o],v=o>c;if(!m)continue;if(E.useMediaCapabilities&&!m.supportedResult&&!m.supportedPromise){let t=navigator.mediaCapabilities;"function"==typeof(null==t?void 0:t.decodingInfo)&&function(e,t,i,r,a,s){let n=e.videoCodec,o=e.audioCodec?e.audioGroups:null,l=null==s?void 0:s.audioCodec,d=null==s?void 0:s.channels,u=d?parseInt(d):l?1/0:2,h=null;if(null!=o&&o.length)try{h=1===o.length&&o[0]?t.groups[o[0]].channels:o.reduce((e,i)=>{if(i){let r=t.groups[i];if(!r)throw Error(`Audio track group ${i} not found`);Object.keys(r.channels).forEach(t=>{e[t]=(e[t]||0)+r.channels[t]})}return e},{2:0})}catch(e){return!0}return void 0!==n&&(n.split(",").some(e=>iD(e))||e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(r,30)||"SDR"!==e.videoRange&&e.videoRange!==i||e.bitrate>Math.max(a,8e6))||!!h&&tU(u)&&Object.keys(h).some(e=>parseInt(e)>u)}(m,w,_,S,e,k)?(m.supportedPromise=iQ(m,w,t,this.supportedCache),m.supportedPromise.then(e=>{if(!this.hls)return;m.supportedResult=e;let t=this.hls.levels,i=t.indexOf(m);e.error?this.warn(`MediaCapabilities decodingInfo error: "${e.error}" for level ${i} ${i5(e)}`):e.supported?e.decodingInfoResults.some(e=>!1===e.smooth||!1===e.powerEfficient)&&this.log(`MediaCapabilities decodingInfo for level ${i} not smooth or powerEfficient: ${i5(e)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${i} ${i5(e)}`),i>-1&&t.length>1&&(this.log(`Removing unsupported level ${i}`),this.hls.removeLevel(i),-1===this.hls.loadLevel&&(this.hls.nextLoadLevel=0)))}).catch(e=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${e}`)})):m.supportedResult=iz}if((d&&m.codecSet!==d||_&&m.videoRange!==_||v&&S>m.frameRate||!v&&S>0&&S<m.frameRate||null!=(l=m.supportedResult)&&null!=(l=l.decodingInfoResults)&&l.some(e=>!1===e.smooth))&&(!A||o!==R)){D.push(o);continue}let b=m.details,L=(f?null==b?void 0:b.partTarget:null==b?void 0:b.averagetargetduration)||I;t=v?n*e:s*e;let x=I&&r>=2*I&&0===a?m.averageBitrate:m.maxBitrate,P=this.getTimeToLoadFrag(C,t,x*L,void 0===b);if(t>=x&&(o===h||0===m.loadError&&0===m.fragmentError)&&(P<=C||!tU(P)||T&&!this.bitrateTestDelay||P<u)){let e=this.forcedAutoLevel;return o!==y&&(-1===e||e!==y)&&(D.length&&this.trace(`Skipped level(s) ${D.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${g[D[0]].codecs}" ${g[D[0]].videoRange}; not compatible with "${d}" ${_}`),this.info(`switch candidate:${c}->${o} adjustedbw(${Math.round(t)})-bitrate=${Math.round(t-x)} ttfb:${C.toFixed(1)} avgDuration:${L.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${P.toFixed(1)} firstSelection:${A} codecSet:${m.codecSet} videoRange:${m.videoRange} hls.loadLevel:${y}`)),A&&(this.firstSelection=o),o}}return -1}set nextAutoLevel(e){let t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){let{maxAutoLevel:t,minAutoLevel:i}=this.hls;return Math.min(Math.max(e,i),t)}},bufferController:class extends t1{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=e=>{var t;this.hls&&(null==(t=this.mediaSource)?void 0:t.readyState)==="open"&&this.hls.pauseBuffer
26ing()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=e=>{let{media:t,mediaSource:i}=this;e&&this.log("Media source opened"),t&&i&&(i.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(tV.MEDIA_ATTACHED,{media:t,mediaSource:i}),null!==this.mediaSource&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{let{mediaSrc:e,_objectUrl:t}=this;e!==t&&this.error(`Media element src was set while attaching MediaSource (${t} > ${e})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=function(e){return"u">typeof self&&e===self.ManagedMediaSource}(t9(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(){let{hls:e}=this;e.on(tV.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tV.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tV.BUFFER_RESET,this.onBufferReset,this),e.on(tV.BUFFER_APPENDING,this.onBufferAppending,this),e.on(tV.BUFFER_CODECS,this.onBufferCodecs,this),e.on(tV.BUFFER_EOS,this.onBufferEos,this),e.on(tV.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(tV.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(tV.FRAG_PARSED,this.onFragParsed,this),e.on(tV.FRAG_CHANGED,this.onFragChanged,this),e.on(tV.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(tV.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tV.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tV.BUFFER_RESET,this.onBufferReset,this),e.off(tV.BUFFER_APPENDING,this.onBufferAppending,this),e.off(tV.BUFFER_CODECS,this.onBufferCodecs,this),e.off(tV.BUFFER_EOS,this.onBufferEos,this),e.off(tV.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(tV.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(tV.FRAG_PARSED,this.onFragParsed,this),e.off(tV.FRAG_CHANGED,this.onFragChanged,this),e.off(tV.ERROR,this.onError,this)}transferMedia(){let{media:e,mediaSource:t}=this;if(!e)return null;let i={};if(this.operationQueue){let e=this.isUpdating();e||this.operationQueue.removeBlockers();let t=this.isQueued();(e||t)&&this.warn(`Transfering MediaSource with${t?" operations in queue":""}${e?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}let r=this.transferData;return!this.sourceBufferCount&&r&&r.mediaSource===t?tZ(i,r.tracks):this.sourceBuffers.forEach(e=>{let[t]=e;t&&(i[t]=tZ({},this.tracks[t]),this.removeBuffer(t)),e[0]=e[1]=null}),{media:e,mediaSource:t,tracks:i}}initTracks(){this.sourceBuffers=[[null,null],[null,null]],this.tracks={},this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var i;let r=2;(!t.audio||t.video)&&t.altAudio||(r=1),this.bufferCodecEventsTotal=r,this.log(`${r} bufferCodec event(s) expected.`),null!=(i=this.transferData)&&i.mediaSource&&this.sourceBufferCount&&r&&this.bufferCreated()}onMediaAttaching(e,t){let i=this.media=t.media;this.transferData=this.overrides=void 0;let r=t9(this.appendSource);if(r){let e=!!t.mediaSource;(e||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);let n=this.mediaSource=t.mediaSource||new r;if(this.assignMediaSource(n),e)this._objectUrl=i.src,this.attachTransferred();else{let e=this._objectUrl=self.URL.createObjectURL(n);if(this.appendSource)try{var a,s;let t;i.removeAttribute("src");let r=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||r&&n instanceof r,na(i),a=i,s=e,(t=self.document.createElement("source")).type="video/mp4",t.src=s,a.appendChild(t),i.load()}catch(t){i.src=e}else i.src=e}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,i;this.log(`${(null==(t=this.transferData)?void 0:t.mediaSource)===e?"transferred":"created"}
26 media source: ${null==(i=e.constructor)?void 0:i.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(){let e=this.media,t=this.transferData;if(!t||!e)return;let i=this.tracks,r=t.tracks,a=r?Object.keys(r):null,s=a?a.length:0,n=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(r&&a&&s){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal}) 27required tracks: ${i5(i,(e,t)=>"initSegment"===e?void 0:t)}; 28transfer tracks: ${i5(r,(e,t)=>"initSegment"===e?void 0:t)}}`),!t6(r,i)){t.mediaSource=null,t.tracks=void 0;let a=e.currentTime,s=this.details,n=Math.max(a,(null==s?void 0:s.fragments[0].start)||0);return n-a>1?void this.log(`attachTransferred: waiting for playback to reach new tracks start time ${a} -> ${n}`):(this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(r)}"->"${Object.keys(i)}") start time: ${n} currentTime: ${a}`),this.onMediaDetaching(tV.MEDIA_DETACHING,{}),this.onMediaAttaching(tV.MEDIA_ATTACHING,t),void(e.currentTime=n))}this.transferData=void 0,a.forEach(e=>{let t=r[e];if(t){let i=t.buffer;if(i){let r=this.fragmentTracker,a=t.id;if(r.hasFragments(a)||r.hasParts(a)){let t=rN.getBuffered(i);r.detectEvictedFragments(e,t,a,null,!0)}let s=ns(e),n=[e,i];this.sourceBuffers[s]=n,i.updating&&this.operationQueue&&this.operationQueue.prependBlocker(e),this.trackSourceBuffer(e,t)}}}),n(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),n()}get mediaSourceOpenOrEnded(){var e;let t=null==(e=this.mediaSource)?void 0:e.readyState;return"open"===t||"ended"===t}onMediaDetaching(e,t){let i=!!t.transferMedia;this.transferData=this.overrides=void 0;let{media:r,mediaSource:a,_objectUrl:s}=this;if(a){if(this.log(`media source ${i?"transferring":"detaching"}`),i)this.sourceBuffers.forEach(([e])=>{e&&this.removeBuffer(e)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){let e="open"===a.readyState;try{let t=a.sourceBuffers;for(let i=t.length;i--;)e&&t[i].abort(),a.removeSourceBuffer(t[i]);e&&a.endOfStream()}catch(e){this.warn(`onMediaDetaching: ${e.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}a.removeEventListener("sourceopen",this._onMediaSourceOpen),a.removeEventListener("sourceended",this._onMediaSourceEnded),a.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(a.removeEventListener("startstreaming",this._onStartStreaming),a.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}r&&(r.removeEventListener("emptied",this._onMediaEmptied),i||(s&&self.URL.revokeObjectURL(s),this.mediaSrc===s?(r.removeAttribute("src"),this.appendSource&&na(r),r.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(tV.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t,i;let r=null==(t=this.tracks[e])?void 0:t.buffer;if(this.removeBuffer(e),r)try{null!=(i=this.mediaSource)&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(r)}catch(t){this.warn(`onBufferReset ${e}`,t)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[ns(e)]=[null,null];let t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new ne(this.tracks)}onBufferCodecs(e,t){var i;let r=this.tracks,a=Object.keys(t);this.log(`BUFFER_CODECS: "${a}" (current SB count ${this.sourceBufferCount})`);let s="audiovideo"in t&&(r.audio||r.video)||r.audiovideo&&("audio"in t||"video"in t),n=!s&&this.sourceBufferCount&&this.media&&a.some(e=>!r[e]);
28s||n?this.warn(`Unsupported transition between "${Object.keys(r)}" and "${a}" SourceBuffers`):(a.forEach(e=>{var i,a;let{id:s,codec:n,levelCodec:o,container:l,metadata:d,supplemental:u}=t[e],h=r[e],c=null==(i=this.transferData)||null==(i=i.tracks)?void 0:i[e],m=null!=c&&c.buffer?c:h,f=(null==m?void 0:m.pendingCodec)||(null==m?void 0:m.codec),g=null==m?void 0:m.levelCodec;h||(h=r[e]={buffer:void 0,listeners:[],codec:n,supplemental:u,container:l,levelCodec:o,metadata:d,id:s});let v=iW(f,g),y=null==v?void 0:v.replace(nt,"$1"),E=iW(n,o),b=null==(a=E)?void 0:a.replace(nt,"$1");E&&v&&y!==b&&("audio"===e.slice(0,5)&&(E=iG(E,this.appendSource)),this.log(`switching codec ${f} to ${E}`),E!==(h.pendingCodec||h.codec)&&(h.pendingCodec=E),h.container=l,this.appendChangeType(e,l,E))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(!(this.bufferCodecEventsTotal>1)||this.tracks.video||t.video||(null==(i=t.audio)?void 0:i.id)!=="main"||(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks()))}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{let i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,t,i){let r=`${t};codecs=${i}`,a={label:`change-type=${r}`,execute:()=>{let a=this.tracks[e];if(a){let s=a.buffer;null!=s&&s.changeType&&(this.log(`changing ${e} sourceBuffer type to ${r}`),s.changeType(r),a.codec=i,a.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn(`Failed to change ${e} SourceBuffer type`,t)}};this.append(a,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;let i=e.start,r=i+.05*e.duration;if((null==(t=this.fragmentTracker.getAppendedFrag(i,tj))?void 0:t.gap)===!0)return;let a={label:"block-audio",execute:()=>{var e;let t=this.tracks.video;(this.lastVideoAppendEnd>r||null!=t&&t.buffer&&rN.isBuffered(t.buffer,r)||(null==(e=this.fragmentTracker.getAppendedFrag(r,tj))?void 0:e.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:e=>{this.warn("Error executing block-audio operation",e)}};this.blockedAudioAppend={op:a,frag:e},this.append(a,"audio",!0)}unblockAudio(){let{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){let{tracks:i}=this,{data:r,type:a,parent:s,frag:n,part:o,chunkMeta:l,offset:d}=t,u=l.buffering[a],{sn:h,cc:c}=n,m=self.performance.now();u.start=m;let f=n.stats.buffering,g=o?o.stats.buffering:null;0===f.start&&(f.start=m),g&&0===g.start&&(g.start=m);let v=i.audio,y=!1;"audio"===a&&(null==v?void 0:v.container)==="audio/mpeg"&&(y=!this.lastMpegAudioChunk||1===l.id||this.lastMpegAudioChunk.sn!==l.sn,this.lastMpegAudioChunk=l);let E=i.video,b=null==E?void 0:E.buffer;if(b&&"initSegment"!==h){let e=o||n,t=this.blockedAudioAppend;if("audio"!==a||"main"===s||this.blockedAudioAppend||E.ending||E.ended){if("video"===a){let i=e.end;if(t){let e=t.frag.start;(i>e||i<this.lastVideoAppendEnd||rN.isBuffered(b,e))&&this.unblockAudio()}this.lastVideoAppendEnd=i}}else{let t=e.start+.05*e.duration,i=b.buffered,r=this.currentOp("video");(i.length||r)&&(r||rN.isBuffered(b,t)||!(this.lastVideoAppendEnd<t))||this.blockAudio(e)}}let T=(o||n).start,A={label:`append-${a}`,execute:()=>{var e;u.executeStart=self.performance.now();let t=null==(e=this.tracks[a])?void 0:e.buffer;t&&(y?this.updateTimestampOffset(t,T,.1,a,h,c):void 0!==d&&tU(d)&&this.updateTimestampOffset(t,d,1e-6,a,h,c)),this.appendExecutor(r,a)},onStart:()=>{},onComplete:()=>{let e=self.performance.now();u.executeEnd=u.end=e,0===f.first&&(f.first=e),g&&0===g.first&&(g.first=e);let t={};this.sourceBuffers.forEach(([e,i])=>{e&&(t[e]=rN.getBuffered(i))}),this.appendErrors[a]=0,"audio"===a||"video"===a?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(tV.BUFFER_APPENDED,{type:a,frag:n,part:o,chunkMeta:l,parent:n.type,timeRanges:t})},onError:e=>{var t;let i={type:t$.MEDIA_ERROR,parent:n.type,details:tH.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:n,part:o,chunkMeta:l,error:e,err:e,fatal:!1},r=null==(t=this.media)?void 0:t.error;if(e.code===DOMException.QUOTA_EXCEEDED_ERR||"QuotaExceededError"==e.name||"quota"in e)i.details=tH.BUFFER_FULL_ERROR;else if(e.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!r)i.errorAction=rg(!0);else if(e.name===ni&&0===this.sourceBufferCount)i.errorAction=rg(!0);else{let e=++this.appendErrors[a];this.warn(`Failed ${e}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${a}
28" sourceBuffer (${r||"no media error"})`),(e>=this.hls.config.appendErrorMaxRetry||r)&&(i.fatal=!0)}this.hls.trigger(tV.ERROR,i)}};this.log(`queuing "${a}" append sn: ${h}${o?" p: "+o.index:""} of ${n.type===tj?"level":"track"} ${n.level} cc: ${c}`),this.append(A,a,this.isPending(this.tracks[a]))}getFlushOp(e,t,i){return this.log(`queuing "${e}" remove ${t}-${i}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger(tV.BUFFER_FLUSHED,{type:e})},onError:r=>{this.warn(`Failed to remove ${t}-${i} from "${e}" SourceBuffer`,r)}}}onBufferFlushing(e,t){let{type:i,startOffset:r,endOffset:a}=t;i?this.append(this.getFlushOp(i,r,a),i):this.sourceBuffers.forEach(([e])=>{e&&this.append(this.getFlushOp(e,r,a),e)})}onFragParsed(e,t){let{frag:i,part:r}=t,a=[],s=r?r.elementaryStreams:i.elementaryStreams;s[il]?a.push("audiovideo"):(s[is]&&a.push("audio"),s[io]&&a.push("video"));let n=()=>{let e=self.performance.now();i.stats.buffering.end=e,r&&(r.stats.buffering.end=e);let t=r?r.stats:i.stats;this.hls.trigger(tV.FRAG_BUFFERED,{frag:i,part:r,stats:t,id:i.type})};0===a.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(n,a).catch(e=>{this.warn(`Fragment buffered callback ${e}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){let t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var i;this.sourceBuffers.forEach(([e])=>{if(e){let i=this.tracks[e];(!t.type||t.type===e)&&(i.ending=!0,i.ended||(i.ended=!0,this.log(`${e} buffer reached EOS`)))}});let r=(null==(i=this.overrides)?void 0:i.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{var t;return e&&!(null!=(t=this.tracks[e])&&t.ended)})?r?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();let{mediaSource:e}=this;if(!e||"open"!==e.readyState){e&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${e.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),e.endOfStream(),this.hls.trigger(tV.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(tV.BUFFERED_TO_END,void 0)):"video"===t.type&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(null!==e){let t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{let e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===tH.BUFFER_APPEND_ERROR&&t.frag){var i;let e=null==(i=t.errorAction)?void 0:i.nextAutoLevel;tU(e)&&e!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){let{hls:e,details:t,media:i}=this;if(!i||null===t||!this.sourceBufferCount)return;let r=e.config,a=i.currentTime,s=t.levelTargetDuration,n=t.live&&null!==r.liveBackBufferLength?r.liveBackBufferLength:r.backBufferLength;if(tU(n)&&n>=0){let e=Math.max(n,s),t=Math.floor(a/s)*s-e;this.flushBackBuffer(a,s,t)}let o=r.frontBufferFlushThreshold;if(tU(o)&&o>0){let e=Math.max(Math.max(r.maxBufferLength,o),s),t=Math.floor(a/s)*s+e;this.flushFrontBuffer(a,s,t)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([e,t])=>{if(t){let a=rN.getBuffered(t);if(a.length>0&&i>a.start(0)){var r;this.hls.trigger(tV.BACK_BUFFER_REACHED,{bufferEnd:i});let t=this.tracks[e];if(null!=(r=this.details)&&r.live)this.hls.trigger(tV.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(null!=t&&t.ended)return void this.log(`Cannot flush ${e} back buffer while SourceBuffer is in ended state`);this.hls.trigger(tV.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:e})}}})}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach(([t,r])=>{if(r){let a=rN.getBuffered(r),s=a.length;if(s<2)return;let n=a.start(s-1),o=a.end(s-1);i>n||e>=n&&e<=o||this.hls.trigger(tV.BUFFER_FLUSHING,{startOffset:n,endOffset:1/0,type:t})}})}getDurationAndRange(){var e;let{details:t,mediaSource:i}=this;if(!t||!this.media||(null==i?void 0:i.readyState)!=="open")return null;let r=t.edge;
28if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&i.setLiveSeekableRange){let e=Math.max(0,t.fragmentStart),i=Math.max(e,r);return{duration:1/0,start:e,end:i}}return{duration:1/0}}let a=null==(e=this.overrides)?void 0:e.duration;if(a)return tU(a)?{duration:a}:null;let s=this.media.duration;return r>(tU(i.duration)?i.duration:0)&&r>s||!tU(s)?{duration:r}:null}updateMediaSource({duration:e,start:t,end:i}){let r=this.mediaSource;this.media&&r&&"open"===r.readyState&&(r.duration!==e&&(tU(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),r.duration=e),void 0!==t&&void 0!==i&&(this.log(`MediaSource duration is set to ${r.duration}. Setting seekable range to ${t}-${i}.`),r.setLiveSeekableRange(t,i)))}get tracksReady(){let e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){let{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:i}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${i5(i)}`),this.tracksReady){var r;let e=null==(r=this.transferData)?void 0:r.tracks;e&&Object.keys(e).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){let e={};this.sourceBuffers.forEach(([t,i])=>{if(t){let r=this.tracks[t];e[t]={buffer:i,container:r.container,codec:r.codec,supplemental:r.supplemental,levelCodec:r.levelCodec,id:r.id,metadata:r.metadata}}}),this.hls.trigger(tV.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([e])=>{this.executeNext(e)})}else{let e=Error("could not create source buffer for media codec(s)");this.hls.trigger(tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){let{tracks:e,sourceBuffers:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(let a in e){let s=e[a];if(this.isPending(s)){let e=this.getTrackCodec(s,a),n=`${s.container};codecs=${e}`;s.codec=e,this.log(`creating sourceBuffer(${n})${this.currentOp(a)?" Queued":""} ${i5(s)}`);try{let e=i.addSourceBuffer(n),r=ns(a),o=[a,e];t[r]=o,s.buffer=e}catch(e){var r;this.error(`error while trying to add sourceBuffer: ${e.message}`),this.shiftAndExecuteNext(a),null==(r=this.operationQueue)||r.removeBlockers(),delete this.tracks[a],this.hls.trigger(tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:a,mimeType:n,parent:s.id});return}this.trackSourceBuffer(a,s)}}this.bufferCreated()}getTrackCodec(e,t){let i=e.supplemental,r=e.codec;i&&("video"===t||"audiovideo"===t)&&iN(i,"video")&&(r=function(e,t){let i=[];if(e){let t=e.split(",");for(let e=0;e<t.length;e++)iO(t[e],"video")||i.push(t[e])}return t&&i.push(t),i.join(",")}(r,i));let a=iW(r,e.levelCodec);return a?"audio"===t.slice(0,5)?iG(a,this.appendSource):a:""}trackSourceBuffer(e,t){let i=t.buffer;if(!i)return;let r=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,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",(e,t)=>{let i=t.removedRanges;null!=i&&i.length&&this.hls.trigger(tV.BUFFER_FLUSHED,{type:e})})}get mediaSrc(){var e,t;let i=(null==(e=this.media)||null==(t=e.querySelector)?void 0:t.call(e,"source"))||this.media;return null==i?void 0:i.src}onSBUpdateStart(e){let t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if((null==(t=this.mediaSource)?void 0:t.readyState)==="closed")return void this.resetBuffer(e);let i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var i;let r=Error(`${e} SourceBuffer error. MediaSource readyState: ${null==(i=this.mediaSource)?void 0:i.readyState}`);this.error(`${r}`,t),this.hls.trigger(tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});let a=this.currentOp(e);a&&a.onError(r)}updateTimestampOffset(e,t,i,r,a,s){Math.abs(t-e.timestampOffset)>=i&&(this.log(`Updating ${r} SourceBuffer timestampOffset to ${t} (sn: ${a} cc: ${s})`),e.timestampOffset=t)}removeExecutor(e,t,i){let{media:r,mediaSource:a}=this,s=this.tracks[e],n=null==s?void 0:s.buffer;if(!r||!a||!n){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}let o=tU(r.duration)?r.duration:1/0,l=tU(a.duration)?a.duration:1/0,d=Math.max(0,t),u=Math.min(i,o,l);u>d&&(!s.ending||s.ended)?(s.ended=!1,this.log(`Removing [${d},${u}] from the ${e} SourceBuffer`),n.remove(d,u)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){let i=this.tracks[t],r=null==i?void 0:i.buffer;if(!r)throw new nr(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,r.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(e=>{this.warn(`SourceBuffer blocked callback ${e}
28`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(e){this.warn(`Callback run without blocking ${this.operationQueue} ${e}`)}}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);let{operationQueue:i}=this,r=t.map(e=>this.appendBlocker(e));return t.length>1&&this.blockedAudioAppend&&this.unblockAudio(),Promise.all(r).then(t=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(e=>{var t;let i=null==(t=this.tracks[e])?void 0:t.buffer;i&&!i.updating&&this.shiftAndExecuteNext(e)})}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}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]),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+ +!!t,0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,i){let r=this.tracks[e];if(!r)return;let a=r.buffer;if(!a)return;let s=i.bind(this,e);r.listeners.push({event:t,listener:s}),a.addEventListener(t,s)}removeBufferListeners(e){let t=this.tracks[e];if(!t)return;let i=t.buffer;i&&(t.listeners.forEach(e=>{i.removeEventListener(e.event,e.listener)}),t.listeners.length=0)}},capLevelController:nn,errorController:class extends t1{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){let e=this.hls;e.on(tV.ERROR,this.onError,this),e.on(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tV.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){let e=this.hls;e&&(e.off(tV.ERROR,this.onError,this),e.off(tV.ERROR,this.onErrorOut,this),e.off(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tV.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(null==e?void 0:e.type)===tj?e.level:this.getVariantIndex()}getVariantIndex(){var e;let t=this.hls,i=t.currentLevel;return null!=(e=t.loadLevelObj)&&e.details||-1===i?t.loadLevel:i}variantHasKey(e,t){if(e){var i;if(null!=(i=e.details)&&i.hasKey(t))return!0;let r=e.audioGroups;if(r)return this.hls.allAudioTracks.filter(e=>r.indexOf(e.groupId)>=0).some(e=>{var i;return null==(i=e.details)?void 0:i.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var i,r,a;if(t.fatal)return;let s=this.hls,n=t.context;switch(t.details){case tH.FRAG_LOAD_ERROR:case tH.FRAG_LOAD_TIMEOUT:case tH.KEY_LOAD_ERROR:case tH.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case tH.FRAG_PARSING_ERROR:if(null!=(i=t.frag)&&i.gap){t.errorAction=rg();return}case tH.FRAG_GAP:case tH.FRAG_DECRYPT_ERROR:t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=2;return;case tH.LEVEL_EMPTY_ERROR:case tH.LEVEL_PARSING_ERROR:{let e=t.parent===tj?t.level:s.loadLevel;t.details===tH.LEVEL_EMPTY_ERROR&&null!=(r=t.context)&&null!=(r=r.levelDetails)&&r.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case tH.LEVEL_LOAD_ERROR:case tH.LEVEL_LOAD_TIMEOUT:"number"==typeof(null==n?void 0:n.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level));return;case tH.AUDIO_TRACK_LOAD_ERROR:case tH.AUDIO_TRACK_LOAD_TIMEOUT:case tH.SUBTITLE_LOAD_ERROR:case tH.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){let e=s.loadLevelObj;e&&(n.type===tK&&e.hasAudioGroup(n.groupId)||n.type===tq&&e.hasSubtitleGroup(n.groupId))&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.loadLevel),t.errorAction.action=2,t.errorAction.flags=1)}return;case tH.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:2,flags:2};return;case tH.KEY_SYSTEM_SESSION_UPDATE_FAILED:case tH.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case tH.KEY_SYSTEM_NO_SESSION:t.errorAction={action:2,flags:4};return;
28case tH.BUFFER_ADD_CODEC_ERROR:case tH.REMUX_ALLOC_ERROR:case tH.BUFFER_APPEND_ERROR:t.errorAction||(t.errorAction=this.getLevelSwitchAction(t,null!=(a=t.level)?a:s.loadLevel));return;case tH.INTERNAL_EXCEPTION:case tH.BUFFER_APPENDING_ERROR:case tH.BUFFER_FULL_ERROR:case tH.LEVEL_SWITCH_ERROR:case tH.BUFFER_STALLED_ERROR:case tH.BUFFER_SEEK_OVER_HOLE:case tH.BUFFER_NUDGE_ON_STALL:t.errorAction=rg();return}t.type===t$.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=rg())}getPlaylistRetryOrSwitchAction(e,t){let i=rh(this.hls.config.playlistLoadPolicy,e),r=this.playlistError++;if(rf(i,r,rl(e),e.response))return{action:5,flags:0,retryConfig:i,retryCount:r};let a=this.getLevelSwitchAction(e,t);return i&&(a.retryConfig=i,a.retryCount=r),a}getFragRetryOrSwitchAction(e){let t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],{fragLoadPolicy:a,keyLoadPolicy:s}=t.config,n=rh(rd(e)?s:a,e),o=t.levels.reduce((e,t)=>e+t.fragmentError,0);if(r&&(e.details!==tH.FRAG_GAP&&r.fragmentError++,!ru(e))&&rf(n,o,rl(e),e.response))return{action:5,flags:0,retryConfig:n,retryCount:o};let l=this.getLevelSwitchAction(e,i);return n&&(l.retryConfig=n,l.retryCount=o),l}getLevelSwitchAction(e,t){let i=this.hls;null==t&&(t=i.loadLevel);let r=this.hls.levels[t];if(r){var a,s,n,o;let t=e.details;r.loadError++,t===tH.BUFFER_APPEND_ERROR&&r.fragmentError++;let l=-1,{levels:d,loadLevel:u,minAutoLevel:h,maxAutoLevel:c}=i;i.autoLevelEnabled||i.config.preserveManualLevelOnError||(i.loadLevel=-1);let m=null==(a=e.frag)?void 0:a.type,f=(m===tY&&t===tH.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(t===tH.BUFFER_ADD_CODEC_ERROR||t===tH.BUFFER_APPEND_ERROR))&&d.some(({audioCodec:e})=>r.audioCodec!==e),g="video"===e.sourceBufferName&&(t===tH.BUFFER_ADD_CODEC_ERROR||t===tH.BUFFER_APPEND_ERROR)&&d.some(({codecSet:e,audioCodec:t})=>r.codecSet!==e&&r.audioCodec===t),{type:v,groupId:y}=null!=(s=e.context)?s:{};for(let i=d.length;i--;){let a=(i+u)%d.length;if(a!==u&&a>=h&&a<=c&&0===d[a].loadError){let i=d[a];if(t===tH.FRAG_GAP&&m===tj&&e.frag){let t=d[a].details;if(t){let i=rs(e.frag,t.fragments,e.frag.start);if(null!=i&&i.gap)continue}}else if(v===tK&&i.hasAudioGroup(y)||v===tq&&i.hasSubtitleGroup(y))continue;else if(m===tY&&null!=(n=r.audioGroups)&&n.some(e=>i.hasAudioGroup(e))||m===tz&&null!=(o=r.subtitleGroups)&&o.some(e=>i.hasSubtitleGroup(e))||f&&r.audioCodec===i.audioCodec||g&&r.codecSet===i.codecSet||!f&&r.codecSet!==i.codecSet)continue;l=a;break}}if(l>-1&&i.loadLevel!==l)return e.levelRetry=!0,this.playlistError=0,{action:2,flags:0,nextAutoLevel:l}}return{action:2,flags:1}}onErrorOut(e,t){var i;switch(null==(i=t.errorAction)?void 0:i.action){case 0:break;case 2:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===tH.FRAG_GAP?/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()):t.fatal=!0}if(t.fatal)return void this.hls.stopLoad()}sendAlternateToPenaltyBox(e){let t=this.hls,i=e.errorAction;if(!i)return;let{flags:r}=i,a=i.nextAutoLevel;switch(r){case 0:this.switchLevel(e,a);break;case 2:{let r=this.getVariantLevelIndex(e.frag),a=t.levels[r],s=null==a?void 0:a.attrs["HDCP-LEVEL"];if(i.hdcpLevel=s,"NONE"===s)this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(s){t.maxHdcpLevel=iJ[iJ.indexOf(s)-1],i.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case 4:{let t=e.decryptdata;if(t){let r=this.hls.levels,a=r.length;for(let i=a;i--;)if(this.variantHasKey(r[i],t)){var s,n;this.log(`Banned key found in level ${i} (${r[i].bitrate}bps) or audio group "${null==(s=r[i].audioGroups)?void 0:s.join(",")}" (${null==(n=e.frag)?void 0:n.type} fragment) ${ie(t.keyId||[])}`),r[i].fragmentError++,r[i].loadError++,this.log(`Removing level ${i} with key error (${e.error})`),this.hls.removeLevel(i)}let o=e.frag;if(this.hls.levels.length<a)i.resolved=!0;else if(o&&o.type!==tj){let e=o.decryptdata;e&&!t.matches(e)&&(i.resolved=!0)}}}}i.resolved||this.switchLevel(e,a)}switchLevel(e,t){if(void 0!==t&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===tH.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&"audiovideo"!==e.sourceBufferName)){let t=ij(e.mimeType),i=this.hls.levels;for(let r=i.length;r--;)i[r][`${e.sourceBufferName}Codec`]===t&&(this.log(`Removing level ${r} for ${e.details} ("${t}" not supported)`),this.hls.removeLevel(r))}}},fpsController:class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}
28registerListeners(){this.hls.on(tV.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(tV.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(tV.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(tV.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){let i=this.hls.config;if(i.capLevelOnFPSDrop){let e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&"function"==typeof e.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){let r=performance.now();if(t){if(this.lastTime){let e=r-this.lastTime,a=i-this.lastDroppedFrames,s=t-this.lastDecodedFrames,n=1e3*a/e,o=this.hls;if(o.trigger(tV.FPS_DROP,{currentDropped:a,currentDecoded:s,totalDroppedFrames:i}),n>0&&a>o.config.fpsDroppedMonitoringThreshold*s){let e=o.currentLevel;o.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===o.autoLevelCapping||o.autoLevelCapping>=e)&&(e-=1,o.trigger(tV.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:o.currentLevel}),o.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){let e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){let t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}},stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:at,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:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},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},{cueHandler:oj,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends aJ{constructor(e,t,i){super(e,t,i,"subt
28itle-stream-controller",tz),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();let{hls:e}=this;e.on(tV.LEVEL_LOADED,this.onLevelLoaded,this),e.on(tV.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(tV.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(tV.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(tV.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(tV.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();let{hls:e}=this;e.off(tV.LEVEL_LOADED,this.onLevelLoaded,this),e.off(tV.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(tV.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(tV.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(tV.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(tV.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=aV,this.setInterval(500),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){let i,{frag:r,success:a}=t;if(this.fragContextChanged(r)||(iu(r)&&(this.fragPrevious=r),this.state=aV),!a)return;let s=this.tracksBuffered[this.currentTrackId];if(!s)return;let n=r.start;for(let e=0;e<s.length;e++)if(n>=s[e].start&&n<=s[e].end){i=s[e];break}let o=r.start+r.duration;i?i.end=o:(i={start:n,end:o},s.push(i)),this.fragmentTracker.fragBuffered(r),this.fragBufferedComplete(r,null),this.media&&this.tick()}onBufferFlushing(e,t){let{startOffset:i,endOffset:r}=t;if(0===i&&r!==1/0){let e=r-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach(t=>{for(let i=0;i<t.length;){if(t[i].end<=e){t.shift();continue}if(t[i].start<e)t[i].start=e;else break;i++}}),this.fragmentTracker.removeFragmentsInRange(i,e,tz)}}onError(e,t){let i=t.frag;(null==i?void 0:i.type)===tz&&(t.details===tH.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==aH&&(this.state=aV))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&s9(this.levels,t)){this.levels=t.map(e=>new i3(e));return}this.tracksBuffered=[],this.levels=t.map(e=>{let t=new i3(e);return this.tracksBuffered[t.id]=[],t}),this.fragmentTracker.removeFragmentsInRange(0,1/0,tz),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,!(null!=(i=this.levels)&&i.length)||-1===this.currentTrackId)return void this.clearInterval();let r=this.levels[this.currentTrackId];null!=r&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.state!==aH&&this.setInterval(500)}onSubtitleTrackLoaded(e,t){var i,r;let{currentTrackId:a,levels:s}=this,{details:n,id:o}=t;if(!s)return void this.warn(`Subtitle tracks were reset while loading level ${o}`);let l=s[o];if(o>=s.length||!l)return;this.log(`Subtitle track ${o} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let d=0;if(n.live||null!=(i=l.details)&&i.live){if(n.deltaUpdateFailed)return;let e=this.mainDetails;if(!e){this.startFragRequested=!1;return}let t=e.fragments[0];l.details?0===(d=this.alignPlaylists(n,l.details,null==(r=this.levelLastLoaded)?void 0:r.details))&&t&&aL(n,d=t.start):n.hasProgramDateTime&&e.hasProgramDateTime?(aU(n,e),d=n.fragmentStart):t&&aL(n,d=t.start),e&&!this.startFragRequested&&this.setStartPosition(e,d)}l.details=n,this.levelLastLoaded=l,o===a&&(this.hls.trigger(tV.SUBTITLE_TRACK_UPDATED,{details:n,id:o,groupId:t.groupId}),this.tick(),n.live&&!this.fragCurrent&&this.media&&this.state===aV&&(rs(null,n.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)))}_handleFragmentLoadComplete(e){let{frag:t,payload:i}=e,r=t.decryptdata,a=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>
280&&null!=r&&r.key&&r.iv&&rj(r.method)){let e=performance.now();this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer,rY(r.method)).catch(e=>{throw a.trigger(tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e}).then(i=>{let r=performance.now();a.trigger(tV.FRAG_DECRYPTED,{frag:t,payload:i,stats:{tstart:e,tdecrypt:r}})}).catch(e=>{this.warn(`${e.name}: ${e.message}`),this.state=aV})}}doTick(){if(!this.media){this.state=aV;return}if(this.state===aV){let{currentTrackId:e,levels:t}=this,i=null==t?void 0:t[e];if(!i||!t.length||!i.details||this.waitForLive(i))return;let{config:r}=this,a=this.getLoadPosition(),{end:s,len:n}=rN.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],a,r.maxBufferHole),o=i.details;if(n>this.hls.maxBufferLength+o.levelTargetDuration)return;let l=o.fragments,d=l.length,u=o.edge,h=null,c=this.fragPrevious;if(s<u){let e=r.maxFragLookUpTolerance;(h=rs(c,l,Math.max(l[0].start,s),s>u-e?0:e))||!c||!(c.start<l[0].start)||(h=l[0])}else h=l[d-1];if(!(h=this.filterReplacedPrimary(h,i.details)))return;let m=l[h.sn-o.startSN-1];if(m&&m.cc===h.cc&&this.fragmentTracker.getState(m)===rv&&(h=m),this.fragmentTracker.getState(h)===rv){let e=this.mapToInitFragWhenRequired(h);e&&this.loadFragment(e,i,s)}}}loadFragment(e,t,i){iu(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new oi(this.tracksBuffered[this.currentTrackId]||[])}},subtitleTrackController:class extends s8{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 e=null,t=nZ(this.media.textTracks);for(let i=0;i<t.length;i++)if("hidden"===t[i].mode)e=t[i];else if("showing"===t[i].mode){e=t[i];break}let i=this.findTrackForTextTrack(e);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){let{hls:e}=this;e.on(tV.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tV.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tV.LEVEL_LOADING,this.onLevelLoading,this),e.on(tV.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(tV.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(tV.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(tV.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tV.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tV.LEVEL_LOADING,this.onLevelLoading,this),e.off(tV.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(tV.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(tV.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){let i=this.media;if(!i)return;let r=!!t.transferMedia;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,r||nZ(i.textTracks).forEac
28h(e=>{nX(e)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){let{id:i,groupId:r,details:a}=t,s=this.tracksInGroup[i];if(!s||s.groupId!==r)return void this.warn(`Subtitle track with id:${i} and group:${r} not found in active group ${null==s?void 0:s.groupId}`);let n=s.details;s.details=t.details,this.log(`Subtitle track ${i} "${s.name}" lang:${s.lang} group:${r} loaded [${a.startSN}-${a.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,n)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){let t=this.hls.levels[e];if(!t)return;let i=t.subtitleGroups||null,r=this.groupIds,a=this.currentTrack;if(!i||(null==r?void 0:r.length)!==(null==i?void 0:i.length)||null!=i&&i.some(e=>(null==r?void 0:r.indexOf(e))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;let e=this.tracks.filter(e=>!i||-1!==i.indexOf(e.groupId));if(e.length)this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),e.forEach((e,t)=>{e.id=t});else if(!a&&!this.tracksInGroup.length)return;this.tracksInGroup=e;let t=this.hls.config.subtitlePreference;if(!a&&t){this.selectDefaultTrack=!1;let i=i7(t,e);if(i>-1)a=e[i];else{let e=i7(t,this.tracks);a=this.tracks[e]}}let r=this.findTrackId(a);-1===r&&a&&(r=this.findTrackId(null)),this.log(`Updating subtitle tracks, ${e.length} track(s) found in "${null==i?void 0:i.join(",")}" group-id`),this.hls.trigger(tV.SUBTITLE_TRACKS_UPDATED,{subtitleTracks:e}),-1!==r&&-1===this.trackId&&this.setSubtitleTrack(r)}}findTrackId(e){let t=this.tracksInGroup,i=this.selectDefaultTrack;for(let r=0;r<t.length;r++){let a=t[r];if((!i||a.default)&&(i||e)&&(!e||re(a,e)))return r}if(e){for(let i=0;i<t.length;i++){let r=t[i];if(s6(e.attrs,r.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){let r=t[i];if(s6(e.attrs,r.attrs,["LANGUAGE"]))return i}}return -1}findTrackForTextTrack(e){if(e){let t=this.tracksInGroup;for(let i=0;i<t.length;i++)if(s7(t[i],e))return i}return -1}onError(e,t){!t.fatal&&t.context&&(t.context.type!==tq||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||this.checkRetry(t))}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(-1===e.id)return this.setSubtitleTrack(-1),null;let t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){let i=this.currentTrack;if(i&&re(e,i))return i;let r=i7(e,this.tracksInGroup);if(r>-1){let e=this.tracksInGroup[r];return this.setSubtitleTrack(r),e}{if(i)return null;let r=i7(e,t);if(r>-1)return t[r]}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let i=e.id,r=e.groupId,a=this.getUrlWithDirectives(e.url,t),s=e.details,n=null==s?void 0:s.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${r}${(null==t?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${n&&s.live?" age "+n.toFixed(1)+(s.type?" "+s.type:""):""} ${a}`),this.hls.trigger(tV.SUBTITLE_TRACK_LOADING,{url:a,id:i,groupId:r,deliveryDirectives:t||null,track:e})}toggleTrackModes(){let e,{media:t}=this;if(!t)return;let i=nZ(t.textTracks),r=this.currentTrack;if(r&&((e=i.filter(e=>s7(r,e))[0])||this.warn(`Unable to find subtitle TextTrack with name "${r.name}" and language "${r.lang}"`)),[].slice.call(i).forEach(t=>{"disabled"!==t.mode&&t!==e&&(t.mode="disabled")}),e){let t=this.subtitleDisplay?"showing":"hidden";e.mode!==t&&(e.mode=t)}}setSubtitleTrack(e){let t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!tU(e))return void this.warn(`Invalid subtitle track id: ${e}`);this.selectDefaultTrack=!1;let i=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r)return void this.hls.trigger(tV.SUBTITLE_TRACK_SWITCH,{id:e});let a=!!r.details&&!r.details.live;if(e===this.trackId&&r===i&&a)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));let{id:s,groupId:n="",name:o,type:l,url:d}=r;this.hls.trigger(tV.SUBTITLE_TRACK_SWITCH,{id:s,groupId:n,name:o,type:l,url:d});let u=this.switchParams(r.url,null==i?void 0:i.details,r.details);this.loadPlaylist(u)}},timelineController:class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=oK(),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}}
28,e.on(tV.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tV.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(tV.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(tV.FRAG_LOADING,this.onFragLoading,this),e.on(tV.FRAG_LOADED,this.onFragLoaded,this),e.on(tV.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(tV.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(tV.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(tV.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(tV.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){let{hls:e}=this;e.off(tV.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tV.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(tV.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(tV.FRAG_LOADING,this.onFragLoading,this),e.off(tV.FRAG_LOADED,this.onFragLoaded,this),e.off(tV.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(tV.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(tV.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(tV.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(tV.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){let e=new oV(this,"textTrack1"),t=new oV(this,"textTrack2"),i=new oV(this,"textTrack3"),r=new oV(this,"textTrack4");this.cea608Parser1=new ov(1,e,t),this.cea608Parser2=new ov(3,i,r)}addCues(e,t,i,r,a){let s=!1;for(let e=a.length;e--;){var n,o;let r=a[e],l=(n=r[0],o=r[1],Math.min(o,i)-Math.max(n,t));if(l>=0&&(r[0]=Math.min(r[0],t),r[1]=Math.max(r[1],i),s=!0,l/(i-t)>.5))return}if(s||a.push([t,i]),this.config.renderTextTracksNatively){let a=this.captionsTracks[e];this.Cues.newCue(a,t,i,r)}else{let a=this.Cues.newCue(null,t,i,r);this.hls.trigger(tV.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:a,trackId:s}){let{unparsedVttFrags:n}=this;i===tj&&(this.initPTS[t.cc]={baseTime:r,timescale:a,trackId:s}),n.length&&(this.unparsedVttFrags=[],n.forEach(e=>{this.initPTS[e.frag.cc]?this.onFragLoaded(tV.FRAG_LOADED,e):this.hls.trigger(tV.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e.frag,error:Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){let{media:i}=this;if(i)for(let r=0;r<i.textTracks.length;r++){let a=i.textTracks[r];if(oW(a,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return a}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;let{captionsProperties:t,captionsTracks:i,media:r}=this,{label:a,languageCode:s}=t[e],n=this.getExistingTrack(a,s);if(n)i[e]=n,nX(i[e]),nY(i[e],r);else{let t=this.createTextTrack("captions",a,s);t&&(t[e]=!0,i[e]=t)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;let t=this.captionsProperties[e];if(!t)return;let i={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(tV.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,i){let r=this.media;if(r)return r.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){let i=!!t.transferMedia;if(this.media=null,i)return;let{captionsTracks:r}=this;Object.keys(r).forEach(e=>{nX(r[e]),delete r[e]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=oK(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){let{media:e}=this;if(!e)return;let t=e.textTracks;
28if(t)for(let e=0;e<t.length;e++)nX(t[e])}onSubtitleTracksUpdated(e,t){let i=t.subtitleTracks||[],r=i.some(e=>e.textCodec===ox);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(s9(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){let e=this.media,t=e?nZ(e.textTracks):null;if(this.tracks.forEach((e,i)=>{let r;if(t){let i=null;for(let r=0;r<t.length;r++)if(t[r]&&oW(t[r],e)){i=t[r],t[r]=null;break}i&&(r=i)}if(r)nX(r);else{let t=oG(e);(r=this.createTextTrack(t,e.name,e.lang))&&(r.mode="disabled")}r&&this.textTracks.push(r)}),null!=t&&t.length){let e=t.filter(e=>null!==e).map(e=>e.label);e.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${e.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){let e=this.tracks.map(e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}));this.hls.trigger(tV.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(e=>{let t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;let i=`textTrack${t[1]}`,r=this.captionsProperties[i];r&&(r.label=e.name,e.lang&&(r.languageCode=e.lang),r.media=e)})}closedCaptionsForLevel(e){let t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===tj){var i,r;let{cea608Parser1:e,cea608Parser2:a,lastSn:s}=this,{cc:n,sn:o}=t.frag,l=null!=(i=null==(r=t.part)?void 0:r.index)?i:-1;e&&a&&(o!==s+1||o===s&&l!==this.lastPartIndex+1||n!==this.lastCc)&&(e.reset(),a.reset()),this.lastCc=n,this.lastSn=o,this.lastPartIndex=l}}onFragLoaded(e,t){let{frag:i,payload:r}=t;if(i.type===tz)if(r.byteLength){let e=i.decryptdata,a="stats"in t;if(null==e||!e.encrypted||a){let e=this.tracks[i.level],a=this.vttCCs;a[i.cc]||(a[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),e&&e.textCodec===ox?this._parseIMSC1(i,r):this._parseVTTs(t)}}else this.hls.trigger(tV.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:Error("Empty subtitle payload")})}_parseIMSC1(e,t){let i=this.hls;oN(t,this.initPTS[e.cc],t=>{this._appendCues(t,e.level),i.trigger(tV.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},t=>{i.logger.log(`Failed to parse IMSC1: ${t}`),i.trigger(tV.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})})}_parseVTTs(e){var t,i,r,a,s,n,o,l;let d,u,h,c,m,f,g,v,y,{frag:E,payload:b}=e,{initPTS:T,unparsedVttFrags:A}=this,_=T.length-1;if(!T[E.cc]&&-1===_)return void A.push(e);let S=this.hls;i=null!=(t=E.initSegment)&&t.data?iI(E.initSegment.data,new Uint8Array(b)).buffer:b,r=this.initPTS[E.cc],a=this.vttCCs,s=E.cc,n=E.start,o=e=>{this._appendCues(e,E.level),S.trigger(tV.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:E})},l=t=>{let i="Missing initPTS for VTT MPEGTS"===t.message;i?A.push(e):this._fallbackToIMSC1(E,b),S.logger.log(`Failed to parse VTT cue: ${t}`),i&&_>E.cc||S.trigger(tV.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:E,error:t})},u=new oL,h=t7(new Uint8Array(i)).trim().replace(ow,"\n").split("\n"),c=[],m=r?function(e,t=1){return s$(e,9e4,1/t)}(r.baseTime,r.timescale):0,f="00:00.000",g=0,v=0,y=!0,u.oncue=function(e){let t=a[s],i=a.ccOffset,o=(g-m)/9e4;if(null!=t&&t.new&&(void 0!==v?i=a.ccOffset=t.start:oD(a,s,o)),o){if(!r){d=Error("Missing initPTS for VTT MPEGTS");return}i=o-a.presentationOffset}let l=e.endTime-e.startTime,u=sj((e.startTime+i-v)*9e4,9e4*n)/9e4;e.startTime=Math.max(u,0),e.endTime=Math.max(u+l,0);let h=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(h)),e.id||(e.id=oC(e.startTime,e.endTime,h)),e.endTime>0&&c.push(e)},u.onparsingerror=function(e){d=e},u.onflush=function(){d?l(d):o(c)},h.forEach(e=>{if(y)if(oR(e,"X-TIMESTAMP-MAP=")){y=!1,e.slice(16).split(",").forEach(e=>{oR(e,"LOCAL:")?f=e.slice(6):oR(e,"MPEGTS:")&&(g=parseInt(e.slice(7)))});try{v=oI(f)/1e3}catch(e){d=e}return}else""===e&&(y=!1);u.parse(e+"\n")}),u.flush()}_fallbackToIMSC1(e,t){let i=this.tracks[e.level];i.textCodec||oN(t,this.initPTS[e.cc],()=>{i.textCodec=ox,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){let i=this.hls;if(this.config.renderTextTracksNatively){let i=this.textTracks[t];if(!i||"disabled"===i.mode)return;
28e.forEach(e=>nz(i,e))}else{let r=this.tracks[t];if(!r)return;let a=r.default?"default":"subtitles"+t;i.trigger(tV.CUES_PARSED,{type:"subtitles",cues:e,track:a})}}onFragDecrypted(e,t){let{frag:i}=t;i.type===tz&&this.onFragLoaded(tV.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;let{frag:i,samples:r}=t;if(i.type!==tj||"NONE"!==this.closedCaptionsForLevel(i))for(let e=0;e<r.length;e++){let t=r[e].bytes;if(t){this.cea608Parser1||this.initCea608Parsers();let i=this.extractCea608Data(t);this.cea608Parser1.addData(r[e].pts,i[0]),this.cea608Parser2.addData(r[e].pts,i[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:r,type:a}){let{media:s}=this;if(s&&!(s.currentTime<i)){if(!a||"video"===a){let{captionsTracks:e}=this;Object.keys(e).forEach(r=>nQ(e[r],t,i))}if(this.config.renderTextTracksNatively&&0===t&&void 0!==r){let{textTracks:e}=this;Object.keys(e).forEach(i=>nQ(e[i],t,r))}}}extractCea608Data(e){let t=[[],[]],i=31&e[0],r=2;for(let a=0;a<i;a++){let i=e[r++],a=127&e[r++],s=127&e[r++];if((0!==a||0!==s)&&(4&i)!=0){let e=3&i;(0===e||1===e)&&(t[e].push(a),t[e].push(s))}}return t}},audioStreamController:class extends aJ{constructor(e,t,i){super(e,t,i,"audio-stream-controller",tY),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();let{hls:e}=this;e.on(tV.LEVEL_LOADED,this.onLevelLoaded,this),e.on(tV.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(tV.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(tV.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(tV.BUFFER_RESET,this.onBufferReset,this),e.on(tV.BUFFER_CREATED,this.onBufferCreated,this),e.on(tV.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(tV.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(tV.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(tV.FRAG_LOADING,this.onFragLoading,this),e.on(tV.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){let{hls:e}=this;e&&(super.unregisterListeners(),e.off(tV.LEVEL_LOADED,this.onLevelLoaded,this),e.off(tV.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(tV.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(tV.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(tV.BUFFER_RESET,this.onBufferReset,this),e.off(tV.BUFFER_CREATED,this.onBufferCreated,this),e.off(tV.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(tV.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(tV.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(tV.FRAG_LOADING,this.onFragLoading,this),e.off(tV.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:a,trackId:s}){if(i===tj){let e=t.cc,i=this.fragCurrent;if(this.initPTS[e]={baseTime:r,timescale:a,trackId:s},this.log(`InitPTS for cc: ${e} found from main: ${r/a} (${r}/${a}) trackId: ${s}`),this.mainAnchor=t,this.state===aQ){let i=this.waitingData;(i||this.loadingParts)&&(!i||i.frag.cc===e)||this.syncWithAnchor(t,null==i?void 0:i.frag)}else!this.hls.hasEnoughToStart&&i&&i.cc!==e?(i.abortRequests(),this.syncWithAnchor(t,i)):this.state===aV&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var i;let r=(null==(i=this.mainFragLoading)?void 0:i.frag)||null;if(t&&(null==r?void 0:r.cc)===t.cc)return;let a=(r||e).cc,s=ro(this.getLevelDetails(),a,this.getLoadPosition());s&&(this.log(`Syncing with main frag at ${s.start} cc ${s.cc}`),this.startFragRequested=!1,this.nextLoadPosition=s.start,this.resetLoadingState(),this.state===aV&&this.doTickIdle())}
28startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=aH;return}let i=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),i>0&&-1===e?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=aV):this.state=aq,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case aV:this.doTickIdle();break;case aq:{let{levels:e,trackId:t}=this,i=null==e?void 0:e[t],r=null==i?void 0:i.details;if(r&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(r))break;this.state=aQ}break}case aK:this.checkRetryDate();break;case aQ:{let e=this.waitingData;if(e){let{frag:t,part:i,cache:r,complete:a}=e,s=this.mainAnchor;if(void 0!==this.initPTS[t.cc]){this.waitingData=null,this.state=aW;let e={frag:t,part:i,payload:r.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(e),a&&super._handleFragmentLoadComplete(e)}else s&&s.cc!==e.frag.cc&&this.syncWithAnchor(s,e.frag)}else this.state=aV}}this.onTickEnd()}resetLoadingState(){let e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){let{media:e}=this;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;let{hls:t,levels:i,media:r,trackId:a}=this,s=t.config;if(!this.buffering||!r&&!this.primaryPrefetch&&(this.startFragRequested||!s.startFragPrefetch)||!(null!=i&&i[a]))return;let n=i[a],o=n.details;if(!o||this.waitForLive(n)||this.waitForCdnTuneIn(o)){this.state=aq,this.startFragRequested=!1;return}let l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,is,tY));let d=this.getFwdBufferInfo(l,tY);if(null===d)return;if(!this.switchingTrack&&this._streamEnded(d,o)){t.trigger(tV.BUFFER_EOS,{type:"audio"}),this.state=az;return}let u=d.len,h=t.maxBufferLength,c=o.fragments,m=c[0].start,f=this.getLoadPosition(),g=this.flushing?f:d.end;if(this.switchingTrack&&r&&o.PTSKnown&&f<m&&(d.end>m||d.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=m+.05),u>=h&&!this.switchingTrack&&g<c[c.length-1].start)return;let v=this.getNextFragment(g,o);if(v&&this.isLoopLoading(v,g)&&(v=this.getNextFragmentLoopLoading(v,o,d,tj,h)),!v){this.bufferFlushed=!0;return}let y=(null==(e=this.mainFragLoading)?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&y&&iu(v)&&!v.endList&&(!o.live||!this.loadingParts&&g<this.hls.liveSyncPosition)&&("OK"===this.fragmentTracker.getState(y)&&(this.mainFragLoading=y=null),y&&iu(y))){if(v.start>y.end){let e=this.fragmentTracker.getFragAtPos(g,tj);e&&e.end>y.end&&(y=e,this.mainFragLoading={frag:e,targetBufferTime:null})}if(v.start>y.end)return}this.loadFragment(v,n,g)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(e=>new i3(e))}onAudioTrackSwitching(e,t){let i=!!t.url;this.trackId=t.id;let{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==aH&&(this.setInterval(100),this.state=aV,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;let i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(tV.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i,r;let{levels:a}=this,{details:s,id:n,groupId:o,track:l}=t;if(!a)return void this.warn(`Audio tracks reset while loading track ${n} "${l.name}" of "${o}"`);let d=this.mainDetails;if(!d||s.endCC>d.endCC||d.expired){this.cachedTrackLoadedData=t,this.state!==aH&&(this.state=aq);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${n} "${l.name}" of "${o}" loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);let u=a[n],h=0;
28if(s.live||null!=(i=u.details)&&i.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;u.details&&(h=this.alignPlaylists(s,u.details,null==(r=this.levelLastLoaded)?void 0:r.details)),s.alignedSliding||(aN(s,d),s.alignedSliding||aU(s,d),h=s.fragmentStart)}u.details=s,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(d,h),this.hls.trigger(tV.AUDIO_TRACK_UPDATED,{details:s,id:n,groupId:t.groupId}),this.state!==aq||this.waitForCdnTuneIn(s)||(this.state=aV),this.tick()}_handleFragmentLoadProgress(e){var t;let i=e.frag,{part:r,payload:a}=e,{config:s,trackId:n,levels:o}=this;if(!o)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);let l=o[n];if(!l)return void this.warn("Audio track is undefined on fragment load progress");let d=l.details;if(!d){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}let u=s.defaultAudioCodec||l.audioCodec||"mp4a.40.2",h=this.transmuxer;h||(h=this.transmuxer=new s5(this.hls,tY,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));let c=this.initPTS[i.cc],m=null==(t=i.initSegment)?void 0:t.data;if(void 0!==c){let e=r?r.index:-1,t=new rP(i.level,i.sn,i.stats.chunkCount,a.byteLength,e,-1!==e);h.push(a,m,u,"",i,r,d.totalduration,!1,t,c)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${d.startSN} ,${d.endSN}],track ${n}`);let{cache:e}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new a1,complete:!1};e.push(new Uint8Array(a)),this.state!==aH&&(this.state=aQ)}}_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;let i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===tj&&iu(t.frag)&&(this.mainFragLoading=t,this.state===aV&&this.tick())}onFragBuffered(e,t){let{frag:i,part:r}=t;if(i.type!==tY){this.audioOnly||i.type!==tj||i.elementaryStreams.video||i.elementaryStreams.audiovideo||(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(i))return void this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);if(iu(i)){this.fragPrevious=i;let e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(tV.AUDIO_TRACK_SWITCHED,t0({},e)))}this.fragBufferedComplete(i,r),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=aX;return}switch(t.details){case tH.FRAG_GAP:case tH.FRAG_PARSING_ERROR:case tH.FRAG_DECRYPT_ERROR:case tH.FRAG_LOAD_ERROR:case tH.FRAG_LOAD_TIMEOUT:case tH.KEY_LOAD_ERROR:case tH.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(tY,t);break;case tH.AUDIO_TRACK_LOAD_ERROR:case tH.AUDIO_TRACK_LOAD_TIMEOUT:case tH.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==aq||(null==(i=t.context)?void 0:i.type)!==tK||(this.state=aV);break;case tH.BUFFER_ADD_CODEC_ERROR:case tH.BUFFER_APPEND_ERROR:if("audio"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case tH.BUFFER_FULL_ERROR:if("audio"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,1/0,"audio"));break;case tH.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushing(e,{type:t}){t!==io&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==io){this.flushing=!1,this.bufferFlushed=!0,this.state===az&&(this.state=aV);let e=this.mediaBuffer||this.media;e&&(this.afterBufferFlushed(e,t,tY),this.tick())}}_handleTransmuxComplete(e){var t;let i="audio",{hls:r}=this,{remuxResult:a,chunkMeta:s}=e,n=this.getCurrentContext(s);if(!n)return void this.resetWhenMissingContext(s);let{frag:o,part:l,level:d}=n,{details:u}=d,{audio:h,text:c,id3:m,initSegment:f}=a;if(this.fragContextChanged(o)||!u)return void this.fragmentTracker.removeFragment(o);if(this.state=aj,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),null!=f&&f.tracks){let e=o.initSegment||o;if(this.unhandledEncryptionError(f,o))return;this._bufferInitSegment(d,f.tracks,e,s),r.trigger(tV.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:f.tracks})}if(h){let{startPTS:e,endPTS:t,startDTS:i,endDTS:r}=h;l&&(l.elementaryStreams[is]={startPTS:e,endPTS:t,startDTS:i,endDTS:r}),o.setElementaryStreamInfo(is,e,t,i,r),this.bufferFragmentData(h,o,l,s)}if(null!=m&&null!=(t=m.samples)&&t.length){let e=tZ({id:i,frag:o,details:u},m);r.trigger(tV.FRAG_PARSING_METADATA,e)}if(c){let e=tZ({id:i,frag:o,details:u},c);r.trigger(tV.FRAG_PARSING_USERDATA,e)}}_bufferInitSegment(e,t,i,r){if(this.state!==aj||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;let a=t.audio;a.id=tY;let s=e.audioCodec;this.log(`Init audio buffer, container:${a.container}, codecs[level/parsed]=[${s}/${a.codec}]`),s&&1===s.split(",").length&&(a.levelCodec=s),this.hls.trigger(tV.BUFFER_CODECS,t);let n=a.initSegment;if(null!=n&&n.byteLength){let e={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:n};this.hls.trigger(tV.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,i){let r=this.fragmentTracker.getState(e);if(this.switchingTrack||r===rv||r===rE){var a;if(iu(e))if(null!=(a=t.details)&&a.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=aQ;let i=this.mainDetails;i&&i.fragmentStart!==t.details.fragmentStart&&aU(t.details,i)}else super.loadFragment(e,t,i);else this._loadInitSegment(e,t)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){let{name:t,lang:i,assocLang:r,characteristics:a,audioCodec:s,channels:n}=this.bufferedTrack;re({name:t,lang:i,assocLang:r,characteristics:a,audioCodec:s,channels:n},e,rt)||(rr(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,1/0,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){let{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(tV.AUDIO_TRACK_SWITCHED,t0({},e))}},audioTrackController:class extends s8{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){let{hls:e}=this;e.on(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tV.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tV.LEVEL_LOADING,this.onLevelLoading,this),e.on(tV.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(tV.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(tV.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tV.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tV.LEVEL_LOADING,this.onLevelLoading,this),e.off(tV.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(tV.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(tV.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){let{id:i,groupId:r,details:a}=t,s=this.tracksInGroup[i];if(!s||s.groupId!==r)return void this.warn(`Audio track with id:${i} and group:${r} not found in active group ${null==s?void 0:s.groupId}`);let n=s.details;s.details=t.details,this.log(`Audio track ${i} "${s.name}" lang:${s.lang} group:${r} loaded [${a.startSN}-${a.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,n)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){let t=this.hls.levels[e];if(!t)return;let i=t.audioGroups||null,r=this.groupIds,a=this.currentTrack;if(!i||(null==r?void 0:r.length)!==(null==i?void 0:i.length)||null!=i&&i.some(e=>(null==r?void 0:r.indexOf(e))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;let e=this.tracks.filter(e=>!i||-1!==i.indexOf(e.groupId));if(e.length)this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),e.forEach((e,t)=>
28{e.id=t});else if(!a&&!this.tracksInGroup.length)return;this.tracksInGroup=e;let t=this.hls.config.audioPreference;if(!a&&t){let i=i7(t,e,rt);if(i>-1)a=e[i];else{let e=i7(t,this.tracks);a=this.tracks[e]}}let r=this.findTrackId(a);-1===r&&a&&(r=this.findTrackId(null)),this.log(`Updating audio tracks, ${e.length} track(s) found in group(s): ${null==i?void 0:i.join(",")}`),this.hls.trigger(tV.AUDIO_TRACKS_UPDATED,{audioTracks:e});let n=this.trackId;if(-1!==r&&-1===n)this.setAudioTrack(r);else if(e.length&&-1===n){var s;let t=Error(`No audio track selected for current audio group-ID(s): ${null==(s=this.groupIds)?void 0:s.join(",")} track count: ${e.length}`);this.warn(t.message),this.hls.trigger(tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}}onError(e,t){!t.fatal&&t.context&&(t.context.type!==tK||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){let t=this.hls;if(t.config.audioPreference=e,e){let a=this.allAudioTracks;
28if(this.selectDefaultTrack=!1,a.length){let s=this.currentTrack;if(s&&re(e,s,rt))return s;let n=i7(e,this.tracksInGroup,rt);if(n>-1){let e=this.tracksInGroup[n];return this.setAudioTrack(n),e}if(s){var i,r;let s,n,o,l,d,u,h=t.loadLevel;-1===h&&(h=t.firstAutoLevel);let c=(i=t.levels,s=i[r=h],(n=i.reduce((e,t,i)=>{let r=t.uri;return(e[r]||(e[r]=[])).push(i),e},{})[s.uri]).length>1&&(r=Math.max.apply(Math,n)),o=s.videoRange,l=s.frameRate,d=s.codecSet.substring(0,4),(u=ri(i,r,t=>{if(t.videoRange!==o||t.frameRate!==l||t.codecSet.substring(0,4)!==d)return!1;let i=t.audioGroups;return i7(e,a.filter(e=>!i||-1!==i.indexOf(e.groupId)),rt)>-1}))>-1?u:ri(i,r,t=>{let i=t.audioGroups;return i7(e,a.filter(e=>!i||-1!==i.indexOf(e.groupId)),rt)>-1}));if(-1===c)return null;t.nextLoadLevel=c}if(e.channels||e.audioCodec){let t=i7(e,a);if(t>-1)return a[t]}}}return null}setAudioTrack(e){let t=this.tracksInGroup;if(e<0||e>=t.length)return void this.warn(`Invalid audio track id: ${e}`);this.selectDefaultTrack=!1;let i=this.currentTrack,r=t[e],a=r.details&&!r.details.live;if(e===this.trackId&&r===i&&a||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(tV.AUDIO_TRACK_SWITCHING,t0({},r)),a))return;let s=this.switchParams(r.url,null==i?void 0:i.details,r.details);this.loadPlaylist(s)}findTrackId(e){let t=this.tracksInGroup;for(let i=0;i<t.length;i++){let r=t[i];if((!this.selectDefaultTrack||r.default)&&(!e||re(e,r,rt)))return i}if(e){let{name:i,lang:r,assocLang:a,characteristics:s,audioCodec:n,channels:o}=e;for(let e=0;e<t.length;e++)if(re({name:i,lang:r,assocLang:a,characteristics:s,audioCodec:n,channels:o},t[e],rt))return e;for(let i=0;i<t.length;i++){let r=t[i];if(s6(e.attrs,r.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){let r=t[i];if(s6(e.attrs,r.attrs,["LANGUAGE"]))return i}}return -1}loadPlaylist(e){super.loadPlaylist();let t=this.currentTrack;this.shouldLoadPlaylist(t)&&rr(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let i=e.id,r=e.groupId,a=this.getUrlWithDirectives(e.url,t),s=e.details,n=null==s?void 0:s.age;this.log(`Loading audio-track ${i} "${e.name}" lang:${e.lang} group:${r}${(null==t?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${n&&s.live?" age "+n.toFixed(1)+(s.type?" "+s.type:""):""} ${a}`),this.hls.trigger(tV.AUDIO_TRACK_LOADING,{url:a,id:i,groupId:r,deliveryDirectives:t||null,track:e})}},emeController:nW,cmcdController:class{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:"m",su:!this.initialized})}catch(e){this.hls.logger.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=e=>{try{let{frag:t,part:i}=e,r=this.hls.levels[t.level],a=this.getObjectType(t),s={d:1e3*(i||t).duration,ot:a};("v"===a||"a"===a||"av"==a)&&(s.br=r.bitrate/1e3,s.tb=this.getTopBandwidth(a)/1e3,s.bl=this.getBufferLength(a));let n=i?this.getNextPart(i):this.getNextFrag(t);null!=n&&n.url&&n.url!==t.url&&(s.nor=n.url),this.apply(e,s)}catch(e){this.hls.logger.warn("Could not generate segment CMCD data.",e)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;null!=i&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||e.sessionId,this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){let e=this.hls;e.on(tV.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tV.MEDIA_DETACHED,this.onMediaDetached,this),e.on(tV.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){let e=this.hls;e.off(tV.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tV.MEDIA_DETACHED,this.onMediaDetached,this),e.off(tV.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 i,r;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(r=t.tracks.video)?void 0:r.buffer}createData(){var e;return{v:1,sf:"h",sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){tZ(t,this.createData());let i="i"===t.ot||"v"===t.ot||"av"===t.ot;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);let{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((e,i)=>(r.includes(i)&&(e[i]=t[i]),e),{}));let a={baseUrl:e.url};if(this.useHeaders){var s;e.headers||(e.headers={}),s=e.headers,tZ(s,function(e,t={}){let i={};return e?Object.entries(function(e,t){let i={};if(!e)return i;let r=Object.keys(e),a=t?Object.keys(t).reduce((e,i)=>{var r;return null==(r=t[i])||r.forEach(t=>e[t]=i),e},{}):{};return r.reduce((t,i)=>{var r;let s=n_[i]||a[i]||nb;return(null!=(r=t[s])?r:t[s]={})[i]=e[i],t},i)}
28(n$(e,t),null==t?void 0:t.customHeaderMap)).reduce((e,[t,i])=>{let r=ny(i,{whitespace:!1});return r&&(e[t]=r),e},i):i}(t,a))}else e.url=function(e,t,i){let r=function(e,t={}){if(!e)return"";let i=function(e,t={}){return e?encodeURIComponent(function(e,t={}){return e?ny(n$(e,t),{whitespace:!1}):""}(e,t)):""}(e,t);return`CMCD=${i}`}(t,i);if(!r)return e;if(nH.test(e))return e.replace(nH,r);let a=e.includes("?")?"&":"?";return`${e}${a}${r}`}(e.url,t,a)}getNextFrag(e){var t;let i=null==(t=this.hls.levels[e.level])?void 0:t.details;if(i){let t=e.sn-i.startSN;return i.fragments[t+1]}}getNextPart(e){var t;let{index:i,fragment:r}=e,a=null==(t=this.hls.levels[r.level])||null==(t=t.details)?void 0:t.partList;if(a){let{sn:e}=r;for(let t=a.length-1;t>=0;t--){let r=a[t];if(r.index===i&&r.fragment.sn===e)return a[t+1]}}}getObjectType(e){let{type:t}=e;return"subtitle"===t?"tt":"initSegment"===e.sn?"i":"audio"===t?"a":"main"===t?this.hls.audioTracks.length?"v":"av":void 0}getTopBandwidth(e){let t,i=0,r=this.hls;if("a"===e)t=r.audioTracks;else{let e=r.maxAutoLevel,i=e>-1?e+1:r.levels.length;t=r.levels.slice(0,i)}return t.forEach(e=>{e.bitrate>i&&(i=e.bitrate)}),i>0?i:NaN}getBufferLength(e){let t=this.media,i="a"===e?this.audioBuffer:this.videoBuffer;return i&&t?1e3*rN.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len:NaN}createPlaylistLoader(){let{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,r){t(e),this.loader.load(e,i,r)}}}createFragmentLoader(){let{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,r){t(e),this.loader.load(e,i,r)}}}},contentSteeringController:class extends t1{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(){let e=this.hls;e.on(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tV.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(tV.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tV.ERROR,this.onError,this)}unregisterListeners(){let e=this.hls;e&&(e.off(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tV.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(tV.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tV.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(-1===e.indexOf(t.pathwayId)&&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){let e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){let t=this.levels;t&&(this.levels=t.filter(t=>t!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){let{contentSteering:i}=t;null!==i&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){let{errorAction:i}=t;if((null==i?void 0:i.action)===2&&1===i.flags){let e=this.levels,r=this._pathwayPriority,a=this.pathwayId;if(t.context){let{groupId:i,pathwayId:r,type:s}=t.context;i&&e?a=this.getPathwayForGroupId(i,s,a):r&&(a=r)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!r&&e&&(r=this.pathways()),r&&r.length>1&&(this.updatePathwayPriority(r),i.resolved=this.pathwayId!==a),t.details!==tH.BUFFER_APPEND_ERROR||t.fatal?i.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${e?e.length:e} priorities: ${i5(r)} penalized: ${i5(this.penalizedPathways)}`):i.resolved=!0}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){let i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return null===this.levels?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){let t;this._pathwayPriority=e;let i=this.penalizedPathways,r=performance.now();
28Object.keys(i).forEach(e=>{r-i[e]>3e5&&delete i[e]});for(let r=0;r<e.length;r++){let a=e[r];if(a in i)continue;if(a===this.pathwayId)return;let s=this.hls.nextLoadLevel,n=this.hls.levels[s];if((t=this.getLevelsForPathway(a)).length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,aD(t),this.hls.trigger(tV.LEVELS_UPDATED,{levels:t});let e=this.hls.levels[s];n&&e&&this.levels&&(e.attrs["STABLE-VARIANT-ID"]!==n.attrs["STABLE-VARIANT-ID"]&&e.bitrate!==n.bitrate&&this.log(`Unstable Pathways change from bitrate ${n.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=s);break}}}getPathwayForGroupId(e,t,i){let r=this.getLevelsForPathway(i).concat(this.levels||[]);for(let i=0;i<r.length;i++)if(t===tK&&r[i].hasAudioGroup(e)||t===tq&&r[i].hasSubtitleGroup(e))return r[i].pathwayId;return i}clonePathways(e){let t=this.levels;if(!t)return;let i={},r={};e.forEach(e=>{let{ID:a,"BASE-ID":s,"URI-REPLACEMENT":n}=e;if(t.some(e=>e.pathwayId===a))return;let o=this.getLevelsForPathway(s).map(e=>{let t=new rV(e.attrs);t["PATHWAY-ID"]=a;let s=t.AUDIO&&`${t.AUDIO}_clone_${a}`,o=t.SUBTITLES&&`${t.SUBTITLES}_clone_${a}`;s&&(i[t.AUDIO]=s,t.AUDIO=s),o&&(r[t.SUBTITLES]=o,t.SUBTITLES=o);let l=nG(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",n),d=new i3({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:l,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t<e.audioGroups.length;t++)d.addGroupId("audio",`${e.audioGroups[t]}_clone_${a}`);if(e.subtitleGroups)for(let t=1;t<e.subtitleGroups.length;t++)d.addGroupId("text",`${e.subtitleGroups[t]}_clone_${a}`);return d});t.push(...o),nV(this.audioTracks,i,n,a),nV(this.subtitleTracks,r,n,a)})}loadSteeringManifest(e){let t,i=this.hls.config,r=i.loader;this.loader&&this.loader.destroy(),this.loader=new r(i);try{t=new self.URL(e)}catch(t){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if("data:"!==t.protocol){let e=0|(this.hls.bandwidthEstimate||i.abrEwmaDefaultEstimate);t.searchParams.set("_HLS_pathway",this.pathwayId),t.searchParams.set("_HLS_throughput",""+e)}let a={responseType:"json",url:t.href},s=i.steeringManifestLoadPolicy.default,n=s.errorRetry||s.timeoutRetry||{},o={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:n.maxNumRetry||0,retryDelay:n.retryDelayMs||0,maxRetryDelay:n.maxRetryDelayMs||0};this.log(`Requesting steering manifest: ${t}`),this.loader.load(a,o,{onSuccess:(e,i,r,a)=>{this.log(`Loaded steering manifest: "${t}"`);let s=e.data;if((null==s?void 0:s.VERSION)!==1)return void this.log(`Steering VERSION ${s.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=s.TTL;let{"RELOAD-URI":n,"PATHWAY-CLONES":o,"PATHWAY-PRIORITY":l}=s;if(n)try{this.uri=new self.URL(n,t).href}catch(e){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${n}`);return}this.scheduleRefresh(this.uri||r.url),o&&this.clonePathways(o);let d={steeringManifest:s,url:t.toString()};this.hls.trigger(tV.STEERING_MANIFEST_LOADED,d),l&&this.updatePathwayPriority(l)},onError:(e,t,i,r)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),410===e.code){this.enabled=!1,this.log(`Steering manifest ${t.url} no longer available`);return}let a=1e3*this.timeToLoad;if(429===e.code){let e=this.loader;if("function"==typeof(null==e?void 0:e.getResponseHeader)){let t=e.getResponseHeader("Retry-After");t&&(a=1e3*parseFloat(t))}this.log(`Steering manifest ${t.url} rate limited`);return}this.scheduleRefresh(this.uri||t.url,a)},onTimeout:(e,t,i)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}})}scheduleRefresh(e,t=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var t;let i=null==(t=this.hls)?void 0:t.media;i&&!i.ended?this.loadSteeringManifest(e):this.scheduleRefresh(e,1e3*this.timeToLoad)},t)}},interstitialsController:class extends t1{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}
28,this.onSeeking=()=>{var e,t;let i=this.currentTime;if(void 0===i||this.playbackDisabled||!this.schedule)return;let r=i-this.timelinePos;if(Math.abs(r)<1/7056e5)return;let a=r<=-.01;this.timelinePos=i,this.bufferedPos=i;let s=this.playingItem;if(!s)return void this.checkBuffer();if(a&&this.schedule.resetErrorsInRange(i,i-r)&&this.updateSchedule(!0),this.checkBuffer(),a&&i<s.start||i>=s.end){let t=this.findItemIndex(s),r=this.schedule.findItemIndexAtTime(i);if(-1===r&&(r=t+(a?-1:1),this.log(`seeked ${a?"back ":""}to position not covered by schedule ${i} (resolving from ${t} to ${r})`)),!this.isInterstitial(s)&&null!=(e=this.media)&&e.paused&&(this.shouldPlay=!1),!a&&r>t){let e=this.schedule.findJumpRestrictedIndex(t+1,r);if(e>t)return void this.setSchedulePosition(e)}this.setSchedulePosition(r);return}let n=this.playingAsset;if(!n){if(this.playingLastItem&&this.isInterstitial(s)){let e=s.event.assetList[0];e&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,e))}return}let o=n.timelineStart,l=n.duration||0;(a&&i<o||i>=o+l)&&(null!=(t=s.event)&&t.appendInPlace&&(this.clearAssetPlayers(s.event,s),this.flushFrontBuffer(i)),this.setScheduleToAssetAtTime(i,n))},this.onTimeupdate=()=>{let e=this.currentTime;if(void 0===e||this.playbackDisabled||!(e>this.timelinePos))return;this.timelinePos=e,e>this.bufferedPos&&this.checkBuffer();let t=this.playingItem;if(!t||this.playingLastItem)return;if(e>=t.end){this.timelinePos=t.end;let e=this.findItemIndex(t);this.setSchedulePosition(e+1)}let i=this.playingAsset;!i||e>=i.timelineStart+(i.duration||0)&&this.setScheduleToAssetAtTime(e,i)},this.onScheduleUpdate=(e,t)=>{let i=this.schedule;if(!i)return;let r=this.playingItem,a=i.events||[],s=i.items||[],n=i.durations,o=e.map(e=>e.identifier),l=!!(a.length||o.length);(l||t)&&this.log(`INTERSTITIALS_UPDATED (${a.length}): ${a} 29Schedule: ${s.map(e=>n6(e))} pos: ${this.timelinePos}`),o.length&&this.log(`Removed events ${o}`);let d=null,u=null;r&&(d=this.updateItem(r,this.timelinePos),this.itemsMatch(r,d)?this.playingItem=d:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);let h=this.bufferingItem;if(h&&(u=this.updateItem(h,this.bufferedPos),this.itemsMatch(h,u)?this.bufferingItem=u:h.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(h.event,null))),e.forEach(e=>{e.assetList.forEach(e=>{this.clearAssetPlayer(e.identifier,null)})}),this.playerQueue.forEach(e=>{if(e.interstitial.appendInPlace){let t=e.assetItem.timelineStart,i=e.timelineOffset-t;if(i)try{e.timelineOffset=t}catch(r){Math.abs(i)>.025&&this.warn(`${r} ("${e.assetId}" ${e.timelineOffset}->${t})`)}}}),l||t){if(this.hls.trigger(tV.INTERSTITIALS_UPDATED,{events:a.slice(0),schedule:s.slice(0),durations:n,removedIds:o}),this.isInterstitial(r)&&o.includes(r.event.identifier)){this.warn(`Interstitial "${r.event.identifier}" removed while playing`),this.primaryFallback(r.event);return}r&&this.trimInPlace(d,r),h&&u!==d&&this.trimInPlace(u,h),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new n7(e),this.schedule=new n9(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){let e=this.hls;e&&(e.on(tV.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(tV.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tV.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(tV.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(tV.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(tV.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(tV.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(tV.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(tV.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(tV.BUFFER_APPENDED,this.onBufferAppended,this),e.on(tV.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(tV.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(tV.MEDIA_ENDED,this.onMediaEnded,this),e.on(tV.ERROR,this.onError,this),e.on(tV.DESTROYING,this.onDestroying,this))}unregisterListeners(){let e=this.hls;
29e&&(e.off(tV.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(tV.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tV.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(tV.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(tV.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(tV.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(tV.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(tV.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(tV.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(tV.BUFFER_CODECS,this.onBufferCodecs,this),e.off(tV.BUFFER_APPENDED,this.onBufferAppended,this),e.off(tV.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(tV.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(tV.MEDIA_ENDED,this.onMediaEnded,this),e.off(tV.ERROR,this.onError,this),e.off(tV.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;null==(e=this.getBufferingPlayer())||e.resumeBuffering()}pauseBuffering(){var e;null==(e=this.getBufferingPlayer())||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(){let e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){aB(e,"play",this.onPlay),aB(e,"pause",this.onPause),aB(e,"seeking",this.onSeeking),aB(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){let i=this.media=t.media;aF(i,"seeking",this.onSeeking),aF(i,"timeupdate",this.onTimeupdate),aF(i,"play",this.onPlay),aF(i,"pause",this.onPause)}onMediaAttached(e,t){let i=this.effectivePlayingItem,r=this.detachedData;if(this.detachedData=null,null===i)this.checkStart();else if(!r){this.clearScheduleState();let e=this.findItemIndex(i);this.setSchedulePosition(e)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){let i=!!t.transferMedia,r=this.media;if(this.media=null,!i&&(r&&this.removeMediaListeners(r),this.detachedData)){let e=this.getBufferingPlayer();e&&(this.log(`Removing schedule state for detachedData and ${e}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,e.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;let e=this,t=t=>t?e.getAssetPlayer(t.identifier):t,i=(i,a,s,n,o)=>{if(i){let l=i[a].start,d=i.event;if(d){if("playout"===a||d.timelineOccupancy!==n0.Point){let e=t(s);(null==e?void 0:e.interstitial)===d&&(l+=e.assetItem.startOffset+e[o])}}else l+=("bufferedPos"===n?r():e[n])-i.start;return l}return 0},r=()=>{let t=e.bufferedPos;return t===Number.MAX_VALUE?a("primary"):Math.max(t,0)},a=t=>{var i,r;return null!=(i=e.primaryDetails)&&i.live?e.primaryDetails.edge:(null==(r=e.schedule)?void 0:r.durations[t])||0},s=(r,a)=>{var s,n;let o=e.effectivePlayingItem;if(null!=o&&null!=(s=o.event)&&s.restrictions.skip||!e.schedule)return;e.log(`seek to ${r} "${a}"`);let l=e.effectivePlayingItem,d=e.schedule.findItemIndexAtTime(r,a),u=null==(n=e.schedule.items)?void 0:n[d],h=e.getBufferingPlayer(),c=null==h?void 0:h.interstitial,m=null==c?void 0:c.appendInPlace,f=l&&e.itemsMatch(l,u);if(l&&(m||f)){let s=t(e.playingAsset),n=(null==s?void 0:s.media)||e.primaryMedia;if(n){let t="primary"===a?n.currentTime:i(l,a,e.playingAsset,"timelinePos","currentTime"),o=r-t,d=(m?t:n.currentTime)+o;if(d>=0&&(!s||m||d<=s.duration)){n.currentTime=d;return}}}if(u){let t=r;if("primary"!==a){let e=r-u[a].start;t=u.start+e}let i=!e.isInterstitial(u);if((!e.isInterstitial(l)||l.event.appendInPlace)&&(i||u.event.appendInPlace)){let i=e.media||(m?null==h?void 0:h.media:null);i&&(i.currentTime=t)}else if(l){let s=e.findItemIndex(l);if(d>s){let t=e.schedule.findJumpRestrictedIndex(s+1,d);if(t>s)return void e.setSchedulePosition(t)}let n=0;if(i)e.timelinePos=t,e.checkBuffer();else{let e=u.event.assetList,t=r-(u[a]||u).start;for(let i=e.length;i--;){let r=e[i];if(r.duration&&t>=r.startOffset&&t<r.startOffset+r.duration){n=i;break}}}e.setSchedulePosition(d,n)}}},n=()=>{let t=e.effectivePlayingItem;if(e.isInterstitial(t))return t;let i=e.bufferingItem||e.waitingItem;return e.isInterstitial(i)?i:null},o={get bufferedEnd(){let t=e.bufferingItem||e.waitingItem,r=e.bufferingItem;if(r&&r===t){var l;return i(r,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-r.playout.start||(null==(l=e.bufferingAsset)?void 0:l.startOffset)||0}return 0},get currentTime(){let t=n(),r=e.effectivePlayingItem;if(r&&r===t)return i(r,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-r.playout.start;return 0},set currentTime(time){let t=n(),i=e.effectivePlayingItem;i&&i===t&&s(time+i.playout.start,"playout")},get duration(){let e=n();if(e)return e.playout.end-e.playout.start;return 0},get assetPlayers(){var d;let t=null==(d=n())?void 0:d.event.assetList;if(t)return t.map(t=>e.getAssetPlayer(t.identifier));return[]},get playingIndex(){var u;let t=null==(u=n())?void 0:u.event;if(t&&e.effectivePlayingAsset)return t.findAssetIndex(e.effectivePlayingAsset);return -1},get scheduleItem(){return n()}};return this.manager={get events(){var h;return(null==(h=e.schedule)||null==(h=h.events)?void 0:h.slice(0))||[]},get schedule(){var c;return(null==(c=e.schedule)||null==(c=c.items)?void 0:c.slice(0))||[]},get interstitialPlayer(){if(n())return o;return null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return e.bufferingItem||e.waitingItem},get bufferingIndex(){let t=e.bufferingItem||e.waitingItem;return e.findItemIndex(t)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){let t=e.effectivePlayingItem;return e.findItemIndex(t)},primary:{get bufferedEnd(){return r()},get currentTime(){let t=e.timelinePos;return t>0?t:0},set currentTime(time){s(time,"primary")},get duration(){return a("primary")},get seekableStart(){var m;return(null==(m=e.primaryDetails)?void 0:m.fragmentStart)||0}},integrated:{get bufferedEnd(){return i(e.bufferingItem||e.waitingItem,"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return i(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(time){s(time,"integrated")},get duration(){return a("integrated")},get seekableStart(){var f;return((t,i)=>{var r,a;if(0!==t&&"primary"!==i&&null!=(r=e.schedule)&&r.length){let r=e.schedule.findItemIndexAtTime(t),s=null==(a=e.sc
29hedule.items)?void 0:a[r];if(s)return t+(s[i].start-s.start)}return t})((null==(f=e.primaryDetails)?void 0:f.fragmentStart)||0,"integrated")}},skip:()=>{let t=e.effectivePlayingItem,i=null==t?void 0:t.event;if(i&&!i.restrictions.skip){let r=e.findItemIndex(t);i.appendInPlace?s(t.playout.start+t.event.duration+.001,"playout"):e.advanceAfterAssetEnded(i,r,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;let t=this.playingItem,i=null==(e=this.schedule)?void 0:e.items;return!!this.playbackStarted&&!!t&&!!i&&this.findItemIndex(t)===i.length-1}get playbackStarted(){return null!==this.effectivePlayingItem}get currentTime(){var e,t;if(null===this.mediaSelection)return;let i=this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&!i.event.appendInPlace)return;let r=this.media;!r&&null!=(e=this.bufferingItem)&&null!=(e=e.event)&&e.appendInPlace&&(r=this.primaryMedia);let a=null==(t=r)?void 0:t.currentTime;if(void 0!==a&&tU(a))return a}get primaryMedia(){var e;return this.media||(null==(e=this.detachedData)?void 0:e.media)||null}isInterstitial(e){return!!(null!=e&&e.event)}retreiveMediaSource(e,t){let i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,t)}transferMediaFromPlayer(e,t){let i=e.interstitial.appendInPlace,r=e.media;if(i&&r===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&r){this.detachedData={media:r};return}let i=e.transferMedia();this.log(`transfer MediaSource from ${e} ${i5(i)}`),this.detachedData=i}else t&&r&&(this.shouldPlay||(this.shouldPlay=!r.paused))}transferMediaTo(e,t){var i,r;let a;if(e.media===t)return;let s=null,n=this.hls,o=e!==n,l=o&&e.interstitial.appendInPlace,d=null==(i=this.detachedData)?void 0:i.mediaSource;if(n.media)l&&(s=n.transferMedia(),this.detachedData=s),a="Primary";else if(d){let e=this.getBufferingPlayer();e?(s=e.transferMedia(),a=`${e}`):a="detached MediaSource"}else a="detached media";if(!s){if(d)s=this.detachedData,this.log(`using detachedData: MediaSource ${i5(s)}`);else if(!this.detachedData||n.media===t){let e=this.playerQueue;e.length>1&&e.forEach(e=>{if(o&&e.interstitial.appendInPlace!==l){let t=e.interstitial;this.clearInterstitial(e.interstitial,null),t.appendInPlace=!1,t.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${t}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}let u=s&&"mediaSource"in s&&(null==(r=s.mediaSource)?void 0:r.readyState)!=="closed",h=u&&s?s:t;this.log(`${u?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${a} (media.currentTime: ${t.currentTime})`);let c=this.schedule;if(h===s&&c){let t=o&&e.assetId===c.assetIdAtEnd;h.overrides={duration:c.duration,endOfStream:!o||t,cueRemoval:!o}}e.attachMedia(h)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){let e=this.schedule,t=null==e?void 0:e.events;if(!t||this.playbackDisabled||!this.media)return;-1===this.bufferedPos&&(this.bufferedPos=0);let i=this.timelinePos,r=this.effectivePlayingItem;if(-1===i){let i=this.hls.startPosition;if(this.log(ot("checkStart",i)),this.timelinePos=i,t.length&&t[0].cue.pre){let i=e.findEventIndex(t[0].identifier);this.setSchedulePosition(i)}else if(i>=0||!this.primaryLive){let t=this.timelinePos=i>0?i:0,r=e.findItemIndexAtTime(t);this.setSchedulePosition(r)}}else if(r&&!this.playingItem){let t=e.findItemIndex(r);this.setSchedulePosition(t)}}advanceAssetBuffering(e,t){let i=e.event,r=i.findAssetIndex(t),a=n4(i,r);if(i.isAssetPastPlayoutLimit(a)){if(this.schedule){var s;let t=null==(s=this.schedule.items)?void 0:s[this.findItemIndex(e)+1];t&&this.bufferedToItem(t)}}else this.bufferedToEvent(e,a)}advanceAfterAssetEnded(e,t,i){let r=n4(e,i);if(e.isAssetPastPlayoutLimit(r)){if(this.schedule){let i=this.schedule.items;if(i){let r=t+1;if(r>=i.length)return void this.setSchedulePosition(-1);let a=e.resumeTime;this.timelinePos<a&&(this.log(ot("advanceAfterAssetEnded",a)),this.timelinePos=a,e.appendInPlace&&this.advanceInPlace(a),this.checkBuffer(this.bufferedPos<a)),this.setSchedulePosition(r)}}}else{if(e.appendInPlace){let t=e.assetList[r];t&&this.advanceInPlace(t.timelineStart)}this.setSchedulePosition(t,r)}}setScheduleToAssetAtTime(e,t){let i=this.schedule;if(!i)return;let r=t.parentIdentifier,a=i.getEvent(r);if(a){let t=i.findEventIndex(r),s=i.findAssetIndex(a,e);this.advanceAfterAssetEnded(a,t,s-1)}}setSchedulePosition(e,t){var i,r,a;let s=null==(i=this.schedule)?void 0:i.items;if(!s||this.playbackDisabled)return;let n=e>=0?s[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${n?n6(n):n}) pos: ${this.timelinePos}`);let o=this.waitingItem||this.playingItem,l=this.playingLastItem;if(this.isInterstitial(o)){let i=o.event,d=this.playingAsset,u=null==d?void 0:d.identifier,h=u?this.getAssetPlayer(u):null;if(h&&u&&(!this.eventItemsMatch(o,n)||void 0!==t&&u!==i.assetList[t].identifier)){let t=i.findAssetIndex(d);if(this.log(`INTERSTITIAL_ASSET_ENDED ${t+1}/${i.assetList.length} ${n5(d)}`),this.endedAsset=d,this.playingAsset=null,this.hls.trigger(tV.INTERSTITIAL_ASSET_ENDED,{asset:d,assetListIndex:t,event:i,schedule:s.slice(0),scheduleIndex:e,player:h}),o!==this.playingItem){this.itemsMatch(o,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(i,this.findItemIndex(this.playingItem),t);return}this.retreiveMediaSource(u,n),h.media&&!(null!=(r=this.detachedData)&&r.mediaSource)&&h.detachMedia()}if(!this.eventItemsMatch(o,n)&&(this.endedItem=o,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${i} ${n6(o)}`),i.hasPlayed=!0,this.hls.trigger(tV.INTERSTITIAL_ENDED,{event:i,schedule:s.slice(0),scheduleIndex:e}),i.cue.once)){this.updateSchedule();let e=null==(a=this.schedule)?void 0:a.items;if(n&&e){let i=this.findItemIndex(n);this.advanceSchedule(i,e,t,o,l)}return}}this.advanceSchedule(e,s,t,o,l)}advanceSchedule(e,t,i,r,a){let s=this.schedule;if(!s)return;let n=t[e]||null,o=this.primaryMedia,l=this.playerQueue;if(l.length&&l.forEach(t=>{let i=t.interstitial,r=s.findEventIndex(i.identifier);(r<e||r>e+1)&&this.clearInterstitial(i,n)}),this.isInterstitial(n)){this.timelinePos=Math.min(Math.max(this.timelinePos,n.start),n.end);let a=n.event;if(void 0===i){i=s.findAssetIndex(a,this.timelinePos);let t=n4(a,i-1);if(a.isAssetPastPlayoutLimit(t)||a.appendInPlace&&this.timelinePos===n.end)return void this.advanceAfterAssetEnded(a,e,i);i=t}let l=this.waitingItem;this.assetsBuffered(n,o)||this.setBufferingItem(n);let d=this.preloadAssets(a,i);if(this.eventItemsMatch(n,l||r)||(this.waitingItem=n,this.log(`INTERSTITIAL_STARTED ${n6(n)} ${a.appendInPlace?"append in place":""}`),this.hls.trigger(tV.INTERSTITIAL_STARTED,{event:a,schedule:t.slice(0),scheduleIndex:e}
29)),!a.assetListLoaded)return void this.log(`Waiting for ASSET-LIST to complete loading ${a}`);if(a.assetListLoader&&(a.assetListLoader.destroy(),a.assetListLoader=void 0),!o)return void this.log(`Waiting for attachMedia to start Interstitial ${a}`);this.waitingItem=this.endedItem=null,this.playingItem=n;let u=a.assetList[i];if(!u)return void this.advanceAfterAssetEnded(a,e,i||0);if(d||(d=this.getAssetPlayer(u.identifier)),null===d||d.destroyed){let e=a.assetList.length;this.warn(`asset ${i+1}/${e} player destroyed ${a}`),(d=this.createAssetPlayer(a,u,i)).loadSource()}if(!this.eventItemsMatch(n,this.bufferingItem)&&a.appendInPlace&&this.isAssetBuffered(u))return;this.startAssetPlayer(d,i,t,e,o),this.shouldPlay&&oe(d.media)}else n?(this.resumePrimary(n,e,r),this.shouldPlay&&oe(this.hls.media)):a&&this.isInterstitial(r)&&(this.endedItem=null,this.playingItem=r,r.event.appendInPlace||this.attachPrimary(s.durations.primary,null))}get playbackDisabled(){return!1===this.hls.config.enableInterstitialPlayback}get primaryDetails(){var e;return null==(e=this.mediaSelection)?void 0:e.main.details}get primaryLive(){var e;return!!(null!=(e=this.primaryDetails)&&e.live)}resumePrimary(e,t,i){var r,a;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${n6(e)}`),!(null!=(r=this.detachedData)&&r.mediaSource)){let i=this.timelinePos;(i<e.start||i>=e.end)&&(i=this.getPrimaryResumption(e,t),this.log(ot("resumePrimary",i)),this.timelinePos=i),this.attachPrimary(i,e)}if(!i)return;let s=null==(a=this.schedule)?void 0:a.items;s&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${n6(e)}`),this.hls.trigger(tV.INTERSTITIALS_PRIMARY_RESUMED,{schedule:s.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){let i=e.start;if(this.primaryLive){let e=this.primaryDetails;if(0===t)return this.hls.startPosition;if(e&&(i<e.fragmentStart||i>e.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){let t=this.getAssetPlayer(e.identifier);return null!=t&&t.hls?t.hls.bufferedToEnd:rN.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;let r=this.primaryMedia;if(!r)return;let a=this.hls;a.media?this.checkBuffer():(this.transferMediaTo(a,r),i&&this.startLoadingPrimaryAt(e,i)),i||(this.log(ot("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){var i;let r=this.hls;!r.loadingEnabled||!r.media||Math.abs(((null==(i=r.mainForwardBufferInfo)?void 0:i.start)||r.media.currentTime)-e)>.5?r.startLoad(e,t):r.bufferingEnabled||r.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),null==(e=this.schedule)||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(tV.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(tV.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(-1===t.level||!this.schedule)return;let i=this.hls.levels[t.level];if(!i.details)return;let r=t0(t0({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=r,this.schedule.parseInterstitialDateRanges(r,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){let i=this.hls.audioTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=t0(t0({},this.altSelection),{},{audio:i});return}let a=t0(t0({},r),{},{audio:i});this.mediaSelection=a}onSubtitleTrackUpdated(e,t){let i=this.hls.subtitleTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=t0(t0({},this.altSelection),{},{subtitles:i});return}let a=t0(t0({},r),{},{subtitles:i});this.mediaSelection=a}onAudioTrackSwitching(e,t){let i=i6(t);this.playerQueue.forEach(({hls:e})=>e&&(e.setAudioOption(t)||e.setAudioOption(i)))}onSubtitleTrackSwitch(e,t){let i=i6(t);this.playerQueue.forEach(({hls:e})=>
29e&&(e.setSubtitleOption(t)||-1!==t.id&&e.setSubtitleOption(i)))}onBufferCodecs(e,t){let i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){let i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){let e=this.timelinePos;this.bufferedPos=e,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;let t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let e=0;e<t.length;e++){let r=t[e];if(r.cue.post){var i;let e=this.schedule.findEventIndex(r.identifier),t=null==(i=this.schedule.items)?void 0:i[e];this.isInterstitial(t)&&this.eventItemsMatch(t,this.bufferingItem)&&this.bufferedToItem(t,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){let t=this.playingItem;if(!this.playingLastItem&&t){let e=this.findItemIndex(t);this.setSchedulePosition(e+1)}else this.shouldPlay=!1}updateItem(e,t){var i;let r=null==(i=this.schedule)?void 0:i.items;return e&&r&&r[this.findItemIndex(e,t)]||null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((t,i)=>{e.event.isAssetPastPlayoutLimit(i)&&this.clearAssetPlayer(t.identifier,null)});let i=e.end+.25,r=rN.bufferInfo(this.primaryMedia,i,0);(r.end>i||(r.nextStart||0)>i)&&(this.log(`trim buffered interstitial ${n6(e)} (was ${n6(t)})`),this.attachPrimary(i,null,!0),this.flushFrontBuffer(i))}}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 i;return!!t&&(e===t||e.event.identifier===(null==(i=t.event)?void 0:i.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;let i=this.mediaSelection;i&&(null==(t=this.schedule)||t.updateSchedule(i,[],e))}checkBuffer(e){var t;let i=null==(t=this.schedule)?void 0:t.items;if(!i)return;let r=rN.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=r.len<1),this.updateBufferedPos(r.end,i,e)}updateBufferedPos(e,t,i){let r=this.schedule,a=this.bufferingItem;if(this.bufferedPos>e||!r)return;if(1===t.length&&this.itemsMatch(t[0],a)){this.bufferedPos=e;return}let s=this.playingItem,n=this.findItemIndex(s),o=r.findItemIndexAtTime(e);if(this.bufferedPos<e){var l;let i=this.findItemIndex(a),r=Math.min(i+1,t.length-1),s=t[r];if((-1===o&&a&&e>=a.end||null!=(l=s.event)&&l.appendInPlace&&e+.01>=s.start)&&(o=r),this.isInterstitial(a)){let e=a.event;if(r-n>1&&!1===e.appendInPlace||0===e.assetList.length&&e.assetListLoader)return}if(this.bufferedPos=e,o>i&&o>n)this.bufferedToItem(s);else{let t=this.primaryDetails;this.primaryLive&&t&&e>t.edge-t.targetduration&&s.start<t.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(s)&&this.preloadAssets(s.event,0)}}else i&&s&&!this.itemsMatch(s,a)&&(o===n?this.bufferedToItem(s):o===n+1&&this.bufferedToItem(t[o]))}assetsBuffered(e,t){return 0!==e.event.assetList.length&&!e.event.assetList.some(e=>{let i=this.getAssetPlayer(e.identifier);return!(null!=i&&i.bufferedInPlaceToEnd(t))})}setBufferingItem(e){let t=this.bufferingItem,i=this.schedule;if(!this.itemsMatch(e,t)&&i){let{items:r,events:a}=i;if(!r||!a)return t;let s=this.isInterstitial(e),n=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));let o=n?n.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${n6(e)}`+(t?` (${o.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(s){let t=i.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((e,i)=>{let r=this.getAssetPlayer(e.identifier);r&&(i===t&&r.loadSource(),r.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(e=>e.pauseBuffering());this.hls.trigger(tV.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:a.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){let i=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(null!==i){this.bufferingAsset=null;let t=this.detachedData;t&&t.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e)}}}preloadPrimary(e){let t=this.findItemIndex(e),i=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(i)}bufferedToEvent(e,t){let i=e.event,r=0===i.assetList.length&&!i.assetListLoader,a=i.cue.once;if(r||!a){let e=this.preloadAssets(i,t);if(null!=e&&e.interstitial.appendInPlace){let t=this.primaryMedia;t&&this.bufferAssetPlayer(e,t)}}}preloadAssets(e,t){let i=e.assetUrl,r=e.assetList.length,a=0===r&&!e.assetListLoader,s=e.cue.once;if(a){let a,s=e.timelineStart;if(e.appendInPlace){var n;let t=this.playingItem;this.isInterstitial(t)||(null==t||null==(n=t.nextEvent)?void 0:n.identifier)!==e.identifier||this.flushFrontBuffer(s+.25)}let o=0;if(!this.playingItem&&this.primaryLive&&-1===(o=this.hls.startPosition)&&(o=this.hls.liveSyncPosition||0),o&&!(e.cue.pre||e.cue.post)){let e=o-s;e>0&&(a=Math.round(1e3*e)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:r} ${e}${a?` live-start: ${o} start-offset: ${a}`:""}`),i)return this.createAsset(e,0,0,s,e.duration,i);let l=this.assetListLoader.loadAssetList(e,a);l&&(e.assetListLoader=l)}else if(!s&&r){for(let i=t;i<r;i++){let t=e.assetList[i],r=this.getAssetPlayerQueueIndex(t.identifier);(-1===r||this.playerQueue[r].destroyed)&&!t.error&&this.createAssetPlayer(e,t,i)}let i=e.assetList[t];if(i){let e=this.getAssetPlayer(i.identifier);return e&&e.loadSource(),e}}return null}flushFrontBuffer(e){let t=this.requiredTracks;t&&(this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(t=>{this.hls.trigger(tV.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:t})}))}getAssetPlayerQueueIndex(e){let t=this.playerQueue;for(let i=0;i<t.length;i++)if(e===t[i].assetId)return i;return -1}getAssetPlayer(e){let t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}
29getBufferingPlayer(){let{playerQueue:e,primaryMedia:t}=this;if(t){for(let i=0;i<e.length;i++)if(e[i].media===t)return e[i]}return null}createAsset(e,t,i,r,a,s){let n={parentIdentifier:e.identifier,identifier:`${e.identifier}-${t+1}-${nJ(s)}`,duration:a,startOffset:i,timelineStart:r,uri:s};return this.createAssetPlayer(e,n,t)}createAssetPlayer(e,t,i){let r=this.hls,a=r.userConfig,s=a.videoPreference,n=r.loadLevelObj||r.levels[r.currentLevel];(s||n)&&(s=tZ({},s),n.videoCodec&&(s.videoCodec=n.videoCodec),n.videoRange&&(s.allowedVideoRanges=[n.videoRange]));let o=r.audioTracks[r.audioTrack],l=r.subtitleTracks[r.subtitleTrack],d=0;if(this.primaryLive||e.appendInPlace){let e=this.timelinePos-t.timelineStart;if(e>1){let i=t.duration;i&&e<i&&(d=e)}}let u=t.identifier,h=t0(t0({},a),{},{maxMaxBufferLength:Math.min(180,r.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:r.sessionId,assetPlayerId:u,abrEwmaDefaultEstimate:r.bandwidthEstimate,interstitialsController:void 0,startPosition:d,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:s,audioPreference:o||a.audioPreference,subtitlePreference:l||a.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(h.timelineOffset=t.timelineStart));let c=h.cmcd;null!=c&&c.sessionId&&c.contentId&&(h.cmcd=tZ({},c,{contentId:nJ(t.uri)})),this.getAssetPlayer(u)&&this.warn(`Duplicate date range identifier ${e} and asset ${u}`);let m=new n8(this.HlsPlayerClass,h,e,t);this.playerQueue.push(m),e.assetList[i]=t;let f=!0,g=r=>{if(r.live){var a;let t=Error(`Interstitials MUST be VOD assets ${e}`),r={fatal:!0,type:t$.OTHER_ERROR,details:tH.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},s=(null==(a=this.schedule)?void 0:a.findEventIndex(e.identifier))||-1;this.handleAssetItemError(r,e,s,i,t.message);return}let s=r.edge-r.fragmentStart,n=t.duration;(f||null===n||s>n)&&(f=!1,this.log(`Interstitial asset "${u}" duration change ${n} > ${s}`),t.duration=s,this.updateSchedule())};m.on(tV.LEVEL_UPDATED,(e,{details:t})=>g(t)),m.on(tV.LEVEL_PTS_UPDATED,(e,{details:t})=>g(t)),m.on(tV.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());let v=(e,t)=>{let i=this.getAssetPlayer(u);if(i&&t.tracks){i.off(tV.BUFFER_CODECS,v),i.tracks=t.tracks;let e=this.primaryMedia;this.bufferingAsset===i.assetItem&&e&&!i.media&&this.bufferAssetPlayer(i,e)}};m.on(tV.BUFFER_CODECS,v);let y=()=>{var i;let r=this.getAssetPlayer(u);if(this.log(`buffered to end of asset ${r}`),!r||!this.schedule)return;let a=this.schedule.findEventIndex(e.identifier),s=null==(i=this.schedule.items)?void 0:i[a];this.isInterstitial(s)&&this.advanceAssetBuffering(s,t)};m.on(tV.BUFFERED_TO_END,y);let E=t=>()=>{if(!this.getAssetPlayer(u)||!this.schedule)return;this.shouldPlay=!0;let i=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,i,t)};return m.once(tV.MEDIA_ENDED,E(i)),m.once(tV.PLAYOUT_LIMIT_REACHED,E(1/0)),m.on(tV.ERROR,(t,r)=>{if(!this.schedule)return;let a=this.getAssetPlayer(u);r.details===tH.BUFFER_STALLED_ERROR?null!=a&&a.appendInPlace?this.handleInPlaceStall(e):(this.onTimeupdate(),this.checkBuffer(!0)):this.handleAssetItemError(r,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${r.error} ${e}`)}),m.on(tV.DESTROYING,()=>{if(!this.getAssetPlayer(u)||!this.schedule)return;let t=Error(`Asset player destroyed unexpectedly ${u}`),r={fatal:!0,type:t$.OTHER_ERROR,details:tH.INTERSTITIAL_ASSET_ITEM_ERROR,error:t};this.handleAssetItemError(r,e,this.schedule.findEventIndex(e.identifier),i,t.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${n5(t)}`),this.hls.trigger(tV.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:m}),m}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(e=>{this.clearAssetPlayer(e.identifier,t)})}resetAssetPlayer(e){let t=this.getAssetPlayerQueueIndex(e);if(-1!==t){this.log(`reset asset player "${e}" after error`);let i=this.playerQueue[t];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(e,t){let i=this.getAssetPlayerQueueIndex(e);if(-1!==i){let e=this.playerQueue[i];this.log(`clear ${e} toSegment: ${t?n6(t):t}`),this.transferMediaFromPlayer(e,t),this.playerQueue.splice(i,1),e.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,r,a){let{interstitial:s,assetItem:n,assetId:o}=e,l=s.assetList.length,d=this.playingAsset;this.endedAsset=null,this.playingAsset=n,d&&d.identifier===o||(d&&(this.clearAssetPlayer(d.identifier,i[r]),delete d.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${l} ${n5(n)}`),this.hls.trigger(tV.INTERSTITIAL_ASSET_STARTED,{asset:n,assetListIndex:t,event:s,schedule:i.slice(0),scheduleIndex:r,player:e})),this.bufferAssetPlayer(e,a)}bufferAssetPlayer(e,t){var i,r;if(!this.schedule)return;
29let{interstitial:a,assetItem:s}=e,n=this.schedule.findEventIndex(a.identifier),o=null==(i=this.schedule.items)?void 0:i[n];if(!o)return;e.loadSource(),this.setBufferingItem(o),this.bufferingAsset=s;let l=this.getBufferingPlayer();if(l===e)return;let d=a.appendInPlace;if(d&&(null==l?void 0:l.interstitial.appendInPlace)===!1)return;let u=(null==l?void 0:l.tracks)||(null==(r=this.detachedData)?void 0:r.tracks)||this.requiredTracks;if(d&&s!==this.playingAsset){if(!e.tracks)return void this.log(`Waiting for track info before buffering ${e}`);if(u&&!t6(u,e.tracks)){let t=Error(`Asset ${n5(s)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(u)}')`),i={fatal:!0,type:t$.OTHER_ERROR,details:tH.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},r=a.findAssetIndex(s);this.handleAssetItemError(i,a,n,r,t.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){let t=this.schedule,i=this.primaryMedia;if(!t||!i)return;let r=i.currentTime,a=t.findAssetIndex(e,r),s=e.assetList[a];if(s){let n=this.getAssetPlayer(s.identifier);if(n){let o=n.currentTime||r-s.timelineStart,l=n.duration-o;if(this.warn(`Stalled at ${o} of ${o+l} in ${n} ${e} (media.currentTime: ${r})`),o&&(l/i.playbackRate<.5||n.bufferedInPlaceToEnd(i))&&n.hls){let i=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,i,a)}}}}advanceInPlace(e){let t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,i,r,a){if(e.details===tH.BUFFER_STALLED_ERROR)return;let s=t.assetList[r]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${s?n5(s):s} ${e.error}`),!this.schedule)return;let n=(null==s?void 0:s.identifier)||"",o=this.getAssetPlayerQueueIndex(n),l=this.playerQueue[o]||null,d=this.schedule.items,u=tZ({},e,{fatal:!1,errorAction:rg(!0),asset:s,assetListIndex:r,event:t,schedule:d,scheduleIndex:i,player:l});if(this.hls.trigger(tV.INTERSTITIAL_ASSET_ERROR,u),!e.fatal)return;let h=this.playingAsset,c=this.bufferingAsset,m=Error(a);if(s&&(this.clearAssetPlayer(n,null),s.error=m),t.assetList.some(e=>!e.error))for(let e=r;e<t.assetList.length;e++)this.resetAssetPlayer(t.assetList[e].identifier);else t.error=m;this.updateSchedule(!0),t.error?this.primaryFallback(t):h&&h.identifier===n?this.advanceAfterAssetEnded(t,i,r):c&&c.identifier===n&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,c)}primaryFallback(e){let t=e.timelineStart,i=this.effectivePlayingItem,r=this.timelinePos;if(i){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${r} playing: ${n6(i)} error: ${e.error}`),-1===r&&(r=this.hls.startPosition);let a=this.updateItem(i,r);this.itemsMatch(i,a)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(-1===r)return void this.checkStart();if(!this.schedule)return;let a=this.schedule.findItemIndexAtTime(r);this.setSchedulePosition(a)}onAssetListLoaded(e,t){var i,r,a;let s=t.event,n=s.identifier,o=t.assetListResponse.ASSETS;if(!(null!=(i=this.schedule)&&i.hasEvent(n)))return;let l=s.timelineStart,d=s.duration,u=0;o.forEach((e,t)=>{let i=parseFloat(e.DURATION);this.createAsset(s,t,u,l+u,i,e.URI),u+=i}),s.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${d}) ${s}`);let h=this.waitingItem,c=(null==h?void 0:h.event.identifier)===n;this.updateSchedule();let m=null==(r=this.bufferingItem)?void 0:r.event;if(c){let e=this.schedule.findEventIndex(n),t=null==(a=this.schedule.items)?void 0:a[e];if(t){if(!this.playingItem&&this.timelinePos>t.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==e){s.error=Error(`Interstitial ${o.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${s}`),this.log(s.error.message),this.updateSchedule(!0),this.primaryFallback(s);return}this.setBufferingItem(t)}this.setSchedulePosition(e)}else if((null==m?void 0:m.identifier)===n){let e=s.assetList[0];if(e){let t=this.getAssetPlayer(e.identifier);if(m.appendInPlace){let e=this.primaryMedia;t&&e&&this.bufferAssetPlayer(t,e)}else t&&t.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case tH.ASSET_LIST_PARSING_ERROR:case tH.ASSET_LIST_LOAD_ERROR:case tH.ASSET_LIST_LOAD_TIMEOUT:{let e=t.interstitial;e&&(this.updateSchedule(!0),this.primaryFallback(e));break}case tH.BUFFER_STALLED_ERROR:{let e=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(e)&&e.event.appendInPlace)return void this.handleInPlaceStall(e.event);this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0)}}}}});class o1 extends rx{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 e;null!=(e=this.media)&&e.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>
29{if(this.hls){var e;this.ended=(null==(e=this.media)?void 0:e.currentTime)||1,this.hls.trigger(tV.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){let{hls:e}=this;e&&(e.on(tV.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tV.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){let{hls:e}=this;e&&(e.off(tV.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tV.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(100),this.mediaSource=t.mediaSource;let i=this.media=t.media;aF(i,"playing",this.onMediaPlaying),aF(i,"waiting",this.onMediaWaiting),aF(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();let{media:i}=this;i&&(aB(i,"playing",this.onMediaPlaying),aB(i,"waiting",this.onMediaWaiting),aB(i,"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(!(null!=(e=this.media)&&e.readyState)||!this.hasBuffered)return;let t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,r,a;let s=null==(i=this.hls)?void 0:i.config;if(!s)return;let n=this.media;if(!n)return;let{seeking:o}=n,l=this.seeking&&!o,d=!this.seeking&&o,u=n.paused&&!o||n.ended||0===n.playbackRate;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,!o&&(this.nudgeRetry=0,s.nudgeOnVideoHole&&!u&&e>t&&this.nudgeOnVideoHole(e,t)),0===this.waiting&&this.stallResolved(e);return}if(d||l){l&&this.stallResolved(e);return}if(u){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&n.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(tV.MEDIA_ENDED,{stalled:!1}));return}if(!rN.getBuffered(n).length){this.nudgeRetry=0;return}let h=rN.bufferInfo(n,e,0),c=h.nextStart||0,m=this.fragmentTracker;if(o&&m&&this.hls){let t=o2(this.hls.inFlightFragments,e),i=h.len>2,r=!c||t||c-e>2&&!m.getPartialFragment(e);if(i||r)return;this.moved=!1}let f=null==(r=this.hls)?void 0:r.latestLevelDetails;if(!this.moved&&null!==this.stalled&&m){if(!(h.len>0)&&!c)return;let t=Math.max(c,h.start||0)-e,i=null!=f&&f.live?2*f.targetduration:2,r=o4(e,m);if(t>0&&(t<=i||r)){n.paused||this._trySkipBufferHole(r);return}}let g=s.detectStallWithCurrentTimeMs,v=self.performance.now(),y=this.waiting,E=this.stalled;if(null===E)if(y>0&&v-y<g)E=this.stalled=y;else{this.stalled=v;return}let b=v-E;if(!o&&(b>=g||y)&&this.hls){if((null==(a=this.mediaSource)?void 0:a.readyState)==="ended"&&!(null!=f&&f.live)&&1>Math.abs(e-((null==f?void 0:f.edge)||0))){if(this.ended)return;this.ended=e||1,this.hls.trigger(tV.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(h),!this.media||!this.hls)return}let T=rN.bufferInfo(n,e,s.maxBufferHole);this._tryFixBufferStall(T,b,e)}stallResolved(e){let t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){let i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(tV.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;let r=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&null!=(i=this.buffered.audio)&&i.length&&r&&r.length>1&&e>r.end(0)){let i=rN.bufferedInfo(rN.timeRangesToArray(this.buffered.audio),e,0);if(i.len>1&&t>=i.start){let i=rN.timeRangesToArray(r),a=rN.bufferedInfo(i,t,0).bufferedIndex;if(a>-1&&a<i.length-1){let t=rN.bufferedInfo(i,e,0).bufferedIndex,r=i[a].end,s=i[a+1].start;if((-1===t||t>a)&&s-r<1&&e-r<2){let i=Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${r} -> ${s} buffered index: ${t}`);this.warn(i.message),this.media.currentTime+=1e-6;let a=o4(e,this.fragmentTracker);a&&"fragment"in a?a=a.fragment:a||(a=void 0);let n=rN.bufferInfo(this.media,e,0);this.hls.trigger(tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:i,reason:i.message,frag:a,buffer:n.len,bufferInfo:n})}}}}}_tryFixBufferStall(e,t,i){var r,a;let{fragmentTracker:s,media:n}=this,o=null==(r=this.hls)?void 0:r.config;if(!n||!s||!o)return;let l=null==(a=this.hls)?void 0:a.latestLevelDetails,d=o4(i,s);if((d||null!=l&&l.live&&i<l.fragmentStart)&&(this._trySkipBufferHole(d)||!this.media))return;let u=e.buffered,h=this.adjacentTraversal(e,i);(u&&u.length>1&&e.len>o.maxBufferHole||e.nextStart&&(e.nextStart-i<o.maxBufferHole||h))&&(t>1e3*o.highBufferWatchdogPeriod||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){let i=this.fragmentTracker,r=e.nextStart;if(i&&r){let e=i.getFragAtPos(t,tj),a=i.getFragAtPos(r,tj);if(e&&a)return a.sn-e.sn<2}return!1}_reportStall(e){let{hls:t,media:i,stallReported:r,stalled:a}=this;if(!r&&null!==a&&i&&t){this.stallReported=!0;let r=Error(`Playback stalling at @${i.currentTime} due to low buffer (${i5(e)})`);this.warn(r.message),t.trigger(tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len,bufferInfo:e,stalled:{start:a}})}}_trySkipBufferHole(e){var t,i;let{fragmentTracker:r,media:a}=this,s=null==(t=this.hls)?void 0:t.config;if(!a||!r||!s)return 0;let n=a.currentTime,o=rN.bufferInfo(a,n,0),l=n<o.start?o.start:o.nextStart;
29if(l&&this.hls){let t=o.len<=s.maxBufferHole,d=o.len>0&&o.len<1&&a.readyState<3,u=l-n;if(u>0&&(t||d)){if(u>s.maxBufferHole){let t=!1;if(0===n){let e=r.getAppendedFrag(0,tj);e&&l<e.end&&(t=!0)}if(!t&&e){if(!(null!=(i=this.hls.loadLevelObj)&&i.details)||o2(this.hls.inFlightFragments,l))return 0;let t=!1,a=e.end;for(;a<l;){let e=o4(a,r);if(e)a+=e.duration;else{t=!0;break}}if(t)return 0}}let t=Math.max(l+.05,n+.1);if(this.warn(`skipping hole, adjusting currentTime from ${n} to ${t}`),this.moved=!0,a.currentTime=t,!(null!=e&&e.gap)){let i=Error(`fragment loaded with buffer holes, seeking from ${n} to ${t}`),r={type:t$.MEDIA_ERROR,details:tH.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:i,reason:i.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?r.part=e:r.frag=e),this.hls.trigger(tV.ERROR,r)}return t}}return 0}_tryNudgeBuffer(e){let{hls:t,media:i,nudgeRetry:r}=this,a=null==t?void 0:t.config;if(!i||!a)return 0;let s=i.currentTime;if(this.nudgeRetry++,r<a.nudgeMaxRetry){let n=s+(r+1)*a.nudgeOffset,o=Error(`Nudging 'currentTime' from ${s} to ${n}`);this.warn(o.message),i.currentTime=n,t.trigger(tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1,buffer:e.len,bufferInfo:e})}else{let i=Error(`Playhead still not moving while enough data buffered @${s} after ${a.nudgeMaxRetry} nudges`);this.error(i.message),t.trigger(tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.BUFFER_STALLED_ERROR,error:i,fatal:!0,buffer:e.len,bufferInfo:e})}}}function o2(e,t){let i=o3(e.main);if(i&&i.start<=t)return i;let r=o3(e.audio);return r&&r.start<=t?r:null}function o3(e){if(!e)return null;switch(e.state){case aV:case aH:case az:case aX:return null}return e.frag}function o4(e,t){return t.getAppendedFrag(e,tj)||t.getPartialFragment(e)}function o5(){if("u">typeof self)return self.VTTCue||self.TextTrackCue}function o8(e,t,i,r,a){let s=new e(t,i,"");try{s.value=r,a&&(s.type=a)}catch(n){s=new e(t,i,i5(a?t0({type:a},r):r))}return s}let o9=(()=>{let e=o5();try{e&&new e(0,1/0,"")}catch(e){return Number.MAX_VALUE}return 1/0})();class o6{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(tV.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(){let{hls:e}=this;e&&(e.on(tV.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(tV.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tV.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(tV.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(tV.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(tV.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){let{hls:e}=this;e&&(e.off(tV.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(tV.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tV.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(tV.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(tV.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(tV.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var i;this.media=t.media,(null==(i=t.overrides)?void 0:i.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;let t=null==(e=this.hls)?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,t.transferMedia||(this.id3Track&&(this.removeCues&&nX(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){let t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){let i=e[t];if("metadata"===i.kind&&"id3"===i.label)return nY(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;let{enableEmsgMetadataCues:i,enableID3MetadataCues:r}=this.hls.config;if(!i&&!r)return;let{samples:a}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));let s=o5();if(s)for(let e=0;e<a.length;
29e++){let t=a[e].type;if(t===su.emsg&&!i||!r)continue;let n=so(a[e].data),o=a[e].pts,l=o+a[e].duration;l>o9&&(l=o9),l-o<=0&&(l=o+.25);for(let e=0;e<n.length;e++){let i=n[e];if(!sl(i)){this.updateId3CueEnds(o,t);let e=o8(s,o,l,i,t);e&&this.id3Track.addCue(e)}}}}updateId3CueEnds(e,t){var i;let r=null==(i=this.id3Track)?void 0:i.cues;if(r)for(let i=r.length;i--;){let a=r[i];a.type===t&&a.startTime<e&&a.endTime===o9&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:r}){let{id3Track:a,hls:s}=this;if(!s)return;let{config:{enableEmsgMetadataCues:n,enableID3MetadataCues:o}}=s;a&&(n||o)&&nQ(a,t,i,"audio"===r?e=>e.type===su.audioId3&&o:"video"===r?e=>e.type===su.emsg&&n:e=>e.type===su.audioId3&&o||e.type===su.emsg&&n)}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){var i,r;if(!this.hls||!this.media)return;let{assetPlayerId:a,timelineOffset:s,enableDateRangeMetadataCues:n,interstitialsController:o}=this.hls.config;if(!n)return;let l=o5();if(a&&s&&!o){let{fragmentStart:t,fragmentEnd:i}=e,r=this.assetCue;r?(r.startTime=t,r.endTime=i):l&&(r=this.assetCue=o8(l,t,i,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"))&&(r.id=a,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(r),r.addEventListener("enter",this.onEventCueEnter))}if(!e.hasProgramDateTime)return;let{id3Track:d}=this,{dateRanges:u}=e,h=Object.keys(u),c=this.dateRangeCuesAppended;if(d&&t)if(null!=(i=d.cues)&&i.length){let e=Object.keys(c).filter(e=>!h.includes(e));for(let t=e.length;t--;){let i=e[t],a=null==(r=c[i])?void 0:r.cues;delete c[i],a&&Object.keys(a).forEach(e=>{let t=a[e];if(t){t.removeEventListener("enter",this.onEventCueEnter);try{d.removeCue(t)}catch(e){}}})}}else c=this.dateRangeCuesAppended={};let m=e.fragments[e.fragments.length-1];if(0!==h.length&&tU(null==m?void 0:m.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let e=0;e<h.length;e++){let t=h[e],i=u[t],r=i.startTime,a=c[t],s=(null==a?void 0:a.cues)||{},n=(null==a?void 0:a.durationKnown)||!1,d=o9,{duration:m,endDate:f}=i;if(f&&null!==m)d=r+m,n=!0;else if(i.endOnNext&&!n){let e=h.reduce((e,t)=>{if(t!==i.id){let r=u[t];if(r.class===i.class&&r.startDate>i.startDate&&(!e||i.startDate<e.startDate))return r}return e},null);e&&(d=e.startTime,n=!0)}let g=Object.keys(i.attr);for(let e=0;e<g.length;e++){let u=g[e];if("ID"===u||"CLASS"===u||"CUE"===u||"START-DATE"===u||"DURATION"===u||"END-DATE"===u||"END-ON-NEXT"===u)continue;let h=s[u];if(h)n&&!(null!=a&&a.durationKnown)?h.endTime=d:Math.abs(h.startTime-r)>.01&&(h.startTime=r,h.endTime=d);else if(l){let e=i.attr[u];("SCTE35-OUT"===u||"SCTE35-IN"===u||"SCTE35-CMD"===u)&&(e=it(e));let a=o8(l,r,d,{key:u,data:e},su.dateRange);a&&(a.id=t,this.id3Track.addCue(a),s[u]=a,o&&("X-ASSET-LIST"===u||"X-ASSET-URL"===u)&&a.addEventListener("enter",this.onEventCueEnter))}}c[t]={cues:s,dateRange:i,durationKnown:n}}}}}class o7{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=()=>{let{media:e}=this,t=this.levelDetails;if(!e||!t)return;this.currentTime=e.currentTime;let i=this.computeLatency();if(null===i)return;this._latency=i;let{lowLatencyMode:r,maxLiveSyncPlaybackRate:a}=this.config;if(!r||1===a||!t.live)return;let s=this.targetLatency;if(null===s)return;let n=i-s;if(n<Math.min(this.maxLatency,s+t.targetduration)&&n>.05&&this.forwardBufferLength>1){let t=Math.min(Math.min(2,Math.max(1,a)),Math.max(1,Math.round(2/(1+Math.exp(-.75*n-this.edgeStalled))*20)/20));this.changeMediaPlaybackRate(e,t)}else 1!==e.playbackRate&&0!==e.playbackRate&&this.changeMediaPlaybackRate(e,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return(null==(e=this.hls)?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){let{config:e}=this;if(void 0!==e.liveMaxLatencyDuration)return e.liveMaxLatencyDuration;let t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){let e=this.levelDetails;if(null===e||null===this.hls)return null;let{holdBack:t,partHoldBack:i,targetduration:r}=e,{liveSyncDuration:a,liveSyncDurationCount:s,lowLatencyMode:n}=this.config,o=this.hls.userConfig,l=n&&i||t;return(this._targetLatencyUpdated||o.liveSyncDuration||o.liveSyncDurationCount||0===l)&&(l=void 0!==a?a:s*r),l+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,r)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){let e=this.estimateLiveEdge(),t=this.targetLatency;if(null===e||null===t)return null;let i=this.levelDetails;if(null===i)return null;let r=i.edge,a=e-t-this.edgeStalled;return Math.min(Math.max(r-i.totalduration,a),r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration))}get drift(){let e=this.levelDetails;return null===e?1:e.drift}get edgeStalled(){let e=this.levelDetails;if(null===e)return 0;let t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}get forwardBufferLength(){let{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;let i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){let{hls:e}=this;
29e&&(e.on(tV.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tV.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(tV.ERROR,this.onError,this))}unregisterListeners(){let{hls:e}=this;e&&(e.off(tV.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tV.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tV.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(tV.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 i;t.details===tH.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&null!=(i=this.levelDetails)&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,r;e.playbackRate!==t&&(null==(i=this.hls)||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${null==(r=this.targetLatency)?void 0:r.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){let e=this.levelDetails;return null===e?null:e.edge+e.age}computeLatency(){let e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}class le extends s8{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){let{hls:e}=this;e.on(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tV.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(tV.LEVEL_LOADED,this.onLevelLoaded,this),e.on(tV.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(tV.FRAG_BUFFERED,this.onFragBuffered,this),e.on(tV.ERROR,this.onError,this)}_unregisterListeners(){let{hls:e}=this;e.off(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tV.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(tV.LEVEL_LOADED,this.onLevelLoaded,this),e.off(tV.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(tV.FRAG_BUFFERED,this.onFragBuffered,this),e.off(tV.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(e=>{e.loadError=0,e.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){let i=this.hls.config.preferManagedMediaSource,r=[],a={},s={},n=!1,o=!1,l=!1;t.levels.forEach(e=>{let t=e.attrs,{audioCodec:d,videoCodec:u}=e;d&&(e.audioCodec=d=iG(d,i)||void 0),u&&(u=e.videoCodec=function(e){let t=e.split(",");for(let e=0;e<t.length;e++){let i=t[e].split(".");i.length>2&&"avc1"===i[0]&&(t[e]=`avc1.${parseInt(i[1]).toString(16)}${("000"+parseInt(i[2]).toString(16)).slice(-4)}`)}return t.join(",")}(u));let{width:h,height:c,unknownCodecs:m}=e,f=(null==m?void 0:m.length)||0;if(n||(n=!!(h&&c)),o||(o=!!u),l||(l=!!d),f||d&&!this.isAudioSupported(d)||u&&!this.isVideoSupported(u))return void this.log(`Some or all CODECS not supported "${t.CODECS}"`);let{CODECS:g,"FRAME-RATE":v,"HDCP-LEVEL":y,"PATHWAY-ID":E,RESOLUTION:b,"VIDEO-RANGE":T}=t,A=`${E||"."}-`,_=`${A}${e.bitrate}-${b}-${v}-${g}-${T}-${y}`;if(a[_])if(a[_].uri===e.url||e.attrs["PATHWAY-ID"])a[_].addGroupId("audio",t.AUDIO),a[_].addGroupId("text",t.SUBTITLES);else{let t=s[_]+=1;e.attrs["PATHWAY-ID"]=Array(t+1).join(".");let i=this.createLevel(e);a[_]=i,r.push(i)}else{let t=this.createLevel(e);a[_]=t,s[_]=1,r.push(t)}}),this.filterAndSortMediaOptions(r,t,n,o,l)}createLevel(e){let t=new i3(e),i=e.supplemental;if(null!=i&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){let e=Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(e.message),t.supportedResult=iX(e,[])}return t}isAudioSupported(e){return iN(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return iN(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,r,a){var s,n;let o=[],l=[],d=e,u=(null==(s=t.stats)?void 0:s.parsing)||{};if((i||r)&&a&&(d=d.filter(({videoCodec:e,videoRange:t,width:i,height:r})=>{var a;return(!!e||!!(i&&r))&&!!(a=t)&&i0.indexOf(a)>-1})),0===d.length){Promise.resolve().then(()=>
29{if(this.hls){let e="no level with compatible codecs found in manifest",i=e;t.levels.length&&(i=`one or more CODECS in variant not supported: ${i5(t.levels.map(e=>e.attrs.CODECS).filter((e,t,i)=>i.indexOf(e)===t))}`,this.warn(i),e+=` (${i})`);let r=Error(e);this.hls.trigger(tV.ERROR,{type:t$.MEDIA_ERROR,details:tH.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:r,reason:i})}}),u.end=performance.now();return}t.audioTracks&<(o=t.audioTracks.filter(e=>!e.audioCodec||this.isAudioSupported(e.audioCodec))),t.subtitles&<(l=t.subtitles);let h=d.slice(0);d.sort((e,t)=>{if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return i0.indexOf(e.videoRange)-i0.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){let i=iB(e.videoCodec),r=iB(t.videoCodec);if(i!==r)return r-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){let i=i$(e.codecSet),r=i$(t.codecSet);if(i!==r)return r-i}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0});let c=h[0];if(this.steering&&(d=this.steering.filterParsedLevels(d)).length!==h.length){for(let e=0;e<h.length;e++)if(h[e].pathwayId===d[0].pathwayId){c=h[e];break}}this._levels=d;for(let e=0;e<d.length;e++)if(d[e]===c){this._firstLevel=e;let t=c.bitrate,i=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${d.length} level(s) found, first bitrate: ${t}`),(null==(n=this.hls.userConfig)?void 0:n.abrEwmaDefaultEstimate)===void 0){let e=Math.min(t,this.hls.config.abrEwmaDefaultEstimateMax);e>i&&i===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}let m=a&&!r,f=this.hls.config,g=!!(f.audioStreamController&&f.audioTrackController),v={levels:d,audioTracks:o,subtitleTracks:l,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:a,video:r,altAudio:g&&!m&&o.some(e=>!!e.url)};u.end=performance.now(),this.hls.trigger(tV.MANIFEST_PARSED,v)}get levels(){return 0===this._levels.length?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){let t=this._levels;if(0===t.length)return;if(e<0||e>=t.length){let i=Error("invalid level idx"),r=e<0;if(this.hls.trigger(tV.ERROR,{type:t$.OTHER_ERROR,details:tH.LEVEL_SWITCH_ERROR,level:e,fatal:r,error:i,reason:i.message}),r)return;e=Math.min(e,t.length-1)}let i=this.currentLevelIndex,r=this.currentLevel,a=r?r.attrs["PATHWAY-ID"]:void 0,s=t[e],n=s.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=s,i===e&&r&&a===n)return;this.log(`Switching to level ${e} (${s.height?s.height+"p ":""}${s.videoRange?s.videoRange+" ":""}${s.codecSet?s.codecSet+" ":""}@${s.bitrate})${n?" with Pathway "+n:""} from level ${i}${a?" with Pathway "+a:""}`);let o={level:e,attrs:s.attrs,details:s.details,bitrate:s.bitrate,averageBitrate:s.averageBitrate,maxBitrate:s.maxBitrate,realBitrate:s.realBitrate,width:s.width,height:s.height,codecSet:s.codecSet,audioCodec:s.audioCodec,videoCodec:s.videoCodec,audioGroups:s.audioGroups,subtitleGroups:s.subtitleGroups,loaded:s.loaded,loadError:s.loadError,fragmentError:s.fragmentError,name:s.name,id:s.id,uri:s.uri,url:s.url,urlId:0,audioGroupIds:s.audioGroupIds,textGroupIds:s.textGroupIds};this.hls.trigger(tV.LEVEL_SWITCHING,o);let l=s.details;if(!l||l.live){let e=this.switchParams(s.uri,null==r?void 0:r.details,l);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(void 0===this._startLevel){let e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){let t=this.steering.pathways(),i=e.filter(e=>-1!==t.indexOf(e));if(e.length<1)return void this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);this.steering.pathwayPriority=i}}onError(e,t){!t.fatal&&t.context&&t.context.type===tW&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(void 0!==t&&t.type===tj){let e=t.elementaryStreams;if(!Object.keys(e).some(t=>!!e[t]))return;let i=this._levels[t.level];null!=i&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var i,r;let{level:a,details:s}=t,n=t.levelInfo;if(!n){this.warn(`Invalid level index ${a}`),null!=(r=t.deliveryDirectives)&&r.skip&&(s.deltaUpdateFailed=!0);return}if(n===this.currentLevel||t.withoutMultiVariant){0===n.fragmentError&&(n.loadError=0);let e=n.details;e===t.details&&e.advanced&&(e=void 0),this.playlistLoaded(a,t,e)}else null!=(i=t.deliveryDirectives)&&i.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLo
29ading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let i=this.getUrlWithDirectives(e.uri,t),r=this.currentLevelIndex,a=e.attrs["PATHWAY-ID"],s=e.details,n=null==s?void 0:s.age;this.log(`Loading level index ${r}${(null==t?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${a?" Pathway "+a:""}${n&&s.live?" age "+n.toFixed(1)+(s.type?" "+s.type:""):""} ${i}`),this.hls.trigger(tV.LEVEL_LOADING,{url:i,level:r,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return -1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(1===this._levels.length)return;let i=this._levels.filter((t,i)=>i!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach(e=>e.level=-1)),!1));aD(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);let r=i.length-1;this._firstLevel=Math.min(this._firstLevel,r),this._startLevel&&(this._startLevel=Math.min(this._startLevel,r)),this.hls.trigger(tV.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){let{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(tV.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function lt(e){let t={};e.forEach(e=>{let i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++})}function li(){return self.SourceBuffer||self.WebKitSourceBuffer}function lr(){if(!t9())return!1;let e=li();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}class la extends aJ{constructor(e,t,i){super(e,t,i,"stream-controller",tj),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=()=>{let e=this.media,t=e?e.currentTime:null;if(null===t||!tU(t)||(this.log(`Media seeked to ${t.toFixed(3)}`),!this.getBufferedFrag(t)))return;let i=this.getFwdBufferInfoAtPos(e,t,tj,0);null===i||0===i.len?this.warn(`Main forward buffer length at ${t} on "seeked" event ${i?i.len:"empty"})`):this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();let{hls:e}=this;e.on(tV.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tV.LEVEL_LOADING,this.onLevelLoading,this),e.on(tV.LEVEL_LOADED,this.onLevelLoaded,this),e.on(tV.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(tV.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(tV.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(tV.BUFFER_CREATED,this.onBufferCreated,this),e.on(tV.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(tV.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(tV.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();let{hls:e}=this;e.off(tV.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tV.LEVEL_LOADED,this.onLevelLoaded,this),e.off(tV.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(tV.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(tV.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(tV.BUFFER_CREATED,this.onBufferCreated,this),e.off(tV.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(tV.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(tV.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){let{lastCurrentTime:i,hls:r}=this;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){let e=r.startLevel;-1===e&&(r.config.testBandwidth&&this.levels.length>1?(e=0,this.bitrateTest=!0):e=r.firstAutoLevel),r.nextLoadLevel=e,this.level=r.loadLevel,this._hasEnoughToStart=!!t}i>0&&-1===e&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=aV,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=aH}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case aZ:{let{levels:e,level:t}=this,i=null==e?void 0:e[t],r=null==i?void 0:i.details;if(!r||r.live&&(this.levelLastLoaded!==i||this.waitForLive(i)))this.hls.nextLoadLevel!==this.level&&(this.state=aV);else{if(this.waitForCdnTuneIn(r))break;this.state=aV}break}case aK:this.checkRetryDate()}this.state===aV&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),null!=(e=this.media)&&e.readyState&&!1===this.media.seeking&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){let{hls:e,levelLastLoaded:t,levels:i,media:r}=this;if(null===t||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;
29let a=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(null!=i&&i[a]))return;let s=i[a],n=this.getMainFwdBufferInfo();if(null===n)return;let o=this.getLevelDetails();if(o&&this._streamEnded(n,o)){let e={};2===this.altAudio&&(e.type="video"),this.hls.trigger(tV.BUFFER_EOS,e),this.state=az;return}if(!this.buffering)return;e.loadLevel!==a&&-1===e.manualLevel&&this.log(`Adapting to level ${a} from level ${this.level}`),this.level=e.nextLoadLevel=a;let l=s.details;if(!l||this.state===aZ||this.waitForLive(s)){this.level=a,this.state=aZ,this.startFragRequested=!1;return}let d=n.len,u=this.getMaxBufferLength(s.maxBitrate);if(d>=u)return;this.backtrackFragment&&this.backtrackFragment.start>n.end&&(this.backtrackFragment=null);let h=this.backtrackFragment?this.backtrackFragment.start:n.end,c=this.getNextFragment(h,l);if(this.couldBacktrack&&!this.fragPrevious&&c&&iu(c)&&"OK"!==this.fragmentTracker.getState(c)){var m;let e=(null!=(m=this.backtrackFragment)?m:c).sn-l.startSN,t=l.fragments[e-1];t&&c.cc===t.cc&&(c=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&n.len&&(this.backtrackFragment=null);if(c&&this.isLoopLoading(c,h)){if(!c.gap){let e=this.audioOnly&&!this.altAudio?is:io,t=(e===io?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,tj)}c=this.getNextFragmentLoopLoading(c,l,n,tj,u)}c&&(!c.initSegment||c.initSegment.data||this.bitrateTest||(c=c.initSegment),this.loadFragment(c,s,h))}loadFragment(e,t,i){let r=this.fragmentTracker.getState(e);r===rv||r===rE?iu(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,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,tj)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,1/0)}nextLevelSwitch(){let{levels:e,media:t}=this;if(null!=t&&t.readyState){let i,r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);let a=this.getLevelDetails();if(null!=a&&a.live){let e=this.getMainFwdBufferInfo();if(!e||e.len<2*a.targetduration)return}if(!t.paused&&e){let t=e[this.hls.nextLoadLevel],r=this.fragLastKbps;i=r&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*r)+1:0}else i=0;let s=this.getBufferedFrag(t.currentTime+i);if(s){let e=this.followingBufferedFrag(s);if(e){this.abortCurrentFrag();let t=e.maxStartPTS?e.maxStartPTS:e.start,i=e.duration,r=Math.max(s.end,t+Math.min(Math.max(i-this.config.maxFragLookUpTolerance,i*(this.couldBacktrack?.5:.125)),i*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(r,1/0)}}}}abortCurrentFrag(){let e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case aG:case aW:case aK:case aj:case aY:this.state=aV}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,2===this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);let i=t.media;aF(i,"playing",this.onMediaPlaying),aF(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){let{media:i}=this;i&&(aB(i,"playing",this.onMediaPlaying),aB(i,"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(tV.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){var i;let r,a=!1,s=!1;for(let e=0;e<t.levels.length;e++){let i=t.levels[e].audioCodec;i&&(a=a||-1!==i.indexOf("mp4a.40.2"),s=s||-1!==i.indexOf("mp4a.40.5"))}this.audioCodecSwitch=a&&s&&"function"!=typeof(null==(r=li())||null==(i=r.prototype)?void 0:i.changeType),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){let{levels:i}=this;if(!i||this.state!==aV)return;let r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=aZ)}onLevelLoaded(e,t){var i,r;let{levels:a,startFragRequested:s}=this,n=t.level,o=t.details,l=o.totalduration;if(!a)return void this.warn(`Levels were reset while loading level ${n}`);this.log(`Level ${n} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${l}`);let d=t.levelInfo,u=this.fragCurrent;u&&(this.state===aW||this.state===aK)&&u.level!==t.level&&u.loader&&this.abortCurrentFrag();let h=0;if(o.live||null!=(i=d.details)&&i.live){if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;h=this.alignPlaylists(o,d.details,null==(r=this.levelLastLoaded)?void 0:r.details)}if(d.details=o,this.levelLastLoaded=d,s||this.setStartPosition(o,h),this.hls.trigger(tV.LEVEL_UPDATED,{details:o,level:n}),this.state===aZ){if(this.waitForCdnTuneIn(o))return;this.state=aV}s&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}
29synchronizeToLiveEdge(e){let{config:t,media:i}=this;if(!i)return;let r=this.hls.liveSyncPosition,a=this.getLoadPosition(),s=e.fragmentStart,n=e.edge,o=a>=s-t.maxFragLookUpTolerance&&a<=n;if(null!==r&&i.duration>r&&(a<r||!o)){let s=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!o&&i.readyState<4||a<n-s)&&(this._hasEnoughToStart||(this.nextLoadPosition=r),i.readyState))if(this.warn(`Playback: ${a.toFixed(3)} is located too far from the end of live sliding playlist: ${n}, reset currentTime to : ${r.toFixed(3)}`),"buffered"===this.config.liveSyncMode){var l;let e=rN.bufferInfo(i,r,0);if(!(null!=(l=e.buffered)&&l.length)||e.start<=a){i.currentTime=r;return}let{nextStart:t}=rN.bufferedInfo(e.buffered,a,0);t&&(i.currentTime=t)}else i.currentTime=r}}_handleFragmentLoadProgress(e){var t;let i=e.frag,{part:r,payload:a}=e,{levels:s}=this;if(!s)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);let n=s[i.level];if(!n)return void this.warn(`Level ${i.level} not found on progress`);let o=n.details;if(!o){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}let l=n.videoCodec,d=o.PTSKnown||!o.live,u=null==(t=i.initSegment)?void 0:t.data,h=this._getAudioCodec(n),c=this.transmuxer=this.transmuxer||new s5(this.hls,tj,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=r?r.index:-1,f=new rP(i.level,i.sn,i.stats.chunkCount,a.byteLength,m,-1!==m),g=this.initPTS[i.cc];c.push(a,u,h,l,i,r,o.totalduration,d,f,g)}onAudioTrackSwitching(e,t){let i=this.hls,r=0!==this.altAudio;if(rr(t.url,i))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;let e=this.fragCurrent;e&&(this.log("Switching to main audio track, cancel main fragment load"),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(r){this.altAudio=0,this.fragmentTracker.removeAllFragments(),i.once(tV.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(tV.AUDIO_TRACK_SWITCHED,t)}),i.trigger(tV.BUFFER_FLUSHING,{startOffset:0,endOffset:1/0,type:null});return}i.trigger(tV.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){let i=rr(t.url,this.hls);if(i){let e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e)}this.altAudio=2*!!i,this.tick()}onBufferCreated(e,t){let i,r,a=t.tracks,s=!1;for(let e in a){let t=a[e];if("main"===t.id){if(r=e,i=t,"video"===e){let t=a[e];t&&(this.videoBuffer=t.buffer)}}else s=!0}s&&i?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){let{frag:i,part:r}=t,a=i.type===tj;if(a){if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===aY&&(this.state=aV);return}let e=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*e.total/(e.buffering.end-e.loading.first)),iu(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}let s=this.media;s&&(!this._hasEnoughToStart&&rN.getBuffered(s).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),a&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=aX;return}switch(t.details){case tH.FRAG_GAP:case tH.FRAG_PARSING_ERROR:case tH.FRAG_DECRYPT_ERROR:case tH.FRAG_LOAD_ERROR:case tH.FRAG_LOAD_TIMEOUT:case tH.KEY_LOAD_ERROR:case tH.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(tj,t);break;case tH.LEVEL_LOAD_ERROR:case tH.LEVEL_LOAD_TIMEOUT:case tH.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==aZ||(null==(i=t.context)?void 0:i.type)!==tW||(this.state=aV);break;case tH.BUFFER_ADD_CODEC_ERROR:case tH.BUFFER_APPEND_ERROR:if("main"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case tH.BUFFER_FULL_ERROR:if("main"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,1/0));break;case tH.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onFragLoadEmergencyAborted(){this.state=aV,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==is||!this.altAudio){let e=(t===io?this.videoBuffer:this.mediaBuffer)||this.media;e&&(this.afterBufferFlushed(e,t,tj),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,-1===this.level&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){let{media:e}=this;if(!e)return;let t=e.currentTime,i=this.startPosition;if(i>=0&&t<i){if(e.seeking)return void this.log(`could not seek to ${i}, already seeking at ${t}`);let r=this.timelineOffset;r&&i&&(i+=r);let a=this.getLevelDetails(),s=rN.getBuffered(e),n=s.length?s.start(0):0,o=n-i,l=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||o>0&&(o<l||this.loadingParts&&o<2*((null==a?void 0:a.partTarget)||0)))&&(this.log(`adjusting start position by ${o} to match buffer start`),i+=o,this.startPosition=i),t<i&&(this.log(`seek to target start position ${i} from current time ${t} buffer start ${n}`),e.currentTime=i)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(e=>{let{hls:i}=this,r=null==e?void 0:e.frag;if(!r||this.fragContextChanged(r))return;t.fragmentError=0,this.state=aV,this.startFragRequested=!1,this.bitrateTest=!1;let a=r.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),i.trigger(tV.FRAG_LOADED,e),r.bitrateTest=!1}
29).catch(t=>{this.state!==aH&&this.state!==aX&&(this.warn(t),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){let t=this.playlistType,{hls:i}=this,{remuxResult:r,chunkMeta:a}=e,s=this.getCurrentContext(a);if(!s)return void this.resetWhenMissingContext(a);let{frag:n,part:o,level:l}=s,{video:d,text:u,id3:h,initSegment:c}=r,{details:m}=l,f=this.altAudio?void 0:r.audio;if(this.fragContextChanged(n))return void this.fragmentTracker.removeFragment(n);if(this.state=aj,c){let e=c.tracks;if(e){let r=n.initSegment||n;if(this.unhandledEncryptionError(c,n))return;this._bufferInitSegment(l,e,r,a),i.trigger(tV.FRAG_PARSING_INIT_SEGMENT,{frag:r,id:t,tracks:e})}let r=c.initPTS,s=c.timescale,o=this.initPTS[n.cc];if(tU(r)&&(!o||o.baseTime!==r||o.timescale!==s)){let e=c.trackId;this.initPTS[n.cc]={baseTime:r,timescale:s,trackId:e},i.trigger(tV.INIT_PTS_FOUND,{frag:n,id:t,initPTS:r,timescale:s,trackId:e})}}if(d&&m){f&&"audiovideo"===d.type&&this.logMuxedErr(n);let e=m.fragments[n.sn-1-m.startSN],t=n.sn===m.startSN,i=!e||n.cc>e.cc;if(!1!==r.independent){let{startPTS:e,endPTS:r,startDTS:s,endDTS:l}=d;if(o)o.elementaryStreams[d.type]={startPTS:e,endPTS:r,startDTS:s,endDTS:l};else if(d.firstKeyFrame&&d.independent&&1===a.id&&!i&&(this.couldBacktrack=!0),d.dropped&&d.independent){let a=this.getMainFwdBufferInfo(),s=(a?a.end:this.getLoadPosition())+this.config.maxBufferHole,o=d.firstKeyFramePTS?d.firstKeyFramePTS:e;if(!t&&s<o-this.config.maxBufferHole&&!i)return void this.backtrack(n);i&&(n.gap=!0),n.setElementaryStreamInfo(d.type,n.start,r,n.start,l,!0)}else t&&e-(m.appliedTimelineOffset||0)>2&&(n.gap=!0);n.setElementaryStreamInfo(d.type,e,r,s,l),this.backtrackFragment&&(this.backtrackFragment=n),this.bufferFragmentData(d,n,o,a,t||i)}else{if(!t&&!i)return void this.backtrack(n);n.gap=!0}}if(f){let{startPTS:e,endPTS:t,startDTS:i,endDTS:r}=f;o&&(o.elementaryStreams[is]={startPTS:e,endPTS:t,startDTS:i,endDTS:r}),n.setElementaryStreamInfo(is,e,t,i,r),this.bufferFragmentData(f,n,o,a)}if(m&&null!=h&&h.samples.length){let e={id:t,frag:n,details:m,samples:h.samples};i.trigger(tV.FRAG_PARSING_METADATA,e)}if(m&&u){let e={id:t,frag:n,details:m,samples:u.samples};i.trigger(tV.FRAG_PARSING_USERDATA,e)}}logMuxedErr(e){this.warn(`${iu(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,r){if(this.state!==aj)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));let{audio:a,video:s,audiovideo:n}=t;if(a){let i=e.audioCodec,r=iW(a.codec,i);"mp4a"===r&&(r="mp4a.40.5");let s=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){r&&(r=-1!==r.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");let e=a.metadata;e&&"channelCount"in e&&1!==(e.channelCount||1)&&-1===s.indexOf("firefox")&&(r="mp4a.40.5")}r&&-1!==r.indexOf("mp4a.40.5")&&-1!==s.indexOf("android")&&"audio/mpeg"!==a.container&&(r="mp4a.40.2",this.log(`Android: force audio codec to ${r}`)),i&&i!==r&&this.log(`Swapping manifest audio codec "${i}" for "${r}"`),a.levelCodec=r,a.id=tj,this.log(`Init audio buffer, container:${a.container}, codecs[selected/level/parsed]=[${r||""}/${i||""}/${a.codec}]`),delete t.audiovideo}if(s){s.levelCodec=e.videoCodec,s.id=tj;let i=s.codec;if((null==i?void 0:i.length)===4)switch(i){case"hvc1":case"hev1":s.codec="hvc1.1.6.L120.90";break;case"av01":s.codec="av01.0.04M.08";break;case"avc1":s.codec="avc1.42e01e"}this.log(`Init video buffer, container:${s.container}, codecs[level/parsed]=[${e.videoCodec||""}/${i}]${s.codec!==i?" parsed-corrected="+s.codec:""}${s.supplemental?" supplemental="+s.supplemental:""}`),delete t.audiovideo}n&&(this.log(`Init audiovideo buffer, container:${n.container}, codecs[level/parsed]=[${e.codecs}/${n.codec}]`),delete t.video,delete t.audio);let o=Object.keys(t);if(o.length){if(this.hls.trigger(tV.BUFFER_CODECS,t),!this.hls)return;o.forEach(e=>{let a=t[e].initSegment;null!=a&&a.byteLength&&this.hls.trigger(tV.BUFFER_APPENDING,{type:e,data:a,frag:i,part:null,chunkMeta:r,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){let e=this.mediaBuffer&&2===this.altAudio?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,tj)}get maxBufferLength(){let{levels:e,level:t}=this,i=null==e?void 0:e[t];return i?this.getMaxBufferLength(i.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=aV}checkFragmentChanged(){let e=this.media,t=null;if(e&&e.readyState>1&&!1===e.seeking){let i=e.currentTime;if(rN.isBuffered(e,i)?t=this.getAppendedFrag(i):rN.isBuffered(e,i+.
291)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;let e=this.fragPlaying,i=t.level;(!e||t.sn!==e.sn||e.level!==i)&&(this.fragPlaying=t,this.hls.trigger(tV.FRAG_CHANGED,{frag:t}),e&&e.level===i||this.hls.trigger(tV.LEVEL_SWITCHED,{level:i}))}}}get nextLevel(){let e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;let t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;return tU(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;let t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;if(tU(t)){let e=this.getLevelDetails(),i=this.currentFrag||(e?rs(null,e.fragments,t):null);if(i){let e=i.programDateTime;if(null!==e)return new Date(e+(t-i.start)*1e3)}}return null}get currentLevel(){let e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){let e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class ls extends t1{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(let i in this.keyIdToKeyInfo){let r=this.keyIdToKeyInfo[i].loader;if(r){var t;if(e&&e!==(null==(t=r.context)?void 0:t.frag.type))return;r.abort()}}}detach(){for(let e in this.keyIdToKeyInfo){let t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){for(let e in this.detach(),this.keyIdToKeyInfo){let t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=tH.KEY_LOAD_ERROR,i,r,a){return new rD({type:t$.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:a,error:i,networkDetails:r})}loadClear(e,t,i){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let r=0,a=t.length;r<a;r++){let s=t[r];if(e.cc<=s.cc&&(!iu(e)||!iu(s)||e.sn<s.sn)||!i&&r==a-1)return this.emeController.selectKeySystemFormat(s).then(e=>{if(!this.emeController)return;s.setKeyFormat(e);let t=r6(e);if(t)return this.emeController.getKeySystemAccess([t])})}if(this.config.requireKeySystemAccessOnStart){let e=ae(this.config);if(e.length)return this.emeController.getKeySystemAccess(e)}}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 i,r;t&&e.setKeyFormat(t);let a=e.decryptdata;if(!a){let i=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,tH.KEY_LOAD_ERROR,i))}let s=a.uri;if(!s)return Promise.reject(this.createKeyLoadError(e,tH.KEY_LOAD_ERROR,Error(`Invalid key URI: "${s}"`)));let n=ln(a),o=this.keyIdToKeyInfo[n];if(null!=(i=o)&&i.decryptdata.key)return a.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if(this.emeController&&null!=(r=o)&&r.keyLoadPromise)switch(this.emeController.getKeyStatus(o.decryptdata)){case"usable":case"usable-in-future":return o.keyLoadPromise.then(t=>{let{keyInfo:i}=t;return a.key=i.decryptdata.key,{frag:e,keyInfo:i}})}switch(this.log(`${this.keyIdToKeyInfo[n]?"Rel":"L"}oading${a.keyId?" keyId: "+ie(a.keyId):""} URI: ${a.uri} from ${e.type} ${e.level}`),o=this.keyIdToKeyInfo[n]={decryptdata:a,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},a.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":if("identity"===a.keyFormat)return this.loadKeyHTTP(o,e);return this.loadKeyEME(o,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,tH.KEY_LOAD_ERROR,Error(`Key supplied with unsupported METHOD: "${a.method}"`)))}}loadKeyEME(e,t){let i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var r,a;if(!e.decryptdata.keyId&&null!=(r=t.initSegment)&&r.data){let i,r=(a=t.initSegment.data,i=[],iw(a,e=>i.push(e.subarray(8,24))),i);if(r.length){let t=r[0];t.some(e=>0!==e)?(this.log(`Using keyId found in init segment ${ie(t)}`),aa.setKeyIdForUri(e.decryptdata.uri,t)):(t=aa.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${ie(t)}`)),e.decryptdata.keyId=t}}return e.decryptdata.keyId||iu(t)?(e.keyLoadPromise=this.emeController.loadKey(i).then(t=>(e.mediaKeySessionContext=t,i))).catch(i=>{throw e.keyLoadPromise=null,"data"in i&&(i.data.frag=t),i}):Promise.resolve(i)}return Promise.resolve(i)}loadKeyHTTP(e,t){let i=this.config,r=new i.loader(i);return t.keyLoader=e.loader=r,e.keyLoadPromise=new Promise((a,s)=>{let n={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},o=i.keyLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};r.load(n,l,{onSuccess:(e,t,i,r)=>{let{frag:n,keyInfo:o}=i,l=ln(o.decryptdata);if(!n.decryptdata||o!==this.keyIdToKeyInfo[l])return s(this.createKeyLoadError(n,tH.KEY_LOAD_ERROR,Error("after key load, decryptdata unset or changed"),r));o.decryptdata.key=n.decryptdata.key=new Uint8Array(e.data),n.keyLoader=null,o.loader=null,a({frag:n,keyInfo:o})},onError:(e,i,r,a)=>{this.resetLoader(i),s(this.createKeyLoadError(t,tH.KEY_LOAD_ERROR,Error(`HTTP Error ${e.code} loading key ${e.text}`),r,t0({url:n.url,data:void 0},e)))},onTimeout:(e,i,r)=>{this.resetLoader(i),s(this.createKeyLoadError(t,tH.KEY_LOAD_TIMEOUT,Error("key loading timed out"),r))},onAbort:(e,i,r)=>{this.resetLoader(i),s(this.createKeyLoadError(t,tH.INTERNAL_ABORTED,Error("key loading aborted"),r))}})})}
29resetLoader(e){let{frag:t,keyInfo:i,url:r}=e,a=i.loader;t.keyLoader===a&&(t.keyLoader=null,i.loader=null);let s=ln(i.decryptdata)||r;delete this.keyIdToKeyInfo[s],a&&a.destroy()}}function ln(e){if(e.keyFormat!==r5){let t=e.keyId;if(t)return ie(t)}return e.uri}function lo(e){let{type:t}=e;switch(t){case tK:return tY;case tq:return tz;default:return tj}}function ll(e,t){let i=e.url;return(void 0===i||0===i.indexOf("data:"))&&(i=t.url),i}class ld{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(){let{hls:e}=this;e.on(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tV.LEVEL_LOADING,this.onLevelLoading,this),e.on(tV.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(tV.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(tV.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){let{hls:e}=this;e.off(tV.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tV.LEVEL_LOADING,this.onLevelLoading,this),e.off(tV.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(tV.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(tV.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){let t=this.hls.config,i=t.pLoader,r=t.loader,a=new(i||r)(t);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(let e in this.loaders){let t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){let{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:tG,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){let{id:i,level:r,pathwayId:a,url:s,deliveryDirectives:n,levelInfo:o}=t;this.load({id:i,level:r,pathwayId:a,responseType:"text",type:tW,url:s,deliveryDirectives:n,levelOrTrack:o})}onAudioTrackLoading(e,t){let{id:i,groupId:r,url:a,deliveryDirectives:s,track:n}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:tK,url:a,deliveryDirectives:s,levelOrTrack:n})}onSubtitleTrackLoading(e,t){let{id:i,groupId:r,url:a,deliveryDirectives:s,track:n}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:tq,url:a,deliveryDirectives:s,levelOrTrack:n})}onLevelsUpdated(e,t){let i=this.loaders[tW];if(i){let e=i.context;e&&!t.levels.some(t=>t===e.levelOrTrack)&&(i.abort(),delete this.loaders[tW])}}load(e){var t;let i,r=this.hls.config,a=this.getInternalLoader(e);if(a){let t=this.hls.logger,i=a.context;if(i&&i.levelOrTrack===e.levelOrTrack&&(i.url===e.url||i.deliveryDirectives&&!e.deliveryDirectives))return void(i.url===e.url?t.log(`[playlist-loader]: ignore ${e.url} ongoing request`):t.log(`[playlist-loader]: ignore ${e.url} in favor of ${i.url}`));t.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),a.abort()}if(i=e.type===tG?r.manifestLoadPolicy.default:tZ({},r.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),a=this.createInternalLoader(e),tU(null==(t=e.deliveryDirectives)?void 0:t.part)){let t;if(e.type===tW&&null!==e.level?t=this.hls.levels[e.level].details:e.type===tK&&null!==e.id?t=this.hls.audioTracks[e.id].details:e.type===tq&&null!==e.id&&(t=this.hls.subtitleTracks[e.id].details),t){let e=t.partTarget,r=t.targetduration;if(e&&r){let t=1e3*Math.max(3*e,.8*r);i=tZ({},i,{maxTimeToFirstByteMs:Math.min(t,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,i.maxTimeToFirstByteMs)})}}}let s=i.errorRetry||i.timeoutRetry||{},n={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:s.maxNumRetry||0,retryDelay:s.retryDelayMs||0,maxRetryDelay:s.maxRetryDelayMs||0};a.load(e,n,{onSuccess:(e,t,i,r)=>{let a=this.getInternalLoader(i);this.resetInternalLoader(i.type);let s=e.data;t.parsing.start=performance.now(),ah.isMediaPlaylist(s)||i.type!==tG?this.handleTrackOrLevelPlaylist(e,t,i,r||null,a):this.handleMasterPlaylist(e,t,i,r)},onError:(e,t,i,r)=>{this.handleNetworkError(t,i,!1,e,r)},onTimeout:(e,t,i)=>{this.handleNetworkError(t,i,!0,void 0,e)}})}
29checkAutostartLoad(){if(!this.hls)return;let{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,r){let a=this.hls,s=e.data,n=ll(e,i),o=ah.parseMasterPlaylist(s,n);if(o.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,i,o.playlistParsingError,r,t);return}let{contentSteering:l,levels:d,sessionData:u,sessionKeys:h,startTimeOffset:c,variableList:m}=o;this.variableList=m,d.forEach(e=>{let{unknownCodecs:t}=e;if(t){let{preferManagedMediaSource:i}=this.hls.config,{audioCodec:r,videoCodec:a}=e;for(let s=t.length;s--;){let n=t[s];iN(n,"audio",i)?(e.audioCodec=r=r?`${r},${n}`:n,iM.audio[r.substring(0,4)]=2,t.splice(s,1)):iN(n,"video",i)&&(e.videoCodec=a=a?`${a},${n}`:n,iM.video[a.substring(0,4)]=2,t.splice(s,1))}}});let{AUDIO:f=[],SUBTITLES:g,"CLOSED-CAPTIONS":v}=ah.parseMasterPlaylistMedia(s,n,o);f.length&&(f.some(e=>!e.url)||!d[0].audioCodec||d[0].attrs.AUDIO||(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new rV({}),bitrate:0,url:""}))),a.trigger(tV.MANIFEST_LOADED,{levels:d,audioTracks:f,subtitles:g,captions:v,contentSteering:l,url:n,stats:t,networkDetails:r,sessionData:u,sessionKeys:h,startTimeOffset:c,variableList:m})}handleTrackOrLevelPlaylist(e,t,i,r,a){let s=this.hls,{id:n,level:o,type:l}=i,d=ll(e,i),u=tU(o)?o:tU(n)?n:0,h=lo(i),c=ah.parseLevelPlaylist(e.data,d,u,h,0,this.variableList);if(l===tG){let e={attrs:new rV({}),bitrate:0,details:c,name:"",url:d};c.requestScheduled=t.loading.start+aw(c,0),s.trigger(tV.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:d,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=c,this.handlePlaylistLoaded(c,e,t,i,r,a)}handleManifestParsingError(e,t,i,r,a){this.hls.trigger(tV.ERROR,{type:t$.NETWORK_ERROR,details:tH.MANIFEST_PARSING_ERROR,fatal:t.type===tG,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:a})}handleNetworkError(e,t,i=!1,r,a){let s=`A network ${i?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===tW?s+=`: ${e.level} id: ${e.id}`:(e.type===tK||e.type===tq)&&(s+=` id: ${e.id} group-id: "${e.groupId}"`);let n=Error(s);this.hls.logger.warn(`[playlist-loader]: ${s}`);let o=tH.UNKNOWN,l=!1,d=this.getInternalLoader(e);switch(e.type){case tG:o=i?tH.MANIFEST_LOAD_TIMEOUT:tH.MANIFEST_LOAD_ERROR,l=!0;break;case tW:o=i?tH.LEVEL_LOAD_TIMEOUT:tH.LEVEL_LOAD_ERROR,l=!1;break;case tK:o=i?tH.AUDIO_TRACK_LOAD_TIMEOUT:tH.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case tq:o=i?tH.SUBTITLE_TRACK_LOAD_TIMEOUT:tH.SUBTITLE_LOAD_ERROR,l=!1}d&&this.resetInternalLoader(e.type);let u={type:t$.NETWORK_ERROR,details:o,fatal:l,url:e.url,loader:d,context:e,error:n,networkDetails:t,stats:a};r&&(u.response=t0({url:(null==t?void 0:t.url)||e.url,data:void 0},r)),this.hls.trigger(tV.ERROR,u)}handlePlaylistLoaded(e,t,i,r,a,s){let n=this.hls,{type:o,level:l,levelOrTrack:d,id:u,groupId:h,deliveryDirectives:c}=r,m=ll(t,r),f=lo(r),g="number"==typeof r.level&&f===tj?l:void 0,v=e.playlistParsingError;if(v){if(this.hls.logger.warn(`${v} ${e.url}`),!n.config.ignorePlaylistParsingErrors)return void n.trigger(tV.ERROR,{type:t$.NETWORK_ERROR,details:tH.LEVEL_PARSING_ERROR,fatal:!1,url:m,error:v,reason:v.message,response:t,context:r,level:g,parent:f,networkDetails:a,stats:i});e.playlistParsingError=null}if(!e.fragments.length){let s=e.playlistParsingError=Error("No Segments found in Playlist");n.trigger(tV.ERROR,{type:t$.NETWORK_ERROR,details:tH.LEVEL_EMPTY_ERROR,fatal:!1,url:m,error:s,reason:s.message,response:t,context:r,level:g,parent:f,networkDetails:a,stats:i});return}switch(e.live&&s&&(s.getCacheAge&&(e.ageHeader=s.getCacheAge()||0),(!s.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),o){case tG:case tW:if(g)if(d){if(d!==n.levels[g]){let e=n.levels.indexOf(d);e>-1&&(g=e)}}else g=0;n.trigger(tV.LEVEL_LOADED,{details:e,levelInfo:d||n.levels[0],level:g||0,id:u||0,stats:i,networkDetails:a,deliveryDirectives:c,withoutMultiVariant:o===tG});break;case tK:n.trigger(tV.AUDIO_TRACK_LOADED,{details:e,track:d,id:u||0,groupId:h||"",stats:i,networkDetails:a,deliveryDirectives:c});break;case tq:n.trigger(tV.SUBTITLE_TRACK_LOADED,{details:e,track:d,id:u||0,groupId:h||"",stats:i,networkDetails:a,deliveryDirectives:c})}}}class lu{static get version(){return a4}static isMSESupported(){return lr()}static isSupported(){if(!lr())return!1;let e=t9();
29return"function"==typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(t=>e.isTypeSupported(iF(t,"video")))||["mp4a.40.2","fLaC"].some(t=>e.isTypeSupported(iF(t,"audio"))))}static getMediaSource(){return t9()}static get Events(){return tV}static get MetadataSchema(){return su}static get ErrorTypes(){return t$}static get ErrorDetails(){return tH}static get DefaultConfig(){return lu.defaultConfig?lu.defaultConfig:o0}static set DefaultConfig(e){lu.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 a3,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=function(e,t,i){let r=t4();if("object"==typeof console&&!0===e||"object"==typeof e){let a=["debug","log","info","warn","error"];a.forEach(t=>{r[t]=t5(t,e,i)});try{r.log(`Debug logs enabled for "${t}" in hls.js version 1.6.15`)}catch(e){return t4()}a.forEach(t=>{t8[t]=t5(t,e)})}else tZ(t8,r);return r}(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=function(e,t,i){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');let r=function e(t){return t&&"object"==typeof t?Array.isArray(t)?t.map(e):Object.keys(t).reduce((i,r)=>(i[r]=e(t[r]),i),{}):t}(e),a=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(e=>{let s=`${"level"===e?"playlist":e}LoadPolicy`,n=void 0===t[s],o=[];a.forEach(i=>{let a=`${e}Loading${i}`,l=t[a];if(void 0!==l&&n){o.push(a);let e=r[s].default;switch(t[s]={default:e},i){case"TimeOut":e.maxLoadTimeMs=l,e.maxTimeToFirstByteMs=l;break;case"MaxRetry":e.errorRetry.maxNumRetry=l,e.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":e.errorRetry.retryDelayMs=l,e.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":e.errorRetry.maxRetryDelayMs=l,e.timeoutRetry.maxRetryDelayMs=l}}}),o.length&&i.warn(`hls.js config: "${o.join('", "')}" setting(s) are deprecated, use "${s}": ${i5(t[s])}`)}),t0(t0({},r),t)}(lu.DefaultConfig,e,t);this.userConfig=e,i.progressive&&function(e,t){let i=e.loader;i!==oz&&i!==oJ?(t.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1}()&&(e.loader=oz,e.progressive=!0,e.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}(i,t);const{abrController:r,bufferController:a,capLevelController:s,errorController:n,fpsController:o}=i,l=new n(this),d=this.abrController=new r(this),u=new rb(this),h=i.interstitialsController,c=h?this.interstitialsController=new h(this,lu):null,m=this.bufferController=new a(this,u),f=this.capLevelController=new s(this),g=new o(this),v=new ld(this),y=i.contentSteeringController,E=y?new y(this):null,b=this.levelController=new le(this,E),T=new o6(this),A=new ls(this.config,this.logger),_=this.streamController=new la(this,u,A),S=this.gapController=new o1(this,u);f.setStreamController(_),g.setStreamController(_);const k=[v,b,_];c&&k.splice(1,0,c),E&&k.splice(1,0,E),this.networkControllers=k;const L=[d,m,S,f,g,T,u];this.audioTrackController=this.createController(i.audioTrackController,k);const w=i.audioStreamController;w&&k.push(this.audioStreamController=new w(this,u,A)),this.subtitleTrackController=this.createController(i.subtitleTrackController,k);const R=i.subtitleStreamController;R&&k.push(this.subtititleStreamController=new R(this,u,A)),this.createController(i.timelineController,L),A.emeController=this.emeController=this.createController(i.emeController,L),this.cmcdController=this.createController(i.cmcdController,L),this.latencyController=this.createController(o7,L),this.coreComponents=L,k.push(l);const I=l.onErrorOut;"function"==typeof I&&this.on(tV.ERROR,I,l),this.on(tV.MANIFEST_LOADED,v.onManifestLoaded,v)}createController(e,t){if(e){let i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,r){this._emitter.off(e,t,i,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}
29trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;let i=e===tV.ERROR;this.trigger(tV.ERROR,{type:t$.OTHER_ERROR,details:tH.INTERNAL_EXCEPTION,fatal:i,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(tV.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(e=>e.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(e=>e.destroy()),this.coreComponents.length=0;let e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){let t=Error(`attachMedia failed: invalid argument (${e})`);this.trigger(tV.ERROR,{type:t$.OTHER_ERROR,details:tH.ATTACH_MEDIA_ERROR,fatal:!0,error:t});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());let t="media"in e,i=t?e.media:e,r=t?e:{media:i};this._media=i,this.trigger(tV.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log("detachMedia"),this.trigger(tV.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;let e=this.bufferController.transferMedia();return this.trigger(tV.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();let t=this.media,i=this._url,r=this._url=ir.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${r}`),t&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(tV.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 i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(e,t),this.started&&this.networkControllers);i++);}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(){let e={[tj]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[tY]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[tz]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");let e=this._media,t=null==e?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=function(){try{return crypto.randomUUID()}catch(e){try{let e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(t){let e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let i=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?i:3&i|8).toString(16)})}}}()),e}get levels(){return this.levelController.levels||[]}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(){let e=this.levelController.startLevel;return -1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){let t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){let{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){let{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){let{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){iJ.indexOf(e)>-1&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return -1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){let{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;let i=e.length;for(let r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){let e,{levels:t,autoLevelCapping:i,maxHdcpLevel:r}=this;if(e=-1===i&&null!=t&&t.length?t.length-1:i,r)for(let i=e;i--;){let e=t[i].attrs["HDCP-LEVEL"];if(e&&e<=r)return i}return e}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return(null==(t=this.audioTrackController)?void 0:t.setAudioOption(e))||null}
29setSubtitleOption(e){var t;return(null==(t=this.subtitleTrackController)?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){let e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){let e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){let e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){let t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){let e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){let e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){let e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){let t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){let e=this.subtitleTrackController;return!!e&&e.subtitleDisplay}set subtitleDisplay(e){let t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}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!!(null!=(e=this.bufferController)&&e.bufferedToEnd)}get interstitialsManager(){var e;return(null==(e=this.interstitialsController)?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){return iQ(e,i9(t),navigator.mediaCapabilities)}}lu.defaultConfig=void 0;var lh="video",lc=e=>e===lh?"playback":e,lm=class e extends Error{constructor(t,i=e.MEDIA_ERR_CUSTOM,r,a){var s;super(t),this.name="MediaError",this.code=i,this.context=a,this.fatal=null!=r?r:i>=e.MEDIA_ERR_NETWORK&&i<=e.MEDIA_ERR_ENCRYPTED,this.message||(this.message=null!=(s=e.defaultMessages[this.code])?s:"")}};lm.MEDIA_ERR_ABORTED=1,lm.MEDIA_ERR_NETWORK=2,lm.MEDIA_ERR_DECODE=3,lm.MEDIA_ERR_SRC_NOT_SUPPORTED=4,lm.MEDIA_ERR_ENCRYPTED=5,lm.MEDIA_ERR_CUSTOM=100,lm.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 lf=(e,t)=>null!=t&&e in t,lp={ANY:"any",MUTED:"muted"},lg="on-demand",lv="live",ly="unknown",lE="native",lb={HEADER:"header",QUERY:"query",NONE:"none"},lT=Object.values(lb),lA={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},l_={HLS:lA.M3U8};Object.keys(l_),[...Object.values(lA)];var lS={code:"en"},lk=(e,t,i,r,a=e)=>{a.addEventListener(t,i,r),e.addEventListener("teardown",()=>{a.removeEventListener(t,i)},{once:!0})},lL=e=>{let t=e.indexOf("?");return t<0?[e]:[e.slice(0,t),e.slice(t)]},lw=e=>{let{type:t}=e;if(t){let e=t.toUpperCase();return lf(e,l_)?l_[e]:t}return lC(e)},lR=e=>"VOD"===e?lg:lv,lI=e=>"EVENT"===e?1/0:"VOD"===e?NaN:0,lC=e=>{let{src:t}=e;if(!t)return"";let i="";try{i=new URL(t).pathname}catch{console.error("invalid url")}let r=i.lastIndexOf(".");if(r<0)return lx(e)?lA.M3U8:"";let a=i.slice(r+1).toUpperCase();return lf(a,lA)?lA[a]:""},lD="mux.com",lx=({src:e,customDomain:t=lD})=>{let i;try{i=new URL(`${e}`)}catch{return!1}let r="https:"===i.protocol,a=i.hostname===`stream.${t}`.toLowerCase(),s=i.pathname.split("/"),n=2===s.length,o=!(null!=s&&s[1].includes("."));return r&&a&&n&&o},lP=e=>{let t=(null!=e?e:"").split(".")[1];if(t)try{let e=t.replace(/-/g,"+").replace(/_/g,"/"),i=decodeURIComponent(atob(e).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(i)}catch{return}};function lM(e,t=!0){var i;return new lO(t&&null!=(i=null==lS?void 0:lS[e])?i:e,t?lS.code:"en")}
29var lO=class{constructor(e,t=(e=>null!=(e=lS)?e:"en")()){this.message=e,this.locale=t}format(e){return this.message.replace(/\{(\w+)\}/g,(t,i)=>{var r;return null!=(r=e[i])?r:""})}toString(){return this.message}},lN=Object.values(lp),lU=e=>"boolean"==typeof e||"string"==typeof e&&lN.includes(e),lF=(e,t)=>{if(!t)return;let i=e.muted,r=()=>e.muted=i;switch(t){case lp.ANY:e.play().catch(()=>{e.muted=!0,e.play().catch(r)});break;case lp.MUTED:e.muted=!0,e.play().catch(r);break;default:e.play().catch(()=>{})}},lB=e=>"time"in e?e.time:e.startTime;function l$(e,t,i,r,a,s){let n=document.createElement("track");return n.kind=t,n.label=i,r&&(n.srclang=r),a&&(n.id=a),s&&(n.default=!0),n.track.mode=["subtitles","captions"].includes(t)?"disabled":"hidden",n.setAttribute("data-removeondestroy",""),e.append(n),n.track}function lH(e,t,i){var r;return null==(r=Array.from(e.querySelectorAll("track")).find(e=>e.track.label===t&&e.track.kind===i))?void 0:r.track}async function lV(e,t,i,r){let a=lH(e,i,r);return a||((a=l$(e,r,i)).mode="hidden",await new Promise(e=>setTimeout(()=>e(void 0),0))),"hidden"!==a.mode&&(a.mode="hidden"),[...t].sort((e,t)=>lB(t)-lB(e)).forEach(t=>{var i,s;let n=t.value,o=lB(t);if("endTime"in t&&null!=t.endTime)null==a||a.addCue(new VTTCue(o,t.endTime,"chapters"===r?n:JSON.stringify(null!=n?n:null)));else{let t=Array.prototype.findIndex.call(null==a?void 0:a.cues,e=>e.startTime>=o),l=null==(i=null==a?void 0:a.cues)?void 0:i[t],d=l?l.startTime:Number.isFinite(e.duration)?e.duration:Number.MAX_SAFE_INTEGER,u=null==(s=null==a?void 0:a.cues)?void 0:s[t-1];u&&(u.endTime=o),null==a||a.addCue(new VTTCue(o,d,"chapters"===r?n:JSON.stringify(null!=n?n:null)))}}),e.textTracks.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),a}var lG="cuepoints",lW=Object.freeze({label:lG});async function lK(e,t,i=lW){return lV(e,t,i.label,"metadata")}var lq=e=>({time:e.startTime,value:JSON.parse(e.text)});function lj(e,t={label:lG}){var i,r;let a=lH(e,t.label,"metadata");if(!(null!=(i=null==a?void 0:a.activeCues)&&i.length))return;if(1===a.activeCues.length)return lq(a.activeCues[0]);let{currentTime:s}=e;return lq(Array.prototype.find.call(null!=(r=a.activeCues)?r:[],({startTime:e,endTime:t})=>e<=s&&t>s)||a.activeCues[0])}async function lY(e,t=lW){return new Promise(i=>{lk(e,"loadstart",async()=>{let r=await lK(e,[],t);lk(e,"cuechange",()=>{let t=lj(e);if(t){let i=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:t});e.dispatchEvent(i)}},{},r),i(r)})})}var lz="chapters",lX=Object.freeze({label:lz}),lQ=e=>({startTime:e.startTime,endTime:e.endTime,value:e.text});async function lZ(e,t,i=lX){return lV(e,t,i.label,"chapters")}function lJ(e,t={label:lz}){var i,r;let a=lH(e,t.label,"chapters");if(!(null!=(i=null==a?void 0:a.activeCues)&&i.length))return;if(1===a.activeCues.length)return lQ(a.activeCues[0]);let{currentTime:s}=e;return lQ(Array.prototype.find.call(null!=(r=a.activeCues)?r:[],({startTime:e,endTime:t})=>e<=s&&t>s)||a.activeCues[0])}async function l0(e,t=lX){return new Promise(i=>{lk(e,"loadstart",async()=>{let r=await lZ(e,[],t);lk(e,"cuechange",()=>{let t=lJ(e);if(t){let i=new CustomEvent("chapterchange",{composed:!0,bubbles:!0,detail:t});e.dispatchEvent(i)}},{},r),i(r)})})}var l1=(e,t,i,r,a=!1,s=!(e=>null==(e=globalThis.navigator)?void 0:e.onLine)())=>{var n,o,l,d;let u,h;if(s){let i=lM("Your device appears to be offline",a),r=lm.MEDIA_ERR_NETWORK,s=new lm(i,r,!1,void 0);return s.errorCategory=t,s.muxCode=2000002,s.data=e,s}let c="status"in e?e.status:e.code,m=Date.now(),f=lm.MEDIA_ERR_NETWORK;if(200===c)return;let g=lc(t),v=(u=lc(t),h=`${u}Token`,null!=(l=i.tokens)&&l[u]?null==(d=i.tokens)?void 0:d[u]:lf(h,i)?i[h]:void 0),y=t===lh?"v":"drm"===t?"d":void 0,[E]=lL(null!=(n=i.playbackId)?n:"");if(!c||!E)return;let b=lP(v);if(v&&!b){let i=new lm(lM("The {tokenNamePrefix}-token provided is invalid or malformed.",a).format({tokenNamePrefix:g}),f,!0,lM("Compact JWT string: {token}",a).format({token:v}));return i.errorCategory=t,i.muxCode=2412202,i.data=e,i}if(c>=500){let e=new lm("",f,null==r||r);return e.errorCategory=t,e.muxCode=2e6,e}if(403===c)if(b){if((({exp:e},t=Date.now())=>!e||1e3*e<t)(b,m)){let i={timeStyle:"medium",dateStyle:"medium"},r=new lm(lM("The videoâs secured {tokenNamePrefix}-token has expired.",a).format({tokenNamePrefix:g}),f,!0,lM("Expired at: {expiredDate}. Current time: {currentDate}.",a).format({expiredDate:new Intl.DateTimeFormat("en",i).format(null!=(o=b.exp)?o:0),currentDate:new Intl.DateTimeFormat("en",i).format(m)}));return r.errorCategory=t,r.muxCode=2403210,r.data=e,r}if((({sub:e},t)=>e!==t)(b,E)){let i=new lm(lM("The videoâs playback ID does not match the one encoded in the {tokenNamePrefix}-token.",a).format({tokenNamePrefix:g}),f,!0,lM("Specified playback ID: {playbackId} and the playback ID encoded in the {tokenNamePrefix}-token: {tokenPlaybackId}",a).format({tokenNamePrefix:g,playbackId:E,tokenPlaybackId:b.sub}));return i.errorCategory=t,i.muxCode=2403232,i.data=e,i}if((({aud:e},t)=>!e)(b,0)){let i=new lm(lM("The {tokenNamePrefix}-token is formatted with incorrect information.",a).format({tokenNamePrefix:g}),f,!0,lM("The {tokenNamePrefix}-token has no aud value. aud value should be {expectedAud}.",a).format({tokenNamePrefix:g,expectedAud:y}));return i.errorCategory=t,i.muxCode=2403221,i.data=e,i}if((({aud:e},t)=>e!==t)(b,y)){let i=new lm(lM("The {tokenNamePrefix}-token is formatted with incorrect information.",a).format({tokenNamePrefix:g}),f,!0,lM("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.",a).format({tokenNamePrefix:g,expectedAud:y,aud:b.aud}));return i.errorCategory=t,i.muxCode=2403222,i.data=e,i}}else{let i=new lm(lM("Authorization error trying to access this {category} URL. If this is a signed URL, you might need to provide a {tokenNamePrefix}-token.",a).format({tokenNamePrefix:g,category:t}),f,null==r||r,lM("Specified playback ID: {playbackId}",a).format({playbackId:E}));return i.errorCategory=t,i.muxCode=2403201,i.data=e,i}if(412===c){let s=new lm(lM("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",a),f,null==r||r,lM("Specified playback ID: {playbackId}",a).format({playbackId:E}));return s.errorCategory=t,s.muxCode=2412e3,s.streamType=i.streamType===lv?"live":i.streamType===lg?"on-demand":"unknown",s.data=e,s}if(404===c){let i=new lm(lM("This URL or playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",a),f,null==r||r,lM("Specified playback ID: {playbackId}",a).format({playbackId:E}));return i.errorCategory=t,i.muxCode=2404e3,i.data=e,i}
29if(400===c){let i=new lm(lM("The URL or playback-id was invalid. You may have used an invalid value as a playback-id."),f,null==r||r,lM("Specified playback ID: {playbackId}",a).format({playbackId:E}));return i.errorCategory=t,i.muxCode=24e5,i.data=e,i}let T=new lm("",f,null==r||r);return T.errorCategory=t,T.muxCode=2e6,T.data=e,T},l2=lu.DefaultConfig.capLevelController,l3={"720p":921600,"1080p":2073600,"1440p":4194304,"2160p":8294400},l4=class e extends l2{constructor(e){super(e)}static setMaxAutoResolution(t,i){i?e.maxAutoResolution.set(t,i):e.maxAutoResolution.delete(t)}getMaxAutoResolution(){var t;let i=this.hls;return null!=(t=e.maxAutoResolution.get(i))?t:void 0}get levels(){var e;return null!=(e=this.hls.levels)?e:[]}getValidLevels(e){return this.levels.filter((t,i)=>this.isLevelAllowed(t)&&i<=e)}getMaxLevelCapped(e){let t=this.getValidLevels(e),i=this.getMaxAutoResolution();if(!i)return super.getMaxLevel(e);let r=l3[i.toLowerCase().trim()];if(!r)return super.getMaxLevel(e);let a=t.filter(e=>e.width*e.height<=r),s=a.findIndex(e=>e.width*e.height===r);if(-1!==s){let e=a[s];return t.findIndex(t=>t===e)}if(0===a.length)return 0;let n=a[a.length-1];return t.findIndex(e=>e===n)}getMaxLevel(t){if(void 0!==this.getMaxAutoResolution())return this.getMaxLevelCapped(t);let i=super.getMaxLevel(t),r=this.getValidLevels(t);if(!r[i])return i;let a=Math.min(r[i].width,r[i].height),s=e.minMaxResolution;return a>=s?i:l2.getMaxLevelByMediaSize(r,16/9*s,s)}};l4.minMaxResolution=720,l4.maxAutoResolution=new WeakMap;var l5,l8,l9,l6,l7,de,dt,di,dr,da,ds,dn,dl,dd,du,dh,dc,dm,df,dp,dg=e=>new TextDecoder("utf-16le").decode(e).replace("skd://","").slice(1),dv="fairplay",dy=/([A-Z0-9-]+)="?(.*?)"?(?:,|$)/g,dE=async(e,t)=>{if(t===lA.MP4)return{streamType:lg,targetLiveWindow:NaN,liveEdgeStartOffset:void 0,sessionData:void 0};if(t===lA.M3U8){let t=await fetch(e);if(!t.ok)return Promise.reject(t);let i=await t.text(),r=await fetch(i.split(` 30`).find((e,t,i)=>t&&i[t-1].startsWith("#EXT-X-STREAM-INF"))).then(e=>200!==e.status?Promise.reject(e):e.text());return{...(e=>{let t=e.split(` 31`).filter(e=>e.startsWith("#EXT-X-SESSION-DATA"));if(!t.length)return{};let i={};for(let e of t){let t=Object.fromEntries([...e.matchAll(dy)].map(([,e,t])=>[e,t])),r=t["DATA-ID"];r&&(i[r]={...t})}return{sessionData:i}})(i),...(e=>{var t,i,r;let a=e.split(` 32`),s=null==(i=(null!=(t=a.find(e=>e.startsWith("#EXT-X-PLAYLIST-TYPE")))?t:"").split(":")[1])?void 0:i.trim(),n=lR(s),o=lI(s),l;if(n===lv){let e=a.find(e=>e.startsWith("#EXT-X-PART-INF"));if(e)l=2*e.split(":")[1].split("=")[1];else{let e=a.find(e=>e.startsWith("#EXT-X-TARGETDURATION")),t=null==(r=null==e?void 0:e.split(":"))?void 0:r[1];l=(null!=t?t:6)*3}}return{streamType:n,targetLiveWindow:o,liveEdgeStartOffset:l}})(r)}}return console.error(`Media type ${t} is an unrecognized or unsupported type for src ${e}.`),{streamType:void 0,targetLiveWindow:void 0,liveEdgeStartOffset:void 0,sessionData:void 0}},db=async(e,t,i=lw({src:e}))=>{var r,a,s,n;let{streamType:o,targetLiveWindow:l,liveEdgeStartOffset:d,sessionData:u}=await dE(e,i),h=null==u?void 0:u["com.apple.hls.chapters"];(null!=h&&h.URI||null!=h&&h.VALUE.toLocaleLowerCase().startsWith("http"))&&dT(null!=(r=h.URI)?r:h.VALUE,t),(null!=(a=dk.get(t))?a:{}).liveEdgeStartOffset=d,(null!=(s=dk.get(t))?s:{}).targetLiveWindow=l,t.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),(null!=(n=dk.get(t))?n:{}).streamType=o,t.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},dT=async(e,t)=>{var i,r;try{let a=await fetch(e);if(!a.ok)throw Error(`Failed to fetch Mux metadata: ${a.status} ${a.statusText}`);let s=await a.json(),n={};if(!(null!=(i=null==s?void 0:s[0])&&i.metadata))return;for(let e of s[0].metadata)e.key&&e.value&&(n[e.key]=e.value);(null!=(r=dk.get(t))?r:{}).metadata=n;let o=new CustomEvent("muxmetadata");t.dispatchEvent(o)}catch(e){console.error(e)}},dA=null!=(dh=null==(du=null==globalThis?void 0:globalThis.navigator)?void 0:du.userAgent)?dh:"",d_=null!=(df=null==(dm=null==(dc=null==globalThis?void 0:globalThis.navigator)?void 0:dc.userAgentData)?void 0:dm.platform)?df:"",dS=dA.toLowerCase().includes("android")||["x11","android"].some(e=>d_.toLowerCase().includes(e)),dk=new WeakMap,dL="mux.com",dw=null==(dp=lu.isSupported)?void 0:dp.call(lu),dR=()=>
32{if("u">typeof window)return tO.utils.now()},dI=tO.utils.generateUUID,dC=({playbackId:e,customDomain:t=dL,maxResolution:i,minResolution:r,renditionOrder:a,programStartTime:s,programEndTime:n,assetStartTime:o,assetEndTime:l,playbackToken:d,tokens:{playback:u=d}={},extraSourceParams:h={}}={})=>{if(!e)return;let[c,m=""]=lL(e),f=new URL(`https://stream.${t}/${c}.m3u8${m}`);return u||f.searchParams.has("token")?(f.searchParams.forEach((e,t)=>{"token"!=t&&f.searchParams.delete(t)}),u&&f.searchParams.set("token",u)):(i&&f.searchParams.set("max_resolution",i),r&&(f.searchParams.set("min_resolution",r),i&&+i.slice(0,-1)<+r.slice(0,-1)&&console.error("minResolution must be <= maxResolution","minResolution",r,"maxResolution",i)),a&&f.searchParams.set("rendition_order",a),s&&f.searchParams.set("program_start_time",`${s}`),n&&f.searchParams.set("program_end_time",`${n}`),o&&f.searchParams.set("asset_start_time",`${o}`),l&&f.searchParams.set("asset_end_time",`${l}`),Object.entries(h).forEach(([e,t])=>{null!=t&&f.searchParams.set(e,t)})),f.toString()},dD=e=>{if(!e)return;let[t]=e.split("?");return t||void 0},dx=e=>{if(!e||!e.startsWith("https://stream."))return;let[t]=new URL(e).pathname.slice(1).split(/\.m3u8|\//);return t||void 0},dP=e=>{var t;return null==(t=dk.get(e))?void 0:t.error},dM=e=>{var t,i;return null!=(i=null==(t=dk.get(e))?void 0:t.streamType)?i:ly},dO=e=>{var t,i;return null!=(i=null==(t=dk.get(e))?void 0:t.seekable)?i:e.seekable},dN=.034,dU=(e,t,i=dN)=>e>t||((e,t,i=dN)=>Math.abs(e-t)<=i)(e,t,i),dF=(e,t)=>{var i,r,a;if(!t||!e.buffered.length)return;if(e.readyState>2)return!1;let s=t.currentLevel>=0?null==(r=null==(i=t.levels)?void 0:i[t.currentLevel])?void 0:r.details:null==(a=t.levels.find(e=>!!e.details))?void 0:a.details;if(!s||s.live)return;let{fragments:n}=s;if(!(null!=n&&n.length))return;if(e.currentTime<e.duration-(s.targetduration+.5))return!1;let o=n[n.length-1];if(e.currentTime<=o.start)return!1;let l=o.start+o.duration/2,d=e.buffered.start(e.buffered.length-1),u=e.buffered.end(e.buffered.length-1);return l>d&&l<u},dB=(e,t)=>e.ended||e.loop?e.ended:!!(t&&dF(e,t))||((e,t=dN)=>e.paused&&dU(e.currentTime,e.duration,t))(e),d$=(e,t,i)=>{var r,a,s;dH(t,i,e);let{metadata:n={}}=e,{view_session_id:o=dI()}=n,l=null!=(r=null==e?void 0:e.metadata)&&r.video_id?e.metadata.video_id:dX(e)&&null!=(s=null!=(a=dD(e.playbackId))?a:dx(e.src))?s:e.src;n.view_session_id=o,n.video_id=l,e.metadata=n,e.drmTypeCb=e=>{var i;null==(i=t.mux)||i.emit("hb",{view_drm_type:e})},e.fallbackToWebkitFairplay=async()=>{var i;let r=!t.paused,a=t.currentTime;e.useWebkitFairplay=!0;let s=e.muxDataKeepSession;e.muxDataKeepSession=!0;let n=null==(i=dk.get(t))?void 0:i.coreReference;d$(e,t,n),e.muxDataKeepSession=s,e.useWebkitFairplay=!1,r&&await t.play().then(()=>{t.currentTime=a}).catch(()=>{}),t.currentTime=a},dk.set(t,{retryCount:0});let d=dG(e,t),u=(({preload:e,src:t},i,r)=>{let a=e=>{null!=e&&["","none","metadata","auto"].includes(e)?i.setAttribute("preload",e):i.removeAttribute("preload")};if(!r)return a(e),a;let s=!1,n=!1,o=r.config.maxBufferLength,l=r.config.maxBufferSize,d=e=>{a(e);let t=null!=e?e:i.preload;n||"none"===t||("metadata"===t?(r.config.maxBufferLength=1,r.config.maxBufferSize=1):(r.config.maxBufferLength=o,r.config.maxBufferSize=l),u())},u=()=>{!s&&t&&(s=!0,r.loadSource(t))};return lk(i,"play",()=>{n=!0,r.config.maxBufferLength=o,r.config.maxBufferSize=l,u()},{once:!0}),d(e),d})(e,t,d);null!=e&&e.muxDataKeepSession&&null!=t&&t.mux&&!t.mux.deleted?d&&t.mux.addHLSJS({hlsjs:d,Hls:d?lu:void 0}):dZ(e,t,d),dJ(e,t,d),lY(t),l0(t);let h=((e,t,i)=>{let{autoplay:r}=e,a=!1,s=!1,n=lU(r)?r:!!r,o=()=>{a||lk(t,"playing",()=>{a=!0},{once:!0})};if(o(),lk(t,"loadstart",()=>{a=!1,o(),lF(t,n)},{once:!0}),lk(t,"loadstart",()=>{i||(s=e.streamType&&e.streamType!==ly?e.streamType===lv:!Number.isFinite(t.duration)),lF(t,n)},{once:!0}),i&&i.once(lu.Events.LEVEL_LOADED,(t,i)=>{var r;s=e.streamType&&e.streamType!==ly?e.streamType===lv:null!=(r=i.details.live)&&r}),!n){let r=()=>{!s||Number.isFinite(e.startTime)||(null!=i&&i.liveSyncPosition?t.currentTime=i.liveSyncPosition:Number.isFinite(t.seekable.end(0))&&(t.currentTime=t.
32seekable.end(0)))};i&&lk(t,"play",()=>{"metadata"===t.preload?i.once(lu.Events.LEVEL_UPDATED,r):r()},{once:!0})}return e=>{a||lF(t,n=lU(e)?e:!!e)}})(e,t,d),c={engine:d,setAutoplay:h,setPreload:u},m=dk.get(t);return m&&(m.coreReference=c),c},dH=(e,t,i)=>{let r=null==t?void 0:t.engine;null!=e&&e.mux&&!e.mux.deleted&&(null!=i&&i.muxDataKeepSession?r&&e.mux.removeHLSJS():(e.mux.destroy(),delete e.mux)),r&&(r.detachMedia(),r.destroy()),e&&(e.hasAttribute("src")&&(e.removeAttribute("src"),e.load()),e.removeEventListener("error",d1),e.removeEventListener("error",d3),e.removeEventListener("durationchange",d0),dk.delete(e),e.dispatchEvent(new Event("teardown")))};function dV(e,t){var i;let r=lw(e);if(r!==lA.M3U8)return!0;let a=!r||null==(i=t.canPlayType(r))||i,{preferPlayback:s}=e,n=dw&&("mse"===s||dS||!(/^((?!chrome|android).)*safari/i.test(dA)&&t.canPlayType("application/vnd.apple.mpegurl")));return a&&(s===lE||!n)}var dG=(e,t)=>{let{debug:i,streamType:r,startTime:a=-1,metadata:s,preferCmcd:n,_hlsConfig:o={},maxAutoResolution:l}=e,d=lw(e)===lA.M3U8,u=dV(e,t);if(d&&!u&&dw){let d=dW(r),u=dK(e),h=[lb.QUERY,lb.HEADER].includes(n)?{useHeaders:n===lb.HEADER,sessionId:null==s?void 0:s.view_session_id,contentId:null==s?void 0:s.video_id}:void 0,c=dQ(e,o),m=new lu({debug:i,startPosition:a,cmcd:h,xhrSetup:(e,t)=>{var i,r;if(n&&n!==lb.QUERY)return;let a=new URL(t);if(!a.searchParams.has("CMCD"))return;let s=(null!=(r=null==(i=a.searchParams.get("CMCD"))?void 0:i.split(","))?r:[]).filter(e=>e.startsWith("sid")||e.startsWith("cid")).join(",");a.searchParams.set("CMCD",s),e.open("GET",a)},backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelOnFPSDrop:!0,...c,...d,...u,...o});return c.capLevelController===l4&&void 0!==l&&l4.setMaxAutoResolution(m,l),m.on(lu.Events.MANIFEST_PARSED,async function(e,i){var r,a;let s=null==(r=i.sessionData)?void 0:r["com.apple.hls.chapters"];(null!=s&&s.URI||null!=s&&s.VALUE.toLocaleLowerCase().startsWith("http"))&&dT(null!=(a=null==s?void 0:s.URI)?a:null==s?void 0:s.VALUE,t)}),m}},dW=e=>e===lv?{backBufferLength:8}:{},dK=e=>{let{tokens:{drm:t}={},playbackId:i,drmTypeCb:r}=e,a=dD(i);return t&&a?{emeEnabled:!0,drmSystems:{"com.apple.fps":{licenseUrl:dY(e,"fairplay"),serverCertificateUrl:dz(e,"fairplay")},"com.widevine.alpha":{licenseUrl:dY(e,"widevine")},"com.microsoft.playready":{licenseUrl:dY(e,"playready")}},requestMediaKeySystemAccessFunc:(e,t)=>("com.widevine.alpha"===e&&(t=[...t.map(e=>{var t;let i=null==(t=e.videoCapabilities)?void 0:t.map(e=>({...e,robustness:"HW_SECURE_ALL"}));return{...e,videoCapabilities:i}}),...t]),navigator.requestMediaKeySystemAccess(e,t).then(t=>{let i=e.includes("fps")?dv:e.includes("playready")?"playready":e.includes("widevine")?"widevine":void 0;return null==r||r(i),t}))}:{}},dq=async e=>{let t=await fetch(e);return 200!==t.status?Promise.reject(t):await t.arrayBuffer()},dj=async(e,t)=>{let i=await fetch(t,{method:"POST",headers:{"Content-type":"application/octet-stream"},body:e});return 200!==i.status?Promise.reject(i):new Uint8Array(await i.arrayBuffer())},dY=({playbackId:e,tokens:{drm:t}={},customDomain:i=dL},r)=>{let a=dD(e);return`https://license.${i.toLocaleLowerCase().endsWith(dL)?i:dL}/license/${r}/${a}?token=${t}`},dz=({playbackId:e,tokens:{drm:t}={},customDomain:i=dL},r)=>{let a=dD(e);return`https://license.${i.toLocaleLowerCase().endsWith(dL)?i:dL}/appcert/${r}/${a}?token=${t}`},dX=({playbackId:e,src:t,customDomain:i})=>{if(e)return!0;if("string"!=typeof t)return!1;let r=new URL(t,null==window?void 0:window.location.href).hostname.toLocaleLowerCase();return r.includes(dL)||!!i&&r.includes(i.toLocaleLowerCase())},dQ=(e,t)=>{let i={};return i.capLevelToPlayerSize=e.capRenditionToPlayerSize,null==i.capLevelToPlayerSize?(i.capLevelController=l4,i.capLevelToPlayerSize=!0):i.capLevelController=nn,i},dZ=(e,t,i)=>{var r;let{envKey:a,disableTracking:s,muxDataSDK:n=tO,muxDataSDKOptions:o={}}=e,l=dX(e);if(!s&&(a||l)){let{playerInitTime:s,playerSoftwareName:l,playerSoftwareVersion:d,beaconCollectionDomain:u,debug:h,disableCookies:c}=e,m={...e.metadata,video_title:(null==(r=null==e?void 0:e.metadata)?void 0:r.video_title)||void 0};n.monitor(t,{debug:h,beaconCollectionDomain:u,hlsjs:i,Hls:i?lu:void 0,automaticErrorTracking:!1,errorTranslator:t=>"string"!=typeof t.player_error_code&&("function"==typeof e.errorTranslator?e.errorTranslator(t):t),disableCookies:c,...o,data:{...a?{env_key:a}:{},player_software_name:l,player_software:l,player_software_version:d,player_init_time:s,...m}})}},dJ=(e,t,i)=>{var r,a;let s=dV(e,t),{src:n,customDomain:o=dL}=e,l=()=>{t.ended||e.disablePseudoEnded||!dB(t,i)||(dF(t,i)?t.currentTime=t.buffered.end(t.buffered.length-1):t.dispatchEvent(new Event("ended")))},d,u,h=()=>{let e=dO(t),i,r;e.length>0&&(i=e.start(0),r=e.end(0)),(u!==r||d!==i)&&t.dispatchEvent(new CustomEvent("seekablechange",{composed:!0})),d=i,u=r};if(lk(t,"durationchange",h),t&&s){let i=lw(e);if("string"==typeof n){if(n.endsWith(".mp4")&&n.includes(o)){let e=dx(n);dT(new URL(`https://stream.${o}/${e}/metadata.json`).toString(),t)}let s=()=>
32{if(dM(t)!==lv||Number.isFinite(t.duration))return;let e=setInterval(h,1e3);t.addEventListener("teardown",()=>{clearInterval(e)},{once:!0}),lk(t,"durationchange",()=>{Number.isFinite(t.duration)&&clearInterval(e)})},l=async()=>db(n,t,i).then(s).catch(i=>{if(i instanceof Response){let r=l1(i,lh,e);if(r)return void d2(t,r)}});if("none"===t.preload){let e=()=>{l(),t.removeEventListener("loadedmetadata",i)},i=()=>{l(),t.removeEventListener("play",e)};lk(t,"play",e,{once:!0}),lk(t,"loadedmetadata",i,{once:!0})}else l();null!=(r=e.tokens)&&r.drm?((e,t)=>{let i={mediaEl:t,getAppCertificate:()=>dq(dz(e,"fairplay")).catch(t=>{if(t instanceof Response){let i=l1(t,"drm",e);return console.error("mediaError",null==i?void 0:i.message,null==i?void 0:i.context),i?Promise.reject(i):Promise.reject(Error("Unexpected error in app cert request"))}return Promise.reject(t)}),getLicenseKey:t=>dj(t,dY(e,"fairplay")).catch(t=>{if(t instanceof Response){let i=l1(t,"drm",e);return console.error("mediaError",null==i?void 0:i.message,null==i?void 0:i.context),i?Promise.reject(i):Promise.reject(Error("Unexpected error in license key request"))}return Promise.reject(t)}),saveAndDispatchError:d2,drmTypeCb:()=>{var t;null==(t=e.drmTypeCb)||t.call(e,dv)}};if(e.useWebkitFairplay)(({mediaEl:e,getAppCertificate:t,getLicenseKey:i,saveAndDispatchError:r,drmTypeCb:a})=>{if(!window.WebKitMediaKeys||!("onwebkitneedkey"in e)){console.error("No WebKitMediaKeys. FairPlay may not be supported");let t=new lm(lM("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),lm.MEDIA_ERR_ENCRYPTED,!0);return t.errorCategory="drm",t.muxCode=5000005,r(e,t),()=>{}}let s=t(),n=null,o=t=>{(async()=>{try{var i,a;let r,n,o,u,h,c,m,f;e.webkitKeys||l();let g=await s;if(null===t.initData||null==g)return;let v=(i=t.initData,a=g,r=function(e){let t=new ArrayBuffer(2*e.length),i=new DataView(t);for(let t=0;t<e.length;t++)i.setUint16(2*t,e.charCodeAt(t),!0);return t}(dg(i)),n=new Uint8Array(i),o=new Uint8Array(r),u=new Uint8Array(a),h=new Uint8Array(n.byteLength+4+u.byteLength+4+o.byteLength),c=0,m=e=>{h.set(e,c),c+=e.byteLength},f=e=>{let t=new DataView(h.buffer),i=e.byteLength;t.setUint32(c,i,!0),c+=4,m(e)},m(n),f(o),f(u),h);d(v)}catch(t){console.error("Could not start encrypted playback due to exception",t),r(e,t)}})()},l=()=>{try{let t=new WebKitMediaKeys("com.apple.fps.1_0");e.webkitSetMediaKeys(t),a()}catch{let e=new lm("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser.",lm.MEDIA_ERR_ENCRYPTED,!0);throw e.errorCategory="drm",e.muxCode=5000001,e}},d=t=>{let a=e.webkitKeys.createSession("application/vnd.apple.mpegurl",t),s=async t=>{try{let e=t.message,r=await i(e);a.update(r)}catch(t){console.error("Error on FairPlay session message",t),r(e,t)}},o=t=>{let i=t.target.error;if(!i)return;console.error(`Internal Webkit Key Session Error - sysCode: ${i.systemCode} code: ${i.code}`);let a=new lm(lM("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser."),lm.MEDIA_ERR_ENCRYPTED,!0);a.errorCategory="drm",a.muxCode=5000005,r(e,a)},l=()=>{a.removeEventListener("webkitkeymessage",s),a.removeEventListener("webkitkeyerror",o),e.removeEventListener("teardown",l),"webkitCurrentPlaybackTargetIsWireless"in e&&e.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged",l),n=null;try{a.close()}catch{}};"webkitCurrentPlaybackTargetIsWireless"in e&&e.addEventListener("webkitcurrentplaybacktargetiswirelesschanged",l,{once:!0}),a.addEventListener("webkitkeymessage",s),a.addEventListener("webkitkeyerror",o),e.addEventListener("teardown",l),n=l},u=()=>{e.removeEventListener("webkitneedkey",o),e.removeEventListener("teardown",u),null==n||n();try{e.webkitSetMediaKeys(null)}catch{}};return e.addEventListener("webkitneedkey",o),e.addEventListener("teardown",u,{once:!0})})(i);else{let t=(({mediaEl:e,getAppCertificate:t,getLicenseKey:i,saveAndDispatchError:r,drmTypeCb:a,fallbackToWebkitFairplay:s})=>{let n=null,o=async t=>{try{let i=t.initDataType;if("skd"!==i)return void console.error(`Received unexpected initialization data type "${i}"`);e.mediaKeys||await l(i);let r=t.initData;if(null==r)return void console.error(`Could not start encrypted playback due to missing initData in ${t.type} event`);await d(i,r)}catch(t){r(e,t);return}},l=async i=>{let s=await navigator.requestMediaKeySystemAccess("com.apple.fps",[{initDataTypes:[i],videoCapabilities:[{contentType:"application/vnd.apple.mpegurl",robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:"not-allowed",sessionTypes:["temporary"]}]).then(e=>(a(),e)).catch(()=>{let t=new lm(lM("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),lm.MEDIA_ERR_ENCRYPTED,!0);t.errorCategory="drm",t.muxCode=5000001,r(e,t)});if(!s)return;let n=await s.createMediaKeys();try{let e=await t();await n.setServerCertificate(e).catch(()=>{let e=lM("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate."),t=new lm(e,lm.MEDIA_ERR_ENCRYPTED,!0);return t.errorCategory="drm",t.muxCode=5000004,Promise.reject(t)})}catch(t){r(e,t);return}await e.setMediaKeys(n)},d=async(t,a)=>{let o=e.mediaKeys.createSession(),l=async t=>{let a=t.message,s=await i(a);try{await o.update(s)}catch{let t=new lm(lM("Failed to update DRM license. This may be an issue with the player or your protected content."),lm.MEDIA_ERR_ENCRYPTED,!0);t.errorCategory="drm",t.muxCode=5000003,r(e,t)}},d=()=>
32{o.keyStatuses.forEach(t=>{let i;"internal-error"===t?((i=new lm(lM("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser."),lm.MEDIA_ERR_ENCRYPTED,!0)).errorCategory="drm",i.muxCode=5000005):("output-restricted"===t||"output-downscaled"===t)&&((i=new lm(lM("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen."),lm.MEDIA_ERR_ENCRYPTED,!1)).errorCategory="drm",i.muxCode=5000006),i&&r(e,i)})};o.addEventListener("keystatuseschange",d),o.addEventListener("message",l);let u=async()=>{o.removeEventListener("keystatuseschange",d),o.removeEventListener("message",l),"webkitCurrentPlaybackTargetIsWireless"in e&&e.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged",u),e.removeEventListener("teardown",u),await o.close().catch(e=>{console.warn("There was an error when closing EME session",e)}),n=null};"webkitCurrentPlaybackTargetIsWireless"in e&&e.addEventListener("webkitcurrentplaybacktargetiswirelesschanged",u,{once:!0}),e.addEventListener("teardown",u,{once:!0}),n=u,await o.generateRequest(t,a).catch(async t=>{if("NotSupportedError"===t.name&&"webkitCurrentPlaybackTargetIsWireless"in e&&e.webkitCurrentPlaybackTargetIsWireless)console.warn("Failed to generate a DRM license request. Attempting to fallback to Webkit DRM"),null==s||s();else{let e=new lm(lM("Failed to generate a DRM license request. This may be an issue with the player or your protected content."),lm.MEDIA_ERR_ENCRYPTED,!0);return e.errorCategory="drm",e.muxCode=5000002,console.error("Failed to generate license request",t),Promise.reject(e)}})},u=async()=>{e.removeEventListener("encrypted",o),e.removeEventListener("teardown",u),n&&await n(),await e.setMediaKeys(null).catch(()=>{})};return e.addEventListener("encrypted",o),e.addEventListener("teardown",u,{once:!0}),u})({fallbackToWebkitFairplay:async()=>{var i;await t(),null==(i=e.fallbackToWebkitFairplay)||i.call(e)},...i})}})(e,t):lk(t,"encrypted",()=>{let e=new lm(lM("Attempting to play DRM-protected content without providing a DRM token."),lm.MEDIA_ERR_ENCRYPTED,!0);e.errorCategory="drm",e.muxCode=5000002,d2(t,e)},{once:!0}),t.setAttribute("src",n),e.startTime&&((null!=(a=dk.get(t))?a:{}).startTime=e.startTime,t.addEventListener("durationchange",d0,{once:!0}))}else t.removeAttribute("src");t.addEventListener("error",d1),t.addEventListener("error",d3),t.addEventListener("emptied",()=>{t.querySelectorAll("track[data-removeondestroy]").forEach(e=>{e.remove()})},{once:!0}),lk(t,"pause",l),lk(t,"seeked",l),lk(t,"play",()=>{t.ended||dU(t.currentTime,t.duration)&&(t.currentTime=t.seekable.length?t.seekable.start(0):0)})}else{let r,a;i&&n?(i.once(lu.Events.LEVEL_LOADED,(e,r)=>{((e,t,i)=>{var r,a,s,n,o,l,d,u,h;let c,m,f,g,v,{streamType:y,targetLiveWindow:E,liveEdgeStartOffset:b,lowLatency:T}=(m=lR(c=e.type),f=lI(c),v=!!(null!=(h=e.partList)&&h.length),m===lv&&(g=v?2*e.partTarget:3*e.targetduration),{streamType:m,targetLiveWindow:f,liveEdgeStartOffset:g,lowLatency:v});if(y===lv){T?(i.config.backBufferLength=null!=(r=i.userConfig.backBufferLength)?r:4,i.config.maxFragLookUpTolerance=null!=(a=i.userConfig.maxFragLookUpTolerance)?a:.001,i.config.abrBandWidthUpFactor=null!=(s=i.userConfig.abrBandWidthUpFactor)?s:i.config.abrBandWidthFactor):i.config.backBufferLength=null!=(n=i.userConfig.backBufferLength)?n:8;let e=Object.freeze({get length(){return t.seekable.length},start:e=>t.seekable.start(e),end(e){var r;return e>this.length||e<0||Number.isFinite(t.duration)?t.seekable.end(e):null!=(r=i.liveSyncPosition)?r:t.seekable.end(e)}});(null!=(o=dk.get(t))?o:{}).seekable=e}(null!=(l=dk.get(t))?l:{}).liveEdgeStartOffset=b,(null!=(d=dk.get(t))?d:{}).targetLiveWindow=E,t.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),(null!=(u=dk.get(t))?u:{}).streamType=y,t.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))})(r.details,t,i),h(),dM(t)!==lv||Number.isFinite(t.duration)||(i.on(lu.Events.LEVEL_UPDATED,h),lk(t,"durationchange",()=>{Number.isFinite(t.duration)&&i.off(lu.Events.LEVELS_UPDATED,h)}))}),i.on(lu.Events.ERROR,(r,a)=>{var s,n;let o=d4(a,e);if(2412e3===o.muxCode){let e=null!=(s=dk.get(t))?s:{},r=null!=(n=e.retryCount)?n:0;if(r<6){let s=0===r?5e3:6e4,n=new lm(`Retrying in ${s/1e3} seconds...`,o.code,o.fatal);Object.assign(n,o),d2(t,n),setTimeout(()=>{e.retryCount=r+1,"manifestLoadError"===a.details&&a.url&&i.loadSource(a.url)},s);return}{e.retryCount=0;let i=new lm('Try again later or <a href="#" onclick="window.location.reload(); return false;" style="color: #4a90e2;">click here to retry</a>',o.code,o.fatal);Object.assign(i,o),d2(t,i);return}}d2(t,o)}),i.on(lu.Events.MANIFEST_LOADED,()=>{let e=dk.get(t);e&&e.error&&(e.error=null,e.retryCount=0,t.dispatchEvent(new Event("emptied")),t.dispatchEvent(new Event("loadstart")))}),t.addEventListener("error",d3),lk(t,"waiting",l),function(e,t){var i;if(!("videoTracks"in e))return;let r=new WeakMap;t.on(lu.Events.MANIFEST_PARSED,function(t,i){s();let a=e.addVideoTrack("main");for(let[e,t]of(a.selected=!0,i.levels.entries())){let i=a.addRendition(t.url[0],t.width,t.height,t.videoCodec,t.bitrate);r.set(t,`${e}`),i.id=`${e}`}}),t.on(lu.Events.AUDIO_TRACKS_UPDATED,function(t,i){for(let t of(a(),i.audioTracks)){let i=t.default?"main":"alternative",r=e.addAudioTrack(i,t.name,t.lang);r.id=`${t.id}`,t.default&&(r.enabled=!0)}}),e.audioTracks.addEventListener("change",()=>{var i;let r=+(null==(i=[...e.audioTracks].find(e=>e.enabled))?void 0:i.id),a=t.audioTracks.map(e=>e.id);r!=t.audioTrack&&a.includes(r)&&(t.audioTrack=r)}),t.on(lu.Events.LEVELS_UPDATED,function(t,i){var a;let s=e.videoTracks[null!=(a=e.videoTracks.selectedIndex)?a:0];if(!s)return;let n=i.levels.map(e=>r.get(e));for(let t of e.videoRenditions)t.id&&!n.includes(t.id)&&s.removeRendition(t)}),null==(i=e.videoRenditions)||i.addEventListener("change",e=>{let i=e.target.selectedIndex;i!=t.nextLevel&&(t.nextLevel=i)});let a=()=>{for(let t of e.audioTracks)e.removeAudioTrack(t)},s=()=>{(()=>{for(let t of e.videoTracks)e.removeVideoTrack(t)})(),a()};t.once(lu.Events.DESTROYING,s)}(e,i),i.on(lu.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(e,{tracks:r})=>
32{r.forEach(e=>{var r,a;let s=null!=(r=e.subtitleTrack)?r:e.closedCaptions,n=i.subtitleTracks.findIndex(({lang:t,name:i,type:r})=>t==(null==s?void 0:s.lang)&&i===e.label&&r.toLowerCase()===e.kind),o=(null!=(a=e._id)?a:e.default)?"default":`${e.kind}${n}`;l$(t,e.kind,e.label,null==s?void 0:s.lang,o,e.default)})}),r=()=>{if(!i.subtitleTracks.length)return;let e=Array.from(t.textTracks).find(e=>e.id&&"showing"===e.mode&&["subtitles","captions"].includes(e.kind));if(!e)return;let r=i.subtitleTracks[i.subtitleTrack],a=r?r.default?"default":`${i.subtitleTracks[i.subtitleTrack].type.toLowerCase()}${i.subtitleTrack}`:void 0;if(i.subtitleTrack<0||(null==e?void 0:e.id)!==a){let t=i.subtitleTracks.findIndex(({lang:t,name:i,type:r,default:a})=>"default"===e.id&&a||t==e.language&&i===e.label&&r.toLowerCase()===e.kind);i.subtitleTrack=t}(null==e?void 0:e.id)===a&&e.cues&&Array.from(e.cues).forEach(t=>{e.addCue(t)})},t.textTracks.addEventListener("change",r),i.on(lu.Events.CUES_PARSED,(e,{track:i,cues:r})=>{let a=t.textTracks.getTrackById(i);if(!a)return;let s="disabled"===a.mode;s&&(a.mode="hidden"),r.forEach(e=>{var t;null!=(t=a.cues)&&t.getCueById(e.id)||a.addCue(e)}),s&&(a.mode="disabled")}),i.once(lu.Events.DESTROYING,()=>{t.textTracks.removeEventListener("change",r),t.querySelectorAll("track[data-removeondestroy]").forEach(e=>{e.remove()})}),a=()=>
32{Array.from(t.textTracks).forEach(e=>{var i,r;if(!["subtitles","caption"].includes(e.kind)&&("thumbnails"===e.label||"chapters"===e.kind)){if(!(null!=(i=e.cues)&&i.length)){let i="track";e.kind&&(i+=`[kind="${e.kind}"]`),e.label&&(i+=`[label="${e.label}"]`);let a=t.querySelector(i),s=null!=(r=null==a?void 0:a.getAttribute("src"))?r:"";null==a||a.removeAttribute("src"),setTimeout(()=>{null==a||a.setAttribute("src",s)},0)}"hidden"!==e.mode&&(e.mode="hidden")}})},i.once(lu.Events.MANIFEST_LOADED,a),i.once(lu.Events.MEDIA_ATTACHED,a),i.attachMedia(t)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")}};function d0(e){var t;let i=e.target,r=null==(t=dk.get(i))?void 0:t.startTime;if(r&&function(e,t,i){t&&i>t&&(i=t);for(let t=0;t<e.length;t++)if(e.start(t)<=i&&e.end(t)>=i)return!0;return!1}(i.seekable,i.duration,r)){let e="auto"===i.preload;e&&(i.preload="none"),i.currentTime=r,e&&(i.preload="auto")}}async function d1(e){if(!e.isTrusted)return;e.stopImmediatePropagation();let t=e.target;if(!(null!=t&&t.error))return;let{message:i,code:r}=t.error,a=new lm(i,r);if(t.src&&r===lm.MEDIA_ERR_SRC_NOT_SUPPORTED&&t.readyState===HTMLMediaElement.HAVE_NOTHING)return void setTimeout(()=>{var e;let i=null!=(e=dP(t))?e:t.error;(null==i?void 0:i.code)===lm.MEDIA_ERR_SRC_NOT_SUPPORTED&&d2(t,a)},500);if(t.src&&(r!==lm.MEDIA_ERR_DECODE||void 0!==r))try{let{status:e}=await fetch(t.src);a.data={response:{code:e}}}catch{}d2(t,a)}function d2(e,t){var i;t.fatal&&((null!=(i=dk.get(e))?i:{}).error=t,e.dispatchEvent(new CustomEvent("error",{detail:t})))}function d3(e){var t,i;if(!(e instanceof CustomEvent)||!(e.detail instanceof lm))return;let r=e.target,a=e.detail;a&&a.fatal&&((null!=(t=dk.get(r))?t:{}).error=a,null==(i=r.mux)||i.emit("error",{player_error_code:a.code,player_error_message:a.message,player_error_context:a.context}))}var d4=(e,t)=>{var i,r,a;e.fatal?console.error("getErrorFromHlsErrorData()",e):t.debug&&console.warn("getErrorFromHlsErrorData() (non-fatal)",e);let s={[lu.ErrorTypes.NETWORK_ERROR]:lm.MEDIA_ERR_NETWORK,[lu.ErrorTypes.MEDIA_ERROR]:lm.MEDIA_ERR_DECODE,[lu.ErrorTypes.KEY_SYSTEM_ERROR]:lm.MEDIA_ERR_ENCRYPTED},n,o=[lu.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,lu.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED].includes(e.details)?lm.MEDIA_ERR_NETWORK:s[e.type];if(o===lm.MEDIA_ERR_NETWORK&&e.response){let a=null!=(i=e.type===lu.ErrorTypes.KEY_SYSTEM_ERROR?"drm":e.type===lu.ErrorTypes.NETWORK_ERROR?lh:void 0)?i:lh;n=null!=(r=l1(e.response,a,t,e.fatal))?r:new lm("",o,e.fatal)}else o===lm.MEDIA_ERR_ENCRYPTED?e.details===lu.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE?((n=new lm(lM("Attempting to play DRM-protected content without providing a DRM token."),lm.MEDIA_ERR_ENCRYPTED,e.fatal)).errorCategory="drm",n.muxCode=5000002):e.details===lu.ErrorDetails.KEY_SYSTEM_NO_ACCESS?((n=new lm(lM("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),lm.MEDIA_ERR_ENCRYPTED,e.fatal)).errorCategory="drm",n.muxCode=5000001):e.details===lu.ErrorDetails.KEY_SYSTEM_NO_SESSION?((n=new lm(lM("Failed to generate a DRM license request. This may be an issue with the player or your protected content."),lm.MEDIA_ERR_ENCRYPTED,!0)).errorCategory="drm",n.muxCode=5000002):e.details===lu.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED?((n=new lm(lM("Failed to update DRM license. This may be an issue with the player or your protected content."),lm.MEDIA_ERR_ENCRYPTED,e.fatal)).errorCategory="drm",n.muxCode=5000003):e.details===lu.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED?((n=new lm(lM("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate."),lm.MEDIA_ERR_ENCRYPTED,e.fatal)).errorCategory="drm",n.muxCode=5000004):e.details===lu.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR?((n=new lm(lM("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser."),lm.MEDIA_ERR_ENCRYPTED,e.fatal)).errorCategory="drm",n.muxCode=5000005):e.details===lu.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED?((n=new lm(lM("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen."),lm.MEDIA_ERR_ENCRYPTED,!1)).errorCategory="drm",n.muxCode=5000006):((n=new lm(e.error.message,lm.MEDIA_ERR_ENCRYPTED,e.fatal)).errorCategory="drm",n.muxCode=5e6):n=new lm("",o,e.fatal);return n.context||(n.context=`${e.url?`url: ${e.url} 33`:""}${e.response&&(e.response.code||e.response.text)?`response: ${e.response.code}, ${e.response.text} 34`:""}${e.reason?`failure reason: ${e.reason} 35`:""}${e.level?`level: ${e.level} 36`:""}${e.parent?`parent stream controller: ${e.parent} 37`:""}${e.buffer?`buffer length: ${e.buffer} 38`:""}${e.error?`error: ${e.error} 39`:""}${e.event?`event: ${e.event} 40`:""}${e.err?`error message: ${null==(a=e.err)?void 0:a.message} 41`:""}`),n.data=e,n};let d5=["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"],d8=["autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"];function d9(e){return` 42 <style> 43 :host { 44 display: inline-flex; 45 line-height: 0; 46 flex-direction: column; 47 justify-content: end; 48 } 49 50 audio { 51 width: 100%; 52 } 53 </style> 54 <slot name="media"> 55 <audio${ue(e)}></audio> 56 </slot> 57 <slot></slot> 58 `}function d6(e){return` 59 <style> 60 :host { 61 display: inline-block; 62 line-height: 0; 63 } 64 65 video { 66 max-width: 100%; 67 max-height: 100%; 68 min-width: 100%; 69 min-height: 100%; 70 object-fit: var(--media-object-fit, contain); 71 object-position: var(--media-object-position, 50% 50%); 72 } 73 74 video::-webkit-media-text-track-container { 75 transform: var(--media-webkit-text-track-transform); 76 transition: var(--media-webkit-text-track-transition); 77 } 78 </style> 79 <slot name="media"> 80 <video${ue(e)}></video> 81 </slot> 82 <slot></slot> 83 `}function d7(e,{tag:t,is:i}){let r=globalThis.document?.createElement?.(t,{is:i}),a=r?function(e){let t=[];for(let i=Object.getPrototypeOf(e);i&&i!==HTMLElement.prototype;i=Object.getPrototypeOf(i)){let e=Object.getOwnPropertyNames(i);t.push(...e)}return t}(r):[];return class s extends e{static getTemplateHTML=t.endsWith("audio")?d9:d6;static shadowRootOptions={mode:"open"};static Events=d5;static #e=!1;static get observedAttributes(){return s.#t(),[...r?.constructor?.observedAttributes??[],...d8]}
83static #t(){if(this.#e)return;this.#e=!0;let e=new Set(this.observedAttributes);for(let t of(e.delete("muted"),a))if(!(t in this.prototype))if("function"==typeof r[t])this.prototype[t]=function(...e){return this.#i(),(()=>{if(this.call)return this.call(t,...e);let i=this.nativeEl?.[t];return i?.apply(this.nativeEl,e)})()};else{let i={get(){this.#i();let i=t.toLowerCase();if(e.has(i)){let e=this.getAttribute(i);return null!==e&&(""===e||e)}return this.get?.(t)??this.nativeEl?.[t]}};t!==t.toUpperCase()&&(i.set=function(i){this.#i();let r=t.toLowerCase();e.has(r)?!0===i||!1===i||null==i?this.toggleAttribute(r,!!i):this.setAttribute(r,i):this.set?this.set(t,i):this.nativeEl&&(this.nativeEl[t]=i)}),Object.defineProperty(this.prototype,t,i)}}#r=!1;#a=null;#s=new Map;#n;get;set;call;get nativeEl(){return this.#i(),this.#a??this.querySelector(":scope > [slot=media]")??this.querySelector(t)??this.shadowRoot?.querySelector(t)??null}set nativeEl(e){this.#a=e}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(e){this.toggleAttribute("muted",e)}get src(){return this.getAttribute("src")}set src(e){this.setAttribute("src",`${e}`)}get preload(){return this.getAttribute("preload")??this.nativeEl?.preload}set preload(e){this.setAttribute("preload",`${e}`)}#i(){this.#r||(this.#r=!0,this.init())}init(){if(!this.shadowRoot){this.attachShadow({mode:"open"});let e=function(e){let t={};for(let i of e)t[i.name]=i.value;return t}(this.attributes);i&&(e.is=i),t&&(e.part=t),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}for(let e of(this.nativeEl.muted=this.hasAttribute("muted"),a))this.#o(e);for(let e of(this.#n=new MutationObserver(this.#l.bind(this)),this.shadowRoot.addEventListener("slotchange",()=>this.#d()),this.#d(),this.constructor.Events))this.shadowRoot.addEventListener(e,this,!0)}handleEvent(e){e.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))}#d(){let e=new Map(this.#s),t=this.shadowRoot?.querySelector("slot:not([name])");(t?.assignedElements({flatten:!0}).filter(e=>["track","source"].includes(e.localName))).forEach(t=>{e.delete(t);let i=this.#s.get(t);i||(i=t.cloneNode(),this.#s.set(t,i),this.#n?.observe(t,{attributes:!0})),this.nativeEl?.append(i),this.#u(i)}),e.forEach((e,t)=>{e.remove(),this.#s.delete(t)})}#l(e){for(let t of e)if("attributes"===t.type){let{target:e,attributeName:i}=t,r=this.#s.get(e);r&&i&&(r.setAttribute(i,e.getAttribute(i)??""),this.#u(r))}}#u(e){e&&"track"===e.localName&&e.default&&("chapters"===e.kind||"metadata"===e.kind)&&"disabled"===e.track.mode&&(e.track.mode="hidden")}#o(e){if(Object.prototype.hasOwnProperty.call(this,e)){let t=this[e];delete this[e],this[e]=t}}attributeChangedCallback(e,t,i){this.#i(),this.#h(e,t,i)}#h(e,t,i){["id","class"].includes(e)||!s.observedAttributes.includes(e)&&this.constructor.observedAttributes.includes(e)||(null===i?this.nativeEl?.removeAttribute(e):this.nativeEl?.getAttribute(e)!==i&&this.nativeEl?.setAttribute(e,i))}connectedCallback(){this.#i()}}}function ue(e){let t="";for(let i in e){if(!d8.includes(i))continue;let r=e[i];""===r?t+=` ${i}`:t+=` ${i}="${r}"`}return t}let ut=d7(globalThis.HTMLElement??class{},{tag:"video"});d7(globalThis.HTMLElement??class{},{tag:"audio"});var ui,ur,ua,us,un,uo,ul,ud,uu,uh,uc,um,uf,up=e=>{throw TypeError(e)},ug=(e,t,i)=>t.has(e)||up("Cannot "+i),uv=(e,t,i)=>(ug(e,t,"read from private field"),i?i.call(e):t.get(e)),uy=(e,t,i)=>t.has(e)?up("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),uE=(e,t,i,r)=>(ug(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),ub=(e,t,i)=>(ug(e,t,"access private method"),i),uT=(()=>{try{return"0.30.3"}catch{}return"UNKNOWN"})(),uA=` 84<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.12
841 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>`,u_={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",CAP_RENDITION_TO_PLAYER_SIZE:"cap-rendition-to-player-size"},uS=Object.values(u_),uk="mux-video",uL=class extends ut{constructor(){super(),uy(this,uh),uy(this,ui),uy(this,ur),uy(this,ua,{}),uy(this,us,{}),uy(this,un),uy(this,uo),uy(this,ul),uy(this,ud),uy(this,uu,""),uy(this,um),uE(this,ur,dR()),this.nativeEl.addEventListener("muxmetadata",e=>{var t,i,r;let a=(i=this.nativeEl,null==(r=dk.get(i))?void 0:r.metadata),s=null!=(t=this.metadata)?t:{};this.metadata={...a,...s},(null==a?void 0:a["com.mux.video.branding"])==="mux-free-plan"&&(uE(this,uu,"default"),this.updateLogo())})}static get NAME(){return uk}static get VERSION(){return uT}static get observedAttributes(){var e;return[...uS,...null!=(e=ut.observedAttributes)?e:[]]}static getLogoHTML(e){return e&&"false"!==e?"default"===e?uA:`<img part="logo" src="${e}" />`:""}static getTemplateHTML(e={}){var t;return` 85 ${ut.getTemplateHTML(e)} 86 <style> 87 :host { 88 position: relative; 89 } 90 slot[name="logo"] { 91 display: flex; 92 justify-content: end; 93 position: absolute; 94 top: 1rem; 95 right: 1rem; 96 opacity: 0; 97 transition: opacity 0.25s ease-in-out; 98 z-index: 1; 99 } 100 slot[name="logo"]:has([part="logo"]) { 101 opacity: 1; 102 } 103 slot[name="logo"] [part="logo"] { 104 width: 5rem; 105 pointer-events: none; 106 user-select: none; 107 } 108 </style> 109 <slot name="logo"> 110 ${this.getLogoHTML(null!=(t=e[u_.LOGO])?t:"")} 111 </slot> 112 `}get preferCmcd(){var e;return null!=(e=this.getAttribute(u_.PREFER_CMCD))?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?lT.includes(e)?this.setAttribute(u_.PREFER_CMCD,e):console.warn(`Invalid value for preferCmcd. Must be one of ${lT.join()}`):this.removeAttribute(u_.PREFER_CMCD))}get playerInitTime(){return this.hasAttribute(u_.PLAYER_INIT_TIME)?+this.getAttribute(u_.PLAYER_INIT_TIME):uv(this,ur)}set playerInitTime(e){e!=this.playerInitTime&&(null==e?this.removeAttribute(u_.PLAYER_INIT_TIME):this.setAttribute(u_.PLAYER_INIT_TIME,`${+e}`))}get playerSoftwareName(){var e;return null!=(e=uv(this,ul))?e:uk}set playerSoftwareName(e){uE(this,ul,e)}get playerSoftwareVersion(){var e;return null!=(e=uv(this,uo))?e:uT}set playerSoftwareVersion(e){uE(this,uo,e)}
112get _hls(){var e;return null==(e=uv(this,uh,uc))?void 0:e.engine}get mux(){var e;return null==(e=this.nativeEl)?void 0:e.mux}get error(){var e;return null!=(e=dP(this.nativeEl))?e:null}get errorTranslator(){return uv(this,ud)}set errorTranslator(e){uE(this,ud,e)}get src(){return this.getAttribute("src")}set src(e){e!==this.src&&(null==e?this.removeAttribute("src"):this.setAttribute("src",e))}get type(){var e;return null!=(e=this.getAttribute(u_.TYPE))?e:void 0}set type(e){e!==this.type&&(e?this.setAttribute(u_.TYPE,e):this.removeAttribute(u_.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 null!=this.getAttribute(u_.DEBUG)}set debug(e){e!==this.debug&&(e?this.setAttribute(u_.DEBUG,""):this.removeAttribute(u_.DEBUG))}get disableTracking(){return this.hasAttribute(u_.DISABLE_TRACKING)}set disableTracking(e){e!==this.disableTracking&&this.toggleAttribute(u_.DISABLE_TRACKING,!!e)}get disableCookies(){return this.hasAttribute(u_.DISABLE_COOKIES)}set disableCookies(e){e!==this.disableCookies&&(e?this.setAttribute(u_.DISABLE_COOKIES,""):this.removeAttribute(u_.DISABLE_COOKIES))}get disablePseudoEnded(){return this.hasAttribute(u_.DISABLE_PSEUDO_ENDED)}set disablePseudoEnded(e){e!==this.disablePseudoEnded&&(e?this.setAttribute(u_.DISABLE_PSEUDO_ENDED,""):this.removeAttribute(u_.DISABLE_PSEUDO_ENDED))}get startTime(){let e=this.getAttribute(u_.START_TIME);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set startTime(e){e!==this.startTime&&(null==e?this.removeAttribute(u_.START_TIME):this.setAttribute(u_.START_TIME,`${e}`))}get playbackId(){var e;return this.hasAttribute(u_.PLAYBACK_ID)?this.getAttribute(u_.PLAYBACK_ID):null!=(e=dx(this.src))?e:void 0}set playbackId(e){e!==this.playbackId&&(e?this.setAttribute(u_.PLAYBACK_ID,e):this.removeAttribute(u_.PLAYBACK_ID))}get maxResolution(){var e;return null!=(e=this.getAttribute(u_.MAX_RESOLUTION))?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(u_.MAX_RESOLUTION,e):this.removeAttribute(u_.MAX_RESOLUTION))}get minResolution(){var e;return null!=(e=this.getAttribute(u_.MIN_RESOLUTION))?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(u_.MIN_RESOLUTION,e):this.removeAttribute(u_.MIN_RESOLUTION))}get maxAutoResolution(){var e;return null!=(e=this.getAttribute(u_.MAX_AUTO_RESOLUTION))?e:void 0}set maxAutoResolution(e){null==e?this.removeAttribute(u_.MAX_AUTO_RESOLUTION):this.setAttribute(u_.MAX_AUTO_RESOLUTION,e)}get renditionOrder(){var e;return null!=(e=this.getAttribute(u_.RENDITION_ORDER))?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(u_.RENDITION_ORDER,e):this.removeAttribute(u_.RENDITION_ORDER))}get programStartTime(){let e=this.getAttribute(u_.PROGRAM_START_TIME);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set programStartTime(e){null==e?this.removeAttribute(u_.PROGRAM_START_TIME):this.setAttribute(u_.PROGRAM_START_TIME,`${e}`)}get programEndTime(){let e=this.getAttribute(u_.PROGRAM_END_TIME);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set programEndTime(e){null==e?this.removeAttribute(u_.PROGRAM_END_TIME):this.setAttribute(u_.PROGRAM_END_TIME,`${e}`)}get assetStartTime(){let e=this.getAttribute(u_.ASSET_START_TIME);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set assetStartTime(e){null==e?this.removeAttribute(u_.ASSET_START_TIME):this.setAttribute(u_.ASSET_START_TIME,`${e}`)}get assetEndTime(){let e=this.getAttribute(u_.ASSET_END_TIME);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set assetEndTime(e){null==e?this.removeAttribute(u_.ASSET_END_TIME):this.setAttribute(u_.ASSET_END_TIME,`${e}`)}get customDomain(){var e;return null!=(e=this.getAttribute(u_.CUSTOM_DOMAIN))?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(u_.CUSTOM_DOMAIN,e):this.removeAttribute(u_.CUSTOM_DOMAIN))}get capRenditionToPlayerSize(){var e;return(null==(e=this._hlsConfig)?void 0:e.capLevelToPlayerSize)!=null?this._hlsConfig.capLevelToPlayerSize:uv(this,um)}set capRenditionToPlayerSize(e){uE(this,um,e)}get drmToken(){var e;return null!=(e=this.getAttribute(u_.DRM_TOKEN))?e:void 0}
112set drmToken(e){e!==this.drmToken&&(e?this.setAttribute(u_.DRM_TOKEN,e):this.removeAttribute(u_.DRM_TOKEN))}get playbackToken(){var e,t,i,r;if(this.hasAttribute(u_.PLAYBACK_TOKEN))return null!=(e=this.getAttribute(u_.PLAYBACK_TOKEN))?e:void 0;if(this.hasAttribute(u_.PLAYBACK_ID)){let[,e]=lL(null!=(t=this.playbackId)?t:"");return null!=(i=new URLSearchParams(e).get("token"))?i:void 0}if(this.src)return null!=(r=new URLSearchParams(this.src).get("token"))?r:void 0}set playbackToken(e){e!==this.playbackToken&&(e?this.setAttribute(u_.PLAYBACK_TOKEN,e):this.removeAttribute(u_.PLAYBACK_TOKEN))}get tokens(){let e=this.getAttribute(u_.PLAYBACK_TOKEN),t=this.getAttribute(u_.DRM_TOKEN);return{...uv(this,us),...null!=e?{playback:e}:{},...null!=t?{drm:t}:{}}}set tokens(e){uE(this,us,null!=e?e:{})}get ended(){return dB(this.nativeEl,this._hls)}get envKey(){var e;return null!=(e=this.getAttribute(u_.ENV_KEY))?e:void 0}set envKey(e){e!==this.envKey&&(e?this.setAttribute(u_.ENV_KEY,e):this.removeAttribute(u_.ENV_KEY))}get beaconCollectionDomain(){var e;return null!=(e=this.getAttribute(u_.BEACON_COLLECTION_DOMAIN))?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(u_.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(u_.BEACON_COLLECTION_DOMAIN))}get streamType(){var e;return null!=(e=this.getAttribute(u_.STREAM_TYPE))?e:dM(this.nativeEl)}set streamType(e){e!==this.streamType&&(e?this.setAttribute(u_.STREAM_TYPE,e):this.removeAttribute(u_.STREAM_TYPE))}get targetLiveWindow(){var e,t,i;return this.hasAttribute(u_.TARGET_LIVE_WINDOW)?+this.getAttribute(u_.TARGET_LIVE_WINDOW):(e=this.nativeEl,null!=(i=null==(t=dk.get(e))?void 0:t.targetLiveWindow)?i:NaN)}set targetLiveWindow(e){e!=this.targetLiveWindow&&(null==e?this.removeAttribute(u_.TARGET_LIVE_WINDOW):this.setAttribute(u_.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e,t;if(this.hasAttribute(u_.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:i}=this,r=null!=(e=this.nativeEl.seekable.end(0))?e:0;return Math.max(null!=(t=this.nativeEl.seekable.start(0))?t:0,r-i)}return(e=>{var t;let i=null==(t=dk.get(e))?void 0:t.liveEdgeStartOffset;if("number"!=typeof i)return NaN;let r=dO(e);return r.length?r.end(r.length-1)-i:NaN})(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(u_.LIVE_EDGE_OFFSET))return+this.getAttribute(u_.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){e!=this.liveEdgeOffset&&(null==e?this.removeAttribute(u_.LIVE_EDGE_OFFSET):this.setAttribute(u_.LIVE_EDGE_OFFSET,`${+e}`))}get seekable(){return dO(this.nativeEl)}async addCuePoints(e){return lK(this.nativeEl,e)}get activeCuePoint(){return lj(this.nativeEl)}get cuePoints(){return function(e,t={label:lG}){let i=lH(e,t.label,"metadata");return null!=i&&i.cues?Array.from(i.cues,e=>lq(e)):[]}(this.nativeEl)}async addChapters(e){return lZ(this.nativeEl,e)}get activeChapter(){return lJ(this.nativeEl)}get chapters(){return function(e,t={label:lz}){var i;let r=lH(e,t.label,"chapters");return null!=(i=null==r?void 0:r.cues)&&i.length?Array.from(r.cues,e=>lQ(e)):[]}(this.nativeEl)}getStartDate(){return function(e,t){if(t){let i=t.playingDate;if(null!=i)return new Date(i.getTime()-1e3*e.currentTime)}return"function"==typeof e.getStartDate?e.getStartDate():new Date(NaN)}(this.nativeEl,this._hls)}get currentPdt(){var e,t;return e=this.nativeEl,(t=this._hls)&&t.playingDate?t.playingDate:new Date("function"==typeof e.getStartDate?e.getStartDate().getTime()+1e3*e.currentTime:NaN)}get preferPlayback(){let e=this.getAttribute(u_.PREFER_PLAYBACK);if("mse"===e||e===lE)return e}set preferPlayback(e){e!==this.preferPlayback&&("mse"===e||e===lE?this.setAttribute(u_.PREFER_PLAYBACK,e):this.removeAttribute(u_.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(e=>e.startsWith("metadata-")&&![u_.METADATA_URL].includes(e)).reduce((e,t)=>{let i=this.getAttribute(t);return null!=i&&(e[t.replace(/^metadata-/,"").replace(/-/g,"_")]=i),e},{}),...uv(this,ua)}}set metadata(e){uE(this,ua,null!=e?e:{}),this.mux&&this.mux.emit("hb",uv(this,ua))}get _hlsConfig(){return uv(this,un)}set _hlsConfig(e){uE(this,un,e)}get logo(){var e;return null!=(e=this.getAttribute(u_.LOGO))?e:uv(this,uu)}set logo(e){e?this.setAttribute(u_.LOGO,e):this.removeAttribute(u_.LOGO)}load(){d$(this,this.nativeEl,uv(this,uh,uc))}unload(){dH(this.nativeEl,uv(this,uh,uc),this)}attributeChangedCallback(e,t,i){var r,a;
112switch(ut.observedAttributes.includes(e)&&!["src","autoplay","preload"].includes(e)&&super.attributeChangedCallback(e,t,i),e){case u_.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=null!=i?i:void 0;break;case u_.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=null!=i?i:void 0;break;case"src":{let e=!!t,r=!!i;!e&&r?ub(this,uh,uf).call(this):e&&!r?this.unload():e&&r&&(this.unload(),ub(this,uh,uf).call(this));break}case"autoplay":if(i===t)break;null==(r=uv(this,uh,uc))||r.setAutoplay(this.autoplay);break;case"preload":if(i===t)break;null==(a=uv(this,uh,uc))||a.setPreload(i);break;case u_.PLAYBACK_ID:this.src=dC(this);break;case u_.DEBUG:{let e=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=e);break}case u_.METADATA_URL:i&&fetch(i).then(e=>e.json()).then(e=>this.metadata=e).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${i}!`));break;case u_.STREAM_TYPE:(null==i||i!==t)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case u_.TARGET_LIVE_WINDOW:(null==i||i!==t)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;case u_.LOGO:(null==i||i!==t)&&this.updateLogo();break;case u_.DISABLE_TRACKING:if(null==i||i!==t){let e=this.currentTime,t=this.paused;this.unload(),ub(this,uh,uf).call(this).then(()=>{this.currentTime=e,t||this.play()})}break;case u_.DISABLE_COOKIES:(null==i||i!==t)&&this.disableCookies&&document.cookie.split(";").forEach(e=>{e.trim().startsWith("muxData")&&(document.cookie=e.replace(/^ +/,"").replace(/=.*/,"=;expires="+new Date().toUTCString()+";path=/"))});break;case u_.CAP_RENDITION_TO_PLAYER_SIZE:(null==i||i!==t)&&(this.capRenditionToPlayerSize=null!=i||void 0)}}updateLogo(){if(!this.shadowRoot)return;let e=this.shadowRoot.querySelector('slot[name="logo"]');e&&(e.innerHTML=this.constructor.getLogoHTML(uv(this,uu)||this.logo))}connectedCallback(){var e;null==(e=super.connectedCallback)||e.call(this),this.nativeEl&&this.src&&!uv(this,uh,uc)&&ub(this,uh,uf).call(this)}disconnectedCallback(){this.unload()}handleEvent(e){e.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(e.type,{composed:!0,detail:e.detail}))}};ui=new WeakMap,ur=new WeakMap,ua=new WeakMap,us=new WeakMap,un=new WeakMap,uo=new WeakMap,ul=new WeakMap,ud=new WeakMap,uu=new WeakMap,uh=new WeakSet,uc=function(){var e,t;return e=this.nativeEl,null==(t=dk.get(e))?void 0:t.coreReference},um=new WeakMap,uf=async function(){uv(this,ui)||(await uE(this,ui,Promise.resolve()),uE(this,ui,null),this.load())};let uw=new WeakMap;
112class uR extends Error{}class uI extends Error{}let uC=["application/x-mpegURL","application/vnd.apple.mpegurl","audio/mpegurl"];function uD(){return globalThis.cast?.framework?.CastContext.getInstance()}function ux(){return uD()?.getCurrentSession()}function uP(){return ux()?.getSessionObj().media[0]}function uM(e){return uD().setOptions({...uO(),...e})}function uO(){return{receiverApplicationId:"CC1AD845",autoJoinPolicy:"origin_scoped",androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0}}async function uN(e){try{let t=(await fetch(e,{method:"HEAD"})).headers.get("Content-Type");return uC.some(e=>t===e)}catch(e){return console.error("Error while trying to get the Content-Type of the manifest",e),!1}}async function uU(e){try{let i=await (await fetch(e)).text(),r=i,a=function(e){let t=e.split("\n"),i=[];for(let e=0;e<t.length;e++)if(t[e].trim().startsWith("#EXT-X-STREAM-INF")){let r=t[e+1]?t[e+1].trim():"";r&&!r.startsWith("#")&&i.push(r)}return i}(i);if(a.length>0){let t=new URL(a[0],e).toString();r=await (await fetch(t)).text()}var t=r.split("\n").find(e=>!e.trim().startsWith("#")&&""!==e.trim());if(!t)return;let s=t.match(/\.([a-zA-Z0-9]+)(?:\?.*)?$/);return s?s[1]:null}catch(e){console.error("Error while trying to parse the manifest playlist",e);return}}let uF=new(globalThis.WeakRef?class extends Set{add(e){super.add(new WeakRef(e))}forEach(e){super.forEach(t=>{let i=t.deref();i&&e(i)})}}:Set),uB=new WeakSet;ho=()=>{globalThis.chrome?.cast?.isAvailable?i||(i=cast.framework,uD().addEventListener(i.CastContextEventType.CAST_STATE_CHANGED,e=>{uF.forEach(t=>uw.get(t).onCastStateChanged?.(e))}),uD().addEventListener(i.CastContextEventType.SESSION_STATE_CHANGED,e=>{uF.forEach(t=>uw.get(t).onSessionStateChanged?.(e))}),uF.forEach(e=>uw.get(e).init?.())):console.debug("chrome.cast.isAvailable",globalThis.chrome?.cast?.isAvailable)},globalThis.chrome?.cast?.isAvailable?globalThis.cast?.framework?ho():customElements.whenDefined("google-cast-button").then(ho):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(ho)};let u$=0;class uH extends EventTarget{#c;#r;#m;#f;#p="disconnected";#g=!1;#v=new Set;#y=new WeakMap;constructor(e){super(),this.#c=e,uF.add(this),uw.set(this,{init:()=>this.#i(),onCastStateChanged:()=>this.#E(),onSessionStateChanged:()=>this.#b(),getCastPlayer:()=>this.#T}),this.#i()}get #T(){if(uB.has(this.#c))return this.#m}get state(){return this.#p}async watchAvailability(e){if(this.#c.disableRemotePlayback)throw new uR("disableRemotePlayback attribute is present.");return this.#y.set(e,++u$),this.#v.add(e),queueMicrotask(()=>e(this.#A())),u$}async cancelWatchAvailability(e){if(this.#c.disableRemotePlayback)throw new uR("disableRemotePlayback attribute is present.");e?this.#v.delete(e):this.#v.clear()}async prompt(){if(this.#c.disableRemotePlayback)throw new uR("disableRemotePlayback attribute is present.");if(!globalThis.chrome?.cast?.isAvailable)throw new uI("The RemotePlayback API is disabled on this platform.");let e=uB.has(this.#c);uB.add(this.#c),uM(this.#c.castOptions),Object.entries(this.#f).forEach(([e,t])=>{this.#m.controller.addEventListener(e,t)});try{await uD().requestSession()}catch(t){if(e||uB.delete(this.#c),"cancel"===t)return;throw Error(t)}uw.get(this.#c)?.loadOnPrompt?.()}#_(){uB.has(this.#c)&&(Object.entries(this.#f).forEach(([e,t])=>{this.#m.controller.removeEventListener(e,t)}),uB.delete(this.#c),this.#c.muted=this.#m.isMuted,this.#c.currentTime=this.#m.savedPlayerState.currentTime,!1===this.#m.savedPlayerState.isPau
112sed&&this.#c.play())}#A(){let e=uD()?.getCastState();return e&&"NO_DEVICES_AVAILABLE"!==e}#E(){let e=uD().getCastState();if(uB.has(this.#c)&&"CONNECTING"===e&&(this.#p="connecting",this.dispatchEvent(new Event("connecting"))),!this.#g&&e?.includes("CONNECT"))for(let e of(this.#g=!0,this.#v))e(!0);else if(this.#g&&(!e||"NO_DEVICES_AVAILABLE"===e))for(let e of(this.#g=!1,this.#v))e(!1)}async #b(){let{SESSION_RESUMED:e}=i.SessionState;if(uD().getSessionState()===e&&this.#c.castSrc===uP()?.media.contentId){uB.add(this.#c),Object.entries(this.#f).forEach(([e,t])=>{this.#m.controller.addEventListener(e,t)});try{var t;await (t=new chrome.cast.media.GetStatusRequest,new Promise((e,i)=>{uP().getStatus(t,e,i)}))}catch(e){console.error(e)}this.#f[i.RemotePlayerEventType.IS_PAUSED_CHANGED](),this.#f[i.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}}#i(){i&&!this.#r&&(this.#r=!0,uM(this.#c.castOptions),this.#c.textTracks.addEventListener("change",()=>this.#S()),this.#E(),this.#m=new i.RemotePlayer,new i.RemotePlayerController(this.#m),this.#f={[i.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:e})=>{!0===e?(this.#p="connected",this.dispatchEvent(new Event("connect"))):(this.#_(),this.#p="disconnected",this.dispatchEvent(new Event("disconnect")))},[i.RemotePlayerEventType.DURATION_CHANGED]:()=>{this.#c.dispatchEvent(new Event("durationchange"))},[i.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{this.#c.dispatchEvent(new Event("volumechange"))},[i.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{this.#c.dispatchEvent(new Event("volumechange"))},[i.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{this.#T?.isMediaLoaded&&this.#c.dispatchEvent(new Event("timeupdate"))},[i.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{this.#c.dispatchEvent(new Event("resize"))},[i.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{this.#c.dispatchEvent(new Event(this.paused?"pause":"play"))},[i.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{this.#T?.playerState!==chrome.cast.media.PlayerState.PAUSED&&this.#c.dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[this.#T?.playerState]))},[i.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{this.#T?.isMediaLoaded&&(await Promise.resolve(),this.#k())}})}#k(){this.#S()}async #S(){let e;if(!this.#T)return;let t=(this.#m.mediaInfo?.tracks??[]).filter(({type:e})=>e===chrome.cast.media.TrackType.TEXT),i=[...this.#c.textTracks].filter(({kind:e})=>"subtitles"===e||"captions"===e),r=t.map(({language:e,name:t,trackId:r})=>{let{mode:a}=i.find(i=>i.language===e&&i.label===t)??{};return!!a&&{mode:a,trackId:r}}).filter(Boolean),a=r.filter(({mode:e})=>"showing"!==e).map(({trackId:e})=>e),s=r.find(({mode:e})=>"showing"===e),n=ux()?.getSessionObj().media[0]?.activeTrackIds??[],o=n;if(n.length&&(o=o.filter(e=>!a.includes(e))),s?.trackId&&(o=[...o,s.trackId]),e=o=[...new Set(o)],!(n.length===e.length&&n.every(t=>e.includes(t))))try{let e=new chrome.cast.media.EditTracksInfoRequest(o);await new Promise((t,i)=>{uP().editTracksInfo(e,t,i)})}catch(e){console.error(e)}}}let uV=e=>class extends e{static observedAttributes=[...e.observedAttributes??[],"cast-src","cast-content-type","cast-stream-type","cast-receiver"];#L={paused:!1};#w=uO();#R;#I;get remote(){return this.#I?this.#I:globalThis.chrome?(this.disableRemotePlayback||function(){let e="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";if(globalThis.chrome?.cast||document.querySelector(`script[src="${e}"]`))return;let t=document.createElement("script");t.src=e,document.head.append(t)}(),uw.set(this,{loadOnPrompt:()=>this.#C()}),this.#I=new uH(this)):super.remote}get #T(){return uw.get(this.remote)?.getCastPlayer?.()}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),"cast-receiver"===e&&i){this.#w.receiverApplicationId=i;return}if(this.#T)switch(e){case"cast-stream-type":case"cast-src":this.load()}}async #C(){this.#L.paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(e){console.error(e)}}async load(){if(!this.#T)return super.load();let e=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType);e.customData=this.castCustomData;let t=[...this.querySelectorAll("track")].filter(({kind:e,src:t})=>t&&("subtitles"===e||"captions"===e)),i=[],r=0;if(t.length&&(e.tracks=t.map(e=>{let t=++r;0===i.length&&"showing"===e.track.mode&&i.push(t);let a=new chrome.cast.media.Track(t,chrome.cast.media.TrackType.TEXT);return a.trackContentId=e.src,a.trackContentType="text/vtt",a.subtype="captions"===e.kind?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,a.name=e.label,a.language=e.srclang,a})),"live"===this.castStreamType?e.streamType=chrome.cast.media.StreamType.LIVE:e.streamType=chrome.cast.media.StreamType.BUFFERED,e.metadata=new chrome.cast.media.GenericMediaMetadata,e.metadata.title=this.title,e.metadata.images=[{url:this.poster}],uN(this.castSrc)){let t=await uU(this.castSrc);t?.includes("m4s")||t?.includes("mp4")?(e.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.FMP4,e.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.FMP4):t?.includes("ts")&&(e.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.TS,e.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.TS)}let a=new chrome.cast.media.LoadRequest(e);a.currentTime=super.currentTime??0,a.autoplay=!this.#L.paused,a.activeTrackIds=i,await ux()?.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.#w}get castReceiver(){return this.getAttribute("cast-receiver")??void 0}set castReceiver(e){this.castReceiver!=e&&this.setAttribute("cast-receiver",`${e}`)}get castSrc(){return this.getAttribute("cast-src")??this.querySelector("source")?.src??this.currentSrc}set castSrc(e){this.castSrc!=e&&this.setAttribute("cast-src",`${e}`)}get castContentType(){return this.getAttribute("cast-content-type")??void 0}set castContentType(e){this.setAttribute("cast-content-type",`${e}`)}get castStreamType(){return this.getAttribute("cast-stream-type")??this.streamType??void 0}set castStreamType(e){this.setAttribute("cast-stream-type",`${e}`)}get castCustomData(){return this.#R}set castCustomData(e){let t=typeof e;["object","undefined"].includes(t)?this.#R=e:console.error(`castCustomData must be nullish or an object but value was of type ${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(e){if(this.#T){(e&&!this.#T.isMuted||!e&&this.#T.isMuted)&&this.#T.controller?.muteOr
112Unmute();return}super.muted=e}get volume(){return this.#T?this.#T?.volumeLevel??1:super.volume}set volume(e){if(this.#T){this.#T.volumeLevel=+e,this.#T.controller?.setVolumeLevel();return}super.volume=e}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(e){if(this.#T){this.#T.currentTime=e,this.#T.controller?.seek();return}super.currentTime=e}};class uG extends Event{track;constructor(e,t){super(e),this.track=t.track}}let uW=new WeakMap;function uK(e){var t,i;let r;return uW.get(e)??(t=e,i={},(r=uW.get(t))||uW.set(t,r={}),Object.assign(r,i))}function uq(e,t){let i=e.videoTracks;uK(t).media=e,uK(t).renditionSet||(uK(t).renditionSet=new Set);let r=uK(i).trackSet;r.add(t);let a=r.size-1;a in uY.prototype||Object.defineProperty(uY.prototype,a,{get(){return[...uK(this).trackSet][a]}}),queueMicrotask(()=>{i.dispatchEvent(new uG("addtrack",{track:t}))})}function uj(e){let t=uK(e).media?.videoTracks;t&&(uK(t).trackSet.delete(e),queueMicrotask(()=>{t.dispatchEvent(new uG("removetrack",{track:e}))}))}class uY extends EventTarget{#D;#x;#P;constructor(){super(),uK(this).trackSet=new Set}get #M(){return uK(this).trackSet}[Symbol.iterator](){return this.#M.values()}get length(){return this.#M.size}getTrackById(e){return[...this.#M].find(t=>t.id===e)??null}get selectedIndex(){return[...this.#M].findIndex(e=>e.selected)}get onaddtrack(){return this.#D}set onaddtrack(e){this.#D&&(this.removeEventListener("addtrack",this.#D),this.#D=void 0),"function"==typeof e&&(this.#D=e,this.addEventListener("addtrack",e))}get onremovetrack(){return this.#x}set onremovetrack(e){this.#x&&(this.removeEventListener("removetrack",this.#x),this.#x=void 0),"function"==typeof e&&(this.#x=e,this.addEventListener("removetrack",e))}get onchange(){return this.#P}set onchange(e){this.#P&&(this.removeEventListener("change",this.#P),this.#P=void 0),"function"==typeof e&&(this.#P=e,this.addEventListener("change",e))}}class uz extends Event{rendition;constructor(e,t){super(e),this.rendition=t.rendition}}function uX(e){return[...uK(e).media.videoTracks].filter(e=>e.selected).flatMap(e=>[...uK(e).renditionSet])}class uQ extends EventTarget{#O;#N;#P;[Symbol.iterator](){return uX(this).values()}get length(){return uX(this).length}getRenditionById(e){return uX(this).find(t=>`${t.id}`==`${e}`)??null}get selectedIndex(){return uX(this).findIndex(e=>e.selected)}set selectedIndex(e){for(let[t,i]of uX(this).entries())i.selected=t===e}get onaddrendition(){return this.#O}set onaddrendition(e){this.#O&&(this.removeEventListener("addrendition",this.#O),this.#O=void 0),"function"==typeof e&&(this.#O=e,this.addEventListener("addrendition",e))}get onremoverendition(){return this.#N}set onremoverendition(e){this.#N&&(this.removeEventListener("removerendition",this.#N),this.#N=void 0),"function"==typeof e&&(this.#N=e,this.addEventListener("removerendition",e))}get onchange(){return this.#P}set onchange(e){this.#P&&(this.removeEventListener("change",this.#P),this.#P=void 0),"function"==typeof e&&(this.#P=e,this.addEventListener("change",e))}}class uZ{src;id;width;height;bitrate;frameRate;codec;#U=!1;get selected(){return this.#U}set selected(e){if(this.#U!==e){var t;let i;this.#U=e,t=this,(i=uK(t).media.videoRenditions)&&!uK(i).changeRequested&&(uK(i).changeRequested=!0,queueMicrotask(()=>{delete uK(i).changeRequested,uK(t).track.selected&&i.dispatchEvent(new Event("change"))}))}}}class uJ{id;kind;label="";language="";sourceBuffer;#U=!1;addRendition(e,t,i,r,a,s){var n;let o,l,d,u=new uZ;return u.src=e,u.width=t,u.height=i,u.frameRate=s,u.bitrate=a,u.codec=r,n=this,o=uK(n).media.videoRenditions,uK(u).media=uK(n).media,uK(u).track=n,(l=uK(n).renditionSet).add(u),(d=l.size-1)in uQ.prototype||Object.defineProperty(uQ.prototype,d,{get(){return uX(this)[d]}}),queueMicrotask(()=>{n.selected&&o.dispatchEvent(new uz("addrendition",{rendition:u}))}),u}removeRendition(e){let t,i;t=uK(e).media.videoRenditions,i=uK(e).track,uK(i).renditionSet.delete(e),queueMicrotask(()=>{uK(e).track.selected&&t.dispatchEvent(new uz("removerendition",{rendition:e}))})}get selected(){return this.#U}set selected(e){this.#U===e||(this.#U=e,!0===e&&function(e){let t=uK(e).media.videoTracks??[],i=!1;for(let r of t)r!==e&&(r.selected=!1,i=!0);if(i){if(uK(t).changeRequested)return;uK(t).changeRequested=!0,queueMicrotask(()=>{delete uK(t).changeRequested,t.dispatchEvent(new Event("change"))})}}(this))}}function u0(e){return[...uK(e).media.audioTracks].filter(e=>e.enabled).flatMap(e=>[...uK(e).renditionSet])}
112class u1 extends EventTarget{#O;#N;#P;[Symbol.iterator](){return u0(this).values()}get length(){return u0(this).length}getRenditionById(e){return u0(this).find(t=>`${t.id}`==`${e}`)??null}get selectedIndex(){return u0(this).findIndex(e=>e.selected)}set selectedIndex(e){for(let[t,i]of u0(this).entries())i.selected=t===e}get onaddrendition(){return this.#O}set onaddrendition(e){this.#O&&(this.removeEventListener("addrendition",this.#O),this.#O=void 0),"function"==typeof e&&(this.#O=e,this.addEventListener("addrendition",e))}get onremoverendition(){return this.#N}set onremoverendition(e){this.#N&&(this.removeEventListener("removerendition",this.#N),this.#N=void 0),"function"==typeof e&&(this.#N=e,this.addEventListener("removerendition",e))}get onchange(){return this.#P}set onchange(e){this.#P&&(this.removeEventListener("change",this.#P),this.#P=void 0),"function"==typeof e&&(this.#P=e,this.addEventListener("change",e))}}class u2{src;id;bitrate;codec;#U=!1;get selected(){return this.#U}set selected(e){if(this.#U!==e){var t;let i;this.#U=e,t=this,(i=uK(t).media.audioRenditions)&&!uK(i).changeRequested&&(uK(i).changeRequested=!0,queueMicrotask(()=>{delete uK(i).changeRequested,uK(t).track.enabled&&i.dispatchEvent(new Event("change"))}))}}}function u3(e,t){let i=e.audioTracks;uK(t).media=e,uK(t).renditionSet||(uK(t).renditionSet=new Set);let r=uK(i).trackSet;r.add(t);let a=r.size-1;a in u5.prototype||Object.defineProperty(u5.prototype,a,{get(){return[...uK(this).trackSet][a]}}),queueMicrotask(()=>{i.dispatchEvent(new uG("addtrack",{track:t}))})}function u4(e){let t=uK(e).media?.audioTracks;t&&(uK(t).trackSet.delete(e),queueMicrotask(()=>{t.dispatchEvent(new uG("removetrack",{track:e}))}))}class u5 extends EventTarget{#D;#x;#P;constructor(){super(),uK(this).trackSet=new Set}get #M(){return uK(this).trackSet}[Symbol.iterator](){return this.#M.values()}get length(){return this.#M.size}getTrackById(e){return[...this.#M].find(t=>t.id===e)??null}get onaddtrack(){return this.#D}set onaddtrack(e){this.#D&&(this.removeEventListener("addtrack",this.#D),this.#D=void 0),"function"==typeof e&&(this.#D=e,this.addEventListener("addtrack",e))}get onremovetrack(){return this.#x}set onremovetrack(e){this.#x&&(this.removeEventListener("removetrack",this.#x),this.#x=void 0),"function"==typeof e&&(this.#x=e,this.addEventListener("removetrack",e))}get onchange(){return this.#P}set onchange(e){this.#P&&(this.removeEventListener("change",this.#P),this.#P=void 0),"function"==typeof e&&(this.#P=e,this.addEventListener("change",e))}}class u8{id;kind;label="";language="";sourceBuffer;#F=!1;addRendition(e,t,i){var r;let a,s,n,o=new u2;return o.src=e,o.codec=t,o.bitrate=i,r=this,a=uK(r).media.audioRenditions,uK(o).media=uK(r).media,uK(o).track=r,(s=uK(r).renditionSet).add(o),(n=s.size-1)in u1.prototype||Object.defineProperty(u1.prototype,n,{get(){return u0(this)[n]}}),queueMicrotask(()=>{r.enabled&&a.dispatchEvent(new uz("addrendition",{rendition:o}))}),o}removeRendition(e){let t,i;t=uK(e).media.audioRenditions,i=uK(e).track,uK(i).renditionSet.delete(e),queueMicrotask(()=>{uK(e).track.enabled&&t.dispatchEvent(new uz("removerendition",{rendition:e}))})}get enabled(){return this.#F}set enabled(e){if(this.#F!==e){let t;this.#F=e,(t=uK(this).media.audioTracks)&&!uK(t).changeRequested&&(uK(t).changeRequested=!0,queueMicrotask(()=>{delete uK(t).changeRequested,t.dispatchEvent(new Event("change"))}))}}}let u9=he(globalThis.HTMLMediaElement,"video"),u6=he(globalThis.HTMLMediaElement,"audio");function u7(e){if(!e?.prototype)return e;let t=he(e,"video");(!t||`${t}`.includes("[native code]"))&&Object.defineProperty(e.prototype,"videoTracks",{get(){var e=this;let t=uK(e).videoTracks;if(!t&&(t=new uY,uK(e).videoTracks=t,u9)){let i=u9.call(e.nativeEl??e);for(let t of i)uq(e,t);i.addEventListener("change",()=>{t.dispatchEvent(new Event("change"))}),i.addEventListener("addtrack",r=>{if([...t].some(e=>e instanceof uJ)){for(let e of i)uj(e);return}uq(e,r.track)}),i.addEventListener("removetrack",e=>{uj(e.track)})}return t}});let i=he(e,"audio");(!i||`${i}`.includes("[native code]"))&&Object.defineProperty(e.prototype,"audioTracks",{get(){var e=this;let t=uK(e).audioTracks;
112if(!t&&(t=new u5,uK(e).audioTracks=t,u6)){let i=u6.call(e.nativeEl??e);for(let t of i)u3(e,t);i.addEventListener("change",()=>{t.dispatchEvent(new Event("change"))}),i.addEventListener("addtrack",r=>{if([...t].some(e=>e instanceof u8)){for(let e of i)u4(e);return}u3(e,r.track)}),i.addEventListener("removetrack",e=>{u4(e.track)})}return t}}),"addVideoTrack"in e.prototype||(e.prototype.addVideoTrack=function(e,t="",i=""){let r=new uJ;return r.kind=e,r.label=t,r.language=i,uq(this,r),r}),"removeVideoTrack"in e.prototype||(e.prototype.removeVideoTrack=uj),"addAudioTrack"in e.prototype||(e.prototype.addAudioTrack=function(e,t="",i=""){let r=new u8;return r.kind=e,r.label=t,r.language=i,u3(this,r),r}),"removeAudioTrack"in e.prototype||(e.prototype.removeAudioTrack=u4),"videoRenditions"in e.prototype||Object.defineProperty(e.prototype,"videoRenditions",{get(){return r(this)}});let r=e=>{let t=uK(e).videoRenditions;return t||(uK(t=new uQ).media=e,uK(e).videoRenditions=t),t};"audioRenditions"in e.prototype||Object.defineProperty(e.prototype,"audioRenditions",{get(){return a(this)}});let a=e=>{let t=uK(e).audioRenditions;return t||(uK(t=new u1).media=e,uK(e).audioRenditions=t),t};return e}function he(e,t){if(e?.prototype)return Object.getOwnPropertyDescriptor(e.prototype,`${t}Tracks`)?.get}var ht=e=>{throw TypeError(e)},hi=(e,t,i)=>t.has(e)||ht("Cannot "+i),hr=(e,t,i)=>(hi(e,t,"read from private field"),i?i.call(e):t.get(e)),ha=(e,t,i)=>t.has(e)?ht("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),hs=(e,t,i,r)=>(hi(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),hn=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};"u"<typeof DocumentFragment&&(globalThis.DocumentFragment=class extends hn{});var ho,hl,hd=class extends hn{},hu=class{constructor(e,t={}){ha(this,hl),hs(this,hl,null==t?void 0:t.detail)}get detail(){return hr(this,hl)}initCustomEvent(){}};hl=new WeakMap;var hh={document:{createElement:function(e,t){return new hd}},DocumentFragment,customElements:{get(e){},define(e,t,i){},getName:e=>null,upgrade(e){},whenDefined:e=>Promise.resolve(hd)},CustomEvent:hu,EventTarget:hn,HTMLElement:hd,HTMLVideoElement:class extends hn{}},hc="u"<typeof window||void 0===globalThis.customElements,hm=hc?hh:globalThis;hc&&hh.document;var hf,hp=class extends uV(u7(uL)){constructor(){super(...arguments),ha(this,hf)}get autoplay(){let e=this.getAttribute("autoplay");return null!==e&&(""===e||e)}set autoplay(e){e!==this.autoplay&&(e?this.setAttribute("autoplay","string"==typeof e?e:""):this.removeAttribute("autoplay"))}get 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 e;return null!=(e=hr(this,hf))?e:this.muxCastCustomData}set castCustomData(e){hs(this,hf,e)}};hf=new WeakMap,hm.customElements.get("mux-video")||(hm.customElements.define("mux-video",hp),hm.MuxVideoElement=hp);let hg={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:"mediash
112owsubtitlesrequest",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"},hv={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},hy={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
112LAYED:"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"},hE=Object.entries(hy),hb=hE.reduce((e,[t,i])=>(e[t]=i.toLowerCase(),e),{}),hT=hE.reduce((e,[t,i])=>(e[t]=i.toLowerCase(),e),{USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"}),hA=Object.entries(hT).reduce((e,[t,i])=>{let r=hb[t];return r&&(e[i]=r),e},{userinactivechange:"userinactive"}),h_=Object.entries(hb).reduce((e,[t,i])=>{let r=hT[t];return r&&(e[i]=r),e},{userinactive:"userinactivechange"}),hS={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},hk={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"},hL={HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4},hw={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},hR={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},hI={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"},hC={HIGH:"high",MEDIUM:"medium",LOW:"low",OFF:"off"},hD={INLINE:"inline",FULLSCREEN:"fullscreen",PICTURE_IN_PICTURE:"picture-in-picture"};function hx(e){if(e){let{id:t,width:i,height:r}=e;return[t,i,r].filter(e=>null!=e).join(":")}}function hP(e){if(e){let[t,i,r]=e.split(":");return{id:t,width:+i,height:+r}}}function hM(e){if(e){let{id:t,kind:i,language:r,label:a}=e;return[t,i,r,a].filter(e=>null!=e).join(":")}}function hO(e){if(e){let[t,i,r,a]=e.split(":");return{id:t,kind:i,language:r,label:a}}}function hN(e){return"number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)}function hU(e){return"string"==typeof e&&!isNaN(e)&&!isNaN(parseFloat(e))}e.s(["AttributeToStateChangeEventMap",()=>h_,"AvailabilityStates",()=>hR,"MediaStateChangeEvents",()=>hT,"MediaStateReceiverAttributes",()=>hv,"MediaUIAttributes",()=>hb,"MediaUIEvents",()=>hg,"MediaUIProps",()=>hy,"PointerTypes",()=>hw,"ReadyStates",()=>hL,"StateChangeEventToAttributeMap",()=>hA,"StreamTypes",()=>hI,"TextTrackKinds",()=>hS,"TextTrackModes",()=>hk,"VolumeLevels",()=>hC,"WebkitPresentationModes",()=>hD],92617),e.i(92617);let hF=e=>new Promise(t=>setTimeout(t,e)),hB=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],h$=e=>{if(!hN(e))return"";let t=Math.abs(e),i=t!==e,r=new Date(0,0,0,0,0,t,0),a=[r.getHours(),r.getMinutes(),r.getSeconds()].map((e,t)=>{let i;return e&&(i=1===e?hB[t].singular:hB[t].plural,`${e} ${i}`)}).filter(e=>e).join(", ");return`${a}${i?" remaining":""}`};function hH(e,t){let i=!1;e<0&&(i=!0,e=0-e);let r=Math.floor((e=e<0?0:e)%60),a=Math.floor(e/60%60),s=Math.floor(e/3600),n=Math.floor(t/60%60),o=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(s=a=r="0"),a=(((s=s>
1120||o>0?s+":":"")||n>=10)&&a<10?"0"+a:a)+":",(i?"-":"")+s+a+(r=r<10?"0"+r:r)}let hV=Object.freeze({length:0,start(e){let t=e>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(e){let t=e>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0}});function hG(e=hV){return Array.from(e).map((t,i)=>[Number(e.start(i).toFixed(3)),Number(e.end(i).toFixed(3))].join(":")).join(" ")}e.s(["emptyTimeRanges",()=>hV,"formatAsTimePhrase",()=>h$,"formatTime",()=>hH,"serializeTimeRanges",()=>hG],38333),e.i(38333);let hW={en:{"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","Source Not Supported":"Source Not Supported","Encryption Error":"Encryption
112Error","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."}},hK=(null==(vP=globalThis.navigator)?void 0:vP.language)||"en",hq=(e,t={})=>(e=>{var t,i,r;let[a]=hK.split("-");return(null==(t=hW[hK])?void 0:t[e])||(null==(i=hW[a])?void 0:i[e])||(null==(r=hW.en)?void 0:r[e])||e})(e).replace(/\{(\w+)\}/g,(e,i)=>i in t?String(t[i]):`{${i}}`);class hj{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}}class hY extends hj{}class hz extends hY{constructor(){super(...arguments),this.role=null}}let hX={createElement:function(){return new hQ.HTMLElement},createElementNS:function(){return new hQ.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent:e=>!1},hQ={ResizeObserver:class{observe(){}unobserve(){}disconnect(){}},document:hX,Node:hY,Element:hz,HTMLElement:class extends hz{constructor(){super(...arguments),this.innerHTML=""}get content(){return new hQ.DocumentFragment}},DocumentFragment:class extends hj{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},localStorage:{getItem:e=>null,setItem(e,t){},removeItem(e){}},CustomEvent:function(){},getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return""}},matchMedia:e=>({matches:!1,media:e}),DOMParser:class{parseFromString(e,t){return{body:{textContent:e}}}}},hZ="global"in globalThis&&(null==globalThis?void 0:globalThis.global)===globalThis||"u"<typeof window||void 0===window.customElements,hJ=Object.keys(hQ).every(e=>e in globalThis),h0=hZ&&!hJ?hQ:globalThis,h1=hZ&&!hJ?hX:globalThis.document,h2=new WeakMap,h3=e=>{let t=h2.get(e);return t||h2.set(e,t=new Set),t},h4=new h0.ResizeObserver(e=>{for(let t of e)for(let e of h3(t.target))e(t)});function h5(e,t){h3(e).add(t),h4.observe(e)}function h8(e,t){let i=h3(e);i.delete(t),i.size||h4.unobserve(e)}function h9(e){let t={};for(let i of e)t[i.name]=i.value;return t}function h6(e){var t;return null!=(t=h7(e))?t:cr(e,"media-controller")}function h7(e){var t;let{MEDIA_CONTROLLER:i}=hv,r=e.getAttribute(i);if(r)return null==(t=cs(e))?void 0:t.getElementById(r)}let ce=(e,t,i=".value")=>{let r=e.querySelector(i);r&&(r.textContent=t)},ct=(e,t)=>{let i,r;return(i=`slot[name="${t}"]`,!(r=e.shadowRoot.querySelector(i))?[]:r.children)[0]},ci=(e,t)=>!!e&&!!t&&(null!=e&&!!e.contains(t)||ci(e,t.getRootNode().host)),cr=(e,t)=>{if(!e)return null;let i=e.closest(t);return i||cr(e.getRootNode().host,t)};function ca(e=document){var t;let i=null==e?void 0:e.activeElement;return i?null!=(t=ca(i.shadowRoot))?t:i:null}function cs(e){var t;let i=null==(t=null==e?void 0:e.getRootNode)?void 0:t.call(e);return i instanceof ShadowRoot||i instanceof Document?i:null}function cn(e,{depth:t=3,checkOpacity:i=!0,checkVisibilityCSS:r=!0}={}){if(e.checkVisibility)return e.checkVisibility({checkOpacity:i,checkVisibilityCSS:r});let a=e;for(;a&&t>0;){let e=getComputedStyle(a);if(i&&"0"===e.opacity||r&&"hidden"===e.visibility||"none"===e.display)return!1;a=a.parentElement,t--}return!0}function co(e,t){let i=function(e,t){var i,r;let a;for(a of null!=(i=e.querySelectorAll("style:not([media])"))?i:[]){let e;try{e=null==(r=a.sheet)?void 0:r.cssRules}catch{continue}for(let i of null!=e?e:[])if(t(i.selectorText))return i}}(e,e=>e===t);return i||cl(e,t)}function cl(e,t){var i,r;let a=null!=(i=e.querySelectorAll("style:not([media])"))?i:[],s=null==a?void 0:a[a.length-1];return(null==s?void 0:s.sheet)?(null==s||s.sheet.insertRule(`${t}{}`,s.sheet.cssRules.length),null==(r=s.sheet.cssRules)?void 0:r[s.sheet.cssRules.length-1]):(console.warn("Media Chrome: No style sheet found on style tag of",e),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}})}function cd(e,t,i=NaN){let r=e.getAttribute(t);return null!=r?+r:i}function cu(e,t,i){let r=+i;if(null==i||Number.isNaN(r)){e.hasAttribute(t)&&e.removeAttribute(t);return}cd(e,t,void 0)!==r&&e.setAttribute(t,`${r}`)}function ch(e,t){return e.hasAttribute(t)}function cc(e,t,i){if(null==i){e.hasAttribute(t)&&e.removeAttribute(t);return}ch(e,t)!=i&&e.toggleAttribute(t,i)}function cm(e,t,i=null){var r;return null!=(r=e.getAttribute(t))?r:i}function cf(e,t,i){if(null==i){e.hasAttribute(t)&&e.removeAttribute(t);return}let r=`${i}`;cm(e,t,void 0)!==r&&e.setAttribute(t,r)}var cp=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},cg=(e,t,i)=>(cp(e,t,"read from private field"),i?i.call(e):t.get(e)),cv=(e,t,i,r)=>(cp(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);class cy extends h0.HTMLElement{constructor(){if(super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,vM,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=h9(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[hv.MEDIA_CONTROLLER,hb.MEDIA_PAUSED]}attributeChangedCallback(e,t,i){var r,a,s,n,o;e===hv.MEDIA_CONTROLLER&&(t&&(null==(a=null==(r=cg(this,vM))?void 0:r.unassociateElement)||a.call(r,this),cv(this,vM,null)),i&&this.isConnected&&(cv(this,vM,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=cg(this,vM))?void 0:n.associateElement)||o.call(n,this)))}connectedCallback(){var e,t,i,r,a,s;let n;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),cv(this,vM,(a=this,(n=a.getAttribute(hv.MEDIA_CONTROLLER))?null==(s=a.getRootNode())?void 0:s.getElementById(n):cr(a,"media-controller"))),this.getAttribute(hv.MEDIA_CONTROLLER)&&(null==(t=null==(e=cg(this,vM))?void 0:e.associateElement)||t.call(e,this)),null==(i=cg(this,vM))||i.addEventListener("pointerdown",this),null==(r=cg(this,vM))||r.addEventListener("click",this)}disconnectedCallback(){var e,t,i,r;this.getAttribute(hv.MEDIA_CONTROLLER)&&(null==(t=null==(e=cg(this,vM))?void 0:e.unassociateElement)||t.call(e,this)),null==(i=cg(this,vM))||i.removeEventListener("pointerdown",this),null==(r=cg(this,vM))||r.removeEventListener("click",this),cv(this,vM,null)}handleEvent(e){var t;let i=null==(t=e.composedPath())?void 0:t[0];if(["video","media-controller"].includes(null==i?void 0:i.localName)){if("pointerdown"===e.type)this._pointerType=e.pointerType;else if("click"===e.type){let{clientX:t,clientY:i}=e,{left:r,top:a,width:s,height:n}=this.getBoundingClientRect(),o=t-r,l=i-a;if(o<0||l<0||o>s||l>n||0===s&&0===n)return;let d=this._pointerType||"mouse";if(this._pointerType=void 0,d===hw.TOUCH)return void this.handleTap(e);if(d===hw.MOUSE||d===hw.PEN)return void this.handleMouseClick(e)}}}get mediaPaused(){return ch(this,hb.MEDIA_PAUSED)}set mediaPaused(e){cc(this,hb.MEDIA_PAUSED,e)}handleTap(e){}handleMouseClick(e){let t=this.mediaPaused?hg.MEDIA_PLAY_REQUEST:hg.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new h0.CustomEvent(t,{composed:!0,bubbles:!0}))}}vM=new WeakMap,cy.shadowRootOptions={mode:"open"},cy.getTemplateHTML=function(e){return` 113 <style> 114 :host { 115 display: var(--media-control-display, var(--media-gesture-receiver-display, inline-block)); 116 box-sizing: border-box; 117 } 118 </style> 119 `},h0.customElements.get("media-gesture-receiver")||h0.customElements.define("media-gesture-receiver",cy);var cE=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},cb=(e,t,i)=>(cE(e,t,"read from private field"),i?i.call(e):t.get(e)),cT=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},cA=(e,t,i,r)=>(cE(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),c_=(e,t,i)=>(cE(e,t,"access private method"),i);let cS="audio",ck="autohide",cL="breakpoints",cw="gesturesdisabled",cR="keyboardcontrol",cI="noautohide",cC="userinactive",cD="autohideovercontrols",cx=Object.values(hb);function cP(e,t){var i,r,a;if(!e.isConnected)return;let s=Object.fromEntries((null!=(i=e.getAttribute(cL))?i:"sm:384 md:576 lg:768 xl:960").split(/\s+/).map(e=>e.split(":"))),n=(r=s,a=t,Object.keys(r).filter(e=>a>=parseInt(r[e]))),o=!1;
119if(Object.keys(s).forEach(t=>{if(n.includes(t)){e.hasAttribute(`breakpoint${t}`)||(e.setAttribute(`breakpoint${t}`,""),o=!0);return}e.hasAttribute(`breakpoint${t}`)&&(e.removeAttribute(`breakpoint${t}`),o=!0)}),o){let t=new CustomEvent(hT.BREAKPOINTS_CHANGE,{detail:n});e.dispatchEvent(t)}e.breakpointsComputed||(e.breakpointsComputed=!0,e.dispatchEvent(new CustomEvent(hT.BREAKPOINTS_COMPUTED,{bubbles:!0,composed:!0})))}class cM extends h0.HTMLElement{constructor(){if(super(),cT(this,v$),cT(this,vW),cT(this,vq),cT(this,vY),cT(this,vX),cT(this,vZ),cT(this,vO,0),cT(this,vN,null),cT(this,vU,null),cT(this,vF,void 0),this.breakpointsComputed=!1,cT(this,vB,new MutationObserver(c_(this,v$,vH).bind(this))),cT(this,vV,!1),cT(this,vG,e=>{cb(this,vV)||(setTimeout(()=>{cP(e.target,e.contentRect.width),cA(this,vV,!1)},0),cA(this,vV,!0))}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=h9(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}const e=this.querySelector(":scope > slot[slot=media]");e&&e.addEventListener("slotchange",()=>{if(!e.assignedElements({flatten:!0}).length){cb(this,vN)&&this.mediaUnsetCallback(cb(this,vN));return}this.handleMediaUpdated(this.media)})}static get observedAttributes(){return[ck,cw].concat(cx).filter(e=>![hb.MEDIA_RENDITION_LIST,hb.MEDIA_AUDIO_TRACK_LIST,hb.MEDIA_CHAPTERS_CUES,hb.MEDIA_WIDTH,hb.MEDIA_HEIGHT,hb.MEDIA_ERROR,hb.MEDIA_ERROR_MESSAGE].includes(e))}attributeChangedCallback(e,t,i){e.toLowerCase()==ck&&(this.autohide=i)}get media(){let e=this.querySelector(":scope > [slot=media]");return(null==e?void 0:e.nodeName)=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}async handleMediaUpdated(e){e&&(cA(this,vN,e),e.localName.includes("-")&&await h0.customElements.whenDefined(e.localName),this.mediaSetCallback(e))}connectedCallback(){var e;cb(this,vB).observe(this,{childList:!0,subtree:!0}),h5(this,cb(this,vG));let t=null!=this.getAttribute(cS)?hq("audio player"):hq("video player");this.setAttribute("role","region"),this.setAttribute("aria-label",t),this.handleMediaUpdated(this.media),this.setAttribute(cC,""),cP(this,this.getBoundingClientRect().width),this.addEventListener("pointerdown",this),this.addEventListener("pointermove",this),this.addEventListener("pointerup",this),this.addEventListener("mouseleave",this),this.addEventListener("keyup",this),null==(e=h0.window)||e.addEventListener("mouseup",this)}disconnectedCallback(){var e;cb(this,vB).disconnect(),h8(this,cb(this,vG)),this.media&&this.mediaUnsetCallback(this.media),null==(e=h0.window)||e.removeEventListener("mouseup",this)}mediaSetCallback(e){}mediaUnsetCallback(e){cA(this,vN,null)}handleEvent(e){switch(e.type){case"pointerdown":cA(this,vO,e.timeStamp);break;case"pointermove":c_(this,vW,vK).call(this,e);break;case"pointerup":c_(this,vq,vj).call(this,e);break;case"mouseleave":c_(this,vY,vz).call(this);break;case"mouseup":this.removeAttribute(cR);break;case"keyup":c_(this,vZ,vJ).call(this),this.setAttribute(cR,"")}}set autohide(e){let t=Number(e);cA(this,vF,isNaN(t)?0:t)}get autohide(){return(void 0===cb(this,vF)?2:cb(this,vF)).toString()}get breakpoints(){return cm(this,cL)}set breakpoints(e){cf(this,cL,e)}get audio(){return ch(this,cS)}set audio(e){cc(this,cS,e)}get gesturesDisabled(){return ch(this,cw)}set gesturesDisabled(e){cc(this,cw,e)}get keyboardControl(){return ch(this,cR)}set keyboardControl(e){cc(this,cR,e)}get noAutohide(){return ch(this,cI)}set noAutohide(e){cc(this,cI,e)}get autohideOverControls(){return ch(this,cD)}set autohideOverControls(e){cc(this,cD,e)}get userInteractive(){return ch(this,cC)}set userInteractive(e){cc(this,cC,e)}}vO=new WeakMap,vN=new WeakMap,vU=new WeakMap,vF=new WeakMap,vB=new WeakMap,v$=new WeakSet,vH=function(e){let t=this.media;for(let i of e)if("childList"===i.type){for(let e of i.removedNodes){if("media"!=e.slot||i.target!=this)continue;let r=i.previousSibling&&i.previousSibling.previousElementSibling;if(r&&t){let t="media"!==r.slot;for(;null!==(r=r.previousSibling);)"media"==r.slot&&(t=!1);t&&this.mediaUnsetCallback(e)}else this.mediaUnsetCallback(e)}if(t)for(let e of i.addedNodes)e===t&&this.handleMediaUpdated(t)}},vV=new WeakMap,vG=new WeakMap,vW=new WeakSet,vK=function(e){if("mouse"!==e.pointerType&&e.timeStamp-cb(this,vO)<250)return;c_(this,vX,vQ).call(this),clearTimeout(cb(this,vU));let t=this.hasAttribute(cD);([this,this.media].includes(e.target)||t)&&c_(this,vZ,vJ).call(this)},vq=new WeakSet,vj=function(e){if("touch"===e.pointerType){let t=!this.hasAttribute(cC);[this,this.media].includes(e.target)&&t?c_(this,vY,vz).call(this):c_(this,vZ,vJ).call(this)}else e.composedPath().some(e=>["media-play-button","media-fullscreen-button"].includes(null==e?void 0:e.localName))&&c_(this,vZ,vJ).call(this)}
119,vY=new WeakSet,vz=function(){if(0>cb(this,vF)||this.hasAttribute(cC))return;this.setAttribute(cC,"");let e=new h0.CustomEvent(hT.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(e)},vX=new WeakSet,vQ=function(){if(!this.hasAttribute(cC))return;this.removeAttribute(cC);let e=new h0.CustomEvent(hT.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(e)},vZ=new WeakSet,vJ=function(){c_(this,vX,vQ).call(this),clearTimeout(cb(this,vU));let e=parseInt(this.autohide);e<0||cA(this,vU,setTimeout(()=>{c_(this,vY,vz).call(this)},1e3*e))},cM.shadowRootOptions={mode:"open"},cM.getTemplateHTML=function(e){return` 120 <style> 121 122 :host([${hb.MEDIA_IS_FULLSCREEN}]) ::slotted([slot=media]) { 123 outline: none; 124 } 125 126 :host { 127 box-sizing: border-box; 128 position: relative; 129 display: inline-block; 130 line-height: 0; 131 background-color: var(--media-background-color, #000); 132 overflow: hidden; 133 } 134 135 :host(:not([${cS}])) [part~=layer]:not([part~=media-layer]) { 136 position: absolute; 137 top: 0; 138 left: 0; 139 bottom: 0; 140 right: 0; 141 display: flex; 142 flex-flow: column nowrap; 143 align-items: start; 144 pointer-events: none; 145 background: none; 146 } 147 148 slot[name=media] { 149 display: var(--media-slot-display, contents); 150 } 151 152 153 :host([${cS}]) slot[name=media] { 154 display: var(--media-slot-display, none); 155 } 156 157 158 :host([${cS}]) [part~=layer][part~=gesture-layer] { 159 height: 0; 160 display: block; 161 } 162 163 164 :host(:not([${cS}])[${cw}]) ::slotted([slot=gestures-chrome]), 165 :host(:not([${cS}])[${cw}]) media-gesture-receiver[slot=gestures-chrome] { 166 display: none; 167 } 168 169 170 ::slotted(:not([slot=media]):not([slot=poster]):not(media-loading-indicator):not([role=dialog]):not([hidden])) { 171 pointer-events: auto; 172 } 173 174 :host(:not([${cS}])) *[part~=layer][part~=centered-layer] { 175 align-items: center; 176 justify-content: center; 177 } 178 179 :host(:not([${cS}])) ::slotted(media-gesture-receiver[slot=gestures-chrome]), 180 :host(:not([${cS}])) media-gesture-receiver[slot=gestures-chrome] { 181 align-self: stretch; 182 flex-grow: 1; 183 } 184 185 slot[name=middle-chrome] { 186 display: inline; 187 flex-grow: 1; 188 pointer-events: none; 189 background: none; 190 } 191 192 193 ::slotted([slot=media]), 194 ::slotted([slot=poster]) { 195 width: 100%; 196 height: 100%; 197 } 198 199 200 :host(:not([${cS}])) .spacer { 201 flex-grow: 1; 202 } 203 204 205 :host(:-webkit-full-screen) { 206 207 width: 100% !important; 208 height: 100% !important; 209 } 210 211 212 ::slotted(:not([slot=media]):not([slot=poster]):not([${cI}]):not([hidden]):not([role=dialog])) { 213 opacity: 1; 214 transition: var(--media-control-transition-in, opacity 0.25s); 215 } 216 217 218 :host([${cC}]:not([${hb.MEDIA_PAUSED}]):not([${hb.MEDIA_IS_AIRPLAYING}]):not([${hb.MEDIA_IS_CASTING}]):not([${cS}])) ::slotted(:not([slot=media]):not([slot=poster]):not([${cI}]):not([role=dialog])) { 219 opacity: 0; 220 transition: var(--media-control-transition-out, opacity 1s); 221 } 222 223 :host([${cC}]:not([${cI}]):not([${hb.MEDIA_PAUSED}]):not([${hb.MEDIA_IS_CASTING}]):not([${cS}])) ::slotted([slot=media]) { 224 cursor: none; 225 } 226 227 :host([${cC}][${cD}]:not([${cI}]):not([${hb.MEDIA_PAUSED}]):not([${hb.MEDIA_IS_CASTING}]):not([${cS}])) * { 228 --media-cursor: none; 229 cursor: none; 230 } 231 232 233 ::slotted(media-control-bar) { 234 align-self: stretch; 235 } 236 237 238 :host(:not([${cS}
238])[${hb.MEDIA_HAS_PLAYED}]) slot[name=poster] { 239 display: none; 240 } 241 242 ::slotted([role=dialog]) { 243 width: 100%; 244 height: 100%; 245 align-self: center; 246 } 247 248 ::slotted([role=menu]) { 249 align-self: end; 250 } 251 </style> 252 253 <slot name="media" part="layer media-layer"></slot> 254 <slot name="poster" part="layer poster-layer"></slot> 255 <slot name="gestures-chrome" part="layer gesture-layer"> 256 <media-gesture-receiver slot="gestures-chrome"> 257 <template shadowrootmode="${cy.shadowRootOptions.mode}"> 258 ${cy.getTemplateHTML({})} 259 </template> 260 </media-gesture-receiver> 261 </slot> 262 <span part="layer vertical-layer"> 263 <slot name="top-chrome" part="top chrome"></slot> 264 <slot name="middle-chrome" part="middle chrome"></slot> 265 <slot name="centered-chrome" part="layer centered-layer center centered chrome"></slot> 266 267 <slot part="bottom chrome"></slot> 268 </span> 269 <slot name="dialog" part="layer dialog-layer"></slot> 270 `},h0.customElements.get("media-container")||h0.customElements.define("media-container",cM);var cO=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},cN=(e,t,i)=>(cO(e,t,"read from private field"),i?i.call(e):t.get(e)),cU=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},cF=(e,t,i,r)=>(cO(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);class cB{constructor(e,t,{defaultValue:i}={defaultValue:void 0}){cU(this,v4),cU(this,v0,void 0),cU(this,v1,void 0),cU(this,v2,void 0),cU(this,v3,new Set),cF(this,v0,e),cF(this,v1,t),cF(this,v2,new Set(i))}[Symbol.iterator](){return cN(this,v4,v5).values()}get length(){return cN(this,v4,v5).size}get value(){var e;return null!=(e=[...cN(this,v4,v5)].join(" "))?e:""}set value(e){var t;e!==this.value&&(cF(this,v3,new Set),this.add(...null!=(t=null==e?void 0:e.split(" "))?t:[]))}toString(){return this.value}item(e){return[...cN(this,v4,v5)][e]}values(){return cN(this,v4,v5).values()}forEach(e,t){cN(this,v4,v5).forEach(e,t)}add(...e){var t,i;e.forEach(e=>cN(this,v3).add(e)),(""!==this.value||(null==(t=cN(this,v0))?void 0:t.hasAttribute(`${cN(this,v1)}`)))&&(null==(i=cN(this,v0))||i.setAttribute(`${cN(this,v1)}`,`${this.value}`))}remove(...e){var t;e.forEach(e=>cN(this,v3).delete(e)),null==(t=cN(this,v0))||t.setAttribute(`${cN(this,v1)}`,`${this.value}`)}contains(e){return cN(this,v4,v5).has(e)}toggle(e,t){if(void 0!==t)if(t)return this.add(e),!0;else return this.remove(e),!1;return this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){return this.remove(e),this.add(t),e===t}}v0=new WeakMap,v1=new WeakMap,v2=new WeakMap,v3=new WeakMap,v4=new WeakSet,v5=function(){return cN(this,v3).size?cN(this,v3):cN(this,v2)};let c$=(e="")=>{let[t,i,r]=e.split(":"),a=r?decodeURIComponent(r):void 0;return{kind:"cc"===t?hS.CAPTIONS:hS.SUBTITLES,language:i,label:a}},cH=(e="",t={})=>((e="")=>e.split(/\s+/))(e).map(e=>{let i=c$(e);return{...t,...i}}),cV=e=>e?Array.isArray(e)?e.map(e=>"string"==typeof e?c$(e):e):"string"==typeof e?cH(e):[e]:[],cG=({kind:e,label:t,language:i}={kind:"subtitles"})=>t?`${"captions"===e?"cc":"sb"}:${i}:${encodeURIComponent(t)}`:i,cW=(e=[])=>Array.prototype.map.call(e,cG).join(" "),cK=e=>{let t=Object.entries(e).map(([e,t])=>i=>i[e]===t);return e=>t.every(t=>t(e))},cq=(e,t=[],i=[])=>{let r=cV(i).map(cK);Array.from(t).filter(e=>r.some(t=>t(e))).forEach(t=>{t.mode=e})},cj=(e,t=()=>!0)=>{if(!(null==e?void 0:e.textTracks))return[];let i="function"==typeof t?t:cK(t);return Array.from(e.textTracks).filter(i)},cY=e=>{var t;return!!(null==(t=e.mediaSubtitlesShowing)?void 0:t.length)||e.hasAttribute(hb.MEDIA_SUBTITLES_SHOWING)},cz="exitFullscreen"in h1?"exitFullscreen":"webkitExitFullscreen"in h1?"webkitExitFullscreen":"webkitCancelFullScreen"in h1?"webkitCancelFullScreen":void 0,cX="fullscreenElement"in h1?"fullscreenElement":"webkitFullscreenElement"in h1?"webkitFullscreenElement":void 0,cQ="fullscreenEnabled"in h1?"fullscreenEnabled":"webkitFullscreenEnabled"in h1?"webkitFullscreenEnabled":void 0,cZ=()=>{var e;return r||(r=null==(e=null==h1?void 0:h1.createElement)?void 0:e.call(h1,"video"))},cJ=async(e=cZ())=>{if(!e)return!1;let t=e.volume;
270e.volume=t/2+.1;let i=new AbortController,r=await Promise.race([c0(e,i.signal),c1(e,t)]);return i.abort(),r},c0=(e,t)=>new Promise(i=>{e.addEventListener("volumechange",()=>i(!0),{signal:t})}),c1=async(e,t)=>{for(let i=0;i<10;i++){if(e.volume===t)return!1;await hF(10)}return e.volume!==t},c2=/.*Version\/.*Safari\/.*/.test(h0.navigator.userAgent),c3=(e=cZ())=>(!h0.matchMedia("(display-mode: standalone)").matches||!c2)&&"function"==typeof(null==e?void 0:e.requestPictureInPicture),c4=(e=cZ())=>(e=>{let{documentElement:t,media:i}=e;return!!(null==t?void 0:t[cQ])||i&&"webkitSupportsFullscreen"in i})({documentElement:h1,media:e}),c5=c4(),c8=c3(),c9=!!h0.WebKitPlaybackTargetAvailabilityEvent,c6=!!h0.chrome,c7=e=>cj(e.media,e=>[hS.SUBTITLES,hS.CAPTIONS].includes(e.kind)).sort((e,t)=>e.kind>=t.kind?1:-1),me=e=>cj(e.media,e=>e.mode===hk.SHOWING&&[hS.SUBTITLES,hS.CAPTIONS].includes(e.kind)),mt=(e,t)=>{let i=c7(e),r=me(e),a=!!r.length;if(i.length){if(!1===t||a&&!0!==t)cq(hk.DISABLED,i,r);else if(!0===t||!a&&!1!==t){let t=i[0],{options:a}=e;if(!(null==a?void 0:a.noSubtitlesLangPref)){let e=globalThis.localStorage.getItem("media-chrome-pref-subtitles-lang"),r=e?[e,...globalThis.navigator.languages]:globalThis.navigator.languages,a=i.filter(e=>r.some(t=>e.language.toLowerCase().startsWith(t.split("-")[0]))).sort((e,t)=>r.findIndex(t=>e.language.toLowerCase().startsWith(t.split("-")[0]))-r.findIndex(e=>t.language.toLowerCase().startsWith(e.split("-")[0])));a[0]&&(t=a[0])}let{language:s,label:n,kind:o}=t;cq(hk.DISABLED,i,r),cq(hk.SHOWING,i,[{language:s,label:n,kind:o}])}}},mi=(e,t)=>e===t||null!=e&&null!=t&&typeof e==typeof t&&(!!("number"==typeof e&&Number.isNaN(e)&&Number.isNaN(t))||"object"==typeof e&&(Array.isArray(e)?mr(e,t):Object.entries(e).every(([e,i])=>e in t&&mi(i,t[e])))),mr=(e,t)=>{let i=Array.isArray(e),r=Array.isArray(t);return i===r&&(!i&&!r||e.length===t.length&&e.every((e,i)=>mi(e,t[i])))},ma=Object.values(hI),ms=cJ().then(e=>a=e),mn=async(...e)=>{await Promise.all(e.filter(e=>e).map(async e=>{if(!("localName"in e&&e instanceof h0.HTMLElement))return;let t=e.localName;if(!t.includes("-"))return;let i=h0.customElements.get(t);i&&e instanceof i||(await h0.customElements.whenDefined(t),h0.customElements.upgrade(e))}))},mo=new h0.DOMParser,ml={mediaError:{get(e,t){let{media:i}=e;if((null==t?void 0:t.type)!=="playing")return null==i?void 0:i.error},mediaEvents:["emptied","error","playing"]},mediaErrorCode:{get(e,t){var i;let{media:r}=e;if((null==t?void 0:t.type)!=="playing")return null==(i=null==r?void 0:r.error)?void 0:i.code},mediaEvents:["emptied","error","playing"]},mediaErrorMessage:{get(e,t){var i,r;let{media:a}=e;if((null==t?void 0:t.type)!=="playing")return null!=(r=null==(i=null==a?void 0:a.error)?void 0:i.message)?r:""},mediaEvents:["emptied","error","playing"]},mediaWidth:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.videoWidth)?t:0},mediaEvents:["resize"]},mediaHeight:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.videoHeight)?t:0},mediaEvents:["resize"]},mediaPaused:{get(e){var t;let{media:i}=e;return null==(t=null==i?void 0:i.paused)||t},set(e,t){var i;let{media:r}=t;r&&(e?r.pause():null==(i=r.play())||i.catch(()=>{}))},mediaEvents:["play","playing","pause","emptied"]},mediaHasPlayed:{get(e,t){let{media:i}=e;return!!i&&(t?"playing"===t.type:!i.paused)},mediaEvents:["playing","emptied"]},mediaEnded:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.ended)&&t},mediaEvents:["seeked","ended","emptied"]},mediaPlaybackRate:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.playbackRate)?t:1},set(e,t){let{media:i}=t;!i||Number.isFinite(+e)&&(i.playbackRate=+e)},mediaEvents:["ratechange","loadstart"]},mediaMuted:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.muted)&&t},set(e,t){let{media:i,options:{noMutedPref:r}={}}=t;if(i){i.muted=e;try{let t=null!==h0.localStorage.getItem("media-chrome-pref-muted"),a=i.hasAttribute("muted");if(r){t&&h0.localStorage.removeItem("media-chrome-pref-muted");return}if(a&&!t)return;h0.localStorage.setItem("media-chrome-pref-muted",e?"true":"false")}catch(e){console.debug("Error setting muted pref",e)}}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(e,t)=>{let{options:{noMutedPref:i}}=t,{media:r}=t;if(r&&!r.muted&&!i)try{let i="true"===h0.localStorage.getItem("media-chrome-pref-muted");ml.mediaMuted.set(i,t),e(i)}catch(e){console.debug("Error getting muted pref",e)}}]},mediaLoop:{get(e){let{media:t}=e;return null==t?void 0:t.loop},set(e,t){let{media:i}=t;i&&(i.loop=e)},mediaEvents:["medialooprequest"]},mediaVolume:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.volume)?t:1},set(e,t){let{media:i,options:{noVolumePref:r}={}}=t;if(i){try{null==e?h0.localStorage.removeItem("media-chrome-pref-volume"):i.hasAttribute("muted")||r||h0.localStorage.setItem("media-chrome-pref-volume",e.toString())}catch(e){console.debug("Error setting volume pref",e)}Number.isFinite(+e)&&(i.volume=+e)}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(e,t)=>{let{options:{noVolumePref:i}}=t;if(!i)try{let{media:i}=t;if(!i)return;let r=h0.localStorage.getItem("media-chrome-pref-volume");if(null==r)return;ml.mediaVolume.set(+r,t),e(+r)}catch(e){console.debug("Error getting volume pref",e)}}]},mediaVolumeLevel:{get(e){let{media:t}=e;return void 0===(null==t?void 0:t.volume)?"high":t.muted||0===t.volume?"off":t.volume<.5?"low":t.volume<.75?"medium":"high"},mediaEvents:["volumechange"]},mediaCurrentTime:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.currentTime)?t:0},set(e,t){let{media:i}=t;i&&hN(e)&&(i.currentTime=e)},mediaEvents:["timeupdate","loadedmetadata"]},mediaDuration:{get(e){let{media:t,options:{defaultDuration:i}={}}=e;return i&&(!t||!t.duration||Number.isNaN(t.duration)||!Number.isFinite(t.duration))?i:Number.isFinite(null==t?void 0:t.duration)?t.duration:NaN},mediaEvents:["durationchange","loadedmetadata","emptied"]},mediaLoading:{get(e){let{media:t}=e;return(null==t?void 0:t.readyState)<3},mediaEvents:["waiting","playing","emptied"]},mediaSeekable:{get(e){var t;let{media:i}=e;if(!(null==(t=null==i?void 0:i.seekable)?void 0:t.length))return;let r=i.seekable.start(0),a=i.seekable.end(i.seekable.length-1);if(r||a)return[Number(r.toFixed(3)),Number(a.toFixed(3))]},mediaEvents:["loadedmetadata","emptied","progress","seekablechange"]},mediaBuffered:{get(e){var t;let{media:i}=e,r=null!=(t=null==i?void 0:i.buffered)?t:[];return Array.from(r).map((e,t)=>[Number(r.start(t).toFixed(3)),Number(r.end(t).toFixed(3))])},mediaEvents:["progress","emptied"]},mediaStreamType:{get(e){let{media:t,options:{defaultStreamType:i}={}}=e,r=[hI.LIVE,hI.ON_DEMAND].includes(i)?i:void 0;if(!t)return r;let{streamType:a}=t;if(ma.includes(a))return a===hI.UNKNOWN?r:a;let s=t.duration;return s===1/0?hI.LIVE:Number.isFinite(s)?hI.ON_DEMAND:r}
270,mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},mediaTargetLiveWindow:{get(e){let{media:t}=e;if(!t)return NaN;let{targetLiveWindow:i}=t,r=ml.mediaStreamType.get(e);return(null==i||Number.isNaN(i))&&r===hI.LIVE?0:i},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},mediaTimeIsLive:{get(e){let{media:t,options:{liveEdgeOffset:i=10}={}}=e;if(!t)return!1;if("number"==typeof t.liveEdgeStart)return!Number.isNaN(t.liveEdgeStart)&&t.currentTime>=t.liveEdgeStart;if(ml.mediaStreamType.get(e)!==hI.LIVE)return!1;let r=t.seekable;if(!r)return!0;if(!r.length)return!1;let a=r.end(r.length-1)-i;return t.currentTime>=a},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},mediaSubtitlesList:{get:e=>c7(e).map(({kind:e,label:t,language:i})=>({kind:e,label:t,language:i})),mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},mediaSubtitlesShowing:{get:e=>me(e).map(({kind:e,label:t,language:i})=>({kind:e,label:t,language:i})),mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(e,t)=>{var i,r;let{media:a,options:s}=t;if(!a)return;let n=e=>{var i;s.defaultSubtitles&&(e&&![hS.CAPTIONS,hS.SUBTITLES].includes(null==(i=null==e?void 0:e.track)?void 0:i.kind)||mt(t,!0))};return a.addEventListener("loadstart",n),null==(i=a.textTracks)||i.addEventListener("addtrack",n),null==(r=a.textTracks)||r.addEventListener("removetrack",n),()=>{var e,t;a.removeEventListener("loadstart",n),null==(e=a.textTracks)||e.removeEventListener("addtrack",n),null==(t=a.textTracks)||t.removeEventListener("removetrack",n)}}]},mediaChaptersCues:{get(e){var t;let{media:i}=e;if(!i)return[];let[r]=cj(i,{kind:hS.CHAPTERS});return Array.from(null!=(t=null==r?void 0:r.cues)?t:[]).map(({text:e,startTime:t,endTime:i})=>({text:e&&mo.parseFromString(e,"text/html").body.textContent||e,startTime:t,endTime:i}))},mediaEvents:["loadstart","loadedmetadata"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(e,t)=>{var i;let{media:r}=t;if(!r)return;let a=r.querySelector('track[kind="chapters"][default][src]'),s=null==(i=r.shadowRoot)?void 0:i.querySelector(':is(video,audio) > track[kind="chapters"][default][src]');return null==a||a.addEventListener("load",e),null==s||s.addEventListener("load",e),()=>{null==a||a.removeEventListener("load",e),null==s||s.removeEventListener("load",e)}}]},mediaIsPip:{get(e){var t,i;let{media:r,documentElement:a}=e;if(!r||!a||!a.pictureInPictureElement)return!1;if(a.pictureInPictureElement===r)return!0;if(a.pictureInPictureElement instanceof HTMLMediaElement)return!!(null==(t=r.localName)?void 0:t.includes("-"))&&ci(r,a.pictureInPictureElement);if(a.pictureInPictureElement.localName.includes("-")){let e=a.pictureInPictureElement.shadowRoot;for(;null==e?void 0:e.pictureInPictureElement;){if(e.pictureInPictureElement===r)return!0;e=null==(i=e.pictureInPictureElement)?void 0:i.shadowRoot}}return!1},set(e,t){let{media:i}=t;if(i)if(e){if(!h1.pictureInPictureEnabled)return void console.warn("MediaChrome: Picture-in-picture is not enabled");if(!i.requestPictureInPicture)return void console.warn("MediaChrome: The current media does not support picture-in-picture");let e=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};i.requestPictureInPicture().catch(t=>{if(11===t.code){if(!i.src)return void console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a src set.");if(0===i.readyState&&"none"===i.preload){let t=()=>{i.removeEventListener("loadedmetadata",r),i.preload="none"},r=()=>{i.requestPictureInPicture().catch(e),t()};i.addEventListener("loadedmetadata",r),i.preload="metadata",setTimeout(()=>{0===i.readyState&&e(),t()},1e3)}else throw t}else throw t})}else h1.pictureInPictureElement&&h1.exitPictureInPicture()},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},mediaRenditionList:{get(e){var t;let{media:i}=e;return[...null!=(t=null==i?void 0:i.videoRenditions)?t:[]].map(e=>({...e}))},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaRenditionSelected:{get(e){var t,i,r;let{media:a}=e;return null==(r=null==(i=null==a?void 0:a.videoRenditions)?void 0:i[null==(t=a.videoRenditions)?void 0:t.selectedIndex])?void 0:r.id},set(e,t){let{media:i}=t;if(!(null==i?void 0:i.videoRenditions))return void console.warn("MediaController: Rendition selection not supported by this media.");let r=Array.prototype.findIndex.call(i.videoRenditions,t=>t.id==e);i.videoRenditions.selectedIndex!=r&&(i.videoRenditions.selectedIndex=r)},mediaEvents:["emptied"],videoRenditionsEvents:["addrendition","removerendition","change"]},mediaAudioTrackList:{get(e){var t;let{media:i}=e;return[...null!=(t=null==i?void 0:i.audioTracks)?t:[]]},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaAudioTrackEnabled:{get(e){var t,i;let{media:r}=e;return null==(i=[...null!=(t=null==r?void 0:r.audioTracks)?t:[]].find(e=>e.enabled))?void 0:i.id},set(e,t){let{media:i}=t;if(!(null==i?void 0:i.audioTracks))return void console.warn("MediaChrome: Audio track selection not supported by this media.");
270for(let t of i.audioTracks)t.enabled=e==t.id},mediaEvents:["emptied"],audioTracksEvents:["addtrack","removetrack","change"]},mediaIsFullscreen:{get:e=>(e=>{var t;let{media:i,documentElement:r,fullscreenElement:a=i}=e;if(!i||!r)return!1;let s=(e=>{let{documentElement:t,media:i}=e,r=null==t?void 0:t[cX];return!r&&"webkitDisplayingFullscreen"in i&&"webkitPresentationMode"in i&&i.webkitDisplayingFullscreen&&i.webkitPresentationMode===hD.FULLSCREEN?i:r})(e);if(!s)return!1;if(s===a||s===i)return!0;if(s.localName.includes("-")){let e=s.shadowRoot;if(!(cX in e))return ci(s,a);for(;null==e?void 0:e[cX];){if(e[cX]===a)return!0;e=null==(t=e[cX])?void 0:t.shadowRoot}}return!1})(e),set(e,t,i){var r;e?((e=>{var t;let{media:i,fullscreenElement:r}=e;try{let e=r&&"requestFullscreen"in r?"requestFullscreen":r&&"webkitRequestFullScreen"in r?"webkitRequestFullScreen":void 0;if(e){let i=null==(t=r[e])?void 0:t.call(r);if(i instanceof Promise)return i.catch(()=>{})}else(null==i?void 0:i.webkitEnterFullscreen)?i.webkitEnterFullscreen():(null==i?void 0:i.requestFullscreen)&&i.requestFullscreen()}catch(e){console.error(e)}})(t),i.detail&&(null==(r=t.media)||r.focus())):(e=>{var t;let{documentElement:i}=e;if(cz){let e=null==(t=null==i?void 0:i[cz])?void 0:t.call(i);if(e instanceof Promise)return e.catch(()=>{})}})(t)},rootEvents:["fullscreenchange","webkitfullscreenchange"],mediaEvents:["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"]},mediaIsCasting:{get(e){var t;let{media:i}=e;return!!(null==i?void 0:i.remote)&&(null==(t=i.remote)?void 0:t.state)!=="disconnected"&&!!i.remote.state},set(e,t){var i,r;let{media:a}=t;if(a&&(!e||(null==(i=a.remote)?void 0:i.state)==="disconnected")&&(e||(null==(r=a.remote)?void 0:r.state)==="connected")){if("function"!=typeof a.remote.prompt)return void console.warn("MediaChrome: Casting is not supported in this environment");a.remote.prompt().catch(()=>{})}},remoteEvents:["connect","connecting","disconnect"]},mediaIsAirplaying:{get:()=>!1,set(e,t){let{media:i}=t;if(i){if(!(i.webkitShowPlaybackTargetPicker&&h0.WebKitPlaybackTargetAvailabilityEvent))return void console.error("MediaChrome: received a request to select AirPlay but AirPlay is not supported in this environment");i.webkitShowPlaybackTargetPicker()}},mediaEvents:["webkitcurrentplaybacktargetiswirelesschanged"]},mediaFullscreenUnavailable:{get(e){let{media:t}=e;if(!c5||!c4(t))return hR.UNSUPPORTED}},mediaPipUnavailable:{get(e){let{media:t}=e;return c8&&c3(t)?(null==t?void 0:t.disablePictureInPicture)?hR.UNAVAILABLE:void 0:hR.UNSUPPORTED}},mediaVolumeUnavailable:{get(e){let{media:t}=e;if(!1===a||(null==t?void 0:t.volume)==void 0)return hR.UNSUPPORTED},stateOwnersUpdateHandlers:[e=>{null==a&&ms.then(t=>e(t?void 0:hR.UNSUPPORTED))}]},mediaCastUnavailable:{get(e,{availability:t="not-available"}={}){var i;let{media:r}=e;return c6&&(null==(i=null==r?void 0:r.remote)?void 0:i.state)?null!=t&&"available"!==t?hR.UNAVAILABLE:void 0:hR.UNSUPPORTED},stateOwnersUpdateHandlers:[(e,t)=>{var i;let{media:r}=t;if(r)return r.disableRemotePlayback||r.hasAttribute("disableremoteplayback")||null==(i=null==r?void 0:r.remote)||i.watchAvailability(t=>{e({availability:t?"available":"not-available"})}).catch(t=>{"NotSupportedError"===t.name?e({availability:null}):e({availability:"not-available"})}),()=>{var e;null==(e=null==r?void 0:r.remote)||e.cancelWatchAvailability().catch(()=>{})}}]},mediaAirplayUnavailable:{get:(e,t)=>c9?(null==t?void 0:t.availability)==="not-available"?hR.UNAVAILABLE:void 0:hR.UNSUPPORTED,mediaEvents:["webkitplaybacktargetavailabilitychanged"],stateOwnersUpdateHandlers:[(e,t)=>{var i;let{media:r}=t;if(r)return r.disableRemotePlayback||r.hasAttribute("disableremoteplayback")||null==(i=null==r?void 0:r.remote)||i.watchAvailability(t=>{e({availability:t?"available":"not-available"})}).catch(t=>{"NotSupportedError"===t.name?e({availability:null}):e({availability:"not-available"})}),()=>{var e;null==(e=null==r?void 0:r.remote)||e.cancelWatchAvailability().catch(()=>{})}}]},mediaRenditionUnavailable:{get(e){var t;let{media:i}=e;return(null==i?void 0:i.videoRenditions)?(null==(t=i.videoRenditions)?void 0:t.length)?void 0:hR.UNAVAILABLE:hR.UNSUPPORTED},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaAudioTrackUnavailable:{get(e){var t,i;let{media:r}=e;return(null==r?void 0:r.audioTracks)?(null!=(i=null==(t=r.audioTracks)?void 0:t.length)?i:0)<=1?hR.UNAVAILABLE:void 0:hR.UNSUPPORTED},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaLang:{get(e){let{options:{mediaLang:t}={}}=e;return null!=t?t:"en"}}},md={[hg.MEDIA_PREVIEW_REQUEST](e,t,{detail:i}){var r,a,s;let n,o,{media:l}=t,d=null!=i?i:void 0;if(l&&null!=d){let[e]=cj(l,{kind:hS.METADATA,label:"thumbnails"}),t=Array.prototype.find.call(null!=(r=null==e?void 0:e.cues)?r:[],
270(e,t,i)=>0===t?e.endTime>d:t===i.length-1?e.startTime<=d:e.startTime<=d&&e.endTime>d);if(t){let e=/'^(?:[a-z]+:)?\/\//i.test(t.text)||null==(a=null==l?void 0:l.querySelector('track[label="thumbnails"]'))?void 0:a.src,i=new URL(t.text,e);o=new URLSearchParams(i.hash).get("#xywh").split(",").map(e=>+e),n=i.href}}let u=e.mediaDuration.get(t),h=null==(s=e.mediaChaptersCues.get(t).find((e,t,i)=>t===i.length-1&&u===e.endTime?e.startTime<=d&&e.endTime>=d:e.startTime<=d&&e.endTime>d))?void 0:s.text;return null!=i&&null==h&&(h=""),{mediaPreviewTime:d,mediaPreviewImage:n,mediaPreviewCoords:o,mediaPreviewChapter:h}},[hg.MEDIA_PAUSE_REQUEST](e,t){e.mediaPaused.set(!0,t)},[hg.MEDIA_PLAY_REQUEST](e,t){var i,r,a,s;let n=e.mediaStreamType.get(t)===hI.LIVE,o=!(null==(i=t.options)?void 0:i.noAutoSeekToLive),l=e.mediaTargetLiveWindow.get(t)>0;if(n&&o&&!l){let i=null==(r=e.mediaSeekable.get(t))?void 0:r[1];if(i){let r=null!=(s=null==(a=t.options)?void 0:a.seekToLiveOffset)?s:0;e.mediaCurrentTime.set(i-r,t)}}e.mediaPaused.set(!1,t)},[hg.MEDIA_PLAYBACK_RATE_REQUEST](e,t,{detail:i}){e.mediaPlaybackRate.set(i,t)},[hg.MEDIA_MUTE_REQUEST](e,t){e.mediaMuted.set(!0,t)},[hg.MEDIA_UNMUTE_REQUEST](e,t){e.mediaVolume.get(t)||e.mediaVolume.set(.25,t),e.mediaMuted.set(!1,t)},[hg.MEDIA_LOOP_REQUEST](e,t,{detail:i}){let r=!!i;return e.mediaLoop.set(r,t),{mediaLoop:r}},[hg.MEDIA_VOLUME_REQUEST](e,t,{detail:i}){i&&e.mediaMuted.get(t)&&e.mediaMuted.set(!1,t),e.mediaVolume.set(i,t)},[hg.MEDIA_SEEK_REQUEST](e,t,{detail:i}){e.mediaCurrentTime.set(i,t)},[hg.MEDIA_SEEK_TO_LIVE_REQUEST](e,t){var i,r,a;let s=null==(i=e.mediaSeekable.get(t))?void 0:i[1];if(Number.isNaN(Number(s)))return;let n=null!=(a=null==(r=t.options)?void 0:r.seekToLiveOffset)?a:0;e.mediaCurrentTime.set(s-n,t)},[hg.MEDIA_SHOW_SUBTITLES_REQUEST](e,t,{detail:i}){var r;let{options:a}=t,s=c7(t),n=cV(i),o=null==(r=n[0])?void 0:r.language;o&&!a.noSubtitlesLangPref&&h0.localStorage.setItem("media-chrome-pref-subtitles-lang",o),cq(hk.SHOWING,s,n)},[hg.MEDIA_DISABLE_SUBTITLES_REQUEST](e,t,{detail:i}){let r=c7(t);cq(hk.DISABLED,r,null!=i?i:[])},[hg.MEDIA_TOGGLE_SUBTITLES_REQUEST](e,t,{detail:i}){mt(t,i)},[hg.MEDIA_RENDITION_REQUEST](e,t,{detail:i}){e.mediaRenditionSelected.set(i,t)},[hg.MEDIA_AUDIO_TRACK_REQUEST](e,t,{detail:i}){e.mediaAudioTrackEnabled.set(i,t)},[hg.MEDIA_ENTER_PIP_REQUEST](e,t){e.mediaIsFullscreen.get(t)&&e.mediaIsFullscreen.set(!1,t),e.mediaIsPip.set(!0,t)},[hg.MEDIA_EXIT_PIP_REQUEST](e,t){e.mediaIsPip.set(!1,t)},[hg.MEDIA_ENTER_FULLSCREEN_REQUEST](e,t,i){e.mediaIsPip.get(t)&&e.mediaIsPip.set(!1,t),e.mediaIsFullscreen.set(!0,t,i)},[hg.MEDIA_EXIT_FULLSCREEN_REQUEST](e,t){e.mediaIsFullscreen.set(!1,t)},[hg.MEDIA_ENTER_CAST_REQUEST](e,t){e.mediaIsFullscreen.get(t)&&e.mediaIsFullscreen.set(!1,t),e.mediaIsCasting.set(!0,t)},[hg.MEDIA_EXIT_CAST_REQUEST](e,t){e.mediaIsCasting.set(!1,t)},[hg.MEDIA_AIRPLAY_REQUEST](e,t){e.mediaIsAirplaying.set(!0,t)}};var mu=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},mh=(e,t,i)=>(mu(e,t,"read from private field"),i?i.call(e):t.get(e)),mc=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},mm=(e,t,i,r)=>(mu(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),mf=(e,t,i)=>(mu(e,t,"access private method"),i);let mp=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Enter"," ","f","m","k","c","l","j",">","<","p"],mg="defaultsubtitles",mv="defaultstreamtype",my="defaultduration",mE="fullscreenelement",mb="hotkeys",mT="keyboardbackwardseekoffset",mA="keyboardforwardseekoffset",m_="keyboarddownvolumestep",mS="keyboardupvolumestep",mk="keysused",mL="lang",mw="loop",mR="liveedgeoffset",mI="noautoseektolive",mC="nodefaultstore",mD="nohotkeys",mx="nomutedpref",mP="nosubtitleslangpref",mM="novolumepref",mO="seektoliveoffset";class mN extends cM{constructor(){super(),mc(this,ya),mc(this,yn),mc(this,yl),mc(this,yu),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,mc(this,v8,new cB(this,mb)),mc(this,v9,void 0),mc(this,v6,void 0),mc(this,v7,null),mc(this,ye,void 0),mc(this,yt,void 0),mc(this,yi,e=>{var t;null==(t=mh(this,v6))||t.dispatch(e)}),mc(this,yr,void 0),this.associateElement(this);let e={};mm(this,ye,t=>{Object.entries(t).forEach(([t,i])=>{if(t in e&&e[t]===i)return;
270this.propagateMediaState(t,i);let r=t.toLowerCase(),a=new h0.CustomEvent(h_[r],{composed:!0,detail:i});this.dispatchEvent(a)}),e=t}),this.hasAttribute(mD)?this.disableHotkeys():this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(mD,mb,mv,mg,my,mx,mM,mL,mw)}get mediaStore(){return mh(this,v6)}set mediaStore(e){var t,i;(mh(this,v6)&&(null==(t=mh(this,yt))||t.call(this),mm(this,yt,void 0)),mm(this,v6,e),mh(this,v6)||this.hasAttribute(mC))?mm(this,yt,null==(i=mh(this,v6))?void 0:i.subscribe(mh(this,ye))):mf(this,ya,ys).call(this)}get fullscreenElement(){var e;return null!=(e=mh(this,v9))?e:this}set fullscreenElement(e){var t;this.hasAttribute(mE)&&this.removeAttribute(mE),mm(this,v9,e),null==(t=mh(this,v6))||t.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}get defaultSubtitles(){return ch(this,mg)}set defaultSubtitles(e){cc(this,mg,e)}get defaultStreamType(){return cm(this,mv)}set defaultStreamType(e){cf(this,mv,e)}get defaultDuration(){return cd(this,my)}set defaultDuration(e){cu(this,my,e)}get noHotkeys(){return ch(this,mD)}set noHotkeys(e){cc(this,mD,e)}get keysUsed(){return cm(this,mk)}set keysUsed(e){cf(this,mk,e)}get liveEdgeOffset(){return cd(this,mR)}set liveEdgeOffset(e){cu(this,mR,e)}get noAutoSeekToLive(){return ch(this,mI)}set noAutoSeekToLive(e){cc(this,mI,e)}get noVolumePref(){return ch(this,mM)}set noVolumePref(e){cc(this,mM,e)}get noMutedPref(){return ch(this,mx)}set noMutedPref(e){cc(this,mx,e)}get noSubtitlesLangPref(){return ch(this,mP)}set noSubtitlesLangPref(e){cc(this,mP,e)}get noDefaultStore(){return ch(this,mC)}set noDefaultStore(e){cc(this,mC,e)}attributeChangedCallback(e,t,i){var r,a,s,n,o,l,d,u,h,c,m,f;if(super.attributeChangedCallback(e,t,i),e===mD)i!==t&&""===i?(this.hasAttribute(mb)&&console.warn("Media Chrome: Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):i!==t&&null===i&&this.enableHotkeys();else if(e===mb)mh(this,v8).value=i;else if(e===mg&&i!==t)null==(r=mh(this,v6))||r.dispatch({type:"optionschangerequest",detail:{defaultSubtitles:this.hasAttribute(mg)}});else if(e===mv)null==(s=mh(this,v6))||s.dispatch({type:"optionschangerequest",detail:{defaultStreamType:null!=(a=this.getAttribute(mv))?a:void 0}});else if(e===mR)null==(n=mh(this,v6))||n.dispatch({type:"optionschangerequest",detail:{liveEdgeOffset:this.hasAttribute(mR)?+this.getAttribute(mR):void 0,seekToLiveOffset:this.hasAttribute(mO)?void 0:+this.getAttribute(mR)}});else if(e===mO)null==(o=mh(this,v6))||o.dispatch({type:"optionschangerequest",detail:{seekToLiveOffset:this.hasAttribute(mO)?+this.getAttribute(mO):void 0}});else if(e===mI)null==(l=mh(this,v6))||l.dispatch({type:"optionschangerequest",detail:{noAutoSeekToLive:this.hasAttribute(mI)}});else if(e===mE){let e=i?null==(d=this.getRootNode())?void 0:d.getElementById(i):void 0;mm(this,v9,e),null==(u=mh(this,v6))||u.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}else e===mL&&i!==t?(hK=i,null==(h=mh(this,v6))||h.dispatch({type:"optionschangerequest",detail:{mediaLang:i}})):e===mw&&i!==t?null==(c=mh(this,v6))||c.dispatch({type:hg.MEDIA_LOOP_REQUEST,detail:null!=i}):e===mM&&i!==t?null==(m=mh(this,v6))||m.dispatch({type:"optionschangerequest",detail:{noVolumePref:this.hasAttribute(mM)}}):e===mx&&i!==t&&(null==(f=mh(this,v6))||f.dispatch({type:"optionschangerequest",detail:{noMutedPref:this.hasAttribute(mx)}}))}connectedCallback(){var e,t;mh(this,v6)||this.hasAttribute(mC)||mf(this,ya,ys).call(this),null==(e=mh(this,v6))||e.dispatch({type:"documentelementchangerequest",detail:h1}),super.connectedCallback(),mh(this,v6)&&!mh(this,yt)&&mm(this,yt,null==(t=mh(this,v6))?void 0:t.subscribe(mh(this,ye))),void 0!==mh(this,yr)&&mh(this,v6)&&this.media&&setTimeout(()=>{var e,t,i;(null==(t=null==(e=this.media)?void 0:e.textTracks)?void 0:t.length)&&(null==(i=mh(this,v6))||i.dispatch({type:hg.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:mh(this,yr)}))},0),this.hasAttribute(mD)?this.disableHotkeys():this.enableHotkeys()}disconnectedCallback(){var e,t,i,r,a;if(null==(e=super.disconnectedCallback)||e.call(this),mh(this,v6)){let e=mh(this,v6).getState();mm(this,yr,!!(null==(t=e.mediaSubtitlesShowing)?void 0:t.length)),null==(i=mh(this,v6))||i.dispatch({type:"documentelementchangerequest",detail:void 0}),null==(r=mh(this,v6))||r.dispatch({type:hg.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:!1})}mh(this,yt)&&(null==(a=mh(this,yt))||a.call(this),mm(this,yt,void 0))}mediaSetCallback(e){var t;super.mediaSetCallback(e),null==(t=mh(this,v6))||t.dispatch({type:"mediaelementchangerequest",detail:e}),e.hasAttribute("tabindex")||(e.tabIndex=-1)}mediaUnsetCallback(e){var t;super.mediaUnsetCallback(e),null==(t=mh(this,v6))||t.dispatch({type:"mediaelementchangerequest",detail:void 0})}propagateMediaState(e,t){mK(this.mediaStateReceivers,e,t)}associateElement(e){if(!e)return;let{associatedElementSubscriptions:t}=this;if(t.has(e))return;let i=mq(e,this.registerMediaStateReceiver.bind(this),this.unregisterMediaStateReceiver.bind(this));Object.values(hg).forEach(t=>{e.addEventListener(t,mh(this,yi))}),t.set(e,i)}unassociateElement(e){if(!e)return;let{associatedElementSubscriptions:t}=this;t.has(e)&&(t.get(e)(),t.delete(e),Object.values(hg).forEach(t=>{e.removeEventListener(t,mh(this,yi))}))}registerMediaStateReceiver(e){if(!e)return;let t=this.mediaStateReceivers;!(t.indexOf(e)>-1)&&(t.push(e),mh(this,v6)&&Object.entries(mh(this,v6).getState()).forEac
270h(([t,i])=>{mK([e],t,i)}))}unregisterMediaStateReceiver(e){let t=this.mediaStateReceivers,i=t.indexOf(e);i<0||t.splice(i,1)}enableHotkeys(){this.addEventListener("keydown",mf(this,yl,yd))}disableHotkeys(){this.removeEventListener("keydown",mf(this,yl,yd)),this.removeEventListener("keyup",mf(this,yn,yo))}get hotkeys(){return cm(this,mb)}set hotkeys(e){cf(this,mb,e)}keyboardShortcutHandler(e){var t,i,r,a,s,n,o,l,d;let u,h,c,m=e.target;if(!((null!=(r=null!=(i=null==(t=m.getAttribute(mk))?void 0:t.split(" "))?i:null==m?void 0:m.keysUsed)?r:[]).map(e=>"Space"===e?" ":e).filter(Boolean).includes(e.key)||mh(this,v8).contains(`no${e.key.toLowerCase()}`)||" "===e.key&&mh(this,v8).contains("nospace"))&&!(e.shiftKey&&("/"===e.key||"?"===e.key)&&mh(this,v8).contains("noshift+/")))switch(e.key){case" ":case"k":u=mh(this,v6).getState().mediaPaused?hg.MEDIA_PLAY_REQUEST:hg.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new h0.CustomEvent(u,{composed:!0,bubbles:!0}));break;case"m":u="off"===this.mediaStore.getState().mediaVolumeLevel?hg.MEDIA_UNMUTE_REQUEST:hg.MEDIA_MUTE_REQUEST,this.dispatchEvent(new h0.CustomEvent(u,{composed:!0,bubbles:!0}));break;case"f":u=this.mediaStore.getState().mediaIsFullscreen?hg.MEDIA_EXIT_FULLSCREEN_REQUEST:hg.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new h0.CustomEvent(u,{composed:!0,bubbles:!0}));break;case"c":this.dispatchEvent(new h0.CustomEvent(hg.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}));break;case"ArrowLeft":case"j":{let e=this.hasAttribute(mT)?+this.getAttribute(mT):10;h=Math.max((null!=(a=this.mediaStore.getState().mediaCurrentTime)?a:0)-e,0),c=new h0.CustomEvent(hg.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(c);break}case"ArrowRight":case"l":{let e=this.hasAttribute(mA)?+this.getAttribute(mA):10;h=Math.max((null!=(s=this.mediaStore.getState().mediaCurrentTime)?s:0)+e,0),c=new h0.CustomEvent(hg.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(c);break}case"ArrowUp":{let e=this.hasAttribute(mS)?+this.getAttribute(mS):.025;h=Math.min((null!=(n=this.mediaStore.getState().mediaVolume)?n:1)+e,1),c=new h0.CustomEvent(hg.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(c);break}case"ArrowDown":{let e=this.hasAttribute(m_)?+this.getAttribute(m_):.025;h=Math.max((null!=(o=this.mediaStore.getState().mediaVolume)?o:1)-e,0),c=new h0.CustomEvent(hg.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(c);break}case"<":h=Math.max((null!=(l=this.mediaStore.getState().mediaPlaybackRate)?l:1)-.25,.25).toFixed(2),c=new h0.CustomEvent(hg.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(c);break;case">":h=Math.min((null!=(d=this.mediaStore.getState().mediaPlaybackRate)?d:1)+.25,2).toFixed(2),c=new h0.CustomEvent(hg.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(c);break;case"/":case"?":e.shiftKey&&mf(this,yu,yh).call(this);break;case"p":u=this.mediaStore.getState().mediaIsPip?hg.MEDIA_EXIT_PIP_REQUEST:hg.MEDIA_ENTER_PIP_REQUEST,c=new h0.CustomEvent(u,{composed:!0,bubbles:!0}),this.dispatchEvent(c)}}}v8=new WeakMap,v9=new WeakMap,v6=new WeakMap,v7=new WeakMap,ye=new WeakMap,yt=new WeakMap,yi=new WeakMap,yr=new WeakMap,ya=new WeakSet,ys=function(){var e;this.mediaStore=(({media:e,fullscreenElement:t,documentElement:i,stateMediator:r=ml,requestMap:a=md,options:s={},monitorStateOwnersOnlyWithSubscriptions:n=!0})=>{let o,l=[],d={options:{...s}},u=Object.freeze({mediaPreviewTime:void 0,mediaPreviewImage:void 0,mediaPreviewCoords:void 0,mediaPreviewChapter:void 0}),h=e=>{void 0==e||mi(e,u)||(u=Object.freeze({...u,...e}),l.forEach(e=>e(u)))},c=()=>{h(Object.entries(r).reduce((e,[t,{get:i}])=>(e[t]=i(d),e),{}))},m={},f=async(e,t)=>{var i,a,s,u,f,g,v,y,E,b,T,A,_,S,k,L;let w=!!o;if(o={...d,...null!=o?o:{},...e},w)return;await mn(...Object.values(e));let R=l.length>0&&0===t&&n,I=d.media!==o.media,C=(null==(i=d.media)?void 0:i.textTracks)!==(null==(a=o.media)?void 0:a.textTracks),D=(null==(s=d.media)?void 0:s.videoRenditions)!==(null==(u=o.media)?void 0:u.videoRenditions),x=(null==(f=d.media)?void 0:f.audioTracks)!==(null==(g=o.media)?void 0:g.audioTracks),P=(null==(v=d.media)?void 0:v.remote)!==(null==(y=o.media)?void 0:y.remote),M=d.documentElement!==o.documentElement,O=!!d.media&&(I||R),N=!!(null==(E=d.media)?void 0:E.textTracks)&&(C||R),U=!!(null==(b=d.media)?void 0:b.videoRenditions)&&(D||R),F=!!(null==(T=d.media)?void 0:T.audioTracks)&&(x||R),B=!!(null==(A=d.media)?void 0:A.remote)&&(P||R),$=!!d.documentElement&&(M||R),H=O||N||U||F||B||$,V=0===l.length&&1===t&&n,G=!!o.media&&(I||V),W=!!(null==(_=o.media)?void 0:_.textTracks)&&(C||V),K=!!(null==(S=o.media)?void 0:S.videoRenditions)&&(D||V),q=!!(null==(k=o.media)?void 0:k.audioTracks)&&(x||V),j=!!(null==(L=o.media)?void 0:L.remote)&&(P||V),Y=!!o.documentElement&&(M||V),z=G||W||K||q||j||Y;
270if(!(H||z)){Object.entries(o).forEach(([e,t])=>{d[e]=t}),c(),o=void 0;return}Object.entries(r).forEach(([e,{get:t,mediaEvents:i=[],textTracksEvents:r=[],videoRenditionsEvents:a=[],audioTracksEvents:s=[],remoteEvents:n=[],rootEvents:l=[],stateOwnersUpdateHandlers:u=[]}])=>{let c;m[e]||(m[e]={});let f=i=>{h({[e]:t(d,i)})};c=m[e].mediaEvents,i.forEach(t=>{c&&O&&(d.media.removeEventListener(t,c),m[e].mediaEvents=void 0),G&&(o.media.addEventListener(t,f),m[e].mediaEvents=f)}),c=m[e].textTracksEvents,r.forEach(t=>{var i,r;c&&N&&(null==(i=d.media.textTracks)||i.removeEventListener(t,c),m[e].textTracksEvents=void 0),W&&(null==(r=o.media.textTracks)||r.addEventListener(t,f),m[e].textTracksEvents=f)}),c=m[e].videoRenditionsEvents,a.forEach(t=>{var i,r;c&&U&&(null==(i=d.media.videoRenditions)||i.removeEventListener(t,c),m[e].videoRenditionsEvents=void 0),K&&(null==(r=o.media.videoRenditions)||r.addEventListener(t,f),m[e].videoRenditionsEvents=f)}),c=m[e].audioTracksEvents,s.forEach(t=>{var i,r;c&&F&&(null==(i=d.media.audioTracks)||i.removeEventListener(t,c),m[e].audioTracksEvents=void 0),q&&(null==(r=o.media.audioTracks)||r.addEventListener(t,f),m[e].audioTracksEvents=f)}),c=m[e].remoteEvents,n.forEach(t=>{var i,r;c&&B&&(null==(i=d.media.remote)||i.removeEventListener(t,c),m[e].remoteEvents=void 0),j&&(null==(r=o.media.remote)||r.addEventListener(t,f),m[e].remoteEvents=f)}),c=m[e].rootEvents,l.forEach(t=>{c&&$&&(d.documentElement.removeEventListener(t,c),m[e].rootEvents=void 0),Y&&(o.documentElement.addEventListener(t,f),m[e].rootEvents=f)});let g=m[e].stateOwnersUpdateHandlers;if(g&&H&&(Array.isArray(g)?g:[g]).forEach(e=>{"function"==typeof e&&e()}),z){let t=u.map(e=>e(f,o)).filter(e=>"function"==typeof e);m[e].stateOwnersUpdateHandlers=1===t.length?t[0]:t}else H&&(m[e].stateOwnersUpdateHandlers=void 0)}),Object.entries(o).forEach(([e,t])=>{d[e]=t}),c(),o=void 0};return f({media:e,fullscreenElement:t,documentElement:i,options:s}),{dispatch(e){let{type:t,detail:i}=e;a[t]&&null==u.mediaErrorCode?h(a[t](r,d,e)):"mediaelementchangerequest"===t?f({media:i}):"fullscreenelementchangerequest"===t?f({fullscreenElement:i}):"documentelementchangerequest"===t?f({documentElement:i}):"optionschangerequest"===t&&(Object.entries(null!=i?i:{}).forEach(([e,t])=>{d.options[e]=t}),c())},getState:()=>u,subscribe:e=>(f({},l.length+1),l.push(e),e(u),()=>{let t=l.indexOf(e);t>=0&&(f({},l.length-1),l.splice(t,1))})}})({media:this.media,fullscreenElement:this.fullscreenElement,options:{defaultSubtitles:this.hasAttribute(mg),defaultDuration:this.hasAttribute(my)?+this.getAttribute(my):void 0,defaultStreamType:null!=(e=this.getAttribute(mv))?e:void 0,liveEdgeOffset:this.hasAttribute(mR)?+this.getAttribute(mR):void 0,seekToLiveOffset:this.hasAttribute(mO)?+this.getAttribute(mO):this.hasAttribute(mR)?+this.getAttribute(mR):void 0,noAutoSeekToLive:this.hasAttribute(mI),noVolumePref:this.hasAttribute(mM),noMutedPref:this.hasAttribute(mx),noSubtitlesLangPref:this.hasAttribute(mP)}})},yn=new WeakSet,yo=function(e){let{key:t,shiftKey:i}=e;i&&("/"===t||"?"===t)||mp.includes(t)?this.keyboardShortcutHandler(e):this.removeEventListener("keyup",mf(this,yn,yo))},yl=new WeakSet,yd=function(e){var t;let{metaKey:i,altKey:r,key:a,shiftKey:s}=e,n=s&&("/"===a||"?"===a);if(n&&(null==(t=mh(this,v7))?void 0:t.open)||i||r||!n&&!mp.includes(a))return void this.removeEventListener("keyup",mf(this,yn,yo));let o=e.target,l=o instanceof HTMLElement&&("media-volume-range"===o.tagName.toLowerCase()||"media-time-range"===o.tagName.toLowerCase());![" ","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(a)||mh(this,v8).contains(`no${a.toLowerCase()}`)||" "===a&&mh(this,v8).contains("nospace")||l||e.preventDefault(),this.addEventListener("keyup",mf(this,yn,yo),{once:!0})},yu=new WeakSet,yh=function(){mh(this,v7)||(mm(this,v7,h1.createElement("media-keyboard-shortcuts-dialog")),this.appendChild(mh(this,v7))),mh(this,v7).open=!0};let mU=Object.values(hb),mF=Object.values(hy),mB=e=>{var t,i,r,a;let{observedAttributes:s}=e.constructor;!s&&(null==(t=e.nodeName)?void 0:t.includes("-"))&&(h0.customElements.upgrade(e),{observedAttributes:s}=e.constructor);let n=null==(a=null==(r=null==(i=null==e?void 0:e.getAttribute)?void 0:i.call(e,hv.MEDIA_CHROME_ATTRIBUTES))?void 0:r.split)?void 0:a.call(r,/\s+/);return Array.isArray(s||n)?(s||n).filter(e=>mU.includes(e)):[]},m$=e=>{var t,i;return(null==(t=e.nodeName)?void 0:t.includes("-"))&&h0.customElements.get(null==(i=e.nodeName)?void 0:i.toLowerCase())&&!(e instanceof h0.customElements.get(e.nodeName.toLowerCase()))&&h0.customElements.upgrade(e),mF.some(t=>t in e)||!!mB(e).length}
270,mH=e=>{var t;return null==(t=null==e?void 0:e.join)?void 0:t.call(e,":")},mV={[hb.MEDIA_SUBTITLES_LIST]:cW,[hb.MEDIA_SUBTITLES_SHOWING]:cW,[hb.MEDIA_SEEKABLE]:mH,[hb.MEDIA_BUFFERED]:e=>null==e?void 0:e.map(mH).join(" "),[hb.MEDIA_PREVIEW_COORDS]:e=>null==e?void 0:e.join(" "),[hb.MEDIA_RENDITION_LIST]:function(e){return null==e?void 0:e.map(hx).join(" ")},[hb.MEDIA_AUDIO_TRACK_LIST]:function(e){return null==e?void 0:e.map(hM).join(" ")}},mG=async(e,t,i)=>{var r,a;if(e.isConnected||await hF(0),"boolean"==typeof i||null==i)return cc(e,t,i);if("number"==typeof i)return cu(e,t,i);if("string"==typeof i)return cf(e,t,i);if(Array.isArray(i)&&!i.length)return e.removeAttribute(t);let s=null!=(a=null==(r=mV[t])?void 0:r.call(mV,i))?a:i;return e.setAttribute(t,s)},mW=(e,t)=>{var i;if(null==(i=e.closest)?void 0:i.call(e,'*[slot="media"]'))return;let r=(e,t)=>{var i,r;m$(e)&&t(e);let{children:a=[]}=null!=e?e:{};[...a,...null!=(r=null==(i=null==e?void 0:e.shadowRoot)?void 0:i.children)?r:[]].forEach(e=>mW(e,t))},a=null==e?void 0:e.nodeName.toLowerCase();a.includes("-")&&!m$(e)?h0.customElements.whenDefined(a).then(()=>{r(e,t)}):r(e,t)},mK=(e,t,i)=>{e.forEach(e=>{if(t in e){e[t]=i;return}let r=mB(e),a=t.toLowerCase();r.includes(a)&&mG(e,a,i)})},mq=(e,t,i)=>{mW(e,t);let r=e=>{var i;t(null!=(i=null==e?void 0:e.composedPath()[0])?i:e.target)},a=e=>{var t;i(null!=(t=null==e?void 0:e.composedPath()[0])?t:e.target)};e.addEventListener(hg.REGISTER_MEDIA_STATE_RECEIVER,r),e.addEventListener(hg.UNREGISTER_MEDIA_STATE_RECEIVER,a);let s=[],n=e=>{let r=e.target;"media"!==r.name&&(s.forEach(e=>mW(e,i)),(s=[...r.assignedElements({flatten:!0})]).forEach(e=>mW(e,t)))};e.addEventListener("slotchange",n);let o=new MutationObserver(e=>{e.forEach(e=>{let{addedNodes:r=[],removedNodes:a=[],type:s,target:n,attributeName:o}=e;"childList"===s?(Array.prototype.forEach.call(r,e=>mW(e,t)),Array.prototype.forEach.call(a,e=>mW(e,i))):"attributes"===s&&o===hv.MEDIA_CHROME_ATTRIBUTES&&(m$(n)?t(n):i(n))})});return o.observe(e,{childList:!0,attributes:!0,subtree:!0}),()=>{mW(e,i),e.removeEventListener("slotchange",n),o.disconnect(),e.removeEventListener(hg.REGISTER_MEDIA_STATE_RECEIVER,r),e.removeEventListener(hg.UNREGISTER_MEDIA_STATE_RECEIVER,a)}};h0.customElements.get("media-controller")||h0.customElements.define("media-controller",mN);let mj="placement",mY="bounds";class mz extends h0.HTMLElement{constructor(){if(super(),this.updateXOffset=()=>{var e;if(!cn(this,{checkOpacity:!1,checkVisibilityCSS:!1}))return;let t=this.placement;if("left"===t||"right"===t)return void this.style.removeProperty("--media-tooltip-offset-x");let i=getComputedStyle(this),r=null!=(e=cr(this,"#"+this.bounds))?e:h6(this);if(!r)return;let{x:a,width:s}=r.getBoundingClientRect(),{x:n,width:o}=this.getBoundingClientRect(),l=i.getPropertyValue("--media-tooltip-offset-x"),d=l?parseFloat(l.replace("px","")):0,u=i.getPropertyValue("--media-tooltip-container-margin"),h=u?parseFloat(u.replace("px","")):0,c=n-a+d-h,m=n+o-(a+s)+d+h;c<0?this.style.setProperty("--media-tooltip-offset-x",`${c}px`):m>0?this.style.setProperty("--media-tooltip-offset-x",`${m}px`):this.style.removeProperty("--media-tooltip-offset-x")},!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=h9(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[mj,mY]}get placement(){return cm(this,mj)}set placement(e){cf(this,mj,e)}get bounds(){return cm(this,mY)}set bounds(e){cf(this,mY,e)}}mz.shadowRootOptions={mode:"open"},mz.getTemplateHTML=function(e){return` 271 <style> 272 :host { 273 --_tooltip-background-color: var(--media-tooltip-background-color, var(--media-secondary-color, rgba(20, 20, 30, .7))); 274 --_tooltip-background: var(--media-tooltip-background, var(--_tooltip-background-color)); 275 --_tooltip-arrow-half-width: calc(var(--media-tooltip-arrow-width, 12px) / 2); 276 --_tooltip-arrow-height: var(--media-tooltip-arrow-height, 5px); 277 --_tooltip-arrow-background: var(--media-tooltip-arrow-color, var(--_tooltip-background-color)); 278 position: relative; 279 pointer-events: none; 280 display: var(--media-tooltip-display, inline-flex); 281 justify-content: center; 282 align-items: center; 283 box-sizing: border-box; 284 z-index: var(--media-tooltip-z-index, 1); 285 background: var(--_tooltip-background); 286 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 287 font: var(--media-font, 288 var(--media-font-weight, 400) 289 var(--media-font-size, 13px) / 290 var(--media-text-content-height, var(--media-control-height, 18px)) 291 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 292 padding: var(--media-tooltip-padding, .35em .7em); 293 border: var(--media-tooltip-border, none); 294 border-radius: var(--media-tooltip-border-radius, 5px); 295 filter: var(--media-tooltip-filter, drop-shadow(0 0 4px rgba(0, 0, 0, .2))); 296 white-space: var(--media-tooltip-white-space, nowrap); 297 } 298 299 :host([hidden]) { 300 display: none; 301 } 302 303 img, svg { 304 display: inline-block; 305 } 306 307 #arrow { 308 position: absolute; 309 width: 0px; 310 height: 0px; 311 border-style: solid; 312 display: var(--media-tooltip-arrow-display, block); 313 } 314 315 :host(:not([placement])), 316 :host([placement="top"]) { 317 position: absolute; 318 bottom: calc(100% + var(--media-tooltip-distance, 12px)); 319 left: 50%; 320 transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0
320); 321 } 322 :host(:not([placement])) #arrow, 323 :host([placement="top"]) #arrow { 324 top: 100%; 325 left: 50%; 326 border-width: var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width); 327 border-color: var(--_tooltip-arrow-background) transparent transparent transparent; 328 transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0); 329 } 330 331 :host([placement="right"]) { 332 position: absolute; 333 left: calc(100% + var(--media-tooltip-distance, 12px)); 334 top: 50%; 335 transform: translate(0, -50%); 336 } 337 :host([placement="right"]) #arrow { 338 top: 50%; 339 right: 100%; 340 border-width: var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0; 341 border-color: transparent var(--_tooltip-arrow-background) transparent transparent; 342 transform: translate(0, -50%); 343 } 344 345 :host([placement="bottom"]) { 346 position: absolute; 347 top: calc(100% + var(--media-tooltip-distance, 12px)); 348 left: 50%; 349 transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0); 350 } 351 :host([placement="bottom"]) #arrow { 352 bottom: 100%; 353 left: 50%; 354 border-width: 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width); 355 border-color: transparent transparent var(--_tooltip-arrow-background) transparent; 356 transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0); 357 } 358 359 :host([placement="left"]) { 360 position: absolute; 361 right: calc(100% + var(--media-tooltip-distance, 12px)); 362 top: 50%; 363 transform: translate(0, -50%); 364 } 365 :host([placement="left"]) #arrow { 366 top: 50%; 367 left: 100%; 368 border-width: var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height); 369 border-color: transparent transparent transparent var(--_tooltip-arrow-background); 370 transform: translate(0, -50%); 371 } 372 373 :host([placement="none"]) #arrow { 374 display: none; 375 } 376 </style> 377 <slot></slot> 378 <div id="arrow"></div> 379 `},h0.customElements.get("media-tooltip")||h0.customElements.define("media-tooltip",mz);var mX=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},mQ=(e,t,i)=>(mX(e,t,"read from private field"),i?i.call(e):t.get(e)),mZ=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},mJ=(e,t,i,r)=>(mX(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);let m0="tooltipplacement",m1="disabled",m2="notooltip";class m3 extends h0.HTMLElement{constructor(){if(super(),mZ(this,yv),mZ(this,yc,void 0),this.preventClick=!1,this.tooltipEl=null,mZ(this,ym,e=>{this.preventClick||this.handleClick(e),setTimeout(mQ(this,yf),0)}),mZ(this,yf,()=>{var e,t;null==(t=null==(e=this.tooltipEl)?void 0:e.updateXOffset)||t.call(e)}),mZ(this,yp,e=>{let{key:t}=e;this.keysUsed.includes(t)?this.preventClick||this.handleClick(e):this.removeEventListener("keyup",mQ(this,yp))}),mZ(this,yg,e=>{let{metaKey:t,altKey:i,key:r}=e;t||i||!this.keysUsed.includes(r)?this.removeEventListener("keyup",mQ(this,yp)):this.addEventListener("keyup",mQ(this,yp),{once:!0})}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=h9(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",m0,hv.MEDIA_CONTROLLER,hb.MEDIA_LANG]}enable(){this.addEventListener("click",mQ(this,ym)),this.addEventListener("keydown",mQ(this,yg)),this.tabIndex=0}disable(){this.removeEventListener("click",mQ(this,ym)),this.removeEventListener("keydown",mQ(this,yg)),this.removeEventListener("keyup",mQ(this,yp)),this.tabIndex=-1}attributeChangedCallback(e,t,i){var r,a,s,n,o;e===hv.MEDIA_CONTROLLER?(t&&(null==(a=null==(r=mQ(this,yc))?void 0:r.unassociateElement)||a.call(r,this),mJ(this,yc,null)),i&&this.isConnected&&(mJ(this,yc,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=mQ(this,yc))?void 0:n.associateElement)||o.call(n,this))):"disabled"===e&&i!==t?null==i?this.enable():this.disable():e===m0&&this.tooltipEl&&i!==t?this.tooltipEl.placement=i:e===hb.MEDIA_LA
379NG&&(this.shadowRoot.querySelector('slot[name="tooltip-content"]').innerHTML=this.constructor.getTooltipContentHTML()),mQ(this,yf).call(this)}connectedCallback(){var e,t,i;let{style:r}=co(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");let a=this.getAttribute(hv.MEDIA_CONTROLLER);a&&(mJ(this,yc,null==(e=this.getRootNode())?void 0:e.getElementById(a)),null==(i=null==(t=mQ(this,yc))?void 0:t.associateElement)||i.call(t,this)),h0.customElements.whenDefined("media-tooltip").then(()=>{var e,t;return(e=yv,t=yy,mX(this,e,"access private method"),t).call(this)})}disconnectedCallback(){var e,t;this.disable(),null==(t=null==(e=mQ(this,yc))?void 0:e.unassociateElement)||t.call(e,this),mJ(this,yc,null),this.removeEventListener("mouseenter",mQ(this,yf)),this.removeEventListener("focus",mQ(this,yf)),this.removeEventListener("click",mQ(this,ym))}get keysUsed(){return["Enter"," "]}get tooltipPlacement(){return cm(this,m0)}set tooltipPlacement(e){cf(this,m0,e)}get mediaController(){return cm(this,hv.MEDIA_CONTROLLER)}set mediaController(e){cf(this,hv.MEDIA_CONTROLLER,e)}get disabled(){return ch(this,m1)}set disabled(e){cc(this,m1,e)}get noTooltip(){return ch(this,m2)}set noTooltip(e){cc(this,m2,e)}handleClick(e){}}yc=new WeakMap,ym=new WeakMap,yf=new WeakMap,yp=new WeakMap,yg=new WeakMap,yv=new WeakSet,yy=function(){this.addEventListener("mouseenter",mQ(this,yf)),this.addEventListener("focus",mQ(this,yf)),this.addEventListener("click",mQ(this,ym));let e=this.tooltipPlacement;e&&this.tooltipEl&&(this.tooltipEl.placement=e)},m3.shadowRootOptions={mode:"open"},m3.getTemplateHTML=function(e,t={}){return` 380 <style> 381 :host { 382 position: relative; 383 font: var(--media-font, 384 var(--media-font-weight, bold) 385 var(--media-font-size, 14px) / 386 var(--media-text-content-height, var(--media-control-height, 24px)) 387 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 388 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 389 background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))); 390 padding: var(--media-button-padding, var(--media-control-padding, 10px)); 391 justify-content: var(--media-button-justify-content, center); 392 display: inline-flex; 393 align-items: center; 394 vertical-align: middle; 395 box-sizing: border-box; 396 transition: background .15s linear; 397 pointer-events: auto; 398 cursor: var(--media-cursor, pointer); 399 -webkit-tap-highlight-color: transparent; 400 } 401 402 403 :host(:focus-visible) { 404 box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9)); 405 outline: 0; 406 } 407 408 :host(:where(:focus)) { 409 box-shadow: none; 410 outline: 0; 411 } 412 413 :host(:hover) { 414 background: var(--media-control-hover-background, rgba(50 50 70 / .7)); 415 } 416 417 svg, img, ::slotted(svg), ::slotted(img) { 418 width: var(--media-button-icon-width); 419 height: var(--media-button-icon-height, var(--media-control-height, 24px)); 420 transform: var(--media-button-icon-transform); 421 transition: var(--media-button-icon-transition); 422 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 423 vertical-align: middle; 424 max-width: 100%; 425 max-height: 100%; 426 min-width: 100%; 427 } 428 429 media-tooltip { 430 431 max-width: 0; 432 overflow-x: clip; 433 opacity: 0; 434 transition: opacity .3s, max-width 0s 9s; 435 } 436 437 :host(:hover) media-tooltip, 438 :host(:focus-visible) media-tooltip { 439 max-width: 100vw; 440 opacity: 1; 441 transition: opacity .3s; 442 } 443 444 :host([notooltip]) slot[name="tooltip"] { 445 display: none; 446 } 447 </style> 448 449 ${this.getSlotTemplateHTML(e,t)} 450 451 <slot name="tooltip"> 452 <media-tooltip part="tooltip" aria-hidden="true"> 453 <template shadowrootmode="${mz.shadowRootOptions.mode}"> 454 ${mz.getTemplateHTML({})} 455 </template> 456 <slot name="tooltip-content"> 457 ${this.getTooltipContentHTML(e)} 458 </slot> 459 </media-tooltip> 460 </slot> 461 `},m3.getSlotTemplateHTML=function(e,t){return` 462 <slot></slot> 463 `},m3.getTooltipContentHTML=function(){return""},h0.customElements.get("media-chrome-button")||h0.customElements.define("media-chrome-button",m3);let m4=`<svg aria-hidden="true" viewBox="0 0 26 24"> 464 <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"/> 465</svg> 466`,m5=e=>{let t=e.mediaIsAirplaying?hq("stop airplay"):hq("start airplay");e.setAttribute("aria-label",t)};class m8 extends m3{static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_IS_AIRPLAYING,hb.MEDIA_AIRPLAY_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),m5(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===hb.MEDIA_IS_AIRPLAYING&&m5(this)}get mediaIsAirplaying(){return ch(this,hb.MEDIA_IS_AIRPLAYING)}set mediaIsAirplaying(e){cc(this,hb.MEDIA_IS_AIRPLAYING,e)}get mediaAirplayUnavailable(){return cm(this,hb.MEDIA_AIRPLAY_UNAVAILABLE)}set mediaAirplayUnavailable(e){cf(this,hb.MEDIA_AIRPLAY_UNAVAILABLE,e)}handleClick(){let e=new h0.CustomEvent(hg.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(e)}}m8.getSlotTemplateHTML=function(e){return` 467 <style> 468 :host([${hb.MEDIA_IS_AIRPLAYING}]) slot[name=icon] slot:not([name=exit]) { 469 display: none !important; 470 } 471 472 473 :host(:not([${hb.MEDIA_IS_AIRPLAYING}])) slot[name=icon] slot:not([name=enter]) { 474 display: none !important; 475 } 476 477 :host([${hb.MEDIA_IS_AIRPLAYING}]) slot[name=tooltip-enter], 478 :host(:not([${hb.MEDIA_IS_AIRPLAYING}])) slot[name=tooltip-exit] { 479 display: none; 480 } 481 </style> 482 483 <slot name="icon"> 484 <slot name="enter">${m4}</slot> 485 <slot name="exit">${m4}</slot> 486 </slot> 487 `},m8.getTooltipContentHTML=function(){return` 488 <slot name="tooltip-enter">${hq("start airplay")}</slot> 489 <slot name="tooltip-exit">${hq("stop airplay")}</slot> 490 `},h0.customElements.get("media-airplay-button")||h0.customElements.define("media-airplay-button",m8);let m9=`<svg aria-hidden="true" viewBox="0 0 26 24"> 491 <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
4910 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"/> 492</svg>`,m6=`<svg aria-hidden="true" viewBox="0 0 26 24"> 493 <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"/> 494</svg>`,m7=e=>{e.setAttribute("aria-checked",cY(e).toString())};class fe extends m3{static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_SUBTITLES_LIST,hb.MEDIA_SUBTITLES_SHOWING]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",hq("closed captions")),m7(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===hb.MEDIA_SUBTITLES_SHOWING&&m7(this)}get mediaSubtitlesList(){return ft(this,hb.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){fi(this,hb.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return ft(this,hb.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){fi(this,hb.MEDIA_SUBTITLES_SHOWING,e)}handleClick(){this.dispatchEvent(new h0.CustomEvent(hg.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}))}}fe.getSlotTemplateHTML=function(e){return` 495 <style> 496 :host([aria-checked="true"]) slot[name=off] { 497 display: none !important; 498 } 499 500 501 :host(:not([aria-checked="true"])) slot[name=on] { 502 display: none !important; 503 } 504 505 :host([aria-checked="true"]) slot[name=tooltip-enable], 506 :host(:not([aria-checked="true"])) slot[name=tooltip-disable] { 507 display: none; 508 } 509 </style> 510 511 <slot name="icon"> 512 <slot name="on">${m9}</slot> 513 <slot name="off">${m6}</slot> 514 </slot> 515 `},fe.getTooltipContentHTML=function(){return` 516 <slot name="tooltip-enable">${hq("Enable captions")}</slot> 517 <slot name="tooltip-disable">${hq("Disable captions")}</slot> 518 `};let ft=(e,t)=>{let i=e.getAttribute(t);return i?cH(i):[]},fi=(e,t,i)=>{if(!(null==i?void 0:i.length))return void e.removeAttribute(t);let r=cW(i);e.getAttribute(t)!==r&&e.setAttribute(t,r)};h0.customElements.get("media-captions-button")||h0.customElements.define("media-captions-button",fe);let fr=e=>{let t=e.mediaIsCasting?hq("stop casting"):hq("start casting");e.setAttribute("aria-label",t)};class fa extends m3{static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_IS_CASTING,hb.MEDIA_CAST_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),fr(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===hb.MEDIA_IS_CASTING&&fr(this)}get mediaIsCasting(){return ch(this,hb.MEDIA_IS_CASTING)}set mediaIsCasting(e){cc(this,hb.MEDIA_IS_CASTING,e)}get mediaCastUnavailable(){return cm(this,hb.MEDIA_CAST_UNAVAILABLE)}set mediaCastUnavailable(e){cf(this,hb.MEDIA_CAST_UNAVAILABLE,e)}handleClick(){let e=this.mediaIsCasting?hg.MEDIA_EXIT_CAST_REQUEST:hg.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new h0.CustomEvent(e,{composed:!0,bubbles:!0}))}}fa.getSlotTemplateHTML=function(e){return` 519 <style> 520 :host([${hb.MEDIA_IS_CASTING}]) slot[name=icon] slot:not([name=exit]) { 521 display: none !important; 522 } 523 524 525 :host(:not([${hb.MEDIA_IS_CASTING}])) slot[name=icon] slot:not([name=enter]) { 526 display: none !important; 527 } 528 529 :host([${hb.MEDIA_IS_CASTING}]) slot[name=tooltip-enter], 530 :host(:not([${hb.MEDIA_IS_CASTING}])) slot[name=tooltip-exit] { 531 display: none; 532 } 533 </style> 534 535 <slot name="icon"> 536 <slot name="enter"><svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/></g></svg></slot> 537 <slot name="exit"><svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/><path class="cast_caf_icon_boxfill" d="M5,7 L5,8.63 C8,8.6 13.37,14 13.37,17 L19,17 L19,7 Z"/></g></svg></slot> 538 </slot> 539 `},fa.getTooltipContentHTML=function(){return` 540 <slot name="tooltip-enter">${hq("Start casting")}</slot> 541 <slot name="tooltip-exit">${hq("Stop casting")}</slot> 542 `},h0.customElements.get("media-cast-button")||h0.customElements.define("media-cast-button",fa);var fs=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},fn=(e,t,i)=>(fs(e,t,"read from private field"),i?i.call(e):t.get(e)),fo=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},fl=(e,t,i,r)=>(fs(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),fd=(e,t,i)=>(fs(e,t,"access private method"),i);let fu="open";class fh extends h0.HTMLElement{constructor(){super(),fo(this,yA),fo(this,yS),fo(this,yL),fo(this,yR),fo(this,yC),fo(this,yx),fo(this,yE,!1),fo(this,yb,null),fo(this,yT,null),this.addEventListener("invoke",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this)}static get observedAttributes(){return[fu,"anchor"]}get open(){return ch(this,fu)}set open(e){cc(this,fu,e)}handleEvent(e){switch(e.type){case"invoke":fd(this,yR,yI).call(this,e);break;
542case"focusout":fd(this,yC,yD).call(this,e);break;case"keydown":fd(this,yx,yP).call(this,e)}}connectedCallback(){fd(this,yA,y_).call(this),this.role||(this.role="dialog")}attributeChangedCallback(e,t,i){fd(this,yA,y_).call(this),e===fu&&i!==t&&(this.open?fd(this,yS,yk).call(this):fd(this,yL,yw).call(this))}focus(){fl(this,yb,ca());let 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;let i=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');null==i||i.focus()}get keysUsed(){return["Escape","Tab"]}}yE=new WeakMap,yb=new WeakMap,yT=new WeakMap,yA=new WeakSet,y_=function(){if(!fn(this,yE)&&(fl(this,yE,!0),!this.shadowRoot)){this.attachShadow(this.constructor.shadowRootOptions);let e=h9(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e),queueMicrotask(()=>{let{style:e}=co(this.shadowRoot,":host");e.setProperty("transition","display .15s, visibility .15s, opacity .15s ease-in, transform .15s ease-in")})}},yS=new WeakSet,yk=function(){var e;null==(e=fn(this,yT))||e.setAttribute("aria-expanded","true"),this.dispatchEvent(new Event("open",{composed:!0,bubbles:!0})),this.addEventListener("transitionend",()=>this.focus(),{once:!0})},yL=new WeakSet,yw=function(){var e;null==(e=fn(this,yT))||e.setAttribute("aria-expanded","false"),this.dispatchEvent(new Event("close",{composed:!0,bubbles:!0}))},yR=new WeakSet,yI=function(e){fl(this,yT,e.relatedTarget),ci(this,e.relatedTarget)||(this.open=!this.open)},yC=new WeakSet,yD=function(e){var t;!ci(this,e.relatedTarget)&&(null==(t=fn(this,yb))||t.focus(),fn(this,yT)&&fn(this,yT)!==e.relatedTarget&&this.open&&(this.open=!1))},yx=new WeakSet,yP=function(e){var t,i,r,a,s;let{key:n,ctrlKey:o,altKey:l,metaKey:d}=e;o||l||d||this.keysUsed.includes(n)&&(e.preventDefault(),e.stopPropagation(),"Tab"===n?(e.shiftKey?null==(i=null==(t=this.previousElementSibling)?void 0:t.focus)||i.call(t):null==(a=null==(r=this.nextElementSibling)?void 0:r.focus)||a.call(r),this.blur()):"Escape"===n&&(null==(s=fn(this,yb))||s.focus(),this.open=!1))},fh.shadowRootOptions={mode:"open"},fh.getTemplateHTML=function(e){return` 543 <style> 544 :host { 545 font: var(--media-font, 546 var(--media-font-weight, normal) 547 var(--media-font-size, 14px) / 548 var(--media-text-content-height, var(--media-control-height, 24px)) 549 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 550 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 551 display: var(--media-dialog-display, inline-flex); 552 justify-content: center; 553 align-items: center; 554 555 transition-behavior: allow-discrete; 556 visibility: hidden; 557 opacity: 0; 558 transform: translateY(2px) scale(.99); 559 pointer-events: none; 560 } 561 562 :host([open]) { 563 transition: display .2s, visibility 0s, opacity .2s ease-out, transform .15s ease-out; 564 visibility: visible; 565 opacity: 1; 566 transform: translateY(0) scale(1); 567 pointer-events: auto; 568 } 569 570 #content { 571 display: flex; 572 position: relative; 573 box-sizing: border-box; 574 width: min(320px, 100%); 575 word-wrap: break-word; 576 max-height: 100%; 577 overflow: auto; 578 text-align: center; 579 line-height: 1.4; 580 } 581 </style> 582 ${this.getSlotTemplateHTML(e)} 583 `},fh.getSlotTemplateHTML=function(e){return` 584 <slot id="content"></slot> 585 `},h0.customElements.get("media-chrome-dialog")||h0.customElements.define("media-chrome-dialog",fh);var fc=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},fm=(e,t,i)=>(fc(e,t,"read from private field"),i?i.call(e):t.get(e)),ff=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},fp=(e,t,i,r)=>(fc(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),fg=(e,t,i)=>(fc(e,t,"access private method"),i);class fv extends h0.HTMLElement{constructor(){if(super(),ff(this,yG),ff(this,yK),ff(this,yj),ff(this,yz),ff(this,yQ),ff(this,yJ),ff(this,y1),ff(this,y3),ff(this,yM,void 0),ff(this,yO,void 0),ff(this,yN,void 0),ff(this,yU,void 0),ff(this,yF,{}),ff(this,yB,[]),ff(this,y$,()=>{if(this.range.matches(":focus-visible")){let{style:e}=co(this.shadowRoot,":host");e.setProperty("--_focus-visible-box-shadow","var(--_focus-box-sha
585dow)")}}),ff(this,yH,()=>{let{style:e}=co(this.shadowRoot,":host");e.removeProperty("--_focus-visible-box-shadow")}),ff(this,yV,()=>{let e=this.shadowRoot.querySelector("#segments-clipping");e&&e.parentNode.append(e)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=h9(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}this.container=this.shadowRoot.querySelector("#container"),fp(this,yN,this.shadowRoot.querySelector("#startpoint")),fp(this,yU,this.shadowRoot.querySelector("#endpoint")),this.range=this.shadowRoot.querySelector("#range"),this.appearance=this.shadowRoot.querySelector("#appearance")}static get observedAttributes(){return["disabled","aria-disabled",hv.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,i){var r,a,s,n,o;e===hv.MEDIA_CONTROLLER?(t&&(null==(a=null==(r=fm(this,yM))?void 0:r.unassociateElement)||a.call(r,this),fp(this,yM,null)),i&&this.isConnected&&(fp(this,yM,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=fm(this,yM))?void 0:n.associateElement)||o.call(n,this))):("disabled"===e||"aria-disabled"===e&&t!==i)&&(null==i?(this.range.removeAttribute(e),fg(this,yK,yq).call(this)):(this.range.setAttribute(e,i),fg(this,yj,yY).call(this)))}connectedCallback(){var e,t,i;let{style:r}=co(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),fm(this,yF).pointer=co(this.shadowRoot,"#pointer"),fm(this,yF).progress=co(this.shadowRoot,"#progress"),fm(this,yF).thumb=co(this.shadowRoot,'#thumb, ::slotted([slot="thumb"])'),fm(this,yF).activeSegment=co(this.shadowRoot,"#segments-clipping rect:nth-child(0)");let a=this.getAttribute(hv.MEDIA_CONTROLLER);a&&(fp(this,yM,null==(e=this.getRootNode())?void 0:e.getElementById(a)),null==(i=null==(t=fm(this,yM))?void 0:t.associateElement)||i.call(t,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",fm(this,y$)),this.shadowRoot.addEventListener("focusout",fm(this,yH)),fg(this,yK,yq).call(this),h5(this.container,fm(this,yV))}disconnectedCallback(){var e,t;fg(this,yj,yY).call(this),null==(t=null==(e=fm(this,yM))?void 0:e.unassociateElement)||t.call(e,this),fp(this,yM,null),this.shadowRoot.removeEventListener("focusin",fm(this,y$)),this.shadowRoot.removeEventListener("focusout",fm(this,yH)),h8(this.container,fm(this,yV))}updatePointerBar(e){var t;null==(t=fm(this,yF).pointer)||t.style.setProperty("width",`${100*this.getPointerRatio(e)}%`)}updateBar(){var e,t;let i=100*this.range.valueAsNumber;null==(e=fm(this,yF).progress)||e.style.setProperty("width",`${i}%`),null==(t=fm(this,yF).thumb)||t.style.setProperty("left",`${i}%`)}updateSegments(e){let t=this.shadowRoot.querySelector("#segments-clipping");if(t.textContent="",this.container.classList.toggle("segments",!!(null==e?void 0:e.length)),!(null==e?void 0:e.length))return;let i=[...new Set([+this.range.min,...e.flatMap(e=>[e.start,e.end]),+this.range.max])];fp(this,yB,[...i]);let r=i.pop();for(let[e,a]of i.entries()){let[s,n]=[0===e,e===i.length-1],o=s?"calc(var(--segments-gap) / -1)":`${100*a}%`,l=n?r:i[e+1],d=`calc(${(l-a)*100}%${s||n?"":" - var(--segments-gap)"})`,u=h1.createElementNS("http://www.w3.org/2000/svg","rect"),h=cl(this.shadowRoot,`#segments-clipping rect:nth-child(${e+1})`);h.style.setProperty("x",o),h.style.setProperty("width",d),t.append(u)}}getPointerRatio(e){var t,i,r,a;let s,n,o;return t=e.clientX,i=e.clientY,r=fm(this,yN).getBoundingClientRect(),s=(a=fm(this,yU).getBoundingClientRect()).x-r.x,0==(o=s*s+(n=a.y-r.y)*n)?0:Math.max(0,Math.min(1,((t-r.x)*s+(i-r.y)*n)/o))}get dragging(){return this.hasAttribute("dragging")}handleEvent(e){switch(e.type){case"pointermove":fg(this,y3,y4).call(this,e);break;case"input":this.updateBar();break;case"pointerenter":fg(this,yQ,yZ).call(this,e);break;case"pointerdown":fg(this,yz,yX).call(this,e);break;case"pointerup":fg(this,yJ,y0).call(this);break;case"pointerleave":fg(this,y1,y2).call(this)}}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}}yM=new WeakMap,yO=new WeakMap,yN=new WeakMap,yU=new WeakMap,yF=new WeakMap,yB=new WeakMap,y$=new WeakMap,yH=new WeakMap,yV=new WeakMap,yG=new WeakSet,yW=function(e){let t=fm(this,yF).activeSegment;if(!t)return;
585let i=this.getPointerRatio(e),r=fm(this,yB).findIndex((e,t,r)=>{let a=r[t+1];return null!=a&&i>=e&&i<=a}),a=`#segments-clipping rect:nth-child(${r+1})`;t.selectorText==a&&t.style.transform||(t.selectorText=a,t.style.setProperty("transform","var(--media-range-segment-hover-transform, scaleY(2))"))},yK=new WeakSet,yq=function(){this.hasAttribute("disabled")||(this.addEventListener("input",this),this.addEventListener("pointerdown",this),this.addEventListener("pointerenter",this))},yj=new WeakSet,yY=function(){var e,t;this.removeEventListener("input",this),this.removeEventListener("pointerdown",this),this.removeEventListener("pointerenter",this),null==(e=h0.window)||e.removeEventListener("pointerup",this),null==(t=h0.window)||t.removeEventListener("pointermove",this)},yz=new WeakSet,yX=function(e){var t;fp(this,yO,e.composedPath().includes(this.range)),null==(t=h0.window)||t.addEventListener("pointerup",this)},yQ=new WeakSet,yZ=function(e){var t;"mouse"!==e.pointerType&&fg(this,yz,yX).call(this,e),this.addEventListener("pointerleave",this),null==(t=h0.window)||t.addEventListener("pointermove",this)},yJ=new WeakSet,y0=function(){var e;null==(e=h0.window)||e.removeEventListener("pointerup",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled")},y1=new WeakSet,y2=function(){var e,t;this.removeEventListener("pointerleave",this),null==(e=h0.window)||e.removeEventListener("pointermove",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled"),null==(t=fm(this,yF).activeSegment)||t.style.removeProperty("transform")},y3=new WeakSet,y4=function(e){("pen"!==e.pointerType||0!==e.buttons)&&(this.toggleAttribute("dragging",1===e.buttons||"mouse"!==e.pointerType),this.updatePointerBar(e),fg(this,yG,yW).call(this,e),this.dragging&&("mouse"!==e.pointerType||!fm(this,yO))&&(this.range.disabled=!0,this.range.valueAsNumber=this.getPointerRatio(e),this.range.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))))},fv.shadowRootOptions={mode:"open"},fv.getTemplateHTML=function(e){return` 586 <style> 587 :host { 588 --_focus-box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9)); 589 --_media-range-padding: var(--media-range-padding, var(--media-control-padding, 10px)); 590 591 box-shadow: var(--_focus-visible-box-shadow, none); 592 background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))); 593 height: calc(var(--media-control-height, 24px) + 2 * var(--_media-range-padding)); 594 display: inline-flex; 595 align-items: center; 596 597 vertical-align: middle; 598 box-sizing: border-box; 599 position: relative; 600 width: 100px; 601 transition: background .15s linear; 602 cursor: var(--media-cursor, pointer); 603 pointer-events: auto; 604 touch-action: none; 605 } 606 607 608 input[type=range]:focus { 609 outline: 0; 610 } 611 input[type=range]:focus::-webkit-slider-runnable-track { 612 outline: 0; 613 } 614 615 :host(:hover) { 616 background: var(--media-control-hover-background, rgb(50 50 70 / .7)); 617 } 618 619 #leftgap { 620 padding-left: var(--media-range-padding-left, var(--_media-range-padding)); 621 } 622 623 #rightgap { 624 padding-right: var(--media-range-padding-right, var(--_media-range-padding)); 625 } 626 627 #startpoint, 628 #endpoint { 629 position: absolute; 630 } 631 632 #endpoint { 633 right: 0; 634 } 635 636 #container { 637 638 width: var(--media-range-track-width, 100%); 639 transform: translate(var(--media-range-track-translate-x, 0px), var(--media-range-track-translate-y, 0px)); 640 position: relative; 641 height: 100%; 642 display: flex; 643 align-items: center; 644 min-width: 40px; 645 } 646 647 #range { 648 649 display: var(--media-time-range-hover-display, block); 650 bottom: var(--media-time-range-hover-bottom, -7px); 651 height: var(--media-time-range-hover-height, max(100% + 7px, 25px)); 652 width: 100%; 653 position: absolute; 654 cursor: var(--media-cursor, pointer); 655 656 -webkit-appearance: none; 657 -webkit-tap-highlight-color: transparent; 658 background: transparent; 659 margin: 0; 660 z-index: 1; 661 } 662 663 @media (hover: hover) { 664 #range { 665 bottom: var(--media-time-range-hover-bottom, -5px); 666 height: var(--media-time-range-hover-height, max(100% + 5px, 20px)); 667 } 668 } 669 670 671 672 #range::-webkit-slider-thumb { 673 -webkit-appearance: none; 674 background: transparent; 675 width: .1px; 676 height: .1px; 677 } 678 679 680 #range::-moz-range-thumb { 681 background: transparent; 682 border: transparent; 683 width: .1px; 684 height: .1px; 685 } 686 687 #appearance { 688 height: var(--media-range-track-height, 4px); 689 display: flex; 690 flex-direction: column; 691 justify-content: center; 692 width: 100%; 693 position: absolute; 694 695 will-change: transform; 696 } 697 698 #track { 699 background: var(--media-range-track-background, rgb(255 255 255 / .2)); 700 border-radius: var(--media-range-track-border-radius, 1px); 701 border: var(--media-range-track-border, none); 702 outline: var(--media-range-track-outline); 703 outline-offset: var(--media-range-track-outline-offset); 704 backdrop-filter: var(--media-range-track-backdrop-filter); 705 -webkit-backdrop-filter: var(--media-range-track-backdrop-filter);
706 box-shadow: var(--media-range-track-box-shadow, none); 707 position: absolute; 708 width: 100%; 709 height: 100%; 710 overflow: hidden; 711 } 712 713 #progress, 714 #pointer { 715 position: absolute; 716 height: 100%; 717 will-change: width; 718 } 719 720 #progress { 721 background: var(--media-range-bar-color, var(--media-primary-color, rgb(238 238 238))); 722 transition: var(--media-range-track-transition); 723 } 724 725 #pointer { 726 background: var(--media-range-track-pointer-background); 727 border-right: var(--media-range-track-pointer-border-right); 728 transition: visibility .25s, opacity .25s; 729 visibility: hidden; 730 opacity: 0; 731 } 732 733 @media (hover: hover) { 734 :host(:hover) #pointer { 735 transition: visibility .5s, opacity .5s; 736 visibility: visible; 737 opacity: 1; 738 } 739 } 740 741 #thumb, 742 ::slotted([slot=thumb]) { 743 width: var(--media-range-thumb-width, 10px); 744 height: var(--media-range-thumb-height, 10px); 745 transition: var(--media-range-thumb-transition); 746 transform: var(--media-range-thumb-transform, none); 747 opacity: var(--media-range-thumb-opacity, 1); 748 translate: -50%; 749 position: absolute; 750 left: 0; 751 cursor: var(--media-cursor, pointer); 752 } 753 754 #thumb { 755 border-radius: var(--media-range-thumb-border-radius, 10px); 756 background: var(--media-range-thumb-background, var(--media-primary-color, rgb(238 238 238))); 757 box-shadow: var(--media-range-thumb-box-shadow, 1px 1px 1px transparent); 758 border: var(--media-range-thumb-border, none); 759 } 760 761 :host([disabled]) #thumb { 762 background-color: #777; 763 } 764 765 .segments #appearance { 766 height: var(--media-range-segment-hover-height, 7px); 767 } 768 769 #track { 770 clip-path: url(#segments-clipping); 771 } 772 773 #segments { 774 --segments-gap: var(--media-range-segments-gap, 2px); 775 position: absolute; 776 width: 100%; 777 height: 100%; 778 } 779 780 #segments-clipping { 781 transform: translateX(calc(var(--segments-gap) / 2)); 782 } 783 784 #segments-clipping:empty { 785 display: none; 786 } 787 788 #segments-clipping rect { 789 height: var(--media-range-track-height, 4px); 790 y: calc((var(--media-range-segment-hover-height, 7px) - var(--media-range-track-height, 4px)) / 2); 791 transition: var(--media-range-segment-transition, transform .1s ease-in-out); 792 transform: var(--media-range-segment-transform, scaleY(1)); 793 transform-origin: center; 794 } 795 </style> 796 <div id="leftgap"></div> 797 <div id="container"> 798 <div id="startpoint"></div> 799 <div id="endpoint"></div> 800 <div id="appearance"> 801 <div id="track" part="track"> 802 <div id="pointer"></div> 803 <div id="progress" part="progress"></div> 804 </div> 805 <slot name="thumb"> 806 <div id="thumb" part="thumb"></div> 807 </slot> 808 <svg id="segments"><clipPath id="segments-clipping"></clipPath></svg> 809 </div>
810 <input id="range" type="range" min="0" max="1" step="any" value="0"> 811 812 ${this.getContainerTemplateHTML(e)} 813 </div> 814 <div id="rightgap"></div> 815 `},fv.getContainerTemplateHTML=function(e){return""},h0.customElements.get("media-chrome-range")||h0.customElements.define("media-chrome-range",fv);var fy=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},fE=(e,t,i)=>(fy(e,t,"read from private field"),i?i.call(e):t.get(e)),fb=(e,t,i,r)=>(fy(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);class fT extends h0.HTMLElement{constructor(){if(super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,y5,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=h9(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[hv.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,i){var r,a,s,n,o;e===hv.MEDIA_CONTROLLER&&(t&&(null==(a=null==(r=fE(this,y5))?void 0:r.unassociateElement)||a.call(r,this),fb(this,y5,null)),i&&this.isConnected&&(fb(this,y5,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=fE(this,y5))?void 0:n.associateElement)||o.call(n,this)))}connectedCallback(){var e,t,i;let r=this.getAttribute(hv.MEDIA_CONTROLLER);r&&(fb(this,y5,null==(e=this.getRootNode())?void 0:e.getElementById(r)),null==(i=null==(t=fE(this,y5))?void 0:t.associateElement)||i.call(t,this))}disconnectedCallback(){var e,t;null==(t=null==(e=fE(this,y5))?void 0:e.unassociateElement)||t.call(e,this),fb(this,y5,null)}}y5=new WeakMap,fT.shadowRootOptions={mode:"open"},fT.getTemplateHTML=function(e){return` 816 <style> 817 :host { 818 819 box-sizing: border-box; 820 display: var(--media-control-display, var(--media-control-bar-display, inline-flex)); 821 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 822 --media-loading-indicator-icon-height: 44px; 823 } 824 825 ::slotted(media-time-range), 826 ::slotted(media-volume-range) { 827 min-height: 100%; 828 } 829 830 ::slotted(media-time-range), 831 ::slotted(media-clip-selector) { 832 flex-grow: 1; 833 } 834 835 ::slotted([role="menu"]) { 836 position: absolute; 837 } 838 </style> 839 840 <slot></slot> 841 `},h0.customElements.get("media-control-bar")||h0.customElements.define("media-control-bar",fT);var fA=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},f_=(e,t,i)=>(fA(e,t,"read from private field"),i?i.call(e):t.get(e)),fS=(e,t,i,r)=>(fA(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);class fk extends h0.HTMLElement{constructor(){if(super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,y8,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=h9(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[hv.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,i){var r,a,s,n,o;e===hv.MEDIA_CONTROLLER&&(t&&(null==(a=null==(r=f_(this,y8))?void 0:r.unassociateElement)||a.call(r,this),fS(this,y8,null)),i&&this.isConnected&&(fS(this,y8,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=f_(this,y8))?void 0:n.associateElement)||o.call(n,this)))}connectedCallback(){var e,t,i;let{style:r}=co(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`);let a=this.getAttribute(hv.MEDIA_CONTROLLER);a&&(fS(this,y8,null==(e=this.getRootNode())?void 0:e.getElementById(a)),null==(i=null==(t=f_(this,y8))?void 0:t.associateElement)||i.call(t,this))}disconnectedCallback(){var e,t;null==(t=null==(e=f_(this,y8))?void 0:e.unassociateElement)||t.call(e,this),fS(this,y8,null)}}y8=new WeakMap,fk.shadowRootOptions={mode:"open"},fk.getTemplateHTML=function(e,t={}){return` 842 <style> 843 :host { 844 font: var(--media-font, 845 var(--media-font-weight, normal) 846 var(--media-font-size, 14px) / 847 var(--media-text-content-height, var(--media-control-height, 24px)) 848 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 849 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 850 background: var(--media-text-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)))); 851 padding: var(--media-control-padding, 10px); 852 display: inline-flex; 853 justify-content: center; 854 align-items: center; 855 vertical-align: middle; 856 box-sizing: border-box; 857 text-align: center; 858 pointer-events: auto; 859 } 860 861 862 :host(:focus-visible) { 863 box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9); 864 outline: 0; 865 } 866 867 868 :host(:where(:focus)) { 869 box-shadow: none; 870 outline: 0; 871 } 872 </style> 873
874 ${this.getSlotTemplateHTML(e,t)} 875 `},fk.getSlotTemplateHTML=function(e,t){return` 876 <slot></slot> 877 `},h0.customElements.get("media-text-display")||h0.customElements.define("media-text-display",fk);var fL=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},fw=(e,t,i)=>(fL(e,t,"read from private field"),i?i.call(e):t.get(e));class fR extends fk{constructor(){var e;super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,y9,void 0),((e,t,i,r)=>(fL(e,t,"write to private field"),r?r.call(e,i):t.set(e,i)))(this,y9,this.shadowRoot.querySelector("slot")),fw(this,y9).textContent=hH(null!=(e=this.mediaDuration)?e:0)}static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_DURATION]}attributeChangedCallback(e,t,i){e===hb.MEDIA_DURATION&&(fw(this,y9).textContent=hH(+i)),super.attributeChangedCallback(e,t,i)}get mediaDuration(){return cd(this,hb.MEDIA_DURATION)}set mediaDuration(e){cu(this,hb.MEDIA_DURATION,e)}}y9=new WeakMap,fR.getSlotTemplateHTML=function(e,t){return` 878 <slot>${hH(t.mediaDuration)}</slot> 879 `},h0.customElements.get("media-duration-display")||h0.customElements.define("media-duration-display",fR);let fI={2:hq("Network Error"),3:hq("Decode Error"),4:hq("Source Not Supported"),5:hq("Encryption
879Error")},fC={2:hq("A network error caused the media download to fail."),3:hq("A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format."),4:hq("An unsupported error occurred. The server or network failed, or your browser does not support this format."),5:hq("The media is encrypted and there are no keys to decrypt it.")},fD=e=>{var t,i;return 1===e.code?null:{title:null!=(t=fI[e.code])?t:`Error ${e.code}`,message:null!=(i=fC[e.code])?i:e.message}};var fx=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)};function fP(e){var t;let{title:i,message:r}=null!=(t=fD(e))?t:{},a="";return i&&(a+=`<slot name="error-${e.code}-title"><h3>${i}</h3></slot>`),r&&(a+=`<slot name="error-${e.code}-message"><p>${r}</p></slot>`),a}let fM=[hb.MEDIA_ERROR_CODE,hb.MEDIA_ERROR_MESSAGE];class fO extends fh{constructor(){super(...arguments),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,y6,null)}static get observedAttributes(){return[...super.observedAttributes,...fM]}formatErrorMessage(e){return this.constructor.formatErrorMessage(e)}attributeChangedCallback(e,t,i){var r;if(super.attributeChangedCallback(e,t,i),!fM.includes(e))return;let a=null!=(r=this.mediaError)?r:{code:this.mediaErrorCode,message:this.mediaErrorMessage};this.open=a.code&&null!==fD(a),this.open&&(this.shadowRoot.querySelector("slot").name=`error-${this.mediaErrorCode}`,this.shadowRoot.querySelector("#content").innerHTML=this.formatErrorMessage(a))}get mediaError(){var e,t;return fx(this,e=y6,"read from private field"),t?t.call(this):e.get(this)}set mediaError(e){var t,i;fx(this,t=y6,"write to private field"),i?i.call(this,e):t.set(this,e)}get mediaErrorCode(){return cd(this,"mediaerrorcode")}set mediaErrorCode(e){cu(this,"mediaerrorcode",e)}get mediaErrorMessage(){return cm(this,"mediaerrormessage")}set mediaErrorMessage(e){cf(this,"mediaerrormessage",e)}}y6=new WeakMap,fO.getSlotTemplateHTML=function(e){return` 880 <style> 881 :host { 882 background: rgb(20 20 30 / .8); 883 } 884 885 #content { 886 display: block; 887 padding: 1.2em 1.5em; 888 } 889 890 h3, 891 p { 892 margin-block: 0 .3em; 893 } 894 </style> 895 <slot name="error-${e.mediaerrorcode}" id="content"> 896 ${fP({code:+e.mediaerrorcode,message:e.mediaerrormessage})} 897 </slot> 898 `},fO.formatErrorMessage=fP,h0.customElements.get("media-error-dialog")||h0.customElements.define("media-error-dialog",fO);var fN=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot read from private field");return i?i.call(e):t.get(e)},fU=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)};class fF extends fh{constructor(){super(...arguments),fU(this,y7,e=>{var t;if(!this.open)return;let i=null==(t=this.shadowRoot)?void 0:t.querySelector("#content");if(!i)return;let r=e.composedPath(),a=r[0]===this||r.includes(this),s=r.includes(i);a&&!s&&(this.open=!1)}),fU(this,Ee,e=>{if(!this.open)return;let t=e.shiftKey&&("/"===e.key||"?"===e.key);"Escape"!==e.key&&!t||e.ctrlKey||e.altKey||e.metaKey||(this.open=!1,e.preventDefault(),e.stopPropagation())})}connectedCallback(){super.connectedCallback(),this.open&&(this.addEventListener("click",fN(this,y7)),document.addEventListener("keydown",fN(this,Ee)))}disconnectedCallback(){this.removeEventListener("click",fN(this,y7)),document.removeEventListener("keydown",fN(this,Ee))}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),"open"===e&&(this.open?(this.addEventListener("click",fN(this,y7)),document.addEventListener("keydown",fN(this,Ee))):(this.removeEventListener("click",fN(this,y7)),document.removeEventListener("keydown",fN(this,Ee))))}}y7=new WeakMap,Ee=new WeakMap,fF.getSlotTemplateHTML=function(e){let t;return` 899 <style> 900 :host { 901 position: fixed; 902 top: 0; 903 left: 0; 904 z-index: 9999; 905 background: rgb(20 20 30 / .8); 906 backdrop-filter: blur(10px); 907 } 908 909 #content { 910 display: block; 911 width: clamp(400px, 40vw, 700px); 912 max-width: 90vw; 913 text-align: left; 914 } 915 916 h2 { 917 margin: 0 0 1.5rem 0; 918 font-size: 1.5rem; 919 font-weight: 500; 920 text-align: center; 921 } 922 923 .shortcuts-table { 924 width: 100%; 925 border-collapse: collapse; 926 } 927 928 .shortcuts-table tr { 929 border-bottom: 1px solid rgba(255, 255, 255, 0.1); 930 } 931 932 .shortcuts-table tr:last-child { 933 border-bottom: none; 934 } 935 936 .shortcuts-table td { 937 padding: 0.75rem 0.5rem; 938 } 939 940 .shortcuts-table td:first-child { 941 text-align: right; 942 padding-right: 1rem; 943 width: 40%; 944 min-width: 120px; 945 } 946 947 .shortcuts-table td:last-child { 948 padding-left: 1rem; 949 } 950 951 .key { 952 display: inline-block; 953 background: rgba(255, 255, 255, 0.15); 954 border: 1px solid rgba(255, 255, 255, 0.2); 955 border-radius: 4px; 956 padding: 0.25rem 0.5rem; 957 font-family: 'Courier New', monospace; 958 font-size: 0.9rem; 959 font-weight: 500; 960 min-width: 1.5rem; 961 text-align: center; 962 margin: 0 0.2rem; 963 } 964 965 .description { 966 color: rgba(255, 255, 255, 0.9); 967 font-size: 0.95rem; 968 } 969 970 .key-combo { 971 display: flex; 972 align-items: center; 973 justify-content: flex-end; 974 gap: 0.3rem; 975 } 976 977 .key-separator { 978 color: rgba(255, 255, 255, 0.5); 979 font-size: 0.9rem; 980 } 981 </style> 982 <slot id="content"> 983 ${t=[{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:e,description:t})=>{let i=e.map((e,t)=>t>0?`<span class="key-separator">or</span><span class="key">${e}</span>`:`<span class="key">${e}</span>`).join("");return` 984 <tr> 985 <td> 986 <div class="key-combo">${i}</div> 987 </td> 988 <td class="description">${t}</td> 989 </tr> 990 `}).join(""),` 991 <h2>Keyboard Shortcuts</h2> 992 <table class="shortcuts-table">${t}</table> 993 `} 994 </slot> 995 `},h0.customElements.get("media-keyboard-shortcuts-dialog")||h0.customElements.define("media-keyboard-shortcuts-dialog",fF);var fB=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)};let f$=`<svg aria-hidden="true" viewBox="0 0 26 24"> 996 <path d="M16 3v2.5h3.5V9H22V3h-6ZM4 9h2.5V5.5H10V3H4v6Zm15.5 9.5H16V21h6v-6h-2.5v3.5ZM6.5 15H4v6h6v-2.5H6.5V15Z"/> 997</svg>`,fH=`<svg aria-hidden="true" viewBox="0 0 26 24"> 998 <path d="M18.5 6.5V3H16v6h6V6.5h-3.5ZM16 21h2.5v-3.5H22V15h-6v6ZM4 17.5h3.5V21H10v-6H4v2.5Zm3.5-11H4V9h6V3H7.5v3.5Z"/> 999</svg>`,fV=e=>{let t=e.mediaIsFullscreen?hq("exit fullscreen mode"):hq("enter fullscreen mode");e.setAttribute("aria-label",t)};class fG extends m3{constructor(){super(...arguments),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,Et,null)}static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_IS_FULLSCREEN,hb.MEDIA_FULLSCREEN_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),fV(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===hb.MEDIA_IS_FULLSCREEN&&fV(this)}get mediaFullscreenUnavailable(){return cm(this,hb.MEDIA_FULLSCREEN_UNAVAILABLE)}set mediaFullscreenUnavailable(e){cf(this,hb.MEDIA_FULLSCREEN_UNAVAILABLE,e)}get mediaIsFullscreen(){return ch(this,hb.MEDIA_IS_FULLSCREEN)}set mediaIsFullscreen(e){cc(this,hb.MEDIA_IS_FULLSCREEN,e)}handleClick(e){var t,i,r,a;fB(this,t=Et,"write to private field"),i?i.call(this,e):t.set(this,e);let s=(fB(this,r=Et,"read from private field"),(a?a.call(this):r.get(this))instanceof PointerEvent),n=this.mediaIsFullscreen?new h0.CustomEvent(hg.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0}):new h0.CustomEvent(hg.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0,detail:s});this.dispatchEvent(n)}}Et=new WeakMap,fG.getSlotTemplateHTML=function(e){return` 1000 <style> 1001 :host([${hb.MEDIA_IS_FULLSCREEN}]) slot[name=icon] slot:not([name=exit]) { 1002 display: none !important; 1003 } 1004 1005 1006 :host(:not([${hb.MEDIA_IS_FULLSCREEN}])) slot[name=icon] slot:not([name=enter]) { 1007 display: none !important; 1008 } 1009 1010 :host([${hb.MEDIA_IS_FULLSCREEN}]) slot[name=tooltip-enter], 1011 :host(:not([${hb.MEDIA_IS_FULLSCREEN}])) slot[name=tooltip-exit] { 1012 display: none; 1013 } 1014 </style> 1015 1016 <slot name="icon"> 1017 <slot name="enter">${f$}</slot> 1018 <slot name="exit">${fH}</slot> 1019 </slot> 1020 `},fG.getTooltipContentHTML=function(){return` 1021 <slot name="tooltip-enter">${hq("Enter fullscreen mode")}</slot> 1022 <slot name="tooltip-exit">${hq("Exit fullscreen mode")}</slot> 1023 `},h0.customElements.get("media-fullscreen-button")||h0.customElements.define("media-fullscreen-button",fG);let{MEDIA_TIME_IS_LIVE:fW,MEDIA_PAUSED:fK}=hb,{MEDIA_SEEK_TO_LIVE_REQUEST:fq,MEDIA_PLAY_REQUEST:fj}=hg,fY=e=>{var t;let i=e.mediaPaused||!e.mediaTimeIsLive,r=i?hq("seek to live"):hq("playing live");e.setAttribute("aria-label",r);let a=null==(t=e.shadowRoot)?void 0:t.querySelector('slot[name="text"]');a&&(a.textContent=hq("live")),i?e.removeAttribute("aria-disabled"):e.setAttribute("aria-disabled","true")};class fz extends m3{static get observedAttributes(){return[...super.observedAttributes,fW,fK]}connectedCallback(){super.connectedCallback(),fY(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),fY(this)}get mediaPaused(){return ch(this,hb.MEDIA_PAUSED)}set mediaPaused(e){cc(this,hb.MEDIA_PAUSED,e)}get mediaTimeIsLive(){return ch(this,hb.MEDIA_TIME_IS_LIVE)}set mediaTimeIsLive(e){cc(this,hb.MEDIA_TIME_IS_LIVE,e)}handleClick(){(this.mediaPaused||!this.mediaTimeIsLive)&&(this.dispatchEvent(new h0.CustomEvent(fq,{composed:!0,bubbles:!0})),this.hasAttribute(fK)&&this.dispatchEvent(new h0.CustomEvent(fj,{composed:!0,bubbles:!0})))}}fz.getSlotTemplateHTML=function(e){return` 1024 <style> 1025 :host { --media-tooltip-display: none; } 1026 1027 slot[name=indicator] > *, 1028 :host ::slotted([slot=indicator]) { 1029 1030 min-width: auto; 1031 fill: var(--media-live-button-icon-color, rgb(140, 140, 140)); 1032 color: var(--media-live-button-icon-color, rgb(140, 140, 140)); 1033 } 1034 1035 :host([${fW}]:not([${fK}])) slot[name=indicator] > *, 1036 :host([${fW}]:not([${fK}])) ::slotted([slot=indicator]) { 1037 fill: var(--media-live-button-indicator-color, rgb(255, 0, 0)); 1038 color: var(--media-live-button-indicator-color, rgb(255, 0, 0)); 1039 } 1040 1041 :host([${fW}]:not([${fK}])) { 1042 cursor: var(--media-cursor, not-allowed); 1043 } 1044 1045 slot[name=text]{ 1046 text-transform: uppercase; 1047 } 1048 1049 </style> 1050 1051 <slot name="indicator"><svg viewBox="0 0 6 12"><circle cx="3" cy="6" r="2"></circle></svg></slot> 1052 1053 <slot name="spacer"> </slot><slot name="text">${hq("live")}</slot> 1054 `},h0.customElements.get("media-live-button")||h0.customElements.define("media-live-button",fz);var fX=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},fQ=(e,t,i)=>(fX(e,t,"read from private field"),i?i.call(e):t.get(e)),fZ=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},fJ=(e,t,i,r)=>(fX(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);let f0="loadingdelay",f1="noautohide",f2=` 1055<svg aria-hidden="true" viewBox="0 0 100 100"> 1056 <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"> 1057 <animateTransform 1058 attributeName="transform" 1059 attributeType="XML" 1060 type="rotate" 1061 dur="1s" 1062 from="0 50 50" 1063 to="360 50 50"
1064 repeatCount="indefinite" /> 1065 </path> 1066</svg> 1067`;class f3 extends h0.HTMLElement{constructor(){if(super(),fZ(this,Ei,void 0),fZ(this,Er,500),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=h9(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[hv.MEDIA_CONTROLLER,hb.MEDIA_PAUSED,hb.MEDIA_LOADING,f0]}attributeChangedCallback(e,t,i){var r,a,s,n,o;e===f0&&t!==i?this.loadingDelay=Number(i):e===hv.MEDIA_CONTROLLER&&(t&&(null==(a=null==(r=fQ(this,Ei))?void 0:r.unassociateElement)||a.call(r,this),fJ(this,Ei,null)),i&&this.isConnected&&(fJ(this,Ei,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=fQ(this,Ei))?void 0:n.associateElement)||o.call(n,this)))}connectedCallback(){var e,t,i;let r=this.getAttribute(hv.MEDIA_CONTROLLER);r&&(fJ(this,Ei,null==(e=this.getRootNode())?void 0:e.getElementById(r)),null==(i=null==(t=fQ(this,Ei))?void 0:t.associateElement)||i.call(t,this))}disconnectedCallback(){var e,t;null==(t=null==(e=fQ(this,Ei))?void 0:e.unassociateElement)||t.call(e,this),fJ(this,Ei,null)}get loadingDelay(){return fQ(this,Er)}set loadingDelay(e){fJ(this,Er,e);let{style:t}=co(this.shadowRoot,":host");t.setProperty("--_loading-indicator-delay",`var(--media-loading-indicator-transition-delay, ${e}ms)`)}get mediaPaused(){return ch(this,hb.MEDIA_PAUSED)}set mediaPaused(e){cc(this,hb.MEDIA_PAUSED,e)}get mediaLoading(){return ch(this,hb.MEDIA_LOADING)}set mediaLoading(e){cc(this,hb.MEDIA_LOADING,e)}get mediaController(){return cm(this,hv.MEDIA_CONTROLLER)}set mediaController(e){cf(this,hv.MEDIA_CONTROLLER,e)}get noAutohide(){return ch(this,f1)}set noAutohide(e){cc(this,f1,e)}}Ei=new WeakMap,Er=new WeakMap,f3.shadowRootOptions={mode:"open"},f3.getTemplateHTML=function(e){return` 1068 <style> 1069 :host { 1070 display: var(--media-control-display, var(--media-loading-indicator-display, inline-block)); 1071 vertical-align: middle; 1072 box-sizing: border-box; 1073 --_loading-indicator-delay: var(--media-loading-indicator-transition-delay, 500ms); 1074 } 1075 1076 #status { 1077 color: rgba(0,0,0,0); 1078 width: 0px; 1079 height: 0px; 1080 } 1081 1082 :host slot[name=icon] > *, 1083 :host ::slotted([slot=icon]) { 1084 opacity: var(--media-loading-indicator-opacity, 0); 1085 transition: opacity 0.15s; 1086 } 1087 1088 :host([${hb.MEDIA_LOADING}]:not([${hb.MEDIA_PAUSED}])) slot[name=icon] > *, 1089 :host([${hb.MEDIA_LOADING}]:not([${hb.MEDIA_PAUSED}])) ::slotted([slot=icon]) { 1090 opacity: var(--media-loading-indicator-opacity, 1); 1091 transition: opacity 0.15s var(--_loading-indicator-delay); 1092 } 1093 1094 :host #status { 1095 visibility: var(--media-loading-indicator-opacity, hidden); 1096 transition: visibility 0.15s; 1097 } 1098 1099 :host([${hb.MEDIA_LOADING}]:not([${hb.MEDIA_PAUSED}])) #status { 1100 visibility: var(--media-loading-indicator-opacity, visible); 1101 transition: visibility 0.15s var(--_loading-indicator-delay); 1102 } 1103 1104 svg, img, ::slotted(svg), ::slotted(img) { 1105 width: var(--media-loading-indicator-icon-width); 1106 height: var(--media-loading-indicator-icon-height, 100px); 1107 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 1108 vertical-align: middle; 1109 } 1110 </style> 1111 1112 <slot name="icon">${f2}</slot> 1113 <div id="status" role="status" aria-live="polite">${hq("media loading")}</div> 1114 `},h0.customElements.get("media-loading-indicator")||h0.customElements.define("media-loading-indicator",f3);let f4=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1115 <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"/> 1116</svg>`,f5=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1117 <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"/> 1118</svg>`,f8=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1119 <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"/> 1120</svg>`,f9=e=>{let t="off"===e.mediaVolumeLevel?hq("unmute"):hq("mute");e.setAttribute("aria-label",t)};class f6 extends m3{static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_VOLUME_LEVEL]}connectedCallback(){super.connectedCallback(),f9(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===hb.MEDIA_VOLUME_LEVEL&&f9(this)}get mediaVolumeLevel(){return cm(this,hb.MEDIA_VOLUME_LEVEL)}set mediaVolumeLevel(e){cf(this,hb.MEDIA_VOLUME_LEVEL,e)}handleClick(){let e="off"===this.mediaVolumeLevel?hg.MEDIA_UNMUTE_REQUEST:hg.MEDIA_MUTE_REQUEST;this.dispatchEvent(new h0.CustomEvent(e,{composed:!0,bubbles:!0}))}}f6.getSlotTemplateHTML=function(e){return` 1121 <style> 1122 :host(:not([${hb.MEDIA_VOLUME_LEVEL}])) slot[name=icon] slot:not([name=high]), 1123 :host([${hb.MEDIA_VOLUME_LEVEL}=high]) slot[name=icon] slot:not([name=high]) { 1124 display: none !important; 1125 } 1126 1127 :host([${hb.MEDIA_VOLUME_LEVEL}=off]) slot[name=icon] slot:not([name=off]) { 1128 display: none !important; 1129 } 1130 1131 :host([${hb.MEDIA_VOLUME_LEVEL}=low]) slot[name=icon] slot:not([name=low]) { 1132 display: none !important; 1133 } 1134 1135 :host([${hb.MEDIA_VOLUME_LEVEL}=medium]) slot[name=icon] slot:not([name=medium]) { 1136 display: none !important; 1137 } 1138 1139 :host(:not([${hb.MEDIA_VOLUME_LEVEL}=off])) slot[name=tooltip-unmute], 1140 :host([${hb.MEDIA_VOLUME_LEVEL}=off]) slot[name=tooltip-mute] { 1141 display: none; 1142 } 1143 </style> 1144 1145 <slot name="icon"> 1146 <slot name="off">${f4}</slot> 1147 <slot name="low">${f5}</slot> 1148 <slot name="medium">${f5}</slot> 1149 <slot name="high">${f8}</slot> 1150 </slot> 1151 `},f6.getTooltipContentHTML=function(){return` 1152 <slot name="tooltip-mute">${hq("Mute")}</slot> 1153 <slot name="tooltip-unmute">${hq("Unmute")}</slot> 1154 `},h0.customElements.get("media-mute-button")||h0.customElements.define("media-mute-button",f6);let f7=`<svg aria-hidden="true" viewBox="0 0 28 24"> 1155 <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"/> 1156</svg>`,pe=e=>{let t=e.mediaIsPip?hq("exit picture in picture mode"):hq("enter picture in picture mode");e.setAttribute("aria-label",t)};class pt extends m3{static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_IS_PIP,hb.MEDIA_PIP_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),pe(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===hb.MEDIA_IS_PIP&&pe(this)}get mediaPipUnavailable(){return cm(this,hb.MEDIA_PIP_UNAVAILABLE)}set mediaPipUnavailable(e){cf(this,hb.MEDIA_PIP_UNAVAILABLE,e)}get mediaIsPip(){return ch(this,hb.MEDIA_IS_PIP)}set mediaIsPip(e){cc(this,hb.MEDIA_IS_PIP,e)}handleClick(){let e=this.mediaIsPip?hg.MEDIA_EXIT_PIP_REQUEST:hg.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new h0.CustomEvent(e,{composed:!0,bubbles:!0}))}}pt.getSlotTemplateHTML=function(e){return` 1157 <style> 1158 :host([${hb.MEDIA_IS_PIP}]) slot[name=icon] slot:not([name=exit]) { 1159 display: none !important; 1160 } 1161 1162 :host(:not([${hb.MEDIA_IS_PIP}])) slot[name=icon] slot:not([name=enter]) { 1163 display: none !important; 1164 } 1165 1166 :host([${hb.MEDIA_IS_PIP}]) slot[name=tooltip-enter], 1167 :host(:not([${hb.MEDIA_IS_PIP}])) slot[name=tooltip-exit] { 1168 display: none; 1169 } 1170 </style> 1171 1172 <slot name="icon"> 1173 <slot name="enter">${f7}</slot> 1174 <slot name="exit">${f7}</slot> 1175 </slot> 1176 `},pt.getTooltipContentHTML=function(){return` 1177 <slot name="tooltip-enter">${hq("Enter picture in picture mode")}</slot> 1178 <slot name="tooltip-exit">${hq("Exit picture in picture mode")}</slot> 1179 `},h0.customElements.get("media-pip-button")||h0.customElements.define("media-pip-button",pt);var pi=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot read from private field");return i?i.call(e):t.get(e)};let pr="rates",pa=[1,1.2,1.5,1.7,2];class ps extends m3{constructor(){var e;super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,Ea,new cB(this,pr,{defaultValue:pa})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${null!=(e=this.mediaPlaybackRate)?e:1}x`}static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_PLAYBACK_RATE,pr]}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),e===pr&&(pi(this,Ea).value=i),e===hb.MEDIA_PLAYBACK_RATE){let e=i?+i:NaN,t=Number.isNaN(e)?1:e;this.container.innerHTML=`${t}x`,this.setAttribute("aria-label",hq("Playback rate {playbackRate}",{playbackRate:t}))}}get rates(){return pi(this,Ea)}set rates(e){e?Array.isArray(e)?pi(this,Ea).value=e.join(" "):"str
1179ing"==typeof e&&(pi(this,Ea).value=e):pi(this,Ea).value=""}get mediaPlaybackRate(){return cd(this,hb.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){cu(this,hb.MEDIA_PLAYBACK_RATE,e)}handleClick(){var e,t;let i=Array.from(pi(this,Ea).values(),e=>+e).sort((e,t)=>e-t),r=null!=(t=null!=(e=i.find(e=>e>this.mediaPlaybackRate))?e:i[0])?t:1,a=new h0.CustomEvent(hg.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(a)}}Ea=new WeakMap,ps.getSlotTemplateHTML=function(e){return` 1180 <style> 1181 :host { 1182 min-width: 5ch; 1183 padding: var(--media-button-padding, var(--media-control-padding, 10px 5px)); 1184 } 1185 </style> 1186 <slot name="icon">${e.mediaplaybackrate||1}x</slot> 1187 `},ps.getTooltipContentHTML=function(){return hq("Playback rate")},h0.customElements.get("media-playback-rate-button")||h0.customElements.define("media-playback-rate-button",ps);let pn=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1188 <path d="m6 21 15-9L6 3v18Z"/> 1189</svg>`,po=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1190 <path d="M6 20h4V4H6v16Zm8-16v16h4V4h-4Z"/> 1191</svg>`,pl=e=>{let t=e.mediaPaused?hq("play"):hq("pause");e.setAttribute("aria-label",t)};class pd extends m3{static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_PAUSED,hb.MEDIA_ENDED]}connectedCallback(){super.connectedCallback(),pl(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),(e===hb.MEDIA_PAUSED||e===hb.MEDIA_LANG)&&pl(this)}get mediaPaused(){return ch(this,hb.MEDIA_PAUSED)}set mediaPaused(e){cc(this,hb.MEDIA_PAUSED,e)}handleClick(){let e=this.mediaPaused?hg.MEDIA_PLAY_REQUEST:hg.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new h0.CustomEvent(e,{composed:!0,bubbles:!0}))}}pd.getSlotTemplateHTML=function(e){return` 1192 <style> 1193 :host([${hb.MEDIA_PAUSED}]) slot[name=pause], 1194 :host(:not([${hb.MEDIA_PAUSED}])) slot[name=play] { 1195 display: none !important; 1196 } 1197 1198 :host([${hb.MEDIA_PAUSED}]) slot[name=tooltip-pause], 1199 :host(:not([${hb.MEDIA_PAUSED}])) slot[name=tooltip-play] { 1200 display: none; 1201 } 1202 </style> 1203 1204 <slot name="icon"> 1205 <slot name="play">${pn}</slot> 1206 <slot name="pause">${po}</slot> 1207 </slot> 1208 `},pd.getTooltipContentHTML=function(){return` 1209 <slot name="tooltip-play">${hq("Play")}</slot> 1210 <slot name="tooltip-pause">${hq("Pause")}</slot> 1211 `},h0.customElements.get("media-play-button")||h0.customElements.define("media-play-button",pd);let pu="placeholdersrc";class ph extends h0.HTMLElement{static get observedAttributes(){return[pu,"src"]}constructor(){if(super(),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=h9(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(e,t,i){if("src"===e&&(null==i?this.image.removeAttribute("src"):this.image.setAttribute("src",i)),e===pu)if(null==i)this.image.style.removeProperty("background-image");else{var r;r=this.image,r.style["background-image"]=`url('${i}')`}}get placeholderSrc(){return cm(this,pu)}set placeholderSrc(e){cf(this,"src",e)}get src(){return cm(this,"src")}set src(e){cf(this,"src",e)}}ph.shadowRootOptions={mode:"open"},ph.getTemplateHTML=function(e){return` 1212 <style> 1213 :host { 1214 pointer-events: none; 1215 display: var(--media-poster-image-display, inline-block); 1216 box-sizing: border-box; 1217 } 1218 1219 img { 1220 max-width: 100%; 1221 max-height: 100%; 1222 min-width: 100%; 1223 min-height: 100%; 1224 background-repeat: no-repeat; 1225 background-position: var(--media-poster-image-background-position, var(--media-object-position, center)); 1226 background-size: var(--media-poster-image-background-size, var(--media-object-fit, contain)); 1227 object-fit: var(--media-object-fit, contain); 1228 object-position: var(--media-object-position, center); 1229 } 1230 </style> 1231 1232 <img part="poster img" aria-hidden="true" id="image"/> 1233 `},h0.customElements.get("media-poster-image")||h0.customElements.define("media-poster-image",ph);var pc=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)};Es=new WeakMap,h0.customElements.get("media-preview-chapter-display")||h0.customElements.define("media-preview-chapter-display",class extends fk{constructor(){super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,Es,void 0),((e,t,i,r)=>(pc(e,t,"write to private field"),r?r.call(e,i):t.set(e,i)))(this,Es,this.shadowRoot.querySelector("slot"))}static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_PREVIEW_CHAPTER,hb.MEDIA_LA
1233NG]}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),(e===hb.MEDIA_PREVIEW_CHAPTER||e===hb.MEDIA_LANG)&&i!==t&&null!=i){var r;if((pc(this,Es,"read from private field"),r?r.call(this):Es.get(this)).textContent=i,""!==i){let e=hq("chapter: {chapterName}",{chapterName:i});this.setAttribute("aria-valuetext",e)}else this.removeAttribute("aria-valuetext")}}get mediaPreviewChapter(){return cm(this,hb.MEDIA_PREVIEW_CHAPTER)}set mediaPreviewChapter(e){cf(this,hb.MEDIA_PREVIEW_CHAPTER,e)}});var pm=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},pf=(e,t,i)=>(pm(e,t,"read from private field"),i?i.call(e):t.get(e)),pp=(e,t,i,r)=>(pm(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);class pg extends h0.HTMLElement{constructor(){if(super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,En,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=h9(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[hv.MEDIA_CONTROLLER,hb.MEDIA_PREVIEW_IMAGE,hb.MEDIA_PREVIEW_COORDS]}connectedCallback(){var e,t,i;let r=this.getAttribute(hv.MEDIA_CONTROLLER);r&&(pp(this,En,null==(e=this.getRootNode())?void 0:e.getElementById(r)),null==(i=null==(t=pf(this,En))?void 0:t.associateElement)||i.call(t,this))}disconnectedCallback(){var e,t;null==(t=null==(e=pf(this,En))?void 0:e.unassociateElement)||t.call(e,this),pp(this,En,null)}attributeChangedCallback(e,t,i){var r,a,s,n,o;[hb.MEDIA_PREVIEW_IMAGE,hb.MEDIA_PREVIEW_COORDS].includes(e)&&this.update(),e===hv.MEDIA_CONTROLLER&&(t&&(null==(a=null==(r=pf(this,En))?void 0:r.unassociateElement)||a.call(r,this),pp(this,En,null)),i&&this.isConnected&&(pp(this,En,null==(s=this.getRootNode())?void 0:s.getElementById(i)),null==(o=null==(n=pf(this,En))?void 0:n.associateElement)||o.call(n,this)))}get mediaPreviewImage(){return cm(this,hb.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){cf(this,hb.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewCoords(){let e=this.getAttribute(hb.MEDIA_PREVIEW_COORDS);if(e)return e.split(/\s+/).map(e=>+e)}set mediaPreviewCoords(e){e?this.setAttribute(hb.MEDIA_PREVIEW_COORDS,e.join(" ")):this.removeAttribute(hb.MEDIA_PREVIEW_COORDS)}update(){let e=this.mediaPreviewCoords,t=this.mediaPreviewImage;if(!(e&&t))return;let[i,r,a,s]=e,n=t.split("#")[0],{maxWidth:o,maxHeight:l,minWidth:d,minHeight:u}=getComputedStyle(this),h=Math.min(parseInt(o)/a,parseInt(l)/s),c=Math.max(parseInt(d)/a,parseInt(u)/s),m=h<1,f=m?h:c>1?c:1,{style:g}=co(this.shadowRoot,":host"),v=co(this.shadowRoot,"img").style,y=this.shadowRoot.querySelector("img"),E=m?"min":"max";g.setProperty(`${E}-width`,"initial","important"),g.setProperty(`${E}-height`,"initial","important"),g.width=`${a*f}px`,g.height=`${s*f}px`;let b=()=>{v.width=`${this.imgWidth*f}px`,v.height=`${this.imgHeight*f}px`,v.display="block"};y.src!==n&&(y.onload=()=>{this.imgWidth=y.naturalWidth,this.imgHeight=y.naturalHeight,b()},y.src=n,b()),b(),v.transform=`translate(-${i*f}px, -${r*f}px)`}}En=new WeakMap,pg.shadowRootOptions={mode:"open"},pg.getTemplateHTML=function(e){return` 1234 <style> 1235 :host { 1236 box-sizing: border-box; 1237 display: var(--media-control-display, var(--media-preview-thumbnail-display, inline-block)); 1238 overflow: hidden; 1239 } 1240 1241 img { 1242 display: none; 1243 position: relative; 1244 } 1245 </style> 1246 <img crossorigin loading="eager" decoding="async"> 1247 `},h0.customElements.get("media-preview-thumbnail")||h0.customElements.define("media-preview-thumbnail",pg);var pv=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},py=(e,t,i)=>(pv(e,t,"read from private field"),i?i.call(e):t.get(e));Eo=new WeakMap,h0.customElements.get("media-preview-time-display")||h0.customElements.define("media-preview-time-display",class extends fk{constructor(){super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,Eo,void 0),((e,t,i,r)=>(pv(e,t,"write to private field"),r?r.call(e,i):t.set(e,i)))(this,Eo,this.shadowRoot.querySelector("slot")),py(this,Eo).textContent=hH(0)}static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_PREVIEW_TIME]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===hb.MEDIA_PREVIEW_TIME&&null!=i&&(py(this,Eo).textContent=hH(parseFloat(i)))}get mediaPreviewTime(){return cd(this,hb.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){cu(this,hb.MEDIA_PREVIEW_TIME,e)}});let pE="seekoffset";class pb extends m3{static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_CURRENT_TIME,pE]}connectedCallback(){super.connectedCallback(),this.seekOffset=cd(this,pE,30)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===pE&&(this.seekOffset=cd(this,pE,30))}get seekOffset(){return cd(this,pE,30)}set seekOffset(e){cu(this,pE,e),this.setAttribute("aria-label",hq("seek back {seekOffset} seconds",{seekOffset:this.seekOffset})),ce(ct(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return cd(this,hb.MEDIA_CURRENT_TIME,0)}set mediaCurrentTime(e){cu(this,hb.MEDIA_CURRENT_TIME,e)}handleClick(){let e=Math.max(this.mediaCurrentTime-this.seekOffset,0),t=new h0.CustomEvent(hg.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}pb.getSlotTemplateHTML=function(e,t){let i;return` 1248 <slot name="icon">${i=t.seekOffset,` 1249 <svg aria-hidden="true" viewBox="0 0 20 24"> 1250 <defs> 1251 <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style> 1252 </defs> 1253 <text class="text value" transform="translate(2.18 19.87)">${i}</text> 1254 <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"/> 1255 </svg>`}</slot> 1256 `},pb.getTooltipContentHTML=function(){return hq("Seek backward")},h0.customElements.get("media-seek-backward-button")||h0.customElements.define("media-seek-backward-button",pb);let pT="seekoffset";class pA extends m3{static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_CURRENT_TIME,pT]}connectedCallback(){super.connectedCallback(),this.seekOffset=cd(this,pT,30)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===pT&&(this.seekOffset=cd(this,pT,30))}get seekOffset(){return cd(this,pT,30)}set seekOffset(e){cu(this,pT,e),this.setAttribute("aria-label",hq("seek forward {seekOffset} seconds",{seekOffset:this.seekOffset})),ce(ct(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return cd(this,hb.MEDIA_CURRENT_TIME,0)}set mediaCurrentTime(e){cu(this,hb.MEDIA_CURRENT_TIME,e)}handleClick(){let e=this.mediaCurrentTime+this.seekOffset,t=new h0.CustomEvent(hg.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}pA.getSlotTemplateHTML=function(e,t){let i;return` 1257 <slot name="icon">${i=t.seekOffset,` 1258 <svg aria-hidden="true" viewBox="0 0 20 24"> 1259 <defs> 1260 <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style> 1261 </defs> 1262 <text class="text value" transform="translate(8.9 19.87)">${i}</text> 1263 <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"/> 1264 </svg>`}</slot> 1265 `},pA.getTooltipContentHTML=function(){return hq("Seek forward")},h0.customElements.get("media-seek-forward-button")||h0.customElements.define("media-seek-forward-button",pA);var p_=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},pS=(e,t,i)=>(p_(e,t,"read from private field"),i?i.call(e):t.get(e));let pk={REMAINING:"remaining",SHOW_DURATION:"showduration",NO_TOGGLE:"notoggle"},pL=[...Object.values(pk),hb.MEDIA_CURRENT_TIME,hb.MEDIA_DURATION,hb.MEDIA_SEEKABLE],pw=["Enter"," "],pR=" / ",pI=(e,{timesSep:t=pR}={})=>{var i,r;let a=null!=(i=e.mediaCurrentTime)?i:0,[,s]=null!=(r=e.mediaSeekable)?r:[],n=0;Number.isFinite(e.mediaDuration)?n=e.mediaDuration:Number.isFinite(s)&&(n=s);let o=e.remaining?hH(0-(n-a)):hH(a);return e.showDuration?`${o}${t}${hH(n)}`:o};class pC extends fk{constructor(){super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,El,void 0),((e,t,i,r)=>(p_(e,t,"write to private field"),r?r.call(e,i):t.set(e,i)))(this,El,this.shadowRoot.querySelector("slot")),pS(this,El).innerHTML=`${pI(this)}`}static get observedAttributes(){return[...super.observedAttributes,...pL,"disabled"]}connectedCallback(){let{style:e}=co(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",hq("playback time"));let t=e=>{let{key:i}=e;pw.includes(i)?this.toggleTimeDisplay():this.removeEventListener("keyup",t)};this.addEventListener("keydown",e=>{let{metaKey:i,altKey:r,key:a}=e;i||r||!pw.includes(a)?this.removeEventListener("keyup",t):this.addEventListener("keyup",t)}),this.addEventListener("click",this.toggleTimeDisplay),super.connectedCallback()}toggleTimeDisplay(){this.noToggle||(this.hasAttribute("remaining")?this.removeAttribute("remaining"):this.setAttribute("remaining",""))}disconnectedCallback(){this.disable(),super.disconnectedCallback()}attributeChangedCallback(e,t,i){pL.includes(e)?this.update():"disabled"===e&&i!==t&&(null==i?this.enable():this.disable()),super.attributeChangedCallback(e,t,i)}enable(){this.tabIndex=0}disable(){this.tabIndex=-1}get remaining(){return ch(this,pk.REMAINING)}set remaining(e){cc(this,pk.REMAINING,e)}get showDuration(){return ch(this,pk.SHOW_DURATION)}set showDuration(e){cc(this,pk.SHOW_DURATION,e)}get noToggle(){return ch(this,pk.NO_TOGGLE)}set noToggle(e){cc(this,pk.NO_TOGGLE,e)}get mediaDuration(){return cd(this,hb.MEDIA_DURATION)}set mediaDuration(e){cu(this,hb.MEDIA_DURATION,e)}get mediaCurrentTime(){return cd(this,hb.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){cu(this,hb.MEDIA_CURRENT_TIME,e)}get mediaSeekable(){let e=this.getAttribute(hb.MEDIA_SEEKABLE);if(e)return e.split(":").map(e=>+e)}set mediaSeekable(e){null==e?this.removeAttribute(hb.MEDIA_SEEKABLE):this.setAttribute(hb.MEDIA_SEEKABLE,e.join(":"))}update(){let e=pI(this);(e=>{var t;let i=e.mediaCurrentTime,[,r]=null!=(t=e.mediaSeekable)?t:[],a=null;if(Number.isFinite(e.mediaDuration)?a=e.mediaDuration:Number.isFinite(r)&&(a=r),null==i||null===a)return e.setAttribute("aria-valuetext","video not loaded, unknown time.");let s=e.remaining?h$(0-(a-i)):h$(i);if(!e.showDuration)return e.setAttribute("aria-valuetext",s);let n=h$(a),o=`${s} of ${n}`;e.setAttribute("aria-valuetext",o)})(this),e!==pS(this,El).innerHTML&&(pS(this,El).innerHTML=e)}}El=new WeakMap,pC.getSlotTemplateHTML=function(e,t){return` 1266 <slot>${pI(t)}</slot> 1267 `},h0.customElements.get("media-time-display")||h0.customElements.define("media-time-display",pC);var pD=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},px=(e,t,i)=>(pD(e,t,"read from private field"),i?i.call(e):t.get(e)),pP=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},pM=(e,t,i,r)=>(pD(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);class pO{constructor(e,t,i){pP(this,Ed,void 0),pP(this,Eu,void 0),pP(this,Eh,void 0),pP(this,Ec,void 0),pP(this,Em,void 0),pP(this,Ef,void 0),pP(this,Ep,void 0),pP(this,Eg,void 0),pP(this,Ev,0),pP(this,Ey,(e=performance.now())=>{pM(this,Ev,requestAnimationFrame(px(this,Ey))),pM(this,Ec,performance.now()-px(this,Eh));let t=1e3/this.fps;if(px(this,Ec)>t){let i,r,a,s;pM(this,Eh,e-px(this,Ec)%t);let n=1e3/((e-px(this,Eu))/++(i=this,r=Em,{set _(value){pM(i,r,value,a)},get _(){return px(i,r,s)}})._),o=(e-px(this,Ef))/1e3/this.duration,l=px(this,Ep)+o*this.playbackRate;l-px(this,Ed).valueAsNumber>0?pM(this,Eg,this.playbackRate/this.duration/n):(pM(this,Eg,.995*px(this,Eg)),l=px(this,Ed).valueAsNumber+px(this,Eg)),this.callback(l)}}),pM(this,Ed,e),this.callback=t,this.fps=i}start(){0===px(this,Ev)&&(pM(this,Eh,performance.now()),pM(this,Eu,px(this,Eh)),pM(this,Em,0),px(this,Ey).call(this))}stop(){0!==px(this,Ev)&&(cancelAnimationFrame(px(this,Ev)),pM(this,Ev,0))}update({start:e,duration:t,playbackRate:i}){let r=e-px(this,Ed).valueAsNumber,a=Math.abs(t-this.duration);(r>0||r<-.03||a>=.5)&&this.callback(e),pM(this,Ep,e),pM(this,Ef,performance.now()),this.duration=t,this.playbackRate=i}}Ed=new WeakMap,Eu=new WeakMap,Eh=new WeakMap,Ec=new WeakMap,Em=new WeakMap,Ef=new WeakMap,Ep=new WeakMap,Eg=new WeakMap,Ev=new WeakMap,Ey=new WeakMap;var pN=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},pU=(e,t,i)=>(pN(e,t,"read from private field"),i?i.call(e):t.get(e)),pF=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},pB=(e,t,i,r)=>(pN(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),p$=(e,t,i)=>(pN(e,t,"access private method"),i);let pH=(e,t=e.mediaCurrentTime)=>{let i=Number.isFinite(e.mediaSeekableStart)?e.mediaSeekableStart:0,r=Number.isFinite(e.mediaDuration)?e.mediaDuration:e.mediaSeekableEnd;return Number.isNaN(r)?0:Math.max(0,Math.min((t-i)/(r-i),1))},pV=(e,t=e.range.valueAsNumber)=>{let i=Number.isFinite(e.mediaSeekableStart)?e.mediaSeekableStart:0,r=Number.isFinite(e.mediaDuration)?e.mediaDuration:e.mediaSeekableEnd;return Number.isNaN(r)?0:t*(r-i)+i};class pG extends fv{constructor(){super(),pF(this,EI),pF(this,ED),pF(this,EM),pF(this,EN),pF(this,EF),pF(this,E$),pF(this,EV),pF(this,EW),pF(this,EE,void 0),pF(this,Eb,void 0),pF(this,ET,void 0),pF(this,EA,void 0),pF(this,E_,void 0),pF(this,ES,void 0),pF(this,Ek,void 0),pF(this,EL,void 0),pF(this,Ew,void 0),pF(this,ER,void 0),pF(this,EP,e=>{!this.dragging&&(hN(e)&&(this.range.valueAsNumber=e),pU(this,ER)||this.updateBar())}),this.shadowRoot.querySelector("#track").insertAdjacentHTML("afterbegin",'<div id="buffered" part="buffered"></div>'),pB(this,ET,this.shadowRoot.querySelectorAll('[part~="box"]')),pB(this,E_,this.shadowRoot.querySelector('[part~="preview-box"]')),pB(this,ES,this.shadowRoot.querySelector('[part~="current-box"]'));const e=getComputedStyle(this);pB(this,Ek,parseInt(e.getPropertyValue("--media-box-padding-left"))),pB(this,EL,parseInt(e.getPropertyValue("--media-box-padding-right"))),pB(this,Eb,new pO(this.range,pU(this,EP),60))}static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_PAUSED,hb.MEDIA_DURATION,hb.MEDIA_SEEKABLE,hb.MEDIA_CURRENT_TIME,hb.MEDIA_PREVIEW_IMAGE,hb.MEDIA_PREVIEW_TIME,hb.MEDIA_PREVIEW_CHAPTER,hb.MEDIA_BUFFERED,hb.MEDIA_PLAYBACK_RATE,hb.MEDIA_LOADING,hb.MEDIA_ENDED]}connectedCallback(){var e;super.connectedCallback(),this.range.setAttribute("aria-label",hq("seek")),p$(this,EI,EC).call(this),pB(this,EE,this.getRootNode()),null==(e=pU(this,EE))||e.addEventListener("transitionstart",this)}disconnectedCallback(){var e;super.disconnectedCallback(),p$(this,EI,EC).call(this),null==(e=pU(this,EE))||e.removeEventListener("transitionstart",this),pB(this,EE,null)}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),t!=i){if(e===hb.MEDIA_CURRENT_TIME||e===hb.MEDIA_PAUSED||e===hb.MEDIA_ENDED||e===hb.MEDIA_LOADING||e===hb.MEDIA_DURATION||e===hb.MEDIA_SEEKABLE){let e,t,i,r;pU(this,Eb).update({start:pH(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),p$(this,EI,EC).call(this),e=this.range,t=h$(+pV(this)),i=h$(+this.mediaSeekableEnd),r
1267=t&&i?`${t} of ${i}`:"video not loaded, unknown time.",e.setAttribute("aria-valuetext",r)}else e===hb.MEDIA_BUFFERED&&this.updateBufferedBar();(e===hb.MEDIA_DURATION||e===hb.MEDIA_SEEKABLE)&&(this.mediaChaptersCues=pU(this,Ew),this.updateBar())}}get mediaChaptersCues(){return pU(this,Ew)}set mediaChaptersCues(e){var t;pB(this,Ew,e),this.updateSegments(null==(t=pU(this,Ew))?void 0:t.map(e=>({start:pH(this,e.startTime),end:pH(this,e.endTime)})))}get mediaPaused(){return ch(this,hb.MEDIA_PAUSED)}set mediaPaused(e){cc(this,hb.MEDIA_PAUSED,e)}get mediaLoading(){return ch(this,hb.MEDIA_LOADING)}set mediaLoading(e){cc(this,hb.MEDIA_LOADING,e)}get mediaDuration(){return cd(this,hb.MEDIA_DURATION)}set mediaDuration(e){cu(this,hb.MEDIA_DURATION,e)}get mediaCurrentTime(){return cd(this,hb.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){cu(this,hb.MEDIA_CURRENT_TIME,e)}get mediaPlaybackRate(){return cd(this,hb.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){cu(this,hb.MEDIA_PLAYBACK_RATE,e)}get mediaBuffered(){let e=this.getAttribute(hb.MEDIA_BUFFERED);return e?e.split(" ").map(e=>e.split(":").map(e=>+e)):[]}set mediaBuffered(e){if(!e)return void this.removeAttribute(hb.MEDIA_BUFFERED);let t=e.map(e=>e.join(":")).join(" ");this.setAttribute(hb.MEDIA_BUFFERED,t)}get mediaSeekable(){let e=this.getAttribute(hb.MEDIA_SEEKABLE);if(e)return e.split(":").map(e=>+e)}set mediaSeekable(e){null==e?this.removeAttribute(hb.MEDIA_SEEKABLE):this.setAttribute(hb.MEDIA_SEEKABLE,e.join(":"))}get mediaSeekableEnd(){var e;let[,t=this.mediaDuration]=null!=(e=this.mediaSeekable)?e:[];return t}get mediaSeekableStart(){var e;let[t=0]=null!=(e=this.mediaSeekable)?e:[];return t}get mediaPreviewImage(){return cm(this,hb.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){cf(this,hb.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewTime(){return cd(this,hb.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){cu(this,hb.MEDIA_PREVIEW_TIME,e)}get mediaEnded(){return ch(this,hb.MEDIA_ENDED)}set mediaEnded(e){cc(this,hb.MEDIA_ENDED,e)}updateBar(){super.updateBar(),this.updateBufferedBar(),this.updateCurrentBox()}updateBufferedBar(){var e;let t,i=this.mediaBuffered;if(!i.length)return;if(this.mediaEnded)t=1;else{let r=this.mediaCurrentTime,[,a=this.mediaSeekableStart]=null!=(e=i.find(([e,t])=>e<=r&&r<=t))?e:[];t=pH(this,a)}let{style:r}=co(this.shadowRoot,"#buffered");r.setProperty("width",`${100*t}%`)}updateCurrentBox(){if(!this.shadowRoot.querySelector('slot[name="current"]').assignedElements().length)return;let e=co(this.shadowRoot,"#current-rail"),t=co(this.shadowRoot,'[part~="current-box"]'),i=p$(this,EM,EO).call(this,pU(this,ES)),r=p$(this,EN,EU).call(this,i,this.range.valueAsNumber),a=p$(this,EF,EB).call(this,i,this.range.valueAsNumber);e.style.transform=`translateX(${r})`,e.style.setProperty("--_range-width",`${i.range.width}`),t.style.setProperty("--_box-shift",`${a}`),t.style.setProperty("--_box-width",`${i.box.width}px`),t.style.setProperty("visibility","initial")}handleEvent(e){switch(super.handleEvent(e),e.type){case"input":p$(this,EW,EK).call(this);break;case"pointermove":p$(this,E$,EH).call(this,e);break;case"pointerup":pU(this,ER)&&pB(this,ER,!1);break;case"pointerdown":pB(this,ER,!0);break;case"pointerleave":p$(this,EV,EG).call(this,null);break;case"transitionstart":ci(e.target,this)&&setTimeout(()=>p$(this,EI,EC).call(this),0)}}}EE=new WeakMap,Eb=new WeakMap,ET=new WeakMap,EA=new WeakMap,E_=new WeakMap,ES=new WeakMap,Ek=new WeakMap,EL=new WeakMap,Ew=new WeakMap,ER=new WeakMap,EI=new WeakSet,EC=function(){p$(this,ED,Ex).call(this)?pU(this,Eb).start():pU(this,Eb).stop()},ED=new WeakSet,Ex=function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaSeekableEnd>0&&cn(this)}
1267,EP=new WeakMap,EM=new WeakSet,EO=function(e){var t;let i=(null!=(t=this.getAttribute("bounds")?cr(this,`#${this.getAttribute("bounds")}`):this.parentElement)?t:this).getBoundingClientRect(),r=this.range.getBoundingClientRect(),a=e.offsetWidth,s=-(r.left-i.left-a/2),n=i.right-r.left-a/2;return{box:{width:a,min:s,max:n},bounds:i,range:r}},EN=new WeakSet,EU=function(e,t){let i=`${100*t}%`,{width:r,min:a,max:s}=e.box;if(!r)return i;if(!Number.isNaN(a)){let e=`calc(1 / var(--_range-width) * 100 * ${a}% + var(--media-box-padding-left))`;i=`max(${e}, ${i})`}if(!Number.isNaN(s)){let e=`calc(1 / var(--_range-width) * 100 * ${s}% - var(--media-box-padding-right))`;i=`min(${i}, ${e})`}return i},EF=new WeakSet,EB=function(e,t){let{width:i,min:r,max:a}=e.box,s=t*e.range.width;if(s<r+pU(this,Ek)){let t=e.range.left-e.bounds.left-pU(this,Ek);return`${s-i/2+t}px`}if(s>a-pU(this,EL)){let t=e.bounds.right-e.range.right-pU(this,EL);return`${s+i/2-t-e.range.width}px`}return 0},E$=new WeakSet,EH=function(e){let t=[...pU(this,ET)].some(t=>e.composedPath().includes(t));if(!this.dragging&&(t||!e.composedPath().includes(this)))return void p$(this,EV,EG).call(this,null);let i=this.mediaSeekableEnd;if(!i)return;let r=co(this.shadowRoot,"#preview-rail"),a=co(this.shadowRoot,'[part~="preview-box"]'),s=p$(this,EM,EO).call(this,pU(this,E_)),n=(e.clientX-s.range.left)/s.range.width;n=Math.max(0,Math.min(1,n));let o=p$(this,EN,EU).call(this,s,n),l=p$(this,EF,EB).call(this,s,n);r.style.transform=`translateX(${o})`,r.style.setProperty("--_range-width",`${s.range.width}`),a.style.setProperty("--_box-shift",`${l}`),a.style.setProperty("--_box-width",`${s.box.width}px`),1>Math.abs(Math.round(pU(this,EA))-Math.round(n*i))&&n>.01&&n<.99||(pB(this,EA,n*i),p$(this,EV,EG).call(this,pU(this,EA)))},EV=new WeakSet,EG=function(e){this.dispatchEvent(new h0.CustomEvent(hg.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:e}))},EW=new WeakSet,EK=function(){pU(this,Eb).stop();let e=pV(this);this.dispatchEvent(new h0.CustomEvent(hg.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e}))},pG.shadowRootOptions={mode:"open"},pG.getContainerTemplateHTML=function(e){return` 1268 <style> 1269 :host { 1270 --media-box-border-radius: 4px; 1271 --media-box-padding-left: 10px; 1272 --media-box-padding-right: 10px; 1273 --media-preview-border-radius: var(--media-box-border-radius); 1274 --media-box-arrow-offset: var(--media-box-border-radius); 1275 --_control-background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))); 1276 --_preview-background: var(--media-preview-background, var(--_control-background)); 1277 1278 1279 contain: layout; 1280 } 1281 1282 #buffered { 1283 background: var(--media-time-range-buffered-color, rgb(255 255 255 / .4)); 1284 position: absolute; 1285 height: 100%; 1286 will-change: width; 1287 } 1288 1289 #preview-rail, 1290 #current-rail { 1291 width: 100%; 1292 position: absolute; 1293 left: 0; 1294 bottom: 100%; 1295 pointer-events: none; 1296 will-change: transform; 1297 } 1298 1299 [part~="box"] { 1300 width: min-content; 1301 1302 position: absolute; 1303 bottom: 100%; 1304 flex-direction: column; 1305 align-items: center; 1306 transform: translateX(-50%); 1307 } 1308 1309 [part~="current-box"] { 1310 display: var(--media-current-box-display, var(--media-box-display, flex)); 1311 margin: var(--media-current-box-margin, var(--media-box-margin, 0 0 5px)); 1312 visibility: hidden; 1313 } 1314 1315 [part~="preview-box"] { 1316 display: var(--media-preview-box-display, var(--media-box-display, flex)); 1317 margin: var(--media-preview-box-margin, var(--media-box-margin, 0 0 5px)); 1318 transition-property: var(--media-preview-transition-property, visibility, opacity); 1319 transition-duration: var(--media-preview-transition-duration-out, .25s); 1320 transition-delay: var(--media-preview-transition-delay-out, 0s); 1321 visibility: hidden; 1322 opacity: 0; 1323 } 1324 1325 :host(:is([${hb.MEDIA_PREVIEW_IMAGE}], [${hb.MEDIA_PREVIEW_TIME}])[dragging]) [part~="preview-box"] { 1326 transition-duration: var(--media-preview-transition-duration-in, .5s); 1327 transition-delay: var(--media-preview-transition-delay-in, .25s); 1328 visibility: visible; 1329 opacity: 1; 1330 } 1331 1332 @media (hover: hover) { 1333 :host(:is([${hb.MEDIA_PREVIEW_IMAGE}], [${hb.MEDIA_PREVIEW_TIME}]):hover) [part~="preview-box"] { 1334 transition-duration: var(--media-preview-transition-duration-in, .5s); 1335 transition-delay: var(--media-preview-transition-delay-in, .25s); 1336 visibility: visible; 1337 opacity: 1; 1338 } 1339 } 1340
1341 media-preview-thumbnail, 1342 ::slotted(media-preview-thumbnail) { 1343 visibility: hidden; 1344 1345 transition: visibility 0s .25s; 1346 transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s)); 1347 background: var(--media-preview-thumbnail-background, var(--_preview-background)); 1348 box-shadow: var(--media-preview-thumbnail-box-shadow, 0 0 4px rgb(0 0 0 / .2)); 1349 max-width: var(--media-preview-thumbnail-max-width, 180px); 1350 max-height: var(--media-preview-thumbnail-max-height, 160px); 1351 min-width: var(--media-preview-thumbnail-min-width, 120px); 1352 min-height: var(--media-preview-thumbnail-min-height, 80px); 1353 border: var(--media-preview-thumbnail-border); 1354 border-radius: var(--media-preview-thumbnail-border-radius, 1355 var(--media-preview-border-radius) var(--media-preview-border-radius) 0 0); 1356 } 1357 1358 :host([${hb.MEDIA_PREVIEW_IMAGE}][dragging]) media-preview-thumbnail, 1359 :host([${hb.MEDIA_PREVIEW_IMAGE}][dragging]) ::slotted(media-preview-thumbnail) { 1360 transition-delay: var(--media-preview-transition-delay-in, .25s); 1361 visibility: visible; 1362 } 1363 1364 @media (hover: hover) { 1365 :host([${hb.MEDIA_PREVIEW_IMAGE}]:hover) media-preview-thumbnail, 1366 :host([${hb.MEDIA_PREVIEW_IMAGE}]:hover) ::slotted(media-preview-thumbnail) { 1367 transition-delay: var(--media-preview-transition-delay-in, .25s); 1368 visibility: visible; 1369 } 1370 1371 :host([${hb.MEDIA_PREVIEW_TIME}]:hover) { 1372 --media-time-range-hover-display: block; 1373 } 1374 } 1375 1376 media-preview-chapter-display, 1377 ::slotted(media-preview-chapter-display) { 1378 font-size: var(--media-font-size, 13px); 1379 line-height: 17px; 1380 min-width: 0; 1381 visibility: hidden; 1382 1383 transition: min-width 0s, border-radius 0s, margin 0s, padding 0s, visibility 0s; 1384 transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s)); 1385 background: var(--media-preview-chapter-background, var(--_preview-background)); 1386 border-radius: var(--media-preview-chapter-border-radius, 1387 var(--media-preview-border-radius) var(--media-preview-border-radius) 1388 var(--media-preview-border-radius) var(--media-preview-border-radius)); 1389 padding: var(--media-preview-chapter-padding, 3.5px 9px); 1390 margin: var(--media-preview-chapter-margin, 0 0 5px); 1391 text-shadow: var(--media-preview-chapter-text-shadow, 0 0 4px rgb(0 0 0 / .75)); 1392 } 1393 1394 :host([${hb.MEDIA_PREVIEW_IMAGE}]) media-preview-chapter-display, 1395 :host([${hb.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-chapter-display) { 1396 transition-delay: var(--media-preview-transition-delay-in, .25s); 1397 border-radius: var(--media-preview-chapter-border-radius, 0); 1398 padding: var(--media-preview-chapter-padding, 3.5px 9px 0); 1399 margin: var(--media-preview-chapter-margin, 0); 1400 min-width: 100%; 1401 } 1402 1403 media-preview-chapter-display[${hb.MEDIA_PREVIEW_CHAPTER}], 1404 ::slotted(media-preview-chapter-display[${hb.MEDIA_PREVIEW_CHAPTER}]) { 1405 visibility: visible; 1406 } 1407 1408 media-preview-chapter-display:not([aria-valuetext]), 1409 ::slotted(media-preview-chapter-display:not([aria-valuetext])) { 1410 display: none; 1411 } 1412 1413 media-preview-time-display, 1414 ::slotted(media-preview-time-display), 1415 media-time-display, 1416 ::slotted(media-time-display) { 1417 font-size: var(--media-font-size, 13px); 1418 line-height: 17px; 1419 min-width: 0; 1420 1421 transition: min-width 0s, border-radius 0s; 1422 transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s)); 1423 background: var(--media-preview-time-background, var(--_preview-background)); 1424 border-radius: var(--media-preview-time-border-radius, 1425 var(--media-preview-border-radius) var(--media-preview-border-radius) 1426 var(--media-preview-border-radius) var(--media-preview-border-radius)); 1427 padding: var(--media-preview-time-padding, 3.5px 9px); 1428 margin: var(--media-preview-time-margin, 0); 1429 text-shadow: var(--media-preview-time-text-shadow, 0 0 4px rgb(0 0 0 / .75)); 1430 transform: translateX(min( 1431 max(calc(50% - var(--_box-width) / 2), 1432 calc(var(--_box-shift, 0))), 1433 calc(var(--_box-width) / 2 - 50%) 1434 )); 1435 } 1436 1437 :host([${hb.MEDIA_PREVIEW_IMAGE}]) media-preview-time-display, 1438 :host([${hb.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-time-display) { 1439 transition-delay: var(--media-preview-transition-delay-in, .25s); 1440 border-radius: var(--media-preview-time-border-radius, 1441 0 0 var(--media-preview-border-radius) var(--media-preview-border-radius)); 1442 min-width: 100%; 1443 } 1444 1445 :host([${hb.MEDIA_PREVIEW_TIME}]:hover) { 1446 --media-time-range-hover-display: block; 1447 } 1448 1449 [part~="arrow"], 1450 ::slotted([part~="arrow"]) { 1451 display: var(--media-box-arrow-display, inline-block); 1452 transform: translateX(min( 1453 max(calc(50% - var(--_box-width) / 2 + var(--media-box-arrow-offset)), 1454 calc(var(--_box-shift, 0))), 1455 calc(var(--_box-width) / 2 - 50% - var(--media-box-arrow-offset)) 1456 )); 1457 1458 border-color: transparent; 1459 border-top-color: var(--media-box-arrow-background, var(--_control-background)); 1460 border-width: var(--media-box-arrow-border-width, 1461 var(--media-box-arrow-height, 5px) var(--media-box-arrow-width, 6px) 0); 1462 border-style: solid; 1463 justify-content: center; 1464 height: 0; 1465 } 1466 </style> 1467 <div id="preview-rail"> 1468 <slot name="preview" part="box preview-box">
1469 <media-preview-thumbnail> 1470 <template shadowrootmode="${pg.shadowRootOptions.mode}"> 1471 ${pg.getTemplateHTML({})} 1472 </template> 1473 </media-preview-thumbnail> 1474 <media-preview-chapter-display></media-preview-chapter-display> 1475 <media-preview-time-display></media-preview-time-display> 1476 <slot name="preview-arrow"><div part="arrow"></div></slot> 1477 </slot> 1478 </div> 1479 <div id="current-rail"> 1480 <slot name="current" part="box current-box"> 1481 1482 </slot> 1483 </div> 1484 `},h0.customElements.get("media-time-range")||h0.customElements.define("media-time-range",pG),h0.customElements.get("media-volume-range")||h0.customElements.define("media-volume-range",class extends fv{static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_VOLUME,hb.MEDIA_MUTED,hb.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.addEventListener("input",()=>{let e=this.range.value,t=new h0.CustomEvent(hg.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)})}connectedCallback(){super.connectedCallback(),this.range.setAttribute("aria-label",hq("volume"))}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),e===hb.MEDIA_VOLUME||e===hb.MEDIA_MUTED){let e;this.range.valueAsNumber=this.mediaMuted?0:this.mediaVolume,this.range.setAttribute("aria-valuetext",(e=this.range.valueAsNumber,`${Math.round(100*e)}%`)),this.updateBar()}}
1484get mediaVolume(){return cd(this,hb.MEDIA_VOLUME,1)}set mediaVolume(e){cu(this,hb.MEDIA_VOLUME,e)}get mediaMuted(){return ch(this,hb.MEDIA_MUTED)}set mediaMuted(e){cc(this,hb.MEDIA_MUTED,e)}get mediaVolumeUnavailable(){return cm(this,hb.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(e){cf(this,hb.MEDIA_VOLUME_UNAVAILABLE,e)}});class pW extends m3{constructor(){super(...arguments),this.container=null}static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_LOOP]}connectedCallback(){var e;super.connectedCallback(),this.container=(null==(e=this.shadowRoot)?void 0:e.querySelector("#icon"))||null,this.container&&(this.container.textContent=hq("Loop"))}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===hb.MEDIA_LOOP&&this.container&&this.setAttribute("aria-checked",this.mediaLoop?"true":"false")}get mediaLoop(){return ch(this,hb.MEDIA_LOOP)}set mediaLoop(e){cc(this,hb.MEDIA_LOOP,e)}handleClick(){let e=!this.mediaLoop,t=new h0.CustomEvent(hg.MEDIA_LOOP_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}pW.getSlotTemplateHTML=function(e){return` 1485 <style> 1486 :host { 1487 min-width: 4ch; 1488 padding: var(--media-button-padding, var(--media-control-padding, 10px 5px)); 1489 width: 100%; 1490 display: grid; 1491 grid-template-columns: 1fr auto; 1492 gap: 1rem; 1493 font-weight: var(--media-button-font-weight, normal); 1494 } 1495 1496 #checked-indicator { 1497 display: none; 1498 } 1499 1500 :host([${hb.MEDIA_LOOP}]) #checked-indicator { 1501 display: block; 1502 } 1503 </style> 1504 1505 <span id="icon"> 1506 </span> 1507 1508 <div id="checked-indicator"> 1509 <svg aria-hidden="true" viewBox="0 1 24 24" part="checked-indicator indicator"> 1510 <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"/> 1511 </svg> 1512 </div> 1513 `},pW.getTooltipContentHTML=function(){return hq("Loop")},h0.customElements.get("media-loop-button")||h0.customElements.define("media-loop-button",pW);var pK=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},pq=(e,t,i)=>(pK(e,t,"read from private field"),i?i.call(e):t.get(e)),pj=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},pY=(e,t,i,r)=>(pK(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);let pz={processCallback(e,t,i){if(i){for(let[e,r]of t)if(e in i){let t=i[e];"boolean"==typeof t&&r instanceof p3&&"boolean"==typeof r.element[r.attributeName]?r.booleanValue=t:"function"==typeof t&&r instanceof p3?r.element[r.attributeName]=t:r.value=t}}}};class pX extends h0.DocumentFragment{constructor(e,t,i=pz){var r;super(),pj(this,Eq,void 0),pj(this,Ej,void 0),this.append(e.content.cloneNode(!0)),pY(this,Eq,pQ(this)),pY(this,Ej,i),null==(r=i.createCallback)||r.call(i,this,pq(this,Eq),t),i.processCallback(this,pq(this,Eq),t)}update(e){pq(this,Ej).processCallback(this,pq(this,Eq),e)}}Eq=new WeakMap,Ej=new WeakMap;let pQ=(e,t=[])=>{let i,r;for(let a of e.attributes||[])if(a.value.includes("{{")){let s=new p2;for([i,r]of pJ(a.value))if(i){let i=new p3(e,a.name,a.namespaceURI);s.append(i),t.push([r,i])}else s.append(r);a.value=s.toString()}for(let a of e.childNodes)if(1!==a.nodeType||a instanceof HTMLTemplateElement){let s=a.data;if(1===a.nodeType||s.includes("{{")){let n=[];if(s)for([i,r]of pJ(s))if(i){let i=new p4(e);n.push(i),t.push([r,i])}else n.push(new Text(r));else if(a instanceof HTMLTemplateElement){let i=new p5(e,a);n.push(i),t.push([i.expression,i])}a.replaceWith(...n.flatMap(e=>e.replacementNodes||[e]))}}else pQ(a,t);return t},pZ={},pJ=e=>{let t="",i=0,r=pZ[e],a=0,s;if(r)return r;for(r=[];s=e[a];a++)"{"===s&&"{"===e[a+1]&&"\\"!==e[a-1]&&e[a+2]&&1==++i?(t&&r.push([0,t]),t="",a++):"}"!==s||"}"!==e[a+1]||"\\"===e[a-1]||--i?t+=s||"":(r.push([1,t.trim()]),t="",a++);return t&&r.push([0,(i>0?"{{":"")+t]),pZ[e]=r};class p0{get value(){return""}set value(e){}toString(){return this.value}}let p1=new WeakMap;class p2{constructor(){pj(this,EY,[])}[Symbol.iterator](){return pq(this,EY).values()}get length(){return pq(this,EY).length}item(e){return pq(this,EY)[e]}append(...e){for(let t of e)t instanceof p3&&p1.set(t,this),pq(this,EY).push(t)}toString(){return pq(this,EY).join("")}}EY=new WeakMap;class p3 extends p0{constructor(e,t,i){super(),pj(this,EJ),pj(this,Ez,""),pj(this,EX,void 0),pj(this,EQ,void 0),pj(this,EZ,void 0),pY(this,EX,e),pY(this,EQ,t),pY(this,EZ,i)}get attributeName(){return pq(this,EQ)}get attributeNamespace(){return pq(this,EZ)}
1513get element(){return pq(this,EX)}get value(){return pq(this,Ez)}set value(e){pq(this,Ez)!==e&&(pY(this,Ez,e),pq(this,EJ,E0)&&1!==pq(this,EJ,E0).length?pq(this,EX).setAttributeNS(pq(this,EZ),pq(this,EQ),pq(this,EJ,E0).toString()):null==e?pq(this,EX).removeAttributeNS(pq(this,EZ),pq(this,EQ)):pq(this,EX).setAttributeNS(pq(this,EZ),pq(this,EQ),e))}get booleanValue(){return pq(this,EX).hasAttributeNS(pq(this,EZ),pq(this,EQ))}set booleanValue(e){if(pq(this,EJ,E0)&&1!==pq(this,EJ,E0).length)throw new DOMException("Value is not fully templatized");this.value=e?"":null}}Ez=new WeakMap,EX=new WeakMap,EQ=new WeakMap,EZ=new WeakMap,EJ=new WeakSet,E0=function(){return p1.get(this)};class p4 extends p0{constructor(e,t){super(),pj(this,E1,void 0),pj(this,E2,void 0),pY(this,E1,e),pY(this,E2,t?[...t]:[new Text])}get replacementNodes(){return pq(this,E2)}get parentNode(){return pq(this,E1)}get nextSibling(){return pq(this,E2)[pq(this,E2).length-1].nextSibling}get previousSibling(){return pq(this,E2)[0].previousSibling}get value(){return pq(this,E2).map(e=>e.textContent).join("")}set value(e){this.replace(e)}replace(...e){let t=e.flat().flatMap(e=>null==e?[new Text]:e.forEach?[...e]:11===e.nodeType?[...e.childNodes]:e.nodeType?[e]:[new Text(e)]);t.length||t.push(new Text),pY(this,E2,function(e,t,i,r=null){let a=0,s,n,o,l=i.length,d=t.length;for(;a<l&&a<d&&t[a]==i[a];)a++;for(;a<l&&a<d&&i[l-1]==t[d-1];)r=i[--d,--l];if(a==d)for(;a<l;)e.insertBefore(i[a++],r);if(a==l)for(;a<d;)e.removeChild(t[a++]);else{for(s=t[a];a<l;)o=i[a++],n=s?s.nextSibling:r,s==o?s=n:a<l&&i[a]==n?(e.replaceChild(o,s),s=n):e.insertBefore(o,s);for(;s!=r;)n=s.nextSibling,e.removeChild(s),s=n}return i}(pq(this,E2)[0].parentNode,pq(this,E2),t,this.nextSibling))}}E1=new WeakMap,E2=new WeakMap;class p5 extends p4{constructor(e,t){const i=t.getAttribute("directive")||t.getAttribute("type");let r=t.getAttribute("expression")||t.getAttribute(i)||"";r.startsWith("{{")&&(r=r.trim().slice(2,-2).trim()),super(e),this.expression=r,this.template=t,this.directive=i}}let p8={string:e=>String(e)};class p9{constructor(e){this.template=e,this.state=void 0}}let p6=new WeakMap,p7=new WeakMap,ge={partial:(e,t)=>{t[e.expression]=new p9(e.template)},if:(e,t)=>{var i;if(ga(e.expression,t))if(p6.get(e)!==e.template){p6.set(e,e.template);let i=new pX(e.template,t,gi);e.replace(i),p7.set(e,i)}else null==(i=p7.get(e))||i.update(t);else e.replace(""),p6.delete(e),p7.delete(e)}},gt=Object.keys(ge),gi={processCallback(e,t,i){var r,a;if(i)for(let[e,s]of t){if(s instanceof p5){if(!s.directive){let e=gt.find(e=>s.template.hasAttribute(e));e&&(s.directive=e,s.expression=s.template.getAttribute(e))}null==(r=ge[s.directive])||r.call(ge,s,i);continue}let t=ga(e,i);if(t instanceof p9){p6.get(s)!==t.template?(p6.set(s,t.template),s.value=t=new pX(t.template,t.state,gi),p7.set(s,t)):null==(a=p7.get(s))||a.update(t.state);continue}t?(s instanceof p3&&s.attributeName.startsWith("aria-")&&(t=String(t)),s instanceof p3?"boolean"==typeof t?s.booleanValue=t:"function"==typeof t?s.element[s.attributeName]=t:s.value=t:(s.value=t,p6.delete(s),p7.delete(s))):s instanceof p3?s.value=void 0:(s.value=void 0,p6.delete(s),p7.delete(s))}}},gr={"!":e=>!e,"!!":e=>!!e,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,">":(e,t)=>e>t,">=":(e,t)=>
1513e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"??":(e,t)=>null!=e?e:t,"|":(e,t)=>{var i;return null==(i=p8[t])?void 0:i.call(p8,e)}};function ga(e,t={}){var i,r,a,s,n,o,l;let d=(function(e,t){let i,r,a,s=[];for(;e;){for(let s in a=null,i=e.length,t)(r=t[s].exec(e))&&r.index<i&&(a={token:r[0],type:s,matches:r.slice(1)},i=r.index);i&&s.push({token:e.substr(0,i),type:void 0}),a&&s.push(a),e=e.substr(i+(a?a.token.length:0))}return s})(e,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:e})=>"ws"!==e);if(0===d.length||d.some(({type:e})=>!e))return gs(e);if((null==(i=d[0])?void 0:i.token)===">"){let i=t[null==(r=d[1])?void 0:r.token];if(!i)return gs(e);let o={...t};i.state=o;let l=d.slice(2);for(let e=0;e<l.length;e+=3){let i=null==(a=l[e])?void 0:a.token,r=null==(s=l[e+1])?void 0:s.token,d=null==(n=l[e+2])?void 0:n.token;i&&"="===r&&(o[i]=go(d,t))}return i}if(1===d.length)return gn(d[0])?go(d[0].token,t):gs(e);if(2===d.length){let i=gr[null==(o=d[0])?void 0:o.token];return i&&gn(d[1])?i(go(d[1].token,t)):gs(e)}if(3===d.length){let i=null==(l=d[1])?void 0:l.token,r=gr[i];if(!r||!gn(d[0])||!gn(d[2]))return gs(e);let a=go(d[0].token,t);return r(a,"|"===i?d[2].token:go(d[2].token,t))}}function gs(e){return console.warn(`Warning: invalid expression \`${e}\``),!1}function gn({type:e}){return["number","boolean","string","param"].includes(e)}function go(e,t){let i=e[0],r=e.slice(-1);return"true"===e||"false"===e?"true"===e:i===r&&["'",'"'].includes(i)?e.slice(1,-1):hU(e)?parseFloat(e):t[e]}var gl=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},gd=(e,t,i)=>(gl(e,t,"read from private field"),i?i.call(e):t.get(e)),gu=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},gh=(e,t,i,r)=>(gl(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),gc=(e,t,i)=>(gl(e,t,"access private method"),i);let gm={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},gf=h1.createElement("template");gf.innerHTML=` 1514 <style> 1515 :host { 1516 display: inline-block; 1517 line-height: 0; 1518 } 1519 1520 media-controller { 1521 width: 100%; 1522 height: 100%; 1523 } 1524 1525 media-captions-button:not([mediasubtitleslist]), 1526 media-captions-menu:not([mediasubtitleslist]), 1527 media-captions-menu-button:not([mediasubtitleslist]), 1528 media-audio-track-menu[mediaaudiotrackunavailable], 1529 media-audio-track-menu-button[mediaaudiotrackunavailable], 1530 media-rendition-menu[mediarenditionunavailable], 1531 media-rendition-menu-button[mediarenditionunavailable], 1532 media-volume-range[mediavolumeunavailable], 1533 media-airplay-button[mediaairplayunavailable], 1534 media-fullscreen-button[mediafullscreenunavailable], 1535 media-cast-button[mediacastunavailable], 1536 media-pip-button[mediapipunavailable] { 1537 display: none; 1538 } 1539 </style> 1540`;class gp extends h0.HTMLElement{constructor(){super(),gu(this,E8),gu(this,E6),gu(this,E3,void 0),gu(this,E4,void 0),gu(this,E5,void 0),this.shadowRoot?this.renderRoot=this.shadowRoot:(this.renderRoot=this.attachShadow({mode:"open"}),this.createRenderer());const e=new MutationObserver(e=>{var t;(!this.mediaController||(null==(t=this.mediaController)?void 0:t.breakpointsComputed))&&e.some(e=>{let t=e.target;return t===this||"media-controller"===t.localName&&!!(gm[e.attributeName]||e.attributeName.startsWith("breakpoint"))})&&this.render()});e.observe(this,{attributes:!0}),e.observe(this.renderRoot,{attributes:!0,subtree:!0}),this.addEventListener(hT.BREAKPOINTS_COMPUTED,this.render),gc(this,E8,E9).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var e;return null!=(e=gd(this,E3))?e:this.constructor.template}set template(e){null===e?this.removeAttribute("template"):"string"==typeof e?this.setAttribute("template",e):e instanceof HTMLTemplateElement&&(gh(this,E3,e),gh(this,E5,null),this.createRenderer())}get props(){var e,t,i;let r=[...Array.from(null!=(t=null==(e=this.mediaController)?void 0:e.attributes)?t:[]).filter(({name:e})=>gm[e]||e.startsWith("breakpoint")),...Array.from(this.attributes)],a={};for(let e of r){let t=null!=(i=gm[e.name])?i:e.name.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase()),{value:r}=e;null!=r?(hU(r)&&(r=parseFloat(r)),a[t]=""===r||r):a[t]=!1}return a}
1540attributeChangedCallback(e,t,i){"template"===e&&t!=i&&gc(this,E6,E7).call(this)}connectedCallback(){gc(this,E6,E7).call(this)}createRenderer(){this.template instanceof HTMLTemplateElement&&this.template!==gd(this,E4)&&(gh(this,E4,this.template),this.renderer=new pX(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(gf.content.cloneNode(!0),this.renderer))}render(){var e;null==(e=this.renderer)||e.update(this.props)}}async function gg(e){let t=await fetch(e);if(200!==t.status)throw Error(`Failed to load resource: the server responded with a status of ${t.status}`);return t.text()}function gv(e){return e.split("-")[0]}E3=new WeakMap,E4=new WeakMap,E5=new WeakMap,E8=new WeakSet,E9=function(e){if(Object.prototype.hasOwnProperty.call(this,e)){let t=this[e];delete this[e],this[e]=t}},E6=new WeakSet,E7=function(){var e;let t=this.getAttribute("template");if(!t||t===gd(this,E5))return;let i=this.getRootNode(),r=null==(e=null==i?void 0:i.getElementById)?void 0:e.call(i,t);if(r){gh(this,E5,t),gh(this,E3,r),this.createRenderer();return}(function(e){if(!/^(\/|\.\/|https?:\/\/)/.test(e))return!1;let t=/^https?:\/\//.test(e)?void 0:location.origin;try{new URL(e,t)}catch(e){return!1}return!0})(t)&&(gh(this,E5,t),gg(t).then(e=>{let t=h1.createElement("template");t.innerHTML=e,gh(this,E3,t),this.createRenderer()}).catch(console.error))},gp.observedAttributes=["template"],gp.processor=gi,h0.customElements.get("media-theme")||h0.customElements.define("media-theme",gp);class gy extends Event{constructor({action:e="auto",relatedTarget:t,...i}){super("invoke",i),this.action=e,this.relatedTarget=t}}class gE extends Event{constructor({newState:e,oldState:t,...i}){super("toggle",i),this.newState=e,this.oldState=t}}var gb=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},gT=(e,t,i)=>(gb(e,t,"read from private field"),i?i.call(e):t.get(e)),gA=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},g_=(e,t,i,r)=>(gb(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),gS=(e,t,i)=>(gb(e,t,"access private method"),i);function gk({type:e,text:t,value:i,checked:r}){let a=h1.createElement("media-chrome-menu-item");a.type=null!=e?e:"",a.part.add("menu-item"),e&&a.part.add(e),a.value=i,a.checked=r;let s=h1.createElement("span");return s.textContent=t,a.append(s),a}function gL(e,t){let i=e.querySelector(`:scope > [slot="${t}"]`);if((null==i?void 0:i.nodeName)=="SLOT"&&(i=i.assignedElements({flatten:!0})[0]),i)return i.cloneNode(!0);let r=e.shadowRoot.querySelector(`[name="${t}"] > svg`);return r?r.cloneNode(!0):""}let gw="style",gR="hidden",gI="disabled";class gC extends h0.HTMLElement{constructor(){if(super(),gA(this,bo),gA(this,bd),gA(this,bc),gA(this,bf),gA(this,bg),gA(this,by),gA(this,bA),gA(this,bS),gA(this,bL),gA(this,bR),gA(this,bC),gA(this,bx),gA(this,bM),gA(this,bN),gA(this,bF),gA(this,b$),gA(this,bV),gA(this,bW),gA(this,be,null),gA(this,bt,null),gA(this,bi,null),gA(this,br,new Set),gA(this,ba,void 0),gA(this,bs,!1),gA(this,bn,null),gA(this,bh,()=>{let e=gT(this,br),t=new Set(this.items);for(let i of e)t.has(i)||this.dispatchEvent(new CustomEvent("removemenuitem",{detail:i}));for(let i of t)e.has(i)||this.dispatchEvent(new CustomEvent("addmenuitem",{detail:i}));g_(this,br,t)}),gA(this,bb,()=>{gS(this,bA,b_).call(this),gS(this,bS,bk).call(this,!1)}),gA(this,bT,()=>{gS(this,bA,b_).call(this)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=h9(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),g_(this,ba,new MutationObserver(gT(this,bh))),gT(this,ba).observe(this.defaultSlot,{childList:!0})}static get observedAttributes(){return[gI,gR,gw,"anchor",hv.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":gS(this,bo,bl).call(this,e);break;case"invoke":gS(this,bf,bp).call(this,e);break;case"click":gS(this,bL,bw).call(this,e);break;case"toggle":gS(this,bC,bD).call(this,e);break;case"focusout":gS(this,bM,bO).call(this,e);break;case"keydown":gS(this,bN,bU).call(this,e)}}connectedCallback(){var e,t;g_(this,bn,cl(this.shadowRoot,":host")),gS(this,bc,bm).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),g_(this,be,h7(this)),null==(t=null==(e=gT(this,be))?void 0:e.associateElement)||t.call(e,this),this.hidden||(h5(gx(this),gT(this,bb)),h5(this,gT(this,bT))),gS(this,bd,bu).call(this)}disconnectedCallback(){var e,t;h8(gx(this),gT(this,bb)),h8(this,gT(this,bT)),this.disable(),null==(t=null==(e=gT(this,be))?void 0:e.unassociateElement)||t.call(e,this),g_(this,be,null)}attributeChangedCallback(e,t,i){var r,a,s,n;e===gR&&i!==t?(gT(this,bs)||g_(this,bs,!0),this.hidden?gS(this,by,bE).call(this):gS(this,bg,bv).call(this),this.dispatchEvent(new gE({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:!0}))):e===hv.MEDIA_CONTROLLER?(t&&(null==(a=null==(r=gT(this,be))?void 0:r.unassociateElement)||a.call(r,this),g_(this,be,null)),i&&this.isConnected&&(g_(this,be,h7(this)),null==(n=null==(s=gT(this,be))?void 0:s.associateElement)||n.call(s,this))):e===gI&&i!==t?null==i?this.enable():this.disable():e===gw&&i!==t&&gS(this,bc,bm).call(this)}formatMenuItemText(e,t){return this.constructor.formatMenuItemText(e,t)}get anchor(){return this.getAttribute("anchor")}
1540set anchor(e){this.setAttribute("anchor",`${e}`)}get anchorElement(){var e;return this.anchor?null==(e=cs(this))?void 0:e.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:!0}).filter(gD)}get radioGroupItems(){return this.items.filter(e=>"menuitemradio"===e.role)}get checkedItems(){return this.items.filter(e=>e.checked)}get value(){var e,t;return null!=(t=null==(e=this.checkedItems[0])?void 0:e.value)?t:""}set value(e){let t=this.items.find(t=>t.value===e);t&&gS(this,bW,bK).call(this,t)}focus(){if(g_(this,bt,ca()),this.items.length){gS(this,bV,bG).call(this,this.items[0]),this.items[0].focus();return}let e=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');null==e||e.focus()}handleSelect(e){var t;let i=gS(this,bF,bB).call(this,e);i&&(gS(this,bW,bK).call(this,i,"checkbox"===i.type),gT(this,bi)&&!this.hidden&&(null==(t=gT(this,bt))||t.focus(),this.hidden=!0))}get keysUsed(){return["Enter","Escape","Tab"," ","ArrowDown","ArrowUp","Home","End"]}handleMove(e){var t,i;let{key:r}=e,a=this.items,s=null!=(i=null!=(t=gS(this,bF,bB).call(this,e))?t:gS(this,b$,bH).call(this))?i:a[0],n=Math.max(0,a.indexOf(s));"ArrowDown"===r?n++:"ArrowUp"===r?n--:"Home"===e.key?n=0:"End"===e.key&&(n=a.length-1),n<0&&(n=a.length-1),n>a.length-1&&(n=0),gS(this,bV,bG).call(this,a[n]),a[n].focus()}}function gD(e){return["menuitem","menuitemradio","menuitemcheckbox"].includes(null==e?void 0:e.role)}function gx(e){var t;return null!=(t=e.getAttribute("bounds")?cr(e,`#${e.getAttribute("bounds")}`):h6(e)||e.parentElement)?t:e}be=new WeakMap,bt=new WeakMap,bi=new WeakMap,br=new WeakMap,ba=new WeakMap,bs=new WeakMap,bn=new WeakMap,bo=new WeakSet,bl=function(e){let t=e.target;for(let e of t.assignedNodes({flatten:!0}))3===e.nodeType&&""===e.textContent.trim()&&e.remove();["header","title"].includes(t.name)&&gS(this,bd,bu).call(this),t.name||gT(this,bh).call(this)},bd=new WeakSet,bu=function(){let e=this.shadowRoot.querySelector('slot[name="header"]');e.hidden=0===this.shadowRoot.querySelector('slot[name="title"]').assignedNodes().length&&0===e.assignedNodes().length},bh=new WeakMap,bc=new WeakSet,bm=function(){var e;let t=this.shadowRoot.querySelector("#layout-row"),i=null==(e=getComputedStyle(this).getPropertyValue("--media-menu-layout"))?void 0:e.trim();t.setAttribute("media","row"===i?"":"width:0")},bf=new WeakSet,bp=function(e){g_(this,bi,e.relatedTarget),ci(this,e.relatedTarget)||(this.hidden=!this.hidden)},bg=new WeakSet,bv=function(){var e;null==(e=gT(this,bi))||e.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:!0}),h5(gx(this),gT(this,bb)),h5(this,gT(this,bT))},by=new WeakSet,bE=function(){var e;null==(e=gT(this,bi))||e.setAttribute("aria-expanded","false"),h8(gx(this),gT(this,bb)),h8(this,gT(this,bT))},bb=new WeakMap,bT=new WeakMap,bA=new WeakSet,b_=function(e){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;let{x:t,y:i}=function({anchor:e,floating:t,placement:i}){let{x:r,y:a}=function({anchor:e,floating:t},i){let r,a="x"==(["top","bottom"].includes(gv(i))?"y":"x")?"y":"x",s="y"===a?"height":"width",n=gv(i),o=e.x+e.width/2-t.width/2,l=e.y+e.height/2-t.height/2,d=e[s]/2-t[s]/2;switch(n){case"top":r={x:o,y:e.y-t.height};break;case"bottom":r={x:o,y:e.y+e.height};break;case"right":r={x:e.x+e.width,y:l};break;case"left":r={x:e.x-t.width,y:l};break;default:r={x:e.x,y:e.y}}switch(i.split("-")[1]){case"start":r[a]-=d;break;case"end":r[a]+=d}return r}(function({anchor:e,floating:t}){var i,r,a;let s,n;return{anchor:(i=e,r=t.offsetParent,s=i.getBoundingClientRect(),n=null!=(a=null==r?void 0:r.getBoundingClientRect())?a:{x:0,y:0},{x:s.x-n.x,y:s.y-n.y,width:s.width,height:s.height}),floating:{x:0,y:0,width:t.offsetWidth,height:t.offsetHeight}}}({anchor:e,floating:t}),i);return{x:r,y:a}}({anchor:this.anchorElement,floating:this,placement:"top-start"});null!=e||(e=this.offsetWidth);let r=gx(this).getBoundingClientRect(),a=r.width-t-e,s=r.height-i-this.offsetHeight,{style:n}=gT(this,bn);n.setProperty("position","absolute"),n.setProperty("right",`${Math.max(0,a)}px`),n.setProperty("--_menu-bottom",`${s}px`);let o=getComputedStyle(this),l=n.getPropertyValue("--_menu-bottom")===o.bottom?s:parseFloat(o.bottom),d=r.height-l-parseFloat(o.marginBottom);this.style.setProperty("--_menu-max-height",`${d}px`)},bS=new WeakSet,bk=function(e){let t=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),i=null==t?void 0:t.querySelector('[role="menu"]'),{style:r}=gT(this,bn);if(e||r.setProperty("--media-menu-transition-in","none"),i){let e=i.offsetHeight,r=Math.max(i.offsetWidth,t.offsetWidth);this.style.setProperty("min-width",`${r}px`),this.style.setProperty("min-height",`${e}px`),gS(this,bA,b_).call(this,r)}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),gS(this,bA,b_).call(this);r.removeProperty("--media-menu-transition-in")},bL=new WeakSet,bw=function(e){var t;if(e.stopPropagation(),e.composedPath().includes(gT(this,bR,bI))){
1540null==(t=gT(this,bt))||t.focus(),this.hidden=!0;return}let i=gS(this,bF,bB).call(this,e);!i||i.hasAttribute("disabled")||(gS(this,bV,bG).call(this,i),this.handleSelect(e))},bR=new WeakSet,bI=function(){var e;return null==(e=this.shadowRoot.querySelector('slot[name="header"]').assignedElements({flatten:!0}))?void 0:e.find(e=>e.matches('button[part~="back"]'))},bC=new WeakSet,bD=function(e){if(e.target===this)return;gS(this,bx,bP).call(this);let t=Array.from(this.querySelectorAll('[role="menuitem"][aria-haspopup]'));for(let i of t)i.invokeTargetElement!=e.target&&("open"!=e.newState||"true"!=i.getAttribute("aria-expanded")||i.invokeTargetElement.hidden||i.invokeTargetElement.dispatchEvent(new gy({relatedTarget:i})));for(let e of t)e.setAttribute("aria-expanded",`${!e.submenuElement.hidden}`);gS(this,bS,bk).call(this,!0)},bx=new WeakSet,bP=function(){let e=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!e)},bM=new WeakSet,bO=function(e){var t;ci(this,e.relatedTarget)||(gT(this,bs)&&(null==(t=gT(this,bt))||t.focus()),gT(this,bi)&&gT(this,bi)!==e.relatedTarget&&!this.hidden&&(this.hidden=!0))},bN=new WeakSet,bU=function(e){var t,i,r,a,s;let{key:n,ctrlKey:o,altKey:l,metaKey:d}=e;if(!o&&!l&&!d&&this.keysUsed.includes(n))if(e.preventDefault(),e.stopPropagation(),"Tab"===n){if(gT(this,bs)){this.hidden=!0;return}e.shiftKey?null==(i=null==(t=this.previousElementSibling)?void 0:t.focus)||i.call(t):null==(a=null==(r=this.nextElementSibling)?void 0:r.focus)||a.call(r),this.blur()}else"Escape"===n?(null==(s=gT(this,bt))||s.focus(),gT(this,bs)&&(this.hidden=!0)):"Enter"===n||" "===n?this.handleSelect(e):this.handleMove(e)},bF=new WeakSet,bB=function(e){return e.composedPath().find(e=>["menuitemradio","menuitemcheckbox"].includes(e.role))},b$=new WeakSet,bH=function(){return this.items.find(e=>0===e.tabIndex)},bV=new WeakSet,bG=function(e){for(let t of this.items)t.tabIndex=t===e?0:-1},bW=new WeakSet,bK=function(e,t){let i=[...this.checkedItems];"radio"===e.type&&this.radioGroupItems.forEach(e=>e.checked=!1),t?e.checked=!e.checked:e.checked=!0,this.checkedItems.some((e,t)=>e!=i[t])&&this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},gC.shadowRootOptions={mode:"open"},gC.getTemplateHTML=function(e){return` 1541 <style> 1542 :host { 1543 font: var(--media-font, 1544 var(--media-font-weight, normal) 1545 var(--media-font-size, 14px) / 1546 var(--media-text-content-height, var(--media-control-height, 24px)) 1547 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 1548 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 1549 --_menu-bg: rgb(20 20 30 / .8); 1550 background: var(--media-menu-background, var(--media-control-background, var(--media-secondary-color, var(--_menu-bg)))); 1551 border-radius: var(--media-menu-border-radius); 1552 border: var(--media-menu-border, none); 1553 display: var(--media-menu-display, inline-flex) !important; 1554 1555 transition: var(--media-menu-transition-in, 1556 visibility 0s, 1557 opacity .2s ease-out, 1558 transform .15s ease-out, 1559 left .2s ease-in-out, 1560 min-width .2s ease-in-out, 1561 min-height .2s ease-in-out 1562 ) !important; 1563 1564 visibility: var(--media-menu-visibility, visible); 1565 opacity: var(--media-menu-opacity, 1); 1566 max-height: var(--media-menu-max-height, var(--_menu-max-height, 300px)); 1567 transform: var(--media-menu-transform-in, translateY(0) scale(1)); 1568 flex-direction: column; 1569 1570 min-height: 0; 1571 position: relative; 1572 bottom: var(--_menu-bottom); 1573 box-sizing: border-box; 1574 } 1575 1576 @-moz-document url-prefix() { 1577 :host{ 1578 --_menu-bg: rgb(20 20 30); 1579 } 1580 } 1581 1582 :host([hidden]) { 1583 transition: var(--media-menu-transition-out, 1584 visibility .15s ease-in, 1585 opacity .15s ease-in, 1586 transform .15s ease-in 1587 ) !important; 1588 visibility: var(--media-menu-hidden-visibility, hidden); 1589 opacity: var(--media-menu-hidden-opacity, 0); 1590 max-height: var(--media-menu-hidden-max-height, 1591 var(--media-menu-max-height, var(--_menu-max-height, 300px))); 1592 transform: var(--media-menu-transform-out, translateY(2px) scale(.99)); 1593 pointer-events: none; 1594 } 1595 1596 :host([slot="submenu"]) { 1597 background: none; 1598 width: 100%; 1599 min-height: 100%; 1600 position: absolute; 1601 bottom: 0; 1602 right: -100%; 1603 } 1604 1605 #container { 1606 display: flex; 1607 flex-direction: column; 1608 min-height: 0; 1609 transition: transform .2s ease-out; 1610 transform: translate(0, 0); 1611 } 1612 1613 #container.has-expanded { 1614 transition: transform .2s ease-in; 1615 transform: translate(-100%, 0); 1616 } 1617 1618 button { 1619 background: none; 1620 color: inherit; 1621 border: none; 1622 padding: 0; 1623 font: inherit; 1624 outline: inherit; 1625 display: inline-flex; 1626 align-items: center; 1627 } 1628 1629 slot[name="header"][hidden] { 1630 display: none; 1631 } 1632 1633 slot[name="header"] > *, 1634 slot[name="header"]::slotted(*) { 1635 padding: .4em .7em; 1636 border-bottom: 1px solid rgb(255 255 255 / .25); 1637 cursor: var(--media-cursor, default); 1638 } 1639 1640 slot[name="header"] > button[part~="back"], 1641 slot[name="header"]::slotted(button[part~="back"]) { 1642 cursor: var(--media-cursor, pointer); 1643 } 1644 1645 svg[part~="back"] { 1646 height: var(--media-menu-icon-height, var(--media-control-height, 24px)); 1647 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 1648 display: block; 1649 margin-right: .5ch; 1650 } 1651 1652 slot:not([name]) { 1653 gap: var(--media-menu-gap); 1654 flex-direction: var(--media-menu-flex-direction, column); 1655 overflow: var(--media-menu-overflow, hidden auto); 1656 display: flex; 1657 min-height: 0; 1658 } 1659 1660 :host([role="menu"]) slot:not([name]) { 1661 padding-block: .4em; 1662 } 1663 1664 slot:not([name])::slotted([role="menu"]) { 1665 background: none; 1666 } 1667 1668 media-chrome-menu-item > span { 1669 margin-right: .5ch; 1670 max-width: var(--media-menu-item-max-width); 1671 text-overflow: ellipsis; 1672 overflow: hidden; 1673 } 1674 </style> 1675 <style id="layout-row" media="width:0"> 1676 1677 slot[name="header"] > *, 1678 slot[name="header"]::slotted(*) { 1679 padding: .4em .5em; 1680 } 1681 1682 slot:not([name]) { 1683 gap: var(--media-menu-gap, .25em); 1684 flex-direction: var(--media-menu-flex-direction, row); 1685 padding-inline: .5em; 1686 } 1687 1688 media-chrome-menu-item { 1689 padding: .3em .5em; 1690 } 1691 1692 media-chrome-menu-item[aria-checked="true"] { 1693 background: var(--media-menu-item-checked-background, rgb(255 255 255 / .2)); 1694 } 1695 1696 1697 media-chrome-menu-item::part(checked-indicator) { 1698 display: var(--media-menu-item-checked-indicator-display, none); 1699 } 1700 </style> 1701 <div id="container" part="container"> 1702 <slot name="header" hidden> 1703 <button part="back button" aria-label="Back to previous menu"> 1704 <slot name="back-icon"> 1705 <svg aria-hidden="true" viewBox="0 0 20 24" part="back indicator"> 1706 <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"/> 1707 </svg> 1708 </slot> 1709 <slot name="title"></slot> 1710 </button> 1711 </slot> 1712 <slot></slot> 1713 </div> 1714 <slot name="checked-indicator" hidden></slot> 1715 `},h0.customElements.get("media-chrome-menu")||h0.customElements.define("media-chrome-menu",gC);var gP=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},gM=(e,t,i)=>(gP(e,t,"read from private field"),i?i.call(e):t.get(e)),gO=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},gN=(e,t,i,r)=>(gP(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),gU=(e,t,i)=>(gP(e,t,"access private method"),i);let gF="type",gB="value",g$="checked",gH="disabled";class gV extends h0.HTMLElement{constructor(){if(super(),gO(this,bY),gO(this,bX),gO(this,bZ),gO(this,b1),gO(this,b3),gO(this,b5),gO(this,bq,!1),gO(this,bj,void 0),gO(this,b0,()=>{var e,t;this.submenuElement.items&&this.setAttribute("submenusize",`${this.submenuElement.items.length}`);let i=this.shadowRoot.querySelector('slot[name="description"]'),r=null==(e=this.submenuElement.checkedItems)?void 0:e[0],a=null!=(t=null==r?void 0:r.dataset.description)?t:null==r?void 0:r.text,s=h1.createElement("span");s.textContent=null!=a?a:"",i.replaceChildren(s)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=h9(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.shadowRoot.addEventListener("slotchange",this)}static get observedAttributes(){return[gF,gH,g$,gB]}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),gG(this)&&!this.hasAttribute("aria-checked")&&this.setAttribute("aria-checked","fal
1715se"),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":gU(this,bY,bz).call(this,e);break;case"click":this.handleClick(e);break;case"keydown":gU(this,b3,b4).call(this,e);break;case"keyup":gU(this,b1,b2).call(this,e)}}attributeChangedCallback(e,t,i){e===g$&&gG(this)&&!gM(this,bq)?this.setAttribute("aria-checked",null!=i?"true":"false"):e===gF&&i!==t?this.role="menuitem"+i:e===gH&&i!==t&&(null==i?this.enable():this.disable())}connectedCallback(){this.hasAttribute(gH)||this.enable(),this.role="menuitem"+this.type,gN(this,bj,function e(t,i){if(!t)return null;let{host:r}=t.getRootNode();return!i&&r?e(t,r):(null==i?void 0:i.items)?i:e(i,null==i?void 0:i.parentNode)}(this,this.parentNode)),gU(this,b5,b8).call(this),this.submenuElement&&gU(this,bX,bQ).call(this)}disconnectedCallback(){this.disable(),gU(this,b5,b8).call(this),gN(this,bj,null)}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(e){this.setAttribute("invoketarget",`${e}`)}get invokeTargetElement(){var e;return this.invokeTarget?null==(e=cs(this))?void 0:e.querySelector(`#${this.invokeTarget}`):this.submenuElement}get submenuElement(){return this.shadowRoot.querySelector('slot[name="submenu"]').assignedElements({flatten:!0})[0]}get type(){var e;return null!=(e=this.getAttribute(gF))?e:""}set type(e){this.setAttribute(gF,`${e}`)}get value(){var e;return null!=(e=this.getAttribute(gB))?e:this.text}set value(e){this.setAttribute(gB,e)}get text(){var e;return(null!=(e=this.textContent)?e:"").trim()}get checked(){if(gG(this))return"true"===this.getAttribute("aria-checked")}set checked(e){gG(this)&&(gN(this,bq,!0),this.setAttribute("aria-checked",e?"true":"false"),e?this.part.add("checked"):this.part.remove("checked"))}handleClick(e){!gG(this)&&this.invokeTargetElement&&ci(this,e.target)&&this.invokeTargetElement.dispatchEvent(new gy({relatedTarget:this}))}get keysUsed(){return["Enter"," "]}}function gG(e){return"radio"===e.type||"checkbox"===e.type}bq=new WeakMap,bj=new WeakMap,bY=new WeakSet,bz=function(e){let t=e.target;if(!(null==t?void 0:t.name))for(let e of t.assignedNodes({flatten:!0}))e instanceof Text&&""===e.textContent.trim()&&e.remove();"submenu"===t.name&&(this.submenuElement?gU(this,bX,bQ).call(this):gU(this,bZ,bJ).call(this))},bX=new WeakSet,bQ=async function(){this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded",`${!this.submenuElement.hidden}`),this.submenuElement.addEventListener("change",gM(this,b0)),this.submenuElement.addEventListener("addmenuitem",gM(this,b0)),this.submenuElement.addEventListener("removemenuitem",gM(this,b0)),gM(this,b0).call(this)},bZ=new WeakSet,bJ=function(){this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.submenuElement.removeEventListener("change",gM(this,b0)),this.submenuElement.removeEventListener("addmenuitem",gM(this,b0)),this.submenuElement.removeEventListener("removemenuitem",gM(this,b0)),gM(this,b0).call(this)},b0=new WeakMap,b1=new WeakSet,b2=function(e){let{key:t}=e;this.keysUsed.includes(t)?this.handleClick(e):this.removeEventListener("keyup",gU(this,b1,b2))},b3=new WeakSet,b4=function(e){let{metaKey:t,altKey:i,key:r}=e;t||i||!this.keysUsed.includes(r)?this.removeEventListener("keyup",gU(this,b1,b2)):this.addEventListener("keyup",gU(this,b1,b2),{once:!0})},b5=new WeakSet,b8=function(){var e;let t=null==(e=gM(this,bj))?void 0:e.radioGroupItems;if(!t)return;let i=t.filter(e=>"true"===e.getAttribute("aria-checked")).pop();for(let e of(i||(i=t[0]),t))e.setAttribute("aria-checked","false");null==i||i.setAttribute("aria-checked","true")},gV.shadowRootOptions={mode:"open"},gV.getTemplateHTML=function(e){return` 1716 <style> 1717 :host { 1718 transition: var(--media-menu-item-transition, 1719 background .15s linear, 1720 opacity .2s ease-in-out 1721 ); 1722 outline: var(--media-menu-item-outline, 0); 1723 outline-offset: var(--media-menu-item-outline-offset, -1px); 1724 cursor: var(--media-cursor, pointer); 1725 display: flex; 1726 align-items: center; 1727 align-self: stretch; 1728 justify-self: stretch; 1729 white-space: nowrap; 1730 white-space-collapse: collapse; 1731 text-wrap: nowrap; 1732 padding: .4em .8em .4em 1em; 1733 } 1734 1735 :host(:focus-visible) { 1736 box-shadow: var(--media-menu-item-focus-shadow, inset 0 0 0 2px rgb(27 127 204 / .9)); 1737 outline: var(--media-menu-item-hover-outline, 0); 1738 outline-offset: var(--media-menu-item-hover-outline-offset, var(--media-menu-item-outline-offset, -1px)); 1739 } 1740 1741 :host(:hover) { 1742 cursor: var(--media-cursor, pointer); 1743 background: var(--media-menu-item-hover-background, rgb(92 92 102 / .5)); 1744 outline: var(--media-menu-item-hover-outline); 1745 outline-offset: var(--media-menu-item-hover-outline-offset, var(--media-menu-item-outline-offset, -1px)); 1746 } 1747 1748 :host([aria-checked="true"]) { 1749 background: var(--media-menu-item-checked-background); 1750 } 1751 1752 :host([hidden]) { 1753 display: none; 1754 } 1755 1756 :host([disabled]) { 1757 pointer-events: none; 1758 color: rgba(255, 255, 255, .3); 1759 } 1760 1761 slot:not([name]) { 1762 width: 100%; 1763 } 1764 1765 slot:not([name="submenu"]) { 1766 display: inline-flex; 1767 align-items: center; 1768 transition: inherit; 1769 opacity: var(--media-menu-item-opacity, 1); 1770 } 1771 1772 slot[name="description"] { 1773 justify-content: end; 1774 } 1775 1776 slot[name="description"] > span { 1777 display: inline-block; 1778 margin-inline: 1em .2em; 1779 max-width: var(--media-menu-item-description-max-width, 100px); 1780 text-overflow: ellipsis; 1781 overflow: hidden; 1782 font-size: .8em; 1783 font-weight: 400; 1784 text-align: right; 1785 position: relative; 1786 top: .04em; 1787 } 1788 1789 slot[name="checked-indicator"] { 1790 display: none; 1791 } 1792 1793 :host(:is([role="menuitemradio"],[role="menuitemcheckbox"])) slot[name="checked-indicator"] { 1794 display: var(--media-menu-item-checked-indicator-display, inline-block); 1795 } 1796 1797 1798 svg, img, ::slotted(svg), ::slotted(img) { 1799 height: var(--media-menu-item-icon-height, var(--media-control-height, 24px)); 1800 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 1801 display: block; 1802 } 1803 1804 1805 [part~="indicator"], 1806 ::slotted([part~="indicator"]) { 1807 fill: var(--media-menu-item-indicator-fill, 1808 var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)))); 1809 height: var(--media-menu-item-indicator-height, 1.25em); 1810 margin-right: .5ch; 1811 } 1812 1813 [part~="checked-indicator"] { 1814 visibility: hidden; 1815 } 1816 1817 :host([aria-checked="true"]) [part~="checked-indicator"] { 1818 visibility: visible; 1819 } 1820 </style> 1821 <slot name="checked-indicator"> 1822 <svg aria-hidden="true" viewBox="0 1 24 24" part="checked-indicator indicator"> 1823 <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"/> 1824 </svg> 1825 </slot> 1826 <slot name="prefix"></slot> 1827 <slot></slot> 1828 <slot name="description"></slot> 1829 <slot name="suffix">
1830 ${this.getSuffixSlotInnerHTML(e)} 1831 </slot> 1832 <slot name="submenu"></slot> 1833 `},gV.getSuffixSlotInnerHTML=function(e){return""},h0.customElements.get("media-chrome-menu-item")||h0.customElements.define("media-chrome-menu-item",gV);class gW extends gC{get anchorElement(){return"auto"!==this.anchor?super.anchorElement:h6(this).querySelector("media-settings-menu-button")}}gW.getTemplateHTML=function(e){return` 1834 ${gC.getTemplateHTML(e)} 1835 <style> 1836 :host { 1837 --_menu-bg: rgb(20 20 30 / .8); 1838 background: var(--media-settings-menu-background, 1839 var(--media-menu-background, 1840 var(--media-control-background, 1841 var(--media-secondary-color, var(--_menu-bg))))); 1842 min-width: var(--media-settings-menu-min-width, 170px); 1843 border-radius: 2px 2px 0 0; 1844 overflow: hidden; 1845 } 1846 1847 @-moz-document url-prefix() { 1848 :host{ 1849 --_menu-bg: rgb(20 20 30); 1850 } 1851 } 1852 1853 :host([role="menu"]) { 1854 1855 justify-content: end; 1856 } 1857 1858 slot:not([name]) { 1859 justify-content: var(--media-settings-menu-justify-content); 1860 flex-direction: var(--media-settings-menu-flex-direction, column); 1861 overflow: visible; 1862 } 1863 1864 #container.has-expanded { 1865 --media-settings-menu-item-opacity: 0; 1866 } 1867 </style> 1868 `},h0.customElements.get("media-settings-menu")||h0.customElements.define("media-settings-menu",gW);class gK extends gV{}gK.shadowRootOptions={mode:"open"},gK.getTemplateHTML=function(e){return` 1869 ${gV.getTemplateHTML.call(this,e)} 1870 <style> 1871 slot:not([name="submenu"]) { 1872 opacity: var(--media-settings-menu-item-opacity, var(--media-menu-item-opacity)); 1873 } 1874 1875 :host([aria-expanded="true"]:hover) { 1876 background: transparent; 1877 } 1878 </style> 1879 `},gK.getSuffixSlotInnerHTML=function(e){return` 1880 <svg aria-hidden="true" viewBox="0 0 20 24"> 1881 <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"/> 1882 </svg> 1883 `},h0.customElements.get("media-settings-menu-item")||h0.customElements.define("media-settings-menu-item",gK);class gq extends m3{connectedCallback(){super.connectedCallback(),this.invokeTargetElement&&this.setAttribute("aria-haspopup","menu")}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(e){this.setAttribute("invoketarget",`${e}`)}get invokeTargetElement(){var e;return this.invokeTarget?null==(e=cs(this))?void 0:e.querySelector(`#${this.invokeTarget}`):null}handleClick(){var e;null==(e=this.invokeTargetElement)||e.dispatchEvent(new gy({relatedTarget:this}))}}h0.customElements.get("media-chrome-menu-button")||h0.customElements.define("media-chrome-menu-button",gq);class gj extends gq{static get observedAttributes(){return[...super.observedAttributes,"target"]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",hq("settings"))}get invokeTargetElement(){return void 0!=this.invokeTarget?super.invokeTargetElement:h6(this).querySelector("media-settings-menu")}}gj.getSlotTemplateHTML=function(){return` 1884 <style> 1885 :host([aria-expanded="true"]) slot[name=tooltip] { 1886 display: none; 1887 } 1888 </style> 1889 <slot name="icon"> 1890 <svg aria-hidden="true" viewBox="0 0 24 24"> 1891 <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"/> 1892 </svg> 1893 </slot> 1894 `},gj.getTooltipContentHTML=function(){return hq("Settings")},h0.customElements.get("media-settings-menu-button")||h0.customElements.define("media-settings-menu-button",gj);var gY=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},gz=(e,t,i)=>(gY(e,t,"read from private field"),i?i.call(e):t.get(e)),gX=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},gQ=(e,t,i,r)=>(gY(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),gZ=(e,t,i)=>(gY(e,t,"access private method"),i);b9=new WeakMap,b6=new WeakMap,b7=new WeakSet,Te=function(){if(gz(this,b6)===JSON.stringify(this.mediaAudioTrackList))return;gQ(this,b6,JSON.stringify(this.mediaAudioTrackList));let e=this.mediaAudioTrackList;for(let t of(this.defaultSlot.textContent="",e.sort((e,t)=>
1894e.id.localeCompare(t.id,void 0,{numeric:!0})),e)){let e=gk({type:"radio",text:this.formatMenuItemText(t.label,t),value:`${t.id}`,checked:t.enabled});e.prepend(gL(this,"checked-indicator")),this.defaultSlot.append(e)}},Tt=new WeakSet,Ti=function(){if(null==this.value)return;let e=new h0.CustomEvent(hg.MEDIA_AUDIO_TRACK_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(e)},h0.customElements.get("media-audio-track-menu")||h0.customElements.define("media-audio-track-menu",class extends gC{constructor(){super(...arguments),gX(this,b7),gX(this,Tt),gX(this,b9,[]),gX(this,b6,void 0)}static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_AUDIO_TRACK_LIST,hb.MEDIA_AUDIO_TRACK_ENABLED,hb.MEDIA_AUDIO_TRACK_UNAVAILABLE]}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),e===hb.MEDIA_AUDIO_TRACK_ENABLED&&t!==i)this.value=i;else if(e===hb.MEDIA_AUDIO_TRACK_LIST&&t!==i){var r;gQ(this,b9,null==(r=null!=i?i:"")?void 0:r.split(/\s+/).map(hO)),gZ(this,b7,Te).call(this)}}connectedCallback(){super.connectedCallback(),this.addEventListener("change",gZ(this,Tt,Ti))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",gZ(this,Tt,Ti))}get anchorElement(){var e;return"auto"!==this.anchor?super.anchorElement:null==(e=h6(this))?void 0:e.querySelector("media-audio-track-menu-button")}get mediaAudioTrackList(){return gz(this,b9)}set mediaAudioTrackList(e){gQ(this,b9,e),gZ(this,b7,Te).call(this)}get mediaAudioTrackEnabled(){var e;return null!=(e=cm(this,hb.MEDIA_AUDIO_TRACK_ENABLED))?e:""}set mediaAudioTrackEnabled(e){cf(this,hb.MEDIA_AUDIO_TRACK_ENABLED,e)}});let gJ=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1895 <path d="M11 17H9.5V7H11v10Zm-3-3H6.5v-4H8v4Zm6-5h-1.5v6H14V9Zm3 7h-1.5V8H17v8Z"/> 1896 <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"/> 1897</svg>`,g0=e=>{let t=hq("Audio");e.setAttribute("aria-label",t)};class g1 extends gq{static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_AUDIO_TRACK_ENABLED,hb.MEDIA_AUDIO_TRACK_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),g0(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===hb.MEDIA_LANG&&g0(this)}get invokeTargetElement(){var e;return void 0!=this.invokeTarget?super.invokeTargetElement:null==(e=h6(this))?void 0:e.querySelector("media-audio-track-menu")}get mediaAudioTrackEnabled(){var e;return null!=(e=cm(this,hb.MEDIA_AUDIO_TRACK_ENABLED))?e:""}set mediaAudioTrackEnabled(e){cf(this,hb.MEDIA_AUDIO_TRACK_ENABLED,e)}}g1.getSlotTemplateHTML=function(){return` 1898 <style> 1899 :host([aria-expanded="true"]) slot[name=tooltip] { 1900 display: none; 1901 } 1902 </style> 1903 <slot name="icon">${gJ}</slot> 1904 `},g1.getTooltipContentHTML=function(){return hq("Audio")},h0.customElements.get("media-audio-track-menu-button")||h0.customElements.define("media-audio-track-menu-button",g1);var g2=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},g3=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},g4=(e,t,i)=>(g2(e,t,"access private method"),i);let g5=` 1905 <svg aria-hidden="true" viewBox="0 0 26 24" part="captions-indicator indicator"> 1906 <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
19060 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"/> 1907 </svg>`;class g8 extends gC{constructor(){super(...arguments),g3(this,Ta),g3(this,Tn),g3(this,Tr,void 0)}static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_SUBTITLES_LIST,hb.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===hb.MEDIA_SUBTITLES_LIST&&t!==i?g4(this,Ta,Ts).call(this):e===hb.MEDIA_SUBTITLES_SHOWING&&t!==i&&(this.value=i||"",g4(this,Ta,Ts).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",g4(this,Tn,To))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",g4(this,Tn,To))}get anchorElement(){return"auto"!==this.anchor?super.anchorElement:h6(this).querySelector("media-captions-menu-button")}get mediaSubtitlesList(){return g9(this,hb.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){g6(this,hb.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return g9(this,hb.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){g6(this,hb.MEDIA_SUBTITLES_SHOWING,e)}}Tr=new WeakMap,Ta=new WeakSet,Ts=function(){var e,t,i,r,a,s;let n=(g2(this,t=Tr,"read from private field"),(i?i.call(this):t.get(this))!==JSON.stringify(this.mediaSubtitlesList)),o=this.value!==this.getAttribute(hb.MEDIA_SUBTITLES_SHOWING);if(!n&&!o)return;r=Tr,a=JSON.stringify(this.mediaSubtitlesList),g2(this,r,"write to private field"),s?s.call(this,a):r.set(this,a),this.defaultSlot.textContent="";let l=!this.value,d=gk({type:"radio",text:this.formatMenuItemText(hq("Off")),value:"off",checked:l});for(let t of(d.prepend(gL(this,"checked-indicator")),this.defaultSlot.append(d),this.mediaSubtitlesList)){let i=gk({type:"radio",text:this.formatMenuItemText(t.label,t),value:cG(t),checked:this.value==cG(t)});i.prepend(gL(this,"checked-indicator")),"captions"===(null!=(e=t.kind)?e:"subs")&&i.append(gL(this,"captions-indicator")),this.defaultSlot.append(i)}},Tn=new WeakSet,To=function(){let e=this.mediaSubtitlesShowing,t=this.getAttribute(hb.MEDIA_SUBTITLES_SHOWING),i=this.value!==t;if((null==e?void 0:e.length)&&i&&this.dispatchEvent(new h0.CustomEvent(hg.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:e})),!this.value||!i)return;let r=new h0.CustomEvent(hg.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(r)},g8.getTemplateHTML=function(e){return` 1908 ${gC.getTemplateHTML(e)} 1909 <slot name="captions-indicator" hidden>${g5}</slot> 1910 `};let g9=(e,t)=>{let i=e.getAttribute(t);return i?cH(i):[]},g6=(e,t,i)=>{if(!(null==i?void 0:i.length))return void e.removeAttribute(t);let r=cW(i);e.getAttribute(t)!==r&&e.setAttribute(t,r)};h0.customElements.get("media-captions-menu")||h0.customElements.define("media-captions-menu",g8);let g7=`<svg aria-hidden="true" viewBox="0 0 26 24"> 1911 <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"/> 1912</svg>`,ve=`<svg aria-hidden="true" viewBox="0 0 26 24"> 1913 <path d="M17.73 14.09a1.4 1.4 0 0 1-1 .37 1.579 1.579 0 0 1-1.27-.58A3 3 0 0 1 15 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34A2.89 2.89 0 0 0 19 9.07a3 3 0 0 0-2.14-.78 3.14 3.14 0 0 0-2.42 1 3.91 3.91 0 0 0-.93 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.17 3.17 0 0 0 1.07-1.74l-1.4-.45c-.083.43-.3.822-.62 1.12Zm-7.22 0a1.43 1.43 0 0 1-1 .37 1.58 1.58 0 0 1-1.27-.58A3 3 0 0 1 7.76 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34a2.8
19131 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"/> 1914</svg>`,vt=e=>{e.setAttribute("data-captions-enabled",cY(e).toString())},vi=e=>{e.setAttribute("aria-label",hq("closed captions"))};class vr extends gq{static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_SUBTITLES_LIST,hb.MEDIA_SUBTITLES_SHOWING,hb.MEDIA_LANG]}connectedCallback(){super.connectedCallback(),vi(this),vt(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===hb.MEDIA_SUBTITLES_SHOWING?vt(this):e===hb.MEDIA_LANG&&vi(this)}get invokeTargetElement(){var e;return void 0!=this.invokeTarget?super.invokeTargetElement:null==(e=h6(this))?void 0:e.querySelector("media-captions-menu")}get mediaSubtitlesList(){return va(this,hb.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){vs(this,hb.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return va(this,hb.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){vs(this,hb.MEDIA_SUBTITLES_SHOWING,e)}}vr.getSlotTemplateHTML=function(){return` 1915 <style> 1916 :host([data-captions-enabled="true"]) slot[name=off] { 1917 display: none !important; 1918 } 1919 1920 1921 :host(:not([data-captions-enabled="true"])) slot[name=on] { 1922 display: none !important; 1923 } 1924 1925 :host([aria-expanded="true"]) slot[name=tooltip] { 1926 display: none; 1927 } 1928 </style> 1929 1930 <slot name="icon"> 1931 <slot name="on">${g7}</slot> 1932 <slot name="off">${ve}</slot> 1933 </slot> 1934 `},vr.getTooltipContentHTML=function(){return hq("Captions")};let va=(e,t)=>{let i=e.getAttribute(t);return i?cH(i):[]},vs=(e,t,i)=>{if(!(null==i?void 0:i.length))return void e.removeAttribute(t);let r=cW(i);e.getAttribute(t)!==r&&e.setAttribute(t,r)};h0.customElements.get("media-captions-menu-button")||h0.customElements.define("media-captions-menu-button",vr);var vn=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},vo=(e,t,i)=>(vn(e,t,"read from private field"),i?i.call(e):t.get(e)),vl=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},vd=(e,t,i)=>(vn(e,t,"access private method"),i);let vu="rates";Tl=new WeakMap,Td=new WeakSet,Tu=function(){this.defaultSlot.textContent="";let e=this.mediaPlaybackRate,t=new Set(Array.from(vo(this,Tl)).map(e=>Number(e)));for(let i of(e>0&&!t.has(e)&&t.add(e),Array.from(t).sort((e,t)=>e-t))){let t=gk({type:"radio",text:this.formatMenuItemText(`${i}x`,i),value:i.toString(),checked:e===i});t.prepend(gL(this,"checked-indicator")),this.defaultSlot.append(t)}},Th=new WeakSet,Tc=function(){if(!this.value)return;let e=new h0.CustomEvent(hg.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(e)},h0.customElements.get("media-playback-rate-menu")||h0.customElements.define("media-playback-rate-menu",class extends gC{constructor(){super(),vl(this,Td),vl(this,Th),vl(this,Tl,new cB(this,vu,{defaultValue:pa})),vd(this,Td,Tu).call(this)}static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_PLAYBACK_RATE,vu]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===hb.MEDIA_PLAYBACK_RATE&&t!=i?(this.value=i,vd(this,Td,Tu).call(this)):e===vu&&t!=i&&(vo(this,Tl).value=i,vd(this,Td,Tu).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",vd(this,Th,Tc))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",vd(this,Th,Tc))}get anchorElement(){return"auto"!==this.anchor?super.anchorElement:h6(this).querySelector("media-playback-rate-menu-button")}get rates(){return vo(this,Tl)}set rates(e){e?Array.isArray(e)?vo(this,Tl).value=e.join(" "):"str
1934ing"==typeof e&&(vo(this,Tl).value=e):vo(this,Tl).value="",vd(this,Td,Tu).call(this)}get mediaPlaybackRate(){return cd(this,hb.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){cu(this,hb.MEDIA_PLAYBACK_RATE,e)}});class vh extends gq{static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_PLAYBACK_RATE]}constructor(){var e;super(),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${null!=(e=this.mediaPlaybackRate)?e:1}x`}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),e===hb.MEDIA_PLAYBACK_RATE){let e=i?+i:NaN,t=Number.isNaN(e)?1:e;this.container.innerHTML=`${t}x`,this.setAttribute("aria-label",hq("Playback rate {playbackRate}",{playbackRate:t}))}}get invokeTargetElement(){return void 0!=this.invokeTarget?super.invokeTargetElement:h6(this).querySelector("media-playback-rate-menu")}get mediaPlaybackRate(){return cd(this,hb.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){cu(this,hb.MEDIA_PLAYBACK_RATE,e)}}vh.getSlotTemplateHTML=function(e){return` 1935 <style> 1936 :host { 1937 min-width: 5ch; 1938 padding: var(--media-button-padding, var(--media-control-padding, 10px 5px)); 1939 } 1940 1941 :host([aria-expanded="true"]) slot { 1942 display: block; 1943 } 1944 1945 :host([aria-expanded="true"]) slot[name=tooltip] { 1946 display: none; 1947 } 1948 </style> 1949 <slot name="icon">${e.mediaplaybackrate||1}x</slot> 1950 `},vh.getTooltipContentHTML=function(){return hq("Playback rate")},h0.customElements.get("media-playback-rate-menu-button")||h0.customElements.define("media-playback-rate-menu-button",vh);var vc=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},vm=(e,t,i)=>(vc(e,t,"read from private field"),i?i.call(e):t.get(e)),vf=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},vp=(e,t,i,r)=>(vc(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),vg=(e,t,i)=>(vc(e,t,"access private method"),i);Tm=new WeakMap,Tf=new WeakMap,Tp=new WeakSet,Tg=function(){if(vm(this,Tf).mediaRenditionList===JSON.stringify(this.mediaRenditionList)&&vm(this,Tf).mediaHeight===this.mediaHeight)return;vm(this,Tf).mediaRenditionList=JSON.stringify(this.mediaRenditionList),vm(this,Tf).mediaHeight=this.mediaHeight;let e=this.mediaRenditionList.sort(this.compareRendition.bind(this)),t=e.find(e=>e.id===this.mediaRenditionSelected);for(let i of e)i.selected=i===t;this.defaultSlot.textContent="";let i=!this.mediaRenditionSelected;for(let t of e){let e=gk({type:"radio",text:this.formatRendition(t,{showBitrate:this.showRenditionBitrate(t)}),value:`${t.id}`,checked:t.selected&&!i});
1950e.prepend(gL(this,"checked-indicator")),this.defaultSlot.append(e)}let r=t&&this.showRenditionBitrate(t),a=i?t?this.formatMenuItemText(`${hq("Auto")} \u2022 ${this.formatRendition(t,{showBitrate:r})}`,t):this.formatMenuItemText(`${hq("Auto")} (${this.mediaHeight}p)`):this.formatMenuItemText(hq("Auto")),s=gk({type:"radio",text:a,value:"auto",checked:i});s.dataset.description=a,s.prepend(gL(this,"checked-indicator")),this.defaultSlot.append(s)},Tv=new WeakSet,Ty=function(){if(null==this.value)return;let e=new h0.CustomEvent(hg.MEDIA_RENDITION_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(e)},h0.customElements.get("media-rendition-menu")||h0.customElements.define("media-rendition-menu",class extends gC{constructor(){super(...arguments),vf(this,Tp),vf(this,Tv),vf(this,Tm,[]),vf(this,Tf,{})}static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_RENDITION_LIST,hb.MEDIA_RENDITION_SELECTED,hb.MEDIA_RENDITION_UNAVAILABLE,hb.MEDIA_HEIGHT]}static formatMenuItemText(e,t){return super.formatMenuItemText(e,t)}static formatRendition(e,{showBitrate:t=!1}={}){let i=`${Math.min(e.width,e.height)}p`;if(t&&e.bitrate){let t=e.bitrate/1e6,r=`${t.toFixed(+(t<1))} Mbps`;return`${i} (${r})`}return this.formatMenuItemText(i,e)}static compareRendition(e,t){var i,r;return t.height===e.height?(null!=(i=t.bitrate)?i:0)-(null!=(r=e.bitrate)?r:0):t.height-e.height}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),e===hb.MEDIA_RENDITION_SELECTED&&t!==i)this.value=null!=i?i:"auto",vg(this,Tp,Tg).call(this);else if(e===hb.MEDIA_RENDITION_LIST&&t!==i)vp(this,Tm,null==i?void 0:i.split(/\s+/).map(hP)),vg(this,Tp,Tg).call(this);else e===hb.MEDIA_HEIGHT&&t!==i&&vg(this,Tp,Tg).call(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",vg(this,Tv,Ty))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",vg(this,Tv,Ty))}get anchorElement(){return"auto"!==this.anchor?super.anchorElement:h6(this).querySelector("media-rendition-menu-button")}get mediaRenditionList(){return vm(this,Tm)}set mediaRenditionList(e){vp(this,Tm,e),vg(this,Tp,Tg).call(this)}get mediaRenditionSelected(){return cm(this,hb.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){cf(this,hb.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return cd(this,hb.MEDIA_HEIGHT)}set mediaHeight(e){cu(this,hb.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)}});let vv=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1951 <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" /> 1952</svg>`;class vy extends gq{static get observedAttributes(){return[...super.observedAttributes,hb.MEDIA_RENDITION_SELECTED,hb.MEDIA_RENDITION_UNAVAILABLE,hb.MEDIA_HEIGHT]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",hq("quality"))}get invokeTargetElement(){return void 0!=this.invokeTarget?super.invokeTargetElement:h6(this).querySelector("media-rendition-menu")}get mediaRenditionSelected(){return cm(this,hb.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){cf(this,hb.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return cd(this,hb.MEDIA_HEIGHT)}set mediaHeight(e){cu(this,hb.MEDIA_HEIGHT,e)}}vy.getSlotTemplateHTML=function(){return` 1953 <style> 1954 :host([aria-expanded="true"]) slot[name=tooltip] { 1955 display: none; 1956 } 1957 </style> 1958 <slot name="icon">${vv}</slot> 1959 `},vy.getTooltipContentHTML=function(){return hq("Quality")},h0.customElements.get("media-rendition-menu-button")||h0.customElements.define("media-rendition-menu-button",vy);var vE=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},vb=(e,t,i)=>(vE(e,t,"read from private field"),i?i.call(e):t.get(e)),vT=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},vA=(e,t,i,r)=>(vE(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),v_=(e,t,i)=>(vE(e,t,"access private method"),i);class vS extends gC{constructor(){super(),vT(this,Tb),vT(this,TA),vT(this,TS),vT(this,TL),vT(this,TI),vT(this,TE,!1),vT(this,TR,e=>{let t=e.target,i=(null==t?void 0:t.nodeName)==="VIDEO",r=v_(this,TL,Tw).call(this,t);(i||r)&&(vb(this,TE)?v_(this,TA,T_).call(this):v_(this,TI,TC).call(this,e))}),vT(this,TD,e=>{let t=e.target,i=this.contains(t),r=2===e.button,a=(null==t?void 0:t.nodeName)==="VIDEO",s=v_(this,TL,Tw).call(this,t);i||r&&(a||s)||v_(this,TA,T_).call(this)}),vT(this,Tx,e=>{"Escape"===e.key&&v_(this,TA,T_).call(this)}),vT(this,TP,e=>{var t,i;let r=e.target;if(null==(t=r.matches)?void 0:t.call(r,'button[invoke="copy"]')){let e=null==(i=r.closest("media-context-menu-item"))?void 0:i.querySelector('input[slot="copy"]');e&&navigator.clipboard.writeText(e.value)}v_(this,TA,T_).call(this)}),this.setAttribute("noautohide",""),v_(this,Tb,TT).call(this)}connectedCallback(){super.connectedCallback(),h6(this).addEventListener("contextmenu",vb(this,TR)),this.addEventListener("click",vb(this,TP))}disconnectedCallback(){super.disconnectedCallback(),h6(this).removeEventListener("contextmenu",vb(this,TR)),this.removeEventListener("click",vb(this,TP)),document.removeEventListener("mousedown",vb(this,TD)),document.removeEventListener("keydown",vb(this,Tx))}}TE=new WeakMap,Tb=new WeakSet,TT=function(){this.hidden=!vb(this,TE)},TA=new WeakSet,T_=function(){vA(this,TE,!1),v_(this,Tb,TT).call(this)},TS=new WeakSet,Tk=function(){document.querySelectorAll("media-context-menu").forEach(e
1959=>{e!==this&&v_(e,TA,T_).call(e)})},TL=new WeakSet,Tw=function(e){return!!e&&(!!e.hasAttribute("slot")&&"media"===e.getAttribute("slot")||!!(e.nodeName.includes("-")&&e.tagName.includes("-"))&&(e.hasAttribute("src")||e.hasAttribute("poster")||e.hasAttribute("preload")||e.hasAttribute("playsinline")))},TR=new WeakMap,TI=new WeakSet,TC=function(e){e.preventDefault(),v_(this,TS,Tk).call(this),vA(this,TE,!0),this.style.position="fixed",this.style.left=`${e.clientX}px`,this.style.top=`${e.clientY}px`,v_(this,Tb,TT).call(this),document.addEventListener("mousedown",vb(this,TD),{once:!0}),document.addEventListener("keydown",vb(this,Tx),{once:!0})},TD=new WeakMap,Tx=new WeakMap,TP=new WeakMap,vS.getTemplateHTML=function(e){return` 1960 ${gC.getTemplateHTML(e)} 1961 <style> 1962 :host { 1963 --_menu-bg: rgb(20 20 30 / .8); 1964 background: var(--media-settings-menu-background, 1965 var(--media-menu-background, 1966 var(--media-control-background, 1967 var(--media-secondary-color, var(--_menu-bg))))); 1968 min-width: var(--media-settings-menu-min-width, 170px); 1969 border-radius: 2px; 1970 overflow: hidden; 1971 } 1972 </style> 1973 `},h0.customElements.get("media-context-menu")||h0.customElements.define("media-context-menu",vS);class vk extends gV{}vk.shadowRootOptions={mode:"open"},vk.getTemplateHTML=function(e){return` 1974 ${gV.getTemplateHTML.call(this,e)} 1975 <style> 1976 ::slotted(*) { 1977 color: var(--media-text-color, white); 1978 text-decoration: none; 1979 border: none; 1980 background: none; 1981 cursor: pointer; 1982 padding: 0; 1983 min-height: var(--media-control-height, 24px); 1984 } 1985 </style> 1986 `},h0.customElements.get("media-context-menu-item")||h0.customElements.define("media-context-menu-item",vk);var vL=e=>{throw TypeError(e)},vw=(e,t,i)=>t.has(e)||vL("Cannot "+i),vR=(e,t,i)=>(vw(e,t,"read from private field"),i?i.call(e):t.get(e)),vI=(e,t,i)=>t.has(e)?vL("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),vC=(e,t,i,r)=>(vw(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),vD=(e,t,i)=>(vw(e,t,"access private method"),i),vx=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};"u"<typeof DocumentFragment&&(globalThis.DocumentFragment=class extends vx{});var vP,vM,vO,vN,vU,vF,vB,v$,vH,vV,vG,vW,vK,vq,vj,vY,vz,vX,vQ,vZ,vJ,v0,v1,v2,v3,v4,v5,v8,v9,v6,v7,ye,yt,yi,yr,ya,ys,yn,yo,yl,yd,yu,yh,yc,ym,yf,yp,yg,yv,yy,yE,yb,yT,yA,y_,yS,yk,yL,yw,yR,yI,yC,yD,yx,yP,yM,yO,yN,yU,yF,yB,y$,yH,yV,yG,yW,yK,yq,yj,yY,yz,yX,yQ,yZ,yJ,y0,y1,y2,y3,y4,y5,y8,y9,y6,y7,Ee,Et,Ei,Er,Ea,Es,En,Eo,El,Ed,Eu,Eh,Ec,Em,Ef,Ep,Eg,Ev,Ey,EE,Eb,ET,EA,E_,ES,Ek,EL,Ew,ER,EI,EC,ED,Ex,EP,EM,EO,EN,EU,EF,EB,E$,EH,EV,EG,EW,EK,Eq,Ej,EY,Ez,EX,EQ,EZ,EJ,E0,E1,E2,E3,E4,E5,E8,E9,E6,E7,be,bt,bi,br,ba,bs,bn,bo,bl,bd,bu,bh,bc,bm,bf,bp,bg,bv,by,bE,bb,bT,bA,b_,bS,bk,bL,bw,bR,bI,bC,bD,bx,bP,bM,bO,bN,bU,bF,bB,b$,bH,bV,bG,bW,bK,bq,bj,bY,bz,bX,bQ,bZ,bJ,b0,b1,b2,b3,b4,b5,b8,b9,b6,b7,Te,Tt,Ti,Tr,Ta,Ts,Tn,To,Tl,Td,Tu,Th,Tc,Tm,Tf,Tp,Tg,Tv,Ty,TE,Tb,TT,TA,T_,TS,Tk,TL,Tw,TR,TI,TC,TD,Tx,TP,TM,TO=class extends vx{},TN=class{constructor(e,t={}){vI(this,TM),vC(this,TM,null==t?void 0:t.detail)}get detail(){return vR(this,TM)}initCustomEvent(){}};TM=new WeakMap;var TU={document:{createElement:function(e,t){return new TO}},DocumentFragment,customElements:{get(e){},define(e,t,i){},getName:e=>null,upgrade(e){},whenDefined:e=>Promise.resolve(TO)},CustomEvent:TN,EventTarget:vx,HTMLElement:TO,HTMLVideoElement:class extends vx{}},TF="u"<typeof window||void 0===globalThis.customElements,TB=TF?TU:globalThis,T$=TF?TU.document:globalThis.document;function TH(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function TV(e){return e.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function TG(e){if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}function TW(e){let t=(function(e){let t={};for(let i in e)null!=e[i]&&(t[i]=e[i]);return new URLSearchParams(t)})(e).toString();return t?"?"+t:""}var TK,Tq,Tj,TY=(e,t)=>
1986!!e&&!!t&&(!!e.contains(t)||TY(e,t.getRootNode().host)),Tz="mux.com",TX=(()=>{try{return"3.11.5"}catch{}return"UNKNOWN"})(),TQ=e=>{if(e){if([lv,lg].includes(e))return e;if(null!=e&&e.includes("live"))return lv}},TZ={crossorigin:"crossOrigin",playsinline:"playsInline"},TJ=class{constructor(e,t){vI(this,TK),vI(this,Tq),vI(this,Tj,[]),vC(this,TK,e),vC(this,Tq,t)}[Symbol.iterator](){return vR(this,Tj).values()}get length(){return vR(this,Tj).length}get value(){var e;return null!=(e=vR(this,Tj).join(" "))?e:""}set value(e){var t;e!==this.value&&(vC(this,Tj,[]),this.add(...null!=(t=null==e?void 0:e.split(" "))?t:[]))}toString(){return this.value}item(e){return vR(this,Tj)[e]}values(){return vR(this,Tj).values()}keys(){return vR(this,Tj).keys()}forEach(e){vR(this,Tj).forEach(e)}add(...e){var t,i;e.forEach(e=>{this.contains(e)||vR(this,Tj).push(e)}),(""!==this.value||null!=(t=vR(this,TK))&&t.hasAttribute(`${vR(this,Tq)}`))&&null!=(i=vR(this,TK))&&i.setAttribute(`${vR(this,Tq)}`,`${this.value}`)}remove(...e){var t;e.forEach(e=>{vR(this,Tj).splice(vR(this,Tj).indexOf(e),1)}),null==(t=vR(this,TK))||t.setAttribute(`${vR(this,Tq)}`,`${this.value}`)}contains(e){return vR(this,Tj).includes(e)}toggle(e,t){return void 0!==t?t?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){this.remove(e),this.add(t)}};TK=new WeakMap,Tq=new WeakMap,Tj=new WeakMap;var T0=`[mux-player ${TX}]`;function T1(...e){console.warn(T0,...e)}function T2(...e){console.error(T0,...e)}function T3(e){var t;let i=null!=(t=e.message)?t:"";e.context&&(i+=` ${e.context}`),e.file&&(i+=` ${lM("Read more: ")} 1987https://github.com/muxinc/elements/blob/main/errors/${e.file}`),T1(i)}var T4={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},T5={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},T8=Object.freeze({length:0,start(e){let t=e>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(e){let t=e>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),T9=[...Object.values(T4).filter(e=>T4.PLAYSINLINE!==e),...Object.values(T5)];function T6(e,t){return e.media?e.media.getAttribute(t):e.getAttribute(t)}var T7=class extends TB.HTMLElement{static get observedAttributes(){return T9}constructor(){super()}attributeChangedCallback(e,t,i){var r,a;switch(e){case T5.MUTED:this.media&&(this.media.muted=null!=i,this.media.defaultMuted=null!=i);return;case T5.VOLUME:{let e=null!=(r=TG(i))?r:1;this.media&&(this.media.volume=e);return}case T5.PLAYBACKRATE:{let e=null!=(a=TG(i))?a:1;this.media&&(this.media.playbackRate=e,this.media.defaultPlaybackRate=e);return}}}play(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.play())?t:Promise.reject()}pause(){var e;null==(e=this.media)||e.pause()}load(){var e;null==(e=this.media)||e.load()}get media(){var e;return null==(e=this.shadowRoot)?void 0:e.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var e,t;return null==(t=null==(e=this.media)?void 0:e.paused)||t}get duration(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.duration)?t:NaN}get ended(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.ended)&&t}get buffered(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.buffered)?t:T8}get seekable(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.seekable)?t:T8}get readyState(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.readyState)?t:0}get videoWidth(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.videoWidth)?t:0}get videoHeight(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.videoHeight)?t:0}get currentSrc(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.currentSrc)?t:""}get currentTime(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.currentTime)?t:0}set currentTime(e){this.media&&(this.media.currentTime=Number(e))}get volume(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.volume)?t:1}set volume(e){this.media&&(this.media.volume=Number(e))}get playbackRate(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.playbackRate)?t:1}set playbackRate(e){this.media&&(this.media.playbackRate=Number(e))}get defaultPlaybackRate(){var e;return null!=(e=TG(this.getAttribute(T5.PLAYBACKRATE)))?e:1}set defaultPlaybackRate(e){null!=e?this.setAttribute(T5.PLAYBACKRATE,`${e}`):this.removeAttribute(T5.PLAYBACKRATE)}get crossOrigin(){return T6(this,T4.CROSSORIGIN)}set crossOrigin(e){this.setAttribute(T4.CROSSORIGIN,`${e}`)}get autoplay(){return null!=T6(this,T4.AUTOPLAY)}set autoplay(e){e?this.setAttribute(T4.AUTOPLAY,"string"==typeof e?e:""):this.removeAttribute(T4.AUTOPLAY)}get loop(){return null!=T6(this,T4.LOOP)}set loop(e){e?this.setAttribute(T4.LOOP,""):this.removeAttribute(T4.LOOP)}get muted(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.muted)&&t}set muted(e){this.media&&(this.media.muted=!!e)}get defaultMuted(){return null!=T6(this,T4.MUTED)}set defaultMuted(e){e?this.setAttribute(T4.MUTED,""):this.removeAttribute(T4.MUTED)}
1987get playsInline(){return null!=T6(this,T4.PLAYSINLINE)}set playsInline(e){T2("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(e){["","none","metadata","auto"].includes(e)?this.setAttribute(T4.PRELOAD,e):this.removeAttribute(T4.PRELOAD)}},Ae=`:host { 1988 --media-control-display: var(--controls); 1989 --media-loading-indicator-display: var(--loading-indicator); 1990 --media-dialog-display: var(--dialog); 1991 --media-play-button-display: var(--play-button); 1992 --media-live-button-display: var(--live-button); 1993 --media-seek-backward-button-display: var(--seek-backward-button); 1994 --media-seek-forward-button-display: var(--seek-forward-button); 1995 --media-mute-button-display: var(--mute-button); 1996 --media-captions-button-display: var(--captions-button); 1997 --media-captions-menu-button-display: var(--captions-menu-button, var(--media-captions-button-display)); 1998 --media-rendition-menu-button-display: var(--rendition-menu-button); 1999 --media-audio-track-menu-button-display: var(--audio-track-menu-button); 2000 --media-airplay-button-display: var(--airplay-button); 2001 --media-pip-button-display: var(--pip-button); 2002 --media-fullscreen-button-display: var(--fullscreen-button); 2003 --media-cast-button-display: var(--cast-button, var(--_cast-button-drm-display)); 2004 --media-playback-rate-button-display: var(--playback-rate-button); 2005 --media-playback-rate-menu-button-display: var(--playback-rate-menu-button); 2006 --media-volume-range-display: var(--volume-range); 2007 --media-time-range-display: var(--time-range); 2008 --media-time-display-display: var(--time-display); 2009 --media-duration-display-display: var(--duration-display); 2010 --media-title-display-display: var(--title-display); 2011 2012 display: inline-block; 2013 line-height: 0; 2014 width: 100%; 2015} 2016 2017a { 2018 color: #fff; 2019 font-size: 0.9em; 2020 text-decoration: underline; 2021} 2022 2023media-theme { 2024 display: inline-block; 2025 line-height: 0; 2026 width: 100%; 2027 height: 100%; 2028 direction: ltr; 2029} 2030 2031media-poster-image { 2032 display: inline-block; 2033 line-height: 0; 2034 width: 100%; 2035 height: 100%; 2036} 2037 2038media-poster-image:not([src]):not([placeholdersrc]) { 2039 display: none; 2040} 2041 2042::part(top), 2043[part~='top'] { 2044 --media-control-display: var(--controls, var(--top-controls)); 2045 --media-play-button-display: var(--play-button, var(--top-play-button)); 2046 --media-live-button-display: var(--live-button, var(--top-live-button)); 2047 --media-seek-backward-button-display: var(--seek-backward-button, var(--top-seek-backward-button)); 2048 --media-seek-forward-button-display: var(--seek-forward-button, var(--top-seek-forward-button)); 2049 --media-mute-button-display: var(--mute-button, var(--top-mute-button)); 2050 --media-captions-button-display: var(--captions-button, var(--top-captions-button)); 2051 --media-captions-menu-button-display: var( 2052 --captions-menu-button, 2053 var(--media-captions-button-display, var(--top-captions-menu-button)) 2054 ); 2055 --media-rendition-menu-button-display: var(--rendition-menu-button, var(--top-rendition-menu-button)); 2056 --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--top-audio-track-menu-button)); 2057 --media-airplay-button-display: var(--airplay-button, var(--top-airplay-button)); 2058 --media-pip-button-display: var(--pip-button, var(--top-pip-button)); 2059 --media-fullscreen-button-display: var(--fullscreen-button, var(--top-fullscreen-button)); 2060 --media-cast-button-display: var(--cast-button, var(--top-cast-button, var(--_cast-button-drm-display))); 2061 --media-playback-rate-button-display: var(--playback-rate-button, var(--top-playback-rate-button)); 2062 --media-playback-rate-menu-button-display: var( 2063 --captions-menu-button, 2064 var(--media-playback-rate-button-display, var(--top-playback-rate-menu-button)) 2065 ); 2066 --media-volume-range-display: var(--volume-range, var(--top-volume-range)); 2067 --media-time-range-display: var(--time-range, var(--top-time-range)); 2068 --media-time-display-display: var(--time-display, var(--top-time-display)); 2069 --media-duration-display-display: var(--duration-display, var(--top-duration-display)); 2070 --media-title-display-display: var(--title-display, var(--top-title-display)); 2071} 2072 2073::part(center), 2074[part~='center'] {
2075 --media-control-display: var(--controls, var(--center-controls)); 2076 --media-play-button-display: var(--play-button, var(--center-play-button)); 2077 --media-live-button-display: var(--live-button, var(--center-live-button)); 2078 --media-seek-backward-button-display: var(--seek-backward-button, var(--center-seek-backward-button)); 2079 --media-seek-forward-button-display: var(--seek-forward-button, var(--center-seek-forward-button)); 2080 --media-mute-button-display: var(--mute-button, var(--center-mute-button)); 2081 --media-captions-button-display: var(--captions-button, var(--center-captions-button)); 2082 --media-captions-menu-button-display: var( 2083 --captions-menu-button, 2084 var(--media-captions-button-display, var(--center-captions-menu-button)) 2085 ); 2086 --media-rendition-menu-button-display: var(--rendition-menu-button, var(--center-rendition-menu-button)); 2087 --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--center-audio-track-menu-button)); 2088 --media-airplay-button-display: var(--airplay-button, var(--center-airplay-button)); 2089 --media-pip-button-display: var(--pip-button, var(--center-pip-button)); 2090 --media-fullscreen-button-display: var(--fullscreen-button, var(--center-fullscreen-button)); 2091 --media-cast-button-display: var(--cast-button, var(--center-cast-button, var(--_cast-button-drm-display))); 2092 --media-playback-rate-button-display: var(--playback-rate-button, var(--center-playback-rate-button)); 2093 --media-playback-rate-menu-button-display: var( 2094 --playback-rate-menu-button, 2095 var(--media-playback-rate-button-display, var(--center-playback-rate-menu-button)) 2096 ); 2097 --media-volume-range-display: var(--volume-range, var(--center-volume-range)); 2098 --media-time-range-display: var(--time-range, var(--center-time-range)); 2099 --media-time-display-display: var(--time-display, var(--center-time-display)); 2100 --media-duration-display-display: var(--duration-display, var(--center-duration-display)); 2101} 2102 2103::part(bottom), 2104[part~='bottom'] { 2105 --media-control-display: var(--controls, var(--bottom-controls)); 2106 --media-play-button-display: var(--play-button, var(--bottom-play-button)); 2107 --media-live-button-display: var(--live-button, var(--bottom-live-button)); 2108 --media-seek-backward-button-display: var(--seek-backward-button, var(--bottom-seek-backward-button)); 2109 --media-seek-forward-button-display: var(--seek-forward-button, var(--bottom-seek-forward-button)); 2110 --media-mute-button-display: var(--mute-button, var(--bottom-mute-button)); 2111 --media-captions-button-display: var(--captions-button, var(--bottom-captions-button)); 2112 --media-captions-menu-button-display: var( 2113 --captions-menu-button, 2114 var(--media-captions-button-display, var(--bottom-captions-menu-button)) 2115 ); 2116 --media-rendition-menu-button-display: var(--rendition-menu-button, var(--bottom-rendition-menu-button)); 2117 --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--bottom-audio-track-menu-button)); 2118 --media-airplay-button-display: var(--airplay-button, var(--bottom-airplay-button)); 2119 --media-pip-button-display: var(--pip-button, var(--bottom-pip-button)); 2120 --media-fullscreen-button-display: var(--fullscreen-button, var(--bottom-fullscreen-button)); 2121 --media-cast-button-display: var(--cast-button, var(--bottom-cast-button, var(--_cast-button-drm-display))); 2122 --media-playback-rate-button-display: var(--playback-rate-button, var(--bottom-playback-rate-button)); 2123 --media-playback-rate-menu-button-display: var( 2124 --playback-rate-menu-button, 2125 var(--media-playback-rate-button-display, var(--bottom-playback-rate-menu-button)) 2126 ); 2127 --media-volume-range-display: var(--volume-range, var(--bottom-volume-range)); 2128 --media-time-range-display: var(--time-range, var(--bottom-time-range)); 2129 --media-time-display-display: var(--time-display, var(--bottom-time-display)); 2130 --media-duration-display-display: var(--duration-display, var(--bottom-duration-display)); 2131 --media-title-display-display: var(--title-display, var(--bottom-title-display)); 2132} 2133 2134:host([no-tooltips]) { 2135 --media-tooltip-display: none; 2136} 2137`,At=new WeakMap,Ai=class e{constructor(e,t){this.element=e,this.type=t,this.element.addEventListener(this.type,this);let i=At.get(this.element);i&&i.set(this.type,this)}set(e){if("function"==typeof e)this.handleEvent=e.bind(this.element);else if("object"==typeof e&&"function"==typeof e.handleEvent)this.handleEvent=e.handleEvent.bind(e);else{this.element.removeEventListener(this.type,this);let e=At.get(this.element);
2137e&&e.delete(this.type)}}static for(t){At.has(t.element)||At.set(t.element,new Map);let i=t.attributeName.slice(2),r=At.get(t.element);return r&&r.has(i)?r.get(i):new e(t.element,i)}},Ar=new Map,Aa=new WeakMap,As=new WeakMap,An=class{constructor(e,t,i){this.strings=e,this.values=t,this.processor=i,this.stringsKey=this.strings.join("\x01")}get template(){if(Ar.has(this.stringsKey))return Ar.get(this.stringsKey);{let e=T$.createElement("template"),t=this.strings.length-1;return e.innerHTML=this.strings.reduce((e,i,r)=>e+i+(r<t?`{{ ${r} }}`:""),""),Ar.set(this.stringsKey,e),e}}renderInto(e){var t;let i=this.template;if(Aa.get(e)!==i){Aa.set(e,i);let t=new pX(i,this.values,this.processor);As.set(e,t),e instanceof p4?e.replace(...t.children):e.appendChild(t);return}let r=As.get(e);null==(t=null==r?void 0:r.update)||t.call(r,this.values)}},Ao={processCallback(e,t,i){var r;if(i)for(let[e,a]of t)e in i&&function(e,t){(function(e,t){if(e instanceof p3&&t instanceof Element){let i=e.element;return i[e.attributeName]!==t&&(e.element.removeAttributeNS(e.attributeNamespace,e.attributeName),i[e.attributeName]=t),!0}return!1})(e,t)||function(e,t){if("boolean"==typeof t&&e instanceof p3){let i=e.attributeNamespace;return t!==e.element.hasAttributeNS(i,e.attributeName)&&(e.booleanValue=t),!0}return!1}(e,t)||e instanceof p3&&e.attributeName.startsWith("on")&&(Ai.for(e).set(t),e.element.removeAttributeNS(e.attributeNamespace,e.attributeName),1)||!1===t&&e instanceof p4&&(e.replace(""),1)||t instanceof An&&e instanceof p4&&(t.renderInto(e),1)||t instanceof DocumentFragment&&e instanceof p4&&(t.childNodes.length&&e.replace(...t.childNodes),1)||function(e,t){if(e instanceof p3){let i=e.attributeNamespace,r=e.element.getAttributeNS(i,e.attributeName);return String(t)!==r&&(e.value=String(t))}e.value=String(t)}(e,t)}(a,null!=(r=i[e])?r:"")}};function Al(e,...t){return new An(e,t,Ao)}var Ad=Object.values({TOP:"top",CENTER:"center",BOTTOM:"bottom",LAYER:"layer",MEDIA_LAYER:"media-layer",POSTER_LAYER:"poster-layer",VERTICAL_LAYER:"vertical-layer",CENTERED_LAYER:"centered-layer",GESTURE_LAYER:"gesture-layer",CONTROLLER_LAYER:"controller",BUTTON:"button",RANGE:"range",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"}).join(", "),Au=e=>e.charAt(0).toUpperCase()+e.slice(1),Ah=(e,t)=>{let i=(e=>{if(e.muxCode){if(2403210===e.muxCode)return"403-expired-token.md";if(2412202===e.muxCode)return"403-malformatted-token.md";if([2403222,2403221].includes(e.muxCode))return"403-incorrect-aud-value.md";if(2403232===e.muxCode)return"403-playback-id-mismatch.md";if(2403201===e.muxCode)return"missing-signed-tokens.md";if(2404e3===e.muxCode)return"404-not-found.md";if(2412e3===e.muxCode)return"412-not-playable.md"}if(e.code){if(e.code===lm.MEDIA_ERR_NETWORK)return"";if(e.code===lm.MEDIA_ERR_DECODE)return"media-decode-error.md";if(e.code===lm.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""})(e);return{message:e.message,context:e.context,file:i}},Ac
vendor: 8,830 bytes, lines 2137-2437
2137=`<template id="media-theme-gerwig"> 2138 <style> 2139 @keyframes pre-play-hide { 2140 0% { 2141 transform: scale(1); 2142 opacity: 1; 2143 } 2144 2145 30% { 2146 transform: scale(0.7); 2147 } 2148 2149 100% { 2150 transform: scale(1.5); 2151 opacity: 0; 2152 } 2153 } 2154 2155 :host { 2156 --_primary-color: var(--media-primary-color, #fff); 2157 --_secondary-color: var(--media-secondary-color, transparent); 2158 --_accent-color: var(--media-accent-color, #fa50b5); 2159 --_text-color: var(--media-text-color, #000); 2160 2161 --media-icon-color: var(--_primary-color); 2162 --media-control-background: var(--_secondary-color); 2163 --media-control-hover-background: var(--_accent-color); 2164 --media-time-buffered-color: rgba(255, 255, 255, 0.4); 2165 --media-preview-time-text-shadow: none; 2166 --media-control-height: 14px; 2167 --media-control-padding: 6px; 2168 --media-tooltip-container-margin: 6px; 2169 --media-tooltip-distance: 18px; 2170 2171 color: var(--_primary-color); 2172 display: inline-block; 2173 width: 100%; 2174 height: 100%; 2175 } 2176 2177 :host([audio]) { 2178 --_secondary-color: var(--media-secondary-color, black); 2179 --media-preview-time-text-shadow: none; 2180 } 2181 2182 :host([audio]) ::slotted([slot='media']) { 2183 height: 0px; 2184 } 2185 2186 :host([audio]) media-loading-indicator { 2187 display: none; 2188 } 2189 2190 :host([audio]) media-controller { 2191 background: transparent; 2192 } 2193 2194 :host([audio]) media-controller::part(vertical-layer) { 2195 background: transparent; 2196 } 2197 2198 :host([audio]) media-control-bar { 2199 width: 100%; 2200 background-color: var(--media-control-background); 2201 } 2202 2203 /* 2204 * 0.433s is the transition duration for VTT Regions. 2205 * Borrowed here, so the captions don't move too fast. 2206 */ 2207 media-controller { 2208 --media-webkit-text-track-transform: translateY(0) scale(0.98); 2209 --media-webkit-text-track-transition: transform 0.433s ease-out 0.3s; 2210 } 2211 media-controller:is([mediapaused], :not([userinactive])) { 2212 --media-webkit-text-track-transform: translateY(-50px) scale(0.98); 2213 --media-webkit-text-track-transition: transform 0.15s ease; 2214 } 2215 2216 /* 2217 * CSS specific to iOS devices. 2218 * See: https://stackoverflow.com/questions/30102792/css-media-query-to-target-only-ios-devices/60220757#60220757 2219 */ 2220 @supports (-webkit-touch-callout: none) { 2221 /* Disable subtitle adjusting for iOS Safari */ 2222 media-controller[mediaisfullscreen] { 2223 --media-webkit-text-track-transform: unset; 2224 --media-webkit-text-track-transition: unset; 2225 } 2226 } 2227 2228 media-time-range { 2229 --media-box-padding-left: 6px; 2230 --media-box-padding-right: 6px; 2231 --media-range-bar-color: var(--_accent-color); 2232 --media-time-range-buffered-color: var(--_primary-color); 2233 --media-range-track-color: transparent; 2234 --media-range-track-background: rgba(255, 255, 255, 0.4); 2235 --media-range-thumb-background: radial-gradient( 2236 circle, 2237 #000 0%, 2238 #000 25%, 2239 var(--_accent-color) 25%, 2240 var(--_accent-color) 2241 ); 2242 --media-range-thumb-width: 12px; 2243 --media-range-thumb-height: 12px; 2244 --media-range-thumb-transform: scale(0); 2245 --media-range-thumb-transition: transform 0.3s; 2246 --media-range-thumb-opacity: 1; 2247 --media-preview-background: var(--_primary-color); 2248 --media-box-arrow-background: var(--_primary-color); 2249 --media-preview-thumbnail-border: 5px solid var(--_primary-color); 2250 --media-preview-border-radius: 5px; 2251 --media-text-color: var(--_text-color); 2252 --media-control-hover-background: transparent; 2253 --media-preview-chapter-text-shadow: none; 2254 color: var(--_accent-color); 2255 padding: 0 6px; 2256 } 2257 2258 :host([audio]) media-time-range { 2259 --media-preview-time-padding: 1.5px 6px; 2260 --media-preview-box-margin: 0 0 -5px; 2261 } 2262 2263 media-time-range:hover { 2264 --media-range-thumb-transform: scale(1); 2265 } 2266 2267 media-preview-thumbnail { 2268 border-bottom-width: 0; 2269 } 2270 2271 [part~='menu'] { 2272 border-radius: 2px; 2273 border: 1px solid rgba(0, 0, 0, 0.1); 2274 bottom: 50px; 2275 padding: 2.5px 10px; 2276 } 2277 2278 [part~='menu']::part(indicator) { 2279 fill: var(--_accent-color); 2280 } 2281 2282 [part~='menu']::part(menu-item) { 2283 box-sizing: border-box; 2284 display: flex; 2285 align-items: center; 2286 padding: 6px 10px; 2287 min-height: 34px; 2288 } 2289 2290 [part~='menu']::part(checked) { 2291 font-weight: 700; 2292 } 2293 2294 media-captions-menu, 2295 media-rendition-menu, 2296 media-audio-track-menu, 2297 media-playback-rate-menu { 2298 position: absolute; /* ensure they don't take up space in DOM on load */ 2299 --media-menu-background: var(--_primary-color); 2300 --media-menu-item-checked-background: transparent; 2301 --media-text-color: var(--_text-color); 2302 --media-menu-item-hover-background: transparent; 2303 --media-menu-item-hover-outline: var(--_accent-color) solid 1px; 2304 } 2305 2306 media-rendition-menu { 2307 min-width: 140px; 2308 } 2309 2310 /* The icon is a circle so make it 16px high instead of 14px for more balance. */ 2311 media-audio-track-menu-button { 2312 --media-control-padding: 5px; 2313 --media-control-height: 16px; 2314 } 2315 2316 media-playback-rate-menu-button { 2317 --media-control-padding: 6px 3px; 2318 min-width: 4.4ch; 2319 } 2320 2321 media-playback-rate-menu { 2322 --media-menu-flex-direction: row; 2323 --media-menu-item-checked-background: var(--_accent-color); 2324 --media-menu-item-checked-indicator-display: none; 2325 margin-right: 6px; 2326 padding: 0; 2327 --media-menu-gap: 0.25em; 2328 } 2329 2330 media-playback-rate-menu[part~='menu']::part(menu-item) { 2331 padding: 6px 6px 6px 8px; 2332 } 2333 2334 media-playback-rate-menu[part~='menu']::part(checked) { 2335 color: #fff; 2336 } 2337 2338 :host(:not([audio])) media-time-range { 2339 /* Adding px is required here for calc() */ 2340 --media-range-padding: 0px; 2341 background: transparent; 2342 z-index: 10; 2343 height: 10px; 2344 bottom: -3px; 2345 width: 100%; 2346 } 2347 2348 media-control-bar :is([role='button'], [role='switch'], button) { 2349 line-height: 0; 2350 } 2351 2352 media-control-bar :is([part*='button'], [part*='range'], [part*='display']) { 2353 border-radius: 3px; 2354 } 2355 2356 .spacer { 2357 flex-grow: 1; 2358 background-color: var(--media-control-background, rgba(20, 20, 30, 0.7)); 2359 } 2360 2361 media-control-bar[slot~='top-chrome'] { 2362 min-height: 42px; 2363 pointer-events: none; 2364 } 2365 2366 media-control-bar { 2367 --gradient-steps: 2368 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%, 2369 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%, 2370 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%, 2371 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%; 2372 } 2373 2374 :host([title]) media-control-bar[slot='top-chrome']::before, 2375 :host([videotitle]) media-control-bar[slot='top-chrome']::before { 2376 content: ''; 2377 position: absolute; 2378 width: 100%; 2379 padding-bottom: min(100px, 25%); 2380 background: linear-gradient(to top, var(--gradient-steps)); 2381 opacity: 0.8; 2382 pointer-events: none; 2383 } 2384 2385 :host(:not([audio])) media-control-bar[part~='bottom']::before { 2386 content: ''; 2387 position: absolute; 2388 width: 100%; 2389 bottom: 0; 2390 left: 0; 2391 padding-bottom: min(100px, 25%); 2392 background: linear-gradient(to bottom, var(--gradient-steps)); 2393 opacity: 0.8; 2394 z-index: 1; 2395 pointer-events: none; 2396 } 2397 2398 media-control-bar[part~='bottom'] > * { 2399 z-index: 20; 2400 } 2401 2402 media-control-bar[part~='bottom'] { 2403 padding: 6px 6px; 2404 } 2405 2406 media-control-bar[slot~='top-chrome'] > * { 2407 --media-control-background: transparent; 2408 --media-control-hover-background: transparent; 2409 position: relative; 2410 } 2411 2412 media-controller::part(vertical-layer) { 2413 transition: background-color 1s; 2414 } 2415 2416 media-controller:is([mediapaused], :not([userinactive]))::part(vertical-layer) { 2417 background-color: var(--controls-backdrop-color, var(--controls, transparent)); 2418 transition: background-color 0.25s; 2419 } 2420 2421 .center-controls { 2422 --media-button-icon-width: 100%; 2423 --media-button-icon-height: auto; 2424 --media-tooltip-display: none; 2425 pointer-events: none; 2426 width: 100%; 2427 display: flex; 2428 flex-flow: row; 2429 align-items: center; 2430 justify-content: center; 2431 paint-order: stroke; 2432 stroke: rgba(102, 102, 102, 1); 2433 stroke-width: 0.3px; 2434 text-shadow: 2435 0 0 2px rgb(0 0 0 / 0.25), 2436 0 0 6px rgb(0 0 0 / 0.25); 2437
2437} 2438 2439 .center-controls media-play-button { 2440 --media-control-background: transparent; 2441 --media-control-hover-background: transparent; 2442 --media-control-padding: 0; 2443 width: 40px; 2444 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 2444-3269
2444; 2445 } 2446 2447 [breakpointsm] .center-controls media-play-button { 2448 width: 90px; 2449 height: 90px; 2450 border-radius: 50%; 2451 transition: background 0.4s; 2452 padding: 24px; 2453 --media-control-background: #000; 2454 --media-control-hover-background: var(--_accent-color); 2455 } 2456 2457 .center-controls media-seek-backward-button, 2458 .center-controls media-seek-forward-button { 2459 --media-control-background: transparent; 2460 --media-control-hover-background: transparent; 2461 padding: 0; 2462 margin: 0 20px; 2463 width: max(33px, min(8%, 40px)); 2464 text-shadow: 2465 0 0 2px rgb(0 0 0 / 0.25), 2466 0 0 6px rgb(0 0 0 / 0.25); 2467 } 2468 2469 [breakpointsm]:not([audio]) .center-controls.pre-playback { 2470 display: grid; 2471 align-items: initial; 2472 justify-content: initial; 2473 height: 100%; 2474 overflow: hidden; 2475 } 2476 2477 [breakpointsm]:not([audio]) .center-controls.pre-playback media-play-button { 2478 place-self: var(--_pre-playback-place, center); 2479 grid-area: 1 / 1; 2480 margin: 16px; 2481 } 2482 2483 /* Show and hide controls or pre-playback state */ 2484 2485 [breakpointsm]:is([mediahasplayed], :not([mediapaused])):not([audio]) 2486 .center-controls.pre-playback 2487 media-play-button { 2488 /* Using \`forwards\` would lead to a laggy UI after the animation got in the end state */ 2489 animation: 0.3s linear pre-play-hide; 2490 opacity: 0; 2491 pointer-events: none; 2492 } 2493 2494 .autoplay-unmute { 2495 --media-control-hover-background: transparent; 2496 width: 100%; 2497 display: flex; 2498 align-items: center; 2499 justify-content: center; 2500 filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25)); 2501 } 2502 2503 .autoplay-unmute-btn { 2504 --media-control-height: 16px; 2505 border-radius: 8px; 2506 background: #000; 2507 color: var(--_primary-color); 2508 display: flex; 2509 align-items: center; 2510 padding: 8px 16px; 2511 font-size: 18px; 2512 font-weight: 500; 2513 cursor: pointer; 2514 } 2515 2516 .autoplay-unmute-btn:hover { 2517 background: var(--_accent-color); 2518 } 2519 2520 [breakpointsm] .autoplay-unmute-btn { 2521 --media-control-height: 30px; 2522 padding: 14px 24px; 2523 font-size: 26px; 2524 } 2525 2526 .autoplay-unmute-btn svg { 2527 margin: 0 6px 0 0; 2528 } 2529 2530 [breakpointsm] .autoplay-unmute-btn svg { 2531 margin: 0 10px 0 0; 2532 } 2533 2534 media-controller:not([audio]):not([mediahasplayed]) *:is(media-control-bar, media-time-range) { 2535 display: none; 2536 } 2537 2538 media-error-dialog:not([mediaerrorcode]) { 2539 opacity: 0; 2540 } 2541 2542 media-loading-indicator { 2543 --media-loading-icon-width: 100%; 2544 --media-button-icon-height: auto; 2545 display: var(--media-control-display, var(--media-loading-indicator-display, flex)); 2546 pointer-events: none; 2547 position: absolute; 2548 width: min(15%, 150px); 2549 flex-flow: row; 2550 align-items: center; 2551 justify-content: center; 2552 } 2553 2554 /* Intentionally don't target the div for transition but the children 2555 of the div. Prevents messing with media-chrome's autohide feature. */ 2556 media-loading-indicator + div * { 2557 transition: opacity 0.15s; 2558 opacity: 1; 2559 } 2560 2561 media-loading-indicator[medialoading]:not([mediapaused]) ~ div > * { 2562 opacity: 0; 2563 transition-delay: 400ms; 2564 } 2565 2566 media-volume-range { 2567 width: min(100%, 100px); 2568 --media-range-padding-left: 10px; 2569 --media-range-padding-right: 10px; 2570 --media-range-thumb-width: 12px; 2571 --media-range-thumb-height: 12px; 2572 --media-range-thumb-background: radial-gradient( 2573 circle, 2574 #000 0%, 2575 #000 25%, 2576 var(--_primary-color) 25%, 2577 var(--_primary-color) 2578 ); 2579 --media-control-hover-background: none; 2580 } 2581 2582 media-time-display { 2583 white-space: nowrap; 2584 } 2585 2586 /* Generic style for explicitly disabled controls */ 2587 media-control-bar[part~='bottom'] [disabled], 2588 media-control-bar[part~='bottom'] [aria-disabled='true'] { 2589 opacity: 60%; 2590 cursor: not-allowed; 2591 } 2592 2593 media-text-display { 2594 --media-font-size: 16px; 2595 --media-control-padding: 14px; 2596 font-weight: 500; 2597 } 2598 2599 media-play-button.animated *:is(g, path) { 2600 transition: all 0.3s; 2601 } 2602 2603 media-play-button.animated[mediapaused] .pause-icon-pt1 { 2604 opacity: 0; 2605 } 2606 2607 media-play-button.animated[mediapaused] .pause-icon-pt2 { 2608 transform-origin: center center; 2609 transform: scaleY(0); 2610 } 2611 2612 media-play-button.animated[mediapaused] .play-icon { 2613 clip-path: inset(0 0 0 0); 2614 } 2615 2616 media-play-button.animated:not([mediapaused]) .play-icon { 2617 clip-path: inset(0 0 0 100%); 2618 } 2619 2620 media-seek-forward-button, 2621 media-seek-backward-button { 2622 --media-font-weight: 400; 2623 } 2624 2625 .mute-icon { 2626 display: inline-block; 2627 } 2628 2629 .mute-icon :is(path, g) { 2630 transition: opacity 0.5s; 2631 } 2632 2633 .muted { 2634 opacity: 0; 2635 } 2636 2637 media-mute-button[mediavolumelevel='low'] :is(.volume-medium, .volume-high), 2638 media-mute-button[mediavolumelevel='medium'] :is(.volume-high) { 2639 opacity: 0; 2640 } 2641 2642 media-mute-button[mediavolumelevel='off'] .unmuted { 2643 opacity: 0; 2644 } 2645 2646 media-mute-button[mediavolumelevel='off'] .muted { 2647 opacity: 1; 2648 } 2649 2650 /** 2651 * Our defaults for these buttons are to hide them at small sizes 2652 * users can override this with CSS 2653 */ 2654 media-controller:not([breakpointsm]):not([audio]) { 2655 --bottom-play-button: none; 2656 --bottom-seek-backward-button: none; 2657 --bottom-seek-forward-button: none; 2658 --bottom-time-display: none; 2659 --bottom-playback-rate-menu-button: none; 2660 --bottom-pip-button: none; 2661 } 2662 2663 [part='mux-badge'] { 2664 position: absolute; 2665 bottom: 10px; 2666 right: 10px; 2667 z-index: 2; 2668 opacity: 0.6; 2669 transition: 2670 opacity 0.2s ease-in-out, 2671 bottom 0.2s ease-in-out; 2672 } 2673 2674 [part='mux-badge']:hover { 2675 opacity: 1; 2676 } 2677 2678 [part='mux-badge'] a { 2679 font-size: 14px; 2680 font-family: var(--_font-family); 2681 color: var(--_primary-color); 2682 text-decoration: none; 2683 display: flex; 2684 align-items: center; 2685 gap: 5px; 2686 } 2687 2688 [part='mux-badge'] .mux-badge-text { 2689 transition: opacity 0.5s ease-in-out; 2690 opacity: 0; 2691 } 2692 2693 [part='mux-badge'] .mux-badge-logo { 2694 width: 40px; 2695 height: auto; 2696 display: inline-block; 2697 } 2698 2699 [part='mux-badge'] .mux-badge-logo svg { 2700 width: 100%; 2701 height: 100%; 2702 fill: white; 2703 } 2704 2705 media-controller:not([userinactive]):not([mediahasplayed]) [part='mux-badge'], 2706 media-controller:not([userinactive]) [part='mux-badge'], 2707 media-controller[mediahasplayed][mediapaused] [part='mux-badge'] { 2708 transition: bottom 0.1s ease-in-out; 2709 } 2710 2711 media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] { 2712 transition: bottom 0.2s ease-in-out 0.62s; 2713 } 2714 2715 media-controller:not([userinactive]) [part='mux-badge'] .mux-badge-text, 2716 media-controller[mediahasplayed][mediapaused] [part='mux-badge'] .mux-badge-text { 2717 opacity: 1; 2718 } 2719 2720 media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] .mux-badge-text { 2721 opacity: 0; 2722 } 2723 2724 media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] { 2725 bottom: 10px; 2726 } 2727 2728 media-controller:not([userinactive]):not([mediahasplayed]) [part='mux-badge'] { 2729 bottom: 10px; 2730 } 2731 2732 media-controller:not([userinactive])[mediahasplayed] [part='mux-badge'], 2733 media-controller[mediahasplayed][mediapaused] [part='mux-badge'] { 2734 bottom: calc(28px + var(--media-control-height, 0px) + var(--media-control-padding, 0px) * 2); 2735 } 2736 </style> 2737 2738 <template partial="TitleDisplay"> 2739 <template if="videotitle"> 2740 <template if="videotitle != true"> 2741 <media-text-display part="top title display" class="title-display">{{videotitle}}</media-text-display> 2742 </template> 2743 </template> 2744 <template if="!videotitle"> 2745 <template if="title"> 2746 <media-text-display part="top title display" class="title-display">{{title}}</media-text-display> 2747 </template> 2748 </template> 2749 </template> 2750 2751 <template partial="PlayButton"> 2752 <media-play-button 2753 part="{{section ?? 'bottom'}} play button" 2754 disabled="{{disabled}}" 2755 aria-disabled="{{disabled}}" 2756 class="animated" 2757 > 2758 <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon"> 2759 <g class="play-icon"> 2760 <path 2761 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" 2762 /> 2763 </g> 2764 <g class="pause-icon"> 2765 <path 2766 class="pause-icon-pt1" 2767 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" 2768 /> 2769 <path 2770 class="pause-icon-pt2" 2771 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" 2772 /> 2773 </g> 2774 </svg> 2775 </media-play-button> 2776 </template> 2777 2778 <template partial="PrePlayButton"> 2779 <media-play-button 2780 part="{{section ?? 'center'}} play button pre-play" 2781 disabled="{{disabled}}" 2782 aria-disabled="{{disabled}}" 2783 > 2784 <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon" style="transform: translate(3px, 0)"> 2785 <path 2786 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" 2787 /> 2788 </svg> 2789 </media-play-button> 2790 </template> 2791 2792 <template partial="SeekBackwardButton"> 2793 <media-seek-backward-button 2794 seekoffset="{{backwardseekoffset}}" 2795 part="{{section ?? 'bottom'}} seek-backward button" 2796 disabled="{{disabled}}" 2797 aria-disabled="{{disabled}}" 2798 > 2799 <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon"> 2800 <path 2801 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" 2802 /> 2803 <text transform="translate(6 12)" style="font-size: 14px; font-family: 'ArialMT', 'Arial'"> 2804 {{backwardseekoffset}} 2805 </text> 2806 </svg> 2807 </media-seek-backward-button> 2808 </template> 2809 2810 <template partial="SeekForwardButton"> 2811 <media-seek-forward-button 2812 seekoffset="{{forwardseekoffset}}" 2813 part="{{section ?? 'bottom'}} seek-forward button" 2814 disabled="{{disabled}}" 2815 aria-disabled="{{disabled}}" 2816 > 2817 <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon"> 2818 <g> 2819 <text transform="translate(-1 12)" style="font-size: 14px; font-family: 'ArialMT', 'Arial'"> 2820 {{forwardseekoffset}} 2821 </text> 2822 <path 2823 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" 2824 /> 2825 </g> 2826 </svg> 2827 </media-seek-forward-button> 2828 </template> 2829 2830 <template partial="MuteButton"> 2831 <media-mute-button part="bottom mute button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2832 <svg viewBox="0 0 18 14" slot="icon" class="mute-icon" aria-hidden="true"> 2833 <g class="unmuted"> 2834 <path 2835 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" 2836 /> 2837 <path 2838 class="volume-low" 2839 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" 2840 /> 2841 <path 2842 class="volume-medium" 2843 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" 2844 /> 2845 <path 2846 class="volume-high" 2847 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" 2848 /> 2849 </g> 2850 <g class="muted"> 2851 <path 2852 fill-rule="evenodd" 2853 clip-rule="evenodd" 2854 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" 2855 /> 2856 <path 2857 fill-rule="evenodd" 2858 clip-rule="evenodd" 2859 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" 2860 /> 2861 </g> 2862 </svg> 2863 </media-mute-button> 2864 </template> 2865 2866 <template partial="PipButton"> 2867 <media-pip-button part="bottom pip button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2868 <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon"> 2869 <path 2870 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" 2871 /> 2872 <path 2873 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" 2874 /> 2875 </svg> 2876 </media-pip-button> 2877 </template> 2878 2879 <template partial="CaptionsMenu"> 2880 <media-captions-menu-button part="bottom captions button"> 2881 <svg aria-hidden="true" viewBox="0 0 18 14" slot="on"> 2882 <path 2883 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" 2884 /> 2885 </svg> 2886 <svg aria-hidden="true" viewBox="0 0 18 14" slot="off"> 2887 <path 2888 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" 2889 /> 2890 <path 2891 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" 2892 /> 2893 <path 2894 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" 2895 /> 2896 </svg> 2897 </media-captions-menu-button> 2898 <media-captions-menu 2899 hidden 2900 anchor="auto" 2901 part="bottom captions menu" 2902 disabled="{{disabled}}" 2903 aria-disabled="{{disabled}}" 2904 exportparts="menu-item" 2905 > 2906 <div slot="checked-indicator"> 2907 <style> 2908 .indicator { 2909 position: relative; 2910 top: 1px; 2911 width: 0.9em; 2912 height: auto; 2913 fill: var(--_accent-color); 2914 margin-right: 5px; 2915 } 2916 2917 [aria-checked='false'] .indicator { 2918 display: none; 2919 } 2920 </style> 2921 <svg viewBox="0 0 14 18" class="indicator"> 2922 <path 2923 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" 2924 fill-rule="evenodd" 2925 /> 2926 </svg></div 2927 ></media-captions-menu> 2928 </template> 2929 2930 <template partial="AirplayButton"> 2931 <media-airplay-button part="bottom airplay button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2932 <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon"> 2933 <path 2934 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" 2935 /> 2936 <path 2937 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" 2938 /> 2939 </svg> 2940 </media-airplay-button> 2941 </template> 2942 2943 <template partial="FullscreenButton"> 2944 <media-fullscreen-button part="bottom fullscreen button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2945 <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter"> 2946 <path 2947 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" 2948 /> 2949 <path 2950 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" 2951 /> 2952 <path 2953 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" 2954 /> 2955 <path 2956 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" 2957 /> 2958 </svg> 2959 <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit"> 2960 <path 2961 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" 2962 /> 2963 <path 2964 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" 2965 /> 2966 <path 2967 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" 2968 /> 2969 <path 2970 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" 2971 /> 2972 </svg> 2973 </media-fullscreen-button> 2974 </template> 2975 2976 <template partial="CastButton"> 2977 <media-cast-button part="bottom cast button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2978 <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter"> 2979 <path 2980 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" 2981 /> 2982 </svg> 2983 <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit"> 2984 <path 2985 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" 2986 /> 2987 <path d="M2.15002 5.634C5.18352 6.4207 7.57252 8.8151 8.35282 11.8499H15.8501V2.1499H2.15002V5.634Z" /> 2988 </svg> 2989 </media-cast-button> 2990 </template> 2991 2992 <template partial="LiveButton"> 2993 <media-live-button part="{{section ?? 'top'}} live button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2994 <span slot="text">Live</span> 2995 </media-live-button> 2996 </template> 2997 2998 <template partial="PlaybackRateMenu"> 2999 <media-playback-rate-menu-button part="bottom playback-rate button"></media-playback-rate-menu-button> 3000 <media-playback-rate-menu 3001 hidden 3002 anchor="auto" 3003 rates="{{playbackrates}}" 3004 exportparts="menu-item" 3005 part="bottom playback-rate menu" 3006 disabled="{{disabled}}" 3007 aria-disabled="{{disabled}}" 3008 ></media-playback-rate-menu> 3009 </template> 3010 3011 <template partial="VolumeRange"> 3012 <media-volume-range 3013 part="bottom volume range" 3014 disabled="{{disabled}}" 3015 aria-disabled="{{disabled}}" 3016 ></media-volume-range> 3017 </template> 3018 3019 <template partial="TimeDisplay"> 3020 <media-time-display 3021 remaining="{{defaultshowremainingtime}}" 3022 showduration="{{!hideduration}}" 3023 part="bottom time display" 3024 disabled="{{disabled}}" 3025 aria-disabled="{{disabled}}" 3026 ></media-time-display> 3027 </template> 3028 3029 <template partial="TimeRange"> 3030 <media-time-range part="bottom time range" disabled="{{disabled}}" aria-disabled="{{disabled}}" exportparts="thumb"> 3031 <media-preview-thumbnail slot="preview"></media-preview-thumbnail> 3032 <media-preview-chapter-display slot="preview"></media-preview-chapter-display> 3033 <media-preview-time-display slot="preview"></media-preview-time-display> 3034 <div slot="preview" part="arrow"></div> 3035 </media-time-range> 3036 </template> 3037 3038 <template partial="AudioTrackMenu"> 3039 <media-audio-track-menu-button part="bottom audio-track button"> 3040 <svg aria-hidden="true" slot="icon" viewBox="0 0 18 16"> 3041 <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" /> 3042 <path 3043 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" 3044 /> 3045 </svg> 3046 </media-audio-track-menu-button> 3047 <media-audio-track-menu 3048 hidden 3049 anchor="auto" 3050 part="bottom audio-track menu" 3051 disabled="{{disabled}}" 3052 aria-disabled="{{disabled}}" 3053 exportparts="menu-item" 3054 > 3055 <div slot="checked-indicator"> 3056 <style> 3057 .indicator { 3058 position: relative; 3059 top: 1px; 3060 width: 0.9em; 3061 height: auto; 3062 fill: var(--_accent-color); 3063 margin-right: 5px; 3064 } 3065 3066 [aria-checked='false'] .indicator { 3067 display: none; 3068 } 3069 </style> 3070 <svg viewBox="0 0 14 18" class="indicator"> 3071 <path 3072 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" 3073 fill-rule="evenodd" 3074 /> 3075 </svg> 3076 </div> 3077 </media-audio-track-menu> 3078 </template> 3079 3080 <template partial="RenditionMenu"> 3081 <media-rendition-menu-button part="bottom rendition button"> 3082 <svg aria-hidden="true" slot="icon" viewBox="0 0 18 14"> 3083 <path 3084 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" 3085 /> 3086 </svg> 3087 </media-rendition-menu-button> 3088 <media-rendition-menu 3089 hidden 3090 anchor="auto" 3091 part="bottom rendition menu" 3092 disabled="{{disabled}}" 3093 aria-disabled="{{disabled}}" 3094 > 3095 <div slot="checked-indicator"> 3096 <style> 3097 .indicator { 3098 position: relative; 3099 top: 1px; 3100 width: 0.9em; 3101 height: auto; 3102 fill: var(--_accent-color); 3103 margin-right: 5px; 3104 } 3105 3106 [aria-checked='false'] .indicator { 3107 opacity: 0; 3108 } 3109 </style> 3110 <svg viewBox="0 0 14 18" class="indicator"> 3111 <path 3112 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" 3113 fill-rule="evenodd" 3114 /> 3115 </svg> 3116 </div> 3117 </media-rendition-menu> 3118 </template> 3119 3120 <template partial="MuxBadge"> 3121 <div part="mux-badge"> 3122 <a href="https://www.mux.com/player" target="_blank"> 3123 <span class="mux-badge-text">Powered by</span> 3124 <div class="mux-badge-logo"> 3125 <svg 3126 viewBox="0 0 1600 500" 3127 style="fill-rule: evenodd; clip-rule: evenodd; stroke-linejoin: round; stroke-miterlimit: 2" 3128 > 3129 <g> 3130 <path 3131 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" 3132 style="fill-rule: nonzero" 3133 ></path> 3134 <path 3135 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" 3136 style="fill-rule: nonzero" 3137 ></path> 3138 <path 3139 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" 3140 style="fill-rule: nonzero" 3141 ></path> 3142 </g> 3143 </svg> 3144 </div> 3145 </a> 3146 </div> 3147 </template> 3148 3149 <media-controller 3150 part="controller" 3151 defaultstreamtype="{{defaultstreamtype ?? 'on-demand'}}" 3152 breakpoints="sm:470" 3153 gesturesdisabled="{{disabled}}" 3154 hotkeys="{{hotkeys}}" 3155 nohotkeys="{{nohotkeys}}" 3156 novolumepref="{{novolumepref}}" 3157 audio="{{audio}}" 3158 noautoseektolive="{{noautoseektolive}}" 3159 defaultsubtitles="{{defaultsubtitles}}" 3160 defaultduration="{{defaultduration ?? false}}" 3161 keyboardforwardseekoffset="{{forwardseekoffset}}" 3162 keyboardbackwardseekoffset="{{backwardseekoffset}}" 3163 exportparts="layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer" 3164 style="--_pre-playback-place:{{preplaybackplace ?? 'center'}}" 3165 > 3166 <slot name="media" slot="media"></slot> 3167 <slot name="poster" slot="poster"></slot> 3168 3169 <media-loading-indicator slot="centered-chrome" noautohide></media-loading-indicator> 3170 3171 <template if="!audio"> 3172 <media-error-dialog slot="dialog" noautohide></media-error-dialog> 3173 <!-- Pre-playback UI --> 3174 <!-- same for both on-demand and live --> 3175 <div slot="centered-chrome" class="center-controls pre-playback"> 3176 <template if="!breakpointsm">{{>PlayButton section="center"}}</template> 3177 <template if="breakpointsm">{{>PrePlayButton section="center"}}</template> 3178 </div> 3179 3180 <!-- Mux Badge --> 3181 <template if="proudlydisplaymuxbadge"> {{>MuxBadge}} </template> 3182 3183 <!-- Autoplay centered unmute button --> 3184 <!-- 3185 todo: figure out how show this with available state variables 3186 needs to show when: 3187 - autoplay is enabled 3188 - playback has been successful 3189 - audio is muted 3190 - in place / instead of the pre-plaback play button 3191 - not to show again after user has interacted with this button 3192 - OR user has interacted with the mute button in the control bar 3193 --> 3194 <!-- 3195 There should be a >MuteButton to the left of the "Unmute" text, but a templating bug 3196 makes it appear even if commented out in the markup, add it back when code is un-commented 3197 --> 3198 <!-- <div slot="centered-chrome" class="autoplay-unmute"> 3199 <div role="button" class="autoplay-unmute-btn">Unmute</div> 3200 </div> --> 3201 3202 <template if="streamtype == 'on-demand'"> 3203 <template if="breakpointsm"> 3204 <media-control-bar part="control-bar top" slot="top-chrome">{{>TitleDisplay}} </media-control-bar> 3205 </template> 3206 {{>TimeRange}} 3207 <media-control-bar part="control-bar bottom"> 3208 {{>PlayButton}} {{>SeekBackwardButton}} {{>SeekForwardButton}} {{>TimeDisplay}} {{>MuteButton}} 3209 {{>VolumeRange}} 3210 <div class="spacer"></div> 3211 {{>RenditionMenu}} {{>PlaybackRateMenu}} {{>AudioTrackMenu}} {{>CaptionsMenu}} {{>AirplayButton}} 3212 {{>CastButton}} {{>PipButton}} {{>FullscreenButton}} 3213 </media-control-bar> 3214 </template> 3215 3216 <template if="streamtype == 'live'"> 3217 <media-control-bar part="control-bar top" slot="top-chrome"> 3218 {{>LiveButton}} 3219 <template if="breakpointsm"> {{>TitleDisplay}} </template> 3220 </media-control-bar> 3221 <template if="targetlivewindow > 0">{{>TimeRange}}</template> 3222 <media-control-bar part="control-bar bottom"> 3223 {{>PlayButton}} 3224 <template if="targetlivewindow > 0">{{>SeekBackwardButton}} {{>SeekForwardButton}}</template> 3225 {{>MuteButton}} {{>VolumeRange}} 3226 <div class="spacer"></div> 3227 {{>RenditionMenu}} {{>AudioTrackMenu}} {{>CaptionsMenu}} {{>AirplayButton}} {{>CastButton}} {{>PipButton}} 3228 {{>FullscreenButton}} 3229 </media-control-bar> 3230 </template> 3231 </template> 3232 3233 <template if="audio"> 3234 <template if="streamtype == 'on-demand'"> 3235 <template if="title"> 3236 <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar> 3237 </template> 3238 <media-control-bar part="control-bar bottom"> 3239 {{>PlayButton}} 3240 <template if="breakpointsm"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template> 3241 {{>MuteButton}} 3242 <template if="breakpointsm">{{>VolumeRange}}</template> 3243 {{>TimeDisplay}} {{>TimeRange}} 3244 <template if="breakpointsm">{{>PlaybackRateMenu}}</template> 3245 {{>AirplayButton}} {{>CastButton}} 3246 </media-control-bar> 3247 </template> 3248 3249 <template if="streamtype == 'live'"> 3250 <template if="title"> 3251 <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar> 3252 </template> 3253 <media-control-bar part="control-bar bottom"> 3254 {{>PlayButton}} {{>LiveButton section="bottom"}} {{>MuteButton}} 3255 <template if="breakpointsm"> 3256 {{>VolumeRange}} 3257 <template if="targetlivewindow > 0"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template> 3258 </template> 3259 <template if="targetlivewindow > 0"> {{>TimeDisplay}} {{>TimeRange}} </template> 3260 <template if="!targetlivewindow"><div class="spacer"></div></template> 3261 {{>AirplayButton}} {{>CastButton}} 3262 </media-control-bar> 3263 </template> 3264 </template> 3265 3266 <slot></slot> 3267 </media-controller> 3268</template> 3269`
3269,Am=T$.createElement("template");"innerHTML"in Am&&(Am.innerHTML=Ac);var Af,Ap,Ag=class extends gp{};Ag.template=null==(Ap=null==(Af=Am.content)?void 0:Af.children)?void 0:Ap[0],TB.customElements.get("media-theme-gerwig")||TB.customElements.define("media-theme-gerwig",Ag);var Av={SRC:"src",POSTER:"poster"},Ay={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",PLAYBACK_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"},AE=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","videotitle","novolumepref","nomutedpref","proudlydisplaymuxbadge"],Ab=fO.formatErrorMessage;function AT(e){let t=e.videoTitle?{video_title:e.videoTitle}:{};return e.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((t,i)=>{let r=e.getAttribute(i);return null!==r&&(t[i.replace(/^metadata-/,"").replace(/-/g,"_")]=r),t},t)}fO.formatErrorMessage=e=>{var t,i;if(e instanceof lm){let r=((e,t=!1)=>({title:((e,t=!1)=>{var i,r;if(e.muxCode){let a=Au(null!=(i=e.errorCategory)?i:"video"),s=lc(null!=(r=e.errorCategory)?r:lh);if(2000002===e.muxCode)return lM("Your device appears to be offline",t);if(2403210===e.muxCode)return lM("{category} URL has expired",t).format({category:a});if([2403232,2403222,2403221,2412202].includes(e.muxCode))return lM("{category} URL is formatted incorrectly",t).format({category:a});if(2403201===e.muxCode)return lM("Invalid {categoryName} URL",t).format({categoryName:s});if(2404e3===e.muxCode)return lM("{category} does not exist",t).format({category:a});if(2412e3===e.muxCode){let i="live"===e.streamType?"Live stream":"Video";return lM("{mediaType} is not currently available",t).format({mediaType:i})}}if(e.code){if(e.code===lm.MEDIA_ERR_NETWORK)return lM("Network Error",t);if(e.code===lm.MEDIA_ERR_DECODE)return lM("Media Error",t);if(e.code===lm.MEDIA_ERR_SRC_NOT_SUPPORTED)return lM("Source Not Supported",t)}return lM("Error",t)})(e,t).toString(),message:((e,t=!1)=>{var i,r;if(e.muxCode){let a=Au(null!=(i=e.errorCategory)?i:"video"),s=lc(null!=(r=e.errorCategory)?r:lh);return 2000002===e.muxCode?lM("Check your internet connection and try reloading this video.",t):2403210===e.muxCode?lM("The videoâs secured {tokenNamePrefix}-token has expired.",t).format({tokenNamePrefix:s}):2403232===e.muxCode?lM("The videoâs playback ID does not match the one encoded in the {tokenNamePrefix}-token.",t).format({tokenNamePrefix:s}):2412202===e.muxCode?lM("{category} URL is formatted incorrectly",t).format({category:a}):[2403222,2403221].includes(e.muxCode)?lM("The {tokenNamePrefix}-token is formatted with incorrect information.",t).format({tokenNamePrefix:s}):[2403201,24e5].includes(e.muxCode)?lM("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",t).format({tokenNamePrefix:s}):2404e3===e.muxCode?"":e.message}return e.code&&(e.code===lm.MEDIA_ERR_NETWORK||e.code===lm.MEDIA_ERR_DECODE||e.code===lm.MEDIA_ERR_SRC_NOT_SUPPORTED),e.message})(e,t).toString()}))(e,!1);return` 3270 ${null!=r&&r.title?`<h3>${r.title}</h3>`:""} 3271 ${null!=r&&r.message||null!=r&&r.linkUrl?`<p> 3272 ${null==r?void 0:r.message} 3273 ${null!=r&&r.linkUrl?`<a 3274 href="${r.linkUrl}" 3275 target="_blank" 3276 rel="external noopener" 3277 aria-label="${null!=(t=r.linkText)?t:""} ${lM("(opens in a new window)")}" 3278 >${null!=(i=r.linkText)?i:r.linkUrl}</a 3279 >`:""} 3280 </p>`:""} 3281 `}return Ab(e)};var AA,A_,AS,Ak,AL,Aw,AR,AI,AC,AD,Ax,AP,AM,AO,AN,AU=Object.values(u_),AF=Object.values(Av),AB=Object.values(Ay),A$="mux-player",AH={isDialogOpen:!1},AV={redundant_streams:!0},AG=class extends T7{constructor(){super(),vI(this,AR),vI(this,AA),vI(this,A_,!1),vI(this,AS,{}),vI(this,Ak,!0),vI(this,AL,new TJ(this,"hotkeys")),vI(this,Aw,{...AH,onCloseErrorDialog:e=>{var t;(null==(t=e.composedPath()[0])?void 0:t.localName)==="media-error-dialog"&&vD(this,AR,AD).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:e=>{var t;(null==(t=e.composedPath()[0])?void 0:t.localName)==="media-error-dialog"&&(TY(this,T$.activeElement)||e.preventDefault())}}),vC(this,AA,dR()),this.attachShadow({mode:"open"}),vD(this,AR,AC).call(this),this.isConnected&&vD(this,AR,AI).call(this)}static get NAME(){return A$}static get VERSION(){return TX}static get observedAttributes(){var e;return[...null!=(e=T7.observedAttributes)?e:[],...AF,...AU,...AB]}get mediaTheme(){var e;return null==(e=this.shadowRoot)?void 0:e.querySelector("media-theme")}get mediaController(){var e,t;return null==(t=null==(e=this.mediaTheme)?void 0:e.shadowRoot)?void 0:t.querySelector("media-controller")}connectedCallback(){let e=this.media;e&&(e.metadata=AT(this))}attributeChangedCallback(e,t,i){var r;switch(vD(this,AR,AI).call(this),super.attributeChangedCallback(e,t,i),e){case Ay.HOTKEYS:vR(this,AL).value=i;break;case Ay.THUMBNAIL_TIME:null!=i&&this.tokens.thumbnail&&T1(lM("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").toString());break;case Ay.THUMBNAIL_TOKEN:if(i){let e=lP(i);if(e){let{aud:t}=e;"t"!==t&&T1(lM("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:t,expectedAud:"t",tokenNamePrefix:"thumbnail"}))}}break;case Ay.STORYBOARD_TOKEN:if(i){let e=lP(i);if(e){let{aud:t}=e;"s"!==t&&T1(lM("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:t,expectedAud:"s",tokenNamePrefix:"storyboard"}))}}break;case Ay.DRM_TOKEN:if(i){let e=lP(i);if(e){let{aud:t}=e;"d"!==t&&T1(lM("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:t,expectedAud:"d",tokenNamePrefix:"drm"}))}}break;case u_.PLAYBACK_ID:null!=i&&i.includes("?token")&&T2(lM("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:i}));break;case u_.STREAM_TYPE:i&&![lv,lg,ly].includes(i)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=i.includes("dvr")?1/0:0:T3({file:"invalid-stream-type.md",message:lM("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):i===lv?null==this.getAttribute(Ay.TARGET_LIVE_WINDOW)&&(this.targetLiveWindow=0):this.targetLiveWindow=NaN;break;case Ay.FULLSCREEN_ELEMENT:if(null!=i||i!==t){let e=T$.getElementById(i),t=null==e?void 0:e.querySelector("mux-player");this.mediaController&&e&&t&&(this.mediaController.fullscreenElement=e)}break;case u_.CAP_RENDITION_TO_PLAYER_SIZE:(null==i||i!==t)&&(this.capRenditionToPlayerSize=null!=i||void 0)}
3281[u_.PLAYBACK_ID,Av.SRC,Ay.PLAYBACK_TOKEN].includes(e)&&t!==i&&vC(this,Aw,{...vR(this,Aw),...AH}),vD(this,AR,Ax).call(this,{[null!=(r=TZ[e])?r:TV(e)]:i})}async requestFullscreen(e){var t;if(!(!this.mediaController||this.mediaController.hasAttribute(hb.MEDIA_IS_FULLSCREEN)))return null==(t=this.mediaController)||t.dispatchEvent(new TB.CustomEvent(hg.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((e,t)=>{var i;null==(i=this.mediaController)||i.addEventListener(hT.MEDIA_IS_FULLSCREEN,()=>e(),{once:!0})})}async exitFullscreen(){var e;if(!(!this.mediaController||!this.mediaController.hasAttribute(hb.MEDIA_IS_FULLSCREEN)))return null==(e=this.mediaController)||e.dispatchEvent(new TB.CustomEvent(hg.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((e,t)=>{var i;null==(i=this.mediaController)||i.addEventListener(hT.MEDIA_IS_FULLSCREEN,()=>e(),{once:!0})})}get preferCmcd(){var e;return null!=(e=this.getAttribute(u_.PREFER_CMCD))?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?lT.includes(e)?this.setAttribute(u_.PREFER_CMCD,e):T1(`Invalid value for preferCmcd. Must be one of ${lT.join()}`):this.removeAttribute(u_.PREFER_CMCD))}get hasPlayed(){var e,t;return null!=(t=null==(e=this.mediaController)?void 0:e.hasAttribute(hb.MEDIA_HAS_P
3281LAYED))&&t}get inLiveWindow(){var e;return null==(e=this.mediaController)?void 0:e.hasAttribute(hb.MEDIA_TIME_IS_LIVE)}get _hls(){var e;return null==(e=this.media)?void 0:e._hls}get mux(){var e;return null==(e=this.media)?void 0:e.mux}get theme(){var e;return null!=(e=this.getAttribute(Ay.THEME))?e:"gerwig"}set theme(e){this.setAttribute(Ay.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let t={};for(let i of e.getAttributeNames()){if(AE.includes(i))continue;let r=e.getAttribute(i);t[TV(i)]=""===r||r}return t}set themeProps(e){var t,i;vD(this,AR,AI).call(this);let r={...this.themeProps,...e};for(let a in r){if(AE.includes(a))continue;let r=null==e?void 0:e[a];"boolean"==typeof r||null==r?null==(t=this.mediaTheme)||t.toggleAttribute(TH(a),!!r):null==(i=this.mediaTheme)||i.setAttribute(TH(a),r)}}get playbackId(){var e;return null!=(e=this.getAttribute(u_.PLAYBACK_ID))?e:void 0}set playbackId(e){e?this.setAttribute(u_.PLAYBACK_ID,e):this.removeAttribute(u_.PLAYBACK_ID)}get src(){var e,t;return this.playbackId?null!=(e=AW(this,Av.SRC))?e:void 0:null!=(t=this.getAttribute(Av.SRC))?t:void 0}set src(e){e?this.setAttribute(Av.SRC,e):this.removeAttribute(Av.SRC)}get poster(){var e;let t=this.getAttribute(Av.POSTER);if(null!=t)return t;let{tokens:i}=this;return i.playback&&!i.thumbnail?void T1("Missing expected thumbnail token. No poster image will be shown"):this.playbackId&&!this.audio?((e,{token:t,customDomain:i=Tz,thumbnailTime:r,programTime:a}={})=>{var s;let n=null==t?r:void 0,{aud:o}=null!=(s=lP(t))?s:{};if(!(t&&"t"!==o))return`https://image.${i}/${e}/thumbnail.webp${TW({token:t,time:n,program_time:a})}`})(this.playbackId,{customDomain:this.customDomain,thumbnailTime:null!=(e=this.thumbnailTime)?e:this.startTime,programTime:this.programStartTime,token:i.thumbnail}):void 0}set poster(e){e||""===e?this.setAttribute(Av.POSTER,e):this.removeAttribute(Av.POSTER)}get storyboardSrc(){var e;return null!=(e=this.getAttribute(Ay.STORYBOARD_SRC))?e:void 0}set storyboardSrc(e){e?this.setAttribute(Ay.STORYBOARD_SRC,e):this.removeAttribute(Ay.STORYBOARD_SRC)}get storyboard(){let{tokens:e}=this;return this.storyboardSrc&&!e.storyboard?this.storyboardSrc:this.audio||!this.playbackId||!this.streamType||[lv,ly].includes(this.streamType)||e.playback&&!e.storyboard?void 0:((e,{token:t,customDomain:i=Tz,programStartTime:r,programEndTime:a}={})=>{var s;let{aud:n}=null!=(s=lP(t))?s:{};if(!(t&&"s"!==n))return`https://image.${i}/${e}/storyboard.vtt${TW({token:t,format:"webp",program_start_time:r,program_end_time:a})}`})(this.playbackId,{customDomain:this.customDomain,token:e.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(Ay.AUDIO)}set audio(e){e?this.setAttribute(Ay.AUDIO,""):this.removeAttribute(Ay.AUDIO)}get hotkeys(){return vR(this,AL)}get nohotkeys(){return this.hasAttribute(Ay.NOHOTKEYS)}set nohotkeys(e){e?this.setAttribute(Ay.NOHOTKEYS,""):this.removeAttribute(Ay.NOHOTKEYS)}get thumbnailTime(){return TG(this.getAttribute(Ay.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(Ay.THUMBNAIL_TIME,`${e}`)}get videoTitle(){var e,t;return null!=(t=null!=(e=this.getAttribute(Ay.VIDEO_TITLE))?e:this.getAttribute(Ay.TITLE))?t:""}set videoTitle(e){e!==this.videoTitle&&(e?this.setAttribute(Ay.VIDEO_TITLE,e):this.removeAttribute(Ay.VIDEO_TITLE))}get placeholder(){var e;return null!=(e=AW(this,Ay.PLACEHOLDER))?e:""}set placeholder(e){this.setAttribute(Ay.PLACEHOLDER,`${e}`)}get primaryColor(){var e,t;let i=this.getAttribute(Ay.PRIMARY_COLOR);if(null!=i||this.mediaTheme&&(i=null==(t=null==(e=TB.getComputedStyle(this.mediaTheme))?void 0:e.getPropertyValue("--_primary-color"))?void 0:t.trim()))return i}set primaryColor(e){this.setAttribute(Ay.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var e,t;let i=this.getAttribute(Ay.SECONDARY_COLOR);if(null!=i||this.mediaTheme&&(i=null==(t=null==(e=TB.getComputedStyle(this.mediaTheme))?void 0:e.getPropertyValue("--_secondary-color"))?void 0:t.trim()))return i}set secondaryColor(e){this.setAttribute(Ay.SECONDARY_COLOR,`${e}`)}get accentColor(){var e,t;let i=this.getAttribute(Ay.ACCENT_COLOR);if(null!=i||this.mediaTheme&&(i=null==(t=null==(e=TB.getComputedStyle(this.mediaTheme))?void 0:e.getPropertyValue("--_accent-color"))?void 0:t.trim()))return i}set accentColor(e){this.setAttribute(Ay.ACCENT_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(Ay.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(Ay.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(Ay.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(Ay.PLAYBACK_RATES))return this.getAttribute(Ay.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,t)=>
3281e-t)}set playbackRates(e){e?this.setAttribute(Ay.PLAYBACK_RATES,e.join(" ")):this.removeAttribute(Ay.PLAYBACK_RATES)}get forwardSeekOffset(){var e;return null!=(e=TG(this.getAttribute(Ay.FORWARD_SEEK_OFFSET)))?e:10}set forwardSeekOffset(e){this.setAttribute(Ay.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return null!=(e=TG(this.getAttribute(Ay.BACKWARD_SEEK_OFFSET)))?e:10}set backwardSeekOffset(e){this.setAttribute(Ay.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(Ay.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(Ay.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(Ay.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return TG(this.getAttribute(Ay.DEFAULT_DURATION))}set defaultDuration(e){null==e?this.removeAttribute(Ay.DEFAULT_DURATION):this.setAttribute(Ay.DEFAULT_DURATION,`${e}`)}get playerInitTime(){return this.hasAttribute(u_.PLAYER_INIT_TIME)?TG(this.getAttribute(u_.PLAYER_INIT_TIME)):vR(this,AA)}set playerInitTime(e){e!=this.playerInitTime&&(null==e?this.removeAttribute(u_.PLAYER_INIT_TIME):this.setAttribute(u_.PLAYER_INIT_TIME,`${+e}`))}get playerSoftwareName(){var e;return null!=(e=this.getAttribute(u_.PLAYER_SOFTWARE_NAME))?e:A$}get playerSoftwareVersion(){var e;return null!=(e=this.getAttribute(u_.PLAYER_SOFTWARE_VERSION))?e:TX}get beaconCollectionDomain(){var e;return null!=(e=this.getAttribute(u_.BEACON_COLLECTION_DOMAIN))?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(u_.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(u_.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return null!=(e=this.getAttribute(u_.MAX_RESOLUTION))?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(u_.MAX_RESOLUTION,e):this.removeAttribute(u_.MAX_RESOLUTION))}get minResolution(){var e;return null!=(e=this.getAttribute(u_.MIN_RESOLUTION))?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(u_.MIN_RESOLUTION,e):this.removeAttribute(u_.MIN_RESOLUTION))}get maxAutoResolution(){var e;return null!=(e=this.getAttribute(u_.MAX_AUTO_RESOLUTION))?e:void 0}set maxAutoResolution(e){null==e?this.removeAttribute(u_.MAX_AUTO_RESOLUTION):this.setAttribute(u_.MAX_AUTO_RESOLUTION,e)}get renditionOrder(){var e;return null!=(e=this.getAttribute(u_.RENDITION_ORDER))?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(u_.RENDITION_ORDER,e):this.removeAttribute(u_.RENDITION_ORDER))}get programStartTime(){return TG(this.getAttribute(u_.PROGRAM_START_TIME))}set programStartTime(e){null==e?this.removeAttribute(u_.PROGRAM_START_TIME):this.setAttribute(u_.PROGRAM_START_TIME,`${e}`)}get programEndTime(){return TG(this.getAttribute(u_.PROGRAM_END_TIME))}set programEndTime(e){null==e?this.removeAttribute(u_.PROGRAM_END_TIME):this.setAttribute(u_.PROGRAM_END_TIME,`${e}`)}get assetStartTime(){return TG(this.getAttribute(u_.ASSET_START_TIME))}set assetStartTime(e){null==e?this.removeAttribute(u_.ASSET_START_TIME):this.setAttribute(u_.ASSET_START_TIME,`${e}`)}get assetEndTime(){return TG(this.getAttribute(u_.ASSET_END_TIME))}set assetEndTime(e){null==e?this.removeAttribute(u_.ASSET_END_TIME):this.setAttribute(u_.ASSET_END_TIME,`${e}`)}get extraSourceParams(){return this.hasAttribute(Ay.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(Ay.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,[t,i])=>(e[t]=i,e),{}):AV}set extraSourceParams(e){null==e?this.removeAttribute(Ay.EXTRA_SOURCE_PARAMS):this.setAttribute(Ay.EXTRA_SOURCE_PARAMS,new URLSearchParams(e).toString())}get customDomain(){var e;return null!=(e=this.getAttribute(u_.CUSTOM_DOMAIN))?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(u_.CUSTOM_DOMAIN,e):this.removeAttribute(u_.CUSTOM_DOMAIN))}get envKey(){var e;return null!=(e=AW(this,u_.ENV_KEY))?e:void 0}set envKey(e){this.setAttribute(u_.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute(Ay.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(Ay.NO_VOLUME_PREF,""):this.removeAttribute(Ay.NO_VOLUME_PREF)}get noMutedPref(){return this.hasAttribute(Ay.NO_MUTED_PREF)}set noMutedPref(e){e?this.setAttribute(Ay.NO_MUTED_PREF,""):this.removeAttribute(Ay.NO_MUTED_PREF)}get debug(){return null!=AW(this,u_.DEBUG)}set debug(e){e?this.setAttribute(u_.DEBUG,""):this.removeAttribute(u_.DEBUG)}get disableTracking(){return null!=AW(this,u_.DISABLE_TRACKING)}set disableTracking(e){this.toggleAttribute(u_.DISABLE_TRACKING,!!e)}get disableCookies(){return null!=AW(this,u_.DISABLE_COOKIES)}set disableCookies(e){e?this.setAttribute(u_.DISABLE_COOKIES,""):this.removeAttribute(u_.DISABLE_COOKIES)}get streamType(){var e,t,i;return null!=(i=null!=(t=this.getAttribute(u_.STREAM_TYPE))?t:null==(e=this.media)?void 0:e.streamType)?i:ly}set streamType(e){this.setAttribute(u_.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,t,i;return null!=(i=null!=(t=this.getAttribute(Ay.DEFAULT_STREAM_TYPE))?t:null==(e=this.mediaController)?void 0:e.getAttribute(Ay.DEFAULT_STREAM_TYPE))?i:lg}set defaultStreamType(e){e?this.setAttribute(Ay.DEFAULT_STREAM_TYPE,e):this.removeAttribute(Ay.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,t;return this.hasAttribute(Ay.TARGET_LIVE_WINDOW)?+this.getAttribute(Ay.TARGET_LIVE_WINDOW):null!=(t=null==(e=this.media)?void 0:e.targetLiveWindow)?t:NaN}
3281set targetLiveWindow(e){e==this.targetLiveWindow||Number.isNaN(e)&&Number.isNaN(this.targetLiveWindow)||(null==e?this.removeAttribute(Ay.TARGET_LIVE_WINDOW):this.setAttribute(Ay.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return null==(e=this.media)?void 0:e.liveEdgeStart}get startTime(){return TG(AW(this,u_.START_TIME))}set startTime(e){this.setAttribute(u_.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(u_.PREFER_PLAYBACK);if("mse"===e||e===lE)return e}set preferPlayback(e){e!==this.preferPlayback&&("mse"===e||e===lE?this.setAttribute(u_.PREFER_PLAYBACK,e):this.removeAttribute(u_.PREFER_PLAYBACK))}get metadata(){var e;return null==(e=this.media)?void 0:e.metadata}set metadata(e){(vD(this,AR,AI).call(this),this.media)?this.media.metadata={...AT(this),...e}:T2("underlying media element missing when trying to set metadata. metadata will not be set.")}get _hlsConfig(){var e;return null==(e=this.media)?void 0:e._hlsConfig}set _hlsConfig(e){(vD(this,AR,AI).call(this),this.media)?this.media._hlsConfig=e:T2("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.")}async addCuePoints(e){var t;return(vD(this,AR,AI).call(this),this.media)?null==(t=this.media)?void 0:t.addCuePoints(e):void T2("underlying media element missing when trying to addCuePoints. cuePoints will not be added.")}get activeCuePoint(){var e;return null==(e=this.media)?void 0:e.activeCuePoint}get cuePoints(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.cuePoints)?t:[]}addChapters(e){var t;return(vD(this,AR,AI).call(this),this.media)?null==(t=this.media)?void 0:t.addChapters(e):void T2("underlying media element missing when trying to addChapters. chapters will not be added.")}get activeChapter(){var e;return null==(e=this.media)?void 0:e.activeChapter}get chapters(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.chapters)?t:[]}getStartDate(){var e;return null==(e=this.media)?void 0:e.getStartDate()}get currentPdt(){var e;return null==(e=this.media)?void 0:e.currentPdt}get tokens(){let e=this.getAttribute(Ay.PLAYBACK_TOKEN),t=this.getAttribute(Ay.DRM_TOKEN),i=this.getAttribute(Ay.THUMBNAIL_TOKEN),r=this.getAttribute(Ay.STORYBOARD_TOKEN);return{...vR(this,AS),...null!=e?{playback:e}:{},...null!=t?{drm:t}:{},...null!=i?{thumbnail:i}:{},...null!=r?{storyboard:r}:{}}}set tokens(e){vC(this,AS,null!=e?e:{})}get playbackToken(){var e;return null!=(e=this.getAttribute(Ay.PLAYBACK_TOKEN))?e:void 0}set playbackToken(e){this.setAttribute(Ay.PLAYBACK_TOKEN,`${e}`)}get drmToken(){var e;return null!=(e=this.getAttribute(Ay.DRM_TOKEN))?e:void 0}set drmToken(e){this.setAttribute(Ay.DRM_TOKEN,`${e}`)}get thumbnailToken(){var e;return null!=(e=this.getAttribute(Ay.THUMBNAIL_TOKEN))?e:void 0}set thumbnailToken(e){this.setAttribute(Ay.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return null!=(e=this.getAttribute(Ay.STORYBOARD_TOKEN))?e:void 0}set storyboardToken(e){this.setAttribute(Ay.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,t,i,r){var a;let s=null==(a=this.media)?void 0:a.nativeEl;if(s)return l$(s,e,t,i,r)}removeTextTrack(e){var t;let i=null==(t=this.media)?void 0:t.nativeEl;if(i){let t;return void(null==(t=Array.prototype.find.call(i.querySelectorAll("track"),t=>t.track===e))||t.remove())}}get textTracks(){var e;return null==(e=this.media)?void 0:e.textTracks}get castReceiver(){var e;return null!=(e=this.getAttribute(Ay.CAST_RECEIVER))?e:void 0}set castReceiver(e){e!==this.castReceiver&&(e?this.setAttribute(Ay.CAST_RECEIVER,e):this.removeAttribute(Ay.CAST_RECEIVER))}get castCustomData(){var e;return null==(e=this.media)?void 0:e.castCustomData}set castCustomData(e){this.media?this.media.castCustomData=e:T2("underlying media element missing when trying to set castCustomData. castCustomData will not be set.")}get noTooltips(){return this.hasAttribute(Ay.NO_TOOLTIPS)}set noTooltips(e){e?this.setAttribute(Ay.NO_TOOLTIPS,""):this.removeAttribute(Ay.NO_TOOLTIPS)}get proudlyDisplayMuxBadge(){return this.hasAttribute(Ay.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(e){e?this.setAttribute(Ay.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(Ay.PROUDLY_DISPLAY_MUX_BADGE)}get capRenditionToPlayerSize(){var e;return null==(e=this.media)?void 0:e.capRenditionToPlayerSize}set capRenditionToPlayerSize(e){this.media?this.media.capRenditionToPlayerSize=e:T2("underlying media element missing when trying to set capRenditionToPlayerSize")}};function AW(e,t){return e.media?e.media.getAttribute(t):e.getAttribute(t)}AA=new WeakMap,A_=new WeakMap,AS=new WeakMap,Ak=new WeakMap,AL=new WeakMap,Aw=new WeakMap,AR=new WeakSet,AI=function(){var e,t,i,r;if(!vR(this,A_)){vC(this,A_,!0),vD(this,AR,Ax).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof TB.HTMLElement))throw""}catch{T2("<media-theme> failed to upgrade!")}try{customElements.upgrade(this.media)}catch{T2("underlying media element failed to upgrade!")}
3281try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof mN))throw""}catch{T2("<media-controller> failed to upgrade!")}vD(this,AR,AP).call(this),vD(this,AR,AM).call(this),vD(this,AR,AO).call(this),vC(this,Ak,null==(t=null==(e=this.mediaController)?void 0:e.hasAttribute(cC))||t),vD(this,AR,AN).call(this),null==(i=this.media)||i.addEventListener("streamtypechange",()=>vD(this,AR,Ax).call(this)),null==(r=this.media)||r.addEventListener("loadstart",()=>vD(this,AR,Ax).call(this))}},AC=function(){var e,t;try{null==(e=null==window?void 0:window.CSS)||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),null==(t=null==window?void 0:window.CSS)||t.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},AD=function(e){Object.assign(vR(this,Aw),e),vD(this,AR,Ax).call(this)},Ax=function(e={}){var t,i,r,a,s,n,o,l,d,u,h,c,m,f,g,v,y,E,b,T,A,_,S,k,L,w,R,I,C,D,x,P,M,O,N,U,F,B,$,H,V,G,W,K,q,j,Y,z;let X,Q,Z,J;t={...vR(this,Aw),...e},X={src:!this.playbackId&&this.src,playbackId:this.playbackId,hasSrc:!!this.playbackId||!!this.src||!!this.currentSrc,poster:this.poster,storyboard:(null==(i=this.media)?void 0:i.currentSrc)&&this.storyboard,storyboardSrc:this.getAttribute(Ay.STORYBOARD_SRC),fullscreenElement:this.getAttribute(Ay.FULLSCREEN_ELEMENT),placeholder:this.getAttribute("placeholder"),themeTemplate:function(e){var t,i;let r=e.theme;if(r){let a=null==(i=null==(t=e.getRootNode())?void 0:t.getElementById)?void 0:i.call(t,r);
3281if(a&&a instanceof HTMLTemplateElement)return a;r.startsWith("media-theme-")||(r=`media-theme-${r}`);let s=TB.customElements.get(r);if(null!=s&&s.template)return s.template}}(this),thumbnailTime:!this.tokens.thumbnail&&this.thumbnailTime,autoplay:this.autoplay,crossOrigin:this.crossOrigin,loop:this.loop,noHotKeys:this.hasAttribute(Ay.NOHOTKEYS),hotKeys:this.getAttribute(Ay.HOTKEYS),muted:this.muted,paused:this.paused,preload:this.preload,envKey:this.envKey,preferCmcd:this.preferCmcd,debug:this.debug,disableTracking:this.disableTracking,disableCookies:this.disableCookies,tokens:this.tokens,beaconCollectionDomain:this.beaconCollectionDomain,maxResolution:this.maxResolution,minResolution:this.minResolution,maxAutoResolution:this.maxAutoResolution,programStartTime:this.programStartTime,programEndTime:this.programEndTime,assetStartTime:this.assetStartTime,assetEndTime:this.assetEndTime,renditionOrder:this.renditionOrder,metadata:this.metadata,playerInitTime:this.playerInitTime,playerSoftwareName:this.playerSoftwareName,playerSoftwareVersion:this.playerSoftwareVersion,startTime:this.startTime,preferPlayback:this.preferPlayback,audio:this.audio,defaultStreamType:this.defaultStreamType,targetLiveWindow:this.getAttribute(u_.TARGET_LIVE_WINDOW),streamType:TQ(this.getAttribute(u_.STREAM_TYPE)),primaryColor:this.getAttribute(Ay.PRIMARY_COLOR),secondaryColor:this.getAttribute(Ay.SECONDARY_COLOR),accentColor:this.getAttribute(Ay.ACCENT_COLOR),forwardSeekOffset:this.forwardSeekOffset,backwardSeekOffset:this.backwardSeekOffset,defaultHiddenCaptions:this.defaultHiddenCaptions,defaultDuration:this.defaultDuration,defaultShowRemainingTime:this.defaultShowRemainingTime,hideDuration:(Q=null==(s=this.mediaController)?void 0:s.querySelector("media-time-display"))&&"none"===getComputedStyle(Q).getPropertyValue("--media-duration-display-display").trim(),playbackRates:this.getAttribute(Ay.PLAYBACK_RATES),customDomain:null!=(r=this.getAttribute(u_.CUSTOM_DOMAIN))?r:void 0,title:this.getAttribute(Ay.TITLE),videoTitle:null!=(a=this.getAttribute(Ay.VIDEO_TITLE))?a:this.getAttribute(Ay.TITLE),novolumepref:this.hasAttribute(Ay.NO_VOLUME_PREF),nomutedpref:this.hasAttribute(Ay.NO_MUTED_PREF),proudlyDisplayMuxBadge:this.hasAttribute(Ay.PROUDLY_DISPLAY_MUX_BADGE),castReceiver:this.castReceiver,disablePseudoEnded:this.hasAttribute(Ay.DISABLE_PSEUDO_ENDED),capRenditionToPlayerSize:this.capRenditionToPlayerSize,...t,extraSourceParams:this.extraSourceParams},n=Al` 3282 <style> 3283 ${(e=>{let{tokens:t}=e;return t.drm?":host(:not([cast-receiver])) { --_cast-button-drm-display: none; }":""})(X)} 3284 ${Ae} 3285 </style> 3286 ${l=X,Al` 3287 <media-theme 3288 template="${l.themeTemplate||!1}" 3289 defaultstreamtype="${null!=(d=l.defaultStreamType)&&d}" 3290 hotkeys="${Z=l.hotKeys?`${l.hotKeys}`:"","live"===TQ(l.streamType)&&(Z+=" noarrowleft noarrowright"),Z||!1}" 3291 nohotkeys="${l.noHotKeys||!l.hasSrc||!1}" 3292 noautoseektolive="${!!(null!=(u=l.streamType)&&u.includes(lv))&&0!==l.targetLiveWindow}" 3293 novolumepref="${l.novolumepref||!1}" 3294 nomutedpref="${l.nomutedpref||!1}" 3295 disabled="${!l.hasSrc||l.isDialogOpen}" 3296 audio="${null!=(h=l.audio)&&h}" 3297 style="${null!=(z={"--media-primary-color":l.primaryColor,"--media-secondary-color":l.secondaryColor,"--media-accent-color":l.accentColor},J="",Object.entries(z).forEach(([e,t])=>{null!=t&&(J+=`${TH(e)}: ${t}; `)}),c=J?J.trim():void 0)&&c}" 3298 defaultsubtitles="${!l.defaultHiddenCaptions}" 3299 forwardseekoffset="${null!=(m=l.forwardSeekOffset)&&m}" 3300 backwardseekoffset="${null!=(f=l.backwardSeekOffset)&&f}" 3301 playbackrates="${null!=(g=l.playbackRates)&&g}" 3302 defaultshowremainingtime="${null!=(v=l.defaultShowRemainingTime)&&v}" 3303 defaultduration="${null!=(y=l.defaultDuration)&&y}" 3304 hideduration="${null!=(E=l.hideDuration)&&E}" 3305 title="${null!=(b=l.title)&&b}" 3306 videotitle="${null!=(T=l.videoTitle)&&T}" 3307 proudlydisplaymuxbadge="${null!=(A=l.proudlyDisplayMuxBadge)&&A}" 3308 exportparts="${Ad}" 3309 onclose="${l.onCloseErrorDialog}" 3310 onfocusin="${l.onFocusInErrorDialog}" 3311 > 3312 <mux-video 3313 slot="media" 3314 inert="${null!=(_=l.noHotKeys)&&_}" 3315 target-live-window="${null!=(S=l.targetLiveWindow)&&S}"
3316 stream-type="${null!=(k=TQ(l.streamType))&&k}" 3317 crossorigin="${null!=(L=l.crossOrigin)?L:""}" 3318 playsinline 3319 autoplay="${null!=(w=l.autoplay)&&w}" 3320 muted="${null!=(R=l.muted)&&R}" 3321 loop="${null!=(I=l.loop)&&I}" 3322 preload="${null!=(C=l.preload)&&C}" 3323 debug="${null!=(D=l.debug)&&D}" 3324 prefer-cmcd="${null!=(x=l.preferCmcd)&&x}" 3325 disable-tracking="${null!=(P=l.disableTracking)&&P}" 3326 disable-cookies="${null!=(M=l.disableCookies)&&M}" 3327 prefer-playback="${null!=(O=l.preferPlayback)&&O}" 3328 start-time="${null!=l.startTime&&l.startTime}" 3329 beacon-collection-domain="${null!=(N=l.beaconCollectionDomain)&&N}" 3330 player-init-time="${null!=(U=l.playerInitTime)&&U}" 3331 player-software-name="${null!=(F=l.playerSoftwareName)&&F}" 3332 player-software-version="${null!=(B=l.playerSoftwareVersion)&&B}" 3333 env-key="${null!=($=l.envKey)&&$}" 3334 custom-domain="${null!=(H=l.customDomain)&&H}" 3335 src="${l.src?l.src:!!l.playbackId&&dC(l)}" 3336 cast-src="${l.src?l.src:!!l.playbackId&&dC(l)}" 3337 cast-receiver="${null!=(V=l.castReceiver)&&V}" 3338 drm-token="${null!=(W=null==(G=l.tokens)?void 0:G.drm)&&W}" 3339 exportparts="video" 3340 disable-pseudo-ended="${null!=(K=l.disablePseudoEnded)&&K}" 3341 max-auto-resolution="${null!=(q=l.maxAutoResolution)&&q}" 3342 cap-rendition-to-player-size="${null!=(j=l.capRenditionToPlayerSize)&&j}" 3343 > 3344 ${l.storyboard?Al`<track label="thumbnails" default kind="metadata" src="${l.storyboard}" />`:Al``} 3345 <slot></slot> 3346 </mux-video> 3347 <slot name="poster" slot="poster"> 3348 <media-poster-image 3349 part="poster" 3350 exportparts="poster, img" 3351 src="${!!l.poster&&l.poster}" 3352 placeholdersrc="${null!=(Y=l.placeholder)&&Y}" 3353 ></media-poster-image> 3354 </slot> 3355 </media-theme> 3356`} 3357`,o=this.shadowRoot,n.renderInto(o)},AP=function(){let e=e=>{var t,i;if(!(null!=e&&e.startsWith("theme-")))return;let r=e.replace(/^theme-/,"");if(AE.includes(r))return;let a=this.getAttribute(e);null!=a?null==(t=this.mediaTheme)||t.setAttribute(r,a):null==(i=this.mediaTheme)||i.removeAttribute(r)};new MutationObserver(t=>{for(let{attributeName:i}of t)e(i)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},AM=function(){let e=e=>{var t;let i=null==(t=this.media)?void 0:t.error;if(!(i instanceof lm)){let{message:e,code:t}=null!=i?i:{};i=new lm(e,t)}if(!(null!=i&&i.fatal)){T1(i),i.data&&T1(`${i.name} data:`,i.data);return}let r=Ah(i,!1);r.message&&T3(r),T2(i),i.data&&T2(`${i.name} data:`,i.data),vD(this,AR,AD).call(this,{isDialogOpen:!0})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(e={})=>{var t,i,r;if(!((null==(t=this.media)?void 0:t.error)instanceof lm))return e;let a=Ah(null==(i=this.media)?void 0:i.error,!1);return{player_error_code:null==(r=this.media)?void 0:r.error.code,player_error_message:a.message?String(a.message):e.player_error_message,player_error_context:a.context?String(a.context):e.player_error_context}})},AO=function(){var e,t,i,r;let a=()=>vD(this,AR,Ax).call(this);null==(t=null==(e=this.media)?void 0:e.textTracks)||t.addEventListener("addtrack",a),null==(r=null==(i=this.media)?void 0:i.textTracks)||r.addEventListener("removetrack",a)},AN=function(){var e,t;if(!/Firefox/i.test(navigator.userAgent))return;let i,r=new WeakMap,a=()=>this.streamType===lv&&!this.secondaryColor&&this.offsetWidth>=800,s=(e,t,i=!1)=>{a()||Array.from(e&&e.activeCues||[]).forEach(e=>{if(!(!e.snapToLines||e.line<-5||e.line>=0&&e.line<10))if(!t||this.paused){let t=e.text.split(` 3358`).length,a=-3;this.streamType===lv&&(a=-2);let s=a-t;if(e.line===s&&!i)return;r.has(e)||r.set(e,e.line),e.line=s}else setTimeout(()=>{e.line=r.get(e)||"auto"},500)})},n=()=>{var e,t;s(i,null!=(t=null==(e=this.mediaController)?void 0:e.hasAttribute(cC))&&t)},o=()=>{var e,t;let r=Array.from((null==(t=null==(e=this.mediaController)?void 0:e.media)?void 0:t.textTracks)||[]).filter(e=>["subtitles","captions"].includes(e.kind)&&"showing"===e.mode)[0];r!==i&&(null==i||i.removeEventListener("cuechange",n)),null==(i=r)||i.addEventListener("cuechange",n),s(i,vR(this,Ak))};o(),null==(e=this.textTracks)||e.addEventListener("change",o),null==(t=this.textTracks)||t.addEventListener("addtrack",o),this.addEventListener("userinactivechange",()=>{var e,t;let r=null==(t=null==(e=this.mediaController)?void 0:e.hasAttribute(cC))||t;vR(this,Ak)!==r&&(vC(this,Ak,r),s(i,vR(this,Ak)))})},e.s(["default",()=>AG,"getVideoAttribute",()=>AW,"playerSoftwareName",()=>A$,"playerSoftwareVersion",()=>TX],6552);var AK=e=>{throw TypeError(e)},Aq=(e,t,i)=>t.has(e)||AK("Cannot "+i),Aj=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};"u"<typeof DocumentFragment&&(globalThis.DocumentFragment=class extends Aj{});var AY,Az=class extends Aj{},AX=class{constructor(e,t={}){((e,t,i)=>t.has(e)?AK("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i))(this,AY),((e,t,i,r)=>(Aq(e,t,"write to private field"),r?r.call(e,i):t.set(e,i)))(this,AY,null==t?void 0:t.detail)}get detail(){let e,t;return Aq(this,e=AY,"read from private field"),t?t.call(this):e.get(this)}initCustomEvent(){}};AY=new WeakMap;var AQ={document:{createElement:function(e,t){return new Az}},DocumentFragment,customElements:{get(e){},define(e,t,i){},getName:e=>null,upgrade(e){},whenDefined:e=>Promise.resolve(Az)},CustomEvent:AX,EventTarget:Aj,HTMLElement:Az,HTMLVideoElement:class extends Aj{}},AZ="u"<typeof window||void 0===globalThis.customElements,AJ=AZ?AQ:globalThis;AZ&&AQ.document,AJ.customElements.get("mux-player")||(AJ.customElements.define("mux-player",AG),AJ.MuxPlayerElement=AG),e.i(6552);var A0=parseInt(s.default.version)>
3358=19,A1={className:"class",classname:"class",htmlFor:"for",crossOrigin:"crossorigin",viewBox:"viewBox",playsInline:"playsinline",autoPlay:"autoplay",playbackRate:"playbackrate"};function A2(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}var A3=Object.prototype.hasOwnProperty,A4=(e,t,i)=>!((e,t)=>{if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(Array.isArray(e))return!!Array.isArray(t)&&e.length===t.length&&e.some((e,i)=>t[i]===e);let i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(let r=0;r<i.length;r++)if(!A3.call(t,i[r])||!Object.is(e[i[r]],t[i[r]]))return!1;return!0})(t,e[i]),A5=(e,t,i)=>{e[i]=t},A8=(e,t,i,r=A5,a=A4)=>(0,s.useEffect)(()=>{let s=null==i?void 0:i.current;s&&a(s,t,e)&&r(s,t,e)},[null==i?void 0:i.current,t]),A9=(()=>{try{return"3.11.5"}catch{}return"UNKNOWN"})(),A6=(e,t,i)=>(0,s.useEffect)(()=>{let r=null==t?void 0:t.current;if(r&&i)return r.addEventListener(e,i),()=>{r.removeEventListener(e,i)}},[null==t?void 0:t.current,i,e]),A7=s.default.forwardRef(({children:e,...t},i)=>s.default.createElement("mux-player",{suppressHydrationWarning:!0,...((e={})=>{let{ref:t,...i}=e;return Object.entries(i).reduce((e,[t,i])=>{let r=((e,t)=>{if(!(!A0&&"boolean"==typeof t&&!t)){let i,r;if(i=e,null!=(r=A1)&&i in r)return A1[e];if(void 0!==t)return/[A-Z]/.test(e)?e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`):e}})(t,i);if(!r)return e;let a=A0||"boolean"!=typeof i?i:"";return e[r]=a,e},{})})(t),ref:i},e)),_e=s.default.forwardRef((e,t)=>{var i;let r=(0,s.useRef)(null),a=function(...e){return s.useCallback(function(...e){return t=>{let i=!1,r=e.map(e=>{let r=A2(e,t);return i||"function"!=typeof r||(i=!0),r});if(i)return()=>{for(let t=0;t<r.length;t++){let i=r[t];"function"==typeof i?i():A2(e[t],null)}}}}(...e),e)}(r,t),[n]=((e,t)=>{let{onAbort:i,onCanPlay:r,onCanPlayThrough:a,onEmptied:s,onLoadStart:n,onLoadedData:o,onLoadedMetadata:l,onProgress:d,onDurationChange:u,onVolumeChange:h,onRateChange:c,onResize:m,onWaiting:f,onPlay:g,onPlaying:v,onTimeUpdate:y,onPause:E,onSeeking:b,onSeeked:T,onStalled:A,onSuspend:_,onEnded:S,onError:k,onCuePointChange:L,onChapterChange:w,metadata:R,tokens:I,paused:C,playbackId:D,playbackRates:x,currentTime:P,themeProps:M,extraSourceParams:O,castCustomData:N,_hlsConfig:U,...F}=t;return A8("tokens",I,e),A8("playbackId",D,e),A8("playbackRates",x,e),A8("metadata",R,e),A8("extraSourceParams",O,e),A8("_hlsConfig",U,e),A8("themeProps",M,e),A8("castCustomData",N,e),A8("paused",C,e,(e,t)=>{null!=t&&(t?e.pause():e.play())},(e,t,i)=>(!e.hasAttribute("autoplay")||!!e.hasPlayed)&&A4(e,t,i)),A8("currentTime",P,e,(e,t)=>{null!=t&&(e.currentTime=t)}),A6("abort",e,i),A6("canplay",e,r),A6("canplaythrough",e,a),A6("emptied",e,s),A6("loadstart",e,n),A6("loadeddata",e,o),A6("loadedmetadata",e,l),A6("progress",e,d),A6("durationchange",e,u),A6("volumechange",e,h),A6("ratechange",e,c),A6("resize",e,m),A6("waiting",e,f),A6("play",e,g),A6("playing",e,v),A6("timeupdate",e,y),A6("pause",e,E),A6("seeking",e,b),A6("seeked",e,T),A6("stalled",e,A),A6("suspend",e,_),A6("ended",e,S),A6("error",e,k),A6("cuepointchange",e,L),A6("chapterchange",e,w),[F]}
3358)(r,e),[o]=(0,s.useState)(null!=(i=e.playerInitTime)?i:dR());return s.default.createElement(A7,{ref:a,defaultHiddenCaptions:e.defaultHiddenCaptions,playerSoftwareName:"mux-player-react",playerSoftwareVersion:A9,playerInitTime:o,...n})});e.s(["default",()=>_e],68399)},46932,31178,37806,21476,47414,74008,64978,72846,e=>{"use strict";let t,i,r,a,s=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],n=new Set(s),o=(e,t,i)=>i>t?t:i<e?e:i,l={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},d={...l,transform:e=>o(0,1,e)},u={...l,default:1},h=e=>Math.round(1e5*e)/1e5,c=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,m=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,f=(e,t)=>i=>!!("string"==typeof i&&m.test(i)&&i.startsWith(e)||t&&null!=i&&Object.prototype.hasOwnProperty.call(i,t)),g=(e,t,i)=>r=>{if("string"!=typeof r)return r;let[a,s,n,o]=r.match(c);return{[e]:parseFloat(a),[t]:parseFloat(s),[i]:parseFloat(n),alpha:void 0!==o?parseFloat(o):1}},v={...l,transform:e=>Math.round(o(0,255,e))},y={test:f("rgb","red"),parse:g("red","green","blue"),transform:({red:e,green:t,blue:i,alpha:r=1})=>"rgba("+v.transform(e)+", "+v.transform(t)+", "+v.transform(i)+", "+h(d.transform(r))+")"},E={test:f("#"),parse:function(e){let t="",i="",r="",a="";return e.length>5?(t=e.substring(1,3),i=e.substring(3,5),r=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),i=e.substring(2,3),r=e.substring(3,4),a=e.substring(4,5),t+=t,i+=i,r+=r,a+=a),{red:parseInt(t,16),green:parseInt(i,16),blue:parseInt(r,16),alpha:a?parseInt(a,16)/255:1}},transform:y.transform},b=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),T=b("deg"),A=b("%"),_=b("px"),S=b("vh"),k=b("vw"),L={...A,parse:e=>A.parse(e)/100,transform:e=>A.transform(100*e)},w={test:f("hsl","hue"),parse:g("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:i,alpha:r=1})=>"hsla("+Math.round(e)+", "+A.transform(h(t))+", "+A.transform(h(i))+", "+h(d.transform(r))+")"},R={test:e=>y.test(e)||E.test(e)||w.test(e),parse:e=>y.test(e)?y.parse(e):w.test(e)?w.parse(e):E.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?y.transform(e):w.transform(e),getAnimatableNone:e=>{let t=R.parse(e);return t.alpha=0,R.transform(t)}},I=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,C="number",D="color",x=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function P(e){let t=e.toString(),i=[],r={color:[],number:[],var:[]},a=[],s=0,n=t.replace(x,e=>(R.test(e)?(r.color.push(s),a.push(D),i.push(R.parse(e))):e.startsWith("var(")?(r.var.push(s),a.push("var"),i.push(e)):(r.number.push(s),a.push(C),i.push(parseFloat(e))),++s,"${}")).split("${}");return{values:i,split:n,indexes:r,types:a}}function M(e){return P(e).values}function O(e){let{split:t,types:i}=P(e),r=t.length;return e=>{let a="";for(let s=0;s<r;s++)if(a+=t[s],void 0!==e[s]){let t=i[s];t===C?a+=h(e[s]):t===D?a+=R.transform(e[s]):a+=e[s]}return a}}let N=e=>"number"==typeof e?0:R.test(e)?R.getAnimatableNone(e):e,U={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(c)?.length||0)+(e.match(I)?.length||0)>0},parse:M,createTransformer:O,getAnimatableNone:function(e){let t=M(e);return O(e)(t.map(N))}},F=new Set(["brightness","contrast","saturate","opacity"]);function B(e){let[t,i]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;let[r]=i.match(c)||[];if(!r)return e;let a=i.replace(r,""),s=+!!F.has(t);return r!==i&&(s*=100),t+"("+s+a+")"}let $=/\b([a-z-]*)\(.*?\)/gu,H={...U,getAnimatableNone:e=>{let t=e.match($);return t?t.map(B).join(" "):e}},V={...U,getAnimatableNone:e=>{let t=U.parse(e);return U.createTransformer(e)(t.map(e=>"number"==typeof e?0:"object"==typeof e?{...e,alpha:1}:e))}},G={...l,transform:Math.round},W={borderWidth:_,borderTopWidth:_,borderRightWidth:_,borderBottomWidth:_,borderLeftWidth:_,borderRadius:_,borderTopLeftRadius:_,borderTopRightRadius:_,borderBottomRightRadius:_,borderBottomLeftRadius:_,width:_,maxWidth:_,height:_,maxHeight:_,top:_,right:_,bottom:_,left:_,inset:_,insetBlock:_,insetBlockStart:_,insetBlockEnd:_,insetInline:_,insetInlineStart:_,insetInlineEnd:_,padding:_,paddingTop:_,paddingRight:_,paddingBottom:_,paddingLeft:_,paddingBlock:_,paddingBlockStart:_,paddingBlockEnd:_,paddingInline:_,paddingInlineStart:_,paddingInlineEnd:_,margin:_,marginTop:_,marginRight:_,marginBottom:_,marginLeft:_,marginBlock:_,marginBlockStart:_,marginBlockEnd:_,marginInline:_,marginInlineStart:_,marginInlineEnd:_,fontSize:_,backgroundPositionX:_,backgroundPositionY:_,rotate:T,rotateX:T,rotateY:T,rotateZ:T,scale:u,scaleX:u,scaleY:u,scaleZ:u,skew:T,skewX:T,skewY:T,distance:_,translateX:_,translateY:_,translateZ:_,x:_,y:_,z:_,perspective:_,transformPerspective:_,opacity:d,originX:L,originY:L,originZ:_,zIndex:G,fillOpacity:d,strokeOpacity:d,numOctaves:G},K={...W,color:R,backgroundColor:R,outlineColor:R,fill:R,stroke:
3358R,borderColor:R,borderTopColor:R,borderRightColor:R,borderBottomColor:R,borderLeftColor:R,filter:H,WebkitFilter:H,mask:V,WebkitMask:V},q=e=>K[e],j=()=>({translate:0,scale:1,origin:0,originPoint:0}),Y=()=>({x:j(),y:j()}),z=()=>({min:0,max:0}),X=()=>({x:z(),y:z()}),Q=e=>!!(e&&e.getVelocity),Z=new Set(["width","height","top","left","right","bottom",...s]),J=e=>t=>t.test(e),ee=[l,_,A,T,k,S,{test:e=>"auto"===e,parse:e=>e}],et=e=>ee.find(J(e));var ei,er=e.i(47167);let ea=()=>{},es=()=>{};er.default;let en=e=>t=>"string"==typeof t&&t.startsWith(e),eo=en("--"),el=en("var(--"),ed=e=>!!el(e)&&eu.test(e.split("/*")[0].trim()),eu=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function eh(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}let ec=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,em=e=>180*e/Math.PI,ef=e=>eg(em(Math.atan2(e[1],e[0]))),ep={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:ef,rotateZ:ef,skewX:e=>em(Math.atan(e[1])),skewY:e=>em(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},eg=e=>((e%=360)<0&&(e+=360),e),ev=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),ey=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),eE={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ev,scaleY:ey,scale:e=>(ev(e)+ey(e))/2,rotateX:e=>eg(em(Math.atan2(e[6],e[5]))),rotateY:e=>eg(em(Math.atan2(-e[2],e[0]))),rotateZ:ef,rotate:ef,skewX:e=>em(Math.atan(e[4])),skewY:e=>em(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function eb(e){return+!!e.includes("scale")}function eT(e,t){let i,r;if(!e||"none"===e)return eb(t);let a=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(a)i=eE,r=a;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=ep,r=t}if(!r)return eb(t);let s=i[t],n=r[1].split(",").map(eA);return"function"==typeof s?s(n):n[s]}function eA(e){return parseFloat(e.trim())}let e_=e=>e===l||e===_,eS=new Set(["x","y","z"]),ek=s.filter(e=>!eS.has(e)),eL={width:({x:e},{paddingLeft:t="0",paddingRight:i="0"})=>e.max-e.min-parseFloat(t)-parseFloat(i),height:({y:e},{paddingTop:t="0",paddingBottom:i="0"})=>e.max-e.min-parseFloat(t)-parseFloat(i),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>eT(t,"x"),y:(e,{transform:t})=>eT(t,"y")};eL.translateX=eL.x,eL.translateY=eL.y;let ew=e=>e,eR={},eI=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function eC(e,t){let i=!1,r=!0,a={delta:0,timestamp:0,isProcessing:!1},s=()=>i=!0,n=eI.reduce((e,i)=>(e[i]=function(e,t){let i=new Set,r=new Set,a=!1,s=!1,n=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1},l=0;function d(t){n.has(t)&&(u.schedule(t),e()),l++,t(o)}let u={schedule:(e,t=!1,s=!1)=>{let o=s&&a?i:r;return t&&n.add(e),o.has(e)||o.add(e),e},cancel:e=>{r.delete(e),n.delete(e)},process:e=>{if(o=e,a){s=!0;return}a=!0,[i,r]=[r,i],i.forEach(d),t,l=0,i.clear(),a=!1,s&&(s=!1,u.process(e))}};return u}(s,t?i:void 0),e),{}),{setup:o,read:l,resolveKeyframes:d,preUpdate:u,update:h,preRender:c,render:m,postRender:f}=n,g=()=>{let s=eR.useManualTiming?a.timestamp:performance.now();i=!1,eR.useManualTiming||(a.delta=r?1e3/60:Math.max(Math.min(s-a.timestamp,40),1)),a.timestamp=s,a.isProcessing=!0,o.process(a),l.process(a),d.process(a),u.process(a),h.process(a),c.process(a),m.process(a),f.process(a),a.isProcessing=!1,i&&t&&(r=!1,e(g))};return{schedule:eI.reduce((t,s)=>{let o=n[s];return t[s]=(t,s=!1,n=!1)=>(!i&&(i=!0,r=!0,a.isProcessing||e(g)),o.schedule(t,s,n)),t},{}),cancel:e=>{for(let t=0;t<eI.length;t++)n[eI[t]].cancel(e)},state:a,steps:n}}let{schedule:eD,cancel:ex,state:eP,steps:eM}=eC("u">typeof requestAnimationFrame?requestAnimationFrame:ew,!0),eO=new Set,eN=!1,eU=!1,eF=!1;function eB(){if(eU){let e=Array.from(eO).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),i=new Map;t.forEach(e=>{let t,r=(t=[],ek.forEach(i=>{let r=e.getValue(i);void 0!==r&&(t.push([i,r.get()]),r.set(+!!i.startsWith("scale")))}),t);r.length&&(i.set(e,r),e.render())}
3358),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=i.get(e);t&&t.forEach(([t,i])=>{e.getValue(t)?.set(i)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}eU=!1,eN=!1,eO.forEach(e=>e.complete(eF)),eO.clear()}function e$(){eO.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(eU=!0)})}class eH{constructor(e,t,i,r,a,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=i,this.motionValue=r,this.element=a,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(eO.add(this),eN||(eN=!0,eD.read(e$),eD.resolveKeyframes(eB))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:i,motionValue:r}=this;if(null===e[0]){let a=r?.get(),s=e[e.length-1];if(void 0!==a)e[0]=a;else if(i&&t){let r=i.readValue(t,s);null!=r&&(e[0]=r)}void 0===e[0]&&(e[0]=s),r&&void 0===a&&r.set(e[0])}for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),eO.delete(this)}cancel(){"scheduled"===this.state&&(eO.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}let eV=new Set([H,V]);function eG(e,t){let i=q(e);return eV.has(i)||(i=U),i.getAnimatableNone?i.getAnimatableNone(t):void 0}let eW=new Set(["auto","none","0"]);class eK extends eH{constructor(e,t,i,r,a){super(e,t,i,r,a,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:i}=this;if(!t||!t.current)return;super.readKeyframes();for(let i=0;i<e.length;i++){let r=e[i];if("string"==typeof r&&ed(r=r.trim())){let a=function e(t,i,r=1){es(r<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[a,s]=function(e){let t=ec.exec(e);if(!t)return[,];let[,i,r,a]=t;return[`--${i??r}`,a]}(t);if(!a)return;let n=window.getComputedStyle(i).getPropertyValue(a);if(n){let e=n.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)?parseFloat(e):e}return ed(s)?e(s,i,r+1):s}(r,t.current);void 0!==a&&(e[i]=a),i===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Z.has(i)||2!==e.length)return;let[r,a]=e,s=et(r),n=et(a);if(eh(r)!==eh(a)&&eL[i]){this.needsMeasurement=!0;return}if(s!==n)if(e_(s)&&e_(n))for(let t=0;t<e.length;t++){let i=e[t];"string"==typeof i&&(e[t]=parseFloat(i))}else eL[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,i=[];for(let t=0;t<e.length;t++)(null===e[t]||function(e){if("number"==typeof e)return 0===e;if(null===e)return!0;return"none"===e||"0"===e||/^0[^.\s]+$/u.test(e)}(e[t]))&&i.push(t);i.length&&function(e,t,i){let r,a=0;for(;a<e.length&&!r;){let t=e[a];"string"==typeof t&&!eW.has(t)&&P(t).values.length&&(r=e[a]),a++}if(r&&i)for(let a of t)e[a]=eG(i,r)}(e,i,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:i}=this;if(!e||!e.current)return;"height"===i&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=eL[i](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];void 0!==r&&e.getValue(i,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:i}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let a=i.length-1,s=i[a];i[a]=eL[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==s&&void 0===this.finalKeyframe&&(this.finalKeyframe=s),this.removedTransforms?.length&&this.removedTransforms.forEac
3358h(([t,i])=>{e.getValue(t).set(i)}),this.resolveNoneKeyframes()}}let eq=e=>1e3*e;function ej(e,t){-1===e.indexOf(t)&&e.push(t)}function eY(e,t){let i=e.indexOf(t);i>-1&&e.splice(i,1)}class ez{constructor(){this.subscriptions=[]}add(e){return ej(this.subscriptions,e),()=>eY(this.subscriptions,e)}notify(e,t,i){let r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](e,t,i);else for(let a=0;a<r;a++){let r=this.subscriptions[a];r&&r(e,t,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function eX(e){let t;return()=>(void 0===t&&(t=e()),t)}let eQ={};function eZ(e,t){let i=eX(e);return()=>eQ[t]??i()}let eJ=eZ(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),e0=e=>null!==e;function e1(e,{repeat:t,repeatType:i="loop"},r,a=1){let s=e.filter(e0),n=a<0||t&&"loop"!==i&&t%2==1?0:s.length-1;return n&&void 0!==r?r:s[n]}class e2{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}let e3={layout:0,mainThread:0,waapi:0},e4=e=>Array.isArray(e)&&"number"==typeof e[0],e5=eZ(()=>{try{document.createElement("div").animate({opacity:0}
3358,{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),e8=(e,t,i=10)=>{let r="",a=Math.max(Math.round(t/i),2);for(let t=0;t<a;t++)r+=Math.round(1e4*e(t/(a-1)))/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},e9=([e,t,i,r])=>`cubic-bezier(${e}, ${t}, ${i}, ${r})`,e6={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:e9([0,.65,.55,1]),circOut:e9([.55,0,1,.45]),backIn:e9([.31,.01,.66,-.59]),backOut:e9([.33,1.53,.69,.99])};function e7(e){return"function"==typeof e&&"applyToOptions"in e}class te extends e2{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:i,keyframes:r,pseudoElement:a,allowFlatten:s=!1,finalKeyframe:n,onComplete:o}=e;this.isPseudoElement=!!a,this.allowFlatten=s,this.options=e,es("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return e7(e)&&e5()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=function(e,t,i,{delay:r=0,duration:a=300,repeat:s=0,repeatType:n="loop",ease:o="easeOut",times:l}={},d){let u={[t]:i};l&&(u.offset=l);let h=function e(t,i){if(t)return"function"==typeof t?e5()?e8(t,i):"ease-out":e4(t)?e9(t):Array.isArray(t)?t.map(t=>e(t,i)||e6.easeOut):e6[t]}(o,a);Array.isArray(h)&&(u.easing=h);let c={delay:r,duration:a,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:s+1,direction:"reverse"===n?"alternate":"normal"};d&&(c.pseudoElement=d);let m=e.animate(u,c);return m}(t,i,r,l,a),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){let e=e1(r,this.options,n,this.speed);this.updateMotionValue&&this.updateMotionValue(e);i.startsWith("--")?t.style.setProperty(i,e):t.style[i]=e,this.animation.cancel()}o?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=eq(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:i,observe:r}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&eJ())?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),i&&(this.animation.rangeEnd=i),ew):r(this)}}let tt=new Set(["opacity","clipPath","filter","transform"]),{schedule:ti}=eC(queueMicrotask,!1);function tr(){i=void 0}let ta={now:()=>(void 0===i&&ta.set(eP.isProcessing||eR.useManualTiming?eP.timestamp:performance.now()),i),set:e=>{i=e,queueMicrotask(tr)}};class ts{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=ta.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=ta.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new ez);let i=this.events[e].add(t);return"change"===e?()=>{i(),eD.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,i){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return t&&t.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e;let t=ta.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;let i=Math.min(this.updatedAt-this.prevUpdatedAt,30);return e=parseFloat(this.current)-parseFloat(this.prevFrameValue),i?1e3/i*e:0}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function tn(e,t){return new ts(e,t)}let to=[...ee,R,U],tl=new WeakMap;function td(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function tu(e){return"string"==typeof e||Array.isArray(e)}let th=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],tc=["initial",...th];function tm(e){return td(e.animate)||tc.some(t=>tu(e[t]))}function tf(e){return!!(tm(e)||e.variants)}let tp={current:null},tg={current:!1},tv="u">typeof window;function ty(e){let t=[{},{}];
3358return e?.values.forEach((e,i)=>{t[0][i]=e.get(),t[1][i]=e.getVelocity()}),t}function tE(e,t,i,r){if("function"==typeof t){let[a,s]=ty(r);t=t(void 0!==i?i:e.custom,a,s)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[a,s]=ty(r);t=t(void 0!==i?i:e.custom,a,s)}return t}let tb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],tT={};class tA{scrapeMotionValuesFromProps(e,t,i){return{}}constructor({parent:e,props:t,presenceContext:i,reducedMotionConfig:r,skipAnimations:a,blockInitialAnimation:s,visualState:n},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=eH,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=ta.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,eD.render(this.render,!1,!0))};const{latestValues:l,renderState:d}=n;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=d,this.parent=e,this.props=t,this.presenceContext=i,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=a,this.options=o,this.blockInitialAnimation=!!s,this.isControllingVariants=tm(t),this.isVariantNode=tf(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:u,...h}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in h){const t=h[e];void 0!==l[e]&&Q(t)&&t.set(l[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,tl.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(tg.current||function(){if(tg.current=!0,tv)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>tp.current=e.matches;e.addEventListener("change",t),t()}else tp.current=!1}(),this.shouldReduceMotion=tp.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){for(let e in this.projection&&this.projection.unmount(),ex(this.notifyUpdate),ex(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){let i;if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&tt.has(e)&&this.current instanceof HTMLElement){let{factory:i,keyframes:r,times:a,ease:s,duration:n}=t.accelerate,o=new te({element:this.current,name:e,keyframes:r,times:a,ease:s,duration:eq(n)}),l=i(o);this.valueSubscriptions.set(e,()=>{l(),o.cancel()});return}let r=n.has(e);r&&this.onBindTransform&&this.onBindTransform();let a=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&eD.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});"u">typeof window&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{a(),i&&i(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in tT){let t=tT[e];if(!t)continue;let{isEnabled:i,Feature:r}=t;if(!this.features[e]&&r&&i(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];
3358t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):X()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<tb.length;t++){let i=tb[t];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);let r=e["on"+i];r&&(this.propEventSubscriptions[i]=this.on(i,r))}this.prevMotionValues=function(e,t,i){for(let r in t){let a=t[r],s=i[r];if(Q(a))e.addValue(r,a);else if(Q(s))e.addValue(r,tn(a,{owner:e}));else if(s!==a)if(e.hasValue(r)){let t=e.getValue(r);!0===t.liveStyle?t.jump(a):t.hasAnimated||t.set(a)}else{let t=e.getStaticValue(r);e.addValue(r,tn(void 0!==t?t:a,{owner:e}))}}for(let r in i)void 0===t[r]&&e.removeValue(r);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let i=this.values.get(e);t!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return void 0===i&&void 0!==t&&(i=tn(null===t?void 0:t,{owner:this}),this.addValue(e,i)),i}readValue(e,t){let i=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];if(null!=i){let r,a;if("string"==typeof i&&(r=i,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(r)||(a=i,/^0[^.\s]+$/u.test(a))))i=parseFloat(i);else{let r;r=i,!to.find(J(r))&&U.test(t)&&(i=eG(e,t))}this.setBaseTarget(e,Q(i)?i.get():i)}return Q(i)?i.get():i}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let t,{initial:i}=this.props;if("string"==typeof i||"object"==typeof i){let r=tE(this.props,i,this.presenceContext?.custom);r&&(t=r[e])}if(i&&void 0!==t)return t;let r=this.getBaseTargetFromProps(this.props,e);return void 0===r||Q(r)?void 0!==this.initialValues[e]&&void 0===t?void 0:this.baseTarget[e]:r}on(e,t){return this.events[e]||(this.events[e]=new ez),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){ti.render(this.render)}}class t_ extends tA{constructor(){super(...arguments),this.KeyframeResolver=eK}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){let i=e.style;return i?i[t]:void 0}removeValueFromRenderState(e,{vars:t,style:i}){delete t[e],delete i[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;Q(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}function tS(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}let tk=(e,t)=>t&&"number"==typeof e?t.transform(e):e,tL={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},tw=s.length;function tR(e,t,i){let{style:r,vars:a,transformOrigin:o}=e,l=!1,d=!1;for(let e in t){let i=t[e];if(n.has(e)){l=!0;continue}if(eo(e)){a[e]=i;continue}{let t=tk(i,W[e]);e.startsWith("origin")?(d=!0,o[e]=t):r[e]=t}}if(!t.transform&&(l||i?r.transform=function(e,t,i){let r="",a=!0;for(let n=0;n<tw;n++){let o=s[n],l=e[o];if(void 0===l)continue;let d=!0;if("number"==typeof l)d=l===+!!o.startsWith("scale");else{let e=parseFloat(l);d=o.startsWith("scale")?1===e:0===e}if(!d||i){let e=tk(l,W[o]);if(!d){a=!1;let t=tL[o]||o;r+=`${t}(${e}) `}i&&(t[o]=e)}}return r=r.trim(),i?r=i(t,a?"":r):a&&(r="none"),r}(t,e.transform,i):r.transform&&(r.transform="none")),d){let{originX:e="50%",originY:t="50%",originZ:i=0}=o;r.transformOrigin=`${e} ${t} ${i}`}}let tI={offset:"stroke-dashoffset",array:"stroke-dasharray"},tC={offset:"strokeDashoffset",array:"strokeDasharray"},tD=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function tx(e,{attrX:t,attrY:i,attrScale:r,pathLength:a,pathSpacing:s=1,pathOffset:n=0,...o}
3358,l,d,u){if(tR(e,o,d),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:h,style:c}=e;for(let e of(h.transform&&(c.transform=h.transform,delete h.transform),(c.transform||h.transformOrigin)&&(c.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),c.transform&&(c.transformBox=u?.transformBox??"fill-box",delete h.transformBox),tD))void 0!==h[e]&&(c[e]=h[e],delete h[e]);void 0!==t&&(h.x=t),void 0!==i&&(h.y=i),void 0!==r&&(h.scale=r),void 0!==a&&function(e,t,i=1,r=0,a=!0){e.pathLength=1;let s=a?tI:tC;e[s.offset]=`${-r}`,e[s.array]=`${t} ${i}`}(h,a,s,n,!1)}let tP=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),tM=e=>"string"==typeof e&&"svg"===e.toLowerCase();function tO(e,{style:t,vars:i},r,a){let s,n=e.style;for(s in t)n[s]=t[s];for(s in a?.applyProjectionStyles(n,r),i)n.setProperty(s,i[s])}function tN(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let tU={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e)if(!_.test(e))return e;else e=parseFloat(e);let i=tN(e,t.target.x),r=tN(e,t.target.y);return`${i}% ${r}%`}},tF=(e,t,i)=>e+(t-e)*i,tB={borderRadius:{...tU,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:tU,borderTopRightRadius:tU,borderBottomLeftRadius:tU,borderBottomRightRadius:tU,boxShadow:{correct:(e,{treeScale:t,projectionDelta:i})=>{let r=U.parse(e);if(r.length>5)return e;let a=U.createTransformer(e),s=+("number"!=typeof r[0]),n=i.x.scale*t.x,o=i.y.scale*t.y;r[0+s]/=n,r[1+s]/=o;let l=tF(n,o,.5);return"number"==typeof r[2+s]&&(r[2+s]/=l),"number"==typeof r[3+s]&&(r[3+s]/=l),a(r)}}};function t$(e,{layout:t,layoutId:i}){return n.has(e)||e.startsWith("origin")||(t||void 0!==i)&&(!!tB[e]||"opacity"===e)}function tH(e,t,i){let r=e.style,a=t?.style,s={};if(!r)return s;for(let t in r)(Q(r[t])||a&&Q(a[t])||t$(t,e)||i?.getValue(t)?.liveStyle!==void 0)&&(s[t]=r[t]);return s}function tV(e,t,i){let r=tH(e,t,i);for(let i in e)(Q(e[i])||Q(t[i]))&&(r[-1!==s.indexOf(i)?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i]=e[i]);return r}class tG extends t_{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=X}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(n.has(t)){let e=q(t);return e&&e.default||0}return t=tP.has(t)?t:tS(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,i){return tV(e,t,i)}build(e,t,i){tx(e,t,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(e,t,i,r){for(let i in tO(e,t,void 0,r),t.attrs)e.setAttribute(tP.has(i)?i:tS(i),t.attrs[i])}mount(e){this.isSVGTag=tM(e.tagName),super.mount(e)}}function tW({top:e,left:t,right:i,bottom:r}){return{x:{min:t,max:i},y:{min:e,max:r}}}function tK(e){return void 0===e||1===e}function tq({scale:e,scaleX:t,scaleY:i}){return!tK(e)||!tK(t)||!tK(i)}function tj(e){return tq(e)||tY(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function tY(e){var t,i;return(t=e.x)&&"0%"!==t||(i=e.y)&&"0%"!==i}function tz(e,t,i,r,a){return void 0!==a&&(e=r+a*(e-r)),r+i*(e-r)+t}function tX(e,t=0,i=1,r,a){e.min=tz(e.min,t,i,r,a),e.max=tz(e.max,t,i,r,a)}function tQ(e,{x:t,y:i}){tX(e.x,t.translate,t.scale,t.originPoint),tX(e.y,i.translate,i.scale,i.originPoint)}function tZ(e,t){e.min=e.min+t,e.max=e.max+t}function tJ(e,t,i,r,a=.5){let s=tF(e.min,e.max,a);tX(e,t,i,s,r)}function t0(e,t){return"string"==typeof e?parseFloat(e)/100*(t.max-t.min):e}function t1(e,t){tJ(e.x,t0(t.x,e.x),t.scaleX,t.scale,t.originX),tJ(e.y,t0(t.y,e.y),t.scaleY,t.scale,t.originY)}function t2(e,t){return tW(function(e,t){if(!t)return e;let i=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:i.y,left:i.x,bottom:r.y,right:r.x}}(e.getBoundingClientRect(),t))}class t3 extends t_{constructor(){super(...arguments),this.type="html",this.renderInstance=tO}readValueFromInstance(e,t){if(n.has(t))return this.projection?.isProjecting?eb(t):((e,t)=>{let{transform:i="none"}=getComputedStyle(e);return eT(i,t)})(e,t);{let i=window.getComputedStyle(e),r=(eo(t)?i.getPropertyValue(t):i[t])||0;return"string"==typeof r?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return t2(e,t)}build(e,t,i){tR(e,t,i.transformTemplate)}scrapeMotionValuesFromProps(e,t,i){return tH(e,t,i)}}var t4=e.i(71645);let t5=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function t8(e){if("string"!=typeof e||e.includes("-"));else if(t5.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}var t9=e.i(43476);let t6=(0,t4.createContext)({});e.s(["LayoutGroupContext",()=>
3358t6],31178);let t7=(0,t4.createContext)({strict:!1}),ie=(0,t4.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});e.s(["MotionConfigContext",()=>ie],37806);let it=(0,t4.createContext)({});function ii(e){return Array.isArray(e)?e.join(" "):e}let ir=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function ia(e,t,i){for(let r in t)Q(t[r])||t$(r,i)||(e[r]=t[r])}let is=()=>({...ir(),attrs:{}}),io=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function il(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||io.has(e)}let id=e=>!il(e);try{ei=(()=>{let e=Error("Cannot find module '@emotion/is-prop-valid'");throw e.code="MODULE_NOT_FOUND",e})().default,"function"==typeof ei&&(id=e=>e.startsWith("on")?!il(e):ei(e))}catch{}function iu(e){return Q(e)?e.get():e}let ih=(0,t4.createContext)(null);function ic(e){let t=(0,t4.useRef)(null);return null===t.current&&(t.current=e()),t.current}e.s(["PresenceContext",()=>ih],21476),e.s(["useConstant",()=>ic],47414);let im=e=>(t,i)=>{let r=(0,t4.useContext)(it),a=(0,t4.useContext)(ih),s=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t},i,r,a){return{latestValues:function(e,t,i,r){let a={},s=r(e,{});for(let e in s)a[e]=iu(s[e]);let{initial:n,animate:o}=e,l=tm(e),d=tf(e);t&&d&&!l&&!1!==e.inherit&&(void 0===n&&(n=t.initial),void 0===o&&(o=t.animate));let u=!!i&&!1===i.initial,h=(u=u||!1===n)?o:n;if(h&&"boolean"!=typeof h&&!td(h)){let t=Array.isArray(h)?h:[h];for(let i=0;i<t.length;i++){let r=tE(e,t[i]);if(r){let{transitionEnd:e,transition:t,...i}=r;for(let e in i){let t=i[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}null!==t&&(a[e]=t)}for(let t in e)a[t]=e[t]}}}return a}(i,r,a,e),renderState:t()}})(e,t,r,a);return i?s():ic(s)},ip=im({scrapeMotionValuesFromProps:tH,createRenderState:ir}),ig=im({scrapeMotionValuesFromProps:tV,createRenderState:is}),iv={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},iy=!1;function iE(){return!function(){if(iy)return;let e={};for(let t in iv)e[t]={isEnabled:e=>iv[t].some(t=>!!e[t])};tT=e,iy=!0}(),tT}let ib=Symbol.for("motionComponentSymbol"),iT="data-"+tS("framerAppearId"),iA=(0,t4.createContext)({});function i_(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}let iS="u">typeof window?t4.useLayoutEffect:t4.useEffect;function ik(e,{forwardMotionProps:t=!1,type:i}={},r,a){r&&function(e){let t=iE();for(let i in e)t[i]={...t[i],...e[i]};tT=t}(r);let s=i?"svg"===i:t8(e),n=s?ig:ip;function o(i,r){var o;let l,d,u,h={...(0,t4.useContext)(ie),...i,layoutId:function({layoutId:e}){let t=(0,t4.useContext)(t6).id;return t&&void 0!==e?t+"-"+e:e}(i)},{isStatic:c}=h,m=function(e){let{initial:t,animate:i}=function(e,t){if(tm(e)){let{initial:t,animate:i}=e;return{initial:!1===t||tu(t)?t:void 0,animate:tu(i)?i:void 0}}return!1!==e.inherit?t:{}}(e,(0,t4.useContext)(it));return(0,t4.useMemo)(()=>({initial:t,animate:i}),[ii(t),ii(i)])}(i),f=n(i,c);if(!c&&"u">typeof window){(0,t4.useContext)(t7).strict;let t=function(e){let{drag:t,layout:i}=iE();if(!t&&!i)return{};let r={...t,...i};return{MeasureLayout:t?.isEnabled(e)||i?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(h);l=t.MeasureLayout,m.visualElement=function(e,t,i,r,a,s){let{visualElement:n}=(0,t4.useContext)(it),o=(0,t4.useContext)(t7),l=(0,t4.useContext)(ih),d=(0,t4.useContext)(ie),u=d.reducedMotion,h=d.skipAnimations,c=(0,t4.useRef)(null),m=(0,t4.useRef)(!1);r=r||o.renderer,!c.current&&r&&(c.current=r(e,{visualState:t,parent:n,props:i,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:u,skipAnimations:h,isSVG:s}),m.current&&c.current&&(c.current.manuallyAnimateOnMount=!0));let f=c.current,g=(0,t4.useContext)(iA);f&&!f.projection&&a&&("html"===f.type||"svg"===f.type)&&function(e,t,i,r){let{layoutId:a,layout:s,drag:n,dragConstraints:o,layoutScroll:l,layoutRoot:d,layoutCrossfade:u}=t;e.projection=new i(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:a,layout:s,alwaysMeasureLayout:!!n||o&&i_(o),visualElement:e,animationType:"string"==typeof s?s:"both",initialPromotionConfig:r,crossfade:u,layoutScroll:l,layoutRoot:d})}(c.current,i,a,g);let v=(0,t4.useRef)(!1);(0,t4.useInsertionEffect)(()=>{f&&v.current&&f.update(i,l)});let y=i[iT],E=(0,t4.useRef)(!!y&&"u">typeof window&&!window.MotionHandoffIsComplete?.(y)&&window.MotionHasOptimisedAnimation?.(y));return iS(()=>{m.current=!0,f&&(v.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),f.scheduleRenderMicrotask(),E.current&&f.animationState&&f.animationState.animateChanges())}),(0,t4.useEffect)(()=>{f&&(!E.current&&f.animationState&&f.animationState.animateChanges(),E.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(y)}),E.current=!1),f.enteringChildren=void 0)}),f}(e,f,h,a,t.ProjectionNode,s)}return(0,t9.jsxs)(it.Provider,{value:m,children:[l&&m.visualElement?(0,t9.jsx)(l,{visualElement:m.visualElement,...h}):null,function(e,t,i,{latestValues:r},a,s=!1,n){let o=(n??t8(e)?function(e,t,i,r){let a=(0,t4.useMemo)(()=>{let i=is();return tx(i,t,tM(r),e.transformTemplate,e.style),{...i.attrs,style:{...i.style}}},[t]);if(e.style){let t={};ia(t,e.style,e),a.style={...t,...a.style}}return a}:function(e,t){let i,r,a={},s=(i=e.style||{},ia(r={},i,e),Object.assign(r,function({transformTemplate:e},t){return(0,t4.useMemo)(()=>{let i=ir();return tR(i,t,e),Object.assign({},i.vars,i.style)},[t])}(e,t)),r);return e.drag&&!1!==e.dragListener&&(a.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}
3358`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(a.tabIndex=0),a.style=s,a})(t,r,a,e),l=function(e,t,i){let r={};for(let a in e)("values"!==a||"object"!=typeof e.values)&&(id(a)||!0===i&&il(a)||!t&&!il(a)||e.draggable&&a.startsWith("onDrag"))&&(r[a]=e[a]);return r}(t,"string"==typeof e,s),d=e!==t4.Fragment?{...l,...o,ref:i}:{},{children:u}=t,h=(0,t4.useMemo)(()=>Q(u)?u.get():u,[u]);return(0,t4.createElement)(e,{...d,children:h})}(e,i,(o=m.visualElement,d=(0,t4.useRef)(r),(0,t4.useInsertionEffect)(()=>{d.current=r}),u=(0,t4.useRef)(null),(0,t4.useCallback)(e=>{e&&f.onMount?.(e);let t=d.current;if("function"==typeof t)if(e){let i=t(e);"function"==typeof i&&(u.current=i)}else u.current?(u.current(),u.current=null):t(e);else t&&(t.current=e);o&&(e?o.mount(e):o.unmount())},[o])),f,c,t,s)]})}o.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;let l=(0,t4.forwardRef)(o);return l[ib]=e,l}e.s(["useIsomorphicLayoutEffect",()=>iS],74008);class iL{constructor(e){this.isMounted=!1,this.node=e}update(){}}function iw(e,t,i){let r=e.getProps();return tE(r,t,void 0!==i?i:r.custom,e)}function iR(e,t){if(e?.inherit&&t){let{inherit:i,...r}=e;return{...t,...r}}return e}function iI(e,t){let i=e?.[t]??e?.default??e;return i!==e?iR(i,e):i}let iC=e=>Array.isArray(e);function iD(e,t){let i=e.getValue("willChange");if(Q(i)&&i.add)return i.add(t);if(!i&&eR.WillChange){let i=new eR.WillChange("auto");e.addValue("willChange",i),i.add(t)}}let ix=(e,t)=>i=>t(e(i)),iP=(...e)=>e.reduce(ix);function iM(e,t,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?e+(t-e)*6*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e}function iO(e,t){return i=>i>0?t:e}let iN=(e,t,i)=>{let r=e*e,a=i*(t*t-r)+r;return a<0?0:Math.sqrt(a)},iU=[E,y,w];function iF(e){let t=iU.find(t=>t.test(e));if(ea(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let i=t.parse(e);return t===w&&(i=function({hue:e,saturation:t,lightness:i,alpha:r}){e/=360,i/=100;let a=0,s=0,n=0;if(t/=100){let r=i<.5?i*(1+t):i+t-i*t,o=2*i-r;a=iM(o,r,e+1/3),s=iM(o,r,e),n=iM(o,r,e-1/3)}else a=s=n=i;return{red:Math.round(255*a),green:Math.round(255*s),blue:Math.round(255*n),alpha:r}}(i)),i}let iB=(e,t)=>{let i=iF(e),r=iF(t);if(!i||!r)return iO(e,t);let a={...i};return e=>(a.red=iN(i.red,r.red,e),a.green=iN(i.green,r.green,e),a.blue=iN(i.blue,r.blue,e),a.alpha=tF(i.alpha,r.alpha,e),y.transform(a))},i$=new Set(["none","hidden"]);function iH(e,t){return i=>tF(e,t,i)}function iV(e){return"number"==typeof e?iH:"string"==typeof e?ed(e)?iO:R.test(e)?iB:iK:Array.isArray(e)?iG:"object"==typeof e?R.test(e)?iB:iW:iO}function iG(e,t){let i=[...e],r=i.length,a=e.map((e,i)=>iV(e)(e,t[i]));return e=>{for(let t=0;t<r;t++)i[t]=a[t](e);return i}}function iW(e,t){let i={...e,...t},r={};for(let a in i)void 0!==e[a]&&void 0!==t[a]&&(r[a]=iV(e[a])(e[a],t[a]));return e=>{for(let t in r)i[t]=r[t](e);return i}}let iK=(e,t)=>{let i=U.createTransformer(t),r=P(e),a=P(t);if(!(r.indexes.var.length===a.indexes.var.length&&r.indexes.color.length===a.indexes.color.length&&r.indexes.number.length>=a.indexes.number.length))return ea(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),iO(e,t);if(i$.has(e)&&!a.values.length||i$.has(t)&&!r.values.length)return i$.has(e)?i=>i<=0?e:t:i=>i>=1?t:e;return iP(iG(function(e,t){let i=[],r={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){let s=t.types[a],n=e.indexes[s][r[s]],o=e.values[n]??0;i[a]=o,r[s]++}return i}(r,a),a.values),i)};function iq(e,t,i){return"number"==typeof e&&"number"==typeof t&&"number"==typeof i?tF(e,t,i):iV(e)(e,t)}let ij=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>eD.update(t,e),stop:()=>ex(t),now:()=>eP.isProcessing?eP.timestamp:ta.now()}};function iY(e){let t=0,i=e.next(t);for(;!i.done&&t<2e4;)t+=50,i=e.next(t);return t>=2e4?1/0:t}function iz(e,t,i){var r,a;let s=Math.max(t-5,0);return r=i-e(s),(a=t-s)?1e3/a*r:0}let iX=.01,iQ=2,iZ=.005,iJ=.5;function i0(e,t){return e*Math.sqrt(1-t*t)}let i1=["duration","bounce"],i2=["stiffness","damping","mass"];function i3(e,t){return t.some(t=>void 0!==e[t])}function i4(e=.3,t=.3){let i,r="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:a,restDelta:s}=r,n=r.keyframes[0],l=r.keyframes[r.keyframes.length-1],d={done:!1,value:n},{stiffness:u,damping:h,mass:c,duration:m,velocity:f,isResolvedFromDuration:g}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!i3(e,i2)&&i3(e,i1))if(t.velocity=0,e.visualDuration){let i=2*Math.PI/(1.2*e.visualDuration),r=i*i,a=2*o(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:1,stiffness:r,damping:a}}else{let i=function({duration:e=800,bounce:t=.3,velocity:i=0,mass:r=1}){let a,s;ea(e<=eq(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let n=1-t;n=o(.05,1,n),e=o(.01,10,e/1e3),n<1?(a=t=>{let r=t*n,a=r*e;return .001-(r-i)/i0(t,n)*Math.exp(-a)},s=t=>{let r=t*n*e,s=Math.pow(n,2)*Math.pow(t,2)*e,o=Math.exp(-r),l=i0(Math.pow(t,2),n);return(r*i+i-s)*o*(-a(t)+.001>0?-1:1)/l}):(a=t=>-.001+Math.exp(-t*e)*((t-i)*e+1),s=t=>e*e*(i-t)*Math.exp(-t*e));let l=function(e,t,i){let r=i;for(let i=1;i<12;i++)r-=e(r)/t(r);return r}(a,s,5/e);if(e=eq(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(l,2)*r;return{stiffness:t,damping:2*n*Math.sqrt(r*t),duration:e}}}({...e,velocity:0});(t={...t,...i,mass:1}).isResolvedFromDuration=!0}return t}({...r,velocity:-((r.velocity||0)/1e3)}),v=f||0,y=h/(2*Math.sqrt(u*c)),E=l-n,b=Math.sqrt(u/c)/1e3,T=5>Math.abs(E);if(a||(a=T?iX:iQ),s||(s=T?iZ:iJ),y<1){let e=i0(b,y);i=t=>l-Math.exp(-y*b*t)*((v+y*b*E)/e*Math.sin(e*t)+E*Math.cos(e*t))}else if(1===y)i=e=>l-Math.exp(-b*e)*(E+(v+b*E)*e);else{let e=b*Math.sqrt(y*y-1);i=t=>{let i=Math.exp(-y*b*t),r=Math.min(e*t,300);return l-i*((v+y*b*E)*Math.sinh(r)+e*E*Math.cosh(r))/e}}let A={calculatedDuration:g&&m||null,next:e=>{let t=i(e);if(g)d.done=e>=m;else{let r=0===e?v:0;y<1&&(r=0===e?eq(v):iz(i,e,t));let n=Math.abs(l-t)<=s;d.done=Math.abs(r)<=a&&n}return d.value=d.done?l:t,d},toString:()=>{let e=Math.min(iY(A),2e4),t=e8(t=>A.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return A}function i5({keyframes:e,velocity:t=0,power:i=.8,timeConstant:r=325,bounceDamping:a=10,bounceStiffness:s=500,modifyTarget:n,min:o,max:l,restDelta:d=.5,restSpeed:u}){let h,c,m=e[0],f={done:!1,value:m},g=i*t,v=m+g,y=void 0===n?v:n(v);y!==v&&(g=y-m);let E=e=>-g*Math.exp(-e/r),b=e=>y+E(e),T=e=>{let t=E(e),i=b(e);f.done=Math.abs(t)<=d,f.value=f.done?y:i},A=e=>{let t;if(t=f.value,void 0!==o&&t<o||void 0!==l&&t>l){var i;h=e,c=i4({keyframes:[f.value,(i=f.value,void 0===o?l:void 0===l||Math.abs(o-i)<Math.abs(l-i)?o:l)],velocity:iz(b,e,f.value),damping:a,stiffness:s,restDelta:d,restSpeed:u})}};return A(0),{calculatedDuration:null,next:e=>{let t=!1;return(c||void 0!==h||(t=!0,T(e),A(e)),void 0!==h&&e>=h)?c.next(e-h):(t||T(e),f)}}}i4.applyToOptions=e=>{let t=function(e,t=100,i){let r=i({...e,keyframes:[0,t]}),a=Math.min(iY(r),2e4);return{type:"keyframes",ease:e=>r.next(a*e).value/t,duration:a/1e3}}(e,100,i4);return e.ease=t.ease,e.duration=eq(t.duration),e.type="keyframes",e};let i8=(e,t,i)=>(((1-3*i+3*t)*e+(3*i-6*t))*e+3*t)*e;function i9(e,t,i,r){return e===t&&i===r?ew:a=>0===a||1===a?a:i8(function(e,t,i,r,a){let s,n,o=0;do(s=i8(n=t+(i-t)/2,r,a)-e)>0?i=n:t=n;while(Math.abs(s)>1e-7&&++o<12)return n}(a,0,1,e,i),t,r)}let i6=i9(.42,0,1,1),i7=i9(0,0,.58,1),re=i9(.42,0,.58,1),rt=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,ri=e=>t=>1-e(1-t),rr=i9(.33,1.53,.69,.99),ra=ri(rr),rs=rt(ra),rn=e=>(e*=2)<1?.5*ra(e):.5*(2-Math.pow(2,-10*(e-1))),ro=e=>1-Math.sin(Math.acos(e)),rl=ri(ro),rd=rt(ro),ru={linear:ew,easeIn:i6,easeInOut:re,easeOut:i7,circIn:ro,circInOut:rd,circOut:rl,backIn:ra,backInOut:rs,backOut:rr,anticipate:rn},rh=e=>{if(e4(e)){es(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[t,i,r,a]=e;return i9(t,i,r,a)}return"string"==typeof e?(es(void 0!==ru[e],`Invalid easing type '${e}
3358'`,"invalid-easing-type"),ru[e]):e},rc=(e,t,i)=>{let r=t-e;return 0===r?1:(i-e)/r};function rm({duration:e=300,keyframes:t,times:i,ease:r="easeInOut"}){var a;let s,n=Array.isArray(r)&&"number"!=typeof r[0]?r.map(rh):rh(r),l={done:!1,value:t[0]},d=function(e,t,{clamp:i=!0,ease:r,mixer:a}={}){let s=e.length;if(es(s===t.length,"Both input and output ranges must be the same length","range-length"),1===s)return()=>t[0];if(2===s&&t[0]===t[1])return()=>t[1];let n=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());let l=function(e,t,i){let r=[],a=i||eR.mix||iq,s=e.length-1;for(let i=0;i<s;i++){let s=a(e[i],e[i+1]);t&&(s=iP(Array.isArray(t)?t[i]||ew:t,s)),r.push(s)}return r}(t,r,a),d=l.length,u=i=>{if(n&&i<e[0])return t[0];let r=0;if(d>1)for(;r<e.length-2&&!(i<e[r+1]);r++);let a=rc(e[r],e[r+1],i);return l[r](a)};return i?t=>u(o(e[0],e[s-1],t)):u}((a=i&&i.length===t.length?i:(!function(e,t){let i=e[e.length-1];for(let r=1;r<=t;r++){let a=rc(0,t,r);e.push(tF(i,1,a))}}(s=[0],t.length-1),s),a.map(t=>t*e)),t,{ease:Array.isArray(n)?n:t.map(()=>n||re).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(l.value=d(t),l.done=t>=e,l)}}let rf={decay:i5,inertia:i5,tween:rm,keyframes:rm,spring:i4};function rp(e){"string"==typeof e.type&&(e.type=rf[e.type])}let rg=e=>e/100;class rv extends e2{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==ta.now()&&this.tick(ta.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},e3.mainThread++,this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){let{options:e}=this;rp(e);let{type:t=rm,repeat:i=0,repeatDelay:r=0,repeatType:a,velocity:s=0}=e,{keyframes:n}=e,o=t||rm;o!==rm&&"number"!=typeof n[0]&&(this.mixKeyframes=iP(rg,iq(n[0],n[1])),n=[0,100]);let l=o({...e,keyframes:n});"mirror"===a&&(this.mirroredGenerator=o({...e,keyframes:[...n].reverse(),velocity:-s})),null===l.calculatedDuration&&(l.calculatedDuration=iY(l));let{calculatedDuration:d}=l;this.calculatedDuration=d,this.resolvedDuration=d+r,this.totalDuration=this.resolvedDuration*(i+1)-r,this.generator=l}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){let{generator:i,totalDuration:r,mixKeyframes:a,mirroredGenerator:s,resolvedDuration:n,calculatedDuration:l}=this;if(null===this.startTime)return i.next(0);let{delay:d=0,keyframes:u,repeat:h,repeatType:c,repeatDelay:m,type:f,onUpdate:g,finalKeyframe:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let y=this.currentTime-d*(this.playbackSpeed>=0?1:-1),E=this.playbackSpeed>=0?y<0:y>r;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=r);let b=this.currentTime,T=i;if(h){let e=Math.min(this.currentTime,r)/n,t=Math.floor(e),i=e%1;!i&&e>=1&&(i=1),1===i&&t--,(t=Math.min(t,h+1))%2&&("reverse"===c?(i=1-i,m&&(i-=m/n)):"mirror"===c&&(T=s)),b=o(0,1,i)*n}let A=E?{done:!1,value:u[0]}:T.next(b);a&&(A.value=a(A.value));let{done:_}=A;E||null===l||(_=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&_);return S&&f!==i5&&(A.value=e1(u,this.options,v,this.speed)),g&&g(A.value),S&&this.finish(),A}then(e,t){return this.finished.then(e,t)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return this.currentTime/1e3}set time(e){e=eq(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(ta.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:e=ij,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();let i=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=i):null!==this.holdTime?this.startTime=i-this.holdTime:this.startTime||(this.startTime=t??i),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(ta.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,e3.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}let ry={anticipate:rn,backInOut:rs,circInOut:rd};class rE extends te{constructor(e){!function(e){"string"==typeof e.ease&&e.ease in ry&&(e.ease=ry[e.ease])}(e),rp(e),super(e),void 0!==e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:i,onComplete:r,element:a,...s}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);let n=new rv({...s,autoplay:!1}),l=Math.max(10,ta.now()-this.startTime),d=o(0,10,l-10);
3358t.setWithVelocity(n.sample(Math.max(0,l-d)).value,n.sample(l).value,d),n.stop()}}let rb=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(U.test(e)||"0"===e)&&!e.startsWith("url("));function rT(e){e.duration=0,e.type="keyframes"}let rA=new Set(["opacity","clipPath","filter","transform"]),r_=eX(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class rS extends e2{constructor({autoplay:e=!0,delay:t=0,type:i="keyframes",repeat:r=0,repeatDelay:a=0,repeatType:s="loop",keyframes:n,name:o,motionValue:l,element:d,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=ta.now();const h={autoplay:e,delay:t,type:i,repeat:r,repeatDelay:a,repeatType:s,name:o,motionValue:l,element:d,...u},c=d?.KeyframeResolver||eH;this.keyframeResolver=new c(n,(e,t,i)=>this.onKeyframesResolved(e,t,h,!i),o,l,d),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,i,r){this.keyframeResolver=void 0;let{name:a,type:s,velocity:n,delay:o,isHandoff:l,onUpdate:d}=i;this.resolvedAt=ta.now(),!function(e,t,i,r){let a=e[0];if(null===a)return!1;if("display"===t||"visibility"===t)return!0;let s=e[e.length-1],n=rb(a,t),o=rb(s,t);return ea(n===o,`You are trying to animate ${t} from "${a}" to "${s}". "${n?s:a}" is not an animatable value.`,"value-not-animatable"),!!n&&!!o&&(function(e){let t=e[0];if(1===e.length)return!0;for(let i=0;i<e.length;i++)if(e[i]!==t)return!0}(e)||("spring"===i||e7(i))&&r)}(e,a,s,n)&&((eR.instantAnimations||!o)&&d?.(e1(e,i,t)),e[0]=e[e.length-1],rT(i),i.repeat=0);let u={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...i,keyframes:e},h=!l&&function(e){let{motionValue:t,name:i,repeatDelay:r,repeatType:a,damping:s,type:n}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:o,transformTemplate:l}=t.owner.getProps();return r_()&&i&&rA.has(i)&&("transform"!==i||!l)&&!o&&!r&&"mirror"!==a&&0!==s&&"inertia"!==n}(u),c=u.motionValue?.owner?.current,m=h?new rE({...u,element:c}):new rv(u);m.finished.then(()=>{this.notifyFinished()}).catch(ew),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),eF=!0,e$(),eB(),eF=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let rk={type:"spring",stiffness:500,damping:25,restSpeed:10},rL={type:"keyframes",duration:.8},rw={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},rR=e=>null!==e,rI=(e,t,i,r={},a,s)=>o=>{let l=iI(r,e)||{},d=l.delay||r.delay||0,{elapsed:u=0}=r;u-=eq(d);let h={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:e=>{t.set(e),l.onUpdate&&l.onUpdate(e)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:s?void 0:a};!function({when:e,delay:t,delayChildren:i,staggerChildren:r,staggerDirection:a,repeat:s,repeatType:n,repeatDelay:o,from:l,elapsed:d,...u}){return!!Object.keys(u).length}(l)&&Object.assign(h,((e,{keyframes:t})=>t.length>2?rL:n.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:rk:rw)(e,h)),h.duration&&(h.duration=eq(h.duration)),h.repeatDelay&&(h.repeatDelay=eq(h.repeatDelay)),void 0!==h.from&&(h.keyframes[0]=h.from);let c=!1;if(!1!==h.type&&(0!==h.duration||h.repeatDelay)||(rT(h),0===h.delay&&(c=!0)),(eR.instantAnimations||eR.skipAnimations||a?.shouldSkipAnimations)&&(c=!0,rT(h),h.delay=0),h.allowFlatten=!l.type&&!l.ease,c&&!s&&void 0!==t.get()){let e=function(e,{repeat:t,repeatType:i="loop"},r){let a=e.filter(rR),s=t&&"loop"!==i&&t%2==1?0:a.length-1;return a[s]}(h.keyframes,l);if(void 0!==e)return void eD.update(()=>{h.onUpdate(e),h.onComplete()})}return l.isSync?new rv(h):new rS(h)};function rC(e,t,{delay:i=0,transitionOverride:r,type:a}={}){let{transition:s,transitionEnd:n,...o}=t,l=e.getDefaultTransition();s=s?iR(s,l):l;let d=s?.reduceMotion;r&&(s=r);let u=[],h=a&&e.animationState&&e.animationState.getState()[a];for(let t in o){let r=e.getValue(t,e.latestValues[t]??null),a=o[t];if(void 0===a||h&&function({protectedKeys:e,needsAnimating:t},i){let r=e.hasOwnProperty(i)&&!0!==t[i];return t[i]=!1,r}(h,t))continue;let n={delay:i,...iI(s||{},t)},l=r.get();if(void 0!==l&&!r.isAnimating&&!Array.isArray(a)&&a===l&&!n.velocity)continue;let c=!1;if(window.MotionHandoffAnimation){let i=e.props[iT];if(i){let e=window.MotionHandoffAnimation(i,t,eD);null!==e&&(n.startTime=e,c=!0)}}iD(e,t);let m=d??e.shouldReduceMotion;r.start(rI(t,r,a,m&&Z.has(t)?{type:!1}:n,e,c));let f=r.animation;f&&u.push(f)}if(n){let t=()=>eD.update(()=>{n&&function(e,t){let{transitionEnd:i={},transition:r={},...a}=iw(e,t)||{};for(let t in a={...a,...i}){var s;let i=iC(s=a[t])?s[s.length-1]||0:s;e.hasValue(t)?e.getValue(t).set(i):e.addValue(t,tn(i))}}(e,n)});u.length?Promise.all(u).then(t):t()}return u}function rD(e,t,i,r=0,a=1){let s=Array.from(e).sort((e,t)=>
3358e.sortNodePosition(t)).indexOf(t),n=e.size,o=(n-1)*r;return"function"==typeof i?i(s,n):1===a?s*r:o-s*r}function rx(e,t,i={}){let r=iw(e,t,"exit"===i.type?e.presenceContext?.custom:void 0),{transition:a=e.getDefaultTransition()||{}}=r||{};i.transitionOverride&&(a=i.transitionOverride);let s=r?()=>Promise.all(rC(e,r,i)):()=>Promise.resolve(),n=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:s=0,staggerChildren:n,staggerDirection:o}=a;return function(e,t,i=0,r=0,a=0,s=1,n){let o=[];for(let l of e.variantChildren)l.notify("AnimationStart",t),o.push(rx(l,t,{...n,delay:i+("function"==typeof r?0:r)+rD(e.variantChildren,l,r,a,s)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(o)}(e,t,r,s,n,o,i)}:()=>Promise.resolve(),{when:o}=a;if(!o)return Promise.all([s(),n(i.delay)]);{let[e,t]="beforeChildren"===o?[s,n]:[n,s];return e().then(()=>t())}}let rP=tc.length;function rM(e,t){if(!Array.isArray(t))return!1;let i=t.length;if(i!==e.length)return!1;for(let r=0;r<i;r++)if(t[r]!==e[r])return!1;return!0}let rO=[...th].reverse(),rN=th.length;function rU(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function rF(){return{animate:rU(!0),whileInView:rU(),whileHover:rU(),whileTap:rU(),whileDrag:rU(),whileFocus:rU(),exit:rU()}}let rB=0;function r$(e){return[e("x"),e("y")]}function rH(e,t,i,r={passive:!0}){return e.addEventListener(t,i,r),()=>e.removeEventListener(t,i)}let rV={x:!1,y:!1};function rG(e){return e.max-e.min}function rW(e,t,i,r=.5){e.origin=r,e.originPoint=tF(t.min,t.max,e.origin),e.scale=rG(i)/rG(t),e.translate=tF(i.min,i.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function rK(e,t,i,r){rW(e.x,t.x,i.x,r?r.originX:void 0),rW(e.y,t.y,i.y,r?r.originY:void 0)}function rq(e,t,i){e.min=i.min+t.min,e.max=e.min+rG(t)}function rj(e,t,i){e.min=t.min-i.min,e.max=e.min+rG(t)}function rY(e,t,i){rj(e.x,t.x,i.x),rj(e.y,t.y,i.y)}function rz(e){return"object"==typeof e&&null!==e}function rX(e){return rz(e)&&"ownerSVGElement"in e}var rQ=e.i(49652);let rZ=new WeakMap,rJ=(e,t,i)=>(r,a)=>a&&a[0]?a[0][e+"Size"]:rX(r)&&"getBBox"in r?r.getBBox()[t]:r[i],r0=rJ("inline","width","offsetWidth"),r1=rJ("block","height","offsetHeight");function r2({target:e,borderBoxSize:t}){rZ.get(e)?.forEach(i=>{i(e,{get width(){return r0(e,t)},get height(){return r1(e,t)}})})}function r3(e){e.forEach(r2)}let r4=new Set;function r5(e,t){let i;return"function"==typeof e?(r4.add(e),a||(a=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};r4.forEach(t=>t(e))},window.addEventListener("resize",a)),()=>{r4.delete(e),r4.size||"function"!=typeof a||(window.removeEventListener("resize",a),a=void 0)}):(!r&&"u">typeof ResizeObserver&&(r=new ResizeObserver(r3)),(i=(0,rQ.resolveElements)(e)).forEach(e=>{let i=rZ.get(e);i||(i=new Set,rZ.set(e,i)),i.add(t),r?.observe(e)}),()=>{i.forEach(e=>{let i=rZ.get(e);i?.delete(t),i?.size||r?.unobserve(e)})})}let r8=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]),r9=new Set(["INPUT","SELECT","TEXTAREA"]),r6=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function r7(e){return{point:{x:e.pageX,y:e.pageY}}}function ae(e,t,i,r){return rH(e,t,e=>r6(e)&&i(e,r7(e)),r)}let at=({current:e})=>e?e.ownerDocument.defaultView:null,ai=(e,t)=>Math.abs(e-t),ar=new Set(["auto","scroll"]);class aa{constructor(e,t,{transformPagePoint:i,contextWindow:r=window,dragSnapToOrigin:a=!1,distanceThreshold:s=3,element:n}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var e,t;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let i=ao(this.lastMoveEventInfo,this.history),r=null!==this.startEvent,a=(e=i.offset,t={x:0,y:0},Math.sqrt(ai(e.x,t.x)**2+ai(e.y,t.y)**2)>=this.distanceThreshold);if(!r&&!a)return;let{point:s}=i,{timestamp:n}=eP;this.history.push({...s,timestamp:n});
3358let{onStart:o,onMove:l}=this.handlers;r||(o&&o(this.lastMoveEvent,i),this.startEvent=this.lastMoveEvent),l&&l(this.lastMoveEvent,i)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=as(t,this.transformPagePoint),eD.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:i,onSessionEnd:r,resumeAnimation:a}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&a&&a(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let s=ao("pointercancel"===e.type?this.lastMoveEventInfo:as(t,this.transformPagePoint),this.history);this.startEvent&&i&&i(e,s),r&&r(e,s)},!r6(e))return;this.dragSnapToOrigin=a,this.handlers=t,this.transformPagePoint=i,this.distanceThreshold=s,this.contextWindow=r||window;const o=as(r7(e),this.transformPagePoint),{point:l}=o,{timestamp:d}=eP;this.history=[{...l,timestamp:d}];const{onSessionStart:u}=t;u&&u(e,ao(o,this.history)),this.removeListeners=iP(ae(this.contextWindow,"pointermove",this.handlePointerMove),ae(this.contextWindow,"pointerup",this.handlePointerUp),ae(this.contextWindow,"pointercancel",this.handlePointerUp)),n&&this.startScrollTracking(n)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(ar.has(e.overflowX)||ar.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let i=e===window,r=i?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},a={x:r.x-t.x,y:r.y-t.y};(0!==a.x||0!==a.y)&&(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.y),this.scrollPositions.set(e,r),eD.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ex(this.updatePoint)}}function as(e,t){return t?{point:t(e.point)}:e}function an(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ao({point:e},t){return{point:e,delta:an(e,al(t)),offset:an(e,t[0]),velocity:function(e,t){if(e.length<2)return{x:0,y:0};let i=e.length-1,r=null,a=al(e);for(;i>=0&&(r=e[i],!(a.timestamp-r.timestamp>eq(.1)));)i--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&a.timestamp-r.timestamp>2*eq(.1)&&(r=e[1]);let s=(a.timestamp-r.timestamp)/1e3;if(0===s)return{x:0,y:0};let n={x:(a.x-r.x)/s,y:(a.y-r.y)/s};return n.x===1/0&&(n.x=0),n.y===1/0&&(n.y=0),n}(t,.1)}}function al(e){return e[e.length-1]}function ad(e,t,i){return{min:void 0!==t?e.min+t:void 0,max:void 0!==i?e.max+i-(e.max-e.min):void 0}}function au(e,t){let i=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([i,r]=[r,i]),{min:i,max:r}}function ah(e,t,i){return{min:ac(e,t),max:ac(e,i)}}function ac(e,t){return"number"==typeof e?e:e[t]||0}let am=new WeakMap;class af{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=X(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:i}={}){let{presenceContext:r}=this.visualElement;if(r&&!1===r.isPresent)return;let a=e=>{t&&this.snapToCursor(r7(e).point),this.stopAnimation()},s=(e,t)=>{let{drag:i,dragPropagation:r,onDragStart:a}=this.getProps();if(i&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(e){if("x"===e||"y"===e)if(rV[e])return null;else return rV[e]=!0,()=>{rV[e]=!1};return rV.x||rV.y?null:(rV.x=rV.y=!0,()=>{rV.x=rV.y=!1})}(i),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),r$(e=>{let t=this.getAxisMotionValue(e).get()||0;if(A.test(t)){let{projection:i}=this.visualElement;if(i&&i.layout){let r=i.layout.layoutBox[e];r&&(t=rG(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),a&&eD.update(()=>a(e,t),!1,!0),iD(this.visualElement,"transform");let{animationState:s}=this.visualElement;s&&s.setActive("whileDrag",!0)},n=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:i,dragDirectionLock:r,onDirectionLock:a,onDrag:s}=this.getProps();if(!i&&!this.openDragLock)return;let{offset:n}=t;if(r&&null===this.currentDirection){this.currentDirection=function(e,t=10){let i=null;return Math.abs(e.y)>t?i="y":Math.abs(e.x)>t&&(i="x"),i}(n),null!==this.currentDirection&&a&&a(this.currentDirection);return}this.updateAxis("x",t.point,n),this.updateAxis("y",t.point,n),this.visualElement.render(),s&&eD.update(()=>s(e,t),!1,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:d}=this.getProps();this.panSession=new aa(e,{onSessionStart:a,onStart:s,onMove:n,onSessionEnd:o,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:i,contextWindow:at(this.visualElement),element:this.visualElement.current})}stop(e,t){let i=e||this.latestPointerEvent,r=t||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!r||!i)return;let{velocity:s}=r;this.startAnimation(s);let{onDragEnd:n}=this.getProps();n&&eD.postRender(()=>n(i,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,i){let{drag:r}=this.getProps();if(!i||!ag(e,r,this.currentDirection))return;let a=this.getAxisMotionValue(e),s=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(s=function(e,{min:t,max:i},r){return void 0!==t&&e<t?e=r?tF(t,e,r.min):Math.max(e,t):void 0!==i&&e>i&&(e=r?tF(i,e,r.max):Math.min(e,i)),e}(s,this.constraints[e],this.elastic[e])),a.set(s)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&i_(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&i?this.constraints=function(e,{top:t,left:i,bottom:r,right:a}){return{x:ad(e.x,i,a),y:ad(e.y,t,r)}}(i.layoutBox,e):this.constraints=!1,this.elastic=function(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:ah(e,"left","right"),y:ah(e,"top","bottom")}}(t),r!==this.constraints&&!i_(e)&&i&&this.constraints&&!this.hasMutatedConstraints&&r$(e=>{var t,r;let a;!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=(t=i.layoutBox[e],r=this.constraints[e],a={},void 0!==r.min&&(a.min=r.min-t.min),void 0!==r.max&&(a.max=r.max-t.min),a))})}resolveRefConstraints(){var e;let{dragConstraints:t,onMeasureDragConstraints:i}=this.getProps();if(!t||!i_(t))return!1;let r=t.current;es(null!==r,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:a}=this.visualElement;if(!a||!a.layout)return!1;let s=function(e,t,i){let r=t2(e,i),{scroll:a}=t;return a&&(tZ(r.x,a.offset.x),tZ(r.y,a.offset.y)),r}(r,a.root,this.visualElement.getTransformPagePoint()),n=(e=a.layout.layoutBox,{x:au(e.x,s.x),y:au(e.y,s.y)});if(i){let e=i(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(n));this.hasMutatedConstraints=!!e,e&&(n=tW(e))}return n}startAnimation(e){let{drag:t,dragMomentum:i,dragElastic:r,dragTransition:a,dragSnapToOrigin:s,onDragTransitionEnd:n}=this.getProps(),o=this.constraints||{};return Promise.all(r$(n=>{if(!ag(n,t,this.currentDirection))return;let l=o&&o[n]||{};s&&(l={min:0,max:0});let d={type:"inertia",velocity:i?e[n]:0,bounceStiffness:r?200:1e6,bounceDamping:r?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...a,...l};return this.startAxisValueAnimation(n,d)})).then(n)}startAxisValueAnimation(e,t){let i=this.getAxisMotionValue(e);return iD(this.visualElement,e),i.start(rI(e,i,0,t,this.visualElement,!1))}stopAnimation(){r$(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps();return i[t]||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){r$(t=>{let{drag:i}=this.getProps();if(!ag(t,i,this.currentDirection))return;let{projection:r}=this.visualElement,a=this.getAxisMotionValue(t);if(r&&r.layout){let{min:i,max:s}=r.layout.layoutBox[t],n=a.get()||0;a.set(e[t]-tF(i,s,.5)+n)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:i}=this.visualElement;if(!i_(t)||!i||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};r$(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){var i,a;let s,n,l,d=t.get();r[e]=(i={min:d,max:d},a=this.constraints[e],s=.5,n=rG(i),(l=rG(a))>n?s=rc(a.min,a.max-n,i.min):n>l&&(s=rc(i.min,i.max-l,a.min)),o(0,1,s))}});let{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.constraints=!1,this.resolveConstraints(),r$(t=>{if(!ag(t,e,null))return;let i=this.getAxisMotionValue(t),{min:a,max:s}=this.constraints[t];i.set(tF(a,s,r[t]))}),this.visualElement.render()}addListeners(){let e;if(!this.visualElement.current)return;am.set(this.visualElement,this);let t=this.visualElement.current,i=ae(t,"pointerdown",e=>{let{drag:i,dragListener:r=!0}=this.getProps(),a=e.target,s=a!==t&&(r9.has(a.tagName)||!0===a.isContentEditable);i&&r&&!s&&this.start(e)}),r=()=>{var i,r,a;let s,n,{dragConstraints:o}=this.getProps();i_(o)&&o.current&&(this.constraints=this.resolveRefConstraints(),e||(i=t,r=o.current,s=r5(i,ap(a=()=>this.scalePositionWithinConstraints())),n=r5(r,ap(a)),e=()=>{s(),n()}))},{projection:a}=this.visualElement,s=a.addEventListener("measure",r);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),eD.read(r);let n=rH(window,"resize",()=>this.scalePositionWithinConstraints()),o=a.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(r$(t=>{let i=this.getAxisMotionValue(t);i&&(this.originPoint[t]+=e[t].translate,i.set(i.get()+e[t].translate))}),this.visualElement.render())});return()=>{n(),i(),s(),o&&o(),e&&e()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:a=!1,dragElastic:s=.35,dragMomentum:n=!0}=e;return{...e,drag:t,dragDirectionLock:i,dragPropagation:r,dragConstraints:a,dragElastic:s,dragMomentum:n}}}function ap(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function ag(e,t,i){return(!0===t||t===e)&&(null===i||i===e)}let av=e=>(t,i)=>{e&&eD.update(()=>e(t,i),!1,!0)},ay={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var aE=t4;function ab(e=!0){let t=(0,t4.useContext)(ih);if(null===t)return[!0,null];let{isPresent:i,onExitComplete:r,register:a}=t,s=(0,t4.useId)();(0,t4.useEffect)(()=>
3358{if(e)return a(s)},[e]);let n=(0,t4.useCallback)(()=>e&&r&&r(s),[s,r,e]);return!i&&r?[!1,n]:[!0]}e.s(["usePresence",()=>ab],64978);let aT=!1;class aA extends aE.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:i,layoutId:r}=this.props,{projection:a}=e;a&&(t.group&&t.group.add(a),i&&i.register&&r&&i.register(a),aT&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),ay.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:i,drag:r,isPresent:a}=this.props,{projection:s}=i;return s&&(s.isPresent=a,e.layoutDependency!==t&&s.setOptions({...s.options,layoutDependency:t}),aT=!0,r||e.layoutDependency!==t||void 0===t||e.isPresent!==a?s.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?s.promote():s.relegate()||eD.postRender(()=>{let e=s.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ti.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:i}=this.props,{projection:r}=e;aT=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}}function a_(e){let[t,i]=ab(),r=(0,aE.useContext)(t6);return(0,t9.jsx)(aA,{...e,layoutGroup:r,switchLayoutGroup:(0,aE.useContext)(iA),isPresent:t,safeToRemove:i})}let aS=["TopLeft","TopRight","BottomLeft","BottomRight"],ak=aS.length,aL=e=>"string"==typeof e?parseFloat(e):e,aw=e=>"number"==typeof e||_.test(e);function aR(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let aI=aD(0,.5,rl),aC=aD(.5,.95,ew);function aD(e,t,i){return r=>r<e?0:r>t?1:i(rc(e,t,r))}function ax(e,t){e.min=t.min,e.max=t.max}function aP(e,t){ax(e.x,t.x),ax(e.y,t.y)}function aM(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function aO(e,t,i,r,a){return e-=t,e=r+1/i*(e-r),void 0!==a&&(e=r+1/a*(e-r)),e}function aN(e,t,[i,r,a],s,n){!function(e,t=0,i=1,r=.5,a,s=e,n=e){if(A.test(t)&&(t=parseFloat(t),t=tF(n.min,n.max,t/100)-n.min),"number"!=typeof t)return;let o=tF(s.min,s.max,r);e===s&&(o-=t),e.min=aO(e.min,t,i,o,a),e.max=aO(e.max,t,i,o,a)}(e,t[i],t[r],t[a],t.scale,s,n)}let aU=["x","scaleX","originX"],aF=["y","scaleY","originY"];function aB(e,t,i,r){aN(e.x,t,aU,i?i.x:void 0,r?r.x:void 0),aN(e.y,t,aF,i?i.y:void 0,r?r.y:void 0)}function a$(e){return 0===e.translate&&1===e.scale}function aH(e){return a$(e.x)&&a$(e.y)}function aV(e,t){return e.min===t.min&&e.max===t.max}function aG(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function aW(e,t){return aG(e.x,t.x)&&aG(e.y,t.y)}function aK(e){return rG(e.x)/rG(e.y)}function aq(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class aj{constructor(){this.members=[]}add(e){ej(this.members,e);for(let t=this.members.length-1;t>=0;t--){let i=this.members[t];if(i===e||i===this.lead||i===this.prevLead)continue;let r=i.instance;r&&!1!==r.isConnected||i.snapshot||(eY(this.members,i),i.unmount())}e.scheduleRender()}remove(e){if(eY(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(!1!==e.isPresent&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=i.options,{layoutDependency:a}=e.options;(void 0===r||r!==a)&&(e.resumeFrom=i,t&&(i.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),!1===e.options.crossfade&&i.hide()}}
3358exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}let aY=(e,t)=>e.depth-t.depth;class az{constructor(){this.children=[],this.isDirty=!1}add(e){ej(this.children,e),this.isDirty=!0}remove(e){eY(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(aY),this.isDirty=!1,this.children.forEach(e)}}let aX=["","X","Y","Z"],aQ=0;function aZ(e,t,i,r){let{latestValues:a}=t;a[e]&&(i[e]=a[e],t.setStaticValue(e,0),r&&(r[e]=0))}function aJ({attachResizeListener:e,defaultParent:t,measureScroll:i,checkIsScrollRoot:r,resetTransform:a}){return class{constructor(e={},i=t?.()){this.id=aQ++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(a2),this.nodes.forEach(a7),this.nodes.forEach(se),this.nodes.forEach(a3)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=i?i.root||i:this,this.path=i?[...i.path,i]:[],this.parent=i,this.depth=i?i.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new az)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new ez),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let i=this.eventHandlers.get(e);i&&i.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=rX(t)&&!(rX(t)&&"svg"===t.tagName),this.instance=t;let{layoutId:i,layout:r,visualElement:a}=this.options;if(a&&!a.current&&a.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||i)&&(this.isLayoutDirty=!0),e){let i,r=0,a=()=>this.root.updateBlockedByResize=!1;eD.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;if(e!==r){let t,s;r=e,this.root.updateBlockedByResize=!0,i&&i(),t=ta.now(),s=({timestamp:e})=>{let i=e-t;i>=250&&(ex(s),a(i-250))},eD.setup(s,!0),i=()=>ex(s),ay.hasAnimatedSinceResize&&(ay.hasAnimatedSinceResize=!1,this.nodes.forEach(a6))}})}i&&this.root.registerSharedNode(i,this),!1!==this.options.animate&&a&&(i||r)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:i,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let s=this.options.transition||a.getDefaultTransition()||sn,{onLayoutAnimationStart:n,onLayoutAnimationComplete:o}=a.getProps(),l=!this.targetLayout||!aW(this.targetLayout,r),d=!t&&i;if(this.options.layoutRoot||this.resumeFrom||d||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...iI(s,"layout"),onPlay:n,onComplete:o};(a.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,d)}else t||a6(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ex(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEac
3358h(st),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:i}=t.options;if(!i)return;let r=i.props[iT];if(window.MotionHasOptimisedAnimation(r,"transform")){let{layout:e,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",eD,!(e||i))}let{parent:a}=t;a&&!a.hasCheckedOptimisedAppear&&e(a)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:i}=this.options;if(void 0===t&&!i)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(a5);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(a8);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(a9),this.nodes.forEach(a0),this.nodes.forEach(a1)):this.nodes.forEach(a8),this.clearAllSnapshots();let e=ta.now();eP.delta=o(0,1e3/60,e-eP.timestamp),eP.timestamp=e,eP.isProcessing=!0,eM.update.process(eP),eM.preRender.process(eP),eM.render.process(eP),eP.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ti.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(a4),this.sharedNodes.forEach(si)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,eD.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){eD.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||rG(this.snapshot.measuredBox.x)||rG(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=X(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!a)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!aH(this.projectionDelta),i=this.getTransformTemplate(),r=i?i(this.latestValues,""):void 0,s=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||tj(this.latestValues)||s)&&(a(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){var t;let i=this.measurePageBox(),r=this.removeElementScroll(i);return e&&(r=this.removeTransform(r)),sd((t=r).x),sd(t.y),{animationId:this.root.animationId,measuredBox:i,layoutBox:r,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return X();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(sh))){let{scroll:e}=this.root;e&&(tZ(t.x,e.offset.x),tZ(t.y,e.offset.y))}return t}removeElementScroll(e){let t=X();if(aP(t,e),this.scroll?.wasRoot)return t;for(let i=0;i<this.path.length;i++){let r=this.path[i],{scroll:a,options:s}=r;r!==this.root&&a&&s.layoutScroll&&(a.wasRoot&&aP(t,e),tZ(t.x,a.offset.x),tZ(t.y,a.offset.y))}return t}applyTransform(e,t=!1){let i=X();aP(i,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];!t&&r.options.layoutScroll&&r.scroll&&r!==r.root&&t1(i,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),tj(r.latestValues)&&t1(i,r.latestValues)}return tj(this.latestValues)&&t1(i,this.latestValues),i}removeTransform(e){let t=X();aP(t,e);for(let e=0;e<this.path.length;e++){let i=this.path[e];if(!i.instance||!tj(i.latestValues))continue;tq(i.latestValues)&&i.updateSnapshot();let r=X();aP(r,i.measurePageBox()),aB(t,i.latestValues,i.snapshot?i.snapshot.layoutBox:void 0,r)}return tj(this.latestValues)&&aB(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==eP.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.
3358isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);let i=!!this.resumingFrom||this!==t;if(!(e||i&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:a}=this.options;if(!this.layout||!(r||a))return;this.resolvedRelativeTargetAt=eP.timestamp;let s=this.getClosestProjectingParent();if(s&&this.linkedParentVersion!==s.layoutVersion&&!s.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(s&&s.layout?this.createRelativeTarget(s,this.layout.layoutBox,s.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=X(),this.targetWithTransforms=X()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var n,o,l;this.forceRelativeParentToResolveTarget(),n=this.target,o=this.relativeTarget,l=this.relativeParent.target,rq(n.x,o.x,l.x),rq(n.y,o.y,l.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):aP(this.target,this.layout.layoutBox),tQ(this.target,this.targetDelta)):aP(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,s&&!!s.resumingFrom==!!this.resumingFrom&&!s.options.layoutScroll&&s.target&&1!==this.animationProgress?this.createRelativeTarget(s,this.target,s.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||tq(this.parent.latestValues)||tY(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,i){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=X(),this.relativeTargetOrigin=X(),rY(this.relativeTargetOrigin,t,i),aP(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,i=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(i=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(i=!1),this.resolvedRelativeTargetAt===eP.timestamp&&(i=!1),i)return;let{layout:r,layoutId:a}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||a))return;aP(this.layoutCorrected,this.layout.layoutBox);let s=this.treeScale.x,n=this.treeScale.y;!function(e,t,i,r=!1){let a,s,n=i.length;if(n){t.x=t.y=1;for(let o=0;o<n;o++){s=(a=i[o]).projectionDelta;let{visualElement:n}=a.options;(!n||!n.props.style||"contents"!==n.props.style.display)&&(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&t1(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),s&&(t.x*=s.x.scale,t.y*=s.y.scale,tQ(e,s)),r&&tj(a.latestValues)&&t1(e,a.latestValues))}t.x<1.0000000000001&&t.x>.999999999999&&(t.x=1),t.y<1.0000000000001&&t.y>.999999999999&&(t.y=1)}}(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=X());let{target:o}=e;if(!o){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(aM(this.prevProjectionDelta.x,this.projectionDelta.x),aM(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),rK(this.projectionDelta,this.layoutCorrected,o,this.latestValues),this.treeScale.x===s&&this.treeScale.y===n&&aq(this.projectionDelta.x,this.prevProjectionDelta.x)&&aq(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",o))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Y(),this.projectionDelta=Y(),this.projectionDeltaWithTransform=Y()}setAnimationOrigin(e,t=!1){let i,r=this.snapshot,a=r?r.latestValues:{},s={...this.latestValues},n=Y();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=X(),l=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),d=this.getStack(),u=!d||d.members.length<=1,h=!!(l&&!u&&!0===this.options.crossfade&&!this.path.some(ss));this.animationProgress=0,this.mixTargetDelta=t=>{let r=t/1e3;if(sr(n.x,e.x,r),sr(n.y,e.y,r),this.setTargetDelta(n),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var d,c,m,f,g,v;rY(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,f=this.relativeTargetOrigin,g=o,v=r,sa(m.x,f.x,g.x,v),sa(m.y,f.y,g.y,v),i&&(d=this.relativeTarget,c=i,aV(d.x,c.x)&&aV(d.y,c.y))&&(this.isProjectionDirty=!1),i||(i=X()),aP(i,this.relativeTarget)}l&&(this.animationValues=s,function(e,t,i,r,a,s){a?(e.opacity=tF(0,i.opacity??1,aI(r)),e.opacityExit=tF(t.o
3358pacity??1,0,aC(r))):s&&(e.opacity=tF(t.opacity??1,i.opacity??1,r));for(let a=0;a<ak;a++){let s=`border${aS[a]}Radius`,n=aR(t,s),o=aR(i,s);(void 0!==n||void 0!==o)&&(n||(n=0),o||(o=0),0===n||0===o||aw(n)===aw(o)?(e[s]=Math.max(tF(aL(n),aL(o),r),0),(A.test(o)||A.test(n))&&(e[s]+="%")):e[s]=o)}(t.rotate||i.rotate)&&(e.rotate=tF(t.rotate||0,i.rotate||0,r))}(s,a,this.latestValues,r,h,u)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=r},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(ex(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=eD.update(()=>{var t,i,r;let a;ay.hasAnimatedSinceResize=!0,e3.layout++,this.motionValue||(this.motionValue=tn(0)),this.motionValue.jump(0,!1),this.currentAnimation=(t=this.motionValue,i=[0,1e3],r={...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{e3.layout--},onComplete:()=>{e3.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}},(a=Q(t)?t:tn(t)).start(rI("",a,i,r)),a.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:i,layout:r,latestValues:a}=e;if(t&&i&&r){if(this!==e&&this.layout&&r&&su(this.options.animationType,this.layout.layoutBox,r.layoutBox)){i=this.target||X();let t=rG(this.layout.layoutBox.x);i.x.min=e.target.x.min,i.x.max=i.x.min+t;let r=rG(this.layout.layoutBox.y);i.y.min=e.target.y.min,i.y.max=i.y.min+r}aP(t,i),t1(t,a),rK(this.projectionDeltaWithTransform,this.layoutCorrected,t,a)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new aj),this.sharedNodes.get(e).add(t);let i=t.options.initialPromotionConfig;t.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:i}={}){let r=this.getStack();r&&r.promote(this,i),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:i}=e;if((i.z||i.rotate||i.rotateX||i.rotateY||i.rotateZ||i.skewX||i.skewY)&&(t=!0),!t)return;let r={};i.z&&aZ("z",e,r,this.animationValues);for(let t=0;t<aX.length;t++)aZ(`rotate${aX[t]}`,e,r,this.animationValues),aZ(`skew${aX[t]}`,e,r,this.animationValues);for(let t in e.render(),r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility="hidden";return}let i=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=iu(t?.pointerEvents)||"",e.transform=i?i(this.latestValues,""):"none";return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=iu(t?.pointerEvents)||""),this.hasProjected&&!tj(this.latestValues)&&(e.transform=i?i({},""):"none",this.hasProjected=!1);return}e.visibility="";let a=r.animationValues||r.latestValues;this.applyTransformsToTarget();let s=function(e,t,i){let r="",a=e.x.translate/t.x,s=e.y.translate/t.y,n=i?.z||0;if((a||s||n)&&(r=`translate3d(${a}px, ${s}px, ${n}px) `),(1!==t.x||1!==t.y)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),i){let{transformPerspective:e,rotate:t,rotateX:a,rotateY:s,skewX:n,skewY:o}=i;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),a&&(r+=`rotateX(${a}deg) `),s&&(r+=`rotateY(${s}deg) `),n&&(r+=`skewX(${n}deg) `),o&&(r+=`skewY(${o}deg) `)}let o=e.x.scale*t.x,l=e.y.scale*t.y;return(1!==o||1!==l)&&(r+=`scale(${o}, ${l}
3358)`),r||"none"}(this.projectionDeltaWithTransform,this.treeScale,a);i&&(s=i(a,s)),e.transform=s;let{x:n,y:o}=this.projectionDelta;for(let t in e.transformOrigin=`${100*n.origin}% ${100*o.origin}% 0`,r.animationValues?e.opacity=r===this?a.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:a.opacityExit:e.opacity=r===this?void 0!==a.opacity?a.opacity:"":void 0!==a.opacityExit?a.opacityExit:0,tB){if(void 0===a[t])continue;let{correct:i,applyTo:n,isCSSVariable:o}=tB[t],l="none"===s?a[t]:i(a[t],r);if(n){let t=n.length;for(let i=0;i<t;i++)e[n[i]]=l}else o?this.options.visualElement.renderState.vars[t]=l:e[t]=l}this.options.layoutId&&(e.pointerEvents=r===this?iu(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(a5),this.root.sharedNodes.clear()}}}function a0(e){e.updateLayout()}function a1(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){let{layoutBox:i,measuredBox:r}=e.layout,{animationType:a}=e.options,s=t.source!==e.layout.source;"size"===a?r$(e=>{let r=s?t.measuredBox[e]:t.layoutBox[e],a=rG(r);r.min=i[e].min,r.max=r.min+a}):su(a,t.layoutBox,i)&&r$(r=>{let a=s?t.measuredBox[r]:t.layoutBox[r],n=rG(i[r]);a.max=a.min+n,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+n)});let n=Y();rK(n,i,t.layoutBox);let o=Y();s?rK(o,e.applyTransform(r,!0),t.measuredBox):rK(o,i,t.layoutBox);let l=!aH(n),d=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:a,layout:s}=r;if(a&&s){let n=X();rY(n,t.layoutBox,a.layoutBox);let o=X();rY(o,i,s.layoutBox),aW(n,o)||(d=!0),r.options.layoutRoot&&(e.relativeTarget=o,e.relativeTargetOrigin=n,e.relativeParent=r)}}}e.notifyListeners("didUpdate",{layout:i,snapshot:t,delta:o,layoutDelta:n,hasLayoutChanged:l,hasRelativeLayoutChanged:d})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function a2(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function a3(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function a4(e){e.clearSnapshot()}function a5(e){e.clearMeasurements()}function a8(e){e.isLayoutDirty=!1}function a9(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function a6(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function a7(e){e.resolveTargetDelta()}function se(e){e.calcProjection()}function st(e){e.resetSkewAndRotation()}function si(e){e.removeLeadSnapshot()}function sr(e,t,i){e.translate=tF(t.translate,0,i),e.scale=tF(t.scale,1,i),e.origin=t.origin,e.originPoint=t.originPoint}function sa(e,t,i,r){e.min=tF(t.min,i.min,r),e.max=tF(t.max,i.max,r)}function ss(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let sn={duration:.45,ease:[.4,0,.1,1]},so=e=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),sl=so("applewebkit/")&&!so("chrome/")?Math.round:ew;function sd(e){e.min=sl(e.min),e.max=sl(e.max)}function su(e,t,i){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(aK(t)-aK(i)))}function sh(e){return e!==e.root&&e.scroll?.wasRoot}let sc=aJ({attachResizeListener:(e,t)=>rH(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),sm={current:void 0},sf=aJ({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!sm.current){let e=new sc({});e.mount(window),e.setOptions({layoutScroll:!0}),sm.current=e}return sm.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function sp(e,t){let i=(0,rQ.resolveElements)(e),r=new AbortController;return[i,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function sg(e,t,i){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover","Start"===i);let a=r["onHover"+i];a&&eD.postRender(()=>a(t,r7(t)))}function sv(e){return rz(e)&&"offsetHeight"in e}e.s(["isHTMLElement",()=>sv],72846);let sy=(e,t)=>!!t&&(e===t||sy(e,t.parentElement)),sE=new WeakSet;
3358function sb(e){return t=>{"Enter"===t.key&&e(t)}}function sT(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function sA(e){return r6(e)&&!(rV.x||rV.y)}let s_=new WeakSet;function sS(e,t,i){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap","Start"===i);let a=r["onTap"+("End"===i?"":i)];a&&eD.postRender(()=>a(t,r7(t)))}let sk=new WeakMap,sL=new WeakMap,sw=e=>{let t=sk.get(e.target);t&&t(e)},sR=e=>{e.forEach(sw)},sI={some:0,all:1},sC=function(e,t){if("u"<typeof Proxy)return ik;let i=new Map,r=(i,r)=>ik(i,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(a,s)=>"create"===s?r:(i.has(s)||i.set(s,ik(s,void 0,e,t)),i.get(s))})}({animation:{Feature:class extends iL{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=t=>Promise.all(t.map(({animation:t,options:i})=>(function(e,t,i={}){let r;if(e.notify("AnimationStart",t),Array.isArray(t))r=Promise.all(t.map(t=>rx(e,t,i)));else if("string"==typeof t)r=rx(e,t,i);else{let a="function"==typeof t?iw(e,t,i.custom):t;r=Promise.all(rC(e,a,i))}return r.then(()=>{e.notify("AnimationComplete",t)})})(e,t,i))),i=rF(),r=!0,a=!1,s=t=>(i,r)=>{let a=iw(e,r,"exit"===t?e.presenceContext?.custom:void 0);if(a){let{transition:e,transitionEnd:t,...r}=a;i={...i,...r,...t}}return i};function n(n){let{props:o}=e,l=function e(t){if(!t)return;if(!t.isControllingVariants){let i=t.parent&&e(t.parent)||{};return void 0!==t.props.initial&&(i.initial=t.props.initial),i}let i={};for(let e=0;e<rP;e++){let r=tc[e],a=t.props[r];(tu(a)||!1===a)&&(i[r]=a)}return i}(e.parent)||{},d=[],u=new Set,h={},c=1/0;for(let t=0;t<rN;t++){var m,f;let g=rO[t],v=i[g],y=void 0!==o[g]?o[g]:l[g],E=tu(y),b=g===n?v.isActive:null;!1===b&&(c=t);let T=y===l[g]&&y!==o[g]&&E;if(T&&(r||a)&&e.manuallyAnimateOnMount&&(T=!1),v.protectedKeys={...h},!v.isActive&&null===b||!y&&!v.prevProp||td(y)||"boolean"==typeof y)continue;if("exit"===g&&v.isActive&&!0!==b){v.prevResolvedValues&&(h={...h,...v.prevResolvedValues});continue}let A=(m=v.prevProp,"string"==typeof(f=y)?f!==m:!!Array.isArray(f)&&!rM(f,m)),_=A||g===n&&v.isActive&&!T&&E||t>c&&E,S=!1,k=Array.isArray(y)?y:[y],L=k.reduce(s(g),{});!1===b&&(L={});let{prevResolvedValues:w={}}=v,R={...w,...L},I=t=>{_=!0,u.has(t)&&(S=!0,u.delete(t)),v.needsAnimating[t]=!0;let i=e.getValue(t);i&&(i.liveStyle=!1)};for(let e in R){let t=L[e],i=w[e];if(!h.hasOwnProperty(e))(iC(t)&&iC(i)?rM(t,i):t===i)?void 0!==t&&u.has(e)?I(e):v.protectedKeys[e]=!0:null!=t?I(e):u.add(e)}v.prevProp=y,v.prevResolvedValues=L,v.isActive&&(h={...h,...L}),(r||a)&&e.blockInitialAnimation&&(_=!1);let C=T&&A,D=!C||S;_&&D&&d.push(...k.map(t=>{let i={type:g};if("string"==typeof t&&(r||a)&&!C&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,a=iw(r,t);if(r.enteringChildren&&a){let{delayChildren:t}=a.transition||{};i.delay=rD(r.enteringChildren,e,t)}}return{animation:t,options:i}}))}if(u.size){let t={};if("boolean"!=typeof o.initial){let i=iw(e,Array.isArray(o.initial)?o.initial[0]:o.initial);i&&i.transition&&(t.transition=i.transition)}u.forEach(i=>{let r=e.getBaseTarget(i),a=e.getValue(i);a&&(a.liveStyle=!0),t[i]=r??null}),d.push({animation:t})}let g=!!d.length;return r&&(!1===o.initial||o.initial===o.animate)&&!e.manuallyAnimateOnMount&&(g=!1),r=!1,a=!1,g?t(d):Promise.resolve()}return{animateChanges:n,setActive:function(t,r){if(i[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),i[t].isActive=r;let a=n(t);for(let e in i)i[e].protectedKeys={};return a},setAnimateFunction:function(i){t=i(e)},getState:()=>i,reset:()=>{i=rF(),a=!0}}}(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();td(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends iL{constructor(){super(...arguments),this.id=rB++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;let r=this.node.animationState.setActive("exit",!e);t&&!e&&r.then(()=>
3358{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}},inView:{Feature:class extends iL{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;let t;this.unmount();let{viewport:i={}}=this.node.getProps(),{root:r,margin:a,amount:s="some",once:n}=i,o={root:r?r.current:void 0,rootMargin:a,threshold:"number"==typeof s?s:sI[s]},l=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,n&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);let{onViewportEnter:i,onViewportLeave:r}=this.node.getProps(),a=t?i:r;a&&a(e)};return e=this.node.current,t=function({root:e,...t}){let i=e||document;sL.has(i)||sL.set(i,{});let r=sL.get(i),a=JSON.stringify(t);return r[a]||(r[a]=new IntersectionObserver(sR,{root:e,...t})),r[a]}(o),sk.set(e,l),t.observe(e),()=>{sk.delete(e),t.unobserve(e)}}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return i=>e[i]!==t[i]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends iL{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:i}=this.node.props;this.unmount=function(e,t,i={}){let[r,a,s]=sp(e,i),n=e=>{let r=e.currentTarget;if(!sA(e)||s_.has(e))return;sE.add(r),i.stopPropagation&&s_.add(e);let s=t(r,e),n=(e,t)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),sE.has(r)&&sE.delete(r),sA(e)&&"function"==typeof s&&s(e,{success:t})},o=e=>{n(e,r===window||r===document||i.useGlobalTarget||sy(r,e.target))},l=e=>{n(e,!1)};window.addEventListener("pointerup",o,a),window.addEventListener("pointercancel",l,a)};return r.forEach(e=>{((i.useGlobalTarget?window:e).addEventListener("pointerdown",n,a),sv(e))&&(e.addEventListener("focus",e=>((e,t)=>{let i=e.currentTarget;if(!i)return;let r=sb(()=>{if(sE.has(i))return;sT(i,"down");let e=sb(()=>{sT(i,"up")});i.addEventListener("keyup",e,t),i.addEventListener("blur",()=>sT(i,"cancel"),t)});i.addEventListener("keydown",r,t),i.addEventListener("blur",()=>i.removeEventListener("keydown",r),t)})(e,a)),r8.has(e.tagName)||!0===e.isContentEditable||e.hasAttribute("tabindex")||(e.tabIndex=0))}),s}(e,(e,t)=>(sS(this.node,t,"Start"),(e,{success:t})=>sS(this.node,e,t?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:i?.tap===!1})}unmount(){}}},focus:{Feature:class extends iL{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=iP(rH(this.node.current,"focus",()=>this.onFocus()),rH(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends iL{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,i={}){let[r,a,s]=sp(e,i);return r.forEach(e=>{let i,r=!1,s=!1,n=t=>{i&&(i(t),i=void 0),e.removeEventListener("pointerleave",l)},o=e=>{r=!1,window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",o),s&&(s=!1,n(e))},l=e=>{if("touch"!==e.pointerType){if(r){s=!0;return}n(e)}};e.addEventListener("pointerenter",r=>{if("touch"===r.pointerType||rV.x||rV.y)return;s=!1;let n=t(e,r);"function"==typeof n&&(i=n,e.addEventListener("pointerleave",l,a))},a),e.addEventListener("pointerdown",()=>{r=!0,window.addEventListener("pointerup",o,a),window.addEventListener("pointercancel",o,a)},a)}),s}(e,(e,t)=>(sg(this.node,t,"Start"),e=>sg(this.node,e,"End"))))}unmount(){}}},pan:{Feature:class extends iL{constructor(){super(...arguments),this.removePointerDownListener=ew}onPointerDown(e){this.session=new aa(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:at(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:av(e),onStart:av(t),onMove:av(i),onEnd:(e,t)=>{delete this.session,r&&eD.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=ae(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends iL{constructor(e){super(e),this.removeGroupControls=ew,this.removeListeners=ew,this.controls=new af(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ew}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:sf,MeasureLayout:a_},layout:{ProjectionNode:sf,MeasureLayout:a_}},(e,t)=>t.isSVG??t8(e)?new tG(t):new t3(t,{allowProjection:e!==t4.Fragment}));e.s(["motion",()=>sC],46932)},88653,e=>{"use strict";e.i(47167);var t=e.i(43476),i=e.i(71645),r=e.i(31178),a=e.i(47414),s=e.i(74008),n=e.i(21476),o=e.i(72846),l=i,d=e.i(37806);function u(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}class h extends l.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent&&!1!==this.props.pop){let e=t.offsetParent,
3358i=(0,o.isHTMLElement)(e)&&e.offsetWidth||0,r=(0,o.isHTMLElement)(e)&&e.offsetHeight||0,a=this.props.sizeRef.current;a.height=t.offsetHeight||0,a.width=t.offsetWidth||0,a.top=t.offsetTop,a.left=t.offsetLeft,a.right=i-a.width-a.left,a.bottom=r-a.height-a.top}return null}componentDidUpdate(){}render(){return this.props.children}}function c({children:e,isPresent:r,anchorX:a,anchorY:s,root:n,pop:o}){let c=(0,l.useId)(),m=(0,l.useRef)(null),f=(0,l.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:g}=(0,l.useContext)(d.MotionConfigContext),v=function(...e){return i.useCallback(function(...e){return t=>{let i=!1,r=e.map(e=>{let r=u(e,t);return i||"function"!=typeof r||(i=!0),r});if(i)return()=>{for(let t=0;t<r.length;t++){let i=r[t];"function"==typeof i?i():u(e[t],null)}}}}(...e),e)}(m,e.props?.ref??e?.ref);return(0,l.useInsertionEffect)(()=>{let{width:e,height:t,top:i,left:l,right:d,bottom:u}=f.current;if(r||!1===o||!m.current||!e||!t)return;let h="left"===a?`left: ${l}`:`right: ${d}`,v="bottom"===s?`bottom: ${u}`:`top: ${i}`;m.current.dataset.motionPopId=c;let y=document.createElement("style");g&&(y.nonce=g);let E=n??document.head;return E.appendChild(y),y.sheet&&y.sheet.insertRule(` 3359 [data-motion-pop-id="${c}"] { 3360 position: absolute !important; 3361 width: ${e}px !important; 3362 height: ${t}px !important; 3363 ${h}px !important; 3364 ${v}px !important; 3365 } 3366 `),()=>{E.contains(y)&&E.removeChild(y)}},[r]),(0,t.jsx)(h,{isPresent:r,childRef:m,sizeRef:f,pop:o,children:!1===o?e:l.cloneElement(e,{ref:v})})}let m=({children:e,initial:r,isPresent:s,onExitComplete:o,custom:l,presenceAffectsLayout:d,mode:u,anchorX:h,anchorY:m,root:g})=>{let v=(0,a.useConstant)(f),y=(0,i.useId)(),E=!0,b=(0,i.useMemo)(()=>(E=!1,{id:y,initial:r,isPresent:s,custom:l,onExitComplete:e=>
3366{for(let t of(v.set(e,!0),v.values()))if(!t)return;o&&o()},register:e=>(v.set(e,!1),()=>v.delete(e))}),[s,v,o]);return d&&E&&(b={...b}),(0,i.useMemo)(()=>{v.forEach((e,t)=>v.set(t,!1))},[s]),i.useEffect(()=>{s||v.size||!o||o()},[s]),e=(0,t.jsx)(c,{pop:"popLayout"===u,isPresent:s,anchorX:h,anchorY:m,root:g,children:e}),(0,t.jsx)(n.PresenceContext.Provider,{value:b,children:e})};function f(){return new Map}var g=e.i(64978);let v=e=>e.key||"";function y(e){let t=[];return i.Children.forEach(e,e=>{(0,i.isValidElement)(e)&&t.push(e)}),t}let E=({children:e,custom:n,initial:o=!0,onExitComplete:l,presenceAffectsLayout:d=!0,mode:u="sync",propagate:h=!1,anchorX:c="left",anchorY:f="top",root:E})=>{let[b,T]=(0,g.usePresence)(h),A=(0,i.useMemo)(()=>y(e),[e]),_=h&&!b?[]:A.map(v),S=(0,i.useRef)(!0),k=(0,i.useRef)(A),L=(0,a.useConstant)(()=>new Map),w=(0,i.useRef)(new Set),[R,I]=(0,i.useState)(A),[C,D]=(0,i.useState)(A);(0,s.useIsomorphicLayoutEffect)(()=>{S.current=!1,k.current=A;for(let e=0;e<C.length;e++){let t=v(C[e]);_.includes(t)?(L.delete(t),w.current.delete(t)):!0!==L.get(t)&&L.set(t,!1)}},[C,_.length,_.join("-")]);let x=[];if(A!==R){let e=[...A];for(let t=0;t<C.length;t++){let i=C[t],r=v(i);_.includes(r)||(e.splice(t,0,i),x.push(i))}return"wait"===u&&x.length&&(e=x),D(y(e)),I(A),null}let{forceRender:P}=(0,i.useContext)(r.LayoutGroupContext);return(0,t.jsx)(t.Fragment,{children:C.map(e=>{let i=v(e),r=(!h||!!b)&&(A===C||_.includes(i));return(0,t.jsx)(m,{isPresent:r,initial:(!S.current||!!o)&&void 0,custom:n,presenceAffectsLayout:d,mode:u,root:E,onExitComplete:r?void 0:()=>{if(w.current.has(i)||(w.current.add(i),!L.has(i)))return;L.set(i,!0);let e=!0;L.forEach(t=>{t||(e=!1)}),e&&(P?.(),D(k.current),h&&T?.(),l&&l())},anchorX:c,anchorY:f,children:e},i)})})};e.s(["AnimatePresence",()=>E],88653)}]);
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.