wx-screen-ui 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.WxUI={},e.Vue))})(this,function(e,t){Object.defineProperty(e,`__esModule`,{value:!0});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),l=e=>{let t={};for(var n in e)r(t,n,{get:e[n],enumerable:!0});return t},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e},d=((e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(c(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.mpegts=r():n.mpegts=r()})(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(e,`__esModule`,{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t||4&t&&typeof e==`object`&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,`default`,{enumerable:!0,value:e}),2&t&&typeof e!=`string`)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=20)}([function(e,t,n){var r=n(9),i=n.n(r),a=function(){function e(){}return e.e=function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r=`[${t}] > ${n}`;e.ENABLE_CALLBACK&&e.emitter.emit(`log`,`error`,r),e.ENABLE_ERROR&&(console.error?console.error(r):console.warn?console.warn(r):console.log(r))},e.i=function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r=`[${t}] > ${n}`;e.ENABLE_CALLBACK&&e.emitter.emit(`log`,`info`,r),e.ENABLE_INFO&&(console.info?console.info(r):console.log(r))},e.w=function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r=`[${t}] > ${n}`;e.ENABLE_CALLBACK&&e.emitter.emit(`log`,`warn`,r),e.ENABLE_WARN&&(console.warn?console.warn(r):console.log(r))},e.d=function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r=`[${t}] > ${n}`;e.ENABLE_CALLBACK&&e.emitter.emit(`log`,`debug`,r),e.ENABLE_DEBUG&&(console.debug?console.debug(r):console.log(r))},e.v=function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r=`[${t}] > ${n}`;e.ENABLE_CALLBACK&&e.emitter.emit(`log`,`verbose`,r),e.ENABLE_VERBOSE&&console.log(r)},e}();a.GLOBAL_TAG=`mpegts.js`,a.FORCE_GLOBAL_TAG=!1,a.ENABLE_ERROR=!0,a.ENABLE_INFO=!0,a.ENABLE_WARN=!0,a.ENABLE_DEBUG=!0,a.ENABLE_VERBOSE=!0,a.ENABLE_CALLBACK=!1,a.emitter=new i.a,t.a=a},function(e,t,n){var r;(function(e){e.IO_ERROR=`io_error`,e.DEMUX_ERROR=`demux_error`,e.INIT_SEGMENT=`init_segment`,e.MEDIA_SEGMENT=`media_segment`,e.LOADING_COMPLETE=`loading_complete`,e.RECOVERED_EARLY_EOF=`recovered_early_eof`,e.MEDIA_INFO=`media_info`,e.METADATA_ARRIVED=`metadata_arrived`,e.SCRIPTDATA_ARRIVED=`scriptdata_arrived`,e.TIMED_ID3_METADATA_ARRIVED=`timed_id3_metadata_arrived`,e.SYNCHRONOUS_KLV_METADATA_ARRIVED=`synchronous_klv_metadata_arrived`,e.ASYNCHRONOUS_KLV_METADATA_ARRIVED=`asynchronous_klv_metadata_arrived`,e.SMPTE2038_METADATA_ARRIVED=`smpte2038_metadata_arrived`,e.SCTE35_METADATA_ARRIVED=`scte35_metadata_arrived`,e.PES_PRIVATE_DATA_DESCRIPTOR=`pes_private_data_descriptor`,e.PES_PRIVATE_DATA_ARRIVED=`pes_private_data_arrived`,e.STATISTICS_INFO=`statistics_info`,e.RECOMMEND_SEEKPOINT=`recommend_seekpoint`})(r||={}),t.a=r},function(e,t,n){n.d(t,`c`,(function(){return i})),n.d(t,`b`,(function(){return a})),n.d(t,`a`,(function(){return o}));var r=n(3),i={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},a={OK:`OK`,EXCEPTION:`Exception`,HTTP_STATUS_CODE_INVALID:`HttpStatusCodeInvalid`,CONNECTING_TIMEOUT:`ConnectingTimeout`,EARLY_EOF:`EarlyEof`,UNRECOVERABLE_EARLY_EOF:`UnrecoverableEarlyEof`},o=function(){function e(e){this._type=e||`undefined`,this._status=i.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return e.prototype.destroy=function(){this._status=i.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},e.prototype.isWorking=function(){return this._status===i.kConnecting||this._status===i.kBuffering},Object.defineProperty(e.prototype,`type`,{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`status`,{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`needStashBuffer`,{get:function(){return this._needStash},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onContentLengthKnown`,{get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onURLRedirect`,{get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onDataArrival`,{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onError`,{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onComplete`,{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),e.prototype.open=function(e,t){throw new r.c(`Unimplemented abstract function!`)},e.prototype.abort=function(){throw new r.c(`Unimplemented abstract function!`)},e}()},function(e,t,n){n.d(t,`d`,(function(){return a})),n.d(t,`a`,(function(){return o})),n.d(t,`b`,(function(){return s})),n.d(t,`c`,(function(){return c}));var r,i=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}r(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),a=function(){function e(e){this._message=e}return Object.defineProperty(e.prototype,`name`,{get:function(){return`RuntimeException`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`message`,{get:function(){return this._message},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return this.name+`: `+this.message},e}(),o=function(e){function t(t){return e.call(this,t)||this}return i(t,e),Object.defineProperty(t.prototype,`name`,{get:function(){return`IllegalStateException`},enumerable:!1,configurable:!0}),t}(a),s=function(e){function t(t){return e.call(this,t)||this}return i(t,e),Object.defineProperty(t.prototype,`name`,{get:function(){return`InvalidArgumentException`},enumerable:!1,configurable:!0}),t}(a),c=function(e){function t(t){return e.call(this,t)||this}return i(t,e),Object.defineProperty(t.prototype,`name`,{get:function(){return`NotImplementedException`},enumerable:!1,configurable:!0}),t}(a)},function(e,t,n){var r;(function(e){e.ERROR=`error`,e.LOADING_COMPLETE=`loading_complete`,e.RECOVERED_EARLY_EOF=`recovered_early_eof`,e.MEDIA_INFO=`media_info`,e.METADATA_ARRIVED=`metadata_arrived`,e.SCRIPTDATA_ARRIVED=`scriptdata_arrived`,e.TIMED_ID3_METADATA_ARRIVED=`timed_id3_metadata_arrived`,e.SYNCHRONOUS_KLV_METADATA_ARRIVED=`synchronous_klv_metadata_arrived`,e.ASYNCHRONOUS_KLV_METADATA_ARRIVED=`asynchronous_klv_metadata_arrived`,e.SMPTE2038_METADATA_ARRIVED=`smpte2038_metadata_arrived`,e.SCTE35_METADATA_ARRIVED=`scte35_metadata_arrived`,e.PES_PRIVATE_DATA_DESCRIPTOR=`pes_private_data_descriptor`,e.PES_PRIVATE_DATA_ARRIVED=`pes_private_data_arrived`,e.STATISTICS_INFO=`statistics_info`,e.DESTROYING=`destroying`})(r||={}),t.a=r},function(e,t,n){var r={};(function(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf(`trident`)>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf(`compatible`)<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],n=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],i={browser:t[5]||t[3]||t[1]||``,version:t[2]||t[4]||`0`,majorVersion:t[4]||t[2]||`0`,platform:n[0]||``},a={};if(i.browser){a[i.browser]=!0;var o=i.majorVersion.split(`.`);a.version={major:parseInt(i.majorVersion,10),string:i.version},o.length>1&&(a.version.minor=parseInt(o[1],10)),o.length>2&&(a.version.build=parseInt(o[2],10))}for(var s in i.platform&&(a[i.platform]=!0),(a.chrome||a.opr||a.safari)&&(a.webkit=!0),(a.rv||a.iemobile)&&(a.rv&&delete a.rv,i.browser=`msie`,a.msie=!0),a.edge&&(delete a.edge,i.browser=`msedge`,a.msedge=!0),a.opr&&(i.browser=`opera`,a.opera=!0),a.safari&&a.android&&(i.browser=`android`,a.android=!0),a.name=i.browser,a.platform=i.platform,r)r.hasOwnProperty(s)&&delete r[s];Object.assign(r,a)})(),t.a=r},function(e,t,n){t.a={OK:`OK`,FORMAT_ERROR:`FormatError`,FORMAT_UNSUPPORTED:`FormatUnsupported`,CODEC_UNSUPPORTED:`CodecUnsupported`}},function(e,t,n){var r;(function(e){e.ERROR=`error`,e.SOURCE_OPEN=`source_open`,e.UPDATE_END=`update_end`,e.BUFFER_FULL=`buffer_full`,e.START_STREAMING=`start_streaming`,e.END_STREAMING=`end_streaming`})(r||={}),t.a=r},function(e,t,n){var r=n(9),i=n.n(r),a=n(0),o=function(){function e(){}return Object.defineProperty(e,`forceGlobalTag`,{get:function(){return a.a.FORCE_GLOBAL_TAG},set:function(t){a.a.FORCE_GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`globalTag`,{get:function(){return a.a.GLOBAL_TAG},set:function(t){a.a.GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableAll`,{get:function(){return a.a.ENABLE_VERBOSE&&a.a.ENABLE_DEBUG&&a.a.ENABLE_INFO&&a.a.ENABLE_WARN&&a.a.ENABLE_ERROR},set:function(t){a.a.ENABLE_VERBOSE=t,a.a.ENABLE_DEBUG=t,a.a.ENABLE_INFO=t,a.a.ENABLE_WARN=t,a.a.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableDebug`,{get:function(){return a.a.ENABLE_DEBUG},set:function(t){a.a.ENABLE_DEBUG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableVerbose`,{get:function(){return a.a.ENABLE_VERBOSE},set:function(t){a.a.ENABLE_VERBOSE=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableInfo`,{get:function(){return a.a.ENABLE_INFO},set:function(t){a.a.ENABLE_INFO=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableWarn`,{get:function(){return a.a.ENABLE_WARN},set:function(t){a.a.ENABLE_WARN=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableError`,{get:function(){return a.a.ENABLE_ERROR},set:function(t){a.a.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),e.getConfig=function(){return{globalTag:a.a.GLOBAL_TAG,forceGlobalTag:a.a.FORCE_GLOBAL_TAG,enableVerbose:a.a.ENABLE_VERBOSE,enableDebug:a.a.ENABLE_DEBUG,enableInfo:a.a.ENABLE_INFO,enableWarn:a.a.ENABLE_WARN,enableError:a.a.ENABLE_ERROR,enableCallback:a.a.ENABLE_CALLBACK}},e.applyConfig=function(e){a.a.GLOBAL_TAG=e.globalTag,a.a.FORCE_GLOBAL_TAG=e.forceGlobalTag,a.a.ENABLE_VERBOSE=e.enableVerbose,a.a.ENABLE_DEBUG=e.enableDebug,a.a.ENABLE_INFO=e.enableInfo,a.a.ENABLE_WARN=e.enableWarn,a.a.ENABLE_ERROR=e.enableError,a.a.ENABLE_CALLBACK=e.enableCallback},e._notifyChange=function(){var t=e.emitter;if(t.listenerCount(`change`)>0){var n=e.getConfig();t.emit(`change`,n)}},e.registerListener=function(t){e.emitter.addListener(`change`,t)},e.removeListener=function(t){e.emitter.removeListener(`change`,t)},e.addLogListener=function(t){a.a.emitter.addListener(`log`,t),a.a.emitter.listenerCount(`log`)>0&&(a.a.ENABLE_CALLBACK=!0,e._notifyChange())},e.removeLogListener=function(t){a.a.emitter.removeListener(`log`,t),a.a.emitter.listenerCount(`log`)===0&&(a.a.ENABLE_CALLBACK=!1,e._notifyChange())},e}();o.emitter=new i.a,t.a=o},function(e,t,n){var r,i=typeof Reflect==`object`?Reflect:null,a=i&&typeof i.apply==`function`?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&typeof i.ownKeys==`function`?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}_(e,t,a,{once:!0}),t!==`error`&&function(e,t,n){typeof e.on==`function`&&_(e,`error`,t,n)}(e,i,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}function d(e,t,n,r){var i,a,o,s;if(l(n),(a=e._events)===void 0?(a=e._events=Object.create(null),e._eventsCount=0):(a.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),a=e._events),o=a[t]),o===void 0)o=a[t]=n,++e._eventsCount;else if(typeof o==`function`?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=u(e))>0&&o.length>i&&!o.warned){o.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+o.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=o.length,s=c,console&&console.warn&&console.warn(s)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?function(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):g(i,i.length)}function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else{if(typeof e.addEventListener!=`function`)throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e);e.addEventListener(t,(function i(a){r.once&&e.removeEventListener(t,i),n(a)}))}}Object.defineProperty(s,`defaultMaxListeners`,{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r=e===`error`,i=this._events;if(i!==void 0)r&&=i.error===void 0;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=i[e];if(c===void 0)return!1;if(typeof c==`function`)a(c,this,t);else{var l=c.length,u=g(c,l);for(n=0;n<l;++n)a(u[n],this,t)}return!0},s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)},s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),(r=this._events)===void 0||(n=r[e])===void 0)return this;if(n===t||n.listener===t)--this._eventsCount==0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n,r;if((n=this._events)===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i,a=Object.keys(n);for(r=0;r<a.length;++r)(i=a[r])!==`removeListener`&&this.removeAllListeners(i);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(t=n[e])==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){n.d(t,`b`,(function(){return a})),n.d(t,`a`,(function(){return o}));var r=n(2),i=n(6),a={NETWORK_ERROR:`NetworkError`,MEDIA_ERROR:`MediaError`,OTHER_ERROR:`OtherError`},o={NETWORK_EXCEPTION:r.b.EXCEPTION,NETWORK_STATUS_CODE_INVALID:r.b.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:r.b.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:r.b.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:`MediaMSEError`,MEDIA_FORMAT_ERROR:i.a.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:i.a.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:i.a.CODEC_UNSUPPORTED}},function(e,t,n){n.d(t,`d`,(function(){return r})),n.d(t,`b`,(function(){return i})),n.d(t,`a`,(function(){return a})),n.d(t,`c`,(function(){return o}));var r=function(e,t,n,r,i){this.dts=e,this.pts=t,this.duration=n,this.originalDts=r,this.isSyncPoint=i,this.fileposition=null},i=function(){function e(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return e.prototype.appendSyncPoint=function(e){e.isSyncPoint=!0,this.syncPoints.push(e)},e}(),a=function(){function e(){this._list=[]}return e.prototype.clear=function(){this._list=[]},e.prototype.appendArray=function(e){var t=this._list;e.length!==0&&(t.length>0&&e[0].originalDts<t[t.length-1].originalDts&&this.clear(),Array.prototype.push.apply(t,e))},e.prototype.getLastSyncPointBeforeDts=function(e){if(this._list.length==0)return null;var t=this._list,n=0,r=t.length-1,i=0,a=0,o=r;for(e<t[0].dts&&(n=0,a=o+1);a<=o;){if((i=a+Math.floor((o-a)/2))===r||e>=t[i].dts&&e<t[i+1].dts){n=i;break}t[i].dts<e?a=i+1:o=i-1}return this._list[n]},e}(),o=function(){function e(e){this._type=e,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(e.prototype,`type`,{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`length`,{get:function(){return this._list.length},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return this._list.length===0},e.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},e.prototype._searchNearestSegmentBefore=function(e){var t=this._list;if(t.length===0)return-2;var n=t.length-1,r=0,i=0,a=n,o=0;if(e<t[0].originalBeginDts)return o=-1;for(;i<=a;){if((r=i+Math.floor((a-i)/2))===n||e>t[r].lastSample.originalDts&&e<t[r+1].originalBeginDts){o=r;break}t[r].originalBeginDts<e?i=r+1:a=r-1}return o},e.prototype._searchNearestSegmentAfter=function(e){return this._searchNearestSegmentBefore(e)+1},e.prototype.append=function(e){var t=this._list,n=e,r=this._lastAppendLocation,i=0;r!==-1&&r<t.length&&n.originalBeginDts>=t[r].lastSample.originalDts&&(r===t.length-1||r<t.length-1&&n.originalBeginDts<t[r+1].originalBeginDts)?i=r+1:t.length>0&&(i=this._searchNearestSegmentBefore(n.originalBeginDts)+1),this._lastAppendLocation=i,this._list.splice(i,0,n)},e.prototype.getLastSegmentBefore=function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null},e.prototype.getLastSampleBefore=function(e){var t=this.getLastSegmentBefore(e);return t==null?null:t.lastSample},e.prototype.getLastSyncPointBefore=function(e){for(var t=this._searchNearestSegmentBefore(e),n=this._list[t].syncPoints;n.length===0&&t>0;)t--,n=this._list[t].syncPoints;return n.length>0?n[n.length-1]:null},e}()},function(e,t,n){t.a=function(){function e(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return e.prototype.isComplete=function(){var e=!1===this.hasAudio||!0===this.hasAudio&&this.audioCodec!=null&&this.audioSampleRate!=null&&this.audioChannelCount!=null,t=!1===this.hasVideo||!0===this.hasVideo&&this.videoCodec!=null&&this.width!=null&&this.height!=null&&this.fps!=null&&this.profile!=null&&this.level!=null&&this.refFrames!=null&&this.chromaFormat!=null&&this.sarNum!=null&&this.sarDen!=null;return this.mimeType!=null&&e&&t},e.prototype.isSeekable=function(){return!0===this.hasKeyframesIndex},e.prototype.getNearestKeyframe=function(e){if(this.keyframesIndex==null)return null;var t=this.keyframesIndex,n=this._search(t.times,e);return{index:n,milliseconds:t.times[n],fileposition:t.filepositions[n]}},e.prototype._search=function(e,t){var n=0,r=e.length-1,i=0,a=0,o=r;for(t<e[0]&&(n=0,a=o+1);a<=o;){if((i=a+Math.floor((o-a)/2))===r||t>=e[i]&&t<e[i+1]){n=i;break}e[i]<t?a=i+1:o=i-1}return n},e}()},function(e,t,n){var r=n(9),i=n.n(r),a=n(0),o=n(5),s=n(12);function c(e,t,n){var r=e;if(t+n<r.length){for(;n--;)if((192&r[++t])!=128)return!1;return!0}return!1}var l,u=function(e){for(var t=[],n=e,r=0,i=e.length;r<i;)if(n[r]<128)t.push(String.fromCharCode(n[r])),++r;else{if(!(n[r]<192)){if(n[r]<224){if(c(n,r,1)&&(a=(31&n[r])<<6|63&n[r+1])>=128){t.push(String.fromCharCode(65535&a)),r+=2;continue}}else if(n[r]<240){if(c(n,r,2)&&(a=(15&n[r])<<12|(63&n[r+1])<<6|63&n[r+2])>=2048&&(63488&a)!=55296){t.push(String.fromCharCode(65535&a)),r+=3;continue}}else if(n[r]<248){var a;if(c(n,r,3)&&(a=(7&n[r])<<18|(63&n[r+1])<<12|(63&n[r+2])<<6|63&n[r+3])>65536&&a<1114112){a-=65536,t.push(String.fromCharCode(a>>>10|55296)),t.push(String.fromCharCode(1023&a|56320)),r+=4;continue}}}t.push(`�`),++r}return t.join(``)},d=n(3),f=(l=new ArrayBuffer(2),new DataView(l).setInt16(0,256,!0),new Int16Array(l)[0]===256),p=function(){function e(){}return e.parseScriptData=function(t,n,r){var i={};try{var o=e.parseValue(t,n,r),s=e.parseValue(t,n+o.size,r-o.size);i[o.data]=s.data}catch(e){a.a.e(`AMF`,e.toString())}return i},e.parseObject=function(t,n,r){if(r<3)throw new d.a(`Data not enough when parse ScriptDataObject`);var i=e.parseString(t,n,r),a=e.parseValue(t,n+i.size,r-i.size),o=a.objectEnd;return{data:{name:i.data,value:a.data},size:i.size+a.size,objectEnd:o}},e.parseVariable=function(t,n,r){return e.parseObject(t,n,r)},e.parseString=function(e,t,n){if(n<2)throw new d.a(`Data not enough when parse String`);var r=new DataView(e,t,n).getUint16(0,!f);return{data:r>0?u(new Uint8Array(e,t+2,r)):``,size:2+r}},e.parseLongString=function(e,t,n){if(n<4)throw new d.a(`Data not enough when parse LongString`);var r=new DataView(e,t,n).getUint32(0,!f);return{data:r>0?u(new Uint8Array(e,t+4,r)):``,size:4+r}},e.parseDate=function(e,t,n){if(n<10)throw new d.a(`Data size invalid when parse Date`);var r=new DataView(e,t,n),i=r.getFloat64(0,!f),a=r.getInt16(8,!f);return{data:new Date(i+=60*a*1e3),size:10}},e.parseValue=function(t,n,r){if(r<1)throw new d.a(`Data not enough when parse Value`);var i,o=new DataView(t,n,r),s=1,c=o.getUint8(0),l=!1;try{switch(c){case 0:i=o.getFloat64(1,!f),s+=8;break;case 1:i=!!o.getUint8(1),s+=1;break;case 2:var u=e.parseString(t,n+1,r-1);i=u.data,s+=u.size;break;case 3:i={};var p=0;for((16777215&o.getUint32(r-4,!f))==9&&(p=3);s<r-4;){var m=e.parseObject(t,n+s,r-s-p);if(m.objectEnd)break;i[m.data.name]=m.data.value,s+=m.size}s<=r-3&&(16777215&o.getUint32(s-1,!f))==9&&(s+=3);break;case 8:for(i={},s+=4,p=0,(16777215&o.getUint32(r-4,!f))==9&&(p=3);s<r-8;){var h=e.parseVariable(t,n+s,r-s-p);if(h.objectEnd)break;i[h.data.name]=h.data.value,s+=h.size}s<=r-3&&(16777215&o.getUint32(s-1,!f))==9&&(s+=3);break;case 9:i=void 0,s=1,l=!0;break;case 10:i=[];var g=o.getUint32(1,!f);s+=4;for(var _=0;_<g;_++){var v=e.parseValue(t,n+s,r-s);i.push(v.data),s+=v.size}break;case 11:var y=e.parseDate(t,n+1,r-1);i=y.data,s+=y.size;break;case 12:var b=e.parseString(t,n+1,r-1);i=b.data,s+=b.size;break;default:s=r,a.a.w(`AMF`,`Unsupported AMF value type `+c)}}catch(e){a.a.e(`AMF`,e.toString())}return{data:i,size:s,objectEnd:l}},e}(),m=function(){function e(e){this.TAG=`ExpGolomb`,this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=8*e.byteLength,this._current_word=0,this._current_word_bits_left=0}return e.prototype.destroy=function(){this._buffer=null},e.prototype._fillCurrentWord=function(){var e=this._total_bytes-this._buffer_index;if(e<=0)throw new d.a(`ExpGolomb: _fillCurrentWord() but no bytes available`);var t=Math.min(4,e),n=new Uint8Array(4);n.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(n.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t},e.prototype.readBits=function(e){if(e>32)throw new d.b(`ExpGolomb: readBits() bits exceeded max 32bits!`);if(e<=this._current_word_bits_left){var t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}var n=this._current_word_bits_left?this._current_word:0;n>>>=32-this._current_word_bits_left;var r=e-this._current_word_bits_left;this._fillCurrentWord();var i=Math.min(r,this._current_word_bits_left),a=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,n=n<<i|a},e.prototype.readBool=function(){return this.readBits(1)===1},e.prototype.readByte=function(){return this.readBits(8)},e.prototype._skipLeadingZero=function(){var e;for(e=0;e<this._current_word_bits_left;e++)if(this._current_word&2147483648>>>e)return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()},e.prototype.readUEG=function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1},e.prototype.readSEG=function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)},e}(),h=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,n=t.byteLength,r=new Uint8Array(n),i=0,a=0;a<n;a++)a>=2&&t[a]===3&&t[a-1]===0&&t[a-2]===0||(r[i]=t[a],i++);return new Uint8Array(r.buffer,0,i)},e.parseSPS=function(t){for(var n=t.subarray(1,4),r=`avc1.`,i=0;i<3;i++){var a=n[i].toString(16);a.length<2&&(a=`0`+a),r+=a}var o=new m(e._ebsp2rbsp(t));o.readByte();var s=o.readByte();o.readByte();var c=o.readByte();o.readUEG();var l=e.getProfileString(s),u=e.getLevelString(c),d=1,f=420,p=8,h=8;if((s===100||s===110||s===122||s===244||s===44||s===83||s===86||s===118||s===128||s===138||s===144)&&((d=o.readUEG())===3&&o.readBits(1),d<=3&&(f=[0,420,422,444][d]),p=o.readUEG()+8,h=o.readUEG()+8,o.readBits(1),o.readBool()))for(var g=d===3?12:8,_=0;_<g;_++)o.readBool()&&(_<6?e._skipScalingList(o,16):e._skipScalingList(o,64));o.readUEG();var v=o.readUEG();if(v===0)o.readUEG();else if(v===1){o.readBits(1),o.readSEG(),o.readSEG();var y=o.readUEG();for(_=0;_<y;_++)o.readSEG()}var b=o.readUEG();o.readBits(1);var x=o.readUEG(),S=o.readUEG(),C=o.readBits(1);C===0&&o.readBits(1),o.readBits(1);var w=0,T=0,E=0,D=0;o.readBool()&&(w=o.readUEG(),T=o.readUEG(),E=o.readUEG(),D=o.readUEG());var O=1,k=1,A=0,j=!0,M=0,N=0;if(o.readBool()){if(o.readBool()){var P=o.readByte();P>0&&P<16?(O=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][P-1],k=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][P-1]):P===255&&(O=o.readByte()<<8|o.readByte(),k=o.readByte()<<8|o.readByte())}if(o.readBool()&&o.readBool(),o.readBool()&&(o.readBits(4),o.readBool()&&o.readBits(24)),o.readBool()&&(o.readUEG(),o.readUEG()),o.readBool()){var F=o.readBits(32),I=o.readBits(32);j=o.readBool(),A=(M=I)/(N=2*F)}}var ee=1;O===1&&k===1||(ee=O/k);var L=0,R=0;d===0?(L=1,R=2-C):(L=d===3?1:2,R=(d===1?2:1)*(2-C));var te=16*(x+1),ne=16*(S+1)*(2-C);te-=(w+T)*L,ne-=(E+D)*R;var re=Math.ceil(te*ee);return o.destroy(),o=null,{codec_mimetype:r,profile_idc:s,level_idc:c,profile_string:l,level_string:u,chroma_format_idc:d,bit_depth:p,bit_depth_luma:p,bit_depth_chroma:h,ref_frames:b,chroma_format:f,chroma_format_string:e.getChromaFormatString(f),frame_rate:{fixed:j,fps:A,fps_den:N,fps_num:M},sar_ratio:{width:O,height:k},codec_size:{width:te,height:ne},present_size:{width:re,height:ne}}},e._skipScalingList=function(e,t){for(var n=8,r=8,i=0;i<t;i++)r!==0&&(r=(n+e.readSEG()+256)%256),n=r===0?n:r},e.getProfileString=function(e){switch(e){case 66:return`Baseline`;case 77:return`Main`;case 88:return`Extended`;case 100:return`High`;case 110:return`High10`;case 122:return`High422`;case 244:return`High444`;default:return`Unknown`}},e.getLevelString=function(e){return(e/10).toFixed(1)},e.getChromaFormatString=function(e){switch(e){case 420:return`4:2:0`;case 422:return`4:2:2`;case 444:return`4:4:4`;default:return`Unknown`}},e}(),g=n(6),_=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,n=t.byteLength,r=new Uint8Array(n),i=0,a=0;a<n;a++)a>=2&&t[a]===3&&t[a-1]===0&&t[a-2]===0||(r[i]=t[a],i++);return new Uint8Array(r.buffer,0,i)},e.parseVPS=function(t){var n=new m(e._ebsp2rbsp(t));return n.readByte(),n.readByte(),n.readBits(4),n.readBits(2),n.readBits(6),{num_temporal_layers:n.readBits(3)+1,temporal_id_nested:n.readBool()}},e.parseSPS=function(t){var n=new m(e._ebsp2rbsp(t));n.readByte(),n.readByte();for(var r=0,i=0,a=0,o=0,s=(n.readBits(4),n.readBits(3)),c=(n.readBool(),n.readBits(2)),l=n.readBool(),u=n.readBits(5),d=n.readByte(),f=n.readByte(),p=n.readByte(),h=n.readByte(),g=n.readByte(),_=n.readByte(),v=n.readByte(),y=n.readByte(),b=n.readByte(),x=n.readByte(),S=n.readByte(),C=[],w=[],T=0;T<s;T++)C.push(n.readBool()),w.push(n.readBool());if(s>0)for(T=s;T<8;T++)n.readBits(2);for(T=0;T<s;T++)C[T]&&(n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte()),w[T]&&n.readByte();n.readUEG();var E=n.readUEG();E==3&&n.readBits(1);var D=n.readUEG(),O=n.readUEG();n.readBool()&&(r+=n.readUEG(),i+=n.readUEG(),a+=n.readUEG(),o+=n.readUEG());var k=n.readUEG(),A=n.readUEG(),j=n.readUEG();for(T=n.readBool()?0:s;T<=s;T++)n.readUEG(),n.readUEG(),n.readUEG();if(n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readBool()&&n.readBool())for(var M=0;M<4;M++)for(var N=0;N<(M===3?2:6);N++)if(n.readBool()){var P=Math.min(64,1<<4+(M<<1));for(M>1&&n.readSEG(),T=0;T<P;T++)n.readSEG()}else n.readUEG();n.readBool(),n.readBool(),n.readBool()&&(n.readByte(),n.readUEG(),n.readUEG(),n.readBool());var F=n.readUEG(),I=0;for(T=0;T<F;T++){var ee=!1;if(T!==0&&(ee=n.readBool()),ee){T===F&&n.readUEG(),n.readBool(),n.readUEG();for(var L=0,R=0;R<=I;R++){var te=n.readBool(),ne=!1;te||(ne=n.readBool()),(te||ne)&&L++}I=L}else{var re=n.readUEG(),ie=n.readUEG();for(I=re+ie,R=0;R<re;R++)n.readUEG(),n.readBool();for(R=0;R<ie;R++)n.readUEG(),n.readBool()}}if(n.readBool()){var ae=n.readUEG();for(T=0;T<ae;T++){for(R=0;R<j+4;R++)n.readBits(1);n.readBits(1)}}var oe=0,se=1,ce=1,le=!1,ue=1,de=1;if(n.readBool(),n.readBool(),n.readBool()){if(n.readBool()){var fe=n.readByte();fe>0&&fe<=16?(se=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][fe-1],ce=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][fe-1]):fe===255&&(se=n.readBits(16),ce=n.readBits(16))}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(3),n.readBool(),n.readBool()&&(n.readByte(),n.readByte(),n.readByte())),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool(),n.readBool(),n.readBool(),n.readBool()&&(n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG()),n.readBool()&&(ue=n.readBits(32),de=n.readBits(32),n.readBool()&&n.readUEG(),n.readBool())){var pe=!1,me=!1,he=!1;for(pe=n.readBool(),me=n.readBool(),(pe||me)&&((he=n.readBool())&&(n.readByte(),n.readBits(5),n.readBool(),n.readBits(5)),n.readBits(4),n.readBits(4),he&&n.readBits(4),n.readBits(5),n.readBits(5),n.readBits(5)),T=0;T<=s;T++){var ge=n.readBool();le=ge;var _e=!0,ve=1;ge||(_e=n.readBool());var ye=!1;if(_e?n.readUEG():ye=n.readBool(),ye||(ve=n.readUEG()+1),pe){for(R=0;R<ve;R++)n.readUEG(),n.readUEG(),he&&(n.readUEG(),n.readUEG());n.readBool()}if(me){for(R=0;R<ve;R++)n.readUEG(),n.readUEG(),he&&(n.readUEG(),n.readUEG());n.readBool()}}}n.readBool()&&(n.readBool(),n.readBool(),n.readBool(),oe=n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG())}n.readBool();var be=`hvc1.${u}.1.L${S}.B0`,xe=D-(r+i)*(E===1||E===2?2:1),Se=O-(a+o)*(E===1?2:1),Ce=1;return se!==1&&ce!==1&&(Ce=se/ce),n.destroy(),n=null,{codec_mimetype:be,profile_string:e.getProfileString(u),level_string:e.getLevelString(S),profile_idc:u,bit_depth:k+8,ref_frames:1,chroma_format:E,chroma_format_string:e.getChromaFormatString(E),general_level_idc:S,general_profile_space:c,general_tier_flag:l,general_profile_idc:u,general_profile_compatibility_flags_1:d,general_profile_compatibility_flags_2:f,general_profile_compatibility_flags_3:p,general_profile_compatibility_flags_4:h,general_constraint_indicator_flags_1:g,general_constraint_indicator_flags_2:_,general_constraint_indicator_flags_3:v,general_constraint_indicator_flags_4:y,general_constraint_indicator_flags_5:b,general_constraint_indicator_flags_6:x,min_spatial_segmentation_idc:oe,constant_frame_rate:0,chroma_format_idc:E,bit_depth_luma_minus8:k,bit_depth_chroma_minus8:A,frame_rate:{fixed:le,fps:de/ue,fps_den:ue,fps_num:de},sar_ratio:{width:se,height:ce},codec_size:{width:xe,height:Se},present_size:{width:xe*Ce,height:Se}}},e.parsePPS=function(t){var n=new m(e._ebsp2rbsp(t));n.readByte(),n.readByte(),n.readUEG(),n.readUEG(),n.readBool(),n.readBool(),n.readBits(3),n.readBool(),n.readBool(),n.readUEG(),n.readUEG(),n.readSEG(),n.readBool(),n.readBool(),n.readBool()&&n.readUEG(),n.readSEG(),n.readSEG(),n.readBool(),n.readBool(),n.readBool(),n.readBool();var r=n.readBool(),i=n.readBool(),a=1;return i&&r?a=0:i?a=3:r&&(a=2),{parallelismType:a}},e.getChromaFormatString=function(e){switch(e){case 0:return`4:0:0`;case 1:return`4:2:0`;case 2:return`4:2:2`;case 3:return`4:4:4`;default:return`Unknown`}},e.getProfileString=function(e){switch(e){case 1:return`Main`;case 2:return`Main10`;case 3:return`MainSP`;case 4:return`Rext`;case 9:return`SCC`;default:return`Unknown`}},e.getLevelString=function(e){return(e/30).toFixed(1)},e}();function v(e){return e.byteOffset%2==0&&e.byteLength%2==0}function y(e){return e.byteOffset%4==0&&e.byteLength%4==0}function b(e,t){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var x=function(e,t){return e.byteLength===t.byteLength&&(y(e)&&y(t)?function(e,t){return b(new Uint32Array(e.buffer,e.byteOffset,e.byteLength/4),new Uint32Array(t.buffer,t.byteOffset,t.byteLength/4))}(e,t):v(e)&&v(t)?function(e,t){return b(new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2))}(e,t):function(e,t){return b(e,t)}(e,t))},S=function(){return(S=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},C=function(){function e(){}return e.parseOBUs=function(t,n){for(var r=0;r<t.byteLength;){var i=r,a=(t[r],(120&t[r])>>3),o=(4&t[r])!=0,s=(2&t[r])!=0;t[r],r+=1,o&&(r+=1);var c=1/0;if(s){c=0;for(var l=0;;l++){var u=t[r++];if(c|=(127&u)<<7*l,!(128&u))break}}console.log(a),a===1?n=S(S({},e.parseSeuqneceHeader(t.subarray(r,r+c))),{sequence_header_data:t.subarray(i,r+c)}):(a==3&&n||a==6&&n)&&(n=e.parseOBUFrameHeader(t.subarray(r,r+c),0,0,n)),r+=c}return n},e.parseSeuqneceHeader=function(t){var n=new m(t),r=n.readBits(3),i=(n.readBool(),n.readBool()),a=!0,o=0,s=1,c=void 0,l=[];if(i)l.push({operating_point_idc:0,level:n.readBits(5),tier:0});else{if(n.readBool()){var u=n.readBits(32),d=n.readBits(32),f=n.readBool();if(f){for(var p=0;n.readBits(1)===0;)p+=1;p>=32||(1<<p)-1+n.readBits(p)}(o=d)/(s=u),a=f,n.readBool()&&(n.readBits(5),n.readBits(32),c=n.readBits(5),n.readBits(5))}for(var h=n.readBool(),g=n.readBits(5),_=0;_<=g;_++){var v=n.readBits(12),y=n.readBits(5),b=y>7?n.readBits(1):0;l.push({operating_point_idc:v,level:y,tier:b}),h&&n.readBool()&&n.readBits(4)}}var x=l[0],S=x.level,C=x.tier,w=n.readBits(4),T=n.readBits(4),E=n.readBits(w+1)+1,D=n.readBits(T+1)+1,O=!1;i||(O=n.readBool()),O&&(n.readBits(4),n.readBits(4)),n.readBool(),n.readBool(),n.readBool();var k=!1,A=2,j=2,M=0;i||(n.readBool(),n.readBool(),n.readBool(),n.readBool(),(k=n.readBool())&&(n.readBool(),n.readBool()),j=(A=n.readBool()?2:n.readBits(1))?n.readBool()?2:n.readBits(1):2,M=k?n.readBits(3)+1:0);var N=n.readBool(),P=(n.readBool(),n.readBool(),n.readBool()),F=8;F=r===2&&P?n.readBool()?12:10:P?10:8;var I=!1;r!==1&&(I=n.readBool()),n.readBool()&&(n.readBits(8),n.readBits(8),n.readBits(8));var ee=1,L=1;return I?(n.readBits(1),ee=1,L=1):(n.readBits(1),r==0?(ee=1,L=1):r==1?(ee=0,L=0):F==12?n.readBits(1)&&n.readBits(1):(ee=1,L=0),ee&&L&&n.readBits(2),n.readBits(1)),n.readBool(),n.destroy(),n=null,{codec_mimetype:`av01.${r}.${e.getLevelString(S,C)}.${F.toString(10).padStart(2,`0`)}`,level:S,tier:C,level_string:e.getLevelString(S,C),profile_idc:r,profile_string:`${r}`,bit_depth:F,ref_frames:1,chroma_format:e.getChromaFormat(I,ee,L),chroma_format_string:e.getChromaFormatString(I,ee,L),sequence_header:{frame_id_numbers_present_flag:O,additional_frame_id_length_minus_1:void 0,delta_frame_id_length_minus_2:void 0,reduced_still_picture_header:i,decoder_model_info_present_flag:!1,operating_points:l,buffer_removal_time_length_minus_1:c,equal_picture_interval:a,seq_force_screen_content_tools:A,seq_force_integer_mv:j,enable_order_hint:k,order_hint_bits:M,enable_superres:N,frame_width_bit:w+1,frame_height_bit:T+1,max_frame_width:E,max_frame_height:D},keyframe:void 0,frame_rate:{fixed:a,fps:o/s,fps_den:s,fps_num:o}}},e.parseOBUFrameHeader=function(t,n,r,i){var a=i.sequence_header,o=new m(t),s=(a.max_frame_width,a.max_frame_height,0);a.frame_id_numbers_present_flag&&(s=a.additional_frame_id_length_minus_1+a.delta_frame_id_length_minus_2+3);var c=0,l=!0,u=!0,d=!1;if(!a.reduced_still_picture_header){if(o.readBool())return i;l=(c=o.readBits(2))===2||c===0,(u=o.readBool())&&a.decoder_model_info_present_flag&&a.equal_picture_interval,u&&o.readBool(),d=!!(c===3||c===0&&u)||o.readBool()}i.keyframe=l,o.readBool();var f=a.seq_force_screen_content_tools;a.seq_force_screen_content_tools===2&&(f=o.readBits(1)),f&&(a.seq_force_integer_mv,a.seq_force_integer_mv==2&&o.readBits(1)),a.frame_id_numbers_present_flag&&o.readBits(s);var p=!1;if(p=c==3||!a.reduced_still_picture_header&&o.readBool(),o.readBits(a.order_hint_bits),(l||d||o.readBits(3),a.decoder_model_info_present_flag)&&o.readBool()){for(var h=0;h<=a.operating_points_cnt_minus_1;h++)if(a.operating_points[h].decoder_model_present_for_this_op[h]){var g=a.operating_points[h].operating_point_idc;(g===0||g>>n&1&&g>>r+8&1)&&o.readBits(a.buffer_removal_time_length_minus_1+1)}}var _=255;if(c===3||c==0&&u||(_=o.readBits(8)),(l||_!==255)&&d&&a.enable_order_hint)for(var v=0;v<8;v++)o.readBits(a.order_hint_bits);if(l){var y=e.frameSizeAndRenderSize(o,p,a);i.codec_size={width:y.FrameWidth,height:y.FrameHeight},i.present_size={width:y.RenderWidth,height:y.RenderHeight},i.sar_ratio={width:y.RenderWidth/y.FrameWidth,height:y.RenderHeight/y.FrameHeight}}return o.destroy(),o=null,i},e.frameSizeAndRenderSize=function(e,t,n){var r=n.max_frame_width,i=n.max_frame_height;t&&(r=e.readBits(n.frame_width_bit)+1,i=e.readBits(n.frame_height_bit)+1);var a=!1;n.enable_superres&&(a=e.readBool());var o=8;a&&(o=e.readBits(3)+9);var s=r;r=Math.floor((8*s+o/2)/o);var c=s,l=i;if(e.readBool()){var u=e.readBits(16)+1,d=e.readBits(16)+1;c=e.readBits(u)+1,l=e.readBits(d)+1}return{UpscaledWidth:s,FrameWidth:r,FrameHeight:i,RenderWidth:c,RenderHeight:l}},e.getLevelString=function(e,t){return`${e.toString(10).padStart(2,`0`)}${t===0?`M`:`H`}`},e.getChromaFormat=function(e,t,n){return e?0:t===0&&n===0?3:t===1&&n===0?2:t===1&&n===1?1:NaN},e.getChromaFormatString=function(e,t,n){return e?`4:0:0`:t===0&&n===0?`4:4:4`:t===1&&n===0?`4:2:2`:t===1&&n===1?`4:2:0`:`Unknown`},e}(),w,T=function(){function e(e,t){this.TAG=`FLVDemuxer`,this._config=t,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=e.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=e.hasAudioTrack,this._hasVideo=e.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new s.a,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:`video`,id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:`audio`,id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256}()}return e.prototype.destroy=function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null},e.probe=function(e){var t=new Uint8Array(e);if(t.byteLength<9)return{needMoreData:!0};var n={match:!1};if(t[0]!==70||t[1]!==76||t[2]!==86||t[3]!==1)return n;var r,i,a=(4&t[4])>>>2!=0,o=(1&t[4])!=0,s=(r=t)[i=5]<<24|r[i+1]<<16|r[i+2]<<8|r[i+3];return s<9?n:{match:!0,consumed:s,dataOffset:s,hasAudioTrack:a,hasVideoTrack:o}},e.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(e.prototype,`onTrackMetadata`,{get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onMediaInfo`,{get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onMetaDataArrived`,{get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onScriptDataArrived`,{get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onError`,{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onDataAvailable`,{get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`timestampBase`,{get:function(){return this._timestampBase},set:function(e){this._timestampBase=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`overridedDuration`,{get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo.duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`overridedHasAudio`,{set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`overridedHasVideo`,{set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e},enumerable:!1,configurable:!0}),e.prototype.resetMediaInfo=function(){this._mediaInfo=new s.a},e.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched},e.prototype.parseChunks=function(t,n){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new d.a(`Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified`);var r=0,i=this._littleEndian;if(n===0){if(!(t.byteLength>13))return 0;r=e.probe(t).dataOffset}for(this._firstParse&&(this._firstParse=!1,n+r!==this._dataOffset&&a.a.w(this.TAG,`First time parsing but chunk byteStart invalid!`),(o=new DataView(t,r)).getUint32(0,!i)!==0&&a.a.w(this.TAG,`PrevTagSize0 !== 0 !!!`),r+=4);r<t.byteLength;){this._dispatch=!0;var o=new DataView(t,r);if(r+11+4>t.byteLength)break;var s=o.getUint8(0),c=16777215&o.getUint32(0,!i);if(r+11+c+4>t.byteLength)break;if(s===8||s===9||s===18){var l=o.getUint8(4),u=o.getUint8(5),f=o.getUint8(6)|u<<8|l<<16|o.getUint8(7)<<24;16777215&o.getUint32(7,!i)&&a.a.w(this.TAG,`Meet tag which has StreamID != 0!`);var p=r+11;switch(s){case 8:this._parseAudioData(t,p,c,f);break;case 9:this._parseVideoData(t,p,c,f,n+r);break;case 18:this._parseScriptData(t,p,c)}var m=o.getUint32(11+c,!i);m!==11+c&&a.a.w(this.TAG,`Invalid PrevTagSize ${m}`),r+=11+c+4}else a.a.w(this.TAG,`Unsupported tag type ${s}, skipped`),r+=11+c+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),r},e.prototype._parseScriptData=function(e,t,n){var r=p.parseScriptData(e,t,n);if(r.hasOwnProperty(`onMetaData`)){if(r.onMetaData==null||typeof r.onMetaData!=`object`)return void a.a.w(this.TAG,`Invalid onMetaData structure!`);this._metadata&&a.a.w(this.TAG,`Found another onMetaData tag!`),this._metadata=r;var i=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},i)),typeof i.hasAudio==`boolean`&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=i.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),typeof i.hasVideo==`boolean`&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=i.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),typeof i.audiodatarate==`number`&&(this._mediaInfo.audioDataRate=i.audiodatarate),typeof i.videodatarate==`number`&&(this._mediaInfo.videoDataRate=i.videodatarate),typeof i.width==`number`&&(this._mediaInfo.width=i.width),typeof i.height==`number`&&(this._mediaInfo.height=i.height),typeof i.duration==`number`){if(!this._durationOverrided){var o=Math.floor(i.duration*this._timescale);this._duration=o,this._mediaInfo.duration=o}}else this._mediaInfo.duration=0;if(typeof i.framerate==`number`){var s=Math.floor(1e3*i.framerate);if(s>0){var c=s/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=c,this._referenceFrameRate.fps_num=s,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=c}}if(typeof i.keyframes==`object`){this._mediaInfo.hasKeyframesIndex=!0;var l=i.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(l),i.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=i,a.a.v(this.TAG,`Parsed onMetaData`),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(r).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},r))},e.prototype._parseKeyframesIndex=function(e){for(var t=[],n=[],r=1;r<e.times.length;r++){var i=this._timestampBase+Math.floor(1e3*e.times[r]);t.push(i),n.push(e.filepositions[r])}return{times:t,filepositions:n}},e.prototype._parseAudioData=function(e,t,n,r){if(n<=1)a.a.w(this.TAG,`Flv: Invalid audio packet, missing SoundData payload!`);else if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){this._littleEndian;var i=new DataView(e,t,n).getUint8(0),o=i>>>4;if(o!==9)if(o===2||o===10){var s=0,c=(12&i)>>>2;if(c>=0&&c<=4){s=this._flvSoundRateTable[c];var l=1&i,u=this._audioMetadata,d=this._audioTrack;if(u||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(u=this._audioMetadata={}).type=`audio`,u.id=d.id,u.timescale=this._timescale,u.duration=this._duration,u.audioSampleRate=s,u.channelCount=l===0?1:2),o===10){var f=this._parseAACAudioData(e,t+1,n-1);if(f==null)return;if(f.packetType===0){if(u.config){if(x(f.data.config,u.config))return;a.a.w(this.TAG,`AudioSpecificConfig has been changed, re-generate initialization segment`)}var p=f.data;u.audioSampleRate=p.samplingRate,u.channelCount=p.channelCount,u.codec=p.codec,u.originalCodec=p.originalCodec,u.config=p.config,u.refSampleDuration=1024/u.audioSampleRate*u.timescale,a.a.v(this.TAG,`Parsed AudioSpecificConfig`),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata(`audio`,u),(_=this._mediaInfo).audioCodec=u.originalCodec,_.audioSampleRate=u.audioSampleRate,_.audioChannelCount=u.channelCount,_.hasVideo?_.videoCodec!=null&&(_.mimeType=`video/x-flv; codecs="`+_.videoCodec+`,`+_.audioCodec+`"`):_.mimeType=`video/x-flv; codecs="`+_.audioCodec+`"`,_.isComplete()&&this._onMediaInfo(_)}else if(f.packetType===1){var m=this._timestampBase+r,h={unit:f.data,length:f.data.byteLength,dts:m,pts:m};d.samples.push(h),d.length+=f.data.length}else a.a.e(this.TAG,`Flv: Unsupported AAC data type ${f.packetType}`)}else if(o===2){if(!u.codec){var _;if((p=this._parseMP3AudioData(e,t+1,n-1,!0))==null)return;u.audioSampleRate=p.samplingRate,u.channelCount=p.channelCount,u.codec=p.codec,u.originalCodec=p.originalCodec,u.refSampleDuration=1152/u.audioSampleRate*u.timescale,a.a.v(this.TAG,`Parsed MPEG Audio Frame Header`),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata(`audio`,u),(_=this._mediaInfo).audioCodec=u.codec,_.audioSampleRate=u.audioSampleRate,_.audioChannelCount=u.channelCount,_.audioDataRate=p.bitRate,_.hasVideo?_.videoCodec!=null&&(_.mimeType=`video/x-flv; codecs="`+_.videoCodec+`,`+_.audioCodec+`"`):_.mimeType=`video/x-flv; codecs="`+_.audioCodec+`"`,_.isComplete()&&this._onMediaInfo(_)}var v=this._parseMP3AudioData(e,t+1,n-1,!1);if(v==null)return;m=this._timestampBase+r;var y={unit:v,length:v.byteLength,dts:m,pts:m};d.samples.push(y),d.length+=v.length}}else this._onError(g.a.FORMAT_ERROR,`Flv: Invalid audio sample rate idx: `+c)}else this._onError(g.a.CODEC_UNSUPPORTED,`Flv: Unsupported audio codec idx: `+o);else{if(n<=5)return void a.a.w(this.TAG,`Flv: Invalid audio packet, missing AudioFourCC in Ehnanced FLV payload!`);var b=15&i,S=String.fromCharCode.apply(String,new Uint8Array(e,t,n).slice(1,5));switch(S){case`Opus`:this._parseOpusAudioPacket(e,t+5,n-5,r,b);break;case`fLaC`:this._parseFlacAudioPacket(e,t+5,n-5,r,b);break;default:this._onError(g.a.CODEC_UNSUPPORTED,`Flv: Unsupported audio codec: `+S)}}}},e.prototype._parseAACAudioData=function(e,t,n){if(!(n<=1)){var r={},i=new Uint8Array(e,t,n);return r.packetType=i[0],i[0]===0?r.data=this._parseAACAudioSpecificConfig(e,t+1,n-1):r.data=i.subarray(1),r}a.a.w(this.TAG,`Flv: Invalid AAC packet, missing AACPacketType or/and Data!`)},e.prototype._parseAACAudioSpecificConfig=function(e,t,n){var r,i,a=new Uint8Array(e,t,n),o=null,s=0,c=null;if(s=r=a[0]>>>3,(i=(7&a[0])<<1|a[1]>>>7)<0||i>=this._mpegSamplingRates.length)this._onError(g.a.FORMAT_ERROR,`Flv: AAC invalid sampling frequency index!`);else{var l=this._mpegSamplingRates[i],u=(120&a[1])>>>3;if(!(u<0||u>=8)){s===5&&(c=(7&a[1])<<1|a[2]>>>7,(124&a[2])>>>2);var d=self.navigator.userAgent.toLowerCase();return d.indexOf(`firefox`)===-1?d.indexOf(`android`)===-1?(s=5,c=i,o=[,,,,],i>=6?c=i-3:u===1&&(s=2,o=[,,],c=i)):(s=2,o=[,,],c=i):i>=6?(s=5,o=[,,,,],c=i-3):(s=2,o=[,,],c=i),o[0]=s<<3,o[0]|=(15&i)>>>1,o[1]=(15&i)<<7,o[1]|=(15&u)<<3,s===5&&(o[1]|=(15&c)>>>1,o[2]=(1&c)<<7,o[2]|=8,o[3]=0),{config:o,samplingRate:l,channelCount:u,codec:`mp4a.40.`+s,originalCodec:`mp4a.40.`+r}}this._onError(g.a.FORMAT_ERROR,`Flv: AAC invalid channel configuration`)}},e.prototype._parseMP3AudioData=function(e,t,n,r){if(!(n<4)){this._littleEndian;var i=new Uint8Array(e,t,n),o=null;if(r){if(i[0]!==255)return;var s=i[1]>>>3&3,c=(6&i[1])>>1,l=(240&i[2])>>>4,u=(12&i[2])>>>2,d=(i[3]>>>6&3)==3?1:2,f=0,p=0;switch(s){case 0:f=this._mpegAudioV25SampleRateTable[u];break;case 2:f=this._mpegAudioV20SampleRateTable[u];break;case 3:f=this._mpegAudioV10SampleRateTable[u]}switch(c){case 1:l<this._mpegAudioL3BitRateTable.length&&(p=this._mpegAudioL3BitRateTable[l]);break;case 2:l<this._mpegAudioL2BitRateTable.length&&(p=this._mpegAudioL2BitRateTable[l]);break;case 3:l<this._mpegAudioL1BitRateTable.length&&(p=this._mpegAudioL1BitRateTable[l])}o={bitRate:p,samplingRate:f,channelCount:d,codec:`mp3`,originalCodec:`mp3`}}else o=i;return o}a.a.w(this.TAG,`Flv: Invalid MP3 packet, header missing!`)},e.prototype._parseOpusAudioPacket=function(e,t,n,r,i){if(i===0)this._parseOpusSequenceHeader(e,t,n);else if(i===1)this._parseOpusAudioData(e,t,n,r);else if(i!==2)return void this._onError(g.a.FORMAT_ERROR,`Flv: Invalid video packet type ${i}`)},e.prototype._parseOpusSequenceHeader=function(e,t,n){if(n<=16)a.a.w(this.TAG,`Flv: Invalid OpusSequenceHeader, lack of data!`);else{var r=this._audioMetadata,i=this._audioTrack;r||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(r=this._audioMetadata={}).type=`audio`,r.id=i.id,r.timescale=this._timescale,r.duration=this._duration);var o=new DataView(e,t,n);o.setUint8(8,0);var s=o.getUint8(9);o.setUint16(10,o.getUint16(10,!0),!1);var c=o.getUint32(12,!0);o.setUint32(12,o.getUint32(12,!0),!1);var l={config:new Uint8Array(e,t+8,n-8),channelCount:s,samplingFrequence:c,codec:`opus`,originalCodec:`opus`};if(r.config){if(x(l.config,r.config))return;a.a.w(this.TAG,`OpusSequenceHeader has been changed, re-generate initialization segment`)}r.audioSampleRate=l.samplingFrequence,r.channelCount=l.channelCount,r.codec=l.codec,r.originalCodec=l.originalCodec,r.config=l.config,r.refSampleDuration=20,a.a.v(this.TAG,`Parsed OpusSequenceHeader`),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata(`audio`,r);var u=this._mediaInfo;u.audioCodec=r.originalCodec,u.audioSampleRate=r.audioSampleRate,u.audioChannelCount=r.channelCount,u.hasVideo?u.videoCodec!=null&&(u.mimeType=`video/x-flv; codecs="`+u.videoCodec+`,`+u.audioCodec+`"`):u.mimeType=`video/x-flv; codecs="`+u.audioCodec+`"`,u.isComplete()&&this._onMediaInfo(u)}},e.prototype._parseOpusAudioData=function(e,t,n,r){var i=this._audioTrack,a=new Uint8Array(e,t,n),o=this._timestampBase+r,s={unit:a,length:a.byteLength,dts:o,pts:o};i.samples.push(s),i.length+=a.length},e.prototype._parseFlacAudioPacket=function(e,t,n,r,i){if(i===0)this._parseFlacSequenceHeader(e,t,n);else if(i===1)this._parseFlacAudioData(e,t,n,r);else if(i!==2)return void this._onError(g.a.FORMAT_ERROR,`Flv: Invalid Flac audio packet type ${i}`)},e.prototype._parseFlacSequenceHeader=function(e,t,n){var r=this._audioMetadata,i=this._audioTrack;r||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(r=this._audioMetadata={}).type=`audio`,r.id=i.id,r.timescale=this._timescale,r.duration=this._duration);var o=new Uint8Array(e,t+4,n-4),s=new m(o),c=s.readBits(16),l=s.readBits(16),u=l===c?l:null;s.readBits(24),s.readBits(24);var d=s.readBits(20),f=s.readBits(3)+1,p=s.readBits(5)+1;s.destroy();var h=new Uint8Array(o.byteLength+4);h.set(o,4),h[0]=128,h[1]=o.byteLength>>>16&255,h[2]=o.byteLength>>>8&255,h[3]=o.byteLength>>>0&255;var g={config:h,channelCount:f,samplingFrequence:d,sampleSize:p,codec:`flac`,originalCodec:`flac`};if(r.config){if(x(g.config,r.config))return;a.a.w(this.TAG,`FlacSequenceHeader has been changed, re-generate initialization segment`)}r.audioSampleRate=g.samplingFrequence,r.channelCount=g.channelCount,r.sampleSize=g.sampleSize,r.codec=g.codec,r.originalCodec=g.originalCodec,r.config=g.config,r.refSampleDuration=u==null?null:1e3*u/g.samplingFrequence,a.a.v(this.TAG,`Parsed FlacSequenceHeader`),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata(`audio`,r);var _=this._mediaInfo;_.audioCodec=r.originalCodec,_.audioSampleRate=r.audioSampleRate,_.audioChannelCount=r.channelCount,_.hasVideo?_.videoCodec!=null&&(_.mimeType=`video/x-flv; codecs="`+_.videoCodec+`,`+_.audioCodec+`"`):_.mimeType=`video/x-flv; codecs="`+_.audioCodec+`"`,_.isComplete()&&this._onMediaInfo(_)},e.prototype._parseFlacAudioData=function(e,t,n,r){var i=this._audioTrack,a=new Uint8Array(e,t,n),o=this._timestampBase+r,s={unit:a,length:a.byteLength,dts:o,pts:o};i.samples.push(s),i.length+=a.length},e.prototype._parseVideoData=function(e,t,n,r,i){if(n<=1)a.a.w(this.TAG,`Flv: Invalid video packet, missing VideoData payload!`);else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var o=new Uint8Array(e,t,n)[0],s=(112&o)>>>4;if(128&o){var c=15&o,l=String.fromCharCode.apply(String,new Uint8Array(e,t,n).slice(1,5));if(l===`hvc1`)this._parseEnhancedHEVCVideoPacket(e,t+5,n-5,r,i,s,c);else{if(l!==`av01`)return void this._onError(g.a.CODEC_UNSUPPORTED,`Flv: Unsupported codec in video frame: ${l}`);this._parseEnhancedAV1VideoPacket(e,t+5,n-5,r,i,s,c)}}else{var u=15&o;if(u===7)this._parseAVCVideoPacket(e,t+1,n-1,r,i,s);else{if(u!==12)return void this._onError(g.a.CODEC_UNSUPPORTED,`Flv: Unsupported codec in video frame: ${u}`);this._parseHEVCVideoPacket(e,t+1,n-1,r,i,s)}}}},e.prototype._parseAVCVideoPacket=function(e,t,n,r,i,o){if(n<4)a.a.w(this.TAG,`Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime`);else{var s=this._littleEndian,c=new DataView(e,t,n),l=c.getUint8(0),u=(16777215&c.getUint32(0,!s))<<8>>8;if(l===0)this._parseAVCDecoderConfigurationRecord(e,t+4,n-4);else if(l===1)this._parseAVCVideoData(e,t+4,n-4,r,i,o,u);else if(l!==2)return void this._onError(g.a.FORMAT_ERROR,`Flv: Invalid video packet type ${l}`)}},e.prototype._parseHEVCVideoPacket=function(e,t,n,r,i,o){if(n<4)a.a.w(this.TAG,`Flv: Invalid HEVC packet, missing HEVCPacketType or/and CompositionTime`);else{var s=this._littleEndian,c=new DataView(e,t,n),l=c.getUint8(0),u=(16777215&c.getUint32(0,!s))<<8>>8;if(l===0)this._parseHEVCDecoderConfigurationRecord(e,t+4,n-4);else if(l===1)this._parseHEVCVideoData(e,t+4,n-4,r,i,o,u);else if(l!==2)return void this._onError(g.a.FORMAT_ERROR,`Flv: Invalid video packet type ${l}`)}},e.prototype._parseEnhancedHEVCVideoPacket=function(e,t,n,r,i,a,o){var s=this._littleEndian,c=new DataView(e,t,n);if(o===0)this._parseHEVCDecoderConfigurationRecord(e,t,n);else if(o===1){var l=(4294967040&c.getUint32(0,!s))>>8;this._parseHEVCVideoData(e,t+3,n-3,r,i,a,l)}else if(o===3)this._parseHEVCVideoData(e,t,n,r,i,a,0);else if(o!==2)return void this._onError(g.a.FORMAT_ERROR,`Flv: Invalid video packet type ${o}`)},e.prototype._parseEnhancedAV1VideoPacket=function(e,t,n,r,i,a,o){if(this._littleEndian,new DataView(e,t,n),o===0)this._parseAV1CodecConfigurationRecord(e,t,n);else if(o===1)this._parseAV1VideoData(e,t,n,r,i,a,0);else{if(o===5)return void this._onError(g.a.FORMAT_ERROR,`Flv: Not Supported MP2T AV1 video packet type ${o}`);if(o!==2)return void this._onError(g.a.FORMAT_ERROR,`Flv: Invalid video packet type ${o}`)}},e.prototype._parseAVCDecoderConfigurationRecord=function(e,t,n){if(n<7)a.a.w(this.TAG,`Flv: Invalid AVCDecoderConfigurationRecord, lack of data!`);else{var r=this._videoMetadata,i=this._videoTrack,o=this._littleEndian,s=new DataView(e,t,n);if(r){if(r.avcc!==void 0){if(x(new Uint8Array(e,t,n),r.avcc))return;a.a.w(this.TAG,`AVCDecoderConfigurationRecord has been changed, re-generate initialization segment`)}}else !1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(r=this._videoMetadata={}).type=`video`,r.id=i.id,r.timescale=this._timescale,r.duration=this._duration;var c=s.getUint8(0),l=s.getUint8(1);if(s.getUint8(2),s.getUint8(3),c===1&&l!==0)if(this._naluLengthSize=1+(3&s.getUint8(4)),this._naluLengthSize===3||this._naluLengthSize===4){var u=31&s.getUint8(5);if(u!==0){u>1&&a.a.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ${u}`);for(var d=6,f=0;f<u;f++){var p=s.getUint16(d,!o);if(d+=2,p!==0){var m=new Uint8Array(e,t+d,p);d+=p;var _=h.parseSPS(m);if(f===0){r.codecWidth=_.codec_size.width,r.codecHeight=_.codec_size.height,r.presentWidth=_.present_size.width,r.presentHeight=_.present_size.height,r.profile=_.profile_string,r.level=_.level_string,r.bitDepth=_.bit_depth,r.chromaFormat=_.chroma_format,r.sarRatio=_.sar_ratio,r.frameRate=_.frame_rate,!1!==_.frame_rate.fixed&&_.frame_rate.fps_num!==0&&_.frame_rate.fps_den!==0||(r.frameRate=this._referenceFrameRate);var v=r.frameRate.fps_den,y=r.frameRate.fps_num;r.refSampleDuration=r.timescale*(v/y);for(var b=m.subarray(1,4),S=`avc1.`,C=0;C<3;C++){var w=b[C].toString(16);w.length<2&&(w=`0`+w),S+=w}r.codec=S;var T=this._mediaInfo;T.width=r.codecWidth,T.height=r.codecHeight,T.fps=r.frameRate.fps,T.profile=r.profile,T.level=r.level,T.refFrames=_.ref_frames,T.chromaFormat=_.chroma_format_string,T.sarNum=r.sarRatio.width,T.sarDen=r.sarRatio.height,T.videoCodec=S,T.hasAudio?T.audioCodec!=null&&(T.mimeType=`video/x-flv; codecs="`+T.videoCodec+`,`+T.audioCodec+`"`):T.mimeType=`video/x-flv; codecs="`+T.videoCodec+`"`,T.isComplete()&&this._onMediaInfo(T)}}}var E=s.getUint8(d);if(E!==0){for(E>1&&a.a.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ${E}`),d++,f=0;f<E;f++)p=s.getUint16(d,!o),d+=2,p!==0&&(d+=p);r.avcc=new Uint8Array(n),r.avcc.set(new Uint8Array(e,t,n),0),a.a.v(this.TAG,`Parsed AVCDecoderConfigurationRecord`),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata(`video`,r)}else this._onError(g.a.FORMAT_ERROR,`Flv: Invalid AVCDecoderConfigurationRecord: No PPS`)}else this._onError(g.a.FORMAT_ERROR,`Flv: Invalid AVCDecoderConfigurationRecord: No SPS`)}else this._onError(g.a.FORMAT_ERROR,`Flv: Strange NaluLengthSizeMinusOne: ${this._naluLengthSize-1}`);else this._onError(g.a.FORMAT_ERROR,`Flv: Invalid AVCDecoderConfigurationRecord`)}},e.prototype._parseHEVCDecoderConfigurationRecord=function(e,t,n){if(n<22)a.a.w(this.TAG,`Flv: Invalid HEVCDecoderConfigurationRecord, lack of data!`);else{var r=this._videoMetadata,i=this._videoTrack,o=this._littleEndian,s=new DataView(e,t,n);if(r){if(r.hvcc!==void 0){if(x(new Uint8Array(e,t,n),r.hvcc))return;a.a.w(this.TAG,`HEVCDecoderConfigurationRecord has been changed, re-generate initialization segment`)}}else !1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(r=this._videoMetadata={}).type=`video`,r.id=i.id,r.timescale=this._timescale,r.duration=this._duration;var c=s.getUint8(0),l=31&s.getUint8(1);if(c!==0&&c!==1||l===0)this._onError(g.a.FORMAT_ERROR,`Flv: Invalid HEVCDecoderConfigurationRecord`);else if(this._naluLengthSize=1+(3&s.getUint8(21)),this._naluLengthSize===3||this._naluLengthSize===4){for(var u=s.getUint8(22),d=0,f=23;d<u;d++){var p=63&s.getUint8(f+0),m=s.getUint16(f+1,!o);f+=3;for(var h=0;h<m;h++){var v=s.getUint16(f+0,!o);if(h===0)if(p===33){f+=2;var y=new Uint8Array(e,t+f,v),b=_.parseSPS(y);r.codecWidth=b.codec_size.width,r.codecHeight=b.codec_size.height,r.presentWidth=b.present_size.width,r.presentHeight=b.present_size.height,r.profile=b.profile_string,r.level=b.level_string,r.bitDepth=b.bit_depth,r.chromaFormat=b.chroma_format,r.sarRatio=b.sar_ratio,r.frameRate=b.frame_rate,!1!==b.frame_rate.fixed&&b.frame_rate.fps_num!==0&&b.frame_rate.fps_den!==0||(r.frameRate=this._referenceFrameRate);var S=r.frameRate.fps_den,C=r.frameRate.fps_num;r.refSampleDuration=r.timescale*(S/C),r.codec=b.codec_mimetype;var w=this._mediaInfo;w.width=r.codecWidth,w.height=r.codecHeight,w.fps=r.frameRate.fps,w.profile=r.profile,w.level=r.level,w.refFrames=b.ref_frames,w.chromaFormat=b.chroma_format_string,w.sarNum=r.sarRatio.width,w.sarDen=r.sarRatio.height,w.videoCodec=b.codec_mimetype,w.hasAudio?w.audioCodec!=null&&(w.mimeType=`video/x-flv; codecs="`+w.videoCodec+`,`+w.audioCodec+`"`):w.mimeType=`video/x-flv; codecs="`+w.videoCodec+`"`,w.isComplete()&&this._onMediaInfo(w),f+=v}else f+=2+v;else f+=2+v}}r.hvcc=new Uint8Array(n),r.hvcc.set(new Uint8Array(e,t,n),0),a.a.v(this.TAG,`Parsed HEVCDecoderConfigurationRecord`),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata(`video`,r)}else this._onError(g.a.FORMAT_ERROR,`Flv: Strange NaluLengthSizeMinusOne: ${this._naluLengthSize-1}`)}},e.prototype._parseAV1CodecConfigurationRecord=function(e,t,n){if(n<4)a.a.w(this.TAG,`Flv: Invalid AV1CodecConfigurationRecord, lack of data!`);else{var r=this._videoMetadata,i=this._videoTrack,o=(this._littleEndian,new DataView(e,t,n));r?r.av1c!==void 0&&a.a.w(this.TAG,`Found another AV1CodecConfigurationRecord!`):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(r=this._videoMetadata={}).type=`video`,r.id=i.id,r.timescale=this._timescale,r.duration=this._duration);var s=127&o.getUint8(0);if(o.getUint8(1),o.getUint8(1),o.getUint8(2),s===1){var c=C.parseOBUs(new Uint8Array(e,t+4,n-4));if(c!=null){r.profile=c.profile_string,r.level=c.level_string,r.bitDepth=c.bit_depth,r.chromaFormat=c.chroma_format,r.frameRate=c.frame_rate,!1!==c.frame_rate.fixed&&c.frame_rate.fps_num!==0&&c.frame_rate.fps_den!==0||(r.frameRate=this._referenceFrameRate);var l=r.frameRate.fps_den,u=r.frameRate.fps_num;r.refSampleDuration=r.timescale*(l/u),r.codec=c.codec_mimetype,r.extra=c;var d=this._mediaInfo;d.fps=r.frameRate.fps,d.profile=r.profile,d.level=r.level,d.refFrames=c.ref_frames,d.chromaFormat=c.chroma_format_string,d.videoCodec=c.codec_mimetype,d.hasAudio?d.audioCodec!=null&&(d.mimeType=`video/x-flv; codecs="`+d.videoCodec+`,`+d.audioCodec+`"`):d.mimeType=`video/x-flv; codecs="`+d.videoCodec+`"`,d.isComplete()&&this._onMediaInfo(d),r.av1c=new Uint8Array(n),r.av1c.set(new Uint8Array(e,t,n),0),a.a.v(this.TAG,`Preparing AV1CodecConfigurationRecord`)}else this._onError(g.a.FORMAT_ERROR,`Flv: Invalid AV1CodecConfigurationRecord`)}else this._onError(g.a.FORMAT_ERROR,`Flv: Invalid AV1CodecConfigurationRecord`)}},e.prototype._parseAVCVideoData=function(e,t,n,r,i,o,s){for(var c=this._littleEndian,l=new DataView(e,t,n),u=[],d=0,f=0,p=this._naluLengthSize,m=this._timestampBase+r,h=o===1;f<n;){if(f+4>=n){a.a.w(this.TAG,`Malformed Nalu near timestamp ${m}, offset = ${f}, dataSize = ${n}`);break}var g=l.getUint32(f,!c);if(p===3&&(g>>>=8),g>n-p)return void a.a.w(this.TAG,`Malformed Nalus near timestamp ${m}, NaluSize > DataSize!`);var _=31&l.getUint8(f+p);_===5&&(h=!0);var v=new Uint8Array(e,t+f,p+g),y={type:_,data:v};u.push(y),d+=v.byteLength,f+=p+g}if(u.length){var b=this._videoTrack,x={units:u,length:d,isKeyframe:h,dts:m,cts:s,pts:m+s};h&&(x.fileposition=i),b.samples.push(x),b.length+=d}},e.prototype._parseHEVCVideoData=function(e,t,n,r,i,o,s){for(var c=this._littleEndian,l=new DataView(e,t,n),u=[],d=0,f=0,p=this._naluLengthSize,m=this._timestampBase+r,h=o===1;f<n;){if(f+4>=n){a.a.w(this.TAG,`Malformed Nalu near timestamp ${m}, offset = ${f}, dataSize = ${n}`);break}var g=l.getUint32(f,!c);if(p===3&&(g>>>=8),g>n-p)return void a.a.w(this.TAG,`Malformed Nalus near timestamp ${m}, NaluSize > DataSize!`);var _=l.getUint8(f+p)>>1&63;_!==19&&_!==20&&_!==21||(h=!0);var v=new Uint8Array(e,t+f,p+g),y={type:_,data:v};u.push(y),d+=v.byteLength,f+=p+g}if(u.length){var b=this._videoTrack,x={units:u,length:d,isKeyframe:h,dts:m,cts:s,pts:m+s};h&&(x.fileposition=i),b.samples.push(x),b.length+=d}},e.prototype._parseAV1VideoData=function(e,t,n,r,i,o,s){this._littleEndian,new DataView(e,t,n);var c,l=[],u=this._timestampBase+r,d=o===1;if(d){var f=this._videoMetadata,p=C.parseOBUs(new Uint8Array(e,t,n),f.extra);if(p==null)return void this._onError(g.a.FORMAT_ERROR,`Flv: Invalid AV1 VideoData`);console.log(p),f.codecWidth=p.codec_size.width,f.codecHeight=p.codec_size.height,f.presentWidth=p.present_size.width,f.presentHeight=p.present_size.height,f.sarRatio=p.sar_ratio;var m=this._mediaInfo;m.width=f.codecWidth,m.height=f.codecHeight,m.sarNum=f.sarRatio.width,m.sarDen=f.sarRatio.height,a.a.v(this.TAG,`Parsed AV1DecoderConfigurationRecord`),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata(`video`,f)}if(c=n,l.push({unitType:0,data:new Uint8Array(e,t+0,n)}),l.length){var h=this._videoTrack,_={units:l,length:c,isKeyframe:d,dts:u,cts:s,pts:u+s};d&&(_.fileposition=i),h.samples.push(_),h.length+=c}},e}(),E=function(){function e(){}return e.prototype.destroy=function(){this.onError=null,this.onMediaInfo=null,this.onMetaDataArrived=null,this.onTrackMetadata=null,this.onDataAvailable=null,this.onTimedID3Metadata=null,this.onSynchronousKLVMetadata=null,this.onAsynchronousKLVMetadata=null,this.onSMPTE2038Metadata=null,this.onSCTE35Metadata=null,this.onPESPrivateData=null,this.onPESPrivateDataDescriptor=null},e}(),D=function(){this.program_pmt_pid={}};(function(e){e[e.kMPEG1Audio=3]=`kMPEG1Audio`,e[e.kMPEG2Audio=4]=`kMPEG2Audio`,e[e.kPESPrivateData=6]=`kPESPrivateData`,e[e.kADTSAAC=15]=`kADTSAAC`,e[e.kLOASAAC=17]=`kLOASAAC`,e[e.kAC3=129]=`kAC3`,e[e.kEAC3=135]=`kEAC3`,e[e.kMetadata=21]=`kMetadata`,e[e.kSCTE35=134]=`kSCTE35`,e[e.kH264=27]=`kH264`,e[e.kH265=36]=`kH265`})(w||={});var O,k=function(){this.pid_stream_type={},this.common_pids={h264:void 0,h265:void 0,av1:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},this.pes_private_data_pids={},this.timed_id3_pids={},this.synchronous_klv_pids={},this.asynchronous_klv_pids={},this.scte_35_pids={},this.smpte2038_pids={}},A=function(){},j=function(){},M=function(){this.slices=[],this.total_length=0,this.expected_length=0,this.file_position=0};(function(e){e[e.kUnspecified=0]=`kUnspecified`,e[e.kSliceNonIDR=1]=`kSliceNonIDR`,e[e.kSliceDPA=2]=`kSliceDPA`,e[e.kSliceDPB=3]=`kSliceDPB`,e[e.kSliceDPC=4]=`kSliceDPC`,e[e.kSliceIDR=5]=`kSliceIDR`,e[e.kSliceSEI=6]=`kSliceSEI`,e[e.kSliceSPS=7]=`kSliceSPS`,e[e.kSlicePPS=8]=`kSlicePPS`,e[e.kSliceAUD=9]=`kSliceAUD`,e[e.kEndOfSequence=10]=`kEndOfSequence`,e[e.kEndOfStream=11]=`kEndOfStream`,e[e.kFiller=12]=`kFiller`,e[e.kSPSExt=13]=`kSPSExt`,e[e.kReserved0=14]=`kReserved0`})(O||={});var N,P,F=function(){},I=function(e){var t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)},ee=function(){function e(e){this.TAG=`H264AnnexBParser`,this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&a.a.e(this.TAG,`Could not find H264 startcode until payload end!`)}return e.prototype.findNextStartCodeOffset=function(e){for(var t=e,n=this.data_;;){if(t+3>=n.byteLength)return this.eof_flag_=!0,n.byteLength;var r=n[t+0]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3],i=n[t+0]<<16|n[t+1]<<8|n[t+2];if(r===1||i===1)return t;t++}},e.prototype.readNextNaluPayload=function(){for(var e=this.data_,t=null;t==null&&!this.eof_flag_;){var n=this.current_startcode_offset_,r=31&e[n+=(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])==1?4:3],i=(128&e[n])>>>7,a=this.findNextStartCodeOffset(n);if(this.current_startcode_offset_=a,!(r>=O.kReserved0)&&i===0){var o=e.subarray(n,a);(t=new F).type=r,t.data=o}}return t},e}(),L=function(){function e(e,t,n){var r=8+e.byteLength+1+2+t.byteLength,i=!1;e[3]!==66&&e[3]!==77&&e[3]!==88&&(i=!0,r+=4);var a=this.data=new Uint8Array(r);a[0]=1,a[1]=e[1],a[2]=e[2],a[3]=e[3],a[4]=255,a[5]=225;var o=e.byteLength;a[6]=o>>>8,a[7]=255&o;var s=8;a.set(e,8),a[s+=o]=1;var c=t.byteLength;a[s+1]=c>>>8,a[s+2]=255&c,a.set(t,s+3),s+=3+c,i&&(a[s]=252|n.chroma_format_idc,a[s+1]=248|n.bit_depth_luma-8,a[s+2]=248|n.bit_depth_chroma-8,a[s+3]=0,s+=4)}return e.prototype.getData=function(){return this.data},e}();(function(e){e[e.kNull=0]=`kNull`,e[e.kAACMain=1]=`kAACMain`,e[e.kAAC_LC=2]=`kAAC_LC`,e[e.kAAC_SSR=3]=`kAAC_SSR`,e[e.kAAC_LTP=4]=`kAAC_LTP`,e[e.kAAC_SBR=5]=`kAAC_SBR`,e[e.kAAC_Scalable=6]=`kAAC_Scalable`,e[e.kLayer1=32]=`kLayer1`,e[e.kLayer2=33]=`kLayer2`,e[e.kLayer3=34]=`kLayer3`})(N||={}),function(e){e[e.k96000Hz=0]=`k96000Hz`,e[e.k88200Hz=1]=`k88200Hz`,e[e.k64000Hz=2]=`k64000Hz`,e[e.k48000Hz=3]=`k48000Hz`,e[e.k44100Hz=4]=`k44100Hz`,e[e.k32000Hz=5]=`k32000Hz`,e[e.k24000Hz=6]=`k24000Hz`,e[e.k22050Hz=7]=`k22050Hz`,e[e.k16000Hz=8]=`k16000Hz`,e[e.k12000Hz=9]=`k12000Hz`,e[e.k11025Hz=10]=`k11025Hz`,e[e.k8000Hz=11]=`k8000Hz`,e[e.k7350Hz=12]=`k7350Hz`}(P||={});var R,te,ne=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],re=(R=function(e,t){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}R(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),ie=function(){},ae=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return re(t,e),t}(ie),oe=function(){function e(e){this.TAG=`AACADTSParser`,this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&a.a.e(this.TAG,`Could not found ADTS syncword until payload end`)}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,n=this.data_;;){if(t+7>=n.byteLength)return this.eof_flag_=!0,n.byteLength;if((n[t+0]<<8|n[t+1])>>>4==4095)return t;t++}},e.prototype.readNextAACFrame=function(){for(var e=this.data_,t=null;t==null&&!this.eof_flag_;){var n=this.current_syncword_offset_,r=(8&e[n+1])>>>3,i=(6&e[n+1])>>>1,a=1&e[n+1],o=(192&e[n+2])>>>6,s=(60&e[n+2])>>>2,c=(1&e[n+2])<<2|(192&e[n+3])>>>6,l=(3&e[n+3])<<11|e[n+4]<<3|(224&e[n+5])>>>5;if(e[n+6],n+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var u=a===1?7:9,d=l-u;if(n+=u,this.current_syncword_offset_=this.findNextSyncwordOffset(n+d),(r===0||r===1)&&i===0){var f=e.subarray(n,n+d);(t=new ie).audio_object_type=o+1,t.sampling_freq_index=s,t.sampling_frequency=ne[s],t.channel_config=c,t.data=f}}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),se=function(){function e(e){this.TAG=`AACLOASParser`,this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&a.a.e(this.TAG,`Could not found LOAS syncword until payload end`)}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,n=this.data_;;){if(t+1>=n.byteLength)return this.eof_flag_=!0,n.byteLength;if((n[t+0]<<3|n[t+1]>>>5)==695)return t;t++}},e.prototype.getLATMValue=function(e){for(var t=e.readBits(2),n=0,r=0;r<=t;r++)n<<=8,n|=e.readByte();return n},e.prototype.readNextAACFrame=function(e){for(var t=this.data_,n=null;n==null&&!this.eof_flag_;){var r=this.current_syncword_offset_,i=(31&t[r+1])<<8|t[r+2];if(r+3+i>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var o=new m(t.subarray(r+3,r+3+i)),s=null;if(o.readBool()){if(e==null){a.a.w(this.TAG,`StreamMuxConfig Missing`),this.current_syncword_offset_=this.findNextSyncwordOffset(r+3+i),o.destroy();continue}s=e}else{var c=o.readBool();if(c&&o.readBool()){a.a.e(this.TAG,`audioMuxVersionA is Not Supported`),o.destroy();break}if(c&&this.getLATMValue(o),!o.readBool()){a.a.e(this.TAG,`allStreamsSameTimeFraming zero is Not Supported`),o.destroy();break}if(o.readBits(6)!==0){a.a.e(this.TAG,`more than 2 numSubFrames Not Supported`),o.destroy();break}if(o.readBits(4)!==0){a.a.e(this.TAG,`more than 2 numProgram Not Supported`),o.destroy();break}if(o.readBits(3)!==0){a.a.e(this.TAG,`more than 2 numLayer Not Supported`),o.destroy();break}var l=c?this.getLATMValue(o):0,u=o.readBits(5);l-=5;var d=o.readBits(4);l-=4;var f=o.readBits(4);l-=4,o.readBits(3),(l-=3)>0&&o.readBits(l);var p=o.readBits(3);if(p!==0){a.a.e(this.TAG,`frameLengthType = ${p}. Only frameLengthType = 0 Supported`),o.destroy();break}o.readByte();var h=o.readBool();if(h)if(c)this.getLATMValue(o);else{for(var g=0;;){g<<=8;var _=o.readBool();if(g+=o.readByte(),!_)break}console.log(g)}o.readBool()&&o.readByte(),(s=new ae).audio_object_type=u,s.sampling_freq_index=d,s.sampling_frequency=ne[s.sampling_freq_index],s.channel_config=f,s.other_data_present=h}for(var v=0;;){var y=o.readByte();if(v+=y,y!==255)break}for(var b=new Uint8Array(v),x=0;x<v;x++)b[x]=o.readByte();(n=new ae).audio_object_type=s.audio_object_type,n.sampling_freq_index=s.sampling_freq_index,n.sampling_frequency=ne[s.sampling_freq_index],n.channel_config=s.channel_config,n.other_data_present=s.other_data_present,n.data=b,this.current_syncword_offset_=this.findNextSyncwordOffset(r+3+i)}return n},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),ce=function(e){var t=null,n=e.audio_object_type,r=e.audio_object_type,i=e.sampling_freq_index,a=e.channel_config,o=0,s=navigator.userAgent.toLowerCase();s.indexOf(`firefox`)===-1?s.indexOf(`android`)===-1?(r=5,o=i,t=[,,,,],i>=6?o=i-3:a===1&&(r=2,t=[,,],o=i)):(r=2,t=[,,],o=i):i>=6?(r=5,t=[,,,,],o=i-3):(r=2,t=[,,],o=i),t[0]=r<<3,t[0]|=(15&i)>>>1,t[1]=(15&i)<<7,t[1]|=(15&a)<<3,r===5&&(t[1]|=(15&o)>>>1,t[2]=(1&o)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=ne[i],this.channel_count=a,this.codec_mimetype=`mp4a.40.`+r,this.original_codec_mimetype=`mp4a.40.`+n},le=function(){},ue=function(){};(function(e){e[e.kSpliceNull=0]=`kSpliceNull`,e[e.kSpliceSchedule=4]=`kSpliceSchedule`,e[e.kSpliceInsert=5]=`kSpliceInsert`,e[e.kTimeSignal=6]=`kTimeSignal`,e[e.kBandwidthReservation=7]=`kBandwidthReservation`,e[e.kPrivateCommand=255]=`kPrivateCommand`})(te||={});var de,fe=function(e){var t=e.readBool();return t?(e.readBits(6),{time_specified_flag:t,pts_time:4*e.readBits(31)+e.readBits(2)}):(e.readBits(7),{time_specified_flag:t})},pe=function(e){var t=e.readBool();return e.readBits(6),{auto_return:t,duration:4*e.readBits(31)+e.readBits(2)}},me=function(e,t){var n=t.readBits(8);return e?{component_tag:n}:{component_tag:n,splice_time:fe(t)}},he=function(e){return{component_tag:e.readBits(8),utc_splice_time:e.readBits(32)}},ge=function(e){var t=e.readBits(32),n=e.readBool();e.readBits(7);var r={splice_event_id:t,splice_event_cancel_indicator:n};if(n)return r;if(r.out_of_network_indicator=e.readBool(),r.program_splice_flag=e.readBool(),r.duration_flag=e.readBool(),e.readBits(5),r.program_splice_flag)r.utc_splice_time=e.readBits(32);else{r.component_count=e.readBits(8),r.components=[];for(var i=0;i<r.component_count;i++)r.components.push(he(e))}return r.duration_flag&&(r.break_duration=pe(e)),r.unique_program_id=e.readBits(16),r.avail_num=e.readBits(8),r.avails_expected=e.readBits(8),r},_e=function(e,t,n,r){return{descriptor_tag:e,descriptor_length:t,identifier:n,provider_avail_id:r.readBits(32)}},ve=function(e,t,n,r){var i=r.readBits(8),a=r.readBits(3);r.readBits(5);for(var o=``,s=0;s<a;s++)o+=String.fromCharCode(r.readBits(8));return{descriptor_tag:e,descriptor_length:t,identifier:n,preroll:i,dtmf_count:a,DTMF_char:o}},ye=function(e){var t=e.readBits(8);return e.readBits(7),{component_tag:t,pts_offset:4*e.readBits(31)+e.readBits(2)}},be=function(e,t,n,r){var i=r.readBits(32),a=r.readBool();r.readBits(7);var o={descriptor_tag:e,descriptor_length:t,identifier:n,segmentation_event_id:i,segmentation_event_cancel_indicator:a};if(a)return o;if(o.program_segmentation_flag=r.readBool(),o.segmentation_duration_flag=r.readBool(),o.delivery_not_restricted_flag=r.readBool(),o.delivery_not_restricted_flag?r.readBits(5):(o.web_delivery_allowed_flag=r.readBool(),o.no_regional_blackout_flag=r.readBool(),o.archive_allowed_flag=r.readBool(),o.device_restrictions=r.readBits(2)),!o.program_segmentation_flag){o.component_count=r.readBits(8),o.components=[];for(var s=0;s<o.component_count;s++)o.components.push(ye(r))}o.segmentation_duration_flag&&(o.segmentation_duration=r.readBits(40)),o.segmentation_upid_type=r.readBits(8),o.segmentation_upid_length=r.readBits(8);var c=new Uint8Array(o.segmentation_upid_length);for(s=0;s<o.segmentation_upid_length;s++)c[s]=r.readBits(8);return o.segmentation_upid=c.buffer,o.segmentation_type_id=r.readBits(8),o.segment_num=r.readBits(8),o.segments_expected=r.readBits(8),o.segmentation_type_id!==52&&o.segmentation_type_id!==54&&o.segmentation_type_id!==56&&o.segmentation_type_id!==58||(o.sub_segment_num=r.readBits(8),o.sub_segments_expected=r.readBits(8)),o},xe=function(e,t,n,r){return{descriptor_tag:e,descriptor_length:t,identifier:n,TAI_seconds:r.readBits(48),TAI_ns:r.readBits(32),UTC_offset:r.readBits(16)}},Se=function(e){return{component_tag:e.readBits(8),ISO_code:String.fromCharCode(e.readBits(8),e.readBits(8),e.readBits(8)),Bit_Stream_Mode:e.readBits(3),Num_Channels:e.readBits(4),Full_Srvc_Audio:e.readBool()}},Ce=function(e,t,n,r){for(var i=r.readBits(4),a=[],o=0;o<i;o++)a.push(Se(r));return{descriptor_tag:e,descriptor_length:t,identifier:n,audio_count:i,components:a}},we=function(e){var t=new m(e),n=t.readBits(8),r=t.readBool(),i=t.readBool();t.readBits(2);var a=t.readBits(12),o=t.readBits(8),s=t.readBool(),c=t.readBits(6),l=4*t.readBits(31)+t.readBits(2),u=t.readBits(8),d=t.readBits(12),f=t.readBits(12),p=t.readBits(8),h=null;p===te.kSpliceNull?h={}:p===te.kSpliceSchedule?h=function(e){for(var t=e.readBits(8),n=[],r=0;r<t;r++)n.push(ge(e));return{splice_count:t,events:n}}(t):p===te.kSpliceInsert?h=function(e){var t=e.readBits(32),n=e.readBool();e.readBits(7);var r={splice_event_id:t,splice_event_cancel_indicator:n};if(n)return r;if(r.out_of_network_indicator=e.readBool(),r.program_splice_flag=e.readBool(),r.duration_flag=e.readBool(),r.splice_immediate_flag=e.readBool(),e.readBits(4),r.program_splice_flag&&!r.splice_immediate_flag&&(r.splice_time=fe(e)),!r.program_splice_flag){r.component_count=e.readBits(8),r.components=[];for(var i=0;i<r.component_count;i++)r.components.push(me(r.splice_immediate_flag,e))}return r.duration_flag&&(r.break_duration=pe(e)),r.unique_program_id=e.readBits(16),r.avail_num=e.readBits(8),r.avails_expected=e.readBits(8),r}(t):p===te.kTimeSignal?h=function(e){return{splice_time:fe(e)}}(t):p===te.kBandwidthReservation?h={}:p===te.kPrivateCommand?h=function(e,t){for(var n=String.fromCharCode(t.readBits(8),t.readBits(8),t.readBits(8),t.readBits(8)),r=new Uint8Array(e-4),i=0;i<e-4;i++)r[i]=t.readBits(8);return{identifier:n,private_data:r.buffer}}(f,t):t.readBits(8*f);for(var g=[],_=t.readBits(16),v=0;v<_;){var y=t.readBits(8),b=t.readBits(8),x=String.fromCharCode(t.readBits(8),t.readBits(8),t.readBits(8),t.readBits(8));y===0?g.push(_e(y,b,x,t)):y===1?g.push(ve(y,b,x,t)):y===2?g.push(be(y,b,x,t)):y===3?g.push(xe(y,b,x,t)):y===4?g.push(Ce(y,b,x,t)):t.readBits(8*(b-4)),v+=2+b}var S={table_id:n,section_syntax_indicator:r,private_indicator:i,section_length:a,protocol_version:o,encrypted_packet:s,encryption_algorithm:c,pts_adjustment:l,cw_index:u,tier:d,splice_command_length:f,splice_command_type:p,splice_command:h,descriptor_loop_length:_,splice_descriptors:g,E_CRC32:s?t.readBits(32):void 0,CRC32:t.readBits(32)};if(p===te.kSpliceInsert){var C=h;if(C.splice_event_cancel_indicator)return{splice_command_type:p,detail:S,data:e};if(C.program_splice_flag&&!C.splice_immediate_flag){var w=C.duration_flag?C.break_duration.auto_return:void 0,T=C.duration_flag?C.break_duration.duration/90:void 0;return C.splice_time.time_specified_flag?{splice_command_type:p,pts:(l+C.splice_time.pts_time)%2**33,auto_return:w,duraiton:T,detail:S,data:e}:{splice_command_type:p,auto_return:w,duraiton:T,detail:S,data:e}}return{splice_command_type:p,auto_return:w=C.duration_flag?C.break_duration.auto_return:void 0,duraiton:T=C.duration_flag?C.break_duration.duration/90:void 0,detail:S,data:e}}if(p===te.kTimeSignal){var E=h;return E.splice_time.time_specified_flag?{splice_command_type:p,pts:(l+E.splice_time.pts_time)%2**33,detail:S,data:e}:{splice_command_type:p,detail:S,data:e}}return{splice_command_type:p,detail:S,data:e}};(function(e){e[e.kSliceIDR_W_RADL=19]=`kSliceIDR_W_RADL`,e[e.kSliceIDR_N_LP=20]=`kSliceIDR_N_LP`,e[e.kSliceCRA_NUT=21]=`kSliceCRA_NUT`,e[e.kSliceVPS=32]=`kSliceVPS`,e[e.kSliceSPS=33]=`kSliceSPS`,e[e.kSlicePPS=34]=`kSlicePPS`,e[e.kSliceAUD=35]=`kSliceAUD`})(de||={});var Te=function(){},Ee=function(e){var t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)},De=function(){function e(e){this.TAG=`H265AnnexBParser`,this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&a.a.e(this.TAG,`Could not find H265 startcode until payload end!`)}return e.prototype.findNextStartCodeOffset=function(e){for(var t=e,n=this.data_;;){if(t+3>=n.byteLength)return this.eof_flag_=!0,n.byteLength;var r=n[t+0]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3],i=n[t+0]<<16|n[t+1]<<8|n[t+2];if(r===1||i===1)return t;t++}},e.prototype.readNextNaluPayload=function(){for(var e=this.data_,t=null;t==null&&!this.eof_flag_;){var n=this.current_startcode_offset_,r=e[n+=(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])==1?4:3]>>1&63,i=(128&e[n])>>>7,a=this.findNextStartCodeOffset(n);if(this.current_startcode_offset_=a,i===0){var o=e.subarray(n,a);(t=new Te).type=r,t.data=o}}return t},e}(),Oe=function(){function e(e,t,n,r){var i=23+(5+e.byteLength)+(5+t.byteLength)+(5+n.byteLength),a=this.data=new Uint8Array(i);a[0]=1,a[1]=(3&r.general_profile_space)<<6|(r.general_tier_flag?1:0)<<5|31&r.general_profile_idc,a[2]=r.general_profile_compatibility_flags_1,a[3]=r.general_profile_compatibility_flags_2,a[4]=r.general_profile_compatibility_flags_3,a[5]=r.general_profile_compatibility_flags_4,a[6]=r.general_constraint_indicator_flags_1,a[7]=r.general_constraint_indicator_flags_2,a[8]=r.general_constraint_indicator_flags_3,a[9]=r.general_constraint_indicator_flags_4,a[10]=r.general_constraint_indicator_flags_5,a[11]=r.general_constraint_indicator_flags_6,a[12]=r.general_level_idc,a[13]=240|(3840&r.min_spatial_segmentation_idc)>>8,a[14]=255&r.min_spatial_segmentation_idc,a[15]=252|3&r.parallelismType,a[16]=252|3&r.chroma_format_idc,a[17]=248|7&r.bit_depth_luma_minus8,a[18]=248|7&r.bit_depth_chroma_minus8,a[19]=0,a[20]=0,a[21]=(3&r.constant_frame_rate)<<6|(7&r.num_temporal_layers)<<3|(r.temporal_id_nested?1:0)<<2|3,a[22]=3,a[23]=128|de.kSliceVPS,a[24]=0,a[25]=1,a[26]=(65280&e.byteLength)>>8,a[27]=(255&e.byteLength)>>0,a.set(e,28),a[23+(5+e.byteLength)+0]=128|de.kSliceSPS,a[23+(5+e.byteLength)+1]=0,a[23+(5+e.byteLength)+2]=1,a[23+(5+e.byteLength)+3]=(65280&t.byteLength)>>8,a[23+(5+e.byteLength)+4]=(255&t.byteLength)>>0,a.set(t,23+(5+e.byteLength)+5),a[23+(5+e.byteLength+5+t.byteLength)+0]=128|de.kSlicePPS,a[23+(5+e.byteLength+5+t.byteLength)+1]=0,a[23+(5+e.byteLength+5+t.byteLength)+2]=1,a[23+(5+e.byteLength+5+t.byteLength)+3]=(65280&n.byteLength)>>8,a[23+(5+e.byteLength+5+t.byteLength)+4]=(255&n.byteLength)>>0,a.set(n,23+(5+e.byteLength+5+t.byteLength)+5)}return e.prototype.getData=function(){return this.data},e}(),ke=function(){},Ae=function(){},je=function(){},Me=[[64,64,80,80,96,96,112,112,128,128,160,160,192,192,224,224,256,256,320,320,384,384,448,448,512,512,640,640,768,768,896,896,1024,1024,1152,1152,1280,1280],[69,70,87,88,104,105,121,122,139,140,174,175,208,209,243,244,278,279,348,349,417,418,487,488,557,558,696,697,835,836,975,976,1114,1115,1253,1254,1393,1394],[96,96,120,120,144,144,168,168,192,192,240,240,288,288,336,336,384,384,480,480,576,576,672,672,768,768,960,960,1152,1152,1344,1344,1536,1536,1728,1728,1920,1920]],Ne=function(){function e(e){this.TAG=`AC3Parser`,this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&a.a.e(this.TAG,`Could not found AC3 syncword until payload end`)}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,n=this.data_;;){if(t+7>=n.byteLength)return this.eof_flag_=!0,n.byteLength;if((n[t+0]<<8|n[t+1]<<0)==2935)return t;t++}},e.prototype.readNextAC3Frame=function(){for(var e=this.data_,t=null;t==null&&!this.eof_flag_;){var n=this.current_syncword_offset_,r=e[n+4]>>6,i=[48e3,44200,33e3][r],a=63&e[n+4],o=2*Me[r][a];if(isNaN(o)||n+o>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}this.current_syncword_offset_=this.findNextSyncwordOffset(n+o);var s=e[n+5]>>3,c=7&e[n+5],l=e[n+6]>>5,u=0;1&l&&l!==1&&(u+=2),4&l&&(u+=2),l===2&&(u+=2);var d=(e[n+6]<<8|e[n+7]<<0)>>12-u&1,f=[2,1,2,3,3,4,4,5][l]+d;(t=new je).sampling_frequency=i,t.channel_count=f,t.channel_mode=l,t.bit_stream_identification=s,t.low_frequency_effects_channel_on=d,t.bit_stream_mode=c,t.frame_size_code=a,t.data=e.subarray(n,n+o)}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),Pe=function(e){this.config=[e.sampling_rate_code<<6|e.bit_stream_identification<<1|e.bit_stream_mode>>2,(3&e.bit_stream_mode)<<6|e.channel_mode<<3|e.low_frequency_effects_channel_on<<2|e.frame_size_code>>4,e.frame_size_code<<4&224],this.sampling_rate=e.sampling_frequency,this.bit_stream_identification=e.bit_stream_identification,this.bit_stream_mode=e.bit_stream_mode,this.low_frequency_effects_channel_on=e.low_frequency_effects_channel_on,this.channel_count=e.channel_count,this.channel_mode=e.channel_mode,this.codec_mimetype=`ac-3`,this.original_codec_mimetype=`ac-3`},Fe=function(){},Ie=function(){function e(e){this.TAG=`EAC3Parser`,this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&a.a.e(this.TAG,`Could not found AC3 syncword until payload end`)}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,n=this.data_;;){if(t+7>=n.byteLength)return this.eof_flag_=!0,n.byteLength;if((n[t+0]<<8|n[t+1]<<0)==2935)return t;t++}},e.prototype.readNextEAC3Frame=function(){for(var e=this.data_,t=null;t==null&&!this.eof_flag_;){var n=this.current_syncword_offset_,r=new m(e.subarray(n+2)),i=(r.readBits(2),r.readBits(3),r.readBits(11)+1<<1),a=r.readBits(2),o=null,s=null;a===3?(o=[24e3,22060,16e3][a=r.readBits(2)],s=3):(o=[48e3,44100,32e3][a],s=r.readBits(2));var c=r.readBits(3),l=r.readBits(1),u=r.readBits(5);if(n+i>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}this.current_syncword_offset_=this.findNextSyncwordOffset(n+i);var d=[2,1,2,3,3,4,4,5][c]+l;r.destroy(),(t=new Fe).sampling_frequency=o,t.channel_count=d,t.channel_mode=c,t.bit_stream_identification=u,t.low_frequency_effects_channel_on=l,t.frame_size=i,t.num_blks=[1,2,3,6][s],t.data=e.subarray(n,n+i)}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),Le=function(e){var t,n=Math.floor(e.frame_size*e.sampling_frequency/(16*e.num_blks));t=[255&n,248&n,e.sampling_rate_code<<6|e.bit_stream_identification<<1|0,0|e.channel_mode<<1|e.low_frequency_effects_channel_on<<0,0],this.config=t,this.sampling_rate=e.sampling_frequency,this.bit_stream_identification=e.bit_stream_identification,this.num_blks=e.num_blks,this.low_frequency_effects_channel_on=e.low_frequency_effects_channel_on,this.channel_count=e.channel_count,this.channel_mode=e.channel_mode,this.codec_mimetype=`ec-3`,this.original_codec_mimetype=`ec-3`},Re=function(){},ze=function(){function e(e){this.TAG=`AV1OBUInMpegTsParser`,this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&a.a.e(this.TAG,`Could not find AV1 startcode until payload end!`)}return e._ebsp2rbsp=function(e){for(var t=e,n=t.byteLength,r=new Uint8Array(n),i=0,a=0;a<n;a++)a>=2&&t[a]===3&&t[a-1]===0&&t[a-2]===0||(r[i]=t[a],i++);return new Uint8Array(r.buffer,0,i)},e.prototype.findNextStartCodeOffset=function(e){for(var t=e,n=this.data_;;){if(t+2>=n.byteLength)return this.eof_flag_=!0,n.byteLength;if((n[t+0]<<16|n[t+1]<<8|n[t+2])==1)return t;t++}},e.prototype.readNextOBUPayload=function(){for(var t=this.data_,n=null;n==null&&!this.eof_flag_;){var r=this.current_startcode_offset_+3,i=this.findNextStartCodeOffset(r);this.current_startcode_offset_=i,n=e._ebsp2rbsp(t.subarray(r,i))}return n},e}(),Be=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ve=function(){return(Ve=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},He=function(e){function t(t,n){var r=e.call(this)||this;return r.TAG=`TSDemuxer`,r.first_parse_=!0,r.media_info_=new s.a,r.timescale_=90,r.duration_=0,r.current_pmt_pid_=-1,r.program_pmt_map_={},r.pes_slice_queues_={},r.section_slice_queues_={},r.video_metadata_={vps:void 0,sps:void 0,pps:void 0,av1c:void 0,details:void 0},r.audio_metadata_={codec:void 0,audio_object_type:void 0,sampling_freq_index:void 0,sampling_frequency:void 0,channel_config:void 0},r.last_pcr_base_=NaN,r.timestamp_offset_=0,r.audio_last_sample_pts_=void 0,r.aac_last_incomplete_data_=null,r.has_video_=!1,r.has_audio_=!1,r.video_init_segment_dispatched_=!1,r.audio_init_segment_dispatched_=!1,r.video_metadata_changed_=!1,r.audio_metadata_changed_=!1,r.loas_previous_frame=null,r.video_track_={type:`video`,id:1,sequenceNumber:0,samples:[],length:0},r.audio_track_={type:`audio`,id:2,sequenceNumber:0,samples:[],length:0},r.ts_packet_size_=t.ts_packet_size,r.sync_offset_=t.sync_offset,r.config_=n,r}return Be(t,e),t.prototype.destroy=function(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,e.prototype.destroy.call(this)},t.probe=function(e){var t=new Uint8Array(e),n=-1,r=188;if(t.byteLength<=3*r)return{needMoreData:!0};for(;n===-1;){for(var i=Math.min(1e3,t.byteLength-3*r),o=0;o<i;){if(t[o]===71&&t[o+r]===71&&t[o+2*r]===71){n=o;break}o++}if(n===-1)if(r===188)r=192;else{if(r!==192)break;r=204}}return n===-1?{match:!1}:(r===192&&n>=4?(a.a.v(`TSDemuxer`,`ts_packet_size = 192, m2ts mode`),n-=4):r===204&&a.a.v(`TSDemuxer`,`ts_packet_size = 204, RS encoded MPEG2-TS stream`),{match:!0,consumed:0,ts_packet_size:r,sync_offset:n})},t.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},t.prototype.resetMediaInfo=function(){this.media_info_=new s.a},t.prototype.parseChunks=function(e,t){if(!(this.onError&&this.onMediaInfo&&this.onTrackMetadata&&this.onDataAvailable))throw new d.a(`onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified`);var n=0;for(this.first_parse_&&(this.first_parse_=!1,n=this.sync_offset_);n+this.ts_packet_size_<=e.byteLength;){var r=t+n;this.ts_packet_size_===192&&(n+=4);var i=new Uint8Array(e,n,188),o=i[0];if(o!==71){a.a.e(this.TAG,`sync_byte = ${o}, not 0x47`);break}var s=(64&i[1])>>>6,c=(i[1],(31&i[1])<<8|i[2]),l=(48&i[3])>>>4,u=15&i[3],f=!(!this.pmt_||this.pmt_.pcr_pid!==c),p={},m=4;if(l==2||l==3){var h=i[4];if(h>0&&(f||l==3)&&(p.discontinuity_indicator=(128&i[5])>>>7,p.random_access_indicator=(64&i[5])>>>6,p.elementary_stream_priority_indicator=(32&i[5])>>>5,(16&i[5])>>>4&&(this.last_pcr_=300*this.getPcrBase(i)+((1&i[10])<<8|i[11]))),l==2||5+h===188){n+=188,this.ts_packet_size_===204&&(n+=16);continue}m=5+h}if(l==1||l==3){if(c===0||c===this.current_pmt_pid_||this.pmt_!=null&&this.pmt_.pid_stream_type[c]===w.kSCTE35){var g=188-m;this.handleSectionSlice(e,n+m,g,{pid:c,file_position:r,payload_unit_start_indicator:s,continuity_conunter:u,random_access_indicator:p.random_access_indicator})}else if(this.pmt_!=null&&this.pmt_.pid_stream_type[c]!=null){g=188-m;var _=this.pmt_.pid_stream_type[c];c!==this.pmt_.common_pids.h264&&c!==this.pmt_.common_pids.h265&&c!==this.pmt_.common_pids.av1&&c!==this.pmt_.common_pids.adts_aac&&c!==this.pmt_.common_pids.loas_aac&&c!==this.pmt_.common_pids.ac3&&c!==this.pmt_.common_pids.eac3&&c!==this.pmt_.common_pids.opus&&c!==this.pmt_.common_pids.mp3&&!0!==this.pmt_.pes_private_data_pids[c]&&!0!==this.pmt_.timed_id3_pids[c]&&!0!==this.pmt_.synchronous_klv_pids[c]&&!0!==this.pmt_.asynchronous_klv_pids[c]||this.handlePESSlice(e,n+m,g,{pid:c,stream_type:_,file_position:r,payload_unit_start_indicator:s,continuity_conunter:u,random_access_indicator:p.random_access_indicator})}}n+=188,this.ts_packet_size_===204&&(n+=16)}return this.dispatchAudioVideoMediaSegment(),n},t.prototype.handleSectionSlice=function(e,t,n,r){var i=new Uint8Array(e,t,n),a=this.section_slice_queues_[r.pid];if(r.payload_unit_start_indicator){var o=i[0];if(a!=null&&a.total_length!==0){var s=new Uint8Array(e,t+1,Math.min(n,o));a.slices.push(s),a.total_length+=s.byteLength,a.total_length===a.expected_length?this.emitSectionSlices(a,r):this.clearSlices(a,r)}for(var c=1+o;c<i.byteLength&&i[c+0]!==255;){var l=(15&i[c+1])<<8|i[c+2];this.section_slice_queues_[r.pid]=new M,(a=this.section_slice_queues_[r.pid]).expected_length=l+3,a.file_position=r.file_position,a.random_access_indicator=r.random_access_indicator,s=new Uint8Array(e,t+c,Math.min(n-c,a.expected_length-a.total_length)),a.slices.push(s),a.total_length+=s.byteLength,a.total_length===a.expected_length?this.emitSectionSlices(a,r):a.total_length>=a.expected_length&&this.clearSlices(a,r),c+=s.byteLength}}else a!=null&&a.total_length!==0&&(s=new Uint8Array(e,t,Math.min(n,a.expected_length-a.total_length)),a.slices.push(s),a.total_length+=s.byteLength,a.total_length===a.expected_length?this.emitSectionSlices(a,r):a.total_length>=a.expected_length&&this.clearSlices(a,r))},t.prototype.handlePESSlice=function(e,t,n,r){var i=new Uint8Array(e,t,n),o=i[0]<<16|i[1]<<8|i[2],s=(i[3],i[4]<<8|i[5]);if(r.payload_unit_start_indicator){if(o!==1)return void a.a.e(this.TAG,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${o}`);var c=this.pes_slice_queues_[r.pid];c&&(c.expected_length===0||c.expected_length===c.total_length?this.emitPESSlices(c,r):this.clearSlices(c,r)),this.pes_slice_queues_[r.pid]=new M,this.pes_slice_queues_[r.pid].file_position=r.file_position,this.pes_slice_queues_[r.pid].random_access_indicator=r.random_access_indicator}if(this.pes_slice_queues_[r.pid]!=null){var l=this.pes_slice_queues_[r.pid];l.slices.push(i),r.payload_unit_start_indicator&&(l.expected_length=s===0?0:s+6),l.total_length+=i.byteLength,l.expected_length>0&&l.expected_length===l.total_length?this.emitPESSlices(l,r):l.expected_length>0&&l.expected_length<l.total_length&&this.clearSlices(l,r)}},t.prototype.emitSectionSlices=function(e,t){for(var n=new Uint8Array(e.total_length),r=0,i=0;r<e.slices.length;r++){var a=e.slices[r];n.set(a,i),i+=a.byteLength}e.slices=[],e.expected_length=-1,e.total_length=0;var o=new j;o.pid=t.pid,o.data=n,o.file_position=e.file_position,o.random_access_indicator=e.random_access_indicator,this.parseSection(o)},t.prototype.emitPESSlices=function(e,t){for(var n=new Uint8Array(e.total_length),r=0,i=0;r<e.slices.length;r++){var a=e.slices[r];n.set(a,i),i+=a.byteLength}e.slices=[],e.expected_length=-1,e.total_length=0;var o=new A;o.pid=t.pid,o.data=n,o.stream_type=t.stream_type,o.file_position=e.file_position,o.random_access_indicator=e.random_access_indicator,this.parsePES(o)},t.prototype.clearSlices=function(e,t){e.slices=[],e.expected_length=-1,e.total_length=0},t.prototype.parseSection=function(e){var t=e.data,n=e.pid;n===0?this.parsePAT(t):n===this.current_pmt_pid_?this.parsePMT(t):this.pmt_!=null&&this.pmt_.scte_35_pids[n]&&this.parseSCTE35(t)},t.prototype.parsePES=function(e){var t=e.data,n=t[0]<<16|t[1]<<8|t[2],r=t[3],i=t[4]<<8|t[5];if(n===1)if(r!==188&&r!==190&&r!==191&&r!==240&&r!==241&&r!==255&&r!==242&&r!==248){t[6];var o=(192&t[7])>>>6,s=t[8],c=void 0,l=void 0;o!==2&&o!==3||(c=this.getTimestamp(t,9),l=o===3?this.getTimestamp(t,14):c);var u=9+s,d=void 0;if(i!==0){if(i<3+s)return void a.a.v(this.TAG,`Malformed PES: PES_packet_length < 3 + PES_header_data_length`);d=i-3-s}else d=t.byteLength-u;var f=t.subarray(u,u+d);switch(e.stream_type){case w.kMPEG1Audio:case w.kMPEG2Audio:this.parseMP3Payload(f,c);break;case w.kPESPrivateData:this.pmt_.common_pids.av1===e.pid?this.parseAV1Payload(f,c,l,e.file_position,e.random_access_indicator):this.pmt_.common_pids.opus===e.pid?this.parseOpusPayload(f,c):this.pmt_.common_pids.ac3===e.pid?this.parseAC3Payload(f,c):this.pmt_.common_pids.eac3===e.pid?this.parseEAC3Payload(f,c):this.pmt_.asynchronous_klv_pids[e.pid]?this.parseAsynchronousKLVMetadataPayload(f,e.pid,r):this.pmt_.smpte2038_pids[e.pid]?this.parseSMPTE2038MetadataPayload(f,c,l,e.pid,r):this.parsePESPrivateDataPayload(f,c,l,e.pid,r);break;case w.kADTSAAC:this.parseADTSAACPayload(f,c);break;case w.kLOASAAC:this.parseLOASAACPayload(f,c);break;case w.kAC3:this.parseAC3Payload(f,c);break;case w.kEAC3:this.parseEAC3Payload(f,c);break;case w.kMetadata:this.pmt_.timed_id3_pids[e.pid]?this.parseTimedID3MetadataPayload(f,c,l,e.pid,r):this.pmt_.synchronous_klv_pids[e.pid]&&this.parseSynchronousKLVMetadataPayload(f,c,l,e.pid,r);break;case w.kH264:this.parseH264Payload(f,c,l,e.file_position,e.random_access_indicator);break;case w.kH265:this.parseH265Payload(f,c,l,e.file_position,e.random_access_indicator)}}else (r===188||r===191||r===240||r===241||r===255||r===242||r===248)&&e.stream_type===w.kPESPrivateData&&(u=6,d=void 0,d=i===0?t.byteLength-u:i,f=t.subarray(u,u+d),this.parsePESPrivateDataPayload(f,void 0,void 0,e.pid,r));else a.a.e(this.TAG,`parsePES: packet_start_code_prefix should be 1 but with value ${n}`)},t.prototype.parsePAT=function(e){var t=e[0];if(t===0){var n=(15&e[1])<<8|e[2],r=(e[3],e[4],(62&e[5])>>>1),i=1&e[5],o=e[6],s=(e[7],null);if(i===1&&o===0)(s=new D).version_number=r;else if((s=this.pat_)==null)return;for(var c=n-5-4,l=-1,u=-1,d=8;d<8+c;d+=4){var f=e[d]<<8|e[d+1],p=(31&e[d+2])<<8|e[d+3];f===0?s.network_pid=p:(s.program_pmt_pid[f]=p,l===-1&&(l=f),u===-1&&(u=p))}i===1&&o===0&&(this.pat_??a.a.v(this.TAG,`Parsed first PAT: ${JSON.stringify(s)}`),this.pat_=s,this.current_program_=l,this.current_pmt_pid_=u)}else a.a.e(this.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`)},t.prototype.parsePMT=function(e){var t=e[0];if(t===2){var n=(15&e[1])<<8|e[2],r=e[3]<<8|e[4],i=(62&e[5])>>>1,o=1&e[5],s=e[6],c=(e[7],null);if(o===1&&s===0)(c=new k).program_number=r,c.version_number=i,this.program_pmt_map_[r]=c;else if((c=this.program_pmt_map_[r])==null)return;c.pcr_pid=(31&e[8])<<8|e[9];for(var l=(15&e[10])<<8|e[11],u=12+l,d=n-9-l-4,f=u;f<u+d;){var p=e[f],m=(31&e[f+1])<<8|e[f+2],h=(15&e[f+3])<<8|e[f+4];c.pid_stream_type[m]=p;var g=c.common_pids.h264||c.common_pids.h265,_=c.common_pids.adts_aac||c.common_pids.loas_aac||c.common_pids.ac3||c.common_pids.eac3||c.common_pids.opus||c.common_pids.mp3;if(p!==w.kH264||g)if(p!==w.kH265||g)if(p!==w.kADTSAAC||_)if(p!==w.kLOASAAC||_)if(p!==w.kAC3||_)if(p!==w.kEAC3||_)if(p!==w.kMPEG1Audio&&p!==w.kMPEG2Audio||_)if(p===w.kPESPrivateData){if(c.pes_private_data_pids[m]=!0,h>0){for(var v=f+5;v<f+5+h;){var y=e[v+0],b=e[v+1];if(y===5){var x=String.fromCharCode.apply(String,Array.from(e.subarray(v+2,v+2+b)));x===`VANC`?c.smpte2038_pids[m]=!0:x===`AV01`?c.common_pids.av1=m:x===`Opus`?c.common_pids.opus=m:x===`KLVA`&&(c.asynchronous_klv_pids[m]=!0)}else if(y===127){if(m===c.common_pids.opus){var S=null;if(e[v+2]===128&&(S=e[v+3]),S==null){a.a.e(this.TAG,`Not Supported Opus channel count.`);continue}var C={codec:`opus`,channel_count:15&S?15&S:2,channel_config_code:S,sample_rate:48e3},T={codec:`opus`,meta:C};this.audio_init_segment_dispatched_==0?(this.audio_metadata_=C,this.dispatchAudioInitSegment(T)):this.detectAudioMetadataChange(T)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(T))}}else y===128&&m===c.common_pids.av1&&(this.video_metadata_.av1c=e.subarray(v+2,v+2+b));v+=2+b}var E=e.subarray(f+5,f+5+h);this.dispatchPESPrivateDataDescriptor(m,p,E)}}else if(p===w.kMetadata){if(h>0)for(v=f+5;v<f+5+h;){y=e[v+0];var D=e[v+1];if(y===38){var O=e[v+2]<<8|e[v+3]<<0,A=null;O===65535&&(A=String.fromCharCode.apply(String,Array.from(e.subarray(v+4,v+4+4))));var j=null;if(e[v+4+(O===65535?4:0)]===255){var M=4+(O===65535?4:0)+1;j=String.fromCharCode.apply(String,Array.from(e.subarray(v+M,v+M+4)))}A===`ID3 `&&j===`ID3 `?c.timed_id3_pids[m]=!0:j===`KLVA`&&(c.synchronous_klv_pids[m]=!0)}v+=2+D}}else p===w.kSCTE35&&(c.scte_35_pids[m]=!0);else c.common_pids.mp3=m;else c.common_pids.eac3=m;else c.common_pids.ac3=m;else c.common_pids.loas_aac=m;else c.common_pids.adts_aac=m;else c.common_pids.h265=m;else c.common_pids.h264=m;f+=5+h}r===this.current_program_&&(this.pmt_??a.a.v(this.TAG,`Parsed first PMT: ${JSON.stringify(c)}`),this.pmt_=c,(c.common_pids.h264||c.common_pids.h265||c.common_pids.av1)&&(this.has_video_=!0),(c.common_pids.adts_aac||c.common_pids.loas_aac||c.common_pids.ac3||c.common_pids.opus||c.common_pids.mp3)&&(this.has_audio_=!0))}else a.a.e(this.TAG,`parsePMT: table_id ${t} is not corresponded to PMT!`)},t.prototype.parseSCTE35=function(e){var t=we(e);t.pts==null?t.nearest_pts=this.getNearestTimestampMilliseconds():t.pts=Math.floor(t.pts/this.timescale_),this.onSCTE35Metadata&&this.onSCTE35Metadata(t)},t.prototype.parseAV1Payload=function(e,t,n,r,i){for(var a=new ze(e),o=null,s=[],c=0,l=!1,u=null;(o=a.readNextOBUPayload())!=null;){if((u=C.parseOBUs(o,this.video_metadata_.details))&&!0===u.keyframe)if(this.video_init_segment_dispatched_){if(!0===this.detectVideoMetadataChange(null,u)){var d;this.video_metadata_changed_=!0,this.dispatchVideoMediaSegment(),(d=new Uint8Array(new ArrayBuffer(this.video_metadata_.av1c.byteLength+u.sequence_header_data.byteLength))).set(this.video_metadata_.av1c,0),d.set(u.sequence_header_data,this.video_metadata_.av1c.byteLength),u.av1c=d,this.dispatchVideoInitSegment()}}else (d=new Uint8Array(new ArrayBuffer(this.video_metadata_.av1c.byteLength+u.sequence_header_data.byteLength))).set(this.video_metadata_.av1c,0),d.set(u.sequence_header_data,this.video_metadata_.av1c.byteLength),u.av1c=d,this.video_metadata_.details=u,this.dispatchVideoInitSegment();this.video_metadata_.details=u,l||=u.keyframe,s.push({data:o}),c+=o.byteLength}var f=Math.floor(t/this.timescale_),p=Math.floor(n/this.timescale_);if(s.length){var m=this.video_track_,h={units:s,length:c,isKeyframe:l,dts:p,pts:f,cts:f-p,file_position:r};m.samples.push(h),m.length+=c}},t.prototype.parseH264Payload=function(e,t,n,r,i){for(var o=new ee(e),s=null,c=[],l=0,u=!1;(s=o.readNextNaluPayload())!=null;){var d=new I(s);if(d.type===O.kSliceSPS){var f=h.parseSPS(s.data);this.video_init_segment_dispatched_?!0===this.detectVideoMetadataChange(d,f)&&(a.a.v(this.TAG,`H264: Critical h264 metadata has been changed, attempt to re-generate InitSegment`),this.video_metadata_changed_=!0,this.video_metadata_={vps:void 0,sps:d,pps:void 0,av1c:void 0,details:f}):(this.video_metadata_.sps=d,this.video_metadata_.details=f)}else d.type===O.kSlicePPS?this.video_init_segment_dispatched_&&!this.video_metadata_changed_||(this.video_metadata_.pps=d,this.video_metadata_.sps&&this.video_metadata_.pps&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):(d.type===O.kSliceIDR||d.type===O.kSliceNonIDR&&i===1)&&(u=!0);this.video_init_segment_dispatched_&&(c.push(d),l+=d.data.byteLength)}var p=Math.floor(t/this.timescale_),m=Math.floor(n/this.timescale_);if(c.length){var g=this.video_track_,_={units:c,length:l,isKeyframe:u,dts:m,pts:p,cts:p-m,file_position:r};g.samples.push(_),g.length+=l}},t.prototype.parseH265Payload=function(e,t,n,r,i){for(var o=new De(e),s=null,c=[],l=0,u=!1;(s=o.readNextNaluPayload())!=null;){var d=new Ee(s);if(d.type===de.kSliceVPS){if(!this.video_init_segment_dispatched_){var f=_.parseVPS(s.data);this.video_metadata_.vps=d,this.video_metadata_.details=Ve(Ve({},this.video_metadata_.details),f)}}else d.type===de.kSliceSPS?(f=_.parseSPS(s.data),this.video_init_segment_dispatched_?!0===this.detectVideoMetadataChange(d,f)&&(a.a.v(this.TAG,`H265: Critical h265 metadata has been changed, attempt to re-generate InitSegment`),this.video_metadata_changed_=!0,this.video_metadata_={vps:void 0,sps:d,pps:void 0,av1c:void 0,details:f}):(this.video_metadata_.sps=d,this.video_metadata_.details=Ve(Ve({},this.video_metadata_.details),f))):d.type===de.kSlicePPS?(!this.video_init_segment_dispatched_||this.video_metadata_changed_)&&(f=_.parsePPS(s.data),this.video_metadata_.pps=d,this.video_metadata_.details=Ve(Ve({},this.video_metadata_.details),f),this.video_metadata_.vps&&this.video_metadata_.sps&&this.video_metadata_.pps&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):d.type!==de.kSliceIDR_W_RADL&&d.type!==de.kSliceIDR_N_LP&&d.type!==de.kSliceCRA_NUT||(u=!0);this.video_init_segment_dispatched_&&(c.push(d),l+=d.data.byteLength)}var p=Math.floor(t/this.timescale_),m=Math.floor(n/this.timescale_);if(c.length){var h=this.video_track_,g={units:c,length:l,isKeyframe:u,dts:m,pts:p,cts:p-m,file_position:r};h.samples.push(g),h.length+=l}},t.prototype.detectVideoMetadataChange=function(e,t){if(t.codec_mimetype!==this.video_metadata_.details.codec_mimetype)return a.a.v(this.TAG,`Video: Codec mimeType changed from ${this.video_metadata_.details.codec_mimetype} to ${t.codec_mimetype}`),!0;if(t.codec_size.width!==this.video_metadata_.details.codec_size.width||t.codec_size.height!==this.video_metadata_.details.codec_size.height){var n=this.video_metadata_.details.codec_size,r=t.codec_size;return a.a.v(this.TAG,`Video: Coded Resolution changed from ${n.width}x${n.height} to ${r.width}x${r.height}`),!0}return t.present_size.width!==this.video_metadata_.details.present_size.width&&(a.a.v(this.TAG,`Video: Present resolution width changed from ${this.video_metadata_.details.present_size.width} to ${t.present_size.width}`),!0)},t.prototype.isInitSegmentDispatched=function(){return this.has_video_&&this.has_audio_?this.video_init_segment_dispatched_&&this.audio_init_segment_dispatched_:this.has_video_&&!this.has_audio_?this.video_init_segment_dispatched_:!(this.has_video_||!this.has_audio_)&&this.audio_init_segment_dispatched_},t.prototype.dispatchVideoInitSegment=function(){var e=this.video_metadata_.details,t={type:`video`};if(t.id=this.video_track_.id,t.timescale=1e3,t.duration=this.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate,t.refSampleDuration=t.frameRate.fps_den/t.frameRate.fps_num*1e3,t.codec=e.codec_mimetype,this.video_metadata_.av1c)t.av1c=this.video_metadata_.av1c,this.video_init_segment_dispatched_==0&&a.a.v(this.TAG,`Generated first AV1 for mimeType: ${t.codec}`);else if(this.video_metadata_.vps){var n=this.video_metadata_.vps.data.subarray(4),r=this.video_metadata_.sps.data.subarray(4),i=this.video_metadata_.pps.data.subarray(4);t.hvcc=new Oe(n,r,i,e).getData(),this.video_init_segment_dispatched_==0&&a.a.v(this.TAG,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`)}else r=this.video_metadata_.sps.data.subarray(4),i=this.video_metadata_.pps.data.subarray(4),t.avcc=new L(r,i,e).getData(),this.video_init_segment_dispatched_==0&&a.a.v(this.TAG,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`);this.onTrackMetadata(`video`,t),this.video_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var o=this.media_info_;o.hasVideo=!0,o.width=t.codecWidth,o.height=t.codecHeight,o.fps=t.frameRate.fps,o.profile=t.profile,o.level=t.level,o.refFrames=e.ref_frames,o.chromaFormat=e.chroma_format_string,o.sarNum=t.sarRatio.width,o.sarDen=t.sarRatio.height,o.videoCodec=t.codec,o.hasAudio&&o.audioCodec?o.mimeType=`video/mp2t; codecs="${o.videoCodec},${o.audioCodec}"`:o.mimeType=`video/mp2t; codecs="${o.videoCodec}"`,o.isComplete()&&this.onMediaInfo(o)},t.prototype.dispatchVideoMediaSegment=function(){this.isInitSegmentDispatched()&&this.video_track_.length&&this.onDataAvailable(null,this.video_track_)},t.prototype.dispatchAudioMediaSegment=function(){this.isInitSegmentDispatched()&&this.audio_track_.length&&this.onDataAvailable(this.audio_track_,null)},t.prototype.dispatchAudioVideoMediaSegment=function(){this.isInitSegmentDispatched()&&(this.audio_track_.length||this.video_track_.length)&&this.onDataAvailable(this.audio_track_,this.video_track_)},t.prototype.parseADTSAACPayload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var n=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);n.set(this.aac_last_incomplete_data_,0),n.set(e,this.aac_last_incomplete_data_.byteLength),e=n}var r,i;if(t!=null&&(i=t/this.timescale_),this.audio_metadata_.codec===`aac`){if(t==null&&this.audio_last_sample_pts_!=null)r=1024/this.audio_metadata_.sampling_frequency*1e3,i=this.audio_last_sample_pts_+r;else if(t==null)return void a.a.w(this.TAG,`AAC: Unknown pts`);if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){r=1024/this.audio_metadata_.sampling_frequency*1e3;var o=this.audio_last_sample_pts_+r;Math.abs(o-i)>1&&(a.a.w(this.TAG,`AAC: Detected pts overlapped, expected: ${o}ms, PES pts: ${i}ms`),i=o)}}for(var s,c=new oe(e),l=null,u=i;(l=c.readNextAACFrame())!=null;){r=1024/l.sampling_frequency*1e3;var d={codec:`aac`,data:l};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:`aac`,audio_object_type:l.audio_object_type,sampling_freq_index:l.sampling_freq_index,sampling_frequency:l.sampling_frequency,channel_config:l.channel_config},this.dispatchAudioInitSegment(d)):this.detectAudioMetadataChange(d)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(d)),s=u;var f=Math.floor(u),p={unit:l.data,length:l.data.byteLength,pts:f,dts:f};this.audio_track_.samples.push(p),this.audio_track_.length+=l.data.byteLength,u+=r}c.hasIncompleteData()&&(this.aac_last_incomplete_data_=c.getIncompleteData()),s&&(this.audio_last_sample_pts_=s)}},t.prototype.parseLOASAACPayload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var n=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);n.set(this.aac_last_incomplete_data_,0),n.set(e,this.aac_last_incomplete_data_.byteLength),e=n}var r,i;if(t!=null&&(i=t/this.timescale_),this.audio_metadata_.codec===`aac`){if(t==null&&this.audio_last_sample_pts_!=null)r=1024/this.audio_metadata_.sampling_frequency*1e3,i=this.audio_last_sample_pts_+r;else if(t==null)return void a.a.w(this.TAG,`AAC: Unknown pts`);if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){r=1024/this.audio_metadata_.sampling_frequency*1e3;var o=this.audio_last_sample_pts_+r;Math.abs(o-i)>1&&(a.a.w(this.TAG,`AAC: Detected pts overlapped, expected: ${o}ms, PES pts: ${i}ms`),i=o)}}for(var s,c=new se(e),l=null,u=i;(l=c.readNextAACFrame(this.loas_previous_frame??void 0))!=null;){this.loas_previous_frame=l,r=1024/l.sampling_frequency*1e3;var d={codec:`aac`,data:l};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:`aac`,audio_object_type:l.audio_object_type,sampling_freq_index:l.sampling_freq_index,sampling_frequency:l.sampling_frequency,channel_config:l.channel_config},this.dispatchAudioInitSegment(d)):this.detectAudioMetadataChange(d)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(d)),s=u;var f=Math.floor(u),p={unit:l.data,length:l.data.byteLength,pts:f,dts:f};this.audio_track_.samples.push(p),this.audio_track_.length+=l.data.byteLength,u+=r}c.hasIncompleteData()&&(this.aac_last_incomplete_data_=c.getIncompleteData()),s&&(this.audio_last_sample_pts_=s)}},t.prototype.parseAC3Payload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var n,r;if(t!=null&&(r=t/this.timescale_),this.audio_metadata_.codec===`ac-3`){if(t==null&&this.audio_last_sample_pts_!=null)n=1536/this.audio_metadata_.sampling_frequency*1e3,r=this.audio_last_sample_pts_+n;else if(t==null)return void a.a.w(this.TAG,`AC3: Unknown pts`)}for(var i,o=new Ne(e),s=null,c=r;(s=o.readNextAC3Frame())!=null;){n=1536/s.sampling_frequency*1e3;var l={codec:`ac-3`,data:s};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:`ac-3`,sampling_frequency:s.sampling_frequency,bit_stream_identification:s.bit_stream_identification,bit_stream_mode:s.bit_stream_mode,low_frequency_effects_channel_on:s.low_frequency_effects_channel_on,channel_mode:s.channel_mode},this.dispatchAudioInitSegment(l)):this.detectAudioMetadataChange(l)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(l)),i=c;var u=Math.floor(c),d={unit:s.data,length:s.data.byteLength,pts:u,dts:u};this.audio_track_.samples.push(d),this.audio_track_.length+=s.data.byteLength,c+=n}i&&(this.audio_last_sample_pts_=i)}},t.prototype.parseEAC3Payload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var n,r;if(t!=null&&(r=t/this.timescale_),this.audio_metadata_.codec===`ec-3`){if(t==null&&this.audio_last_sample_pts_!=null)n=256*this.audio_metadata_.num_blks/this.audio_metadata_.sampling_frequency*1e3,r=this.audio_last_sample_pts_+n;else if(t==null)return void a.a.w(this.TAG,`EAC3: Unknown pts`)}for(var i,o=new Ie(e),s=null,c=r;(s=o.readNextEAC3Frame())!=null;){n=1536/s.sampling_frequency*1e3;var l={codec:`ec-3`,data:s};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:`ec-3`,sampling_frequency:s.sampling_frequency,bit_stream_identification:s.bit_stream_identification,low_frequency_effects_channel_on:s.low_frequency_effects_channel_on,num_blks:s.num_blks,channel_mode:s.channel_mode},this.dispatchAudioInitSegment(l)):this.detectAudioMetadataChange(l)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(l)),i=c;var u=Math.floor(c),d={unit:s.data,length:s.data.byteLength,pts:u,dts:u};this.audio_track_.samples.push(d),this.audio_track_.length+=s.data.byteLength,c+=n}i&&(this.audio_last_sample_pts_=i)}},t.prototype.parseOpusPayload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var n,r;if(t!=null&&(r=t/this.timescale_),this.audio_metadata_.codec===`opus`){if(t==null&&this.audio_last_sample_pts_!=null)n=20,r=this.audio_last_sample_pts_+n;else if(t==null)return void a.a.w(this.TAG,`Opus: Unknown pts`)}for(var i,o=r,s=0;s<e.length;){n=20;for(var c=(16&e[s+1])!=0,l=(8&e[s+1])!=0,u=s+2,d=0;e[u]===255;)d+=255,u+=1;d+=e[u],u+=1,u+=c?2:0,u+=l?2:0,i=o;var f=Math.floor(o),p=e.slice(u,u+d),m={unit:p,length:p.byteLength,pts:f,dts:f};this.audio_track_.samples.push(m),this.audio_track_.length+=p.byteLength,o+=n,s=u+d}i&&(this.audio_last_sample_pts_=i)}},t.prototype.parseMP3Payload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var n=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],r=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],i=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],a=e[1]>>>3&3,o=(6&e[1])>>1,s=(240&e[2])>>>4,c=(12&e[2])>>>2,l=(e[3]>>>6&3)==3?1:2,u=0,d=34;switch(a){case 0:u=[11025,12e3,8e3,0][c];break;case 2:u=[22050,24e3,16e3,0][c];break;case 3:u=[44100,48e3,32e3,0][c]}switch(o){case 1:d=34,s<i.length&&i[s];break;case 2:d=33,s<r.length&&r[s];break;case 3:d=32,s<n.length&&n[s]}var f=new Ae;f.object_type=d,f.sample_rate=u,f.channel_count=l,f.data=e;var p={codec:`mp3`,data:f};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:`mp3`,object_type:d,sample_rate:u,channel_count:l},this.dispatchAudioInitSegment(p)):this.detectAudioMetadataChange(p)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(p));var m={unit:e,length:e.byteLength,pts:t/this.timescale_,dts:t/this.timescale_};this.audio_track_.samples.push(m),this.audio_track_.length+=e.byteLength}},t.prototype.detectAudioMetadataChange=function(e){if(e.codec!==this.audio_metadata_.codec)return a.a.v(this.TAG,`Audio: Audio Codecs changed from ${this.audio_metadata_.codec} to ${e.codec}`),!0;if(e.codec===`aac`&&this.audio_metadata_.codec===`aac`){if((t=e.data).audio_object_type!==this.audio_metadata_.audio_object_type)return a.a.v(this.TAG,`AAC: AudioObjectType changed from ${this.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return a.a.v(this.TAG,`AAC: SamplingFrequencyIndex changed from ${this.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==this.audio_metadata_.channel_config)return a.a.v(this.TAG,`AAC: Channel configuration changed from ${this.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if(e.codec===`ac-3`&&this.audio_metadata_.codec===`ac-3`){var t;if((t=e.data).sampling_frequency!==this.audio_metadata_.sampling_frequency)return a.a.v(this.TAG,`AC3: Sampling Frequency changed from ${this.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return a.a.v(this.TAG,`AC3: Bit Stream Identification changed from ${this.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return a.a.v(this.TAG,`AC3: BitStream Mode changed from ${this.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==this.audio_metadata_.channel_mode)return a.a.v(this.TAG,`AC3: Channel Mode changed from ${this.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return a.a.v(this.TAG,`AC3: Low Frequency Effects Channel On changed from ${this.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if(e.codec===`opus`&&this.audio_metadata_.codec===`opus`){if((n=e.meta).sample_rate!==this.audio_metadata_.sample_rate)return a.a.v(this.TAG,`Opus: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${n.sample_rate}`),!0;if(n.channel_count!==this.audio_metadata_.channel_count)return a.a.v(this.TAG,`Opus: Channel count changed from ${this.audio_metadata_.channel_count} to ${n.channel_count}`),!0}else if(e.codec===`mp3`&&this.audio_metadata_.codec===`mp3`){var n;if((n=e.data).object_type!==this.audio_metadata_.object_type)return a.a.v(this.TAG,`MP3: AudioObjectType changed from ${this.audio_metadata_.object_type} to ${n.object_type}`),!0;if(n.sample_rate!==this.audio_metadata_.sample_rate)return a.a.v(this.TAG,`MP3: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${n.sample_rate}`),!0;if(n.channel_count!==this.audio_metadata_.channel_count)return a.a.v(this.TAG,`MP3: Channel count changed from ${this.audio_metadata_.channel_count} to ${n.channel_count}`),!0}return!1},t.prototype.dispatchAudioInitSegment=function(e){var t={type:`audio`};if(t.id=this.audio_track_.id,t.timescale=1e3,t.duration=this.duration_,this.audio_metadata_.codec===`aac`){var n=new ce(e.codec===`aac`?e.data:null);t.audioSampleRate=n.sampling_rate,t.channelCount=n.channel_count,t.codec=n.codec_mimetype,t.originalCodec=n.original_codec_mimetype,t.config=n.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale}else if(this.audio_metadata_.codec===`ac-3`){var r=new Pe(e.codec===`ac-3`?e.data:null);t.audioSampleRate=r.sampling_rate,t.channelCount=r.channel_count,t.codec=r.codec_mimetype,t.originalCodec=r.original_codec_mimetype,t.config=r.config,t.refSampleDuration=1536/t.audioSampleRate*t.timescale}else if(this.audio_metadata_.codec===`ec-3`){var i=new Le(e.codec===`ec-3`?e.data:null);t.audioSampleRate=i.sampling_rate,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=256*i.num_blks/t.audioSampleRate*t.timescale}else this.audio_metadata_.codec===`opus`?(t.audioSampleRate=this.audio_metadata_.sample_rate,t.channelCount=this.audio_metadata_.channel_count,t.channelConfigCode=this.audio_metadata_.channel_config_code,t.codec=`opus`,t.originalCodec=`opus`,t.config=void 0,t.refSampleDuration=20):this.audio_metadata_.codec===`mp3`&&(t.audioSampleRate=this.audio_metadata_.sample_rate,t.channelCount=this.audio_metadata_.channel_count,t.codec=`mp3`,t.originalCodec=`mp3`,t.config=void 0);this.audio_init_segment_dispatched_==0&&a.a.v(this.TAG,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),this.onTrackMetadata(`audio`,t),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var o=this.media_info_;o.hasAudio=!0,o.audioCodec=t.originalCodec,o.audioSampleRate=t.audioSampleRate,o.audioChannelCount=t.channelCount,o.hasVideo&&o.videoCodec?o.mimeType=`video/mp2t; codecs="${o.videoCodec},${o.audioCodec}"`:o.mimeType=`video/mp2t; codecs="${o.audioCodec}"`,o.isComplete()&&this.onMediaInfo(o)},t.prototype.dispatchPESPrivateDataDescriptor=function(e,t,n){var r=new ue;r.pid=e,r.stream_type=t,r.descriptor=n,this.onPESPrivateDataDescriptor&&this.onPESPrivateDataDescriptor(r)},t.prototype.parsePESPrivateDataPayload=function(e,t,n,r,i){var a=new le;a.pid=r,a.stream_id=i,a.len=e.byteLength,a.data=e,t==null?a.nearest_pts=this.getNearestTimestampMilliseconds():a.pts=Math.floor(t/this.timescale_),n!=null&&(a.dts=Math.floor(n/this.timescale_)),this.onPESPrivateData&&this.onPESPrivateData(a)},t.prototype.parseTimedID3MetadataPayload=function(e,t,n,r,i){var a=new le;a.pid=r,a.stream_id=i,a.len=e.byteLength,a.data=e,t!=null&&(a.pts=Math.floor(t/this.timescale_)),n!=null&&(a.dts=Math.floor(n/this.timescale_)),this.onTimedID3Metadata&&this.onTimedID3Metadata(a)},t.prototype.parseSynchronousKLVMetadataPayload=function(e,t,n,r,i){var a=new Re;a.pid=r,a.stream_id=i,a.len=e.byteLength,a.data=e,t!=null&&(a.pts=Math.floor(t/this.timescale_)),n!=null&&(a.dts=Math.floor(n/this.timescale_)),a.access_units=function(e){for(var t=[],n=0;n+5<e.byteLength;){var r=e[n+0],i=e[n+1],a=e[n+2],o=e[n+3]<<8|e[n+4]<<0,s=e.slice(n+5,n+5+o);t.push({service_id:r,sequence_number:i,flags:a,data:s}),n+=5+o}return t}(e),this.onSynchronousKLVMetadata&&this.onSynchronousKLVMetadata(a)},t.prototype.parseAsynchronousKLVMetadataPayload=function(e,t,n){var r=new le;r.pid=t,r.stream_id=n,r.len=e.byteLength,r.data=e,this.onAsynchronousKLVMetadata&&this.onAsynchronousKLVMetadata(r)},t.prototype.parseSMPTE2038MetadataPayload=function(e,t,n,r,i){var a=new ke;a.pid=r,a.stream_id=i,a.len=e.byteLength,a.data=e,t!=null&&(a.pts=Math.floor(t/this.timescale_)),a.nearest_pts=this.getNearestTimestampMilliseconds(),n!=null&&(a.dts=Math.floor(n/this.timescale_)),a.ancillaries=function(e){for(var t=new m(e),n=0,r=[];n+=6,t.readBits(6)===0;){var i=t.readBool();n+=1;var a=t.readBits(11);n+=11;var o=t.readBits(12);n+=12;var s=255&t.readBits(10);n+=10;var c=255&t.readBits(10);n+=10;var l=255&t.readBits(10);n+=10;for(var u=new Uint8Array(l),d=0;d<l;d++){var f=255&t.readBits(10);n+=10,u[d]=f}t.readBits(10),n+=10;var p=`User Defined`;s===65?c===7&&(p=`SCTE-104`):s===95?c===220?p=`ARIB STD-B37 (1SEG)`:c===221?p=`ARIB STD-B37 (ANALOG)`:c===222?p=`ARIB STD-B37 (SD)`:c===223&&(p=`ARIB STD-B37 (HD)`):s===97&&(c===1?p=`EIA-708`:c===2&&(p=`EIA-608`)),r.push({yc_indicator:i,line_number:a,horizontal_offset:o,did:s,sdid:c,user_data:u,description:p,information:{}}),t.readBits(8-(n-Math.floor(n/8))%8),n+=(8-(n-Math.floor(n/8)))%8}return t.destroy(),t=null,r}(e),this.onSMPTE2038Metadata&&this.onSMPTE2038Metadata(a)},t.prototype.getNearestTimestampMilliseconds=function(){return this.audio_last_sample_pts_==null?this.last_pcr_==null?void 0:Math.floor(this.last_pcr_/300/this.timescale_):Math.floor(this.audio_last_sample_pts_)},t.prototype.getPcrBase=function(e){var t=33554432*e[6]+131072*e[7]+512*e[8]+2*e[9]+(128&e[10])/128+this.timestamp_offset_;return t+4294967296<this.last_pcr_base_&&(t+=8589934592,this.timestamp_offset_+=8589934592),this.last_pcr_base_=t,t},t.prototype.getTimestamp=function(e,t){var n=536870912*(14&e[t])+4194304*(255&e[t+1])+16384*(254&e[t+2])+128*(255&e[t+3])+(254&e[t+4])/2+this.timestamp_offset_;return n+4294967296<this.last_pcr_base_&&(n+=8589934592),n},t}(E),Ue=function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},We=function(){function e(){}return e.init=function(){for(var t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],hvc1:[],hvcC:[],av01:[],av1C:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[],fLaC:[],dfLa:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var n=e.constants={};n.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),n.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),n.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),n.STSC=n.STCO=n.STTS,n.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),n.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),n.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),n.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},e.box=function(e){for(var t=8,n=null,r=Array.prototype.slice.call(arguments,1),i=r.length,a=0;a<i;a++)t+=r[a].byteLength;(n=new Uint8Array(t))[0]=t>>>24&255,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n.set(e,4);var o=8;for(a=0;a<i;a++)n.set(r[a],o),o+=r[a].byteLength;return n},e.generateInitSegment=function(t){var n=e.box(e.types.ftyp,e.constants.FTYP),r=e.moov(t),i=new Uint8Array(n.byteLength+r.byteLength);return i.set(n,0),i.set(r,n.byteLength),i},e.moov=function(t){var n=e.mvhd(t.timescale,t.duration),r=e.trak(t),i=e.mvex(t);return e.box(e.types.moov,n,r,i)},e.mvhd=function(t,n){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,n>>>24&255,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]))},e.trak=function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.tkhd=function(t){var n=t.id,r=t.duration,i=t.presentWidth,a=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,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,i>>>8&255,255&i,0,0,a>>>8&255,255&a,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))},e.mdhd=function(t){var n=t.timescale,r=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))},e.hdlr=function(t){var n=null;return n=t.type===`audio`?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,n)},e.minf=function(t){var n=null;return n=t.type===`audio`?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,n,e.dinf(),e.stbl(t))},e.dinf=function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))},e.stsd=function(t){return t.type===`audio`?t.codec===`mp3`?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):t.codec===`ac-3`?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.ac3(t)):t.codec===`ec-3`?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.ec3(t)):t.codec===`opus`?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.Opus(t)):t.codec==`flac`?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.fLaC(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):t.type===`video`&&t.codec.startsWith(`hvc1`)?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.hvc1(t)):t.type===`video`&&t.codec.startsWith(`av01`)?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.av01(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t))},e.mp3=function(t){var n=t.channelCount,r=t.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types[`.mp3`],i)},e.mp4a=function(t){var n=t.channelCount,r=t.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types.mp4a,i,e.esds(t))},e.ac3=function(t){var n=t.channelCount,r=t.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types[`ac-3`],i,e.box(e.types.dac3,new Uint8Array(t.config)))},e.ec3=function(t){var n=t.channelCount,r=t.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types[`ec-3`],i,e.box(e.types.dec3,new Uint8Array(t.config)))},e.esds=function(t){var n=t.config||[],r=n.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5,r].concat(n,[6,1,2]));return e.box(e.types.esds,i)},e.Opus=function(t){var n=t.channelCount,r=t.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types.Opus,i,e.dOps(t))},e.dOps=function(t){var n=t.channelCount,r=t.channelConfigCode,i=t.audioSampleRate;if(t.config)return e.box(e.types.dOps,t.config);var a=[];switch(r){case 1:case 2:a=[0];break;case 0:a=[255,1,1,0,1];break;case 128:a=[255,2,0,0,1];break;case 3:a=[1,2,1,0,2,1];break;case 4:a=[1,2,2,0,1,2,3];break;case 5:a=[1,3,2,0,4,1,2,3];break;case 6:a=[1,4,2,0,4,1,2,3,5];break;case 7:a=[1,4,2,0,4,1,2,3,5,6];break;case 8:a=[1,5,3,0,6,1,2,3,4,5,7];break;case 130:a=[1,1,2,0,1];break;case 131:a=[1,1,3,0,1,2];break;case 132:a=[1,1,4,0,1,2,3];break;case 133:a=[1,1,5,0,1,2,3,4];break;case 134:a=[1,1,6,0,1,2,3,4,5];break;case 135:a=[1,1,7,0,1,2,3,4,5,6];break;case 136:a=[1,1,8,0,1,2,3,4,5,6,7]}var o=new Uint8Array(Ue([0,n,0,0,i>>>24&255,i>>>17&255,i>>>8&255,i>>>0&255,0,0],a,!0));return e.box(e.types.dOps,o)},e.fLaC=function(t){var n=t.channelCount,r=Math.min(t.audioSampleRate,65535),i=t.sampleSize,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,i,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types.fLaC,a,e.dfLa(t))},e.dfLa=function(t){var n=new Uint8Array(Ue([0,0,0,0],t.config,!0));return e.box(e.types.dfLa,n)},e.avc1=function(t){var n=t.avcc,r=t.codecWidth,i=t.codecHeight,a=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,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.avc1,a,e.box(e.types.avcC,n))},e.hvc1=function(t){var n=t.hvcc,r=t.codecWidth,i=t.codecHeight,a=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,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.hvc1,a,e.box(e.types.hvcC,n))},e.av01=function(t){var n=t.av1c,r=t.codecWidth||192,i=t.codecHeight||108,a=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,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.av01,a,e.box(e.types.av1C,n))},e.mvex=function(t){return e.box(e.types.mvex,e.trex(t))},e.trex=function(t){var n=t.id,r=new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,r)},e.moof=function(t,n){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,n))},e.mfhd=function(t){var n=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,n)},e.traf=function(t,n){var r=t.id,i=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),a=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n])),o=e.sdtp(t),s=e.trun(t,o.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,i,a,s,o)},e.sdtp=function(t){for(var n=t.samples||[],r=n.length,i=new Uint8Array(4+r),a=0;a<r;a++){var o=n[a].flags;i[a+4]=o.isLeading<<6|o.dependsOn<<4|o.isDependedOn<<2|o.hasRedundancy}return e.box(e.types.sdtp,i)},e.trun=function(t,n){var r=t.samples||[],i=r.length,a=12+16*i,o=new Uint8Array(a);n+=8+a,o.set([0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0);for(var s=0;s<i;s++){var c=r[s].duration,l=r[s].size,u=r[s].flags,d=r[s].cts;o.set([c>>>24&255,c>>>16&255,c>>>8&255,255&c,l>>>24&255,l>>>16&255,l>>>8&255,255&l,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.isNonSync,0,0,d>>>24&255,d>>>16&255,d>>>8&255,255&d],12+16*s)}return e.box(e.types.trun,o)},e.mdat=function(t){return e.box(e.types.mdat,t)},e}();We.init();var Ge=We,Ke=function(){function e(){}return e.getSilentFrame=function(e,t){if(e===`mp4a.40.2`){if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2||t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},e}(),qe=n(11),Je=function(){function e(e){this.TAG=`MP4Remuxer`,this._config=e,this._isLive=!0===e.isLive,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new qe.c(`audio`),this._videoSegmentInfoList=new qe.c(`video`),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!o.a.chrome||!(o.a.version.major<50||o.a.version.major===50&&o.a.version.build<2661)),this._fillSilentAfterSeek=o.a.msedge||o.a.msie,this._mp3UseMpegAudio=!o.a.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return e.prototype.destroy=function(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null},e.prototype.bindDataSource=function(e){return e.onDataAvailable=this.remux.bind(this),e.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(e.prototype,`onInitSegment`,{get:function(){return this._onInitSegment},set:function(e){this._onInitSegment=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onMediaSegment`,{get:function(){return this._onMediaSegment},set:function(e){this._onMediaSegment=e},enumerable:!1,configurable:!0}),e.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},e.prototype.seek=function(e){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},e.prototype.remux=function(e,t){if(!this._onMediaSegment)throw new d.a(`MP4Remuxer: onMediaSegment callback must be specificed!`);this._dtsBaseInited||this._calculateDtsBase(e,t),t&&this._remuxVideo(t),e&&this._remuxAudio(e)},e.prototype._onTrackMetadataReceived=function(e,t){var n=null,r=`mp4`,i=t.codec;if(e===`audio`)this._audioMeta=t,t.codec===`mp3`&&this._mp3UseMpegAudio?(r=`mpeg`,i=``,n=new Uint8Array):n=Ge.generateInitSegment(t);else{if(e!==`video`)return;this._videoMeta=t,n=Ge.generateInitSegment(t)}if(!this._onInitSegment)throw new d.a(`MP4Remuxer: onInitSegment callback must be specified!`);this._onInitSegment(e,{type:e,data:n.buffer,codec:i,container:`${e}/${r}`,mediaDuration:t.duration})},e.prototype._calculateDtsBase=function(e,t){this._dtsBaseInited||=(e&&e.samples&&e.samples.length&&(this._audioDtsBase=e.samples[0].dts),t&&t.samples&&t.samples.length&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),!0)},e.prototype.getTimestampBase=function(){if(this._dtsBaseInited)return this._dtsBase},e.prototype.flushStashedSamples=function(){var e=this._videoStashedLastSample,t=this._audioStashedLastSample,n={type:`video`,id:1,sequenceNumber:0,samples:[],length:0};e!=null&&(n.samples.push(e),n.length=e.length);var r={type:`audio`,id:2,sequenceNumber:0,samples:[],length:0};t!=null&&(r.samples.push(t),r.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(n,!0),this._remuxAudio(r,!0)},e.prototype._remuxAudio=function(e,t){if(this._audioMeta!=null){var n,r=e,i=r.samples,s=void 0,c=-1,l=this._audioMeta.refSampleDuration,u=this._audioMeta.codec===`mp3`&&this._mp3UseMpegAudio,d=this._dtsBaseInited&&this._audioNextDts===void 0,f=!1;if(i&&i.length!==0&&(i.length!==1||t)){var p=0,m=null,h=0;u?(p=0,h=r.length):(p=8,h=8+r.length);var g=null;if(i.length>1&&(h-=(g=i.pop()).length),this._audioStashedLastSample!=null){var _=this._audioStashedLastSample;this._audioStashedLastSample=null,i.unshift(_),h+=_.length}g!=null&&(this._audioStashedLastSample=g);var v=i[0].dts-this._dtsBase;if(this._audioNextDts)s=v-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())s=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&this._audioMeta.originalCodec!==`mp3`&&(f=!0);else{var y=this._audioSegmentInfoList.getLastSampleBefore(v);if(y!=null){var b=v-(y.originalDts+y.duration);b<=3&&(b=0),s=v-(y.dts+y.duration+b)}else s=0}if(f){var x=v-s,S=this._videoSegmentInfoList.getLastSegmentBefore(v);if(S!=null&&S.beginDts<x){if(N=Ke.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount)){var C=S.beginDts,w=x-S.beginDts;a.a.v(this.TAG,`InsertPrefixSilentAudio: dts: ${C}, duration: ${w}`),i.unshift({unit:N,dts:C,pts:C}),h+=N.byteLength}}else f=!1}for(var T=[],E=0;E<i.length;E++){var D=(_=i[E]).unit,O=_.dts-this._dtsBase,k=(C=O,!1),A=null,j=0;if(!(O<-.001)){if(this._audioMeta.codec!==`mp3`&&l!=null){var M=O;if(this._audioNextDts&&(M=this._audioNextDts),(s=O-M)<=-3*l){a.a.w(this.TAG,`Dropping 1 audio frame (originalDts: ${O} ms ,curRefDts: ${M} ms) due to dtsCorrection: ${s} ms overlap.`);continue}if(s>=3*l&&this._fillAudioTimestampGap&&!o.a.safari){k=!0;var N,P=Math.floor(s/l);a.a.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.WxScreenUI={},e.Vue))})(this,function(e,t){Object.defineProperty(e,`__esModule`,{value:!0});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),l=e=>{let t={};for(var n in e)r(t,n,{get:e[n],enumerable:!0});return t},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e},d=((e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(c(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.mpegts=r():n.mpegts=r()})(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(e,`__esModule`,{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t||4&t&&typeof e==`object`&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,`default`,{enumerable:!0,value:e}),2&t&&typeof e!=`string`)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=20)}([function(e,t,n){var r=n(9),i=n.n(r),a=function(){function e(){}return e.e=function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r=`[${t}] > ${n}`;e.ENABLE_CALLBACK&&e.emitter.emit(`log`,`error`,r),e.ENABLE_ERROR&&(console.error?console.error(r):console.warn?console.warn(r):console.log(r))},e.i=function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r=`[${t}] > ${n}`;e.ENABLE_CALLBACK&&e.emitter.emit(`log`,`info`,r),e.ENABLE_INFO&&(console.info?console.info(r):console.log(r))},e.w=function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r=`[${t}] > ${n}`;e.ENABLE_CALLBACK&&e.emitter.emit(`log`,`warn`,r),e.ENABLE_WARN&&(console.warn?console.warn(r):console.log(r))},e.d=function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r=`[${t}] > ${n}`;e.ENABLE_CALLBACK&&e.emitter.emit(`log`,`debug`,r),e.ENABLE_DEBUG&&(console.debug?console.debug(r):console.log(r))},e.v=function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r=`[${t}] > ${n}`;e.ENABLE_CALLBACK&&e.emitter.emit(`log`,`verbose`,r),e.ENABLE_VERBOSE&&console.log(r)},e}();a.GLOBAL_TAG=`mpegts.js`,a.FORCE_GLOBAL_TAG=!1,a.ENABLE_ERROR=!0,a.ENABLE_INFO=!0,a.ENABLE_WARN=!0,a.ENABLE_DEBUG=!0,a.ENABLE_VERBOSE=!0,a.ENABLE_CALLBACK=!1,a.emitter=new i.a,t.a=a},function(e,t,n){var r;(function(e){e.IO_ERROR=`io_error`,e.DEMUX_ERROR=`demux_error`,e.INIT_SEGMENT=`init_segment`,e.MEDIA_SEGMENT=`media_segment`,e.LOADING_COMPLETE=`loading_complete`,e.RECOVERED_EARLY_EOF=`recovered_early_eof`,e.MEDIA_INFO=`media_info`,e.METADATA_ARRIVED=`metadata_arrived`,e.SCRIPTDATA_ARRIVED=`scriptdata_arrived`,e.TIMED_ID3_METADATA_ARRIVED=`timed_id3_metadata_arrived`,e.SYNCHRONOUS_KLV_METADATA_ARRIVED=`synchronous_klv_metadata_arrived`,e.ASYNCHRONOUS_KLV_METADATA_ARRIVED=`asynchronous_klv_metadata_arrived`,e.SMPTE2038_METADATA_ARRIVED=`smpte2038_metadata_arrived`,e.SCTE35_METADATA_ARRIVED=`scte35_metadata_arrived`,e.PES_PRIVATE_DATA_DESCRIPTOR=`pes_private_data_descriptor`,e.PES_PRIVATE_DATA_ARRIVED=`pes_private_data_arrived`,e.STATISTICS_INFO=`statistics_info`,e.RECOMMEND_SEEKPOINT=`recommend_seekpoint`})(r||={}),t.a=r},function(e,t,n){n.d(t,`c`,(function(){return i})),n.d(t,`b`,(function(){return a})),n.d(t,`a`,(function(){return o}));var r=n(3),i={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},a={OK:`OK`,EXCEPTION:`Exception`,HTTP_STATUS_CODE_INVALID:`HttpStatusCodeInvalid`,CONNECTING_TIMEOUT:`ConnectingTimeout`,EARLY_EOF:`EarlyEof`,UNRECOVERABLE_EARLY_EOF:`UnrecoverableEarlyEof`},o=function(){function e(e){this._type=e||`undefined`,this._status=i.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return e.prototype.destroy=function(){this._status=i.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},e.prototype.isWorking=function(){return this._status===i.kConnecting||this._status===i.kBuffering},Object.defineProperty(e.prototype,`type`,{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`status`,{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`needStashBuffer`,{get:function(){return this._needStash},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onContentLengthKnown`,{get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onURLRedirect`,{get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onDataArrival`,{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onError`,{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onComplete`,{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),e.prototype.open=function(e,t){throw new r.c(`Unimplemented abstract function!`)},e.prototype.abort=function(){throw new r.c(`Unimplemented abstract function!`)},e}()},function(e,t,n){n.d(t,`d`,(function(){return a})),n.d(t,`a`,(function(){return o})),n.d(t,`b`,(function(){return s})),n.d(t,`c`,(function(){return c}));var r,i=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}r(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),a=function(){function e(e){this._message=e}return Object.defineProperty(e.prototype,`name`,{get:function(){return`RuntimeException`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`message`,{get:function(){return this._message},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return this.name+`: `+this.message},e}(),o=function(e){function t(t){return e.call(this,t)||this}return i(t,e),Object.defineProperty(t.prototype,`name`,{get:function(){return`IllegalStateException`},enumerable:!1,configurable:!0}),t}(a),s=function(e){function t(t){return e.call(this,t)||this}return i(t,e),Object.defineProperty(t.prototype,`name`,{get:function(){return`InvalidArgumentException`},enumerable:!1,configurable:!0}),t}(a),c=function(e){function t(t){return e.call(this,t)||this}return i(t,e),Object.defineProperty(t.prototype,`name`,{get:function(){return`NotImplementedException`},enumerable:!1,configurable:!0}),t}(a)},function(e,t,n){var r;(function(e){e.ERROR=`error`,e.LOADING_COMPLETE=`loading_complete`,e.RECOVERED_EARLY_EOF=`recovered_early_eof`,e.MEDIA_INFO=`media_info`,e.METADATA_ARRIVED=`metadata_arrived`,e.SCRIPTDATA_ARRIVED=`scriptdata_arrived`,e.TIMED_ID3_METADATA_ARRIVED=`timed_id3_metadata_arrived`,e.SYNCHRONOUS_KLV_METADATA_ARRIVED=`synchronous_klv_metadata_arrived`,e.ASYNCHRONOUS_KLV_METADATA_ARRIVED=`asynchronous_klv_metadata_arrived`,e.SMPTE2038_METADATA_ARRIVED=`smpte2038_metadata_arrived`,e.SCTE35_METADATA_ARRIVED=`scte35_metadata_arrived`,e.PES_PRIVATE_DATA_DESCRIPTOR=`pes_private_data_descriptor`,e.PES_PRIVATE_DATA_ARRIVED=`pes_private_data_arrived`,e.STATISTICS_INFO=`statistics_info`,e.DESTROYING=`destroying`})(r||={}),t.a=r},function(e,t,n){var r={};(function(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf(`trident`)>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf(`compatible`)<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],n=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],i={browser:t[5]||t[3]||t[1]||``,version:t[2]||t[4]||`0`,majorVersion:t[4]||t[2]||`0`,platform:n[0]||``},a={};if(i.browser){a[i.browser]=!0;var o=i.majorVersion.split(`.`);a.version={major:parseInt(i.majorVersion,10),string:i.version},o.length>1&&(a.version.minor=parseInt(o[1],10)),o.length>2&&(a.version.build=parseInt(o[2],10))}for(var s in i.platform&&(a[i.platform]=!0),(a.chrome||a.opr||a.safari)&&(a.webkit=!0),(a.rv||a.iemobile)&&(a.rv&&delete a.rv,i.browser=`msie`,a.msie=!0),a.edge&&(delete a.edge,i.browser=`msedge`,a.msedge=!0),a.opr&&(i.browser=`opera`,a.opera=!0),a.safari&&a.android&&(i.browser=`android`,a.android=!0),a.name=i.browser,a.platform=i.platform,r)r.hasOwnProperty(s)&&delete r[s];Object.assign(r,a)})(),t.a=r},function(e,t,n){t.a={OK:`OK`,FORMAT_ERROR:`FormatError`,FORMAT_UNSUPPORTED:`FormatUnsupported`,CODEC_UNSUPPORTED:`CodecUnsupported`}},function(e,t,n){var r;(function(e){e.ERROR=`error`,e.SOURCE_OPEN=`source_open`,e.UPDATE_END=`update_end`,e.BUFFER_FULL=`buffer_full`,e.START_STREAMING=`start_streaming`,e.END_STREAMING=`end_streaming`})(r||={}),t.a=r},function(e,t,n){var r=n(9),i=n.n(r),a=n(0),o=function(){function e(){}return Object.defineProperty(e,`forceGlobalTag`,{get:function(){return a.a.FORCE_GLOBAL_TAG},set:function(t){a.a.FORCE_GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`globalTag`,{get:function(){return a.a.GLOBAL_TAG},set:function(t){a.a.GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableAll`,{get:function(){return a.a.ENABLE_VERBOSE&&a.a.ENABLE_DEBUG&&a.a.ENABLE_INFO&&a.a.ENABLE_WARN&&a.a.ENABLE_ERROR},set:function(t){a.a.ENABLE_VERBOSE=t,a.a.ENABLE_DEBUG=t,a.a.ENABLE_INFO=t,a.a.ENABLE_WARN=t,a.a.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableDebug`,{get:function(){return a.a.ENABLE_DEBUG},set:function(t){a.a.ENABLE_DEBUG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableVerbose`,{get:function(){return a.a.ENABLE_VERBOSE},set:function(t){a.a.ENABLE_VERBOSE=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableInfo`,{get:function(){return a.a.ENABLE_INFO},set:function(t){a.a.ENABLE_INFO=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableWarn`,{get:function(){return a.a.ENABLE_WARN},set:function(t){a.a.ENABLE_WARN=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,`enableError`,{get:function(){return a.a.ENABLE_ERROR},set:function(t){a.a.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),e.getConfig=function(){return{globalTag:a.a.GLOBAL_TAG,forceGlobalTag:a.a.FORCE_GLOBAL_TAG,enableVerbose:a.a.ENABLE_VERBOSE,enableDebug:a.a.ENABLE_DEBUG,enableInfo:a.a.ENABLE_INFO,enableWarn:a.a.ENABLE_WARN,enableError:a.a.ENABLE_ERROR,enableCallback:a.a.ENABLE_CALLBACK}},e.applyConfig=function(e){a.a.GLOBAL_TAG=e.globalTag,a.a.FORCE_GLOBAL_TAG=e.forceGlobalTag,a.a.ENABLE_VERBOSE=e.enableVerbose,a.a.ENABLE_DEBUG=e.enableDebug,a.a.ENABLE_INFO=e.enableInfo,a.a.ENABLE_WARN=e.enableWarn,a.a.ENABLE_ERROR=e.enableError,a.a.ENABLE_CALLBACK=e.enableCallback},e._notifyChange=function(){var t=e.emitter;if(t.listenerCount(`change`)>0){var n=e.getConfig();t.emit(`change`,n)}},e.registerListener=function(t){e.emitter.addListener(`change`,t)},e.removeListener=function(t){e.emitter.removeListener(`change`,t)},e.addLogListener=function(t){a.a.emitter.addListener(`log`,t),a.a.emitter.listenerCount(`log`)>0&&(a.a.ENABLE_CALLBACK=!0,e._notifyChange())},e.removeLogListener=function(t){a.a.emitter.removeListener(`log`,t),a.a.emitter.listenerCount(`log`)===0&&(a.a.ENABLE_CALLBACK=!1,e._notifyChange())},e}();o.emitter=new i.a,t.a=o},function(e,t,n){var r,i=typeof Reflect==`object`?Reflect:null,a=i&&typeof i.apply==`function`?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&typeof i.ownKeys==`function`?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}_(e,t,a,{once:!0}),t!==`error`&&function(e,t,n){typeof e.on==`function`&&_(e,`error`,t,n)}(e,i,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}function d(e,t,n,r){var i,a,o,s;if(l(n),(a=e._events)===void 0?(a=e._events=Object.create(null),e._eventsCount=0):(a.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),a=e._events),o=a[t]),o===void 0)o=a[t]=n,++e._eventsCount;else if(typeof o==`function`?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=u(e))>0&&o.length>i&&!o.warned){o.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+o.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=o.length,s=c,console&&console.warn&&console.warn(s)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?function(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):g(i,i.length)}function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else{if(typeof e.addEventListener!=`function`)throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e);e.addEventListener(t,(function i(a){r.once&&e.removeEventListener(t,i),n(a)}))}}Object.defineProperty(s,`defaultMaxListeners`,{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r=e===`error`,i=this._events;if(i!==void 0)r&&=i.error===void 0;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=i[e];if(c===void 0)return!1;if(typeof c==`function`)a(c,this,t);else{var l=c.length,u=g(c,l);for(n=0;n<l;++n)a(u[n],this,t)}return!0},s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)},s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),(r=this._events)===void 0||(n=r[e])===void 0)return this;if(n===t||n.listener===t)--this._eventsCount==0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n,r;if((n=this._events)===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i,a=Object.keys(n);for(r=0;r<a.length;++r)(i=a[r])!==`removeListener`&&this.removeAllListeners(i);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(t=n[e])==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){n.d(t,`b`,(function(){return a})),n.d(t,`a`,(function(){return o}));var r=n(2),i=n(6),a={NETWORK_ERROR:`NetworkError`,MEDIA_ERROR:`MediaError`,OTHER_ERROR:`OtherError`},o={NETWORK_EXCEPTION:r.b.EXCEPTION,NETWORK_STATUS_CODE_INVALID:r.b.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:r.b.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:r.b.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:`MediaMSEError`,MEDIA_FORMAT_ERROR:i.a.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:i.a.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:i.a.CODEC_UNSUPPORTED}},function(e,t,n){n.d(t,`d`,(function(){return r})),n.d(t,`b`,(function(){return i})),n.d(t,`a`,(function(){return a})),n.d(t,`c`,(function(){return o}));var r=function(e,t,n,r,i){this.dts=e,this.pts=t,this.duration=n,this.originalDts=r,this.isSyncPoint=i,this.fileposition=null},i=function(){function e(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return e.prototype.appendSyncPoint=function(e){e.isSyncPoint=!0,this.syncPoints.push(e)},e}(),a=function(){function e(){this._list=[]}return e.prototype.clear=function(){this._list=[]},e.prototype.appendArray=function(e){var t=this._list;e.length!==0&&(t.length>0&&e[0].originalDts<t[t.length-1].originalDts&&this.clear(),Array.prototype.push.apply(t,e))},e.prototype.getLastSyncPointBeforeDts=function(e){if(this._list.length==0)return null;var t=this._list,n=0,r=t.length-1,i=0,a=0,o=r;for(e<t[0].dts&&(n=0,a=o+1);a<=o;){if((i=a+Math.floor((o-a)/2))===r||e>=t[i].dts&&e<t[i+1].dts){n=i;break}t[i].dts<e?a=i+1:o=i-1}return this._list[n]},e}(),o=function(){function e(e){this._type=e,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(e.prototype,`type`,{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`length`,{get:function(){return this._list.length},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return this._list.length===0},e.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},e.prototype._searchNearestSegmentBefore=function(e){var t=this._list;if(t.length===0)return-2;var n=t.length-1,r=0,i=0,a=n,o=0;if(e<t[0].originalBeginDts)return o=-1;for(;i<=a;){if((r=i+Math.floor((a-i)/2))===n||e>t[r].lastSample.originalDts&&e<t[r+1].originalBeginDts){o=r;break}t[r].originalBeginDts<e?i=r+1:a=r-1}return o},e.prototype._searchNearestSegmentAfter=function(e){return this._searchNearestSegmentBefore(e)+1},e.prototype.append=function(e){var t=this._list,n=e,r=this._lastAppendLocation,i=0;r!==-1&&r<t.length&&n.originalBeginDts>=t[r].lastSample.originalDts&&(r===t.length-1||r<t.length-1&&n.originalBeginDts<t[r+1].originalBeginDts)?i=r+1:t.length>0&&(i=this._searchNearestSegmentBefore(n.originalBeginDts)+1),this._lastAppendLocation=i,this._list.splice(i,0,n)},e.prototype.getLastSegmentBefore=function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null},e.prototype.getLastSampleBefore=function(e){var t=this.getLastSegmentBefore(e);return t==null?null:t.lastSample},e.prototype.getLastSyncPointBefore=function(e){for(var t=this._searchNearestSegmentBefore(e),n=this._list[t].syncPoints;n.length===0&&t>0;)t--,n=this._list[t].syncPoints;return n.length>0?n[n.length-1]:null},e}()},function(e,t,n){t.a=function(){function e(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return e.prototype.isComplete=function(){var e=!1===this.hasAudio||!0===this.hasAudio&&this.audioCodec!=null&&this.audioSampleRate!=null&&this.audioChannelCount!=null,t=!1===this.hasVideo||!0===this.hasVideo&&this.videoCodec!=null&&this.width!=null&&this.height!=null&&this.fps!=null&&this.profile!=null&&this.level!=null&&this.refFrames!=null&&this.chromaFormat!=null&&this.sarNum!=null&&this.sarDen!=null;return this.mimeType!=null&&e&&t},e.prototype.isSeekable=function(){return!0===this.hasKeyframesIndex},e.prototype.getNearestKeyframe=function(e){if(this.keyframesIndex==null)return null;var t=this.keyframesIndex,n=this._search(t.times,e);return{index:n,milliseconds:t.times[n],fileposition:t.filepositions[n]}},e.prototype._search=function(e,t){var n=0,r=e.length-1,i=0,a=0,o=r;for(t<e[0]&&(n=0,a=o+1);a<=o;){if((i=a+Math.floor((o-a)/2))===r||t>=e[i]&&t<e[i+1]){n=i;break}e[i]<t?a=i+1:o=i-1}return n},e}()},function(e,t,n){var r=n(9),i=n.n(r),a=n(0),o=n(5),s=n(12);function c(e,t,n){var r=e;if(t+n<r.length){for(;n--;)if((192&r[++t])!=128)return!1;return!0}return!1}var l,u=function(e){for(var t=[],n=e,r=0,i=e.length;r<i;)if(n[r]<128)t.push(String.fromCharCode(n[r])),++r;else{if(!(n[r]<192)){if(n[r]<224){if(c(n,r,1)&&(a=(31&n[r])<<6|63&n[r+1])>=128){t.push(String.fromCharCode(65535&a)),r+=2;continue}}else if(n[r]<240){if(c(n,r,2)&&(a=(15&n[r])<<12|(63&n[r+1])<<6|63&n[r+2])>=2048&&(63488&a)!=55296){t.push(String.fromCharCode(65535&a)),r+=3;continue}}else if(n[r]<248){var a;if(c(n,r,3)&&(a=(7&n[r])<<18|(63&n[r+1])<<12|(63&n[r+2])<<6|63&n[r+3])>65536&&a<1114112){a-=65536,t.push(String.fromCharCode(a>>>10|55296)),t.push(String.fromCharCode(1023&a|56320)),r+=4;continue}}}t.push(`�`),++r}return t.join(``)},d=n(3),f=(l=new ArrayBuffer(2),new DataView(l).setInt16(0,256,!0),new Int16Array(l)[0]===256),p=function(){function e(){}return e.parseScriptData=function(t,n,r){var i={};try{var o=e.parseValue(t,n,r),s=e.parseValue(t,n+o.size,r-o.size);i[o.data]=s.data}catch(e){a.a.e(`AMF`,e.toString())}return i},e.parseObject=function(t,n,r){if(r<3)throw new d.a(`Data not enough when parse ScriptDataObject`);var i=e.parseString(t,n,r),a=e.parseValue(t,n+i.size,r-i.size),o=a.objectEnd;return{data:{name:i.data,value:a.data},size:i.size+a.size,objectEnd:o}},e.parseVariable=function(t,n,r){return e.parseObject(t,n,r)},e.parseString=function(e,t,n){if(n<2)throw new d.a(`Data not enough when parse String`);var r=new DataView(e,t,n).getUint16(0,!f);return{data:r>0?u(new Uint8Array(e,t+2,r)):``,size:2+r}},e.parseLongString=function(e,t,n){if(n<4)throw new d.a(`Data not enough when parse LongString`);var r=new DataView(e,t,n).getUint32(0,!f);return{data:r>0?u(new Uint8Array(e,t+4,r)):``,size:4+r}},e.parseDate=function(e,t,n){if(n<10)throw new d.a(`Data size invalid when parse Date`);var r=new DataView(e,t,n),i=r.getFloat64(0,!f),a=r.getInt16(8,!f);return{data:new Date(i+=60*a*1e3),size:10}},e.parseValue=function(t,n,r){if(r<1)throw new d.a(`Data not enough when parse Value`);var i,o=new DataView(t,n,r),s=1,c=o.getUint8(0),l=!1;try{switch(c){case 0:i=o.getFloat64(1,!f),s+=8;break;case 1:i=!!o.getUint8(1),s+=1;break;case 2:var u=e.parseString(t,n+1,r-1);i=u.data,s+=u.size;break;case 3:i={};var p=0;for((16777215&o.getUint32(r-4,!f))==9&&(p=3);s<r-4;){var m=e.parseObject(t,n+s,r-s-p);if(m.objectEnd)break;i[m.data.name]=m.data.value,s+=m.size}s<=r-3&&(16777215&o.getUint32(s-1,!f))==9&&(s+=3);break;case 8:for(i={},s+=4,p=0,(16777215&o.getUint32(r-4,!f))==9&&(p=3);s<r-8;){var h=e.parseVariable(t,n+s,r-s-p);if(h.objectEnd)break;i[h.data.name]=h.data.value,s+=h.size}s<=r-3&&(16777215&o.getUint32(s-1,!f))==9&&(s+=3);break;case 9:i=void 0,s=1,l=!0;break;case 10:i=[];var g=o.getUint32(1,!f);s+=4;for(var _=0;_<g;_++){var v=e.parseValue(t,n+s,r-s);i.push(v.data),s+=v.size}break;case 11:var y=e.parseDate(t,n+1,r-1);i=y.data,s+=y.size;break;case 12:var b=e.parseString(t,n+1,r-1);i=b.data,s+=b.size;break;default:s=r,a.a.w(`AMF`,`Unsupported AMF value type `+c)}}catch(e){a.a.e(`AMF`,e.toString())}return{data:i,size:s,objectEnd:l}},e}(),m=function(){function e(e){this.TAG=`ExpGolomb`,this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=8*e.byteLength,this._current_word=0,this._current_word_bits_left=0}return e.prototype.destroy=function(){this._buffer=null},e.prototype._fillCurrentWord=function(){var e=this._total_bytes-this._buffer_index;if(e<=0)throw new d.a(`ExpGolomb: _fillCurrentWord() but no bytes available`);var t=Math.min(4,e),n=new Uint8Array(4);n.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(n.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t},e.prototype.readBits=function(e){if(e>32)throw new d.b(`ExpGolomb: readBits() bits exceeded max 32bits!`);if(e<=this._current_word_bits_left){var t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}var n=this._current_word_bits_left?this._current_word:0;n>>>=32-this._current_word_bits_left;var r=e-this._current_word_bits_left;this._fillCurrentWord();var i=Math.min(r,this._current_word_bits_left),a=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,n=n<<i|a},e.prototype.readBool=function(){return this.readBits(1)===1},e.prototype.readByte=function(){return this.readBits(8)},e.prototype._skipLeadingZero=function(){var e;for(e=0;e<this._current_word_bits_left;e++)if(this._current_word&2147483648>>>e)return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()},e.prototype.readUEG=function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1},e.prototype.readSEG=function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)},e}(),h=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,n=t.byteLength,r=new Uint8Array(n),i=0,a=0;a<n;a++)a>=2&&t[a]===3&&t[a-1]===0&&t[a-2]===0||(r[i]=t[a],i++);return new Uint8Array(r.buffer,0,i)},e.parseSPS=function(t){for(var n=t.subarray(1,4),r=`avc1.`,i=0;i<3;i++){var a=n[i].toString(16);a.length<2&&(a=`0`+a),r+=a}var o=new m(e._ebsp2rbsp(t));o.readByte();var s=o.readByte();o.readByte();var c=o.readByte();o.readUEG();var l=e.getProfileString(s),u=e.getLevelString(c),d=1,f=420,p=8,h=8;if((s===100||s===110||s===122||s===244||s===44||s===83||s===86||s===118||s===128||s===138||s===144)&&((d=o.readUEG())===3&&o.readBits(1),d<=3&&(f=[0,420,422,444][d]),p=o.readUEG()+8,h=o.readUEG()+8,o.readBits(1),o.readBool()))for(var g=d===3?12:8,_=0;_<g;_++)o.readBool()&&(_<6?e._skipScalingList(o,16):e._skipScalingList(o,64));o.readUEG();var v=o.readUEG();if(v===0)o.readUEG();else if(v===1){o.readBits(1),o.readSEG(),o.readSEG();var y=o.readUEG();for(_=0;_<y;_++)o.readSEG()}var b=o.readUEG();o.readBits(1);var x=o.readUEG(),S=o.readUEG(),C=o.readBits(1);C===0&&o.readBits(1),o.readBits(1);var w=0,T=0,E=0,D=0;o.readBool()&&(w=o.readUEG(),T=o.readUEG(),E=o.readUEG(),D=o.readUEG());var O=1,k=1,A=0,j=!0,M=0,N=0;if(o.readBool()){if(o.readBool()){var P=o.readByte();P>0&&P<16?(O=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][P-1],k=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][P-1]):P===255&&(O=o.readByte()<<8|o.readByte(),k=o.readByte()<<8|o.readByte())}if(o.readBool()&&o.readBool(),o.readBool()&&(o.readBits(4),o.readBool()&&o.readBits(24)),o.readBool()&&(o.readUEG(),o.readUEG()),o.readBool()){var F=o.readBits(32),I=o.readBits(32);j=o.readBool(),A=(M=I)/(N=2*F)}}var ee=1;O===1&&k===1||(ee=O/k);var L=0,R=0;d===0?(L=1,R=2-C):(L=d===3?1:2,R=(d===1?2:1)*(2-C));var te=16*(x+1),ne=16*(S+1)*(2-C);te-=(w+T)*L,ne-=(E+D)*R;var re=Math.ceil(te*ee);return o.destroy(),o=null,{codec_mimetype:r,profile_idc:s,level_idc:c,profile_string:l,level_string:u,chroma_format_idc:d,bit_depth:p,bit_depth_luma:p,bit_depth_chroma:h,ref_frames:b,chroma_format:f,chroma_format_string:e.getChromaFormatString(f),frame_rate:{fixed:j,fps:A,fps_den:N,fps_num:M},sar_ratio:{width:O,height:k},codec_size:{width:te,height:ne},present_size:{width:re,height:ne}}},e._skipScalingList=function(e,t){for(var n=8,r=8,i=0;i<t;i++)r!==0&&(r=(n+e.readSEG()+256)%256),n=r===0?n:r},e.getProfileString=function(e){switch(e){case 66:return`Baseline`;case 77:return`Main`;case 88:return`Extended`;case 100:return`High`;case 110:return`High10`;case 122:return`High422`;case 244:return`High444`;default:return`Unknown`}},e.getLevelString=function(e){return(e/10).toFixed(1)},e.getChromaFormatString=function(e){switch(e){case 420:return`4:2:0`;case 422:return`4:2:2`;case 444:return`4:4:4`;default:return`Unknown`}},e}(),g=n(6),_=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,n=t.byteLength,r=new Uint8Array(n),i=0,a=0;a<n;a++)a>=2&&t[a]===3&&t[a-1]===0&&t[a-2]===0||(r[i]=t[a],i++);return new Uint8Array(r.buffer,0,i)},e.parseVPS=function(t){var n=new m(e._ebsp2rbsp(t));return n.readByte(),n.readByte(),n.readBits(4),n.readBits(2),n.readBits(6),{num_temporal_layers:n.readBits(3)+1,temporal_id_nested:n.readBool()}},e.parseSPS=function(t){var n=new m(e._ebsp2rbsp(t));n.readByte(),n.readByte();for(var r=0,i=0,a=0,o=0,s=(n.readBits(4),n.readBits(3)),c=(n.readBool(),n.readBits(2)),l=n.readBool(),u=n.readBits(5),d=n.readByte(),f=n.readByte(),p=n.readByte(),h=n.readByte(),g=n.readByte(),_=n.readByte(),v=n.readByte(),y=n.readByte(),b=n.readByte(),x=n.readByte(),S=n.readByte(),C=[],w=[],T=0;T<s;T++)C.push(n.readBool()),w.push(n.readBool());if(s>0)for(T=s;T<8;T++)n.readBits(2);for(T=0;T<s;T++)C[T]&&(n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte()),w[T]&&n.readByte();n.readUEG();var E=n.readUEG();E==3&&n.readBits(1);var D=n.readUEG(),O=n.readUEG();n.readBool()&&(r+=n.readUEG(),i+=n.readUEG(),a+=n.readUEG(),o+=n.readUEG());var k=n.readUEG(),A=n.readUEG(),j=n.readUEG();for(T=n.readBool()?0:s;T<=s;T++)n.readUEG(),n.readUEG(),n.readUEG();if(n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readBool()&&n.readBool())for(var M=0;M<4;M++)for(var N=0;N<(M===3?2:6);N++)if(n.readBool()){var P=Math.min(64,1<<4+(M<<1));for(M>1&&n.readSEG(),T=0;T<P;T++)n.readSEG()}else n.readUEG();n.readBool(),n.readBool(),n.readBool()&&(n.readByte(),n.readUEG(),n.readUEG(),n.readBool());var F=n.readUEG(),I=0;for(T=0;T<F;T++){var ee=!1;if(T!==0&&(ee=n.readBool()),ee){T===F&&n.readUEG(),n.readBool(),n.readUEG();for(var L=0,R=0;R<=I;R++){var te=n.readBool(),ne=!1;te||(ne=n.readBool()),(te||ne)&&L++}I=L}else{var re=n.readUEG(),ie=n.readUEG();for(I=re+ie,R=0;R<re;R++)n.readUEG(),n.readBool();for(R=0;R<ie;R++)n.readUEG(),n.readBool()}}if(n.readBool()){var ae=n.readUEG();for(T=0;T<ae;T++){for(R=0;R<j+4;R++)n.readBits(1);n.readBits(1)}}var oe=0,se=1,ce=1,le=!1,ue=1,de=1;if(n.readBool(),n.readBool(),n.readBool()){if(n.readBool()){var fe=n.readByte();fe>0&&fe<=16?(se=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][fe-1],ce=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][fe-1]):fe===255&&(se=n.readBits(16),ce=n.readBits(16))}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(3),n.readBool(),n.readBool()&&(n.readByte(),n.readByte(),n.readByte())),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool(),n.readBool(),n.readBool(),n.readBool()&&(n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG()),n.readBool()&&(ue=n.readBits(32),de=n.readBits(32),n.readBool()&&n.readUEG(),n.readBool())){var pe=!1,me=!1,he=!1;for(pe=n.readBool(),me=n.readBool(),(pe||me)&&((he=n.readBool())&&(n.readByte(),n.readBits(5),n.readBool(),n.readBits(5)),n.readBits(4),n.readBits(4),he&&n.readBits(4),n.readBits(5),n.readBits(5),n.readBits(5)),T=0;T<=s;T++){var ge=n.readBool();le=ge;var _e=!0,ve=1;ge||(_e=n.readBool());var ye=!1;if(_e?n.readUEG():ye=n.readBool(),ye||(ve=n.readUEG()+1),pe){for(R=0;R<ve;R++)n.readUEG(),n.readUEG(),he&&(n.readUEG(),n.readUEG());n.readBool()}if(me){for(R=0;R<ve;R++)n.readUEG(),n.readUEG(),he&&(n.readUEG(),n.readUEG());n.readBool()}}}n.readBool()&&(n.readBool(),n.readBool(),n.readBool(),oe=n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG())}n.readBool();var be=`hvc1.${u}.1.L${S}.B0`,xe=D-(r+i)*(E===1||E===2?2:1),Se=O-(a+o)*(E===1?2:1),Ce=1;return se!==1&&ce!==1&&(Ce=se/ce),n.destroy(),n=null,{codec_mimetype:be,profile_string:e.getProfileString(u),level_string:e.getLevelString(S),profile_idc:u,bit_depth:k+8,ref_frames:1,chroma_format:E,chroma_format_string:e.getChromaFormatString(E),general_level_idc:S,general_profile_space:c,general_tier_flag:l,general_profile_idc:u,general_profile_compatibility_flags_1:d,general_profile_compatibility_flags_2:f,general_profile_compatibility_flags_3:p,general_profile_compatibility_flags_4:h,general_constraint_indicator_flags_1:g,general_constraint_indicator_flags_2:_,general_constraint_indicator_flags_3:v,general_constraint_indicator_flags_4:y,general_constraint_indicator_flags_5:b,general_constraint_indicator_flags_6:x,min_spatial_segmentation_idc:oe,constant_frame_rate:0,chroma_format_idc:E,bit_depth_luma_minus8:k,bit_depth_chroma_minus8:A,frame_rate:{fixed:le,fps:de/ue,fps_den:ue,fps_num:de},sar_ratio:{width:se,height:ce},codec_size:{width:xe,height:Se},present_size:{width:xe*Ce,height:Se}}},e.parsePPS=function(t){var n=new m(e._ebsp2rbsp(t));n.readByte(),n.readByte(),n.readUEG(),n.readUEG(),n.readBool(),n.readBool(),n.readBits(3),n.readBool(),n.readBool(),n.readUEG(),n.readUEG(),n.readSEG(),n.readBool(),n.readBool(),n.readBool()&&n.readUEG(),n.readSEG(),n.readSEG(),n.readBool(),n.readBool(),n.readBool(),n.readBool();var r=n.readBool(),i=n.readBool(),a=1;return i&&r?a=0:i?a=3:r&&(a=2),{parallelismType:a}},e.getChromaFormatString=function(e){switch(e){case 0:return`4:0:0`;case 1:return`4:2:0`;case 2:return`4:2:2`;case 3:return`4:4:4`;default:return`Unknown`}},e.getProfileString=function(e){switch(e){case 1:return`Main`;case 2:return`Main10`;case 3:return`MainSP`;case 4:return`Rext`;case 9:return`SCC`;default:return`Unknown`}},e.getLevelString=function(e){return(e/30).toFixed(1)},e}();function v(e){return e.byteOffset%2==0&&e.byteLength%2==0}function y(e){return e.byteOffset%4==0&&e.byteLength%4==0}function b(e,t){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var x=function(e,t){return e.byteLength===t.byteLength&&(y(e)&&y(t)?function(e,t){return b(new Uint32Array(e.buffer,e.byteOffset,e.byteLength/4),new Uint32Array(t.buffer,t.byteOffset,t.byteLength/4))}(e,t):v(e)&&v(t)?function(e,t){return b(new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2))}(e,t):function(e,t){return b(e,t)}(e,t))},S=function(){return(S=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},C=function(){function e(){}return e.parseOBUs=function(t,n){for(var r=0;r<t.byteLength;){var i=r,a=(t[r],(120&t[r])>>3),o=(4&t[r])!=0,s=(2&t[r])!=0;t[r],r+=1,o&&(r+=1);var c=1/0;if(s){c=0;for(var l=0;;l++){var u=t[r++];if(c|=(127&u)<<7*l,!(128&u))break}}console.log(a),a===1?n=S(S({},e.parseSeuqneceHeader(t.subarray(r,r+c))),{sequence_header_data:t.subarray(i,r+c)}):(a==3&&n||a==6&&n)&&(n=e.parseOBUFrameHeader(t.subarray(r,r+c),0,0,n)),r+=c}return n},e.parseSeuqneceHeader=function(t){var n=new m(t),r=n.readBits(3),i=(n.readBool(),n.readBool()),a=!0,o=0,s=1,c=void 0,l=[];if(i)l.push({operating_point_idc:0,level:n.readBits(5),tier:0});else{if(n.readBool()){var u=n.readBits(32),d=n.readBits(32),f=n.readBool();if(f){for(var p=0;n.readBits(1)===0;)p+=1;p>=32||(1<<p)-1+n.readBits(p)}(o=d)/(s=u),a=f,n.readBool()&&(n.readBits(5),n.readBits(32),c=n.readBits(5),n.readBits(5))}for(var h=n.readBool(),g=n.readBits(5),_=0;_<=g;_++){var v=n.readBits(12),y=n.readBits(5),b=y>7?n.readBits(1):0;l.push({operating_point_idc:v,level:y,tier:b}),h&&n.readBool()&&n.readBits(4)}}var x=l[0],S=x.level,C=x.tier,w=n.readBits(4),T=n.readBits(4),E=n.readBits(w+1)+1,D=n.readBits(T+1)+1,O=!1;i||(O=n.readBool()),O&&(n.readBits(4),n.readBits(4)),n.readBool(),n.readBool(),n.readBool();var k=!1,A=2,j=2,M=0;i||(n.readBool(),n.readBool(),n.readBool(),n.readBool(),(k=n.readBool())&&(n.readBool(),n.readBool()),j=(A=n.readBool()?2:n.readBits(1))?n.readBool()?2:n.readBits(1):2,M=k?n.readBits(3)+1:0);var N=n.readBool(),P=(n.readBool(),n.readBool(),n.readBool()),F=8;F=r===2&&P?n.readBool()?12:10:P?10:8;var I=!1;r!==1&&(I=n.readBool()),n.readBool()&&(n.readBits(8),n.readBits(8),n.readBits(8));var ee=1,L=1;return I?(n.readBits(1),ee=1,L=1):(n.readBits(1),r==0?(ee=1,L=1):r==1?(ee=0,L=0):F==12?n.readBits(1)&&n.readBits(1):(ee=1,L=0),ee&&L&&n.readBits(2),n.readBits(1)),n.readBool(),n.destroy(),n=null,{codec_mimetype:`av01.${r}.${e.getLevelString(S,C)}.${F.toString(10).padStart(2,`0`)}`,level:S,tier:C,level_string:e.getLevelString(S,C),profile_idc:r,profile_string:`${r}`,bit_depth:F,ref_frames:1,chroma_format:e.getChromaFormat(I,ee,L),chroma_format_string:e.getChromaFormatString(I,ee,L),sequence_header:{frame_id_numbers_present_flag:O,additional_frame_id_length_minus_1:void 0,delta_frame_id_length_minus_2:void 0,reduced_still_picture_header:i,decoder_model_info_present_flag:!1,operating_points:l,buffer_removal_time_length_minus_1:c,equal_picture_interval:a,seq_force_screen_content_tools:A,seq_force_integer_mv:j,enable_order_hint:k,order_hint_bits:M,enable_superres:N,frame_width_bit:w+1,frame_height_bit:T+1,max_frame_width:E,max_frame_height:D},keyframe:void 0,frame_rate:{fixed:a,fps:o/s,fps_den:s,fps_num:o}}},e.parseOBUFrameHeader=function(t,n,r,i){var a=i.sequence_header,o=new m(t),s=(a.max_frame_width,a.max_frame_height,0);a.frame_id_numbers_present_flag&&(s=a.additional_frame_id_length_minus_1+a.delta_frame_id_length_minus_2+3);var c=0,l=!0,u=!0,d=!1;if(!a.reduced_still_picture_header){if(o.readBool())return i;l=(c=o.readBits(2))===2||c===0,(u=o.readBool())&&a.decoder_model_info_present_flag&&a.equal_picture_interval,u&&o.readBool(),d=!!(c===3||c===0&&u)||o.readBool()}i.keyframe=l,o.readBool();var f=a.seq_force_screen_content_tools;a.seq_force_screen_content_tools===2&&(f=o.readBits(1)),f&&(a.seq_force_integer_mv,a.seq_force_integer_mv==2&&o.readBits(1)),a.frame_id_numbers_present_flag&&o.readBits(s);var p=!1;if(p=c==3||!a.reduced_still_picture_header&&o.readBool(),o.readBits(a.order_hint_bits),(l||d||o.readBits(3),a.decoder_model_info_present_flag)&&o.readBool()){for(var h=0;h<=a.operating_points_cnt_minus_1;h++)if(a.operating_points[h].decoder_model_present_for_this_op[h]){var g=a.operating_points[h].operating_point_idc;(g===0||g>>n&1&&g>>r+8&1)&&o.readBits(a.buffer_removal_time_length_minus_1+1)}}var _=255;if(c===3||c==0&&u||(_=o.readBits(8)),(l||_!==255)&&d&&a.enable_order_hint)for(var v=0;v<8;v++)o.readBits(a.order_hint_bits);if(l){var y=e.frameSizeAndRenderSize(o,p,a);i.codec_size={width:y.FrameWidth,height:y.FrameHeight},i.present_size={width:y.RenderWidth,height:y.RenderHeight},i.sar_ratio={width:y.RenderWidth/y.FrameWidth,height:y.RenderHeight/y.FrameHeight}}return o.destroy(),o=null,i},e.frameSizeAndRenderSize=function(e,t,n){var r=n.max_frame_width,i=n.max_frame_height;t&&(r=e.readBits(n.frame_width_bit)+1,i=e.readBits(n.frame_height_bit)+1);var a=!1;n.enable_superres&&(a=e.readBool());var o=8;a&&(o=e.readBits(3)+9);var s=r;r=Math.floor((8*s+o/2)/o);var c=s,l=i;if(e.readBool()){var u=e.readBits(16)+1,d=e.readBits(16)+1;c=e.readBits(u)+1,l=e.readBits(d)+1}return{UpscaledWidth:s,FrameWidth:r,FrameHeight:i,RenderWidth:c,RenderHeight:l}},e.getLevelString=function(e,t){return`${e.toString(10).padStart(2,`0`)}${t===0?`M`:`H`}`},e.getChromaFormat=function(e,t,n){return e?0:t===0&&n===0?3:t===1&&n===0?2:t===1&&n===1?1:NaN},e.getChromaFormatString=function(e,t,n){return e?`4:0:0`:t===0&&n===0?`4:4:4`:t===1&&n===0?`4:2:2`:t===1&&n===1?`4:2:0`:`Unknown`},e}(),w,T=function(){function e(e,t){this.TAG=`FLVDemuxer`,this._config=t,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=e.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=e.hasAudioTrack,this._hasVideo=e.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new s.a,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:`video`,id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:`audio`,id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256}()}return e.prototype.destroy=function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null},e.probe=function(e){var t=new Uint8Array(e);if(t.byteLength<9)return{needMoreData:!0};var n={match:!1};if(t[0]!==70||t[1]!==76||t[2]!==86||t[3]!==1)return n;var r,i,a=(4&t[4])>>>2!=0,o=(1&t[4])!=0,s=(r=t)[i=5]<<24|r[i+1]<<16|r[i+2]<<8|r[i+3];return s<9?n:{match:!0,consumed:s,dataOffset:s,hasAudioTrack:a,hasVideoTrack:o}},e.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(e.prototype,`onTrackMetadata`,{get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onMediaInfo`,{get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onMetaDataArrived`,{get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onScriptDataArrived`,{get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onError`,{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onDataAvailable`,{get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`timestampBase`,{get:function(){return this._timestampBase},set:function(e){this._timestampBase=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`overridedDuration`,{get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo.duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`overridedHasAudio`,{set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`overridedHasVideo`,{set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e},enumerable:!1,configurable:!0}),e.prototype.resetMediaInfo=function(){this._mediaInfo=new s.a},e.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched},e.prototype.parseChunks=function(t,n){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new d.a(`Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified`);var r=0,i=this._littleEndian;if(n===0){if(!(t.byteLength>13))return 0;r=e.probe(t).dataOffset}for(this._firstParse&&(this._firstParse=!1,n+r!==this._dataOffset&&a.a.w(this.TAG,`First time parsing but chunk byteStart invalid!`),(o=new DataView(t,r)).getUint32(0,!i)!==0&&a.a.w(this.TAG,`PrevTagSize0 !== 0 !!!`),r+=4);r<t.byteLength;){this._dispatch=!0;var o=new DataView(t,r);if(r+11+4>t.byteLength)break;var s=o.getUint8(0),c=16777215&o.getUint32(0,!i);if(r+11+c+4>t.byteLength)break;if(s===8||s===9||s===18){var l=o.getUint8(4),u=o.getUint8(5),f=o.getUint8(6)|u<<8|l<<16|o.getUint8(7)<<24;16777215&o.getUint32(7,!i)&&a.a.w(this.TAG,`Meet tag which has StreamID != 0!`);var p=r+11;switch(s){case 8:this._parseAudioData(t,p,c,f);break;case 9:this._parseVideoData(t,p,c,f,n+r);break;case 18:this._parseScriptData(t,p,c)}var m=o.getUint32(11+c,!i);m!==11+c&&a.a.w(this.TAG,`Invalid PrevTagSize ${m}`),r+=11+c+4}else a.a.w(this.TAG,`Unsupported tag type ${s}, skipped`),r+=11+c+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),r},e.prototype._parseScriptData=function(e,t,n){var r=p.parseScriptData(e,t,n);if(r.hasOwnProperty(`onMetaData`)){if(r.onMetaData==null||typeof r.onMetaData!=`object`)return void a.a.w(this.TAG,`Invalid onMetaData structure!`);this._metadata&&a.a.w(this.TAG,`Found another onMetaData tag!`),this._metadata=r;var i=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},i)),typeof i.hasAudio==`boolean`&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=i.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),typeof i.hasVideo==`boolean`&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=i.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),typeof i.audiodatarate==`number`&&(this._mediaInfo.audioDataRate=i.audiodatarate),typeof i.videodatarate==`number`&&(this._mediaInfo.videoDataRate=i.videodatarate),typeof i.width==`number`&&(this._mediaInfo.width=i.width),typeof i.height==`number`&&(this._mediaInfo.height=i.height),typeof i.duration==`number`){if(!this._durationOverrided){var o=Math.floor(i.duration*this._timescale);this._duration=o,this._mediaInfo.duration=o}}else this._mediaInfo.duration=0;if(typeof i.framerate==`number`){var s=Math.floor(1e3*i.framerate);if(s>0){var c=s/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=c,this._referenceFrameRate.fps_num=s,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=c}}if(typeof i.keyframes==`object`){this._mediaInfo.hasKeyframesIndex=!0;var l=i.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(l),i.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=i,a.a.v(this.TAG,`Parsed onMetaData`),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(r).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},r))},e.prototype._parseKeyframesIndex=function(e){for(var t=[],n=[],r=1;r<e.times.length;r++){var i=this._timestampBase+Math.floor(1e3*e.times[r]);t.push(i),n.push(e.filepositions[r])}return{times:t,filepositions:n}},e.prototype._parseAudioData=function(e,t,n,r){if(n<=1)a.a.w(this.TAG,`Flv: Invalid audio packet, missing SoundData payload!`);else if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){this._littleEndian;var i=new DataView(e,t,n).getUint8(0),o=i>>>4;if(o!==9)if(o===2||o===10){var s=0,c=(12&i)>>>2;if(c>=0&&c<=4){s=this._flvSoundRateTable[c];var l=1&i,u=this._audioMetadata,d=this._audioTrack;if(u||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(u=this._audioMetadata={}).type=`audio`,u.id=d.id,u.timescale=this._timescale,u.duration=this._duration,u.audioSampleRate=s,u.channelCount=l===0?1:2),o===10){var f=this._parseAACAudioData(e,t+1,n-1);if(f==null)return;if(f.packetType===0){if(u.config){if(x(f.data.config,u.config))return;a.a.w(this.TAG,`AudioSpecificConfig has been changed, re-generate initialization segment`)}var p=f.data;u.audioSampleRate=p.samplingRate,u.channelCount=p.channelCount,u.codec=p.codec,u.originalCodec=p.originalCodec,u.config=p.config,u.refSampleDuration=1024/u.audioSampleRate*u.timescale,a.a.v(this.TAG,`Parsed AudioSpecificConfig`),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata(`audio`,u),(_=this._mediaInfo).audioCodec=u.originalCodec,_.audioSampleRate=u.audioSampleRate,_.audioChannelCount=u.channelCount,_.hasVideo?_.videoCodec!=null&&(_.mimeType=`video/x-flv; codecs="`+_.videoCodec+`,`+_.audioCodec+`"`):_.mimeType=`video/x-flv; codecs="`+_.audioCodec+`"`,_.isComplete()&&this._onMediaInfo(_)}else if(f.packetType===1){var m=this._timestampBase+r,h={unit:f.data,length:f.data.byteLength,dts:m,pts:m};d.samples.push(h),d.length+=f.data.length}else a.a.e(this.TAG,`Flv: Unsupported AAC data type ${f.packetType}`)}else if(o===2){if(!u.codec){var _;if((p=this._parseMP3AudioData(e,t+1,n-1,!0))==null)return;u.audioSampleRate=p.samplingRate,u.channelCount=p.channelCount,u.codec=p.codec,u.originalCodec=p.originalCodec,u.refSampleDuration=1152/u.audioSampleRate*u.timescale,a.a.v(this.TAG,`Parsed MPEG Audio Frame Header`),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata(`audio`,u),(_=this._mediaInfo).audioCodec=u.codec,_.audioSampleRate=u.audioSampleRate,_.audioChannelCount=u.channelCount,_.audioDataRate=p.bitRate,_.hasVideo?_.videoCodec!=null&&(_.mimeType=`video/x-flv; codecs="`+_.videoCodec+`,`+_.audioCodec+`"`):_.mimeType=`video/x-flv; codecs="`+_.audioCodec+`"`,_.isComplete()&&this._onMediaInfo(_)}var v=this._parseMP3AudioData(e,t+1,n-1,!1);if(v==null)return;m=this._timestampBase+r;var y={unit:v,length:v.byteLength,dts:m,pts:m};d.samples.push(y),d.length+=v.length}}else this._onError(g.a.FORMAT_ERROR,`Flv: Invalid audio sample rate idx: `+c)}else this._onError(g.a.CODEC_UNSUPPORTED,`Flv: Unsupported audio codec idx: `+o);else{if(n<=5)return void a.a.w(this.TAG,`Flv: Invalid audio packet, missing AudioFourCC in Ehnanced FLV payload!`);var b=15&i,S=String.fromCharCode.apply(String,new Uint8Array(e,t,n).slice(1,5));switch(S){case`Opus`:this._parseOpusAudioPacket(e,t+5,n-5,r,b);break;case`fLaC`:this._parseFlacAudioPacket(e,t+5,n-5,r,b);break;default:this._onError(g.a.CODEC_UNSUPPORTED,`Flv: Unsupported audio codec: `+S)}}}},e.prototype._parseAACAudioData=function(e,t,n){if(!(n<=1)){var r={},i=new Uint8Array(e,t,n);return r.packetType=i[0],i[0]===0?r.data=this._parseAACAudioSpecificConfig(e,t+1,n-1):r.data=i.subarray(1),r}a.a.w(this.TAG,`Flv: Invalid AAC packet, missing AACPacketType or/and Data!`)},e.prototype._parseAACAudioSpecificConfig=function(e,t,n){var r,i,a=new Uint8Array(e,t,n),o=null,s=0,c=null;if(s=r=a[0]>>>3,(i=(7&a[0])<<1|a[1]>>>7)<0||i>=this._mpegSamplingRates.length)this._onError(g.a.FORMAT_ERROR,`Flv: AAC invalid sampling frequency index!`);else{var l=this._mpegSamplingRates[i],u=(120&a[1])>>>3;if(!(u<0||u>=8)){s===5&&(c=(7&a[1])<<1|a[2]>>>7,(124&a[2])>>>2);var d=self.navigator.userAgent.toLowerCase();return d.indexOf(`firefox`)===-1?d.indexOf(`android`)===-1?(s=5,c=i,o=[,,,,],i>=6?c=i-3:u===1&&(s=2,o=[,,],c=i)):(s=2,o=[,,],c=i):i>=6?(s=5,o=[,,,,],c=i-3):(s=2,o=[,,],c=i),o[0]=s<<3,o[0]|=(15&i)>>>1,o[1]=(15&i)<<7,o[1]|=(15&u)<<3,s===5&&(o[1]|=(15&c)>>>1,o[2]=(1&c)<<7,o[2]|=8,o[3]=0),{config:o,samplingRate:l,channelCount:u,codec:`mp4a.40.`+s,originalCodec:`mp4a.40.`+r}}this._onError(g.a.FORMAT_ERROR,`Flv: AAC invalid channel configuration`)}},e.prototype._parseMP3AudioData=function(e,t,n,r){if(!(n<4)){this._littleEndian;var i=new Uint8Array(e,t,n),o=null;if(r){if(i[0]!==255)return;var s=i[1]>>>3&3,c=(6&i[1])>>1,l=(240&i[2])>>>4,u=(12&i[2])>>>2,d=(i[3]>>>6&3)==3?1:2,f=0,p=0;switch(s){case 0:f=this._mpegAudioV25SampleRateTable[u];break;case 2:f=this._mpegAudioV20SampleRateTable[u];break;case 3:f=this._mpegAudioV10SampleRateTable[u]}switch(c){case 1:l<this._mpegAudioL3BitRateTable.length&&(p=this._mpegAudioL3BitRateTable[l]);break;case 2:l<this._mpegAudioL2BitRateTable.length&&(p=this._mpegAudioL2BitRateTable[l]);break;case 3:l<this._mpegAudioL1BitRateTable.length&&(p=this._mpegAudioL1BitRateTable[l])}o={bitRate:p,samplingRate:f,channelCount:d,codec:`mp3`,originalCodec:`mp3`}}else o=i;return o}a.a.w(this.TAG,`Flv: Invalid MP3 packet, header missing!`)},e.prototype._parseOpusAudioPacket=function(e,t,n,r,i){if(i===0)this._parseOpusSequenceHeader(e,t,n);else if(i===1)this._parseOpusAudioData(e,t,n,r);else if(i!==2)return void this._onError(g.a.FORMAT_ERROR,`Flv: Invalid video packet type ${i}`)},e.prototype._parseOpusSequenceHeader=function(e,t,n){if(n<=16)a.a.w(this.TAG,`Flv: Invalid OpusSequenceHeader, lack of data!`);else{var r=this._audioMetadata,i=this._audioTrack;r||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(r=this._audioMetadata={}).type=`audio`,r.id=i.id,r.timescale=this._timescale,r.duration=this._duration);var o=new DataView(e,t,n);o.setUint8(8,0);var s=o.getUint8(9);o.setUint16(10,o.getUint16(10,!0),!1);var c=o.getUint32(12,!0);o.setUint32(12,o.getUint32(12,!0),!1);var l={config:new Uint8Array(e,t+8,n-8),channelCount:s,samplingFrequence:c,codec:`opus`,originalCodec:`opus`};if(r.config){if(x(l.config,r.config))return;a.a.w(this.TAG,`OpusSequenceHeader has been changed, re-generate initialization segment`)}r.audioSampleRate=l.samplingFrequence,r.channelCount=l.channelCount,r.codec=l.codec,r.originalCodec=l.originalCodec,r.config=l.config,r.refSampleDuration=20,a.a.v(this.TAG,`Parsed OpusSequenceHeader`),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata(`audio`,r);var u=this._mediaInfo;u.audioCodec=r.originalCodec,u.audioSampleRate=r.audioSampleRate,u.audioChannelCount=r.channelCount,u.hasVideo?u.videoCodec!=null&&(u.mimeType=`video/x-flv; codecs="`+u.videoCodec+`,`+u.audioCodec+`"`):u.mimeType=`video/x-flv; codecs="`+u.audioCodec+`"`,u.isComplete()&&this._onMediaInfo(u)}},e.prototype._parseOpusAudioData=function(e,t,n,r){var i=this._audioTrack,a=new Uint8Array(e,t,n),o=this._timestampBase+r,s={unit:a,length:a.byteLength,dts:o,pts:o};i.samples.push(s),i.length+=a.length},e.prototype._parseFlacAudioPacket=function(e,t,n,r,i){if(i===0)this._parseFlacSequenceHeader(e,t,n);else if(i===1)this._parseFlacAudioData(e,t,n,r);else if(i!==2)return void this._onError(g.a.FORMAT_ERROR,`Flv: Invalid Flac audio packet type ${i}`)},e.prototype._parseFlacSequenceHeader=function(e,t,n){var r=this._audioMetadata,i=this._audioTrack;r||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(r=this._audioMetadata={}).type=`audio`,r.id=i.id,r.timescale=this._timescale,r.duration=this._duration);var o=new Uint8Array(e,t+4,n-4),s=new m(o),c=s.readBits(16),l=s.readBits(16),u=l===c?l:null;s.readBits(24),s.readBits(24);var d=s.readBits(20),f=s.readBits(3)+1,p=s.readBits(5)+1;s.destroy();var h=new Uint8Array(o.byteLength+4);h.set(o,4),h[0]=128,h[1]=o.byteLength>>>16&255,h[2]=o.byteLength>>>8&255,h[3]=o.byteLength>>>0&255;var g={config:h,channelCount:f,samplingFrequence:d,sampleSize:p,codec:`flac`,originalCodec:`flac`};if(r.config){if(x(g.config,r.config))return;a.a.w(this.TAG,`FlacSequenceHeader has been changed, re-generate initialization segment`)}r.audioSampleRate=g.samplingFrequence,r.channelCount=g.channelCount,r.sampleSize=g.sampleSize,r.codec=g.codec,r.originalCodec=g.originalCodec,r.config=g.config,r.refSampleDuration=u==null?null:1e3*u/g.samplingFrequence,a.a.v(this.TAG,`Parsed FlacSequenceHeader`),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata(`audio`,r);var _=this._mediaInfo;_.audioCodec=r.originalCodec,_.audioSampleRate=r.audioSampleRate,_.audioChannelCount=r.channelCount,_.hasVideo?_.videoCodec!=null&&(_.mimeType=`video/x-flv; codecs="`+_.videoCodec+`,`+_.audioCodec+`"`):_.mimeType=`video/x-flv; codecs="`+_.audioCodec+`"`,_.isComplete()&&this._onMediaInfo(_)},e.prototype._parseFlacAudioData=function(e,t,n,r){var i=this._audioTrack,a=new Uint8Array(e,t,n),o=this._timestampBase+r,s={unit:a,length:a.byteLength,dts:o,pts:o};i.samples.push(s),i.length+=a.length},e.prototype._parseVideoData=function(e,t,n,r,i){if(n<=1)a.a.w(this.TAG,`Flv: Invalid video packet, missing VideoData payload!`);else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var o=new Uint8Array(e,t,n)[0],s=(112&o)>>>4;if(128&o){var c=15&o,l=String.fromCharCode.apply(String,new Uint8Array(e,t,n).slice(1,5));if(l===`hvc1`)this._parseEnhancedHEVCVideoPacket(e,t+5,n-5,r,i,s,c);else{if(l!==`av01`)return void this._onError(g.a.CODEC_UNSUPPORTED,`Flv: Unsupported codec in video frame: ${l}`);this._parseEnhancedAV1VideoPacket(e,t+5,n-5,r,i,s,c)}}else{var u=15&o;if(u===7)this._parseAVCVideoPacket(e,t+1,n-1,r,i,s);else{if(u!==12)return void this._onError(g.a.CODEC_UNSUPPORTED,`Flv: Unsupported codec in video frame: ${u}`);this._parseHEVCVideoPacket(e,t+1,n-1,r,i,s)}}}},e.prototype._parseAVCVideoPacket=function(e,t,n,r,i,o){if(n<4)a.a.w(this.TAG,`Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime`);else{var s=this._littleEndian,c=new DataView(e,t,n),l=c.getUint8(0),u=(16777215&c.getUint32(0,!s))<<8>>8;if(l===0)this._parseAVCDecoderConfigurationRecord(e,t+4,n-4);else if(l===1)this._parseAVCVideoData(e,t+4,n-4,r,i,o,u);else if(l!==2)return void this._onError(g.a.FORMAT_ERROR,`Flv: Invalid video packet type ${l}`)}},e.prototype._parseHEVCVideoPacket=function(e,t,n,r,i,o){if(n<4)a.a.w(this.TAG,`Flv: Invalid HEVC packet, missing HEVCPacketType or/and CompositionTime`);else{var s=this._littleEndian,c=new DataView(e,t,n),l=c.getUint8(0),u=(16777215&c.getUint32(0,!s))<<8>>8;if(l===0)this._parseHEVCDecoderConfigurationRecord(e,t+4,n-4);else if(l===1)this._parseHEVCVideoData(e,t+4,n-4,r,i,o,u);else if(l!==2)return void this._onError(g.a.FORMAT_ERROR,`Flv: Invalid video packet type ${l}`)}},e.prototype._parseEnhancedHEVCVideoPacket=function(e,t,n,r,i,a,o){var s=this._littleEndian,c=new DataView(e,t,n);if(o===0)this._parseHEVCDecoderConfigurationRecord(e,t,n);else if(o===1){var l=(4294967040&c.getUint32(0,!s))>>8;this._parseHEVCVideoData(e,t+3,n-3,r,i,a,l)}else if(o===3)this._parseHEVCVideoData(e,t,n,r,i,a,0);else if(o!==2)return void this._onError(g.a.FORMAT_ERROR,`Flv: Invalid video packet type ${o}`)},e.prototype._parseEnhancedAV1VideoPacket=function(e,t,n,r,i,a,o){if(this._littleEndian,new DataView(e,t,n),o===0)this._parseAV1CodecConfigurationRecord(e,t,n);else if(o===1)this._parseAV1VideoData(e,t,n,r,i,a,0);else{if(o===5)return void this._onError(g.a.FORMAT_ERROR,`Flv: Not Supported MP2T AV1 video packet type ${o}`);if(o!==2)return void this._onError(g.a.FORMAT_ERROR,`Flv: Invalid video packet type ${o}`)}},e.prototype._parseAVCDecoderConfigurationRecord=function(e,t,n){if(n<7)a.a.w(this.TAG,`Flv: Invalid AVCDecoderConfigurationRecord, lack of data!`);else{var r=this._videoMetadata,i=this._videoTrack,o=this._littleEndian,s=new DataView(e,t,n);if(r){if(r.avcc!==void 0){if(x(new Uint8Array(e,t,n),r.avcc))return;a.a.w(this.TAG,`AVCDecoderConfigurationRecord has been changed, re-generate initialization segment`)}}else !1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(r=this._videoMetadata={}).type=`video`,r.id=i.id,r.timescale=this._timescale,r.duration=this._duration;var c=s.getUint8(0),l=s.getUint8(1);if(s.getUint8(2),s.getUint8(3),c===1&&l!==0)if(this._naluLengthSize=1+(3&s.getUint8(4)),this._naluLengthSize===3||this._naluLengthSize===4){var u=31&s.getUint8(5);if(u!==0){u>1&&a.a.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ${u}`);for(var d=6,f=0;f<u;f++){var p=s.getUint16(d,!o);if(d+=2,p!==0){var m=new Uint8Array(e,t+d,p);d+=p;var _=h.parseSPS(m);if(f===0){r.codecWidth=_.codec_size.width,r.codecHeight=_.codec_size.height,r.presentWidth=_.present_size.width,r.presentHeight=_.present_size.height,r.profile=_.profile_string,r.level=_.level_string,r.bitDepth=_.bit_depth,r.chromaFormat=_.chroma_format,r.sarRatio=_.sar_ratio,r.frameRate=_.frame_rate,!1!==_.frame_rate.fixed&&_.frame_rate.fps_num!==0&&_.frame_rate.fps_den!==0||(r.frameRate=this._referenceFrameRate);var v=r.frameRate.fps_den,y=r.frameRate.fps_num;r.refSampleDuration=r.timescale*(v/y);for(var b=m.subarray(1,4),S=`avc1.`,C=0;C<3;C++){var w=b[C].toString(16);w.length<2&&(w=`0`+w),S+=w}r.codec=S;var T=this._mediaInfo;T.width=r.codecWidth,T.height=r.codecHeight,T.fps=r.frameRate.fps,T.profile=r.profile,T.level=r.level,T.refFrames=_.ref_frames,T.chromaFormat=_.chroma_format_string,T.sarNum=r.sarRatio.width,T.sarDen=r.sarRatio.height,T.videoCodec=S,T.hasAudio?T.audioCodec!=null&&(T.mimeType=`video/x-flv; codecs="`+T.videoCodec+`,`+T.audioCodec+`"`):T.mimeType=`video/x-flv; codecs="`+T.videoCodec+`"`,T.isComplete()&&this._onMediaInfo(T)}}}var E=s.getUint8(d);if(E!==0){for(E>1&&a.a.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ${E}`),d++,f=0;f<E;f++)p=s.getUint16(d,!o),d+=2,p!==0&&(d+=p);r.avcc=new Uint8Array(n),r.avcc.set(new Uint8Array(e,t,n),0),a.a.v(this.TAG,`Parsed AVCDecoderConfigurationRecord`),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata(`video`,r)}else this._onError(g.a.FORMAT_ERROR,`Flv: Invalid AVCDecoderConfigurationRecord: No PPS`)}else this._onError(g.a.FORMAT_ERROR,`Flv: Invalid AVCDecoderConfigurationRecord: No SPS`)}else this._onError(g.a.FORMAT_ERROR,`Flv: Strange NaluLengthSizeMinusOne: ${this._naluLengthSize-1}`);else this._onError(g.a.FORMAT_ERROR,`Flv: Invalid AVCDecoderConfigurationRecord`)}},e.prototype._parseHEVCDecoderConfigurationRecord=function(e,t,n){if(n<22)a.a.w(this.TAG,`Flv: Invalid HEVCDecoderConfigurationRecord, lack of data!`);else{var r=this._videoMetadata,i=this._videoTrack,o=this._littleEndian,s=new DataView(e,t,n);if(r){if(r.hvcc!==void 0){if(x(new Uint8Array(e,t,n),r.hvcc))return;a.a.w(this.TAG,`HEVCDecoderConfigurationRecord has been changed, re-generate initialization segment`)}}else !1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(r=this._videoMetadata={}).type=`video`,r.id=i.id,r.timescale=this._timescale,r.duration=this._duration;var c=s.getUint8(0),l=31&s.getUint8(1);if(c!==0&&c!==1||l===0)this._onError(g.a.FORMAT_ERROR,`Flv: Invalid HEVCDecoderConfigurationRecord`);else if(this._naluLengthSize=1+(3&s.getUint8(21)),this._naluLengthSize===3||this._naluLengthSize===4){for(var u=s.getUint8(22),d=0,f=23;d<u;d++){var p=63&s.getUint8(f+0),m=s.getUint16(f+1,!o);f+=3;for(var h=0;h<m;h++){var v=s.getUint16(f+0,!o);if(h===0)if(p===33){f+=2;var y=new Uint8Array(e,t+f,v),b=_.parseSPS(y);r.codecWidth=b.codec_size.width,r.codecHeight=b.codec_size.height,r.presentWidth=b.present_size.width,r.presentHeight=b.present_size.height,r.profile=b.profile_string,r.level=b.level_string,r.bitDepth=b.bit_depth,r.chromaFormat=b.chroma_format,r.sarRatio=b.sar_ratio,r.frameRate=b.frame_rate,!1!==b.frame_rate.fixed&&b.frame_rate.fps_num!==0&&b.frame_rate.fps_den!==0||(r.frameRate=this._referenceFrameRate);var S=r.frameRate.fps_den,C=r.frameRate.fps_num;r.refSampleDuration=r.timescale*(S/C),r.codec=b.codec_mimetype;var w=this._mediaInfo;w.width=r.codecWidth,w.height=r.codecHeight,w.fps=r.frameRate.fps,w.profile=r.profile,w.level=r.level,w.refFrames=b.ref_frames,w.chromaFormat=b.chroma_format_string,w.sarNum=r.sarRatio.width,w.sarDen=r.sarRatio.height,w.videoCodec=b.codec_mimetype,w.hasAudio?w.audioCodec!=null&&(w.mimeType=`video/x-flv; codecs="`+w.videoCodec+`,`+w.audioCodec+`"`):w.mimeType=`video/x-flv; codecs="`+w.videoCodec+`"`,w.isComplete()&&this._onMediaInfo(w),f+=v}else f+=2+v;else f+=2+v}}r.hvcc=new Uint8Array(n),r.hvcc.set(new Uint8Array(e,t,n),0),a.a.v(this.TAG,`Parsed HEVCDecoderConfigurationRecord`),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata(`video`,r)}else this._onError(g.a.FORMAT_ERROR,`Flv: Strange NaluLengthSizeMinusOne: ${this._naluLengthSize-1}`)}},e.prototype._parseAV1CodecConfigurationRecord=function(e,t,n){if(n<4)a.a.w(this.TAG,`Flv: Invalid AV1CodecConfigurationRecord, lack of data!`);else{var r=this._videoMetadata,i=this._videoTrack,o=(this._littleEndian,new DataView(e,t,n));r?r.av1c!==void 0&&a.a.w(this.TAG,`Found another AV1CodecConfigurationRecord!`):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(r=this._videoMetadata={}).type=`video`,r.id=i.id,r.timescale=this._timescale,r.duration=this._duration);var s=127&o.getUint8(0);if(o.getUint8(1),o.getUint8(1),o.getUint8(2),s===1){var c=C.parseOBUs(new Uint8Array(e,t+4,n-4));if(c!=null){r.profile=c.profile_string,r.level=c.level_string,r.bitDepth=c.bit_depth,r.chromaFormat=c.chroma_format,r.frameRate=c.frame_rate,!1!==c.frame_rate.fixed&&c.frame_rate.fps_num!==0&&c.frame_rate.fps_den!==0||(r.frameRate=this._referenceFrameRate);var l=r.frameRate.fps_den,u=r.frameRate.fps_num;r.refSampleDuration=r.timescale*(l/u),r.codec=c.codec_mimetype,r.extra=c;var d=this._mediaInfo;d.fps=r.frameRate.fps,d.profile=r.profile,d.level=r.level,d.refFrames=c.ref_frames,d.chromaFormat=c.chroma_format_string,d.videoCodec=c.codec_mimetype,d.hasAudio?d.audioCodec!=null&&(d.mimeType=`video/x-flv; codecs="`+d.videoCodec+`,`+d.audioCodec+`"`):d.mimeType=`video/x-flv; codecs="`+d.videoCodec+`"`,d.isComplete()&&this._onMediaInfo(d),r.av1c=new Uint8Array(n),r.av1c.set(new Uint8Array(e,t,n),0),a.a.v(this.TAG,`Preparing AV1CodecConfigurationRecord`)}else this._onError(g.a.FORMAT_ERROR,`Flv: Invalid AV1CodecConfigurationRecord`)}else this._onError(g.a.FORMAT_ERROR,`Flv: Invalid AV1CodecConfigurationRecord`)}},e.prototype._parseAVCVideoData=function(e,t,n,r,i,o,s){for(var c=this._littleEndian,l=new DataView(e,t,n),u=[],d=0,f=0,p=this._naluLengthSize,m=this._timestampBase+r,h=o===1;f<n;){if(f+4>=n){a.a.w(this.TAG,`Malformed Nalu near timestamp ${m}, offset = ${f}, dataSize = ${n}`);break}var g=l.getUint32(f,!c);if(p===3&&(g>>>=8),g>n-p)return void a.a.w(this.TAG,`Malformed Nalus near timestamp ${m}, NaluSize > DataSize!`);var _=31&l.getUint8(f+p);_===5&&(h=!0);var v=new Uint8Array(e,t+f,p+g),y={type:_,data:v};u.push(y),d+=v.byteLength,f+=p+g}if(u.length){var b=this._videoTrack,x={units:u,length:d,isKeyframe:h,dts:m,cts:s,pts:m+s};h&&(x.fileposition=i),b.samples.push(x),b.length+=d}},e.prototype._parseHEVCVideoData=function(e,t,n,r,i,o,s){for(var c=this._littleEndian,l=new DataView(e,t,n),u=[],d=0,f=0,p=this._naluLengthSize,m=this._timestampBase+r,h=o===1;f<n;){if(f+4>=n){a.a.w(this.TAG,`Malformed Nalu near timestamp ${m}, offset = ${f}, dataSize = ${n}`);break}var g=l.getUint32(f,!c);if(p===3&&(g>>>=8),g>n-p)return void a.a.w(this.TAG,`Malformed Nalus near timestamp ${m}, NaluSize > DataSize!`);var _=l.getUint8(f+p)>>1&63;_!==19&&_!==20&&_!==21||(h=!0);var v=new Uint8Array(e,t+f,p+g),y={type:_,data:v};u.push(y),d+=v.byteLength,f+=p+g}if(u.length){var b=this._videoTrack,x={units:u,length:d,isKeyframe:h,dts:m,cts:s,pts:m+s};h&&(x.fileposition=i),b.samples.push(x),b.length+=d}},e.prototype._parseAV1VideoData=function(e,t,n,r,i,o,s){this._littleEndian,new DataView(e,t,n);var c,l=[],u=this._timestampBase+r,d=o===1;if(d){var f=this._videoMetadata,p=C.parseOBUs(new Uint8Array(e,t,n),f.extra);if(p==null)return void this._onError(g.a.FORMAT_ERROR,`Flv: Invalid AV1 VideoData`);console.log(p),f.codecWidth=p.codec_size.width,f.codecHeight=p.codec_size.height,f.presentWidth=p.present_size.width,f.presentHeight=p.present_size.height,f.sarRatio=p.sar_ratio;var m=this._mediaInfo;m.width=f.codecWidth,m.height=f.codecHeight,m.sarNum=f.sarRatio.width,m.sarDen=f.sarRatio.height,a.a.v(this.TAG,`Parsed AV1DecoderConfigurationRecord`),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata(`video`,f)}if(c=n,l.push({unitType:0,data:new Uint8Array(e,t+0,n)}),l.length){var h=this._videoTrack,_={units:l,length:c,isKeyframe:d,dts:u,cts:s,pts:u+s};d&&(_.fileposition=i),h.samples.push(_),h.length+=c}},e}(),E=function(){function e(){}return e.prototype.destroy=function(){this.onError=null,this.onMediaInfo=null,this.onMetaDataArrived=null,this.onTrackMetadata=null,this.onDataAvailable=null,this.onTimedID3Metadata=null,this.onSynchronousKLVMetadata=null,this.onAsynchronousKLVMetadata=null,this.onSMPTE2038Metadata=null,this.onSCTE35Metadata=null,this.onPESPrivateData=null,this.onPESPrivateDataDescriptor=null},e}(),D=function(){this.program_pmt_pid={}};(function(e){e[e.kMPEG1Audio=3]=`kMPEG1Audio`,e[e.kMPEG2Audio=4]=`kMPEG2Audio`,e[e.kPESPrivateData=6]=`kPESPrivateData`,e[e.kADTSAAC=15]=`kADTSAAC`,e[e.kLOASAAC=17]=`kLOASAAC`,e[e.kAC3=129]=`kAC3`,e[e.kEAC3=135]=`kEAC3`,e[e.kMetadata=21]=`kMetadata`,e[e.kSCTE35=134]=`kSCTE35`,e[e.kH264=27]=`kH264`,e[e.kH265=36]=`kH265`})(w||={});var O,k=function(){this.pid_stream_type={},this.common_pids={h264:void 0,h265:void 0,av1:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},this.pes_private_data_pids={},this.timed_id3_pids={},this.synchronous_klv_pids={},this.asynchronous_klv_pids={},this.scte_35_pids={},this.smpte2038_pids={}},A=function(){},j=function(){},M=function(){this.slices=[],this.total_length=0,this.expected_length=0,this.file_position=0};(function(e){e[e.kUnspecified=0]=`kUnspecified`,e[e.kSliceNonIDR=1]=`kSliceNonIDR`,e[e.kSliceDPA=2]=`kSliceDPA`,e[e.kSliceDPB=3]=`kSliceDPB`,e[e.kSliceDPC=4]=`kSliceDPC`,e[e.kSliceIDR=5]=`kSliceIDR`,e[e.kSliceSEI=6]=`kSliceSEI`,e[e.kSliceSPS=7]=`kSliceSPS`,e[e.kSlicePPS=8]=`kSlicePPS`,e[e.kSliceAUD=9]=`kSliceAUD`,e[e.kEndOfSequence=10]=`kEndOfSequence`,e[e.kEndOfStream=11]=`kEndOfStream`,e[e.kFiller=12]=`kFiller`,e[e.kSPSExt=13]=`kSPSExt`,e[e.kReserved0=14]=`kReserved0`})(O||={});var N,P,F=function(){},I=function(e){var t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)},ee=function(){function e(e){this.TAG=`H264AnnexBParser`,this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&a.a.e(this.TAG,`Could not find H264 startcode until payload end!`)}return e.prototype.findNextStartCodeOffset=function(e){for(var t=e,n=this.data_;;){if(t+3>=n.byteLength)return this.eof_flag_=!0,n.byteLength;var r=n[t+0]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3],i=n[t+0]<<16|n[t+1]<<8|n[t+2];if(r===1||i===1)return t;t++}},e.prototype.readNextNaluPayload=function(){for(var e=this.data_,t=null;t==null&&!this.eof_flag_;){var n=this.current_startcode_offset_,r=31&e[n+=(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])==1?4:3],i=(128&e[n])>>>7,a=this.findNextStartCodeOffset(n);if(this.current_startcode_offset_=a,!(r>=O.kReserved0)&&i===0){var o=e.subarray(n,a);(t=new F).type=r,t.data=o}}return t},e}(),L=function(){function e(e,t,n){var r=8+e.byteLength+1+2+t.byteLength,i=!1;e[3]!==66&&e[3]!==77&&e[3]!==88&&(i=!0,r+=4);var a=this.data=new Uint8Array(r);a[0]=1,a[1]=e[1],a[2]=e[2],a[3]=e[3],a[4]=255,a[5]=225;var o=e.byteLength;a[6]=o>>>8,a[7]=255&o;var s=8;a.set(e,8),a[s+=o]=1;var c=t.byteLength;a[s+1]=c>>>8,a[s+2]=255&c,a.set(t,s+3),s+=3+c,i&&(a[s]=252|n.chroma_format_idc,a[s+1]=248|n.bit_depth_luma-8,a[s+2]=248|n.bit_depth_chroma-8,a[s+3]=0,s+=4)}return e.prototype.getData=function(){return this.data},e}();(function(e){e[e.kNull=0]=`kNull`,e[e.kAACMain=1]=`kAACMain`,e[e.kAAC_LC=2]=`kAAC_LC`,e[e.kAAC_SSR=3]=`kAAC_SSR`,e[e.kAAC_LTP=4]=`kAAC_LTP`,e[e.kAAC_SBR=5]=`kAAC_SBR`,e[e.kAAC_Scalable=6]=`kAAC_Scalable`,e[e.kLayer1=32]=`kLayer1`,e[e.kLayer2=33]=`kLayer2`,e[e.kLayer3=34]=`kLayer3`})(N||={}),function(e){e[e.k96000Hz=0]=`k96000Hz`,e[e.k88200Hz=1]=`k88200Hz`,e[e.k64000Hz=2]=`k64000Hz`,e[e.k48000Hz=3]=`k48000Hz`,e[e.k44100Hz=4]=`k44100Hz`,e[e.k32000Hz=5]=`k32000Hz`,e[e.k24000Hz=6]=`k24000Hz`,e[e.k22050Hz=7]=`k22050Hz`,e[e.k16000Hz=8]=`k16000Hz`,e[e.k12000Hz=9]=`k12000Hz`,e[e.k11025Hz=10]=`k11025Hz`,e[e.k8000Hz=11]=`k8000Hz`,e[e.k7350Hz=12]=`k7350Hz`}(P||={});var R,te,ne=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],re=(R=function(e,t){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}R(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),ie=function(){},ae=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return re(t,e),t}(ie),oe=function(){function e(e){this.TAG=`AACADTSParser`,this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&a.a.e(this.TAG,`Could not found ADTS syncword until payload end`)}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,n=this.data_;;){if(t+7>=n.byteLength)return this.eof_flag_=!0,n.byteLength;if((n[t+0]<<8|n[t+1])>>>4==4095)return t;t++}},e.prototype.readNextAACFrame=function(){for(var e=this.data_,t=null;t==null&&!this.eof_flag_;){var n=this.current_syncword_offset_,r=(8&e[n+1])>>>3,i=(6&e[n+1])>>>1,a=1&e[n+1],o=(192&e[n+2])>>>6,s=(60&e[n+2])>>>2,c=(1&e[n+2])<<2|(192&e[n+3])>>>6,l=(3&e[n+3])<<11|e[n+4]<<3|(224&e[n+5])>>>5;if(e[n+6],n+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var u=a===1?7:9,d=l-u;if(n+=u,this.current_syncword_offset_=this.findNextSyncwordOffset(n+d),(r===0||r===1)&&i===0){var f=e.subarray(n,n+d);(t=new ie).audio_object_type=o+1,t.sampling_freq_index=s,t.sampling_frequency=ne[s],t.channel_config=c,t.data=f}}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),se=function(){function e(e){this.TAG=`AACLOASParser`,this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&a.a.e(this.TAG,`Could not found LOAS syncword until payload end`)}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,n=this.data_;;){if(t+1>=n.byteLength)return this.eof_flag_=!0,n.byteLength;if((n[t+0]<<3|n[t+1]>>>5)==695)return t;t++}},e.prototype.getLATMValue=function(e){for(var t=e.readBits(2),n=0,r=0;r<=t;r++)n<<=8,n|=e.readByte();return n},e.prototype.readNextAACFrame=function(e){for(var t=this.data_,n=null;n==null&&!this.eof_flag_;){var r=this.current_syncword_offset_,i=(31&t[r+1])<<8|t[r+2];if(r+3+i>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var o=new m(t.subarray(r+3,r+3+i)),s=null;if(o.readBool()){if(e==null){a.a.w(this.TAG,`StreamMuxConfig Missing`),this.current_syncword_offset_=this.findNextSyncwordOffset(r+3+i),o.destroy();continue}s=e}else{var c=o.readBool();if(c&&o.readBool()){a.a.e(this.TAG,`audioMuxVersionA is Not Supported`),o.destroy();break}if(c&&this.getLATMValue(o),!o.readBool()){a.a.e(this.TAG,`allStreamsSameTimeFraming zero is Not Supported`),o.destroy();break}if(o.readBits(6)!==0){a.a.e(this.TAG,`more than 2 numSubFrames Not Supported`),o.destroy();break}if(o.readBits(4)!==0){a.a.e(this.TAG,`more than 2 numProgram Not Supported`),o.destroy();break}if(o.readBits(3)!==0){a.a.e(this.TAG,`more than 2 numLayer Not Supported`),o.destroy();break}var l=c?this.getLATMValue(o):0,u=o.readBits(5);l-=5;var d=o.readBits(4);l-=4;var f=o.readBits(4);l-=4,o.readBits(3),(l-=3)>0&&o.readBits(l);var p=o.readBits(3);if(p!==0){a.a.e(this.TAG,`frameLengthType = ${p}. Only frameLengthType = 0 Supported`),o.destroy();break}o.readByte();var h=o.readBool();if(h)if(c)this.getLATMValue(o);else{for(var g=0;;){g<<=8;var _=o.readBool();if(g+=o.readByte(),!_)break}console.log(g)}o.readBool()&&o.readByte(),(s=new ae).audio_object_type=u,s.sampling_freq_index=d,s.sampling_frequency=ne[s.sampling_freq_index],s.channel_config=f,s.other_data_present=h}for(var v=0;;){var y=o.readByte();if(v+=y,y!==255)break}for(var b=new Uint8Array(v),x=0;x<v;x++)b[x]=o.readByte();(n=new ae).audio_object_type=s.audio_object_type,n.sampling_freq_index=s.sampling_freq_index,n.sampling_frequency=ne[s.sampling_freq_index],n.channel_config=s.channel_config,n.other_data_present=s.other_data_present,n.data=b,this.current_syncword_offset_=this.findNextSyncwordOffset(r+3+i)}return n},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),ce=function(e){var t=null,n=e.audio_object_type,r=e.audio_object_type,i=e.sampling_freq_index,a=e.channel_config,o=0,s=navigator.userAgent.toLowerCase();s.indexOf(`firefox`)===-1?s.indexOf(`android`)===-1?(r=5,o=i,t=[,,,,],i>=6?o=i-3:a===1&&(r=2,t=[,,],o=i)):(r=2,t=[,,],o=i):i>=6?(r=5,t=[,,,,],o=i-3):(r=2,t=[,,],o=i),t[0]=r<<3,t[0]|=(15&i)>>>1,t[1]=(15&i)<<7,t[1]|=(15&a)<<3,r===5&&(t[1]|=(15&o)>>>1,t[2]=(1&o)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=ne[i],this.channel_count=a,this.codec_mimetype=`mp4a.40.`+r,this.original_codec_mimetype=`mp4a.40.`+n},le=function(){},ue=function(){};(function(e){e[e.kSpliceNull=0]=`kSpliceNull`,e[e.kSpliceSchedule=4]=`kSpliceSchedule`,e[e.kSpliceInsert=5]=`kSpliceInsert`,e[e.kTimeSignal=6]=`kTimeSignal`,e[e.kBandwidthReservation=7]=`kBandwidthReservation`,e[e.kPrivateCommand=255]=`kPrivateCommand`})(te||={});var de,fe=function(e){var t=e.readBool();return t?(e.readBits(6),{time_specified_flag:t,pts_time:4*e.readBits(31)+e.readBits(2)}):(e.readBits(7),{time_specified_flag:t})},pe=function(e){var t=e.readBool();return e.readBits(6),{auto_return:t,duration:4*e.readBits(31)+e.readBits(2)}},me=function(e,t){var n=t.readBits(8);return e?{component_tag:n}:{component_tag:n,splice_time:fe(t)}},he=function(e){return{component_tag:e.readBits(8),utc_splice_time:e.readBits(32)}},ge=function(e){var t=e.readBits(32),n=e.readBool();e.readBits(7);var r={splice_event_id:t,splice_event_cancel_indicator:n};if(n)return r;if(r.out_of_network_indicator=e.readBool(),r.program_splice_flag=e.readBool(),r.duration_flag=e.readBool(),e.readBits(5),r.program_splice_flag)r.utc_splice_time=e.readBits(32);else{r.component_count=e.readBits(8),r.components=[];for(var i=0;i<r.component_count;i++)r.components.push(he(e))}return r.duration_flag&&(r.break_duration=pe(e)),r.unique_program_id=e.readBits(16),r.avail_num=e.readBits(8),r.avails_expected=e.readBits(8),r},_e=function(e,t,n,r){return{descriptor_tag:e,descriptor_length:t,identifier:n,provider_avail_id:r.readBits(32)}},ve=function(e,t,n,r){var i=r.readBits(8),a=r.readBits(3);r.readBits(5);for(var o=``,s=0;s<a;s++)o+=String.fromCharCode(r.readBits(8));return{descriptor_tag:e,descriptor_length:t,identifier:n,preroll:i,dtmf_count:a,DTMF_char:o}},ye=function(e){var t=e.readBits(8);return e.readBits(7),{component_tag:t,pts_offset:4*e.readBits(31)+e.readBits(2)}},be=function(e,t,n,r){var i=r.readBits(32),a=r.readBool();r.readBits(7);var o={descriptor_tag:e,descriptor_length:t,identifier:n,segmentation_event_id:i,segmentation_event_cancel_indicator:a};if(a)return o;if(o.program_segmentation_flag=r.readBool(),o.segmentation_duration_flag=r.readBool(),o.delivery_not_restricted_flag=r.readBool(),o.delivery_not_restricted_flag?r.readBits(5):(o.web_delivery_allowed_flag=r.readBool(),o.no_regional_blackout_flag=r.readBool(),o.archive_allowed_flag=r.readBool(),o.device_restrictions=r.readBits(2)),!o.program_segmentation_flag){o.component_count=r.readBits(8),o.components=[];for(var s=0;s<o.component_count;s++)o.components.push(ye(r))}o.segmentation_duration_flag&&(o.segmentation_duration=r.readBits(40)),o.segmentation_upid_type=r.readBits(8),o.segmentation_upid_length=r.readBits(8);var c=new Uint8Array(o.segmentation_upid_length);for(s=0;s<o.segmentation_upid_length;s++)c[s]=r.readBits(8);return o.segmentation_upid=c.buffer,o.segmentation_type_id=r.readBits(8),o.segment_num=r.readBits(8),o.segments_expected=r.readBits(8),o.segmentation_type_id!==52&&o.segmentation_type_id!==54&&o.segmentation_type_id!==56&&o.segmentation_type_id!==58||(o.sub_segment_num=r.readBits(8),o.sub_segments_expected=r.readBits(8)),o},xe=function(e,t,n,r){return{descriptor_tag:e,descriptor_length:t,identifier:n,TAI_seconds:r.readBits(48),TAI_ns:r.readBits(32),UTC_offset:r.readBits(16)}},Se=function(e){return{component_tag:e.readBits(8),ISO_code:String.fromCharCode(e.readBits(8),e.readBits(8),e.readBits(8)),Bit_Stream_Mode:e.readBits(3),Num_Channels:e.readBits(4),Full_Srvc_Audio:e.readBool()}},Ce=function(e,t,n,r){for(var i=r.readBits(4),a=[],o=0;o<i;o++)a.push(Se(r));return{descriptor_tag:e,descriptor_length:t,identifier:n,audio_count:i,components:a}},we=function(e){var t=new m(e),n=t.readBits(8),r=t.readBool(),i=t.readBool();t.readBits(2);var a=t.readBits(12),o=t.readBits(8),s=t.readBool(),c=t.readBits(6),l=4*t.readBits(31)+t.readBits(2),u=t.readBits(8),d=t.readBits(12),f=t.readBits(12),p=t.readBits(8),h=null;p===te.kSpliceNull?h={}:p===te.kSpliceSchedule?h=function(e){for(var t=e.readBits(8),n=[],r=0;r<t;r++)n.push(ge(e));return{splice_count:t,events:n}}(t):p===te.kSpliceInsert?h=function(e){var t=e.readBits(32),n=e.readBool();e.readBits(7);var r={splice_event_id:t,splice_event_cancel_indicator:n};if(n)return r;if(r.out_of_network_indicator=e.readBool(),r.program_splice_flag=e.readBool(),r.duration_flag=e.readBool(),r.splice_immediate_flag=e.readBool(),e.readBits(4),r.program_splice_flag&&!r.splice_immediate_flag&&(r.splice_time=fe(e)),!r.program_splice_flag){r.component_count=e.readBits(8),r.components=[];for(var i=0;i<r.component_count;i++)r.components.push(me(r.splice_immediate_flag,e))}return r.duration_flag&&(r.break_duration=pe(e)),r.unique_program_id=e.readBits(16),r.avail_num=e.readBits(8),r.avails_expected=e.readBits(8),r}(t):p===te.kTimeSignal?h=function(e){return{splice_time:fe(e)}}(t):p===te.kBandwidthReservation?h={}:p===te.kPrivateCommand?h=function(e,t){for(var n=String.fromCharCode(t.readBits(8),t.readBits(8),t.readBits(8),t.readBits(8)),r=new Uint8Array(e-4),i=0;i<e-4;i++)r[i]=t.readBits(8);return{identifier:n,private_data:r.buffer}}(f,t):t.readBits(8*f);for(var g=[],_=t.readBits(16),v=0;v<_;){var y=t.readBits(8),b=t.readBits(8),x=String.fromCharCode(t.readBits(8),t.readBits(8),t.readBits(8),t.readBits(8));y===0?g.push(_e(y,b,x,t)):y===1?g.push(ve(y,b,x,t)):y===2?g.push(be(y,b,x,t)):y===3?g.push(xe(y,b,x,t)):y===4?g.push(Ce(y,b,x,t)):t.readBits(8*(b-4)),v+=2+b}var S={table_id:n,section_syntax_indicator:r,private_indicator:i,section_length:a,protocol_version:o,encrypted_packet:s,encryption_algorithm:c,pts_adjustment:l,cw_index:u,tier:d,splice_command_length:f,splice_command_type:p,splice_command:h,descriptor_loop_length:_,splice_descriptors:g,E_CRC32:s?t.readBits(32):void 0,CRC32:t.readBits(32)};if(p===te.kSpliceInsert){var C=h;if(C.splice_event_cancel_indicator)return{splice_command_type:p,detail:S,data:e};if(C.program_splice_flag&&!C.splice_immediate_flag){var w=C.duration_flag?C.break_duration.auto_return:void 0,T=C.duration_flag?C.break_duration.duration/90:void 0;return C.splice_time.time_specified_flag?{splice_command_type:p,pts:(l+C.splice_time.pts_time)%2**33,auto_return:w,duraiton:T,detail:S,data:e}:{splice_command_type:p,auto_return:w,duraiton:T,detail:S,data:e}}return{splice_command_type:p,auto_return:w=C.duration_flag?C.break_duration.auto_return:void 0,duraiton:T=C.duration_flag?C.break_duration.duration/90:void 0,detail:S,data:e}}if(p===te.kTimeSignal){var E=h;return E.splice_time.time_specified_flag?{splice_command_type:p,pts:(l+E.splice_time.pts_time)%2**33,detail:S,data:e}:{splice_command_type:p,detail:S,data:e}}return{splice_command_type:p,detail:S,data:e}};(function(e){e[e.kSliceIDR_W_RADL=19]=`kSliceIDR_W_RADL`,e[e.kSliceIDR_N_LP=20]=`kSliceIDR_N_LP`,e[e.kSliceCRA_NUT=21]=`kSliceCRA_NUT`,e[e.kSliceVPS=32]=`kSliceVPS`,e[e.kSliceSPS=33]=`kSliceSPS`,e[e.kSlicePPS=34]=`kSlicePPS`,e[e.kSliceAUD=35]=`kSliceAUD`})(de||={});var Te=function(){},Ee=function(e){var t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)},De=function(){function e(e){this.TAG=`H265AnnexBParser`,this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&a.a.e(this.TAG,`Could not find H265 startcode until payload end!`)}return e.prototype.findNextStartCodeOffset=function(e){for(var t=e,n=this.data_;;){if(t+3>=n.byteLength)return this.eof_flag_=!0,n.byteLength;var r=n[t+0]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3],i=n[t+0]<<16|n[t+1]<<8|n[t+2];if(r===1||i===1)return t;t++}},e.prototype.readNextNaluPayload=function(){for(var e=this.data_,t=null;t==null&&!this.eof_flag_;){var n=this.current_startcode_offset_,r=e[n+=(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])==1?4:3]>>1&63,i=(128&e[n])>>>7,a=this.findNextStartCodeOffset(n);if(this.current_startcode_offset_=a,i===0){var o=e.subarray(n,a);(t=new Te).type=r,t.data=o}}return t},e}(),Oe=function(){function e(e,t,n,r){var i=23+(5+e.byteLength)+(5+t.byteLength)+(5+n.byteLength),a=this.data=new Uint8Array(i);a[0]=1,a[1]=(3&r.general_profile_space)<<6|(r.general_tier_flag?1:0)<<5|31&r.general_profile_idc,a[2]=r.general_profile_compatibility_flags_1,a[3]=r.general_profile_compatibility_flags_2,a[4]=r.general_profile_compatibility_flags_3,a[5]=r.general_profile_compatibility_flags_4,a[6]=r.general_constraint_indicator_flags_1,a[7]=r.general_constraint_indicator_flags_2,a[8]=r.general_constraint_indicator_flags_3,a[9]=r.general_constraint_indicator_flags_4,a[10]=r.general_constraint_indicator_flags_5,a[11]=r.general_constraint_indicator_flags_6,a[12]=r.general_level_idc,a[13]=240|(3840&r.min_spatial_segmentation_idc)>>8,a[14]=255&r.min_spatial_segmentation_idc,a[15]=252|3&r.parallelismType,a[16]=252|3&r.chroma_format_idc,a[17]=248|7&r.bit_depth_luma_minus8,a[18]=248|7&r.bit_depth_chroma_minus8,a[19]=0,a[20]=0,a[21]=(3&r.constant_frame_rate)<<6|(7&r.num_temporal_layers)<<3|(r.temporal_id_nested?1:0)<<2|3,a[22]=3,a[23]=128|de.kSliceVPS,a[24]=0,a[25]=1,a[26]=(65280&e.byteLength)>>8,a[27]=(255&e.byteLength)>>0,a.set(e,28),a[23+(5+e.byteLength)+0]=128|de.kSliceSPS,a[23+(5+e.byteLength)+1]=0,a[23+(5+e.byteLength)+2]=1,a[23+(5+e.byteLength)+3]=(65280&t.byteLength)>>8,a[23+(5+e.byteLength)+4]=(255&t.byteLength)>>0,a.set(t,23+(5+e.byteLength)+5),a[23+(5+e.byteLength+5+t.byteLength)+0]=128|de.kSlicePPS,a[23+(5+e.byteLength+5+t.byteLength)+1]=0,a[23+(5+e.byteLength+5+t.byteLength)+2]=1,a[23+(5+e.byteLength+5+t.byteLength)+3]=(65280&n.byteLength)>>8,a[23+(5+e.byteLength+5+t.byteLength)+4]=(255&n.byteLength)>>0,a.set(n,23+(5+e.byteLength+5+t.byteLength)+5)}return e.prototype.getData=function(){return this.data},e}(),ke=function(){},Ae=function(){},je=function(){},Me=[[64,64,80,80,96,96,112,112,128,128,160,160,192,192,224,224,256,256,320,320,384,384,448,448,512,512,640,640,768,768,896,896,1024,1024,1152,1152,1280,1280],[69,70,87,88,104,105,121,122,139,140,174,175,208,209,243,244,278,279,348,349,417,418,487,488,557,558,696,697,835,836,975,976,1114,1115,1253,1254,1393,1394],[96,96,120,120,144,144,168,168,192,192,240,240,288,288,336,336,384,384,480,480,576,576,672,672,768,768,960,960,1152,1152,1344,1344,1536,1536,1728,1728,1920,1920]],Ne=function(){function e(e){this.TAG=`AC3Parser`,this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&a.a.e(this.TAG,`Could not found AC3 syncword until payload end`)}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,n=this.data_;;){if(t+7>=n.byteLength)return this.eof_flag_=!0,n.byteLength;if((n[t+0]<<8|n[t+1]<<0)==2935)return t;t++}},e.prototype.readNextAC3Frame=function(){for(var e=this.data_,t=null;t==null&&!this.eof_flag_;){var n=this.current_syncword_offset_,r=e[n+4]>>6,i=[48e3,44200,33e3][r],a=63&e[n+4],o=2*Me[r][a];if(isNaN(o)||n+o>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}this.current_syncword_offset_=this.findNextSyncwordOffset(n+o);var s=e[n+5]>>3,c=7&e[n+5],l=e[n+6]>>5,u=0;1&l&&l!==1&&(u+=2),4&l&&(u+=2),l===2&&(u+=2);var d=(e[n+6]<<8|e[n+7]<<0)>>12-u&1,f=[2,1,2,3,3,4,4,5][l]+d;(t=new je).sampling_frequency=i,t.channel_count=f,t.channel_mode=l,t.bit_stream_identification=s,t.low_frequency_effects_channel_on=d,t.bit_stream_mode=c,t.frame_size_code=a,t.data=e.subarray(n,n+o)}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),Pe=function(e){this.config=[e.sampling_rate_code<<6|e.bit_stream_identification<<1|e.bit_stream_mode>>2,(3&e.bit_stream_mode)<<6|e.channel_mode<<3|e.low_frequency_effects_channel_on<<2|e.frame_size_code>>4,e.frame_size_code<<4&224],this.sampling_rate=e.sampling_frequency,this.bit_stream_identification=e.bit_stream_identification,this.bit_stream_mode=e.bit_stream_mode,this.low_frequency_effects_channel_on=e.low_frequency_effects_channel_on,this.channel_count=e.channel_count,this.channel_mode=e.channel_mode,this.codec_mimetype=`ac-3`,this.original_codec_mimetype=`ac-3`},Fe=function(){},Ie=function(){function e(e){this.TAG=`EAC3Parser`,this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&a.a.e(this.TAG,`Could not found AC3 syncword until payload end`)}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,n=this.data_;;){if(t+7>=n.byteLength)return this.eof_flag_=!0,n.byteLength;if((n[t+0]<<8|n[t+1]<<0)==2935)return t;t++}},e.prototype.readNextEAC3Frame=function(){for(var e=this.data_,t=null;t==null&&!this.eof_flag_;){var n=this.current_syncword_offset_,r=new m(e.subarray(n+2)),i=(r.readBits(2),r.readBits(3),r.readBits(11)+1<<1),a=r.readBits(2),o=null,s=null;a===3?(o=[24e3,22060,16e3][a=r.readBits(2)],s=3):(o=[48e3,44100,32e3][a],s=r.readBits(2));var c=r.readBits(3),l=r.readBits(1),u=r.readBits(5);if(n+i>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}this.current_syncword_offset_=this.findNextSyncwordOffset(n+i);var d=[2,1,2,3,3,4,4,5][c]+l;r.destroy(),(t=new Fe).sampling_frequency=o,t.channel_count=d,t.channel_mode=c,t.bit_stream_identification=u,t.low_frequency_effects_channel_on=l,t.frame_size=i,t.num_blks=[1,2,3,6][s],t.data=e.subarray(n,n+i)}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),Le=function(e){var t,n=Math.floor(e.frame_size*e.sampling_frequency/(16*e.num_blks));t=[255&n,248&n,e.sampling_rate_code<<6|e.bit_stream_identification<<1|0,0|e.channel_mode<<1|e.low_frequency_effects_channel_on<<0,0],this.config=t,this.sampling_rate=e.sampling_frequency,this.bit_stream_identification=e.bit_stream_identification,this.num_blks=e.num_blks,this.low_frequency_effects_channel_on=e.low_frequency_effects_channel_on,this.channel_count=e.channel_count,this.channel_mode=e.channel_mode,this.codec_mimetype=`ec-3`,this.original_codec_mimetype=`ec-3`},Re=function(){},ze=function(){function e(e){this.TAG=`AV1OBUInMpegTsParser`,this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&a.a.e(this.TAG,`Could not find AV1 startcode until payload end!`)}return e._ebsp2rbsp=function(e){for(var t=e,n=t.byteLength,r=new Uint8Array(n),i=0,a=0;a<n;a++)a>=2&&t[a]===3&&t[a-1]===0&&t[a-2]===0||(r[i]=t[a],i++);return new Uint8Array(r.buffer,0,i)},e.prototype.findNextStartCodeOffset=function(e){for(var t=e,n=this.data_;;){if(t+2>=n.byteLength)return this.eof_flag_=!0,n.byteLength;if((n[t+0]<<16|n[t+1]<<8|n[t+2])==1)return t;t++}},e.prototype.readNextOBUPayload=function(){for(var t=this.data_,n=null;n==null&&!this.eof_flag_;){var r=this.current_startcode_offset_+3,i=this.findNextStartCodeOffset(r);this.current_startcode_offset_=i,n=e._ebsp2rbsp(t.subarray(r,i))}return n},e}(),Be=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ve=function(){return(Ve=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},He=function(e){function t(t,n){var r=e.call(this)||this;return r.TAG=`TSDemuxer`,r.first_parse_=!0,r.media_info_=new s.a,r.timescale_=90,r.duration_=0,r.current_pmt_pid_=-1,r.program_pmt_map_={},r.pes_slice_queues_={},r.section_slice_queues_={},r.video_metadata_={vps:void 0,sps:void 0,pps:void 0,av1c:void 0,details:void 0},r.audio_metadata_={codec:void 0,audio_object_type:void 0,sampling_freq_index:void 0,sampling_frequency:void 0,channel_config:void 0},r.last_pcr_base_=NaN,r.timestamp_offset_=0,r.audio_last_sample_pts_=void 0,r.aac_last_incomplete_data_=null,r.has_video_=!1,r.has_audio_=!1,r.video_init_segment_dispatched_=!1,r.audio_init_segment_dispatched_=!1,r.video_metadata_changed_=!1,r.audio_metadata_changed_=!1,r.loas_previous_frame=null,r.video_track_={type:`video`,id:1,sequenceNumber:0,samples:[],length:0},r.audio_track_={type:`audio`,id:2,sequenceNumber:0,samples:[],length:0},r.ts_packet_size_=t.ts_packet_size,r.sync_offset_=t.sync_offset,r.config_=n,r}return Be(t,e),t.prototype.destroy=function(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,e.prototype.destroy.call(this)},t.probe=function(e){var t=new Uint8Array(e),n=-1,r=188;if(t.byteLength<=3*r)return{needMoreData:!0};for(;n===-1;){for(var i=Math.min(1e3,t.byteLength-3*r),o=0;o<i;){if(t[o]===71&&t[o+r]===71&&t[o+2*r]===71){n=o;break}o++}if(n===-1)if(r===188)r=192;else{if(r!==192)break;r=204}}return n===-1?{match:!1}:(r===192&&n>=4?(a.a.v(`TSDemuxer`,`ts_packet_size = 192, m2ts mode`),n-=4):r===204&&a.a.v(`TSDemuxer`,`ts_packet_size = 204, RS encoded MPEG2-TS stream`),{match:!0,consumed:0,ts_packet_size:r,sync_offset:n})},t.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},t.prototype.resetMediaInfo=function(){this.media_info_=new s.a},t.prototype.parseChunks=function(e,t){if(!(this.onError&&this.onMediaInfo&&this.onTrackMetadata&&this.onDataAvailable))throw new d.a(`onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified`);var n=0;for(this.first_parse_&&(this.first_parse_=!1,n=this.sync_offset_);n+this.ts_packet_size_<=e.byteLength;){var r=t+n;this.ts_packet_size_===192&&(n+=4);var i=new Uint8Array(e,n,188),o=i[0];if(o!==71){a.a.e(this.TAG,`sync_byte = ${o}, not 0x47`);break}var s=(64&i[1])>>>6,c=(i[1],(31&i[1])<<8|i[2]),l=(48&i[3])>>>4,u=15&i[3],f=!(!this.pmt_||this.pmt_.pcr_pid!==c),p={},m=4;if(l==2||l==3){var h=i[4];if(h>0&&(f||l==3)&&(p.discontinuity_indicator=(128&i[5])>>>7,p.random_access_indicator=(64&i[5])>>>6,p.elementary_stream_priority_indicator=(32&i[5])>>>5,(16&i[5])>>>4&&(this.last_pcr_=300*this.getPcrBase(i)+((1&i[10])<<8|i[11]))),l==2||5+h===188){n+=188,this.ts_packet_size_===204&&(n+=16);continue}m=5+h}if(l==1||l==3){if(c===0||c===this.current_pmt_pid_||this.pmt_!=null&&this.pmt_.pid_stream_type[c]===w.kSCTE35){var g=188-m;this.handleSectionSlice(e,n+m,g,{pid:c,file_position:r,payload_unit_start_indicator:s,continuity_conunter:u,random_access_indicator:p.random_access_indicator})}else if(this.pmt_!=null&&this.pmt_.pid_stream_type[c]!=null){g=188-m;var _=this.pmt_.pid_stream_type[c];c!==this.pmt_.common_pids.h264&&c!==this.pmt_.common_pids.h265&&c!==this.pmt_.common_pids.av1&&c!==this.pmt_.common_pids.adts_aac&&c!==this.pmt_.common_pids.loas_aac&&c!==this.pmt_.common_pids.ac3&&c!==this.pmt_.common_pids.eac3&&c!==this.pmt_.common_pids.opus&&c!==this.pmt_.common_pids.mp3&&!0!==this.pmt_.pes_private_data_pids[c]&&!0!==this.pmt_.timed_id3_pids[c]&&!0!==this.pmt_.synchronous_klv_pids[c]&&!0!==this.pmt_.asynchronous_klv_pids[c]||this.handlePESSlice(e,n+m,g,{pid:c,stream_type:_,file_position:r,payload_unit_start_indicator:s,continuity_conunter:u,random_access_indicator:p.random_access_indicator})}}n+=188,this.ts_packet_size_===204&&(n+=16)}return this.dispatchAudioVideoMediaSegment(),n},t.prototype.handleSectionSlice=function(e,t,n,r){var i=new Uint8Array(e,t,n),a=this.section_slice_queues_[r.pid];if(r.payload_unit_start_indicator){var o=i[0];if(a!=null&&a.total_length!==0){var s=new Uint8Array(e,t+1,Math.min(n,o));a.slices.push(s),a.total_length+=s.byteLength,a.total_length===a.expected_length?this.emitSectionSlices(a,r):this.clearSlices(a,r)}for(var c=1+o;c<i.byteLength&&i[c+0]!==255;){var l=(15&i[c+1])<<8|i[c+2];this.section_slice_queues_[r.pid]=new M,(a=this.section_slice_queues_[r.pid]).expected_length=l+3,a.file_position=r.file_position,a.random_access_indicator=r.random_access_indicator,s=new Uint8Array(e,t+c,Math.min(n-c,a.expected_length-a.total_length)),a.slices.push(s),a.total_length+=s.byteLength,a.total_length===a.expected_length?this.emitSectionSlices(a,r):a.total_length>=a.expected_length&&this.clearSlices(a,r),c+=s.byteLength}}else a!=null&&a.total_length!==0&&(s=new Uint8Array(e,t,Math.min(n,a.expected_length-a.total_length)),a.slices.push(s),a.total_length+=s.byteLength,a.total_length===a.expected_length?this.emitSectionSlices(a,r):a.total_length>=a.expected_length&&this.clearSlices(a,r))},t.prototype.handlePESSlice=function(e,t,n,r){var i=new Uint8Array(e,t,n),o=i[0]<<16|i[1]<<8|i[2],s=(i[3],i[4]<<8|i[5]);if(r.payload_unit_start_indicator){if(o!==1)return void a.a.e(this.TAG,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${o}`);var c=this.pes_slice_queues_[r.pid];c&&(c.expected_length===0||c.expected_length===c.total_length?this.emitPESSlices(c,r):this.clearSlices(c,r)),this.pes_slice_queues_[r.pid]=new M,this.pes_slice_queues_[r.pid].file_position=r.file_position,this.pes_slice_queues_[r.pid].random_access_indicator=r.random_access_indicator}if(this.pes_slice_queues_[r.pid]!=null){var l=this.pes_slice_queues_[r.pid];l.slices.push(i),r.payload_unit_start_indicator&&(l.expected_length=s===0?0:s+6),l.total_length+=i.byteLength,l.expected_length>0&&l.expected_length===l.total_length?this.emitPESSlices(l,r):l.expected_length>0&&l.expected_length<l.total_length&&this.clearSlices(l,r)}},t.prototype.emitSectionSlices=function(e,t){for(var n=new Uint8Array(e.total_length),r=0,i=0;r<e.slices.length;r++){var a=e.slices[r];n.set(a,i),i+=a.byteLength}e.slices=[],e.expected_length=-1,e.total_length=0;var o=new j;o.pid=t.pid,o.data=n,o.file_position=e.file_position,o.random_access_indicator=e.random_access_indicator,this.parseSection(o)},t.prototype.emitPESSlices=function(e,t){for(var n=new Uint8Array(e.total_length),r=0,i=0;r<e.slices.length;r++){var a=e.slices[r];n.set(a,i),i+=a.byteLength}e.slices=[],e.expected_length=-1,e.total_length=0;var o=new A;o.pid=t.pid,o.data=n,o.stream_type=t.stream_type,o.file_position=e.file_position,o.random_access_indicator=e.random_access_indicator,this.parsePES(o)},t.prototype.clearSlices=function(e,t){e.slices=[],e.expected_length=-1,e.total_length=0},t.prototype.parseSection=function(e){var t=e.data,n=e.pid;n===0?this.parsePAT(t):n===this.current_pmt_pid_?this.parsePMT(t):this.pmt_!=null&&this.pmt_.scte_35_pids[n]&&this.parseSCTE35(t)},t.prototype.parsePES=function(e){var t=e.data,n=t[0]<<16|t[1]<<8|t[2],r=t[3],i=t[4]<<8|t[5];if(n===1)if(r!==188&&r!==190&&r!==191&&r!==240&&r!==241&&r!==255&&r!==242&&r!==248){t[6];var o=(192&t[7])>>>6,s=t[8],c=void 0,l=void 0;o!==2&&o!==3||(c=this.getTimestamp(t,9),l=o===3?this.getTimestamp(t,14):c);var u=9+s,d=void 0;if(i!==0){if(i<3+s)return void a.a.v(this.TAG,`Malformed PES: PES_packet_length < 3 + PES_header_data_length`);d=i-3-s}else d=t.byteLength-u;var f=t.subarray(u,u+d);switch(e.stream_type){case w.kMPEG1Audio:case w.kMPEG2Audio:this.parseMP3Payload(f,c);break;case w.kPESPrivateData:this.pmt_.common_pids.av1===e.pid?this.parseAV1Payload(f,c,l,e.file_position,e.random_access_indicator):this.pmt_.common_pids.opus===e.pid?this.parseOpusPayload(f,c):this.pmt_.common_pids.ac3===e.pid?this.parseAC3Payload(f,c):this.pmt_.common_pids.eac3===e.pid?this.parseEAC3Payload(f,c):this.pmt_.asynchronous_klv_pids[e.pid]?this.parseAsynchronousKLVMetadataPayload(f,e.pid,r):this.pmt_.smpte2038_pids[e.pid]?this.parseSMPTE2038MetadataPayload(f,c,l,e.pid,r):this.parsePESPrivateDataPayload(f,c,l,e.pid,r);break;case w.kADTSAAC:this.parseADTSAACPayload(f,c);break;case w.kLOASAAC:this.parseLOASAACPayload(f,c);break;case w.kAC3:this.parseAC3Payload(f,c);break;case w.kEAC3:this.parseEAC3Payload(f,c);break;case w.kMetadata:this.pmt_.timed_id3_pids[e.pid]?this.parseTimedID3MetadataPayload(f,c,l,e.pid,r):this.pmt_.synchronous_klv_pids[e.pid]&&this.parseSynchronousKLVMetadataPayload(f,c,l,e.pid,r);break;case w.kH264:this.parseH264Payload(f,c,l,e.file_position,e.random_access_indicator);break;case w.kH265:this.parseH265Payload(f,c,l,e.file_position,e.random_access_indicator)}}else (r===188||r===191||r===240||r===241||r===255||r===242||r===248)&&e.stream_type===w.kPESPrivateData&&(u=6,d=void 0,d=i===0?t.byteLength-u:i,f=t.subarray(u,u+d),this.parsePESPrivateDataPayload(f,void 0,void 0,e.pid,r));else a.a.e(this.TAG,`parsePES: packet_start_code_prefix should be 1 but with value ${n}`)},t.prototype.parsePAT=function(e){var t=e[0];if(t===0){var n=(15&e[1])<<8|e[2],r=(e[3],e[4],(62&e[5])>>>1),i=1&e[5],o=e[6],s=(e[7],null);if(i===1&&o===0)(s=new D).version_number=r;else if((s=this.pat_)==null)return;for(var c=n-5-4,l=-1,u=-1,d=8;d<8+c;d+=4){var f=e[d]<<8|e[d+1],p=(31&e[d+2])<<8|e[d+3];f===0?s.network_pid=p:(s.program_pmt_pid[f]=p,l===-1&&(l=f),u===-1&&(u=p))}i===1&&o===0&&(this.pat_??a.a.v(this.TAG,`Parsed first PAT: ${JSON.stringify(s)}`),this.pat_=s,this.current_program_=l,this.current_pmt_pid_=u)}else a.a.e(this.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`)},t.prototype.parsePMT=function(e){var t=e[0];if(t===2){var n=(15&e[1])<<8|e[2],r=e[3]<<8|e[4],i=(62&e[5])>>>1,o=1&e[5],s=e[6],c=(e[7],null);if(o===1&&s===0)(c=new k).program_number=r,c.version_number=i,this.program_pmt_map_[r]=c;else if((c=this.program_pmt_map_[r])==null)return;c.pcr_pid=(31&e[8])<<8|e[9];for(var l=(15&e[10])<<8|e[11],u=12+l,d=n-9-l-4,f=u;f<u+d;){var p=e[f],m=(31&e[f+1])<<8|e[f+2],h=(15&e[f+3])<<8|e[f+4];c.pid_stream_type[m]=p;var g=c.common_pids.h264||c.common_pids.h265,_=c.common_pids.adts_aac||c.common_pids.loas_aac||c.common_pids.ac3||c.common_pids.eac3||c.common_pids.opus||c.common_pids.mp3;if(p!==w.kH264||g)if(p!==w.kH265||g)if(p!==w.kADTSAAC||_)if(p!==w.kLOASAAC||_)if(p!==w.kAC3||_)if(p!==w.kEAC3||_)if(p!==w.kMPEG1Audio&&p!==w.kMPEG2Audio||_)if(p===w.kPESPrivateData){if(c.pes_private_data_pids[m]=!0,h>0){for(var v=f+5;v<f+5+h;){var y=e[v+0],b=e[v+1];if(y===5){var x=String.fromCharCode.apply(String,Array.from(e.subarray(v+2,v+2+b)));x===`VANC`?c.smpte2038_pids[m]=!0:x===`AV01`?c.common_pids.av1=m:x===`Opus`?c.common_pids.opus=m:x===`KLVA`&&(c.asynchronous_klv_pids[m]=!0)}else if(y===127){if(m===c.common_pids.opus){var S=null;if(e[v+2]===128&&(S=e[v+3]),S==null){a.a.e(this.TAG,`Not Supported Opus channel count.`);continue}var C={codec:`opus`,channel_count:15&S?15&S:2,channel_config_code:S,sample_rate:48e3},T={codec:`opus`,meta:C};this.audio_init_segment_dispatched_==0?(this.audio_metadata_=C,this.dispatchAudioInitSegment(T)):this.detectAudioMetadataChange(T)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(T))}}else y===128&&m===c.common_pids.av1&&(this.video_metadata_.av1c=e.subarray(v+2,v+2+b));v+=2+b}var E=e.subarray(f+5,f+5+h);this.dispatchPESPrivateDataDescriptor(m,p,E)}}else if(p===w.kMetadata){if(h>0)for(v=f+5;v<f+5+h;){y=e[v+0];var D=e[v+1];if(y===38){var O=e[v+2]<<8|e[v+3]<<0,A=null;O===65535&&(A=String.fromCharCode.apply(String,Array.from(e.subarray(v+4,v+4+4))));var j=null;if(e[v+4+(O===65535?4:0)]===255){var M=4+(O===65535?4:0)+1;j=String.fromCharCode.apply(String,Array.from(e.subarray(v+M,v+M+4)))}A===`ID3 `&&j===`ID3 `?c.timed_id3_pids[m]=!0:j===`KLVA`&&(c.synchronous_klv_pids[m]=!0)}v+=2+D}}else p===w.kSCTE35&&(c.scte_35_pids[m]=!0);else c.common_pids.mp3=m;else c.common_pids.eac3=m;else c.common_pids.ac3=m;else c.common_pids.loas_aac=m;else c.common_pids.adts_aac=m;else c.common_pids.h265=m;else c.common_pids.h264=m;f+=5+h}r===this.current_program_&&(this.pmt_??a.a.v(this.TAG,`Parsed first PMT: ${JSON.stringify(c)}`),this.pmt_=c,(c.common_pids.h264||c.common_pids.h265||c.common_pids.av1)&&(this.has_video_=!0),(c.common_pids.adts_aac||c.common_pids.loas_aac||c.common_pids.ac3||c.common_pids.opus||c.common_pids.mp3)&&(this.has_audio_=!0))}else a.a.e(this.TAG,`parsePMT: table_id ${t} is not corresponded to PMT!`)},t.prototype.parseSCTE35=function(e){var t=we(e);t.pts==null?t.nearest_pts=this.getNearestTimestampMilliseconds():t.pts=Math.floor(t.pts/this.timescale_),this.onSCTE35Metadata&&this.onSCTE35Metadata(t)},t.prototype.parseAV1Payload=function(e,t,n,r,i){for(var a=new ze(e),o=null,s=[],c=0,l=!1,u=null;(o=a.readNextOBUPayload())!=null;){if((u=C.parseOBUs(o,this.video_metadata_.details))&&!0===u.keyframe)if(this.video_init_segment_dispatched_){if(!0===this.detectVideoMetadataChange(null,u)){var d;this.video_metadata_changed_=!0,this.dispatchVideoMediaSegment(),(d=new Uint8Array(new ArrayBuffer(this.video_metadata_.av1c.byteLength+u.sequence_header_data.byteLength))).set(this.video_metadata_.av1c,0),d.set(u.sequence_header_data,this.video_metadata_.av1c.byteLength),u.av1c=d,this.dispatchVideoInitSegment()}}else (d=new Uint8Array(new ArrayBuffer(this.video_metadata_.av1c.byteLength+u.sequence_header_data.byteLength))).set(this.video_metadata_.av1c,0),d.set(u.sequence_header_data,this.video_metadata_.av1c.byteLength),u.av1c=d,this.video_metadata_.details=u,this.dispatchVideoInitSegment();this.video_metadata_.details=u,l||=u.keyframe,s.push({data:o}),c+=o.byteLength}var f=Math.floor(t/this.timescale_),p=Math.floor(n/this.timescale_);if(s.length){var m=this.video_track_,h={units:s,length:c,isKeyframe:l,dts:p,pts:f,cts:f-p,file_position:r};m.samples.push(h),m.length+=c}},t.prototype.parseH264Payload=function(e,t,n,r,i){for(var o=new ee(e),s=null,c=[],l=0,u=!1;(s=o.readNextNaluPayload())!=null;){var d=new I(s);if(d.type===O.kSliceSPS){var f=h.parseSPS(s.data);this.video_init_segment_dispatched_?!0===this.detectVideoMetadataChange(d,f)&&(a.a.v(this.TAG,`H264: Critical h264 metadata has been changed, attempt to re-generate InitSegment`),this.video_metadata_changed_=!0,this.video_metadata_={vps:void 0,sps:d,pps:void 0,av1c:void 0,details:f}):(this.video_metadata_.sps=d,this.video_metadata_.details=f)}else d.type===O.kSlicePPS?this.video_init_segment_dispatched_&&!this.video_metadata_changed_||(this.video_metadata_.pps=d,this.video_metadata_.sps&&this.video_metadata_.pps&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):(d.type===O.kSliceIDR||d.type===O.kSliceNonIDR&&i===1)&&(u=!0);this.video_init_segment_dispatched_&&(c.push(d),l+=d.data.byteLength)}var p=Math.floor(t/this.timescale_),m=Math.floor(n/this.timescale_);if(c.length){var g=this.video_track_,_={units:c,length:l,isKeyframe:u,dts:m,pts:p,cts:p-m,file_position:r};g.samples.push(_),g.length+=l}},t.prototype.parseH265Payload=function(e,t,n,r,i){for(var o=new De(e),s=null,c=[],l=0,u=!1;(s=o.readNextNaluPayload())!=null;){var d=new Ee(s);if(d.type===de.kSliceVPS){if(!this.video_init_segment_dispatched_){var f=_.parseVPS(s.data);this.video_metadata_.vps=d,this.video_metadata_.details=Ve(Ve({},this.video_metadata_.details),f)}}else d.type===de.kSliceSPS?(f=_.parseSPS(s.data),this.video_init_segment_dispatched_?!0===this.detectVideoMetadataChange(d,f)&&(a.a.v(this.TAG,`H265: Critical h265 metadata has been changed, attempt to re-generate InitSegment`),this.video_metadata_changed_=!0,this.video_metadata_={vps:void 0,sps:d,pps:void 0,av1c:void 0,details:f}):(this.video_metadata_.sps=d,this.video_metadata_.details=Ve(Ve({},this.video_metadata_.details),f))):d.type===de.kSlicePPS?(!this.video_init_segment_dispatched_||this.video_metadata_changed_)&&(f=_.parsePPS(s.data),this.video_metadata_.pps=d,this.video_metadata_.details=Ve(Ve({},this.video_metadata_.details),f),this.video_metadata_.vps&&this.video_metadata_.sps&&this.video_metadata_.pps&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):d.type!==de.kSliceIDR_W_RADL&&d.type!==de.kSliceIDR_N_LP&&d.type!==de.kSliceCRA_NUT||(u=!0);this.video_init_segment_dispatched_&&(c.push(d),l+=d.data.byteLength)}var p=Math.floor(t/this.timescale_),m=Math.floor(n/this.timescale_);if(c.length){var h=this.video_track_,g={units:c,length:l,isKeyframe:u,dts:m,pts:p,cts:p-m,file_position:r};h.samples.push(g),h.length+=l}},t.prototype.detectVideoMetadataChange=function(e,t){if(t.codec_mimetype!==this.video_metadata_.details.codec_mimetype)return a.a.v(this.TAG,`Video: Codec mimeType changed from ${this.video_metadata_.details.codec_mimetype} to ${t.codec_mimetype}`),!0;if(t.codec_size.width!==this.video_metadata_.details.codec_size.width||t.codec_size.height!==this.video_metadata_.details.codec_size.height){var n=this.video_metadata_.details.codec_size,r=t.codec_size;return a.a.v(this.TAG,`Video: Coded Resolution changed from ${n.width}x${n.height} to ${r.width}x${r.height}`),!0}return t.present_size.width!==this.video_metadata_.details.present_size.width&&(a.a.v(this.TAG,`Video: Present resolution width changed from ${this.video_metadata_.details.present_size.width} to ${t.present_size.width}`),!0)},t.prototype.isInitSegmentDispatched=function(){return this.has_video_&&this.has_audio_?this.video_init_segment_dispatched_&&this.audio_init_segment_dispatched_:this.has_video_&&!this.has_audio_?this.video_init_segment_dispatched_:!(this.has_video_||!this.has_audio_)&&this.audio_init_segment_dispatched_},t.prototype.dispatchVideoInitSegment=function(){var e=this.video_metadata_.details,t={type:`video`};if(t.id=this.video_track_.id,t.timescale=1e3,t.duration=this.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate,t.refSampleDuration=t.frameRate.fps_den/t.frameRate.fps_num*1e3,t.codec=e.codec_mimetype,this.video_metadata_.av1c)t.av1c=this.video_metadata_.av1c,this.video_init_segment_dispatched_==0&&a.a.v(this.TAG,`Generated first AV1 for mimeType: ${t.codec}`);else if(this.video_metadata_.vps){var n=this.video_metadata_.vps.data.subarray(4),r=this.video_metadata_.sps.data.subarray(4),i=this.video_metadata_.pps.data.subarray(4);t.hvcc=new Oe(n,r,i,e).getData(),this.video_init_segment_dispatched_==0&&a.a.v(this.TAG,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`)}else r=this.video_metadata_.sps.data.subarray(4),i=this.video_metadata_.pps.data.subarray(4),t.avcc=new L(r,i,e).getData(),this.video_init_segment_dispatched_==0&&a.a.v(this.TAG,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`);this.onTrackMetadata(`video`,t),this.video_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var o=this.media_info_;o.hasVideo=!0,o.width=t.codecWidth,o.height=t.codecHeight,o.fps=t.frameRate.fps,o.profile=t.profile,o.level=t.level,o.refFrames=e.ref_frames,o.chromaFormat=e.chroma_format_string,o.sarNum=t.sarRatio.width,o.sarDen=t.sarRatio.height,o.videoCodec=t.codec,o.hasAudio&&o.audioCodec?o.mimeType=`video/mp2t; codecs="${o.videoCodec},${o.audioCodec}"`:o.mimeType=`video/mp2t; codecs="${o.videoCodec}"`,o.isComplete()&&this.onMediaInfo(o)},t.prototype.dispatchVideoMediaSegment=function(){this.isInitSegmentDispatched()&&this.video_track_.length&&this.onDataAvailable(null,this.video_track_)},t.prototype.dispatchAudioMediaSegment=function(){this.isInitSegmentDispatched()&&this.audio_track_.length&&this.onDataAvailable(this.audio_track_,null)},t.prototype.dispatchAudioVideoMediaSegment=function(){this.isInitSegmentDispatched()&&(this.audio_track_.length||this.video_track_.length)&&this.onDataAvailable(this.audio_track_,this.video_track_)},t.prototype.parseADTSAACPayload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var n=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);n.set(this.aac_last_incomplete_data_,0),n.set(e,this.aac_last_incomplete_data_.byteLength),e=n}var r,i;if(t!=null&&(i=t/this.timescale_),this.audio_metadata_.codec===`aac`){if(t==null&&this.audio_last_sample_pts_!=null)r=1024/this.audio_metadata_.sampling_frequency*1e3,i=this.audio_last_sample_pts_+r;else if(t==null)return void a.a.w(this.TAG,`AAC: Unknown pts`);if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){r=1024/this.audio_metadata_.sampling_frequency*1e3;var o=this.audio_last_sample_pts_+r;Math.abs(o-i)>1&&(a.a.w(this.TAG,`AAC: Detected pts overlapped, expected: ${o}ms, PES pts: ${i}ms`),i=o)}}for(var s,c=new oe(e),l=null,u=i;(l=c.readNextAACFrame())!=null;){r=1024/l.sampling_frequency*1e3;var d={codec:`aac`,data:l};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:`aac`,audio_object_type:l.audio_object_type,sampling_freq_index:l.sampling_freq_index,sampling_frequency:l.sampling_frequency,channel_config:l.channel_config},this.dispatchAudioInitSegment(d)):this.detectAudioMetadataChange(d)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(d)),s=u;var f=Math.floor(u),p={unit:l.data,length:l.data.byteLength,pts:f,dts:f};this.audio_track_.samples.push(p),this.audio_track_.length+=l.data.byteLength,u+=r}c.hasIncompleteData()&&(this.aac_last_incomplete_data_=c.getIncompleteData()),s&&(this.audio_last_sample_pts_=s)}},t.prototype.parseLOASAACPayload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var n=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);n.set(this.aac_last_incomplete_data_,0),n.set(e,this.aac_last_incomplete_data_.byteLength),e=n}var r,i;if(t!=null&&(i=t/this.timescale_),this.audio_metadata_.codec===`aac`){if(t==null&&this.audio_last_sample_pts_!=null)r=1024/this.audio_metadata_.sampling_frequency*1e3,i=this.audio_last_sample_pts_+r;else if(t==null)return void a.a.w(this.TAG,`AAC: Unknown pts`);if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){r=1024/this.audio_metadata_.sampling_frequency*1e3;var o=this.audio_last_sample_pts_+r;Math.abs(o-i)>1&&(a.a.w(this.TAG,`AAC: Detected pts overlapped, expected: ${o}ms, PES pts: ${i}ms`),i=o)}}for(var s,c=new se(e),l=null,u=i;(l=c.readNextAACFrame(this.loas_previous_frame??void 0))!=null;){this.loas_previous_frame=l,r=1024/l.sampling_frequency*1e3;var d={codec:`aac`,data:l};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:`aac`,audio_object_type:l.audio_object_type,sampling_freq_index:l.sampling_freq_index,sampling_frequency:l.sampling_frequency,channel_config:l.channel_config},this.dispatchAudioInitSegment(d)):this.detectAudioMetadataChange(d)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(d)),s=u;var f=Math.floor(u),p={unit:l.data,length:l.data.byteLength,pts:f,dts:f};this.audio_track_.samples.push(p),this.audio_track_.length+=l.data.byteLength,u+=r}c.hasIncompleteData()&&(this.aac_last_incomplete_data_=c.getIncompleteData()),s&&(this.audio_last_sample_pts_=s)}},t.prototype.parseAC3Payload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var n,r;if(t!=null&&(r=t/this.timescale_),this.audio_metadata_.codec===`ac-3`){if(t==null&&this.audio_last_sample_pts_!=null)n=1536/this.audio_metadata_.sampling_frequency*1e3,r=this.audio_last_sample_pts_+n;else if(t==null)return void a.a.w(this.TAG,`AC3: Unknown pts`)}for(var i,o=new Ne(e),s=null,c=r;(s=o.readNextAC3Frame())!=null;){n=1536/s.sampling_frequency*1e3;var l={codec:`ac-3`,data:s};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:`ac-3`,sampling_frequency:s.sampling_frequency,bit_stream_identification:s.bit_stream_identification,bit_stream_mode:s.bit_stream_mode,low_frequency_effects_channel_on:s.low_frequency_effects_channel_on,channel_mode:s.channel_mode},this.dispatchAudioInitSegment(l)):this.detectAudioMetadataChange(l)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(l)),i=c;var u=Math.floor(c),d={unit:s.data,length:s.data.byteLength,pts:u,dts:u};this.audio_track_.samples.push(d),this.audio_track_.length+=s.data.byteLength,c+=n}i&&(this.audio_last_sample_pts_=i)}},t.prototype.parseEAC3Payload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var n,r;if(t!=null&&(r=t/this.timescale_),this.audio_metadata_.codec===`ec-3`){if(t==null&&this.audio_last_sample_pts_!=null)n=256*this.audio_metadata_.num_blks/this.audio_metadata_.sampling_frequency*1e3,r=this.audio_last_sample_pts_+n;else if(t==null)return void a.a.w(this.TAG,`EAC3: Unknown pts`)}for(var i,o=new Ie(e),s=null,c=r;(s=o.readNextEAC3Frame())!=null;){n=1536/s.sampling_frequency*1e3;var l={codec:`ec-3`,data:s};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:`ec-3`,sampling_frequency:s.sampling_frequency,bit_stream_identification:s.bit_stream_identification,low_frequency_effects_channel_on:s.low_frequency_effects_channel_on,num_blks:s.num_blks,channel_mode:s.channel_mode},this.dispatchAudioInitSegment(l)):this.detectAudioMetadataChange(l)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(l)),i=c;var u=Math.floor(c),d={unit:s.data,length:s.data.byteLength,pts:u,dts:u};this.audio_track_.samples.push(d),this.audio_track_.length+=s.data.byteLength,c+=n}i&&(this.audio_last_sample_pts_=i)}},t.prototype.parseOpusPayload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var n,r;if(t!=null&&(r=t/this.timescale_),this.audio_metadata_.codec===`opus`){if(t==null&&this.audio_last_sample_pts_!=null)n=20,r=this.audio_last_sample_pts_+n;else if(t==null)return void a.a.w(this.TAG,`Opus: Unknown pts`)}for(var i,o=r,s=0;s<e.length;){n=20;for(var c=(16&e[s+1])!=0,l=(8&e[s+1])!=0,u=s+2,d=0;e[u]===255;)d+=255,u+=1;d+=e[u],u+=1,u+=c?2:0,u+=l?2:0,i=o;var f=Math.floor(o),p=e.slice(u,u+d),m={unit:p,length:p.byteLength,pts:f,dts:f};this.audio_track_.samples.push(m),this.audio_track_.length+=p.byteLength,o+=n,s=u+d}i&&(this.audio_last_sample_pts_=i)}},t.prototype.parseMP3Payload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var n=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],r=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],i=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],a=e[1]>>>3&3,o=(6&e[1])>>1,s=(240&e[2])>>>4,c=(12&e[2])>>>2,l=(e[3]>>>6&3)==3?1:2,u=0,d=34;switch(a){case 0:u=[11025,12e3,8e3,0][c];break;case 2:u=[22050,24e3,16e3,0][c];break;case 3:u=[44100,48e3,32e3,0][c]}switch(o){case 1:d=34,s<i.length&&i[s];break;case 2:d=33,s<r.length&&r[s];break;case 3:d=32,s<n.length&&n[s]}var f=new Ae;f.object_type=d,f.sample_rate=u,f.channel_count=l,f.data=e;var p={codec:`mp3`,data:f};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:`mp3`,object_type:d,sample_rate:u,channel_count:l},this.dispatchAudioInitSegment(p)):this.detectAudioMetadataChange(p)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(p));var m={unit:e,length:e.byteLength,pts:t/this.timescale_,dts:t/this.timescale_};this.audio_track_.samples.push(m),this.audio_track_.length+=e.byteLength}},t.prototype.detectAudioMetadataChange=function(e){if(e.codec!==this.audio_metadata_.codec)return a.a.v(this.TAG,`Audio: Audio Codecs changed from ${this.audio_metadata_.codec} to ${e.codec}`),!0;if(e.codec===`aac`&&this.audio_metadata_.codec===`aac`){if((t=e.data).audio_object_type!==this.audio_metadata_.audio_object_type)return a.a.v(this.TAG,`AAC: AudioObjectType changed from ${this.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return a.a.v(this.TAG,`AAC: SamplingFrequencyIndex changed from ${this.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==this.audio_metadata_.channel_config)return a.a.v(this.TAG,`AAC: Channel configuration changed from ${this.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if(e.codec===`ac-3`&&this.audio_metadata_.codec===`ac-3`){var t;if((t=e.data).sampling_frequency!==this.audio_metadata_.sampling_frequency)return a.a.v(this.TAG,`AC3: Sampling Frequency changed from ${this.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return a.a.v(this.TAG,`AC3: Bit Stream Identification changed from ${this.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return a.a.v(this.TAG,`AC3: BitStream Mode changed from ${this.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==this.audio_metadata_.channel_mode)return a.a.v(this.TAG,`AC3: Channel Mode changed from ${this.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return a.a.v(this.TAG,`AC3: Low Frequency Effects Channel On changed from ${this.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if(e.codec===`opus`&&this.audio_metadata_.codec===`opus`){if((n=e.meta).sample_rate!==this.audio_metadata_.sample_rate)return a.a.v(this.TAG,`Opus: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${n.sample_rate}`),!0;if(n.channel_count!==this.audio_metadata_.channel_count)return a.a.v(this.TAG,`Opus: Channel count changed from ${this.audio_metadata_.channel_count} to ${n.channel_count}`),!0}else if(e.codec===`mp3`&&this.audio_metadata_.codec===`mp3`){var n;if((n=e.data).object_type!==this.audio_metadata_.object_type)return a.a.v(this.TAG,`MP3: AudioObjectType changed from ${this.audio_metadata_.object_type} to ${n.object_type}`),!0;if(n.sample_rate!==this.audio_metadata_.sample_rate)return a.a.v(this.TAG,`MP3: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${n.sample_rate}`),!0;if(n.channel_count!==this.audio_metadata_.channel_count)return a.a.v(this.TAG,`MP3: Channel count changed from ${this.audio_metadata_.channel_count} to ${n.channel_count}`),!0}return!1},t.prototype.dispatchAudioInitSegment=function(e){var t={type:`audio`};if(t.id=this.audio_track_.id,t.timescale=1e3,t.duration=this.duration_,this.audio_metadata_.codec===`aac`){var n=new ce(e.codec===`aac`?e.data:null);t.audioSampleRate=n.sampling_rate,t.channelCount=n.channel_count,t.codec=n.codec_mimetype,t.originalCodec=n.original_codec_mimetype,t.config=n.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale}else if(this.audio_metadata_.codec===`ac-3`){var r=new Pe(e.codec===`ac-3`?e.data:null);t.audioSampleRate=r.sampling_rate,t.channelCount=r.channel_count,t.codec=r.codec_mimetype,t.originalCodec=r.original_codec_mimetype,t.config=r.config,t.refSampleDuration=1536/t.audioSampleRate*t.timescale}else if(this.audio_metadata_.codec===`ec-3`){var i=new Le(e.codec===`ec-3`?e.data:null);t.audioSampleRate=i.sampling_rate,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=256*i.num_blks/t.audioSampleRate*t.timescale}else this.audio_metadata_.codec===`opus`?(t.audioSampleRate=this.audio_metadata_.sample_rate,t.channelCount=this.audio_metadata_.channel_count,t.channelConfigCode=this.audio_metadata_.channel_config_code,t.codec=`opus`,t.originalCodec=`opus`,t.config=void 0,t.refSampleDuration=20):this.audio_metadata_.codec===`mp3`&&(t.audioSampleRate=this.audio_metadata_.sample_rate,t.channelCount=this.audio_metadata_.channel_count,t.codec=`mp3`,t.originalCodec=`mp3`,t.config=void 0);this.audio_init_segment_dispatched_==0&&a.a.v(this.TAG,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),this.onTrackMetadata(`audio`,t),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var o=this.media_info_;o.hasAudio=!0,o.audioCodec=t.originalCodec,o.audioSampleRate=t.audioSampleRate,o.audioChannelCount=t.channelCount,o.hasVideo&&o.videoCodec?o.mimeType=`video/mp2t; codecs="${o.videoCodec},${o.audioCodec}"`:o.mimeType=`video/mp2t; codecs="${o.audioCodec}"`,o.isComplete()&&this.onMediaInfo(o)},t.prototype.dispatchPESPrivateDataDescriptor=function(e,t,n){var r=new ue;r.pid=e,r.stream_type=t,r.descriptor=n,this.onPESPrivateDataDescriptor&&this.onPESPrivateDataDescriptor(r)},t.prototype.parsePESPrivateDataPayload=function(e,t,n,r,i){var a=new le;a.pid=r,a.stream_id=i,a.len=e.byteLength,a.data=e,t==null?a.nearest_pts=this.getNearestTimestampMilliseconds():a.pts=Math.floor(t/this.timescale_),n!=null&&(a.dts=Math.floor(n/this.timescale_)),this.onPESPrivateData&&this.onPESPrivateData(a)},t.prototype.parseTimedID3MetadataPayload=function(e,t,n,r,i){var a=new le;a.pid=r,a.stream_id=i,a.len=e.byteLength,a.data=e,t!=null&&(a.pts=Math.floor(t/this.timescale_)),n!=null&&(a.dts=Math.floor(n/this.timescale_)),this.onTimedID3Metadata&&this.onTimedID3Metadata(a)},t.prototype.parseSynchronousKLVMetadataPayload=function(e,t,n,r,i){var a=new Re;a.pid=r,a.stream_id=i,a.len=e.byteLength,a.data=e,t!=null&&(a.pts=Math.floor(t/this.timescale_)),n!=null&&(a.dts=Math.floor(n/this.timescale_)),a.access_units=function(e){for(var t=[],n=0;n+5<e.byteLength;){var r=e[n+0],i=e[n+1],a=e[n+2],o=e[n+3]<<8|e[n+4]<<0,s=e.slice(n+5,n+5+o);t.push({service_id:r,sequence_number:i,flags:a,data:s}),n+=5+o}return t}(e),this.onSynchronousKLVMetadata&&this.onSynchronousKLVMetadata(a)},t.prototype.parseAsynchronousKLVMetadataPayload=function(e,t,n){var r=new le;r.pid=t,r.stream_id=n,r.len=e.byteLength,r.data=e,this.onAsynchronousKLVMetadata&&this.onAsynchronousKLVMetadata(r)},t.prototype.parseSMPTE2038MetadataPayload=function(e,t,n,r,i){var a=new ke;a.pid=r,a.stream_id=i,a.len=e.byteLength,a.data=e,t!=null&&(a.pts=Math.floor(t/this.timescale_)),a.nearest_pts=this.getNearestTimestampMilliseconds(),n!=null&&(a.dts=Math.floor(n/this.timescale_)),a.ancillaries=function(e){for(var t=new m(e),n=0,r=[];n+=6,t.readBits(6)===0;){var i=t.readBool();n+=1;var a=t.readBits(11);n+=11;var o=t.readBits(12);n+=12;var s=255&t.readBits(10);n+=10;var c=255&t.readBits(10);n+=10;var l=255&t.readBits(10);n+=10;for(var u=new Uint8Array(l),d=0;d<l;d++){var f=255&t.readBits(10);n+=10,u[d]=f}t.readBits(10),n+=10;var p=`User Defined`;s===65?c===7&&(p=`SCTE-104`):s===95?c===220?p=`ARIB STD-B37 (1SEG)`:c===221?p=`ARIB STD-B37 (ANALOG)`:c===222?p=`ARIB STD-B37 (SD)`:c===223&&(p=`ARIB STD-B37 (HD)`):s===97&&(c===1?p=`EIA-708`:c===2&&(p=`EIA-608`)),r.push({yc_indicator:i,line_number:a,horizontal_offset:o,did:s,sdid:c,user_data:u,description:p,information:{}}),t.readBits(8-(n-Math.floor(n/8))%8),n+=(8-(n-Math.floor(n/8)))%8}return t.destroy(),t=null,r}(e),this.onSMPTE2038Metadata&&this.onSMPTE2038Metadata(a)},t.prototype.getNearestTimestampMilliseconds=function(){return this.audio_last_sample_pts_==null?this.last_pcr_==null?void 0:Math.floor(this.last_pcr_/300/this.timescale_):Math.floor(this.audio_last_sample_pts_)},t.prototype.getPcrBase=function(e){var t=33554432*e[6]+131072*e[7]+512*e[8]+2*e[9]+(128&e[10])/128+this.timestamp_offset_;return t+4294967296<this.last_pcr_base_&&(t+=8589934592,this.timestamp_offset_+=8589934592),this.last_pcr_base_=t,t},t.prototype.getTimestamp=function(e,t){var n=536870912*(14&e[t])+4194304*(255&e[t+1])+16384*(254&e[t+2])+128*(255&e[t+3])+(254&e[t+4])/2+this.timestamp_offset_;return n+4294967296<this.last_pcr_base_&&(n+=8589934592),n},t}(E),Ue=function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},We=function(){function e(){}return e.init=function(){for(var t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],hvc1:[],hvcC:[],av01:[],av1C:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[],fLaC:[],dfLa:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var n=e.constants={};n.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),n.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),n.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),n.STSC=n.STCO=n.STTS,n.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),n.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),n.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),n.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},e.box=function(e){for(var t=8,n=null,r=Array.prototype.slice.call(arguments,1),i=r.length,a=0;a<i;a++)t+=r[a].byteLength;(n=new Uint8Array(t))[0]=t>>>24&255,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n.set(e,4);var o=8;for(a=0;a<i;a++)n.set(r[a],o),o+=r[a].byteLength;return n},e.generateInitSegment=function(t){var n=e.box(e.types.ftyp,e.constants.FTYP),r=e.moov(t),i=new Uint8Array(n.byteLength+r.byteLength);return i.set(n,0),i.set(r,n.byteLength),i},e.moov=function(t){var n=e.mvhd(t.timescale,t.duration),r=e.trak(t),i=e.mvex(t);return e.box(e.types.moov,n,r,i)},e.mvhd=function(t,n){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,n>>>24&255,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]))},e.trak=function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.tkhd=function(t){var n=t.id,r=t.duration,i=t.presentWidth,a=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,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,i>>>8&255,255&i,0,0,a>>>8&255,255&a,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))},e.mdhd=function(t){var n=t.timescale,r=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))},e.hdlr=function(t){var n=null;return n=t.type===`audio`?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,n)},e.minf=function(t){var n=null;return n=t.type===`audio`?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,n,e.dinf(),e.stbl(t))},e.dinf=function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))},e.stsd=function(t){return t.type===`audio`?t.codec===`mp3`?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):t.codec===`ac-3`?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.ac3(t)):t.codec===`ec-3`?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.ec3(t)):t.codec===`opus`?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.Opus(t)):t.codec==`flac`?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.fLaC(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):t.type===`video`&&t.codec.startsWith(`hvc1`)?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.hvc1(t)):t.type===`video`&&t.codec.startsWith(`av01`)?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.av01(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t))},e.mp3=function(t){var n=t.channelCount,r=t.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types[`.mp3`],i)},e.mp4a=function(t){var n=t.channelCount,r=t.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types.mp4a,i,e.esds(t))},e.ac3=function(t){var n=t.channelCount,r=t.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types[`ac-3`],i,e.box(e.types.dac3,new Uint8Array(t.config)))},e.ec3=function(t){var n=t.channelCount,r=t.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types[`ec-3`],i,e.box(e.types.dec3,new Uint8Array(t.config)))},e.esds=function(t){var n=t.config||[],r=n.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5,r].concat(n,[6,1,2]));return e.box(e.types.esds,i)},e.Opus=function(t){var n=t.channelCount,r=t.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types.Opus,i,e.dOps(t))},e.dOps=function(t){var n=t.channelCount,r=t.channelConfigCode,i=t.audioSampleRate;if(t.config)return e.box(e.types.dOps,t.config);var a=[];switch(r){case 1:case 2:a=[0];break;case 0:a=[255,1,1,0,1];break;case 128:a=[255,2,0,0,1];break;case 3:a=[1,2,1,0,2,1];break;case 4:a=[1,2,2,0,1,2,3];break;case 5:a=[1,3,2,0,4,1,2,3];break;case 6:a=[1,4,2,0,4,1,2,3,5];break;case 7:a=[1,4,2,0,4,1,2,3,5,6];break;case 8:a=[1,5,3,0,6,1,2,3,4,5,7];break;case 130:a=[1,1,2,0,1];break;case 131:a=[1,1,3,0,1,2];break;case 132:a=[1,1,4,0,1,2,3];break;case 133:a=[1,1,5,0,1,2,3,4];break;case 134:a=[1,1,6,0,1,2,3,4,5];break;case 135:a=[1,1,7,0,1,2,3,4,5,6];break;case 136:a=[1,1,8,0,1,2,3,4,5,6,7]}var o=new Uint8Array(Ue([0,n,0,0,i>>>24&255,i>>>17&255,i>>>8&255,i>>>0&255,0,0],a,!0));return e.box(e.types.dOps,o)},e.fLaC=function(t){var n=t.channelCount,r=Math.min(t.audioSampleRate,65535),i=t.sampleSize,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,i,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types.fLaC,a,e.dfLa(t))},e.dfLa=function(t){var n=new Uint8Array(Ue([0,0,0,0],t.config,!0));return e.box(e.types.dfLa,n)},e.avc1=function(t){var n=t.avcc,r=t.codecWidth,i=t.codecHeight,a=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,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.avc1,a,e.box(e.types.avcC,n))},e.hvc1=function(t){var n=t.hvcc,r=t.codecWidth,i=t.codecHeight,a=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,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.hvc1,a,e.box(e.types.hvcC,n))},e.av01=function(t){var n=t.av1c,r=t.codecWidth||192,i=t.codecHeight||108,a=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,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.av01,a,e.box(e.types.av1C,n))},e.mvex=function(t){return e.box(e.types.mvex,e.trex(t))},e.trex=function(t){var n=t.id,r=new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,r)},e.moof=function(t,n){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,n))},e.mfhd=function(t){var n=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,n)},e.traf=function(t,n){var r=t.id,i=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),a=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n])),o=e.sdtp(t),s=e.trun(t,o.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,i,a,s,o)},e.sdtp=function(t){for(var n=t.samples||[],r=n.length,i=new Uint8Array(4+r),a=0;a<r;a++){var o=n[a].flags;i[a+4]=o.isLeading<<6|o.dependsOn<<4|o.isDependedOn<<2|o.hasRedundancy}return e.box(e.types.sdtp,i)},e.trun=function(t,n){var r=t.samples||[],i=r.length,a=12+16*i,o=new Uint8Array(a);n+=8+a,o.set([0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0);for(var s=0;s<i;s++){var c=r[s].duration,l=r[s].size,u=r[s].flags,d=r[s].cts;o.set([c>>>24&255,c>>>16&255,c>>>8&255,255&c,l>>>24&255,l>>>16&255,l>>>8&255,255&l,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.isNonSync,0,0,d>>>24&255,d>>>16&255,d>>>8&255,255&d],12+16*s)}return e.box(e.types.trun,o)},e.mdat=function(t){return e.box(e.types.mdat,t)},e}();We.init();var Ge=We,Ke=function(){function e(){}return e.getSilentFrame=function(e,t){if(e===`mp4a.40.2`){if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2||t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},e}(),qe=n(11),Je=function(){function e(e){this.TAG=`MP4Remuxer`,this._config=e,this._isLive=!0===e.isLive,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new qe.c(`audio`),this._videoSegmentInfoList=new qe.c(`video`),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!o.a.chrome||!(o.a.version.major<50||o.a.version.major===50&&o.a.version.build<2661)),this._fillSilentAfterSeek=o.a.msedge||o.a.msie,this._mp3UseMpegAudio=!o.a.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return e.prototype.destroy=function(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null},e.prototype.bindDataSource=function(e){return e.onDataAvailable=this.remux.bind(this),e.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(e.prototype,`onInitSegment`,{get:function(){return this._onInitSegment},set:function(e){this._onInitSegment=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onMediaSegment`,{get:function(){return this._onMediaSegment},set:function(e){this._onMediaSegment=e},enumerable:!1,configurable:!0}),e.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},e.prototype.seek=function(e){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},e.prototype.remux=function(e,t){if(!this._onMediaSegment)throw new d.a(`MP4Remuxer: onMediaSegment callback must be specificed!`);this._dtsBaseInited||this._calculateDtsBase(e,t),t&&this._remuxVideo(t),e&&this._remuxAudio(e)},e.prototype._onTrackMetadataReceived=function(e,t){var n=null,r=`mp4`,i=t.codec;if(e===`audio`)this._audioMeta=t,t.codec===`mp3`&&this._mp3UseMpegAudio?(r=`mpeg`,i=``,n=new Uint8Array):n=Ge.generateInitSegment(t);else{if(e!==`video`)return;this._videoMeta=t,n=Ge.generateInitSegment(t)}if(!this._onInitSegment)throw new d.a(`MP4Remuxer: onInitSegment callback must be specified!`);this._onInitSegment(e,{type:e,data:n.buffer,codec:i,container:`${e}/${r}`,mediaDuration:t.duration})},e.prototype._calculateDtsBase=function(e,t){this._dtsBaseInited||=(e&&e.samples&&e.samples.length&&(this._audioDtsBase=e.samples[0].dts),t&&t.samples&&t.samples.length&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),!0)},e.prototype.getTimestampBase=function(){if(this._dtsBaseInited)return this._dtsBase},e.prototype.flushStashedSamples=function(){var e=this._videoStashedLastSample,t=this._audioStashedLastSample,n={type:`video`,id:1,sequenceNumber:0,samples:[],length:0};e!=null&&(n.samples.push(e),n.length=e.length);var r={type:`audio`,id:2,sequenceNumber:0,samples:[],length:0};t!=null&&(r.samples.push(t),r.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(n,!0),this._remuxAudio(r,!0)},e.prototype._remuxAudio=function(e,t){if(this._audioMeta!=null){var n,r=e,i=r.samples,s=void 0,c=-1,l=this._audioMeta.refSampleDuration,u=this._audioMeta.codec===`mp3`&&this._mp3UseMpegAudio,d=this._dtsBaseInited&&this._audioNextDts===void 0,f=!1;if(i&&i.length!==0&&(i.length!==1||t)){var p=0,m=null,h=0;u?(p=0,h=r.length):(p=8,h=8+r.length);var g=null;if(i.length>1&&(h-=(g=i.pop()).length),this._audioStashedLastSample!=null){var _=this._audioStashedLastSample;this._audioStashedLastSample=null,i.unshift(_),h+=_.length}g!=null&&(this._audioStashedLastSample=g);var v=i[0].dts-this._dtsBase;if(this._audioNextDts)s=v-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())s=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&this._audioMeta.originalCodec!==`mp3`&&(f=!0);else{var y=this._audioSegmentInfoList.getLastSampleBefore(v);if(y!=null){var b=v-(y.originalDts+y.duration);b<=3&&(b=0),s=v-(y.dts+y.duration+b)}else s=0}if(f){var x=v-s,S=this._videoSegmentInfoList.getLastSegmentBefore(v);if(S!=null&&S.beginDts<x){if(N=Ke.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount)){var C=S.beginDts,w=x-S.beginDts;a.a.v(this.TAG,`InsertPrefixSilentAudio: dts: ${C}, duration: ${w}`),i.unshift({unit:N,dts:C,pts:C}),h+=N.byteLength}}else f=!1}for(var T=[],E=0;E<i.length;E++){var D=(_=i[E]).unit,O=_.dts-this._dtsBase,k=(C=O,!1),A=null,j=0;if(!(O<-.001)){if(this._audioMeta.codec!==`mp3`&&l!=null){var M=O;if(this._audioNextDts&&(M=this._audioNextDts),(s=O-M)<=-3*l){a.a.w(this.TAG,`Dropping 1 audio frame (originalDts: ${O} ms ,curRefDts: ${M} ms) due to dtsCorrection: ${s} ms overlap.`);continue}if(s>=3*l&&this._fillAudioTimestampGap&&!o.a.safari){k=!0;var N,P=Math.floor(s/l);a.a.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.
|
|
2
2
|
originalDts: ${O} ms, curRefDts: ${M} ms, dtsCorrection: ${Math.round(s)} ms, generate: ${P} frames`),C=Math.floor(M),j=Math.floor(M+l)-C,(N=Ke.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount))??(a.a.w(this.TAG,`Unable to generate silent frame for ${this._audioMeta.originalCodec} with ${this._audioMeta.channelCount} channels, repeat last frame`),N=D),A=[];for(var F=0;F<P;F++){M+=l;var I=Math.floor(M),ee=Math.floor(M+l)-I,L={dts:I,pts:I,cts:0,unit:N,size:N.byteLength,duration:ee,originalDts:O,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};A.push(L),h+=L.size}this._audioNextDts=M+l}else C=Math.floor(M),j=Math.floor(M+l)-C,this._audioNextDts=M+l}else C=O-s,j=E===i.length-1?g==null?T.length>=1?T[T.length-1].duration:Math.floor(l):g.dts-this._dtsBase-s-C:i[E+1].dts-this._dtsBase-s-C,this._audioNextDts=C+j;c===-1&&(c=C),T.push({dts:C,pts:C,cts:0,unit:_.unit,size:_.unit.byteLength,duration:j,originalDts:O,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),k&&T.push.apply(T,A)}}if(T.length===0)return r.samples=[],void(r.length=0);for(u?m=new Uint8Array(h):((m=new Uint8Array(h))[0]=h>>>24&255,m[1]=h>>>16&255,m[2]=h>>>8&255,m[3]=255&h,m.set(Ge.types.mdat,4)),E=0;E<T.length;E++)D=T[E].unit,m.set(D,p),p+=D.byteLength;var R=T[T.length-1];n=R.dts+R.duration;var te=new qe.b;te.beginDts=c,te.endDts=n,te.beginPts=c,te.endPts=n,te.originalBeginDts=T[0].originalDts,te.originalEndDts=R.originalDts+R.duration,te.firstSample=new qe.d(T[0].dts,T[0].pts,T[0].duration,T[0].originalDts,!1),te.lastSample=new qe.d(R.dts,R.pts,R.duration,R.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(te),r.samples=T,r.sequenceNumber++;var ne=null;ne=u?new Uint8Array:Ge.moof(r,c),r.samples=[],r.length=0;var re={type:`audio`,data:this._mergeBoxes(ne,m).buffer,sampleCount:T.length,info:te};u&&d&&(re.timestampOffset=c),this._onMediaSegment(`audio`,re)}}},e.prototype._remuxVideo=function(e,t){if(this._videoMeta!=null){var n,r,i=e,a=i.samples,o=void 0,s=-1,c=-1;if(a&&a.length!==0&&(a.length!==1||t)){var l=8,u=null,d=8+e.length,f=null;if(a.length>1&&(d-=(f=a.pop()).length),this._videoStashedLastSample!=null){var p=this._videoStashedLastSample;this._videoStashedLastSample=null,a.unshift(p),d+=p.length}f!=null&&(this._videoStashedLastSample=f);var m=a[0].dts-this._dtsBase;if(this._videoNextDts)o=m-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())o=0;else{var h=this._videoSegmentInfoList.getLastSampleBefore(m);if(h!=null){var g=m-(h.originalDts+h.duration);g<=3&&(g=0),o=m-(h.dts+h.duration+g)}else o=0}for(var _=new qe.b,v=[],y=0;y<a.length;y++){var b=(p=a[y]).dts-this._dtsBase,x=p.isKeyframe,S=b-o,C=p.cts,w=S+C;s===-1&&(s=S,c=w);var T=0;if(T=y===a.length-1?f==null?v.length>=1?v[v.length-1].duration:Math.floor(this._videoMeta.refSampleDuration):f.dts-this._dtsBase-o-S:a[y+1].dts-this._dtsBase-o-S,x){var E=new qe.d(S,w,T,p.dts,!0);E.fileposition=p.fileposition,_.appendSyncPoint(E)}v.push({dts:S,pts:w,cts:C,units:p.units,size:p.length,isKeyframe:x,duration:T,originalDts:b,flags:{isLeading:0,dependsOn:x?2:1,isDependedOn:x?1:0,hasRedundancy:0,isNonSync:x?0:1}})}for((u=new Uint8Array(d))[0]=d>>>24&255,u[1]=d>>>16&255,u[2]=d>>>8&255,u[3]=255&d,u.set(Ge.types.mdat,4),y=0;y<v.length;y++)for(var D=v[y].units;D.length;){var O=D.shift().data;u.set(O,l),l+=O.byteLength}var k=v[v.length-1];if(n=k.dts+k.duration,r=k.pts+k.duration,this._videoNextDts=n,_.beginDts=s,_.endDts=n,_.beginPts=c,_.endPts=r,_.originalBeginDts=v[0].originalDts,_.originalEndDts=k.originalDts+k.duration,_.firstSample=new qe.d(v[0].dts,v[0].pts,v[0].duration,v[0].originalDts,v[0].isKeyframe),_.lastSample=new qe.d(k.dts,k.pts,k.duration,k.originalDts,k.isKeyframe),this._isLive||this._videoSegmentInfoList.append(_),i.samples=v,i.sequenceNumber++,this._forceFirstIDR){var A=v[0].flags;A.dependsOn=2,A.isNonSync=0}var j=Ge.moof(i,s);i.samples=[],i.length=0,this._onMediaSegment(`video`,{type:`video`,data:this._mergeBoxes(j,u).buffer,sampleCount:v.length,info:_})}}},e.prototype._mergeBoxes=function(e,t){var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e,0),n.set(t,e.byteLength),n},e}(),Ye=n(14),Xe=n(1);t.a=(n(2),function(){function e(e,t){this.TAG=`TransmuxingController`,this._emitter=new i.a,this._config=t,e.segments||=[{duration:e.duration,filesize:e.filesize,url:e.url}],typeof e.cors!=`boolean`&&(e.cors=!0),typeof e.withCredentials!=`boolean`&&(e.withCredentials=!1),this._mediaDataSource=e,this._currentSegmentIndex=0;var n=0;this._mediaDataSource.segments.forEach((function(r){r.timestampBase=n,n+=r.duration,r.cors=e.cors,r.withCredentials=e.withCredentials,t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy)})),isNaN(n)||this._mediaDataSource.duration===n||(this._mediaDataSource.duration=n),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return e.prototype.destroy=function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&=(this._ioctl.destroy(),null),this._demuxer&&=(this._demuxer.destroy(),null),this._remuxer&&=(this._remuxer.destroy(),null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},e.prototype._loadSegment=function(e,t){this._currentSegmentIndex=e;var n=this._mediaDataSource.segments[e],r=this._ioctl=new Ye.a(n,this._config,e);r.onError=this._onIOException.bind(this),r.onSeeked=this._onIOSeeked.bind(this),r.onComplete=this._onIOComplete.bind(this),r.onRedirect=this._onIORedirect.bind(this),r.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):r.onDataArrival=this._onInitChunkArrival.bind(this),r.open(t)},e.prototype.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},e.prototype._internalAbort=function(){this._ioctl&&=(this._ioctl.destroy(),null)},e.prototype.pause=function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},e.prototype.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},e.prototype.seek=function(e){if(this._mediaInfo!=null&&this._mediaInfo.isSeekable()){var t=this._searchSegmentIndexContains(e);if(t===this._currentSegmentIndex){var n=this._mediaInfo.segments[t];if(n==null)this._pendingSeekTime=e;else{var r=n.getNearestKeyframe(e);this._remuxer.seek(r.milliseconds),this._ioctl.seek(r.fileposition),this._pendingResolveSeekPoint=r.milliseconds}}else{var i=this._mediaInfo.segments[t];i==null?(this._pendingSeekTime=e,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t)):(r=i.getNearestKeyframe(e),this._internalAbort(),this._remuxer.seek(e),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,r.fileposition),this._pendingResolveSeekPoint=r.milliseconds,this._reportSegmentMediaInfo(t))}this._enableStatisticsReporter()}},e.prototype._searchSegmentIndexContains=function(e){for(var t=this._mediaDataSource.segments,n=t.length-1,r=0;r<t.length;r++)if(e<t[r].timestampBase){n=r-1;break}return n},e.prototype._onInitChunkArrival=function(e,t){var n=this,r=0;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,r=this._demuxer.parseChunks(e,t);else{var i=null;(i=T.probe(e)).match&&(this._setupFLVDemuxerRemuxer(i),r=this._demuxer.parseChunks(e,t)),i.match||i.needMoreData||(i=He.probe(e)).match&&(this._setupTSDemuxerRemuxer(i),r=this._demuxer.parseChunks(e,t)),i.match||i.needMoreData||(i=null,a.a.e(this.TAG,`Non MPEG-TS/FLV, Unsupported media type!`),Promise.resolve().then((function(){n._internalAbort()})),this._emitter.emit(Xe.a.DEMUX_ERROR,g.a.FORMAT_UNSUPPORTED,`Non MPEG-TS/FLV, Unsupported media type!`))}return r},e.prototype._setupFLVDemuxerRemuxer=function(e){this._demuxer=new T(e,this._config),this._remuxer||=new Je(this._config);var t=this._mediaDataSource;t.duration==null||isNaN(t.duration)||(this._demuxer.overridedDuration=t.duration),typeof t.hasAudio==`boolean`&&(this._demuxer.overridedHasAudio=t.hasAudio),typeof t.hasVideo==`boolean`&&(this._demuxer.overridedHasVideo=t.hasVideo),this._demuxer.timestampBase=t.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this)},e.prototype._setupTSDemuxerRemuxer=function(e){var t=this._demuxer=new He(e,this._config);this._remuxer||=new Je(this._config),t.onError=this._onDemuxException.bind(this),t.onMediaInfo=this._onMediaInfo.bind(this),t.onMetaDataArrived=this._onMetaDataArrived.bind(this),t.onTimedID3Metadata=this._onTimedID3Metadata.bind(this),t.onSynchronousKLVMetadata=this._onSynchronousKLVMetadata.bind(this),t.onAsynchronousKLVMetadata=this._onAsynchronousKLVMetadata.bind(this),t.onSMPTE2038Metadata=this._onSMPTE2038Metadata.bind(this),t.onSCTE35Metadata=this._onSCTE35Metadata.bind(this),t.onPESPrivateDataDescriptor=this._onPESPrivateDataDescriptor.bind(this),t.onPESPrivateData=this._onPESPrivateData.bind(this),this._remuxer.bindDataSource(this._demuxer),this._demuxer.bindDataSource(this._ioctl),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this)},e.prototype._onMediaInfo=function(e){var t=this;this._mediaInfo??(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,s.a.prototype));var n=Object.assign({},e);Object.setPrototypeOf(n,s.a.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=n,this._reportSegmentMediaInfo(this._currentSegmentIndex),this._pendingSeekTime!=null&&Promise.resolve().then((function(){var e=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(e)}))},e.prototype._onMetaDataArrived=function(e){this._emitter.emit(Xe.a.METADATA_ARRIVED,e)},e.prototype._onScriptDataArrived=function(e){this._emitter.emit(Xe.a.SCRIPTDATA_ARRIVED,e)},e.prototype._onTimedID3Metadata=function(e){var t=this._remuxer.getTimestampBase();t!=null&&(e.pts!=null&&(e.pts-=t),e.dts!=null&&(e.dts-=t),this._emitter.emit(Xe.a.TIMED_ID3_METADATA_ARRIVED,e))},e.prototype._onSynchronousKLVMetadata=function(e){var t=this._remuxer.getTimestampBase();t!=null&&(e.pts!=null&&(e.pts-=t),e.dts!=null&&(e.dts-=t),this._emitter.emit(Xe.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,e))},e.prototype._onAsynchronousKLVMetadata=function(e){this._emitter.emit(Xe.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,e)},e.prototype._onSMPTE2038Metadata=function(e){var t=this._remuxer.getTimestampBase();t!=null&&(e.pts!=null&&(e.pts-=t),e.dts!=null&&(e.dts-=t),e.nearest_pts!=null&&(e.nearest_pts-=t),this._emitter.emit(Xe.a.SMPTE2038_METADATA_ARRIVED,e))},e.prototype._onSCTE35Metadata=function(e){var t=this._remuxer.getTimestampBase();t!=null&&(e.pts!=null&&(e.pts-=t),e.nearest_pts!=null&&(e.nearest_pts-=t),this._emitter.emit(Xe.a.SCTE35_METADATA_ARRIVED,e))},e.prototype._onPESPrivateDataDescriptor=function(e){this._emitter.emit(Xe.a.PES_PRIVATE_DATA_DESCRIPTOR,e)},e.prototype._onPESPrivateData=function(e){var t=this._remuxer.getTimestampBase();t!=null&&(e.pts!=null&&(e.pts-=t),e.nearest_pts!=null&&(e.nearest_pts-=t),e.dts!=null&&(e.dts-=t),this._emitter.emit(Xe.a.PES_PRIVATE_DATA_ARRIVED,e))},e.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},e.prototype._onIOComplete=function(e){var t=e+1;t<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer&&this._remuxer.flushStashedSamples(),this._loadSegment(t)):(this._remuxer&&this._remuxer.flushStashedSamples(),this._emitter.emit(Xe.a.LOADING_COMPLETE),this._disableStatisticsReporter())},e.prototype._onIORedirect=function(e){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=e},e.prototype._onIORecoveredEarlyEof=function(){this._emitter.emit(Xe.a.RECOVERED_EARLY_EOF)},e.prototype._onIOException=function(e,t){a.a.e(this.TAG,`IOException: type = ${e}, code = ${t.code}, msg = ${t.msg}`),this._emitter.emit(Xe.a.IO_ERROR,e,t),this._disableStatisticsReporter()},e.prototype._onDemuxException=function(e,t){a.a.e(this.TAG,`DemuxException: type = ${e}, info = ${t}`),this._emitter.emit(Xe.a.DEMUX_ERROR,e,t)},e.prototype._onRemuxerInitSegmentArrival=function(e,t){this._emitter.emit(Xe.a.INIT_SEGMENT,e,t)},e.prototype._onRemuxerMediaSegmentArrival=function(e,t){if(this._pendingSeekTime==null&&(this._emitter.emit(Xe.a.MEDIA_SEGMENT,e,t),this._pendingResolveSeekPoint!=null&&e===`video`)){var n=t.info.syncPoints,r=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,o.a.safari&&n.length>0&&n[0].originalDts===r&&(r=n[0].pts),this._emitter.emit(Xe.a.RECOMMEND_SEEKPOINT,r)}},e.prototype._enableStatisticsReporter=function(){this._statisticsReporter??=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)},e.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&=(self.clearInterval(this._statisticsReporter),null)},e.prototype._reportSegmentMediaInfo=function(e){var t=this._mediaInfo.segments[e],n=Object.assign({},t);n.duration=this._mediaInfo.duration,n.segmentCount=this._mediaInfo.segmentCount,delete n.segments,delete n.keyframesIndex,this._emitter.emit(Xe.a.MEDIA_INFO,n)},e.prototype._reportStatisticsInfo=function(){var e={};e.url=this._ioctl.currentURL,e.hasRedirect=this._ioctl.hasRedirect,e.hasRedirect&&(e.redirectedURL=this._ioctl.currentRedirectedURL),e.speed=this._ioctl.currentSpeed,e.loaderType=this._ioctl.loaderType,e.currentSegmentIndex=this._currentSegmentIndex,e.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(Xe.a.STATISTICS_INFO,e)},e}())},function(e,t,n){var r,i=n(0),a=function(){function e(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return e.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},e.prototype.addBytes=function(e){this._firstCheckpoint===0?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())},Object.defineProperty(e.prototype,`currentKBps`,{get:function(){this.addBytes(0);var e=(this._now()-this._lastCheckpoint)/1e3;return e==0&&(e=1),this._intervalBytes/e/1024},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`lastSecondKBps`,{get:function(){return this.addBytes(0),this._lastSecondBytes===0?this._now()-this._lastCheckpoint>=500?this.currentKBps:0:this._lastSecondBytes/1024},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`averageKBps`,{get:function(){var e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024},enumerable:!1,configurable:!0}),e}(),o=n(2),s=n(5),c=n(3),l=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}r(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),u=function(e){function t(t,n){var r=e.call(this,`fetch-stream-loader`)||this;return r.TAG=`FetchStreamLoader`,r._seekHandler=t,r._config=n,r._needStash=!0,r._requestAbort=!1,r._abortController=null,r._contentLength=null,r._receivedLength=0,r}return l(t,e),t.isSupported=function(){try{var e=s.a.msedge&&s.a.version.minor>=15048,t=!s.a.msedge||e;return self.fetch&&self.ReadableStream&&t}catch{return!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){var n=this;this._dataSource=e,this._range=t;var r=e.url;this._config.reuseRedirectedURL&&e.redirectedURL!=null&&(r=e.redirectedURL);var i=this._seekHandler.getConfig(r,t),a=new self.Headers;if(typeof i.headers==`object`){var s=i.headers;for(var l in s)s.hasOwnProperty(l)&&a.append(l,s[l])}var u={method:`GET`,headers:a,mode:`cors`,cache:`default`,referrerPolicy:`no-referrer-when-downgrade`};if(typeof this._config.headers==`object`)for(var l in this._config.headers)a.append(l,this._config.headers[l]);!1===e.cors&&(u.mode=`same-origin`),e.withCredentials&&(u.credentials=`include`),e.referrerPolicy&&(u.referrerPolicy=e.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,u.signal=this._abortController.signal),this._status=o.c.kConnecting,self.fetch(i.url,u).then((function(e){if(n._requestAbort)return n._status=o.c.kIdle,void e.body.cancel();if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==i.url&&n._onURLRedirect){var t=n._seekHandler.removeURLParameters(e.url);n._onURLRedirect(t)}var r=e.headers.get(`Content-Length`);return r!=null&&(n._contentLength=parseInt(r),n._contentLength!==0&&n._onContentLengthKnown&&n._onContentLengthKnown(n._contentLength)),n._pump.call(n,e.body.getReader())}if(n._status=o.c.kError,!n._onError)throw new c.d(`FetchStreamLoader: Http code invalid, `+e.status+` `+e.statusText);n._onError(o.b.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})})).catch((function(e){if(!n._abortController||!n._abortController.signal.aborted){if(n._status=o.c.kError,!n._onError)throw e;n._onError(o.b.EXCEPTION,{code:-1,msg:e.message})}}))},t.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==o.c.kBuffering||!s.a.chrome)&&this._abortController)try{this._abortController.abort()}catch{}},t.prototype._pump=function(e){var t=this;return e.read().then((function(n){if(n.done)if(t._contentLength!==null&&t._receivedLength<t._contentLength){t._status=o.c.kError;var r=o.b.EARLY_EOF,i={code:-1,msg:`Fetch stream meet Early-EOF`};if(!t._onError)throw new c.d(i.msg);t._onError(r,i)}else t._status=o.c.kComplete,t._onComplete&&t._onComplete(t._range.from,t._range.from+t._receivedLength-1);else{if(t._abortController&&t._abortController.signal.aborted)return void(t._status=o.c.kComplete);if(!0===t._requestAbort)return t._status=o.c.kComplete,e.cancel();t._status=o.c.kBuffering;var a=n.value.buffer,s=t._range.from+t._receivedLength;t._receivedLength+=a.byteLength,t._onDataArrival&&t._onDataArrival(a,s,t._receivedLength),t._pump(e)}})).catch((function(e){if(t._abortController&&t._abortController.signal.aborted)t._status=o.c.kComplete;else if(e.code!==11||!s.a.msedge){t._status=o.c.kError;var n=0,r=null;if(e.code!==19&&e.message!==`network error`||!(t._contentLength===null||t._contentLength!==null&&t._receivedLength<t._contentLength)?(n=o.b.EXCEPTION,r={code:e.code,msg:e.message}):(n=o.b.EARLY_EOF,r={code:e.code,msg:`Fetch stream meet Early-EOF`}),!t._onError)throw new c.d(r.msg);t._onError(n,r)}}))},t}(o.a),d=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),f=function(e){function t(t,n){var r=e.call(this,`xhr-moz-chunked-loader`)||this;return r.TAG=`MozChunkedLoader`,r._seekHandler=t,r._config=n,r._needStash=!0,r._xhr=null,r._requestAbort=!1,r._contentLength=null,r._receivedLength=0,r}return d(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open(`GET`,`https://example.com`,!0),e.responseType=`moz-chunked-arraybuffer`,e.responseType===`moz-chunked-arraybuffer`}catch(e){return i.a.w(`MozChunkedLoader`,e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&=(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,null),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){this._dataSource=e,this._range=t;var n=e.url;this._config.reuseRedirectedURL&&e.redirectedURL!=null&&(n=e.redirectedURL);var r=this._seekHandler.getConfig(n,t);this._requestURL=r.url;var i=this._xhr=new XMLHttpRequest;if(i.open(`GET`,r.url,!0),i.responseType=`moz-chunked-arraybuffer`,i.onreadystatechange=this._onReadyStateChange.bind(this),i.onprogress=this._onProgress.bind(this),i.onloadend=this._onLoadEnd.bind(this),i.onerror=this._onXhrError.bind(this),e.withCredentials&&(i.withCredentials=!0),typeof r.headers==`object`){var a=r.headers;for(var s in a)a.hasOwnProperty(s)&&i.setRequestHeader(s,a[s])}if(typeof this._config.headers==`object`)for(var s in a=this._config.headers,a)a.hasOwnProperty(s)&&i.setRequestHeader(s,a[s]);this._status=o.c.kConnecting,i.send()},t.prototype.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=o.c.kComplete},t.prototype._onReadyStateChange=function(e){var t=e.target;if(t.readyState===2){if(t.responseURL!=null&&t.responseURL!==this._requestURL&&this._onURLRedirect){var n=this._seekHandler.removeURLParameters(t.responseURL);this._onURLRedirect(n)}if(t.status!==0&&(t.status<200||t.status>299)){if(this._status=o.c.kError,!this._onError)throw new c.d(`MozChunkedLoader: Http code invalid, `+t.status+` `+t.statusText);this._onError(o.b.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=o.c.kBuffering}},t.prototype._onProgress=function(e){if(this._status!==o.c.kError){this._contentLength===null&&e.total!==null&&e.total!==0&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var t=e.target.response,n=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,n,this._receivedLength)}},t.prototype._onLoadEnd=function(e){!0===this._requestAbort?this._requestAbort=!1:this._status!==o.c.kError&&(this._status=o.c.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))},t.prototype._onXhrError=function(e){this._status=o.c.kError;var t=0,n=null;if(this._contentLength&&e.loaded<this._contentLength?(t=o.b.EARLY_EOF,n={code:-1,msg:`Moz-Chunked stream meet Early-Eof`}):(t=o.b.EXCEPTION,n={code:-1,msg:e.constructor.name+` `+e.type}),!this._onError)throw new c.d(n.msg);this._onError(t,n)},t}(o.a),p=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),m=(function(e){function t(t,n){var r=e.call(this,`xhr-msstream-loader`)||this;return r.TAG=`MSStreamLoader`,r._seekHandler=t,r._config=n,r._needStash=!0,r._xhr=null,r._reader=null,r._totalRange=null,r._currentRange=null,r._currentRequestURL=null,r._currentRedirectedURL=null,r._contentLength=null,r._receivedLength=0,r._bufferLimit=16777216,r._lastTimeBufferSize=0,r._isReconnecting=!1,r}p(t,e),t.isSupported=function(){try{if(self.MSStream===void 0||self.MSStreamReader===void 0)return!1;var e=new XMLHttpRequest;return e.open(`GET`,`https://example.com`,!0),e.responseType=`ms-stream`,e.responseType===`ms-stream`}catch(e){return i.a.w(`MSStreamLoader`,e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._reader&&=(this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,null),this._xhr&&=(this._xhr.onreadystatechange=null,null),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){this._internalOpen(e,t,!1)},t.prototype._internalOpen=function(e,t,n){this._dataSource=e,n?this._currentRange=t:this._totalRange=t;var r=e.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL==null?e.redirectedURL!=null&&(r=e.redirectedURL):r=this._currentRedirectedURL);var i=this._seekHandler.getConfig(r,t);this._currentRequestURL=i.url;var a=this._reader=new self.MSStreamReader;a.onprogress=this._msrOnProgress.bind(this),a.onload=this._msrOnLoad.bind(this),a.onerror=this._msrOnError.bind(this);var s=this._xhr=new XMLHttpRequest;if(s.open(`GET`,i.url,!0),s.responseType=`ms-stream`,s.onreadystatechange=this._xhrOnReadyStateChange.bind(this),s.onerror=this._xhrOnError.bind(this),e.withCredentials&&(s.withCredentials=!0),typeof i.headers==`object`){var c=i.headers;for(var l in c)c.hasOwnProperty(l)&&s.setRequestHeader(l,c[l])}if(typeof this._config.headers==`object`)for(var l in c=this._config.headers,c)c.hasOwnProperty(l)&&s.setRequestHeader(l,c[l]);this._isReconnecting?this._isReconnecting=!1:this._status=o.c.kConnecting,s.send()},t.prototype.abort=function(){this._internalAbort(),this._status=o.c.kComplete},t.prototype._internalAbort=function(){this._reader&&=(this._reader.readyState===1&&this._reader.abort(),this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,null),this._xhr&&=(this._xhr.abort(),this._xhr.onreadystatechange=null,null)},t.prototype._xhrOnReadyStateChange=function(e){var t=e.target;if(t.readyState===2)if(t.status>=200&&t.status<=299){if(this._status=o.c.kBuffering,t.responseURL!=null){var n=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&n!==this._currentRedirectedURL&&(this._currentRedirectedURL=n,this._onURLRedirect&&this._onURLRedirect(n))}var r=t.getResponseHeader(`Content-Length`);if(r!=null&&this._contentLength==null){var i=parseInt(r);i>0&&(this._contentLength=i,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength))}}else{if(this._status=o.c.kError,!this._onError)throw new c.d(`MSStreamLoader: Http code invalid, `+t.status+` `+t.statusText);this._onError(o.b.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else if(t.readyState===3&&t.status>=200&&t.status<=299){this._status=o.c.kBuffering;var a=t.response;this._reader.readAsArrayBuffer(a)}},t.prototype._xhrOnError=function(e){this._status=o.c.kError;var t=o.b.EXCEPTION,n={code:-1,msg:e.constructor.name+` `+e.type};if(!this._onError)throw new c.d(n.msg);this._onError(t,n)},t.prototype._msrOnProgress=function(e){var t=e.target.result;if(t!=null){var n=t.slice(this._lastTimeBufferSize);this._lastTimeBufferSize=t.byteLength;var r=this._totalRange.from+this._receivedLength;this._receivedLength+=n.byteLength,this._onDataArrival&&this._onDataArrival(n,r,this._receivedLength),t.byteLength>=this._bufferLimit&&(i.a.v(this.TAG,`MSStream buffer exceeded max size near ${r+n.byteLength}, reconnecting...`),this._doReconnectIfNeeded())}else this._doReconnectIfNeeded()},t.prototype._doReconnectIfNeeded=function(){if(this._contentLength==null||this._receivedLength<this._contentLength){this._isReconnecting=!0,this._lastTimeBufferSize=0,this._internalAbort();var e={from:this._totalRange.from+this._receivedLength,to:-1};this._internalOpen(this._dataSource,e,!0)}},t.prototype._msrOnLoad=function(e){this._status=o.c.kComplete,this._onComplete&&this._onComplete(this._totalRange.from,this._totalRange.from+this._receivedLength-1)},t.prototype._msrOnError=function(e){this._status=o.c.kError;var t=0,n=null;if(this._contentLength&&this._receivedLength<this._contentLength?(t=o.b.EARLY_EOF,n={code:-1,msg:`MSStream meet Early-Eof`}):(t=o.b.EARLY_EOF,n={code:-1,msg:e.constructor.name+` `+e.type}),!this._onError)throw new c.d(n.msg);this._onError(t,n)}}(o.a),function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}()),h=function(e){function t(t,n){var r=e.call(this,`xhr-range-loader`)||this;return r.TAG=`RangeLoader`,r._seekHandler=t,r._config=n,r._needStash=!1,r._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],r._currentChunkSizeKB=384,r._currentSpeedNormalized=0,r._zeroSpeedChunkCount=0,r._xhr=null,r._speedSampler=new a,r._requestAbort=!1,r._waitForTotalLength=!1,r._totalLengthReceived=!1,r._currentRequestURL=null,r._currentRedirectedURL=null,r._currentRequestRange=null,r._totalLength=null,r._contentLength=null,r._receivedLength=0,r._lastTimeLoaded=0,r}return m(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open(`GET`,`https://example.com`,!0),e.responseType=`arraybuffer`,e.responseType===`arraybuffer`}catch(e){return i.a.w(`RangeLoader`,e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&=(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,null),e.prototype.destroy.call(this)},Object.defineProperty(t.prototype,`currentSpeed`,{get:function(){return this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),t.prototype.open=function(e,t){this._dataSource=e,this._range=t,this._status=o.c.kConnecting;var n=!1;this._dataSource.filesize!=null&&this._dataSource.filesize!==0&&(n=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||n?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))},t.prototype._openSubRange=function(){var e=1024*this._currentChunkSizeKB,t=this._range.from+this._receivedLength,n=t+e;this._contentLength!=null&&n-this._range.from>=this._contentLength&&(n=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:n},this._internalOpen(this._dataSource,this._currentRequestRange)},t.prototype._internalOpen=function(e,t){this._lastTimeLoaded=0;var n=e.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL==null?e.redirectedURL!=null&&(n=e.redirectedURL):n=this._currentRedirectedURL);var r=this._seekHandler.getConfig(n,t);this._currentRequestURL=r.url;var i=this._xhr=new XMLHttpRequest;if(i.open(`GET`,r.url,!0),i.responseType=`arraybuffer`,i.onreadystatechange=this._onReadyStateChange.bind(this),i.onprogress=this._onProgress.bind(this),i.onload=this._onLoad.bind(this),i.onerror=this._onXhrError.bind(this),e.withCredentials&&(i.withCredentials=!0),typeof r.headers==`object`){var a=r.headers;for(var o in a)a.hasOwnProperty(o)&&i.setRequestHeader(o,a[o])}if(typeof this._config.headers==`object`)for(var o in a=this._config.headers,a)a.hasOwnProperty(o)&&i.setRequestHeader(o,a[o]);i.send()},t.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=o.c.kComplete},t.prototype._internalAbort=function(){this._xhr&&=(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),null)},t.prototype._onReadyStateChange=function(e){var t=e.target;if(t.readyState===2){if(t.responseURL!=null){var n=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&n!==this._currentRedirectedURL&&(this._currentRedirectedURL=n,this._onURLRedirect&&this._onURLRedirect(n))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=o.c.kBuffering}else{if(this._status=o.c.kError,!this._onError)throw new c.d(`RangeLoader: Http code invalid, `+t.status+` `+t.statusText);this._onError(o.b.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}},t.prototype._onProgress=function(e){if(this._status!==o.c.kError){if(this._contentLength===null){var t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;var n=e.total;this._internalAbort(),n!=null&n!==0&&(this._totalLength=n)}if(this._range.to===-1?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,t)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var r=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(r)}},t.prototype._normalizeSpeed=function(e){var t=this._chunkSizeKBList,n=t.length-1,r=0,i=0,a=n;if(e<t[0])return t[0];for(;i<=a;){if((r=i+Math.floor((a-i)/2))===n||e>=t[r]&&e<t[r+1])return t[r];t[r]<e?i=r+1:a=r-1}},t.prototype._onLoad=function(e){if(this._status!==o.c.kError)if(this._waitForTotalLength)this._waitForTotalLength=!1;else{this._lastTimeLoaded=0;var t=this._speedSampler.lastSecondKBps;if(t===0&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(t=this._speedSampler.currentKBps)),t!==0){var n=this._normalizeSpeed(t);this._currentSpeedNormalized!==n&&(this._currentSpeedNormalized=n,this._currentChunkSizeKB=n)}var r=e.target.response,i=this._range.from+this._receivedLength;this._receivedLength+=r.byteLength;var a=!1;this._contentLength!=null&&this._receivedLength<this._contentLength?this._openSubRange():a=!0,this._onDataArrival&&this._onDataArrival(r,i,this._receivedLength),a&&(this._status=o.c.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}},t.prototype._onXhrError=function(e){this._status=o.c.kError;var t=0,n=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=o.b.EARLY_EOF,n={code:-1,msg:`RangeLoader meet Early-Eof`}):(t=o.b.EXCEPTION,n={code:-1,msg:e.constructor.name+` `+e.type}),!this._onError)throw new c.d(n.msg);this._onError(t,n)},t}(o.a),g=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),_=function(e){function t(){var t=e.call(this,`websocket-loader`)||this;return t.TAG=`WebSocketLoader`,t._needStash=!0,t._ws=null,t._requestAbort=!1,t._receivedLength=0,t}return g(t,e),t.isSupported=function(){try{return self.WebSocket!==void 0}catch{return!1}},t.prototype.destroy=function(){this._ws&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e){try{var t=this._ws=new self.WebSocket(e.url);t.binaryType=`arraybuffer`,t.onopen=this._onWebSocketOpen.bind(this),t.onclose=this._onWebSocketClose.bind(this),t.onmessage=this._onWebSocketMessage.bind(this),t.onerror=this._onWebSocketError.bind(this),this._status=o.c.kConnecting}catch(e){this._status=o.c.kError;var n={code:e.code,msg:e.message};if(!this._onError)throw new c.d(n.msg);this._onError(o.b.EXCEPTION,n)}},t.prototype.abort=function(){var e=this._ws;!e||e.readyState!==0&&e.readyState!==1||(this._requestAbort=!0,e.close()),this._ws=null,this._status=o.c.kComplete},t.prototype._onWebSocketOpen=function(e){this._status=o.c.kBuffering},t.prototype._onWebSocketClose=function(e){!0===this._requestAbort?this._requestAbort=!1:(this._status=o.c.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1))},t.prototype._onWebSocketMessage=function(e){var t=this;if(e.data instanceof ArrayBuffer)this._dispatchArrayBuffer(e.data);else if(e.data instanceof Blob){var n=new FileReader;n.onload=function(){t._dispatchArrayBuffer(n.result)},n.readAsArrayBuffer(e.data)}else{this._status=o.c.kError;var r={code:-1,msg:`Unsupported WebSocket message type: `+e.data.constructor.name};if(!this._onError)throw new c.d(r.msg);this._onError(o.b.EXCEPTION,r)}},t.prototype._dispatchArrayBuffer=function(e){var t=e,n=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,n,this._receivedLength)},t.prototype._onWebSocketError=function(e){this._status=o.c.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new c.d(t.msg);this._onError(o.b.EXCEPTION,t)},t}(o.a),v=function(){function e(e){this._zeroStart=e||!1}return e.prototype.getConfig=function(e,t){var n={};if(t.from!==0||t.to!==-1){var r=void 0;r=t.to===-1?`bytes=${t.from.toString()}-`:`bytes=${t.from.toString()}-${t.to.toString()}`,n.Range=r}else this._zeroStart&&(n.Range=`bytes=0-`);return{url:e,headers:n}},e.prototype.removeURLParameters=function(e){return e},e}(),y=function(){function e(e,t){this._startName=e,this._endName=t}return e.prototype.getConfig=function(e,t){var n=e;if(t.from!==0||t.to!==-1){var r=!0;n.indexOf(`?`)===-1&&(n+=`?`,r=!1),r&&(n+=`&`),n+=`${this._startName}=${t.from.toString()}`,t.to!==-1&&(n+=`&${this._endName}=${t.to.toString()}`)}return{url:n,headers:{}}},e.prototype.removeURLParameters=function(e){var t=e.split(`?`)[0],n=void 0,r=e.indexOf(`?`);r!==-1&&(n=e.substring(r+1));var i=``;if(n!=null&&n.length>0)for(var a=n.split(`&`),o=0;o<a.length;o++){var s=a[o].split(`=`),c=o>0;s[0]!==this._startName&&s[0]!==this._endName&&(c&&(i+=`&`),i+=a[o])}return i.length===0?t:t+`?`+i},e}();t.a=function(){function e(e,t,n){this.TAG=`IOController`,this._config=t,this._extraData=n,this._stashInitialSize=65536,t.stashInitialSize!=null&&t.stashInitialSize>0&&(this._stashInitialSize=t.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=Math.max(this._stashSize,3145728),this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,!1===t.enableStashBuffer&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=e,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(e.url),this._refTotalLength=e.filesize?e.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new a,this._speedNormalizeList=[32,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return e.prototype.destroy=function(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null},e.prototype.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},e.prototype.isPaused=function(){return this._paused},Object.defineProperty(e.prototype,`status`,{get:function(){return this._loader.status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`extraData`,{get:function(){return this._extraData},set:function(e){this._extraData=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onDataArrival`,{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onSeeked`,{get:function(){return this._onSeeked},set:function(e){this._onSeeked=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onError`,{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onComplete`,{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onRedirect`,{get:function(){return this._onRedirect},set:function(e){this._onRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`onRecoveredEarlyEof`,{get:function(){return this._onRecoveredEarlyEof},set:function(e){this._onRecoveredEarlyEof=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`currentURL`,{get:function(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`hasRedirect`,{get:function(){return this._redirectedURL!=null||this._dataSource.redirectedURL!=null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`currentRedirectedURL`,{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`currentSpeed`,{get:function(){return this._loaderClass===h?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`loaderType`,{get:function(){return this._loader.type},enumerable:!1,configurable:!0}),e.prototype._selectSeekHandler=function(){var e=this._config;if(e.seekType===`range`)this._seekHandler=new v(this._config.rangeLoadZeroStart);else if(e.seekType===`param`)this._seekHandler=new y(e.seekParamStart||`bstart`,e.seekParamEnd||`bend`);else{if(e.seekType!==`custom`)throw new c.b(`Invalid seekType in config: ${e.seekType}`);if(typeof e.customSeekHandler!=`function`)throw new c.b(`Custom seekType specified in config but invalid customSeekHandler!`);this._seekHandler=new e.customSeekHandler}},e.prototype._selectLoader=function(){if(this._config.customLoader!=null)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=_;else if(u.isSupported())this._loaderClass=u;else if(f.isSupported())this._loaderClass=f;else{if(!h.isSupported())throw new c.d(`Your browser doesn't support xhr with arraybuffer responseType!`);this._loaderClass=h}},e.prototype._createLoader=function(){this._loader=new this._loaderClass(this._seekHandler,this._config),!1===this._loader.needStashBuffer&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)},e.prototype.open=function(e){this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),this._speedSampler.reset(),e||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},e.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},e.prototype.pause=function(){this.isWorking()&&(this._loader.abort(),this._stashUsed===0?this._resumeFrom=this._currentRange.to+1:(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1),this._stashUsed=0,this._stashByteStart=0,this._paused=!0)},e.prototype.resume=function(){if(this._paused){this._paused=!1;var e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}},e.prototype.seek=function(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)},e.prototype._internalSeek=function(e,t){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(t),this._loader.destroy(),this._loader=null;var n={from:e,to:-1};this._currentRange={from:n.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,n),this._onSeeked&&this._onSeeked()},e.prototype.updateUrl=function(e){if(!e||typeof e!=`string`||e.length===0)throw new c.b(`Url must be a non-empty string!`);this._dataSource.url=e},e.prototype._expandBuffer=function(e){for(var t=this._stashSize;t+1048576<e;)t*=2;if((t+=1048576)!==this._bufferSize){var n=new ArrayBuffer(t);if(this._stashUsed>0){var r=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(n,0,t).set(r,0)}this._stashBuffer=n,this._bufferSize=t}},e.prototype._normalizeSpeed=function(e){var t=this._speedNormalizeList,n=t.length-1,r=0,i=0,a=n;if(e<t[0])return t[0];for(;i<=a;){if((r=i+Math.floor((a-i)/2))===n||e>=t[r]&&e<t[r+1])return t[r];t[r]<e?i=r+1:a=r-1}},e.prototype._adjustStashSize=function(e){var t=0;(t=this._config.isLive?e/8:e<512?e:e>=512&&e<=1024?Math.floor(1.5*e):2*e)>8192&&(t=8192);var n=1024*t+1048576;this._bufferSize<n&&this._expandBuffer(n),this._stashSize=1024*t},e.prototype._dispatchChunks=function(e,t){return this._currentRange.to=t+e.byteLength-1,this._onDataArrival(e,t)},e.prototype._onURLRedirect=function(e){this._redirectedURL=e,this._onRedirect&&this._onRedirect(e)},e.prototype._onContentLengthKnown=function(e){e&&this._fullRequestFlag&&(this._totalLength=e,this._fullRequestFlag=!1)},e.prototype._onLoaderChunkArrival=function(e,t,n){if(!this._onDataArrival)throw new c.a(`IOController: No existing consumer (onDataArrival) callback!`);if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(e.byteLength);var r=this._speedSampler.lastSecondKBps;if(r!==0){var i=this._normalizeSpeed(r);this._speedNormalized!==i&&(this._speedNormalized=i,this._adjustStashSize(i))}if(this._enableStash)if(this._stashUsed===0&&this._stashByteStart===0&&(this._stashByteStart=t),this._stashUsed+e.byteLength<=this._stashSize)(s=new Uint8Array(this._stashBuffer,0,this._stashSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;else if(s=new Uint8Array(this._stashBuffer,0,this._bufferSize),this._stashUsed>0){var a=this._stashBuffer.slice(0,this._stashUsed);(l=this._dispatchChunks(a,this._stashByteStart))<a.byteLength?l>0&&(u=new Uint8Array(a,l),s.set(u,0),this._stashUsed=u.byteLength,this._stashByteStart+=l):(this._stashUsed=0,this._stashByteStart+=l),this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),s=new Uint8Array(this._stashBuffer,0,this._bufferSize)),s.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else (l=this._dispatchChunks(e,t))<e.byteLength&&((o=e.byteLength-l)>this._bufferSize&&(this._expandBuffer(o),s=new Uint8Array(this._stashBuffer,0,this._bufferSize)),s.set(new Uint8Array(e,l),0),this._stashUsed+=o,this._stashByteStart=t+l);else if(this._stashUsed===0){var o;(l=this._dispatchChunks(e,t))<e.byteLength&&((o=e.byteLength-l)>this._bufferSize&&this._expandBuffer(o),(s=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e,l),0),this._stashUsed+=o,this._stashByteStart=t+l)}else{var s,l;if(this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength),(s=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength,(l=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart))<this._stashUsed&&l>0){var u=new Uint8Array(this._stashBuffer,l);s.set(u,0)}this._stashUsed-=l,this._stashByteStart+=l}}},e.prototype._flushStashBuffer=function(e){if(this._stashUsed>0){var t=this._stashBuffer.slice(0,this._stashUsed),n=this._dispatchChunks(t,this._stashByteStart),r=t.byteLength-n;if(n<t.byteLength){if(!e){if(n>0){var a=new Uint8Array(this._stashBuffer,0,this._bufferSize),o=new Uint8Array(t,n);a.set(o,0),this._stashUsed=o.byteLength,this._stashByteStart+=n}return 0}i.a.w(this.TAG,`${r} bytes unconsumed data remain when flush buffer, dropped`)}return this._stashUsed=0,this._stashByteStart=0,r}return 0},e.prototype._onLoaderComplete=function(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},e.prototype._onLoaderError=function(e,t){switch(i.a.e(this.TAG,`Loader error, code = ${t.code}, msg = ${t.msg}`),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=o.b.UNRECOVERABLE_EARLY_EOF),e){case o.b.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var n=this._currentRange.to+1;n<this._totalLength&&(i.a.w(this.TAG,`Connection lost, trying reconnect...`),this._isEarlyEofReconnecting=!0,this._internalSeek(n,!1));return}e=o.b.UNRECOVERABLE_EARLY_EOF;break;case o.b.UNRECOVERABLE_EARLY_EOF:case o.b.CONNECTING_TIMEOUT:case o.b.HTTP_STATUS_CODE_INVALID:case o.b.EXCEPTION:}if(!this._onError)throw new c.d(`IOException: `+t.msg);this._onError(e,t)},e}()},function(e,t,n){var r=function(){function e(){}return e.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Object.assign=Object.assign||function(e){if(e==null)throw TypeError(`Cannot convert undefined or null to object`);for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(r!=null)for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])}return t},String.prototype.startsWith||Object.defineProperty(String.prototype,`startsWith`,{value:function(e,t){var n=t>0?0|t:0;return this.substring(n,n+e.length)===e}}),typeof self.Promise!=`function`&&n(21).polyfill()},e}();r.install(),t.a=r},function(e,t,n){var r=n(9),i=n.n(r),a=n(0),o=n(5),s=n(7),c=n(3);t.a=function(){function e(e){this.TAG=`MSEController`,this._config=e,this._emitter=new i.a,this._config.isLive&&this._config.autoCleanupSourceBuffer==null&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onStartStreaming:this._onStartStreaming.bind(this),onEndStreaming:this._onEndStreaming.bind(this),onQualityChange:this._onQualityChange.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._useManagedMediaSource=`ManagedMediaSource`in self&&!(`MediaSource`in self),this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElementProxy=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]}}return e.prototype.destroy=function(){this._mediaSource&&this.shutdown(),this._mediaSourceObjectURL&&this.revokeObjectURL(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.initialize=function(e){if(this._mediaSource)throw new c.a(`MediaSource has been attached to an HTMLMediaElement!`);this._useManagedMediaSource&&a.a.v(this.TAG,`Using ManagedMediaSource`);var t=this._mediaSource=this._useManagedMediaSource?new self.ManagedMediaSource:new self.MediaSource;t.addEventListener(`sourceopen`,this.e.onSourceOpen),t.addEventListener(`sourceended`,this.e.onSourceEnded),t.addEventListener(`sourceclose`,this.e.onSourceClose),this._useManagedMediaSource&&(t.addEventListener(`startstreaming`,this.e.onStartStreaming),t.addEventListener(`endstreaming`,this.e.onEndStreaming),t.addEventListener(`qualitychange`,this.e.onQualityChange)),this._mediaElementProxy=e},e.prototype.shutdown=function(){if(this._mediaSource){var e=this._mediaSource;for(var t in this._sourceBuffers){var n=this._pendingSegments[t];n.splice(0,n.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var r=this._sourceBuffers[t];if(r){if(e.readyState!==`closed`){try{e.removeSourceBuffer(r)}catch(e){a.a.e(this.TAG,e.message)}r.removeEventListener(`error`,this.e.onSourceBufferError),r.removeEventListener(`updateend`,this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if(e.readyState===`open`)try{e.endOfStream()}catch(e){a.a.e(this.TAG,e.message)}this._mediaElementProxy=null,e.removeEventListener(`sourceopen`,this.e.onSourceOpen),e.removeEventListener(`sourceended`,this.e.onSourceEnded),e.removeEventListener(`sourceclose`,this.e.onSourceClose),this._useManagedMediaSource&&(e.removeEventListener(`startstreaming`,this.e.onStartStreaming),e.removeEventListener(`endstreaming`,this.e.onEndStreaming),e.removeEventListener(`qualitychange`,this.e.onQualityChange)),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._mediaSource=null}},e.prototype.isManagedMediaSource=function(){return this._useManagedMediaSource},e.prototype.getObject=function(){if(!this._mediaSource)throw new c.a(`MediaSource has not been initialized yet!`);return this._mediaSource},e.prototype.getHandle=function(){if(!this._mediaSource)throw new c.a(`MediaSource has not been initialized yet!`);return this._mediaSource.handle},e.prototype.getObjectURL=function(){if(!this._mediaSource)throw new c.a(`MediaSource has not been initialized yet!`);return this._mediaSourceObjectURL??=URL.createObjectURL(this._mediaSource),this._mediaSourceObjectURL},e.prototype.revokeObjectURL=function(){this._mediaSourceObjectURL&&=(URL.revokeObjectURL(this._mediaSourceObjectURL),null)},e.prototype.appendInitSegment=function(e,t){if(t===void 0&&(t=void 0),!this._mediaSource||this._mediaSource.readyState!==`open`||!1===this._mediaSource.streaming)return this._pendingSourceBufferInit.push(e),void this._pendingSegments[e.type].push(e);var n=e,r=`${n.container}`;n.codec&&n.codec.length>0&&(n.codec===`opus`&&o.a.safari&&(n.codec=`Opus`),r+=`;codecs=${n.codec}`);var i=!1;if(a.a.v(this.TAG,`Received Initialization Segment, mimeType: `+r),this._lastInitSegments[n.type]=n,r!==this._mimeTypes[n.type]){if(this._mimeTypes[n.type])a.a.v(this.TAG,`Notice: ${n.type} mimeType changed, origin: ${this._mimeTypes[n.type]}, target: ${r}`);else{i=!0;try{var c=this._sourceBuffers[n.type]=this._mediaSource.addSourceBuffer(r);c.addEventListener(`error`,this.e.onSourceBufferError),c.addEventListener(`updateend`,this.e.onSourceBufferUpdateEnd)}catch(e){a.a.e(this.TAG,e.message),this._emitter.emit(s.a.ERROR,{code:e.code,msg:e.message});return}}this._mimeTypes[n.type]=r}t||this._pendingSegments[n.type].push(n),i||this._sourceBuffers[n.type]&&!this._sourceBuffers[n.type].updating&&this._doAppendSegments(),o.a.safari&&n.container===`audio/mpeg`&&n.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=n.mediaDuration/1e3,this._updateMediaSourceDuration())},e.prototype.appendMediaSegment=function(e){var t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var n=this._sourceBuffers[t.type];!n||n.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()},e.prototype.flush=function(){for(var e in this._sourceBuffers)if(this._sourceBuffers[e]){var t=this._sourceBuffers[e];if(this._mediaSource.readyState===`open`)try{t.abort()}catch(e){a.a.e(this.TAG,e.message)}var n=this._pendingSegments[e];if(n.splice(0,n.length),this._mediaSource.readyState!==`closed`){for(var r=0;r<t.buffered.length;r++){var i=t.buffered.start(r),s=t.buffered.end(r);this._pendingRemoveRanges[e].push({start:i,end:s})}if(t.updating||this._doRemoveRanges(),o.a.safari){var c=this._lastInitSegments[e];c&&(this._pendingSegments[e].push(c),t.updating||this._doAppendSegments())}}}},e.prototype.endOfStream=function(){var e=this._mediaSource,t=this._sourceBuffers;e&&e.readyState===`open`?t.video&&t.video.updating||t.audio&&t.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,e.endOfStream()):e&&e.readyState===`closed`&&this._hasPendingSegments()&&(this._hasPendingEos=!0)},e.prototype._needCleanupSourceBuffer=function(){if(!this._config.autoCleanupSourceBuffer)return!1;var e=this._mediaElementProxy.getCurrentTime();for(var t in this._sourceBuffers){var n=this._sourceBuffers[t];if(n){var r=n.buffered;if(r.length>=1&&e-r.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},e.prototype._doCleanupSourceBuffer=function(){var e=this._mediaElementProxy.getCurrentTime();for(var t in this._sourceBuffers){var n=this._sourceBuffers[t];if(n){for(var r=n.buffered,i=!1,a=0;a<r.length;a++){var o=r.start(a),s=r.end(a);if(o<=e&&e<s+3){if(e-o>=this._config.autoCleanupMaxBackwardDuration){i=!0;var c=e-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[t].push({start:o,end:c})}}else s<e&&(i=!0,this._pendingRemoveRanges[t].push({start:o,end:s}))}i&&!n.updating&&this._doRemoveRanges()}}},e.prototype._updateMediaSourceDuration=function(){var e=this._sourceBuffers;if(this._mediaElementProxy.getReadyState()!==0&&this._mediaSource.readyState===`open`&&!(e.video&&e.video.updating||e.audio&&e.audio.updating)){var t=this._mediaSource.duration,n=this._pendingMediaDuration;n>0&&(isNaN(t)||n>t)&&(a.a.v(this.TAG,`Update MediaSource duration from ${t} to ${n}`),this._mediaSource.duration=n),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},e.prototype._doRemoveRanges=function(){for(var e in this._pendingRemoveRanges)if(this._sourceBuffers[e]&&!this._sourceBuffers[e].updating)for(var t=this._sourceBuffers[e],n=this._pendingRemoveRanges[e];n.length&&!t.updating;){var r=n.shift();t.remove(r.start,r.end)}},e.prototype._doAppendSegments=function(){var e=this._pendingSegments;for(var t in e)if(this._sourceBuffers[t]&&!this._sourceBuffers[t].updating&&!1!==this._mediaSource.streaming&&e[t].length>0){var n=e[t].shift();if(typeof n.timestampOffset==`number`&&isFinite(n.timestampOffset)){var r=this._sourceBuffers[t].timestampOffset,i=n.timestampOffset/1e3;Math.abs(r-i)>.1&&(a.a.v(this.TAG,`Update MPEG audio timestampOffset from ${r} to ${i}`),this._sourceBuffers[t].timestampOffset=i),delete n.timestampOffset}if(!n.data||n.data.byteLength===0)continue;try{this._sourceBuffers[t].appendBuffer(n.data),this._isBufferFull=!1}catch(e){this._pendingSegments[t].unshift(n),e.code===22?(this._isBufferFull||this._emitter.emit(s.a.BUFFER_FULL),this._isBufferFull=!0):(a.a.e(this.TAG,e.message),this._emitter.emit(s.a.ERROR,{code:e.code,msg:e.message}))}}},e.prototype._onSourceOpen=function(){if(a.a.v(this.TAG,`MediaSource onSourceOpen`),this._mediaSource.removeEventListener(`sourceopen`,this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var e=this._pendingSourceBufferInit;e.length;){var t=e.shift();this.appendInitSegment(t,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(s.a.SOURCE_OPEN)},e.prototype._onStartStreaming=function(){a.a.v(this.TAG,`ManagedMediaSource onStartStreaming`),this._emitter.emit(s.a.START_STREAMING)},e.prototype._onEndStreaming=function(){a.a.v(this.TAG,`ManagedMediaSource onEndStreaming`),this._emitter.emit(s.a.END_STREAMING)},e.prototype._onQualityChange=function(){a.a.v(this.TAG,`ManagedMediaSource onQualityChange`)},e.prototype._onSourceEnded=function(){a.a.v(this.TAG,`MediaSource onSourceEnded`)},e.prototype._onSourceClose=function(){a.a.v(this.TAG,`MediaSource onSourceClose`),this._mediaSource&&this.e!=null&&(this._mediaSource.removeEventListener(`sourceopen`,this.e.onSourceOpen),this._mediaSource.removeEventListener(`sourceended`,this.e.onSourceEnded),this._mediaSource.removeEventListener(`sourceclose`,this.e.onSourceClose),this._useManagedMediaSource&&(this._mediaSource.removeEventListener(`startstreaming`,this.e.onStartStreaming),this._mediaSource.removeEventListener(`endstreaming`,this.e.onEndStreaming),this._mediaSource.removeEventListener(`qualitychange`,this.e.onQualityChange)))},e.prototype._hasPendingSegments=function(){var e=this._pendingSegments;return e.video.length>0||e.audio.length>0},e.prototype._hasPendingRemoveRanges=function(){var e=this._pendingRemoveRanges;return e.video.length>0||e.audio.length>0},e.prototype._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(s.a.UPDATE_END)},e.prototype._onSourceBufferError=function(e){a.a.e(this.TAG,`SourceBuffer Error: ${e}`)},e}()},function(e,t,n){var r=n(9),i=n.n(r),a=n(18),o=n.n(a),s=n(0),c=n(8),l=n(13),u=n(1),d=(n(19),n(12));t.a=function(){function e(e,t){if(this.TAG=`Transmuxer`,this._emitter=new i.a,t.enableWorker&&typeof Worker<`u`)try{this._worker=o()(19),this._workerDestroying=!1,this._worker.addEventListener(`message`,this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:`init`,param:[e,t]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},c.a.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:`logging_config`,param:c.a.getConfig()})}catch{s.a.e(this.TAG,`Error while initialize transmuxing worker, fallback to inline transmuxing`),this._worker=null,this._controller=new l.a(e,t)}else this._controller=new l.a(e,t);if(this._controller){var n=this._controller;n.on(u.a.IO_ERROR,this._onIOError.bind(this)),n.on(u.a.DEMUX_ERROR,this._onDemuxError.bind(this)),n.on(u.a.INIT_SEGMENT,this._onInitSegment.bind(this)),n.on(u.a.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),n.on(u.a.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),n.on(u.a.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),n.on(u.a.MEDIA_INFO,this._onMediaInfo.bind(this)),n.on(u.a.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),n.on(u.a.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),n.on(u.a.TIMED_ID3_METADATA_ARRIVED,this._onTimedID3MetadataArrived.bind(this)),n.on(u.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,this._onSynchronousKLVMetadataArrived.bind(this)),n.on(u.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,this._onAsynchronousKLVMetadataArrived.bind(this)),n.on(u.a.SMPTE2038_METADATA_ARRIVED,this._onSMPTE2038MetadataArrived.bind(this)),n.on(u.a.SCTE35_METADATA_ARRIVED,this._onSCTE35MetadataArrived.bind(this)),n.on(u.a.PES_PRIVATE_DATA_DESCRIPTOR,this._onPESPrivateDataDescriptor.bind(this)),n.on(u.a.PES_PRIVATE_DATA_ARRIVED,this._onPESPrivateDataArrived.bind(this)),n.on(u.a.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),n.on(u.a.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return e.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:`destroy`}),c.a.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.hasWorker=function(){return this._worker!=null},e.prototype.open=function(){this._worker?this._worker.postMessage({cmd:`start`}):this._controller.start()},e.prototype.close=function(){this._worker?this._worker.postMessage({cmd:`stop`}):this._controller.stop()},e.prototype.seek=function(e){this._worker?this._worker.postMessage({cmd:`seek`,param:e}):this._controller.seek(e)},e.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:`pause`}):this._controller.pause()},e.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:`resume`}):this._controller.resume()},e.prototype._onInitSegment=function(e,t){var n=this;Promise.resolve().then((function(){n._emitter.emit(u.a.INIT_SEGMENT,e,t)}))},e.prototype._onMediaSegment=function(e,t){var n=this;Promise.resolve().then((function(){n._emitter.emit(u.a.MEDIA_SEGMENT,e,t)}))},e.prototype._onLoadingComplete=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(u.a.LOADING_COMPLETE)}))},e.prototype._onRecoveredEarlyEof=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(u.a.RECOVERED_EARLY_EOF)}))},e.prototype._onMediaInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(u.a.MEDIA_INFO,e)}))},e.prototype._onMetaDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(u.a.METADATA_ARRIVED,e)}))},e.prototype._onScriptDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(u.a.SCRIPTDATA_ARRIVED,e)}))},e.prototype._onTimedID3MetadataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(u.a.TIMED_ID3_METADATA_ARRIVED,e)}))},e.prototype._onSynchronousKLVMetadataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(u.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,e)}))},e.prototype._onAsynchronousKLVMetadataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(u.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,e)}))},e.prototype._onSMPTE2038MetadataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(u.a.SMPTE2038_METADATA_ARRIVED,e)}))},e.prototype._onSCTE35MetadataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(u.a.SCTE35_METADATA_ARRIVED,e)}))},e.prototype._onPESPrivateDataDescriptor=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(u.a.PES_PRIVATE_DATA_DESCRIPTOR,e)}))},e.prototype._onPESPrivateDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(u.a.PES_PRIVATE_DATA_ARRIVED,e)}))},e.prototype._onStatisticsInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(u.a.STATISTICS_INFO,e)}))},e.prototype._onIOError=function(e,t){var n=this;Promise.resolve().then((function(){n._emitter.emit(u.a.IO_ERROR,e,t)}))},e.prototype._onDemuxError=function(e,t){var n=this;Promise.resolve().then((function(){n._emitter.emit(u.a.DEMUX_ERROR,e,t)}))},e.prototype._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(u.a.RECOMMEND_SEEKPOINT,e)}))},e.prototype._onLoggingConfigChanged=function(e){this._worker&&this._worker.postMessage({cmd:`logging_config`,param:e})},e.prototype._onWorkerMessage=function(e){var t=e.data,n=t.data;if(t.msg===`destroyed`||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case u.a.INIT_SEGMENT:case u.a.MEDIA_SEGMENT:this._emitter.emit(t.msg,n.type,n.data);break;case u.a.LOADING_COMPLETE:case u.a.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case u.a.MEDIA_INFO:Object.setPrototypeOf(n,d.a.prototype),this._emitter.emit(t.msg,n);break;case u.a.METADATA_ARRIVED:case u.a.SCRIPTDATA_ARRIVED:case u.a.TIMED_ID3_METADATA_ARRIVED:case u.a.SYNCHRONOUS_KLV_METADATA_ARRIVED:case u.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED:case u.a.SMPTE2038_METADATA_ARRIVED:case u.a.SCTE35_METADATA_ARRIVED:case u.a.PES_PRIVATE_DATA_DESCRIPTOR:case u.a.PES_PRIVATE_DATA_ARRIVED:case u.a.STATISTICS_INFO:this._emitter.emit(t.msg,n);break;case u.a.IO_ERROR:case u.a.DEMUX_ERROR:this._emitter.emit(t.msg,n.type,n.info);break;case u.a.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,n);break;case`logcat_callback`:s.a.emitter.emit(`log`,n.type,n.logcat)}},e}()},function(e,t,n){function r(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,`__esModule`,{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=`/`,n.oe=function(e){throw console.error(e),e};var r=n(n.s=ENTRY_MODULE);return r.default||r}function i(e){return(e+``).replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}function a(e,t,r){var a={};a[r]=[];var o=t.toString(),s=o.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return a;for(var c,l=s[1],u=RegExp(`(\\\\n|\\W)`+i(l)+`\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)`,`g`);c=u.exec(o);)c[3]!==`dll-reference`&&a[r].push(c[3]);for(u=RegExp(`\\(`+i(l)+`\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)`,`g`);c=u.exec(o);)e[c[2]]||(a[r].push(c[1]),e[c[2]]=n(c[1]).m),a[c[2]]=a[c[2]]||[],a[c[2]].push(c[4]);for(var d,f=Object.keys(a),p=0;p<f.length;p++)for(var m=0;m<a[f[p]].length;m++)d=a[f[p]][m],isNaN(1*d)||(a[f[p]][m]=1*a[f[p]][m]);return a}function o(e){return Object.keys(e).reduce((function(t,n){return t||e[n].length>0}),!1)}e.exports=function(e,t){t||={};var i={main:n.m},s=t.all?{main:Object.keys(i.main)}:function(e,t){for(var n={main:[t]},r={main:[]},i={main:{}};o(n);)for(var s=Object.keys(n),c=0;c<s.length;c++){var l=s[c],u=n[l].pop();if(i[l]=i[l]||{},!i[l][u]&&e[l][u]){i[l][u]=!0,r[l]=r[l]||[],r[l].push(u);for(var d=a(e,e[l][u],l),f=Object.keys(d),p=0;p<f.length;p++)n[f[p]]=n[f[p]]||[],n[f[p]]=n[f[p]].concat(d[f[p]])}}return r}(i,e),c=``;Object.keys(s).filter((function(e){return e!==`main`})).forEach((function(e){for(var t=0;s[e][t];)t++;s[e].push(t),i[e][t]=`(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })`,c=c+`var `+e+` = (`+r.toString().replace(`ENTRY_MODULE`,JSON.stringify(t))+`)({`+s[e].map((function(t){return JSON.stringify(t)+`: `+i[e][t].toString()})).join(`,`)+`});
|
|
3
3
|
`})),c=c+`new ((`+r.toString().replace(`ENTRY_MODULE`,JSON.stringify(e))+`)({`+s.main.map((function(e){return JSON.stringify(e)+`: `+i.main[e].toString()})).join(`,`)+`}))(self);`;var l=new self.Blob([c],{type:`text/javascript`});if(t.bare)return l;var u=(self.URL||self.webkitURL||self.mozURL||self.msURL).createObjectURL(l),d=new self.Worker(u);return d.objectURL=u,d}},function(e,t,n){n.r(t),n(0);var r=n(8),i=n(15),a=n(13),o=n(1);t.default=function(e){var t=null,n=function(t,n){e.postMessage({msg:`logcat_callback`,data:{type:t,logcat:n}})}.bind(this);function s(t,n){var r={msg:o.a.INIT_SEGMENT,data:{type:t,data:n}};e.postMessage(r,[n.data])}function c(t,n){var r={msg:o.a.MEDIA_SEGMENT,data:{type:t,data:n}};e.postMessage(r,[n.data])}function l(){var t={msg:o.a.LOADING_COMPLETE};e.postMessage(t)}function u(){var t={msg:o.a.RECOVERED_EARLY_EOF};e.postMessage(t)}function d(t){var n={msg:o.a.MEDIA_INFO,data:t};e.postMessage(n)}function f(t){var n={msg:o.a.METADATA_ARRIVED,data:t};e.postMessage(n)}function p(t){var n={msg:o.a.SCRIPTDATA_ARRIVED,data:t};e.postMessage(n)}function m(t){var n={msg:o.a.TIMED_ID3_METADATA_ARRIVED,data:t};e.postMessage(n)}function h(t){var n={msg:o.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,data:t};e.postMessage(n)}function g(t){var n={msg:o.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,data:t};e.postMessage(n)}function _(t){var n={msg:o.a.SMPTE2038_METADATA_ARRIVED,data:t};e.postMessage(n)}function v(t){var n={msg:o.a.SCTE35_METADATA_ARRIVED,data:t};e.postMessage(n)}function y(t){var n={msg:o.a.PES_PRIVATE_DATA_DESCRIPTOR,data:t};e.postMessage(n)}function b(t){var n={msg:o.a.PES_PRIVATE_DATA_ARRIVED,data:t};e.postMessage(n)}function x(t){var n={msg:o.a.STATISTICS_INFO,data:t};e.postMessage(n)}function S(t,n){e.postMessage({msg:o.a.IO_ERROR,data:{type:t,info:n}})}function C(t,n){e.postMessage({msg:o.a.DEMUX_ERROR,data:{type:t,info:n}})}function w(t){e.postMessage({msg:o.a.RECOMMEND_SEEKPOINT,data:t})}i.a.install(),e.addEventListener(`message`,(function(i){switch(i.data.cmd){case`init`:(t=new a.a(i.data.param[0],i.data.param[1])).on(o.a.IO_ERROR,S.bind(this)),t.on(o.a.DEMUX_ERROR,C.bind(this)),t.on(o.a.INIT_SEGMENT,s.bind(this)),t.on(o.a.MEDIA_SEGMENT,c.bind(this)),t.on(o.a.LOADING_COMPLETE,l.bind(this)),t.on(o.a.RECOVERED_EARLY_EOF,u.bind(this)),t.on(o.a.MEDIA_INFO,d.bind(this)),t.on(o.a.METADATA_ARRIVED,f.bind(this)),t.on(o.a.SCRIPTDATA_ARRIVED,p.bind(this)),t.on(o.a.TIMED_ID3_METADATA_ARRIVED,m.bind(this)),t.on(o.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,h.bind(this)),t.on(o.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,g.bind(this)),t.on(o.a.SMPTE2038_METADATA_ARRIVED,_.bind(this)),t.on(o.a.SCTE35_METADATA_ARRIVED,v.bind(this)),t.on(o.a.PES_PRIVATE_DATA_DESCRIPTOR,y.bind(this)),t.on(o.a.PES_PRIVATE_DATA_ARRIVED,b.bind(this)),t.on(o.a.STATISTICS_INFO,x.bind(this)),t.on(o.a.RECOMMEND_SEEKPOINT,w.bind(this));break;case`destroy`:t&&=(t.destroy(),null),e.postMessage({msg:`destroyed`});break;case`start`:t.start();break;case`stop`:t.stop();break;case`seek`:t.seek(i.data.param);break;case`pause`:t.pause();break;case`resume`:t.resume();break;case`logging_config`:var T=i.data.param;r.a.applyConfig(T),!0===T.enableCallback?r.a.addLogListener(n):r.a.removeLogListener(n)}}))}},function(e,t,n){e.exports=n(25).default},function(e,t,n){(function(t,n){e.exports=function(){function e(e){return typeof e==`function`}var r=Array.isArray?Array.isArray:function(e){return Object.prototype.toString.call(e)===`[object Array]`},i=0,a=void 0,o=void 0,s=function(e,t){m[i]=e,m[i+1]=t,(i+=2)===2&&(o?o(h):b())},c=typeof window<`u`?window:void 0,l=c||{},u=l.MutationObserver||l.WebKitMutationObserver,d=typeof self>`u`&&t!==void 0&&{}.toString.call(t)===`[object process]`,f=typeof Uint8ClampedArray<`u`&&typeof importScripts<`u`&&typeof MessageChannel<`u`;function p(){var e=setTimeout;return function(){return e(h,1)}}var m=Array(1e3);function h(){for(var e=0;e<i;e+=2)(0,m[e])(m[e+1]),m[e]=void 0,m[e+1]=void 0;i=0}var g,_,v,y,b=void 0;function x(e,t){var n=this,r=new this.constructor(w);r[C]===void 0&&P(r);var i=n._state;if(i){var a=arguments[i-1];s((function(){return M(i,r,a,n._result)}))}else A(n,r,e,t);return r}function S(e){if(e&&typeof e==`object`&&e.constructor===this)return e;var t=new this(w);return E(t,e),t}d?b=function(){return t.nextTick(h)}:u?(_=0,v=new u(h),y=document.createTextNode(``),v.observe(y,{characterData:!0}),b=function(){y.data=_=++_%2}):f?((g=new MessageChannel).port1.onmessage=h,b=function(){return g.port2.postMessage(0)}):b=c===void 0?function(){try{var e=Function(`return this`)().require(`vertx`);return(a=e.runOnLoop||e.runOnContext)===void 0?p():function(){a(h)}}catch{return p()}}():p();var C=Math.random().toString(36).substring(2);function w(){}function T(t,n,r){n.constructor===t.constructor&&r===x&&n.constructor.resolve===S?function(e,t){t._state===1?O(e,t._result):t._state===2?k(e,t._result):A(t,void 0,(function(t){return E(e,t)}),(function(t){return k(e,t)}))}(t,n):r===void 0?O(t,n):e(r)?function(e,t,n){s((function(e){var r=!1,i=function(e,t,n,r){try{e.call(t,n,r)}catch(e){return e}}(n,t,(function(n){r||(r=!0,t===n?O(e,n):E(e,n))}),(function(t){r||(r=!0,k(e,t))}),e._label);!r&&i&&(r=!0,k(e,i))}),e)}(t,n,r):O(t,n)}function E(e,t){if(e===t)k(e,TypeError(`You cannot resolve a promise with itself`));else if(i=typeof(r=t),r===null||i!==`object`&&i!==`function`)O(e,t);else{var n=void 0;try{n=t.then}catch(t){k(e,t);return}T(e,t,n)}var r,i}function D(e){e._onerror&&e._onerror(e._result),j(e)}function O(e,t){e._state===void 0&&(e._result=t,e._state=1,e._subscribers.length!==0&&s(j,e))}function k(e,t){e._state===void 0&&(e._state=2,e._result=t,s(D,e))}function A(e,t,n,r){var i=e._subscribers,a=i.length;e._onerror=null,i[a]=t,i[a+1]=n,i[a+2]=r,a===0&&e._state&&s(j,e)}function j(e){var t=e._subscribers,n=e._state;if(t.length!==0){for(var r=void 0,i=void 0,a=e._result,o=0;o<t.length;o+=3)r=t[o],i=t[o+n],r?M(n,r,i,a):i(a);e._subscribers.length=0}}function M(t,n,r,i){var a=e(r),o=void 0,s=void 0,c=!0;if(a){try{o=r(i)}catch(e){c=!1,s=e}if(n===o)return void k(n,TypeError(`A promises callback cannot return that same promise.`))}else o=i;n._state!==void 0||(a&&c?E(n,o):!1===c?k(n,s):t===1?O(n,o):t===2&&k(n,o))}var N=0;function P(e){e[C]=N++,e._state=void 0,e._result=void 0,e._subscribers=[]}var F=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(w),this.promise[C]||P(this.promise),r(t)?(this.length=t.length,this._remaining=t.length,this._result=Array(this.length),this.length===0?O(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),this._remaining===0&&O(this.promise,this._result))):k(this.promise,Error(`Array Methods must be provided an Array`))}return e.prototype._enumerate=function(e){for(var t=0;this._state===void 0&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===S){var i=void 0,a=void 0,o=!1;try{i=e.then}catch(e){o=!0,a=e}if(i===x&&e._state!==void 0)this._settledAt(e._state,t,e._result);else if(typeof i!=`function`)this._remaining--,this._result[t]=e;else if(n===I){var s=new n(w);o?k(s,a):T(s,e,i),this._willSettleAt(s,t)}else this._willSettleAt(new n((function(t){return t(e)})),t)}else this._willSettleAt(r(e),t)},e.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===void 0&&(this._remaining--,e===2?k(r,n):this._result[t]=n),this._remaining===0&&O(r,this._result)},e.prototype._willSettleAt=function(e,t){var n=this;A(e,void 0,(function(e){return n._settledAt(1,t,e)}),(function(e){return n._settledAt(2,t,e)}))},e}(),I=function(){function t(e){this[C]=N++,this._result=this._state=void 0,this._subscribers=[],w!==e&&(typeof e!=`function`&&function(){throw TypeError(`You must pass a resolver function as the first argument to the promise constructor`)}(),this instanceof t?function(e,t){try{t((function(t){E(e,t)}),(function(t){k(e,t)}))}catch(t){k(e,t)}}(this,e):function(){throw TypeError(`Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.`)}())}return t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var n=this.constructor;return e(t)?this.then((function(e){return n.resolve(t()).then((function(){return e}))}),(function(e){return n.resolve(t()).then((function(){throw e}))})):this.then(t,t)},t}();return I.prototype.then=x,I.all=function(e){return new F(this,e).promise},I.race=function(e){var t=this;return r(e)?new t((function(n,r){for(var i=e.length,a=0;a<i;a++)t.resolve(e[a]).then(n,r)})):new t((function(e,t){return t(TypeError(`You must pass an array to race.`))}))},I.resolve=S,I.reject=function(e){var t=new this(w);return k(t,e),t},I._setScheduler=function(e){o=e},I._setAsap=function(e){s=e},I._asap=s,I.polyfill=function(){var e=void 0;if(n!==void 0)e=n;else if(typeof self<`u`)e=self;else try{e=Function(`return this`)()}catch{throw Error(`polyfill failed because global object is unavailable in this environment`)}var t=e.Promise;if(t){var r=null;try{r=Object.prototype.toString.call(t.resolve())}catch{}if(r===`[object Promise]`&&!t.cast)return}e.Promise=I},I.Promise=I,I}()}).call(this,n(22),n(23))},function(e,t){var n,r,i=e.exports={};function a(){throw Error(`setTimeout has not been defined`)}function o(){throw Error(`clearTimeout has not been defined`)}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch{try{return n.call(null,e,0)}catch{return n.call(this,e,0)}}}(function(){try{n=typeof setTimeout==`function`?setTimeout:a}catch{n=a}try{r=typeof clearTimeout==`function`?clearTimeout:o}catch{r=o}})();var c,l=[],u=!1,d=-1;function f(){u&&c&&(u=!1,c.length?l=c.concat(l):d=-1,l.length&&p())}function p(){if(!u){var e=s(f);u=!0;for(var t=l.length;t;){for(c=l,l=[];++d<t;)c&&c[d].run();d=-1,t=l.length}c=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch{try{return r.call(null,e)}catch{return r.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function h(){}i.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new m(e,t)),l.length!==1||u||s(p)},m.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=h,i.addListener=h,i.once=h,i.off=h,i.removeListener=h,i.removeAllListeners=h,i.emit=h,i.prependListener=h,i.prependOnceListener=h,i.listeners=function(e){return[]},i.binding=function(e){throw Error(`process.binding is not supported`)},i.cwd=function(){return`/`},i.chdir=function(e){throw Error(`process.chdir is not supported`)},i.umask=function(){return 0}},function(e,t){var n=function(){return this}();try{n||=Function(`return this`)()}catch{typeof window==`object`&&(n=window)}e.exports=n},function(e,t,n){n.r(t);var r=n(0),i=n(8),a=n(3),o=n(7),s=n(16),c=n(17),l=n(1),u=n(4),d=n(10);t.default=function(e){var t=`PlayerEngineWorker`,n=function(t,n){e.postMessage({msg:`logcat_callback`,type:t,logcat:n})}.bind(void 0),f=null,p=null,m=null,h=null,g=!1,_=!1,v=0,y=0,b=!1;function x(){m&&=(m.shutdown(),m.destroy(),null)}function S(){if(f==null||p==null)throw new a.a(`Worker not initialized`);if(h)throw new a.a(`Transmuxer has been initialized`);_||(!p.deferLoadAfterSourceOpen||g?((h=new c.a(f,p)).on(l.a.INIT_SEGMENT,(function(e,t){m.appendInitSegment(t)})),h.on(l.a.MEDIA_SEGMENT,(function(t,n){m.appendMediaSegment(n),e.postMessage({msg:`buffered_position_changed`,buffered_position_milliseconds:n.info.endDts})})),h.on(l.a.LOADING_COMPLETE,(function(){m.endOfStream(),e.postMessage({msg:`player_event`,event:u.a.LOADING_COMPLETE})})),h.on(l.a.RECOVERED_EARLY_EOF,(function(){e.postMessage({msg:`player_event`,event:u.a.RECOVERED_EARLY_EOF})})),h.on(l.a.IO_ERROR,(function(t,n){e.postMessage({msg:`player_event`,event:u.a.ERROR,error_type:d.b.NETWORK_ERROR,error_detail:t,info:n})})),h.on(l.a.DEMUX_ERROR,(function(t,n){e.postMessage({msg:`player_event`,event:u.a.ERROR,error_type:d.b.MEDIA_ERROR,error_detail:t,info:n})})),h.on(l.a.MEDIA_INFO,(function(e){O(l.a.MEDIA_INFO,e)})),h.on(l.a.STATISTICS_INFO,(function(e){O(l.a.STATISTICS_INFO,e)})),h.on(l.a.RECOMMEND_SEEKPOINT,(function(t){(function(t){e.postMessage({msg:`transmuxing_event`,event:l.a.RECOMMEND_SEEKPOINT,milliseconds:t})})(t)})),h.on(l.a.METADATA_ARRIVED,(function(e){k(u.a.METADATA_ARRIVED,e)})),h.on(l.a.SCRIPTDATA_ARRIVED,(function(e){k(u.a.SCRIPTDATA_ARRIVED,e)})),h.on(l.a.TIMED_ID3_METADATA_ARRIVED,(function(e){k(u.a.TIMED_ID3_METADATA_ARRIVED,e)})),h.on(l.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,(function(e){k(u.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,e)})),h.on(l.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,(function(e){k(u.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,e)})),h.on(l.a.SMPTE2038_METADATA_ARRIVED,(function(e){k(u.a.SMPTE2038_METADATA_ARRIVED,e)})),h.on(l.a.SCTE35_METADATA_ARRIVED,(function(e){k(u.a.SCTE35_METADATA_ARRIVED,e)})),h.on(l.a.PES_PRIVATE_DATA_DESCRIPTOR,(function(e){k(u.a.PES_PRIVATE_DATA_DESCRIPTOR,e)})),h.on(l.a.PES_PRIVATE_DATA_ARRIVED,(function(e){k(u.a.PES_PRIVATE_DATA_ARRIVED,e)})),h.open()):_=!0)}function C(){m&&m.flush(),h&&=(h.close(),h.destroy(),null)}function w(){g=!0,_&&(_=!1,S())}function T(){e.postMessage({msg:`mse_event`,event:o.a.UPDATE_END})}function E(){r.a.v(t,`MSE SourceBuffer is full, report to main thread`),e.postMessage({msg:`mse_event`,event:o.a.BUFFER_FULL})}function D(t){e.postMessage({msg:`player_event`,event:u.a.ERROR,error_type:d.b.MEDIA_ERROR,error_detail:d.b.MEDIA_MSE_ERROR,info:t})}function O(t,n){e.postMessage({msg:`transmuxing_event`,event:t,info:n})}function k(t,n){e.postMessage({msg:`player_event`,event:t,extraData:n})}e.addEventListener(`message`,(function(a){if(!b){var c=a.data;switch(c.cmd){case`logging_config`:var l=c;i.a.applyConfig(l.logging_config),!0===l.logging_config.enableCallback?i.a.addLogListener(n):i.a.removeLogListener(n);break;case`init`:f=(l=c).media_data_source,p=l.config;break;case`destroy`:(function(){h&&C(),m&&x(),b=!0,e.postMessage({msg:`destroyed`})})();break;case`initialize_mse`:(function(){r.a.v(t,`Initializing MediaSource in DedicatedWorker`),(m=new s.a(p)).on(o.a.SOURCE_OPEN,w.bind(this)),m.on(o.a.UPDATE_END,T.bind(this)),m.on(o.a.BUFFER_FULL,E.bind(this)),m.on(o.a.ERROR,D.bind(this)),m.initialize({getCurrentTime:function(){return v},getReadyState:function(){return y}});var n=m.getHandle();e.postMessage({msg:`mse_init`,handle:n},[n])})();break;case`shutdown_mse`:x();break;case`load`:S();break;case`unload`:C();break;case`unbuffered_seek`:l=c,m.flush(),h.seek(l.milliseconds);break;case`timeupdate`:v=(l=c).current_time;break;case`readystatechange`:y=(l=c).ready_state;break;case`pause_transmuxer`:h.pause();break;case`resume_transmuxer`:h.resume()}}}))}},function(e,t,n){n.r(t);var r=n(15),i=n(14),a={enableWorker:!1,enableWorkerForMSE:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,liveBufferLatencyChasing:!1,liveBufferLatencyChasingOnPaused:!1,liveBufferLatencyMaxLatency:1.5,liveBufferLatencyMinRemain:.5,liveSync:!1,liveSyncMaxLatency:1.2,liveSyncTargetLatency:.8,liveSyncPlaybackRate:1.2,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:`range`,seekParamStart:`bstart`,seekParamEnd:`bend`,rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0};function o(){return Object.assign({},a)}var s=function(){function e(){}return e.supportMSEH264Playback=function(){var e=self.MediaSource&&self.MediaSource.isTypeSupported(`video/mp4; codecs="avc1.42E01E,mp4a.40.2"`),t=self.ManagedMediaSource&&self.ManagedMediaSource.isTypeSupported(`video/mp4; codecs="avc1.42E01E,mp4a.40.2"`);return e||t},e.supportMSEH265Playback=function(){var e=self.MediaSource&&self.MediaSource.isTypeSupported(`video/mp4; codecs="hvc1.1.6.L93.B0"`),t=self.ManagedMediaSource&&self.ManagedMediaSource.isTypeSupported(`video/mp4; codecs="hvc1.1.6.L93.B0"`);return e||t},e.supportNetworkStreamIO=function(){var e=new i.a({},o()),t=e.loaderType;return e.destroy(),t==`fetch-stream-loader`||t==`xhr-moz-chunked-loader`},e.getNetworkLoaderTypeName=function(){var e=new i.a({},o()),t=e.loaderType;return e.destroy(),t},e.supportNativeMediaPlayback=function(t){e.videoElement??=window.document.createElement(`video`);var n=e.videoElement.canPlayType(t);return n===`probably`||n==`maybe`},e.getFeatureList=function(){var t={msePlayback:!1,mseLivePlayback:!1,mseH265Playback:!1,networkStreamIO:!1,networkLoaderName:``,nativeMP4H264Playback:!1,nativeMP4H265Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.msePlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName(),t.mseLivePlayback=t.msePlayback&&t.networkStreamIO,t.mseH265Playback=e.supportMSEH265Playback(),t.nativeMP4H264Playback=e.supportNativeMediaPlayback(`video/mp4; codecs="avc1.42001E, mp4a.40.2"`),t.nativeMP4H265Playback=e.supportNativeMediaPlayback(`video/mp4; codecs="hvc1.1.6.L93.B0"`),t.nativeWebmVP8Playback=e.supportNativeMediaPlayback(`video/webm; codecs="vp8.0, vorbis"`),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback(`video/webm; codecs="vp9"`),t},e}(),c=n(2),l=n(0),u=n(9),d=n.n(u),f=n(16),p=n(4),m=n(17),h=n(7),g=n(10),_=n(3),v=n(1),y=n(5),b=n(11),x=function(){function e(e,t,n){this.TAG=`SeekingHandler`,this._config=null,this._media_element=null,this._always_seek_keyframe=!1,this._on_unbuffered_seek=null,this._request_set_current_time=!1,this._seek_request_record_clocktime=null,this._idr_sample_list=new b.a,this.e=null,this._config=e,this._media_element=t,this._on_unbuffered_seek=n,this.e={onMediaSeeking:this._onMediaSeeking.bind(this)},this._always_seek_keyframe=!!(y.a.chrome&&(y.a.version.major<50||y.a.version.major===50&&y.a.version.build<2661)||y.a.msedge||y.a.msie),this._always_seek_keyframe&&(this._config.accurateSeek=!1),this._media_element.addEventListener(`seeking`,this.e.onMediaSeeking)}return e.prototype.destroy=function(){this._idr_sample_list.clear(),this._idr_sample_list=null,this._media_element.removeEventListener(`seeking`,this.e.onMediaSeeking),this._media_element=null,this._on_unbuffered_seek=null},e.prototype.seek=function(e){var t=this._isPositionBuffered(e),n=!1;if(e<1&&this._media_element.buffered.length>0){var r=this._media_element.buffered.start(0);(r<1&&e<r||y.a.safari)&&(n=!0,e=y.a.safari?.1:r)}if(n)this.directSeek(e);else if(t)if(this._always_seek_keyframe){var i=this._getNearestKeyframe(Math.floor(1e3*e));i!=null&&(e=i.dts/1e3),this.directSeek(e)}else this.directSeek(e);else this._idr_sample_list.clear(),this._on_unbuffered_seek(Math.floor(1e3*e)),this._config.accurateSeek&&this.directSeek(e)},e.prototype.directSeek=function(e){this._request_set_current_time=!0,this._media_element.currentTime=e},e.prototype.appendSyncPoints=function(e){this._idr_sample_list.appendArray(e)},e.prototype._onMediaSeeking=function(t){if(this._request_set_current_time)this._request_set_current_time=!1;else{var n=this._media_element.currentTime,r=this._media_element.buffered;if(n<1&&r.length>0){var i=r.start(0);if(i<1&&n<i||y.a.safari){var a=y.a.safari?.1:i;this.directSeek(a);return}}if(this._isPositionBuffered(n)){if(this._always_seek_keyframe){var o=this._getNearestKeyframe(Math.floor(1e3*n));o!=null&&(n=o.dts/1e3,this.directSeek(n))}}else this._seek_request_record_clocktime=e._getClockTime(),window.setTimeout(this._pollAndApplyUnbufferedSeek.bind(this),50)}},e.prototype._pollAndApplyUnbufferedSeek=function(){if(this._seek_request_record_clocktime!=null)if(this._seek_request_record_clocktime<=e._getClockTime()-100){var t=this._media_element.currentTime;this._seek_request_record_clocktime=null,this._isPositionBuffered(t)||(this._idr_sample_list.clear(),this._on_unbuffered_seek(Math.floor(1e3*t)),this._config.accurateSeek&&this.directSeek(t))}else window.setTimeout(this._pollAndApplyUnbufferedSeek.bind(this),50)},e.prototype._isPositionBuffered=function(e){for(var t=this._media_element.buffered,n=0;n<t.length;n++){var r=t.start(n),i=t.end(n);if(e>=r&&e<i)return!0}return!1},e.prototype._getNearestKeyframe=function(e){return this._idr_sample_list.getLastSyncPointBeforeDts(e)},e._getClockTime=function(){return self.performance&&self.performance.now?self.performance.now():Date.now()},e}(),S=function(){function e(e,t,n,r){this.TAG=`LoadingController`,this._config=null,this._media_element=null,this._on_pause_transmuxer=null,this._on_resume_transmuxer=null,this._paused=!1,this.e=null,this._config=e,this._media_element=t,this._on_pause_transmuxer=n,this._on_resume_transmuxer=r,this.e={onMediaTimeUpdate:this._onMediaTimeUpdate.bind(this)}}return e.prototype.destroy=function(){this._media_element.removeEventListener(`timeupdate`,this.e.onMediaTimeUpdate),this.e=null,this._media_element=null,this._config=null,this._on_pause_transmuxer=null,this._on_resume_transmuxer=null},e.prototype.notifyBufferedPositionChanged=function(e){!this._config.isLive&&this._config.lazyLoad&&(e==null?this._suspendTransmuxerIfNeeded():this._suspendTransmuxerIfBufferedPositionExceeded(e))},e.prototype._onMediaTimeUpdate=function(e){this._paused&&this._resumeTransmuxerIfNeeded()},e.prototype._suspendTransmuxerIfNeeded=function(){for(var e=this._media_element.buffered,t=this._media_element.currentTime,n=0,r=0;r<e.length;r++){var i=e.start(r),a=e.end(r);if(i<=t&&t<a){n=a;break}}n>0&&this._suspendTransmuxerIfBufferedPositionExceeded(n)},e.prototype._suspendTransmuxerIfBufferedPositionExceeded=function(e){e>=this._media_element.currentTime+this._config.lazyLoadMaxDuration&&!this._paused&&(l.a.v(this.TAG,`Maximum buffering duration exceeded, suspend transmuxing task`),this.suspendTransmuxer(),this._media_element.addEventListener(`timeupdate`,this.e.onMediaTimeUpdate))},e.prototype.suspendTransmuxer=function(){this._paused=!0,this._on_pause_transmuxer()},e.prototype._resumeTransmuxerIfNeeded=function(){for(var e=this._media_element.buffered,t=this._media_element.currentTime,n=this._config.lazyLoadRecoverDuration,r=!1,i=0;i<e.length;i++){var a=e.start(i),o=e.end(i);if(t>=a&&t<o){t>=o-n&&(r=!0);break}}r&&(l.a.v(this.TAG,`Continue loading from paused position`),this.resumeTransmuxer(),this._media_element.removeEventListener(`timeupdate`,this.e.onMediaTimeUpdate))},e.prototype.resumeTransmuxer=function(){this._paused=!1,this._on_resume_transmuxer()},e}(),C=function(){function e(e,t){this.TAG=`StartupStallJumper`,this._media_element=null,this._on_direct_seek=null,this._canplay_received=!1,this.e=null,this._media_element=e,this._on_direct_seek=t,this.e={onMediaCanPlay:this._onMediaCanPlay.bind(this),onMediaStalled:this._onMediaStalled.bind(this),onMediaProgress:this._onMediaProgress.bind(this)},this._media_element.addEventListener(`canplay`,this.e.onMediaCanPlay),this._media_element.addEventListener(`stalled`,this.e.onMediaStalled),this._media_element.addEventListener(`progress`,this.e.onMediaProgress)}return e.prototype.destroy=function(){this._media_element.removeEventListener(`canplay`,this.e.onMediaCanPlay),this._media_element.removeEventListener(`stalled`,this.e.onMediaStalled),this._media_element.removeEventListener(`progress`,this.e.onMediaProgress),this._media_element=null,this._on_direct_seek=null},e.prototype._onMediaCanPlay=function(e){this._canplay_received=!0,this._media_element.removeEventListener(`canplay`,this.e.onMediaCanPlay)},e.prototype._onMediaStalled=function(e){this._detectAndFixStuckPlayback(!0)},e.prototype._onMediaProgress=function(e){this._detectAndFixStuckPlayback()},e.prototype._detectAndFixStuckPlayback=function(e){var t=this._media_element,n=t.buffered;e||!this._canplay_received||t.readyState<2?n.length>0&&t.currentTime<n.start(0)&&(l.a.w(this.TAG,`Playback seems stuck at ${t.currentTime}, seek to ${n.start(0)}`),this._on_direct_seek(n.start(0)),this._media_element.removeEventListener(`progress`,this.e.onMediaProgress)):this._media_element.removeEventListener(`progress`,this.e.onMediaProgress)},e}(),w=function(){function e(e,t,n){this._config=null,this._media_element=null,this._on_direct_seek=null,this._config=e,this._media_element=t,this._on_direct_seek=n}return e.prototype.destroy=function(){this._on_direct_seek=null,this._media_element=null,this._config=null},e.prototype.notifyBufferedRangeUpdate=function(){this._chaseLiveLatency()},e.prototype._chaseLiveLatency=function(){var e=this._media_element.buffered,t=this._media_element.currentTime,n=this._media_element.paused;if(this._config.isLive&&this._config.liveBufferLatencyChasing&&e.length!=0&&(this._config.liveBufferLatencyChasingOnPaused||!n)){var r=e.end(e.length-1);if(r>this._config.liveBufferLatencyMaxLatency&&r-t>this._config.liveBufferLatencyMaxLatency){var i=r-this._config.liveBufferLatencyMinRemain;this._on_direct_seek(i)}}},e}(),T=function(){function e(e,t){this._config=null,this._media_element=null,this.e=null,this._config=e,this._media_element=t,this.e={onMediaTimeUpdate:this._onMediaTimeUpdate.bind(this)},this._media_element.addEventListener(`timeupdate`,this.e.onMediaTimeUpdate)}return e.prototype.destroy=function(){this._media_element.removeEventListener(`timeupdate`,this.e.onMediaTimeUpdate),this._media_element=null,this._config=null},e.prototype._onMediaTimeUpdate=function(e){if(this._config.isLive&&this._config.liveSync){var t=this._getCurrentLatency();if(t>this._config.liveSyncMaxLatency){var n=Math.min(2,Math.max(1,this._config.liveSyncPlaybackRate));this._media_element.playbackRate=n}else t>this._config.liveSyncTargetLatency||this._media_element.playbackRate!==1&&this._media_element.playbackRate!==0&&(this._media_element.playbackRate=1)}},e.prototype._getCurrentLatency=function(){if(!this._media_element)return 0;var e=this._media_element.buffered,t=this._media_element.currentTime;return e.length==0?0:e.end(e.length-1)-t},e}(),E=function(){function e(e,t){this.TAG=`PlayerEngineMainThread`,this._emitter=new u,this._media_element=null,this._mse_controller=null,this._transmuxer=null,this._pending_seek_time=null,this._seeking_handler=null,this._loading_controller=null,this._startup_stall_jumper=null,this._live_latency_chaser=null,this._live_latency_synchronizer=null,this._mse_source_opened=!1,this._has_pending_load=!1,this._loaded_metadata_received=!1,this._media_info=null,this._statistics_info=null,this.e=null,this._media_data_source=e,this._config=o(),typeof t==`object`&&Object.assign(this._config,t),!0===e.isLive&&(this._config.isLive=!0),this.e={onMediaLoadedMetadata:this._onMediaLoadedMetadata.bind(this)}}return e.prototype.destroy=function(){this._emitter.emit(p.a.DESTROYING),this._transmuxer&&this.unload(),this._media_element&&this.detachMediaElement(),this.e=null,this._media_data_source=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var n=this;this._emitter.addListener(e,t),e===p.a.MEDIA_INFO&&this._media_info?Promise.resolve().then((function(){return n._emitter.emit(p.a.MEDIA_INFO,n.mediaInfo)})):e==p.a.STATISTICS_INFO&&this._statistics_info&&Promise.resolve().then((function(){return n._emitter.emit(p.a.STATISTICS_INFO,n.statisticsInfo)}))},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){var t=this;this._media_element=e,e.src=``,e.removeAttribute(`src`),e.srcObject=null,e.load(),e.addEventListener(`loadedmetadata`,this.e.onMediaLoadedMetadata),this._mse_controller=new f.a(this._config),this._mse_controller.on(h.a.UPDATE_END,this._onMSEUpdateEnd.bind(this)),this._mse_controller.on(h.a.BUFFER_FULL,this._onMSEBufferFull.bind(this)),this._mse_controller.on(h.a.SOURCE_OPEN,this._onMSESourceOpen.bind(this)),this._mse_controller.on(h.a.ERROR,this._onMSEError.bind(this)),this._mse_controller.on(h.a.START_STREAMING,this._onMSEStartStreaming.bind(this)),this._mse_controller.on(h.a.END_STREAMING,this._onMSEEndStreaming.bind(this)),this._mse_controller.initialize({getCurrentTime:function(){return t._media_element.currentTime},getReadyState:function(){return t._media_element.readyState}}),this._mse_controller.isManagedMediaSource()?(e.disableRemotePlayback=!0,e.srcObject=this._mse_controller.getObject()):e.src=this._mse_controller.getObjectURL()},e.prototype.detachMediaElement=function(){this._media_element&&(this._mse_controller.shutdown(),this._media_element.removeEventListener(`loadedmetadata`,this.e.onMediaLoadedMetadata),this._media_element.src=``,this._media_element.removeAttribute(`src`),this._media_element.srcObject=null,this._media_element.load(),this._media_element=null,this._mse_controller.revokeObjectURL()),this._mse_controller&&=(this._mse_controller.destroy(),null)},e.prototype.load=function(){var e=this;if(!this._media_element)throw new _.a(`HTMLMediaElement must be attached before load()!`);if(this._transmuxer)throw new _.a(`load() has been called, please call unload() first!`);this._has_pending_load||(!this._config.deferLoadAfterSourceOpen||this._mse_source_opened?(this._transmuxer=new m.a(this._media_data_source,this._config),this._transmuxer.on(v.a.INIT_SEGMENT,(function(t,n){e._mse_controller.appendInitSegment(n)})),this._transmuxer.on(v.a.MEDIA_SEGMENT,(function(t,n){e._mse_controller.appendMediaSegment(n),!e._config.isLive&&t===`video`&&n.data&&n.data.byteLength>0&&`info`in n&&e._seeking_handler.appendSyncPoints(n.info.syncPoints),e._loading_controller.notifyBufferedPositionChanged(n.info.endDts/1e3)})),this._transmuxer.on(v.a.LOADING_COMPLETE,(function(){e._mse_controller.endOfStream(),e._emitter.emit(p.a.LOADING_COMPLETE)})),this._transmuxer.on(v.a.RECOVERED_EARLY_EOF,(function(){e._emitter.emit(p.a.RECOVERED_EARLY_EOF)})),this._transmuxer.on(v.a.IO_ERROR,(function(t,n){e._emitter.emit(p.a.ERROR,g.b.NETWORK_ERROR,t,n)})),this._transmuxer.on(v.a.DEMUX_ERROR,(function(t,n){e._emitter.emit(p.a.ERROR,g.b.MEDIA_ERROR,t,n)})),this._transmuxer.on(v.a.MEDIA_INFO,(function(t){e._media_info=t,e._emitter.emit(p.a.MEDIA_INFO,Object.assign({},t))})),this._transmuxer.on(v.a.STATISTICS_INFO,(function(t){e._statistics_info=e._fillStatisticsInfo(t),e._emitter.emit(p.a.STATISTICS_INFO,Object.assign({},t))})),this._transmuxer.on(v.a.RECOMMEND_SEEKPOINT,(function(t){e._media_element&&!e._config.accurateSeek&&e._seeking_handler.directSeek(t/1e3)})),this._transmuxer.on(v.a.METADATA_ARRIVED,(function(t){e._emitter.emit(p.a.METADATA_ARRIVED,t)})),this._transmuxer.on(v.a.SCRIPTDATA_ARRIVED,(function(t){e._emitter.emit(p.a.SCRIPTDATA_ARRIVED,t)})),this._transmuxer.on(v.a.TIMED_ID3_METADATA_ARRIVED,(function(t){e._emitter.emit(p.a.TIMED_ID3_METADATA_ARRIVED,t)})),this._transmuxer.on(v.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,(function(t){e._emitter.emit(p.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,t)})),this._transmuxer.on(v.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,(function(t){e._emitter.emit(p.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,t)})),this._transmuxer.on(v.a.SMPTE2038_METADATA_ARRIVED,(function(t){e._emitter.emit(p.a.SMPTE2038_METADATA_ARRIVED,t)})),this._transmuxer.on(v.a.SCTE35_METADATA_ARRIVED,(function(t){e._emitter.emit(p.a.SCTE35_METADATA_ARRIVED,t)})),this._transmuxer.on(v.a.PES_PRIVATE_DATA_DESCRIPTOR,(function(t){e._emitter.emit(p.a.PES_PRIVATE_DATA_DESCRIPTOR,t)})),this._transmuxer.on(v.a.PES_PRIVATE_DATA_ARRIVED,(function(t){e._emitter.emit(p.a.PES_PRIVATE_DATA_ARRIVED,t)})),this._seeking_handler=new x(this._config,this._media_element,this._onRequiredUnbufferedSeek.bind(this)),this._loading_controller=new S(this._config,this._media_element,this._onRequestPauseTransmuxer.bind(this),this._onRequestResumeTransmuxer.bind(this)),this._startup_stall_jumper=new C(this._media_element,this._onRequestDirectSeek.bind(this)),this._config.isLive&&this._config.liveBufferLatencyChasing&&(this._live_latency_chaser=new w(this._config,this._media_element,this._onRequestDirectSeek.bind(this))),this._config.isLive&&this._config.liveSync&&(this._live_latency_synchronizer=new T(this._config,this._media_element)),this._media_element.readyState>0&&this._seeking_handler.directSeek(0),this._transmuxer.open()):this._has_pending_load=!0)},e.prototype.unload=function(){var e,t,n,r,i,a,o,s,c;(e=this._media_element)==null||e.pause(),(t=this._live_latency_synchronizer)==null||t.destroy(),this._live_latency_synchronizer=null,(n=this._live_latency_chaser)==null||n.destroy(),this._live_latency_chaser=null,(r=this._startup_stall_jumper)==null||r.destroy(),this._startup_stall_jumper=null,(i=this._loading_controller)==null||i.destroy(),this._loading_controller=null,(a=this._seeking_handler)==null||a.destroy(),this._seeking_handler=null,(o=this._mse_controller)==null||o.flush(),(s=this._transmuxer)==null||s.close(),(c=this._transmuxer)==null||c.destroy(),this._transmuxer=null},e.prototype.play=function(){return this._media_element.play()},e.prototype.pause=function(){this._media_element.pause()},e.prototype.seek=function(e){this._media_element&&this._seeking_handler?this._seeking_handler.seek(e):this._pending_seek_time=e},Object.defineProperty(e.prototype,`mediaInfo`,{get:function(){return Object.assign({},this._media_info)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`statisticsInfo`,{get:function(){return Object.assign({},this._statistics_info)},enumerable:!1,configurable:!0}),e.prototype._onMSESourceOpen=function(){this._mse_source_opened=!0,this._has_pending_load&&(this._has_pending_load=!1,this.load())},e.prototype._onMSEUpdateEnd=function(){this._config.isLive&&this._config.liveBufferLatencyChasing&&this._live_latency_chaser&&this._live_latency_chaser.notifyBufferedRangeUpdate(),this._loading_controller.notifyBufferedPositionChanged()},e.prototype._onMSEBufferFull=function(){l.a.v(this.TAG,`MSE SourceBuffer is full, suspend transmuxing task`),this._loading_controller.suspendTransmuxer()},e.prototype._onMSEError=function(e){this._emitter.emit(p.a.ERROR,g.b.MEDIA_ERROR,g.a.MEDIA_MSE_ERROR,e)},e.prototype._onMSEStartStreaming=function(){this._loaded_metadata_received&&(this._config.isLive||(l.a.v(this.TAG,`Resume transmuxing task due to ManagedMediaSource onStartStreaming`),this._loading_controller.resumeTransmuxer()))},e.prototype._onMSEEndStreaming=function(){this._config.isLive||(l.a.v(this.TAG,`Suspend transmuxing task due to ManagedMediaSource onEndStreaming`),this._loading_controller.suspendTransmuxer())},e.prototype._onMediaLoadedMetadata=function(e){this._loaded_metadata_received=!0,this._pending_seek_time!=null&&(this._seeking_handler.seek(this._pending_seek_time),this._pending_seek_time=null)},e.prototype._onRequestDirectSeek=function(e){this._seeking_handler.directSeek(e)},e.prototype._onRequiredUnbufferedSeek=function(e){this._mse_controller.flush(),this._transmuxer.seek(e)},e.prototype._onRequestPauseTransmuxer=function(){this._transmuxer.pause()},e.prototype._onRequestResumeTransmuxer=function(){this._transmuxer.resume()},e.prototype._fillStatisticsInfo=function(e){if(e.playerType=`MSEPlayer`,!(this._media_element instanceof HTMLVideoElement))return e;var t=!0,n=0,r=0;if(this._media_element.getVideoPlaybackQuality){var i=this._media_element.getVideoPlaybackQuality();n=i.totalVideoFrames,r=i.droppedVideoFrames}else this._media_element.webkitDecodedFrameCount==null?t=!1:(n=this._media_element.webkitDecodedFrameCount,r=this._media_element.webkitDroppedFrameCount);return t&&(e.decodedFrames=n,e.droppedFrames=r),e},e}(),D=n(18),O=n(8),k=function(){function e(e,t){this.TAG=`PlayerEngineDedicatedThread`,this._emitter=new u,this._media_element=null,this._worker_destroying=!1,this._seeking_handler=null,this._loading_controller=null,this._startup_stall_jumper=null,this._live_latency_chaser=null,this._live_latency_synchronizer=null,this._pending_seek_time=null,this._media_info=null,this._statistics_info=null,this.e=null,this._media_data_source=e,this._config=o(),typeof t==`object`&&Object.assign(this._config,t),!0===e.isLive&&(this._config.isLive=!0),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this),onMediaLoadedMetadata:this._onMediaLoadedMetadata.bind(this),onMediaTimeUpdate:this._onMediaTimeUpdate.bind(this),onMediaReadyStateChanged:this._onMediaReadyStateChange.bind(this)},O.a.registerListener(this.e.onLoggingConfigChanged),this._worker=D(24,{all:!0}),this._worker.addEventListener(`message`,this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:`init`,media_data_source:this._media_data_source,config:this._config}),this._worker.postMessage({cmd:`logging_config`,logging_config:O.a.getConfig()})}return e.isSupported=function(){return!!self.Worker&&(!(!self.MediaSource||!(`canConstructInDedicatedWorker`in self.MediaSource)||!0!==self.MediaSource.canConstructInDedicatedWorker)||!(!self.ManagedMediaSource||!(`canConstructInDedicatedWorker`in self.ManagedMediaSource)||!0!==self.ManagedMediaSource.canConstructInDedicatedWorker))},e.prototype.destroy=function(){this._emitter.emit(p.a.DESTROYING),this.unload(),this.detachMediaElement(),this._worker_destroying=!0,this._worker.postMessage({cmd:`destroy`}),O.a.removeListener(this.e.onLoggingConfigChanged),this.e=null,this._media_data_source=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var n=this;this._emitter.addListener(e,t),e===p.a.MEDIA_INFO&&this._media_info?Promise.resolve().then((function(){return n._emitter.emit(p.a.MEDIA_INFO,n.mediaInfo)})):e==p.a.STATISTICS_INFO&&this._statistics_info&&Promise.resolve().then((function(){return n._emitter.emit(p.a.STATISTICS_INFO,n.statisticsInfo)}))},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){this._media_element=e,this._media_element.src=``,this._media_element.removeAttribute(`src`),this._media_element.srcObject=null,this._media_element.load(),this._media_element.addEventListener(`loadedmetadata`,this.e.onMediaLoadedMetadata),this._media_element.addEventListener(`timeupdate`,this.e.onMediaTimeUpdate),this._media_element.addEventListener(`readystatechange`,this.e.onMediaReadyStateChanged),this._worker.postMessage({cmd:`initialize_mse`})},e.prototype.detachMediaElement=function(){this._worker.postMessage({cmd:`shutdown_mse`}),this._media_element&&=(this._media_element.removeEventListener(`loadedmetadata`,this.e.onMediaLoadedMetadata),this._media_element.removeEventListener(`timeupdate`,this.e.onMediaTimeUpdate),this._media_element.removeEventListener(`readystatechange`,this.e.onMediaReadyStateChanged),this._media_element.src=``,this._media_element.removeAttribute(`src`),this._media_element.srcObject=null,this._media_element.load(),null)},e.prototype.load=function(){this._worker.postMessage({cmd:`load`}),this._seeking_handler=new x(this._config,this._media_element,this._onRequiredUnbufferedSeek.bind(this)),this._loading_controller=new S(this._config,this._media_element,this._onRequestPauseTransmuxer.bind(this),this._onRequestResumeTransmuxer.bind(this)),this._startup_stall_jumper=new C(this._media_element,this._onRequestDirectSeek.bind(this)),this._config.isLive&&this._config.liveBufferLatencyChasing&&(this._live_latency_chaser=new w(this._config,this._media_element,this._onRequestDirectSeek.bind(this))),this._config.isLive&&this._config.liveSync&&(this._live_latency_synchronizer=new T(this._config,this._media_element)),this._media_element.readyState>0&&this._seeking_handler.directSeek(0)},e.prototype.unload=function(){var e,t,n,r,i,a;(e=this._media_element)==null||e.pause(),this._worker.postMessage({cmd:`unload`}),(t=this._live_latency_synchronizer)==null||t.destroy(),this._live_latency_synchronizer=null,(n=this._live_latency_chaser)==null||n.destroy(),this._live_latency_chaser=null,(r=this._startup_stall_jumper)==null||r.destroy(),this._startup_stall_jumper=null,(i=this._loading_controller)==null||i.destroy(),this._loading_controller=null,(a=this._seeking_handler)==null||a.destroy(),this._seeking_handler=null},e.prototype.play=function(){return this._media_element.play()},e.prototype.pause=function(){this._media_element.pause()},e.prototype.seek=function(e){this._media_element&&this._seeking_handler?this._seeking_handler.seek(e):this._pending_seek_time=e},Object.defineProperty(e.prototype,`mediaInfo`,{get:function(){return Object.assign({},this._media_info)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`statisticsInfo`,{get:function(){return Object.assign({},this._statistics_info)},enumerable:!1,configurable:!0}),e.prototype._onLoggingConfigChanged=function(e){var t;(t=this._worker)==null||t.postMessage({cmd:`logging_config`,logging_config:e})},e.prototype._onMSEUpdateEnd=function(){this._config.isLive&&this._config.liveBufferLatencyChasing&&this._live_latency_chaser&&this._live_latency_chaser.notifyBufferedRangeUpdate(),this._loading_controller.notifyBufferedPositionChanged()},e.prototype._onMSEBufferFull=function(){l.a.v(this.TAG,`MSE SourceBuffer is full, suspend transmuxing task`),this._loading_controller.suspendTransmuxer()},e.prototype._onMediaLoadedMetadata=function(e){this._pending_seek_time!=null&&(this._seeking_handler.seek(this._pending_seek_time),this._pending_seek_time=null)},e.prototype._onRequestDirectSeek=function(e){this._seeking_handler.directSeek(e)},e.prototype._onRequiredUnbufferedSeek=function(e){this._worker.postMessage({cmd:`unbuffered_seek`,milliseconds:e})},e.prototype._onRequestPauseTransmuxer=function(){this._worker.postMessage({cmd:`pause_transmuxer`})},e.prototype._onRequestResumeTransmuxer=function(){this._worker.postMessage({cmd:`resume_transmuxer`})},e.prototype._onMediaTimeUpdate=function(e){this._worker.postMessage({cmd:`timeupdate`,current_time:e.target.currentTime})},e.prototype._onMediaReadyStateChange=function(e){this._worker.postMessage({cmd:`readystatechange`,ready_state:e.target.readyState})},e.prototype._onWorkerMessage=function(e){var t,n=e.data,r=n.msg;if(r==`destroyed`||this._worker_destroying)return this._worker_destroying=!1,(t=this._worker)==null||t.terminate(),void(this._worker=null);switch(r){case`mse_init`:var i=n;`ManagedMediaSource`in self&&!(`MediaSource`in self)&&(this._media_element.disableRemotePlayback=!0),this._media_element.srcObject=i.handle;break;case`mse_event`:(i=n).event==h.a.UPDATE_END?this._onMSEUpdateEnd():i.event==h.a.BUFFER_FULL&&this._onMSEBufferFull();break;case`transmuxing_event`:if((i=n).event==v.a.MEDIA_INFO){var a=n;this._media_info=a.info,this._emitter.emit(p.a.MEDIA_INFO,Object.assign({},a.info))}else if(i.event==v.a.STATISTICS_INFO){var o=n;this._statistics_info=this._fillStatisticsInfo(o.info),this._emitter.emit(p.a.STATISTICS_INFO,Object.assign({},o.info))}else if(i.event==v.a.RECOMMEND_SEEKPOINT){var s=n;this._media_element&&!this._config.accurateSeek&&this._seeking_handler.directSeek(s.milliseconds/1e3)}break;case`player_event`:if((i=n).event==p.a.ERROR){var c=n;this._emitter.emit(p.a.ERROR,c.error_type,c.error_detail,c.info)}else if(`extraData`in i){var u=n;this._emitter.emit(u.event,u.extraData)}break;case`logcat_callback`:i=n,l.a.emitter.emit(`log`,i.type,i.logcat);break;case`buffered_position_changed`:i=n,this._loading_controller.notifyBufferedPositionChanged(i.buffered_position_milliseconds/1e3)}},e.prototype._fillStatisticsInfo=function(e){if(e.playerType=`MSEPlayer`,!(this._media_element instanceof HTMLVideoElement))return e;var t=!0,n=0,r=0;if(this._media_element.getVideoPlaybackQuality){var i=this._media_element.getVideoPlaybackQuality();n=i.totalVideoFrames,r=i.droppedVideoFrames}else this._media_element.webkitDecodedFrameCount==null?t=!1:(n=this._media_element.webkitDecodedFrameCount,r=this._media_element.webkitDroppedFrameCount);return t&&(e.decodedFrames=n,e.droppedFrames=r),e},e}(),A=function(){function e(e,t){this.TAG=`MSEPlayer`,this._type=`MSEPlayer`,this._media_element=null,this._player_engine=null;var n=e.type.toLowerCase();if(n!==`mse`&&n!==`mpegts`&&n!==`m2ts`&&n!==`flv`)throw new _.b(`MSEPlayer requires an mpegts/m2ts/flv MediaDataSource input!`);if(t&&t.enableWorkerForMSE&&k.isSupported())try{this._player_engine=new k(e,t)}catch{l.a.e(this.TAG,`Error while initializing PlayerEngineDedicatedThread, fallback to PlayerEngineMainThread`),this._player_engine=new E(e,t)}else this._player_engine=new E(e,t)}return e.prototype.destroy=function(){this._player_engine.destroy(),this._player_engine=null,this._media_element=null},e.prototype.on=function(e,t){this._player_engine.on(e,t)},e.prototype.off=function(e,t){this._player_engine.off(e,t)},e.prototype.attachMediaElement=function(e){this._media_element=e,this._player_engine.attachMediaElement(e)},e.prototype.detachMediaElement=function(){this._media_element=null,this._player_engine.detachMediaElement()},e.prototype.load=function(){this._player_engine.load()},e.prototype.unload=function(){this._player_engine.unload()},e.prototype.play=function(){return this._player_engine.play()},e.prototype.pause=function(){this._player_engine.pause()},Object.defineProperty(e.prototype,`type`,{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`buffered`,{get:function(){return this._media_element.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`duration`,{get:function(){return this._media_element.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`volume`,{get:function(){return this._media_element.volume},set:function(e){this._media_element.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`muted`,{get:function(){return this._media_element.muted},set:function(e){this._media_element.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`currentTime`,{get:function(){return this._media_element?this._media_element.currentTime:0},set:function(e){this._player_engine.seek(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`mediaInfo`,{get:function(){return this._player_engine.mediaInfo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`statisticsInfo`,{get:function(){return this._player_engine.statisticsInfo},enumerable:!1,configurable:!0}),e}(),j=function(){function e(e,t){this.TAG=`NativePlayer`,this._type=`NativePlayer`,this._emitter=new d.a,this._config=o(),typeof t==`object`&&Object.assign(this._config,t);var n=e.type.toLowerCase();if(n===`mse`||n===`mpegts`||n===`m2ts`||n===`flv`)throw new _.b(`NativePlayer does't support mse/mpegts/m2ts/flv MediaDataSource input!`);if(e.hasOwnProperty(`segments`))throw new _.b(`NativePlayer(${e.type}) doesn't support multipart playback!`);this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=e,this._mediaElement=null}return e.prototype.destroy=function(){this._emitter.emit(p.a.DESTROYING),this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var n=this;e===p.a.MEDIA_INFO?this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then((function(){n._emitter.emit(p.a.MEDIA_INFO,n.mediaInfo)})):e===p.a.STATISTICS_INFO&&this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then((function(){n._emitter.emit(p.a.STATISTICS_INFO,n.statisticsInfo)})),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaElement=e,e.addEventListener(`loadedmetadata`,this.e.onvLoadedMetadata),this._pendingSeekTime!=null)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch{}},e.prototype.detachMediaElement=function(){this._mediaElement&&=(this._mediaElement.src=``,this._mediaElement.removeAttribute(`src`),this._mediaElement.removeEventListener(`loadedmetadata`,this.e.onvLoadedMetadata),null),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.load=function(){if(!this._mediaElement)throw new _.a(`HTMLMediaElement must be attached before load()!`);this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload=`auto`,this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)},e.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src=``,this._mediaElement.removeAttribute(`src`)),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.play=function(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,`type`,{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`buffered`,{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`duration`,{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`volume`,{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`muted`,{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`currentTime`,{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._mediaElement.currentTime=e:this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`mediaInfo`,{get:function(){var e={mimeType:(this._mediaElement instanceof HTMLAudioElement?`audio/`:`video/`)+this._mediaDataSource.type};return this._mediaElement&&(e.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(e.width=this._mediaElement.videoWidth,e.height=this._mediaElement.videoHeight)),e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`statisticsInfo`,{get:function(){var e={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,n=0,r=0;if(this._mediaElement.getVideoPlaybackQuality){var i=this._mediaElement.getVideoPlaybackQuality();n=i.totalVideoFrames,r=i.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount==null?t=!1:(n=this._mediaElement.webkitDecodedFrameCount,r=this._mediaElement.webkitDroppedFrameCount);return t&&(e.decodedFrames=n,e.droppedFrames=r),e},enumerable:!1,configurable:!0}),e.prototype._onvLoadedMetadata=function(e){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(p.a.MEDIA_INFO,this.mediaInfo)},e.prototype._reportStatisticsInfo=function(){this._emitter.emit(p.a.STATISTICS_INFO,this.statisticsInfo)},e}();r.a.install();var M={createPlayer:function(e,t){var n=e;if(typeof n!=`object`||!n)throw new _.b(`MediaDataSource must be an javascript object!`);if(!n.hasOwnProperty(`type`))throw new _.b(`MediaDataSource must has type field to indicate video file type!`);switch(n.type){case`mse`:case`mpegts`:case`m2ts`:case`flv`:return new A(n,t);default:return new j(n,t)}},isSupported:function(){return s.supportMSEH264Playback()},getFeatureList:function(){return s.getFeatureList()}};M.BaseLoader=c.a,M.LoaderStatus=c.c,M.LoaderErrors=c.b,M.Events=p.a,M.ErrorTypes=g.b,M.ErrorDetails=g.a,M.MSEPlayer=A,M.NativePlayer=j,M.LoggingControl=O.a,Object.defineProperty(M,`version`,{enumerable:!0,get:function(){return`1.8.0`}}),t.default=M}])}))}))()),f=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},p=f({__name:`index`,props:{url:{type:String,default:``}},setup(e){let n=e;(0,t.watch)(()=>n.url,e=>{(0,t.nextTick)(()=>{e?a():o()})},{immediate:!0});let r=null,i=(0,t.ref)(),a=()=>{d.default.isSupported()&&(r=d.default.createPlayer({type:`flv`,url:n.url},{cors:!0}),r.attachMediaElement(i.value),r.load(),r.play())},o=()=>{r&&=(r.pause(),r.unload(),r.detachMediaElement(),r.destroy(),null)};return(0,t.onUnmounted)(()=>{o()}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`video`,{class:`com-full`,autoplay:``,controls:``,ref_key:`videoRef`,ref:i,muted:``},null,512))}},[[`__scopeId`,`data-v-86c157c1`]]),m=Number.isFinite||function(e){return typeof e==`number`&&isFinite(e)},h=Number.isSafeInteger||function(e){return typeof e==`number`&&Math.abs(e)<=g},g=2**53-1||9007199254740991,_=function(e){return e.NETWORK_ERROR=`networkError`,e.MEDIA_ERROR=`mediaError`,e.KEY_SYSTEM_ERROR=`keySystemError`,e.MUX_ERROR=`muxError`,e.OTHER_ERROR=`otherError`,e}({}),v=function(e){return e.KEY_SYSTEM_NO_KEYS=`keySystemNoKeys`,e.KEY_SYSTEM_NO_ACCESS=`keySystemNoAccess`,e.KEY_SYSTEM_NO_SESSION=`keySystemNoSession`,e.KEY_SYSTEM_NO_CONFIGURED_LICENSE=`keySystemNoConfiguredLicense`,e.KEY_SYSTEM_LICENSE_REQUEST_FAILED=`keySystemLicenseRequestFailed`,e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED=`keySystemServerCertificateRequestFailed`,e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED=`keySystemServerCertificateUpdateFailed`,e.KEY_SYSTEM_SESSION_UPDATE_FAILED=`keySystemSessionUpdateFailed`,e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED=`keySystemStatusOutputRestricted`,e.KEY_SYSTEM_STATUS_INTERNAL_ERROR=`keySystemStatusInternalError`,e.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR=`keySystemDestroyMediaKeysError`,e.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR=`keySystemDestroyCloseSessionError`,e.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR=`keySystemDestroyRemoveSessionError`,e.MANIFEST_LOAD_ERROR=`manifestLoadError`,e.MANIFEST_LOAD_TIMEOUT=`manifestLoadTimeOut`,e.MANIFEST_PARSING_ERROR=`manifestParsingError`,e.MANIFEST_INCOMPATIBLE_CODECS_ERROR=`manifestIncompatibleCodecsError`,e.LEVEL_EMPTY_ERROR=`levelEmptyError`,e.LEVEL_LOAD_ERROR=`levelLoadError`,e.LEVEL_LOAD_TIMEOUT=`levelLoadTimeOut`,e.LEVEL_PARSING_ERROR=`levelParsingError`,e.LEVEL_SWITCH_ERROR=`levelSwitchError`,e.AUDIO_TRACK_LOAD_ERROR=`audioTrackLoadError`,e.AUDIO_TRACK_LOAD_TIMEOUT=`audioTrackLoadTimeOut`,e.SUBTITLE_LOAD_ERROR=`subtitleTrackLoadError`,e.SUBTITLE_TRACK_LOAD_TIMEOUT=`subtitleTrackLoadTimeOut`,e.FRAG_LOAD_ERROR=`fragLoadError`,e.FRAG_LOAD_TIMEOUT=`fragLoadTimeOut`,e.FRAG_DECRYPT_ERROR=`fragDecryptError`,e.FRAG_PARSING_ERROR=`fragParsingError`,e.FRAG_GAP=`fragGap`,e.REMUX_ALLOC_ERROR=`remuxAllocError`,e.KEY_LOAD_ERROR=`keyLoadError`,e.KEY_LOAD_TIMEOUT=`keyLoadTimeOut`,e.BUFFER_ADD_CODEC_ERROR=`bufferAddCodecError`,e.BUFFER_INCOMPATIBLE_CODECS_ERROR=`bufferIncompatibleCodecsError`,e.BUFFER_APPEND_ERROR=`bufferAppendError`,e.BUFFER_APPENDING_ERROR=`bufferAppendingError`,e.BUFFER_STALLED_ERROR=`bufferStalledError`,e.BUFFER_FULL_ERROR=`bufferFullError`,e.BUFFER_SEEK_OVER_HOLE=`bufferSeekOverHole`,e.BUFFER_NUDGE_ON_STALL=`bufferNudgeOnStall`,e.ASSET_LIST_LOAD_ERROR=`assetListLoadError`,e.ASSET_LIST_LOAD_TIMEOUT=`assetListLoadTimeout`,e.ASSET_LIST_PARSING_ERROR=`assetListParsingError`,e.INTERSTITIAL_ASSET_ITEM_ERROR=`interstitialAssetItemError`,e.INTERNAL_EXCEPTION=`internalException`,e.INTERNAL_ABORTED=`aborted`,e.ATTACH_MEDIA_ERROR=`attachMediaError`,e.UNKNOWN=`unknown`,e}({}),y=function(e){return e.MEDIA_ATTACHING=`hlsMediaAttaching`,e.MEDIA_ATTACHED=`hlsMediaAttached`,e.MEDIA_DETACHING=`hlsMediaDetaching`,e.MEDIA_DETACHED=`hlsMediaDetached`,e.MEDIA_ENDED=`hlsMediaEnded`,e.STALL_RESOLVED=`hlsStallResolved`,e.BUFFER_RESET=`hlsBufferReset`,e.BUFFER_CODECS=`hlsBufferCodecs`,e.BUFFER_CREATED=`hlsBufferCreated`,e.BUFFER_APPENDING=`hlsBufferAppending`,e.BUFFER_APPENDED=`hlsBufferAppended`,e.BUFFER_EOS=`hlsBufferEos`,e.BUFFERED_TO_END=`hlsBufferedToEnd`,e.BUFFER_FLUSHING=`hlsBufferFlushing`,e.BUFFER_FLUSHED=`hlsBufferFlushed`,e.MANIFEST_LOADING=`hlsManifestLoading`,e.MANIFEST_LOADED=`hlsManifestLoaded`,e.MANIFEST_PARSED=`hlsManifestParsed`,e.LEVEL_SWITCHING=`hlsLevelSwitching`,e.LEVEL_SWITCHED=`hlsLevelSwitched`,e.LEVEL_LOADING=`hlsLevelLoading`,e.LEVEL_LOADED=`hlsLevelLoaded`,e.LEVEL_UPDATED=`hlsLevelUpdated`,e.LEVEL_PTS_UPDATED=`hlsLevelPtsUpdated`,e.LEVELS_UPDATED=`hlsLevelsUpdated`,e.AUDIO_TRACKS_UPDATED=`hlsAudioTracksUpdated`,e.AUDIO_TRACK_SWITCHING=`hlsAudioTrackSwitching`,e.AUDIO_TRACK_SWITCHED=`hlsAudioTrackSwitched`,e.AUDIO_TRACK_LOADING=`hlsAudioTrackLoading`,e.AUDIO_TRACK_LOADED=`hlsAudioTrackLoaded`,e.AUDIO_TRACK_UPDATED=`hlsAudioTrackUpdated`,e.SUBTITLE_TRACKS_UPDATED=`hlsSubtitleTracksUpdated`,e.SUBTITLE_TRACKS_CLEARED=`hlsSubtitleTracksCleared`,e.SUBTITLE_TRACK_SWITCH=`hlsSubtitleTrackSwitch`,e.SUBTITLE_TRACK_LOADING=`hlsSubtitleTrackLoading`,e.SUBTITLE_TRACK_LOADED=`hlsSubtitleTrackLoaded`,e.SUBTITLE_TRACK_UPDATED=`hlsSubtitleTrackUpdated`,e.SUBTITLE_FRAG_PROCESSED=`hlsSubtitleFragProcessed`,e.CUES_PARSED=`hlsCuesParsed`,e.NON_NATIVE_TEXT_TRACKS_FOUND=`hlsNonNativeTextTracksFound`,e.INIT_PTS_FOUND=`hlsInitPtsFound`,e.FRAG_LOADING=`hlsFragLoading`,e.FRAG_LOAD_EMERGENCY_ABORTED=`hlsFragLoadEmergencyAborted`,e.FRAG_LOADED=`hlsFragLoaded`,e.FRAG_DECRYPTED=`hlsFragDecrypted`,e.FRAG_PARSING_INIT_SEGMENT=`hlsFragParsingInitSegment`,e.FRAG_PARSING_USERDATA=`hlsFragParsingUserdata`,e.FRAG_PARSING_METADATA=`hlsFragParsingMetadata`,e.FRAG_PARSED=`hlsFragParsed`,e.FRAG_BUFFERED=`hlsFragBuffered`,e.FRAG_CHANGED=`hlsFragChanged`,e.FPS_DROP=`hlsFpsDrop`,e.FPS_DROP_LEVEL_CAPPING=`hlsFpsDropLevelCapping`,e.MAX_AUTO_LEVEL_UPDATED=`hlsMaxAutoLevelUpdated`,e.ERROR=`hlsError`,e.DESTROYING=`hlsDestroying`,e.KEY_LOADING=`hlsKeyLoading`,e.KEY_LOADED=`hlsKeyLoaded`,e.LIVE_BACK_BUFFER_REACHED=`hlsLiveBackBufferReached`,e.BACK_BUFFER_REACHED=`hlsBackBufferReached`,e.STEERING_MANIFEST_LOADED=`hlsSteeringManifestLoaded`,e.ASSET_LIST_LOADING=`hlsAssetListLoading`,e.ASSET_LIST_LOADED=`hlsAssetListLoaded`,e.INTERSTITIALS_UPDATED=`hlsInterstitialsUpdated`,e.INTERSTITIALS_BUFFERED_TO_BOUNDARY=`hlsInterstitialsBufferedToBoundary`,e.INTERSTITIAL_ASSET_PLAYER_CREATED=`hlsInterstitialAssetPlayerCreated`,e.INTERSTITIAL_STARTED=`hlsInterstitialStarted`,e.INTERSTITIAL_ASSET_STARTED=`hlsInterstitialAssetStarted`,e.INTERSTITIAL_ASSET_ENDED=`hlsInterstitialAssetEnded`,e.INTERSTITIAL_ASSET_ERROR=`hlsInterstitialAssetError`,e.INTERSTITIAL_ENDED=`hlsInterstitialEnded`,e.INTERSTITIALS_PRIMARY_RESUMED=`hlsInterstitialsPrimaryResumed`,e.PLAYOUT_LIMIT_REACHED=`hlsPlayoutLimitReached`,e.EVENT_CUE_ENTER=`hlsEventCueEnter`,e}({}),b={MANIFEST:`manifest`,LEVEL:`level`,AUDIO_TRACK:`audioTrack`,SUBTITLE_TRACK:`subtitleTrack`},x={MAIN:`main`,AUDIO:`audio`,SUBTITLE:`subtitle`},S=class{constructor(e,t=0,n=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=n}sample(e,t){let n=this.alpha_**+e;this.estimate_=t*(1-n)+n*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){let e=1-this.alpha_**+this.totalWeight_;if(e)return this.estimate_/e}return this.estimate_}},C=class{constructor(e,t,n,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new S(e),this.fast_=new S(t),this.defaultTTFB_=r,this.ttfb_=new S(e)}update(e,t){let{slow_:n,fast_:r,ttfb_:i}=this;n.halfLife!==e&&(this.slow_=new S(e,n.getEstimate(),n.getTotalWeight())),r.halfLife!==t&&(this.fast_=new S(t,r.getEstimate(),r.getTotalWeight())),i.halfLife!==e&&(this.ttfb_=new S(e,i.getEstimate(),i.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);let n=8*t,r=e/1e3,i=n/r;this.fast_.sample(r,i),this.slow_.sample(r,i)}sampleTTFB(e){let t=e/1e3,n=Math.sqrt(2)*Math.exp(-(t**2)/2);this.ttfb_.sample(n,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}};function w(e,t,n){return(t=k(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T(){return T=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},T.apply(null,arguments)}function E(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function D(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?E(Object(n),!0).forEach(function(t){w(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function O(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function k(e){var t=O(e,`string`);return typeof t==`symbol`?t:t+``}var A=class{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;let n=`[${e}]:`;this.trace=j,this.debug=t.debug.bind(null,n),this.log=t.log.bind(null,n),this.warn=t.warn.bind(null,n),this.info=t.info.bind(null,n),this.error=t.error.bind(null,n)}},j=function(){},M={trace:j,debug:j,log:j,warn:j,info:j,error:j};function N(){return T({},M)}function P(e,t){let n=self.console[e];return n?n.bind(self.console,`${t?`[`+t+`] `:``}[${e}] >`):j}function F(e,t,n){return t[e]?t[e].bind(t):P(e,n)}var I=N();function ee(e,t,n){let r=N();if(typeof console==`object`&&e===!0||typeof e==`object`){let i=[`debug`,`log`,`info`,`warn`,`error`];i.forEach(t=>{r[t]=F(t,e,n)});try{r.log(`Debug logs enabled for "${t}" in hls.js version 1.6.15`)}catch{return N()}i.forEach(t=>{I[t]=F(t,e)})}else T(I,r);return r}var L=I;function R(e=!0){if(!(typeof self>`u`))return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function te(e){return typeof self<`u`&&e===self.ManagedMediaSource}function ne(e,t){let n=Object.keys(e),r=Object.keys(t),i=n.length,a=r.length;return!i||!a||i===a&&!n.some(e=>r.indexOf(e)===-1)}function re(e,t=!1){if(typeof TextDecoder<`u`){let n=new TextDecoder(`utf-8`).decode(e);if(t){let e=n.indexOf(`\0`);return e===-1?n:n.substring(0,e)}return n.replace(/\0/g,``)}let n=e.length,r,i,a,o=``,s=0;for(;s<n;){if(r=e[s++],r===0&&t)return o;if(!(r===0||r===3))switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(r);break;case 12:case 13:i=e[s++],o+=String.fromCharCode((r&31)<<6|i&63);break;case 14:i=e[s++],a=e[s++],o+=String.fromCharCode((r&15)<<12|(i&63)<<6|(a&63)<<0);break}}return o}function ie(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n].toString(16);r.length<2&&(r=`0`+r),t+=r}return t}function ae(e){return Uint8Array.from(e.replace(/^0x/,``).replace(/([\da-fA-F]{2}) ?/g,`0x$1 `).replace(/ +$/,``).split(` `)).buffer}function oe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var se={exports:{}},ce;function le(){return ce?se.exports:(ce=1,(function(e,t){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,n){if(n||={},e=e.trim(),t=t.trim(),!t){if(!n.alwaysNormalize)return e;var i=o.parseURL(e);if(!i)throw Error(`Error trying to parse base URL.`);return i.path=o.normalizePath(i.path),o.buildURLFromParts(i)}var a=o.parseURL(t);if(!a)throw Error(`Error trying to parse relative URL.`);if(a.scheme)return n.alwaysNormalize?(a.path=o.normalizePath(a.path),o.buildURLFromParts(a)):t;var s=o.parseURL(e);if(!s)throw Error(`Error trying to parse base URL.`);if(!s.netLoc&&s.path&&s.path[0]!==`/`){var c=r.exec(s.path);s.netLoc=c[1],s.path=c[2]}s.netLoc&&!s.path&&(s.path=`/`);var l={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(l.netLoc=s.netLoc,a.path[0]!==`/`))if(!a.path)l.path=s.path,a.params||(l.params=s.params,a.query||(l.query=s.query));else{var u=s.path,d=u.substring(0,u.lastIndexOf(`/`)+1)+a.path;l.path=o.normalizePath(d)}return l.path===null&&(l.path=n.alwaysNormalize?o.normalizePath(a.path):a.path),o.buildURLFromParts(l)},parseURL:function(e){var t=n.exec(e);return t?{scheme:t[1]||``,netLoc:t[2]||``,path:t[3]||``,params:t[4]||``,query:t[5]||``,fragment:t[6]||``}:null},normalizePath:function(e){for(e=e.split(``).reverse().join(``).replace(i,``);e.length!==(e=e.replace(a,``)).length;);return e.split(``).reverse().join(``)},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=o})()})(se),se.exports)}var ue=le(),de=class{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}}},fe={AUDIO:`audio`,VIDEO:`video`,AUDIOVIDEO:`audiovideo`},pe=class{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e==`string`&&(e={url:e}),this.base=e,ve(this,`stats`)}setByteRange(e,t){let n=e.split(`@`,2),r;r=n.length===1?t?.byteRangeEndOffset||0:parseInt(n[1]),this._byteRange=[r,parseInt(n[0])+r]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[fe.AUDIO]:null,[fe.VIDEO]:null,[fe.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new de),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=ue.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||``}set url(e){this._url=e}clearElementaryStreamInfo(){let{elementaryStreams:e}=this;e[fe.AUDIO]=null,e[fe.VIDEO]=null,e[fe.AUDIOVIDEO]=null}};function me(e){return e.sn!==`initSegment`}var he=class extends pe{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){let e=this.stats.total;if(e)return e}if(this.byteRange.length){let e=this.byteRange[0],t=this.byteRange[1];if(m(e)&&m(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;let{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||=t.identity.getDecryptData(this.sn);else if(!((e=this._decryptdata)!=null&&e.keyId)){let e=Object.keys(t);if(e.length===1){let n=this._decryptdata=t[e[0]]||null;n&&(this._decryptdata=n.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;let e=m(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;let e=Object.keys(this.levelkeys),n=e.length;if(n>1||n===1&&(t=this.levelkeys[e[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!m(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return me(this)?(this._ref||={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime},this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){let t=this.levelkeys;if(t){var n;let r=t[e];r&&!((n=this._decryptdata)!=null&&n.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,n,r,i,a=!1){let{elementaryStreams:o}=this,s=o[e];if(!s){o[e]={startPTS:t,endPTS:n,startDTS:r,endDTS:i,partial:a};return}s.startPTS=Math.min(s.startPTS,t),s.endPTS=Math.max(s.endPTS,n),s.startDTS=Math.min(s.startDTS,r),s.endDTS=Math.max(s.endDTS,i)}},ge=class extends pe{constructor(e,t,n,r,i){super(n),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint(`DURATION`),this.gap=e.bool(`GAP`),this.independent=e.bool(`INDEPENDENT`),this.relurl=e.enumeratedString(`URI`),this.fragment=t,this.index=r;let a=e.enumeratedString(`BYTERANGE`);a&&this.setByteRange(a,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(){let{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}};function _e(e,t){let n=Object.getPrototypeOf(e);if(n)return Object.getOwnPropertyDescriptor(n,t)||_e(n,t)}function ve(e,t){let n=_e(e,t);n&&(n.enumerable=!0,Object.defineProperty(e,t,n))}var ye=2**32-1,be=[].push,xe={video:1,audio:2,id3:3,text:4};function Se(e){return String.fromCharCode.apply(null,e)}function Ce(e,t){let n=e[t]<<8|e[t+1];return n<0?65536+n:n}function we(e,t){let n=Ee(e,t);return n<0?4294967296+n:n}function Te(e,t){let n=we(e,t);return n*=2**32,n+=we(e,t+4),n}function Ee(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function De(e){let t=e.byteLength;for(let n=0;n<t;){let r=we(e,n);if(r>8&&e[n+4]===109&&e[n+5]===111&&e[n+6]===111&&e[n+7]===102)return!0;n=r>1?n+r:t}return!1}function Oe(e,t){let n=[];if(!t.length)return n;let r=e.byteLength;for(let i=0;i<r;){let a=we(e,i),o=Se(e.subarray(i+4,i+8)),s=a>1?i+a:r;if(o===t[0])if(t.length===1)n.push(e.subarray(i+8,s));else{let r=Oe(e.subarray(i+8,s),t.slice(1));r.length&&be.apply(n,r)}i=s}return n}function ke(e){let t=[],n=e[0],r=8,i=we(e,r);r+=4;let a=0,o=0;n===0?(a=we(e,r),o=we(e,r+4),r+=8):(a=Te(e,r),o=Te(e,r+8),r+=16),r+=2;let s=e.length+o,c=Ce(e,r);r+=2;for(let n=0;n<c;n++){let n=r,a=we(e,n);n+=4;let o=a&2147483647;if((a&2147483648)>>>31==1)return L.warn(`SIDX has hierarchical references (not supported)`),null;let c=we(e,n);n+=4,t.push({referenceSize:o,subsegmentDuration:c,info:{duration:c/i,start:s,end:s+o-1}}),s+=o,n+=4,r=n}return{earliestPresentationTime:a,timescale:i,version:n,referencesCount:c,references:t}}function Ae(e){let t=[],n=Oe(e,[`moov`,`trak`]);for(let e=0;e<n.length;e++){let r=n[e],i=Oe(r,[`tkhd`])[0];if(i){let e=i[0],n=we(i,e===0?12:20),a=Oe(r,[`mdia`,`mdhd`])[0];if(a){e=a[0];let i=we(a,e===0?12:20),o=Oe(r,[`mdia`,`hdlr`])[0];if(o){let e=Se(o.subarray(8,12)),a={soun:fe.AUDIO,vide:fe.VIDEO}[e],s=Oe(r,[`mdia`,`minf`,`stbl`,`stsd`])[0],c=je(s);a?(t[n]={timescale:i,type:a,stsd:c},t[a]=D({timescale:i,id:n},c)):t[n]={timescale:i,type:e,stsd:c}}}}}return Oe(e,[`moov`,`mvex`,`trex`]).forEach(e=>{let n=t[we(e,4)];n&&(n.default={duration:we(e,12),flags:we(e,20)})}),t}function je(e){let t=e.subarray(8),n=t.subarray(86),r=Se(t.subarray(4,8)),i=r,a,o=r===`enca`||r===`encv`;o&&Oe(Oe(t,[r])[0].subarray(r===`enca`?28:78),[`sinf`]).forEach(e=>{let t=Oe(e,[`schm`])[0];if(t){let n=Se(t.subarray(4,8));if(n===`cbcs`||n===`cenc`){let t=Oe(e,[`frma`])[0];t&&(i=Se(t))}}});let s=i;switch(i){case`avc1`:case`avc2`:case`avc3`:case`avc4`:{let e=Oe(n,[`avcC`])[0];e&&e.length>3&&(i+=`.`+Fe(e[1])+Fe(e[2])+Fe(e[3]),a=Me(s===`avc1`?`dva1`:`dvav`,n));break}case`mp4a`:{let e=Oe(t,[r])[0],n=Oe(e.subarray(28),[`esds`])[0];if(n&&n.length>7){let e=4;if(n[e++]!==3)break;e=Pe(n,e),e+=2;let t=n[e++];if(t&128&&(e+=2),t&64&&(e+=n[e++]),n[e++]!==4)break;e=Pe(n,e);let r=n[e++];if(r===64)i+=`.`+Fe(r);else break;if(e+=12,n[e++]!==5)break;e=Pe(n,e);let a=n[e++],o=(a&248)>>3;o===31&&(o+=1+((a&7)<<3)+((n[e]&224)>>5)),i+=`.`+o}break}case`hvc1`:case`hev1`:{let e=Oe(n,[`hvcC`])[0];if(e&&e.length>12){let t=e[1],n=[``,`A`,`B`,`C`][t>>6],r=t&31,a=we(e,2),o=(t&32)>>5?`H`:`L`,s=e[12],c=e.subarray(6,12);i+=`.`+n+r,i+=`.`+Ne(a).toString(16).toUpperCase(),i+=`.`+o+s;let l=``;for(let e=c.length;e--;){let t=c[e];(t||l)&&(l=`.`+t.toString(16).toUpperCase()+l)}i+=l}a=Me(s==`hev1`?`dvhe`:`dvh1`,n);break}case`dvh1`:case`dvhe`:case`dvav`:case`dva1`:case`dav1`:i=Me(i,n)||i;break;case`vp09`:{let e=Oe(n,[`vpcC`])[0];if(e&&e.length>6){let t=e[4],n=e[5],r=e[6]>>4&15;i+=`.`+Ie(t)+`.`+Ie(n)+`.`+Ie(r)}break}case`av01`:{let e=Oe(n,[`av1C`])[0];if(e&&e.length>2){let t=e[1]>>>5,r=e[1]&31,o=e[2]>>>7?`H`:`M`,s=(e[2]&64)>>6,c=(e[2]&32)>>5,l=t===2&&s?c?12:10:s?10:8,u=(e[2]&16)>>4,d=(e[2]&8)>>3,f=(e[2]&4)>>2,p=e[2]&3;i+=`.`+t+`.`+Ie(r)+o+`.`+Ie(l)+`.`+u+`.`+d+f+p+`.`+Ie(1)+`.`+Ie(1)+`.`+Ie(1)+`.0`,a=Me(`dav1`,n)}break}}return{codec:i,encrypted:o,supplemental:a}}function Me(e,t){let n=Oe(t,[`dvvC`]),r=n.length?n[0]:Oe(t,[`dvcC`])[0];if(r){let t=r[2]>>1&127,n=r[2]<<5&32|r[3]>>3&31;return e+`.`+Ie(t)+`.`+Ie(n)}}function Ne(e){let t=0;for(let n=0;n<32;n++)t|=(e>>n&1)<<31-n;return t>>>0}function Pe(e,t){let n=t+5;for(;e[t++]&128&&t<n;);return t}function Fe(e){return(`0`+e.toString(16).toUpperCase()).slice(-2)}function Ie(e){return(e<10?`0`:``)+e}function Le(e,t){if(!e||!t)return;let n=t.keyId;n&&t.isCommonEncryption&&ze(e,(e,t)=>{let r=e.subarray(8,24);r.some(e=>e!==0)||(L.log(`[eme] Patching keyId in 'enc${t?`a`:`v`}>sinf>>tenc' box: ${ie(r)} -> ${ie(n)}`),e.set(n,8))})}function Re(e){let t=[];return ze(e,e=>t.push(e.subarray(8,24))),t}function ze(e,t){Oe(e,[`moov`,`trak`]).forEach(e=>{let n=Oe(e,[`mdia`,`minf`,`stbl`,`stsd`])[0];if(!n)return;let r=n.subarray(8),i=Oe(r,[`enca`]),a=i.length>0;a||(i=Oe(r,[`encv`])),i.forEach(e=>{Oe(a?e.subarray(28):e.subarray(78),[`sinf`]).forEach(e=>{let n=Be(e);n&&t(n,a)})})})}function Be(e){let t=Oe(e,[`schm`])[0];if(t){let n=Se(t.subarray(4,8));if(n===`cbcs`||n===`cenc`){let t=Oe(e,[`schi`,`tenc`])[0];if(t)return t}}}function Ve(e,t,n){let r={},i=Oe(e,[`moof`,`traf`]);for(let e=0;e<i.length;e++){let a=i[e],o=Oe(a,[`tfhd`])[0],s=we(o,4),c=t[s];if(!c)continue;r[s]||(r[s]={start:NaN,duration:0,sampleCount:0,timescale:c.timescale,type:c.type});let l=r[s],u=Oe(a,[`tfdt`])[0];if(u){let e=u[0],t=we(u,4);e===1&&(t===ye?n.warn(`[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time`):(t*=ye+1,t+=we(u,8))),m(t)&&(!m(l.start)||t<l.start)&&(l.start=t)}let d=c.default,f=we(o,0)|d?.flags,p=d?.duration||0;f&8&&(p=f&2?we(o,12):we(o,8));let h=Oe(a,[`trun`]),g=l.start||0,_=0,v=p;for(let e=0;e<h.length;e++){let t=h[e],n=we(t,4),r=l.sampleCount;l.sampleCount+=n;let i=t[3]&1,a=t[3]&4,o=t[2]&1,s=t[2]&2,c=t[2]&4,u=t[2]&8,d=8,f=n;for(i&&(d+=4),a&&n&&(!(t[d+1]&1)&&l.keyFrameIndex===void 0&&(l.keyFrameIndex=r),d+=4,o?(v=we(t,d),d+=4):v=p,s&&(d+=4),u&&(d+=4),g+=v,_+=v,f--);f--;)o?(v=we(t,d),d+=4):v=p,s&&(d+=4),c&&(t[d+1]&1||l.keyFrameIndex===void 0&&(l.keyFrameIndex=l.sampleCount-(f+1),l.keyFrameStart=g),d+=4),u&&(d+=4),g+=v,_+=v;!_&&p&&(_+=p*n)}l.duration+=_}if(!Object.keys(r).some(e=>r[e].duration)){let t=1/0,n=0,i=Oe(e,[`sidx`]);for(let e=0;e<i.length;e++){let r=ke(i[e]);if(r!=null&&r.references){t=Math.min(t,r.earliestPresentationTime/r.timescale);let e=r.references.reduce((e,t)=>e+t.info.duration||0,0);n=Math.max(n,e+r.earliestPresentationTime/r.timescale)}}n&&m(n)&&Object.keys(r).forEach(e=>{r[e].duration||(r[e].duration=n*r[e].timescale-r[e].start)})}return r}function He(e){let t={valid:null,remainder:null},n=Oe(e,[`moof`]);if(n.length<2)return t.remainder=e,t;let r=n[n.length-1];return t.valid=e.slice(0,r.byteOffset-8),t.remainder=e.slice(r.byteOffset-8),t}function Ue(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function We(e,t){let n=[],r=t.samples,i=t.timescale,a=t.id,o=!1;return Oe(r,[`moof`]).map(s=>{let c=s.byteOffset-8;Oe(s,[`traf`]).map(s=>{let l=Oe(s,[`tfdt`]).map(e=>{let t=e[0],n=we(e,4);return t===1&&(n*=2**32,n+=we(e,8)),n/i})[0];return l!==void 0&&(e=l),Oe(s,[`tfhd`]).map(l=>{let u=we(l,4),d=we(l,0)&16777215,f=(d&1)!=0,p=(d&2)!=0,m=(d&8)!=0,h=0,g=(d&16)!=0,_=0,v=(d&32)!=0,y=8;u===a&&(f&&(y+=8),p&&(y+=4),m&&(h=we(l,y),y+=4),g&&(_=we(l,y),y+=4),v&&(y+=4),t.type===`video`&&(o=Ge(t.codec)),Oe(s,[`trun`]).map(a=>{let s=a[0],l=we(a,0)&16777215,u=(l&1)!=0,d=0,f=(l&4)!=0,p=(l&256)!=0,m=0,g=(l&512)!=0,v=0,y=(l&1024)!=0,b=(l&2048)!=0,x=0,S=we(a,4),C=8;u&&(d=we(a,C),C+=4),f&&(C+=4);let w=d+c;for(let c=0;c<S;c++){if(p?(m=we(a,C),C+=4):m=h,g?(v=we(a,C),C+=4):v=_,y&&(C+=4),b&&(x=s===0?we(a,C):Ee(a,C),C+=4),t.type===fe.VIDEO){let t=0;for(;t<v;){let a=we(r,w);w+=4,Ke(o,r[w])&&qe(r.subarray(w,w+a),o?2:1,e+x/i,n),w+=a,t+=a+4}}e+=m/i}}))})})}),n}function Ge(e){if(!e)return!1;let t=e.substring(0,4);return t===`hvc1`||t===`hev1`||t===`dvh1`||t===`dvhe`}function Ke(e,t){if(e){let e=t>>1&63;return e===39||e===40}else return(t&31)==6}function qe(e,t,n,r){let i=Je(e),a=0;a+=t;let o=0,s=0,c=0;for(;a<i.length;){o=0;do{if(a>=i.length)break;c=i[a++],o+=c}while(c===255);s=0;do{if(a>=i.length)break;c=i[a++],s+=c}while(c===255);let e=i.length-a,t=a;if(s<e)a+=s;else if(s>e){L.error(`Malformed SEI payload. ${s} is too small, only ${e} bytes left to parse.`);break}if(o===4){if(i[t++]===181){let e=Ce(i,t);if(t+=2,e===49){let e=we(i,t);if(t+=4,e===1195456820){let e=i[t++];if(e===3){let a=i[t++],s=31&a,c=64&a,l=c?2+s*3:0,u=new Uint8Array(l);if(c){u[0]=a;for(let e=1;e<l;e++)u[e]=i[t++]}r.push({type:e,payloadType:o,pts:n,bytes:u})}}}}}else if(o===5&&s>16){let e=[];for(let n=0;n<16;n++){let r=i[t++].toString(16);e.push(r.length==1?`0`+r:r),(n===3||n===5||n===7||n===9)&&e.push(`-`)}let a=s-16,c=new Uint8Array(a);for(let e=0;e<a;e++)c[e]=i[t++];r.push({payloadType:o,pts:n,uuid:e.join(``),userData:re(c),userDataBytes:c})}}}function Je(e){let t=e.byteLength,n=[],r=1;for(;r<t-2;)e[r]===0&&e[r+1]===0&&e[r+2]===3?(n.push(r+2),r+=2):r++;if(n.length===0)return e;let i=t-n.length,a=new Uint8Array(i),o=0;for(r=0;r<i;o++,r++)o===n[0]&&(o++,n.shift()),a[r]=e[o];return a}function Ye(e){let t=e[0],n=``,r=``,i=0,a=0,o=0,s=0,c=0,l=0;if(t===0){for(;Se(e.subarray(l,l+1))!==`\0`;)n+=Se(e.subarray(l,l+1)),l+=1;for(n+=Se(e.subarray(l,l+1)),l+=1;Se(e.subarray(l,l+1))!==`\0`;)r+=Se(e.subarray(l,l+1)),l+=1;r+=Se(e.subarray(l,l+1)),l+=1,i=we(e,12),a=we(e,16),s=we(e,20),c=we(e,24),l=28}else if(t===1){l+=4,i=we(e,l),l+=4;let t=we(e,l);l+=4;let a=we(e,l);for(l+=4,o=2**32*t+a,h(o)||(o=2**53-1,L.warn(`Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box`)),s=we(e,l),l+=4,c=we(e,l),l+=4;Se(e.subarray(l,l+1))!==`\0`;)n+=Se(e.subarray(l,l+1)),l+=1;for(n+=Se(e.subarray(l,l+1)),l+=1;Se(e.subarray(l,l+1))!==`\0`;)r+=Se(e.subarray(l,l+1)),l+=1;r+=Se(e.subarray(l,l+1)),l+=1}let u=e.subarray(l,e.byteLength);return{schemeIdUri:n,value:r,timeScale:i,presentationTime:o,presentationTimeDelta:a,eventDuration:s,id:c,payload:u}}function Xe(e,...t){let n=t.length,r=8,i=n;for(;i--;)r+=t[i].byteLength;let a=new Uint8Array(r);for(a[0]=r>>24&255,a[1]=r>>16&255,a[2]=r>>8&255,a[3]=r&255,a.set(e,4),i=0,r=8;i<n;i++)a.set(t[i],r),r+=t[i].byteLength;return a}function Ze(e,t,n){if(e.byteLength!==16)throw RangeError(`Invalid system id`);let r,i;r=0,i=new Uint8Array;let a;r>0?(a=new Uint8Array(4),t.length>0&&new DataView(a.buffer).setUint32(0,t.length,!1)):a=new Uint8Array;let o=new Uint8Array(4);return n.byteLength>0&&new DataView(o.buffer).setUint32(0,n.byteLength,!1),Xe([112,115,115,104],new Uint8Array([r,0,0,0]),e,a,i,o,n)}function eee(e){let t=[];if(e instanceof ArrayBuffer){let n=e.byteLength,r=0;for(;r+32<n;){let n=Qe(new DataView(e,r));t.push(n),r+=n.size}}return t}function Qe(e){let t=e.getUint32(0),n=e.byteOffset,r=e.byteLength;if(r<t)return{offset:n,size:r};if(e.getUint32(4)!==1886614376)return{offset:n,size:t};let i=e.getUint32(8)>>>24;if(i!==0&&i!==1)return{offset:n,size:t};let a=e.buffer,o=ie(new Uint8Array(a,n+12,16)),s=null,c=null,l=0;if(i===0)l=28;else{let i=e.getUint32(28);if(!i||r<32+i*16)return{offset:n,size:t};s=[];for(let e=0;e<i;e++)s.push(new Uint8Array(a,n+32+e*16,16));l=32+i*16}if(!l)return{offset:n,size:t};let u=e.getUint32(l);return t-32<u?{offset:n,size:t}:(c=new Uint8Array(a,n+l+4,u),{version:i,systemId:o,kids:s,data:c,offset:n,size:t})}var $e=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),et={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function tt(e,t){let n=et[t];return!!n&&!!n[e.slice(0,4)]}function nt(e,t,n=!0){return!e.split(`,`).some(e=>!rt(e,t,n))}function rt(e,t,n=!0){return R(n)?.isTypeSupported(it(e,t))??!1}function it(e,t){return`${t}/mp4;codecs=${e}`}function at(e){if(e){let t=e.substring(0,4);return et.video[t]}return 2}function ot(e){let t=$e();return e.split(`,`).reduce((e,n)=>{let r=t&&Ge(n)?9:et.video[n];return r?(r*2+e)/(e?3:2):(et.audio[n]+e)/(e?2:1)},0)}var st={};function ct(e,t=!0){if(st[e])return st[e];let n={flac:[`flac`,`fLaC`,`FLAC`],opus:[`opus`,`Opus`],"mp4a.40.34":[`mp3`]}[e];for(let i=0;i<n.length;i++){var r;if(rt(n[i],`audio`,t))return st[e]=n[i],n[i];if(n[i]===`mp3`&&(r=R(t))!=null&&r.isTypeSupported(`audio/mpeg`))return``}return e}var lt=/flac|opus|mp4a\.40\.34/i;function ut(e,t=!0){return e.replace(lt,e=>ct(e.toLowerCase(),t))}function tee(e,t){let n=[];if(e){let t=e.split(`,`);for(let e=0;e<t.length;e++)tt(t[e],`video`)||n.push(t[e])}return t&&n.push(t),n.join(`,`)}function dt(e,t){if(e&&(e.length>4||[`ac-3`,`ec-3`,`alac`,`fLaC`,`Opus`].indexOf(e)!==-1)&&(ft(e,`audio`)||ft(e,`video`)))return e;if(t){let n=t.split(`,`);if(n.length>1){if(e){for(let t=n.length;t--;)if(n[t].substring(0,4)===e.substring(0,4))return n[t]}return n[0]}}return t||e}function ft(e,t){return tt(e,t)&&rt(e,t)}function pt(e){let t=e.split(`,`);for(let e=0;e<t.length;e++){let n=t[e].split(`.`);n.length>2&&n[0]===`avc1`&&(t[e]=`avc1.${parseInt(n[1]).toString(16)}${(`000`+parseInt(n[2]).toString(16)).slice(-4)}`)}return t.join(`,`)}function mt(e){if(e.startsWith(`av01.`)){let t=e.split(`.`),n=[`0`,`111`,`01`,`01`,`01`,`0`];for(let e=t.length;e>4&&e<10;e++)t[e]=n[e-4];return t.join(`.`)}return e}function ht(e){let t=R(e)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported(`audio/mpeg`),mp3:t.isTypeSupported(`audio/mp4; codecs="mp3"`),ac3:t.isTypeSupported(`audio/mp4; codecs="ac-3"`)}}function gt(e){return e.replace(/^.+codecs=["']?([^"']+).*$/,`$1`)}var _t={supported:!0,powerEfficient:!0,smooth:!0},vt={supported:!1,smooth:!1,powerEfficient:!1},yt={supported:!0,configurations:[],decodingInfoResults:[_t]};function bt(e,t){return{supported:!1,configurations:t,decodingInfoResults:[vt],error:e}}function nee(e,t,n,r,i,a){let o=e.videoCodec,s=e.audioCodec?e.audioGroups:null,c=a?.audioCodec,l=a?.channels,u=l?parseInt(l):c?1/0:2,d=null;if(s!=null&&s.length)try{d=s.length===1&&s[0]?t.groups[s[0]].channels:s.reduce((e,n)=>{if(n){let r=t.groups[n];if(!r)throw Error(`Audio track group ${n} not found`);Object.keys(r.channels).forEach(t=>{e[t]=(e[t]||0)+r.channels[t]})}return e},{2:0})}catch{return!0}return o!==void 0&&(o.split(`,`).some(e=>Ge(e))||e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(r,30)||e.videoRange!==`SDR`&&e.videoRange!==n||e.bitrate>Math.max(i,8e6))||!!d&&m(u)&&Object.keys(d).some(e=>parseInt(e)>u)}function xt(e,t,n,r={}){let i=e.videoCodec;if(!i&&!e.audioCodec||!n)return Promise.resolve(yt);let a=[],o=St(e),s=o.length,c=Ct(e,t,s>0),l=c.length;for(let e=s||1*l||1;e--;){let t={type:`media-source`};if(s&&(t.video=o[e%s]),l){t.audio=c[e%l];let n=t.audio.bitrate;t.video&&n&&(t.video.bitrate-=n)}a.push(t)}if(i){let e=navigator.userAgent;if(i.split(`,`).some(e=>Ge(e))&&$e())return Promise.resolve(bt(Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${e})`),a))}return Promise.all(a.map(e=>{let t=Et(e);return r[t]||(r[t]=n.decodingInfo(e))})).then(e=>({supported:!e.some(e=>!e.supported),configurations:a,decodingInfoResults:e})).catch(e=>({supported:!1,configurations:a,decodingInfoResults:[],error:e}))}function St(e){let t=e.videoCodec?.split(`,`),n=Tt(e),r=e.width||640,i=e.height||480,a=e.frameRate||30,o=e.videoRange.toLowerCase();return t?t.map(e=>{let t={contentType:it(mt(e),`video`),width:r,height:i,bitrate:n,framerate:a};return o!==`sdr`&&(t.transferFunction=o),t}):[]}function Ct(e,t,n){let r=e.audioCodec?.split(`,`),i=Tt(e);return r&&e.audioGroups?e.audioGroups.reduce((e,a)=>{let o=a?t.groups[a]?.tracks:null;return o?o.reduce((e,t)=>{if(t.groupId===a){let a=parseFloat(t.channels||``);r.forEach(t=>{let r={contentType:it(t,`audio`),bitrate:n?wt(t,i):i};a&&(r.channels=``+a),e.push(r)})}return e},e):e},[]):[]}function wt(e,t){if(t<=1)return 1;let n=128e3;return e===`ec-3`?n=768e3:e===`ac-3`&&(n=64e4),Math.min(t/2,n)}function Tt(e){return Math.ceil(Math.max(e.bitrate*.9,e.averageBitrate)/1e3)*1e3||1}function Et(e){let t=``,{audio:n,video:r}=e;if(r){let e=gt(r.contentType);t+=`${e}_r${r.height}x${r.width}f${Math.ceil(r.framerate)}${r.transferFunction||`sd`}_${Math.ceil(r.bitrate/1e5)}`}if(n){let e=gt(n.contentType);t+=`${r?`_`:``}${e}_c${n.channels}`}return t}var Dt=[`NONE`,`TYPE-0`,`TYPE-1`,null];function Ot(e){return Dt.indexOf(e)>-1}var kt=[`SDR`,`PQ`,`HLG`];function At(e){return!!e&&kt.indexOf(e)>-1}var jt={No:``,Yes:`YES`,v2:`v2`};function Mt(e){let{canSkipUntil:t,canSkipDateRanges:n,age:r}=e,i=r<t/2;return t&&i?n?jt.v2:jt.Yes:jt.No}var Nt=class{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}addDirectives(e){let t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set(`_HLS_msn`,this.msn.toString()),this.part!==void 0&&t.searchParams.set(`_HLS_part`,this.part.toString()),this.skip&&t.searchParams.set(`_HLS_skip`,this.skip),t.href}},Pt=class{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat(`FRAME-RATE`,0),this._avgBitrate=e.attrs.decimalInteger(`AVERAGE-BANDWIDTH`),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(e=>!!e).map(e=>e.substring(0,4)).join(`,`),`supplemental`in e){this.supplemental=e.supplemental;let t=e.supplemental?.videoCodec;t&&t!==e.videoCodec&&(this.codecSet+=`,${t.substring(0,4)}`)}this.addGroupId(`audio`,e.attrs.AUDIO),this.addGroupId(`text`,e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||``}get pathwayId(){return this.attrs[`PATHWAY-ID`]||`.`}get videoRange(){return this.attrs[`VIDEO-RANGE`]||`SDR`}get score(){return this.attrs.optionalFloat(`SCORE`,0)}get uri(){return this.url[0]||``}hasAudioGroup(e){return Ft(this._audioGroups,e)}hasSubtitleGroup(e){return Ft(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e===`audio`){let e=this._audioGroups;e||=this._audioGroups=[],e.indexOf(t)===-1&&e.push(t)}else if(e===`text`){let e=this._subtitleGroups;e||=this._subtitleGroups=[],e.indexOf(t)===-1&&e.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){return this.audioGroups?.[0]}get textGroupId(){return this.subtitleGroups?.[0]}addFallback(){}};function Ft(e,t){return!t||!e?!1:e.indexOf(t)!==-1}function It(){if(typeof matchMedia==`function`){let e=matchMedia(`(dynamic-range: high)`),t=matchMedia(`bad query`);if(e.media!==t.media)return e.matches===!0}return!1}function ree(e,t){let n=!1,r=[];if(e&&(n=e!==`SDR`,r=[e]),t){r=t.allowedVideoRanges||kt.slice(0);let e=r.join(``)!==`SDR`&&!t.videoCodec;n=t.preferHDR===void 0?e&&It():t.preferHDR,n||(r=[`SDR`])}return{preferHDR:n,allowedVideoRanges:r}}var iee=e=>{let t=new WeakSet;return(n,r)=>{if(e&&(r=e(n,r)),typeof r==`object`&&r){if(t.has(r))return;t.add(r)}return r}},Lt=(e,t)=>JSON.stringify(e,iee(t));function Rt(e,t,n,r,i){let a=Object.keys(e),o=r?.channels,s=r?.audioCodec,c=i?.videoCodec,l=o&&parseInt(o)===2,u=!1,d=!1,f=1/0,p=1/0,h=1/0,g=1/0,_=0,v=[],{preferHDR:y,allowedVideoRanges:b}=ree(t,i);for(let t=a.length;t--;){let n=e[a[t]];u||=n.channels[2]>0,f=Math.min(f,n.minHeight),p=Math.min(p,n.minFramerate),h=Math.min(h,n.minBitrate),b.filter(e=>n.videoRanges[e]>0).length>0&&(d=!0)}f=m(f)?f:0,p=m(p)?p:0;let x=Math.max(1080,f),S=Math.max(30,p);h=m(h)?h:n,n=Math.max(h,n),d||(t=void 0);let C=a.length>1;return{codecSet:a.reduce((t,r)=>{let i=e[r];if(r===t)return t;if(v=d?b.filter(e=>i.videoRanges[e]>0):[],C){if(i.minBitrate>n)return zt(r,`min bitrate of ${i.minBitrate} > current estimate of ${n}`),t;if(!i.hasDefaultAudio)return zt(r,`no renditions with default or auto-select sound found`),t;if(s&&r.indexOf(s.substring(0,4))%5!=0)return zt(r,`audio codec preference "${s}" not found`),t;if(o&&!l){if(!i.channels[o])return zt(r,`no renditions with ${o} channel sound found (channels options: ${Object.keys(i.channels)})`),t}else if((!s||l)&&u&&i.channels[2]===0)return zt(r,`no renditions with stereo sound found`),t;if(i.minHeight>x)return zt(r,`min resolution of ${i.minHeight} > maximum of ${x}`),t;if(i.minFramerate>S)return zt(r,`min framerate of ${i.minFramerate} > maximum of ${S}`),t;if(!v.some(e=>i.videoRanges[e]>0))return zt(r,`no variants with VIDEO-RANGE of ${Lt(v)} found`),t;if(c&&r.indexOf(c.substring(0,4))%5!=0)return zt(r,`video codec preference "${c}" not found`),t;if(i.maxScore<_)return zt(r,`max score of ${i.maxScore} < selected max of ${_}`),t}return t&&(ot(r)>=ot(t)||i.fragmentError>e[t].fragmentError)?t:(g=i.minIndex,_=i.maxScore,r)},void 0),videoRanges:v,preferHDR:y,minFramerate:p,minBitrate:h,minIndex:g}}function zt(e,t){L.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function Bt(e){return e.reduce((e,t)=>{let n=e.groups[t.groupId];n||=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1},n.tracks.push(t);let r=t.channels||`2`;return n.channels[r]=(n.channels[r]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Vt(e,t,n,r){return e.slice(n,r+1).reduce((e,n,r)=>{if(!n.codecSet)return e;let i=n.audioGroups,a=e[n.codecSet];a||(e[n.codecSet]=a={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:r,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!i,fragmentError:0}),a.minBitrate=Math.min(a.minBitrate,n.bitrate);let o=Math.min(n.height,n.width);return a.minHeight=Math.min(a.minHeight,o),a.minFramerate=Math.min(a.minFramerate,n.frameRate),a.minIndex=Math.min(a.minIndex,r),a.maxScore=Math.max(a.maxScore,n.score),a.fragmentError+=n.fragmentError,a.videoRanges[n.videoRange]=(a.videoRanges[n.videoRange]||0)+1,i&&i.forEach(e=>{if(!e)return;let n=t.groups[e];n&&(a.hasDefaultAudio=a.hasDefaultAudio||t.hasDefaultAudio?n.hasDefault:n.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(n.channels).forEach(e=>{a.channels[e]=(a.channels[e]||0)+n.channels[e]}))}),e},{})}function Ht(e){if(!e)return e;let{lang:t,assocLang:n,characteristics:r,channels:i,audioCodec:a}=e;return{lang:t,assocLang:n,characteristics:r,channels:i,audioCodec:a}}function Ut(e,t,n){if(`attrs`in e){let n=t.indexOf(e);if(n!==-1)return n}for(let r=0;r<t.length;r++){let i=t[r];if(Wt(e,i,n))return r}return-1}function Wt(e,t,n){let{groupId:r,name:i,lang:a,assocLang:o,default:s}=e,c=e.forced;return(r===void 0||t.groupId===r)&&(i===void 0||t.name===i)&&(a===void 0||aee(a,t.lang))&&(a===void 0||t.assocLang===o)&&(s===void 0||t.default===s)&&(c===void 0||t.forced===c)&&(!(`characteristics`in e)||oee(e.characteristics||``,t.characteristics))&&(n===void 0||n(e,t))}function aee(e,t=`--`){return e.length===t.length?e===t:e.startsWith(t)||t.startsWith(e)}function oee(e,t=``){let n=e.split(`,`),r=t.split(`,`);return n.length===r.length&&!n.some(e=>r.indexOf(e)===-1)}function Gt(e,t){let{audioCodec:n,channels:r}=e;return(n===void 0||(t.audioCodec||``).substring(0,4)===n.substring(0,4))&&(r===void 0||r===(t.channels||`2`))}function see(e,t,n,r,i){let a=t[r],o=t.reduce((e,t,n)=>{let r=t.uri;return(e[r]||(e[r]=[])).push(n),e},{})[a.uri];o.length>1&&(r=Math.max.apply(Math,o));let s=a.videoRange,c=a.frameRate,l=a.codecSet.substring(0,4),u=Kt(t,r,t=>{if(t.videoRange!==s||t.frameRate!==c||t.codecSet.substring(0,4)!==l)return!1;let r=t.audioGroups;return Ut(e,n.filter(e=>!r||r.indexOf(e.groupId)!==-1),i)>-1});return u>-1?u:Kt(t,r,t=>{let r=t.audioGroups;return Ut(e,n.filter(e=>!r||r.indexOf(e.groupId)!==-1),i)>-1})}function Kt(e,t,n){for(let r=t;r>-1;r--)if(n(e[r]))return r;for(let r=t+1;r<e.length;r++)if(n(e[r]))return r;return-1}function qt(e,t){return!!e&&e!==t.loadLevelObj?.uri}var Jt=class extends A{constructor(e){super(`abr`,e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey=``,this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=e=>{let{fragCurrent:t,partCurrent:n,hls:r}=this,{autoLevelEnabled:i,media:a}=r;if(!t||!a)return;let o=performance.now(),s=n?n.stats:t.stats,c=n?n.duration:t.duration,l=o-s.loading.start,u=r.minAutoLevel,d=t.level,f=this._nextAutoLevel;if(s.aborted||s.loaded&&s.loaded===s.total||d<=u){this.clearTimer(),this._nextAutoLevel=-1;return}if(!i)return;let p=f>-1&&f!==d,h=!!e||p;if(!h&&(a.paused||!a.playbackRate||!a.readyState))return;let g=r.mainForwardBufferInfo;if(!h&&g===null)return;let _=this.bwEstimator.getEstimateTTFB(),v=Math.abs(a.playbackRate);if(l<=Math.max(_,1e3*(c/(v*2))))return;let b=g?g.len/v:0,x=s.loading.first?s.loading.first-s.loading.start:-1,S=s.loaded&&x>-1,C=this.getBwEstimate(),w=r.levels,T=w[d],E=Math.max(s.loaded,Math.round(c*(t.bitrate||T.averageBitrate)/8)),D=S?l-x:l;D<1&&S&&(D=Math.min(l,s.loaded*8/C));let O=S?s.loaded*1e3/D:0,k=_/1e3,A=O?(E-s.loaded)/O:E*8/C+k;if(A<=b)return;let j=O?O*8:C,M=(e?.details||this.hls.latestLevelDetails)?.live===!0,N=this.hls.config.abrBandWidthUpFactor,P=1/0,F;for(F=d-1;F>u;F--){let e=w[F].maxBitrate,t=!w[F].details||M;if(P=this.getTimeToLoadFrag(k,j,c*e,t),P<Math.min(b,c+k))break}if(P>=A||P>c*10)return;S?this.bwEstimator.sample(l-Math.min(_,x),s.loaded):this.bwEstimator.sampleTTFB(l);let I=w[F].maxBitrate;this.getBwEstimate()*N>I&&this.resetEstimator(I);let ee=this.findBestLevel(I,u,F,0,b,1,1);ee>-1&&(F=ee),this.warn(`Fragment ${t.sn}${n?` part `+n.index:``} of level ${d} is loading too slowly;
|
|
4
4
|
Fragment duration: ${t.duration.toFixed(3)}
|