File manager - Edit - /opt/flussonic/wwwroot/flu/player/main.ba6d63bf3213ba56553b.js
Back
/*! For license information please see main.ba6d63bf3213ba56553b.js.LICENSE.txt */ var LivePlayer=function(t){function e(e){for(var n,a,o=e[0],l=e[1],c=e[2],h=0,d=[];h<o.length;h++)a=o[h],Object.prototype.hasOwnProperty.call(i,a)&&i[a]&&d.push(i[a][0]),i[a]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(t[n]=l[n]);for(u&&u(e);d.length;)d.shift()();return s.push.apply(s,c||[]),r()}function r(){for(var t,e=0;e<s.length;e++){for(var r=s[e],n=!0,o=1;o<r.length;o++){var l=r[o];0!==i[l]&&(n=!1)}n&&(s.splice(e--,1),t=a(a.s=r[0]))}return t}var n={},i={3:0},s=[];function a(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=t,a.c=n,a.d=function(t,e,r){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)a.d(r,n,function(e){return t[e]}.bind(null,n));return r},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="/flu/player/";var o=this.webpackJsonpLivePlayer=this.webpackJsonpLivePlayer||[],l=o.push.bind(o);o.push=e,o=o.slice();for(var c=0;c<o.length;c++)e(o[c]);var u=l;return s.push([205,1,5,4,0,2,6]),r()}([function(t,e,r){"use strict";r.d(e,"b",(function(){return i})),r.d(e,"a",(function(){return s})),r.d(e,"e",(function(){return a})),r.d(e,"c",(function(){return o})),r.d(e,"d",(function(){return l}));var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)};function i(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var s=function(){return s=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},s.apply(this,arguments)};function a(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,s=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=s.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return a}function l(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(o(arguments[e]));return t}},,,function(t,e){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.__esModule=!0,t.exports.default=t.exports,r(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},,function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(124);function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}t.exports=function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(61).default,i=r(207);t.exports=function(t,e){if(e&&("object"==n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return i(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(208);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&n(t,e)},t.exports.__esModule=!0,t.exports.default=t.exports},,,,,,,function(t,e,r){var n=r(364);function i(){return t.exports=i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var i=n(t,e);if(i){var s=Object.getOwnPropertyDescriptor(i,e);return s.get?s.get.call(arguments.length<3?t:r):s.value}},t.exports.__esModule=!0,t.exports.default=t.exports,i.apply(null,arguments)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},,function(t,e,r){var n=r(124);t.exports=function(t,e,r){return(e=n(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.__esModule=!0,t.exports.default=t.exports},,,,,,,,,function(t,e,r){"use strict";r.d(e,"i",(function(){return L})),r.d(e,"j",(function(){return y})),r.d(e,"h",(function(){return v})),r.d(e,"g",(function(){return E})),r.d(e,"c",(function(){return b})),r.d(e,"e",(function(){return S})),r.d(e,"b",(function(){return R})),r.d(e,"f",(function(){return _})),r.d(e,"a",(function(){return A})),r.d(e,"d",(function(){return k}));var n=r(17),i=r.n(n),s=r(165),a=r.n(s),o=r(61),l=r.n(o),c=r(121),u=r.n(c);function h(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function d(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?h(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var f="authTokenName",p=["streamName",f,"authToken","autoplay","ago","debug","duration","from","timeshift","logo","poster","hasPreview","isVideoPoster","proto","play_duration","realtime","to","tracks","liveSyncDurationCount","url","source","sentryConfig","chromeless","filter.tracks"],g=function(t){return t[f]||"token"};function m(t){if("string"==typeof t){if("false"===t.toLowerCase()||"0"===t)return!1;if("true"===t.toLowerCase()||"1"===t)return!0}return null}var y=function(t,e){var r=u()({url:t}),n=r.pathname.split("/").filter((function(t){return""!==t&&-1===t.indexOf(".html")})).join("/"),i=r.query,s={};i&&(s=i.split("&").filter((function(t){return""!==t})).reduce((function(t,e){var r=e.split("="),n=a()(r,2),i=n[0],s=n[1],o=function(t){return decodeURIComponent(t)};return t[o(i)]=o(s),t}),{}));var o,c,h=e.reduce((function(t,e){return d(d({},t),e)}),{}),f=d(d({},s),h),p=f.baseUrl,y=p&&u()({url:p})||r,v=d(d(d({},{host:y.host,hostname:y.hostname,protocol:y.protocol,port:y.port,streamName:n}),s),f);return null!=v.volume&&(v.volume=(o=v.volume,(c=parseInt(o,10))>=0&&c<=100?c:void 0)),1===v.mute?v.mute=!0:0===v.mute&&(v.mute=!1),function(t,e){var r={};for(var n in t){var i=t[n];"streamName"===n||e&&e.indexOf(n)>-1||null!==i&&"object"===l()(i)?r[n]=i:r[n]=null!=m(i)?m(i):i}return r}(v,[g(v),"volume"])};function v(t){var e=g(t);return[].concat(p,e?[e]:[])}function E(t){var e=g(t),r=t[e];return r?"".concat(e,"=").concat(r):void 0}var b=function(t){var e=t.from,r=t.to;return e&&r&&r-e>0?r-e:void 0},T=function(t,e){return e?"".concat(t).concat(t.includes("?")?"&":"?").concat(e):t};function S(t){if(!1===t.poster)return{isVideoPoster:!1,poster:!1};var e,r,n,i,s,a;return{isVideoPoster:!t.hasPreview,poster:(e=E(t),r=t.host,n=t.protocol,i=t.streamName,s=t.hasPreview?"jpg":"mp4",a="".concat(n,"//").concat(r,"/").concat(i,"/preview.").concat(s),T(a,e))}}var A=function(t,e){var r=t.authToken,n=t.protocol,i=t.host,s=t.streamName;return T("".concat(n,"//").concat(i,"/").concat(s,"/").concat(e),r)},_=function(t,e){var r=t.proto,n=t.streamName,i=t.ago,s=t.from,a=t.duration,o=t.realtime,l=t.protocol,c=t.host,u=t.debug,h=t.authToken,d=t.url,f=t.source,p=t.timeshift,g=t.filterTracks;return function(){var t=d||f,m=".fmp4.m3u8";switch(r){case"dash":m=".mpd";break;case"ll-hls":m=o?".ll.m3u8":".fmp4.m3u8";break;default:m=".fmp4.m3u8"}return window.navigator.userAgent.includes("(Web0S; Linux/SmartTV)")&&(m="dash"),t||(t="//".concat(c,"/").concat(n,"/"),o&&e&&!i?"ll-hls"!==r&&e?t+="mse_ld".concat(s?"?from=".concat(s):""):t="".concat(l).concat(t,"index").concat(m):(t="".concat(l).concat(t),t+=i?"rewind-".concat(i).concat("dash"===r?"?thumbnails=100":""):s?"archive-".concat(s,"-").concat(a||"7200"):!p||"hls"!==r&&r?"index":"timeshift_".concat(p.length>=10?"abs":"rel","-").concat(p),t+=m,(i||s||p&&("hls"===r||!r))&&(t=t.replace(".fmp4","")))),t=T(t,h),g&&(t="".concat(t).concat(t.includes("?")?"&":"?","filter.tracks=").concat(g)),u&&console.info("set source",t),t}},k=function(t){var e=t.streamName,r=t.host,n=t.authToken,i="//".concat(r,"/").concat(e,"/media_info.json");return i=T(i,n)},L=function(){var t=window.navigator.userAgent;if(t.includes("Chrome")){var e=t.split("Chrome/")[1];if(Number(e.split(".")[0])>=107)return!0}else if(t.includes("Safari"))return!0;return!1},w=function(t,e){return e.indexOf(t)>-1};function R(t,e){return function(r){var n=w(r,e)?t[r]:void 0;return"true"===n||"on"===n||"false"!==n&&"off"!==n&&n}}},,,,,function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(t,e,r){"use strict";var n,i=r(374),s=r(375),a=r(376),o=r(377),l=r(157),c=r(70),u=r(378),h=Function,d=function(t){try{return h('"use strict"; return ('+t+").constructor;")()}catch(t){}},f=Object.getOwnPropertyDescriptor;if(f)try{f({},"")}catch(t){f=null}var p=function(){throw new c},g=f?function(){try{return p}catch(t){try{return f(arguments,"callee").get}catch(t){return p}}}():p,m=r(379)(),y=r(381)(),v=Object.getPrototypeOf||(y?function(t){return t.__proto__}:null),E={},b="undefined"!=typeof Uint8Array&&v?v(Uint8Array):n,T={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":m&&v?v([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":E,"%AsyncGenerator%":E,"%AsyncGeneratorFunction%":E,"%AsyncIteratorPrototype%":E,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":s,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":h,"%GeneratorFunction%":E,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":m&&v?v(v([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&m&&v?v((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":a,"%ReferenceError%":o,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&m&&v?v((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":m&&v?v(""[Symbol.iterator]()):n,"%Symbol%":m?Symbol:n,"%SyntaxError%":l,"%ThrowTypeError%":g,"%TypedArray%":b,"%TypeError%":c,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":u,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet};if(v)try{null.error}catch(t){var S=v(v(t));T["%Error.prototype%"]=S}var A=function t(e){var r;if("%AsyncFunction%"===e)r=d("async function () {}");else if("%GeneratorFunction%"===e)r=d("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=d("async function* () {}");else if("%AsyncGenerator%"===e){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&v&&(r=v(i.prototype))}return T[e]=r,r},_={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},k=r(118),L=r(383),w=k.call(Function.call,Array.prototype.concat),R=k.call(Function.apply,Array.prototype.splice),C=k.call(Function.call,String.prototype.replace),D=k.call(Function.call,String.prototype.slice),I=k.call(Function.call,RegExp.prototype.exec),x=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,P=/\\(\\)?/g,O=function(t,e){var r,n=t;if(L(_,n)&&(n="%"+(r=_[n])[0]+"%"),L(T,n)){var i=T[n];if(i===E&&(i=A(n)),void 0===i&&!e)throw new c("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new l("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new c('"allowMissing" argument must be a boolean');if(null===I(/^%?[^%]*%?$/,t))throw new l("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=D(t,0,1),r=D(t,-1);if("%"===e&&"%"!==r)throw new l("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new l("invalid intrinsic syntax, expected opening `%`");var n=[];return C(t,x,(function(t,e,r,i){n[n.length]=r?C(i,P,"$1"):e||t})),n}(t),n=r.length>0?r[0]:"",i=O("%"+n+"%",e),s=i.name,a=i.value,o=!1,u=i.alias;u&&(n=u[0],R(r,w([0,1],u)));for(var h=1,d=!0;h<r.length;h+=1){var p=r[h],g=D(p,0,1),m=D(p,-1);if(('"'===g||"'"===g||"`"===g||'"'===m||"'"===m||"`"===m)&&g!==m)throw new l("property names with quotes must have matching quotes");if("constructor"!==p&&d||(o=!0),L(T,s="%"+(n+="."+p)+"%"))a=T[s];else if(null!=a){if(!(p in a)){if(!e)throw new c("base intrinsic for "+t+" exists, but the property is not available.");return}if(f&&h+1>=r.length){var y=f(a,p);a=(d=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:a[p]}else d=L(a,p),a=a[p];d&&!o&&(T[s]=a)}}return a}},function(t,e){function r(e){return t.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,r(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(361),i=r(362),s=r(155),a=r(363);t.exports=function(t){return n(t)||i(t)||s(t)||a()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(365)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},,,,,,,function(t,e,r){"use strict";t.exports=TypeError},,,,,,function(t,e){var r,n,i=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(r===setTimeout)return setTimeout(t,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(t){r=s}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var l,c=[],u=!1,h=-1;function d(){u&&l&&(u=!1,l.length?c=l.concat(c):h=-1,c.length&&f())}function f(){if(!u){var t=o(d);u=!0;for(var e=c.length;e;){for(l=c,c=[];++h<e;)l&&l[h].run();h=-1,e=c.length}l=null,u=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{return n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function g(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new p(t,e)),1!==c.length||u||o(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},,,,,,,,,,,,,function(t,e){function r(t,e,r,n,i,s,a){try{var o=t[s](a),l=o.value}catch(t){return void r(t)}o.done?e(l):Promise.resolve(l).then(n,i)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(i,s){var a=t.apply(e,n);function o(t){r(a,i,s,o,l,"next",t)}function l(t){r(a,i,s,o,l,"throw",t)}o(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},,function(t,e,r){"use strict";r.d(e,"a",(function(){return a})),r.d(e,"b",(function(){return c}));var n=r(17),i=r.n(n);r(122);function s(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){var e=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?s(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},{media:{width:0,height:0},letterboxing:{horizontal:0,vertical:0}});return e.media.width=t.media.width*t.dom.height/t.media.height,e.media.height=t.media.height*e.media.width/t.media.width,e.media.width>t.dom.width&&(e.media.height=t.media.height*t.dom.width/t.media.width,e.media.width=t.media.width*e.media.height/t.media.height),e.media.width<t.dom.width?e.letterboxing.horizontal=Math.floor((t.dom.width-e.media.width)/2):e.media.height<t.dom.height&&(e.letterboxing.vertical=Math.floor((t.dom.height-e.media.height)/2)),e.media.width=Math.floor(e.media.width),e.media.height=Math.floor(e.media.height),e}var o,l=(o=Date.now(),function(t){var e=Date.now();e-o>16?(o=e,t(e)):setTimeout((function(){polyfill(t)}),0)});window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame;function c(t){var e=window,r=e.innerWidth,n=e.innerHeight,i=document.documentElement,s=i.clientHeight,a=i.clientWidth,o=t.getBoundingClientRect(),l=o.bottom,c=o.right,u=o.left,h=o.top;return l>=0&&c>=0&&h<=(n||s)&&u<=(r||a)}},,,,function(t,e,r){"use strict";r.d(e,"a",(function(){return ro}));var n=r(62),i=r.n(n),s=r(17),a=r.n(s),o=r(5),l=r.n(o),c=r(6),u=r.n(c),h=r(7),d=r.n(h),f=r(3),p=r.n(f),g=r(15),m=r.n(g),y=r(8),v=r.n(y),E=r(4);function b(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var T={exports:{}};!function(t){var e,r,n,i,s;e=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,i=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsoluteURL:function(t,e,n){if(n=n||{},t=t.trim(),!(e=e.trim())){if(!n.alwaysNormalize)return t;var i=s.parseURL(t);if(!i)throw new Error("Error trying to parse base URL.");return i.path=s.normalizePath(i.path),s.buildURLFromParts(i)}var a=s.parseURL(e);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return n.alwaysNormalize?(a.path=s.normalizePath(a.path),s.buildURLFromParts(a)):e;var o=s.parseURL(t);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=r.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var c={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(c.netLoc=o.netLoc,"/"!==a.path[0]))if(a.path){var u=o.path,h=u.substring(0,u.lastIndexOf("/")+1)+a.path;c.path=s.normalizePath(h)}else c.path=o.path,a.params||(c.params=o.params,a.query||(c.query=o.query));return null===c.path&&(c.path=n.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(c)},parseURL:function(t){var r=e.exec(t);return r?{scheme:r[1]||"",netLoc:r[2]||"",path:r[3]||"",params:r[4]||"",query:r[5]||"",fragment:r[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(n,"");t.length!==(t=t.replace(i,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}},t.exports=s}(T);var S=T.exports;function A(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?A(Object(r),!0).forEach((function(e){L(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function k(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function L(t,e,r){return(e=k(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function w(){return w=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},w.apply(this,arguments)}const R=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},C=Number.isSafeInteger||function(t){return"number"==typeof t&&Math.abs(t)<=D},D=Number.MAX_SAFE_INTEGER||9007199254740991;let I=function(t){return t.MEDIA_ATTACHING="hlsMediaAttaching",t.MEDIA_ATTACHED="hlsMediaAttached",t.MEDIA_DETACHING="hlsMediaDetaching",t.MEDIA_DETACHED="hlsMediaDetached",t.BUFFER_RESET="hlsBufferReset",t.BUFFER_CODECS="hlsBufferCodecs",t.BUFFER_CREATED="hlsBufferCreated",t.BUFFER_APPENDING="hlsBufferAppending",t.BUFFER_APPENDED="hlsBufferAppended",t.BUFFER_EOS="hlsBufferEos",t.BUFFER_FLUSHING="hlsBufferFlushing",t.BUFFER_FLUSHED="hlsBufferFlushed",t.MANIFEST_LOADING="hlsManifestLoading",t.MANIFEST_LOADED="hlsManifestLoaded",t.MANIFEST_PARSED="hlsManifestParsed",t.LEVEL_SWITCHING="hlsLevelSwitching",t.LEVEL_SWITCHED="hlsLevelSwitched",t.LEVEL_LOADING="hlsLevelLoading",t.LEVEL_LOADED="hlsLevelLoaded",t.LEVEL_UPDATED="hlsLevelUpdated",t.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",t.LEVELS_UPDATED="hlsLevelsUpdated",t.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",t.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",t.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",t.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",t.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",t.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",t.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",t.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",t.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",t.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",t.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",t.CUES_PARSED="hlsCuesParsed",t.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",t.INIT_PTS_FOUND="hlsInitPtsFound",t.FRAG_LOADING="hlsFragLoading",t.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",t.FRAG_LOADED="hlsFragLoaded",t.FRAG_DECRYPTED="hlsFragDecrypted",t.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",t.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",t.FRAG_PARSING_METADATA="hlsFragParsingMetadata",t.FRAG_PARSED="hlsFragParsed",t.FRAG_BUFFERED="hlsFragBuffered",t.FRAG_CHANGED="hlsFragChanged",t.FPS_DROP="hlsFpsDrop",t.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",t.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",t.ERROR="hlsError",t.DESTROYING="hlsDestroying",t.KEY_LOADING="hlsKeyLoading",t.KEY_LOADED="hlsKeyLoaded",t.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",t.BACK_BUFFER_REACHED="hlsBackBufferReached",t.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",t}({}),x=function(t){return t.NETWORK_ERROR="networkError",t.MEDIA_ERROR="mediaError",t.KEY_SYSTEM_ERROR="keySystemError",t.MUX_ERROR="muxError",t.OTHER_ERROR="otherError",t}({}),P=function(t){return t.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",t.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",t.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",t.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_PARSING_ERROR="levelParsingError",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.FRAG_GAP="fragGap",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.UNKNOWN="unknown",t}({});const O=function(){},M={trace:O,debug:O,log:O,warn:O,info:O,error:O};let F=M;function B(t,...e){e.forEach((function(e){F[e]=t[e]?t[e].bind(t):function(t){const e=self.console[t];return e?e.bind(self.console,`[${t}] >`):O}(e)}))}const N=F,U=/^(\d+)x(\d+)$/,$=/(.+?)=(".*?"|.*?)(?:,|$)/g;class j{constructor(t){"string"==typeof t&&(t=j.parseAttrList(t)),w(this,t)}get clientAttrs(){return Object.keys(this).filter((t=>"X-"===t.substring(0,2)))}decimalInteger(t){const e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e}hexadecimalInteger(t){if(this[t]){let e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;const r=new Uint8Array(e.length/2);for(let t=0;t<e.length/2;t++)r[t]=parseInt(e.slice(2*t,2*t+2),16);return r}return null}hexadecimalIntegerAsNumber(t){const e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e}decimalFloatingPoint(t){return parseFloat(this[t])}optionalFloat(t,e){const r=this[t];return r?parseFloat(r):e}enumeratedString(t){return this[t]}bool(t){return"YES"===this[t]}decimalResolution(t){const e=U.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}}static parseAttrList(t){let e;const r={};for($.lastIndex=0;null!==(e=$.exec(t));){let t=e[2];0===t.indexOf('"')&&t.lastIndexOf('"')===t.length-1&&(t=t.slice(1,-1));r[e[1].trim()]=t}return r}}function G(t){return"SCTE35-OUT"===t||"SCTE35-IN"===t}class K{constructor(t,e){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,e){const r=e.attr;for(const e in r)if(Object.prototype.hasOwnProperty.call(t,e)&&t[e]!==r[e]){N.warn(`DATERANGE tag attribute: "${e}" does not match for tags with ID: "${t.ID}"`),this._badValueForSameId=e;break}t=w(new j({}),r,t)}if(this.attr=t,this._startDate=new Date(t["START-DATE"]),"END-DATE"in this.attr){const t=new Date(this.attr["END-DATE"]);R(t.getTime())&&(this._endDate=t)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const t=this.duration;return null!==t?new Date(this._startDate.getTime()+1e3*t):null}get duration(){if("DURATION"in this.attr){const t=this.attr.decimalFloatingPoint("DURATION");if(R(t))return t}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&R(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class H{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 V="audio",W="video",Y="audiovideo";class q{constructor(t){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[V]:null,[W]:null,[Y]:null},this.baseurl=t}setByteRange(t,e){const r=t.split("@",2);let n;n=1===r.length?(null==e?void 0:e.byteRangeEndOffset)||0:parseInt(r[1]),this._byteRange=[n,parseInt(r[0])+n]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=S.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(t){this._url=t}}class z extends q{constructor(t,e){super(e),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new H,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=t}get decryptdata(){const{levelkeys:t}=this;if(!t&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const t=Object.keys(this.levelkeys);if(1===t.length)return this._decryptdata=this.levelkeys[t[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;if(!R(this.programDateTime))return null;const t=R(this.duration)?this.duration:0;return this.programDateTime+1e3*t}get encrypted(){var t;if(null!=(t=this._decryptdata)&&t.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),e=t.length;if(e>1||1===e&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(t){if(this.levelkeys){const e=this.levelkeys[t];e&&!this._decryptdata&&(this._decryptdata=e.getDecryptData(this.sn))}}abortRequests(){var t,e;null==(t=this.loader)||t.abort(),null==(e=this.keyLoader)||e.abort()}setElementaryStreamInfo(t,e,r,n,i,s=!1){const{elementaryStreams:a}=this,o=a[t];o?(o.startPTS=Math.min(o.startPTS,e),o.endPTS=Math.max(o.endPTS,r),o.startDTS=Math.min(o.startDTS,n),o.endDTS=Math.max(o.endDTS,i)):a[t]={startPTS:e,endPTS:r,startDTS:n,endDTS:i,partial:s}}clearElementaryStreamInfo(){const{elementaryStreams:t}=this;t[V]=null,t[W]=null,t[Y]=null}}class X extends q{constructor(t,e,r,n,i){super(r),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new H,this.duration=t.decimalFloatingPoint("DURATION"),this.gap=t.bool("GAP"),this.independent=t.bool("INDEPENDENT"),this.relurl=t.enumeratedString("URI"),this.fragment=e,this.index=n;const s=t.enumeratedString("BYTERANGE");s&&this.setByteRange(s,i),i&&(this.fragOffset=i.fragOffset+i.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:t}=this;return!!(t.audio||t.video||t.audiovideo)}}class Q{constructor(t){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=t}reloaded(t){if(!t)return this.advanced=!0,void(this.updated=!0);const e=this.lastPartSn-t.lastPartSn,r=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!r||!!e||!this.live,this.advanced=this.endSN>t.endSN||e>0||0===e&&r>0,this.updated||this.advanced?this.misses=Math.floor(.6*t.misses):this.misses=t.misses+1,this.availabilityDelay=t.availabilityDelay}get hasProgramDateTime(){return!!this.fragments.length&&R(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const t=this.driftEndTime-this.driftStartTime;if(t>0){return 1e3*(this.driftEnd-this.driftStart)/t}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var t;return null!=(t=this.fragments)&&t.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function J(t){return Uint8Array.from(atob(t),(t=>t.charCodeAt(0)))}function Z(t){const e=t.split(":");let r=null;if("data"===e[0]&&2===e.length){const t=e[1].split(";"),n=t[t.length-1].split(",");if(2===n.length){const e="base64"===n[0],i=n[1];e?(t.splice(-1,1),r=J(i)):r=function(t){const e=tt(t).subarray(0,16),r=new Uint8Array(16);return r.set(e,16-e.length),r}(i)}}return r}function tt(t){return Uint8Array.from(unescape(encodeURIComponent(t)),(t=>t.charCodeAt(0)))}const et="undefined"!=typeof self?self:void 0;var rt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},nt="org.w3.clearkey",it="com.apple.streamingkeydelivery",st="com.microsoft.playready",at="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function ot(t){switch(t){case it:return rt.FAIRPLAY;case st:return rt.PLAYREADY;case at:return rt.WIDEVINE;case nt:return rt.CLEARKEY}}var lt="1077efecc0b24d02ace33c1e52e2fb4b",ct="e2719d58a985b3c9781ab030af78d30e",ut="9a04f07998404286ab92e65be0885f95",ht="edef8ba979d64acea3c827dcd51d21ed";function dt(t){return t===ht?rt.WIDEVINE:t===ut?rt.PLAYREADY:t===lt||t===ct?rt.CLEARKEY:void 0}function ft(t){switch(t){case rt.FAIRPLAY:return it;case rt.PLAYREADY:return st;case rt.WIDEVINE:return at;case rt.CLEARKEY:return nt}}function pt(t){const{drmSystems:e,widevineLicenseUrl:r}=t,n=e?[rt.FAIRPLAY,rt.WIDEVINE,rt.PLAYREADY,rt.CLEARKEY].filter((t=>!!e[t])):[];return!n[rt.WIDEVINE]&&r&&n.push(rt.WIDEVINE),n}const gt=null!=et&&null!=(mt=et.navigator)&&mt.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var mt;function yt(t,e,r){return Uint8Array.prototype.slice?t.slice(e,r):new Uint8Array(Array.prototype.slice.call(t,e,r))}const vt=(t,e)=>e+10<=t.length&&73===t[e]&&68===t[e+1]&&51===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128,Et=(t,e)=>e+10<=t.length&&51===t[e]&&68===t[e+1]&&73===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128,bt=(t,e)=>{const r=e;let n=0;for(;vt(t,e);){n+=10;n+=Tt(t,e+6),Et(t,e+10)&&(n+=10),e+=n}if(n>0)return t.subarray(r,r+n)},Tt=(t,e)=>{let r=0;return r=(127&t[e])<<21,r|=(127&t[e+1])<<14,r|=(127&t[e+2])<<7,r|=127&t[e+3],r},St=(t,e)=>vt(t,e)&&Tt(t,e+6)+10<=t.length-e,At=t=>{const e=Lt(t);for(let t=0;t<e.length;t++){const r=e[t];if(_t(r))return It(r)}},_t=t=>t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info,kt=t=>{const e=String.fromCharCode(t[0],t[1],t[2],t[3]),r=Tt(t,4);return{type:e,size:r,data:t.subarray(10,10+r)}},Lt=t=>{let e=0;const r=[];for(;vt(t,e);){const n=Tt(t,e+6);e+=10;const i=e+n;for(;e+8<i;){const n=kt(t.subarray(e)),i=wt(n);i&&r.push(i),e+=n.size+10}Et(t,e)&&(e+=10)}return r},wt=t=>"PRIV"===t.type?Rt(t):"W"===t.type[0]?Dt(t):Ct(t),Rt=t=>{if(t.size<2)return;const e=xt(t.data,!0),r=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:r.buffer}},Ct=t=>{if(t.size<2)return;if("TXXX"===t.type){let e=1;const r=xt(t.data.subarray(e),!0);e+=r.length+1;const n=xt(t.data.subarray(e));return{key:t.type,info:r,data:n}}const e=xt(t.data.subarray(1));return{key:t.type,data:e}},Dt=t=>{if("WXXX"===t.type){if(t.size<2)return;let e=1;const r=xt(t.data.subarray(e),!0);e+=r.length+1;const n=xt(t.data.subarray(e));return{key:t.type,info:r,data:n}}const e=xt(t.data);return{key:t.type,data:e}},It=t=>{if(8===t.data.byteLength){const e=new Uint8Array(t.data),r=1&e[3];let n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,r&&(n+=47721858.84),Math.round(n)}},xt=(t,e=!1)=>{const r=Ot();if(r){const n=r.decode(t);if(e){const t=n.indexOf("\0");return-1!==t?n.substring(0,t):n}return n.replace(/\0/g,"")}const n=t.length;let i,s,a,o="",l=0;for(;l<n;){if(i=t[l++],0===i&&e)return o;if(0!==i&&3!==i)switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(i);break;case 12:case 13:s=t[l++],o+=String.fromCharCode((31&i)<<6|63&s);break;case 14:s=t[l++],a=t[l++],o+=String.fromCharCode((15&i)<<12|(63&s)<<6|63&a)}}return o};let Pt;function Ot(){if(!navigator.userAgent.includes("PlayStation 4"))return Pt||void 0===self.TextDecoder||(Pt=new self.TextDecoder("utf-8")),Pt}const Mt=function(t){let e="";for(let r=0;r<t.length;r++){let n=t[r].toString(16);n.length<2&&(n="0"+n),e+=n}return e},Ft=Math.pow(2,32)-1,Bt=[].push,Nt={video:1,audio:2,id3:3,text:4};function Ut(t){return String.fromCharCode.apply(null,t)}function $t(t,e){const r=t[e]<<8|t[e+1];return r<0?65536+r:r}function jt(t,e){const r=Kt(t,e);return r<0?4294967296+r:r}function Gt(t,e){let r=jt(t,e);return r*=Math.pow(2,32),r+=jt(t,e+4),r}function Kt(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function Ht(t,e,r){t[e]=r>>24,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r}function Vt(t,e){const r=[];if(!e.length)return r;const n=t.byteLength;for(let i=0;i<n;){const s=jt(t,i),a=s>1?i+s:n;if(Ut(t.subarray(i+4,i+8))===e[0])if(1===e.length)r.push(t.subarray(i+8,a));else{const n=Vt(t.subarray(i+8,a),e.slice(1));n.length&&Bt.apply(r,n)}i=a}return r}function Wt(t){const e=[],r=t[0];let n=8;const i=jt(t,n);n+=4;let s=0,a=0;0===r?(s=jt(t,n),a=jt(t,n+4),n+=8):(s=Gt(t,n),a=Gt(t,n+8),n+=16),n+=2;let o=t.length+a;const l=$t(t,n);n+=2;for(let r=0;r<l;r++){let r=n;const s=jt(t,r);r+=4;const a=2147483647&s;if(1===(2147483648&s)>>>31)return N.warn("SIDX has hierarchical references (not supported)"),null;const l=jt(t,r);r+=4,e.push({referenceSize:a,subsegmentDuration:l,info:{duration:l/i,start:o,end:o+a-1}}),o+=a,r+=4,n=r}return{earliestPresentationTime:s,timescale:i,version:r,referencesCount:l,references:e}}function Yt(t){const e=[],r=Vt(t,["moov","trak"]);for(let t=0;t<r.length;t++){const n=r[t],i=Vt(n,["tkhd"])[0];if(i){let t=i[0];const r=jt(i,0===t?12:20),s=Vt(n,["mdia","mdhd"])[0];if(s){t=s[0];const i=jt(s,0===t?12:20),a=Vt(n,["mdia","hdlr"])[0];if(a){const t=Ut(a.subarray(8,12)),s={soun:V,vide:W}[t];if(s){const t=qt(Vt(n,["mdia","minf","stbl","stsd"])[0]);e[r]={timescale:i,type:s},e[s]=_({timescale:i,id:r},t)}}}}}return Vt(t,["moov","mvex","trex"]).forEach((t=>{const r=jt(t,4),n=e[r];n&&(n.default={duration:jt(t,12),flags:jt(t,20)})})),e}function qt(t){const e=t.subarray(8),r=e.subarray(86),n=Ut(e.subarray(4,8));let i=n;const s="enca"===n||"encv"===n;if(s){const t=Vt(e,[n])[0];Vt(t.subarray("enca"===n?28:78),["sinf"]).forEach((t=>{const e=Vt(t,["schm"])[0];if(e){const r=Ut(e.subarray(4,8));if("cbcs"===r||"cenc"===r){const e=Vt(t,["frma"])[0];e&&(i=Ut(e))}}}))}switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const t=Vt(r,["avcC"])[0];i+="."+Xt(t[1])+Xt(t[2])+Xt(t[3]);break}case"mp4a":{const t=Vt(e,[n])[0],r=Vt(t.subarray(28),["esds"])[0];if(r&&r.length>12){let t=4;if(3!==r[t++])break;t=zt(r,t),t+=2;const e=r[t++];if(128&e&&(t+=2),64&e&&(t+=r[t++]),4!==r[t++])break;t=zt(r,t);const n=r[t++];if(64!==n)break;if(i+="."+Xt(n),t+=12,5!==r[t++])break;t=zt(r,t);const s=r[t++];let a=(248&s)>>3;31===a&&(a+=1+((7&s)<<3)+((224&r[t])>>5)),i+="."+a}break}case"hvc1":case"hev1":{const t=Vt(r,["hvcC"])[0],e=t[1],n=["","A","B","C"][e>>6],s=31&e,a=jt(t,2),o=(32&e)>>5?"H":"L",l=t[12],c=t.subarray(6,12);i+="."+n+s,i+="."+a.toString(16).toUpperCase(),i+="."+o+l;let u="";for(let t=c.length;t--;){const e=c[t];if(e||u){u="."+e.toString(16).toUpperCase()+u}}i+=u;break}case"dvh1":case"dvhe":{const t=Vt(r,["dvcC"])[0],e=t[2]>>1&127,n=t[2]<<5&32|t[3]>>3&31;i+="."+Qt(e)+"."+Qt(n);break}case"vp09":{const t=Vt(r,["vpcC"])[0],e=t[4],n=t[5],s=t[6]>>4&15;i+="."+Qt(e)+"."+Qt(n)+"."+Qt(s);break}case"av01":{const t=Vt(r,["av1C"])[0],e=t[1]>>>5,n=31&t[1],s=t[2]>>>7?"H":"M",a=(64&t[2])>>6,o=(32&t[2])>>5,l=2===e&&a?o?12:10:a?10:8,c=(16&t[2])>>4,u=(8&t[2])>>3,h=(4&t[2])>>2,d=3&t[2],f=1,p=1,g=1,m=0;i+="."+e+"."+Qt(n)+s+"."+Qt(l)+"."+c+"."+u+h+d+"."+Qt(f)+"."+Qt(p)+"."+Qt(g)+"."+m;break}}return{codec:i,encrypted:s}}function zt(t,e){const r=e+5;for(;128&t[e++]&&e<r;);return e}function Xt(t){return("0"+t.toString(16).toUpperCase()).slice(-2)}function Qt(t){return(t<10?"0":"")+t}function Jt(t){const e=Vt(t,["schm"])[0];if(e){const r=Ut(e.subarray(4,8));if("cbcs"===r||"cenc"===r)return Vt(t,["schi","tenc"])[0]}return null}function Zt(t){const e=jt(t,0);let r=8;1&e&&(r+=4),4&e&&(r+=4);let n=0;const i=jt(t,4);for(let s=0;s<i;s++){if(256&e){n+=jt(t,r),r+=4}512&e&&(r+=4),1024&e&&(r+=4),2048&e&&(r+=4)}return n}function te(t,e){const r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r}function ee(t,e){const r=[],n=e.samples,i=e.timescale,s=e.id;let a=!1;return Vt(n,["moof"]).map((o=>{const l=o.byteOffset-8;Vt(o,["traf"]).map((o=>{const c=Vt(o,["tfdt"]).map((t=>{const e=t[0];let r=jt(t,4);return 1===e&&(r*=Math.pow(2,32),r+=jt(t,8)),r/i}))[0];return void 0!==c&&(t=c),Vt(o,["tfhd"]).map((c=>{const u=jt(c,4),h=16777215&jt(c,0);let d=0;const f=!!(16&h);let p=0;const g=!!(32&h);let m=8;u===s&&(!!(1&h)&&(m+=8),!!(2&h)&&(m+=4),!!(8&h)&&(d=jt(c,m),m+=4),f&&(p=jt(c,m),m+=4),g&&(m+=4),"video"===e.type&&(a=function(t){if(!t)return!1;const e=t.indexOf("."),r=e<0?t:t.substring(0,e);return"hvc1"===r||"hev1"===r||"dvh1"===r||"dvhe"===r}(e.codec)),Vt(o,["trun"]).map((s=>{const o=s[0],c=16777215&jt(s,0),u=!!(1&c);let h=0;const f=!!(4&c),g=!!(256&c);let m=0;const y=!!(512&c);let v=0;const E=!!(1024&c),b=!!(2048&c);let T=0;const S=jt(s,4);let A=8;u&&(h=jt(s,A),A+=4),f&&(A+=4);let _=h+l;for(let l=0;l<S;l++){if(g?(m=jt(s,A),A+=4):m=d,y?(v=jt(s,A),A+=4):v=p,E&&(A+=4),b&&(T=0===o?jt(s,A):Kt(s,A),A+=4),e.type===W){let e=0;for(;e<v;){const s=jt(n,_);if(_+=4,re(a,n[_])){ne(n.subarray(_,_+s),a?2:1,t+T/i,r)}_+=s,e+=s+4}}t+=m/i}})))}))}))})),r}function re(t,e){if(t){const t=e>>1&63;return 39===t||40===t}return 6===(31&e)}function ne(t,e,r,n){const i=ie(t);let s=0;s+=e;let a=0,o=0,l=0;for(;s<i.length;){a=0;do{if(s>=i.length)break;l=i[s++],a+=l}while(255===l);o=0;do{if(s>=i.length)break;l=i[s++],o+=l}while(255===l);const t=i.length-s;let e=s;if(o<t)s+=o;else if(o>t){N.error(`Malformed SEI payload. ${o} is too small, only ${t} bytes left to parse.`);break}if(4===a){if(181===i[e++]){const t=$t(i,e);if(e+=2,49===t){const t=jt(i,e);if(e+=4,1195456820===t){const t=i[e++];if(3===t){const s=i[e++],o=64&s,l=o?2+3*(31&s):0,c=new Uint8Array(l);if(o){c[0]=s;for(let t=1;t<l;t++)c[t]=i[e++]}n.push({type:t,payloadType:a,pts:r,bytes:c})}}}}}else if(5===a&&o>16){const t=[];for(let r=0;r<16;r++){const n=i[e++].toString(16);t.push(1==n.length?"0"+n:n),3!==r&&5!==r&&7!==r&&9!==r||t.push("-")}const s=o-16,l=new Uint8Array(s);for(let t=0;t<s;t++)l[t]=i[e++];n.push({payloadType:a,pts:r,uuid:t.join(""),userData:xt(l),userDataBytes:l})}}}function ie(t){const e=t.byteLength,r=[];let n=1;for(;n<e-2;)0===t[n]&&0===t[n+1]&&3===t[n+2]?(r.push(n+2),n+=2):n++;if(0===r.length)return t;const i=e-r.length,s=new Uint8Array(i);let a=0;for(n=0;n<i;a++,n++)a===r[0]&&(a++,r.shift()),s[n]=t[a];return s}function se(t,e,r){if(16!==t.byteLength)throw new RangeError("Invalid system id");let n,i,s;if(e){n=1,i=new Uint8Array(16*e.length);for(let t=0;t<e.length;t++){const r=e[t];if(16!==r.byteLength)throw new RangeError("Invalid key");i.set(r,16*t)}}else n=0,i=new Uint8Array;n>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;const a=new Uint8Array(4);return r&&r.byteLength>0&&new DataView(a.buffer).setUint32(0,r.byteLength,!1),function(t,...e){const r=e.length;let n=8,i=r;for(;i--;)n+=e[i].byteLength;const s=new Uint8Array(n);for(s[0]=n>>24&255,s[1]=n>>16&255,s[2]=n>>8&255,s[3]=255&n,s.set(t,4),i=0,n=8;i<r;i++)s.set(e[i],n),n+=e[i].byteLength;return s}([112,115,115,104],new Uint8Array([n,0,0,0]),t,s,i,a,r||new Uint8Array)}function ae(t){const e=t.getUint32(0),r=t.byteOffset,n=t.byteLength;if(n<e)return{offset:r,size:n};if(1886614376!==t.getUint32(4))return{offset:r,size:e};const i=t.getUint32(8)>>>24;if(0!==i&&1!==i)return{offset:r,size:e};const s=t.buffer,a=Mt(new Uint8Array(s,r+12,16)),o=t.getUint32(28);let l=null,c=null;if(0===i){if(e-32<o||o<22)return{offset:r,size:e};c=new Uint8Array(s,r+32,o)}else if(1===i){if(!o||n<r+32+16*o+16)return{offset:r,size:e};l=[];for(let t=0;t<o;t++)l.push(new Uint8Array(s,r+32+16*t,16))}return{version:i,systemId:a,kids:l,data:c,offset:r,size:e}}let oe={};class le{static clearKeyUriToKeyIdMap(){oe={}}constructor(t,e,r,n=[1],i=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=t,this.uri=e,this.keyFormat=r,this.keyFormatVersions=n,this.iv=i,this.encrypted=!!t&&"NONE"!==t,this.isCommonEncryption=this.encrypted&&"AES-128"!==t}isSupported(){if(this.method){if("AES-128"===this.method||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case it:case at:case st:case nt:return-1!==["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1}getDecryptData(t){if(!this.encrypted||!this.uri)return null;if("AES-128"===this.method&&this.uri&&!this.iv){"number"!=typeof t&&("AES-128"!==this.method||this.iv||N.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),t=0);const e=function(t){const e=new Uint8Array(16);for(let r=12;r<16;r++)e[r]=t>>8*(15-r)&255;return e}(t);return new le(this.method,this.uri,"identity",this.keyFormatVersions,e)}const e=Z(this.uri);if(e)switch(this.keyFormat){case at:this.pssh=e,e.length>=22&&(this.keyId=e.subarray(e.length-22,e.length-6));break;case st:{const t=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=se(t,null,e);const r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),n=String.fromCharCode.apply(null,Array.from(r)),i=n.substring(n.indexOf("<"),n.length),s=(new DOMParser).parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(s){const t=s.childNodes[0]?s.childNodes[0].nodeValue:s.getAttribute("VALUE");if(t){const e=J(t).subarray(0,16);!function(t){const e=function(t,e,r){const n=t[e];t[e]=t[r],t[r]=n};e(t,0,3),e(t,1,2),e(t,4,5),e(t,6,7)}(e),this.keyId=e}}break}default:{let t=e.subarray(0,16);if(16!==t.length){const e=new Uint8Array(16);e.set(t,16-t.length),t=e}this.keyId=t;break}}if(!this.keyId||16!==this.keyId.byteLength){let t=oe[this.uri];if(!t){const e=Object.keys(oe).length%Number.MAX_SAFE_INTEGER;t=new Uint8Array(16);new DataView(t.buffer,12,4).setUint32(0,e),oe[this.uri]=t}this.keyId=t}return this}}const ce=/\{\$([a-zA-Z0-9-_]+)\}/g;function ue(t){return ce.test(t)}function he(t,e,r){if(null!==t.variableList||t.hasVariableRefs)for(let n=r.length;n--;){const i=r[n],s=e[i];s&&(e[i]=de(t,s))}}function de(t,e){if(null!==t.variableList||t.hasVariableRefs){const r=t.variableList;return e.replace(ce,(e=>{const n=e.substring(2,e.length-1),i=null==r?void 0:r[n];return void 0===i?(t.playlistParsingError||(t.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${n}"`)),e):i}))}return e}function fe(t,e,r){let n,i,s=t.variableList;if(s||(t.variableList=s={}),"QUERYPARAM"in e){n=e.QUERYPARAM;try{const t=new self.URL(r).searchParams;if(!t.has(n))throw new Error(`"${n}" does not match any query parameter in URI: "${r}"`);i=t.get(n)}catch(e){t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${e.message}`))}}else n=e.NAME,i=e.VALUE;n in s?t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${n}"`)):s[n]=i||""}function pe(t,e,r){const n=e.IMPORT;if(r&&n in r){let e=t.variableList;e||(t.variableList=e={}),e[n]=r[n]}else t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${n}"`))}function ge(t=!0){if("undefined"==typeof self)return;return(t||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}const me={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function ye(t,e,r=!0){return!t.split(",").some((t=>!ve(t,e,r)))}function ve(t,e,r=!0){var n;const i=ge(r);return null!=(n=null==i?void 0:i.isTypeSupported(Ee(t,e)))&&n}function Ee(t,e){return`${e}/mp4;codecs="${t}"`}function be(t){if(t){const e=t.substring(0,4);return me.video[e]}return 2}function Te(t){return t.split(",").reduce(((t,e)=>{const r=me.video[e];return r?(2*r+t)/(t?3:2):(me.audio[e]+t)/(t?2:1)}),0)}const Se={};const Ae=/flac|opus/i;function _e(t,e=!0){return t.replace(Ae,(t=>function(t,e=!0){if(Se[t])return Se[t];const r={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[t];for(let n=0;n<r.length;n++)if(ve(r[n],"audio",e))return Se[t]=r[n],r[n];return t}(t.toLowerCase(),e)))}function ke(t,e){return t&&"mp4a"!==t?t:e?e.split(",")[0]:e}const Le=/#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,we=/#EXT-X-MEDIA:(.*)/g,Re=/^#EXT(?:INF|-X-TARGETDURATION):/m,Ce=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),De=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Ie{static findGroup(t,e){for(let r=0;r<t.length;r++){const n=t[r];if(n.id===e)return n}}static resolve(t,e){return S.buildAbsoluteURL(e,t,{alwaysNormalize:!0})}static isMediaPlaylist(t){return Re.test(t)}static parseMasterPlaylist(t,e){const r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:ue(t)},n=[];let i;for(Le.lastIndex=0;null!=(i=Le.exec(t));)if(i[1]){var s;const t=new j(i[1]);he(r,t,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const a=de(r,i[2]),o={attrs:t,bitrate:t.decimalInteger("BANDWIDTH")||t.decimalInteger("AVERAGE-BANDWIDTH"),name:t.NAME,url:Ie.resolve(a,e)},l=t.decimalResolution("RESOLUTION");l&&(o.width=l.width,o.height=l.height),Oe(t.CODECS,o),null!=(s=o.unknownCodecs)&&s.length||n.push(o),r.levels.push(o)}else if(i[3]){const t=i[3],n=i[4];switch(t){case"SESSION-DATA":{const t=new j(n);he(r,t,["DATA-ID","LANGUAGE","VALUE","URI"]);const e=t["DATA-ID"];e&&(null===r.sessionData&&(r.sessionData={}),r.sessionData[e]=t);break}case"SESSION-KEY":{const t=xe(n,e,r);t.encrypted&&t.isSupported()?(null===r.sessionKeys&&(r.sessionKeys=[]),r.sessionKeys.push(t)):N.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${n}"`);break}case"DEFINE":{const t=new j(n);he(r,t,["NAME","VALUE","QUERYPARAM"]),fe(r,t,e)}break;case"CONTENT-STEERING":{const t=new j(n);he(r,t,["SERVER-URI","PATHWAY-ID"]),r.contentSteering={uri:Ie.resolve(t["SERVER-URI"],e),pathwayId:t["PATHWAY-ID"]||"."};break}case"START":r.startTimeOffset=Pe(n)}}const a=n.length>0&&n.length<r.levels.length;return r.levels=a?n:r.levels,0===r.levels.length&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(t,e,r){let n;const i={},s=r.levels,a={AUDIO:s.map((t=>({id:t.attrs.AUDIO,audioCodec:t.audioCodec}))),SUBTITLES:s.map((t=>({id:t.attrs.SUBTITLES,textCodec:t.textCodec}))),"CLOSED-CAPTIONS":[]};let o=0;for(we.lastIndex=0;null!==(n=we.exec(t));){const t=new j(n[1]),s=t.TYPE;if(s){const n=a[s],l=i[s]||[];i[s]=l,he(r,t,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const c=t.LANGUAGE,u=t["ASSOC-LANGUAGE"],h=t.CHANNELS,d=t.CHARACTERISTICS,f=t["INSTREAM-ID"],p={attrs:t,bitrate:0,id:o++,groupId:t["GROUP-ID"]||"",name:t.NAME||c||"",type:s,default:t.bool("DEFAULT"),autoselect:t.bool("AUTOSELECT"),forced:t.bool("FORCED"),lang:c,url:t.URI?Ie.resolve(t.URI,e):""};if(u&&(p.assocLang=u),h&&(p.channels=h),d&&(p.characteristics=d),f&&(p.instreamId=f),null!=n&&n.length){const t=Ie.findGroup(n,p.groupId)||n[0];Me(p,t,"audioCodec"),Me(p,t,"textCodec")}l.push(p)}}return i}static parseLevelPlaylist(t,e,r,n,i,s){const a=new Q(e),o=a.fragments;let l,c,u,h=null,d=0,f=0,p=0,g=0,m=null,y=new z(n,e),v=-1,E=!1,b=null;for(Ce.lastIndex=0,a.m3u8=t,a.hasVariableRefs=ue(t);null!==(l=Ce.exec(t));){E&&(E=!1,y=new z(n,e),y.start=p,y.sn=d,y.cc=g,y.level=r,h&&(y.initSegment=h,y.rawProgramDateTime=h.rawProgramDateTime,h.rawProgramDateTime=null,b&&(y.setByteRange(b),b=null)));const t=l[1];if(t){y.duration=parseFloat(t);const e=(" "+l[2]).slice(1);y.title=e||null,y.tagList.push(e?["INF",t,e]:["INF",t])}else if(l[3]){if(R(y.duration)){y.start=p,u&&Ne(y,u,a),y.sn=d,y.level=r,y.cc=g,o.push(y);const t=(" "+l[3]).slice(1);y.relurl=de(a,t),Fe(y,m),m=y,p+=y.duration,d++,f=0,E=!0}}else if(l[4]){const t=(" "+l[4]).slice(1);m?y.setByteRange(t,m):y.setByteRange(t)}else if(l[5])y.rawProgramDateTime=(" "+l[5]).slice(1),y.tagList.push(["PROGRAM-DATE-TIME",y.rawProgramDateTime]),-1===v&&(v=o.length);else{if(l=l[0].match(De),!l){N.warn("No matches on slow regex match for level playlist!");continue}for(c=1;c<l.length&&void 0===l[c];c++);const t=(" "+l[c]).slice(1),i=(" "+l[c+1]).slice(1),p=l[c+2]?(" "+l[c+2]).slice(1):"";switch(t){case"PLAYLIST-TYPE":a.type=i.toUpperCase();break;case"MEDIA-SEQUENCE":d=a.startSN=parseInt(i);break;case"SKIP":{const t=new j(i);he(a,t,["RECENTLY-REMOVED-DATERANGES"]);const e=t.decimalInteger("SKIPPED-SEGMENTS");if(R(e)){a.skippedSegments=e;for(let t=e;t--;)o.unshift(null);d+=e}const r=t.enumeratedString("RECENTLY-REMOVED-DATERANGES");r&&(a.recentlyRemovedDateranges=r.split("\t"));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(i),1);break;case"VERSION":a.version=parseInt(i);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(i||p)&&y.tagList.push(p?[i,p]:[i]);break;case"DISCONTINUITY":g++,y.tagList.push(["DIS"]);break;case"GAP":y.gap=!0,y.tagList.push([t]);break;case"BITRATE":y.tagList.push([t,i]);break;case"DATERANGE":{const t=new j(i);he(a,t,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),he(a,t,t.clientAttrs);const e=new K(t,a.dateRanges[t.ID]);e.isValid||a.skippedSegments?a.dateRanges[e.id]=e:N.warn(`Ignoring invalid DATERANGE tag: "${i}"`),y.tagList.push(["EXT-X-DATERANGE",i]);break}case"DEFINE":{const t=new j(i);he(a,t,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in t?pe(a,t,s):fe(a,t,e)}break;case"DISCONTINUITY-SEQUENCE":g=parseInt(i);break;case"KEY":{const t=xe(i,e,a);if(t.isSupported()){if("NONE"===t.method){u=void 0;break}u||(u={}),u[t.keyFormat]&&(u=w({},u)),u[t.keyFormat]=t}else N.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${i}"`);break}case"START":a.startTimeOffset=Pe(i);break;case"MAP":{const t=new j(i);if(he(a,t,["BYTERANGE","URI"]),y.duration){const i=new z(n,e);Be(i,t,r,u),h=i,y.initSegment=h,h.rawProgramDateTime&&!y.rawProgramDateTime&&(y.rawProgramDateTime=h.rawProgramDateTime)}else{const e=y.byteRangeEndOffset;if(e){const t=y.byteRangeStartOffset;b=`${e-t}@${t}`}else b=null;Be(y,t,r,u),h=y,E=!0}break}case"SERVER-CONTROL":{const t=new j(i);a.canBlockReload=t.bool("CAN-BLOCK-RELOAD"),a.canSkipUntil=t.optionalFloat("CAN-SKIP-UNTIL",0),a.canSkipDateRanges=a.canSkipUntil>0&&t.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=t.optionalFloat("PART-HOLD-BACK",0),a.holdBack=t.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const t=new j(i);a.partTarget=t.decimalFloatingPoint("PART-TARGET");break}case"PART":{let t=a.partList;t||(t=a.partList=[]);const r=f>0?t[t.length-1]:void 0,n=f++,s=new j(i);he(a,s,["BYTERANGE","URI"]);const o=new X(s,y,e,n,r);t.push(o),y.duration+=o.duration;break}case"PRELOAD-HINT":{const t=new j(i);he(a,t,["URI"]),a.preloadHint=t;break}case"RENDITION-REPORT":{const t=new j(i);he(a,t,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(t);break}default:N.warn(`line parsed but not handled: ${l}`)}}}m&&!m.relurl?(o.pop(),p-=m.duration,a.partList&&(a.fragmentHint=m)):a.partList&&(Fe(y,m),y.cc=g,a.fragmentHint=y,u&&Ne(y,u,a));const T=o.length,S=o[0],A=o[T-1];if(p+=a.skippedSegments*a.targetduration,p>0&&T&&A){a.averagetargetduration=p/T;const t=A.sn;a.endSN="initSegment"!==t?t:0,a.live||(A.endList=!0),S&&(a.startCC=S.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(p+=a.fragmentHint.duration),a.totalduration=p,a.endCC=g,v>0&&function(t,e){let r=t[e];for(let n=e;n--;){const e=t[n];if(!e)return;e.programDateTime=r.programDateTime-1e3*e.duration,r=e}}(o,v),a}}function xe(t,e,r){var n,i;const s=new j(t);he(r,s,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const a=null!=(n=s.METHOD)?n:"",o=s.URI,l=s.hexadecimalInteger("IV"),c=s.KEYFORMATVERSIONS,u=null!=(i=s.KEYFORMAT)?i:"identity";o&&s.IV&&!l&&N.error(`Invalid IV: ${s.IV}`);const h=o?Ie.resolve(o,e):"",d=(c||"1").split("/").map(Number).filter(Number.isFinite);return new le(a,h,u,d,l)}function Pe(t){const e=new j(t).decimalFloatingPoint("TIME-OFFSET");return R(e)?e:null}function Oe(t,e){let r=(t||"").split(/[ ,]+/).filter((t=>t));["video","audio","text"].forEach((t=>{const n=r.filter((e=>function(t,e){const r=me[e];return!!r&&!!r[t.slice(0,4)]}(e,t)));n.length&&(e[`${t}Codec`]=n.join(","),r=r.filter((t=>-1===n.indexOf(t))))})),e.unknownCodecs=r}function Me(t,e,r){const n=e[r];n&&(t[r]=n)}function Fe(t,e){t.rawProgramDateTime?t.programDateTime=Date.parse(t.rawProgramDateTime):null!=e&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime),R(t.programDateTime)||(t.programDateTime=null,t.rawProgramDateTime=null)}function Be(t,e,r,n){t.relurl=e.URI,e.BYTERANGE&&t.setByteRange(e.BYTERANGE),t.level=r,t.sn="initSegment",n&&(t.levelkeys=n),t.initSegment=null}function Ne(t,e,r){t.levelkeys=e;const{encryptedFragments:n}=r;n.length&&n[n.length-1].levelkeys===e||!Object.keys(e).some((t=>e[t].isCommonEncryption))||n.push(t)}var Ue="manifest",$e="level",je="audioTrack",Ge="subtitleTrack",Ke="main",He="audio",Ve="subtitle";function We(t){const{type:e}=t;switch(e){case je:return He;case Ge:return Ve;default:return Ke}}function Ye(t,e){let r=t.url;return void 0!==r&&0!==r.indexOf("data:")||(r=e.url),r}class qe{constructor(t){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=t,this.registerListeners()}startLoad(t){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:t}=this;t.on(I.MANIFEST_LOADING,this.onManifestLoading,this),t.on(I.LEVEL_LOADING,this.onLevelLoading,this),t.on(I.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(I.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:t}=this;t.off(I.MANIFEST_LOADING,this.onManifestLoading,this),t.off(I.LEVEL_LOADING,this.onLevelLoading,this),t.off(I.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(I.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(t){const e=this.hls.config,r=e.pLoader,n=e.loader,i=new(r||n)(e);return this.loaders[t.type]=i,i}getInternalLoader(t){return this.loaders[t.type]}resetInternalLoader(t){this.loaders[t]&&delete this.loaders[t]}destroyInternalLoaders(){for(const t in this.loaders){const e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(t,e){const{url:r}=e;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Ue,url:r,deliveryDirectives:null})}onLevelLoading(t,e){const{id:r,level:n,pathwayId:i,url:s,deliveryDirectives:a}=e;this.load({id:r,level:n,pathwayId:i,responseType:"text",type:$e,url:s,deliveryDirectives:a})}onAudioTrackLoading(t,e){const{id:r,groupId:n,url:i,deliveryDirectives:s}=e;this.load({id:r,groupId:n,level:null,responseType:"text",type:je,url:i,deliveryDirectives:s})}onSubtitleTrackLoading(t,e){const{id:r,groupId:n,url:i,deliveryDirectives:s}=e;this.load({id:r,groupId:n,level:null,responseType:"text",type:Ge,url:i,deliveryDirectives:s})}load(t){var e;const r=this.hls.config;let n,i=this.getInternalLoader(t);if(i){const e=i.context;if(e&&e.url===t.url&&e.level===t.level)return void N.trace("[playlist-loader]: playlist request ongoing");N.log(`[playlist-loader]: aborting previous loader for type: ${t.type}`),i.abort()}if(n=t.type===Ue?r.manifestLoadPolicy.default:w({},r.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(t),R(null==(e=t.deliveryDirectives)?void 0:e.part)){let e;if(t.type===$e&&null!==t.level?e=this.hls.levels[t.level].details:t.type===je&&null!==t.id?e=this.hls.audioTracks[t.id].details:t.type===Ge&&null!==t.id&&(e=this.hls.subtitleTracks[t.id].details),e){const t=e.partTarget,r=e.targetduration;if(t&&r){const e=1e3*Math.max(3*t,.8*r);n=w({},n,{maxTimeToFirstByteMs:Math.min(e,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(e,n.maxTimeToFirstByteMs)})}}}const s=n.errorRetry||n.timeoutRetry||{},a={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:s.maxNumRetry||0,retryDelay:s.retryDelayMs||0,maxRetryDelay:s.maxRetryDelayMs||0},o={onSuccess:(t,e,r,n)=>{const i=this.getInternalLoader(r);this.resetInternalLoader(r.type);const s=t.data;0===s.indexOf("#EXTM3U")?(e.parsing.start=performance.now(),Ie.isMediaPlaylist(s)?this.handleTrackOrLevelPlaylist(t,e,r,n||null,i):this.handleMasterPlaylist(t,e,r,n)):this.handleManifestParsingError(t,r,new Error("no EXTM3U delimiter"),n||null,e)},onError:(t,e,r,n)=>{this.handleNetworkError(e,r,!1,t,n)},onTimeout:(t,e,r)=>{this.handleNetworkError(e,r,!0,void 0,t)}};i.load(t,a,o)}handleMasterPlaylist(t,e,r,n){const i=this.hls,s=t.data,a=Ye(t,r),o=Ie.parseMasterPlaylist(s,a);if(o.playlistParsingError)return void this.handleManifestParsingError(t,r,o.playlistParsingError,n,e);const{contentSteering:l,levels:c,sessionData:u,sessionKeys:h,startTimeOffset:d,variableList:f}=o;this.variableList=f;const{AUDIO:p=[],SUBTITLES:g,"CLOSED-CAPTIONS":m}=Ie.parseMasterPlaylistMedia(s,a,o);if(p.length){p.some((t=>!t.url))||!c[0].audioCodec||c[0].attrs.AUDIO||(N.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),p.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new j({}),bitrate:0,url:""}))}i.trigger(I.MANIFEST_LOADED,{levels:c,audioTracks:p,subtitles:g,captions:m,contentSteering:l,url:a,stats:e,networkDetails:n,sessionData:u,sessionKeys:h,startTimeOffset:d,variableList:f})}handleTrackOrLevelPlaylist(t,e,r,n,i){const s=this.hls,{id:a,level:o,type:l}=r,c=Ye(t,r),u=R(o)?o:R(a)?a:0,h=We(r),d=Ie.parseLevelPlaylist(t.data,c,u,h,0,this.variableList);if(l===Ue){const t={attrs:new j({}),bitrate:0,details:d,name:"",url:c};s.trigger(I.MANIFEST_LOADED,{levels:[t],audioTracks:[],url:c,stats:e,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}e.parsing.end=performance.now(),r.levelDetails=d,this.handlePlaylistLoaded(d,t,e,r,n,i)}handleManifestParsingError(t,e,r,n,i){this.hls.trigger(I.ERROR,{type:x.NETWORK_ERROR,details:P.MANIFEST_PARSING_ERROR,fatal:e.type===Ue,url:t.url,err:r,error:r,reason:r.message,response:t,context:e,networkDetails:n,stats:i})}handleNetworkError(t,e,r=!1,n,i){let s=`A network ${r?"timeout":"error"+(n?" (status "+n.code+")":"")} occurred while loading ${t.type}`;t.type===$e?s+=`: ${t.level} id: ${t.id}`:t.type!==je&&t.type!==Ge||(s+=` id: ${t.id} group-id: "${t.groupId}"`);const a=new Error(s);N.warn(`[playlist-loader]: ${s}`);let o=P.UNKNOWN,l=!1;const c=this.getInternalLoader(t);switch(t.type){case Ue:o=r?P.MANIFEST_LOAD_TIMEOUT:P.MANIFEST_LOAD_ERROR,l=!0;break;case $e:o=r?P.LEVEL_LOAD_TIMEOUT:P.LEVEL_LOAD_ERROR,l=!1;break;case je:o=r?P.AUDIO_TRACK_LOAD_TIMEOUT:P.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case Ge:o=r?P.SUBTITLE_TRACK_LOAD_TIMEOUT:P.SUBTITLE_LOAD_ERROR,l=!1}c&&this.resetInternalLoader(t.type);const u={type:x.NETWORK_ERROR,details:o,fatal:l,url:t.url,loader:c,context:t,error:a,networkDetails:e,stats:i};if(n){const r=(null==e?void 0:e.url)||t.url;u.response=_({url:r,data:void 0},n)}this.hls.trigger(I.ERROR,u)}handlePlaylistLoaded(t,e,r,n,i,s){const a=this.hls,{type:o,level:l,id:c,groupId:u,deliveryDirectives:h}=n,d=Ye(e,n),f=We(n),p="number"==typeof n.level&&f===Ke?l:void 0;if(!t.fragments.length){const t=new Error("No Segments found in Playlist");return void a.trigger(I.ERROR,{type:x.NETWORK_ERROR,details:P.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:t,reason:t.message,response:e,context:n,level:p,parent:f,networkDetails:i,stats:r})}t.targetduration||(t.playlistParsingError=new Error("Missing Target Duration"));const g=t.playlistParsingError;if(g)a.trigger(I.ERROR,{type:x.NETWORK_ERROR,details:P.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:g,reason:g.message,response:e,context:n,level:p,parent:f,networkDetails:i,stats:r});else switch(t.live&&s&&(s.getCacheAge&&(t.ageHeader=s.getCacheAge()||0),s.getCacheAge&&!isNaN(t.ageHeader)||(t.ageHeader=0)),o){case Ue:case $e:a.trigger(I.LEVEL_LOADED,{details:t,level:p||0,id:c||0,stats:r,networkDetails:i,deliveryDirectives:h});break;case je:a.trigger(I.AUDIO_TRACK_LOADED,{details:t,id:c||0,groupId:u||"",stats:r,networkDetails:i,deliveryDirectives:h});break;case Ge:a.trigger(I.SUBTITLE_TRACK_LOADED,{details:t,id:c||0,groupId:u||"",stats:r,networkDetails:i,deliveryDirectives:h})}}}function ze(t,e){let r;try{r=new Event("addtrack")}catch(t){r=document.createEvent("Event"),r.initEvent("addtrack",!1,!1)}r.track=t,e.dispatchEvent(r)}function Xe(t,e){const r=t.mode;if("disabled"===r&&(t.mode="hidden"),t.cues&&!t.cues.getCueById(e.id))try{if(t.addCue(e),!t.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(r){N.debug(`[texttrack-utils]: ${r}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,t.addCue(r)}catch(t){N.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${t}`)}}"disabled"===r&&(t.mode=r)}function Qe(t){const e=t.mode;if("disabled"===e&&(t.mode="hidden"),t.cues)for(let e=t.cues.length;e--;)t.removeCue(t.cues[e]);"disabled"===e&&(t.mode=e)}function Je(t,e,r,n){const i=t.mode;if("disabled"===i&&(t.mode="hidden"),t.cues&&t.cues.length>0){const i=function(t,e,r){const n=[],i=function(t,e){if(e<t[0].startTime)return 0;const r=t.length-1;if(e>t[r].endTime)return-1;let n=0,i=r;for(;n<=i;){const s=Math.floor((i+n)/2);if(e<t[s].startTime)i=s-1;else{if(!(e>t[s].startTime&&n<r))return s;n=s+1}}return t[n].startTime-e<e-t[i].startTime?n:i}(t,e);if(i>-1)for(let s=i,a=t.length;s<a;s++){const i=t[s];if(i.startTime>=e&&i.endTime<=r)n.push(i);else if(i.startTime>r)return n}return n}(t.cues,e,r);for(let e=0;e<i.length;e++)n&&!n(i[e])||t.removeCue(i[e])}"disabled"===i&&(t.mode=i)}function Ze(t){const e=[];for(let r=0;r<t.length;r++){const n=t[r];"subtitles"!==n.kind&&"captions"!==n.kind||!n.label||e.push(t[r])}return e}var tr="org.id3",er="com.apple.quicktime.HLS",rr="https://aomedia.org/emsg/ID3";function nr(){if("undefined"!=typeof self)return self.VTTCue||self.TextTrackCue}function ir(t,e,r,n,i){let s=new t(e,r,"");try{s.value=n,i&&(s.type=i)}catch(a){s=new t(e,r,JSON.stringify(i?_({type:i},n):n))}return s}const sr=(()=>{const t=nr();try{t&&new t(0,Number.POSITIVE_INFINITY,"")}catch(t){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function ar(t,e){return t.getTime()/1e3-e}class or{constructor(t){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=t,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:t}=this;t.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(I.MANIFEST_LOADING,this.onManifestLoading,this),t.on(I.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(I.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:t}=this;t.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(I.MANIFEST_LOADING,this.onManifestLoading,this),t.off(I.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(I.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(t,e){this.media=e.media}onMediaDetaching(){this.id3Track&&(Qe(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(t){const e=this.getID3Track(t.textTracks);return e.mode="hidden",e}getID3Track(t){if(this.media){for(let e=0;e<t.length;e++){const r=t[e];if("metadata"===r.kind&&"id3"===r.label)return ze(r,this.media),r}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(t,e){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:r,enableID3MetadataCues:n}}}=this;if(!r&&!n)return;const{samples:i}=e;this.id3Track||(this.id3Track=this.createTrack(this.media));const s=nr();if(s)for(let t=0;t<i.length;t++){const e=i[t].type;if(e===rr&&!r||!n)continue;const a=Lt(i[t].data);if(a){const r=i[t].pts;let n=r+i[t].duration;n>sr&&(n=sr);n-r<=0&&(n=r+.25);for(let t=0;t<a.length;t++){const i=a[t];if(!_t(i)){this.updateId3CueEnds(r,e);const t=ir(s,r,n,i,e);t&&this.id3Track.addCue(t)}}}}}updateId3CueEnds(t,e){var r;const n=null==(r=this.id3Track)?void 0:r.cues;if(n)for(let r=n.length;r--;){const i=n[r];i.type===e&&i.startTime<t&&i.endTime===sr&&(i.endTime=t)}}onBufferFlushing(t,{startOffset:e,endOffset:r,type:n}){const{id3Track:i,hls:s}=this;if(!s)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:o}}=s;if(i&&(a||o)){let t;t="audio"===n?t=>t.type===tr&&o:"video"===n?t=>t.type===rr&&a:t=>t.type===tr&&o||t.type===rr&&a,Je(i,e,r,t)}}onLevelUpdated(t,{details:e}){if(!this.media||!e.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:r,id3Track:n}=this,{dateRanges:i}=e,s=Object.keys(i);if(n){const t=Object.keys(r).filter((t=>!s.includes(t)));for(let e=t.length;e--;){const i=t[e];Object.keys(r[i].cues).forEach((t=>{n.removeCue(r[i].cues[t])})),delete r[i]}}const a=e.fragments[e.fragments.length-1];if(0===s.length||!R(null==a?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=a.programDateTime/1e3-a.start,l=nr();for(let t=0;t<s.length;t++){const e=s[t],n=i[e],a=ar(n.startDate,o),h=r[e],d=(null==h?void 0:h.cues)||{};let f=(null==h?void 0:h.durationKnown)||!1,p=sr;const g=n.endDate;if(g)p=ar(g,o),f=!0;else if(n.endOnNext&&!f){const t=s.reduce(((t,e)=>{if(e!==n.id){const r=i[e];if(r.class===n.class&&r.startDate>n.startDate&&(!t||n.startDate<t.startDate))return r}return t}),null);t&&(p=ar(t.startDate,o),f=!0)}const m=Object.keys(n.attr);for(let t=0;t<m.length;t++){const r=m[t];if("ID"===(u=r)||"CLASS"===u||"START-DATE"===u||"DURATION"===u||"END-DATE"===u||"END-ON-NEXT"===u)continue;const i=d[r];if(i)f&&!h.durationKnown&&(i.endTime=p);else if(l){let t=n.attr[r];G(r)&&(c=t,t=Uint8Array.from(c.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer);const i=ir(l,a,p,{key:r,data:t},er);i&&(i.id=e,this.id3Track.addCue(i),d[r]=i)}}r[e]={cues:d,dateRange:n,durationKnown:f}}var c,u}}class lr{constructor(t){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=t,this.config=t.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:t,levelDetails:e}=this;return void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:e?t.liveMaxLatencyDurationCount*e.targetduration:0}get targetLatency(){const{levelDetails:t}=this;if(null===t)return null;const{holdBack:e,partHoldBack:r,targetduration:n}=t,{liveSyncDuration:i,liveSyncDurationCount:s,lowLatencyMode:a}=this.config,o=this.hls.userConfig;let l=a&&r||e;(o.liveSyncDuration||o.liveSyncDurationCount||0===l)&&(l=void 0!==i?i:s*n);const c=n;return l+Math.min(1*this.stallCount,c)}get liveSyncPosition(){const t=this.estimateLiveEdge(),e=this.targetLatency,r=this.levelDetails;if(null===t||null===e||null===r)return null;const n=r.edge,i=t-e-this.edgeStalled,s=n-r.totalduration,a=n-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(s,i),a)}get drift(){const{levelDetails:t}=this;return null===t?1:t.drift}get edgeStalled(){const{levelDetails:t}=this;if(null===t)return 0;const e=3*(this.config.lowLatencyMode&&t.partTarget||t.targetduration);return Math.max(t.age-e,0)}get forwardBufferLength(){const{media:t,levelDetails:e}=this;if(!t||!e)return 0;const r=t.buffered.length;return(r?t.buffered.end(r-1):e.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(I.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(I.ERROR,this.onError,this)}onMediaAttached(t,e){this.media=e.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(t,{details:e}){this.levelDetails=e,e.advanced&&this.timeupdate(),!e.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(t,e){var r;e.details===P.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(r=this.levelDetails)&&r.live&&N.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:t,levelDetails:e}=this;if(!t||!e)return;this.currentTime=t.currentTime;const r=this.computeLatency();if(null===r)return;this._latency=r;const{lowLatencyMode:n,maxLiveSyncPlaybackRate:i}=this.config;if(!n||1===i||!e.live)return;const s=this.targetLatency;if(null===s)return;const a=r-s;if(a<Math.min(this.maxLatency,s+e.targetduration)&&a>.05&&this.forwardBufferLength>1){const e=Math.min(2,Math.max(1,i)),r=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;t.playbackRate=Math.min(e,Math.max(1,r))}else 1!==t.playbackRate&&0!==t.playbackRate&&(t.playbackRate=1)}estimateLiveEdge(){const{levelDetails:t}=this;return null===t?null:t.edge+t.age}computeLatency(){const t=this.estimateLiveEdge();return null===t?null:t-this.currentTime}}const cr=["NONE","TYPE-0","TYPE-1",null];const ur=["SDR","PQ","HLG"];var hr="",dr="YES",fr="v2";function pr(t){const{canSkipUntil:e,canSkipDateRanges:r,age:n}=t;return e&&n<e/2?r?fr:dr:hr}class gr{constructor(t,e,r){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=e,this.skip=r}addDirectives(t){const e=new self.URL(t);return void 0!==this.msn&&e.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.href}}class mr{constructor(t){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[t.url],this._attrs=[t.attrs],this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.frameRate=t.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=t.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.codecSet=[t.videoCodec,t.audioCodec].filter((t=>!!t)).map((t=>t.substring(0,4))).join(","),this.addGroupId("audio",t.attrs.AUDIO),this.addGroupId("text",t.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(t){return yr(this._audioGroups,t)}hasSubtitleGroup(t){return yr(this._subtitleGroups,t)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(t,e){if(e)if("audio"===t){let t=this._audioGroups;t||(t=this._audioGroups=[]),-1===t.indexOf(e)&&t.push(e)}else if("text"===t){let t=this._subtitleGroups;t||(t=this._subtitleGroups=[]),-1===t.indexOf(e)&&t.push(e)}}get urlId(){return 0}set urlId(t){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var t;return null==(t=this.audioGroups)?void 0:t[0]}get textGroupId(){var t;return null==(t=this.subtitleGroups)?void 0:t[0]}addFallback(){}}function yr(t,e){return!(!e||!t)&&-1!==t.indexOf(e)}function vr(t,e){const r=e.startPTS;if(R(r)){let n,i=0;e.sn>t.sn?(i=r-t.start,n=t):(i=t.start-r,n=e),n.duration!==i&&(n.duration=i)}else if(e.sn>t.sn){t.cc===e.cc&&t.minEndPTS?e.start=t.start+(t.minEndPTS-t.start):e.start=t.start+t.duration}else e.start=Math.max(t.start-e.duration,0)}function Er(t,e,r,n,i,s){n-r<=0&&(N.warn("Fragment should have a positive duration",e),n=r+e.duration,s=i+e.duration);let a=r,o=n;const l=e.startPTS,c=e.endPTS;if(R(l)){const t=Math.abs(l-r);R(e.deltaPTS)?e.deltaPTS=Math.max(t,e.deltaPTS):e.deltaPTS=t,a=Math.max(r,l),r=Math.min(r,l),i=Math.min(i,e.startDTS),o=Math.min(n,c),n=Math.max(n,c),s=Math.max(s,e.endDTS)}const u=r-e.start;0!==e.start&&(e.start=r),e.duration=n-e.start,e.startPTS=r,e.maxStartPTS=a,e.startDTS=i,e.endPTS=n,e.minEndPTS=o,e.endDTS=s;const h=e.sn;if(!t||h<t.startSN||h>t.endSN)return 0;let d;const f=h-t.startSN,p=t.fragments;for(p[f]=e,d=f;d>0;d--)vr(p[d],p[d-1]);for(d=f;d<p.length-1;d++)vr(p[d],p[d+1]);return t.fragmentHint&&vr(p[p.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,u}function br(t,e){let r=null;const n=t.fragments;for(let t=n.length-1;t>=0;t--){const e=n[t].initSegment;if(e){r=e;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;let i,s=0;if(function(t,e,r){const n=e.skippedSegments,i=Math.max(t.startSN,e.startSN)-e.startSN,s=(t.fragmentHint?1:0)+(n?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,a=e.startSN-t.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments;for(let t=i;t<=s;t++){const i=l[a+t];let s=o[t];n&&!s&&t<n&&(s=e.fragments[t]=i),i&&s&&r(i,s)}}(t,e,((t,n)=>{t.relurl&&(s=t.cc-n.cc),R(t.startPTS)&&R(t.endPTS)&&(n.start=n.startPTS=t.startPTS,n.startDTS=t.startDTS,n.maxStartPTS=t.maxStartPTS,n.endPTS=t.endPTS,n.endDTS=t.endDTS,n.minEndPTS=t.minEndPTS,n.duration=t.endPTS-t.startPTS,n.duration&&(i=n),e.PTSKnown=e.alignedSliding=!0),n.elementaryStreams=t.elementaryStreams,n.loader=t.loader,n.stats=t.stats,t.initSegment&&(n.initSegment=t.initSegment,r=t.initSegment)})),r){(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach((t=>{var e;!t||t.initSegment&&t.initSegment.relurl!==(null==(e=r)?void 0:e.relurl)||(t.initSegment=r)}))}if(e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some((t=>!t)),e.deltaUpdateFailed){N.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let t=e.skippedSegments;t--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=function(t,e,r){const n=w({},t);r&&r.forEach((t=>{delete n[t]}));return Object.keys(e).forEach((t=>{const r=new K(e[t].attr,n[t]);r.isValid?n[t]=r:N.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[t].attr)}"`)})),n}(t.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const a=e.fragments;if(s){N.warn("discontinuity sliding from playlist, take drift into account");for(let t=0;t<a.length;t++)a[t].cc+=s}e.skippedSegments&&(e.startCC=e.fragments[0].cc),function(t,e,r){if(t&&e){let n=0;for(let i=0,s=t.length;i<=s;i++){const s=t[i],a=e[i+n];s&&a&&s.index===a.index&&s.fragment.sn===a.fragment.sn?r(s,a):n--}}}(t.partList,e.partList,((t,e)=>{e.elementaryStreams=t.elementaryStreams,e.stats=t.stats})),i?Er(e,i,i.startPTS,i.endPTS,i.startDTS,i.endDTS):Tr(t,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;const o=e.advancedDateTime;if(e.advanced&&o){const t=e.edge;e.driftStart||(e.driftStartTime=o,e.driftStart=t),e.driftEndTime=o,e.driftEnd=t}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime}function Tr(t,e){const r=e.startSN+e.skippedSegments-t.startSN,n=t.fragments;r<0||r>=n.length||Sr(e,n[r].start)}function Sr(t,e){if(e){const r=t.fragments;for(let n=t.skippedSegments;n<r.length;n++)r[n].start+=e;t.fragmentHint&&(t.fragmentHint.start+=e)}}function Ar(t,e,r){var n;return null!=t&&t.details?_r(null==(n=t.details)?void 0:n.partList,e,r):null}function _r(t,e,r){if(t)for(let n=t.length;n--;){const i=t[n];if(i.index===r&&i.fragment.sn===e)return i}return null}function kr(t){t.forEach(((t,e)=>{const{details:r}=t;null!=r&&r.fragments&&r.fragments.forEach((t=>{t.level=e}))}))}function Lr(t){switch(t.details){case P.FRAG_LOAD_TIMEOUT:case P.KEY_LOAD_TIMEOUT:case P.LEVEL_LOAD_TIMEOUT:case P.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function wr(t,e){const r=Lr(e);return t.default[(r?"timeout":"error")+"Retry"]}function Rr(t,e){const r="linear"===t.backoff?1:Math.pow(2,e);return Math.min(r*t.retryDelayMs,t.maxRetryDelayMs)}function Cr(t){return _(_({},t),{errorRetry:null,timeoutRetry:null})}function Dr(t,e,r,n){if(!t)return!1;const i=null==n?void 0:n.code,s=e<t.maxNumRetry&&(function(t){return 0===t&&!1===navigator.onLine||!!t&&(t<400||t>499)}(i)||!!r);return t.shouldRetry?t.shouldRetry(t,e,r,n,s):s}const Ir=function(t,e){let r=0,n=t.length-1,i=null,s=null;for(;r<=n;){i=(r+n)/2|0,s=t[i];const a=e(s);if(a>0)r=i+1;else{if(!(a<0))return s;n=i-1}}return null};function xr(t,e,r=0,n=0,i=.005){let s=null;if(t){s=e[t.sn-e[0].sn+1]||null;const n=t.endDTS-r;n>0&&n<15e-7&&(r+=15e-7)}else 0===r&&0===e[0].start&&(s=e[0]);if(s&&((!t||t.level===s.level)&&0===Pr(r,n,s)||function(t,e,r){if(e&&0===e.start&&e.level<t.level&&(e.endPTS||0)>0){const n=e.tagList.reduce(((t,e)=>("INF"===e[0]&&(t+=parseFloat(e[1])),t)),r);return t.start<=n}return!1}(s,t,Math.min(i,n))))return s;const a=Ir(e,Pr.bind(null,r,n));return!a||a===t&&s?s:a}function Pr(t=0,e=0,r){if(r.start<=t&&r.start+r.duration>t)return 0;const n=Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-n<=t?1:r.start-n>t&&r.start?-1:0}function Or(t,e,r){const n=1e3*Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-n>t}var Mr=0,Fr=2,Br=3,Nr=5,Ur=0,$r=1,jr=2;class Gr{constructor(t,e){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=N.log.bind(N,`${e}:`),this.warn=N.warn.bind(N,`${e}:`),this.hls=t}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(t,e,r){const n=null==e?void 0:e.renditionReports;if(n){let i=-1;for(let r=0;r<n.length;r++){const s=n[r];let a;try{a=new self.URL(s.URI,e.url).href}catch(t){N.warn(`Could not construct new URL for Rendition Report: ${t}`),a=s.URI||""}if(a===t){i=r;break}a===t.substring(0,a.length)&&(i=r)}if(-1!==i){const t=n[i],s=parseInt(t["LAST-MSN"])||(null==e?void 0:e.lastPartSn);let a=parseInt(t["LAST-PART"])||(null==e?void 0:e.lastPartIndex);if(this.hls.config.lowLatencyMode){const t=Math.min(e.age-e.partTarget,e.targetduration);a>=0&&t>e.partTarget&&(a+=1)}const o=r&&pr(r);return new gr(s,a>=0?a:void 0,o)}}}loadPlaylist(t){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(t){return this.canLoad&&!!t&&!!t.url&&(!t.details||t.details.live)}shouldReloadPlaylist(t){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(t)}playlistLoaded(t,e,r){const{details:n,stats:i}=e,s=self.performance.now(),a=i.loading.first?Math.max(0,s-i.loading.first):0;if(n.advancedDateTime=Date.now()-a,n.live||null!=r&&r.live){if(n.reloaded(r),r&&this.log(`live playlist ${t} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),r&&n.fragments.length>0&&br(r,n),!this.canLoad||!n.live)return;let a,o,l;if(n.canBlockReload&&n.endSN&&n.advanced){const t=this.hls.config.lowLatencyMode,i=n.lastPartSn,s=n.endSN,c=n.lastPartIndex,u=i===s;-1!==c?(o=u?s+1:i,l=u?t?0:c:c+1):o=s+1;const h=n.age,d=h+n.ageHeader;let f=Math.min(d-n.partTarget,1.5*n.targetduration);if(f>0){if(r&&f>r.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${r.tuneInGoal} to: ${f} with playlist age: ${n.age}`),f=0;else{const t=Math.floor(f/n.targetduration);if(o+=t,void 0!==l){l+=Math.round(f%n.targetduration/n.partTarget)}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${h.toFixed(2)}s goal: ${f} skip sn ${t} to part ${l}`)}n.tuneInGoal=f}if(a=this.getDeliveryDirectives(n,e.deliveryDirectives,o,l),t||!u)return void this.loadPlaylist(a)}else(n.canBlockReload||n.canSkipUntil)&&(a=this.getDeliveryDirectives(n,e.deliveryDirectives,o,l));const c=this.hls.mainForwardBufferInfo,u=c?c.end-c.len:0,h=function(t,e=1/0){let r=1e3*t.targetduration;if(t.updated){const n=t.fragments,i=4;if(n.length&&r*i>e){const t=1e3*n[n.length-1].duration;t<r&&(r=t)}}else r/=2;return Math.round(r)}(n,1e3*(n.edge-u));n.updated&&s>this.requestScheduled+h&&(this.requestScheduled=i.loading.start),void 0!==o&&n.canBlockReload?this.requestScheduled=i.loading.first+h-(1e3*n.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+h<s?this.requestScheduled=s:this.requestScheduled-s<=0&&(this.requestScheduled+=h);let d=this.requestScheduled-s;d=Math.max(0,d),this.log(`reload live playlist ${t} in ${Math.round(d)} ms`),this.timer=self.setTimeout((()=>this.loadPlaylist(a)),d)}else this.clearTimer()}getDeliveryDirectives(t,e,r,n){let i=pr(t);return null!=e&&e.skip&&t.deltaUpdateFailed&&(r=e.msn,n=e.part,i=hr),new gr(r,n,i)}checkRetry(t){const e=t.details,r=Lr(t),n=t.errorAction,{action:i,retryCount:s=0,retryConfig:a}=n||{},o=!!n&&!!a&&(i===Nr||!n.resolved&&i===Fr);if(o){var l;if(this.requestScheduled=-1,s>=a.maxNumRetry)return!1;if(r&&null!=(l=t.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${s+1}/${a.maxNumRetry} after "${e}" without delivery-directives`),this.loadPlaylist();else{const t=Rr(a,s);this.timer=self.setTimeout((()=>this.loadPlaylist()),t),this.warn(`Retrying playlist loading ${s+1}/${a.maxNumRetry} after "${e}" in ${t}ms`)}t.levelRetry=!0,n.resolved=!0}return o}}class Kr{constructor(t,e=0,r=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=e,this.totalWeight_=r}sample(t,e){const r=Math.pow(this.alpha_,t);this.estimate_=e*(1-r)+r*this.estimate_,this.totalWeight_+=t}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_}}class Hr{constructor(t,e,r,n=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_=r,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Kr(t),this.fast_=new Kr(e),this.defaultTTFB_=n,this.ttfb_=new Kr(t)}update(t,e){const{slow_:r,fast_:n,ttfb_:i}=this;r.halfLife!==t&&(this.slow_=new Kr(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.fast_=new Kr(e,n.getEstimate(),n.getTotalWeight())),i.halfLife!==t&&(this.ttfb_=new Kr(t,i.getEstimate(),i.getTotalWeight()))}sample(t,e){const r=(t=Math.max(t,this.minDelayMs_))/1e3,n=8*e/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}sampleTTFB(t){const e=t/1e3,r=Math.sqrt(2)*Math.exp(-Math.pow(e,2)/2);this.ttfb_.sample(r,Math.max(t,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const Vr={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Wr={};function Yr(t,e,r,n,i,s){const a=t.audioCodec?t.audioGroups:null,o=null==s?void 0:s.audioCodec,l=null==s?void 0:s.channels,c=l?parseInt(l):o?1/0:2;let u=null;if(null!=a&&a.length)try{u=1===a.length&&a[0]?e.groups[a[0]].channels:a.reduce(((t,r)=>{if(r){const n=e.groups[r];if(!n)throw new Error(`Audio track group ${r} not found`);Object.keys(n.channels).forEach((e=>{t[e]=(t[e]||0)+n.channels[e]}))}return t}),{2:0})}catch(t){return!0}return void 0!==t.videoCodec&&(t.width>1920&&t.height>1088||t.height>1920&&t.width>1088||t.frameRate>Math.max(n,30)||"SDR"!==t.videoRange&&t.videoRange!==r||t.bitrate>Math.max(i,8e6))||!!u&&R(c)&&Object.keys(u).some((t=>parseInt(t)>c))}function qr(t,e,r){const n=t.videoCodec,i=t.audioCodec;if(!n||!i||!r)return Promise.resolve(Vr);const s={width:t.width,height:t.height,bitrate:Math.ceil(Math.max(.9*t.bitrate,t.averageBitrate)),framerate:t.frameRate||30},a=t.videoRange;"SDR"!==a&&(s.transferFunction=a.toLowerCase());const o=n.split(",").map((t=>({type:"media-source",video:_(_({},s),{},{contentType:Ee(t,"video")})})));return i&&t.audioGroups&&t.audioGroups.forEach((t=>{var r;t&&(null==(r=e.groups[t])||r.tracks.forEach((e=>{if(e.groupId===t){const t=e.channels||"",r=parseFloat(t);R(r)&&r>2&&o.push.apply(o,i.split(",").map((t=>({type:"media-source",audio:{contentType:Ee(t,"audio"),channels:""+r}}))))}})))})),Promise.all(o.map((t=>{const e=function(t){const{audio:e,video:r}=t,n=r||e;if(n){const t=n.contentType.split('"')[1];if(r)return`r${r.height}x${r.width}f${Math.ceil(r.framerate)}${r.transferFunction||"sd"}_${t}_${Math.ceil(r.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${t}`}return""}(t);return Wr[e]||(Wr[e]=r.decodingInfo(t))}))).then((t=>({supported:!t.some((t=>!t.supported)),configurations:o,decodingInfoResults:t}))).catch((t=>({supported:!1,configurations:o,decodingInfoResults:[],error:t})))}function zr(t,e){let r=!1,n=[];return t&&(r="SDR"!==t,n=[t]),e&&(n=e.allowedVideoRanges||ur.slice(0),r=void 0!==e.preferHDR?e.preferHDR:function(){if("function"==typeof matchMedia){const t=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(t.media!==e.media)return!0===t.matches}return!1}(),n=r?n.filter((t=>"SDR"!==t)):["SDR"]),{preferHDR:r,allowedVideoRanges:n}}function Xr(t,e){N.log(`[abr] start candidates with "${t}" ignored because ${e}`)}function Qr(t,e,r){if("attrs"in t){const r=e.indexOf(t);if(-1!==r)return r}for(let n=0;n<e.length;n++){if(Jr(t,e[n],r))return n}return-1}function Jr(t,e,r){const{groupId:n,name:i,lang:s,assocLang:a,characteristics:o,default:l}=t,c=t.forced;return(void 0===n||e.groupId===n)&&(void 0===i||e.name===i)&&(void 0===s||e.lang===s)&&(void 0===s||e.assocLang===a)&&(void 0===l||e.default===l)&&(void 0===c||e.forced===c)&&(void 0===o||function(t,e=""){const r=t.split(","),n=e.split(",");return r.length===n.length&&!r.some((t=>-1===n.indexOf(t)))}(o,e.characteristics))&&(void 0===r||r(t,e))}function Zr(t,e){const{audioCodec:r,channels:n}=t;return!(void 0!==r&&(e.audioCodec||"").substring(0,4)!==r.substring(0,4)||void 0!==n&&n!==(e.channels||"2"))}function tn(t,e,r){for(let n=e;n>-1;n--)if(r(t[n]))return n;for(let n=e+1;n<t.length;n++)if(r(t[n]))return n;return-1}class en{constructor(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(t){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,t),!0)}clearInterval(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)}clearNextTick(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)}tick(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var rn="NOT_LOADED",nn="APPENDING",sn="PARTIAL",an="OK";class on{constructor(t){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=t,this._registerListeners()}_registerListeners(){const{hls:t}=this;t.on(I.BUFFER_APPENDED,this.onBufferAppended,this),t.on(I.FRAG_BUFFERED,this.onFragBuffered,this),t.on(I.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:t}=this;t.off(I.BUFFER_APPENDED,this.onBufferAppended,this),t.off(I.FRAG_BUFFERED,this.onFragBuffered,this),t.off(I.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(t,e){const r=this.activePartLists[e];if(r)for(let e=r.length;e--;){const n=r[e];if(!n)break;const i=n.end;if(n.start<=t&&null!==i&&t<=i)return n}return this.getBufferedFrag(t,e)}getBufferedFrag(t,e){const{fragments:r}=this,n=Object.keys(r);for(let i=n.length;i--;){const s=r[n[i]];if((null==s?void 0:s.body.type)===e&&s.buffered){const e=s.body;if(e.start<=t&&t<=e.end)return e}}return null}detectEvictedFragments(t,e,r,n){this.timeRanges&&(this.timeRanges[t]=e);const i=(null==n?void 0:n.fragment.sn)||-1;Object.keys(this.fragments).forEach((n=>{const s=this.fragments[n];if(!s)return;if(i>=s.body.sn)return;if(!s.buffered&&!s.loaded)return void(s.body.type===r&&this.removeFragment(s.body));const a=s.range[t];a&&a.time.some((t=>{const r=!this.isTimeBuffered(t.startPTS,t.endPTS,e);return r&&this.removeFragment(s.body),r}))}))}detectPartialFragments(t){const e=this.timeRanges,{frag:r,part:n}=t;if(!e||"initSegment"===r.sn)return;const i=cn(r),s=this.fragments[i];if(!s||s.buffered&&r.gap)return;const a=!r.relurl;if(Object.keys(e).forEach((t=>{const i=r.elementaryStreams[t];if(!i)return;const o=e[t],l=a||!0===i.partial;s.range[t]=this.getBufferedTimes(r,n,l,o)})),s.loaded=null,Object.keys(s.range).length){s.buffered=!0;(s.body.endList=r.endList||s.body.endList)&&(this.endListFragments[s.body.type]=s),ln(s)||this.removeParts(r.sn-1,r.type)}else this.removeFragment(s.body)}removeParts(t,e){const r=this.activePartLists[e];r&&(this.activePartLists[e]=r.filter((e=>e.fragment.sn>=t)))}fragBuffered(t,e){const r=cn(t);let n=this.fragments[r];!n&&e&&(n=this.fragments[r]={body:t,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},t.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,n.buffered=!0)}getBufferedTimes(t,e,r,n){const i={time:[],partial:r},s=t.start,a=t.end,o=t.minEndPTS||a,l=t.maxStartPTS||s;for(let t=0;t<n.length;t++){const e=n.start(t)-this.bufferPadding,r=n.end(t)+this.bufferPadding;if(l>=e&&o<=r){i.time.push({startPTS:Math.max(s,n.start(t)),endPTS:Math.min(a,n.end(t))});break}if(s<r&&a>e){const e=Math.max(s,n.start(t)),r=Math.min(a,n.end(t));r>e&&(i.partial=!0,i.time.push({startPTS:e,endPTS:r}))}else if(a<=e)break}return i}getPartialFragment(t){let e,r,n,i=null,s=0;const{bufferPadding:a,fragments:o}=this;return Object.keys(o).forEach((l=>{const c=o[l];c&&ln(c)&&(r=c.body.start-a,n=c.body.end+a,t>=r&&t<=n&&(e=Math.min(t-r,n-t),s<=e&&(i=c.body,s=e)))})),i}isEndListAppended(t){const e=this.endListFragments[t];return void 0!==e&&(e.buffered||ln(e))}getState(t){const e=cn(t),r=this.fragments[e];return r?r.buffered?ln(r)?sn:an:nn:rn}isTimeBuffered(t,e,r){let n,i;for(let s=0;s<r.length;s++){if(n=r.start(s)-this.bufferPadding,i=r.end(s)+this.bufferPadding,t>=n&&e<=i)return!0;if(e<=n)return!1}return!1}onFragLoaded(t,e){const{frag:r,part:n}=e;if("initSegment"===r.sn||r.bitrateTest)return;const i=n?null:e,s=cn(r);this.fragments[s]={body:r,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}onBufferAppended(t,e){const{frag:r,part:n,timeRanges:i}=e;if("initSegment"===r.sn)return;const s=r.type;if(n){let t=this.activePartLists[s];t||(this.activePartLists[s]=t=[]),t.push(n)}this.timeRanges=i,Object.keys(i).forEach((t=>{const e=i[t];this.detectEvictedFragments(t,e,s,n)}))}onFragBuffered(t,e){this.detectPartialFragments(e)}hasFragment(t){const e=cn(t);return!!this.fragments[e]}hasParts(t){var e;return!(null==(e=this.activePartLists[t])||!e.length)}removeFragmentsInRange(t,e,r,n,i){n&&!this.hasGaps||Object.keys(this.fragments).forEach((s=>{const a=this.fragments[s];if(!a)return;const o=a.body;o.type!==r||n&&!o.gap||o.start<e&&o.end>t&&(a.buffered||i)&&this.removeFragment(o)}))}removeFragment(t){const e=cn(t);t.stats.loaded=0,t.clearElementaryStreamInfo();const r=this.activePartLists[t.type];if(r){const e=t.sn;this.activePartLists[t.type]=r.filter((t=>t.fragment.sn!==e))}delete this.fragments[e],t.endList&&delete this.endListFragments[t.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function ln(t){var e,r,n;return t.buffered&&(t.body.gap||(null==(e=t.range.video)?void 0:e.partial)||(null==(r=t.range.audio)?void 0:r.partial)||(null==(n=t.range.audiovideo)?void 0:n.partial))}function cn(t){return`${t.type}_${t.level}_${t.sn}`}const un={length:0,start:()=>0,end:()=>0};class hn{static isBuffered(t,e){try{if(t){const r=hn.getBuffered(t);for(let t=0;t<r.length;t++)if(e>=r.start(t)&&e<=r.end(t))return!0}}catch(t){}return!1}static bufferInfo(t,e,r){try{if(t){const n=hn.getBuffered(t),i=[];let s;for(s=0;s<n.length;s++)i.push({start:n.start(s),end:n.end(s)});return this.bufferedInfo(i,e,r)}}catch(t){}return{len:0,start:e,end:e,nextStart:void 0}}static bufferedInfo(t,e,r){e=Math.max(0,e),t.sort((function(t,e){const r=t.start-e.start;return r||e.end-t.end}));let n=[];if(r)for(let e=0;e<t.length;e++){const i=n.length;if(i){const s=n[i-1].end;t[e].start-s<r?t[e].end>s&&(n[i-1].end=t[e].end):n.push(t[e])}else n.push(t[e])}else n=t;let i,s=0,a=e,o=e;for(let t=0;t<n.length;t++){const l=n[t].start,c=n[t].end;if(e+r>=l&&e<c)a=l,o=c,s=o-e;else if(e+r<l){i=l;break}}return{len:s,start:a||0,end:o||0,nextStart:i}}static getBuffered(t){try{return t.buffered}catch(t){return N.log("failed to get media.buffered",t),un}}}class dn{constructor(t,e,r,n=0,i=-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={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=t,this.sn=e,this.id=r,this.size=n,this.part=i,this.partial=s}}function fn(t,e){for(let n=0,i=t.length;n<i;n++){var r;if((null==(r=t[n])?void 0:r.cc)===e)return t[n]}return null}function pn(t,e){if(t){const r=t.start+e;t.start=t.startPTS=r,t.endPTS=r+t.duration}}function gn(t,e){const r=e.fragments;for(let e=0,n=r.length;e<n;e++)pn(r[e],t);e.fragmentHint&&pn(e.fragmentHint,t),e.alignedSliding=!0}function mn(t,e,r){e&&(!function(t,e,r){if(function(t,e,r){return!(!e||!(r.endCC>r.startCC||t&&t.cc<r.startCC))}(t,r,e)){const t=function(t,e){const r=t.fragments,n=e.fragments;if(!n.length||!r.length)return void N.log("No fragments to align");const i=fn(r,n[0].cc);if(i&&(!i||i.startPTS))return i;N.log("No frag in previous level to align on")}(r,e);t&&R(t.start)&&(N.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),gn(t.start,e))}}(t,r,e),!r.alignedSliding&&e&&yn(r,e),r.alignedSliding||!e||r.skippedSegments||Tr(e,r))}function yn(t,e){if(!t.hasProgramDateTime||!e.hasProgramDateTime)return;const r=t.fragments,n=e.fragments;if(!r.length||!n.length)return;let i,s;const a=Math.min(e.endCC,t.endCC);e.startCC<a&&t.startCC<a&&(i=fn(n,a),s=fn(r,a)),i&&s||(i=n[Math.floor(n.length/2)],s=fn(r,i.cc)||r[Math.floor(r.length/2)]);const o=i.programDateTime,l=s.programDateTime;if(!o||!l)return;gn((l-o)/1e3-(s.start-i.start),t)}const vn=Math.pow(2,17);class En{constructor(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(t,e){const r=t.url;if(!r)return Promise.reject(new Sn({type:x.NETWORK_ERROR,details:P.FRAG_LOAD_ERROR,fatal:!1,frag:t,error:new Error("Fragment does not have a "+(r?"part list":"url")),networkDetails:null}));this.abort();const n=this.config,i=n.fLoader,s=n.loader;return new Promise(((a,o)=>{if(this.loader&&this.loader.destroy(),t.gap){if(t.tagList.some((t=>"GAP"===t[0])))return void o(Tn(t));t.gap=!1}const l=this.loader=t.loader=i?new i(n):new s(n),c=bn(t),u=Cr(n.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===t.sn?1/0:vn};t.stats=l.stats,l.load(c,h,{onSuccess:(e,r,n,i)=>{this.resetLoader(t,l);let s=e.data;n.resetIV&&t.decryptdata&&(t.decryptdata.iv=new Uint8Array(s.slice(0,16)),s=s.slice(16)),a({frag:t,part:null,payload:s,networkDetails:i})},onError:(e,n,i,s)=>{this.resetLoader(t,l),o(new Sn({type:x.NETWORK_ERROR,details:P.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:_({url:r,data:void 0},e),error:new Error(`HTTP Error ${e.code} ${e.text}`),networkDetails:i,stats:s}))},onAbort:(e,r,n)=>{this.resetLoader(t,l),o(new Sn({type:x.NETWORK_ERROR,details:P.INTERNAL_ABORTED,fatal:!1,frag:t,error:new Error("Aborted"),networkDetails:n,stats:e}))},onTimeout:(e,r,n)=>{this.resetLoader(t,l),o(new Sn({type:x.NETWORK_ERROR,details:P.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:n,stats:e}))},onProgress:(r,n,i,s)=>{e&&e({frag:t,part:null,payload:i,networkDetails:s})}})}))}loadPart(t,e,r){this.abort();const n=this.config,i=n.fLoader,s=n.loader;return new Promise(((a,o)=>{if(this.loader&&this.loader.destroy(),t.gap||e.gap)return void o(Tn(t,e));const l=this.loader=t.loader=i?new i(n):new s(n),c=bn(t,e),u=Cr(n.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:vn};e.stats=l.stats,l.load(c,h,{onSuccess:(n,i,s,o)=>{this.resetLoader(t,l),this.updateStatsFromPart(t,e);const c={frag:t,part:e,payload:n.data,networkDetails:o};r(c),a(c)},onError:(r,n,i,s)=>{this.resetLoader(t,l),o(new Sn({type:x.NETWORK_ERROR,details:P.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:e,response:_({url:c.url,data:void 0},r),error:new Error(`HTTP Error ${r.code} ${r.text}`),networkDetails:i,stats:s}))},onAbort:(r,n,i)=>{t.stats.aborted=e.stats.aborted,this.resetLoader(t,l),o(new Sn({type:x.NETWORK_ERROR,details:P.INTERNAL_ABORTED,fatal:!1,frag:t,part:e,error:new Error("Aborted"),networkDetails:i,stats:r}))},onTimeout:(r,n,i)=>{this.resetLoader(t,l),o(new Sn({type:x.NETWORK_ERROR,details:P.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:i,stats:r}))}})}))}updateStatsFromPart(t,e){const r=t.stats,n=e.stats,i=n.total;if(r.loaded+=n.loaded,i){const n=Math.round(t.duration/e.duration),s=Math.min(Math.round(r.loaded/i),n),a=(n-s)*Math.round(r.loaded/s);r.total=r.loaded+a}else r.total=Math.max(r.loaded,r.total);const s=r.loading,a=n.loading;s.start?s.first+=a.first-a.start:(s.start=a.start,s.first=a.first),s.end=a.end}resetLoader(t,e){t.loader=null,this.loader===e&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),e.destroy()}}function bn(t,e=null){const r=e||t,n={frag:t,part:e,responseType:"arraybuffer",url:r.url,headers:{},rangeStart:0,rangeEnd:0},i=r.byteRangeStartOffset,s=r.byteRangeEndOffset;if(R(i)&&R(s)){var a;let e=i,r=s;if("initSegment"===t.sn&&"AES-128"===(null==(a=t.decryptdata)?void 0:a.method)){const t=s-i;t%16&&(r=s+(16-t%16)),0!==i&&(n.resetIV=!0,e=i-16)}n.rangeStart=e,n.rangeEnd=r}return n}function Tn(t,e){const r=new Error(`GAP ${t.gap?"tag":"attribute"} found`),n={type:x.MEDIA_ERROR,details:P.FRAG_GAP,fatal:!1,frag:t,error:r,networkDetails:null};return e&&(n.part=e),(e||t).stats.aborted=!0,new Sn(n)}class Sn extends Error{constructor(t){super(t.error.message),this.data=void 0,this.data=t}}class An{constructor(t,e){this.subtle=void 0,this.aesIV=void 0,this.subtle=t,this.aesIV=e}decrypt(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)}}class _n{constructor(t,e){this.subtle=void 0,this.key=void 0,this.subtle=t,this.key=e}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}class kn{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_(t){const e=new DataView(t),r=new Uint32Array(4);for(let t=0;t<4;t++)r[t]=e.getUint32(4*t);return r}initTable(){const t=this.sBox,e=this.invSBox,r=this.subMix,n=r[0],i=r[1],s=r[2],a=r[3],o=this.invSubMix,l=o[0],c=o[1],u=o[2],h=o[3],d=new Uint32Array(256);let f=0,p=0,g=0;for(g=0;g<256;g++)d[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){let r=p^p<<1^p<<2^p<<3^p<<4;r=r>>>8^255&r^99,t[f]=r,e[r]=f;const o=d[f],g=d[o],m=d[g];let y=257*d[r]^16843008*r;n[f]=y<<24|y>>>8,i[f]=y<<16|y>>>16,s[f]=y<<8|y>>>24,a[f]=y,y=16843009*m^65537*g^257*o^16843008*f,l[r]=y<<24|y>>>8,c[r]=y<<16|y>>>16,u[r]=y<<8|y>>>24,h[r]=y,f?(f=o^d[d[d[m^o]]],p^=d[d[p]]):f=p=1}}expandKey(t){const e=this.uint8ArrayToUint32Array_(t);let r=!0,n=0;for(;n<e.length&&r;)r=e[n]===this.key[n],n++;if(r)return;this.key=e;const i=this.keySize=e.length;if(4!==i&&6!==i&&8!==i)throw new Error("Invalid aes key size="+i);const s=this.ksRows=4*(i+6+1);let a,o;const l=this.keySchedule=new Uint32Array(s),c=this.invKeySchedule=new Uint32Array(s),u=this.sBox,h=this.rcon,d=this.invSubMix,f=d[0],p=d[1],g=d[2],m=d[3];let y,v;for(a=0;a<s;a++)a<i?y=l[a]=e[a]:(v=y,a%i==0?(v=v<<8|v>>>24,v=u[v>>>24]<<24|u[v>>>16&255]<<16|u[v>>>8&255]<<8|u[255&v],v^=h[a/i|0]<<24):i>6&&a%i==4&&(v=u[v>>>24]<<24|u[v>>>16&255]<<16|u[v>>>8&255]<<8|u[255&v]),l[a]=y=(l[a-i]^v)>>>0);for(o=0;o<s;o++)a=s-o,v=3&o?l[a]:l[a-4],c[o]=o<4||a<=4?v:f[u[v>>>24]]^p[u[v>>>16&255]]^g[u[v>>>8&255]]^m[u[255&v]],c[o]=c[o]>>>0}networkToHostOrderSwap(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24}decrypt(t,e,r){const n=this.keySize+6,i=this.invKeySchedule,s=this.invSBox,a=this.invSubMix,o=a[0],l=a[1],c=a[2],u=a[3],h=this.uint8ArrayToUint32Array_(r);let d=h[0],f=h[1],p=h[2],g=h[3];const m=new Int32Array(t),y=new Int32Array(m.length);let v,E,b,T,S,A,_,k,L,w,R,C,D,I;const x=this.networkToHostOrderSwap;for(;e<m.length;){for(L=x(m[e]),w=x(m[e+1]),R=x(m[e+2]),C=x(m[e+3]),S=L^i[0],A=C^i[1],_=R^i[2],k=w^i[3],D=4,I=1;I<n;I++)v=o[S>>>24]^l[A>>16&255]^c[_>>8&255]^u[255&k]^i[D],E=o[A>>>24]^l[_>>16&255]^c[k>>8&255]^u[255&S]^i[D+1],b=o[_>>>24]^l[k>>16&255]^c[S>>8&255]^u[255&A]^i[D+2],T=o[k>>>24]^l[S>>16&255]^c[A>>8&255]^u[255&_]^i[D+3],S=v,A=E,_=b,k=T,D+=4;v=s[S>>>24]<<24^s[A>>16&255]<<16^s[_>>8&255]<<8^s[255&k]^i[D],E=s[A>>>24]<<24^s[_>>16&255]<<16^s[k>>8&255]<<8^s[255&S]^i[D+1],b=s[_>>>24]<<24^s[k>>16&255]<<16^s[S>>8&255]<<8^s[255&A]^i[D+2],T=s[k>>>24]<<24^s[S>>16&255]<<16^s[A>>8&255]<<8^s[255&_]^i[D+3],y[e]=x(v^d),y[e+1]=x(T^f),y[e+2]=x(b^p),y[e+3]=x(E^g),d=L,f=w,p=R,g=C,e+=4}return y.buffer}}class Ln{constructor(t,{removePKCS7Padding:e=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=t.enableSoftwareAES,this.removePKCS7Padding=e,e)try{const t=self.crypto;t&&(this.subtle=t.subtle||t.webkitSubtle)}catch(t){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:t,remainderData:e}=this;if(!t||e)return this.reset(),null;const r=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?function(t){const e=t.byteLength,r=e&&new DataView(t.buffer).getUint8(e-1);return r?yt(t,0,e-r):t}(r):r}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(t,e,r){return this.useSoftware?new Promise(((n,i)=>{this.softwareDecrypt(new Uint8Array(t),e,r);const s=this.flush();s?n(s.buffer):i(new Error("[softwareDecrypt] Failed to decrypt data"))})):this.webCryptoDecrypt(new Uint8Array(t),e,r)}softwareDecrypt(t,e,r){const{currentIV:n,currentResult:i,remainderData:s}=this;this.logOnce("JS AES decrypt"),s&&(t=te(s,t),this.remainderData=null);const a=this.getValidChunk(t);if(!a.length)return null;n&&(r=n);let o=this.softwareDecrypter;o||(o=this.softwareDecrypter=new kn),o.expandKey(e);const l=i;return this.currentResult=o.decrypt(a.buffer,0,r),this.currentIV=yt(a,-16).buffer,l||null}webCryptoDecrypt(t,e,r){if(this.key!==e||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(t,e,r));this.key=e,this.fastAesKey=new _n(this.subtle,e)}return this.fastAesKey.expandKey().then((e=>{if(!this.subtle)return Promise.reject(new Error("web crypto not initialized"));this.logOnce("WebCrypto AES decrypt");return new An(this.subtle,new Uint8Array(r)).decrypt(t.buffer,e)})).catch((n=>(N.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(t,e,r))))}onWebCryptoError(t,e,r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(t,e,r);const n=this.flush();if(n)return n.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(t){let e=t;const r=t.length-t.length%16;return r!==t.length&&(e=yt(t,0,r),this.remainderData=yt(t,r)),e}logOnce(t){this.logEnabled&&(N.log(`[decrypter]: ${t}`),this.logEnabled=!1)}}const wn=function(t){let e="";const r=t.length;for(let n=0;n<r;n++)e+=`[${t.start(n).toFixed(3)}-${t.end(n).toFixed(3)}]`;return e},Rn="STOPPED",Cn="IDLE",Dn="KEY_LOADING",In="FRAG_LOADING",xn="FRAG_LOADING_WAITING_RETRY",Pn="WAITING_TRACK",On="PARSING",Mn="PARSED",Fn="ENDED",Bn="ERROR",Nn="WAITING_INIT_PTS",Un="WAITING_LEVEL";class $n extends en{constructor(t,e,r,n,i){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=Rn,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=i,this.logPrefix=n,this.log=N.log.bind(N,`${n}:`),this.warn=N.warn.bind(N,`${n}:`),this.hls=t,this.fragmentLoader=new En(t.config),this.keyLoader=r,this.fragmentTracker=e,this.config=t.config,this.decrypter=new Ln(t.config),t.on(I.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(t){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const t=this.fragCurrent;null!=t&&t.loader&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Rn}_streamEnded(t,e){if(e.live||t.nextStart||!t.end||!this.media)return!1;const r=e.partList;if(null!=r&&r.length){const t=r[r.length-1];return hn.isBuffered(this.media,t.start+t.duration/2)}const n=e.fragments[e.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(n)}getLevelDetails(){var t;if(this.levels&&null!==this.levelLastLoaded)return null==(t=this.levelLastLoaded)?void 0:t.details}onMediaAttached(t,e){const r=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),r.addEventListener("seeking",this.onvseeking),r.addEventListener("ended",this.onvended);const n=this.config;this.levels&&n.autoStartLoad&&this.state===Rn&&this.startLoad(n.startPosition)}onMediaDetaching(){const t=this.media;null!=t&&t.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),t&&this.onvseeking&&this.onvended&&(t.removeEventListener("seeking",this.onvseeking),t.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:t,fragCurrent:e,media:r,mediaBuffer:n,state:i}=this,s=r?r.currentTime:0,a=hn.bufferInfo(n||r,s,t.maxBufferHole);if(this.log(`media seeking to ${R(s)?s.toFixed(3):s}, state: ${i}`),this.state===Fn)this.resetLoadingState();else if(e){const r=t.maxFragLookUpTolerance,n=e.start-r,i=e.start+e.duration+r;if(!a.len||i<a.start||n>a.end){const t=s>i;(s<n||t)&&(t&&e.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),e.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}r&&(this.fragmentTracker.removeFragmentsInRange(s,1/0,this.playlistType,!0),this.lastCurrentTime=s),this.loadedmetadata||a.len||(this.nextLoadPosition=this.startPosition=s),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(t,e){this.startTimeOffset=e.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=Rn,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(t,e,r){this._loadFragForPlayback(t,e,r)}_loadFragForPlayback(t,e,r){this._doFragLoad(t,e,r,(e=>{if(this.fragContextChanged(t))return this.warn(`Fragment ${t.sn}${e.part?" p: "+e.part.index:""} of level ${t.level} was dropped during download.`),void this.fragmentTracker.removeFragment(t);t.stats.chunkCount++,this._handleFragmentLoadProgress(e)})).then((e=>{if(!e)return;const r=this.state;this.fragContextChanged(t)?(r===In||!this.fragCurrent&&r===On)&&(this.fragmentTracker.removeFragment(t),this.state=Cn):("payload"in e&&(this.log(`Loaded fragment ${t.sn} of level ${t.level}`),this.hls.trigger(I.FRAG_LOADED,e)),this._handleFragmentLoadComplete(e))})).catch((e=>{this.state!==Rn&&this.state!==Bn&&(this.warn(`Frag error: ${(null==e?void 0:e.message)||e}`),this.resetFragmentLoading(t))}))}clearTrackerIfNeeded(t){var e;const{fragmentTracker:r}=this;if(r.getState(t)===nn){const e=t.type,n=this.getFwdBufferInfo(this.mediaBuffer,e),i=Math.max(t.duration,n?n.len:this.config.maxBufferLength),s=this.backtrackFragment;(1===(s?t.sn-s.sn:0)||this.reduceMaxBufferLength(i,t.duration))&&r.removeFragment(t)}else 0===(null==(e=this.mediaBuffer)?void 0:e.buffered.length)?r.removeAllFragments():r.hasParts(t.type)&&(r.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type}),r.getState(t)===sn&&r.removeFragment(t))}checkLiveUpdate(t){if(t.updated&&!t.live){const e=t.fragments[t.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type})}t.fragments[0]||(t.deltaUpdateFailed=!0)}flushMainBuffer(t,e,r=null){if(!(t-e))return;const n={startOffset:t,endOffset:e,type:r};this.hls.trigger(I.BUFFER_FLUSHING,n)}_loadInitSegment(t,e){this._doFragLoad(t,e).then((e=>{if(!e||this.fragContextChanged(t)||!this.levels)throw new Error("init load aborted");return e})).then((e=>{const{hls:r}=this,{payload:n}=e,i=t.decryptdata;if(n&&n.byteLength>0&&null!=i&&i.key&&i.iv&&"AES-128"===i.method){const s=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer).catch((e=>{throw r.trigger(I.ERROR,{type:x.MEDIA_ERROR,details:P.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e})).then((n=>{const i=self.performance.now();return r.trigger(I.FRAG_DECRYPTED,{frag:t,payload:n,stats:{tstart:s,tdecrypt:i}}),e.payload=n,this.completeInitSegmentLoad(e)}))}return this.completeInitSegmentLoad(e)})).catch((e=>{this.state!==Rn&&this.state!==Bn&&(this.warn(e),this.resetFragmentLoading(t))}))}completeInitSegmentLoad(t){const{levels:e}=this;if(!e)throw new Error("init load aborted, missing levels");const r=t.frag.stats;this.state=Cn,t.frag.data=new Uint8Array(t.payload),r.parsing.start=r.buffering.start=self.performance.now(),r.parsing.end=r.buffering.end=self.performance.now(),this.tick()}fragContextChanged(t){const{fragCurrent:e}=this;return!t||!e||t.sn!==e.sn||t.level!==e.level}fragBufferedComplete(t,e){var r,n,i,s;const a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${t.type} sn: ${t.sn}${e?" part: "+e.index:""} of ${this.playlistType===Ke?"level":"track"} ${t.level} (frag:[${(null!=(r=t.startPTS)?r:NaN).toFixed(3)}-${(null!=(n=t.endPTS)?n:NaN).toFixed(3)}] > buffer:${a?wn(hn.getBuffered(a)):"(detached)"})`),"initSegment"!==t.sn){var o;if(t.type!==Ve){const e=t.elementaryStreams;if(!Object.keys(e).some((t=>!!e[t])))return void(this.state=Cn)}const e=null==(o=this.levels)?void 0:o[t.level];null!=e&&e.fragmentError&&(this.log(`Resetting level fragment error count of ${e.fragmentError} on frag buffered`),e.fragmentError=0)}this.state=Cn,a&&(!this.loadedmetadata&&t.type==Ke&&a.buffered.length&&(null==(i=this.fragCurrent)?void 0:i.sn)===(null==(s=this.fragPrevious)?void 0:s.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(t){const{transmuxer:e}=this;if(!e)return;const{frag:r,part:n,partsLoaded:i}=t,s=!i||0===i.length||i.some((t=>!t)),a=new dn(r.level,r.sn,r.stats.chunkCount+1,0,n?n.index:-1,!s);e.flush(a)}_handleFragmentLoadProgress(t){}_doFragLoad(t,e,r=null,n){var i;const s=null==e?void 0:e.details;if(!this.levels||!s)throw new Error(`frag load aborted, missing level${s?"":" detail"}s`);let a=null;if(!t.encrypted||null!=(i=t.decryptdata)&&i.key?!t.encrypted&&s.encryptedFragments.length&&this.keyLoader.loadClear(t,s.encryptedFragments):(this.log(`Loading key for ${t.sn} of [${s.startSN}-${s.endSN}], ${"[stream-controller]"===this.logPrefix?"level":"track"} ${t.level}`),this.state=Dn,this.fragCurrent=t,a=this.keyLoader.load(t).then((t=>{if(!this.fragContextChanged(t.frag))return this.hls.trigger(I.KEY_LOADED,t),this.state===Dn&&(this.state=Cn),t})),this.hls.trigger(I.KEY_LOADING,{frag:t}),null===this.fragCurrent&&(a=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),r=Math.max(t.start,r||0),this.config.lowLatencyMode&&"initSegment"!==t.sn){const i=s.partList;if(i&&n){r>t.end&&s.fragmentHint&&(t=s.fragmentHint);const o=this.getNextPart(i,t,r);if(o>-1){const l=i[o];let c;return this.log(`Loading part sn: ${t.sn} p: ${l.index} cc: ${t.cc} of playlist [${s.startSN}-${s.endSN}] parts [0-${o}-${i.length-1}] ${"[stream-controller]"===this.logPrefix?"level":"track"}: ${t.level}, target: ${parseFloat(r.toFixed(3))}`),this.nextLoadPosition=l.start+l.duration,this.state=In,c=a?a.then((r=>!r||this.fragContextChanged(r.frag)?null:this.doFragPartsLoad(t,l,e,n))).catch((t=>this.handleFragLoadError(t))):this.doFragPartsLoad(t,l,e,n).catch((t=>this.handleFragLoadError(t))),this.hls.trigger(I.FRAG_LOADING,{frag:t,part:l,targetBufferTime:r}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):c}if(!t.url||this.loadedEndOfParts(i,r))return Promise.resolve(null)}}this.log(`Loading fragment ${t.sn} cc: ${t.cc} ${s?"of ["+s.startSN+"-"+s.endSN+"] ":""}${"[stream-controller]"===this.logPrefix?"level":"track"}: ${t.level}, target: ${parseFloat(r.toFixed(3))}`),R(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=In;const o=this.config.progressive;let l;return l=o&&a?a.then((e=>!e||this.fragContextChanged(null==e?void 0:e.frag)?null:this.fragmentLoader.load(t,n))).catch((t=>this.handleFragLoadError(t))):Promise.all([this.fragmentLoader.load(t,o?n:void 0),a]).then((([t])=>(!o&&t&&n&&n(t),t))).catch((t=>this.handleFragLoadError(t))),this.hls.trigger(I.FRAG_LOADING,{frag:t,targetBufferTime:r}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(t,e,r,n){return new Promise(((i,s)=>{var a;const o=[],l=null==(a=r.details)?void 0:a.partList,c=e=>{this.fragmentLoader.loadPart(t,e,n).then((n=>{o[e.index]=n;const s=n.part;this.hls.trigger(I.FRAG_LOADED,n);const a=Ar(r,t.sn,e.index+1)||_r(l,t.sn,e.index+1);if(!a)return i({frag:t,part:s,partsLoaded:o});c(a)})).catch(s)};c(e)}))}handleFragLoadError(t){if("data"in t){const e=t.data;t.data&&e.details===P.INTERNAL_ABORTED?this.handleFragLoadAborted(e.frag,e.part):this.hls.trigger(I.ERROR,e)}else this.hls.trigger(I.ERROR,{type:x.OTHER_ERROR,details:P.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null}_handleTransmuxerFlush(t){const e=this.getCurrentContext(t);if(!e||this.state!==On)return void(this.fragCurrent||this.state===Rn||this.state===Bn||(this.state=Cn));const{frag:r,part:n,level:i}=e,s=self.performance.now();r.stats.parsing.end=s,n&&(n.stats.parsing.end=s),this.updateLevelTiming(r,n,i,t.partial)}getCurrentContext(t){const{levels:e,fragCurrent:r}=this,{level:n,sn:i,part:s}=t;if(null==e||!e[n])return this.warn(`Levels object was unset while buffering fragment ${i} of level ${n}. The current chunk will not be buffered.`),null;const a=e[n],o=s>-1?Ar(a,i,s):null,l=o?o.fragment:function(t,e,r){if(null==t||!t.details)return null;const n=t.details;let i=n.fragments[e-n.startSN];return i||(i=n.fragmentHint,i&&i.sn===e?i:e<n.startSN&&r&&r.sn===e?r:null)}(a,i,r);return l?(r&&r!==l&&(l.stats=r.stats),{frag:l,part:o,level:a}):null}bufferFragmentData(t,e,r,n,i){var s;if(!t||this.state!==On)return;const{data1:a,data2:o}=t;let l=a;if(a&&o&&(l=te(a,o)),null==(s=l)||!s.length)return;const c={type:t.type,frag:e,part:r,chunkMeta:n,parent:e.type,data:l};if(this.hls.trigger(I.BUFFER_APPENDING,c),t.dropped&&t.independent&&!r){if(i)return;this.flushBufferGap(e)}}flushBufferGap(t){const e=this.media;if(!e)return;if(!hn.isBuffered(e,e.currentTime))return void this.flushMainBuffer(0,t.start);const r=e.currentTime,n=hn.bufferInfo(e,r,0),i=t.duration,s=Math.min(2*this.config.maxFragLookUpTolerance,.25*i),a=Math.max(Math.min(t.start-s,n.end-s),r+s);t.start-a>s&&this.flushMainBuffer(a,t.start)}getFwdBufferInfo(t,e){const r=this.getLoadPosition();return R(r)?this.getFwdBufferInfoAtPos(t,r,e):null}getFwdBufferInfoAtPos(t,e,r){const{config:{maxBufferHole:n}}=this,i=hn.bufferInfo(t,e,n);if(0===i.len&&void 0!==i.nextStart){const s=this.fragmentTracker.getBufferedFrag(e,r);if(s&&i.nextStart<s.end)return hn.bufferInfo(t,e,Math.max(i.nextStart,n))}return i}getMaxBufferLength(t){const{config:e}=this;let r;return r=t?Math.max(8*e.maxBufferSize/t,e.maxBufferLength):e.maxBufferLength,Math.min(r,e.maxMaxBufferLength)}reduceMaxBufferLength(t,e){const r=this.config,n=Math.max(Math.min(t-e,r.maxBufferLength),e),i=Math.max(t-3*e,r.maxMaxBufferLength/2,n);return i>=n&&(r.maxMaxBufferLength=i,this.warn(`Reduce max buffer length to ${i}s`),!0)}getAppendedFrag(t,e=Ke){const r=this.fragmentTracker.getAppendedFrag(t,Ke);return r&&"fragment"in r?r.fragment:r}getNextFragment(t,e){const r=e.fragments,n=r.length;if(!n)return null;const{config:i}=this,s=r[0].start;let a;if(e.live){const o=i.initialLiveManifestSize;if(n<o)return this.warn(`Not enough fragments to start playback (have: ${n}, need: ${o})`),null;(!e.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||t<s)&&(a=this.getInitialLiveFragment(e,r),this.startPosition=this.nextLoadPosition=a?this.hls.liveSyncPosition||a.start:t)}else t<=s&&(a=r[0]);if(!a){const r=i.lowLatencyMode?e.partEnd:e.fragmentEnd;a=this.getFragmentAtPosition(t,r,e)}return this.mapToInitFragWhenRequired(a)}isLoopLoading(t,e){const r=this.fragmentTracker.getState(t);return(r===an||r===sn&&!!t.gap)&&this.nextLoadPosition>e}getNextFragmentLoopLoading(t,e,r,n,i){const s=t.gap,a=this.getNextFragment(this.nextLoadPosition,e);if(null===a)return a;if(t=a,s&&t&&!t.gap&&r.nextStart){const e=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,n);if(null!==e&&r.len+e.len>=i)return this.log(`buffer full after gaps in "${n}" playlist starting at sn: ${t.sn}`),null}return t}mapToInitFragWhenRequired(t){return null==t||!t.initSegment||null!=t&&t.initSegment.data||this.bitrateTest?t:t.initSegment}getNextPart(t,e,r){let n=-1,i=!1,s=!0;for(let a=0,o=t.length;a<o;a++){const o=t[a];if(s=s&&!o.independent,n>-1&&r<o.start)break;const l=o.loaded;l?n=-1:(i||o.independent||s)&&o.fragment===e&&(n=a),i=l}return n}loadedEndOfParts(t,e){const r=t[t.length-1];return r&&e>r.start&&r.loaded}getInitialLiveFragment(t,e){const r=this.fragPrevious;let n=null;if(r){if(t.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${r.programDateTime}`),n=function(t,e,r){if(null===e||!Array.isArray(t)||!t.length||!R(e))return null;if(e<(t[0].programDateTime||0))return null;if(e>=(t[t.length-1].endProgramDateTime||0))return null;r=r||0;for(let n=0;n<t.length;++n){const i=t[n];if(Or(e,r,i))return i}return null}(e,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){const i=r.sn+1;if(i>=t.startSN&&i<=t.endSN){const s=e[i-t.startSN];r.cc===s.cc&&(n=s,this.log(`Live playlist, switching playlist, load frag with next SN: ${n.sn}`))}n||(n=function(t,e){return Ir(t,(t=>t.cc<e?1:t.cc>e?-1:0))}(e,r.cc),n&&this.log(`Live playlist, switching playlist, load frag with same CC: ${n.sn}`))}}else{const e=this.hls.liveSyncPosition;null!==e&&(n=this.getFragmentAtPosition(e,this.bitrateTest?t.fragmentEnd:t.edge,t))}return n}getFragmentAtPosition(t,e,r){const{config:n}=this;let{fragPrevious:i}=this,{fragments:s,endSN:a}=r;const{fragmentHint:o}=r,{maxFragLookUpTolerance:l}=n,c=r.partList,u=!!(n.lowLatencyMode&&null!=c&&c.length&&o);let h;if(u&&o&&!this.bitrateTest&&(s=s.concat(o),a=o.sn),t<e){h=xr(i,s,t,t>e-l?0:l)}else h=s[s.length-1];if(h){const t=h.sn-r.startSN,e=this.fragmentTracker.getState(h);if((e===an||e===sn&&h.gap)&&(i=h),i&&h.sn===i.sn&&(!u||c[0].fragment.sn>h.sn)){if(i&&h.level===i.level){const e=s[t+1];h=h.sn<a&&this.fragmentTracker.getState(e)!==an?e:null}}}return h}synchronizeToLiveEdge(t){const{config:e,media:r}=this;if(!r)return;const n=this.hls.liveSyncPosition,i=r.currentTime,s=t.fragments[0].start,a=t.edge,o=i>=s-e.maxFragLookUpTolerance&&i<=a;if(null!==n&&r.duration>n&&(i<n||!o)){const s=void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:e.liveMaxLatencyDurationCount*t.targetduration;(!o&&r.readyState<4||i<a-s)&&(this.loadedmetadata||(this.nextLoadPosition=n),r.readyState&&(this.warn(`Playback: ${i.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${n.toFixed(3)}`),r.currentTime=n))}}alignPlaylists(t,e,r){const n=t.fragments.length;if(!n)return this.warn("No fragments in live playlist"),0;const i=t.fragments[0].start,s=!e,a=t.alignedSliding&&R(i);if(s||!a&&!i){const{fragPrevious:i}=this;mn(i,r,t);const s=t.fragments[0].start;return this.log(`Live playlist sliding: ${s.toFixed(2)} start-sn: ${e?e.startSN:"na"}->${t.startSN} prev-sn: ${i?i.sn:"na"} fragments: ${n}`),s}return i}waitForCdnTuneIn(t){return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)}setStartPosition(t,e){let r=this.startPosition;if(r<e&&(r=-1),-1===r||-1===this.lastCurrentTime){const n=null!==this.startTimeOffset,i=n?this.startTimeOffset:t.startTimeOffset;null!==i&&R(i)?(r=e+i,i<0&&(r+=t.totalduration),r=Math.min(Math.max(e,r),e+t.totalduration),this.log(`Start time offset ${i} found in ${n?"multivariant":"media"} playlist, adjust startPosition to ${r}`),this.startPosition=r):t.live?r=this.hls.liveSyncPosition||e:this.startPosition=r=0,this.lastCurrentTime=r}this.nextLoadPosition=r}getLoadPosition(){const{media:t}=this;let e=0;return this.loadedmetadata&&t?e=t.currentTime:this.nextLoadPosition&&(e=this.nextLoadPosition),e}handleFragLoadAborted(t,e){this.transmuxer&&"initSegment"!==t.sn&&t.stats.aborted&&(this.warn(`Fragment ${t.sn}${e?" part "+e.index:""} of level ${t.level} was aborted`),this.resetFragmentLoading(t))}resetFragmentLoading(t){this.fragCurrent&&(this.fragContextChanged(t)||this.state===xn)||(this.state=Cn)}onFragmentOrKeyLoadError(t,e){if(e.chunkMeta&&!e.frag){const t=this.getCurrentContext(e.chunkMeta);t&&(e.frag=t.frag)}const r=e.frag;if(!r||r.type!==t||!this.levels)return;var n;if(this.fragContextChanged(r))return void this.warn(`Frag load error must match current frag to retry ${r.url} > ${null==(n=this.fragCurrent)?void 0:n.url}`);const i=e.details===P.FRAG_GAP;i&&this.fragmentTracker.fragBuffered(r,!0);const s=e.errorAction,{action:a,retryCount:o=0,retryConfig:l}=s||{};if(s&&a===Nr&&l){this.resetStartWhenNotLoaded(this.levelLastLoaded);const n=Rr(l,o);this.warn(`Fragment ${r.sn} of ${t} ${r.level} errored with ${e.details}, retrying loading ${o+1}/${l.maxNumRetry} in ${n}ms`),s.resolved=!0,this.retryDate=self.performance.now()+n,this.state=xn}else if(l&&s){if(this.resetFragmentErrors(t),!(o<l.maxNumRetry))return void N.warn(`${e.details} reached or exceeded max retry (${o})`);i||a===Br||(s.resolved=!0)}else(null==s?void 0:s.action)===Fr?this.state=Un:this.state=Bn;this.tickImmediate()}reduceLengthAndFlushBuffer(t){if(this.state===On||this.state===Mn){const e=t.frag,r=t.parent,n=this.getFwdBufferInfo(this.mediaBuffer,r),i=n&&n.len>.5;i&&this.reduceMaxBufferLength(n.len,(null==e?void 0:e.duration)||10);const s=!i;return s&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${r} buffer`),e&&(this.fragmentTracker.removeFragment(e),this.nextLoadPosition=e.start),this.resetLoadingState(),s}return!1}resetFragmentErrors(t){t===He&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Rn&&(this.state=Cn)}afterBufferFlushed(t,e,r){if(!t)return;const n=hn.getBuffered(t);this.fragmentTracker.detectEvictedFragments(e,n,r),this.state===Fn&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Cn}resetStartWhenNotLoaded(t){if(!this.loadedmetadata){this.startFragRequested=!1;const e=t?t.details:null;null!=e&&e.live?(this.startPosition=-1,this.setStartPosition(e,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(t){this.warn(`The loading context changed while buffering fragment ${t.sn} of level ${t.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(t=0){this.fragmentTracker.removeFragmentsInRange(t,1/0,this.playlistType,!1,!0)}updateLevelTiming(t,e,r,n){var i;const s=r.details;if(!s)return void this.warn("level.details undefined");if(!Object.keys(t.elementaryStreams).reduce(((e,i)=>{const a=t.elementaryStreams[i];if(a){const o=a.endPTS-a.startPTS;if(o<=0)return this.warn(`Could not parse fragment ${t.sn} ${i} duration reliably (${o})`),e||!1;const l=n?0:Er(s,t,a.startPTS,a.endPTS,a.startDTS,a.endDTS);return this.hls.trigger(I.LEVEL_PTS_UPDATED,{details:s,level:r,drift:l,type:i,frag:t,start:a.startPTS,end:a.endPTS}),!0}return e}),!1)&&null===(null==(i=this.transmuxer)?void 0:i.error)){const e=new Error(`Found no media in fragment ${t.sn} of level ${t.level} resetting transmuxer to fallback to playlist timing`);if(0===r.fragmentError&&(r.fragmentError++,t.gap=!0,this.fragmentTracker.removeFragment(t),this.fragmentTracker.fragBuffered(t,!0)),this.warn(e.message),this.hls.trigger(I.ERROR,{type:x.MEDIA_ERROR,details:P.FRAG_PARSING_ERROR,fatal:!1,error:e,frag:t,reason:`Found no media in msn ${t.sn} of level "${r.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=Mn,this.hls.trigger(I.FRAG_PARSED,{frag:t,part:e})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(t){"demuxerWorker"===t.event&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(t){const e=this._state;e!==t&&(this._state=t,this.log(`${e}->${t}`))}get state(){return this._state}}class jn{constructor(){this.chunks=[],this.dataLength=0}push(t){this.chunks.push(t),this.dataLength+=t.length}flush(){const{chunks:t,dataLength:e}=this;let r;return t.length?(r=1===t.length?t[0]:function(t,e){const r=new Uint8Array(e);let n=0;for(let e=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r}(t,e),this.reset(),r):new Uint8Array(0)}reset(){this.chunks.length=0,this.dataLength=0}}function Gn(t="",e=9e4){return{type:t,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Kn{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(t,e,r,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(t){this.initPTS=t,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(t,e){return!1}appendFrame(t,e,r){}demux(t,e){this.cachedData&&(t=te(this.cachedData,t),this.cachedData=null);let r,n=bt(t,0),i=n?n.length:0;const s=this._audioTrack,a=this._id3Track,o=n?At(n):void 0,l=t.length;for((null===this.basePTS||0===this.frameIndex&&R(o))&&(this.basePTS=Hn(o,e,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),n&&n.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:tr,duration:Number.POSITIVE_INFINITY});i<l;){if(this.canParse(t,i)){const e=this.appendFrame(s,t,i);e?(this.frameIndex++,this.lastPTS=e.sample.pts,i+=e.length,r=i):i=l}else St(t,i)?(n=bt(t,i),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:tr,duration:Number.POSITIVE_INFINITY}),i+=n.length,r=i):i++;if(i===l&&r!==l){const e=yt(t,r);this.cachedData?this.cachedData=te(this.cachedData,e):this.cachedData=e}}return{audioTrack:s,videoTrack:Gn(),id3Track:a,textTrack:Gn()}}demuxSampleAes(t,e,r){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(t){const e=this.cachedData;return e&&(this.cachedData=null,this.demux(e,0)),{audioTrack:this._audioTrack,videoTrack:Gn(),id3Track:this._id3Track,textTrack:Gn()}}destroy(){}}const Hn=(t,e,r)=>{if(R(t))return 90*t;return 9e4*e+(r?9e4*r.baseTime/r.timescale:0)};function Vn(t,e){return 255===t[e]&&240==(246&t[e+1])}function Wn(t,e){return 1&t[e+1]?7:9}function Yn(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function qn(t,e){return e+1<t.length&&Vn(t,e)}function zn(t,e){if(qn(t,e)){const r=Wn(t,e);if(e+r>=t.length)return!1;const n=Yn(t,e);if(n<=r)return!1;const i=e+n;return i===t.length||qn(t,i)}return!1}function Xn(t,e,r,n,i){if(!t.samplerate){const s=function(t,e,r,n){let i,s,a,o;const l=navigator.userAgent.toLowerCase(),c=n,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];i=1+((192&e[r+2])>>>6);const h=(60&e[r+2])>>>2;if(!(h>u.length-1))return a=(1&e[r+2])<<2,a|=(192&e[r+3])>>>6,N.log(`manifest codec:${n}, ADTS type:${i}, samplingIndex:${h}`),/firefox/i.test(l)?h>=6?(i=5,o=new Array(4),s=h-3):(i=2,o=new Array(2),s=h):-1!==l.indexOf("android")?(i=2,o=new Array(2),s=h):(i=5,o=new Array(4),n&&(-1!==n.indexOf("mp4a.40.29")||-1!==n.indexOf("mp4a.40.5"))||!n&&h>=6?s=h-3:((n&&-1!==n.indexOf("mp4a.40.2")&&(h>=6&&1===a||/vivaldi/i.test(l))||!n&&1===a)&&(i=2,o=new Array(2)),s=h)),o[0]=i<<3,o[0]|=(14&h)>>1,o[1]|=(1&h)<<7,o[1]|=a<<3,5===i&&(o[1]|=(14&s)>>1,o[2]=(1&s)<<7,o[2]|=8,o[3]=0),{config:o,samplerate:u[h],channelCount:a,codec:"mp4a.40."+i,manifestCodec:c};{const e=new Error(`invalid ADTS sampling index:${h}`);t.emit(I.ERROR,I.ERROR,{type:x.MEDIA_ERROR,details:P.FRAG_PARSING_ERROR,fatal:!0,error:e,reason:e.message})}}(e,r,n,i);if(!s)return;t.config=s.config,t.samplerate=s.samplerate,t.channelCount=s.channelCount,t.codec=s.codec,t.manifestCodec=s.manifestCodec,N.log(`parsed codec:${t.codec}, rate:${s.samplerate}, channels:${s.channelCount}`)}}function Qn(t){return 9216e4/t}function Jn(t,e,r,n,i){const s=n+i*Qn(t.samplerate),a=function(t,e){const r=Wn(t,e);if(e+r<=t.length){const n=Yn(t,e)-r;if(n>0)return{headerLength:r,frameLength:n}}}(e,r);let o;if(a){const{frameLength:n,headerLength:i}=a,l=i+n,c=Math.max(0,r+l-e.length);c?(o=new Uint8Array(l-i),o.set(e.subarray(r+i,e.length),0)):o=e.subarray(r+i,r+l);const u={unit:o,pts:s};return c||t.samples.push(u),{sample:u,length:l,missing:c}}const l=e.length-r;o=new Uint8Array(l),o.set(e.subarray(r,e.length),0);return{sample:{unit:o,pts:s},length:l,missing:-1}}let Zn=null;const ti=[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],ei=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],ri=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],ni=[0,1,1,4];function ii(t,e,r,n,i){if(r+24>e.length)return;const s=si(e,r);if(s&&r+s.frameLength<=e.length){const a=n+i*(9e4*s.samplesPerFrame/s.sampleRate),o={unit:e.subarray(r,r+s.frameLength),pts:a,dts:a};return t.config=[],t.channelCount=s.channelCount,t.samplerate=s.sampleRate,t.samples.push(o),{sample:o,length:s.frameLength,missing:0}}}function si(t,e){const r=t[e+1]>>3&3,n=t[e+1]>>1&3,i=t[e+2]>>4&15,s=t[e+2]>>2&3;if(1!==r&&0!==i&&15!==i&&3!==s){const a=t[e+2]>>1&1,o=t[e+3]>>6,l=1e3*ti[14*(3===r?3-n:3===n?3:4)+i-1],c=ei[3*(3===r?0:2===r?1:2)+s],u=3===o?1:2,h=ri[r][n],d=ni[n],f=8*h*d,p=Math.floor(h*l/c+a)*d;if(null===Zn){const t=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Zn=t?parseInt(t[1]):0}return!!Zn&&Zn<=87&&2===n&&l>=224e3&&0===o&&(t[e+3]=128|t[e+3]),{sampleRate:c,channelCount:u,frameLength:p,samplesPerFrame:f}}}function ai(t,e){return!(255!==t[e]||224&~t[e+1]||!(6&t[e+1]))}function oi(t,e){return e+1<t.length&&ai(t,e)}function li(t,e){if(e+1<t.length&&ai(t,e)){const r=4,n=si(t,e);let i=r;null!=n&&n.frameLength&&(i=n.frameLength);const s=e+i;return s===t.length||oi(t,s)}return!1}const ci=/\/emsg[-/]ID3/i;const ui=(t,e)=>{let r=0,n=5;e+=n;const i=new Uint32Array(1),s=new Uint32Array(1),a=new Uint8Array(1);for(;n>0;){a[0]=t[e];const o=Math.min(n,8),l=8-o;s[0]=4278190080>>>24+l<<l,i[0]=(a[0]&s[0])>>l,r=r?r<<o|i[0]:i[0],e+=1,n-=o}return r};class hi extends Kn{constructor(t){super(),this.observer=void 0,this.observer=t}resetInitSegment(t,e,r,n){super.resetInitSegment(t,e,r,n),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:e,duration:n,inputTimeScale:9e4,dropped:0}}canParse(t,e){return e+64<t.length}appendFrame(t,e,r){const n=di(t,e,r,this.basePTS,this.frameIndex);if(-1!==n){return{sample:t.samples[t.samples.length-1],length:n,missing:0}}}static probe(t){if(!t)return!1;const e=bt(t,0);if(!e)return!1;const r=e.length;return 11===t[r]&&119===t[r+1]&&void 0!==At(e)&&ui(t,r)<16}}function di(t,e,r,n,i){if(r+8>e.length)return-1;if(11!==e[r]||119!==e[r+1])return-1;const s=e[r+4]>>6;if(s>=3)return-1;const a=[48e3,44100,32e3][s],o=63&e[r+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(r+l>e.length)return-1;const c=e[r+6]>>5;let u=0;2===c?u+=2:(1&c&&1!==c&&(u+=2),4&c&&(u+=2));const h=(e[r+6]<<8|e[r+7])>>12-u&1,d=[2,1,2,3,3,4,4,5][c]+h,f=e[r+5]>>3,p=7&e[r+5],g=new Uint8Array([s<<6|f<<1|p>>2,(3&p)<<6|c<<3|h<<2|o>>4,o<<4&224]),m=n+i*(1536/a*9e4),y=e.subarray(r,r+l);return t.config=g,t.channelCount=d,t.samplerate=a,t.samples.push({unit:y,pts:m}),l}class fi{constructor(){this.VideoSample=null}createVideoSample(t,e,r,n){return{key:t,frame:!1,pts:e,dts:r,units:[],debug:n,length:0}}getLastNalUnit(t){var e;let r,n=this.VideoSample;if(n&&0!==n.units.length||(n=t[t.length-1]),null!=(e=n)&&e.units){const t=n.units;r=t[t.length-1]}return r}pushAccessUnit(t,e){if(t.units.length&&t.frame){if(void 0===t.pts){const r=e.samples,n=r.length;if(!n)return void e.dropped++;{const e=r[n-1];t.pts=e.pts,t.dts=e.dts}}e.samples.push(t)}t.debug.length&&N.log(t.pts+"/"+t.dts+":"+t.debug)}}class pi{constructor(t){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const t=this.data,e=this.bytesAvailable,r=t.byteLength-e,n=new Uint8Array(4),i=Math.min(4,e);if(0===i)throw new Error("no bytes available");n.set(t.subarray(r,r+i)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=8*i,this.bytesAvailable-=i}skipBits(t){let e;t=Math.min(t,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(e=(t-=this.bitsAvailable)>>3,t-=e<<3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)}readBits(t){let e=Math.min(this.bitsAvailable,t);const r=this.word>>>32-e;if(t>32&&N.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0)this.word<<=e;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return e=t-e,e>0&&this.bitsAvailable?r<<e|this.readBits(e):r}skipLZ(){let t;for(t=0;t<this.bitsAvailable;++t)if(this.word&2147483648>>>t)return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const t=this.skipLZ();return this.readBits(t+1)-1}readEG(){const t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(t){let e,r=8,n=8;for(let i=0;i<t;i++)0!==n&&(e=this.readEG(),n=(r+e+256)%256),r=0===n?r:n}readSPS(){let t,e,r,n=0,i=0,s=0,a=0;const o=this.readUByte.bind(this),l=this.readBits.bind(this),c=this.readUEG.bind(this),u=this.readBoolean.bind(this),h=this.skipBits.bind(this),d=this.skipEG.bind(this),f=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);o();const g=o();if(l(5),h(3),o(),f(),100===g||110===g||122===g||244===g||44===g||83===g||86===g||118===g||128===g){const t=c();if(3===t&&h(1),f(),f(),h(1),u())for(e=3!==t?8:12,r=0;r<e;r++)u()&&p(r<6?16:64)}f();const m=c();if(0===m)c();else if(1===m)for(h(1),d(),d(),t=c(),r=0;r<t;r++)d();f(),h(1);const y=c(),v=c(),E=l(1);0===E&&h(1),h(1),u()&&(n=c(),i=c(),s=c(),a=c());let b=[1,1];if(u()&&u()){switch(o()){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:b=[o()<<8|o(),o()<<8|o()]}}return{width:Math.ceil(16*(y+1)-2*n-2*i),height:(2-E)*(v+1)*16-(E?2:4)*(s+a),pixelRatio:b}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class gi extends fi{parseAVCPES(t,e,r,n,i){const s=this.parseAVCNALu(t,r.data);let a,o=this.VideoSample,l=!1;r.data=null,o&&s.length&&!t.audFound&&(this.pushAccessUnit(o,t),o=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts,"")),s.forEach((n=>{var s;switch(n.type){case 1:{let e=!1;a=!0;const i=n.data;if(l&&i.length>4){const t=new pi(i).readSliceType();2!==t&&4!==t&&7!==t&&9!==t||(e=!0)}var c;if(e)null!=(c=o)&&c.frame&&!o.key&&(this.pushAccessUnit(o,t),o=this.VideoSample=null);o||(o=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts,"")),o.frame=!0,o.key=e;break}case 5:a=!0,null!=(s=o)&&s.frame&&!o.key&&(this.pushAccessUnit(o,t),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts,"")),o.key=!0,o.frame=!0;break;case 6:a=!0,ne(n.data,1,r.pts,e.samples);break;case 7:{var u,h;a=!0,l=!0;const e=n.data,r=new pi(e).readSPS();if(!t.sps||t.width!==r.width||t.height!==r.height||(null==(u=t.pixelRatio)?void 0:u[0])!==r.pixelRatio[0]||(null==(h=t.pixelRatio)?void 0:h[1])!==r.pixelRatio[1]){t.width=r.width,t.height=r.height,t.pixelRatio=r.pixelRatio,t.sps=[e],t.duration=i;const n=e.subarray(1,4);let s="avc1.";for(let t=0;t<3;t++){let e=n[t].toString(16);e.length<2&&(e="0"+e),s+=e}t.codec=s}break}case 8:a=!0,t.pps=[n.data];break;case 9:a=!0,t.audFound=!0,o&&this.pushAccessUnit(o,t),o=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts,"");break;case 12:a=!0;break;default:a=!1,o&&(o.debug+="unknown NAL "+n.type+" ")}if(o&&a){o.units.push(n)}})),n&&o&&(this.pushAccessUnit(o,t),this.VideoSample=null)}parseAVCNALu(t,e){const r=e.byteLength;let n=t.naluState||0;const i=n,s=[];let a,o,l,c=0,u=-1,h=0;for(-1===n&&(u=0,h=31&e[0],n=0,c=1);c<r;)if(a=e[c++],n)if(1!==n)if(a)if(1===a){if(o=c-n-1,u>=0){const t={data:e.subarray(u,o),type:h};s.push(t)}else{const r=this.getLastNalUnit(t.samples);r&&(i&&c<=4-i&&r.state&&(r.data=r.data.subarray(0,r.data.byteLength-i)),o>0&&(r.data=te(r.data,e.subarray(0,o)),r.state=0))}c<r?(l=31&e[c],u=c,h=l,n=0):n=-1}else n=0;else n=3;else n=a?0:2;else n=a?0:1;if(u>=0&&n>=0){const t={data:e.subarray(u,r),type:h,state:n};s.push(t)}if(0===s.length){const r=this.getLastNalUnit(t.samples);r&&(r.data=te(r.data,e))}return t.naluState=n,s}}class mi{constructor(t,e,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new Ln(e,{removePKCS7Padding:!1})}decryptBuffer(t){return this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(t,e,r){const n=t[e].unit;if(n.length<=16)return;const i=n.subarray(16,n.length-n.length%16),s=i.buffer.slice(i.byteOffset,i.byteOffset+i.length);this.decryptBuffer(s).then((i=>{const s=new Uint8Array(i);n.set(s,16),this.decrypter.isSync()||this.decryptAacSamples(t,e+1,r)}))}decryptAacSamples(t,e,r){for(;;e++){if(e>=t.length)return void r();if(!(t[e].unit.length<32)&&(this.decryptAacSample(t,e,r),!this.decrypter.isSync()))return}}getAvcEncryptedData(t){const e=16*Math.floor((t.length-48)/160)+16,r=new Int8Array(e);let n=0;for(let e=32;e<t.length-16;e+=160,n+=16)r.set(t.subarray(e,e+16),n);return r}getAvcDecryptedUnit(t,e){const r=new Uint8Array(e);let n=0;for(let e=32;e<t.length-16;e+=160,n+=16)t.set(r.subarray(n,n+16),e);return t}decryptAvcSample(t,e,r,n,i){const s=ie(i.data),a=this.getAvcEncryptedData(s);this.decryptBuffer(a.buffer).then((a=>{i.data=this.getAvcDecryptedUnit(s,a),this.decrypter.isSync()||this.decryptAvcSamples(t,e,r+1,n)}))}decryptAvcSamples(t,e,r,n){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;e++,r=0){if(e>=t.length)return void n();const i=t[e].units;for(;!(r>=i.length);r++){const s=i[r];if(!(s.data.length<=48||1!==s.type&&5!==s.type||(this.decryptAvcSample(t,e,r,n,s),this.decrypter.isSync())))return}}}}const yi=188;class vi{constructor(t,e,r){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=t,this.config=e,this.typeSupported=r,this.videoParser=new gi}static probe(t){const e=vi.syncOffset(t);return e>0&&N.warn(`MPEG2-TS detected but first sync word found @ offset ${e}`),-1!==e}static syncOffset(t){const e=t.length;let r=Math.min(940,e-yi)+1,n=0;for(;n<r;){let i=!1,s=-1,a=0;for(let o=n;o<e;o+=yi){if(71!==t[o]||e-o!==yi&&71!==t[o+yi]){if(a)return-1;break}if(a++,-1===s&&(s=o,0!==s&&(r=Math.min(s+18612,t.length-yi)+1)),i||(i=0===Ei(t,o)),i&&a>1&&(0===s&&a>2||o+yi>r))return s}n++}return-1}static createTrack(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:Nt[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===t?e:void 0}}resetInitSegment(t,e,r,n){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=vi.createTrack("video"),this._audioTrack=vi.createTrack("audio",n),this._id3Track=vi.createTrack("id3"),this._txtTrack=vi.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=e,this.videoCodec=r,this._duration=n}resetTimeStamp(){}resetContiguity(){const{_audioTrack:t,_videoTrack:e,_id3Track:r}=this;t&&(t.pesData=null),e&&(e.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(t,e,r=!1,n=!1){let i;r||(this.sampleAes=null);const s=this._videoTrack,a=this._audioTrack,o=this._id3Track,l=this._txtTrack;let c=s.pid,u=s.pesData,h=a.pid,d=o.pid,f=a.pesData,p=o.pesData,g=null,m=this.pmtParsed,y=this._pmtId,v=t.length;if(this.remainderData&&(v=(t=te(this.remainderData,t)).length,this.remainderData=null),v<yi&&!n)return this.remainderData=t,{audioTrack:a,videoTrack:s,id3Track:o,textTrack:l};const E=Math.max(0,vi.syncOffset(t));v-=(v-E)%yi,v<t.byteLength&&!n&&(this.remainderData=new Uint8Array(t.buffer,v,t.buffer.byteLength-v));let b=0;for(let e=E;e<v;e+=yi)if(71===t[e]){const n=!!(64&t[e+1]),v=Ei(t,e);let b;if((48&t[e+3])>>4>1){if(b=e+5+t[e+4],b===e+yi)continue}else b=e+4;switch(v){case c:n&&(u&&(i=_i(u))&&this.videoParser.parseAVCPES(s,l,i,!1,this._duration),u={data:[],size:0}),u&&(u.data.push(t.subarray(b,e+yi)),u.size+=e+yi-b);break;case h:if(n){if(f&&(i=_i(f)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,i);break;case"mp3":this.parseMPEGPES(a,i);break;case"ac3":this.parseAC3PES(a,i)}f={data:[],size:0}}f&&(f.data.push(t.subarray(b,e+yi)),f.size+=e+yi-b);break;case d:n&&(p&&(i=_i(p))&&this.parseID3PES(o,i),p={data:[],size:0}),p&&(p.data.push(t.subarray(b,e+yi)),p.size+=e+yi-b);break;case 0:n&&(b+=t[b]+1),y=this._pmtId=bi(t,b);break;case y:{n&&(b+=t[b]+1);const i=Ti(t,b,this.typeSupported,r,this.observer);c=i.videoPid,c>0&&(s.pid=c,s.segmentCodec=i.segmentVideoCodec),h=i.audioPid,h>0&&(a.pid=h,a.segmentCodec=i.segmentAudioCodec),d=i.id3Pid,d>0&&(o.pid=d),null===g||m||(N.warn(`MPEG-TS PMT found at ${e} after unknown PID '${g}'. Backtracking to sync byte @${E} to parse all TS packets.`),g=null,e=E-188),m=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=v}}else b++;b>0&&Si(this.observer,new Error(`Found ${b} TS packet/s that do not start with 0x47`)),s.pesData=u,a.pesData=f,o.pesData=p;const T={audioTrack:a,videoTrack:s,id3Track:o,textTrack:l};return n&&this.extractRemainingSamples(T),T}flush(){const{remainderData:t}=this;let e;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(t){const{audioTrack:e,videoTrack:r,id3Track:n,textTrack:i}=t,s=r.pesData,a=e.pesData,o=n.pesData;let l;if(s&&(l=_i(s))?(this.videoParser.parseAVCPES(r,i,l,!0,this._duration),r.pesData=null):r.pesData=s,a&&(l=_i(a))){switch(e.segmentCodec){case"aac":this.parseAACPES(e,l);break;case"mp3":this.parseMPEGPES(e,l);break;case"ac3":this.parseAC3PES(e,l)}e.pesData=null}else null!=a&&a.size&&N.log("last AAC PES packet truncated,might overlap between fragments"),e.pesData=a;o&&(l=_i(o))?(this.parseID3PES(n,l),n.pesData=null):n.pesData=o}demuxSampleAes(t,e,r){const n=this.demux(t,r,!0,!this.config.progressive),i=this.sampleAes=new mi(this.observer,this.config,e);return this.decrypt(n,i)}decrypt(t,e){return new Promise((r=>{const{audioTrack:n,videoTrack:i}=t;n.samples&&"aac"===n.segmentCodec?e.decryptAacSamples(n.samples,0,(()=>{i.samples?e.decryptAvcSamples(i.samples,0,0,(()=>{r(t)})):r(t)})):i.samples&&e.decryptAvcSamples(i.samples,0,0,(()=>{r(t)}))}))}destroy(){this._duration=0}parseAACPES(t,e){let r=0;const n=this.aacOverFlow;let i,s,a,o=e.data;if(n){this.aacOverFlow=null;const e=n.missing,i=n.sample.unit.byteLength;if(-1===e)o=te(n.sample.unit,o);else{const s=i-e;n.sample.unit.set(o.subarray(0,e),s),t.samples.push(n.sample),r=n.missing}}for(i=r,s=o.length;i<s-1&&!qn(o,i);i++);if(i!==r){let t;const e=i<s-1;if(t=e?`AAC PES did not start with ADTS header,offset:${i}`:"No ADTS header found in AAC PES",Si(this.observer,new Error(t),e),!e)return}if(Xn(t,this.observer,o,i,this.audioCodec),void 0!==e.pts)a=e.pts;else{if(!n)return void N.warn("[tsdemuxer]: AAC PES unknown PTS");{const e=Qn(t.samplerate);a=n.sample.pts+e}}let l,c=0;for(;i<s;){if(l=Jn(t,o,i,a,c),i+=l.length,l.missing){this.aacOverFlow=l;break}for(c++;i<s-1&&!qn(o,i);i++);}}parseMPEGPES(t,e){const r=e.data,n=r.length;let i=0,s=0;const a=e.pts;if(void 0!==a)for(;s<n;)if(oi(r,s)){const e=ii(t,r,s,a,i);if(!e)break;s+=e.length,i++}else s++;else N.warn("[tsdemuxer]: MPEG PES unknown PTS")}parseAC3PES(t,e){{const r=e.data,n=e.pts;if(void 0===n)return void N.warn("[tsdemuxer]: AC3 PES unknown PTS");const i=r.length;let s,a=0,o=0;for(;o<i&&(s=di(t,r,o,n,a++))>0;)o+=s}}parseID3PES(t,e){if(void 0===e.pts)return void N.warn("[tsdemuxer]: ID3 PES unknown PTS");const r=w({},e,{type:this._videoTrack?rr:tr,duration:Number.POSITIVE_INFINITY});t.samples.push(r)}}function Ei(t,e){return((31&t[e+1])<<8)+t[e+2]}function bi(t,e){return(31&t[e+10])<<8|t[e+11]}function Ti(t,e,r,n,i){const s={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=e+3+((15&t[e+1])<<8|t[e+2])-4;for(e+=12+((15&t[e+10])<<8|t[e+11]);e<a;){const a=Ei(t,e),o=(15&t[e+3])<<8|t[e+4];switch(t[e]){case 207:if(!n){Ai("ADTS AAC");break}case 15:-1===s.audioPid&&(s.audioPid=a);break;case 21:-1===s.id3Pid&&(s.id3Pid=a);break;case 219:if(!n){Ai("H.264");break}case 27:-1===s.videoPid&&(s.videoPid=a,s.segmentVideoCodec="avc");break;case 3:case 4:r.mpeg||r.mp3?-1===s.audioPid&&(s.audioPid=a,s.segmentAudioCodec="mp3"):N.log("MPEG audio found, not supported in this browser");break;case 193:if(!n){Ai("AC-3");break}case 129:r.ac3?-1===s.audioPid&&(s.audioPid=a,s.segmentAudioCodec="ac3"):N.log("AC-3 audio found, not supported in this browser");break;case 6:if(-1===s.audioPid&&o>0){let n=e+5,i=o;for(;i>2;){if(106===t[n])!0!==r.ac3?N.log("AC-3 audio found, not supported in this browser for now"):(s.audioPid=a,s.segmentAudioCodec="ac3");const e=t[n+1]+2;n+=e,i-=e}}break;case 194:case 135:return Si(i,new Error("Unsupported EC-3 in M2TS found")),s;case 36:return Si(i,new Error("Unsupported HEVC in M2TS found")),s}e+=o+5}return s}function Si(t,e,r){N.warn(`parsing error: ${e.message}`),t.emit(I.ERROR,I.ERROR,{type:x.MEDIA_ERROR,details:P.FRAG_PARSING_ERROR,fatal:!1,levelRetry:r,error:e,reason:e.message})}function Ai(t){N.log(`${t} with AES-128-CBC encryption found in unencrypted stream`)}function _i(t){let e,r,n,i,s,a=0;const o=t.data;if(!t||0===t.size)return null;for(;o[0].length<19&&o.length>1;)o[0]=te(o[0],o[1]),o.splice(1,1);e=o[0];if(1===(e[0]<<16)+(e[1]<<8)+e[2]){if(r=(e[4]<<8)+e[5],r&&r>t.size-6)return null;const l=e[7];192&l&&(i=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&l?(s=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,i-s>54e5&&(N.warn(`${Math.round((i-s)/9e4)}s delta between PTS and DTS, align them`),i=s)):s=i),n=e[8];let c=n+9;if(t.size<=c)return null;t.size-=c;const u=new Uint8Array(t.size);for(let t=0,r=o.length;t<r;t++){e=o[t];let r=e.byteLength;if(c){if(c>r){c-=r;continue}e=e.subarray(c),r-=c,c=0}u.set(e,a),a+=r}return r&&(r-=n+3),{data:u,pts:i,dts:s,len:r}}return null}class ki{static getSilentFrame(t,e){if("mp4a.40.2"===t){if(1===e)return new Uint8Array([0,200,0,128,35,128]);if(2===e)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===e)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===e)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===e)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===e)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])}}}const Li=Math.pow(2,32)-1;class wi{static init(){let t;for(t in wi.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},wi.types)wi.types.hasOwnProperty(t)&&(wi.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);const e=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]),r=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]);wi.HDLR_TYPES={video:e,audio:r};const n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i=new Uint8Array([0,0,0,0,0,0,0,0]);wi.STTS=wi.STSC=wi.STCO=i,wi.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),wi.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),wi.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),wi.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const s=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),o=new Uint8Array([0,0,0,1]);wi.FTYP=wi.box(wi.types.ftyp,s,o,s,a),wi.DINF=wi.box(wi.types.dinf,wi.box(wi.types.dref,n))}static box(t,...e){let r=8,n=e.length;const i=n;for(;n--;)r+=e[n].byteLength;const 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(t,4),n=0,r=8;n<i;n++)s.set(e[n],r),r+=e[n].byteLength;return s}static hdlr(t){return wi.box(wi.types.hdlr,wi.HDLR_TYPES[t])}static mdat(t){return wi.box(wi.types.mdat,t)}static mdhd(t,e){e*=t;const r=Math.floor(e/(Li+1)),n=Math.floor(e%(Li+1));return wi.box(wi.types.mdhd,new Uint8Array([1,0,0,0,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,r>>24,r>>16&255,r>>8&255,255&r,n>>24,n>>16&255,n>>8&255,255&n,85,196,0,0]))}static mdia(t){return wi.box(wi.types.mdia,wi.mdhd(t.timescale,t.duration),wi.hdlr(t.type),wi.minf(t))}static mfhd(t){return wi.box(wi.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}static minf(t){return"audio"===t.type?wi.box(wi.types.minf,wi.box(wi.types.smhd,wi.SMHD),wi.DINF,wi.stbl(t)):wi.box(wi.types.minf,wi.box(wi.types.vmhd,wi.VMHD),wi.DINF,wi.stbl(t))}static moof(t,e,r){return wi.box(wi.types.moof,wi.mfhd(t),wi.traf(r,e))}static moov(t){let e=t.length;const r=[];for(;e--;)r[e]=wi.trak(t[e]);return wi.box.apply(null,[wi.types.moov,wi.mvhd(t[0].timescale,t[0].duration)].concat(r).concat(wi.mvex(t)))}static mvex(t){let e=t.length;const r=[];for(;e--;)r[e]=wi.trex(t[e]);return wi.box.apply(null,[wi.types.mvex,...r])}static mvhd(t,e){e*=t;const r=Math.floor(e/(Li+1)),n=Math.floor(e%(Li+1)),i=new Uint8Array([1,0,0,0,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,r>>24,r>>16&255,r>>8&255,255&r,n>>24,n>>16&255,n>>8&255,255&n,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 wi.box(wi.types.mvhd,i)}static sdtp(t){const e=t.samples||[],r=new Uint8Array(4+e.length);let n,i;for(n=0;n<e.length;n++)i=e[n].flags,r[n+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return wi.box(wi.types.sdtp,r)}static stbl(t){return wi.box(wi.types.stbl,wi.stsd(t),wi.box(wi.types.stts,wi.STTS),wi.box(wi.types.stsc,wi.STSC),wi.box(wi.types.stsz,wi.STSZ),wi.box(wi.types.stco,wi.STCO))}static avc1(t){let e,r,n,i=[],s=[];for(e=0;e<t.sps.length;e++)r=t.sps[e],n=r.byteLength,i.push(n>>>8&255),i.push(255&n),i=i.concat(Array.prototype.slice.call(r));for(e=0;e<t.pps.length;e++)r=t.pps[e],n=r.byteLength,s.push(n>>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(r));const a=wi.box(wi.types.avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|t.sps.length].concat(i).concat([t.pps.length]).concat(s))),o=t.width,l=t.height,c=t.pixelRatio[0],u=t.pixelRatio[1];return wi.box(wi.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]),a,wi.box(wi.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),wi.box(wi.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,u>>24,u>>16&255,u>>8&255,255&u])))}static esds(t){const e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))}static audioStsd(t){const e=t.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0])}static mp4a(t){return wi.box(wi.types.mp4a,wi.audioStsd(t),wi.box(wi.types.esds,wi.esds(t)))}static mp3(t){return wi.box(wi.types[".mp3"],wi.audioStsd(t))}static ac3(t){return wi.box(wi.types["ac-3"],wi.audioStsd(t),wi.box(wi.types.dac3,t.config))}static stsd(t){return"audio"===t.type?"mp3"===t.segmentCodec&&"mp3"===t.codec?wi.box(wi.types.stsd,wi.STSD,wi.mp3(t)):"ac3"===t.segmentCodec?wi.box(wi.types.stsd,wi.STSD,wi.ac3(t)):wi.box(wi.types.stsd,wi.STSD,wi.mp4a(t)):wi.box(wi.types.stsd,wi.STSD,wi.avc1(t))}static tkhd(t){const e=t.id,r=t.duration*t.timescale,n=t.width,i=t.height,s=Math.floor(r/(Li+1)),a=Math.floor(r%(Li+1));return wi.box(wi.types.tkhd,new Uint8Array([1,0,0,7,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,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,a>>24,a>>16&255,a>>8&255,255&a,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,n>>8&255,255&n,0,0,i>>8&255,255&i,0,0]))}static traf(t,e){const r=wi.sdtp(t),n=t.id,i=Math.floor(e/(Li+1)),s=Math.floor(e%(Li+1));return wi.box(wi.types.traf,wi.box(wi.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),wi.box(wi.types.tfdt,new Uint8Array([1,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s])),wi.trun(t,r.length+16+20+8+16+8+8),r)}static trak(t){return t.duration=t.duration||4294967295,wi.box(wi.types.trak,wi.tkhd(t),wi.mdia(t))}static trex(t){const e=t.id;return wi.box(wi.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(t,e){const r=t.samples||[],n=r.length,i=12+16*n,s=new Uint8Array(i);let a,o,l,c,u,h;for(e+=8+i,s.set(["video"===t.type?1:0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,e>>>24&255,e>>>16&255,e>>>8&255,255&e],0),a=0;a<n;a++)o=r[a],l=o.duration,c=o.size,u=o.flags,h=o.cts,s.set([l>>>24&255,l>>>16&255,l>>>8&255,255&l,c>>>24&255,c>>>16&255,c>>>8&255,255&c,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,61440&u.degradPrio,15&u.degradPrio,h>>>24&255,h>>>16&255,h>>>8&255,255&h],12+16*a);return wi.box(wi.types.trun,s)}static initSegment(t){wi.types||wi.init();const e=wi.moov(t);return te(wi.FTYP,e)}}wi.types=void 0,wi.HDLR_TYPES=void 0,wi.STTS=void 0,wi.STSC=void 0,wi.STCO=void 0,wi.STSZ=void 0,wi.VMHD=void 0,wi.SMHD=void 0,wi.STSD=void 0,wi.FTYP=void 0,wi.DINF=void 0;function Ri(t,e,r=1,n=!1){const i=t*e*r;return n?Math.round(i):i}function Ci(t,e=!1){return Ri(t,1e3,1/9e4,e)}let Di,Ii=null,xi=null;class Pi{constructor(t,e,r,n=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=t,this.config=e,this.typeSupported=r,this.ISGenerated=!1,null===Ii){const t=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ii=t?parseInt(t[1]):0}if(null===xi){const t=navigator.userAgent.match(/Safari\/(\d+)/i);xi=t?parseInt(t[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(t){N.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=t}resetNextTimestamp(){N.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){N.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(t){let e=!1;const r=t.reduce(((t,r)=>{const n=r.pts-t;return n<-4294967296?(e=!0,Oi(t,r.pts)):n>0?t:r.pts}),t[0].pts);return e&&N.debug("PTS rollover detected"),r}remux(t,e,r,n,i,s,a,o){let l,c,u,h,d,f,p=i,g=i;const m=t.pid>-1,y=e.pid>-1,v=e.samples.length,E=t.samples.length>0,b=a&&v>0||v>1;if((!m||E)&&(!y||b)||this.ISGenerated||a){if(this.ISGenerated){var T,S,A,_;const t=this.videoTrackConfig;!t||e.width===t.width&&e.height===t.height&&(null==(T=e.pixelRatio)?void 0:T[0])===(null==(S=t.pixelRatio)?void 0:S[0])&&(null==(A=e.pixelRatio)?void 0:A[1])===(null==(_=t.pixelRatio)?void 0:_[1])||this.resetInitSegment()}else u=this.generateIS(t,e,i,s);const r=this.isVideoContiguous;let n,a=-1;if(b&&(a=function(t){for(let e=0;e<t.length;e++)if(t[e].key)return e;return-1}(e.samples),!r&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,a>0){N.warn(`[mp4-remuxer]: Dropped ${a} out of ${v} video samples due to a missing keyframe`);const t=this.getVideoStartPts(e.samples);e.samples=e.samples.slice(a),e.dropped+=a,g+=(e.samples[0].pts-t)/e.inputTimeScale,n=g}else-1===a&&(N.warn(`[mp4-remuxer]: No keyframe found out of ${v} video samples`),f=!1);if(this.ISGenerated){if(E&&b){const r=this.getVideoStartPts(e.samples),n=(Oi(t.samples[0].pts,r)-r)/e.inputTimeScale;p+=Math.max(0,n),g+=Math.max(0,-n)}if(E){if(t.samplerate||(N.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),u=this.generateIS(t,e,i,s)),c=this.remuxAudio(t,p,this.isAudioContiguous,s,y||b||o===He?g:void 0),b){const n=c?c.endPTS-c.startPTS:0;e.inputTimeScale||(N.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),u=this.generateIS(t,e,i,s)),l=this.remuxVideo(e,g,r,n)}}else b&&(l=this.remuxVideo(e,g,r,0));l&&(l.firstKeyFrame=a,l.independent=-1!==a,l.firstKeyFramePTS=n)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(d=Mi(r,i,this._initPTS,this._initDTS)),n.samples.length&&(h=Fi(n,i,this._initPTS))),{audio:c,video:l,initSegment:u,independent:f,text:h,id3:d}}generateIS(t,e,r,n){const i=t.samples,s=e.samples,a=this.typeSupported,o={},l=this._initPTS;let c,u,h,d=!l||n,f="audio/mp4";if(d&&(c=u=1/0),t.config&&i.length){switch(t.timescale=t.samplerate,t.segmentCodec){case"mp3":a.mpeg?(f="audio/mpeg",t.codec=""):a.mp3&&(t.codec="mp3");break;case"ac3":t.codec="ac-3"}o.audio={id:"audio",container:f,codec:t.codec,initSegment:"mp3"===t.segmentCodec&&a.mpeg?new Uint8Array(0):wi.initSegment([t]),metadata:{channelCount:t.channelCount}},d&&(h=t.inputTimeScale,l&&h===l.timescale?d=!1:c=u=i[0].pts-Math.round(h*r))}if(e.sps&&e.pps&&s.length){if(e.timescale=e.inputTimeScale,o.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:wi.initSegment([e]),metadata:{width:e.width,height:e.height}},d)if(h=e.inputTimeScale,l&&h===l.timescale)d=!1;else{const t=this.getVideoStartPts(s),e=Math.round(h*r);u=Math.min(u,Oi(s[0].dts,t)-e),c=Math.min(c,t-e)}this.videoTrackConfig={width:e.width,height:e.height,pixelRatio:e.pixelRatio}}if(Object.keys(o).length)return this.ISGenerated=!0,d?(this._initPTS={baseTime:c,timescale:h},this._initDTS={baseTime:u,timescale:h}):c=h=void 0,{tracks:o,initPTS:c,timescale:h}}remuxVideo(t,e,r,n){const i=t.inputTimeScale,s=t.samples,a=[],o=s.length,l=this._initPTS;let c,u,h=this.nextAvcDts,d=8,f=this.videoSampleDuration,p=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,m=!1;if(!r||null===h){const t=e*i,n=s[0].pts-Oi(s[0].dts,s[0].pts);Ii&&null!==h&&Math.abs(t-n-h)<15e3?r=!0:h=t-n}const y=l.baseTime*i/l.timescale;for(let t=0;t<o;t++){const e=s[t];e.pts=Oi(e.pts-y,h),e.dts=Oi(e.dts-y,h),e.dts<s[t>0?t-1:t].dts&&(m=!0)}m&&s.sort((function(t,e){const r=t.dts-e.dts,n=t.pts-e.pts;return r||n})),c=s[0].dts,u=s[s.length-1].dts;const v=u-c,E=v?Math.round(v/(o-1)):f||t.inputTimeScale/30;if(r){const t=c-h,r=t>E,n=t<-1;if((r||n)&&(r?N.warn(`AVC: ${Ci(t,!0)} ms (${t}dts) hole between fragments detected at ${e.toFixed(3)}`):N.warn(`AVC: ${Ci(-t,!0)} ms (${t}dts) overlapping between fragments detected at ${e.toFixed(3)}`),!n||h>=s[0].pts||Ii)){c=h;const e=s[0].pts-t;if(r)s[0].dts=c,s[0].pts=e;else for(let r=0;r<s.length&&!(s[r].dts>e);r++)s[r].dts-=t,s[r].pts-=t;N.log(`Video: Initial PTS/DTS adjusted: ${Ci(e,!0)}/${Ci(c,!0)}, delta: ${Ci(t,!0)} ms`)}}c=Math.max(0,c);let b=0,T=0,S=c;for(let t=0;t<o;t++){const e=s[t],r=e.units,n=r.length;let i=0;for(let t=0;t<n;t++)i+=r[t].data.length;T+=i,b+=n,e.length=i,e.dts<S?(e.dts=S,S+=E/4|0||1):S=e.dts,p=Math.min(e.pts,p),g=Math.max(e.pts,g)}u=s[o-1].dts;const A=T+4*b+8;let _;try{_=new Uint8Array(A)}catch(t){return void this.observer.emit(I.ERROR,I.ERROR,{type:x.MUX_ERROR,details:P.REMUX_ALLOC_ERROR,fatal:!1,error:t,bytes:A,reason:`fail allocating video mdat ${A}`})}const k=new DataView(_.buffer);k.setUint32(0,A),_.set(wi.types.mdat,4);let L=!1,R=Number.POSITIVE_INFINITY,C=Number.POSITIVE_INFINITY,D=Number.NEGATIVE_INFINITY,O=Number.NEGATIVE_INFINITY;for(let t=0;t<o;t++){const e=s[t],r=e.units;let l,c=0;for(let t=0,e=r.length;t<e;t++){const e=r[t],n=e.data,i=e.data.byteLength;k.setUint32(d,i),d+=4,_.set(n,d),d+=i,c+=4+i}if(t<o-1)f=s[t+1].dts-e.dts,l=s[t+1].pts-e.pts;else{const r=this.config,a=t>0?e.dts-s[t-1].dts:E;if(l=t>0?e.pts-s[t-1].pts:E,r.stretchShortVideoTrack&&null!==this.nextAudioPts){const t=Math.floor(r.maxBufferHole*i),s=(n?p+n*i:this.nextAudioPts)-e.pts;s>t?(f=s-a,f<0?f=a:L=!0,N.log(`[mp4-remuxer]: It is approximately ${s/90} ms to the next segment; using duration ${f/90} ms for the last video frame.`)):f=a}else f=a}const u=Math.round(e.pts-e.dts);R=Math.min(R,f),D=Math.max(D,f),C=Math.min(C,l),O=Math.max(O,l),a.push(new Bi(e.key,f,c,u))}if(a.length)if(Ii){if(Ii<70){const t=a[0].flags;t.dependsOn=2,t.isNonSync=0}}else if(xi&&O-C<D-R&&E/D<.025&&0===a[0].cts){N.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let t=c;for(let e=0,r=a.length;e<r;e++){const n=t+a[e].duration,i=t+a[e].cts;if(e<r-1){const t=n+a[e+1].cts;a[e].duration=t-i}else a[e].duration=e?a[e-1].duration:E;a[e].cts=0,t=n}}f=L||!f?E:f,this.nextAvcDts=h=u+f,this.videoSampleDuration=f,this.isVideoContiguous=!0;const M={data1:wi.moof(t.sequenceNumber++,c,w({},t,{samples:a})),data2:_,startPTS:p/i,endPTS:(g+f)/i,startDTS:c/i,endDTS:h/i,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:t.dropped};return t.samples=[],t.dropped=0,M}getSamplesPerFrame(t){switch(t.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}}remuxAudio(t,e,r,n,i){const s=t.inputTimeScale,a=s/(t.samplerate?t.samplerate:s),o=this.getSamplesPerFrame(t),l=o*a,c=this._initPTS,u="mp3"===t.segmentCodec&&this.typeSupported.mpeg,h=[],d=void 0!==i;let f=t.samples,p=u?0:8,g=this.nextAudioPts||-1;const m=e*s,y=c.baseTime*s/c.timescale;if(this.isAudioContiguous=r=r||f.length&&g>0&&(n&&Math.abs(m-g)<9e3||Math.abs(Oi(f[0].pts-y,m)-g)<20*l),f.forEach((function(t){t.pts=Oi(t.pts-y,m)})),!r||g<0){if(f=f.filter((t=>t.pts>=0)),!f.length)return;g=0===i?0:n&&!d?Math.max(0,m):f[0].pts}if("aac"===t.segmentCodec){const e=this.config.maxAudioFramesDrift;for(let r=0,n=g;r<f.length;r++){const i=f[r],a=i.pts,o=a-n,c=Math.abs(1e3*o/s);if(o<=-e*l&&d)0===r&&(N.warn(`Audio frame @ ${(a/s).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*o/s)} ms.`),this.nextAudioPts=g=n=a);else if(o>=e*l&&c<1e4&&d){let e=Math.round(o/l);n=a-e*l,n<0&&(e--,n+=l),0===r&&(this.nextAudioPts=g=n),N.warn(`[mp4-remuxer]: Injecting ${e} audio frame @ ${(n/s).toFixed(3)}s due to ${Math.round(1e3*o/s)} ms gap.`);for(let s=0;s<e;s++){const e=Math.max(n,0);let s=ki.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);s||(N.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),s=i.unit.subarray()),f.splice(r,0,{unit:s,pts:e}),n+=l,r++}}i.pts=n,n+=l}}let v,E=null,b=null,T=0,S=f.length;for(;S--;)T+=f[S].unit.byteLength;for(let e=0,n=f.length;e<n;e++){const n=f[e],i=n.unit;let s=n.pts;if(null!==b){h[e-1].duration=Math.round((s-b)/a)}else{if(r&&"aac"===t.segmentCodec&&(s=g),E=s,!(T>0))return;T+=p;try{v=new Uint8Array(T)}catch(t){return void this.observer.emit(I.ERROR,I.ERROR,{type:x.MUX_ERROR,details:P.REMUX_ALLOC_ERROR,fatal:!1,error:t,bytes:T,reason:`fail allocating audio mdat ${T}`})}if(!u){new DataView(v.buffer).setUint32(0,T),v.set(wi.types.mdat,4)}}v.set(i,p);const l=i.byteLength;p+=l,h.push(new Bi(!0,o,l,0)),b=s}const A=h.length;if(!A)return;const _=h[h.length-1];this.nextAudioPts=g=b+a*_.duration;const k=u?new Uint8Array(0):wi.moof(t.sequenceNumber++,E/a,w({},t,{samples:h}));t.samples=[];const L=E/s,R=g/s,C={data1:k,data2:v,startPTS:L,endPTS:R,startDTS:L,endDTS:R,type:"audio",hasAudio:!0,hasVideo:!1,nb:A};return this.isAudioContiguous=!0,C}remuxEmptyAudio(t,e,r,n){const i=t.inputTimeScale,s=i/(t.samplerate?t.samplerate:i),a=this.nextAudioPts,o=this._initDTS,l=9e4*o.baseTime/o.timescale,c=(null!==a?a:n.startDTS*i)+l,u=n.endDTS*i+l,h=1024*s,d=Math.ceil((u-c)/h),f=ki.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(N.warn("[mp4-remuxer]: remux empty Audio"),!f)return void N.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");const p=[];for(let t=0;t<d;t++){const e=c+t*h;p.push({unit:f,pts:e,dts:e})}return t.samples=p,this.remuxAudio(t,e,r,!1)}}function Oi(t,e){let r;if(null===e)return t;for(r=e<t?-8589934592:8589934592;Math.abs(t-e)>4294967296;)t+=r;return t}function Mi(t,e,r,n){const i=t.samples.length;if(!i)return;const s=t.inputTimeScale;for(let a=0;a<i;a++){const i=t.samples[a];i.pts=Oi(i.pts-r.baseTime*s/r.timescale,e*s)/s,i.dts=Oi(i.dts-n.baseTime*s/n.timescale,e*s)/s}const a=t.samples;return t.samples=[],{samples:a}}function Fi(t,e,r){const n=t.samples.length;if(!n)return;const i=t.inputTimeScale;for(let s=0;s<n;s++){const n=t.samples[s];n.pts=Oi(n.pts-r.baseTime*i/r.timescale,e*i)/i}t.samples.sort(((t,e)=>t.pts-e.pts));const s=t.samples;return t.samples=[],{samples:s}}class Bi{constructor(t,e,r,n){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=e,this.size=r,this.cts=n,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:t?2:1,isNonSync:t?0:1}}}function Ni(t,e){const r=null==t?void 0:t.codec;if(r&&r.length>4)return r;if(e===V){if("ec-3"===r||"ac-3"===r||"alac"===r)return r;if("fLaC"===r||"Opus"===r){return _e(r,!1)}const t="mp4a.40.5";return N.info(`Parsed audio codec "${r}" or audio object type not handled. Using "${t}"`),t}return N.warn(`Unhandled video codec "${r}"`),"hvc1"===r||"hev1"===r?"hvc1.1.6.L120.90":"av01"===r?"av01.0.04M.08":"avc1.42e01e"}try{Di=self.performance.now.bind(self.performance)}catch(t){N.debug("Unable to use Performance API on this environment"),Di=null==et?void 0:et.Date.now}const Ui=[{demux:class{constructor(t,e){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=e}resetTimeStamp(){}resetInitSegment(t,e,r,n){const i=this.videoTrack=Gn("video",1),s=this.audioTrack=Gn("audio",1),a=this.txtTrack=Gn("text",1);if(this.id3Track=Gn("id3",1),this.timeOffset=0,null==t||!t.byteLength)return;const o=Yt(t);if(o.video){const{id:t,timescale:e,codec:r}=o.video;i.id=t,i.timescale=a.timescale=e,i.codec=r}if(o.audio){const{id:t,timescale:e,codec:r}=o.audio;s.id=t,s.timescale=e,s.codec=r}a.id=Nt.text,i.sampleDuration=0,i.duration=s.duration=n}resetContiguity(){this.remainderData=null}static probe(t){return function(t){const e=t.byteLength;for(let r=0;r<e;){const n=jt(t,r);if(n>8&&109===t[r+4]&&111===t[r+5]&&111===t[r+6]&&102===t[r+7])return!0;r=n>1?r+n:e}return!1}(t)}demux(t,e){this.timeOffset=e;let r=t;const n=this.videoTrack,i=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=te(this.remainderData,t));const e=function(t){const e={valid:null,remainder:null},r=Vt(t,["moof"]);if(r.length<2)return e.remainder=t,e;const n=r[r.length-1];return e.valid=yt(t,0,n.byteOffset-8),e.remainder=yt(t,n.byteOffset-8),e}(r);this.remainderData=e.remainder,n.samples=e.valid||new Uint8Array}else n.samples=r;const s=this.extractID3Track(n,e);return i.samples=ee(e,n),{videoTrack:n,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}}flush(){const t=this.timeOffset,e=this.videoTrack,r=this.txtTrack;e.samples=this.remainderData||new Uint8Array,this.remainderData=null;const n=this.extractID3Track(e,this.timeOffset);return r.samples=ee(t,e),{videoTrack:e,audioTrack:Gn(),id3Track:n,textTrack:Gn()}}extractID3Track(t,e){const r=this.id3Track;if(t.samples.length){const n=Vt(t.samples,["emsg"]);n&&n.forEach((t=>{const n=function(t){const e=t[0];let r="",n="",i=0,s=0,a=0,o=0,l=0,c=0;if(0===e){for(;"\0"!==Ut(t.subarray(c,c+1));)r+=Ut(t.subarray(c,c+1)),c+=1;for(r+=Ut(t.subarray(c,c+1)),c+=1;"\0"!==Ut(t.subarray(c,c+1));)n+=Ut(t.subarray(c,c+1)),c+=1;n+=Ut(t.subarray(c,c+1)),c+=1,i=jt(t,12),s=jt(t,16),o=jt(t,20),l=jt(t,24),c=28}else if(1===e){c+=4,i=jt(t,c),c+=4;const e=jt(t,c);c+=4;const s=jt(t,c);for(c+=4,a=2**32*e+s,C(a)||(a=Number.MAX_SAFE_INTEGER,N.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=jt(t,c),c+=4,l=jt(t,c),c+=4;"\0"!==Ut(t.subarray(c,c+1));)r+=Ut(t.subarray(c,c+1)),c+=1;for(r+=Ut(t.subarray(c,c+1)),c+=1;"\0"!==Ut(t.subarray(c,c+1));)n+=Ut(t.subarray(c,c+1)),c+=1;n+=Ut(t.subarray(c,c+1)),c+=1}return{schemeIdUri:r,value:n,timeScale:i,presentationTime:a,presentationTimeDelta:s,eventDuration:o,id:l,payload:t.subarray(c,t.byteLength)}}(t);if(ci.test(n.schemeIdUri)){const t=R(n.presentationTime)?n.presentationTime/n.timeScale:e+n.presentationTimeDelta/n.timeScale;let i=4294967295===n.eventDuration?Number.POSITIVE_INFINITY:n.eventDuration/n.timeScale;i<=.001&&(i=Number.POSITIVE_INFINITY);const s=n.payload;r.samples.push({data:s,len:s.byteLength,dts:t,pts:t,type:rr,duration:i})}}))}return r}demuxSampleAes(t,e,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}},remux:class{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(t){this.initPTS=t,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(t,e,r,n){this.audioCodec=e,this.videoCodec=r,this.generateInitSegment(function(t,e){if(!t||!e)return t;const r=e.keyId;r&&e.isCommonEncryption&&Vt(t,["moov","trak"]).forEach((t=>{const e=Vt(t,["mdia","minf","stbl","stsd"])[0].subarray(8);let n=Vt(e,["enca"]);const i=n.length>0;i||(n=Vt(e,["encv"])),n.forEach((t=>{Vt(i?t.subarray(28):t.subarray(78),["sinf"]).forEach((t=>{const e=Jt(t);if(e){const t=e.subarray(8,24);t.some((t=>0!==t))||(N.log(`[eme] Patching keyId in 'enc${i?"a":"v"}>sinf>>tenc' box: ${Mt(t)} -> ${Mt(r)}`),e.set(r,8))}}))}))}));return t}(t,n)),this.emitInitSegment=!0}generateInitSegment(t){let{audioCodec:e,videoCodec:r}=this;if(null==t||!t.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const n=this.initData=Yt(t);n.audio&&(e=Ni(n.audio,V)),n.video&&(r=Ni(n.video,W));const i={};n.audio&&n.video?i.audiovideo={container:"video/mp4",codec:e+","+r,initSegment:t,id:"main"}:n.audio?i.audio={container:"audio/mp4",codec:e,initSegment:t,id:"audio"}:n.video?i.video={container:"video/mp4",codec:r,initSegment:t,id:"main"}:N.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i}remux(t,e,r,n,i,s){var a,o;let{initPTS:l,lastEndTime:c}=this;const u={audio:void 0,video:void 0,text:n,id3:r,initSegment:void 0};R(c)||(c=this.lastEndTime=i||0);const h=e.samples;if(null==h||!h.length)return u;const d={initPTS:void 0,timescale:1};let f=this.initData;if(null!=(a=f)&&a.length||(this.generateInitSegment(h),f=this.initData),null==(o=f)||!o.length)return N.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),u;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const p=function(t,e){let r=0,n=0,i=0;const s=Vt(t,["moof","traf"]);for(let t=0;t<s.length;t++){const a=s[t],o=Vt(a,["tfhd"])[0],l=e[jt(o,4)];if(!l)continue;const c=l.default,u=jt(o,0)|(null==c?void 0:c.flags);let h=null==c?void 0:c.duration;8&u&&(h=jt(o,2&u?12:8));const d=l.timescale||9e4,f=Vt(a,["trun"]);for(let t=0;t<f.length;t++)r=Zt(f[t]),!r&&h&&(r=h*jt(f[t],4)),l.type===W?n+=r/d:l.type===V&&(i+=r/d)}if(0===n&&0===i){let e=1/0,r=0,n=0;const i=Vt(t,["sidx"]);for(let t=0;t<i.length;t++){const s=Wt(i[t]);if(null!=s&&s.references){e=Math.min(e,s.earliestPresentationTime/s.timescale);const t=s.references.reduce(((t,e)=>t+e.info.duration||0),0);r=Math.max(r,t+s.earliestPresentationTime/s.timescale),n=r-e}}if(n&&R(n))return n}return n||i}(h,f),g=function(t,e){return Vt(e,["moof","traf"]).reduce(((e,r)=>{const n=Vt(r,["tfdt"])[0],i=n[0],s=Vt(r,["tfhd"]).reduce(((e,r)=>{const s=jt(r,4),a=t[s];if(a){let t=jt(n,4);if(1===i){if(t===Ft)return N.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),e;t*=Ft+1,t+=jt(n,8)}const r=t/(a.timescale||9e4);if(R(r)&&(null===e||r<e))return r}return e}),null);return null!==s&&R(s)&&(null===e||s<e)?s:e}),null)}(f,h),m=null===g?i:g;(function(t,e,r,n){if(null===t)return!0;const i=Math.max(n,1),s=e-t.baseTime/t.timescale;return Math.abs(s-r)>i}(l,m,i,p)||d.timescale!==l.timescale&&s)&&(d.initPTS=m-i,l&&1===l.timescale&&N.warn("Adjusting initPTS by "+(d.initPTS-l.baseTime)),this.initPTS=l={baseTime:d.initPTS,timescale:1});const y=t?m-l.baseTime/l.timescale:c,v=y+p;!function(t,e,r){Vt(e,["moof","traf"]).forEach((e=>{Vt(e,["tfhd"]).forEach((n=>{const i=jt(n,4),s=t[i];if(!s)return;const a=s.timescale||9e4;Vt(e,["tfdt"]).forEach((t=>{const e=t[0],n=r*a;if(n){let r=jt(t,4);if(0===e)r-=n,r=Math.max(r,0),Ht(t,4,r);else{r*=Math.pow(2,32),r+=jt(t,8),r-=n,r=Math.max(r,0);const e=Math.floor(r/(Ft+1)),i=Math.floor(r%(Ft+1));Ht(t,4,e),Ht(t,8,i)}}}))}))}))}(f,h,l.baseTime/l.timescale),p>0?this.lastEndTime=v:(N.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const E=!!f.audio,b=!!f.video;let T="";E&&(T+="audio"),b&&(T+="video");const S={data1:h,startPTS:y,startDTS:y,endPTS:v,endDTS:v,type:T,hasAudio:E,hasVideo:b,nb:1,dropped:0};return u.audio="audio"===S.type?S:void 0,u.video="audio"!==S.type?S:void 0,u.initSegment=d,u.id3=Mi(r,i,l,l),n.samples.length&&(u.text=Fi(n,i,l)),u}}},{demux:vi,remux:Pi},{demux:class extends Kn{constructor(t,e){super(),this.observer=void 0,this.config=void 0,this.observer=t,this.config=e}resetInitSegment(t,e,r,n){super.resetInitSegment(t,e,r,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:e,duration:n,inputTimeScale:9e4,dropped:0}}static probe(t){if(!t)return!1;const e=bt(t,0);let r=(null==e?void 0:e.length)||0;if(li(t,r))return!1;for(let e=t.length;r<e;r++)if(zn(t,r))return N.log("ADTS sync word found !"),!0;return!1}canParse(t,e){return function(t,e){return function(t,e){return e+5<t.length}(t,e)&&Vn(t,e)&&Yn(t,e)<=t.length-e}(t,e)}appendFrame(t,e,r){Xn(t,this.observer,e,r,t.manifestCodec);const n=Jn(t,e,r,this.basePTS,this.frameIndex);if(n&&0===n.missing)return n}},remux:Pi},{demux:class extends Kn{resetInitSegment(t,e,r,n){super.resetInitSegment(t,e,r,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:e,duration:n,inputTimeScale:9e4,dropped:0}}static probe(t){if(!t)return!1;const e=bt(t,0);let r=(null==e?void 0:e.length)||0;if(e&&11===t[r]&&119===t[r+1]&&void 0!==At(e)&&ui(t,r)<=16)return!1;for(let e=t.length;r<e;r++)if(li(t,r))return N.log("MPEG Audio sync word found !"),!0;return!1}canParse(t,e){return function(t,e){return ai(t,e)&&4<=t.length-e}(t,e)}appendFrame(t,e,r){if(null!==this.basePTS)return ii(t,e,r,this.basePTS,this.frameIndex)}},remux:Pi}];Ui.splice(2,0,{demux:hi,remux:Pi});class $i{constructor(t,e,r,n,i){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=t,this.typeSupported=e,this.config=r,this.vendor=n,this.id=i}configure(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()}push(t,e,r,n){const i=r.transmuxing;i.executeStart=Di();let s=new Uint8Array(t);const{currentTransmuxState:a,transmuxConfig:o}=this;n&&(this.currentTransmuxState=n);const{contiguous:l,discontinuity:c,trackSwitch:u,accurateTimeOffset:h,timeOffset:d,initSegmentChange:f}=n||a,{audioCodec:p,videoCodec:g,defaultInitPts:m,duration:y,initSegmentData:v}=o,E=function(t,e){let r=null;t.byteLength>0&&null!=(null==e?void 0:e.key)&&null!==e.iv&&null!=e.method&&(r=e);return r}(s,e);if(E&&"AES-128"===E.method){const t=this.getDecrypter();if(!t.isSync())return this.decryptionPromise=t.webCryptoDecrypt(s,E.key.buffer,E.iv.buffer).then((t=>{const e=this.push(t,null,r);return this.decryptionPromise=null,e})),this.decryptionPromise;{let e=t.softwareDecrypt(s,E.key.buffer,E.iv.buffer);if(r.part>-1&&(e=t.flush()),!e)return i.executeEnd=Di(),ji(r);s=new Uint8Array(e)}}const b=this.needsProbing(c,u);if(b){const t=this.configureTransmuxer(s);if(t)return N.warn(`[transmuxer] ${t.message}`),this.observer.emit(I.ERROR,I.ERROR,{type:x.MEDIA_ERROR,details:P.FRAG_PARSING_ERROR,fatal:!1,error:t,reason:t.message}),i.executeEnd=Di(),ji(r)}(c||u||f||b)&&this.resetInitSegment(v,p,g,y,e),(c||f||b)&&this.resetInitialTimestamp(m),l||this.resetContiguity();const T=this.transmux(s,E,d,h,r),S=this.currentTransmuxState;return S.contiguous=!0,S.discontinuity=!1,S.trackSwitch=!1,i.executeEnd=Di(),T}flush(t){const e=t.transmuxing;e.executeStart=Di();const{decrypter:r,currentTransmuxState:n,decryptionPromise:i}=this;if(i)return i.then((()=>this.flush(t)));const s=[],{timeOffset:a}=n;if(r){const e=r.flush();e&&s.push(this.push(e,null,t))}const{demuxer:o,remuxer:l}=this;if(!o||!l)return e.executeEnd=Di(),[ji(t)];const c=o.flush(a);return Gi(c)?c.then((e=>(this.flushRemux(s,e,t),s))):(this.flushRemux(s,c,t),s)}flushRemux(t,e,r){const{audioTrack:n,videoTrack:i,id3Track:s,textTrack:a}=e,{accurateTimeOffset:o,timeOffset:l}=this.currentTransmuxState;N.log(`[transmuxer.ts]: Flushed fragment ${r.sn}${r.part>-1?" p: "+r.part:""} of level ${r.level}`);const c=this.remuxer.remux(n,i,s,a,l,o,!0,this.id);t.push({remuxResult:c,chunkMeta:r}),r.transmuxing.executeEnd=Di()}resetInitialTimestamp(t){const{demuxer:e,remuxer:r}=this;e&&r&&(e.resetTimeStamp(t),r.resetTimeStamp(t))}resetContiguity(){const{demuxer:t,remuxer:e}=this;t&&e&&(t.resetContiguity(),e.resetNextTimestamp())}resetInitSegment(t,e,r,n,i){const{demuxer:s,remuxer:a}=this;s&&a&&(s.resetInitSegment(t,e,r,n),a.resetInitSegment(t,e,r,i))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(t,e,r,n,i){let s;return s=e&&"SAMPLE-AES"===e.method?this.transmuxSampleAes(t,e,r,n,i):this.transmuxUnencrypted(t,r,n,i),s}transmuxUnencrypted(t,e,r,n){const{audioTrack:i,videoTrack:s,id3Track:a,textTrack:o}=this.demuxer.demux(t,e,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(i,s,a,o,e,r,!1,this.id),chunkMeta:n}}transmuxSampleAes(t,e,r,n,i){return this.demuxer.demuxSampleAes(t,e,r).then((t=>({remuxResult:this.remuxer.remux(t.audioTrack,t.videoTrack,t.id3Track,t.textTrack,r,n,!1,this.id),chunkMeta:i})))}configureTransmuxer(t){const{config:e,observer:r,typeSupported:n,vendor:i}=this;let s;for(let e=0,r=Ui.length;e<r;e++){var a;if(null!=(a=Ui[e].demux)&&a.probe(t)){s=Ui[e];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,l=this.remuxer,c=s.remux,u=s.demux;l&&l instanceof c||(this.remuxer=new c(r,e,n,i)),o&&o instanceof u||(this.demuxer=new u(r,e,n),this.probe=u.probe)}needsProbing(t,e){return!this.demuxer||!this.remuxer||t||e}getDecrypter(){let t=this.decrypter;return t||(t=this.decrypter=new Ln(this.config)),t}}const ji=t=>({remuxResult:{},chunkMeta:t});function Gi(t){return"then"in t&&t.then instanceof Function}class Ki{constructor(t,e,r,n,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=t,this.videoCodec=e,this.initSegmentData=r,this.duration=n,this.defaultInitPts=i||null}}class Hi{constructor(t,e,r,n,i,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=t,this.contiguous=e,this.accurateTimeOffset=r,this.trackSwitch=n,this.timeOffset=i,this.initSegmentChange=s}}var Vi={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function i(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function s(t,e,n,s,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new i(n,s||t,a),l=r?r+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),o.prototype.eventNames=function(){var t,n,i=[];if(0===this._eventsCount)return i;for(n in t=this._events)e.call(t,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},o.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,a=new Array(s);i<s;i++)a[i]=n[i].fn;return a},o.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},o.prototype.emit=function(t,e,n,i,s,a){var o=r?r+t:t;if(!this._events[o])return!1;var l,c,u=this._events[o],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,n),!0;case 4:return u.fn.call(u.context,e,n,i),!0;case 5:return u.fn.call(u.context,e,n,i,s),!0;case 6:return u.fn.call(u.context,e,n,i,s,a),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var d,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(t,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,e);break;case 3:u[c].fn.call(u[c].context,e,n);break;case 4:u[c].fn.call(u[c].context,e,n,i);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];u[c].fn.apply(u[c].context,l)}}return!0},o.prototype.on=function(t,e,r){return s(this,t,e,r,!1)},o.prototype.once=function(t,e,r){return s(this,t,e,r,!0)},o.prototype.removeListener=function(t,e,n,i){var s=r?r+t:t;if(!this._events[s])return this;if(!e)return a(this,s),this;var o=this._events[s];if(o.fn)o.fn!==e||i&&!o.once||n&&o.context!==n||a(this,s);else{for(var l=0,c=[],u=o.length;l<u;l++)(o[l].fn!==e||i&&!o[l].once||n&&o[l].context!==n)&&c.push(o[l]);c.length?this._events[s]=1===c.length?c[0]:c:a(this,s)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&a(this,e)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=r,o.EventEmitter=o,t.exports=o}(Vi);var Wi=b(Vi.exports);class Yi{constructor(t,e,r,n){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const i=t.config;this.hls=t,this.id=e,this.useWorker=!!i.enableWorker,this.onTransmuxComplete=r,this.onFlush=n;const s=(t,e)=>{(e=e||{}).frag=this.frag,e.id=this.id,t===I.ERROR&&(this.error=e.error),this.hls.trigger(t,e)};this.observer=new Wi,this.observer.on(I.FRAG_DECRYPTED,s),this.observer.on(I.ERROR,s);const a=ge(i.preferManagedMediaSource)||{isTypeSupported:()=>!1},o={mpeg:a.isTypeSupported("audio/mpeg"),mp3:a.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:a.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&"undefined"!=typeof Worker){if(i.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{i.workerPath?(N.log(`loading Web Worker ${i.workerPath} for "${e}"`),this.workerContext=function(t){const e=new self.URL(t,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}(i.workerPath)):(N.log(`injecting Web Worker for "${e}"`),this.workerContext=function(){const 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"}),e=self.URL.createObjectURL(t);return{worker:new self.Worker(e),objectURL:e}}()),this.onwmsg=t=>this.onWorkerMessage(t);const{worker:t}=this.workerContext;t.addEventListener("message",this.onwmsg),t.onerror=t=>{const r=new Error(`${t.message} (${t.filename}:${t.lineno})`);i.enableWorker=!1,N.warn(`Error in "${e}" Web Worker, fallback to inline`),this.hls.trigger(I.ERROR,{type:x.OTHER_ERROR,details:P.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:r})},t.postMessage({cmd:"init",typeSupported:o,vendor:"",id:e,config:JSON.stringify(i)})}catch(t){N.warn(`Error setting up "${e}" Web Worker, fallback to inline`,t),this.resetWorker(),this.error=null,this.transmuxer=new $i(this.observer,o,i,"",e)}return}}this.transmuxer=new $i(this.observer,o,i,"",e)}resetWorker(){if(this.workerContext){const{worker:t,objectURL:e}=this.workerContext;e&&self.URL.revokeObjectURL(e),t.removeEventListener("message",this.onwmsg),t.onerror=null,t.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const t=this.observer;t&&t.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(t,e,r,n,i,s,a,o,l,c){var u,h;l.transmuxing.start=self.performance.now();const{transmuxer:d}=this,f=s?s.start:i.start,p=i.decryptdata,g=this.frag,m=!(g&&i.cc===g.cc),y=!(g&&l.level===g.level),v=g?l.sn-g.sn:-1,E=this.part?l.part-this.part.index:-1,b=0===v&&l.id>1&&l.id===(null==g?void 0:g.stats.chunkCount),T=!y&&(1===v||0===v&&(1===E||b&&E<=0)),S=self.performance.now();(y||v||0===i.stats.parsing.start)&&(i.stats.parsing.start=S),!s||!E&&T||(s.stats.parsing.start=S);const A=!(g&&(null==(u=i.initSegment)?void 0:u.url)===(null==(h=g.initSegment)?void 0:h.url)),_=new Hi(m,T,o,y,f,A);if(!T||m||A){N.log(`[transmuxer-interface, ${i.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}\n discontinuity: ${m}\n trackSwitch: ${y}\n contiguous: ${T}\n accurateTimeOffset: ${o}\n timeOffset: ${f}\n initSegmentChange: ${A}`);const t=new Ki(r,n,e,a,c);this.configureTransmuxer(t)}if(this.frag=i,this.part=s,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:t,decryptdata:p,chunkMeta:l,state:_},t instanceof ArrayBuffer?[t]:[]);else if(d){const e=d.push(t,p,l,_);Gi(e)?(d.async=!0,e.then((t=>{this.handleTransmuxComplete(t)})).catch((t=>{this.transmuxerError(t,l,"transmuxer-interface push error")}))):(d.async=!1,this.handleTransmuxComplete(e))}}flush(t){t.transmuxing.start=self.performance.now();const{transmuxer:e}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:t});else if(e){let r=e.flush(t);Gi(r)||e.async?(Gi(r)||(r=Promise.resolve(r)),r.then((e=>{this.handleFlushResult(e,t)})).catch((e=>{this.transmuxerError(e,t,"transmuxer-interface flush error")}))):this.handleFlushResult(r,t)}}transmuxerError(t,e,r){this.hls&&(this.error=t,this.hls.trigger(I.ERROR,{type:x.MEDIA_ERROR,details:P.FRAG_PARSING_ERROR,chunkMeta:e,frag:this.frag||void 0,fatal:!1,error:t,err:t,reason:r}))}handleFlushResult(t,e){t.forEach((t=>{this.handleTransmuxComplete(t)})),this.onFlush(e)}onWorkerMessage(t){const e=t.data;if(null==e||!e.event)return void N.warn("worker message received with no "+(e?"event name":"data"));const r=this.hls;if(this.hls)switch(e.event){case"init":{var n;const t=null==(n=this.workerContext)?void 0:n.objectURL;t&&self.URL.revokeObjectURL(t);break}case"transmuxComplete":this.handleTransmuxComplete(e.data);break;case"flush":this.onFlush(e.data);break;case"workerLog":N[e.data.logType]&&N[e.data.logType](e.data.message);break;default:e.data=e.data||{},e.data.frag=this.frag,e.data.id=this.id,r.trigger(e.event,e.data)}}configureTransmuxer(t){const{transmuxer:e}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:t}):e&&e.configure(t)}handleTransmuxComplete(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)}}function qi(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!zi(t[r].attrs,e[r].attrs))return!1;return!0}function zi(t,e,r){const n=t["STABLE-RENDITION-ID"];return n&&!r?n===e["STABLE-RENDITION-ID"]:!(r||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some((r=>t[r]!==e[r]))}function Xi(t,e){return e.label.toLowerCase()===t.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(t.lang||"").toLowerCase())}class Qi{constructor(t){this.buffered=void 0;const e=(e,r,n)=>{if((r>>>=0)>n-1)throw new DOMException(`Failed to execute '${e}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${n})`);return t[r][e]};this.buffered={get length(){return t.length},end:r=>e("end",r,t.length),start:r=>e("start",r,t.length)}}}class Ji{constructor(t){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=t}append(t,e,r){const n=this.queues[e];n.push(t),1!==n.length||r||this.executeNext(e)}insertAbort(t,e){this.queues[e].unshift(t),this.executeNext(e)}appendBlocker(t){let e;const r=new Promise((t=>{e=t})),n={execute:e,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(n,t),r}executeNext(t){const e=this.queues[t];if(e.length){const r=e[0];try{r.execute()}catch(e){N.warn(`[buffer-operation-queue]: Exception executing "${t}" SourceBuffer operation: ${e}`),r.onError(e);const n=this.buffers[t];null!=n&&n.updating||this.shiftAndExecuteNext(t)}}}shiftAndExecuteNext(t){this.queues[t].shift(),this.executeNext(t)}current(t){return this.queues[t][0]}}const Zi=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;function ts(t){const e=t.querySelectorAll("source");[].slice.call(e).forEach((e=>{t.removeChild(e)}))}const es={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},rs=t=>String.fromCharCode(es[t]||t),ns=15,is=100,ss={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},as={17:2,18:4,21:6,22:8,23:10,19:13,20:15},os={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},ls={25:2,26:4,29:6,30:8,31:10,27:13,28:15},cs=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class us{constructor(){this.time=null,this.verboseLevel=0}log(t,e){if(this.verboseLevel>=t){const r="function"==typeof e?e():e;N.log(`${this.time} [${t}] ${r}`)}}}const hs=function(t){const e=[];for(let r=0;r<t.length;r++)e.push(t[r].toString(16));return e};class ds{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(t){const e=["foreground","underline","italics","background","flash"];for(let r=0;r<e.length;r++){const n=e[r];t.hasOwnProperty(n)&&(this[n]=t[n])}}isDefault(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash}equals(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash}copy(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class fs{constructor(){this.uchar=" ",this.penState=new ds}reset(){this.uchar=" ",this.penState.reset()}setChar(t,e){this.uchar=t,this.penState.copy(e)}setPenState(t){this.penState.copy(t)}equals(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)}copy(t){this.uchar=t.uchar,this.penState.copy(t.penState)}isEmpty(){return" "===this.uchar&&this.penState.isDefault()}}class ps{constructor(t){this.chars=[],this.pos=0,this.currPenState=new ds,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<is;t++)this.chars.push(new fs);this.logger=t}equals(t){for(let e=0;e<is;e++)if(!this.chars[e].equals(t.chars[e]))return!1;return!0}copy(t){for(let e=0;e<is;e++)this.chars[e].copy(t.chars[e])}isEmpty(){let t=!0;for(let e=0;e<is;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t}setCursor(t){this.pos!==t&&(this.pos=t),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>is&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=is)}moveCursor(t){const e=this.pos+t;if(t>1)for(let t=this.pos+1;t<e+1;t++)this.chars[t].setPenState(this.currPenState);this.setCursor(e)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(t){t>=144&&this.backSpace();const e=rs(t);this.pos>=is?this.logger.log(0,(()=>"Cannot insert "+t.toString(16)+" ("+e+") at position "+this.pos+". Skipping it!")):(this.chars[this.pos].setChar(e,this.currPenState),this.moveCursor(1))}clearFromPos(t){let e;for(e=t;e<is;e++)this.chars[e].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const t=[];let e=!0;for(let r=0;r<is;r++){const n=this.chars[r].uchar;" "!==n&&(e=!1),t.push(n)}return e?"":t.join("")}setPenStyles(t){this.currPenState.setStyles(t);this.chars[this.pos].setPenState(this.currPenState)}}class gs{constructor(t){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let e=0;e<ns;e++)this.rows.push(new ps(t));this.logger=t}reset(){for(let t=0;t<ns;t++)this.rows[t].clear();this.currRow=14}equals(t){let e=!0;for(let r=0;r<ns;r++)if(!this.rows[r].equals(t.rows[r])){e=!1;break}return e}copy(t){for(let e=0;e<ns;e++)this.rows[e].copy(t.rows[e])}isEmpty(){let t=!0;for(let e=0;e<ns;e++)if(!this.rows[e].isEmpty()){t=!1;break}return t}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(t){this.rows[this.currRow].insertChar(t)}setPen(t){this.rows[this.currRow].setPenStyles(t)}moveCursor(t){this.rows[this.currRow].moveCursor(t)}setCursor(t){this.logger.log(2,"setCursor: "+t);this.rows[this.currRow].setCursor(t)}setPAC(t){this.logger.log(2,(()=>"pacData = "+JSON.stringify(t)));let e=t.row-1;if(this.nrRollUpRows&&e<this.nrRollUpRows-1&&(e=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==e){for(let t=0;t<ns;t++)this.rows[t].clear();const t=this.currRow+1-this.nrRollUpRows,r=this.lastOutputScreen;if(r){const n=r.rows[t].cueStartTime,i=this.logger.time;if(null!==n&&null!==i&&n<i)for(let n=0;n<this.nrRollUpRows;n++)this.rows[e-this.nrRollUpRows+n+1].copy(r.rows[t+n])}}this.currRow=e;const r=this.rows[this.currRow];if(null!==t.indent){const e=t.indent,n=Math.max(e-1,0);r.setCursor(t.indent),t.color=r.chars[n].penState.foreground}const n={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(n)}setBkgData(t){this.logger.log(2,(()=>"bkgData = "+JSON.stringify(t))),this.backSpace(),this.setPen(t),this.insertChar(32)}setRollUpRows(t){this.nrRollUpRows=t}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,(()=>this.getDisplayText()));const t=this.currRow+1-this.nrRollUpRows,e=this.rows.splice(t,1)[0];e.clear(),this.rows.splice(this.currRow,0,e),this.logger.log(2,"Rolling up")}getDisplayText(t){t=t||!1;const e=[];let r="",n=-1;for(let r=0;r<ns;r++){const i=this.rows[r].getTextString();i&&(n=r+1,t?e.push("Row "+n+": '"+i+"'"):e.push(i.trim()))}return e.length>0&&(r=t?"["+e.join(" | ")+"]":e.join("\n")),r}getTextAndFormat(){return this.rows}}class ms{constructor(t,e,r){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=t,this.outputFilter=e,this.mode=null,this.verbose=0,this.displayedMemory=new gs(r),this.nonDisplayedMemory=new gs(r),this.lastOutputScreen=new gs(r),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}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(t){this.outputFilter=t}setPAC(t){this.writeScreen.setPAC(t)}setBkgData(t){this.writeScreen.setBkgData(t)}setMode(t){t!==this.mode&&(this.mode=t,this.logger.log(2,(()=>"MODE="+t)),"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=t)}insertChars(t){for(let e=0;e<t.length;e++)this.writeScreen.insertChar(t[e]);const e=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,(()=>e+": "+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(t){this.logger.log(2,"RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){const t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(()=>"DISP: "+this.displayedMemory.getDisplayText()))}this.outputDataUpdate(!0)}ccTO(t){this.logger.log(2,"TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)}ccMIDROW(t){const e={flash:!1};if(e.underline=t%2==1,e.italics=t>=46,e.italics)e.foreground="white";else{const r=Math.floor(t/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];e.foreground=n[r]}this.logger.log(2,"MIDROW: "+JSON.stringify(e)),this.writeScreen.setPen(e)}outputDataUpdate(t=!1){const e=this.logger.time;null!==e&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))}}class ys{constructor(t,e,r){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const n=this.logger=new us;this.channels=[null,new ms(t,e,n),new ms(t+1,r,n)]}getHandler(t){return this.channels[t].getHandler()}setHandler(t,e){this.channels[t].setHandler(e)}addData(t,e){this.logger.time=t;for(let t=0;t<e.length;t+=2){const r=127&e[t],n=127&e[t+1];let i=!1,s=null;if(0===r&&0===n)continue;this.logger.log(3,(()=>"["+hs([e[t],e[t+1]])+"] -> ("+hs([r,n])+")"));const a=this.cmdHistory;if(r>=16&&r<=31){if(Es(r,n,a)){vs(null,null,a),this.logger.log(3,(()=>"Repeated command ("+hs([r,n])+") is dropped"));continue}vs(r,n,this.cmdHistory),i=this.parseCmd(r,n),i||(i=this.parseMidrow(r,n)),i||(i=this.parsePAC(r,n)),i||(i=this.parseBackgroundAttributes(r,n))}else vs(null,null,a);if(!i&&(s=this.parseChars(r,n),s)){const t=this.currentChannel;if(t&&t>0){this.channels[t].insertChars(s)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}i||s||this.logger.log(2,(()=>"Couldn't parse cleaned data "+hs([r,n])+" orig: "+hs([e[t],e[t+1]])))}}parseCmd(t,e){if(!((20===t||28===t||21===t||29===t)&&e>=32&&e<=47)&&!((23===t||31===t)&&e>=33&&e<=35))return!1;const r=20===t||21===t||23===t?1:2,n=this.channels[r];return 20===t||21===t||28===t||29===t?32===e?n.ccRCL():33===e?n.ccBS():34===e?n.ccAOF():35===e?n.ccAON():36===e?n.ccDER():37===e?n.ccRU(2):38===e?n.ccRU(3):39===e?n.ccRU(4):40===e?n.ccFON():41===e?n.ccRDC():42===e?n.ccTR():43===e?n.ccRTD():44===e?n.ccEDM():45===e?n.ccCR():46===e?n.ccENM():47===e&&n.ccEOC():n.ccTO(e-32),this.currentChannel=r,!0}parseMidrow(t,e){let r=0;if((17===t||25===t)&&e>=32&&e<=47){if(r=17===t?1:2,r!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const n=this.channels[r];return!!n&&(n.ccMIDROW(e),this.logger.log(3,(()=>"MIDROW ("+hs([t,e])+")")),!0)}return!1}parsePAC(t,e){let r;if(!((t>=17&&t<=23||t>=25&&t<=31)&&e>=64&&e<=127)&&!((16===t||24===t)&&e>=64&&e<=95))return!1;const n=t<=23?1:2;r=e>=64&&e<=95?1===n?ss[t]:os[t]:1===n?as[t]:ls[t];const i=this.channels[n];return!!i&&(i.setPAC(this.interpretPAC(r,e)),this.currentChannel=n,!0)}interpretPAC(t,e){let r;const n={color:null,italics:!1,indent:null,underline:!1,row:t};return r=e>95?e-96:e-64,n.underline=!(1&~r),r<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(n.italics=!0,n.color="white"):n.indent=4*Math.floor((r-16)/2),n}parseChars(t,e){let r,n=null,i=null;if(t>=25?(r=2,i=t-8):(r=1,i=t),i>=17&&i<=19){let t;t=17===i?e+80:18===i?e+112:e+144,this.logger.log(2,(()=>"Special char '"+rs(t)+"' in channel "+r)),n=[t]}else t>=32&&t<=127&&(n=0===e?[t]:[t,e]);return n&&this.logger.log(3,(()=>"Char codes = "+hs(n).join(","))),n}parseBackgroundAttributes(t,e){if(!((16===t||24===t)&&e>=32&&e<=47)&&!((23===t||31===t)&&e>=45&&e<=47))return!1;let r;const n={};16===t||24===t?(r=Math.floor((e-32)/2),n.background=cs[r],e%2==1&&(n.background=n.background+"_semi")):45===e?n.background="transparent":(n.foreground="black",47===e&&(n.underline=!0));const i=t<=23?1:2;return this.channels[i].setBkgData(n),!0}reset(){for(let t=0;t<Object.keys(this.channels).length;t++){const e=this.channels[t];e&&e.reset()}vs(null,null,this.cmdHistory)}cueSplitAtTime(t){for(let e=0;e<this.channels.length;e++){const r=this.channels[e];r&&r.cueSplitAtTime(t)}}}function vs(t,e,r){r.a=t,r.b=e}function Es(t,e,r){return r.a===t&&r.b===e}class bs{constructor(t,e){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=t,this.trackName=e}dispatchCue(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(t,e,r){(null===this.startTime||this.startTime>t)&&(this.startTime=t),this.endTime=e,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var Ts=function(){if(null!=et&&et.VTTCue)return self.VTTCue;const t=["","lr","rl"],e=["start","middle","end","left","right"];function r(t,e){if("string"!=typeof e)return!1;if(!Array.isArray(t))return!1;const r=e.toLowerCase();return!!~t.indexOf(r)&&r}function n(t){return r(e,t)}function i(t,...e){let r=1;for(;r<arguments.length;r++){const e=arguments[r];for(const r in e)t[r]=e[r]}return t}function s(e,s,a){const o=this,l={enumerable:!0};o.hasBeenReset=!1;let c="",u=!1,h=e,d=s,f=a,p=null,g="",m=!0,y="auto",v="start",E=50,b="middle",T=50,S="middle";Object.defineProperty(o,"id",i({},l,{get:function(){return c},set:function(t){c=""+t}})),Object.defineProperty(o,"pauseOnExit",i({},l,{get:function(){return u},set:function(t){u=!!t}})),Object.defineProperty(o,"startTime",i({},l,{get:function(){return h},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");h=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",i({},l,{get:function(){return d},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");d=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",i({},l,{get:function(){return f},set:function(t){f=""+t,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",i({},l,{get:function(){return p},set:function(t){p=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",i({},l,{get:function(){return g},set:function(e){const n=function(e){return r(t,e)}(e);if(!1===n)throw new SyntaxError("An invalid or illegal string was specified.");g=n,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",i({},l,{get:function(){return m},set:function(t){m=!!t,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",i({},l,{get:function(){return y},set:function(t){if("number"!=typeof t&&"auto"!==t)throw new SyntaxError("An invalid number or illegal string was specified.");y=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",i({},l,{get:function(){return v},set:function(t){const e=n(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");v=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",i({},l,{get:function(){return E},set:function(t){if(t<0||t>100)throw new Error("Position must be between 0 and 100.");E=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",i({},l,{get:function(){return b},set:function(t){const e=n(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",i({},l,{get:function(){return T},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");T=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",i({},l,{get:function(){return S},set:function(t){const e=n(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");S=e,this.hasBeenReset=!0}})),o.displayState=void 0}return s.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},s}();class Ss{decode(t,e){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}function As(t){function e(t,e,r,n){return 3600*(0|t)+60*(0|e)+(0|r)+parseFloat(n||0)}const r=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return r?parseFloat(r[2])>59?e(r[2],r[3],0,r[4]):e(r[1],r[2],r[3],r[4]):null}class _s{constructor(){this.values=Object.create(null)}set(t,e){this.get(t)||""===e||(this.values[t]=e)}get(t,e,r){return r?this.has(t)?this.values[t]:e[r]:this.has(t)?this.values[t]:e}has(t){return t in this.values}alt(t,e,r){for(let n=0;n<r.length;++n)if(e===r[n]){this.set(t,e);break}}integer(t,e){/^-?\d+$/.test(e)&&this.set(t,parseInt(e,10))}percent(t,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){const r=parseFloat(e);if(r>=0&&r<=100)return this.set(t,r),!0}return!1}}function ks(t,e,r,n){const i=n?t.split(n):[t];for(const t in i){if("string"!=typeof i[t])continue;const n=i[t].split(r);if(2!==n.length)continue;e(n[0],n[1])}}const Ls=new Ts(0,0,""),ws="middle"===Ls.align?"middle":"center";function Rs(t,e,r){const n=t;function i(){const e=As(t);if(null===e)throw new Error("Malformed timestamp: "+n);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function s(){t=t.replace(/^\s+/,"")}if(s(),e.startTime=i(),s(),"--\x3e"!==t.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);t=t.slice(3),s(),e.endTime=i(),s(),function(t,e){const n=new _s;ks(t,(function(t,e){let i;switch(t){case"region":for(let i=r.length-1;i>=0;i--)if(r[i].id===e){n.set(t,r[i].region);break}break;case"vertical":n.alt(t,e,["rl","lr"]);break;case"line":i=e.split(","),n.integer(t,i[0]),n.percent(t,i[0])&&n.set("snapToLines",!1),n.alt(t,i[0],["auto"]),2===i.length&&n.alt("lineAlign",i[1],["start",ws,"end"]);break;case"position":i=e.split(","),n.percent(t,i[0]),2===i.length&&n.alt("positionAlign",i[1],["start",ws,"end","line-left","line-right","auto"]);break;case"size":n.percent(t,e);break;case"align":n.alt(t,e,["start",ws,"end","left","right"])}}),/:/,/\s/),e.region=n.get("region",null),e.vertical=n.get("vertical","");let i=n.get("line","auto");"auto"===i&&-1===Ls.line&&(i=-1),e.line=i,e.lineAlign=n.get("lineAlign","start"),e.snapToLines=n.get("snapToLines",!0),e.size=n.get("size",100),e.align=n.get("align",ws);let s=n.get("position","auto");"auto"===s&&50===Ls.position&&(s="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=s}(t,e)}function Cs(t){return t.replace(/<br(?: \/)?>/gi,"\n")}class Ds{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Ss,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(t){const e=this;function r(){let t=e.buffer,r=0;for(t=Cs(t);r<t.length&&"\r"!==t[r]&&"\n"!==t[r];)++r;const n=t.slice(0,r);return"\r"===t[r]&&++r,"\n"===t[r]&&++r,e.buffer=t.slice(r),n}t&&(e.buffer+=e.decoder.decode(t,{stream:!0}));try{let t="";if("INITIAL"===e.state){if(!/\r\n|\n/.test(e.buffer))return this;t=r();const n=t.match(/^()?WEBVTT([ \t].*)?$/);if(null==n||!n[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}let n=!1;for(;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(n?n=!1:t=r(),e.state){case"HEADER":/:/.test(t)?ks(t,(function(t,e){}),/:/):t||(e.state="ID");continue;case"NOTE":t||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(t)){e.state="NOTE";break}if(!t)continue;if(e.cue=new Ts(0,0,""),e.state="CUE",-1===t.indexOf("--\x3e")){e.cue.id=t;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{Rs(t,e.cue,e.regionList)}catch(t){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{const r=-1!==t.indexOf("--\x3e");if(!t||r&&(n=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(null===e.cue)continue;e.cue.text&&(e.cue.text+="\n"),e.cue.text+=t}continue;case"BADCUE":t||(e.state="ID")}}}catch(t){"CUETEXT"===e.state&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state="INITIAL"===e.state?"BADWEBVTT":"BADCUE"}return this}flush(){const t=this;try{if((t.cue||"HEADER"===t.state)&&(t.buffer+="\n\n",t.parse()),"INITIAL"===t.state||"BADWEBVTT"===t.state)throw new Error("Malformed WebVTT signature.")}catch(e){t.onparsingerror&&t.onparsingerror(e)}return t.onflush&&t.onflush(),this}}const Is=/\r\n|\n\r|\n|\r/g,xs=function(t,e,r=0){return t.slice(r,r+e.length)===e},Ps=function(t){let e=5381,r=t.length;for(;r;)e=33*e^t.charCodeAt(--r);return(e>>>0).toString()};function Os(t,e,r){return Ps(t.toString())+Ps(e.toString())+Ps(r)}function Ms(t,e,r,n,i,s,a){const o=new Ds,l=xt(new Uint8Array(t)).trim().replace(Is,"\n").split("\n"),c=[],u=e?function(t,e=1){return Ri(t,9e4,1/e)}(e.baseTime,e.timescale):0;let h,d="00:00.000",f=0,p=0,g=!0;o.oncue=function(t){const s=r[n];let a=r.ccOffset;const o=(f-u)/9e4;if(null!=s&&s.new&&(void 0!==p?a=r.ccOffset=s.start:function(t,e,r){let n=t[e],i=t[n.prevCC];if(!i||!i.new&&n.new)return t.ccOffset=t.presentationOffset=n.start,void(n.new=!1);for(;null!=(s=i)&&s.new;){var s;t.ccOffset+=n.start-i.start,n.new=!1,n=i,i=t[n.prevCC]}t.presentationOffset=r}(r,n,o)),o){if(!e)return void(h=new Error("Missing initPTS for VTT MPEGTS"));a=o-r.presentationOffset}const l=t.endTime-t.startTime,d=Oi(9e4*(t.startTime+a-p),9e4*i)/9e4;t.startTime=Math.max(d,0),t.endTime=Math.max(d+l,0);const g=t.text.trim();t.text=decodeURIComponent(encodeURIComponent(g)),t.id||(t.id=Os(t.startTime,t.endTime,g)),t.endTime>0&&c.push(t)},o.onparsingerror=function(t){h=t},o.onflush=function(){h?a(h):s(c)},l.forEach((t=>{if(g){if(xs(t,"X-TIMESTAMP-MAP=")){g=!1,t.slice(16).split(",").forEach((t=>{xs(t,"LOCAL:")?d=t.slice(6):xs(t,"MPEGTS:")&&(f=parseInt(t.slice(7)))}));try{p=function(t){let e=parseInt(t.slice(-3));const r=parseInt(t.slice(-6,-4)),n=parseInt(t.slice(-9,-7)),i=t.length>9?parseInt(t.substring(0,t.indexOf(":"))):0;if(!(R(e)&&R(r)&&R(n)&&R(i)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${t}`);return e+=1e3*r,e+=6e4*n,e+=36e5*i,e}(d)/1e3}catch(t){h=t}return}""===t&&(g=!1)}o.parse(t+"\n")})),o.flush()}const Fs="stpp.ttml.im1t",Bs=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ns=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Us={left:"start",center:"center",right:"end",start:"start",end:"end"};function $s(t,e,r,n){const i=Vt(new Uint8Array(t),["mdat"]);if(0===i.length)return void n(new Error("Could not parse IMSC1 mdat"));const s=i.map((t=>xt(t))),a=function(t,e,r=1,n=!1){return Ri(t,e,1/r,n)}(e.baseTime,1,e.timescale);try{s.forEach((t=>r(function(t,e){const r=(new DOMParser).parseFromString(t,"text/xml"),n=r.getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");const i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},s=Object.keys(i).reduce(((t,e)=>(t[e]=n.getAttribute(`ttp:${e}`)||i[e],t)),{}),a="preserve"!==n.getAttribute("xml:space"),o=Gs(js(n,"styling","style")),l=Gs(js(n,"layout","region")),c=js(n,"body","[begin]");return[].map.call(c,(t=>{const r=Ks(t,a);if(!r||!t.hasAttribute("begin"))return null;const n=Ws(t.getAttribute("begin"),s),i=Ws(t.getAttribute("dur"),s);let c=Ws(t.getAttribute("end"),s);if(null===n)throw Vs(t);if(null===c){if(null===i)throw Vs(t);c=n+i}const u=new Ts(n-e,c-e,r);u.id=Os(u.startTime,u.endTime,u.text);const h=function(t,e,r){const n="http://www.w3.org/ns/ttml#styling";let i=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=null!=t&&t.hasAttribute("style")?t.getAttribute("style"):null;a&&r.hasOwnProperty(a)&&(i=r[a]);return s.reduce(((r,s)=>{const a=Hs(e,n,s)||Hs(t,n,s)||Hs(i,n,s);return a&&(r[s]=a),r}),{})}(l[t.getAttribute("region")],o[t.getAttribute("style")],o),{textAlign:d}=h;if(d){const t=Us[d];t&&(u.lineAlign=t),u.align=d}return w(u,h),u})).filter((t=>null!==t))}(t,a))))}catch(t){n(t)}}function js(t,e,r){const n=t.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(r)):[]}function Gs(t){return t.reduce(((t,e)=>{const r=e.getAttribute("xml:id");return r&&(t[r]=e),t}),{})}function Ks(t,e){return[].slice.call(t.childNodes).reduce(((t,r,n)=>{var i;return"br"===r.nodeName&&n?t+"\n":null!=(i=r.childNodes)&&i.length?Ks(r,e):e?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent}),"")}function Hs(t,e,r){return t&&t.hasAttributeNS(e,r)?t.getAttributeNS(e,r):null}function Vs(t){return new Error(`Could not parse ttml timestamp ${t}`)}function Ws(t,e){if(!t)return null;let r=As(t);return null===r&&(Bs.test(t)?r=function(t,e){const r=Bs.exec(t),n=(0|r[4])+(0|r[5])/e.subFrameRate;return 3600*(0|r[1])+60*(0|r[2])+(0|r[3])+n/e.frameRate}(t,e):Ns.test(t)&&(r=function(t,e){const r=Ns.exec(t),n=Number(r[1]);switch(r[2]){case"h":return 3600*n;case"m":return 60*n;case"ms":return 1e3*n;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}(t,e))),r}function Ys(t){return t.characteristics&&/transcribes-spoken-dialog/gi.test(t.characteristics)&&/describes-music-and-sound/gi.test(t.characteristics)?"captions":"subtitles"}function qs(t,e){return!!t&&t.kind===Ys(e)&&Xi(e,t)}class zs{constructor(t){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=t,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(t){this.streamController=t}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:t}=this;t.on(I.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on(I.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(I.MANIFEST_PARSED,this.onManifestParsed,this),t.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(I.BUFFER_CODECS,this.onBufferCodecs,this),t.on(I.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:t}=this;t.off(I.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(I.MANIFEST_PARSED,this.onManifestParsed,this),t.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(I.BUFFER_CODECS,this.onBufferCodecs,this),t.off(I.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(t,e){const r=this.hls.levels[e.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})}onMediaAttaching(t,e){this.media=e.media instanceof HTMLVideoElement?e.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(t,e){const r=this.hls;this.restrictedLevels=[],this.firstLevel=e.firstLevel,r.config.capLevelToPlayerSize&&e.video&&this.startCapping()}onLevelsUpdated(t,e){this.timer&&R(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(t,e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const t=this.hls.levels;if(t.length){const e=this.hls,r=this.getMaxLevel(t.length-1);r!==this.autoLevelCapping&&N.log(`Setting autoLevelCapping to ${r}: ${t[r].height}p@${t[r].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),e.autoLevelCapping=r,e.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}}getMaxLevel(t){const e=this.hls.levels;if(!e.length)return-1;const r=e.filter(((e,r)=>this.isLevelAllowed(e)&&r<=t));return this.clientRect=null,zs.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const t=this.media,e={width:0,height:0};if(t){const r=t.getBoundingClientRect();e.width=r.width,e.height=r.height,e.width||e.height||(e.width=r.right-r.left||t.width||0,e.height=r.bottom-r.top||t.height||0)}return this.clientRect=e,e}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let t=1;if(!this.hls.config.ignoreDevicePixelRatio)try{t=self.devicePixelRatio}catch(t){}return t}isLevelAllowed(t){return!this.restrictedLevels.some((e=>t.bitrate===e.bitrate&&t.width===e.width&&t.height===e.height))}static getMaxLevelByMediaSize(t,e,r){if(null==t||!t.length)return-1;let n=t.length-1;const i=Math.max(e,r);for(let e=0;e<t.length;e+=1){const r=t[e];if((r.width>=i||r.height>=i)&&(s=r,!(a=t[e+1])||s.width!==a.width||s.height!==a.height)){n=e;break}}var s,a;return n}}const Xs="[eme]";class Qs{constructor(t){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=Qs.CDMCleanupPromise?[Qs.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=N.debug.bind(N,Xs),this.log=N.log.bind(N,Xs),this.warn=N.warn.bind(N,Xs),this.error=N.error.bind(N,Xs),this.hls=t,this.config=t.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const t=this.config;t.requestMediaKeySystemAccessFunc=null,t.licenseXhrSetup=t.licenseResponseCallback=void 0,t.drmSystems=t.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(I.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(I.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(t){const{drmSystems:e,widevineLicenseUrl:r}=this.config,n=e[t];if(n)return n.licenseUrl;if(t===rt.WIDEVINE&&r)return r;throw new Error(`no license server URL configured for key-system "${t}"`)}getServerCertificateUrl(t){const{drmSystems:e}=this.config,r=e[t];if(r)return r.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${t}"]`)}attemptKeySystemAccess(t){const e=this.hls.levels,r=(t,e,r)=>!!t&&r.indexOf(t)===e,n=e.map((t=>t.audioCodec)).filter(r),i=e.map((t=>t.videoCodec)).filter(r);return n.length+i.length===0&&i.push("avc1.42e01e"),new Promise(((e,r)=>{const s=t=>{const a=t.shift();this.getMediaKeysPromise(a,n,i).then((t=>e({keySystem:a,mediaKeys:t}))).catch((e=>{t.length?s(t):r(e instanceof Js?e:new Js({type:x.KEY_SYSTEM_ERROR,details:P.KEY_SYSTEM_NO_ACCESS,error:e,fatal:!0},e.message))}))};s(t)}))}requestMediaKeySystemAccess(t,e){const{requestMediaKeySystemAccessFunc:r}=this.config;if("function"!=typeof r){let t=`Configured requestMediaKeySystemAccess is not a function ${r}`;return null===gt&&"http:"===self.location.protocol&&(t=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(t))}return r(t,e)}getMediaKeysPromise(t,e,r){const n=function(t,e,r,n){let i;switch(t){case rt.FAIRPLAY:i=["cenc","sinf"];break;case rt.WIDEVINE:case rt.PLAYREADY:i=["cenc"];break;case rt.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${t}`)}return function(t,e,r,n){return[{initDataTypes:t,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:e.map((t=>({contentType:`audio/mp4; codecs="${t}"`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null}))),videoCapabilities:r.map((t=>({contentType:`video/mp4; codecs="${t}"`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null})))}]}(i,e,r,n)}(t,e,r,this.config.drmSystemOptions),i=this.keySystemAccessPromises[t];let s=null==i?void 0:i.keySystemAccess;if(!s){this.log(`Requesting encrypted media "${t}" key-system access with config: ${JSON.stringify(n)}`),s=this.requestMediaKeySystemAccess(t,n);const e=this.keySystemAccessPromises[t]={keySystemAccess:s};return s.catch((e=>{this.log(`Failed to obtain access to key-system "${t}": ${e}`)})),s.then((r=>{this.log(`Access for key-system "${r.keySystem}" obtained`);const n=this.fetchServerCertificate(t);return this.log(`Create media-keys for "${t}"`),e.mediaKeys=r.createMediaKeys().then((e=>(this.log(`Media-keys created for "${t}"`),n.then((r=>r?this.setMediaKeysServerCertificate(e,t,r):e))))),e.mediaKeys.catch((e=>{this.error(`Failed to create media-keys for "${t}"}: ${e}`)})),e.mediaKeys}))}return s.then((()=>i.mediaKeys))}createMediaKeySessionContext({decryptdata:t,keySystem:e,mediaKeys:r}){this.log(`Creating key-system session "${e}" keyId: ${Mt(t.keyId||[])}`);const n=r.createSession(),i={decryptdata:t,keySystem:e,mediaKeys:r,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(i),i}renewKeySession(t){const e=t.decryptdata;if(e.pssh){const r=this.createMediaKeySessionContext(t),n=this.getKeyIdString(e),i="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(r,i,e.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(t)}getKeyIdString(t){if(!t)throw new Error("Could not read keyId of undefined decryptdata");if(null===t.keyId)throw new Error("keyId is null");return Mt(t.keyId)}updateKeySession(t,e){var r;const n=t.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyID ${Mt((null==(r=t.decryptdata)?void 0:r.keyId)||[])}\n } (data length: ${e?e.byteLength:e})`),n.update(e)}selectKeySystemFormat(t){const e=Object.keys(t.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${t.sn} ${t.type}: ${t.level}) key formats ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)),this.keyFormatPromise}getKeyFormatPromise(t){return new Promise(((e,r)=>{const n=pt(this.config),i=t.map(ot).filter((t=>!!t&&-1!==n.indexOf(t)));return this.getKeySystemSelectionPromise(i).then((({keySystem:t})=>{const n=ft(t);n?e(n):r(new Error(`Unable to find format for key-system "${t}"`))})).catch(r)}))}loadKey(t){const e=t.keyInfo.decryptdata,r=this.getKeyIdString(e),n=`(keyId: ${r} format: "${e.keyFormat}" method: ${e.method} uri: ${e.uri})`;this.log(`Starting session for key ${n}`);let i=this.keyIdToKeySessionPromise[r];return i||(i=this.keyIdToKeySessionPromise[r]=this.getKeySystemForKeyPromise(e).then((({keySystem:r,mediaKeys:i})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${t.frag.sn} ${t.frag.type}: ${t.frag.level} using key ${n}`),this.attemptSetMediaKeys(r,i).then((()=>{this.throwIfDestroyed();const t=this.createMediaKeySessionContext({keySystem:r,mediaKeys:i,decryptdata:e});return this.generateRequestWithPreferredKeySession(t,"cenc",e.pssh,"playlist-key")}))))),i.catch((t=>this.handleError(t)))),i}throwIfDestroyed(t="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(t){this.hls&&(this.error(t.message),t instanceof Js?this.hls.trigger(I.ERROR,t.data):this.hls.trigger(I.ERROR,{type:x.KEY_SYSTEM_ERROR,details:P.KEY_SYSTEM_NO_KEYS,error:t,fatal:!0}))}getKeySystemForKeyPromise(t){const e=this.getKeyIdString(t),r=this.keyIdToKeySessionPromise[e];if(!r){const e=ot(t.keyFormat),r=e?[e]:pt(this.config);return this.attemptKeySystemAccess(r)}return r}getKeySystemSelectionPromise(t){if(t.length||(t=pt(this.config)),0===t.length)throw new Js({type:x.KEY_SYSTEM_ERROR,details:P.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(t)}_onMediaEncrypted(t){const{initDataType:e,initData:r}=t,n=`"${t.type}" event: init data type: "${e}"`;if(this.debug(n),null===r)return;let i,s;if("sinf"===e&&this.config.drmSystems[rt.FAIRPLAY]){const t=Ut(new Uint8Array(r));try{const e=J(JSON.parse(t).sinf),r=Jt(new Uint8Array(e));if(!r)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");i=r.subarray(8,24),s=rt.FAIRPLAY}catch(t){return void this.warn(`${n} Failed to parse sinf: ${t}`)}}else{const t=function(t){const e=[];if(t instanceof ArrayBuffer){const r=t.byteLength;let n=0;for(;n+32<r;){const r=ae(new DataView(t,n));e.push(r),n+=r.size}}return e}(r),e=t.filter((t=>t.systemId===ht))[0];if(!e)return void(0===t.length||t.some((t=>!t.systemId))?this.warn(`${n} contains incomplete or invalid pssh data`):this.log(`ignoring ${n} for ${t.map((t=>dt(t.systemId))).join(",")} pssh data in favor of playlist keys`));if(s=dt(e.systemId),0===e.version&&e.data){const t=e.data.length-22;i=e.data.subarray(t,t+16)}}if(!s||!i)return;const a=Mt(i),{keyIdToKeySessionPromise:o,mediaKeySessions:l}=this;let c=o[a];for(let t=0;t<l.length;t++){const n=l[t],s=n.decryptdata;if(!s.keyId)continue;const u=Mt(s.keyId);if(a===u||-1!==s.uri.replace(/-/g,"").indexOf(a)){if(c=o[u],s.pssh)break;delete o[u],s.pssh=new Uint8Array(r),s.keyId=i,c=o[a]=c.then((()=>this.generateRequestWithPreferredKeySession(n,e,r,"encrypted-event-key-match")));break}}c||(c=o[a]=this.getKeySystemSelectionPromise([s]).then((({keySystem:t,mediaKeys:n})=>{var s;this.throwIfDestroyed();const o=new le("ISO-23001-7",a,null!=(s=ft(t))?s:"");return o.pssh=new Uint8Array(r),o.keyId=i,this.attemptSetMediaKeys(t,n).then((()=>{this.throwIfDestroyed();const i=this.createMediaKeySessionContext({decryptdata:o,keySystem:t,mediaKeys:n});return this.generateRequestWithPreferredKeySession(i,e,r,"encrypted-event-no-match")}))}))),c.catch((t=>this.handleError(t)))}_onWaitingForKey(t){this.log(`"${t.type}" event`)}attemptSetMediaKeys(t,e){const r=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${t}"`);const n=Promise.all(r).then((()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(e)}));return this.setMediaKeysQueue.push(n),n.then((()=>{this.log(`Media-keys set for "${t}"`),r.push(n),this.setMediaKeysQueue=this.setMediaKeysQueue.filter((t=>-1===r.indexOf(t)))}))}generateRequestWithPreferredKeySession(t,e,r,n){var i,s;const a=null==(i=this.config.drmSystems)||null==(s=i[t.keySystem])?void 0:s.generateRequest;if(a)try{const n=a.call(this.hls,e,r,t);if(!n)throw new Error("Invalid response from configured generateRequest filter");e=n.initDataType,r=t.decryptdata.pssh=n.initData?new Uint8Array(n.initData):null}catch(t){var o;if(this.warn(t.message),null!=(o=this.hls)&&o.config.debug)throw t}if(null===r)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(t);const l=this.getKeyIdString(t.decryptdata);this.log(`Generating key-session request for "${n}": ${l} (init data type: ${e} length: ${r?r.byteLength:null})`);const c=new Wi,u=t._onmessage=e=>{const r=t.mediaKeysSession;if(!r)return void c.emit("error",new Error("invalid state"));const{messageType:n,message:i}=e;this.log(`"${n}" message event for session "${r.sessionId}" message size: ${i.byteLength}`),"license-request"===n||"license-renewal"===n?this.renewLicense(t,i).catch((t=>{this.handleError(t),c.emit("error",t)})):"license-release"===n?t.keySystem===rt.FAIRPLAY&&(this.updateKeySession(t,tt("acknowledged")),this.removeSession(t)):this.warn(`unhandled media key message type "${n}"`)},h=t._onkeystatuseschange=e=>{if(!t.mediaKeysSession)return void c.emit("error",new Error("invalid state"));this.onKeyStatusChange(t);const r=t.keyStatus;c.emit("keyStatus",r),"expired"===r&&(this.warn(`${t.keySystem} expired for key ${l}`),this.renewKeySession(t))};t.mediaKeysSession.addEventListener("message",u),t.mediaKeysSession.addEventListener("keystatuseschange",h);const d=new Promise(((t,e)=>{c.on("error",e),c.on("keyStatus",(r=>{r.startsWith("usable")?t():"output-restricted"===r?e(new Js({type:x.KEY_SYSTEM_ERROR,details:P.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===r?e(new Js({type:x.KEY_SYSTEM_ERROR,details:P.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${r}"`)):"expired"===r?e(new Error("key expired while generating request")):this.warn(`unhandled key status change "${r}"`)}))}));return t.mediaKeysSession.generateRequest(e,r).then((()=>{var e;this.log(`Request generated for key-session "${null==(e=t.mediaKeysSession)?void 0:e.sessionId}" keyId: ${l}`)})).catch((t=>{throw new Js({type:x.KEY_SYSTEM_ERROR,details:P.KEY_SYSTEM_NO_SESSION,error:t,fatal:!1},`Error generating key-session request: ${t}`)})).then((()=>d)).catch((e=>{throw c.removeAllListeners(),this.removeSession(t),e})).then((()=>(c.removeAllListeners(),t)))}onKeyStatusChange(t){t.mediaKeysSession.keyStatuses.forEach(((e,r)=>{this.log(`key status change "${e}" for keyStatuses keyId: ${Mt("buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r))} session keyId: ${Mt(new Uint8Array(t.decryptdata.keyId||[]))} uri: ${t.decryptdata.uri}`),t.keyStatus=e}))}fetchServerCertificate(t){const e=this.config,r=new(0,e.loader)(e),n=this.getServerCertificateUrl(t);return n?(this.log(`Fetching server certificate for "${t}"`),new Promise(((i,s)=>{const a={responseType:"arraybuffer",url:n},o=e.certLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(t,e,r,n)=>{i(t.data)},onError:(e,r,i,o)=>{s(new Js({type:x.KEY_SYSTEM_ERROR,details:P.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:i,response:_({url:a.url,data:void 0},e)},`"${t}" certificate request failed (${n}). Status: ${e.code} (${e.text})`))},onTimeout:(e,r,i)=>{s(new Js({type:x.KEY_SYSTEM_ERROR,details:P.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:i,response:{url:a.url,data:void 0}},`"${t}" certificate request timed out (${n})`))},onAbort:(t,e,r)=>{s(new Error("aborted"))}};r.load(a,l,c)}))):Promise.resolve()}setMediaKeysServerCertificate(t,e,r){return new Promise(((n,i)=>{t.setServerCertificate(r).then((i=>{this.log(`setServerCertificate ${i?"success":"not supported by CDM"} (${null==r?void 0:r.byteLength}) on "${e}"`),n(t)})).catch((t=>{i(new Js({type:x.KEY_SYSTEM_ERROR,details:P.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:t,fatal:!0},t.message))}))}))}renewLicense(t,e){return this.requestLicense(t,new Uint8Array(e)).then((e=>this.updateKeySession(t,new Uint8Array(e)).catch((t=>{throw new Js({type:x.KEY_SYSTEM_ERROR,details:P.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:t,fatal:!0},t.message)}))))}unpackPlayReadyKeyMessage(t,e){const r=String.fromCharCode.apply(null,new Uint16Array(e.buffer));if(!r.includes("PlayReadyKeyMessage"))return t.setRequestHeader("Content-Type","text/xml; charset=utf-8"),e;const n=(new DOMParser).parseFromString(r,"application/xml"),i=n.querySelectorAll("HttpHeader");if(i.length>0){let e;for(let r=0,n=i.length;r<n;r++){var s,a;e=i[r];const n=null==(s=e.querySelector("name"))?void 0:s.textContent,o=null==(a=e.querySelector("value"))?void 0:a.textContent;n&&o&&t.setRequestHeader(n,o)}}const o=n.querySelector("Challenge"),l=null==o?void 0:o.textContent;if(!l)throw new Error("Cannot find <Challenge> in key message");return tt(atob(l))}setupLicenseXHR(t,e,r,n){const i=this.config.licenseXhrSetup;return i?Promise.resolve().then((()=>{if(!r.decryptdata)throw new Error("Key removed");return i.call(this.hls,t,e,r,n)})).catch((s=>{if(!r.decryptdata)throw s;return t.open("POST",e,!0),i.call(this.hls,t,e,r,n)})).then((r=>{t.readyState||t.open("POST",e,!0);return{xhr:t,licenseChallenge:r||n}})):(t.open("POST",e,!0),Promise.resolve({xhr:t,licenseChallenge:n}))}requestLicense(t,e){const r=this.config.keyLoadPolicy.default;return new Promise(((n,i)=>{const s=this.getLicenseServerUrl(t.keySystem);this.log(`Sending license request to URL: ${s}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!t.mediaKeysSession)return i(new Error("invalid state"));if(4===a.readyState)if(200===a.status){this._requestLicenseFailureCount=0;let e=a.response;this.log(`License received ${e instanceof ArrayBuffer?e.byteLength:e}`);const r=this.config.licenseResponseCallback;if(r)try{e=r.call(this.hls,a,s,t)}catch(t){this.error(t)}n(e)}else{const o=r.errorRetry,l=o?o.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)i(new Js({type:x.KEY_SYSTEM_ERROR,details:P.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:s,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${s}). Status: ${a.status} (${a.statusText})`));else{const r=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${r} attempts left`),this.requestLicense(t,e).then(n,i)}}},t.licenseXhr&&t.licenseXhr.readyState!==XMLHttpRequest.DONE&&t.licenseXhr.abort(),t.licenseXhr=a,this.setupLicenseXHR(a,s,t,e).then((({xhr:e,licenseChallenge:r})=>{t.keySystem==rt.PLAYREADY&&(r=this.unpackPlayReadyKeyMessage(e,r)),e.send(r)}))}))}onMediaAttached(t,e){if(!this.config.emeEnabled)return;const r=e.media;this.media=r,r.addEventListener("encrypted",this.onMediaEncrypted),r.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const t=this.media,e=this.mediaKeySessions;t&&(t.removeEventListener("encrypted",this.onMediaEncrypted),t.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},le.clearKeyUriToKeyIdMap();const r=e.length;Qs.CDMCleanupPromise=Promise.all(e.map((t=>this.removeSession(t))).concat(null==t?void 0:t.setMediaKeys(null).catch((t=>{this.log(`Could not clear media keys: ${t}`)})))).then((()=>{r&&(this.log("finished closing key sessions and clearing media keys"),e.length=0)})).catch((t=>{this.log(`Could not close sessions and clear media keys: ${t}`)}))}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(t,{sessionKeys:e}){if(e&&this.config.emeEnabled&&!this.keyFormatPromise){const t=e.reduce(((t,e)=>(-1===t.indexOf(e.keyFormat)&&t.push(e.keyFormat),t)),[]);this.log(`Selecting key-system from session-keys ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)}}removeSession(t){const{mediaKeysSession:e,licenseXhr:r}=t;if(e){this.log(`Remove licenses and keys and close session ${e.sessionId}`),t._onmessage&&(e.removeEventListener("message",t._onmessage),t._onmessage=void 0),t._onkeystatuseschange&&(e.removeEventListener("keystatuseschange",t._onkeystatuseschange),t._onkeystatuseschange=void 0),r&&r.readyState!==XMLHttpRequest.DONE&&r.abort(),t.mediaKeysSession=t.decryptdata=t.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(t);return n>-1&&this.mediaKeySessions.splice(n,1),e.remove().catch((t=>{this.log(`Could not remove session: ${t}`)})).then((()=>e.close())).catch((t=>{this.log(`Could not close session: ${t}`)}))}}}Qs.CDMCleanupPromise=void 0;class Js extends Error{constructor(t,e){super(e),this.data=void 0,t.error||(t.error=new Error(e)),this.data=t,t.err=t.error}}var Zs,ta,ea;!function(t){t.MANIFEST="m",t.AUDIO="a",t.VIDEO="v",t.MUXED="av",t.INIT="i",t.CAPTION="c",t.TIMED_TEXT="tt",t.KEY="k",t.OTHER="o"}(Zs||(Zs={})),function(t){t.DASH="d",t.HLS="h",t.SMOOTH="s",t.OTHER="o"}(ta||(ta={})),function(t){t.OBJECT="CMCD-Object",t.REQUEST="CMCD-Request",t.SESSION="CMCD-Session",t.STATUS="CMCD-Status"}(ea||(ea={}));const ra={[ea.OBJECT]:["br","d","ot","tb"],[ea.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[ea.SESSION]:["cid","pr","sf","sid","st","v"],[ea.STATUS]:["bs","rtp"]};class na{constructor(t,e){this.value=void 0,this.params=void 0,Array.isArray(t)&&(t=t.map((t=>t instanceof na?t:new na(t)))),this.value=t,this.params=e}}class ia{constructor(t){this.description=void 0,this.description=t}}function sa(t,e,r,n){return new Error(`failed to ${t} "${i=e,Array.isArray(i)?JSON.stringify(i):i instanceof Map?"Map{}":i instanceof Set?"Set{}":"object"==typeof i?JSON.stringify(i):String(i)}" as ${r}`,{cause:n});var i}const aa="Bare Item";const oa=/[\x00-\x1f\x7f]+/;function la(t,e,r){return sa("serialize",t,e,r)}function ca(t){if(!1===ArrayBuffer.isView(t))throw la(t,"Byte Sequence");return`:${e=t,btoa(String.fromCharCode(...e))}:`;var e}function ua(t){if(function(t){return t<-999999999999999||999999999999999<t}(t))throw la(t,"Integer");return t.toString()}function ha(t,e){if(t<0)return-ha(-t,e);const r=Math.pow(10,e);if(Math.abs(t*r%1-.5)<Number.EPSILON){const e=Math.floor(t*r);return(e%2==0?e:e+1)/r}return Math.round(t*r)/r}function da(t){const e=ha(t,3);if(Math.floor(Math.abs(e)).toString().length>12)throw la(t,"Decimal");const r=e.toString();return r.includes(".")?r:`${r}.0`}function fa(t){const e=(r=t).description||r.toString().slice(7,-1);var r;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e))throw la(e,"Token");return e}function pa(t){switch(typeof t){case"number":if(!R(t))throw la(t,aa);return Number.isInteger(t)?ua(t):da(t);case"string":return function(t){if(oa.test(t))throw la(t,"String");return`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(t);case"symbol":return fa(t);case"boolean":return function(t){if("boolean"!=typeof t)throw la(t,"Boolean");return t?"?1":"?0"}(t);case"object":if(t instanceof Date)return function(t){return`@${ua(t.getTime()/1e3)}`}(t);if(t instanceof Uint8Array)return ca(t);if(t instanceof ia)return fa(t);default:throw la(t,aa)}}function ga(t){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(t))throw la(t,"Key");return t}function ma(t){return null==t?"":Object.entries(t).map((([t,e])=>!0===e?`;${ga(t)}`:`;${ga(t)}=${pa(e)}`)).join("")}function ya(t){return t instanceof na?`${pa(t.value)}${ma(t.params)}`:pa(t)}function va(t,e={whitespace:!0}){if("object"!=typeof t)throw la(t,"Dict");const r=t instanceof Map?t.entries():Object.entries(t),n=null!=e&&e.whitespace?" ":"";return Array.from(r).map((([t,e])=>{e instanceof na==!1&&(e=new na(e));let r=ga(t);var n;return!0===e.value?r+=ma(e.params):(r+="=",Array.isArray(e.value)?r+=`(${(n=e).value.map(ya).join(" ")})${ma(n.params)}`:r+=ya(e)),r})).join(`,${n}`)}const Ea=t=>Math.round(t),ba=t=>100*Ea(t/100),Ta={br:Ea,d:Ea,bl:ba,dl:ba,mtp:ba,nor:(t,e)=>(null!=e&&e.baseUrl&&(t=function(t,e){const r=new URL(t),n=new URL(e);if(r.origin!==n.origin)return t;const i=r.pathname.split("/").slice(1),s=n.pathname.split("/").slice(1,-1);for(;i[0]===s[0];)i.shift(),s.shift();for(;s.length;)s.shift(),i.unshift("..");return i.join("/")}(t,e.baseUrl)),encodeURIComponent(t)),rtp:ba,tb:Ea};function Sa(t,e){const r={};if(null==t||"object"!=typeof t)return r;const n=Object.keys(t).sort(),i=w({},Ta,null==e?void 0:e.formatters),s=null==e?void 0:e.filter;return n.forEach((n=>{if(null!=s&&s(n))return;let a=t[n];const o=i[n];o&&(a=o(a,e)),"v"===n&&1===a||"pr"==n&&1===a||(t=>"number"==typeof t?R(t):null!=t&&""!==t&&!1!==t)(a)&&((t=>"ot"===t||"sf"===t||"st"===t)(n)&&"string"==typeof a&&(a=new ia(a)),r[n]=a)})),r}function Aa(t,e={}){return t?function(t,e){return va(t,e)}(Sa(t,e),w({whitespace:!1},e)):""}function _a(t,e,r){return w(t,function(t,e={}){if(!t)return{};const r=Object.entries(t),n=Object.entries(ra).concat(Object.entries((null==e?void 0:e.customHeaderMap)||{})),i=r.reduce(((t,e)=>{var r;const[i,s]=e,a=(null==(r=n.find((t=>t[1].includes(i))))?void 0:r[0])||ea.REQUEST;return null!=t[a]||(t[a]={}),t[a][i]=s,t}),{});return Object.entries(i).reduce(((t,[r,n])=>(t[r]=Aa(n,e),t)),{})}(e,r))}const ka=/CMCD=[^&#]+/;function La(t,e,r){const n=function(t,e={}){if(!t)return"";const r=Aa(t,e);return`CMCD=${encodeURIComponent(r)}`}(e,r);if(!n)return t;if(ka.test(t))return t.replace(ka,n);const i=t.includes("?")?"&":"?";return`${t}${i}${n}`}function wa(t,e,r,n){t&&Object.keys(e).forEach((i=>{const s=t.filter((t=>t.groupId===i)).map((t=>{const s=w({},t);return s.details=void 0,s.attrs=new j(s.attrs),s.url=s.attrs.URI=Ra(t.url,t.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",r),s.groupId=s.attrs["GROUP-ID"]=e[i],s.attrs["PATHWAY-ID"]=n,s}));t.push(...s)}))}function Ra(t,e,r,n){const{HOST:i,PARAMS:s,[r]:a}=n;let o;e&&(o=null==a?void 0:a[e],o&&(t=o));const l=new self.URL(t);return i&&!o&&(l.host=i),s&&Object.keys(s).sort().forEach((t=>{t&&l.searchParams.set(t,s[t])})),l.href}const Ca=/^age:\s*[\d.]+\s*$/im;class Da{constructor(t){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=t&&t.xhrSetup||null,this.stats=new H,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,4!==t.readyState&&(this.stats.aborted=!0,t.abort()))}abort(){var t;this.abortInternal(),null!=(t=this.callbacks)&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(t,e,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=e,this.callbacks=r,this.loadInternal()}loadInternal(){const{config:t,context:e}=this;if(!t||!e)return;const r=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0,n.aborted=!1;const i=this.xhrSetup;i?Promise.resolve().then((()=>{if(this.loader===r&&!this.stats.aborted)return i(r,e.url)})).catch((t=>{if(this.loader===r&&!this.stats.aborted)return r.open("GET",e.url,!0),i(r,e.url)})).then((()=>{this.loader!==r||this.stats.aborted||this.openAndSendXhr(r,e,t)})).catch((t=>{this.callbacks.onError({code:r.status,text:t.message},e,r,n)})):this.openAndSendXhr(r,e,t)}openAndSendXhr(t,e,r){t.readyState||t.open("GET",e.url,!0);const n=e.headers,{maxTimeToFirstByteMs:i,maxLoadTimeMs:s}=r.loadPolicy;if(n)for(const e in n)t.setRequestHeader(e,n[e]);e.rangeEnd&&t.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),t.onreadystatechange=this.readystatechange.bind(this),t.onprogress=this.loadprogress.bind(this),t.responseType=e.responseType,self.clearTimeout(this.requestTimeout),r.timeout=i&&R(i)?i:s,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),t.send()}readystatechange(){const{context:t,loader:e,stats:r}=this;if(!t||!e)return;const n=e.readyState,i=this.config;if(!r.aborted&&n>=2&&(0===r.loading.first&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),i.timeout!==i.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),i.timeout=i.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),4===n)){self.clearTimeout(this.requestTimeout),e.onreadystatechange=null,e.onprogress=null;const n=e.status,s="text"!==e.responseType;if(n>=200&&n<300&&(s&&e.response||null!==e.responseText)){r.loading.end=Math.max(self.performance.now(),r.loading.first);const i=s?e.response:e.responseText,a="arraybuffer"===e.responseType?i.byteLength:i.length;if(r.loaded=r.total=a,r.bwEstimate=8e3*r.total/(r.loading.end-r.loading.first),!this.callbacks)return;const o=this.callbacks.onProgress;if(o&&o(r,t,i,e),!this.callbacks)return;const l={url:e.responseURL,data:i,code:n};this.callbacks.onSuccess(l,r,t,e)}else{const s=i.loadPolicy.errorRetry;Dr(s,r.retry,!1,{url:t.url,data:void 0,code:n})?this.retry(s):(N.error(`${n} while loading ${t.url}`),this.callbacks.onError({code:n,text:e.statusText},t,e,r))}}}loadtimeout(){if(!this.config)return;const t=this.config.loadPolicy.timeoutRetry;if(Dr(t,this.stats.retry,!0))this.retry(t);else{var e;N.warn(`timeout while loading ${null==(e=this.context)?void 0:e.url}`);const t=this.callbacks;t&&(this.abortInternal(),t.onTimeout(this.stats,this.context,this.loader))}}retry(t){const{context:e,stats:r}=this;this.retryDelay=Rr(t,r.retry),r.retry++,N.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==e?void 0:e.url}, retrying ${r.retry}/${t.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(t){const e=this.stats;e.loaded=t.loaded,t.lengthComputable&&(e.total=t.total)}getCacheAge(){let t=null;if(this.loader&&Ca.test(this.loader.getAllResponseHeaders())){const e=this.loader.getResponseHeader("age");t=e?parseFloat(e):null}return t}getResponseHeader(t){return this.loader&&new RegExp(`^${t}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(t):null}}const Ia=/(\d+)-(\d+)\/(\d+)/;class xa{constructor(t){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=t.fetchSetup||Pa,this.controller=new self.AbortController,this.stats=new H}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 t;this.abortInternal(),null!=(t=this.callbacks)&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(t,e,r){const n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();const i=function(t,e){const r={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(w({},t.headers))};t.rangeEnd&&r.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1));return r}(t,this.controller.signal),s=r.onProgress,a="arraybuffer"===t.responseType,o=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:c}=e.loadPolicy;this.context=t,this.config=e,this.callbacks=r,this.request=this.fetchSetup(t,i),self.clearTimeout(this.requestTimeout),e.timeout=l&&R(l)?l:c,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),r.onTimeout(n,t,this.response)}),e.timeout),self.fetch(this.request).then((i=>{this.response=this.loader=i;const o=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(this.requestTimeout),e.timeout=c,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),r.onTimeout(n,t,this.response)}),c-(o-n.loading.start)),!i.ok){const{status:t,statusText:e}=i;throw new Oa(e||"fetch, bad network response",t,i)}return n.loading.first=o,n.total=function(t){const e=t.get("Content-Range");if(e){const t=function(t){const e=Ia.exec(t);if(e)return parseInt(e[2])-parseInt(e[1])+1}(e);if(R(t))return t}const r=t.get("Content-Length");if(r)return parseInt(r)}(i.headers)||n.total,s&&R(e.highWaterMark)?this.loadProgressively(i,n,t,e.highWaterMark,s):a?i.arrayBuffer():"json"===t.responseType?i.json():i.text()})).then((i=>{const a=this.response;if(!a)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const l=i[o];l&&(n.loaded=n.total=l);const c={url:a.url,data:i,code:a.status};s&&!R(e.highWaterMark)&&s(n,t,i,a),r.onSuccess(c,n,t,a)})).catch((e=>{if(self.clearTimeout(this.requestTimeout),n.aborted)return;const i=e&&e.code||0,s=e?e.message:null;r.onError({code:i,text:s},t,e?e.details:null,n)}))}getCacheAge(){let t=null;if(this.response){const e=this.response.headers.get("age");t=e?parseFloat(e):null}return t}getResponseHeader(t){return this.response?this.response.headers.get(t):null}loadProgressively(t,e,r,n=0,i){const s=new jn,a=t.body.getReader(),o=()=>a.read().then((a=>{if(a.done)return s.dataLength&&i(e,r,s.flush(),t),Promise.resolve(new ArrayBuffer(0));const l=a.value,c=l.length;return e.loaded+=c,c<n||s.dataLength?(s.push(l),s.dataLength>=n&&i(e,r,s.flush(),t)):i(e,r,l,t),o()})).catch((()=>Promise.reject()));return o()}}function Pa(t,e){return new self.Request(t.url,e)}class Oa extends Error{constructor(t,e,r){super(t),this.code=void 0,this.details=void 0,this.code=e,this.details=r}}const Ma=/\s/,Fa={newCue(t,e,r,n){const i=[];let s,a,o,l,c;const u=self.VTTCue||self.TextTrackCue;for(let d=0;d<n.rows.length;d++)if(s=n.rows[d],o=!0,l=0,c="",!s.isEmpty()){var h;for(let t=0;t<s.chars.length;t++)Ma.test(s.chars[t].uchar)&&o?l++:(c+=s.chars[t].uchar,o=!1);s.cueStartTime=e,e===r&&(r+=1e-4),l>=16?l--:l++;const n=Cs(c.trim()),f=Os(e,r,n);null!=t&&null!=(h=t.cues)&&h.getCueById(f)||(a=new u(e,r,n),a.id=f,a.line=d+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*l/32)),i.push(a))}return t&&i.length&&(i.sort(((t,e)=>"auto"===t.line||"auto"===e.line?0:t.line>8&&e.line>8?e.line-t.line:t.line-e.line)),i.forEach((e=>Xe(t,e)))),i}},Ba=_(_({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Da,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class{constructor(t){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:t,partCurrent:e,hls:r}=this,{autoLevelEnabled:n,media:i}=r;if(!t||!i)return;const s=performance.now(),a=e?e.stats:t.stats,o=e?e.duration:t.duration,l=s-a.loading.start,c=r.minAutoLevel;if(a.aborted||a.loaded&&a.loaded===a.total||t.level<=c)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!n||i.paused||!i.playbackRate||!i.readyState)return;const u=r.mainForwardBufferInfo;if(null===u)return;const h=this.bwEstimator.getEstimateTTFB(),d=Math.abs(i.playbackRate);if(l<=Math.max(h,o/(2*d)*1e3))return;const f=u.len/d,p=a.loading.first?a.loading.first-a.loading.start:-1,g=a.loaded&&p>-1,m=this.getBwEstimate(),y=r.levels,v=y[t.level],E=a.total||Math.max(a.loaded,Math.round(o*v.averageBitrate/8));let b=g?l-p:l;b<1&&g&&(b=Math.min(l,8*a.loaded/m));const T=g?1e3*a.loaded/b:0,S=T?(E-a.loaded)/T:8*E/m+h/1e3;if(S<=f)return;const A=T?8*T:m;let _,k=Number.POSITIVE_INFINITY;for(_=t.level-1;_>c;_--){const t=y[_].maxBitrate;if(k=this.getTimeToLoadFrag(h/1e3,A,o*t,!y[_].details),k<f)break}if(k>=S)return;if(k>10*o)return;r.nextLoadLevel=r.nextAutoLevel=_,g?this.bwEstimator.sample(l-Math.min(h,p),a.loaded):this.bwEstimator.sampleTTFB(l);const L=y[_].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>L&&this.resetEstimator(L),this.clearTimer(),N.warn(`[abr] Fragment ${t.sn}${e?" part "+e.index:""} of level ${t.level} is loading too slowly;\n Time to underbuffer: ${f.toFixed(3)} s\n Estimated load time for current fragment: ${S.toFixed(3)} s\n Estimated load time for down switch fragment: ${k.toFixed(3)} s\n TTFB estimate: ${0|p} ms\n Current BW estimate: ${R(m)?0|m:"Unknown"} bps\n New BW estimate: ${0|this.getBwEstimate()} bps\n Switching to level ${_} @ ${0|L} bps`),r.trigger(I.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:e,stats:a})},this.hls=t,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(t){t&&(N.log(`setting initial bwe to ${t}`),this.hls.config.abrEwmaDefaultEstimate=t),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const t=this.hls.config;return new Hr(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate)}registerListeners(){const{hls:t}=this;t.on(I.MANIFEST_LOADING,this.onManifestLoading,this),t.on(I.FRAG_LOADING,this.onFragLoading,this),t.on(I.FRAG_LOADED,this.onFragLoaded,this),t.on(I.FRAG_BUFFERED,this.onFragBuffered,this),t.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(I.LEVEL_LOADED,this.onLevelLoaded,this),t.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(I.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t&&(t.off(I.MANIFEST_LOADING,this.onManifestLoading,this),t.off(I.FRAG_LOADING,this.onFragLoading,this),t.off(I.FRAG_LOADED,this.onFragLoaded,this),t.off(I.FRAG_BUFFERED,this.onFragBuffered,this),t.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(I.LEVEL_LOADED,this.onLevelLoaded,this),t.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(I.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.off(I.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(t,e){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(t,e){const r=e.frag;if(!this.ignoreFragment(r)){var n;if(!r.bitrateTest)this.fragCurrent=r,this.partCurrent=null!=(n=e.part)?n:null;this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(t,e){this.clearTimer()}onError(t,e){if(!e.fatal)switch(e.details){case P.BUFFER_ADD_CODEC_ERROR:case P.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case P.FRAG_LOAD_TIMEOUT:{const t=e.frag,{fragCurrent:r,partCurrent:n}=this;if(t&&r&&t.sn===r.sn&&t.level===r.level){const e=performance.now(),r=n?n.stats:t.stats,i=e-r.loading.start,s=r.loading.first?r.loading.first-r.loading.start:-1;if(r.loaded&&s>-1){const t=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(i-Math.min(t,s),r.loaded)}else this.bwEstimator.sampleTTFB(i)}break}}}getTimeToLoadFrag(t,e,r,n){return t+r/e+(n?this.lastLevelLoadSec:0)}onLevelLoaded(t,e){const r=this.hls.config,{loading:n}=e.stats,i=n.end-n.start;R(i)&&(this.lastLevelLoadSec=i/1e3),e.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD)}onFragLoaded(t,{frag:e,part:r}){const n=r?r.stats:e.stats;if(e.type===Ke&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(e)){if(this.clearTimer(),e.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const t=r?r.duration:e.duration,i=this.hls.levels[e.level],s=(i.loaded?i.loaded.bytes:0)+n.loaded,a=(i.loaded?i.loaded.duration:0)+t;i.loaded={bytes:s,duration:a},i.realBitrate=Math.round(8*s/a)}if(e.bitrateTest){const t={stats:n,frag:e,part:r,id:e.type};this.onFragBuffered(I.FRAG_BUFFERED,t),e.bitrateTest=!1}else this.lastLoadedFragLevel=e.level}}onFragBuffered(t,e){const{frag:r,part:n}=e,i=null!=n&&n.stats.loaded?n.stats:r.stats;if(i.aborted)return;if(this.ignoreFragment(r))return;const s=i.parsing.end-i.loading.start-Math.min(i.loading.first-i.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(s,i.loaded),i.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=s/1e3:this.bitrateTestDelay=0}ignoreFragment(t){return t.type!==Ke||"initSegment"===t.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:t,minAutoLevel:e}=this.hls,r=this.getBwEstimate(),n=this.hls.config.maxStarvationDelay,i=this.findBestLevel(r,e,t,0,n,1,1);if(i>-1)return i;const s=this.hls.firstLevel,a=Math.min(Math.max(s,e),t);return N.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${s} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const t=this.forcedAutoLevel,e=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(!(-1===t||e&&r&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return t;const n=e&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==t){const e=this.hls.levels;if(e.length>Math.max(t,n)&&e[t].loadError<=e[n].loadError)return t}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:t,partCurrent:e,hls:r}=this,{maxAutoLevel:n,config:i,minAutoLevel:s}=r,a=e?e.duration:t?t.duration:0,o=this.getBwEstimate(),l=this.getStarvationDelay();let c=i.abrBandWidthFactor,u=i.abrBandWidthUpFactor;if(l){const t=this.findBestLevel(o,s,n,l,0,c,u);if(t>=0)return t}let h=a?Math.min(a,i.maxStarvationDelay):i.maxStarvationDelay;if(!l){const t=this.bitrateTestDelay;if(t){h=(a?Math.min(a,i.maxLoadingDelay):i.maxLoadingDelay)-t,N.info(`[abr] bitrate test took ${Math.round(1e3*t)}ms, set first fragment max fetchDuration to ${Math.round(1e3*h)} ms`),c=u=1}}const d=this.findBestLevel(o,s,n,l,h,c,u);if(N.info(`[abr] ${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${d}`),d>-1)return d;const f=r.levels[s],p=r.levels[r.loadLevel];return(null==f?void 0:f.bitrate)<(null==p?void 0:p.bitrate)?s:r.loadLevel}getStarvationDelay(){const t=this.hls,e=t.media;if(!e)return 1/0;const r=e&&0!==e.playbackRate?Math.abs(e.playbackRate):1,n=t.mainForwardBufferInfo;return(n?n.len:0)/r}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(t,e,r,n,i,s,a){var o;const l=n+i,c=this.lastLoadedFragLevel,u=-1===c?this.hls.firstLevel:c,{fragCurrent:h,partCurrent:d}=this,{levels:f,allAudioTracks:p,loadLevel:g,config:m}=this.hls;if(1===f.length)return 0;const y=f[u],v=!(null==y||null==(o=y.details)||!o.live),E=-1===g||-1===c;let b,T="SDR",S=(null==y?void 0:y.frameRate)||0;const{audioPreference:A,videoPreference:_}=m,k=this.audioTracksByGroup||(this.audioTracksByGroup=function(t){return t.reduce(((t,e)=>{let r=t.groups[e.groupId];r||(r=t.groups[e.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),r.tracks.push(e);const n=e.channels||"2";return r.channels[n]=(r.channels[n]||0)+1,r.hasDefault=r.hasDefault||e.default,r.hasAutoSelect=r.hasAutoSelect||e.autoselect,r.hasDefault&&(t.hasDefaultAudio=!0),r.hasAutoSelect&&(t.hasAutoSelectAudio=!0),t}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}(p));if(E){if(-1!==this.firstSelection)return this.firstSelection;const n=this.codecTiers||(this.codecTiers=function(t,e,r,n){return t.slice(r,n+1).reduce(((t,r)=>{if(!r.codecSet)return t;const n=r.audioGroups;let i=t[r.codecSet];i||(t[r.codecSet]=i={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!n,fragmentError:0}),i.minBitrate=Math.min(i.minBitrate,r.bitrate);const s=Math.min(r.height,r.width);return i.minHeight=Math.min(i.minHeight,s),i.minFramerate=Math.min(i.minFramerate,r.frameRate),i.maxScore=Math.max(i.maxScore,r.score),i.fragmentError+=r.fragmentError,i.videoRanges[r.videoRange]=(i.videoRanges[r.videoRange]||0)+1,n&&n.forEach((t=>{if(!t)return;const r=e.groups[t];r&&(i.hasDefaultAudio=i.hasDefaultAudio||e.hasDefaultAudio?r.hasDefault:r.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(r.channels).forEach((t=>{i.channels[t]=(i.channels[t]||0)+r.channels[t]})))})),t}),{})}(f,k,e,r)),i=function(t,e,r,n,i){const s=Object.keys(t),a=null==n?void 0:n.channels,o=null==n?void 0:n.audioCodec,l=a&&2===parseInt(a);let c=!0,u=!1,h=1/0,d=1/0,f=1/0,p=0,g=[];const{preferHDR:m,allowedVideoRanges:y}=zr(e,i);for(let e=s.length;e--;){const r=t[s[e]];c=r.channels[2]>0,h=Math.min(h,r.minHeight),d=Math.min(d,r.minFramerate),f=Math.min(f,r.minBitrate);const n=y.filter((t=>r.videoRanges[t]>0));n.length>0&&(u=!0,g=n)}h=R(h)?h:0,d=R(d)?d:0;const v=Math.max(1080,h),E=Math.max(30,d);return f=R(f)?f:r,r=Math.max(f,r),u||(e=void 0,g=[]),{codecSet:s.reduce(((e,n)=>{const i=t[n];if(n===e)return e;if(i.minBitrate>r)return Xr(n,`min bitrate of ${i.minBitrate} > current estimate of ${r}`),e;if(!i.hasDefaultAudio)return Xr(n,"no renditions with default or auto-select sound found"),e;if(o&&n.indexOf(o.substring(0,4))%5!=0)return Xr(n,`audio codec preference "${o}" not found`),e;if(a&&!l){if(!i.channels[a])return Xr(n,`no renditions with ${a} channel sound found (channels options: ${Object.keys(i.channels)})`),e}else if((!o||l)&&c&&0===i.channels[2])return Xr(n,"no renditions with stereo sound found"),e;return i.minHeight>v?(Xr(n,`min resolution of ${i.minHeight} > maximum of ${v}`),e):i.minFramerate>E?(Xr(n,`min framerate of ${i.minFramerate} > maximum of ${E}`),e):g.some((t=>i.videoRanges[t]>0))?i.maxScore<p?(Xr(n,`max score of ${i.maxScore} < selected max of ${p}`),e):e&&(Te(n)>=Te(e)||i.fragmentError>t[e].fragmentError)?e:(p=i.maxScore,n):(Xr(n,`no variants with VIDEO-RANGE of ${JSON.stringify(g)} found`),e)}),void 0),videoRanges:g,preferHDR:m,minFramerate:d,minBitrate:f}}(n,T,t,A,_),{codecSet:s,videoRanges:a,minFramerate:o,minBitrate:l,preferHDR:c}=i;b=s,T=c?a[a.length-1]:a[0],S=o,t=Math.max(t,l),N.log(`[abr] picked start tier ${JSON.stringify(i)}`)}else b=null==y?void 0:y.codecSet,T=null==y?void 0:y.videoRange;const L=d?d.duration:h?h.duration:0,w=this.bwEstimator.getEstimateTTFB()/1e3,C=[];for(let o=r;o>=e;o--){var D;const e=f[o],h=o>u;if(!e)continue;if(m.useMediaCapabilities&&!e.supportedResult&&!e.supportedPromise){const r=navigator.mediaCapabilities;"function"==typeof(null==r?void 0:r.decodingInfo)&&Yr(e,k,T,S,t,A)?(e.supportedPromise=qr(e,k,r),e.supportedPromise.then((t=>{if(!this.hls)return;e.supportedResult=t;const r=this.hls.levels,n=r.indexOf(e);t.error?N.warn(`[abr] MediaCapabilities decodingInfo error: "${t.error}" for level ${n} ${JSON.stringify(t)}`):t.supported||(N.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${n} ${JSON.stringify(t)}`),n>-1&&r.length>1&&(N.log(`[abr] Removing unsupported level ${n}`),this.hls.removeLevel(n)))}))):e.supportedResult=Vr}if(b&&e.codecSet!==b||T&&e.videoRange!==T||h&&S>e.frameRate||!h&&S>0&&S<e.frameRate||e.supportedResult&&(null==(D=e.supportedResult.decodingInfoResults)||!D[0].smooth)){C.push(o);continue}const p=e.details,_=(d?null==p?void 0:p.partTarget:null==p?void 0:p.averagetargetduration)||L;let I;I=h?a*t:s*t;const x=L&&n>=2*L&&0===i?f[o].averageBitrate:f[o].maxBitrate,P=this.getTimeToLoadFrag(w,I,x*_,void 0===p);if(I>=x&&(o===c||0===e.loadError&&0===e.fragmentError)&&(P<=w||!R(P)||v&&!this.bitrateTestDelay||P<l)){const t=this.forcedAutoLevel;return o===g||-1!==t&&t===g||(C.length&&N.trace(`[abr] Skipped level(s) ${C.join(",")} of ${r} max with CODECS and VIDEO-RANGE:"${f[C[0]].codecs}" ${f[C[0]].videoRange}; not compatible with "${y.codecs}" ${T}`),N.info(`[abr] switch candidate:${u}->${o} adjustedbw(${Math.round(I)})-bitrate=${Math.round(I-x)} ttfb:${w.toFixed(1)} avgDuration:${_.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${P.toFixed(1)} firstSelection:${E} codecSet:${b} videoRange:${T} hls.loadLevel:${g}`)),E&&(this.firstSelection=o),o}}return-1}set nextAutoLevel(t){const{maxAutoLevel:e,minAutoLevel:r}=this.hls,n=Math.min(Math.max(t,r),e);this._nextAutoLevel!==n&&(this.nextAutoLevelKey="",this._nextAutoLevel=n)}},bufferController:class{constructor(t){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=t=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=t=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:t,mediaSource:e}=this;this.log("Media source opened"),t&&(t.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(I.MEDIA_ATTACHED,{media:t,mediaSource:e})),e&&e.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:t,_objectUrl:e}=this;t!==e&&N.error(`Media element src was set while attaching MediaSource (${e} > ${t})`)},this.hls=t;const e="[buffer-controller]";var r;this.appendSource=(r=ge(t.config.preferManagedMediaSource),"undefined"!=typeof self&&r===self.ManagedMediaSource),this.log=N.log.bind(N,e),this.warn=N.warn.bind(N,e),this.error=N.error.bind(N,e),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:t}=this;t.on(I.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(I.MANIFEST_LOADING,this.onManifestLoading,this),t.on(I.MANIFEST_PARSED,this.onManifestParsed,this),t.on(I.BUFFER_RESET,this.onBufferReset,this),t.on(I.BUFFER_APPENDING,this.onBufferAppending,this),t.on(I.BUFFER_CODECS,this.onBufferCodecs,this),t.on(I.BUFFER_EOS,this.onBufferEos,this),t.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(I.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(I.FRAG_PARSED,this.onFragParsed,this),t.on(I.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:t}=this;t.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(I.MANIFEST_LOADING,this.onManifestLoading,this),t.off(I.MANIFEST_PARSED,this.onManifestParsed,this),t.off(I.BUFFER_RESET,this.onBufferReset,this),t.off(I.BUFFER_APPENDING,this.onBufferAppending,this),t.off(I.BUFFER_CODECS,this.onBufferCodecs,this),t.off(I.BUFFER_EOS,this.onBufferEos,this),t.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(I.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(I.FRAG_PARSED,this.onFragParsed,this),t.off(I.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new Ji(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(t,e){let r=2;(e.audio&&!e.video||!e.altAudio)&&(r=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=r,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(t,e){const r=this.media=e.media,n=ge(this.appendSource);if(r&&n){var i;const t=this.mediaSource=new n;this.log(`created media source: ${null==(i=t.constructor)?void 0:i.name}`),t.addEventListener("sourceopen",this._onMediaSourceOpen),t.addEventListener("sourceended",this._onMediaSourceEnded),t.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.addEventListener("startstreaming",this._onStartStreaming),t.addEventListener("endstreaming",this._onEndStreaming));const e=this._objectUrl=self.URL.createObjectURL(t);if(this.appendSource)try{r.removeAttribute("src");const n=self.ManagedMediaSource;r.disableRemotePlayback=r.disableRemotePlayback||n&&t instanceof n,ts(r),function(t,e){const r=self.document.createElement("source");r.type="video/mp4",r.src=e,t.appendChild(r)}(r,e),r.load()}catch(t){r.src=e}else r.src=e;r.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:t,mediaSource:e,_objectUrl:r}=this;if(e){if(this.log("media source detaching"),"open"===e.readyState)try{e.endOfStream()}catch(t){this.warn(`onMediaDetaching: ${t.message} while calling endOfStream`)}this.onBufferReset(),e.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("sourceended",this._onMediaSourceEnded),e.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.removeEventListener("startstreaming",this._onStartStreaming),e.removeEventListener("endstreaming",this._onEndStreaming)),t&&(t.removeEventListener("emptied",this._onMediaEmptied),r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(t.removeAttribute("src"),this.appendSource&&ts(t),t.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(I.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach((t=>{this.resetBuffer(t)})),this._initSourceBuffer()}resetBuffer(t){const e=this.sourceBuffer[t];try{var r;if(e)this.removeBufferListeners(t),this.sourceBuffer[t]=void 0,null!=(r=this.mediaSource)&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(e)}catch(e){this.warn(`onBufferReset ${t}`,e)}}onBufferCodecs(t,e){const r=this.getSourceBufferTypes().length,n=Object.keys(e);if(n.forEach((t=>{if(r){const r=this.tracks[t];if(r&&"function"==typeof r.buffer.changeType){var n;const{id:i,codec:s,levelCodec:a,container:o,metadata:l}=e[t],c=ke(r.codec,r.levelCodec),u=null==c?void 0:c.replace(Zi,"$1");let h=ke(s,a);const d=null==(n=h)?void 0:n.replace(Zi,"$1");if(h&&u!==d){"audio"===t.slice(0,5)&&(h=_e(h,this.appendSource));const e=`${o};codecs=${h}`;this.appendChangeType(t,e),this.log(`switching codec ${c} to ${h}`),this.tracks[t]={buffer:r.buffer,codec:s,container:o,levelCodec:a,metadata:l,id:i}}}}else this.pendingTracks[t]=e[t]})),r)return;const i=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==i&&(this.log(`${i} bufferCodec event(s) expected ${n.join(",")}`),this.bufferCodecEventsExpected=i),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}appendChangeType(t,e){const{operationQueue:r}=this,n={execute:()=>{const n=this.sourceBuffer[t];n&&(this.log(`changing ${t} sourceBuffer type to ${e}`),n.changeType(e)),r.shiftAndExecuteNext(t)},onStart:()=>{},onComplete:()=>{},onError:e=>{this.warn(`Failed to change ${t} SourceBuffer type`,e)}};r.append(n,t,!!this.pendingTracks[t])}onBufferAppending(t,e){const{hls:r,operationQueue:n,tracks:i}=this,{data:s,type:a,frag:o,part:l,chunkMeta:c}=e,u=c.buffering[a],h=self.performance.now();u.start=h;const d=o.stats.buffering,f=l?l.stats.buffering:null;0===d.start&&(d.start=h),f&&0===f.start&&(f.start=h);const p=i.audio;let g=!1;"audio"===a&&"audio/mpeg"===(null==p?void 0:p.container)&&(g=!this.lastMpegAudioChunk||1===c.id||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const m=o.start,y={execute:()=>{if(u.executeStart=self.performance.now(),g){const t=this.sourceBuffer[a];if(t){const e=m-t.timestampOffset;Math.abs(e)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${m} (delta: ${e}) sn: ${o.sn})`),t.timestampOffset=m)}}this.appendExecutor(s,a)},onStart:()=>{},onComplete:()=>{const t=self.performance.now();u.executeEnd=u.end=t,0===d.first&&(d.first=t),f&&0===f.first&&(f.first=t);const{sourceBuffer:e}=this,r={};for(const t in e)r[t]=hn.getBuffered(e[t]);this.appendErrors[a]=0,"audio"===a||"video"===a?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(I.BUFFER_APPENDED,{type:a,frag:o,part:l,chunkMeta:c,parent:o.type,timeRanges:r})},onError:t=>{const e={type:x.MEDIA_ERROR,parent:o.type,details:P.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:o,part:l,chunkMeta:c,error:t,err:t,fatal:!1};if(t.code===DOMException.QUOTA_EXCEEDED_ERR)e.details=P.BUFFER_FULL_ERROR;else{const t=++this.appendErrors[a];e.details=P.BUFFER_APPEND_ERROR,this.warn(`Failed ${t}/${r.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),t>=r.config.appendErrorMaxRetry&&(e.fatal=!0)}r.trigger(I.ERROR,e)}};n.append(y,a,!!this.pendingTracks[a])}onBufferFlushing(t,e){const{operationQueue:r}=this,n=t=>({execute:this.removeExecutor.bind(this,t,e.startOffset,e.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(I.BUFFER_FLUSHED,{type:t})},onError:e=>{this.warn(`Failed to remove from ${t} SourceBuffer`,e)}});e.type?r.append(n(e.type),e.type):this.getSourceBufferTypes().forEach((t=>{r.append(n(t),t)}))}onFragParsed(t,e){const{frag:r,part:n}=e,i=[],s=n?n.elementaryStreams:r.elementaryStreams;s[Y]?i.push("audiovideo"):(s[V]&&i.push("audio"),s[W]&&i.push("video"));0===i.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${r.type} level: ${r.level} sn: ${r.sn}`),this.blockBuffers((()=>{const t=self.performance.now();r.stats.buffering.end=t,n&&(n.stats.buffering.end=t);const e=n?n.stats:r.stats;this.hls.trigger(I.FRAG_BUFFERED,{frag:r,part:n,stats:e,id:r.type})}),i)}onFragChanged(t,e){this.trimBuffers()}onBufferEos(t,e){this.getSourceBufferTypes().reduce(((t,r)=>{const n=this.sourceBuffer[r];return!n||e.type&&e.type!==r||(n.ending=!0,n.ended||(n.ended=!0,this.log(`${r} sourceBuffer now EOS`))),t&&!(n&&!n.ended)}),!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers((()=>{this.getSourceBufferTypes().forEach((t=>{const e=this.sourceBuffer[t];e&&(e.ending=!1)}));const{mediaSource:t}=this;t&&"open"===t.readyState?(this.log("Calling mediaSource.endOfStream()"),t.endOfStream()):t&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${t.readyState}`)})))}onLevelUpdated(t,{details:e}){e.fragments.length&&(this.details=e,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:t,details:e,media:r}=this;if(!r||null===e)return;if(!this.getSourceBufferTypes().length)return;const n=t.config,i=r.currentTime,s=e.levelTargetDuration,a=e.live&&null!==n.liveBackBufferLength?n.liveBackBufferLength:n.backBufferLength;if(R(a)&&a>0){const t=Math.max(a,s),e=Math.floor(i/s)*s-t;this.flushBackBuffer(i,s,e)}if(R(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const t=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),e=Math.max(t,s),r=Math.floor(i/s)*s+e;this.flushFrontBuffer(i,s,r)}}flushBackBuffer(t,e,r){const{details:n,sourceBuffer:i}=this;this.getSourceBufferTypes().forEach((s=>{const a=i[s];if(a){const i=hn.getBuffered(a);if(i.length>0&&r>i.start(0)){if(this.hls.trigger(I.BACK_BUFFER_REACHED,{bufferEnd:r}),null!=n&&n.live)this.hls.trigger(I.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});else if(a.ended&&i.end(i.length-1)-t<2*e)return void this.log(`Cannot flush ${s} back buffer while SourceBuffer is in ended state`);this.hls.trigger(I.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:s})}}}))}flushFrontBuffer(t,e,r){const{sourceBuffer:n}=this;this.getSourceBufferTypes().forEach((i=>{const s=n[i];if(s){const n=hn.getBuffered(s),a=n.length;if(a<2)return;const o=n.start(a-1),l=n.end(a-1);if(r>o||t>=o&&t<=l)return;if(s.ended&&t-l<2*e)return void this.log(`Cannot flush ${i} front buffer while SourceBuffer is in ended state`);this.hls.trigger(I.BUFFER_FLUSHING,{startOffset:o,endOffset:1/0,type:i})}}))}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||"open"!==this.mediaSource.readyState)return;const{details:t,hls:e,media:r,mediaSource:n}=this,i=t.fragments[0].start+t.totalduration,s=r.duration,a=R(n.duration)?n.duration:0;t.live&&e.config.liveDurationInfinity?(n.duration=1/0,this.updateSeekableRange(t)):(i>a&&i>s||!R(s))&&(this.log(`Updating Media Source duration to ${i.toFixed(3)}`),n.duration=i)}updateSeekableRange(t){const e=this.mediaSource,r=t.fragments;if(r.length&&t.live&&null!=e&&e.setLiveSeekableRange){const n=Math.max(0,r[0].start),i=Math.max(n,n+t.totalduration);this.log(`Media Source duration is set to ${e.duration}. Setting seekable range to ${n}-${i}.`),e.setLiveSeekableRange(n,i)}}checkPendingTracks(){const{bufferCodecEventsExpected:t,operationQueue:e,pendingTracks:r}=this,n=Object.keys(r).length;if(n&&(!t||2===n||"audiovideo"in r)){this.createSourceBuffers(r),this.pendingTracks={};const t=this.getSourceBufferTypes();if(t.length)this.hls.trigger(I.BUFFER_CREATED,{tracks:this.tracks}),t.forEach((t=>{e.executeNext(t)}));else{const t=new Error("could not create source buffer for media codec(s)");this.hls.trigger(I.ERROR,{type:x.MEDIA_ERROR,details:P.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:t,reason:t.message})}}}createSourceBuffers(t){const{sourceBuffer:e,mediaSource:r}=this;if(!r)throw Error("createSourceBuffers called when mediaSource was null");for(const i in t)if(!e[i]){var n;const s=t[i];if(!s)throw Error(`source buffer exists for track ${i}, however track does not`);let a=-1===(null==(n=s.levelCodec)?void 0:n.indexOf(","))?s.levelCodec:s.codec;a&&"audio"===i.slice(0,5)&&(a=_e(a,this.appendSource));const o=`${s.container};codecs=${a}`;this.log(`creating sourceBuffer(${o})`);try{const t=e[i]=r.addSourceBuffer(o),n=i;this.addBufferListener(n,"updatestart",this._onSBUpdateStart),this.addBufferListener(n,"updateend",this._onSBUpdateEnd),this.addBufferListener(n,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(n,"bufferedchange",((t,e)=>{const r=e.removedRanges;null!=r&&r.length&&this.hls.trigger(I.BUFFER_FLUSHED,{type:i})})),this.tracks[i]={buffer:t,codec:a,container:s.container,levelCodec:s.levelCodec,metadata:s.metadata,id:s.id}}catch(t){this.error(`error while trying to add sourceBuffer: ${t.message}`),this.hls.trigger(I.ERROR,{type:x.MEDIA_ERROR,details:P.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:t,sourceBufferName:i,mimeType:o})}}}get mediaSrc(){var t,e;const r=(null==(t=this.media)||null==(e=t.querySelector)?void 0:e.call(t,"source"))||this.media;return null==r?void 0:r.src}_onSBUpdateStart(t){const{operationQueue:e}=this;e.current(t).onStart()}_onSBUpdateEnd(t){var e;if("closed"===(null==(e=this.mediaSource)?void 0:e.readyState))return void this.resetBuffer(t);const{operationQueue:r}=this;r.current(t).onComplete(),r.shiftAndExecuteNext(t)}_onSBUpdateError(t,e){var r;const n=new Error(`${t} SourceBuffer error. MediaSource readyState: ${null==(r=this.mediaSource)?void 0:r.readyState}`);this.error(`${n}`,e),this.hls.trigger(I.ERROR,{type:x.MEDIA_ERROR,details:P.BUFFER_APPENDING_ERROR,sourceBufferName:t,error:n,fatal:!1});const i=this.operationQueue.current(t);i&&i.onError(n)}removeExecutor(t,e,r){const{media:n,mediaSource:i,operationQueue:s,sourceBuffer:a}=this,o=a[t];if(!n||!i||!o)return this.warn(`Attempting to remove from the ${t} SourceBuffer, but it does not exist`),void s.shiftAndExecuteNext(t);const l=R(n.duration)?n.duration:1/0,c=R(i.duration)?i.duration:1/0,u=Math.max(0,e),h=Math.min(r,l,c);h>u&&(!o.ending||o.ended)?(o.ended=!1,this.log(`Removing [${u},${h}] from the ${t} SourceBuffer`),o.remove(u,h)):s.shiftAndExecuteNext(t)}appendExecutor(t,e){const r=this.sourceBuffer[e];if(r)r.ended=!1,r.appendBuffer(t);else if(!this.pendingTracks[e])throw new Error(`Attempting to append to the ${e} SourceBuffer, but it does not exist`)}blockBuffers(t,e=this.getSourceBufferTypes()){if(!e.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(t);const{operationQueue:r}=this,n=e.map((t=>r.appendBlocker(t)));Promise.all(n).then((()=>{t(),e.forEach((t=>{const e=this.sourceBuffer[t];null!=e&&e.updating||r.shiftAndExecuteNext(t)}))}))}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(t,e,r){const n=this.sourceBuffer[t];if(!n)return;const i=r.bind(this,t);this.listeners[t].push({event:e,listener:i}),n.addEventListener(e,i)}removeBufferListeners(t){const e=this.sourceBuffer[t];e&&this.listeners[t].forEach((t=>{e.removeEventListener(t.event,t.listener)}))}},capLevelController:zs,errorController:class{constructor(t){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=t,this.log=N.log.bind(N,"[info]:"),this.warn=N.warn.bind(N,"[warning]:"),this.error=N.error.bind(N,"[error]:"),this.registerListeners()}registerListeners(){const t=this.hls;t.on(I.ERROR,this.onError,this),t.on(I.MANIFEST_LOADING,this.onManifestLoading,this),t.on(I.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const t=this.hls;t&&(t.off(I.ERROR,this.onError,this),t.off(I.ERROR,this.onErrorOut,this),t.off(I.MANIFEST_LOADING,this.onManifestLoading,this),t.off(I.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(t){}stopLoad(){this.playlistError=0}getVariantLevelIndex(t){return(null==t?void 0:t.type)===Ke?t.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(t,e){var r,n;if(e.fatal)return;const i=this.hls,s=e.context;switch(e.details){case P.FRAG_LOAD_ERROR:case P.FRAG_LOAD_TIMEOUT:case P.KEY_LOAD_ERROR:case P.KEY_LOAD_TIMEOUT:return void(e.errorAction=this.getFragRetryOrSwitchAction(e));case P.FRAG_PARSING_ERROR:if(null!=(r=e.frag)&&r.gap)return void(e.errorAction={action:Mr,flags:Ur});case P.FRAG_GAP:case P.FRAG_DECRYPT_ERROR:return e.errorAction=this.getFragRetryOrSwitchAction(e),void(e.errorAction.action=Fr);case P.LEVEL_EMPTY_ERROR:case P.LEVEL_PARSING_ERROR:{var a,o;const t=e.parent===Ke?e.level:i.loadLevel;e.details===P.LEVEL_EMPTY_ERROR&&null!=(a=e.context)&&null!=(o=a.levelDetails)&&o.live?e.errorAction=this.getPlaylistRetryOrSwitchAction(e,t):(e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t))}return;case P.LEVEL_LOAD_ERROR:case P.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==s?void 0:s.level)&&(e.errorAction=this.getPlaylistRetryOrSwitchAction(e,s.level)));case P.AUDIO_TRACK_LOAD_ERROR:case P.AUDIO_TRACK_LOAD_TIMEOUT:case P.SUBTITLE_LOAD_ERROR:case P.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const t=i.levels[i.loadLevel];if(t&&(s.type===je&&t.hasAudioGroup(s.groupId)||s.type===Ge&&t.hasSubtitleGroup(s.groupId)))return e.errorAction=this.getPlaylistRetryOrSwitchAction(e,i.loadLevel),e.errorAction.action=Fr,void(e.errorAction.flags=$r)}return;case P.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const t=i.levels[i.loadLevel],r=null==t?void 0:t.attrs["HDCP-LEVEL"];r?e.errorAction={action:Fr,flags:jr,hdcpLevel:r}:this.keySystemError(e)}return;case P.BUFFER_ADD_CODEC_ERROR:case P.REMUX_ALLOC_ERROR:case P.BUFFER_APPEND_ERROR:return void(e.errorAction=this.getLevelSwitchAction(e,null!=(n=e.level)?n:i.loadLevel));case P.INTERNAL_EXCEPTION:case P.BUFFER_APPENDING_ERROR:case P.BUFFER_FULL_ERROR:case P.LEVEL_SWITCH_ERROR:case P.BUFFER_STALLED_ERROR:case P.BUFFER_SEEK_OVER_HOLE:case P.BUFFER_NUDGE_ON_STALL:return void(e.errorAction={action:Mr,flags:Ur})}e.type===x.KEY_SYSTEM_ERROR&&this.keySystemError(e)}keySystemError(t){const e=this.getVariantLevelIndex(t.frag);t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e)}getPlaylistRetryOrSwitchAction(t,e){const r=wr(this.hls.config.playlistLoadPolicy,t),n=this.playlistError++;if(Dr(r,n,Lr(t),t.response))return{action:Nr,flags:Ur,retryConfig:r,retryCount:n};const i=this.getLevelSwitchAction(t,e);return r&&(i.retryConfig=r,i.retryCount=n),i}getFragRetryOrSwitchAction(t){const e=this.hls,r=this.getVariantLevelIndex(t.frag),n=e.levels[r],{fragLoadPolicy:i,keyLoadPolicy:s}=e.config,a=wr(t.details.startsWith("key")?s:i,t),o=e.levels.reduce(((t,e)=>t+e.fragmentError),0);if(n){t.details!==P.FRAG_GAP&&n.fragmentError++;if(Dr(a,o,Lr(t),t.response))return{action:Nr,flags:Ur,retryConfig:a,retryCount:o}}const l=this.getLevelSwitchAction(t,r);return a&&(l.retryConfig=a,l.retryCount=o),l}getLevelSwitchAction(t,e){const r=this.hls;null==e&&(e=r.loadLevel);const n=this.hls.levels[e];if(n){var i,s;const e=t.details;n.loadError++,e===P.BUFFER_APPEND_ERROR&&n.fragmentError++;let l=-1;const{levels:c,loadLevel:u,minAutoLevel:h,maxAutoLevel:d}=r;r.autoLevelEnabled||(r.loadLevel=-1);const f=null==(i=t.frag)?void 0:i.type,p=(f===He&&e===P.FRAG_PARSING_ERROR||"audio"===t.sourceBufferName&&(e===P.BUFFER_ADD_CODEC_ERROR||e===P.BUFFER_APPEND_ERROR))&&c.some((({audioCodec:t})=>n.audioCodec!==t)),g="video"===t.sourceBufferName&&(e===P.BUFFER_ADD_CODEC_ERROR||e===P.BUFFER_APPEND_ERROR)&&c.some((({codecSet:t,audioCodec:e})=>n.codecSet!==t&&n.audioCodec===e)),{type:m,groupId:y}=null!=(s=t.context)?s:{};for(let r=c.length;r--;){const i=(r+u)%c.length;if(i!==u&&i>=h&&i<=d&&0===c[i].loadError){var a,o;const r=c[i];if(e===P.FRAG_GAP&&f===Ke&&t.frag){const e=c[i].details;if(e){const r=xr(t.frag,e.fragments,t.frag.start);if(null!=r&&r.gap)continue}}else{if(m===je&&r.hasAudioGroup(y)||m===Ge&&r.hasSubtitleGroup(y))continue;if(f===He&&null!=(a=n.audioGroups)&&a.some((t=>r.hasAudioGroup(t)))||f===Ve&&null!=(o=n.subtitleGroups)&&o.some((t=>r.hasSubtitleGroup(t)))||p&&n.audioCodec===r.audioCodec||!p&&n.audioCodec!==r.audioCodec||g&&n.codecSet===r.codecSet)continue}l=i;break}}if(l>-1&&r.loadLevel!==l)return t.levelRetry=!0,this.playlistError=0,{action:Fr,flags:Ur,nextAutoLevel:l}}return{action:Fr,flags:$r}}onErrorOut(t,e){var r;switch(null==(r=e.errorAction)?void 0:r.action){case Mr:break;case Fr:this.sendAlternateToPenaltyBox(e),e.errorAction.resolved||e.details===P.FRAG_GAP?/MediaSource readyState: ended/.test(e.error.message)&&(this.warn(`MediaSource ended after "${e.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError()):e.fatal=!0}e.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(t){const e=this.hls,r=t.errorAction;if(!r)return;const{flags:n,hdcpLevel:i,nextAutoLevel:s}=r;switch(n){case Ur:this.switchLevel(t,s);break;case jr:i&&(e.maxHdcpLevel=cr[cr.indexOf(i)-1],r.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${e.maxHdcpLevel}" or lower`)}r.resolved||this.switchLevel(t,s)}switchLevel(t,e){void 0!==e&&t.errorAction&&(this.warn(`switching to level ${e} after ${t.details}`),this.hls.nextAutoLevel=e,t.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}},fpsController:class{constructor(t){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=t,this.registerListeners()}setStreamController(t){this.streamController=t}registerListeners(){this.hls.on(I.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(t,e){const r=this.hls.config;if(r.capLevelOnFPSDrop){const t=e.media instanceof self.HTMLVideoElement?e.media:null;this.media=t,t&&"function"==typeof t.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}}checkFPS(t,e,r){const n=performance.now();if(e){if(this.lastTime){const t=n-this.lastTime,i=r-this.lastDroppedFrames,s=e-this.lastDecodedFrames,a=1e3*i/t,o=this.hls;if(o.trigger(I.FPS_DROP,{currentDropped:i,currentDecoded:s,totalDroppedFrames:r}),a>0&&i>o.config.fpsDroppedMonitoringThreshold*s){let t=o.currentLevel;N.warn("drop FPS ratio greater than max allowed value for currentLevel: "+t),t>0&&(-1===o.autoLevelCapping||o.autoLevelCapping>=t)&&(t-=1,o.trigger(I.FPS_DROP_LEVEL_CAPPING,{level:t,droppedLevel:o.currentLevel}),o.autoLevelCapping=t,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=r,this.lastDecodedFrames=e}}checkFPSInterval(){const t=this.media;if(t)if(this.isVideoPlaybackQualityAvailable){const e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.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:gt,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:Fa,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 $n{constructor(t,e,r){super(t,e,r,"[subtitle-stream-controller]",Ve),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:t}=this;t.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(I.MANIFEST_LOADING,this.onManifestLoading,this),t.on(I.LEVEL_LOADED,this.onLevelLoaded,this),t.on(I.ERROR,this.onError,this),t.on(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(I.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(I.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:t}=this;t.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(I.MANIFEST_LOADING,this.onManifestLoading,this),t.off(I.LEVEL_LOADED,this.onLevelLoaded,this),t.off(I.ERROR,this.onError,this),t.off(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(I.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(I.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(t){this.stopLoad(),this.state=Cn,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(t,e){this.mainDetails=e.details}onSubtitleFragProcessed(t,e){const{frag:r,success:n}=e;if(this.fragPrevious=r,this.state=Cn,!n)return;const i=this.tracksBuffered[this.currentTrackId];if(!i)return;let s;const a=r.start;for(let t=0;t<i.length;t++)if(a>=i[t].start&&a<=i[t].end){s=i[t];break}const o=r.start+r.duration;s?s.end=o:(s={start:a,end:o},i.push(s)),this.fragmentTracker.fragBuffered(r),this.fragBufferedComplete(r,null)}onBufferFlushing(t,e){const{startOffset:r,endOffset:n}=e;if(0===r&&n!==Number.POSITIVE_INFINITY){const t=n-1;if(t<=0)return;e.endOffsetSubtitles=Math.max(0,t),this.tracksBuffered.forEach((e=>{for(let r=0;r<e.length;)if(e[r].end<=t)e.shift();else{if(!(e[r].start<t))break;e[r].start=t,r++}})),this.fragmentTracker.removeFragmentsInRange(r,t,Ve)}}onFragBuffered(t,e){var r;this.loadedmetadata||e.frag.type!==Ke||null!=(r=this.media)&&r.buffered.length&&(this.loadedmetadata=!0)}onError(t,e){const r=e.frag;(null==r?void 0:r.type)===Ve&&(e.details===P.FRAG_GAP&&this.fragmentTracker.fragBuffered(r,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Rn&&(this.state=Cn))}onSubtitleTracksUpdated(t,{subtitleTracks:e}){this.levels&&qi(this.levels,e)?this.levels=e.map((t=>new mr(t))):(this.tracksBuffered=[],this.levels=e.map((t=>{const e=new mr(t);return this.tracksBuffered[e.id]=[],e})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ve),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(t,e){var r;if(this.currentTrackId=e.id,null==(r=this.levels)||!r.length||-1===this.currentTrackId)return void this.clearInterval();const n=this.levels[this.currentTrackId];null!=n&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.setInterval(500)}onSubtitleTrackLoaded(t,e){var r;const{currentTrackId:n,levels:i}=this,{details:s,id:a}=e;if(!i)return void this.warn(`Subtitle tracks were reset while loading level ${a}`);const o=i[a];if(a>=i.length||!o)return;this.log(`Subtitle track ${a} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(s.live||null!=(r=o.details)&&r.live){const t=this.mainDetails;if(s.deltaUpdateFailed||!t)return;const e=t.fragments[0];var c;if(o.details)l=this.alignPlaylists(s,o.details,null==(c=this.levelLastLoaded)?void 0:c.details),0===l&&e&&(l=e.start,Sr(s,l));else s.hasProgramDateTime&&t.hasProgramDateTime?(yn(s,t),l=s.fragments[0].start):e&&(l=e.start,Sr(s,l))}if(o.details=s,this.levelLastLoaded=o,a===n&&(this.startFragRequested||!this.mainDetails&&s.live||this.setStartPosition(this.mainDetails||s,l),this.tick(),s.live&&!this.fragCurrent&&this.media&&this.state===Cn)){xr(null,s.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),o.details=void 0)}}_handleFragmentLoadComplete(t){const{frag:e,payload:r}=t,n=e.decryptdata,i=this.hls;if(!this.fragContextChanged(e)&&r&&r.byteLength>0&&null!=n&&n.key&&n.iv&&"AES-128"===n.method){const t=performance.now();this.decrypter.decrypt(new Uint8Array(r),n.key.buffer,n.iv.buffer).catch((t=>{throw i.trigger(I.ERROR,{type:x.MEDIA_ERROR,details:P.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t})).then((r=>{const n=performance.now();i.trigger(I.FRAG_DECRYPTED,{frag:e,payload:r,stats:{tstart:t,tdecrypt:n}})})).catch((t=>{this.warn(`${t.name}: ${t.message}`),this.state=Cn}))}}doTick(){if(this.media){if(this.state===Cn){const{currentTrackId:t,levels:e}=this,r=null==e?void 0:e[t];if(!r||!e.length||!r.details)return;const{config:n}=this,i=this.getLoadPosition(),s=hn.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],i,n.maxBufferHole),{end:a,len:o}=s,l=this.getFwdBufferInfo(this.media,Ke),c=r.details;if(o>this.getMaxBufferLength(null==l?void 0:l.len)+c.levelTargetDuration)return;const u=c.fragments,h=u.length,d=c.edge;let f=null;const p=this.fragPrevious;if(a<d){const t=n.maxFragLookUpTolerance,e=a>d-t?0:t;f=xr(p,u,Math.max(u[0].start,a),e),!f&&p&&p.start<u[0].start&&(f=u[0])}else f=u[h-1];if(!f)return;if(f=this.mapToInitFragWhenRequired(f),"initSegment"!==f.sn){const t=u[f.sn-c.startSN-1];t&&t.cc===f.cc&&this.fragmentTracker.getState(t)===rn&&(f=t)}this.fragmentTracker.getState(f)===rn&&this.loadFragment(f,r,a)}}else this.state=Cn}getMaxBufferLength(t){const e=super.getMaxBufferLength();return t?Math.max(e,t):e}loadFragment(t,e,r){this.fragCurrent=t,"initSegment"===t.sn?this._loadInitSegment(t,e):(this.startFragRequested=!0,super.loadFragment(t,e,r))}get mediaBufferTimeRanges(){return new Qi(this.tracksBuffered[this.currentTrackId]||[])}},subtitleTrackController:class extends Gr{constructor(t){super(t,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const e=Ze(this.media.textTracks);for(let r=0;r<e.length;r++)if("hidden"===e[r].mode)t=e[r];else if("showing"===e[r].mode){t=e[r];break}const r=this.findTrackForTextTrack(t);this.subtitleTrack!==r&&this.setSubtitleTrack(r)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(t){this._subtitleDisplay=t,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:t}=this;t.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(I.MANIFEST_LOADING,this.onManifestLoading,this),t.on(I.MANIFEST_PARSED,this.onManifestParsed,this),t.on(I.LEVEL_LOADING,this.onLevelLoading,this),t.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(I.MANIFEST_LOADING,this.onManifestLoading,this),t.off(I.MANIFEST_PARSED,this.onManifestParsed,this),t.off(I.LEVEL_LOADING,this.onLevelLoading,this),t.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(I.ERROR,this.onError,this)}onMediaAttached(t,e){this.media=e.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(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,t)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);Ze(this.media.textTracks).forEach((t=>{Qe(t)})),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(t,e){this.tracks=e.subtitleTracks}onSubtitleTrackLoaded(t,e){const{id:r,groupId:n,details:i}=e,s=this.tracksInGroup[r];if(!s||s.groupId!==n)return void this.warn(`Subtitle track with id:${r} and group:${n} not found in active group ${null==s?void 0:s.groupId}`);const a=s.details;s.details=e.details,this.log(`Subtitle track ${r} "${s.name}" lang:${s.lang} group:${n} loaded [${i.startSN}-${i.endSN}]`),r===this.trackId&&this.playlistLoaded(r,e,a)}onLevelLoading(t,e){this.switchLevel(e.level)}onLevelSwitching(t,e){this.switchLevel(e.level)}switchLevel(t){const e=this.hls.levels[t];if(!e)return;const r=e.subtitleGroups||null,n=this.groupIds;let i=this.currentTrack;if(!r||(null==n?void 0:n.length)!==(null==r?void 0:r.length)||null!=r&&r.some((t=>-1===(null==n?void 0:n.indexOf(t))))){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const t=this.tracks.filter((t=>!r||-1!==r.indexOf(t.groupId)));if(t.length)this.selectDefaultTrack&&!t.some((t=>t.default))&&(this.selectDefaultTrack=!1),t.forEach(((t,e)=>{t.id=e}));else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=t;const e=this.hls.config.subtitlePreference;if(!i&&e){this.selectDefaultTrack=!1;const r=Qr(e,t);if(r>-1)i=t[r];else{const t=Qr(e,this.tracks);i=this.tracks[t]}}let n=this.findTrackId(i);-1===n&&i&&(n=this.findTrackId(null));const s={subtitleTracks:t};this.log(`Updating subtitle tracks, ${t.length} track(s) found in "${null==r?void 0:r.join(",")}" group-id`),this.hls.trigger(I.SUBTITLE_TRACKS_UPDATED,s),-1!==n&&-1===this.trackId&&this.setSubtitleTrack(n)}else this.shouldReloadPlaylist(i)&&this.setSubtitleTrack(this.trackId)}findTrackId(t){const e=this.tracksInGroup,r=this.selectDefaultTrack;for(let n=0;n<e.length;n++){const i=e[n];if((!r||i.default)&&(r||t)&&(!t||Jr(i,t)))return n}if(t){for(let r=0;r<e.length;r++){const n=e[r];if(zi(t.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<e.length;r++){const n=e[r];if(zi(t.attrs,n.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(t){if(t){const e=this.tracksInGroup;for(let r=0;r<e.length;r++){if(Xi(e[r],t))return r}}return-1}onError(t,e){!e.fatal&&e.context&&(e.context.type!==Ge||e.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(e.context.groupId)||this.checkRetry(e))}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(t){this.selectDefaultTrack=!1,this.setSubtitleTrack(t)}setSubtitleOption(t){if(this.hls.config.subtitlePreference=t,t){const e=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,e.length){const r=this.currentTrack;if(r&&Jr(t,r))return r;const n=Qr(t,this.tracksInGroup);if(n>-1){const t=this.tracksInGroup[n];return this.setSubtitleTrack(n),t}if(r)return null;{const r=Qr(t,e);if(r>-1)return e[r]}}}return null}loadPlaylist(t){super.loadPlaylist();const e=this.currentTrack;if(this.shouldLoadPlaylist(e)&&e){const r=e.id,n=e.groupId;let i=e.url;if(t)try{i=t.addDirectives(i)}catch(t){this.warn(`Could not construct new URL with HLS Delivery Directives: ${t}`)}this.log(`Loading subtitle playlist for id ${r}`),this.hls.trigger(I.SUBTITLE_TRACK_LOADING,{url:i,id:r,groupId:n,deliveryDirectives:t||null})}}toggleTrackModes(){const{media:t}=this;if(!t)return;const e=Ze(t.textTracks),r=this.currentTrack;let n;if(r&&(n=e.filter((t=>Xi(r,t)))[0],n||this.warn(`Unable to find subtitle TextTrack with name "${r.name}" and language "${r.lang}"`)),[].slice.call(e).forEach((t=>{"disabled"!==t.mode&&t!==n&&(t.mode="disabled")})),n){const t=this.subtitleDisplay?"showing":"hidden";n.mode!==t&&(n.mode=t)}}setSubtitleTrack(t){const e=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=t);if(t<-1||t>=e.length||!R(t))return void this.warn(`Invalid subtitle track id: ${t}`);this.clearTimer(),this.selectDefaultTrack=!1;const r=this.currentTrack,n=e[t]||null;if(this.trackId=t,this.currentTrack=n,this.toggleTrackModes(),!n)return void this.hls.trigger(I.SUBTITLE_TRACK_SWITCH,{id:t});const i=!!n.details&&!n.details.live;if(t===this.trackId&&n===r&&i)return;this.log(`Switching to subtitle-track ${t}`+(n?` "${n.name}" lang:${n.lang} group:${n.groupId}`:""));const{id:s,groupId:a="",name:o,type:l,url:c}=n;this.hls.trigger(I.SUBTITLE_TRACK_SWITCH,{id:s,groupId:a,name:o,type:l,url:c});const u=this.switchParams(n.url,null==r?void 0:r.details,n.details);this.loadPlaylist(u)}},timelineController:class{constructor(t){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={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.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}},t.on(I.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(I.MANIFEST_LOADING,this.onManifestLoading,this),t.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(I.FRAG_LOADING,this.onFragLoading,this),t.on(I.FRAG_LOADED,this.onFragLoaded,this),t.on(I.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(I.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(I.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(I.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:t}=this;t.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(I.MANIFEST_LOADING,this.onManifestLoading,this),t.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(I.FRAG_LOADING,this.onFragLoading,this),t.off(I.FRAG_LOADED,this.onFragLoaded,this),t.off(I.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off(I.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off(I.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(I.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const t=new bs(this,"textTrack1"),e=new bs(this,"textTrack2"),r=new bs(this,"textTrack3"),n=new bs(this,"textTrack4");this.cea608Parser1=new ys(1,t,e),this.cea608Parser2=new ys(3,r,n)}}addCues(t,e,r,n,i){let s=!1;for(let t=i.length;t--;){const n=i[t],u=(a=n[0],o=n[1],l=e,c=r,Math.min(o,c)-Math.max(a,l));if(u>=0&&(n[0]=Math.min(n[0],e),n[1]=Math.max(n[1],r),s=!0,u/(r-e)>.5))return}var a,o,l,c;if(s||i.push([e,r]),this.config.renderTextTracksNatively){const i=this.captionsTracks[t];this.Cues.newCue(i,e,r,n)}else{const i=this.Cues.newCue(null,e,r,n);this.hls.trigger(I.CUES_PARSED,{type:"captions",cues:i,track:t})}}onInitPtsFound(t,{frag:e,id:r,initPTS:n,timescale:i}){const{unparsedVttFrags:s}=this;"main"===r&&(this.initPTS[e.cc]={baseTime:n,timescale:i}),s.length&&(this.unparsedVttFrags=[],s.forEach((t=>{this.onFragLoaded(I.FRAG_LOADED,t)})))}getExistingTrack(t,e){const{media:r}=this;if(r)for(let n=0;n<r.textTracks.length;n++){const i=r.textTracks[n];if(qs(i,{name:t,lang:e,attrs:{}}))return i}return null}createCaptionsTrack(t){this.config.renderTextTracksNatively?this.createNativeTrack(t):this.createNonNativeTrack(t)}createNativeTrack(t){if(this.captionsTracks[t])return;const{captionsProperties:e,captionsTracks:r,media:n}=this,{label:i,languageCode:s}=e[t],a=this.getExistingTrack(i,s);if(a)r[t]=a,Qe(r[t]),ze(r[t],n);else{const e=this.createTextTrack("captions",i,s);e&&(e[t]=!0,r[t]=e)}}createNonNativeTrack(t){if(this.nonNativeCaptionsTracks[t])return;const e=this.captionsProperties[t];if(!e)return;const r={_id:t,label:e.label,kind:"captions",default:!!e.media&&!!e.media.default,closedCaptions:e.media};this.nonNativeCaptionsTracks[t]=r,this.hls.trigger(I.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(t,e,r){const n=this.media;if(n)return n.addTextTrack(t,e,r)}onMediaAttaching(t,e){this.media=e.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:t}=this;Object.keys(t).forEach((e=>{Qe(t[e]),delete t[e]})),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:t}=this;if(!t)return;const e=t.textTracks;if(e)for(let t=0;t<e.length;t++)Qe(e[t])}onSubtitleTracksUpdated(t,e){const r=e.subtitleTracks||[],n=r.some((t=>t.textCodec===Fs));if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(qi(this.tracks,r))return void(this.tracks=r);if(this.textTracks=[],this.tracks=r,this.config.renderTextTracksNatively){const t=this.media,e=t?Ze(t.textTracks):null;if(this.tracks.forEach(((t,r)=>{let n;if(e){let r=null;for(let n=0;n<e.length;n++)if(e[n]&&qs(e[n],t)){r=e[n],e[n]=null;break}r&&(n=r)}if(n)Qe(n);else{const e=Ys(t);n=this.createTextTrack(e,t.name,t.lang),n&&(n.mode="disabled")}n&&this.textTracks.push(n)})),null!=e&&e.length){const t=e.filter((t=>null!==t)).map((t=>t.label));t.length&&N.warn(`Media element contains unused subtitle tracks: ${t.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const t=this.tracks.map((t=>({label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t})));this.hls.trigger(I.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:t})}}}onManifestLoaded(t,e){this.config.enableCEA708Captions&&e.captions&&e.captions.forEach((t=>{const e=/(?:CC|SERVICE)([1-4])/.exec(t.instreamId);if(!e)return;const r=`textTrack${e[1]}`,n=this.captionsProperties[r];n&&(n.label=t.name,t.lang&&(n.languageCode=t.lang),n.media=t)}))}closedCaptionsForLevel(t){const e=this.hls.levels[t.level];return null==e?void 0:e.attrs["CLOSED-CAPTIONS"]}onFragLoading(t,e){if(this.enabled&&e.frag.type===Ke){var r,n;const{cea608Parser1:t,cea608Parser2:i,lastSn:s}=this,{cc:a,sn:o}=e.frag,l=null!=(r=null==(n=e.part)?void 0:n.index)?r:-1;t&&i&&(o!==s+1||o===s&&l!==this.lastPartIndex+1||a!==this.lastCc)&&(t.reset(),i.reset()),this.lastCc=a,this.lastSn=o,this.lastPartIndex=l}}onFragLoaded(t,e){const{frag:r,payload:n}=e;if(r.type===Ve)if(n.byteLength){const t=r.decryptdata,i="stats"in e;if(null==t||!t.encrypted||i){const t=this.tracks[r.level],i=this.vttCCs;i[r.cc]||(i[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),t&&t.textCodec===Fs?this._parseIMSC1(r,n):this._parseVTTs(e)}}else this.hls.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})}_parseIMSC1(t,e){const r=this.hls;$s(e,this.initPTS[t.cc],(e=>{this._appendCues(e,t.level),r.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})}),(e=>{N.log(`Failed to parse IMSC1: ${e}`),r.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:e})}))}_parseVTTs(t){var e;const{frag:r,payload:n}=t,{initPTS:i,unparsedVttFrags:s}=this,a=i.length-1;if(!i[r.cc]&&-1===a)return void s.push(t);const o=this.hls;Ms(null!=(e=r.initSegment)&&e.data?te(r.initSegment.data,new Uint8Array(n)):n,this.initPTS[r.cc],this.vttCCs,r.cc,r.start,(t=>{this._appendCues(t,r.level),o.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})}),(e=>{const i="Missing initPTS for VTT MPEGTS"===e.message;i?s.push(t):this._fallbackToIMSC1(r,n),N.log(`Failed to parse VTT cue: ${e}`),i&&a>r.cc||o.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:e})}))}_fallbackToIMSC1(t,e){const r=this.tracks[t.level];r.textCodec||$s(e,this.initPTS[t.cc],(()=>{r.textCodec=Fs,this._parseIMSC1(t,e)}),(()=>{r.textCodec="wvtt"}))}_appendCues(t,e){const r=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[e];if(!r||"disabled"===r.mode)return;t.forEach((t=>Xe(r,t)))}else{const n=this.tracks[e];if(!n)return;const i=n.default?"default":"subtitles"+e;r.trigger(I.CUES_PARSED,{type:"subtitles",cues:t,track:i})}}onFragDecrypted(t,e){const{frag:r}=e;r.type===Ve&&this.onFragLoaded(I.FRAG_LOADED,e)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(t,e){this.initCea608Parsers();const{cea608Parser1:r,cea608Parser2:n}=this;if(!this.enabled||!r||!n)return;const{frag:i,samples:s}=e;if(i.type!==Ke||"NONE"!==this.closedCaptionsForLevel(i))for(let t=0;t<s.length;t++){const e=s[t].bytes;if(e){const i=this.extractCea608Data(e);r.addData(s[t].pts,i[0]),n.addData(s[t].pts,i[1])}}}onBufferFlushing(t,{startOffset:e,endOffset:r,endOffsetSubtitles:n,type:i}){const{media:s}=this;if(s&&!(s.currentTime<r)){if(!i||"video"===i){const{captionsTracks:t}=this;Object.keys(t).forEach((n=>Je(t[n],e,r)))}if(this.config.renderTextTracksNatively&&0===e&&void 0!==n){const{textTracks:t}=this;Object.keys(t).forEach((r=>Je(t[r],e,n)))}}}extractCea608Data(t){const e=[[],[]],r=31&t[0];let n=2;for(let i=0;i<r;i++){const r=t[n++],i=127&t[n++],s=127&t[n++];if(0===i&&0===s)continue;if(!!(4&r)){const t=3&r;0!==t&&1!==t||(e[t].push(i),e[t].push(s))}}return e}},audioStreamController:class extends $n{constructor(t,e,r){super(t,e,r,"[audio-stream-controller]",He),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:t}=this;t.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(I.MANIFEST_LOADING,this.onManifestLoading,this),t.on(I.LEVEL_LOADED,this.onLevelLoaded,this),t.on(I.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(I.ERROR,this.onError,this),t.on(I.BUFFER_RESET,this.onBufferReset,this),t.on(I.BUFFER_CREATED,this.onBufferCreated,this),t.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(I.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(I.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:t}=this;t.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(I.MANIFEST_LOADING,this.onManifestLoading,this),t.off(I.LEVEL_LOADED,this.onLevelLoaded,this),t.off(I.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(I.ERROR,this.onError,this),t.off(I.BUFFER_RESET,this.onBufferReset,this),t.off(I.BUFFER_CREATED,this.onBufferCreated,this),t.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(I.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(I.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(t,{frag:e,id:r,initPTS:n,timescale:i}){if("main"===r){const t=e.cc;this.initPTS[e.cc]={baseTime:n,timescale:i},this.log(`InitPTS for cc: ${t} found from main: ${n}`),this.videoTrackCC=t,this.state===Nn&&this.tick()}}startLoad(t){if(!this.levels)return this.startPosition=t,void(this.state=Rn);const e=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),e>0&&-1===t?(this.log(`Override startPosition with lastCurrentTime @${e.toFixed(3)}`),t=e,this.state=Cn):(this.loadedmetadata=!1,this.state=Pn),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}doTick(){switch(this.state){case Cn:this.doTickIdle();break;case Pn:{var t;const{levels:e,trackId:r}=this,n=null==e||null==(t=e[r])?void 0:t.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=Nn}break}case xn:{var e;const t=performance.now(),r=this.retryDate;if(!r||t>=r||null!=(e=this.media)&&e.seeking){const{levels:t,trackId:e}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==t?void 0:t[e])||null),this.state=Cn}break}case Nn:{const t=this.waitingData;if(t){const{frag:e,part:r,cache:n,complete:i}=t;if(void 0!==this.initPTS[e.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=In;const t={frag:e,part:r,payload:n.flush(),networkDetails:null};this._handleFragmentLoadProgress(t),i&&super._handleFragmentLoadComplete(t)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${e.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const t=this.getLoadPosition(),r=hn.bufferInfo(this.mediaBuffer,t,this.config.maxBufferHole);Pr(r.end,this.config.maxFragLookUpTolerance,e)<0&&(this.log(`Waiting fragment cc (${e.cc}) @ ${e.start} cancelled because another fragment at ${r.end} is needed`),this.clearWaitingFragment())}}else this.state=Cn}}this.onTickEnd()}clearWaitingFragment(){const t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Cn)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:t}=this;null!=t&&t.readyState&&(this.lastCurrentTime=t.currentTime)}doTickIdle(){const{hls:t,levels:e,media:r,trackId:n}=this,i=t.config;if(!r&&(this.startFragRequested||!i.startFragPrefetch)||null==e||!e[n])return;const s=e[n],a=s.details;if(!a||a.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(a))return void(this.state=Pn);const o=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&o&&(this.bufferFlushed=!1,this.afterBufferFlushed(o,V,He));const l=this.getFwdBufferInfo(o,He);if(null===l)return;const{bufferedTrack:c,switchingTrack:u}=this;if(!u&&this._streamEnded(l,a))return t.trigger(I.BUFFER_EOS,{type:"audio"}),void(this.state=Fn);const h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Ke),d=l.len,f=this.getMaxBufferLength(null==h?void 0:h.len),p=a.fragments,g=p[0].start;let m=this.flushing?this.getLoadPosition():l.end;if(u&&r){const t=this.getLoadPosition();c&&!zi(u.attrs,c.attrs)&&(m=t),a.PTSKnown&&t<g&&(l.end>g||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=g+.05)}if(d>=f&&!u&&m<p[p.length-1].start)return;let y=this.getNextFragment(m,a),v=!1;if(y&&this.isLoopLoading(y,m)&&(v=!!y.gap,y=this.getNextFragmentLoopLoading(y,a,l,Ke,f)),!y)return void(this.bufferFlushed=!0);const E=h&&y.start>h.end+a.targetduration;if(E||(null==h||!h.len)&&l.len){const t=this.getAppendedFrag(y.start,Ke);if(null===t)return;if(v||(v=!!t.gap||!!E&&0===h.len),E&&!v||v&&l.nextStart&&l.nextStart<t.end)return}this.loadFragment(y,s,m)}getMaxBufferLength(t){const e=super.getMaxBufferLength();return t?Math.min(Math.max(e,t),this.config.maxMaxBufferLength):e}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(t,{audioTracks:e}){this.resetTransmuxer(),this.levels=e.map((t=>new mr(t)))}onAudioTrackSwitching(t,e){const r=!!e.url;this.trackId=e.id;const{fragCurrent:n}=this;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),r?this.setInterval(100):this.resetTransmuxer(),r?(this.switchingTrack=e,this.state=Cn,this.flushAudioIfNeeded(e)):(this.switchingTrack=null,this.bufferedTrack=e,this.state=Rn),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(t,e){this.mainDetails=e.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(I.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(t,e){var r;if(null==this.mainDetails)return void(this.cachedTrackLoadedData=e);const{levels:n}=this,{details:i,id:s}=e;if(!n)return void this.warn(`Audio tracks were reset while loading level ${s}`);this.log(`Audio track ${s} loaded [${i.startSN},${i.endSN}]${i.lastPartSn?`[part-${i.lastPartSn}-${i.lastPartIndex}]`:""},duration:${i.totalduration}`);const a=n[s];let o=0;if(i.live||null!=(r=a.details)&&r.live){this.checkLiveUpdate(i);const t=this.mainDetails;if(i.deltaUpdateFailed||!t)return;var l;if(!a.details&&i.hasProgramDateTime&&t.hasProgramDateTime)yn(i,t),o=i.fragments[0].start;else o=this.alignPlaylists(i,a.details,null==(l=this.levelLastLoaded)?void 0:l.details)}a.details=i,this.levelLastLoaded=a,this.startFragRequested||!this.mainDetails&&i.live||this.setStartPosition(this.mainDetails||i,o),this.state!==Pn||this.waitForCdnTuneIn(i)||(this.state=Cn),this.tick()}_handleFragmentLoadProgress(t){var e;const{frag:r,part:n,payload:i}=t,{config:s,trackId:a,levels:o}=this;if(!o)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);const l=o[a];if(!l)return void this.warn("Audio track is undefined on fragment load progress");const c=l.details;if(!c)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(r.start);const u=s.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new Yi(this.hls,He,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[r.cc],f=null==(e=r.initSegment)?void 0:e.data;if(void 0!==d){const t=!1,e=n?n.index:-1,s=-1!==e,a=new dn(r.level,r.sn,r.stats.chunkCount,i.byteLength,e,s);h.push(i,f,u,"",r,n,c.totalduration,t,a,d)}else{this.log(`Unknown video PTS for cc ${r.cc}, waiting for video PTS before demuxing audio frag ${r.sn} of [${c.startSN} ,${c.endSN}],track ${a}`);const{cache:t}=this.waitingData=this.waitingData||{frag:r,part:n,cache:new jn,complete:!1};t.push(new Uint8Array(i)),this.waitingVideoCC=this.videoTrackCC,this.state=Nn}}_handleFragmentLoadComplete(t){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(t)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(t,e){const r=e.tracks.audio;r&&(this.mediaBuffer=r.buffer||null),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer||null)}onFragBuffered(t,e){const{frag:r,part:n}=e;if(r.type===He)if(this.fragContextChanged(r))this.warn(`Fragment ${r.sn}${n?" p: "+n.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if("initSegment"!==r.sn){this.fragPrevious=r;const t=this.switchingTrack;t&&(this.bufferedTrack=t,this.switchingTrack=null,this.hls.trigger(I.AUDIO_TRACK_SWITCHED,_({},t)))}this.fragBufferedComplete(r,n)}else if(!this.loadedmetadata&&r.type===Ke){const t=this.videoBuffer||this.media;if(t){hn.getBuffered(t).length&&(this.loadedmetadata=!0)}}}onError(t,e){var r;if(e.fatal)this.state=Bn;else switch(e.details){case P.FRAG_GAP:case P.FRAG_PARSING_ERROR:case P.FRAG_DECRYPT_ERROR:case P.FRAG_LOAD_ERROR:case P.FRAG_LOAD_TIMEOUT:case P.KEY_LOAD_ERROR:case P.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(He,e);break;case P.AUDIO_TRACK_LOAD_ERROR:case P.AUDIO_TRACK_LOAD_TIMEOUT:case P.LEVEL_PARSING_ERROR:e.levelRetry||this.state!==Pn||(null==(r=e.context)?void 0:r.type)!==je||(this.state=Cn);break;case P.BUFFER_APPEND_ERROR:case P.BUFFER_FULL_ERROR:if(!e.parent||"audio"!==e.parent)return;if(e.details===P.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(e)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case P.INTERNAL_EXCEPTION:this.recoverWorkerError(e)}}onBufferFlushing(t,{type:e}){e!==W&&(this.flushing=!0)}onBufferFlushed(t,{type:e}){if(e!==W){this.flushing=!1,this.bufferFlushed=!0,this.state===Fn&&(this.state=Cn);const t=this.mediaBuffer||this.media;t&&(this.afterBufferFlushed(t,e,He),this.tick())}}_handleTransmuxComplete(t){var e;const r="audio",{hls:n}=this,{remuxResult:i,chunkMeta:s}=t,a=this.getCurrentContext(s);if(!a)return void this.resetWhenMissingContext(s);const{frag:o,part:l,level:c}=a,{details:u}=c,{audio:h,text:d,id3:f,initSegment:p}=i;if(!this.fragContextChanged(o)&&u){if(this.state=On,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),null!=p&&p.tracks){const t=o.initSegment||o;this._bufferInitSegment(c,p.tracks,t,s),n.trigger(I.FRAG_PARSING_INIT_SEGMENT,{frag:t,id:r,tracks:p.tracks})}if(h){const{startPTS:t,endPTS:e,startDTS:r,endDTS:n}=h;l&&(l.elementaryStreams[V]={startPTS:t,endPTS:e,startDTS:r,endDTS:n}),o.setElementaryStreamInfo(V,t,e,r,n),this.bufferFragmentData(h,o,l,s)}if(null!=f&&null!=(e=f.samples)&&e.length){const t=w({id:r,frag:o,details:u},f);n.trigger(I.FRAG_PARSING_METADATA,t)}if(d){const t=w({id:r,frag:o,details:u},d);n.trigger(I.FRAG_PARSING_USERDATA,t)}}else this.fragmentTracker.removeFragment(o)}_bufferInitSegment(t,e,r,n){if(this.state!==On)return;e.video&&delete e.video;const i=e.audio;if(!i)return;i.id="audio";const s=t.audioCodec;this.log(`Init audio buffer, container:${i.container}, codecs[level/parsed]=[${s}/${i.codec}]`),s&&1===s.split(",").length&&(i.levelCodec=s),this.hls.trigger(I.BUFFER_CODECS,e);const a=i.initSegment;if(null!=a&&a.byteLength){const t={type:"audio",frag:r,part:null,chunkMeta:n,parent:r.type,data:a};this.hls.trigger(I.BUFFER_APPENDING,t)}this.tickImmediate()}loadFragment(t,e,r){const n=this.fragmentTracker.getState(t);var i;if(this.fragCurrent=t,this.switchingTrack||n===rn||n===sn)if("initSegment"===t.sn)this._loadInitSegment(t,e);else if(null!=(i=e.details)&&i.live&&!this.initPTS[t.cc]){this.log(`Waiting for video PTS in continuity counter ${t.cc} of live stream before loading audio fragment ${t.sn} of level ${this.trackId}`),this.state=Nn;const r=this.mainDetails;r&&r.fragments[0].start!==e.details.fragments[0].start&&yn(e.details,r)}else this.startFragRequested=!0,super.loadFragment(t,e,r);else this.clearTrackerIfNeeded(t)}flushAudioIfNeeded(t){const{media:e,bufferedTrack:r}=this,n=null==r?void 0:r.attrs,i=t.attrs;e&&n&&(n.CHANNELS!==i.CHANNELS||r.name!==t.name||r.lang!==t.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(t){const{hls:e}=this;this.flushAudioIfNeeded(t),this.bufferedTrack=t,this.switchingTrack=null,e.trigger(I.AUDIO_TRACK_SWITCHED,_({},t))}},audioTrackController:class extends Gr{constructor(t){super(t,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:t}=this;t.on(I.MANIFEST_LOADING,this.onManifestLoading,this),t.on(I.MANIFEST_PARSED,this.onManifestParsed,this),t.on(I.LEVEL_LOADING,this.onLevelLoading,this),t.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(I.MANIFEST_LOADING,this.onManifestLoading,this),t.off(I.MANIFEST_PARSED,this.onManifestParsed,this),t.off(I.LEVEL_LOADING,this.onLevelLoading,this),t.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(I.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(t,e){this.tracks=e.audioTracks||[]}onAudioTrackLoaded(t,e){const{id:r,groupId:n,details:i}=e,s=this.tracksInGroup[r];if(!s||s.groupId!==n)return void this.warn(`Audio track with id:${r} and group:${n} not found in active group ${null==s?void 0:s.groupId}`);const a=s.details;s.details=e.details,this.log(`Audio track ${r} "${s.name}" lang:${s.lang} group:${n} loaded [${i.startSN}-${i.endSN}]`),r===this.trackId&&this.playlistLoaded(r,e,a)}onLevelLoading(t,e){this.switchLevel(e.level)}onLevelSwitching(t,e){this.switchLevel(e.level)}switchLevel(t){const e=this.hls.levels[t];if(!e)return;const r=e.audioGroups||null,n=this.groupIds;let i=this.currentTrack;if(!r||(null==n?void 0:n.length)!==(null==r?void 0:r.length)||null!=r&&r.some((t=>-1===(null==n?void 0:n.indexOf(t))))){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const t=this.tracks.filter((t=>!r||-1!==r.indexOf(t.groupId)));if(t.length)this.selectDefaultTrack&&!t.some((t=>t.default))&&(this.selectDefaultTrack=!1),t.forEach(((t,e)=>{t.id=e}));else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=t;const e=this.hls.config.audioPreference;if(!i&&e){const r=Qr(e,t,Zr);if(r>-1)i=t[r];else{const t=Qr(e,this.tracks);i=this.tracks[t]}}let n=this.findTrackId(i);-1===n&&i&&(n=this.findTrackId(null));const a={audioTracks:t};this.log(`Updating audio tracks, ${t.length} track(s) found in group(s): ${null==r?void 0:r.join(",")}`),this.hls.trigger(I.AUDIO_TRACKS_UPDATED,a);const o=this.trackId;if(-1!==n&&-1===o)this.setAudioTrack(n);else if(t.length&&-1===o){var s;const e=new Error(`No audio track selected for current audio group-ID(s): ${null==(s=this.groupIds)?void 0:s.join(",")} track count: ${t.length}`);this.warn(e.message),this.hls.trigger(I.ERROR,{type:x.MEDIA_ERROR,details:P.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:e})}}else this.shouldReloadPlaylist(i)&&this.setAudioTrack(this.trackId)}onError(t,e){!e.fatal&&e.context&&(e.context.type!==je||e.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(e.context.groupId)||(this.requestScheduled=-1,this.checkRetry(e)))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}setAudioOption(t){const e=this.hls;if(e.config.audioPreference=t,t){const r=this.allAudioTracks;if(this.selectDefaultTrack=!1,r.length){const n=this.currentTrack;if(n&&Jr(t,n,Zr))return n;const i=Qr(t,this.tracksInGroup,Zr);if(i>-1){const t=this.tracksInGroup[i];return this.setAudioTrack(i),t}if(n){let n=e.loadLevel;-1===n&&(n=e.firstAutoLevel);const i=function(t,e,r,n,i){const s=e[n],a=e.reduce(((t,e,r)=>{const n=e.uri;return(t[n]||(t[n]=[])).push(r),t}),{})[s.uri];a.length>1&&(n=Math.max.apply(Math,a));const o=s.videoRange,l=s.frameRate,c=s.codecSet.substring(0,4),u=tn(e,n,(e=>{if(e.videoRange!==o||e.frameRate!==l||e.codecSet.substring(0,4)!==c)return!1;const n=e.audioGroups,s=r.filter((t=>!n||-1!==n.indexOf(t.groupId)));return Qr(t,s,i)>-1}));return u>-1?u:tn(e,n,(e=>{const n=e.audioGroups,s=r.filter((t=>!n||-1!==n.indexOf(t.groupId)));return Qr(t,s,i)>-1}))}(t,e.levels,r,n,Zr);if(-1===i)return null;e.nextLoadLevel=i}if(t.channels||t.audioCodec){const e=Qr(t,r);if(e>-1)return r[e]}}}return null}setAudioTrack(t){const e=this.tracksInGroup;if(t<0||t>=e.length)return void this.warn(`Invalid audio track id: ${t}`);this.clearTimer(),this.selectDefaultTrack=!1;const r=this.currentTrack,n=e[t],i=n.details&&!n.details.live;if(t===this.trackId&&n===r&&i)return;if(this.log(`Switching to audio-track ${t} "${n.name}" lang:${n.lang} group:${n.groupId} channels:${n.channels}`),this.trackId=t,this.currentTrack=n,this.hls.trigger(I.AUDIO_TRACK_SWITCHING,_({},n)),i)return;const s=this.switchParams(n.url,null==r?void 0:r.details,n.details);this.loadPlaylist(s)}findTrackId(t){const e=this.tracksInGroup;for(let r=0;r<e.length;r++){const n=e[r];if((!this.selectDefaultTrack||n.default)&&(!t||Jr(t,n,Zr)))return r}if(t){const{name:r,lang:n,assocLang:i,characteristics:s,audioCodec:a,channels:o}=t;for(let t=0;t<e.length;t++){if(Jr({name:r,lang:n,assocLang:i,characteristics:s,audioCodec:a,channels:o},e[t],Zr))return t}for(let r=0;r<e.length;r++){const n=e[r];if(zi(t.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<e.length;r++){const n=e[r];if(zi(t.attrs,n.attrs,["LANGUAGE"]))return r}}return-1}loadPlaylist(t){const e=this.currentTrack;if(this.shouldLoadPlaylist(e)&&e){super.loadPlaylist();const r=e.id,n=e.groupId;let i=e.url;if(t)try{i=t.addDirectives(i)}catch(t){this.warn(`Could not construct new URL with HLS Delivery Directives: ${t}`)}this.log(`loading audio-track playlist ${r} "${e.name}" lang:${e.lang} group:${n}`),this.clearTimer(),this.hls.trigger(I.AUDIO_TRACK_LOADING,{url:i,id:r,groupId:n,deliveryDirectives:t||null})}}},emeController:Qs,cmcdController:class{constructor(t){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=t=>{try{this.apply(t,{ot:Zs.MANIFEST,su:!this.initialized})}catch(t){N.warn("Could not generate manifest CMCD data.",t)}},this.applyFragmentData=t=>{try{const e=t.frag,r=this.hls.levels[e.level],n=this.getObjectType(e),i={d:1e3*e.duration,ot:n};n!==Zs.VIDEO&&n!==Zs.AUDIO&&n!=Zs.MUXED||(i.br=r.bitrate/1e3,i.tb=this.getTopBandwidth(n)/1e3,i.bl=this.getBufferLength(n)),this.apply(t,i)}catch(t){N.warn("Could not generate segment CMCD data.",t)}},this.hls=t;const e=this.config=t.config,{cmcd:r}=e;null!=r&&(e.pLoader=this.createPlaylistLoader(),e.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||function(){try{return crypto.randomUUID()}catch(t){try{const t=URL.createObjectURL(new Blob),e=t.toString();return URL.revokeObjectURL(t),e.slice(e.lastIndexOf("/")+1)}catch(t){let e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?r:3&r|8).toString(16)}))}}}(),this.cid=r.contentId,this.useHeaders=!0===r.useHeaders,this.includeKeys=r.includeKeys,this.registerListeners())}registerListeners(){const t=this.hls;t.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(I.MEDIA_DETACHED,this.onMediaDetached,this),t.on(I.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const t=this.hls;t.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(I.MEDIA_DETACHED,this.onMediaDetached,this),t.off(I.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(t,e){this.media=e.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(t,e){var r,n;this.audioBuffer=null==(r=e.tracks.audio)?void 0:r.buffer,this.videoBuffer=null==(n=e.tracks.video)?void 0:n.buffer}createData(){var t;return{v:1,sf:ta.HLS,sid:this.sid,cid:this.cid,pr:null==(t=this.media)?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(t,e={}){w(e,this.createData());const r=e.ot===Zs.INIT||e.ot===Zs.VIDEO||e.ot===Zs.MUXED;this.starved&&r&&(e.bs=!0,e.su=!0,this.starved=!1),null==e.su&&(e.su=this.buffering);const{includeKeys:n}=this;n&&(e=Object.keys(e).reduce(((t,r)=>(n.includes(r)&&(t[r]=e[r]),t)),{})),this.useHeaders?(t.headers||(t.headers={}),_a(t.headers,e)):t.url=La(t.url,e)}getObjectType(t){const{type:e}=t;return"subtitle"===e?Zs.TIMED_TEXT:"initSegment"===t.sn?Zs.INIT:"audio"===e?Zs.AUDIO:"main"===e?this.hls.audioTracks.length?Zs.VIDEO:Zs.MUXED:void 0}getTopBandwidth(t){let e,r=0;const n=this.hls;if(t===Zs.AUDIO)e=n.audioTracks;else{const t=n.maxAutoLevel,r=t>-1?t+1:n.levels.length;e=n.levels.slice(0,r)}for(const t of e)t.bitrate>r&&(r=t.bitrate);return r>0?r:NaN}getBufferLength(t){const e=this.hls.media,r=t===Zs.AUDIO?this.audioBuffer:this.videoBuffer;if(!r||!e)return NaN;return 1e3*hn.bufferInfo(r,e.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:t}=this.config,e=this.applyPlaylistData,r=t||this.config.loader;return class{constructor(t){this.loader=void 0,this.loader=new r(t)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(t,r,n){e(t),this.loader.load(t,r,n)}}}createFragmentLoader(){const{fLoader:t}=this.config,e=this.applyFragmentData,r=t||this.config.loader;return class{constructor(t){this.loader=void 0,this.loader=new r(t)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(t,r,n){e(t),this.loader.load(t,r,n)}}}},contentSteeringController:class{constructor(t){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=t,this.log=N.log.bind(N,"[content-steering]:"),this.registerListeners()}registerListeners(){const t=this.hls;t.on(I.MANIFEST_LOADING,this.onManifestLoading,this),t.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(I.MANIFEST_PARSED,this.onManifestParsed,this),t.on(I.ERROR,this.onError,this)}unregisterListeners(){const t=this.hls;t&&(t.off(I.MANIFEST_LOADING,this.onManifestLoading,this),t.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(I.MANIFEST_PARSED,this.onManifestParsed,this),t.off(I.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const t=1e3*this.timeToLoad-(performance.now()-this.updated);if(t>0)return void this.scheduleRefresh(this.uri,t)}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(t){const e=this.levels;e&&(this.levels=e.filter((e=>e!==t)))}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(t,e){const{contentSteering:r}=e;null!==r&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())}onManifestParsed(t,e){this.audioTracks=e.audioTracks,this.subtitleTracks=e.subtitleTracks}onError(t,e){const{errorAction:r}=e;if((null==r?void 0:r.action)===Fr&&r.flags===$r){const t=this.levels;let n=this.pathwayPriority,i=this.pathwayId;if(e.context){const{groupId:r,pathwayId:n,type:s}=e.context;r&&t?i=this.getPathwayForGroupId(r,s,i):n&&(i=n)}i in this.penalizedPathways||(this.penalizedPathways[i]=performance.now()),!n&&t&&(n=t.reduce(((t,e)=>(-1===t.indexOf(e.pathwayId)&&t.push(e.pathwayId),t)),[])),n&&n.length>1&&(this.updatePathwayPriority(n),r.resolved=this.pathwayId!==i),r.resolved||N.warn(`Could not resolve ${e.details} ("${e.error.message}") with content-steering for Pathway: ${i} levels: ${t?t.length:t} priorities: ${JSON.stringify(n)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(t){this.levels=t;let e=this.getLevelsForPathway(this.pathwayId);if(0===e.length){const r=t[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${r}"`),e=this.getLevelsForPathway(r),this.pathwayId=r}return e.length!==t.length&&this.log(`Found ${e.length}/${t.length} levels in Pathway "${this.pathwayId}"`),e}getLevelsForPathway(t){return null===this.levels?[]:this.levels.filter((e=>t===e.pathwayId))}updatePathwayPriority(t){let e;this.pathwayPriority=t;const r=this.penalizedPathways,n=performance.now();Object.keys(r).forEach((t=>{n-r[t]>3e5&&delete r[t]}));for(let n=0;n<t.length;n++){const i=t[n];if(i in r)continue;if(i===this.pathwayId)return;const s=this.hls.nextLoadLevel,a=this.hls.levels[s];if(e=this.getLevelsForPathway(i),e.length>0){this.log(`Setting Pathway to "${i}"`),this.pathwayId=i,kr(e),this.hls.trigger(I.LEVELS_UPDATED,{levels:e});const t=this.hls.levels[s];a&&t&&this.levels&&(t.attrs["STABLE-VARIANT-ID"]!==a.attrs["STABLE-VARIANT-ID"]&&t.bitrate!==a.bitrate&&this.log(`Unstable Pathways change from bitrate ${a.bitrate} to ${t.bitrate}`),this.hls.nextLoadLevel=s);break}}}getPathwayForGroupId(t,e,r){const n=this.getLevelsForPathway(r).concat(this.levels||[]);for(let r=0;r<n.length;r++)if(e===je&&n[r].hasAudioGroup(t)||e===Ge&&n[r].hasSubtitleGroup(t))return n[r].pathwayId;return r}clonePathways(t){const e=this.levels;if(!e)return;const r={},n={};t.forEach((t=>{const{ID:i,"BASE-ID":s,"URI-REPLACEMENT":a}=t;if(e.some((t=>t.pathwayId===i)))return;const o=this.getLevelsForPathway(s).map((t=>{const e=new j(t.attrs);e["PATHWAY-ID"]=i;const s=e.AUDIO&&`${e.AUDIO}_clone_${i}`,o=e.SUBTITLES&&`${e.SUBTITLES}_clone_${i}`;s&&(r[e.AUDIO]=s,e.AUDIO=s),o&&(n[e.SUBTITLES]=o,e.SUBTITLES=o);const l=Ra(t.uri,e["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",a),c=new mr({attrs:e,audioCodec:t.audioCodec,bitrate:t.bitrate,height:t.height,name:t.name,url:l,videoCodec:t.videoCodec,width:t.width});if(t.audioGroups)for(let e=1;e<t.audioGroups.length;e++)c.addGroupId("audio",`${t.audioGroups[e]}_clone_${i}`);if(t.subtitleGroups)for(let e=1;e<t.subtitleGroups.length;e++)c.addGroupId("text",`${t.subtitleGroups[e]}_clone_${i}`);return c}));e.push(...o),wa(this.audioTracks,r,a,i),wa(this.subtitleTracks,n,a,i)}))}loadSteeringManifest(t){const e=this.hls.config,r=e.loader;let n;this.loader&&this.loader.destroy(),this.loader=new r(e);try{n=new self.URL(t)}catch(e){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest URI: ${t}`)}if("data:"!==n.protocol){const t=0|(this.hls.bandwidthEstimate||e.abrEwmaDefaultEstimate);n.searchParams.set("_HLS_pathway",this.pathwayId),n.searchParams.set("_HLS_throughput",""+t)}const i={responseType:"json",url:n.href},s=e.steeringManifestLoadPolicy.default,a=s.errorRetry||s.timeoutRetry||{},o={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(t,e,r,i)=>{this.log(`Loaded steering manifest: "${n}"`);const s=t.data;if(1!==s.VERSION)return void this.log(`Steering VERSION ${s.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=s.TTL;const{"RELOAD-URI":a,"PATHWAY-CLONES":o,"PATHWAY-PRIORITY":l}=s;if(a)try{this.uri=new self.URL(a,n).href}catch(t){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${a}`)}this.scheduleRefresh(this.uri||r.url),o&&this.clonePathways(o);const c={steeringManifest:s,url:n.toString()};this.hls.trigger(I.STEERING_MANIFEST_LOADED,c),l&&this.updatePathwayPriority(l)},onError:(t,e,r,n)=>{if(this.log(`Error loading steering manifest: ${t.code} ${t.text} (${e.url})`),this.stopLoad(),410===t.code)return this.enabled=!1,void this.log(`Steering manifest ${e.url} no longer available`);let i=1e3*this.timeToLoad;if(429!==t.code)this.scheduleRefresh(this.uri||e.url,i);else{const t=this.loader;if("function"==typeof(null==t?void 0:t.getResponseHeader)){const e=t.getResponseHeader("Retry-After");e&&(i=1e3*parseFloat(e))}this.log(`Steering manifest ${e.url} rate limited`)}},onTimeout:(t,e,r)=>{this.log(`Timeout loading steering manifest (${e.url})`),this.scheduleRefresh(this.uri||e.url)}};this.log(`Requesting steering manifest: ${n}`),this.loader.load(i,o,l)}scheduleRefresh(t,e=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout((()=>{var e;const r=null==(e=this.hls)?void 0:e.media;!r||r.ended?this.scheduleRefresh(t,1e3*this.timeToLoad):this.loadSteeringManifest(t)}),e)}}});function Na(t){return t&&"object"==typeof t?Array.isArray(t)?t.map(Na):Object.keys(t).reduce(((e,r)=>(e[r]=Na(t[r]),e)),{}):t}function Ua(t){const e=t.loader;if(e!==xa&&e!==Da)N.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(t){}return!1})()&&(t.loader=xa,t.progressive=!0,t.enableSoftwareAES=!0,N.log("[config]: Progressive streaming enabled, using FetchLoader"))}}let $a;class ja extends Gr{constructor(t,e){super(t,"[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=e,this._registerListeners()}_registerListeners(){const{hls:t}=this;t.on(I.MANIFEST_LOADING,this.onManifestLoading,this),t.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(I.LEVEL_LOADED,this.onLevelLoaded,this),t.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(I.FRAG_BUFFERED,this.onFragBuffered,this),t.on(I.ERROR,this.onError,this)}_unregisterListeners(){const{hls:t}=this;t.off(I.MANIFEST_LOADING,this.onManifestLoading,this),t.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(I.LEVEL_LOADED,this.onLevelLoaded,this),t.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(I.FRAG_BUFFERED,this.onFragBuffered,this),t.off(I.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach((t=>{t.loadError=0,t.fragmentError=0})),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(t,e){this.resetLevels()}onManifestLoaded(t,e){const r=this.hls.config.preferManagedMediaSource,n=[],i={},s={};let a=!1,o=!1,l=!1;e.levels.forEach((t=>{var e,c;const u=t.attrs;let{audioCodec:h,videoCodec:d}=t;-1!==(null==(e=h)?void 0:e.indexOf("mp4a.40.34"))&&($a||($a=/chrome|firefox/i.test(navigator.userAgent)),$a&&(t.audioCodec=h=void 0)),h&&(t.audioCodec=h=_e(h,r)),0===(null==(c=d)?void 0:c.indexOf("avc1"))&&(d=t.videoCodec=function(t){const e=t.split(",");for(let t=0;t<e.length;t++){const r=e[t].split(".");if(r.length>2){let n=r.shift()+".";n+=parseInt(r.shift()).toString(16),n+=("000"+parseInt(r.shift()).toString(16)).slice(-4),e[t]=n}}return e.join(",")}(d));const{width:f,height:p,unknownCodecs:g}=t;if(a||(a=!(!f||!p)),o||(o=!!d),l||(l=!!h),null!=g&&g.length||h&&!ye(h,"audio",r)||d&&!ye(d,"video",r))return;const{CODECS:m,"FRAME-RATE":y,"HDCP-LEVEL":v,"PATHWAY-ID":E,RESOLUTION:b,"VIDEO-RANGE":T}=u,S=`${`${E||"."}-`}${t.bitrate}-${b}-${y}-${m}-${T}-${v}`;if(i[S])if(i[S].uri===t.url||t.attrs["PATHWAY-ID"])i[S].addGroupId("audio",u.AUDIO),i[S].addGroupId("text",u.SUBTITLES);else{const e=s[S]+=1;t.attrs["PATHWAY-ID"]=new Array(e+1).join(".");const r=new mr(t);i[S]=r,n.push(r)}else{const e=new mr(t);i[S]=e,s[S]=1,n.push(e)}})),this.filterAndSortMediaOptions(n,e,a,o,l)}filterAndSortMediaOptions(t,e,r,n,i){let s=[],a=[],o=t;if((r||n)&&i&&(o=o.filter((({videoCodec:t,videoRange:e,width:r,height:n})=>{return(!!t||!(!r||!n))&&(!!(i=e)&&ur.indexOf(i)>-1);var i}))),0===o.length)return void Promise.resolve().then((()=>{if(this.hls){e.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(e.levels[0].attrs)}`);const t=new Error("no level with compatible codecs found in manifest");this.hls.trigger(I.ERROR,{type:x.MEDIA_ERROR,details:P.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:e.url,error:t,reason:t.message})}}));if(e.audioTracks){const{preferManagedMediaSource:t}=this.hls.config;s=e.audioTracks.filter((e=>!e.audioCodec||ye(e.audioCodec,"audio",t))),Ga(s)}e.subtitles&&(a=e.subtitles,Ga(a));const l=o.slice(0);o.sort(((t,e)=>{if(t.attrs["HDCP-LEVEL"]!==e.attrs["HDCP-LEVEL"])return(t.attrs["HDCP-LEVEL"]||"")>(e.attrs["HDCP-LEVEL"]||"")?1:-1;if(r&&t.height!==e.height)return t.height-e.height;if(t.frameRate!==e.frameRate)return t.frameRate-e.frameRate;if(t.videoRange!==e.videoRange)return ur.indexOf(t.videoRange)-ur.indexOf(e.videoRange);if(t.videoCodec!==e.videoCodec){const r=be(t.videoCodec),n=be(e.videoCodec);if(r!==n)return n-r}if(t.uri===e.uri&&t.codecSet!==e.codecSet){const r=Te(t.codecSet),n=Te(e.codecSet);if(r!==n)return n-r}return t.averageBitrate!==e.averageBitrate?t.averageBitrate-e.averageBitrate:0}));let c=l[0];if(this.steering&&(o=this.steering.filterParsedLevels(o),o.length!==l.length))for(let t=0;t<l.length;t++)if(l[t].pathwayId===o[0].pathwayId){c=l[t];break}this._levels=o;for(let t=0;t<o.length;t++)if(o[t]===c){var u;this._firstLevel=t;const e=c.bitrate,r=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${o.length} level(s) found, first bitrate: ${e}`),void 0===(null==(u=this.hls.userConfig)?void 0:u.abrEwmaDefaultEstimate)){const t=Math.min(e,this.hls.config.abrEwmaDefaultEstimateMax);t>r&&r===Ba.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=t)}break}const h=i&&!n,d={levels:o,audioTracks:s,subtitleTracks:a,sessionData:e.sessionData,sessionKeys:e.sessionKeys,firstLevel:this._firstLevel,stats:e.stats,audio:i,video:n,altAudio:!h&&s.some((t=>!!t.url))};this.hls.trigger(I.MANIFEST_PARSED,d),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return 0===this._levels.length?null:this._levels}get level(){return this.currentLevelIndex}set level(t){const e=this._levels;if(0===e.length)return;if(t<0||t>=e.length){const r=new Error("invalid level idx"),n=t<0;if(this.hls.trigger(I.ERROR,{type:x.OTHER_ERROR,details:P.LEVEL_SWITCH_ERROR,level:t,fatal:n,error:r,reason:r.message}),n)return;t=Math.min(t,e.length-1)}const r=this.currentLevelIndex,n=this.currentLevel,i=n?n.attrs["PATHWAY-ID"]:void 0,s=e[t],a=s.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=s,r===t&&s.details&&n&&i===a)return;this.log(`Switching to level ${t} (${s.height?s.height+"p ":""}${s.videoRange?s.videoRange+" ":""}${s.codecSet?s.codecSet+" ":""}@${s.bitrate})${a?" with Pathway "+a:""} from level ${r}${i?" with Pathway "+i:""}`);const o={level:t,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(I.LEVEL_SWITCHING,o);const l=s.details;if(!l||l.live){const t=this.switchParams(s.uri,null==n?void 0:n.details,l);this.loadPlaylist(t)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(t){this.manualLevelIndex=t,void 0===this._startLevel&&(this._startLevel=t),-1!==t&&(this.level=t)}get firstLevel(){return this._firstLevel}set firstLevel(t){this._firstLevel=t}get startLevel(){if(void 0===this._startLevel){const t=this.hls.config.startLevel;return void 0!==t?t:this.hls.firstAutoLevel}return this._startLevel}set startLevel(t){this._startLevel=t}onError(t,e){!e.fatal&&e.context&&e.context.type===$e&&e.context.level===this.level&&this.checkRetry(e)}onFragBuffered(t,{frag:e}){if(void 0!==e&&e.type===Ke){const t=e.elementaryStreams;if(!Object.keys(t).some((e=>!!t[e])))return;const r=this._levels[e.level];null!=r&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(t,e){var r;const{level:n,details:i}=e,s=this._levels[n];var a;if(!s)return this.warn(`Invalid level index ${n}`),void(null!=(a=e.deliveryDirectives)&&a.skip&&(i.deltaUpdateFailed=!0));n===this.currentLevelIndex?(0===s.fragmentError&&(s.loadError=0),this.playlistLoaded(n,e,s.details)):null!=(r=e.deliveryDirectives)&&r.skip&&(i.deltaUpdateFailed=!0)}loadPlaylist(t){super.loadPlaylist();const e=this.currentLevelIndex,r=this.currentLevel;if(r&&this.shouldLoadPlaylist(r)){let n=r.uri;if(t)try{n=t.addDirectives(n)}catch(t){this.warn(`Could not construct new URL with HLS Delivery Directives: ${t}`)}const i=r.attrs["PATHWAY-ID"];this.log(`Loading level index ${e}${void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:""} with${i?" Pathway "+i:""} ${n}`),this.clearTimer(),this.hls.trigger(I.LEVEL_LOADING,{url:n,level:e,pathwayId:r.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(t){this.level=t,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=t)}removeLevel(t){var e;const r=this._levels.filter(((e,r)=>r!==t||(this.steering&&this.steering.removeLevel(e),e===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,e.details&&e.details.fragments.forEach((t=>t.level=-1))),!1)));kr(r),this._levels=r,this.currentLevelIndex>-1&&null!=(e=this.currentLevel)&&e.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(I.LEVELS_UPDATED,{levels:r})}onLevelsUpdated(t,{levels:e}){this._levels=e}checkMaxAutoUpdated(){const{autoLevelCapping:t,maxAutoLevel:e,maxHdcpLevel:r}=this.hls;this._maxAutoLevel!==e&&(this._maxAutoLevel=e,this.hls.trigger(I.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:e,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:r}))}}function Ga(t){const e={};t.forEach((t=>{const r=t.groupId||"";t.id=e[r]=e[r]||0,e[r]++}))}class Ka{constructor(t){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=t}abort(t){for(const r in this.keyUriToKeyInfo){const n=this.keyUriToKeyInfo[r].loader;if(n){var e;if(t&&t!==(null==(e=n.context)?void 0:e.frag.type))return;n.abort()}}}detach(){for(const t in this.keyUriToKeyInfo){const e=this.keyUriToKeyInfo[t];(e.mediaKeySessionContext||e.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[t]}}destroy(){this.detach();for(const t in this.keyUriToKeyInfo){const e=this.keyUriToKeyInfo[t].loader;e&&e.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(t,e=P.KEY_LOAD_ERROR,r,n,i){return new Sn({type:x.NETWORK_ERROR,details:e,fatal:!1,frag:t,response:i,error:r,networkDetails:n})}loadClear(t,e){if(this.emeController&&this.config.emeEnabled){const{sn:r,cc:n}=t;for(let t=0;t<e.length;t++){const i=e[t];if(n<=i.cc&&("initSegment"===r||"initSegment"===i.sn||r<i.sn)){this.emeController.selectKeySystemFormat(i).then((t=>{i.setKeyFormat(t)}));break}}}}load(t){return!t.decryptdata&&t.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(t).then((e=>this.loadInternal(t,e))):this.loadInternal(t)}loadInternal(t,e){var r,n;e&&t.setKeyFormat(e);const i=t.decryptdata;if(!i){const r=new Error(e?`Expected frag.decryptdata to be defined after setting format ${e}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(t,P.KEY_LOAD_ERROR,r))}const s=i.uri;if(!s)return Promise.reject(this.createKeyLoadError(t,P.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${s}"`)));let a=this.keyUriToKeyInfo[s];if(null!=(r=a)&&r.decryptdata.key)return i.key=a.decryptdata.key,Promise.resolve({frag:t,keyInfo:a});var o;if(null!=(n=a)&&n.keyLoadPromise)switch(null==(o=a.mediaKeySessionContext)?void 0:o.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then((e=>(i.key=e.keyInfo.decryptdata.key,{frag:t,keyInfo:a})))}switch(a=this.keyUriToKeyInfo[s]={decryptdata:i,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},i.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===i.keyFormat?this.loadKeyHTTP(a,t):this.loadKeyEME(a,t);case"AES-128":return this.loadKeyHTTP(a,t);default:return Promise.reject(this.createKeyLoadError(t,P.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${i.method}"`)))}}loadKeyEME(t,e){const r={frag:e,keyInfo:t};if(this.emeController&&this.config.emeEnabled){const e=this.emeController.loadKey(r);if(e)return(t.keyLoadPromise=e.then((e=>(t.mediaKeySessionContext=e,r)))).catch((e=>{throw t.keyLoadPromise=null,e}))}return Promise.resolve(r)}loadKeyHTTP(t,e){const r=this.config,n=new(0,r.loader)(r);return e.keyLoader=t.loader=n,t.keyLoadPromise=new Promise(((i,s)=>{const a={keyInfo:t,frag:e,responseType:"arraybuffer",url:t.decryptdata.uri},o=r.keyLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(t,e,r,n)=>{const{frag:a,keyInfo:o,url:l}=r;if(!a.decryptdata||o!==this.keyUriToKeyInfo[l])return s(this.createKeyLoadError(a,P.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),n));o.decryptdata.key=a.decryptdata.key=new Uint8Array(t.data),a.keyLoader=null,o.loader=null,i({frag:a,keyInfo:o})},onError:(t,r,n,i)=>{this.resetLoader(r),s(this.createKeyLoadError(e,P.KEY_LOAD_ERROR,new Error(`HTTP Error ${t.code} loading key ${t.text}`),n,_({url:a.url,data:void 0},t)))},onTimeout:(t,r,n)=>{this.resetLoader(r),s(this.createKeyLoadError(e,P.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),n))},onAbort:(t,r,n)=>{this.resetLoader(r),s(this.createKeyLoadError(e,P.INTERNAL_ABORTED,new Error("key loading aborted"),n))}};n.load(a,l,c)}))}resetLoader(t){const{frag:e,keyInfo:r,url:n}=t,i=r.loader;e.keyLoader===i&&(e.keyLoader=null,r.loader=null),delete this.keyUriToKeyInfo[n],i&&i.destroy()}}function Ha(){return self.SourceBuffer||self.WebKitSourceBuffer}function Va(){if(!ge())return!1;const t=Ha();return!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove}class Wa{constructor(t,e,r,n){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=t,this.media=e,this.fragmentTracker=r,this.hls=n}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(t,e){const{config:r,media:n,stalled:i}=this;if(null===n)return;const{currentTime:s,seeking:a}=n,o=this.seeking&&!a,l=!this.seeking&&a;if(this.seeking=a,s!==t){if(this.moved=!0,a||(this.nudgeRetry=0),null!==i){if(this.stallReported){const t=self.performance.now()-i;N.warn(`playback not stuck anymore @${s}, after ${Math.round(t)}ms`),this.stallReported=!1}this.stalled=null}return}if(l||o)return void(this.stalled=null);if(n.paused&&!a||n.ended||0===n.playbackRate||!hn.getBuffered(n).length)return void(this.nudgeRetry=0);const c=hn.bufferInfo(n,s,0),u=c.nextStart||0;if(a){const t=c.len>2,r=!u||e&&e.start<=s||u-s>2&&!this.fragmentTracker.getPartialFragment(s);if(t||r)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var h;if(!(c.len>0)&&!u)return;const t=Math.max(u,c.start||0)-s,e=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,r=(null==e||null==(h=e.details)?void 0:h.live)?2*e.details.targetduration:2,i=this.fragmentTracker.getPartialFragment(s);if(t>0&&(t<=r||i))return void(n.paused||this._trySkipBufferHole(i))}const d=self.performance.now();if(null===i)return void(this.stalled=d);const f=d-i;if(!a&&f>=250&&(this._reportStall(c),!this.media))return;const p=hn.bufferInfo(n,s,r.maxBufferHole);this._tryFixBufferStall(p,f)}_tryFixBufferStall(t,e){const{config:r,fragmentTracker:n,media:i}=this;if(null===i)return;const s=i.currentTime,a=n.getPartialFragment(s);if(a){if(this._trySkipBufferHole(a)||!this.media)return}(t.len>r.maxBufferHole||t.nextStart&&t.nextStart-s<r.maxBufferHole)&&e>1e3*r.highBufferWatchdogPeriod&&(N.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(t){const{hls:e,media:r,stallReported:n}=this;if(!n&&r){this.stallReported=!0;const n=new Error(`Playback stalling at @${r.currentTime} due to low buffer (${JSON.stringify(t)})`);N.warn(n.message),e.trigger(I.ERROR,{type:x.MEDIA_ERROR,details:P.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:t.len})}}_trySkipBufferHole(t){const{config:e,hls:r,media:n}=this;if(null===n)return 0;const i=n.currentTime,s=hn.bufferInfo(n,i,0),a=i<s.start?s.start:s.nextStart;if(a){const o=s.len<=e.maxBufferHole,l=s.len>0&&s.len<1&&n.readyState<3,c=a-i;if(c>0&&(o||l)){if(c>e.maxBufferHole){const{fragmentTracker:e}=this;let r=!1;if(0===i){const t=e.getAppendedFrag(0,Ke);t&&a<t.end&&(r=!0)}if(!r){const r=t||e.getAppendedFrag(i,Ke);if(r){let t=!1,n=r.end;for(;n<a;){const r=e.getPartialFragment(n);if(!r){t=!0;break}n+=r.duration}if(t)return 0}}}const s=Math.max(a+.05,i+.1);if(N.warn(`skipping hole, adjusting currentTime from ${i} to ${s}`),this.moved=!0,this.stalled=null,n.currentTime=s,t&&!t.gap){const e=new Error(`fragment loaded with buffer holes, seeking from ${i} to ${s}`);r.trigger(I.ERROR,{type:x.MEDIA_ERROR,details:P.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:e,reason:e.message,frag:t})}return s}}return 0}_tryNudgeBuffer(){const{config:t,hls:e,media:r,nudgeRetry:n}=this;if(null===r)return;const i=r.currentTime;if(this.nudgeRetry++,n<t.nudgeMaxRetry){const s=i+(n+1)*t.nudgeOffset,a=new Error(`Nudging 'currentTime' from ${i} to ${s}`);N.warn(a.message),r.currentTime=s,e.trigger(I.ERROR,{type:x.MEDIA_ERROR,details:P.BUFFER_NUDGE_ON_STALL,error:a,fatal:!1})}else{const r=new Error(`Playhead still not moving while enough data buffered @${i} after ${t.nudgeMaxRetry} nudges`);N.error(r.message),e.trigger(I.ERROR,{type:x.MEDIA_ERROR,details:P.BUFFER_STALLED_ERROR,error:r,fatal:!0})}}}class Ya extends $n{constructor(t,e,r){super(t,e,r,"[stream-controller]",Ke),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:t}=this;t.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(I.MANIFEST_LOADING,this.onManifestLoading,this),t.on(I.MANIFEST_PARSED,this.onManifestParsed,this),t.on(I.LEVEL_LOADING,this.onLevelLoading,this),t.on(I.LEVEL_LOADED,this.onLevelLoaded,this),t.on(I.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(I.ERROR,this.onError,this),t.on(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(I.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(I.BUFFER_CREATED,this.onBufferCreated,this),t.on(I.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:t}=this;t.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(I.MANIFEST_LOADING,this.onManifestLoading,this),t.off(I.MANIFEST_PARSED,this.onManifestParsed,this),t.off(I.LEVEL_LOADED,this.onLevelLoaded,this),t.off(I.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(I.ERROR,this.onError,this),t.off(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(I.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(I.BUFFER_CREATED,this.onBufferCreated,this),t.off(I.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(t){if(this.levels){const{lastCurrentTime:e,hls:r}=this;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){let t=r.startLevel;-1===t&&(r.config.testBandwidth&&this.levels.length>1?(t=0,this.bitrateTest=!0):t=r.firstAutoLevel),r.nextLoadLevel=t,this.level=r.loadLevel,this.loadedmetadata=!1}e>0&&-1===t&&(this.log(`Override startPosition with lastCurrentTime @${e.toFixed(3)}`),t=e),this.state=Cn,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=Rn}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Un:{const{levels:t,level:e}=this,r=null==t?void 0:t[e],n=null==r?void 0:r.details;if(n&&(!n.live||this.levelLastLoaded===r)){if(this.waitForCdnTuneIn(n))break;this.state=Cn;break}if(this.hls.nextLoadLevel!==this.level){this.state=Cn;break}break}case xn:{var t;const e=self.performance.now(),r=this.retryDate;if(!r||e>=r||null!=(t=this.media)&&t.seeking){const{levels:t,level:e}=this,r=null==t?void 0:t[e];this.resetStartWhenNotLoaded(r||null),this.state=Cn}}}this.state===Cn&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:t,levelLastLoaded:e,levels:r,media:n}=this;if(null===e||!n&&(this.startFragRequested||!t.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const i=t.nextLoadLevel;if(null==r||!r[i])return;const s=r[i],a=this.getMainFwdBufferInfo();if(null===a)return;const o=this.getLevelDetails();if(o&&this._streamEnded(a,o)){const t={};return this.altAudio&&(t.type="video"),this.hls.trigger(I.BUFFER_EOS,t),void(this.state=Fn)}t.loadLevel!==i&&-1===t.manualLevel&&this.log(`Adapting to level ${i} from level ${this.level}`),this.level=t.nextLoadLevel=i;const l=s.details;if(!l||this.state===Un||l.live&&this.levelLastLoaded!==s)return this.level=i,void(this.state=Un);const c=a.len,u=this.getMaxBufferLength(s.maxBitrate);if(c>=u)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const h=this.backtrackFragment?this.backtrackFragment.start:a.end;let d=this.getNextFragment(h,l);if(this.couldBacktrack&&!this.fragPrevious&&d&&"initSegment"!==d.sn&&this.fragmentTracker.getState(d)!==an){var f;const t=(null!=(f=this.backtrackFragment)?f:d).sn-l.startSN,e=l.fragments[t-1];e&&d.cc===e.cc&&(d=e,this.fragmentTracker.removeFragment(e))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(d&&this.isLoopLoading(d,h)){if(!d.gap){const t=this.audioOnly&&!this.altAudio?V:W,e=(t===W?this.videoBuffer:this.mediaBuffer)||this.media;e&&this.afterBufferFlushed(e,t,Ke)}d=this.getNextFragmentLoopLoading(d,l,a,Ke,u)}d&&(!d.initSegment||d.initSegment.data||this.bitrateTest||(d=d.initSegment),this.loadFragment(d,s,h))}loadFragment(t,e,r){const n=this.fragmentTracker.getState(t);this.fragCurrent=t,n===rn||n===sn?"initSegment"===t.sn?this._loadInitSegment(t,e):this.bitrateTest?(this.log(`Fragment ${t.sn} of level ${t.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(t,e)):(this.startFragRequested=!0,super.loadFragment(t,e,r)):this.clearTrackerIfNeeded(t)}getBufferedFrag(t){return this.fragmentTracker.getBufferedFrag(t,Ke)}followingBufferedFrag(t){return t?this.getBufferedFrag(t.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:t,media:e}=this;if(null!=e&&e.readyState){let r;const n=this.getAppendedFrag(e.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.start-1);const i=this.getLevelDetails();if(null!=i&&i.live){const t=this.getMainFwdBufferInfo();if(!t||t.len<2*i.targetduration)return}if(!e.paused&&t){const e=t[this.hls.nextLoadLevel],n=this.fragLastKbps;r=n&&this.fragCurrent?this.fragCurrent.duration*e.maxBitrate/(1e3*n)+1:0}else r=0;const s=this.getBufferedFrag(e.currentTime+r);if(s){const t=this.followingBufferedFrag(s);if(t){this.abortCurrentFrag();const e=t.maxStartPTS?t.maxStartPTS:t.start,r=t.duration,n=Math.max(s.end,e+Math.min(Math.max(r-this.config.maxFragLookUpTolerance,r*(this.couldBacktrack?.5:.125)),r*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(n,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const t=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,t&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.state){case Dn:case In:case xn:case On:case Mn:this.state=Cn}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(t,e){super.flushMainBuffer(t,e,this.altAudio?"video":null)}onMediaAttached(t,e){super.onMediaAttached(t,e);const r=e.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new Wa(this.config,r,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:t}=this;t&&this.onvplaying&&this.onvseeked&&(t.removeEventListener("playing",this.onvplaying),t.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const t=this.media,e=t?t.currentTime:null;R(e)&&this.log(`Media seeked to ${e.toFixed(3)}`);const r=this.getMainFwdBufferInfo();null!==r&&0!==r.len?this.tick():this.warn(`Main forward buffer length on "seeked" event ${r?r.len:"empty"})`)}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(I.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(t,e){let r=!1,n=!1;e.levels.forEach((t=>{const e=t.audioCodec;e&&(r=r||-1!==e.indexOf("mp4a.40.2"),n=n||-1!==e.indexOf("mp4a.40.5"))})),this.audioCodecSwitch=r&&n&&!function(){var t;const e=Ha();return"function"==typeof(null==e||null==(t=e.prototype)?void 0:t.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startFragRequested=!1}onLevelLoading(t,e){const{levels:r}=this;if(!r||this.state!==Cn)return;const n=r[e.level];(!n.details||n.details.live&&this.levelLastLoaded!==n||this.waitForCdnTuneIn(n.details))&&(this.state=Un)}onLevelLoaded(t,e){var r;const{levels:n}=this,i=e.level,s=e.details,a=s.totalduration;if(!n)return void this.warn(`Levels were reset while loading level ${i}`);this.log(`Level ${i} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""}, cc [${s.startCC}, ${s.endCC}] duration:${a}`);const o=n[i],l=this.fragCurrent;!l||this.state!==In&&this.state!==xn||l.level!==e.level&&l.loader&&this.abortCurrentFrag();let c=0;if(s.live||null!=(r=o.details)&&r.live){var u;if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;c=this.alignPlaylists(s,o.details,null==(u=this.levelLastLoaded)?void 0:u.details)}if(o.details=s,this.levelLastLoaded=o,this.hls.trigger(I.LEVEL_UPDATED,{details:s,level:i}),this.state===Un){if(this.waitForCdnTuneIn(s))return;this.state=Cn}this.startFragRequested?s.live&&this.synchronizeToLiveEdge(s):this.setStartPosition(s,c),this.tick()}_handleFragmentLoadProgress(t){var e;const{frag:r,part:n,payload:i}=t,{levels:s}=this;if(!s)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);const a=s[r.level],o=a.details;if(!o)return this.warn(`Dropping fragment ${r.sn} of level ${r.level} after level details were reset`),void this.fragmentTracker.removeFragment(r);const l=a.videoCodec,c=o.PTSKnown||!o.live,u=null==(e=r.initSegment)?void 0:e.data,h=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new Yi(this.hls,Ke,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=n?n.index:-1,p=-1!==f,g=new dn(r.level,r.sn,r.stats.chunkCount,i.byteLength,f,p),m=this.initPTS[r.cc];d.push(i,u,h,l,r,n,o.totalduration,c,g,m)}onAudioTrackSwitching(t,e){const r=this.altAudio;if(!!!e.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const t=this.fragCurrent;t&&(this.log("Switching to main audio track, cancel main fragment load"),t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const t=this.hls;r&&(t.trigger(I.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),t.trigger(I.AUDIO_TRACK_SWITCHED,e)}}onAudioTrackSwitched(t,e){const r=e.id,n=!!this.hls.audioTracks[r].url;if(n){const t=this.videoBuffer;t&&this.mediaBuffer!==t&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=t)}this.altAudio=n,this.tick()}onBufferCreated(t,e){const r=e.tracks;let n,i,s=!1;for(const t in r){const e=r[t];if("main"===e.id){if(i=t,n=e,"video"===t){const e=r[t];e&&(this.videoBuffer=e.buffer)}}else s=!0}s&&n?(this.log(`Alternate track found, use ${i}.buffered to schedule main fragment loading`),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media}onFragBuffered(t,e){const{frag:r,part:n}=e;if(r&&r.type!==Ke)return;if(this.fragContextChanged(r))return this.warn(`Fragment ${r.sn}${n?" p: "+n.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===Mn&&(this.state=Cn));const i=n?n.stats:r.stats;this.fragLastKbps=Math.round(8*i.total/(i.buffering.end-i.loading.first)),"initSegment"!==r.sn&&(this.fragPrevious=r),this.fragBufferedComplete(r,n)}onError(t,e){var r;if(e.fatal)this.state=Bn;else switch(e.details){case P.FRAG_GAP:case P.FRAG_PARSING_ERROR:case P.FRAG_DECRYPT_ERROR:case P.FRAG_LOAD_ERROR:case P.FRAG_LOAD_TIMEOUT:case P.KEY_LOAD_ERROR:case P.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ke,e);break;case P.LEVEL_LOAD_ERROR:case P.LEVEL_LOAD_TIMEOUT:case P.LEVEL_PARSING_ERROR:e.levelRetry||this.state!==Un||(null==(r=e.context)?void 0:r.type)!==$e||(this.state=Cn);break;case P.BUFFER_APPEND_ERROR:case P.BUFFER_FULL_ERROR:if(!e.parent||"main"!==e.parent)return;if(e.details===P.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(e)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case P.INTERNAL_EXCEPTION:this.recoverWorkerError(e)}}checkBuffer(){const{media:t,gapController:e}=this;if(t&&e&&t.readyState){if(this.loadedmetadata||!hn.getBuffered(t).length){const t=this.state!==Cn?this.fragCurrent:null;e.poll(this.lastCurrentTime,t)}this.lastCurrentTime=t.currentTime}}onFragLoadEmergencyAborted(){this.state=Cn,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(t,{type:e}){if(e!==V||this.audioOnly&&!this.altAudio){const t=(e===W?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(t,e,Ke),this.tick()}}onLevelsUpdated(t,e){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=e.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:t}=this;if(!t)return;const e=t.currentTime;let r=this.startPosition;if(r>=0&&e<r){if(t.seeking)return void this.log(`could not seek to ${r}, already seeking at ${e}`);const n=hn.getBuffered(t),i=(n.length?n.start(0):0)-r;i>0&&(i<this.config.maxBufferHole||i<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${i} to match buffer start`),r+=i,this.startPosition=r),this.log(`seek to target start position ${r} from current time ${e}`),t.currentTime=r}}_getAudioCodec(t){let e=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&e&&(this.log("Swapping audio codec"),e=-1!==e.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),e}_loadBitrateTestFrag(t,e){t.bitrateTest=!0,this._doFragLoad(t,e).then((r=>{const{hls:n}=this;if(!r||this.fragContextChanged(t))return;e.fragmentError=0,this.state=Cn,this.startFragRequested=!1,this.bitrateTest=!1;const i=t.stats;i.parsing.start=i.parsing.end=i.buffering.start=i.buffering.end=self.performance.now(),n.trigger(I.FRAG_LOADED,r),t.bitrateTest=!1}))}_handleTransmuxComplete(t){var e;const r="main",{hls:n}=this,{remuxResult:i,chunkMeta:s}=t,a=this.getCurrentContext(s);if(!a)return void this.resetWhenMissingContext(s);const{frag:o,part:l,level:c}=a,{video:u,text:h,id3:d,initSegment:f}=i,{details:p}=c,g=this.altAudio?void 0:i.audio;if(this.fragContextChanged(o))this.fragmentTracker.removeFragment(o);else{if(this.state=On,f){if(null!=f&&f.tracks){const t=o.initSegment||o;this._bufferInitSegment(c,f.tracks,t,s),n.trigger(I.FRAG_PARSING_INIT_SEGMENT,{frag:t,id:r,tracks:f.tracks})}const t=f.initPTS,e=f.timescale;R(t)&&(this.initPTS[o.cc]={baseTime:t,timescale:e},n.trigger(I.INIT_PTS_FOUND,{frag:o,id:r,initPTS:t,timescale:e}))}if(u&&p&&"initSegment"!==o.sn){const t=p.fragments[o.sn-1-p.startSN],e=o.sn===p.startSN,r=!t||o.cc>t.cc;if(!1!==i.independent){const{startPTS:t,endPTS:n,startDTS:i,endDTS:a}=u;if(l)l.elementaryStreams[u.type]={startPTS:t,endPTS:n,startDTS:i,endDTS:a};else if(u.firstKeyFrame&&u.independent&&1===s.id&&!r&&(this.couldBacktrack=!0),u.dropped&&u.independent){const i=this.getMainFwdBufferInfo(),s=(i?i.end:this.getLoadPosition())+this.config.maxBufferHole,l=u.firstKeyFramePTS?u.firstKeyFramePTS:t;if(!e&&s<l-this.config.maxBufferHole&&!r)return void this.backtrack(o);r&&(o.gap=!0),o.setElementaryStreamInfo(u.type,o.start,n,o.start,a,!0)}else e&&t>2&&(o.gap=!0);o.setElementaryStreamInfo(u.type,t,n,i,a),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(u,o,l,s,e||r)}else{if(!e&&!r)return void this.backtrack(o);o.gap=!0}}if(g){const{startPTS:t,endPTS:e,startDTS:r,endDTS:n}=g;l&&(l.elementaryStreams[V]={startPTS:t,endPTS:e,startDTS:r,endDTS:n}),o.setElementaryStreamInfo(V,t,e,r,n),this.bufferFragmentData(g,o,l,s)}if(p&&null!=d&&null!=(e=d.samples)&&e.length){const t={id:r,frag:o,details:p,samples:d.samples};n.trigger(I.FRAG_PARSING_METADATA,t)}if(p&&h){const t={id:r,frag:o,details:p,samples:h.samples};n.trigger(I.FRAG_PARSING_USERDATA,t)}}}_bufferInitSegment(t,e,r,n){if(this.state!==On)return;this.audioOnly=!!e.audio&&!e.video,this.altAudio&&!this.audioOnly&&delete e.audio;const{audio:i,video:s,audiovideo:a}=e;if(i){let e=t.audioCodec;const r=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){e&&(e=-1!==e.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");const t=i.metadata;t&&"channelCount"in t&&1!==(t.channelCount||1)&&-1===r.indexOf("firefox")&&(e="mp4a.40.5")}e&&-1!==e.indexOf("mp4a.40.5")&&-1!==r.indexOf("android")&&"audio/mpeg"!==i.container&&(e="mp4a.40.2",this.log(`Android: force audio codec to ${e}`)),t.audioCodec&&t.audioCodec!==e&&this.log(`Swapping manifest audio codec "${t.audioCodec}" for "${e}"`),i.levelCodec=e,i.id="main",this.log(`Init audio buffer, container:${i.container}, codecs[selected/level/parsed]=[${e||""}/${t.audioCodec||""}/${i.codec}]`)}s&&(s.levelCodec=t.videoCodec,s.id="main",this.log(`Init video buffer, container:${s.container}, codecs[level/parsed]=[${t.videoCodec||""}/${s.codec}]`)),a&&this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${t.codecs}/${a.codec}]`),this.hls.trigger(I.BUFFER_CODECS,e),Object.keys(e).forEach((t=>{const i=e[t].initSegment;null!=i&&i.byteLength&&this.hls.trigger(I.BUFFER_APPENDING,{type:t,data:i,frag:r,part:null,chunkMeta:n,parent:r.type})})),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Ke)}backtrack(t){this.couldBacktrack=!0,this.backtrackFragment=t,this.resetTransmuxer(),this.flushBufferGap(t),this.fragmentTracker.removeFragment(t),this.fragPrevious=null,this.nextLoadPosition=t.start,this.state=Cn}checkFragmentChanged(){const t=this.media;let e=null;if(t&&t.readyState>1&&!1===t.seeking){const r=t.currentTime;if(hn.isBuffered(t,r)?e=this.getAppendedFrag(r):hn.isBuffered(t,r+.1)&&(e=this.getAppendedFrag(r+.1)),e){this.backtrackFragment=null;const t=this.fragPlaying,r=e.level;t&&e.sn===t.sn&&t.level===r||(this.fragPlaying=e,this.hls.trigger(I.FRAG_CHANGED,{frag:e}),t&&t.level===r||this.hls.trigger(I.LEVEL_SWITCHED,{level:r}))}}}get nextLevel(){const t=this.nextBufferedFrag;return t?t.level:-1}get currentFrag(){const t=this.media;return t?this.fragPlaying||this.getAppendedFrag(t.currentTime):null}get currentProgramDateTime(){const t=this.media;if(t){const e=t.currentTime,r=this.currentFrag;if(r&&R(e)&&R(r.programDateTime)){const t=r.programDateTime+1e3*(e-r.start);return new Date(t)}}return null}get currentLevel(){const t=this.currentFrag;return t?t.level:-1}get nextBufferedFrag(){const t=this.currentFrag;return t?this.followingBufferedFrag(t):null}get forceStartLoad(){return this._forceStartLoad}}class qa{static get version(){return"1.5.17"}static isMSESupported(){return Va()}static isSupported(){return function(){if(!Va())return!1;const t=ge();return"function"==typeof(null==t?void 0:t.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some((e=>t.isTypeSupported(Ee(e,"video"))))||["mp4a.40.2","fLaC"].some((e=>t.isTypeSupported(Ee(e,"audio")))))}()}static getMediaSource(){return ge()}static get Events(){return I}static get ErrorTypes(){return x}static get ErrorDetails(){return P}static get DefaultConfig(){return qa.defaultConfig?qa.defaultConfig:Ba}static set DefaultConfig(t){qa.defaultConfig=t}constructor(t={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Wi,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,function(t,e){if("object"==typeof console&&!0===t||"object"==typeof t){B(t,"debug","log","info","warn","error");try{F.log(`Debug logs enabled for "${e}" in hls.js version 1.5.17`)}catch(t){F=M}}else F=M}(t.debug||!1,"Hls instance");const e=this.config=function(t,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==e.liveMaxLatencyDurationCount&&(void 0===e.liveSyncDurationCount||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==e.liveMaxLatencyDuration&&(void 0===e.liveSyncDuration||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const r=Na(t),n=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((t=>{const i=`${"level"===t?"playlist":t}LoadPolicy`,s=void 0===e[i],a=[];n.forEach((n=>{const o=`${t}Loading${n}`,l=e[o];if(void 0!==l&&s){a.push(o);const t=r[i].default;switch(e[i]={default:t},n){case"TimeOut":t.maxLoadTimeMs=l,t.maxTimeToFirstByteMs=l;break;case"MaxRetry":t.errorRetry.maxNumRetry=l,t.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":t.errorRetry.retryDelayMs=l,t.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":t.errorRetry.maxRetryDelayMs=l,t.timeoutRetry.maxRetryDelayMs=l}}})),a.length&&N.warn(`hls.js config: "${a.join('", "')}" setting(s) are deprecated, use "${i}": ${JSON.stringify(e[i])}`)})),_(_({},r),e)}(qa.DefaultConfig,t);this.userConfig=t,e.progressive&&Ua(e);const{abrController:r,bufferController:n,capLevelController:i,errorController:s,fpsController:a}=e,o=new s(this),l=this.abrController=new r(this),c=this.bufferController=new n(this),u=this.capLevelController=new i(this),h=new a(this),d=new qe(this),f=new or(this),p=e.contentSteeringController,g=p?new p(this):null,m=this.levelController=new ja(this,g),y=new on(this),v=new Ka(this.config),E=this.streamController=new Ya(this,y,v);u.setStreamController(E),h.setStreamController(E);const b=[d,m,E];g&&b.splice(1,0,g),this.networkControllers=b;const T=[l,c,u,h,f,y];this.audioTrackController=this.createController(e.audioTrackController,b);const S=e.audioStreamController;S&&b.push(new S(this,y,v)),this.subtitleTrackController=this.createController(e.subtitleTrackController,b);const A=e.subtitleStreamController;A&&b.push(new A(this,y,v)),this.createController(e.timelineController,T),v.emeController=this.emeController=this.createController(e.emeController,T),this.cmcdController=this.createController(e.cmcdController,T),this.latencyController=this.createController(lr,T),this.coreComponents=T,b.push(o);const k=o.onErrorOut;"function"==typeof k&&this.on(I.ERROR,k,o)}createController(t,e){if(t){const r=new t(this);return e&&e.push(r),r}return null}on(t,e,r=this){this._emitter.on(t,e,r)}once(t,e,r=this){this._emitter.once(t,e,r)}removeAllListeners(t){this._emitter.removeAllListeners(t)}off(t,e,r=this,n){this._emitter.off(t,e,r,n)}listeners(t){return this._emitter.listeners(t)}emit(t,e,r){return this._emitter.emit(t,e,r)}trigger(t,e){if(this.config.debug)return this.emit(t,t,e);try{return this.emit(t,t,e)}catch(e){if(N.error("An internal error happened while handling event "+t+'. Error message: "'+e.message+'". Here is a stacktrace:',e),!this.triggeringException){this.triggeringException=!0;const r=t===I.ERROR;this.trigger(I.ERROR,{type:x.OTHER_ERROR,details:P.INTERNAL_EXCEPTION,fatal:r,event:t,error:e}),this.triggeringException=!1}}return!1}listenerCount(t){return this._emitter.listenerCount(t)}destroy(){N.log("destroy"),this.trigger(I.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((t=>t.destroy())),this.networkControllers.length=0,this.coreComponents.forEach((t=>t.destroy())),this.coreComponents.length=0;const t=this.config;t.xhrSetup=t.fetchSetup=void 0,this.userConfig=null}attachMedia(t){N.log("attachMedia"),this._media=t,this.trigger(I.MEDIA_ATTACHING,{media:t})}detachMedia(){N.log("detachMedia"),this.trigger(I.MEDIA_DETACHING,void 0),this._media=null}loadSource(t){this.stopLoad();const e=this.media,r=this.url,n=this.url=S.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,N.log(`loadSource:${n}`),e&&r&&(r!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(e)),this.trigger(I.MANIFEST_LOADING,{url:t})}startLoad(t=-1){N.log(`startLoad(${t})`),this.started=!0,this.networkControllers.forEach((e=>{e.startLoad(t)}))}stopLoad(){N.log("stopLoad"),this.started=!1,this.networkControllers.forEach((t=>{t.stopLoad()}))}resumeBuffering(){this.started&&this.networkControllers.forEach((t=>{"fragmentLoader"in t&&t.startLoad(-1)}))}pauseBuffering(){this.networkControllers.forEach((t=>{"fragmentLoader"in t&&t.stopLoad()}))}swapAudioCodec(){N.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){N.log("recoverMediaError");const t=this._media;this.detachMedia(),t&&this.attachMedia(t)}removeLevel(t){this.levelController.removeLevel(t)}get levels(){const t=this.levelController.levels;return t||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(t){N.log(`set currentLevel:${t}`),this.levelController.manualLevel=t,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(t){N.log(`set nextLevel:${t}`),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(t){N.log(`set loadLevel:${t}`),this.levelController.manualLevel=t}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(t){this.levelController.nextLoadLevel=t}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(t){N.log(`set firstLevel:${t}`),this.levelController.firstLevel=t}get startLevel(){const t=this.levelController.startLevel;return-1===t&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:t}set startLevel(t){N.log(`set startLevel:${t}`),-1!==t&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(t){const e=!!t;e!==this.config.capLevelToPlayerSize&&(e?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=e)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimate():NaN}set bandwidthEstimate(t){this.abrController.resetEstimator(t)}get ttfbEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimateTTFB():NaN}set autoLevelCapping(t){this._autoLevelCapping!==t&&(N.log(`set autoLevelCapping:${t}`),this._autoLevelCapping=t,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(t){(function(t){return cr.indexOf(t)>-1})(t)&&this._maxHdcpLevel!==t&&(this._maxHdcpLevel=t,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:t,config:{minAutoBitrate:e}}=this;if(!t)return 0;const r=t.length;for(let n=0;n<r;n++)if(t[n].maxBitrate>=e)return n;return 0}get maxAutoLevel(){const{levels:t,autoLevelCapping:e,maxHdcpLevel:r}=this;let n;if(n=-1===e&&null!=t&&t.length?t.length-1:e,r)for(let e=n;e--;){const n=t[e].attrs["HDCP-LEVEL"];if(n&&n<=r)return e}return n}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(t){this.abrController.nextAutoLevel=t}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(t){var e;return null==(e=this.audioTrackController)?void 0:e.setAudioOption(t)}setSubtitleOption(t){var e;return null==(e=this.subtitleTrackController)||e.setSubtitleOption(t),null}get allAudioTracks(){const t=this.audioTrackController;return t?t.allAudioTracks:[]}get audioTracks(){const t=this.audioTrackController;return t?t.audioTracks:[]}get audioTrack(){const t=this.audioTrackController;return t?t.audioTrack:-1}set audioTrack(t){const e=this.audioTrackController;e&&(e.audioTrack=t)}get allSubtitleTracks(){const t=this.subtitleTrackController;return t?t.allSubtitleTracks:[]}get subtitleTracks(){const t=this.subtitleTrackController;return t?t.subtitleTracks:[]}get subtitleTrack(){const t=this.subtitleTrackController;return t?t.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(t){const e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}get subtitleDisplay(){const t=this.subtitleTrackController;return!!t&&t.subtitleDisplay}set subtitleDisplay(t){const e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(t){this.config.lowLatencyMode=t}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}function za(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Xa(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?za(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):za(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Qa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Qa=function(){return!!t})()}function Ja(t,e,r,n){var i=m()(p()(1&n?t.prototype:t),e,r);return 2&n&&"function"==typeof i?function(t){return i.apply(r,t)}:i}qa.defaultConfig=void 0;var Za=E.f.now,to=E.f.assign,eo=E.f.listContainsIgnoreCase;E.a.register("PLAYBACK_FRAGMENT_CHANGED"),E.a.register("PLAYBACK_FRAGMENT_PARSING_METADATA");var ro=function(t){function e(){var t,r,n,i;l()(this,e);for(var s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];return r=this,n=e,i=[].concat(a),n=p()(n),(t=d()(r,Qa()?Reflect.construct(n,i||[],p()(r).constructor):n.apply(r,i))).options.playback=Xa(Xa({},t.options),t.options.playback),t.options.hlsPlayback=Xa(Xa({},t.defaultOptions),t.options.hlsPlayback),t._minDvrSize=void 0===t.options.hlsMinimumDvrSize?60:t.options.hlsMinimumDvrSize,t._extrapolatedWindowNumSegments=t.options.playback&&void 0!==t.options.playback.extrapolatedWindowNumSegments?t.options.playback.extrapolatedWindowNumSegments:2,t._playbackType=E.d.VOD,t._lastTimeUpdate={current:0,total:0},t._lastDuration=null,t._playableRegionStartTime=0,t._localStartTimeCorrelation=null,t._localEndTimeCorrelation=null,t._playableRegionDuration=0,t._programDateTime=0,t._durationExcludesAfterLiveSyncPoint=!1,t._segmentTargetDuration=null,t._playlistType=null,t._recoverAttemptsRemaining=t.options.hlsRecoverAttempts||16,t}return v()(e,t),u()(e,[{key:"name",get:function(){return"hls"}},{key:"levels",get:function(){return this._levels||[]}},{key:"currentLevel",get:function(){return null===this._currentLevel||void 0===this._currentLevel?-1:this._currentLevel},set:function(t){this._currentLevel=t,this.trigger(E.a.PLAYBACK_LEVEL_SWITCH_START),this.options.playback.hlsUseNextLevel?this._hls.nextLevel=this._currentLevel:this._hls.currentLevel=this._currentLevel}},{key:"isReady",get:function(){return this._isReadyState}},{key:"_startTime",get:function(){return this._playbackType===E.d.LIVE&&"EVENT"!==this._playlistType?this._extrapolatedStartTime:this._playableRegionStartTime}},{key:"_now",get:function(){return Za()}},{key:"_extrapolatedStartTime",get:function(){if(!this._localStartTimeCorrelation)return this._playableRegionStartTime;var t=this._localStartTimeCorrelation,e=this._now-t.local,r=(t.remote+e)/1e3;return Math.min(r,this._playableRegionStartTime+this._extrapolatedWindowDuration)}},{key:"_extrapolatedEndTime",get:function(){var t=this._playableRegionStartTime+this._playableRegionDuration;if(!this._localEndTimeCorrelation)return t;var e=this._localEndTimeCorrelation,r=this._now-e.local,n=(e.remote+r)/1e3;return Math.max(t-this._extrapolatedWindowDuration,Math.min(n,t))}},{key:"_duration",get:function(){return this._extrapolatedEndTime-this._startTime}},{key:"_extrapolatedWindowDuration",get:function(){return null===this._segmentTargetDuration?0:this._extrapolatedWindowNumSegments*this._segmentTargetDuration}},{key:"bandwidthEstimate",get:function(){return this._hls&&this._hls.bandwidthEstimate}},{key:"defaultOptions",get:function(){return{preload:!1}}},{key:"customListeners",get:function(){return this.options.hlsPlayback&&this.options.hlsPlayback.customListeners||[]}},{key:"_setup",value:function(){var t=this;this._manifestParsed=!1,this._ccIsSetup=!1,this._ccTracksUpdated=!1,this._hls&&this._hls.destroy(),this._hls=new qa(to({},this.options.playback.hlsjsConfig)),this._hls.once(qa.Events.MEDIA_ATTACHED,(function(){t.options.hlsPlayback.preload&&t._hls.loadSource(t.options.src)})),this._hls.on(qa.Events.MANIFEST_PARSED,(function(){t._manifestParsed=!0})),this._hls.on(qa.Events.LEVEL_LOADED,(function(e,r){return t._updatePlaybackType(e,r)})),this._hls.on(qa.Events.LEVEL_UPDATED,(function(e,r){return t._onLevelUpdated(e,r)})),this._hls.on(qa.Events.LEVEL_SWITCHING,(function(e,r){return t._onLevelSwitch(e,r)})),this._hls.on(qa.Events.FRAG_CHANGED,(function(e,r){return t._onFragmentChanged(e,r)})),this._hls.on(qa.Events.FRAG_LOADED,(function(e,r){return t._onFragmentLoaded(e,r)})),this._hls.on(qa.Events.FRAG_PARSING_METADATA,(function(e,r){return t._onFragmentParsingMetadata(e,r)})),this._hls.on(qa.Events.ERROR,(function(e,r){return t._onHLSJSError(e,r)})),this._hls.on(qa.Events.SUBTITLE_TRACK_LOADED,(function(e,r){return t._onSubtitleLoaded(e,r)})),this._hls.on(qa.Events.SUBTITLE_TRACKS_UPDATED,(function(){return t._ccTracksUpdated=!0})),this.bindCustomListeners(),this.checkIfCritical(),this._hls.attachMedia(this.el)}},{key:"bindCustomListeners",value:function(){var t=this;this.customListeners.forEach((function(e){var r=e.eventName,n=e.once?"once":"on";r&&t._hls["".concat(n)](r,e.callback)}))}},{key:"unbindCustomListeners",value:function(){var t=this;this.customListeners.forEach((function(e){var r=e.eventName;r&&t._hls.off(r,e.callback)}))}},{key:"_onFragmentParsingMetadata",value:function(t,e){this.trigger(E.a.Custom.PLAYBACK_FRAGMENT_PARSING_METADATA,{evt:t,data:e})}},{key:"render",value:function(){return this._ready(),Ja(e,"render",this,3)([])}},{key:"_ready",value:function(){this._isReadyState||(!this._hls&&this._setup(),this._isReadyState=!0,this.trigger(E.a.PLAYBACK_READY,this.name))}},{key:"_recover",value:function(t,e,r){var n=this;if(this._recoveredDecodingError)if(this._recoveredAudioCodecError){E.c.error("hlsjs: failed to recover",{evt:t,data:e}),r.level=E.e.Levels.FATAL;var i=this.createError(r);this.trigger(E.a.PLAYBACK_ERROR,i),this.stop()}else this._recoveredAudioCodecError=!0,this._hls.swapAudioCodec(),this._hls.recoverMediaError(),this.$el[0].play().then((function(){n._recoveredAudioCodecError=!1}));else this._recoveredDecodingError=!0,this._hls.recoverMediaError(),this.$el[0].play()}},{key:"_setupSrc",value:function(t){}},{key:"_startTimeUpdateTimer",value:function(){var t=this;this._timeUpdateTimer||(this._timeUpdateTimer=setInterval((function(){t._onDurationChange(),t._onTimeUpdate()}),100))}},{key:"_stopTimeUpdateTimer",value:function(){this._timeUpdateTimer&&(clearInterval(this._timeUpdateTimer),this._timeUpdateTimer=null)}},{key:"getProgramDateTime",value:function(){return this._programDateTime}},{key:"getDuration",value:function(){return this._duration}},{key:"getCurrentTime",value:function(){return Math.max(0,this.el.currentTime-this._startTime)}},{key:"getStartTimeOffset",value:function(){return this._startTime}},{key:"seekPercentage",value:function(t){var e=this._duration;t>0&&(e=this._duration*(t/100)),this.seek(e)}},{key:"seek",value:function(t){t<0&&(E.c.warn("Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point."),t=this.getDuration()),this.dvrEnabled&&this._updateDvr(t<this.getDuration()-3),t+=this._startTime,this.el.currentTime=t}},{key:"seekToLivePoint",value:function(){this.seek(this.getDuration())}},{key:"_updateDvr",value:function(t){this.trigger(E.a.PLAYBACK_DVR,t),this.trigger(E.a.PLAYBACK_STATS_ADD,{dvr:t})}},{key:"_updateSettings",value:function(){this._playbackType===E.d.VOD?this.settings.left=["playpause","position","duration"]:this.dvrEnabled?this.settings.left=["playpause"]:this.settings.left=["playstop"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(E.a.PLAYBACK_SETTINGSUPDATE)}},{key:"_onHLSJSError",value:function(t,e){var r,n={code:"".concat(e.type,"_").concat(e.details),description:"".concat(this.name," error: type: ").concat(e.type,", details: ").concat(e.details),raw:e};if(e.response&&(n.description+=", response: ".concat(JSON.stringify(e.response))),e.fatal)if(this._recoverAttemptsRemaining>0)switch(this._recoverAttemptsRemaining-=1,e.type){case qa.ErrorTypes.NETWORK_ERROR:switch(e.details){case qa.ErrorDetails.MANIFEST_LOAD_ERROR:case qa.ErrorDetails.MANIFEST_LOAD_TIMEOUT:case qa.ErrorDetails.MANIFEST_PARSING_ERROR:case qa.ErrorDetails.LEVEL_LOAD_ERROR:case qa.ErrorDetails.LEVEL_LOAD_TIMEOUT:E.c.error("hlsjs: unrecoverable network fatal error.",{evt:t,data:e}),r=this.createError(n),this.trigger(E.a.PLAYBACK_ERROR,r),this.stop();break;default:E.c.warn("hlsjs: trying to recover from network error.",{evt:t,data:e}),n.level=E.e.Levels.WARN,this._hls.startLoad()}break;case qa.ErrorTypes.MEDIA_ERROR:E.c.warn("hlsjs: trying to recover from media error.",{evt:t,data:e}),n.level=E.e.Levels.WARN,this._recover(t,e,n);break;default:E.c.error("hlsjs: could not recover from error.",{evt:t,data:e}),r=this.createError(n),this.trigger(E.a.PLAYBACK_ERROR,r),this.stop()}else E.c.error("hlsjs: could not recover from error after maximum number of attempts.",{evt:t,data:e}),r=this.createError(n),this.trigger(E.a.PLAYBACK_ERROR,r),this.stop();else{if(this.options.playback.triggerFatalErrorOnResourceDenied&&this._keyIsDenied(e))return E.c.error("hlsjs: could not load decrypt key.",{evt:t,data:e}),r=this.createError(n),this.trigger(E.a.PLAYBACK_ERROR,r),void this.stop();n.level=E.e.Levels.WARN,E.c.warn("hlsjs: non-fatal error occurred",{evt:t,data:e})}}},{key:"_keyIsDenied",value:function(t){return t.type===qa.ErrorTypes.NETWORK_ERROR&&t.details===qa.ErrorDetails.KEY_LOAD_ERROR&&t.response&&t.response.code>=400}},{key:"_onTimeUpdate",value:function(){var t={current:this.getCurrentTime(),total:this.getDuration(),firstFragDateTime:this.getProgramDateTime()};this._lastTimeUpdate&&t.current===this._lastTimeUpdate.current&&t.total===this._lastTimeUpdate.total||(this._lastTimeUpdate=t,this.trigger(E.a.PLAYBACK_TIMEUPDATE,t,this.name))}},{key:"_onDurationChange",value:function(){var t=this.getDuration();this._lastDuration!==t&&(this._lastDuration=t,Ja(e,"_onDurationChange",this,3)([]))}},{key:"_onProgress",value:function(){if(this.el.buffered.length){for(var t=[],e=0,r=0;r<this.el.buffered.length;r++)t=[].concat(i()(t),[{start:Math.max(0,this.el.buffered.start(r)-this._playableRegionStartTime),end:Math.max(0,this.el.buffered.end(r)-this._playableRegionStartTime)}]),this.el.currentTime>=t[r].start&&this.el.currentTime<=t[r].end&&(e=r);var n={start:t[e].start,current:t[e].end,total:this.getDuration()};this.trigger(E.a.PLAYBACK_PROGRESS,n,t)}}},{key:"play",value:function(){!this._hls&&this._setup(),!this._manifestParsed&&!this.options.hlsPlayback.preload&&this._hls.loadSource(this.options.src),Ja(e,"play",this,3)([]),this._startTimeUpdateTimer()}},{key:"pause",value:function(){this._hls&&(this.el.pause(),this.dvrEnabled&&this._updateDvr(!0))}},{key:"stop",value:function(){this._stopTimeUpdateTimer(),this._hls&&(Ja(e,"stop",this,3)([]),this._hls.destroy(),delete this._hls)}},{key:"destroy",value:function(){this._stopTimeUpdateTimer(),this._hls&&(this._hls.destroy(),delete this._hls),Ja(e,"destroy",this,3)([])}},{key:"_updatePlaybackType",value:function(t,e){this._playbackType=e.details.live?E.d.LIVE:E.d.VOD,this._onLevelUpdated(t,e),this._ccTracksUpdated&&this._playbackType===E.d.LIVE&&this.hasClosedCaptionsTracks&&this._onSubtitleLoaded()}},{key:"_fillLevels",value:function(){this._levels=this._hls.levels.map((function(t,e){return{id:e,level:t,label:"".concat(t.bitrate/1e3,"Kbps")}})),this.trigger(E.a.PLAYBACK_LEVELS_AVAILABLE,this._levels)}},{key:"_onLevelUpdated",value:function(t,e){this._segmentTargetDuration=e.details.targetduration,this._playlistType=e.details.type||null;var r=!1,n=!1,i=e.details.fragments,s=this._playableRegionStartTime,a=this._playableRegionDuration;if(0!==i.length){if(i[0].rawProgramDateTime&&(this._programDateTime=i[0].rawProgramDateTime),this._playableRegionStartTime!==i[0].start&&(r=!0,this._playableRegionStartTime=i[0].start),r)if(this._localStartTimeCorrelation){var o=this._localStartTimeCorrelation,l=this._now-o.local,c=(o.remote+l)/1e3;c<i[0].start?this._localStartTimeCorrelation={local:this._now,remote:1e3*i[0].start}:c>s+this._extrapolatedWindowDuration&&(this._localStartTimeCorrelation={local:this._now,remote:1e3*Math.max(i[0].start,s+this._extrapolatedWindowDuration)})}else this._localStartTimeCorrelation={local:this._now,remote:1e3*(i[0].start+this._extrapolatedWindowDuration/2)};var u=e.details.totalduration;if(this._playbackType===E.d.LIVE){var h=e.details.targetduration*((this.options.playback.hlsjsConfig||{}).liveSyncDurationCount||qa.DefaultConfig.liveSyncDurationCount);h<=u?(u-=h,this._durationExcludesAfterLiveSyncPoint=!0):this._durationExcludesAfterLiveSyncPoint=!1}u!==this._playableRegionDuration&&(n=!0,this._playableRegionDuration=u);var d=i[0].start+u,f=s+a;if(d!==f)if(this._localEndTimeCorrelation){var p=this._localEndTimeCorrelation,g=this._now-p.local,m=(p.remote+g)/1e3;m>d?this._localEndTimeCorrelation={local:this._now,remote:1e3*d}:m<d-this._extrapolatedWindowDuration?this._localEndTimeCorrelation={local:this._now,remote:1e3*(d-this._extrapolatedWindowDuration)}:m>f&&(this._localEndTimeCorrelation={local:this._now,remote:1e3*f})}else this._localEndTimeCorrelation={local:this._now,remote:1e3*d};n&&this._onDurationChange(),r&&this._onProgress()}}},{key:"_onFragmentChanged",value:function(t,e){var r=this.options.onTagCallback;r&&r(e.frag.tagList);this.trigger(E.a.Custom.PLAYBACK_FRAGMENT_CHANGED,e)}},{key:"_onFragmentLoaded",value:function(t,e){this.trigger(E.a.PLAYBACK_FRAGMENT_LOADED,e)}},{key:"_onSubtitleLoaded",value:function(){if(!this._ccIsSetup){this.trigger(E.a.PLAYBACK_SUBTITLE_AVAILABLE);var t=this._playbackType===E.d.LIVE?-1:this.closedCaptionsTrackId;this.closedCaptionsTrackId=t,this._ccIsSetup=!0}}},{key:"_onLevelSwitch",value:function(t,e){this.levels.length||this._fillLevels(),this.trigger(E.a.PLAYBACK_LEVEL_SWITCH_END),this.trigger(E.a.PLAYBACK_LEVEL_SWITCH,e);var r=this._hls.levels[e.level];r&&(this.highDefinition=r.height>=720||r.bitrate/1e3>=2e3,this.trigger(E.a.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this.trigger(E.a.PLAYBACK_BITRATE,{height:r.height,width:r.width,bandwidth:r.bitrate,bitrate:r.bitrate,level:e.level}))}},{key:"dvrEnabled",get:function(){return this._durationExcludesAfterLiveSyncPoint&&this._duration>=this._minDvrSize&&this.getPlaybackType()===E.d.LIVE}},{key:"getPlaybackType",value:function(){return this._playbackType}},{key:"isSeekEnabled",value:function(){return this._playbackType===E.d.VOD||this.dvrEnabled}},{key:"checkIfCritical",value:function(){var t=this;this._options.mediaInfo.then((function(e){var r=e.criticalError,n=e.errorCodec;r&&(t._isReadyState=!1,t.stop(),t.trigger(E.a.PLAYBACK_ERROR,{UI:{title:"Playback error",message:"Could not play ".concat(n||"this"," codec")},raw:{response:{critical:!0}}}),t._hls&&t._hls.destroy())}))}}],[{key:"HLSJS",get:function(){return qa}}])}(E.b);ro.canPlay=function(t,e){var r=t.split("?")[0].match(/.*\.(.*)$/)||[],n=r.length>1&&"m3u8"===r[1].toLowerCase()||eo(e,["application/vnd.apple.mpegurl","application/x-mpegURL"]);return!(!qa.isSupported()||!n)}},,,,,,,,,,,,,,,,,,,,,,,function(t,e,r){"use strict";var n=r(382);t.exports=Function.prototype.bind||n},function(t,e,r){"use strict";var n=r(60)("%Object.defineProperty%",!0)||!1;if(n)try{n({},"a",{value:1})}catch(t){n=!1}t.exports=n},function(t,e,r){"use strict";var n=String.prototype.replace,i=/%20/g,s="RFC1738",a="RFC3986";t.exports={default:a,formatters:{RFC1738:function(t){return n.call(t,i,"+")},RFC3986:function(t){return String(t)}},RFC1738:s,RFC3986:a}},function(t,e,r){"use strict";var n=r(369),i=n.parse,s=n.Url;function a(t){var e=t.url;if(void 0!==e){var r=t._parsedUrl;return l(e,r)?r:((r=o(e))._raw=e,t._parsedUrl=r)}}function o(t){if("string"!=typeof t||47!==t.charCodeAt(0))return i(t);for(var e=t,r=null,n=null,a=1;a<t.length;a++)switch(t.charCodeAt(a)){case 63:null===n&&(e=t.substring(0,a),r=t.substring(a+1),n=t.substring(a));break;case 9:case 10:case 12:case 13:case 32:case 35:case 160:case 65279:return i(t)}var o=void 0!==s?new s:{};return o.path=t,o.href=t,o.pathname=e,null!==n&&(o.query=r,o.search=n),o}function l(t,e){return"object"==typeof e&&null!==e&&(void 0===s||e instanceof s)&&e._raw===t}t.exports=a,t.exports.original=function(t){var e=t.originalUrl;if("string"!=typeof e)return a(t);var r=t._parsedOriginalUrl;if(l(e,r))return r;return r=o(e),r._raw=e,t._parsedOriginalUrl=r}},function(t,e,r){var n,i,s,a,o,l,c,u,h,d,f,p,g,m,y,v,E,b,T,S,A,_;a=this,o=/iPhone/i,l=/iPod/i,c=/iPad/i,u=/(?=.*\bAndroid\b)(?=.*\bMobile\b)/i,h=/Android/i,d=/(?=.*\bAndroid\b)(?=.*\bSD4930UR\b)/i,f=/(?=.*\bAndroid\b)(?=.*\b(?:KFOT|KFTT|KFJWI|KFJWA|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|KFARWI|KFASWI|KFSAWI|KFSAWA)\b)/i,p=/Windows Phone/i,g=/(?=.*\bWindows\b)(?=.*\bARM\b)/i,m=/BlackBerry/i,y=/BB10/i,v=/Opera Mini/i,E=/(CriOS|Chrome)(?=.*\bMobile\b)/i,b=/(?=.*\bFirefox\b)(?=.*\bMobile\b)/i,T=new RegExp("(?:Nexus 7|BNTV250|Kindle Fire|Silk|GT-P1000)","i"),S=function(t,e){return t.test(e)},A=function(t){var e=t||navigator.userAgent,r=e.split("[FBAN");if(void 0!==r[1]&&(e=r[0]),void 0!==(r=e.split("Twitter"))[1]&&(e=r[0]),this.apple={phone:S(o,e),ipod:S(l,e),tablet:!S(o,e)&&S(c,e),device:S(o,e)||S(l,e)||S(c,e)},this.amazon={phone:S(d,e),tablet:!S(d,e)&&S(f,e),device:S(d,e)||S(f,e)},this.android={phone:S(d,e)||S(u,e),tablet:!S(d,e)&&!S(u,e)&&(S(f,e)||S(h,e)),device:S(d,e)||S(f,e)||S(u,e)||S(h,e)},this.windows={phone:S(p,e),tablet:S(g,e),device:S(p,e)||S(g,e)},this.other={blackberry:S(m,e),blackberry10:S(y,e),opera:S(v,e),firefox:S(b,e),chrome:S(E,e),device:S(m,e)||S(y,e)||S(v,e)||S(b,e)||S(E,e)},this.seven_inch=S(T,e),this.any=this.apple.device||this.android.device||this.windows.device||this.other.device||this.seven_inch,this.phone=this.apple.phone||this.android.phone||this.windows.phone,this.tablet=this.apple.tablet||this.android.tablet||this.windows.tablet,"undefined"==typeof window)return this},_=function(){var t=new A;return t.Class=A,t},t.exports&&"undefined"==typeof window?t.exports=A:t.exports&&"undefined"!=typeof window?t.exports=_():(i=[],n=a.isMobile=_(),void 0===(s="function"==typeof n?n.apply(e,i):n)||(t.exports=s))},function(t,e,r){"use strict";r.d(e,"a",(function(){return D}));var n=r(89),i=r.n(n),s=r(62),a=r.n(s),o=(r(394),r(17)),l=r.n(o),c=r(5),u=r.n(c),h=r(6),d=r.n(h),f=r(7),p=r.n(f),g=r(3),m=r.n(g),y=r(15),v=r.n(y),E=r(8),b=r.n(E),T=r(63),S=r.n(T),A=r(1),_=r(93),k=r.n(_);function L(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function w(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?L(Object(r),!0).forEach((function(e){l()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function R(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(R=function(){return!!t})()}function C(t,e,r,n){var i=v()(m()(1&n?t.prototype:t),e,r);return 2&n&&"function"==typeof i?function(t){return i.apply(r,t)}:i}var D=function(t){function e(){var t,r,n,i;u()(this,e);for(var s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];return r=this,n=e,i=[].concat(a),n=m()(n),(t=p()(r,R()?Reflect.construct(n,i||[],m()(r).constructor):n.apply(r,i))).options.playback=w(w({},t.options),t.options.playback),t.mustDestroy=!1,t._paused=!1,t.firstPlay=!0,t}return b()(e,t),d()(e,[{key:"name",get:function(){return"mseld"}},{key:"supportedVersion",get:function(){return{min:"0.4.18"}}},{key:"levels",get:function(){return this._levels||[]}},{key:"currentLevel",get:function(){return null===this._currentLevel||void 0===this._currentLevel?-1:this._currentLevel},set:function(t){this._currentLevel=t,this.trigger(A.Events.PLAYBACK_LEVEL_SWITCH_START),this.setTracks(t)}},{key:"init",value:function(){var t=this,e=this.options.src,r=k.a.replaceHttpByWS(e);return this.options.autoplay&&!this.options.mute&&(this.el.autoplay=!1,this.el.muted=!0,this.el.volume=0),this.MSE=new k.a(this.el,r,{debug:!0,connectionRetries:0,errorsBeforeStop:0,onCrashTryVideoOnly:!1,wsReconnect:!1,statsSendEnable:!1,onError:function(e){if(e&&!e.type&&t.trigger(A.Events.PLAYBACK_ERROR,e),e){var r=e.error,n=e.code;"WebSocket lost connection"===r&&1e3===n&&(t.playingStarted=!1,t.stop())}},onMediaInfo:function(e){var r=t.options.onMediaInfo;if(r&&"function"==typeof r){var n=e.streams||e.tracks;n&&n.length>0&&(t._levels=n.filter((function(e){return e.content&&"audio"===e.content&&(t.audio=e),!(!e.content||"video"!==e.content)})).map((function(t,e){return{id:e,level:t.size||0,label:"".concat(t.bitrate,"Kbps"),bitrate:t.bitrate,track_id:t.track_id}})),t.trigger(A.Events.PLAYBACK_LEVELS_AVAILABLE,t._levels)),r(e)}},onProgress:function(){t.playingStarted=!0,t.trigger(A.Events.PLAYBACK_BUFFERFULL);var e=t.options.tracks;if(e&&e.length>=2&&!1!==t.firstPlay){var r=a()(e),n=[];r.forEach((function(t,e){(e+1)%2==0&&n.push(r[e-1]+r[e])})),t.MSE.setTracks(n),t.firstPlay=!1}},onStartStalling:function(){t.trigger(A.Events.PLAYBACK_BUFFERING)},onEndStalling:function(){t.trigger(A.Events.PLAYBACK_BUFFERFULL)},onPause:function(){t.trigger(A.Events.PLAYBACK_STOP)},onEvent:function(t){}}),this.MSE}},{key:"_startTimeUpdateTimer",value:function(){var t=this;this._timeUpdateTimer=setInterval((function(){t._onTimeUpdate()}),100)}},{key:"_onTimeUpdate",value:function(){var t={current:this.getCurrentTime(),total:this.getDuration()};this._lastTimeUpdate&&t.current===this._lastTimeUpdate.current||(this._lastTimeUpdate=t,this.trigger(A.Events.PLAYBACK_TIMEUPDATE,t,this.name))}},{key:"_updateSettings",value:function(){this.settings.left=["playstop"],this.trigger(A.Events.PLAYBACK_SETTINGSUPDATE)}},{key:"_onDurationChange",value:function(){var t=this.getDuration();this._lastDuration!==t&&(this._lastDuration=t,C(e,"_onDurationChange",this,3)([]))}},{key:"_stopTimeUpdateTimer",value:function(){clearInterval(this._timeUpdateTimer)}},{key:"getPlaybackType",value:function(){return A.Playback.LIVE}},{key:"destroy",value:function(){var t=this;this.playPromise?(this.playPromise.catch((function(){t.stop()})).finally((function(){t.stop()})),this._stopTimeUpdateTimer(),C(e,"destroy",this,3)([])):this.mustDestroy=!0}},{key:"resolveRedirect",value:function(t){return fetch(t,{method:"OPTIONS"}).catch((function(e){return t})).then((function(e){return e.headers&&e.headers.get("location")?e.headers.get("location"):t}))}},{key:"getStartTimeOffset",value:function(){return this.getCurrentTime()}},{key:"_handleBufferingEvents",value:function(){}},{key:"isSeekEnabled",value:function(){return!1}},{key:"attemptAutoPlay",value:(r=i()(S.a.mark((function t(){var e=this;return S.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.checkIfCritical().then((function(){e.criticalError||e.MSE||(e.init(),e._onProgress=e.MSE.onProgress.bind(e),e.play())}));case 2:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"_onError",value:function(){}},{key:"play",value:function(){var t=this;this.criticalError||this.playingStarted||(this.trigger(A.Events.PLAYBACK_PLAY_INTENT),this.MSE||this.init(),this.playPromise=this.MSE.play(),this.playPromise&&this.playPromise.then((function(){t._ready(),t.playingStarted=!0,t._stopped=!1,t.trigger(A.Events.PLAYBACK_BUFFERING),t.mustDestroy&&t.destroy()})).catch((function(){t.mustDestroy&&t.destroy()})).finally((function(){t.trigger(A.Events.MEDIACONTROL_PLAYING)})),this._startTimeUpdateTimer())}},{key:"pause",value:function(){this.MSE&&(this._paused?(this.MSE.play(),this._paused=!1):(this.MSE.pause(),this._paused=!0))}},{key:"isPlaying",value:function(){return this.playingStarted||!1}},{key:"setTracks",value:function(t){var e=-1===t?0:t;if(this.MSE){var r;this.audio&&this.audio.track_id&&(r=this.audio.track_id);var n=[];this._levels[e]&&n.push(this._levels[e].track_id),void 0!==r&&n.push(r),n.length>0&&this.MSE.setTracks(n)}this.trigger(A.Events.PLAYBACK_LEVEL_SWITCH_END)}},{key:"getStats",value:function(){return this.MSE.getStats()}},{key:"_ready",value:function(){this.trigger(A.Events.PLAYBACK_READY)}},{key:"setWaitStatus",value:function(t){this._waitStatus=t}},{key:"stop",value:function(){this.MSE?(this.MSE.stop(),C(e,"stop",this,3)([]),this.trigger(A.Events.PLAYBACK_STOP),this.playingStarted=!1,this.MSE=void 0):this.mustDestroy=!0}},{key:"checkIfCritical",value:function(){var t=this;return new Promise((function(e,r){t._options.mediaInfo.then((function(r){var n=r.criticalError,i=r.errorCodec;return n&&(t.destroy(),t.criticalError=!0,t.stop(),t.trigger(A.Events.PLAYBACK_ERROR,{UI:{title:"Playback error",message:"Could not play ".concat(i||"this"," codec")},raw:{response:{critical:!0}}})),e()}))}))}}],[{key:"MSELD",get:function(){return e}}]);var r}(A.HTML5Video);D.isSupported=function(){return k.a.isSupported()},D.canPlay=function(t,e){return(-1!==t.indexOf("mse_ld")||"application/x-flussonic-mse"===e)&&D.isSupported()}},function(t,e,r){var n=r(61).default,i=r(206);t.exports=function(t){var e=i(t,"string");return"symbol"==n(e)?e:e+""},t.exports.__esModule=!0,t.exports.default=t.exports},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(154);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";t.exports=SyntaxError},function(t,e,r){"use strict";var n=r(60)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(t){n=null}t.exports=n},function(t,e,r){"use strict";var n=r(120),i=Object.prototype.hasOwnProperty,s=Array.isArray,a=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),o=function(t,e){for(var r=e&&e.plainObjects?{__proto__:null}:{},n=0;n<t.length;++n)void 0!==t[n]&&(r[n]=t[n]);return r},l=1024;t.exports={arrayToObject:o,assign:function(t,e){return Object.keys(e).reduce((function(t,r){return t[r]=e[r],t}),t)},combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],n=0;n<e.length;++n)for(var i=e[n],a=i.obj[i.prop],o=Object.keys(a),l=0;l<o.length;++l){var c=o[l],u=a[c];"object"==typeof u&&null!==u&&-1===r.indexOf(u)&&(e.push({obj:a,prop:c}),r.push(u))}return function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(s(r)){for(var n=[],i=0;i<r.length;++i)void 0!==r[i]&&n.push(r[i]);e.obj[e.prop]=n}}}(e),t},decode:function(t,e,r){var n=t.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(t){return n}},encode:function(t,e,r,i,s){if(0===t.length)return t;var o=t;if("symbol"==typeof t?o=Symbol.prototype.toString.call(t):"string"!=typeof t&&(o=String(t)),"iso-8859-1"===r)return escape(o).replace(/%u[0-9a-f]{4}/gi,(function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"}));for(var c="",u=0;u<o.length;u+=l){for(var h=o.length>=l?o.slice(u,u+l):o,d=[],f=0;f<h.length;++f){var p=h.charCodeAt(f);45===p||46===p||95===p||126===p||p>=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||s===n.RFC1738&&(40===p||41===p)?d[d.length]=h.charAt(f):p<128?d[d.length]=a[p]:p<2048?d[d.length]=a[192|p>>6]+a[128|63&p]:p<55296||p>=57344?d[d.length]=a[224|p>>12]+a[128|p>>6&63]+a[128|63&p]:(f+=1,p=65536+((1023&p)<<10|1023&h.charCodeAt(f)),d[d.length]=a[240|p>>18]+a[128|p>>12&63]+a[128|p>>6&63]+a[128|63&p])}c+=d.join("")}return c},isBuffer:function(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(s(t)){for(var r=[],n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)},merge:function t(e,r,n){if(!r)return e;if("object"!=typeof r&&"function"!=typeof r){if(s(e))e.push(r);else{if(!e||"object"!=typeof e)return[e,r];(n&&(n.plainObjects||n.allowPrototypes)||!i.call(Object.prototype,r))&&(e[r]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(r);var a=e;return s(e)&&!s(r)&&(a=o(e,n)),s(e)&&s(r)?(r.forEach((function(r,s){if(i.call(e,s)){var a=e[s];a&&"object"==typeof a&&r&&"object"==typeof r?e[s]=t(a,r,n):e.push(r)}else e[s]=r})),e):Object.keys(r).reduce((function(e,s){var a=r[s];return i.call(e,s)?e[s]=t(e[s],a,n):e[s]=a,e}),a)}}},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r=function(t,e){var r=t[1]||"",n=t[3];if(!n)return r;if(e&&"function"==typeof btoa){var i=(a=n,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),s=n.sources.map((function(t){return"/*# sourceURL="+n.sourceRoot+t+" */"}));return[r].concat(s).concat([i]).join("\n")}var a;return[r].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+r+"}":r})).join("")},e.i=function(t,r){"string"==typeof t&&(t=[[null,t,""]]);for(var n={},i=0;i<this.length;i++){var s=this[i][0];"number"==typeof s&&(n[s]=!0)}for(i=0;i<t.length;i++){var a=t[i];"number"==typeof a[0]&&n[a[0]]||(r&&!a[2]?a[2]=r:r&&(a[2]="("+a[2]+") and ("+r+")"),e.push(a))}},e}},function(t,e,r){var n,i,s={},a=(n=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===i&&(i=n.apply(this,arguments)),i}),o=function(t,e){return e?e.querySelector(t):document.querySelector(t)},l=function(){var t={};return function(e,r){if("function"==typeof e)return e();if(void 0===t[e]){var n=o.call(this,e,r);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}t[e]=n}return t[e]}}(),c=null,u=0,h=[],d=r(393);function f(t,e){for(var r=0;r<t.length;r++){var n=t[r],i=s[n.id];if(i){i.refs++;for(var a=0;a<i.parts.length;a++)i.parts[a](n.parts[a]);for(;a<n.parts.length;a++)i.parts.push(E(n.parts[a],e))}else{var o=[];for(a=0;a<n.parts.length;a++)o.push(E(n.parts[a],e));s[n.id]={id:n.id,refs:1,parts:o}}}}function p(t,e){for(var r=[],n={},i=0;i<t.length;i++){var s=t[i],a=e.base?s[0]+e.base:s[0],o={css:s[1],media:s[2],sourceMap:s[3]};n[a]?n[a].parts.push(o):r.push(n[a]={id:a,parts:[o]})}return r}function g(t,e){var r=l(t.insertInto);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var n=h[h.length-1];if("top"===t.insertAt)n?n.nextSibling?r.insertBefore(e,n.nextSibling):r.appendChild(e):r.insertBefore(e,r.firstChild),h.push(e);else if("bottom"===t.insertAt)r.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var i=l(t.insertAt.before,r);r.insertBefore(e,i)}}function m(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=h.indexOf(t);e>=0&&h.splice(e,1)}function y(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var n=function(){0;return r.nc}();n&&(t.attrs.nonce=n)}return v(e,t.attrs),g(t,e),e}function v(t,e){Object.keys(e).forEach((function(r){t.setAttribute(r,e[r])}))}function E(t,e){var r,n,i,s;if(e.transform&&t.css){if(!(s="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=s}if(e.singleton){var a=u++;r=c||(c=y(e)),n=S.bind(null,r,a,!1),i=S.bind(null,r,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(r=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",v(e,t.attrs),g(t,e),e}(e),n=_.bind(null,r,e),i=function(){m(r),r.href&&URL.revokeObjectURL(r.href)}):(r=y(e),n=A.bind(null,r),i=function(){m(r)});return n(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n(t=e)}else i()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var r=p(t,e);return f(r,e),function(t){for(var n=[],i=0;i<r.length;i++){var a=r[i];(o=s[a.id]).refs--,n.push(o)}t&&f(p(t,e),e);for(i=0;i<n.length;i++){var o;if(0===(o=n[i]).refs){for(var l=0;l<o.parts.length;l++)o.parts[l]();delete s[o.id]}}}};var b,T=(b=[],function(t,e){return b[t]=e,b.filter(Boolean).join("\n")});function S(t,e,r,n){var i=r?"":n.css;if(t.styleSheet)t.styleSheet.cssText=T(e,i);else{var s=document.createTextNode(i),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(s,a[e]):t.appendChild(s)}}function A(t,e){var r=e.css,n=e.media;if(n&&t.setAttribute("media",n),t.styleSheet)t.styleSheet.cssText=r;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(r))}}function _(t,e,r){var n=r.css,i=r.sourceMap,s=void 0===e.convertToAbsoluteUrls&&i;(e.convertToAbsoluteUrls||s)&&(n=d(n)),i&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var a=new Blob([n],{type:"text/css"}),o=t.href;t.href=URL.createObjectURL(a),o&&URL.revokeObjectURL(o)}},function(t,e){t.exports=function(t){if(!t.webpackPolyfill){var e=Object.create(t);e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(e,"exports",{enumerable:!0}),e.webpackPolyfill=1}return e}},function(t,e,r){"use strict";r.d(e,"a",(function(){return y}));var n=r(89),i=r.n(n),s=r(17),a=r.n(s),o=r(6),l=r.n(o),c=r(5),u=r.n(c),h=r(63),d=r.n(h),f=r(164),p=r(26);function g(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function m(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(Object(r),!0).forEach((function(e){a()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var y=l()((function t(e){u()(this,t);var r=p.h(e),n=p.g(e),s=p.c(e),a=p.e(e),o=m(m(m(m({},e),a),{duration:s}),{authToken:n}),l=Object(f.pickBy)(o,(function(t){return void 0!==t}));l.filterTracks=l["filter.tracks"],this.get=p.b(l,r).bind(this),this.constructSource=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return p.f(l,t)},this.getMediaInfo=i()(d.a.mark((function t(){var e,r,n;return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=p.d(l),r=p.i(),n={criticalError:!1},t.next=5,fetch(e).then((function(t){return t.json()})).then((function(t){n=m(m({},n),t),t.tracks.forEach((function(t){var e=t.codec;if(e)switch(e){case"mp2v":n.criticalError=!0,n.errorCodec=e;break;case"hevc":if(r)return;n.criticalError=!0,n.errorCodec=e}}))}));case 5:return t.abrupt("return",n);case 6:case"end":return t.stop()}}),t)})))}))},function(t,e,r){(function(t,n){var i;(function(){var s,a="Expected a function",o="__lodash_hash_undefined__",l="__lodash_placeholder__",c=16,u=32,h=64,d=128,f=256,p=1/0,g=9007199254740991,m=NaN,y=4294967295,v=[["ary",d],["bind",1],["bindKey",2],["curry",8],["curryRight",c],["flip",512],["partial",u],["partialRight",h],["rearg",f]],E="[object Arguments]",b="[object Array]",T="[object Boolean]",S="[object Date]",A="[object Error]",_="[object Function]",k="[object GeneratorFunction]",L="[object Map]",w="[object Number]",R="[object Object]",C="[object Promise]",D="[object RegExp]",I="[object Set]",x="[object String]",P="[object Symbol]",O="[object WeakMap]",M="[object ArrayBuffer]",F="[object DataView]",B="[object Float32Array]",N="[object Float64Array]",U="[object Int8Array]",$="[object Int16Array]",j="[object Int32Array]",G="[object Uint8Array]",K="[object Uint8ClampedArray]",H="[object Uint16Array]",V="[object Uint32Array]",W=/\b__p \+= '';/g,Y=/\b(__p \+=) '' \+/g,q=/(__e\(.*?\)|\b__t\)) \+\n'';/g,z=/&(?:amp|lt|gt|quot|#39);/g,X=/[&<>"']/g,Q=RegExp(z.source),J=RegExp(X.source),Z=/<%-([\s\S]+?)%>/g,tt=/<%([\s\S]+?)%>/g,et=/<%=([\s\S]+?)%>/g,rt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nt=/^\w*$/,it=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,st=/[\\^$.*+?()[\]{}|]/g,at=RegExp(st.source),ot=/^\s+/,lt=/\s/,ct=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ut=/\{\n\/\* \[wrapped with (.+)\] \*/,ht=/,? & /,dt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ft=/[()=,{}\[\]\/\s]/,pt=/\\(\\)?/g,gt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,mt=/\w*$/,yt=/^[-+]0x[0-9a-f]+$/i,vt=/^0b[01]+$/i,Et=/^\[object .+?Constructor\]$/,bt=/^0o[0-7]+$/i,Tt=/^(?:0|[1-9]\d*)$/,St=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,_t=/['\n\r\u2028\u2029\\]/g,kt="\\ud800-\\udfff",Lt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",wt="\\u2700-\\u27bf",Rt="a-z\\xdf-\\xf6\\xf8-\\xff",Ct="A-Z\\xc0-\\xd6\\xd8-\\xde",Dt="\\ufe0e\\ufe0f",It="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",xt="['’]",Pt="["+kt+"]",Ot="["+It+"]",Mt="["+Lt+"]",Ft="\\d+",Bt="["+wt+"]",Nt="["+Rt+"]",Ut="[^"+kt+It+Ft+wt+Rt+Ct+"]",$t="\\ud83c[\\udffb-\\udfff]",jt="[^"+kt+"]",Gt="(?:\\ud83c[\\udde6-\\uddff]){2}",Kt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ht="["+Ct+"]",Vt="\\u200d",Wt="(?:"+Nt+"|"+Ut+")",Yt="(?:"+Ht+"|"+Ut+")",qt="(?:['’](?:d|ll|m|re|s|t|ve))?",zt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Xt="(?:"+Mt+"|"+$t+")"+"?",Qt="["+Dt+"]?",Jt=Qt+Xt+("(?:"+Vt+"(?:"+[jt,Gt,Kt].join("|")+")"+Qt+Xt+")*"),Zt="(?:"+[Bt,Gt,Kt].join("|")+")"+Jt,te="(?:"+[jt+Mt+"?",Mt,Gt,Kt,Pt].join("|")+")",ee=RegExp(xt,"g"),re=RegExp(Mt,"g"),ne=RegExp($t+"(?="+$t+")|"+te+Jt,"g"),ie=RegExp([Ht+"?"+Nt+"+"+qt+"(?="+[Ot,Ht,"$"].join("|")+")",Yt+"+"+zt+"(?="+[Ot,Ht+Wt,"$"].join("|")+")",Ht+"?"+Wt+"+"+qt,Ht+"+"+zt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ft,Zt].join("|"),"g"),se=RegExp("["+Vt+kt+Lt+Dt+"]"),ae=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,oe=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],le=-1,ce={};ce[B]=ce[N]=ce[U]=ce[$]=ce[j]=ce[G]=ce[K]=ce[H]=ce[V]=!0,ce[E]=ce[b]=ce[M]=ce[T]=ce[F]=ce[S]=ce[A]=ce[_]=ce[L]=ce[w]=ce[R]=ce[D]=ce[I]=ce[x]=ce[O]=!1;var ue={};ue[E]=ue[b]=ue[M]=ue[F]=ue[T]=ue[S]=ue[B]=ue[N]=ue[U]=ue[$]=ue[j]=ue[L]=ue[w]=ue[R]=ue[D]=ue[I]=ue[x]=ue[P]=ue[G]=ue[K]=ue[H]=ue[V]=!0,ue[A]=ue[_]=ue[O]=!1;var he={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},de=parseFloat,fe=parseInt,pe="object"==typeof t&&t&&t.Object===Object&&t,ge="object"==typeof self&&self&&self.Object===Object&&self,me=pe||ge||Function("return this")(),ye=e&&!e.nodeType&&e,ve=ye&&"object"==typeof n&&n&&!n.nodeType&&n,Ee=ve&&ve.exports===ye,be=Ee&&pe.process,Te=function(){try{var t=ve&&ve.require&&ve.require("util").types;return t||be&&be.binding&&be.binding("util")}catch(t){}}(),Se=Te&&Te.isArrayBuffer,Ae=Te&&Te.isDate,_e=Te&&Te.isMap,ke=Te&&Te.isRegExp,Le=Te&&Te.isSet,we=Te&&Te.isTypedArray;function Re(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function Ce(t,e,r,n){for(var i=-1,s=null==t?0:t.length;++i<s;){var a=t[i];e(n,a,r(a),t)}return n}function De(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}function Ie(t,e){for(var r=null==t?0:t.length;r--&&!1!==e(t[r],r,t););return t}function xe(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}function Pe(t,e){for(var r=-1,n=null==t?0:t.length,i=0,s=[];++r<n;){var a=t[r];e(a,r,t)&&(s[i++]=a)}return s}function Oe(t,e){return!!(null==t?0:t.length)&&He(t,e,0)>-1}function Me(t,e,r){for(var n=-1,i=null==t?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1}function Fe(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function Be(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}function Ne(t,e,r,n){var i=-1,s=null==t?0:t.length;for(n&&s&&(r=t[++i]);++i<s;)r=e(r,t[i],i,t);return r}function Ue(t,e,r,n){var i=null==t?0:t.length;for(n&&i&&(r=t[--i]);i--;)r=e(r,t[i],i,t);return r}function $e(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var je=qe("length");function Ge(t,e,r){var n;return r(t,(function(t,r,i){if(e(t,r,i))return n=r,!1})),n}function Ke(t,e,r,n){for(var i=t.length,s=r+(n?1:-1);n?s--:++s<i;)if(e(t[s],s,t))return s;return-1}function He(t,e,r){return e==e?function(t,e,r){var n=r-1,i=t.length;for(;++n<i;)if(t[n]===e)return n;return-1}(t,e,r):Ke(t,We,r)}function Ve(t,e,r,n){for(var i=r-1,s=t.length;++i<s;)if(n(t[i],e))return i;return-1}function We(t){return t!=t}function Ye(t,e){var r=null==t?0:t.length;return r?Qe(t,e)/r:m}function qe(t){return function(e){return null==e?s:e[t]}}function ze(t){return function(e){return null==t?s:t[e]}}function Xe(t,e,r,n,i){return i(t,(function(t,i,s){r=n?(n=!1,t):e(r,t,i,s)})),r}function Qe(t,e){for(var r,n=-1,i=t.length;++n<i;){var a=e(t[n]);a!==s&&(r=r===s?a:r+a)}return r}function Je(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function Ze(t){return t?t.slice(0,mr(t)+1).replace(ot,""):t}function tr(t){return function(e){return t(e)}}function er(t,e){return Fe(e,(function(e){return t[e]}))}function rr(t,e){return t.has(e)}function nr(t,e){for(var r=-1,n=t.length;++r<n&&He(e,t[r],0)>-1;);return r}function ir(t,e){for(var r=t.length;r--&&He(e,t[r],0)>-1;);return r}var sr=ze({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ar=ze({"&":"&","<":"<",">":">",'"':""","'":"'"});function or(t){return"\\"+he[t]}function lr(t){return se.test(t)}function cr(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function ur(t,e){return function(r){return t(e(r))}}function hr(t,e){for(var r=-1,n=t.length,i=0,s=[];++r<n;){var a=t[r];a!==e&&a!==l||(t[r]=l,s[i++]=r)}return s}function dr(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}function fr(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=[t,t]})),r}function pr(t){return lr(t)?function(t){var e=ne.lastIndex=0;for(;ne.test(t);)++e;return e}(t):je(t)}function gr(t){return lr(t)?function(t){return t.match(ne)||[]}(t):function(t){return t.split("")}(t)}function mr(t){for(var e=t.length;e--&<.test(t.charAt(e)););return e}var yr=ze({"&":"&","<":"<",">":">",""":'"',"'":"'"});var vr=function t(e){var r,n=(e=null==e?me:vr.defaults(me.Object(),e,vr.pick(me,oe))).Array,i=e.Date,lt=e.Error,kt=e.Function,Lt=e.Math,wt=e.Object,Rt=e.RegExp,Ct=e.String,Dt=e.TypeError,It=n.prototype,xt=kt.prototype,Pt=wt.prototype,Ot=e["__core-js_shared__"],Mt=xt.toString,Ft=Pt.hasOwnProperty,Bt=0,Nt=(r=/[^.]+$/.exec(Ot&&Ot.keys&&Ot.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",Ut=Pt.toString,$t=Mt.call(wt),jt=me._,Gt=Rt("^"+Mt.call(Ft).replace(st,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Kt=Ee?e.Buffer:s,Ht=e.Symbol,Vt=e.Uint8Array,Wt=Kt?Kt.allocUnsafe:s,Yt=ur(wt.getPrototypeOf,wt),qt=wt.create,zt=Pt.propertyIsEnumerable,Xt=It.splice,Qt=Ht?Ht.isConcatSpreadable:s,Jt=Ht?Ht.iterator:s,Zt=Ht?Ht.toStringTag:s,te=function(){try{var t=ds(wt,"defineProperty");return t({},"",{}),t}catch(t){}}(),ne=e.clearTimeout!==me.clearTimeout&&e.clearTimeout,se=i&&i.now!==me.Date.now&&i.now,he=e.setTimeout!==me.setTimeout&&e.setTimeout,pe=Lt.ceil,ge=Lt.floor,ye=wt.getOwnPropertySymbols,ve=Kt?Kt.isBuffer:s,be=e.isFinite,Te=It.join,je=ur(wt.keys,wt),ze=Lt.max,Er=Lt.min,br=i.now,Tr=e.parseInt,Sr=Lt.random,Ar=It.reverse,_r=ds(e,"DataView"),kr=ds(e,"Map"),Lr=ds(e,"Promise"),wr=ds(e,"Set"),Rr=ds(e,"WeakMap"),Cr=ds(wt,"create"),Dr=Rr&&new Rr,Ir={},xr=Ns(_r),Pr=Ns(kr),Or=Ns(Lr),Mr=Ns(wr),Fr=Ns(Rr),Br=Ht?Ht.prototype:s,Nr=Br?Br.valueOf:s,Ur=Br?Br.toString:s;function $r(t){if(eo(t)&&!Ha(t)&&!(t instanceof Hr)){if(t instanceof Kr)return t;if(Ft.call(t,"__wrapped__"))return Us(t)}return new Kr(t)}var jr=function(){function t(){}return function(e){if(!to(e))return{};if(qt)return qt(e);t.prototype=e;var r=new t;return t.prototype=s,r}}();function Gr(){}function Kr(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=s}function Hr(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=y,this.__views__=[]}function Vr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Wr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Yr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function qr(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new Yr;++e<r;)this.add(t[e])}function zr(t){var e=this.__data__=new Wr(t);this.size=e.size}function Xr(t,e){var r=Ha(t),n=!r&&Ka(t),i=!r&&!n&&qa(t),s=!r&&!n&&!i&&co(t),a=r||n||i||s,o=a?Je(t.length,Ct):[],l=o.length;for(var c in t)!e&&!Ft.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Es(c,l))||o.push(c);return o}function Qr(t){var e=t.length;return e?t[zn(0,e-1)]:s}function Jr(t,e){return Ms(Di(t),ln(e,0,t.length))}function Zr(t){return Ms(Di(t))}function tn(t,e,r){(r!==s&&!$a(t[e],r)||r===s&&!(e in t))&&an(t,e,r)}function en(t,e,r){var n=t[e];Ft.call(t,e)&&$a(n,r)&&(r!==s||e in t)||an(t,e,r)}function rn(t,e){for(var r=t.length;r--;)if($a(t[r][0],e))return r;return-1}function nn(t,e,r,n){return fn(t,(function(t,i,s){e(n,t,r(t),s)})),n}function sn(t,e){return t&&Ii(e,xo(e),t)}function an(t,e,r){"__proto__"==e&&te?te(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function on(t,e){for(var r=-1,i=e.length,a=n(i),o=null==t;++r<i;)a[r]=o?s:wo(t,e[r]);return a}function ln(t,e,r){return t==t&&(r!==s&&(t=t<=r?t:r),e!==s&&(t=t>=e?t:e)),t}function cn(t,e,r,n,i,a){var o,l=1&e,c=2&e,u=4&e;if(r&&(o=i?r(t,n,i,a):r(t)),o!==s)return o;if(!to(t))return t;var h=Ha(t);if(h){if(o=function(t){var e=t.length,r=new t.constructor(e);e&&"string"==typeof t[0]&&Ft.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!l)return Di(t,o)}else{var d=gs(t),f=d==_||d==k;if(qa(t))return _i(t,l);if(d==R||d==E||f&&!i){if(o=c||f?{}:ys(t),!l)return c?function(t,e){return Ii(t,ps(t),e)}(t,function(t,e){return t&&Ii(e,Po(e),t)}(o,t)):function(t,e){return Ii(t,fs(t),e)}(t,sn(o,t))}else{if(!ue[d])return i?t:{};o=function(t,e,r){var n=t.constructor;switch(e){case M:return ki(t);case T:case S:return new n(+t);case F:return function(t,e){var r=e?ki(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case B:case N:case U:case $:case j:case G:case K:case H:case V:return Li(t,r);case L:return new n;case w:case x:return new n(t);case D:return function(t){var e=new t.constructor(t.source,mt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case I:return new n;case P:return i=t,Nr?wt(Nr.call(i)):{}}var i}(t,d,l)}}a||(a=new zr);var p=a.get(t);if(p)return p;a.set(t,o),ao(t)?t.forEach((function(n){o.add(cn(n,e,r,n,t,a))})):ro(t)&&t.forEach((function(n,i){o.set(i,cn(n,e,r,i,t,a))}));var g=h?s:(u?c?ss:is:c?Po:xo)(t);return De(g||t,(function(n,i){g&&(n=t[i=n]),en(o,i,cn(n,e,r,i,t,a))})),o}function un(t,e,r){var n=r.length;if(null==t)return!n;for(t=wt(t);n--;){var i=r[n],a=e[i],o=t[i];if(o===s&&!(i in t)||!a(o))return!1}return!0}function hn(t,e,r){if("function"!=typeof t)throw new Dt(a);return Is((function(){t.apply(s,r)}),e)}function dn(t,e,r,n){var i=-1,s=Oe,a=!0,o=t.length,l=[],c=e.length;if(!o)return l;r&&(e=Fe(e,tr(r))),n?(s=Me,a=!1):e.length>=200&&(s=rr,a=!1,e=new qr(e));t:for(;++i<o;){var u=t[i],h=null==r?u:r(u);if(u=n||0!==u?u:0,a&&h==h){for(var d=c;d--;)if(e[d]===h)continue t;l.push(u)}else s(e,h,n)||l.push(u)}return l}$r.templateSettings={escape:Z,evaluate:tt,interpolate:et,variable:"",imports:{_:$r}},$r.prototype=Gr.prototype,$r.prototype.constructor=$r,Kr.prototype=jr(Gr.prototype),Kr.prototype.constructor=Kr,Hr.prototype=jr(Gr.prototype),Hr.prototype.constructor=Hr,Vr.prototype.clear=function(){this.__data__=Cr?Cr(null):{},this.size=0},Vr.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Vr.prototype.get=function(t){var e=this.__data__;if(Cr){var r=e[t];return r===o?s:r}return Ft.call(e,t)?e[t]:s},Vr.prototype.has=function(t){var e=this.__data__;return Cr?e[t]!==s:Ft.call(e,t)},Vr.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Cr&&e===s?o:e,this},Wr.prototype.clear=function(){this.__data__=[],this.size=0},Wr.prototype.delete=function(t){var e=this.__data__,r=rn(e,t);return!(r<0)&&(r==e.length-1?e.pop():Xt.call(e,r,1),--this.size,!0)},Wr.prototype.get=function(t){var e=this.__data__,r=rn(e,t);return r<0?s:e[r][1]},Wr.prototype.has=function(t){return rn(this.__data__,t)>-1},Wr.prototype.set=function(t,e){var r=this.__data__,n=rn(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},Yr.prototype.clear=function(){this.size=0,this.__data__={hash:new Vr,map:new(kr||Wr),string:new Vr}},Yr.prototype.delete=function(t){var e=us(this,t).delete(t);return this.size-=e?1:0,e},Yr.prototype.get=function(t){return us(this,t).get(t)},Yr.prototype.has=function(t){return us(this,t).has(t)},Yr.prototype.set=function(t,e){var r=us(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},qr.prototype.add=qr.prototype.push=function(t){return this.__data__.set(t,o),this},qr.prototype.has=function(t){return this.__data__.has(t)},zr.prototype.clear=function(){this.__data__=new Wr,this.size=0},zr.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},zr.prototype.get=function(t){return this.__data__.get(t)},zr.prototype.has=function(t){return this.__data__.has(t)},zr.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Wr){var n=r.__data__;if(!kr||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Yr(n)}return r.set(t,e),this.size=r.size,this};var fn=Oi(Tn),pn=Oi(Sn,!0);function gn(t,e){var r=!0;return fn(t,(function(t,n,i){return r=!!e(t,n,i)})),r}function mn(t,e,r){for(var n=-1,i=t.length;++n<i;){var a=t[n],o=e(a);if(null!=o&&(l===s?o==o&&!lo(o):r(o,l)))var l=o,c=a}return c}function yn(t,e){var r=[];return fn(t,(function(t,n,i){e(t,n,i)&&r.push(t)})),r}function vn(t,e,r,n,i){var s=-1,a=t.length;for(r||(r=vs),i||(i=[]);++s<a;){var o=t[s];e>0&&r(o)?e>1?vn(o,e-1,r,n,i):Be(i,o):n||(i[i.length]=o)}return i}var En=Mi(),bn=Mi(!0);function Tn(t,e){return t&&En(t,e,xo)}function Sn(t,e){return t&&bn(t,e,xo)}function An(t,e){return Pe(e,(function(e){return Qa(t[e])}))}function _n(t,e){for(var r=0,n=(e=bi(e,t)).length;null!=t&&r<n;)t=t[Bs(e[r++])];return r&&r==n?t:s}function kn(t,e,r){var n=e(t);return Ha(t)?n:Be(n,r(t))}function Ln(t){return null==t?t===s?"[object Undefined]":"[object Null]":Zt&&Zt in wt(t)?function(t){var e=Ft.call(t,Zt),r=t[Zt];try{t[Zt]=s;var n=!0}catch(t){}var i=Ut.call(t);n&&(e?t[Zt]=r:delete t[Zt]);return i}(t):function(t){return Ut.call(t)}(t)}function wn(t,e){return t>e}function Rn(t,e){return null!=t&&Ft.call(t,e)}function Cn(t,e){return null!=t&&e in wt(t)}function Dn(t,e,r){for(var i=r?Me:Oe,a=t[0].length,o=t.length,l=o,c=n(o),u=1/0,h=[];l--;){var d=t[l];l&&e&&(d=Fe(d,tr(e))),u=Er(d.length,u),c[l]=!r&&(e||a>=120&&d.length>=120)?new qr(l&&d):s}d=t[0];var f=-1,p=c[0];t:for(;++f<a&&h.length<u;){var g=d[f],m=e?e(g):g;if(g=r||0!==g?g:0,!(p?rr(p,m):i(h,m,r))){for(l=o;--l;){var y=c[l];if(!(y?rr(y,m):i(t[l],m,r)))continue t}p&&p.push(m),h.push(g)}}return h}function In(t,e,r){var n=null==(t=Rs(t,e=bi(e,t)))?t:t[Bs(Xs(e))];return null==n?s:Re(n,t,r)}function xn(t){return eo(t)&&Ln(t)==E}function Pn(t,e,r,n,i){return t===e||(null==t||null==e||!eo(t)&&!eo(e)?t!=t&&e!=e:function(t,e,r,n,i,a){var o=Ha(t),l=Ha(e),c=o?b:gs(t),u=l?b:gs(e),h=(c=c==E?R:c)==R,d=(u=u==E?R:u)==R,f=c==u;if(f&&qa(t)){if(!qa(e))return!1;o=!0,h=!1}if(f&&!h)return a||(a=new zr),o||co(t)?rs(t,e,r,n,i,a):function(t,e,r,n,i,s,a){switch(r){case F:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case M:return!(t.byteLength!=e.byteLength||!s(new Vt(t),new Vt(e)));case T:case S:case w:return $a(+t,+e);case A:return t.name==e.name&&t.message==e.message;case D:case x:return t==e+"";case L:var o=cr;case I:var l=1&n;if(o||(o=dr),t.size!=e.size&&!l)return!1;var c=a.get(t);if(c)return c==e;n|=2,a.set(t,e);var u=rs(o(t),o(e),n,i,s,a);return a.delete(t),u;case P:if(Nr)return Nr.call(t)==Nr.call(e)}return!1}(t,e,c,r,n,i,a);if(!(1&r)){var p=h&&Ft.call(t,"__wrapped__"),g=d&&Ft.call(e,"__wrapped__");if(p||g){var m=p?t.value():t,y=g?e.value():e;return a||(a=new zr),i(m,y,r,n,a)}}if(!f)return!1;return a||(a=new zr),function(t,e,r,n,i,a){var o=1&r,l=is(t),c=l.length,u=is(e),h=u.length;if(c!=h&&!o)return!1;var d=c;for(;d--;){var f=l[d];if(!(o?f in e:Ft.call(e,f)))return!1}var p=a.get(t),g=a.get(e);if(p&&g)return p==e&&g==t;var m=!0;a.set(t,e),a.set(e,t);var y=o;for(;++d<c;){var v=t[f=l[d]],E=e[f];if(n)var b=o?n(E,v,f,e,t,a):n(v,E,f,t,e,a);if(!(b===s?v===E||i(v,E,r,n,a):b)){m=!1;break}y||(y="constructor"==f)}if(m&&!y){var T=t.constructor,S=e.constructor;T==S||!("constructor"in t)||!("constructor"in e)||"function"==typeof T&&T instanceof T&&"function"==typeof S&&S instanceof S||(m=!1)}return a.delete(t),a.delete(e),m}(t,e,r,n,i,a)}(t,e,r,n,Pn,i))}function On(t,e,r,n){var i=r.length,a=i,o=!n;if(null==t)return!a;for(t=wt(t);i--;){var l=r[i];if(o&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++i<a;){var c=(l=r[i])[0],u=t[c],h=l[1];if(o&&l[2]){if(u===s&&!(c in t))return!1}else{var d=new zr;if(n)var f=n(u,h,c,t,e,d);if(!(f===s?Pn(h,u,3,n,d):f))return!1}}return!0}function Mn(t){return!(!to(t)||(e=t,Nt&&Nt in e))&&(Qa(t)?Gt:Et).test(Ns(t));var e}function Fn(t){return"function"==typeof t?t:null==t?il:"object"==typeof t?Ha(t)?Gn(t[0],t[1]):jn(t):fl(t)}function Bn(t){if(!_s(t))return je(t);var e=[];for(var r in wt(t))Ft.call(t,r)&&"constructor"!=r&&e.push(r);return e}function Nn(t){if(!to(t))return function(t){var e=[];if(null!=t)for(var r in wt(t))e.push(r);return e}(t);var e=_s(t),r=[];for(var n in t)("constructor"!=n||!e&&Ft.call(t,n))&&r.push(n);return r}function Un(t,e){return t<e}function $n(t,e){var r=-1,i=Wa(t)?n(t.length):[];return fn(t,(function(t,n,s){i[++r]=e(t,n,s)})),i}function jn(t){var e=hs(t);return 1==e.length&&e[0][2]?Ls(e[0][0],e[0][1]):function(r){return r===t||On(r,t,e)}}function Gn(t,e){return Ts(t)&&ks(e)?Ls(Bs(t),e):function(r){var n=wo(r,t);return n===s&&n===e?Ro(r,t):Pn(e,n,3)}}function Kn(t,e,r,n,i){t!==e&&En(e,(function(a,o){if(i||(i=new zr),to(a))!function(t,e,r,n,i,a,o){var l=Cs(t,r),c=Cs(e,r),u=o.get(c);if(u)return void tn(t,r,u);var h=a?a(l,c,r+"",t,e,o):s,d=h===s;if(d){var f=Ha(c),p=!f&&qa(c),g=!f&&!p&&co(c);h=c,f||p||g?Ha(l)?h=l:Ya(l)?h=Di(l):p?(d=!1,h=_i(c,!0)):g?(d=!1,h=Li(c,!0)):h=[]:io(c)||Ka(c)?(h=l,Ka(l)?h=vo(l):to(l)&&!Qa(l)||(h=ys(c))):d=!1}d&&(o.set(c,h),i(h,c,n,a,o),o.delete(c));tn(t,r,h)}(t,e,o,r,Kn,n,i);else{var l=n?n(Cs(t,o),a,o+"",t,e,i):s;l===s&&(l=a),tn(t,o,l)}}),Po)}function Hn(t,e){var r=t.length;if(r)return Es(e+=e<0?r:0,r)?t[e]:s}function Vn(t,e,r){e=e.length?Fe(e,(function(t){return Ha(t)?function(e){return _n(e,1===t.length?t[0]:t)}:t})):[il];var n=-1;e=Fe(e,tr(cs()));var i=$n(t,(function(t,r,i){var s=Fe(e,(function(e){return e(t)}));return{criteria:s,index:++n,value:t}}));return function(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}(i,(function(t,e){return function(t,e,r){var n=-1,i=t.criteria,s=e.criteria,a=i.length,o=r.length;for(;++n<a;){var l=wi(i[n],s[n]);if(l)return n>=o?l:l*("desc"==r[n]?-1:1)}return t.index-e.index}(t,e,r)}))}function Wn(t,e,r){for(var n=-1,i=e.length,s={};++n<i;){var a=e[n],o=_n(t,a);r(o,a)&&ti(s,bi(a,t),o)}return s}function Yn(t,e,r,n){var i=n?Ve:He,s=-1,a=e.length,o=t;for(t===e&&(e=Di(e)),r&&(o=Fe(t,tr(r)));++s<a;)for(var l=0,c=e[s],u=r?r(c):c;(l=i(o,u,l,n))>-1;)o!==t&&Xt.call(o,l,1),Xt.call(t,l,1);return t}function qn(t,e){for(var r=t?e.length:0,n=r-1;r--;){var i=e[r];if(r==n||i!==s){var s=i;Es(i)?Xt.call(t,i,1):di(t,i)}}return t}function zn(t,e){return t+ge(Sr()*(e-t+1))}function Xn(t,e){var r="";if(!t||e<1||e>g)return r;do{e%2&&(r+=t),(e=ge(e/2))&&(t+=t)}while(e);return r}function Qn(t,e){return xs(ws(t,e,il),t+"")}function Jn(t){return Qr(jo(t))}function Zn(t,e){var r=jo(t);return Ms(r,ln(e,0,r.length))}function ti(t,e,r,n){if(!to(t))return t;for(var i=-1,a=(e=bi(e,t)).length,o=a-1,l=t;null!=l&&++i<a;){var c=Bs(e[i]),u=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(i!=o){var h=l[c];(u=n?n(h,c,l):s)===s&&(u=to(h)?h:Es(e[i+1])?[]:{})}en(l,c,u),l=l[c]}return t}var ei=Dr?function(t,e){return Dr.set(t,e),t}:il,ri=te?function(t,e){return te(t,"toString",{configurable:!0,enumerable:!1,value:el(e),writable:!0})}:il;function ni(t){return Ms(jo(t))}function ii(t,e,r){var i=-1,s=t.length;e<0&&(e=-e>s?0:s+e),(r=r>s?s:r)<0&&(r+=s),s=e>r?0:r-e>>>0,e>>>=0;for(var a=n(s);++i<s;)a[i]=t[i+e];return a}function si(t,e){var r;return fn(t,(function(t,n,i){return!(r=e(t,n,i))})),!!r}function ai(t,e,r){var n=0,i=null==t?n:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;n<i;){var s=n+i>>>1,a=t[s];null!==a&&!lo(a)&&(r?a<=e:a<e)?n=s+1:i=s}return i}return oi(t,e,il,r)}function oi(t,e,r,n){var i=0,a=null==t?0:t.length;if(0===a)return 0;for(var o=(e=r(e))!=e,l=null===e,c=lo(e),u=e===s;i<a;){var h=ge((i+a)/2),d=r(t[h]),f=d!==s,p=null===d,g=d==d,m=lo(d);if(o)var y=n||g;else y=u?g&&(n||f):l?g&&f&&(n||!p):c?g&&f&&!p&&(n||!m):!p&&!m&&(n?d<=e:d<e);y?i=h+1:a=h}return Er(a,4294967294)}function li(t,e){for(var r=-1,n=t.length,i=0,s=[];++r<n;){var a=t[r],o=e?e(a):a;if(!r||!$a(o,l)){var l=o;s[i++]=0===a?0:a}}return s}function ci(t){return"number"==typeof t?t:lo(t)?m:+t}function ui(t){if("string"==typeof t)return t;if(Ha(t))return Fe(t,ui)+"";if(lo(t))return Ur?Ur.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function hi(t,e,r){var n=-1,i=Oe,s=t.length,a=!0,o=[],l=o;if(r)a=!1,i=Me;else if(s>=200){var c=e?null:Xi(t);if(c)return dr(c);a=!1,i=rr,l=new qr}else l=e?[]:o;t:for(;++n<s;){var u=t[n],h=e?e(u):u;if(u=r||0!==u?u:0,a&&h==h){for(var d=l.length;d--;)if(l[d]===h)continue t;e&&l.push(h),o.push(u)}else i(l,h,r)||(l!==o&&l.push(h),o.push(u))}return o}function di(t,e){return null==(t=Rs(t,e=bi(e,t)))||delete t[Bs(Xs(e))]}function fi(t,e,r,n){return ti(t,e,r(_n(t,e)),n)}function pi(t,e,r,n){for(var i=t.length,s=n?i:-1;(n?s--:++s<i)&&e(t[s],s,t););return r?ii(t,n?0:s,n?s+1:i):ii(t,n?s+1:0,n?i:s)}function gi(t,e){var r=t;return r instanceof Hr&&(r=r.value()),Ne(e,(function(t,e){return e.func.apply(e.thisArg,Be([t],e.args))}),r)}function mi(t,e,r){var i=t.length;if(i<2)return i?hi(t[0]):[];for(var s=-1,a=n(i);++s<i;)for(var o=t[s],l=-1;++l<i;)l!=s&&(a[s]=dn(a[s]||o,t[l],e,r));return hi(vn(a,1),e,r)}function yi(t,e,r){for(var n=-1,i=t.length,a=e.length,o={};++n<i;){var l=n<a?e[n]:s;r(o,t[n],l)}return o}function vi(t){return Ya(t)?t:[]}function Ei(t){return"function"==typeof t?t:il}function bi(t,e){return Ha(t)?t:Ts(t,e)?[t]:Fs(Eo(t))}var Ti=Qn;function Si(t,e,r){var n=t.length;return r=r===s?n:r,!e&&r>=n?t:ii(t,e,r)}var Ai=ne||function(t){return me.clearTimeout(t)};function _i(t,e){if(e)return t.slice();var r=t.length,n=Wt?Wt(r):new t.constructor(r);return t.copy(n),n}function ki(t){var e=new t.constructor(t.byteLength);return new Vt(e).set(new Vt(t)),e}function Li(t,e){var r=e?ki(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function wi(t,e){if(t!==e){var r=t!==s,n=null===t,i=t==t,a=lo(t),o=e!==s,l=null===e,c=e==e,u=lo(e);if(!l&&!u&&!a&&t>e||a&&o&&c&&!l&&!u||n&&o&&c||!r&&c||!i)return 1;if(!n&&!a&&!u&&t<e||u&&r&&i&&!n&&!a||l&&r&&i||!o&&i||!c)return-1}return 0}function Ri(t,e,r,i){for(var s=-1,a=t.length,o=r.length,l=-1,c=e.length,u=ze(a-o,0),h=n(c+u),d=!i;++l<c;)h[l]=e[l];for(;++s<o;)(d||s<a)&&(h[r[s]]=t[s]);for(;u--;)h[l++]=t[s++];return h}function Ci(t,e,r,i){for(var s=-1,a=t.length,o=-1,l=r.length,c=-1,u=e.length,h=ze(a-l,0),d=n(h+u),f=!i;++s<h;)d[s]=t[s];for(var p=s;++c<u;)d[p+c]=e[c];for(;++o<l;)(f||s<a)&&(d[p+r[o]]=t[s++]);return d}function Di(t,e){var r=-1,i=t.length;for(e||(e=n(i));++r<i;)e[r]=t[r];return e}function Ii(t,e,r,n){var i=!r;r||(r={});for(var a=-1,o=e.length;++a<o;){var l=e[a],c=n?n(r[l],t[l],l,r,t):s;c===s&&(c=t[l]),i?an(r,l,c):en(r,l,c)}return r}function xi(t,e){return function(r,n){var i=Ha(r)?Ce:nn,s=e?e():{};return i(r,t,cs(n,2),s)}}function Pi(t){return Qn((function(e,r){var n=-1,i=r.length,a=i>1?r[i-1]:s,o=i>2?r[2]:s;for(a=t.length>3&&"function"==typeof a?(i--,a):s,o&&bs(r[0],r[1],o)&&(a=i<3?s:a,i=1),e=wt(e);++n<i;){var l=r[n];l&&t(e,l,n,a)}return e}))}function Oi(t,e){return function(r,n){if(null==r)return r;if(!Wa(r))return t(r,n);for(var i=r.length,s=e?i:-1,a=wt(r);(e?s--:++s<i)&&!1!==n(a[s],s,a););return r}}function Mi(t){return function(e,r,n){for(var i=-1,s=wt(e),a=n(e),o=a.length;o--;){var l=a[t?o:++i];if(!1===r(s[l],l,s))break}return e}}function Fi(t){return function(e){var r=lr(e=Eo(e))?gr(e):s,n=r?r[0]:e.charAt(0),i=r?Si(r,1).join(""):e.slice(1);return n[t]()+i}}function Bi(t){return function(e){return Ne(Jo(Ho(e).replace(ee,"")),t,"")}}function Ni(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var r=jr(t.prototype),n=t.apply(r,e);return to(n)?n:r}}function Ui(t){return function(e,r,n){var i=wt(e);if(!Wa(e)){var a=cs(r,3);e=xo(e),r=function(t){return a(i[t],t,i)}}var o=t(e,r,n);return o>-1?i[a?e[o]:o]:s}}function $i(t){return ns((function(e){var r=e.length,n=r,i=Kr.prototype.thru;for(t&&e.reverse();n--;){var o=e[n];if("function"!=typeof o)throw new Dt(a);if(i&&!l&&"wrapper"==os(o))var l=new Kr([],!0)}for(n=l?n:r;++n<r;){var c=os(o=e[n]),u="wrapper"==c?as(o):s;l=u&&Ss(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?l[os(u[0])].apply(l,u[3]):1==o.length&&Ss(o)?l[c]():l.thru(o)}return function(){var t=arguments,n=t[0];if(l&&1==t.length&&Ha(n))return l.plant(n).value();for(var i=0,s=r?e[i].apply(this,t):n;++i<r;)s=e[i].call(this,s);return s}}))}function ji(t,e,r,i,a,o,l,c,u,h){var f=e&d,p=1&e,g=2&e,m=24&e,y=512&e,v=g?s:Ni(t);return function d(){for(var E=arguments.length,b=n(E),T=E;T--;)b[T]=arguments[T];if(m)var S=ls(d),A=function(t,e){for(var r=t.length,n=0;r--;)t[r]===e&&++n;return n}(b,S);if(i&&(b=Ri(b,i,a,m)),o&&(b=Ci(b,o,l,m)),E-=A,m&&E<h){var _=hr(b,S);return qi(t,e,ji,d.placeholder,r,b,_,c,u,h-E)}var k=p?r:this,L=g?k[t]:t;return E=b.length,c?b=function(t,e){var r=t.length,n=Er(e.length,r),i=Di(t);for(;n--;){var a=e[n];t[n]=Es(a,r)?i[a]:s}return t}(b,c):y&&E>1&&b.reverse(),f&&u<E&&(b.length=u),this&&this!==me&&this instanceof d&&(L=v||Ni(L)),L.apply(k,b)}}function Gi(t,e){return function(r,n){return function(t,e,r,n){return Tn(t,(function(t,i,s){e(n,r(t),i,s)})),n}(r,t,e(n),{})}}function Ki(t,e){return function(r,n){var i;if(r===s&&n===s)return e;if(r!==s&&(i=r),n!==s){if(i===s)return n;"string"==typeof r||"string"==typeof n?(r=ui(r),n=ui(n)):(r=ci(r),n=ci(n)),i=t(r,n)}return i}}function Hi(t){return ns((function(e){return e=Fe(e,tr(cs())),Qn((function(r){var n=this;return t(e,(function(t){return Re(t,n,r)}))}))}))}function Vi(t,e){var r=(e=e===s?" ":ui(e)).length;if(r<2)return r?Xn(e,t):e;var n=Xn(e,pe(t/pr(e)));return lr(e)?Si(gr(n),0,t).join(""):n.slice(0,t)}function Wi(t){return function(e,r,i){return i&&"number"!=typeof i&&bs(e,r,i)&&(r=i=s),e=po(e),r===s?(r=e,e=0):r=po(r),function(t,e,r,i){for(var s=-1,a=ze(pe((e-t)/(r||1)),0),o=n(a);a--;)o[i?a:++s]=t,t+=r;return o}(e,r,i=i===s?e<r?1:-1:po(i),t)}}function Yi(t){return function(e,r){return"string"==typeof e&&"string"==typeof r||(e=yo(e),r=yo(r)),t(e,r)}}function qi(t,e,r,n,i,a,o,l,c,d){var f=8&e;e|=f?u:h,4&(e&=~(f?h:u))||(e&=-4);var p=[t,e,i,f?a:s,f?o:s,f?s:a,f?s:o,l,c,d],g=r.apply(s,p);return Ss(t)&&Ds(g,p),g.placeholder=n,Ps(g,t,e)}function zi(t){var e=Lt[t];return function(t,r){if(t=yo(t),(r=null==r?0:Er(go(r),292))&&be(t)){var n=(Eo(t)+"e").split("e");return+((n=(Eo(e(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return e(t)}}var Xi=wr&&1/dr(new wr([,-0]))[1]==p?function(t){return new wr(t)}:cl;function Qi(t){return function(e){var r=gs(e);return r==L?cr(e):r==I?fr(e):function(t,e){return Fe(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Ji(t,e,r,i,o,p,g,m){var y=2&e;if(!y&&"function"!=typeof t)throw new Dt(a);var v=i?i.length:0;if(v||(e&=-97,i=o=s),g=g===s?g:ze(go(g),0),m=m===s?m:go(m),v-=o?o.length:0,e&h){var E=i,b=o;i=o=s}var T=y?s:as(t),S=[t,e,r,i,o,E,b,p,g,m];if(T&&function(t,e){var r=t[1],n=e[1],i=r|n,s=i<131,a=n==d&&8==r||n==d&&r==f&&t[7].length<=e[8]||384==n&&e[7].length<=e[8]&&8==r;if(!s&&!a)return t;1&n&&(t[2]=e[2],i|=1&r?0:4);var o=e[3];if(o){var c=t[3];t[3]=c?Ri(c,o,e[4]):o,t[4]=c?hr(t[3],l):e[4]}(o=e[5])&&(c=t[5],t[5]=c?Ci(c,o,e[6]):o,t[6]=c?hr(t[5],l):e[6]);(o=e[7])&&(t[7]=o);n&d&&(t[8]=null==t[8]?e[8]:Er(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(S,T),t=S[0],e=S[1],r=S[2],i=S[3],o=S[4],!(m=S[9]=S[9]===s?y?0:t.length:ze(S[9]-v,0))&&24&e&&(e&=-25),e&&1!=e)A=8==e||e==c?function(t,e,r){var i=Ni(t);return function a(){for(var o=arguments.length,l=n(o),c=o,u=ls(a);c--;)l[c]=arguments[c];var h=o<3&&l[0]!==u&&l[o-1]!==u?[]:hr(l,u);return(o-=h.length)<r?qi(t,e,ji,a.placeholder,s,l,h,s,s,r-o):Re(this&&this!==me&&this instanceof a?i:t,this,l)}}(t,e,m):e!=u&&33!=e||o.length?ji.apply(s,S):function(t,e,r,i){var s=1&e,a=Ni(t);return function e(){for(var o=-1,l=arguments.length,c=-1,u=i.length,h=n(u+l),d=this&&this!==me&&this instanceof e?a:t;++c<u;)h[c]=i[c];for(;l--;)h[c++]=arguments[++o];return Re(d,s?r:this,h)}}(t,e,r,i);else var A=function(t,e,r){var n=1&e,i=Ni(t);return function e(){return(this&&this!==me&&this instanceof e?i:t).apply(n?r:this,arguments)}}(t,e,r);return Ps((T?ei:Ds)(A,S),t,e)}function Zi(t,e,r,n){return t===s||$a(t,Pt[r])&&!Ft.call(n,r)?e:t}function ts(t,e,r,n,i,a){return to(t)&&to(e)&&(a.set(e,t),Kn(t,e,s,ts,a),a.delete(e)),t}function es(t){return io(t)?s:t}function rs(t,e,r,n,i,a){var o=1&r,l=t.length,c=e.length;if(l!=c&&!(o&&c>l))return!1;var u=a.get(t),h=a.get(e);if(u&&h)return u==e&&h==t;var d=-1,f=!0,p=2&r?new qr:s;for(a.set(t,e),a.set(e,t);++d<l;){var g=t[d],m=e[d];if(n)var y=o?n(m,g,d,e,t,a):n(g,m,d,t,e,a);if(y!==s){if(y)continue;f=!1;break}if(p){if(!$e(e,(function(t,e){if(!rr(p,e)&&(g===t||i(g,t,r,n,a)))return p.push(e)}))){f=!1;break}}else if(g!==m&&!i(g,m,r,n,a)){f=!1;break}}return a.delete(t),a.delete(e),f}function ns(t){return xs(ws(t,s,Vs),t+"")}function is(t){return kn(t,xo,fs)}function ss(t){return kn(t,Po,ps)}var as=Dr?function(t){return Dr.get(t)}:cl;function os(t){for(var e=t.name+"",r=Ir[e],n=Ft.call(Ir,e)?r.length:0;n--;){var i=r[n],s=i.func;if(null==s||s==t)return i.name}return e}function ls(t){return(Ft.call($r,"placeholder")?$r:t).placeholder}function cs(){var t=$r.iteratee||sl;return t=t===sl?Fn:t,arguments.length?t(arguments[0],arguments[1]):t}function us(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function hs(t){for(var e=xo(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,ks(i)]}return e}function ds(t,e){var r=function(t,e){return null==t?s:t[e]}(t,e);return Mn(r)?r:s}var fs=ye?function(t){return null==t?[]:(t=wt(t),Pe(ye(t),(function(e){return zt.call(t,e)})))}:ml,ps=ye?function(t){for(var e=[];t;)Be(e,fs(t)),t=Yt(t);return e}:ml,gs=Ln;function ms(t,e,r){for(var n=-1,i=(e=bi(e,t)).length,s=!1;++n<i;){var a=Bs(e[n]);if(!(s=null!=t&&r(t,a)))break;t=t[a]}return s||++n!=i?s:!!(i=null==t?0:t.length)&&Za(i)&&Es(a,i)&&(Ha(t)||Ka(t))}function ys(t){return"function"!=typeof t.constructor||_s(t)?{}:jr(Yt(t))}function vs(t){return Ha(t)||Ka(t)||!!(Qt&&t&&t[Qt])}function Es(t,e){var r=typeof t;return!!(e=null==e?g:e)&&("number"==r||"symbol"!=r&&Tt.test(t))&&t>-1&&t%1==0&&t<e}function bs(t,e,r){if(!to(r))return!1;var n=typeof e;return!!("number"==n?Wa(r)&&Es(e,r.length):"string"==n&&e in r)&&$a(r[e],t)}function Ts(t,e){if(Ha(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!lo(t))||(nt.test(t)||!rt.test(t)||null!=e&&t in wt(e))}function Ss(t){var e=os(t),r=$r[e];if("function"!=typeof r||!(e in Hr.prototype))return!1;if(t===r)return!0;var n=as(r);return!!n&&t===n[0]}(_r&&gs(new _r(new ArrayBuffer(1)))!=F||kr&&gs(new kr)!=L||Lr&&gs(Lr.resolve())!=C||wr&&gs(new wr)!=I||Rr&&gs(new Rr)!=O)&&(gs=function(t){var e=Ln(t),r=e==R?t.constructor:s,n=r?Ns(r):"";if(n)switch(n){case xr:return F;case Pr:return L;case Or:return C;case Mr:return I;case Fr:return O}return e});var As=Ot?Qa:yl;function _s(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Pt)}function ks(t){return t==t&&!to(t)}function Ls(t,e){return function(r){return null!=r&&(r[t]===e&&(e!==s||t in wt(r)))}}function ws(t,e,r){return e=ze(e===s?t.length-1:e,0),function(){for(var i=arguments,s=-1,a=ze(i.length-e,0),o=n(a);++s<a;)o[s]=i[e+s];s=-1;for(var l=n(e+1);++s<e;)l[s]=i[s];return l[e]=r(o),Re(t,this,l)}}function Rs(t,e){return e.length<2?t:_n(t,ii(e,0,-1))}function Cs(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Ds=Os(ei),Is=he||function(t,e){return me.setTimeout(t,e)},xs=Os(ri);function Ps(t,e,r){var n=e+"";return xs(t,function(t,e){var r=e.length;if(!r)return t;var n=r-1;return e[n]=(r>1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(ct,"{\n/* [wrapped with "+e+"] */\n")}(n,function(t,e){return De(v,(function(r){var n="_."+r[0];e&r[1]&&!Oe(t,n)&&t.push(n)})),t.sort()}(function(t){var e=t.match(ut);return e?e[1].split(ht):[]}(n),r)))}function Os(t){var e=0,r=0;return function(){var n=br(),i=16-(n-r);if(r=n,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(s,arguments)}}function Ms(t,e){var r=-1,n=t.length,i=n-1;for(e=e===s?n:e;++r<e;){var a=zn(r,i),o=t[a];t[a]=t[r],t[r]=o}return t.length=e,t}var Fs=function(t){var e=Oa(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(it,(function(t,r,n,i){e.push(n?i.replace(pt,"$1"):r||t)})),e}));function Bs(t){if("string"==typeof t||lo(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Ns(t){if(null!=t){try{return Mt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Us(t){if(t instanceof Hr)return t.clone();var e=new Kr(t.__wrapped__,t.__chain__);return e.__actions__=Di(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var $s=Qn((function(t,e){return Ya(t)?dn(t,vn(e,1,Ya,!0)):[]})),js=Qn((function(t,e){var r=Xs(e);return Ya(r)&&(r=s),Ya(t)?dn(t,vn(e,1,Ya,!0),cs(r,2)):[]})),Gs=Qn((function(t,e){var r=Xs(e);return Ya(r)&&(r=s),Ya(t)?dn(t,vn(e,1,Ya,!0),s,r):[]}));function Ks(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=null==r?0:go(r);return i<0&&(i=ze(n+i,0)),Ke(t,cs(e,3),i)}function Hs(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=n-1;return r!==s&&(i=go(r),i=r<0?ze(n+i,0):Er(i,n-1)),Ke(t,cs(e,3),i,!0)}function Vs(t){return(null==t?0:t.length)?vn(t,1):[]}function Ws(t){return t&&t.length?t[0]:s}var Ys=Qn((function(t){var e=Fe(t,vi);return e.length&&e[0]===t[0]?Dn(e):[]})),qs=Qn((function(t){var e=Xs(t),r=Fe(t,vi);return e===Xs(r)?e=s:r.pop(),r.length&&r[0]===t[0]?Dn(r,cs(e,2)):[]})),zs=Qn((function(t){var e=Xs(t),r=Fe(t,vi);return(e="function"==typeof e?e:s)&&r.pop(),r.length&&r[0]===t[0]?Dn(r,s,e):[]}));function Xs(t){var e=null==t?0:t.length;return e?t[e-1]:s}var Qs=Qn(Js);function Js(t,e){return t&&t.length&&e&&e.length?Yn(t,e):t}var Zs=ns((function(t,e){var r=null==t?0:t.length,n=on(t,e);return qn(t,Fe(e,(function(t){return Es(t,r)?+t:t})).sort(wi)),n}));function ta(t){return null==t?t:Ar.call(t)}var ea=Qn((function(t){return hi(vn(t,1,Ya,!0))})),ra=Qn((function(t){var e=Xs(t);return Ya(e)&&(e=s),hi(vn(t,1,Ya,!0),cs(e,2))})),na=Qn((function(t){var e=Xs(t);return e="function"==typeof e?e:s,hi(vn(t,1,Ya,!0),s,e)}));function ia(t){if(!t||!t.length)return[];var e=0;return t=Pe(t,(function(t){if(Ya(t))return e=ze(t.length,e),!0})),Je(e,(function(e){return Fe(t,qe(e))}))}function sa(t,e){if(!t||!t.length)return[];var r=ia(t);return null==e?r:Fe(r,(function(t){return Re(e,s,t)}))}var aa=Qn((function(t,e){return Ya(t)?dn(t,e):[]})),oa=Qn((function(t){return mi(Pe(t,Ya))})),la=Qn((function(t){var e=Xs(t);return Ya(e)&&(e=s),mi(Pe(t,Ya),cs(e,2))})),ca=Qn((function(t){var e=Xs(t);return e="function"==typeof e?e:s,mi(Pe(t,Ya),s,e)})),ua=Qn(ia);var ha=Qn((function(t){var e=t.length,r=e>1?t[e-1]:s;return r="function"==typeof r?(t.pop(),r):s,sa(t,r)}));function da(t){var e=$r(t);return e.__chain__=!0,e}function fa(t,e){return e(t)}var pa=ns((function(t){var e=t.length,r=e?t[0]:0,n=this.__wrapped__,i=function(e){return on(e,t)};return!(e>1||this.__actions__.length)&&n instanceof Hr&&Es(r)?((n=n.slice(r,+r+(e?1:0))).__actions__.push({func:fa,args:[i],thisArg:s}),new Kr(n,this.__chain__).thru((function(t){return e&&!t.length&&t.push(s),t}))):this.thru(i)}));var ga=xi((function(t,e,r){Ft.call(t,r)?++t[r]:an(t,r,1)}));var ma=Ui(Ks),ya=Ui(Hs);function va(t,e){return(Ha(t)?De:fn)(t,cs(e,3))}function Ea(t,e){return(Ha(t)?Ie:pn)(t,cs(e,3))}var ba=xi((function(t,e,r){Ft.call(t,r)?t[r].push(e):an(t,r,[e])}));var Ta=Qn((function(t,e,r){var i=-1,s="function"==typeof e,a=Wa(t)?n(t.length):[];return fn(t,(function(t){a[++i]=s?Re(e,t,r):In(t,e,r)})),a})),Sa=xi((function(t,e,r){an(t,r,e)}));function Aa(t,e){return(Ha(t)?Fe:$n)(t,cs(e,3))}var _a=xi((function(t,e,r){t[r?0:1].push(e)}),(function(){return[[],[]]}));var ka=Qn((function(t,e){if(null==t)return[];var r=e.length;return r>1&&bs(t,e[0],e[1])?e=[]:r>2&&bs(e[0],e[1],e[2])&&(e=[e[0]]),Vn(t,vn(e,1),[])})),La=se||function(){return me.Date.now()};function wa(t,e,r){return e=r?s:e,e=t&&null==e?t.length:e,Ji(t,d,s,s,s,s,e)}function Ra(t,e){var r;if("function"!=typeof e)throw new Dt(a);return t=go(t),function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=s),r}}var Ca=Qn((function(t,e,r){var n=1;if(r.length){var i=hr(r,ls(Ca));n|=u}return Ji(t,n,e,r,i)})),Da=Qn((function(t,e,r){var n=3;if(r.length){var i=hr(r,ls(Da));n|=u}return Ji(e,n,t,r,i)}));function Ia(t,e,r){var n,i,o,l,c,u,h=0,d=!1,f=!1,p=!0;if("function"!=typeof t)throw new Dt(a);function g(e){var r=n,a=i;return n=i=s,h=e,l=t.apply(a,r)}function m(t){var r=t-u;return u===s||r>=e||r<0||f&&t-h>=o}function y(){var t=La();if(m(t))return v(t);c=Is(y,function(t){var r=e-(t-u);return f?Er(r,o-(t-h)):r}(t))}function v(t){return c=s,p&&n?g(t):(n=i=s,l)}function E(){var t=La(),r=m(t);if(n=arguments,i=this,u=t,r){if(c===s)return function(t){return h=t,c=Is(y,e),d?g(t):l}(u);if(f)return Ai(c),c=Is(y,e),g(u)}return c===s&&(c=Is(y,e)),l}return e=yo(e)||0,to(r)&&(d=!!r.leading,o=(f="maxWait"in r)?ze(yo(r.maxWait)||0,e):o,p="trailing"in r?!!r.trailing:p),E.cancel=function(){c!==s&&Ai(c),h=0,n=u=i=c=s},E.flush=function(){return c===s?l:v(La())},E}var xa=Qn((function(t,e){return hn(t,1,e)})),Pa=Qn((function(t,e,r){return hn(t,yo(e)||0,r)}));function Oa(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Dt(a);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var a=t.apply(this,n);return r.cache=s.set(i,a)||s,a};return r.cache=new(Oa.Cache||Yr),r}function Ma(t){if("function"!=typeof t)throw new Dt(a);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Oa.Cache=Yr;var Fa=Ti((function(t,e){var r=(e=1==e.length&&Ha(e[0])?Fe(e[0],tr(cs())):Fe(vn(e,1),tr(cs()))).length;return Qn((function(n){for(var i=-1,s=Er(n.length,r);++i<s;)n[i]=e[i].call(this,n[i]);return Re(t,this,n)}))})),Ba=Qn((function(t,e){var r=hr(e,ls(Ba));return Ji(t,u,s,e,r)})),Na=Qn((function(t,e){var r=hr(e,ls(Na));return Ji(t,h,s,e,r)})),Ua=ns((function(t,e){return Ji(t,f,s,s,s,e)}));function $a(t,e){return t===e||t!=t&&e!=e}var ja=Yi(wn),Ga=Yi((function(t,e){return t>=e})),Ka=xn(function(){return arguments}())?xn:function(t){return eo(t)&&Ft.call(t,"callee")&&!zt.call(t,"callee")},Ha=n.isArray,Va=Se?tr(Se):function(t){return eo(t)&&Ln(t)==M};function Wa(t){return null!=t&&Za(t.length)&&!Qa(t)}function Ya(t){return eo(t)&&Wa(t)}var qa=ve||yl,za=Ae?tr(Ae):function(t){return eo(t)&&Ln(t)==S};function Xa(t){if(!eo(t))return!1;var e=Ln(t);return e==A||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!io(t)}function Qa(t){if(!to(t))return!1;var e=Ln(t);return e==_||e==k||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ja(t){return"number"==typeof t&&t==go(t)}function Za(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=g}function to(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function eo(t){return null!=t&&"object"==typeof t}var ro=_e?tr(_e):function(t){return eo(t)&&gs(t)==L};function no(t){return"number"==typeof t||eo(t)&&Ln(t)==w}function io(t){if(!eo(t)||Ln(t)!=R)return!1;var e=Yt(t);if(null===e)return!0;var r=Ft.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&Mt.call(r)==$t}var so=ke?tr(ke):function(t){return eo(t)&&Ln(t)==D};var ao=Le?tr(Le):function(t){return eo(t)&&gs(t)==I};function oo(t){return"string"==typeof t||!Ha(t)&&eo(t)&&Ln(t)==x}function lo(t){return"symbol"==typeof t||eo(t)&&Ln(t)==P}var co=we?tr(we):function(t){return eo(t)&&Za(t.length)&&!!ce[Ln(t)]};var uo=Yi(Un),ho=Yi((function(t,e){return t<=e}));function fo(t){if(!t)return[];if(Wa(t))return oo(t)?gr(t):Di(t);if(Jt&&t[Jt])return function(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}(t[Jt]());var e=gs(t);return(e==L?cr:e==I?dr:jo)(t)}function po(t){return t?(t=yo(t))===p||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function go(t){var e=po(t),r=e%1;return e==e?r?e-r:e:0}function mo(t){return t?ln(go(t),0,y):0}function yo(t){if("number"==typeof t)return t;if(lo(t))return m;if(to(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=to(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ze(t);var r=vt.test(t);return r||bt.test(t)?fe(t.slice(2),r?2:8):yt.test(t)?m:+t}function vo(t){return Ii(t,Po(t))}function Eo(t){return null==t?"":ui(t)}var bo=Pi((function(t,e){if(_s(e)||Wa(e))Ii(e,xo(e),t);else for(var r in e)Ft.call(e,r)&&en(t,r,e[r])})),To=Pi((function(t,e){Ii(e,Po(e),t)})),So=Pi((function(t,e,r,n){Ii(e,Po(e),t,n)})),Ao=Pi((function(t,e,r,n){Ii(e,xo(e),t,n)})),_o=ns(on);var ko=Qn((function(t,e){t=wt(t);var r=-1,n=e.length,i=n>2?e[2]:s;for(i&&bs(e[0],e[1],i)&&(n=1);++r<n;)for(var a=e[r],o=Po(a),l=-1,c=o.length;++l<c;){var u=o[l],h=t[u];(h===s||$a(h,Pt[u])&&!Ft.call(t,u))&&(t[u]=a[u])}return t})),Lo=Qn((function(t){return t.push(s,ts),Re(Mo,s,t)}));function wo(t,e,r){var n=null==t?s:_n(t,e);return n===s?r:n}function Ro(t,e){return null!=t&&ms(t,e,Cn)}var Co=Gi((function(t,e,r){null!=e&&"function"!=typeof e.toString&&(e=Ut.call(e)),t[e]=r}),el(il)),Do=Gi((function(t,e,r){null!=e&&"function"!=typeof e.toString&&(e=Ut.call(e)),Ft.call(t,e)?t[e].push(r):t[e]=[r]}),cs),Io=Qn(In);function xo(t){return Wa(t)?Xr(t):Bn(t)}function Po(t){return Wa(t)?Xr(t,!0):Nn(t)}var Oo=Pi((function(t,e,r){Kn(t,e,r)})),Mo=Pi((function(t,e,r,n){Kn(t,e,r,n)})),Fo=ns((function(t,e){var r={};if(null==t)return r;var n=!1;e=Fe(e,(function(e){return e=bi(e,t),n||(n=e.length>1),e})),Ii(t,ss(t),r),n&&(r=cn(r,7,es));for(var i=e.length;i--;)di(r,e[i]);return r}));var Bo=ns((function(t,e){return null==t?{}:function(t,e){return Wn(t,e,(function(e,r){return Ro(t,r)}))}(t,e)}));function No(t,e){if(null==t)return{};var r=Fe(ss(t),(function(t){return[t]}));return e=cs(e),Wn(t,r,(function(t,r){return e(t,r[0])}))}var Uo=Qi(xo),$o=Qi(Po);function jo(t){return null==t?[]:er(t,xo(t))}var Go=Bi((function(t,e,r){return e=e.toLowerCase(),t+(r?Ko(e):e)}));function Ko(t){return Qo(Eo(t).toLowerCase())}function Ho(t){return(t=Eo(t))&&t.replace(St,sr).replace(re,"")}var Vo=Bi((function(t,e,r){return t+(r?"-":"")+e.toLowerCase()})),Wo=Bi((function(t,e,r){return t+(r?" ":"")+e.toLowerCase()})),Yo=Fi("toLowerCase");var qo=Bi((function(t,e,r){return t+(r?"_":"")+e.toLowerCase()}));var zo=Bi((function(t,e,r){return t+(r?" ":"")+Qo(e)}));var Xo=Bi((function(t,e,r){return t+(r?" ":"")+e.toUpperCase()})),Qo=Fi("toUpperCase");function Jo(t,e,r){return t=Eo(t),(e=r?s:e)===s?function(t){return ae.test(t)}(t)?function(t){return t.match(ie)||[]}(t):function(t){return t.match(dt)||[]}(t):t.match(e)||[]}var Zo=Qn((function(t,e){try{return Re(t,s,e)}catch(t){return Xa(t)?t:new lt(t)}})),tl=ns((function(t,e){return De(e,(function(e){e=Bs(e),an(t,e,Ca(t[e],t))})),t}));function el(t){return function(){return t}}var rl=$i(),nl=$i(!0);function il(t){return t}function sl(t){return Fn("function"==typeof t?t:cn(t,1))}var al=Qn((function(t,e){return function(r){return In(r,t,e)}})),ol=Qn((function(t,e){return function(r){return In(t,r,e)}}));function ll(t,e,r){var n=xo(e),i=An(e,n);null!=r||to(e)&&(i.length||!n.length)||(r=e,e=t,t=this,i=An(e,xo(e)));var s=!(to(r)&&"chain"in r&&!r.chain),a=Qa(t);return De(i,(function(r){var n=e[r];t[r]=n,a&&(t.prototype[r]=function(){var e=this.__chain__;if(s||e){var r=t(this.__wrapped__);return(r.__actions__=Di(this.__actions__)).push({func:n,args:arguments,thisArg:t}),r.__chain__=e,r}return n.apply(t,Be([this.value()],arguments))})})),t}function cl(){}var ul=Hi(Fe),hl=Hi(xe),dl=Hi($e);function fl(t){return Ts(t)?qe(Bs(t)):function(t){return function(e){return _n(e,t)}}(t)}var pl=Wi(),gl=Wi(!0);function ml(){return[]}function yl(){return!1}var vl=Ki((function(t,e){return t+e}),0),El=zi("ceil"),bl=Ki((function(t,e){return t/e}),1),Tl=zi("floor");var Sl,Al=Ki((function(t,e){return t*e}),1),_l=zi("round"),kl=Ki((function(t,e){return t-e}),0);return $r.after=function(t,e){if("function"!=typeof e)throw new Dt(a);return t=go(t),function(){if(--t<1)return e.apply(this,arguments)}},$r.ary=wa,$r.assign=bo,$r.assignIn=To,$r.assignInWith=So,$r.assignWith=Ao,$r.at=_o,$r.before=Ra,$r.bind=Ca,$r.bindAll=tl,$r.bindKey=Da,$r.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Ha(t)?t:[t]},$r.chain=da,$r.chunk=function(t,e,r){e=(r?bs(t,e,r):e===s)?1:ze(go(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var a=0,o=0,l=n(pe(i/e));a<i;)l[o++]=ii(t,a,a+=e);return l},$r.compact=function(t){for(var e=-1,r=null==t?0:t.length,n=0,i=[];++e<r;){var s=t[e];s&&(i[n++]=s)}return i},$r.concat=function(){var t=arguments.length;if(!t)return[];for(var e=n(t-1),r=arguments[0],i=t;i--;)e[i-1]=arguments[i];return Be(Ha(r)?Di(r):[r],vn(e,1))},$r.cond=function(t){var e=null==t?0:t.length,r=cs();return t=e?Fe(t,(function(t){if("function"!=typeof t[1])throw new Dt(a);return[r(t[0]),t[1]]})):[],Qn((function(r){for(var n=-1;++n<e;){var i=t[n];if(Re(i[0],this,r))return Re(i[1],this,r)}}))},$r.conforms=function(t){return function(t){var e=xo(t);return function(r){return un(r,t,e)}}(cn(t,1))},$r.constant=el,$r.countBy=ga,$r.create=function(t,e){var r=jr(t);return null==e?r:sn(r,e)},$r.curry=function t(e,r,n){var i=Ji(e,8,s,s,s,s,s,r=n?s:r);return i.placeholder=t.placeholder,i},$r.curryRight=function t(e,r,n){var i=Ji(e,c,s,s,s,s,s,r=n?s:r);return i.placeholder=t.placeholder,i},$r.debounce=Ia,$r.defaults=ko,$r.defaultsDeep=Lo,$r.defer=xa,$r.delay=Pa,$r.difference=$s,$r.differenceBy=js,$r.differenceWith=Gs,$r.drop=function(t,e,r){var n=null==t?0:t.length;return n?ii(t,(e=r||e===s?1:go(e))<0?0:e,n):[]},$r.dropRight=function(t,e,r){var n=null==t?0:t.length;return n?ii(t,0,(e=n-(e=r||e===s?1:go(e)))<0?0:e):[]},$r.dropRightWhile=function(t,e){return t&&t.length?pi(t,cs(e,3),!0,!0):[]},$r.dropWhile=function(t,e){return t&&t.length?pi(t,cs(e,3),!0):[]},$r.fill=function(t,e,r,n){var i=null==t?0:t.length;return i?(r&&"number"!=typeof r&&bs(t,e,r)&&(r=0,n=i),function(t,e,r,n){var i=t.length;for((r=go(r))<0&&(r=-r>i?0:i+r),(n=n===s||n>i?i:go(n))<0&&(n+=i),n=r>n?0:mo(n);r<n;)t[r++]=e;return t}(t,e,r,n)):[]},$r.filter=function(t,e){return(Ha(t)?Pe:yn)(t,cs(e,3))},$r.flatMap=function(t,e){return vn(Aa(t,e),1)},$r.flatMapDeep=function(t,e){return vn(Aa(t,e),p)},$r.flatMapDepth=function(t,e,r){return r=r===s?1:go(r),vn(Aa(t,e),r)},$r.flatten=Vs,$r.flattenDeep=function(t){return(null==t?0:t.length)?vn(t,p):[]},$r.flattenDepth=function(t,e){return(null==t?0:t.length)?vn(t,e=e===s?1:go(e)):[]},$r.flip=function(t){return Ji(t,512)},$r.flow=rl,$r.flowRight=nl,$r.fromPairs=function(t){for(var e=-1,r=null==t?0:t.length,n={};++e<r;){var i=t[e];n[i[0]]=i[1]}return n},$r.functions=function(t){return null==t?[]:An(t,xo(t))},$r.functionsIn=function(t){return null==t?[]:An(t,Po(t))},$r.groupBy=ba,$r.initial=function(t){return(null==t?0:t.length)?ii(t,0,-1):[]},$r.intersection=Ys,$r.intersectionBy=qs,$r.intersectionWith=zs,$r.invert=Co,$r.invertBy=Do,$r.invokeMap=Ta,$r.iteratee=sl,$r.keyBy=Sa,$r.keys=xo,$r.keysIn=Po,$r.map=Aa,$r.mapKeys=function(t,e){var r={};return e=cs(e,3),Tn(t,(function(t,n,i){an(r,e(t,n,i),t)})),r},$r.mapValues=function(t,e){var r={};return e=cs(e,3),Tn(t,(function(t,n,i){an(r,n,e(t,n,i))})),r},$r.matches=function(t){return jn(cn(t,1))},$r.matchesProperty=function(t,e){return Gn(t,cn(e,1))},$r.memoize=Oa,$r.merge=Oo,$r.mergeWith=Mo,$r.method=al,$r.methodOf=ol,$r.mixin=ll,$r.negate=Ma,$r.nthArg=function(t){return t=go(t),Qn((function(e){return Hn(e,t)}))},$r.omit=Fo,$r.omitBy=function(t,e){return No(t,Ma(cs(e)))},$r.once=function(t){return Ra(2,t)},$r.orderBy=function(t,e,r,n){return null==t?[]:(Ha(e)||(e=null==e?[]:[e]),Ha(r=n?s:r)||(r=null==r?[]:[r]),Vn(t,e,r))},$r.over=ul,$r.overArgs=Fa,$r.overEvery=hl,$r.overSome=dl,$r.partial=Ba,$r.partialRight=Na,$r.partition=_a,$r.pick=Bo,$r.pickBy=No,$r.property=fl,$r.propertyOf=function(t){return function(e){return null==t?s:_n(t,e)}},$r.pull=Qs,$r.pullAll=Js,$r.pullAllBy=function(t,e,r){return t&&t.length&&e&&e.length?Yn(t,e,cs(r,2)):t},$r.pullAllWith=function(t,e,r){return t&&t.length&&e&&e.length?Yn(t,e,s,r):t},$r.pullAt=Zs,$r.range=pl,$r.rangeRight=gl,$r.rearg=Ua,$r.reject=function(t,e){return(Ha(t)?Pe:yn)(t,Ma(cs(e,3)))},$r.remove=function(t,e){var r=[];if(!t||!t.length)return r;var n=-1,i=[],s=t.length;for(e=cs(e,3);++n<s;){var a=t[n];e(a,n,t)&&(r.push(a),i.push(n))}return qn(t,i),r},$r.rest=function(t,e){if("function"!=typeof t)throw new Dt(a);return Qn(t,e=e===s?e:go(e))},$r.reverse=ta,$r.sampleSize=function(t,e,r){return e=(r?bs(t,e,r):e===s)?1:go(e),(Ha(t)?Jr:Zn)(t,e)},$r.set=function(t,e,r){return null==t?t:ti(t,e,r)},$r.setWith=function(t,e,r,n){return n="function"==typeof n?n:s,null==t?t:ti(t,e,r,n)},$r.shuffle=function(t){return(Ha(t)?Zr:ni)(t)},$r.slice=function(t,e,r){var n=null==t?0:t.length;return n?(r&&"number"!=typeof r&&bs(t,e,r)?(e=0,r=n):(e=null==e?0:go(e),r=r===s?n:go(r)),ii(t,e,r)):[]},$r.sortBy=ka,$r.sortedUniq=function(t){return t&&t.length?li(t):[]},$r.sortedUniqBy=function(t,e){return t&&t.length?li(t,cs(e,2)):[]},$r.split=function(t,e,r){return r&&"number"!=typeof r&&bs(t,e,r)&&(e=r=s),(r=r===s?y:r>>>0)?(t=Eo(t))&&("string"==typeof e||null!=e&&!so(e))&&!(e=ui(e))&&lr(t)?Si(gr(t),0,r):t.split(e,r):[]},$r.spread=function(t,e){if("function"!=typeof t)throw new Dt(a);return e=null==e?0:ze(go(e),0),Qn((function(r){var n=r[e],i=Si(r,0,e);return n&&Be(i,n),Re(t,this,i)}))},$r.tail=function(t){var e=null==t?0:t.length;return e?ii(t,1,e):[]},$r.take=function(t,e,r){return t&&t.length?ii(t,0,(e=r||e===s?1:go(e))<0?0:e):[]},$r.takeRight=function(t,e,r){var n=null==t?0:t.length;return n?ii(t,(e=n-(e=r||e===s?1:go(e)))<0?0:e,n):[]},$r.takeRightWhile=function(t,e){return t&&t.length?pi(t,cs(e,3),!1,!0):[]},$r.takeWhile=function(t,e){return t&&t.length?pi(t,cs(e,3)):[]},$r.tap=function(t,e){return e(t),t},$r.throttle=function(t,e,r){var n=!0,i=!0;if("function"!=typeof t)throw new Dt(a);return to(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),Ia(t,e,{leading:n,maxWait:e,trailing:i})},$r.thru=fa,$r.toArray=fo,$r.toPairs=Uo,$r.toPairsIn=$o,$r.toPath=function(t){return Ha(t)?Fe(t,Bs):lo(t)?[t]:Di(Fs(Eo(t)))},$r.toPlainObject=vo,$r.transform=function(t,e,r){var n=Ha(t),i=n||qa(t)||co(t);if(e=cs(e,4),null==r){var s=t&&t.constructor;r=i?n?new s:[]:to(t)&&Qa(s)?jr(Yt(t)):{}}return(i?De:Tn)(t,(function(t,n,i){return e(r,t,n,i)})),r},$r.unary=function(t){return wa(t,1)},$r.union=ea,$r.unionBy=ra,$r.unionWith=na,$r.uniq=function(t){return t&&t.length?hi(t):[]},$r.uniqBy=function(t,e){return t&&t.length?hi(t,cs(e,2)):[]},$r.uniqWith=function(t,e){return e="function"==typeof e?e:s,t&&t.length?hi(t,s,e):[]},$r.unset=function(t,e){return null==t||di(t,e)},$r.unzip=ia,$r.unzipWith=sa,$r.update=function(t,e,r){return null==t?t:fi(t,e,Ei(r))},$r.updateWith=function(t,e,r,n){return n="function"==typeof n?n:s,null==t?t:fi(t,e,Ei(r),n)},$r.values=jo,$r.valuesIn=function(t){return null==t?[]:er(t,Po(t))},$r.without=aa,$r.words=Jo,$r.wrap=function(t,e){return Ba(Ei(e),t)},$r.xor=oa,$r.xorBy=la,$r.xorWith=ca,$r.zip=ua,$r.zipObject=function(t,e){return yi(t||[],e||[],en)},$r.zipObjectDeep=function(t,e){return yi(t||[],e||[],ti)},$r.zipWith=ha,$r.entries=Uo,$r.entriesIn=$o,$r.extend=To,$r.extendWith=So,ll($r,$r),$r.add=vl,$r.attempt=Zo,$r.camelCase=Go,$r.capitalize=Ko,$r.ceil=El,$r.clamp=function(t,e,r){return r===s&&(r=e,e=s),r!==s&&(r=(r=yo(r))==r?r:0),e!==s&&(e=(e=yo(e))==e?e:0),ln(yo(t),e,r)},$r.clone=function(t){return cn(t,4)},$r.cloneDeep=function(t){return cn(t,5)},$r.cloneDeepWith=function(t,e){return cn(t,5,e="function"==typeof e?e:s)},$r.cloneWith=function(t,e){return cn(t,4,e="function"==typeof e?e:s)},$r.conformsTo=function(t,e){return null==e||un(t,e,xo(e))},$r.deburr=Ho,$r.defaultTo=function(t,e){return null==t||t!=t?e:t},$r.divide=bl,$r.endsWith=function(t,e,r){t=Eo(t),e=ui(e);var n=t.length,i=r=r===s?n:ln(go(r),0,n);return(r-=e.length)>=0&&t.slice(r,i)==e},$r.eq=$a,$r.escape=function(t){return(t=Eo(t))&&J.test(t)?t.replace(X,ar):t},$r.escapeRegExp=function(t){return(t=Eo(t))&&at.test(t)?t.replace(st,"\\$&"):t},$r.every=function(t,e,r){var n=Ha(t)?xe:gn;return r&&bs(t,e,r)&&(e=s),n(t,cs(e,3))},$r.find=ma,$r.findIndex=Ks,$r.findKey=function(t,e){return Ge(t,cs(e,3),Tn)},$r.findLast=ya,$r.findLastIndex=Hs,$r.findLastKey=function(t,e){return Ge(t,cs(e,3),Sn)},$r.floor=Tl,$r.forEach=va,$r.forEachRight=Ea,$r.forIn=function(t,e){return null==t?t:En(t,cs(e,3),Po)},$r.forInRight=function(t,e){return null==t?t:bn(t,cs(e,3),Po)},$r.forOwn=function(t,e){return t&&Tn(t,cs(e,3))},$r.forOwnRight=function(t,e){return t&&Sn(t,cs(e,3))},$r.get=wo,$r.gt=ja,$r.gte=Ga,$r.has=function(t,e){return null!=t&&ms(t,e,Rn)},$r.hasIn=Ro,$r.head=Ws,$r.identity=il,$r.includes=function(t,e,r,n){t=Wa(t)?t:jo(t),r=r&&!n?go(r):0;var i=t.length;return r<0&&(r=ze(i+r,0)),oo(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&He(t,e,r)>-1},$r.indexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=null==r?0:go(r);return i<0&&(i=ze(n+i,0)),He(t,e,i)},$r.inRange=function(t,e,r){return e=po(e),r===s?(r=e,e=0):r=po(r),function(t,e,r){return t>=Er(e,r)&&t<ze(e,r)}(t=yo(t),e,r)},$r.invoke=Io,$r.isArguments=Ka,$r.isArray=Ha,$r.isArrayBuffer=Va,$r.isArrayLike=Wa,$r.isArrayLikeObject=Ya,$r.isBoolean=function(t){return!0===t||!1===t||eo(t)&&Ln(t)==T},$r.isBuffer=qa,$r.isDate=za,$r.isElement=function(t){return eo(t)&&1===t.nodeType&&!io(t)},$r.isEmpty=function(t){if(null==t)return!0;if(Wa(t)&&(Ha(t)||"string"==typeof t||"function"==typeof t.splice||qa(t)||co(t)||Ka(t)))return!t.length;var e=gs(t);if(e==L||e==I)return!t.size;if(_s(t))return!Bn(t).length;for(var r in t)if(Ft.call(t,r))return!1;return!0},$r.isEqual=function(t,e){return Pn(t,e)},$r.isEqualWith=function(t,e,r){var n=(r="function"==typeof r?r:s)?r(t,e):s;return n===s?Pn(t,e,s,r):!!n},$r.isError=Xa,$r.isFinite=function(t){return"number"==typeof t&&be(t)},$r.isFunction=Qa,$r.isInteger=Ja,$r.isLength=Za,$r.isMap=ro,$r.isMatch=function(t,e){return t===e||On(t,e,hs(e))},$r.isMatchWith=function(t,e,r){return r="function"==typeof r?r:s,On(t,e,hs(e),r)},$r.isNaN=function(t){return no(t)&&t!=+t},$r.isNative=function(t){if(As(t))throw new lt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Mn(t)},$r.isNil=function(t){return null==t},$r.isNull=function(t){return null===t},$r.isNumber=no,$r.isObject=to,$r.isObjectLike=eo,$r.isPlainObject=io,$r.isRegExp=so,$r.isSafeInteger=function(t){return Ja(t)&&t>=-9007199254740991&&t<=g},$r.isSet=ao,$r.isString=oo,$r.isSymbol=lo,$r.isTypedArray=co,$r.isUndefined=function(t){return t===s},$r.isWeakMap=function(t){return eo(t)&&gs(t)==O},$r.isWeakSet=function(t){return eo(t)&&"[object WeakSet]"==Ln(t)},$r.join=function(t,e){return null==t?"":Te.call(t,e)},$r.kebabCase=Vo,$r.last=Xs,$r.lastIndexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=n;return r!==s&&(i=(i=go(r))<0?ze(n+i,0):Er(i,n-1)),e==e?function(t,e,r){for(var n=r+1;n--;)if(t[n]===e)return n;return n}(t,e,i):Ke(t,We,i,!0)},$r.lowerCase=Wo,$r.lowerFirst=Yo,$r.lt=uo,$r.lte=ho,$r.max=function(t){return t&&t.length?mn(t,il,wn):s},$r.maxBy=function(t,e){return t&&t.length?mn(t,cs(e,2),wn):s},$r.mean=function(t){return Ye(t,il)},$r.meanBy=function(t,e){return Ye(t,cs(e,2))},$r.min=function(t){return t&&t.length?mn(t,il,Un):s},$r.minBy=function(t,e){return t&&t.length?mn(t,cs(e,2),Un):s},$r.stubArray=ml,$r.stubFalse=yl,$r.stubObject=function(){return{}},$r.stubString=function(){return""},$r.stubTrue=function(){return!0},$r.multiply=Al,$r.nth=function(t,e){return t&&t.length?Hn(t,go(e)):s},$r.noConflict=function(){return me._===this&&(me._=jt),this},$r.noop=cl,$r.now=La,$r.pad=function(t,e,r){t=Eo(t);var n=(e=go(e))?pr(t):0;if(!e||n>=e)return t;var i=(e-n)/2;return Vi(ge(i),r)+t+Vi(pe(i),r)},$r.padEnd=function(t,e,r){t=Eo(t);var n=(e=go(e))?pr(t):0;return e&&n<e?t+Vi(e-n,r):t},$r.padStart=function(t,e,r){t=Eo(t);var n=(e=go(e))?pr(t):0;return e&&n<e?Vi(e-n,r)+t:t},$r.parseInt=function(t,e,r){return r||null==e?e=0:e&&(e=+e),Tr(Eo(t).replace(ot,""),e||0)},$r.random=function(t,e,r){if(r&&"boolean"!=typeof r&&bs(t,e,r)&&(e=r=s),r===s&&("boolean"==typeof e?(r=e,e=s):"boolean"==typeof t&&(r=t,t=s)),t===s&&e===s?(t=0,e=1):(t=po(t),e===s?(e=t,t=0):e=po(e)),t>e){var n=t;t=e,e=n}if(r||t%1||e%1){var i=Sr();return Er(t+i*(e-t+de("1e-"+((i+"").length-1))),e)}return zn(t,e)},$r.reduce=function(t,e,r){var n=Ha(t)?Ne:Xe,i=arguments.length<3;return n(t,cs(e,4),r,i,fn)},$r.reduceRight=function(t,e,r){var n=Ha(t)?Ue:Xe,i=arguments.length<3;return n(t,cs(e,4),r,i,pn)},$r.repeat=function(t,e,r){return e=(r?bs(t,e,r):e===s)?1:go(e),Xn(Eo(t),e)},$r.replace=function(){var t=arguments,e=Eo(t[0]);return t.length<3?e:e.replace(t[1],t[2])},$r.result=function(t,e,r){var n=-1,i=(e=bi(e,t)).length;for(i||(i=1,t=s);++n<i;){var a=null==t?s:t[Bs(e[n])];a===s&&(n=i,a=r),t=Qa(a)?a.call(t):a}return t},$r.round=_l,$r.runInContext=t,$r.sample=function(t){return(Ha(t)?Qr:Jn)(t)},$r.size=function(t){if(null==t)return 0;if(Wa(t))return oo(t)?pr(t):t.length;var e=gs(t);return e==L||e==I?t.size:Bn(t).length},$r.snakeCase=qo,$r.some=function(t,e,r){var n=Ha(t)?$e:si;return r&&bs(t,e,r)&&(e=s),n(t,cs(e,3))},$r.sortedIndex=function(t,e){return ai(t,e)},$r.sortedIndexBy=function(t,e,r){return oi(t,e,cs(r,2))},$r.sortedIndexOf=function(t,e){var r=null==t?0:t.length;if(r){var n=ai(t,e);if(n<r&&$a(t[n],e))return n}return-1},$r.sortedLastIndex=function(t,e){return ai(t,e,!0)},$r.sortedLastIndexBy=function(t,e,r){return oi(t,e,cs(r,2),!0)},$r.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var r=ai(t,e,!0)-1;if($a(t[r],e))return r}return-1},$r.startCase=zo,$r.startsWith=function(t,e,r){return t=Eo(t),r=null==r?0:ln(go(r),0,t.length),e=ui(e),t.slice(r,r+e.length)==e},$r.subtract=kl,$r.sum=function(t){return t&&t.length?Qe(t,il):0},$r.sumBy=function(t,e){return t&&t.length?Qe(t,cs(e,2)):0},$r.template=function(t,e,r){var n=$r.templateSettings;r&&bs(t,e,r)&&(e=s),t=Eo(t),e=So({},e,n,Zi);var i,a,o=So({},e.imports,n.imports,Zi),l=xo(o),c=er(o,l),u=0,h=e.interpolate||At,d="__p += '",f=Rt((e.escape||At).source+"|"+h.source+"|"+(h===et?gt:At).source+"|"+(e.evaluate||At).source+"|$","g"),p="//# sourceURL="+(Ft.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++le+"]")+"\n";t.replace(f,(function(e,r,n,s,o,l){return n||(n=s),d+=t.slice(u,l).replace(_t,or),r&&(i=!0,d+="' +\n__e("+r+") +\n'"),o&&(a=!0,d+="';\n"+o+";\n__p += '"),n&&(d+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),u=l+e.length,e})),d+="';\n";var g=Ft.call(e,"variable")&&e.variable;if(g){if(ft.test(g))throw new lt("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(a?d.replace(W,""):d).replace(Y,"$1").replace(q,"$1;"),d="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var m=Zo((function(){return kt(l,p+"return "+d).apply(s,c)}));if(m.source=d,Xa(m))throw m;return m},$r.times=function(t,e){if((t=go(t))<1||t>g)return[];var r=y,n=Er(t,y);e=cs(e),t-=y;for(var i=Je(n,e);++r<t;)e(r);return i},$r.toFinite=po,$r.toInteger=go,$r.toLength=mo,$r.toLower=function(t){return Eo(t).toLowerCase()},$r.toNumber=yo,$r.toSafeInteger=function(t){return t?ln(go(t),-9007199254740991,g):0===t?t:0},$r.toString=Eo,$r.toUpper=function(t){return Eo(t).toUpperCase()},$r.trim=function(t,e,r){if((t=Eo(t))&&(r||e===s))return Ze(t);if(!t||!(e=ui(e)))return t;var n=gr(t),i=gr(e);return Si(n,nr(n,i),ir(n,i)+1).join("")},$r.trimEnd=function(t,e,r){if((t=Eo(t))&&(r||e===s))return t.slice(0,mr(t)+1);if(!t||!(e=ui(e)))return t;var n=gr(t);return Si(n,0,ir(n,gr(e))+1).join("")},$r.trimStart=function(t,e,r){if((t=Eo(t))&&(r||e===s))return t.replace(ot,"");if(!t||!(e=ui(e)))return t;var n=gr(t);return Si(n,nr(n,gr(e))).join("")},$r.truncate=function(t,e){var r=30,n="...";if(to(e)){var i="separator"in e?e.separator:i;r="length"in e?go(e.length):r,n="omission"in e?ui(e.omission):n}var a=(t=Eo(t)).length;if(lr(t)){var o=gr(t);a=o.length}if(r>=a)return t;var l=r-pr(n);if(l<1)return n;var c=o?Si(o,0,l).join(""):t.slice(0,l);if(i===s)return c+n;if(o&&(l+=c.length-l),so(i)){if(t.slice(l).search(i)){var u,h=c;for(i.global||(i=Rt(i.source,Eo(mt.exec(i))+"g")),i.lastIndex=0;u=i.exec(h);)var d=u.index;c=c.slice(0,d===s?l:d)}}else if(t.indexOf(ui(i),l)!=l){var f=c.lastIndexOf(i);f>-1&&(c=c.slice(0,f))}return c+n},$r.unescape=function(t){return(t=Eo(t))&&Q.test(t)?t.replace(z,yr):t},$r.uniqueId=function(t){var e=++Bt;return Eo(t)+e},$r.upperCase=Xo,$r.upperFirst=Qo,$r.each=va,$r.eachRight=Ea,$r.first=Ws,ll($r,(Sl={},Tn($r,(function(t,e){Ft.call($r.prototype,e)||(Sl[e]=t)})),Sl),{chain:!1}),$r.VERSION="4.17.21",De(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){$r[t].placeholder=$r})),De(["drop","take"],(function(t,e){Hr.prototype[t]=function(r){r=r===s?1:ze(go(r),0);var n=this.__filtered__&&!e?new Hr(this):this.clone();return n.__filtered__?n.__takeCount__=Er(r,n.__takeCount__):n.__views__.push({size:Er(r,y),type:t+(n.__dir__<0?"Right":"")}),n},Hr.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),De(["filter","map","takeWhile"],(function(t,e){var r=e+1,n=1==r||3==r;Hr.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:cs(t,3),type:r}),e.__filtered__=e.__filtered__||n,e}})),De(["head","last"],(function(t,e){var r="take"+(e?"Right":"");Hr.prototype[t]=function(){return this[r](1).value()[0]}})),De(["initial","tail"],(function(t,e){var r="drop"+(e?"":"Right");Hr.prototype[t]=function(){return this.__filtered__?new Hr(this):this[r](1)}})),Hr.prototype.compact=function(){return this.filter(il)},Hr.prototype.find=function(t){return this.filter(t).head()},Hr.prototype.findLast=function(t){return this.reverse().find(t)},Hr.prototype.invokeMap=Qn((function(t,e){return"function"==typeof t?new Hr(this):this.map((function(r){return In(r,t,e)}))})),Hr.prototype.reject=function(t){return this.filter(Ma(cs(t)))},Hr.prototype.slice=function(t,e){t=go(t);var r=this;return r.__filtered__&&(t>0||e<0)?new Hr(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),e!==s&&(r=(e=go(e))<0?r.dropRight(-e):r.take(e-t)),r)},Hr.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Hr.prototype.toArray=function(){return this.take(y)},Tn(Hr.prototype,(function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),n=/^(?:head|last)$/.test(e),i=$r[n?"take"+("last"==e?"Right":""):e],a=n||/^find/.test(e);i&&($r.prototype[e]=function(){var e=this.__wrapped__,o=n?[1]:arguments,l=e instanceof Hr,c=o[0],u=l||Ha(e),h=function(t){var e=i.apply($r,Be([t],o));return n&&d?e[0]:e};u&&r&&"function"==typeof c&&1!=c.length&&(l=u=!1);var d=this.__chain__,f=!!this.__actions__.length,p=a&&!d,g=l&&!f;if(!a&&u){e=g?e:new Hr(this);var m=t.apply(e,o);return m.__actions__.push({func:fa,args:[h],thisArg:s}),new Kr(m,d)}return p&&g?t.apply(this,o):(m=this.thru(h),p?n?m.value()[0]:m.value():m)})})),De(["pop","push","shift","sort","splice","unshift"],(function(t){var e=It[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);$r.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var i=this.value();return e.apply(Ha(i)?i:[],t)}return this[r]((function(r){return e.apply(Ha(r)?r:[],t)}))}})),Tn(Hr.prototype,(function(t,e){var r=$r[e];if(r){var n=r.name+"";Ft.call(Ir,n)||(Ir[n]=[]),Ir[n].push({name:e,func:r})}})),Ir[ji(s,2).name]=[{name:"wrapper",func:s}],Hr.prototype.clone=function(){var t=new Hr(this.__wrapped__);return t.__actions__=Di(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Di(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Di(this.__views__),t},Hr.prototype.reverse=function(){if(this.__filtered__){var t=new Hr(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Hr.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,r=Ha(t),n=e<0,i=r?t.length:0,s=function(t,e,r){var n=-1,i=r.length;for(;++n<i;){var s=r[n],a=s.size;switch(s.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=Er(e,t+a);break;case"takeRight":t=ze(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=s.start,o=s.end,l=o-a,c=n?o:a-1,u=this.__iteratees__,h=u.length,d=0,f=Er(l,this.__takeCount__);if(!r||!n&&i==l&&f==l)return gi(t,this.__actions__);var p=[];t:for(;l--&&d<f;){for(var g=-1,m=t[c+=e];++g<h;){var y=u[g],v=y.iteratee,E=y.type,b=v(m);if(2==E)m=b;else if(!b){if(1==E)continue t;break t}}p[d++]=m}return p},$r.prototype.at=pa,$r.prototype.chain=function(){return da(this)},$r.prototype.commit=function(){return new Kr(this.value(),this.__chain__)},$r.prototype.next=function(){this.__values__===s&&(this.__values__=fo(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?s:this.__values__[this.__index__++]}},$r.prototype.plant=function(t){for(var e,r=this;r instanceof Gr;){var n=Us(r);n.__index__=0,n.__values__=s,e?i.__wrapped__=n:e=n;var i=n;r=r.__wrapped__}return i.__wrapped__=t,e},$r.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Hr){var e=t;return this.__actions__.length&&(e=new Hr(this)),(e=e.reverse()).__actions__.push({func:fa,args:[ta],thisArg:s}),new Kr(e,this.__chain__)}return this.thru(ta)},$r.prototype.toJSON=$r.prototype.valueOf=$r.prototype.value=function(){return gi(this.__wrapped__,this.__actions__)},$r.prototype.first=$r.prototype.head,Jt&&($r.prototype[Jt]=function(){return this}),$r}();me._=vr,(i=function(){return vr}.call(e,r,e,n))===s||(n.exports=i)}).call(this)}).call(this,r(31),r(156)(t))},function(t,e,r){var n=r(366),i=r(367),s=r(155),a=r(368);t.exports=function(t,e){return n(t)||i(t,e)||s(t,e)||a()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return E}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(8),d=r.n(h),f=r(1),p=r(167),g=r.n(p),m=r(168),y=r.n(m);function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(v=function(){return!!t})()}var E=function(e){function r(){return i()(this,r),t=this,e=r,n=arguments,e=u()(e),l()(t,v()?Reflect.construct(e,n||[],u()(t).constructor):e.apply(t,n));var t,e,n}return d()(r,e),a()(r,[{key:"name",get:function(){return"level_selector"}},{key:"template",get:function(){return Object(f.template)(g.a)}},{key:"supportedVersion",get:function(){return{min:f.version}}},{key:"attributes",get:function(){return{class:this.name,"data-level-selector":""}}},{key:"events",get:function(){return{"click [data-level-selector-select]":"onLevelSelect","click [data-level-selector-button]":"onShowLevelSelectMenu"}}},{key:"container",get:function(){return this.core.activeContainer?this.core.activeContainer:this.core.mediaControl.container}},{key:"playback",get:function(){return this.core.activePlayback?this.core.activePlayback:this.core.getCurrentPlayback()}},{key:"bindEvents",value:function(){this.listenTo(this.core,f.Events.CORE_READY,this.bindPlaybackEvents),f.Events.CORE_ACTIVE_CONTAINER_CHANGED?this.listenTo(this.core,f.Events.CORE_ACTIVE_CONTAINER_CHANGED,this.reload):this.listenTo(this.core.mediaControl,f.Events.MEDIACONTROL_CONTAINERCHANGED,this.reload),this.listenTo(this.core.mediaControl,f.Events.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.core.mediaControl,f.Events.MEDIACONTROL_HIDE,this.hideSelectLevelMenu)}},{key:"bindPlaybackEvents",value:function(){this.playback&&(this.listenTo(this.playback,f.Events.PLAYBACK_LEVELS_AVAILABLE,this.fillLevels),this.listenTo(this.playback,f.Events.PLAYBACK_LEVEL_SWITCH_START,this.startLevelSwitch),this.listenTo(this.playback,f.Events.PLAYBACK_LEVEL_SWITCH_END,this.stopLevelSwitch),this.listenTo(this.playback,f.Events.PLAYBACK_BITRATE,this.updateCurrentLevel),this.playback.levels&&this.playback.levels.length>0&&this.fillLevels(this.playback.levels))}},{key:"reload",value:function(){var e=this;this.stopListening(),t.nextTick((function(){e.bindEvents(),e.bindPlaybackEvents()}))}},{key:"shouldRender",value:function(){if(!this.container||!this.playback)return!1;var t=void 0!==this.playback.currentLevel,e=!!(this.levels&&this.levels.length>1);return t&&e}},{key:"render",value:function(){if(this.shouldRender()){var t=f.Styler.getStyleFor(y.a,{baseUrl:this.core.options.baseUrl});this.$el.html(this.template({levels:this.levels,title:this.getTitle()})),this.$el.append(t),this.core.mediaControl.$(".media-control-right-panel").append(this.el),this.$(".level_selector ul").css("max-height",.8*this.core.el.offsetHeight),this.highlightCurrentLevel()}return this}},{key:"fillLevels",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;void 0===this.selectedLevelId&&(this.selectedLevelId=e);var r=this.core.options&&this.core.options.levelSelectorConfig&&this.core.options.levelSelectorConfig.onLevelsAvailable;if(r){if("function"!=typeof r)throw new TypeError("onLevelsAvailable must be a function");t=r(t.slice())}t.forEach((function(t){var e=t.level;if(Object.keys(e).length){var r=e.height;t.resolution="".concat(r,"p")}})),this.levels=t,this.configureLevelsLabels(),this.render()}},{key:"configureLevelsLabels",value:function(){if(void 0!==this.core.options.levelSelectorConfig){var t=this.core.options.levelSelectorConfig.labelCallback;if(t&&"function"!=typeof t)throw new TypeError("labelCallback must be a function");var e,r,n=this.core.options.levelSelectorConfig.labels,i=n?this.core.options.levelSelectorConfig.labels:{};if(t||n)for(var s in this.levels)r=i[(e=this.levels[s]).id],t?e.label=t(e,r):r&&(e.label=r)}}},{key:"findLevelBy",value:function(t){var e;return this.levels.forEach((function(r){r.id===t&&(e=r)})),e}},{key:"onLevelSelect",value:function(t){return this.selectedLevelId=parseInt(t.target.dataset.levelSelectorSelect,10),this.playback.currentLevel==this.selectedLevelId||(this.playback.currentLevel=this.selectedLevelId,this.toggleContextMenu(),t.stopPropagation()),!1}},{key:"onShowLevelSelectMenu",value:function(){this.toggleContextMenu()}},{key:"hideSelectLevelMenu",value:function(){this.$(".level_selector ul").hide()}},{key:"toggleContextMenu",value:function(){this.$(".level_selector ul").toggle()}},{key:"buttonElement",value:function(){return this.$(".level_selector button")}},{key:"levelElement",value:function(t){return this.$(".level_selector ul a".concat(isNaN(t)?"":'[data-level-selector-select="'.concat(t,'"]'))).parent()}},{key:"getTitle",value:function(){return(this.core.options.levelSelectorConfig||{}).title}},{key:"startLevelSwitch",value:function(){this.buttonElement().addClass("changing")}},{key:"stopLevelSwitch",value:function(){this.buttonElement().removeClass("changing")}},{key:"updateText",value:function(t){-1===t?this.buttonElement().text(this.currentLevel?"AUTO (".concat(this.currentLevel.resolution,")"):"AUTO"):this.buttonElement().text(this.findLevelBy(t).resolution)}},{key:"updateCurrentLevel",value:function(t){var e=this.findLevelBy(t.level);this.currentLevel=e||null,this.highlightCurrentLevel()}},{key:"highlightCurrentLevel",value:function(){this.levelElement().removeClass("current"),this.currentLevel&&this.levelElement(this.currentLevel.id).addClass("current"),this.updateText(this.selectedLevelId)}}],[{key:"version",get:function(){return"24.6.1"}}])}(f.UICorePlugin)}).call(this,r(76))},function(t,e){t.exports='<button data-level-selector-button>\n Auto\n</button>\n<ul>\n <% if (title) { %>\n <li data-title><%= title %></li>\n <% }; %>\n <li><a href="#" data-level-selector-select="-1">AUTO</a></li>\n <% for (var i = 0; i < levels.length; i++) { %>\n <li><a href="#" data-level-selector-select="<%= levels[i].id %>"><%= levels[i].resolution %></a></li>\n <% }; %>\n</ul>'},function(t,e,r){var n=r(392);"string"==typeof n&&(n=[[t.i,n,""]]);var i={hmr:!0,transform:undefined,insertInto:void 0};r(161)(n,i);n.locals&&(t.exports=n.locals)},function(t,e,r){"use strict";r.d(e,"a",(function(){return L}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(15),d=r.n(h),f=r(8),p=r.n(f),g=r(1),m=r(90),y=r.n(m),v=r(170),E=r.n(v),b=r(171),T=r.n(b),S=r(91);function A(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(A=function(){return!!t})()}function _(t,e,r,n){var i=d()(u()(1&n?t.prototype:t),e,r);return 2&n&&"function"==typeof i?function(t){return i.apply(r,t)}:i}var k="blinkPoster",L=function(t){function e(t){var r,n,s,a;return i()(this,e),n=this,s=e,a=[t],s=u()(s),(r=l()(n,A()?Reflect.construct(s,a||[],u()(n).constructor):s.apply(n,a))).startBlinkPoster(),r.container=t,r}return p()(e,t),a()(e,[{key:"name",get:function(){return"poster"}},{key:"bindEvents",value:function(){_(e,"bindEvents",this,3)([]),this.listenTo(this.container,g.Events.CONTAINER_OPTIONS_CHANGE,this.changeOptsRuntime)}},{key:"destroy",value:function(){_(e,"destroy",this,3)([]),this.stopBlinkPoster()}},{key:"changeOptsRuntime",value:function(){this.options[k]?this.startBlinkPoster():this.stopBlinkPoster()}},{key:"startBlinkPoster",value:function(){if(this.options[k]&&!this.hasStartedPlaying){var t=this.options.blinkPosterDelay||5e3;this.posterChangeSource=this.posterChangeSource.bind(this),this.posterTimer=setTimeout(this.posterChangeSource,t)}}},{key:"stopBlinkPoster",value:function(){clearTimeout(this.posterTimer)}},{key:"onStop",value:function(){_(e,"onStop",this,3)([]),this.startBlinkPoster()}},{key:"onPlay",value:function(){_(e,"onPlay",this,3)([]),this.stopBlinkPoster()}},{key:"posterChangeSource",value:function(){var t=this,e=this.options.authToken?"&":"?",r=this.getPosterSource({postfix:"".concat(e,"_t=").concat(Number(new Date))});this.setPosterSource(r).then((function(){t.posterTimer=setTimeout(t.posterChangeSource,5e3)}))}},{key:"templateVideo",get:function(){return Object(g.template)(T.a)}},{key:"shouldRender",get:function(){var t=!!this.options.poster;return"html_img"!==this.container.playback.name&&("no_op"!==this.container.playback.getPlaybackType()||t)}},{key:"showOnVideoEnd",get:function(){return!this.options.poster||this.options.poster.showOnVideoEnd||void 0===this.options.poster.showOnVideoEnd}},{key:"setPosterSource",value:function(t){var e=this;return Object(S.b)(this.$el[0])?new Promise((function(r){var n=e._videoPoster,i=e.$el.find(".poster-video:not(.visible)");i.one("loadeddata",(function(){n.removeClass("visible"),i.addClass("visible"),e._videoPoster=i,r()})),i.attr({src:t})})):Promise.resolve()}},{key:"renderVideoPoster",value:function(){this.$el.html(this.templateVideo()),this.setPosterStyles(),this.setVideoPoster()}},{key:"setPosterStyles",value:function(){this.$el.append('<style class="clappr-style"></style>'),this.$el.find(".clappr-style").html(Object(g.template)(E.a.toString()))}},{key:"setVideoPoster",value:function(){this._videoPoster=this.$el.find(".poster-video"),this._videoPoster.attr({src:this.getPosterSource()})}},{key:"renderPlayButton",value:function(){this.container.$el.append(this.el),this.$playWrapper=this.$el.find(".play-wrapper"),this.$playWrapper.append(y.a),this.$playButton=this.$playWrapper.find("svg"),this.$playButton.addClass("poster-icon"),this.$playButton.attr("data-poster","");var t=this.options.mediacontrol&&this.options.mediacontrol.buttons;t&&this.$el.find("svg path").css("fill",t),this.options.mediacontrol&&this.options.mediacontrol.buttons&&(t=this.options.mediacontrol.buttons,this.$playButton.css("color",t))}},{key:"getPosterSource",value:function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).postfix,e=this.options.poster.url||this.options.poster;return t?"".concat(e).concat(t):e}},{key:"render",value:function(){if(this.shouldRender)return this.renderVideoPoster(),this.renderPlayButton(),this.update(),this}}])}(g.Poster)},function(t,e,r){},function(t,e){t.exports='<div class="video-poster-wrapper">\n <video class="poster-video visible" autoplay />\n <video class="poster-video" autoplay />\n <div class="play-wrapper-cont">\n <div class="play-wrapper"></div>\n </div>\n</div>\n'},function(t,e,r){"use strict";r.d(e,"a",(function(){return E}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(8),d=r.n(h),f=r(1),p=r(90),g=r.n(p),m=r(173),y=r.n(m);function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(v=function(){return!!t})()}var E=function(t){function e(t){var r,n,s,a;return i()(this,e),n=this,s=e,a=[t],s=u()(s),(r=l()(n,v()?Reflect.construct(s,a||[],u()(n).constructor):s.apply(n,a))).container=t,r}return d()(e,t),a()(e,[{key:"setPosterStyles",value:function(){this.$el.append('<style class="clappr-style"></style>'),this.$el.find(".clappr-style").html(Object(f.template)(y.a.toString()))}},{key:"render",value:function(){var t=this;if(this.shouldRender){if(this.$el[0].addEventListener("touchstart",(function(){t.container.play()})),this.$el.html(this.template()),this.setPosterStyles(),this.options.poster&&null==this.options.poster.custom){var e=this.options.poster.url||this.options.poster;this.$el.css({"background-image":"url(".concat(e,")")})}else this.options.poster&&this.$el.css({background:this.options.poster.custom});this.container.$el.append(this.el),this.$playWrapper=this.$el.find(".play-wrapper"),this.$playWrapper.append(g.a),this.$playButton=this.$playWrapper.find("svg"),this.$playButton.addClass("poster-icon"),this.$playButton.attr("data-poster","");var r=this.options.mediacontrol&&this.options.mediacontrol.buttons;return r&&this.$el.find("svg path").css("fill",r),this.options.mediacontrol&&this.options.mediacontrol.buttons&&(r=this.options.mediacontrol.buttons,this.$playButton.css("color",r)),this.update(),this}}}])}(f.Poster)},function(t,e,r){},function(t,e,r){"use strict";r.d(e,"a",(function(){return S}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(8),u=r.n(c),h=r(3),d=r.n(h),f=r(15),p=r.n(f),g=r(1),m=r(91),y=r(175),v=r.n(y),E=r(176),b=r.n(E);function T(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(T=function(){return!!t})()}var S=function(t){function e(t){var r,n,s,a;return i()(this,e),n=this,s=e,a=[t],s=d()(s),(r=l()(n,T()?Reflect.construct(s,a||[],d()(n).constructor):s.apply(n,a))).hasStartedPlaying=!1,r.playRequested=!1,r.render(),r}return u()(e,t),a()(e,[{key:"name",get:function(){return"logo"}},{key:"template",get:function(){return Object(g.template)(v.a)}},{key:"attributes",get:function(){return{class:"player-logo","data-logo":""}}},{key:"shouldRender",get:function(){return!!this.options.logo.path}},{key:"bindEvents",value:function(){this.setPositionBinded=this.setPosition.bind(this),window.addEventListener("resize",this.setPositionBinded),(g.Browser.isSafari||g.Browser.isIE)&&this.container.playback.el.addEventListener("loadeddata",this.setPositionBinded),this.listenTo(this.container,g.Events.CONTAINER_STOP,this.onStop),this.listenTo(this.container,g.Events.CONTAINER_PLAY,this.onPlay),this.listenTo(this.container,g.Events.CONTAINER_LOADEDMETADATA,this.setPositionBinded)}},{key:"stopListening",value:function(){var t,r,n,i,s;window.removeEventListener("resize",this.setPositionBinded),(g.Browser.isSafari||g.Browser.isIE)&&window.removeEventListener("loadeddata",this.setPositionBinded),(t=e,r="stopListening",n=this,i=3,s=p()(d()(1&i?t.prototype:t),r,n),2&i&&"function"==typeof s?function(t){return s.apply(n,t)}:s)([])}},{key:"onPlay",value:function(){this.hasStartedPlaying=!0,this.update()}},{key:"onStop",value:function(){this.hasStartedPlaying=!1,this.playRequested=!1,this.update()}},{key:"update",value:function(){this.shouldRender&&(this.hasStartedPlaying?this.$el.show():this.$el.hide())}},{key:"render",value:function(){if(this.shouldRender)return this.$el.html(this.template()),this.setLogoStyles(),this.setLogoImgAttrs(),this.container.$el.append(this.$el),this.update(),this}},{key:"setLogoImgAttrs",value:function(){var t=this.options,e=t.logo,r=e.path,n=e.width,i=void 0===n?60:n,s=e.height,a=void 0===s?60:s,o=t.authToken;this.$logoContainer=this.$el.find(".live-logo"),this.$logoContainer.find(".live-logo-img").attr({src:"".concat(r.includes("http")||r.includes("https")?"":"/").concat(r).concat(o?"?".concat(o):""),style:"width: ".concat(i,"px;height: ").concat(a,"px;")})}},{key:"setPosition",value:function(){if(this.shouldRender){var t=this.container,e=t.$el,r=t.currentSize,n=e.find("video[data-html5-video]").get(0),i=n.videoWidth,s=n.videoHeight,a=Object(m.a)({dom:{width:r.width,height:r.height},media:{width:i,height:s}}),o=this.options.logo,l=a.letterboxing,c=l.vertical,u=l.horizontal,h=this.$logoContainer.get(0);this.setStyles(o,["top","bottom"],h,c),this.setStyles(o,["left","right"],h,u),this.update()}}},{key:"setStyles",value:function(t,e,r,n){var i=this;e.forEach((function(e){return i.setStyle(t,e,r,n)}))}},{key:"setStyle",value:function(t,e,r,n){t[e]&&(r.style[e]="".concat(parseInt(t[e],10)+n,"px"))}},{key:"setLogoStyles",value:function(){this.$el.append('<style class="clappr-style"></style>'),this.$el.find(".clappr-style").html(Object(g.template)(b.a.toString()))}}])}(g.UIContainerPlugin)},function(t,e){t.exports='<div class="live-logo">\n <img class="live-logo-img" />\n</div>\n'},function(t,e,r){},function(t,e,r){"use strict";r.d(e,"a",(function(){return g}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(8),d=r.n(h),f=r(1);function p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(p=function(){return!!t})()}var g=function(t){function e(){return i()(this,e),t=this,r=e,n=arguments,r=u()(r),l()(t,p()?Reflect.construct(r,n||[],u()(t).constructor):r.apply(t,n));var t,r,n}return d()(e,t),a()(e,[{key:"name",get:function(){return"volumePlugin"}},{key:"bindEvents",value:function(){this.container.options.volume>0?this.listenToOnce(this.container,f.Events.CONTAINER_MEDIACONTROL_ENABLE,this.setInitialVolume):this.enabled=!1}},{key:"setInitialVolume",value:function(){this.container.setVolume(this.container.options.volume)}}])}(f.ContainerPlugin)},function(t,e,r){"use strict";r.d(e,"a",(function(){return E}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(15),d=r.n(h),f=r(8),p=r.n(f),g=r(1),m=r(26);function y(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(y=function(){return!!t})()}function v(t,e,r,n){var i=d()(u()(1&n?t.prototype:t),e,r);return 2&n&&"function"==typeof i?function(t){return i.apply(r,t)}:i}var E=function(t){function e(){return i()(this,e),t=this,r=e,n=arguments,r=u()(r),l()(t,y()?Reflect.construct(r,n||[],u()(t).constructor):r.apply(t,n));var t,r,n}return p()(e,t),a()(e,[{key:"name",get:function(){return"StreamStatusPlugin"}},{key:"bindEvents",value:function(){var t=this;if("mseld"===this.container.playback.name)return this.listenTo(this.container.playback,g.Events.PLAYBACK_BUFFERING,this.waitForTime(5e3)),void this.listenTo(this.container.playback,g.Events.PLAYBACK_BUFFERFULL,(function(){return t._buffering=!1}));this.listenTo(this.container.playback,g.Events.PLAYBACK_ERROR,this.startListenStatus)}},{key:"startListenStatus",value:function(t){"mseld"!==this.container.playback.name&&(!t||t&&t.data&&"networkError"!==t.data.type)||(this._statusUrl=Object(m.a)(this.container.options,"info.json"),this.checkStatus=this.checkStatus.bind(this),clearInterval(this.timerStatus),this.timerStatus=setInterval(this.checkStatus,1e3))}},{key:"waitForTime",value:function(t){var e=this;return function(){e._buffering=!0,setTimeout((function(){e._buffering&&e.startListenStatus()}),t)}}},{key:"checkStatus",value:function(){var t=this;fetch(this._statusUrl).then((function(e){404===e.status&&(t.container.playback.setWaitStatus&&t.container.playback.setWaitStatus(!0),t.container.playback.stop()),200===e.status&&(clearInterval(t.timerStatus),t.container.playback.setWaitStatus&&t.container.playback.setWaitStatus(!1))}))}},{key:"disable",value:function(){clearInterval(this.timerStatus),v(e,"disable",this,3)([])}},{key:"destroy",value:function(){clearInterval(this.timerStatus),v(e,"destroy",this,3)([])}}])}(g.UIContainerPlugin)},function(t,e,r){"use strict";r.d(e,"a",(function(){return g}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(8),d=r.n(h),f=r(1);function p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(p=function(){return!!t})()}var g=function(t){function e(){return i()(this,e),t=this,r=e,n=arguments,r=u()(r),l()(t,p()?Reflect.construct(r,n||[],u()(t).constructor):r.apply(t,n));var t,r,n}return d()(e,t),a()(e,[{key:"name",get:function(){return"DebugPlugin"}},{key:"bindEvents",value:function(){for(var t in f.Events)"register"!==t&&"listAvailableCustomEvents"!==t&&this.listenTo(this.container.playback,f.Events[t],this.fireEvent.bind(this,t))}},{key:"fireEvent",value:function(t){console.log(t)}}])}(f.UIContainerPlugin)},function(t,e,r){"use strict";var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(15),d=r.n(h),f=r(8),p=r.n(f),g=r(1),m=r(55),y=r.n(m);function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(v=function(){return!!t})()}function E(t,e,r,n){var i=d()(u()(1&n?t.prototype:t),e,r);return 2&n&&"function"==typeof i?function(t){return i.apply(r,t)}:i}var b=function(t){function e(){var t,r,n,s;i()(this,e);for(var a=arguments.length,o=new Array(a),c=0;c<a;c++)o[c]=arguments[c];return r=this,n=e,s=[].concat(o),n=u()(n),(t=l()(r,v()?Reflect.construct(n,s||[],u()(r).constructor):n.apply(r,s)))._levels=[],t._pendingAdaptationEvent=!1,t._isShakaReadyState=!1,t._minDvrSize=void 0===t.options.shakaMinimumDvrSize?60:t.options.shakaMinimumDvrSize,t.checkIfCritical(),t}return p()(e,t),a()(e,[{key:"name",get:function(){return"dash_shaka_playback"}},{key:"shakaVersion",get:function(){return y.a.player.Player.version}},{key:"shakaPlayerInstance",get:function(){return this._player}},{key:"levels",get:function(){return this._levels}},{key:"seekRange",get:function(){return this.shakaPlayerInstance?this.shakaPlayerInstance.seekRange():{start:0,end:0}}},{key:"currentLevel",get:function(){return this._currentLevelId||-1},set:function(t){var e=this;this._currentLevelId=t;var r=-1===this._currentLevelId;this.trigger(g.Events.PLAYBACK_LEVEL_SWITCH_START),r?(this._player.configure({abr:{enabled:!0}}),this.trigger(g.Events.PLAYBACK_LEVEL_SWITCH_END)):(this._player.configure({abr:{enabled:!1}}),this._pendingAdaptationEvent=!0,this.selectTrack(this.videoTracks.filter((function(t){return t.id===e._currentLevelId}))[0]))}},{key:"dvrEnabled",get:function(){return this._duration>=this._minDvrSize&&"live"===this.getPlaybackType()}},{key:"getDuration",value:function(){return this._duration}},{key:"_duration",get:function(){return this.shakaPlayerInstance?this.seekRange.end-this.seekRange.start:0}},{key:"getCurrentTime",value:function(){return this.shakaPlayerInstance?this.shakaPlayerInstance.getMediaElement().currentTime-this.seekRange.start:0}},{key:"_startTime",get:function(){return this.seekRange.start}},{key:"presentationStartTimeAsDate",get:function(){return this.shakaPlayerInstance&&this.shakaPlayerInstance.getPresentationStartTimeAsDate()?new Date(this.shakaPlayerInstance.getPresentationStartTimeAsDate().getTime()+1e3*this.seekRange.start):0}},{key:"bandwidthEstimate",get:function(){return this.shakaPlayerInstance?this.shakaPlayerInstance.getStats().estimatedBandwidth:null}},{key:"getProgramDateTime",value:function(){return this.presentationStartTimeAsDate}},{key:"_updateDvr",value:function(t){this.trigger(g.Events.PLAYBACK_DVR,t),this.trigger(g.Events.PLAYBACK_STATS_ADD,{dvr:t})}},{key:"seek",value:function(t){t<0&&(g.Log.warn("Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point."),t=this._duration),this.dvrEnabled&&this._updateDvr(t<this._duration-3),t+=this._startTime,this.el.currentTime=t}},{key:"pause",value:function(){this.el.pause(),this.dvrEnabled&&this._updateDvr(!0)}},{key:"play",value:function(){this.criticalError||(this._player||this._setup(),this.isReady?(this._stopped=!1,this._src=this.el.src,E(e,"play",this,3)([]),this._startTimeUpdateTimer()):this.once(e.Events.SHAKA_READY,this.play))}},{key:"_onPlaying",value:function(){if(!this._isBuffering)return E(e,"_onPlaying",this,3)([])}},{key:"_onSeeking",value:function(){return this._isSeeking=!0,E(e,"_onSeeking",this,3)([])}},{key:"_onSeeked",value:function(){if(!this._isBuffering)return this._isSeeking=!1,E(e,"_onSeeked",this,3)([])}},{key:"_startTimeUpdateTimer",value:function(){var t=this;this._stopTimeUpdateTimer(),this._timeUpdateTimer=setInterval((function(){t._onTimeUpdate()}),100)}},{key:"_stopTimeUpdateTimer",value:function(){this._timeUpdateTimer&&clearInterval(this._timeUpdateTimer)}},{key:"_setupSrc",value:function(){}},{key:"_ready",value:function(){}},{key:"_onShakaReady",value:function(){this._isShakaReadyState=!0,this.trigger(e.Events.SHAKA_READY),this.trigger(g.Events.PLAYBACK_READY,this.name)}},{key:"isReady",get:function(){return this._isShakaReadyState}},{key:"error",value:function(t){g.Log.error("an error was raised by the video tag",t,this.el.error)}},{key:"isHighDefinitionInUse",value:function(){return!!this.highDefinition}},{key:"stop",value:function(){var t=this;this._stopTimeUpdateTimer(),clearInterval(this.sendStatsId),this._stopped=!0,this._player?(this._sendStats(),this._player.unload().then((function(){E(e,"stop",t,3)([]),t._player=null,t._isShakaReadyState=!1})).catch((function(){g.Log.error("shaka could not be unloaded")}))):E(e,"stop",this,3)([])}},{key:"textTracks",get:function(){return this.isReady&&this._player.getTextTracks()}},{key:"audioTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter((function(t){return t.mimeType.startsWith("audio/")}))}},{key:"videoTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter((function(t){return t.mimeType.startsWith("video/")}))}},{key:"getPlaybackType",value:function(){return(this.isReady&&this._player.isLive()?"live":"vod")||""}},{key:"selectTrack",value:function(t){if("text"===t.type)this._player.selectTextTrack(t);else{if("variant"!==t.type)throw new Error("Unhandled track type:",t.type);this._player.selectVariantTrack(t),t.mimeType.startsWith("video/")&&this._onAdaptation()}}},{key:"closedCaptionsTracks",get:function(){var t=0;return(this.textTracks||[]).filter((function(t){return"subtitle"===t.kind})).map((function(e){return{id:t++,name:e.label||e.language,track:e}}))}},{key:"closedCaptionsTrackId",get:function(){return E(e,"closedCaptionsTrackId",this,1)},set:function(t){if(this._player){var e,r=this.closedCaptionsTracks;if(-1!==t){if(!(e=r.find((function(e){return e.id===t}))))return void g.Log.warn('Track id "'.concat(t,'" not found'));if(this._shakaTTVisible&&!0===e.track.active)return void g.Log.info('Track id "'.concat(t,'" already showing'))}e?(this._player.selectTextTrack(e.track),this._player.setTextTrackVisibility(!0),this._enableShakaTextTrack(!0)):(this._player.setTextTrackVisibility(!1),this._enableShakaTextTrack(!1)),this._ccTrackId=t,this.trigger(g.Events.PLAYBACK_SUBTITLE_CHANGED,{id:t})}}},{key:"_enableShakaTextTrack",value:function(t){this.el.textTracks&&(this._shakaTTVisible=t,Array.from(this.el.textTracks).filter((function(t){return"subtitles"===t.kind})).forEach((function(e){return e.mode=!0===t?"showing":"hidden"})))}},{key:"_checkForClosedCaptions",value:function(){if(!this._ccIsSetup){if(this.hasClosedCaptionsTracks){this.trigger(g.Events.PLAYBACK_SUBTITLE_AVAILABLE);var t=this.closedCaptionsTrackId;this.closedCaptionsTrackId=t}this._ccIsSetup=!0}}},{key:"destroy",value:function(){var t=this;this._stopTimeUpdateTimer(),clearInterval(this.sendStatsId),this._player?this._player.destroy().then((function(){return t._destroy()})).catch((function(){t._destroy(),g.Log.error("shaka could not be destroyed")})):this._destroy(),E(e,"destroy",this,3)([])}},{key:"_setup",value:function(){var t=this;this._isShakaReadyState=!1,this._ccIsSetup=!1;var e=function(){t._player=t._createPlayer(),t._setInitialConfig(),t._loadSource()};this._player?this._player.destroy().then((function(){return e()})):e()}},{key:"_createPlayer",value:function(){var t=new y.a.Player(this.el);return t.addEventListener("error",this._onError.bind(this)),t.addEventListener("adaptation",this._onAdaptation.bind(this)),t.addEventListener("buffering",this._handleShakaBufferingEvents.bind(this)),t.addEventListener("sessiondata",this._onHeaders.bind(this)),t}},{key:"_onHeaders",value:function(t){this.trigger(g.Events.PLAYBACK_FRAGMENT_LOADED,t)}},{key:"_setInitialConfig",value:function(){this._options.shakaConfiguration&&this._player.configure(this._options.shakaConfiguration),this._options.shakaOnBeforeLoad&&this._options.shakaOnBeforeLoad(this._player)}},{key:"_loadSource",value:function(){var t=this;this._player.load(this._options.src).then((function(){return t._loaded()})).catch((function(e){return t._setupError(e)}))}},{key:"_onTimeUpdate",value:function(){if(this.shakaPlayerInstance){var t={current:this.getCurrentTime(),total:this.getDuration(),firstFragDateTime:this.getProgramDateTime()};this._lastTimeUpdate&&t.current===this._lastTimeUpdate.current&&t.total===this._lastTimeUpdate.total||(this._lastTimeUpdate=t,this.trigger(g.Events.PLAYBACK_TIMEUPDATE,t,this.name))}}},{key:"_handleBufferingEvents",value:function(){}},{key:"_handleShakaBufferingEvents",value:function(t){this._stopped||(this._isBuffering=t.buffering,this._isBuffering?this._onBuffering():this._onBufferfull())}},{key:"_onBuffering",value:function(){this.trigger(g.Events.PLAYBACK_BUFFERING)}},{key:"_onBufferfull",value:function(){this.trigger(g.Events.PLAYBACK_BUFFERFULL),this._isSeeking&&this._onSeeked(),this.isPlaying()&&this._onPlaying()}},{key:"_loaded",value:function(){this._onShakaReady(),this._startToSendStats(),this._fillLevels(),this._checkForClosedCaptions()}},{key:"_fillLevels",value:function(){0===this._levels.length&&(this._levels=this.videoTracks.map((function(t){return{id:t.id,label:"".concat(t.height,"p")}})).reverse(),this.trigger(g.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels))}},{key:"_startToSendStats",value:function(){var t=this,e=this._options.shakaSendStatsInterval||3e4;this.sendStatsId=setInterval((function(){return t._sendStats()}),e)}},{key:"_sendStats",value:function(){this.trigger(g.Events.PLAYBACK_STATS_ADD,this._player.getStats())}},{key:"_setupError",value:function(t){this._onError(t)}},{key:"_onError",value:function(t){var r={shakaError:t,videoError:this.el.error},n=r.shakaError.detail||r.shakaError,i=n.category,s=n.code,a=n.severity;if(r.videoError||!s&&!i)return E(e,"_onError",this,3)([]);var o=a===y.a.util.Error.Severity.CRITICAL,l={code:"".concat(i,"_").concat(s),description:"Category: ".concat(i,", code: ").concat(s,", severity: ").concat(a),level:o?g.PlayerError.Levels.FATAL:g.PlayerError.Levels.WARN,raw:t},c=this.createError(l);g.Log.error("Shaka error event:",c),this.trigger(g.Events.PLAYBACK_ERROR,c)}},{key:"_onAdaptation",value:function(){var t=this.videoTracks.filter((function(t){return!0===t.active}))[0];this._fillLevels(),this._sendStats(),this._pendingAdaptationEvent&&(this.trigger(g.Events.PLAYBACK_LEVEL_SWITCH_END),this._pendingAdaptationEvent=!1),g.Log.debug("an adaptation has happened:",t),this.highDefinition=t.height>=720,this.trigger(g.Events.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this.trigger(g.Events.PLAYBACK_BITRATE,{bandwidth:t.bandwidth,width:t.width,height:t.height,level:t.id,bitrate:t.videoBandwidth})}},{key:"_updateSettings",value:function(){"vod"===this.getPlaybackType()?this.settings.left=["playpause","position","duration"]:this.dvrEnabled?this.settings.left=["playpause"]:this.settings.left=["playstop"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(g.Events.PLAYBACK_SETTINGSUPDATE)}},{key:"checkIfCritical",value:function(){var t=this;this._options.mediaInfo.then((function(e){var r=e.criticalError,n=e.errorCodec;r&&(t._isShakaReadyState=!1,t.criticalError=!0,t.stop(),t.trigger(g.Events.PLAYBACK_ERROR,{UI:{title:"Playback error",message:"Could not play ".concat(n||"this"," codec")},raw:{response:{critical:!0}}}))}))}},{key:"_destroy",value:function(){this._isShakaReadyState=!1,g.Log.debug("shaka was destroyed")}}],[{key:"Events",get:function(){return{SHAKA_READY:"shaka:ready"}}},{key:"shakaPlayer",get:function(){return y.a}},{key:"canPlay",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";y.a.polyfill.installAll();var r=y.a.Player.isBrowserSupported(),n=t.split("?")[0].match(/.*\.(.*)$/)||[];return r&&("mpd"===n[1]||e.indexOf("application/dash+xml")>-1)}}])}(g.HTML5Video);e.a=b},function(t,e,r){"use strict";r.d(e,"a",(function(){return E}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(15),d=r.n(h),f=r(8),p=r.n(f),g=r(1),m=r(182),y=r.n(m);function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(v=function(){return!!t})()}var E=function(t){function e(t){var r,n,s,a;return i()(this,e),n=this,s=e,a=[t],s=u()(s),(r=l()(n,v()?Reflect.construct(s,a||[],u()(n).constructor):s.apply(n,a))).listenTo(r.container,g.Events.MEDIACONTROL_CONTAINERCHANGED,r.calculatePos),r.listenToOnce(r.container,g.Events.CONTAINER_LOADEDMETADATA,(function(t){r.render(t)})),r}return p()(e,t),a()(e,[{key:"name",get:function(){return"Flussonic paning/zooming plugin"}},{key:"supportedVersion",get:function(){return{min:"0.4.18"}}},{key:"destroy",value:function(){var t,r,n,i,s;(t=e,r="destroy",n=this,i=3,s=d()(u()(1&i?t.prototype:t),r,n),2&i&&"function"==typeof s?function(t){return s.apply(n,t)}:s)([])}},{key:"render",value:function(t){var e=this,r=t.data;this._video=r.target,this.zoomElement=y()(this._video,{maxZoom:10,minZoom:1,smoothScroll:!1,zoomDoubleClickSpeed:1,filterKey:function(){return!0},onDoubleClick:function(t){return!1}}),this.zoomElement.on("transform",(function(t){e.calculatePos(t)}))}},{key:"calculatePos",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(e)t=e.getTransform();else{if(!this.zoomElement)return;t=this.zoomElement.getTransform()}var r=function(t){return Math.floor(100*t)/100};if(t){var n=t,i=n.x,s=n.y,a=i,o=s,l=!1,c=this.container.el.getBoundingClientRect(),u=this._video.getBoundingClientRect();if(!c)return;if(u.left>c.left&&(a=c.left,l=!0),u.top>c.top&&(o=c.top,l=!0),u.right<c.right&&(a=c.right-u.width,l=!0),u.bottom<c.bottom&&(o=c.bottom-u.height,l=!0),l){if(r(a)===r(i)&&r(o)===r(s))return;this.zoomElement.moveTo(a,o)}}}}])}(g.ContainerPlugin)},,function(t,e,r){"use strict";r.d(e,"a",(function(){return y}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(8),d=r.n(h),f=r(1),p=r(184),g=r.n(p);r(404);function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(m=function(){return!!t})()}var y=function(t){function e(t){var r,n,s,a;return i()(this,e),n=this,s=e,a=[t],s=u()(s),(r=l()(n,m()?Reflect.construct(s,a||[],u()(n).constructor):s.apply(n,a))).core=t,r.guid=r.randomGUID(),r}return d()(e,t),a()(e,[{key:"name",get:function(){return"Flussonic Video Thumbnails"}},{key:"supportedVersion",get:function(){return{min:"0.4.18"}}},{key:"template",get:function(){return Object(f.template)(g.a)}},{key:"bindEvents",value:function(){this.listenTo(this.core,f.Events.CORE_ACTIVE_CONTAINER_CHANGED,this.containerChanged),this.listenTo(this.core.mediaControl,f.Events.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.core.mediaControl,f.Events.MEDIACONTROL_MOUSEMOVE_SEEKBAR,this.onMouseMove.bind(this)),this.listenTo(this.core.mediaControl,f.Events.MEDIACONTROL_MOUSELEAVE_SEEKBAR,this.onMouseLeave)}},{key:"containerChanged",value:function(){this.stopListening(),this.bindEvents(),this.bindHLS()}},{key:"bindHLS",value:function(){var t=this,e=this.core.getCurrentPlayback()._hls;e&&!this.attachedEvent?(this.listenTo(e,"hlsLevelPtsUpdated",this.hlsPtsUpdated.bind(this)),this.attachedEvent=!0,this.hls=!0):this.attachedEvent||this.core.getCurrentPlayback().on("playback:ready",(function(){var e=t.core.getCurrentPlayback()._player;if(e){t.player=e,t.hls=!1;var r=t.getThumbnailImageTrack(e);r&&r.id&&(t.thumbnailTrackId=r.id),t.attachedEvent=!0}}))}},{key:"hlsPtsUpdated",value:function(t,e){e.details.fragments[0]&&(this.totalDuration=e.details.totalduration,this.startProgramDateTime=e.details.fragments[0].rawProgramDateTime)}},{key:"setUpStyles",value:function(t){return t.addClass("thumbnail_placeholder")}},{key:"onMouseMove",value:function(t){var e=t.clientX,r=this.core.mediaControl.$seekBarContainer.width();this.updateThumbPosition(r,e),!this.hls&&this.player?this.updateJpegUrl(r,e):this.totalDuration&&this.startProgramDateTime?this.updateThumbUrl(r,e):this.hide()}},{key:"updateThumbUrl",value:function(t,e){var r=new Date(this.startProgramDateTime),n=e-this.core.mediaControl.$seekBarContainer.offset().left,i=Math.min(1,Math.max(n/t,0)),s=r.getTime(),a=this.totalDuration*i*1e3,o=new Date(s+a),l=this.getBaseUrl(this.core,o);document.getElementById(this.guid).setAttribute("src",l)}},{key:"updateJpegUrl",value:function(t,e){var r=this;if(this.thumbnailTrackId&&!this.hls&&this.player){var n=e-this.core.mediaControl.$seekBarContainer.offset().left,i=this.player.seekRange(),s=(i.end-i.start)/t,a=i.start+n*s;this.player.getThumbnails(this.thumbnailTrackId,a).then((function(t){var e=t.uris;e&&document.getElementById(r.guid).setAttribute("src",e)}))}}},{key:"updateThumbPosition",value:function(t,e){var r=Math.max(0,Math.min(t-300,e-150));this.$el.css("left",r),this.show()}},{key:"onMouseLeave",value:function(){this.hide()}},{key:"onRendered",value:function(){this.$el.html(this.template({guid:this.guid,hls:this.hls})),this.setUpStyles(this.$el)}},{key:"render",value:function(){this.onRendered();var t=this.core.$el.find(".media-control-background");t[0]&&t.append(this.$el)}},{key:"show",value:function(){this.$el.css("opacity",1),this.$el.css("height","180px")}},{key:"hide",value:function(){this.$el.css("opacity",0),this.$el.css("height","0")}},{key:"s4",value:function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}},{key:"randomGUID",value:function(){return"".concat(this.s4()+this.s4(),"-").concat(this.s4(),"-").concat(this.s4(),"-").concat(this.s4(),"-").concat(this.s4()).concat(this.s4()).concat(this.s4())}},{key:"zeroBased",value:function(t){return t<10?"0".concat(t):String(t)}},{key:"relUrl",value:function(t){return"".concat(this.zeroBased(t.getUTCFullYear()),"/").concat(this.zeroBased(t.getUTCMonth()+1),"/").concat(this.zeroBased(t.getUTCDate()),"/").concat(this.zeroBased(t.getUTCHours()),"/").concat(this.zeroBased(t.getUTCMinutes()),"/").concat(this.zeroBased(t.getUTCSeconds()),"-preview.mp4")}},{key:"getBaseUrl",value:function(t,e){var r=t._options,n=r.source,i=r.authToken,s="".concat(n.slice(0,n.lastIndexOf("/")),"/");return"".concat(s).concat(this.relUrl(e)).concat(i?"?".concat(i):"")}},{key:"getThumbnailImageTrack",value:function(t){var e=t.getImageTracks();return e&&e.length,e[0]}}])}(f.UICorePlugin)},function(t,e){t.exports='<% if (hls) { %>\n<video\n autoplay\n id="<%= guid %>"\n width="100%"\n type=\'video/mp4; codecs="avc1.42E01E, mp4a.40.2"\'\n></video>\n<% } else { %>\n<img id="<%= guid %>" alt="" />\n<% }; %>\n'},function(t,e,r){"use strict";r.d(e,"a",(function(){return v}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(8),d=r.n(h),f=r(1),p=r(186),g=r(187),m=r.n(g);function y(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(y=function(){return!!t})()}var v=function(t){function e(t){var r,n,s,a;return i()(this,e),n=this,s=e,a=[t],s=u()(s),(r=l()(n,y()?Reflect.construct(s,a||[],u()(n).constructor):s.apply(n,a))).$el.addClass("media-control-button media-control-icon").css({float:"right",height:"100%"}).append(m.a),r.$el.click((function(){var t=r.core.mediaControl.container.playback.el,e=document.createElement("canvas");e.width=t.videoWidth,e.height=t.videoHeight,e.getContext("2d").drawImage(t,0,0);var n=e.toDataURL("image/jpeg");r.core.mediaControl.trigger("capture:base64",n)})),r}return d()(e,t),a()(e,[{key:"name",get:function(){return"Flussonic capture plugin"}},{key:"supportedVersion",get:function(){return{min:"0.4.18"}}},{key:"tagName",get:function(){return"button"}},{key:"attributes",get:function(){return{class:this.name}}},{key:"bindEvents",value:function(){this.listenToOnce(this.core,f.Events.CORE_ACTIVE_CONTAINER_CHANGED,(function(){this.listenTo(this.core.mediaControl,f.Events.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.core.mediaControl,"capture:base64",(function(t){Object(p.saveAs)(t,"screenshot_".concat(Date.now(),".jpg"))}))}))}},{key:"unBindEvents",value:function(){this.stopListening(this.core.mediaControl,f.Events.MEDIACONTROL_RENDERED)}},{key:"render",value:function(){return this.core.mediaControl.$el.find(".media-control-right-panel").append(this.el),this}}])}(f.UICorePlugin)},function(t,e,r){(function(r){var n,i,s;i=[],void 0===(s="function"==typeof(n=function(){"use strict";function e(t,e){return void 0===e?e={autoBom:!1}:"object"!=typeof e&&(console.warn("Deprecated: Expected third argument to be a object"),e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t}function n(t,e,r){var n=new XMLHttpRequest;n.open("GET",t),n.responseType="blob",n.onload=function(){l(n.response,e,r)},n.onerror=function(){console.error("could not download file")},n.send()}function i(t){var e=new XMLHttpRequest;e.open("HEAD",t,!1);try{e.send()}catch(t){}return 200<=e.status&&299>=e.status}function s(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(r){var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(e)}}var a="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof r&&r.global===r?r:void 0,o=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=a.saveAs||("object"!=typeof window||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(t,e,r){var o=a.URL||a.webkitURL,l=document.createElement("a");e=e||t.name||"download",l.download=e,l.rel="noopener","string"==typeof t?(l.href=t,l.origin===location.origin?s(l):i(l.href)?n(t,e,r):s(l,l.target="_blank")):(l.href=o.createObjectURL(t),setTimeout((function(){o.revokeObjectURL(l.href)}),4e4),setTimeout((function(){s(l)}),0))}:"msSaveOrOpenBlob"in navigator?function(t,r,a){if(r=r||t.name||"download","string"!=typeof t)navigator.msSaveOrOpenBlob(e(t,a),r);else if(i(t))n(t,r,a);else{var o=document.createElement("a");o.href=t,o.target="_blank",setTimeout((function(){s(o)}))}}:function(t,e,r,i){if((i=i||open("","_blank"))&&(i.document.title=i.document.body.innerText="downloading..."),"string"==typeof t)return n(t,e,r);var s="application/octet-stream"===t.type,l=/constructor/i.test(a.HTMLElement)||a.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||s&&l||o)&&"undefined"!=typeof FileReader){var u=new FileReader;u.onloadend=function(){var t=u.result;t=c?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),i?i.location.href=t:location=t,i=null},u.readAsDataURL(t)}else{var h=a.URL||a.webkitURL,d=h.createObjectURL(t);i?i.location=d:location.href=d,i=null,setTimeout((function(){h.revokeObjectURL(d)}),4e4)}});a.saveAs=l.saveAs=l,t.exports=l})?n.apply(e,i):n)||(t.exports=s)}).call(this,r(31))},function(t,e){t.exports='<svg viewBox="0 0 2048 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1024 672q119 0 203.5 84.5t84.5 203.5-84.5 203.5-203.5 84.5-203.5-84.5-84.5-203.5 84.5-203.5 203.5-84.5zm704-416q106 0 181 75t75 181v896q0 106-75 181t-181 75h-1408q-106 0-181-75t-75-181v-896q0-106 75-181t181-75h224l51-136q19-49 69.5-84.5t103.5-35.5h512q53 0 103.5 35.5t69.5 84.5l51 136h224zm-704 1152q185 0 316.5-131.5t131.5-316.5-131.5-316.5-316.5-131.5-316.5 131.5-131.5 316.5 131.5 316.5 316.5 131.5z" fill="#fff"></path></svg>'},function(t,e,r){"use strict";r.d(e,"a",(function(){return E}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(15),d=r.n(h),f=r(8),p=r.n(f),g=r(17),m=r.n(g),y=r(1);r(405);function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(v=function(){return!!t})()}var E=function(t){function e(t){var r,n,s,a;return i()(this,e),n=this,s=e,a=[t],s=u()(s),r=l()(n,v()?Reflect.construct(s,a||[],u()(n).constructor):s.apply(n,a)),m()(r,"frameLooper",(function(){if(r.audioConnected){var t=new Uint8Array(r.analyser.frequencyBinCount);r.analyser.getByteFrequencyData(t);for(var e=0,n=0;n<t.length;n++)if(0!==t[n]){var i=Math.abs(t[n]);i>e&&(e=i)}var s=Math.round(r.canvas.offsetHeight/(256/e))||0;r.eqBarBack.style.height="".concat(r.canvas.offsetHeight,"px"),r.eqBar.style.height="".concat(s,"px")}})),r.container=t,r.audioConnected=!1,r.render(),r}return p()(e,t),a()(e,[{key:"name",get:function(){return"EqualizerPlugin"}},{key:"bindEvents",value:function(){this.listenTo(this.container,y.Events.CONTAINER_VOLUME,this.connectToAudio)}},{key:"destroy",value:function(){var t,r,n,i,s;clearInterval(this.timerStatus),(t=e,r="destroy",n=this,i=3,s=d()(u()(1&i?t.prototype:t),r,n),2&i&&"function"==typeof s?function(t){return s.apply(n,t)}:s)([])}},{key:"connectToAudio",value:function(t){100===t&&(this.context=new(window.AudioContext||window.webkitAudioContext),this.analyser=this.context.createAnalyser(),this.source=this.context.createMediaElementSource(this.container.$el.find("video")[0]),this.source.connect(this.analyser),this.analyser.connect(this.context.destination),this.audioConnected=!0,this.frameLooper=this.frameLooper.bind(this),clearInterval(this.timerStatus),this.timerStatus=setInterval(this.frameLooper,25),this.stopListening(this.container,y.Events.CONTAINER_VOLUME,this.connectToAudio))}},{key:"render",value:function(){return this.container.$el.append('<div class="equalizer"><div class="eq-bar"><div class="eq-bar-back"></div></div></div>'),this.canvas=this.container.$el.find(".equalizer")[0],this.eqBar=this.container.$el.find(".eq-bar")[0],this.eqBarBack=this.container.$el.find(".eq-bar-back")[0],this}}])}(y.ContainerPlugin)},function(t,e,r){"use strict";r.d(e,"a",(function(){return y}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(15),d=r.n(h),f=r(8),p=r.n(f),g=r(1);function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(m=function(){return!!t})()}var y=function(t){function e(t){var r,n,s,a;return i()(this,e),n=this,s=e,a=[t],s=u()(s),(r=l()(n,m()?Reflect.construct(s,a||[],u()(n).constructor):s.apply(n,a))).background="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAFoBAMAAAA1HFdiAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAG1BMVEX5+fn//wAA//8A/wD/AP//AAAAAP8XFxf///8H5gWfAAAAAWJLR0QIht6VegAAAAd0SU1FB98IBRIsAXmGk48AAAI5SURBVHja7dJBDYBADADBs4AFLGABC1iohbOPhv1BMvu+NLlp10odqTN1pe7Uk5pQ8wMIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECDA/wKWxzM71T7ZZrfltNnppgACBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAL8B+ALjSfYzPnmdzgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNS0wOC0wNVQxODo0NDowMSswMTowMCL95a4AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTUtMDgtMDVUMTg6NDQ6MDErMDE6MDBToF0SAAAAAElFTkSuQmCC","boolean"==typeof r.options.calmError&&r.options.calmError&&(r.background=""),r.options.dontShowError&&(r.dontShowError=parseInt(r.options.dontShowError,10),1==r.options.dontShowError&&(r.dontShowError=1)),r.listenTo(r.container,g.Events.CONTAINER_ERROR,r.onError),r}return p()(e,t),a()(e,[{key:"name",get:function(){return"Flussonic error plugin"}},{key:"supportedVersion",get:function(){return{min:"0.4.18"}}},{key:"destroy",value:function(){var t,r,n,i,s;this.t="stop",(t=e,r="destroy",n=this,i=3,s=d()(u()(1&i?t.prototype:t),r,n),2&i&&"function"==typeof s?function(t){return s.apply(n,t)}:s)([])}},{key:"hide",value:function(){this._err&&this._err.remove()}},{key:"show",value:function(t,e){var r=t.title,n=t.message;this.hide();var i=t&&r?r:"",s=t&&n?n:"A fatal error occured.",a="";if(e){var o=e.code,l=void 0===o?"":o,c=e.text,u=void 0===c?"":c;a=l||u?"Code:".concat(l||""," - ").concat(u||""):""}this._err=$("<div>").css({position:"absolute","z-index":"999",width:"100%",height:"100%",display:"flex","align-items":"center","justify-content":" center","flex-direction":"column","background-image":"url(".concat(this.background,")"),"background-size":"100% 100%","background-repeat":"no-repeat","background-color":"#777","text-align":"center","font-weight":"bold","text-shadow":"1px 1px ".concat(this.options.calmError?"#000":"#fff"),color:"".concat(this.options.calmError?"#fff":"#000")}).append($("<h1>").text(i).css({"font-size":"200%"})).append($("<h2>").text(s).css({"font-size":"150%","margin-top":"8px"})).append($("<h3>").text(a).css({"font-size":"100%","margin-top":"8px","margin-bottom":"16px"})).append($('<p class="retrying_text">').html('Retrying in <span class="retry-counter">10</span> seconds ...').css({"font-size":"120%",margin:"15px"})),this.dontShowError&&this.dontShowError>0?this.dontShowError-=1:this.container&&this.container.$el.prepend(this._err)}},{key:"onError",value:function(t){if(t){var e=t.UI,r=t.raw;if(r){var n=r.response;if(!this.container)return;if(this.show(e,n),n&&"critical"in n&&n.critical)return $(".retrying_text").text(""),this.t,void this.container.getPlugin("click_to_pause").disable()}}var i;this.container.getPlugin("click_to_pause").disable();var s=10,a=function(){if(clearTimeout(i),"stop"!==this.t){if(0===s)return this.container.getPlugin("click_to_pause").enable(),this.options.errorPlugin&&this.options.errorPlugin.onRetry?void this.options.errorPlugin.onRetry(t):(this.container.stop(),this.container.play(),void this.hide());$(".retry-counter").text(s),s--,this.t=s,i=setTimeout(a,1e3)}}.bind(this);a()}}])}(g.ContainerPlugin)},function(t,e,r){"use strict";r.d(e,"a",(function(){return E}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(8),d=r.n(h),f=r(1),p=r(191),g=r.n(p),m=r(192),y=r.n(m);r(406);function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(v=function(){return!!t})()}var E=function(t){function e(t){var r,n,s,a;i()(this,e),n=this,s=e,a=[t],s=u()(s),(r=l()(n,v()?Reflect.construct(s,a||[],u()(n).constructor):s.apply(n,a))).core=t;var o=t.options.closedCaptionsConfig;return r._title=o&&o.title?o.title:null,r._ariaLabel=o&&o.ariaLabel?o.ariaLabel:"cc-button",r._labelCb=o&&o.labelCallback&&"function"==typeof o.labelCallback?o.labelCallback:function(t){return t.name},r.hideCCOnStart=t.options.hideCCOnStart,r.tracksAdded=!1,r.firstTime=!0,r.onSubtitleAvailable(),r}return d()(e,t),a()(e,[{key:"name",get:function(){return"Flussonic closed captions"}},{key:"supportedVersion",get:function(){return{min:"0.4.18"}}},{key:"template",get:function(){return Object(f.template)(y.a)}},{key:"events",get:function(){return{"click [data-cc-button]":"toggleContextMenu","click [data-cc-select]":"onTrackSelect"}}},{key:"attributes",get:function(){return{class:"cc-controls","data-cc-controls":""}}},{key:"bindEvents",value:function(){this.listenTo(this.core,f.Events.CORE_ACTIVE_CONTAINER_CHANGED,this.containerChanged),this.listenTo(this.core.mediaControl,f.Events.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.core.mediaControl,f.Events.MEDIACONTROL_HIDE,this.hideContextMenu),this.bindContainerEvents()}},{key:"bindContainerEvents",value:function(){this.container=this.core.activeContainer,this.container&&(this.listenTo(this.container,f.Events.CONTAINER_SUBTITLE_CHANGED,this.onSubtitleChanged),this.listenTo(this.container,f.Events.CONTAINER_STOP,this.onContainerStop))}},{key:"onContainerStop",value:function(){this.ccAvailable(!1)}},{key:"containerChanged",value:function(){var t=this.core.plugins;t.length>0&&t.forEach((function(t){"ClosedCaptions"===t.constructor.name&&(t.$el[0].style.display="none");"closed_captions"===t.name&&(t.$el[0].style.display="none",t.disable())})),this.stopListening(),this.bindEvents()}},{key:"onSubtitleAvailable",value:function(){this.renderCcButton(),this.ccAvailable(!0)}},{key:"onSubtitleChanged",value:function(t){if(this.setCurrentContextMenuElement(t.id),this.firstTime){var e=this.container.$el.find("video")[0].textTracks,r=e.length;e&&r&&(this.setCurrentContextMenuElement(r-1),this.$el.addClass("available")),this.firstTime=!1}}},{key:"onTrackSelect",value:function(t){var e=parseInt(t.target.dataset.ccSelect,10);return this.container.closedCaptionsTrackId=e,this.hideContextMenu(),t.noProp||t.stopPropagation(),!1}},{key:"ccAvailable",value:function(t){var e=t?"addClass":"removeClass";this.$el[e]("available")}},{key:"toggleContextMenu",value:function(){this.$el.find("ul").toggle()}},{key:"hideContextMenu",value:function(){this.$el.find("ul").hide()}},{key:"contextMenuElement",value:function(t){return this.$el.find("ul a".concat(Number.isNaN(t)?"":'[data-cc-select="'.concat(t,'"]'))).parent()}},{key:"mainButtonElement",value:function(){return this.$el.find("button.cc-button[data-cc-button]")}},{key:"setCurrentContextMenuElement",value:function(t){if(void 0===this._trackId&&void 0!==this.startingSubs)return this.contextMenuElement().removeClass("current"),this.contextMenuElement(this.startingSubs).addClass("current"),this.$el.find("button.cc-button[data-cc-button]").addClass("enabled"),this._trackId=this.startingSubs,void(this.startingSubs=void 0);if(this._trackId!==t){this.contextMenuElement(this._trackId).removeClass("current"),this.contextMenuElement(t).addClass("current");var e=t>-1?"addClass":"removeClass";this.$ccButton[e]("enabled"),this._trackId=t}}},{key:"renderCcButton",value:function(){for(var t=this.container?this.container.closedCaptionsTracks:[],e=0;e<t.length;e+=1)t[e].label=this._labelCb(t[e]);this.$el.html(this.template({ariaLabel:this._ariaLabel,disabledLabel:this.core.i18n.t("disabled"),title:this._title,tracks:t})),this.$ccButton=this.$el.find("button.cc-button[data-cc-button]"),this.$ccButton.append(g.a),this.$el.append(this.style)}},{key:"render",value:function(){this.renderCcButton();var t=this.core.mediaControl.$el.find("button[data-fullscreen]");return t[0]?this.$el.insertAfter(t):this.core.mediaControl.$el.find(".media-control-right-panel[data-media-control]").prepend(this.$el),this}}])}(f.UICorePlugin)},function(t,e){t.exports='<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 49 41.8" style="enable-background:new 0 0 49 41.8;" xml:space="preserve"><path d="M47.1,0H3.2C1.6,0,0,1.2,0,2.8v31.5C0,35.9,1.6,37,3.2,37h11.9l3.2,1.9l4.7,2.7c0.9,0.5,2-0.1,2-1.1V37h22.1 c1.6,0,1.9-1.1,1.9-2.7V2.8C49,1.2,48.7,0,47.1,0z M7.2,18.6c0-4.8,3.5-9.3,9.9-9.3c4.8,0,7.1,2.7,7.1,2.7l-2.5,4 c0,0-1.7-1.7-4.2-1.7c-2.8,0-4.3,2.1-4.3,4.3c0,2.1,1.5,4.4,4.5,4.4c2.5,0,4.9-2.1,4.9-2.1l2.2,4.2c0,0-2.7,2.9-7.6,2.9 C10.8,27.9,7.2,23.5,7.2,18.6z M36.9,27.9c-6.4,0-9.9-4.4-9.9-9.3c0-4.8,3.5-9.3,9.9-9.3C41.7,9.3,44,12,44,12l-2.5,4 c0,0-1.7-1.7-4.2-1.7c-2.8,0-4.3,2.1-4.3,4.3c0,2.1,1.5,4.4,4.5,4.4c2.5,0,4.9-2.1,4.9-2.1l2.2,4.2C44.5,25,41.9,27.9,36.9,27.9z"></path></svg>'},function(t,e){t.exports='<button\n type="button"\n class="cc-button media-control-button media-control-icon"\n data-cc-button\n aria-label="<%= ariaLabel %>"\n></button>\n<ul>\n <% if (title) { %>\n <li data-title><%= title %></li>\n <% }; %>\n <li><a href="#" data-cc-select="-1"><%= disabledLabel %></a></li>\n <% for (var i = 0; i < tracks.length; i++) { %>\n <li class="<% if (tracks[i].track.mode == \'showing\') { %>current<% }; %>">\n <a href="#" data-cc-select="<%= tracks[i].id %>">\n <%= tracks[i].label %> <% if (tracks[i].track.language) { %> (<%=\n tracks[i].track.language %>) <% }; %></a\n >\n </li>\n <% }; %>\n</ul>\n'},function(t,e,r){"use strict";r.d(e,"a",(function(){return A}));var n=r(62),i=r.n(n),s=r(5),a=r.n(s),o=r(6),l=r.n(o),c=r(7),u=r.n(c),h=r(3),d=r.n(h),f=r(15),p=r.n(f),g=r(8),m=r.n(g),y=r(17),v=r.n(y),E=r(1);function b(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function T(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?b(Object(r),!0).forEach((function(e){v()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function S(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(S=function(){return!!t})()}var A=function(t){function e(t){var r,n,i,s;a()(this,e),n=this,i=e,s=[t],i=d()(i),r=u()(n,S()?Reflect.construct(i,s||[],d()(n).constructor):i.apply(n,s)),v()(r,"resetStats",(function(){r.playerStatsObject={proto:"mseld",user_agent:navigator.userAgent,bytes:0,application:{application_name:"live_player",application_version:r._options.version,stall_count:0,pause_count:0,error_count:0,reconnect_count:0,bitrate_change_count:0,live_duration:0,stall_duration:0,pause_duration:0,total_video_frames:0,dropped_video_frames:0,corrupted_video_frames:0}}})),v()(r,"start",(function(){r.sendingInterval=setInterval((function(){r.post()}),r.statsSendTime)})),v()(r,"stop",(function(){r.sendingInterval&&(clearInterval(r.sendingInterval),r.post())})),v()(r,"post",(function(){if(r.playerStatsObject.started_at){var t=r.playerStatsObject.source_id,e=r.statsURL.replace(/sessions/,"sessions/".concat(t||""));r._options.statsSendEnable&&fetch(e,{headers:{Accept:"application/json","Content-Type":"application/json"},method:"PUT",body:JSON.stringify(r.getStats())})}})),r.uuid=r.generateUUID();var o=r._options,l=o.statsSendTime,c=o.src;return r.statsSendTime=1e3*l||6e4,r.statsURL=c.replace(/index.mpd/,"sessions").replace(/index.fmp4.m3u8/,"sessions").replace(/mse_ld/,"sessions"),r.resetStats(),r.playerStatsObject=r.getStats(),r}return m()(e,t),l()(e,[{key:"name",get:function(){return"StatsPlugin"}},{key:"bindEvents",value:function(){var t=this,e=this._options.playback;this.proto=this._options.proto;var r=["PLAYBACK_PLAY_INTENT","PLAYBACK_LOADEDMETADATA","PLAYBACK_PLAYBACKSTATE","PLAYBACK_PROGRESS","PLAYBACK_READY","CONTAINER_BITRATE","PLAYBACK_BUFFERING","PLAYBACK_BUFFERFULL","PLAYBACK_ERROR","PLAYBACK_FRAGMENT_LOADED","PLAYBACK_STOP","PLAYBACK_STATS_ADD"];!!e.MSE||(r=[].concat(i()(r),["PLAYBACK_PAUSE","PLAYBACK_PLAY"])),r.forEach((function(e){t.listenTo(t.container.playback,E.Events[e],(function(r){t.onEvent(E.Events[e],r)}))}))}},{key:"onEvent",value:function(t,e){var r=this,n=this._options.playback,i=!!n.MSE;switch(t){case"playback:ready":i||(this.playerStatsObject.proto=this.proto||"hls",this.playerStatsObject.opened_at=Date.now()),this.start();break;case"playback:play:intent":i&&this.updateMseStats();break;case"playback:play":if(this.playerStatsObject.started_at=Date.now(),this.pauseStartedAt){var s=this.playerStatsObject.application;if(s){var a=s.pause_duration;a+=Date.now()-this.pauseStartedAt,this.addPlayerStat("pause_duration",!1,a),delete this.pauseStartedAt}}break;case"playback:buffering":this.buferingStart=Date.now(),this.addPlayerStat("stall_count");break;case"playback:bufferfull":if(this.buferingStart){var o=this.playerStatsObject.application;if(o){var l=o.stall_duration;l+=Date.now()-this.buferingStart,this.addPlayerStat("stall_duration",!1,l),delete this.buferingStart}}break;case"playback:loadedmetadata":i||this.addPlayerStat("bitrate_change_count");break;case"playback:error":i||this.addPlayerStat("error_count");break;case"playback:stop":i?this.updateMseStats():this.playerStatsObject.closed_at=Date.now(),this.stop();break;case"playback:pause":this.addPlayerStat("pause_count"),this.pauseStartedAt=Date.now();break;case"playback:loadedmetadata":this.playerStatsObject.first_byte_at=Date.now();break;case"playback:fragment:loaded":var c=e.networkDetails;c.onload=function(){r.playerStatsObject.source_id=c.getResponseHeader("X-Sid")};var u=e.frag.stats.loaded;this.playerStatsObject.bytes+=u;break;case"playback:progress":if(i)this.updateMseStats();else{if(this.playerStatsObject.updated_at=Date.now(),this.segmentStart){var h=this.playerStatsObject.application;if(h){var d=h.live_duration;d+=Date.now()-this.segmentStart,this.addPlayerStat("live_duration",!1,d),delete this.segmentStart}}else this.segmentStart=Date.now();this.playerStatsObject=T(T({},this.playerStatsObject),{},{id:this.uuid});var f=n.el.getVideoPlaybackQuality(),p=f.corruptedVideoFrames,g=f.droppedVideoFrames,m=f.totalVideoFrames;this.addPlayerStat("total_video_frames",!1,m),this.addPlayerStat("dropped_video_frames",!1,g),this.addPlayerStat("corrupted_video_frames",!1,p)}}"playback:ready"!==t&&this._options.statsCallback(this.getStats())}},{key:"updateMseStats",value:function(){if(this._options.playback.MSE){var t=this.getMseStats();this.playerStatsObject=T(T({},this.playerStatsObject),t)}}},{key:"getMseStats",value:function(){var t=this._options.playback.getStats();return delete t.application_name,delete t.application_version,delete t.user_agent,delete t.uuid,t}},{key:"addPlayerStat",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=this.playerStatsObject.application;n&&(r?n[t]=r:e&&n[t]++,this.playerStatsObject.application=n)}},{key:"getStats",value:function(){return T(T({},this.playerStatsObject),{},{id:this.uuid})}},{key:"generateUUID",value:function(){var t=(new Date).getTime(),e="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var n=16*Math.random();return t>0?(n=(t+n)%16|0,t=Math.floor(t/16)):(n=(e+n)%16|0,e=Math.floor(e/16)),("x"===r?n:3&n|8).toString(16)}))}},{key:"destroy",value:function(){var t,r,n,i,s;(t=e,r="destroy",n=this,i=3,s=p()(d()(1&i?t.prototype:t),r,n),2&i&&"function"==typeof s?function(t){return s.apply(n,t)}:s)([])}}])}(E.UIContainerPlugin)},function(t,e,r){"use strict";r.d(e,"a",(function(){return y}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(15),d=r.n(h),f=r(8),p=r.n(f),g=r(1);function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(m=function(){return!!t})()}var y=function(t){function e(){return i()(this,e),t=this,r=e,n=arguments,r=u()(r),l()(t,m()?Reflect.construct(r,n||[],u()(t).constructor):r.apply(t,n));var t,r,n}return p()(e,t),a()(e,[{key:"name",get:function(){return"Flussonic timeline check plugin"}},{key:"supportedVersion",get:function(){return{min:"0.4.18"}}},{key:"bindEvents",value:function(){var t=this;this.listenTo(this.core,g.Events.CORE_ACTIVE_CONTAINER_CHANGED,this.checkForLive),this.checkingLive||(this.checkingLive=setInterval((function(){t.checkForLive()}),1e3))}},{key:"destroy",value:function(){var t,r,n,i,s;clearInterval(this.checkingLive),(t=e,r="destroy",n=this,i=3,s=d()(u()(1&i?t.prototype:t),r,n),2&i&&"function"==typeof s?function(t){return s.apply(n,t)}:s)([])}},{key:"checkForLive",value:function(){this.stopListening(),this.bindEvents(),this.mediaControl=this.core.mediaControl;var t=this.mediaControl.$el;"live"===this.core.getPlaybackType()&&t.addClass("live")}},{key:"render",value:function(){this.checkForLive()}}])}(g.UICorePlugin)},function(t,e,r){"use strict";r.d(e,"a",(function(){return y}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(15),d=r.n(h),f=r(8),p=r.n(f),g=r(1);function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(m=function(){return!!t})()}var y=function(t){function e(t){var r,n,s,a;i()(this,e),n=this,s=e,a=[t],s=u()(s);var o=(r=l()(n,m()?Reflect.construct(s,a||[],u()(n).constructor):s.apply(n,a)))._options.playbackDuration;return r.playbackDuration=o,r}return p()(e,t),a()(e,[{key:"name",get:function(){return"SegmentPlayPlugin"}},{key:"bindEvents",value:function(){var t=this;this.listenTo(this.container.playback,g.Events.PLAYBACK_PLAY,(function(){t.stopTimer()}))}},{key:"stopTimer",value:function(){var t=this;this.playbackDuration&&(this.stopTimeout=setTimeout((function(){t.container.pause(),setTimeout((function(){t.container.stop()}),0)}),1e3*this.playbackDuration))}},{key:"destroy",value:function(){var t,r,n,i,s;clearTimeout(this.stopTimeout),(t=e,r="destroy",n=this,i=3,s=d()(u()(1&i?t.prototype:t),r,n),2&i&&"function"==typeof s?function(t){return s.apply(n,t)}:s)([])}}])}(g.UIContainerPlugin)},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return E}));var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(8),d=r.n(h),f=r(1),p=r(197),g=r.n(p),m=r(198),y=r.n(m);function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(v=function(){return!!t})()}var E=function(e){function r(){return i()(this,r),t=this,e=r,n=arguments,e=u()(e),l()(t,v()?Reflect.construct(e,n||[],u()(t).constructor):e.apply(t,n));var t,e,n}return d()(r,e),a()(r,[{key:"name",get:function(){return"audioTrackSelector"}},{key:"template",get:function(){return Object(f.template)(g.a)}},{key:"supportedVersion",get:function(){return{min:f.version}}},{key:"attributes",get:function(){return{class:this.name,"data-audioTrackSelector":""}}},{key:"events",get:function(){return{"click [data-audioTrackSelector-select]":"onLevelSelect","click [data-audioTrackSelector-button]":"onShowLevelSelectMenu"}}},{key:"container",get:function(){return this.core.activeContainer?this.core.activeContainer:this.core.mediaControl.container}},{key:"playback",get:function(){return this.core.activePlayback?this.core.activePlayback:this.core.getCurrentPlayback()}},{key:"bindEvents",value:function(){this.listenTo(this.core,f.Events.CORE_READY,this.bindPlaybackEvents),f.Events.CORE_ACTIVE_CONTAINER_CHANGED?this.listenTo(this.core,f.Events.CORE_ACTIVE_CONTAINER_CHANGED,this.reload):this.listenTo(this.core.mediaControl,f.Events.MEDIACONTROL_CONTAINERCHANGED,this.reload),this.listenTo(this.core.mediaControl,f.Events.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.core.mediaControl,f.Events.MEDIACONTROL_HIDE,this.hideSelectLevelMenu)}},{key:"bindPlaybackEvents",value:function(){this.playback&&(this.listenTo(this.playback,f.Events.PLAYBACK_LEVELS_AVAILABLE,this.fillLevels),this.listenTo(this.playback,f.Events.PLAYBACK_LEVEL_SWITCH_START,this.startLevelSwitch),this.listenTo(this.playback,f.Events.PLAYBACK_LEVEL_SWITCH_END,this.stopLevelSwitch),this.listenTo(this.playback,f.Events.PLAYBACK_BITRATE,this.updateCurrentLevel),this.playback.levels&&this.playback.levels.length>0&&this.fillLevels(this.playback.levels))}},{key:"reload",value:function(){var e=this;this.stopListening(),t.nextTick((function(){e.bindEvents(),e.bindPlaybackEvents()}))}},{key:"shouldRender",value:function(){if(!this.container||!this.playback)return!1;var t=void 0!==this.playback.currentLevel,e=!!(this.audioLevels&&this.audioLevels.length>1);return t&&e}},{key:"render",value:function(){if(this.shouldRender()){var t=f.Styler.getStyleFor(y.a,{baseUrl:this.core.options.baseUrl});this.$el.html(this.template({audioLevels:this.audioLevels,title:this.getTitle()})),this.$el.append(t),this.core.mediaControl.$(".media-control-right-panel").append(this.el),this.$(".audioTrackSelector ul").css("max-height",.8*this.core.el.offsetHeight),this.highlightCurrentLevel()}return this}},{key:"fillLevels",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;void 0===this.selectedLevelId&&(this.selectedLevelId=e);var r=this.core.getCurrentPlayback()._hls.audioTrackController.tracks,n=this.core.options&&this.core.options.levelSelectorConfig&&this.core.options.levelSelectorConfig.onLevelsAvailable;if(n){if("function"!=typeof n)throw new TypeError("onLevelsAvailable must be a function");t=n(t.slice())}this.audioLevels=r,this.configureLevelsLabels(),this.render()}},{key:"configureLevelsLabels",value:function(){if(void 0!==this.core.options.levelSelectorConfig){var t=this.core.options.levelSelectorConfig.labelCallback;if(t&&"function"!=typeof t)throw new TypeError("labelCallback must be a function");var e,r,n=this.core.options.levelSelectorConfig.labels,i=n?this.core.options.levelSelectorConfig.labels:{};if(t||n)for(var s in this.audioLevels)r=i[(e=this.audioLevels[s]).id],t?e.label=t(e,r):r&&(e.label=r)}}},{key:"findLevelBy",value:function(t){var e;return this.audioLevels.forEach((function(r){r.id===t&&(e=r)})),e}},{key:"onLevelSelect",value:function(t){return this.selectedLevelId=parseInt(t.target.dataset.audiotrackselectorSelect,10),this.core.getCurrentPlayback()._hls.audioTrackController.trackId===this.selectedLevelId||(this.core.getCurrentPlayback()._hls.audioTrack=this.selectedLevelId,this.updateCurrentLevel(),this.highlightCurrentLevel(),this.toggleContextMenu(),t.stopPropagation()),!1}},{key:"onShowLevelSelectMenu",value:function(){this.toggleContextMenu()}},{key:"hideSelectLevelMenu",value:function(){this.$(".audioTrackSelector ul").hide()}},{key:"toggleContextMenu",value:function(){this.$(".audioTrackSelector ul").toggle()}},{key:"buttonElement",value:function(){return this.$(".audioTrackSelector button")}},{key:"levelElement",value:function(t){return this.$(".audioTrackSelector ul a".concat(isNaN(t)?"":'[data-audioTrackSelector-select="'.concat(t,'"]'))).parent()}},{key:"getTitle",value:function(){return(this.core.options.levelSelectorConfig||{}).title}},{key:"startLevelSwitch",value:function(){this.buttonElement().addClass("changing")}},{key:"stopLevelSwitch",value:function(){this.buttonElement().removeClass("changing")}},{key:"updateText",value:function(){var t=this.findLevelBy(this.core.getCurrentPlayback()._hls.audioTrackController.trackId).lang||"audio track ".concat(this.findLevelBy(this.core.getCurrentPlayback()._hls.audioTrackController.trackId).id+1);this.buttonElement().text(t)}},{key:"updateCurrentLevel",value:function(){var t=this.findLevelBy(this.core.getCurrentPlayback()._hls.audioTrackController.trackId);this.currentAudioLevel=t||null,this.highlightCurrentLevel()}},{key:"highlightCurrentLevel",value:function(){this.levelElement().removeClass("current"),this.currentAudioLevel&&this.levelElement(this.currentAudioLevel.id).addClass("current"),this.updateText()}}],[{key:"version",get:function(){return"24.6.1"}}])}(f.UICorePlugin)}).call(this,r(76))},function(t,e){t.exports='<button data-audioTrackSelector-button>\n Auto\n</button>\n<ul>\n <% if (title) { %>\n <li data-title><%= title %></li>\n <% }; %>\n <% for (var i = 0; i < audioLevels.length; i++) { %>\n <li><a href="#" data-audioTrackSelector-select="<%= audioLevels[i].id %>"><%= audioLevels[i].lang ? audioLevels[i].lang : \'audio track \' + (audioLevels[i].id + 1) %></a></li>\n <% }; %>\n</ul>\n'},function(t,e,r){var n=r(407);"string"==typeof n&&(n=[[t.i,n,""]]);var i={hmr:!0,transform:undefined,insertInto:void 0};r(161)(n,i);n.locals&&(t.exports=n.locals)},,,,,,,function(t,e,r){"use strict";r.r(e),function(t){var n=r(5),i=r.n(n),s=r(6),a=r.n(s),o=r(7),l=r.n(o),c=r(3),u=r.n(c),h=r(8),d=r.n(h),f=r(17),p=r.n(f),g=(r(209),r(358),r(359),r(360),r(1)),m=r(408),y=r(22),v=r(95),E=r(163),b=r(166),T=r(169),S=r(172),A=r(174),_=r(177),k=r(178),L=r(179),w=r(180),R=r(123),C=r(181),D=r(183),I=r(26),x=r(185),P=r(188),O=r(189),M=r(190),F=r(193),B=r(194),N=r(195),U=r(196);function $(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return($=function(){return!!t})()}function j(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function G(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?j(Object(r),!0).forEach((function(e){p()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var K=function(e){function r(e){var n;i()(this,r);var s=new E.a(e),a=s.get("debug"),o=s.get("panzoom"),c=s.get("equalizer"),h=s.get("tracks"),d=s.get("dontShowError"),f=s.get("hideMediaControl"),p=s.get("disableVideoTagContextMenu"),I=s.get("loop"),j=function(t){var e={};e.mediaInfo=t.getMediaInfo(),e.source=t.constructSource(R.a.isSupported(),!1)();var r=t.get("autoplay");return e.autoPlay||(e.autoPlay=!1!==r),e.authToken=t.get("authToken"),e.logo=t.get("logo"),e.poster=t.get("poster"),e.playback||(e.playback={hlsUseNextLevel:!1,playInline:!0,recycleVideo:g.Browser.isMobile,crossOrigin:"anonymous"}),e.playback.hlsjsConfig||(e.playback.hlsjsConfig={debug:t.get("debug"),lowLatencyMode:!0,latency:.25,maxLatency:.5,liveSyncPosition:.25,backBufferLength:90,autoStartLoad:!0,subtitleDisplay:!0,enableWebVTT:!0}),!1!==e.autorestart&&(e.events||(e.events={})),"statsSendEnable"in e||(e.statsSendEnable=!0),e}(s),K=!0,H=s.get("calmError");H&&(K=H);var V,W,Y,q=s.get("play_duration"),z=G(G(G(G(G(G(G(G(G(G(G(G(G({},{onMediaInfo:function(){}}),e),j),a),o),c),h),f),p),I),K),d),{},{playbackDuration:q});return z=function(e,r){var n=r.get("isVideoPoster"),i=G({},e);i.plugins||(i.plugins=[]),i.plugins.push(w.a),i.logo&&i.plugins.push(A.a),n||("mse"===i.proto||"ws:"===i.protocol||"wss:"===i.protocol)&&i.autoPlay?i.plugins.push(T.a):i.plugins.push(S.a),i.plugins.push(R.a),(i.from||i.to||i.ago)&&i.plugins.push(D.a),i.plugins.push(b.a),i.plugins.push(x.a),i.plugins.push(U.a),i.plugins.push(O.a),i.plugins.push(M.a),i.plugins.push(B.a),i.panzoom&&i.plugins.push(C.a),i.debug&&(i.plugins.push(g.Log),g.Log.setLevel(0)),i.errorPlugin&&i.errorPlugin.hide(),0===i.volume||i.autoPlay||r.get("mute")?i.mute=!0:(i.volume||(i.volume=100),i.plugins.push(_.a)),i.plugins.push(k.a),i.eventLog&&i.plugins.push(L.a),i.equalizer&&i.plugins.push(P.a),i.plugins.push(v.a);var s={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0}};return v.a.isCodecType=function(t,e){var r=s[e];return!!r&&!0===r[t.slice(0,4)]},i.plugins.push(v.a),i.plugins.push(F.a),i.plugins.push(N.a),i.sentryConfig&&i.sentryConfig.length&&(m.a({dsn:i.sentryConfig,environment:"production",release:"LivePlayer".concat(t.env.npm_package_version?"@".concat(t.env.npm_package_version):"")}),i.events.onError=function(t){y.a(t)}),i}(z,s),s.get("debug")&&console.info("options",z),z.version=r.version||"",z.statsCallback=function(t){n.playerStatistics=t},V=this,W=r,Y=[z],W=u()(W),n=l()(V,$()?Reflect.construct(W,Y||[],u()(V).constructor):W.apply(V,Y))}return d()(r,e),a()(r,[{key:"name",get:function(){return"LivePlayer"}},{key:"getStats",value:function(){return this.playerStatistics}}],[{key:"parseUrl",value:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return I.j(t,r)}},{key:"version",get:function(){return"24.6.1"}}])}(g.Player);K.FlasHLS=g.FlasHLS,K.ClapprPlayer=g.Player,e.default=K}.call(this,r(76))},function(t,e,r){var n=r(61).default;t.exports=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(e,n){return t.exports=r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},t.exports.__esModule=!0,t.exports.default=t.exports,r(e,n)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(t,e,r){"use strict";(function(t){var e="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==t&&t||{},r="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(t){return!1}}(),s="FormData"in e,a="ArrayBuffer"in e;if(a)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(t){return t&&o.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function u(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function d(t){this.map={},t instanceof d?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(!t._noBody)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function g(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||l(t))?this._bodyArrayBuffer=m(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=f(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(i)return this.blob().then(g);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,e,r,n,i,s=f(this);if(s)return s;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=p(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),i=n?n[1]:"utf-8",e.readAsText(t,i),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(t,e){t=c(t),e=u(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},d.prototype.delete=function(t){delete this.map[c(t)]},d.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},d.prototype.set=function(t,e){this.map[c(t)]=u(e)},d.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},d.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),h(t)},d.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),h(t)},d.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),h(t)},n&&(d.prototype[Symbol.iterator]=d.prototype.entries);var v=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function E(t,r){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n,i,s=(r=r||{}).body;if(t instanceof E){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,r.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,s||null==t._bodyInit||(s=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=r.credentials||this.credentials||"same-origin",!r.headers&&this.headers||(this.headers=new d(r.headers)),this.method=(n=r.method||this.method||"GET",i=n.toUpperCase(),v.indexOf(i)>-1?i:n),this.mode=r.mode||this.mode||null,this.signal=r.signal||this.signal||function(){if("AbortController"in e)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(s),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==r.cache&&"no-cache"!==r.cache)){var a=/([?&])_=[^&]*/;if(a.test(this.url))this.url=this.url.replace(a,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function b(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function T(t,e){if(!(this instanceof T))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}E.prototype.clone=function(){return new E(this,{body:this._bodyInit})},y.call(E.prototype),y.call(T.prototype),T.prototype.clone=function(){return new T(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},T.error=function(){var t=new T(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var S=[301,302,303,307,308];T.redirect=function(t,e){if(-1===S.indexOf(e))throw new RangeError("Invalid status code");return new T(null,{status:e,headers:{location:t}})};var A=e.DOMException;try{new A}catch(t){(A=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack}).prototype=Object.create(Error.prototype),A.prototype.constructor=A}function _(t,r){return new Promise((function(n,s){var o=new E(t,r);if(o.signal&&o.signal.aborted)return s(new A("Aborted","AbortError"));var l=new XMLHttpRequest;function h(){l.abort()}if(l.onload=function(){var t,e,r={statusText:l.statusText,headers:(t=l.getAllResponseHeaders()||"",e=new d,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();try{e.append(n,i)}catch(t){console.warn("Response "+t.message)}}})),e)};0===o.url.indexOf("file://")&&(l.status<200||l.status>599)?r.status=200:r.status=l.status,r.url="responseURL"in l?l.responseURL:r.headers.get("X-Request-URL");var i="response"in l?l.response:l.responseText;setTimeout((function(){n(new T(i,r))}),0)},l.onerror=function(){setTimeout((function(){s(new TypeError("Network request failed"))}),0)},l.ontimeout=function(){setTimeout((function(){s(new TypeError("Network request timed out"))}),0)},l.onabort=function(){setTimeout((function(){s(new A("Aborted","AbortError"))}),0)},l.open(o.method,function(t){try{return""===t&&e.location.href?e.location.href:t}catch(e){return t}}(o.url),!0),"include"===o.credentials?l.withCredentials=!0:"omit"===o.credentials&&(l.withCredentials=!1),"responseType"in l&&(i?l.responseType="blob":a&&(l.responseType="arraybuffer")),r&&"object"==typeof r.headers&&!(r.headers instanceof d||e.Headers&&r.headers instanceof e.Headers)){var f=[];Object.getOwnPropertyNames(r.headers).forEach((function(t){f.push(c(t)),l.setRequestHeader(t,u(r.headers[t]))})),o.headers.forEach((function(t,e){-1===f.indexOf(e)&&l.setRequestHeader(e,t)}))}else o.headers.forEach((function(t,e){l.setRequestHeader(e,t)}));o.signal&&(o.signal.addEventListener("abort",h),l.onreadystatechange=function(){4===l.readyState&&o.signal.removeEventListener("abort",h)}),l.send(void 0===o._bodyInit?null:o._bodyInit)}))}_.polyfill=!0,e.fetch||(e.fetch=_,e.Headers=d,e.Request=E,e.Response=T)}).call(this,r(31))},function(t,e,r){(function(t){!function(t){var e=function(){try{return!!Symbol.iterator}catch(t){return!1}}(),r=function(t){var r={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return e&&(r[Symbol.iterator]=function(){return r}),r},n=function(t){return encodeURIComponent(t).replace(/%20/g,"+")},i=function(t){return decodeURIComponent(String(t).replace(/\+/g," "))};(function(){try{var e=t.URLSearchParams;return"a=1"===new e("?a=1").toString()&&"function"==typeof e.prototype.set&&"function"==typeof e.prototype.entries}catch(t){return!1}})()||function(){var i=function(t){Object.defineProperty(this,"_entries",{writable:!0,value:{}});var e=typeof t;if("undefined"===e);else if("string"===e)""!==t&&this._fromString(t);else if(t instanceof i){var r=this;t.forEach((function(t,e){r.append(e,t)}))}else{if(null===t||"object"!==e)throw new TypeError("Unsupported input's type for URLSearchParams");if("[object Array]"===Object.prototype.toString.call(t))for(var n=0;n<t.length;n++){var s=t[n];if("[object Array]"!==Object.prototype.toString.call(s)&&2===s.length)throw new TypeError("Expected [string, any] as entry at index "+n+" of URLSearchParams's input");this.append(s[0],s[1])}else for(var a in t)t.hasOwnProperty(a)&&this.append(a,t[a])}},s=i.prototype;s.append=function(t,e){t in this._entries?this._entries[t].push(String(e)):this._entries[t]=[String(e)]},s.delete=function(t){delete this._entries[t]},s.get=function(t){return t in this._entries?this._entries[t][0]:null},s.getAll=function(t){return t in this._entries?this._entries[t].slice(0):[]},s.has=function(t){return t in this._entries},s.set=function(t,e){this._entries[t]=[String(e)]},s.forEach=function(t,e){var r;for(var n in this._entries)if(this._entries.hasOwnProperty(n)){r=this._entries[n];for(var i=0;i<r.length;i++)t.call(e,r[i],n,this)}},s.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),r(t)},s.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),r(t)},s.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),r(t)},e&&(s[Symbol.iterator]=s.entries),s.toString=function(){var t=[];return this.forEach((function(e,r){t.push(n(r)+"="+n(e))})),t.join("&")},t.URLSearchParams=i}();var s=t.URLSearchParams.prototype;"function"!=typeof s.sort&&(s.sort=function(){var t=this,e=[];this.forEach((function(r,n){e.push([n,r]),t._entries||t.delete(n)})),e.sort((function(t,e){return t[0]<e[0]?-1:t[0]>e[0]?1:0})),t._entries&&(t._entries={});for(var r=0;r<e.length;r++)this.append(e[r][0],e[r][1])}),"function"!=typeof s._fromString&&Object.defineProperty(s,"_fromString",{enumerable:!1,configurable:!1,writable:!1,value:function(t){if(this._entries)this._entries={};else{var e=[];this.forEach((function(t,r){e.push(r)}));for(var r=0;r<e.length;r++)this.delete(e[r])}var n,s=(t=t.replace(/^\?/,"")).split("&");for(r=0;r<s.length;r++)n=s[r].split("="),this.append(i(n[0]),n.length>1?i(n[1]):"")}})}(void 0!==t?t:"undefined"!=typeof window?window:"undefined"!=typeof self?self:this),function(t){if(function(){try{var e=new t.URL("b","http://a");return e.pathname="c d","http://a/c%20d"===e.href&&e.searchParams}catch(t){return!1}}()||function(){var e=t.URL,r=function(e,r){"string"!=typeof e&&(e=String(e)),r&&"string"!=typeof r&&(r=String(r));var n,i=document;if(r&&(void 0===t.location||r!==t.location.href)){r=r.toLowerCase(),(n=(i=document.implementation.createHTMLDocument("")).createElement("base")).href=r,i.head.appendChild(n);try{if(0!==n.href.indexOf(r))throw new Error(n.href)}catch(t){throw new Error("URL unable to set base "+r+" due to "+t)}}var s=i.createElement("a");s.href=e,n&&(i.body.appendChild(s),s.href=s.href);var a=i.createElement("input");if(a.type="url",a.value=e,":"===s.protocol||!/:/.test(s.href)||!a.checkValidity()&&!r)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:s});var o=new t.URLSearchParams(this.search),l=!0,c=!0,u=this;["append","delete","set"].forEach((function(t){var e=o[t];o[t]=function(){e.apply(o,arguments),l&&(c=!1,u.search=o.toString(),c=!0)}})),Object.defineProperty(this,"searchParams",{value:o,enumerable:!0});var h=void 0;Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==h&&(h=this.search,c&&(l=!1,this.searchParams._fromString(this.search),l=!0))}})},n=r.prototype;["hash","host","hostname","port","protocol"].forEach((function(t){!function(t){Object.defineProperty(n,t,{get:function(){return this._anchorElement[t]},set:function(e){this._anchorElement[t]=e},enumerable:!0})}(t)})),Object.defineProperty(n,"search",{get:function(){return this._anchorElement.search},set:function(t){this._anchorElement.search=t,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(n,{toString:{get:function(){var t=this;return function(){return t.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,"")},set:function(t){this._anchorElement.href=t,this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function(t){this._anchorElement.pathname=t},enumerable:!0},origin:{get:function(){var t={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],e=this._anchorElement.port!=t&&""!==this._anchorElement.port;return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(e?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function(){return""},set:function(t){},enumerable:!0},username:{get:function(){return""},set:function(t){},enumerable:!0}}),r.createObjectURL=function(t){return e.createObjectURL.apply(e,arguments)},r.revokeObjectURL=function(t){return e.revokeObjectURL.apply(e,arguments)},t.URL=r}(),void 0!==t.location&&!("origin"in t.location)){var e=function(){return t.location.protocol+"//"+t.location.hostname+(t.location.port?":"+t.location.port:"")};try{Object.defineProperty(t.location,"origin",{get:e,enumerable:!0})}catch(r){setInterval((function(){t.location.origin=e()}),100)}}}(void 0!==t?t:"undefined"!=typeof window?window:"undefined"!=typeof self?self:this)}).call(this,r(31))},function(t,e,r){},function(t,e,r){var n=r(154);t.exports=function(t){if(Array.isArray(t))return n(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(3);t.exports=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=n(t)););return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(61).default;function i(){"use strict";t.exports=i=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var e,r={},s=Object.prototype,a=s.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},l="function"==typeof Symbol?Symbol:{},c=l.iterator||"@@iterator",u=l.asyncIterator||"@@asyncIterator",h=l.toStringTag||"@@toStringTag";function d(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{d({},"")}catch(e){d=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,s=Object.create(i.prototype),a=new P(n||[]);return o(s,"_invoke",{value:C(t,r,a)}),s}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=f;var g="suspendedStart",m="suspendedYield",y="executing",v="completed",E={};function b(){}function T(){}function S(){}var A={};d(A,c,(function(){return this}));var _=Object.getPrototypeOf,k=_&&_(_(O([])));k&&k!==s&&a.call(k,c)&&(A=k);var L=S.prototype=b.prototype=Object.create(A);function w(t){["next","throw","return"].forEach((function(e){d(t,e,(function(t){return this._invoke(e,t)}))}))}function R(t,e){function r(i,s,o,l){var c=p(t[i],t,s);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==n(h)&&a.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,o,l)}),(function(t){r("throw",t,o,l)})):e.resolve(h).then((function(t){u.value=t,o(u)}),(function(t){return r("throw",t,o,l)}))}l(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function s(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(s,s):s()}})}function C(t,r,n){var i=g;return function(s,a){if(i===y)throw Error("Generator is already running");if(i===v){if("throw"===s)throw a;return{value:e,done:!0}}for(n.method=s,n.arg=a;;){var o=n.delegate;if(o){var l=D(o,n);if(l){if(l===E)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===g)throw i=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=y;var c=p(t,r,n);if("normal"===c.type){if(i=n.done?v:m,c.arg===E)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=v,n.method="throw",n.arg=c.arg)}}}function D(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,D(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),E;var s=p(i,t.iterator,r.arg);if("throw"===s.type)return r.method="throw",r.arg=s.arg,r.delegate=null,E;var a=s.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,E):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,E)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function O(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,s=function r(){for(;++i<t.length;)if(a.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return s.next=s}}throw new TypeError(n(t)+" is not iterable")}return T.prototype=S,o(L,"constructor",{value:S,configurable:!0}),o(S,"constructor",{value:T,configurable:!0}),T.displayName=d(S,h,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===T||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,S):(t.__proto__=S,d(t,h,"GeneratorFunction")),t.prototype=Object.create(L),t},r.awrap=function(t){return{__await:t}},w(R.prototype),d(R.prototype,u,(function(){return this})),r.AsyncIterator=R,r.async=function(t,e,n,i,s){void 0===s&&(s=Promise);var a=new R(f(t,e,n,i),s);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(L),d(L,h,"Generator"),d(L,c,(function(){return this})),d(L,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=O,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(x),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,i){return o.type="throw",o.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],o=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var l=a.call(s,"catchLoc"),c=a.call(s,"finallyLoc");if(l&&c){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(l){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,E):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),E},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),E}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:O(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),E}},r}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){c=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){"use strict";var n=r(370);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,o=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,l=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(l),u=["%","/","?",";","#"].concat(c),h=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,p={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=r(371);function v(t,e,r){if(t&&"object"==typeof t&&t instanceof i)return t;var n=new i;return n.parse(t,e,r),n}i.prototype.parse=function(t,e,r){if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),a=-1!==i&&i<t.indexOf("#")?"?":"#",l=t.split(a);l[0]=l[0].replace(/\\/g,"/");var v=t=l.join(a);if(v=v.trim(),!r&&1===t.split("#").length){var E=o.exec(v);if(E)return this.path=v,this.href=v,this.pathname=E[1],E[2]?(this.search=E[2],this.query=e?y.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var b=s.exec(v);if(b){var T=(b=b[0]).toLowerCase();this.protocol=T,v=v.substr(b.length)}if(r||b||v.match(/^\/\/[^@/]+@[^@/]+/)){var S="//"===v.substr(0,2);!S||b&&g[b]||(v=v.substr(2),this.slashes=!0)}if(!g[b]&&(S||b&&!m[b])){for(var A,_,k=-1,L=0;L<h.length;L++){-1!==(w=v.indexOf(h[L]))&&(-1===k||w<k)&&(k=w)}-1!==(_=-1===k?v.lastIndexOf("@"):v.lastIndexOf("@",k))&&(A=v.slice(0,_),v=v.slice(_+1),this.auth=decodeURIComponent(A)),k=-1;for(L=0;L<u.length;L++){var w;-1!==(w=v.indexOf(u[L]))&&(-1===k||w<k)&&(k=w)}-1===k&&(k=v.length),this.host=v.slice(0,k),v=v.slice(k),this.parseHost(),this.hostname=this.hostname||"";var R="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!R)for(var C=this.hostname.split(/\./),D=(L=0,C.length);L<D;L++){var I=C[L];if(I&&!I.match(d)){for(var x="",P=0,O=I.length;P<O;P++)I.charCodeAt(P)>127?x+="x":x+=I[P];if(!x.match(d)){var M=C.slice(0,L),F=C.slice(L+1),B=I.match(f);B&&(M.push(B[1]),F.unshift(B[2])),F.length&&(v="/"+F.join(".")+v),this.hostname=M.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),R||(this.hostname=n.toASCII(this.hostname));var N=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+N,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==v[0]&&(v="/"+v))}if(!p[T])for(L=0,D=c.length;L<D;L++){var $=c[L];if(-1!==v.indexOf($)){var j=encodeURIComponent($);j===$&&(j=escape($)),v=v.split($).join(j)}}var G=v.indexOf("#");-1!==G&&(this.hash=v.substr(G),v=v.slice(0,G));var K=v.indexOf("?");if(-1!==K?(this.search=v.substr(K),this.query=v.substr(K+1),e&&(this.query=y.parse(this.query)),v=v.slice(0,K)):e&&(this.search="",this.query={}),v&&(this.pathname=v),m[T]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){N=this.pathname||"";var H=this.search||"";this.path=N+H}return this.href=this.format(),this},i.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",i=!1,s="";this.host?i=t+this.host:this.hostname&&(i=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&"object"==typeof this.query&&Object.keys(this.query).length&&(s=y.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var a=this.search||s&&"?"+s||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||m[e])&&!1!==i?(i="//"+(i||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):i||(i=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),e+i+(r=r.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(a=a.replace("#","%23"))+n},i.prototype.resolve=function(t){return this.resolveObject(v(t,!1,!0)).format()},i.prototype.resolveObject=function(t){if("string"==typeof t){var e=new i;e.parse(t,!1,!0),t=e}for(var r=new i,n=Object.keys(this),s=0;s<n.length;s++){var a=n[s];r[a]=this[a]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var o=Object.keys(t),l=0;l<o.length;l++){var c=o[l];"protocol"!==c&&(r[c]=t[c])}return m[r.protocol]&&r.hostname&&!r.pathname&&(r.pathname="/",r.path=r.pathname),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!m[t.protocol]){for(var u=Object.keys(t),h=0;h<u.length;h++){var d=u[h];r[d]=t[d]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||g[t.protocol])r.pathname=t.pathname;else{for(var f=(t.pathname||"").split("/");f.length&&!(t.host=f.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==f[0]&&f.unshift(""),f.length<2&&f.unshift(""),r.pathname=f.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var p=r.pathname||"",y=r.search||"";r.path=p+y}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var v=r.pathname&&"/"===r.pathname.charAt(0),E=t.host||t.pathname&&"/"===t.pathname.charAt(0),b=E||v||r.host&&t.pathname,T=b,S=r.pathname&&r.pathname.split("/")||[],A=(f=t.pathname&&t.pathname.split("/")||[],r.protocol&&!m[r.protocol]);if(A&&(r.hostname="",r.port=null,r.host&&(""===S[0]?S[0]=r.host:S.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===f[0]?f[0]=t.host:f.unshift(t.host)),t.host=null),b=b&&(""===f[0]||""===S[0])),E)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,S=f;else if(f.length)S||(S=[]),S.pop(),S=S.concat(f),r.search=t.search,r.query=t.query;else if(null!=t.search){if(A)r.host=S.shift(),r.hostname=r.host,(R=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=R.shift(),r.hostname=R.shift(),r.host=r.hostname);return r.search=t.search,r.query=t.query,null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var _=S.slice(-1)[0],k=(r.host||t.host||S.length>1)&&("."===_||".."===_)||""===_,L=0,w=S.length;w>=0;w--)"."===(_=S[w])?S.splice(w,1):".."===_?(S.splice(w,1),L++):L&&(S.splice(w,1),L--);if(!b&&!T)for(;L--;L)S.unshift("..");!b||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),k&&"/"!==S.join("/").substr(-1)&&S.push("");var R,C=""===S[0]||S[0]&&"/"===S[0].charAt(0);A&&(r.hostname=C?"":S.length?S.shift():"",r.host=r.hostname,(R=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=R.shift(),r.hostname=R.shift(),r.host=r.hostname));return(b=b||r.host&&S.length)&&!C&&S.unshift(""),S.length>0?r.pathname=S.join("/"):(r.pathname=null,r.path=null),null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},i.prototype.parseHost=function(){var t=this.host,e=a.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)},e.parse=v,e.resolve=function(t,e){return v(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?v(t,!1,!0).resolveObject(e):e},e.format=function(t){return"string"==typeof t&&(t=v(t)),t instanceof i?t.format():i.prototype.format.call(t)},e.Url=i},function(t,e,r){(function(t,n){var i;!function(){e&&e.nodeType,t&&t.nodeType;var s="object"==typeof n&&n;s.global!==s&&s.window!==s&&s.self;var a,o=2147483647,l=36,c=/^xn--/,u=/[^\x20-\x7E]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,p=String.fromCharCode;function g(t){throw new RangeError(d[t])}function m(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function y(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+m((t=t.replace(h,".")).split("."),e).join(".")}function v(t){for(var e,r,n=[],i=0,s=t.length;i<s;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<s?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function E(t){return m(t,(function(t){var e="";return t>65535&&(e+=p((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=p(t)})).join("")}function b(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function T(t,e,r){var n=0;for(t=r?f(t/700):t>>1,t+=f(t/e);t>455;n+=l)t=f(t/35);return f(n+36*t/(t+38))}function S(t){var e,r,n,i,s,a,c,u,h,d,p,m=[],y=t.length,v=0,b=128,S=72;for((r=t.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&g("not-basic"),m.push(t.charCodeAt(n));for(i=r>0?r+1:0;i<y;){for(s=v,a=1,c=l;i>=y&&g("invalid-input"),((u=(p=t.charCodeAt(i++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:l)>=l||u>f((o-v)/a))&&g("overflow"),v+=u*a,!(u<(h=c<=S?1:c>=S+26?26:c-S));c+=l)a>f(o/(d=l-h))&&g("overflow"),a*=d;S=T(v-s,e=m.length+1,0==s),f(v/e)>o-b&&g("overflow"),b+=f(v/e),v%=e,m.splice(v++,0,b)}return E(m)}function A(t){var e,r,n,i,s,a,c,u,h,d,m,y,E,S,A,_=[];for(y=(t=v(t)).length,e=128,r=0,s=72,a=0;a<y;++a)(m=t[a])<128&&_.push(p(m));for(n=i=_.length,i&&_.push("-");n<y;){for(c=o,a=0;a<y;++a)(m=t[a])>=e&&m<c&&(c=m);for(c-e>f((o-r)/(E=n+1))&&g("overflow"),r+=(c-e)*E,e=c,a=0;a<y;++a)if((m=t[a])<e&&++r>o&&g("overflow"),m==e){for(u=r,h=l;!(u<(d=h<=s?1:h>=s+26?26:h-s));h+=l)A=u-d,S=l-d,_.push(p(b(d+A%S,0))),u=f(A/S);_.push(p(b(u,0))),s=T(r,E,n==i),r=0,++n}++r,++e}return _.join("")}a={version:"1.4.1",ucs2:{decode:v,encode:E},decode:S,encode:A,toASCII:function(t){return y(t,(function(t){return u.test(t)?"xn--"+A(t):t}))},toUnicode:function(t){return y(t,(function(t){return c.test(t)?S(t.slice(4).toLowerCase()):t}))}},void 0===(i=function(){return a}.call(e,r,e,t))||(t.exports=i)}()}).call(this,r(156)(t),r(31))},function(t,e,r){"use strict";var n=r(372),i=r(391),s=r(120);t.exports={formats:s,parse:i,stringify:n}},function(t,e,r){"use strict";var n=r(373),i=r(159),s=r(120),a=Object.prototype.hasOwnProperty,o={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},l=Array.isArray,c=Array.prototype.push,u=function(t,e){c.apply(t,l(e)?e:[e])},h=Date.prototype.toISOString,d=s.default,f={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:i.encode,encodeValuesOnly:!1,filter:void 0,format:d,formatter:s.formatters[d],indices:!1,serializeDate:function(t){return h.call(t)},skipNulls:!1,strictNullHandling:!1},p={},g=function t(e,r,s,a,o,c,h,d,g,m,y,v,E,b,T,S,A,_){for(var k,L=e,w=_,R=0,C=!1;void 0!==(w=w.get(p))&&!C;){var D=w.get(e);if(R+=1,void 0!==D){if(D===R)throw new RangeError("Cyclic object value");C=!0}void 0===w.get(p)&&(R=0)}if("function"==typeof m?L=m(r,L):L instanceof Date?L=E(L):"comma"===s&&l(L)&&(L=i.maybeMap(L,(function(t){return t instanceof Date?E(t):t}))),null===L){if(c)return g&&!S?g(r,f.encoder,A,"key",b):r;L=""}if("string"==typeof(k=L)||"number"==typeof k||"boolean"==typeof k||"symbol"==typeof k||"bigint"==typeof k||i.isBuffer(L))return g?[T(S?r:g(r,f.encoder,A,"key",b))+"="+T(g(L,f.encoder,A,"value",b))]:[T(r)+"="+T(String(L))];var I,x=[];if(void 0===L)return x;if("comma"===s&&l(L))S&&g&&(L=i.maybeMap(L,g)),I=[{value:L.length>0?L.join(",")||null:void 0}];else if(l(m))I=m;else{var P=Object.keys(L);I=y?P.sort(y):P}var O=d?String(r).replace(/\./g,"%2E"):String(r),M=a&&l(L)&&1===L.length?O+"[]":O;if(o&&l(L)&&0===L.length)return M+"[]";for(var F=0;F<I.length;++F){var B=I[F],N="object"==typeof B&&B&&void 0!==B.value?B.value:L[B];if(!h||null!==N){var U=v&&d?String(B).replace(/\./g,"%2E"):String(B),$=l(L)?"function"==typeof s?s(M,U):M:M+(v?"."+U:"["+U+"]");_.set(e,R);var j=n();j.set(p,_),u(x,t(N,$,s,a,o,c,h,d,"comma"===s&&S&&l(L)?null:g,m,y,v,E,b,T,S,A,j))}}return x};t.exports=function(t,e){var r,i=t,c=function(t){if(!t)return f;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.encodeDotInKeys&&"boolean"!=typeof t.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||f.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=s.default;if(void 0!==t.format){if(!a.call(s.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var n,i=s.formatters[r],c=f.filter;if(("function"==typeof t.filter||l(t.filter))&&(c=t.filter),n=t.arrayFormat in o?t.arrayFormat:"indices"in t?t.indices?"indices":"repeat":f.arrayFormat,"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var u=void 0===t.allowDots?!0===t.encodeDotInKeys||f.allowDots:!!t.allowDots;return{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:f.addQueryPrefix,allowDots:u,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:f.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:f.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:void 0===t.delimiter?f.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:f.encode,encodeDotInKeys:"boolean"==typeof t.encodeDotInKeys?t.encodeDotInKeys:f.encodeDotInKeys,encoder:"function"==typeof t.encoder?t.encoder:f.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:f.encodeValuesOnly,filter:c,format:r,formatter:i,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:f.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:f.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:f.strictNullHandling}}(e);"function"==typeof c.filter?i=(0,c.filter)("",i):l(c.filter)&&(r=c.filter);var h=[];if("object"!=typeof i||null===i)return"";var d=o[c.arrayFormat],p="comma"===d&&c.commaRoundTrip;r||(r=Object.keys(i)),c.sort&&r.sort(c.sort);for(var m=n(),y=0;y<r.length;++y){var v=r[y],E=i[v];c.skipNulls&&null===E||u(h,g(E,v,d,p,c.allowEmptyArrays,c.strictNullHandling,c.skipNulls,c.encodeDotInKeys,c.encode?c.encoder:null,c.filter,c.sort,c.allowDots,c.serializeDate,c.format,c.formatter,c.encodeValuesOnly,c.charset,m))}var b=h.join(c.delimiter),T=!0===c.addQueryPrefix?"?":"";return c.charsetSentinel&&("iso-8859-1"===c.charset?T+="utf8=%26%2310003%3B&":T+="utf8=%E2%9C%93&"),b.length>0?T+b:""}},function(t,e,r){"use strict";var n=r(60),i=r(384),s=r(389),a=r(70),o=n("%WeakMap%",!0),l=n("%Map%",!0),c=i("WeakMap.prototype.get",!0),u=i("WeakMap.prototype.set",!0),h=i("WeakMap.prototype.has",!0),d=i("Map.prototype.get",!0),f=i("Map.prototype.set",!0),p=i("Map.prototype.has",!0),g=function(t,e){for(var r,n=t;null!==(r=n.next);n=r)if(r.key===e)return n.next=r.next,r.next=t.next,t.next=r,r};t.exports=function(){var t,e,r,n={assert:function(t){if(!n.has(t))throw new a("Side channel does not contain "+s(t))},get:function(n){if(o&&n&&("object"==typeof n||"function"==typeof n)){if(t)return c(t,n)}else if(l){if(e)return d(e,n)}else if(r)return function(t,e){var r=g(t,e);return r&&r.value}(r,n)},has:function(n){if(o&&n&&("object"==typeof n||"function"==typeof n)){if(t)return h(t,n)}else if(l){if(e)return p(e,n)}else if(r)return function(t,e){return!!g(t,e)}(r,n);return!1},set:function(n,i){o&&n&&("object"==typeof n||"function"==typeof n)?(t||(t=new o),u(t,n,i)):l?(e||(e=new l),f(e,n,i)):(r||(r={key:{},next:null}),function(t,e,r){var n=g(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}}(r,n,i))}};return n}},function(t,e,r){"use strict";t.exports=Error},function(t,e,r){"use strict";t.exports=EvalError},function(t,e,r){"use strict";t.exports=RangeError},function(t,e,r){"use strict";t.exports=ReferenceError},function(t,e,r){"use strict";t.exports=URIError},function(t,e,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=r(380);t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},function(t,e,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(t,e);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},function(t,e,r){"use strict";var n={__proto__:null,foo:{}},i=Object;t.exports=function(){return{__proto__:n}.foo===n.foo&&!(n instanceof i)}},function(t,e,r){"use strict";var n=Object.prototype.toString,i=Math.max,s=function(t,e){for(var r=[],n=0;n<t.length;n+=1)r[n]=t[n];for(var i=0;i<e.length;i+=1)r[i+t.length]=e[i];return r};t.exports=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==n.apply(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r,a=function(t,e){for(var r=[],n=e||0,i=0;n<t.length;n+=1,i+=1)r[i]=t[n];return r}(arguments,1),o=i(0,e.length-a.length),l=[],c=0;c<o;c++)l[c]="$"+c;if(r=Function("binder","return function ("+function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r}(l,",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof r){var n=e.apply(this,s(a,arguments));return Object(n)===n?n:this}return e.apply(t,s(a,arguments))})),e.prototype){var u=function(){};u.prototype=e.prototype,r.prototype=new u,u.prototype=null}return r}},function(t,e,r){"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,s=r(118);t.exports=s.call(n,i)},function(t,e,r){"use strict";var n=r(60),i=r(385),s=i(n("String.prototype.indexOf"));t.exports=function(t,e){var r=n(t,!!e);return"function"==typeof r&&s(t,".prototype.")>-1?i(r):r}},function(t,e,r){"use strict";var n=r(118),i=r(60),s=r(386),a=r(70),o=i("%Function.prototype.apply%"),l=i("%Function.prototype.call%"),c=i("%Reflect.apply%",!0)||n.call(l,o),u=r(119),h=i("%Math.max%");t.exports=function(t){if("function"!=typeof t)throw new a("a function is required");var e=c(n,l,arguments);return s(e,1+h(0,t.length-(arguments.length-1)),!0)};var d=function(){return c(n,o,arguments)};u?u(t.exports,"apply",{value:d}):t.exports.apply=d},function(t,e,r){"use strict";var n=r(60),i=r(387),s=r(388)(),a=r(158),o=r(70),l=n("%Math.floor%");t.exports=function(t,e){if("function"!=typeof t)throw new o("`fn` is not a function");if("number"!=typeof e||e<0||e>4294967295||l(e)!==e)throw new o("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,c=!0;if("length"in t&&a){var u=a(t,"length");u&&!u.configurable&&(n=!1),u&&!u.writable&&(c=!1)}return(n||c||!r)&&(s?i(t,"length",e,!0,!0):i(t,"length",e)),t}},function(t,e,r){"use strict";var n=r(119),i=r(157),s=r(70),a=r(158);t.exports=function(t,e,r){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new s("`obj` must be an object or a function`");if("string"!=typeof e&&"symbol"!=typeof e)throw new s("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new s("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new s("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new s("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new s("`loose`, if provided, must be a boolean");var o=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,u=arguments.length>6&&arguments[6],h=!!a&&a(t,e);if(n)n(t,e,{configurable:null===c&&h?h.configurable:!c,enumerable:null===o&&h?h.enumerable:!o,value:r,writable:null===l&&h?h.writable:!l});else{if(!u&&(o||l||c))throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[e]=r}}},function(t,e,r){"use strict";var n=r(119),i=function(){return!!n};i.hasArrayLengthDefineBug=function(){if(!n)return null;try{return 1!==n([],"length",{value:1}).length}catch(t){return!0}},t.exports=i},function(t,e,r){(function(e){var n="function"==typeof Map&&Map.prototype,i=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,s=n&&i&&"function"==typeof i.get?i.get:null,a=n&&Map.prototype.forEach,o="function"==typeof Set&&Set.prototype,l=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=o&&l&&"function"==typeof l.get?l.get:null,u=o&&Set.prototype.forEach,h="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,d="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,f="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,p=Boolean.prototype.valueOf,g=Object.prototype.toString,m=Function.prototype.toString,y=String.prototype.match,v=String.prototype.slice,E=String.prototype.replace,b=String.prototype.toUpperCase,T=String.prototype.toLowerCase,S=RegExp.prototype.test,A=Array.prototype.concat,_=Array.prototype.join,k=Array.prototype.slice,L=Math.floor,w="function"==typeof BigInt?BigInt.prototype.valueOf:null,R=Object.getOwnPropertySymbols,C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,D="function"==typeof Symbol&&"object"==typeof Symbol.iterator,I="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===D||"symbol")?Symbol.toStringTag:null,x=Object.prototype.propertyIsEnumerable,P=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function O(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||S.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var n=t<0?-L(-t):L(t);if(n!==t){var i=String(n),s=v.call(e,i.length+1);return E.call(i,r,"$&_")+"."+E.call(E.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return E.call(e,r,"$&_")}var M=r(390),F=M.custom,B=H(F)?F:null,N={__proto__:null,double:'"',single:"'"},U={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function $(t,e,r){var n=r.quoteStyle||e,i=N[n];return i+t+i}function j(t){return E.call(String(t),/"/g,""")}function G(t){return!("[object Array]"!==Y(t)||I&&"object"==typeof t&&I in t)}function K(t){return!("[object RegExp]"!==Y(t)||I&&"object"==typeof t&&I in t)}function H(t){if(D)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!C)return!1;try{return C.call(t),!0}catch(t){}return!1}t.exports=function t(r,n,i,o){var l=n||{};if(W(l,"quoteStyle")&&!W(N,l.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(W(l,"maxStringLength")&&("number"==typeof l.maxStringLength?l.maxStringLength<0&&l.maxStringLength!==1/0:null!==l.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var g=!W(l,"customInspect")||l.customInspect;if("boolean"!=typeof g&&"symbol"!==g)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(W(l,"indent")&&null!==l.indent&&"\t"!==l.indent&&!(parseInt(l.indent,10)===l.indent&&l.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(W(l,"numericSeparator")&&"boolean"!=typeof l.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var b=l.numericSeparator;if(void 0===r)return"undefined";if(null===r)return"null";if("boolean"==typeof r)return r?"true":"false";if("string"==typeof r)return z(r,l);if("number"==typeof r){if(0===r)return 1/0/r>0?"0":"-0";var S=String(r);return b?O(r,S):S}if("bigint"==typeof r){var L=String(r)+"n";return b?O(r,L):L}var R=void 0===l.depth?5:l.depth;if(void 0===i&&(i=0),i>=R&&R>0&&"object"==typeof r)return G(r)?"[Array]":"[Object]";var F=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=_.call(Array(t.indent+1)," ")}return{base:r,prev:_.call(Array(e+1),r)}}(l,i);if(void 0===o)o=[];else if(q(o,r)>=0)return"[Circular]";function U(e,r,n){if(r&&(o=k.call(o)).push(r),n){var s={depth:l.depth};return W(l,"quoteStyle")&&(s.quoteStyle=l.quoteStyle),t(e,s,i+1,o)}return t(e,l,i+1,o)}if("function"==typeof r&&!K(r)){var V=function(t){if(t.name)return t.name;var e=y.call(m.call(t),/^function\s*([\w$]+)/);if(e)return e[1];return null}(r),X=et(r,U);return"[Function"+(V?": "+V:" (anonymous)")+"]"+(X.length>0?" { "+_.call(X,", ")+" }":"")}if(H(r)){var rt=D?E.call(String(r),/^(Symbol\(.*\))_[^)]*$/,"$1"):C.call(r);return"object"!=typeof r||D?rt:Q(rt)}if(function(t){if(!t||"object"!=typeof t)return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(r)){for(var nt="<"+T.call(String(r.nodeName)),it=r.attributes||[],st=0;st<it.length;st++)nt+=" "+it[st].name+"="+$(j(it[st].value),"double",l);return nt+=">",r.childNodes&&r.childNodes.length&&(nt+="..."),nt+="</"+T.call(String(r.nodeName))+">"}if(G(r)){if(0===r.length)return"[]";var at=et(r,U);return F&&!function(t){for(var e=0;e<t.length;e++)if(q(t[e],"\n")>=0)return!1;return!0}(at)?"["+tt(at,F)+"]":"[ "+_.call(at,", ")+" ]"}if(function(t){return!("[object Error]"!==Y(t)||I&&"object"==typeof t&&I in t)}(r)){var ot=et(r,U);return"cause"in Error.prototype||!("cause"in r)||x.call(r,"cause")?0===ot.length?"["+String(r)+"]":"{ ["+String(r)+"] "+_.call(ot,", ")+" }":"{ ["+String(r)+"] "+_.call(A.call("[cause]: "+U(r.cause),ot),", ")+" }"}if("object"==typeof r&&g){if(B&&"function"==typeof r[B]&&M)return M(r,{depth:R-i});if("symbol"!==g&&"function"==typeof r.inspect)return r.inspect()}if(function(t){if(!s||!t||"object"!=typeof t)return!1;try{s.call(t);try{c.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(r)){var lt=[];return a&&a.call(r,(function(t,e){lt.push(U(e,r,!0)+" => "+U(t,r))})),Z("Map",s.call(r),lt,F)}if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t);try{s.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(r)){var ct=[];return u&&u.call(r,(function(t){ct.push(U(t,r))})),Z("Set",c.call(r),ct,F)}if(function(t){if(!h||!t||"object"!=typeof t)return!1;try{h.call(t,h);try{d.call(t,d)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(r))return J("WeakMap");if(function(t){if(!d||!t||"object"!=typeof t)return!1;try{d.call(t,d);try{h.call(t,h)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(r))return J("WeakSet");if(function(t){if(!f||!t||"object"!=typeof t)return!1;try{return f.call(t),!0}catch(t){}return!1}(r))return J("WeakRef");if(function(t){return!("[object Number]"!==Y(t)||I&&"object"==typeof t&&I in t)}(r))return Q(U(Number(r)));if(function(t){if(!t||"object"!=typeof t||!w)return!1;try{return w.call(t),!0}catch(t){}return!1}(r))return Q(U(w.call(r)));if(function(t){return!("[object Boolean]"!==Y(t)||I&&"object"==typeof t&&I in t)}(r))return Q(p.call(r));if(function(t){return!("[object String]"!==Y(t)||I&&"object"==typeof t&&I in t)}(r))return Q(U(String(r)));if("undefined"!=typeof window&&r===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&r===globalThis||void 0!==e&&r===e)return"{ [object globalThis] }";if(!function(t){return!("[object Date]"!==Y(t)||I&&"object"==typeof t&&I in t)}(r)&&!K(r)){var ut=et(r,U),ht=P?P(r)===Object.prototype:r instanceof Object||r.constructor===Object,dt=r instanceof Object?"":"null prototype",ft=!ht&&I&&Object(r)===r&&I in r?v.call(Y(r),8,-1):dt?"Object":"",pt=(ht||"function"!=typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"")+(ft||dt?"["+_.call(A.call([],ft||[],dt||[]),": ")+"] ":"");return 0===ut.length?pt+"{}":F?pt+"{"+tt(ut,F)+"}":pt+"{ "+_.call(ut,", ")+" }"}return String(r)};var V=Object.prototype.hasOwnProperty||function(t){return t in this};function W(t,e){return V.call(t,e)}function Y(t){return g.call(t)}function q(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function z(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return z(v.call(t,0,e.maxStringLength),e)+n}var i=U[e.quoteStyle||"single"];return i.lastIndex=0,$(E.call(E.call(t,i,"\\$1"),/[\x00-\x1f]/g,X),"single",e)}function X(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+b.call(e.toString(16))}function Q(t){return"Object("+t+")"}function J(t){return t+" { ? }"}function Z(t,e,r,n){return t+" ("+e+") {"+(n?tt(r,n):_.call(r,", "))+"}"}function tt(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+_.call(t,","+r)+"\n"+e.prev}function et(t,e){var r=G(t),n=[];if(r){n.length=t.length;for(var i=0;i<t.length;i++)n[i]=W(t,i)?e(t[i],t):""}var s,a="function"==typeof R?R(t):[];if(D){s={};for(var o=0;o<a.length;o++)s["$"+a[o]]=a[o]}for(var l in t)W(t,l)&&(r&&String(Number(l))===l&&l<t.length||D&&s["$"+l]instanceof Symbol||(S.call(/[^\w$]/,l)?n.push(e(l,t)+": "+e(t[l],t)):n.push(l+": "+e(t[l],t))));if("function"==typeof R)for(var c=0;c<a.length;c++)x.call(t,a[c])&&n.push("["+e(a[c])+"]: "+e(t[a[c]],t));return n}}).call(this,r(31))},function(t,e){},function(t,e,r){"use strict";var n=r(159),i=Object.prototype.hasOwnProperty,s=Array.isArray,a={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:n.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},o=function(t){return t.replace(/&#(\d+);/g,(function(t,e){return String.fromCharCode(parseInt(e,10))}))},l=function(t,e){return t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1?t.split(","):t},c=function(t,e,r,n){if(t){var s=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/g,o=r.depth>0&&/(\[[^[\]]*])/.exec(s),c=o?s.slice(0,o.index):s,u=[];if(c){if(!r.plainObjects&&i.call(Object.prototype,c)&&!r.allowPrototypes)return;u.push(c)}for(var h=0;r.depth>0&&null!==(o=a.exec(s))&&h<r.depth;){if(h+=1,!r.plainObjects&&i.call(Object.prototype,o[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(o[1])}if(o){if(!0===r.strictDepth)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");u.push("["+s.slice(o.index)+"]")}return function(t,e,r,n){for(var i=n?e:l(e,r),s=t.length-1;s>=0;--s){var a,o=t[s];if("[]"===o&&r.parseArrays)a=r.allowEmptyArrays&&(""===i||r.strictNullHandling&&null===i)?[]:[].concat(i);else{a=r.plainObjects?{__proto__:null}:{};var c="["===o.charAt(0)&&"]"===o.charAt(o.length-1)?o.slice(1,-1):o,u=r.decodeDotInKeys?c.replace(/%2E/g,"."):c,h=parseInt(u,10);r.parseArrays||""!==u?!isNaN(h)&&o!==u&&String(h)===u&&h>=0&&r.parseArrays&&h<=r.arrayLimit?(a=[])[h]=i:"__proto__"!==u&&(a[u]=i):a={0:i}}i=a}return i}(u,e,r,n)}};t.exports=function(t,e){var r=function(t){if(!t)return a;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.decodeDotInKeys&&"boolean"!=typeof t.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?a.charset:t.charset,r=void 0===t.duplicates?a.duplicates:t.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===t.allowDots?!0===t.decodeDotInKeys||a.allowDots:!!t.allowDots,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:a.allowEmptyArrays,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:a.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:a.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:a.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:a.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:a.comma,decodeDotInKeys:"boolean"==typeof t.decodeDotInKeys?t.decodeDotInKeys:a.decodeDotInKeys,decoder:"function"==typeof t.decoder?t.decoder:a.decoder,delimiter:"string"==typeof t.delimiter||n.isRegExp(t.delimiter)?t.delimiter:a.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:a.depth,duplicates:r,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:a.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:a.plainObjects,strictDepth:"boolean"==typeof t.strictDepth?!!t.strictDepth:a.strictDepth,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:a.strictNullHandling}}(e);if(""===t||null==t)return r.plainObjects?{__proto__:null}:{};for(var u="string"==typeof t?function(t,e){var r={__proto__:null},c=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;c=c.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var u,h=e.parameterLimit===1/0?void 0:e.parameterLimit,d=c.split(e.delimiter,h),f=-1,p=e.charset;if(e.charsetSentinel)for(u=0;u<d.length;++u)0===d[u].indexOf("utf8=")&&("utf8=%E2%9C%93"===d[u]?p="utf-8":"utf8=%26%2310003%3B"===d[u]&&(p="iso-8859-1"),f=u,u=d.length);for(u=0;u<d.length;++u)if(u!==f){var g,m,y=d[u],v=y.indexOf("]="),E=-1===v?y.indexOf("="):v+1;-1===E?(g=e.decoder(y,a.decoder,p,"key"),m=e.strictNullHandling?null:""):(g=e.decoder(y.slice(0,E),a.decoder,p,"key"),m=n.maybeMap(l(y.slice(E+1),e),(function(t){return e.decoder(t,a.decoder,p,"value")}))),m&&e.interpretNumericEntities&&"iso-8859-1"===p&&(m=o(String(m))),y.indexOf("[]=")>-1&&(m=s(m)?[m]:m);var b=i.call(r,g);b&&"combine"===e.duplicates?r[g]=n.combine(r[g],m):b&&"last"!==e.duplicates||(r[g]=m)}return r}(t,r):t,h=r.plainObjects?{__proto__:null}:{},d=Object.keys(u),f=0;f<d.length;++f){var p=d[f],g=c(p,u[p],r,"string"==typeof t);h=n.merge(h,g,r)}return!0===r.allowSparse?h:n.compact(h)}},function(t,e,r){(t.exports=r(160)(!1)).push([t.i,'.level_selector[data-level-selector]{float:right;position:relative;height:100%}.level_selector[data-level-selector] button{background-color:transparent;color:#fff;font-family:Roboto,"Open Sans",Arial,sans-serif;-webkit-font-smoothing:antialiased;border:none;font-size:12px;height:100%}.level_selector[data-level-selector] button:hover{color:#c9c9c9}.level_selector[data-level-selector] button.changing{-webkit-animation:pulse .5s infinite alternate}.level_selector[data-level-selector]>ul{overflow-x:hidden;overflow-y:auto;list-style-type:none;position:absolute;bottom:100%;display:none;background-color:rgba(28,28,28,.9);white-space:nowrap}.level_selector[data-level-selector] li{font-size:12px;color:#eee}.level_selector[data-level-selector] li[data-title]{background-color:#333;padding:8px 25px}.level_selector[data-level-selector] li a{color:#eee;padding:5px 18px;display:block;text-decoration:none}.level_selector[data-level-selector] li a:hover{background-color:rgba(255,255,255,.1);color:#fff}.level_selector[data-level-selector] li a:hover a{color:#fff;text-decoration:none}.level_selector[data-level-selector] li.current a{color:#2ecc71}@-webkit-keyframes pulse{0%{color:#fff}50%{color:#ff0101}100%{color:#b80000}}',""])},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var r=e.protocol+"//"+e.host,n=r+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var i,s=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(s)?t:(i=0===s.indexOf("//")?s:0===s.indexOf("/")?r+s:n+s.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")}))}},function(t,e){t.exports=function(t){throw new TypeError('"'+t+'" is read-only')},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(t,e,r){t.addEventListener("wheel",e,r)}t.exports=r,t.exports.addWheelListener=r,t.exports.removeWheelListener=function(t,e,r){t.removeEventListener("wheel",e,r)}},function(t,e,r){var n=r(397),i={ease:n(.25,.1,.25,1),easeIn:n(.42,0,1,1),easeOut:n(0,0,.58,1),easeInOut:n(.42,0,.58,1),linear:n(0,0,1,1)};function s(){}function a(){var t=new Set,e=new Set,r=0;return{next:n,cancel:n,clearAll:function(){t.clear(),e.clear(),cancelAnimationFrame(r),r=0}};function n(t){e.add(t),r||(r=requestAnimationFrame(i))}function i(){r=0;var n=e;e=t,(t=n).forEach((function(t){t()})),t.clear()}}t.exports=function(t,e,r){var n=Object.create(null),a=Object.create(null),o="function"==typeof(r=r||{}).easing?r.easing:i[r.easing];o||(r.easing&&console.warn("Unknown easing function in amator: "+r.easing),o=i.ease);var l="function"==typeof r.step?r.step:s,c="function"==typeof r.done?r.done:s,u=function(t){if(!t){return"undefined"!=typeof window&&window.requestAnimationFrame?{next:window.requestAnimationFrame.bind(window),cancel:window.cancelAnimationFrame.bind(window)}:{next:function(t){return setTimeout(t,1e3/60)},cancel:function(t){return clearTimeout(t)}}}if("function"!=typeof t.next)throw new Error("Scheduler is supposed to have next(cb) function");if("function"!=typeof t.cancel)throw new Error("Scheduler is supposed to have cancel(handle) function");return t}(r.scheduler),h=Object.keys(e);h.forEach((function(r){n[r]=t[r],a[r]=e[r]-t[r]}));var d,f="number"==typeof r.duration?r.duration:400,p=Math.max(1,.06*f),g=0;return d=u.next((function e(){var r=o(g/p);g+=1,m(r),g<=p?(d=u.next(e),l(t)):(d=0,setTimeout((function(){c(t)}),0))})),{cancel:function(){u.cancel(d),d=0}};function m(e){h.forEach((function(r){t[r]=a[r]*e+n[r]}))}},t.exports.makeAggregateRaf=a,t.exports.sharedScheduler=a()},function(t,e){var r=.1,n="function"==typeof Float32Array;function i(t,e){return 1-3*e+3*t}function s(t,e){return 3*e-6*t}function a(t){return 3*t}function o(t,e,r){return((i(e,r)*t+s(e,r))*t+a(e))*t}function l(t,e,r){return 3*i(e,r)*t*t+2*s(e,r)*t+a(e)}function c(t){return t}t.exports=function(t,e,i,s){if(!(0<=t&&t<=1&&0<=i&&i<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&i===s)return c;for(var a=n?new Float32Array(11):new Array(11),u=0;u<11;++u)a[u]=o(u*r,t,i);function h(e){for(var n=0,s=1;10!==s&&a[s]<=e;++s)n+=r;--s;var c=n+(e-a[s])/(a[s+1]-a[s])*r,u=l(c,t,i);return u>=.001?function(t,e,r,n){for(var i=0;i<4;++i){var s=l(e,r,n);if(0===s)return e;e-=(o(e,r,n)-t)/s}return e}(e,c,t,i):0===u?c:function(t,e,r,n,i){var s,a,l=0;do{(s=o(a=e+(r-e)/2,n,i)-t)>0?r=a:e=a}while(Math.abs(s)>1e-7&&++l<10);return a}(e,n,n+r,t,i)}return function(t){return 0===t?0:1===t?1:o(h(t),e,s)}}},function(t,e){t.exports=function(t){!function(t){if(!t)throw new Error("Eventify cannot use falsy object as events subject");for(var e=["on","fire","off"],r=0;r<e.length;++r)if(t.hasOwnProperty(e[r]))throw new Error("Subject cannot be eventified, since it already has property '"+e[r]+"'")}(t);var e=function(t){var e=Object.create(null);return{on:function(r,n,i){if("function"!=typeof n)throw new Error("callback is expected to be a function");var s=e[r];return s||(s=e[r]=[]),s.push({callback:n,ctx:i}),t},off:function(r,n){if(void 0===r)return e=Object.create(null),t;if(e[r])if("function"!=typeof n)delete e[r];else for(var i=e[r],s=0;s<i.length;++s)i[s].callback===n&&i.splice(s,1);return t},fire:function(r){var n,i=e[r];if(!i)return t;arguments.length>1&&(n=Array.prototype.splice.call(arguments,1));for(var s=0;s<i.length;++s){var a=i[s];a.callback.apply(a.ctx,n)}return t}}}(t);return t.on=e.on,t.off=e.off,t.fire=e.fire,t}},,,,,,function(t,e,r){},function(t,e,r){},function(t,e,r){},function(t,e,r){(t.exports=r(160)(!1)).push([t.i,'.audioTrackSelector[data-audioTrackSelector]{float:right;position:relative;height:100%}.audioTrackSelector[data-audioTrackSelector] button{background-color:transparent;color:#fff;font-family:Roboto,"Open Sans",Arial,sans-serif;-webkit-font-smoothing:antialiased;border:none;font-size:12px;height:100%}.audioTrackSelector[data-audioTrackSelector] button:hover{color:#c9c9c9}.audioTrackSelector[data-audioTrackSelector] button.changing{-webkit-animation:pulse .5s infinite alternate}.audioTrackSelector[data-audioTrackSelector]>ul{overflow-x:hidden;overflow-y:auto;list-style-type:none;position:absolute;bottom:100%;display:none;background-color:rgba(28,28,28,.9);white-space:nowrap}.audioTrackSelector[data-audioTrackSelector] li{font-size:12px;color:#eee}.audioTrackSelector[data-audioTrackSelector] li[data-title]{background-color:#333;padding:8px 25px}.audioTrackSelector[data-audioTrackSelector] li a{color:#eee;padding:5px 18px;display:block;text-decoration:none}.audioTrackSelector[data-audioTrackSelector] li a:hover{background-color:rgba(255,255,255,.1);color:#fff}.audioTrackSelector[data-audioTrackSelector] li a:hover a{color:#fff;text-decoration:none}.audioTrackSelector[data-audioTrackSelector] li.current a{color:#2ecc71}@-webkit-keyframes pulse{0%{color:#fff}50%{color:#ff0101}100%{color:#b80000}}',""])}]).default;
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.03 |
proxy
|
phpinfo
|
Settings