xgplayer-mp4
Version:
xgplayer plugin for mp4 transform to fmp4
1 lines • 376 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("core-js/modules/es.json.stringify.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.regexp.test.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.promise.finally.js"),require("core-js/modules/es.object.assign.js"),require("core-js/modules/es.array.splice.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.array.concat.js"),require("xgplayer"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.typed-array.uint8-array.js"),require("core-js/modules/esnext.typed-array.at.js"),require("core-js/modules/es.typed-array.copy-within.js"),require("core-js/modules/es.typed-array.every.js"),require("core-js/modules/es.typed-array.fill.js"),require("core-js/modules/es.typed-array.filter.js"),require("core-js/modules/es.typed-array.find.js"),require("core-js/modules/es.typed-array.find-index.js"),require("core-js/modules/esnext.typed-array.find-last.js"),require("core-js/modules/esnext.typed-array.find-last-index.js"),require("core-js/modules/es.typed-array.for-each.js"),require("core-js/modules/es.typed-array.includes.js"),require("core-js/modules/es.typed-array.index-of.js"),require("core-js/modules/es.typed-array.iterator.js"),require("core-js/modules/es.typed-array.join.js"),require("core-js/modules/es.typed-array.last-index-of.js"),require("core-js/modules/es.typed-array.map.js"),require("core-js/modules/es.typed-array.reduce.js"),require("core-js/modules/es.typed-array.reduce-right.js"),require("core-js/modules/es.typed-array.reverse.js"),require("core-js/modules/es.typed-array.set.js"),require("core-js/modules/es.typed-array.slice.js"),require("core-js/modules/es.typed-array.some.js"),require("core-js/modules/es.typed-array.sort.js"),require("core-js/modules/es.typed-array.subarray.js"),require("core-js/modules/es.typed-array.to-locale-string.js"),require("core-js/modules/es.typed-array.to-string.js"),require("core-js/modules/es.array.find.js"),require("core-js/modules/es.number.constructor.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.array.includes.js"),require("core-js/modules/es.string.includes.js"),require("core-js/modules/es.number.is-finite.js"),require("core-js/modules/es.regexp.to-string.js"),require("core-js/modules/es.math.hypot.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.string.from-code-point.js"),require("core-js/modules/es.string.match.js"),require("core-js/modules/es.array.sort.js"),require("core-js/modules/es.regexp.flags.js"),require("core-js/modules/es.string.pad-start.js"),require("core-js/modules/es.array.from.js"),require("core-js/modules/es.array-buffer.constructor.js"),require("core-js/modules/es.typed-array.int8-array.js"),require("core-js/modules/es.typed-array.uint8-clamped-array.js"),require("core-js/modules/es.typed-array.int16-array.js"),require("core-js/modules/es.typed-array.uint16-array.js"),require("core-js/modules/es.typed-array.int32-array.js"),require("core-js/modules/es.typed-array.uint32-array.js"),require("core-js/modules/es.typed-array.float32-array.js"),require("core-js/modules/es.typed-array.float64-array.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url-search-params.js"),require("core-js/modules/es.string.replace.js"),require("core-js/modules/es.number.is-nan.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.string.trim.js"),require("core-js/modules/es.set.js")):"function"==typeof define&&define.amd?define(["core-js/modules/es.json.stringify.js","core-js/modules/es.regexp.exec.js","core-js/modules/es.regexp.test.js","core-js/modules/es.object.to-string.js","core-js/modules/es.promise.js","core-js/modules/es.promise.finally.js","core-js/modules/es.object.assign.js","core-js/modules/es.array.splice.js","core-js/modules/web.dom-collections.for-each.js","core-js/modules/es.object.keys.js","core-js/modules/es.function.name.js","core-js/modules/es.array.concat.js","xgplayer","core-js/modules/es.array.map.js","core-js/modules/es.array.iterator.js","core-js/modules/es.typed-array.uint8-array.js","core-js/modules/esnext.typed-array.at.js","core-js/modules/es.typed-array.copy-within.js","core-js/modules/es.typed-array.every.js","core-js/modules/es.typed-array.fill.js","core-js/modules/es.typed-array.filter.js","core-js/modules/es.typed-array.find.js","core-js/modules/es.typed-array.find-index.js","core-js/modules/esnext.typed-array.find-last.js","core-js/modules/esnext.typed-array.find-last-index.js","core-js/modules/es.typed-array.for-each.js","core-js/modules/es.typed-array.includes.js","core-js/modules/es.typed-array.index-of.js","core-js/modules/es.typed-array.iterator.js","core-js/modules/es.typed-array.join.js","core-js/modules/es.typed-array.last-index-of.js","core-js/modules/es.typed-array.map.js","core-js/modules/es.typed-array.reduce.js","core-js/modules/es.typed-array.reduce-right.js","core-js/modules/es.typed-array.reverse.js","core-js/modules/es.typed-array.set.js","core-js/modules/es.typed-array.slice.js","core-js/modules/es.typed-array.some.js","core-js/modules/es.typed-array.sort.js","core-js/modules/es.typed-array.subarray.js","core-js/modules/es.typed-array.to-locale-string.js","core-js/modules/es.typed-array.to-string.js","core-js/modules/es.array.find.js","core-js/modules/es.number.constructor.js","core-js/modules/es.array.filter.js","core-js/modules/es.array.slice.js","core-js/modules/es.symbol.js","core-js/modules/es.symbol.iterator.js","core-js/modules/es.string.iterator.js","core-js/modules/web.dom-collections.iterator.js","core-js/modules/es.symbol.description.js","core-js/modules/es.array.includes.js","core-js/modules/es.string.includes.js","core-js/modules/es.number.is-finite.js","core-js/modules/es.regexp.to-string.js","core-js/modules/es.math.hypot.js","core-js/modules/es.array.join.js","core-js/modules/es.string.from-code-point.js","core-js/modules/es.string.match.js","core-js/modules/es.array.sort.js","core-js/modules/es.regexp.flags.js","core-js/modules/es.string.pad-start.js","core-js/modules/es.array.from.js","core-js/modules/es.array-buffer.constructor.js","core-js/modules/es.typed-array.int8-array.js","core-js/modules/es.typed-array.uint8-clamped-array.js","core-js/modules/es.typed-array.int16-array.js","core-js/modules/es.typed-array.uint16-array.js","core-js/modules/es.typed-array.int32-array.js","core-js/modules/es.typed-array.uint32-array.js","core-js/modules/es.typed-array.float32-array.js","core-js/modules/es.typed-array.float64-array.js","core-js/modules/web.url.js","core-js/modules/web.url-search-params.js","core-js/modules/es.string.replace.js","core-js/modules/es.number.is-nan.js","core-js/modules/es.object.get-prototype-of.js","core-js/modules/es.string.trim.js","core-js/modules/es.set.js"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Mp4Plugin=t(null,null,null,null,null,null,null,null,null,null,null,null,e.Player)}(this,(function(e,t,i,n,s,a,r,l,o,d,c,u,m){"use strict";function h(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function p(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?h(Object(i),!0).forEach((function(t){G(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):h(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function y(){y=function(){return e};var e={},t=Object.prototype,i=t.hasOwnProperty,n=Object.defineProperty||function(e,t,i){e[t]=i.value},s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",r=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function o(e,t,i){return Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{o({},"")}catch(k){o=function(e,t,i){return e[t]=i}}function d(e,t,i,s){var a=t&&t.prototype instanceof m?t:m,r=Object.create(a.prototype),l=new g(s||[]);return n(r,"_invoke",{value:G(e,i,l)}),r}function c(e,t,i){try{return{type:"normal",arg:e.call(t,i)}}catch(k){return{type:"throw",arg:k}}}e.wrap=d;var u={};function m(){}function h(){}function p(){}var Z={};o(Z,a,(function(){return this}));var b=Object.getPrototypeOf,f=b&&b(b(V([])));f&&f!==t&&i.call(f,a)&&(Z=f);var X=p.prototype=m.prototype=Object.create(Z);function L(e){["next","throw","return"].forEach((function(t){o(e,t,(function(e){return this._invoke(t,e)}))}))}function W(e,t){function s(n,a,r,l){var o=c(e[n],e,a);if("throw"!==o.type){var d=o.arg,u=d.value;return u&&"object"==typeof u&&i.call(u,"__await")?t.resolve(u.__await).then((function(e){s("next",e,r,l)}),(function(e){s("throw",e,r,l)})):t.resolve(u).then((function(e){d.value=e,r(d)}),(function(e){return s("throw",e,r,l)}))}l(o.arg)}var a;n(this,"_invoke",{value:function(e,i){function n(){return new t((function(t,n){s(e,i,t,n)}))}return a=a?a.then(n,n):n()}})}function G(e,t,i){var n="suspendedStart";return function(s,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===s)throw a;return{value:void 0,done:!0}}for(i.method=s,i.arg=a;;){var r=i.delegate;if(r){var l=v(r,i);if(l){if(l===u)continue;return l}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if("suspendedStart"===n)throw n="completed",i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);n="executing";var o=c(e,t,i);if("normal"===o.type){if(n=i.done?"completed":"suspendedYield",o.arg===u)continue;return{value:o.arg,done:i.done}}"throw"===o.type&&(n="completed",i.method="throw",i.arg=o.arg)}}}function v(e,t){var i=t.method,n=e.iterator[i];if(void 0===n)return t.delegate=null,"throw"===i&&e.iterator.return&&(t.method="return",t.arg=void 0,v(e,t),"throw"===t.method)||"return"!==i&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+i+"' method")),u;var s=c(n,e.iterator,t.arg);if("throw"===s.type)return t.method="throw",t.arg=s.arg,t.delegate=null,u;var a=s.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function g(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function V(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,s=function t(){for(;++n<e.length;)if(i.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return s.next=s}}return{next:Y}}function Y(){return{value:void 0,done:!0}}return h.prototype=p,n(X,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:h,configurable:!0}),h.displayName=o(p,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,o(e,l,"GeneratorFunction")),e.prototype=Object.create(X),e},e.awrap=function(e){return{__await:e}},L(W.prototype),o(W.prototype,r,(function(){return this})),e.AsyncIterator=W,e.async=function(t,i,n,s,a){void 0===a&&(a=Promise);var r=new W(d(t,i,n,s),a);return e.isGeneratorFunction(i)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},L(X),o(X,l,"Generator"),o(X,a,(function(){return this})),o(X,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),i=[];for(var n in t)i.push(n);return i.reverse(),function e(){for(;i.length;){var n=i.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=V,g.prototype={constructor:g,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(i,n){return r.type="throw",r.arg=e,t.next=i,n&&(t.method="next",t.arg=void 0),!!n}for(var s=this.tryEntries.length-1;s>=0;--s){var a=this.tryEntries[s],r=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var l=i.call(a,"catchLoc"),o=i.call(a,"finallyLoc");if(l&&o){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!o)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var s=this.tryEntries[n];if(s.tryLoc<=this.prev&&i.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var a=s;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var r=a?a.completion:{};return r.type=e,r.arg=t,a?(this.method="next",this.next=a.finallyLoc,u):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),S(i),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var n=i.completion;if("throw"===n.type){var s=n.arg;S(i)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:V(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=void 0),u}},e}function Z(e){return(Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function b(e,t,i,n,s,a,r){try{var l=e[a](r),o=l.value}catch(d){return void i(d)}l.done?t(o):Promise.resolve(o).then(n,s)}function f(e){return function(){var t=this,i=arguments;return new Promise((function(n,s){var a=e.apply(t,i);function r(e){b(a,n,s,r,l,"next",e)}function l(e){b(a,n,s,r,l,"throw",e)}r(void 0)}))}}function X(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,F(n.key),n)}}function W(e,t,i){return t&&L(e.prototype,t),i&&L(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function G(e,t,i){return(t=F(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function v(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&S(e,t)}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e,t){return(S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function g(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function V(e,t,i){return(V=g()?Reflect.construct.bind():function(e,t,i){var n=[null];n.push.apply(n,t);var s=new(Function.bind.apply(e,n));return i&&S(s,i.prototype),s}).apply(null,arguments)}function Y(e){var t="function"==typeof Map?new Map:void 0;return Y=function(e){if(null===e||(i=e,-1===Function.toString.call(i).indexOf("[native code]")))return e;var i;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return V(e,arguments,x(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),S(n,e)},Y(e)}function k(e,t){if(null==e)return{};var i,n,s=function(e,t){if(null==e)return{};var i,n,s={},a=Object.keys(e);for(n=0;n<a.length;n++)i=a[n],t.indexOf(i)>=0||(s[i]=e[i]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)i=a[n],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i])}return s}function R(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function T(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return R(e)}function w(e){var t=g();return function(){var i,n=x(e);if(t){var s=x(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return T(this,i)}}function M(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=x(e)););return e}function K(){return K="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var n=M(e,t);if(n){var s=Object.getOwnPropertyDescriptor(n,t);return s.get?s.get.call(arguments.length<3?e:i):s.value}},K.apply(this,arguments)}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,s,a,r,l=[],o=!0,d=!1;try{if(a=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;o=!1}else for(;!(o=(n=a.call(i)).done)&&(l.push(n.value),l.length!==t);o=!0);}catch(c){d=!0,s=c}finally{try{if(!o&&null!=i.return&&(r=i.return(),Object(r)!==r))return}finally{if(d)throw s}}return l}}(e,t)||H(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e){return function(e){if(Array.isArray(e))return N(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||H(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function H(e,t){if(e){if("string"==typeof e)return N(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?N(e,t):void 0}}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function z(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=H(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,r=!0,l=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return r=e.done,e},e:function(e){l=!0,a=e},f:function(){try{r||null==i.return||i.return()}finally{if(l)throw a}}}}function F(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var U={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function s(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function a(e,t,n,a,r){if("function"!=typeof n)throw new TypeError("The listener must be a function");var l=new s(n,a||e,r),o=i?i+t:t;return e._events[o]?e._events[o].fn?e._events[o]=[e._events[o],l]:e._events[o].push(l):(e._events[o]=l,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function l(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),l.prototype.eventNames=function(){var e,n,s=[];if(0===this._eventsCount)return s;for(n in e=this._events)t.call(e,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},l.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,a=n.length,r=new Array(a);s<a;s++)r[s]=n[s].fn;return r},l.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},l.prototype.emit=function(e,t,n,s,a,r){var l=i?i+e:e;if(!this._events[l])return!1;var o,d,c=this._events[l],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,s),!0;case 5:return c.fn.call(c.context,t,n,s,a),!0;case 6:return c.fn.call(c.context,t,n,s,a,r),!0}for(d=1,o=new Array(u-1);d<u;d++)o[d-1]=arguments[d];c.fn.apply(c.context,o)}else{var m,h=c.length;for(d=0;d<h;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),u){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,s);break;default:if(!o)for(m=1,o=new Array(u-1);m<u;m++)o[m-1]=arguments[m];c[d].fn.apply(c[d].context,o)}}return!0},l.prototype.on=function(e,t,i){return a(this,e,t,i,!1)},l.prototype.once=function(e,t,i){return a(this,e,t,i,!0)},l.prototype.removeListener=function(e,t,n,s){var a=i?i+e:e;if(!this._events[a])return this;if(!t)return r(this,a),this;var l=this._events[a];if(l.fn)l.fn!==t||s&&!l.once||n&&l.context!==n||r(this,a);else{for(var o=0,d=[],c=l.length;o<c;o++)(l[o].fn!==t||s&&!l[o].once||n&&l[o].context!==n)&&d.push(l[o]);d.length?this._events[a]=1===d.length?d[0]:d:r(this,a)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&r(this,t)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=i,l.EventEmitter=l,e.exports=l}(U);var J,j=U.exports,P={};Object.defineProperty(P,"__esModule",{value:!0}),P.default=function(e){for(var t=0,i=arguments.length,n=Array(i>1?i-1:0),s=1;s<i;s++)n[s-1]=arguments[s];var a=!0,r=!1,l=void 0;try{for(var o,d=n[Symbol.iterator]();!(a=(o=d.next()).done);a=!0){var c=o.value;t+=c.length}}catch(X){r=!0,l=X}finally{try{!a&&d.return&&d.return()}finally{if(r)throw l}}var u=new e(t),m=0,h=!0,p=!1,y=void 0;try{for(var Z,b=n[Symbol.iterator]();!(h=(Z=b.next()).done);h=!0){var f=Z.value;u.set(f,m),m+=f.length}}catch(X){p=!0,y=X}finally{try{!h&&b.return&&b.return()}finally{if(p)throw y}}return u};var E=((J=P)&&J.__esModule?J:{default:J}).default,D="video",B="audio",_="metadata",Q="av1",O="avc",A="hevc",q="aac",$="g7110a",ee="g7110m",te="opus",ie="mp3",ne="LARGE_AV_SHIFT",se="LARGE_VIDEO_GAP",ae="LARGE_VIDEO_GAP_BETWEEN_CHUNK",re="LARGE_AUDIO_GAP",le="AUDIO_FILLED",oe="AUDIO_DROPPED",de=function(){function e(){X(this,e),G(this,"id",1),G(this,"type",D),G(this,"codecType",O),G(this,"pid",-1),G(this,"hvcC",void 0),G(this,"codec",""),G(this,"timescale",0),G(this,"formatTimescale",0),G(this,"sequenceNumber",0),G(this,"baseMediaDecodeTime",0),G(this,"baseDts",0),G(this,"duration",0),G(this,"warnings",[]),G(this,"samples",[]),G(this,"pps",[]),G(this,"sps",[]),G(this,"vps",[]),G(this,"fpsNum",0),G(this,"fpsDen",0),G(this,"sarRatio",[]),G(this,"width",0),G(this,"height",0),G(this,"nalUnitSize",4),G(this,"present",!1),G(this,"isVideoEncryption",!1),G(this,"isAudioEncryption",!1),G(this,"isVideo",!0),G(this,"lastKeyFrameDts",0),G(this,"kid",null),G(this,"pssh",null),G(this,"ext",void 0)}return W(e,[{key:"reset",value:function(){this.sequenceNumber=this.width=this.height=this.fpsDen=this.fpsNum=this.duration=this.baseMediaDecodeTime=this.timescale=0,this.codec="",this.present=!1,this.pid=-1,this.pps=[],this.sps=[],this.vps=[],this.sarRatio=[],this.samples=[],this.warnings=[],this.hvcC=null}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var e=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-e.dts+t.duration}return 0}},{key:"exist",value:function(){return!!/av01/.test(this.codec)||!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isVideoEncryption}}]),e}(),ce=function(){function e(){X(this,e),G(this,"id",2),G(this,"type",B),G(this,"codecType",q),G(this,"pid",-1),G(this,"codec",""),G(this,"container",""),G(this,"sequenceNumber",0),G(this,"sampleDuration",0),G(this,"timescale",0),G(this,"formatTimescale",0),G(this,"baseMediaDecodeTime",0),G(this,"duration",0),G(this,"warnings",[]),G(this,"samples",[]),G(this,"baseDts",0),G(this,"sampleSize",16),G(this,"sampleRate",0),G(this,"channelCount",0),G(this,"objectType",0),G(this,"sampleRateIndex",0),G(this,"parsedCodec",null),G(this,"config",[]),G(this,"present",!1),G(this,"isVideoEncryption",!1),G(this,"isAudioEncryption",!1),G(this,"kid",null),G(this,"ext",void 0)}return W(e,[{key:"reset",value:function(){this.sequenceNumber=0,this.timescale=0,this.sampleDuration=0,this.sampleRate=0,this.channelCount=0,this.baseMediaDecodeTime=0,this.present=!1,this.pid=-1,this.codec="",this.samples=[],this.config=[],this.warnings=[]}},{key:"exist",value:function(){return!(!this.sampleRate||!this.channelCount||!this.codec&&!this.container||this.codecType!==q&&this.codecType!==$&&this.codecType!==ee&&this.codecType!==te&&this.codecType!==ie)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var e=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-e.dts+t.duration}return 0}}]),e}(),ue=function(){function e(t,i,n){X(this,e),G(this,"flag",{}),G(this,"keyframe",!1),G(this,"gopId",0),G(this,"duration",0),G(this,"size",0),G(this,"units",[]),G(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=i,n&&(this.units=n)}return W(e,[{key:"cts",get:function(){return this.pts-this.dts}},{key:"setToKeyframe",value:function(){this.keyframe=!0,this.flag.dependsOn=2,this.flag.isNonSyncSample=0}}]),e}(),me=W((function e(t,i,n,s){X(this,e),G(this,"duration",1024),G(this,"flag",{dependsOn:2,isNonSyncSample:0}),G(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=i,this.size=i.byteLength,this.sampleOffset=s,n&&(this.duration=n)})),he=W((function e(t,i){X(this,e),G(this,"time",0),this.data=t,this.originPts=this.pts=i})),pe=function(e){v(i,e);var t=w(i);function i(){return X(this,i),t.apply(this,arguments)}return W(i)}(he),ye=function(e){v(i,e);var t=w(i);function i(){return X(this,i),t.apply(this,arguments)}return W(i)}(he),Ze=function(){function e(){X(this,e),G(this,"id",3),G(this,"type",_),G(this,"timescale",0),G(this,"flvScriptSamples",[]),G(this,"seiSamples",[])}return W(e,[{key:"exist",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length||!this.timescale)}},{key:"reset",value:function(){this.timescale=0,this.flvScriptSamples=[],this.seiSamples=[]}},{key:"hasSample",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length)}}]),e}(),be=function(){function e(t){if(X(this,e),G(this,"_bytesAvailable",void 0),G(this,"_bitsAvailable",0),G(this,"_word",0),!t)throw new Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}return W(e,[{key:"bitsAvailable",get:function(){return this._bitsAvailable}},{key:"_loadWord",value:function(){var e=this._data.byteLength-this._bytesAvailable,t=Math.min(4,this._bytesAvailable);if(0===t)throw new Error("No bytes available");var i=new Uint8Array(4);i.set(this._data.subarray(e,e+t)),this._word=new DataView(i.buffer).getUint32(0),this._bitsAvailable=8*t,this._bytesAvailable-=t}},{key:"skipBits",value:function(e){if(this._bitsAvailable>e)this._word<<=e,this._bitsAvailable-=e;else{e-=this._bitsAvailable;var t=Math.floor(e/8);e-=8*t,this._bytesAvailable-=t,this._loadWord(),this._word<<=e,this._bitsAvailable-=e}}},{key:"readBits",value:function(e){if(e>32)throw new Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,e),i=this._word>>>32-t;return this._bitsAvailable-=t,this._bitsAvailable>0?this._word<<=t:this._bytesAvailable>0&&this._loadWord(),(t=e-t)>0&&this._bitsAvailable?i<<t|this.readBits(t):i}},{key:"skipLZ",value:function(){var e;for(e=0;e<this._bitsAvailable;++e)if(0!=(this._word&2147483648>>>e))return this._word<<=e,this._bitsAvailable-=e,e;return this._loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(e){for(var t=8,i=8,n=0;n<e;n++)0!==i&&(i=(t+this.readEG()+256)%256),t=0===i?t:i}}]),e}(),fe=function(){function e(t){X(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]")}return W(e,[{key:"warn",value:function(){var t;if(!e.disabled){for(var i=arguments.length,n=new Array(i),s=0;s<i;s++)n[s]=arguments[s];(t=console).warn.apply(t,[this._prefix].concat(n))}}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();G(fe,"disabled",!0);var Xe=function(){function e(){X(this,e)}return W(e,null,[{key:"decode",value:function(t){for(var i=[],n=t,s=0,a=t.length;s<a;)if(n[s]<128)i.push(String.fromCharCode(n[s])),++s;else{if(n[s]<192);else if(n[s]<224){if(e._checkContinuation(n,s,1)){var r=(31&n[s])<<6|63&n[s+1];if(r>=128){i.push(String.fromCharCode(65535&r)),s+=2;continue}}}else if(n[s]<240){if(e._checkContinuation(n,s,2)){var l=(15&n[s])<<12|(63&n[s+1])<<6|63&n[s+2];if(l>=2048&&55296!=(63488&l)){i.push(String.fromCharCode(65535&l)),s+=3;continue}}}else if(n[s]<248&&e._checkContinuation(n,s,3)){var o=(7&n[s])<<18|(63&n[s+1])<<12|(63&n[s+2])<<6|63&n[s+3];if(o>65536&&o<1114112){o-=65536,i.push(String.fromCharCode(o>>>10|55296)),i.push(String.fromCharCode(1023&o|56320)),s+=4;continue}}i.push(String.fromCharCode(65533)),++s}return i.join("")}},{key:"_checkContinuation",value:function(e,t,i){var n=e;if(t+i<n.length){for(;i--;)if(128!=(192&n[++t]))return!1;return!0}return!1}}]),e}(),Le="undefined"!=typeof window,We=Le&&navigator.userAgent.toLocaleLowerCase(),Ge=Le&&/^((?!chrome|android).)*safari/.test(We),ve=Le&&We.includes("firefox"),xe=Le&&We.includes("android");function Se(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];t=t.filter(Boolean);var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),s=0;return t.forEach((function(e){n.set(e,s),s+=e.byteLength})),n}var ge=Math.pow(2,32);function Ve(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function Ye(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function ke(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Ye(e,t)*ge+Ye(e,t+4)}function Re(e){for(var t,i="avc1.",n=0;n<3;n++)(t=e[n].toString(16)).length<2&&(t="0".concat(t)),i+=t;return i}function Te(e){var t="";if(e.forEach((function(e){t+=function(e){return("0"+Number(e).toString(16)).slice(-2).toUpperCase()}(e)})),t.length<=32)for(var i=32-t.length,n=0;n<i;n++)t+="0";return t}function we(e){if(!Array.isArray(e)){for(var t=[],i="",n=0;n<e.length;n++)n%2&&(i=e[n-1]+e[n],t.push(parseInt(i,16)),i="");return t}return e.map((function(e){return parseInt(e,16)}))}function Me(e,t){return Number(e+"."+t)}var Ke=function(){function e(){X(this,e)}return W(e,null,[{key:"getRateIndexByRate",value:function(t){return e.FREQ.indexOf(t)}},{key:"parseADTS",value:function(t,i){for(var n=t.length,s=0;s+2<n&&(255!==t[s]||240!=(246&t[s+1]));)s++;if(!(s>=n)){var a=s,r=[],l=(60&t[s+2])>>>2,o=e.FREQ[l];if(!o)throw new Error("Invalid sampling index: ".concat(l));for(var d,c,u=1+((192&t[s+2])>>>6),m=(1&t[s+2])<<2|(192&t[s+3])>>>6,h=e._getConfig(l,m,u),p=h.config,y=h.codec,Z=0,b=e.getFrameDuration(o);s+7<n;)if(255===t[s]&&240==(246&t[s+1])){if(!(c=(3&t[s+3])<<11|t[s+4]<<3|(224&t[s+5])>>5)||n-s<c)break;d=2*(1&~t[s+1]),r.push({pts:i+Z*b,data:t.subarray(s+7+d,s+c)}),Z++,s+=c}else s++;return{skip:a,remaining:s>=n?void 0:t.subarray(s),frames:r,samplingFrequencyIndex:l,sampleRate:o,objectType:u,channelCount:m,codec:y,config:p,originCodec:"mp4a.40.".concat(u)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var i=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,s=(120&t[1])>>>3,a=e.FREQ[n];if(a){var r=e._getConfig(n,s,i);return{samplingFrequencyIndex:n,sampleRate:a,objectType:i,channelCount:s,config:r.config,codec:r.codec,originCodec:"mp4a.40.".concat(i)}}}}},{key:"getFrameDuration",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return 1024*t/e}},{key:"_getConfig",value:function(e,t,i){var n,s,a=[];return ve?e>=6?(n=5,s=e-3):(n=2,s=e):xe?(n=2,s=e):(n=5,s=e,e>=6?s=e-3:1===t&&(n=2,s=e)),a[0]=n<<3,a[0]|=(14&e)>>1,a[1]=(1&e)<<7,a[1]|=t<<3,5===n&&(a[1]|=(14&s)>>1,a[2]=(1&s)<<7,a[2]|=8,a[3]=0),{config:a,codec:"mp4a.40.".concat(n)}}},{key:"getSilentFrame",value:function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}]),e}();G(Ke,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var Ie=function(){function e(){X(this,e)}return W(e,null,[{key:"parseAnnexB",value:function(e){var t=e.byteLength-1,i=0;do{if(0!==e[t])break;i++,t--}while(t>0);i>=3&&(e=e.subarray(0,t+1));for(var n=e.length,s=2,a=0;null!==e[s]&&void 0!==e[s]&&1!==e[s];)s++;if((a=++s+2)>=n)return[];for(var r=[];a<n;)switch(e[a]){case 0:if(0!==e[a-1]){a+=2;break}if(0!==e[a-2]){a++;break}if(a<n-1&&1!==e[a+1]){a++;break}s!==a-2&&r.push(e.subarray(s,a-2));do{a++}while(1!==e[a]&&a<n);a=(s=a+1)+2;break;case 1:if(0!==e[a-1]||0!==e[a-2]){a+=3;break}s!==a-2&&r.push(e.subarray(s,a-2)),a=(s=a+1)+2;break;default:a+=3}return s<n&&r.push(e.subarray(s)),r}},{key:"parseAvcC",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(!(e.length<4)){for(var i,n=e.length,s=[],a=0;a+t<n;)if(i=Ye(e,a),3===t&&(i>>>=8),a+=t,i){if(a+i>n)break;s.push(e.subarray(a,a+i)),a+=i}return s}}},{key:"parseSEI",value:function(e,t){for(var i=e.length,n=t?2:1,s=0,a=0,r="";255===e[n];)s+=255,n++;for(s+=e[n++];255===e[n];)a+=255,n++;if(a+=e[n++],5===s&&i>n+16)for(var l=0;l<16;l++)r+=e[n].toString(16),n++;return{payload:e.subarray(n,n+a),type:s,size:a,uuid:r}}},{key:"removeEPB",value:function(e){for(var t=e.byteLength,i=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(i.push(n+2),n+=2):n++;if(!i.length)return e;var s=t-i.length,a=new Uint8Array(s),r=0;for(n=0;n<s;r++,n++)r===i[0]&&(r++,i.shift()),a[n]=e[r];return a}}]),e}(),Ce=function(){function e(){X(this,e)}return W(e,null,[{key:"parseAVCDecoderConfigurationRecord",value:function(t){if(!(t.length<7)){for(var i,n,s=1+(3&t[4]),a=[],r=[],l=6,o=31&t[5],d=0;d<o;d++)if(n=t[l]<<8|t[l+1],l+=2,n){var c=t.subarray(l,l+n);l+=n,a.push(c),i||(i=e.parseSPS(Ie.removeEPB(c)))}var u,m=t[l];l++;for(var h=0;h<m;h++)u=t[l]<<8|t[l+1],l+=2,u&&(r.push(t.subarray(l,l+u)),l+=u);return{sps:i,spsArr:a,ppsArr:r,nalUnitSize:s}}}},{key:"parseSPS",value:function(e){var t=new be(e);t.readUByte();var i=t.readUByte(),n=t.readUByte(),s=t.readUByte();t.skipUEG();var a=420;if(100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i){var r=t.readUEG();if(r<=3&&(a=[0,420,422,444][r]),3===r&&t.skipBits(1),t.skipUEG(),t.skipUEG(),t.skipBits(1),t.readBool())for(var l=3!==r?8:12,o=0;o<l;o++)t.readBool()&&(o<6?t.skipScalingList(16):t.skipScalingList(64))}t.skipUEG();var d=t.readUEG();if(0===d)t.readUEG();else if(1===d){t.skipBits(1),t.skipUEG(),t.skipUEG();for(var c=t.readUEG(),u=0;u<c;u++)t.skipUEG()}t.skipUEG(),t.skipBits(1);var m=t.readUEG(),h=t.readUEG(),p=t.readBits(1);0===p&&t.skipBits(1),t.skipBits(1);var y,Z,b,f,X,L=0,W=0,G=0,v=0;if(t.readBool()&&(L=t.readUEG(),W=t.readUEG(),G=t.readUEG(),v=t.readUEG()),t.readBool()){if(t.readBool())switch(t.readUByte()){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:y=[t.readUByte()<<8|t.readUByte(),t.readUByte()<<8|t.readUByte()]}if(t.readBool()&&t.readBool(),t.readBool()&&(t.readBits(4),t.readBool()&&t.readBits(24)),t.readBool()&&(t.readUEG(),t.readUEG()),t.readBool()){var x=t.readBits(32),S=t.readBits(32);Z=t.readBool(),X=(b=S)/(f=2*x)}}return{codec:Re(e.subarray(1,4)),profileIdc:i,profileCompatibility:n,levelIdc:s,chromaFormat:a,width:Math.ceil(16*(m+1)-2*(L+W)),height:(2-p)*(h+1)*16-(p?2:4)*(G+v),sarRatio:y,fpsNum:b,fpsDen:f,fps:X,fixedFrame:Z}}}]),e}(),He=function(){function e(){X(this,e)}return W(e,null,[{key:"parseHEVCDecoderConfigurationRecord",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(t.length<23)){i=i||{};for(var n,s,a,r,l,o=1+(3&t[21]),d=[],c=[],u=[],m=23,h=t[22],p=0;p<h;p++){a=63&t[m],r=t[m+1]<<8|t[m+2],m+=3;for(var y=0;y<r;y++)if(l=t[m]<<8|t[m+1],m+=2,l){switch(a){case 32:var Z=t.subarray(m,m+l);n||(n=e.parseVPS(Ie.removeEPB(Z),i)),u.push(Z);break;case 33:var b=t.subarray(m,m+l);s||(s=e.parseSPS(Ie.removeEPB(b),i)),d.push(b);break;case 34:c.push(t.subarray(m,m+l))}m+=l}}return{hvcC:i,sps:s,spsArr:d,ppsArr:c,vpsArr:u,nalUnitSize:o}}}},{key:"parseVPS",value:function(t,i){i=i||{};var n=new be(t);n.readUByte(),n.readUByte(),n.readBits(12);var s=n.readBits(3);return i.numTemporalLayers=Math.max(i.numTemporalLayers||0,s+1),n.readBits(17),e._parseProfileTierLevel(n,s,i),i}},{key:"parseSPS",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i=i||{};var n=new be(t);n.readUByte(),n.readUByte(),n.readBits(4);var s=n.readBits(3);i.numTemporalLayers=Math.max(s+1,i.numTemporalLayers||0),i.temporalIdNested=n.readBits(1),e._parseProfileTierLevel(n,s,i),n.readUEG();var a=i.chromaFormatIdc=n.readUEG(),r=420;a<=3&&(r=[0,420,422,444][a]);var l=0;3===a&&(l=n.readBits(1));var o,d,c,u,m=n.readUEG(),h=n.readUEG(),p=n.readBits(1);if(1===p&&(o=n.readUEG(),d=n.readUEG(),c=n.readUEG(),u=n.readUEG()),i.bitDepthLumaMinus8=n.readUEG(),i.bitDepthChromaMinus8=n.readUEG(),1===p){var y=1!==a&&2!==a||0!==l?1:2,Z=1===a&&0===l?2:1;m-=y*(d+o),h-=Z*(u+c)}return{codec:"hev1.1.6.L93.B0",width:m,height:h,chromaFormat:r,hvcC:i}}},{key:"_parseProfileTierLevel",value:function(e,t,i){var n=i.generalTierFlag||0;i.generalProfileSpace=e.readBits(2),i.generalTierFlag=Math.max(e.readBits(1),n),i.generalProfileIdc=Math.max(e.readBits(5),i.generalProfileIdc||0),i.generalProfileCompatibilityFlags=e.readBits(32),i.generalConstraintIndicatorFlags=[e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8)];var s=e.readBits(8);n<i.generalTierFlag?i.generalLevelIdc=s:i.generalLevelIdc=Math.max(s,i.generalLevelIdc||0);var a=[],r=[];if(t>e.bitsAvailable)throw new Error("maxSubLayersMinus inavlid size ".concat(t));for(var l=0;l<t;l++)a[l]=e.readBits(1),r[l]=e.readBits(1);t>0&&e.readBits(2*(8-t));for(var o=0;o<t;o++)0!==a[o]&&(e.readBits(2),e.readBits(1),e.readBits(5),e.readBits(16),e.readBits(16),e.readBits(4),e.readBits(16),e.readBits(16),e.readBits(12)),0!==r[o]&&e.readBits(8)}}]),e}(),Ne=function(){function e(){X(this,e)}return W(e,null,[{key:"getFrameDuration",value:function(e){return 20}},{key:"parseHeaderPackets",value:function(e){if(e.length){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i="",n=0;n<8;n++)i+=String.fromCodePoint(e[n]);if("OpusHead"!==i)throw new Error("Invalid Opus MagicSignature");var s=e[9];console.log("Pre-skip",e[10],e[11]);var a=t.getUint32(12,!0),r=t.getInt16(16,!0);if(a){return{outputGain:r,sampleRate:a,channelCount:s,config:new Uint8Array(e.buffer,e.byteOffset+8,e.byteLength-8),codec:"opus",originCodec:"opus"}}}}}]),e}(),ze=1e3,Fe=5e3,Ue=function(){function e(t,i,n){X(this,e),this.videoTrack=t,this.audioTrack=i,this.metadataTrack=n,this._baseDts=-1,this._baseDtsInited=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=0,this._videoTimestampBreak=0,this._lastVideoDuration=0,this._keyFrameInNextChunk=!1,this._lastAudioExceptionGapDot=-1/0,this._lastAudioExceptionOverlapDot=-1/0,this._lastAudioExceptionLargeGapDot=-1/0,this._lastVideoExceptionLargeGapDot=-1/0,this._lastVideoExceptionChunkFirstDtsDot=-1/0}return W(e,[{key:"fix",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t=Math.round(1e3*t);var s=this.videoTrack,a=this.audioTrack;!i&&n||(this._videoLastSample=null,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=0,this._videoTimestampBreak=0,this._lastAudioExceptionGapDot=-1/0,this._lastAudioExceptionOverlapDot=-1/0,this._lastAudioExceptionLargeGapDot=-1/0,this._lastVideoExceptionLargeGapDot=-1/0,this._lastVideoExceptionChunkFirstDtsDot=-1/0),i&&!n&&(this._baseDtsInited=!1),this._baseDtsInited||this._calculateBaseDts(a,s),!n&&t&&(this._audioNextPts=this._videoNextDts=t);var r=this._baseDtsInited&&(this._videoTimestampBreak||!this.videoTrack.exist())&&(this._audioTimestampBreak||!this.audioTrack.exist());if(r&&this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(a),this._keyFrameInNextChunk=!1,this._fixVideo(s),this.metadataTrack.exist()){var l=this.metadataTrack.timescale;this.metadataTrack.seiSamples.forEach((function(t){t.pts=t.originPts-e._baseDts,t.time=Math.max(0,t.pts)/l})),this.metadataTrack.flvScriptSamples.forEach((function(t){t.pts=t.originPts-e._baseDts,t.time=Math.max(0,t.pts)/l}))}s.samples.length&&(s.baseMediaDecodeTime=s.samples[0].dts),a.samples.length&&(a.baseMediaDecodeTime=a.samples[0].pts*a.timescale/1e3)}},{key:"_fixVideo",value:function(e){var t=this,i=e.samples;if(i.length){var n;if(i.forEach((function(e){e.dts-=t._baseDts,e.pts-=t._baseDts,e.keyframe&&(t._keyFrameInNextChunk=!0)})),e.fpsNum&&e.fpsDen)n=e.timescale*(e.fpsDen/e.fpsNum);else if(e.length>1){var s=e.samples[0],a=e.samples[i.length-1];n=Math.floor((a.dts-s.dts)/(i.length-1))}else n=this._lastVideoDuration||40;var r=i.pop();if(this._videoLastSample&&i.unshift(this._videoLastSample),this._videoLastSample=r,i.length){if(void 0===this._videoNextDts){var l=i[0];this._videoNextDts=l.dts}var o=i.length,d=0,c=i[0],u=this._videoNextDts-c.dts;if(Math.abs(u)>200){var m;if(Math.abs(c.dts-this._lastVideoExceptionChunkFirstDtsDot)>5e3)this._lastVideoExceptionChunkFirstDtsDot=c.dts,e.warnings.push({type:ae,nextDts:this._videoNextDts,firstSampleDts:c.dts,nextSampleDts:null===(m=i[1])||void 0===m?void 0:m.dts,sampleDuration:u});this._videoTimestampBreak>=5?(this._videoNextDts=c.dts,this._videoTimestampBreak=0):(c.dts+=u,c.pts+=u,this.audioTrack.exist()||(this._videoTimestampBreak=1))}for(var h=0;h<o;h++){var p=i[h].dts,y=i[h+1];((d=h<o-1?y.dts-p:r?r.dts-p:n)>1e3||d<0)&&(this._videoTimestampBreak++,Math.abs(p-this._lastVideoExceptionLargeGapDot)>5e3&&(this._lastVideoExceptionLargeGapDot=p,e.warnings.push({type:se,time:p/e.timescale,dts:p,originDts:i[h].originDts,nextDts:this._videoNextDts,sampleDuration:d,refSampleDuration:n})),d=n),i[h].duration=d,this._videoNextDts+=d,this._lastVideoDuration=d}}}}},{key:"_fixAudio",value:function(e){var t=this,i=e.samples;i.length&&(i.forEach((function(e){e.dts=e.pts-=t._baseDts})),this._doFixAudioInternal(e,i,1e3))}},{key:"_calculateBaseDts",value:function(e,t){var i=e.samples,n=t.samples;if(!i.length&&!n.length)return!1;var s=1/0,a=1/0;i.length&&(e.baseDts=s=i[0].pts),n.length&&(t.baseDts=a=n[0].dts),this._baseDts=Math.min(s,a);var r=a-s;return Number.isFinite(r)&&Math.abs(r)>500&&t.warnings.push({type:ne,videoBaseDts:a,audioBasePts:s,baseDts:this._baseDts,delta:r}),this._baseDtsInited=!0,!0}},{key:"_resetBaseDtsWhenStreamBreaked",value:function(){this._calculateBaseDts(this.audioTrack,this.videoTrack)&&(this.audioTrack.exist()?this.videoTrack.exist()?this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts):this._baseDts-=this._audioNextPts:this._baseDts-=this._videoNextDts,this._videoTimestampBreak=0,this._audioTimestampBreak=0)}},{key:"_doFixAudioInternal",value:function(e,t,i){if(!e.sampleDuration)switch(e.codecType){case q:e.sampleDuration=Ke.getFrameDuration(e.timescale,i);break;case te:e.sampleDuration=Ne.getFrameDuration(e.samples,i);break;case $:case ee:e.sampleDuration=this._getG711Duration(e);break;default:console.error("can't fix audio codecType:",e.codecType)}var n=e.sampleDuration,s=e.codecType===te?20:e.codecType===q?1024:n*e.timescale/1e3;if(void 0===this._audioNextPts){var a=t[0];this._audioNextPts=a.pts}for(var r=0;r<t.length;r++){var l=this._audioNextPts,o=t[r],d=o.pts-l;if(0===r&&this._audioTimestampBreak>=5&&this._keyFrameInNextChunk&&(l=this._audioNextPts=o.dts,d=0,this._audioTimestampBreak=0),!this._audioTimestampBreak&&d>=3*n&&d<=ze&&!Ge){var c=this._getSilentFrame(e)||t[0].data.subarray(),u=Math.floor(d/n);Math.abs(o.pts-this._lastAudioExceptionGapDot)>Fe&&(this._lastAudioExceptionGapDot=o.pts,e.warnings.push({type:le,pts:o.pts,originPts:o.originPts,count:u,nextPts:l,refSampleDuration:n}));for(var m=0;m<u;m++){var h=new me(Math.floor(this._audioNextPts+n)-Math.floor(this._audioNextPts),c,s);h.originPts=Math.floor(this._baseDts+l),t.splice(r,0,h),this._audioNextPts+=n,r++}r--}else if(d<=-3*n&&d>=-1e3)Math.abs(o.pts-this._lastAudioExceptionOverlapDot)>Fe&&(this._lastAudioExceptionOverlapDot=o.pts,e.warnings.push({type:oe,pts:o.pts,originPts:o.originPts,nextPts:l,refSampleDuration:n})),t.splice(r,1),r--;else{if(Math.abs(d)>ze&&(this._audioTimestampBreak++,Math.abs(o.pts-this._lastAudioExceptionLargeGapDot)>Fe&&(this._lastAudioExceptionLargeGapDot=o.pts,e.warnings.push({type:re,time:o.pts/1e3,pts:o.pts,originPts:o.originPts,nextPts:l,sampleDuration:d,refSampleDuration:n}))),e.codecType===te){var p=t[t.length-1];p&&(p.duration=o.pts-p.pts)}else o.dts=o.pts=l,o.duration=s;this._audioNextPts+=n}}}},{key:"_getG711Duration",value:function(e){var t=e.sampleSize,i=e.channelCount,n=e.sampleRate,s=e.samples[0];if(s)return 2*s.data.byteLength/i/(t/8)/n*1e3}},{key:"_getSilentFrame",value:function(e){return e.codecType===q?Ke.getSilentFrame(e.codec,e.channelCount):new Uint8Array(8*e.sampleDuration*e.channelCount)}}]),e}(),Je=function(){function e(){X(this,e)}return W(e,null,[{key:"parse",value:function(t){if(!(t.length<3)){var i={},n=e._parseValue(new DataView(t.buffer,t.byteOffset,t.byteLength)),s=e._parseValue(new DataView(t.buffer,t.byteOffset+n.size,t.b