@byteplus/veplayer-plugin 2.3.0-rc.0
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.
- package/LICENSE +18 -0
- package/README.md +22 -0
- package/esm/flv.d.ts +3 -0
- package/esm/hls.d.ts +3 -0
- package/esm/index.d.ts +8 -0
- package/esm/index.development.css +63 -0
- package/esm/index.development.js +92379 -0
- package/esm/index.production.css +1 -0
- package/esm/index.production.js +26 -0
- package/esm/mp4.d.ts +3 -0
- package/esm/rtm.d.ts +3 -0
- package/esm/shaka.d.ts +3 -0
- package/esm/veplayer.plugin.drm.development.js +1577 -0
- package/esm/veplayer.plugin.drm.production.js +2 -0
- package/esm/veplayer.plugin.flv.development.js +11097 -0
- package/esm/veplayer.plugin.flv.production.js +2 -0
- package/esm/veplayer.plugin.hls.development.js +14461 -0
- package/esm/veplayer.plugin.hls.production.js +2 -0
- package/esm/veplayer.plugin.mp4.development.js +38039 -0
- package/esm/veplayer.plugin.mp4.production.js +2 -0
- package/esm/veplayer.plugin.rtm.development.js +5587 -0
- package/esm/veplayer.plugin.rtm.production.js +2 -0
- package/esm/veplayer.plugin.shaka.development.js +15973 -0
- package/esm/veplayer.plugin.shaka.production.js +20 -0
- package/esm/veplayer.plugin.time.shift.development.css +63 -0
- package/esm/veplayer.plugin.time.shift.development.js +339 -0
- package/esm/veplayer.plugin.time.shift.production.css +1 -0
- package/esm/veplayer.plugin.time.shift.production.js +2 -0
- package/esm/veplayer.plugin.xgvideo.development.js +19097 -0
- package/esm/veplayer.plugin.xgvideo.production.js +2 -0
- package/esm/xgvideo.d.ts +3 -0
- package/package.json +161 -0
- package/umd/flv.d.ts +3 -0
- package/umd/hls.d.ts +3 -0
- package/umd/index.d.ts +8 -0
- package/umd/index.development.js +92050 -0
- package/umd/index.production.js +1 -0
- package/umd/mp4.d.ts +3 -0
- package/umd/rtm.d.ts +3 -0
- package/umd/shaka.d.ts +3 -0
- package/umd/veplayer.plugin.drm.development.js +1579 -0
- package/umd/veplayer.plugin.drm.production.js +1 -0
- package/umd/veplayer.plugin.flv.development.js +11102 -0
- package/umd/veplayer.plugin.flv.production.js +1 -0
- package/umd/veplayer.plugin.hls.development.js +14463 -0
- package/umd/veplayer.plugin.hls.production.js +1 -0
- package/umd/veplayer.plugin.mp4.development.js +38043 -0
- package/umd/veplayer.plugin.mp4.production.js +1 -0
- package/umd/veplayer.plugin.rtm.development.js +5589 -0
- package/umd/veplayer.plugin.rtm.production.js +1 -0
- package/umd/veplayer.plugin.shaka.development.js +15977 -0
- package/umd/veplayer.plugin.shaka.production.js +1 -0
- package/umd/veplayer.plugin.time.shift.development.css +63 -0
- package/umd/veplayer.plugin.time.shift.development.js +342 -0
- package/umd/veplayer.plugin.time.shift.production.css +1 -0
- package/umd/veplayer.plugin.time.shift.production.js +1 -0
- package/umd/veplayer.plugin.xgvideo.development.js +19099 -0
- package/umd/veplayer.plugin.xgvideo.production.js +1 -0
- package/umd/xgvideo.d.ts +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@byted/veplayer")):"function"==typeof define&&define.amd?define(["exports","@byted/veplayer"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).__VEPLAYER_PLUGINS__={},e.veplayer)}(this,(function(e,t){"use strict";var n=Object.defineProperty,r=(e,t,r)=>(((e,t,r)=>{t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);function i(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 o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(){a=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(I){c=function(e,t,n){return e[t]=n}}function l(e,t,n,i){var o=t&&t.prototype instanceof f?t:f,a=Object.create(o.prototype),s=new x(i||[]);return r(a,"_invoke",{value:w(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(I){return{type:"throw",arg:I}}}e.wrap=l;var h={};function f(){}function p(){}function m(){}var y={};c(y,o,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(E([])));g&&g!==t&&n.call(g,o)&&(y=g);var b=m.prototype=f.prototype=Object.create(y);function A(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(r,o,a,s){var u=d(e[r],e,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(l).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function w(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=S(a,n);if(s){if(s===h)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=d(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function S(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var i=d(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,h;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function k(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 T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function E(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=m,r(b,"constructor",{value:m,configurable:!0}),r(m,"constructor",{value:p,configurable:!0}),p.displayName=c(m,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},A(_.prototype),c(_.prototype,s,(function(){return this})),e.AsyncIterator=_,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new _(l(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},A(b),c(b,u,"Generator"),c(b,o,(function(){return this})),c(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=E,x.prototype={constructor:x,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(T),!e)for(var t in this)"t"===t.charAt(0)&&n.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 r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},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),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},e}function s(e){return(s="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 u(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(c){return void n(c)}s.done?t(u):Promise.resolve(u).then(r,i)}function c(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){u(o,r,i,a,s,"next",e)}function s(e){u(o,r,i,a,s,"throw",e)}a(void 0)}))}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,b(r.key),r)}}function h(e,t,n){return t&&d(e.prototype,t),n&&d(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e,t,n){return(t=b(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(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&&y(e,t)}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t){return(y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e){var t=function(){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}}();return function(){var n,r=m(e);if(t){var i=m(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(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 v(e)}(this,n)}}function b(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function A(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 _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A(Object(n),!0).forEach((function(t){x(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function w(e){return(w="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 S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,I(r.key),r)}}function T(e,t,n){return t&&k(e.prototype,t),n&&k(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function x(e,t,n){return(t=I(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(e){return function(e){if(Array.isArray(e))return L(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return L(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return L(e,t)}(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 L(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function I(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;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 R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Z(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var C={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||e,a),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,a=new Array(o);i<o;i++)a[i]=r[i].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,o,a){var s=n?n+e:e;if(!this._events[s])return!1;var u,c,l=this._events[s],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,i),!0;case 5:return l.fn.call(l.context,t,r,i,o),!0;case 6:return l.fn.call(l.context,t,r,i,o,a),!0}for(c=1,u=new Array(d-1);c<d;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var h,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),d){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,r);break;case 4:l[c].fn.call(l[c].context,t,r,i);break;default:if(!u)for(h=1,u=new Array(d-1);h<d;h++)u[h-1]=arguments[h];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||r&&s.context!==r||a(this,o);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==t||i&&!s[u].once||r&&s[u].context!==r)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}(C);var P=Z(C.exports),G="undefined"!=typeof window&&window.location&&window.location.href.indexOf("xgplayerdebugger=1")>-1,D={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},M="%c[xgplayer]",V={config:{debug:G?3:0},logInfo:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];this.config.debug>=3&&(t=console).log.apply(t,[M,D.info,e].concat(r))},logWarn:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];this.config.debug>=1&&(t=console).warn.apply(t,[M,D.warn,e].concat(r))},logError:function(e){var t;if(!(this.config.debug<1)){for(var n=this.config.debug>=2?"trace":"error",r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];(t=console)[n].apply(t,[M,D.error,e].concat(i))}}},X=function(){function e(t){S(this,e),this.bufferedList=t}return T(e,[{key:"start",value:function(e){return this.bufferedList[e].start}},{key:"end",value:function(e){return this.bufferedList[e].end}},{key:"length",get:function(){return this.bufferedList.length}}]),e}(),W={};W.createDom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=document.createElement(e);return i.className=r,i.innerHTML=t,Object.keys(n).forEach((function(t){var r=t,o=n[t];"video"===e||"audio"===e||"live-video"===e?o&&i.setAttribute(r,o):i.setAttribute(r,o)})),i},W.createDomFromHtml=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";try{var r=document.createElement("div");r.innerHTML=e;var i=r.children;return r=null,i.length>0?(i=i[0],n&&W.addClass(i,n),t&&Object.keys(t).forEach((function(e){i.setAttribute(e,t[e])})),i):null}catch(o){return V.logError("util.createDomFromHtml",o),null}},W.hasClass=function(e,t){if(!e||!t)return!1;try{return Array.prototype.some.call(e.classList,(function(e){return e===t}))}catch(r){var n=e.className&&"object"===w(e.className)?e.getAttribute("class"):e.className;return n&&!!n.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},W.addClass=function(e,t){if(e&&t)try{t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.add(t)}))}catch(n){W.hasClass(e,t)||(e.className&&"object"===w(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},W.removeClass=function(e,t){if(e&&t)try{t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.remove(t)}))}catch(n){W.hasClass(e,t)&&t.split(/\s+/g).forEach((function(t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===w(e.className)?e.setAttribute("class",e.getAttribute("class").replace(n," ")):e.className=e.className.replace(n," ")}))}},W.toggleClass=function(e,t){e&&t.split(/\s+/g).forEach((function(t){W.hasClass(e,t)?W.removeClass(e,t):W.addClass(e,t)}))},W.classNames=function(){for(var e=arguments,t=[],n=function(n){"String"===W.typeOf(e[n])?t.push(e[n]):"Object"===W.typeOf(e[n])&&Object.keys(e[n]).map((function(r){e[n][r]&&t.push(r)}))},r=0;r<arguments.length;r++)n(r);return t.join(" ")},W.findDom=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,n=arguments.length>1?arguments[1]:void 0;try{e=t.querySelector(n)}catch(r){V.logError("util.findDom",r),0===n.indexOf("#")&&(e=t.getElementById(n.slice(1)))}return e},W.getCss=function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},W.padStart=function(e,t,n){for(var r=String(n),i=t>>0,o=Math.ceil(i/r.length),a=[],s=String(e);o--;)a.push(r);return a.join("").substring(0,i-s.length)+s},W.format=function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=W.padStart(Math.floor(e/3600),2,0),n=W.padStart(Math.floor((e-3600*t)/60),2,0),r=W.padStart(Math.floor(e-3600*t-60*n),2,0);return("00"===t?[n,r]:[t,n,r]).join(":")},W.event=function(e){if(e.touches){var t=e.touches[0]||e.changedTouches[0];e.clientX=t.clientX||0,e.clientY=t.clientY||0,e.offsetX=t.pageX-t.target.offsetLeft,e.offsetY=t.pageY-t.target.offsetTop}e._target=e.target||e.srcElement},W.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},W.deepCopy=function(e,t){if("Object"===W.typeOf(t)&&"Object"===W.typeOf(e))return Object.keys(t).forEach((function(n){"Object"!==W.typeOf(t[n])||t[n]instanceof Node?"Array"===W.typeOf(t[n])?e[n]="Array"===W.typeOf(e[n])?e[n].concat(t[n]):t[n]:e[n]=t[n]:void 0===e[n]||void 0===e[n]?e[n]=t[n]:W.deepCopy(e[n],t[n])})),e},W.deepMerge=function(e,t){return Object.keys(t).map((function(n){var r;"Array"===W.typeOf(t[n])&&"Array"===W.typeOf(e[n])?"Array"===W.typeOf(e[n])&&(r=e[n]).push.apply(r,E(t[n])):W.typeOf(e[n])!==W.typeOf(t[n])||null===e[n]||"Object"!==W.typeOf(e[n])||t[n]instanceof window.Node?null!==t[n]&&(e[n]=t[n]):W.deepMerge(e[n],t[n])})),e},W.getBgImage=function(e){var t=(e.currentStyle||window.getComputedStyle(e,null)).backgroundImage;if(!t||"none"===t)return"";var n=document.createElement("a");return n.href=t.replace(/url\("|"\)/g,""),n.href},W.copyDom=function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return Array.prototype.forEach.call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},W.setInterval=function(e,t,n,r){e._interval[t]||(e._interval[t]=window.setInterval(n.bind(e),r))},W.clearInterval=function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},W.setTimeout=function(e,t,n){e._timers||(e._timers=[]);var r=setTimeout((function(){t(),W.clearTimeout(e,r)}),n);return e._timers.push(r),r},W.clearTimeout=function(e,t){var n=e._timers;if("Array"===W.typeOf(n)){for(var r=0;r<n.length;r++)if(n[r]===t){n.splice(r,1),clearTimeout(t);break}}else clearTimeout(t)},W.clearAllTimers=function(e){var t=e._timers;"Array"===W.typeOf(t)&&(t.map((function(e){clearTimeout(e)})),e._timerIds=[])},W.createImgBtn=function(e,t,n,r){var i,o,a,s=W.createDom("xg-".concat(e),"",{},"xgplayer-".concat(e,"-img"));(s.style.backgroundImage='url("'.concat(t,'")'),n&&r)&&(["px","rem","em","pt","dp","vw","vh","vm","%"].every((function(e){return!(n.indexOf(e)>-1&&r.indexOf(e)>-1)||(i=parseFloat(n.slice(0,n.indexOf(e)).trim()),o=parseFloat(r.slice(0,r.indexOf(e)).trim()),a=e,!1)})),s.style.width="".concat(i).concat(a),s.style.height="".concat(o).concat(a),s.style.backgroundSize="".concat(i).concat(a," ").concat(o).concat(a),s.style.margin="start"===e?"-".concat(o/2).concat(a," auto auto -").concat(i/2).concat(a):"auto 5px auto 5px");return s},W.Hex2RGBA=function(e,t){var n=[];if(/^\#[0-9A-F]{3}$/i.test(e)){var r="#";e.replace(/[0-9A-F]/gi,(function(e){r+=e+e})),e=r}return/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,(function(e){n.push(parseInt(e,16))})),"rgba(".concat(n.join(","),", ").concat(t,")")):"rgba(255, 255, 255, 0.1)"},W.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},W.checkIsFunction=function(e){return e&&"function"==typeof e},W.checkIsObject=function(e){return null!==e&&"object"===w(e)},W.hide=function(e){e.style.display="none"},W.show=function(e,t){e.style.display=t||"block"},W.isUndefined=function(e){if(null==e)return!0},W.isNotNull=function(e){return!(null==e)},W.setStyleFromCsstext=function(e,t){t&&("String"===W.typeOf(t)?t.replace(/\s+/g,"").split(";").map((function(t){if(t){var n=t.split(":");n.length>1&&(e.style[n[0]]=n[1])}})):Object.keys(t).map((function(n){e.style[n]=t[n]})))},W.filterStyleFromText=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],n=e.style.cssText;if(!n)return{};var r=n.replace(/\s+/g,"").split(";"),i={},o={};return r.map((function(e){if(e){var n=e.split(":");n.length>1&&(!function(e,t){for(var n=0,r=t.length;n<r;n++)if(e.indexOf(t[n])>-1)return!0;return!1}(n[0],t)?o[n[0]]=n[1]:i[n[0]]=n[1])}})),e.setAttribute("style",""),Object.keys(o).map((function(t){e.style[t]=o[t]})),i},W.getStyleFromCsstext=function(e){var t=e.style.cssText;if(!t)return{};var n=t.replace(/\s+/g,"").split(";"),r={};return n.map((function(e){if(e){var t=e.split(":");t.length>1&&(r[t[0]]=t[1])}})),r},W.preloadImg=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(e){var r=new window.Image;r.onload=function(e){r=null,t&&t(e)},r.onerror=function(e){r=null,n&&n(e)},r.src=e}},W.stopPropagation=function(e){e&&e.stopPropagation()},W.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},W.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},W.checkTouchSupport=function(){return"ontouchstart"in window},W.getBuffered2=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,n=[],r=0;r<e.length;r++)n.push({start:e.start(r)<.5?0:e.start(r),end:e.end(r)});n.sort((function(e,t){var n=e.start-t.start;return n||t.end-e.end}));var i=[];if(t)for(var o=0;o<n.length;o++){var a=i.length;if(a){var s=i[a-1].end;n[o].start-s<t?n[o].end>s&&(i[a-1].end=n[o].end):i.push(n[o])}else i.push(n[o])}else i=n;return new X(i)},W.getEventPos=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.touches&&e.touches.length>0&&(e=e.touches[0]),{x:e.x/t,y:e.y/t,clientX:e.clientX/t,clientY:e.clientY/t,offsetX:e.offsetX/t,offsetY:e.offsetY/t,pageX:e.pageX/t,pageY:e.pageY/t}},W.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},W.getHostFromUrl=function(e){if("String"!==W.typeOf(e))return"";var t=e.split("/"),n="";return t.length>3&&t[2]&&(n=t[2]),n},W.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},W.isMSE=function(e){return!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},W.isBlob=function(e){return"string"==typeof e&&/^blob/.test(e)},W.generateSessionId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=(new Date).getTime();try{e=parseInt(e)}catch(n){e=0}return t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=parseInt(window.performance.now())),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))},W.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},W.adjustTimeByDuration=function(e,t,n){return t&&e&&(e>t||n&&e<t)?t:e},W.createPositionBar=function(e,t){var n=W.createDom("xg-bar","",{"data-index":-1},e);return t.appendChild(n),n},W.getTransformStyle=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n={scale:"".concat(e.scale||1),translate:"".concat(e.x||0,"%, ").concat(e.y||0,"%"),rotate:"".concat(e.rotate||0,"deg")};return Object.keys(n).forEach((function(e){var r=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),i="".concat(e,"(").concat(n[e],")");r.test(t)?(r.lastIndex=-1,t=t.replace(r,i)):t+="".concat(i," ")})),t},W.convertDeg=function(e){return Math.abs(e)<=1?360*e:e%360},W.getIndexByTime=function(e,t){var n=t.length,r=-1;if(n<1)return r;if(e<=t[0].end||n<2)r=0;else if(e>t[n-1].end)r=n-1;else for(var i=1;i<n;i++)if(e>t[i-1].end&&e<=t[i].end){r=i;break}return r},W.getOffsetCurrentTime=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=-1;if((r=n>=0&&n<t.length?n:W.getIndexByTime(e,t))<0)return-1;var i=t.length,o=t[r],a=o.start,s=o.end,u=o.cTime,c=o.offset;return e<a?u:e>=a&&e<=s?e-c:e>s&&r>=i-1?s:-1},W.getCurrentTimeByOffset=function(e,t){var n=-1;if(!t||t.length<0)return e;for(var r=0;r<t.length;r++)if(e<=t[r].duration){n=r;break}if(-1!==n){var i=t[n].start;return n-1<0?i+e:i+(e-t[n-1].duration)}return e};var O=/(Android)\s([\d.]+)/,N=/(Version)\/([\d.]+)/,U=["avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","avc1.42E01E","mp4v.20.8","avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","mp4v.20.8, mp4a.40.2","mp4v.20.240, mp4a.40.2"],F={get device(){return F.os.isPc?"pc":"mobile"},get browser(){if("undefined"==typeof navigator)return"";var e=navigator.userAgent.toLowerCase(),t={ie:/rv:([\d.]+)\) like gecko/,firefox:/firefox\/([\d.]+)/,chrome:/chrome\/([\d.]+)/,opera:/opera.([\d.]+)/,safari:/version\/([\d.]+).*safari/};return[].concat(Object.keys(t).filter((function(n){return t[n].test(e)})))[0]},get os(){if("undefined"==typeof navigator)return{};var e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),n=/(?:SymbianOS)/.test(e)||t,r=/(?:Android)/.test(e),i=/(?:Firefox)/.test(e),o=/(?:iPad|PlayBook)/.test(e)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,a=o||r&&!/(?:Mobile)/.test(e)||i&&/(?:Tablet)/.test(e),s=/(?:iPhone)/.test(e)&&!a;return{isTablet:a,isPhone:s,isIpad:o,isIos:s||o,isAndroid:r,isPc:!(s||r||n||a),isSymbian:n,isWindowsPhone:t,isFireFox:i}},get osVersion(){if("undefined"==typeof navigator)return 0;var e=navigator.userAgent,t="",n=(t=/(?:iPhone)|(?:iPad|PlayBook)/.test(e)?N:O)?t.exec(e):[];if(n&&n.length>=3){var r=n[2].split(".");return r.length>0?parseInt(r[0]):0}return 0},get isWeixin(){if("undefined"==typeof navigator)return!1;return!!/(micromessenger)\/([\d.]+)/.exec(navigator.userAgent.toLocaleLowerCase())},isSupportMP4:function(){var e={isSupport:!1,mime:""};if("undefined"==typeof document)return e;if(this.supportResult)return this.supportResult;var t=document.createElement("video");return"function"==typeof t.canPlayType&&U.map((function(n){"probably"===t.canPlayType('video/mp4; codecs="'.concat(n,'"'))&&(e.isSupport=!0,e.mime+="||".concat(n))})),this.supportResult=e,t=null,e},isMSESupport:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if("undefined"==typeof MediaSource||!MediaSource)return!1;try{return MediaSource.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}},isHevcSupported:function(){return!("undefined"==typeof MediaSource||!MediaSource.isTypeSupported)&&(MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"'))},probeConfigSupported:function(e){var t={supported:!1,smooth:!1,powerEfficient:!1};if(!e||"undefined"==typeof navigator)return Promise.resolve(t);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(e);var n=e.video||{},r=e.audio||{};try{var i=MediaSource.isTypeSupported(n.contentType),o=MediaSource.isTypeSupported(r.contentType);return Promise.resolve({supported:i&&o,smooth:!1,powerEfficient:!1})}catch(a){return Promise.resolve(t)}}},Y="3.0.12",K={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},j=T((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};S(this,e);var r=t&&t.i18n?t.i18n.ERROR_TYPES:null;if(t.media){var i=n.mediaError?n.mediaError:t.media.error||{},o=t.duration,a=t.currentTime,s=t.ended,u=t.src,c=t.currentSrc,l=t.media,d=l.readyState,h=l.networkState,f=n.errorCode||i.code;K[f]&&(f=K[f]);var p={playerVersion:Y,currentTime:a,duration:o,ended:s,readyState:d,networkState:h,src:u||c,errorType:n.errorType,errorCode:f,message:n.errorMessage||i.message,mediaError:i,originError:n.originError?n.originError.stack:"",host:W.getHostFromUrl(u||c)};return n.ext&&Object.keys(n.ext).map((function(e){p[e]=n.ext[e]})),p}if(arguments.length>1){for(var m={playerVersion:Y,domain:document.domain},y=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],v=0;v<arguments.length;v++)m[y[v]]=arguments[v];return m.ex=r?(r[arguments[0]]||{}).msg:"",m}})),H="error",B="destroy",J="urlchange",z="definition_change";function Q(e,t,n){for(var r=arguments.length,i=new Array(r>3?r-3:0),o=3;o<r;o++)i[o-3]=arguments[o];var a=t.call.apply(t,[e].concat(i));n&&"function"==typeof n&&(a&&a.then?a.then((function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];n.call.apply(n,[e].concat(r))})):n.call.apply(n,[e].concat(i)))}function q(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),!this.__hooks[e]&&(this.__hooks[e]=null),function(){var r=arguments,i=this;if(n.pre)try{var o;(o=n.pre).call.apply(o,[this].concat(Array.prototype.slice.call(arguments)))}catch(u){throw u.message="[pluginName: ".concat(this.pluginName,":").concat(e,":pre error] >> ").concat(u.message),u}if(this.__hooks&&this.__hooks[e])try{var a,s=(a=this.__hooks[e]).call.apply(a,[this,this].concat(Array.prototype.slice.call(arguments)));s?s.then?s.then((function(e){!1!==e&&Q.apply(void 0,[i,t,n.next].concat(E(r)))})).catch((function(e){throw e})):Q.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments))):void 0===s&&Q.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments)))}catch(u){throw u.message="[pluginName: ".concat(this.pluginName,":").concat(e,"] >> ").concat(u.message),u}else Q.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments)))}.bind(this)}function $(e,t){var n=this.__hooks;if(n)return n.hasOwnProperty(e)?(n&&(n[e]=t),!0):(console.warn("has no supported hook which name [".concat(e,"]")),!1)}function ee(e,t){var n=this.__hooks;n&&delete n[e]}function te(e,t){V.logError("[".concat(e,"] event or callback cant be undefined or null when call ").concat(t))}var ne=function(){function e(t){S(this,e),W.checkIsFunction(this.beforeCreate)&&this.beforeCreate(t),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e.__hooks={},t&&t.map((function(t){e.__hooks[t]=null})),Object.defineProperty(e,"hooks",{get:function(){return e.__hooks&&Object.keys(e.__hooks).map((function(t){if(e.__hooks[t])return t}))}})}(this),this.__args=t,this.__events={},this.__onceEvents={},this.config=t.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(t)}return T(e,[{key:"beforeCreate",value:function(e){}},{key:"afterCreate",value:function(){}},{key:"beforePlayerInit",value:function(){}},{key:"onPluginsReady",value:function(){}},{key:"afterPlayerInit",value:function(){}},{key:"destroy",value:function(){}},{key:"__init",value:function(e){this.player=e.player,this.playerConfig=e.player&&e.player.config,this.pluginName=e.pluginName?e.pluginName.toLowerCase():this.constructor.pluginName.toLowerCase(),this.logger=e.player&&e.player.logger}},{key:"updateLang",value:function(e){e||(e=this.lang)}},{key:"lang",get:function(){return this.player.lang}},{key:"i18n",get:function(){return this.player.i18n}},{key:"i18nKeys",get:function(){return this.player.i18nKeys}},{key:"domEventType",get:function(){var e=W.checkTouchSupport()?"touch":"mouse";return!this.playerConfig||"touch"!==this.playerConfig.domEventType&&"mouse"!==this.playerConfig.domEventType||(e=this.playerConfig.domEventType),e}},{key:"on",value:function(e,t){var n=this;e&&t&&this.player?"string"==typeof e?(this.__events[e]=t,this.player.on(e,t)):Array.isArray(e)&&e.forEach((function(e){n.__events[e]=t,n.player.on(e,t)})):te(this.pluginName,"plugin.on(event, callback)")}},{key:"once",value:function(e,t){var n=this;e&&t&&this.player?"string"==typeof e?(this.__onceEvents[e]=t,this.player.once(e,t)):Array.isArray(e)&&e.forEach((function(r){n.__onceEvents[r]=t,n.player.once(e,t)})):te(this.pluginName,"plugin.once(event, callback)")}},{key:"off",value:function(e,t){var n=this;e&&t&&this.player?"string"==typeof e?(delete this.__events[e],this.player.off(e,t)):Array.isArray(e)&&e.forEach((function(r){delete n.__events[e],n.player.off(r,t)})):te(this.pluginName,"plugin.off(event, callback)")}},{key:"offAll",value:function(){var e=this;["__events","__onceEvents"].forEach((function(t){Object.keys(e[t]).forEach((function(n){e[t][n]&&e.off(n,e[t][n]),n&&delete e[t][n]}))})),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(e){var t;if(this.player){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];(t=this.player).emit.apply(t,[e].concat(r))}}},{key:"emitUserAction",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this.player){var r=_(_({},n),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,r)}}},{key:"hook",value:function(e,t){return q.call.apply(q,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return $.call.apply($,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return ee.call.apply(ee,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"registerPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.player)return n&&(t.pluginName=n),this.player.registerPlugin({plugin:e,options:t})}},{key:"getPlugin",value:function(e){return this.player?this.player.getPlugin(e):null}},{key:"__destroy",value:function(){var e=this,t=this.player,n=this.pluginName;this.offAll(),W.clearAllTimers(this),W.checkIsFunction(this.destroy)&&this.destroy(),["player","playerConfig","pluginName","logger","__args","__hooks"].map((function(t){e[t]=null})),t.unRegisterPlugin(n),this.__hooks=null}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&Object.defineProperty(e,n,t[n])}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]),e}();function re(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 ie(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?re(Object(n),!0).forEach((function(t){he(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):re(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function oe(){oe=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(L){u=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var o=t&&t.prototype instanceof h?t:h,a=Object.create(o.prototype),s=new T(i||[]);return r(a,"_invoke",{value:_(e,n,s)}),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(L){return{type:"throw",arg:L}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,o)&&(m=v);var g=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,t){function i(r,o,a,s){var u=l(e[r],e,o);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(d).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=w(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=l(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,d;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function S(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function x(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(A.prototype),u(A.prototype,a,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new A(c(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),u(g,s,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=x,T.prototype={constructor:T,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(k),!e)for(var t in this)"t"===t.charAt(0)&&n.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 r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},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),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:x(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function ae(e){return(ae="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 se(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(c){return void n(c)}s.done?t(u):Promise.resolve(u).then(r,i)}function ue(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){se(o,r,i,a,s,"next",e)}function s(e){se(o,r,i,a,s,"throw",e)}a(void 0)}))}}function ce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function le(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Te(r.key),r)}}function de(e,t,n){return t&&le(e.prototype,t),n&&le(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function he(e,t,n){return(t=Te(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fe(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&&me(e,t)}function pe(e){return(pe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function me(e,t){return(me=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ye(){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 ve(e,t,n){return(ve=ye()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&me(i,n.prototype),i}).apply(null,arguments)}function ge(e){var t="function"==typeof Map?new Map:void 0;return ge=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;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,r)}function r(){return ve(e,arguments,pe(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),me(r,e)},ge(e)}function be(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Ae(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _e(e){var t=ye();return function(){var n,r=pe(e);if(t){var i=pe(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(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 Ae(e)}(this,n)}}function we(){return we="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=pe(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},we.apply(this,arguments)}function Se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ke(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Se(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Se(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}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 o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Te(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function xe(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.used=!1,n.resolve=function(){return n.used=!0,e.apply(void 0,arguments)},n.reject=function(){return n.used=!0,t.apply(void 0,arguments)},n}function Ee(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}var Le,Ie=function(){function e(){ce(this,e)}return de(e,null,[{key:"start",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&e.start(0)<0?0:e.start(0):0}},{key:"end",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1):0}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(t){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var n=[],r=0,i=e.length;r<i;r++){var o=n.length;if(o&&t){var a=n[o-1],s=a[1];if(e.start(r)-s<=t){var u=e.end(r);u>s&&(a[1]=u)}else n.push([e.start(r),e.end(r)])}else n.push([e.start(r),e.end(r)])}return n}},{key:"totalLength",value:function(e){return e&&e.length?e.reduce((function(e,t){return e+(t[1]-t[0])}),0):0}},{key:"info",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t||!t.length)return{start:0,end:0,buffers:[]};for(var i=0,o=0,a=0,s=0,u=0,c=0,l=0,d=e.buffers(t,r),h=0,f=d.length;h<f;h++){var p=d[h];if(n+r>=p[0]&&n<=p[1])i=p[0],o=p[1],a=h;else{if(n+r<p[0]){s=p[0],u=p[1];break}n+r>p[1]&&(c=p[0],l=p[1])}}return{start:i,end:o,index:a,buffers:d,nextStart:s,nextEnd:u,prevStart:c,prevEnd:l,currentTime:n,behind:n-i,remaining:o?o-n:0,length:e.totalLength&&e.totalLength(d)}}}]),e}(),Re="network",Ze="network_timeout",Ce="network_forbidden",Pe="network_notfound",Ge="network_range_not_satisfiable",De="demux",Me="remux",Ve="media",Xe="drm",We="other",Oe="runtime",Ne={FLV:"FLV",HLS:"HLS",MP4:"MP4",FMP4:"FMP4",MSE_ADD_SB:"MSE_ADD_SB",MSE_APPEND_BUFFER:"MSE_APPEND_BUFFER",MSE_OTHER:"MSE_OTHER",MSE_FULL:"MSE_FULL",OPTION:"OPTION",DASH:"DASH",LICENSE:"LICENSE",CUSTOM_LICENSE:"CUSTOM_LICENSE",MSE_HIJACK:"MSE_HIJACK",EME_HIJACK:"EME_HIJACK",SIDX:"SIDX",NO_CANPLAY_ERROR:"NO_CANPLAY_ERROR",BUFFERBREAK_ERROR:"BUFFERBREAK_ERROR",WAITING_TIMEOUT_ERROR:"WAITING_TIMEOUT_ERROR",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_CODEC_NOT_SUPPORTED:"MEDIA_ERR_CODEC_NOT_SUPPORTED",MEDIA_ERR_URL_EMPTY:"MEDIA_ERR_URL_EMPTY"},Ue=(he(Le={},"manifest",{HLS:1100,DASH:1200}),he(Le,Re,2100),he(Le,Ze,2101),he(Le,Ce,2103),he(Le,Pe,2104),he(Le,Ge,2116),he(Le,De,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),he(Le,Me,{FMP4:4100,MP4:4200}),he(Le,Ve,{MEDIA_ERR_ABORTED:5101,MEDIA_ERR_NETWORK:5102,MEDIA_ERR_DECODE:5103,MEDIA_ERR_SRC_NOT_SUPPORTED:5104,MEDIA_ERR_CODEC_NOT_SUPPORTED:5105,MEDIA_ERR_URL_EMPTY:5106,MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203,MSE_HIJACK:5204,EME_HIJACK:5301}),he(Le,Xe,{LICENSE:7100,CUSTOM_LICENSE:7200}),he(Le,We,8e3),he(Le,Oe,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002,WAITING_TIMEOUT_ERROR:9003}),Le),Fe=function(e){fe(n,e);var t=_e(n);function n(e,r,i,o,a){var s;return ce(this,n),(s=t.call(this,a||(null==i?void 0:i.message))).errorType=e===Ze?Re:e,s.originError=i,s.ext=o,s.errorCode=Ue[e][r]||Ue[e],s.errorMessage=s.message,s.errorCode||(s.errorType=We,s.errorCode=Ue[s.errorType]),s}return de(n,null,[{key:"create",value:function(e,t,r,i,o){return e instanceof n?e:(e instanceof Error&&(r=e,e=""),e||(e=We),new n(e,t,r,i,o))}},{key:"network",value:function(e){var t;return new n(null!=e&&e.isTimeout?Ze:Re,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}]),n}(ge(Error)),Ye="undefined"!=typeof window,Ke={DEBUG:1,LOG:2,WARN:3,ERROR:4},je=["Boolean","Number","String","Undefined","Null","Date","Object"],He=function(){function e(t,n){ce(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),this.logCacheLevel=(null==n?void 0:n.logCacheLevel)||3,this.logMaxSize=(null==n?void 0:n.logMaxSize)||204800,this.logSize=0,this.logTextArray=[]}return de(e,[{key:"debug",value:function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];this.logCache.apply(this,[Ke.DEBUG].concat(r)),e.disabled||(t=console).debug.apply(t,[this._prefix,Be()].concat(r))}},{key:"log",value:function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];this.logCache.apply(this,[Ke.LOG].concat(r)),e.disabled||(t=console).log.apply(t,[this._prefix,Be()].concat(r))}},{key:"warn",value:function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];this.logCache.apply(this,[Ke.WARN].concat(r)),e.disabled||(t=console).warn.apply(t,[this._prefix,Be()].concat(r))}},{key:"error",value:function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];this.logCache.apply(this,[Ke.ERROR].concat(r)),e.disabled||(t=console).error.apply(t,[this._prefix,Be()].concat(r))}},{key:"logCache",value:function(e){if(!(e<this.logCacheLevel)){var t="";try{for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=r.map((function(e){return ze(e)}));t=this._prefix+Be()+JSON.stringify(o)}catch(s){return}if(e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var a=this.logTextArray.shift();this.logSize-=a.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function Be(){return(new Date).toLocaleString()}function Je(e){if("object"!==ae(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function ze(e,t,n){n||(n=1),t||(t=2);var r={};if(!e||"object"!==ae(e))return e;var i=Object.prototype.toString.call(e).slice(8,-1);if(!je.includes(i))return i;if(!(n>t)){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n===t?r[o]=Je(e[o]):"object"===ae(e[o])?r[o]=ze(e[o],t,n+1):r[o]=e[o]);return r}}he(He,"disabled",!0);var Qe=function(){try{return Ye?window.MediaSource:null}catch(e){}}(),qe="appendBuffer",$e="removeBuffer",et="updateDuration",tt=function(){function e(t,n){var r=this;ce(this,e),he(this,"media",null),he(this,"mediaSource",null),he(this,"_openPromise",xe()),he(this,"_queue",Object.create(null)),he(this,"_sourceBuffer",Object.create(null)),he(this,"_mseFullFlag",{}),he(this,"_st",0),he(this,"_opst",0),he(this,"_logger",null),he(this,"_config",null),he(this,"_url",null),he(this,"_onSBUpdateEnd",(function(e){var t=r._queue[e];if(t){var n=t[0];if((null==n?void 0:n.opName)!==et&&t.shift(),n){var i=Ee()-r._opst;r._logger.debug("UpdateEnd",n.opName,i,n.context),n.promise.resolve({name:n.opName,context:n.context,costtime:i}),r._startQueue(e)}}})),he(this,"_onSBUpdateError",(function(e,t){var n=r._queue[e];if(n){var i=n[0];i&&(r._logger.error("UpdateError",e,i.opName,i.context),i.promise.reject(new Fe(Ve,Ne.MSE_APPEND_BUFFER,t)))}})),this._config=Object.assign(e.getDefaultConfig(),n),t&&this.bindMedia(t),this._logger=new He("MSE"),this._config.openLog&&He.enable()}var t,n,r;return de(e,[{key:"isOpened",get:function(){var e;return"open"===(null===(e=this.mediaSource)||void 0===e?void 0:e.readyState)}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return(null===(e=this.mediaSource)||void 0===e?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"isFull",value:function(t){return t?this._mseFullFlag[t]:this._mseFullFlag[e.VIDEO]}},{key:"updateDuration",value:function(e){var t=this,n=this.mediaSource&&this.mediaSource.duration>e;if(this.mediaSource&&this.mediaSource.duration>e){var r=0;if(Object.keys(this._sourceBuffer).forEach((function(e){try{r=Math.max(t.bufferEnd(e)||0,r)}catch(n){}})),e<r)return Promise.resolve()}return this._enqueueBlockingOp((function(){t.isEnded?t._logger.debug("[debug mse] setDuration ended"):t.mediaSource&&(t.mediaSource.duration=e,t._logger.debug("[debug mse] setDuration"))}),et,{isReduceDuration:n})}},{key:"open",value:function(){var e=this;if(this._openPromise.used&&!this.isOpened&&this.mediaSource){var t=this.mediaSource;t.addEventListener("sourceopen",(function n(){var r=Ee()-e._st;e._logger.debug("MSE OPEN",r),t.removeEventListener("sourceopen",n),e._openPromise.resolve({costtime:r})})),this._openPromise=xe()}return this._openPromise}},{key:"bindMedia",value:(r=ue(oe().mark((function e(t){var n,r,i=this;return oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.mediaSource&&!this.media){e.next=3;break}return e.next=3,this.unbindMedia();case 3:if(t&&Qe){e.next=5;break}throw new Error("Param media or MediaSource does not exist");case 5:return this.media=t,n=this.mediaSource=new Qe,this._st=Ee(),r=function e(){var r=Ee()-i._st;i._logger.debug("MSE OPEN"),n.removeEventListener("sourceopen",e),URL.revokeObjectURL(t.src),i._openPromise.resolve({costtime:r})},n.addEventListener("sourceopen",r),this._url=URL.createObjectURL(n),t.src=this._url,e.abrupt("return",this._openPromise);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unbindMedia",value:(n=ue(oe().mark((function e(){var t,n,r,i=this;return oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._openPromise.used||this._openPromise.resolve(),t=this.mediaSource){if(Object.keys(this._queue).forEach((function(e){var t=i._queue[e];t&&t.forEach((function(e){var t,n;return null===(t=e.promise)||void 0===t||null===(n=t.resolve)||void 0===n?void 0:n.call(t)}))})),n=!!this.media&&this.media.readyState>=1,r="open"===t.readyState,n&&r)try{t.endOfStream()}catch(o){}Object.keys(this._sourceBuffer).forEach((function(e){try{t.removeSourceBuffer(i._sourceBuffer[e])}catch(o){}}))}if(this.media){this.media.removeAttribute("src");try{this.media.load()}catch(o){}this.media=null}this.mediaSource=null,this._openPromise=xe(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"createSource",value:function(e,t){if(!this._sourceBuffer[e]&&this.mediaSource){var n;try{n=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(r){throw new Fe(Ve,Ne.MSE_ADD_SB,r)}n.mimeType=t,n.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),n.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,t){var n=this,r=this._sourceBuffer[e];return this.mediaSource&&r&&r.mimeType!==t?"function"!=typeof r.changeType?Promise.reject():this._enqueueOp(e,(function(){r.changeType(t),r.mimeType=t,n._onSBUpdateEnd(e)}),"changeType",{mimeType:t}):Promise.resolve()}},{key:"createOrChangeSource",value:function(e,t){return this.createSource(e,t),this.changeType(e,t)}},{key:"append",value:function(e,t,n){var r=this;return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,(function(){var i;r.mediaSource&&!r.media.error&&(r._logger.debug("MSE APPEND START",n),r._opst=Ee(),null===(i=r._sourceBuffer[e])||void 0===i||i.appendBuffer(t))}),qe,n):Promise.resolve()}},{key:"remove",value:function(e,t,n,r){var i=this,o=!1;return this._mseFullFlag[e]&&(o=!0),this._enqueueOp(e,(function(){if(i.mediaSource&&!i.media.error){var o=i._sourceBuffer[e];t>=n||!o?i._onSBUpdateEnd(e):(i._opst=Ee(),i._logger.debug("MSE REMOVE START",e,t,n,r),o.remove(t,n))}}),$e,r,o)}},{key:"clearBuffer",value:function(e,t){var n,r=this;return Object.keys(this._sourceBuffer).forEach((function(i){n=r.remove(i,e,t)})),n||Promise.resolve()}},{key:"clearAllBuffer",value:function(){var e,t=this;return Object.keys(this._sourceBuffer).forEach((function(n){var r=t._sourceBuffer[n];e=t.remove(n,0,Ie.end(Ie.get(r)))})),e}},{key:"clearOpQueues",value:function(e,t){var n;this._logger.debug("MSE clearOpQueue START");var r=this._queue[e];if(t&&r)this._queue[e]=[];else if(r&&r[e]&&!(r.length<5)){var i=[];r.forEach((function(e){e.context&&e.context.isinit&&i.push(e)})),this._queue[e]=r.slice(0,2),i.length>0&&(n=this._queue[e]).push.apply(n,i)}}},{key:"endOfStream",value:function(e){var t=this;return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp((function(){var n=t.mediaSource;n&&"open"===n.readyState&&(t._logger.debug("MSE endOfStream START"),e?n.endOfStream(e):n.endOfStream())}),"endOfStream"):Promise.resolve()}},{key:"setLiveSeekableRange",value:function(e,t){var n=this.mediaSource;e<0||t<e||null==n||!n.setLiveSeekableRange||"open"!==n.readyState||n.setLiveSeekableRange(e,t)}},{key:"getSourceBuffer",value:function(e){return this._sourceBuffer[e]}},{key:"buffered",value:function(e){return Ie.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return Ie.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return Ie.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,t,n,r,i){var o=this;if(!this.mediaSource)return Promise.resolve();var a=this._queue[e]=this._queue[e]||[],s={exec:t,promise:xe(),opName:n,context:r};return i?(a.splice(0,0,s),this._mseFullFlag[e]=!1,this._startQueue(e)):a.push(s),this.isOpened||this.isEnded?1===a.length&&this._startQueue(e):this._openPromise.then((function(){1===a.length&&o._startQueue(e)})),s.promise}},{key:"_enqueueBlockingOp",value:(t=ue(oe().mark((function e(t,n,r){var i,o,a=this;return oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaSource){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:if((i=Object.keys(this._sourceBuffer)).length){e.next=5;break}return e.abrupt("return",t());case 5:return o=[],i.forEach((function(e){var t=a._queue[e],i=xe();o.push(i),t.push({exec:function(){i.resolve()},promise:i,opName:n,context:r}),1===t.length&&a._startQueue(e)})),e.abrupt("return",Promise.all(o).then((function(){try{return t()}finally{i.forEach((function(e){var t=a._queue[e],n=a._sourceBuffer[e];null==t||t.shift(),n&&n.updating||a._startQueue(e)}))}})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"_startQueue",value:function(e){var t=this._queue[e];if(t){var n=t[0];if(n&&!this._mseFullFlag[e])try{n.exec()}catch(r){r&&r.message&&r.message.indexOf("SourceBuffer is full")>=0?(this._mseFullFlag[e]=!0,this._logger.error("[MSE error], context,",n.context," ,name,",n.opName,",err,SourceBuffer is full"),n.promise.reject(new Fe(Ve,Ne.MSE_FULL,r))):(this._logger.error(r),n.promise.reject(new Fe(Ve,Ne.MSE_OTHER,r)),t.shift(),this._startQueue(e))}}}},{key:"setTimeoffset",value:function(e,t,n){var r=this;return this._enqueueOp(e,(function(){t<0&&(t+=.001),r._sourceBuffer[e].timestampOffset=t,r._onSBUpdateEnd(e)}),"setTimeoffset",n)}},{key:"abort",value:function(e,t){var n=this;return this.isOpened?this._enqueueOp(e,(function(){n._sourceBuffer[e].abort(),n._onSBUpdateEnd(e)}),"abort",t):Promise.resolve()}}],[{key:"getDefaultConfig",value:function(){return{openLog:!1}}},{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if(!Qe)return!1;try{return Qe.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}}}]),e}();he(tt,"VIDEO","video"),he(tt,"AUDIO","audio");var nt="fetch",rt="xhr",it="arraybuffer",ot="text",at="json",st=function(e){fe(n,e);var t=_e(n);function n(e,r,i,o){var a;return ce(this,n),he(Ae(a=t.call(this,o)),"retryCount",0),he(Ae(a),"isTimeout",!1),he(Ae(a),"loaderType",nt),he(Ae(a),"startTime",0),he(Ae(a),"endTime",0),he(Ae(a),"options",{}),a.url=e,a.request=r,a.response=i,a}return de(n)}(ge(Error)),ut=Object.prototype.toString;function ct(e){if("[object Object]"!==ut.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function lt(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function dt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ht(e,t){if(e){if(!t)return e;var n,r=Object.keys(t).map((function(e){if(null!=(n=t[e]))return Array.isArray(n)?e+="[]":n=[n],n.map((function(t){var n;return n=t,"[object Date]"===ut.call(n)?t=t.toISOString():function(e){return null!==e&&"object"===ae(e)}(t)&&(t=JSON.stringify(t)),"".concat(dt(e),"=").concat(dt(t))})).join("&")})).filter(Boolean).join("&");if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e}}function ft(e,t,n,r,i,o,a,s,u,c,l){return i=null!=i?parseFloat(i):null,r=parseInt(r||"0",10),Number.isNaN(r)&&(r=0),{data:e,done:t,options:{range:u,vid:c,index:s,contentLength:r,age:i,startTime:o,firstByteTime:a,endTime:Date.now(),priOptions:l},response:n}}function pt(e,t){return Math.round(8*e*1e3/t/1024)}var mt="error",yt="core.ttfb",vt="core.loadstart",gt="core.loadresponseheaders",bt="core.loadcomplete",At="core.loadretry",_t="core.sourcebuffercreated",wt="core.analyzedurationexceeded",St="core.removebuffer",kt="core.buffereos",Tt="core.keyframe",xt="core.metadataparsed",Et="core.sei",Lt="core.seiintime",It="core.flvscriptdata",Rt="core.lowdecode",Zt="core.switchurlsuccess",Ct="core.switchurlfailed",Pt="core.demuxedtrack",Gt="core.streamexception",Dt="LARGE_AV_FIRST_FRAME_GAP_DETECT",Mt="LARGE_VIDEO_DTS_GAP_DETECT",Vt="LARGE_AUDIO_DTS_GAP_DETECT",Xt="AUDIO_GAP_DETECT",Wt="AUDIO_OVERLAP_DETECT",Ot="MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT",Nt="real_time_speed",Ut=2097152,Ft=function(e){fe(r,e);var t,n=_e(r);function r(){var e;return ce(this,r),he(Ae(e=n.call(this)),"_abortController",null),he(Ae(e),"_timeoutTimer",null),he(Ae(e),"_reader",null),he(Ae(e),"_response",null),he(Ae(e),"_aborted",!1),he(Ae(e),"_index",-1),he(Ae(e),"_range",null),he(Ae(e),"_receivedLength",0),he(Ae(e),"_running",!1),he(Ae(e),"_logger",null),he(Ae(e),"_vid",""),he(Ae(e),"_onProcessMinLen",0),he(Ae(e),"_onCancel",null),he(Ae(e),"_priOptions",null),e}return de(r,[{key:"load",value:function(e){var t,n=this,r=e.url,i=e.vid,o=e.timeout,a=e.responseType,s=e.onProgress,u=e.index,c=e.onTimeout,l=e.onCancel,d=e.range,h=e.transformResponse,f=e.request,p=e.params,m=e.logger,y=e.method,v=e.headers,g=e.body,b=e.mode,A=e.credentials,_=e.cache,w=e.redirect,S=e.referrer,k=e.referrerPolicy,T=e.onProcessMinLen,x=e.priOptions;this._logger=m,this._aborted=!1,this._onProcessMinLen=T,this._onCancel=l,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=u,this._range=d||[0,0],this._vid=i||r,this._priOptions=x||{};var E={method:y,headers:v,body:g,mode:b,credentials:A,cache:_,redirect:w,referrer:S,referrerPolicy:k,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},L=!1;clearTimeout(this._timeoutTimer),r=ht(r,p);var I=lt(d);I&&(v=f?f.headers:E.headers=E.headers||(Headers?new Headers:{}),Headers&&v instanceof Headers?v.append("Range",I):v.Range=I),o&&(this._timeoutTimer=setTimeout((function(){if(L=!0,n.cancel(),c){var e=new st(r,E,null,"timeout");e.isTimeout=!0,c(e,{index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions})}}),o));var R=Date.now();return this._logger.debug("[fetch load start], index,",u,",range,",d),new Promise((function(e,t){fetch(f||r,f?void 0:E).then(function(){var i=ue(oe().mark((function i(o){var c,l,f,p;return oe().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(n._timeoutTimer),n._response=o,!n._aborted&&n._running){i.next=4;break}return i.abrupt("return");case 4:if(h&&(o=h(o,r)||o),o.ok){i.next=7;break}throw new st(r,E,o,"bad network response");case 7:if(c=Date.now(),a!==ot){i.next=15;break}return i.next=11,o.text();case 11:l=i.sent,n._running=!1,i.next=37;break;case 15:if(a!==at){i.next=22;break}return i.next=18,o.json();case 18:l=i.sent,n._running=!1,i.next=37;break;case 22:if(!s){i.next=29;break}return n.resolve=e,n.reject=t,n._loadChunk(o,s,R,c),i.abrupt("return");case 29:return i.next=31,o.arrayBuffer();case 31:l=i.sent,l=new Uint8Array(l),n._running=!1,f=Date.now()-R,p=pt(l.byteLength,f),n.emit(Nt,{speed:p,len:l.byteLength,time:f,vid:n._vid,index:n._index,range:n._range,priOptions:n._priOptions});case 37:n._logger.debug("[fetch load end], index,",u,",range,",d),e(ft(l,!0,o,o.headers.get("Content-Length"),o.headers.get("age"),R,c,u,d,n._vid,n._priOptions));case 39:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}()).catch((function(e){var i;clearTimeout(n._timeoutTimer),n._running=!1,n._aborted&&!L||((e=e instanceof st?e:new st(r,E,null,null===(i=e)||void 0===i?void 0:i.message)).startTime=R,e.endTime=Date.now(),e.isTimeout=L,e.options={index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions},t(e))}))}))}},{key:"cancel",value:(t=ue(oe().mark((function e(){return oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch(t){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,n,r){var i=this;if(!e.body||!e.body.getReader){this._running=!1;var o=new st(e.url,"",e,"onProgress of bad response.body.getReader");return o.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(o)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(Ut),this._writeIdx=0);var a,s,u,c=this._reader=e.body.getReader(),l=function(){var o=ue(oe().mark((function o(){var d,h,f,p,m,y,v,g;return oe().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return s=Date.now(),o.prev=1,o.next=4,c.read();case 4:a=o.sent,u=Date.now(),o.next=13;break;case 8:return o.prev=8,o.t0=o.catch(1),u=Date.now(),i._aborted||(i._running=!1,o.t0.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i.reject(o.t0)),o.abrupt("return");case 13:if(h=(null===(d=i._range)||void 0===d?void 0:d.length)>0?i._range[0]:0,f=h+i._receivedLength,!i._aborted){o.next=19;break}return i._running=!1,t(void 0,!1,{range:[f,f],vid:i._vid,index:i._index,startTime:s,endTime:u,st:n,firstByteTime:r,priOptions:i._priOptions},e),o.abrupt("return");case 19:p=a.value?a.value.byteLength:0,i._receivedLength+=p,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",f,", end,",h+i._receivedLength,", done,",a.done),i._onProcessMinLen>0?i._writeIdx+p>=i._onProcessMinLen||a.done?((m=new Uint8Array(i._writeIdx+p)).set(i._cache.slice(0,i._writeIdx),0),p>0&&m.set(a.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",a.done,",len,",m.byteLength,", writeIdx,",i._writeIdx)):p>0&&i._writeIdx+p<Ut?(i._cache.set(a.value,i._writeIdx),i._writeIdx+=p,i._logger.debug("【fetchLoader,onProgress cache】,len,",p,", writeIdx,",i._writeIdx)):p>0&&(y=new Uint8Array(i._writeIdx+p+2048),i._logger.debug("【fetchLoader,onProgress extra start】,size,",i._writeIdx+p+2048,", datalen,",p,", writeIdx,",i._writeIdx),y.set(i._cache.slice(0,i._writeIdx),0),p>0&&y.set(a.value,i._writeIdx),i._writeIdx+=p,delete i._cache,i._cache=y,i._logger.debug("【fetchLoader,onProgress extra end】,len,",p,", writeIdx,",i._writeIdx)):m=a.value,(m&&m.byteLength>0||a.done)&&t(m,a.done,{range:[i._range[0]+i._receivedLength-(m?m.byteLength:0),i._range[0]+i._receivedLength],vid:i._vid,index:i._index,startTime:s,endTime:u,st:n,firstByteTime:r,priOptions:i._priOptions},e),a.done?(v=Date.now()-n,g=pt(i._receivedLength,v),i.emit(Nt,{speed:g,len:i._receivedLength,time:v,vid:i._vid,index:i._index,range:i._range,priOptions:i._priOptions}),i._running=!1,i._logger.debug("[fetchLoader onProgress end],task,",i._range,",done,",a.done),i.resolve(ft(a,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),n,r,i._index,i._range,i._vid,i._priOptions))):l();case 25:case"end":return o.stop()}}),o,null,[[1,8]])})));return function(){return o.apply(this,arguments)}}();l()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}]),r}(P);var Yt=function(e){fe(n,e);var t=_e(n);function n(){var e;return ce(this,n),he(Ae(e=t.call(this)),"_xhr",null),he(Ae(e),"_aborted",!1),he(Ae(e),"_timeoutTimer",null),he(Ae(e),"_range",null),he(Ae(e),"_receivedLength",0),he(Ae(e),"_url",null),he(Ae(e),"_onProgress",null),he(Ae(e),"_index",-1),he(Ae(e),"_headers",null),he(Ae(e),"_currentChunkSizeKB",384),he(Ae(e),"_timeout",null),he(Ae(e),"_xhr",null),he(Ae(e),"_withCredentials",null),he(Ae(e),"_startTime",-1),he(Ae(e),"_loadCompleteResolve",null),he(Ae(e),"_loadCompleteReject",null),he(Ae(e),"_runing",!1),he(Ae(e),"_logger",!1),he(Ae(e),"_vid",""),he(Ae(e),"_responseType",void 0),he(Ae(e),"_credentials",void 0),he(Ae(e),"_method",void 0),he(Ae(e),"_transformResponse",void 0),he(Ae(e),"_firstRtt",void 0),he(Ae(e),"_onCancel",null),he(Ae(e),"_priOptions",null),e}return de(n,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=ht(e.url,e.params);var n=Date.now();return new Promise((function(e,n){t._loadCompleteResolve=e,t._loadCompleteReject=n,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof st?e:new st(t._url,t._request)).startTime=n,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e}))}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===it&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,n=this._range[0]+this._receivedLength,r=this._range[1];t<this._range[1]-n&&(r=n+t),e=[n,r],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var n=this._xhr=new XMLHttpRequest;n.open(this._method||"GET",this._url,!0),n.responseType=this._responseType,this._timeout&&(n.timeout=this._timeout),n.withCredentials=this._withCredentials,n.onload=this._onLoad.bind(this),n.onreadystatechange=this._onReadyStatechange.bind(this),n.onerror=function(e){var n,r,i;t._running=!1;var o=new st(t._url,t._request,null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.response,"xhr.onerror.status:"+(null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.status)+",statusText,"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.statusText));o.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(o)},n.ontimeout=function(e){t.cancel();var n=new st(t._url,t._request,{status:408},"timeout");t._onTimeout&&(n.isTimeout=!0,t._onTimeout(n,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),n.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(n)};var r=this._headers||{},i=lt(e);i&&(r.Range=i),r&&Object.keys(r).forEach((function(e){n.setRequestHeader(e,r[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),n.send(this._body)}catch(o){o.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(o)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t,n=e.target.status;if(n<200||n>299){var r=new st(this._url,null,ie(ie({},e.target.response),{},{status:n}),"bad response,status:"+n);return r.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(r)}var i,o=null,a=!1,s=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===it){var u,c=new Uint8Array(e.target.response);if(i=s+this._receivedLength,c&&c.byteLength>0){this._receivedLength+=c.byteLength;var l=Date.now()-this._startTime,d=pt(this._receivedLength,l);this.emit(Nt,{speed:d,len:this._receivedLength,time:l,vid:this._vid,index:this._index,range:[i,s+this._receivedLength],priOptions:this._priOptions})}o=c,a=!((null===(u=this._range)||void 0===u?void 0:u.length)>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",i,"end ",s+this._receivedLength,",dataLen,",c?c.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",a)}else a=!0,o=e.target.response;var h={ok:n>=200&&n<300,status:n,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(h=this._transformResponse(h,this._url)||h),this._onProgress&&this._onProgress(o,a,{index:this._index,vid:this._vid,range:[i,s+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},h),a?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(ft(this._onProgress?null:o,a,h,h.headers["content-length"],h.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,we(pe(n.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,n={},r=ke(e.getAllResponseHeaders().trim().split("\r\n"));try{for(r.s();!(t=r.n()).done;){var i=t.value.split(": ");n[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(o){r.e(o)}finally{r.f()}return n}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),n}(P),Kt=["retry","retryDelay","onRetryError","transformError"],jt=function(){function e(t,n){ce(this,e),this.promise=xe(),this.alive=!!n.onProgress,!n.logger&&(n.logger=new He("Loader")),this._loaderType=t,this._loader=t===nt&&"undefined"!=typeof fetch?new Ft:new Yt,this._config=n,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=n.retryCheckFunc,this._logger=n.logger}var t;return de(e,[{key:"exec",value:function(){var e=this,t=this._config,n=t.retry,r=t.retryDelay,i=t.onRetryError,o=t.transformError,a=be(t,Kt),s=function(){var t=ue(oe().mark((function t(){var u,c,l;return oe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(a);case 3:u=t.sent,e.promise.resolve(u),t.next=27;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,c=t.t0,o&&(c=o(c)||c),i&&e._retryCount>0&&i(c,e._retryCount,{index:a.index,vid:a.vid,range:a.range,priOptions:a.priOptions}),e._retryCount++,l=!0,e._retryCheckFunc&&(l=e._retryCheckFunc(t.t0)),!(l&&e._retryCount<=n)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",a.range),e._retryTimer=setTimeout(s,r),t.abrupt("return");case 26:e.promise.reject(c);case 27:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return s(),this.promise}},{key:"cancel",value:(t=ue(oe().mark((function e(){return oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),e}();function Ht(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if((t=t.filter(Boolean)).length<2)return t[0];var r=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){r.set(e,i),i+=e.byteLength})),r}function Bt(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var Jt=function(e){fe(r,e);var t,n=_e(r);function r(e){var t;return ce(this,r),he(Ae(t=n.call(this,e)),"type",nt),he(Ae(t),"_queue",[]),he(Ae(t),"_alive",[]),he(Ae(t),"_currentTask",null),he(Ae(t),"_finnalUrl",""),he(Ae(t),"_config",void 0),t._config=function(e){return ie({loaderType:nt,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:ot,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0},e)}(e),t._config.loaderType!==rt&&Ft.isSupported()||(t.type=rt),t.log=e.logger,t}return de(r,[{key:"isFetch",value:function(){return this.type===nt}},{key:"load",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?n=e:n.url=e||n.url||this._config.url,(n=Object.assign({},this._config,n)).params&&(n.params=Object.assign({},n.params)),n.headers&&ct(n.headers)&&(n.headers=Object.assign({},n.headers)),n.body&&ct(n.body)&&(n.body=Object.assign({},n.body)),n.transformRequest&&(n=n.transformRequest(n)||n),n.logger=this.log;var r=new jt(this.type,n);return r.loader.on(Nt,(function(e){t.emit(Nt,e)})),this._queue.push(r),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),r.promise}},{key:"cancel",value:(t=ue(oe().mark((function e(){var t;return oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,Bt();case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,n;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(n=e._alive)||void 0===n?void 0:n.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return Ft.isSupported()}}]),r}(P),zt=function(){function e(){ce(this,e),he(this,"_prevCurrentTime",0)}return de(e,[{key:"do",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(e){var i=e.currentTime,o=0;if(this._prevCurrentTime===i){var a=Ie.info(Ie.get(e),i);if(!a.buffers.length)return;n&&a.nextStart||a.nextStart&&a.nextStart-i<t?o=a.nextStart+.1:a.end&&a.end-i>r&&!e.seeking&&(o=i+.1)}this._prevCurrentTime=i,o&&i!==o&&(e.currentTime=o)}}}]),e}(),Qt=function(){function e(t){var n=this;ce(this,e),he(this,"_seiSet",new Set),this.emitter=t,t.on(Et,(function(e){e&&n._seiSet.add(e)}))}return de(e,[{key:"throw",value:function(e,t){var n=this;if(null!=e&&this._seiSet.size){var r=e-.2,i=e+.2,o=[];this._seiSet.forEach((function(e){e.time>=r&&e.time<=i&&o.push(e)})),o.forEach((function(e){n._seiSet.delete(e),n.emitter.emit(Lt,e)})),t&&this._seiSet.forEach((function(t){t.time<e-5&&n._seiSet.delete(t)}))}}},{key:"reset",value:function(){this._seiSet.clear()}}]),e}(),qt=function(){function e(){ce(this,e),he(this,"_chunkSpeeds",[]),he(this,"_speeds",[])}return de(e,[{key:"addRecord",value:function(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}},{key:"addChunkRecord",value:function(e,t){e&&t&&(this._chunkSpeeds.push(8e3*e/t),this._chunkSpeeds=this._chunkSpeeds.slice(-100))}},{key:"getAvgSpeed",value:function(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds.reduce((function(e,t){return e+t}))/this._speeds.length:this._chunkSpeeds.reduce((function(e,t){return e+t}))/this._chunkSpeeds.length:0}},{key:"getLatestSpeed",value:function(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeeds[this._chunkSpeeds.length-1]:0}},{key:"reset",value:function(){this._chunkSpeeds=[],this._speeds=[]}}]),e}(),$t=function(){function e(t){ce(this,e),he(this,"encodeType",""),he(this,"audioCodec",""),he(this,"videoCodec",""),he(this,"domain",""),he(this,"fps",0),he(this,"bitrate",0),he(this,"width",0),he(this,"height",0),he(this,"samplerate",0),he(this,"channelCount",0),he(this,"gop",0),he(this,"_bitsAccumulateSize",0),he(this,"_bitsAccumulateDuration",0),he(this,"_startGopId",-1),this._timescale=t}return de(e,[{key:"getStats",value:function(){return{encodeType:this.encodeType,audioCodec:this.audioCodec,videoCodec:this.videoCodec,domain:this.domain,fps:this.fps,bitrate:this.bitrate,width:this.width,height:this.height,samplerate:this.samplerate,channelCount:this.channelCount,gop:this.gop}}},{key:"setEncodeType",value:function(e){this.encodeType=e}},{key:"setFpsFromScriptData",value:function(e){var t,n=e.data,r=null==n||null===(t=n.onMetaData)||void 0===t?void 0:t.framerate;r&&r>0&&r<100&&(this.fps=r)}},{key:"setVideoMeta",value:function(e){if(this.width=e.width,this.height=e.height,this.videoCodec=e.codec,this.encodeType=e.codecType,e.fpsNum&&e.fpsDen){var t=e.fpsNum/e.fpsDen;t>0&&t<100&&(this.fps=t)}}},{key:"setAudioMeta",value:function(e){this.audioCodec=e.codec,this.samplerate=e.sampleRate,this.channelCount=e.channelCount}},{key:"setDomain",value:function(e){this.domain=e.split("/").slice(2,3)[0]}},{key:"updateBitrate",value:function(e){var t=this;if((!this.fps||this.fps>=100)&&e.length){var n=e.reduce((function(e,t){return e+t.duration}),0)/e.length;this.fps=Math.round(this._timescale/n)}e.forEach((function(e){-1===t._startGopId&&(t._startGopId=e.gopId),e.gopId===t._startGopId&&t.gop++,t._bitsAccumulateDuration+=e.duration/(t._timescale/1e3),t._bitsAccumulateSize+=e.units.reduce((function(e,t){return e+t.length}),0),t._bitsAccumulateDuration>=1e3&&(t.bitrate=8*t._bitsAccumulateSize,t._bitsAccumulateDuration=0,t._bitsAccumulateSize=0)}))}}]),e}(),en=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;ce(this,e),he(this,"_core",null),he(this,"_samples",[]),this._core=t,this._timescale=n,this._stats=new $t(n),this._bindEvents()}return de(e,[{key:"getStats",value:function(){var e,t,n,r,i,o,a,s=(null===(e=this._core)||void 0===e?void 0:e.media)||{},u=s.currentTime,c=void 0===u?0:u,l=s.decodeFps,d=void 0===l?0:l;return ie(ie({},this._stats.getStats()),{},{downloadSpeed:(null===(t=this._core)||void 0===t||null===(n=t.speedInfo)||void 0===n?void 0:n.call(t).speed)||0,avgSpeed:(null===(r=this._core)||void 0===r||null===(i=r.speedInfo)||void 0===i?void 0:i.call(r).avgSpeed)||0,currentTime:c,bufferEnd:(null===(o=this._core)||void 0===o||null===(a=o.bufferInfo())||void 0===a?void 0:a.remaining)||0,decodeFps:d})}},{key:"_bindEvents",value:function(){var e=this;this._core.on(Pt,(function(t){var n=t.videoTrack;return e._stats.updateBitrate(n.samples)})),this._core.on(It,(function(t){e._stats.setFpsFromScriptData(t)})),this._core.on(xt,(function(t){"video"===t.type?e._stats.setVideoMeta(t.track):e._stats.setAudioMeta(t.track)})),this._core.on(yt,(function(t){e._stats.setDomain(t.responseUrl)}))}},{key:"reset",value:function(){this._samples=[],this._stats=new $t(this._timescale)}}]),e}();function tn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,mn(r.key),r)}}function rn(e,t,n){return t&&nn(e.prototype,t),n&&nn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function on(e,t,n){return(t=mn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function an(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&&un(e,t)}function sn(e){return(sn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function un(e,t){return(un=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function cn(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 function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function ln(e){var t=function(){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}}();return function(){var n,r=sn(e);if(t){var i=sn(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return cn(this,n)}}function dn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(l){c=!0,i=l}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||fn(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 hn(e){return function(e){if(Array.isArray(e))return pn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||fn(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 fn(e,t){if(e){if("string"==typeof e)return pn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pn(e,t):void 0}}function pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function mn(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;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 yn="video",vn="audio",gn="metadata",bn="avc",An="hevc",_n="aac",wn="g7110a",Sn="g7110m",kn="LARGE_AV_SHIFT",Tn="LARGE_VIDEO_GAP",xn="LARGE_VIDEO_GAP_BETWEEN_CHUNK",En="LARGE_AUDIO_GAP",Ln="AUDIO_FILLED",In="AUDIO_DROPPED",Rn=function(){function e(){tn(this,e),on(this,"id",1),on(this,"type",yn),on(this,"codecType",bn),on(this,"pid",-1),on(this,"hvcC",void 0),on(this,"codec",""),on(this,"timescale",0),on(this,"formatTimescale",0),on(this,"sequenceNumber",0),on(this,"baseMediaDecodeTime",0),on(this,"baseDts",0),on(this,"duration",0),on(this,"warnings",[]),on(this,"samples",[]),on(this,"pps",[]),on(this,"sps",[]),on(this,"vps",[]),on(this,"fpsNum",0),on(this,"fpsDen",0),on(this,"sarRatio",[]),on(this,"width",0),on(this,"height",0),on(this,"nalUnitSize",4),on(this,"present",!1),on(this,"isVideoEncryption",!1),on(this,"isAudioEncryption",!1),on(this,"isVideo",!0),on(this,"kid",null),on(this,"pssh",null),on(this,"ext",void 0)}return rn(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:"exist",value:function(){return!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isVideoEncryption}}]),e}(),Zn=function(){function e(){tn(this,e),on(this,"id",2),on(this,"type",vn),on(this,"codecType",_n),on(this,"pid",-1),on(this,"codec",""),on(this,"sequenceNumber",0),on(this,"sampleDuration",0),on(this,"timescale",0),on(this,"formatTimescale",0),on(this,"baseMediaDecodeTime",0),on(this,"duration",0),on(this,"warnings",[]),on(this,"samples",[]),on(this,"baseDts",0),on(this,"sampleSize",16),on(this,"sampleRate",0),on(this,"channelCount",0),on(this,"objectType",0),on(this,"sampleRateIndex",0),on(this,"config",[]),on(this,"present",!1),on(this,"isVideoEncryption",!1),on(this,"isAudioEncryption",!1),on(this,"kid",null),on(this,"ext",void 0)}return rn(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.codecType===_n)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}}]),e}(),Cn=function(){function e(t,n,r){tn(this,e),on(this,"flag",{}),on(this,"keyframe",!1),on(this,"gopId",0),on(this,"duration",0),on(this,"size",0),on(this,"units",[]),on(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=n,r&&(this.units=r)}return rn(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}(),Pn=rn((function e(t,n,r,i){tn(this,e),on(this,"duration",1024),on(this,"flag",{dependsOn:2,isNonSyncSample:0}),on(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=n,this.size=n.byteLength,this.sampleOffset=i,r&&(this.duration=r)})),Gn=rn((function e(t,n){tn(this,e),on(this,"time",0),this.data=t,this.originPts=this.pts=n})),Dn=function(e){an(n,e);var t=ln(n);function n(){return tn(this,n),t.apply(this,arguments)}return rn(n)}(Gn),Mn=function(e){an(n,e);var t=ln(n);function n(){return tn(this,n),t.apply(this,arguments)}return rn(n)}(Gn),Vn=function(){function e(){tn(this,e),on(this,"id",3),on(this,"type",gn),on(this,"timescale",0),on(this,"flvScriptSamples",[]),on(this,"seiSamples",[])}return rn(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}(),Xn=function(){function e(t){tn(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]")}return rn(e,[{key:"warn",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(r))}}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();on(Xn,"disabled",!0);var Wn="undefined"!=typeof window,On=Wn&&navigator.userAgent.toLocaleLowerCase(),Nn=Wn&&/^((?!chrome|android).)*safari/.test(On),Un=Wn&&On.includes("firefox"),Fn=Wn&&On.includes("android"),Yn=function(){function e(){tn(this,e)}return rn(e,null,[{key:"getRateIndexByRate",value:function(t){return e.FREQ.indexOf(t)}},{key:"parseADTS",value:function(t,n){for(var r=t.length,i=0;i+2<r&&(255!==t[i]||240!=(246&t[i+1]));)i++;if(!(i>=r)){var o=i,a=[],s=(60&t[i+2])>>>2,u=e.FREQ[s];if(!u)throw new Error("Invalid sampling index: ".concat(s));for(var c,l,d=1+((192&t[i+2])>>>6),h=(1&t[i+2])<<2|(192&t[i+3])>>>6,f=e._getConfig(s,h,d),p=f.config,m=f.codec,y=0,v=e.getFrameDuration(u);i+7<r;)if(255===t[i]&&240==(246&t[i+1])){if(r-i<(l=(3&t[i+3])<<11|t[i+4]<<3|(224&t[i+5])>>5))break;c=2*(1&~t[i+1]),a.push({pts:n+y*v,data:t.subarray(i+7+c,i+l)}),y++,i+=l}else i++;return{skip:o,remaining:i>=r?void 0:t.subarray(i),frames:a,samplingFrequencyIndex:s,sampleRate:u,objectType:d,channelCount:h,codec:m,config:p,originCodec:"mp4a.40.".concat(d)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var n=t[0]>>>3,r=(7&t[0])<<1|t[1]>>>7,i=(120&t[1])>>>3,o=e.FREQ[r];if(o){var a=e._getConfig(r,i,n);return{samplingFrequencyIndex:r,sampleRate:o,objectType:n,channelCount:i,config:a.config,codec:a.codec,originCodec:"mp4a.40.".concat(n)}}}}},{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,n){var r,i,o=[];return Un?e>=6?(r=5,i=e-3):(r=2,i=e):Fn?(r=2,i=e):(r=2===n||5===n?n:5,i=e,e>=6?i=e-3:1===t&&(r=2,i=e)),o[0]=r<<3,o[0]|=(14&e)>>1,o[1]=(1&e)<<7,o[1]|=t<<3,5===r&&(o[1]|=(14&i)>>1,o[2]=(1&i)<<7,o[2]|=8,o[3]=0),{config:o,codec:"mp4a.40.".concat(r)}}},{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}();on(Yn,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var Kn=1e3,jn=5e3,Hn=function(){function e(t,n,r){tn(this,e),this.videoTrack=t,this.audioTrack=n,this.metadataTrack=r,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 rn(e,[{key:"fix",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t=Math.round(1e3*t);var i=this.videoTrack,o=this.audioTrack;if(!n&&r||(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),n&&!r&&(this._baseDtsInited=!1),this._baseDtsInited||this._calculateBaseDts(o,i),!r&&t&&(this._audioNextPts=this._videoNextDts=t),this._baseDtsInited&&(this._videoTimestampBreak||!this.videoTrack.exist())&&(this._audioTimestampBreak||!this.audioTrack.exist())&&this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(o),this._keyFrameInNextChunk=!1,this._fixVideo(i),this.metadataTrack.exist()){var a=this.metadataTrack.timescale;this.metadataTrack.seiSamples.forEach((function(t){t.pts=t.originPts-e._baseDts,t.time=Math.max(0,t.pts)/a})),this.metadataTrack.flvScriptSamples.forEach((function(t){t.pts=t.originPts-e._baseDts,t.time=Math.max(0,t.pts)/a}))}i.samples.length&&(i.baseMediaDecodeTime=i.samples[0].dts),o.samples.length&&(o.baseMediaDecodeTime=o.samples[0].pts*o.timescale/1e3)}},{key:"_fixVideo",value:function(e){var t=this,n=e.samples;if(n.length){var r;if(n.forEach((function(e){e.dts-=t._baseDts,e.pts-=t._baseDts,e.keyframe&&(t._keyFrameInNextChunk=!0)})),e.fpsNum&&e.fpsDen)r=e.timescale*(e.fpsDen/e.fpsNum);else if(e.length>1){var i=e.samples[0],o=e.samples[n.length-1];r=Math.floor((o.dts-i.dts)/(n.length-1))}else r=this._lastVideoDuration||40;var a=n.pop();if(this._videoLastSample&&n.unshift(this._videoLastSample),this._videoLastSample=a,n.length){if(void 0===this._videoNextDts){var s=n[0];this._videoNextDts=s.dts}var u=n.length,c=0,l=n[0],d=this._videoNextDts-l.dts;if(Math.abs(d)>200){var h;if(Math.abs(l.dts-this._lastVideoExceptionChunkFirstDtsDot)>5e3)this._lastVideoExceptionChunkFirstDtsDot=l.dts,e.warnings.push({type:xn,nextDts:this._videoNextDts,firstSampleDts:l.dts,nextSampleDts:null===(h=n[1])||void 0===h?void 0:h.dts,sampleDuration:d});this._videoTimestampBreak>=5?(this._videoNextDts=l.dts,this._videoTimestampBreak=0):(l.dts+=d,l.pts+=d,this.audioTrack.exist()||(this._videoTimestampBreak=1))}for(var f=0;f<u;f++){var p=n[f].dts,m=n[f+1];((c=f<u-1?m.dts-p:a?a.dts-p:r)>1e3||c<0)&&(this._videoTimestampBreak++,Math.abs(p-this._lastVideoExceptionLargeGapDot)>5e3&&(this._lastVideoExceptionLargeGapDot=p,e.warnings.push({type:Tn,time:p/e.timescale,dts:p,originDts:n[f].originDts,nextDts:this._videoNextDts,sampleDuration:c,refSampleDuration:r})),c=r),n[f].duration=c,this._videoNextDts+=c,this._lastVideoDuration=c}}}}},{key:"_fixAudio",value:function(e){var t=this,n=e.samples;n.length&&(n.forEach((function(e){e.dts=e.pts-=t._baseDts})),this._doFixAudioInternal(e,n,1e3))}},{key:"_calculateBaseDts",value:function(e,t){var n=e.samples,r=t.samples;if(!n.length&&!r.length)return!1;var i=1/0,o=1/0;n.length&&(e.baseDts=i=n[0].pts),r.length&&(t.baseDts=o=r[0].dts),this._baseDts=Math.min(i,o);var a=o-i;return Number.isFinite(a)&&Math.abs(a)>500&&t.warnings.push({type:kn,videoBaseDts:o,audioBasePts:i,baseDts:this._baseDts,delta:a}),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,n){e.sampleDuration||(e.sampleDuration=e.codecType===_n?Yn.getFrameDuration(e.timescale,n):this._getG711Duration(e));var r=e.sampleDuration,i=e.codecType===_n?1024:r*e.timescale/1e3;if(void 0===this._audioNextPts){var o=t[0];this._audioNextPts=o.pts}for(var a=0;a<t.length;a++){var s=this._audioNextPts,u=t[a],c=u.pts-s;if(0===a&&this._audioTimestampBreak>=5&&this._keyFrameInNextChunk&&(s=this._audioNextPts=u.dts,c=0,this._audioTimestampBreak=0),!this._audioTimestampBreak&&c>=3*r&&c<=Kn&&!Nn){var l=this._getSilentFrame(e)||t[0].data.subarray(),d=Math.floor(c/r);Math.abs(u.pts-this._lastAudioExceptionGapDot)>jn&&(this._lastAudioExceptionGapDot=u.pts,e.warnings.push({type:Ln,pts:u.pts,originPts:u.originPts,count:d,nextPts:s,refSampleDuration:r}));for(var h=0;h<d;h++){var f=new Pn(Math.floor(this._audioNextPts+r)-Math.floor(this._audioNextPts),l,i);f.originPts=Math.floor(this._baseDts+s),t.splice(a,0,f),this._audioNextPts+=r,a++}a--}else c<=-3*r&&c>=-1e3?(Math.abs(u.pts-this._lastAudioExceptionOverlapDot)>jn&&(this._lastAudioExceptionOverlapDot=u.pts,e.warnings.push({type:In,pts:u.pts,originPts:u.originPts,nextPts:s,refSampleDuration:r})),t.splice(a,1),a--):(Math.abs(c)>Kn&&(this._audioTimestampBreak++,Math.abs(u.pts-this._lastAudioExceptionLargeGapDot)>jn&&(this._lastAudioExceptionLargeGapDot=u.pts,e.warnings.push({type:En,time:u.pts/1e3,pts:u.pts,originPts:u.originPts,nextPts:s,sampleDuration:c,refSampleDuration:r}))),u.dts=u.pts=s,u.duration=i,this._audioNextPts+=r)}}},{key:"_getG711Duration",value:function(e){var t=e.sampleSize,n=e.channelCount,r=e.sampleRate,i=e.samples[0];if(i)return 2*i.data.byteLength/n/(t/8)/r*1e3}},{key:"_getSilentFrame",value:function(e){return e.codecType===_n?Yn.getSilentFrame(e.codec,e.channelCount):new Uint8Array(8*e.sampleDuration*e.channelCount)}}]),e}();function Bn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t=t.filter(Boolean);var r=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){r.set(e,i),i+=e.byteLength})),r}function Jn(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 zn(e){for(var t,n="avc1.",r=0;r<3;r++)(t=e[r].toString(16)).length<2&&(t="0".concat(t)),n+=t;return n}function Qn(e){if(!Array.isArray(e)){for(var t=[],n="",r=0;r<e.length;r++)r%2&&(n=e[r-1]+e[r],t.push(parseInt(n,16)),n="");return t}return e.map((function(e){return parseInt(e,16)}))}var qn=function(){function e(){tn(this,e)}return rn(e,null,[{key:"parseAnnexB",value:function(e){for(var t=e.length,n=2,r=0;null!==e[n]&&void 0!==e[n]&&1!==e[n];)n++;if((r=++n+2)>=t)return[];for(var i=[];r<t;)switch(e[r]){case 0:if(0!==e[r-1]){r+=2;break}if(0!==e[r-2]){r++;break}n!==r-2&&i.push(e.subarray(n,r-2));do{r++}while(1!==e[r]&&r<t);r=(n=r+1)+2;break;case 1:if(0!==e[r-1]||0!==e[r-2]){r+=3;break}n!==r-2&&i.push(e.subarray(n,r-2)),r=(n=r+1)+2;break;default:r+=3}return n<t&&i.push(e.subarray(n)),i}},{key:"parseAvcC",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(!(e.length<4)){for(var n,r=e.length,i=[],o=0;o+t<r;)if(n=Jn(e,o),3===t&&(n>>>=8),o+=t,n){if(o+n>r)break;i.push(e.subarray(o,o+n)),o+=n}return i}}},{key:"parseSEI",value:function(e,t){for(var n=e.length,r=t?2:1,i=0,o=0,a="";255===e[r];)i+=255,r++;for(i+=e[r++];255===e[r];)o+=255,r++;if(o+=e[r++],5===i&&n>r+16)for(var s=0;s<16;s++)a+=e[r].toString(16),r++;return{payload:e.subarray(r,r+o),type:i,size:o,uuid:a}}},{key:"removeEPB",value:function(e){for(var t=e.byteLength,n=[],r=1;r<t-2;)0===e[r]&&0===e[r+1]&&3===e[r+2]?(n.push(r+2),r+=2):r++;if(!n.length)return e;var i=t-n.length,o=new Uint8Array(i),a=0;for(r=0;r<i;a++,r++)a===n[0]&&(a++,n.shift()),o[r]=e[a];return o}}]),e}(),$n=function(){function e(t){if(tn(this,e),on(this,"_bytesAvailable",void 0),on(this,"_bitsAvailable",0),on(this,"_word",0),!t)throw new Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}return rn(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 n=new Uint8Array(4);n.set(this._data.subarray(e,e+t)),this._word=new DataView(n.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),n=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?n<<t|this.readBits(t):n}},{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,n=8,r=0;r<e;r++)0!==n&&(n=(t+this.readEG()+256)%256),t=0===n?t:n}}]),e}(),er=function(){function e(){tn(this,e)}return rn(e,null,[{key:"parseAVCDecoderConfigurationRecord",value:function(t){if(!(t.length<7)){for(var n,r,i=1+(3&t[4]),o=[],a=[],s=6,u=31&t[5],c=0;c<u;c++)if(r=t[s]<<8|t[s+1],s+=2,r){var l=t.subarray(s,s+r);s+=r,o.push(l),n||(n=e.parseSPS(qn.removeEPB(l)))}var d,h=t[s];s++;for(var f=0;f<h;f++)d=t[s]<<8|t[s+1],s+=2,d&&(a.push(t.subarray(s,s+d)),s+=d);return{sps:n,spsArr:o,ppsArr:a,nalUnitSize:i}}}},{key:"parseSPS",value:function(e){var t=new $n(e);t.readUByte();var n=t.readUByte(),r=t.readUByte(),i=t.readUByte();t.skipUEG();var o=420;if(100===n||110===n||122===n||244===n||44===n||83===n||86===n||118===n||128===n||138===n||144===n){var a=t.readUEG();if(a<=3&&(o=[0,420,422,444][a]),3===a&&t.skipBits(1),t.skipUEG(),t.skipUEG(),t.skipBits(1),t.readBool())for(var s=3!==a?8:12,u=0;u<s;u++)t.readBool()&&(u<6?t.skipScalingList(16):t.skipScalingList(64))}t.skipUEG();var c=t.readUEG();if(0===c)t.readUEG();else if(1===c){t.skipBits(1),t.skipUEG(),t.skipUEG();for(var l=t.readUEG(),d=0;d<l;d++)t.skipUEG()}t.skipUEG(),t.skipBits(1);var h=t.readUEG(),f=t.readUEG(),p=t.readBits(1);0===p&&t.skipBits(1),t.skipBits(1);var m,y,v,g,b,A=0,_=0,w=0,S=0;if(t.readBool()&&(A=t.readUEG(),_=t.readUEG(),w=t.readUEG(),S=t.readUEG()),t.readBool()){if(t.readBool())switch(t.readUByte()){case 1:m=[1,1];break;case 2:m=[12,11];break;case 3:m=[10,11];break;case 4:m=[16,11];break;case 5:m=[40,33];break;case 6:m=[24,11];break;case 7:m=[20,11];break;case 8:m=[32,11];break;case 9:m=[80,33];break;case 10:m=[18,11];break;case 11:m=[15,11];break;case 12:m=[64,33];break;case 13:m=[160,99];break;case 14:m=[4,3];break;case 15:m=[3,2];break;case 16:m=[2,1];break;case 255:m=[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 k=t.readBits(32),T=t.readBits(32);y=t.readBool(),b=(v=T)/(g=2*k)}}return{codec:zn(e.subarray(1,4)),profileIdc:n,profileCompatibility:r,levelIdc:i,chromaFormat:o,width:Math.ceil(16*(h+1)-2*(A+_)),height:(2-p)*(f+1)*16-(p?2:4)*(w+S),sarRatio:m,fpsNum:v,fpsDen:g,fps:b,fixedFrame:y}}}]),e}(),tr=function(){function e(){tn(this,e)}return rn(e,null,[{key:"parseHEVCDecoderConfigurationRecord",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(t.length<23)){n=n||{};for(var r,i,o,a,s,u=1+(3&t[21]),c=[],l=[],d=[],h=23,f=t[22],p=0;p<f;p++){o=63&t[h],a=t[h+1]<<8|t[h+2],h+=3;for(var m=0;m<a;m++)if(s=t[h]<<8|t[h+1],h+=2,s){switch(o){case 32:var y=t.subarray(h,h+s);r||(r=e.parseVPS(qn.removeEPB(y),n)),d.push(y);break;case 33:var v=t.subarray(h,h+s);i||(i=e.parseSPS(qn.removeEPB(v),n)),c.push(v);break;case 34:l.push(t.subarray(h,h+s))}h+=s}}return{hvcC:n,sps:i,spsArr:c,ppsArr:l,vpsArr:d,nalUnitSize:u}}}},{key:"parseVPS",value:function(t,n){n=n||{};var r=new $n(t);r.readUByte(),r.readUByte(),r.readBits(12);var i=r.readBits(3);return n.numTemporalLayers=Math.max(n.numTemporalLayers||0,i+1),r.readBits(17),e._parseProfileTierLevel(r,i,n),n}},{key:"parseSPS",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n=n||{};var r=new $n(t);r.readUByte(),r.readUByte(),r.readBits(4);var i=r.readBits(3);n.numTemporalLayers=Math.max(i+1,n.numTemporalLayers||0),n.temporalIdNested=r.readBits(1),e._parseProfileTierLevel(r,i,n),r.readUEG();var o=n.chromaFormatIdc=r.readUEG(),a=420;o<=3&&(a=[0,420,422,444][o]);var s=0;3===o&&(s=r.readBits(1));var u,c,l,d,h=r.readUEG(),f=r.readUEG(),p=r.readBits(1);(1===p&&(u=r.readUEG(),c=r.readUEG(),l=r.readUEG(),d=r.readUEG()),n.bitDepthLumaMinus8=r.readUEG(),n.bitDepthChromaMinus8=r.readUEG(),1===p)&&(h-=(1!==o&&2!==o||0!==s?1:2)*(c+u),f-=(1===o&&0===s?2:1)*(d+l));return{codec:"hev1.1.6.L93.B0",width:h,height:f,chromaFormat:a,hvcC:n}}},{key:"_parseProfileTierLevel",value:function(e,t,n){var r=n.generalTierFlag||0;n.generalProfileSpace=e.readBits(2),n.generalTierFlag=Math.max(e.readBits(1),r),n.generalProfileIdc=Math.max(e.readBits(5),n.generalProfileIdc||0),n.generalProfileCompatibilityFlags=e.readBits(32),n.generalConstraintIndicatorFlags=[e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8)];var i=e.readBits(8);r<n.generalTierFlag?n.generalLevelIdc=i:n.generalLevelIdc=Math.max(i,n.generalLevelIdc||0);var o=[],a=[];if(t>e.bitsAvailable)throw new Error("maxSubLayersMinus inavlid size ".concat(t));for(var s=0;s<t;s++)o[s]=e.readBits(1),a[s]=e.readBits(1);t>0&&e.readBits(2*(8-t));for(var u=0;u<t;u++)0!==o[u]&&(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!==a[u]&&e.readBits(8)}}]),e}(),nr=function(){function e(){tn(this,e)}return rn(e,null,[{key:"decode",value:function(t){for(var n=[],r=t,i=0,o=t.length;i<o;)if(r[i]<128)n.push(String.fromCharCode(r[i])),++i;else{if(r[i]<192);else if(r[i]<224){if(e._checkContinuation(r,i,1)){var a=(31&r[i])<<6|63&r[i+1];if(a>=128){n.push(String.fromCharCode(65535&a)),i+=2;continue}}}else if(r[i]<240){if(e._checkContinuation(r,i,2)){var s=(15&r[i])<<12|(63&r[i+1])<<6|63&r[i+2];if(s>=2048&&55296!=(63488&s)){n.push(String.fromCharCode(65535&s)),i+=3;continue}}}else if(r[i]<248&&e._checkContinuation(r,i,3)){var u=(7&r[i])<<18|(63&r[i+1])<<12|(63&r[i+2])<<6|63&r[i+3];if(u>65536&&u<1114112){u-=65536,n.push(String.fromCharCode(u>>>10|55296)),n.push(String.fromCharCode(1023&u|56320)),i+=4;continue}}n.push(String.fromCharCode(65533)),++i}return n.join("")}},{key:"_checkContinuation",value:function(e,t,n){var r=e;if(t+n<r.length){for(;n--;)if(128!=(192&r[++t]))return!1;return!0}return!1}}]),e}(),rr=function(){function e(){tn(this,e)}return rn(e,null,[{key:"parse",value:function(t){if(!(t.length<3)){var n={},r=e._parseValue(new DataView(t.buffer,t.byteOffset,t.byteLength)),i=e._parseValue(new DataView(t.buffer,t.byteOffset+r.size,t.byteLength-r.size));return n[r.data]=i.data,n}}},{key:"_parseValue",value:function(t){var n,r=t.byteLength,i=1,o=!1;switch(t.getUint8(0)){case 0:n=t.getFloat64(1),i+=8;break;case 1:n=!!t.getUint8(1),i+=1;break;case 2:var a=e._parseString(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i));n=a.data,i+=a.size;break;case 3:n={};var s=0;for(9==(16777215&t.getUint32(r-4))&&(s=3);i<r-4;){var u=e._parseObject(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i-s)),c=u.size,l=u.data;if(u.isEnd)break;n[l.name]=l.value,i+=c}if(i<=r-3)9===(16777215&t.getUint32(i-1))&&(i+=3);break;case 8:n={},i+=4;var d=0;for(9==(16777215&t.getUint32(r-4))&&(d=3);i<r-8;){var h=e._parseObject(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i-d)),f=h.size,p=h.data;if(h.isEnd)break;n[p.name]=p.value,i+=f}if(i<=r-3)9===(16777215&t.getUint32(i-1))&&(i+=3);break;case 9:n=void 0,i=1,o=!0;break;case 10:n=[];var m=t.getUint32(1);i+=4;for(var y=0;y<m;y++){var v=e._parseValue(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i)),g=v.data,b=v.size;n.push(g),i+=b}break;case 11:var A=t.getFloat64(i)+6e4*t.getInt16(i+8);n=new Date(A),i+=10;break;case 12:var _=t.getUint32(1);i+=4,n="",_>0&&(n=nr.decode(new Uint8Array(t.buffer,t.byteOffset+i,_))),i+=_;break;default:i=r}return{data:n,size:i,isEnd:o}}},{key:"_parseString",value:function(e){var t=e.getUint16(0),n="";return t>0&&(n=nr.decode(new Uint8Array(e.buffer,e.byteOffset+2,t))),{data:n,size:2+t}}},{key:"_parseObject",value:function(t){if(!(t.byteLength<3)){var n=e._parseString(t),r=e._parseValue(new DataView(t.buffer,t.byteOffset+n.size,t.byteLength-n.size));return{data:{name:n.data,value:r.data},size:n.size+r.size,isEnd:r.isEnd}}}}]),e}(),ir=new Xn("FlvDemuxer"),or=function(){function e(t,n,r){tn(this,e),on(this,"_headerParsed",!1),on(this,"_remainingData",null),on(this,"_gopId",0),on(this,"_needAddMetaBeforeKeyFrameNal",!0),this.videoTrack=t||new Rn,this.audioTrack=n||new Zn,this.metadataTrack=r||new Vn,this._fixer=new Hn(this.videoTrack,this.audioTrack,this.metadataTrack)}return rn(e,[{key:"demux",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=this.audioTrack,o=this.videoTrack,a=this.metadataTrack;if(!n&&r||(this._remainingData=null),n&&(this._headerParsed=!1),n?(o.reset(),i.reset(),a.reset()):(o.samples=[],i.samples=[],a.seiSamples=[],a.flvScriptSamples=[],o.warnings=[],i.warnings=[],this._remainingData&&(t=Bn(this._remainingData,t),this._remainingData=null)),!t.length)return{videoTrack:o,audioTrack:i,metadataTrack:a};var s=0;if(!this._headerParsed){if(!e.probe(t))throw new Error("Invalid flv file");i.present=(4&t[4])>>>2!=0,o.present=0!=(1&t[4]),this._headerParsed=!0,s=Jn(t,5)+4}for(var u,c,l,d,h,f=t.length;s+15<f&&(u=t[s],!(s+15+(c=t[s+1]<<16|t[s+2]<<8|t[s+3])>f));)l=(t[s+7]<<24>>>0)+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6],s+=11,d=t.subarray(s,s+c),8===u?this._parseAudio(d,l):9===u?this._parseVideo(d,l):18===u?this._parseScript(d,l):ir.warn("Invalid tag type: ".concat(u)),(h=Jn(t,s+=c))!==11+c&&ir.warn("Invalid PrevTagSize ".concat(h," (").concat(11+c,")")),s+=4;return s<f&&(this._remainingData=t.subarray(s)),i.formatTimescale=o.formatTimescale=o.timescale=a.timescale=1e3,i.timescale=i.sampleRate||0,!i.exist()&&i.hasSample()&&i.reset(),!o.exist()&&o.hasSample()&&o.reset(),{videoTrack:o,audioTrack:i,metadataTrack:a}}},{key:"fix",value:function(e,t,n){return this._fixer.fix(e,t,n),{videoTrack:this.videoTrack,audioTrack:this.audioTrack,metadataTrack:this.metadataTrack}}},{key:"demuxAndFix",value:function(e,t,n,r){return this.demux(e,t,n),this.fix(r,t,n)}},{key:"_parseAudio",value:function(t,n){if(t.length){var r=(240&t[0])>>>4,i=this.audioTrack;if(10!==r&&7!==r&&8!==r)return ir.warn("Unsupported sound format: ".concat(r)),void i.reset();if(10!==r){var o=(12&t[0])>>2,a=(2&t[0])>>1,s=1&t[0];i.sampleRate=e.AUDIO_RATE[o],i.sampleSize=a?16:8,i.channelCount=s+1}10===r?this._parseAac(t,n):this._parseG711(t,n,r)}}},{key:"_parseG711",value:function(e,t,n){var r=this.audioTrack;r.codecType=7===n?wn:Sn,r.sampleRate=8e3,r.codec=r.codecType,r.samples.push(new Pn(t,e.subarray(1)))}},{key:"_parseAac",value:function(e,t){var n=this.audioTrack;if(n.codecType=_n,0===e[1]){var r=Yn.parseAudioSpecificConfig(e.subarray(2));r?(n.codec=r.codec,n.channelCount=r.channelCount,n.sampleRate=r.sampleRate,n.config=r.config,n.objectType=r.objectType,n.sampleRateIndex=r.samplingFrequencyIndex):(n.reset(),ir.warn("Cannot parse AudioSpecificConfig",e))}else if(1===e[1]){if(null==t)return;n.samples.push(new Pn(t,e.subarray(2)))}else ir.warn("Unknown AACPacketType: ".concat(e[1]))}},{key:"_parseVideo",value:function(e,t){var n=this;if(!(e.length<6)){var r=(240&e[0])>>>4,i=15&e[0],o=this.videoTrack;if(7!==i&&12!==i)return o.reset(),void ir.warn("Unsupported codecId: ".concat(i));var a=12===i;o.codecType=a?An:bn;var s=e[1],u=(e[2]<<16|e[3]<<8|e[4])<<8>>8;if(0===s){var c=e.subarray(5),l=a?tr.parseHEVCDecoderConfigurationRecord(c):er.parseAVCDecoderConfigurationRecord(c);if(l){var d=l.hvcC,h=l.sps,f=l.ppsArr,p=l.spsArr,m=l.vpsArr,y=l.nalUnitSize;d&&(o.hvcC=o.hvcC||d),h&&(o.codec=h.codec,o.width=h.width,o.height=h.height,o.sarRatio=h.sarRatio,o.fpsNum=h.fpsNum,o.fpsDen=h.fpsDen),p.length&&(o.sps=p),f.length&&(o.pps=f),m&&m.length&&(o.vps=m),y&&(o.nalUnitSize=y)}else ir.warn("Cannot parse ".concat(a?"HEVC":"AVC","DecoderConfigurationRecord"),e)}else if(1===s){var v=qn.parseAvcC(e.subarray(5),o.nalUnitSize);if((v=this._checkAddMetaNalToUnits(a,v,o))&&v.length){var g=new Cn(t+u,t,v);1===r&&g.setToKeyframe(),o.samples.push(g),v.forEach((function(e){var r=a?e[0]>>>1&63:31&e[0];switch(r){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!a&&5!==r||a&&5===r)break;g.setToKeyframe();break;case 6:case 39:case 40:if(!a&&6!==r||a&&6===r)break;n.metadataTrack.seiSamples.push(new Mn(qn.parseSEI(qn.removeEPB(e),a),t+u))}})),g.keyframe&&this._gopId++,g.gopId=this._gopId}else ir.warn("Cannot parse NALUs",e)}else 2===s||ir.warn("Unknown AVCPacketType: ".concat(s))}}},{key:"_checkAddMetaNalToUnits",value:function(e,t,n){return e&&this._needAddMetaBeforeKeyFrameNal?t.map((function(e){return e[0]>>>1&63})).includes(32)?(this._needAddMetaBeforeKeyFrameNal=!1,t):(t.unshift(n.pps[0]),t.unshift(n.sps[0]),t.unshift(n.vps[0]),t.filter(Boolean)):(this._needAddMetaBeforeKeyFrameNal=!1,t)}},{key:"_parseScript",value:function(e,t){this.metadataTrack.flvScriptSamples.push(new Dn(rr.parse(e),t))}}],[{key:"probe",value:function(e){return 70===e[0]&&76===e[1]&&86===e[2]&&1===e[3]&&Jn(e,5)>=9}}]),e}();on(or,"AUDIO_RATE",[5500,11e3,22e3,44e3]);var ar=function(){function e(){tn(this,e),this.buffer=new Uint8Array(0)}return rn(e,[{key:"write",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach((function(t){t?e.buffer=function(e){for(var t=0,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];r.forEach((function(e){t+=e.length}));var o=new e(t),a=0;return r.forEach((function(e){o.set(e,a),a+=e.length})),o}(Uint8Array,e.buffer,t):window.console.warn(t)}))}}],[{key:"writeUint16",value:function(e){return new Uint8Array([e>>8&255,255&e])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}]),e}(),sr=Math.pow(2,32)-1,ur=function(){function e(){tn(this,e)}return rn(e,null,[{key:"box",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=8+(n=n.filter(Boolean)).reduce((function(e,t){return e+t.byteLength}),0),o=new Uint8Array(i);o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=255&i,o.set(e,4);var a=8;return n.forEach((function(e){o.set(e,a),a+=e.byteLength})),o}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===yn&&e.codecType===An}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return Bn(e.ftyp(t),e.moov(t))}},{key:"pssh",value:function(t){var n=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],Qn(t.kid),[0,0,0,0]));return e.box(e.types.pssh,n)}},{key:"moov",value:function(t){if(t[0].useEME&&(t[0].encv||t[0].enca)){t[0].pssh||(t[0].pssh={kid:t[0].kid});var n=this.pssh(t[0].pssh);return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale),e.mvex(t)].concat(hn(t.map((function(t){return e.trak(t)}))),[n]))}return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale)].concat(hn(t.map((function(t){return e.trak(t)}))),[e.mvex(t)]))}},{key:"mvhd",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mvhd,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,t>>24&255,t>>16&255,t>>8&255,255&t,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]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.tkhdDuration||0,t.width,t.height),e.mdia(t))}},{key:"tkhd",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,255&r,0,0,i>>8&255,255&i,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minf(t))}},{key:"mdhd",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;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,t>>24&255,t>>16&255,t>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"minf",value:function(t){return e.box(e.types.minf,t.type===yn?e.VMHD:e.SMHD,e.DINF,e.stbl(t))}},{key:"stbl",value:function(t){var n=[];return t&&t.ext&&t.ext.stss&&n.push(e.stss(t.ext.stss.entries)),e.box(e.types.stbl,e.stsd(t),e.STTS,n[0],e.STSC,e.STSZ,e.STCO)}},{key:"stsd",value:function(t){var n;return n="audio"===t.type?t.useEME&&t.enca?e.enca(t):e.mp4a(t):t.useEME&&t.encv?e.encv(t):e.avc1hev1(t),e.box(e.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),n)}},{key:"enca",value:function(t){var n=t.enca.channelCount,r=t.enca.sampleRate,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]),o=e.esds(t.config),a=e.sinf(t.enca);return e.box(e.types.enca,i,o,a)}},{key:"encv",value:function(t){var n,r,i=t.sps.length>0?t.sps[0]:[],o=t.pps.length>0?t.pps[0]:[],a=t.width,s=t.height,u=t.sarRatio[0],c=t.sarRatio[1],l=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,a>>8&255,255&a,s>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),d=new Uint8Array((n=(r=[1,i[1],i[2],i[3],255,225,i.length>>>8&255,255&i.length]).concat.apply(r,hn(i)).concat([1,o.length>>>8&255,255&o.length])).concat.apply(n,hn(o))),h=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),f=e.sinf(t.encv),p=new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,c>>24,c>>16&255,c>>8&255,255&c]);return e.box(e.types.encv,l,e.box(e.types.avcC,d),e.box(e.types.btrt,h),f,e.box(e.types.pasp,p))}},{key:"schi",value:function(t){var n=new Uint8Array([]),r=e.tenc(t);return e.box(e.types.schi,n,r)}},{key:"tenc",value:function(t){var n=new Uint8Array([0,0,0,0,0,0,255&t.default_IsEncrypted,255&t.default_IV_size].concat(Qn(t.default_KID)));return e.box(e.types.tenc,n)}},{key:"sinf",value:function(t){var n=new Uint8Array([]),r=new Uint8Array([t.data_format.charCodeAt(0),t.data_format.charCodeAt(1),t.data_format.charCodeAt(2),t.data_format.charCodeAt(3)]),i=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),o=e.schi(t);return e.box(e.types.sinf,n,e.box(e.types.frma,r),e.box(e.types.schm,i),o)}},{key:"avc1hev1",value:function(t){var n=t.codecType===An,r=n?e.types.hvc1:e.types.avc1,i=n?e.hvcC(t):e.avcC(t),o=[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,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,17,17]),i];return n?o.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&o.push(e.pasp(t.sarRatio)),e.box.apply(e,[r].concat(o))}},{key:"avcC",value:function(t){var n,r,i,o=[],a=[];return t.sps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,hn(e))})),t.pps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,hn(e))})),e.box(e.types.avcC,new Uint8Array((n=(r=[1,o[3],o[4],o[5],255,224|t.sps.length]).concat.apply(r,o).concat([t.pps.length])).concat.apply(n,a)))}},{key:"hvcC",value:function(t){var n=t.hvcC;if(n instanceof ArrayBuffer||n instanceof Uint8Array)return n;var r,i=t.vps,o=t.sps,a=t.pps;if(n){var s=n.generalProfileCompatibilityFlags,u=n.generalConstraintIndicatorFlags,c=(i.length&&1)+(o.length&&1)+(a.length&&1);r=[1,n.generalProfileSpace<<6|n.generalTierFlag<<5|n.generalProfileIdc,s>>>24,s>>>16,s>>>8,s,u[0],u[1],u[2],u[3],u[4],u[5],n.generalLevelIdc,240,0,252,252|n.chromaFormatIdc,248|n.bitDepthLumaMinus8,248|n.bitDepthChromaMinus8,0,0,n.numTemporalLayers<<3|n.temporalIdNested<<2|3,c];var l=function(e){var t;r.push(e.length>>8,e.length),(t=r).push.apply(t,hn(e))};i.length&&(r.push(160,0,i.length),i.forEach(l)),o.length&&(r.push(161,0,o.length),o.forEach(l)),a.length&&(r.push(162,0,a.length),a.forEach(l))}else r=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return e.box(e.types.hvcC,new Uint8Array(r))}},{key:"pasp",value:function(t){var n=dn(t,2),r=n[0],i=n[1];return e.box(e.types.pasp,new Uint8Array([r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),t.config.length?e.esds(t.config):void 0)}},{key:"esds",value:function(t){var n=t.length;return e.box(e.types.esds,new Uint8Array([0,0,0,0,3,23+n,0,0,0,4,15+n,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([n]).concat(t).concat([6,1,2])))}},{key:"mvex",value:function(t){return e.box.apply(e,[e.types.mvex].concat(hn(t.map((function(t){return e.trex(t.id)})))))}},{key:"trex",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trex1",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]))}},{key:"trex2",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]))}},{key:"moof",value:function(t){return e.box.apply(e,[e.types.moof,e.mfhd(t[0].samples?t[0].samples[0].gopId:0)].concat(hn(t.map((function(t){return e.traf(t)})))))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"traf",value:function(t){var n=e.tfhd(t.id),r=e.tfdt(t,t.baseMediaDecodeTime),i=0;if(t.isVideo&&t.videoSenc&&t.videoSenc.forEach((function(e){i+=8,e.subsamples&&e.subsamples.length&&(i+=2,i+=6*e.subsamples.length)})),t.videoSencLength=i,t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)){if(t.isVideoEncryption){if(t.isVideo){var o=e.saiz(t),a=e.saio(t),s=e.trun1(t),u=e.senc(t);return e.box(e.types.traf,n,r,o,a,s,u)}if(t.isAudioEncryption){var c=e.sbgp(),l=e.saiz(t),d=e.saio(t),h=e.senc(t),f=e.trun1(t);return e.box(e.types.traf,n,r,c,l,d,h,f)}var p=e.sbgp(),m=e.trun1(t);return e.box(e.types.traf,n,r,p,m)}if(t.isVideo){var y=e.trun1(t);return e.box(e.types.traf,n,r,y)}var v=e.sbgp(),g=e.saiz(t),b=e.saio(t),A=e.senc(t),_=e.trun1(t);return e.box(e.types.traf,n,r,v,g,b,A,_)}var w=e.sdtp(t);return e.box(e.types.traf,n,r,w,e.trun(t.samples,w.byteLength+76))}},{key:"sdtp",value:function(t){var n=new ar;return t.samples.forEach((function(e){n.write(new Uint8Array(t.isVideo?[e.keyframe?32:16]:[16]))})),e.box(e.types.sdtp,this.extension(0,0),n.buffer)}},{key:"trun1",value:function(t){var n=new ar,r=ar.writeUint32(t.samples.length),i=null;if(t.isVideo){var o=t.videoSencLength;i=ar.writeUint32(16*t.samples.length+o+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=ar.writeUint32(16*t.samples.length+92))}else{var a=12*t.samples.length+124;t.isAudioEncryption&&(a=12*t.samples.length+8*t.audioSenc.length+177),i=ar.writeUint32(a)}return t.samples.forEach((function(e){n.write(ar.writeUint32(e.duration)),n.write(ar.writeUint32(e.size)),n.write(ar.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&n.write(ar.writeUint32(e.cts?e.cts:0))})),e.box(e.types.trun,this.extension(0,t.flags),r,i,n.buffer)}},{key:"senc",value:function(t){var n=new ar,r=t.samples.length,i=t.isVideo?16:8,o=t.isVideo?2:0,a=[],s=0;return t.isVideo?(a=t.videoSenc,s=t.videoSencLength):a=t.audioSenc,s=s||i*r,n.write(ar.writeUint32(16+s),e.types.senc,this.extension(0,o)),n.write(ar.writeUint32(r)),a.forEach((function(e){for(var t=0;t<e.InitializationVector.length;t++)n.write(new Uint8Array([e.InitializationVector[t]]));e.subsamples&&e.subsamples.length&&(n.write(ar.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){n.write(ar.writeUint16(e.BytesOfClearData)),n.write(ar.writeUint32(e.BytesOfProtectedData))})))})),n.buffer}},{key:"saio",value:function(t){var n=12*t.samples.length+141;!t.isVideo&&t.isAudioEncryption&&(n=149);var r=new Uint8Array([1,0,0,0,0,0,0,1,0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n]);return e.box(e.types.saio,r)}},{key:"saiz",value:function(t){var n=t.samples.length,r=new Uint8Array([0,0,0,0,16,n>>24&255,n>>16&255,n>>8&255,255&n]);return e.box(e.types.saiz,r)}},{key:"sbgp",value:function(){var t=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return e.box(e.types.sbgp,this.extension(0,0),t)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"tfhd",value:function(t){return e.box(e.types.tfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"tfdt",value:function(t,n){var r=Math.floor(n/(sr+1)),i=Math.floor(n%(sr+1));return t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)?e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])):e.box(e.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"trun",value:function(t,n){var r=t.length,i=12+16*r;n+=8+i;var o=new Uint8Array(i);o.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0);for(var a=0;a<r;a++){var s=t[a],u=s.duration,c=s.size,l=s.flag,d=void 0===l?{}:l,h=s.cts,f=void 0===h?0:h;o.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,c>>>24&255,c>>>16&255,c>>>8&255,255&c,d.isLeading<<2|(null===d.dependsOn||void 0===d.dependsOn?1:d.dependsOn),d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|(null===d.isNonSyncSample||void 0===d.isNonSyncSample?1:d.isNonSyncSample),61440&d.degradationPriority,15&d.degradationPriority,f>>>24&255,f>>>16&255,f>>>8&255,255&f],12+16*a)}return e.box(e.types.trun,o)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(hn(t.map((function(t){return e.trackMP4(t)})))))}},{key:"trackMP4",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.duration,t.width,t.height),e.mdiaMP4(t))}},{key:"mdiaMP4",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minfMP4(t))}},{key:"minfMP4",value:function(t){return e.box(e.types.minf,t.type===yn?e.VMHD:e.SMHD,e.DINF,e.stblMP4(t))}},{key:"stblMP4",value:function(t){var n=t.ext,r=[e.stsd(t),e.stts(n.stts),e.stsc(n.stsc),e.stsz(n.stsz),e.stco(n.stco)];return n.stss.length&&r.push(e.stss(n.stss)),n.ctts.length&&r.push(e.ctts(n.ctts)),e.box.apply(e,[e.types.stbl].concat(r))}},{key:"stts",value:function(t){var n=t.length,r=new Uint8Array(8*n),i=0;return t.forEach((function(e){var t=e.value,n=e.count;r.set([n>>24,n>>16&255,n>>8&255,255&n,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.stts,Bn(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stsc",value:function(t){var n=t.length,r=new Uint8Array(12*n),i=0;return t.forEach((function(e){var t=e.firstChunk,n=e.samplesPerChunk,o=e.sampleDescIndex;r.set([t>>24,t>>16&255,t>>8&255,255&t,n>>24,n>>16&255,n>>8&255,255&n,o>>24,o>>16&255,o>>8&255,255&o],i),i+=12})),e.box(e.types.stsc,Bn(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stsz",value:function(t){var n=t.length,r=new Uint8Array(4*n),i=0;return t.forEach((function(e){r.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stsz,Bn(new Uint8Array([0,0,0,0,0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stco",value:function(t){var n=t.length,r=new Uint8Array(4*n),i=0;return t.forEach((function(e){r.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stco,Bn(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stss",value:function(t){var n=t.length,r=new Uint8Array(4*n),i=0;return t.forEach((function(e){r.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stss,Bn(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"ctts",value:function(t){var n=t.length,r=new Uint8Array(8*n),i=0;return t.forEach((function(e){var t=e.value,n=e.count;r.set([n>>24,n>>16&255,n>>8&255,255&n,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.ctts,Bn(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"styp",value:function(){return e.box(e.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(t){var n=t.timescale,r=t.samples[0].duration,i=r*t.samples.length,o=t.samples[0].sampleOffset*r,a=8;t.samples.forEach((function(e){a+=e.size}));var s=0;if(t.isVideo){var u,c=0;t.videoSenc&&(u=t.videoSenc),t.isVideo&&u.forEach((function(e){c+=8,e.subsamples&&e.subsamples.length&&(c+=2,c+=6*e.subsamples.length)})),t.videoSencLength=c,s=a+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=a+16*t.samples.length+84)}else s=a+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=a+169+12*t.samples.length+8*t.audioSenc.length);var l=new Uint8Array([0,0,0,0,0,0,0,255&t.id,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,1,0,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,144,0,0,0]);return e.box(e.types.sidx,l)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}]),e}();on(ur,"types",["avc1","avcC","hvc1","hvcC","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp"].reduce((function(e,t){return e[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)],e}),Object.create(null))),on(ur,"HDLR_TYPES",{video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])}),on(ur,"FTYPAVC1",ur.box(ur.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),on(ur,"FTYPHEV1",ur.box(ur.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),on(ur,"DINF",ur.box(ur.types.dinf,ur.box(ur.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),on(ur,"VMHD",ur.box(ur.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),on(ur,"SMHD",ur.box(ur.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),on(ur,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),on(ur,"STTS",ur.box(ur.types.stts,ur.StblTable)),on(ur,"STSC",ur.box(ur.types.stsc,ur.StblTable)),on(ur,"STSZ",ur.box(ur.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),on(ur,"STCO",ur.box(ur.types.stco,ur.StblTable));var cr=function(){function e(t,n){tn(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=n}return rn(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).debug.apply(t,[this._prefix].concat(r))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).log.apply(t,[this._prefix].concat(r))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(r))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).error.apply(t,[this._prefix].concat(r))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();on(cr,"disabled",!0);var lr=function(){function e(t,n,r){tn(this,e),this.videoTrack=t,this.audioTrack=n;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new cr("FMP4Remuxer",!r||!r.openLog||!r.openLog)}return rn(e,[{key:"remux",value:function(){var e,t,n,r,i,o=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),l=u.exist(),d=[];return o&&(a&&a.initMerge?(c&&d.push(this.videoTrack),l&&d.push(this.audioTrack),n=ur.initSegment(d)):(c&&(e=ur.initSegment([this.videoTrack])),l&&(t=ur.initSegment([this.audioTrack])))),c&&s.hasSample()&&(r=this._remuxVideo()),l&&u.hasSample()&&(i=this._remuxAudio()),s.samples=[],u.samples=[],{initSegment:n,videoInitSegment:e,audioInitSegment:t,videoSegment:r,audioSegment:i}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack;this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0});var t=e.samples,n=0;t.forEach((function(e){n+=e.units.reduce((function(e,t){return e+t.byteLength}),0),n+=4*e.units.length}));for(var r,i=new Uint8Array(n),o=new DataView(i.buffer),a=function(e,n){n=t[s];var a=0;n.units.forEach((function(t){o.setUint32(e,t.byteLength),e+=4,i.set(t,e),e+=t.byteLength,a+=4+t.byteLength})),n.size=a,c=e,r=n},s=0,u=t.length,c=0;s<u;s++)a(c,r);var l=ur.mdat(i);return Bn(ur.moof([e]),l)}},{key:"_remuxAudio",value:function(){var e=this.audioTrack,t=new Uint8Array(e.samples.reduce((function(e,t){return e+t.size}),0));e.samples.reduce((function(e,n){return t.set(n.data,e),e+n.size}),0);var n=ur.mdat(t);return Bn(ur.moof([e]),n)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}();class dr{static create(...e){return new this(...e)}mixIn(e){return Object.assign(this,e)}clone(){const e=new this.constructor;return Object.assign(e,this),e}}class hr extends dr{constructor(e=[],t=4*e.length){super();let n=e;if(n instanceof ArrayBuffer&&(n=new Uint8Array(n)),(n instanceof Int8Array||n instanceof Uint8ClampedArray||n instanceof Int16Array||n instanceof Uint16Array||n instanceof Int32Array||n instanceof Uint32Array||n instanceof Float32Array||n instanceof Float64Array)&&(n=new Uint8Array(n.buffer,n.byteOffset,n.byteLength)),n instanceof Uint8Array){const e=n.byteLength,t=[];for(let r=0;r<e;r+=1)t[r>>>2]|=n[r]<<24-r%4*8;this.words=t,this.sigBytes=e}else this.words=e,this.sigBytes=t}static random(e){const t=[],n=e=>{let t=e,n=987654321;const r=4294967295;return()=>{n=36969*(65535&n)+(n>>16)&r,t=18e3*(65535&t)+(t>>16)&r;let e=(n<<16)+t&r;return e/=4294967296,e+=.5,e*(Math.random()>.5?1:-1)}};for(let r,i=0;i<e;i+=4){const e=n(4294967296*(r||Math.random()));r=987654071*e(),t.push(4294967296*e()|0)}return new hr(t,e)}toString(e=fr){return e.stringify(this)}concat(e){const t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(let o=0;o<i;o+=1){const e=n[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=e<<24-(r+o)%4*8}else for(let o=0;o<i;o+=4)t[r+o>>>2]=n[o>>>2];return this.sigBytes+=i,this}clamp(){const{words:e,sigBytes:t}=this;e[t>>>2]&=4294967295<<32-t%4*8,e.length=Math.ceil(t/4)}clone(){const e=super.clone.call(this);return e.words=this.words.slice(0),e}}const fr={stringify(e){const{words:t,sigBytes:n}=e,r=[];for(let i=0;i<n;i+=1){const e=t[i>>>2]>>>24-i%4*8&255;r.push((e>>>4).toString(16)),r.push((15&e).toString(16))}return r.join("")},parse(e){const t=e.length,n=[];for(let r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new hr(n,t/2)}},pr={stringify(e){const{words:t,sigBytes:n}=e,r=[];for(let i=0;i<n;i+=1){const e=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(e))}return r.join("")},parse(e){const t=e.length,n=[];for(let r=0;r<t;r+=1)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new hr(n,t)}},mr={stringify(e){try{return decodeURIComponent(escape(pr.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:e=>pr.parse(unescape(encodeURIComponent(e)))};class yr extends dr{constructor(){super(),this._minBufferSize=0}reset(){this._data=new hr,this._nDataBytes=0}_append(e){let t=e;"string"==typeof t&&(t=mr.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes}_process(e){let t;const{_data:n,blockSize:r}=this,i=n.words,o=n.sigBytes;let a=o/(4*r);a=e?Math.ceil(a):Math.max((0|a)-this._minBufferSize,0);const s=a*r,u=Math.min(4*s,o);if(s){for(let e=0;e<s;e+=r)this._doProcessBlock(i,e);t=i.splice(0,s),n.sigBytes-=u}return new hr(t,u)}clone(){const e=super.clone.call(this);return e._data=this._data.clone(),e}}class vr extends yr{constructor(e){super(),this.blockSize=16,this.cfg=Object.assign(new dr,e),this.reset()}static _createHelper(e){return(t,n)=>new e(n).finalize(t)}static _createHmacHelper(e){return(t,n)=>new gr(e,n).finalize(t)}reset(){super.reset.call(this),this._doReset()}update(e){return this._append(e),this._process(),this}finalize(e){e&&this._append(e);return this._doFinalize()}}class gr extends dr{constructor(e,t){super();const n=new e;this._hasher=n;let r=t;"string"==typeof r&&(r=mr.parse(r));const i=n.blockSize,o=4*i;r.sigBytes>o&&(r=n.finalize(t)),r.clamp();const a=r.clone();this._oKey=a;const s=r.clone();this._iKey=s;const u=a.words,c=s.words;for(let l=0;l<i;l+=1)u[l]^=1549556828,c[l]^=909522486;a.sigBytes=o,s.sigBytes=o,this.reset()}reset(){const e=this._hasher;e.reset(),e.update(this._iKey)}update(e){return this._hasher.update(e),this}finalize(e){const t=this._hasher,n=t.finalize(e);t.reset();return t.finalize(this._oKey.clone().concat(n))}}const br={stringify(e){const{words:t,sigBytes:n}=e,r=this._map;e.clamp();const i=[];for(let a=0;a<n;a+=3){const e=(t[a>>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255;for(let t=0;t<4&&a+.75*t<n;t+=1)i.push(r.charAt(e>>>6*(3-t)&63))}const o=r.charAt(64);if(o)for(;i.length%4;)i.push(o);return i.join("")},parse(e){let t=e.length;const n=this._map;let r=this._reverseMap;if(!r){this._reverseMap=[],r=this._reverseMap;for(let e=0;e<n.length;e+=1)r[n.charCodeAt(e)]=e}const i=n.charAt(64);if(i){const n=e.indexOf(i);-1!==n&&(t=n)}return((e,t,n)=>{const r=[];let i=0;for(let o=0;o<t;o+=1)if(o%4){const t=n[e.charCodeAt(o-1)]<<o%4*2|n[e.charCodeAt(o)]>>>6-o%4*2;r[i>>>2]|=t<<24-i%4*8,i+=1}return hr.create(r,i)})(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},Ar=[];for(let Tye=0;Tye<64;Tye+=1)Ar[Tye]=4294967296*Math.abs(Math.sin(Tye+1))|0;const _r=(e,t,n,r,i,o,a)=>{const s=e+(t&n|~t&r)+i+a;return(s<<o|s>>>32-o)+t},wr=(e,t,n,r,i,o,a)=>{const s=e+(t&r|n&~r)+i+a;return(s<<o|s>>>32-o)+t},Sr=(e,t,n,r,i,o,a)=>{const s=e+(t^n^r)+i+a;return(s<<o|s>>>32-o)+t},kr=(e,t,n,r,i,o,a)=>{const s=e+(n^(t|~r))+i+a;return(s<<o|s>>>32-o)+t};class Tr extends vr{_doReset(){this._hash=new hr([1732584193,4023233417,2562383102,271733878])}_doProcessBlock(e,t){const n=e;for(let k=0;k<16;k+=1){const r=t+k,i=e[r];n[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}const r=this._hash.words,i=n[t+0],o=n[t+1],a=n[t+2],s=n[t+3],u=n[t+4],c=n[t+5],l=n[t+6],d=n[t+7],h=n[t+8],f=n[t+9],p=n[t+10],m=n[t+11],y=n[t+12],v=n[t+13],g=n[t+14],b=n[t+15];let A=r[0],_=r[1],w=r[2],S=r[3];A=_r(A,_,w,S,i,7,Ar[0]),S=_r(S,A,_,w,o,12,Ar[1]),w=_r(w,S,A,_,a,17,Ar[2]),_=_r(_,w,S,A,s,22,Ar[3]),A=_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(w,S,A,_,b,16,Ar[46]),_=Sr(_,w,S,A,a,23,Ar[47]),A=kr(A,_,w,S,i,6,Ar[48]),S=kr(S,A,_,w,d,10,Ar[49]),w=kr(w,S,A,_,g,15,Ar[50]),_=kr(_,w,S,A,c,21,Ar[51]),A=kr(A,_,w,S,y,6,Ar[52]),S=kr(S,A,_,w,s,10,Ar[53]),w=kr(w,S,A,_,p,15,Ar[54]),_=kr(_,w,S,A,o,21,Ar[55]),A=kr(A,_,w,S,h,6,Ar[56]),S=kr(S,A,_,w,b,10,Ar[57]),w=kr(w,S,A,_,l,15,Ar[58]),_=kr(_,w,S,A,v,21,Ar[59]),A=kr(A,_,w,S,u,6,Ar[60]),S=kr(S,A,_,w,m,10,Ar[61]),w=kr(w,S,A,_,a,15,Ar[62]),_=kr(_,w,S,A,f,21,Ar[63]),r[0]=r[0]+A|0,r[1]=r[1]+_|0,r[2]=r[2]+w|0,r[3]=r[3]+S|0}_doFinalize(){const e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;t[r>>>5]|=128<<24-r%32;const i=Math.floor(n/4294967296),o=n;t[15+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t[14+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),e.sigBytes=4*(t.length+1),this._process();const a=this._hash,s=a.words;for(let u=0;u<4;u+=1){const e=s[u];s[u]=16711935&(e<<8|e>>>24)|4278255360&(e<<24|e>>>8)}return a}clone(){const e=super.clone.call(this);return e._hash=this._hash.clone(),e}}class xr extends dr{constructor(e){super(),this.cfg=Object.assign(new dr,{keySize:4,hasher:Tr,iterations:1},e)}compute(e,t){let n;const{cfg:r}=this,i=r.hasher.create(),o=hr.create(),a=o.words,{keySize:s,iterations:u}=r;for(;a.length<s;){n&&i.update(n),n=i.update(e).finalize(t),i.reset();for(let e=1;e<u;e+=1)n=i.finalize(n),i.reset();o.concat(n)}return o.sigBytes=4*s,o}}class Er extends yr{constructor(e,t,n){super(),this.cfg=Object.assign(new dr,n),this._xformMode=e,this._key=t,this.reset()}static createEncryptor(e,t){return this.create(this._ENC_XFORM_MODE,e,t)}static createDecryptor(e,t){return this.create(this._DEC_XFORM_MODE,e,t)}static _createHelper(e){const t=e=>"string"==typeof e?Vr:Dr;return{encrypt:(n,r,i)=>t(r).encrypt(e,n,r,i),decrypt:(n,r,i)=>t(r).decrypt(e,n,r,i)}}reset(){super.reset.call(this),this._doReset()}process(e){return this._append(e),this._process()}finalize(e){e&&this._append(e);return this._doFinalize()}}Er._ENC_XFORM_MODE=1,Er._DEC_XFORM_MODE=2,Er.keySize=4,Er.ivSize=4;class Lr extends dr{constructor(e,t){super(),this._cipher=e,this._iv=t}static createEncryptor(e,t){return this.Encryptor.create(e,t)}static createDecryptor(e,t){return this.Decryptor.create(e,t)}}function Ir(e,t,n){const r=e;let i;const o=this._iv;o?(i=o,this._iv=void 0):i=this._prevBlock;for(let a=0;a<n;a+=1)r[t+a]^=i[a]}class Rr extends Lr{}Rr.Encryptor=class extends Rr{processBlock(e,t){const n=this._cipher,{blockSize:r}=n;Ir.call(this,e,t,r),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+r)}},Rr.Decryptor=class extends Rr{processBlock(e,t){const n=this._cipher,{blockSize:r}=n,i=e.slice(t,t+r);n.decryptBlock(e,t),Ir.call(this,e,t,r),this._prevBlock=i}};const Zr={pad(e,t){const n=4*t,r=n-e.sigBytes%n,i=r<<24|r<<16|r<<8|r,o=[];for(let s=0;s<r;s+=4)o.push(i);const a=hr.create(o,r);e.concat(a)},unpad(e){const t=e,n=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=n}};class Cr extends Er{constructor(e,t,n){super(e,t,Object.assign({mode:Rr,padding:Zr},n)),this.blockSize=4}reset(){let e;super.reset.call(this);const{cfg:t}=this,{iv:n,mode:r}=t;this._xformMode===this.constructor._ENC_XFORM_MODE?e=r.createEncryptor:(e=r.createDecryptor,this._minBufferSize=1),this._mode=e.call(r,this,n&&n.words),this._mode.__creator=e}_doProcessBlock(e,t){this._mode.processBlock(e,t)}_doFinalize(){let e;const{padding:t}=this.cfg;return this._xformMode===this.constructor._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e}}class Pr extends dr{constructor(e){super(),this.mixIn(e)}toString(e){return(e||this.formatter).stringify(this)}}const Gr={stringify(e){let t;const{ciphertext:n,salt:r}=e;return t=r?hr.create([1398893684,1701076831]).concat(r).concat(n):n,t.toString(br)},parse(e){let t;const n=br.parse(e),r=n.words;return 1398893684===r[0]&&1701076831===r[1]&&(t=hr.create(r.slice(2,4)),r.splice(0,4),n.sigBytes-=16),Pr.create({ciphertext:n,salt:t})}};class Dr extends dr{static encrypt(e,t,n,r){const i=Object.assign(new dr,this.cfg,r),o=e.createEncryptor(n,i),a=o.finalize(t),s=o.cfg;return Pr.create({ciphertext:a,key:n,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:o.blockSize,formatter:i.format})}static decrypt(e,t,n,r){let i=t;const o=Object.assign(new dr,this.cfg,r);i=this._parse(i,o.format);return e.createDecryptor(n,o).finalize(i.ciphertext)}static _parse(e,t){return"string"==typeof e?t.parse(e,this):e}}Dr.cfg=Object.assign(new dr,{format:Gr});const Mr={execute(e,t,n,r){let i=r;i||(i=hr.random(8));const o=xr.create({keySize:t+n}).compute(e,i),a=hr.create(o.words.slice(t),4*n);return o.sigBytes=4*t,Pr.create({key:o,iv:a,salt:i})}};class Vr extends Dr{static encrypt(e,t,n,r){const i=Object.assign(new dr,this.cfg,r),o=i.kdf.execute(n,e.keySize,e.ivSize);i.iv=o.iv;const a=Dr.encrypt.call(this,e,t,o.key,i);return a.mixIn(o),a}static decrypt(e,t,n,r){let i=t;const o=Object.assign(new dr,this.cfg,r);i=this._parse(i,o.format);const a=o.kdf.execute(n,e.keySize,e.ivSize,i.salt);o.iv=a.iv;return Dr.decrypt.call(this,e,i,a.key,o)}}Vr.cfg=Object.assign(Dr.cfg,{kdf:Mr});const Xr=[],Wr=[],Or=[],Nr=[],Ur=[],Fr=[],Yr=[],Kr=[],jr=[],Hr=[],Br=[];for(let Tye=0;Tye<256;Tye+=1)Br[Tye]=Tye<128?Tye<<1:Tye<<1^283;let Jr=0,zr=0;for(let Tye=0;Tye<256;Tye+=1){let e=zr^zr<<1^zr<<2^zr<<3^zr<<4;e=e>>>8^255&e^99,Xr[Jr]=e,Wr[e]=Jr;const t=Br[Jr],n=Br[t],r=Br[n];let i=257*Br[e]^16843008*e;Or[Jr]=i<<24|i>>>8,Nr[Jr]=i<<16|i>>>16,Ur[Jr]=i<<8|i>>>24,Fr[Jr]=i,i=16843009*r^65537*n^257*t^16843008*Jr,Yr[e]=i<<24|i>>>8,Kr[e]=i<<16|i>>>16,jr[e]=i<<8|i>>>24,Hr[e]=i,Jr?(Jr=t^Br[Br[Br[r^t]]],zr^=Br[Br[zr]]):(zr=1,Jr=zr)}const Qr=[0,1,2,4,8,16,32,64,128,27,54];class qr extends Cr{_doReset(){let e;if(this._nRounds&&this._keyPriorReset===this._key)return;this._keyPriorReset=this._key;const t=this._keyPriorReset,n=t.words,r=t.sigBytes/4;this._nRounds=r+6;const i=4*(this._nRounds+1);this._keySchedule=[];const o=this._keySchedule;for(let s=0;s<i;s+=1)s<r?o[s]=n[s]:(e=o[s-1],s%r?r>6&&s%r==4&&(e=Xr[e>>>24]<<24|Xr[e>>>16&255]<<16|Xr[e>>>8&255]<<8|Xr[255&e]):(e=e<<8|e>>>24,e=Xr[e>>>24]<<24|Xr[e>>>16&255]<<16|Xr[e>>>8&255]<<8|Xr[255&e],e^=Qr[s/r|0]<<24),o[s]=o[s-r]^e);this._invKeySchedule=[];const a=this._invKeySchedule;for(let s=0;s<i;s+=1){const t=i-s;e=s%4?o[t]:o[t-4],a[s]=s<4||t<=4?e:Yr[Xr[e>>>24]]^Kr[Xr[e>>>16&255]]^jr[Xr[e>>>8&255]]^Hr[Xr[255&e]]}}encryptBlock(e,t){this._doCryptBlock(e,t,this._keySchedule,Or,Nr,Ur,Fr,Xr)}decryptBlock(e,t){const n=e;let r=n[t+1];n[t+1]=n[t+3],n[t+3]=r,this._doCryptBlock(n,t,this._invKeySchedule,Yr,Kr,jr,Hr,Wr),r=n[t+1],n[t+1]=n[t+3],n[t+3]=r}_doCryptBlock(e,t,n,r,i,o,a,s){const u=e,c=this._nRounds;let l=u[t]^n[0],d=u[t+1]^n[1],h=u[t+2]^n[2],f=u[t+3]^n[3],p=4;for(let b=1;b<c;b+=1){const e=r[l>>>24]^i[d>>>16&255]^o[h>>>8&255]^a[255&f]^n[p];p+=1;const t=r[d>>>24]^i[h>>>16&255]^o[f>>>8&255]^a[255&l]^n[p];p+=1;const s=r[h>>>24]^i[f>>>16&255]^o[l>>>8&255]^a[255&d]^n[p];p+=1;const u=r[f>>>24]^i[l>>>16&255]^o[d>>>8&255]^a[255&h]^n[p];p+=1,l=e,d=t,h=s,f=u}const m=(s[l>>>24]<<24|s[d>>>16&255]<<16|s[h>>>8&255]<<8|s[255&f])^n[p];p+=1;const y=(s[d>>>24]<<24|s[h>>>16&255]<<16|s[f>>>8&255]<<8|s[255&l])^n[p];p+=1;const v=(s[h>>>24]<<24|s[f>>>16&255]<<16|s[l>>>8&255]<<8|s[255&d])^n[p];p+=1;const g=(s[f>>>24]<<24|s[l>>>16&255]<<16|s[d>>>8&255]<<8|s[255&h])^n[p];p+=1,u[t]=m,u[t+1]=y,u[t+2]=v,u[t+3]=g}}qr.keySize=8;const $r=Cr._createHelper(qr);class ei extends Lr{}ei.Encryptor=class extends ei{processBlock(e,t){const n=e,r=this._cipher,{blockSize:i}=r,o=this._iv;let a=this._counter;o&&(this._counter=o.slice(0),a=this._counter,this._iv=void 0);const s=a.slice(0);r.encryptBlock(s,0),a[i-1]=a[i-1]+1|0;for(let u=0;u<i;u+=1)n[t+u]^=s[u]}},ei.Decryptor=ei.Encryptor;const ti={pad(){},unpad(){}};var ni=new He("BufferService"),ri=function(){function e(t,n,r){l(this,e),f(this,"flv",null),f(this,"_demuxer",new or),f(this,"_remuxer",null),f(this,"_mse",null),f(this,"_softVideo",null),f(this,"_sourceCreated",!1),f(this,"_needInitSegment",!0),f(this,"_discontinuity",!0),f(this,"_contiguous",!1),f(this,"_initSegmentId",""),f(this,"_cachedBuffer",null),f(this,"_demuxStartTime",0),f(this,"_opts",null),this.flv=t,this._opts=r,n?this._softVideo=n:(this._remuxer=new lr(this._demuxer.videoTrack,this._demuxer.audioTrack),this._mse=new tt,this._mse.bindMedia(t.media))}var t,n,r,i,s,u;return h(e,[{key:"baseDts",get:function(){var e,t;return null===(e=this._demuxer)||void 0===e||null===(t=e._fixer)||void 0===t?void 0:t._baseDts}},{key:"isFull",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:tt.VIDEO;return this._mse.isFull(e)}},{key:"seamlessSwitch",value:function(){this._needInitSegment=!0,this._discontinuity=!0,this._contiguous=!0,this._initSegmentId=""}},{key:"unContiguous",value:function(e){this._contiguous=!1,this._demuxStartTime=e}},{key:"reset",value:(u=c(a().mark((function e(){var t,n=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]&&n[0],!this._mse||t){e.next=6;break}return e.next=4,this._mse.unbindMedia();case 4:return e.next=6,this._mse.bindMedia(this.flv.media);case 6:this._needInitSegment=!0,this._discontinuity=!0,this._contiguous=!1,this._sourceCreated=!1,this._initSegmentId="";case 11:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"endOfStream",value:(s=c(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=7;break}if(!this._sourceCreated){e.next=5;break}return e.next=4,this._mse.endOfStream();case 4:this.flv.emit(kt);case 5:e.next=8;break;case 7:this._softVideo&&this._softVideo.endOfStream();case 8:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"updateDuration",value:(i=c(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=7;break}if(this._mse.isOpened){e.next=4;break}return e.next=4,this._mse.open();case 4:return ni.debug("update duration",t),e.next=7,this._mse.updateDuration(t);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"destroy",value:(r=c(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=3;break}return e.next=3,this._mse.unbindMedia();case 3:this._mse=null,this._softVideo=null,this._demuxer=null,this._remuxer=null;case 7:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"appendBuffer",value:(n=c(a().mark((function e(t){var n,r,i,o,s,u,c,l,d,h,f,p,m,y;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._cachedBuffer&&(t=Ht(this._cachedBuffer,t),this._cachedBuffer=null),n=this._demuxer,t&&t.length&&n){e.next=4;break}return e.abrupt("return");case 4:e.prev=4,n.demuxAndFix(t,this._discontinuity,this._contiguous,this._demuxStartTime),e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(4),new Fe(De,Ne.FLV,e.t0);case 11:if(r=n.videoTrack,i=n.audioTrack,o=n.metadataTrack,s=r.exist(),u=i.exist(),this._opts.onlyAudio&&(s=!1,r.present=!1),this._opts.onlyVideo&&(u=!1,i.present=!1),!(!s&&r.present||!u&&i.present)){e.next=29;break}if(c=0,(l=s?r:u?i:void 0)&&l.samples.length&&(c=(l.samples[l.samples.length-1].originPts-l.samples[0].originPts)/l.timescale*1e3),!(c>this._opts.analyzeDuration)){e.next=27;break}ni.warn("analyze duration exceeded, ".concat(c,"ms"),l),r.present=s,i.present=u,this.flv.emit(wt,{duration:c}),e.next=29;break;case 27:return this._cachedBuffer=t,e.abrupt("return");case 29:if(d=r.type,h=i.type,this._fireEvents(r,i,o),this._discontinuity=!1,this._contiguous=!0,this._demuxStartTime=0,f=this._mse,this.flv.emit(Pt,{videoTrack:r}),(p="".concat(r.codec,"/").concat(r.width,"/").concat(r.height,"/").concat(i.codec,"/").concat(i.config))!==this._initSegmentId&&(this._needInitSegment=!0,this._initSegmentId=p,this._emitMetaParsedEvent(r,i)),!f){e.next=65;break}if(this._sourceCreated){e.next=47;break}return e.next=43,f.open();case 43:s&&(ni.log("codec: video/mp4;codecs=".concat(r.codec)),f.createSource(d,"video/mp4;codecs=".concat(r.codec))),u&&(ni.log("codec: audio/mp4;codecs=".concat(i.codec)),f.createSource(h,"audio/mp4;codecs=".concat(i.codec))),this._sourceCreated=!0,this.flv.emit(_t);case 47:e.prev=47,m=this._remuxer.remux(this._needInitSegment),e.next=54;break;case 51:throw e.prev=51,e.t1=e.catch(47),new Fe(Me,Ne.FMP4,e.t1);case 54:if(!this._needInitSegment||m.videoInitSegment||m.audioInitSegment){e.next=56;break}return e.abrupt("return");case 56:return this._needInitSegment=!1,y=[],m.videoInitSegment&&y.push(f.append(d,m.videoInitSegment)),m.audioInitSegment&&y.push(f.append(h,m.audioInitSegment)),m.videoSegment&&y.push(f.append(d,m.videoSegment)),m.audioSegment&&y.push(f.append(h,m.audioSegment)),e.abrupt("return",Promise.all(y));case 65:this._softVideo&&this._softVideo.appendBuffer(r,i);case 66:case"end":return e.stop()}}),e,this,[[4,8],[47,51]])}))),function(e){return n.apply(this,arguments)})},{key:"evictBuffer",value:(t=c(a().mark((function e(t){var n,r,i,o=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.flv.media,this._mse&&this._demuxer&&n&&t&&!(t<0)){e.next=3;break}return e.abrupt("return");case 3:if(r=n.currentTime,!((i=r-t)<=0)){e.next=7;break}return e.abrupt("return");case 7:if(!(Ie.start(Ie.get(n))+1>=i)){e.next=10;break}return e.abrupt("return");case 10:return e.abrupt("return",this._mse.clearBuffer(0,i).then((function(){return o.flv.emit(St,{removeEnd:i})})));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_emitMetaParsedEvent",value:function(e,t){e.exist()&&this.flv.emit(xt,{type:"video",track:e,meta:{codec:e.codec,timescale:e.timescale,width:e.width,height:e.height,sarRatio:e.sarRatio,baseDts:e.baseDts}}),t.exist()&&this.flv.emit(xt,{type:"audio",track:t,meta:{codec:t.codec,channelCount:t.channelCount,sampleRate:t.sampleRate,timescale:t.timescale,baseDts:t.baseDts}}),ni.debug("track parsed",e,t)}},{key:"_fireEvents",value:function(e,t,n){var r=this;ni.debug(e.samples,t.samples),n.flvScriptSamples.forEach((function(e){r.flv.emit(It,e),ni.debug("flvScriptData",e)})),e.samples.forEach((function(e){e.keyframe&&r.flv.emit(Tt,{pts:e.pts})})),e.warnings.forEach((function(e){var t;switch(e.type){case kn:t=Dt;break;case Tn:t=Mt;break;case xn:t=Ot}t&&r.flv.emit(Gt,o(o({},e),{},{type:t})),ni.warn("video exception",e)})),t.warnings.forEach((function(e){var t;switch(e.type){case En:t=Vt;break;case Ln:t=Xt;break;case In:t=Wt}t&&r.flv.emit(Gt,o(o({},e),{},{type:t})),ni.warn("audio exception",e)})),n.seiSamples.forEach((function(e){r.flv.emit(Et,o(o({},e),{},{sei:{code:e.data.type,content:e.data.payload,dts:e.pts}}))}))}}]),e}();function ii(e,t){var n=0,r=e.length-1,i=0,o=0,a=r;for(t<e[0]&&(n=0,o=a+1);o<=a;){if((i=o+Math.floor((a-o)/2))===r||t>=e[i]&&t<e[i+1]){n=i;break}e[i]<t?o=i+1:a=i-1}return n}var oi=new He("flv"),ai=.1,si=function(e){p(y,e);var t,n,r,i,s,u,d,m=g(y);function y(e){var t,n;return l(this,y),f(v(t=m.call(this)),"media",null),f(v(t),"_loading",!1),f(v(t),"_opts",null),f(v(t),"_bufferService",null),f(v(t),"_gapService",null),f(v(t),"_stats",null),f(v(t),"_mediaLoader",null),f(v(t),"_maxChunkWaitTimer",null),f(v(t),"_tickTimer",null),f(v(t),"_tickInterval",500),f(v(t),"_urlSwitching",!1),f(v(t),"_seamlessSwitching",!1),f(v(t),"_disconnectRetryCount",0),f(v(t),"_preLoadEndPoint",0),f(v(t),"_keyframes",null),f(v(t),"_acceptRanges",!0),f(v(t),"_onProgress",function(){var e=c(a().mark((function e(n,r,i,o){var s,u,c,l,d,h,f,p,m;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=i.startTime,u=i.endTime,c=i.st,l=i.firstByteTime,t._loading=!r,t._firstProgressEmit){e.next=11;break}if(t.media){e.next=6;break}return null===(d=t._mediaLoader)||void 0===d||d.cancel(),e.abrupt("return");case 6:h=o.headers,t.emit(yt,{url:t._opts.url,responseUrl:o.url,elapsed:c?l-c:u-s}),t.emit(gt,{headers:h}),t._acceptRanges=!(null==h||!h.get("Accept-Ranges"))||!(null==h||!h.get("Content-Range")),t._firstProgressEmit=!0;case 11:if(t._bufferService){e.next=13;break}return e.abrupt("return");case 13:return clearTimeout(t._maxChunkWaitTimer),t._bandwidthService.addChunkRecord(null==n?void 0:n.byteLength,u-s),e.prev=15,e.next=18,t._bufferService.appendBuffer(n);case 18:null===(f=t._bufferService)||void 0===f||f.evictBuffer(t._opts.bufferBehind),e.next=31;break;case 21:if(e.prev=21,e.t0=e.catch(15),t.isLive||!t._bufferService.isFull()){e.next=30;break}return e.next=26,t._mediaLoader.cancel();case 26:return t._loading=!1,p=t.bufferInfo().remaining,t._opts.preloadTime=parseInt(p)/2,e.abrupt("return");case 30:return e.abrupt("return",t._emitError(Fe.create(e.t0)));case 31:if(t._urlSwitching&&(t._urlSwitching=!1,t.emit(Zt,{url:t._opts.url})),t._seamlessSwitching&&(t._seamlessSwitching=!1,t._tick()),!r||t.media.seeking){e.next=38;break}return t.emit(bt),oi.debug("load done"),t.isLive&&t._disconnectRetryCount<=0&&t._end(),e.abrupt("return");case 38:if(t.isLive){e.next=40;break}return e.abrupt("return");case 40:(m=t._opts.maxReaderInterval)&&(clearTimeout(t._maxChunkWaitTimer),t._maxChunkWaitTimer=setTimeout((function(){if(t._disconnectRetryCount)return t._disconnectRetryCount--,void t.load();oi.debug("onMaxChunkWait",m),t._end()}),m));case 42:case"end":return e.stop()}}),e,null,[[15,21]])})));return function(t,n,r,i){return e.apply(this,arguments)}}()),f(v(t),"_onRetryError",(function(e,n){oi.debug("load retry",e,n),t.emit(At,{error:Fe.network(e),retryTime:n})})),f(v(t),"_end",(function(){t._clear(),t._bufferService&&t._bufferService.endOfStream(),oi.debug("end stream")})),f(v(t),"_resetDisconnectCount",(function(){t._disconnectRetryCount=t._opts.disconnectRetryCount})),f(v(t),"_tick",(function(){clearTimeout(t._tickTimer);var e=v(t).media;if(e){t._tickTimer=setTimeout(t._tick,t._tickInterval);var n=Ie.end(Ie.get(e));if(!(n<ai)&&e.readyState){var r=t._opts;if(function(e){return e&&!e.paused&&!e.ended&&0!==e.playbackRate&&0!==e.readyState}(e))t._gapService&&t._gapService.do(e,r.maxJumpDistance,t.isLive,3);else{if(!e.currentTime&&t._gapService)return void t._gapService.do(e,r.maxJumpDistance,t.isLive,3);r.isLive&&n>r.disconnectTime&&t.disconnect()}}}})),f(v(t),"_onPlay",(function(){var e,n,r=t._opts.softDecode||(null===(e=t.media)||void 0===e||null===(n=e.buffered)||void 0===n?void 0:n.length);if(t.isLive)!t._loading&&r&&t.replay(void 0,!0);else{var i=t.bufferInfo();(i.start||i.nextStart)>ai&&t._tick()}})),f(v(t),"_onSeeking",c(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:!t.isLive&&t.seekable&&(t._preLoadEndPoint=-1,t._checkPreload());case 1:case"end":return e.stop()}}),e)})))),f(v(t),"_onTimeupdate",(function(){if(t.media){var e=t._opts,n=t.media.currentTime;if(e.isLive&&e.maxLatency&&e.targetLatency){var r=Ie.end(Ie.get(t.media));r-n>=e.maxLatency&&(t.media.currentTime=r-e.targetLatency)}t._seiService.throw(n,!0),e.isLive||!t.seekable||t._loading||t._checkPreload()}})),f(v(t),"_onWaiting",(function(){t.isLive&&!t._loading&&t._disconnectRetryCount&&(t._disconnectRetryCount--,t.load())})),f(v(t),"_onBufferUpdate",(function(){if(!t._opts.isLive){var e=t.bufferInfo(),n=e.end,r=e.nextEnd;Math.abs((n||r)-t.media.duration)<1&&(t._end(),t.media.readyState<=2&&t._tick())}})),f(v(t),"_checkPreload",c(a().mark((function e(){var n,r,i,o,s,u,c,l,d,h;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.bufferInfo(),r=n.remaining,i=void 0===r?0:r,o=t._opts,s=t._keyframes.filepositions,u=t._keyframes.times,c=t.media.currentTime,!(i<o.preloadTime)){e.next=19;break}if(l=ii(t._keyframes.times,c+i+ai),(d=ii(t._keyframes.times,c+i+t._opts.preloadTime))===l&&(d=l+1),t._preLoadEndPoint!==d){e.next=11;break}return e.abrupt("return");case 11:if(null!=(h=s[l])){e.next=14;break}return e.abrupt("return");case 14:return e.next=16,t._mediaLoader.cancel();case 16:t._loadData(null,[h,s[d]]),t._preLoadEndPoint=d,t._bufferService.unContiguous(u[l]);case 19:case"end":return e.stop()}}),e)})))),f(v(t),"_onFlvScriptData",(function(e){var n,r,i,o,a=null===(n=e.data)||void 0===n||null===(r=n.onMetaData)||void 0===r?void 0:r.keyframes,s=null===(i=e.data)||void 0===i||null===(o=i.onMetaData)||void 0===o?void 0:o.duration;a&&(t._keyframes=a),!t._opts.isLive&&s&&t._bufferService.updateDuration(s)})),t._opts=((n=o({retryCount:3,retryDelay:1e3,disconnectRetryCount:0,loadTimeout:1e4,maxReaderInterval:5e3,preloadTime:5,defaultVodLoadSize:1e7,isLive:!1,softDecode:!1,bufferBehind:10,maxJumpDistance:3,analyzeDuration:2e4,seamlesslyReload:!1,keepStatusAfterSwitch:!0,onlyVideo:!1,onlyAudio:!1},e)).isLive&&n.preloadTime&&(n.maxLatency||(n.maxLatency=2*n.preloadTime),n.targetLatency||(n.targetLatency=n.preloadTime),null!==n.disconnectTime&&void 0!==n.disconnectTime||(n.disconnectTime=n.maxLatency)),n),t.media=t._opts.media||document.createElement("video"),t._opts.media=null,t._firstProgressEmit=!1,t._mediaLoader=new Jt(o(o({},t._opts.fetchOptions),{},{retry:t._opts.retryCount,retryDelay:t._opts.retryDelay,timeout:t._opts.loadTimeout,onRetryError:t._onRetryError,onProgress:t._onProgress,responseType:"arraybuffer"})),t._disconnectRetryCount=t._opts.disconnectRetryCount,t._bufferService=new ri(v(t),t._opts.softDecode?t.media:void 0,t._opts),t._seiService=new Qt(v(t)),t._bandwidthService=new qt,t._stats=new en(v(t)),t._opts.softDecode||(t._gapService=new zt),t.media.addEventListener("play",t._onPlay),t.media.addEventListener("seeking",t._onSeeking),t.media.addEventListener("timeupdate",t._onTimeupdate),t.media.addEventListener("progress",t._onBufferUpdate),t.media.addEventListener("waiting",t._onWaiting),t.on(It,t._onFlvScriptData),t}return h(y,[{key:"version",get:function(){return"3.0.12"}},{key:"isLive",get:function(){return this._opts.isLive}},{key:"baseDts",get:function(){var e;return null===(e=this._bufferService)||void 0===e?void 0:e.baseDts}},{key:"seekable",get:function(){return!!this._keyframes&&this._acceptRanges}},{key:"loader",get:function(){return this._mediaLoader}},{key:"speedInfo",value:function(){return{speed:this._bandwidthService.getLatestSpeed(),avgSpeed:this._bandwidthService.getAvgSpeed()}}},{key:"getStats",value:function(){return this._stats.getStats()}},{key:"bufferInfo",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ai;return Ie.info(Ie.get(this.media),null===(e=this.media)||void 0===e?void 0:e.currentTime,t)}},{key:"playbackQuality",value:function(){return function(e){if(!e)return{};if("function"==typeof e.getVideoPlaybackQuality){var t=e.getVideoPlaybackQuality();return{droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}return{droppedVideoFrames:e.webkitDroppedFrameCount,totalVideoFrames:e.webkitDecodedFrameCount,creationTime:performance.now()}}(this.media)}},{key:"load",value:(d=c(a().mark((function e(t){var n,r=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.length>1&&void 0!==r[1]&&r[1],this._bufferService){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this._reset(n);case 5:this._loadData(t,this._opts.isLive?[]:[0,this._opts.defaultVodLoadSize]),clearTimeout(this._tickTimer),this._tickTimer=setTimeout(this._tick,this._tickInterval);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"replay",value:(u=c(a().mark((function e(){var t,n,r=this,i=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:this._opts.seamlesslyReload,n=i.length>1?i[1]:void 0,this.media){e.next=4;break}return e.abrupt("return");case 4:if(this._resetDisconnectCount(),!t){e.next=11;break}return e.next=8,this._clear();case 8:setTimeout((function(){r._loadData(r._opts.url),r._bufferService.seamlessSwitch(),r._seamlessSwitching=!0})),e.next=13;break;case 11:return e.next=13,this.load();case 13:return e.abrupt("return",this.media.play(!n).catch((function(){})));case 14:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"disconnect",value:function(){return oi.debug("disconnect!"),this._clear()}},{key:"switchURL",value:(s=c(a().mark((function e(t,n){var r=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._bufferService){e.next=2;break}return e.abrupt("return");case 2:if(this._resetDisconnectCount(),n&&this._opts.isLive){e.next=8;break}return e.next=6,this.load(t);case 6:return this._urlSwitching=!0,e.abrupt("return",this.media.play(!0).catch((function(){})));case 8:return e.next=10,this._clear();case 10:setTimeout((function(){r._loadData(t),r._bufferService.seamlessSwitch(),r._urlSwitching=!0,r._seamlessSwitching=!0}));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"destroy",value:(i=c(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.media){e.next=2;break}return e.abrupt("return");case 2:return this.removeAllListeners(),this._seiService.reset(),this.media.removeEventListener("play",this._onPlay),this.media.removeEventListener("seeking",this._onSeeking),this.media.removeEventListener("timeupdate",this._onTimeupdate),this.media.removeEventListener("waiting",this._onWaiting),this.media.removeEventListener("progress",this._onBufferUpdate),e.next=11,Promise.all([this._clear(),this._bufferService.destroy()]);case 11:this.media=null,this._bufferService=null;case 13:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"_emitError",value:function(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];oi.table(e),oi.error(e),oi.error(null===(t=this.media)||void 0===t?void 0:t.error),this._urlSwitching&&(this._urlSwitching=!1,this._seamlessSwitching=!1,this.emit(Ct,e)),this.emit(mt,e),n&&(this._seiService.reset(),this._end())}},{key:"_reset",value:(r=c(a().mark((function e(){var t,n=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]&&n[0],this._seiService.reset(),this._bandwidthService.reset(),this._stats.reset(),e.next=6,this._clear();case 6:return e.next=8,this._bufferService.reset(t);case 8:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_loadData",value:(n=c(a().mark((function e(t,n){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&(this._opts.url=t),r=t=this._opts.url,t){e.next=4;break}throw new Error("Source url is missing");case 4:if(this._opts.preProcessUrl&&(r=this._opts.preProcessUrl(t).url),this._mediaLoader.finnalUrl=r,this.emit(vt,{url:r}),oi.debug("load data, loading:",this._loading,r),!this._loading){e.next=11;break}return e.next=11,this._mediaLoader.cancel();case 11:return this._loading=!0,e.prev=12,e.next=15,this._mediaLoader.load({url:r,range:n});case 15:e.next=21;break;case 17:return e.prev=17,e.t0=e.catch(12),this._loading=!1,e.abrupt("return",this._emitError(Fe.network(e.t0)));case 21:case"end":return e.stop()}}),e,this,[[12,17]])}))),function(e,t){return n.apply(this,arguments)})},{key:"_clear",value:(t=c(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mediaLoader){e.next=3;break}return e.next=3,this._mediaLoader.cancel();case 3:clearTimeout(this._maxChunkWaitTimer),clearTimeout(this._tickTimer),this._loading=!1,this._firstProgressEmit=!1;case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}],[{key:"isSupported",value:function(e){return e&&"video"!==e&&"audio"!==e?"undefined"!=typeof WebAssembly:tt.isSupported()}},{key:"enableLogger",value:function(){He.enable(),Xn.enable()}},{key:"disableLogger",value:function(){He.disable(),Xn.disable()}}]),y}(P);try{localStorage.getItem("xgd")?si.enableLogger():si.disableLogger()}catch(Sye){}var ui=function(){function e(t,n){var r=this;l(this,e),f(this,"_onLowDecode",(function(){var e,t,n,i,a=r._opts,s=a.media,u=a.innerDegrade,c=a.backupURL;null===(e=r._plugin)||void 0===e||null===(t=e.player)||void 0===t||t.emit("lowdecode",s.degradeInfo),null===(n=r._plugin)||void 0===n||null===(i=n.player)||void 0===i||i.emit("core_event",o(o({},s.degradeInfo),{},{eventName:Rt})),1!==u&&3!==u||!c||r._degrade(c)})),f(this,"_degrade",(function(e){var t=r._plugin.player,n=t.video;if("MVideo"===(null==n?void 0:n.TAG)){var i=t.video.degradeVideo;t.video=i,n.degrade(e),e&&(t.config.url=e);var o=t.root.firstChild;"MVideo"===o.TAG&&t.root.replaceChild(i,o);var a=r._plugin.constructor.pluginName.toLowerCase();t.unRegisterPlugin(a),t.once("canplay",(function(){t.play()}))}})),f(this,"forceDegradeToVideo",(function(e){var t=r._opts.innerDegrade;1!==t&&3!==t||r._degrade(e)})),this._opts=t,this._plugin=n,this._init()}return h(e,[{key:"_init",value:function(){var e=this._opts,t=e.media,n=e.preloadTime,r=e.innerDegrade,i=e.decodeMode;t&&(r&&t.setAttribute("innerdegrade",r),n&&t.setAttribute("preloadtime",n),t.setDecodeMode&&t.setDecodeMode(i),this._bindEvents())}},{key:"_bindEvents",value:function(){this._opts.media.addEventListener("lowdecode",this._onLowDecode)}},{key:"destroy",value:function(){var e,t;null===(e=this._opts)||void 0===e||null===(t=e.media)||void 0===t||t.removeEventListener("lowdecode",this._onLowDecode),this._plugin=null}}]),e}(),ci=function(e){p(n,e);var t=g(n);function n(){var e;l(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return f(v(e=t.call.apply(t,[this].concat(i))),"flv",null),f(v(e),"pluginExtension",null),f(v(e),"getStats",(function(){var t;return null===(t=e.flv)||void 0===t?void 0:t.getStats()})),f(v(e),"destroy",(function(){var t;e.flv&&(e.flv.destroy(),e.flv=null),null===(t=e.pluginExtension)||void 0===t||t.destroy(),e.pluginExtension=null})),f(v(e),"_onSwitchURL",(function(t,n){var r,i;e.flv&&(e.player.config.url=t,"object"===s(n)&&(n=n.seamless),e.flv.switchURL(t,n),!n&&null!==(r=e.player.config)&&void 0!==r&&null!==(i=r.flv)&&void 0!==i&&i.keepStatusAfterSwitch&&e._keepPauseStatus())})),f(v(e),"_keepPauseStatus",(function(){e.player.paused&&e.player.once("canplay",(function(){e.player.pause()}))})),f(v(e),"_onDefinitionChange",(function(t){var n=t.to;e.flv&&e.flv.switchURL(n)})),e}return h(n,[{key:"core",get:function(){return this.flv}},{key:"version",get:function(){var e;return null===(e=this.flv)||void 0===e?void 0:e.version}},{key:"softDecode",get:function(){var e,t,n=null===(e=this.player)||void 0===e||null===(t=e.config)||void 0===t?void 0:t.mediaType;return!!n&&"video"!==n&&"audio"!==n}},{key:"loader",get:function(){var e;return null===(e=this.flv)||void 0===e?void 0:e.loader}},{key:"beforePlayerInit",value:function(){var e=this,t=this.player.config;if(t.url){this.flv&&this.flv.destroy(),this.player.switchURL=this._onSwitchURL;var n,r=t.flv||{};if(null!==r.disconnectTime&&void 0!==r.disconnectTime||(r.disconnectTime=0),this.flv=new si(o({softDecode:this.softDecode,isLive:t.isLive,media:this.player.video,preProcessUrl:function(t,n){var r,i;return(null===(r=(i=e.player).preProcessUrl)||void 0===r?void 0:r.call(i,t,n))||{url:t,ext:n}}},r)),this.softDecode||ne.defineGetterOrSetter(this.player,{url:{get:function(){var t,n;return null===(t=e.flv)||void 0===t||null===(n=t.media)||void 0===n?void 0:n.src},configurable:!0}}),this.softDecode&&(this.pluginExtension=new ui(o({media:this.player.video},t.flv),this),this.player.forceDegradeToVideo=function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return null===(t=e.pluginExtension)||void 0===t?void 0:t.forceDegradeToVideo.apply(t,r)}),t.isLive)null===(n=this.player)||void 0===n||n.useHooks("replay",(function(){var t;return null===(t=e.flv)||void 0===t?void 0:t.replay()}));this.on(J,this._onSwitchURL),this.on(B,this.destroy),this._transError(),this._transCoreEvent(yt),this._transCoreEvent(vt),this._transCoreEvent(gt),this._transCoreEvent(bt),this._transCoreEvent(At),this._transCoreEvent(_t),this._transCoreEvent(wt),this._transCoreEvent(St),this._transCoreEvent(kt),this._transCoreEvent(Tt),this._transCoreEvent(xt),this._transCoreEvent(Et),this._transCoreEvent(Lt),this._transCoreEvent(It),this._transCoreEvent(Gt),this._transCoreEvent(Zt),this._transCoreEvent(Ct),this.flv.load(t.url,!0)}}},{key:"_transError",value:function(){var e=this;this.flv.on(mt,(function(t){e.player&&e.player.emit(H,new j(e.player,t))}))}},{key:"_transCoreEvent",value:function(e){var t=this;this.flv.on(e,(function(n){t.player&&t.player.emit("core_event",o(o({},n),{},{eventName:e}))}))}}],[{key:"pluginName",get:function(){return"flv"}},{key:"isSupported",value:function(e,t){return si.isSupported(e,t)}}]),n}(ne);function li(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(i=r.key,o=void 0,"symbol"==typeof(o=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(i,"string"))?o:String(o)),r)}var i,o}function di(e){return(di=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function hi(e,t){return(hi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function fi(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 function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function pi(e){var t=function(){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}}();return function(){var n,r=di(e);if(t){var i=di(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return fi(this,n)}}f(ci,"Flv",si);var mi=function(e){!function(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&&hi(e,t)}(o,e);var t,n,r,i=pi(o);function o(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),i.apply(this,arguments)}return t=o,r=[{key:"pluginName",get:function(){return"adaptive"}},{key:"defaultConfig",get:function(){return{hurryEndMs:1800,hurryStartMs:2500,hurrySpeed:1.1}}}],(n=[{key:"afterCreate",value:function(){this.on("timeupdate",this.onTimeUpdate.bind(this))}},{key:"onTimeUpdate",value:function(){var e=this.bufferLength;this.speed===this.config.hurrySpeed?e<=this.config.hurryEndMs&&(this.speed=1):1===this.speed&&e>=this.config.hurryStartMs&&(this.speed=this.config.hurrySpeed)}},{key:"bufferLength",get:function(){var e=this.player.getBufferedRange(),t=this.player.video.currentTime,n=e[1]-Math.max(e[0],t);return n=Math.round(1e3*Math.max(0,n))}},{key:"speed",get:function(){return this.player.playbackRate},set:function(e){this.speed!==e&&(this.player.playbackRate=e)}}])&&li(t.prototype,n),r&&li(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(ne);const yi=t.DynamicModule.PluginFlv;var vi,gi=Object.freeze({__proto__:null,Adaptive:mi,FlvPlugin:ci,__PLUGIN_NAME__:yi});function bi(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 Ai(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bi(Object(n),!0).forEach((function(t){Ei(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _i(){_i=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(L){u=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var o=t&&t.prototype instanceof h?t:h,a=Object.create(o.prototype),s=new T(i||[]);return r(a,"_invoke",{value:_(e,n,s)}),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(L){return{type:"throw",arg:L}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,o)&&(m=v);var g=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,t){function i(r,o,a,s){var u=l(e[r],e,o);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(d).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=w(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=l(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,d;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function S(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function x(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(A.prototype),u(A.prototype,a,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new A(c(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),u(g,s,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=x,T.prototype={constructor:T,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(k),!e)for(var t in this)"t"===t.charAt(0)&&n.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 r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},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),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:x(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function wi(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(Sye){return void n(Sye)}s.done?t(u):Promise.resolve(u).then(r,i)}function Si(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){wi(o,r,i,a,s,"next",e)}function s(e){wi(o,r,i,a,s,"throw",e)}a(void 0)}))}}function ki(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ti(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Pi(r.key),r)}}function xi(e,t,n){return t&&Ti(e.prototype,t),n&&Ti(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ei(e,t,n){return(t=Pi(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Li(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&&Ri(e,t)}function Ii(e){return(Ii=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ri(e,t){return(Ri=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Zi(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ci(e){var t=function(){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}}();return function(){var n,r=Ii(e);if(t){var i=Ii(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(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 Zi(e)}(this,n)}}function Pi(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function Gi(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 Di(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gi(Object(n),!0).forEach((function(t){Fi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Mi(){Mi=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(L){u=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var o=t&&t.prototype instanceof h?t:h,a=Object.create(o.prototype),s=new T(i||[]);return r(a,"_invoke",{value:_(e,n,s)}),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(L){return{type:"throw",arg:L}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,o)&&(m=v);var g=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,t){function i(r,o,a,s){var u=l(e[r],e,o);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(d).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=w(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=l(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,d;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function S(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function x(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(A.prototype),u(A.prototype,a,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new A(c(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),u(g,s,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=x,T.prototype={constructor:T,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(k),!e)for(var t in this)"t"===t.charAt(0)&&n.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 r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},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),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:x(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function Vi(e){return(Vi="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 Xi(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(Sye){return void n(Sye)}s.done?t(u):Promise.resolve(u).then(r,i)}function Wi(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Xi(o,r,i,a,s,"next",e)}function s(e){Xi(o,r,i,a,s,"throw",e)}a(void 0)}))}}function Oi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ni(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,no(r.key),r)}}function Ui(e,t,n){return t&&Ni(e.prototype,t),n&&Ni(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Fi(e,t,n){return(t=no(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yi(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&&ji(e,t)}function Ki(e){return(Ki=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ji(e,t){return(ji=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Hi(){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 Bi(e,t,n){return(Bi=Hi()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&ji(i,n.prototype),i}).apply(null,arguments)}function Ji(e){var t="function"==typeof Map?new Map:void 0;return Ji=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;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,r)}function r(){return Bi(e,arguments,Ki(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ji(r,e)},Ji(e)}function zi(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Qi(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function qi(e){var t=Hi();return function(){var n,r=Ki(e);if(t){var i=Ki(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(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 Qi(e)}(this,n)}}function $i(){return $i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ki(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},$i.apply(this,arguments)}function eo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function to(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return eo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?eo(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}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 o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function no(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;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 ro="network",io="network_timeout",oo="network_forbidden",ao="network_notfound",so="network_range_not_satisfiable",uo="demux",co="remux",lo="media",ho="drm",fo="other",po="runtime",mo=(Fi(vi={},"manifest",{HLS:1100,DASH:1200}),Fi(vi,ro,2100),Fi(vi,io,2101),Fi(vi,oo,2103),Fi(vi,ao,2104),Fi(vi,so,2116),Fi(vi,uo,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),Fi(vi,co,{FMP4:4100,MP4:4200}),Fi(vi,lo,{MEDIA_ERR_ABORTED:5101,MEDIA_ERR_NETWORK:5102,MEDIA_ERR_DECODE:5103,MEDIA_ERR_SRC_NOT_SUPPORTED:5104,MEDIA_ERR_CODEC_NOT_SUPPORTED:5105,MEDIA_ERR_URL_EMPTY:5106,MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203,MSE_HIJACK:5204,EME_HIJACK:5301}),Fi(vi,ho,{LICENSE:7100,CUSTOM_LICENSE:7200}),Fi(vi,fo,8e3),Fi(vi,po,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002,WAITING_TIMEOUT_ERROR:9003}),vi),yo=function(e){Yi(n,e);var t=qi(n);function n(e,r,i,o,a){var s;return Oi(this,n),(s=t.call(this,a||(null==i?void 0:i.message))).errorType=e===io?ro:e,s.originError=i,s.ext=o,s.errorCode=mo[e][r]||mo[e],s.errorMessage=s.message,s.errorCode||(s.errorType=fo,s.errorCode=mo[s.errorType]),s}return Ui(n,null,[{key:"create",value:function(e,t,r,i,o){return e instanceof n?e:(e instanceof Error&&(r=e,e=""),e||(e=fo),new n(e,t,r,i,o))}},{key:"network",value:function(e){var t;return new n(null!=e&&e.isTimeout?io:ro,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}]),n}(Ji(Error)),vo={DEBUG:1,LOG:2,WARN:3,ERROR:4},go=["Boolean","Number","String","Undefined","Null","Date","Object"],bo=function(){function e(t,n){Oi(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=(null==n?void 0:n.disabled)||!0,this.logCacheLevel=(null==n?void 0:n.logCacheLevel)||3,this.logMaxSize=(null==n?void 0:n.logMaxSize)||204800,this.logSize=0,this.logTextArray=[]}return Ui(e,[{key:"debug",value:function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];this.logCache.apply(this,[vo.DEBUG].concat(r)),e.disabled||(t=console).debug.apply(t,[this._prefix,Ao()].concat(r))}},{key:"log",value:function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];this.logCache.apply(this,[vo.LOG].concat(r)),e.disabled||(t=console).log.apply(t,[this._prefix,Ao()].concat(r))}},{key:"warn",value:function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];this.logCache.apply(this,[vo.WARN].concat(r)),e.disabled||(t=console).warn.apply(t,[this._prefix,Ao()].concat(r))}},{key:"error",value:function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];this.logCache.apply(this,[vo.ERROR].concat(r)),e.disabled||(t=console).error.apply(t,[this._prefix,Ao()].concat(r))}},{key:"logCache",value:function(e){if(!(e<this.logCacheLevel)){var t="";try{for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=r.map((function(e){return wo(e)}));t=this._prefix+Ao()+JSON.stringify(o)}catch(s){return}if(e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var a=this.logTextArray.shift();this.logSize-=a.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function Ao(){return(new Date).toLocaleString()}function _o(e){if("object"!==Vi(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function wo(e,t,n){n||(n=1),t||(t=2);var r={};if(!e||"object"!==Vi(e))return e;var i=Object.prototype.toString.call(e).slice(8,-1);if(!go.includes(i))return i;if(!(n>t)){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n===t?r[o]=_o(e[o]):"object"===Vi(e[o])?r[o]=wo(e[o],t,n+1):r[o]=e[o]);return r}}Fi(bo,"disabled",!0);var So="fetch",ko="xhr",To="arraybuffer",xo="text",Eo="json",Lo=function(e){Yi(n,e);var t=qi(n);function n(e,r,i,o){var a;return Oi(this,n),Fi(Qi(a=t.call(this,o)),"retryCount",0),Fi(Qi(a),"isTimeout",!1),Fi(Qi(a),"loaderType",So),Fi(Qi(a),"startTime",0),Fi(Qi(a),"endTime",0),Fi(Qi(a),"options",{}),a.url=e,a.request=r,a.response=i,a}return Ui(n)}(Ji(Error)),Io=Object.prototype.toString;function Ro(e){if("[object Object]"!==Io.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function Zo(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function Co(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Po(e,t){if(e){if(!t)return e;var n,r=Object.keys(t).map((function(e){if(null!=(n=t[e]))return Array.isArray(n)?e+="[]":n=[n],n.map((function(t){var n;return n=t,"[object Date]"===Io.call(n)?t=t.toISOString():function(e){return null!==e&&"object"===Vi(e)}(t)&&(t=JSON.stringify(t)),"".concat(Co(e),"=").concat(Co(t))})).join("&")})).filter(Boolean).join("&");if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e}}function Go(e,t,n,r,i,o,a,s,u,c,l){return i=null!=i?parseFloat(i):null,r=parseInt(r||"0",10),Number.isNaN(r)&&(r=0),{data:e,done:t,options:{range:u,vid:c,index:s,contentLength:r,age:i,startTime:o,firstByteTime:a,endTime:Date.now(),priOptions:l},response:n}}function Do(e,t){return Math.round(8*e*1e3/t/1024)}var Mo="error",Vo="core.ttfb",Xo="core.loadstart",Wo="core.loadresponseheaders",Oo="core.loadcomplete",No="core.loadretry",Uo="core.metadataparsed",Fo="real_time_speed",Yo=2097152,Ko=function(e){Yi(r,e);var t,n=qi(r);function r(){var e;return Oi(this,r),Fi(Qi(e=n.call(this)),"_abortController",null),Fi(Qi(e),"_timeoutTimer",null),Fi(Qi(e),"_reader",null),Fi(Qi(e),"_response",null),Fi(Qi(e),"_aborted",!1),Fi(Qi(e),"_index",-1),Fi(Qi(e),"_range",null),Fi(Qi(e),"_receivedLength",0),Fi(Qi(e),"_running",!1),Fi(Qi(e),"_logger",null),Fi(Qi(e),"_vid",""),Fi(Qi(e),"_onProcessMinLen",0),Fi(Qi(e),"_onCancel",null),Fi(Qi(e),"_priOptions",null),e}return Ui(r,[{key:"load",value:function(e){var t,n=this,r=e.url,i=e.vid,o=e.timeout,a=e.responseType,s=e.onProgress,u=e.index,c=e.onTimeout,l=e.onCancel,d=e.range,h=e.transformResponse,f=e.request,p=e.params,m=e.logger,y=e.method,v=e.headers,g=e.body,b=e.mode,A=e.credentials,_=e.cache,w=e.redirect,S=e.referrer,k=e.referrerPolicy,T=e.onProcessMinLen,x=e.priOptions;this._logger=m,this._aborted=!1,this._onProcessMinLen=T,this._onCancel=l,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=u,this._range=d||[0,0],this._vid=i||r,this._priOptions=x||{};var E={method:y,headers:v,body:g,mode:b,credentials:A,cache:_,redirect:w,referrer:S,referrerPolicy:k,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},L=!1;clearTimeout(this._timeoutTimer),r=Po(r,p);var I=Zo(d);I&&(v=f?f.headers:E.headers=E.headers||(Headers?new Headers:{}),Headers&&v instanceof Headers?v.append("Range",I):v.Range=I),o&&(this._timeoutTimer=setTimeout((function(){if(L=!0,n.cancel(),c){var e=new Lo(r,E,null,"timeout");e.isTimeout=!0,c(e,{index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions})}}),o));var R=Date.now();return this._logger.debug("[fetch load start], index,",u,",range,",d),new Promise((function(e,t){fetch(f||r,f?void 0:E).then(function(){var i=Wi(Mi().mark((function i(o){var c,l,f,p;return Mi().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(n._timeoutTimer),n._response=o,!n._aborted&&n._running){i.next=4;break}return i.abrupt("return");case 4:if(h&&(o=h(o,r)||o),o.ok){i.next=7;break}throw new Lo(r,E,o,"bad network response");case 7:if(c=Date.now(),a!==xo){i.next=15;break}return i.next=11,o.text();case 11:l=i.sent,n._running=!1,i.next=37;break;case 15:if(a!==Eo){i.next=22;break}return i.next=18,o.json();case 18:l=i.sent,n._running=!1,i.next=37;break;case 22:if(!s){i.next=29;break}return n.resolve=e,n.reject=t,n._loadChunk(o,s,R,c),i.abrupt("return");case 29:return i.next=31,o.arrayBuffer();case 31:l=i.sent,l=new Uint8Array(l),n._running=!1,f=Date.now()-R,p=Do(l.byteLength,f),n.emit(Fo,{speed:p,len:l.byteLength,time:f,vid:n._vid,index:n._index,range:n._range,priOptions:n._priOptions});case 37:n._logger.debug("[fetch load end], index,",u,",range,",d),e(Go(l,!0,o,o.headers.get("Content-Length"),o.headers.get("age"),R,c,u,d,n._vid,n._priOptions));case 39:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}()).catch((function(e){var i;clearTimeout(n._timeoutTimer),n._running=!1,n._aborted&&!L||((e=e instanceof Lo?e:new Lo(r,E,null,null===(i=e)||void 0===i?void 0:i.message)).startTime=R,e.endTime=Date.now(),e.isTimeout=L,e.options={index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions},t(e))}))}))}},{key:"cancel",value:(t=Wi(Mi().mark((function e(){return Mi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch(Sye){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,n,r){var i=this;if(!e.body||!e.body.getReader){this._running=!1;var o=new Lo(e.url,"",e,"onProgress of bad response.body.getReader");return o.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(o)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(Yo),this._writeIdx=0);var a,s,u,c=this._reader=e.body.getReader(),l=function(){var o=Wi(Mi().mark((function o(){var d,h,f,p,m,y,v,g;return Mi().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return s=Date.now(),o.prev=1,o.next=4,c.read();case 4:a=o.sent,u=Date.now(),o.next=13;break;case 8:return o.prev=8,o.t0=o.catch(1),u=Date.now(),i._aborted||(i._running=!1,o.t0.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i.reject(o.t0)),o.abrupt("return");case 13:if(h=(null===(d=i._range)||void 0===d?void 0:d.length)>0?i._range[0]:0,f=h+i._receivedLength,!i._aborted){o.next=19;break}return i._running=!1,t(void 0,!1,{range:[f,f],vid:i._vid,index:i._index,startTime:s,endTime:u,st:n,firstByteTime:r,priOptions:i._priOptions},e),o.abrupt("return");case 19:p=a.value?a.value.byteLength:0,i._receivedLength+=p,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",f,", end,",h+i._receivedLength,", done,",a.done),i._onProcessMinLen>0?i._writeIdx+p>=i._onProcessMinLen||a.done?((m=new Uint8Array(i._writeIdx+p)).set(i._cache.slice(0,i._writeIdx),0),p>0&&m.set(a.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",a.done,",len,",m.byteLength,", writeIdx,",i._writeIdx)):p>0&&i._writeIdx+p<Yo?(i._cache.set(a.value,i._writeIdx),i._writeIdx+=p,i._logger.debug("【fetchLoader,onProgress cache】,len,",p,", writeIdx,",i._writeIdx)):p>0&&(y=new Uint8Array(i._writeIdx+p+2048),i._logger.debug("【fetchLoader,onProgress extra start】,size,",i._writeIdx+p+2048,", datalen,",p,", writeIdx,",i._writeIdx),y.set(i._cache.slice(0,i._writeIdx),0),p>0&&y.set(a.value,i._writeIdx),i._writeIdx+=p,delete i._cache,i._cache=y,i._logger.debug("【fetchLoader,onProgress extra end】,len,",p,", writeIdx,",i._writeIdx)):m=a.value,(m&&m.byteLength>0||a.done)&&t(m,a.done,{range:[i._range[0]+i._receivedLength-(m?m.byteLength:0),i._range[0]+i._receivedLength],vid:i._vid,index:i._index,startTime:s,endTime:u,st:n,firstByteTime:r,priOptions:i._priOptions},e),a.done?(v=Date.now()-n,g=Do(i._receivedLength,v),i.emit(Fo,{speed:g,len:i._receivedLength,time:v,vid:i._vid,index:i._index,range:i._range,priOptions:i._priOptions}),i._running=!1,i._logger.debug("[fetchLoader onProgress end],task,",i._range,",done,",a.done),i.resolve(Go(a,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),n,r,i._index,i._range,i._vid,i._priOptions))):l();case 25:case"end":return o.stop()}}),o,null,[[1,8]])})));return function(){return o.apply(this,arguments)}}();l()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}]),r}(P);var jo=function(e){Yi(n,e);var t=qi(n);function n(){var e;return Oi(this,n),Fi(Qi(e=t.call(this)),"_xhr",null),Fi(Qi(e),"_aborted",!1),Fi(Qi(e),"_timeoutTimer",null),Fi(Qi(e),"_range",null),Fi(Qi(e),"_receivedLength",0),Fi(Qi(e),"_url",null),Fi(Qi(e),"_onProgress",null),Fi(Qi(e),"_index",-1),Fi(Qi(e),"_headers",null),Fi(Qi(e),"_currentChunkSizeKB",384),Fi(Qi(e),"_timeout",null),Fi(Qi(e),"_xhr",null),Fi(Qi(e),"_withCredentials",null),Fi(Qi(e),"_startTime",-1),Fi(Qi(e),"_loadCompleteResolve",null),Fi(Qi(e),"_loadCompleteReject",null),Fi(Qi(e),"_runing",!1),Fi(Qi(e),"_logger",!1),Fi(Qi(e),"_vid",""),Fi(Qi(e),"_responseType",void 0),Fi(Qi(e),"_credentials",void 0),Fi(Qi(e),"_method",void 0),Fi(Qi(e),"_transformResponse",void 0),Fi(Qi(e),"_firstRtt",void 0),Fi(Qi(e),"_onCancel",null),Fi(Qi(e),"_priOptions",null),e}return Ui(n,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=Po(e.url,e.params);var n=Date.now();return new Promise((function(e,n){t._loadCompleteResolve=e,t._loadCompleteReject=n,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof Lo?e:new Lo(t._url,t._request)).startTime=n,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e}))}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===To&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,n=this._range[0]+this._receivedLength,r=this._range[1];t<this._range[1]-n&&(r=n+t),e=[n,r],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var n=this._xhr=new XMLHttpRequest;n.open(this._method||"GET",this._url,!0),n.responseType=this._responseType,this._timeout&&(n.timeout=this._timeout),n.withCredentials=this._withCredentials,n.onload=this._onLoad.bind(this),n.onreadystatechange=this._onReadyStatechange.bind(this),n.onerror=function(e){var n,r,i;t._running=!1;var o=new Lo(t._url,t._request,null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.response,"xhr.onerror.status:"+(null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.status)+",statusText,"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.statusText));o.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(o)},n.ontimeout=function(e){t.cancel();var n=new Lo(t._url,t._request,{status:408},"timeout");t._onTimeout&&(n.isTimeout=!0,t._onTimeout(n,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),n.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(n)};var r=this._headers||{},i=Zo(e);i&&(r.Range=i),r&&Object.keys(r).forEach((function(e){n.setRequestHeader(e,r[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),n.send(this._body)}catch(o){o.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(o)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t,n=e.target.status;if(n<200||n>299){var r=new Lo(this._url,null,Di(Di({},e.target.response),{},{status:n}),"bad response,status:"+n);return r.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(r)}var i,o=null,a=!1,s=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===To){var u,c=new Uint8Array(e.target.response);if(i=s+this._receivedLength,c&&c.byteLength>0){this._receivedLength+=c.byteLength;var l=Date.now()-this._startTime,d=Do(this._receivedLength,l);this.emit(Fo,{speed:d,len:this._receivedLength,time:l,vid:this._vid,index:this._index,range:[i,s+this._receivedLength],priOptions:this._priOptions})}o=c,a=!((null===(u=this._range)||void 0===u?void 0:u.length)>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",i,"end ",s+this._receivedLength,",dataLen,",c?c.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",a)}else a=!0,o=e.target.response;var h={ok:n>=200&&n<300,status:n,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(h=this._transformResponse(h,this._url)||h),this._onProgress&&this._onProgress(o,a,{index:this._index,vid:this._vid,range:[i,s+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},h),a?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(Go(this._onProgress?null:o,a,h,h.headers["content-length"],h.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,$i(Ki(n.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,n={},r=to(e.getAllResponseHeaders().trim().split("\r\n"));try{for(r.s();!(t=r.n()).done;){var i=t.value.split(": ");n[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(o){r.e(o)}finally{r.f()}return n}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),n}(P),Ho=["retry","retryDelay","onRetryError","transformError"],Bo=function(){function e(t,n){var r,i,o;Oi(this,e),this.promise=((o=new Promise((function(e,t){r=e,i=t}))).used=!1,o.resolve=function(){return o.used=!0,r.apply(void 0,arguments)},o.reject=function(){return o.used=!0,i.apply(void 0,arguments)},o),this.alive=!!n.onProgress,!n.logger&&(n.logger=new bo("Loader")),this._loaderType=t,this._loader=t===So&&window.fetch?new Ko:new jo,this._config=n,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=n.retryCheckFunc,this._logger=n.logger}var t;return Ui(e,[{key:"exec",value:function(){var e=this,t=this._config,n=t.retry,r=t.retryDelay,i=t.onRetryError,o=t.transformError,a=zi(t,Ho),s=function(){var t=Wi(Mi().mark((function t(){var u,c,l;return Mi().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(a);case 3:u=t.sent,e.promise.resolve(u),t.next=27;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,c=t.t0,o&&(c=o(c)||c),i&&e._retryCount>0&&i(c,e._retryCount,{index:a.index,vid:a.vid,range:a.range,priOptions:a.priOptions}),e._retryCount++,l=!0,e._retryCheckFunc&&(l=e._retryCheckFunc(t.t0)),!(l&&e._retryCount<=n)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",a.range),e._retryTimer=setTimeout(s,r),t.abrupt("return");case 26:e.promise.reject(c);case 27:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return s(),this.promise}},{key:"cancel",value:(t=Wi(Mi().mark((function e(){return Mi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),e}();function Jo(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var zo=function(e){Yi(r,e);var t,n=qi(r);function r(e){var t;return Oi(this,r),Fi(Qi(t=n.call(this,e)),"type",So),Fi(Qi(t),"_queue",[]),Fi(Qi(t),"_alive",[]),Fi(Qi(t),"_currentTask",null),Fi(Qi(t),"_config",void 0),t._config=function(e){return Di({loaderType:So,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:xo,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0},e)}(e),t._config.loaderType!==ko&&Ko.isSupported()||(t.type=ko),t.log=e.logger,t}return Ui(r,[{key:"isFetch",value:function(){return this.type===So}},{key:"load",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?n=e:n.url=e||n.url||this._config.url,(n=Object.assign({},this._config,n)).params&&(n.params=Object.assign({},n.params)),n.headers&&Ro(n.headers)&&(n.headers=Object.assign({},n.headers)),n.body&&Ro(n.body)&&(n.body=Object.assign({},n.body)),n.transformRequest&&(n=n.transformRequest(n)||n),n.logger=this.log;var r=new Bo(this.type,n);return r.loader.on(Fo,(function(e){t.emit(Fo,e)})),this._queue.push(r),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),r.promise}},{key:"cancel",value:(t=Wi(Mi().mark((function e(){var t;return Mi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,Jo();case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,n;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(n=e._alive)||void 0===n?void 0:n.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return Ko.isSupported()}}]),r}(P),Qo="core.rtcstatechange",qo={},$o={},ea={exports:{}},ta=ea.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(ta).forEach((function(e){ta[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}));var na=ea.exports;!function(e){var t=function(e){return String(Number(e))===e?Number(e):e},n=function(e,n,r){var i=e.name&&e.names;e.push&&!n[e.push]?n[e.push]=[]:i&&!n[e.name]&&(n[e.name]={});var o=e.push?{}:i?n[e.name]:n;!function(e,n,r,i){if(i&&!r)n[i]=t(e[1]);else for(var o=0;o<r.length;o+=1)null!=e[o+1]&&(n[r[o]]=t(e[o+1]))}(r.match(e.reg),o,e.names,e.name),e.push&&n[e.push].push(o)},r=na,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(r[t]||[]).length;s+=1){var u=r[t][s];if(u.reg.test(i))return n(u,a,i)}})),t.media=o,t};var o=function(e,n){var r=n.split(/=(.+)/,2);return 2===r.length?e[r[0]]=t(r[1]):1===r.length&&n.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var n=[],r=e.split(" ").map(t),i=0;i<r.length;i+=3)n.push({component:r[i],ip:r[i+1],port:r[i+2]});return n},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var n,r=!1;return"~"!==e[0]?n=t(e):(n=t(e.substring(1,e.length)),r=!0),{scid:n,paused:r}}))}))}}($o);var ra=na,ia=/%[sdv%]/g,oa=function(e){var t=1,n=arguments,r=n.length;return e.replace(ia,(function(e){if(t>=r)return e;var i=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},aa=function(e,t,n){var r=[e+"="+(t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?r.push(n[t.name][o]):r.push(n[t.names[i]])}else r.push(n[t.name]);return oa.apply(null,r)},sa=["v","o","s","i","u","e","p","c","b","t","r","z","a"],ua=["i","c","b","a"],ca=$o,la=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var n=t.outerOrder||sa,r=t.innerOrder||ua,i=[];return n.forEach((function(t){ra[t].forEach((function(n){n.name in e&&null!=e[n.name]?i.push(aa(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){i.push(aa(t,n,e))}))}))})),e.media.forEach((function(e){i.push(aa("m",ra.m[0],e)),r.forEach((function(t){ra[t].forEach((function(n){n.name in e&&null!=e[n.name]?i.push(aa(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){i.push(aa(t,n,e))}))}))}))})),i.join("\r\n")+"\r\n"};qo.write=la,qo.parse=ca.parse,qo.parseParams=ca.parseParams,qo.parseFmtpConfig=ca.parseFmtpConfig,qo.parsePayloads=ca.parsePayloads,qo.parseRemoteCandidates=ca.parseRemoteCandidates,qo.parseImageAttributes=ca.parseImageAttributes,qo.parseSimulcastStreamList=ca.parseSimulcastStreamList;var da=new bo("rts"),ha=function(e){Li(i,e);var t,n,r=Ci(i);function i(e){var t;return ki(this,i),Ei(Zi(t=r.call(this)),"_url",""),Ei(Zi(t),"_pc",null),Ei(Zi(t),"_audioTransceicer",null),Ei(Zi(t),"_videoTransceicer",null),Ei(Zi(t),"_mediaStream",null),Ei(Zi(t),"_media",null),Ei(Zi(t),"_opts",null),Ei(Zi(t),"_loader",null),Ei(Zi(t),"_retry",0),Ei(Zi(t),"_waitingTimer",0),Ei(Zi(t),"_rctConnectStartTs",0),Ei(Zi(t),"_onTrack",(function(e){if(da.log("addTrack: ",e.track,e.streams),t["_".concat(e.track.kind)]=e.track,!t._mediaStream){t._mediaStream=new MediaStream,t._media.srcObject=t._mediaStream;var n=t._media.play();n&&n.catch&&n.catch((function(e){}))}t._mediaStream.addTrack(e.track)})),Ei(Zi(t),"_mockWaitingByTimeupdate",(function(){var e,n;"connected"!==(null===(e=t._pc)||void 0===e?void 0:e.connectionState)&&"connected"!==(null===(n=t._pc)||void 0===n?void 0:n.iceConnectionState)||(clearTimeout(t._waitingTimer),t._waitingTimer=setTimeout((function(){var e;null!==(e=t._media)&&void 0!==e&&e.paused||t.emit("waiting")}),t._opts.stallInterval))})),Ei(Zi(t),"_onLoadedData",(function(){da.log("loadeddata emit"),t.getStatsSnapshoot().then((function(e){t.emit(Uo,{type:"video",elapsed:Date.now()-t._rctConnectStartTs,meta:e.video}),t.emit(Uo,{type:"audio",elapsed:Date.now()-t._rctConnectStartTs,meta:e.audio})}))})),Ei(Zi(t),"_onLoaderRetry",(function(e,n){t.emit(No,{error:yo.network(e),retryTime:n})})),t._opts=function(e){return Ai({retryCount:0,retryDelay:1e3,loadTimeout:5e3,stallInterval:400,delayHint:0},e)}(e),t._media=t._opts.media,t._loader=new zo(Ai(Ai({},e.fetchOptions),{},{responseType:"json",method:"POST",retry:t._opts.retryCount,retryDelay:t._opts.retryDelay,timeout:t._opts.loadTimeout,onRetryError:t._onLoaderRetry,logger:da})),t._retry=t._opts.retryCount,t._bindMediaEvent(),t}return xi(i,[{key:"pc",get:function(){return this._pc}},{key:"audioTrack",get:function(){return this._audio}},{key:"videoTack",get:function(){return this._video}},{key:"loader",get:function(){return this._loader}},{key:"getStats",value:function(){return e=this._pc,new Promise((function(t){var n;null===(n=e.getStats(null))||void 0===n||n.then((function(e){var n,r;t((r=[],(n=e).forEach((function(e){"inbound-rtp"===e.type&&r.push(e)})),r.map((function(e){var t=n.get(e.codecId),r=n.get(e.trackId);return{type:e.mediaType,inboundRtp:e,codec:t,track:r}}))))}))})).catch((function(){}));var e}},{key:"getStatsSnapshoot",value:function(){return this.getStats().then((function(e){return function(e){var t,n,r,i,o,a,s,u,c,l,d,h,f,p,m,y,v,g,b,A,_,w,S,k,T,x,E,L,I,R=null==e?void 0:e.filter((function(e){return"video"===e.type}))[0],Z=null==e?void 0:e.filter((function(e){return"audio"===e.type}))[0];return{video:R?{codec:null===(t=R.codec)||void 0===t?void 0:t.mimeType,payloadType:null===(n=R.codec)||void 0===n?void 0:n.payloadType,sdpFmtpLine:null===(r=R.codec)||void 0===r?void 0:r.sdpFmtpLine,bytesReceived:null===(i=R.inboundRtp)||void 0===i?void 0:i.bytesReceived,firCount:null===(o=R.inboundRtp)||void 0===o?void 0:o.firCount,pliCount:null===(a=R.inboundRtp)||void 0===a?void 0:a.pliCount,frameHeight:null===(s=R.inboundRtp)||void 0===s?void 0:s.frameHeight,frameWidth:null===(u=R.inboundRtp)||void 0===u?void 0:u.frameWidth,framesDecoded:null===(c=R.inboundRtp)||void 0===c?void 0:c.framesDecoded,framesDropped:null===(l=R.inboundRtp)||void 0===l?void 0:l.framesDropped,framesPerSecond:null===(d=R.inboundRtp)||void 0===d?void 0:d.framesPerSecond,framesReceived:null===(h=R.inboundRtp)||void 0===h?void 0:h.framesReceived,jitter:null===(f=R.inboundRtp)||void 0===f?void 0:f.jitter,jitterBufferDelay:null===(p=R.inboundRtp)||void 0===p?void 0:p.jitterBufferDelay,keyFramesDecoded:null===(m=R.inboundRtp)||void 0===m?void 0:m.keyFramesDecoded,nackCount:null===(y=R.inboundRtp)||void 0===y?void 0:y.nackCount,packetsLost:null===(v=R.inboundRtp)||void 0===v?void 0:v.packetsLost,packetsReceived:null===(g=R.inboundRtp)||void 0===g?void 0:g.packetsReceived}:void 0,audio:Z?{codec:null===(b=Z.codec)||void 0===b?void 0:b.mimeType,payloadType:null===(A=Z.codec)||void 0===A?void 0:A.payloadType,sdpFmtpLine:null===(_=Z.codec)||void 0===_?void 0:_.sdpFmtpLine,bytesReceived:null===(w=Z.inboundRtp)||void 0===w?void 0:w.bytesReceived,audioLevel:null===(S=Z.inboundRtp)||void 0===S?void 0:S.audioLevel,jitter:null===(k=Z.inboundRtp)||void 0===k?void 0:k.jitter,jitterBufferDelay:null===(T=Z.inboundRtp)||void 0===T?void 0:T.jitterBufferDelay,packetsLost:null===(x=Z.inboundRtp)||void 0===x?void 0:x.packetsLost,packetsReceived:null===(E=Z.inboundRtp)||void 0===E?void 0:E.packetsReceived,totalSamplesDuration:null===(L=Z.inboundRtp)||void 0===L?void 0:L.totalSamplesDuration,totalSamplesReceived:null===(I=Z.inboundRtp)||void 0===I?void 0:I.totalSamplesReceived}:void 0}}(e)}))}},{key:"load",value:(n=Si(_i().mark((function e(t){var n,r=this;return _i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._disconnect(),this._url=t,this._retry=this._opts.retryCount,(n=this._pc)&&n.close(),e.prev=5,this._pc=new RTCPeerConnection,this._bindRTCEvents(),e.next=10,this._connect(t);case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(5),setTimeout((function(){return r._emitError(yo.create(fo,null,e.t0))}));case 15:case"end":return e.stop()}}),e,this,[[5,12]])}))),function(e){return n.apply(this,arguments)})},{key:"switchURL",value:function(e){this.load(e||this._url)}},{key:"_bindRTCEvents",value:function(){var e=this,t=this._pc;t.addEventListener("track",this._onTrack),t.addEventListener("connectionstatechange",(function(){if(da.warn("onconnectionstatechange:",t.connectionState),e.emit(Qo,{state:t.connectionState,url:e._url}),"disconnected"!==t.connectionState&&"failed"!==t.connectionState||e.emit("waiting"),"failed"===t.connectionState){if(0===e._retry)return void e._emitError(yo.network(new Error("rtc connect failed")));e._retry--,e.load(e._url)}"connected"===t.connectionState&&e.emit(Vo,{url:e._url,responseUrl:e._url,elapsed:Date.now()-e._rctConnectStartTs})}))}},{key:"_bindMediaEvent",value:function(){this._media.addEventListener("timeupdate",this._mockWaitingByTimeupdate),this._media.addEventListener("loadeddata",this._onLoadedData)}},{key:"_connect",value:(t=Si(_i().mark((function e(){var t,n,r,i,o,a,s,u,c,l,d,h,f,p;return _i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t=this._pc).addTransceiver){e.next=11;break}return this._audioTransceicer=t.addTransceiver("audio",{direction:"recvonly"}),this._videoTransceicer=t.addTransceiver("video",{direction:"recvonly"}),(r=this._opts.delayHint)&&(this._audioTransceicer.receiver.playoutDelayHint=r,this._audioTransceicer.receiver.jitterBufferDelayHint=r,this._videoTransceicer.receiver.playoutDelayHint=r,this._videoTransceicer.receiver.jitterBufferDelayHint=r),e.next=8,t.createOffer();case 8:n=e.sent,e.next=14;break;case 11:return e.next=13,t.createOffer({iceRestart:!0,offerToReceiveAudio:!0,offerToReceiveVideo:!0});case 13:n=e.sent;case 14:return da.log("local offer"),da.log(n.sdp),(i=qo.parse(n.sdp)).media.filter((function(e){return"audio"===e.type})).forEach((function(e){var t,n=null===(t=e.rtp.filter((function(e){return"opus"===e.codec}))[0])||void 0===t?void 0:t.payload;n&&e.fmtp.forEach((function(e){e.payload===n&&(e.config="minptime=10;stereo=1;useinbandfec=1")}))})),n.sdp=qo.write(i),da.log("local offer modified:\n",n.sdp),e.next=22,t.setLocalDescription(n);case 22:return o=this._url,e.prev=23,this._opts.preProcessUrl&&(o=this._opts.preProcessUrl(o).url),this._loader.finnalUrl=o,u=/_?session_id=([^&$]+)/.exec(o),c=u?u[1]:Date.now()+"666",this.emit(Xo,{url:o,offersdp:n.sdp,sessionId:c}),l=Date.now(),e.next=32,this._loader.load(o,{body:JSON.stringify({sessionId:c,version:"1.0-html",localSdp:n})});case 32:if(d=e.sent,this.emit(Wo,{headers:d.response.headers}),404!==(null==(h=null==d?void 0:d.data)?void 0:h.code)&&403!==(null==h?void 0:h.code)){e.next=40;break}return(f=yo.create(404===h.code?ao:oo,null,h)).errorType=ro,this._emitError(f),e.abrupt("return");case 40:if(200===(null==h?void 0:h.code)){e.next=42;break}throw new Error("code: ".concat(null==h?void 0:h.code,", message:").concat(null==h?void 0:h.message));case 42:return da.log("answer:"),da.log(null===(a=h.remoteSdp)||void 0===a?void 0:a.sdp),this.emit(Oo,{url:o,elapsed:Date.now()-l,answersdp:null===(s=h.remoteSdp)||void 0===s?void 0:s.sdp}),(p=qo.parse(h.remoteSdp.sdp)).media.forEach((function(e){e.fingerprint.hash=e.fingerprint.hash.toUpperCase()})),h.remoteSdp.sdp=qo.write(p),da.log("answer modified:\n",h.remoteSdp.sdp),this._rctConnectStartTs=Date.now(),e.next=52,this._pc.setRemoteDescription(h.remoteSdp);case 52:e.next=57;break;case 54:e.prev=54,e.t0=e.catch(23),this._emitError(yo.network(e.t0));case 57:case"end":return e.stop()}}),e,this,[[23,54]])}))),function(){return t.apply(this,arguments)})},{key:"_disconnect",value:function(){var e;null===(e=this._loader)||void 0===e||e.cancel(),this._audioTransceicer=null,this._videoTransceicer=null,this._mediaStream=null}},{key:"_emitError",value:function(e){this.emit(Mo,e)}},{key:"destroy",value:function(){var e;this._disconnect(),null===(e=this._media)||void 0===e||e.removeEventListener("timeupdate",this._mockWaitingByTimeupdate),this._media&&(this._media.srcObject=null),this._pc&&this._pc.close(),this._loader=null,this._media=null,this._pc=null}}],[{key:"enableLogger",value:function(){bo.enable()}},{key:"disableLogger",value:function(){bo.disable()}}]),i}(P);try{localStorage.getItem("xgd")?ha.enableLogger():ha.disableLogger()}catch(Sye){}function fa(){return!(!window.RTCPeerConnection||!window.RTCPeerConnection.prototype.addTransceiver)}var pa=function(e){Li(r,e);var t,n=Ci(r);function r(){var e;ki(this,r);for(var t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];return Ei(Zi(e=n.call.apply(n,[this].concat(i))),"_rts",null),Ei(Zi(e),"_rtsOpts",null),Ei(Zi(e),"_init",(function(){var t;null===(t=e._rts)||void 0===t||t.destroy();var n=e.player.config,r=n.rts||{};e._rtsOpts=r,e._rts=new ha(Ai({media:e.player.video,preProcessUrl:function(t,n){var r,i;return(null===(r=(i=e.player).preProcessUrl)||void 0===r?void 0:r.call(i,t,n))||{url:t,ext:n}}},r)),e._rts.load(n.url)})),Ei(Zi(e),"_onSwitchURL",(function(t){e._rts&&(e.player.config.url=t,e._rts.switchURL(t))})),e}return xi(r,[{key:"pc",get:function(){var e;return null===(e=this._rts)||void 0===e?void 0:e.pc}},{key:"videoTrack",get:function(){var e;return null===(e=this._rts)||void 0===e?void 0:e.videoTack}},{key:"audioTrack",get:function(){var e;return null===(e=this._rts)||void 0===e?void 0:e.audioTrack}},{key:"core",get:function(){return this._rts}},{key:"loader",get:function(){var e;return null===(e=this._rts)||void 0===e?void 0:e.loader}},{key:"version",get:function(){return"0.2.0-alpha.5"}},{key:"beforePlayerInit",value:function(){var e,t=this;this._init(),this.player.switchURL=this._onSwitchURL,null===(e=this.player)||void 0===e||e.useHooks("replay",(function(){var e;return null===(e=t._rts)||void 0===e?void 0:e.switchURL()})),this.on(J,this._onSwitchURL),this.on(B,this.destroy),this._transErrorEvent(),this._transCoreEvent(Xo),this._transCoreEvent(Oo),this._transCoreEvent(Vo),this._transCoreEvent(Wo),this._transCoreEvent(No),this._transCoreEvent(Uo),this._transCoreEvent(Qo);try{ne.defineGetterOrSetter(this.player,{__url:{get:function(){try{return URL.createObjectURL(new MediaSource)}catch(r){var e,n;null!==(e=t.player)&&void 0!==e&&null!==(n=e.video)&&void 0!==n&&n.srcObject||(t.player.video.srcObject=new MediaStream)}}}})}catch(n){}}},{key:"getStats",value:function(){var e;return null===(e=this._rts)||void 0===e?void 0:e.getStats()}},{key:"getStatsSnapshoot",value:function(){var e;return null===(e=this._rts)||void 0===e?void 0:e.getStatsSnapshoot()}},{key:"_transErrorEvent",value:function(){var e=this;this._rts.on(Mo,(function(t){if(e.player){var n=new j(e.player,t),r=e._rtsOpts,i=r.backupConstruct,o=r.backupURL;if(o){var a,s=e.player;s.emit("core_event",Ai(Ai({},{url:s.config.url,code:n.errorCode,message:n.message,httpCode:n.httpCode}),{},{eventName:"core.degrade"})),s.emit("degrade",{url:s.config.url,code:n.errorCode,message:n.message,httpCode:n.httpCode}),s.unRegisterPlugin("rts"),e._rts=null,s.rts=null,null!==(a=s.video)&&void 0!==a&&a.srcObject&&(s.video.srcObject=null),s.config.url=o,i?s.registerPlugin(i).beforePlayerInit():s.video.src=o}else e.player.emit(H,n)}})),this._rts.on("waiting",(function(){var t;null===(t=e.player)||void 0===t||t.emit("waiting")}))}},{key:"_transCoreEvent",value:function(e){var t=this;this._rts.on(e,(function(n){t.player&&t.player.emit("core_event",Ai(Ai({},n),{},{eventName:e}))}))}},{key:"destroy",value:function(){var e;null===(e=this._rts)||void 0===e||e.destroy()}}],[{key:"pluginName",get:function(){return"rts"}},{key:"isSupported",value:function(){return fa()}},{key:"getCapacity",value:function(){return function(){if(!fa())return Promise.reject("RTCPeerConnection no support");var e;try{(e=new RTCPeerConnection).addTransceiver("video",{direction:"recvonly"}),e.addTransceiver("audio",{direction:"recvonly"})}catch(t){return Promise.reject(null==t?void 0:t.message)}return e.createOffer().then((function(t){var n,r,i,o;da.log(t.sdp);var a=qo.parse(t.sdp),s=null===(n=a.media)||void 0===n?void 0:n.filter((function(e){return"video"===e.type}))[0],u=null===(r=a.media)||void 0===r?void 0:r.filter((function(e){return"audio"===e.type}))[0],c=null==s||null===(i=s.rtp)||void 0===i?void 0:i.filter((function(e){return"VP8"===e.codec||"VP9"===e.codec||"H264"===e.codec})),l=null==u||null===(o=u.rtp)||void 0===o?void 0:o.filter((function(e){return"opus"===e.codec})),d=null==s?void 0:s.fmtp,h=null==u?void 0:u.fmtp;return d&&c.map((function(e){var t;e.config=null===(t=d.filter((function(t){return t.payload===e.payload}))[0])||void 0===t?void 0:t.config})),h&&l.map((function(e){var t;e.config=null===(t=h.filter((function(t){return t.payload===e.payload}))[0])||void 0===t?void 0:t.config})),e.close(),{video:c,audio:l}}))}()}},{key:"isSupportedH264",value:(t=Si(_i().mark((function e(t){var n,i,o,a,s;return _i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.getCapacity();case 3:if(i=e.sent,o=null===(n=i.video)||void 0===n?void 0:n.filter((function(e){return"H264"===e.codec&&(!t||-1!==e.config.indexOf(t))})).length){e.next=10;break}return e.next=8,r.getCapacity();case 8:s=e.sent,o=null===(a=s.video)||void 0===a?void 0:a.filter((function(e){return"H264"===e.codec&&(!t||-1!==e.config.indexOf(t))})).length;case 10:return e.abrupt("return",!!o);case 13:return e.prev=13,e.t0=e.catch(0),e.abrupt("return",!1);case 16:case"end":return e.stop()}}),e,null,[[0,13]])}))),function(e){return t.apply(this,arguments)})}]),r}(ne);const ma=t.DynamicModule.PluginRtm;var ya=Object.freeze({__proto__:null,RtmPlugin:pa,__PLUGIN_NAME__:ma});function va(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 ga(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?va(Object(n),!0).forEach((function(t){xa(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):va(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ba(){ba=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(L){u=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var o=t&&t.prototype instanceof h?t:h,a=Object.create(o.prototype),s=new T(i||[]);return r(a,"_invoke",{value:_(e,n,s)}),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(L){return{type:"throw",arg:L}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,o)&&(m=v);var g=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,t){function i(r,o,a,s){var u=l(e[r],e,o);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(d).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=w(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=l(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,d;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function S(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function x(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(A.prototype),u(A.prototype,a,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new A(c(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),u(g,s,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=x,T.prototype={constructor:T,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(k),!e)for(var t in this)"t"===t.charAt(0)&&n.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 r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},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),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:x(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function Aa(e){return(Aa="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 _a(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(Sye){return void n(Sye)}s.done?t(u):Promise.resolve(u).then(r,i)}function wa(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){_a(o,r,i,a,s,"next",e)}function s(e){_a(o,r,i,a,s,"throw",e)}a(void 0)}))}}function Sa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ka(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ma(r.key),r)}}function Ta(e,t,n){return t&&ka(e.prototype,t),n&&ka(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function xa(e,t,n){return(t=Ma(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ea(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&&Ia(e,t)}function La(e){return(La=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ia(e,t){return(Ia=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ra(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Za(e){var t=function(){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}}();return function(){var n,r=La(e);if(t){var i=La(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(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 Ra(e)}(this,n)}}function Ca(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(l){c=!0,i=l}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||Ga(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 Pa(e){return function(e){if(Array.isArray(e))return Da(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ga(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 Ga(e,t){if(e){if("string"==typeof e)return Da(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Da(e,t):void 0}}function Da(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ma(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function Va(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 Xa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Va(Object(n),!0).forEach((function(t){ja(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Va(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Wa(){Wa=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(L){u=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var o=t&&t.prototype instanceof h?t:h,a=Object.create(o.prototype),s=new T(i||[]);return r(a,"_invoke",{value:_(e,n,s)}),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(L){return{type:"throw",arg:L}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,o)&&(m=v);var g=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,t){function i(r,o,a,s){var u=l(e[r],e,o);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(d).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=w(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=l(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,d;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function S(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function x(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(A.prototype),u(A.prototype,a,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new A(c(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),u(g,s,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=x,T.prototype={constructor:T,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(k),!e)for(var t in this)"t"===t.charAt(0)&&n.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 r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},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),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:x(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function Oa(e){return(Oa="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 Na(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(Sye){return void n(Sye)}s.done?t(u):Promise.resolve(u).then(r,i)}function Ua(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Na(o,r,i,a,s,"next",e)}function s(e){Na(o,r,i,a,s,"throw",e)}a(void 0)}))}}function Fa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ya(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,os(r.key),r)}}function Ka(e,t,n){return t&&Ya(e.prototype,t),n&&Ya(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ja(e,t,n){return(t=os(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ha(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&&Ja(e,t)}function Ba(e){return(Ba=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ja(e,t){return(Ja=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function za(){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 Qa(e,t,n){return(Qa=za()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&Ja(i,n.prototype),i}).apply(null,arguments)}function qa(e){var t="function"==typeof Map?new Map:void 0;return qa=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;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,r)}function r(){return Qa(e,arguments,Ba(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Ja(r,e)},qa(e)}function $a(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function es(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ts(e){var t=za();return function(){var n,r=Ba(e);if(t){var i=Ba(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(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 es(e)}(this,n)}}function ns(){return ns="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ba(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},ns.apply(this,arguments)}function rs(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function is(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return rs(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rs(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}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 o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function os(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function as(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.used=!1,n.resolve=function(){return n.used=!0,e.apply(void 0,arguments)},n.reject=function(){return n.used=!0,t.apply(void 0,arguments)},n}function ss(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}var us,cs=function(){function e(){Fa(this,e)}return Ka(e,null,[{key:"start",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&e.start(0)<0?0:e.start(0):0}},{key:"end",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1):0}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(Sye){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var n=[],r=0,i=e.length;r<i;r++){var o=n.length;if(o&&t){var a=n[o-1],s=a[1];if(e.start(r)-s<=t){var u=e.end(r);u>s&&(a[1]=u)}else n.push([e.start(r),e.end(r)])}else n.push([e.start(r),e.end(r)])}return n}},{key:"totalLength",value:function(e){return e&&e.length?e.reduce((function(e,t){return e+(t[1]-t[0])}),0):0}},{key:"info",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t||!t.length)return{start:0,end:0,buffers:[]};for(var i=0,o=0,a=0,s=0,u=0,c=0,l=0,d=e.buffers(t,r),h=0,f=d.length;h<f;h++){var p=d[h];if(n+r>=p[0]&&n<=p[1])i=p[0],o=p[1],a=h;else{if(n+r<p[0]){s=p[0],u=p[1];break}n+r>p[1]&&(c=p[0],l=p[1])}}return{start:i,end:o,index:a,buffers:d,nextStart:s,nextEnd:u,prevStart:c,prevEnd:l,currentTime:n,behind:n-i,remaining:o?o-n:0,length:e.totalLength&&e.totalLength(d)}}}]),e}(),ls="manifest",ds="network",hs="network_timeout",fs="network_forbidden",ps="network_notfound",ms="network_range_not_satisfiable",ys="demux",vs="remux",gs="media",bs="drm",As="other",_s="runtime",ws={FLV:"FLV",HLS:"HLS",MP4:"MP4",FMP4:"FMP4",MSE_ADD_SB:"MSE_ADD_SB",MSE_APPEND_BUFFER:"MSE_APPEND_BUFFER",MSE_OTHER:"MSE_OTHER",MSE_FULL:"MSE_FULL",OPTION:"OPTION",DASH:"DASH",LICENSE:"LICENSE",CUSTOM_LICENSE:"CUSTOM_LICENSE",MSE_HIJACK:"MSE_HIJACK",EME_HIJACK:"EME_HIJACK",SIDX:"SIDX",NO_CANPLAY_ERROR:"NO_CANPLAY_ERROR",BUFFERBREAK_ERROR:"BUFFERBREAK_ERROR",WAITING_TIMEOUT_ERROR:"WAITING_TIMEOUT_ERROR",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_CODEC_NOT_SUPPORTED:"MEDIA_ERR_CODEC_NOT_SUPPORTED",MEDIA_ERR_URL_EMPTY:"MEDIA_ERR_URL_EMPTY"},Ss=(ja(us={},ls,{HLS:1100,DASH:1200}),ja(us,ds,2100),ja(us,hs,2101),ja(us,fs,2103),ja(us,ps,2104),ja(us,ms,2116),ja(us,ys,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),ja(us,vs,{FMP4:4100,MP4:4200}),ja(us,gs,{MEDIA_ERR_ABORTED:5101,MEDIA_ERR_NETWORK:5102,MEDIA_ERR_DECODE:5103,MEDIA_ERR_SRC_NOT_SUPPORTED:5104,MEDIA_ERR_CODEC_NOT_SUPPORTED:5105,MEDIA_ERR_URL_EMPTY:5106,MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203,MSE_HIJACK:5204,EME_HIJACK:5301}),ja(us,bs,{LICENSE:7100,CUSTOM_LICENSE:7200}),ja(us,As,8e3),ja(us,_s,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002,WAITING_TIMEOUT_ERROR:9003}),us),ks=function(e){Ha(n,e);var t=ts(n);function n(e,r,i,o,a){var s;return Fa(this,n),(s=t.call(this,a||(null==i?void 0:i.message))).errorType=e===hs?ds:e,s.originError=i,s.ext=o,s.errorCode=Ss[e][r]||Ss[e],s.errorMessage=s.message,s.errorCode||(s.errorType=As,s.errorCode=Ss[s.errorType]),s}return Ka(n,null,[{key:"create",value:function(e,t,r,i,o){return e instanceof n?e:(e instanceof Error&&(r=e,e=""),e||(e=As),new n(e,t,r,i,o))}},{key:"network",value:function(e){var t;return new n(null!=e&&e.isTimeout?hs:ds,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}]),n}(qa(Error)),Ts="undefined"!=typeof window,xs={DEBUG:1,LOG:2,WARN:3,ERROR:4},Es=["Boolean","Number","String","Undefined","Null","Date","Object"],Ls=function(){function e(t,n){Fa(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),this.logCacheLevel=(null==n?void 0:n.logCacheLevel)||3,this.logMaxSize=(null==n?void 0:n.logMaxSize)||204800,this.logSize=0,this.logTextArray=[]}return Ka(e,[{key:"debug",value:function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];this.logCache.apply(this,[xs.DEBUG].concat(r)),e.disabled||(t=console).debug.apply(t,[this._prefix,Is()].concat(r))}},{key:"log",value:function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];this.logCache.apply(this,[xs.LOG].concat(r)),e.disabled||(t=console).log.apply(t,[this._prefix,Is()].concat(r))}},{key:"warn",value:function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];this.logCache.apply(this,[xs.WARN].concat(r)),e.disabled||(t=console).warn.apply(t,[this._prefix,Is()].concat(r))}},{key:"error",value:function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];this.logCache.apply(this,[xs.ERROR].concat(r)),e.disabled||(t=console).error.apply(t,[this._prefix,Is()].concat(r))}},{key:"logCache",value:function(e){if(!(e<this.logCacheLevel)){var t="";try{for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=r.map((function(e){return Zs(e)}));t=this._prefix+Is()+JSON.stringify(o)}catch(s){return}if(e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var a=this.logTextArray.shift();this.logSize-=a.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function Is(){return(new Date).toLocaleString()}function Rs(e){if("object"!==Oa(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function Zs(e,t,n){n||(n=1),t||(t=2);var r={};if(!e||"object"!==Oa(e))return e;var i=Object.prototype.toString.call(e).slice(8,-1);if(!Es.includes(i))return i;if(!(n>t)){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n===t?r[o]=Rs(e[o]):"object"===Oa(e[o])?r[o]=Zs(e[o],t,n+1):r[o]=e[o]);return r}}ja(Ls,"disabled",!0);var Cs=function(){try{return Ts?window.MediaSource:null}catch(e){}}(),Ps="appendBuffer",Gs="removeBuffer",Ds="updateDuration",Ms=function(){function e(t,n){var r=this;Fa(this,e),ja(this,"media",null),ja(this,"mediaSource",null),ja(this,"_openPromise",as()),ja(this,"_queue",Object.create(null)),ja(this,"_sourceBuffer",Object.create(null)),ja(this,"_mseFullFlag",{}),ja(this,"_st",0),ja(this,"_opst",0),ja(this,"_logger",null),ja(this,"_config",null),ja(this,"_url",null),ja(this,"_onSBUpdateEnd",(function(e){var t=r._queue[e];if(t){var n=t[0];if((null==n?void 0:n.opName)!==Ds&&t.shift(),n){var i=ss()-r._opst;r._logger.debug("UpdateEnd",n.opName,i,n.context),n.promise.resolve({name:n.opName,context:n.context,costtime:i}),r._startQueue(e)}}})),ja(this,"_onSBUpdateError",(function(e,t){var n=r._queue[e];if(n){var i=n[0];i&&(r._logger.error("UpdateError",e,i.opName,i.context),i.promise.reject(new ks(gs,ws.MSE_APPEND_BUFFER,t)))}})),this._config=Object.assign(e.getDefaultConfig(),n),t&&this.bindMedia(t),this._logger=new Ls("MSE"),this._config.openLog&&Ls.enable()}var t,n,r;return Ka(e,[{key:"isOpened",get:function(){var e;return"open"===(null===(e=this.mediaSource)||void 0===e?void 0:e.readyState)}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return(null===(e=this.mediaSource)||void 0===e?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"isFull",value:function(t){return t?this._mseFullFlag[t]:this._mseFullFlag[e.VIDEO]}},{key:"updateDuration",value:function(e){var t=this,n=this.mediaSource&&this.mediaSource.duration>e;if(this.mediaSource&&this.mediaSource.duration>e){var r=0;if(Object.keys(this._sourceBuffer).forEach((function(e){try{r=Math.max(t.bufferEnd(e)||0,r)}catch(Sye){}})),e<r)return Promise.resolve()}return this._enqueueBlockingOp((function(){t.isEnded?t._logger.debug("[debug mse] setDuration ended"):t.mediaSource&&(t.mediaSource.duration=e,t._logger.debug("[debug mse] setDuration"))}),Ds,{isReduceDuration:n})}},{key:"open",value:function(){var e=this;if(this._openPromise.used&&!this.isOpened&&this.mediaSource){var t=this.mediaSource;t.addEventListener("sourceopen",(function n(){var r=ss()-e._st;e._logger.debug("MSE OPEN",r),t.removeEventListener("sourceopen",n),e._openPromise.resolve({costtime:r})})),this._openPromise=as()}return this._openPromise}},{key:"bindMedia",value:(r=Ua(Wa().mark((function e(t){var n,r,i=this;return Wa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.mediaSource&&!this.media){e.next=3;break}return e.next=3,this.unbindMedia();case 3:if(t&&Cs){e.next=5;break}throw new Error("Param media or MediaSource does not exist");case 5:return this.media=t,n=this.mediaSource=new Cs,this._st=ss(),r=function e(){var r=ss()-i._st;i._logger.debug("MSE OPEN"),n.removeEventListener("sourceopen",e),URL.revokeObjectURL(t.src),i._openPromise.resolve({costtime:r})},n.addEventListener("sourceopen",r),this._url=URL.createObjectURL(n),t.src=this._url,e.abrupt("return",this._openPromise);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unbindMedia",value:(n=Ua(Wa().mark((function e(){var t,n,r,i=this;return Wa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._openPromise.used||this._openPromise.resolve(),t=this.mediaSource){if(Object.keys(this._queue).forEach((function(e){var t=i._queue[e];t&&t.forEach((function(e){var t,n;return null===(t=e.promise)||void 0===t||null===(n=t.resolve)||void 0===n?void 0:n.call(t)}))})),n=!!this.media&&this.media.readyState>=1,r="open"===t.readyState,n&&r)try{t.endOfStream()}catch(Sye){}Object.keys(this._sourceBuffer).forEach((function(e){try{t.removeSourceBuffer(i._sourceBuffer[e])}catch(Sye){}}))}if(this.media){this.media.removeAttribute("src");try{this.media.load()}catch(Sye){}this.media=null}this.mediaSource=null,this._openPromise=as(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"createSource",value:function(e,t){if(!this._sourceBuffer[e]&&this.mediaSource){var n;try{n=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(Sye){throw new ks(gs,ws.MSE_ADD_SB,Sye)}n.mimeType=t,n.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),n.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,t){var n=this,r=this._sourceBuffer[e];return this.mediaSource&&r&&r.mimeType!==t?"function"!=typeof r.changeType?Promise.reject():this._enqueueOp(e,(function(){r.changeType(t),r.mimeType=t,n._onSBUpdateEnd(e)}),"changeType",{mimeType:t}):Promise.resolve()}},{key:"createOrChangeSource",value:function(e,t){return this.createSource(e,t),this.changeType(e,t)}},{key:"append",value:function(e,t,n){var r=this;return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,(function(){var i;r.mediaSource&&!r.media.error&&(r._logger.debug("MSE APPEND START",n),r._opst=ss(),null===(i=r._sourceBuffer[e])||void 0===i||i.appendBuffer(t))}),Ps,n):Promise.resolve()}},{key:"remove",value:function(e,t,n,r){var i=this,o=!1;return this._mseFullFlag[e]&&(o=!0),this._enqueueOp(e,(function(){if(i.mediaSource&&!i.media.error){var o=i._sourceBuffer[e];t>=n||!o?i._onSBUpdateEnd(e):(i._opst=ss(),i._logger.debug("MSE REMOVE START",e,t,n,r),o.remove(t,n))}}),Gs,r,o)}},{key:"clearBuffer",value:function(e,t){var n,r=this;return Object.keys(this._sourceBuffer).forEach((function(i){n=r.remove(i,e,t)})),n||Promise.resolve()}},{key:"clearAllBuffer",value:function(){var e,t=this;return Object.keys(this._sourceBuffer).forEach((function(n){var r=t._sourceBuffer[n];e=t.remove(n,0,cs.end(cs.get(r)))})),e}},{key:"clearOpQueues",value:function(e,t){var n;this._logger.debug("MSE clearOpQueue START");var r=this._queue[e];if(t&&r)this._queue[e]=[];else if(r&&r[e]&&!(r.length<5)){var i=[];r.forEach((function(e){e.context&&e.context.isinit&&i.push(e)})),this._queue[e]=r.slice(0,2),i.length>0&&(n=this._queue[e]).push.apply(n,i)}}},{key:"endOfStream",value:function(e){var t=this;return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp((function(){var n=t.mediaSource;n&&"open"===n.readyState&&(t._logger.debug("MSE endOfStream START"),e?n.endOfStream(e):n.endOfStream())}),"endOfStream"):Promise.resolve()}},{key:"setLiveSeekableRange",value:function(e,t){var n=this.mediaSource;e<0||t<e||null==n||!n.setLiveSeekableRange||"open"!==n.readyState||n.setLiveSeekableRange(e,t)}},{key:"getSourceBuffer",value:function(e){return this._sourceBuffer[e]}},{key:"buffered",value:function(e){return cs.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return cs.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return cs.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,t,n,r,i){var o=this;if(!this.mediaSource)return Promise.resolve();var a=this._queue[e]=this._queue[e]||[],s={exec:t,promise:as(),opName:n,context:r};return i?(a.splice(0,0,s),this._mseFullFlag[e]=!1,this._startQueue(e)):a.push(s),this.isOpened||this.isEnded?1===a.length&&this._startQueue(e):this._openPromise.then((function(){1===a.length&&o._startQueue(e)})),s.promise}},{key:"_enqueueBlockingOp",value:(t=Ua(Wa().mark((function e(t,n,r){var i,o,a=this;return Wa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaSource){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:if((i=Object.keys(this._sourceBuffer)).length){e.next=5;break}return e.abrupt("return",t());case 5:return o=[],i.forEach((function(e){var t=a._queue[e],i=as();o.push(i),t.push({exec:function(){i.resolve()},promise:i,opName:n,context:r}),1===t.length&&a._startQueue(e)})),e.abrupt("return",Promise.all(o).then((function(){try{return t()}finally{i.forEach((function(e){var t=a._queue[e],n=a._sourceBuffer[e];null==t||t.shift(),n&&n.updating||a._startQueue(e)}))}})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"_startQueue",value:function(e){var t=this._queue[e];if(t){var n=t[0];if(n&&!this._mseFullFlag[e])try{n.exec()}catch(Sye){Sye&&Sye.message&&Sye.message.indexOf("SourceBuffer is full")>=0?(this._mseFullFlag[e]=!0,this._logger.error("[MSE error], context,",n.context," ,name,",n.opName,",err,SourceBuffer is full"),n.promise.reject(new ks(gs,ws.MSE_FULL,Sye))):(this._logger.error(Sye),n.promise.reject(new ks(gs,ws.MSE_OTHER,Sye)),t.shift(),this._startQueue(e))}}}},{key:"setTimeoffset",value:function(e,t,n){var r=this;return this._enqueueOp(e,(function(){t<0&&(t+=.001),r._sourceBuffer[e].timestampOffset=t,r._onSBUpdateEnd(e)}),"setTimeoffset",n)}},{key:"abort",value:function(e,t){var n=this;return this.isOpened?this._enqueueOp(e,(function(){n._sourceBuffer[e].abort(),n._onSBUpdateEnd(e)}),"abort",t):Promise.resolve()}}],[{key:"getDefaultConfig",value:function(){return{openLog:!1}}},{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if(!Cs)return!1;try{return Cs.isTypeSupported(e)}catch(Sye){return this._logger.error(e,Sye),!1}}}]),e}();ja(Ms,"VIDEO","video"),ja(Ms,"AUDIO","audio");var Vs="fetch",Xs="xhr",Ws="arraybuffer",Os="text",Ns="json",Us=function(e){Ha(n,e);var t=ts(n);function n(e,r,i,o){var a;return Fa(this,n),ja(es(a=t.call(this,o)),"retryCount",0),ja(es(a),"isTimeout",!1),ja(es(a),"loaderType",Vs),ja(es(a),"startTime",0),ja(es(a),"endTime",0),ja(es(a),"options",{}),a.url=e,a.request=r,a.response=i,a}return Ka(n)}(qa(Error)),Fs=Object.prototype.toString;function Ys(e){if("[object Object]"!==Fs.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function Ks(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function js(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Hs(e,t){if(e){if(!t)return e;var n,r=Object.keys(t).map((function(e){if(null!=(n=t[e]))return Array.isArray(n)?e+="[]":n=[n],n.map((function(t){var n;return n=t,"[object Date]"===Fs.call(n)?t=t.toISOString():function(e){return null!==e&&"object"===Oa(e)}(t)&&(t=JSON.stringify(t)),"".concat(js(e),"=").concat(js(t))})).join("&")})).filter(Boolean).join("&");if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e}}function Bs(e,t,n,r,i,o,a,s,u,c,l){return i=null!=i?parseFloat(i):null,r=parseInt(r||"0",10),Number.isNaN(r)&&(r=0),{data:e,done:t,options:{range:u,vid:c,index:s,contentLength:r,age:i,startTime:o,firstByteTime:a,endTime:Date.now(),priOptions:l},response:n}}function Js(e,t){return Math.round(8*e*1e3/t/1024)}var zs={ERROR:"error",TTFB:"core.ttfb",LOAD_START:"core.loadstart",LOAD_RESPONSE_HEADERS:"core.loadresponseheaders",LOAD_COMPLETE:"core.loadcomplete",LOAD_RETRY:"core.loadretry",SOURCEBUFFER_CREATED:"core.sourcebuffercreated",ANALYZE_DURATION_EXCEEDED:"core.analyzedurationexceeded",REMOVE_BUFFER:"core.removebuffer",BUFFEREOS:"core.buffereos",KEYFRAME:"core.keyframe",METADATA_PARSED:"core.metadataparsed",SEI:"core.sei",SEI_IN_TIME:"core.seiintime",FLV_SCRIPT_DATA:"core.flvscriptdata",LOWDECODE:"core.lowdecode",SWITCH_URL_SUCCESS:"core.switchurlsuccess",SWITCH_URL_FAILED:"core.switchurlfailed",SPEED:"core.speed",HLS_MANIFEST_LOADED:"core.hlsmanifestloaded",HLS_LEVEL_LOADED:"core.hlslevelloaded",DEMUXED_TRACK:"core.demuxedtrack",STREAM_EXCEPTION:"core.streamexception",LARGE_AV_FIRST_FRAME_GAP_DETECT:"LARGE_AV_FIRST_FRAME_GAP_DETECT",LARGE_VIDEO_DTS_GAP_DETECT:"LARGE_VIDEO_DTS_GAP_DETECT",LARGE_AUDIO_DTS_GAP_DETECT:"LARGE_AUDIO_DTS_GAP_DETECT",AUDIO_GAP_DETECT:"AUDIO_GAP_DETECT",AUDIO_OVERLAP_DETECT:"AUDIO_OVERLAP_DETECT",MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT:"MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT",REAL_TIME_SPEED:"real_time_speed"},Qs=2097152,qs=function(e){Ha(r,e);var t,n=ts(r);function r(){var e;return Fa(this,r),ja(es(e=n.call(this)),"_abortController",null),ja(es(e),"_timeoutTimer",null),ja(es(e),"_reader",null),ja(es(e),"_response",null),ja(es(e),"_aborted",!1),ja(es(e),"_index",-1),ja(es(e),"_range",null),ja(es(e),"_receivedLength",0),ja(es(e),"_running",!1),ja(es(e),"_logger",null),ja(es(e),"_vid",""),ja(es(e),"_onProcessMinLen",0),ja(es(e),"_onCancel",null),ja(es(e),"_priOptions",null),e}return Ka(r,[{key:"load",value:function(e){var t,n=this,r=e.url,i=e.vid,o=e.timeout,a=e.responseType,s=e.onProgress,u=e.index,c=e.onTimeout,l=e.onCancel,d=e.range,h=e.transformResponse,f=e.request,p=e.params,m=e.logger,y=e.method,v=e.headers,g=e.body,b=e.mode,A=e.credentials,_=e.cache,w=e.redirect,S=e.referrer,k=e.referrerPolicy,T=e.onProcessMinLen,x=e.priOptions;this._logger=m,this._aborted=!1,this._onProcessMinLen=T,this._onCancel=l,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=u,this._range=d||[0,0],this._vid=i||r,this._priOptions=x||{};var E={method:y,headers:v,body:g,mode:b,credentials:A,cache:_,redirect:w,referrer:S,referrerPolicy:k,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},L=!1;clearTimeout(this._timeoutTimer),r=Hs(r,p);var I=Ks(d);I&&(v=f?f.headers:E.headers=E.headers||(Headers?new Headers:{}),Headers&&v instanceof Headers?v.append("Range",I):v.Range=I),o&&(this._timeoutTimer=setTimeout((function(){if(L=!0,n.cancel(),c){var e=new Us(r,E,null,"timeout");e.isTimeout=!0,c(e,{index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions})}}),o));var R=Date.now();return this._logger.debug("[fetch load start], index,",u,",range,",d),new Promise((function(e,t){fetch(f||r,f?void 0:E).then(function(){var i=Ua(Wa().mark((function i(o){var c,l,f,p;return Wa().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(n._timeoutTimer),n._response=o,!n._aborted&&n._running){i.next=4;break}return i.abrupt("return");case 4:if(h&&(o=h(o,r)||o),o.ok){i.next=7;break}throw new Us(r,E,o,"bad network response");case 7:if(c=Date.now(),a!==Os){i.next=15;break}return i.next=11,o.text();case 11:l=i.sent,n._running=!1,i.next=37;break;case 15:if(a!==Ns){i.next=22;break}return i.next=18,o.json();case 18:l=i.sent,n._running=!1,i.next=37;break;case 22:if(!s){i.next=29;break}return n.resolve=e,n.reject=t,n._loadChunk(o,s,R,c),i.abrupt("return");case 29:return i.next=31,o.arrayBuffer();case 31:l=i.sent,l=new Uint8Array(l),n._running=!1,f=Date.now()-R,p=Js(l.byteLength,f),n.emit(zs.REAL_TIME_SPEED,{speed:p,len:l.byteLength,time:f,vid:n._vid,index:n._index,range:n._range,priOptions:n._priOptions});case 37:n._logger.debug("[fetch load end], index,",u,",range,",d),e(Bs(l,!0,o,o.headers.get("Content-Length"),o.headers.get("age"),R,c,u,d,n._vid,n._priOptions));case 39:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}()).catch((function(e){var i;clearTimeout(n._timeoutTimer),n._running=!1,n._aborted&&!L||((e=e instanceof Us?e:new Us(r,E,null,null===(i=e)||void 0===i?void 0:i.message)).startTime=R,e.endTime=Date.now(),e.isTimeout=L,e.options={index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions},t(e))}))}))}},{key:"cancel",value:(t=Ua(Wa().mark((function e(){return Wa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch(Sye){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,n,r){var i=this;if(!e.body||!e.body.getReader){this._running=!1;var o=new Us(e.url,"",e,"onProgress of bad response.body.getReader");return o.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(o)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(Qs),this._writeIdx=0);var a,s,u,c=this._reader=e.body.getReader(),l=function(){var o=Ua(Wa().mark((function o(){var d,h,f,p,m,y,v,g;return Wa().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return s=Date.now(),o.prev=1,o.next=4,c.read();case 4:a=o.sent,u=Date.now(),o.next=13;break;case 8:return o.prev=8,o.t0=o.catch(1),u=Date.now(),i._aborted||(i._running=!1,o.t0.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i.reject(o.t0)),o.abrupt("return");case 13:if(h=(null===(d=i._range)||void 0===d?void 0:d.length)>0?i._range[0]:0,f=h+i._receivedLength,!i._aborted){o.next=19;break}return i._running=!1,t(void 0,!1,{range:[f,f],vid:i._vid,index:i._index,startTime:s,endTime:u,st:n,firstByteTime:r,priOptions:i._priOptions},e),o.abrupt("return");case 19:p=a.value?a.value.byteLength:0,i._receivedLength+=p,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",f,", end,",h+i._receivedLength,", done,",a.done),i._onProcessMinLen>0?i._writeIdx+p>=i._onProcessMinLen||a.done?((m=new Uint8Array(i._writeIdx+p)).set(i._cache.slice(0,i._writeIdx),0),p>0&&m.set(a.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",a.done,",len,",m.byteLength,", writeIdx,",i._writeIdx)):p>0&&i._writeIdx+p<Qs?(i._cache.set(a.value,i._writeIdx),i._writeIdx+=p,i._logger.debug("【fetchLoader,onProgress cache】,len,",p,", writeIdx,",i._writeIdx)):p>0&&(y=new Uint8Array(i._writeIdx+p+2048),i._logger.debug("【fetchLoader,onProgress extra start】,size,",i._writeIdx+p+2048,", datalen,",p,", writeIdx,",i._writeIdx),y.set(i._cache.slice(0,i._writeIdx),0),p>0&&y.set(a.value,i._writeIdx),i._writeIdx+=p,delete i._cache,i._cache=y,i._logger.debug("【fetchLoader,onProgress extra end】,len,",p,", writeIdx,",i._writeIdx)):m=a.value,(m&&m.byteLength>0||a.done)&&t(m,a.done,{range:[i._range[0]+i._receivedLength-(m?m.byteLength:0),i._range[0]+i._receivedLength],vid:i._vid,index:i._index,startTime:s,endTime:u,st:n,firstByteTime:r,priOptions:i._priOptions},e),a.done?(v=Date.now()-n,g=Js(i._receivedLength,v),i.emit(zs.REAL_TIME_SPEED,{speed:g,len:i._receivedLength,time:v,vid:i._vid,index:i._index,range:i._range,priOptions:i._priOptions}),i._running=!1,i._logger.debug("[fetchLoader onProgress end],task,",i._range,",done,",a.done),i.resolve(Bs(a,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),n,r,i._index,i._range,i._vid,i._priOptions))):l();case 25:case"end":return o.stop()}}),o,null,[[1,8]])})));return function(){return o.apply(this,arguments)}}();l()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}]),r}(P);var $s=function(e){Ha(n,e);var t=ts(n);function n(){var e;return Fa(this,n),ja(es(e=t.call(this)),"_xhr",null),ja(es(e),"_aborted",!1),ja(es(e),"_timeoutTimer",null),ja(es(e),"_range",null),ja(es(e),"_receivedLength",0),ja(es(e),"_url",null),ja(es(e),"_onProgress",null),ja(es(e),"_index",-1),ja(es(e),"_headers",null),ja(es(e),"_currentChunkSizeKB",384),ja(es(e),"_timeout",null),ja(es(e),"_xhr",null),ja(es(e),"_withCredentials",null),ja(es(e),"_startTime",-1),ja(es(e),"_loadCompleteResolve",null),ja(es(e),"_loadCompleteReject",null),ja(es(e),"_runing",!1),ja(es(e),"_logger",!1),ja(es(e),"_vid",""),ja(es(e),"_responseType",void 0),ja(es(e),"_credentials",void 0),ja(es(e),"_method",void 0),ja(es(e),"_transformResponse",void 0),ja(es(e),"_firstRtt",void 0),ja(es(e),"_onCancel",null),ja(es(e),"_priOptions",null),e}return Ka(n,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=Hs(e.url,e.params);var n=Date.now();return new Promise((function(e,n){t._loadCompleteResolve=e,t._loadCompleteReject=n,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof Us?e:new Us(t._url,t._request)).startTime=n,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e}))}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===Ws&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,n=this._range[0]+this._receivedLength,r=this._range[1];t<this._range[1]-n&&(r=n+t),e=[n,r],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var n=this._xhr=new XMLHttpRequest;n.open(this._method||"GET",this._url,!0),n.responseType=this._responseType,this._timeout&&(n.timeout=this._timeout),n.withCredentials=this._withCredentials,n.onload=this._onLoad.bind(this),n.onreadystatechange=this._onReadyStatechange.bind(this),n.onerror=function(e){var n,r,i;t._running=!1;var o=new Us(t._url,t._request,null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.response,"xhr.onerror.status:"+(null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.status)+",statusText,"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.statusText));o.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(o)},n.ontimeout=function(e){t.cancel();var n=new Us(t._url,t._request,{status:408},"timeout");t._onTimeout&&(n.isTimeout=!0,t._onTimeout(n,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),n.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(n)};var r=this._headers||{},i=Ks(e);i&&(r.Range=i),r&&Object.keys(r).forEach((function(e){n.setRequestHeader(e,r[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),n.send(this._body)}catch(o){o.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(o)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t,n=e.target.status;if(n<200||n>299){var r=new Us(this._url,null,Xa(Xa({},e.target.response),{},{status:n}),"bad response,status:"+n);return r.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(r)}var i,o=null,a=!1,s=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===Ws){var u,c=new Uint8Array(e.target.response);if(i=s+this._receivedLength,c&&c.byteLength>0){this._receivedLength+=c.byteLength;var l=Date.now()-this._startTime,d=Js(this._receivedLength,l);this.emit(zs.REAL_TIME_SPEED,{speed:d,len:this._receivedLength,time:l,vid:this._vid,index:this._index,range:[i,s+this._receivedLength],priOptions:this._priOptions})}o=c,a=!((null===(u=this._range)||void 0===u?void 0:u.length)>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",i,"end ",s+this._receivedLength,",dataLen,",c?c.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",a)}else a=!0,o=e.target.response;var h={ok:n>=200&&n<300,status:n,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(h=this._transformResponse(h,this._url)||h),this._onProgress&&this._onProgress(o,a,{index:this._index,vid:this._vid,range:[i,s+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},h),a?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(Bs(this._onProgress?null:o,a,h,h.headers["content-length"],h.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,ns(Ba(n.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,n={},r=is(e.getAllResponseHeaders().trim().split("\r\n"));try{for(r.s();!(t=r.n()).done;){var i=t.value.split(": ");n[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(o){r.e(o)}finally{r.f()}return n}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),n}(P),eu=["retry","retryDelay","onRetryError","transformError"],tu=function(){function e(t,n){Fa(this,e),this.promise=as(),this.alive=!!n.onProgress,!n.logger&&(n.logger=new Ls("Loader")),this._loaderType=t,this._loader=t===Vs&&"undefined"!=typeof fetch?new qs:new $s,this._config=n,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=n.retryCheckFunc,this._logger=n.logger}var t;return Ka(e,[{key:"exec",value:function(){var e=this,t=this._config,n=t.retry,r=t.retryDelay,i=t.onRetryError,o=t.transformError,a=$a(t,eu),s=function(){var t=Ua(Wa().mark((function t(){var u,c,l;return Wa().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(a);case 3:u=t.sent,e.promise.resolve(u),t.next=27;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,c=t.t0,o&&(c=o(c)||c),i&&e._retryCount>0&&i(c,e._retryCount,{index:a.index,vid:a.vid,range:a.range,priOptions:a.priOptions}),e._retryCount++,l=!0,e._retryCheckFunc&&(l=e._retryCheckFunc(t.t0)),!(l&&e._retryCount<=n)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",a.range),e._retryTimer=setTimeout(s,r),t.abrupt("return");case 26:e.promise.reject(c);case 27:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return s(),this.promise}},{key:"cancel",value:(t=Ua(Wa().mark((function e(){return Wa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),e}();function nu(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if((t=t.filter(Boolean)).length<2)return t[0];var r=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){r.set(e,i),i+=e.byteLength})),r}function ru(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var iu=function(e){Ha(r,e);var t,n=ts(r);function r(e){var t;return Fa(this,r),ja(es(t=n.call(this,e)),"type",Vs),ja(es(t),"_queue",[]),ja(es(t),"_alive",[]),ja(es(t),"_currentTask",null),ja(es(t),"_finnalUrl",""),ja(es(t),"_config",void 0),t._config=function(e){return Xa({loaderType:Vs,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:Os,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0},e)}(e),t._config.loaderType!==Xs&&qs.isSupported()||(t.type=Xs),t.log=e.logger,t}return Ka(r,[{key:"isFetch",value:function(){return this.type===Vs}},{key:"load",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?n=e:n.url=e||n.url||this._config.url,(n=Object.assign({},this._config,n)).params&&(n.params=Object.assign({},n.params)),n.headers&&Ys(n.headers)&&(n.headers=Object.assign({},n.headers)),n.body&&Ys(n.body)&&(n.body=Object.assign({},n.body)),n.transformRequest&&(n=n.transformRequest(n)||n),n.logger=this.log;var r=new tu(this.type,n);return r.loader.on(zs.REAL_TIME_SPEED,(function(e){t.emit(zs.REAL_TIME_SPEED,e)})),this._queue.push(r),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),r.promise}},{key:"cancel",value:(t=Ua(Wa().mark((function e(){var t;return Wa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,ru();case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,n;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(n=e._alive)||void 0===n?void 0:n.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return qs.isSupported()}}]),r}(P),ou=function(){function e(){Fa(this,e),ja(this,"_prevCurrentTime",0)}return Ka(e,[{key:"do",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(e){var i=e.currentTime,o=0;if(this._prevCurrentTime===i){var a=cs.info(cs.get(e),i);if(!a.buffers.length)return;n&&a.nextStart||a.nextStart&&a.nextStart-i<t?o=a.nextStart+.1:a.end&&a.end-i>r&&!e.seeking&&(o=i+.1)}this._prevCurrentTime=i,o&&i!==o&&(e.currentTime=o)}}}]),e}(),au=function(){function e(t){var n=this;Fa(this,e),ja(this,"_seiSet",new Set),this.emitter=t,t.on(zs.SEI,(function(e){e&&n._seiSet.add(e)}))}return Ka(e,[{key:"throw",value:function(e,t){var n=this;if(null!=e&&this._seiSet.size){var r=e-.2,i=e+.2,o=[];this._seiSet.forEach((function(e){e.time>=r&&e.time<=i&&o.push(e)})),o.forEach((function(e){n._seiSet.delete(e),n.emitter.emit(zs.SEI_IN_TIME,e)})),t&&this._seiSet.forEach((function(t){t.time<e-5&&n._seiSet.delete(t)}))}}},{key:"reset",value:function(){this._seiSet.clear()}}]),e}(),su=function(){function e(){Fa(this,e),ja(this,"_chunkSpeeds",[]),ja(this,"_speeds",[])}return Ka(e,[{key:"addRecord",value:function(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}},{key:"addChunkRecord",value:function(e,t){e&&t&&(this._chunkSpeeds.push(8e3*e/t),this._chunkSpeeds=this._chunkSpeeds.slice(-100))}},{key:"getAvgSpeed",value:function(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds.reduce((function(e,t){return e+t}))/this._speeds.length:this._chunkSpeeds.reduce((function(e,t){return e+t}))/this._chunkSpeeds.length:0}},{key:"getLatestSpeed",value:function(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeeds[this._chunkSpeeds.length-1]:0}},{key:"reset",value:function(){this._chunkSpeeds=[],this._speeds=[]}}]),e}(),uu=function(){function e(t){Fa(this,e),ja(this,"encodeType",""),ja(this,"audioCodec",""),ja(this,"videoCodec",""),ja(this,"domain",""),ja(this,"fps",0),ja(this,"bitrate",0),ja(this,"width",0),ja(this,"height",0),ja(this,"samplerate",0),ja(this,"channelCount",0),ja(this,"gop",0),ja(this,"_bitsAccumulateSize",0),ja(this,"_bitsAccumulateDuration",0),ja(this,"_startGopId",-1),this._timescale=t}return Ka(e,[{key:"getStats",value:function(){return{encodeType:this.encodeType,audioCodec:this.audioCodec,videoCodec:this.videoCodec,domain:this.domain,fps:this.fps,bitrate:this.bitrate,width:this.width,height:this.height,samplerate:this.samplerate,channelCount:this.channelCount,gop:this.gop}}},{key:"setEncodeType",value:function(e){this.encodeType=e}},{key:"setFpsFromScriptData",value:function(e){var t,n=e.data,r=null==n||null===(t=n.onMetaData)||void 0===t?void 0:t.framerate;r&&r>0&&r<100&&(this.fps=r)}},{key:"setVideoMeta",value:function(e){if(this.width=e.width,this.height=e.height,this.videoCodec=e.codec,this.encodeType=e.codecType,e.fpsNum&&e.fpsDen){var t=e.fpsNum/e.fpsDen;t>0&&t<100&&(this.fps=t)}}},{key:"setAudioMeta",value:function(e){this.audioCodec=e.codec,this.samplerate=e.sampleRate,this.channelCount=e.channelCount}},{key:"setDomain",value:function(e){this.domain=e.split("/").slice(2,3)[0]}},{key:"updateBitrate",value:function(e){var t=this;if((!this.fps||this.fps>=100)&&e.length){var n=e.reduce((function(e,t){return e+t.duration}),0)/e.length;this.fps=Math.round(this._timescale/n)}e.forEach((function(e){-1===t._startGopId&&(t._startGopId=e.gopId),e.gopId===t._startGopId&&t.gop++,t._bitsAccumulateDuration+=e.duration/(t._timescale/1e3),t._bitsAccumulateSize+=e.units.reduce((function(e,t){return e+t.length}),0),t._bitsAccumulateDuration>=1e3&&(t.bitrate=8*t._bitsAccumulateSize,t._bitsAccumulateDuration=0,t._bitsAccumulateSize=0)}))}}]),e}(),cu=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;Fa(this,e),ja(this,"_core",null),ja(this,"_samples",[]),this._core=t,this._timescale=n,this._stats=new uu(n),this._bindEvents()}return Ka(e,[{key:"getStats",value:function(){var e,t,n,r,i,o,a,s=(null===(e=this._core)||void 0===e?void 0:e.media)||{},u=s.currentTime,c=void 0===u?0:u,l=s.decodeFps,d=void 0===l?0:l;return Xa(Xa({},this._stats.getStats()),{},{downloadSpeed:(null===(t=this._core)||void 0===t||null===(n=t.speedInfo)||void 0===n?void 0:n.call(t).speed)||0,avgSpeed:(null===(r=this._core)||void 0===r||null===(i=r.speedInfo)||void 0===i?void 0:i.call(r).avgSpeed)||0,currentTime:c,bufferEnd:(null===(o=this._core)||void 0===o||null===(a=o.bufferInfo())||void 0===a?void 0:a.remaining)||0,decodeFps:d})}},{key:"_bindEvents",value:function(){var e=this;this._core.on(zs.DEMUXED_TRACK,(function(t){var n=t.videoTrack;return e._stats.updateBitrate(n.samples)})),this._core.on(zs.FLV_SCRIPT_DATA,(function(t){e._stats.setFpsFromScriptData(t)})),this._core.on(zs.METADATA_PARSED,(function(t){"video"===t.type?e._stats.setVideoMeta(t.track):e._stats.setAudioMeta(t.track)})),this._core.on(zs.TTFB,(function(t){e._stats.setDomain(t.responseUrl)}))}},{key:"reset",value:function(){this._samples=[],this._stats=new uu(this._timescale)}}]),e}();function lu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function du(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,wu(r.key),r)}}function hu(e,t,n){return t&&du(e.prototype,t),n&&du(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function fu(e,t,n){return(t=wu(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pu(e){return(pu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function mu(e,t){return(mu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function yu(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 function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function vu(e){var t=function(){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}}();return function(){var n,r=pu(e);if(t){var i=pu(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return yu(this,n)}}function gu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(l){c=!0,i=l}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||Au(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 bu(e){return function(e){if(Array.isArray(e))return _u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Au(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 Au(e,t){if(e){if("string"==typeof e)return _u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_u(e,t):void 0}}function _u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function wu(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;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 Su="video",ku="audio",Tu="metadata",xu="avc",Eu="hevc",Lu="aac",Iu="g7110a",Ru="g7110m",Zu="LARGE_AV_SHIFT",Cu="LARGE_VIDEO_GAP",Pu="LARGE_VIDEO_GAP_BETWEEN_CHUNK",Gu="LARGE_AUDIO_GAP",Du="AUDIO_FILLED",Mu="AUDIO_DROPPED",Vu=function(){function e(){lu(this,e),fu(this,"id",1),fu(this,"type",Su),fu(this,"codecType",xu),fu(this,"pid",-1),fu(this,"hvcC",void 0),fu(this,"codec",""),fu(this,"timescale",0),fu(this,"formatTimescale",0),fu(this,"sequenceNumber",0),fu(this,"baseMediaDecodeTime",0),fu(this,"baseDts",0),fu(this,"duration",0),fu(this,"warnings",[]),fu(this,"samples",[]),fu(this,"pps",[]),fu(this,"sps",[]),fu(this,"vps",[]),fu(this,"fpsNum",0),fu(this,"fpsDen",0),fu(this,"sarRatio",[]),fu(this,"width",0),fu(this,"height",0),fu(this,"nalUnitSize",4),fu(this,"present",!1),fu(this,"isVideoEncryption",!1),fu(this,"isAudioEncryption",!1),fu(this,"isVideo",!0),fu(this,"kid",null),fu(this,"pssh",null),fu(this,"ext",void 0)}return hu(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:"exist",value:function(){return!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isVideoEncryption}}]),e}(),Xu=function(){function e(){lu(this,e),fu(this,"id",2),fu(this,"type",ku),fu(this,"codecType",Lu),fu(this,"pid",-1),fu(this,"codec",""),fu(this,"sequenceNumber",0),fu(this,"sampleDuration",0),fu(this,"timescale",0),fu(this,"formatTimescale",0),fu(this,"baseMediaDecodeTime",0),fu(this,"duration",0),fu(this,"warnings",[]),fu(this,"samples",[]),fu(this,"baseDts",0),fu(this,"sampleSize",16),fu(this,"sampleRate",0),fu(this,"channelCount",0),fu(this,"objectType",0),fu(this,"sampleRateIndex",0),fu(this,"config",[]),fu(this,"present",!1),fu(this,"isVideoEncryption",!1),fu(this,"isAudioEncryption",!1),fu(this,"kid",null),fu(this,"ext",void 0)}return hu(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.codecType===Lu)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}}]),e}(),Wu=function(){function e(t,n,r){lu(this,e),fu(this,"flag",{}),fu(this,"keyframe",!1),fu(this,"gopId",0),fu(this,"duration",0),fu(this,"size",0),fu(this,"units",[]),fu(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=n,r&&(this.units=r)}return hu(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}(),Ou=hu((function e(t,n,r,i){lu(this,e),fu(this,"duration",1024),fu(this,"flag",{dependsOn:2,isNonSyncSample:0}),fu(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=n,this.size=n.byteLength,this.sampleOffset=i,r&&(this.duration=r)})),Nu=function(e){!function(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&&mu(e,t)}(n,e);var t=vu(n);function n(){return lu(this,n),t.apply(this,arguments)}return hu(n)}(hu((function e(t,n){lu(this,e),fu(this,"time",0),this.data=t,this.originPts=this.pts=n}))),Uu=function(){function e(){lu(this,e),fu(this,"id",3),fu(this,"type",Tu),fu(this,"timescale",0),fu(this,"flvScriptSamples",[]),fu(this,"seiSamples",[])}return hu(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}(),Fu=function(){function e(t){lu(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]")}return hu(e,[{key:"warn",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(r))}}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();fu(Fu,"disabled",!0);var Yu="undefined"!=typeof window,Ku=Yu&&navigator.userAgent.toLocaleLowerCase(),ju=Yu&&/^((?!chrome|android).)*safari/.test(Ku),Hu=Yu&&Ku.includes("firefox"),Bu=Yu&&Ku.includes("android"),Ju=function(){function e(){lu(this,e)}return hu(e,null,[{key:"getRateIndexByRate",value:function(t){return e.FREQ.indexOf(t)}},{key:"parseADTS",value:function(t,n){for(var r=t.length,i=0;i+2<r&&(255!==t[i]||240!=(246&t[i+1]));)i++;if(!(i>=r)){var o=i,a=[],s=(60&t[i+2])>>>2,u=e.FREQ[s];if(!u)throw new Error("Invalid sampling index: ".concat(s));for(var c,l,d=1+((192&t[i+2])>>>6),h=(1&t[i+2])<<2|(192&t[i+3])>>>6,f=e._getConfig(s,h,d),p=f.config,m=f.codec,y=0,v=e.getFrameDuration(u);i+7<r;)if(255===t[i]&&240==(246&t[i+1])){if(r-i<(l=(3&t[i+3])<<11|t[i+4]<<3|(224&t[i+5])>>5))break;c=2*(1&~t[i+1]),a.push({pts:n+y*v,data:t.subarray(i+7+c,i+l)}),y++,i+=l}else i++;return{skip:o,remaining:i>=r?void 0:t.subarray(i),frames:a,samplingFrequencyIndex:s,sampleRate:u,objectType:d,channelCount:h,codec:m,config:p,originCodec:"mp4a.40.".concat(d)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var n=t[0]>>>3,r=(7&t[0])<<1|t[1]>>>7,i=(120&t[1])>>>3,o=e.FREQ[r];if(o){var a=e._getConfig(r,i,n);return{samplingFrequencyIndex:r,sampleRate:o,objectType:n,channelCount:i,config:a.config,codec:a.codec,originCodec:"mp4a.40.".concat(n)}}}}},{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,n){var r,i,o=[];return Hu?e>=6?(r=5,i=e-3):(r=2,i=e):Bu?(r=2,i=e):(r=2===n||5===n?n:5,i=e,e>=6?i=e-3:1===t&&(r=2,i=e)),o[0]=r<<3,o[0]|=(14&e)>>1,o[1]=(1&e)<<7,o[1]|=t<<3,5===r&&(o[1]|=(14&i)>>1,o[2]=(1&i)<<7,o[2]|=8,o[3]=0),{config:o,codec:"mp4a.40.".concat(r)}}},{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}();function zu(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t=t.filter(Boolean);var r=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){r.set(e,i),i+=e.byteLength})),r}fu(Ju,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var Qu=Math.pow(2,32);function qu(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function $u(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 ec(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return $u(e,t)*Qu+$u(e,t+4)}function tc(e){for(var t,n="avc1.",r=0;r<3;r++)(t=e[r].toString(16)).length<2&&(t="0".concat(t)),n+=t;return n}function nc(e){if(!Array.isArray(e)){for(var t=[],n="",r=0;r<e.length;r++)r%2&&(n=e[r-1]+e[r],t.push(parseInt(n,16)),n="");return t}return e.map((function(e){return parseInt(e,16)}))}var rc=function(){function e(){lu(this,e)}return hu(e,null,[{key:"parseAnnexB",value:function(e){for(var t=e.length,n=2,r=0;null!==e[n]&&void 0!==e[n]&&1!==e[n];)n++;if((r=++n+2)>=t)return[];for(var i=[];r<t;)switch(e[r]){case 0:if(0!==e[r-1]){r+=2;break}if(0!==e[r-2]){r++;break}n!==r-2&&i.push(e.subarray(n,r-2));do{r++}while(1!==e[r]&&r<t);r=(n=r+1)+2;break;case 1:if(0!==e[r-1]||0!==e[r-2]){r+=3;break}n!==r-2&&i.push(e.subarray(n,r-2)),r=(n=r+1)+2;break;default:r+=3}return n<t&&i.push(e.subarray(n)),i}},{key:"parseAvcC",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(!(e.length<4)){for(var n,r=e.length,i=[],o=0;o+t<r;)if(n=$u(e,o),3===t&&(n>>>=8),o+=t,n){if(o+n>r)break;i.push(e.subarray(o,o+n)),o+=n}return i}}},{key:"parseSEI",value:function(e,t){for(var n=e.length,r=t?2:1,i=0,o=0,a="";255===e[r];)i+=255,r++;for(i+=e[r++];255===e[r];)o+=255,r++;if(o+=e[r++],5===i&&n>r+16)for(var s=0;s<16;s++)a+=e[r].toString(16),r++;return{payload:e.subarray(r,r+o),type:i,size:o,uuid:a}}},{key:"removeEPB",value:function(e){for(var t=e.byteLength,n=[],r=1;r<t-2;)0===e[r]&&0===e[r+1]&&3===e[r+2]?(n.push(r+2),r+=2):r++;if(!n.length)return e;var i=t-n.length,o=new Uint8Array(i),a=0;for(r=0;r<i;a++,r++)a===n[0]&&(a++,n.shift()),o[r]=e[a];return o}}]),e}(),ic=function(){function e(t){if(lu(this,e),fu(this,"_bytesAvailable",void 0),fu(this,"_bitsAvailable",0),fu(this,"_word",0),!t)throw new Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}return hu(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 n=new Uint8Array(4);n.set(this._data.subarray(e,e+t)),this._word=new DataView(n.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),n=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?n<<t|this.readBits(t):n}},{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,n=8,r=0;r<e;r++)0!==n&&(n=(t+this.readEG()+256)%256),t=0===n?t:n}}]),e}(),oc=function(){function e(){lu(this,e)}return hu(e,null,[{key:"parseAVCDecoderConfigurationRecord",value:function(t){if(!(t.length<7)){for(var n,r,i=1+(3&t[4]),o=[],a=[],s=6,u=31&t[5],c=0;c<u;c++)if(r=t[s]<<8|t[s+1],s+=2,r){var l=t.subarray(s,s+r);s+=r,o.push(l),n||(n=e.parseSPS(rc.removeEPB(l)))}var d,h=t[s];s++;for(var f=0;f<h;f++)d=t[s]<<8|t[s+1],s+=2,d&&(a.push(t.subarray(s,s+d)),s+=d);return{sps:n,spsArr:o,ppsArr:a,nalUnitSize:i}}}},{key:"parseSPS",value:function(e){var t=new ic(e);t.readUByte();var n=t.readUByte(),r=t.readUByte(),i=t.readUByte();t.skipUEG();var o=420;if(100===n||110===n||122===n||244===n||44===n||83===n||86===n||118===n||128===n||138===n||144===n){var a=t.readUEG();if(a<=3&&(o=[0,420,422,444][a]),3===a&&t.skipBits(1),t.skipUEG(),t.skipUEG(),t.skipBits(1),t.readBool())for(var s=3!==a?8:12,u=0;u<s;u++)t.readBool()&&(u<6?t.skipScalingList(16):t.skipScalingList(64))}t.skipUEG();var c=t.readUEG();if(0===c)t.readUEG();else if(1===c){t.skipBits(1),t.skipUEG(),t.skipUEG();for(var l=t.readUEG(),d=0;d<l;d++)t.skipUEG()}t.skipUEG(),t.skipBits(1);var h=t.readUEG(),f=t.readUEG(),p=t.readBits(1);0===p&&t.skipBits(1),t.skipBits(1);var m,y,v,g,b,A=0,_=0,w=0,S=0;if(t.readBool()&&(A=t.readUEG(),_=t.readUEG(),w=t.readUEG(),S=t.readUEG()),t.readBool()){if(t.readBool())switch(t.readUByte()){case 1:m=[1,1];break;case 2:m=[12,11];break;case 3:m=[10,11];break;case 4:m=[16,11];break;case 5:m=[40,33];break;case 6:m=[24,11];break;case 7:m=[20,11];break;case 8:m=[32,11];break;case 9:m=[80,33];break;case 10:m=[18,11];break;case 11:m=[15,11];break;case 12:m=[64,33];break;case 13:m=[160,99];break;case 14:m=[4,3];break;case 15:m=[3,2];break;case 16:m=[2,1];break;case 255:m=[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 k=t.readBits(32),T=t.readBits(32);y=t.readBool(),b=(v=T)/(g=2*k)}}return{codec:tc(e.subarray(1,4)),profileIdc:n,profileCompatibility:r,levelIdc:i,chromaFormat:o,width:Math.ceil(16*(h+1)-2*(A+_)),height:(2-p)*(f+1)*16-(p?2:4)*(w+S),sarRatio:m,fpsNum:v,fpsDen:g,fps:b,fixedFrame:y}}}]),e}(),ac=function(){function e(){lu(this,e)}return hu(e,null,[{key:"parseHEVCDecoderConfigurationRecord",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(t.length<23)){n=n||{};for(var r,i,o,a,s,u=1+(3&t[21]),c=[],l=[],d=[],h=23,f=t[22],p=0;p<f;p++){o=63&t[h],a=t[h+1]<<8|t[h+2],h+=3;for(var m=0;m<a;m++)if(s=t[h]<<8|t[h+1],h+=2,s){switch(o){case 32:var y=t.subarray(h,h+s);r||(r=e.parseVPS(rc.removeEPB(y),n)),d.push(y);break;case 33:var v=t.subarray(h,h+s);i||(i=e.parseSPS(rc.removeEPB(v),n)),c.push(v);break;case 34:l.push(t.subarray(h,h+s))}h+=s}}return{hvcC:n,sps:i,spsArr:c,ppsArr:l,vpsArr:d,nalUnitSize:u}}}},{key:"parseVPS",value:function(t,n){n=n||{};var r=new ic(t);r.readUByte(),r.readUByte(),r.readBits(12);var i=r.readBits(3);return n.numTemporalLayers=Math.max(n.numTemporalLayers||0,i+1),r.readBits(17),e._parseProfileTierLevel(r,i,n),n}},{key:"parseSPS",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n=n||{};var r=new ic(t);r.readUByte(),r.readUByte(),r.readBits(4);var i=r.readBits(3);n.numTemporalLayers=Math.max(i+1,n.numTemporalLayers||0),n.temporalIdNested=r.readBits(1),e._parseProfileTierLevel(r,i,n),r.readUEG();var o=n.chromaFormatIdc=r.readUEG(),a=420;o<=3&&(a=[0,420,422,444][o]);var s=0;3===o&&(s=r.readBits(1));var u,c,l,d,h=r.readUEG(),f=r.readUEG(),p=r.readBits(1);(1===p&&(u=r.readUEG(),c=r.readUEG(),l=r.readUEG(),d=r.readUEG()),n.bitDepthLumaMinus8=r.readUEG(),n.bitDepthChromaMinus8=r.readUEG(),1===p)&&(h-=(1!==o&&2!==o||0!==s?1:2)*(c+u),f-=(1===o&&0===s?2:1)*(d+l));return{codec:"hev1.1.6.L93.B0",width:h,height:f,chromaFormat:a,hvcC:n}}},{key:"_parseProfileTierLevel",value:function(e,t,n){var r=n.generalTierFlag||0;n.generalProfileSpace=e.readBits(2),n.generalTierFlag=Math.max(e.readBits(1),r),n.generalProfileIdc=Math.max(e.readBits(5),n.generalProfileIdc||0),n.generalProfileCompatibilityFlags=e.readBits(32),n.generalConstraintIndicatorFlags=[e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8)];var i=e.readBits(8);r<n.generalTierFlag?n.generalLevelIdc=i:n.generalLevelIdc=Math.max(i,n.generalLevelIdc||0);var o=[],a=[];if(t>e.bitsAvailable)throw new Error("maxSubLayersMinus inavlid size ".concat(t));for(var s=0;s<t;s++)o[s]=e.readBits(1),a[s]=e.readBits(1);t>0&&e.readBits(2*(8-t));for(var u=0;u<t;u++)0!==o[u]&&(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!==a[u]&&e.readBits(8)}}]),e}(),sc=9e4,uc=45e4,cc=9e4,lc=function(){function e(t,n,r){lu(this,e),this.videoTrack=t,this.audioTrack=n,this.metadataTrack=r,this._baseDts=-1,this._baseDtsInited=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0}return hu(e,[{key:"fix",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t=Math.round(9e4*t);var i=this.videoTrack,o=this.audioTrack,a=i.samples,s=o.samples;if(a.length||s.length){var u=a[0],c=s[0],l=0;if(a.length&&s.length&&(l=u.dts-c.pts),this._baseDtsInited||this._calculateBaseDts(this.audioTrack,this.videoTrack),n&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=t),!r){this._videoNextDts=l>0?t+l:t,this._audioNextPts=l>0?t:t-l;var d=u?u.dts-this._baseDts-this._videoNextDts:0,h=c?c.pts-this._baseDts-this._audioNextPts:0;Math.abs(d||h)>cc&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=t)}if(this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(o),this._fixVideo(i),this.metadataTrack.exist()){var f=this.metadataTrack.timescale;this.metadataTrack.seiSamples.forEach((function(t){t.pts=t.originPts-e._baseDts,t.time=Math.max(0,t.pts)/f}))}i.samples.length&&(i.baseMediaDecodeTime=i.samples[0].dts),o.samples.length&&(o.baseMediaDecodeTime=o.samples[0].pts*o.timescale/9e4)}}},{key:"_fixVideo",value:function(e){var t=this,n=e.samples;if(n.length){if(n.forEach((function(e){e.dts-=t._baseDts,e.pts-=t._baseDts})),void 0===this._videoNextDts){var r=n[0];this._videoNextDts=r.dts}var i,o,a=n.length,s=0,u=n[0],c=n[1],l=this._videoNextDts-u.dts;if(Math.abs(l)>45e3)if(e.warnings.push({type:Pu,nextDts:this._videoNextDts/90,firstSampleDts:u.dts/90,nextSampleDts:((null===(i=n[1])||void 0===i?void 0:i.dts)||0)/90,sampleDuration:l/90}),u.dts+=l,u.pts+=l,c&&Math.abs(c.dts-u.dts)>cc)this._videoTimestampBreak=!0,n.forEach((function(e,t){0!==t&&(e.dts+=l,e.pts+=l)}));else for(var d=1;d<a-1;d++){var h,f=null===(h=n[d])||void 0===h?void 0:h.dts,p=n[d-1].dts;f&&f-p<0&&(n[d].dts+=l,n[d].pts+=l)}if(e.fpsNum&&e.fpsDen)o=e.timescale*(e.fpsDen/e.fpsNum);else{var m=e.samples[0],y=e.samples[1];o=1===a?9e3:Math.floor(y.dts-m.dts)}for(var v=0;v<a;v++){var g=n[v].dts,b=n[v+1];if((s=v<a-1?b.dts-g:n[v-1]?Math.min(g-n[v-1].dts,o):o)>cc||s<0){this._videoTimestampBreak=!0,s=this._audioTimestampBreak?o:Math.max(s,2700);var A=this._audioNextPts||0;b&&b.dts>A&&(s=o),e.warnings.push({type:Cu,time:g/e.timescale,dts:g,originDts:n[v].originDts,nextDts:this._videoNextDts,sampleDuration:s,refSampleDuration:o})}n[v].duration=s,this._videoNextDts+=s}}}},{key:"_fixAudio",value:function(e){var t=this,n=e.samples;n.length&&(n.forEach((function(e){e.pts-=t._baseDts,e.dts=e.pts})),this._doFixAudioInternal(e,n,9e4))}},{key:"_calculateBaseDts",value:function(e,t){var n=e.samples,r=t.samples;if(!n.length&&!r.length)return!1;var i=1/0,o=1/0;n.length&&(e.baseDts=i=n[0].pts),r.length&&(t.baseDts=o=r[0].dts),this._baseDts=Math.min(i,o);var a=o-i;return Number.isFinite(a)&&Math.abs(a)>45e3&&t.warnings.push({type:Zu,videoBaseDts:o,audioBasePts:i,baseDts:this._baseDts,delta:a}),this._baseDtsInited=!0,!0}},{key:"_resetBaseDtsWhenStreamBreaked",value:function(){if(this._baseDtsInited&&this._videoTimestampBreak&&this._audioTimestampBreak){if(!this._calculateBaseDts(this.audioTrack,this.videoTrack))return;this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts),this._audioLastSample=null,this._videoLastSample=null,this._videoTimestampBreak=!1,this._audioTimestampBreak=!1}}},{key:"_doFixAudioInternal",value:function(e,t,n){e.sampleDuration||(e.sampleDuration=Ju.getFrameDuration(e.timescale,n));var r=e.sampleDuration;if(void 0===this._audioNextPts){var i=t[0];this._audioNextPts=i.pts}for(var o=0;o<t.length;o++){var a=this._audioNextPts,s=t[o],u=s.pts-a;if(!this._audioTimestampBreak&&u>=3*r&&u<=sc&&!ju){var c=Ju.getSilentFrame(e.codec,e.channelCount)||t[0].data.subarray(),l=Math.floor(u/r);Math.abs(s.pts-this._lastAudioExceptionGapDot)>uc&&(this._lastAudioExceptionGapDot=s.pts),e.warnings.push({type:Du,pts:s.pts,originPts:s.originPts,count:l,nextPts:a,refSampleDuration:r});for(var d=0;d<l;d++){var h=new Ou(Math.floor(a),c);h.originPts=Math.floor(this._baseDts+a),t.splice(o,0,h),this._audioNextPts+=r,o++}o--}else u<=-3*r&&u>=-9e4?(Math.abs(s.pts-this._lastAudioExceptionOverlapDot)>uc&&(this._lastAudioExceptionOverlapDot=s.pts,e.warnings.push({type:Mu,pts:s.pts,originPts:s.originPts,nextPts:a,refSampleDuration:r})),t.splice(o,1),o--):(Math.abs(u)>=sc&&(this._audioTimestampBreak=!0,Math.abs(s.pts-this._lastAudioExceptionLargeGapDot)>uc&&(this._lastAudioExceptionLargeGapDot=s.pts,e.warnings.push({type:Gu,time:s.pts/1e3,pts:s.pts,originPts:s.originPts,nextPts:a,sampleDuration:u,refSampleDuration:r}))),s.dts=s.pts=a,this._audioNextPts+=r)}}}]),e}(),dc=new Fu("TsDemuxer"),hc=function(){function e(t,n,r){lu(this,e),fu(this,"_pmtId",-1),fu(this,"_remainingPacketData",null),fu(this,"_videoPesData",[]),fu(this,"_audioPesData",[]),fu(this,"_gopId",0),this.videoTrack=t||new Vu,this.audioTrack=n||new Xu,this.metadataTrack=r||new Uu,this._fixer=new lc(this.videoTrack,this.audioTrack,this.metadataTrack)}return hu(e,[{key:"demux",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=this.audioTrack,i=this.videoTrack,o=this.metadataTrack;t&&(this._pmtId=-1,i.reset(),r.reset(),o.reset()),!n||t?(this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[]):(i.samples=[],r.samples=[],o.seiSamples=[],i.warnings=[],r.warnings=[],this._remainingPacketData&&(e=zu(this._remainingPacketData,e),this._remainingPacketData=null));var a=e.length,s=a%188;s&&(this._remainingPacketData=e.subarray(a-s),a-=s);for(var u=i.pid,c=r.pid,l=0;l<a;l+=188){if(71!==e[l])throw new Error("TS packet did not start with 0x47");var d=!!(64&e[l+1]),h=((31&e[l+1])<<8)+e[l+2],f=void 0;if((48&e[l+3])>>4>1){if((f=l+5+e[l+4])===l+188)continue}else f=l+4;switch(h){case 0:d&&(f+=e[f]+1),this._pmtId=(31&e[f+10])<<8|e[f+11];break;case this._pmtId:d&&(f+=e[f]+1);var p=f+3+((15&e[f+1])<<8|e[f+2])-4;for(f+=12+((15&e[f+10])<<8|e[f+11]);f<p;){var m=(31&e[f+1])<<8|e[f+2];switch(e[f]){case 15:r.pid=c=m;break;case 27:if(-1!==u)break;i.codecType=xu,i.pid=u=m;break;case 36:if(-1!==u)break;i.codecType=Eu,i.pid=u=m;break;default:dc.warn("Unsupported stream. type: ".concat(e[f],", pid: ").concat(m))}f+=5+((15&e[f+3])<<8|e[f+4])}break;case u:d&&this._videoPesData.length&&this._parseVideoData(),this._videoPesData.push(e.subarray(f,l+188));break;case c:d&&this._audioPesData.length&&this._parseAudioData(),this._audioPesData.push(e.subarray(f,l+188));break;case 17:case 8191:break;default:dc.warn("Unknown pid: ".concat(h))}}return this._parseVideoData(),this._parseAudioData(),r.formatTimescale=i.formatTimescale=i.timescale=o.timescale=9e4,r.timescale=r.sampleRate||0,{videoTrack:i,audioTrack:r,metadataTrack:o}}},{key:"fix",value:function(e,t,n){return this._fixer.fix(e,t,n),{videoTrack:this.videoTrack,audioTrack:this.audioTrack,metadataTrack:this.metadataTrack}}},{key:"demuxAndFix",value:function(e,t,n,r){return this.demux(e,t,n),this.fix(r,t,n)}},{key:"_parseVideoData",value:function(){if(this._videoPesData.length){var t=e._parsePES(zu.apply(void 0,bu(this._videoPesData)));if(t){var n=rc.parseAnnexB(t.data);n?this._createVideoSample(n,t.pts,t.dts):dc.warn("Cannot parse avc units",t),this._videoPesData=[]}else dc.warn("Cannot parse video pes",this._videoPesData)}}},{key:"_createVideoSample",value:function(e,t,n){var r=this;if(e.length){var i=this.videoTrack,o=i.codecType===Eu,a=new Wu(t,n);e.forEach((function(e){var n=o?e[0]>>>1&63:31&e[0];switch(n){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!o&&5!==n||o&&5===n)break;a.setToKeyframe(),r._gopId++;break;case 6:case 39:case 40:if(!o&&6!==n||o&&6===n)break;return void r.metadataTrack.seiSamples.push(new Nu(rc.parseSEI(rc.removeEPB(e),o),t));case 32:if(!o)break;if(!i.vps.length){var s=ac.parseVPS(rc.removeEPB(e),i.hvcC);i.hvcC=i.hvcC||s,i.vps=[e]}break;case 7:case 33:if(!o&&7!==n||o&&7===n)break;if(!i.sps.length){var u=rc.removeEPB(e),c=o?ac.parseSPS(u,i.hvcC):oc.parseSPS(u);i.sps=[e],i.hvcC=i.hvcC||c.hvcC,i.codec=c.codec,i.width=c.width,i.height=c.height,i.sarRatio=c.sarRatio,i.fpsNum=c.fpsNum,i.fpsDen=c.fpsDen}break;case 8:case 34:if(!o&&8!==n||o&&8===n)break;i.pps.length||(i.pps=[e])}a.units.push(e)})),a.gopId=this._gopId,this._pushVideoSample(i,a)}}},{key:"_pushVideoSample",value:function(e,t){if(t.units.length)if(null===t.pts||void 0===t.pts){dc.warn("Video sample no pts",t);var n=e.samples[e.samples.length-1];n?(t.pts=n.pts,t.dts=n.dts):dc.warn("Drop video sample",t)}else e.samples.push(t)}},{key:"_parseAudioData",value:function(){if(this._audioPesData.length){var t=e._parsePES(zu.apply(void 0,bu(this._audioPesData)));t?(this._parseAacData(t),this._audioPesData=[]):dc.warn("Cannot parse audio pes",this._audioPesData)}}},{key:"_parseAacData",value:function(e){var t=this.audioTrack,n=e.pts;if(null==n){if(dc.warn("AAC pes not pts",t),!t.samples.length||!t.sampleRate)return;n=t.samples[t.samples.length-1].pts+Ju.getFrameDuration(t.sampleRate)}var r,i=Ju.parseADTS(e.data,n);i?(t.codec=i.codec,t.channelCount=i.channelCount,t.sampleRate=i.sampleRate,t.objectType=i.objectType,t.sampleRateIndex=i.samplingFrequencyIndex,t.config=i.config,(r=t.samples).push.apply(r,bu(i.frames.map((function(e){return new Ou(e.pts,e.data)})))),i.skip&&dc.warn("Skip aac adts ".concat(i.skip," bits")),i.remaining&&dc.warn("Remaining aac adts ".concat(i.remaining," bits"))):dc.warn("Cannot parse aac adts",e)}}],[{key:"probe",value:function(e){return!!e.length&&(71===e[0]&&71===e[188]&&71===e[376])}},{key:"_parsePES",value:function(e){var t=e[8];if(!(null==t||e.length<t+9)&&1===(e[0]<<16|e[1]<<8|e[2])){var n=(e[4]<<8)+e[5];if(!(n&&n>e.length-6)){var r,i,o=e[7];return 192&o&&(r=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&o?r-(i=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2)>54e5&&(r=i):i=r),{data:e.subarray(9+t),pts:r,dts:i}}}}}]),e}(),fc=function(){function e(){lu(this,e)}return hu(e,null,[{key:"findBox",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[];if(!t)return i;for(var o=0,a="",s=0;t.length>7;){if(o=$u(t),a=String.fromCharCode.apply(null,t.subarray(4,8)),s=8,1===o?(o=ec(t,8),s+=8):o||(o=t.length),!n[0]||a===n[0]){var u=t.subarray(0,o);if(!(n.length<2))return e.findBox(u.subarray(s),n.slice(1),r+s);i.push({start:r,size:o,headerSize:s,type:a,data:u})}r+=o,t=t.subarray(o)}return i}},{key:"tfhd",value:function(e){return vc(e,!0,(function(e,t){e.trackId=$u(t);var n=4,r=1&e.flags,i=2&e.flags,o=8&e.flags,a=16&e.flags,s=32&e.flags;r&&(n+=4,e.baseDataOffset=$u(t,n),n+=4),i&&(e.sampleDescriptionIndex=$u(t,n),n+=4),o&&(e.defaultSampleDuration=$u(t,n),n+=4),a&&(e.defaultSampleSize=$u(t,n),n+=4),s&&(e.defaultSampleFlags=$u(t,n))}))}},{key:"sidx",value:function(e){return vc(e,!0,(function(e,t){var n=0;e.reference_ID=$u(t,n),n+=4,e.timescale=$u(t,n),n+=4,0===e.version?(e.earliest_presentation_time=$u(t,n),n+=4,e.first_offset=$u(t,n),n+=4):(e.earliest_presentation_time=ec(t,n),n+=8,e.first_offset=ec(t,n),n+=8),n+=2,e.references=[];var r=qu(t,n);n+=2;for(var i=0;i<r;i++){var o={};e.references.push(o);var a=$u(t,n);n+=4,o.reference_type=a>>31&1,o.referenced_size=2147483647&a,o.subsegment_duration=$u(t,n),a=$u(t,n+=4),n+=4,o.starts_with_SAP=a>>31&1,o.SAP_type=a>>28&7,o.SAP_delta_time=268435455&a}}))}},{key:"moov",value:function(t){return vc(t,!1,(function(t,n,r){t.mvhd=e.mvhd(e.findBox(n,["mvhd"],r)[0]),t.trak=e.findBox(n,["trak"],r).map((function(t){return e.trak(t)})),t.pssh=e.pssh(e.findBox(n,["pssh"],r)[0])}))}},{key:"mvhd",value:function(e){return vc(e,!0,(function(e,t){var n=0;1===e.version?(e.timescale=$u(t,16),e.duration=ec(t,20),n+=28):(e.timescale=$u(t,8),e.duration=$u(t,12),n+=16),e.nextTrackId=$u(t,n+76)}))}},{key:"trak",value:function(t){return vc(t,!1,(function(t,n,r){t.tkhd=e.tkhd(e.findBox(n,["tkhd"],r)[0]),t.mdia=e.mdia(e.findBox(n,["mdia"],r)[0])}))}},{key:"tkhd",value:function(e){return vc(e,!0,(function(e,t){var n=0;1===e.version?(e.trackId=$u(t,16),e.duration=ec(t,24),n+=32):(e.trackId=$u(t,8),e.duration=$u(t,16),n+=20),e.width=$u(t,n+52),e.height=$u(t,n+56)}))}},{key:"mdia",value:function(t){return vc(t,!1,(function(t,n,r){t.mdhd=e.mdhd(e.findBox(n,["mdhd"],r)[0]),t.hdlr=e.hdlr(e.findBox(n,["hdlr"],r)[0]),t.minf=e.minf(e.findBox(n,["minf"],r)[0])}))}},{key:"mdhd",value:function(e){return vc(e,!0,(function(e,t){var n=0;1===e.version?(e.timescale=$u(t,16),e.duration=ec(t,20),n+=28):(e.timescale=$u(t,8),e.duration=$u(t,12),n+=16);var r=qu(t,n);e.language=String.fromCharCode(96+(r>>10&31),96+(r>>5&31),96+(31&r))}))}},{key:"hdlr",value:function(e){return vc(e,!0,(function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}},{key:"minf",value:function(t){return vc(t,!1,(function(t,n,r){t.vmhd=e.vmhd(e.findBox(n,["vmhd"],r)[0]),t.smhd=e.smhd(e.findBox(n,["smhd"],r)[0]),t.stbl=e.stbl(e.findBox(n,["stbl"],r)[0])}))}},{key:"vmhd",value:function(e){return vc(e,!0,(function(e,t){e.graphicsmode=qu(t),e.opcolor=[qu(t,2),qu(t,4),qu(t,6)]}))}},{key:"smhd",value:function(e){return vc(e,!0,(function(e,t){e.balance=qu(t)}))}},{key:"stbl",value:function(t){return vc(t,!1,(function(t,n,r){var i,o,a;t.stsd=e.stsd(e.findBox(n,["stsd"],r)[0]),t.stts=e.stts(e.findBox(n,["stts"],r)[0]),t.ctts=e.ctts(e.findBox(n,["ctts"],r)[0]),t.stsc=e.stsc(e.findBox(n,["stsc"],r)[0]),t.stsz=e.stsz(e.findBox(n,["stsz"],r)[0]),t.stco=e.stco(e.findBox(n,["stco"],r)[0]),t.stco||(t.co64=e.co64(e.findBox(n,["co64"],r)[0]),t.stco=t.co64);var s=null===(i=t.stsd.entries[0])||void 0===i||null===(o=i.sinf)||void 0===o||null===(a=o.schi)||void 0===a?void 0:a.tenc.default_IV_size;t.stss=e.stss(e.findBox(n,["stss"],r)[0]),t.senc=e.senc(e.findBox(n,["senc"],r)[0],s)}))}},{key:"senc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return vc(e,!0,(function(e,n){var r=0,i=$u(n,r);r+=4,e.samples=[];for(var o=0;o<i;o++){for(var a={InitializationVector:[]},s=0;s<t;s++)a.InitializationVector[s]=n[r+s];if(r+=t,2&e.flags){a.subsamples=[];var u=qu(n,r);r+=2;for(var c=0;c<u;c++){var l={};l.BytesOfClearData=qu(n,r),r+=2,l.BytesOfProtectedData=$u(n,r),r+=4,a.subsamples.push(l)}}e.samples.push(a)}}))}},{key:"pssh",value:function(e){return vc(e,!0,(function(e,t){for(var n=[],r=[],i=0,o=0;o<16;o++)r.push(gc(t[i+o]));if(i+=16,e.version>0){var a=$u(t,i);i+=4;for(var s=0;s<(""+a).length;s++)for(var u=0;u<16;u++){var c=t[i];i+=1,n.push(gc(c))}}var l=$u(t,i);e.data_size=l,i+=4,e.kid=n,e.system_id=r,e.buffer=t}))}},{key:"stsd",value:function(t){return vc(t,!0,(function(t,n,r){t.entryCount=$u(n),t.entries=e.findBox(n.subarray(4),[],r+4).map((function(t){switch(t.type){case"avc1":case"avc2":case"avc3":case"avc4":return e.avc1(t);case"hvc1":case"hev1":return e.hvc1(t);case"mp4a":return e.mp4a(t);case"alaw":case"ulaw":return e.alaw(t);case"enca":return vc(t,!1,(function(t,n,r){t.channelCount=qu(n,16),t.samplesize=qu(n,18),t.sampleRate=$u(n,24)/65536,n=n.subarray(28),t.sinf=e.sinf(e.findBox(n,["sinf"],r)[0]),t.esds=e.esds(e.findBox(n,["esds"],r)[0])}));case"encv":return vc(t,!1,(function(t,n,r){t.width=qu(n,24),t.height=qu(n,26),t.horizresolution=$u(n,28),t.vertresolution=$u(n,32),n=n.subarray(78),t.sinf=e.sinf(e.findBox(n,["sinf"],r)[0]),t.avcC=e.avcC(e.findBox(n,["avcC"],r)[0]),t.hvcC=e.hvcC(e.findBox(n,["hvcC"],r)[0]),t.pasp=e.pasp(e.findBox(n,["pasp"],r)[0])}))}})).filter(Boolean)}))}},{key:"tenc",value:function(e){return vc(e,!1,(function(e,t){var n=6;e.default_IsEncrypted=t[n],n+=1,e.default_IV_size=t[n],n+=1,e.default_KID=[];for(var r=0;r<16;r++)e.default_KID.push(gc(t[n])),n+=1}))}},{key:"schi",value:function(t){return vc(t,!1,(function(t,n,r){t.tenc=e.tenc(e.findBox(n,["tenc"],r)[0])}))}},{key:"sinf",value:function(t){return vc(t,!1,(function(t,n,r){t.schi=e.schi(e.findBox(n,["schi"],r)[0]),t.frma=e.frma(e.findBox(n,["frma"],r)[0])}))}},{key:"frma",value:function(e){return vc(e,!1,(function(e,t){e.data_format="";for(var n=0;n<4;n++)e.data_format+=String.fromCharCode(t[n])}))}},{key:"avc1",value:function(t){return vc(t,!1,(function(t,n,r){var i=mc(t,n),o=n.subarray(i);r+=i,t.avcC=e.avcC(e.findBox(o,["avcC"],r)[0]),t.pasp=e.pasp(e.findBox(o,["pasp"],r)[0])}))}},{key:"avcC",value:function(e){return vc(e,!1,(function(e,t){e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=tc([t[1],t[2],t[3]]),e.lengthSizeMinusOne=3&t[4],e.spsLength=31&t[5],e.sps=[];for(var n=6,r=0;r<e.spsLength;r++){var i=qu(t,n);n+=2,e.sps.push(t.subarray(n,n+i)),n+=i}e.ppsLength=t[n],n+=1,e.pps=[];for(var o=0;o<e.ppsLength;o++){var a=qu(t,n);n+=2,e.pps.push(t.subarray(n,n+=a)),n+=a}}))}},{key:"hvc1",value:function(t){return vc(t,!1,(function(t,n,r){var i=mc(t,n),o=n.subarray(i);r+=i,t.hvcC=e.hvcC(e.findBox(o,["hvcC"],r)[0]),t.pasp=e.pasp(e.findBox(o,["pasp"],r)[0])}))}},{key:"hvcC",value:function(e){return vc(e,!1,(function(t,n){t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=n[0];var r=n[1];t.generalProfileSpace=r>>6,t.generalTierFlag=(32&r)>>5,t.generalProfileIdc=31&r,t.generalProfileCompatibility=$u(n,2),t.generalConstraintIndicatorFlags=n.subarray(6,12),t.generalLevelIdc=n[12],t.avgFrameRate=qu(n,19),t.numOfArrays=n[22],t.vps=[],t.sps=[],t.pps=[];for(var i=23,o=0,a=0,s=0,u=0;u<t.numOfArrays;u++){o=63&n[i],a=qu(n,i+1),i+=3;for(var c,l=[],d=0;d<a;d++)s=qu(n,i),i+=2,l.push(n.subarray(i,i+s)),i+=s;if(32===o)(c=t.vps).push.apply(c,l);else if(33===o){var h;(h=t.sps).push.apply(h,l)}else if(34===o){var f;(f=t.pps).push.apply(f,l)}}}))}},{key:"pasp",value:function(e){return vc(e,!1,(function(e,t){e.hSpacing=$u(t),e.vSpacing=$u(t,4)}))}},{key:"mp4a",value:function(t){return vc(t,!1,(function(t,n,r){var i=yc(t,n);t.esds=e.esds(e.findBox(n.subarray(i),["esds"],r+i)[0])}))}},{key:"esds",value:function(e){return vc(e,!0,(function(e,t){e.codec="mp4a.";for(var n=0,r=0,i=0,o=0;t.length;){for(o=t[n=0],r=t[n+1],n+=2;128&r;)i=(127&r)<<7,r=t[n],n+=1;if(i+=127&r,3===o)t=t.subarray(n+3);else{if(4!==o){if(5===o){var a=e.config=t.subarray(n,n+i),s=(248&a[0])>>3;return 31===s&&a.length>=2&&(s=32+((7&a[0])<<3)+((224&a[1])>>5)),e.objectType=s,e.codec+=s.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[n].toString(16)+".").padStart(3,"0"),t=t.subarray(n+13)}}}))}},{key:"alaw",value:function(e){return vc(e,!1,(function(e,t){yc(e,t)}))}},{key:"stts",value:function(e){return vc(e,!0,(function(e,t){for(var n=$u(t),r=[],i=4,o=0;o<n;o++)r.push({count:$u(t,i),delta:$u(t,i+4)}),i+=8;e.entryCount=n,e.entries=r}))}},{key:"ctts",value:function(e){return vc(e,!0,(function(e,t){var n=$u(t),r=[],i=4;if(1===e.version)for(var o=0;o<n;o++)r.push({count:$u(t,i),offset:$u(t,i+4)}),i+=8;else for(var a=0;a<n;a++)r.push({count:$u(t,i),offset:-(1+~$u(t,i+4))}),i+=8;e.entryCount=n,e.entries=r}))}},{key:"stsc",value:function(e){return vc(e,!0,(function(e,t){for(var n=$u(t),r=[],i=4,o=0;o<n;o++)r.push({firstChunk:$u(t,i),samplesPerChunk:$u(t,i+4),sampleDescriptionIndex:$u(t,i+8)}),i+=12;e.entryCount=n,e.entries=r}))}},{key:"stsz",value:function(e){return vc(e,!0,(function(e,t){var n=$u(t),r=$u(t,4),i=[];if(!n)for(var o=8,a=0;a<r;a++)i.push($u(t,o)),o+=4;e.sampleSize=n,e.sampleCount=r,e.entrySizes=i}))}},{key:"stco",value:function(e){return vc(e,!0,(function(e,t){for(var n=$u(t),r=[],i=4,o=0;o<n;o++)r.push($u(t,i)),i+=4;e.entryCount=n,e.entries=r}))}},{key:"co64",value:function(e){return vc(e,!0,(function(e,t){for(var n=$u(t),r=[],i=4,o=0;o<n;o++)r.push(ec(t,i)),i+=8;e.entryCount=n,e.entries=r}))}},{key:"stss",value:function(e){return vc(e,!0,(function(e,t){for(var n=$u(t),r=[],i=4,o=0;o<n;o++)r.push($u(t,i)),i+=4;e.entryCount=n,e.entries=r}))}},{key:"moof",value:function(t){return vc(t,!1,(function(t,n,r){t.mfhd=e.mfhd(e.findBox(n,["mfhd"],r)[0]),t.traf=e.findBox(n,["traf"],r).map((function(t){return e.traf(t)}))}))}},{key:"mfhd",value:function(e){return vc(e,!0,(function(e,t){e.sequenceNumber=$u(t)}))}},{key:"traf",value:function(t){return vc(t,!1,(function(t,n,r){t.tfhd=e.tfhd(e.findBox(n,["tfhd"],r)[0]),t.tfdt=e.tfdt(e.findBox(n,["tfdt"],r)[0]),t.trun=e.trun(e.findBox(n,["trun"],r)[0])}))}},{key:"trun",value:function(e){return vc(e,!0,(function(e,t){var n=e.version,r=e.flags,i=t.length,o=e.sampleCount=$u(t),a=4;if(i>a&&1&r&&(e.dataOffset=-(1+~$u(t,a)),a+=4),i>a&&4&r&&(e.firstSampleFlags=$u(t,a),a+=4),e.samples=[],i>a)for(var s,u=0;u<o;u++)s={},256&r&&(s.duration=$u(t,a),a+=4),512&r&&(s.size=$u(t,a),a+=4),1024&r&&(s.flags=$u(t,a),a+=4),2048&r&&(s.cts=n?-(1+~$u(t,a+4)):$u(t,a),a+=4),e.samples.push(s)}))}},{key:"tfdt",value:function(e){return vc(e,!0,(function(e,t){1===e.version?e.baseMediaDecodeTime=ec(t):e.baseMediaDecodeTime=$u(t)}))}},{key:"probe",value:function(t){return!!e.findBox(t,["ftyp"])}},{key:"parseSampleFlags",value:function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}},{key:"moovToTrack",value:function(e,t,n){var r,i,o=e.trak;if(o&&o.length){var a=o.find((function(e){var t,n;return"vide"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)})),s=o.find((function(e){var t,n;return"soun"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)}));if(a&&t){var u,c,l,d,h,f,p,m=t,y=null===(u=a.tkhd)||void 0===u?void 0:u.trackId;null!=y&&(m.id=a.tkhd.trackId),m.tkhdDuration=a.tkhd.duration,m.mvhdDurtion=e.mvhd.duration,m.mvhdTimecale=e.mvhd.timescale,m.timescale=m.formatTimescale=a.mdia.mdhd.timescale,m.duration=a.mdia.mdhd.duration||m.mvhdDurtion/m.mvhdTimecale*m.timescale;var v,g,b,A,_,w,S,k,T=a.mdia.minf.stbl.stsd.entries[0];if(m.width=T.width,m.height=T.height,T.pasp&&(m.sarRatio=[T.pasp.hSpacing,T.pasp.vSpacing]),T.hvcC)m.codecType=Eu,m.codec=T.hvcC.codec,m.vps=T.hvcC.vps,m.sps=T.hvcC.sps,m.pps=T.hvcC.pps,m.hvcC=T.hvcC.data;else{if(!T.avcC)throw new Error("unknown video stsd entry");m.codec=T.avcC.codec,m.sps=T.avcC.sps,m.pps=T.avcC.pps}if(m.present=!0,m.ext={},m.ext.stss=null===(c=a.mdia)||void 0===c||null===(l=c.minf)||void 0===l||null===(d=l.stbl)||void 0===d?void 0:d.stss,m.ext.ctts=null===(h=a.mdia)||void 0===h||null===(f=h.minf)||void 0===f||null===(p=f.stbl)||void 0===p?void 0:p.ctts,T&&"encv"===T.type)m.isVideoEncryption=!0,T.default_KID=null===(v=T.sinf)||void 0===v||null===(g=v.schi)||void 0===g?void 0:g.tenc.default_KID,T.default_IsEncrypted=null===(b=T.sinf)||void 0===b||null===(A=b.schi)||void 0===A?void 0:A.tenc.default_IsEncrypted,T.default_IV_size=null===(_=T.sinf)||void 0===_||null===(w=_.schi)||void 0===w?void 0:w.tenc.default_IV_size,m.videoSenc=a.mdia.minf.stbl.senc&&a.mdia.minf.stbl.senc.samples,T.data_format=null===(S=T.sinf)||void 0===S||null===(k=S.frma)||void 0===k?void 0:k.data_format,m.useEME=e.useEME,m.kidValue=e.kidValue,m.pssh=e.pssh,m.encv=T}if(s&&n){var x,E,L,I,R,Z,C,P,G,D=n,M=null===(x=s.tkhd)||void 0===x?void 0:x.trackId;null!=M&&(D.id=s.tkhd.trackId),D.tkhdDuration=s.tkhd.duration,D.mvhdDurtion=e.mvhd.duration,D.mvhdTimecale=e.mvhd.timescale,D.timescale=D.formatTimescale=s.mdia.mdhd.timescale,D.duration=s.mdia.mdhd.duration||D.mvhdDurtion/D.mvhdTimecale*D.timescale;var V,X,W,O,N,U,F,Y,K=s.mdia.minf.stbl.stsd.entries[0];switch(D.sampleSize=K.sampleSize,D.sampleRate=K.sampleRate,D.channelCount=K.channelCount,D.present=!0,K.type){case"alaw":D.codecType=D.codec=Iu,D.sampleRate=8e3;break;case"ulaw":D.codecType=D.codec=Ru,D.sampleRate=8e3;break;default:D.sampleDuration=Ju.getFrameDuration(D.sampleRate,D.timescale),D.sampleRateIndex=Ju.getRateIndexByRate(D.sampleRate),D.objectType=(null===(r=K.esds)||void 0===r?void 0:r.objectType)||2,K.esds&&(D.config=Array.from(K.esds.config)),D.codec=(null===(i=K.esds)||void 0===i?void 0:i.codec)||"mp4a.40.2"}if(D.sampleDuration=Ju.getFrameDuration(D.sampleRate,D.timescale),D.objectType=(null===(E=K.esds)||void 0===E?void 0:E.objectType)||2,K.esds&&(K.esds.config?D.config=Array.from(K.esds.config):console.warn("esds config is null")),D.codec=(null===(L=K.esds)||void 0===L?void 0:L.codec)||"mp4a.40.2",D.sampleRateIndex=Ju.getRateIndexByRate(D.sampleRate),D.ext={},D.ext.stss=null===(I=s.mdia)||void 0===I||null===(R=I.minf)||void 0===R||null===(Z=R.stbl)||void 0===Z?void 0:Z.stss,D.ext.ctts=null===(C=s.mdia)||void 0===C||null===(P=C.minf)||void 0===P||null===(G=P.stbl)||void 0===G?void 0:G.ctts,D.present=!0,K&&"enca"===K.type)D.isAudioEncryption=!0,K.data_format=null===(V=K.sinf)||void 0===V||null===(X=V.frma)||void 0===X?void 0:X.data_format,K.default_KID=null===(W=K.sinf)||void 0===W||null===(O=W.schi)||void 0===O?void 0:O.tenc.default_KID,K.default_IsEncrypted=null===(N=K.sinf)||void 0===N||null===(U=N.schi)||void 0===U?void 0:U.tenc.default_IsEncrypted,K.default_IV_size=null===(F=K.sinf)||void 0===F||null===(Y=F.schi)||void 0===Y?void 0:Y.tenc.default_IV_size,D.audioSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,D.useEME=e.useEME,D.kidValue=e.kidValue,D.enca=K}if(n&&(n.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!n&&n.isAudioEncryption),null!=t&&t.encv||null!=n&&n.enca){var j,H,B=null==t||null===(j=t.encv)||void 0===j?void 0:j.default_KID,J=null==n||null===(H=n.enca)||void 0===H?void 0:H.default_KID,z=B||J?(B||J).join(""):null;t&&(t.kid=z),n&&(n.kid=z)}return t&&(t.flags=3841),n&&(n.flags=1793),{videoTrack:t,audioTrack:n}}}},{key:"evaluateDefaultDuration",value:function(e,t,n){var r,i=null==t||null===(r=t.samples)||void 0===r?void 0:r.length;return i?1024*i/t.timescale*e.timescale/n:1024}},{key:"moofToSamples",value:function(t,n,r){var i={};return t.mfhd&&(n&&(n.sequenceNumber=t.mfhd.sequenceNumber),r&&(r.sequenceNumber=t.mfhd.sequenceNumber)),t.traf.forEach((function(t){var o=t.tfhd,a=t.tfdt,s=t.trun;if(o&&s){a&&(n&&n.id===o.trackId&&(n.baseMediaDecodeTime=a.baseMediaDecodeTime),r&&r.id===o.trackId&&(r.baseMediaDecodeTime=a.baseMediaDecodeTime));var u=o.defaultSampleSize||0,c=o.defaultSampleDuration||e.evaluateDefaultDuration(n,r,s.samples.length||s.sampleCount),l=s.dataOffset||0,d=0,h=-1;if(!s.samples.length&&s.sampleCount){i[o.trackId]=[];for(var f=0;f<s.sampleCount;f++)i[o.trackId].push({offset:l,dts:d,duration:c,size:u}),d+=c,l+=u}else i[o.trackId]=s.samples.map((function(e,t){return(e={offset:l,dts:d,pts:d+(e.cts||0),duration:e.duration||c,size:e.size||u,gopId:h,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(h++,e.gopId=h),d+=e.duration,l+=e.size,e}))}})),i}},{key:"moovToSamples",value:function(e){var t=e.trak;if(t&&t.length){var n=t.find((function(e){var t,n;return"vide"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)})),r=t.find((function(e){var t,n;return"soun"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)}));if(n||r){var i,o;if(n){var a,s,u=null===(a=n.mdia)||void 0===a||null===(s=a.minf)||void 0===s?void 0:s.stbl;if(!u)return;var c=u.stts,l=u.stsc,d=u.stsz,h=u.stco,f=u.stss,p=u.ctts;if(!(c&&l&&d&&h&&f))return;i=pc(c,l,d,h,p,f)}if(r){var m,y,v,g=null===(m=r.mdia)||void 0===m||null===(y=m.minf)||void 0===y?void 0:y.stbl;if(!g)return;var b=null===(v=r.mdia.mdhd)||void 0===v?void 0:v.timescale,A=g.stts,_=g.stsc,w=g.stsz,S=g.stco;if(!(b&&A&&_&&w&&S))return;o=pc(A,_,w,S)}return{videoSamples:i,audioSamples:o}}}}}]),e}();function pc(e,t,n,r,i,o){var a,s,u,c=[],l=null==i?void 0:i.entries,d=t.entries,h=r.entries,f=n.entrySizes,p=null==o?void 0:o.entries;p&&(a={},p.forEach((function(e){a[e-1]=!0}))),l&&(s=[],l.forEach((function(e){for(var t=e.count,n=e.offset,r=0;r<t;r++)s.push(n)})));var m=-1,y=0,v=0,g=0,b=0,A=0,_=d[0].samplesPerChunk,w=d[1]?d[1].firstChunk-1:1/0;return e.entries.forEach((function(e){for(var t=e.count,r=e.delta,i=0;i<t;i++)u={dts:y,duration:r,size:f[v]||n.sampleSize,offset:h[g]+A,index:v},p&&(u.keyframe=a[v],u.keyframe&&m++,u.gopId=m),s&&v<s.length&&(u.pts=u.dts+s[v]),c.push(u),y+=r,++v<_?A+=u.size:(g++,A=0,g>=w&&(b++,w=d[b+1]?d[b+1].firstChunk-1:1/0),_+=d[b].samplesPerChunk)})),c}function mc(e,t){return e.dataReferenceIndex=qu(t,6),e.width=qu(t,24),e.height=qu(t,26),e.horizresolution=$u(t,28),e.vertresolution=$u(t,32),e.frameCount=qu(t,40),e.depth=qu(t,74),78}function yc(e,t){return e.dataReferenceIndex=qu(t,6),e.channelCount=qu(t,16),e.sampleSize=qu(t,18),e.sampleRate=$u(t,24)/65536,28}function vc(e,t,n){if(e){if(e.size!==e.data.length)throw new Error("box ".concat(e.type," size !== data.length"));var r={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(r.version=e.data[e.headerSize],r.flags=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),r.headerSize+=4),n(r,e.data.subarray(r.headerSize),r.start+r.headerSize),r}}var gc=function(){for(var e=[],t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach((function(t){e.push(function(e,t,n){for(var r=String(n),i=t>>0,o=Math.ceil(i/r.length),a=[],s=String(e);o--;)a.push(r);return a.join("").substring(0,i-s.length)+s}(Number(t).toString(16),2,0))})),e[0]},bc=function(){function e(t,n,r){lu(this,e),this.videoTrack=t||new Vu,this.audioTrack=n||new Xu,this.metadataTrack=r||new Uu}return hu(e,[{key:"demux",value:function(e,t){var n=this.videoTrack,r=this.audioTrack,i=n.exist(),o=r.exist();if(n.samples=[],r.samples=[],t){if(!o){var a=fc.findBox(t,["moov"])[0];if(!a)throw new Error("cannot found moov box");fc.moovToTrack(fc.moov(a),null,r)}var s=fc.findBox(t,["moof"])[0];if(s){var u=fc.moofToSamples(fc.moof(s),null,r)[r.id],c=r.baseMediaDecodeTime;if(u){var l=s.start;u.map((function(e){e.offset+=l;var n=t.subarray(e.offset,e.offset+e.size);r.samples.push(new Ou(e.dts+c,n,e.duration))}))}}}if(e){if(!i&&!o){var d=fc.findBox(e,["moov"])[0];if(!d)throw new Error("cannot found moov box");fc.moovToTrack(fc.moov(d),n,r)}var h=fc.findBox(e,["moof"])[0];if(h){var f,p=fc.moofToSamples(fc.moof(h),n,r),m=n.baseMediaDecodeTime,y=r.baseMediaDecodeTime,v=h.start;Object.keys(p).forEach((function(t){n.id==t?p[t].map((function(t){t.offset+=v;var r=new Wu((t.pts||t.dts)+m,t.dts+m);r.duration=t.duration,r.gopId=t.gopId,t.keyframe&&r.setToKeyframe();var i=e.subarray(t.offset,t.offset+t.size);r.data=i;for(var o=0,a=i.length-1;o<a;)f=$u(i,o),o+=4,r.units.push(i.subarray(o,o+f)),o+=f;n.samples.push(r)})):r.id==t&&p[t].map((function(t){t.offset+=v;var n=e.subarray(t.offset,t.offset+t.size);r.samples.push(new Ou(t.dts+y,n,t.duration))}))}))}}return{videoTrack:n,audioTrack:r,metadataTrack:this.metadataTrack}}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset(),this.metadataTrack.reset()}}],[{key:"probe",value:function(e){return fc.probe(e)}}]),e}();var Ac=function(){function e(){lu(this,e),this.buffer=new Uint8Array(0)}return hu(e,[{key:"write",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach((function(t){t?e.buffer=function(e){for(var t=0,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];r.forEach((function(e){t+=e.length}));var o=new e(t),a=0;return r.forEach((function(e){o.set(e,a),a+=e.length})),o}(Uint8Array,e.buffer,t):window.console.warn(t)}))}}],[{key:"writeUint16",value:function(e){return new Uint8Array([e>>8&255,255&e])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}]),e}(),_c=Math.pow(2,32)-1,wc=function(){function e(){lu(this,e)}return hu(e,null,[{key:"box",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=8+(n=n.filter(Boolean)).reduce((function(e,t){return e+t.byteLength}),0),o=new Uint8Array(i);o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=255&i,o.set(e,4);var a=8;return n.forEach((function(e){o.set(e,a),a+=e.byteLength})),o}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===Su&&e.codecType===Eu}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return zu(e.ftyp(t),e.moov(t))}},{key:"pssh",value:function(t){var n=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],nc(t.kid),[0,0,0,0]));return e.box(e.types.pssh,n)}},{key:"moov",value:function(t){if(t[0].useEME&&(t[0].encv||t[0].enca)){t[0].pssh||(t[0].pssh={kid:t[0].kid});var n=this.pssh(t[0].pssh);return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale),e.mvex(t)].concat(bu(t.map((function(t){return e.trak(t)}))),[n]))}return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale)].concat(bu(t.map((function(t){return e.trak(t)}))),[e.mvex(t)]))}},{key:"mvhd",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mvhd,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,t>>24&255,t>>16&255,t>>8&255,255&t,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]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.tkhdDuration||0,t.width,t.height),e.mdia(t))}},{key:"tkhd",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,255&r,0,0,i>>8&255,255&i,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minf(t))}},{key:"mdhd",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;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,t>>24&255,t>>16&255,t>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"minf",value:function(t){return e.box(e.types.minf,t.type===Su?e.VMHD:e.SMHD,e.DINF,e.stbl(t))}},{key:"stbl",value:function(t){var n=[];return t&&t.ext&&t.ext.stss&&n.push(e.stss(t.ext.stss.entries)),e.box(e.types.stbl,e.stsd(t),e.STTS,n[0],e.STSC,e.STSZ,e.STCO)}},{key:"stsd",value:function(t){var n;return n="audio"===t.type?t.useEME&&t.enca?e.enca(t):e.mp4a(t):t.useEME&&t.encv?e.encv(t):e.avc1hev1(t),e.box(e.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),n)}},{key:"enca",value:function(t){var n=t.enca.channelCount,r=t.enca.sampleRate,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]),o=e.esds(t.config),a=e.sinf(t.enca);return e.box(e.types.enca,i,o,a)}},{key:"encv",value:function(t){var n,r,i=t.sps.length>0?t.sps[0]:[],o=t.pps.length>0?t.pps[0]:[],a=t.width,s=t.height,u=t.sarRatio[0],c=t.sarRatio[1],l=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,a>>8&255,255&a,s>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),d=new Uint8Array((n=(r=[1,i[1],i[2],i[3],255,225,i.length>>>8&255,255&i.length]).concat.apply(r,bu(i)).concat([1,o.length>>>8&255,255&o.length])).concat.apply(n,bu(o))),h=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),f=e.sinf(t.encv),p=new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,c>>24,c>>16&255,c>>8&255,255&c]);return e.box(e.types.encv,l,e.box(e.types.avcC,d),e.box(e.types.btrt,h),f,e.box(e.types.pasp,p))}},{key:"schi",value:function(t){var n=new Uint8Array([]),r=e.tenc(t);return e.box(e.types.schi,n,r)}},{key:"tenc",value:function(t){var n=new Uint8Array([0,0,0,0,0,0,255&t.default_IsEncrypted,255&t.default_IV_size].concat(nc(t.default_KID)));return e.box(e.types.tenc,n)}},{key:"sinf",value:function(t){var n=new Uint8Array([]),r=new Uint8Array([t.data_format.charCodeAt(0),t.data_format.charCodeAt(1),t.data_format.charCodeAt(2),t.data_format.charCodeAt(3)]),i=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),o=e.schi(t);return e.box(e.types.sinf,n,e.box(e.types.frma,r),e.box(e.types.schm,i),o)}},{key:"avc1hev1",value:function(t){var n=t.codecType===Eu,r=n?e.types.hvc1:e.types.avc1,i=n?e.hvcC(t):e.avcC(t),o=[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,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,17,17]),i];return n?o.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&o.push(e.pasp(t.sarRatio)),e.box.apply(e,[r].concat(o))}},{key:"avcC",value:function(t){var n,r,i,o=[],a=[];return t.sps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,bu(e))})),t.pps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,bu(e))})),e.box(e.types.avcC,new Uint8Array((n=(r=[1,o[3],o[4],o[5],255,224|t.sps.length]).concat.apply(r,o).concat([t.pps.length])).concat.apply(n,a)))}},{key:"hvcC",value:function(t){var n=t.hvcC;if(n instanceof ArrayBuffer||n instanceof Uint8Array)return n;var r,i=t.vps,o=t.sps,a=t.pps;if(n){var s=n.generalProfileCompatibilityFlags,u=n.generalConstraintIndicatorFlags,c=(i.length&&1)+(o.length&&1)+(a.length&&1);r=[1,n.generalProfileSpace<<6|n.generalTierFlag<<5|n.generalProfileIdc,s>>>24,s>>>16,s>>>8,s,u[0],u[1],u[2],u[3],u[4],u[5],n.generalLevelIdc,240,0,252,252|n.chromaFormatIdc,248|n.bitDepthLumaMinus8,248|n.bitDepthChromaMinus8,0,0,n.numTemporalLayers<<3|n.temporalIdNested<<2|3,c];var l=function(e){var t;r.push(e.length>>8,e.length),(t=r).push.apply(t,bu(e))};i.length&&(r.push(160,0,i.length),i.forEach(l)),o.length&&(r.push(161,0,o.length),o.forEach(l)),a.length&&(r.push(162,0,a.length),a.forEach(l))}else r=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return e.box(e.types.hvcC,new Uint8Array(r))}},{key:"pasp",value:function(t){var n=gu(t,2),r=n[0],i=n[1];return e.box(e.types.pasp,new Uint8Array([r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),t.config.length?e.esds(t.config):void 0)}},{key:"esds",value:function(t){var n=t.length;return e.box(e.types.esds,new Uint8Array([0,0,0,0,3,23+n,0,0,0,4,15+n,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([n]).concat(t).concat([6,1,2])))}},{key:"mvex",value:function(t){return e.box.apply(e,[e.types.mvex].concat(bu(t.map((function(t){return e.trex(t.id)})))))}},{key:"trex",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trex1",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]))}},{key:"trex2",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]))}},{key:"moof",value:function(t){return e.box.apply(e,[e.types.moof,e.mfhd(t[0].samples?t[0].samples[0].gopId:0)].concat(bu(t.map((function(t){return e.traf(t)})))))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"traf",value:function(t){var n=e.tfhd(t.id),r=e.tfdt(t,t.baseMediaDecodeTime),i=0;if(t.isVideo&&t.videoSenc&&t.videoSenc.forEach((function(e){i+=8,e.subsamples&&e.subsamples.length&&(i+=2,i+=6*e.subsamples.length)})),t.videoSencLength=i,t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)){if(t.isVideoEncryption){if(t.isVideo){var o=e.saiz(t),a=e.saio(t),s=e.trun1(t),u=e.senc(t);return e.box(e.types.traf,n,r,o,a,s,u)}if(t.isAudioEncryption){var c=e.sbgp(),l=e.saiz(t),d=e.saio(t),h=e.senc(t),f=e.trun1(t);return e.box(e.types.traf,n,r,c,l,d,h,f)}var p=e.sbgp(),m=e.trun1(t);return e.box(e.types.traf,n,r,p,m)}if(t.isVideo){var y=e.trun1(t);return e.box(e.types.traf,n,r,y)}var v=e.sbgp(),g=e.saiz(t),b=e.saio(t),A=e.senc(t),_=e.trun1(t);return e.box(e.types.traf,n,r,v,g,b,A,_)}var w=e.sdtp(t);return e.box(e.types.traf,n,r,w,e.trun(t.samples,w.byteLength+76))}},{key:"sdtp",value:function(t){var n=new Ac;return t.samples.forEach((function(e){n.write(new Uint8Array(t.isVideo?[e.keyframe?32:16]:[16]))})),e.box(e.types.sdtp,this.extension(0,0),n.buffer)}},{key:"trun1",value:function(t){var n=new Ac,r=Ac.writeUint32(t.samples.length),i=null;if(t.isVideo){var o=t.videoSencLength;i=Ac.writeUint32(16*t.samples.length+o+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=Ac.writeUint32(16*t.samples.length+92))}else{var a=12*t.samples.length+124;t.isAudioEncryption&&(a=12*t.samples.length+8*t.audioSenc.length+177),i=Ac.writeUint32(a)}return t.samples.forEach((function(e){n.write(Ac.writeUint32(e.duration)),n.write(Ac.writeUint32(e.size)),n.write(Ac.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&n.write(Ac.writeUint32(e.cts?e.cts:0))})),e.box(e.types.trun,this.extension(0,t.flags),r,i,n.buffer)}},{key:"senc",value:function(t){var n=new Ac,r=t.samples.length,i=t.isVideo?16:8,o=t.isVideo?2:0,a=[],s=0;return t.isVideo?(a=t.videoSenc,s=t.videoSencLength):a=t.audioSenc,s=s||i*r,n.write(Ac.writeUint32(16+s),e.types.senc,this.extension(0,o)),n.write(Ac.writeUint32(r)),a.forEach((function(e){for(var t=0;t<e.InitializationVector.length;t++)n.write(new Uint8Array([e.InitializationVector[t]]));e.subsamples&&e.subsamples.length&&(n.write(Ac.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){n.write(Ac.writeUint16(e.BytesOfClearData)),n.write(Ac.writeUint32(e.BytesOfProtectedData))})))})),n.buffer}},{key:"saio",value:function(t){var n=12*t.samples.length+141;!t.isVideo&&t.isAudioEncryption&&(n=149);var r=new Uint8Array([1,0,0,0,0,0,0,1,0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n]);return e.box(e.types.saio,r)}},{key:"saiz",value:function(t){var n=t.samples.length,r=new Uint8Array([0,0,0,0,16,n>>24&255,n>>16&255,n>>8&255,255&n]);return e.box(e.types.saiz,r)}},{key:"sbgp",value:function(){var t=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return e.box(e.types.sbgp,this.extension(0,0),t)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"tfhd",value:function(t){return e.box(e.types.tfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"tfdt",value:function(t,n){var r=Math.floor(n/(_c+1)),i=Math.floor(n%(_c+1));return t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)?e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])):e.box(e.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"trun",value:function(t,n){var r=t.length,i=12+16*r;n+=8+i;var o=new Uint8Array(i);o.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0);for(var a=0;a<r;a++){var s=t[a],u=s.duration,c=s.size,l=s.flag,d=void 0===l?{}:l,h=s.cts,f=void 0===h?0:h;o.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,c>>>24&255,c>>>16&255,c>>>8&255,255&c,d.isLeading<<2|(null===d.dependsOn||void 0===d.dependsOn?1:d.dependsOn),d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|(null===d.isNonSyncSample||void 0===d.isNonSyncSample?1:d.isNonSyncSample),61440&d.degradationPriority,15&d.degradationPriority,f>>>24&255,f>>>16&255,f>>>8&255,255&f],12+16*a)}return e.box(e.types.trun,o)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(bu(t.map((function(t){return e.trackMP4(t)})))))}},{key:"trackMP4",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.duration,t.width,t.height),e.mdiaMP4(t))}},{key:"mdiaMP4",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minfMP4(t))}},{key:"minfMP4",value:function(t){return e.box(e.types.minf,t.type===Su?e.VMHD:e.SMHD,e.DINF,e.stblMP4(t))}},{key:"stblMP4",value:function(t){var n=t.ext,r=[e.stsd(t),e.stts(n.stts),e.stsc(n.stsc),e.stsz(n.stsz),e.stco(n.stco)];return n.stss.length&&r.push(e.stss(n.stss)),n.ctts.length&&r.push(e.ctts(n.ctts)),e.box.apply(e,[e.types.stbl].concat(r))}},{key:"stts",value:function(t){var n=t.length,r=new Uint8Array(8*n),i=0;return t.forEach((function(e){var t=e.value,n=e.count;r.set([n>>24,n>>16&255,n>>8&255,255&n,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.stts,zu(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stsc",value:function(t){var n=t.length,r=new Uint8Array(12*n),i=0;return t.forEach((function(e){var t=e.firstChunk,n=e.samplesPerChunk,o=e.sampleDescIndex;r.set([t>>24,t>>16&255,t>>8&255,255&t,n>>24,n>>16&255,n>>8&255,255&n,o>>24,o>>16&255,o>>8&255,255&o],i),i+=12})),e.box(e.types.stsc,zu(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stsz",value:function(t){var n=t.length,r=new Uint8Array(4*n),i=0;return t.forEach((function(e){r.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stsz,zu(new Uint8Array([0,0,0,0,0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stco",value:function(t){var n=t.length,r=new Uint8Array(4*n),i=0;return t.forEach((function(e){r.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stco,zu(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stss",value:function(t){var n=t.length,r=new Uint8Array(4*n),i=0;return t.forEach((function(e){r.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stss,zu(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"ctts",value:function(t){var n=t.length,r=new Uint8Array(8*n),i=0;return t.forEach((function(e){var t=e.value,n=e.count;r.set([n>>24,n>>16&255,n>>8&255,255&n,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.ctts,zu(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"styp",value:function(){return e.box(e.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(t){var n=t.timescale,r=t.samples[0].duration,i=r*t.samples.length,o=t.samples[0].sampleOffset*r,a=8;t.samples.forEach((function(e){a+=e.size}));var s=0;if(t.isVideo){var u,c=0;t.videoSenc&&(u=t.videoSenc),t.isVideo&&u.forEach((function(e){c+=8,e.subsamples&&e.subsamples.length&&(c+=2,c+=6*e.subsamples.length)})),t.videoSencLength=c,s=a+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=a+16*t.samples.length+84)}else s=a+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=a+169+12*t.samples.length+8*t.audioSenc.length);var l=new Uint8Array([0,0,0,0,0,0,0,255&t.id,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,1,0,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,144,0,0,0]);return e.box(e.types.sidx,l)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}]),e}();fu(wc,"types",["avc1","avcC","hvc1","hvcC","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp"].reduce((function(e,t){return e[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)],e}),Object.create(null))),fu(wc,"HDLR_TYPES",{video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])}),fu(wc,"FTYPAVC1",wc.box(wc.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),fu(wc,"FTYPHEV1",wc.box(wc.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),fu(wc,"DINF",wc.box(wc.types.dinf,wc.box(wc.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),fu(wc,"VMHD",wc.box(wc.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),fu(wc,"SMHD",wc.box(wc.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),fu(wc,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),fu(wc,"STTS",wc.box(wc.types.stts,wc.StblTable)),fu(wc,"STSC",wc.box(wc.types.stsc,wc.StblTable)),fu(wc,"STSZ",wc.box(wc.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),fu(wc,"STCO",wc.box(wc.types.stco,wc.StblTable));var Sc=function(){function e(t,n){lu(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=n}return hu(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).debug.apply(t,[this._prefix].concat(r))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).log.apply(t,[this._prefix].concat(r))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(r))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).error.apply(t,[this._prefix].concat(r))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();fu(Sc,"disabled",!0);var kc=function(){function e(t,n,r){lu(this,e),this.videoTrack=t,this.audioTrack=n;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new Sc("FMP4Remuxer",!r||!r.openLog||!r.openLog)}return hu(e,[{key:"remux",value:function(){var e,t,n,r,i,o=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),l=u.exist(),d=[];return o&&(a&&a.initMerge?(c&&d.push(this.videoTrack),l&&d.push(this.audioTrack),n=wc.initSegment(d)):(c&&(e=wc.initSegment([this.videoTrack])),l&&(t=wc.initSegment([this.audioTrack])))),c&&s.hasSample()&&(r=this._remuxVideo()),l&&u.hasSample()&&(i=this._remuxAudio()),s.samples=[],u.samples=[],{initSegment:n,videoInitSegment:e,audioInitSegment:t,videoSegment:r,audioSegment:i}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack;this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0});var t=e.samples,n=0;t.forEach((function(e){n+=e.units.reduce((function(e,t){return e+t.byteLength}),0),n+=4*e.units.length}));for(var r,i=new Uint8Array(n),o=new DataView(i.buffer),a=function(e,n){n=t[s];var a=0;n.units.forEach((function(t){o.setUint32(e,t.byteLength),e+=4,i.set(t,e),e+=t.byteLength,a+=4+t.byteLength})),n.size=a,c=e,r=n},s=0,u=t.length,c=0;s<u;s++)a(c,r);var l=wc.mdat(i);return zu(wc.moof([e]),l)}},{key:"_remuxAudio",value:function(){var e=this.audioTrack,t=new Uint8Array(e.samples.reduce((function(e,t){return e+t.size}),0));e.samples.reduce((function(e,n){return t.set(n.data,e),e+n.size}),0);var n=wc.mdat(t);return zu(wc.moof([e]),n)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}(),Tc=function(){function e(){Sa(this,e);var t=window.crypto||window.msCrypto;this.subtle=t&&(t.subtle||t.webkitSubtle),this.externalDecryptor=null}var t,n;return Ta(e,[{key:"destroy",value:function(){var e;null!==(e=this.externalDecryptor)&&void 0!==e&&e.destroy&&this.externalDecryptor.destroy()}},{key:"decrypt",value:function(e,t){if(e||t){var n=[];return e&&(n[0]=this._decryptSegment(e)),t&&(n[1]=this._decryptSegment(t)),Promise.all(n)}}},{key:"_decryptSegment",value:(n=wa(ba().mark((function e(t){var n;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.data,!t.key){e.next=5;break}return e.next=4,this._decryptData(t.data,t.key,t.keyIv);case 4:n=e.sent;case 5:if(t.map){e.next=7;break}return e.abrupt("return",n);case 7:return e.abrupt("return",nu(t.map,n));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_decryptData",value:(t=wa(ba().mark((function e(t,n,r){var i;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.externalDecryptor){e.next=6;break}return e.next=3,this.externalDecryptor.decrypt(t,n,r);case 3:return e.abrupt("return",e.sent);case 6:if(this.subtle){e.next=8;break}throw new Error("crypto is not defined");case 8:return e.next=10,this.subtle.importKey("raw",n,{name:"AES-CBC"},!1,["encrypt","decrypt"]);case 10:return i=e.sent,e.t0=Uint8Array,e.next=14,this.subtle.decrypt({name:"AES-CBC",iv:r},i,t);case 14:return e.t1=e.sent,e.abrupt("return",new e.t0(e.t1));case 16:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})}]),e}(),xc=ga(ga({},zs),{},{STREAM_PARSED:"core.streamparsed",NO_AUDIO_TRACK:"core.noaudiotrack",SUBTITLE_SEGMENTS:"core.subtitlesegments",SUBTITLE_PLAYLIST:"core.subtitleplaylist",SEI_PAYLOAD_TIME:"core.seipayloadtime",APPEND_COST:"core.appendcost"}),Ec=new Ls("Transmuxer"),Lc=function(){function e(t,n,r){Sa(this,e),xa(this,"_initSegmentId",""),this.hls=t,this._demuxer=n?new bc:new hc,this._isMP4=n,r&&(this._remuxer=new kc(this._demuxer.videoTrack,this._demuxer.audioTrack))}return Ta(e,[{key:"transmux",value:function(e,t,n,r,i,o){var a=this._demuxer;try{this._isMP4?a.demux(e,t):a.demuxAndFix(nu(e,t),n,r,i)}catch(Sye){throw new ks(ys,ws.HLS,Sye)}var s=a.videoTrack,u=a.audioTrack,c=a.metadataTrack,l="".concat(s.codec,"/").concat(s.width,"/").concat(s.height,"/").concat(u.codec,"/").concat(u.config);if(l!==this._initSegmentId&&(this._initSegmentId=l,o=!0),this._fireEvents(s,u,c,n||o),this.hls.emit(xc.DEMUXED_TRACK,{videoTrack:s,audioTrack:u}),!this._remuxer)return[s,u];try{var d=this._remuxer.remux(o),h=d.videoInitSegment,f=d.videoSegment,p=d.audioInitSegment,m=d.audioSegment,y=nu(h,f),v=nu(p,m);return[y?{codec:s.codec,data:y}:void 0,v?{codec:u.codec,data:v}:void 0]}catch(Sye){throw new ks(vs,ws.FMP4,Sye)}}},{key:"_fireEvents",value:function(e,t,n,r){var i=this;Ec.debug(e.samples,t.samples),r&&(e.exist()&&this.hls.emit(xc.METADATA_PARSED,{type:"video",track:e,meta:{codec:e.codec,timescale:e.timescale,width:e.width,height:e.height,sarRatio:e.sarRatio,baseDts:e.baseDts}}),t.exist()&&this.hls.emit(xc.METADATA_PARSED,{type:"audio",track:t,meta:{codec:t.codec,channelCount:t.channelCount,sampleRate:t.sampleRate,timescale:t.timescale,baseDts:t.baseDts}}),Ec.debug("discontinuity",e,t)),e.warnings.forEach((function(e){var t;switch(e.type){case Zu:t=xc.LARGE_AV_FIRST_FRAME_GAP_DETECT;break;case Cu:t=xc.LARGE_VIDEO_DTS_GAP_DETECT;break;case Pu:t=xc.MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT}t&&i.hls.emit(xc.STREAM_EXCEPTION,ga(ga({},e),{},{type:t})),Ec.warn("video exception",e)})),t.warnings.forEach((function(e){var t;switch(e.type){case Gu:t=xc.LARGE_AUDIO_DTS_GAP_DETECT;break;case Du:t=xc.AUDIO_GAP_DETECT;break;case Mu:t=xc.AUDIO_OVERLAP_DETECT}t&&i.hls.emit(xc.STREAM_EXCEPTION,ga(ga({},e),{},{type:t})),Ec.warn("audio exception",e)})),e.samples.forEach((function(e){e.keyframe&&i.hls.emit(xc.KEYFRAME,{pts:e.pts})})),n.seiSamples.forEach((function(e){i.hls.emit(xc.SEI,ga(ga({},e),{},{originPts:e.originPts/90,sei:{code:e.data.type,content:e.data.payload,dts:e.pts}}))}))}}]),e}(),Ic=new Ls("BufferService"),Rc=function(){function e(t){Sa(this,e),xa(this,"_decryptor",new Tc),xa(this,"_transmuxer",null),xa(this,"_mse",null),xa(this,"_softVideo",null),xa(this,"_sourceCreated",!1),xa(this,"_needInitSegment",!0),xa(this,"_directAppend",!1),this.hls=t,t.config.softDecode?this._softVideo=t.media:(this._mse=new Ms,t.config.url&&this._mse.bindMedia(t.media)),t.config.decryptor&&(this._decryptor.externalDecryptor=t.config.decryptor)}var t,n,r,i,o,a,s,u,c;return Ta(e,[{key:"baseDts",get:function(){var e,t,n;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t||null===(n=t._fixer)||void 0===n?void 0:n._baseDts}},{key:"nbSb",get:function(){var e;return null!==(e=this._mse)&&void 0!==e&&e._sourceBuffer?Object.keys(this._mse._sourceBuffer).length:0}},{key:"msIsOpend",get:function(){var e;return null===(e=this._mse)||void 0===e?void 0:e.isOpened}},{key:"updateDuration",value:(c=wa(ba().mark((function e(t){return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Ic.debug("update duration",t),!this._mse){e.next=9;break}if(this._mse.isOpened){e.next=5;break}return e.next=5,this._mse.open();case 5:return e.next=7,this._mse.updateDuration(t);case 7:e.next=10;break;case 9:this._softVideo&&(this._softVideo.duration=t);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"createSource",value:function(e,t,n,r){if(!this._sourceCreated){var i=e||t;if(i){if(hc.probe(i))this._transmuxer||(this._transmuxer=new Lc(this.hls,!1,!this._softVideo));else{if(!fc.probe(i))throw new ks(As,null,null,null,"unsupported stream");if(this._softVideo)this._transmuxer||(this._transmuxer=new Lc(this.hls,!0));else{this._directAppend=!0;var o=!1;e&&!n&&fc.findBox(e,["moov","trak"]).forEach((function(e){var t=fc.findBox(e.data,["trak","mdia","minf","stbl","stsd"])[0];if(t){var i=fc.stsd(t).entries[0];if(i)if(i.hvcC)n=i.hvcC.codec||"hev1.1.6.L93.B0";else if(i.avcC)n=i.avcC.codec;else if(i.sampleRate||i.esds){var a;r=(null===(a=i.esds)||void 0===a?void 0:a.codec)||"mp4a.40.2",o=!0}}})),t&&!r&&fc.findBox(t,["moov","trak","mdia","minf","stbl","stsd"]).forEach((function(e){var t=fc.stsd(e).entries[0];t&&t.esds&&(r=t.esds.codec)})),e&&!n&&(n="avc1.42e01e"),t&&!r&&(r="mp4a.40.2"),o&&(n+=", ".concat(r),r=""),this._createMseSource(n,r)}}this._softVideo&&(this._sourceCreated=!0)}}}},{key:"appendBuffer",value:(u=wa(ba().mark((function e(t,n,r,i,o,a,s){var u,c,l,d,h,f,p,m,y;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=r&&r.length||null!=i&&i.length){e.next=2;break}return e.abrupt("return");case 2:if(!this._directAppend){e.next=7;break}return u=[],r&&u.push(this._mse.append(Ms.VIDEO,r)),i&&u.push(this._mse.append(Ms.AUDIO,i)),e.abrupt("return",Promise.all(u));case 7:if(c=this._needInitSegment||o,l=this._transmuxer.transmux(r,i,o,a,s,this._needInitSegment||o),d=Ca(l,2),h=d[0],f=d[1],i&&n&&(null==n||n.setTrackExist(!1,!0)),i&&t&&(null==t||t.setTrackExist(!0,!1)),n||null==t||t.setTrackExist(!!h,!!f),h&&!f&&this.hls.emit(xc.NO_AUDIO_TRACK),!this._softVideo){e.next=18;break}this._softVideo.appendBuffer(h,f),this._needInitSegment=!1,e.next=28;break;case 18:if(!this._mse){e.next=28;break}return(p=!this._sourceCreated)&&this._createMseSource(null==h?void 0:h.codec,null==f?void 0:f.codec),this._needInitSegment=!1,m=this._mse,y=[],c&&!p&&this._handleCodecChange(h,f),h&&y.push(m.append(Ms.VIDEO,h.data)),f&&y.push(m.append(Ms.AUDIO,f.data)),e.abrupt("return",Promise.all(y));case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,o,a){return u.apply(this,arguments)})},{key:"removeBuffer",value:(s=wa(ba().mark((function e(){var t,n,r,i=this,o=arguments;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]?o[0]:0,n=o.length>1&&void 0!==o[1]?o[1]:1/0,r=this.hls.media,!(!this._mse||!r||t<0||n<t||t>=this._mse.duration)){e.next=5;break}return e.abrupt("return");case 5:return e.abrupt("return",this._mse.clearBuffer(t,n).then((function(){return i.hls.emit(zs.REMOVE_BUFFER,{start:t,end:n,removeEnd:n})})));case 6:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"evictBuffer",value:(a=wa(ba().mark((function e(t){var n,r,i;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.hls.media,this._mse&&n&&t&&!(t<0)){e.next=3;break}return e.abrupt("return");case 3:if(r=n.currentTime,!((i=r-t)<=0)){e.next=7;break}return e.abrupt("return");case 7:if(!(cs.start(cs.get(n))+1>=i)){e.next=10;break}return e.abrupt("return");case 10:return e.abrupt("return",this.removeBuffer(0,i));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"clearAllBuffer",value:(o=wa(ba().mark((function e(){return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=2;break}return e.abrupt("return",this._mse.clearAllBuffer());case 2:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"decryptBuffer",value:function(e,t){return this._decryptor.decrypt(e,t)}},{key:"reset",value:(i=wa(ba().mark((function e(){var t,n=arguments;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]&&n[0],!this._mse||t){e.next=8;break}return this._transmuxer=null,this._sourceCreated=!1,e.next=6,this._mse.unbindMedia();case 6:return e.next=8,this._mse.bindMedia(this.hls.media);case 8:this._needInitSegment=!0,this._directAppend=!1;case 10:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"endOfStream",value:(r=wa(ba().mark((function e(){return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=5;break}if(!this._sourceCreated){e.next=5;break}return e.next=4,this._mse.endOfStream();case 4:this.hls.emit(zs.BUFFEREOS);case 5:this._softVideo&&this._softVideo.endOfStream();case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"setLiveSeekableRange",value:(n=wa(ba().mark((function e(t,n){return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._mse&&this._mse.setLiveSeekableRange(t,n);case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"destroy",value:(t=wa(ba().mark((function e(){var t;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._decryptor)||void 0===t||t.destroy(),!this._mse){e.next=4;break}return e.next=4,this._mse.unbindMedia();case 4:this._decryptor=null,this._mse=null,this._softVideo=null;case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_createMseSource",value:function(e,t){Ic.debug("create mse source, videoCodec=".concat(e,", audioCodec=").concat(t));var n=this._mse;n&&(e&&(n.createSource(Ms.VIDEO,"video/mp4;codecs=".concat(e)),this._sourceCreated=!0),t&&(n.createSource(Ms.AUDIO,"audio/mp4;codecs=".concat(t)),this._sourceCreated=!0),this.hls.emit(zs.SOURCEBUFFER_CREATED))}},{key:"_handleCodecChange",value:function(e,t){var n=this._mse;[{type:Ms.VIDEO,codecs:null==e?void 0:e.codec},{type:Ms.AUDIO,codecs:null==t?void 0:t.codec}].filter((function(e){return!!e.codecs})).forEach((function(e){var t=e.type,r=e.codecs,i=n.getSourceBuffer(t);if(i){var o=r.split(",")[0];new RegExp(o,"ig").test(i.mimeType)||n.changeType(t,"".concat(t,"/mp4;codecs=").concat(r))}}))}},{key:"seamlessSwitch",value:function(){this._needInitSegment=!0}},{key:"isFull",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ms.VIDEO;return null===(e=this._mse)||void 0===e?void 0:e.isFull(t)}}]),e}();var Zc=Ta((function e(){Sa(this,e),xa(this,"version",0),xa(this,"streams",[]),xa(this,"isMaster",!0)})),Cc="AUDIO",Pc="SUBTITLE",Gc=Ta((function e(){Sa(this,e),xa(this,"id",0),xa(this,"url",""),xa(this,"default",!1),xa(this,"autoSelect",!1),xa(this,"forced",!1),xa(this,"group",""),xa(this,"name",""),xa(this,"lang",""),xa(this,"segments",[]),xa(this,"endSN",0)})),Dc=function(e){Ea(n,e);var t=Za(n);function n(){var e;Sa(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return xa(Ra(e=t.call.apply(t,[this].concat(i))),"mediaType",Cc),xa(Ra(e),"channels",0),e}return Ta(n)}(Gc),Mc=function(e){Ea(n,e);var t=Za(n);function n(){var e;Sa(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return xa(Ra(e=t.call.apply(t,[this].concat(i))),"mediaType",Pc),e}return Ta(n)}(Gc),Vc=Ta((function e(){Sa(this,e),xa(this,"id",0),xa(this,"bitrate",0),xa(this,"width",0),xa(this,"height",0),xa(this,"name",""),xa(this,"url",""),xa(this,"audioCodec",""),xa(this,"videoCodec",""),xa(this,"textCodec",""),xa(this,"audioGroup",""),xa(this,"audioStreams",[]),xa(this,"subtitleStreams",[]),xa(this,"closedCaptionsStream",[])})),Xc=Ta((function e(){Sa(this,e),xa(this,"version",0),xa(this,"url",""),xa(this,"type",""),xa(this,"startCC",0),xa(this,"endCC",0),xa(this,"startSN",0),xa(this,"endSN",0),xa(this,"totalDuration",0),xa(this,"targetDuration",0),xa(this,"partTargetDuration",0),xa(this,"canSkipUntil",0),xa(this,"canSkipDateRanges",!1),xa(this,"skippedSegments",0),xa(this,"canBlockReload",!1),xa(this,"partHoldBack",0),xa(this,"live",!0),xa(this,"lowLatency",!1),xa(this,"endPartIndex",0),xa(this,"segments",[])})),Wc=function(){function e(){Sa(this,e),xa(this,"sn",0),xa(this,"cc",0),xa(this,"url",""),xa(this,"title",""),xa(this,"start",0),xa(this,"duration",0),xa(this,"dataTime",""),xa(this,"key",null),xa(this,"byteRange",null),xa(this,"isInitSegment",!1),xa(this,"initSegment",null),xa(this,"isLast",!1),xa(this,"hasAudio",!1),xa(this,"hasVideo",!1),xa(this,"independent",!1),xa(this,"partIndex",0)}return Ta(e,[{key:"end",get:function(){return this.start+this.duration}},{key:"setTrackExist",value:function(e,t){this.hasVideo=e,this.hasAudio=t}},{key:"setByteRange",value:function(e,t){this.byteRange=[0];var n=e.split("@");1===n.length&&t&&t.byteRange?(this.byteRange[0]=t.byteRange[1]||0,this.byteRange[0]&&(this.byteRange[0]+=1)):this.byteRange[0]=parseInt(n[1]),this.byteRange[1]=this.byteRange[0]+parseInt(n[0])-1}}]),e}(),Oc=function(){function e(t){Sa(this,e),xa(this,"method",""),xa(this,"url",""),xa(this,"iv",null),xa(this,"keyFormat",""),xa(this,"keyFormatVersions",""),t instanceof e&&(this.method=t.method,this.url=t.url,this.keyFormat=t.keyFormat,this.keyFormatVersions=t.keyFormatVersions,t.iv&&(this.iv=new Uint8Array(t.iv)))}return Ta(e,[{key:"clone",value:function(t){var n=new e(this);return null!=t&&n.setIVFromSN(t),n}},{key:"setIVFromSN",value:function(e){if(!this.iv&&"AES-128"===this.method&&"number"==typeof e&&this.url){this.iv=new Uint8Array(16);for(var t=12;t<16;t++)this.iv[t]=e>>8*(15-t)&255}}}]),e}(),Nc=/^#(EXT[^:]*)(?::(.*))?$/,Uc=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g,Fc=/^(?:[a-zA-Z0-9+\-.]+:)?\/\//,Yc=/^((?:[a-zA-Z0-9+\-.]+:)?\/\/[^/?#]*)?([^?#]*\/)?/;function Kc(e){var t=e.match(Nc);if(t&&t[1])return[t[1].replace("EXT-X-",""),t[2]]}function jc(e){for(var t={},n=Uc.exec(e);n;)t[n[1]]=n[2]||n[3],n=Uc.exec(e);return t}function Hc(e,t){if(!t||!e||Fc.test(e))return e;var n=Yc.exec(t);return n?"/"===e[0]?n[1]+e:n[1]+n[2]+e:e}var Bc={audio:[/^mp4a/,/^vorbis$/,/^opus$/,/^flac$/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]};function Jc(e,t){var n=Bc[e];if(n&&t&&t.length)for(var r=0;r<n.length;r++)for(var i=0;i<t.length;i++)if(n[r].test(t[i]))return t[i]}var zc=function(){function e(){Sa(this,e)}return Ta(e,null,[{key:"parse",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;if(!t.includes("#EXTM3U"))throw new Error("Invalid m3u8 file");var i=function(e){return e.split(/[\r\n]/).map((function(e){return e.trim()})).filter(Boolean)}(t);return e.isMediaPlaylist(t)?function(e,t,n){var r=new Xc;r.url=t;for(var i,o=new Wc,a=null,s=null,u=0,c=0,l=0,d=0,h=!1,f=0;(i=e[d++])&&!h;)if("#"===i[0]){var p=Kc(i);if(p){var m=Ca(p,2),y=m[0],v=m[1];switch(y){case"VERSION":r.version=parseInt(v);break;case"PLAYLIST-TYPE":r.type=null==v?void 0:v.toUpperCase();break;case"TARGETDURATION":r.targetDuration=parseFloat(v);break;case"PART-INF":n&&(r.lowLatency=!0);var g=jc(v);g["PART-TARGET"]&&(r.partTargetDuration=parseFloat(g["PART-TARGET"]));break;case"SERVER-CONTROL":var b=jc(v);r.canBlockReload="YES"===b["CAN-BLOCK-RELOAD"],r.partHoldBack=parseFloat(b["PART-HOLD-BACK"]||0),r.canSkipUntil=parseFloat(b["CAN-SKIP-UNTIL"]||0),r.canSkipDateRanges="YES"===b["CAN-SKIP-DATERANGES"];break;case"ENDLIST":var A=r.segments[r.segments.length-1];A&&(A.isLast=!0),r.live=!1,h=!0;break;case"MEDIA-SEQUENCE":c=r.startSN=parseInt(v);break;case"DISCONTINUITY-SEQUENCE":l=r.startCC=parseInt(v);break;case"DISCONTINUITY":l++;break;case"BYTERANGE":o.setByteRange(v,r.segments[r.segments.length-1]);break;case"PART":if(!r.lowLatency)break;var _=jc(v);o.duration=parseFloat(_.DURATION),o.independent="YES"===_.INDEPENDENT,o.sn=c,o.cc=l,o.partIndex=f,o.start=u,o.duration=parseFloat(_.DURATION),u+=o.duration,o.url=Hc(_.URI,t),s&&(o.key=s.clone(c)),a&&(o.initSegment=a),r.segments.push(o),o=new Wc,f++;break;case"PRELOAD-HINT":break;case"PROGRAM-DATE-TIME":o.dataTime=v;break;case"EXTINF":if(r.lowLatency){f=0;break}var w=Ca(v.split(","),2),S=w[0],k=w[1];o.start=u,o.duration=parseFloat(S),u+=o.duration,o.title=k;break;case"KEY":var T=jc(v);if("NONE"===T.METHOD){s=null;break}if("AES-128"!==T.METHOD)throw new Error("encrypt ".concat(T.METHOD,"/").concat(T.KEYFORMAT," is not supported"));if((s=new Oc).method=T.METHOD,s.url=/^blob:/.test(T.URI)?T.URI:Hc(T.URI,t),s.keyFormat=T.KEYFORMAT||"identity",s.keyFormatVersions=T.KEYFORMATVERSIONS,T.IV){var x=T.IV.slice(2);x=(1&x.length?"0":"")+x,s.iv=new Uint8Array(x.length/2);for(var E=0,L=x.length/2;E<L;E++)s.iv[E]=parseInt(x.slice(2*E,2*E+2),16)}break;case"MAP":var I=jc(v);o.url=Hc(I.URI,t),I.BYTERANGE&&o.setByteRange(I.BYTERANGE),o.isInitSegment=!0,o.sn=0,s&&(o.key=s.clone(0)),a=o,o=new Wc}}}else{if(r.lowLatency){c++;continue}o.sn=c,o.cc=l,o.url=Hc(i,t),s&&(o.key=s.clone(c)),a&&(o.initSegment=a),r.segments.push(o),o=new Wc,c++}r.segments=r.segments.filter((function(e){return 0!==e.duration}));var R=r.segments[r.segments.length-1];return R&&(r.endSN=R.sn,r.endPartIndex=R.partIndex),r.totalDuration=u,r.endCC=l,r}(i,n,r):function(e,t){for(var n,r=new Zc,i=0,o=[],a=[];n=e[i++];){var s=Kc(n);if(s){var u=Ca(s,2),c=u[0],l=u[1];if("VERSION"===c)r.version=parseInt(l);else if("MEDIA"===c&&l){var d=jc(l),h=void 0;switch(d.TYPE){case"AUDIO":h=new Dc;break;case"SUBTITLES":h=new Mc;break;default:h=new Gc}h.url=Hc(d.URI,t),h.default="YES"===d.DEFAULT,h.autoSelect="YES"===d.AUTOSELECT,h.group=d["GROUP-ID"],h.name=d.NAME,h.lang=d.LANGUAGE,d.CHANNELS&&(h.channels=Number(d.CHANNELS.split("/")[0]),Number.isNaN(h.channels)&&(h.channels=0)),"AUDIO"===d.TYPE&&d.URI&&o.push(h),"SUBTITLES"===d.TYPE&&a.push(h)}else if("STREAM-INF"===c&&l){var f=new Vc,p=jc(l);if(f.bitrate=parseInt(p["AVERAGE-BANDWIDTH"]||p.BANDWIDTH),f.name=p.NAME,f.url=Hc(e[i++],t),p.RESOLUTION){var m=Ca(p.RESOLUTION.split("x"),2),y=m[0],v=m[1];f.width=parseInt(y),f.height=parseInt(v)}if(p.CODECS){var g=p.CODECS.split(/[ ,]+/).filter(Boolean);f.videoCodec=Jc("video",g),f.audioCodec=Jc("audio",g),f.textCodec=Jc("text",g)}f.audioGroup=p.AUDIO,f.subtitleGroup=p.SUBTITLES,r.streams.push(f)}}}return r.streams.forEach((function(e,t){e.id=t})),o.length&&(o.forEach((function(e,t){e.id=t})),r.streams.forEach((function(e){e.audioGroup&&(e.audioStreams=o.filter((function(t){return t.group===e.audioGroup})))}))),a.length&&(a.forEach((function(e,t){e.id=t})),r.streams.forEach((function(e){e.subtitleGroup&&(e.subtitleStreams=a.filter((function(t){return t.group===e.subtitleGroup})))}))),r}(i,n)}},{key:"isMediaPlaylist",value:function(e){return e.includes("#EXTINF:")||e.includes("#EXT-X-TARGETDURATION:")}}]),e}(),Qc=function(){function e(t){var n=this;Sa(this,e),xa(this,"_emitOnLoaded",(function(e,t){var r=e.response,i=e.options||{},o=i.firstByteTime,a=i.startTime,s=i.endTime,u=i.contentLength,c=s-a;n.hls.emit(zs.SPEED,{time:c,byteLength:u,url:t}),n.hls.emit(zs.LOAD_COMPLETE,{url:t,elapsed:c||0}),n.hls.emit(zs.TTFB,{url:t,responseUrl:r.url,elapsed:o-a}),n.hls.emit(zs.LOAD_RESPONSE_HEADERS,{headers:r.headers,url:t})})),xa(this,"_onLoaderRetry",(function(e,t){n.hls.emit(xc.LOAD_RETRY,{error:ks.network(e),retryTime:t})})),this.hls=t,this._timer=null,this._useLowLatency=t.config.useLowLatency;var r=this.hls.config,i=r.retryCount,o=r.retryDelay,a=r.manifestLoadTimeout,s=r.fetchOptions;this._loader=new iu(ga(ga({},s),{},{responseType:"text",retry:i,retryDelay:o,timeout:a,onRetryError:this._onLoaderRetry})),this._audioLoader=new iu(ga(ga({},s),{},{responseType:"text",retry:i,retryDelay:o,timeout:a,onRetryError:this._onLoaderRetry})),this._subtitleLoader=new iu(ga(ga({},s),{},{responseType:"text",retry:i,retryDelay:o,timeout:a,onRetryError:this._onLoaderRetry}))}var t;return Ta(e,[{key:"load",value:(t=wa(ba().mark((function e(t,n,r){var i,o,a,s,u,c,l,d,h,f,p,m,y,v,g,b,A,_,w,S;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=[this._loader.load(t)],n&&i.push(this._audioLoader.load(n)),r&&i.push(this._subtitleLoader.load(r)),e.prev=3,e.next=6,Promise.all(i);case 6:if(d=e.sent,h=Ca(d,3),f=h[0],p=h[1],m=h[2],f){e.next=13;break}return e.abrupt("return",[]);case 13:this._emitOnLoaded(f,t),o=f.data,u=f.response.url||t,n?(a=null==p?void 0:p.data,s=null==m?void 0:m.data,c=(null==p||null===(y=p.response)||void 0===y?void 0:y.url)||n,l=(null==m||null===(v=m.response)||void 0===v?void 0:v.url)||r,a&&this._emitOnLoaded(p,n),s&&this._emitOnLoaded(m,r)):(s=null==p?void 0:p.data,l=(null==p||null===(g=p.response)||void 0===g?void 0:g.url)||r,s&&this._emitOnLoaded(p,r)),e.next=22;break;case 19:throw e.prev=19,e.t0=e.catch(3),ks.network(e.t0);case 22:if(b=this.hls.config.onPreM3U8Parse,e.prev=23,b&&(o=b(o)||o,a&&(a=b(a,!0)||a),s&&(s=b(s,!0)||s)),A=zc.parse(o,u,this._useLowLatency),!1!==(null===(S=A)||void 0===S?void 0:S.live)||!A.segments||A.segments.length){e.next=28;break}throw new Error("empty segments list");case 28:a&&(_=zc.parse(a,c,this._useLowLatency)),s&&(w=zc.parse(s,l,this._useLowLatency)),e.next=35;break;case 32:throw e.prev=32,e.t1=e.catch(23),new ks(ls,ws.HLS,e.t1);case 35:return A&&(A.isMaster?this.hls.emit(xc.HLS_MANIFEST_LOADED,{playlist:A}):this.hls.emit(xc.HLS_LEVEL_LOADED,{playlist:A})),e.abrupt("return",[A,_,w]);case 37:case"end":return e.stop()}}),e,this,[[3,19],[23,32]])}))),function(e,n,r){return t.apply(this,arguments)})},{key:"parseText",value:function(e,t){var n,r=this.hls.config.onPreM3U8Parse;try{var i;if(r&&(e=r(e)||e),!1===(null===(i=n=zc.parse(e,t,this._useLowLatency))||void 0===i?void 0:i.live)&&n.segments&&!n.segments.length)throw new Error("empty segments list")}catch(Sye){throw new ks(ls,ws.HLS,Sye)}return n&&(n.isMaster?this.hls.emit(xc.HLS_MANIFEST_LOADED,{playlist:n}):this.hls.emit(xc.HLS_LEVEL_LOADED,{playlist:n})),[n]}},{key:"poll",value:function(e,t,n,r,i,o){var a=this;clearTimeout(this._timer),o=o||3e3;var s=this.hls.config.pollRetryCount,u=function(){var c=wa(ba().mark((function c(){var l;return ba().wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return clearTimeout(a._timer),c.prev=1,c.next=4,a.load(e,t,n);case 4:if((l=c.sent)[0]){c.next=7;break}return c.abrupt("return");case 7:s=a.hls.config.pollRetryCount,r(l[0],l[1],l[2]),c.next=15;break;case 11:c.prev=11,c.t0=c.catch(1),--s<=0&&i(c.t0);case 15:a._timer=setTimeout(u,o);case 16:case"end":return c.stop()}}),c,null,[[1,11]])})));return function(){return c.apply(this,arguments)}}();this._timer=setTimeout(u,o)}},{key:"stopPoll",value:function(){return clearTimeout(this._timer),this.cancel()}},{key:"cancel",value:function(){return Promise.all([this._loader.cancel(),this._audioLoader.cancel()])}}]),e}();function qc(e,t,n){return t>n&&(n=t),Math.min(Math.max(e,t),n)}var $c=new Ls("playlist"),el=function(){function e(t,n,r){Sa(this,e),xa(this,"live",void 0),xa(this,"id",0),xa(this,"bitrate",0),xa(this,"width",0),xa(this,"height",0),xa(this,"name",""),xa(this,"url",""),xa(this,"audioCodec",""),xa(this,"videoCodec",""),xa(this,"textCodec",""),xa(this,"startCC",0),xa(this,"endCC",0),xa(this,"startSN",0),xa(this,"endSN",-1),xa(this,"totalDuration",0),xa(this,"targetDuration",0),xa(this,"partTargetDuration",0),xa(this,"canSkipUntil",0),xa(this,"canSkipDateRanges",!1),xa(this,"skippedSegments",0),xa(this,"canBlockReload",!1),xa(this,"partHoldBack",0),xa(this,"lowLatency",!1),xa(this,"endPartIndex",0),xa(this,"snDiff",null),xa(this,"segments",[]),xa(this,"audioStreams",[]),xa(this,"subtitleStreams",[]),xa(this,"closedCaptions",[]),xa(this,"currentAudioStream",null),xa(this,"currentSubtitleStream",null),this.update(this._setLLPlaybackPoint(t),n,r)}return Ta(e,[{key:"lastSegment",get:function(){return this.segments.length?this.segments[this.segments.length-1]:null}},{key:"segmentDuration",get:function(){var e;return this.targetDuration||(null===(e=this.segments[0])||void 0===e?void 0:e.duration)||0}},{key:"liveEdge",get:function(){return this.endTime}},{key:"endTime",get:function(){var e;return(null===(e=this.lastSegment)||void 0===e?void 0:e.end)||0}},{key:"currentSubtitleEndSn",get:function(){var e;return(null===(e=this.currentSubtitleStream)||void 0===e?void 0:e.endSN)||0}},{key:"clearOldSegment",value:function(e,t){return this.currentAudioStream&&this._clearSegments(e,t),this._clearSegments(e,t)}},{key:"getAudioSegment",value:function(e){if(e&&this.currentAudioStream){var t=e.sn-this.snDiff;return this.currentAudioStream.segments.find((function(e){return e.sn===t}))}}},{key:"update",value:function(e,t){this.url=e.url,Array.isArray(e.segments)?(null!==this.live&&void 0!==this.live||(this.live=e.live),this._updateSegments(e,this),this.startCC=e.startCC,this.endCC=e.endCC,this.startSN=e.startSN,this.endSN=e.endSN||-1,this.totalDuration=e.totalDuration,this.targetDuration=e.targetDuration,this.live=e.live,this.lowLatency=e.lowLatency,this.canBlockReload=e.canBlockReload,this.canSkipDateRanges=e.canSkipDateRanges,this.canSkipUntil=e.canSkipUntil,this.partHoldBack=e.partHoldBack,this.partTargetDuration=e.partTargetDuration,this.skippedSegments=e.skippedSegments,this.endPartIndex=e.endPartIndex,t&&this.currentAudioStream&&Array.isArray(t.segments)&&(this._updateSegments(t,this.currentAudioStream),(null===this.snDiff||void 0===this.snDiff)&&e.segments.length&&t.segments.length&&(this.snDiff=e.segments[0].sn-t.segments[0].sn))):(this.id=e.id,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.name=e.name,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.textCodec=e.textCodec,this.audioStreams=e.audioStreams,this.subtitleStreams=e.subtitleStreams,!this.currentAudioStream&&this.audioStreams.length&&(this.currentAudioStream=this.audioStreams.find((function(e){return e.default}))||this.audioStreams[0]),!this.currentSubtitleStream&&this.subtitleStreams.length&&(this.currentSubtitleStream=this.subtitleStreams.find((function(e){return e.default}))||this.subtitleStreams[0]))}},{key:"updateSubtitle",value:function(e){var t=this;if(e&&this.currentSubtitleStream&&Array.isArray(e.segments)){var n=this._updateSegments(e,this.currentSubtitleStream),r=this.currentSubtitleStream.segments;if(r.length>100&&(this.currentSubtitleStream.segments=r.slice(100)),n)return n.map((function(e){return{sn:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end,lang:t.currentSubtitleStream.lang}}))}}},{key:"switchSubtitle",value:function(e){var t=this.subtitleStreams.find((function(t){return t.lang===e})),n=this.currentSubtitleStream;t&&(this.currentSubtitleStream=t,n.segments=[])}},{key:"_setLLPlaybackPoint",value:function(e){if(!e.lowLatency||!e.segments.length)return e;for(var t=e.totalDuration-e.partHoldBack,n=e.segments,r=0,i=0,o=n.length;i<o;i++)n[i].start<=t&&n[i].independent&&(r=i);var a=n.slice(r),s=0;return a.forEach((function(e){e.start=s,s=e.end})),e.segments=a,e.totalDuration=s,e.startSN=a[0].sn,e.startCC=a[0].cc,$c.log("set ll-hls playback point: SN=".concat(e.startSN," partIndex=").concat(a[0].partIndex,", duration=").concat(s)),e}},{key:"_clearSegments",value:function(e,t){for(var n=0,r=this.segments,i=0,o=r.length;i<o;i++)if(r[i].end>=e){n=i;break}return n>t&&(n=t),n&&(this.segments=this.segments.slice(n),this.currentAudioStream&&(this.currentAudioStream.segments=this.currentAudioStream.segments.slice(n))),t-n}},{key:"_updateSegments",value:function(e,t){var n=t.segments;if(this.live){var r=e.lowLatency,i=n[n.length-1],o=(null==i?void 0:i.sn)||-1,a=(null==i?void 0:i.partIndex)||0,s=o<e.endSN&&e.segments.length;if(r&&(s=s||a<e.endPartIndex),s){$c.log("update segments: endSN:".concat(o,", partIndex:").concat(a," --\x3e endSN:").concat(e.endSN,", partIndex:").concat(e.endPartIndex));var u=e.segments.findIndex((function(e){return e.sn===o&&e.partIndex===a})),c=u<0?e.segments:e.segments.slice(u+1);if(n.length&&c.length){var l=i.end,d=l;c.forEach((function(e){e.start=l,l=e.end})),$c.log("liveEdge: ".concat(d," -> ").concat(l));var h=(null==i?void 0:i.cc)||-1;h>c[0].cc&&c.forEach((function(e){return e.cc+=h}))}return t.endSN=e.endSN,t.segments=n.concat(c),c}}else t.segments=e.segments}}]),e}(),tl=function(){function e(t){Sa(this,e),xa(this,"streams",[]),xa(this,"currentStream",null),xa(this,"dvrWindow",0),xa(this,"_segmentPointer",-1),this.hls=t}return Ta(e,[{key:"lowLatency",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.lowLatency}},{key:"lastSegment",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.lastSegment}},{key:"currentSegment",get:function(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer]}},{key:"nextSegment",get:function(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer+1]}},{key:"currentSegments",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.segments}},{key:"currentSubtitleEndSn",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.currentSubtitleEndSn}},{key:"liveEdge",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.liveEdge}},{key:"totalDuration",get:function(){var e;return(null===(e=this.currentStream)||void 0===e?void 0:e.totalDuration)||0}},{key:"seekRange",get:function(){var e=this.currentSegments;if(e&&e.length)return[e[0].start,e[e.length-1].end]}},{key:"nbSegments",get:function(){var e;return(null===(e=this.currentSegments)||void 0===e?void 0:e.length)||0}},{key:"isEmpty",get:function(){var e;return!(null!==(e=this.currentSegments)&&void 0!==e&&e.length)}},{key:"isLive",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.live}},{key:"hadSegmentLoaded",get:function(){return-1!==this._segmentPointer}},{key:"hasSubtitle",get:function(){var e;return!(null===(e=this.currentStream)||void 0===e||!e.currentSubtitleStream)}},{key:"getAudioSegment",value:function(e){var t;return null===(t=this.currentStream)||void 0===t?void 0:t.getAudioSegment(e)}},{key:"moveSegmentPointer",value:function(e){var t;null==e&&(e=this._segmentPointer+1),this._segmentPointer=qc(e,-1,null===(t=this.currentSegments)||void 0===t?void 0:t.length)}},{key:"reset",value:function(){this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1}},{key:"getSegmentByIndex",value:function(e){var t;return null===(t=this.currentSegments)||void 0===t?void 0:t[e]}},{key:"setNextSegmentByIndex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._segmentPointer=e-1}},{key:"findSegmentIndexByTime",value:function(e){var t=this.currentSegments;if(t){for(var n,r=0,i=t.length;r<i;r++)if(e>=(n=t[r]).start&&e<n.end)return r;var o=t[t.length-1];if(Math.abs(e-(null==o?void 0:o.end))<.2)return t.length-1}}},{key:"upsertPlaylist",value:function(e,t,n){var r=this;if(e){if(e.isMaster)this.streams.length=e.streams.length,e.streams.filter((function(e){return e.url})).forEach((function(e,t){r.streams[t]?r.streams[t].update(e):r.streams[t]=new el(e)})),this.currentStream=this.streams[0];else if(Array.isArray(e.segments)){var i=this.currentStream;if(i){i.update(e,t,n);var o=i.updateSubtitle(n);o&&this.hls.emit(xc.SUBTITLE_SEGMENTS,{list:o})}else this.reset(),this.currentStream=this.streams[0]=new el(e,t,n)}this.currentStream&&this.hls.isLive&&!this.dvrWindow&&(this.dvrWindow=this.currentSegments.reduce((function(e,t){return e+=t.duration}),0))}}},{key:"switchSubtitle",value:function(e){var t;null===(t=this.currentStream)||void 0===t||t.switchSubtitle(e)}},{key:"clearOldSegment",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,t=this.currentStream;if(this.dvrWindow&&t){var n=t.endTime-this.dvrWindow;if(!(n<=0))t.segments.length<=e||(this._segmentPointer=t.clearOldSegment(n,this._segmentPointer))}}},{key:"checkSegmentTrackChange",value:function(e,t){var n=this.findSegmentIndexByTime(e),r=this.getSegmentByIndex(n);if(r&&(r.hasAudio||r.hasVideo)){if(2!==t&&r.hasAudio&&r.hasVideo)return r;if(!(r.end-e>.3)){var i=this.getSegmentByIndex(n+1);if(i&&(i.hasAudio||i.hasVideo))return i.hasAudio!==r.hasAudio||i.hasVideo!==r.hasVideo?i:void 0}}}}]),e}(),nl=function(){function e(t){var n=this;Sa(this,e),xa(this,"error",null),xa(this,"_emitOnLoaded",(function(e,t){var r=e.data,i=e.response,o=e.options||{},a=o.firstByteTime,s=o.startTime,u=o.endTime,c=o.contentLength,l=u-s;n._bandwidthService.addRecord(c||r.byteLength,l),n.hls.emit(zs.SPEED,{time:l,byteLength:c,url:t}),n.hls.emit(zs.LOAD_COMPLETE,{url:t,elapsed:l||0}),n.hls.emit(zs.TTFB,{url:t,responseUrl:i.url,elapsed:a-s}),n.hls.emit(zs.LOAD_RESPONSE_HEADERS,{headers:i.headers,url:t})})),xa(this,"_onLoaderRetry",(function(e,t){n.hls.emit(zs.LOAD_RETRY,{error:ks.network(e),retryTime:t})})),this.hls=t,this._bandwidthService=new su,this._mapCache={},this._keyCache={};var r=this.hls.config,i=r.retryCount,o=r.retryDelay,a=r.loadTimeout,s=r.fetchOptions;this._segmentLoader=new iu(ga(ga({},s),{},{responseType:"arraybuffer",retry:i,retryDelay:o,timeout:a,onRetryError:this._onLoaderRetry})),this._audioSegmentLoader=new iu(ga(ga({},s),{},{responseType:"arraybuffer",retry:i,retryDelay:o,timeout:a,onRetryError:this._onLoaderRetry})),this._keyLoader=new iu(ga(ga({},s),{},{responseType:"arraybuffer",retry:i,retryDelay:o,timeout:a,onRetryError:this._onLoaderRetry}))}var t,n;return Ta(e,[{key:"speedInfo",value:function(){return{speed:this._bandwidthService.getLatestSpeed(),avgSpeed:this._bandwidthService.getAvgSpeed()}}},{key:"load",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n,i=[];return e&&(i[0]=this.loadVideoSegment(e,n)),t&&(i[1]=this.loadAudioSegment(t,r)),Promise.all(i)}},{key:"loadVideoSegment",value:function(e,t){return this._loadSegment(this._segmentLoader,e,t)}},{key:"loadAudioSegment",value:function(e,t){return this._loadSegment(this._audioSegmentLoader,e,t)}},{key:"_loadSegment",value:(n=wa(ba().mark((function e(t,n,r){var i,o,a,s,u,c,l,d,h,f,p,m,y,v,g,b=this;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=[],this.hls.emit(zs.LOAD_START,{url:n.url}),l[0]=t.load(n.url),r&&n.initSegment&&(h=n.initSegment.url,(o=this._mapCache[h])||(this.hls.emit(zs.LOAD_START,{url:h}),l[1]=t.load(h).then((function(e){e&&(Object.keys(b._mapCache)>30&&(b._mapCache={}),o=b._mapCache[h]=e.data,b._emitOnLoaded(e,h))}))),(f=null===(d=n.initSegment.key)||void 0===d?void 0:d.url)&&(c=n.initSegment.key.iv,(u=this._keyCache[f])||(this.hls.emit(zs.LOAD_START,{url:f}),l[2]=this._keyLoader.load(f).then((function(e){e&&(u=b._keyCache[f]=e.data,b._emitOnLoaded(e,f))}))))),(p=null===(i=n.key)||void 0===i?void 0:i.url)&&(s=n.key.iv,(a=this._keyCache[p])||(this.hls.emit(zs.LOAD_START,{url:p}),l[3]=this._keyLoader.load(p).then((function(e){e&&(a=b._keyCache[p]=e.data,b._emitOnLoaded(e,p))})))),e.next=8,Promise.all(l);case 8:if(m=e.sent,y=Ca(m,1),v=y[0]){e.next=13;break}return e.abrupt("return");case 13:return g=v.data,this._emitOnLoaded(v,n.url),e.abrupt("return",{data:g,map:o,key:a,mapKey:u,keyIv:s,mapKeyIv:c});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"reset",value:function(){this.error=null,this._mapCache={},this._keyCache={},this._bandwidthService.reset()}},{key:"cancel",value:(t=wa(ba().mark((function e(){return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this._keyLoader.cancel(),this._segmentLoader.cancel(),this._audioSegmentLoader.cancel()]);case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),rl=new Ls("hls"),il=function(e){Ea(y,e);var t,n,r,i,o,a,s,u,c,l,d,h,f,p,m=Za(y);function y(e){var t,n,r;return Sa(this,y),xa(Ra(t=m.call(this)),"version",y.version),xa(Ra(t),"media",null),xa(Ra(t),"config",null),xa(Ra(t),"_manifestLoader",null),xa(Ra(t),"_segmentLoader",null),xa(Ra(t),"_playlist",null),xa(Ra(t),"_bufferService",null),xa(Ra(t),"_gapService",null),xa(Ra(t),"_seiService",null),xa(Ra(t),"_stats",null),xa(Ra(t),"_prevSegSn",null),xa(Ra(t),"_prevSegCc",null),xa(Ra(t),"_tickTimer",null),xa(Ra(t),"_tickInterval",500),xa(Ra(t),"_segmentProcessing",!1),xa(Ra(t),"_reloadOnPlay",!1),xa(Ra(t),"_switchUrlOpts",null),xa(Ra(t),"_isProcessQuotaExceeded",!1),xa(Ra(t),"_loadSegment",wa(ba().mark((function e(){var n,r,i;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t._segmentProcessing&&t.media){e.next=2;break}return e.abrupt("return");case 2:if(n=t._playlist.nextSegment){e.next=5;break}return e.abrupt("return");case 5:if(t.isLive){e.next=13;break}if(r=t.bufferInfo(),t.media.paused&&!t.media.currentTime&&(r=t.bufferInfo(r.nextStart||.5)),i=Math.abs(r.end-t.media.duration)<.1,!(r.remaining>=t.config.preloadTime||i)){e.next=12;break}return i&&t._bufferService.msIsOpend&&t._bufferService.endOfStream(),e.abrupt("return");case 12:!t._urlSwitching&&t._prevSegSn!==n.sn-1&&r.end&&Math.abs(n.start-r.end)>1&&t._playlist.setNextSegmentByIndex(t._playlist.findSegmentIndexByTime(r.end+.1));case 13:return e.abrupt("return",t._loadSegmentDirect());case 14:case"end":return e.stop()}}),e)})))),xa(Ra(t),"_onPlay",wa(ba().mark((function e(){return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.media.seeking||0!==t.media.currentTime){e.next=3;break}return rl.debug("replay currentTime 0, return"),e.abrupt("return");case 3:if(clearTimeout(t._disconnectTimer),!t._reloadOnPlay){e.next=9;break}t._reloadOnPlay=!1,t.replay(!0),e.next=12;break;case 9:return e.next=11,t._loadSegment();case 11:t._startTick();case 12:case"end":return e.stop()}}),e)})))),xa(Ra(t),"_onPause",(function(){if(t.isLive){if(!t._reloadOnPlay){var e=t.config.disconnectTime;if(null==e&&(e=t._playlist.dvrWindow),!Number.isFinite(e))return;clearTimeout(t._disconnectTimer),t._disconnectTimer=setTimeout((function(){t._reloadOnPlay=!0,t._clear()}),e||0)}}else t._stopTick()})),xa(Ra(t),"_onSeeking",wa(ba().mark((function e(){var n,r,i,o,a,s,u;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.media){e.next=2;break}return e.abrupt("return");case 2:if(t._onCheckQuotaExceeded(),n=t.media.currentTime,!(r=t._playlist.seekRange)){e.next=10;break}if(!((i=qc(n,r[0],t.isLive?r[1]:t.media.duration))>=0&&Math.abs(n-i)>=.1)){e.next=10;break}return t.media.currentTime=i,e.abrupt("return");case 10:if(o=t._playlist.currentSegment,a=cs.info(cs.get(t.media),n,.1),!o){e.next=15;break}if(!(a.end&&Math.abs(a.end-o.end)<.2)){e.next=15;break}return e.abrupt("return");case 15:if(s=t._playlist.findSegmentIndexByTime(n),u=t._playlist.getSegmentByIndex(s),null!=s&&u&&(!t._segmentProcessing||u!==t._playlist.nextSegment)){e.next=19;break}return e.abrupt("return");case 19:return rl.debug("seek to",n,u),t._playlist.setNextSegmentByIndex(s),t._stopTick(),e.next=24,t._segmentLoader.cancel();case 24:if(t._segmentProcessing=!1,a.end&&!t.isLive){e.next=28;break}return e.next=28,t._loadSegmentDirect(!0);case 28:t._startTick();case 29:case"end":return e.stop()}}),e)})))),xa(Ra(t),"_onTimeupdate",(function(){if(t.media){var e,n=t.config;if(n.isLive&&n.maxLatency&&n.targetLatency&&t.media){var r=t._playlist.liveEdge;if(!r)return;var i=r-t.media.currentTime;i>=n.maxLatency&&(rl.debug("latency jump, currentTime:".concat(t.media.currentTime,", liveEdge:").concat(r,", latency=").concat(i)),t.media.currentTime=r-n.targetLatency)}if(n.seiInTime)null===(e=t._seiService)||void 0===e||e.throw(t.media.currentTime);t.config.allowedStreamTrackChange&&!t.config.softDecode&&t._checkStreamTrackChange(t.media.currentTime)}})),xa(Ra(t),"_tick",(function(){if(t.media){t._startTick();var e=t.media,n=cs.get(e),r=t._segmentLoader.error;if(t._onCheckQuotaExceeded(),t._isProcessQuotaExceeded&&(t._bufferService.isFull()||(t._isProcessQuotaExceeded=!1,t._segmentProcessing=!1)),r){(!e.readyState||t.bufferInfo(.5).remaining<1)&&(r.fatal=!0,t._emitError(ks.network(r)))}else cs.end(n)<.1||!e.readyState||(!function(e){return e&&!e.paused&&!e.ended&&0!==e.playbackRate&&0!==e.readyState}(e)?e.readyState<2&&t._gapService&&t._gapService.do(e,t.config.maxJumpDistance,!e.currentTime||t.isLive):(t._loadSegment(),t._gapService&&t._gapService.do(e,t.config.maxJumpDistance,t.isLive)))}})),t.config=(r=(null==(n=e)?void 0:n.media)||document.createElement("video"),e=ga(ga({maxPlaylistSize:50,retryCount:3,retryDelay:1e3,pollRetryCount:2,loadTimeout:1e4,manifestLoadTimeout:1e4,preloadTime:30,softDecode:!1,bufferBehind:10,maxJumpDistance:3,startTime:0,useLowLatency:!0,targetLatency:10,maxLatency:20,allowedStreamTrackChange:!0,seiInTime:!1,manifestList:[],minSegmentsStartPlay:3},n),{},{media:r})),t.media=t.config.media,t._manifestLoader=new Qc(Ra(t)),t._segmentLoader=new nl(Ra(t)),t._playlist=new tl(Ra(t)),t._bufferService=new Rc(Ra(t)),e.seiInTime&&(t._seiService=new au(Ra(t))),e.softDecode||(t._gapService=new ou),t._stats=new cu(Ra(t),9e4),t.media.addEventListener("play",t._onPlay),t.media.addEventListener("pause",t._onPause),t.media.addEventListener("seeking",t._onSeeking),t.media.addEventListener("timeupdate",t._onTimeupdate),t}return Ta(y,[{key:"isLive",get:function(){return this._playlist.isLive}},{key:"streams",get:function(){return this._playlist.streams}},{key:"currentStream",get:function(){return this._playlist.currentStream}},{key:"hasSubtitle",get:function(){return this._playlist.hasSubtitle}},{key:"baseDts",get:function(){var e;return null===(e=this._bufferService)||void 0===e?void 0:e.baseDts}},{key:"speedInfo",value:function(){return this._segmentLoader.speedInfo()}},{key:"bufferInfo",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.1;return cs.info(cs.get(this.media),null===(e=this.media)||void 0===e?void 0:e.currentTime,t)}},{key:"getStats",value:function(){return this._stats.getStats()}},{key:"playbackQuality",value:function(){return function(e){if(!e)return{};if("function"==typeof e.getVideoPlaybackQuality){var t=e.getVideoPlaybackQuality();return{droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}return{droppedVideoFrames:e.webkitDroppedFrameCount,totalVideoFrames:e.webkitDecodedFrameCount,creationTime:performance.now()}}(this.media)}},{key:"load",value:(p=wa(ba().mark((function e(t){var n,r=arguments;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.length>1&&void 0!==r[1]&&r[1],t&&(this.config.url=t),t=this.config.url,e.next=5,this._reset(n);case 5:return e.next=7,this._loadData(t);case 7:this._startTick();case 8:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"_loadData",value:(f=wa(ba().mark((function e(t){var n,r,i,o,a,s,u,c,l,d;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{t&&(t=t.trim())}catch(h){}if(t){e.next=3;break}throw this._emitError(new ks(As,ws.OPTION,null,null,"m3u8 url is missing"));case 3:return e.next=5,this._loadM3U8(t);case 5:if(n=e.sent,r=this._playlist.currentStream,!this._urlSwitching){e.next=17;break}if(0===r.bitrate&&null!==(i=this._switchUrlOpts)&&void 0!==i&&i.bitrate&&(r.bitrate=null===(o=this._switchUrlOpts)||void 0===o?void 0:o.bitrate),a=this._getSeamlessSwitchPoint(),this.config.startTime=a,s=this._playlist.findSegmentIndexByTime(a),!(u=this._playlist.getSegmentByIndex(s+1))){e.next=17;break}return c=u.start,e.next=17,this._bufferService.removeBuffer(c);case 17:if(n){e.next=19;break}return e.abrupt("return");case 19:if(!this.isLive){e.next=30;break}if(this._bufferService.setLiveSeekableRange(0,4294967295),rl.log("totalDuration first time got:",this._playlist.totalDuration),rl.log("nb segments got:",this._playlist.nbSegments),this.config.targetLatency<this._playlist.totalDuration&&(this.config.targetLatency=this._playlist.totalDuration,this.config.maxLatency=1.5*this.config.targetLatency),n.isMaster||this._pollM3U8(t),!(this._playlist.nbSegments<this.config.minSegmentsStartPlay)){e.next=27;break}return e.abrupt("return");case 27:return e.next=29,this._loadSegment();case 29:return e.abrupt("return");case 30:return e.next=32,this._bufferService.updateDuration(r.totalDuration);case 32:return(l=this.config.startTime)&&(null!==(d=this._switchUrlOpts)&&void 0!==d&&d.seamless||(this.media.currentTime=l),this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(l)||0)),e.next=36,this._loadSegment();case 36:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"replay",value:(h=wa(ba().mark((function e(t){return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.config.startTime=0,e.next=3,this.load();case 3:return this._reloadOnPlay=!1,e.abrupt("return",this.media.play(!t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"switchURL",value:(d=wa(ba().mark((function e(t){var n,r,i,o,a,s,u,c=arguments;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=c.length>1&&void 0!==c[1]?c[1]:{},r={seamless:!1,startTime:0,bitrate:0},e.t0=Aa(n),e.next="number"===e.t0?5:"boolean"===e.t0?7:"object"===e.t0?9:11;break;case 5:return n={startTime:n},e.abrupt("break",12);case 7:return n={seamless:n},e.abrupt("break",12);case 9:for(i in n)void 0!==n[i]&&null!==n[i]||delete n[i];return e.abrupt("break",12);case 11:throw"unsupported switchURL args: ".concat(n);case 12:if(n=Object.assign({},r,n),a=(o=n).seamless,s=o.startTime,this.config.url=t,this.config.startTime=s,this._switchUrlOpts=n,a){e.next=38;break}if(e.prev=18,!this.config.softDecode){e.next=23;break}e.t1=this.load(t),e.next=26;break;case 23:return e.next=25,this.load(t);case 25:e.t1=e.sent;case 26:u=e.t1,e.next=33;break;case 29:throw e.prev=29,e.t2=e.catch(18),this.emit(xc.SWITCH_URL_FAILED,e.t2),e.t2;case 33:return this._reloadOnPlay=!1,u&&this.emit(xc.SWITCH_URL_SUCCESS,{url:t}),e.abrupt("return",this.media.play(!0));case 38:return this._urlSwitching=!0,this._prevSegSn=null,this._prevSegCc=null,this._playlist.reset(),this._bufferService.seamlessSwitch(),e.next=45,this._clear();case 45:return e.next=47,this._loadData(t);case 47:this._startTick();case 48:this._switchUrlOpts=null;case 49:case"end":return e.stop()}}),e,this,[[18,29]])}))),function(e){return d.apply(this,arguments)})},{key:"switchStream",value:(l=wa(ba().mark((function e(t){var n,r,i,o,a,s=arguments;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(s.length>1&&void 0!==s[1])||s[1],r=this.currentStream,i=this.streams,r&&r.id!==t&&i&&!(i.length<2)){e.next=5;break}return e.abrupt("return");case 5:if(o=i.find((function(e){return e.id===t}))){e.next=8;break}return e.abrupt("return");case 8:return e.prev=8,e.next=11,this._clear();case 11:if(!n){e.next=14;break}return e.next=14,this._bufferService.clearAllBuffer();case 14:e.next=19;break;case 16:throw e.prev=16,e.t0=e.catch(8),this._emitError(ks.create(e.t0));case 19:if(r.currentAudioStream&&o.audioStreams.length>2&&(a=r.currentAudioStream.id,o.currentAudioStream=o.audioStreams.find((function(e){return e.id===a}))||o.currentAudioStream),this._playlist.currentStream=o,e.prev=21,!this.isLive&&o.segments.length){e.next=25;break}return e.next=25,this._refreshM3U8();case 25:return this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(this.media.currentTime)||0),this._prevSegCc=null,e.next=29,this._loadSegmentDirect();case 29:e.next=35;break;case 31:throw e.prev=31,e.t1=e.catch(21),this._playlist.currentStream=r,e.t1;case 35:return this._startTick(),e.abrupt("return",o);case 37:case"end":return e.stop()}}),e,this,[[8,16],[21,31]])}))),function(e){return l.apply(this,arguments)})},{key:"switchAudioStream",value:(c=wa(ba().mark((function e(t){var n,r,i,o,a=arguments;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(a.length>1&&void 0!==a[1])||a[1],r=this.currentStream){e.next=4;break}return e.abrupt("return");case 4:if((i=r.currentAudioStream)&&i.id!==t&&!(r.audioStreams.length<2)){e.next=7;break}return e.abrupt("return");case 7:if(o=r.audioStreams.find((function(e){return e.id===t}))){e.next=10;break}return e.abrupt("return");case 10:return e.prev=10,e.next=13,this._clear();case 13:if(!n){e.next=16;break}return e.next=16,this._bufferService.clearAllBuffer();case 16:e.next=21;break;case 18:throw e.prev=18,e.t0=e.catch(10),this._emitError(ks.create(e.t0));case 21:if(r.currentAudioStream=o,e.prev=22,!this.isLive&&o.segments.length){e.next=26;break}return e.next=26,this._refreshM3U8();case 26:return this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(this.media.currentTime)||0),this._prevSegCc=null,e.next=30,this._loadSegmentDirect();case 30:e.next=36;break;case 32:throw e.prev=32,e.t1=e.catch(22),r.currentAudioStream=i,e.t1;case 36:return this._startTick(),e.abrupt("return",o);case 38:case"end":return e.stop()}}),e,this,[[10,18],[22,32]])}))),function(e){return c.apply(this,arguments)})},{key:"switchSubtitleStream",value:(u=wa(ba().mark((function e(t){return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._playlist.switchSubtitle(t),e.next=3,this._manifestLoader.stopPoll();case 3:return e.next=5,this._refreshM3U8();case 5:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"destroy",value:(s=wa(ba().mark((function e(){var t;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.media){e.next=2;break}return e.abrupt("return");case 2:return this.removeAllListeners(),this._playlist.reset(),this._segmentLoader.reset(),null===(t=this._seiService)||void 0===t||t.reset(),this.media.removeEventListener("play",this._onPlay),this.media.removeEventListener("pause",this._onPause),this.media.removeEventListener("seeking",this._onSeeking),this.media.removeEventListener("timeupdate",this._onTimeupdate),e.next=12,Promise.all([this._clear(),this._bufferService.destroy()]);case 12:this.media=null;case 13:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"_loadM3U8",value:(a=wa(ba().mark((function e(t){var n,r,i,o,a,s,u;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(o=null===(r=this.config.manifestList)||void 0===r||null===(i=r.filter((function(e){return e.url===t}))[0])||void 0===i?void 0:i.manifest)){e.next=6;break}e.t0=this._manifestLoader.parseText(o,t),e.next=9;break;case 6:return e.next=8,this._manifestLoader.load(t);case 8:e.t0=e.sent;case 9:a=e.t0,s=Ca(a,1),n=s[0],e.next=17;break;case 14:throw e.prev=14,e.t1=e.catch(0),this._emitError(ks.create(e.t1));case 17:if(n){e.next=19;break}return e.abrupt("return");case 19:if(this._playlist.upsertPlaylist(n),!n.isMaster){e.next=24;break}return null!==(u=this._playlist.currentStream.subtitleStreams)&&void 0!==u&&u.length&&this.emit(xc.SUBTITLE_PLAYLIST,{list:this._playlist.currentStream.subtitleStreams}),e.next=24,this._refreshM3U8();case 24:return this.emit(xc.STREAM_PARSED),e.abrupt("return",n);case 26:case"end":return e.stop()}}),e,this,[[0,14]])}))),function(e){return a.apply(this,arguments)})},{key:"_refreshM3U8",value:function(){var e,t,n=this,r=this._playlist.currentStream;if(!r||!r.url)throw this._emitError(ks.create(null,null,new Error("m3u8 url is not defined")));var i=r.url,o=null===(e=r.currentAudioStream)||void 0===e?void 0:e.url,a=null===(t=r.currentSubtitleStream)||void 0===t?void 0:t.url;return this._manifestLoader.load(i,o,a).then((function(e){var t=Ca(e,3),r=t[0],s=t[1],u=t[2];r&&(n._playlist.upsertPlaylist(r,s,u),n.isLive&&n._pollM3U8(i,o,a))})).catch((function(e){throw n._emitError(ks.create(e))}))}},{key:"_pollM3U8",value:function(e,t,n){var r,i,o=this,a=this._playlist.isEmpty;this._playlist.lowLatency?r=1e3*(2*this._playlist.currentStream.partTargetDuration||0):r=1e3*((null===(i=this._playlist.lastSegment)||void 0===i?void 0:i.duration)||0);this._manifestLoader.poll(e,t,n,(function(e,t,n){o._playlist.upsertPlaylist(e,t,n),o._playlist.clearOldSegment(),(e&&a&&!o._playlist.isEmpty||!o._playlist.hadSegmentLoaded&&o._playlist.nbSegments>=o.config.minSegmentsStartPlay)&&o._loadSegment(),a&&(a=o._playlist.isEmpty)}),(function(e){o._emitError(ks.create(e))}),r)}},{key:"_loadSegmentDirect",value:(o=wa(ba().mark((function e(t){var n,r,i;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._playlist.nextSegment){e.next=3;break}return e.abrupt("return");case 3:return r=!1,i=null,e.prev=5,this._segmentProcessing=!0,rl.log("load segment, sn:".concat(n.sn,", partIndex:").concat(n.partIndex)),e.next=10,this._reqAndBufferSegment(n,this._playlist.getAudioSegment(n));case 10:r=e.sent,e.next=16;break;case 13:e.prev=13,e.t0=e.catch(5),i=e.t0;case 16:return e.prev=16,this._segmentProcessing=!1,e.finish(16);case 19:if(!i){e.next=26;break}if(!this._bufferService.isFull()){e.next=25;break}return rl.log("load segment, sn:".concat(n.sn,", partIndex:").concat(n.partIndex)),this._segmentProcessing=!0,this._isProcessQuotaExceeded=!0,e.abrupt("return",!1);case 25:return e.abrupt("return",this._emitError(ks.create(i)));case 26:return r&&(this._urlSwitching&&(this._urlSwitching=!1,this.emit(xc.SWITCH_URL_SUCCESS,{url:this.config.url})),this._playlist.moveSegmentPointer(),n.isLast?this._end():t||this._loadSegment()),e.abrupt("return",r);case 28:case"end":return e.stop()}}),e,this,[[5,13,16,19]])}))),function(e){return o.apply(this,arguments)})},{key:"_reqAndBufferSegment",value:(i=wa(ba().mark((function e(t,n){var r,i,o,a,s,u,c,l,d;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t?t.cc:n.cc,o=this._prevSegCc!==i,a=[],e.prev=3,e.next=6,this._segmentLoader.load(t,n,o);case 6:a=e.sent,e.next=14;break;case 9:throw e.prev=9,e.t0=e.catch(3),e.t0.fatal=!1,this._segmentLoader.error=e.t0,e.t0;case 14:if(a[0]){e.next=16;break}return e.abrupt("return");case 16:return e.next=18,(r=this._bufferService).decryptBuffer.apply(r,Pa(a));case 18:if(s=e.sent){e.next=21;break}return e.abrupt("return");case 21:return u=t?t.sn:n.sn,c=t?t.start:n.start,l=this._playlist.currentStream,this._bufferService.createSource(s[0],s[1],null==l?void 0:l.videoCodec,null==l?void 0:l.audioCodec),d=Date.now(),e.next=28,this._bufferService.appendBuffer(t,n,s[0],s[1],o,this._prevSegSn===u-1,c);case 28:return this.emit(xc.APPEND_COST,{elapsed:Date.now()-d,url:t.url}),e.next=31,this._bufferService.evictBuffer(this.config.bufferBehind);case 31:return this._prevSegCc=i,this._prevSegSn=u,e.abrupt("return",!0);case 34:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e,t){return i.apply(this,arguments)})},{key:"_onCheckQuotaExceeded",value:(r=wa(ba().mark((function e(){var t,n,r,i,o,a;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.media.currentTime,n=this.media.buffered,r=!1,i=0;case 4:if(!(i<n.length)){e.next=11;break}if(!(n.start(0)>=t&&t<n.end(i))){e.next=8;break}return r=!0,e.abrupt("break",11);case 8:i++,e.next=4;break;case 11:if(!this._bufferService.isFull()){e.next=17;break}if(o=r?this.config.bufferBehind:5,!((a=this.media.currentTime)-o>0)){e.next=17;break}return e.next=17,this._bufferService.removeBuffer(0,a-o);case 17:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_checkStreamTrackChange",value:function(e){var t=this._playlist.checkSegmentTrackChange(e,this._bufferService.nbSb);t&&this.switchURL(this.config.url,t.start+.2)}},{key:"_clear",value:(n=wa(ba().mark((function e(){return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._disconnectTimer),this._stopTick(),e.next=4,Promise.all([this._segmentLoader.cancel(),this._manifestLoader.stopPoll()]);case 4:this._segmentProcessing=!1;case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"_reset",value:(t=wa(ba().mark((function e(){var t,n,r=arguments;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.length>0&&void 0!==r[0]&&r[0],this._reloadOnPlay=!1,this._prevSegSn=null,this._prevSegCc=null,this._switchUrlOpts=null,this._playlist.reset(),this._segmentLoader.reset(),null===(t=this._seiService)||void 0===t||t.reset(),this._stats.reset(),e.next=11,this._clear();case 11:return e.abrupt("return",this._bufferService.reset(n));case 12:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_end",value:function(){this._clear(),this._bufferService.endOfStream(),(this.media.readyState<=2||this.media.buffered.length>1)&&this._startTick()}},{key:"_stopTick",value:function(){this._tickTimer&&clearTimeout(this._tickTimer),this._tickTimer=null}},{key:"_startTick",value:function(){this._stopTick(),this._tickTimer=setTimeout(this._tick,this._tickInterval)}},{key:"_emitError",value:function(e){var t,n,r,i,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!1===(null===(t=e.originError)||void 0===t?void 0:t.fatal)?rl.warn(e):(rl.table(e),rl.error(e),rl.error(null===(n=this.media)||void 0===n?void 0:n.error),null!==(r=this.media)&&void 0!==r&&r.readyState&&this.media.pause(),this._stopTick(),this._urlSwitching&&(this._urlSwitching=!1,this.emit(xc.SWITCH_URL_FAILED,e)),this.emit(xc.ERROR,e),o&&this._end(),null===(i=this._seiService)||void 0===i||i.reset());return e}},{key:"_getSeamlessSwitchPoint",value:function(){var e=this.media,t=e.currentTime;if(!e.paused){var n,r=this._playlist.findSegmentIndexByTime(e.currentTime),i=this._playlist.getSegmentByIndex(r),o=null===(n=this._stats)||void 0===n?void 0:n.getStats().downloadSpeed;if(o&&i)t+=i.duration*this._playlist.currentStream.bitrate/o+1;else t+=5}return t}}],[{key:"isSupported",value:function(e){return e&&"video"!==e&&"audio"!==e?"undefined"!=typeof WebAssembly:Ms.isSupported()}},{key:"enableLogger",value:function(){Ls.enable(),Fu.enable()}},{key:"disableLogger",value:function(){Ls.disable(),Fu.disable()}}]),y}(P);xa(il,"version","3.0.12");try{localStorage.getItem("xgd")?il.enableLogger():il.disableLogger()}catch(Sye){}var ol=function(){function e(t,n){var r=this;Sa(this,e),xa(this,"_opts",null),xa(this,"_plugin",null),xa(this,"_onLowDecode",(function(){var e,t,n,i,o=r._opts,a=o.media,s=o.innerDegrade;null===(e=r._plugin)||void 0===e||null===(t=e.player)||void 0===t||t.emit("lowdecode",a.degradeInfo),null===(n=r._plugin)||void 0===n||null===(i=n.player)||void 0===i||i.emit("core_event",ga(ga({},a.degradeInfo),{},{eventName:xc.LOWDECODE})),1===s&&r._degrade(a.src)})),xa(this,"_degrade",(function(e){var t=r._plugin.player,n=t.video;if(!n||"MVideo"===n.TAG){var i=t.video.degradeVideo;t.video=i,n.degrade(e),e&&(t.config.url=e);var o=t.root.firstChild;"MVideo"===o.TAG&&t.root.replaceChild(i,o);var a=r._plugin.constructor.pluginName.toLowerCase();t.unRegisterPlugin(a),t.once("canplay",(function(){t.play()}))}})),xa(this,"forceDegradeToVideo",(function(e){1===r._opts.innerDegrade&&r._degrade(e)})),this._opts=t,this._plugin=n,this._init()}return Ta(e,[{key:"_init",value:function(){var e=this._opts,t=e.media,n=e.preloadTime,r=e.innerDegrade,i=e.isLive;t&&(i||!t.setPlayMode?(r&&t.setAttribute("innerdegrade",r),n&&t.setAttribute("preloadtime",n),this._bindEvents()):t.setPlayMode("VOD"))}},{key:"_bindEvents",value:function(){this._opts.media.addEventListener("lowdecode",this._onLowDecode)}},{key:"destroy",value:function(){var e,t;null===(e=this._opts)||void 0===e||null===(t=e.media)||void 0===t||t.removeEventListener("lowdecode",this._onLowDecode),this._plugin=null}}]),e}();var al=function(e){Ea(n,e);var t=Za(n);function n(){var e;Sa(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return xa(Ra(e=t.call.apply(t,[this].concat(i))),"hls",null),xa(Ra(e),"pluginExtension",null),xa(Ra(e),"getStats",(function(){var t;return null===(t=e.hls)||void 0===t?void 0:t.getStats()})),xa(Ra(e),"_onSwitchSubtitle",(function(t){var n,r=t.lang;null===(n=e.hls)||void 0===n||n.switchSubtitleStream(r)})),xa(Ra(e),"_onSwitchURL",(function(t,n){var r=Ra(e),i=r.player,o=r.hls;if(o){var a,s,u=function(e,t){var n={startTime:t.player.currentTime};switch(Aa(e)){case"boolean":n.seamless=e;break;case"object":Object.assign(n,e)}return n}(n,Ra(e));i.config.url=t,o.switchURL(t,u).catch((function(e){})),!u.seamless&&null!==(a=e.player.config)&&void 0!==a&&null!==(s=a.hls)&&void 0!==s&&s.keepStatusAfterSwitch&&e._keepPauseStatus()}})),xa(Ra(e),"_keepPauseStatus",(function(){e.player.paused&&e.player.once("canplay",(function(){e.player.pause()}))})),e}return Ta(n,[{key:"core",get:function(){return this.hls}},{key:"version",get:function(){var e;return null===(e=this.hls)||void 0===e?void 0:e.version}},{key:"softDecode",get:function(){var e,t,n=null===(e=this.player)||void 0===e||null===(t=e.config)||void 0===t?void 0:t.mediaType;return!!n&&"video"!==n&&"audio"!==n}},{key:"beforePlayerInit",value:function(){var e=this,t=this.player.config;if(t.url||t.__allowHlsEmptyUrl__){this.hls&&this.hls.destroy(),this.player.switchURL=this._onSwitchURL;var n,r=t.hls||{};if(r.innerDegrade=r.innerDegrade||t.innerDegrade,null!==r.disconnectTime&&void 0!==r.disconnectTime||(r.disconnectTime=0),this.hls=new il(ga({softDecode:this.softDecode,isLive:t.isLive,media:this.player.media||this.player.video,startTime:t.startTime,url:t.url},r)),this.softDecode||ne.defineGetterOrSetter(this.player,{url:{get:function(){var t,n;return null===(t=e.hls)||void 0===t||null===(n=t.media)||void 0===n?void 0:n.src},configurable:!0}}),this.softDecode&&(this.pluginExtension=new ol(ga({isLive:t.isLive,media:this.player.video},r),this),this.player.forceDegradeToVideo=function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return null===(t=e.pluginExtension)||void 0===t?void 0:t.forceDegradeToVideo.apply(t,r)}),t.isLive)null===(n=this.player)||void 0===n||n.useHooks("replay",(function(){var t;return null===(t=e.hls)||void 0===t?void 0:t.replay()}));this.on("switch_subtitle",this._onSwitchSubtitle),this.on(J,this._onSwitchURL),this.on(B,this.destroy.bind(this)),this._transError(),this._transCoreEvent(zs.TTFB),this._transCoreEvent(zs.LOAD_START),this._transCoreEvent(zs.LOAD_RESPONSE_HEADERS),this._transCoreEvent(zs.LOAD_COMPLETE),this._transCoreEvent(zs.LOAD_RETRY),this._transCoreEvent(zs.SOURCEBUFFER_CREATED),this._transCoreEvent(zs.REMOVE_BUFFER),this._transCoreEvent(zs.BUFFEREOS),this._transCoreEvent(zs.KEYFRAME),this._transCoreEvent(zs.METADATA_PARSED),this._transCoreEvent(zs.DEMUXED_TRACK),this._transCoreEvent(zs.SEI),this._transCoreEvent(zs.SEI_IN_TIME),this._transCoreEvent(zs.SPEED),this._transCoreEvent(zs.HLS_MANIFEST_LOADED),this._transCoreEvent(zs.HLS_LEVEL_LOADED),this._transCoreEvent(zs.STREAM_EXCEPTION),this._transCoreEvent(zs.SWITCH_URL_SUCCESS),this._transCoreEvent(zs.SWITCH_URL_FAILED),this._transCoreEvent(xc.NO_AUDIO_TRACK),this._transCoreEvent(xc.STREAM_PARSED),this._transCoreEvent(xc.SUBTITLE_SEGMENTS),this._transCoreEvent(xc.SUBTITLE_PLAYLIST),this._transCoreEvent(xc.APPEND_COST),t.url&&this.hls.load(t.url,!0).catch((function(e){}))}}},{key:"destroy",value:function(){var e;this.hls&&(this.hls.destroy(),this.hls=null),null===(e=this.pluginExtension)||void 0===e||e.destroy(),this.pluginExtension=null}},{key:"_transError",value:function(){var e=this;this.hls.on(xc.ERROR,(function(t){e.player&&e.player.emit(H,new j(e.player,t))}))}},{key:"_transCoreEvent",value:function(e){var t=this;this.hls.on(e,(function(n){t.player&&(t.player.emit("core_event",ga(ga({},n),{},{eventName:e})),e===zs.SEI_IN_TIME&&t.hls.hasSubtitle&&t._emitSeiPaylodTime(n))}))}},{key:"_emitSeiPaylodTime",value:function(e){try{var t=JSON.parse(Array.from(e.data.payload).map((function(e){return String.fromCharCode(e)})).join("").slice(0,-1));if(!t.rtmp_dts)return;this.player.emit("core_event",{eventName:xc.SEI_PAYLOAD_TIME,time:t.rtmp_dts})}catch(n){}}}],[{key:"pluginName",get:function(){return"hls"}},{key:"isSupported",value:function(e,t){return il.isSupported(e,t)}}]),n}(ne);xa(al,"Hls",il),xa(al,"EVENT",xc);const sl=t.DynamicModule.PluginHls;var ul=Object.freeze({__proto__:null,HlsPlugin:al,__PLUGIN_NAME__:sl});function cl(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 ll(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?cl(Object(n),!0).forEach((function(t){vl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function dl(){dl=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(L){u=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var o=t&&t.prototype instanceof h?t:h,a=Object.create(o.prototype),s=new T(i||[]);return r(a,"_invoke",{value:_(e,n,s)}),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(L){return{type:"throw",arg:L}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,o)&&(m=v);var g=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,t){function i(r,o,a,s){var u=l(e[r],e,o);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(d).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=w(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,d;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function S(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function x(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(A.prototype),u(A.prototype,a,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new A(c(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),u(g,s,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=x,T.prototype={constructor:T,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(k),!e)for(var t in this)"t"===t.charAt(0)&&n.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 r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},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),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:x(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function hl(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(Sye){return void n(Sye)}s.done?t(u):Promise.resolve(u).then(r,i)}function fl(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){hl(o,r,i,a,s,"next",e)}function s(e){hl(o,r,i,a,s,"throw",e)}a(void 0)}))}}function pl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ml(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function yl(e,t,n){return t&&ml(e.prototype,t),n&&ml(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function vl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gl(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&&Al(e,t)}function bl(e){return(bl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Al(e,t){return(Al=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function wl(e){var t=function(){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}}();return function(){var n,r=bl(e);if(t){var i=bl(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(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 _l(e)}(this,n)}}function Sl(){return Sl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=bl(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Sl.apply(this,arguments)}function kl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(u){s=!0,i=u}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(e,t)||xl(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 Tl(e){return function(e){if(Array.isArray(e))return El(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||xl(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 xl(e,t){if(e){if("string"==typeof e)return El(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?El(e,t):void 0}}function El(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ll=function(e){return e&&e.Math==Math&&e},Il=Ll("object"==typeof globalThis&&globalThis)||Ll("object"==typeof window&&window)||Ll("object"==typeof self&&self)||Ll("object"==typeof R&&R)||function(){return this}()||Function("return this")(),Rl={exports:{}},Zl=Il,Cl=Object.defineProperty,Pl=function(e,t){try{Cl(Zl,e,{value:t,configurable:!0,writable:!0})}catch(Sye){Zl[e]=t}return t},Gl=Pl,Dl="__core-js_shared__",Ml=Il[Dl]||Gl(Dl,{}),Vl=Ml;(Rl.exports=function(e,t){return Vl[e]||(Vl[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Xl,Wl,Ol=Rl.exports,Nl=function(e){try{return!!e()}catch(Sye){return!0}},Ul=!Nl((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Fl=Ul,Yl=Function.prototype,Kl=Yl.call,jl=Fl&&Yl.bind.bind(Kl,Kl),Hl=Fl?jl:function(e){return function(){return Kl.apply(e,arguments)}},Bl=function(e){return null==e},Jl=Bl,zl=TypeError,Ql=function(e){if(Jl(e))throw zl("Can't call method on "+e);return e},ql=Ql,$l=Object,ed=function(e){return $l(ql(e))},td=ed,nd=Hl({}.hasOwnProperty),rd=Object.hasOwn||function(e,t){return nd(td(e),t)},id=Hl,od=0,ad=Math.random(),sd=id(1..toString),ud=function(e){return"Symbol("+(void 0===e?"":e)+")_"+sd(++od+ad,36)},cd="object"==typeof document&&document.all,ld={all:cd,IS_HTMLDDA:void 0===cd&&void 0!==cd},dd=ld.all,hd=ld.IS_HTMLDDA?function(e){return"function"==typeof e||e===dd}:function(e){return"function"==typeof e},fd=Il,pd=hd,md=function(e,t){return arguments.length<2?(n=fd[e],pd(n)?n:void 0):fd[e]&&fd[e][t];var n},yd=md("navigator","userAgent")||"",vd=Il,gd=yd,bd=vd.process,Ad=vd.Deno,_d=bd&&bd.versions||Ad&&Ad.version,wd=_d&&_d.v8;wd&&(Wl=(Xl=wd.split("."))[0]>0&&Xl[0]<4?1:+(Xl[0]+Xl[1])),!Wl&&gd&&(!(Xl=gd.match(/Edge\/(\d+)/))||Xl[1]>=74)&&(Xl=gd.match(/Chrome\/(\d+)/))&&(Wl=+Xl[1]);var Sd=Wl,kd=Sd,Td=Nl,xd=!!Object.getOwnPropertySymbols&&!Td((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&kd&&kd<41})),Ed=xd&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Ld=Il,Id=rd,Rd=ud,Zd=xd,Cd=Ed,Pd=Ol("wks"),Gd=Ld.Symbol,Dd=Gd&&Gd.for,Md=Cd?Gd:Gd&&Gd.withoutSetter||Rd,Vd=function(e){if(!Id(Pd,e)||!Zd&&"string"!=typeof Pd[e]){var t="Symbol."+e;Zd&&Id(Gd,e)?Pd[e]=Gd[e]:Pd[e]=Cd&&Dd?Dd(t):Md(t)}return Pd[e]},Xd={};Xd[Vd("toStringTag")]="z";var Wd="[object z]"===String(Xd),Od={},Nd=!Nl((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Ud=hd,Fd=ld.all,Yd=ld.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:Ud(e)||e===Fd}:function(e){return"object"==typeof e?null!==e:Ud(e)},Kd=Yd,jd=Il.document,Hd=Kd(jd)&&Kd(jd.createElement),Bd=function(e){return Hd?jd.createElement(e):{}},Jd=Bd,zd=!Nd&&!Nl((function(){return 7!=Object.defineProperty(Jd("div"),"a",{get:function(){return 7}}).a})),Qd=Nd&&Nl((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),qd=Yd,$d=String,eh=TypeError,th=function(e){if(qd(e))return e;throw eh($d(e)+" is not an object")},nh=Ul,rh=Function.prototype.call,ih=nh?rh.bind(rh):function(){return rh.apply(rh,arguments)},oh=Hl({}.isPrototypeOf),ah=md,sh=hd,uh=oh,ch=Object,lh=Ed?function(e){return"symbol"==typeof e}:function(e){var t=ah("Symbol");return sh(t)&&uh(t.prototype,ch(e))},dh=String,hh=function(e){try{return dh(e)}catch(Sye){return"Object"}},fh=hd,ph=hh,mh=TypeError,yh=function(e){if(fh(e))return e;throw mh(ph(e)+" is not a function")},vh=yh,gh=Bl,bh=function(e,t){var n=e[t];return gh(n)?void 0:vh(n)},Ah=ih,_h=hd,wh=Yd,Sh=TypeError,kh=ih,Th=Yd,xh=lh,Eh=bh,Lh=function(e,t){var n,r;if("string"===t&&_h(n=e.toString)&&!wh(r=Ah(n,e)))return r;if(_h(n=e.valueOf)&&!wh(r=Ah(n,e)))return r;if("string"!==t&&_h(n=e.toString)&&!wh(r=Ah(n,e)))return r;throw Sh("Can't convert object to primitive value")},Ih=TypeError,Rh=Vd("toPrimitive"),Zh=function(e,t){if(!Th(e)||xh(e))return e;var n,r=Eh(e,Rh);if(r){if(void 0===t&&(t="default"),n=kh(r,e,t),!Th(n)||xh(n))return n;throw Ih("Can't convert object to primitive value")}return void 0===t&&(t="number"),Lh(e,t)},Ch=Zh,Ph=lh,Gh=function(e){var t=Ch(e,"string");return Ph(t)?t:t+""},Dh=Nd,Mh=zd,Vh=Qd,Xh=th,Wh=Gh,Oh=TypeError,Nh=Object.defineProperty,Uh=Object.getOwnPropertyDescriptor,Fh="enumerable",Yh="configurable",Kh="writable";Od.f=Dh?Vh?function(e,t,n){if(Xh(e),t=Wh(t),Xh(n),"function"==typeof e&&"prototype"===t&&"value"in n&&Kh in n&&!n[Kh]){var r=Uh(e,t);r&&r[Kh]&&(e[t]=n.value,n={configurable:Yh in n?n[Yh]:r[Yh],enumerable:Fh in n?n[Fh]:r[Fh],writable:!1})}return Nh(e,t,n)}:Nh:function(e,t,n){if(Xh(e),t=Wh(t),Xh(n),Mh)try{return Nh(e,t,n)}catch(Sye){}if("get"in n||"set"in n)throw Oh("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var jh={exports:{}},Hh=Nd,Bh=rd,Jh=Function.prototype,zh=Hh&&Object.getOwnPropertyDescriptor,Qh=Bh(Jh,"name"),qh={EXISTS:Qh,PROPER:Qh&&"something"===function(){}.name,CONFIGURABLE:Qh&&(!Hh||Hh&&zh(Jh,"name").configurable)},$h=hd,ef=Ml,tf=Hl(Function.toString);$h(ef.inspectSource)||(ef.inspectSource=function(e){return tf(e)});var nf,rf,of,af=ef.inspectSource,sf=hd,uf=Il.WeakMap,cf=sf(uf)&&/native code/.test(String(uf)),lf=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},df=Od,hf=lf,ff=Nd?function(e,t,n){return df.f(e,t,hf(1,n))}:function(e,t,n){return e[t]=n,e},pf=ud,mf=Ol("keys"),yf=function(e){return mf[e]||(mf[e]=pf(e))},vf={},gf=cf,bf=Il,Af=Yd,_f=ff,wf=rd,Sf=Ml,kf=yf,Tf=vf,xf="Object already initialized",Ef=bf.TypeError,Lf=bf.WeakMap;if(gf||Sf.state){var If=Sf.state||(Sf.state=new Lf);If.get=If.get,If.has=If.has,If.set=If.set,nf=function(e,t){if(If.has(e))throw Ef(xf);return t.facade=e,If.set(e,t),t},rf=function(e){return If.get(e)||{}},of=function(e){return If.has(e)}}else{var Rf=kf("state");Tf[Rf]=!0,nf=function(e,t){if(wf(e,Rf))throw Ef(xf);return t.facade=e,_f(e,Rf,t),t},rf=function(e){return wf(e,Rf)?e[Rf]:{}},of=function(e){return wf(e,Rf)}}var Zf={set:nf,get:rf,has:of,enforce:function(e){return of(e)?rf(e):nf(e,{})},getterFor:function(e){return function(t){var n;if(!Af(t)||(n=rf(t)).type!==e)throw Ef("Incompatible receiver, "+e+" required");return n}}},Cf=Nl,Pf=hd,Gf=rd,Df=Nd,Mf=qh.CONFIGURABLE,Vf=af,Xf=Zf.enforce,Wf=Zf.get,Of=Object.defineProperty,Nf=Df&&!Cf((function(){return 8!==Of((function(){}),"length",{value:8}).length})),Uf=String(String).split("String"),Ff=jh.exports=function(e,t,n){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!Gf(e,"name")||Mf&&e.name!==t)&&(Df?Of(e,"name",{value:t,configurable:!0}):e.name=t),Nf&&n&&Gf(n,"arity")&&e.length!==n.arity&&Of(e,"length",{value:n.arity});try{n&&Gf(n,"constructor")&&n.constructor?Df&&Of(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(Sye){}var r=Xf(e);return Gf(r,"source")||(r.source=Uf.join("string"==typeof t?t:"")),e};Function.prototype.toString=Ff((function(){return Pf(this)&&Wf(this).source||Vf(this)}),"toString");var Yf=jh.exports,Kf=hd,jf=Od,Hf=Yf,Bf=Pl,Jf=function(e,t,n,r){r||(r={});var i=r.enumerable,o=void 0!==r.name?r.name:t;if(Kf(n)&&Hf(n,o,r),r.global)i?e[t]=n:Bf(t,n);else{try{r.unsafe?e[t]&&(i=!0):delete e[t]}catch(Sye){}i?e[t]=n:jf.f(e,t,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return e},zf=Hl,Qf=zf({}.toString),qf=zf("".slice),$f=function(e){return qf(Qf(e),8,-1)},ep=Wd,tp=hd,np=$f,rp=Vd("toStringTag"),ip=Object,op="Arguments"==np(function(){return arguments}()),ap=ep?np:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(Sye){}}(t=ip(e),rp))?n:op?np(t):"Object"==(r=np(t))&&tp(t.callee)?"Arguments":r},sp=ap,up=Wd?{}.toString:function(){return"[object "+sp(this)+"]"};Wd||Jf(Object.prototype,"toString",up,{unsafe:!0});var cp={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},lp=Bd("span").classList,dp=lp&&lp.constructor&&lp.constructor.prototype,hp=dp===Object.prototype?void 0:dp,fp=$f,pp=Hl,mp=function(e){if("Function"===fp(e))return pp(e)},yp=yh,vp=Ul,gp=mp(mp.bind),bp=function(e,t){return yp(e),void 0===t?e:vp?gp(e,t):function(){return e.apply(t,arguments)}},Ap=Nl,_p=$f,wp=Object,Sp=Hl("".split),kp=Ap((function(){return!wp("z").propertyIsEnumerable(0)}))?function(e){return"String"==_p(e)?Sp(e,""):wp(e)}:wp,Tp=Math.ceil,xp=Math.floor,Ep=Math.trunc||function(e){var t=+e;return(t>0?xp:Tp)(t)},Lp=Ep,Ip=function(e){var t=+e;return t!=t||0===t?0:Lp(t)},Rp=Ip,Zp=Math.min,Cp=function(e){return e>0?Zp(Rp(e),9007199254740991):0},Pp=Cp,Gp=function(e){return Pp(e.length)},Dp=$f,Mp=Array.isArray||function(e){return"Array"==Dp(e)},Vp=Hl,Xp=Nl,Wp=hd,Op=ap,Np=af,Up=function(){},Fp=[],Yp=md("Reflect","construct"),Kp=/^\s*(?:class|function)\b/,jp=Vp(Kp.exec),Hp=!Kp.exec(Up),Bp=function(e){if(!Wp(e))return!1;try{return Yp(Up,Fp,e),!0}catch(Sye){return!1}},Jp=function(e){if(!Wp(e))return!1;switch(Op(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Hp||!!jp(Kp,Np(e))}catch(Sye){return!0}};Jp.sham=!0;var zp=!Yp||Xp((function(){var e;return Bp(Bp.call)||!Bp(Object)||!Bp((function(){e=!0}))||e}))?Jp:Bp,Qp=Mp,qp=zp,$p=Yd,em=Vd("species"),tm=Array,nm=function(e){var t;return Qp(e)&&(t=e.constructor,(qp(t)&&(t===tm||Qp(t.prototype))||$p(t)&&null===(t=t[em]))&&(t=void 0)),void 0===t?tm:t},rm=function(e,t){return new(nm(e))(0===t?0:t)},im=bp,om=kp,am=ed,sm=Gp,um=rm,cm=Hl([].push),lm=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(u,c,l,d){for(var h,f,p=am(u),m=om(p),y=im(c,l),v=sm(m),g=0,b=d||um,A=t?b(u,v):n||a?b(u,0):void 0;v>g;g++)if((s||g in m)&&(f=y(h=m[g],g,p),e))if(t)A[g]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:cm(A,h)}else switch(e){case 4:return!1;case 7:cm(A,h)}return o?-1:r||i?i:A}},dm={forEach:lm(0),map:lm(1),filter:lm(2),some:lm(3),every:lm(4),find:lm(5),findIndex:lm(6),filterReject:lm(7)},hm=Nl,fm=function(e,t){var n=[][e];return!!n&&hm((function(){n.call(null,t||function(){return 1},1)}))},pm=dm.forEach,mm=fm("forEach")?[].forEach:function(e){return pm(this,e,arguments.length>1?arguments[1]:void 0)},ym=Il,vm=cp,gm=hp,bm=mm,Am=ff,_m=function(e){if(e&&e.forEach!==bm)try{Am(e,"forEach",bm)}catch(Sye){e.forEach=bm}};for(var wm in vm)vm[wm]&&_m(ym[wm]&&ym[wm].prototype);_m(gm);var Sm={},km={},Tm={}.propertyIsEnumerable,xm=Object.getOwnPropertyDescriptor,Em=xm&&!Tm.call({1:2},1);km.f=Em?function(e){var t=xm(this,e);return!!t&&t.enumerable}:Tm;var Lm=kp,Im=Ql,Rm=function(e){return Lm(Im(e))},Zm=Nd,Cm=ih,Pm=km,Gm=lf,Dm=Rm,Mm=Gh,Vm=rd,Xm=zd,Wm=Object.getOwnPropertyDescriptor;Sm.f=Zm?Wm:function(e,t){if(e=Dm(e),t=Mm(t),Xm)try{return Wm(e,t)}catch(Sye){}if(Vm(e,t))return Gm(!Cm(Pm.f,e,t),e[t])};var Om={},Nm=Ip,Um=Math.max,Fm=Math.min,Ym=function(e,t){var n=Nm(e);return n<0?Um(n+t,0):Fm(n,t)},Km=Rm,jm=Ym,Hm=Gp,Bm=function(e){return function(t,n,r){var i,o=Km(t),a=Hm(o),s=jm(r,a);if(e&&n!=n){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===n)return e||s||0;return!e&&-1}},Jm={includes:Bm(!0),indexOf:Bm(!1)},zm=rd,Qm=Rm,qm=Jm.indexOf,$m=vf,ey=Hl([].push),ty=function(e,t){var n,r=Qm(e),i=0,o=[];for(n in r)!zm($m,n)&&zm(r,n)&&ey(o,n);for(;t.length>i;)zm(r,n=t[i++])&&(~qm(o,n)||ey(o,n));return o},ny=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ry=ty,iy=ny.concat("length","prototype");Om.f=Object.getOwnPropertyNames||function(e){return ry(e,iy)};var oy={};oy.f=Object.getOwnPropertySymbols;var ay=md,sy=Om,uy=oy,cy=th,ly=Hl([].concat),dy=ay("Reflect","ownKeys")||function(e){var t=sy.f(cy(e)),n=uy.f;return n?ly(t,n(e)):t},hy=rd,fy=dy,py=Sm,my=Od,yy=function(e,t,n){for(var r=fy(t),i=my.f,o=py.f,a=0;a<r.length;a++){var s=r[a];hy(e,s)||n&&hy(n,s)||i(e,s,o(t,s))}},vy=Nl,gy=hd,by=/#|\.prototype\./,Ay=function(e,t){var n=wy[_y(e)];return n==ky||n!=Sy&&(gy(t)?vy(t):!!t)},_y=Ay.normalize=function(e){return String(e).replace(by,".").toLowerCase()},wy=Ay.data={},Sy=Ay.NATIVE="N",ky=Ay.POLYFILL="P",Ty=Ay,xy=Il,Ey=Sm.f,Ly=ff,Iy=Jf,Ry=Pl,Zy=yy,Cy=Ty,Py=function(e,t){var n,r,i,o,a,s=e.target,u=e.global,c=e.stat;if(n=u?xy:c?xy[s]||Ry(s,{}):(xy[s]||{}).prototype)for(r in t){if(o=t[r],i=e.dontCallGetSet?(a=Ey(n,r))&&a.value:n[r],!Cy(u?r:s+(c?".":"#")+r,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;Zy(o,i)}(e.sham||i&&i.sham)&&Ly(o,"sham",!0),Iy(n,r,o,e)}},Gy={},Dy=Gh,My=Od,Vy=lf,Xy=function(e,t,n){var r=Dy(t);r in e?My.f(e,r,Vy(0,n)):e[r]=n},Wy=Ym,Oy=Gp,Ny=Xy,Uy=Array,Fy=Math.max,Yy=function(e,t,n){for(var r=Oy(e),i=Wy(t,r),o=Wy(void 0===n?r:n,r),a=Uy(Fy(o-i,0)),s=0;i<o;i++,s++)Ny(a,s,e[i]);return a.length=s,a},Ky=$f,jy=Rm,Hy=Om.f,By=Yy,Jy="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Gy.f=function(e){return Jy&&"Window"==Ky(e)?function(e){try{return Hy(e)}catch(Sye){return By(Jy)}}(e):Hy(jy(e))};var zy=Py,Qy=Nl,qy=Gy.f;zy({target:"Object",stat:!0,forced:Qy((function(){return!Object.getOwnPropertyNames(1)}))},{getOwnPropertyNames:qy});var $y=ap,ev=String,tv=function(e){if("Symbol"===$y(e))throw TypeError("Cannot convert a Symbol value to a string");return ev(e)},nv=th,rv=function(){var e=nv(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},iv=Nl,ov=Il.RegExp,av=iv((function(){var e=ov("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),sv=av||iv((function(){return!ov("a","y").sticky})),uv=av||iv((function(){var e=ov("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),cv={BROKEN_CARET:uv,MISSED_STICKY:sv,UNSUPPORTED_Y:av},lv={},dv=ty,hv=ny,fv=Object.keys||function(e){return dv(e,hv)},pv=Nd,mv=Qd,yv=Od,vv=th,gv=Rm,bv=fv;lv.f=pv&&!mv?Object.defineProperties:function(e,t){vv(e);for(var n,r=gv(t),i=bv(t),o=i.length,a=0;o>a;)yv.f(e,n=i[a++],r[n]);return e};var Av,_v=md("document","documentElement"),wv=th,Sv=lv,kv=ny,Tv=vf,xv=_v,Ev=Bd,Lv="prototype",Iv="script",Rv=yf("IE_PROTO"),Zv=function(){},Cv=function(e){return"<"+Iv+">"+e+"</"+Iv+">"},Pv=function(e){e.write(Cv("")),e.close();var t=e.parentWindow.Object;return e=null,t},Gv=function(){try{Av=new ActiveXObject("htmlfile")}catch(Sye){}var e,t,n;Gv="undefined"!=typeof document?document.domain&&Av?Pv(Av):(t=Ev("iframe"),n="java"+Iv+":",t.style.display="none",xv.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(Cv("document.F=Object")),e.close(),e.F):Pv(Av);for(var r=kv.length;r--;)delete Gv[Lv][kv[r]];return Gv()};Tv[Rv]=!0;var Dv,Mv,Vv=Object.create||function(e,t){var n;return null!==e?(Zv[Lv]=wv(e),n=new Zv,Zv[Lv]=null,n[Rv]=e):n=Gv(),void 0===t?n:Sv.f(n,t)},Xv=Nl,Wv=Il.RegExp,Ov=Xv((function(){var e=Wv(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Nv=Nl,Uv=Il.RegExp,Fv=Nv((function(){var e=Uv("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Yv=ih,Kv=Hl,jv=tv,Hv=rv,Bv=cv,Jv=Vv,zv=Zf.get,Qv=Ov,qv=Fv,$v=Ol("native-string-replace",String.prototype.replace),eg=RegExp.prototype.exec,tg=eg,ng=Kv("".charAt),rg=Kv("".indexOf),ig=Kv("".replace),og=Kv("".slice),ag=(Mv=/b*/g,Yv(eg,Dv=/a/,"a"),Yv(eg,Mv,"a"),0!==Dv.lastIndex||0!==Mv.lastIndex),sg=Bv.BROKEN_CARET,ug=void 0!==/()??/.exec("")[1];(ag||ug||sg||Qv||qv)&&(tg=function(e){var t,n,r,i,o,a,s,u=this,c=zv(u),l=jv(e),d=c.raw;if(d)return d.lastIndex=u.lastIndex,t=Yv(tg,d,l),u.lastIndex=d.lastIndex,t;var h=c.groups,f=sg&&u.sticky,p=Yv(Hv,u),m=u.source,y=0,v=l;if(f&&(p=ig(p,"y",""),-1===rg(p,"g")&&(p+="g"),v=og(l,u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==ng(l,u.lastIndex-1))&&(m="(?: "+m+")",v=" "+v,y++),n=new RegExp("^(?:"+m+")",p)),ug&&(n=new RegExp("^"+m+"$(?!\\s)",p)),ag&&(r=u.lastIndex),i=Yv(eg,f?n:u,v),f?i?(i.input=og(i.input,y),i[0]=og(i[0],y),i.index=u.lastIndex,u.lastIndex+=i[0].length):u.lastIndex=0:ag&&i&&(u.lastIndex=u.global?i.index+i[0].length:r),ug&&i&&i.length>1&&Yv($v,i[0],n,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&h)for(i.groups=a=Jv(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var cg=tg;Py({target:"RegExp",proto:!0,forced:/./.exec!==cg},{exec:cg});var lg,dg,hg=Py,fg=ih,pg=hd,mg=th,yg=tv,vg=(lg=!1,(dg=/[ac]/).exec=function(){return lg=!0,/./.exec.apply(this,arguments)},!0===dg.test("abc")&&lg),gg=/./.test;hg({target:"RegExp",proto:!0,forced:!vg},{test:function(e){var t=mg(this),n=yg(e),r=t.exec;if(!pg(r))return fg(gg,t,n);var i=fg(r,t,n);return null!==i&&(mg(i),!0)}});var bg=Ul,Ag=Function.prototype,_g=Ag.apply,wg=Ag.call,Sg="object"==typeof Reflect&&Reflect.apply||(bg?wg.bind(_g):function(){return wg.apply(_g,arguments)}),kg=mp,Tg=Jf,xg=cg,Eg=Nl,Lg=Vd,Ig=ff,Rg=Lg("species"),Zg=RegExp.prototype,Cg=function(e,t,n,r){var i=Lg(e),o=!Eg((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!Eg((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[Rg]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!o||!a||n){var s=kg(/./[i]),u=t(i,""[e],(function(e,t,n,r,i){var a=kg(e),u=t.exec;return u===xg||u===Zg.exec?o&&!i?{done:!0,value:s(t,n,r)}:{done:!0,value:a(n,t,r)}:{done:!1}}));Tg(String.prototype,e,u[0]),Tg(Zg,i,u[1])}r&&Ig(Zg[i],"sham",!0)},Pg=Hl,Gg=Ip,Dg=tv,Mg=Ql,Vg=Pg("".charAt),Xg=Pg("".charCodeAt),Wg=Pg("".slice),Og=function(e){return function(t,n){var r,i,o=Dg(Mg(t)),a=Gg(n),s=o.length;return a<0||a>=s?e?"":void 0:(r=Xg(o,a))<55296||r>56319||a+1===s||(i=Xg(o,a+1))<56320||i>57343?e?Vg(o,a):r:e?Wg(o,a,a+2):i-56320+(r-55296<<10)+65536}},Ng={codeAt:Og(!1),charAt:Og(!0)},Ug=Ng.charAt,Fg=function(e,t,n){return t+(n?Ug(e,t).length:1)},Yg=Hl,Kg=ed,jg=Math.floor,Hg=Yg("".charAt),Bg=Yg("".replace),Jg=Yg("".slice),zg=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Qg=/\$([$&'`]|\d{1,2})/g,qg=ih,$g=th,eb=hd,tb=$f,nb=cg,rb=TypeError,ib=function(e,t){var n=e.exec;if(eb(n)){var r=qg(n,e,t);return null!==r&&$g(r),r}if("RegExp"===tb(e))return qg(nb,e,t);throw rb("RegExp#exec called on incompatible receiver")},ob=Sg,ab=ih,sb=Hl,ub=Cg,cb=Nl,lb=th,db=hd,hb=Bl,fb=Ip,pb=Cp,mb=tv,yb=Ql,vb=Fg,gb=bh,bb=function(e,t,n,r,i,o){var a=n+e.length,s=r.length,u=Qg;return void 0!==i&&(i=Kg(i),u=zg),Bg(o,u,(function(o,u){var c;switch(Hg(u,0)){case"$":return"$";case"&":return e;case"`":return Jg(t,0,n);case"'":return Jg(t,a);case"<":c=i[Jg(u,1,-1)];break;default:var l=+u;if(0===l)return o;if(l>s){var d=jg(l/10);return 0===d?o:d<=s?void 0===r[d-1]?Hg(u,1):r[d-1]+Hg(u,1):o}c=r[l-1]}return void 0===c?"":c}))},Ab=ib,_b=Vd("replace"),wb=Math.max,Sb=Math.min,kb=sb([].concat),Tb=sb([].push),xb=sb("".indexOf),Eb=sb("".slice),Lb="$0"==="a".replace(/./,"$0"),Ib=!!/./[_b]&&""===/./[_b]("a","$0"),Rb=!cb((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));ub("replace",(function(e,t,n){var r=Ib?"$":"$0";return[function(e,n){var r=yb(this),i=hb(e)?void 0:gb(e,_b);return i?ab(i,e,r,n):ab(t,mb(r),e,n)},function(e,i){var o=lb(this),a=mb(e);if("string"==typeof i&&-1===xb(i,r)&&-1===xb(i,"$<")){var s=n(t,o,a,i);if(s.done)return s.value}var u=db(i);u||(i=mb(i));var c=o.global;if(c){var l=o.unicode;o.lastIndex=0}for(var d=[];;){var h=Ab(o,a);if(null===h)break;if(Tb(d,h),!c)break;""===mb(h[0])&&(o.lastIndex=vb(a,pb(o.lastIndex),l))}for(var f,p="",m=0,y=0;y<d.length;y++){for(var v=mb((h=d[y])[0]),g=wb(Sb(fb(h.index),a.length),0),b=[],A=1;A<h.length;A++)Tb(b,void 0===(f=h[A])?f:String(f));var _=h.groups;if(u){var w=kb([v],b,g,a);void 0!==_&&Tb(w,_);var S=mb(ob(i,void 0,w))}else S=bb(v,a,g,b,_,i);g>=m&&(p+=Eb(a,m,g)+S,m=g+v.length)}return p+Eb(a,m)}]}),!Rb||!Lb||Ib);var Zb=Nl,Cb=Sd,Pb=Vd("species"),Gb=function(e){return Cb>=51||!Zb((function(){var t=[];return(t.constructor={})[Pb]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Db=dm.filter;Py({target:"Array",proto:!0,forced:!Gb("filter")},{filter:function(e){return Db(this,e,arguments.length>1?arguments[1]:void 0)}});var Mb,Vb,Xb,Wb,Ob="process"==$f(Il.process),Nb=hd,Ub=String,Fb=TypeError,Yb=Hl,Kb=th,jb=function(e){if("object"==typeof e||Nb(e))return e;throw Fb("Can't set "+Ub(e)+" as a prototype")},Hb=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Yb(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),t=n instanceof Array}catch(Sye){}return function(n,r){return Kb(n),jb(r),t?e(n,r):n.__proto__=r,n}}():void 0),Bb=Od.f,Jb=rd,zb=Vd("toStringTag"),Qb=function(e,t,n){e&&!n&&(e=e.prototype),e&&!Jb(e,zb)&&Bb(e,zb,{configurable:!0,value:t})},qb=md,$b=Od,eA=Nd,tA=Vd("species"),nA=function(e){var t=qb(e),n=$b.f;eA&&t&&!t[tA]&&n(t,tA,{configurable:!0,get:function(){return this}})},rA=oh,iA=TypeError,oA=function(e,t){if(rA(t,e))return e;throw iA("Incorrect invocation")},aA=zp,sA=hh,uA=TypeError,cA=function(e){if(aA(e))return e;throw uA(sA(e)+" is not a constructor")},lA=th,dA=cA,hA=Bl,fA=Vd("species"),pA=function(e,t){var n,r=lA(e).constructor;return void 0===r||hA(n=lA(r)[fA])?t:dA(n)},mA=Hl([].slice),yA=TypeError,vA=function(e,t){if(e<t)throw yA("Not enough arguments");return e},gA=/(?:ipad|iphone|ipod).*applewebkit/i.test(yd),bA=Il,AA=Sg,_A=bp,wA=hd,SA=rd,kA=Nl,TA=_v,xA=mA,EA=Bd,LA=vA,IA=gA,RA=Ob,ZA=bA.setImmediate,CA=bA.clearImmediate,PA=bA.process,GA=bA.Dispatch,DA=bA.Function,MA=bA.MessageChannel,VA=bA.String,XA=0,WA={},OA="onreadystatechange";try{Mb=bA.location}catch(Sye){}var NA=function(e){if(SA(WA,e)){var t=WA[e];delete WA[e],t()}},UA=function(e){return function(){NA(e)}},FA=function(e){NA(e.data)},YA=function(e){bA.postMessage(VA(e),Mb.protocol+"//"+Mb.host)};ZA&&CA||(ZA=function(e){LA(arguments.length,1);var t=wA(e)?e:DA(e),n=xA(arguments,1);return WA[++XA]=function(){AA(t,void 0,n)},Vb(XA),XA},CA=function(e){delete WA[e]},RA?Vb=function(e){PA.nextTick(UA(e))}:GA&&GA.now?Vb=function(e){GA.now(UA(e))}:MA&&!IA?(Wb=(Xb=new MA).port2,Xb.port1.onmessage=FA,Vb=_A(Wb.postMessage,Wb)):bA.addEventListener&&wA(bA.postMessage)&&!bA.importScripts&&Mb&&"file:"!==Mb.protocol&&!kA(YA)?(Vb=YA,bA.addEventListener("message",FA,!1)):Vb=OA in EA("script")?function(e){TA.appendChild(EA("script"))[OA]=function(){TA.removeChild(this),NA(e)}}:function(e){setTimeout(UA(e),0)});var KA,jA,HA,BA,JA,zA,QA,qA,$A={set:ZA,clear:CA},e_=Il,t_=/ipad|iphone|ipod/i.test(yd)&&void 0!==e_.Pebble,n_=/web0s(?!.*chrome)/i.test(yd),r_=Il,i_=bp,o_=Sm.f,a_=$A.set,s_=gA,u_=t_,c_=n_,l_=Ob,d_=r_.MutationObserver||r_.WebKitMutationObserver,h_=r_.document,f_=r_.process,p_=r_.Promise,m_=o_(r_,"queueMicrotask"),y_=m_&&m_.value;y_||(KA=function(){var e,t;for(l_&&(e=f_.domain)&&e.exit();jA;){t=jA.fn,jA=jA.next;try{t()}catch(Sye){throw jA?BA():HA=void 0,Sye}}HA=void 0,e&&e.enter()},s_||l_||c_||!d_||!h_?!u_&&p_&&p_.resolve?((QA=p_.resolve(void 0)).constructor=p_,qA=i_(QA.then,QA),BA=function(){qA(KA)}):l_?BA=function(){f_.nextTick(KA)}:(a_=i_(a_,r_),BA=function(){a_(KA)}):(JA=!0,zA=h_.createTextNode(""),new d_(KA).observe(zA,{characterData:!0}),BA=function(){zA.data=JA=!JA}));var v_=y_||function(e){var t={fn:e,next:void 0};HA&&(HA.next=t),jA||(jA=t,BA()),HA=t},g_=Il,b_=function(e){try{return{error:!1,value:e()}}catch(Sye){return{error:!0,value:Sye}}},A_=function(){this.head=null,this.tail=null};A_.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var __=A_,w_=Il.Promise,S_="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,k_=!S_&&!Ob&&"object"==typeof window&&"object"==typeof document,T_=Il,x_=w_,E_=hd,L_=Ty,I_=af,R_=Vd,Z_=k_,C_=S_,P_=Sd;x_&&x_.prototype;var G_=R_("species"),D_=!1,M_=E_(T_.PromiseRejectionEvent),V_={CONSTRUCTOR:L_("Promise",(function(){var e=I_(x_),t=e!==String(x_);if(!t&&66===P_)return!0;if(!P_||P_<51||!/native code/.test(e)){var n=new x_((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};if((n.constructor={})[G_]=r,!(D_=n.then((function(){}))instanceof r))return!0}return!t&&(Z_||C_)&&!M_})),REJECTION_EVENT:M_,SUBCLASSING:D_},X_={},W_=yh,O_=TypeError,N_=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw O_("Bad Promise constructor");t=e,n=r})),this.resolve=W_(t),this.reject=W_(n)};X_.f=function(e){return new N_(e)};var U_,F_,Y_,K_=Py,j_=Ob,H_=Il,B_=ih,J_=Jf,z_=Hb,Q_=Qb,q_=nA,$_=yh,ew=hd,tw=Yd,nw=oA,rw=pA,iw=$A.set,ow=v_,aw=function(e,t){var n=g_.console;n&&n.error&&(1==arguments.length?n.error(e):n.error(e,t))},sw=b_,uw=__,cw=Zf,lw=w_,dw=X_,hw="Promise",fw=V_.CONSTRUCTOR,pw=V_.REJECTION_EVENT,mw=V_.SUBCLASSING,yw=cw.getterFor(hw),vw=cw.set,gw=lw&&lw.prototype,bw=lw,Aw=gw,_w=H_.TypeError,ww=H_.document,Sw=H_.process,kw=dw.f,Tw=kw,xw=!!(ww&&ww.createEvent&&H_.dispatchEvent),Ew="unhandledrejection",Lw=function(e){var t;return!(!tw(e)||!ew(t=e.then))&&t},Iw=function(e,t){var n,r,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{s?(a||(2===t.rejection&&Gw(t),t.rejection=1),!0===s?n=o:(l&&l.enter(),n=s(o),l&&(l.exit(),i=!0)),n===e.promise?c(_w("Promise-chain cycle")):(r=Lw(n))?B_(r,n,u,c):u(n)):c(o)}catch(Sye){l&&!i&&l.exit(),c(Sye)}},Rw=function(e,t){e.notified||(e.notified=!0,ow((function(){for(var n,r=e.reactions;n=r.get();)Iw(n,e);e.notified=!1,t&&!e.rejection&&Cw(e)})))},Zw=function(e,t,n){var r,i;xw?((r=ww.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),H_.dispatchEvent(r)):r={promise:t,reason:n},!pw&&(i=H_["on"+e])?i(r):e===Ew&&aw("Unhandled promise rejection",n)},Cw=function(e){B_(iw,H_,(function(){var t,n=e.facade,r=e.value;if(Pw(e)&&(t=sw((function(){j_?Sw.emit("unhandledRejection",r,n):Zw(Ew,n,r)})),e.rejection=j_||Pw(e)?2:1,t.error))throw t.value}))},Pw=function(e){return 1!==e.rejection&&!e.parent},Gw=function(e){B_(iw,H_,(function(){var t=e.facade;j_?Sw.emit("rejectionHandled",t):Zw("rejectionhandled",t,e.value)}))},Dw=function(e,t,n){return function(r){e(t,r,n)}},Mw=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,Rw(e,!0))},Vw=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw _w("Promise can't be resolved itself");var r=Lw(t);r?ow((function(){var n={done:!1};try{B_(r,t,Dw(Vw,n,e),Dw(Mw,n,e))}catch(Sye){Mw(n,Sye,e)}})):(e.value=t,e.state=1,Rw(e,!1))}catch(Sye){Mw({done:!1},Sye,e)}}};if(fw&&(Aw=(bw=function(e){nw(this,Aw),$_(e),B_(U_,this);var t=yw(this);try{e(Dw(Vw,t),Dw(Mw,t))}catch(Sye){Mw(t,Sye)}}).prototype,(U_=function(e){vw(this,{type:hw,done:!1,notified:!1,parent:!1,reactions:new uw,rejection:!1,state:0,value:void 0})}).prototype=J_(Aw,"then",(function(e,t){var n=yw(this),r=kw(rw(this,bw));return n.parent=!0,r.ok=!ew(e)||e,r.fail=ew(t)&&t,r.domain=j_?Sw.domain:void 0,0==n.state?n.reactions.add(r):ow((function(){Iw(r,n)})),r.promise})),F_=function(){var e=new U_,t=yw(e);this.promise=e,this.resolve=Dw(Vw,t),this.reject=Dw(Mw,t)},dw.f=kw=function(e){return e===bw||undefined===e?new F_(e):Tw(e)},ew(lw)&&gw!==Object.prototype)){Y_=gw.then,mw||J_(gw,"then",(function(e,t){var n=this;return new bw((function(e,t){B_(Y_,n,e,t)})).then(e,t)}),{unsafe:!0});try{delete gw.constructor}catch(Sye){}z_&&z_(gw,Aw)}K_({global:!0,constructor:!0,wrap:!0,forced:fw},{Promise:bw}),Q_(bw,hw,!1),q_(hw);var Xw={},Ww=Xw,Ow=Vd("iterator"),Nw=Array.prototype,Uw=function(e){return void 0!==e&&(Ww.Array===e||Nw[Ow]===e)},Fw=ap,Yw=bh,Kw=Bl,jw=Xw,Hw=Vd("iterator"),Bw=function(e){if(!Kw(e))return Yw(e,Hw)||Yw(e,"@@iterator")||jw[Fw(e)]},Jw=ih,zw=yh,Qw=th,qw=hh,$w=Bw,eS=TypeError,tS=function(e,t){var n=arguments.length<2?$w(e):t;if(zw(n))return Qw(Jw(n,e));throw eS(qw(e)+" is not iterable")},nS=ih,rS=th,iS=bh,oS=function(e,t,n){var r,i;rS(e);try{if(!(r=iS(e,"return"))){if("throw"===t)throw n;return n}r=nS(r,e)}catch(Sye){i=!0,r=Sye}if("throw"===t)throw n;if(i)throw r;return rS(r),n},aS=bp,sS=ih,uS=th,cS=hh,lS=Uw,dS=Gp,hS=oh,fS=tS,pS=Bw,mS=oS,yS=TypeError,vS=function(e,t){this.stopped=e,this.result=t},gS=vS.prototype,bS=function(e,t,n){var r,i,o,a,s,u,c,l=n&&n.that,d=!(!n||!n.AS_ENTRIES),h=!(!n||!n.IS_RECORD),f=!(!n||!n.IS_ITERATOR),p=!(!n||!n.INTERRUPTED),m=aS(t,l),y=function(e){return r&&mS(r,"normal",e),new vS(!0,e)},v=function(e){return d?(uS(e),p?m(e[0],e[1],y):m(e[0],e[1])):p?m(e,y):m(e)};if(h)r=e.iterator;else if(f)r=e;else{if(!(i=pS(e)))throw yS(cS(e)+" is not iterable");if(lS(i)){for(o=0,a=dS(e);a>o;o++)if((s=v(e[o]))&&hS(gS,s))return s;return new vS(!1)}r=fS(e,i)}for(u=h?e.next:r.next;!(c=sS(u,r)).done;){try{s=v(c.value)}catch(Sye){mS(r,"throw",Sye)}if("object"==typeof s&&s&&hS(gS,s))return s}return new vS(!1)},AS=Vd("iterator"),_S=!1;try{var wS=0,SS={next:function(){return{done:!!wS++}},return:function(){_S=!0}};SS[AS]=function(){return this},Array.from(SS,(function(){throw 2}))}catch(Sye){}var kS=function(e,t){if(!t&&!_S)return!1;var n=!1;try{var r={};r[AS]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(Sye){}return n},TS=w_,xS=V_.CONSTRUCTOR||!kS((function(e){TS.all(e).then(void 0,(function(){}))})),ES=ih,LS=yh,IS=X_,RS=b_,ZS=bS;Py({target:"Promise",stat:!0,forced:xS},{all:function(e){var t=this,n=IS.f(t),r=n.resolve,i=n.reject,o=RS((function(){var n=LS(t.resolve),o=[],a=0,s=1;ZS(e,(function(e){var u=a++,c=!1;s++,ES(n,t,e).then((function(e){c||(c=!0,o[u]=e,--s||r(o))}),i)})),--s||r(o)}));return o.error&&i(o.value),n.promise}});var CS=Py,PS=V_.CONSTRUCTOR,GS=w_,DS=md,MS=hd,VS=Jf,XS=GS&&GS.prototype;if(CS({target:"Promise",proto:!0,forced:PS,real:!0},{catch:function(e){return this.then(void 0,e)}}),MS(GS)){var WS=DS("Promise").prototype.catch;XS.catch!==WS&&VS(XS,"catch",WS,{unsafe:!0})}var OS=ih,NS=yh,US=X_,FS=b_,YS=bS;Py({target:"Promise",stat:!0,forced:xS},{race:function(e){var t=this,n=US.f(t),r=n.reject,i=FS((function(){var i=NS(t.resolve);YS(e,(function(e){OS(i,t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var KS=ih,jS=X_;Py({target:"Promise",stat:!0,forced:V_.CONSTRUCTOR},{reject:function(e){var t=jS.f(this);return KS(t.reject,void 0,e),t.promise}});var HS=th,BS=Yd,JS=X_,zS=function(e,t){if(HS(e),BS(t)&&t.constructor===e)return t;var n=JS.f(e);return(0,n.resolve)(t),n.promise},QS=Py,qS=V_.CONSTRUCTOR,$S=zS;md("Promise"),QS({target:"Promise",stat:!0,forced:qS},{resolve:function(e){return $S(this,e)}});var ek=TypeError,tk=function(e){if(e>9007199254740991)throw ek("Maximum allowed index exceeded");return e},nk=Py,rk=Nl,ik=Mp,ok=Yd,ak=ed,sk=Gp,uk=tk,ck=Xy,lk=rm,dk=Gb,hk=Sd,fk=Vd("isConcatSpreadable"),pk=hk>=51||!rk((function(){var e=[];return e[fk]=!1,e.concat()[0]!==e})),mk=dk("concat"),yk=function(e){if(!ok(e))return!1;var t=e[fk];return void 0!==t?!!t:ik(e)};nk({target:"Array",proto:!0,arity:1,forced:!pk||!mk},{concat:function(e){var t,n,r,i,o,a=ak(this),s=lk(a,0),u=0;for(t=-1,r=arguments.length;t<r;t++)if(yk(o=-1===t?a:arguments[t]))for(i=sk(o),uk(u+i),n=0;n<i;n++,u++)n in o&&ck(s,u,o[n]);else uk(u+1),ck(s,u++,o);return s.length=u,s}});var vk=Py,gk=w_,bk=Nl,Ak=md,_k=hd,wk=pA,Sk=zS,kk=Jf,Tk=gk&&gk.prototype;if(vk({target:"Promise",proto:!0,real:!0,forced:!!gk&&bk((function(){Tk.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=wk(this,Ak("Promise")),n=_k(e);return this.then(n?function(n){return Sk(t,e()).then((function(){return n}))}:e,n?function(n){return Sk(t,e()).then((function(){throw n}))}:e)}}),_k(gk)){var xk=Ak("Promise").prototype.finally;Tk.finally!==xk&&kk(Tk,"finally",xk,{unsafe:!0})}var Ek=hd,Lk=Yd,Ik=Hb,Rk=function(e,t,n){var r,i;return Ik&&Ek(r=t.constructor)&&r!==n&&Lk(i=r.prototype)&&i!==n.prototype&&Ik(e,i),e},Zk=Hl(1..valueOf),Ck="\t\n\v\f\r \u2028\u2029\ufeff",Pk=Ql,Gk=tv,Dk=Ck,Mk=Hl("".replace),Vk="["+Dk+"]",Xk=RegExp("^"+Vk+Vk+"*"),Wk=RegExp(Vk+Vk+"*$"),Ok=function(e){return function(t){var n=Gk(Pk(t));return 1&e&&(n=Mk(n,Xk,"")),2&e&&(n=Mk(n,Wk,"")),n}},Nk={start:Ok(1),end:Ok(2),trim:Ok(3)},Uk=Nd,Fk=Il,Yk=Hl,Kk=Ty,jk=Jf,Hk=rd,Bk=Rk,Jk=oh,zk=lh,Qk=Zh,qk=Nl,$k=Om.f,eT=Sm.f,tT=Od.f,nT=Zk,rT=Nk.trim,iT="Number",oT=Fk[iT],aT=oT.prototype,sT=Fk.TypeError,uT=Yk("".slice),cT=Yk("".charCodeAt),lT=function(e){var t,n,r,i,o,a,s,u,c=Qk(e,"number");if(zk(c))throw sT("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=rT(c),43===(t=cT(c,0))||45===t){if(88===(n=cT(c,2))||120===n)return NaN}else if(48===t){switch(cT(c,1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+c}for(a=(o=uT(c,2)).length,s=0;s<a;s++)if((u=cT(o,s))<48||u>i)return NaN;return parseInt(o,r)}return+c};if(Kk(iT,!oT(" 0o1")||!oT("0b1")||oT("+0x1"))){for(var dT,hT=function(e){var t=arguments.length<1?0:oT(function(e){var t=Qk(e,"number");return"bigint"==typeof t?t:lT(t)}(e)),n=this;return Jk(aT,n)&&qk((function(){nT(n)}))?Bk(Object(t),n,hT):t},fT=Uk?$k(oT):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),pT=0;fT.length>pT;pT++)Hk(oT,dT=fT[pT])&&!Hk(hT,dT)&&tT(hT,dT,eT(oT,dT));hT.prototype=aT,aT.constructor=hT,jk(Fk,iT,hT,{constructor:!0})}var mT=Il,yT=Nl,vT=tv,gT=Nk.trim,bT=Ck,AT=Hl("".charAt),_T=mT.parseFloat,wT=mT.Symbol,ST=wT&&wT.iterator,kT=1/_T(bT+"-0")!=-1/0||ST&&!yT((function(){_T(Object(ST))}))?function(e){var t=gT(vT(e)),n=_T(t);return 0===n&&"-"==AT(t,0)?-0:n}:_T,TT=kT;Py({target:"Number",stat:!0,forced:Number.parseFloat!=TT},{parseFloat:TT}),Py({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var xT=dm.map;Py({target:"Array",proto:!0,forced:!Gb("map")},{map:function(e){return xT(this,e,arguments.length>1?arguments[1]:void 0)}});var ET=ed,LT=Ym,IT=Gp,RT=function(e){for(var t=ET(this),n=IT(t),r=arguments.length,i=LT(r>1?arguments[1]:void 0,n),o=r>2?arguments[2]:void 0,a=void 0===o?n:LT(o,n);a>i;)t[i++]=e;return t},ZT=Vd,CT=Vv,PT=Od.f,GT=ZT("unscopables"),DT=Array.prototype;null==DT[GT]&&PT(DT,GT,{configurable:!0,value:CT(null)});var MT=function(e){DT[GT][e]=!0},VT=MT;Py({target:"Array",proto:!0},{fill:RT}),VT("fill");var XT,WT=function(){return"undefined"!=typeof navigator&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream},OT=function(){return"wakeLock"in navigator},NT=function(){function e(){var t=this;pl(this,e),this.enabled=!1,OT()?(this._wakeLock=null,this.handleVisibilityChange=function(){null!==t._wakeLock&&t.visible&&t.enable()},document.addEventListener("visibilitychange",this.handleVisibilityChange),document.addEventListener("fullscreenchange",this.handleVisibilityChange)):WT()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64, AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcm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go8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwA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KPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK"),this.noSleepVideo.addEventListener("loadedmetadata",(function(){t.noSleepVideo&&(t.noSleepVideo.duration<=1?t.noSleepVideo.setAttribute("loop",""):(t.onTimeupdate=function(){t.noSleepVideo.currentTime>.5&&(t.noSleepVideo.currentTime=Math.random())},t.noSleepVideo.addEventListener("timeupdate",t.onTimeupdate)))})))}return yl(e,[{key:"_addSourceToVideo",value:function(e,t,n){var r=document.createElement("source");r.src=n,r.type="video/".concat(t),e.appendChild(r)}},{key:"visible",get:function(){return"visible"===document.visibilityState}},{key:"isEnabled",get:function(){return this.enabled}},{key:"enable",value:function(){var e,t=this;if(OT()&&this.visible)return navigator.wakeLock.request("screen").then((function(e){t._wakeLock=e,t.enabled=!0,t._wakeLock.addEventListener("release",(function(){}))})).catch((function(){t.enabled=!1}));if(WT())return this.disable(),console.warn("\n NoSleep enabled for older iOS devices. This can interrupt\n active or long-running network requests from completing successfully.\n See https://github.com/richtr/NoSleep.js/issues/15 for more details.\n "),this.noSleepTimer=window.setInterval((function(){document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))}),15e3),this.enabled=!0,Promise.resolve();if(null!==(e=this.noSleepVideo)&&void 0!==e&&e.paused){var n=this.noSleepVideo.play();return n&&n.then((function(e){return t.enabled=!0,e})).catch((function(e){console.log("noSleep: ",e.message),t.enabled=!1}))}}},{key:"disable",value:function(){OT()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):WT()?this.noSleepTimer&&(console.warn("\n NoSleep now disabled for older iOS devices.\n "),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}},{key:"toPlay",value:function(){if(this.noSleepVideo&&this.noSleepVideo.paused){var e=performance.now();this.lastTs||(this.lastTs=e),e-this.lastTs>1e4&&(this.enable(),this.lastTs=e)}}},{key:"destroy",value:function(){this.disable(),this.handleVisibilityChange&&(document.removeEventListener("visibilitychange",this.handleVisibilityChange),document.removeEventListener("fullscreenchange",this.handleVisibilityChange)),this.onTimeupdate&&this.noSleepVideo.removeEventListener("timeupdate",this.onTimeupdate),this.noSleepVideo=null}}]),e}();function UT(){if(!document.querySelector("#hackAudioPP")){var e=document.createElement("div");e.innerHTML="<audio id='hackAudioPP'></audio>",document.body.appendChild(e);var t=e.children.item(0);t.controls=!1,t.preload="auto",t.innerHTML="<source src=".concat("data:audio/mpeg;base64,//uQxAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAACAAACcQCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA//////////////////////////////////////////////////////////////////8AAABhTEFNRTMuMTAwA8MAAAAAAAAAABQgJAUHQQAB9AAAAnGMHkkIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//sQxAADgnABGiAAQBCqgCRMAAgEAH///////////////7+n/9FTuQsQH//////2NG0jWUGlio5gLQTOtIoeR2WX////X4s9Atb/JRVCbBUpeRUq//////////////////9RUi0f2jn/+xDECgPCjAEQAABN4AAANIAAAAQVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQ==",' type="audio/mpeg"></source>'),t.muted=!0,t.loop=!0,t.play().catch((function(){}))}}function FT(){var e=XT||(XT=document.querySelector("#hackAudioPP"));e?!1===e.paused&&!1===e.muted||(e.muted=!1,e.play().catch((function(e){console.log("bgAudio: ",e.message)}))):UT()}var YT,KT,jT,HT=!Nl((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),BT=rd,JT=hd,zT=ed,QT=HT,qT=yf("IE_PROTO"),$T=Object,ex=$T.prototype,tx=QT?$T.getPrototypeOf:function(e){var t=zT(e);if(BT(t,qT))return t[qT];var n=t.constructor;return JT(n)&&t instanceof n?n.prototype:t instanceof $T?ex:null},nx=Nl,rx=hd,ix=Yd,ox=tx,ax=Jf,sx=Vd("iterator"),ux=!1;[].keys&&("next"in(jT=[].keys())?(KT=ox(ox(jT)))!==Object.prototype&&(YT=KT):ux=!0),(!ix(YT)||nx((function(){var e={};return YT[sx].call(e)!==e})))&&(YT={}),rx(YT[sx])||ax(YT,sx,(function(){return this}));var cx={IteratorPrototype:YT,BUGGY_SAFARI_ITERATORS:ux},lx=cx.IteratorPrototype,dx=Vv,hx=lf,fx=Qb,px=Xw,mx=function(){return this},yx=function(e,t,n,r){var i=t+" Iterator";return e.prototype=dx(lx,{next:hx(+!r,n)}),fx(e,i,!1),px[i]=mx,e},vx=Py,gx=ih,bx=hd,Ax=yx,_x=tx,wx=Hb,Sx=Qb,kx=ff,Tx=Jf,xx=Xw,Ex=qh.PROPER,Lx=qh.CONFIGURABLE,Ix=cx.IteratorPrototype,Rx=cx.BUGGY_SAFARI_ITERATORS,Zx=Vd("iterator"),Cx="keys",Px="values",Gx="entries",Dx=function(){return this},Mx=function(e,t,n,r,i,o,a){Ax(n,t,r);var s,u,c,l=function(e){if(e===i&&m)return m;if(!Rx&&e in f)return f[e];switch(e){case Cx:case Px:case Gx:return function(){return new n(this,e)}}return function(){return new n(this)}},d=t+" Iterator",h=!1,f=e.prototype,p=f[Zx]||f["@@iterator"]||i&&f[i],m=!Rx&&p||l(i),y="Array"==t&&f.entries||p;if(y&&(s=_x(y.call(new e)))!==Object.prototype&&s.next&&(_x(s)!==Ix&&(wx?wx(s,Ix):bx(s[Zx])||Tx(s,Zx,Dx)),Sx(s,d,!0)),Ex&&i==Px&&p&&p.name!==Px&&(Lx?kx(f,"name",Px):(h=!0,m=function(){return gx(p,this)})),i)if(u={values:l(Px),keys:o?m:l(Cx),entries:l(Gx)},a)for(c in u)(Rx||h||!(c in f))&&Tx(f,c,u[c]);else vx({target:t,proto:!0,forced:Rx||h},u);return f[Zx]!==m&&Tx(f,Zx,m,{name:i}),xx[t]=m,u},Vx=function(e,t){return{value:e,done:t}},Xx=Rm,Wx=MT,Ox=Xw,Nx=Zf,Ux=Od.f,Fx=Mx,Yx=Vx,Kx=Nd,jx="Array Iterator",Hx=Nx.set,Bx=Nx.getterFor(jx),Jx=Fx(Array,"Array",(function(e,t){Hx(this,{type:jx,target:Xx(e),index:0,kind:t})}),(function(){var e=Bx(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,Yx(void 0,!0)):Yx("keys"==n?r:"values"==n?t[r]:[r,t[r]],!1)}),"values"),zx=Ox.Arguments=Ox.Array;if(Wx("keys"),Wx("values"),Wx("entries"),Kx&&"values"!==zx.name)try{Ux(zx,"name",{value:"values"})}catch(Sye){}var Qx,qx,$x,eE={exports:{}},tE="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,nE=tE,rE=Nd,iE=Il,oE=hd,aE=Yd,sE=rd,uE=ap,cE=hh,lE=ff,dE=Jf,hE=Od.f,fE=oh,pE=tx,mE=Hb,yE=Vd,vE=ud,gE=Zf.enforce,bE=Zf.get,AE=iE.Int8Array,_E=AE&&AE.prototype,wE=iE.Uint8ClampedArray,SE=wE&&wE.prototype,kE=AE&&pE(AE),TE=_E&&pE(_E),xE=Object.prototype,EE=iE.TypeError,LE=yE("toStringTag"),IE=vE("TYPED_ARRAY_TAG"),RE="TypedArrayConstructor",ZE=nE&&!!mE&&"Opera"!==uE(iE.opera),CE=!1,PE={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},GE={BigInt64Array:8,BigUint64Array:8},DE=function(e){var t=pE(e);if(aE(t)){var n=bE(t);return n&&sE(n,RE)?n[RE]:DE(t)}},ME=function(e){if(!aE(e))return!1;var t=uE(e);return sE(PE,t)||sE(GE,t)};for(Qx in PE)($x=(qx=iE[Qx])&&qx.prototype)?gE($x)[RE]=qx:ZE=!1;for(Qx in GE)($x=(qx=iE[Qx])&&qx.prototype)&&(gE($x)[RE]=qx);if((!ZE||!oE(kE)||kE===Function.prototype)&&(kE=function(){throw EE("Incorrect invocation")},ZE))for(Qx in PE)iE[Qx]&&mE(iE[Qx],kE);if((!ZE||!TE||TE===xE)&&(TE=kE.prototype,ZE))for(Qx in PE)iE[Qx]&&mE(iE[Qx].prototype,TE);if(ZE&&pE(SE)!==TE&&mE(SE,TE),rE&&!sE(TE,LE))for(Qx in CE=!0,hE(TE,LE,{get:function(){return aE(this)?this[IE]:void 0}}),PE)iE[Qx]&&lE(iE[Qx],IE,Qx);var VE={NATIVE_ARRAY_BUFFER_VIEWS:ZE,TYPED_ARRAY_TAG:CE&&IE,aTypedArray:function(e){if(ME(e))return e;throw EE("Target is not a typed array")},aTypedArrayConstructor:function(e){if(oE(e)&&(!mE||fE(kE,e)))return e;throw EE(cE(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n,r){if(rE){if(n)for(var i in PE){var o=iE[i];if(o&&sE(o.prototype,e))try{delete o.prototype[e]}catch(Sye){try{o.prototype[e]=t}catch(a){}}}TE[e]&&!n||dE(TE,e,n?t:ZE&&_E[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,n){var r,i;if(rE){if(mE){if(n)for(r in PE)if((i=iE[r])&&sE(i,e))try{delete i[e]}catch(Sye){}if(kE[e]&&!n)return;try{return dE(kE,e,n?t:ZE&&kE[e]||t)}catch(Sye){}}for(r in PE)!(i=iE[r])||i[e]&&!n||dE(i,e,t)}},getTypedArrayConstructor:DE,isView:function(e){if(!aE(e))return!1;var t=uE(e);return"DataView"===t||sE(PE,t)||sE(GE,t)},isTypedArray:ME,TypedArray:kE,TypedArrayPrototype:TE},XE=Il,WE=Nl,OE=kS,NE=VE.NATIVE_ARRAY_BUFFER_VIEWS,UE=XE.ArrayBuffer,FE=XE.Int8Array,YE=!NE||!WE((function(){FE(1)}))||!WE((function(){new FE(-1)}))||!OE((function(e){new FE,new FE(null),new FE(1.5),new FE(e)}),!0)||WE((function(){return 1!==new FE(new UE(2),1,void 0).length})),KE=Jf,jE=function(e,t,n){for(var r in t)KE(e,r,t[r],n);return e},HE=Ip,BE=Cp,JE=RangeError,zE=function(e){if(void 0===e)return 0;var t=HE(e),n=BE(t);if(t!==n)throw JE("Wrong length or index");return n},QE=Array,qE=Math.abs,$E=Math.pow,eL=Math.floor,tL=Math.log,nL=Math.LN2,rL=Il,iL=Hl,oL=Nd,aL=tE,sL=qh,uL=ff,cL=jE,lL=Nl,dL=oA,hL=Ip,fL=Cp,pL=zE,mL={pack:function(e,t,n){var r,i,o,a=QE(n),s=8*n-t-1,u=(1<<s)-1,c=u>>1,l=23===t?$E(2,-24)-$E(2,-77):0,d=e<0||0===e&&1/e<0?1:0,h=0;for((e=qE(e))!=e||e===1/0?(i=e!=e?1:0,r=u):(r=eL(tL(e)/nL),e*(o=$E(2,-r))<1&&(r--,o*=2),(e+=r+c>=1?l/o:l*$E(2,1-c))*o>=2&&(r++,o/=2),r+c>=u?(i=0,r=u):r+c>=1?(i=(e*o-1)*$E(2,t),r+=c):(i=e*$E(2,c-1)*$E(2,t),r=0));t>=8;)a[h++]=255&i,i/=256,t-=8;for(r=r<<t|i,s+=t;s>0;)a[h++]=255&r,r/=256,s-=8;return a[--h]|=128*d,a},unpack:function(e,t){var n,r=e.length,i=8*r-t-1,o=(1<<i)-1,a=o>>1,s=i-7,u=r-1,c=e[u--],l=127&c;for(c>>=7;s>0;)l=256*l+e[u--],s-=8;for(n=l&(1<<-s)-1,l>>=-s,s+=t;s>0;)n=256*n+e[u--],s-=8;if(0===l)l=1-a;else{if(l===o)return n?NaN:c?-1/0:1/0;n+=$E(2,t),l-=a}return(c?-1:1)*n*$E(2,l-t)}},yL=tx,vL=Hb,gL=Om.f,bL=Od.f,AL=RT,_L=Yy,wL=Qb,SL=sL.PROPER,kL=sL.CONFIGURABLE,TL=Zf.get,xL=Zf.set,EL="ArrayBuffer",LL="DataView",IL="prototype",RL="Wrong index",ZL=rL[EL],CL=ZL,PL=CL&&CL[IL],GL=rL[LL],DL=GL&&GL[IL],ML=Object.prototype,VL=rL.Array,XL=rL.RangeError,WL=iL(AL),OL=iL([].reverse),NL=mL.pack,UL=mL.unpack,FL=function(e){return[255&e]},YL=function(e){return[255&e,e>>8&255]},KL=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},jL=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},HL=function(e){return NL(e,23,4)},BL=function(e){return NL(e,52,8)},JL=function(e,t){bL(e[IL],t,{get:function(){return TL(this)[t]}})},zL=function(e,t,n,r){var i=pL(n),o=TL(e);if(i+t>o.byteLength)throw XL(RL);var a=TL(o.buffer).bytes,s=i+o.byteOffset,u=_L(a,s,s+t);return r?u:OL(u)},QL=function(e,t,n,r,i,o){var a=pL(n),s=TL(e);if(a+t>s.byteLength)throw XL(RL);for(var u=TL(s.buffer).bytes,c=a+s.byteOffset,l=r(+i),d=0;d<t;d++)u[c+d]=l[o?d:t-d-1]};if(aL){var qL=SL&&ZL.name!==EL;if(lL((function(){ZL(1)}))&&lL((function(){new ZL(-1)}))&&!lL((function(){return new ZL,new ZL(1.5),new ZL(NaN),1!=ZL.length||qL&&!kL})))qL&&kL&&uL(ZL,"name",EL);else{(CL=function(e){return dL(this,PL),new ZL(pL(e))})[IL]=PL;for(var $L,eI=gL(ZL),tI=0;eI.length>tI;)($L=eI[tI++])in CL||uL(CL,$L,ZL[$L]);PL.constructor=CL}vL&&yL(DL)!==ML&&vL(DL,ML);var nI=new GL(new CL(2)),rI=iL(DL.setInt8);nI.setInt8(0,2147483648),nI.setInt8(1,2147483649),!nI.getInt8(0)&&nI.getInt8(1)||cL(DL,{setInt8:function(e,t){rI(this,e,t<<24>>24)},setUint8:function(e,t){rI(this,e,t<<24>>24)}},{unsafe:!0})}else PL=(CL=function(e){dL(this,PL);var t=pL(e);xL(this,{bytes:WL(VL(t),0),byteLength:t}),oL||(this.byteLength=t)})[IL],DL=(GL=function(e,t,n){dL(this,DL),dL(e,PL);var r=TL(e).byteLength,i=hL(t);if(i<0||i>r)throw XL("Wrong offset");if(i+(n=void 0===n?r-i:fL(n))>r)throw XL("Wrong length");xL(this,{buffer:e,byteLength:n,byteOffset:i}),oL||(this.buffer=e,this.byteLength=n,this.byteOffset=i)})[IL],oL&&(JL(CL,"byteLength"),JL(GL,"buffer"),JL(GL,"byteLength"),JL(GL,"byteOffset")),cL(DL,{getInt8:function(e){return zL(this,1,e)[0]<<24>>24},getUint8:function(e){return zL(this,1,e)[0]},getInt16:function(e){var t=zL(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=zL(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return jL(zL(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return jL(zL(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return UL(zL(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return UL(zL(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){QL(this,1,e,FL,t)},setUint8:function(e,t){QL(this,1,e,FL,t)},setInt16:function(e,t){QL(this,2,e,YL,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){QL(this,2,e,YL,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){QL(this,4,e,KL,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){QL(this,4,e,KL,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){QL(this,4,e,HL,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){QL(this,8,e,BL,t,arguments.length>2?arguments[2]:void 0)}});wL(CL,EL),wL(GL,LL);var iI={ArrayBuffer:CL,DataView:GL},oI=Yd,aI=Math.floor,sI=Number.isInteger||function(e){return!oI(e)&&isFinite(e)&&aI(e)===e},uI=Ip,cI=RangeError,lI=function(e){var t=uI(e);if(t<0)throw cI("The argument can't be less than 0");return t},dI=RangeError,hI=function(e,t){var n=lI(e);if(n%t)throw dI("Wrong offset");return n},fI=ap,pI=Hl("".slice),mI=Zh,yI=TypeError,vI=function(e){var t=mI(e,"number");if("number"==typeof t)throw yI("Can't convert number to bigint");return BigInt(t)},gI=bp,bI=ih,AI=cA,_I=ed,wI=Gp,SI=tS,kI=Bw,TI=Uw,xI=function(e){return"Big"===pI(fI(e),0,3)},EI=VE.aTypedArrayConstructor,LI=vI,II=Py,RI=Il,ZI=ih,CI=Nd,PI=YE,GI=VE,DI=iI,MI=oA,VI=lf,XI=ff,WI=sI,OI=Cp,NI=zE,UI=hI,FI=Gh,YI=rd,KI=ap,jI=Yd,HI=lh,BI=Vv,JI=oh,zI=Hb,QI=Om.f,qI=function(e){var t,n,r,i,o,a,s,u,c=AI(this),l=_I(e),d=arguments.length,h=d>1?arguments[1]:void 0,f=void 0!==h,p=kI(l);if(p&&!TI(p))for(u=(s=SI(l,p)).next,l=[];!(a=bI(u,s)).done;)l.push(a.value);for(f&&d>2&&(h=gI(h,arguments[2])),n=wI(l),r=new(EI(c))(n),i=xI(r),t=0;n>t;t++)o=f?h(l[t],t):l[t],r[t]=i?LI(o):+o;return r},$I=dm.forEach,eR=nA,tR=Od,nR=Sm,rR=Rk,iR=Zf.get,oR=Zf.set,aR=Zf.enforce,sR=tR.f,uR=nR.f,cR=Math.round,lR=RI.RangeError,dR=DI.ArrayBuffer,hR=dR.prototype,fR=DI.DataView,pR=GI.NATIVE_ARRAY_BUFFER_VIEWS,mR=GI.TYPED_ARRAY_TAG,yR=GI.TypedArray,vR=GI.TypedArrayPrototype,gR=GI.aTypedArrayConstructor,bR=GI.isTypedArray,AR="BYTES_PER_ELEMENT",_R="Wrong length",wR=function(e,t){gR(e);for(var n=0,r=t.length,i=new e(r);r>n;)i[n]=t[n++];return i},SR=function(e,t){sR(e,t,{get:function(){return iR(this)[t]}})},kR=function(e){var t;return JI(hR,e)||"ArrayBuffer"==(t=KI(e))||"SharedArrayBuffer"==t},TR=function(e,t){return bR(e)&&!HI(t)&&t in e&&WI(+t)&&t>=0},xR=function(e,t){return t=FI(t),TR(e,t)?VI(2,e[t]):uR(e,t)},ER=function(e,t,n){return t=FI(t),!(TR(e,t)&&jI(n)&&YI(n,"value"))||YI(n,"get")||YI(n,"set")||n.configurable||YI(n,"writable")&&!n.writable||YI(n,"enumerable")&&!n.enumerable?sR(e,t,n):(e[t]=n.value,e)};CI?(pR||(nR.f=xR,tR.f=ER,SR(vR,"buffer"),SR(vR,"byteOffset"),SR(vR,"byteLength"),SR(vR,"length")),II({target:"Object",stat:!0,forced:!pR},{getOwnPropertyDescriptor:xR,defineProperty:ER}),eE.exports=function(e,t,n){var r=e.match(/\d+$/)[0]/8,i=e+(n?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=RI[i],u=s,c=u&&u.prototype,l={},d=function(e,t){sR(e,t,{get:function(){return function(e,t){var n=iR(e);return n.view[o](t*r+n.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=iR(e);n&&(i=(i=cR(i))<0?0:i>255?255:255&i),o.view[a](t*r+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};pR?PI&&(u=t((function(e,t,n,i){return MI(e,c),rR(jI(t)?kR(t)?void 0!==i?new s(t,UI(n,r),i):void 0!==n?new s(t,UI(n,r)):new s(t):bR(t)?wR(u,t):ZI(qI,u,t):new s(NI(t)),e,u)})),zI&&zI(u,yR),$I(QI(s),(function(e){e in u||XI(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,n,i){MI(e,c);var o,a,s,l=0,h=0;if(jI(t)){if(!kR(t))return bR(t)?wR(u,t):ZI(qI,u,t);o=t,h=UI(n,r);var f=t.byteLength;if(void 0===i){if(f%r)throw lR(_R);if((a=f-h)<0)throw lR(_R)}else if((a=OI(i)*r)+h>f)throw lR(_R);s=a/r}else s=NI(t),o=new dR(a=s*r);for(oR(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new fR(o)});l<s;)d(e,l++)})),zI&&zI(u,yR),c=u.prototype=BI(vR)),c.constructor!==u&&XI(c,"constructor",u),aR(c).TypedArrayConstructor=u,mR&&XI(c,mR,i);var h=u!=s;l[i]=u,II({global:!0,constructor:!0,forced:h,sham:!pR},l),AR in u||XI(u,AR,r),AR in c||XI(c,AR,r),eR(i)}):eE.exports=function(){};var LR=eE.exports;LR("Uint8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var IR=Gp,RR=Ip,ZR=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("at",(function(e){var t=ZR(this),n=IR(t),r=RR(e),i=r>=0?r:n+r;return i<0||i>=n?void 0:t[i]}));var CR=hh,PR=TypeError,GR=function(e,t){if(!delete e[t])throw PR("Cannot delete property "+CR(t)+" of "+CR(e))},DR=ed,MR=Ym,VR=Gp,XR=GR,WR=Math.min,OR=[].copyWithin||function(e,t){var n=DR(this),r=VR(n),i=MR(e,r),o=MR(t,r),a=arguments.length>2?arguments[2]:void 0,s=WR((void 0===a?r:MR(a,r))-o,r-i),u=1;for(o<i&&i<o+s&&(u=-1,o+=s-1,i+=s-1);s-- >0;)o in n?n[i]=n[o]:XR(n,i),i+=u,o+=u;return n},NR=VE,UR=Hl(OR),FR=NR.aTypedArray;(0,NR.exportTypedArrayMethod)("copyWithin",(function(e,t){return UR(FR(this),e,t,arguments.length>2?arguments[2]:void 0)}));var YR=dm.every,KR=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("every",(function(e){return YR(KR(this),e,arguments.length>1?arguments[1]:void 0)}));var jR=RT,HR=vI,BR=ap,JR=ih,zR=Nl,QR=VE.aTypedArray,qR=VE.exportTypedArrayMethod,$R=Hl("".slice);qR("fill",(function(e){var t=arguments.length;QR(this);var n="Big"===$R(BR(this),0,3)?HR(e):+e;return JR(jR,this,n,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),zR((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e})));var eZ=Gp,tZ=pA,nZ=VE.aTypedArrayConstructor,rZ=VE.getTypedArrayConstructor,iZ=function(e){return nZ(tZ(e,rZ(e)))},oZ=function(e,t){for(var n=0,r=eZ(t),i=new e(r);r>n;)i[n]=t[n++];return i},aZ=iZ,sZ=dm.filter,uZ=function(e,t){return oZ(aZ(e),t)},cZ=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("filter",(function(e){var t=sZ(cZ(this),e,arguments.length>1?arguments[1]:void 0);return uZ(this,t)}));var lZ=dm.find,dZ=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("find",(function(e){return lZ(dZ(this),e,arguments.length>1?arguments[1]:void 0)}));var hZ=dm.findIndex,fZ=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("findIndex",(function(e){return hZ(fZ(this),e,arguments.length>1?arguments[1]:void 0)}));var pZ=bp,mZ=kp,yZ=ed,vZ=Gp,gZ=function(e){var t=1==e;return function(n,r,i){for(var o,a=yZ(n),s=mZ(a),u=pZ(r,i),c=vZ(s);c-- >0;)if(u(o=s[c],c,a))switch(e){case 0:return o;case 1:return c}return t?-1:void 0}},bZ={findLast:gZ(0),findLastIndex:gZ(1)},AZ=bZ.findLast,_Z=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("findLast",(function(e){return AZ(_Z(this),e,arguments.length>1?arguments[1]:void 0)}));var wZ=bZ.findLastIndex,SZ=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("findLastIndex",(function(e){return wZ(SZ(this),e,arguments.length>1?arguments[1]:void 0)}));var kZ=dm.forEach,TZ=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("forEach",(function(e){kZ(TZ(this),e,arguments.length>1?arguments[1]:void 0)}));var xZ=Jm.includes,EZ=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("includes",(function(e){return xZ(EZ(this),e,arguments.length>1?arguments[1]:void 0)}));var LZ=Jm.indexOf,IZ=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("indexOf",(function(e){return LZ(IZ(this),e,arguments.length>1?arguments[1]:void 0)}));var RZ=Il,ZZ=Nl,CZ=Hl,PZ=VE,GZ=Jx,DZ=Vd("iterator"),MZ=RZ.Uint8Array,VZ=CZ(GZ.values),XZ=CZ(GZ.keys),WZ=CZ(GZ.entries),OZ=PZ.aTypedArray,NZ=PZ.exportTypedArrayMethod,UZ=MZ&&MZ.prototype,FZ=!ZZ((function(){UZ[DZ].call([1])})),YZ=!!UZ&&UZ.values&&UZ[DZ]===UZ.values&&"values"===UZ.values.name,KZ=function(){return VZ(OZ(this))};NZ("entries",(function(){return WZ(OZ(this))}),FZ),NZ("keys",(function(){return XZ(OZ(this))}),FZ),NZ("values",KZ,FZ||!YZ,{name:"values"}),NZ(DZ,KZ,FZ||!YZ,{name:"values"});var jZ=VE.aTypedArray,HZ=VE.exportTypedArrayMethod,BZ=Hl([].join);HZ("join",(function(e){return BZ(jZ(this),e)}));var JZ=Sg,zZ=Rm,QZ=Ip,qZ=Gp,$Z=fm,eC=Math.min,tC=[].lastIndexOf,nC=!!tC&&1/[1].lastIndexOf(1,-0)<0,rC=$Z("lastIndexOf"),iC=nC||!rC?function(e){if(nC)return JZ(tC,this,arguments)||0;var t=zZ(this),n=qZ(t),r=n-1;for(arguments.length>1&&(r=eC(r,QZ(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:tC,oC=Sg,aC=iC,sC=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return oC(aC,sC(this),t>1?[e,arguments[1]]:[e])}));var uC=dm.map,cC=iZ,lC=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("map",(function(e){return uC(lC(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(cC(e))(t)}))}));var dC=yh,hC=ed,fC=kp,pC=Gp,mC=TypeError,yC=function(e){return function(t,n,r,i){dC(n);var o=hC(t),a=fC(o),s=pC(o),u=e?s-1:0,c=e?-1:1;if(r<2)for(;;){if(u in a){i=a[u],u+=c;break}if(u+=c,e?u<0:s<=u)throw mC("Reduce of empty array with no initial value")}for(;e?u>=0:s>u;u+=c)u in a&&(i=n(i,a[u],u,o));return i}},vC={left:yC(!1),right:yC(!0)},gC=vC.left,bC=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return gC(bC(this),e,t,t>1?arguments[1]:void 0)}));var AC=vC.right,_C=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return AC(_C(this),e,t,t>1?arguments[1]:void 0)}));var wC=VE.aTypedArray,SC=VE.exportTypedArrayMethod,kC=Math.floor;SC("reverse",(function(){for(var e,t=this,n=wC(t).length,r=kC(n/2),i=0;i<r;)e=t[i],t[i++]=t[--n],t[n]=e;return t}));var TC=Il,xC=ih,EC=VE,LC=Gp,IC=hI,RC=ed,ZC=Nl,CC=TC.RangeError,PC=TC.Int8Array,GC=PC&&PC.prototype,DC=GC&&GC.set,MC=EC.aTypedArray,VC=EC.exportTypedArrayMethod,XC=!ZC((function(){var e=new Uint8ClampedArray(2);return xC(DC,e,{length:1,0:3},1),3!==e[1]})),WC=XC&&EC.NATIVE_ARRAY_BUFFER_VIEWS&&ZC((function(){var e=new PC(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));VC("set",(function(e){MC(this);var t=IC(arguments.length>1?arguments[1]:void 0,1),n=RC(e);if(XC)return xC(DC,this,n,t);var r=this.length,i=LC(n),o=0;if(i+t>r)throw CC("Wrong length");for(;o<i;)this[t+o]=n[o++]}),!XC||WC);var OC=iZ,NC=mA,UC=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("slice",(function(e,t){for(var n=NC(UC(this),e,t),r=OC(this),i=0,o=n.length,a=new r(o);o>i;)a[i]=n[i++];return a}),Nl((function(){new Int8Array(1).slice()})));var FC=dm.some,YC=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("some",(function(e){return FC(YC(this),e,arguments.length>1?arguments[1]:void 0)}));var KC=Yy,jC=Math.floor,HC=function(e,t){var n=e.length,r=jC(n/2);return n<8?BC(e,t):JC(e,HC(KC(e,0,r),t),HC(KC(e,r),t),t)},BC=function(e,t){for(var n,r,i=e.length,o=1;o<i;){for(r=o,n=e[o];r&&t(e[r-1],n)>0;)e[r]=e[--r];r!==o++&&(e[r]=n)}return e},JC=function(e,t,n,r){for(var i=t.length,o=n.length,a=0,s=0;a<i||s<o;)e[a+s]=a<i&&s<o?r(t[a],n[s])<=0?t[a++]:n[s++]:a<i?t[a++]:n[s++];return e},zC=HC,QC=yd.match(/firefox\/(\d+)/i),qC=!!QC&&+QC[1],$C=/MSIE|Trident/.test(yd),eP=yd.match(/AppleWebKit\/(\d+)\./),tP=!!eP&&+eP[1],nP=mp,rP=Nl,iP=yh,oP=zC,aP=qC,sP=$C,uP=Sd,cP=tP,lP=VE.aTypedArray,dP=VE.exportTypedArrayMethod,hP=Il.Uint16Array,fP=hP&&nP(hP.prototype.sort),pP=!(!fP||rP((function(){fP(new hP(2),null)}))&&rP((function(){fP(new hP(2),{})}))),mP=!!fP&&!rP((function(){if(uP)return uP<74;if(aP)return aP<67;if(sP)return!0;if(cP)return cP<602;var e,t,n=new hP(516),r=Array(516);for(e=0;e<516;e++)t=e%4,n[e]=515-e,r[e]=e-2*t+3;for(fP(n,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(n[e]!==r[e])return!0}));dP("sort",(function(e){return void 0!==e&&iP(e),mP?fP(this,e):oP(lP(this),function(e){return function(t,n){return void 0!==e?+e(t,n)||0:n!=n?-1:t!=t?1:0===t&&0===n?1/t>0&&1/n<0?1:-1:t>n}}(e))}),!mP||pP);var yP=Cp,vP=Ym,gP=iZ,bP=VE.aTypedArray;(0,VE.exportTypedArrayMethod)("subarray",(function(e,t){var n=bP(this),r=n.length,i=vP(e,r);return new(gP(n))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,yP((void 0===t?r:vP(t,r))-i))}));var AP=Sg,_P=VE,wP=Nl,SP=mA,kP=Il.Int8Array,TP=_P.aTypedArray,xP=_P.exportTypedArrayMethod,EP=[].toLocaleString,LP=!!kP&&wP((function(){EP.call(new kP(1))}));xP("toLocaleString",(function(){return AP(EP,LP?SP(TP(this)):TP(this),SP(arguments))}),wP((function(){return[1,2].toLocaleString()!=new kP([1,2]).toLocaleString()}))||!wP((function(){kP.prototype.toLocaleString.call([1,2])})));var IP=VE.exportTypedArrayMethod,RP=Nl,ZP=Hl,CP=Il.Uint8Array,PP=CP&&CP.prototype||{},GP=[].toString,DP=ZP([].join);RP((function(){GP.call({})}))&&(GP=function(){return DP(this)});var MP=PP.toString!=GP;IP("toString",GP,MP);var VP=new(function(){function e(){var t=this;pl(this,e);try{var n=/xgd=(\d)/.exec(document.cookie);this._status=!!n,this._level=n&&n[1]}catch(r){this._status=!1}["group","groupEnd","log","warn","error"].forEach((function(e){t[e]=function(n,r,i,o,a,s,u,c,l,d){var h;if(t._status){var f=n,p=[r,i,o,a,s,u,c,l,d].filter((function(e){return void 0!==e}));(h=console)[e].apply(h,["["+f+"]:"].concat(Tl(p)))}}}))}return yl(e,[{key:"enable",get:function(){return this._status}},{key:"long",get:function(){return"2"===this._level}}]),e}());function XP(e,t){if(e&&t){var n=new Uint8Array(e.byteLength+t.byteLength+11);n[0]=1,n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=255,n[5]=225;var r=6;return n.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),r),r+=2,n.set(e,r),n[r+=e.byteLength]=1,r++,n.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),r),r+=2,n.set(t,r),n}}var WP=Nd,OP=Hl,NP=ih,UP=Nl,FP=fv,YP=oy,KP=km,jP=ed,HP=kp,BP=Object.assign,JP=Object.defineProperty,zP=OP([].concat),QP=!BP||UP((function(){if(WP&&1!==BP({b:1},BP(JP({},"a",{enumerable:!0,get:function(){JP(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach((function(e){t[e]=e})),7!=BP({},e)[n]||FP(BP({},t)).join("")!=r}))?function(e,t){for(var n=jP(e),r=arguments.length,i=1,o=YP.f,a=KP.f;r>i;)for(var s,u=HP(arguments[i++]),c=o?zP(FP(u),o(u)):FP(u),l=c.length,d=0;l>d;)s=c[d++],WP&&!NP(a,u,s)||(n[s]=u[s]);return n}:BP,qP=QP;Py({target:"Object",stat:!0,arity:2,forced:Object.assign!==qP},{assign:qP});var $P="xg-video",eG=!1;try{eG=WebAssembly&&WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))}catch(kye){}var tG={preloadDecoder:!1,reuseWasmDecoder:!0,reuseMseForAudio:!1,preciseSeek:0,h264WithWebcodec:!0,lowDecodeThreshold:100,wasmFallbackToAsm:!1,audioWithMse:!0,canUseThreadMode:!1,disabledWhenErrorOccur:!0,disabledDuration:43200,evaluateVVCount:0,disabledByLowdecodePrecent:.5,maxDecodeOnceWasm:eG?6:8,maxDecodeOnceFirstTime:8,maxDecodeOnceWebcodec:20};function nG(){return $P}function rG(){return tG}function iG(){var e="undefined"!=typeof customElements&&customElements.get($P);return e?{H264_DECODER_URL:e.h264Url,ASM_H264_DECODER_URL:e.h264AsmUrl,H265_DECODER_URL:e.h265Url,H265_THREAD_DECODER_URL:e.h265ThreadUrl,H265_SIMD_DECODER_URL:e.h265SimdUrl,ASM_H265_DECODER_URL:e.h265AsmUrl}:{}}function oG(){if("undefined"==typeof customElements)return!1;var e=customElements.get($P);return eG&&!(null==e||!e.h265SimdUrl)}function aG(){if("undefined"==typeof customElements)return!1;var e=customElements.get($P);return!!window.SharedArrayBuffer&&!(null==e||!e.h265ThreadUrl)}var sG=!1;try{var uG,cG;sG="1"===(null===(uG=localStorage)||void 0===uG||null===(cG=uG.getItem)||void 0===cG?void 0:cG.call(uG,"_sds"))}catch(kye){}var lG=0,dG=0,hG=0,fG=!1;function pG(e){localStorage.setItem("xgv_dis",e),2===e&&localStorage.setItem("xgv_dist",(new Date).getTime())}function mG(){if(!0===(!!fG||0!==rG().evaluateVVCount&&(lG===rG().evaluateVVCount&&(hG=dG/lG),hG>=rG().disabledByLowdecodePrecent&&(fG=!0),fG)))return!0;var e=localStorage.getItem("xgv_dis");if(!e)return!1;if("1"===e)return!0;if("2"===e){var t=localStorage.getItem("xgv_dist")||0;if(t=Number(t),((new Date).getTime()-t)/1e3<rG().disabledDuration)return!0;yG()}}function yG(){localStorage.removeItem("xgv_dist"),localStorage.removeItem("xgv_dis")}var vG=Il.isFinite;Py({target:"Number",stat:!0},{isFinite:Number.isFinite||function(e){return"number"==typeof e&&vG(e)}});var gG=Py,bG=Mp,AG=zp,_G=Yd,wG=Ym,SG=Gp,kG=Rm,TG=Xy,xG=Vd,EG=mA,LG=Gb("slice"),IG=xG("species"),RG=Array,ZG=Math.max;gG({target:"Array",proto:!0,forced:!LG},{slice:function(e,t){var n,r,i,o=kG(this),a=SG(o),s=wG(e,a),u=wG(void 0===t?a:t,a);if(bG(o)&&(n=o.constructor,(AG(n)&&(n===RG||bG(n.prototype))||_G(n)&&null===(n=n[IG]))&&(n=void 0),n===RG||void 0===n))return EG(o,s,u);for(r=new(void 0===n?RG:n)(ZG(u-s,0)),i=0;s<u;s++,i++)s in o&&TG(r,i,o[s]);return r.length=i,r}});var CG={WAITING:0,CANPLAY:1,PLAY:2,PLAYING:3,PAUSE:4,SEEKING:5,SEEKED:6,LOADEDDATA:7,LOADEDMETADATA:8,TIMEUPDATE:9,DURATION_CHANGE:10,VOLUME_CHANGE:11,PROGRESS:12,ERROR:13,ENDED:14,RESIZE:15,LOADSTART:16,DECODE_FPS:17,LOW_DECODE:18,LARGE_AV_GAP:19,FIRST_FRAME:20},PG=["waiting","canplay","play","playing","pause","seeking","seeked","loadeddata","loadedmetadata","timeupdate","durationchange","volumechange","progress","error","ended","resize","loadstart","decodefps","lowdecode","largeavgap","firstframe"],GG={AUDIO_READY:"audio_ready",AUDIO_NOT_ALLOWED_AUTOPLAY:"audio_not_allowed_autoplay",AUDIO_WAITING:"audio_waiting",AUDIO_SYNC_DTS:"audio_sync_dts"},DG={VIDEO_DECODER_INIT:"video_decode_init",VIDEO_READY:"video_ready",VIDEO_WAITING:"video_waiting",AUTO_RUN:"auto_run",DECODE_LOW_FPS:"decode_low_fps",UPDATE_VIDEO_FILLTYPE:"update_video_filltype",UPDATE_VIDEO_COVER_POSITION:"update_video_cover_position"},MG={PLAY_EVENT:"play_event",SET_METADATA:"set_metadata",APPEND_CHUNKS:"append_chunks",START_RENDER:"start_render",DO_PLAY:"do_play",DO_PAUSE:"do_pause",DO_SEEK:"do_seek",SET_PLAYBACKRATE:"set_playbackrate",SYNC_DTS:"sync_dts",RESET_BASE_DTS:"reset_base_dts",UPDATE_VOLUME:"update_volume",SINGLE_TRACK:"single_track",DESTROY:"destroy",READY:"ready",UPDATE_GL_OPTIONS:"update_gl_options",SET_VIDEO_DURATION:"set_video_duration",SET_PLAY_MODE:"set_play_mode",UPDATE_CAPABILITY_LEVEL:"update_capability_level",INNER_DEGRADE:"inner_degrade",ADJUST_SEEK_TIME:"adjust_seek_time",CHASE_FRAME:"chase_frame",END_OF_STREAM:"end_of_stream",UPDATE_SEGMENT_END:"update_segment_end"},VG={INIT:"init",READY:"decoderready",REMUX:"remux",INIT_FAILED:"initfailed",DATAREADY:"dataReady",PLAY_FAILED:"playfailed",FRAGMENT_END:"fragmentEnd",APPEND_VIDEO:"appendVideo",FIRST_FRAME:"firstFrame",DECODED:"decoded",RENDE_END:"rendeEnd",CHASE_VIDEO_FRAME:"chaseVideoFrame",CHASE_VIDEO_FRAME_END:"chaseVideoFrameEnd",CHASE_AUDIO_FRAME:"chaseAudioFrame",INIT_SEGMENT:"initSegment",MEDIA_SEGMENT:"mediaSegment",FRAME_MAX_COUNY:"frameMaxCount",FRAME_MIN_COUNY:"frameMinCount"},XG=function(e){gl(n,e);var t=wl(n);function n(e,r){var i;return pl(this,n),(i=t.call(this))._config=e,i._parent=r,i._meta=null,i._ready=!1,i._isLive=!0,i._innerDegrade=!1,i._singleTrack=-1,i}return yl(n,[{key:"analyse",get:function(){return this._parent.analyse}},{key:"isLive",get:function(){return this._isLive}},{key:"innerDegrade",get:function(){return this._innerDegrade}},{key:"noAudio",get:function(){return 1===this._singleTrack||2===this._singleTrack}},{key:"noVideo",get:function(){return 3===this._singleTrack}},{key:"duration",get:function(){return this._timeRange.duration},set:function(e){this._timeRange&&(this._timeRange.duration=e)}},{key:"_bindEvents",value:function(){var e=this;this._parent.on(MG.APPEND_CHUNKS,this._appendChunk.bind(this)),this._parent.on(MG.RESET_BASE_DTS,this._resetDts.bind(this)),this._parent.on(MG.START_RENDER,this._startRender.bind(this)),this._parent.on(MG.DO_PLAY,this._doPlay.bind(this)),this._parent.on(MG.DO_PAUSE,this._doPause.bind(this)),this._parent.on(MG.DO_SEEK,this._doSeek.bind(this)),this._parent.on(MG.DESTROY,this._destroy.bind(this)),this._parent.on(MG.CHASE_FRAME,this._doChaseFrame.bind(this)),this._parent.on(MG.SINGLE_TRACK,(function(t){e._singleTrack=t})),this._parent.on(MG.SET_PLAY_MODE,(function(t){e._isLive="LIVE"===t})),this._parent.on(MG.INNER_DEGRADE,(function(){e._innerDegrade=!0})),this._parent.on(MG.SET_VIDEO_DURATION,(function(t){e.duration=t}))}}]),n}(P),WG=Py,OG=Hl,NG=yh,UG=ed,FG=Gp,YG=GR,KG=tv,jG=Nl,HG=zC,BG=fm,JG=qC,zG=$C,QG=Sd,qG=tP,$G=[],eD=OG($G.sort),tD=OG($G.push),nD=jG((function(){$G.sort(void 0)})),rD=jG((function(){$G.sort(null)})),iD=BG("sort"),oD=!jG((function(){if(QG)return QG<70;if(!(JG&&JG>3)){if(zG)return!0;if(qG)return qG<603;var e,t,n,r,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(r=0;r<47;r++)$G.push({k:t+r,v:n})}for($G.sort((function(e,t){return t.v-e.v})),r=0;r<$G.length;r++)t=$G[r].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));WG({target:"Array",proto:!0,forced:nD||!rD||!iD||!oD},{sort:function(e){void 0!==e&&NG(e);var t=UG(this);if(oD)return void 0===e?eD(t):eD(t,e);var n,r,i=[],o=FG(t);for(r=0;r<o;r++)r in t&&tD(i,t[r]);for(HG(i,function(e){return function(t,n){return void 0===n?-1:void 0===t?1:void 0!==e?+e(t,n)||0:KG(t)>KG(n)?1:-1}}(e)),n=FG(i),r=0;r<n;)t[r]=i[r++];for(;r<o;)YG(t,r++);return t}});var aD=function(){function e(t){pl(this,e),this.TAG="AudioTimeRange",this._parent=t,this._buffers=[],this._duration=0,this._baseDts=0,this._lastBuffer=null}return yl(e,[{key:"isLive",get:function(){return this._parent.isLive}},{key:"duration",get:function(){return this._duration},set:function(e){this._duration=e}},{key:"buffered",get:function(){var e=this;if(this.isLive)return{length:this._duration?1:0,start:function(){return 0},end:function(){return e._duration}};var t=this._mergeBufferRanges();return{length:t.length,start:function(e){var n=t[e];return n?n.start:0},end:function(e){var n=t[e];return n?n.end:1/0}}}},{key:"resetDts",value:function(e){this._baseDts=e}},{key:"_transitionSamples",value:function(e){for(var t=e.numberOfChannels,n=e.length,r=512,i=0;i<t;i++){for(var o=e.getChannelData(i),a=0;a<r;a++)o[a]=o[a]*a/r;for(var s=n-r;s<n;s++)o[s]=o[s]*(n-s)/r}}},{key:"append",value:function(e,t,n,r){-1===this._baseDts&&(this._baseDts=n),this._transitionSamples(e);var i=(n-this._baseDts)/1e3,o=i+t,a={start:i,end:o,startDts:n,source:e,duration:t,delay:r};if(VP.log(this.TAG,"add new buffer range, startDts:".concat(n,", [").concat(a.start," , ").concat(a.end,"]")),!this._buffers.filter((function(e){return e.start===i})).length)return this._buffers.push(a),this.isLive&&(this._duration=o),a.start;console.error("音频重复")}},{key:"deletePassed",value:function(e){return this._buffers=this._buffers.filter((function(t){return t.start>=e})),this._buffers[0]}},{key:"canSeek",value:function(e){var t=this._buffers[this._buffers.length-1];return!!t&&!(t.start<e)}},{key:"_mergeBufferRanges",value:function(){var e=this._buffers.slice().sort((function(e,t){return e.start>t.start?1:-1})),t=e.length,n=[];if(!t)return n;for(var r={start:e[0].start,end:e[0].end},i=1;i<t;i++){var o=e[i];Math.abs(r.end-o.start)<.5?r.end=o.end:(n.push(r),r={start:o.start,end:o.end})}return n.push(r),n}},{key:"getBuffer",value:function(e){if(this.isLive)return this._buffers.shift();var t=this._buffers.filter((function(t){return t.start<e+.5&&t.end>e+.5}))[0];return VP.log(this.TAG,"get audio buffer , currentTime:".concat(e," ,buffer:[").concat(t&&t.start," , ").concat(t&&t.end,"]")),0!==e||t?t:this._buffers[0]}},{key:"hasBuffer",value:function(){var e;return!(null===(e=this._buffers)||void 0===e||!e.length)}}]),e}(),sD=[-5504,-5248,-6016,-5760,-4480,-4224,-4992,-4736,-7552,-7296,-8064,-7808,-6528,-6272,-7040,-6784,-2752,-2624,-3008,-2880,-2240,-2112,-2496,-2368,-3776,-3648,-4032,-3904,-3264,-3136,-3520,-3392,-22016,-20992,-24064,-23040,-17920,-16896,-19968,-18944,-30208,-29184,-32256,-31232,-26112,-25088,-28160,-27136,-11008,-10496,-12032,-11520,-8960,-8448,-9984,-9472,-15104,-14592,-16128,-15616,-13056,-12544,-14080,-13568,-344,-328,-376,-360,-280,-264,-312,-296,-472,-456,-504,-488,-408,-392,-440,-424,-88,-72,-120,-104,-24,-8,-56,-40,-216,-200,-248,-232,-152,-136,-184,-168,-1376,-1312,-1504,-1440,-1120,-1056,-1248,-1184,-1888,-1824,-2016,-1952,-1632,-1568,-1760,-1696,-688,-656,-752,-720,-560,-528,-624,-592,-944,-912,-1008,-976,-816,-784,-880,-848,5504,5248,6016,5760,4480,4224,4992,4736,7552,7296,8064,7808,6528,6272,7040,6784,2752,2624,3008,2880,2240,2112,2496,2368,3776,3648,4032,3904,3264,3136,3520,3392,22016,20992,24064,23040,17920,16896,19968,18944,30208,29184,32256,31232,26112,25088,28160,27136,11008,10496,12032,11520,8960,8448,9984,9472,15104,14592,16128,15616,13056,12544,14080,13568,344,328,376,360,280,264,312,296,472,456,504,488,408,392,440,424,88,72,120,104,24,8,56,40,216,200,248,232,152,136,184,168,1376,1312,1504,1440,1120,1056,1248,1184,1888,1824,2016,1952,1632,1568,1760,1696,688,656,752,720,560,528,624,592,944,912,1008,976,816,784,880,848],uD=[-32124,-31100,-30076,-29052,-28028,-27004,-25980,-24956,-23932,-22908,-21884,-20860,-19836,-18812,-17788,-16764,-15996,-15484,-14972,-14460,-13948,-13436,-12924,-12412,-11900,-11388,-10876,-10364,-9852,-9340,-8828,-8316,-7932,-7676,-7420,-7164,-6908,-6652,-6396,-6140,-5884,-5628,-5372,-5116,-4860,-4604,-4348,-4092,-3900,-3772,-3644,-3516,-3388,-3260,-3132,-3004,-2876,-2748,-2620,-2492,-2364,-2236,-2108,-1980,-1884,-1820,-1756,-1692,-1628,-1564,-1500,-1436,-1372,-1308,-1244,-1180,-1116,-1052,-988,-924,-876,-844,-812,-780,-748,-716,-684,-652,-620,-588,-556,-524,-492,-460,-428,-396,-372,-356,-340,-324,-308,-292,-276,-260,-244,-228,-212,-196,-180,-164,-148,-132,-120,-112,-104,-96,-88,-80,-72,-64,-56,-48,-40,-32,-24,-16,-8,0,32124,31100,30076,29052,28028,27004,25980,24956,23932,22908,21884,20860,19836,18812,17788,16764,15996,15484,14972,14460,13948,13436,12924,12412,11900,11388,10876,10364,9852,9340,8828,8316,7932,7676,7420,7164,6908,6652,6396,6140,5884,5628,5372,5116,4860,4604,4348,4092,3900,3772,3644,3516,3388,3260,3132,3004,2876,2748,2620,2492,2364,2236,2108,1980,1884,1820,1756,1692,1628,1564,1500,1436,1372,1308,1244,1180,1116,1052,988,924,876,844,812,780,748,716,684,652,620,588,556,524,492,460,428,396,372,356,340,324,308,292,276,260,244,228,212,196,180,164,148,132,120,112,104,96,88,80,72,64,56,48,40,32,24,16,8,0],cD=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]);var lD={decodeG711:function(e,t){if("g7110a"===t)return function(e){for(var t=new Uint8Array(2*e.length),n=0,r=0;n<e.length;){var i=sD[e[n]];if(void 0===i)throw new Error("can not decode g711 alaw data!");t[r]=255&i,t[r+1]=i>>8,n+=1,r+=2}return t}(e);if("g7110m"===t)return function(e){for(var t=new Uint8Array(2*e.length),n=0,r=0;n<e.length;){var i=uD[e[n]];if(void 0===i)throw new Error("can not decode g711 ulaw data!");t[r]=255&i,t[r+1]=i>>8,n+=1,r+=2}return t}(e);throw new Error("no supported format=".concat(t," for g711"))},createAudioBufferFromPcm:function(e,t,n,r,i){for(var o,a=function(e,t,n){return e/t/n}(t.byteLength,n,i),s=e.createBuffer(n,a,r),u=new DataView(t),c=0;c<n;c++)for(var l=s.getChannelData(c),d=void 0,h=0;h<a;h++)d=u.getUint16(h*(2*n)+2*c,!0),l[h]=(o=d)>=32768?-(65536-o)/32768:o/32767;return{audioBuffer:s,duration:a/r}},packageAACToAdts:function(e,t){var n=new Uint8Array(t.data.byteLength+7),r=function(e,t){var n=e.sampleRateIndex,r=e.channelCount;n=function(e,t){var n=(7&e[0])<<1|e[1]>>>7;return n!==t?n:t}(e.config,n);var i=new Uint8Array(7);i[0]=255,i[1]=240,i[1]=1|i[1],i[2]=64,i[2]=i[2]|60&n<<2,i[2]=i[2]|1&r>>2,i[3]=192&r<<6;var o=t.byteLength+7;return i[3]=i[3]|3&o>>11,i[4]=255&o>>3,i[5]=224&o<<5,i[5]=31|i[5],i[6]=252,i}(e,t.data);return n.set(r),n.set(t.data,7),n},concatAdts:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0,r=0,i=e.length;r<i;r++)t&&r%t==0||(n+=e[r].byteLength);for(var o=new Uint8Array(n),a=0,s=0,u=e.length;s<u;s++)t&&s%t==0||(o.set(e[s],a),a+=e[s].byteLength);return o},checkRefillFrame:function(e){var t=e[0].dts,n=e.filter((function(e){return e.dts===t})).length;if(!(n<=1))for(var r=0;r<n;r++)e[r].data=cD}},dD="create new AudioContext error",hD=function(e){gl(i,e);var t,n,r=wl(i);function i(e,t){var n;return pl(this,i),vl(_l(n=r.call(this,e,t)),"doPause",n._doPause),n.TAG="AudioRender",n._timeRange=new aD(_l(n)),n._lastTimeLineTime=0,n._sampleQueue=[],n._source=null,n._audioCanAutoplay=!0,n._lastBuffer=null,n._inDecoding=!1,n._endOfStream=!1,n._delay=0,n._isSourceBufferEnd=-1,n._onSourceBufferEnded=n._onSourceBufferEnded.bind(_l(n)),n._initAudioCtx(e.volume||.6),n._bindEvents(),n}return yl(i,[{key:"baseDts",get:function(){return this._timeRange._baseDts}},{key:"currentTime",get:function(){return this._audioCtx?this._lastTimeLineTime+this._audioCtx.currentTime:0}},{key:"preloadTime",get:function(){return this.isLive?1:0}},{key:"timescale",get:function(){return 1e3}},{key:"buffered",get:function(){return this._timeRange.buffered}},{key:"ctxState",get:function(){return this._audioCtx.state}},{key:"audioCanAutoplay",get:function(){return this._audioCanAutoplay}},{key:"resume",value:function(){if(this._audioCtx&&"suspended"===this._audioCtx.state)return this._audioCtx.resume().catch((function(e){}))}},{key:"canSeek",value:function(e){return this._timeRange.canSeek(e)}},{key:"_assembleErr",value:function(e){var t=new Error(e);return t.code=3,t}},{key:"_emitTimelineEvents",value:function(e,t,n){var r,i;null===(r=this._parent)||void 0===r||null===(i=r.emit)||void 0===i||i.call(r,e,t,n)}},{key:"_initAudioCtx",value:function(e){var t=this;VP.log(this.TAG,"init audioCtx");var n=window.AudioContext||window.webkitAudioContext;return this._audioCtx=new n,this._audioCtx?(this._gainNode=this._audioCtx.createGain(),this._gainNode.gain.value=e,this._gainNode.connect(this._audioCtx.destination),this._audioCanAutoplay="running"===this._audioCtx.state,VP.log(this.TAG,"webAudio state:",this._audioCtx.state),UT(),this._bindAudioCtxEvent(),this._audioCtx.suspend()):(VP.warn(this.TAG,"create webaudio error!"),void setTimeout((function(){t._emitTimelineEvents(MG.PLAY_EVENT,CG.ERROR,t._assembleErr(dD))})))}},{key:"_bindAudioCtxEvent",value:function(){var e=this;this._onStateChange=function(){e._audioCtx&&"running"===e._audioCtx.state&&e._ready&&e._emitTimelineEvents(MG.PLAY_EVENT,CG.PLAYING)},this._audioCtx.addEventListener("statechange",this._onStateChange)}},{key:"_bindEvents",value:function(){var e=this;Sl(bl(i.prototype),"_bindEvents",this).call(this),this._parent.on(VG.CHASE_AUDIO_FRAME,this._doChaseFrame.bind(this)),this._parent.on(MG.UPDATE_VOLUME,(function(t){e._gainNode&&(e._gainNode.gain.value=Number.isFinite(t)?t:1,e._emitTimelineEvents(MG.PLAY_EVENT,CG.VOLUME_CHANGE))})),this._parent.on(MG.END_OF_STREAM,(function(){var t;e._endOfStream=!0,e.noAudio||null!==(t=e._timeRange)&&void 0!==t&&t.hasBuffer()||null==e||e._emitTimelineEvents(MG.PLAY_EVENT,CG.ENDED)}))}},{key:"_appendChunk",value:function(e,t){if(!this.noAudio){this._meta||(this._meta=t,VP.warn(this.TAG,"audio set metadata",this._meta));var n=t.samples;if(n.length)if(this._sampleQueue=this._sampleQueue.concat(n),t.samples=[],"aac"===this._meta.codecType){if(this._inDecoding)return;this._decodeAACWrapper()}else this._decodeG711()}}},{key:"_resetDts",value:function(e,t){"video"!==t&&this._timeRange.resetDts(e)}},{key:"_doPlay",value:function(){this.noAudio||this._parent.seeking||(this._source||!this.currentTime?this.resume():this._startRender())}},{key:"_doPause",value:function(){this.noAudio||this._audioCtx.suspend()}},{key:"_reInitAudioCtx",value:function(e){var t=this;if(this._lastTimeLineTime=e,this._lastBuffer=null,this._lastAudioBufferInfo=null,this._delay=0,!this._ready||!this._audioCtx.currentTime)return Promise.resolve();var n=this._gainNode.gain.value;return this._audioCtx.close().then((function(){return t._audioCtx.removeEventListener("statechange",t._onStateChange),t._audioCtx=null,t._source&&t._source.removeEventListener("ended",t._onSourceBufferEnded),t._source=null,t._initAudioCtx(n)}))}},{key:"_doSeek",value:function(e){var t=this;this._reInitAudioCtx(e).then((function(){t._getAudioBuffer(!0)})).catch((function(e){}))}},{key:"_doChaseFrame",value:function(e){var t=this,n=e.position,r=this._timeRange.deletePassed(n);r&&(VP.log(this.TAG,"_doChaseFrame","startTime:",r.start,"buffeLength:",this.buffered.end(0)-r.start),this._reInitAudioCtx(r.start).then((function(){t._startRender(),t._emitTimelineEvents(MG.PLAY_EVENT,CG.TIMEUPDATE)})).catch((function(e){})))}},{key:"_decodeAACWrapper",value:(n=fl(dl().mark((function e(){var t,n,r,i,o,a,s,u,c,l;return dl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._sampleQueue.length,n=this._sampleQueue[0],r=this._sampleQueue[t-1],!((i=(r.dts-n.dts)/this.timescale)<1)){e.next=6;break}return e.abrupt("return");case 6:for(o=parseInt(i/3-1)||1,a=parseInt(t/o),s=[],u=0;u<o;u++)u<o-1?s.push(this._sampleQueue.slice(u*a,(u+1)*a)):s.push(this._sampleQueue.slice(u*a));return this._sampleQueue=[],this._inDecoding=!0,e.prev=12,e.next=15,this._decodeCycle(s);case 15:this._isLive||(c=this._timeRange._buffers,(l=c[c.length-1])&&this._emitTimelineEvents(MG.UPDATE_SEGMENT_END,l.end)),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(12),this._emitTimelineEvents(MG.PLAY_EVENT,CG.ERROR,this._assembleErr("ERROR_MSG.DECODE_ERR:".concat(e.t0&&e.t0.message)));case 21:this._inDecoding=!1;case 22:case"end":return e.stop()}}),e,this,[[12,18]])}))),function(){return n.apply(this,arguments)})},{key:"_decodeCycle",value:(t=fl(dl().mark((function e(t){var n;return dl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.shift()){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this._decodeAAC(n);case 5:return e.next=7,this._decodeCycle(t);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_decodeAAC",value:function(e){var t=this,n=e[0],r=0;lD.checkRefillFrame(e);var i=e.map((function(e){return lD.packageAACToAdts(t._meta,e)})),o=lD.concatAdts(i,0);return new Promise((function(e,i){var a=t._audioCtx.decodeAudioData(o.buffer,(function(i){if(t._timeRange){if(t._lastAudioBufferInfo&&t.isLive){var o=t._lastAudioBufferInfo,a=o.dts+o.duration;(r=n.dts-a)>1&&(t._timeRange._duration+=r/1e3,VP.log(t.TAG,"_decodeAAC","audio data dts is not continue, last end dts:",a,",now start Dts:",n.dts,"delay:",r))}t._lastAudioBufferInfo={duration:Math.floor(1e3*i.duration),dts:n.dts};var s=t._timeRange.append(i,i.duration,n.dts,r/1e3);if(!t._ready){var u=Math.abs(s+i.duration-t.currentTime)<.5;(t.isLive||!u)&&(t._ready=!0,VP.log(t.TAG,"_decodeAAC","set ready true start=",s),t.emit(GG.AUDIO_READY,s))}t._emitTimelineEvents(MG.PLAY_EVENT,CG.PROGRESS),t._emitTimelineEvents(MG.PLAY_EVENT,CG.DURATION_CHANGE),e()}}),i);a.catch&&a.catch(i)}))}},{key:"_decodeG711",value:function(){var e=this._sampleQueue.length,t=this._sampleQueue[0];if(!((this._sampleQueue[e-1].dts-t.dts)/this.timescale<.5)){var n=this._sampleQueue.reduce((function(e,t){return e+=t.data.byteLength}),0),r=new Uint8Array(n),i=0,o=0;this._sampleQueue.forEach((function(e,t){0===t&&(i=e.dts),r.set(e.data,o),o+=e.data.byteLength})),this._sampleQueue=[];try{var a=this._meta,s=a.codecType,u=a.channelCount,c=a.sampleSize,l=a.sampleRate,d=lD.decodeG711(r,s),h=lD.createAudioBufferFromPcm(this._audioCtx,d.buffer,u,l,c/8),f=h.audioBuffer,p=h.duration,m=this._timeRange.append(f,p,i,0);this._ready||(this._ready=!0,VP.log(this.TAG,"_decodeG711","set ready true"),this.emit(GG.AUDIO_READY,m)),this._emitTimelineEvents(MG.PLAY_EVENT,CG.PROGRESS),this._emitTimelineEvents(MG.PLAY_EVENT,CG.DURATION_CHANGE)}catch(kye){this._emitTimelineEvents(MG.PLAY_EVENT,CG.ERROR,this._assembleErr("ERROR_MSG.DECODE_ERR:".concat(kye&&kye.message)))}}}},{key:"_onSourceBufferEnded",value:function(){this._isSourceBufferEnd=!0,VP.long&&VP.log(this.TAG,"source play end! currentTime:".concat(this.currentTime," , duration:").concat(this.duration)),this._startRender()}},{key:"_ajustSeekTime",value:function(e){var t=this._timeRange.getBuffer(e,0);t&&(VP.log(this.TAG,"ajust seek time to:",t.start),this._lastTimeLineTime=t.start)}},{key:"_getAudioBuffer",value:function(e){var t=this;if(this._timeRange){var n=this._timeRange.getBuffer(this._lastBuffer?this._lastBuffer.end:this.currentTime,0);return n?e?(this._ajustSeekTime(n.start),void this.emit(GG.AUDIO_READY)):n:(this._endOfStream||!this._isLive)&&this.currentTime-this.duration>-.5?(this._emitTimelineEvents(MG.PLAY_EVENT,CG.TIMEUPDATE),void this._emitTimelineEvents(MG.PLAY_EVENT,CG.ENDED)):(this._ready=!1,this._audioCtx.suspend(),this.emit(GG.AUDIO_WAITING),void(e&&(this._onAudioReady||(this._onAudioReady=function(e){t._ajustSeekTime(e)}),this.removeListener(GG.AUDIO_READY,this._onAudioReady),this.once(GG.AUDIO_READY,this._onAudioReady))))}}},{key:"_startRender",value:function(e){if(!this.noAudio){if("video"===e&&this.isLive&&this._ready&&!this._isSourceBufferEnd)return console.log(this.TAG,"_startRender, audio currentTime",this.currentTime,"from:",e,"_isSourceBufferEnd:",this._isSourceBufferEnd,"ready:",this._ready),void this._doPlay();var t=this._getAudioBuffer();if(t){"suspended"===this._audioCtx.state&&(this._audioCtx.resume().catch((function(e){})),FT()),this._lastBuffer=t,this._source=null;var n=this._audioCtx.createBufferSource();n.buffer=t.source,n.loop=!1,this._source=n,n.addEventListener("ended",this._onSourceBufferEnded),n.connect(this._gainNode),t.delay&&t.delay>.001&&(this._delay+=t.delay),this.startDts=t.startDts;try{this._isSourceBufferEnd=!1,n.start()}catch(kye){}t.startDts&&this._emitTimelineEvents(MG.SYNC_DTS,t.startDts)}}}},{key:"_destroy",value:function(){VP.log(this.TAG,"destroy audio..."),this._source&&this._source.removeEventListener("ended",this._onSourceBufferEnded),this._audioCtx&&"closed"!==this.ctxState&&this._audioCtx.close(),this._audioCtx=null,this._sampleQueue=null,this._timeRange=null,this._parent=null,this.removeAllListeners()}}]),i}(XG),fD=Py,pD=dm.findIndex,mD=MT,yD="findIndex",vD=!0;yD in[]&&Array(1)[yD]((function(){vD=!1})),fD({target:"Array",proto:!0,forced:vD},{findIndex:function(e){return pD(this,e,arguments.length>1?arguments[1]:void 0)}}),mD(yD);var gD=Nd,bD=Mp,AD=TypeError,_D=Object.getOwnPropertyDescriptor,wD=gD&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(Sye){return Sye instanceof TypeError}}(),SD=Py,kD=ed,TD=Ym,xD=Ip,ED=Gp,LD=wD?function(e,t){if(bD(e)&&!_D(e,"length").writable)throw AD("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},ID=tk,RD=rm,ZD=Xy,CD=GR,PD=Gb("splice"),GD=Math.max,DD=Math.min;SD({target:"Array",proto:!0,forced:!PD},{splice:function(e,t){var n,r,i,o,a,s,u=kD(this),c=ED(u),l=TD(e,c),d=arguments.length;for(0===d?n=r=0:1===d?(n=0,r=c-l):(n=d-2,r=DD(GD(xD(t),0),c-l)),ID(c+n-r),i=RD(u,r),o=0;o<r;o++)(a=l+o)in u&&ZD(i,o,u[a]);if(i.length=r,n<r){for(o=l;o<c-r;o++)s=o+n,(a=o+r)in u?u[s]=u[a]:CD(u,s);for(o=c;o>c-r+n;o--)CD(u,o-1)}else if(n>r)for(o=c-r;o>l;o--)s=o+n-1,(a=o+r-1)in u?u[s]=u[a]:CD(u,s);for(o=0;o<n;o++)u[o+l]=arguments[o+2];return LD(u,c-r+n),i}});var MD=ed,VD=fv;Py({target:"Object",stat:!0,forced:Nl((function(){VD(1)}))},{keys:function(e){return VD(MD(e))}});var XD=Ng.charAt,WD=tv,OD=Zf,ND=Mx,UD=Vx,FD="String Iterator",YD=OD.set,KD=OD.getterFor(FD);ND(String,"String",(function(e){YD(this,{type:FD,string:WD(e),index:0})}),(function(){var e,t=KD(this),n=t.string,r=t.index;return r>=n.length?UD(void 0,!0):(e=XD(n,r),t.index+=e.length,UD(e,!1))}));var jD=Il,HD=cp,BD=hp,JD=Jx,zD=ff,QD=Vd,qD=QD("iterator"),$D=QD("toStringTag"),eM=JD.values,tM=function(e,t){if(e){if(e[qD]!==eM)try{zD(e,qD,eM)}catch(Sye){e[qD]=eM}if(e[$D]||zD(e,$D,t),HD[t])for(var n in JD)if(e[n]!==JD[n])try{zD(e,n,JD[n])}catch(Sye){e[n]=JD[n]}}};for(var nM in HD)tM(jD[nM]&&jD[nM].prototype,nM);function rM(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iM(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oM(e,t,n){return t&&iM(e.prototype,t),n&&iM(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function aM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sM(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(u){s=!0,i=u}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(e,t)||cM(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 uM(e){return function(e){if(Array.isArray(e))return lM(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||cM(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 cM(e,t){if(e){if("string"==typeof e)return lM(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lM(e,t):void 0}}function lM(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}tM(BD,"DOMTokenList");var dM=Jm.includes,hM=MT;Py({target:"Array",proto:!0,forced:Nl((function(){return!Array(1).includes()}))},{includes:function(e){return dM(this,e,arguments.length>1?arguments[1]:void 0)}}),hM("includes");var fM=Yd,pM=$f,mM=Vd("match"),yM=function(e){var t;return fM(e)&&(void 0!==(t=e[mM])?!!t:"RegExp"==pM(e))},vM=yM,gM=TypeError,bM=function(e){if(vM(e))throw gM("The method doesn't accept regular expressions");return e},AM=Vd("match"),_M=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[AM]=!1,"/./"[e](t)}catch(r){}}return!1},wM=Py,SM=bM,kM=Ql,TM=tv,xM=_M,EM=Hl("".indexOf);wM({target:"String",proto:!0,forced:!xM("includes")},{includes:function(e){return!!~EM(TM(kM(this)),TM(SM(e)),arguments.length>1?arguments[1]:void 0)}});var LM="video",IM="hevc",RM=ih,ZM=rd,CM=oh,PM=rv,GM=RegExp.prototype,DM=qh.PROPER,MM=Jf,VM=th,XM=tv,WM=Nl,OM=function(e){var t=e.flags;return void 0!==t||"flags"in GM||ZM(e,"flags")||!CM(GM,e)?t:RM(PM,e)},NM="toString",UM=RegExp.prototype[NM],FM=WM((function(){return"/a/b"!=UM.call({source:"a",flags:"b"})})),YM=DM&&UM.name!=NM;(FM||YM)&&MM(RegExp.prototype,NM,(function(){var e=VM(this);return"/"+XM(e.source)+"/"+XM(OM(e))}),{unsafe:!0});var KM=Nd,jM=qh.EXISTS,HM=Hl,BM=Od.f,JM=Function.prototype,zM=HM(JM.toString),QM=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,qM=HM(QM.exec);KM&&!jM&&BM(JM,"name",{configurable:!0,get:function(){try{return qM(QM,zM(this))[1]}catch(Sye){return""}}});var $M=Py,eV=kp,tV=Rm,nV=fm,rV=Hl([].join),iV=eV!=Object,oV=nV("join",",");function aV(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t=t.filter(Boolean);var r=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){r.set(e,i),i+=e.byteLength})),r}function sV(e){if(!Array.isArray(e)){for(var t=[],n="",r=0;r<e.length;r++)r%2&&(n=e[r-1]+e[r],t.push(parseInt(n,16)),n="");return t}return e.map((function(e){return parseInt(e,16)}))}$M({target:"Array",proto:!0,forced:iV||!oV},{join:function(e){return rV(tV(this),void 0===e?",":e)}});var uV=Yf,cV=Od,lV=function(e,t,n){return n.get&&uV(n.get,t,{getter:!0}),n.set&&uV(n.set,t,{setter:!0}),cV.f(e,t,n)},dV=Nd,hV=lV,fV=rv,pV=Nl,mV=Il.RegExp,yV=mV.prototype;dV&&pV((function(){var e=!0;try{mV(".","d")}catch(Sye){e=!1}var t={},n="",r=e?"dgimsy":"gimsy",i=function(e,r){Object.defineProperty(t,e,{get:function(){return n+=r,!0}})},o={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var a in e&&(o.hasIndices="d"),o)i(a,o[a]);return Object.getOwnPropertyDescriptor(yV,"flags").get.call(t)!==r||n!==r}))&&hV(yV,"flags",{configurable:!0,get:fV});var vV=Ip,gV=tv,bV=Ql,AV=RangeError,_V=function(e){var t=gV(bV(this)),n="",r=vV(e);if(r<0||r==1/0)throw AV("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n},wV=Hl,SV=Cp,kV=tv,TV=Ql,xV=wV(_V),EV=wV("".slice),LV=Math.ceil,IV=function(e){return function(t,n,r){var i,o,a=kV(TV(t)),s=SV(n),u=a.length,c=void 0===r?" ":kV(r);return s<=u||""==c?a:((o=xV(c,LV((i=s-u)/c.length))).length>i&&(o=EV(o,0,i)),e?a+o:o+a)}},RV={start:IV(!1),end:IV(!0)},ZV=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(yd),CV=RV.start;Py({target:"String",proto:!0,forced:ZV},{padStart:function(e){return CV(this,e,arguments.length>1?arguments[1]:void 0)}});var PV=Py,GV=dm.find,DV=MT,MV="find",VV=!0;MV in[]&&Array(1)[MV]((function(){VV=!1})),PV({target:"Array",proto:!0,forced:VV},{find:function(e){return GV(this,e,arguments.length>1?arguments[1]:void 0)}}),DV(MV);var XV=th,WV=oS,OV=bp,NV=ih,UV=ed,FV=function(e,t,n,r){try{return r?t(XV(n)[0],n[1]):t(n)}catch(Sye){WV(e,"throw",Sye)}},YV=Uw,KV=zp,jV=Gp,HV=Xy,BV=tS,JV=Bw,zV=Array,QV=function(e){var t=UV(e),n=KV(this),r=arguments.length,i=r>1?arguments[1]:void 0,o=void 0!==i;o&&(i=OV(i,r>2?arguments[2]:void 0));var a,s,u,c,l,d,h=JV(t),f=0;if(!h||this===zV&&YV(h))for(a=jV(t),s=n?new this(a):zV(a);a>f;f++)d=o?i(t[f],f):t[f],HV(s,f,d);else for(l=(c=BV(t,h)).next,s=n?new this:[];!(u=NV(l,c)).done;f++)d=o?FV(c,i,[u.value,f],!0):u.value,HV(s,f,d);return s.length=f,s},qV=QV;Py({target:"Array",stat:!0,forced:!kS((function(e){Array.from(e)}))},{from:qV});var $V=nA,eX="ArrayBuffer",tX=iI[eX];Py({global:!0,constructor:!0,forced:Il[eX]!==tX},{ArrayBuffer:tX}),$V(eX);var nX=function(){function e(){rM(this,e),this.buffer=new Uint8Array(0)}return oM(e,[{key:"write",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach((function(t){t?e.buffer=function(e){for(var t=0,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];r.forEach((function(e){t+=e.length}));var o=new e(t),a=0;return r.forEach((function(e){o.set(e,a),a+=e.length})),o}(Uint8Array,e.buffer,t):window.console.warn(t)}))}}],[{key:"writeUint16",value:function(e){return new Uint8Array([e>>8&255,255&e])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}]),e}(),rX=Math.pow(2,32)-1,iX=function(){function e(){rM(this,e)}return oM(e,null,[{key:"box",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=8+(n=n.filter(Boolean)).reduce((function(e,t){return e+t.byteLength}),0),o=new Uint8Array(i);o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=255&i,o.set(e,4);var a=8;return n.forEach((function(e){o.set(e,a),a+=e.byteLength})),o}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===LM&&e.codecType===IM}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return aV(e.ftyp(t),e.moov(t))}},{key:"pssh",value:function(t){var n=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],sV(t.kid),[0,0,0,0]));return e.box(e.types.pssh,n)}},{key:"moov",value:function(t){if(t[0].useEME&&(t[0].encv||t[0].enca)){t[0].pssh||(t[0].pssh={kid:t[0].kid});var n=this.pssh(t[0].pssh);return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale),e.mvex(t)].concat(uM(t.map((function(t){return e.trak(t)}))),[n]))}return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale)].concat(uM(t.map((function(t){return e.trak(t)}))),[e.mvex(t)]))}},{key:"mvhd",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mvhd,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,t>>24&255,t>>16&255,t>>8&255,255&t,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]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.tkhdDuration||0,t.width,t.height),e.mdia(t))}},{key:"tkhd",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,255&r,0,0,i>>8&255,255&i,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minf(t))}},{key:"mdhd",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;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,t>>24&255,t>>16&255,t>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"minf",value:function(t){return e.box(e.types.minf,t.type===LM?e.VMHD:e.SMHD,e.DINF,e.stbl(t))}},{key:"stbl",value:function(t){var n=[];return t&&t.ext&&t.ext.stss&&n.push(e.stss(t.ext.stss.entries)),e.box(e.types.stbl,e.stsd(t),e.STTS,n[0],e.STSC,e.STSZ,e.STCO)}},{key:"stsd",value:function(t){var n;return n="audio"===t.type?t.useEME&&t.enca?e.enca(t):e.mp4a(t):t.useEME&&t.encv?e.encv(t):e.avc1hev1(t),e.box(e.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),n)}},{key:"enca",value:function(t){var n=t.enca.channelCount,r=t.enca.sampleRate,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]),o=e.esds(t.config),a=e.sinf(t.enca);return e.box(e.types.enca,i,o,a)}},{key:"encv",value:function(t){var n,r,i=t.sps.length>0?t.sps[0]:[],o=t.pps.length>0?t.pps[0]:[],a=t.width,s=t.height,u=t.sarRatio[0],c=t.sarRatio[1],l=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,a>>8&255,255&a,s>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),d=new Uint8Array((n=(r=[1,i[1],i[2],i[3],255,225,i.length>>>8&255,255&i.length]).concat.apply(r,uM(i)).concat([1,o.length>>>8&255,255&o.length])).concat.apply(n,uM(o))),h=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),f=e.sinf(t.encv),p=new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,c>>24,c>>16&255,c>>8&255,255&c]);return e.box(e.types.encv,l,e.box(e.types.avcC,d),e.box(e.types.btrt,h),f,e.box(e.types.pasp,p))}},{key:"schi",value:function(t){var n=new Uint8Array([]),r=e.tenc(t);return e.box(e.types.schi,n,r)}},{key:"tenc",value:function(t){var n=new Uint8Array([0,0,0,0,0,0,255&t.default_IsEncrypted,255&t.default_IV_size].concat(sV(t.default_KID)));return e.box(e.types.tenc,n)}},{key:"sinf",value:function(t){var n=new Uint8Array([]),r=new Uint8Array([t.data_format.charCodeAt(0),t.data_format.charCodeAt(1),t.data_format.charCodeAt(2),t.data_format.charCodeAt(3)]),i=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),o=e.schi(t);return e.box(e.types.sinf,n,e.box(e.types.frma,r),e.box(e.types.schm,i),o)}},{key:"avc1hev1",value:function(t){var n=t.codecType===IM,r=n?e.types.hvc1:e.types.avc1,i=n?e.hvcC(t):e.avcC(t),o=[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,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,17,17]),i];return n?o.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&o.push(e.pasp(t.sarRatio)),e.box.apply(e,[r].concat(o))}},{key:"avcC",value:function(t){var n,r,i,o=[],a=[];return t.sps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,uM(e))})),t.pps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,uM(e))})),e.box(e.types.avcC,new Uint8Array((n=(r=[1,o[3],o[4],o[5],255,224|t.sps.length]).concat.apply(r,o).concat([t.pps.length])).concat.apply(n,a)))}},{key:"hvcC",value:function(t){var n=t.hvcC;if(n instanceof ArrayBuffer||n instanceof Uint8Array)return n;var r,i=t.vps,o=t.sps,a=t.pps;if(n){var s=n.generalProfileCompatibilityFlags,u=n.generalConstraintIndicatorFlags,c=(i.length&&1)+(o.length&&1)+(a.length&&1);r=[1,n.generalProfileSpace<<6|n.generalTierFlag<<5|n.generalProfileIdc,s>>>24,s>>>16,s>>>8,s,u[0],u[1],u[2],u[3],u[4],u[5],n.generalLevelIdc,240,0,252,252|n.chromaFormatIdc,248|n.bitDepthLumaMinus8,248|n.bitDepthChromaMinus8,0,0,n.numTemporalLayers<<3|n.temporalIdNested<<2|3,c];var l=function(e){var t;r.push(e.length>>8,e.length),(t=r).push.apply(t,uM(e))};i.length&&(r.push(160,0,i.length),i.forEach(l)),o.length&&(r.push(161,0,o.length),o.forEach(l)),a.length&&(r.push(162,0,a.length),a.forEach(l))}else r=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return e.box(e.types.hvcC,new Uint8Array(r))}},{key:"pasp",value:function(t){var n=sM(t,2),r=n[0],i=n[1];return e.box(e.types.pasp,new Uint8Array([r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),t.config.length?e.esds(t.config):void 0)}},{key:"esds",value:function(t){var n=t.length;return e.box(e.types.esds,new Uint8Array([0,0,0,0,3,23+n,0,0,0,4,15+n,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([n]).concat(t).concat([6,1,2])))}},{key:"mvex",value:function(t){return e.box.apply(e,[e.types.mvex].concat(uM(t.map((function(t){return e.trex(t.id)})))))}},{key:"trex",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trex1",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]))}},{key:"trex2",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]))}},{key:"moof",value:function(t){return e.box.apply(e,[e.types.moof,e.mfhd(t[0].samples?t[0].samples[0].gopId:0)].concat(uM(t.map((function(t){return e.traf(t)})))))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"traf",value:function(t){var n=e.tfhd(t.id),r=e.tfdt(t,t.baseMediaDecodeTime),i=0;if(t.isVideo&&t.videoSenc&&t.videoSenc.forEach((function(e){i+=8,e.subsamples&&e.subsamples.length&&(i+=2,i+=6*e.subsamples.length)})),t.videoSencLength=i,t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)){if(t.isVideoEncryption){if(t.isVideo){var o=e.saiz(t),a=e.saio(t),s=e.trun1(t),u=e.senc(t);return e.box(e.types.traf,n,r,o,a,s,u)}if(t.isAudioEncryption){var c=e.sbgp(),l=e.saiz(t),d=e.saio(t),h=e.senc(t),f=e.trun1(t);return e.box(e.types.traf,n,r,c,l,d,h,f)}var p=e.sbgp(),m=e.trun1(t);return e.box(e.types.traf,n,r,p,m)}if(t.isVideo){var y=e.trun1(t);return e.box(e.types.traf,n,r,y)}var v=e.sbgp(),g=e.saiz(t),b=e.saio(t),A=e.senc(t),_=e.trun1(t);return e.box(e.types.traf,n,r,v,g,b,A,_)}var w=e.sdtp(t);return e.box(e.types.traf,n,r,w,e.trun(t.samples,w.byteLength+76))}},{key:"sdtp",value:function(t){var n=new nX;return t.samples.forEach((function(e){n.write(new Uint8Array(t.isVideo?[e.keyframe?32:16]:[16]))})),e.box(e.types.sdtp,this.extension(0,0),n.buffer)}},{key:"trun1",value:function(t){var n=new nX,r=nX.writeUint32(t.samples.length),i=null;if(t.isVideo){var o=t.videoSencLength;i=nX.writeUint32(16*t.samples.length+o+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=nX.writeUint32(16*t.samples.length+92))}else{var a=12*t.samples.length+124;t.isAudioEncryption&&(a=12*t.samples.length+8*t.audioSenc.length+177),i=nX.writeUint32(a)}return t.samples.forEach((function(e){n.write(nX.writeUint32(e.duration)),n.write(nX.writeUint32(e.size)),n.write(nX.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&n.write(nX.writeUint32(e.cts?e.cts:0))})),e.box(e.types.trun,this.extension(0,t.flags),r,i,n.buffer)}},{key:"senc",value:function(t){var n=new nX,r=t.samples.length,i=t.isVideo?16:8,o=t.isVideo?2:0,a=[],s=0;return t.isVideo?(a=t.videoSenc,s=t.videoSencLength):a=t.audioSenc,s=s||i*r,n.write(nX.writeUint32(16+s),e.types.senc,this.extension(0,o)),n.write(nX.writeUint32(r)),a.forEach((function(e){for(var t=0;t<e.InitializationVector.length;t++)n.write(new Uint8Array([e.InitializationVector[t]]));e.subsamples&&e.subsamples.length&&(n.write(nX.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){n.write(nX.writeUint16(e.BytesOfClearData)),n.write(nX.writeUint32(e.BytesOfProtectedData))})))})),n.buffer}},{key:"saio",value:function(t){var n=12*t.samples.length+141;!t.isVideo&&t.isAudioEncryption&&(n=149);var r=new Uint8Array([1,0,0,0,0,0,0,1,0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n]);return e.box(e.types.saio,r)}},{key:"saiz",value:function(t){var n=t.samples.length,r=new Uint8Array([0,0,0,0,16,n>>24&255,n>>16&255,n>>8&255,255&n]);return e.box(e.types.saiz,r)}},{key:"sbgp",value:function(){var t=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return e.box(e.types.sbgp,this.extension(0,0),t)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"tfhd",value:function(t){return e.box(e.types.tfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"tfdt",value:function(t,n){var r=Math.floor(n/(rX+1)),i=Math.floor(n%(rX+1));return t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)?e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])):e.box(e.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"trun",value:function(t,n){var r=t.length,i=12+16*r;n+=8+i;var o=new Uint8Array(i);o.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0);for(var a=0;a<r;a++){var s=t[a],u=s.duration,c=s.size,l=s.flag,d=void 0===l?{}:l,h=s.cts,f=void 0===h?0:h;o.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,c>>>24&255,c>>>16&255,c>>>8&255,255&c,d.isLeading<<2|(null===d.dependsOn||void 0===d.dependsOn?1:d.dependsOn),d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|(null===d.isNonSyncSample||void 0===d.isNonSyncSample?1:d.isNonSyncSample),61440&d.degradationPriority,15&d.degradationPriority,f>>>24&255,f>>>16&255,f>>>8&255,255&f],12+16*a)}return e.box(e.types.trun,o)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(uM(t.map((function(t){return e.trackMP4(t)})))))}},{key:"trackMP4",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.duration,t.width,t.height),e.mdiaMP4(t))}},{key:"mdiaMP4",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minfMP4(t))}},{key:"minfMP4",value:function(t){return e.box(e.types.minf,t.type===LM?e.VMHD:e.SMHD,e.DINF,e.stblMP4(t))}},{key:"stblMP4",value:function(t){var n=t.ext,r=[e.stsd(t),e.stts(n.stts),e.stsc(n.stsc),e.stsz(n.stsz),e.stco(n.stco)];return n.stss.length&&r.push(e.stss(n.stss)),n.ctts.length&&r.push(e.ctts(n.ctts)),e.box.apply(e,[e.types.stbl].concat(r))}},{key:"stts",value:function(t){var n=t.length,r=new Uint8Array(8*n),i=0;return t.forEach((function(e){var t=e.value,n=e.count;r.set([n>>24,n>>16&255,n>>8&255,255&n,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.stts,aV(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stsc",value:function(t){var n=t.length,r=new Uint8Array(12*n),i=0;return t.forEach((function(e){var t=e.firstChunk,n=e.samplesPerChunk,o=e.sampleDescIndex;r.set([t>>24,t>>16&255,t>>8&255,255&t,n>>24,n>>16&255,n>>8&255,255&n,o>>24,o>>16&255,o>>8&255,255&o],i),i+=12})),e.box(e.types.stsc,aV(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stsz",value:function(t){var n=t.length,r=new Uint8Array(4*n),i=0;return t.forEach((function(e){r.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stsz,aV(new Uint8Array([0,0,0,0,0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stco",value:function(t){var n=t.length,r=new Uint8Array(4*n),i=0;return t.forEach((function(e){r.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stco,aV(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stss",value:function(t){var n=t.length,r=new Uint8Array(4*n),i=0;return t.forEach((function(e){r.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stss,aV(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"ctts",value:function(t){var n=t.length,r=new Uint8Array(8*n),i=0;return t.forEach((function(e){var t=e.value,n=e.count;r.set([n>>24,n>>16&255,n>>8&255,255&n,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.ctts,aV(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"styp",value:function(){return e.box(e.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(t){var n=t.timescale,r=t.samples[0].duration,i=r*t.samples.length,o=t.samples[0].sampleOffset*r,a=8;t.samples.forEach((function(e){a+=e.size}));var s=0;if(t.isVideo){var u,c=0;t.videoSenc&&(u=t.videoSenc),t.isVideo&&u.forEach((function(e){c+=8,e.subsamples&&e.subsamples.length&&(c+=2,c+=6*e.subsamples.length)})),t.videoSencLength=c,s=a+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=a+16*t.samples.length+84)}else s=a+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=a+169+12*t.samples.length+8*t.audioSenc.length);var l=new Uint8Array([0,0,0,0,0,0,0,255&t.id,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,1,0,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,144,0,0,0]);return e.box(e.types.sidx,l)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}]),e}();aM(iX,"types",["avc1","avcC","hvc1","hvcC","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp"].reduce((function(e,t){return e[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)],e}),Object.create(null))),aM(iX,"HDLR_TYPES",{video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])}),aM(iX,"FTYPAVC1",iX.box(iX.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),aM(iX,"FTYPHEV1",iX.box(iX.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),aM(iX,"DINF",iX.box(iX.types.dinf,iX.box(iX.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),aM(iX,"VMHD",iX.box(iX.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),aM(iX,"SMHD",iX.box(iX.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),aM(iX,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),aM(iX,"STTS",iX.box(iX.types.stts,iX.StblTable)),aM(iX,"STSC",iX.box(iX.types.stsc,iX.StblTable)),aM(iX,"STSZ",iX.box(iX.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),aM(iX,"STCO",iX.box(iX.types.stco,iX.StblTable));var oX=function(){function e(t,n){rM(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=n}return oM(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).debug.apply(t,[this._prefix].concat(r))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).log.apply(t,[this._prefix].concat(r))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(r))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).error.apply(t,[this._prefix].concat(r))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();aM(oX,"disabled",!0);var aX=function(){function e(t,n,r){rM(this,e),this.videoTrack=t,this.audioTrack=n;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new oX("FMP4Remuxer",!r||!r.openLog||!r.openLog)}return oM(e,[{key:"remux",value:function(){var e,t,n,r,i,o=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),l=u.exist(),d=[];return o&&(a&&a.initMerge?(c&&d.push(this.videoTrack),l&&d.push(this.audioTrack),n=iX.initSegment(d)):(c&&(e=iX.initSegment([this.videoTrack])),l&&(t=iX.initSegment([this.audioTrack])))),c&&s.hasSample()&&(r=this._remuxVideo()),l&&u.hasSample()&&(i=this._remuxAudio()),s.samples=[],u.samples=[],{initSegment:n,videoInitSegment:e,audioInitSegment:t,videoSegment:r,audioSegment:i}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack;this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0});var t=e.samples,n=0;t.forEach((function(e){n+=e.units.reduce((function(e,t){return e+t.byteLength}),0),n+=4*e.units.length}));for(var r,i=new Uint8Array(n),o=new DataView(i.buffer),a=function(e,n,a,s){s=t[e];var u=0;s.units.forEach((function(e){o.setUint32(a,e.byteLength),a+=4,i.set(e,a),a+=e.byteLength,u+=4+e.byteLength})),s.size=u,c=a,r=s},s=0,u=t.length,c=0;s<u;s++)a(s,0,c,r);var l=iX.mdat(i);return aV(iX.moof([e]),l)}},{key:"_remuxAudio",value:function(){var e=this.audioTrack,t=new Uint8Array(e.samples.reduce((function(e,t){return e+t.size}),0));e.samples.reduce((function(e,n){return t.set(n.data,e),e+n.size}),0);var n=iX.mdat(t);return aV(iX.moof([e]),n)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}(),sX=function(){function e(t,n){rM(this,e),this.videoTrack=t,this.audioTrack=n}return oM(e,[{key:"remux",value:function(e,t){this.videoTrack=e||this.videoTrack,this.audioTrack=t||this.audioTrack;var n,r,i=(null==e?void 0:e.exist())&&(null==e?void 0:e.hasSample()),o=(null==t?void 0:t.exist())&&(null==t?void 0:t.hasSample());return i&&o?n=this._remuxMix(e,t):i?n=this._remuxTrack(e):o&&(r=this._remuxTrack(t)),e&&(e.samples=[]),t&&(t.samples=[]),{videoSegment:n,audioSegment:r}}},{key:"_remuxMix",value:function(e,t){var n=iX.ftyp([e,t]),r=this._remuxData(e,n.byteLength+8),i=r.mdatData,o=r.chunkOffset,a=this._remuxData(t,o).mdatData,s=iX.mdat(aV(i,a)),u=iX.moovMP4([e,t]);return e.ext=void 0,t.ext=void 0,e.samples=[],t.samples=[],aV(n,s,u)}},{key:"_remuxTrack",value:function(e){var t=iX.ftyp([e]),n=this._remuxData(e,t.byteLength+8).mdatData,r=iX.mdat(n),i=iX.moovMP4([e]);return e.ext=void 0,e.samples=[],aV(t,r,i)}},{key:"_remuxData",value:function(e,t){var n=e.type===LM,r=e.samples,i=0;n?r.forEach((function(e){i+=e.units.reduce((function(e,t){return e+t.byteLength}),0),i+=4*e.units.length})):i=r.reduce((function(e,t){return e+t.size}),0);for(var o,a=new Uint8Array(i),s=new DataView(a.buffer),u=e.ext={stts:[],stsc:[],stsz:[],stco:[],stss:[],ctts:[]},c=0,l=0,d=r.length,h=0;h<d;h++){l+=(o=r[h]).duration;var f=n?0:o.size;n?o.units.forEach((function(e){s.setUint32(c,e.byteLength),c+=4,a.set(e,c),c+=e.byteLength,f+=4+e.byteLength})):(a.set(o.data,c),c+=f),o.size=f,u.stsz.push(f),n&&this._fillCttsSamples(u.ctts,o.cts),this._fillSttsSamples(u.stts,o,r[h+1]),this._fillStcoSamples(u.stco,h,1,t),t+=f,n&&o.keyframe&&u.stss.push(h+1)}return e.duration=l,this._fillStscSamples(u.stsc,d,1),{mdatData:a,chunkOffset:t}}},{key:"_fillSttsSamples",value:function(e,t,n){var r=e[e.length-1];n?r&&r.value===t.duration?r.count++:e.push({value:t.duration,count:1}):r?r.count++:e.push({value:40,count:1})}},{key:"_fillCttsSamples",value:function(e,t){var n=e[e.length-1];n&&n.value===t?n.count++:e.push({value:t,count:1})}},{key:"_fillStcoSamples",value:function(e,t,n,r){t%n||e.push(r)}},{key:"_fillStscSamples",value:function(e,t,n){if(t<=n)e.push({firstChunk:1,samplesPerChunk:t,sampleDescIndex:1});else{var r=Math.floor(t/n),i=t%n;e.push({firstChunk:1,samplesPerChunk:n,sampleDescIndex:1}),i&&e.push({firstChunk:r+1,samplesPerChunk:i,sampleDescIndex:1})}}}]),e}();function uX(){uX=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(L){u=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var o=t&&t.prototype instanceof h?t:h,a=Object.create(o.prototype),s=new T(i||[]);return r(a,"_invoke",{value:_(e,n,s)}),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(L){return{type:"throw",arg:L}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,o)&&(m=v);var g=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,t){function i(r,o,a,s){var u=l(e[r],e,o);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(d).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=w(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,d;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function S(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function x(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(A.prototype),u(A.prototype,a,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new A(c(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),u(g,s,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=x,T.prototype={constructor:T,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(k),!e)for(var t in this)"t"===t.charAt(0)&&n.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 r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},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),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:x(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function cX(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(Sye){return void n(Sye)}s.done?t(u):Promise.resolve(u).then(r,i)}function lX(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){cX(o,r,i,a,s,"next",e)}function s(e){cX(o,r,i,a,s,"throw",e)}a(void 0)}))}}function dX(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hX(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function fX(e,t,n){return t&&hX(e.prototype,t),n&&hX(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function pX(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mX(e){return(mX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function yX(e,t){return(yX=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function vX(){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(kye){return!1}}function gX(e,t,n){return(gX=vX()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&yX(i,n.prototype),i}).apply(null,arguments)}function bX(e){var t="function"==typeof Map?new Map:void 0;return bX=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;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,r)}function r(){return gX(e,arguments,mX(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),yX(r,e)},bX(e)}function AX(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 function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}var _X=Nl,wX=Vd("iterator"),SX=!_X((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=r+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[wX]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==n||"x"!==new URL("http://x",void 0).host})),kX=Hl,TX=2147483647,xX=/[^\0-\u007E]/,EX=/[.\u3002\uFF0E\uFF61]/g,LX="Overflow: input needs wider integers to process",IX=RangeError,RX=kX(EX.exec),ZX=Math.floor,CX=String.fromCharCode,PX=kX("".charCodeAt),GX=kX([].join),DX=kX([].push),MX=kX("".replace),VX=kX("".split),XX=kX("".toLowerCase),WX=function(e){return e+22+75*(e<26)},OX=function(e,t,n){var r=0;for(e=n?ZX(e/700):e>>1,e+=ZX(e/t);e>455;)e=ZX(e/35),r+=36;return ZX(r+36*e/(e+38))},NX=function(e){var t=[];e=function(e){for(var t=[],n=0,r=e.length;n<r;){var i=PX(e,n++);if(i>=55296&&i<=56319&&n<r){var o=PX(e,n++);56320==(64512&o)?DX(t,((1023&i)<<10)+(1023&o)+65536):(DX(t,i),n--)}else DX(t,i)}return t}(e);var n,r,i=e.length,o=128,a=0,s=72;for(n=0;n<e.length;n++)(r=e[n])<128&&DX(t,CX(r));var u=t.length,c=u;for(u&&DX(t,"-");c<i;){var l=TX;for(n=0;n<e.length;n++)(r=e[n])>=o&&r<l&&(l=r);var d=c+1;if(l-o>ZX((TX-a)/d))throw IX(LX);for(a+=(l-o)*d,o=l,n=0;n<e.length;n++){if((r=e[n])<o&&++a>TX)throw IX(LX);if(r==o){for(var h=a,f=36;;){var p=f<=s?1:f>=s+26?26:f-s;if(h<p)break;var m=h-p,y=36-p;DX(t,CX(WX(p+m%y))),h=ZX(m/y),f+=36}DX(t,CX(WX(h))),s=OX(a,d,c==u),a=0,c++}}a++,o++}return GX(t,"")},UX=Py,FX=Il,YX=ih,KX=Hl,jX=Nd,HX=SX,BX=Jf,JX=jE,zX=Qb,QX=yx,qX=Zf,$X=oA,eW=hd,tW=rd,nW=bp,rW=ap,iW=th,oW=Yd,aW=tv,sW=Vv,uW=lf,cW=tS,lW=Bw,dW=vA,hW=zC,fW=Vd("iterator"),pW="URLSearchParams",mW=pW+"Iterator",yW=qX.set,vW=qX.getterFor(pW),gW=qX.getterFor(mW),bW=Object.getOwnPropertyDescriptor,AW=function(e){if(!jX)return FX[e];var t=bW(FX,e);return t&&t.value},_W=AW("fetch"),wW=AW("Request"),SW=AW("Headers"),kW=wW&&wW.prototype,TW=SW&&SW.prototype,xW=FX.RegExp,EW=FX.TypeError,LW=FX.decodeURIComponent,IW=FX.encodeURIComponent,RW=KX("".charAt),ZW=KX([].join),CW=KX([].push),PW=KX("".replace),GW=KX([].shift),DW=KX([].splice),MW=KX("".split),VW=KX("".slice),XW=/\+/g,WW=Array(4),OW=function(e){return WW[e-1]||(WW[e-1]=xW("((?:%[\\da-f]{2}){"+e+"})","gi"))},NW=function(e){try{return LW(e)}catch(Sye){return e}},UW=function(e){var t=PW(e,XW," "),n=4;try{return LW(t)}catch(Sye){for(;n;)t=PW(t,OW(n--),NW);return t}},FW=/[!'()~]|%20/g,YW={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},KW=function(e){return YW[e]},jW=function(e){return PW(IW(e),FW,KW)},HW=QX((function(e,t){yW(this,{type:mW,iterator:cW(vW(e).entries),kind:t})}),"Iterator",(function(){var e=gW(this),t=e.kind,n=e.iterator.next(),r=n.value;return n.done||(n.value="keys"===t?r.key:"values"===t?r.value:[r.key,r.value]),n}),!0),BW=function(e){this.entries=[],this.url=null,void 0!==e&&(oW(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===RW(e,0)?VW(e,1):e:aW(e)))};BW.prototype={type:pW,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,n,r,i,o,a,s,u=lW(e);if(u)for(n=(t=cW(e,u)).next;!(r=YX(n,t)).done;){if(o=(i=cW(iW(r.value))).next,(a=YX(o,i)).done||(s=YX(o,i)).done||!YX(o,i).done)throw EW("Expected sequence with length 2");CW(this.entries,{key:aW(a.value),value:aW(s.value)})}else for(var c in e)tW(e,c)&&CW(this.entries,{key:c,value:aW(e[c])})},parseQuery:function(e){if(e)for(var t,n,r=MW(e,"&"),i=0;i<r.length;)(t=r[i++]).length&&(n=MW(t,"="),CW(this.entries,{key:UW(GW(n)),value:UW(ZW(n,"="))}))},serialize:function(){for(var e,t=this.entries,n=[],r=0;r<t.length;)e=t[r++],CW(n,jW(e.key)+"="+jW(e.value));return ZW(n,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var JW=function(){$X(this,zW),yW(this,new BW(arguments.length>0?arguments[0]:void 0))},zW=JW.prototype;if(JX(zW,{append:function(e,t){dW(arguments.length,2);var n=vW(this);CW(n.entries,{key:aW(e),value:aW(t)}),n.updateURL()},delete:function(e){dW(arguments.length,1);for(var t=vW(this),n=t.entries,r=aW(e),i=0;i<n.length;)n[i].key===r?DW(n,i,1):i++;t.updateURL()},get:function(e){dW(arguments.length,1);for(var t=vW(this).entries,n=aW(e),r=0;r<t.length;r++)if(t[r].key===n)return t[r].value;return null},getAll:function(e){dW(arguments.length,1);for(var t=vW(this).entries,n=aW(e),r=[],i=0;i<t.length;i++)t[i].key===n&&CW(r,t[i].value);return r},has:function(e){dW(arguments.length,1);for(var t=vW(this).entries,n=aW(e),r=0;r<t.length;)if(t[r++].key===n)return!0;return!1},set:function(e,t){dW(arguments.length,1);for(var n,r=vW(this),i=r.entries,o=!1,a=aW(e),s=aW(t),u=0;u<i.length;u++)(n=i[u]).key===a&&(o?DW(i,u--,1):(o=!0,n.value=s));o||CW(i,{key:a,value:s}),r.updateURL()},sort:function(){var e=vW(this);hW(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,n=vW(this).entries,r=nW(e,arguments.length>1?arguments[1]:void 0),i=0;i<n.length;)r((t=n[i++]).value,t.key,this)},keys:function(){return new HW(this,"keys")},values:function(){return new HW(this,"values")},entries:function(){return new HW(this,"entries")}},{enumerable:!0}),BX(zW,fW,zW.entries,{name:"entries"}),BX(zW,"toString",(function(){return vW(this).serialize()}),{enumerable:!0}),zX(JW,pW),UX({global:!0,constructor:!0,forced:!HX},{URLSearchParams:JW}),!HX&&eW(SW)){var QW=KX(TW.has),qW=KX(TW.set),$W=function(e){if(oW(e)){var t,n=e.body;if(rW(n)===pW)return t=e.headers?new SW(e.headers):new SW,QW(t,"content-type")||qW(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),sW(e,{body:uW(0,aW(n)),headers:uW(0,t)})}return e};if(eW(_W)&&UX({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return _W(e,arguments.length>1?$W(arguments[1]):{})}}),eW(wW)){var eO=function(e){return $X(this,kW),new wW(e,arguments.length>1?$W(arguments[1]):{})};kW.constructor=eO,eO.prototype=kW,UX({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:eO})}}var tO,nO=Py,rO=Nd,iO=SX,oO=Il,aO=bp,sO=Hl,uO=Jf,cO=lV,lO=oA,dO=rd,hO=QP,fO=QV,pO=Yy,mO=Ng.codeAt,yO=function(e){var t,n,r=[],i=VX(MX(XX(e),EX,"."),".");for(t=0;t<i.length;t++)n=i[t],DX(r,RX(xX,n)?"xn--"+NX(n):n);return GX(r,".")},vO=tv,gO=Qb,bO=vA,AO={URLSearchParams:JW,getState:vW},_O=Zf,wO=_O.set,SO=_O.getterFor("URL"),kO=AO.URLSearchParams,TO=AO.getState,xO=oO.URL,EO=oO.TypeError,LO=oO.parseInt,IO=Math.floor,RO=Math.pow,ZO=sO("".charAt),CO=sO(/./.exec),PO=sO([].join),GO=sO(1..toString),DO=sO([].pop),MO=sO([].push),VO=sO("".replace),XO=sO([].shift),WO=sO("".split),OO=sO("".slice),NO=sO("".toLowerCase),UO=sO([].unshift),FO="Invalid scheme",YO="Invalid host",KO="Invalid port",jO=/[a-z]/i,HO=/[\d+-.a-z]/i,BO=/\d/,JO=/^0x/i,zO=/^[0-7]+$/,QO=/^\d+$/,qO=/^[\da-f]+$/i,$O=/[\0\t\n\r #%/:<>?@[\\\]^|]/,eN=/[\0\t\n\r #/:<>?@[\\\]^|]/,tN=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,nN=/[\t\n\r]/g,rN=function(e){var t,n,r,i;if("number"==typeof e){for(t=[],n=0;n<4;n++)UO(t,e%256),e=IO(e/256);return PO(t,".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,n=1,r=null,i=0,o=0;o<8;o++)0!==e[o]?(i>n&&(t=r,n=i),r=null,i=0):(null===r&&(r=o),++i);return i>n&&(t=r,n=i),t}(e),n=0;n<8;n++)i&&0===e[n]||(i&&(i=!1),r===n?(t+=n?":":"::",i=!0):(t+=GO(e[n],16),n<7&&(t+=":")));return"["+t+"]"}return e},iN={},oN=hO({},iN,{" ":1,'"':1,"<":1,">":1,"`":1}),aN=hO({},oN,{"#":1,"?":1,"{":1,"}":1}),sN=hO({},aN,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),uN=function(e,t){var n=mO(e,0);return n>32&&n<127&&!dO(t,e)?e:encodeURIComponent(e)},cN={ftp:21,file:null,http:80,https:443,ws:80,wss:443},lN=function(e,t){var n;return 2==e.length&&CO(jO,ZO(e,0))&&(":"==(n=ZO(e,1))||!t&&"|"==n)},dN=function(e){var t;return e.length>1&&lN(OO(e,0,2))&&(2==e.length||"/"===(t=ZO(e,2))||"\\"===t||"?"===t||"#"===t)},hN=function(e){return"."===e||"%2e"===NO(e)},fN={},pN={},mN={},yN={},vN={},gN={},bN={},AN={},_N={},wN={},SN={},kN={},TN={},xN={},EN={},LN={},IN={},RN={},ZN={},CN={},PN={},GN=function(e,t,n){var r,i,o,a=vO(e);if(t){if(i=this.parse(a))throw EO(i);this.searchParams=null}else{if(void 0!==n&&(r=new GN(n,!0)),i=this.parse(a,null,r))throw EO(i);(o=TO(new kO)).bindURL(this),this.searchParams=o}};GN.prototype={type:"URL",parse:function(e,t,n){var r,i,o,a,s,u=this,c=t||fN,l=0,d="",h=!1,f=!1,p=!1;for(e=vO(e),t||(u.scheme="",u.username="",u.password="",u.host=null,u.port=null,u.path=[],u.query=null,u.fragment=null,u.cannotBeABaseURL=!1,e=VO(e,tN,"")),e=VO(e,nN,""),r=fO(e);l<=r.length;){switch(i=r[l],c){case fN:if(!i||!CO(jO,i)){if(t)return FO;c=mN;continue}d+=NO(i),c=pN;break;case pN:if(i&&(CO(HO,i)||"+"==i||"-"==i||"."==i))d+=NO(i);else{if(":"!=i){if(t)return FO;d="",c=mN,l=0;continue}if(t&&(u.isSpecial()!=dO(cN,d)||"file"==d&&(u.includesCredentials()||null!==u.port)||"file"==u.scheme&&!u.host))return;if(u.scheme=d,t)return void(u.isSpecial()&&cN[u.scheme]==u.port&&(u.port=null));d="","file"==u.scheme?c=xN:u.isSpecial()&&n&&n.scheme==u.scheme?c=yN:u.isSpecial()?c=AN:"/"==r[l+1]?(c=vN,l++):(u.cannotBeABaseURL=!0,MO(u.path,""),c=ZN)}break;case mN:if(!n||n.cannotBeABaseURL&&"#"!=i)return FO;if(n.cannotBeABaseURL&&"#"==i){u.scheme=n.scheme,u.path=pO(n.path),u.query=n.query,u.fragment="",u.cannotBeABaseURL=!0,c=PN;break}c="file"==n.scheme?xN:gN;continue;case yN:if("/"!=i||"/"!=r[l+1]){c=gN;continue}c=_N,l++;break;case vN:if("/"==i){c=wN;break}c=RN;continue;case gN:if(u.scheme=n.scheme,i==tO)u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=pO(n.path),u.query=n.query;else if("/"==i||"\\"==i&&u.isSpecial())c=bN;else if("?"==i)u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=pO(n.path),u.query="",c=CN;else{if("#"!=i){u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=pO(n.path),u.path.length--,c=RN;continue}u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=pO(n.path),u.query=n.query,u.fragment="",c=PN}break;case bN:if(!u.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,c=RN;continue}c=wN}else c=_N;break;case AN:if(c=_N,"/"!=i||"/"!=ZO(d,l+1))continue;l++;break;case _N:if("/"!=i&&"\\"!=i){c=wN;continue}break;case wN:if("@"==i){h&&(d="%40"+d),h=!0,o=fO(d);for(var m=0;m<o.length;m++){var y=o[m];if(":"!=y||p){var v=uN(y,sN);p?u.password+=v:u.username+=v}else p=!0}d=""}else if(i==tO||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(h&&""==d)return"Invalid authority";l-=fO(d).length+1,d="",c=SN}else d+=i;break;case SN:case kN:if(t&&"file"==u.scheme){c=LN;continue}if(":"!=i||f){if(i==tO||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(u.isSpecial()&&""==d)return YO;if(t&&""==d&&(u.includesCredentials()||null!==u.port))return;if(a=u.parseHost(d))return a;if(d="",c=IN,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),d+=i}else{if(""==d)return YO;if(a=u.parseHost(d))return a;if(d="",c=TN,t==kN)return}break;case TN:if(!CO(BO,i)){if(i==tO||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()||t){if(""!=d){var g=LO(d,10);if(g>65535)return KO;u.port=u.isSpecial()&&g===cN[u.scheme]?null:g,d=""}if(t)return;c=IN;continue}return KO}d+=i;break;case xN:if(u.scheme="file","/"==i||"\\"==i)c=EN;else{if(!n||"file"!=n.scheme){c=RN;continue}if(i==tO)u.host=n.host,u.path=pO(n.path),u.query=n.query;else if("?"==i)u.host=n.host,u.path=pO(n.path),u.query="",c=CN;else{if("#"!=i){dN(PO(pO(r,l),""))||(u.host=n.host,u.path=pO(n.path),u.shortenPath()),c=RN;continue}u.host=n.host,u.path=pO(n.path),u.query=n.query,u.fragment="",c=PN}}break;case EN:if("/"==i||"\\"==i){c=LN;break}n&&"file"==n.scheme&&!dN(PO(pO(r,l),""))&&(lN(n.path[0],!0)?MO(u.path,n.path[0]):u.host=n.host),c=RN;continue;case LN:if(i==tO||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&lN(d))c=RN;else if(""==d){if(u.host="",t)return;c=IN}else{if(a=u.parseHost(d))return a;if("localhost"==u.host&&(u.host=""),t)return;d="",c=IN}continue}d+=i;break;case IN:if(u.isSpecial()){if(c=RN,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=tO&&(c=RN,"/"!=i))continue}else u.fragment="",c=PN;else u.query="",c=CN;break;case RN:if(i==tO||"/"==i||"\\"==i&&u.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=NO(s=d))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(u.shortenPath(),"/"==i||"\\"==i&&u.isSpecial()||MO(u.path,"")):hN(d)?"/"==i||"\\"==i&&u.isSpecial()||MO(u.path,""):("file"==u.scheme&&!u.path.length&&lN(d)&&(u.host&&(u.host=""),d=ZO(d,0)+":"),MO(u.path,d)),d="","file"==u.scheme&&(i==tO||"?"==i||"#"==i))for(;u.path.length>1&&""===u.path[0];)XO(u.path);"?"==i?(u.query="",c=CN):"#"==i&&(u.fragment="",c=PN)}else d+=uN(i,aN);break;case ZN:"?"==i?(u.query="",c=CN):"#"==i?(u.fragment="",c=PN):i!=tO&&(u.path[0]+=uN(i,iN));break;case CN:t||"#"!=i?i!=tO&&("'"==i&&u.isSpecial()?u.query+="%27":u.query+="#"==i?"%23":uN(i,iN)):(u.fragment="",c=PN);break;case PN:i!=tO&&(u.fragment+=uN(i,oN))}l++}},parseHost:function(e){var t,n,r;if("["==ZO(e,0)){if("]"!=ZO(e,e.length-1))return YO;if(t=function(e){var t,n,r,i,o,a,s,u=[0,0,0,0,0,0,0,0],c=0,l=null,d=0,h=function(){return ZO(e,d)};if(":"==h()){if(":"!=ZO(e,1))return;d+=2,l=++c}for(;h();){if(8==c)return;if(":"!=h()){for(t=n=0;n<4&&CO(qO,h());)t=16*t+LO(h(),16),d++,n++;if("."==h()){if(0==n)return;if(d-=n,c>6)return;for(r=0;h();){if(i=null,r>0){if(!("."==h()&&r<4))return;d++}if(!CO(BO,h()))return;for(;CO(BO,h());){if(o=LO(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;d++}u[c]=256*u[c]+i,2!=++r&&4!=r||c++}if(4!=r)return;break}if(":"==h()){if(d++,!h())return}else if(h())return;u[c++]=t}else{if(null!==l)return;d++,l=++c}}if(null!==l)for(a=c-l,c=7;0!=c&&a>0;)s=u[c],u[c--]=u[l+a-1],u[l+--a]=s;else if(8!=c)return;return u}(OO(e,1,-1)),!t)return YO;this.host=t}else if(this.isSpecial()){if(e=yO(e),CO($O,e))return YO;if(t=function(e){var t,n,r,i,o,a,s,u=WO(e,".");if(u.length&&""==u[u.length-1]&&u.length--,(t=u.length)>4)return e;for(n=[],r=0;r<t;r++){if(""==(i=u[r]))return e;if(o=10,i.length>1&&"0"==ZO(i,0)&&(o=CO(JO,i)?16:8,i=OO(i,8==o?1:2)),""===i)a=0;else{if(!CO(10==o?QO:8==o?zO:qO,i))return e;a=LO(i,o)}MO(n,a)}for(r=0;r<t;r++)if(a=n[r],r==t-1){if(a>=RO(256,5-t))return null}else if(a>255)return null;for(s=DO(n),r=0;r<n.length;r++)s+=n[r]*RO(256,3-r);return s}(e),null===t)return YO;this.host=t}else{if(CO(eN,e))return YO;for(t="",n=fO(e),r=0;r<n.length;r++)t+=uN(n[r],iN);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return dO(cN,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&lN(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,n=e.username,r=e.password,i=e.host,o=e.port,a=e.path,s=e.query,u=e.fragment,c=t+":";return null!==i?(c+="//",e.includesCredentials()&&(c+=n+(r?":"+r:"")+"@"),c+=rN(i),null!==o&&(c+=":"+o)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+PO(a,"/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},setHref:function(e){var t=this.parse(e);if(t)throw EO(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new DN(e.path[0]).origin}catch(Sye){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+rN(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(vO(e)+":",fN)},getUsername:function(){return this.username},setUsername:function(e){var t=fO(vO(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var n=0;n<t.length;n++)this.username+=uN(t[n],sN)}},getPassword:function(){return this.password},setPassword:function(e){var t=fO(vO(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var n=0;n<t.length;n++)this.password+=uN(t[n],sN)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?rN(e):rN(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,SN)},getHostname:function(){var e=this.host;return null===e?"":rN(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,kN)},getPort:function(){var e=this.port;return null===e?"":vO(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=vO(e))?this.port=null:this.parse(e,TN))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+PO(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,IN))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=vO(e))?this.query=null:("?"==ZO(e,0)&&(e=OO(e,1)),this.query="",this.parse(e,CN)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=vO(e))?("#"==ZO(e,0)&&(e=OO(e,1)),this.fragment="",this.parse(e,PN)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var DN=function(e){var t=lO(this,MN),n=bO(arguments.length,1)>1?arguments[1]:void 0,r=wO(t,new GN(e,!1,n));rO||(t.href=r.serialize(),t.origin=r.getOrigin(),t.protocol=r.getProtocol(),t.username=r.getUsername(),t.password=r.getPassword(),t.host=r.getHost(),t.hostname=r.getHostname(),t.port=r.getPort(),t.pathname=r.getPathname(),t.search=r.getSearch(),t.searchParams=r.getSearchParams(),t.hash=r.getHash())},MN=DN.prototype,VN=function(e,t){return{get:function(){return SO(this)[e]()},set:t&&function(e){return SO(this)[t](e)},configurable:!0,enumerable:!0}};if(rO&&(cO(MN,"href",VN("serialize","setHref")),cO(MN,"origin",VN("getOrigin")),cO(MN,"protocol",VN("getProtocol","setProtocol")),cO(MN,"username",VN("getUsername","setUsername")),cO(MN,"password",VN("getPassword","setPassword")),cO(MN,"host",VN("getHost","setHost")),cO(MN,"hostname",VN("getHostname","setHostname")),cO(MN,"port",VN("getPort","setPort")),cO(MN,"pathname",VN("getPathname","setPathname")),cO(MN,"search",VN("getSearch","setSearch")),cO(MN,"searchParams",VN("getSearchParams")),cO(MN,"hash",VN("getHash","setHash"))),uO(MN,"toJSON",(function(){return SO(this).serialize()}),{enumerable:!0}),uO(MN,"toString",(function(){return SO(this).serialize()}),{enumerable:!0}),xO){var XN=xO.createObjectURL,WN=xO.revokeObjectURL;XN&&uO(DN,"createObjectURL",aO(XN,xO)),WN&&uO(DN,"revokeObjectURL",aO(WN,xO))}function ON(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.used=!1,n.resolve=function(){return n.used=!0,e.apply(void 0,arguments)},n.reject=function(){return n.used=!0,t.apply(void 0,arguments)},n}function NN(){try{return parseInt(performance.now(),10)}catch(kye){return(new Date).getTime()}}gO(DN,"URL"),nO({global:!0,constructor:!0,forced:!iO,sham:!rO},{URL:DN});var UN,FN=function(){function e(){dX(this,e)}return fX(e,null,[{key:"start",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&e.start(0)<0?0:e.start(0):0}},{key:"end",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1):0}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(Sye){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var n=[],r=0,i=e.length;r<i;r++){var o=n.length;if(o&&t){var a=n[o-1],s=a[1];if(e.start(r)-s<=t){var u=e.end(r);u>s&&(a[1]=u)}else n.push([e.start(r),e.end(r)])}else n.push([e.start(r),e.end(r)])}return n}},{key:"totalLength",value:function(e){return e&&e.length?e.reduce((function(e,t){return e+(t[1]-t[0])}),0):0}},{key:"info",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t||!t.length)return{start:0,end:0,buffers:[]};for(var i=0,o=0,a=0,s=0,u=0,c=0,l=0,d=e.buffers(t,r),h=0,f=d.length;h<f;h++){var p=d[h];if(n+r>=p[0]&&n<p[1])i=p[0],o=p[1],a=h;else{if(n+r<p[0]){s=p[0],u=p[1];break}n+r>p[1]&&(c=p[0],l=p[1])}}return{start:i,end:o,index:a,buffers:d,nextStart:s,nextEnd:u,prevStart:c,prevEnd:l,currentTime:n,behind:n-i,remaining:o?o-n:0,length:e.totalLength&&e.totalLength(d)}}}]),e}(),YN="network",KN="network_timeout",jN="demux",HN="remux",BN="media",JN="other",zN={FLV:"FLV",HLS:"HLS",MP4:"MP4",FMP4:"FMP4",MSE_ADD_SB:"MSE_ADD_SB",MSE_APPEND_BUFFER:"MSE_APPEND_BUFFER",MSE_OTHER:"MSE_OTHER",MSE_FULL:"MSE_FULL",OPTION:"OPTION"},QN=(pX(UN={},"manifest",{HLS:1100}),pX(UN,YN,2100),pX(UN,KN,2101),pX(UN,jN,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400}),pX(UN,HN,{FMP4:4100,MP4:4200}),pX(UN,BN,{MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203}),pX(UN,JN,8e3),UN),qN=function(e){!function(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&&yX(e,t)}(i,e);var t,n,r=(t=i,n=vX(),function(){var e,r=mX(t);if(n){var i=mX(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return AX(this,e)});function i(e,t,n,o,a){var s;return dX(this,i),(s=r.call(this,a||(null==n?void 0:n.message))).errorType=e===KN?YN:e,s.originError=n,s.ext=o,s.errorCode=QN[e][t]||QN[e],s.errorMessage=s.message,s.errorCode||(s.errorType=JN,s.errorCode=QN[s.errorType]),s}return fX(i,null,[{key:"create",value:function(e,t,n,r,o){return e instanceof i?e:(e instanceof Error&&(n=e,e=""),e||(e=JN),new i(e,t,n,r,o))}},{key:"network",value:function(e){var t;return new i(null!=e&&e.isTimeout?KN:YN,e,null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}]),i}(bX(Error)),$N="undefined"!=typeof window,eU=function(){function e(t){dX(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]")}return fX(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).debug.apply(t,[this._prefix,NN()].concat(r))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).log.apply(t,[this._prefix,NN()].concat(r))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).warn.apply(t,[this._prefix,NN()].concat(r))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).error.apply(t,[this._prefix,NN()].concat(r))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();pX(eU,"disabled",!0);var tU=function(){try{return $N?window.MediaSource:null}catch(kye){}}(),nU="appendBuffer",rU="removeBuffer",iU=function(){function e(t,n){var r=this;dX(this,e),pX(this,"media",null),pX(this,"mediaSource",null),pX(this,"_openPromise",ON()),pX(this,"_queue",Object.create(null)),pX(this,"_sourceBuffer",Object.create(null)),pX(this,"_mseFullFlag",{}),pX(this,"_st",0),pX(this,"_opst",0),pX(this,"_logger",null),pX(this,"_config",null),pX(this,"_url",null),pX(this,"_onSBUpdateEnd",(function(e){var t=r._queue[e];if(t){var n=t.shift();if(n){var i=NN()-r._opst;r._logger.debug("UpdateEnd",n.opName,i,n.context),n.promise.resolve({name:n.opName,context:n.context,costtime:i}),r._startQueue(e)}}})),pX(this,"_onSBUpdateError",(function(e,t){var n=r._queue[e];if(n){var i=n[0];i&&(r._logger.error("UpdateError",e,i.opName,i.context),i.promise.reject(new qN(BN,zN.MSE_APPEND_BUFFER,t)))}})),this._config=Object.assign(e.getDefaultConfig(),n),t&&this.bindMedia(t),this._logger=new eU("MSE"),this._config.openLog&&eU.enable()}var t,n,r;return fX(e,[{key:"isOpened",get:function(){var e;return"open"===(null===(e=this.mediaSource)||void 0===e?void 0:e.readyState)}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return(null===(e=this.mediaSource)||void 0===e?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"isFull",value:function(t){return t?this._mseFullFlag[t]:this._mseFullFlag[e.VIDEO]}},{key:"updateDuration",value:function(e){var t=this;return this.mediaSource&&this.mediaSource.duration>e?Promise.resolve():this._enqueueBlockingOp((function(){t.isEnded?t._logger.debug("[debug mse] setDuration ended"):t.mediaSource&&(t.mediaSource.duration=e,t._logger.debug("[debug mse] setDuration"))}),"updateDuration")}},{key:"open",value:function(){var e=this;if(this._openPromise.used&&!this.isOpened&&this.mediaSource){var t=this.mediaSource;t.addEventListener("sourceopen",(function n(){var r=NN()-e._st;e._logger.debug("MSE OPEN",r),t.removeEventListener("sourceopen",n),e._openPromise.resolve({costtime:r})})),this._openPromise=ON()}return this._openPromise}},{key:"bindMedia",value:(r=lX(uX().mark((function e(t){var n,r,i=this;return uX().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.mediaSource&&!this.media){e.next=3;break}return e.next=3,this.unbindMedia();case 3:if(t&&tU){e.next=5;break}throw new Error("Param media or MediaSource does not exist");case 5:return this.media=t,n=this.mediaSource=new tU,this._st=NN(),r=function e(){var r=NN()-i._st;i._logger.debug("MSE OPEN"),n.removeEventListener("sourceopen",e),URL.revokeObjectURL(t.src),i._openPromise.resolve({costtime:r})},n.addEventListener("sourceopen",r),this._url=URL.createObjectURL(n),t.src=this._url,e.abrupt("return",this._openPromise);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unbindMedia",value:(n=lX(uX().mark((function e(){var t,n,r,i=this;return uX().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._openPromise.used||this._openPromise.resolve(),t=this.mediaSource){if(Object.keys(this._queue).forEach((function(e){var t=i._queue[e];t&&t.forEach((function(e){return e.promise.resolve}))})),n=!!this.media&&this.media.readyState>=1,r="open"===t.readyState,n&&r)try{t.endOfStream()}catch(Sye){}Object.keys(this._sourceBuffer).forEach((function(e){try{t.removeSourceBuffer(i._sourceBuffer[e])}catch(Sye){}}))}if(this.media){this.media.removeAttribute("src");try{this.media.load()}catch(Sye){}this.media=null}this.mediaSource=null,this._openPromise=ON(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"createSource",value:function(e,t){if(!this._sourceBuffer[e]&&this.mediaSource){var n;try{n=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(Sye){throw new qN(BN,zN.MSE_ADD_SB,Sye)}n.mimeType=t,n.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),n.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,t){var n=this,r=this._sourceBuffer[e];return this.mediaSource&&r&&r.mimeType!==t&&"function"==typeof r.changeType?this._enqueueOp(e,(function(){r.changeType(t),r.mimeType=t,n._onSBUpdateEnd(e)})):Promise.resolve()}},{key:"createOrChangeSource",value:function(e,t){return this.createSource(e,t),this.changeType(e,t)}},{key:"append",value:function(e,t,n){var r=this;return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,(function(){var i;r.mediaSource&&(r._logger.debug("MSE APPEND START",n),r._opst=NN(),null===(i=r._sourceBuffer[e])||void 0===i||i.appendBuffer(t))}),nU,n):Promise.resolve()}},{key:"remove",value:function(e,t,n,r){var i=this,o=!1;return this._mseFullFlag[e]&&(o=!0),this._enqueueOp(e,(function(){if(i.mediaSource){var o=i._sourceBuffer[e];t>=n||!o?i._onSBUpdateEnd(e):(i._opst=NN(),i._logger.debug("MSE REMOVE START",e,t,n,r),o.remove(t,n))}}),rU,r,o)}},{key:"clearBuffer",value:function(e,t){var n,r=this;return Object.keys(this._sourceBuffer).forEach((function(i){n=r._enqueueOp(i,(function(){if(r.mediaSource){var n=r._sourceBuffer[i];r._logger.debug("MSE clearBuffer START",i,e,t),n.remove(e,t)}}))})),n}},{key:"clearAllBuffer",value:function(){var e,t=this;return Object.keys(this._sourceBuffer).forEach((function(n){e=t._enqueueOp(n,(function(){if(t.mediaSource){var e=t._sourceBuffer[n];t._logger.debug("MSE clearAllBuffer START",n),e.remove(0,FN.end(FN.get(e)))}}))})),e}},{key:"clearOpQueues",value:function(e){var t;this._logger.debug("MSE clearOpQueue START");var n=this._queue[e];if(n&&n[e]&&!(n.length<5)){var r=[];n.forEach((function(e){e.context&&e.context.isinit&&r.push(e)})),this._queue[e]=n.slice(0,2),r.length>0&&(t=this._queue[e]).push.apply(t,r)}}},{key:"endOfStream",value:function(e){var t=this;return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp((function(){var n=t.mediaSource;n&&"open"===n.readyState&&(t._logger.debug("MSE endOfStream START"),e?n.endOfStream(e):n.endOfStream())}),"endOfStream"):Promise.resolve()}},{key:"setLiveSeekableRange",value:function(e,t){var n=this.mediaSource;e<0||t<e||null==n||!n.setLiveSeekableRange||"open"!==n.readyState||n.setLiveSeekableRange(e,t)}},{key:"getSourceBuffer",value:function(e){return this._sourceBuffer[e]}},{key:"buffered",value:function(e){return FN.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return FN.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return FN.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,t,n,r,i){var o=this;if(!this.mediaSource)return Promise.resolve();var a=this._queue[e]=this._queue[e]||[],s={exec:t,promise:ON(),opName:n,context:r};return i?(a.splice(0,0,s),this._mseFullFlag[e]=!1,this._startQueue(e)):a.push(s),this.isOpened?1===a.length&&this._startQueue(e):this._openPromise.then((function(){1===a.length&&o._startQueue(e)})),s.promise}},{key:"_enqueueBlockingOp",value:(t=lX(uX().mark((function e(t,n){var r,i,o=this;return uX().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaSource){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:if((r=Object.keys(this._sourceBuffer)).length){e.next=5;break}return e.abrupt("return",t());case 5:return i=[],r.forEach((function(e){var t=o._queue[e],r=ON();i.push(r),t.push({exec:function(){return r.resolve()},promise:r,opName:n}),1===t.length&&o._startQueue(e)})),e.abrupt("return",Promise.all(i).then((function(){try{return t()}finally{r.forEach((function(e){var t=o._queue[e],n=o._sourceBuffer[e];null==t||t.shift(),n&&n.updating||o._startQueue(e)}))}})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"_startQueue",value:function(e){var t=this._queue[e];if(t){var n=t[0];if(n&&!this._mseFullFlag[e])try{n.exec()}catch(Sye){Sye&&Sye.message&&Sye.message.indexOf("SourceBuffer is full")>=0?(this._mseFullFlag[e]=!0,this._logger.error("[MSE error], context,",n.context," ,name,",n.opName,",err,SourceBuffer is full"),n.promise.reject(new qN(BN,zN.MSE_FULL,Sye))):(this._logger.error(Sye),n.promise.reject(new qN(BN,zN.MSE_OTHER,Sye)),t.shift(),this._startQueue(e))}}}},{key:"setTimeoffset",value:function(e,t,n){var r=this;return this._enqueueOp(e,(function(){t<0&&(t+=.001),r._sourceBuffer[e].timestampOffset=t,r._onSBUpdateEnd(e)}),"setTimeoffset",n)}},{key:"abort",value:function(e,t){var n=this;return this.isOpened?this._enqueueOp(e,(function(){n._sourceBuffer[e].abort(),n._onSBUpdateEnd(e)}),"abort",t):Promise.resolve()}}],[{key:"getDefaultConfig",value:function(){return{openLog:!1}}},{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if(!tU)return!1;try{return tU.isTypeSupported(e)}catch(Sye){return this._logger.error(e,Sye),!1}}}]),e}();pX(iU,"VIDEO","video"),pX(iU,"AUDIO","audio");var oU=Py,aU=md,sU=Sg,uU=ih,cU=Hl,lU=Nl,dU=Mp,hU=hd,fU=Yd,pU=lh,mU=mA,yU=xd,vU=aU("JSON","stringify"),gU=cU(/./.exec),bU=cU("".charAt),AU=cU("".charCodeAt),_U=cU("".replace),wU=cU(1..toString),SU=/[\uD800-\uDFFF]/g,kU=/^[\uD800-\uDBFF]$/,TU=/^[\uDC00-\uDFFF]$/,xU=!yU||lU((function(){var e=aU("Symbol")();return"[null]"!=vU([e])||"{}"!=vU({a:e})||"{}"!=vU(Object(e))})),EU=lU((function(){return'"\\udf06\\ud834"'!==vU("\udf06\ud834")||'"\\udead"'!==vU("\udead")})),LU=function(e,t){var n=mU(arguments),r=t;if((fU(t)||void 0!==e)&&!pU(e))return dU(t)||(t=function(e,t){if(hU(r)&&(t=uU(r,this,e,t)),!pU(t))return t}),n[1]=t,sU(vU,null,n)},IU=function(e,t,n){var r=bU(n,t-1),i=bU(n,t+1);return gU(kU,e)&&!gU(TU,i)||gU(TU,e)&&!gU(kU,r)?"\\u"+wU(AU(e,0),16):e};vU&&oU({target:"JSON",stat:!0,arity:3,forced:xU||EU},{stringify:function(e,t,n){var r=mU(arguments),i=sU(xU?LU:vU,null,r);return EU&&"string"==typeof i?_U(i,SU,IU):i}});var RU=ed,ZU=tx,CU=HT;Py({target:"Object",stat:!0,forced:Nl((function(){ZU(1)})),sham:!CU},{getPrototypeOf:function(e){return ZU(RU(e))}});var PU=qh.PROPER,GU=Nl,DU=Ck,MU=Nk.trim;Py({target:"String",proto:!0,forced:function(e){return GU((function(){return!!DU[e]()||"
"!=="
"[e]()||PU&&DU[e].name!==e}))}("trim")},{trim:function(){return MU(this)}});var VU={exports:{}},XU=Nl((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),WU=Nl,OU=Yd,NU=$f,UU=XU,FU=Object.isExtensible,YU=WU((function(){FU(1)}))||UU?function(e){return!!OU(e)&&((!UU||"ArrayBuffer"!=NU(e))&&(!FU||FU(e)))}:FU,KU=!Nl((function(){return Object.isExtensible(Object.preventExtensions({}))})),jU=Py,HU=Hl,BU=vf,JU=Yd,zU=rd,QU=Od.f,qU=Om,$U=Gy,eF=YU,tF=KU,nF=!1,rF=ud("meta"),iF=0,oF=function(e){QU(e,rF,{value:{objectID:"O"+iF++,weakData:{}}})},aF=VU.exports={enable:function(){aF.enable=function(){},nF=!0;var e=qU.f,t=HU([].splice),n={};n[rF]=1,e(n).length&&(qU.f=function(n){for(var r=e(n),i=0,o=r.length;i<o;i++)if(r[i]===rF){t(r,i,1);break}return r},jU({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:$U.f}))},fastKey:function(e,t){if(!JU(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!zU(e,rF)){if(!eF(e))return"F";if(!t)return"E";oF(e)}return e[rF].objectID},getWeakData:function(e,t){if(!zU(e,rF)){if(!eF(e))return!0;if(!t)return!1;oF(e)}return e[rF].weakData},onFreeze:function(e){return tF&&nF&&eF(e)&&!zU(e,rF)&&oF(e),e}};BU[rF]=!0;var sF=VU.exports,uF=Py,cF=Il,lF=Hl,dF=Ty,hF=Jf,fF=sF,pF=bS,mF=oA,yF=hd,vF=Bl,gF=Yd,bF=Nl,AF=kS,_F=Qb,wF=Rk,SF=Od.f,kF=Vv,TF=jE,xF=bp,EF=oA,LF=Bl,IF=bS,RF=Mx,ZF=Vx,CF=nA,PF=Nd,GF=sF.fastKey,DF=Zf.set,MF=Zf.getterFor,VF={getConstructor:function(e,t,n,r){var i=e((function(e,i){EF(e,o),DF(e,{type:t,index:kF(null),first:void 0,last:void 0,size:0}),PF||(e.size=0),LF(i)||IF(i,e[r],{that:e,AS_ENTRIES:n})})),o=i.prototype,a=MF(t),s=function(e,t,n){var r,i,o=a(e),s=u(e,t);return s?s.value=n:(o.last=s={index:i=GF(t,!0),key:t,value:n,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=s),r&&(r.next=s),PF?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},u=function(e,t){var n,r=a(e),i=GF(t);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key==t)return n};return TF(o,{clear:function(){for(var e=a(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,PF?e.size=0:this.size=0},delete:function(e){var t=this,n=a(t),r=u(t,e);if(r){var i=r.next,o=r.previous;delete n.index[r.index],r.removed=!0,o&&(o.next=i),i&&(i.previous=o),n.first==r&&(n.first=i),n.last==r&&(n.last=o),PF?n.size--:t.size--}return!!r},forEach:function(e){for(var t,n=a(this),r=xF(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!u(this,e)}}),TF(o,n?{get:function(e){var t=u(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),PF&&SF(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,n){var r=t+" Iterator",i=MF(t),o=MF(r);RF(e,t,(function(e,t){DF(this,{type:r,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?ZF("keys"==t?n.key:"values"==t?n.value:[n.key,n.value],!1):(e.target=void 0,ZF(void 0,!0))}),n?"entries":"values",!n,!0),CF(t)}},XF={"mp4a.40.5":1,"mp4a.40.2":2},WF=.05,OF=new(function(){function e(){pl(this,e),vl(this,"_queue",[]),"undefined"!=typeof document&&(this._tempMedia=document.createElement("video"))}return yl(e,[{key:"tempMedia",get:function(){return this._tempMedia}},{key:"hasCached",get:function(){return-1!==this._queue.findIndex((function(e){return 1===e.codec}))&&-1!==this._queue.findIndex((function(e){return 2===e.codec}))}},{key:"getCachedMedia",value:function(e){var t=this._queue.findIndex((function(t){return t.codec===e}));return-1!==t?this._queue.splice(t,1)[0]:null}},{key:"cacheMedia",value:function(e){var t=e.codec,n=e.media,r=e.mse,i=XF[t];if(this._queue=this._queue.filter((function(e){var t;return e.mse&&!e.mse.isOpened&&e.mse.unbindMedia(),null===(t=e.mse)||void 0===t?void 0:t.isOpened})),!t||this._queue.filter((function(e){return e.codec===i})).length>2)return null==r||r.endOfStream(),void(null==r||r.unbindMedia());this._queue.push({codec:i,media:n,mse:r})}}]),e}()),NF=function(e){gl(o,e);var t,n,r,i=wl(o);function o(e,t){var n;return pl(this,o),vl(_l(n=i.call(this,e,t)),"_media",void 0),vl(_l(n),"_isTempMedia",!1),vl(_l(n),"_mse",void 0),vl(_l(n),"_remuxer",null),vl(_l(n),"_codec",""),vl(_l(n),"_sourceCreated",!1),vl(_l(n),"_needInitSegment",!0),vl(_l(n),"_seekNoSideEffect",!1),vl(_l(n),"_startRendered",!1),vl(_l(n),"_firstTimeAppendedBuffer",!1),vl(_l(n),"_sampleQueue",[]),vl(_l(n),"_inProcessing",!1),vl(_l(n),"_duration",0),vl(_l(n),"_mediaCache",OF),vl(_l(n),"_resetDts",(function(){})),vl(_l(n),"_onCanplay",(function(){n._ready||(n._ready=!0,n.emit(GG.AUDIO_READY))})),vl(_l(n),"_onPlaying",(function(){n._parent.ready&&(n._audioCanAutoplay=!0,n._emitTimelineEvents(MG.PLAY_EVENT,CG.PLAYING))})),vl(_l(n),"_onWaiting",(function(){if(!n._seekNoSideEffect){try{for(var e,t=n._media.buffered,r=n._media.currentTime,i=0,o=0,a=t.length;o<a;o++)t.start(o)<r&&t.end(o)>r&&(i=t.end(o)-r);if(Math.abs(i)>.5)return;if(Math.abs(n._media.duration-n._media.currentTime)<.3)return n._reuseMse||n._mse.endOfStream(),void(null===(e=_l(n))||void 0===e||e._emitTimelineEvents(MG.PLAY_EVENT,CG.ENDED))}catch(kye){}n._ready=!1,n.emit(GG.AUDIO_WAITING)}})),vl(_l(n),"_onSeeked",(function(){n._seekNoSideEffect||n._isLive?n._seekNoSideEffect=!1:(VP.log(n.TAG,"seeked"),n._ready||(n._media.pause(),n._ready=!0,n.emit(GG.AUDIO_READY)))})),vl(_l(n),"_onProgress",(function(){if(n._media.readyState<=1){var e=n._getBufferGap();e>0&&e<1&&(n._media.currentTime+=e+WF,VP.warn(n.TAG,"progress, gap=",e))}n._emitTimelineEvents(MG.PLAY_EVENT,CG.PROGRESS),n._emitTimelineEvents(MG.PLAY_EVENT,CG.DURATION_CHANGE)})),vl(_l(n),"_onEnded",(function(){var e;VP.log(n.TAG,"ended!"),null===(e=_l(n))||void 0===e||e._emitTimelineEvents(MG.PLAY_EVENT,CG.ENDED)})),vl(_l(n),"_onOnceProgress",(function(){if(n._media.buffered.length){var e=n._media.buffered.start(0);e&&(n._media.currentTime=e+WF,VP.log(n.TAG,"start gap:",e)),n._media.removeEventListener("progress",n._onOnceProgress)}})),vl(_l(n),"_onError",(function(){var e;n._emitTimelineEvents(MG.PLAY_EVENT,CG.ERROR,n._assembleErr("audio error: ".concat(null===(e=n._media.error)||void 0===e?void 0:e.message),3))})),vl(_l(n),"_appendChunk",(function(e,t){if(!n.noAudio&&t.samples.length){if(n._codec||(2!==t.objectType&&5!==t.objectType?n._codec="mp4a.40.5":n._codec=t.codec,n._isTempMedia&&n._switchMedia(n._codec)),t.samples.forEach((function(e){e.baseMediaDecodeTime=t.baseMediaDecodeTime,n._sampleQueue.push(e)})),t.samples=[],!n._meta)return n._meta=ll(ll({},t),{},{exist:function(){return!0},hasSample:function(){return!0},samples:[]}),VP.warn(n.TAG,"audio set metadata",n._meta),void n._doAppendWrapper();n._meta.sampleRate!==t.sampleRate&&(VP.warn(n.TAG,"discontinue: ".concat(n._meta.sampleRate," -> ").concat(t.sampleRate)),n._needInitSegment=!0,Object.keys(t).forEach((function(e){n._meta[e]=t[e]}))),!n._inProcessing&&n._sampleQueue.length&&n._doAppendWrapper()}})),vl(_l(n),"_doAppend",function(){var e=fl(dl().mark((function e(t){var r,i,o;return dl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n._remuxer||(n._remuxer=new aX({samples:[],exist:function(){return!1}},t)),r=t.samples,n._sourceCreated){e.next=12;break}return n.analyse.addAudioMseOpenStart(),e.next=6,n._mse.open();case 6:n._sourceCreated=!0,VP.log(n.TAG,"video/mp4;codecs=".concat(n._codec)),n._mse.createSource(t.type,"video/mp4;codecs=".concat(n._codec)),n.analyse.addAudioMseOpend(),VP.log(n.TAG,"sb created!"),n._checkAutoPlay();case 12:if(i=n._remuxer.remux(n._needInitSegment),!n._needInitSegment||i.audioInitSegment){e.next=15;break}return e.abrupt("return");case 15:return n._needInitSegment=!1,o=[],i.audioInitSegment&&o.push(n._mse.append(t.type,i.audioInitSegment)),i.audioSegment&&o.push(n._mse.append(t.type,i.audioSegment)),e.abrupt("return",Promise.all(o).then((function(){return r[r.length-1].dts/1e3})).then((function(){n._firstTimeAppendedBuffer||(n._firstTimeAppendedBuffer=!0,n.analyse.addAudioFirstTimeAppended())})));case 20:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),vl(_l(n),"_doPlay",(function(){n._media.play().catch((function(){}))})),vl(_l(n),"_doPause",(function(){n._media.pause()})),vl(_l(n),"_doSeek",(function(e){n._ready=!1,n._media.currentTime=e})),vl(_l(n),"_doChaseFrame",(function(e){var t=e.position;n._seekNoSideEffect=!0,n._media.currentTime=t})),vl(_l(n),"_startRender",(function(){VP.log(n.TAG,"start render"),n._startRendered=!0,n._media.play().catch((function(){}))})),n.TAG="AudioMseRender",n._reuseMse=rG().reuseMseForAudio,n._initMedia(),n}return yl(o,[{key:"isMse",get:function(){return!0}},{key:"media",get:function(){return this._media}},{key:"currentTime",get:function(){return this._media.currentTime}},{key:"buffered",get:function(){return this._media.buffered}},{key:"duration",get:function(){return Number.isNaN(this._media.duration)?1/0:this._media.duration},set:function(e){this._duration=e,this._updateDuration(e)}},{key:"audioCanAutoplay",get:function(){return this._audioCanAutoplay||this.noAudio}},{key:"_initMedia",value:function(){if(!this._reuseMse||!OF.hasCached)return VP.log(this.TAG,"init media and mse directly"),this._media=document.createElement("video"),this._media.autoplay=!0,this._mse=new iU,this._bindEvents(),this._bindMediaEvents(),void this._mse.bindMedia(this._media);VP.log(this.TAG,"bind media temporary"),this._media=OF.tempMedia,this._bindEvents(),this._isTempMedia=!0}},{key:"_switchMedia",value:function(e){var t=this._media,n=OF.getCachedMedia(XF[e]);n?(VP.warn(this.TAG,"switch to cached media for audio play! codec=".concat(e)),this._media=n.media,this._mse=n.mse,this._bindMediaEvents(),this._updateDuration(this._duration),this._media.currentTime=WF,this._sourceCreated=!0,this._audioCanAutoplay=!0,this.analyse.addAudioMseOpend()):this._initMedia(),this._media.volume=t.volume,this._media.playbackRate=t.playbackRate,this._isTempMedia=!1}},{key:"_getBufferGap",value:function(){for(var e=this.buffered,t=0,n=e.length;t<n;t++)if(!(e.end(t)<this.currentTime))return e.start(t)-this.currentTime;return 0}},{key:"canSeek",value:function(){return!0}},{key:"resume",value:function(){return this._media.play()}},{key:"pause",value:function(){return this._media.pause()}},{key:"seekNoSideEffect",value:function(e){this._doChaseFrame(e)}},{key:"dump",value:function(){}},{key:"_emitTimelineEvents",value:function(e,t,n){var r,i;null===(r=this._parent)||void 0===r||null===(i=r.emit)||void 0===i||i.call(r,e,t,n)}},{key:"_assembleErr",value:function(e,t){var n=new Error(e);return n.code=3,n.subCode=t,n}},{key:"_bindEvents",value:function(){var e=this;Sl(bl(o.prototype),"_bindEvents",this).call(this),this._parent.on(VG.CHASE_AUDIO_FRAME,this._doChaseFrame),this._parent.on(MG.UPDATE_VOLUME,(function(t){e._media.volume=t,e._emitTimelineEvents(MG.PLAY_EVENT,CG.VOLUME_CHANGE)})),this._parent.on(MG.END_OF_STREAM,(function(){var t;e.reuseMseForAudio||(null===(t=e._mse)||void 0===t||t.endOfStream())})),this._parent.on(MG.SET_PLAYBACKRATE,(function(t){VP.log(e.TAG,"change playbackrate, ",t),e._media.playbackRate=t}))}},{key:"_bindMediaEvents",value:function(){this._media.addEventListener("canplay",this._onCanplay),this._media.addEventListener("playing",this._onPlaying),this._media.addEventListener("waiting",this._onWaiting),this._media.addEventListener("seeked",this._onSeeked),this._media.addEventListener("progress",this._onProgress),this._media.addEventListener("ended",this._onEnded),this._media.addEventListener("progress",this._onOnceProgress),this._media.addEventListener("error",this._onError)}},{key:"_updateDuration",value:(r=fl(dl().mark((function e(t){return dl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=7;break}if(this._mse.isOpened){e.next=4;break}return e.next=4,this._mse.open();case 4:return e.next=6,this._mse.updateDuration(t);case 6:VP.log(this.TAG,"update duration",t);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_doAppendWrapper",value:(n=fl(dl().mark((function e(){var t;return dl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._meta.samples=this._sampleQueue.slice(),this._meta.baseMediaDecodeTime=this._meta.samples[0].baseMediaDecodeTime,this._sampleQueue=[],e.prev=3,this._inProcessing=!0,e.next=7,this._doAppend(this._meta);case 7:if(t=e.sent,this.isLive&&this._emitTimelineEvents(MG.UPDATE_SEGMENT_END,t),this._inProcessing=!1,!this._sampleQueue.length){e.next=13;break}return e.next=13,this._doAppendWrapper();case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(3),this._emitTimelineEvents(MG.PLAY_EVENT,CG.ERROR,this._assembleErr("audio error: ".concat(null===e.t0||void 0===e.t0?void 0:e.t0.message),3));case 18:case"end":return e.stop()}}),e,this,[[3,15]])}))),function(){return n.apply(this,arguments)})},{key:"_checkAutoPlay",value:function(){var e=this;this._media.addEventListener("canplay",(function t(){var n=e._media.volume;e._media.volume=Math.min(n,.1);var r=e._media.play();(r=r.then?r:Promise.reject()).then((function(){VP.log(e.TAG,"auto play by checkAutoPlay!"),e._audioCanAutoplay=!0})).catch((function(){VP.warn(e.TAG,"can’t auto play!"),e._audioCanAutoplay=!1,e.emit(GG.AUDIO_NOT_ALLOWED_AUTOPLAY)})).finally((function(){e._media.volume=n,e._startRendered||(e._media.pause(),VP.log(e.TAG,"auto paused by checkAutoPlay!")),e._media.removeEventListener("canplay",t)}))}))}},{key:"_destroy",value:(t=fl(dl().mark((function e(){var t,n,r;return dl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(VP.log(this.TAG,"destroy audio render"),this._remuxer=null,this.removeAllListeners(),this._media.removeEventListener("canplay",this._onCanplay),this._media.removeEventListener("playing",this._onPlaying),this._media.removeEventListener("waiting",this._onWaiting),this._media.removeEventListener("seeked",this._onSeeked),this._media.removeEventListener("progress",this._onProgress),this._media.removeEventListener("ended",this._onEnded),this._media.removeEventListener("progress",this._onOnceProgress),this._media.removeEventListener("error",this._onError),this._reuseMse){e.next=17;break}return null===(t=this._mse)||void 0===t||t.endOfStream(),e.next=15,null===(n=this._mse)||void 0===n?void 0:n.unbindMedia();case 15:e.next=20;break;case 17:null===(r=this._mse)||void 0===r||r.clearAllBuffer(),OF.cacheMedia({codec:this._codec,media:this._media,mse:this._mse}),VP.log(this.TAG,"cache media for audio play, codec=",this._codec);case 20:this._meta&&(this._meta.duration=0),this._mse=null,this._media=null;case 23:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}],[{key:"isSupported",value:function(){return rG().audioWithMse&&!!window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="mp4a.40.5"')}}]),o}(XG),UF=function(){function e(t){pl(this,e),this.TAG="VideoTimeRange",this._parent=t,this._baseDts=0,this._lastDuration=0,this._duration=0,this._bitrate=0,this._totalSize=0,this._buffers=[],this._currentFrameQueue=[],this._frameIndexInQueue=0,this._delayEstimateList=[],this._keyframeQueue=[]}return yl(e,[{key:"isLive",get:function(){return this._parent.isLive}},{key:"baseDts",get:function(){return this._baseDts}},{key:"duration",get:function(){return this._duration},set:function(e){this._duration=e}},{key:"buffered",get:function(){var e=this;if(this.isLive)return{length:this._duration?1:0,start:function(){return 0},end:function(){return e._duration}};var t=this._mergeBufferRanges();return{length:t.length,start:function(e){var n=t[e];return n?n.start:0},end:function(e){var n=t[e];return n?n.end:1/0}}}},{key:"bufferStart",get:function(){var e;return(null===(e=this._buffers[0])||void 0===e?void 0:e.start)||0}},{key:"frameLength",get:function(){return this._currentFrameQueue.length}},{key:"keyFrameLength",get:function(){return this._keyframeQueue.length}},{key:"totalSize",get:function(){return this._totalSize}},{key:"bitrate",get:function(){return this._bitrate},set:function(e){this._bitrate=e}},{key:"lastDuration",get:function(){return this._lastDuration}},{key:"frames",get:function(){return this._currentFrameQueue}},{key:"getCurrentTime",value:function(e){return this._lastDuration+(e-this._baseDts)/1e3}},{key:"resetDts",value:function(e){this._baseDts=e}},{key:"_mergeBufferRanges",value:function(){var e=this._buffers.sort((function(e,t){return e.start>t.start?1:-1})),t=e.length,n=[];if(!t)return n;for(var r={start:e[0].start,end:e[0].end},i=1;i<t;i++){var o=e[i];Math.abs(r.end-o.start)<.1?r.end=o.end:(n.push(r),r={start:o.start,end:o.end})}return n.push(r),n}},{key:"_caclBaseDts",value:function(e){-1===this._baseDts&&e&&(this._baseDts=e.dts,VP.log(this.TAG,"set baseDts: ",this._baseDts,"frame len:",this._currentFrameQueue.length))}},{key:"_updateDuration",value:function(e){for(var t=e.length,n=e[t-1],r=0;r<t;r++){var i=e[r];if(i&&i.options&&i.options.meta){var o=e[r-1]||this._currentFrameQueue[this._currentFrameQueue.length-1];o?this._lastDuration+=(o.dts-this._baseDts)/1e3:this._lastDuration=this._duration,VP.log(this.TAG,"updateBaseDts,record lastDuration:",this._lastDuration),this._baseDts=i.dts;break}}n&&(this._duration=(n.dts-this._baseDts)/1e3+this._lastDuration)}},{key:"_estimateBitRate",value:function(e){var t=e.length;if(t<=2){if(this._delayEstimateList=this._delayEstimateList.concat(e),(t=this._delayEstimateList.length)<=30)return;e=this._delayEstimateList,this._delayEstimateList=[]}for(var n=0,r=0;r<t;r++){var i=e[r];n+=i.data?i.data.length:i.units.reduce((function(e,t){return e+t.byteLength}),0)}this._totalSize+=n;var o=n/(e[t-1].dts-e[0].dts);this._bitrate=parseInt(8e3*o)}},{key:"_beforeAppendVodBuffer",value:function(e){var t=this;if(e.length){for(var n=[],r=[],i=0,o=e.length;i<o;i++)e[i].keyframe&&(n.push(r),r=[]),r.push(e[i]);r.length&&n.push(r),n.forEach((function(e){return t._appendVodBuffer(e)}))}}},{key:"_appendVodBuffer",value:function(e){if(e.length){var t=e[0],n=e[e.length-1],r=(t.dts-this._baseDts)/1e3,i=(n.dts-this._baseDts)/1e3;VP.enable&&VP.log(this.TAG,"add new buffer range [".concat(r," , ").concat(i,"]")),this._buffers.filter((function(e){return r>=e.start&&i<=e.end})).length||(this._buffers.push({start:r,end:i,duartion:i-r,frames:e.slice()}),this._buffers.sort((function(e,t){return e.start>t.start?1:-1})),this._afterAppendVodBuffer())}}},{key:"_afterAppendVodBuffer",value:function(){if(this._buffers.filter((function(e){var t;return!(null!==(t=e.frames[0])&&void 0!==t&&t.keyframe)})).length){for(var e=this._buffers,t=this._buffers.length,n=[],r=this._buffers[0],i=1;i<t;i++){var o;null!==(o=e[i].frames[0])&&void 0!==o&&o.keyframe?(n.push(r),r=e[i]):(r.frames=r.frames.concat(e[i].frames),r.end=e[i].end,r.duartion=r.end-r.start)}n.push(r),this._buffers=n}}},{key:"_recordKeyframes",value:function(e){var t=this;e.forEach((function(e){if(e.keyframe){var n=(e.dts-t._baseDts)/1e3;t._keyframeQueue.push({position:n,frame:e})}})),this._keyframeQueue=this._keyframeQueue.sort((function(e,t){return e.position>t.position?1:-1})),this.isLive&&this._keyframeQueue.length>40&&this._keyframeQueue.splice(0,20)}},{key:"toAnnexBNalu",value:function(e){e.forEach((function(e){var t=e.units;if(t){var n=t.reduce((function(e,t){return e+4+t.byteLength}),0),r=new Uint8Array(n),i=0;t.forEach((function(e){r.set([0,0,0,1],i),i+=4,r.set(e,i),i+=e.byteLength})),e.units=null,e.data=r}}))}},{key:"append",value:function(e,t,n){n&&this.toAnnexBNalu(e),this._caclBaseDts(e[0]),t&&this._updateDuration(e),this._estimateBitRate(e),this._recordKeyframes(e),this.isLive?this._currentFrameQueue=this._currentFrameQueue.concat(e):this._beforeAppendVodBuffer(e)}},{key:"updateSegmentEnd",value:function(e){var t=this._buffers[this._buffers.length-1];t&&(Math.abs(t.end-e)<.5||(t.end=e,t.duartion=e-t.start,VP.log(this.TAG,"video data lack, reset end:",e)))}},{key:"getFrame",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(this.isLive)return this._currentFrameQueue.shift();if(!(e=this._currentFrameQueue[this._frameIndexInQueue])){if(!(e=this._currentFrameQueue[--this._frameIndexInQueue]))return;if(!this.switchBuffer((e.dts-this._baseDts)/1e3,this._frameIndexInQueue++,t))return;return this.getFrame(++t)}return this._frameIndexInQueue++,e}},{key:"getFramesForPreciseSeek",value:function(e){return this._currentFrameQueue.filter((function(t){return t.dts<=e}))}},{key:"updateFrameIndexForPreciseSeek",value:function(e){this._frameIndexInQueue=e}},{key:"switchBuffer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!((arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)>=20)){e=e||this.bufferStart;var n=this._buffers.filter((function(t){return t.start<e+.1&&t.end>=e+.1}))[0];if(!n){var r=this._buffers.find((function(t){return t.start>=e}));return r&&r.start-e<1?(this._currentFrameQueue=r.frames.slice(0),this._frameIndexInQueue=0,r):void 0}return n.frames[0].dts>=e?(this._currentFrameQueue=n.frames.slice(0),this._frameIndexInQueue=0,VP.log(this.TAG,"switch video buffer, time:".concat(e," , buffer:[").concat(n.start," , ").concat(n.end,"], index=0")),n):n.frames.length>t?(this._currentFrameQueue=n.frames.slice(0),VP.log(this.TAG,"switch video buffer, in the same gop and more frame got, time:".concat(e," , buffer:[").concat(n.start," , ").concat(n.end,"], index=").concat(t)),n):void VP.log(this.TAG,"switch video buffer, in the same gop and no more frame got, time:".concat(e," , buffer:[").concat(n.start," , ").concat(n.end,"], index=").concat(t))}}},{key:"getSeekStartPosition",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(this._keyframeQueue.forEach((function(n){n.position<=e&&(t=n)})),t)return e-t.position<n?t:void 0}},{key:"nextFrame",value:function(){return this._currentFrameQueue[0]}},{key:"deletePassed",value:function(e){this._currentFrameQueue=this._currentFrameQueue.filter((function(t){return t.dts>=e}))}},{key:"getDtsOfTime",value:function(e){var t=e-this._lastDuration;return this._baseDts+1e3*t}},{key:"clean",value:function(){this._currentFrameQueue=[]}},{key:"destroy",value:function(){this._currentFrameQueue=[],this._buffers=[]}}]),e}();function FF(e){var t;(null===(t=e.buffer)||void 0===t?void 0:t.close)&&e.buffer.close()}var YF=function(){function e(t){pl(this,e),this.TAG="FrameQueue",this._parent=t,this._lastGopId=0,this._frames=[]}return yl(e,[{key:"currentTimeDts",get:function(){return this._parent.preciseVideoDts}},{key:"length",get:function(){return this._frames.length}},{key:"frames",get:function(){return this._frames}},{key:"append",value:function(e){e.info?this._frames.push(e):FF(e)}},{key:"appendVodFrame",value:function(e){this._frames.push(e)}},{key:"nextFrame",value:function(){var e=this._frames.length;return 1===this._parent.noAudio&&e>3&&(this._frames=this._frames.slice(e-2)),this._frames[0]}},{key:"shift",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this._frames.shift();return this.deletePassed(e),t}},{key:"deletePassed",value:function(e){this._frames=this._frames.filter((function(t){return!!(t.info&&t.info.dts>e)||(FF(t),!1)}))}},{key:"empty",value:function(){this._frames.forEach((function(e){return FF(e)})),this._frames=[]}},{key:"destroy",value:function(){this.empty(),this._lastGopId=0}}]),e}();LR("Float32",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var KF=new(function(){function e(){pl(this,e),vl(this,"_queue",[]),vl(this,"TAG","FrameRenderCache")}return yl(e,[{key:"cacheCvs",value:function(e){this._queue.push(e),VP.log(this.TAG,"cache canvas!")}},{key:"getCachedCvs",value:function(){var e=this._queue.pop();return e&&VP.log(this.TAG,"get cached canvas!"),e}}]),e}()),jF=function(){function e(t,n){pl(this,e),this.TAG="FrameRender",this.configs=Object.assign({},t),this.parent=n,this.canvas=this.configs.canvas,this.canvas.glInstance=this,this.meta=Object.assign({},this.configs.meta),this.frameRenderCache=KF,this._initMeta(),this._initContextGL(),this.contextGL&&(this._initProgram(),this._initBuffers(),this._initTextures())}return yl(e,[{key:"_initMeta",value:function(){this.chroma=this.meta.chromaFormat,this.height=this.meta.height,this.width=this.meta.width,this.canvas.width===this.meta.width&&this.canvas.height===this.meta.height||(this.canvas.width=this.meta.width,this.canvas.height=this.meta.height,this.parent.emitResizeEvent())}},{key:"_initContextGL",value:function(){if("2d"!==this.configs.type){for(var e=this.canvas,t=null,n=["webgl","experimental-webgl","moz-webgl","webkit-3d"],r=0;!t&&r<n.length;){var i=n[r];try{t=e.getContext(i,this.configs.glCtxOptions),VP.log("FrameRender","use=",i,this.configs.glCtxOptions);break}catch(kye){t=null}t&&"function"==typeof t.getParameter||(t=null),++r}this.contextGL=t}else this.ctx=this.canvas.getContext("2d")}},{key:"_initProgram",value:function(){var e=this.contextGL,t=["attribute vec4 vertexPos;","attribute vec4 texturePos;","attribute vec4 uTexturePos;","attribute vec4 vTexturePos;","varying vec2 textureCoord;","varying vec2 uTextureCoord;","varying vec2 vTextureCoord;","void main()","{"," gl_Position = vertexPos;"," textureCoord = texturePos.xy;"," uTextureCoord = uTexturePos.xy;"," vTextureCoord = vTexturePos.xy;","}"].join("\n"),n=["precision highp float;","varying highp vec2 textureCoord;","varying highp vec2 uTextureCoord;","varying highp vec2 vTextureCoord;","uniform sampler2D ySampler;","uniform sampler2D uSampler;","uniform sampler2D vSampler;","uniform mat4 YUV2RGB;","void main(void) {"," highp float y = texture2D(ySampler, textureCoord).r;"," highp float u = texture2D(uSampler, uTextureCoord).r;"," highp float v = texture2D(vSampler, vTextureCoord).r;"," gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;","}"].join("\n"),r=e.createShader(e.VERTEX_SHADER);e.shaderSource(r,t),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)||console.log("Vertex shader failed to compile: "+e.getShaderInfoLog(r));var i=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||console.log("Fragment shader failed to compile: "+e.getShaderInfoLog(i));var o=e.createProgram();e.attachShader(o,r),e.attachShader(o,i),e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS)||console.log("Program failed to compile: "+e.getProgramInfoLog(o)),e.useProgram(o);var a=e.getUniformLocation(o,"YUV2RGB");e.uniformMatrix4fv(a,!1,[1.16438,0,1.59603,-.87079,1.16438,-.39176,-.81297,.52959,1.16438,2.01723,0,-1.08139,0,0,0,1]),this.shaderProgram=o}},{key:"_initBuffers",value:function(){var e=this.contextGL,t=this.shaderProgram,n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var r=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(r),e.vertexAttribPointer(r,2,e.FLOAT,!1,0,0);var i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var o=e.getAttribLocation(t,"texturePos");e.enableVertexAttribArray(o),e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0),this.texturePosBuffer=i;var a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var s=e.getAttribLocation(t,"uTexturePos");e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),this.uTexturePosBuffer=a;var u=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var c=e.getAttribLocation(t,"vTexturePos");e.enableVertexAttribArray(c),e.vertexAttribPointer(c,2,e.FLOAT,!1,0,0),this.vTexturePosBuffer=u}},{key:"_initTextures",value:function(){var e=this.contextGL,t=this.shaderProgram,n=this._initTexture(),r=e.getUniformLocation(t,"ySampler");e.uniform1i(r,0),this.yTextureRef=n;var i=this._initTexture(),o=e.getUniformLocation(t,"uSampler");e.uniform1i(o,1),this.uTextureRef=i;var a=this._initTexture(),s=e.getUniformLocation(t,"vSampler");e.uniform1i(s,2),this.vTextureRef=a,e.pixelStorei(e.UNPACK_ALIGNMENT,1)}},{key:"_initTexture",value:function(){var e=this.contextGL,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),t}},{key:"_drawPictureGL",value:function(e,t,n,r,i){var o=r*n,a=i*n/2;444!==this.chroma&&422!==this.chroma||(a*=2);var s={yData:(e=new Uint8Array(e)).subarray(0,o),uData:e.subarray(o,o+a),vData:e.subarray(o+a,o+a+a)};this._drawPictureGL420(s,t,n,r,i)}},{key:"_drawPictureGL420",value:function(e,t,n,r,i){var o=this.contextGL,a=this.texturePosBuffer,s=this.uTexturePosBuffer,u=this.vTexturePosBuffer,c=this.yTextureRef,l=this.uTextureRef,d=this.vTextureRef,h=e.yData,f=e.uData,p=e.vData,m=r,y=n,v=i,g=n/2;422!==this.chroma&&444!==this.chroma||(g=n);var b=i,A=g,_=this.canvas.width/this.width,w=this.canvas.height/this.height,S=0,k=0,T=this.canvas.width,x=this.canvas.height;_<w?(x=this.height*this.canvas.width/this.width,k=parseInt((this.canvas.height-this.height*this.canvas.width/this.width)/2)):(T=this.width*this.canvas.height/this.height,S=parseInt((this.canvas.width-this.width*this.canvas.height/this.height)/2)),o.viewport(S,k,T,x);var E=new Float32Array([1,0,0,0,1,1,0,1]);o.bindBuffer(o.ARRAY_BUFFER,a),o.bufferData(o.ARRAY_BUFFER,E,o.DYNAMIC_DRAW);var L=new Float32Array([1,0,0,0,1,1,0,1]);o.bindBuffer(o.ARRAY_BUFFER,s),o.bufferData(o.ARRAY_BUFFER,L,o.DYNAMIC_DRAW);var I=new Float32Array([1,0,0,0,1,1,0,1]);o.bindBuffer(o.ARRAY_BUFFER,u),o.bufferData(o.ARRAY_BUFFER,I,o.DYNAMIC_DRAW),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,c),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,m,y,0,o.LUMINANCE,o.UNSIGNED_BYTE,h),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,l),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,v,g,0,o.LUMINANCE,o.UNSIGNED_BYTE,f),o.activeTexture(o.TEXTURE2),o.bindTexture(o.TEXTURE_2D,d),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,b,A,0,o.LUMINANCE,o.UNSIGNED_BYTE,p),o.drawArrays(o.TRIANGLE_STRIP,0,4)}},{key:"_drawPicture2d",value:function(e){if(e&&this.canvas){this.ctx||(this.ctx=this.canvas.getContext("2d"));var t=e.displayWidth||e.width,n=e.displayHeight||e.height;this.canvas.height===n&&this.canvas.width===t||(this.canvas.height=n,this.canvas.width=t);try{this.ctx.drawImage(e.dom||e,0,0,t,n)}catch(Sye){console.error(this.TAG,"_drawPicture2d",e,e.dom,Sye,Sye.message)}}}},{key:"_resize",value:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.canvas.width=e,this.canvas.height=t,this.parent.emitResizeEvent())}},{key:"render",value:function(e,t,n,r,i){this._resize(t,n),this.contextGL?this._drawPictureGL(e,t,n,r,i):this._drawPicture2d(e)}},{key:"resetMeta",value:function(e){this.meta=Object.assign({},e)}},{key:"updateBind",value:function(e,t){this.parent=e,this.resetMeta(t)}},{key:"destroy",value:function(e){this.parent=null,this.canvas.style.display="none",e&&(this.contextGL&&this.contextGL.clear(this.contextGL.DEPTH_BUFFER_BIT|this.contextGL.COLOR_BUFFER_BIT),KF.cacheCvs(this.canvas))}}]),e}(),HF=function(){function e(t){pl(this,e),vl(this,"_lowDecodeThreshold",rG().lowDecodeThreshold/5),this.TAG="DecodeEstimate",this._needEstimate=!0,this._parent=t,this._lastDecodeDot=0,this._lastDecodeCost=0,this._lastFrameDts=0,this._dtsDeltas=[],this._decodeCosts=[],this._lowDecodeQueue=[],this._fps=0,this._decodeFps=0,this._gopLength=0,this._webcodec=!1}return yl(e,[{key:"fps",get:function(){return this._fps}},{key:"decodeFps",get:function(){return this._decodeFps}},{key:"decodeCost",get:function(){return this._lastDecodeCost}},{key:"gopLength",get:function(){return this._gopLength}},{key:"webcodec",set:function(e){this._webcodec=e}},{key:"updateGopCount",value:function(){this._gopLength++}},{key:"needEstimateFps",value:function(){this._needEstimate=!0}},{key:"addDecodeInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{dts:0};this._estimateDecodeFps(e),this._estimateFps(e)}},{key:"resetDecodeDot",value:function(e){this._lastDecodeDot=e||0}},{key:"reset",value:function(){this._decodeCosts=[],this._lowDecodeQueue=[]}},{key:"_estimateFps",value:function(e){if(this._needEstimate)if(this._lastFrameDts){var t=e.dts-this._lastFrameDts;if(this._lastFrameDts=e.dts,!(Math.abs(t)>200)){this._dtsDeltas.push(t);var n=this._dtsDeltas.length;n<5||(this._fps=Math.ceil(1e3/this._avg(this._dtsDeltas,n)),VP.log(this.TAG,"estimate fps:",this._fps),this._needEstimate=!1)}}else this._lastFrameDts=e.dts}},{key:"_estimateDecodeFps",value:function(e){if(this._lastDecodeDot){var t=performance.now(),n=t-this._lastDecodeDot;this._lastDecodeDot=t,e.cost=n,this._lastDecodeCost=n,this._decodeCosts.push(n);var r=this._decodeCosts.length;if(!(r<5)){var i=this._avg(this._decodeCosts,r);this._decodeFps=Math.floor(1e3/i),this._decodeCosts=[],this._lowDecodeDetect()}}else this._lastDecodeDot=performance.now()}},{key:"_avg",value:function(e,t){var n=e.reduce((function(e,t){return e+=t}),0);return Math.floor(n/t)||1}},{key:"_lowDecodeDetect",value:function(){this._decodeFps?(this._decodeFps<this._fps*this._parent.playbackRate+(this.webcodec?0:3)?this._lowDecodeQueue.push(this._decodeFps):this._lowDecodeQueue.pop(),this._lowDecodeQueue.length>this._lowDecodeThreshold&&(this._lowDecodeQueue=[],VP.log(this.TAG,"解码效率过低,应该降级"),this._parent.emit(DG.DECODE_LOW_FPS))):this._parent.emit(DG.DECODE_LOW_FPS)}}]),e}(),BF=[],JF=function(){function e(t){var n=this;pl(this,e),vl(this,"_doTask",(function(){var e;null===(e=n._task)||void 0===e||e.call(n)})),this._task=t;var r=new Blob(["\n var timer;\n\n function initTimer (interval) {\n destroy()\n clearInterval(timer);\n timer = setInterval(() => {\n self.postMessage({type: 'NEXT_TICK'});\n }, interval)\n }\n\n function destroy () {\n clearInterval(timer);\n }\n\n self.onmessage = function (e) {\n var {type,interval} = e.data;\n switch (type) {\n case 'START':\n initTimer(interval);\n break;\n case 'DESTROY':\n destroy();\n break;\n }\n }\n"],{type:"application/javascript"});this._worker=BF.pop()||new Worker(URL.createObjectURL(r)),this._bindEvent()}return yl(e,[{key:"_bindEvent",value:function(){this._worker.addEventListener("message",this._doTask)}},{key:"start",value:function(e){(e=parseInt(e))<10&&(e=10),e>60?e=60:e>25&&(e=25),this._worker.postMessage({type:"START",interval:e})}},{key:"stop",value:function(){this._worker.postMessage({type:"DESTROY"})}},{key:"destroy",value:function(){this._worker&&(this._worker.postMessage({type:"DESTROY"}),this._worker.removeEventListener("message",this._doTask),BF.push(this._worker),VP.log("TickTimer","unbind timer event"),this._worker=null,this._task=null)}}]),e}(),zF=function(e){gl(n,e);var t=wl(n);function n(e,r){var i;return pl(this,n),(i=t.call(this,e,r))._timeRange=new UF(_l(i)),i._decodeEstimate=new HF(_l(i)),i._frameQueue=new YF(_l(i)),i._lastTimeupdate=0,i._renderCost=0,i._canAutoPlay=!0,i._videoDecode=!1,i._inSeeking=!1,i._frameRender=null,i._configuration=null,i._render=i._render.bind(_l(i)),i._tickTimer=new JF(i._render),i._initCanvas(e),i._bindEvents(),i}return yl(n,[{key:"canAutoPlay",get:function(){return this._canAutoPlay}},{key:"canvas",get:function(){return this._canvas}},{key:"timescale",get:function(){return 1e3}},{key:"fps",get:function(){return this._decodeEstimate.fps||this._meta&&this._meta.fpsNum/this._meta.fpsDen||24}},{key:"decodeFps",get:function(){return this._decodeEstimate.decodeFps}},{key:"decodeCost",get:function(){return this._decodeEstimate.decodeCost}},{key:"renderCost",get:function(){return this._renderCost}},{key:"totalSize",get:function(){return this._timeRange.totalSize}},{key:"bitrate",get:function(){return this._timeRange.bitrate},set:function(e){this._timeRange.bitrate=e}},{key:"gopLength",get:function(){return this._decodeEstimate.gopLength}},{key:"is540p",get:function(){return this._canvas.height<720}},{key:"buffered",get:function(){return this._timeRange.buffered}},{key:"inSeeking",get:function(){return this._inSeeking}},{key:"interval",get:function(){return Math.floor(1e3/this.fps/this.playbackRate)}},{key:"playbackRate",get:function(){return this._playbackRate||1}},{key:"baseDts",get:function(){return this._timeRange.baseDts}},{key:"currentTime",get:function(){return this._timeRange.getCurrentTime(this.preciseVideoDts)}},{key:"timelinePosition",get:function(){return this._parent.timelinePosition}},{key:"lastTimelinePosition",get:function(){return this._lastTimelinePosition||0},set:function(e){this._lastTimelinePosition=e}},{key:"audioSyncDts",get:function(){return this._audioDts||this.baseDts},set:function(e){this._audioDts=e}},{key:"preciseVideoDts",get:function(){return this.audioSyncDts+Math.floor(1e3*(this.timelinePosition-this.lastTimelinePosition))}},{key:"readyState",get:function(){var e=this._frameQueue.length||(this.currentTime?1:0);return e?e>=8?4:e>=4?3:e>=2?2:1:0}},{key:"isHevc",get:function(){return!("hev1.1.6.L93.B0"!==(this._meta||{}).codec)}},{key:"videoDecode",get:function(){return this._videoDecode}},{key:"decoderMode",get:function(){var e;return null===(e=this._decodeController)||void 0===e?void 0:e.decoderMode}},{key:"configuration",get:function(){var e,t;return this._configuration||(this._configuration=this._meta.configuration||XP(null===(e=this._meta)||void 0===e?void 0:e.sps[0],null===(t=this._meta)||void 0===t?void 0:t.pps[0])),this._configuration},set:function(e){this._configuration=e.configuration||XP(e.sps[0],e.pps[0])}},{key:"setSeekingStatus",value:function(e){this._inSeeking=e}},{key:"getDtsOfTime",value:function(e){return this._timeRange.getDtsOfTime(e)}},{key:"updateReady",value:function(){this._whenReady()}},{key:"forceRender",value:function(){this._render(!0)}},{key:"getSeekStartPosition",value:function(e,t){return this._timeRange.getSeekStartPosition(e,t)}},{key:"canSeek",value:function(){throw new Error("need override by children")}},{key:"emitResizeEvent",value:function(){null==this||this._emitTimelineEvents(MG.PLAY_EVENT,CG.RESIZE)}},{key:"_assembleErr",value:function(e,t){var n=new Error(e);return n.code=3,n.subCode=t,n}},{key:"_emitTimelineEvents",value:function(e,t,n){var r;null===(r=this._parent)||void 0===r||r.emit(e,t,n)}},{key:"_initCanvas",value:function(e){e.canvas?this._canvas=e.canvas:this._canvas=KF.getCachedCvs()||document.createElement("canvas"),this._canvas.style.margin="auto",this._canvas.style.position="absolute",this._canvas.style.pointerEvents="none"}},{key:"_bindEvents",value:function(){var e=this;Sl(bl(n.prototype),"_bindEvents",this).call(this);var t=function(t){var n=t.width,r=t.height,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=e._canvas,s=a.width,u=a.height,c=r*s/u,l=n*u/s,d=n-c,h=r-l,f=d*i+"px",p=h*o+"px";e._canvas.style.left=f,e._canvas.style.top=p,VP.warn(e.TAG,"cvsWidth=".concat(s,", cvsHeight=").concat(u,", scaleCvsWidth=").concat(c,", scaleCvsHeight=").concat(l)),VP.warn(e.TAG,"cover position: deltaX=".concat(d,", deltaY=").concat(h,", width=").concat(n,", height=").concat(r,", pX=").concat(f,", pY=").concat(p))};this._parent.on(DG.UPDATE_VIDEO_FILLTYPE,(function(n,r){var i=r.width,o=r.height,a=e._canvas,s=a.width,u=a.height,c=!i||i/o>s/u;if(VP.warn(e.TAG,"UPDATE_VIDEO_FILLTYPE isGapX =",c,"type =",n,s,u,i,o),e._canvas.style.maxWidth="initial",e._canvas.style.maxHeight="initial","cover"===n)return c?(e._canvas.style.left=0,e._canvas.style.top=0,e._canvas.style.height="auto",e._canvas.style.width="100%",void t({width:i,height:o},0,.5)):(e._canvas.style.left=0,e._canvas.style.top=0,e._canvas.style.width="auto",e._canvas.style.height="100%",void t({width:i,height:o},.5,0));if("fill"===n)return e._canvas.style.width="100%",void(e._canvas.style.height="100%");(e._canvas.style.top=0,e._canvas.style.bottom=0,e._canvas.style.left=0,e._canvas.style.right=0,e._canvas.style.maxWidth="100%",e._canvas.style.maxHeight="100%",e._canvas.style.width="initial",e._canvas.style.height="initial",s<i&&u<o)&&(s/i>u/o?e._canvas.style.width="100%":e._canvas.style.height="100%")})),this._parent.on(DG.UPDATE_VIDEO_COVER_POSITION,t),this._parent.on(MG.SYNC_DTS,(function(t){var n,r=e._frameQueue.nextFrame(),i=r&&r.info&&r.info.dts;if(e.lastTimelinePosition=e.timelinePosition,e.noAudio){var o=e._timeRange.nextFrame();t=t||i||o&&o.dts||0}if(e.audioSyncDts=t,i&&i-t>500&&e._emitTimelineEvents(MG.PLAY_EVENT,CG.LARGE_AV_GAP,{aDts:t,vDts:i,frameLength:e._frameQueue.length,currentTime:e._parent.currentTime,duration:e._parent.duration}),VP.log(e.TAG,"audio current buffer play finish, next buffer dts=",t,"currentTime:",e._parent.currentTime,"preciseVideoDts:",e.preciseVideoDts,"next video frame dts:",i,"frame length:",e._frameQueue.length),!(e._isLive||null!==(n=e._parent)&&void 0!==n&&n.seeking)){var a=e._timeRange.nextFrame();if(a){var s=(a.dts-a.baseDts)/1e3;e._parent.currentTime-s>1&&(VP.warn(e.TAG,"丢帧!"),e.ajustSeekTime(e._parent.currentTime))}}})),this._parent.on(MG.UPDATE_GL_OPTIONS,(function(t){e._config.glCtxOptions=t})),this._parent.on(MG.UPDATE_SEGMENT_END,this._updateSegmentEnd.bind(this)),this.on(DG.AUTO_RUN,this._startRender.bind(this)),this._parent.on(MG.SET_PLAYBACKRATE,(function(t){e._playbackRate=t,e._startRender()}))}},{key:"ajustSeekTime",value:function(){throw new Error("need override by children")}},{key:"_resetDts",value:function(e,t){"audio"!==t&&this._timeRange.resetDts(e)}},{key:"_setMetadata",value:function(e,t){if("audio"!==e){VP.warn(this.TAG,"video set metadata"),this._meta=t;var n=t&&t.frameRate&&t.frameRate.fps;n?VP.log(this.TAG,"detect fps:",n):VP.warn(this.TAG,"no detect fps,start estimate"),this._initDecoder()}}},{key:"_initDecoder",value:function(){throw new Error("need override by children")}},{key:"_whenDecoderReady",value:function(){throw new Error("need override by children")}},{key:"_appendChunk",value:function(){throw new Error("need override by children")}},{key:"_startDecode",value:function(){throw new Error("need override by children")}},{key:"_receiveFrame",value:function(e,t){if(this._parent&&this._timeRange){var n=e.info||{};if(this._decodeEstimate.addDecodeInfo(n),!this._isLive&&((n.output||n.keyframe)&&(this.setSeekingStatus(!1),VP.warn(this.TAG,"set seeking status=",!1)),this.inSeeking))return VP.log(this.TAG,"drop frame"),void FF(e);this._isLive?this._frameQueue.append(e):this._frameQueue.appendVodFrame(e),t&&t(),this._ready||this.readyState>=1&&this._whenReady()}}},{key:"_startRender",value:function(){VP.log(this.TAG,"start render"),this._tickTimer.start(this.interval)}},{key:"_render",value:function(){throw new Error("need override by children")}},{key:"_updateSegmentEnd",value:function(){throw new Error("need override by children")}},{key:"_whenReady",value:function(){this._ready=!0,this.emit(DG.VIDEO_READY),this.noAudio&&this._emitTimelineEvents(MG.PLAY_EVENT,CG.PLAYING)}},{key:"_doPlay",value:function(){this._tickTimer.start()}},{key:"_doPause",value:function(){this._tickTimer.stop()}},{key:"_doSeek",value:function(){this._ready=!1,this._frameQueue.destroy()}},{key:"_doChaseFrame",value:function(){throw new Error("need override by children")}},{key:"destroy",value:function(e){var t,n,r,i;null===(t=this._tickTimer)||void 0===t||t.destroy(),null===(n=this._timeRange)||void 0===n||n.destroy(),null===(r=this._frameQueue)||void 0===r||r.destroy(),null===(i=this._frameRender)||void 0===i||i.destroy(e),this._tickTimer=null,this._canvas=null,this._timeRange=null,this._frameQueue=null,this._frameRender=null,this._decodeEstimate=null,this._parent=null,this.removeAllListeners()}}]),n}(XG),QF=function(e){gl(n,e);var t=wl(n);function n(e){var r;return pl(this,n),(r=t.call(this)).TAG="VideoDecoder",r._video=r._createVideo(),r._IsInDecoding=!1,r._fps=0,r._framId=null,r._screenShotNum=0,r._allPicNum=0,r._currentBlob=null,r._basePTS=0,r._totleTime=0,r._isVideoONRun=!0,r.firstEmit=!1,r.ptsArray=[],r._currentCanvasHeight=0,r._canvasList=[],r._realFrameDuration=25,r._maxVideoHeight=e.maxVideoHeight||720,r._minFPSTime=0,r._maxFPSTime=0,r._playFailed=!1,r._isPhoneSafari=!1,r._createCanvasList(),r._bindEvents(),r}return yl(n,[{key:"_createCanvasList",value:function(){this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d",{alpha:!1});for(var e=0;e<45;e++){var t=this._createCanvas(),n=t.dom,r=t.ctx;this._canvasList.push({dom:n,ctx:r})}}},{key:"_createCanvas",value:function(){var e=document.createElement("canvas"),t=e.getContext("2d");return{dom:e,ctx:t}}},{key:"_createVideo",value:function(){var e=document.createElement("video");return e.setAttribute("muted",!0),e.setAttribute("autoplay",!0),e.setAttribute("controls",!0),e.setAttribute("webkit-playsinline",!0),e.setAttribute("playsinline",!0),e.setAttribute("x5-video-player-type","h5"),e.setAttribute("x5-video-player-type","h5-page"),e.style.position="absolute",e}},{key:"_initVideo",value:function(e,t){if(e.blobUrl&&void 0!==e.dts){var n=e.blobUrl;this._currentBlob=n,this._basePTS=e.dts,this._currentDuration=e.duration;try{VP.log(this.TAG,"_initVideo, basePTS:",e.dts),this._setVideoSrc(n,t),this._video.paused&&this._videoPlay("_initVideo")}catch(kye){console.error(this.TAG,"_initVideo, load error",kye)}}else console.error(this.TAG,"_initVideo","input info is error, blobUrl:",e.blobUrl,"dts:",e.dts)}},{key:"_setVideoSrc",value:function(e,t){try{var n=this._video;n.src=e,n.load(),n.playbackRate=2}catch(kye){console.error(this.TAG,"_setVideoSrc",kye)}}},{key:"_videoPlay",value:function(e){var t=this,n=this._video;if(VP.log(this.TAG,"_videoPlay, video is pause:",n.paused,e),n&&n.paused){var r=n.play();void 0!==r&&r.then((function(){t._playFailed=!1,VP.log(t.TAG,"_videoPlay success")})).catch((function(e){console.error(t.TAG,"_videoPlay failed,",e.message),t._playFailed=!0,t.emit(VG.PLAY_FAILED,t.firstEmit)}))}}},{key:"_removeEvents",value:function(){var e=this._video;e.removeEventListener("playing",this._onPlaying.bind(this)),e.removeEventListener("ended",this._onEnded.bind(this)),e.removeEventListener("error",this._onError.bind(this)),e.removeEventListener("loadeddata",this._onLoadeddata.bind(this)),e.removeEventListener("timeupdate",this._onTimeUpdate.bind(this))}},{key:"_bindEvents",value:function(){var e=this,t=this._video;t?(document.addEventListener("visibilitychange",this._onVisibilityChange.bind(this)),t.addEventListener("playing",this._onPlaying.bind(this)),t.addEventListener("ended",this._onEnded.bind(this)),t.addEventListener("error",this._onError.bind(this)),t.addEventListener("loadeddata",this._onLoadeddata.bind(this)),t.addEventListener("timeupdate",this._onTimeUpdate.bind(this)),t.addEventListener("pause",(function(){VP.log("on pause, currentTime, duration:",e._vCurrentTime,e._vDuration)})),this.on("outputresolutionchange",this._onChange.bind(this)),this.on("fpsreduce",(function(t){e._adaptFrameDuration(t)}))):console.error(this.TAG,"_bindEvents")}},{key:"_onTimeUpdate",value:function(){this._lastCurrentTime=this._vCurrentTime}},{key:"_onVisibilityChange",value:function(){this._isVideoONRun="visible"===document.visibilityState}},{key:"_onChange",value:function(e,t){this._width=e,this._height=t}},{key:"_onPlaying",value:function(){this._IsInDecoding&&(console.warn(this.TAG,"_onPlaying","last video not correct end"),this._framId&&(window.cancelAnimationFrame(this._framId),this._framId=null)),VP.log(this.TAG,"_onPlaying, video duration:",this._vDuration,"currentTime:",this._vCurrentTime,"_lastPts:",this._lastPts),this._isInDecoding=!0,this._lastCurrentTime=this._vCurrentTime,this.ptsArray=[],this.playingTime||(this.playingTime=!0),this._getFrame()}},{key:"_onEnded",value:function(e,t){VP.log(this.TAG,"_onEnded","current fmp4 duration is:",this._vDuration,"_isInDecoding:",this._isInDecoding,"_lastPts:",this._lastPts,"_realFrameDuration:",this._realFrameDuration,"from:",t),this._isInDecoding&&(this._isInDecoding=!1,this._lastMp4Duration=Math.min(this._vDuration,this._vCurrentTime),this._framId&&(VP.log(this.TAG,"_onEnded","cancelAnimationFrame"),window.cancelAnimationFrame(this._framId),this._framId=null),this._decodeFPS=parseInt(this._screenShotNum/(this._vDuration/1e3)),this.emit("fps",this._screenShotNum,this._totleTime,this._vDuration,this._metaFPS,{height:this._currentCanvasHeight,relHeight:this._video.videoHeight}),VP.log("_timePerFrame",this._totleTime/this._screenShotNum),this._timePerFrame=this._totleTime/this._screenShotNum,this._screenShotNum=0,this._allPicNum=0,this._totleTime=0,this._currentBlob&&(URL.revokeObjectURL(this._currentBlob),this._currentBlob=null,this._basePTS=0),this.emit(VG.FRAGMENT_END,this._decodeFPS,this._video.duration))}},{key:"_onError",value:function(){this._isInDecoding=!1;var e=this._video;console.error("video error:",e.error.code,e.error.message),this.emit("error",e.error,this.firstEmit)}},{key:"_onLoadeddata",value:function(){var e=this,t=this._video;t.currentTime=.001,this.firstEmit||(this._playFailed?(t.style.visibility="hidden",this.emit(VG.APPEND_VIDEO,t),setTimeout((function(){VP.log(e.TAG,"onloadeddata, setTimeout firstEmit:",e.firstEmit),e._getFirstFrame()}),40)):(VP.log(this.TAG,"onloadeddata, firstEmit:",this.firstEmit),this._getFirstFrame()))}},{key:"_getFirstFrame",value:function(){this.firstTime=Date.now();var e=this._vCurrentTime,t=this._basePTS+e,n=this._getImageData(t).imageData;this.firstEmit=!0,this.emit(VG.FIRST_FRAME,n,t)}},{key:"_getFrame",value:function(){var e=this._video,t=e.videoWidth,n=e.videoHeight;if(this._allPicNum++,this._isInDecoding){if(t||n){var r=this._vCurrentTime,i=this._basePTS+r;if(this.ptsArray.push(i),this._lastCurrentTime&&this._lastCurrentTime===this._vDuration&&(VP.log(this.TAG,"_getFrame, video ended, lastCurrentTime",this._lastCurrentTime,"duration:",this._vDuration,"isInDecoding:",this._isInDecoding),this._onEnded(null,"getFrame")),this._lastPts&&i<=this._lastPts)return void(this._framId=window.requestAnimationFrame(this._getFrame.bind(this)));if(this._lastPts&&i-this._lastPts<this._realFrameDuration)return void(this._framId=window.requestAnimationFrame(this._getFrame.bind(this)));this._screenShotNum++;var o,a=null,s=Date.now();try{a=(o=this._getImageData(i)).imageData}catch(kye){console.error(kye,o,this._canvasList.length)}this._lastPts=i;var u=Date.now()-s;return this._totleTime+=u,this.emit(VG.DECODED,a,i),void(this._framId=window.requestAnimationFrame(this._getFrame.bind(this)))}this._framId=window.requestAnimationFrame(this._getFrame.bind(this))}else this._framId&&(window.cancelAnimationFrame(this._framId),this._framId=null)}},{key:"_getImageData",value:function(){var e,t=this._video,n=t.videoWidth,r=t.videoHeight,i=n,o=r;this._width&&this._height&&(i=this._width,o=this._height),o>this._maxVideoHeight&&(o=this._maxVideoHeight,i=parseInt(o*(n/r))),(e=this._canvasList.shift())||(console.warn(this.TAG,"_getImageData, _canvansList length is 0"),e=this._createCanvas()),e.width=i,e.height=o;var a=e.dom,s=e.ctx;if(this._currentCanvasHeight=o,!a)return{imageData:e};a.width!==i&&(a.width=i,a.height=o);try{r&&n&&i&&o&&s.drawImage(t,0,0,n,r,0,0,i,o)}catch(kye){console.error(this.TAG,"_getImageData, drawImage:",kye)}return{imageData:e}}},{key:"_adaptFrameDuration",value:function(e){e<15?this._minFPSTime++:this._minFPSTime=0,e>30?this._maxFPSTime++:this._maxFPSTime=0,this._minFPSTime>0&&this._decodeFPS<15&&(this._realFrameDuration-=this._timePerFrame,this._realFrameDuration<15&&(this._realFrameDuration=15),this._minFPSTime=0),this._maxFPSTime>0&&this._decodeFPS>30&&(this._realFrameDuration+=this._timePerFrame,this._maxFPSTime=0)}},{key:"_vDuration",get:function(){return parseInt(1e3*this._video.duration)}},{key:"_vCurrentTime",get:function(){return parseInt(1e3*this._video.currentTime)}},{key:"_reset",value:function(){this._isInDecoding=!1,this._lastPts=0,this._screenShotNum=0,this._allPicNum=0,this._totleTime=0}},{key:"reStartDecode",value:function(){this._video.pause(),this._reset();var e=this._currentBlob,t=this._basePTS;this._framId&&(window.cancelAnimationFrame(this._framId),this._framId=null),this._initVideo({blobUrl:e,dts:t})}},{key:"doSeek",value:function(e){if(this._isInDecoding){if(e<=0)return;var t=this._vCurrentTime/1e3+e>=this._vDuration/1e3?this._vDuration/1e3:this._vCurrentTime/1e3+1;console.error("doSeek",t),this._video.currentTime=t}}},{key:"pause",value:function(){this._isInDecoding&&this._video.pause()}},{key:"play",value:function(){if(this._isInDecoding&&this._video.paused)return VP.log("video play",this._vCurrentTime),this._video.play()}},{key:"startDecode",value:function(e,t,n){this._initVideo(e,n),this._metaFPS=t}},{key:"stopDecode",value:function(){this._video.paused||(this._video.pause(),this._reset())}},{key:"canPlayType",value:function(e){return this._video.canPlayType(e)}},{key:"destroy",value:function(){this._isInDecoding=!1,window.cancelAnimationFrame(this._framId),this._video.pause(),this._removeEvents()}},{key:"videoWidth",get:function(){return this._video?this._video.videoWidth:0}},{key:"videoHeight",get:function(){return this._video?this._video.videoHeight:0}}]),n}(P),qF=[{base:720,level:1},{base:540,level:2},{base:360,level:3},{base:280,level:4}],$F=function(e){gl(n,e);var t=wl(n);function n(e,r){var i;return pl(this,n),(i=t.call(this)).TAG="VideoDecoderController",i._decoder=new QF(e),i._remux=new sX,i._bindEvents(),i._isInit=!1,i._isDataReady=!1,i._ready=!1,i._blobURLList=[],i._isInDecoding=!1,i._mediaSegmentReady=!1,i._parent=r,i._isDecodePause=!1,i._playSuccess=!0,i._isVideoOnRun=!0,i._startDts=0,i._fDuration=0,i._minFPSTime=0,i._lastPts=0,i._frameLengthPerFragment=0,i._gopBufferLength=0,i._maxGopDuration=0,i._minGopDuration=0,i._currentLevel=-1,i._endLevel=e.endLevel||2,i.currentFragmentDuration=0,i._handleKeyFrameVideo=i._handleKeyFrameVideo.bind(_l(i)),i}return yl(n,[{key:"_bindEvents",value:function(){var e=this;document.addEventListener("visibilitychange",this._onVisibilityChange.bind(this)),this._decoder.on(VG.APPEND_VIDEO,this._onAppendVideo.bind(this)),this._decoder.on(VG.PLAY_FAILED,this._onPlayFailed.bind(this)),this._decoder.on("error",this._onError.bind(this)),this._decoder.on(VG.DECODED,this._onDecoded.bind(this)),this._decoder.on(VG.FIRST_FRAME,this._onFirstFrame.bind(this)),this._decoder.on(VG.FRAGMENT_END,this._onFragmentEnd.bind(this)),this._decoder.on("fps",(function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=[e._metaFPS].concat(n,[e._frameLengthPerFragment]);e.emit.apply(e,["fps"].concat(Tl(i)))})),this.on("keyFrame",this._handleKeyFrameVideo)}},{key:"_onRemuxed",value:function(e){var t={blobUrl:this._createBlobURL(e),dts:this.currentFragmentDts,duration:this.currentFragmentDuration,frameDuration:Math.floor(1e3/this._metaFPS)};this._recordGopDuration(this.currentFragmentDuration),this._pushBlob(t),VP.log(this.TAG,"_onRemuxed","maxgopduration:",this._maxGopDuration,"_gopBufferLength:",this._gopBufferLength),!this._isDataReady&&this._gopBufferLength>=this._maxGopDuration&&this._checkDataReady()}},{key:"_onPlayFailed",value:function(e){this._isInDecoding=!1,this._parent.emit(VG.PLAY_FAILED,e)}},{key:"_onAppendVideo",value:function(e){this._parent.emit(VG.APPEND_VIDEO,e)}},{key:"_onVisibilityChange",value:function(){this._isVideoOnRun="visible"===document.visibilityState}},{key:"_onDecoded",value:function(e,t){this._frameLengthPerFragment++;var n=this._buildFrameInfo(e,t);this._parent.emit(VG.DECODED,n),this._lastPts=t}},{key:"_onFirstFrame",value:function(e,t){var n=this._buildFrameInfo(e,t);this._parent.emit(VG.FIRST_FRAME,n)}},{key:"_onFragmentEnd",value:function(e,t){var n=this;VP.log(this.TAG,"_onFragmentEnd ,_isDecodePause:",this._isDecodePause,"decodeFPS:",e),e&&this._reduceResolution(e),this._isInDecoding=!1,this._inDecodeId=-1,this._currentInfo=null,this._frameLengthPerFragment=0,this._getBlobLength()&&!this._isDecodePause?this.startDecode():this.loadNextHandle=setInterval((function(){n._getBlobLength()&&!n._isDecodePause&&n._isVideoOnRun&&!n._isInDecoding&&(VP.log(n.TAG,"_onFragmentEnd, setInterval start next mp4 decode"),n.startDecode(),clearInterval(n.loadNextHandle))}))}},{key:"_onError",value:function(e,t){this._isInDecoding=!1,this._parent.emit("error",e,t)}},{key:"_checkReady",value:function(){this._isDataReady&&this._isInit&&(this.ready=!0,VP.log(this.TAG,"checkReady trigger ready"),this._parent.emit(VG.READY))}},{key:"_checkDataReady",value:function(){this._isDataReady=!0,this._checkReady()}},{key:"_reduceResolution",value:function(e){if(VP.log(this.TAG,"_reduceResolution","currentLevel:",this._currentLevel,"endLevel:",this._endLevel),this._videoHeight>720&&(VP.log(this.TAG,"_reduceResolution","trigger DECODE_LOW_FPS"),this._parent.emit(DG.DECODE_LOW_FPS)),e&&e<20?(this._minFPSTime++,this._decoder.emit("fpsreduce",e)):this._minFPSTime=0,this._currentLevel>=this._endLevel)return VP.log(this.TAG,"_reduceResolution","trigger DECODE_LOW_FPS",this._currentLevel,this._endLevel),void this._parent.emit(DG.DECODE_LOW_FPS);if(this._minFPSTime>2){var t,n=this._videoWidth,r=this._videoHeight;if(t=this._findLevel(r,this._currentLevel)){if(this._currentLevel=t.level,4===this._currentLevel)return VP.log(this.TAG,"_reduceResolution","trigger DECODE_LOW_FPS, _currentLevel: ",this._currentLevel),void this._parent.emit(DG.DECODE_LOW_FPS);this.width=t.base*(n/r),this.height=t.base,this._decoder.emit("outputresolutionchange",this.width,this.height)}this._minFPSTime=0}}},{key:"_findLevel",value:function(e,t){return qF.find((function(n){return n.base<e&&n.level>t}))}},{key:"_buildFrameInfo",value:function(e,t){try{var n=e.width,r=e.height;return{msg:"DECODED",width:n,height:r,buffer:e,yLinesize:n,uvLinesize:n/2,info:{baseDts:void 0,dts:t,gopId:0,isGop:void 0,key:!1,pts:t},type:"rgb"}}catch(kye){VP.log(this.TAG,kye)}}},{key:"_pushBlob",value:function(e){VP.log("push blob",e.dts,e.duration),e&&e.duration&&(this._gopBufferLength+=e.duration),this._blobURLList.push(e)}},{key:"_shiftBlob",value:function(){var e=this._blobURLList.shift();return e&&e.duration&&(this._gopBufferLength-=e.duration),e}},{key:"_filterBlob",value:function(e){var t=this;this._blobURLList=this._blobURLList.filter((function(n){return n.dts<e&&(URL.revokeObjectURL(n.blobUrl),n.duration&&(t._gopBufferLength-=n.duration)),n.dts>=e}))}},{key:"_emptyBlobList",value:function(){this._blobURLList=[],this._gopBufferLength=0}},{key:"_getBlobLength",value:function(){return this._blobURLList.length}},{key:"_handleKeyFrameVideo",value:function(e){try{var t=this._parent._timeRange.frames||[];if(this._parent._timeRange.clean(),!t.length)return;var n=t[0].dts,r=t[t.length-1].dts,i=n-this.endDts;VP.log(this.TAG,"_handleKeyFrameVideo","startDts:",n,"endDts:",r,"samples length:",t.length),this.endDts&&i>Math.floor(1e3/this._metaFPS)+1&&VP.log(this.TAG,"_handleKeyFrame, keyFrame dts:",n,"sample length:",t.length,"endDts:",r,"delay:",i);var o=r-n;if(this._fDuration||(this._fDuration=o),o<1500)return void VP.log(this.TAG,"_handleKeyFrame gopDuration :",o,"sample length:",t.length,"gopStartDts:",n,"gopEndDts:",r);if(this.firstDts||(this.firstDts=t[0].dts),this.currentFragmentDts=t[0].dts,this.currentFragmentDuration=this._getFragmentDuration(t),this.endDts=r,this.currentFragmentDts<this._startDts)return console.warn(this.TAG,"_handleKeyFrameVideo","currentFragmentDts < this._startDts",this.currentFragmentDts,this._startDts),void(t=[]);this.startRemux(t),t=[]}catch(kye){console.error(this.TAG,"_handleKeyFrameVideo",kye)}}},{key:"_getFragmentDuration",value:function(e){var t=0,n=0;return e[0].keyframe||console.error(this.TAG,"_getFragmentDuration","gop firstFrame is not keyframe"),e.forEach((function(r,i){r.keyframe&&i&&(t+=e[i-1].dts-e[n].dts,n=i)})),t+=e[e.length-1].dts-e[n].dts}},{key:"_createBlobURL",value:function(e){if(e){var t=new window.Blob([e.buffer],{type:"video/mp4"});return window.URL.createObjectURL(t)}}},{key:"_recordGopDuration",value:function(e){var t=e;this._minGopDuration||(this._minGopDuration=t),t>this._maxGopDuration&&(this._maxGopDuration=t),t<this._minGopDuration&&(this._minGopDuration=t)}},{key:"checkMaxFrames",value:function(e){"number"==typeof e&&(this._isDecodePause=e>40,this._playSuccess&&this._isDecodePause&&this._decoder.pause())}},{key:"checkMinFrames",value:function(e){var t=this;if("number"==typeof e&&(this._isDecodePause=!(e<25),!this._isDecodePause)){var n=this._decoder.play();void 0!==n?n.then((function(){t._playSuccess=!0})).catch((function(){t._playSuccess=!1})):setTimeout((function(){t._playSuccess=!0}),20)}}},{key:"frameRendend",value:function(e){if(e.dom){if(e.dom.width=0,e.dom.height=0,this._decoder._canvasList.length>40)return;this._decoder._canvasList.push(e)}else VP.error(this.TAG,"_onRendend","imageObj. is error",e)}},{key:"checkValidBlob",value:function(e){this._filterBlob(e)}},{key:"chaseVideoFrame",value:function(e){VP.log(this.TAG,e,e.frame.dts,this.currentFragmentDts);var t=e.frame.dts;if(this._startDts=t,t===this.currentFragmentDts){if(VP.log(this.TAG,"_onChaseFrame","_inDecodeId:",this._inDecodeId,"currentFragmentDts:",this.currentFragmentDts),this._inDecodeId>0&&this._inDecodeId<t)return VP.log(this.TAG,"_onChaseFrame, _inDecodeId > 0 && _inDecodeId < startDts, _inDecodeId:",this._inDecodeId,"startDts:",t),this.stopDecode(),this._filterBlob(t),void this.startDecode();if(this._inDecodeId===t)return VP.log(this.TAG,"_onChaseFrame, _inDecodeId === startDts, startDts:",t),this.stopDecode(),void this.reStrartDecode(this._currentInfo);-1===this._inDecodeId&&(VP.log(this.TAG,"_onChaseFrame","_inDecodeId==-1"),this.startDecode())}t>this.currentFragmentDts&&(VP.log(this.TAG,"_onChaseFrame, startDts > currentFragmentDts, startDts:",t,"currentFragmentDts:",this.currentFragmentDts),this.stopDecode(),this._emptyBlobList()),t<this.currentFragmentDts&&(VP.log(this.TAG,"_onChaseFrame, startDts < currentFragmentDts, startDts:",t,"currentFragmentDts:",this.currentFragmentDts),t>this._inDecodeId&&(this._filterBlob(t),this.stopDecode(),this.startDecode()))}},{key:"init",value:function(e){this._isInit||(this._metaFPS=e.fpsNum/e.fpsDen||25,this._videoWidth=e.width,this._videoHeight=e.height,this._width=this._videoWidth,this._height=this._videoHeight,this._frameDuration=parseInt(1e3/this._metaFPS),this._isInit=!0,VP.log("".concat(this.TAG," has inited")),this._isInit=!0,this._checkReady())}},{key:"reStrartDecode",value:function(e){if(e)try{VP.log(this.TAG,"reStrartDecode"),this._isInDecoding=!0,this._inDecodeId=e.dts,this._currentInfo=e,this._decoder.startDecode(e,this._metaFPS,this._startTime),this._startTime=0}catch(kye){console.error("load error",kye)}}},{key:"stopDecode",value:function(){this._isInDecoding=!1,this._inDecodeId=-1,this._currentInfo=null,this._frameLengthPerFragment=0,this._decoder.stopDecode()}},{key:"startDecode",value:function(){if(this._isInDecoding)VP.log(this.TAG,"startDecode","this decoder is in decoding");else{var e=this._getBlobLength();if(this._decoder&&e){VP.log(this.TAG,"startDecode","blob url length:",e);var t=this._shiftBlob()||{};try{VP.log(this.TAG,"startDecode",t.dts,t.duration),this._isInDecoding=!0,this._inDecodeId=t.dts,this._currentInfo=t,this._decoder.startDecode(t,this._metaFPS)}catch(kye){console.error(this.TAG,"startDecode","load error",kye)}}}}},{key:"canSeek",value:function(e){var t=e.frame.dts;return!!(this.currentFragmentDts>=t&&this._isInDecoding)&&(this._inDecodeId!==t&&this._inDecodeId<t)}},{key:"startRemux",value:function(e){if(VP.log("startRemux samples length:",e.length),e.length){var t=this._parent._meta;t.samples=e;var n=this._remux.remux(t).videoSegment;this._onRemuxed(n)}else console.error("frame length is 0")}},{key:"canPlayType",value:function(e){if(this._decoder)try{return this._decoder.canPlayType('video/mp4;codecs="'+e.codec+'"')}catch(kye){console.error(kye)}}},{key:"destroy",value:function(){this._blobURLList=[],this._decoder.destroy()}},{key:"empty",value:function(){if(VP.log("empty"),this._decoder){var e=this._decoder._canvasList;return VP.log(this.TAG,"empty >>>>>>>>>>>>>>>>>>length:",e.length),e.forEach((function(e){e.dom&&(VP.log("clear >>>>>>>>>>>>>>>>>>"),e.dom.width=0,e.dom.height=0,e.dom=null)})),e.length}}},{key:"isIDLE",get:function(){return VP.log(this.TAG,"isIDEL","blob length:",this._getBlobLength(),"_isInDecoding:",this._isInDecoding,"isVideoOnRun:",this._isVideoOnRun,"_isDecodePause",this._isDecodePause),!this._getBlobLength()&&!this._isInDecoding&&this._isVideoOnRun}},{key:"ready",get:function(){return this._ready},set:function(e){this._ready=e}},{key:"remux",get:function(){return this._remux}},{key:"isInit",get:function(){return this._isInit}}]),n}(P),eY=function(e){gl(n,e);var t=wl(n);function n(e,r){var i;return pl(this,n),(i=t.call(this,e,r)).TAG="VideoRenderFromVideo",i._videoDecodeController=new $F(e,_l(i)),i._canAutoPlay=!0,i._videoDecode=e.videoDecode,i._chaseToFrame=null,i}return yl(n,[{key:"videoDecode",get:function(){return this._videoDecode},set:function(e){this._videoDecode=e}},{key:"_bindEvents",value:function(){var e=this;Sl(bl(n.prototype),"_bindEvents",this).call(this),this.on("keyFrame",this._onKeyFrame.bind(this)),this.on(VG.READY,this._onReady.bind(this)),this.on(VG.DECODED,this._onDecoded.bind(this)),this.on(VG.PLAY_FAILED,this._onPlayFailed.bind(this)),this.on("error",this._onError.bind(this)),this.on(VG.APPEND_VIDEO,this._onAppendVideo.bind(this)),this.on(VG.FIRST_FRAME,this._onFirstFrame.bind(this)),this._parent.on(VG.CHASE_VIDEO_FRAME,this._onChaseVideoFrame.bind(this)),this._parent.on(MG.SYNC_DTS,this._onTimeLineSyncDTS.bind(this)),window.addEventListener("unload",(function(){e._empty()}))}},{key:"_onTimeLineSyncDTS",value:function(e){this._videoDecodeController.checkValidBlob(e)}},{key:"_onChaseVideoFrame",value:function(e){this._doChaseVideoFrame(e)}},{key:"_onAppendVideo",value:function(e){try{this._parent._parent.appendChild(e)}catch(kye){cosole.error(this.TAG,"onAppendVideo",kye)}}},{key:"_onKeyFrame",value:function(){VP.log(this.TAG,"_onKeyFrame, keyframe"),this._videoDecodeController.emit("keyFrame")}},{key:"_onError",value:function(e,t){console.error(this.TAG,"decoder error",e,t),t||this._emitTimelineEvents(MG.PLAY_EVENT,CG.ERROR,this._assembleErr(e&&e.message))}},{key:"_onReady",value:function(){if(!this._frameRender){var e=Object.assign(this._config,{meta:this._meta,canvas:this._canvas,type:"2d"});try{this._frameRender=new jF(e,this)}catch(kye){this._emitTimelineEvents(MG.PLAY_EVENT,CG.ERROR,this._assembleErr(kye&&kye.message))}}this._startDecode()}},{key:"_onFirstFrame",value:function(e){VP.log(this.TAG,"onFirstFrame"),this._receiveFrame(e),this._firstFrame=!0}},{key:"_onDecoded",value:function(e){var t=this;if(this._inChaseFrame){if(this.chaseFrameAfter++,1===this.chaseFrameAfter&&this._chaseToFrame){if(this._parent.emit(VG.CHASE_VIDEO_FRAME_END,this._chaseToFrame),this._frameQueue.length)this._frameQueue.frames.forEach((function(e){t._videoDecodeController.frameRendend(e.buffer)}));this._frameQueue.empty(),this._videoDecodeController.checkMinFrames(this._frameQueue.length),this._timeRange.deletePassed(this._chaseToFrame.frame.dts),this._inChaseFrame=!1,this._chaseToFrame=null,console.warn(this.TAG,"onDecoded","_inChaseFrame end")}}else this.chaseFrameAfter=0;this._receiveFrame(e)}},{key:"_onPlayFailed",value:function(e){console.warn(this.TAG,"onPlayFailed, this._ready:",this._ready,",firstEmit:",e,",frame length:",this._frameQueue.length),this._ready||e||this._whenReady(),this._canAutoPlay=!1}},{key:"canSeek",value:function(e){return this._videoDecodeController.canSeek(e)}},{key:"_initDecoder",value:function(){this._isInit||(VP.log(this.TAG,"_initDecoder"),this._videoDecodeController.isInit||this._videoDecodeController.init(this._meta),this._isInit=!0)}},{key:"_receiveFrame",value:function(e){Sl(bl(n.prototype),"_receiveFrame",this).call(this,e),this._videoDecodeController.checkMaxFrames(this._frameQueue._frames.length)}},{key:"_setMetadata",value:function(e){VP.warn(this.TAG,"video set metadata",e),this._meta=e;var t=e.fpsNum/e.fpsDen;t?VP.log(this.TAG,"detect fps:",t):VP.warn(this.TAG,"no detect fps,start estimate"),this._initDecoder(e)}},{key:"_doChaseVideoFrame",value:function(e){this._inChaseFrame=!0,this._chaseToFrame=e,this._videoDecodeController.chaseVideoFrame(e)}},{key:"_appendChunk",value:function(e){this._meta||this._setMetadata(e);for(var t=e.samples.slice(),n=t.length,r=0;r<n;r++){var i=t.shift();i.keyframe&&this.emit("keyFrame"),this._timeRange.append([i],this.noAudio,!1)}}},{key:"_startDecode",value:function(){this._videoDecodeController.startDecode()}},{key:"_checkToDecode",value:function(){this._startDecode()}},{key:"_startRender",value:function(){VP.log(this.TAG,"_startRender interval",this.interval),this._tickTimer.start(this.interval)}},{key:"_render",value:function(e){var t=this,n=this._frameQueue.nextFrame(),r=this.preciseVideoDts;if(n&&this._timeRange){var i=n.info;if(!i)return this._frameQueue.shift(),void console.error("not info");this._renderDts=i.dts;var o=i.dts-r;if(o<-150){this.lastPrecise;var a=this._frameQueue.frames,s=this._getDeleteFrames(a,r),u=s.deleteFrames,c=s.useFrames;return a.splice(0),c.forEach((function(e){a.push(e)})),u.forEach((function(e){t._videoDecodeController.frameRendend(e.buffer)})),this._videoDecodeController.emit("renderDelay",o,this._frameQueue._frames.length),void this._videoDecodeController.checkMinFrames(this._frameQueue.length)}if(!(!e&&o>30&&o<6e4)){Math.abs(this._lastTimeupdate-i.dts)>250&&(this._emitTimelineEvents(MG.PLAY_EVENT,CG.TIMEUPDATE),this._lastTimeupdate=i.dts),VP.long&&VP.log(this.TAG,"render delay:".concat(o," , timelinePosition:").concat(r," , dts:").concat(i.dts," , cost:").concat(i.cost," , gopID:").concat(i.gopId," , rest:").concat(this._frameQueue.length,", buffer frame:").concat(this._timeRange.frameLength));var l=performance.now();this._frameRender.render(n.buffer,n.width,n.height,n.yLinesize,n.uvLinesize),this.hasFirstFrame||e||(this.hasFirstFrame=!0,this._parent.emit(MG.PLAY_EVENT,"firstframe")),this._videoDecodeController.frameRendend(n.buffer),this._frameQueue.shift(),this._videoDecodeController.checkMinFrames(this._frameQueue.length),this._videoDecodeController.emit("renderDelay",o,this._frameQueue._frames.length),this._renderCost=performance.now()-l,e||(this.lastTime&&(this.lastPrecise,Date.now(),this.lastTime),this.lastFrameinfo=i.dts,this.lastPrecise=r,this.lastTime=Date.now(),this.lastAudioTime=this._parent.audioRender.currentTime)}}else{if(this._videoDecodeController.checkMinFrames(this._frameQueue._frames.length),this._parent._paused)return;if(!this._firstFrame)return void VP.log(this.TAG,"_render","not first frame return");var d=this._videoDecodeController;if(VP.log(this.TAG,",lack frame, _inDecoding:",this._videoDecodeController._isInDecoding,this._videoDecodeController._isDecodePause,",_frameQueue.length:",this._frameQueue.length),!this._frameQueue.length&&d.isIDLE){this._ready=!1;var h=this._parent.audioRender;console.warn(this.TAG,"trigger video waiting vdecode, preciseVideoDts:",r,h.currentTime,h.duration,h.buffered.end(0),h.baseDts),this.emit(DG.VIDEO_WAITING)}this._checkToDecode()}}},{key:"_updateSegmentEnd",value:function(){}},{key:"_destroy",value:function(e){this._empty(),Sl(bl(n.prototype),"destroy",this).call(this,e),this._videoDecodeController.destroy()}},{key:"_doPause",value:function(){VP.log(this.TAG,">>>>>>>>doPause"),this._tickTimer.stop()}},{key:"_getDeleteFrames",value:function(e,t){var n=[],r=[];return e.forEach((function(e){e.info&&e.info.dts>t?r.push(e):e.info&&e.info.dts<=t&&n.push(e)})),{deleteFrames:n,useFrames:r}}},{key:"_empty",value:function(){this._videoDecodeController&&(this._videoDecodeController.empty(),this._frameQueue.frames.forEach((function(e){e.buffer&&e.buffer.dom&&(e.buffer.dom.width=0,e.buffer.dom.height=0,e.buffer.dom=null)})))}}]),n}(zF),tY=function(e){gl(n,e);var t=wl(n);function n(e){var r;return pl(this,n),vl(_l(r=t.call(this)),"_parent",null),vl(_l(r),"_decoderReady",!1),vl(_l(r),"_inDecoding",!1),vl(_l(r),"_toDecodeFirstframe",!0),vl(_l(r),"_id",(new Date).getMilliseconds()),vl(_l(r),"_workerErrorCallback",null),vl(_l(r),"_workerMessageCallback",null),vl(_l(r),"_decoderWorker",null),r._parent=e,r}return yl(n,[{key:"analyse",get:function(){return this._parent.analyse}},{key:"inDecoding",get:function(){return this._inDecoding}},{key:"decoderMode",get:function(){return this._decoderMode}},{key:"decoderReady",get:function(){return this._decoderReady}},{key:"needToDecode",get:function(){return this._inDecoding?0:this._continueDecodeThreshold}},{key:"maxDecodeOnce",get:function(){return this._maxDecodeOnce}},{key:"meta",get:function(){var e;return null===(e=this._parent)||void 0===e?void 0:e._meta},set:function(e){this._parent&&(this._parent._meta=e)}},{key:"init",value:function(e,t){this._workerMessageCallback=e,this._workerErrorCallback=t,this._initWorker()}},{key:"_initWorker",value:function(){throw new Error("need override by children")}},{key:"checkToDecode",value:function(e){this.webcodec?e<=this.needToDecode&&this.doDecode():!this._inDecoding&&e<=this.needToDecode&&this.doDecode()}},{key:"doDecode",value:function(){var e=this,t=this._getFramesToDecode();t&&t.length&&this.meta&&(this._toDecodeFirstframe&&(this._toDecodeFirstframe=!1,this.analyse.addFirstFrameToDecode()),this._avccpushed||this._initDecoderWithConfiguration(this._decoderWorker,this.meta),VP.enable&&VP.log(this.TAG,"doDecode ".concat(t.length," frames")),t.forEach((function(t){e._doDecodeInternal(t)})),this._inDecoding=!0,this._decoderWorker.postMessage({msg:"finish_flag"}))}},{key:"preciseSeek",value:function(e){var t,n,r,i,o=this,a=1e3*e,s=null===(t=this._parent)||void 0===t||null===(n=t._timeRange)||void 0===n?void 0:n.getFramesForPreciseSeek(a),u=s.length;u<this.maxDecodeOnce?this.doDecode():(null===(r=this._parent)||void 0===r||null===(i=r._timeRange)||void 0===i||i.updateFrameIndexForPreciseSeek(u),VP.enable&&VP.log(this.TAG,"doDecode ".concat(s.length," frames for precise seek")),s.forEach((function(e,t){o._doDecodeInternal(e,!0,t>=u-6)})),this._inDecoding=!0,this._decoderWorker.postMessage({msg:"finish_flag"}))}},{key:"_getFramesToDecode",value:function(){var e=this._parent,t=e._timeRange,n=e._decodeEstimate;if(this._decoderReady&&t){var r=t.frameLength;if(r){var i=this._toDecodeFirstframe?rG().maxDecodeOnceFirstTime:this.maxDecodeOnce;1===r&&n.resetDecodeDot(performance.now());for(var o=[];i>0;){var a=t&&t.getFrame();if(!a)break;o.push(a),a.gopId&&a.gopId-1==0&&n.updateGopCount(),i--}return o}}}},{key:"_doDecodeInternal",value:function(e,t,n){null!=e&&e.meta&&(this.meta=e.meta,VP.warn(this.TAG,"detect metadata! flush decoder"),this._initDecoderWithConfiguration(this.__decoderWorker,e.meta));var r={dts:e.dts,pts:e.pts||e.dts+e.cts,keyframe:e.keyframe,gopId:e.gopId,id:this._id};t&&(r.preciseSeek=!0,r.output=n);var i=e.data.slice();this._decoderWorker.postMessage({msg:"decode",data:i,info:r},[i.buffer])}},{key:"_initDecoderWithConfiguration",value:function(){throw new Error("need override by children")}},{key:"flushDecoder",value:function(){this._decoderWorker.postMessage({msg:"flush"})}},{key:"destroy",value:function(){throw new Error("need override by children")}}]),n}(P),nY="IWZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBlPW51bGwsdD1bXSxzPTAsYT0hMTtzZWxmLmFkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLChmdW5jdGlvbihvKXtzd2l0Y2goby5kYXRhLm1zZyl7Y2FzZSJjb25maWd1cmF0aW9uIjplPW5ldyBzZWxmLlZpZGVvRGVjb2Rlcih7b3V0cHV0OmZ1bmN0aW9uKG8pe2E9ITAscyYm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hc2UiZGVjb2RlIjp2YXIgbj1vLmRhdGEuZGF0YSxpPW8uZGF0YS5pbmZvO3QucHVzaChpKTt2YXIgZD1uLmJ5dGVMZW5ndGgtNCxjPW5ldyBEYXRhVmlldyhuZXcgQXJyYXlCdWZmZXIoNCkpO2Muc2V0VWludDMyKDAsZCwhMSksbi5zZXQobmV3IFVpbnQ4QXJyYXkoYy5idWZmZXIpLDApLGkua2V5ZnJhbWUmJmUuZmx1c2goKTt2YXIgcj1uZXcgc2VsZi5FbmNvZGVkVmlkZW9DaHVuayh7dHlwZTppLmtleWZyYW1lPyJrZXkiOiJkZWx0YSIsdGltZXN0YW1wOmkucHRzLGRhdGE6bn0pO2UuZGVjb2RlKHIpO2JyZWFrO2Nhc2UiZGVzdHJveSI6ZSYmKGUuZmx1c2goKSxlLmNsb3NlKCkpLGNsZWFyVGltZW91dChzKTticmVhaztjYXNlImNoZWNrRGVjb2RlIjpzZWxmLnBvc3RNZXNzYWdlKHt0eXBlOiJDSEVDS19UT19ERUNPREUiLGRhdGE6MD09PU1hdGguYWJzKGUuZGVjb2RlUXVldWVTaXplLXQubGVuZ3RoKX0pfX0pKX0oKTsK",rY="undefined"!=typeof window&&window.Blob&&new Blob([atob(nY)],{type:"text/javascript;charset=utf-8"});function iY(){var e=rY&&(window.URL||window.webkitURL).createObjectURL(rY);try{return e?new Worker(e,{}):new Worker("data:application/javascript;base64,"+nY,{type:"module"})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var oY=rG().maxDecodeOnceWebcodec,aY=function(e){gl(n,e);var t=wl(n);function n(){var e;pl(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return vl(_l(e=t.call.apply(t,[this].concat(i))),"TAG","WebCodecController"),vl(_l(e),"_decoderMode",5),vl(_l(e),"_maxDecodeOnce",oY),vl(_l(e),"_continueDecodeThreshold",oY/2),vl(_l(e),"_avccpushed",!1),e}return yl(n,[{key:"webcodec",get:function(){return!0}},{key:"needToDecode",get:function(){return this._inDecoding?(this._checkToDecode(),0):this._continueDecodeThreshold}},{key:"_initWorker",value:function(){var e=this;VP.log(this.TAG,"start init webcodec worker");var t=new iY;t.onMessage=function(t){var n,r;switch(t.data.type){case"DECODER_READY":VP.log(e.TAG,"webcodec worker ready "),e._decoderReady=!0,e._workerMessageCallback({type:"DECODER_READY"});break;case"DECODED":if(e._inDecoding=!0,(null===(n=t.data)||void 0===n||null===(r=n.info)||void 0===r?void 0:r.id)!==e._id)return;e._workerMessageCallback({type:"RECEIVE_FRAME",data:t.data});break;case"BATCH_FINISH_FLAG":if(e._inDecoding=!1,!e._workerMessageCallback)return;e._workerMessageCallback({type:"BATCH_FINISH"});break;case"CHECK_TO_DECODE":e._inDecoding=t.data.data;break;case"FAILED":e._whenError(t.data.message)}},t.onError=function(t){var n,r,i=null===(n=e._parent)||void 0===n||null===(r=n._parent)||void 0===r?void 0:r._parent;i&&i.removeChild(i.querySelector("canvas")),e._whenError(t.message)},t.addEventListener("message",t.onMessage),t.addEventListener("error",t.onError),this._decoderWorker=t,this._initDecoderWithConfiguration(t,this._parent.configuration)}},{key:"_whenError",value:function(e){n.canUse=!1,this._workerErrorCallback(e)}},{key:"_initDecoderWithConfiguration",value:function(e,t){e.postMessage({msg:"configuration",data:{codec:this._parent._meta.codec,codedHeight:this._parent._meta.height,codedWidth:this._parent._meta.width,description:t}}),this._avccpushed=!0}},{key:"_checkToDecode",value:function(){this._decoderWorker.postMessage({msg:"checkDecode"})}},{key:"destroy",value:function(){var e=this._decoderWorker;e.removeEventListener("message",e.onMessage),e.removeEventListener("error",e.onError),e.postMessage({msg:"destroy"}),e.terminate(),this._decoderWorker=null}}],[{key:"isSupported",value:function(){return rG().h264WithWebcodec&&!!window.VideoDecoder&&!1!==n.canUse}}]),n}(tY),sY="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIHNoaW1JbXBvcnRTY3JpcHRzKHNyYyl7cmV0dXJuIGZldGNoKHNyY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1ldGE9dC5tZXRhLGluaXQodC51cmwpO2JyZWFrO2Nhc2UidXBkYXRlbWV0YSI6c2VsZi5tZXRhPXQubWV0YSxkZWNvZGVyLnVwZGF0ZU1ldGEodC5tZXRhKTticmVhaztjYXNlImluaXREZWNvZGVyIjpkZWNvZGVyLmRlY29kZSh0LmRhdGEpO2JyZWFrO2Nhc2UiZGVjb2RlIjpkZWNvZGVyLmRlY29kZSh0LmRhdGEsdC5pbmZvKTticmVhaztjYXNlImZsdXNoIjpkZWNvZGVyLmZsdXNoKCk7YnJlYWs7Y2FzZSJmaW5pc2hfZmxhZyI6c2VsZi5wb3N0TWVzc2FnZSh7bXNnOiJCQVRDSF9GSU5JU0hfRkxBRyJ9KTticmVhaztjYXNlImRlc3RvcnkiOmRlY29kZXIuZGVzdHJveSgpfX1lbHNlIHNlbGYucG9zdE1lc3NhZ2Uoe21zZzoiRVJST1I6aW52YWxpZCBtZXNzYWdlIn0pfX0pKCk7Cg==",uY="undefined"!=typeof window&&window.Blob&&new Blob([atob(sY)],{type:"text/javascript;charset=utf-8"});function cY(){var e=uY&&(window.URL||window.webkitURL).createObjectURL(uY);try{return e?new Worker(e,{}):new Worker("data:application/javascript;base64,"+sY,{type:"module"})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var lY="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIHNoaW1JbXBvcnRTY3JpcHRzKHNyYyl7cmV0dXJuIGZldGNoKHNyYykudGhlbigoZnVuY3Rpb24oZSl7cmV0dXJuIGUudGV4dCgpfSkpLnRoZW4oKGZ1bmN0aW9uKHRleHQpe3NlbGYuZXhwb3J0cz17fSxldmFsKHRleHQpLHNlbGYubT1leHBvcnRzLm19KSl9dmFyIE1BWF9TVFJFQU1fQlVGRkVSX0xFTkdUSD01MjQyODgwLEJBVENIX0RFQ09ERV9TSVpFPTgsaW5pdFRzPTAsRGVjb2Rlcj1mdW5jdGlvbihlKXt0aGlzLmluaXRlZD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Y2goKGZ1bmN0aW9uKGUpe3NlbGYucG9zdE1lc3NhZ2Uoe21zZzoiSU5JVF9GQUlMRUQiLGxvZzplLm1lc3NhZ2V9KX0pKX1zZWxmLm9ubWVzc2FnZT1mdW5jdGlvbihlKXt2YXIgdD1lLmRhdGE7aWYoImluaXQiPT09dC5tc2d8fCJwcmVsb2FkIj09PXQubXNnfHxkZWNvZGVyKXN3aXRjaCh0Lm1zZyl7Y2FzZSJwcmVsb2FkIjppbml0KHQudXJsKSxCQVRDSF9ERUNPREVfU0laRT10LmJhdGNoRGVjb2RlQ291bnQ7YnJlYWs7Y2FzZSJpbml0IjpzZWxmLm1ldGE9dC5tZXRhLEJBVENIX0RFQ09ERV9TSVpFPXQuYmF0Y2hEZWNvZGVDb3VudCxpbml0KHQudXJsKTticmVhaztjYXNlInVwZGF0ZW1ldGEiOnNlbGYubWV0YT10Lm1ldGEsZGVjb2Rlci51cGRhdGVNZXRhKHQubWV0YSk7YnJlYWs7Y2FzZSJpbml0RGVjb2RlciI6ZGVjb2Rlci5mcmFtZUxlbnNPZmZzZXQmJmRlY29kZXIuYmF0Y2hEZWNvZGUoITApLGRlY29kZXIuZmx1c2goKSxkZWNvZGVyLmRlY29kZSh0LmRhdGEpO2JyZWFrO2Nhc2UiZGVjb2RlIjpkZWNvZGVyLnN0b3JlQnVmZmVyKHQuZGF0YSx0LmluZm8pO2JyZWFrO2Nhc2UiZmx1c2giOmRlY29kZXIuZmx1c2goKTticmVhaztjYXNlImZpbmlzaF9mbGFnIjpzZWxmLnBvc3RNZXNzYWdlKHttc2c6IkJBVENIX0ZJTklTSF9GTEFHIn0pO2JyZWFrO2Nhc2UiZGVzdG9yeSI6ZGVjb2Rlci5kZXN0cm95KCl9fX0pKCk7Cg==",dY="undefined"!=typeof window&&window.Blob&&new Blob([atob(lY)],{type:"text/javascript;charset=utf-8"});function hY(){var e=dY&&(window.URL||window.webkitURL).createObjectURL(dY);try{return e?new Worker(e,{}):new Worker("data:application/javascript;base64,"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ZXIuZGVzdHJveSgpfX19KSgpOwo=",pY="undefined"!=typeof window&&window.Blob&&new Blob([atob(fY)],{type:"text/javascript;charset=utf-8"});function mY(){var e=pY&&(window.URL||window.webkitURL).createObjectURL(pY);try{return e?new Worker(e,{}):new Worker("data:application/javascript;base64,"+fY,{type:"module"})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var yY=new(function(){function e(){pl(this,e),vl(this,"_queue",[]),vl(this,"_pendingDecoder",null),vl(this,"TAG","DecoderCache")}return yl(e,[{key:"genDecoder",value:function(e){return this._initDecoder(e)}},{key:"_initDecoder",value:function(e){var t=this,n=rG(),r=n.preloadDecoder,i=n.maxDecodeOnceWasm;e=e||r;var o,a,s=iG(),u=s.H264_DECODER_URL,c=s.H265_SIMD_DECODER_URL,l=s.H265_DECODER_URL,d=s.H265_THREAD_DECODER_URL,h=1;if("h265"===e&&(oG()?(o=new cY,a=c,h=2):aG()&&rG().canUseThreadMode?(o=new hY,a=d,h=1):(o=new cY,a=l,h=3)),"h264"===e&&(o=new mY,a=u,h=3),!o)return Promise.resolve();var f,p,m,y=((m=new Promise((function(e,t){f=e,p=t}))).resolve=f,m.reject=p,m);o.postMessage({msg:"preload",batchDecodeCount:i,url:a}),this._pendingDecoder=o,o.id=Date.now()+parseInt(1e3*Math.random()),o.isHevc="h265"===e,o.using=!1,o.ready=!1,VP.log(this.TAG,"start init decoder worker, id=",o.id,"hevc=",o.isHevc,"mode=",h);var v=function e(n){t._pendingDecoder=null;var r=n.data.msg;switch("DECODER_READY"!==r&&"INIT_FAILED"!==r||(o.removeEventListener("message",e),o.removeEventListener("error",g)),r){case"DECODER_READY":VP.log(t.TAG,"decoder worker inited!, id=",o.id,"cost:",n.data.cost),o.ready=!0,o.using||t._queue.push(o),y.resolve();break;case"INIT_FAILED":VP.log(t.TAG,"decoder worker init failed!",n.data.log),y.reject(n.data.log)}},g=function e(t){o.removeEventListener("message",v),o.removeEventListener("error",e),y.reject(null==t?void 0:t.message)};return o.addEventListener("message",v),o.addEventListener("error",g),y}},{key:"cacheDecoder",value:function(e){e.using=!1,e.ready=!0,e.id||(e.id=Date.now()+parseInt(1e3*Math.random())),this._queue.push(e),VP.log(this.TAG,"cache decoder, id=",e.id),"h265"===rG().preloadDecoder&&1===this._queue.filter((function(e){return!e.using&&e.isHevc})).length&&this.genDecoder("h265")}},{key:"getCachedDecoder",value:function(e){var t,n=this._queue.findIndex((function(t){return!t.using&&t.isHevc===e}));if(-1!==n&&(t=this._queue.splice(n,1)[0]),!t&&this._pendingDecoder&&(t=this._pendingDecoder,this._pendingDecoder=null),t)return t.using=!0,VP.warn(this.TAG,"get cached decoder, id=".concat(t.id,", ready=").concat(t.ready)),t}}]),e}()),vY=rG().maxDecodeOnceWasm,gY=function(e){gl(n,e);var t=wl(n);function n(){var e;pl(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return vl(_l(e=t.call.apply(t,[this].concat(i))),"TAG","WasmController"),vl(_l(e),"_avccpushed",!1),vl(_l(e),"_maxDecodeOnce",vY),vl(_l(e),"_continueDecodeThreshold",vY/2),vl(_l(e),"_wasmInitCost",0),vl(_l(e),"_threadSupported",aG()&&rG().canUseThreadMode),vl(_l(e),"_simdSuppported",oG()),vl(_l(e),"_decoderMode",window.WebAssembly?3:4),e}return yl(n,[{key:"wasmInitCost",get:function(){var e;return null===(e=this._decoderWorker)||void 0===e?void 0:e._wasmInitCost}},{key:"isHevc",get:function(){var e;return null===(e=this._parent)||void 0===e?void 0:e.isHevc}},{key:"_selectDecodeWorker",value:function(){this.analyse.addWasmInit();var e,t=iG(),n=t.H264_DECODER_URL,r=t.H265_DECODER_URL,i=t.H265_THREAD_DECODER_URL,o=t.H265_SIMD_DECODER_URL,a=t.ASM_H264_DECODER_URL,s=t.ASM_H265_DECODER_URL;return VP.log(this.TAG,"start init wasm worker:",performance.now(),"hevc:",this.isHevc,"decoderMode:",this._decoderMode),this.isHevc?(e=1===this._decoderMode?i:2===this._decoderMode?o:3===this._decoderMode?r:s)?{decoder:1===this._decoderMode?new hY:new cY,url:e}:void this._workerErrorCallback("no found decoder url, decodeMode:".concat(this._decoderMode)):(e=4===this._decoderMode?a:n)?{decoder:new mY,url:e}:void this._workerErrorCallback("no found decoder url, decodeMode:".concat(this._decoderMode))}},{key:"_initWorker",value:function(){this.isHevc&&(this._threadSupported&&(this._decoderMode=1),this._simdSuppported&&(this._decoderMode=2)),this._initDecodeWorkerInternal()}},{key:"_initDecodeWorkerInternal",value:function(){var e=yY.getCachedDecoder(this.isHevc);if(e)return VP.warn(this.TAG,"select decoder from cache"),this.analyse.addWasmInit(),this._avccpushed=!1,this._bindWorkerEvent(e),this._decoderWorker=e,void(e.ready&&(this._decoderReady=!0,this._initDecoderWithConfiguration(e,this.meta),this._workerMessageCallback({type:"DECODER_READY",data:e}),VP.log(this.TAG,"decoder ready!")));var t=this._selectDecodeWorker()||{},n=t.decoder,r=t.url;n&&(this._avccpushed=!1,this._bindWorkerEvent(n),n.isHevc=this.isHevc,n.postMessage({msg:"init",meta:this.meta,batchDecodeCount:vY,url:r}),this._decoderWorker=n)}},{key:"_bindWorkerEvent",value:function(e){var t=this,n=function(n,r){VP.log(t.TAG,"worker failed: ",n,r),t._terminateWorker(e),t._decoderWorker=null,!1===rG().wasmFallbackToAsm||4===t._decoderMode?t._workerErrorCallback(n):(t._decoderMode=1===t._decoderMode||2===t._decoderMode?3:4,t._initDecodeWorkerInternal())};e._onMessage=function(r){var i,o;switch(r.data.msg){case"DECODER_READY":if(VP.log(t.TAG,"wasm worker ready!","cost:",r.data.cost),t._decoderReady=!0,e._wasmInitCost=parseInt(r.data.cost),!t.meta)return;t._avccpushed||t._initDecoderWithConfiguration(e,t.meta),t.emit(DG.VIDEO_DECODER_INIT,e),t._workerMessageCallback({type:"DECODER_READY",data:e});break;case"DECODED":if(t._inDecoding=!0,(null===(i=r.data)||void 0===i||null===(o=i.info)||void 0===o?void 0:o.id)!==t._id)return;t._workerMessageCallback({type:"RECEIVE_FRAME",data:r.data});break;case"BATCH_FINISH_FLAG":if(t._inDecoding=!1,!t._workerMessageCallback)return;t._workerMessageCallback({type:"BATCH_FINISH"});break;case"INIT_FAILED":n(r.data.log,1)}},e._onError=function(e){n(e.message,2)},e.addEventListener("message",e._onMessage),e.addEventListener("error",e._onError)}},{key:"_initDecoderWithConfiguration",value:function(e,t){VP.log(this.TAG,"init decoder with configuration"),this._avccpushed=!0,e.postMessage({msg:"updatemeta",meta:t});var n=[t.rawVps||t.vps[0],t.rawSps||t.sps[0],t.rawPps||t.pps[0]].filter(Boolean),r=n.reduce((function(e,t){return e+(t.byteLength+4)}),0),i=new Uint8Array(r),o=0;n.forEach((function(e){i.set([0,0,0,1],o),o+=4,i.set(e,o),o+=e.byteLength})),e.postMessage({msg:"initDecoder",data:i})}},{key:"destroy",value:function(){if(this._decoderWorker)return rG().reuseWasmDecoder?(this._offWorkerBind(this._decoderWorker),void yY.cacheDecoder(this._decoderWorker)):void this._terminateWorker(this._decoderWorker)}},{key:"_offWorkerBind",value:function(e){e.removeEventListener("message",e._onMessage),e.removeEventListener("error",e._onError),e.postMessage({msg:"flush"}),e._onMessage=null,e._onError=null,VP.log(this.TAG,"flush decoder and unbind worker event")}},{key:"_terminateWorker",value:function(e){this._offWorkerBind(e),e.postMessage({msg:"destroy"}),e.terminate(),VP.log(this.TAG,"destroy decoder worker")}}]),n}(tY),bY=function(e){gl(n,e);var t=wl(n);function n(){var e;pl(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return vl(_l(e=t.call.apply(t,[this].concat(i))),"TAG","VideoRenderWithDecoder"),vl(_l(e),"_hideRenderFlag",0),vl(_l(e),"_recentMeta",null),vl(_l(e),"_inChaseFrame",!1),vl(_l(e),"_decoderErrorCallback",(function(t){e._emitTimelineEvents(MG.PLAY_EVENT,CG.ERROR,e._assembleErr(t,1))})),vl(_l(e),"_decoderMessageCallback",(function(t){var n,r,i,o=t.type,a=t.data;switch(o){case"DECODER_READY":if(e.analyse.addWasmReady(),!e._frameRender){var s=Object.assign(e._config,{meta:e._meta,canvas:e._canvas,type:e._decodeController.webcodec?"2d":""});try{e._canvas.glInstance?(e._frameRender=e._canvas.glInstance,e._frameRender.updateBind(_l(e),e._meta),VP.warn(e.TAG,"reuse canvas and context")):(e._frameRender=new jF(s,_l(e)),VP.log(e.TAG,"create frameRender with config",s))}catch(kye){e._emitTimelineEvents(MG.PLAY_EVENT,CG.ERROR,e._assembleErr(kye&&kye.message,2))}}e._startDecode();break;case"RECEIVE_FRAME":if(e._inChaseFrame&&(null===(n=e._decodeController)||void 0===n||!n.webcodec))return;e._receiveFrame(a);break;case"BATCH_FINISH":null===(r=_l(e))||void 0===r||r._decodeEstimate.resetDecodeDot(),e._inChaseFrame&&(e._inChaseFrame=!1,e._frameQueue.empty()),e._ready||e.inSeeking||null===(i=e._decodeController)||void 0===i||!i.decoderReady||e._startDecode()}})),e}return yl(n,[{key:"wasmInitCost",get:function(){var e;return null===(e=this._decodeController)||void 0===e?void 0:e.wasmInitCost}},{key:"hevcThread",get:function(){return 1===this.decodeMode}},{key:"lowlatency",get:function(){return this._parent.lowlatency}},{key:"nextFrameTime",get:function(){var e=this._frameQueue.nextFrame();return(e&&e.info&&e.info.dts||0)/1e3}},{key:"ajustSeekTime",value:function(e,t){var n;VP.log(this.TAG,"ajust seek time: ",e),this._frameQueue.empty(),null===(n=this._decodeController)||void 0===n||n.flushDecoder(),this._switchVideoBuffer(e,t)}},{key:"canSeek",value:function(){return!0}},{key:"_appendChunk",value:function(e){var t;if(!this.noVideo&&this._timeRange){if(this._meta){if(this._recentMeta.width!==e.width||this._recentMeta.height!==e.height){VP.warn(this.TAG,"metadata changed! width: ".concat(this._recentMeta.width," -> ").concat(e.width,", height: ").concat(this._recentMeta.height," -> ").concat(e.height));var n=e.samples[0];n&&(this._recentMeta=n.meta=Object.assign({},e,{samples:null}))}}else{this._emitTimelineEvents(MG.PLAY_EVENT,CG.LOADEDMETADATA),this._recentMeta=this._meta=Object.assign({},e,{samples:null}),VP.warn(this.TAG,"video set metadata",this._meta,"configuration:",this.configuration);var r=e.fpsNum/e.fpsDen;r?VP.log(this.TAG,"detect fps:",r):VP.warn(this.TAG,"no detect fps,start estimate"),this._selectDecoder(),this._initDecoder()}if(this._timeRange.append(e.samples,this._isLive&&this.noAudio,!this.videoDecode),e.samples=[],!this.inSeeking){var i;if(this.isLive||this._timeRange.frameLength||this._switchVideoBuffer(this._parent.currentTime),!this._ready&&null!==(t=this._decodeController)&&void 0!==t&&t.decoderReady)!this.noAudio&&null!==(i=this._decodeController)&&void 0!==i&&i.inDecoding||this._startDecode();this.noAudio&&this._emitTimelineEvents(MG.PLAY_EVENT,CG.DURATION_CHANGE)}}}},{key:"_selectDecoder",value:function(){if(!this.isHevc&&aY.isSupported())return this._decodeController=new aY(this),void(this._decodeEstimate.webcodec=!0);this._decodeController=new gY(this)}},{key:"_initDecoder",value:function(){var e;null===(e=this._decodeController)||void 0===e||e.init(this._decoderMessageCallback,this._decoderErrorCallback)}},{key:"_startDecode",value:function(){var e;null===(e=this._decodeController)||void 0===e||e.doDecode()}},{key:"_switchVideoBuffer",value:function(e,t){var n=this._timeRange.switchBuffer(e);if(n){var r;if(this.noAudio&&this._parent.emit(MG.SYNC_DTS,this.getDtsOfTime(n.start)),t)return void(null===(r=this._decodeController)||void 0===r||r.preciseSeek(e));this._startDecode(t)}}},{key:"_checkToDecode",value:function(){var e;this.inSeeking||null===(e=this._decodeController)||void 0===e||e.checkToDecode(this._frameQueue.length)}},{key:"_render",value:function(e){var t;if(!this.noVideo){var n=this._frameQueue&&this._frameQueue.nextFrame();if(n){var r=n.info;if(!r)return this._frameQueue.shift(),void console.error("not info");this._renderDts=r.dts;var i=r.dts-this.preciseVideoDts;if(!(!e&&i>0&&i<6e4)){this._frameQueue.shift(this.preciseVideoDts),Math.abs(this._lastTimeupdate-r.dts)>250&&(this._emitTimelineEvents(MG.PLAY_EVENT,CG.TIMEUPDATE,{pts:r.originPts/90}),this._lastTimeupdate=r.dts),VP.long&&VP.log(this.TAG,"render delay:".concat(i," , timelinePosition:").concat(this.preciseVideoDts," , dts:").concat(r.dts," , cost:").concat(r.cost," , gopID:").concat(r.gopId," , rest:").concat(this._frameQueue.length,", buffer frame:").concat(this._timeRange.frameLength));var o=performance.now();this._hideRenderFlag++,("visible"===document.visibilityState||this._hideRenderFlag%15)&&this._frameRender.render(n.buffer,n.width,n.height,n.yLinesize,n.uvLinesize),null!==(t=this._decodeController)&&void 0!==t&&t.webcodec&&n.buffer.close(),this._renderCost=performance.now()-o,this._checkToDecode()}}else{var a;if(VP.log(this.TAG,"lack frame, ","inDecoding:",null===(a=this._decodeController)||void 0===a?void 0:a.inDecoding),this._checkToDecode(),this.noAudio){var s;if(!this.isLive&&Math.abs(this.currentTime-this.duration)<.5)return null==this||this._emitTimelineEvents(MG.PLAY_EVENT,CG.TIMEUPDATE),null==this||this._emitTimelineEvents(MG.PLAY_EVENT,CG.ENDED),void(null===(s=this._timeRange)||void 0===s||s.clean());this._timeRange.frameLength||(this._ready=!1,this.emit(DG.VIDEO_WAITING))}}}}},{key:"_updateSegmentEnd",value:function(e){var t;null===(t=this._timeRange)||void 0===t||t.updateSegmentEnd(e)}},{key:"_doChaseFrame",value:function(e){var t=e.frame;this._inChaseFrame=!0,this._timeRange.deletePassed(t.dts),this._frameQueue.empty(),this.noAudio&&this._parent.emit(MG.SYNC_DTS,t.dts)}},{key:"_destroy",value:function(e){var t;VP.log(this.TAG,"destroy video render"),Sl(bl(n.prototype),"destroy",this).call(this,e),null===(t=this._decodeController)||void 0===t||t.destroy(),this._decodeController=null}}]),n}(zF),AY=.1,_Y=function(e){gl(n,e);var t=wl(n);function n(e,r){var i;return pl(this,n),(i=t.call(this)).TAG="TimeLine",i._parent=r,i._seeking=!1,i.audioRender=NF.isSupported()?new NF(e,_l(i)):new hD(e,_l(i)),i.videoRender=new bY(e,_l(i)),i._readyStatus={audio:!1,video:!1},i._paused=!0,i._switchToMultiWorker=!1,i._lowdecodeEmited=!1,i._startPlayed=!1,i._emitReady=!1,i._lastSeekTime=1e-4,i._singleTrack=-1,i._bindEvent(),i._decodeVideo=e.video,i}return yl(n,[{key:"analyse",get:function(){return this._parent.analyse}},{key:"ready",get:function(){return this._readyStatus.video&&this._readyStatus.audio}},{key:"played",get:function(){var e=this;return{length:this.currentTime?1:0,start:function(){return 0},end:function(){return e.currentTime}}}},{key:"noAudio",get:function(){return 1===this._singleTrack||2===this._singleTrack}},{key:"isLive",get:function(){return this._parent.live}},{key:"seeking",get:function(){return this._seeking}},{key:"decodeFps",get:function(){return this.videoRender.decodeFps}},{key:"decodeCost",get:function(){return this.videoRender.decodeCost}},{key:"renderCost",get:function(){return this.videoRender.renderCost}},{key:"wasmInitCost",get:function(){return this.videoRender.wasmInitCost}},{key:"fps",get:function(){return this.videoRender.fps}},{key:"totalSize",get:function(){return this.videoRender.totalSize}},{key:"bitrate",get:function(){return this.videoRender.bitrate}},{key:"gopLength",get:function(){return this.videoRender.gopLength}},{key:"currentTime",get:function(){return this.noAudio?this.paused?this.videoRender.nextFrameTime:this.videoRender.currentTime:this.audioRender.currentTime}},{key:"timelinePosition",get:function(){return this.noAudio?performance.now()/1e3:this.audioRender.currentTime}},{key:"canvas",get:function(){return this.videoRender.canvas}},{key:"readyState",get:function(){return this.videoRender.readyState}},{key:"buffered",get:function(){var e=this;return this.noAudio?this.videoRender.buffered:this.isLive?this.audioRender.buffered:{length:this.audioRender.buffered.length,start:function(t){return Math.max(e.audioRender.buffered.start(t),e.videoRender.buffered.start(t))},end:function(t){return Math.min(e.audioRender.buffered.end(t),e.videoRender.buffered.end(t))}}}},{key:"duration",get:function(){return this.noAudio?this.videoRender.duration:this.isLive?this.audioRender.duration:Math.min(this.audioRender.duration,this.videoRender.duration)}},{key:"paused",get:function(){return this._paused},set:function(e){this._paused=e}},{key:"lowlatency",get:function(){return this._parent.lowlatency}},{key:"decoderMode",get:function(){return this.videoRender.decoderMode}},{key:"currentAudioCanAutoplay",get:function(){return this.audioRender.audioCanAutoplay}},{key:"_getController",value:function(e,t){return e?new eY(t,this):new bY(t,this)}},{key:"_checkInBuffer",value:function(){for(var e=this.buffered,t=0,n=e.length;t<n;t++)if(e.start(t)<=this.currentTime+AY&&e.end(t)>=this.currentTime)return!0;return!1}},{key:"_resetReadyStatus",value:function(){this._readyStatus.audio=!1,this._readyStatus.video=!1}},{key:"_bindEvent",value:function(){var e=this;this.on(VG.REMUX,(function(t){e.videoRender.setRemux(t)})),this.on(VG.CHASE_VIDEO_FRAME_END,(function(t){e.emit(VG.CHASE_AUDIO_FRAME,t)})),this.audioRender.on(GG.AUDIO_READY,(function(){VP.log(e.TAG,"audio ready! seeking=",e._seeking),e._seeking&&setTimeout((function(){try{var t=e.videoRender.getSeekStartPosition(e.currentTime,1/0);if(e.audioRender.isMse&&t)return rG().preciseSeek>e.duration&&e.currentTime>AY?(e.audioRender.seekNoSideEffect({position:e.currentTime+AY}),void e.videoRender.ajustSeekTime(e.currentTime,!0)):(e.audioRender.seekNoSideEffect({position:t.position+AY}),void e.videoRender.ajustSeekTime(t.position));e.videoRender.ajustSeekTime(e.currentTime)}catch(kye){}}),10),e._readyStatus.video&&e._startRender(),e._readyStatus.audio=!0,e._startPlayed||e.analyse.addAudioReady()})),this.audioRender.on(GG.AUDIO_NOT_ALLOWED_AUTOPLAY,(function(){e._emitReady&&e.pause()})),this.audioRender.on(GG.AUDIO_WAITING,(function(){!e.noAudio&&e.currentTime&&(VP.warn(e.TAG,"lack data, audio waiting,currentTime:",e.currentTime),e.emit(MG.PLAY_EVENT,CG.TIMEUPDATE),e.emit(MG.PLAY_EVENT,CG.WAITING),e.emit(MG.DO_PAUSE),e._readyStatus.audio=!1)})),this.videoRender.on(DG.VIDEO_WAITING,(function(){VP.warn(e.TAG,"lack data, video waiting"),e.emit(MG.PLAY_EVENT,CG.WAITING),e.emit(MG.DO_PAUSE),e._readyStatus.video=!1})),this.videoRender.on(DG.VIDEO_READY,(function(){VP.log(e.TAG,"video ready!"),e._startPlayed||e.analyse.addVideoReady(),e._readyStatus.audio&&e._startRender("video"),e._readyStatus.video=!0})),this.videoRender.on(DG.DECODE_LOW_FPS,(function(){e.currentTime<2||(e.analyse.increaseLowDecodeCount(),e._lowdecodeEmited||(dG++,e._lowdecodeEmited=!0),e.emit(MG.PLAY_EVENT,CG.LOW_DECODE))})),this.on(MG.SINGLE_TRACK,(function(t){e._singleTrack=t,1!==t&&2!==t||(e._readyStatus.audio=!0),3===t&&(e._readyStatus.video=!0),e.emit(MG.SYNC_DTS,0)})),this.on(MG.DESTROY,(function(){e.removeAllListeners(),e.videoRender=null,e.audioRender=null})),this.on(MG.DO_PLAY,(function(){e.emit(MG.START_RENDER),e._paused=!1,e._lastSeekTime=1e-4,e.noAudio&&e.emit(MG.SYNC_DTS,0)}))}},{key:"_startRender",value:function(e){if(!this._parent.error&&this.videoRender){if(this.noAudio&&this.emit(MG.SYNC_DTS,0),this.videoRender.forceRender(),!this.isLive&&this._paused&&this.seeking&&this._checkInBuffer())return VP.log(this.TAG,"set seeking = false"),this._seeking=!1,this.emit(MG.PLAY_EVENT,CG.SEEKED),void VP.groupEnd();this._startPlayed||(this.analyse.addFirstframe(),this.emit(MG.PLAY_EVENT,CG.LOADEDDATA),this.emit(MG.PLAY_EVENT,CG.FIRST_FRAME),this._startPlayed=!0),VP.log(this.TAG,"emit canplay"),this.emit(MG.PLAY_EVENT,CG.CANPLAY),this._parent.autoplay?(VP.warn(this.TAG,"startRender: time=",this.currentTime,"paused:",this.paused,"seeking:",this.seeking),this.emit(MG.START_RENDER,e)):(this._parent.autoplay=!0,this.emit(MG.PLAY_EVENT,CG.PAUSE)),this.emit(MG.READY),this._emitReady=!0,this._seeking&&this._checkInBuffer()&&(VP.log(this.TAG,"set seeking = false"),this._seeking=!1,this.emit(MG.PLAY_EVENT,CG.SEEKED),VP.groupEnd())}}},{key:"_checkHlsTracks",value:function(e){if(!(null==e?void 0:e.samples[0])){if(!this.buffered.length){var t=new Error("lack video sample");t.code=3,this.emit(MG.PLAY_EVENT,CG.ERROR,t)}return!1}return!0}},{key:"appendBuffer",value:function(e,t){this.emit(MG.APPEND_CHUNKS,e,t),this.noAudio&&this._seeking&&this.videoRender.ajustSeekTime(this.currentTime)}},{key:"play",value:function(){var e=this;return new Promise((function(t,n){var r=e.currentAudioCanAutoplay;e.noAudio?r=!0:e.audioRender&&e.audioRender.resume().then((function(){if(VP.log(e.TAG,"audio render resumed, pause status: ".concat(e._paused,", audioCanAutoplay:").concat(e.currentAudioCanAutoplay)),e._paused||!e.currentAudioCanAutoplay)return r=!1,void e.emit(MG.DO_PAUSE);r=!0})).catch((function(){})),setTimeout((function(){return VP.log(e.TAG,"play() timer done, resumed=".concat(r,", paused=").concat(e.paused)),r?e.videoRender&&!e.videoRender.canAutoPlay?(console.warn("video render an't autoplay"),e.pause(),void t()):(e._paused=!1,void t()):e.paused?void 0:(VP.log(e.TAG,"audioCtx can't autoplay"),e.pause(),void n({name:"NotAllowedError"}))}),e.audioRender.isMse?10:60)}))}},{key:"pause",value:function(){this._paused||!this.ready&&!this._seeking||(this.emit(MG.DO_PAUSE),this._paused=!0,this.emit(MG.PLAY_EVENT,CG.PAUSE))}},{key:"seek",value:function(e){var t=this;if(this._seeking&&VP.groupEnd(),this.isLive){if(this.currentTime<AY||!this.currentAudioCanAutoplay||this.paused)return;var n=this.videoRender.getSeekStartPosition(e,this._parent.preloadTime+1);if(n){if(n.position<this.currentTime)return;var r=this.audioRender.canSeek(n.position),i=this.videoRender.canSeek(n);if(!r||!i)return void VP.log(this.TAG,"seek, !!!!!!!!!can not seek, audioCanSeek:",r,"videoCanSeek:",i);VP.warn(this.TAG,"seek, chase frame to time: ",n.position,"currentTime:",this.currentTime,"duration:",this.duration),this.videoRender.videoDecode?(this.audioRender.doPause(),n.position=n.position-1.5,this.emit(VG.CHASE_VIDEO_FRAME,n)):this.emit(MG.CHASE_FRAME,n)}}else this._lastSeekTime!==e&&(e&&Math.abs(this._lastSeekTime-e)<=.2||(this._lastSeekTime=e,e>=this.duration&&(e=this.duration-1),e<0&&(e=0),VP.group(this.TAG,"start seek to:".concat(e,", set seeking status=true")),this._seeking=!0,this.videoRender.setSeekingStatus(!0),this.noAudio?(this.emit(MG.SYNC_DTS,this.videoRender.getDtsOfTime(e)),this.videoRender.ajustSeekTime(e)):this._resetReadyStatus(),this.emit(MG.DO_SEEK,e),new Promise((function(e){t.emit(MG.PLAY_EVENT,CG.SEEKING),e()}))))}}]),n}(P),wY=Nd,SY=Hl,kY=fv,TY=Rm,xY=SY(km.f),EY=SY([].push),LY=function(e){return function(t){for(var n,r=TY(t),i=kY(r),o=i.length,a=0,s=[];o>a;)n=i[a++],wY&&!xY(r,n)||EY(s,e?[n,r[n]]:r[n]);return s}},IY={entries:LY(!0),values:LY(!1)},RY=IY.entries;Py({target:"Object",stat:!0},{entries:function(e){return RY(e)}});var ZY=Py,CY=Hl,PY=Ip,GY=Zk,DY=_V,MY=Nl,VY=RangeError,XY=String,WY=Math.floor,OY=CY(DY),NY=CY("".slice),UY=CY(1..toFixed),FY=function(e,t,n){return 0===t?n:t%2==1?FY(e,t-1,n*e):FY(e*e,t/2,n)},YY=function(e,t,n){for(var r=-1,i=n;++r<6;)i+=t*e[r],e[r]=i%1e7,i=WY(i/1e7)},KY=function(e,t){for(var n=6,r=0;--n>=0;)r+=e[n],e[n]=WY(r/t),r=r%t*1e7},jY=function(e){for(var t=6,n="";--t>=0;)if(""!==n||0===t||0!==e[t]){var r=XY(e[t]);n=""===n?r:n+OY("0",7-r.length)+r}return n};ZY({target:"Number",proto:!0,forced:MY((function(){return"0.000"!==UY(8e-5,3)||"1"!==UY(.9,0)||"1.25"!==UY(1.255,2)||"1000000000000000128"!==UY(0xde0b6b3a7640080,0)}))||!MY((function(){UY({})}))},{toFixed:function(e){var t,n,r,i,o=GY(this),a=PY(e),s=[0,0,0,0,0,0],u="",c="0";if(a<0||a>20)throw VY("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return XY(o);if(o<0&&(u="-",o=-o),o>1e-21)if(n=(t=function(e){for(var t=0,n=e;n>=4096;)t+=12,n/=4096;for(;n>=2;)t+=1,n/=2;return t}(o*FY(2,69,1))-69)<0?o*FY(2,-t,1):o/FY(2,t,1),n*=4503599627370496,(t=52-t)>0){for(YY(s,0,n),r=a;r>=7;)YY(s,1e7,0),r-=7;for(YY(s,FY(10,r,1),0),r=t-1;r>=23;)KY(s,1<<23),r-=23;KY(s,1<<r),YY(s,1,1),KY(s,2),c=jY(s)}else YY(s,0,n),YY(s,1<<-t,0),c=jY(s)+OY("0",a);return c=a>0?u+((i=c.length)<=a?"0."+OY("0",a-i)+c:NY(c,0,i-a)+"."+NY(c,i-a)):u+c}});var HY={FIRST_DATA:1,AUDIO_MSE_OPEN_START:2,AUDIO_MSE_OPEND:3,AUDIO_FIRSTTIME_APPENDED:4,AUDIO_READY:5,WASM_WORKER_INIT:6,WASM_WORKER_READY:7,FIRST_FRAME_TODECODE:8,VIDEO_READY:9,FIRST_FRAME:10,WAITIGN:11,SEEKING:12,SEEKED:13},BY=Object.entries(HY),JY=function(){function e(){pl(this,e),vl(this,"_dot",[]),vl(this,"_currentLowDecodeCount",0)}return yl(e,[{key:"getBootStats",value:function(){var e,t=(null===(e=this._dot[0])||void 0===e?void 0:e.dot)||0;return this._dot.map((function(e){return{action:BY.filter((function(t){return t[1]===e.action}))[0][1],dot:parseInt(e.dot-t)}}))}},{key:"getStats",value:function(e){var t,n=this.getBootStats();return{bootStats:n,bitrate:Math.abs(e.bitrate/1e3),decodeFps:e.decodeFps,fps:e.fps,playbackRate:e.playbackRate,firstframe:null===(t=n.filter((function(e){return 10===e.action}))[0])||void 0===t?void 0:t.dot,width:e.videoWidth,height:e.videoHeight,decoderMode:e.decoderMode,vv:lG,lowdecodeVV:dG,h265FailureRate:Number((100*hG).toFixed(2)),currentLowDecodeCount:this._currentLowDecodeCount}}},{key:"seekElapses",value:function(){for(var e=this.getBootStats(),t=[],n=0,r=0,i=e.length;r<i;r++){var o=e[r];o.action===HY.SEEKING&&(n=o.dot),o.action===HY.SEEKED&&t.push(o.dot-n)}return t}},{key:"addFirstData",value:function(){this._dot.push({action:HY.FIRST_DATA,dot:this._getTimestap()})}},{key:"addAudioBoundMedia",value:function(){this._dot.push({action:HY.AUDIO_BOUND_MEDIA,dot:this._getTimestap()})}},{key:"addAudioMseOpenStart",value:function(){this._dot.push({action:HY.AUDIO_MSE_OPEN_START,dot:this._getTimestap()})}},{key:"addAudioMseOpend",value:function(){this._dot.push({action:HY.AUDIO_MSE_OPEND,dot:this._getTimestap()})}},{key:"addAudioFirstTimeAppended",value:function(){this._dot.push({action:HY.AUDIO_FIRSTTIME_APPENDED,dot:this._getTimestap()})}},{key:"addAudioReady",value:function(){this._dot.push({action:HY.AUDIO_READY,dot:this._getTimestap()})}},{key:"addWasmInit",value:function(){this._dot.push({action:HY.WASM_WORKER_INIT,dot:this._getTimestap()})}},{key:"addWasmReady",value:function(){this._dot.push({action:HY.WASM_WORKER_READY,dot:this._getTimestap()})}},{key:"addFirstFrameToDecode",value:function(){this._dot.push({action:HY.FIRST_FRAME_TODECODE,dot:this._getTimestap()})}},{key:"addVideoReady",value:function(){this._dot.push({action:HY.VIDEO_READY,dot:this._getTimestap()})}},{key:"addFirstframe",value:function(){this._dot.push({action:HY.FIRST_FRAME,dot:this._getTimestap()})}},{key:"addWaiting",value:function(){this._dot.push({action:HY.WAITIGN,dot:this._getTimestap()})}},{key:"addSeeking",value:function(){this._dot.push({action:HY.SEEKING,dot:this._getTimestap()})}},{key:"addSeeked",value:function(){this._dot.push({action:HY.SEEKED,dot:this._getTimestap()})}},{key:"_getTimestap",value:function(){return performance.now()}},{key:"increaseLowDecodeCount",value:function(){this._currentLowDecodeCount++}},{key:"reset",value:function(){this._currentLowDecodeCount=0,this._dot=[]}}]),e}(),zY=1,QY=2,qY=3,$Y=function(e){gl(n,e);var t=wl(n);function n(){var e,r,i,o,a,s;return pl(this,n),(e=t.call(this)).TAG="XGVideo",e._proxyProps(),e._isLive=!0,e._vMeta=null,e._aMeta=null,e._resizeObserver=null,e._eventsBackup=[],e._hevc="h265"===rG().preloadDecoder,e._hevc||(e._degradeVideo=document.createElement("video")),e._debounceSeek=(r=e._seek.bind(_l(e)),i=300,o=Date.now(),a=null,s=!0,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var u=Date.now();s&&(o=Date.now(),s=!1,r.apply(void 0,t)),u-o>i?(o=u,r.apply(void 0,t)):(a&&window.clearTimeout(a),a=setTimeout((function(){r.apply(void 0,t)}),i))}),e._onTouchEnd=e._onTouchEnd.bind(_l(e)),e.analyse=new JY,e}return yl(n,[{key:"_proxyProps",value:function(){var e=this;Object.getOwnPropertyNames(n.prototype).forEach((function(t){if(/^__/.test(t)){var n=t.replace("__","");Object.defineProperty(e,n,{get:function(){try{return this[t]}catch(kye){}return 0},set:function(e){try{this[t]=e}catch(kye){}}})}}))}},{key:"addEventListener",value:function(e,t,r){Sl(bl(n.prototype),"addEventListener",this).call(this,e,t,r),this._degradeVideo&&this._eventsBackup.push([e,t,r])}},{key:"removeEventListener",value:function(e,t,r){Sl(bl(n.prototype),"removeEventListener",this).call(this,e,t,r),this._degradeVideo&&(this._eventsBackup=this._eventsBackup.filter((function(n){return!(n.eventName===e&&n.handler===t&&n.capture===r)})))}},{key:"setAttribute",value:function(e,t){var r;Sl(bl(n.prototype),"setAttribute",this).call(this,e,t),"src"!==e&&(null===(r=this._degradeVideo)||void 0===r||r.setAttribute(e,t))}},{key:"_init",value:function(){this.analyse.reset(),this.timeline=new _Y({volume:this.volume,canvas:this.querySelector("canvas"),videoContext:this.videoContext,videoDecode:this.videoDecode,maxVideoHeight:this.getAttribute("maxVideoHeight"),endLevel:parseInt(this.getAttribute("endLevel"))},this),VP.log(this.TAG,"timeline init"),this._noSleep=new NT,this._logFirstFrame=!1,this._playRequest=null,this._degradeVideoUserGestured=!1,this._bindEvents(),this._vMeta&&!this.videoDecode&&this.setVideoMeta(this._vMeta),this._glCtxOptions&&(this.glCtxOptions=this._glCtxOptions),this.timeline&&(this.innerDegrade&&this.timeline.emit(MG.INNER_DEGRADE),this.timeline.emit(MG.SET_PLAY_MODE,this._isLive?"LIVE":"VOD"),this.timeline.emit(MG.SET_PLAYBACKRATE,this.playbackRate),this.muted=this.muted)}},{key:"_bindEvents",value:function(){var e=this;this.timeline.on(MG.PLAY_EVENT,(function(t,n){var r;t===CG.LOADEDDATA&&(e.querySelector("canvas")||(VP.log(e.TAG,"_bindEvents, appendChild canvas"),e.appendChild(e.canvas)),e.canvas.style.display="block",null===(r=e.timeline)||void 0===r||r.emit(MG.SET_PLAYBACKRATE,e.playbackRate));if(t!==CG.LOADEDMETADATA&&t!==CG.RESIZE||Promise.resolve().then((function(){e.updateVideoPostion()})),t===CG.ERROR){if(VP.warn(e.TAG,"detect error:",null==n?void 0:n.message),e.pause(),e._disabled(!0),e.innerDegrade||5===e.decoderMode)return e.degradeInfo={decodeFps:e.decodeFps,bitrate:e.bitrate,wasmInitCost:e.wasmInitCost,fps:e.fps,url:e.src,msg:null==n?void 0:n.message,decoderMode:e.decoderMode},void e._innerDispatchEvent("lowdecode");e._err=n}if(t===CG.LOW_DECODE)return e._disabled(),e.degradeInfo={decodeFps:e.decodeFps,bitrate:e.bitrate,wasmInitCost:e.wasmInitCost,fps:e.fps,url:e.src,decoderMode:e.decoderMode},void e._innerDispatchEvent(PG[t],e.degradeInfo);if(t===CG.LARGE_AV_GAP&&(e.unsyncInfo=n),t===CG.ENDED){if(e.paused)return;e.pause()}t===CG.PROGRESS&&e._noSleep.toPlay(),t===CG.WAITING&&e.analyse.addWaiting(),t===CG.SEEKING&&e.analyse.addSeeking(),t===CG.SEEKED&&e.analyse.addSeeked(),e._innerDispatchEvent(PG[t],n)}))}},{key:"_disabled",value:function(e){(this.innerDegrade||e)&&(e?rG().disabledWhenErrorOccur&&pG(1):rG().evaluateVVCount||(this.decodeFps/this.fps<=.6&&this.bitrate<2e6?pG(1):pG(2)))}},{key:"degrade",value:function(e){var t=this;!!this.querySelector("canvas")?this.replaceChild(this._degradeVideo,this.canvas):this.appendChild(this._degradeVideo),this.destroy(),this._eventsBackup.forEach((function(e){var r,i=kl(e,3),o=i[0],a=i[1],s=i[2];Sl(bl(n.prototype),"removeEventListener",t).call(t,o,a,s),null===(r=t._degradeVideo)||void 0===r||r.addEventListener(o,a,s)})),this._eventsBackup=[],e&&(this._degradeVideo.muted=!1,this._degradeVideo.src=e,this._degradeVideo.load())}},{key:"disconnectedCallback",value:function(){VP.log(this.TAG,"video disconnected"),document.removeEventListener("touchend",this._onTouchEnd,!0),this.destroy(!0),this._resizeObserver&&this._resizeObserver.disconnect(this)}},{key:"connectedCallback",value:function(){var e=this;VP.log(this.TAG,"video connected to document",performance.now()),this.timeline||this._init(),this.style.width="100%",this.style.height="100%",this.style.position="absolute",this.style.left="0px",this.style.top="0px",document.addEventListener("touchend",this._onTouchEnd,!0),ResizeObserver&&(this._resizeObserver=new ResizeObserver((function(t){var n;null!==(n=e.timeline)&&void 0!==n&&n.ready&&e.updateVideoPostion()})),this._resizeObserver.observe(this))}},{key:"_onTouchEnd",value:function(){FT(),this._degradeVideoInteract(),this._noSleep&&this._noSleep.enable()}},{key:"_degradeVideoInteract",value:function(){var e=this;if(this._degradeVideo&&(1===this.innerDegrade||3===this.innerDegrade)){if(this._degradeVideoUserGestured)return;var t=this._degradeVideo.play();t&&t.then((function(){e._degradeVideo.pause(),e._degradeVideoUserGestured=!0})).catch((function(e){console.log("degrade video: ",e.message)}))}}},{key:"play",value:function(e){var t=this;if(this.timeline){VP.log(this.TAG,"play() called, ready:".concat(this.timeline.ready,", paused:").concat(this.timeline.paused,", force:").concat(e)),this._degradeVideoInteract();var n=0;if(this.timeline.ready&&this.timeline.paused||e){if(e=e||this._isLive,this._playRequest=null,!e)return this.timeline.emit(MG.DO_PLAY),this._innerDispatchEvent("play"),Promise.resolve();this.destroy(),this._init(),n=setTimeout((function(){try{t._innerDispatchEvent("waiting")}catch(kye){}}),300)}return this._playRequest||!this.timeline.ready||this.timeline.paused?(VP.log(this.TAG,"request play!"),this._playRequest=this._playRequest||new Promise((function(e,r){t.timeline._paused=!1,t._innerDispatchEvent("play"),t._noSleep.enable(),t.timeline.once("ready",(function(){VP.log(t.TAG,"timeline emit ready"),clearTimeout(n),t.timeline.play().then(e).catch(r).finally((function(){t._playRequest=null}))}))})),this.autoplay=!0,this._playRequest):Promise.resolve()}}},{key:"pause",value:function(){this._playRequest=null,this.timeline&&this.timeline.pause();try{this._noSleep.disable(),(e=XT||(XT=document.querySelector("#hackAudioPP")))&&e.pause()}catch(kye){}var e}},{key:"load",value:function(){}},{key:"appendBuffer",value:function(e,t){if(this.timeline&&!this._err){if(!this._logFirstFrame){var n=e&&e.samples[0],r=t&&t.samples[0];if(!n&&!r)return;if(n||r){var i=(null==e?void 0:e.duration)/((null==e?void 0:e.formatTimescale)||1/0),o=(null==t?void 0:t.duration)/((null==t?void 0:t.formatTimescale)||1/0);VP.warn(this.TAG,"video firstDts:".concat(n&&n.dts," , audio firstDts:").concat(r&&r.dts," videoTrack.duration=").concat(i,", audioTrack.duration=").concat(o)),this._logFirstFrame=!0,(i||o)&&(this.setPlayMode("VOD"),this.timeline.emit(MG.SET_PLAY_MODE,this._isLive?"LIVE":"VOD"),this.duration=Math.min(i||o,o||i)),this.analyse.addFirstData()}this.lowlatency&&(VP.warn(this.TAG,"single track! type=",zY),this.timeline.emit(MG.SINGLE_TRACK,zY)),t.exist()||(VP.warn(this.TAG,"single track! type=",QY),this.timeline.emit(MG.SINGLE_TRACK,QY)),e.exist()||(VP.warn(this.TAG,"single track! type=",qY),this.timeline.emit(MG.SINGLE_TRACK,qY))}e.formatTimescale&&e.samples.forEach((function(t){t.dts=Math.floor(t.dts/e.formatTimescale*1e3),t.pts=Math.floor(t.pts/e.formatTimescale*1e3)})),t.formatTimescale&&t.samples.forEach((function(e){e.dts=Math.floor(e.dts/t.formatTimescale*1e3),e.pts=Math.floor(e.pts/t.formatTimescale*1e3)})),this.timeline.appendBuffer(e,t)}}},{key:"setAudioMeta",value:function(e){this._aMeta=e,this.timeline.emit(MG.SET_METADATA,"audio",e)}},{key:"setVideoMeta",value:function(e){!this._isLive&&this._vMeta||(this.timeline.emit(MG.SET_METADATA,"video",e),this._vMeta=e)}},{key:"setDecodeMode",value:function(e){this.setAttribute("decodeMode",e)}},{key:"setPlayMode",value:function(e){this._isLive="LIVE"===e}},{key:"endOfStream",value:function(){var e;this.currentTime&&(null===(e=this.timeline)||void 0===e||e.emit(MG.END_OF_STREAM))}},{key:"updateVideoPostion",value:function(){var e;null===(e=this.timeline)||void 0===e||e.emit(DG.UPDATE_VIDEO_FILLTYPE,this.xgfillType,this.containerLayout)}},{key:"_innerDispatchEvent",value:function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))}},{key:"destroy",value:function(e){this.timeline&&(this._noSleep.destroy(),VP.log(this.TAG,"call destroy"),this.timeline.emit(MG.DESTROY,e),this.querySelector("video")&&this.removeChild(this.querySelector("video")),this.timeline=null,this._err=null,this._noSleep=null,this._eventsBackup=null)}},{key:"updateObjectPosition",value:function(e,t){this.timeline.emit(DG.UPDATE_VIDEO_COVER_POSITION,this.containerLayout,e,t),this._degradeVideo&&(this._degradeVideo.style.objectPosition="".concat(100*e,"% ").concat(100*t,"%"))}},{key:"setVideoDecode",value:function(){VP.log(this.TAG,"set videoDecode",this.videoDecode),this.videoDecode&&this.timeline&&this.timeline.videoRender&&(this.timeline.videoRender.videoDecode=this.videoDecode)}},{key:"live",get:function(){return this._isLive}},{key:"lowlatency",get:function(){return"true"===this.getAttribute("lowlatency")},set:function(e){this.setAttribute("lowlatency",e)}},{key:"autoplay",get:function(){return"true"===this.getAttribute("autoplay")},set:function(e){this.setAttribute("autoplay",e)}},{key:"__canvas",get:function(){return this.timeline.canvas}},{key:"__ended",get:function(){return Math.abs(this.currentTime-this.duration)<.5}},{key:"__width",get:function(){return this.getAttribute("width")||this.videoWidth},set:function(e){var t="number"==typeof e?"".concat(e,"px"):e;this.setAttribute("width",t),this.canvas.width=e}},{key:"__height",get:function(){return this.getAttribute("height")},set:function(e){var t="number"==typeof e?"".concat(e,"px"):e;this.setAttribute("height",t),this.canvas.height=e}},{key:"__videoWidth",get:function(){return this.canvas.width}},{key:"__videoHeight",get:function(){return this.canvas.height}},{key:"__volume",get:function(){return Number(this.getAttribute("volume"))},set:function(e){e<=0&&(e=0),e>=1&&(e=1),this.setAttribute("volume",e),this.muted||this.timeline.emit(MG.UPDATE_VOLUME,e)}},{key:"__muted",get:function(){return"true"===this.getAttribute("muted")},set:function(e){this.setAttribute("muted",e),this._degradeVideoInteract(),this._noSleep.enable(),this.timeline.emit(MG.UPDATE_VOLUME,e?0:this.volume)}},{key:"__currentTime",get:function(){if(!this.timeline)return 0;var e=this.timeline.currentTime,t=this.timeline.duration;return Math.min(e,t)},set:function(e){this._debounceSeek(e)}},{key:"_seek",value:function(e){this.timeline&&(this.buffered.length||this.play(),this.paused&&!this._isLive&&0===e&&this.play(),this.timeline.seek(Number(e)))}},{key:"__duration",get:function(){return this._isLive?1/0:this.timeline.duration},set:function(e){this.timeline.emit(MG.SET_VIDEO_DURATION,e),this._innerDispatchEvent("durationchange")}},{key:"__seeking",get:function(){return this.timeline.seeking}},{key:"__paused",get:function(){return this.timeline.paused}},{key:"__fps",get:function(){return this.timeline.fps}},{key:"__decodeFps",get:function(){return this.timeline.decodeFps}},{key:"__decodeCost",get:function(){return parseInt(this.timeline.decodeCost)}},{key:"__renderCost",get:function(){return this.timeline.renderCost}},{key:"__wasmInitCost",get:function(){return this.timeline.wasmInitCost}},{key:"__totalSize",get:function(){return this.timeline.totalSize}},{key:"__bitrate",get:function(){return this.timeline.bitrate}},{key:"__gopLength",get:function(){return this.timeline.gopLength}},{key:"__readyState",get:function(){return this.timeline.readyState}},{key:"__buffered",get:function(){return this.timeline.buffered}},{key:"__decoderMode",get:function(){return this.timeline.decoderMode}},{key:"src",get:function(){return this.getAttribute("src")||""},set:function(e){VP.log(this.TAG,"set src ",e),this.setAttribute("src",e),this._vMeta=null,this.play(!0),this.timeline||this._init(),this._innerDispatchEvent("loadstart"),lG++}},{key:"currentSrc",get:function(){return this.getAttribute("src")||""}},{key:"playbackRate",get:function(){return parseFloat(this.getAttribute("playbackrate")||1)},set:function(e){var t;this.setAttribute("playbackrate",e),null===(t=this.timeline)||void 0===t||t.emit(MG.SET_PLAYBACKRATE,e)}},{key:"networkState",get:function(){return 1}},{key:"preloadTime",get:function(){var e=this.getAttribute("preloadtime");if(e){var t=Number.parseFloat(e);if(t>0&&!Number.isNaN(t))return t}return 1/0},set:function(e){e&&Number(e)>0&&this.setAttribute("preloadtime",e)}},{key:"innerDegrade",get:function(){var e=this.getAttribute("innerdegrade");return parseInt(e)}},{key:"__glCtxOptions",set:function(e){this._glCtxOptions=e,this.timeline.emit(MG.UPDATE_GL_OPTIONS,e)}},{key:"__error",get:function(){return this._err},set:function(e){this.timeline.emit(MG.PLAY_EVENT,CG.ERROR,e)}},{key:"degradeVideo",get:function(){return this._degradeVideo}},{key:"degradeInfo",get:function(){return this._deradeInfo},set:function(e){this._deradeInfo=e}},{key:"unsyncInfo",get:function(){return this._unsyncInfo},set:function(e){this._unsyncInfo=e}},{key:"xgfillType",get:function(){return this.parentNode.getAttribute("data-xgfill")}},{key:"containerLayout",get:function(){var e=this.parentNode;return{width:e.clientWidth,height:e.clientHeight}}},{key:"videoDecode",get:function(){return"7"===this.getAttribute("decodeMode")}},{key:"audioMedia",get:function(){var e,t;return null===(e=this.timeline)||void 0===e||null===(t=e.audioRender)||void 0===t?void 0:t.media}},{key:"getStats",value:function(){return this.analyse.getStats(this)}},{key:"getSeekElapses",value:function(){return this.analyse.seekElapses()}},{key:"dump",value:function(){var e=this.buffered;return console.log(e),new Array(e.length).fill(0).map((function(t,n){return[e.start(n),e.end(n)]}))}}],[{key:"version",get:function(){return"0.1.16"}},{key:"init",value:function(e){var t=e.h264Url,r=e.h264AsmUrl,i=e.h265AsmUrl,o=e.h265Url,a=e.h265ThreadUrl,s=e.h265SimdUrl;n.h264Url=t,n.h265Url=o,n.h265AsmUrl=i,n.h264AsmUrl=r,n.h265ThreadUrl=a,n.h265SimdUrl=s}},{key:"getDecodeCapacity",value:function(){return rG()}},{key:"getDeviceCapacity",value:function(){return{simd:eG,thread:aG(),nbCpu:navigator.hardwareConcurrency}}},{key:"setDecodeCapacity",value:function(e){var t;t=e,tG=Object.assign({},tG,t),e.preloadDecoder&&yY.genDecoder().catch((function(){}))}},{key:"genDecoder",value:function(e){return yY.genDecoder(e)}},{key:"cleanDisabled",value:function(){yG()}},{key:"isSupported",value:function(){return!!function(){if("undefined"==typeof customElements)return!1;if(sG)return!0;var e=!1,t=!1;try{var n=new(window.AudioContext||window.webkitAudioContext);n.close(),n=null,e=!0}catch(kye){}try{for(var r=document.createElement("canvas"),i=["webgl","experimental-webgl","moz-webgl","webkit-3d"],o=0;o<i.length;o++){var a=r.getContext(i[o]);if(a){a=null,r=null,t=!0;break}}sG=e&&t&&!!WebAssembly,localStorage.setItem("_sds",sG?1:0)}catch(kye){}return sG}()&&!1===mG()}}]),n}("undefined"!=typeof HTMLElement?HTMLElement:function(){});vl($Y,"decoderCache",yY);$Y.init({h264Url:"https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/decoder/1.1.1/h264/decoder.js",h264AsmUrl:"https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/decoder/1.1.1/h264/decoder_asm.js",h265Url:"https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/codec/base/decoder.js",h265SimdUrl:"https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/codec/high/decoder_1656041798666.js",h265ThreadUrl:"https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/codec/main/decoder.js",h265AsmUrl:"https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/codec/high/decoder_asm.js"}),$Y.setEleName=function(e){!function(e){$P=e}(e);var t=function(e){gl(n,e);var t=wl(n);function n(){return pl(this,n),t.apply(this,arguments)}return yl(n)}($Y);customElements.get(nG())||customElements.define(nG(),t)};try{customElements.get(nG())||customElements.define(nG(),$Y)}catch(kye){}const eK=t.DynamicModule.PluginXgvideo;var tK=Object.freeze({__proto__:null,XGVideoPlugin:$Y,__PLUGIN_NAME__:eK}),nK=(e=>(e.widevine="com.widevine.alpha",e.fairplay="com.apple.fps.1_0",e.playready="com.microsoft.playready",e))(nK||{});class rK extends ne{constructor(e){super(e),this.unsupported=!1,this.unRecord=!0,this.needKeyed=!1,this.onNeedKey=e=>{if(this.needKeyed)return;if(this.unsupported)return;this.needKeyed=!0,e.target;let t=e.initData;const n=e.initDataType,r=this.extractContentId(t);if(this.keySystem===nK.fairplay&&!this.certificate)return this.suspend=()=>{this.afterInitDate(t,r,n)};this.afterInitDate(t,r,n)},this.licenseRequestReady=e=>{if(!this.serverProcessSPCPath)return void this.emitError("lack serverProcessSPCPath");const t=e.message,n=new XMLHttpRequest;n.responseType="arraybuffer",n.addEventListener("load",this.licenseRequestLoaded,!1),n.addEventListener("error",this.licenseRequestFailed(e),!1);var r=new Uint8Array(t);n.open("POST",this.serverProcessSPCPath,!0),this.keySystem===nK.playready?n.setRequestHeader("Content-type","text/xml"):n.setRequestHeader("Content-type","application/octet-stream"),n.send(r)},this.licenseRequestLoaded=e=>{const t=e.target.response;let n;n=this.keySystem===nK.playready?this.parseServerResponse(t):new Uint8Array(t),n?this.keySession.update(n):this.emitError(`The license response no array buffer, licence: ${n}`)},this.licenseRequestFailed=e=>t=>{if(this.licenseRetryTime>0)this.licenseRequestReady(e),this.licenseRetryTime--;else{const e=t.target;this.emitError(`The license request fail, status: ${e.status}, statusText: ${e.statusText}`)}},this.onKeyError=()=>{this.emitError("A decryption key error was encountered")},this.loadCertificate=()=>{if(!this.serverCertificatePath)return void this.emitError("lack serverCertificatePath");const e=new XMLHttpRequest;e.responseType="arraybuffer",e.addEventListener("load",this.onCertificateLoaded,!1),e.addEventListener("error",this.onCertificateError,!1),e.open("GET",this.serverCertificatePath,!0),e.send()},this.emitError=e=>{this.emit("error",{errorCode:7100,message:e,drm_sdk_version:"0.0.0-alpha.5"})},this.onCertificateLoaded=e=>{const t=e.target;this.certificate=new Uint8Array(t.response),this.suspend&&this.suspend()},this.onCertificateError=e=>{if(this.certRetryTime>0)this.loadCertificate(),this.certRetryTime--;else{const t=e.target;this.emitError(`get cert fail, status: ${t.status}, statusText: ${t.statusText}`)}},this.restart=()=>{this.reset()},this.reset();const t=e.config||{};this.serverCertificatePath=t.serverCertificatePath,this.serverProcessSPCPath=t.serverProcessSPCPath,"boolean"==typeof t.unRecord&&(this.unRecord=t.unRecord),this.checkUnrecord()}static get pluginName(){return"drm"}set serverCertificatePath(e){e&&this._serverCertificatePath!==e&&(this._serverCertificatePath=e,this.keySystem===nK.fairplay&&(this.certificate=void 0,this.suspend=()=>{},this.loadCertificate()))}get serverCertificatePath(){return this._serverCertificatePath}afterCreate(){this.media=this.player.video,this.media.addEventListener("webkitneedkey",this.onNeedKey,!1),this.media.addEventListener("needkey",this.onNeedKey,!1),this.media.addEventListener("encrypted",this.onNeedKey),this.player.on("urlchange",this.restart)}async checkUnrecord(){if(this.unRecord)try{const{powerEfficient:e}=await navigator.mediaCapabilities.decodingInfo({type:"file",video:{contentType:'video/mp4; codecs="avc1.42c01e"',width:426,height:238,bitrate:1e3,framerate:30}});this.unsupported=!e}catch(Sye){this.emitError(`check powerEfficient failed, ${Sye.message}`),this.unsupported=!0}this.unsupported||function(){const e=[{initDataTypes:["keyids","webm"],audioCapabilities:[{contentType:'audio/mp4; codecs="mp4a.40.2"'}],videoCapabilities:[{contentType:'video/mp4; codecs="avc1.42c01e"'},{contentType:'video/mp4; codecs="hev1.1.6.L120.90"'},{contentType:'video/webm; codecs="vp8"'}]}];return new Promise(((t,n)=>{navigator.requestMediaKeySystemAccess(nK.fairplay,e).then((e=>{t({access:e,system:nK.fairplay})})).catch((()=>{globalThis.WebKitMediaKeys&&globalThis.WebKitMediaKeys.isTypeSupported(nK.fairplay,"video/mp4")?t({access:null,system:nK.fairplay}):navigator.requestMediaKeySystemAccess(nK.widevine,e).then((e=>{t({access:e,system:nK.widevine})})).catch((()=>{navigator.requestMediaKeySystemAccess(nK.playready,e).then((e=>{t({access:e,system:nK.playready})})).catch(n)}))}))}))}().then((({access:e,system:t})=>{this.keySystem=t,t===nK.fairplay&&this.loadCertificate(),e&&(this.keySystemAccess=e)})).catch((e=>{this.emitError(e.message),this.unsupported=!0}))}afterInitDate(e,t,n){if(this.keySystemAccess)this.keySystemAccess.createMediaKeys().then((t=>{if(this.media.setMediaKeys(t),this.media.mediaKeys)return void this.emitError("Could not create MediaKeys");const r=t.createSession();this.keySession=r,r?(r.addEventListener("message",this.licenseRequestReady),r.generateRequest(n,e).catch((e=>{this.emitError(`generateRequest failed, code: ${e.errorCode}, message: ${e.message}`)}))):this.emitError("Could not create key session")})).catch((()=>{throw"Could not create MediaKeys"}));else{const n=new globalThis.WebKitMediaKeys(this.keySystem);if(this.media.webkitSetMediaKeys(n),!this.media.webkitKeys)return void this.emitError("Could not create MediaKeys");const r=n.createSession("video/mp4",this.concatInitDataIdAndCertificate(e,t));if(this.keySession=r,!r)return void this.emitError("Could not create key session");r.addEventListener("webkitkeymessage",this.licenseRequestReady),r.addEventListener("webkitkeyerror",this.onKeyError)}}parseServerResponse(e){const t="http://schemas.xmlsoap.org/soap/envelope/";if(DOMParser){const n=this.uintToString(e),r=(new DOMParser).parseFromString(n,"text/xml"),i=r?r.getElementsByTagNameNS(t,"Envelope")[0]:null,o=i?i.getElementsByTagNameNS(t,"Body")[0]:null;if(o?o.getElementsByTagNameNS(t,"Fault")[0]:null)return null}return e}uintToString(e){const t=String.fromCharCode.apply(null,new Uint8Array(e));return decodeURIComponent(escape(t))}extractContentId(e){const t=(n=new Uint16Array(e.buffer),String.fromCharCode.apply(null,n));var n,r=document.createElement("a");return r.href=t,r.hostname}concatInitDataIdAndCertificate(e,t){"string"==typeof t&&(t=function(e){for(var t=new ArrayBuffer(2*e.length),n=new Uint16Array(t),r=0,i=e.length;r<i;r++)n[r]=e.charCodeAt(r);return n}(t));let n,r=0;const i=this.certificate;n=i?new ArrayBuffer(e.byteLength+4+t.byteLength+4+i.byteLength):new ArrayBuffer(e.byteLength+4+t.byteLength);var o=new DataView(n);new Uint8Array(n,r,e.byteLength).set(e),r+=e.byteLength,o.setUint32(r,t.byteLength,!0),r+=4;var a=new Uint16Array(n,r,t.length);(a.set(t),r+=a.byteLength,i)&&(o.setUint32(r,i.byteLength,!0),r+=4,new Uint8Array(n,r,i.byteLength).set(i));return new Uint8Array(n,0,n.byteLength)}reset(){this.certRetryTime=2,this.licenseRetryTime=2,this.suspend=void 0,this.keySession=void 0,this.needKeyed=!1}destroy(){this.player.off("urlchange",this.restart)}}const iK=t.DynamicModule.PluginDrm;var oK=Object.freeze({__proto__:null,DrmPlugin:class extends rK{updateDrmConfig(e){e.serverProcessSPCPath&&(this.serverProcessSPCPath=e.serverProcessSPCPath),e.serverCertificatePath&&(this.serverCertificatePath=e.serverCertificatePath)}},__PLUGIN_NAME__:iK});function aK(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 sK(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?aK(Object(n),!0).forEach((function(t){mK(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aK(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function uK(){uK=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(L){u=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var o=t&&t.prototype instanceof h?t:h,a=Object.create(o.prototype),s=new T(i||[]);return r(a,"_invoke",{value:_(e,n,s)}),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(L){return{type:"throw",arg:L}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,o)&&(m=v);var g=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,t){function i(r,o,a,s){var u=l(e[r],e,o);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(d).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=w(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,d;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function S(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function x(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(A.prototype),u(A.prototype,a,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new A(c(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),u(g,s,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=x,T.prototype={constructor:T,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(k),!e)for(var t in this)"t"===t.charAt(0)&&n.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 r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},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),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:x(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function cK(e){return(cK="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 lK(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(Sye){return void n(Sye)}s.done?t(u):Promise.resolve(u).then(r,i)}function dK(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){lK(o,r,i,a,s,"next",e)}function s(e){lK(o,r,i,a,s,"throw",e)}a(void 0)}))}}function hK(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fK(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function pK(e,t,n){return t&&fK(e.prototype,t),n&&fK(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function mK(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yK(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&&gK(e,t)}function vK(e){return(vK=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gK(e,t){return(gK=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function bK(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function AK(e){var t=function(){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(kye){return!1}}();return function(){var n,r=vK(e);if(t){var i=vK(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(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 bK(e)}(this,n)}}function _K(e){return function(e){if(Array.isArray(e))return wK(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return wK(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return wK(e,t)}(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 wK(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var SK=Il,kK=Sg,TK=hd,xK=mA,EK=vA,LK=/MSIE .\./.test(yd),IK=SK.Function,RK=function(e){return LK?function(t,n){var r=EK(arguments.length,1)>2,i=TK(t)?t:IK(t),o=r?xK(arguments,2):void 0;return e(r?function(){kK(i,this,o)}:i,n)}:e},ZK={setTimeout:RK(SK.setTimeout),setInterval:RK(SK.setInterval)},CK=ZK.setInterval;Py({global:!0,bind:!0,forced:Il.setInterval!==CK},{setInterval:CK});var PK=ZK.setTimeout;Py({global:!0,bind:!0,forced:Il.setTimeout!==PK},{setTimeout:PK});var GK=dm.every;Py({target:"Array",proto:!0,forced:!fm("every")},{every:function(e){return GK(this,e,arguments.length>1?arguments[1]:void 0)}});var DK=Py,MK=Jm.indexOf,VK=fm,XK=mp([].indexOf),WK=!!XK&&1/XK([1],1,-0)<0,OK=VK("indexOf");DK({target:"Array",proto:!0,forced:WK||!OK},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return WK?XK(this,e,t)||0:MK(this,e,t)}});var NK=Hl,UK=yh,FK=Yd,YK=rd,KK=mA,jK=Ul,HK=Function,BK=NK([].concat),JK=NK([].join),zK={},QK=jK?HK.bind:function(e){var t=UK(this),n=t.prototype,r=KK(arguments,1),i=function(){var n=BK(r,KK(arguments));return this instanceof i?function(e,t,n){if(!YK(zK,t)){for(var r=[],i=0;i<t;i++)r[i]="a["+i+"]";zK[t]=HK("C,a","return new C("+JK(r,",")+")")}return zK[t](e,n)}(t,n.length,n):t.apply(e,n)};return FK(n)&&(i.prototype=n),i},qK=QK;Py({target:"Function",proto:!0,forced:Function.bind!==qK},{bind:qK});Py({target:"Array",proto:!0,forced:[].forEach!=mm},{forEach:mm});var $K=Hl,ej=Jf,tj=Date.prototype,nj="Invalid Date",rj="toString",ij=$K(tj[rj]),oj=$K(tj.getTime);String(new Date(NaN))!=nj&&ej(tj,rj,(function(){var e=oj(this);return e==e?ij(this):nj}));var aj=Il,sj=Nl,uj=Hl,cj=tv,lj=Nk.trim,dj=Ck,hj=aj.parseInt,fj=aj.Symbol,pj=fj&&fj.iterator,mj=/^[+-]?0x/i,yj=uj(mj.exec),vj=8!==hj(dj+"08")||22!==hj(dj+"0x16")||pj&&!sj((function(){hj(Object(pj))}))?function(e,t){var n=lj(cj(e));return hj(n,t>>>0||(yj(mj,n)?16:10))}:hj;function gj(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function bj(e){return(bj=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Aj(e,t){return(Aj=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _j(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function wj(e){var t=function(){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(kye){return!1}}();return function(){var n,r=bj(e);if(t){var i=bj(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(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 _j(e)}(this,n)}}Py({global:!0,forced:parseInt!=vj},{parseInt:vj});var Sj=function(e){return e&&e.Math==Math&&e},kj=Sj("object"==typeof globalThis&&globalThis)||Sj("object"==typeof window&&window)||Sj("object"==typeof self&&self)||Sj("object"==typeof R&&R)||function(){return this}()||R||Function("return this")(),Tj={},xj=function(e){try{return!!e()}catch(Sye){return!0}},Ej=!xj((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Lj=!xj((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Ij=Lj,Rj=Function.prototype.call,Zj=Ij?Rj.bind(Rj):function(){return Rj.apply(Rj,arguments)},Cj={},Pj={}.propertyIsEnumerable,Gj=Object.getOwnPropertyDescriptor,Dj=Gj&&!Pj.call({1:2},1);Cj.f=Dj?function(e){var t=Gj(this,e);return!!t&&t.enumerable}:Pj;var Mj,Vj,Xj=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Wj=Lj,Oj=Function.prototype,Nj=Oj.call,Uj=Wj&&Oj.bind.bind(Nj,Nj),Fj=Wj?Uj:function(e){return function(){return Nj.apply(e,arguments)}},Yj=Fj,Kj=Yj({}.toString),jj=Yj("".slice),Hj=function(e){return jj(Kj(e),8,-1)},Bj=xj,Jj=Hj,zj=Object,Qj=Fj("".split),qj=Bj((function(){return!zj("z").propertyIsEnumerable(0)}))?function(e){return"String"==Jj(e)?Qj(e,""):zj(e)}:zj,$j=function(e){return null==e},eH=$j,tH=TypeError,nH=function(e){if(eH(e))throw tH("Can't call method on "+e);return e},rH=qj,iH=nH,oH=function(e){return rH(iH(e))},aH="object"==typeof document&&document.all,sH={all:aH,IS_HTMLDDA:void 0===aH&&void 0!==aH},uH=sH.all,cH=sH.IS_HTMLDDA?function(e){return"function"==typeof e||e===uH}:function(e){return"function"==typeof e},lH=cH,dH=sH.all,hH=sH.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:lH(e)||e===dH}:function(e){return"object"==typeof e?null!==e:lH(e)},fH=kj,pH=cH,mH=function(e,t){return arguments.length<2?(n=fH[e],pH(n)?n:void 0):fH[e]&&fH[e][t];var n},yH=Fj({}.isPrototypeOf),vH="undefined"!=typeof navigator&&String(navigator.userAgent)||"",gH=kj,bH=vH,AH=gH.process,_H=gH.Deno,wH=AH&&AH.versions||_H&&_H.version,SH=wH&&wH.v8;SH&&(Vj=(Mj=SH.split("."))[0]>0&&Mj[0]<4?1:+(Mj[0]+Mj[1])),!Vj&&bH&&(!(Mj=bH.match(/Edge\/(\d+)/))||Mj[1]>=74)&&(Mj=bH.match(/Chrome\/(\d+)/))&&(Vj=+Mj[1]);var kH=Vj,TH=kH,xH=xj,EH=kj.String,LH=!!Object.getOwnPropertySymbols&&!xH((function(){var e=Symbol();return!EH(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&TH&&TH<41})),IH=LH&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,RH=mH,ZH=cH,CH=yH,PH=Object,GH=IH?function(e){return"symbol"==typeof e}:function(e){var t=RH("Symbol");return ZH(t)&&CH(t.prototype,PH(e))},DH=String,MH=function(e){try{return DH(e)}catch(Sye){return"Object"}},VH=cH,XH=MH,WH=TypeError,OH=function(e){if(VH(e))return e;throw WH(XH(e)+" is not a function")},NH=OH,UH=$j,FH=function(e,t){var n=e[t];return UH(n)?void 0:NH(n)},YH=Zj,KH=cH,jH=hH,HH=TypeError,BH={exports:{}},JH=kj,zH=Object.defineProperty,QH=function(e,t){try{zH(JH,e,{value:t,configurable:!0,writable:!0})}catch(Sye){JH[e]=t}return t},qH=QH,$H="__core-js_shared__",eB=kj[$H]||qH($H,{}),tB=eB;(BH.exports=function(e,t){return tB[e]||(tB[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var nB=BH.exports,rB=nH,iB=Object,oB=function(e){return iB(rB(e))},aB=oB,sB=Fj({}.hasOwnProperty),uB=Object.hasOwn||function(e,t){return sB(aB(e),t)},cB=Fj,lB=0,dB=Math.random(),hB=cB(1..toString),fB=function(e){return"Symbol("+(void 0===e?"":e)+")_"+hB(++lB+dB,36)},pB=nB,mB=uB,yB=fB,vB=LH,gB=IH,bB=kj.Symbol,AB=pB("wks"),_B=gB?bB.for||bB:bB&&bB.withoutSetter||yB,wB=function(e){return mB(AB,e)||(AB[e]=vB&&mB(bB,e)?bB[e]:_B("Symbol."+e)),AB[e]},SB=Zj,kB=hH,TB=GH,xB=FH,EB=function(e,t){var n,r;if("string"===t&&KH(n=e.toString)&&!jH(r=YH(n,e)))return r;if(KH(n=e.valueOf)&&!jH(r=YH(n,e)))return r;if("string"!==t&&KH(n=e.toString)&&!jH(r=YH(n,e)))return r;throw HH("Can't convert object to primitive value")},LB=TypeError,IB=wB("toPrimitive"),RB=function(e,t){if(!kB(e)||TB(e))return e;var n,r=xB(e,IB);if(r){if(void 0===t&&(t="default"),n=SB(r,e,t),!kB(n)||TB(n))return n;throw LB("Can't convert object to primitive value")}return void 0===t&&(t="number"),EB(e,t)},ZB=RB,CB=GH,PB=function(e){var t=ZB(e,"string");return CB(t)?t:t+""},GB=hH,DB=kj.document,MB=GB(DB)&&GB(DB.createElement),VB=function(e){return MB?DB.createElement(e):{}},XB=VB,WB=!Ej&&!xj((function(){return 7!=Object.defineProperty(XB("div"),"a",{get:function(){return 7}}).a})),OB=Ej,NB=Zj,UB=Cj,FB=Xj,YB=oH,KB=PB,jB=uB,HB=WB,BB=Object.getOwnPropertyDescriptor;Tj.f=OB?BB:function(e,t){if(e=YB(e),t=KB(t),HB)try{return BB(e,t)}catch(Sye){}if(jB(e,t))return FB(!NB(UB.f,e,t),e[t])};var JB={},zB=Ej&&xj((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),QB=hH,qB=String,$B=TypeError,eJ=function(e){if(QB(e))return e;throw $B(qB(e)+" is not an object")},tJ=Ej,nJ=WB,rJ=zB,iJ=eJ,oJ=PB,aJ=TypeError,sJ=Object.defineProperty,uJ=Object.getOwnPropertyDescriptor,cJ="enumerable",lJ="configurable",dJ="writable";JB.f=tJ?rJ?function(e,t,n){if(iJ(e),t=oJ(t),iJ(n),"function"==typeof e&&"prototype"===t&&"value"in n&&dJ in n&&!n[dJ]){var r=uJ(e,t);r&&r[dJ]&&(e[t]=n.value,n={configurable:lJ in n?n[lJ]:r[lJ],enumerable:cJ in n?n[cJ]:r[cJ],writable:!1})}return sJ(e,t,n)}:sJ:function(e,t,n){if(iJ(e),t=oJ(t),iJ(n),nJ)try{return sJ(e,t,n)}catch(Sye){}if("get"in n||"set"in n)throw aJ("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var hJ=JB,fJ=Xj,pJ=Ej?function(e,t,n){return hJ.f(e,t,fJ(1,n))}:function(e,t,n){return e[t]=n,e},mJ={exports:{}},yJ=Ej,vJ=uB,gJ=Function.prototype,bJ=yJ&&Object.getOwnPropertyDescriptor,AJ=vJ(gJ,"name"),_J={EXISTS:AJ,PROPER:AJ&&"something"===function(){}.name,CONFIGURABLE:AJ&&(!yJ||yJ&&bJ(gJ,"name").configurable)},wJ=cH,SJ=eB,kJ=Fj(Function.toString);wJ(SJ.inspectSource)||(SJ.inspectSource=function(e){return kJ(e)});var TJ,xJ,EJ,LJ=SJ.inspectSource,IJ=cH,RJ=kj.WeakMap,ZJ=IJ(RJ)&&/native code/.test(String(RJ)),CJ=fB,PJ=nB("keys"),GJ=function(e){return PJ[e]||(PJ[e]=CJ(e))},DJ={},MJ=ZJ,VJ=kj,XJ=hH,WJ=pJ,OJ=uB,NJ=eB,UJ=GJ,FJ=DJ,YJ="Object already initialized",KJ=VJ.TypeError,jJ=VJ.WeakMap;if(MJ||NJ.state){var HJ=NJ.state||(NJ.state=new jJ);HJ.get=HJ.get,HJ.has=HJ.has,HJ.set=HJ.set,TJ=function(e,t){if(HJ.has(e))throw KJ(YJ);return t.facade=e,HJ.set(e,t),t},xJ=function(e){return HJ.get(e)||{}},EJ=function(e){return HJ.has(e)}}else{var BJ=UJ("state");FJ[BJ]=!0,TJ=function(e,t){if(OJ(e,BJ))throw KJ(YJ);return t.facade=e,WJ(e,BJ,t),t},xJ=function(e){return OJ(e,BJ)?e[BJ]:{}},EJ=function(e){return OJ(e,BJ)}}var JJ={set:TJ,get:xJ,has:EJ,enforce:function(e){return EJ(e)?xJ(e):TJ(e,{})},getterFor:function(e){return function(t){var n;if(!XJ(t)||(n=xJ(t)).type!==e)throw KJ("Incompatible receiver, "+e+" required");return n}}},zJ=Fj,QJ=xj,qJ=cH,$J=uB,ez=Ej,tz=_J.CONFIGURABLE,nz=LJ,rz=JJ.enforce,iz=JJ.get,oz=String,az=Object.defineProperty,sz=zJ("".slice),uz=zJ("".replace),cz=zJ([].join),lz=ez&&!QJ((function(){return 8!==az((function(){}),"length",{value:8}).length})),dz=String(String).split("String"),hz=mJ.exports=function(e,t,n){"Symbol("===sz(oz(t),0,7)&&(t="["+uz(oz(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!$J(e,"name")||tz&&e.name!==t)&&(ez?az(e,"name",{value:t,configurable:!0}):e.name=t),lz&&n&&$J(n,"arity")&&e.length!==n.arity&&az(e,"length",{value:n.arity});try{n&&$J(n,"constructor")&&n.constructor?ez&&az(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(Sye){}var r=rz(e);return $J(r,"source")||(r.source=cz(dz,"string"==typeof t?t:"")),e};Function.prototype.toString=hz((function(){return qJ(this)&&iz(this).source||nz(this)}),"toString");var fz=mJ.exports,pz=cH,mz=JB,yz=fz,vz=QH,gz=function(e,t,n,r){r||(r={});var i=r.enumerable,o=void 0!==r.name?r.name:t;if(pz(n)&&yz(n,o,r),r.global)i?e[t]=n:vz(t,n);else{try{r.unsafe?e[t]&&(i=!0):delete e[t]}catch(Sye){}i?e[t]=n:mz.f(e,t,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return e},bz={},Az=Math.ceil,_z=Math.floor,wz=Math.trunc||function(e){var t=+e;return(t>0?_z:Az)(t)},Sz=function(e){var t=+e;return t!=t||0===t?0:wz(t)},kz=Sz,Tz=Math.max,xz=Math.min,Ez=function(e,t){var n=kz(e);return n<0?Tz(n+t,0):xz(n,t)},Lz=Sz,Iz=Math.min,Rz=function(e){return e>0?Iz(Lz(e),9007199254740991):0},Zz=Rz,Cz=function(e){return Zz(e.length)},Pz=oH,Gz=Ez,Dz=Cz,Mz=function(e){return function(t,n,r){var i,o=Pz(t),a=Dz(o),s=Gz(r,a);if(e&&n!=n){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===n)return e||s||0;return!e&&-1}},Vz={includes:Mz(!0),indexOf:Mz(!1)},Xz=uB,Wz=oH,Oz=Vz.indexOf,Nz=DJ,Uz=Fj([].push),Fz=function(e,t){var n,r=Wz(e),i=0,o=[];for(n in r)!Xz(Nz,n)&&Xz(r,n)&&Uz(o,n);for(;t.length>i;)Xz(r,n=t[i++])&&(~Oz(o,n)||Uz(o,n));return o},Yz=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Kz=Fz,jz=Yz.concat("length","prototype");bz.f=Object.getOwnPropertyNames||function(e){return Kz(e,jz)};var Hz={};Hz.f=Object.getOwnPropertySymbols;var Bz,Jz=mH,zz=bz,Qz=Hz,qz=eJ,$z=Fj([].concat),eQ=Jz("Reflect","ownKeys")||function(e){var t=zz.f(qz(e)),n=Qz.f;return n?$z(t,n(e)):t},tQ=uB,nQ=eQ,rQ=Tj,iQ=JB,oQ=xj,aQ=cH,sQ=/#|\.prototype\./,uQ=function(e,t){var n=lQ[cQ(e)];return n==hQ||n!=dQ&&(aQ(t)?oQ(t):!!t)},cQ=uQ.normalize=function(e){return String(e).replace(sQ,".").toLowerCase()},lQ=uQ.data={},dQ=uQ.NATIVE="N",hQ=uQ.POLYFILL="P",fQ=uQ,pQ=kj,mQ=Tj.f,yQ=pJ,vQ=gz,gQ=QH,bQ=function(e,t,n){for(var r=nQ(t),i=iQ.f,o=rQ.f,a=0;a<r.length;a++){var s=r[a];tQ(e,s)||n&&tQ(n,s)||i(e,s,o(t,s))}},AQ=fQ,_Q=function(e,t){var n,r,i,o,a,s=e.target,u=e.global,c=e.stat;if(n=u?pQ:c?pQ[s]||gQ(s,{}):(pQ[s]||{}).prototype)for(r in t){if(o=t[r],i=e.dontCallGetSet?(a=mQ(n,r))&&a.value:n[r],!AQ(u?r:s+(c?".":"#")+r,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;bQ(o,i)}(e.sham||i&&i.sham)&&yQ(o,"sham",!0),vQ(n,r,o,e)}},wQ=Lj,SQ=Function.prototype,kQ=SQ.apply,TQ=SQ.call,xQ="object"==typeof Reflect&&Reflect.apply||(wQ?TQ.bind(kQ):function(){return TQ.apply(kQ,arguments)}),EQ="function"==typeof Bun&&Bun&&"string"==typeof Bun.version,LQ=Fj([].slice),IQ=TypeError,RQ=function(e,t){if(e<t)throw IQ("Not enough arguments");return e},ZQ=kj,CQ=xQ,PQ=cH,GQ=EQ,DQ=vH,MQ=LQ,VQ=RQ,XQ=ZQ.Function,WQ=/MSIE .\./.test(DQ)||GQ&&((Bz=ZQ.Bun.version.split(".")).length<3||0==Bz[0]&&(Bz[1]<3||3==Bz[1]&&0==Bz[2])),OQ=function(e,t){var n=t?2:1;return WQ?function(r,i){var o=VQ(arguments.length,1)>n,a=PQ(r)?r:XQ(r),s=o?MQ(arguments,n):[],u=o?function(){CQ(a,this,s)}:a;return t?e(u,i):e(u)}:e},NQ=_Q,UQ=kj,FQ=OQ(UQ.setInterval,!0);NQ({global:!0,bind:!0,forced:UQ.setInterval!==FQ},{setInterval:FQ});var YQ=_Q,KQ=kj,jQ=OQ(KQ.setTimeout,!0);function HQ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function BQ(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function JQ(e,t,n){return t&&BQ(e.prototype,t),n&&BQ(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}YQ({global:!0,bind:!0,forced:KQ.setTimeout!==jQ},{setTimeout:jQ});var zQ={};zQ[wB("toStringTag")]="z";var QQ="[object z]"===String(zQ),qQ=QQ,$Q=cH,eq=Hj,tq=wB("toStringTag"),nq=Object,rq="Arguments"==eq(function(){return arguments}()),iq=qQ?eq:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(Sye){}}(t=nq(e),tq))?n:rq?eq(t):"Object"==(r=eq(t))&&$Q(t.callee)?"Arguments":r},oq=iq,aq=QQ?{}.toString:function(){return"[object "+oq(this)+"]"};QQ||gz(Object.prototype,"toString",aq,{unsafe:!0});var sq="undefined"!=typeof process&&"process"==Hj(process),uq=Fj,cq=OH,lq=cH,dq=String,hq=TypeError,fq=function(e,t,n){try{return uq(cq(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(Sye){}},pq=eJ,mq=function(e){if("object"==typeof e||lq(e))return e;throw hq("Can't set "+dq(e)+" as a prototype")},yq=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=fq(Object.prototype,"__proto__","set"))(n,[]),t=n instanceof Array}catch(Sye){}return function(n,r){return pq(n),mq(r),t?e(n,r):n.__proto__=r,n}}():void 0),vq=JB.f,gq=uB,bq=wB("toStringTag"),Aq=function(e,t,n){e&&!n&&(e=e.prototype),e&&!gq(e,bq)&&vq(e,bq,{configurable:!0,value:t})},_q=fz,wq=JB,Sq=function(e,t,n){return n.get&&_q(n.get,t,{getter:!0}),n.set&&_q(n.set,t,{setter:!0}),wq.f(e,t,n)},kq=mH,Tq=Sq,xq=Ej,Eq=wB("species"),Lq=function(e){var t=kq(e);xq&&t&&!t[Eq]&&Tq(t,Eq,{configurable:!0,get:function(){return this}})},Iq=yH,Rq=TypeError,Zq=function(e,t){if(Iq(t,e))return e;throw Rq("Incorrect invocation")},Cq=Fj,Pq=xj,Gq=cH,Dq=iq,Mq=LJ,Vq=function(){},Xq=[],Wq=mH("Reflect","construct"),Oq=/^\s*(?:class|function)\b/,Nq=Cq(Oq.exec),Uq=!Oq.exec(Vq),Fq=function(e){if(!Gq(e))return!1;try{return Wq(Vq,Xq,e),!0}catch(Sye){return!1}},Yq=function(e){if(!Gq(e))return!1;switch(Dq(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Uq||!!Nq(Oq,Mq(e))}catch(Sye){return!0}};Yq.sham=!0;var Kq,jq,Hq,Bq,Jq=!Wq||Pq((function(){var e;return Fq(Fq.call)||!Fq(Object)||!Fq((function(){e=!0}))||e}))?Yq:Fq,zq=Jq,Qq=MH,qq=TypeError,$q=function(e){if(zq(e))return e;throw qq(Qq(e)+" is not a constructor")},e$=eJ,t$=$q,n$=$j,r$=wB("species"),i$=function(e,t){var n,r=e$(e).constructor;return void 0===r||n$(n=e$(r)[r$])?t:t$(n)},o$=Hj,a$=Fj,s$=function(e){if("Function"===o$(e))return a$(e)},u$=OH,c$=Lj,l$=s$(s$.bind),d$=function(e,t){return u$(e),void 0===t?e:c$?l$(e,t):function(){return e.apply(t,arguments)}},h$=mH("document","documentElement"),f$=/(?:ipad|iphone|ipod).*applewebkit/i.test(vH),p$=kj,m$=xQ,y$=d$,v$=cH,g$=uB,b$=xj,A$=h$,_$=LQ,w$=VB,S$=RQ,k$=f$,T$=sq,x$=p$.setImmediate,E$=p$.clearImmediate,L$=p$.process,I$=p$.Dispatch,R$=p$.Function,Z$=p$.MessageChannel,C$=p$.String,P$=0,G$={},D$="onreadystatechange";b$((function(){Kq=p$.location}));var M$=function(e){if(g$(G$,e)){var t=G$[e];delete G$[e],t()}},V$=function(e){return function(){M$(e)}},X$=function(e){M$(e.data)},W$=function(e){p$.postMessage(C$(e),Kq.protocol+"//"+Kq.host)};x$&&E$||(x$=function(e){S$(arguments.length,1);var t=v$(e)?e:R$(e),n=_$(arguments,1);return G$[++P$]=function(){m$(t,void 0,n)},jq(P$),P$},E$=function(e){delete G$[e]},T$?jq=function(e){L$.nextTick(V$(e))}:I$&&I$.now?jq=function(e){I$.now(V$(e))}:Z$&&!k$?(Bq=(Hq=new Z$).port2,Hq.port1.onmessage=X$,jq=y$(Bq.postMessage,Bq)):p$.addEventListener&&v$(p$.postMessage)&&!p$.importScripts&&Kq&&"file:"!==Kq.protocol&&!b$(W$)?(jq=W$,p$.addEventListener("message",X$,!1)):jq=D$ in w$("script")?function(e){A$.appendChild(w$("script"))[D$]=function(){A$.removeChild(this),M$(e)}}:function(e){setTimeout(V$(e),0)});var O$={set:x$,clear:E$},N$=function(){this.head=null,this.tail=null};N$.prototype={add:function(e){var t={item:e,next:null},n=this.tail;n?n.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var U$,F$,Y$,K$,j$,H$=N$,B$=/ipad|iphone|ipod/i.test(vH)&&"undefined"!=typeof Pebble,J$=/web0s(?!.*chrome)/i.test(vH),z$=kj,Q$=d$,q$=Tj.f,$$=O$.set,e0=H$,t0=f$,n0=B$,r0=J$,i0=sq,o0=z$.MutationObserver||z$.WebKitMutationObserver,a0=z$.document,s0=z$.process,u0=z$.Promise,c0=q$(z$,"queueMicrotask"),l0=c0&&c0.value;if(!l0){var d0=new e0,h0=function(){var e,t;for(i0&&(e=s0.domain)&&e.exit();t=d0.get();)try{t()}catch(Sye){throw d0.head&&U$(),Sye}e&&e.enter()};t0||i0||r0||!o0||!a0?!n0&&u0&&u0.resolve?((K$=u0.resolve(void 0)).constructor=u0,j$=Q$(K$.then,K$),U$=function(){j$(h0)}):i0?U$=function(){s0.nextTick(h0)}:($$=Q$($$,z$),U$=function(){$$(h0)}):(F$=!0,Y$=a0.createTextNode(""),new o0(h0).observe(Y$,{characterData:!0}),U$=function(){Y$.data=F$=!F$}),l0=function(e){d0.head||U$(),d0.add(e)}}var f0=l0,p0=function(e){try{return{error:!1,value:e()}}catch(Sye){return{error:!0,value:Sye}}},m0=kj.Promise,y0="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,v0=!y0&&!sq&&"object"==typeof window&&"object"==typeof document,g0=kj,b0=m0,A0=cH,_0=fQ,w0=LJ,S0=wB,k0=v0,T0=y0,x0=kH;b0&&b0.prototype;var E0=S0("species"),L0=!1,I0=A0(g0.PromiseRejectionEvent),R0={CONSTRUCTOR:_0("Promise",(function(){var e=w0(b0),t=e!==String(b0);if(!t&&66===x0)return!0;if(!x0||x0<51||!/native code/.test(e)){var n=new b0((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};if((n.constructor={})[E0]=r,!(L0=n.then((function(){}))instanceof r))return!0}return!t&&(k0||T0)&&!I0})),REJECTION_EVENT:I0,SUBCLASSING:L0},Z0={},C0=OH,P0=TypeError,G0=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw P0("Bad Promise constructor");t=e,n=r})),this.resolve=C0(t),this.reject=C0(n)};Z0.f=function(e){return new G0(e)};var D0,M0,V0,X0=_Q,W0=sq,O0=kj,N0=Zj,U0=gz,F0=yq,Y0=Aq,K0=Lq,j0=OH,H0=cH,B0=hH,J0=Zq,z0=i$,Q0=O$.set,q0=f0,$0=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(Sye){}},e1=p0,t1=H$,n1=JJ,r1=m0,i1=Z0,o1="Promise",a1=R0.CONSTRUCTOR,s1=R0.REJECTION_EVENT,u1=R0.SUBCLASSING,c1=n1.getterFor(o1),l1=n1.set,d1=r1&&r1.prototype,h1=r1,f1=d1,p1=O0.TypeError,m1=O0.document,y1=O0.process,v1=i1.f,g1=v1,b1=!!(m1&&m1.createEvent&&O0.dispatchEvent),A1="unhandledrejection",_1=function(e){var t;return!(!B0(e)||!H0(t=e.then))&&t},w1=function(e,t){var n,r,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{s?(a||(2===t.rejection&&E1(t),t.rejection=1),!0===s?n=o:(l&&l.enter(),n=s(o),l&&(l.exit(),i=!0)),n===e.promise?c(p1("Promise-chain cycle")):(r=_1(n))?N0(r,n,u,c):u(n)):c(o)}catch(Sye){l&&!i&&l.exit(),c(Sye)}},S1=function(e,t){e.notified||(e.notified=!0,q0((function(){for(var n,r=e.reactions;n=r.get();)w1(n,e);e.notified=!1,t&&!e.rejection&&T1(e)})))},k1=function(e,t,n){var r,i;b1?((r=m1.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),O0.dispatchEvent(r)):r={promise:t,reason:n},!s1&&(i=O0["on"+e])?i(r):e===A1&&$0("Unhandled promise rejection",n)},T1=function(e){N0(Q0,O0,(function(){var t,n=e.facade,r=e.value;if(x1(e)&&(t=e1((function(){W0?y1.emit("unhandledRejection",r,n):k1(A1,n,r)})),e.rejection=W0||x1(e)?2:1,t.error))throw t.value}))},x1=function(e){return 1!==e.rejection&&!e.parent},E1=function(e){N0(Q0,O0,(function(){var t=e.facade;W0?y1.emit("rejectionHandled",t):k1("rejectionhandled",t,e.value)}))},L1=function(e,t,n){return function(r){e(t,r,n)}},I1=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,S1(e,!0))},R1=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw p1("Promise can't be resolved itself");var r=_1(t);r?q0((function(){var n={done:!1};try{N0(r,t,L1(R1,n,e),L1(I1,n,e))}catch(Sye){I1(n,Sye,e)}})):(e.value=t,e.state=1,S1(e,!1))}catch(Sye){I1({done:!1},Sye,e)}}};if(a1&&(f1=(h1=function(e){J0(this,f1),j0(e),N0(D0,this);var t=c1(this);try{e(L1(R1,t),L1(I1,t))}catch(Sye){I1(t,Sye)}}).prototype,(D0=function(e){l1(this,{type:o1,done:!1,notified:!1,parent:!1,reactions:new t1,rejection:!1,state:0,value:void 0})}).prototype=U0(f1,"then",(function(e,t){var n=c1(this),r=v1(z0(this,h1));return n.parent=!0,r.ok=!H0(e)||e,r.fail=H0(t)&&t,r.domain=W0?y1.domain:void 0,0==n.state?n.reactions.add(r):q0((function(){w1(r,n)})),r.promise})),M0=function(){var e=new D0,t=c1(e);this.promise=e,this.resolve=L1(R1,t),this.reject=L1(I1,t)},i1.f=v1=function(e){return e===h1||undefined===e?new M0(e):g1(e)},H0(r1)&&d1!==Object.prototype)){V0=d1.then,u1||U0(d1,"then",(function(e,t){var n=this;return new h1((function(e,t){N0(V0,n,e,t)})).then(e,t)}),{unsafe:!0});try{delete d1.constructor}catch(Sye){}F0&&F0(d1,f1)}X0({global:!0,constructor:!0,wrap:!0,forced:a1},{Promise:h1}),Y0(h1,o1,!1),K0(o1);var Z1={},C1=Z1,P1=wB("iterator"),G1=Array.prototype,D1=function(e){return void 0!==e&&(C1.Array===e||G1[P1]===e)},M1=iq,V1=FH,X1=$j,W1=Z1,O1=wB("iterator"),N1=function(e){if(!X1(e))return V1(e,O1)||V1(e,"@@iterator")||W1[M1(e)]},U1=Zj,F1=OH,Y1=eJ,K1=MH,j1=N1,H1=TypeError,B1=function(e,t){var n=arguments.length<2?j1(e):t;if(F1(n))return Y1(U1(n,e));throw H1(K1(e)+" is not iterable")},J1=Zj,z1=eJ,Q1=FH,q1=d$,$1=Zj,e2=eJ,t2=MH,n2=D1,r2=Cz,i2=yH,o2=B1,a2=N1,s2=function(e,t,n){var r,i;z1(e);try{if(!(r=Q1(e,"return"))){if("throw"===t)throw n;return n}r=J1(r,e)}catch(Sye){i=!0,r=Sye}if("throw"===t)throw n;if(i)throw r;return z1(r),n},u2=TypeError,c2=function(e,t){this.stopped=e,this.result=t},l2=c2.prototype,d2=function(e,t,n){var r,i,o,a,s,u,c,l=n&&n.that,d=!(!n||!n.AS_ENTRIES),h=!(!n||!n.IS_RECORD),f=!(!n||!n.IS_ITERATOR),p=!(!n||!n.INTERRUPTED),m=q1(t,l),y=function(e){return r&&s2(r,"normal",e),new c2(!0,e)},v=function(e){return d?(e2(e),p?m(e[0],e[1],y):m(e[0],e[1])):p?m(e,y):m(e)};if(h)r=e.iterator;else if(f)r=e;else{if(!(i=a2(e)))throw u2(t2(e)+" is not iterable");if(n2(i)){for(o=0,a=r2(e);a>o;o++)if((s=v(e[o]))&&i2(l2,s))return s;return new c2(!1)}r=o2(e,i)}for(u=h?e.next:r.next;!(c=$1(u,r)).done;){try{s=v(c.value)}catch(Sye){s2(r,"throw",Sye)}if("object"==typeof s&&s&&i2(l2,s))return s}return new c2(!1)},h2=wB("iterator"),f2=!1;try{var p2=0,m2={next:function(){return{done:!!p2++}},return:function(){f2=!0}};m2[h2]=function(){return this},Array.from(m2,(function(){throw 2}))}catch(Sye){}var y2=function(e,t){if(!t&&!f2)return!1;var n=!1;try{var r={};r[h2]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(Sye){}return n},v2=m0,g2=R0.CONSTRUCTOR||!y2((function(e){v2.all(e).then(void 0,(function(){}))})),b2=Zj,A2=OH,_2=Z0,w2=p0,S2=d2;_Q({target:"Promise",stat:!0,forced:g2},{all:function(e){var t=this,n=_2.f(t),r=n.resolve,i=n.reject,o=w2((function(){var n=A2(t.resolve),o=[],a=0,s=1;S2(e,(function(e){var u=a++,c=!1;s++,b2(n,t,e).then((function(e){c||(c=!0,o[u]=e,--s||r(o))}),i)})),--s||r(o)}));return o.error&&i(o.value),n.promise}});var k2=_Q,T2=R0.CONSTRUCTOR,x2=m0,E2=mH,L2=cH,I2=gz,R2=x2&&x2.prototype;if(k2({target:"Promise",proto:!0,forced:T2,real:!0},{catch:function(e){return this.then(void 0,e)}}),L2(x2)){var Z2=E2("Promise").prototype.catch;R2.catch!==Z2&&I2(R2,"catch",Z2,{unsafe:!0})}var C2=Zj,P2=OH,G2=Z0,D2=p0,M2=d2;_Q({target:"Promise",stat:!0,forced:g2},{race:function(e){var t=this,n=G2.f(t),r=n.reject,i=D2((function(){var i=P2(t.resolve);M2(e,(function(e){C2(i,t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var V2=Zj,X2=Z0;_Q({target:"Promise",stat:!0,forced:R0.CONSTRUCTOR},{reject:function(e){var t=X2.f(this);return V2(t.reject,void 0,e),t.promise}});var W2=eJ,O2=hH,N2=Z0,U2=_Q,F2=R0.CONSTRUCTOR,Y2=function(e,t){if(W2(e),O2(t)&&t.constructor===e)return t;var n=N2.f(e);return(0,n.resolve)(t),n.promise};mH("Promise"),U2({target:"Promise",stat:!0,forced:F2},{resolve:function(e){return Y2(this,e)}});var K2=function(){function e(){var t,n;HQ(this,e);var r=new Promise((function(e,r){t=e,n=r}));return r.resolve=t,r.reject=n,r}return JQ(e,[{key:"resolve",value:function(e){}},{key:"reject",value:function(e){}}]),e}(),j2=_Q,H2=Date,B2=Fj(H2.prototype.getTime);j2({target:"Date",stat:!0},{now:function(){return B2(new H2)}});var J2=Fj,z2=gz,Q2=Date.prototype,q2="Invalid Date",$2="toString",e5=J2(Q2[$2]),t5=J2(Q2.getTime);String(new Date(NaN))!=q2&&z2(Q2,$2,(function(){var e=t5(this);return e==e?e5(this):q2}));var n5=function(){function e(){HQ(this,e)}return JQ(e,null,[{key:"install",value:function(){if(window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame,window.cancelAnimationFrame=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame,!window.requestAnimationFrame){var e=Date.now();window.requestAnimationFrame=function(t){var n=Date.now(),r=Math.max(16.7-(n-e),0),i=setTimeout(t,r);return e=n+r,i}}window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}}]),e}(),r5=Fj,i5=OH,o5=hH,a5=uB,s5=LQ,u5=Lj,c5=Function,l5=r5([].concat),d5=r5([].join),h5={},f5=u5?c5.bind:function(e){var t=i5(this),n=t.prototype,r=s5(arguments,1),i=function(){var n=l5(r,s5(arguments));return this instanceof i?function(e,t,n){if(!a5(h5,t)){for(var r=[],i=0;i<t;i++)r[i]="a["+i+"]";h5[t]=c5("C,a","return new C("+d5(r,",")+")")}return h5[t](e,n)}(t,n.length,n):t.apply(e,n)};return o5(n)&&(i.prototype=n),i},p5=f5;_Q({target:"Function",proto:!0,forced:Function.bind!==p5},{bind:p5});var m5=function(){function e(){HQ(this,e),this.fps=0,this.isStoped=!0,this.ticks=[],this.isSupport=!0,this.maxFps=0,this.step=this._step.bind(this),this.rafId=null}return JQ(e,[{key:"_step",value:function(e){var t=this.ticks;if(t.unshift(e),t.length>10){var n=t.pop();n&&(this.fps=Math.floor(1e4/(e-n)),this.updateFpsInfo())}this.isStoped||(this.rafId=window.requestAnimationFrame(this.step))}},{key:"updateFpsInfo",value:function(){this.fps>this.maxFps&&(this.maxFps=this.fps)}},{key:"start",value:function(){void 0!==window.requestAnimationFrame&&(this.isStoped=!1,this.rafId=window.requestAnimationFrame(this.step))}},{key:"stop",value:function(){window.cancelAnimationFrame(this.rafId),this.isStoped=!0}}],[{key:"install",value:function(){n5.install()}}]),e}(),y5=iq,v5=String,g5=function(e){if("Symbol"===y5(e))throw TypeError("Cannot convert a Symbol value to a string");return v5(e)},b5=eJ,A5={},_5=Fz,w5=Yz,S5=Object.keys||function(e){return _5(e,w5)},k5=Ej,T5=zB,x5=JB,E5=eJ,L5=oH,I5=S5;A5.f=k5&&!T5?Object.defineProperties:function(e,t){E5(e);for(var n,r=L5(t),i=I5(t),o=i.length,a=0;o>a;)x5.f(e,n=i[a++],r[n]);return e};var R5,Z5=eJ,C5=A5,P5=Yz,G5=DJ,D5=h$,M5=VB,V5="prototype",X5="script",W5=GJ("IE_PROTO"),O5=function(){},N5=function(e){return"<"+X5+">"+e+"</"+X5+">"},U5=function(e){e.write(N5("")),e.close();var t=e.parentWindow.Object;return e=null,t},F5=function(){try{R5=new ActiveXObject("htmlfile")}catch(Sye){}var e,t,n;F5="undefined"!=typeof document?document.domain&&R5?U5(R5):(t=M5("iframe"),n="java"+X5+":",t.style.display="none",D5.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(N5("document.F=Object")),e.close(),e.F):U5(R5);for(var r=P5.length;r--;)delete F5[V5][P5[r]];return F5()};G5[W5]=!0;var Y5=Object.create||function(e,t){var n;return null!==e?(O5[V5]=Z5(e),n=new O5,O5[V5]=null,n[W5]=e):n=F5(),void 0===t?n:C5.f(n,t)},K5=xj,j5=function(e,t){var n=[][e];return!!n&&K5((function(){n.call(null,t||function(){return 1},1)}))},H5=wB,B5=Y5,J5=JB.f,z5=H5("unscopables"),Q5=Array.prototype;null==Q5[z5]&&J5(Q5,z5,{configurable:!0,value:B5(null)});var q5,$5,e9,t9=!xj((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),n9=uB,r9=cH,i9=oB,o9=t9,a9=GJ("IE_PROTO"),s9=Object,u9=s9.prototype,c9=o9?s9.getPrototypeOf:function(e){var t=i9(e);if(n9(t,a9))return t[a9];var n=t.constructor;return r9(n)&&t instanceof n?n.prototype:t instanceof s9?u9:null},l9=xj,d9=cH,h9=hH,f9=c9,p9=gz,m9=wB("iterator"),y9=!1;[].keys&&("next"in(e9=[].keys())?($5=f9(f9(e9)))!==Object.prototype&&(q5=$5):y9=!0),(!h9(q5)||l9((function(){var e={};return q5[m9].call(e)!==e})))&&(q5={}),d9(q5[m9])||p9(q5,m9,(function(){return this}));var v9={IteratorPrototype:q5,BUGGY_SAFARI_ITERATORS:y9},g9=v9.IteratorPrototype,b9=Y5,A9=Xj,_9=Aq,w9=Z1,S9=function(){return this},k9=_Q,T9=Zj,x9=cH,E9=function(e,t,n,r){var i=t+" Iterator";return e.prototype=b9(g9,{next:A9(+!r,n)}),_9(e,i,!1),w9[i]=S9,e},L9=c9,I9=yq,R9=Aq,Z9=pJ,C9=gz,P9=Z1,G9=_J.PROPER,D9=_J.CONFIGURABLE,M9=v9.IteratorPrototype,V9=v9.BUGGY_SAFARI_ITERATORS,X9=wB("iterator"),W9="keys",O9="values",N9="entries",U9=function(){return this},F9=function(e,t,n,r,i,o,a){E9(n,t,r);var s,u,c,l=function(e){if(e===i&&m)return m;if(!V9&&e in f)return f[e];switch(e){case W9:case O9:case N9:return function(){return new n(this,e)}}return function(){return new n(this)}},d=t+" Iterator",h=!1,f=e.prototype,p=f[X9]||f["@@iterator"]||i&&f[i],m=!V9&&p||l(i),y="Array"==t&&f.entries||p;if(y&&(s=L9(y.call(new e)))!==Object.prototype&&s.next&&(L9(s)!==M9&&(I9?I9(s,M9):x9(s[X9])||C9(s,X9,U9)),R9(s,d,!0)),G9&&i==O9&&p&&p.name!==O9&&(D9?Z9(f,"name",O9):(h=!0,m=function(){return T9(p,this)})),i)if(u={values:l(O9),keys:o?m:l(W9),entries:l(N9)},a)for(c in u)(V9||h||!(c in f))&&C9(f,c,u[c]);else k9({target:t,proto:!0,forced:V9||h},u);return f[X9]!==m&&C9(f,X9,m,{name:i}),P9[t]=m,u},Y9=function(e,t){return{value:e,done:t}},K9=oH,j9=function(e){Q5[z5][e]=!0},H9=Z1,B9=JJ,J9=JB.f,z9=F9,Q9=Y9,q9=Ej,$9="Array Iterator",e4=B9.set,t4=B9.getterFor($9),n4=z9(Array,"Array",(function(e,t){e4(this,{type:$9,target:K9(e),index:0,kind:t})}),(function(){var e=t4(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,Q9(void 0,!0)):Q9("keys"==n?r:"values"==n?t[r]:[r,t[r]],!1)}),"values"),r4=H9.Arguments=H9.Array;if(j9("keys"),j9("values"),j9("entries"),q9&&"values"!==r4.name)try{J9(r4,"name",{value:"values"})}catch(Sye){}var i4="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,o4=gz,a4=function(e,t,n){for(var r in t)o4(e,r,t[r],n);return e},s4=Sz,u4=Rz,c4=RangeError,l4=function(e){if(void 0===e)return 0;var t=s4(e),n=u4(t);if(t!==n)throw c4("Wrong length or index");return n},d4=Array,h4=Math.abs,f4=Math.pow,p4=Math.floor,m4=Math.log,y4=Math.LN2,v4={pack:function(e,t,n){var r,i,o,a=d4(n),s=8*n-t-1,u=(1<<s)-1,c=u>>1,l=23===t?f4(2,-24)-f4(2,-77):0,d=e<0||0===e&&1/e<0?1:0,h=0;for((e=h4(e))!=e||e===1/0?(i=e!=e?1:0,r=u):(r=p4(m4(e)/y4),e*(o=f4(2,-r))<1&&(r--,o*=2),(e+=r+c>=1?l/o:l*f4(2,1-c))*o>=2&&(r++,o/=2),r+c>=u?(i=0,r=u):r+c>=1?(i=(e*o-1)*f4(2,t),r+=c):(i=e*f4(2,c-1)*f4(2,t),r=0));t>=8;)a[h++]=255&i,i/=256,t-=8;for(r=r<<t|i,s+=t;s>0;)a[h++]=255&r,r/=256,s-=8;return a[--h]|=128*d,a},unpack:function(e,t){var n,r=e.length,i=8*r-t-1,o=(1<<i)-1,a=o>>1,s=i-7,u=r-1,c=e[u--],l=127&c;for(c>>=7;s>0;)l=256*l+e[u--],s-=8;for(n=l&(1<<-s)-1,l>>=-s,s+=t;s>0;)n=256*n+e[u--],s-=8;if(0===l)l=1-a;else{if(l===o)return n?NaN:c?-1/0:1/0;n+=f4(2,t),l-=a}return(c?-1:1)*n*f4(2,l-t)}},g4=oB,b4=Ez,A4=Cz,_4=function(e){for(var t=g4(this),n=A4(t),r=arguments.length,i=b4(r>1?arguments[1]:void 0,n),o=r>2?arguments[2]:void 0,a=void 0===o?n:b4(o,n);a>i;)t[i++]=e;return t},w4=PB,S4=JB,k4=Xj,T4=function(e,t,n){var r=w4(t);r in e?S4.f(e,r,k4(0,n)):e[r]=n},x4=Ez,E4=Cz,L4=T4,I4=Array,R4=Math.max,Z4=function(e,t,n){for(var r=E4(e),i=x4(t,r),o=x4(void 0===n?r:n,r),a=I4(R4(o-i,0)),s=0;i<o;i++,s++)L4(a,s,e[i]);return a.length=s,a},C4=kj,P4=Fj,G4=Ej,D4=i4,M4=_J,V4=pJ,X4=Sq,W4=a4,O4=xj,N4=Zq,U4=Sz,F4=Rz,Y4=l4,K4=v4,j4=c9,H4=yq,B4=bz.f,J4=_4,z4=Z4,Q4=Aq,q4=JJ,$4=M4.PROPER,e3=M4.CONFIGURABLE,t3="ArrayBuffer",n3="DataView",r3="prototype",i3="Wrong index",o3=q4.getterFor(t3),a3=q4.getterFor(n3),s3=q4.set,u3=C4[t3],c3=u3,l3=c3&&c3[r3],d3=C4[n3],h3=d3&&d3[r3],f3=Object.prototype,p3=C4.Array,m3=C4.RangeError,y3=P4(J4),v3=P4([].reverse),g3=K4.pack,b3=K4.unpack,A3=function(e){return[255&e]},_3=function(e){return[255&e,e>>8&255]},w3=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},S3=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},k3=function(e){return g3(e,23,4)},T3=function(e){return g3(e,52,8)},x3=function(e,t,n){X4(e[r3],t,{configurable:!0,get:function(){return n(this)[t]}})},E3=function(e,t,n,r){var i=a3(e),o=Y4(n),a=!!r;if(o+t>i.byteLength)throw m3(i3);var s=i.bytes,u=o+i.byteOffset,c=z4(s,u,u+t);return a?c:v3(c)},L3=function(e,t,n,r,i,o){var a=a3(e),s=Y4(n),u=r(+i),c=!!o;if(s+t>a.byteLength)throw m3(i3);for(var l=a.bytes,d=s+a.byteOffset,h=0;h<t;h++)l[d+h]=u[c?h:t-h-1]};if(D4){var I3=$4&&u3.name!==t3;if(O4((function(){u3(1)}))&&O4((function(){new u3(-1)}))&&!O4((function(){return new u3,new u3(1.5),new u3(NaN),1!=u3.length||I3&&!e3})))I3&&e3&&V4(u3,"name",t3);else{(c3=function(e){return N4(this,l3),new u3(Y4(e))})[r3]=l3;for(var R3,Z3=B4(u3),C3=0;Z3.length>C3;)(R3=Z3[C3++])in c3||V4(c3,R3,u3[R3]);l3.constructor=c3}H4&&j4(h3)!==f3&&H4(h3,f3);var P3=new d3(new c3(2)),G3=P4(h3.setInt8);P3.setInt8(0,2147483648),P3.setInt8(1,2147483649),!P3.getInt8(0)&&P3.getInt8(1)||W4(h3,{setInt8:function(e,t){G3(this,e,t<<24>>24)},setUint8:function(e,t){G3(this,e,t<<24>>24)}},{unsafe:!0})}else l3=(c3=function(e){N4(this,l3);var t=Y4(e);s3(this,{type:t3,bytes:y3(p3(t),0),byteLength:t}),G4||(this.byteLength=t,this.detached=!1)})[r3],h3=(d3=function(e,t,n){N4(this,h3),N4(e,l3);var r=o3(e),i=r.byteLength,o=U4(t);if(o<0||o>i)throw m3("Wrong offset");if(o+(n=void 0===n?i-o:F4(n))>i)throw m3("Wrong length");s3(this,{type:n3,buffer:e,byteLength:n,byteOffset:o,bytes:r.bytes}),G4||(this.buffer=e,this.byteLength=n,this.byteOffset=o)})[r3],G4&&(x3(c3,"byteLength",o3),x3(d3,"buffer",a3),x3(d3,"byteLength",a3),x3(d3,"byteOffset",a3)),W4(h3,{getInt8:function(e){return E3(this,1,e)[0]<<24>>24},getUint8:function(e){return E3(this,1,e)[0]},getInt16:function(e){var t=E3(this,2,e,arguments.length>1&&arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=E3(this,2,e,arguments.length>1&&arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return S3(E3(this,4,e,arguments.length>1&&arguments[1]))},getUint32:function(e){return S3(E3(this,4,e,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(e){return b3(E3(this,4,e,arguments.length>1&&arguments[1]),23)},getFloat64:function(e){return b3(E3(this,8,e,arguments.length>1&&arguments[1]),52)},setInt8:function(e,t){L3(this,1,e,A3,t)},setUint8:function(e,t){L3(this,1,e,A3,t)},setInt16:function(e,t){L3(this,2,e,_3,t,arguments.length>2&&arguments[2])},setUint16:function(e,t){L3(this,2,e,_3,t,arguments.length>2&&arguments[2])},setInt32:function(e,t){L3(this,4,e,w3,t,arguments.length>2&&arguments[2])},setUint32:function(e,t){L3(this,4,e,w3,t,arguments.length>2&&arguments[2])},setFloat32:function(e,t){L3(this,4,e,k3,t,arguments.length>2&&arguments[2])},setFloat64:function(e,t){L3(this,8,e,T3,t,arguments.length>2&&arguments[2])}});Q4(c3,t3),Q4(d3,n3);var D3={ArrayBuffer:c3,DataView:d3},M3=_Q,V3=s$,X3=xj,W3=eJ,O3=Ez,N3=Rz,U3=i$,F3=D3.ArrayBuffer,Y3=D3.DataView,K3=Y3.prototype,j3=V3(F3.prototype.slice),H3=V3(K3.getUint8),B3=V3(K3.setUint8);M3({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:X3((function(){return!new F3(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(j3&&void 0===t)return j3(W3(this),e);for(var n=W3(this).byteLength,r=O3(e,n),i=O3(void 0===t?n:t,n),o=new(U3(this,F3))(N3(i-r)),a=new Y3(this),s=new Y3(o),u=0;r<i;)B3(s,u++,H3(a,r++));return o}});var J3,z3,Q3,q3={exports:{}},$3=i4,e8=Ej,t8=kj,n8=cH,r8=hH,i8=uB,o8=iq,a8=MH,s8=pJ,u8=gz,c8=Sq,l8=yH,d8=c9,h8=yq,f8=wB,p8=fB,m8=JJ.enforce,y8=JJ.get,v8=t8.Int8Array,g8=v8&&v8.prototype,b8=t8.Uint8ClampedArray,A8=b8&&b8.prototype,_8=v8&&d8(v8),w8=g8&&d8(g8),S8=Object.prototype,k8=t8.TypeError,T8=f8("toStringTag"),x8=p8("TYPED_ARRAY_TAG"),E8="TypedArrayConstructor",L8=$3&&!!h8&&"Opera"!==o8(t8.opera),I8=!1,R8={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Z8={BigInt64Array:8,BigUint64Array:8},C8=function(e){var t=d8(e);if(r8(t)){var n=y8(t);return n&&i8(n,E8)?n[E8]:C8(t)}},P8=function(e){if(!r8(e))return!1;var t=o8(e);return i8(R8,t)||i8(Z8,t)};for(J3 in R8)(Q3=(z3=t8[J3])&&z3.prototype)?m8(Q3)[E8]=z3:L8=!1;for(J3 in Z8)(Q3=(z3=t8[J3])&&z3.prototype)&&(m8(Q3)[E8]=z3);if((!L8||!n8(_8)||_8===Function.prototype)&&(_8=function(){throw k8("Incorrect invocation")},L8))for(J3 in R8)t8[J3]&&h8(t8[J3],_8);if((!L8||!w8||w8===S8)&&(w8=_8.prototype,L8))for(J3 in R8)t8[J3]&&h8(t8[J3].prototype,w8);if(L8&&d8(A8)!==w8&&h8(A8,w8),e8&&!i8(w8,T8))for(J3 in I8=!0,c8(w8,T8,{configurable:!0,get:function(){return r8(this)?this[x8]:void 0}}),R8)t8[J3]&&s8(t8[J3],x8,J3);var G8={NATIVE_ARRAY_BUFFER_VIEWS:L8,TYPED_ARRAY_TAG:I8&&x8,aTypedArray:function(e){if(P8(e))return e;throw k8("Target is not a typed array")},aTypedArrayConstructor:function(e){if(n8(e)&&(!h8||l8(_8,e)))return e;throw k8(a8(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n,r){if(e8){if(n)for(var i in R8){var o=t8[i];if(o&&i8(o.prototype,e))try{delete o.prototype[e]}catch(Sye){try{o.prototype[e]=t}catch(a){}}}w8[e]&&!n||u8(w8,e,n?t:L8&&g8[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,n){var r,i;if(e8){if(h8){if(n)for(r in R8)if((i=t8[r])&&i8(i,e))try{delete i[e]}catch(Sye){}if(_8[e]&&!n)return;try{return u8(_8,e,n?t:L8&&_8[e]||t)}catch(Sye){}}for(r in R8)!(i=t8[r])||i[e]&&!n||u8(i,e,t)}},getTypedArrayConstructor:C8,isView:function(e){if(!r8(e))return!1;var t=o8(e);return"DataView"===t||i8(R8,t)||i8(Z8,t)},isTypedArray:P8,TypedArray:_8,TypedArrayPrototype:w8},D8=kj,M8=xj,V8=y2,X8=G8.NATIVE_ARRAY_BUFFER_VIEWS,W8=D8.ArrayBuffer,O8=D8.Int8Array,N8=!X8||!M8((function(){O8(1)}))||!M8((function(){new O8(-1)}))||!V8((function(e){new O8,new O8(null),new O8(1.5),new O8(e)}),!0)||M8((function(){return 1!==new O8(new W8(2),1,void 0).length})),U8=hH,F8=Math.floor,Y8=Number.isInteger||function(e){return!U8(e)&&isFinite(e)&&F8(e)===e},K8=Sz,j8=RangeError,H8=function(e){var t=K8(e);if(t<0)throw j8("The argument can't be less than 0");return t},B8=RangeError,J8=function(e,t){var n=H8(e);if(n%t)throw B8("Wrong offset");return n},z8=iq,Q8=RB,q8=TypeError,$8=function(e){var t=Q8(e,"number");if("number"==typeof t)throw q8("Can't convert number to bigint");return BigInt(t)},e6=d$,t6=Zj,n6=$q,r6=oB,i6=Cz,o6=B1,a6=N1,s6=D1,u6=function(e){var t=z8(e);return"BigInt64Array"==t||"BigUint64Array"==t},c6=G8.aTypedArrayConstructor,l6=$8,d6=Hj,h6=Array.isArray||function(e){return"Array"==d6(e)},f6=h6,p6=Jq,m6=hH,y6=wB("species"),v6=Array,g6=function(e){var t;return f6(e)&&(t=e.constructor,(p6(t)&&(t===v6||f6(t.prototype))||m6(t)&&null===(t=t[y6]))&&(t=void 0)),void 0===t?v6:t},b6=d$,A6=qj,_6=oB,w6=Cz,S6=function(e,t){return new(g6(e))(0===t?0:t)},k6=Fj([].push),T6=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(u,c,l,d){for(var h,f,p=_6(u),m=A6(p),y=b6(c,l),v=w6(m),g=0,b=d||S6,A=t?b(u,v):n||a?b(u,0):void 0;v>g;g++)if((s||g in m)&&(f=y(h=m[g],g,p),e))if(t)A[g]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:k6(A,h)}else switch(e){case 4:return!1;case 7:k6(A,h)}return o?-1:r||i?i:A}},x6={forEach:T6(0),map:T6(1),filter:T6(2),some:T6(3),every:T6(4),find:T6(5),findIndex:T6(6),filterReject:T6(7)},E6=cH,L6=hH,I6=yq,R6=function(e,t,n){var r,i;return I6&&E6(r=t.constructor)&&r!==n&&L6(i=r.prototype)&&i!==n.prototype&&I6(e,i),e},Z6=_Q,C6=kj,P6=Zj,G6=Ej,D6=N8,M6=G8,V6=D3,X6=Zq,W6=Xj,O6=pJ,N6=Y8,U6=Rz,F6=l4,Y6=J8,K6=PB,j6=uB,H6=iq,B6=hH,J6=GH,z6=Y5,Q6=yH,q6=yq,$6=bz.f,e7=function(e){var t,n,r,i,o,a,s,u,c=n6(this),l=r6(e),d=arguments.length,h=d>1?arguments[1]:void 0,f=void 0!==h,p=a6(l);if(p&&!s6(p))for(u=(s=o6(l,p)).next,l=[];!(a=t6(u,s)).done;)l.push(a.value);for(f&&d>2&&(h=e6(h,arguments[2])),n=i6(l),r=new(c6(c))(n),i=u6(r),t=0;n>t;t++)o=f?h(l[t],t):l[t],r[t]=i?l6(o):+o;return r},t7=x6.forEach,n7=Lq,r7=Sq,i7=JB,o7=Tj,a7=R6,s7=JJ.get,u7=JJ.set,c7=JJ.enforce,l7=i7.f,d7=o7.f,h7=Math.round,f7=C6.RangeError,p7=V6.ArrayBuffer,m7=p7.prototype,y7=V6.DataView,v7=M6.NATIVE_ARRAY_BUFFER_VIEWS,g7=M6.TYPED_ARRAY_TAG,b7=M6.TypedArray,A7=M6.TypedArrayPrototype,_7=M6.aTypedArrayConstructor,w7=M6.isTypedArray,S7="BYTES_PER_ELEMENT",k7="Wrong length",T7=function(e,t){_7(e);for(var n=0,r=t.length,i=new e(r);r>n;)i[n]=t[n++];return i},x7=function(e,t){r7(e,t,{configurable:!0,get:function(){return s7(this)[t]}})},E7=function(e){var t;return Q6(m7,e)||"ArrayBuffer"==(t=H6(e))||"SharedArrayBuffer"==t},L7=function(e,t){return w7(e)&&!J6(t)&&t in e&&N6(+t)&&t>=0},I7=function(e,t){return t=K6(t),L7(e,t)?W6(2,e[t]):d7(e,t)},R7=function(e,t,n){return t=K6(t),!(L7(e,t)&&B6(n)&&j6(n,"value"))||j6(n,"get")||j6(n,"set")||n.configurable||j6(n,"writable")&&!n.writable||j6(n,"enumerable")&&!n.enumerable?l7(e,t,n):(e[t]=n.value,e)};G6?(v7||(o7.f=I7,i7.f=R7,x7(A7,"buffer"),x7(A7,"byteOffset"),x7(A7,"byteLength"),x7(A7,"length")),Z6({target:"Object",stat:!0,forced:!v7},{getOwnPropertyDescriptor:I7,defineProperty:R7}),q3.exports=function(e,t,n){var r=e.match(/\d+/)[0]/8,i=e+(n?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=C6[i],u=s,c=u&&u.prototype,l={},d=function(e,t){l7(e,t,{get:function(){return function(e,t){var n=s7(e);return n.view[o](t*r+n.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=s7(e);n&&(i=(i=h7(i))<0?0:i>255?255:255&i),o.view[a](t*r+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};v7?D6&&(u=t((function(e,t,n,i){return X6(e,c),a7(B6(t)?E7(t)?void 0!==i?new s(t,Y6(n,r),i):void 0!==n?new s(t,Y6(n,r)):new s(t):w7(t)?T7(u,t):P6(e7,u,t):new s(F6(t)),e,u)})),q6&&q6(u,b7),t7($6(s),(function(e){e in u||O6(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,n,i){X6(e,c);var o,a,s,l=0,h=0;if(B6(t)){if(!E7(t))return w7(t)?T7(u,t):P6(e7,u,t);o=t,h=Y6(n,r);var f=t.byteLength;if(void 0===i){if(f%r)throw f7(k7);if((a=f-h)<0)throw f7(k7)}else if((a=U6(i)*r)+h>f)throw f7(k7);s=a/r}else s=F6(t),o=new p7(a=s*r);for(u7(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new y7(o)});l<s;)d(e,l++)})),q6&&q6(u,b7),c=u.prototype=z6(A7)),c.constructor!==u&&O6(c,"constructor",u),c7(c).TypedArrayConstructor=u,g7&&O6(c,g7,i);var h=u!=s;l[i]=u,Z6({global:!0,constructor:!0,forced:h,sham:!v7},l),S7 in u||O6(u,S7,r),S7 in c||O6(c,S7,r),n7(i)}):q3.exports=function(){};var Z7=q3.exports,C7=MH,P7=TypeError,G7=function(e,t){if(!delete e[t])throw P7("Cannot delete property "+C7(t)+" of "+C7(e))},D7=oB,M7=Ez,V7=Cz,X7=G7,W7=Math.min,O7=[].copyWithin||function(e,t){var n=D7(this),r=V7(n),i=M7(e,r),o=M7(t,r),a=arguments.length>2?arguments[2]:void 0,s=W7((void 0===a?r:M7(a,r))-o,r-i),u=1;for(o<i&&i<o+s&&(u=-1,o+=s-1,i+=s-1);s-- >0;)o in n?n[i]=n[o]:X7(n,i),i+=u,o+=u;return n},N7=G8,U7=Fj(O7),F7=N7.aTypedArray;(0,N7.exportTypedArrayMethod)("copyWithin",(function(e,t){return U7(F7(this),e,t,arguments.length>2?arguments[2]:void 0)}));var Y7=x6.every,K7=G8.aTypedArray;(0,G8.exportTypedArrayMethod)("every",(function(e){return Y7(K7(this),e,arguments.length>1?arguments[1]:void 0)}));var j7=_4,H7=$8,B7=iq,J7=Zj,z7=xj,Q7=G8.aTypedArray,q7=G8.exportTypedArrayMethod,$7=Fj("".slice);q7("fill",(function(e){var t=arguments.length;Q7(this);var n="Big"===$7(B7(this),0,3)?H7(e):+e;return J7(j7,this,n,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),z7((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e})));var eee=Cz,tee=i$,nee=G8.aTypedArrayConstructor,ree=G8.getTypedArrayConstructor,iee=function(e){return nee(tee(e,ree(e)))},oee=function(e,t){for(var n=0,r=eee(t),i=new e(r);r>n;)i[n]=t[n++];return i},aee=iee,see=x6.filter,uee=function(e,t){return oee(aee(e),t)},cee=G8.aTypedArray;(0,G8.exportTypedArrayMethod)("filter",(function(e){var t=see(cee(this),e,arguments.length>1?arguments[1]:void 0);return uee(this,t)}));var lee=x6.find,dee=G8.aTypedArray;(0,G8.exportTypedArrayMethod)("find",(function(e){return lee(dee(this),e,arguments.length>1?arguments[1]:void 0)}));var hee=x6.findIndex,fee=G8.aTypedArray;(0,G8.exportTypedArrayMethod)("findIndex",(function(e){return hee(fee(this),e,arguments.length>1?arguments[1]:void 0)}));var pee=x6.forEach,mee=G8.aTypedArray;(0,G8.exportTypedArrayMethod)("forEach",(function(e){pee(mee(this),e,arguments.length>1?arguments[1]:void 0)}));var yee=Vz.includes,vee=G8.aTypedArray;(0,G8.exportTypedArrayMethod)("includes",(function(e){return yee(vee(this),e,arguments.length>1?arguments[1]:void 0)}));var gee=Vz.indexOf,bee=G8.aTypedArray;(0,G8.exportTypedArrayMethod)("indexOf",(function(e){return gee(bee(this),e,arguments.length>1?arguments[1]:void 0)}));var Aee=kj,_ee=xj,wee=Fj,See=G8,kee=n4,Tee=wB("iterator"),xee=Aee.Uint8Array,Eee=wee(kee.values),Lee=wee(kee.keys),Iee=wee(kee.entries),Ree=See.aTypedArray,Zee=See.exportTypedArrayMethod,Cee=xee&&xee.prototype,Pee=!_ee((function(){Cee[Tee].call([1])})),Gee=!!Cee&&Cee.values&&Cee[Tee]===Cee.values&&"values"===Cee.values.name,Dee=function(){return Eee(Ree(this))};Zee("entries",(function(){return Iee(Ree(this))}),Pee),Zee("keys",(function(){return Lee(Ree(this))}),Pee),Zee("values",Dee,Pee||!Gee,{name:"values"}),Zee(Tee,Dee,Pee||!Gee,{name:"values"});var Mee=G8.aTypedArray,Vee=G8.exportTypedArrayMethod,Xee=Fj([].join);Vee("join",(function(e){return Xee(Mee(this),e)}));var Wee=xQ,Oee=oH,Nee=Sz,Uee=Cz,Fee=j5,Yee=Math.min,Kee=[].lastIndexOf,jee=!!Kee&&1/[1].lastIndexOf(1,-0)<0,Hee=Fee("lastIndexOf"),Bee=jee||!Hee?function(e){if(jee)return Wee(Kee,this,arguments)||0;var t=Oee(this),n=Uee(t),r=n-1;for(arguments.length>1&&(r=Yee(r,Nee(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:Kee,Jee=xQ,zee=Bee,Qee=G8.aTypedArray;(0,G8.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return Jee(zee,Qee(this),t>1?[e,arguments[1]]:[e])}));var qee=x6.map,$ee=iee,ete=G8.aTypedArray;(0,G8.exportTypedArrayMethod)("map",(function(e){return qee(ete(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new($ee(e))(t)}))}));var tte=OH,nte=oB,rte=qj,ite=Cz,ote=TypeError,ate=function(e){return function(t,n,r,i){tte(n);var o=nte(t),a=rte(o),s=ite(o),u=e?s-1:0,c=e?-1:1;if(r<2)for(;;){if(u in a){i=a[u],u+=c;break}if(u+=c,e?u<0:s<=u)throw ote("Reduce of empty array with no initial value")}for(;e?u>=0:s>u;u+=c)u in a&&(i=n(i,a[u],u,o));return i}},ste={left:ate(!1),right:ate(!0)},ute=ste.left,cte=G8.aTypedArray;(0,G8.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return ute(cte(this),e,t,t>1?arguments[1]:void 0)}));var lte=ste.right,dte=G8.aTypedArray;(0,G8.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return lte(dte(this),e,t,t>1?arguments[1]:void 0)}));var hte=G8.aTypedArray,fte=G8.exportTypedArrayMethod,pte=Math.floor;fte("reverse",(function(){for(var e,t=this,n=hte(t).length,r=pte(n/2),i=0;i<r;)e=t[i],t[i++]=t[--n],t[n]=e;return t}));var mte=kj,yte=Zj,vte=G8,gte=Cz,bte=J8,Ate=oB,_te=xj,wte=mte.RangeError,Ste=mte.Int8Array,kte=Ste&&Ste.prototype,Tte=kte&&kte.set,xte=vte.aTypedArray,Ete=vte.exportTypedArrayMethod,Lte=!_te((function(){var e=new Uint8ClampedArray(2);return yte(Tte,e,{length:1,0:3},1),3!==e[1]})),Ite=Lte&&vte.NATIVE_ARRAY_BUFFER_VIEWS&&_te((function(){var e=new Ste(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));Ete("set",(function(e){xte(this);var t=bte(arguments.length>1?arguments[1]:void 0,1),n=Ate(e);if(Lte)return yte(Tte,this,n,t);var r=this.length,i=gte(n),o=0;if(i+t>r)throw wte("Wrong length");for(;o<i;)this[t+o]=n[o++]}),!Lte||Ite);var Rte=iee,Zte=LQ,Cte=G8.aTypedArray;(0,G8.exportTypedArrayMethod)("slice",(function(e,t){for(var n=Zte(Cte(this),e,t),r=Rte(this),i=0,o=n.length,a=new r(o);o>i;)a[i]=n[i++];return a}),xj((function(){new Int8Array(1).slice()})));var Pte=x6.some,Gte=G8.aTypedArray;(0,G8.exportTypedArrayMethod)("some",(function(e){return Pte(Gte(this),e,arguments.length>1?arguments[1]:void 0)}));var Dte=Z4,Mte=Math.floor,Vte=function(e,t){var n=e.length,r=Mte(n/2);return n<8?Xte(e,t):Wte(e,Vte(Dte(e,0,r),t),Vte(Dte(e,r),t),t)},Xte=function(e,t){for(var n,r,i=e.length,o=1;o<i;){for(r=o,n=e[o];r&&t(e[r-1],n)>0;)e[r]=e[--r];r!==o++&&(e[r]=n)}return e},Wte=function(e,t,n,r){for(var i=t.length,o=n.length,a=0,s=0;a<i||s<o;)e[a+s]=a<i&&s<o?r(t[a],n[s])<=0?t[a++]:n[s++]:a<i?t[a++]:n[s++];return e},Ote=Vte,Nte=vH.match(/firefox\/(\d+)/i),Ute=!!Nte&&+Nte[1],Fte=/MSIE|Trident/.test(vH),Yte=vH.match(/AppleWebKit\/(\d+)\./),Kte=!!Yte&&+Yte[1],jte=s$,Hte=xj,Bte=OH,Jte=Ote,zte=Ute,Qte=Fte,qte=kH,$te=Kte,ene=G8.aTypedArray,tne=G8.exportTypedArrayMethod,nne=kj.Uint16Array,rne=nne&&jte(nne.prototype.sort),ine=!(!rne||Hte((function(){rne(new nne(2),null)}))&&Hte((function(){rne(new nne(2),{})}))),one=!!rne&&!Hte((function(){if(qte)return qte<74;if(zte)return zte<67;if(Qte)return!0;if($te)return $te<602;var e,t,n=new nne(516),r=Array(516);for(e=0;e<516;e++)t=e%4,n[e]=515-e,r[e]=e-2*t+3;for(rne(n,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(n[e]!==r[e])return!0}));tne("sort",(function(e){return void 0!==e&&Bte(e),one?rne(this,e):Jte(ene(this),function(e){return function(t,n){return void 0!==e?+e(t,n)||0:n!=n?-1:t!=t?1:0===t&&0===n?1/t>0&&1/n<0?1:-1:t>n}}(e))}),!one||ine);var ane=Rz,sne=Ez,une=iee,cne=G8.aTypedArray;(0,G8.exportTypedArrayMethod)("subarray",(function(e,t){var n=cne(this),r=n.length,i=sne(e,r);return new(une(n))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,ane((void 0===t?r:sne(t,r))-i))}));var lne=xQ,dne=G8,hne=xj,fne=LQ,pne=kj.Int8Array,mne=dne.aTypedArray,yne=dne.exportTypedArrayMethod,vne=[].toLocaleString,gne=!!pne&&hne((function(){vne.call(new pne(1))}));yne("toLocaleString",(function(){return lne(vne,gne?fne(mne(this)):mne(this),fne(arguments))}),hne((function(){return[1,2].toLocaleString()!=new pne([1,2]).toLocaleString()}))||!hne((function(){pne.prototype.toLocaleString.call([1,2])})));var bne=G8.exportTypedArrayMethod,Ane=xj,_ne=Fj,wne=kj.Uint8Array,Sne=wne&&wne.prototype||{},kne=[].toString,Tne=_ne([].join);Ane((function(){kne.call({})}))&&(kne=function(){return Tne(this)});var xne=Sne.toString!=kne;bne("toString",kne,xne);var Ene=Fj,Lne=Sz,Ine=g5,Rne=nH,Zne=Ene("".charAt),Cne=Ene("".charCodeAt),Pne=Ene("".slice),Gne=function(e){return function(t,n){var r,i,o=Ine(Rne(t)),a=Lne(n),s=o.length;return a<0||a>=s?e?"":void 0:(r=Cne(o,a))<55296||r>56319||a+1===s||(i=Cne(o,a+1))<56320||i>57343?e?Zne(o,a):r:e?Pne(o,a,a+2):i-56320+(r-55296<<10)+65536}},Dne={codeAt:Gne(!1),charAt:Gne(!0)},Mne="\t\n\v\f\r \u2028\u2029\ufeff",Vne=nH,Xne=g5,Wne=Mne,One=Fj("".replace),Nne=RegExp("^["+Wne+"]+"),Une=RegExp("(^|[^"+Wne+"])["+Wne+"]+$"),Fne=function(e){return function(t){var n=Xne(Vne(t));return 1&e&&(n=One(n,Nne,"")),2&e&&(n=One(n,Une,"$1")),n}},Yne={start:Fne(1),end:Fne(2),trim:Fne(3)},Kne=x6.forEach,jne=j5("forEach")?[].forEach:function(e){return Kne(this,e,arguments.length>1?arguments[1]:void 0)};_Q({target:"Array",proto:!0,forced:[].forEach!=jne},{forEach:jne});var Hne={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Bne=VB("span").classList,Jne=Bne&&Bne.constructor&&Bne.constructor.prototype,zne=Jne===Object.prototype?void 0:Jne,Qne=kj,qne=Hne,$ne=zne,ere=jne,tre=pJ,nre=function(e){if(e&&e.forEach!==ere)try{tre(e,"forEach",ere)}catch(Sye){e.forEach=ere}};for(var rre in qne)qne[rre]&&nre(Qne[rre]&&Qne[rre].prototype);nre($ne);var ire=function(){function e(){HQ(this,e),this.timeID=null,this.func=null}return JQ(e,[{key:"repeat",value:function(e,t){this.timeID=1,this.repeatInterval(e,t)}},{key:"repeatInterval",value:function(e,t){var n=this;this.timeID&&(null===this.func&&(this.func=e),this.func===e&&(this.timeID&&clearTimeout(this.timeID),this.timeID=null,this.timeID=setTimeout((function(){e(),n.repeatInterval(e,t)}),t)))}},{key:"clear",value:function(){clearTimeout(this.timeID),this.timeID=null}}]),e}(),ore=_Q,are=Vz.indexOf,sre=j5,ure=s$([].indexOf),cre=!!ure&&1/ure([1],1,-0)<0;ore({target:"Array",proto:!0,forced:cre||!sre("indexOf")},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return cre?ure(this,e,t)||0:are(this,e,t)}});var lre=dre&&!function(){var e="_localstorage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(kye){return!0}}();function dre(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(kye){return!1}}var hre={length:lre?localStorage.length:0,clear:function(e){try{for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}}catch(Sye){}},getItem:function(e){try{return localStorage.getItem(e)}catch(Sye){return null}},key:function(e){try{return localStorage.key(e)}catch(Sye){return null}},setItem:function(e,t){try{localStorage.setItem(e,t)}catch(Sye){}},removeItem:function(e){try{localStorage.removeItem(e)}catch(Sye){}},isSupport:lre},fre="video",pre="appendBuffer",mre="removeBuffer",yre="mse_error",vre="updateend",gre="mse_open",bre="mse_open_done",Are=function(e){!function(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&&Aj(e,t)}(o,e);var t,n,r,i=wj(o);function o(e,t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(n=i.call(this)).mediaSource=new window.MediaSource(e),n.url=window.URL.createObjectURL(n.mediaSource),n.queue=[],n._hasDestroyed=!1,n._onSourceOpen=n._onSourceOpen.bind(_j(n)),n._onSourceBufferError=n._onSourceBufferError.bind(_j(n)),n._onSourceBufferUpdateEnd=n._onSourceBufferUpdateEnd.bind(_j(n)),n._mseStart=_re(),n._appendStart=-1,n.mediaSource.addEventListener("sourceopen",n._onSourceOpen),n.opQueues={},n.sourceBuffers={},n.updateHanders={},n.errorHandlers={},n.logger=t||function(){},n._sourceOpenDonePromise=new K2,n._mseAppendFlag=!1,n._mseOpenTime=-1,n.mseFullFlag={},n}return t=o,n=[{key:"init",value:function(){var e,t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(n={mimeType:"video/mp4",codec:'video/mp4; codecs="avc1.64001E, mp4a.40.5"'},(t=fre)in(e={})?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e);return this.contentTypes=r,this._sourceOpenDonePromise}},{key:"_onSourceOpen",value:function(){var e=this;this._mseOpenTime=_re()-this._mseStart,console.log("[mseOpen]==> costtime",this._mseOpenTime),this.mediaSource.removeEventListener("sourceopen",this._onSourceOpen),this.emit(gre,{costtime:this._mseOpenTime});for(var t=Object.keys(this.contentTypes),n=0;n<t.length;n++)try{!function(){var r=t[n],i=e.contentTypes[r].codec,o=e.mediaSource.addSourceBuffer(i),a=function(){return e._onSourceBufferError(r)};o.addEventListener("error",a);var s=function(){return e._onSourceBufferUpdateEnd(r)};o.addEventListener("updateend",s),e.updateHanders={},e.sourceBuffers[r]=o,e.opQueues[r]=[],e.updateHanders[r]=s,e.errorHandlers[r]=a}()}catch(Sye){Sye.errtype="open_error",this.emit(yre,Sye)}this.logger("[debug mse] mse init ready, readyState",this.mediaSource.readyState),this._mseAppendFlag=!0,this.emit(bre,{costtime:_re()-this._mseStart}),this._sourceOpenDonePromise.resolve()}},{key:"ready",get:function(){return this._mseAppendFlag}},{key:"_onSourceBufferError",value:function(e){if(!this._hasDestroyed){this.logger("[debug mse] sourceBuffer error, contentType",e,"readyState",this.mediaSource.readyState);var t=this.opQueues[e][0];this.emit(yre,{errtype:"append_error",name:t.name,context:t.context})}}},{key:"_onSourceBufferUpdateEnd",value:function(e){if(!this._hasDestroyed){var t=this.opQueues[e][0];t&&(this.emit(vre,{name:t.name,context:t.context,costtime:_re()-this._appendStart}),this.pop(e))}}},{key:"state",get:function(){return this.mediaSource.readyState}},{key:"duration",get:function(){return this.mediaSource.duration}},{key:"setDuration",value:function(e){var t=this;this.mediaSource.duration>e||this.enqueueBlockOp((function(){t.ended()?t.logger("[debug mse] setDuration ended"):(t.logger("[debug mse] setDuration"),t.mediaSource.duration=e)}),"setDuration")}},{key:"appendBuffer",value:function(e,t,n){var r=this;return this.enqueueOp(e,(function(){return r._append(e,t,n)}),pre,n)}},{key:"_append",value:function(e,t,n){this._appendStart=_re(),this.logger("[real appendBuffer], context,",n),this.sourceBuffers[e].appendBuffer(t)}},{key:"enqueueOp",value:function(e,t,n,r){var i=this;if(!this._hasDestroyed){var o={handler:t,context:r,name:n};return this._mseAppendFlag?this._enQueue(e,o):this._sourceOpenDonePromise.then((function(){i._hasDestroyed||i._enQueue(e,o)})),o.p}}},{key:"_enQueue",value:function(e,t){this.opQueues[e]||(this.opQueues[e]=[]),this.mseFullFlag[e]&&t.name===mre?(this.opQueues[e].splice(0,0,t),this.mseFullFlag[e]=!1,this.handleOp(e)):(this.opQueues[e].push(t),1===this.opQueues[e].length&&this.handleOp(e))}},{key:"enqueueBlockOp",value:function(e,t){var n=this;this._hasDestroyed||this._sourceOpenDonePromise.then((function(){if(!n._hasDestroyed){for(var r=[],i=Object.keys(n.contentTypes),o=function(e){var o=i[e],a=new K2,s={handler:function(){return a.resolve()},p:a,name:t};n.opQueues[o]||(n.opQueues[o]=[]),n.opQueues[o].push(s),r.push(a),1===n.opQueues[o].length&&s.handler()},a=0;a<i.length;a++)o(a);Promise.all(r).then((function(){try{e()}catch(kye){console.log(kye)}finally{for(var t=0;t<i.length;t++){var r=i[t];n.pop(r)}}})).catch((function(e){console.log("waiting cath",e)}))}}))}},{key:"isFull",value:function(e){return e?this.mseFullFlag[e]:this.mseFullFlag[fre]}},{key:"handleOp",value:function(e){if(!this._hasDestroyed){var t=this.opQueues[e][0];if(t&&!this.mseFullFlag[e])try{t.handler()}catch(Sye){Sye&&Sye.message.indexOf("SourceBuffer is full")>=0?(this.mseFullFlag[e]=!0,this.logger("[MSE error], context,",t.context,",name,",t.name,",err,SourceBuffer is full")):this.pop(e),this.emit(yre,{errtype:"append_error",context:t.context,errMsg:Sye?Sye.message:null})}}}},{key:"pop",value:function(e){this._hasDestroyed||(this.opQueues[e].shift(),this.handleOp(e))}},{key:"clearOpqueues",value:function(e){var t,n=[];if(this.opQueues[e].map((function(e){e.context.isinit&&n.push(e)})),this.opQueues&&this.opQueues[e]&&this.opQueues[e].length>1)if(this.opQueues[e][0].name===pre||this.opQueues[e][0].name===mre)this.logger("[debug mse] clearOpqueues, left:",1,", len,",this.opQueues[e].length),this.opQueues[e]=this.opQueues[e].slice(0,1);else{var r=Math.min(this.opQueues[e].length,Object.keys(this.contentTypes).length);this.logger("[debug mse] clearOpqueues, left:",r,", len,",this.opQueues[e].length),this.opQueues[e]=this.opQueues[e].slice(0,r)}n.length>0&&(t=this.opQueues[e]).push.apply(t,n)}},{key:"removeBuffer",value:function(e,t,n,r){var i=this;return this.enqueueOp(e,(function(){return i._remove(e,t,n,r)}),mre,r)}},{key:"_remove",value:function(e,t,n,r){n<=t?this._onSourceBufferUpdateEnd(e):(this.logger("[debug mse],real removeBuffer, context,",r),this._appendStart=_re(),this.sourceBuffers[e].remove(t,n))}},{key:"endOfStream",value:function(){var e=this;this._hasDestroyed||this.ended()||this.enqueueBlockOp((function(){e._hasDestroyed||e.ended()||(e.logger("[debug mse] endOfStream"),e.mediaSource.endOfStream())}),"endOfStream")}},{key:"ended",value:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"isMediaSourceOpen",value:function(){return!!this.mediaSource&&"open"===this.mediaSource.readyState}},{key:"abort",value:function(e){var t=this;return this.isMediaSourceOpen()?this.enqueueOp(e,(function(){t.sourceBuffers[e].abort(),t._onSourceBufferUpdateEnd(e)}),"abort"):Promise.resolve()}},{key:"reuse",value:function(e,t){for(var n=Object.keys(this.contentTypes),r=0;r<n.length;r++){var i=n[r];this.removeBuffer(i,e,t,{start:e,end:t})}}},{key:"_forceAbort",value:function(){try{for(var e=Object.keys(this.contentTypes),t=0;t<e.length;t++){var n=e[t];this.sourceBuffers[n].abort()}}catch(Sye){console.log("forceAbort error")}}},{key:"destroy",value:function(){if(this.logger("[debug mse] destroy execute"),!this._hasDestroyed){this._forceAbort(),this._hasDestroyed=!0,window.URL.revokeObjectURL(this.url),this.mediaSource&&(this.mediaSource.removeEventListener("sourceclose",this._onMediaSourceClose),this.mediaSource.removeEventListener("sourceopen",this._onSourceOpen));for(var e=Object.keys(this.contentTypes),t=0;t<e.length;t++){var n=e[t],r=this.sourceBuffers[n];if(r){var i=this.errorHandlers[n];r.removeEventListener("error",i);var o=this.updateHanders[n];r.removeEventListener("updateend",o)}}this.opQueues={},this.sourceBuffers={}}}},{key:"buffered",value:function(e){return this.sourceBuffers[e]&&this.sourceBuffers[e].buffered}},{key:"sourceBuffer",value:function(e){return this.sourceBuffers[e]}},{key:"removeSourceBuffer",value:function(e){var t=this.sourceBuffer(e);if(t){this.mediaSource.removeSourceBuffer(t);var n=this.errorHandlers[e];t.removeEventListener("error",n);var r=this.updateHanders[e];t.removeEventListener("updateend",r),delete this.errorHandlers[e],delete this.sourceBuffers[e],delete this.updateHanders[e]}}},{key:"setTimeoffset",value:function(e,t){var n=this;return this.enqueueOp(e,(function(){t<0&&(t+=.001),n.sourceBuffers[e].timestampOffset=t,n._onSourceBufferUpdateEnd(e)}),"setTimeoffset")}}],r=[{key:"isSupported",value:function(e){return window.MediaSource&&window.MediaSource.isTypeSupported(e)}}],n&&gj(t.prototype,n),r&&gj(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(P),_re=function(){try{return parseInt(performance.now(),10)}catch(kye){return(new Date).getTime()}},wre=Py,Sre=mp,kre=Nl,Tre=th,xre=Ym,Ere=Cp,Lre=pA,Ire=iI.ArrayBuffer,Rre=iI.DataView,Zre=Rre.prototype,Cre=Sre(Ire.prototype.slice),Pre=Sre(Zre.getUint8),Gre=Sre(Zre.setUint8);wre({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:kre((function(){return!new Ire(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(Cre&&void 0===t)return Cre(Tre(this),e);for(var n=Tre(this).byteLength,r=xre(e,n),i=xre(void 0===t?n:t,n),o=new(Lre(this,Ire))(Ere(i-r)),a=new Rre(this),s=new Rre(o),u=0;r<i;)Gre(s,u++,Pre(a,r++));return o}}),function(e,t,n){var r=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=r?"set":"add",a=cF[e],s=a&&a.prototype,u=a,c={},l=function(e){var t=lF(s[e]);hF(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!gF(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!gF(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!gF(e))&&t(this,0===e?0:e)}:function(e,n){return t(this,0===e?0:e,n),this})};if(dF(e,!yF(a)||!(i||s.forEach&&!bF((function(){(new a).entries().next()})))))u=n.getConstructor(t,e,r,o),fF.enable();else if(dF(e,!0)){var d=new u,h=d[o](i?{}:-0,1)!=d,f=bF((function(){d.has(1)})),p=AF((function(e){new a(e)})),m=!i&&bF((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));p||((u=t((function(e,t){mF(e,s);var n=wF(new a,e,u);return vF(t)||pF(t,n[o],{that:n,AS_ENTRIES:r}),n}))).prototype=s,s.constructor=u),(f||m)&&(l("delete"),l("has"),r&&l("get")),(m||h)&&l(o),i&&s.clear&&delete s.clear}c[e]=u,uF({global:!0,constructor:!0,forced:u!=a},c),_F(u,e),i||n.setStrong(u,e,r)}("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),VF);var Dre,Mre={};Object.defineProperty(Mre,"__esModule",{value:!0}),Mre.default=function(e){for(var t=0,n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=!0,a=!1,s=void 0;try{for(var u,c=r[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){t+=u.value.length}}catch(g){a=!0,s=g}finally{try{!o&&c.return&&c.return()}finally{if(a)throw s}}var l=new e(t),d=0,h=!0,f=!1,p=void 0;try{for(var m,y=r[Symbol.iterator]();!(h=(m=y.next()).done);h=!0){var v=m.value;l.set(v,d),d+=v.length}}catch(g){f=!0,p=g}finally{try{!h&&y.return&&y.return()}finally{if(f)throw p}}return l};var Vre=Z(((Dre=Mre)&&Dre.__esModule?Dre:{default:Dre}).default);function Xre(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wre(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ore(e,t,n){return t&&Wre(e.prototype,t),n&&Wre(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Nre(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ure(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(u){s=!0,i=u}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(e,t)||Yre(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 Fre(e){return function(e){if(Array.isArray(e))return Kre(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Yre(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 Yre(e,t){if(e){if("string"==typeof e)return Kre(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kre(e,t):void 0}}function Kre(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var jre="video",Hre="audio",Bre="metadata",Jre="avc",zre="hevc",Qre="aac",qre="g7110a",$re="g7110m",eie=function(){function e(){Xre(this,e),Nre(this,"id",1),Nre(this,"type",jre),Nre(this,"codecType",Jre),Nre(this,"pid",-1),Nre(this,"hvcC",void 0),Nre(this,"codec",""),Nre(this,"timescale",0),Nre(this,"formatTimescale",0),Nre(this,"sequenceNumber",0),Nre(this,"baseMediaDecodeTime",0),Nre(this,"baseDts",0),Nre(this,"duration",0),Nre(this,"warnings",[]),Nre(this,"samples",[]),Nre(this,"pps",[]),Nre(this,"sps",[]),Nre(this,"vps",[]),Nre(this,"fpsNum",0),Nre(this,"fpsDen",0),Nre(this,"sarRatio",[]),Nre(this,"width",0),Nre(this,"height",0),Nre(this,"nalUnitSize",4),Nre(this,"present",!1),Nre(this,"isVideoEncryption",!1),Nre(this,"isAudioEncryption",!1),Nre(this,"kid",null),Nre(this,"pssh",null),Nre(this,"ext",void 0)}return Ore(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:"exist",value:function(){return!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}}]),e}(),tie=function(){function e(){Xre(this,e),Nre(this,"id",2),Nre(this,"type",Hre),Nre(this,"codecType",Qre),Nre(this,"pid",-1),Nre(this,"codec",""),Nre(this,"sequenceNumber",0),Nre(this,"sampleDuration",0),Nre(this,"timescale",0),Nre(this,"formatTimescale",0),Nre(this,"baseMediaDecodeTime",0),Nre(this,"duration",0),Nre(this,"warnings",[]),Nre(this,"samples",[]),Nre(this,"baseDts",0),Nre(this,"sampleSize",16),Nre(this,"sampleRate",0),Nre(this,"channelCount",0),Nre(this,"objectType",0),Nre(this,"sampleRateIndex",0),Nre(this,"config",[]),Nre(this,"present",!1),Nre(this,"isVideoEncryption",!1),Nre(this,"isAudioEncryption",!1),Nre(this,"kid",null),Nre(this,"ext",void 0)}return Ore(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.codecType===Qre)}},{key:"hasSample",value:function(){return!!this.samples.length}}]),e}(),nie=function(){function e(t,n,r){Xre(this,e),Nre(this,"flag",{}),Nre(this,"keyframe",!1),Nre(this,"gopId",0),Nre(this,"duration",0),Nre(this,"size",0),Nre(this,"units",[]),Nre(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=n,r&&(this.units=r)}return Ore(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}(),rie=Ore((function e(t,n,r,i){Xre(this,e),Nre(this,"duration",1024),Nre(this,"flag",{dependsOn:2,isNonSyncSample:0}),Nre(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=n,this.size=n.byteLength,this.sampleOffset=i,r&&(this.duration=r)})),iie=function(){function e(){Xre(this,e),Nre(this,"id",3),Nre(this,"type",Bre),Nre(this,"timescale",0),Nre(this,"flvScriptSamples",[]),Nre(this,"seiSamples",[])}return Ore(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}(),oie="undefined"!=typeof window,aie=oie&&navigator.userAgent.toLocaleLowerCase(),sie=oie&&aie.includes("firefox"),uie=oie&&aie.includes("android"),cie=function(){function e(){Xre(this,e)}return Ore(e,null,[{key:"getRateIndexByRate",value:function(t){return e.FREQ.indexOf(t)}},{key:"parseADTS",value:function(t,n){for(var r=t.length,i=0;i+2<r&&(255!==t[i]||240!=(246&t[i+1]));)i++;if(!(i>=r)){var o=i,a=[],s=(60&t[i+2])>>>2,u=e.FREQ[s];if(!u)throw new Error("Invalid sampling index: ".concat(s));for(var c,l,d=1+((192&t[i+2])>>>6),h=(1&t[i+2])<<2|(192&t[i+3])>>>6,f=e._getConfig(s,h,d),p=f.config,m=f.codec,y=0,v=e.getFrameDuration(u);i+7<r;)if(255===t[i]&&240==(246&t[i+1])){if(r-i<(l=(3&t[i+3])<<11|t[i+4]<<3|(224&t[i+5])>>5))break;c=2*(1&~t[i+1]),a.push({pts:n+y*v,data:t.subarray(i+7+c,i+l)}),y++,i+=l}else i++;return{skip:o,remaining:i>=r?void 0:t.subarray(i),frames:a,samplingFrequencyIndex:s,sampleRate:u,objectType:d,channelCount:h,codec:m,config:p,originCodec:"mp4a.40.".concat(d)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var n=t[0]>>>3,r=(7&t[0])<<1|t[1]>>>7,i=(120&t[1])>>>3,o=e.FREQ[r];if(!o)throw new Error("Invalid sampling index: ".concat(r));var a=e._getConfig(r,i,n);return{samplingFrequencyIndex:r,sampleRate:o,objectType:n,channelCount:i,config:a.config,codec:a.codec,originCodec:"mp4a.40.".concat(n)}}}},{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,n){var r,i,o=[];return sie?e>=6?(r=5,i=e-3):(r=2,i=e):uie?(r=2,i=e):(r=2===n||5===n?n:5,i=e,e>=6?i=e-3:1===t&&(r=2,i=e)),o[0]=r<<3,o[0]|=(14&e)>>1,o[1]=(1&e)<<7,o[1]|=t<<3,5===r&&(o[1]|=(14&i)>>1,o[2]=(1&i)<<7,o[2]|=8,o[3]=0),{config:o,codec:"mp4a.40.".concat(r)}}},{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}();function lie(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t=t.filter(Boolean);var r=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){r.set(e,i),i+=e.byteLength})),r}Nre(cie,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var die=Math.pow(2,32);function hie(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function fie(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 pie(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return fie(e,t)*die+fie(e,t+4)}function mie(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 n=32-t.length,r=0;r<n;r++)t+="0";return t}function yie(e){if(!Array.isArray(e)){for(var t=[],n="",r=0;r<e.length;r++)r%2&&(n=e[r-1]+e[r],t.push(parseInt(n,16)),n="");return t}return e.map((function(e){return parseInt(e,16)}))}var vie=function(){function e(){Xre(this,e)}return Ore(e,null,[{key:"findBox",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[];if(!t)return i;for(var o=0,a="",s=0;t.length>7;){if(o=fie(t),a=String.fromCharCode.apply(null,t.subarray(4,8)),s=8,1===o?(o=pie(t,8),s+=8):o||(o=t.length),!n[0]||a===n[0]){var u=t.subarray(0,o);if(!(n.length<2))return e.findBox(u.subarray(s),n.slice(1),r+s);i.push({start:r,size:o,headerSize:s,type:a,data:u})}r+=o,t=t.subarray(o)}return i}},{key:"tfhd",value:function(e){return _ie(e,!0,(function(e,t){e.trackId=fie(t);var n=4,r=1&e.flags,i=2&e.flags,o=8&e.flags,a=16&e.flags,s=32&e.flags;r&&(n+=4,e.baseDataOffset=fie(t,n),n+=4),i&&(e.sampleDescriptionIndex=fie(t,n),n+=4),o&&(e.defaultSampleDuration=fie(t,n),n+=4),a&&(e.defaultSampleSize=fie(t,n),n+=4),s&&(e.defaultSampleFlags=fie(t,n))}))}},{key:"sidx",value:function(e){return _ie(e,!0,(function(e,t){var n=0;e.reference_ID=fie(t,n),n+=4,e.timescale=fie(t,n),n+=4,0===e.version?(e.earliest_presentation_time=fie(t,n),n+=4,e.first_offset=fie(t,n),n+=4):(e.earliest_presentation_time=pie(t,n),n+=8,e.first_offset=pie(t,n),n+=8),n+=2,e.references=[];var r=hie(t,n);n+=2;for(var i=0;i<r;i++){var o={};e.references.push(o);var a=fie(t,n);n+=4,o.reference_type=a>>31&1,o.referenced_size=2147483647&a,o.subsegment_duration=fie(t,n),a=fie(t,n+=4),n+=4,o.starts_with_SAP=a>>31&1,o.SAP_type=a>>28&7,o.SAP_delta_time=268435455&a}}))}},{key:"moov",value:function(t){return _ie(t,!1,(function(t,n,r){t.mvhd=e.mvhd(e.findBox(n,["mvhd"],r)[0]),t.trak=e.findBox(n,["trak"],r).map((function(t){return e.trak(t)})),t.pssh=e.pssh(e.findBox(n,["pssh"],r)[0])}))}},{key:"mvhd",value:function(e){return _ie(e,!0,(function(e,t){var n=0;1===e.version?(e.timescale=fie(t,16),e.duration=pie(t,20),n+=28):(e.timescale=fie(t,8),e.duration=fie(t,12),n+=16),e.nextTrackId=fie(t,n+76)}))}},{key:"trak",value:function(t){return _ie(t,!1,(function(t,n,r){t.tkhd=e.tkhd(e.findBox(n,["tkhd"],r)[0]),t.mdia=e.mdia(e.findBox(n,["mdia"],r)[0])}))}},{key:"tkhd",value:function(e){return _ie(e,!0,(function(e,t){var n=0;1===e.version?(e.trackId=fie(t,16),e.duration=pie(t,24),n+=32):(e.trackId=fie(t,8),e.duration=fie(t,16),n+=20),e.width=fie(t,n+52),e.height=fie(t,n+56)}))}},{key:"mdia",value:function(t){return _ie(t,!1,(function(t,n,r){t.mdhd=e.mdhd(e.findBox(n,["mdhd"],r)[0]),t.hdlr=e.hdlr(e.findBox(n,["hdlr"],r)[0]),t.minf=e.minf(e.findBox(n,["minf"],r)[0])}))}},{key:"mdhd",value:function(e){return _ie(e,!0,(function(e,t){var n=0;1===e.version?(e.timescale=fie(t,16),e.duration=pie(t,20),n+=28):(e.timescale=fie(t,8),e.duration=fie(t,12),n+=16);var r=hie(t,n);e.language=String.fromCharCode(96+(r>>10&31),96+(r>>5&31),96+(31&r))}))}},{key:"hdlr",value:function(e){return _ie(e,!0,(function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}},{key:"minf",value:function(t){return _ie(t,!1,(function(t,n,r){t.vmhd=e.vmhd(e.findBox(n,["vmhd"],r)[0]),t.smhd=e.smhd(e.findBox(n,["smhd"],r)[0]),t.stbl=e.stbl(e.findBox(n,["stbl"],r)[0])}))}},{key:"vmhd",value:function(e){return _ie(e,!0,(function(e,t){e.graphicsmode=hie(t),e.opcolor=[hie(t,2),hie(t,4),hie(t,6)]}))}},{key:"smhd",value:function(e){return _ie(e,!0,(function(e,t){e.balance=hie(t)}))}},{key:"stbl",value:function(t){return _ie(t,!1,(function(t,n,r){t.stsd=e.stsd(e.findBox(n,["stsd"],r)[0]),t.stts=e.stts(e.findBox(n,["stts"],r)[0]),t.ctts=e.ctts(e.findBox(n,["ctts"],r)[0]),t.stsc=e.stsc(e.findBox(n,["stsc"],r)[0]),t.stsz=e.stsz(e.findBox(n,["stsz"],r)[0]),t.stco=e.stco(e.findBox(n,["stco"],r)[0]),t.stco||(t.co64=e.co64(e.findBox(n,["co64"],r)[0]),t.stco=t.co64),t.stss=e.stss(e.findBox(n,["stss"],r)[0]),t.senc=e.senc(e.findBox(n,["senc"],r)[0])}))}},{key:"senc",value:function(e){return _ie(e,!0,(function(e,t){var n=0,r=fie(t,n);n+=4,e.samples=[];for(var i=0;i<r;i++){var o={};if(o.InitializationVector=[t[n],t[n+1],t[n+2],t[n+3],t[n+4],t[n+5],t[n+6],t[n+7]],n+=8,2&e.flags){o.subsamples=[];var a=hie(t,n);n+=2;for(var s=0;s<a;s++){var u={};u.BytesOfClearData=hie(t,n),n+=2,u.BytesOfProtectedData=fie(t,n),n+=4,o.subsamples.push(u)}}e.samples.push(o)}}))}},{key:"pssh",value:function(e){return _ie(e,!0,(function(e,t){for(var n=[],r=[],i=0,o=0;o<16;o++)r.push(wie(t[i+o]));if(i+=16,e.version>0){var a=fie(t,i);i+=4;for(var s=0;s<(""+a).length;s++)for(var u=0;u<16;u++){var c=t[i];i+=1,n.push(wie(c))}}var l=fie(t,i);e.data_size=l,i+=4,e.kid=n,e.system_id=r,e.buffer=t}))}},{key:"stsd",value:function(t){return _ie(t,!0,(function(t,n,r){t.entryCount=fie(n),t.entries=e.findBox(n.subarray(4),[],r+4).map((function(t){switch(t.type){case"avc1":case"avc2":case"avc3":case"avc4":return e.avc1(t);case"hvc1":case"hev1":return e.hvc1(t);case"mp4a":return e.mp4a(t);case"alaw":case"ulaw":return e.alaw(t);case"enca":return _ie(t,!1,(function(t,n,r){t.channelCount=hie(n,16),t.samplesize=hie(n,18),t.sampleRate=fie(n,24)/65536,n=n.subarray(28),t.sinf=e.sinf(e.findBox(n,["sinf"],r)[0]),t.esds=e.esds(e.findBox(n,["esds"],r)[0])}));case"encv":return _ie(t,!1,(function(t,n,r){t.width=hie(n,24),t.height=hie(n,26),t.horizresolution=fie(n,28),t.vertresolution=fie(n,32),n=n.subarray(78),t.sinf=e.sinf(e.findBox(n,["sinf"],r)[0]),t.avcC=e.avcC(e.findBox(n,["avcC"],r)[0]),t.hvcC=e.hvcC(e.findBox(n,["hvcC"],r)[0]),t.pasp=e.pasp(e.findBox(n,["pasp"],r)[0])}))}})).filter(Boolean)}))}},{key:"tenc",value:function(e){return _ie(e,!1,(function(e,t){var n=6;e.default_IsEncrypted=t[n],n+=1,e.default_IV_size=t[n],n+=1,e.default_KID=[];for(var r=0;r<16;r++)e.default_KID.push(wie(t[n])),n+=1}))}},{key:"schi",value:function(t){return _ie(t,!1,(function(t,n,r){t.tenc=e.tenc(e.findBox(n,["tenc"],r)[0])}))}},{key:"sinf",value:function(t){return _ie(t,!1,(function(t,n,r){t.schi=e.schi(e.findBox(n,["schi"],r)[0]),t.frma=e.frma(e.findBox(n,["frma"],r)[0])}))}},{key:"frma",value:function(e){return _ie(e,!1,(function(e,t){e.data_format="";for(var n=0;n<4;n++)e.data_format+=String.fromCharCode(t[n])}))}},{key:"avc1",value:function(t){return _ie(t,!1,(function(t,n,r){var i=bie(t,n),o=n.subarray(i);r+=i,t.avcC=e.avcC(e.findBox(o,["avcC"],r)[0]),t.pasp=e.pasp(e.findBox(o,["pasp"],r)[0])}))}},{key:"avcC",value:function(e){return _ie(e,!1,(function(e,t){e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=function(e){for(var t,n="avc1.",r=0;r<3;r++)(t=e[r].toString(16)).length<2&&(t="0".concat(t)),n+=t;return n}([t[1],t[2],t[3]]),e.lengthSizeMinusOne=3&t[4],e.spsLength=31&t[5],e.sps=[];for(var n=6,r=0;r<e.spsLength;r++){var i=hie(t,n);n+=2,e.sps.push(t.subarray(n,n+i)),n+=i}e.ppsLength=t[n],n+=1,e.pps=[];for(var o=0;o<e.ppsLength;o++){var a=hie(t,n);n+=2,e.pps.push(t.subarray(n,n+=a)),n+=a}}))}},{key:"hvc1",value:function(t){return _ie(t,!1,(function(t,n,r){var i=bie(t,n),o=n.subarray(i);r+=i,t.hvcC=e.hvcC(e.findBox(o,["hvcC"],r)[0]),t.pasp=e.pasp(e.findBox(o,["pasp"],r)[0])}))}},{key:"hvcC",value:function(e){return _ie(e,!1,(function(t,n){t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=n[0];var r=n[1];t.generalProfileSpace=r>>6,t.generalTierFlag=(32&r)>>5,t.generalProfileIdc=31&r,t.generalProfileCompatibility=fie(n,2),t.generalConstraintIndicatorFlags=n.subarray(6,12),t.generalLevelIdc=n[12],t.avgFrameRate=hie(n,19),t.numOfArrays=n[22],t.vps=[],t.sps=[],t.pps=[];for(var i=23,o=0,a=0,s=0,u=0;u<t.numOfArrays;u++){o=63&n[i],a=hie(n,i+1),i+=3;for(var c,l=[],d=0;d<a;d++)s=hie(n,i),i+=2,l.push(n.subarray(i,i+s)),i+=s;if(32===o)(c=t.vps).push.apply(c,l);else if(33===o){var h;(h=t.sps).push.apply(h,l)}else if(34===o){var f;(f=t.pps).push.apply(f,l)}}}))}},{key:"pasp",value:function(e){return _ie(e,!1,(function(e,t){e.hSpacing=fie(t),e.vSpacing=fie(t,4)}))}},{key:"mp4a",value:function(t){return _ie(t,!1,(function(t,n,r){var i=Aie(t,n);t.esds=e.esds(e.findBox(n.subarray(i),["esds"],r+i)[0])}))}},{key:"esds",value:function(e){return _ie(e,!0,(function(e,t){e.codec="mp4a.";for(var n=0,r=0,i=0,o=0;t.length;){for(o=t[n=0],r=t[n+1],n+=2;128&r;)i=(127&r)<<7,r=t[n],n+=1;if(i+=127&r,3===o)t=t.subarray(n+3);else{if(4!==o){if(5===o){var a=e.config=t.subarray(n,n+i),s=(248&a[0])>>3;return 31===s&&a.length>=2&&(s=32+((7&a[0])<<3)+((224&a[1])>>5)),e.objectType=s,e.codec+=s.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[n].toString(16)+".").padStart(3,"0"),t=t.subarray(n+13)}}}))}},{key:"alaw",value:function(e){return _ie(e,!1,(function(e,t){Aie(e,t)}))}},{key:"stts",value:function(e){return _ie(e,!0,(function(e,t){for(var n=fie(t),r=[],i=4,o=0;o<n;o++)r.push({count:fie(t,i),delta:fie(t,i+4)}),i+=8;e.entryCount=n,e.entries=r}))}},{key:"ctts",value:function(e){return _ie(e,!0,(function(e,t){var n=fie(t),r=[],i=4;if(1===e.version)for(var o=0;o<n;o++)r.push({count:fie(t,i),offset:fie(t,i+4)}),i+=8;else for(var a=0;a<n;a++)r.push({count:fie(t,i),offset:-(1+~fie(t,i+4))}),i+=8;e.entryCount=n,e.entries=r}))}},{key:"stsc",value:function(e){return _ie(e,!0,(function(e,t){for(var n=fie(t),r=[],i=4,o=0;o<n;o++)r.push({firstChunk:fie(t,i),samplesPerChunk:fie(t,i+4),sampleDescriptionIndex:fie(t,i+8)}),i+=12;e.entryCount=n,e.entries=r}))}},{key:"stsz",value:function(e){return _ie(e,!0,(function(e,t){var n=fie(t),r=fie(t,4),i=[];if(!n)for(var o=8,a=0;a<r;a++)i.push(fie(t,o)),o+=4;e.sampleSize=n,e.sampleCount=r,e.entrySizes=i}))}},{key:"stco",value:function(e){return _ie(e,!0,(function(e,t){for(var n=fie(t),r=[],i=4,o=0;o<n;o++)r.push(fie(t,i)),i+=4;e.entryCount=n,e.entries=r}))}},{key:"co64",value:function(e){return _ie(e,!0,(function(e,t){for(var n=fie(t),r=[],i=4,o=0;o<n;o++)r.push(pie(t,i)),i+=8;e.entryCount=n,e.entries=r}))}},{key:"stss",value:function(e){return _ie(e,!0,(function(e,t){for(var n=fie(t),r=[],i=4,o=0;o<n;o++)r.push(fie(t,i)),i+=4;e.entryCount=n,e.entries=r}))}},{key:"moof",value:function(t){return _ie(t,!1,(function(t,n,r){t.mfhd=e.mfhd(e.findBox(n,["mfhd"],r)[0]),t.traf=e.findBox(n,["traf"],r).map((function(t){return e.traf(t)}))}))}},{key:"mfhd",value:function(e){return _ie(e,!0,(function(e,t){e.sequenceNumber=fie(t)}))}},{key:"traf",value:function(t){return _ie(t,!1,(function(t,n,r){t.tfhd=e.tfhd(e.findBox(n,["tfhd"],r)[0]),t.tfdt=e.tfdt(e.findBox(n,["tfdt"],r)[0]),t.trun=e.trun(e.findBox(n,["trun"],r)[0])}))}},{key:"trun",value:function(e){return _ie(e,!0,(function(e,t){var n=e.version,r=e.flags,i=t.length,o=e.sampleCount=fie(t),a=4;if(i>a&&1&r&&(e.dataOffset=-(1+~fie(t,a)),a+=4),i>a&&4&r&&(e.firstSampleFlags=fie(t,a),a+=4),e.samples=[],i>a)for(var s,u=0;u<o;u++)s={},256&r&&(s.duration=fie(t,a),a+=4),512&r&&(s.size=fie(t,a),a+=4),1024&r&&(s.flags=fie(t,a),a+=4),2048&r&&(s.cts=n?-(1+~fie(t,a+4)):fie(t,a),a+=4),e.samples.push(s)}))}},{key:"tfdt",value:function(e){return _ie(e,!0,(function(e,t){1===e.version?e.baseMediaDecodeTime=pie(t):e.baseMediaDecodeTime=fie(t)}))}},{key:"probe",value:function(t){return!!e.findBox(t,["ftyp"])}},{key:"parseSampleFlags",value:function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}},{key:"moovToTrack",value:function(e,t,n){var r,i,o=e.trak;if(o&&o.length){var a=o.find((function(e){var t,n;return"vide"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)})),s=o.find((function(e){var t,n;return"soun"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)}));if(a&&t){var u,c,l,d,h,f,p,m=t,y=null===(u=a.tkhd)||void 0===u?void 0:u.trackId;null!=y&&(m.id=a.tkhd.trackId),m.tkhdDuration=a.tkhd.duration,m.mvhdDurtion=e.mvhd.duration,m.mvhdTimecale=e.mvhd.timescale,m.timescale=m.formatTimescale=a.mdia.mdhd.timescale,m.duration=a.mdia.mdhd.duration||m.mvhdDurtion/m.mvhdTimecale*m.timescale;var v,g,b,A,_,w,S,k,T=a.mdia.minf.stbl.stsd.entries[0];if(m.width=T.width,m.height=T.height,T.pasp&&(m.sarRatio=[T.pasp.hSpacing,T.pasp.vSpacing]),T.hvcC)m.codecType=zre,m.codec=T.hvcC.codec,m.vps=T.hvcC.vps,m.sps=T.hvcC.sps,m.pps=T.hvcC.pps,m.hvcC=T.hvcC.data;else{if(!T.avcC)throw new Error("unknown video stsd entry");m.codec=T.avcC.codec,m.sps=T.avcC.sps,m.pps=T.avcC.pps}if(m.present=!0,m.ext={},m.ext.stss=null===(c=a.mdia)||void 0===c||null===(l=c.minf)||void 0===l||null===(d=l.stbl)||void 0===d?void 0:d.stss,m.ext.ctts=null===(h=a.mdia)||void 0===h||null===(f=h.minf)||void 0===f||null===(p=f.stbl)||void 0===p?void 0:p.ctts,T&&"encv"===T.type)m.isVideoEncryption=!0,T.default_KID=null===(v=T.sinf)||void 0===v||null===(g=v.schi)||void 0===g?void 0:g.tenc.default_KID,T.default_IsEncrypted=null===(b=T.sinf)||void 0===b||null===(A=b.schi)||void 0===A?void 0:A.tenc.default_IsEncrypted,T.default_IV_size=null===(_=T.sinf)||void 0===_||null===(w=_.schi)||void 0===w?void 0:w.tenc.default_IV_size,m.videoSenc=a.mdia.minf.stbl.senc&&a.mdia.minf.stbl.senc.samples,T.data_format=null===(S=T.sinf)||void 0===S||null===(k=S.frma)||void 0===k?void 0:k.data_format,m.useEME=e.useEME,m.kidValue=e.kidValue,m.pssh=e.pssh,m.encv=T}if(s&&n){var x,E,L,I,R,Z,C,P,G,D=n,M=null===(x=s.tkhd)||void 0===x?void 0:x.trackId;null!=M&&(D.id=s.tkhd.trackId),D.tkhdDuration=s.tkhd.duration,D.mvhdDurtion=e.mvhd.duration,D.mvhdTimecale=e.mvhd.timescale,D.timescale=D.formatTimescale=s.mdia.mdhd.timescale,D.duration=s.mdia.mdhd.duration||D.mvhdDurtion/D.mvhdTimecale*D.timescale;var V,X,W,O,N,U,F,Y,K=s.mdia.minf.stbl.stsd.entries[0];switch(D.sampleSize=K.sampleSize,D.sampleRate=K.sampleRate,D.channelCount=K.channelCount,D.present=!0,K.type){case"alaw":D.codecType=D.codec=qre,D.sampleRate=8e3;break;case"ulaw":D.codecType=D.codec=$re,D.sampleRate=8e3;break;default:D.sampleDuration=cie.getFrameDuration(D.sampleRate,D.timescale),D.sampleRateIndex=cie.getRateIndexByRate(D.sampleRate),D.objectType=(null===(r=K.esds)||void 0===r?void 0:r.objectType)||2,K.esds&&(D.config=Array.from(K.esds.config)),D.codec=(null===(i=K.esds)||void 0===i?void 0:i.codec)||"mp4a.40.2"}if(D.sampleDuration=cie.getFrameDuration(D.sampleRate,D.timescale),D.objectType=(null===(E=K.esds)||void 0===E?void 0:E.objectType)||2,K.esds&&(K.esds.config?D.config=Array.from(K.esds.config):console.warn("esds config is null")),D.codec=(null===(L=K.esds)||void 0===L?void 0:L.codec)||"mp4a.40.2",D.sampleRateIndex=cie.getRateIndexByRate(D.sampleRate),D.ext={},D.ext.stss=null===(I=s.mdia)||void 0===I||null===(R=I.minf)||void 0===R||null===(Z=R.stbl)||void 0===Z?void 0:Z.stss,D.ext.ctts=null===(C=s.mdia)||void 0===C||null===(P=C.minf)||void 0===P||null===(G=P.stbl)||void 0===G?void 0:G.ctts,D.present=!0,K&&"enca"===K.type)D.isAudioEncryption=!0,K.data_format=null===(V=K.sinf)||void 0===V||null===(X=V.frma)||void 0===X?void 0:X.data_format,K.default_KID=null===(W=K.sinf)||void 0===W||null===(O=W.schi)||void 0===O?void 0:O.tenc.default_KID,K.default_IsEncrypted=null===(N=K.sinf)||void 0===N||null===(U=N.schi)||void 0===U?void 0:U.tenc.default_IsEncrypted,K.default_IV_size=null===(F=K.sinf)||void 0===F||null===(Y=F.schi)||void 0===Y?void 0:Y.tenc.default_IV_size,D.audioSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,D.useEME=e.useEME,D.kidValue=e.kidValue,D.enca=K}if(n&&(n.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!n&&n.isAudioEncryption),null!=t&&t.encv||null!=n&&n.enca){var j,H,B=null==t||null===(j=t.encv)||void 0===j?void 0:j.default_KID,J=null==n||null===(H=n.enca)||void 0===H?void 0:H.default_KID,z=B||J?(B||J).join(""):null;t&&(t.kid=z),n&&(n.kid=z)}return t&&(t.flags=3841),n&&(n.flags=1793),{videoTrack:t,audioTrack:n}}}},{key:"evaluateDefaultDuration",value:function(e,t,n){var r,i=null==t||null===(r=t.samples)||void 0===r?void 0:r.length;return i?1024*i/t.timescale*e.timescale/n:1024}},{key:"moofToSamples",value:function(t,n,r){var i={};return t.mfhd&&(n&&(n.sequenceNumber=t.mfhd.sequenceNumber),r&&(r.sequenceNumber=t.mfhd.sequenceNumber)),t.traf.forEach((function(t){var o=t.tfhd,a=t.tfdt,s=t.trun;if(o&&s){a&&(n&&n.id===o.trackId&&(n.baseMediaDecodeTime=a.baseMediaDecodeTime),r&&r.id===o.trackId&&(r.baseMediaDecodeTime=a.baseMediaDecodeTime));var u=o.defaultSampleSize||0,c=o.defaultSampleDuration||e.evaluateDefaultDuration(n,r,s.samples.length||s.sampleCount),l=s.dataOffset||0,d=0,h=-1;if(!s.samples.length&&s.sampleCount){i[o.trackId]=[];for(var f=0;f<s.sampleCount;f++)i[o.trackId].push({offset:l,dts:d,duration:c,size:u}),d+=c,l+=u}else i[o.trackId]=s.samples.map((function(e,t){return(e={offset:l,dts:d,pts:d+(e.cts||0),duration:e.duration||c,size:e.size||u,gopId:h,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(h++,e.gopId=h),d+=e.duration,l+=e.size,e}))}})),i}},{key:"moovToSamples",value:function(e){var t=e.trak;if(t&&t.length){var n=t.find((function(e){var t,n;return"vide"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)})),r=t.find((function(e){var t,n;return"soun"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)}));if(n||r){var i,o;if(n){var a,s,u=null===(a=n.mdia)||void 0===a||null===(s=a.minf)||void 0===s?void 0:s.stbl;if(!u)return;var c=u.stts,l=u.stsc,d=u.stsz,h=u.stco,f=u.stss,p=u.ctts;if(!(c&&l&&d&&h&&f))return;i=gie(c,l,d,h,p,f)}if(r){var m,y,v,g=null===(m=r.mdia)||void 0===m||null===(y=m.minf)||void 0===y?void 0:y.stbl;if(!g)return;var b=null===(v=r.mdia.mdhd)||void 0===v?void 0:v.timescale,A=g.stts,_=g.stsc,w=g.stsz,S=g.stco;if(!(b&&A&&_&&w&&S))return;o=gie(A,_,w,S)}return{videoSamples:i,audioSamples:o}}}}}]),e}();function gie(e,t,n,r,i,o){var a,s,u,c=[],l=null==i?void 0:i.entries,d=t.entries,h=r.entries,f=n.entrySizes,p=null==o?void 0:o.entries;p&&(a={},p.forEach((function(e){a[e-1]=!0}))),l&&(s=[],l.forEach((function(e){for(var t=e.count,n=e.offset,r=0;r<t;r++)s.push(n)})));var m=-1,y=0,v=0,g=0,b=0,A=0,_=d[0].samplesPerChunk,w=d[1]?d[1].firstChunk-1:1/0;return e.entries.forEach((function(e){for(var t=e.count,r=e.delta,i=0;i<t;i++)u={dts:y,duration:r,size:f[v]||n.sampleSize,offset:h[g]+A,index:v},p&&(u.keyframe=a[v],u.keyframe&&m++,u.gopId=m),s&&v<s.length&&(u.pts=u.dts+s[v]),c.push(u),y+=r,++v<_?A+=u.size:(g++,A=0,g>=w&&(b++,w=d[b+1]?d[b+1].firstChunk-1:1/0),_+=d[b].samplesPerChunk)})),c}function bie(e,t){return e.dataReferenceIndex=hie(t,6),e.width=hie(t,24),e.height=hie(t,26),e.horizresolution=fie(t,28),e.vertresolution=fie(t,32),e.frameCount=hie(t,40),e.depth=hie(t,74),78}function Aie(e,t){return e.dataReferenceIndex=hie(t,6),e.channelCount=hie(t,16),e.sampleSize=hie(t,18),e.sampleRate=fie(t,24)/65536,28}function _ie(e,t,n){if(e){if(e.size!==e.data.length)throw new Error("box ".concat(e.type," size !== data.length"));var r={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(r.version=e.data[e.headerSize],r.flags=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),r.headerSize+=4),n(r,e.data.subarray(r.headerSize),r.start+r.headerSize),r}}var wie=function(){for(var e=[],t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach((function(t){e.push(function(e,t,n){for(var r=String(n),i=t>>0,o=Math.ceil(i/r.length),a=[],s=String(e);o--;)a.push(r);return a.join("").substring(0,i-s.length)+s}(Number(t).toString(16),2,0))})),e[0]},Sie=function(){function e(){Xre(this,e),this.buffer=new Uint8Array(0)}return Ore(e,[{key:"write",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach((function(t){t?e.buffer=Vre(Uint8Array,e.buffer,t):window.console.warn(t)}))}}],[{key:"writeUint16",value:function(e){return new Uint8Array([e>>8&255,255&e])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}]),e}(),kie=Math.pow(2,32)-1,Tie=function(){function e(){Xre(this,e)}return Ore(e,null,[{key:"box",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=8+(n=n.filter(Boolean)).reduce((function(e,t){return e+t.byteLength}),0),o=new Uint8Array(i);o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=255&i,o.set(e,4);var a=8;return n.forEach((function(e){o.set(e,a),a+=e.byteLength})),o}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===jre&&e.codecType===zre}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return lie(e.ftyp(t),e.moov(t))}},{key:"pssh",value:function(t){var n=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],yie(t.kid),[0,0,0,0]));return e.box(e.types.pssh,n)}},{key:"moov",value:function(t){if(t[0].useEME&&(t[0].encv||t[0].enca)){t[0].pssh||(t[0].pssh={kid:t[0].kid});var n=this.pssh(t[0].pssh);return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale),e.mvex(t)].concat(Fre(t.map((function(t){return e.trak(t)}))),[n]))}return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale)].concat(Fre(t.map((function(t){return e.trak(t)}))),[e.mvex(t)]))}},{key:"mvhd",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mvhd,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,t>>24&255,t>>16&255,t>>8&255,255&t,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]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.tkhdDuration||0,t.width,t.height),e.mdia(t))}},{key:"tkhd",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,255&r,0,0,i>>8&255,255&i,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minf(t))}},{key:"mdhd",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;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,t>>24&255,t>>16&255,t>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"minf",value:function(t){return e.box(e.types.minf,t.type===jre?e.VMHD:e.SMHD,e.DINF,e.stbl(t))}},{key:"stbl",value:function(t){var n=[];return t&&t.ext&&t.ext.stss&&n.push(e.stss(t.ext.stss.entries)),e.box(e.types.stbl,e.stsd(t),e.STTS,n[0],e.STSC,e.STSZ,e.STCO)}},{key:"stsd",value:function(t){var n;return n="audio"===t.type?t.useEME&&t.enca?e.enca(t):e.mp4a(t):t.useEME&&t.encv?e.encv(t):e.avc1hev1(t),e.box(e.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),n)}},{key:"enca",value:function(t){var n=t.enca.channelCount,r=t.enca.sampleRate,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]),o=e.esds(t.config),a=e.sinf(t.enca);return e.box(e.types.enca,i,o,a)}},{key:"encv",value:function(t){var n,r,i=t.sps.length>0?t.sps[0]:[],o=t.pps.length>0?t.pps[0]:[],a=t.width,s=t.height,u=t.sarRatio[0],c=t.sarRatio[1],l=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,a>>8&255,255&a,s>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),d=new Uint8Array((n=(r=[1,i[1],i[2],i[3],255,225,i.length>>>8&255,255&i.length]).concat.apply(r,Fre(i)).concat([1,o.length>>>8&255,255&o.length])).concat.apply(n,Fre(o))),h=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),f=e.sinf(t.encv),p=new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,c>>24,c>>16&255,c>>8&255,255&c]);return e.box(e.types.encv,l,e.box(e.types.avcC,d),e.box(e.types.btrt,h),f,e.box(e.types.pasp,p))}},{key:"schi",value:function(t){var n=new Uint8Array([]),r=e.tenc(t);return e.box(e.types.schi,n,r)}},{key:"tenc",value:function(t){var n=new Uint8Array([0,0,0,0,0,0,255&t.default_IsEncrypted,255&t.default_IV_size].concat(yie(t.default_KID)));return e.box(e.types.tenc,n)}},{key:"sinf",value:function(t){var n=new Uint8Array([]),r=new Uint8Array([t.data_format.charCodeAt(0),t.data_format.charCodeAt(1),t.data_format.charCodeAt(2),t.data_format.charCodeAt(3)]),i=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),o=e.schi(t);return e.box(e.types.sinf,n,e.box(e.types.frma,r),e.box(e.types.schm,i),o)}},{key:"avc1hev1",value:function(t){var n=t.codecType===zre,r=n?e.types.hvc1:e.types.avc1,i=n?e.hvcC(t):e.avcC(t),o=[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,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,17,17]),i];return n?o.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&o.push(e.pasp(t.sarRatio)),e.box.apply(e,[r].concat(o))}},{key:"avcC",value:function(t){var n,r,i,o=[],a=[];return t.sps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,Fre(e))})),t.pps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,Fre(e))})),e.box(e.types.avcC,new Uint8Array((n=(r=[1,o[3],o[4],o[5],255,224|t.sps.length]).concat.apply(r,o).concat([t.pps.length])).concat.apply(n,a)))}},{key:"hvcC",value:function(t){var n=t.hvcC;if(n instanceof ArrayBuffer||n instanceof Uint8Array)return n;var r,i=t.vps,o=t.sps,a=t.pps;if(n){var s=n.generalProfileCompatibilityFlags,u=n.generalConstraintIndicatorFlags,c=(i.length&&1)+(o.length&&1)+(a.length&&1);r=[1,n.generalProfileSpace<<6|n.generalTierFlag<<5|n.generalProfileIdc,s>>>24,s>>>16,s>>>8,s,u[0],u[1],u[2],u[3],u[4],u[5],n.generalLevelIdc,240,0,252,252|n.chromaFormatIdc,248|n.bitDepthLumaMinus8,248|n.bitDepthChromaMinus8,0,0,n.numTemporalLayers<<3|n.temporalIdNested<<2|3,c];var l=function(e){var t;r.push(e.length>>8,e.length),(t=r).push.apply(t,Fre(e))};i.length&&(r.push(160,0,i.length),i.forEach(l)),o.length&&(r.push(161,0,o.length),o.forEach(l)),a.length&&(r.push(162,0,a.length),a.forEach(l))}else r=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return e.box(e.types.hvcC,new Uint8Array(r))}},{key:"pasp",value:function(t){var n=Ure(t,2),r=n[0],i=n[1];return e.box(e.types.pasp,new Uint8Array([r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),t.config.length?e.esds(t.config):void 0)}},{key:"esds",value:function(t){var n=t.length;return e.box(e.types.esds,new Uint8Array([0,0,0,0,3,23+n,0,0,0,4,15+n,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([n]).concat(t).concat([6,1,2])))}},{key:"mvex",value:function(t){return e.box.apply(e,[e.types.mvex].concat(Fre(t.map((function(t){return e.trex(t.id)})))))}},{key:"trex",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trex1",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]))}},{key:"trex2",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]))}},{key:"moof",value:function(t){return e.box.apply(e,[e.types.moof,e.mfhd(t[0].samples?t[0].samples[0].gopId:0)].concat(Fre(t.map((function(t){return e.traf(t)})))))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"traf",value:function(t){var n=e.tfhd(t.id),r=e.tfdt(t,t.baseMediaDecodeTime);if(t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)){if(t.isVideoEncryption){if(1===t.id){var i=e.saiz(t),o=e.saio(t),a=e.trun1(t),s=e.senc(t);return e.box(e.types.traf,n,r,i,o,a,s)}if(t.isAudioEncryption){var u=e.sbgp(),c=e.saiz(t),l=e.saio(t),d=e.senc(t),h=e.trun1(t);return e.box(e.types.traf,n,r,u,c,l,d,h)}var f=e.sbgp(),p=e.trun1(t);return e.box(e.types.traf,n,r,f,p)}if(1===t.id){var m=e.trun1(t);return e.box(e.types.traf,n,r,m)}var y=e.sbgp(),v=e.saiz(t),g=e.saio(t),b=e.senc(t),A=e.trun1(t);return e.box(e.types.traf,n,r,y,v,g,b,A)}var _=e.sdtp(t);return e.box(e.types.traf,n,r,_,e.trun(t.samples,_.byteLength+76))}},{key:"sdtp",value:function(t){var n=new Sie;return t.samples.forEach((function(e){n.write(new Uint8Array(1===t.id?[e.keyframe?32:16]:[16]))})),e.box(e.types.sdtp,this.extension(0,0),n.buffer)}},{key:"trun1",value:function(t){var n=new Sie,r=Sie.writeUint32(t.samples.length),i=null;if(1===t.id){var o=t.videoSencLength;i=Sie.writeUint32(16*t.samples.length+o+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=Sie.writeUint32(16*t.samples.length+92))}else{var a=12*t.samples.length+124;t.isAudioEncryption&&(a=12*t.samples.length+8*t.audioSenc.length+177),i=Sie.writeUint32(a)}return t.samples.forEach((function(e){n.write(Sie.writeUint32(e.duration)),n.write(Sie.writeUint32(e.size)),n.write(Sie.writeUint32(e.keyframe?33554432:65536)),1===t.id&&n.write(Sie.writeUint32(e.cts?e.cts:0))})),e.box(e.types.trun,this.extension(0,t.flags),r,i,n.buffer)}},{key:"senc",value:function(t){var n=new Sie,r=t.samples.length,i=1===t.id?16:8,o=1===t.id?2:0,a=[],s=0;return 1===t.id?(a=t.videoSenc,s=t.videoSencLength):a=t.audioSenc,s=s||i*r,n.write(Sie.writeUint32(16+s),e.types.senc,this.extension(0,o)),n.write(Sie.writeUint32(r)),a.forEach((function(e){for(var t=0;t<e.InitializationVector.length;t++)n.write(new Uint8Array([e.InitializationVector[t]]));e.subsamples&&e.subsamples.length&&(n.write(Sie.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){n.write(Sie.writeUint16(e.BytesOfClearData)),n.write(Sie.writeUint32(e.BytesOfProtectedData))})))})),n.buffer}},{key:"saio",value:function(t){var n=12*t.samples.length+141;2===t.id&&t.isAudioEncryption&&(n=149);var r=new Uint8Array([1,0,0,0,0,0,0,1,0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n]);return e.box(e.types.saio,r)}},{key:"saiz",value:function(t){var n=t.samples.length,r=new Uint8Array([0,0,0,0,16,n>>24&255,n>>16&255,n>>8&255,255&n]);return e.box(e.types.saiz,r)}},{key:"sbgp",value:function(){var t=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return e.box(e.types.sbgp,this.extension(0,0),t)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"tfhd",value:function(t){return e.box(e.types.tfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"tfdt",value:function(t,n){var r=Math.floor(n/(kie+1)),i=Math.floor(n%(kie+1));return t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)?e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])):e.box(e.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"trun",value:function(t,n){var r=t.length,i=12+16*r;n+=8+i;var o=new Uint8Array(i);o.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0);for(var a=0;a<r;a++){var s=t[a],u=s.duration,c=s.size,l=s.flag,d=void 0===l?{}:l,h=s.cts,f=void 0===h?0:h;o.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,c>>>24&255,c>>>16&255,c>>>8&255,255&c,d.isLeading<<2|(null===d.dependsOn||void 0===d.dependsOn?1:d.dependsOn),d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|(null===d.isNonSyncSample||void 0===d.isNonSyncSample?1:d.isNonSyncSample),61440&d.degradationPriority,15&d.degradationPriority,f>>>24&255,f>>>16&255,f>>>8&255,255&f],12+16*a)}return e.box(e.types.trun,o)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(Fre(t.map((function(t){return e.trackMP4(t)})))))}},{key:"trackMP4",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.duration,t.width,t.height),e.mdiaMP4(t))}},{key:"mdiaMP4",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minfMP4(t))}},{key:"minfMP4",value:function(t){return e.box(e.types.minf,t.type===jre?e.VMHD:e.SMHD,e.DINF,e.stblMP4(t))}},{key:"stblMP4",value:function(t){var n=t.ext,r=[e.stsd(t),e.stts(n.stts),e.stsc(n.stsc),e.stsz(n.stsz),e.stco(n.stco)];return n.stss.length&&r.push(e.stss(n.stss)),n.ctts.length&&r.push(e.ctts(n.ctts)),e.box.apply(e,[e.types.stbl].concat(r))}},{key:"stts",value:function(t){var n=t.length,r=new Uint8Array(8*n),i=0;return t.forEach((function(e){var t=e.value,n=e.count;r.set([n>>24,n>>16&255,n>>8&255,255&n,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.stts,lie(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stsc",value:function(t){var n=t.length,r=new Uint8Array(12*n),i=0;return t.forEach((function(e){var t=e.firstChunk,n=e.samplesPerChunk,o=e.sampleDescIndex;r.set([t>>24,t>>16&255,t>>8&255,255&t,n>>24,n>>16&255,n>>8&255,255&n,o>>24,o>>16&255,o>>8&255,255&o],i),i+=12})),e.box(e.types.stsc,lie(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stsz",value:function(t){var n=t.length,r=new Uint8Array(4*n),i=0;return t.forEach((function(e){r.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stsz,lie(new Uint8Array([0,0,0,0,0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stco",value:function(t){var n=t.length,r=new Uint8Array(4*n),i=0;return t.forEach((function(e){r.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stco,lie(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"stss",value:function(t){var n=t.length,r=new Uint8Array(4*n),i=0;return t.forEach((function(e){r.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stss,lie(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"ctts",value:function(t){var n=t.length,r=new Uint8Array(8*n),i=0;return t.forEach((function(e){var t=e.value,n=e.count;r.set([n>>24,n>>16&255,n>>8&255,255&n,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.ctts,lie(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),r))}},{key:"styp",value:function(){return e.box(e.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(t){var n=t.timescale,r=t.samples[0].duration,i=r*t.samples.length,o=t.samples[0].sampleOffset*r,a=8;t.samples.forEach((function(e){a+=e.size}));var s=0;if(1===t.id){var u,c=0;t.videoSenc&&(u=t.videoSenc),1===t.id&&u.forEach((function(e){c+=8,e.subsamples&&e.subsamples.length&&(c+=2,c+=6*e.subsamples.length)})),t.videoSencLength=c,s=a+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=a+16*t.samples.length+84)}else s=a+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=a+169+12*t.samples.length+8*t.audioSenc.length);var l=new Uint8Array([0,0,0,0,0,0,0,255&t.id,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,1,0,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,144,0,0,0]);return e.box(e.types.sidx,l)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}]),e}();Nre(Tie,"types",["avc1","avcC","hvc1","hvcC","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp"].reduce((function(e,t){return e[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)],e}),Object.create(null))),Nre(Tie,"HDLR_TYPES",{video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])}),Nre(Tie,"FTYPAVC1",Tie.box(Tie.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),Nre(Tie,"FTYPHEV1",Tie.box(Tie.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),Nre(Tie,"DINF",Tie.box(Tie.types.dinf,Tie.box(Tie.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),Nre(Tie,"VMHD",Tie.box(Tie.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),Nre(Tie,"SMHD",Tie.box(Tie.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),Nre(Tie,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),Nre(Tie,"STTS",Tie.box(Tie.types.stts,Tie.StblTable)),Nre(Tie,"STSC",Tie.box(Tie.types.stsc,Tie.StblTable)),Nre(Tie,"STSZ",Tie.box(Tie.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),Nre(Tie,"STCO",Tie.box(Tie.types.stco,Tie.StblTable));var xie=function(){function e(t,n){Xre(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=n}return Ore(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).debug.apply(t,[this._prefix].concat(r))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).log.apply(t,[this._prefix].concat(r))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(r))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).error.apply(t,[this._prefix].concat(r))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();Nre(xie,"disabled",!0);var Eie=function(){function e(t,n,r){Xre(this,e),this.videoTrack=t,this.audioTrack=n;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new xie("FMP4Remuxer",!r||!r.openLog||!r.openLog)}return Ore(e,[{key:"remux",value:function(){var e,t,n,r,i,o=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),l=u.exist(),d=[];return o&&(a&&a.initMerge?(c&&d.push(this.videoTrack),l&&d.push(this.audioTrack),n=Tie.initSegment(d)):(c&&(e=Tie.initSegment([this.videoTrack])),l&&(t=Tie.initSegment([this.audioTrack])))),c&&s.hasSample()&&(r=this._remuxVideo()),l&&u.hasSample()&&(i=this._remuxAudio()),s.samples=[],u.samples=[],{initSegment:n,videoInitSegment:e,audioInitSegment:t,videoSegment:r,audioSegment:i}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack;this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0});var t=e.samples,n=0;t.forEach((function(e){n+=e.units.reduce((function(e,t){return e+t.byteLength}),0),n+=4*e.units.length}));for(var r,i=new Uint8Array(n),o=new DataView(i.buffer),a=function(e,n,a,s){s=t[e];var u=0;s.units.forEach((function(e){o.setUint32(a,e.byteLength),a+=4,i.set(e,a),a+=e.byteLength,u+=4+e.byteLength})),s.size=u,c=a,r=s},s=0,u=t.length,c=0;s<u;s++)a(s,0,c,r);var l=Tie.mdat(i);return e.isVideoEncryption||e.isAudioEncryption?lie(Tie.styp(),Tie.sidx(e),Tie.moof([e]),l):lie(Tie.moof([e]),l)}},{key:"_remuxAudio",value:function(){var e=this.audioTrack,t=new Uint8Array(e.samples.reduce((function(e,t){return e+t.size}),0));e.samples.reduce((function(e,n){return t.set(n.data,e),e+n.size}),0);var n=Tie.mdat(t);return e.isVideoEncryption||e.isAudioEncryption?lie(Tie.styp(),Tie.sidx(e),Tie.moof([e]),n):lie(Tie.moof([e]),n)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}(),Lie={decryptWordArray:function(e,t,n){var r=fr.parse(t),i=fr.parse(mie(n)),o=hr.create(new Uint8Array(e)),a=$r.decrypt(Pr.create({ciphertext:o}),r,{iv:i,mode:ei,padding:ti});return Lie.wordArrayToUint8Array(a)},wordArrayToUint8Array:function(e){for(var t=e.sigBytes,n=e.words,r=new Uint8Array(t),i=0,o=0;i!==t;){var a=n[o++];if(r[i++]=(4278190080&a)>>>24,i===t)break;if(r[i++]=(16711680&a)>>>16,i===t)break;if(r[i++]=(65280&a)>>>8,i===t)break;r[i++]=255&a}return r}},Iie=function(){function e(t,n,r,i){var o=this;Xre(this,e),Nre(this,"_videoSamples",[]),Nre(this,"_audioSamples",[]),Nre(this,"_lastRemainBuffer",[]),Nre(this,"_lastRemainBufferStartPos",0),this.videoTrack=new eie,this.audioTrack=new tie,this.metadataTrack=r||new iie,this.log=new xie("MP4Demuxer",!i||!i.openLog||!i.openLog),t&&t.forEach((function(e){var t;(t=o._videoSamples).push.apply(t,Fre(e.frames))})),n&&n.forEach((function(e){var t;(t=o._audioSamples).push.apply(t,Fre(e.frames))}))}return Ore(e,[{key:"parseSamples",value:function(e){if(!e)throw new Error("moov is required");if(this.videoTrack.codec||this.audioTrack.codec||(vie.moovToTrack(e,this.videoTrack,this.audioTrack),this.videoSenc=this.videoTrack.videoSenc,this.audioSenc=this.audioTrack.audioSenc),!this._audioSamples.length&&!this._videoSamples.length){var t=vie.moovToSamples(e);if(!t)throw new Error("cannot parse samples from moov box");this._videoSamples=t.videoSamples||[],this._audioSamples=t.audioSamples||[]}}},{key:"demux",value:function(e,t,n,r,i){this.parseSamples(i);var o,a,s,u=this.videoTrack,c=this.audioTrack;if(u.samples=[],c.samples=[],n){for(var l,d=0,h=n[0],f=n[1];h<=f;h++){if(!(o=this._videoSamples[h]))throw new Error("cannot found video frame #".concat(h));s=o.offset-t,a=e.subarray(s,s+o.size),(l=new nie(o.pts||o.dts,o.dts)).duration=o.duration,l.gopId=o.gopId,o.keyframe&&l.setToKeyframe();for(var p=0,m=a.length-1;p<m;)d=fie(a,p),p+=4,l.units.push(a.subarray(p,p+d)),p+=d;u.samples.push(l)}u.baseMediaDecodeTime=u.samples[0].dts}if(r){for(var y=r[0],v=r[1];y<=v;y++){if(!(o=this._audioSamples[y]))throw new Error("cannot found video frame #".concat(y));s=o.offset-t,a=e.subarray(s,s+o.size),c.samples.push(new rie(o.dts,a,o.duration))}c.baseMediaDecodeTime=c.samples[0].dts}return{videoTrack:u,audioTrack:c,metadataTrack:this.metadataTrack}}},{key:"demuxPart",value:function(e,t,n,r,i,o,a){if(this.parseSamples(i),this.videoTrack.useEME=o,this.audioTrack.useEME=o,this._lastRemainBuffer&&this._lastRemainBuffer.byteLength>0&&t>this._lastRemainBufferStartPos&&t<=this._lastRemainBufferStartPos+this._lastRemainBuffer.byteLength)for(var s=0;s<20;)try{var u=this._lastRemainBuffer.subarray(0,t-this._lastRemainBufferStartPos),c=new Uint8Array(e.byteLength+u.byteLength);c.set(u,0),c.set(new Uint8Array(e),u.byteLength),e=c,t-=u.byteLength,this._lastRemainBuffer=null,this._lastRemainBufferStartPos=0;break}catch(kye){if(!(s<20))throw new Error("new Uint8Array error:,"+kye.errorMessage);s++}var l,d,h,f=this.videoTrack,p=this.audioTrack;f.samples=[],p.samples=[],f.videoSenc=null,p.audioSenc=null;var m=0,y=0;if(this._videoSamples.length>0&&n.length>0){for(var v,g=e.byteLength+t,b=n[0];b<=n[1];b++){if(!(l=this._videoSamples[b]))throw new Error("cannot found video frame #".concat(b));l.offset>=t&&l.offset+l.size<=g&&(m=(h=l.offset-t)+l.size,d=e.subarray(h,m),(v=new nie(l.pts||l.dts,l.dts)).duration=l.duration,v.gopId=l.gopId,v.sampleOffset=l.index,l.keyframe&&v.setToKeyframe(),v.data=d,v.size=l.size,f.samples.push(v))}f.samples.length>0&&(f.gopId=f.samples[0].gopId,f.baseMediaDecodeTime=f.samples[0].dts,f.startPts=f.samples[0].pts/f.timescale,f.endPts=f.samples[f.samples.length-1].pts/f.timescale,this.videoSenc&&(f.videoSenc=this.videoSenc.slice(f.samples[0].sampleOffset,f.samples[0].sampleOffset+f.samples.length),f.kidValue=a))}if(this._audioSamples.length>0&&r.length>0){for(var A=r[0];A<=r[1];A++){if(!(l=this._audioSamples[A]))throw new Error("cannot found video frame #".concat(A));l.offset>=t&&l.offset+l.size<=e.byteLength+t&&(y=(h=l.offset-t)+l.size,d=e.subarray(h,y),p.samples.push(new rie(l.dts,d,l.duration,l.index)))}p.samples.length>0&&(p.gopId=p.samples[0].gopId||f.gopId,p.baseMediaDecodeTime=p.samples[0].dts,p.startPts=p.samples[0].pts/p.timescale,p.endPts=p.samples[p.samples.length-1].pts/p.timescale,this.audioSenc&&(p.audioSenc=this.audioSenc.slice(p.samples[0].sampleOffset,p.samples[0].sampleOffset+p.samples.length),p.kidValue=a))}this.decoderData(f,p);for(var _=0,w=0;w<f.samples.length;w++)for(var S=0,k=f.samples[w].data,T=k.length-1;S<T;)_=fie(k,S),S+=4,f.samples[w].units.push(k.subarray(S,S+_)),S+=_;return this._lastRemainBuffer=e.subarray(Math.max(m,y)),this._lastRemainBuffer.byteLength>0?this._lastRemainBufferStartPos=t+e.byteLength-this._lastRemainBuffer.byteLength:this._lastRemainBufferStartPos=0,{videoTrack:f,audioTrack:p,metadataTrack:this.metadataTrack}}},{key:"reset",value:function(){this._videoSamples=[],this._audioSamples=[],this._lastRemainBuffer=null,this._lastRemainBufferStartPos=0,this.videoTrack.reset(),this.audioTrack.reset(),this.metadataTrack.reset()}},{key:"decoderData",value:function(e,t){if(!e.useEME&&!t.useEME){if(e.videoSenc&&1===e.id){var n=e.kidValue,r=e.videoSenc;e.samples.forEach((function(t,i){var o=r[i],a=t.data,s=[],u=[],c=o.InitializationVector;if(o.subsamples&&o.subsamples.length)o.subsamples.forEach((function(e){var t=e.BytesOfClearData+e.BytesOfProtectedData,n=a.slice(0,t);s.push(n.slice(0,e.BytesOfClearData)),u.push(n.slice(e.BytesOfClearData)),a=a.slice(t)}));else{var l=t.size;s.push(a.slice(0,0)),u.push(a.slice(0,l)),a=a.slice(l)}var d=new Sie;d.write.apply(d,u);var h=Lie.decryptWordArray(d.buffer,n,c),f=new Sie;s.forEach((function(e,t){var n=u[t].length,r=h.slice(0,n);f.write(e),f.write(r),h=h.slice(n)})),e.samples[i].data=f.buffer}))}if(t.audioSenc&&2===t.id){var i=t.kidValue,o=t.audioSenc;t.samples.forEach((function(e,n){var r=o[n],a=Lie.decryptWordArray(e.data,i,r.InitializationVector);t.samples[n].data=a}))}}}}],[{key:"probe",value:function(e){return vie.probe(e)}}]),e}(),Rie="3.0.0-alpha.36-3",Zie={416:-499899,401:-499898,403:-499897,404:-499896,timeout:-499895,"4xx":-499894,"5xx":-499893,networkError:-499892,contentError:-499891,mse:-499971,mseOpen:-499972,mseAppend:-499973,boxsError:-499980,moovError:-499981,notH264:-499982,mdatError:-499983,mdhdError:-499984,metaError:-499985,muxError:-499986,h265Error:-499987,noneURL:-499988,other:-499989,other1:-499990,waitTimeout:-499791,onWaitInBufferRange:-499792},Cie={network:1003,format:1005,runtime:1002,other:9999,demux:1006,remux:1007};var Pie=pK((function e(t,n,r){hK(this,e);var i=0,o=0;r&&r.range&&r.range.length>1&&(i=r.range[0],o=r.range[1]);var a=function(e){var t=0;switch(e){case 0:t=0;break;case-1:t=Zie.networkError;break;case-2:t=Zie.timeout;break;case-3:t=Zie.contentError;break;default:t=e<500?Zie[e]||e["4xx"]:Zie[e]||e["5xx"]}return t}(n);return{errorCode:a,errorType:t,errorTypeCode:Cie[t],errorMessage:(null==r?void 0:r.httpText)||(null==r?void 0:r.message),url:null==r?void 0:r.url,httpCode:n,version:Rie,rangeStart:i,rangeEnd:o,ext:r,mediaError:{code:a,message:(null==r?void 0:r.httpText)||(null==r?void 0:r.message)}}})),Gie=pK((function e(t,n,r){return hK(this,e),{errorCode:n,errorType:t,errorTypeCode:Cie[t],version:Rie,errorMessage:r.msg,ext:r,mediaError:{code:n,message:r.msg}}}));Py({target:"Array",stat:!0},{isArray:Mp});var Die=ih,Mie=th,Vie=Bl,Xie=Cp,Wie=tv,Oie=Ql,Nie=bh,Uie=Fg,Fie=ib;Cg("match",(function(e,t,n){return[function(t){var n=Oie(this),r=Vie(t)?void 0:Nie(t,e);return r?Die(r,t,n):new RegExp(t)[e](Wie(n))},function(e){var r=Mie(this),i=Wie(e),o=n(t,r,i);if(o.done)return o.value;if(!r.global)return Fie(r,i);var a=r.unicode;r.lastIndex=0;for(var s,u=[],c=0;null!==(s=Fie(r,i));){var l=Wie(s[0]);u[c]=l,""===l&&(r.lastIndex=Uie(i,Xie(r.lastIndex),a)),c++}return 0===c?null:u}]}));var Yie={};function Kie(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 jie(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kie(Object(n),!0).forEach((function(t){$ie(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kie(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Hie(){Hie=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(L){u=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var o=t&&t.prototype instanceof h?t:h,a=Object.create(o.prototype),s=new T(i||[]);return r(a,"_invoke",{value:_(e,n,s)}),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(L){return{type:"throw",arg:L}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,o)&&(m=v);var g=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,t){function i(r,o,a,s){var u=l(e[r],e,o);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(d).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=w(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,d;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function S(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function x(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(A.prototype),u(A.prototype,a,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new A(c(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),u(g,s,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=x,T.prototype={constructor:T,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(k),!e)for(var t in this)"t"===t.charAt(0)&&n.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 r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},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),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:x(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function Bie(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(Sye){return void n(Sye)}s.done?t(u):Promise.resolve(u).then(r,i)}function Jie(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Bie(o,r,i,a,s,"next",e)}function s(e){Bie(o,r,i,a,s,"throw",e)}a(void 0)}))}}function zie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qie(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function qie(e,t,n){return t&&Qie(e.prototype,t),n&&Qie(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function $ie(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eoe(e){return(eoe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function toe(e,t){return(toe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function noe(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function roe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ioe(e){var t=function(){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(kye){return!1}}();return function(){var n,r=eoe(e);if(t){var i=eoe(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(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 roe(e)}(this,n)}}function ooe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(u){s=!0,i=u}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(e,t)||soe(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 aoe(e){return function(e){if(Array.isArray(e))return uoe(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||soe(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 soe(e,t){if(e){if("string"==typeof e)return uoe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?uoe(e,t):void 0}}function uoe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function coe(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 loe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?coe(Object(n),!0).forEach((function(t){goe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):coe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function doe(){doe=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(L){u=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var o=t&&t.prototype instanceof h?t:h,a=Object.create(o.prototype),s=new T(i||[]);return r(a,"_invoke",{value:_(e,n,s)}),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(L){return{type:"throw",arg:L}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,o)&&(m=v);var g=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,t){function i(r,o,a,s){var u=l(e[r],e,o);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(d).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=w(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,d;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function S(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function x(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(A.prototype),u(A.prototype,a,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new A(c(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),u(g,s,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=x,T.prototype={constructor:T,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(k),!e)for(var t in this)"t"===t.charAt(0)&&n.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 r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},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),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:x(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function hoe(e){return(hoe="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 foe(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(Sye){return void n(Sye)}s.done?t(u):Promise.resolve(u).then(r,i)}function poe(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){foe(o,r,i,a,s,"next",e)}function s(e){foe(o,r,i,a,s,"throw",e)}a(void 0)}))}}function moe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yoe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function voe(e,t,n){return t&&yoe(e.prototype,t),n&&yoe(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function goe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function boe(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&&_oe(e,t)}function Aoe(e){return(Aoe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _oe(e,t){return(_oe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function woe(){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(kye){return!1}}function Soe(e,t,n){return(Soe=woe()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&_oe(i,n.prototype),i}).apply(null,arguments)}function koe(e){var t="function"==typeof Map?new Map:void 0;return koe=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;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,r)}function r(){return Soe(e,arguments,Aoe(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_oe(r,e)},koe(e)}function Toe(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function xoe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Eoe(e){var t=woe();return function(){var n,r=Aoe(e);if(t){var i=Aoe(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(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 xoe(e)}(this,n)}}function Loe(){return Loe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Aoe(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Loe.apply(this,arguments)}function Ioe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Roe(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Ioe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ioe(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}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 o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Zoe(){try{return parseInt(performance.now(),10)}catch(kye){return(new Date).getTime()}}Yie.findBox=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(e.type!==t){if(e&&e.subBox){var r=e.subBox.filter((function(e){return e.type===t}));r.length?r.forEach((function(e){return n.push(e)})):e.subBox.forEach((function(e){return Yie.findBox(e,t,n)}))}}else n.push(e);return(n=[].concat(n)).length>1?n:n[0]},Yie.padStart=function(e,t,n){for(var r=String(n),i=t>>0,o=Math.ceil(i/r.length),a=[],s=String(e);o--;)a.push(r);return a.join("").substring(0,i-s.length)+s},Yie.toHex=function(){for(var e=[],t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach((function(t){e.push(Yie.padStart(Number(t).toString(16),2,0))})),e},Yie.sum=function(){for(var e=0,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach((function(t){e+=t})),e},Yie.StringToArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return t},Yie.fromHex=function(e){for(var t=new Uint8Array(e.length/2),n=0;n<e.length;n+=2)t[n/2]=window.parseInt(e.substr(n,2),16);return t},Yie.fromCharCode=function(e){for(var t="",n=0;n<e.length;n+=16e3){var r=e.subarray(n,n+16e3);t+=String.fromCharCode.apply(null,r)}return t},Yie.ArrayBufferToString=function(e){for(var t="",n=new Uint8Array(e),r=0;r<n.length;r++)t+=String.fromCharCode(n[r]);return t},Yie.Base64ToHex=function(e){for(var t=window.atob(e.replace(/-/g,"+").replace(/_/g,"/")),n="",r=0;r<t.length;r++)n+=("0"+t.charCodeAt(r).toString(16)).substr(-2);return n},Yie.toBase64=function(e,t){var n=Yie.fromCharCode(e);t=void 0===t||t;var r=window.btoa(n).replace(/\+/g,"-").replace(/\//g,"_");return t?r:r.replace(/=*$/,"")},Yie.toUTF8=function(e){for(var t=encodeURIComponent(e),n=unescape(t),r=new Uint8Array(n.length),i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r.buffer},Yie.bufferToString=function(e){return("0"+Number(e).toString(16)).slice(-2).toUpperCase()},Yie.strToBuf=function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e[n]+e[n+1],16));return new Uint8Array(t)},Yie.formatIV=function(e){var t="";if(e.forEach((function(e){t+=Yie.bufferToString(e)})),t.length<=32)for(var n=32-t.length,r=0;r<n;r++)t+="0";return t},Yie.str2hex=function(e){if(""===e)return"";for(var t=[],n=0;n<e.length;n++)t.push(e.charCodeAt(n));return t},Yie.parse=function(e){if(!Array.isArray(e)){for(var t=[],n="",r=0;r<e.length;r++)r%2&&(n=e[r-1]+e[r],t.push(parseInt(n,16)),n="");return t}return e.map((function(e){return parseInt(e,16)}))},Yie.generateUniqueKey=function(e){var t=e.vid;e.start,e.end;var n=e.mediaType,r=e.definition;return e.preloadTime,n=n||"video",r=r||"0",t?"".concat(t,"#").concat(n,"#").concat(r,"#mp4"):null},Yie.validateFragment=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(e instanceof ArrayBuffer){try{if(2===t.length){var n=t[1]-t[0]+1;if(!(e.byteLength===n))return}}catch(kye){return console.error(kye),!1}return!0}return!1},Yie.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},Yie.getBufferSplits=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e5;if(t-e-n<n/2||!t)return[[e,t]];for(var r=[];e<t;){var i=e+n;(i>t||t-i<n/2)&&(i=t),r.push([e,i]),e=i+1}return r},Yie.nowTime=function(){try{return parseInt(performance.now(),10)}catch(kye){return(new Date).getTime()}},Yie.extUrl=function(e,t){try{var n=e.indexOf("?");return n<0?Object.keys(t).map((function(n,r){e+=0===r?"?".concat(n,"=").concat(t[n]):"&".concat(n,"=").concat(t[n])})):Object.keys(t).map((function(r,i){n===e.length-1?e+="".concat(r,"=").concat(t[r]):e+="&".concat(r,"=").concat(t[r])})),e}catch(kye){return e}},Yie.getFileSize=function(e,t){try{return e&&t?parseInt(t*e/8,10):0}catch(kye){return 0}},Yie.hashVal=function(e){var t,n=0;if(0===e.length)return n;for(t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return n},Yie.getFileSize=function(e,t){try{return e&&t?parseInt(t*e/8,10):0}catch(kye){return 0}},Yie.concatData=function(e,t){var n=[],r=0;e&&n.push(e),t&&n.push(t),n.every((function(e){return e&&(r+=e.byteLength),!0}));var i=new Uint8Array(r),o=0;return n.every((function(e){return e&&(i.set(e,o),o+=e.byteLength),!0})),i},Yie.getFragRange=function(e,t,n){var r=e<t.length?t[e]:null,i=e<n.length?n[e]:null,o=0,a=0;return e===t.length-1&&(o=-1),e===n.length-1&&(a=-1),[Math.min((null==r?void 0:r.range[0])||1/0,(null==i?void 0:i.range[0])||1/0),Math.max((null==r?void 0:r.range[1])+o||0,(null==i?void 0:i.range[1])+a||0)]};var Coe=function(){function e(t){moe(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]")}return voe(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).debug.apply(t,[this._prefix,Zoe()].concat(r))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).log.apply(t,[this._prefix,Zoe()].concat(r))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).warn.apply(t,[this._prefix,Zoe()].concat(r))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=console).error.apply(t,[this._prefix,Zoe()].concat(r))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();goe(Coe,"disabled",!0);var Poe="fetch",Goe="xhr",Doe="arraybuffer",Moe="text",Voe="json",Xoe=function(e){boe(n,e);var t=Eoe(n);function n(e,r,i,o){var a;return moe(this,n),goe(xoe(a=t.call(this,o)),"retryCount",0),goe(xoe(a),"isTimeout",!1),goe(xoe(a),"loaderType",Poe),goe(xoe(a),"startTime",0),goe(xoe(a),"endTime",0),a.url=e,a.request=r,a.response=i,a}return voe(n)}(koe(Error)),Woe=Object.prototype.toString;function Ooe(e){if("[object Object]"!==Woe.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function Noe(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function Uoe(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Foe(e,t){if(e){if(!t)return e;var n,r=Object.keys(t).map((function(e){if(null!=(n=t[e]))return Array.isArray(n)?e+="[]":n=[n],n.map((function(t){var n;return n=t,"[object Date]"===Woe.call(n)?t=t.toISOString():function(e){return null!==e&&"object"===hoe(e)}(t)&&(t=JSON.stringify(t)),"".concat(Uoe(e),"=").concat(Uoe(t))})).join("&")})).filter(Boolean).join("&");if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e}}function Yoe(e,t,n,r,i,o,a,s,u,c,l){return i=null!=i?parseFloat(i):null,r=parseInt(r||"0",10),Number.isNaN(r)&&(r=0),{data:e,done:t,option:{range:u,vid:c,index:s,contentLength:r,age:i,startTime:o,firstByteTime:a,endTime:Date.now(),priOptions:l},response:n}}function Koe(e,t){return Math.round(8*e*1e3/t/1024)}var joe="real_time_speed",Hoe=2097152,Boe=function(e){boe(r,e);var t,n=Eoe(r);function r(){var e;return moe(this,r),goe(xoe(e=n.call(this)),"_abortController",null),goe(xoe(e),"_timeoutTimer",null),goe(xoe(e),"_reader",null),goe(xoe(e),"_response",null),goe(xoe(e),"_aborted",!1),goe(xoe(e),"_index",-1),goe(xoe(e),"_range",null),goe(xoe(e),"_receivedLength",0),goe(xoe(e),"_running",!1),goe(xoe(e),"_logger",null),goe(xoe(e),"_vid",""),goe(xoe(e),"_onProcessMinLen",0),goe(xoe(e),"_onCancel",null),goe(xoe(e),"_priOptions",null),e}return voe(r,[{key:"load",value:function(e){var t,n=this,r=e.url,i=e.vid,o=e.timeout,a=e.responseType,s=e.onProgress,u=e.index,c=e.onTimeout,l=e.onCancel,d=e.range,h=e.transformResponse,f=e.request,p=e.params,m=e.logger,y=e.method,v=e.headers,g=e.body,b=e.mode,A=e.credentials,_=e.cache,w=e.redirect,S=e.referrer,k=e.referrerPolicy,T=e.onProcessMinLen,x=e.priOptions;this._logger=m,this._aborted=!1,this._onProcessMinLen=T,this._onCancel=l,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=u,this._range=d||[0,0],this._vid=i||r,this._priOptions=x||{};var E={method:y,headers:v,body:g,mode:b,credentials:A,cache:_,redirect:w,referrer:S,referrerPolicy:k,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},L=!1;clearTimeout(this._timeoutTimer),r=Foe(r,p);var I=Noe(d);I&&((v=f?f.headers:E.headers=E.headers||new Headers)instanceof Headers?v.append("Range",I):v.Range=I),o&&(this._timeoutTimer=setTimeout((function(){if(L=!0,n.cancel(),c){var e=new Xoe(r,E,null,"timeout");e.isTimeout=!0,c(e,n._index)}}),o));var R=Date.now();return this._logger.debug("[fetch load start], index,",u,",range,",d),new Promise((function(e,t){fetch(f||r,f?void 0:E).then(function(){var i=poe(doe().mark((function i(o){var c,l,f,p;return doe().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(n._timeoutTimer),n._response=o,!n._aborted&&n._running){i.next=4;break}return i.abrupt("return");case 4:if(h&&(o=h(o,r)||o),o.ok){i.next=7;break}throw new Xoe(r,E,o,"bad network response");case 7:if(c=Date.now(),a!==Moe){i.next=15;break}return i.next=11,o.text();case 11:l=i.sent,n._running=!1,i.next=37;break;case 15:if(a!==Voe){i.next=22;break}return i.next=18,o.json();case 18:l=i.sent,n._running=!1,i.next=37;break;case 22:if(!s){i.next=29;break}return n.resolve=e,n.reject=t,n._loadChunk(o,s,R,c),i.abrupt("return");case 29:return i.next=31,o.arrayBuffer();case 31:l=i.sent,l=new Uint8Array(l),n._running=!1,f=Date.now()-R,p=Koe(l.byteLength,f),n.emit(joe,{speed:p});case 37:n._logger.debug("[fetch load end], index,",u,",range,",d),e(Yoe(l,!0,o,o.headers.get("Content-Length"),o.headers.get("age"),R,c,u,d,n._vid,n._priOptions));case 39:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}()).catch((function(e){clearTimeout(n._timeoutTimer),n._running=!1,n._aborted&&!L||((e=e instanceof Xoe?e:new Xoe(r,E,null,JSON.stringify(e))).startTime=R,e.endTime=Date.now(),e.isTimeout=L,t(e))}))}))}},{key:"cancel",value:(t=poe(doe().mark((function e(){return doe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch(Sye){}this._abortController=null}this._onCancel&&this._onCancel(this._index);case 16:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,n,r){var i=this;if(!e.body||!e.body.getReader)return this._running=!1,void this.reject(Xoe(e.url,"",e,"onProgress of bad response.body.getReader"));this._onProcessMinLen>0&&(this._cache=new Uint8Array(Hoe),this._writeIdx=0);var o,a,s,u=this._reader=e.body.getReader(),c=function(){var l=poe(doe().mark((function l(){var d,h,f,p,m,y;return doe().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:return a=Date.now(),l.prev=1,l.next=4,u.read();case 4:o=l.sent,s=Date.now(),l.next=13;break;case 8:return l.prev=8,l.t0=l.catch(1),s=Date.now(),i._aborted||(i._running=!1,i.reject(l.t0)),l.abrupt("return");case 13:if(d=i._range[0]+i._receivedLength,!i._aborted){l.next=18;break}return i._running=!1,t(void 0,!1,{range:[d,d],vid:i._vid,index:i._index,startTime:a,endTime:s,priOptions:i._priOptions},e),l.abrupt("return");case 18:h=o.value?o.value.byteLength:0,i._receivedLength+=h,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",d,", end,",i._range[0]+i._receivedLength,", done,",o.done),i._onProcessMinLen>0?i._writeIdx+h>=i._onProcessMinLen||o.done?((f=new Uint8Array(i._writeIdx+h)).set(i._cache.slice(0,i._writeIdx),0),h>0&&f.set(o.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",o.done,",len,",f.byteLength,", writeIdx,",i._writeIdx)):h>0&&i._writeIdx+h<Hoe?(i._cache.set(o.value,i._writeIdx),i._writeIdx+=h,i._logger.debug("【fetchLoader,onProgress cache】,len,",h,", writeIdx,",i._writeIdx)):h>0&&(p=new Uint8Array(i._writeIdx+h+2048),i._logger.debug("【fetchLoader,onProgress extra start】,size,",i._writeIdx+h+2048,", datalen,",h,", writeIdx,",i._writeIdx),p.set(i._cache.slice(0,i._writeIdx),0),h>0&&p.set(o.value,i._writeIdx),i._writeIdx+=h,delete i._cache,i._cache=p,i._logger.debug("【fetchLoader,onProgress extra end】,len,",h,", writeIdx,",i._writeIdx)):f=o.value,(f&&f.byteLength>0||o.done)&&t(f,o.done,{range:[i._range[0]+i._receivedLength-(f?f.byteLength:0),i._range[0]+i._receivedLength],vid:i._vid,index:i._index,startTime:a,endTime:s,priOptions:i._priOptions},e),m=Date.now()-n,y=Koe(i._receivedLength,m),i.emit(joe,{speed:y}),o.done?(i._running=!1,i._logger.debug("[fetchLoader onProgress end],task,",i._range,",done,",o.done),i.resolve(Yoe(o,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),a,r,i._index,i._range,i._vid,i._priOptions))):c();case 27:case"end":return l.stop()}}),l,null,[[1,8]])})));return function(){return l.apply(this,arguments)}}();c()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}]),r}(P);var Joe=function(e){boe(n,e);var t=Eoe(n);function n(){var e;return moe(this,n),goe(xoe(e=t.call(this)),"_xhr",null),goe(xoe(e),"_aborted",!1),goe(xoe(e),"_timeoutTimer",null),goe(xoe(e),"_range",null),goe(xoe(e),"_receivedLength",0),goe(xoe(e),"_url",null),goe(xoe(e),"_onProgress",null),goe(xoe(e),"_index",-1),goe(xoe(e),"_headers",null),goe(xoe(e),"_currentChunkSizeKB",384),goe(xoe(e),"_timeout",null),goe(xoe(e),"_xhr",null),goe(xoe(e),"_withCredentials",null),goe(xoe(e),"_startTime",-1),goe(xoe(e),"_loadCompleteResolve",null),goe(xoe(e),"_loadCompleteReject",null),goe(xoe(e),"_runing",!1),goe(xoe(e),"_logger",!1),goe(xoe(e),"_vid",""),goe(xoe(e),"_responseType",void 0),goe(xoe(e),"_credentials",void 0),goe(xoe(e),"_method",void 0),goe(xoe(e),"_transformResponse",void 0),goe(xoe(e),"_firstRtt",void 0),goe(xoe(e),"_subRangeStartTime",void 0),goe(xoe(e),"_onCancel",null),goe(xoe(e),"_priOptions",null),e}return voe(n,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range||[0,0],this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._credentials=e.credentials,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=Foe(e.url,e.params);var n=Date.now();return new Promise((function(e,n){t._loadCompleteResolve=e,t._loadCompleteReject=n,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof Xoe?e:new Xoe(t._url,t._request)).startTime=n,e.endTime=Date.now(),e}))}},{key:"_startLoad",value:function(){var e=null;if(this._range&&this._range.length>1)if(this._onProgress){this._subRangeStartTime=Date.now(),this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,n=this._range[0]+this._receivedLength,r=this._range[1];t<this._range[1]-n&&(r=n+t),e=[n,r],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var n=this._xhr=new XMLHttpRequest;n.open(this._method||"GET",this._url,!0),n.responseType=this._responseType,this._timeout&&(n.timeout=this._timeout),n.withCredentials=this._credentials,n.onload=this._onLoad.bind(this),n.onreadystatechange=this._onReadyStatechange.bind(this),n.onerror=function(e){t._running=!1;var n=new Xoe(t._url,t._request,{status:0},"onerror");t._loadCompleteReject(n)},n.ontimeout=function(e){t.cancel();var n=new Xoe(t._url,t._request,{status:408},"timeout");t._onTimeout&&(n.isTimeout=!0,t._onTimeout(n,t._index)),t._loadCompleteReject(n)};var r=Noe(e),i=null;r&&((i=this._headers||{}).Range=r),i&&Object.keys(i).forEach((function(e){n.setRequestHeader(e,i[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),n.send()}catch(kye){this._loadCompleteReject(kye)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t=e.target.status;if(t<200||t>299)return this._loadCompleteReject(new Xoe(this._url,null,loe(loe({},e.target.response),{},{status:t}),"bad response,status:"+t));var n,r=null,i=!1;if(this._responseType===Doe){var o=new Uint8Array(e.target.response);if(n=this._range[0]+this._receivedLength,o&&o.byteLength>0){this._receivedLength+=o.byteLength;var a=Date.now()-this._subRangeStartTime,s=Koe(this._receivedLength,a);this.emit(joe,{speed:s})}r=o,i=!(this._range.length>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",n,"end ",this._range[0]+this._receivedLength,",dataLen,",o?o.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",i)}else i=!0,r=e.target.response;var u={ok:t>=200&&t<300,status:t,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(u=this._transformResponse(u,this._url)||u),this._onProgress&&this._onProgress(r,i,{index:this._index,vid:this._vid,range:[n,this._range[0]+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},u),i?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(Yoe(this._onProgress?null:r,i,u,u.headers["content-length"],u.headers.age,this._startTime,-1,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,Loe(Aoe(n.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel(this._index),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,n={},r=Roe(e.getAllResponseHeaders().trim().split("\r\n"));try{for(r.s();!(t=r.n()).done;){var i=t.value.split(": ");n[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(o){r.e(o)}finally{r.f()}return n}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),n}(P),zoe=["retry","retryDelay","onRetryError","transformError"],Qoe=function(){function e(t,n){var r,i,o;moe(this,e),this.promise=((o=new Promise((function(e,t){r=e,i=t}))).used=!1,o.resolve=function(){return o.used=!0,r.apply(void 0,arguments)},o.reject=function(){return o.used=!0,i.apply(void 0,arguments)},o),this.alive=!!n.onProgress,!n.logger&&(n.logger=new Coe("Loader")),this._loaderType=t,this._loader=t===Poe?new Boe:new Joe,this._config=n,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._logger=n.logger}var t;return voe(e,[{key:"exec",value:function(){var e=this,t=this._config,n=t.retry,r=t.retryDelay,i=t.onRetryError,o=t.transformError,a=Toe(t,zoe),s=function(){var t=poe(doe().mark((function t(){var u,c;return doe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(a);case 3:u=t.sent,e.promise.resolve(u),t.next=28;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(!(t.t0.response&&t.t0.response.status>=400&&t.t0.response.status<=599)){t.next=16;break}return e.promise.reject(t.t0),t.abrupt("return");case 16:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,c=t.t0,o&&(c=o(c)||c),i&&e._retryCount>0&&i(c,e._retryCount,n),e._retryCount++,!(e._retryCount<=n)){t.next=27;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",a.range),e._retryTimer=setTimeout(s,r),t.abrupt("return");case 27:e.promise.reject(c);case 28:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return s(),this.promise}},{key:"cancel",value:(t=poe(doe().mark((function e(){return doe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),e}();function qoe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if((t=t.filter(Boolean)).length<2)return t[0];var r=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){r.set(e,i),i+=e.byteLength})),r}function $oe(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var eae=function(e){boe(r,e);var t,n=Eoe(r);function r(e){var t;return moe(this,r),goe(xoe(t=n.call(this,e)),"type",Poe),goe(xoe(t),"_queue",[]),goe(xoe(t),"_alive",[]),goe(xoe(t),"_currentTask",null),goe(xoe(t),"_config",void 0),t._config=function(e){return loe({loaderType:Poe,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:Moe,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0},e)}(e),t._config.loaderType!==Goe&&Boe.isSupported()||(t.type=Goe),t.log=e.logger,t}return voe(r,[{key:"isFetch",value:function(){return this.type===Poe}},{key:"load",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?n=e:n.url=e||n.url||this._config.url,(n=Object.assign({},this._config,n)).params&&(n.params=Object.assign({},n.params)),n.headers&&Ooe(n.headers)&&(n.headers=Object.assign({},n.headers)),n.body&&Ooe(n.body)&&(n.body=Object.assign({},n.body)),n.transformRequest&&(n=n.transformRequest(n)||n),n.logger=this.log;var r=new Qoe(this.type,n);return r.loader.on(joe,(function(e){t.emit(joe,e)})),this._queue.push(r),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),r.promise}},{key:"cancel",value:(t=poe(doe().mark((function e(){var t;return doe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,$oe();case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;this._currentTask=this._queue.shift(),this._currentTask&&(this._currentTask.alive&&this._alive.push(this._currentTask),this._currentTask.exec().catch((function(e){})).finally((function(){e._processTask()})))}}],[{key:"isFetchSupport",value:function(){return Boe.isSupported()}}]),r}(P);var tae=qie((function e(t,n){zie(this,e),this.type="file",this.message=t,this.data=n})),nae=function(){function e(){zie(this,e),$ie(this,"_data",Object.create(null))}return qie(e,[{key:"set",value:function(e,t){this._data[e]=t}},{key:"get",value:function(e){return this._data[e]}},{key:"clear",value:function(){this._data=Object.create(null)}}]),e}();function rae(e,t){var n=e.trak;if(n&&n.length){var r=n.find((function(e){var t,n;return"vide"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)})),i=n.find((function(e){var t,n;return"soun"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)}));if(r||i){var o,a=[],s=[];if(r){var u,c,l,d=null===(u=r.mdia)||void 0===u||null===(c=u.minf)||void 0===c?void 0:c.stbl;if(!d)return;var h=null===(l=r.mdia.mdhd)||void 0===l?void 0:l.timescale,f=d.stts,p=d.stsc,m=d.stsz,y=d.stco,v=d.stss,g=d.ctts;if(!(h&&f&&p&&m&&y&&v))return;o=(a=iae(t,h,f,p,m,y,v,g)).map((function(e){return e.duration}))}if(i){var b,A,_,w=null===(b=i.mdia)||void 0===b||null===(A=b.minf)||void 0===A?void 0:A.stbl;if(!w)return;var S=null===(_=i.mdia.mdhd)||void 0===_?void 0:_.timescale,k=w.stts,T=w.stsc,x=w.stsz,E=w.stco;if(!(S&&k&&T&&x&&E))return;s=iae(t,S,k,T,x,E,null,null,o)}return{videoSegments:a,audioSegments:s}}}}function iae(e,t,n,r,i,o,a,s,u){var c,l,d,h,f=[],p=[],m=[],y=r.entries,v=o.entries,g=i.entrySizes,b=null==a?void 0:a.entries,A=null==s?void 0:s.entries;A&&(c=[],A.forEach((function(e){for(var t=e.count,n=e.offset,r=0;r<t;r++)c.push(n)}))),b&&(l={},b.forEach((function(e){l[e-1]=!0})));var _=0,w=0,S=0,k=0,T=0,x=y[0].samplesPerChunk,E=y[1]?y[1].firstChunk-1:1/0,L=0,I=-1;n.entries.forEach((function(e){var t=e.count,n=e.delta;h=n;for(var r=0;r<t;r++)d={dts:L,startTime:_,duration:h,size:g[w]||i.sampleSize,offset:v[S]+T,index:w},b&&(d.keyframe=l[w],d.keyframe?(I++,p.push([d]),m.push(d.duration)):(p[p.length-1].push(d),m[p.length-1]+=d.duration),d.gopId=I),c&&w<c.length&&(d.pts=L+c[w]),0===w&&(d.pts=0),f.push(d),_+=h,L+=n,++w<x?T+=d.size:(S++,T=0,S>=E&&(k++,E=y[k+1]?y[k+1].firstChunk-1:1/0),x+=y[k].samplesPerChunk)}));var R=f.length;if(R&&(!a||f[0].keyframe)){var Z,C=[],P=[],G=0,D=function(e){var n;Z=P[P.length-1],C.push({index:C.length,startTime:(null===(n=C[C.length-1])||void 0===n?void 0:n.endTime)||P[0].startTime/t,endTime:(Z.startTime+Z.duration)/t,duration:e,range:[P[0].offset,Z.offset+Z.size],frames:P}),G=0,P=[]};if(a)for(var M=e*t,V=0,X=p.length;V<X;V++){var W;G+=m[V],(W=P).push.apply(W,aoe(p[V])),V+1<X?(0===V||G>M)&&D(G/t):D(G/t)}else for(var O=(u=u||[])[0]||e,N=0;N<R;N++)P.push(f[N]),G+=f[N].duration,(N+1>=R||G/t>=O)&&(D(G/t),O=u[C.length]||e);return C}}function oae(e){var t="",n="",r=0,i=0,o=0,a=0,s=0,u=0,c=0;e.mvhd&&(s=e.mvhd.duration/e.mvhd.timescale);var l=e.trak;if(l){var d,h,f,p,m,y,v,g,b,A,_,w,S,k,T,x,E,L=l.find((function(e){var t,n;return"vide"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)})),I=l.find((function(e){var t,n;return"soun"===(null===(t=e.mdia)||void 0===t||null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)})),R=null;if(L)if(R=null===(h=L.mdia)||void 0===h||null===(f=h.minf)||void 0===f||null===(p=f.stbl)||void 0===p?void 0:p.stsd.entries[0])if(r=R.width,i=R.height,u=null===(m=L.mdia)||void 0===m||null===(y=m.mdhd)||void 0===y?void 0:y.timescale,t=null===(v=R.avcC||R.hvcC)||void 0===v?void 0:v.codec,"encv"===R.type)d=null===(g=R.sinf)||void 0===g||null===(b=g.schi)||void 0===b?void 0:b.tenc.default_KID;if(I)if(R=null===(A=I.mdia)||void 0===A||null===(_=A.minf)||void 0===_||null===(w=_.stbl)||void 0===w?void 0:w.stsd.entries[0])if(o=R.channelCount,a=R.sampleRate,n=null===(S=R.esds)||void 0===S?void 0:S.codec,c=null===(k=I.mdia)||void 0===k||null===(T=k.mdhd)||void 0===T?void 0:T.timescale,"enca"===R.type)d=d||(null===(x=R.sinf)||void 0===x||null===(E=x.schi)||void 0===E?void 0:E.tenc.default_KID);return{kid:d?d.join(""):null,videoCodec:t,audioCodec:n,width:r,height:i,videoTimescale:u,audioChannelCount:o,audioSampleRate:a,duration:s,audioTimescale:c,moov:e}}}function aae(e){return"number"==typeof e&&!Number.isNaN(e)}var sae=["vid","cache"],uae=function(e){!function(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&&toe(e,t)}(f,e);var t,n,r,i,o,a,s,u,c,l,d,h=ioe(f);function f(e){var t;zie(this,f),$ie(roe(t=h.call(this)),"vid",""),$ie(roe(t),"url",""),$ie(roe(t),"meta",{}),$ie(roe(t),"downloadInfo",[]),$ie(roe(t),"videoSegments",[]),$ie(roe(t),"audioSegments",[]),$ie(roe(t),"cache",null),$ie(roe(t),"_currentSegmentIndex",-1),$ie(roe(t),"_currentLoadingSegmentIndex",-1),$ie(roe(t),"buffer",void 0),$ie(roe(t),"_error",void 0),$ie(roe(t),"_transformError",(function(e){return e})),t._config=jie({vid:"",moovEnd:8e4,segmentDuration:2,maxDownloadInfoSize:30,responseType:"arraybuffer",cache:null},e);var n=t._config,r=n.vid,i=n.cache,o=noe(n,sae);return t.cache=i||new nae,t.vid=r||o.url,t.url=o.url,o.transformError=t._transformError,t.logger=new Coe("MP4Loader_"+t.vid),e.openLog&&Coe.enable(),o.logger=t.logger,t._loader=new eae(o),t._loader.on(joe,(function(e){t.emit(joe,e)})),t}return qie(f,[{key:"isMetaLoaded",get:function(){return this.videoSegments.length||this.audioSegments.length}},{key:"setCurrentSegment",value:function(e){aae(e)&&(this._currentSegmentIndex=e)}},{key:"isLastSegment",value:function(e){var t,n;return!!aae(e)&&e===((null===(t=this.videoSegments[this.videoSegments.length-1])||void 0===t?void 0:t.index)||(null===(n=this.audioSegments[this.audioSegments.length-1])||void 0===n?void 0:n.index)||0)}},{key:"isSegmentLoading",value:function(e){return e===this._currentLoadingSegmentIndex}},{key:"changeUrl",value:(d=Jie(Hie().mark((function e(t){var n,r,i,o=arguments;return Hie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>1&&void 0!==o[1]?o[1]:t,r=o.length>2?o[2]:void 0,i=o.length>3?o[3]:void 0,e.next=5,this.reset(i);case 5:t&&(this.url=t),n&&(this.vid=n),r&&(this._config.moovEnd=r);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"getOrLoadMeta",value:(l=Jie(Hie().mark((function e(t){return Hie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMetaLoaded){e.next=3;break}return e.next=3,this.loadMeta(t);case 3:return e.abrupt("return",this.meta);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"loadMetaProcess",value:(c=Jie(Hie().mark((function e(t,n,r,i){var o,a,s,u,c=this;return Hie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=ooe(n,2),a=o[0],s=o[1],this._error=!1,this.logger.debug("[loadMetaProcess start], range,",[a,s]),u=function(){var e=Jie(Hie().mark((function e(n,o,u){var l,d,h,f,p,m,y,v;return Hie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c.meta&&null!=u&&u.range&&u.range.length>0&&u.range[1]>=s&&(o=!0,c.logger.debug("[loadMetaProcess],data done,setstate true,[",a,s,"]")),o&&null!=u&&u.range&&u.range.length>0&&u.range[1]<s&&(o=!1,c.logger.debug("[loadMetaProcess],data not done,setstate false,[",a,s,"]")),c.logger.debug("[loadMetaProcess],task,[",a,s,"], range,",u.range,",dataLen,",n?n.byteLength:void 0,", state,",o,",err,",c._error),!c._error&&n&&n.byteLength>0&&r(n,o,u),!c.meta.moov&&!c._error){e.next=6;break}return e.abrupt("return");case 6:if(!(n&&n.byteLength>0)){e.next=44;break}if(c.buffer=qoe(c.buffer,n),l=vie.findBox(c.buffer,["moov"])[0]){e.next=23;break}if(d=vie.findBox(c.buffer,["mdat"])[0],!o){e.next=23;break}if(d){e.next=18;break}return c._error=!0,r(null,o,u,{err:"cannot find moov or mdat box"}),e.abrupt("return");case 18:return h=d.start+d.size,e.next=21,c.loadData([h,""],t,i);case 21:(f=e.sent)&&(l=vie.findBox(f.data,["moov"])[0]);case 23:if(!(l&&o&&l.size>l.data.length)){e.next=27;break}return c.logger.debug("[loadMetaProcess],moov not all, range,",u.range[1],",dataLen,",c.buffer.byteLength,", state,",o),e.next=27,c.loadMetaProcess(t,[u.range[1],l.start+l.size-1],r);case 27:if(!(l&&l.size<=l.data.length)||c.meta.moov){e.next=44;break}if(p=vie.moov(l)){e.next=33;break}return c._error=!0,r(null,o,u,{err:"cannot parse moov box"}),e.abrupt("return");case 33:if(m=rae(p,c._config.segmentDuration)){e.next=38;break}return c._error=!0,r(null,o,u,{err:"cannot parse segments"}),e.abrupt("return");case 38:c.meta=oae(p),y=m.videoSegments,v=m.audioSegments,c.videoSegments=y,c.audioSegments=v,c.logger.debug("[loadMetaProcess] moov ok"),r(void 0,o,{meta:{meta:c.meta,videoSegments:y,audioSegments:v}});case 44:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),e.next=6,this.loadData([a,s||this._config.moovEnd],t,jie({onProgress:u},i));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return c.apply(this,arguments)})},{key:"loadMeta",value:(u=Jie(Hie().mark((function e(t,n,r){var i,o,a,s,u,c,l,d,h;return Hie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=[],this.logger.debug("[loadMeta start]"),e.next=4,this.loadData([0,n||this._config.moovEnd],t,r);case 4:if(o=e.sent){e.next=7;break}return e.abrupt("return");case 7:if(i.push(o),a=vie.findBox(o.data,["moov"])[0]){e.next=23;break}if(s=vie.findBox(o.data,["mdat"])[0]){e.next=13;break}throw new tae("cannot find moov or mdat box",o.data);case 13:return u=s.start+s.size,e.next=16,this.loadData([u],t,r);case 16:if(o=e.sent){e.next=19;break}return e.abrupt("return");case 19:if(i.push(o),a=vie.findBox(o.data,["moov"],u)[0]){e.next=23;break}throw new tae("cannot find moov box",o.data);case 23:if(!(a.size>a.data.length)){e.next=31;break}return e.next=26,this.loadData([o.data.length,a.start+a.size-1],t,r);case 26:if(o=e.sent){e.next=29;break}return e.abrupt("return");case 29:i.push(o),a.data=qoe(a.data,o.data);case 31:if(c=vie.moov(a)){e.next=34;break}throw new tae("cannot parse moov box",a.data);case 34:if(l=rae(c,this._config.segmentDuration)){e.next=37;break}throw new tae("cannot parse segments",a.data);case 37:return this.meta=oae(c),d=l.videoSegments,h=l.audioSegments,this.videoSegments=d,this.audioSegments=h,this.logger.debug("[load moov end!!!!!]"),e.abrupt("return",{meta:this.meta,videoSegments:d,audioSegments:h,responses:i});case 43:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return u.apply(this,arguments)})},{key:"getSegmentByTime",value:function(e){var t,n;return this.videoSegments.length?(t=this.videoSegments.find((function(t){return t.startTime<=e&&t.endTime>e})))&&(n=this.audioSegments[t.index]):n=this.audioSegments.find((function(t){return t.startTime<=e&&t.endTime>e})),{video:t,audio:n}}},{key:"loadSegmentByTime",value:(s=Jie(Hie().mark((function e(t,n){var r,i,o,a,s,u=arguments;return Hie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!(u.length>2&&void 0!==u[2])||u[2],i=u.length>3&&void 0!==u[3]?u[3]:{},this.isMetaLoaded){e.next=5;break}return e.next=5,this.loadMeta(n);case 5:return o=this.getSegmentByTime(t),a=o.video,s=o.audio,e.abrupt("return",this._loadSegment(a,s,n,r,i));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"loadNextSegment",value:(a=Jie(Hie().mark((function e(t){var n,r,i,o,a=arguments;return Hie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(a.length>1&&void 0!==a[1])||a[1],r=a.length>2&&void 0!==a[2]?a[2]:{},this.isMetaLoaded){e.next=5;break}return e.next=5,this.loadMeta();case 5:return i=this.videoSegments[this._currentSegmentIndex+1],o=this.audioSegments[this._currentSegmentIndex+1],e.abrupt("return",this._loadSegment(i,o,t,n,r));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"preload",value:(o=Jie(Hie().mark((function e(t){var n,r,i,o,a,s,u,c=this;return Hie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMetaLoaded){e.next=3;break}return e.next=3,this.loadMeta(!0);case 3:if(t&&!(t<0)){e.next=5;break}return e.abrupt("return");case 5:if(n=this.getSegmentByTime(t),r=n.video,i=n.audio,o=Math.max((null==r?void 0:r.index)||0,(null==i?void 0:i.index)||0)){e.next=9;break}return e.abrupt("return");case 9:return a=this.videoSegments.slice(0,o),s=this.audioSegments.slice(0,o),u=function(){var e=Jie(Hie().mark((function e(t){return Hie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t>o)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,c._loadSegment(a[t],s[t],!0,!1);case 4:return e.next=6,u(t+1);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e.next=14,u(0);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"cancel",value:function(){return this._loader.cancel()}},{key:"reset",value:(i=Jie(Hie().mark((function e(){var t=arguments;return Hie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length>0&&void 0!==t[0]&&t[0]){e.next=5;break}return this.logger.debug("[MP4loader reset func call loader.cancel]"),e.next=5,this._loader.cancel();case 5:this.vid=this.url="",this.meta={},this.downloadInfo=[],this.videoSegments=[],this.audioSegments=[],this._currentSegmentIndex=-1,this._currentLoadingSegmentIndex=-1;case 12:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"destroy",value:(r=Jie(Hie().mark((function e(){return Hie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.reset();case 2:this.cache.clear();case 3:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_loadSegment",value:(n=Jie(Hie().mark((function e(t,n,r,i,o){var a,s;return Hie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t||n){e.next=2;break}return e.abrupt("return");case 2:return a=(null==t?void 0:t.index)||(null==n?void 0:n.index)||0,this._currentLoadingSegmentIndex=a,e.prev=4,e.next=7,this.loadData([Math.min((null==t?void 0:t.range[0])||1/0,(null==n?void 0:n.range[0])||1/0),Math.max((null==t?void 0:t.range[1])||0,(null==n?void 0:n.range[1])||0)],r,o);case 7:s=e.sent;case 8:return e.prev=8,this._currentLoadingSegmentIndex=-1,e.finish(8);case 11:if(s){e.next=13;break}return e.abrupt("return");case 13:return i&&(this._currentSegmentIndex=a),s.video=t,s.audio=n,e.abrupt("return",s);case 17:case"end":return e.stop()}}),e,this,[[4,,8,11]])}))),function(e,t,r,i,o){return n.apply(this,arguments)})},{key:"loadData",value:(t=Jie(Hie().mark((function e(t,n,r){var i,o,a;return Hie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._getCacheKey(t),e.next=3,this.cache.get(i);case 3:if(o=e.sent){e.next=10;break}return e.next=7,this._loader.load(this.url,jie({range:t,vid:this.vid},r));case 7:a=e.sent,e.next=11;break;case 10:a={data:o,state:!0,options:{fromCache:!0,range:t,vid:this.vid}};case 11:if(a){e.next=13;break}return e.abrupt("return");case 13:return o||(a.data&&this.downloadInfo.push({startTime:a.startTime,endTime:a.endTime,size:a.data.byteLength,range:t}),this.downloadInfo&&this.downloadInfo.length>this._config.maxDownloadInfoSize&&(this.downloadInfo=this.downloadInfo.slice(-this._config.maxDownloadInfoSize))),e.abrupt("return",a);case 16:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"_getCacheKey",value:function(e){return(this.vid||this.url)+":"+e}}]),f}(P),cae=function(){try{return"undefined"!=typeof localStorage&&"setItem"in window.localStorage&&!!window.localStorage.setItem}catch(kye){return!1}}()&&!function(){var e="_localstorage_support_test";try{return window.localStorage.setItem(e,!0),window.localStorage.removeItem(e),!1}catch(kye){return!0}}(),lae=dae();function dae(){if(cae)try{return!!window.localStorage.getItem("playerlog")}catch(kye){return!1}return!1}function hae(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];lae&&console.log&&(t=console).log.apply(t,["[logger]",Yie.nowTime(),e].concat(r))}var fae=Sg,pae=ih,mae=Hl,yae=Cg,vae=th,gae=Bl,bae=yM,Aae=Ql,_ae=pA,wae=Fg,Sae=Cp,kae=tv,Tae=bh,xae=Yy,Eae=ib,Lae=cg,Iae=Nl,Rae=cv.UNSUPPORTED_Y,Zae=4294967295,Cae=Math.min,Pae=[].push,Gae=mae(/./.exec),Dae=mae(Pae),Mae=mae("".slice),Vae=!Iae((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));yae("split",(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=kae(Aae(this)),i=void 0===n?Zae:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!bae(e))return pae(t,r,e,i);for(var o,a,s,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,d=new RegExp(e.source,c+"g");(o=pae(Lae,d,r))&&!((a=d.lastIndex)>l&&(Dae(u,Mae(r,l,o.index)),o.length>1&&o.index<r.length&&fae(Pae,u,xae(o,1)),s=o[0].length,l=a,u.length>=i));)d.lastIndex===o.index&&d.lastIndex++;return l===r.length?!s&&Gae(d,"")||Dae(u,""):Dae(u,Mae(r,l)),u.length>i?xae(u,0,i):u}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:pae(t,this,e,n)}:t,[function(t,n){var i=Aae(this),o=gae(t)?void 0:Tae(t,e);return o?pae(o,t,i,n):pae(r,kae(i),t,n)},function(e,i){var o=vae(this),a=kae(e),s=n(r,o,a,i,r!==t);if(s.done)return s.value;var u=_ae(o,RegExp),c=o.unicode,l=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(Rae?"g":"y"),d=new u(Rae?"^(?:"+o.source+")":o,l),h=void 0===i?Zae:i>>>0;if(0===h)return[];if(0===a.length)return null===Eae(d,a)?[a]:[];for(var f=0,p=0,m=[];p<a.length;){d.lastIndex=Rae?0:p;var y,v=Eae(d,Rae?Mae(a,p):a);if(null===v||(y=Cae(Sae(d.lastIndex+(Rae?p:0)),a.length))===f)p=wae(a,p,c);else{if(Dae(m,Mae(a,f,p)),m.length===h)return m;for(var g=1;g<=v.length-1;g++)if(Dae(m,v[g]),m.length===h)return m;p=f=y}}return Dae(m,Mae(a,f)),m}]}),!Vae,Rae);var Xae={"x-cache":"x_cache","x-response-sinfo":"server_ip","x-response-cinfo":"x-response-cinfo"};function Wae(e){var t={};return Object.keys(Xae).forEach((function(n){var r=Xae[n];e&&e.get&&e.get(n)&&(t[r]=e.get(n))})),t}var Oae=[{range:[0,90],size:614400},{range:[90,120],size:1228800},{range:[120,Number.MAX_VALUE],size:2048e3}];function Nae(e,t,n){var r=n>51200?Math.min(n,t):t;if(!e)return r;for(var i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leHQuZnJhZ0luZGV4LHN0YXJ0UHRzOk1hdGgubWluKG8udmlkZW9UcmFjay5zdGFydFB0cyxvLmF1ZGlvVHJhY2suc3RhcnRQdHMpLGVuZFB0czpNYXRoLm1heChvLnZpZGVvVHJhY2suZW5kUHRzLG8uYXVkaW9UcmFjay5lbmRQdHMpfSxpbml0U2VnOnMuaW5pdFNlZ21lbnR9fXRoaXMucG9zdE1lc3NhZ2Uoe21ldGhvZDoidHJhbnNtdXgiLGlkOnQuZGF0YS5pZCxhcmdzOmUoe30sYSl9KTticmVhaztjYXNlInJlc2V0Ijp0aGlzLkZNUDRSZW11eGVyJiZ0aGlzLkZNUDRSZW11eGVyLnJlc2V0KCksdGhpcy5NUDREZW11eGVyJiZ0aGlzLk1QNERlbXV4ZXIucmVzZXQoKSx0aGlzLkZNUDRSZW11eGVyPW51bGwsdGhpcy5NUDREZW11eGVyPW51bGwsdGhpcy5fbmVlZEluaXRTZWdtZW50PSEwfX19KCk7Cg==",Fae="undefined"!=typeof window&&window.Blob&&new Blob([atob(Uae)],{type:"text/javascript;charset=utf-8"});function Yae(){var e=Fae&&(window.URL||window.webkitURL).createObjectURL(Fae);try{return e?new Worker(e,{}):new Worker("data:application/javascript;base64,"+Uae,{type:"module"})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var Kae=function(e){yK(n,e);var t=AK(n);function n(e){var r;return hK(this,n),(r=t.call(this)).openlog=e.openLog,r.codecType=e.codecType,r.supportHevc=e.supportHevc,r.worker=new Yae,r.worker.onmessage=function(e){r.emit(e.data.method,e.data)},r.worker.postMessage({method:"init",id:e.id||0,args:{openlog:r.openlog,supportHevc:r.supportHevc,codecType:r.codecType}}),r}return pK(n,[{key:"transmux",value:function(e,t,n,r,i,o,a,s,u){var c=t.buffer;this.worker&&this.worker.postMessage({method:"transmux",id:e,buffer:c,args:{start:n,videoIdx:r,audioIdx:i,moov:o,useEME:a,kidValue:s,context:u}},[c])}},{key:"reset",value:function(){this.worker&&this.worker.postMessage({method:"reset"})}},{key:"destroy",value:function(){this.worker&&this.worker.terminate()}}]),n}(P),jae="error",Hae="metaReady",Bae="moov_request_Progress",Jae="progress_event",zae="updateEME",Qae="chaneg_url",qae=function(e){yK(d,e);var t,n,r,i,o,a,s,u,c,l=AK(d);function d(e,t,n,r){var i,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[],a=arguments.length>7?arguments[7]:void 0,s=arguments.length>8?arguments[8]:void 0;if(hK(this,d),mK(bK(i=l.call(this)),"onprogressDataArrive",function(){var e=dK(uK().mark((function e(t,n,r){var o;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t&&t.byteLength>0&&((o=i.timeRange[r.index].range)&&r.range[1]>=o[1]&&!n&&(n=!0),i.log("[mp4.loadFragment onprogressDataArrive ] receive data, >>> index,",r.index,",range,",JSON.stringify(r.range),", dataLen,",t.byteLength),i._mux(t,r.range[0],r.index,n)),n&&(i.timeRange[r.index].downloaded=!0,i.bufferLoadedPos=-1,i.log("[FragLoadDowned],fragmentIdx,",r.index,",rangeEnd,",r.range[1]));case 2:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}()),i.timeRecord={startMuxTime:-1,startLoadTime:-1,newMP4Time:Yie.nowTime(),startLoadMetaTime:-1},i.url=e,i.backUrl=o||[],i._bitRate=t,i.options=d.getDefaultConfig(),Object.keys(n).map((function(e){void 0!==n[e]&&null!==n[e]&&(i.options[e]=n[e])})),i.timeRange=[],i.firstFrameTime=a||{},i._logTag=s||"",i.CHUNK_SIZE=Nae(n.duration,i.options.chunkSize,n.fileSize),i.player=r,i.bufferLoaded=new Uint8Array(0),i.bufferLoadedPos=0,i.meta=null,i.preloadCache=null,i.videoTrak=null,i.audioTrak=null,i.canDownload=!0,i._loadSuccessCallBack=null,i._isPending=!1,i._metaLoading=!1,i.MP4Loader=new uae(sK(sK({segmentDuration:n.segmentDuration,url:e,vid:n.vid+"-"+t,retry:n.retryCount||2,retryDelay:n.retryDelay||1e3,timeout:3e3},n.reqOptions),{},{openLog:dae()})),i.MP4Demuxer=null,i.FMP4Remuxer=null,i._needInitSegment=!0,i._bitRateInfoMap=new Map,i._switchBitRate=!1,i._segmentToBitRateMap=new Map,i.useEME=!1,i.kidValue=null,i.enableWorker=n.enableWorker&&("h265"!==n.codecType||n.supportHevc),i.enableWorker&&"undefined"!=typeof Worker)try{i.workerSequence=0,i.transmuxerWorkerControl=new Kae({id:i.workerSequence,codecType:n.codecType,supportHevc:i.options.supportHevc,openLog:dae()}),i.transmuxerWorkerControl.on("transmux",(function(e){var t=e.args;i.log("[transmuxerworker end] ,range, ",JSON.stringify(t.range),",dataLen,",t.buffer.byteLength,t.context),i.firstFrameTime.firstmux<0&&i.timeRecord.startMuxTime>0&&(i.firstFrameTime.firstmux=Yie.nowTime()-i.timeRecord.startMuxTime),i._loadSuccessCallBack&&i._loadSuccessCallBack(t)}))}catch(Sye){i.log("Error in worker:",Sye),i.enableWorker=!1,i.transmuxerWorkerControl=null}return i.enableWorker||(i.MP4Demuxer=null,i.FMP4Remuxer=null),i.seekTime=-1,i}return pK(d,[{key:"changeBitRate",value:(c=dK(uK().mark((function e(t){return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.bitrate===this._bitRate){e.next=9;break}return this.url=t.url,this._bitRate=t.bitrate,this.backUrl=t.backupURL,e.next=6,this.MP4Loader.changeUrl(this.url,this.options.vid+"-"+this._bitRate,this.CHUNK_SIZE);case 6:this.emit(Qae,this.url),this._switchBitRate=!0,this.log("[switchBitrate] changeUrl, bitRate,",this._bitRate,this.url);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"_getByPreload",value:function(e,t,n,r){try{if(e&&e.byteLength>=t){var i={endTime:(new Date).getTime(),startTime:(new Date).getTime(),index:r,range:[],vid:this.options.vid,from:"local"};if(n<=e.byteLength){var o=e.slice(t,n);return i.range=[t,n],i.state=!0,{buffer:o,context:i,state:!0}}var a=e.byteLength-1,s=e.slice(t,a);return i.range=[t,a],{context:i,buffer:s,state:!1}}return null}catch(kye){return console.error("[MP4] _getByPreload",t,n,kye),null}}},{key:"log",value:function(e){for(var t=this.options,n=t&&t.vid?"[MP4]".concat(this._logTag," ").concat(t.vid," ").concat(e):"[MP4]".concat(this._logTag," ").concat(e),r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];hae.apply(void 0,[n].concat(i))}},{key:"errorHandler",value:(u=dK(uK().mark((function e(t,n){var r,i,o,a,s,u,c,l,d,h=arguments;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=h.length>2&&void 0!==h[2]?h[2]:{},i=t.response,o=t.message,a=this.options?this.options.vid:"",s=null,this._isPending=!0,!i){e.next=33;break}if(u=Wae(i.headers),s=new Pie("network",i.status,{httpText:i.httpText,message:o,url:i.url,headers:u}),console.log("[MP4] [".concat(a,"] errorHandler error state:[").concat(n,"], _isPending:[").concat(this._isPending,"] "),s),!(this.backUrl&&this.backUrl.length>0)){e.next=29;break}if(console.log("[MP4] [".concat(a,"] errorHandler start backUpUrl retry"),this.backUrl.length,this.backUrl),c=this.backUrl.shift(),this.update(c),this._isPending=!1,!this.MP4Loader){e.next=18;break}return e.next=17,this.MP4Loader.changeUrl(this.url,this.url+"-"+this._bitRate,this.CHUNK_SIZE);case 17:this.emit(Qae,this.url);case 18:if(this.emit(Jae,{type:"error",error:t}),"getMetaInfo"!==n){e.next=24;break}return this.getMetaInfo(),e.abrupt("return");case 24:if("loadFragment"!==n){e.next=29;break}if(l=r.index,d=r.range,!l||!d){e.next=29;break}return this.loadFragment(l,d),e.abrupt("return");case 29:console.log("[MP4] [".concat(a,"] errorHandler backUpUrl is null emit error")),this.emit(jae,s),e.next=36;break;case 33:console.log("[MP4] [".concat(a,"] errorHandler,"),t),s=t,this.emit(jae,s);case 36:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"init",value:(s=dK(uK().mark((function e(t){var n,r,i,o,a,s,u,c;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.url){e.next=3;break}return e.next=3,this.MP4Loader.changeUrl(this.url,this.options.vid+"-"+this._bitRate,this.CHUNK_SIZE);case 3:if(this.emit(Qae,this.url),this.meta=null,n=t.meta,r=t.mediaSegList,i=t.buffer,o=t.fileSize,a=t.initSeg,s=t.bitrate,!n||!n.ext){e.next=21;break}this.meta=n,this._bitRate=s,this.videoTrak=n.ext.videoTrak,this.audioTrak=n.ext.audioTrak,this.timeRange=this.getTimeRange(),r?this.preloadCache={segList:r||[],initSeg:a}:i&&(this.size=o,this.bufferLoaded=i),u={meta:n,videoSegments:n.ext.videoTrak,audioSegments:n.ext.audioTrak,bufferLoaded:i||null},this._bitRateInfoMap.set(this._bitRate,u),c=(new Date).getTime(),setTimeout((function(){console.log(">>>>metaReady setTimeout",(new Date).getTime()-c)})),console.log(">>>>metaReady",Yie.nowTime()),this.emit(Hae,this.meta),e.next=23;break;case 21:return e.next=23,this.getMetaInfo();case 23:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getTimeRange",value:function(){for(var e=[],t=null,n=0;this.videoTrak&&n<this.videoTrak.length;n++)t={startTime:this.videoTrak[n].startTime,endTime:this.videoTrak[n].endTime,downloaded:!1,isLoading:!1},e.push(t);if(this.audioTrak&&this.audioTrak.length>e.length)for(var r=e.length;r<this.audioTrak.length;r++)t={startTime:Math.max(this.audioTrak[r].startTime,t?t.endTime:0),endTime:Math.max(this.audioTrak[r].endTime,t?t.endTime:0),downloaded:!1,isLoading:!1},e.push(t);return e}},{key:"getMetaInfo",value:(a=dK(uK().mark((function e(){var t,n,r,i,o=this,a=arguments;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=!(a.length>0&&void 0!==a[0])||a[0],e.prev=1,n=Yie.nowTime(),this._metaLoading=!0,this.log("getMetaInfo start, bitRate,",this._bitRate),this.bufferLoaded=new Uint8Array(0),r=0,i=function(){var e=dK(uK().mark((function e(i,a,s,u){var c,l;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o.log("getMetaInfo onProgressHandle, dataLen,",i?i.byteLength:-1,", state,",a,",range,",JSON.stringify(s.range)),!u){e.next=7;break}return e.next=4,o.cancelLoading();case 4:return c=new Gie(Cie.demux,Zie.metaError,{msg:JSON.stringify(u)}),o.errorHandler(c,"getMetaInfo"),e.abrupt("return");case 7:i&&s.range[0]===r&&(o.bufferLoaded=Vre(Uint8Array,o.bufferLoaded,new Uint8Array(i)),r+=i.byteLength),s.meta&&!o.meta&&(o.firstFrameTime.metaload=Yie.nowTime()-n,l=s.meta,o.videoTrak=l.videoSegments,o.audioTrak=l.audioSegments,o.timeRange=o.getTimeRange(),o.meta=sK(sK({},l.meta),{},{ext:{videoTrak:o.videoTrak,audioTrak:o.audioTrak}}),l.bufferLoaded=o.bufferLoaded,o._bitRateInfoMap.set(o._bitRate,l),o.log("meta reach, bitRate,",o._bitRate),t&&o.emit(Hae,o.meta)),o.meta&&a&&(o.log("[getMetaInfo req end]"),o._metaLoading=!1),o.meta&&(i||a)&&(o.log("emit moov_req_progress"),o.emit(Bae));case 11:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}(),e.next=10,this.MP4Loader.loadMetaProcess(this.MP4Loader.cache,[0,this.CHUNK_SIZE],i);case 10:e.next=16;break;case 12:e.prev=12,e.t0=e.catch(1),console.error("[MP4] trigger errorHandler getMetaInfo",e.t0),this.errorHandler(e.t0,"getMetaInfo");case 16:case"end":return e.stop()}}),e,this,[[1,12]])}))),function(){return a.apply(this,arguments)})},{key:"getFragmentIdx",value:function(e){var t,n;if(this.videoTrak.length){if(t=this.videoTrak.find((function(t){return t.startTime<=e&&t.endTime>e})),n=this.audioTrak.find((function(t){return t.startTime<=e&&t.endTime>e})),t&&n)return Math.min(t.index,n.index);if(t||n)return t?t.index:n.index;var r=Number.MAX_VALUE;return this.videoTrak&&this.videoTrak.length>0&&(r=this.videoTrak.length-1),this.audioTrak&&this.audioTrak.length>0&&(r=Math.min(this.audioTrak.length-1,r)),r}return(n=this.audioTrak.find((function(t){return t.startTime<=e&&t.endTime>e})))?n.index:0}},{key:"_checkHasMeta",value:(o=dK(uK().mark((function e(){var t,n;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._bitRateInfoMap.get(this._bitRate)){e.next=19;break}return this.log("[ABR], need load InitSegment, bitRate, ",this._bitRate),this._metaLoading=!0,e.next=6,this.MP4Loader.loadMeta(this.MP4Loader.cache,Math.round(this.CHUNK_SIZE/2));case 6:return n=e.sent,this._metaLoading=!1,this.videoTrak=n.videoSegments,this.audioTrak=n.audioSegments,this.meta=sK(sK({},n.meta),{},{ext:{videoTrak:this.videoTrak,audioTrak:this.audioTrak}}),this.emit(zae,this.meta),this.timeRange=this.getTimeRange(),this.bufferLoaded=new Uint8Array(0),n.bufferLoaded=this.bufferLoaded,this._bitRateInfoMap.set(this._bitRate,n),e.abrupt("return",!0);case 19:return this.log("[ABR], not need load InitSegment, bitRate, ",this._bitRate),this.videoTrak=t.videoSegments,this.audioTrak=t.audioSegments,this.meta=t.meta,this.emit(zae,this.meta),this.timeRange=this.getTimeRange(),this.bufferLoaded=new Uint8Array(0),e.abrupt("return",!0);case 27:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"resetFragmentLoadState",value:function(e){for(var t=0;t<this.timeRange.length;t++)t<e?(this.timeRange[t].downloaded=!0,this.timeRange[t].isLoading=!0):(this.timeRange[t].downloaded=!1,this.timeRange[t].isLoading=!1)}},{key:"getFragRange",value:function(e){var t,n,r,i,o=null;this.videoTrak&&(o=e<this.videoTrak.length?this.videoTrak[e]:this.videoTrak[this.videoTrak.length-1]);var a=null;this.audioTrak&&(a=e<this.audioTrak.length?this.audioTrak[e]:this.audioTrak[this.audioTrak.length-1]);var s=0,u=0;this.videoTrak&&e>=this.videoTrak.length-1&&(s=-1),this.audioTrak&&e>=this.audioTrak.length-1&&(u=-1);var c=[Math.min((null===(t=o)||void 0===t?void 0:t.range[0])||1/0,(null===(n=a)||void 0===n?void 0:n.range[0])||1/0),Math.max((null===(r=o)||void 0===r?void 0:r.range[1])+s||0,(null===(i=a)||void 0===i?void 0:i.range[1])+u||0)];return e<this.timeRange.length&&(this.timeRange[e].range=c),c}},{key:"load",value:(i=dK(uK().mark((function e(t,n){var r,i,o,a;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loadSuccessCallBack=n,!this._switchBitRate||this._metaLoading){e.next=11;break}return this.log("[switchBitrate], switch bitRate start load, bitRate,",this._bitRate,", time,",t>=this.videoTrak.length?this.audioTrak[t].startTime:this.videoTrak[t].startTime,", fragIndex,",t),e.next=5,this._checkHasMeta();case 5:r=e.sent,this.resetFragmentLoadState(t),this.log("[switchBitrate], reset timerange state,",t),this._needInitSegment=!0,this.resetTansmuxer(),r&&(this._switchBitRate=!1);case 11:if(!this._switchBitRate||!this._metaLoading){e.next=13;break}return e.abrupt("return");case 13:i=this.getFragRange(t),(o=this.getFragmentFromCache(t,i))?(this.log("[mp4.load], segment ,",t,"Data In Cache",JSON.stringify(i),", needInit,",this._needInitSegment),this.timeRange[t].downloaded=!0,this.timeRange[t].isLoading=!1,this._needInitSegment=!1,this._loadSuccessCallBack&&this._loadSuccessCallBack(o)):(this.log("loadFragment,",t,",bitRate,",this._bitRate,",range,",JSON.stringify(i)),this.seekTime>0?(a=this.getSubRange(t,this.seekTime,i),this.loadFragment(t,a),this.seekTime=-1):this.loadFragment(t,i));case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"getSubRange",value:function(e,t,n){var r=n[0],i=n[0],o=1,a=!1;if(this.log(">>>>>getSubRange time,",t,JSON.stringify(n)),this.videoTrak){var s=e<this.videoTrak.length?this.videoTrak[e]:this.videoTrak[this.videoTrak.length-1],u=s.frames.filter($ae),c=this.meta.videoTimescale,l=u[0].startTime/c;this.log(">>>>>getSubRange video, startTime,",s.startTime,",endTime,",s.endTime);for(var d=0;d<u.length;d++)this.log(">>>>>getSubRange video keyFrameList, startTime,",u[d].startTime/c,",range,",u[d].offset);for(;o<u.length;o++){var h=u[o].startTime/c;if(l<=t&&t<h&&n[0]<u[o-1].offset){r=u[o-1].offset,a=!0,this.log(">>>>>getSubRange video end, startTime,",l,",endTime,",h,",startRange,",r,", keyFrameIndex,",o-1);break}l=h}!a&&l<=t&&t<s.endTime+.8&&(r=u[o-1].offset,this.log(">>>>>getSubRange video last, startTime,",l,",endTime,",s.endTime,",startRange,",r))}if(o=1,this.audioTrak){var f=e<this.audioTrak.length?this.audioTrak[e]:this.audioTrak[this.audioTrak.length-1],p=f.frames,m=this.meta.audioTimescale;o=Math.floor((t*m-p[0].startTime)/f.frames[0].duration);for(var y=(o=Math.min(p.length-1,o))>0?p[o-1].startTime/m:p[0].startTime/m;o>=0&&o<p.length;)if(o>0&&y>t)y=p[o-=1].startTime/m;else{var v=(p[o].startTime+p[o].duration)/m;if(y<=t&&t<v&&n[0]<p[o].offset){i=p[o].offset,a=!0,this.log(">>>>>getSubRange audio end, startTime,",y,",endTime,",v,",startRange,",i,", index,",o);break}y=v,o++}}var g=[Math.min(i,r),n[1]];return this.log(">>>>>getSubRange finalRange ",JSON.stringify(g),",oldRange,",JSON.stringify(n)),g}},{key:"getFragmentFromCache",value:function(e,t){var n=this.preloadCache;if(!n||!n.segList)return null;for(var r=-1,i=n.segList,o=n.initSeg,a=0;a<i.length;a++)if(i[a].index===e){r=a;break}if(r<0)return null;var s=i[r];if(console.log(">>>>preloadCache",r,s,s.range,t[1],s.range[1]>=t[1]),s.range[1]>=t[1]){var u=[this.timeRange[e].startTime,this.timeRange[e].endTime];return{buffer:s.buffer,range:t,context:{range:t,fragIndex:e,state:!0,timeRange:[u[0],u[1]]},state:!0,initSeg:this._needInitSegment?o:void 0}}return null}},{key:"_mux",value:function(e,t,n,r){this.firstFrameTime.firstmux<0&&this.timeRecord.startMuxTime<0&&(this.timeRecord.startMuxTime=Yie.nowTime(),this.firstFrameTime.startMuxTime=Yie.nowTime()-this.timeRecord.startLoadTime);var i=this.getSamplesRange(n,"video"),o=this.getSamplesRange(n,"audio"),a=[t,t+e.byteLength];if(this.transmuxerWorkerControl){var s={range:a,state:r,fragIndex:n};this.log("[transmuxerworker start] ,range, ",JSON.stringify(a),",dataLen,",e.byteLength,s),this.transmuxerWorkerControl.transmux(this.workerSequence,e,t,i,o,this.meta.moov,this.useEME,this.kidValue,s)}else try{this.MP4Demuxer||(this.MP4Demuxer=new Iie(this.videoTrak,this.audioTrak,null,{openLog:dae()}));var u,c=this.MP4Demuxer.demuxPart(e,t,i,o,this.meta.moov,this.useEME,this.kidValue);this.FMP4Remuxer||this.checkCodecH265()&&!this.options.supportHevc||(this.FMP4Remuxer=new Eie(this.MP4Demuxer.videoTrack,this.MP4Demuxer.audioTrack,{openLog:dae()})),this.log("[mux], videoTimeRange,",c.videoTrack?[c.videoTrack.startPts,c.videoTrack.endPts]:null,",audioTimeRange,",c.audioTrack?[c.audioTrack.startPts,c.audioTrack.endPts]:null);var l=[Math.min(c.videoTrack.startPts,c.audioTrack.startPts),Math.max(c.videoTrack.endPts,c.audioTrack.endPts)];if(this.FMP4Remuxer){var d=this.FMP4Remuxer.remux(this._needInitSegment,{initMerge:!0,range:a});d.initSegment&&(this._needInitSegment=!1),u={buffer:Yie.concatData(d.audioSegment,d.videoSegment),range:a,state:r,context:{range:a,fragIndex:n,timeRange:l},initSeg:d.initSegment}}else u={videoTrack:c.videoTrack,audioTrack:c.audioTrack,buffer:null,range:a,state:r,context:{range:a,fragIndex:n,timeRange:l}};this.firstFrameTime.firstmux<0&&this.timeRecord.startMuxTime>0&&(this.firstFrameTime.firstmux=Yie.nowTime()-this.timeRecord.startMuxTime),this._loadSuccessCallBack&&this._loadSuccessCallBack(u)}catch(kye){console.error("mux err:",kye);var h=new Gie(Cie.remux,Zie.muxError,{msg:JSON.stringify(kye)});this.errorHandler(h,"mux",{fragIndex:n,range:[t,t+e.byteLength]})}}},{key:"getSamplesRange",value:function(e,t){var n=[];switch(t){case"video":if(this.videoTrak&&e<this.videoTrak.length){var r=this.videoTrak[e].frames;n.push(r[0].index),n.push(r[r.length-1].index)}break;case"audio":if(this.audioTrak&&e<this.audioTrak.length){var i=this.audioTrak[e].frames;n.push(i[0].index),n.push(i[i.length-1].index)}break;default:console.warn("[getSamplesRange] type ",t," is invalid")}return n}},{key:"loadFragment",value:(r=dK(uK().mark((function e(t,n){var r,i,o,a;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPending&&n!==[0,0]&&!this.timeRange[t].isLoading){e.next=2;break}return e.abrupt("return");case 2:if(this.log("[MP4.loadFragment] ,fragIndex,",t,",range ",n,",len ,",n[1]-n[0],", bufferLoaded_Len,",this.bufferLoaded.byteLength),this._segmentToBitRateMap.set(t,this._bitRate),this.timeRecord.startLoadTime<0&&(this.timeRecord.startLoadTime=Yie.nowTime()),!(n.length>=2&&n[1]&&n[1]>0&&n[1]<=this.bufferLoaded.byteLength)){e.next=15;break}this.timeRange[t].isLoading=!0,r=Math.max(n[0],this.bufferLoadedPos),i=new Uint8Array(this.bufferLoaded.slice(r,n[1])),this.log("[mp4.loadFragment] has all data: ",r,n[1]),this.timeRange[t].downloaded=!0,this.bufferLoadedPos=-1,this._mux(i,r,t,!0),e.next=38;break;case 15:if(!(n.length>=2&&n[0]&&n[0]<=this.bufferLoaded.byteLength)){e.next=27;break}if(this.timeRange[t].isLoading){e.next=25;break}if(o=Math.max(n[0],this.bufferLoadedPos),!((a=new Uint8Array(this.bufferLoaded.slice(o,n[1]))).byteLength>0)){e.next=24;break}return this.bufferLoadedPos=o+a.byteLength,this.log("[mp4.loadFragment] has part data: ",o,o+a.byteLength),this._mux(a,o,t,n[1]<=this.bufferLoadedPos),e.abrupt("return");case 24:if(!this._metaLoading&&!this.timeRange[t].isLoading)try{this.log("[mp4.loadFragment] ready to load part data >>> ",this.bufferLoaded.byteLength,n[1]),this.timeRange[t].isLoading=!0,this.MP4Loader.loadData([this.bufferLoaded.byteLength,n[1]],this.MP4Loader.cache,{index:t,onProgress:this.onprogressDataArrive,onProcessMinLen:this.options.onProcessMinLen})}catch(kye){this.errorHandler(kye,"MP4Loader.loadData",{range:[this.bufferLoaded.byteLength,n[1]],fragIndex:t})}case 25:e.next=38;break;case 27:if(this._metaLoading&&!(n[0]>=this.CHUNK_SIZE)||this.timeRange[t].isLoading){e.next=38;break}return this.timeRange[t].isLoading=!0,this.log("[mp4.loadFragment],ready to load all data ,segmentIdx, ",t,",range >>> ",JSON.stringify(n)),e.prev=30,e.next=33,this.MP4Loader.loadData(n,this.MP4Loader.cache,{index:t,onProgress:this.onprogressDataArrive,onProcessMinLen:this.options.onProcessMinLen});case 33:e.next=38;break;case 35:e.prev=35,e.t0=e.catch(30),this.errorHandler(e.t0,"MP4Loader.loadData",{range:n,fragIndex:t});case 38:case"end":return e.stop()}}),e,this,[[30,35]])}))),function(e,t){return r.apply(this,arguments)})},{key:"loadAllFragmentData",value:(n=dK(uK().mark((function e(t,n,r){var i,o,a;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.hasDestroyed){e.next=2;break}return e.abrupt("return");case 2:return i=this.getFragRange(t),e.prev=3,e.next=6,this.MP4Loader.loadData(i,this.MP4Loader.cache,{index:t});case 6:if(o=e.sent,this.log("loadAllFragmentData after",JSON.stringify(i),o),o&&o.data){e.next=11;break}return r(new Error("response null")),e.abrupt("return");case 11:a=o.data,this._loadSuccessCallBack=n,this._mux(a,i[0],t,!0),e.next=20;break;case 16:e.prev=16,e.t0=e.catch(3),console.error("[MP4] loadAllFragmentData error",e.t0),r(e.t0);case 20:case"end":return e.stop()}}),e,this,[[3,16]])}))),function(e,t,r){return n.apply(this,arguments)})},{key:"cancelLoading",value:(t=dK(uK().mark((function e(){return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.MP4Loader;case 2:if(e.t0=e.sent,!e.t0){e.next=5;break}this.MP4Loader.cancel();case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"update",value:function(e){this.url=e}},{key:"getDataBitRate",value:function(e){return this._segmentToBitRateMap.get(e)}},{key:"checkCodecH265",value:function(){return this.meta&&(this.meta.videoCodec.indexOf("hvc1")>-1||this.meta.videoCodec.indexOf("hev1")>-1)}},{key:"destroy",value:function(){this.hasDestroyed||(this.resetTansmuxer(),this.transmuxerWorkerControl&&this.transmuxerWorkerControl.destroy(),this.size=0,this._isPending=!1,this._metaLoading=!1,this.bufferLoadedPos=0,this.bufferLoaded=new Uint8Array(0),this._bitRateInfoMap.clear(),this._segmentToBitRateMap.clear(),this.MP4Loader&&(this.MP4Loader.cancel(),this.MP4Loader.destroy()),this.hasDestroyed=!0)}},{key:"resetTansmuxer",value:function(){this.MP4Demuxer&&this.MP4Demuxer.reset(),this.MP4Demuxer=null,this.FMP4Remuxer&&this.FMP4Remuxer.reset(),this.FMP4Remuxer=null,this.transmuxerWorkerControl&&this.transmuxerWorkerControl.reset()}}],[{key:"getDefaultConfig",value:function(){return{onProcessMinLen:5120,xhrSetup:null,chunkSize:8e5,loadSize:800,isCache:!1,playerId:"",vid:"",ext:{}}}}]),d}(P);function $ae(e){if(e.keyframe)return e}var ese=function(){function e(){var t,n;hK(this,e);var r=new Promise((function(e,r){t=e,n=r}));return r.resolve=function(e){t(e),r.state="fulfilled"},r.reject=function(e){n(e),r.state="rejected",r.isBreak="DESTROYED"===e},r.state="pending",r}return pK(e,[{key:"resolve",value:function(e){}},{key:"reject",value:function(e){}}]),e}(),tse=pK((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.url,r=t.method,i=void 0===r?"GET":r,o=t.type,a=void 0===o?"arraybuffer":o,s=t.data,u=void 0===s?{}:s;return hK(this,e),new Promise((function(e,t){var r=new window.XMLHttpRequest,o=i.toUpperCase(),s=[];if(a&&(r.responseType=a),Object.keys(u).map((function(e){s.push("k=".concat(u[e]))})),"GET"===o)r.open(o,"".concat(n,"?").concat(s.join("&"))),r.send();else{if("POST"!==o)throw new Error("xhr ".concat(o," is not supported"));r.open(o,n,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(u))}r.onload=function(){200===r.status||206===r.status?e(r):t(r)},r.onerror=function(){t(r)}}))}));function nse(e,t,n){var r=new ese;return new tse({type:"json",method:"POST",url:n,data:{drm_type:"22",license_request:[{vid:e,kids:[].concat(t)}]}}).then((function(n){var i=n.response;if(i){var o=i.play_licenses[e][t];r.resolve(o)}else r.reject()})).catch((function(){r.reject()})),r}var rse={playBtnClick:function(e,t,n,r){e.paused||e.waitingMoreBuffer&&(e.waitingMoreBuffer=!1),r.call(e,t,n)}},ise={waiting:function(e,t){var n=e.player,r=e.eventName;n.waitingMoreBuffer=!0,t(r,e)},play:function(e,t){var n=e.player,r=e.eventName;n.waitingMoreBuffer||t(r,e)},pause:function(e,t){var n=e.player,r=e.eventName;n.waitingMoreBuffer||t(r,e)},seeking:function(e,t){var n=e.player,r=e.eventName;n.isSeekingStart=!0,t(r,e)},progress:function(e,t){hae(">>>>progress");var n=e.player,r=e.eventName;if(n.waitingMoreBuffer){var i=n.getBufferedRange(n.buffered2);0===i[0]&&0===i[1]||(void 0===n.inWaitingStart||n.isSeekingStart?(hae("progress 起播或seek结束"),i[1]-n.currentTime>=(n.config.canplayWaterLevel||1)||i[1]>n.duration-1?(hae("progress 出起播水位"),n.play()):(hae("progress 未出起播水位"),n.emit("waiting"))):(hae("progress video卡顿结束"),i[1]-n.currentTime>=(n.config.bufferWaterLevel||5)||i[1]>n.duration-1?(hae("progress 出卡顿水位"),n.play()):(hae("progress 未出卡顿水位"),n.emit("waiting"))))}t(r,e)},playing:function(e,t){var n=e.player,r=e.eventName;hae("playing");var i=n.getBufferedRange(n.buffered2);if(0===i[0]&&0===i[1])return hae("playing 当前播放时刻没有缓存 未出水位"),n.waitingMoreBuffer=!0,n.pause(),void t.call("waiting",e);void 0===n.inWaitingStart||n.isSeekingStart?(hae("playing 起播或seek结束"),i[1]-n.currentTime>=(n.config.canplayWaterLevel||1)||i[1]>n.duration-1?(hae("playing 出起播水位"),n.waitingMoreBuffer=!1,n.isSeekingStart=!1,t(r,e)):(hae("playing 未出起播水位"),n.waitingMoreBuffer=!0,n.pause(),t.call("waiting",e))):(hae("playing video卡顿结束"),i[1]-n.currentTime>=(n.config.bufferWaterLevel||5)||i[1]>n.duration-1?(hae("playing 出卡顿水位"),n.waitingMoreBuffer=!1,t(r,e)):(hae("playing 未出卡顿水位"),n.waitingMoreBuffer=!0,n.pause(),t.call("waiting",e)))}};var ose=function(e){yK(n,e);var t=AK(n);function n(e){var r;return hK(this,n),(r=t.call(this)).drm=e,r.KEYSYSTEM_TYPE="",r.keys={},r.drm.clearKeys&&(r.KEYSYSTEM_TYPE="org.w3.clearkey",r.keys=r.drm.clearKeys),r.options=[],r.ensurePromise=void 0,r}return pK(n,[{key:"updateDrm",value:function(e){this.drm=e,this.keys=this.drm.clearKeys}},{key:"setOptions",value:function(){var e=[{contentType:'video/mp4; codecs="avc1.42E01E"'},{contentType:'video/webm; codecs="vp8"'}],t={videoCapabilities:e},n={videoCapabilities:e,persistentState:"required",sessionTypes:["persistent-license"]};this.options=[n,t]}},{key:"bail",value:function(e){}},{key:"UpdateSessionFunc",value:function(e){var t=this;return function(n){var r=[],i=[];Object.keys(e).forEach((function(t){var n=e[t],o=Yie.fromHex(t),a=Yie.fromHex(n),s={kty:"oct",kid:Yie.toBase64(o,!1),k:Yie.toBase64(a,!1)};r.push(s),i.push(s.kid)}));var o={keys:r},a=JSON.stringify(o);n.target.update(Yie.StringToArrayBuffer(a)).then((function(){}),t.bail(" MediaKeySession update failed"))}}},{key:"KeysChange",value:function(e){}},{key:"EnsureMediaKeysCreated",value:function(e,t,n){return this.ensurePromise||(this.ensurePromise=navigator.requestMediaKeySystemAccess(t,n).then((function(e){return e.createMediaKeys()}),this.bail(" Failed to request key system access.")).then((function(t){return e.setMediaKeys(t)}),this.bail(" failed to create MediaKeys object"))),this.ensurePromise}},{key:"SetupEME",value:function(e,t){var n,r,i,o,a=this;e.sessions=[],n=this,r="encrypted",i=function(){var t=JSON.stringify({kids:["0123456789abcdef0123456789abcdef"]}),n=new Uint8Array(Yie.toUTF8(t));a.EnsureMediaKeysCreated(e,a.KEYSYSTEM_TYPE,a.options).then((function(){var t=e.mediaKeys.createSession();return e.sessions.push(t),t.addEventListener("message",a.UpdateSessionFunc(a.keys)),t.addEventListener("keystatuseschange",a.KeysChange),t.generateRequest("keyids",n.buffer)}),a.bail(" failed to ensure MediaKeys on HTMLMediaElement")).then((function(){}),a.bail(" Failed to generate request."))},o?(n.on(r,i),function(e,t,n,r){e.once(r,(function i(){e.off(t,n),e.off(r,i)}))}(n,r,i,o)):n.on(r,(function(e){i(e)}))}}]),n}(P),ase=function(){function e(){hK(this,e),this.queue=[]}return pK(e,[{key:"push",value:function(e){this.queue.push(e)}},{key:"startup",value:function(){return Promise.all(this.queue)}},{key:"destroy",value:function(){this.queue=[]}}]),e}();Py({target:"Array",proto:!0,forced:iC!==[].lastIndexOf},{lastIndexOf:iC});var sse=Py,use=Nl,cse=Rm,lse=Sm.f,dse=Nd,hse=use((function(){lse(1)}));sse({target:"Object",stat:!0,forced:!dse||hse,sham:!dse},{getOwnPropertyDescriptor:function(e,t){return lse(cse(e),t)}});var fse=Py,pse=Nd,mse=Od.f;fse({target:"Object",stat:!0,forced:Object.defineProperty!==mse,sham:!pse},{defineProperty:mse}),LR("Int8",(function(e){return function(t,n,r){return e(this,t,n,r)}})),LR("Int16",(function(e){return function(t,n,r){return e(this,t,n,r)}})),LR("Int32",(function(e){return function(t,n,r){return e(this,t,n,r)}})),LR("Uint16",(function(e){return function(t,n,r){return e(this,t,n,r)}})),LR("Uint32",(function(e){return function(t,n,r){return e(this,t,n,r)}})),LR("Float64",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var yse=Py,vse=Nl,gse=Math.imul;yse({target:"Math",stat:!0,forced:vse((function(){return-5!=gse(4294967295,5)||2!=gse.length}))},{imul:function(e,t){var n=65535,r=+e,i=+t,o=n&r,a=n&i;return 0|o*a+((n&r>>>16)*a+o*(n&i>>>16)<<16>>>0)}});var bse=Math.sign||function(e){var t=+e;return 0==t||t!=t?t:t<0?-1:1},Ase=Math.abs,_se=Math.pow,wse=_se(2,-52),Sse=_se(2,-23),kse=_se(2,127)*(2-Sse),Tse=_se(2,-126);Py({target:"Math",stat:!0},{fround:Math.fround||function(e){var t,n,r=+e,i=Ase(r),o=bse(r);return i<Tse?o*function(e){return e+1/wse-1/wse}(i/Tse/Sse)*Tse*Sse:(n=(t=(1+Sse/wse)*i)-(t-i))>kse||n!=n?o*(1/0):o*n}});var xse=Py,Ese=Math.floor,Lse=Math.log,Ise=Math.LOG2E;xse({target:"Math",stat:!0},{clz32:function(e){var t=e>>>0;return t?31-Ese(Lse(t+.5)*Ise):32}}),Py({target:"Math",stat:!0},{trunc:Ep});var Rse,Zse=Py,Cse=mp,Pse=Sm.f,Gse=Cp,Dse=tv,Mse=bM,Vse=Ql,Xse=_M,Wse=Cse("".startsWith),Ose=Cse("".slice),Nse=Math.min,Use=Xse("startsWith");Zse({target:"String",proto:!0,forced:!!(Use||(Rse=Pse(String.prototype,"startsWith"),!Rse||Rse.writable))&&!Use},{startsWith:function(e){var t=Dse(Vse(this));Mse(e);var n=Gse(Nse(arguments.length>1?arguments[1]:void 0,t.length)),r=Dse(e);return Wse?Wse(t,r,n):Ose(t,n,n+r.length)===r}});var Fse,Yse=(Fse="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e){var t,n=void 0!==(e=e||{})?e:{},r={};for(t in n)n.hasOwnProperty(t)&&(r[t]=n[t]);var i=!0;if(n.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)");var o,a="";if(document.currentScript&&(a=document.currentScript.src),Fse&&(a=Fse),a=0!==a.indexOf("blob:")?a.substr(0,a.lastIndexOf("/")+1):"","object"!==("undefined"==typeof window?"undefined":cK(window))&&"function"!=typeof importScripts)throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");var s,u=n.print||console.log.bind(console),c=n.printErr||console.warn.bind(console);for(t in r)r.hasOwnProperty(t)&&(n[t]=r[t]);function l(e){l.shown||(l.shown={}),l.shown[e]||(l.shown[e]=1,c(e))}r=null,n.arguments&&n.arguments,Object.getOwnPropertyDescriptor(n,"arguments")||Object.defineProperty(n,"arguments",{configurable:!0,get:function(){N("Module.arguments has been replaced with plain arguments_")}}),n.thisProgram&&n.thisProgram,Object.getOwnPropertyDescriptor(n,"thisProgram")||Object.defineProperty(n,"thisProgram",{configurable:!0,get:function(){N("Module.thisProgram has been replaced with plain thisProgram")}}),n.quit&&n.quit,Object.getOwnPropertyDescriptor(n,"quit")||Object.defineProperty(n,"quit",{configurable:!0,get:function(){N("Module.quit has been replaced with plain quit_")}}),m(void 0===n.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),m(void 0===n.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),m(void 0===n.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),m(void 0===n.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),m(void 0===n.read,"Module.read option was removed (modify read_ in JS)"),m(void 0===n.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),m(void 0===n.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),m(void 0===n.setWindowTitle,"Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),Object.getOwnPropertyDescriptor(n,"read")||Object.defineProperty(n,"read",{configurable:!0,get:function(){N("Module.read has been replaced with plain read_")}}),Object.getOwnPropertyDescriptor(n,"readAsync")||Object.defineProperty(n,"readAsync",{configurable:!0,get:function(){N("Module.readAsync has been replaced with plain readAsync")}}),Object.getOwnPropertyDescriptor(n,"readBinary")||Object.defineProperty(n,"readBinary",{configurable:!0,get:function(){N("Module.readBinary has been replaced with plain readBinary")}}),le=function(){N("cannot use the stack before compiled code is ready to run, and has provided stack access")},n.wasmBinary&&(s=n.wasmBinary),Object.getOwnPropertyDescriptor(n,"wasmBinary")||Object.defineProperty(n,"wasmBinary",{configurable:!0,get:function(){N("Module.wasmBinary has been replaced with plain wasmBinary")}}),n.noExitRuntime&&n.noExitRuntime,Object.getOwnPropertyDescriptor(n,"noExitRuntime")||Object.defineProperty(n,"noExitRuntime",{configurable:!0,get:function(){N("Module.noExitRuntime has been replaced with plain noExitRuntime")}});var d,h={Memory:function(e){return{buffer:new ArrayBuffer(65536*e.initial),grow:function(e){var t=this.buffer,n=he(e);return m(this.buffer!==t),n}}},Table:function(e){var t=new Array(e.initial);return t.grow=function(e){t.length>=1&&N("Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH."),t.push(null)},t.set=function(e,n){t[e]=n},t.get=function(e){return t[e]},t},Module:function(e){return{}},Instance:function(e,t){var n;return{exports:(n=f,function(e,t,r){var i=t.memory,o=n,a=new e.Int8Array(r);new e.Int16Array(r);var s=new e.Int32Array(r),u=new e.Uint8Array(r);new e.Uint16Array(r);var c=new e.Uint32Array(r);new e.Float32Array(r),new e.Float64Array(r);var l=e.Math.imul;e.Math.fround,e.Math.abs,e.Math.clz32,e.Math.min,e.Math.max,e.Math.floor,e.Math.ceil,e.Math.sqrt,t.abort,e.NaN,e.Infinity;var d=t.emscripten_memcpy_big,h=t.emscripten_resize_heap,f=t.__unlock,p=t.__lock,m=9744;function y(e){var t,n=0;return t=w(),(e=(n=s[388])+e|0)>>>0<=t<<16>>>0||h(0|e)?(s[388]=e,n):(s[256]=48,-1)}function v(e){var t,n=0,r=0,i=0,o=0,a=0,l=0,d=0,h=0,f=0,p=0,v=0,g=0;m=t=m-16|0;e:{t:{n:{r:{i:{o:{a:{s:{u:{c:{l:{if((e|=0)>>>0<=244){if(3&(n=(a=s[261])>>>(e=(l=e>>>0<11?16:e+11&-8)>>>3))){e=(n=s[1092+(o=(r=e+(1&(-1^n))|0)<<3)>>2])+8|0,(0|(i=s[n+8>>2]))!=(0|(o=o+1084|0))?(s[i+12>>2]=o,s[o+8>>2]=i):(v=1044,g=_(r)&a,s[v>>2]=g),r<<=3,s[n+4>>2]=3|r,s[4+(n=n+r|0)>>2]=1|s[n+4>>2];break e}if(l>>>0<=(h=s[263])>>>0)break l;if(n){r=n=(e=(0-(e=(0-(r=2<<e)|r)&n<<e)&e)-1|0)>>>12&16,r|=n=(e>>>=n)>>>5&8,r|=n=(e>>>=n)>>>2&4,n=s[1092+(i=(r=((r|=n=(e>>>=n)>>>1&2)|(n=(e>>>=n)>>>1&1))+(e>>>n)|0)<<3)>>2],(0|(e=s[n+8>>2]))!=(0|(i=i+1084|0))?(s[e+12>>2]=i,s[i+8>>2]=e):(a=_(r)&a,s[261]=a),e=n+8|0,s[n+4>>2]=3|l,o=(r<<=3)-l|0,s[4+(d=n+l|0)>>2]=1|o,s[n+r>>2]=o,h&&(n=1084+((r=h>>>3)<<3)|0,i=s[266],(r=1<<r)&a?r=s[n+8>>2]:(s[261]=r|a,r=n),s[n+8>>2]=i,s[r+12>>2]=i,s[i+12>>2]=n,s[i+8>>2]=r),s[266]=d,s[263]=o;break e}if(!(p=s[262]))break l;for(r=n=(e=(p&0-p)-1|0)>>>12&16,r|=n=(e>>>=n)>>>5&8,r|=n=(e>>>=n)>>>2&4,n=s[1348+(((r|=n=(e>>>=n)>>>1&2)|(n=(e>>>=n)>>>1&1))+(e>>>n)<<2)>>2],i=(-8&s[n+4>>2])-l|0,r=n;(e=s[r+16>>2])||(e=s[r+20>>2]);)i=(r=(o=(-8&s[e+4>>2])-l|0)>>>0<i>>>0)?o:i,n=r?e:n,r=e;if(f=s[n+24>>2],(0|(o=s[n+12>>2]))!=(0|n)){e=s[n+8>>2],s[e+12>>2]=o,s[o+8>>2]=e;break t}if(!(e=s[(r=n+20|0)>>2])){if(!(e=s[n+16>>2]))break c;r=n+16|0}for(;d=r,o=e,(e=s[(r=e+20|0)>>2])||(r=o+16|0,e=s[o+16>>2]););s[d>>2]=0;break t}if(l=-1,!(e>>>0>4294967231)&&(l=-8&(n=e+11|0),h=s[262])){r=0-l|0,a=0,(n>>>=8)&&(a=31,l>>>0>16777215||(a=28+((e=((a=(n<<=i=n+1048320>>>16&8)<<(e=n+520192>>>16&4))<<(n=a+245760>>>16&2)>>>15)-(n|e|i)|0)<<1|l>>>e+21&1)|0));d:{h:{if(i=s[1348+(a<<2)>>2])for(n=l<<(31==(0|a)?0:25-(a>>>1)|0),e=0;;){if(!((d=(-8&s[i+4>>2])-l|0)>>>0>=r>>>0||(o=i,r=d))){r=0,e=i;break h}if(d=s[i+20>>2],i=s[16+((n>>>29&4)+i|0)>>2],e=d?(0|d)==(0|i)?e:d:e,n<<=0!=(0|i),!i)break}else e=0;if(!(e|o)){if(!(e=(0-(e=2<<a)|e)&h))break l;i=n=(e=(e&0-e)-1|0)>>>12&16,i|=n=(e>>>=n)>>>5&8,i|=n=(e>>>=n)>>>2&4,e=s[1348+(((i|=n=(e>>>=n)>>>1&2)|(n=(e>>>=n)>>>1&1))+(e>>>n)<<2)>>2]}if(!e)break d}for(;r=(n=(i=(-8&s[e+4>>2])-l|0)>>>0<r>>>0)?i:r,o=n?e:o,e=(n=s[e+16>>2])||s[e+20>>2];);}if(!(!o|r>>>0>=s[263]-l>>>0)){if(d=s[o+24>>2],(0|o)!=(0|(n=s[o+12>>2]))){e=s[o+8>>2],s[e+12>>2]=n,s[n+8>>2]=e;break n}if(!(e=s[(i=o+20|0)>>2])){if(!(e=s[o+16>>2]))break u;i=o+16|0}for(;a=i,n=e,(e=s[(i=e+20|0)>>2])||(i=n+16|0,e=s[n+16>>2]););s[a>>2]=0;break n}}}if((n=s[263])>>>0>=l>>>0){e=s[266],(r=n-l|0)>>>0>=16?(s[263]=r,i=e+l|0,s[266]=i,s[i+4>>2]=1|r,s[e+n>>2]=r,s[e+4>>2]=3|l):(s[266]=0,s[263]=0,s[e+4>>2]=3|n,s[4+(n=e+n|0)>>2]=1|s[n+4>>2]),e=e+8|0;break e}if((i=s[264])>>>0>l>>>0){n=i-l|0,s[264]=n,r=(e=s[267])+l|0,s[267]=r,s[r+4>>2]=1|n,s[e+4>>2]=3|l,e=e+8|0;break e}if(e=0,r=o=l+47|0,s[379]?n=s[381]:(s[382]=-1,s[383]=-1,s[380]=4096,s[381]=4096,s[379]=t+12&-16^1431655768,s[384]=0,s[372]=0,n=4096),(r=(a=r+n|0)&(d=0-n|0))>>>0<=l>>>0)break e;if((n=s[371])&&(f=(h=s[369])+r|0)>>>0<=h>>>0|f>>>0>n>>>0)break e;if(4&u[1488])break o;l:{d:{if(n=s[267])for(e=1492;;){if((h=s[e>>2])+s[e+4>>2]>>>0>n>>>0&&h>>>0<=n>>>0)break d;if(!(e=s[e+8>>2]))break}if(-1==(0|(n=y(0))))break a;if(a=r,(i=(e=s[380])+-1|0)&n&&(a=(r-n|0)+(n+i&0-e)|0),a>>>0<=l>>>0|a>>>0>2147483646)break a;if((e=s[371])&&(d=(i=s[369])+a|0)>>>0<=i>>>0|d>>>0>e>>>0)break a;if((0|n)!=(0|(e=y(a))))break l;break i}if((a=d&a-i)>>>0>2147483646)break a;if((0|(n=y(a)))==(s[e>>2]+s[e+4>>2]|0))break s;e=n}if(n=e,!(l+48>>>0<=a>>>0|a>>>0>2147483646|-1==(0|e))){if((e=(e=s[381])+(o-a|0)&0-e)>>>0>2147483646)break i;if(-1!=(0|y(e))){a=e+a|0;break i}y(0-a|0);break a}if(-1!=(0|n))break i;break a}o=0;break t}n=0;break n}if(-1!=(0|n))break i}s[372]=4|s[372]}if(r>>>0>2147483646)break r;if((n=y(r))>>>0>=(e=y(0))>>>0|-1==(0|n)|-1==(0|e))break r;if((a=e-n|0)>>>0<=l+40>>>0)break r}e=s[369]+a|0,s[369]=e,e>>>0>c[370]&&(s[370]=e);i:{o:{a:{if(r=s[267]){for(e=1492;;){if(((i=s[e>>2])+(o=s[e+4>>2])|0)==(0|n))break a;if(!(e=s[e+8>>2]))break}break o}for(n>>>0>=(e=s[265])>>>0&&e||(s[265]=n),e=0,s[374]=a,s[373]=n,s[269]=-1,s[270]=s[379],s[376]=0;i=1084+(r=e<<3)|0,s[r+1092>>2]=i,s[r+1096>>2]=i,32!=(0|(e=e+1|0)););i=(e=a+-40|0)-(r=n+8&7?-8-n&7:0)|0,s[264]=i,r=n+r|0,s[267]=r,s[r+4>>2]=1|i,s[4+(e+n|0)>>2]=40,s[268]=s[383];break i}if(!(8&u[e+12|0]|n>>>0<=r>>>0|i>>>0>r>>>0)){s[e+4>>2]=o+a,n=(e=r+8&7?-8-r&7:0)+r|0,s[267]=n,e=(i=s[264]+a|0)-e|0,s[264]=e,s[n+4>>2]=1|e,s[4+(r+i|0)>>2]=40,s[268]=s[383];break i}}n>>>0<(o=s[265])>>>0&&(s[265]=n,o=0),i=n+a|0,e=1492;o:{a:{s:{u:{c:{l:{for(;;){if((0|i)!=s[e>>2]){if(e=s[e+8>>2])continue;break l}break}if(!(8&u[e+12|0]))break c}for(e=1492;;){if((i=s[e>>2])>>>0<=r>>>0&&(o=i+s[e+4>>2]|0)>>>0>r>>>0)break u;e=s[e+8>>2]}}if(s[e>>2]=n,s[e+4>>2]=s[e+4>>2]+a,s[4+(f=(n+8&7?-8-n&7:0)+n|0)>>2]=3|l,e=((n=i+(i+8&7?-8-i&7:0)|0)-f|0)-l|0,d=l+f|0,(0|n)==(0|r)){s[267]=d,e=s[264]+e|0,s[264]=e,s[d+4>>2]=1|e;break a}if(s[266]==(0|n)){s[266]=d,e=s[263]+e|0,s[263]=e,s[d+4>>2]=1|e,s[e+d>>2]=e;break a}if(1==(3&(r=s[n+4>>2]))){p=-8&r;c:if(r>>>0<=255){if(o=r>>>3,r=s[n+8>>2],(0|(i=s[n+12>>2]))==(0|r)){v=1044,g=s[261]&_(o),s[v>>2]=g;break c}s[r+12>>2]=i,s[i+8>>2]=r}else{if(h=s[n+24>>2],(0|(a=s[n+12>>2]))==(0|n))if((l=s[(i=n+20|0)>>2])||(l=s[(i=n+16|0)>>2])){for(;r=i,a=l,(l=s[(i=l+20|0)>>2])||(i=a+16|0,l=s[a+16>>2]););s[r>>2]=0}else a=0;else r=s[n+8>>2],s[r+12>>2]=a,s[a+8>>2]=r;if(h){r=s[n+28>>2];l:{if(s[(i=1348+(r<<2)|0)>>2]==(0|n)){if(s[i>>2]=a,a)break l;v=1048,g=s[262]&_(r),s[v>>2]=g;break c}if(s[h+(s[h+16>>2]==(0|n)?16:20)>>2]=a,!a)break c}s[a+24>>2]=h,(r=s[n+16>>2])&&(s[a+16>>2]=r,s[r+24>>2]=a),(r=s[n+20>>2])&&(s[a+20>>2]=r,s[r+24>>2]=a)}}n=n+p|0,e=e+p|0}if(s[n+4>>2]=-2&s[n+4>>2],s[d+4>>2]=1|e,s[e+d>>2]=e,e>>>0<=255){e=1084+((n=e>>>3)<<3)|0,(r=s[261])&(n=1<<n)?n=s[e+8>>2]:(s[261]=n|r,n=e),s[e+8>>2]=d,s[n+12>>2]=d,s[d+12>>2]=e,s[d+8>>2]=n;break a}if(n=0,(i=e>>>8)&&(n=31,e>>>0>16777215||(n=28+((n=((l=(i<<=o=i+1048320>>>16&8)<<(n=i+520192>>>16&4))<<(i=l+245760>>>16&2)>>>15)-(i|n|o)|0)<<1|e>>>n+21&1)|0)),s[(r=d)+28>>2]=n,s[d+16>>2]=0,s[d+20>>2]=0,r=1348+(n<<2)|0,(i=s[262])&(o=1<<n)){for(i=e<<(31==(0|n)?0:25-(n>>>1)|0),n=s[r>>2];;){if(r=n,(-8&s[n+4>>2])==(0|e))break s;if(n=i>>>29,i<<=1,!(n=s[16+(o=(4&n)+r|0)>>2]))break}s[o+16>>2]=d}else s[262]=i|o,s[r>>2]=d;s[d+24>>2]=r,s[d+12>>2]=d,s[d+8>>2]=d;break a}for(d=(e=a+-40|0)-(i=n+8&7?-8-n&7:0)|0,s[264]=d,i=n+i|0,s[267]=i,s[i+4>>2]=1|d,s[4+(e+n|0)>>2]=40,s[268]=s[383],s[(i=(e=(o+(o+-39&7?39-o&7:0)|0)-47|0)>>>0<r+16>>>0?r:e)+4>>2]=27,e=s[376],s[i+16>>2]=s[375],s[i+20>>2]=e,e=s[374],s[i+8>>2]=s[373],s[i+12>>2]=e,s[375]=i+8,s[374]=a,s[373]=n,s[376]=0,e=i+24|0;s[e+4>>2]=7,n=e+8|0,e=e+4|0,n>>>0<o>>>0;);if((0|r)==(0|i))break i;if(s[i+4>>2]=-2&s[i+4>>2],o=i-r|0,s[r+4>>2]=1|o,s[i>>2]=o,o>>>0<=255){e=1084+((n=o>>>3)<<3)|0,(i=s[261])&(n=1<<n)?n=s[e+8>>2]:(s[261]=n|i,n=e),s[e+8>>2]=r,s[n+12>>2]=r,s[r+12>>2]=e,s[r+8>>2]=n;break i}if(s[r+16>>2]=0,s[r+20>>2]=0,e=0,(i=o>>>8)&&(e=31,o>>>0>16777215||(e=28+((e=((d=(i<<=a=i+1048320>>>16&8)<<(e=i+520192>>>16&4))<<(i=d+245760>>>16&2)>>>15)-(i|e|a)|0)<<1|o>>>e+21&1)|0)),s[(n=r)+28>>2]=e,n=1348+(e<<2)|0,(i=s[262])&(a=1<<e)){for(e=o<<(31==(0|e)?0:25-(e>>>1)|0),n=s[n>>2];;){if(i=n,(0|o)==(-8&s[n+4>>2]))break o;if(n=e>>>29,e<<=1,!(n=s[16+(a=i+(4&n)|0)>>2]))break}s[a+16>>2]=r,s[r+24>>2]=i}else s[262]=i|a,s[n>>2]=r,s[r+24>>2]=n;s[r+12>>2]=r,s[r+8>>2]=r;break i}e=s[r+8>>2],s[e+12>>2]=d,s[r+8>>2]=d,s[d+24>>2]=0,s[d+12>>2]=r,s[d+8>>2]=e}e=f+8|0;break e}e=s[i+8>>2],s[e+12>>2]=r,s[i+8>>2]=r,s[r+24>>2]=0,s[r+12>>2]=i,s[r+8>>2]=e}if(!((e=s[264])>>>0<=l>>>0)){n=e-l|0,s[264]=n,r=(e=s[267])+l|0,s[267]=r,s[r+4>>2]=1|n,s[e+4>>2]=3|l,e=e+8|0;break e}}s[256]=48,e=0;break e}n:if(d){e=s[o+28>>2];r:{if(s[(i=1348+(e<<2)|0)>>2]==(0|o)){if(s[i>>2]=n,n)break r;h=_(e)&h,s[262]=h;break n}if(s[d+(s[d+16>>2]==(0|o)?16:20)>>2]=n,!n)break n}s[n+24>>2]=d,(e=s[o+16>>2])&&(s[n+16>>2]=e,s[e+24>>2]=n),(e=s[o+20>>2])&&(s[n+20>>2]=e,s[e+24>>2]=n)}n:if(r>>>0<=15)e=r+l|0,s[o+4>>2]=3|e,s[4+(e=e+o|0)>>2]=1|s[e+4>>2];else if(s[o+4>>2]=3|l,s[4+(i=o+l|0)>>2]=1|r,s[r+i>>2]=r,r>>>0<=255)e=1084+((n=r>>>3)<<3)|0,(r=s[261])&(n=1<<n)?n=s[e+8>>2]:(s[261]=n|r,n=e),s[e+8>>2]=i,s[n+12>>2]=i,s[i+12>>2]=e,s[i+8>>2]=n;else{e=0,(l=r>>>8)&&(e=31,r>>>0>16777215||(e=28+((e=((d=(l<<=a=l+1048320>>>16&8)<<(e=l+520192>>>16&4))<<(l=d+245760>>>16&2)>>>15)-(l|e|a)|0)<<1|r>>>e+21&1)|0)),s[(n=i)+28>>2]=e,s[i+16>>2]=0,s[i+20>>2]=0,n=1348+(e<<2)|0;r:{if((l=1<<e)&h){for(e=r<<(31==(0|e)?0:25-(e>>>1)|0),l=s[n>>2];;){if((-8&s[(n=l)+4>>2])==(0|r))break r;if(l=e>>>29,e<<=1,!(l=s[16+(a=(4&l)+n|0)>>2]))break}s[a+16>>2]=i}else s[262]=l|h,s[n>>2]=i;s[i+24>>2]=n,s[i+12>>2]=i,s[i+8>>2]=i;break n}e=s[n+8>>2],s[e+12>>2]=i,s[n+8>>2]=i,s[i+24>>2]=0,s[i+12>>2]=n,s[i+8>>2]=e}e=o+8|0;break e}t:if(f){e=s[n+28>>2];n:{if(s[(r=1348+(e<<2)|0)>>2]==(0|n)){if(s[r>>2]=o,o)break n;v=1048,g=_(e)&p,s[v>>2]=g;break t}if(s[f+(s[f+16>>2]==(0|n)?16:20)>>2]=o,!o)break t}s[o+24>>2]=f,(e=s[n+16>>2])&&(s[o+16>>2]=e,s[e+24>>2]=o),(e=s[n+20>>2])&&(s[o+20>>2]=e,s[e+24>>2]=o)}i>>>0<=15?(e=i+l|0,s[n+4>>2]=3|e,s[4+(e=e+n|0)>>2]=1|s[e+4>>2]):(s[n+4>>2]=3|l,s[4+(l=n+l|0)>>2]=1|i,s[i+l>>2]=i,h&&(e=1084+((r=h>>>3)<<3)|0,o=s[266],(r=1<<r)&a?r=s[e+8>>2]:(s[261]=r|a,r=e),s[e+8>>2]=o,s[r+12>>2]=o,s[o+12>>2]=e,s[o+8>>2]=r),s[266]=l,s[263]=i),e=n+8|0}return m=t+16|0,0|e}function g(e){var t=0,n=0,r=0,i=0,o=0,a=0,u=0,l=0,d=0;e:if(e|=0){o=(r=e+-8|0)+(e=-8&(n=s[e+-4>>2]))|0;t:if(!(1&n)){if(!(3&n))break e;if((r=r-(n=s[r>>2])|0)>>>0<c[265])break e;if(e=e+n|0,s[266]==(0|r)){if(3==(3&(n=s[o+4>>2])))return s[263]=e,s[o+4>>2]=-2&n,s[r+4>>2]=1|e,void(s[e+r>>2]=e)}else{if(n>>>0<=255){if(i=s[r+8>>2],n>>>=3,(0|(t=s[r+12>>2]))==(0|i)){l=1044,d=s[261]&_(n),s[l>>2]=d;break t}s[i+12>>2]=t,s[t+8>>2]=i;break t}if(u=s[r+24>>2],(0|r)==(0|(n=s[r+12>>2])))if((t=s[(i=r+20|0)>>2])||(t=s[(i=r+16|0)>>2])){for(;a=i,(t=s[(i=(n=t)+20|0)>>2])||(i=n+16|0,t=s[n+16>>2]););s[a>>2]=0}else n=0;else t=s[r+8>>2],s[t+12>>2]=n,s[n+8>>2]=t;if(!u)break t;i=s[r+28>>2];n:{if(s[(t=1348+(i<<2)|0)>>2]==(0|r)){if(s[t>>2]=n,n)break n;l=1048,d=s[262]&_(i),s[l>>2]=d;break t}if(s[u+(s[u+16>>2]==(0|r)?16:20)>>2]=n,!n)break t}if(s[n+24>>2]=u,(t=s[r+16>>2])&&(s[n+16>>2]=t,s[t+24>>2]=n),!(t=s[r+20>>2]))break t;s[n+20>>2]=t,s[t+24>>2]=n}}if(!(o>>>0<=r>>>0)&&1&(n=s[o+4>>2])){t:{if(!(2&n)){if(s[267]==(0|o)){if(s[267]=r,e=s[264]+e|0,s[264]=e,s[r+4>>2]=1|e,s[266]!=(0|r))break e;return s[263]=0,void(s[266]=0)}if(s[266]==(0|o))return s[266]=r,e=s[263]+e|0,s[263]=e,s[r+4>>2]=1|e,void(s[e+r>>2]=e);e=(-8&n)+e|0;n:if(n>>>0<=255){if(n>>>=3,(0|(t=s[o+8>>2]))==(0|(i=s[o+12>>2]))){l=1044,d=s[261]&_(n),s[l>>2]=d;break n}s[t+12>>2]=i,s[i+8>>2]=t}else{if(u=s[o+24>>2],(0|o)==(0|(n=s[o+12>>2])))if((t=s[(i=o+20|0)>>2])||(t=s[(i=o+16|0)>>2])){for(;a=i,(t=s[(i=(n=t)+20|0)>>2])||(i=n+16|0,t=s[n+16>>2]););s[a>>2]=0}else n=0;else t=s[o+8>>2],s[t+12>>2]=n,s[n+8>>2]=t;if(u){i=s[o+28>>2];r:{if(s[(t=1348+(i<<2)|0)>>2]==(0|o)){if(s[t>>2]=n,n)break r;l=1048,d=s[262]&_(i),s[l>>2]=d;break n}if(s[u+(s[u+16>>2]==(0|o)?16:20)>>2]=n,!n)break n}s[n+24>>2]=u,(t=s[o+16>>2])&&(s[n+16>>2]=t,s[t+24>>2]=n),(t=s[o+20>>2])&&(s[n+20>>2]=t,s[t+24>>2]=n)}}if(s[r+4>>2]=1|e,s[e+r>>2]=e,s[266]!=(0|r))break t;return void(s[263]=e)}s[o+4>>2]=-2&n,s[r+4>>2]=1|e,s[e+r>>2]=e}if(e>>>0<=255)return n=1084+((e>>>=3)<<3)|0,(t=s[261])&(e=1<<e)?e=s[n+8>>2]:(s[261]=e|t,e=n),s[n+8>>2]=r,s[e+12>>2]=r,s[r+12>>2]=n,void(s[r+8>>2]=e);s[r+16>>2]=0,s[r+20>>2]=0,t=0,(i=e>>>8)&&(t=31,e>>>0>16777215||(t=i,t<<=i=i+1048320>>>16&8,t=28+((t=((t<<=u=t+520192>>>16&4)<<(a=t+245760>>>16&2)>>>15)-(a|i|u)|0)<<1|e>>>t+21&1)|0)),s[(n=r)+28>>2]=t,a=1348+(t<<2)|0;t:if((i=s[262])&(n=1<<t)){i=e<<(31==(0|t)?0:25-(t>>>1)|0),n=s[a>>2];n:{for(;;){if(t=n,(-8&s[n+4>>2])==(0|e))break n;if(n=i>>>29,i<<=1,!(n=s[16+(a=t+(4&n)|0)>>2]))break}s[a+16>>2]=r,s[r+12>>2]=r,s[r+24>>2]=t,s[r+8>>2]=r;break t}e=s[t+8>>2],s[e+12>>2]=r,s[t+8>>2]=r,s[r+24>>2]=0,s[r+12>>2]=t,s[r+8>>2]=e}else s[262]=n|i,s[a>>2]=r,s[r+12>>2]=r,s[r+24>>2]=a,s[r+8>>2]=r;if(e=s[269]+-1|0,s[269]=e,!e){for(r=1500;r=(e=s[r>>2])+8|0,e;);s[269]=-1}}}}function b(e){var t,n=0;return c[e+20>>2]<=c[e+28>>2]||(o[s[e+36>>2]](e,0,0),s[e+20>>2])?((n=s[e+4>>2])>>>0<(t=s[e+8>>2])>>>0&&(n=n-t|0,o[s[e+40>>2]](e,n,n>>31,1)),s[e+28>>2]=0,s[e+16>>2]=0,s[e+20>>2]=0,s[e+4>>2]=0,s[e+8>>2]=0,0):-1}function A(e){for(var t=0,n=0;n=t,e;)e&=e-1,t=t+1|0;return n}function _(e){var t;return(-1>>>(t=31&e)&-2)<<t|(-1<<(e=0-e&31)&-2)>>>e}function w(){return r.byteLength/65536|0}return{__wasm_call_ctors:function(){},malloc:v,openBox:function(e,t){e|=0,t|=0;var n,r,i,o=0;return m=n=m-16|0,s[n+12>>2]=0,s[n+8>>2]=0,s[n+4>>2]=0,s[n>>2]=0,function(e,t,n,r,i,o){var c=0,l=0,d=0,h=0,f=0,p=0;if(c=(u[e+2|0]^u[e+1|0]^u[0|e])<<24>>24,s[o>>2]=c+-48,c=47+(t-c|0)|0,s[r>>2]=c,f=n,p=v(c),s[f>>2]=p,l=s[o>>2],d=v(l),s[i>>2]=d,(0|l)>0)for(c=l;;){if(d=(l-c|0)+d|0,l=(t-l|0)+e|0,a[0|d]=u[(t-c|0)+e|0]^u[l+-1|0]^u[l+-2|0],(0|(c=c+-1|0))<1){c=s[r>>2];break}d=s[i>>2],l=s[o>>2]}if((0|c)>0)for(;t=s[n>>2]+h|0,h=h+1|0,a[0|t]=u[h+e|0],(0|h)<s[r>>2];);}(e,t,n+12|0,n+4|0,n+8|0,n),function(e,t){var n=0,r=0,i=0,o=0,s=0,c=0,l=0;if((0|t)>=1)for(i=85,o=250;r=A(n),s=u[0|(c=e+n|0)],l=r,r=1&n,a[0|c]=l+(21+((s^(r?i:o))<<24>>24)|0),o=r?o:s,i=r?s:i,(0|(n=n+1|0))!=(0|t););}(e=s[n+12>>2],t=s[n+4>>2]),r=function(e){var t=0;return(255&(t=e+-48|0))>>>0<=9?t<<24>>24:((e+-97&255)>>>0<26?e+-87|0:-1)<<24>>24}(a[0|e]),s[n>>2]=r,i=v(o=t-r|0),a[i+(o=o+-1|0)|0]=0,(0|o)>=1&&function(e,t,n){var r,i=0;if(n>>>0>=8192)d(0|e,0|t,0|n);else{r=e+n|0;e:if(3&(e^t))if(r>>>0<4)n=e;else if((i=r+-4|0)>>>0<e>>>0)n=e;else for(n=e;a[0|n]=u[0|t],a[n+1|0]=u[t+1|0],a[n+2|0]=u[t+2|0],a[n+3|0]=u[t+3|0],t=t+4|0,(n=n+4|0)>>>0<=i>>>0;);else{t:if((0|n)<1)n=e;else if(3&e)for(n=e;;){if(a[0|n]=u[0|t],t=t+1|0,(n=n+1|0)>>>0>=r>>>0)break t;if(!(3&n))break}else n=e;if(!((e=-4&r)>>>0<64||n>>>0>(i=e+-64|0)>>>0))for(;s[n>>2]=s[t>>2],s[n+4>>2]=s[t+4>>2],s[n+8>>2]=s[t+8>>2],s[n+12>>2]=s[t+12>>2],s[n+16>>2]=s[t+16>>2],s[n+20>>2]=s[t+20>>2],s[n+24>>2]=s[t+24>>2],s[n+28>>2]=s[t+28>>2],s[n+32>>2]=s[t+32>>2],s[n+36>>2]=s[t+36>>2],s[n+40>>2]=s[t+40>>2],s[n+44>>2]=s[t+44>>2],s[n+48>>2]=s[t+48>>2],s[n+52>>2]=s[t+52>>2],s[n+56>>2]=s[t+56>>2],s[n+60>>2]=s[t+60>>2],t=t- -64|0,(n=n- -64|0)>>>0<=i>>>0;);if(n>>>0>=e>>>0)break e;for(;s[n>>2]=s[t>>2],t=t+4|0,(n=n+4|0)>>>0<e>>>0;);}if(n>>>0<r>>>0)for(;a[0|n]=u[0|t],t=t+1|0,(0|r)!=(0|(n=n+1|0)););}}(i,e+1|0,t+(-1^r)|0),g(e),g(s[n+8>>2]),m=n+16|0,0|i},free:g,__errno_location:function(){return 1024},fflush:function e(t){var n=0;if(t|=0)return s[t+76>>2],0|b(t);if(s[260]&&(n=e(s[260])),p(1028),t=s[259])for(;c[t+20>>2]>c[t+28>>2]&&(n=b(t)|n),t=s[t+56>>2];);return f(1028),0|n},setThrew:function(e,t){e|=0,t|=0,s[385]||(s[386]=t,s[385]=e)},stackSave:function(){return 0|m},stackAlloc:function(e){return m=e=m-(e|=0)&-16,0|e},stackRestore:function(e){m=e|=0},__growWasmMemory:function(t){return 0|function(t){t|=0;var n=0|w(),o=n+t|0;if(n<o&&o<65536){var d=new ArrayBuffer(l(o,65536)),h=new e.Int8Array(d);h.set(a),a=h,a=new e.Int8Array(d),new e.Int16Array(d),s=new e.Int32Array(d),u=new e.Uint8Array(d),new e.Uint16Array(d),c=new e.Uint32Array(d),new e.Float32Array(d),new e.Float64Array(d),r=d,i.buffer=d}return n}(0|(t|=0))}}}({Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,NaN:NaN,Infinity:1/0,Math:Math},J,d.buffer))}},instantiate:function(e,t){return{then:function(n,r){n({instance:new h.Instance(new h.Module(e,t))})}}},RuntimeError:Error};s=[],"object"!==cK(h)&&N("No WebAssembly support found. Build with -s WASM=0 to target JavaScript instead.");var f=new h.Table({initial:1,maximum:1,element:"anyfunc"}),p=!1;function m(e,t){e||N("Assertion failed: "+t)}var y,v,g,b,A,_="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function w(e,t,n,r){if(!(r>0))return 0;for(var i=n,o=n+r-1,a=0;a<e.length;++a){var s=e.charCodeAt(a);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(n>=o)break;t[n++]=s}else if(s<=2047){if(n+1>=o)break;t[n++]=192|s>>6,t[n++]=128|63&s}else if(s<=65535){if(n+2>=o)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|63&s}else{if(n+3>=o)break;s>=2097152&&l("Invalid Unicode code point 0x"+s.toString(16)+" encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF)."),t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}}return t[n]=0,n-i}function S(e){for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r>=55296&&r<=57343&&(r=65536+((1023&r)<<10)|1023&e.charCodeAt(++n)),r<=127?++t:t+=r<=2047?2:r<=65535?3:4}return t}function k(e,t){return e%t>0&&(e+=t-e%t),e}function T(e){y=e,n.HEAP8=v=new Int8Array(e),n.HEAP16=new Int16Array(e),n.HEAP32=b=new Int32Array(e),n.HEAPU8=g=new Uint8Array(e),n.HEAPU16=new Uint16Array(e),n.HEAPU32=A=new Uint32Array(e),n.HEAPF32=new Float32Array(e),n.HEAPF64=new Float64Array(e)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var x=1712;m(!0,"stack must start aligned"),m(!0,"heap must start aligned");var E=8192;n.TOTAL_STACK&&m(E===n.TOTAL_STACK,"the stack size can no longer be determined at runtime");var L=n.TOTAL_MEMORY||65536;function I(){m(0==(3&x)),A[1+(x>>2)]=34821223,A[2+(x>>2)]=2310721022,b[0]=1668509029}function R(){var e=A[1+(x>>2)],t=A[2+(x>>2)];34821223==e&&2310721022==t||N("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x"+t.toString(16)+" "+e.toString(16)),1668509029!==b[0]&&N("Runtime error: The application has corrupted its heap memory area (address zero)!")}function Z(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?n.dynCall_v(r):n.dynCall_vi(r,t.arg):r(void 0===t.arg?null:t.arg)}else t()}}Object.getOwnPropertyDescriptor(n,"TOTAL_MEMORY")||Object.defineProperty(n,"TOTAL_MEMORY",{configurable:!0,get:function(){N("Module.TOTAL_MEMORY has been replaced with plain INITIAL_TOTAL_MEMORY")}}),m(L>=E,"TOTAL_MEMORY should be larger than TOTAL_STACK, was "+L+"! (TOTAL_STACK="+E+")"),m("undefined"!=typeof Int32Array&&"undefined"!=typeof Float64Array&&void 0!==Int32Array.prototype.subarray&&void 0!==Int32Array.prototype.set,"JS engine does not provide full typed array support"),(d=n.wasmMemory?n.wasmMemory:new h.Memory({initial:L/65536}))&&(y=d.buffer),m((L=y.byteLength)%65536==0),T(y),b[388]=9904,function(){var e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,115!==t[0]||99!==t[1])throw"Runtime error: expected the system to be little-endian!"}();var C=[],P=[],G=[],D=[],M=!1;m(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),m(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),m(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),m(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var V=0,X=null,W=null,O={};function N(e){throw n.onAbort&&n.onAbort(e),u(e+=""),c(e),p=!0,e="abort("+e+") at "+(r=function(){var e=new Error;if(!e.stack){try{throw new Error(0)}catch(kye){e=kye}if(!e.stack)return"(no stack trace available)"}return e.stack.toString()}(),n.extraStackTrace&&(r+="\n"+n.extraStackTrace()),t=/\b_Z[\w\d_]+/g,r.replace(t,(function(e){var t,n=(t=e,l("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"),t);return e===n?e:n+" ["+e+"]"}))),new h.RuntimeError(e);var t,r}n.preloadedImages={},n.preloadedAudios={};var U={error:function(){N("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -s FORCE_FILESYSTEM=1")},init:function(){U.error()},createDataFile:function(){U.error()},createPreloadedFile:function(){U.error()},createLazyFile:function(){U.error()},open:function(){U.error()},mkdev:function(){U.error()},registerDevice:function(){U.error()},analyzePath:function(){U.error()},loadFilesFromDB:function(){U.error()},ErrnoError:function(){U.error()}};n.FS_createDataFile=U.createDataFile,n.FS_createPreloadedFile=U.createPreloadedFile;var F="data:application/octet-stream;base64,";function Y(e){return String.prototype.startsWith?e.startsWith(F):0===e.indexOf(F)}var K,j="aw.wasm";function H(){try{if(s)return new Uint8Array(s);var e=function(e){if(Y(e))return function(e){try{for(var t=B(e),n=new Uint8Array(t.length),r=0;r<t.length;++r)n[r]=t.charCodeAt(r);return n}catch(i){throw new Error("Converting base64 string to bytes failed.")}}(e.slice(F.length))}(j);if(e)return e;if(!o)throw"both async and sync fetching of the wasm failed"}catch(t){N(t)}}Y(j)||(K=j,j=n.locateFile?n.locateFile(K,a):a+K),P.push({func:function(){ue()}});var B="function"==typeof atob?atob:function(e){var t,n,r,i,o,a,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",c=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{t=s.indexOf(e.charAt(c++))<<2|(i=s.indexOf(e.charAt(c++)))>>4,n=(15&i)<<4|(o=s.indexOf(e.charAt(c++)))>>2,r=(3&o)<<6|(a=s.indexOf(e.charAt(c++))),u+=String.fromCharCode(t),64!==o&&(u+=String.fromCharCode(n)),64!==a&&(u+=String.fromCharCode(r))}while(c<e.length);return u},J={__lock:function(){},__unlock:function(){},emscripten_memcpy_big:function(e,t,n){g.set(g.subarray(t,t+n),e)},emscripten_resize_heap:function(e){var t=v.length;m(e>t);var n=65536,r=2147418112;if(e>r)return c("Cannot enlarge memory, asked to go up to "+e+" bytes, but the limit is "+r+" bytes!"),!1;for(var i=Math.max(t,16777216);i<e;)(i=i<=536870912?k(2*i,n):Math.min(k((3*i+2147483648)/4,n),r))===t&&l("Cannot ask for more memory since we reached the practical limit in browsers (which is just below 2GB), so the request would have failed. Requesting only "+v.length);return function(e){try{return d.grow(e-y.byteLength+65535>>16),T(d.buffer),1}catch(kye){console.error("emscripten_realloc_buffer: Attempted to grow heap from "+y.byteLength+" bytes to "+e+" bytes, but got error: "+kye)}}(i)?(c("Warning: Enlarging memory arrays, this is not fast! "+[t,i]),!0):(c("Failed to grow the heap from "+t+" bytes to "+i+" bytes, not enough memory!"),!1)},memory:d,table:f},z=function(){var e,t={env:J,wasi_unstable:J};function r(e,t){var r=e.exports;n.asm=r,function(e){if(V--,n.monitorRunDependencies&&n.monitorRunDependencies(V),e?(m(O[e]),delete O[e]):c("warning: run dependency removed without ID"),0==V&&(null!==X&&(clearInterval(X),X=null),W)){var t=W;W=null,t()}}("wasm-instantiate")}e="wasm-instantiate",V++,n.monitorRunDependencies&&n.monitorRunDependencies(V),e?(m(!O[e]),O[e]=1,null===X&&"undefined"!=typeof setInterval&&(X=setInterval((function(){if(p)return clearInterval(X),void(X=null);var e=!1;for(var t in O)e||(e=!0,c("still waiting on run dependencies:")),c("dependency: "+t);e&&c("(end of list)")}),1e4))):c("warning: run dependency added without ID");var o=n;function a(e){m(n===o,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),o=null,r(e.instance)}function u(e){return(!s&&i&&"function"==typeof fetch?fetch(j,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+j+"'";return e.arrayBuffer()})).catch((function(){return H()})):new Promise((function(e,t){e(H())}))).then((function(e){return h.instantiate(e,t)})).then(e,(function(e){c("failed to asynchronously prepare wasm: "+e),N(e)}))}if(n.instantiateWasm)try{return n.instantiateWasm(t,r)}catch(kye){return c("Module.instantiateWasm callback failed with error: "+kye),!1}return function(){if(s||"function"!=typeof h.instantiateStreaming||Y(j)||"function"!=typeof fetch)return u(a);fetch(j,{credentials:"same-origin"}).then((function(e){return h.instantiateStreaming(e,t).then(a,(function(e){c("wasm streaming compile failed: "+e),c("falling back to ArrayBuffer instantiation"),u(a)}))}))}(),{}}(),Q=z.__wasm_call_ctors;z.__wasm_call_ctors=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Q.apply(null,arguments)};var q=z.malloc;z.malloc=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),q.apply(null,arguments)};var $=z.openBox;z.openBox=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),$.apply(null,arguments)};var ee=z.free;z.free=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),ee.apply(null,arguments)};var te=z.__errno_location;z.__errno_location=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),te.apply(null,arguments)};var ne=z.fflush;z.fflush=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),ne.apply(null,arguments)};var re=z.setThrew;z.setThrew=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),re.apply(null,arguments)};var ie=z.stackSave;z.stackSave=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),ie.apply(null,arguments)};var oe=z.stackAlloc;z.stackAlloc=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),oe.apply(null,arguments)};var ae=z.stackRestore;z.stackRestore=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),ae.apply(null,arguments)};var se=z.__growWasmMemory;z.__growWasmMemory=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),se.apply(null,arguments)},n.asm=z;var ue=n.___wasm_call_ctors=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.__wasm_call_ctors.apply(null,arguments)},ce=n._malloc=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.malloc.apply(null,arguments)};n._openBox=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.openBox.apply(null,arguments)},n._free=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.free.apply(null,arguments)},n.___errno_location=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.__errno_location.apply(null,arguments)},n._fflush=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.fflush.apply(null,arguments)},n._setThrew=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.setThrew.apply(null,arguments)};var le=n.stackSave=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.stackSave.apply(null,arguments)};n.stackAlloc=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.stackAlloc.apply(null,arguments)},n.stackRestore=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.stackRestore.apply(null,arguments)};var de,he=n.__growWasmMemory=function(){return m(M,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),m(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.__growWasmMemory.apply(null,arguments)};function fe(e){function t(){de||(de=!0,p||(R(),m(!M),M=!0,Z(P),R(),Z(G),n.onRuntimeInitialized&&n.onRuntimeInitialized(),m(!n._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),function(){if(R(),n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)e=n.postRun.shift(),D.unshift(e);var e;Z(D)}()))}V>0||(I(),function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)e=n.preRun.shift(),C.unshift(e);var e;Z(C)}(),V>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),t()}),1)):t(),R()))}if(n.asm=z,n.intArrayFromString=function(e,t,n){var r=n>0?n:S(e)+1,i=new Array(r),o=w(e,i,0,i.length);return t&&(i.length=o),i},Object.getOwnPropertyDescriptor(n,"intArrayToString")||(n.intArrayToString=function(){N("'intArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"ccall")||(n.ccall=function(){N("'ccall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"cwrap")||(n.cwrap=function(){N("'cwrap' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"setValue")||(n.setValue=function(){N("'setValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getValue")||(n.getValue=function(){N("'getValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"allocate")||(n.allocate=function(){N("'allocate' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getMemory")||(n.getMemory=function(){N("'getMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"AsciiToString")||(n.AsciiToString=function(){N("'AsciiToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stringToAscii")||(n.stringToAscii=function(){N("'stringToAscii' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"UTF8ArrayToString")||(n.UTF8ArrayToString=function(){N("'UTF8ArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),n.UTF8ToString=function(e,t){return e?function(e,t,n){for(var r=t+n,i=t;e[i]&&!(i>=r);)++i;if(i-t>16&&e.subarray&&_)return _.decode(e.subarray(t,i));for(var o="";t<i;){var a=e[t++];if(128&a){var s=63&e[t++];if(192!=(224&a)){var u=63&e[t++];if(224==(240&a)?a=(15&a)<<12|s<<6|u:(240!=(248&a)&&l("Invalid UTF-8 leading byte 0x"+a.toString(16)+" encountered when deserializing a UTF-8 string on the asm.js/wasm heap to a JS string!"),a=(7&a)<<18|s<<12|u<<6|63&e[t++]),a<65536)o+=String.fromCharCode(a);else{var c=a-65536;o+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else o+=String.fromCharCode((31&a)<<6|s)}else o+=String.fromCharCode(a)}return o}(g,e,t):""},Object.getOwnPropertyDescriptor(n,"stringToUTF8Array")||(n.stringToUTF8Array=function(){N("'stringToUTF8Array' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stringToUTF8")||(n.stringToUTF8=function(){N("'stringToUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"lengthBytesUTF8")||(n.lengthBytesUTF8=function(){N("'lengthBytesUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"UTF16ToString")||(n.UTF16ToString=function(){N("'UTF16ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stringToUTF16")||(n.stringToUTF16=function(){N("'stringToUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"lengthBytesUTF16")||(n.lengthBytesUTF16=function(){N("'lengthBytesUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"UTF32ToString")||(n.UTF32ToString=function(){N("'UTF32ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stringToUTF32")||(n.stringToUTF32=function(){N("'stringToUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"lengthBytesUTF32")||(n.lengthBytesUTF32=function(){N("'lengthBytesUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),n.allocateUTF8=function(e){var t=S(e)+1,n=ce(t);return n&&w(e,v,n,t),n},Object.getOwnPropertyDescriptor(n,"stackTrace")||(n.stackTrace=function(){N("'stackTrace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addOnPreRun")||(n.addOnPreRun=function(){N("'addOnPreRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addOnInit")||(n.addOnInit=function(){N("'addOnInit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addOnPreMain")||(n.addOnPreMain=function(){N("'addOnPreMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addOnExit")||(n.addOnExit=function(){N("'addOnExit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addOnPostRun")||(n.addOnPostRun=function(){N("'addOnPostRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"writeStringToMemory")||(n.writeStringToMemory=function(){N("'writeStringToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"writeArrayToMemory")||(n.writeArrayToMemory=function(){N("'writeArrayToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"writeAsciiToMemory")||(n.writeAsciiToMemory=function(){N("'writeAsciiToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addRunDependency")||(n.addRunDependency=function(){N("'addRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"removeRunDependency")||(n.removeRunDependency=function(){N("'removeRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"ENV")||(n.ENV=function(){N("'ENV' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"FS")||(n.FS=function(){N("'FS' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"FS_createFolder")||(n.FS_createFolder=function(){N("'FS_createFolder' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"FS_createPath")||(n.FS_createPath=function(){N("'FS_createPath' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"FS_createDataFile")||(n.FS_createDataFile=function(){N("'FS_createDataFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"FS_createPreloadedFile")||(n.FS_createPreloadedFile=function(){N("'FS_createPreloadedFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"FS_createLazyFile")||(n.FS_createLazyFile=function(){N("'FS_createLazyFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"FS_createLink")||(n.FS_createLink=function(){N("'FS_createLink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"FS_createDevice")||(n.FS_createDevice=function(){N("'FS_createDevice' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"FS_unlink")||(n.FS_unlink=function(){N("'FS_unlink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"GL")||(n.GL=function(){N("'GL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"dynamicAlloc")||(n.dynamicAlloc=function(){N("'dynamicAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"loadDynamicLibrary")||(n.loadDynamicLibrary=function(){N("'loadDynamicLibrary' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"loadWebAssemblyModule")||(n.loadWebAssemblyModule=function(){N("'loadWebAssemblyModule' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getLEB")||(n.getLEB=function(){N("'getLEB' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getFunctionTables")||(n.getFunctionTables=function(){N("'getFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"alignFunctionTables")||(n.alignFunctionTables=function(){N("'alignFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"registerFunctions")||(n.registerFunctions=function(){N("'registerFunctions' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addFunction")||(n.addFunction=function(){N("'addFunction' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"removeFunction")||(n.removeFunction=function(){N("'removeFunction' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getFuncWrapper")||(n.getFuncWrapper=function(){N("'getFuncWrapper' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"prettyPrint")||(n.prettyPrint=function(){N("'prettyPrint' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"makeBigInt")||(n.makeBigInt=function(){N("'makeBigInt' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"dynCall")||(n.dynCall=function(){N("'dynCall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getCompilerSetting")||(n.getCompilerSetting=function(){N("'getCompilerSetting' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stackSave")||(n.stackSave=function(){N("'stackSave' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stackRestore")||(n.stackRestore=function(){N("'stackRestore' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stackAlloc")||(n.stackAlloc=function(){N("'stackAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"establishStackSpace")||(n.establishStackSpace=function(){N("'establishStackSpace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"print")||(n.print=function(){N("'print' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"printErr")||(n.printErr=function(){N("'printErr' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getTempRet0")||(n.getTempRet0=function(){N("'getTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"setTempRet0")||(n.setTempRet0=function(){N("'setTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"callMain")||(n.callMain=function(){N("'callMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"abort")||(n.abort=function(){N("'abort' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),n.Pointer_stringify=function(e,t){N("this function has been removed - you should use UTF8ToString(ptr, maxBytesToRead) instead!")},Object.getOwnPropertyDescriptor(n,"warnOnce")||(n.warnOnce=function(){N("'warnOnce' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),n.writeStackCookie=I,n.checkStackCookie=R,n.abortStackOverflow=function(e){N("Stack overflow! Attempted to allocate "+e+" bytes on the stack, but stack has only "+(x-le()+e)+" bytes available!")},Object.getOwnPropertyDescriptor(n,"intArrayFromBase64")||(n.intArrayFromBase64=function(){N("'intArrayFromBase64' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"tryParseAsDataURI")||(n.tryParseAsDataURI=function(){N("'tryParseAsDataURI' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"ALLOC_NORMAL")||Object.defineProperty(n,"ALLOC_NORMAL",{configurable:!0,get:function(){N("'ALLOC_NORMAL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(n,"ALLOC_STACK")||Object.defineProperty(n,"ALLOC_STACK",{configurable:!0,get:function(){N("'ALLOC_STACK' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(n,"ALLOC_DYNAMIC")||Object.defineProperty(n,"ALLOC_DYNAMIC",{configurable:!0,get:function(){N("'ALLOC_DYNAMIC' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(n,"ALLOC_NONE")||Object.defineProperty(n,"ALLOC_NONE",{configurable:!0,get:function(){N("'ALLOC_NONE' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(n,"calledRun")||Object.defineProperty(n,"calledRun",{configurable:!0,get:function(){N("'calledRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}}),n.then=function(e){if(de)e(n);else{var t=n.onRuntimeInitialized;n.onRuntimeInitialized=function(){t&&t(),e(n)}}return n},W=function e(){de||fe(),de||(W=e)},n.run=fe,n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return fe(),e}),Kse=function(){function e(t,n){hK(this,e),this.cdnHost=t,this.cdnBucket=n}return pK(e,[{key:"init",value:function(){var e=new ese;this.module={onRuntimeInitialized:function(){e.resolve()},onAbort:function(t){e.reject(t)}},this.cdnHost&&(this.module.cdnHost=this.cdnHost);var t=this.cdnBucket?"-".concat(this.cdnBucket):"";return this.module.cdnBucket="media-fe".concat(t),Yse(this.module),e}},{key:"openBox",value:function(e){try{var t=window.atob(e),n=Yie.str2hex(t),r=this.module._malloc(Number(n.length));this.module.HEAP8.set(n,r);var i=this.module._openBox(Number(r),n.length),o=this.module.UTF8ToString(i);return this.module._free(r),o}catch(Sye){}}},{key:"destroy",value:function(){this.module=null}}]),e}(),jse=dm.some;Py({target:"Array",proto:!0,forced:!fm("some")},{some:function(e){return jse(this,e,arguments.length>1?arguments[1]:void 0)}});var Hse={},Bse=Vd;Hse.f=Bse;var Jse=Il,zse=rd,Qse=Hse,qse=Od.f,$se=ih,eue=md,tue=Vd,nue=Jf,rue=Py,iue=Il,oue=ih,aue=Hl,sue=Nd,uue=xd,cue=Nl,lue=rd,due=oh,hue=th,fue=Rm,pue=Gh,mue=tv,yue=lf,vue=Vv,gue=fv,bue=Om,Aue=Gy,_ue=oy,wue=Sm,Sue=Od,kue=lv,Tue=km,xue=Jf,Eue=Ol,Lue=vf,Iue=ud,Rue=Vd,Zue=Hse,Cue=function(e){var t=Jse.Symbol||(Jse.Symbol={});zse(t,e)||qse(t,e,{value:Qse.f(e)})},Pue=function(){var e=eue("Symbol"),t=e&&e.prototype,n=t&&t.valueOf,r=tue("toPrimitive");t&&!t[r]&&nue(t,r,(function(e){return $se(n,this)}),{arity:1})},Gue=Qb,Due=Zf,Mue=dm.forEach,Vue=yf("hidden"),Xue="Symbol",Wue="prototype",Oue=Due.set,Nue=Due.getterFor(Xue),Uue=Object[Wue],Fue=iue.Symbol,Yue=Fue&&Fue[Wue],Kue=iue.TypeError,jue=iue.QObject,Hue=wue.f,Bue=Sue.f,Jue=Aue.f,zue=Tue.f,Que=aue([].push),que=Eue("symbols"),$ue=Eue("op-symbols"),ece=Eue("wks"),tce=!jue||!jue[Wue]||!jue[Wue].findChild,nce=sue&&cue((function(){return 7!=vue(Bue({},"a",{get:function(){return Bue(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=Hue(Uue,t);r&&delete Uue[t],Bue(e,t,n),r&&e!==Uue&&Bue(Uue,t,r)}:Bue,rce=function(e,t){var n=que[e]=vue(Yue);return Oue(n,{type:Xue,tag:e,description:t}),sue||(n.description=t),n},ice=function(e,t,n){e===Uue&&ice($ue,t,n),hue(e);var r=pue(t);return hue(n),lue(que,r)?(n.enumerable?(lue(e,Vue)&&e[Vue][r]&&(e[Vue][r]=!1),n=vue(n,{enumerable:yue(0,!1)})):(lue(e,Vue)||Bue(e,Vue,yue(1,{})),e[Vue][r]=!0),nce(e,r,n)):Bue(e,r,n)},oce=function(e,t){hue(e);var n=fue(t),r=gue(n).concat(cce(n));return Mue(r,(function(t){sue&&!oue(ace,n,t)||ice(e,t,n[t])})),e},ace=function(e){var t=pue(e),n=oue(zue,this,t);return!(this===Uue&&lue(que,t)&&!lue($ue,t))&&(!(n||!lue(this,t)||!lue(que,t)||lue(this,Vue)&&this[Vue][t])||n)},sce=function(e,t){var n=fue(e),r=pue(t);if(n!==Uue||!lue(que,r)||lue($ue,r)){var i=Hue(n,r);return!i||!lue(que,r)||lue(n,Vue)&&n[Vue][r]||(i.enumerable=!0),i}},uce=function(e){var t=Jue(fue(e)),n=[];return Mue(t,(function(e){lue(que,e)||lue(Lue,e)||Que(n,e)})),n},cce=function(e){var t=e===Uue,n=Jue(t?$ue:fue(e)),r=[];return Mue(n,(function(e){!lue(que,e)||t&&!lue(Uue,e)||Que(r,que[e])})),r};uue||(Fue=function(){if(due(Yue,this))throw Kue("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?mue(arguments[0]):void 0,t=Iue(e),n=function(e){this===Uue&&oue(n,$ue,e),lue(this,Vue)&&lue(this[Vue],t)&&(this[Vue][t]=!1),nce(this,t,yue(1,e))};return sue&&tce&&nce(Uue,t,{configurable:!0,set:n}),rce(t,e)},xue(Yue=Fue[Wue],"toString",(function(){return Nue(this).tag})),xue(Fue,"withoutSetter",(function(e){return rce(Iue(e),e)})),Tue.f=ace,Sue.f=ice,kue.f=oce,wue.f=sce,bue.f=Aue.f=uce,_ue.f=cce,Zue.f=function(e){return rce(Rue(e),e)},sue&&(Bue(Yue,"description",{configurable:!0,get:function(){return Nue(this).description}}),xue(Uue,"propertyIsEnumerable",ace,{unsafe:!0}))),rue({global:!0,constructor:!0,wrap:!0,forced:!uue,sham:!uue},{Symbol:Fue}),Mue(gue(ece),(function(e){Cue(e)})),rue({target:Xue,stat:!0,forced:!uue},{useSetter:function(){tce=!0},useSimple:function(){tce=!1}}),rue({target:"Object",stat:!0,forced:!uue,sham:!sue},{create:function(e,t){return void 0===t?vue(e):oce(vue(e),t)},defineProperty:ice,defineProperties:oce,getOwnPropertyDescriptor:sce}),rue({target:"Object",stat:!0,forced:!uue},{getOwnPropertyNames:uce}),Pue(),Gue(Fue,Xue),Lue[Vue]=!0;var lce=xd&&!!Symbol.for&&!!Symbol.keyFor,dce=Py,hce=md,fce=rd,pce=tv,mce=Ol,yce=lce,vce=mce("string-to-symbol-registry"),gce=mce("symbol-to-string-registry");dce({target:"Symbol",stat:!0,forced:!yce},{for:function(e){var t=pce(e);if(fce(vce,t))return vce[t];var n=hce("Symbol")(t);return vce[t]=n,gce[n]=t,n}});var bce=Py,Ace=rd,_ce=lh,wce=hh,Sce=lce,kce=Ol("symbol-to-string-registry");bce({target:"Symbol",stat:!0,forced:!Sce},{keyFor:function(e){if(!_ce(e))throw TypeError(wce(e)+" is not a symbol");if(Ace(kce,e))return kce[e]}});var Tce=oy,xce=ed;Py({target:"Object",stat:!0,forced:!xd||Nl((function(){Tce.f(1)}))},{getOwnPropertySymbols:function(e){var t=Tce.f;return t?t(xce(e)):[]}});var Ece=Py,Lce=Nd,Ice=Il,Rce=Hl,Zce=rd,Cce=hd,Pce=oh,Gce=tv,Dce=Od.f,Mce=yy,Vce=Ice.Symbol,Xce=Vce&&Vce.prototype;if(Lce&&Cce(Vce)&&(!("description"in Xce)||void 0!==Vce().description)){var Wce={},Oce=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:Gce(arguments[0]),t=Pce(Xce,this)?new Vce(e):void 0===e?Vce():Vce(e);return""===e&&(Wce[t]=!0),t};Mce(Oce,Vce),Oce.prototype=Xce,Xce.constructor=Oce;var Nce="Symbol(test)"==String(Vce("test")),Uce=Rce(Xce.valueOf),Fce=Rce(Xce.toString),Yce=/^Symbol\((.*)\)[^)]+$/,Kce=Rce("".replace),jce=Rce("".slice);Dce(Xce,"description",{configurable:!0,get:function(){var e=Uce(this);if(Zce(Wce,e))return"";var t=Fce(e),n=Nce?jce(t,7,-1):Kce(t,Yce,"$1");return""===n?void 0:n}}),Ece({global:!0,constructor:!0,forced:!0},{Symbol:Oce})}var Hce=VE.aTypedArrayConstructor;function Bce(){var e=window.navigator.userAgent,t=e.indexOf("MSIE "),n=e.indexOf("Trident/");return t>0||n>0}function Jce(){var e,t,n,r,i,o,a,s;return!(!navigator.requestMediaKeySystemAccess||(r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),i=Bce(),e=navigator.mimeTypes,t=navigator.userAgent,n=!1,e&&t.indexOf("Chrome")>1&&(n=Object.keys(e).some((function(t){return!!(e[t].type&&e[t].type.indexOf("360")>-1)||!!(e[t].type&&e[t].type.indexOf("application/vnd.chromium.remoting-viewer")>-1)||!!(e[t].description&&e[t].description.indexOf("360")>-1)}))),o=n,a=navigator.userAgent.indexOf("Firefox")>0,s=navigator.userAgent.indexOf("Edge")>0,r||i||o||a||s))}function zce(){try{if("object"===("undefined"==typeof WebAssembly?"undefined":cK(WebAssembly))&&"function"==typeof WebAssembly.instantiate){var e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(kye){console.log(kye)}return!1}function Qce(){var e=window.MediaSource=window.MediaSource||window.WebKitMediaSource;return e&&"function"==typeof e.isTypeSupported}(0,VE.exportTypedArrayStaticMethod)("of",(function(){for(var e=0,t=arguments.length,n=new(Hce(this))(t);t>e;)n[e]=arguments[e++];return n}),YE);var qce=function(){function e(t){hK(this,e),this.onTick_=t,this.cancelPending_=null}return pK(e,[{key:"tickAfter",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.stop();var r=!0,i=null;this.cancelPending_=function(){window.clearTimeout(i),r=!1};return i=window.setTimeout((function(){r&&(t.onTick_(),n&&n())}),1e3*e),this}},{key:"tickEvery",value:function(e){var t=this;this.tickAfter(e,(function(){t.tickEvery(e)}))}},{key:"stop",value:function(){this.cancelPending_&&(this.cancelPending_(),this.cancelPending_=null)}}]),e}();Py({global:!0,forced:parseFloat!=kT},{parseFloat:kT});var $ce="PRELOAD_NEXT",ele="PRELOAD_SEG_DONE",tle="PREPARE",nle="IDLE",rle="FINISH",ile=1,ole=0,ale=1;function sle(e){return(sle="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 ule(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cle(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function lle(e,t,n){return t&&cle(e.prototype,t),n&&cle(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var dle,hle,fle={exports:{}},ple={exports:{}},mle=function(e){return null!=e},yle=mle,vle={object:!0,function:!0,undefined:!0},gle=function(e){return!!yle(e)&&hasOwnProperty.call(vle,typeof e)},ble=function(e){if(!gle(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(Sye){return!1}},Ale=function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(Sye){return!1}return!ble(e)},_le=/^\s*class[\s{/}]/,wle=Function.prototype.toString;var Sle,kle,Tle,xle,Ele,Lle,Ile,Rle,Zle=function(e){return null!=e};function Cle(){return xle?Tle:(xle=1,Tle=(hle?dle:(hle=1,dle=function(){try{return Object.keys("primitive"),!0}catch(kye){return!1}}))()?Object.keys:function(){if(kle)return Sle;kle=1;var e=Zle,t=Object.keys;return Sle=function(n){return t(e(n)?Object(n):n)}}())}var Ple,Gle,Dle=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}()?Object.assign:function(){if(Rle)return Ile;Rle=1;var e=Cle(),t=function(){if(Lle)return Ele;Lle=1;var e=Zle;return Ele=function(t){if(!e(t))throw new TypeError("Cannot use null or undefined");return t}}(),n=Math.max;return Ile=function(r,i){var o,a,s,u=n(arguments.length,2);for(r=Object(t(r)),s=function(e){try{r[e]=i[e]}catch(kye){o||(o=kye)}},a=1;a<u;++a)e(i=arguments[a]).forEach(s);if(void 0!==o)throw o;return r},Ile}(),Mle=Zle,Vle=Array.prototype.forEach,Xle=Object.create,Wle="razdwatrzy";var Ole="function"==typeof Wle.contains&&!0===Wle.contains("dwa")&&!1===Wle.contains("foo")?String.prototype.contains:function(){if(Gle)return Ple;Gle=1;var e=String.prototype.indexOf;return Ple=function(t){return e.call(this,t,arguments[1])>-1},Ple}(),Nle=mle,Ule=function(e){return!!Ale(e)&&!_le.test(wle.call(e))},Fle=Dle,Yle=function(e){var t=Xle(null);return Vle.call(arguments,(function(e){Mle(e)&&function(e,t){var n;for(n in e)t[n]=e[n]}(Object(e),t)})),t},Kle=Ole,jle=ple.exports=function(e,t){var n,r,i,o,a;return arguments.length<2||"string"!=typeof e?(o=t,t=e,e=null):o=arguments[2],Nle(e)?(n=Kle.call(e,"c"),r=Kle.call(e,"e"),i=Kle.call(e,"w")):(n=i=!0,r=!1),a={value:t,configurable:n,enumerable:r,writable:i},o?Fle(Yle(o),a):a};jle.gs=function(e,t,n){var r,i,o,a;return"string"!=typeof e?(o=n,n=t,t=e,e=null):o=arguments[3],Nle(t)?Ule(t)?Nle(n)?Ule(n)||(o=n,n=void 0):n=void 0:(o=t,t=n=void 0):t=void 0,Nle(e)?(r=Kle.call(e,"c"),i=Kle.call(e,"e")):(r=!0,i=!1),a={get:t,set:n,configurable:r,enumerable:i},o?Fle(Yle(o),a):a};var Hle=ple.exports,Ble=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e};!function(e,t){var n,r,i,o,a,s,u,c=Hle,l=Ble,d=Function.prototype.apply,h=Function.prototype.call,f=Object.create,p=Object.defineProperty,m=Object.defineProperties,y=Object.prototype.hasOwnProperty,v={configurable:!0,enumerable:!1,writable:!0};r=function(e,t){var r,o;return l(t),o=this,n.call(this,e,r=function(){i.call(o,e,r),d.call(t,this,arguments)}),r.__eeOnceListener__=t,this},o=function(e){var t,n,r,i,o;if(y.call(this,"__ee__")&&(i=this.__ee__[e]))if("object"==typeof i){for(n=arguments.length,o=new Array(n-1),t=1;t<n;++t)o[t-1]=arguments[t];for(i=i.slice(),t=0;r=i[t];++t)d.call(r,this,o)}else switch(arguments.length){case 1:h.call(i,this);break;case 2:h.call(i,this,arguments[1]);break;case 3:h.call(i,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,o=new Array(n-1),t=1;t<n;++t)o[t-1]=arguments[t];d.call(i,this,o)}},a={on:n=function(e,t){var n;return l(t),y.call(this,"__ee__")?n=this.__ee__:(n=v.value=f(null),p(this,"__ee__",v),v.value=null),n[e]?"object"==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},once:r,off:i=function(e,t){var n,r,i,o;if(l(t),!y.call(this,"__ee__"))return this;if(!(n=this.__ee__)[e])return this;if("object"==typeof(r=n[e]))for(o=0;i=r[o];++o)i!==t&&i.__eeOnceListener__!==t||(2===r.length?n[e]=r[o?0:1]:r.splice(o,1));else r!==t&&r.__eeOnceListener__!==t||delete n[e];return this},emit:o},s={on:c(n),once:c(r),off:c(i),emit:c(o)},u=m({},s),e.exports=t=function(e){return null==e?f(u):m(Object(e),s)},t.methods=a}(fle,fle.exports);var Jle=Z(fle.exports),zle=IY.values;Py({target:"Object",stat:!0},{values:function(e){return zle(e)}});var Qle=Zle,qle={function:!0,object:!0},$le=function(e){return Qle(e)&&qle[typeof e]||!1},ede=function(e){if(!$le(e))throw new TypeError(e+" is not an Object");return e},tde=Object.prototype.hasOwnProperty,nde=function(e){var t,n=arguments[1];if(ede(e),void 0===n)tde.call(e,"__ee__")&&delete e.__ee__;else{if(!(t=tde.call(e,"__ee__")&&e.__ee__))return;t[n]&&delete t[n]}},rde=Z(nde),ide=function(){function e(t,n,r,i,o){ule(this,e),Jle(this),this.state=tle,this.options=t||{},this.logger=t.logger||function(){},this._preloadManager=n,this.player=n.player;var a=r.handlers,s=r.predictInst,u=r.readyPromise;this._predictInst=s,this._handlers=a,this._predictInstReadyPromise=u,this._toLoadList=[],this.retryCount=0,this._cachedHandler=i,this._cachedDataHanlder=o,this.cnt=0}return lle(e,[{key:"start",value:function(){var e=this,t=new K2;return this._handlers.start(this.options).then((function(n){n.onObtain().then((function(r){e._predictInstReadyPromise.then((function(){e._predictInst.updateMediaInfos(r);var i=e._predictInst.preloadPredict(e.options),o=e._predictInst.cachedData;e._cachedDataHanlder(Object.assign({vid:e.options.vid},{data:o}));var a=Object.assign(i,e.options);n.onTransform(a).then((function(n){e._toLoadList=n,t.resolve(n)}))}))}))})).catch((function(e){t.reject(new Error("preload unit start error"))})),t}},{key:"preloadSeg",value:function(){var e=this;if(0===this._toLoadList.length)return this.state=rle,void this.emit(ele,!0);this.state="PRELOADING";var t=this._toLoadList.shift();this._handlers.onRequest(t,(function(n){var r=Object.assign({},t.extData,n);e._cachedHandler(r)})).then((function(){e.state=nle,e.emit(ele)})).catch((function(t){e.requestError(),e.emit(ele,!1)}))}},{key:"requestError",value:function(){this.retryCount++,this.state=nle,this.retryCount>=10&&(this.state=rle),this.emit("ONE_STEP_DONE"),this.logger("preload request error")}},{key:"cancelLoading",value:function(){this._toLoadList=[]}},{key:"destroy",value:function(){rde(this)}}]),e}();var ode=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(kye){}}();function ade(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function sde(e){return"string"!=typeof e&&(console.warn("".concat(e," used as a key, but it is not a string.")),e=String(e)),e}var ude={},cde="readonly",lde="readwrite";function dde(e){var t=ude[e.name],n={};n.promise=new Promise((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function hde(e,t){return new Promise((function(n,r){if(ude[e.name]=ude[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);dde(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var o=ode.open.apply(ode,i);t&&(o.onupgradeneeded=function(t){var n=o.result;try{n.createObjectStore(e.storeName)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),o.onerror=function(e){e.preventDefault(),r(o.error)},o.onsuccess=function(){n(o.result),function(e){var t=ude[e.name].deferredOperations.pop();if(t)t.resolve(),t.promise}(e)}}))}function fde(e){return hde(e,!1)}function pde(e){return hde(e,!0)}function mde(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,i=e.version>e.db.version;if(r&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||n){if(n){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function yde(e){dde(e);for(var t=ude[e.name],n=t.forages,r=0;r<n.length;r++){var i=n[r];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,fde(e).then((function(t){return e.db=t,mde(e)?pde(e):t})).then((function(r){e.db=t.db=r;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=r})).catch((function(t){throw function(e,t){var n=ude[e.name].deferredOperations.pop();if(n)n.reject(t),n.promise}(e,t),t}))}function vde(e,t,n,r){void 0===r&&(r=1);try{var i=e.db.transaction(e.storeName,t);n(null,i)}catch(o){if(r>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return Promise.resolve().then((function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),pde(e)})).then((function(){return yde(e).then((function(){vde(e,t,n,r-1)}))})).catch(n);n(o)}}var gde=function(){function e(){ule(this,e)}return lle(e,[{key:"ready",value:function(){return this._ready}},{key:"_initStorage",value:function(e){var t=this;t._defaultConfig=e;var n={db:null};if(e)for(var r in e)n[r]=e[r];var i=ude[n.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},ude[n.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=t._fullyReady);var o=[];function a(){return Promise.resolve()}for(var s=0;s<i.forages.length;s++){var u=i.forages[s];u!==t&&o.push(u._initReady().catch(a))}var c=i.forages.slice(0);return t._ready=Promise.all(o).then((function(){return n.db=i.db,fde(n)})).then((function(e){return n.db=e,mde(n,t._defaultConfig.version)?pde(n):e})).then((function(e){n.db=i.db=e,t._dbInfo=n;for(var r=0;r<c.length;r++){var o=c[r];o!==t&&(o._dbInfo.db=n.db,o._dbInfo.version=n.version)}})),t._ready}},{key:"probeSupport",get:function(){return function(){try{if(!ode||!ode.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(kye){return!1}}()}},{key:"getItem",value:function(e,t){var n=this;e=sde(e);var r=new Promise((function(t,r){n.ready().then((function(){vde(n._dbInfo,cde,(function(i,o){if(i)return r(i);try{var a=o.objectStore(n._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),t(e)},a.onerror=function(){r(a.error)}}catch(kye){r(kye)}}))})).catch(r)}));return ade(r,t),r}},{key:"setItem",value:function(e,t,n){var r=this;e=sde(e);var i=new Promise((function(n,i){r.ready().then((function(){return r._dbInfo,t})).then((function(t){vde(r._dbInfo,lde,(function(o,a){if(o)return i(o);try{var s=a.objectStore(r._dbInfo.storeName);null===t&&(t=void 0);var u=s.put(t,e);a.oncomplete=function(){void 0===t&&(t=null),n(t)},a.onabort=a.onerror=function(){var e=u.error?u.error:u.transaction.error;i(e)}}catch(kye){i(kye)}}))})).catch(i)}));return ade(i,n),i}},{key:"removeItem",value:function(e,t){var n=this;e=sde(e);var r=new Promise((function(t,r){n.ready().then((function(){vde(n._dbInfo,lde,(function(i,o){if(i)return r(i);try{var a=o.objectStore(n._dbInfo.storeName).delete(e);o.oncomplete=function(){t()},o.onerror=function(){r(a.error)},o.onabort=function(){var e=a.error?a.error:a.transaction.error;r(e)}}catch(kye){r(kye)}}))})).catch(r)}));return ade(r,t),r}},{key:"clear",value:function(e){var t=this,n=new Promise((function(e,n){t.ready().then((function(){vde(t._dbInfo,lde,(function(r,i){if(r)return n(r);try{var o=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=o.error?o.error:o.transaction.error;n(e)}}catch(kye){n(kye)}}))})).catch(n)}));return ade(n,e),n}},{key:"length",value:function(e){var t=this,n=new Promise((function(e,n){t.ready().then((function(){vde(t._dbInfo,cde,(function(r,i){if(r)return n(r);try{var o=i.objectStore(t._dbInfo.storeName).count();o.onsuccess=function(){e(o.result)},o.onerror=function(){n(o.error)}}catch(kye){n(kye)}}))})).catch(n)}));return ade(n,e),n}},{key:"all",value:function(e){var t=this,n=new Promise((function(e,n){t.ready().then((function(){vde(t._dbInfo,cde,(function(r,i){if(r)return n(r);try{var o=i.objectStore(t._dbInfo.storeName).openCursor(),a=[];o.onsuccess=function(){var t=o.result;t?(a.push({key:t.key,value:t.value}),t.continue()):e(a)},o.onerror=function(){n(o.error)}}catch(kye){n(kye)}}))})).catch(n)}));return ade(n,e),n}},{key:"_fullyReady",value:function(e){var t=this,n=t._initReady().then((function(){var e=ude[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return function(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}(n,e,e),n}}]),e}(),bde=function(){function e(){ule(this,e)}return lle(e,[{key:"_initStorage",value:function(e){var t=e.name+"_"+e.storeName;return this.key=t,window[t]&&"object"===sle(window[t])||(window[t]={}),this.store=window[t],Promise.resolve()}},{key:"getItem",value:function(e,t){var n=this.store[e];return void 0===n&&(n=null),this._internalPromise(t,n)}},{key:"setItem",value:function(e,t,n){return this.store[e]=t,this._internalPromise(n)}},{key:"removeItem",value:function(e,t){return delete this.store[e],this._internalPromise(t)}},{key:"clear",value:function(e){return this.store={},window[this.key]={},this._internalPromise(e)}},{key:"length",value:function(e){var t=Object.keys(this.store).length;return this._internalPromise(e,t)}},{key:"_internalPromise",value:function(e,t){var n=t?Promise.resolve(t):Promise.resolve();return ade(n,e),n}},{key:"all",value:function(e){for(var t=[],n=Object.keys(this.store),r=0;r<n.length;r++){var i=n[r];t.push({key:i,value:this.store[i]})}return this._internalPromise(e,t)}},{key:"probeSupport",value:function(){return!0}}]),e}(),Ade={description:"",name:"__PRE_CACHE__",storeName:"keyvaluepairs",version:1},_de="__PRE_CACHE__KEYS",wde=function(){function e(t,n){ule(this,e);var r=n===ile?bde:gde;this._driver=new r,this._driver._initStorage(Ade).catch((function(){})),this._hasIdbForbidden=!1,this._maxCache=!t||t<=0?200:t,this.setMaxCache(this._maxCache),this._allCachedKeys={},this._allCachedTimeKeys={},this.getCachedKeysFromLocal(),this._readyPromise=new K2,this.init()}return lle(e,[{key:"getCachedKeysFromLocal",value:function(){var e=hre.getItem(_de);if(e)for(var t=e.split("|"),n=0;n<t.length;n++){var r=t[n],i=this._getCacheKeyInfos(r),o=i.time,a=i.cachedKey;this._allCachedKeys[a]=1,this._allCachedTimeKeys[a]=o}}},{key:"_getCacheKeyInfos",value:function(e){var t,n=e.split("$");return 2===n.length&&(t=n[0],e=n[1]),{time:t,cachedKey:e}}},{key:"writeCachedKeysToLocal",value:function(e){var t=[];this._allCachedKeys={},this._allCachedTimeKeys={};for(var n=0;n<e.length;n++){var r=e[n].key,i=this._getCacheKeyInfos(r),o=i.time,a=i.cachedKey;this._allCachedKeys[a]=1,this._allCachedTimeKeys[a]=o,t.push(r)}var s=t.join("|");hre.setItem(_de,s)}},{key:"init",value:function(){var e=this;this._driver.setItem("test","test").then((function(){})).catch((function(){e._hasIdbForbidden=!0})).finally((function(){e._driver.removeItem("test").catch((function(){})),e._hasIdbForbidden&&(e._driver=new bde,e._driver._initStorage(Ade)),e._getAll(),e._readyPromise.resolve()}))}},{key:"_getAll",value:function(){var e=this;this._driver.all().then((function(t){e._cachedLength=t.length;var n=t.length-e._maxCache,r=t;if(n>0){var i=t.slice(0,n);r=t.slice(n);for(var o=0;o<i.length;o++)e.removeItem(i[o].key).then((function(){}))}e.writeCachedKeysToLocal(r)})).catch((function(){}))}},{key:"getItem",value:function(e,t){if(!this.hasItem(e))return Promise.resolve(!1);var n=this._getTimeKey(e).timeKey;return this._driver.getItem(n,t)}},{key:"setItem",value:function(e,t,n){var r=this;this._getTimeKey(e).timeKey&&this.removeItem(e);var i=(new Date).getTime();this._allCachedKeys[e]=1,this._allCachedTimeKeys[e]=i;var o=this._genTimeKey(e,i);return n=n?function(){r._getAll(),n()}:function(){r._getAll()},this._driver.setItem(o,t,n)}},{key:"_getTimeKey",value:function(e){var t=this._allCachedTimeKeys[e],n=e;return t&&(n=this._genTimeKey(e,t)),{timeKey:n,time:t}}},{key:"_genTimeKey",value:function(e,t){return"".concat(t).concat("$").concat(e)}},{key:"removeItem",value:function(e,t){var n=this._getTimeKey(e).timeKey,r=this._driver.removeItem(n,t);return delete this._allCachedKeys[e],delete this._allCachedTimeKeys[e],r}},{key:"hasItem",value:function(e){return!!this._allCachedKeys[e]}},{key:"clear",value:function(e){return this._driver.clear(e)}},{key:"length",value:function(e){return this._driver.length(e)}},{key:"setMaxCache",value:function(e){"number"==typeof e&&e>0&&(this._maxCache=e)}}]),e}(),Sde=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;ule(this,e),Jle(this),this._preloadDataList=[],this._currentPreloadInst=null,this._dashPreloadList=[],this.autoPreload=t.autoPreload||!1,this._onPreloadNext=this.onPreloadNextReady.bind(this),this.on($ce,this._onPreloadNext),this._preloaderConfigs={},this.update(t,n,r),this._cacheInst=new wde(t.preloadMaxCacheCount,t.preloadCacheType),this._preloadCacheProgress={},this._ptag_=!0,this._cachedDatas={}}return lle(e,[{key:"_getProloaderKey",value:function(e){return e.vtype?e.vtype:"DEFAULT"}},{key:"update",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!n)throw new Error("PreloaderManager predictInst is null");var r=this._getProloaderKey(e);this._preloaderConfigs[r]={predictInst:n,readyPromise:n.init(e),handlers:t}}},{key:"cachedDatas",get:function(){return this._cachedDatas}},{key:"onCacheSegment",value:function(e){var t=e.vid,n=e.format,r=e.cacheKey,i=e.total,o=e.loaded,a=e.isInitSegment,s=e.mediaType,u=this.getProgressCacheKey(t,n,s),c=this._preloadCacheProgress[u];c||(c=this._preloadCacheProgress[u]={}),c[r]={total:i,loaded:o,isInitSegment:a}}},{key:"onCachePredict",value:function(e){var t=e.vid,n=e.data;t&&n&&(this._cachedDatas[t]=n)}},{key:"getProgressCacheKey",value:function(e,t,n){return"".concat(e,"-").concat(t,"-").concat(n)}},{key:"onPreloadNextReady",value:function(){this.onPreloadNext()}},{key:"onPreloadSegDone",value:function(){this.autoPreload&&this.emit($ce)}},{key:"onPreloadNext",value:function(){var e=this;if(null==this._currentPreloadInst&&this._preloadDataList.length>0){if(this._preloadDataList.length>0){var t=this._preloadDataList.shift().data;if(t.payload){var n=this._getProloaderKey(t),r=this._preloaderConfigs[n];if(!r)return void console.warn("need to set vtype, no preloader",t);this._currentPreloadInst=new ide(t,this,r,(function(t){e.onCacheSegment(t)}),(function(t){e.onCachePredict(t)})),this._currentPreloadInst.on(ele,this.onPreloadSegDone.bind(this)),this._currentPreloadInst.start().then((function(){e._currentPreloadInst.preloadSeg()})).catch((function(){e._currentPreloadInst=null}))}}}else null!=this._currentPreloadInst&&(this._currentPreloadInst.state===nle?this._currentPreloadInst.preloadSeg():this._currentPreloadInst.state===rle?(this._currentPreloadInst.destroy(),this._currentPreloadInst=null):this._currentPreloadInst.state===tle&&(this._currentPreloadInst.cnt++,this._currentPreloadInst.cnt>2&&(this._currentPreloadInst.destroy(),this._currentPreloadInst=null)))}},{key:"addDashPreloader",value:function(e){e&&e.data&&(this._preloadDataList.push(e),this.sort(this._preloadDataList),this.autoPreload&&this.emit($ce))}},{key:"_addDashPreloader",value:function(e){e&&e.data&&this._preloadDataList.push(e)}},{key:"addDashPreloaderList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.sort(e);for(var t=0;t<e.length;t++)this._addDashPreloader(e[t])}},{key:"sort",value:function(e){e.sort((function(e,t){return void 0===e.order&&void 0===e.order||e.order<t.order?-1:1}))}},{key:"destroy",value:function(){this.off($ce,this._onPreloadNext)}},{key:"cancelLoading",value:function(){this._currentPreloadInst&&(this._currentPreloadInst.cancelLoading(),this._currentPreloadInst=null),this._preloadDataList=[]}},{key:"preloadCacheProgress",value:function(e){var t=e.vid,n=e.format,r=e.mediaType,i=e.prelaodType,o=e.bitrate,a=e.set_duration,s=e.set_size,u=e.media_type,c=e.start_time,l=this.getProgressCacheKey(t,n,r),d=this._preloadCacheProgress[l];if(d){for(var h=Object.values(d),f=0,p=0,m=0,y=0,v=0,g=0;g<h.length;g++){var b=h[g];b.isInitSegment&&(f=b.total,m=b.loaded,y=b.loaded===b.total?ole:ale),p+=b.total,v+=b.loaded}return{media_type:u,preload_type:i,stream_bitrate:o,header_size:f,content_total_size:p,start_time:c||-1,state_info:{set_duration:a,set_size:s,current_header_download_size:m,current_content_download_size:v,header_download_state:y,content_download_state:v===p?ole:ale}}}return null}},{key:"getPreloadTaskInfos",value:function(){}},{key:"getItem",value:function(e,t){return this._cacheInst.getItem(e,t)}},{key:"setItem",value:function(e,t,n){return this._cacheInst.setItem(e,t,n)}},{key:"removeItem",value:function(e,t){return this.removeItem(e,t)}}],[{key:"getInstance",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=e.GLOBAL_KEY+(t.globalKey?t.globalKey:""),o=window[i];if(o&&o._ptag_)return o.update(t,n,r),o;var a=new e(t,n,r);return window[i]=a,a}}]),e}();Sde.GLOBAL_KEY="__preloadcontext__";var kde=function(){function e(t){ule(this,e),Jle(this),this.options=t,this.promisePolyfill(),this.before(),this.check(),this._preloadManager=Sde.getInstance(t,this.handlers,this.predictInst),this.loadingTasks=[]}return lle(e,[{key:"promisePolyfill",value:function(){Promise.prototype.finally||(Promise.prototype.finally={finally:function(e){var t=function(t){return Promise.resolve(e()).then(t)};return this.then((function(e){return t((function(){return e}))}),(function(e){return t((function(){return Promise.reject(e)}))}))}}.finally)}},{key:"before",value:function(){throw new Error("need")}},{key:"check",value:function(){if(!this.handlers)throw new Error("handlers null");if(!this.handlers.start||!this.handlers.onRequest)throw new Error("handlers callback null");if(!this.predictInst)throw new Error("predictInst null");if(!this.predictInst.__p__)throw new Error("predictInst need extends predictbase")}},{key:"preloadNext",value:function(){this._preloadManager.emit($ce)}},{key:"preloadManager",get:function(){return this._preloadManager}},{key:"start",value:function(e){throw new Error("start need implment, return Promise")}},{key:"cancelLoading",value:function(){for(var e=0;e<this.loadingTasks.length;e++)try{var t=this.loadingTasks[e];"function"==typeof t.cancel&&t.cancel()}catch(kye){}this.loadingTasks=[],this._preloadManager.cancelLoading()}},{key:"addTasker",value:function(e){this.loadingTasks.push(e)}},{key:"removeTasker",value:function(e){var t=this;setTimeout((function(){for(var n=t.loadingTasks.length-1;n>-1;n--)if(t.loadingTasks[n]===e){t.loadingTasks.splice(n,1);break}}))}},{key:"addDashPreloader",value:function(e){this._preloadManager.addDashPreloader(e)}},{key:"addDashPreloaderList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._preloadManager.addDashPreloaderList(e)}}]),e}(),Tde={MP4:"MP4",DASH:"DASH",HLS:"HLS"},xde="h264",Ede="h265",Lde={DURATION:0,SIZE:1},Ide=null,Rde=function(e){yK(n,e);var t=AK(n);function n(){return hK(this,n),t.apply(this,arguments)}return pK(n,[{key:"init",value:function(){return Promise.resolve()}},{key:"preloadPredict",value:function(e){return e}}]),n}(function(){function e(){ule(this,e),this.bandwidth2item={},this._mediaInfos=null,this.__p__=!0}return lle(e,[{key:"init",value:function(){throw new Error("init func not implement, return promise")}},{key:"preloadPredict",value:function(e){throw new Error("preloadPredict error",e)}},{key:"updateMediaInfos",value:function(e){if(this._mediaInfos=e,this.bandwidth2item={},this.dynamic_video=e&&e.dynamic_video_list,this.dynamic_video&&this.dynamic_video.length>0)for(var t=0;t<this.dynamic_video.length;t++){var n=this.dynamic_video[t];this.bandwidth2item[n.bitrate||n.bandwidth]=n}}},{key:"getIdx",value:function(e,t){var n=0;return e.forEach((function(e,r){e.definition===t&&(n=r)})),n}},{key:"cachedData",get:function(){return null}}]),e}()),Zde=function(e){yK(a,e);var t,n,r,i,o=AK(a);function a(e,t){var n;return hK(this,a),e.vtype=Tde.MP4,(n=o.call(this,e)).player=t,n.loadingCount=0,n._mp4=null,n._loader=null,n._pendingPromise=null,n.playerId=t.playerId,n}return pK(a,[{key:"log",value:function(e){for(var t="[Preloader] ".concat(e),n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];hae.apply(void 0,[t].concat(r))}},{key:"before",value:function(){var e=this;this.handlers={start:function(t){var n=t.payload||[];if(0===n.length)return Promise.reject();var r=t.vid,i=t.vtype||Tde.MP4,o=t.codecType||xde,s=e.getUserSelectDefinition(),u=e.checkCacheKey(r,n,s,i,o);if(console.log("[Preloader] ".concat(r," codecType:").concat(o," vtype:").concat(i," hasCache:").concat(u)),u||"MP3"===i)return Promise.reject();var c=e.getInitDefinition(n,e.options.definition,s);if(console.log("[Preloader] ".concat(r," getInitDefinition"),c),!c)return Promise.reject();var l=c.definition,d=t.preloadTime||e.options.preloadTime,h=t.preloadSize||e.options.preloadSize||Math.pow(25,4)-1,f=a.generateUniqueKey({vid:r,definition:l,vtype:i,codecType:o});hae("[Preloader] ".concat(r," start duration:").concat(c.duration," cacheKey:").concat(f));var p=sK({vid:r,definition:l,preloadTime:d,preloadSize:h,cacheKey:f,codecType:o,vtype:i},c);return e.loadingCount++,e.start(p)},onRequest:function(t,n){var r=t.url,i=t.range,o=t.extData;return e.getData(r,i,o,n)}},this.loggerConfig={logger:function(){},openLog:!1},this.predictInst=new Rde(this.loggerConfig)}},{key:"start",value:function(e){var t=this,n={mediaInfos:{dynamic_video_list:[],dynamic_audio_list:[]},onObtain:function(){var e=new ese;return e.resolve(n.mediaInfos),e},onTransform:function(n){var r=new ese;t._pendingPromise=r;var i=e.preloadTime,o=e.codecType;return i&&(o!==Ede||t.options.supportHevc)?t.loadByPreloadTime(e,r):t.loadByChunkSize(e,r),r}};return Promise.resolve(n)}},{key:"getInitDefinition",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=null;if(a.BitRateAdapter)r=a.BitRateAdapter.getSuitableBitrate(e,n),this.log("Mp4Preloader.BitRateAdapter",r);else{for(var i=0,o=0;o<e.length;o++){if(e[o].definition===t){i=o;break}}r=e[i]}return r||(r=e[0]),r}},{key:"getPreLoadData",value:function(e){var t=this,n=new ese;return this.getItemSameVid(e).then((function(e){if(t.log("getPreLoadData",e.value),e.value){var r=e.value,i=r.mediaSegList,o=r.meta,a=r.type,s=r.buffer,u=r.preloadTime,c=r.vid,l=r.cacheKey,d=r.definition,h=r.byteLength,f=r.duration,p=r.fileSize,m=r.from,y=r.vtype,v=r.codecType,g=r.initSeg,b={vid:c,type:a,vtype:y,codecType:v,definition:d,bitrate:r.bitrate,cacheKey:l,duration:f||0,byteLength:h,from:m,meta:o};a===Lde.SIZE?(b.buffer=s,b.fileSize=p||0):(b.mediaSegList=i,b.preloadTime=u,b.initSeg=g),n.resolve(b)}else n.resolve(null)})).catch((function(e){n.reject(e)})),n}},{key:"setPreLoadData",value:(i=dK(uK().mark((function e(t,n){var r,i,o,a,s,u,c,l,d,h,f,p,m,y,v,g,b,A,_=this;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new ese,i=n.mediaSegList,o=n.meta,a=n.vid,s=n.definition,u=n.type,c=n.buffer,l=n.duration,d=n.byteLength,h=n.preloadTime,f=n.preloadSize,p=n.fileSize,m=n.from,y=n.vtype,v=n.codecType,g=n.initSeg,b=n.bitrate,A={codecType:v,vtype:y,vid:a,definition:s,cacheKey:t,type:u,from:m,meta:o,fileSize:p,bitrate:b},u===Lde.SIZE?(A.buffer=c,A.byteLength=d||0,A.preloadSize=f||0,A.fileSize=p,A.buffer&&A.buffer.byteLength>0&&(this.setItem(t,A),r.resolve(!0))):(A.mediaSegList=i||[],A.duration=l,A.byteLength=d||0,A.preloadTime=h||0,A.initSeg=g,o&&0===i.length?(this.setItem(t,A),r.resolve(!0)):(i.every((function(e){return!!e.buffer&&e.state}))||r.resolve(!1),this.setItem(t,A).then((function(){_.log("setPreLoadData1 success",t,(new Date).getTime())})),r.resolve(!0))),e.abrupt("return",r);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"getInitCacheData",value:function(e,t){var n={type:e,meta:null,byteLength:0,fileSize:0,bitrate:0};return e===Lde.DURATION?(n.mediaSegList=[],n.initSeg=null,n.duration=0):n.buffer=null,Object.keys(t).map((function(e){n[e]=t[e]})),n}},{key:"updatePreCacheData",value:function(e,t,n,r,i,o,a){var s=e.mediaSegList;if(e.type===Lde.SIZE||-1===i)return e.buffer=Vre(Uint8Array,e.buffer.buffer||[],new Uint8Array(t)),e;for(var u=-1,c=0;c<s.length;c++)if(s[c].index===i){u=c;break}var l=o||[0,0];return u>-1?(t&&(s[u].buffer=Vre(Uint8Array,s[u].buffer||[],new Uint8Array(t))),n.length>1&&(s[u].range.length>1?s[u].range[1]=n[1]:s[u].range=n),-1!==a[1]&&(r=s[u].range[1]>=a[1]),s[u].state=r):(e.duration=l[1],s.push({buffer:t,range:n||[],index:i,totalRange:a||[],timeRange:[l[0],l[1]],state:r})),r&&(e.byteLength=n[1]),r}},{key:"checkCacheKey",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Tde.MP4,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:xde;if(n){var o=a.generateUniqueKey({vid:e,definition:n,vtype:r,codecType:i});return this.hasItemSameVid(o)?o:null}for(var s=0;s<t.length;s++){var u=a.generateUniqueKey({vid:e,definition:t[s].definition,vtype:r,codecType:i});if(this.hasItemSameVid(u))return u}return null}},{key:"checkCanPreloadNext",value:function(){var e=!0;return this.loadingCount>=1&&(e=!1),e&&this.preloadNext(),e}},{key:"loadByPreloadTime",value:function(e,t){var n=this,r=e.vid,i=e.cacheKey,o=e.preloadTime,a=e.definition,s=e.duration,u=e.bitrate,c=e.codecType,l=e.vtype,d=null;if(d="Array"===Yie.typeOf(e.url)?e.url.length>1?e.url[1].src:e.url[0].src:e.url){d=Yie.extUrl(d,{__vid:r});var h=o>=this.options.segmentMinDuration?this.options.segmentMinDuration:o;this.log("loadByPreloadTime","".concat(e.cacheKey,", definition:").concat(e.definition,",segmentMinDuration:").concat(h),e);var f=Yie.getFileSize(u,s);this._mp4=new qae(d,u,sK({segmentDuration:h,codecType:this.codecType,chunkSize:this.options.preloadSize,duration:s,fileSize:f,playerId:this.playerId,vid:r,useUrlRange:!1,retryCount:1,retryDelay:1e3,supportHevc:this.options.supportHevc},this.options.reqOptions),null,null,{},[],this.firstFrameTime,"");var p=this.getInitCacheData(Lde.DURATION,{vid:r,preloadTime:o,definition:a,cacheKey:i,codecType:c,vtype:l,bitrate:u||0});this._mp4.once("metaReady",(function(i){n.log("".concat(r," metaReady this._pendingPromise"),n._pendingPromise.state),p.meta=i,p.from=2,n._mp4.cancelLoading(),n.startLoadByFragments(p,e,t)})),this._mp4.on("error",(function(e){console.error("[Preloader] ".concat(r," loadByPreloadTime error"),e),n._endLoadFragments()})),this._mp4.init({})}else this._endLoadFragments()}},{key:"loadByChunkSize",value:(r=dK(uK().mark((function e(t){var n,r,i,o,a,s,u,c,l,d,h,f,p,m,y,v,g,b=this;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.vid,r=t.cacheKey,i=t.definition,o=t.duration,a=t.bitrate,s=t.codecType,u=t.vtype,c=this.options,l="Array"===Yie.typeOf(t.url)?t.url[0].src:t.url){e.next=6;break}return this._endLoadChunk(),e.abrupt("return");case 6:return l=Yie.extUrl(l,{__vid:n}),d=Yie.getFileSize(a,o),h=Nae(o,8e5,d),this.log("".concat(n,"loadByChunkSize"),t.cacheKey,t.definition,h,t),f=this.getInitCacheData(Lde.SIZE,{vid:n,definition:i,cacheKey:r,codecType:s,vtype:u,fileSize:d,bitrate:a||0}),this.MP4Loader=new uae(sK(sK({url:l,retry:c.retry||2,retryDelay:c.retryDelay||1e3,timeout:3e3},c.reqOptions),{},{segmentDuration:c.segmentDuration})),e.prev=12,p=new Uint8Array(0),m=0,y=null,v=null,g=function(e,t,n){if(e&&n.range[0]===m&&(p=Vre(Uint8Array,p,new Uint8Array(e)),m+=e.byteLength),n.meta){b.MP4Loader.cancel();var i=n.meta,o=i.videoSegments,a=i.audioSegments;v=sK(sK({},i.meta),{},{ext:{videoTrak:o,audioTrak:a}}),f.meta=v,f.buffer=p,f.byteLength=p.byteLength,b.setPreLoadData(r,f),y=Yie.getFragRange(0,o,a),b.log("".concat(r," onProgressHandle4 meta"),t,y,m,p.byteLength),y[0]<m&&(y[0]=m),b._loadOneChunk(f,y)}},e.next=20,this.MP4Loader.loadMetaProcess(this.MP4Loader.cache,[0,h],g);case 20:e.next=26;break;case 22:e.prev=22,e.t0=e.catch(12),console.error("[Preloader] ".concat(r," loadByChunkSize error"),e.t0),this._endLoadChunk();case 26:case"end":return e.stop()}}),e,this,[[12,22]])}))),function(e){return r.apply(this,arguments)})},{key:"_loadOneChunk",value:(n=dK(uK().mark((function e(t,n){var r,i,o,a,s,u,c,l;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.vid,i=t.cacheKey,o=t.buffer,e.prev=1,e.next=4,this.MP4Loader.loadData(n,this.MP4Loader.cache,{});case 4:a=e.sent,this.log("".concat(r," _loadOneChunk"),n,a),s=a.response,(u=a.data)?(this._endLoadChunk(),s&&s.headers&&(c=Yie.getFileSize(s.headers))&&(t.fileSize=c),l=Vre(Uint8Array,o,new Uint8Array(u)),t.buffer=l,t.byteLength=l.byteLength,this.log("".concat(r," _loadOneChunk ret"),i,l.byteLength,t),t.from=4,this.setPreLoadData(i,t)):this._endLoadChunk(),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(1),console.error("[Preloader] ".concat(r," loadByChunkSize error"),e.t0),this._endLoadChunk();case 14:case"end":return e.stop()}}),e,this,[[1,10]])}))),function(e,t){return n.apply(this,arguments)})},{key:"_endLoadChunk",value:function(){this.log("_endLoadChunk loadingCount:".concat(this.loadingCount),this._pendingPromise?this._pendingPromise.state:null),this._pendingPromise&&(this._pendingPromise.resolve(),this._pendingPromise=null),this.loadingCount>0&&this.loadingCount--,this.MP4Loader&&(this.MP4Loader.cancel(),this.MP4Loader.destroy(),this.MP4Loader=null)}},{key:"startLoadByFragments",value:(t=dK(uK().mark((function e(t,n,r){var i,o,a,s,u,c,l=this;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(i=n.preloadTime,o=n.vid,console.log("[Preloader] ".concat(o," startLoadByFragments")),a=[],s=0;s<this._mp4.timeRange.length;s++)this._mp4.timeRange[s].startTime<=i&&a.push(s);return u=function(e){l.log("[Preloader] _failedCallback",e),l._endLoadFragments()},c=function(){var e=dK(uK().mark((function e(n){var r,i,o,s,d,h,f,p,m;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l._mp4){e.next=2;break}return e.abrupt("return");case 2:if(r=n.buffer,i=n.context,o=n.state,s=n.initSeg,d=i.fragIndex,h=i.range,f=i.timeRange,p=l._mp4.getFragRange(d),!t.initSeg&&s&&(t.initSeg=s),m=l.updatePreCacheData(t,r,h,o,d,f,p),console.log("[Preloader] ".concat(t.cacheKey," _successCallback"),d,o,m,h,f,p,n),t.from=3,!m){e.next=20;break}return e.next=12,l.setPreLoadData(t.cacheKey,t);case 12:if(!(d>=a.length-1)){e.next=17;break}l.log("".concat(t.cacheKey," mp4.load end"),d),l._endLoadFragments(),e.next=20;break;case 17:return l.log("".concat(t.cacheKey," mp4.load start"),d+1),e.next=20,l._mp4.loadAllFragmentData(d+1,c,u);case 20:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e.next=8,this._mp4.loadAllFragmentData(0,c,u);case 8:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"_endLoadFragments",value:function(){this.log("_endLoadFragments loadingCount:".concat(this.loadingCount),this._pendingPromise?this._pendingPromise.state:null),this._pendingPromise&&(this._pendingPromise.resolve(),this._pendingPromise=null),this.loadingCount>0&&this.loadingCount--,this._mp4&&(this._mp4.destroy(),this._mp4=null)}},{key:"getFragment",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=new ese;return this.getData(e,t,o,!1).then((function(e){r.createFragment(new Uint8Array(e.res),t[0]-r.mdatStart,n,{range:t,context:e.context}).then((function(e){a.resolve(e)}))})),a}},{key:"getPreloadUrl",value:function(e){var t=e.url,n=e.range,r=e.definition,i=e.vid;return[{url:t,range:n,extData:{cacheKey:a.generateUniqueKey({vid:i,start:n[0],end:n[1],definition:r}),vid:i,format:"mp4"}}]}},{key:"getRangeList",value:function(e){var t=this.allCachedKeys,n={timeRange:[],contentRange:[]};for(var r in t)if(t.hasOwnProperty(r)&&r.indexOf(e)>-1){var i=r.split("#");0===i[2].indexOf("pretime")?n.timeRange.push([0,parseFloat(i[2].slice(7))]):n.contentRange.push([parseInt(i[2]),parseInt(i[3])])}return n}},{key:"hasItemSameVid",value:function(e){if(!e)return!1;var t=this.allCachedKeys;for(var n in t)if(t.hasOwnProperty(n)){if(n===e)return n;var r=n.split("#"),i=e.split("#");if(r.length>=4&&i.length>=4&&r[0]===i[0]){if(0===r[2].indexOf("pretime")&&0===i[2].indexOf("pretime"))return n;var o=[parseInt(r[2]),parseInt(r[3])],a=[parseInt(i[2]),parseInt(i[3])];if(a[0]>=o[0]&&a[1]>a[0]&&a[1]<=o[1])return n}}return!1}},{key:"removeOthers",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=this.allCachedKeys;for(var r in n)n.hasOwnProperty(r)&&r.split("#").length>=1&&function(){var n=r.split("#")[0];t.every((function(e){return e.split("#").length>=1&&e.split("#")[0]!==n}))&&(e.log("remove cache:".concat(r)),e.cacheInst.removeItem(r))}()}},{key:"getItemSameVid",value:function(e,t){var n=this.hasItemSameVid(e);return this.log("getItemSameVid: key:".concat(e," checkResult:").concat(n)),n?this.cacheInst.getItem(n,t).then((function(e){return{value:e,key:n}})):Promise.resolve({})}},{key:"setItem",value:function(e,t){return this.cacheInst.setItem(e,t)}},{key:"allCachedKeys",get:function(){return this.cacheInst._allCachedKeys}},{key:"cacheInst",get:function(){return this._preloadManager._cacheInst}},{key:"cancelPreloadByVid",value:function(e){if(e){for(var t=this._preloadManager._preloadDataList,n=[],r=0;r<t.length;r++){t[r].data.vid!==e?n.push(t[r]):(console.log("[Preloader] cancelPreloadByVid",e),this.log("cancelPreloadByVid",e))}this._preloadManager._preloadDataList=n}}},{key:"cancelLoading",value:function(e){this._endLoadFragments(),this._endLoadChunk();var t=this._preloadManager;if(t._currentPreloadInst){var n=t._currentPreloadInst._toLoadList,r=[];n.map((function(t){return t.playerId!==e&&r.push(t),t})),t._currentPreloadInst._toLoadList=r}var i=[],o=[];t._preloadDataList.map((function(t){return t.playerId!==e?i.push(t):o.push(t.data.vid),t})),this.log("cancelLoading",e,o.join(",")),t._preloadDataList=i}},{key:"checkIfExistInList",value:function(e){for(var t=this._preloadManager._preloadDataList,n=0;n<t.length;n++)if(e===t[n].data.vid)return!0;return!1}},{key:"addPreloader",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(e.data){e.data.vtype||(e.data.vtype=Tde.MP4);var r=e.data.vid,i=this.checkIfExistInList(r);console.log("[Preloader] addPreloader checkIfExistInList",r,i),n&&r===n||i||(e.playerId=t,this.addDashPreloader(e))}}},{key:"addPreloaderList",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=[],r=0;r<e.length;r++){var i=e[r].data,o=i.vid,a=i.vtype,s=this.checkIfExistInList(o);console.log("[Preloader] addPreloaderList checkIfExistInList",o,o===t,s),t&&o===t||s||(a||(e[r].data.vtype=Tde.MP4),n.push(e[r]))}console.log("[Preloader] addPreloaderList length is ".concat(n.length)),this.addDashPreloaderList(n)}},{key:"setUserSelectDefinition",value:function(e){this._preloadManager&&(this._preloadManager.userDefinition=e)}},{key:"getUserSelectDefinition",value:function(){return this._preloadManager.userDefinition||null}},{key:"destroy",value:function(){this._endLoadFragments(),this._endLoadChunk(),this.cancelLoading(this.playerId)}}],[{key:"PRELOAD_TYPES",get:function(){return Lde}},{key:"BitRateAdapter",get:function(){return Ide},set:function(e){Ide=e}},{key:"generateUniqueKey",value:function(e){var t=e.vid,n=e.mediaType,r=e.definition,i=e.codecType,o=e.vtype;return n=n||"video",r=r||"-1",i=i||xde,o=o||Tde.MP4,t?"".concat(t,"#").concat(n,"#").concat(i,"#").concat(o,"#").concat(r):null}}]),a}(kde),Cde={MEDIA_EXPIRED:"MEDIA_EXPIRED",INIT_FAIL:"INIT_FAIL",PARSE_ERROR:"PARSE_ERROR",PLAYER_LOG:"PLAYER_LOG",BUFFERED_RESET:"BUFFERED_RESET"},Pde=vC.left,Gde=Sd,Dde=Ob;Py({target:"Array",proto:!0,forced:!fm("reduce")||!Dde&&Gde>79&&Gde<83},{reduce:function(e){var t=arguments.length;return Pde(this,e,t,t>1?arguments[1]:void 0)}});var Mde=function(){function e(t,n){hK(this,e),this.player=t,this.mediaElem=t.video,this.config=n,this.timer=new ire,this.prevReadyState=this.mediaElem.readyState,this.didFireLargeGap=!1,this.seekingEventReceived=!1,this.onWaitFunc=this._onWaiting.bind(this),this.onPlayFunc=this._onPlay.bind(this),this.isSafari=/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),!1!==this.config.useGapJump&&this._start(),this.hasPlayed=!1}return pK(e,[{key:"_onWaiting",value:function(){this.onGapJump()}},{key:"_onPlay",value:function(){this.hasPlayed=!0}},{key:"_start",value:function(){this.mediaElem.addEventListener("waiting",this.onWaitFunc),this.mediaElem.addEventListener("play",this.onPlayFunc)}},{key:"onSegmentAppend",value:function(e){if(this.config.enableCheckBufferDiff&&this.mediaElem){var t=e.reduce((function(e,t){return e+t.downloaded?t[1]-t[0]:0}),0);this._getBuffered(this.mediaElem.buffered).reduce((function(e,t){return e+(t.end-t.start)}),0)/t<.8&&(hae("onSegmentAppend detectGap"),this.player&&this.player.emit("detectGap"))}this.onGapJump()}},{key:"onSeeking",value:function(){this.seekingEventReceived=!0,this.didFireLargeGap=!1}},{key:"onGapJump",value:function(){if(this.mediaElem.readyState!==HTMLMediaElement.HAVE_NOTHING){if(this.mediaElem.seeking){if(!this.seekingEventReceived)return}else this.seekingEventReceived=!1;if(!this.mediaElem.paused||0===this.mediaElem.currentTime||!this.hasPlayed){this.mediaElem.readyState!==this.prevReadyState&&(this.didFireLargeGap=!1,this.prevReadyState=this.mediaElem.readyState);var t=this.mediaElem.buffered,n=this.config.smallGapLimit||.5,r=this.config.gapDetectionThreshold||.1,i=this.mediaElem.currentTime,o=this._getIndex(t,i,r);if(null!==o&&(0!==o||t&&t.length)){var a=t.start(o)+.1;if(!(a>this.mediaElem.duration)){var s=a-i,u=s<=n;s<e.BROWSER_GAP_TOLERANCE||u&&(!0!==this.config.disableGapSetPosition&&(hae("onGapJump this.mediaElem.currentTime"),this.mediaElem.currentTime=this.isSafari?a+.1:a),this.player&&this.player.emit("detectGap"),hae("gapJump gapIndex",o,"isGapSamll",u,"jumpLargeGap",!1,"currentTime",this.mediaElem.currentTime),.08!==a&&this.player&&this.player.emit("log",{type:"oneevent",end_type:"gap",vid:this.player.config.vid,ext:{video_postion:Math.floor(1e3*a)}}))}}}}}},{key:"_getIndex",value:function(e,t,n){if(!e||!e.length)return null;if(1===e.length&&e.end(0)-e.start(0)<1e-6)return null;for(var r=this._getBuffered(e),i=null,o=0;o<r.length;o++){if(r[o].start>t&&(0===o||r[o-1].end-t<=n)){i=o;break}}return i}},{key:"_getBuffered",value:function(e){if(!e)return[];for(var t=[],n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}},{key:"destroy",value:function(){this.mediaElem.removeEventListener("waiting",this.onWaitFunc),this.mediaElem.removeEventListener("play",this.onPlayFunc),this.timer.clear(),this.timer=null}}]),e}();Mde.BROWSER_GAP_TOLERANCE=.001;var Vde=Zj,Xde=uB,Wde=yH,Ode=function(){var e=b5(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},Nde=RegExp.prototype,Ude=_J.PROPER,Fde=gz,Yde=eJ,Kde=g5,jde=xj,Hde=function(e){var t=e.flags;return void 0!==t||"flags"in Nde||Xde(e,"flags")||!Wde(Nde,e)?t:Vde(Ode,e)},Bde="toString",Jde=RegExp.prototype[Bde],zde=jde((function(){return"/a/b"!=Jde.call({source:"a",flags:"b"})})),Qde=Ude&&Jde.name!=Bde;(zde||Qde)&&Fde(RegExp.prototype,Bde,(function(){var e=Yde(this);return"/"+Kde(e.source)+"/"+Kde(Hde(e))}),{unsafe:!0});var qde=kj,$de=xj,ehe=Fj,the=g5,nhe=Yne.trim,rhe=Mne,ihe=qde.parseInt,ohe=qde.Symbol,ahe=ohe&&ohe.iterator,she=/^[+-]?0x/i,uhe=ehe(she.exec),che=8!==ihe(rhe+"08")||22!==ihe(rhe+"0x16")||ahe&&!$de((function(){ihe(Object(ahe))}))?function(e,t){var n=nhe(the(e));return ihe(n,t>>>0||(uhe(she,n)?16:10))}:ihe;_Q({global:!0,forced:parseInt!=che},{parseInt:che});var lhe={exports:{}},dhe={},hhe=Hj,fhe=oH,phe=bz.f,mhe=Z4,yhe="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];dhe.f=function(e){return yhe&&"Window"==hhe(e)?function(e){try{return phe(e)}catch(Sye){return mhe(yhe)}}(e):phe(fhe(e))};var vhe=xj((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),ghe=xj,bhe=hH,Ahe=Hj,_he=vhe,whe=Object.isExtensible,She=ghe((function(){whe(1)}))||_he?function(e){return!!bhe(e)&&((!_he||"ArrayBuffer"!=Ahe(e))&&(!whe||whe(e)))}:whe,khe=!xj((function(){return Object.isExtensible(Object.preventExtensions({}))})),The=_Q,xhe=Fj,Ehe=DJ,Lhe=hH,Ihe=uB,Rhe=JB.f,Zhe=bz,Che=dhe,Phe=She,Ghe=khe,Dhe=!1,Mhe=fB("meta"),Vhe=0,Xhe=function(e){Rhe(e,Mhe,{value:{objectID:"O"+Vhe++,weakData:{}}})},Whe=lhe.exports={enable:function(){Whe.enable=function(){},Dhe=!0;var e=Zhe.f,t=xhe([].splice),n={};n[Mhe]=1,e(n).length&&(Zhe.f=function(n){for(var r=e(n),i=0,o=r.length;i<o;i++)if(r[i]===Mhe){t(r,i,1);break}return r},The({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Che.f}))},fastKey:function(e,t){if(!Lhe(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Ihe(e,Mhe)){if(!Phe(e))return"F";if(!t)return"E";Xhe(e)}return e[Mhe].objectID},getWeakData:function(e,t){if(!Ihe(e,Mhe)){if(!Phe(e))return!0;if(!t)return!1;Xhe(e)}return e[Mhe].weakData},onFreeze:function(e){return Ghe&&Dhe&&Phe(e)&&!Ihe(e,Mhe)&&Xhe(e),e}};Ehe[Mhe]=!0;var Ohe=lhe.exports,Nhe=_Q,Uhe=kj,Fhe=Fj,Yhe=fQ,Khe=gz,jhe=Ohe,Hhe=d2,Bhe=Zq,Jhe=cH,zhe=$j,Qhe=hH,qhe=xj,$he=y2,efe=Aq,tfe=R6,nfe=Y5,rfe=Sq,ife=a4,ofe=d$,afe=Zq,sfe=$j,ufe=d2,cfe=F9,lfe=Y9,dfe=Lq,hfe=Ej,ffe=Ohe.fastKey,pfe=JJ.set,mfe=JJ.getterFor,yfe={getConstructor:function(e,t,n,r){var i=e((function(e,i){afe(e,o),pfe(e,{type:t,index:nfe(null),first:void 0,last:void 0,size:0}),hfe||(e.size=0),sfe(i)||ufe(i,e[r],{that:e,AS_ENTRIES:n})})),o=i.prototype,a=mfe(t),s=function(e,t,n){var r,i,o=a(e),s=u(e,t);return s?s.value=n:(o.last=s={index:i=ffe(t,!0),key:t,value:n,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=s),r&&(r.next=s),hfe?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},u=function(e,t){var n,r=a(e),i=ffe(t);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key==t)return n};return ife(o,{clear:function(){for(var e=a(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,hfe?e.size=0:this.size=0},delete:function(e){var t=this,n=a(t),r=u(t,e);if(r){var i=r.next,o=r.previous;delete n.index[r.index],r.removed=!0,o&&(o.next=i),i&&(i.previous=o),n.first==r&&(n.first=i),n.last==r&&(n.last=o),hfe?n.size--:t.size--}return!!r},forEach:function(e){for(var t,n=a(this),r=ofe(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!u(this,e)}}),ife(o,n?{get:function(e){var t=u(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),hfe&&rfe(o,"size",{configurable:!0,get:function(){return a(this).size}}),i},setStrong:function(e,t,n){var r=t+" Iterator",i=mfe(t),o=mfe(r);cfe(e,t,(function(e,t){pfe(this,{type:r,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?lfe("keys"==t?n.key:"values"==t?n.value:[n.key,n.value],!1):(e.target=void 0,lfe(void 0,!0))}),n?"entries":"values",!n,!0),dfe(t)}};(function(e,t,n){var r=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=r?"set":"add",a=Uhe[e],s=a&&a.prototype,u=a,c={},l=function(e){var t=Fhe(s[e]);Khe(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!Qhe(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!Qhe(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!Qhe(e))&&t(this,0===e?0:e)}:function(e,n){return t(this,0===e?0:e,n),this})};if(Yhe(e,!Jhe(a)||!(i||s.forEach&&!qhe((function(){(new a).entries().next()})))))u=n.getConstructor(t,e,r,o),jhe.enable();else if(Yhe(e,!0)){var d=new u,h=d[o](i?{}:-0,1)!=d,f=qhe((function(){d.has(1)})),p=$he((function(e){new a(e)})),m=!i&&qhe((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));p||((u=t((function(e,t){Bhe(e,s);var n=tfe(new a,e,u);return zhe(t)||Hhe(t,n[o],{that:n,AS_ENTRIES:r}),n}))).prototype=s,s.constructor=u),(f||m)&&(l("delete"),l("has"),r&&l("get")),(m||h)&&l(o),i&&s.clear&&delete s.clear}c[e]=u,Nhe({global:!0,constructor:!0,forced:u!=a},c),efe(u,e),i||n.setStrong(u,e,r)})("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),yfe);var vfe=Dne.charAt,gfe=g5,bfe=JJ,Afe=F9,_fe=Y9,wfe="String Iterator",Sfe=bfe.set,kfe=bfe.getterFor(wfe);Afe(String,"String",(function(e){Sfe(this,{type:wfe,string:gfe(e),index:0})}),(function(){var e,t=kfe(this),n=t.string,r=t.index;return r>=n.length?_fe(void 0,!0):(e=vfe(n,r),t.index+=e.length,_fe(e,!1))}));var Tfe=kj,xfe=Hne,Efe=zne,Lfe=n4,Ife=pJ,Rfe=wB,Zfe=Rfe("iterator"),Cfe=Rfe("toStringTag"),Pfe=Lfe.values,Gfe=function(e,t){if(e){if(e[Zfe]!==Pfe)try{Ife(e,Zfe,Pfe)}catch(Sye){e[Zfe]=Pfe}if(e[Cfe]||Ife(e,Cfe,t),xfe[t])for(var n in Lfe)if(e[n]!==Lfe[n])try{Ife(e,n,Lfe[n])}catch(Sye){e[n]=Lfe[n]}}};for(var Dfe in xfe)Gfe(Tfe[Dfe]&&Tfe[Dfe].prototype,Dfe);Gfe(Efe,"DOMTokenList");var Mfe=kj,Vfe=Fj(1..valueOf),Xfe=_Q,Wfe=Ej,Ofe=kj,Nfe=Mfe,Ufe=Fj,Ffe=fQ,Yfe=uB,Kfe=R6,jfe=yH,Hfe=GH,Bfe=RB,Jfe=xj,zfe=bz.f,Qfe=Tj.f,qfe=JB.f,$fe=Vfe,epe=Yne.trim,tpe="Number",npe=Ofe[tpe];Nfe[tpe];var rpe=npe.prototype,ipe=Ofe.TypeError,ope=Ufe("".slice),ape=Ufe("".charCodeAt),spe=function(e){var t,n,r,i,o,a,s,u,c=Bfe(e,"number");if(Hfe(c))throw ipe("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=epe(c),43===(t=ape(c,0))||45===t){if(88===(n=ape(c,2))||120===n)return NaN}else if(48===t){switch(ape(c,1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+c}for(a=(o=ope(c,2)).length,s=0;s<a;s++)if((u=ape(o,s))<48||u>i)return NaN;return parseInt(o,r)}return+c},upe=Ffe(tpe,!npe(" 0o1")||!npe("0b1")||npe("+0x1")),cpe=function(e){var t,n=arguments.length<1?0:npe(function(e){var t=Bfe(e,"number");return"bigint"==typeof t?t:spe(t)}(e));return jfe(rpe,t=this)&&Jfe((function(){$fe(t)}))?Kfe(Object(n),this,cpe):n};cpe.prototype=rpe,upe&&(rpe.constructor=cpe),Xfe({global:!0,constructor:!0,wrap:!0,forced:upe},{Number:cpe});upe&&function(e,t){for(var n,r=Wfe?zfe(t):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),i=0;r.length>i;i++)Yfe(t,n=r[i])&&!Yfe(e,n)&&qfe(e,n,Qfe(t,n))}(Nfe[tpe],npe);var lpe=kj,dpe=xj,hpe=g5,fpe=Yne.trim,ppe=Mne,mpe=Fj("".charAt),ype=lpe.parseFloat,vpe=lpe.Symbol,gpe=vpe&&vpe.iterator,bpe=1/ype(ppe+"-0")!=-1/0||gpe&&!dpe((function(){ype(Object(gpe))}))?function(e){var t=fpe(hpe(e)),n=ype(t);return 0===n&&"-"==mpe(t,0)?-0:n}:ype;_Q({global:!0,forced:parseFloat!=bpe},{parseFloat:bpe}),Z7("Int32",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var Ape="danger_d_speed";var _pe=function(){function e(t,n,r,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{logger:function(){},openLog:!1};HQ(this,e),this.bitrate=n,this.segment_duration=i||5e3,this.logger=o.logger,this.openLog=o.openLog,this.cdnHost=t.cdnHost,this._loadedPromise=new K2,this._wasmPromise=new K2,this.config=t,this.autoBitrateOpts=t.autoBitrateOpts||{},this.stall_penalty=this.autoBitrateOpts.stall_penalty||11,this.switch_penalty=this.autoBitrateOpts.switch_penalty||4,this.interval=this.autoBitrateOpts.interval||1e3;var a=t.progressTimer||1e3,s=this.autoBitrateOpts.startInterval||a;this.initInterval=.8*s,this._prealodMethod=t.preloadmethod||0,this._videoWidth=0,this._videoHeight=0,this._hasDeviceInfoChanged=!0,this.updateMediaInfos(r,!1)}return JQ(e,[{key:"onLoadWasm",value:function(){var e=this,t=this.module={onRuntimeInitialized:function(){e._wasmPromise.resolve()}};return(0,this.autoBitrateOpts.module)(t),this._wasmPromise}},{key:"updateMediaInfos",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._heightToDefitionConfig=new Map,this._bitrateToDefitionConfig=new Map,e?(this.mediaInfos=e,this.mediaInfos.dynamic_video_list.forEach((function(e){t._heightToDefitionConfig.set(e.vheight,e),t._bitrateToDefitionConfig.set(e.bitrate,e)}))):n&&console.error("baseAbr mediaInfos null")}},{key:"parseMPD",value:function(){if(this.setDebugModel(this.openLog),this.mediaInfos){this.logger("mediaInfos",this.mediaInfos);try{for(var e=[],t=this.mediaInfos.dynamic_video_list,n=0;n<t.length;n++){var r=t[n];e.push({stream_id:"s".concat(n),bandwidth:r.bitrate||r.bandwidth,width:r.vwidth||r.width,height:r.vheight||r.height,codec:r.codecs||r.codec_type||"h264",frame_rate:Number(r.fps)||-1,segment_duration:this.segment_duration})}var i={v_adaptation:e},o=JSON.stringify(i);this.module.ccall("parseMPD","null",["string"],[o])}catch(Sye){}}else console.warn("mediaInfos is null")}},{key:"_getDefautSpeed",value:function(e){var t=0,n=window.navigator.connection;if(n&&n.downlink)t=1024*navigator.connection.downlink/8,this.logger("initSpeed connect",t);else try{t=parseFloat(hre.getItem(Ape))||0,this.logger("initSpeed connect",t)}catch(Sye){}return 0===t&&(t=e&&e.historyAvspeed||0,this.logger("initSpeed history",t)),t}},{key:"setDebugModel",value:function(e){this.module._setDebugModel(e)}},{key:"updateBitrate",value:function(e){this.bitrate=e}},{key:"_updatePreloadSupplier",value:function(e,t){this.module._updatePreloadSupplier(e,t)}},{key:"updatePreloadSupplier",value:function(e){var t=this._getDefautSpeed();this._updatePreloadSupplier(t,e)}},{key:"getPreloadBitrate",value:function(){var e,t=null,n=[];try{this.logger("preloadMethod",this._prealodMethod),e=this.module._getPreloadBitrate(this._prealodMethod);for(var r=0;r<5;r++)n.push(this.module.HEAP32[e/Int32Array.BYTES_PER_ELEMENT+r]);var i={bitrate:n[0],pduration:n[1],preloadType:n[2],size:n[3],mediaType:n[4]};return this.logger("getPreloadBitrate",i),i}catch(Sye){t=null,console.log("getPreloadBitrate",Sye)}finally{this.module._free(e)}return t}},{key:"_updateDeviceInfo",value:function(e){try{if(this._hasDeviceInfoChanged){var t=window.devicePixelRatio||1;this.module._updateDeviceInfo(this._videoWidth||Number(this.config.width),this._videoHeight||Number(this.config.height),t,e||-1)}this._hasDeviceInfoChanged=!1}catch(Sye){console.log("_updateDeviceInfo")}}},{key:"preload",value:function(e){this.parseMPD(),this.updatePreloadSupplier(e),this._updateDeviceInfo(-1);var t=window.devicePixelRatio||1;return this.logger("baseAbr updateDeviceInfo width",this._videoWidth||Number(this.config.width),"height",this._videoHeight||Number(this.config.height),"dpr",t),this.getPreloadBitrate()}}]),e}();_pe.SPPED_CACHE=Ape;var wpe=_Q,Spe=xQ,kpe=f5,Tpe=$q,xpe=eJ,Epe=hH,Lpe=Y5,Ipe=xj,Rpe=mH("Reflect","construct"),Zpe=Object.prototype,Cpe=[].push,Ppe=Ipe((function(){function e(){}return!(Rpe((function(){}),[],e)instanceof e)})),Gpe=!Ipe((function(){Rpe((function(){}))})),Dpe=Ppe||Gpe;function Mpe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Vpe(e){return function(e){if(Array.isArray(e))return Mpe(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Mpe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mpe(e,t):void 0}}(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 Xpe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Wpe(e,t){return(Wpe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ope(e){return(Ope="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 Npe(e){return(Npe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}wpe({target:"Reflect",stat:!0,forced:Dpe,sham:Dpe},{construct:function(e,t){Tpe(e),xpe(t);var n=arguments.length<3?e:Tpe(arguments[2]);if(Gpe&&!Ppe)return Rpe(e,t,n);if(e==n){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var r=[null];return Spe(Cpe,r,t),new(Spe(kpe,e,r))}var i=n.prototype,o=Lpe(Epe(i)?i:Zpe),a=Spe(e,o,t);return Epe(a)?a:o}});var Upe=oB,Fpe=S5;_Q({target:"Object",stat:!0,forced:xj((function(){Fpe(1)}))},{keys:function(e){return Fpe(Upe(e))}});var Ype=_Q,Kpe=Fj,jpe=OH,Hpe=oB,Bpe=Cz,Jpe=G7,zpe=g5,Qpe=xj,qpe=Ote,$pe=j5,eme=Ute,tme=Fte,nme=kH,rme=Kte,ime=[],ome=Kpe(ime.sort),ame=Kpe(ime.push),sme=Qpe((function(){ime.sort(void 0)})),ume=Qpe((function(){ime.sort(null)})),cme=$pe("sort"),lme=!Qpe((function(){if(nme)return nme<70;if(!(eme&&eme>3)){if(tme)return!0;if(rme)return rme<603;var e,t,n,r,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(r=0;r<47;r++)ime.push({k:t+r,v:n})}for(ime.sort((function(e,t){return t.v-e.v})),r=0;r<ime.length;r++)t=ime[r].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));Ype({target:"Array",proto:!0,forced:sme||!ume||!cme||!lme},{sort:function(e){void 0!==e&&jpe(e);var t=Hpe(this);if(lme)return void 0===e?ome(t):ome(t,e);var n,r,i=[],o=Bpe(t);for(r=0;r<o;r++)r in t&&ame(i,t[r]);for(qpe(i,function(e){return function(t,n){return void 0===n?-1:void 0===t?1:void 0!==e?+e(t,n)||0:zpe(t)>zpe(n)?1:-1}}(e)),n=Bpe(i),r=0;r<n;)t[r]=i[r++];for(;r<o;)Jpe(t,r++);return t}});var dme=xj,hme=kH,fme=wB("species"),pme=function(e){return hme>=51||!dme((function(){var t=[];return(t.constructor={})[fme]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},mme=x6.map;_Q({target:"Array",proto:!0,forced:!pme("map")},{map:function(e){return mme(this,e,arguments.length>1?arguments[1]:void 0)}});var yme=_Q,vme=h6,gme=Jq,bme=hH,Ame=Ez,_me=Cz,wme=oH,Sme=T4,kme=wB,Tme=LQ,xme=pme("slice"),Eme=kme("species"),Lme=Array,Ime=Math.max;yme({target:"Array",proto:!0,forced:!xme},{slice:function(e,t){var n,r,i,o=wme(this),a=_me(o),s=Ame(e,a),u=Ame(void 0===t?a:t,a);if(vme(o)&&(n=o.constructor,(gme(n)&&(n===Lme||vme(n.prototype))||bme(n)&&null===(n=n[Eme]))&&(n=void 0),n===Lme||void 0===n))return Tme(o,s,u);for(r=new(void 0===n?Lme:n)(Ime(u-s,0)),i=0;s<u;s++,i++)s in o&&Sme(r,i,o[s]);return r.length=i,r}});var Rme=Sz,Zme=g5,Cme=nH,Pme=RangeError,Gme=_Q,Dme=Fj,Mme=Sz,Vme=Vfe,Xme=function(e){var t=Zme(Cme(this)),n="",r=Rme(e);if(r<0||r==1/0)throw Pme("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n},Wme=xj,Ome=RangeError,Nme=String,Ume=Math.floor,Fme=Dme(Xme),Yme=Dme("".slice),Kme=Dme(1..toFixed),jme=function(e,t,n){return 0===t?n:t%2==1?jme(e,t-1,n*e):jme(e*e,t/2,n)},Hme=function(e,t,n){for(var r=-1,i=n;++r<6;)i+=t*e[r],e[r]=i%1e7,i=Ume(i/1e7)},Bme=function(e,t){for(var n=6,r=0;--n>=0;)r+=e[n],e[n]=Ume(r/t),r=r%t*1e7},Jme=function(e){for(var t=6,n="";--t>=0;)if(""!==n||0===t||0!==e[t]){var r=Nme(e[t]);n=""===n?r:n+Fme("0",7-r.length)+r}return n};function zme(e){var t=function(){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(kye){return!1}}();return function(){var n,r=Npe(e);if(t){var i=Npe(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Ope(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Xpe(e)}(this,n)}}Gme({target:"Number",proto:!0,forced:Wme((function(){return"0.000"!==Kme(8e-5,3)||"1"!==Kme(.9,0)||"1.25"!==Kme(1.255,2)||"1000000000000000128"!==Kme(0xde0b6b3a7640080,0)}))||!Wme((function(){Kme({})}))},{toFixed:function(e){var t,n,r,i,o=Vme(this),a=Mme(e),s=[0,0,0,0,0,0],u="",c="0";if(a<0||a>20)throw Ome("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return Nme(o);if(o<0&&(u="-",o=-o),o>1e-21)if(n=(t=function(e){for(var t=0,n=e;n>=4096;)t+=12,n/=4096;for(;n>=2;)t+=1,n/=2;return t}(o*jme(2,69,1))-69)<0?o*jme(2,-t,1):o/jme(2,t,1),n*=4503599627370496,(t=52-t)>0){for(Hme(s,0,n),r=a;r>=7;)Hme(s,1e7,0),r-=7;for(Hme(s,jme(10,r,1),0),r=t-1;r>=23;)Bme(s,1<<23),r-=23;Bme(s,1<<r),Hme(s,1,1),Bme(s,2),c=Jme(s)}else Hme(s,0,n),Hme(s,1<<-t,0),c=Jme(s)+Fme("0",a);return c=a>0?u+((i=c.length)<=a?"0."+Fme("0",a-i)+c:Yme(c,0,i-a)+"."+Yme(c,i-a)):u+c}});var Qme="ABR_CHANGE_A",qme="UPDATE_AUTO_DESC",$me="MAX_BUFFER_CHANGE",eye=0,tye=1,nye=-1,rye=0,iye=1,oye={PLAYBACK_BITRATE:"avg_play_bitrate",DOWNLOAD_BITRATE:"avg_download_bitrate",DOWNLOAD_NETWORK_SPEED:"avg_download_speed",PREDICT_NETWORK_SPEED:"avg_predict_speed",BUFFER_LENGTH:"avg_buffer_length",QOE:"avg_qoe"},aye=function(e){!function(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&&Wpe(e,t)}(n,e);var t=zme(n);function n(e,r,i,o,a){var s,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{logger:function(){},openLog:!1};HQ(this,n),(s=t.call(this,r,i,o,a,u)).player=e,s.timerId=0,s.isOpenAutoDefi=!!s.autoBitrateOpts.isOpenAutoDefi,s.onPlayrateChange=s._onPlayrateChange.bind(Xpe(s)),s.onPlay=s._onPlay.bind(Xpe(s)),s._stop=s.stop.bind(Xpe(s)),s._bufferRange=new Map,s._sortedBufferRange=[],s._lastCheckResolutionStamp=0,s._currentDefinition=null,s._isSeeking=!1,s._waitingStartTime=0,s._stallCount=0,s._seekState=eye,s._stallState=rye,s._videoCurrentTime=0,s.listeners=[{evt:"playbackrateChange",handler:s.onPlayrateChange},{evt:"ended",handler:s._stop},{evt:"error",handler:s._stop},{evt:"timeupdate",handler:s._onTimeUpdate.bind(Xpe(s))},{evt:"addVideoBufferEnd",handler:s._bufferRangeUpdate.bind(Xpe(s))},{evt:"canplay",handler:s._updateAutoDesc.bind(Xpe(s))},{evt:"play",handler:s._onplayStart.bind(Xpe(s))},{evt:$me,handler:s._onMaxBufferChange.bind(Xpe(s))},{evt:"seeking",handler:s._onSeeking.bind(Xpe(s))},{evt:"seeked",handler:s._onSeekEnd.bind(Xpe(s))},{evt:"waiting",handler:s._onWaiting.bind(Xpe(s))},{evt:"playing",handler:s._onPlaying.bind(Xpe(s))}],s._hasStart=!1,s.listeners.forEach((function(e){var t=e.evt,n=e.handler;s.player.on(t,n)})),s._isPaused=!1,s._hasAddFrament=!1,s._eventInfo={local_time_ms:0,internet_speed:0,buffer_length:0,last_bitrate:0,now_bitrate:0,play_speed:1},s._bitrateSet=[],s._generalInfo={},s._currentInAbr=!1,s._hasCalcTimelineLog=!1,s._abr_play_info={start_play_time_ms:0,is_hint:0,playback_info:{internet_speed_record:[],play_bitrate_record:[],buffer_length_record:[],play_speed_record:[],qoe_record:[],qoe_a_record:[],qoe_b_record:[],qoe_c_record:[]}},s._abrMethod=s.autoBitrateOpts.method||0,s.logger("abr: constructor"),s._loopInterval=s.initInterval,s._tickCount=0,s._fps=30,m5.install(),s.startTime=performance.now(),s.logger("time abr",(new Date).getTime()),s._maxCacheTimeVideo=s.config.maxBufferLength||s.config.preloadTime||50,s._maxCacheTimeAudio=s._maxCacheTimeVideo,s._prevDefinitionItem=null,s._currentItem=null,s._switchCount=0,s._switchBitrate=0,s._avgStatItems={};for(var c=Object.keys(oye),l=0;l<c.length;l++){var d=c[l],h=oye[d];s._avgStatItems[h]=new sye}return s._qoeArgs=[0,0,0,0],s._abrUsed=-1,s._abrAlwaysOn=1,s._prelaodInfo=null,s._hasLogStartInfo=!1,s._hasExecuteAbrAlgo=!1,s._lastExecuteTimeInMs=0,s}return JQ(n,[{key:"init",value:function(e){return this._mediaList=e,this.isOpenAutoDefi?this.onLoadWasm():this._wasmPromise.resolve(),this._wasmPromise}},{key:"execute",value:function(){return this.listenSize(),this.initFps(),this.onWinElemSizeChange(),this.onPlay()}},{key:"_onSeeking",value:function(){this._isSeeking=!0,this.player.currentTime<this._videoCurrentTime?this._seekState=nye:this._seekState=tye,this.logger("seekState",this._seekState)}},{key:"_onSeekEnd",value:function(){this._isSeeking=!1}},{key:"_onWaiting",value:function(){var e=this;this._isSeeking||this._waitingStartTime>0||(this._waitingStartTime=(new Date).getTime(),this._stallId=setTimeout((function(){clearTimeout(e._stallId),e._stallCount++,e._stallState=iye}),200))}},{key:"_onPlaying",value:function(){this._waitingStartTime=0,this._stallState=rye,clearTimeout(this._stallId)}},{key:"initFps",value:function(){this.fpsDetection=new m5,this.fpsDetection.start(),this._fps=this.fpsDetection.fps,this._hasDeviceInfoChanged=!0}},{key:"listenSize",value:function(){var e,t,n,r;this.mediaElem=this.player.video,this._onWinSizeChange=(e=this.onWinElemSizeChange.bind(this),t=1e3,n=!1,function(){var i=this,o=arguments,a=n&&!r;clearTimeout(r),r=setTimeout((function(){r=null,n||e.apply(i,o)}),t),a&&e.apply(i,o)}),window.addEventListener("resize",this._onWinSizeChange)}},{key:"onWinElemSizeChange",value:function(){if(this.mediaElem){var e=this.mediaElem.getBoundingClientRect();this._videoWidth=Math.floor(e.width),this._videoHeight=Math.floor(e.height),this._hasDeviceInfoChanged=!0}}},{key:"_onMaxBufferChange",value:function(e){var t=e.videoCacheTime,n=e.audioCacheTime;this._maxCacheTimeAudio=n,this._maxCacheTimeVideo=t}},{key:"_onTimeUpdate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this._sortedBufferRange&&0!==this._sortedBufferRange.length&&this._currentInAbr){this._videoCurrentTime=this.player.currentTime;var n=Date.now();if(!(n-this._lastCheckResolutionStamp<1e3&&0!==this._lastCheckResolutionStamp)||t){this._lastCheckResolutionStamp=n;for(var r=this.player.currentTime,i=0,o=this._sortedBufferRange.length-1,a=null;i<=o;){var s=Math.floor(i+(o-i)/2),u=this._sortedBufferRange[s];if(r<u.start)o=s-1;else{if(!(r>=u.end)){a=u;break}i=s+1}}if(a){var c=this._bitrateToDefitionConfig.get(a.bandwidth),l=c&&c.definition;if(this._currentDefinition===l&&!t||!l)return void(l||this.logger("error defintion, mpd配置与接口配置不一致"));this._currentDefinition=l,this._prevDefinitionItem=this._currentItem,this._currentFps=c.fps,this._currentItem=c,this._emitAutoDescChange(l,!1,this._currentFps,c)}}}}},{key:"_emitAutoDescChange",value:function(e,t,n,r){console.log("[ABR],emitAutoDescChange, definition, ",e,",item,",r,",pre_item,",this._prevDefinitionItem),this.player.emit(qme,{definition:e,reset:t,fps:n,item:r,pre_item:this._prevDefinitionItem})}},{key:"_onplayStart",value:function(){this._hasStart=!0,this.logger("onplaystart")}},{key:"_updateAutoDesc",value:function(){var e=this;this._currentInAbr&&this._currentDefinition&&(this._updateId=setTimeout((function(){clearTimeout(e._updateId),e._emitAutoDescChange(e._currentDefinition,!1,e._currentFps,e._currentItem)}),0))}},{key:"_bufferRangeUpdate",value:function(e){if(void 0!==e.start){null===this._currentItem&&this._onTimeUpdate(null,!0);var t=e.start;this._hasAddFrament=!0,this._bufferRange.set(t,e);var n=Vpe(this._bufferRange.values());this._sortedBufferRange=n.sort((function(e,t){return e.start-t.start})),this.avgStat(oye.DOWNLOAD_BITRATE,e.bandwidth)}}},{key:"_onPlayrateChange",value:function(){this.module&&this.updateBufferInfo()}},{key:"_onPlay",value:function(){var e=this;if(!this.isOpenAutoDefi)return this.logger("onPlay"),0;var t=0;try{this.logger("abr: loadeddata"),this.updateSwitchInfo(),this.parseMPD(),this.updateDeviceInfo();var r=n.getIsPlayAutoDefi(this.autoBitrateOpts);if(this.isOpenAutoDefi&&r){this._abrUsed=1;var i=this._getDefautSpeed(this.player);t=this._loopAbr(i),this.start(),this.logger("time abr start prgress",(new Date).getTime()),this.logger("time abr costTime",performance.now()-this.startTime),this.logger("abr onplay"),this.startTimer=setTimeout((function(){e._loopInterval=e.interval,clearTimeout(e.startTimer),e.logger("interval change")}),5e3)}}catch(Sye){this.logger("abr: loadeddata error",Sye),this.logger("time abr costTime err",performance.now()-this.startTime)}return t}},{key:"start",value:function(){if(this.logger("abr: start"),this._isPaused=!1,!this._hasCalcTimelineLog){var e=1===Math.floor(100*Math.random());this._abr_play_info.is_hint=e?1:0}this._hasCalcTimelineLog=!0,this._loop()}},{key:"_loop",value:function(){var e=this;this._isPaused||(clearTimeout(this.timerId),this.timerId=setTimeout((function(){if(!e.player.paused||!e.player.config.autoplay&&!e._hasStart){var t=e._hasAddFrament?void 0:e._getDefautSpeed(e.player);e._loopAbr(t)}e._loop()}),this._loopInterval))}},{key:"updateDeviceInfo",value:function(){try{if(this.fpsDetection){var e=this.fpsDetection.fps;e!==this._fps&&(this._fps=e,this._hasDeviceInfoChanged=!0)}this._updateDeviceInfo(this._fps)}catch(Sye){}}},{key:"updateBufferInfo",value:function(e){var t=this.player.playbackRate,n=this.bufferLength,r=e||Math.floor(this.player.downloadSpeed);return this._tickCount<5&&0===r&&(r=this._getDefautSpeed(this.player),this.logger("initSpeed fix")),this.logger("maxCacheTimeAudio:",this._maxCacheTimeAudio,"maxCacheVideoTime",this._maxCacheTimeVideo,"seekState",this._seekState,"stallState",this._stallState),this.module._updateBufferInfo(t,this._maxCacheTimeAudio,this._maxCacheTimeVideo,n,n,r,this._seekState,this.player.currentTime,this._stallState),this._seekState=eye,this._eventInfo={internet_speed:r,buffer_length:n,last_bitrate:this.bitrate,play_speed:t},this.logger("playRate:",t,"buff:",n,"downloadSpeed:",r),{buffer:n,downloadSpeed:r}}},{key:"updateSwitchInfo",value:function(){var e=(new Date).getTime();this._openTimeMs=e,this._abr_play_info.start_play_time_ms=e;var t,n,r=this.player.config.preloadTime||50,i=(n=(t=e).toString(16)).length<=8?{high:0,low:t}:{high:parseInt(n.substr(0,n.length-8),16),low:parseInt(n.substr(n.length-8),16)},o=this.autoBitrateOpts.noStallCheckTime||5,a=this.openLog;this.logger("openTime:",e,"this.logger",a),this.module._updateSwitchInfo(i.low,i.high,o,a,this.stall_penalty,this.switch_penalty);var s=this._mediaList.video,u=s.map((function(e){var t=e.bandwidth,n=e.bitrate;return t||n}));this._bitrateSet=u.map((function(e,t){return{bitrate:e,codecs:s[t].codecs||s[t].codec_type}})),this._generalInfo={max_cache_time:r,bitrate_set:this._bitrateSet,segment_duration:this.segment_duration,preload_info:{},startup_info:{}}}},{key:"updatePreloadCacheInfo",value:function(e){try{this._prelaodInfo=e,this.logger("update preloadInfo",e),e&&e.item_num!==e.items.length&&(this.logger("preloadInfo invalid"),this._prelaodInfo=null)}catch(kye){this.logger("updatePreloadCacheInfo",kye),this._prelaodInfo=null}}},{key:"updatePreloadLogInfo",value:function(e){this._generalInfo.preload_info=e||{}}},{key:"_updatePreloadInfo",value:function(){try{var e=this.player.getPreloadInfos();if(e){var t=e.preloadInfo,n=e.abr;this.updatePreloadLogInfo(t),n&&this.updatePreloadCacheInfo(t)}if(this.logger("_updatePreloadInfo preloadinfos",e),null!=this._prelaodInfo){var r=JSON.stringify(this._prelaodInfo);this.module.ccall("updatePreloadInfo","null",["string"],[r])}else this.logger("_updatePreloadInfo preloadinfo null, no preload")}catch(kye){this.logger("_updatePreloadInfo err",kye)}}},{key:"_loopAbr",value:function(e){var t;this._tickCount++;var n=[];try{this.updateDeviceInfo();var r=this.updateBufferInfo(e),i=r.downloadSpeed,o=r.buffer;t=this.module._getPredictedBitrate(this.bitrate,this._abrMethod);for(var a=0;a<7;a++)n.push(this.module.HEAP32[t/Int32Array.BYTES_PER_ELEMENT+a]);var s=n[0],u=1===n[1];this._eventInfo.now_bitrate=s,this._eventInfo.local_time_ms=(new Date).getTime();var c=0;if(s!==this.bitrate&&0!==s){var l=this.bitrate;c=Math.abs(l-s);for(var d=[],h=this.player.video.buffered,f=0;f<h.length;f++)d.push({start:h.start(f),end:h.end(f)});var p=this._videoWidth||Number(this.config.width),m=this._videoHeight||Number(this.config.height),y=(new Date).getTime(),v={speed:"".concat(i," KB/s"),buffer_length:"".concat(o," s"),video_pos:this.player.currentTime,all_buffers:d,seek_state:this._seekState,stall_state:this._stallState,screen_width:p,screen_height:m,dpr:window&&window.devicePixelRatio,playbackRate:this.player.playbackRate,bitrateSet:this._bitrateSet,abrMethod:this._abrMethod,delta:this._hasExecuteAbrAlgo?y-this._lastExecuteTimeInMs:0};this._lastExecuteTimeInMs=y,this._hasExecuteAbrAlgo=!0,this.player.emit(Qme,this.bitrate,s,u,JSON.stringify(v)),this.logger("abr loop predicte:",s,"willStall:",u,"switchBitrate",c,"cur",l),this.bitrate=s}this._hasLogStartInfo||(this._hasLogStartInfo=!0,this._generalInfo.startup_info={predict_bitrate:s,download_speed:i,screen_width:this._videoWidth||Number(this.config.width),screen_height:this._videoHeight||Number(this.config.height),device_pixel_ratio:window&&window.devicePixelRatio,screen_fps:this._fps,startup_method:this._abrMethod}),this.player.emit("ABR_LOOP"),this.onAbrLoop(i,n[2],c,n.slice(3))}catch(Sye){this.logger("abr error",Sye),console.log("error",Sye)}finally{this.module._free(t)}return this.bitrate}},{key:"stop",value:function(){!0===(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&(this._abrAlwaysOn=-1),clearTimeout(this.timerId),this._isPaused=!0,this.logger("abr: stop")}},{key:"destroy",value:function(){var e=this;this._stop(),this.listeners.forEach((function(t){var n=t.evt,r=t.handler;e.player.off(n,r)})),this.player=null,this._heightToDefitionConfig=null,this._bitrateToDefitionConfig=null,this._bufferRange=null,this._sortedBufferRange=null,this.module=null,clearTimeout(this._stallId),clearTimeout(this._updateId),clearTimeout(this.startTimer),window.removeEventListener("resize",this._onWinSizeChange),this.fpsDetection&&this.fpsDetection.stop(),this.player=null}},{key:"eventInfo",get:function(){return this._eventInfo}},{key:"generalInfo",get:function(){return this._generalInfo}},{key:"bufferLength",get:function(){var e=this.player.getBufferedRange(),t=this.player.video.currentTime,n=e[1]-Math.max(e[0],t);return n=Math.max(0,n).toFixed(2),parseFloat(n)}},{key:"downloadSpeed",get:function(){return Math.floor(this.player.downloadSpeed)}},{key:"nowBitrate",get:function(){return this.bitrate}},{key:"openTimeMs",get:function(){return this._openTimeMs}},{key:"isCurrentInAbr",get:function(){return this._currentInAbr},set:function(e){this._currentInAbr=e}},{key:"onAbrLoop",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(this._qoeArgs=r,this._currentItem&&this.avgStat(oye.PLAYBACK_BITRATE,this._currentItem.bitrate),this.avgStat(oye.DOWNLOAD_NETWORK_SPEED,1e3*e*8),this.avgStat(oye.PREDICT_NETWORK_SPEED,t),this.avgStat(oye.BUFFER_LENGTH,this.bufferLength),this.avgStat(oye.QOE,this.getQoeRelValue(0)),n>0&&(this._switchCount++,this._switchBitrate+=n),this._abr_play_info.is_hint){var i=this,o=((new Date).getTime()-this.openTimeMs)/1e3;o=parseFloat(o.toFixed(2)),this._abr_play_info.playback_info.internet_speed_record.push([o,i.downloadSpeed]),this._abr_play_info.playback_info.play_bitrate_record.push([o,i.nowBitrate]),this._abr_play_info.playback_info.buffer_length_record.push([o,i.bufferLength]),this._abr_play_info.playback_info.play_speed_record.push([o,this.player.playbackRate]),this._abr_play_info.playback_info.qoe_record.push([o,this.getQoeRelValue(0)]),this._abr_play_info.playback_info.qoe_a_record.push([o,this.getQoeRelValue(1)]),this._abr_play_info.playback_info.qoe_b_record.push([o,this.getQoeRelValue(2)]),this._abr_play_info.playback_info.qoe_c_record.push([o,this.getQoeRelValue(3)])}}},{key:"getQoeRelValue",value:function(e){return this._qoeArgs[e]/100}},{key:"avgStat",value:function(e,t){var n=this._avgStatItems[e];n&&n.add(t)}},{key:"getAbrPlayInfo",value:function(){return this._abr_play_info}},{key:"updateAbrMethod",value:function(e){this._abrMethod=e}},{key:"getAbrMethod",value:function(){return this._abrMethod}},{key:"getAbrVVStats",value:function(){for(var e={},t=Object.keys(oye),n=0;n<t.length;n++){var r=t[n],i=oye[r],o=this._avgStatItems[i];e[i]=o.avg()}return e.switch_counts=this._switchCount,e.avg_switch_bitrate=0===this._switchCount?0:this._switchBitrate/this._switchCount,e.abr_qoe=this.getQoeRelValue(0),e.abr_qoe_a=this.getQoeRelValue(1),e.abr_qoe_b=this.getQoeRelValue(2),e.abr_qoe_c=this.getQoeRelValue(3),e.abr_method=this._abrMethod,e.abr_used=this._abrUsed,e.abr_always_on=this._abrAlwaysOn,this.logger("abrVVStats",e),e}}],[{key:"getIsPlayAutoDefi",value:function(e){return!!e.isPlayAutoDefi}}]),n}(_pe),sye=function(){function e(){HQ(this,e),this.total=0,this.count=0}return JQ(e,[{key:"add",value:function(e){this.total+=e,this.count++}},{key:"avg",value:function(){if(0===this.count)return 0;var e=this.total/this.count;return Math.floor(e)}}]),e}(),uye="FIXED",cye="AUTO",lye=function(){function e(t,n){var r=this;hK(this,e),mK(this,"_onAbrChange",(function(e,t,n,i){var o=r._pluginInst.player,a=r.bitrateMap[e],s=r.bitrateMap[t],u=a.definition,c=s&&s.definition?s.definition:u;console.log("[ABR] _onAbrChange ",u,c),u!==c&&(r._abrSwitchHandler(s),o.emit("ABR_CHANGE",{prev:u,cur:c,prevName:a.definitionName,curName:s.definitionName,abrInfo:i}))})),mK(this,"_onAutoDescChange",(function(e){var t=e.definition,n=e.reset,i=e.fps,o=e.item;r.updateAutoDefiDesc(t,n,i,o)})),this._pluginInst=t;var i=this._pluginInst.config.autoBitrateOpts||{};this.isPlayAutoDefi=aye.getIsPlayAutoDefi(i),this.isOpenAutoDefi=!!i.isOpenAutoDefi,this.isCurrentAutoDefi=this.isOpenAutoDefi&&this.isPlayAutoDefi,this.bitrateMap={},this.defiIdMap={},this._abrSwitchHandler=n}var t;return pK(e,[{key:"_destroyAbr",value:function(){var e=this._pluginInst.player;this.abrInstance&&(e&&e.off(qme,this._onAutoDescChange),this.abrInstance.destroy(),this.abrInstance=null)}},{key:"init",value:(t=dK(uK().mark((function e(t){var n,r,i,o;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isOpenAutoDefi){e.next=2;break}return e.abrupt("return",{type:uye});case 2:return n=this._pluginInst,r=n.player,i=n.playerConfig,o=n.config,r.on(qme,this._onAutoDescChange),this.bitrateMap={},this.defiIdMap={},this.abrInstance=new aye(r,o,0,{dynamic_video_list:i.definition.list.concat()},5e3,{logger:hae,openLog:lae}),e.next=9,this.abrInstance.init(t);case 9:r.on(Qme,this._onAbrChange),this.abrInstance.isCurrentInAbr=this.isCurrentAutoDefi;case 11:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"execute",value:function(){var e=this.abrInstance.execute();return{bitrate:e,type:-1===e?uye:cye}}},{key:"updateBitrate",value:function(e){this.abrInstance&&this.abrInstance.updateBitrate(e)}},{key:"enable",value:function(){this.abrInstance.start(),this.isCurrentAutoDefi=!0,this.abrInstance.isCurrentInAbr=!0,this.abrInstance._onTimeUpdate(null,!0)}},{key:"disable",value:function(){this.abrInstance&&(this.updateAutoDefiDesc("",!0),this.isCurrentAutoDefi=!1,this.abrInstance.isCurrentInAbr=!1,this.abrInstance.stop(!0))}},{key:"isCurrentInAbr",value:function(){return!!this.abrInstance&&this.abrInstance.isCurrentInAbr}},{key:"updateAutoDefiDesc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=this._pluginInst,o=i.player,a=(i.config.autoBitrateOpts||{}).autoDefiText||"auto";o.emit("ABR_AUTO_DESC_CHANGE",a,t?void 0:e,n,r)}},{key:"updateAbrCacheData",value:function(){var e=this,t=this._pluginInst,n=t.player,r=t.config,i=t.playerConfig,o=r.autoBitrateOpts||{},a=i.definition.list,s=!1;if(a.forEach((function(t){e.bitrateMap[t.bitrate]={url:t.url,definition:t.definition,definitionName:t.text},e.defiIdMap[t.definition]={bitrate:t.bitrate,definition:t.definition},"auto"!==t.definition&&"自动"!==t.definition||(s=!0)})),this.isOpenAutoDefi,this.isOpenAutoDefi&&!s){var u=o.autoDefiText||"auto",c={definition:"自动",bitrate:n.curDefinition.bitrate,text:u,url:"__auto__",selected:this.isPlayAutoDefi,name:"自动",vwidth:n.curDefinition.vwidth,vheight:n.curDefinition.vheight};i.definition.list.push(c)}}},{key:"destroy",value:function(){this._pluginInst.player.off(Qme,this._onAbrChange),this._destroyAbr()}}]),e}(),dye="real_time_speed",hye=null,fye=null,pye=null,mye=null,yye="h264",vye="h265",gye=0,bye=function(e){yK(i,e);var t,n,r=AK(i);function i(e){var t;return hK(this,i),mK(bK(t=r.call(this,e)),"_replayHook",(function(e){"xgmse-video"===t.player.config.mediaType?t._onReplay():t.useVideoLoad||(t._defInited=!1,t.log("replayHook ",t.playerConfig.url),t.player.video.load(),t.playerStartInit(t.playerConfig.url))})),mK(bK(t),"_retryHook",(function(){var e=bK(t),n=e.player,r=e.playerConfig,i=e.config,o=n.currentTime;if(t.codecType!==vye||i.supportHevc){t._defInited=!1;var a=t.config,s=a.drm,u=a.kid,c=a.secretKey,l=a.keyValue;if(s||u||c||l)t.initAwManager(),t.playerStartInit(r.url);else{if(t.useVideoLoad=!0,"Array"===W.typeOf(r.url)){var d=r.url.length;n.video.src=r.url[d-1].src}else n.video.src=r.url;n.currentTime=o,n.play()}}else t.log("h265 retryHook ",r.vid),t._onDegrade("retry");return!1})),mK(bK(t),"_playHook",(function(e){t._usePaused=!1})),mK(bK(t),"_pauseHook",(function(e){t._usePaused=!0})),mK(bK(t),"abrSwitchURL",function(){var e=dK(uK().mark((function e(n){var r,i,o,a,s,u;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=bK(t),i=r.playerConfig,o=i.definition.list,a=0,s=0;case 4:if(!(s<o.length)){e.next=11;break}if(n.definition!==o[s].definition){e.next=8;break}return a=s,e.abrupt("break",11);case 8:s++,e.next=4;break;case 11:u=t.player.curDefinition,t.changeDefinition(o[a],u,!0);case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),mK(bK(t),"changeDefineCanPlay",(function(e,n,r,i){var o=bK(t).player;o.ended?o.currentTime=0:(t.log("[oldChangeDefinition],this._changeDefState,",t._changeDefState),o.currentTime=t._changeDefState?t._changeDefState.currentTime:e,(t._changeDefState?t._changeDefState.paused:n)?o.pause():o.play(),t._changeDefState=null,o.emit("after_definition_change",{from:r,to:i}))})),mK(bK(t),"changeDefinition",(function(e,n,r){var i=bK(t),o=i.player,a=i.playerConfig,s=i.mp4;if(n||(n=o.curDefinition),t.useVideoLoad)return"__auto__"===e.url&&(e.url=o.config.definition.list[0].url),void pye.call(t.player,e,n);if(t._switchBitRateWay&&!r)return t.log("changeDefinition old"),void t.oldChangeDefinition(e,n);var u="自动"===e.definition||"auto"===e.definition;if(r)t.log("[switchBitrate:ABR], ready to switch bitRate, ",e.bitrate);else{var c=!1;if(u)t._abrService&&t._abrService.enable(),c=!0;else if(t._abrService&&t._abrService.disable(),!e.bitrate||e.bitrate<=0)for(var l=0;l<a.definition.list.length;l++)e.definition===a.definition.list[l].definition&&(e.bitrate=a.definition.list[l].bitrate);o.emit(z,{from:n,to:e}),setTimeout((function(){t._abrService&&t._abrService.updateAutoDefiDesc(o.curDefinition.definition,!u)})),c&&(e=o.curDefinition),t.log("[switchBitrate:CBS],switch bitRate, ",e.bitrate)}o.curDefinition=e;var d=o.definitionList.filter((function(e){return e.definition===o.curDefinition.definition}));d.length>0&&(e=d[0]),s&&(t.config.keyValue=e.keyValue,t.config.kid=e.kid,t.config.secretKey=e.secretKey,t.config.drm=e.drm,t.config.getLicenseUrl=e.getLicenseUrl,t._getLicense().then(dK(uK().mark((function n(){var i,u,c,l,d,h;return uK().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(a.url=e.url,a.backupURL=e.backupURL,i=0,u=!1,t._abrService&&t._abrService.isCurrentInAbr()?(c=o.getBufferedRange(o.buffered2),(i=c[1])<o.currentTime&&(i=o.currentTime,t.log("bufferRange is invaild,adjust",c,",timeStart,",i)),t.log("[switchBitrate:ABR],switch bufferedList, ",t.player.buffered2?t.player.buffered2.bufferedList:null,",curtime,",o.currentTime,",bufferRange,",c)):(i=o.currentTime,u=!0),(l=s.getFragmentIdx(i))<0&&(l=t._curLoadSegmentIdx),t.log("switchBitrate:point,",l,",startTime,",s.timeRange[l].startTime,",currentTime,",o.currentTime),u&&o.emit("definitionSwitchTime",s.timeRange[l].startTime+1),t.changeState("changeDefinition",{abr:r,fragIndex:l,startTime:s.timeRange[l].startTime,currentTime:o.currentTime}),!s){n.next=14;break}return n.next=13,s.cancelLoading();case 13:s._metaLoading&&(s._metaLoading=!1);case 14:return!((d=o.getBufferedRange(o.buffered))[1]>0&&d[1]-o.currentTime>5)||t._abrService&&t._abrService.isCurrentInAbr()||(t.mse.clearOpqueues(fre),t.mse.reuse(o.currentTime+5,d[1])),s.resetFragmentLoadState(l),t._curLoadSegmentIdx=l,n.next=20,t.mp4.changeBitRate(e);case 20:h={width:e.width||e.vwidth,height:e.height||e.vheight},o.emit("RESOLUTION_UPDATE",h);case 22:case"end":return n.stop()}}),n)})))).catch((function(n){console.error(n),n.errorType="GET_LICENSE_ERROR",t.emit("error",n),t.changeState("LICENSE_ERROR",{d:e.definition})})))})),mK(bK(t),"_onVideoError",(function(e){t.log("video err,",e)})),mK(bK(t),"_onPlaying",(function(){t._waitAdjustTimeCnt>0&&t._waitInBufferTimer&&(t._waitAdjustTimeCnt-=1,t.log("[waitInBuffer resume play], waitAdjustTimeCnt,",t._waitAdjustTimeCnt)),clearTimeout(t._waitInBufferTimer),t._waitInBufferTimer=null,t.log("[Index] onPlaying, timeNow,",Yie.nowTime());var e=bK(t),n=e.mp4,r=e.player,i=t.config.resumePlayWaterLevel;if(n){if(!t.playFlag||r.currentTime<1)t.playFlag=!0;else if(!(n&&n.meta&&n.meta.duration-r.currentTime<=i)&&i>0&&t.playFlag){var o=r.getBufferedRange(r.buffered2);o[1]-r.currentTime<i?(r.paused||(r.pause(),t.log("[!!!!!buffer not rich, pause],time,",Yie.nowTime(),", currentTime, ",r.currentTime,", bufferEnd,",o[1])),clearTimeout(t.checkResumePlayTimer),t.checkResumePlayTimer=setTimeout(t._onPlaying,i/2*1e3)):r.paused&&(t.log("[!!!!!buffer rich, play],time,",Yie.nowTime(),", currentTime, ",r.currentTime,", bufferEnd,",o[1]),clearTimeout(t.checkResumePlayTimer),t.checkResumePlayTimer=null,r.play())}}else t.checkResumePlayTimer>0&&(clearTimeout(t.checkResumePlayTimer),t.checkResumePlayTimer=null,r.paused&&r.play())})),mK(bK(t),"_lowDecoder",(function(){var e="function"==typeof t.player.video.getStats?t.player.video.getStats():null;t.log("H265 lowdecode: ".concat(t.playerConfig.vid," "),e,", h265Degrade, ",t.config.h265Degrade),t.config.h265Degrade&&t._onDegrade()})),mK(bK(t),"_onError",(function(e){console.log("H265 onError: ".concat(t.playerConfig.vid," "),e,", h265Degrade, ",t.config.h265Degrade),t._onDegrade(e)})),mK(bK(t),"_onDegrade",(function(e){var n,r,i=bK(t),o=i.player,a=i.playerConfig,s=i.config;o.video.removeEventListener("lowdecode",t._onDegrade),o.video.removeEventListener("error",t._onError),null===(n=t.mp4)||void 0===n||n.destroy();var u=o.currentTime;if(console.log("[h265 degrade], vid,",a.vid,",currtime,",u),t.emit("H265_DEGRADE",{reason:e?"error":"lowdecode",currentTime:u}),null!=s&&s.H264Config){var c=s.H264Config;s.drm=(null==c?void 0:c.drm)||null,s.getLicenseUrl=(null==c?void 0:c.getLicenseUrl)||null,s.kid=(null==c?void 0:c.kid)||null,s.keyValue=(null==c?void 0:c.keyValue)||null,s.secretKey=(null==c?void 0:c.secretKey)||null,s.isEncrypt=(null==c?void 0:c.isEncrypt)||null,s.useEME=(null==c?void 0:c.useEME)||null}var l={mp4encryptplayer:s,mediaType:"video",codecType:yye};(null==a||null===(r=a.H264DefinitionList)||void 0===r?void 0:r.length)>0?(o.config.definition.list=a.H264DefinitionList,o.config.url=a.H264DefinitionList[0].url,o.config.defaultBitrate=a.H264DefinitionList[0].bitrate,o.config.defaultDefinition=a.H264DefinitionList[0].definition,o.playNext(l),o.once("canplay",(function(){o.currentTime=u}))):(console.error("H265 error,degrade h264 but no h264 url"),t.emit("error",e))})),mK(bK(t),"_onMp4MetaReady",(function(e){console.log(">>>>_onMp4MetaReady",Yie.nowTime()),t.firstFrameTime.metaload=t.mp4.firstFrameTime.metaload,t.firstFrameTime.bitrate=t.player.curDefinition.bitrate;var n=t.playerConfig.vid,r=t._checkMetaInfo(e),i=t.mp4.checkCodecH265();if(t.changeState("MP4_META_READY",{is265:i?1:0}),r)return t.removeAndRejectInitPromise(r),void t._errorHandler(r);try{if(t._initEME(t.mp4,e),t.codecType!==vye||t.config.supportHevc){if(!(t.player.video instanceof HTMLVideoElement))return void console.error("".concat(t.player.config.mediaType," is not match"));t._initMse(e)}else{if(!i||t.player.video instanceof HTMLVideoElement)return void console.error("[Index] ".concat(n," config_codec ").concat(t.codecType," and meta_codec ").concat(e.videoCodec," is not match or supportHevc is ").concat(t.config.supportHevc));t._initH265MseProxy()}t._initPromise.resolve()}catch(kye){t.removeAndRejectInitPromise(kye),console.error("[Index] ".concat(n," _initEME error"),kye);var o=new j(t.player,{errorType:"runtime",errorTypeCode:Cie.runtime,errorCode:Zie.other1,errorMessage:null==kye?void 0:kye.message,vid:n,mediaError:{code:Zie.other1,message:null==kye?void 0:kye.message}});t._errorHandler(o)}if(t.mp4&&t.mp4.timeRange){var a=[];t.mp4.timeRange.every((function(e){return a.push({startTime:e.startTime,endTime:e.endTime}),!0})),t.emit("KEYFRAMETIME",a)}t._loadData()})),mK(bK(t),"_onMp4Error",(function(e){var n=t.playerConfig.vid;console.error("[Index] _onMp4Error",n,e),t.changeState("MP4_ERROR",e),t._initPromise&&"pending"===t._initPromise.state&&t.removeAndRejectInitPromise(e),t._errorHandler(e)})),mK(bK(t),"_onMp4Progress",(function(e){t.emit("progress_event",e)})),mK(bK(t),"_onMp4DataCallBack",(function(){t.mse&&!t.mse.ready&&t.openMSE(),t._isMseInit&&t._onTimeUpdate()})),mK(bK(t),"_updateDrmConfig",(function(e){var n=bK(t),r=n.config,i=n.mp4;e.kid&&r.keyValue?r.drm={clearKeys:mK({},e.kid,r.keyValue)}:!e.kid&&r.keyValue&&(r.useEME=!1),i.useEME=r.useEME;var o=r.drm;r.useEME||(i.kidValue=r.keyValue||(o&&o.clearKeys?o.clearKeys[Object.keys(o.clearKeys)[0]]:null)),t.eme&&o&&o.clearKeys&&r.useEME&&t.eme.updateDrm(o)})),mK(bK(t),"_onVideoTimeUpdate",(function(){t.useVideoLoad||null!==t._requestTimer||!t._offineLine&&t._startProgress(),t.useVideoLoad&&t.checkIfCanPreload()})),mK(bK(t),"_onBufferedReset",(function(e){t.mp4&&t.mp4.videoTrak&&t.mp4.resetFragmentLoadState(0)})),mK(bK(t),"_onOnlineHandler",(function(){t._offineLine=!1;var e=bK(t).config;t.log("online useVideoLoad:",t.useVideoLoad,t._hasStartProgressBack),t.useVideoLoad?t.player.src=e._mainURL:(t._hasStartProgressBack&&t._startProgress(),t._hasStartProgressBack=!1)})),mK(bK(t),"_onOfflineHandler",(function(){t._offineLine=!0,t.log("offline, ",t._hasStartProgress),t._hasStartProgress&&(t._stopProgress(),t._hasStartProgressBack=!0)})),mK(bK(t),"_loadDataSuccess",(function(e){if(!t.isDestroy&&(t.mse||t.mseProxy)){e.state&&t._firstSegState<0&&(t._firstSegState=1),t.log("[loadFragment] _loadDataSuccess ",JSON.stringify(e.context.range),",dataLen,",e.buffer?e.buffer.byteLength:0,e.state),t.firstFrameTime.startload_stmux<0&&(t.firstFrameTime.startload_stmux=t.mp4.firstFrameTime.startMuxTime,t.firstFrameTime.firstmux=t.mp4.firstFrameTime.firstmux),t.firstFrameTime.loadst_loadeddata<0&&(t.firstFrameTime.loaddata=Yie.nowTime()-t.loadstart);try{e.initSeg&&(t._appendInitSeg(e.initSeg),(!e.buffer||e.buffer.byteLength<1)&&(t.log("no data, must load data"),t._onTimeUpdate()));var n=e.buffer,r=e.state,i=e.context,o=e.videoTrack,a=e.audioTrack;if(t.debugInfo.loadIndx=i?i.fragIndex:-1,t.mse&&r&&(!n||n.byteLength<=0)&&i.fragIndex===t.mp4.timeRange.length-1){var s=t.player.buffered;t.bufferEndTime=s.end(s.length-1),t._isEnded(),t.log("loaded ended !!!==>>>",JSON.stringify(i.range),", fragIndex,",i.fragIndex,", bufferEndTime,",t.bufferEndTime,",meta_duration,",t.mp4.meta.duration)}if(t.mse&&r&&i.fragIndex===t.mp4.timeRange.length-1&&(!n||n.byteLength<=0)){var u=t.player.buffered;t.bufferEndTime=u.end(u.length-1),t._isEnded(),t.log("load ended !!!==>>>",t.playerConfig.vid,JSON.stringify(i.range),", fragIndex,",i.fragIndex,", bufferEndTime,",t.bufferEndTime,",meta_duration,",t.mp4.meta.duration)}if(n&&t.mse){if(n&&n.byteLength>0){t._appendBuffer(fre,n,i,r);var c=t.getDataBitRate(i.fragIndex);t.player.emit("addVideoBufferEnd",{start:Math.floor(i.startPts),end:i.endPts,bandwidth:c.bitrate})}}else if(t.mseProxy&&(o&&o.samples.length>0||a&&a.samples.length>0)){var l=o.samples.length>0?o.samples[0].sampleOffset:-1,d=o.samples.length>0?o.samples[o.samples.length-1].sampleOffset:-1,h=a.samples.length>0?a.samples[0].sampleOffset:-1,f=a.samples.length>0?a.samples[a.samples.length-1].sampleOffset:-1;t.log("[livevideo] appendBuffer,index,",i.fragIndex,",range,",JSON.stringify(e.context.range),",videoIdxRange,",l,"-",d,",audioIdxRange,",h,"-",f,", timeRange,",i.timeRange),t.mseProxy.appendBuffer(o,a)}}catch(kye){t.changeState("APPEND_DATA_ERROR"),t.log("appendBuffer error",kye);var p=new j(t.player,{errorType:"runtime",errorTypeCode:Cie.runtime,errorCode:Zie.mse,vid:t.player.config.vid,errorMessage:kye.message,mediaError:{code:Zie.mse,message:kye.message}});t._errorHandler(p)}}})),mK(bK(t),"_onWaiting",(function(){var e=bK(t),n=e.player,r=e.config,i=e.playerConfig;clearTimeout(t._waitInBufferTimer),t._waitInBufferTimer=null;var o=n.currentTime;console.log("[>>>>onWaiting],currentTime, ",o,Yie.nowTime());var a=n.bufferedPoint;a.end>0&&a.end-n.currentTime>=2&&(t._waitAdjustTimeCnt<r.waitJampBufferMaxCnt?t._waitInBufferTimer=setTimeout((function(){t._waitAdjustTimeCnt++,n.currentTime=n.currentTime+.5,t.log("[waitInBufferTimeout], waitAdjustTimeCnt,",t._waitAdjustTimeCnt,",curtime,",o,Yie.nowTime())}),r.waitingInBufferTimeOut):t._errorHandler(new j(t.player,{errorType:"waitInBuffer",errorTypeCode:Cie.runtime,errorCode:Zie.onWaitInBufferRange,errorMessage:"onWait_in_buffer",vid:i.vid})))})),mK(bK(t),"_onEnded",(function(){t.log("[player.onEnded], stopProgress"),t.player&&t.off("waiting",t._onWaiting),t._stopProgress()})),mK(bK(t),"_onReplay",(function(){var e=bK(t),n=e.playerConfig,r=e.player;t._reset(),t._init(n.url).then((function(e){var n=e[0],i=e[1];r.video.src=i.url,t._startProgress(),t.mp4=n,t.mse=i,t.log("_replay play"),t.once("canplay",(function(){r.play(),t.on("waiting",t._onWaiting)}))}),(function(e){t.log("_errorHandler6",e),t._errorHandler(e)}))})),mK(bK(t),"_onSeeking",dK(uK().mark((function e(){var n,r,i,o,a,s,u,c,l,d,h;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.useVideoLoad){e.next=2;break}return e.abrupt("return");case 2:if(n=bK(t),r=n.player,i=n.mp4,o=r.currentTime,t.changeState("seeking",{curTime:o}),t.log("[seekTime], curTime,",o,",buffer,",r.buffered2.bufferedList),i&&i.meta){e.next=8;break}return e.abrupt("return");case 8:if(t.endofstream=!1,i.bufferLoadedPos=-1,i._metaLoading=!1,a=r.bufferedPoint,s=!1,u=0,!(a.end>0)){e.next=23;break}if(s=!0,u=i.getFragmentIdx(a.end),t._curLoadSegmentIdx!==u){e.next=20;break}return t.log("[seeking in buffered range], seek fragIndex is current load segmentIdx",u),e.abrupt("return");case 20:i.seekTime=a.end,u<0&&(u=t._curLoadSegmentIdx),t.log("[seeking in buffered range], seekTime ",o,",bufferRange,",a.start,"-",a.end,", fragIndex,",u);case 23:return s||(i.seekTime=o,(u=i.getFragmentIdx(o))<0&&(u=t._curLoadSegmentIdx),t.log("[seekTime out buffer range], curTime,",o,", Idx,",u),c=bK(t),(l=c.mse)&&l.isFull()&&(d=r.buffered2.bufferedList,h=d[d.length-1],l.clearOpqueues(fre),t._checkRemoveSourceBuffer([h.start,h.end],r.currentTime,!0,!0))),e.next=26,i.cancelLoading();case 26:i.resetFragmentLoadState(u),t._curLoadSegmentIdx=u,t._onTimeUpdate(),t._isEnded();case 30:case"end":return e.stop()}}),e)})))),t._pendingPromises=[],t._allInitPromise=new ese,t._isInit=!1,t._isEventInit=!1,t.playerId=t.player._pluginInfoId,t.preloader=null,t.gapJumpInst=null,t.log("playerId",t.playerId),t._tickInSeconds=t.config.tickInSeconds,t.awManager=null,t._useVideoLoad=!1,t.mse=null,t.mp4=null,t.eme=null,t._isMseInit=!1,t._awPromise=null,t._corePromise=null,t._initPromise=null,t._hasStartProgress=!1,t._hasStartProgressBack=!1,t._maxBufferLength=t.config.maxBufferLength,t._minBufferLength=t.config.minBufferLength,t._switchBitRateWay=t.config.switchBitRateWay,t._curLoadSegmentIdx=0,t._abrService=null,t._checkRemoveBufferLastTime=Yie.nowTime(),t.playFlag=!1,t.config.resumePlayWaterLevel=Math.min(t.config.minBufferLength,t.config.resumePlayWaterLevel),t.checkResumePlayTimer=null,t.loadstart=-1,t._loadStartEventTime=-1,t._waitAdjustTimeCnt=0,t._waitInBufferTimer=null,t._firstSegState=-1,t.codecType=t.playerConfig.codecType?t.playerConfig.codecType.toLowerCase():yye,t.playerConfig.vtype&&(t._vtype=t.playerConfig.vtype.toUpperCase()),t.firstFrameTime={newplayer:Yie.nowTime(),newplayer_initkernel:-1,initkernel_initmp4:-1,initmse_sbopen:-1,mseopen:-1,initmse_sbopendone:-1,metaload:-1,metaready_mseisopen:-1,metaready_initsegend:-1,startload_stmux:-1,firstmux:-1,apcnt:0,aplen:0,data_ap:-1,loadst_loadeddata:-1,loaddata:-1,new_loadeddata:-1,bitrate:-1},t.debugInfo={},t.states=[],t.removeVideo=null,t._lastCheckTime=Yie.nowTime(),t._changeDefState=null,t._defInited=!1,t.states=[],t.preLoadData=null,t.forPreloadTimeCache=null,t._usePaused=!1,t.endofstream=!1,t.bufferEndTime=-1,t.hitpreload=!1,window&&window.location.href.indexOf("playerInstance=true")>-1&&(void 0===window.mp4PlayerInstanceList&&(window.mp4PlayerInstanceList=[]),window.mp4PlayerInstanceList.push(t.player)),t}return pK(i,[{key:"afterCreate",value:function(){var e=this,t=this.playerConfig,n=this.config,r=this.player;n.width=t.width||0,n.height=t.height||0,t.vid=t.vid||n.vid,Are.isSupported('video/mp4; codecs="avc1.64001E, mp4a.40.5"')&&(void 0===n.supportHevc&&null!=F&&F.isHevcSupported&&null!=F&&F.isHevcSupported()&&this.player.video instanceof HTMLVideoElement&&(n.supportHevc=!0),Jce()||(n.useEME=!1),this.checkConfig(),n.onlyInit&&(t.autoplay=!1,t.videoInit=!1,this._hasStartProgress=!1,this._hasStartProgressBack=!1),t.useWaterLevel&&(!t.userGestureEventMiddleware&&(t.userGestureEventMiddleware=rse),!t.videoEventMiddleware&&r.setEventsMiddleware(ise)),this.gapJumpInst=new Mde(this.player,this.playerConfig),this.preloader=n.isOpenPreload?new Zde(this.config,this,this.bitRateAdapter):null,r.preloader=this.preloader,this._proxyPlayer(),this.initAwManager(),r.useHooks("replay",this._replayHook),r.useHooks("play",this._playHook),r.useHooks("pause",this._pauseHook),r.useHooks("retry",this._retryHook),r.video.addEventListener(Cde.BUFFERED_RESET,this._onBufferedReset),this._bindNetworkStateChange(),this.on("timeupdate",this._onVideoTimeUpdate),this.on("loadeddata",(function(){e.changeState("LOADED_DATA"),e.deleteVideo(),e._firstSegState=2,e._onTimeUpdate(),e._firstFrameTime()})),this.on("loadstart",(function(){e.changeState("LOAD_START"),e._loadStartEventTime=Yie.nowTime(),e.codecType!==vye||e.config.supportHevc||(e._isMseInit=!0,e._onTimeUpdate())})),this.on("xglog",(function(t){if("firstFrame"===t.eventType){var n=e.preLoadData&&e.preLoadData.definition?e.preLoadData.definition:-1;e.codecType===yye?console.log("[xgplayer-encrypt-mp4]>>>>firstFrame ",e.playerConfig.vid,t.fvt,", codectype: ",e.codecType,", hitpreload: ",e.hitpreload,", video: ",e._useVideoLoad,",curPlayBitrate: ",e.player.curDefinition.definition,", preloadBitrate: ",n,",metaLoad, ",e.firstFrameTime.metaload,", mseOpen: ",e.firstFrameTime.mseopen,",appendInit: ",e.firstFrameTime.metaready_initsegend):console.log("[xgplayer-encrypt-mp4]>>>>firstFrame ",e.playerConfig.vid,t.fvt,", codectype: ",e.codecType,", hitpreload: ",e.hitpreload,",curPlayBitrate: ",e.player.curDefinition.definition,", preloadBitrate: ",n,",metaLoad, ",e.firstFrameTime.metaload)}})),r.mp4MseFlag=!0)}},{key:"_startBufferCheck",value:function(){var e=this.player;if(e.video){var t=[];if(e.video.buffered){for(var n=0,r=e.video.buffered.length;n<r;n++)t.push([e.video.buffered.start(n),e.video.buffered.end(n)]);t.toString()!==this.lastBuffer&&(this.lastBuffer=t.toString(),this._onBufferReachThreshold())}}}},{key:"_onBufferReachThreshold",value:function(){var e=this.player,t=this.config;if(e.video){for(var n=e.video.buffered,r=0,i=0,o=0;o<n.length&&(r=n.start(o),i=n.end(o),!(r<=e.video.currentTime&&e.video.currentTime<=i));o++);i-e.video.currentTime>=t.bufferThreshold&&!this._hasTriggerBufferThreshold&&(this._hasTriggerBufferThreshold=!0,e.emit("BUFFER_THRESHOLD",i-e.video.currentTime))}}},{key:"_startUrlExpiredCheck",value:function(){var e=this.player.config;e.definition&&e.definition.list&&e.definition.list.length>0&&(this.urlExpireTimestamp=e.definition.list[0].url_expire||0,this._handleUrlExpire())}},{key:"checkConfig",value:function(){var e=this.playerConfig,t=this.config,n=e.defaultDefinition,r=e.defaultBitrate;if(!n){var i=this.playerConfig.definition;n=i&&i.defaultDefinition?i.defaultDefinition:t.definition}!r&&t.bitrate&&(r=t.bitrate),e.defaultDefinition=n,e.defaultBitrate=r}},{key:"beforePlayerInit",value:function(){var e=this.player,t=this;this._isInit||(ne.defineGetterOrSetter(e,{__url:{get:function(){return t.mse?t.mse.url:e.config.url},configurable:!0},downloadSpeed:{get:function(){return gye/8},configurable:!0},playerVersion:{get:function(){return Rie},configurable:!0},menuCodeType:{get:function(){return t.mp4&&t.mp4.meta?t.mp4.meta.videoCodec:"avc"},configurable:!0},playerType:{get:function(){return"MP4"},configurable:!0},supportMenus:{get:function(){return{speed:e.mp4MseFlag,cdn:e.mp4MseFlag,resolution:e.mp4MseFlag}},configurable:!0},CDNUrl:{get:function(){return t.CDNUrl},configurable:!0},abrInstance:{get:function(){return t.abrInstance},configurable:!0},ext:{get:function(){var e,n,r,i,o,a,s=[];if(null!==(e=t.player)&&void 0!==e&&null!==(n=e.video)&&void 0!==n&&n.buffered)for(var u=t.player.video.buffered,c=0,l=u.length;c<l;c++)s.push([u.start(c),u.end(c)]);var d=[];if(t.mse)for(var h=Math.min(t.opQueueLen,5),f=0;f<h;f++)d.push(t.mse.opQueues.video[f].context);return{type:"MP4",usevideo:t.useVideoLoad,duration:null===(r=t.mp4)||void 0===r||null===(i=r.meta)||void 0===i?void 0:i.duration,loadseg:{loadIdx:t._curLoadSegmentIdx,loadTimeRange:null!==(o=t.mp4)&&void 0!==o&&o.timeRange?t.mp4.timeRange[t._curLoadSegmentIdx]:{},waitIdx:t.debugInfo.loadIndx,waitTimeRange:null!==(a=t.mp4)&&void 0!==a&&a.timeRange&&void 0!==t.debugInfo.loadIndx?t.mp4.timeRange[t.debugInfo.loadIndx]:{}},bufffer:s,speed:t.debugInfo.speed,states:t.states,mseque:d,url:t.playerConfig.url}},configurable:!0}}),this._isInit=!0)}},{key:"destroy",value:function(){var e=this.player;console.log("[Index] destroy",this.playerId),this.preloader&&this.preloader.destroy(this.playerId),e.preloader=null,e.removeHooks("replay",this._replayHook),e.removeHooks("play",this._playHook),e.removeHooks("pause",this._pauseHook),e.removeHooks("retry",this._retryHook),this._reset(),this._onDestroyWasm(),this.player.playNext=hye,this.player._startInit=fye,this.player.changeDefinition=pye,this.player.switchURL=mye,this._unbindNetworkStateChange(),e.video&&e.video.removeEventListener(Cde.BUFFERED_RESET,this._onBufferedReset),this._bufferCheckTimer&&clearInterval(this._bufferCheckTimer),this._removeBufferTimer&&(clearTimeout(this._removeBufferTimer),this._removeBufferTimer=null)}},{key:"initAwManager",value:function(){var e=this,t=this.config;this.awManager||(this.awManager=new Kse(t.cdnHost,t.cdnBucket));var n=new ese;if(n.id="aw",this._awPromise=n,t.isEncrypt){var r=new ase;r.push(this.awManager.init()),r.startup().then((function(){r.destroy(),n.resolve()})).catch((function(t){r.destroy(),e._emitInitFail(t),n.reject()}))}else n.resolve()}},{key:"_proxyPlayer",value:function(){var e=this;"function"==typeof this.player.playNext&&(hye=this.player.playNext),this.player.playNext=function(){e.playNext.apply(e,arguments)},fye=this.player._startInit,mye=this.player.switchURL,pye=this.player.changeDefinition,this.player._startInit=this.playerStartInit.bind(this),this.player.switchURL=this.switchURL.bind(this),this.player.changeDefinition=this.changeDefinition.bind(this)}},{key:"getInitBitrate",value:function(){var e=this,t=this.player,n=this.config,r=this.playerConfig,i=null,o=t.definitionList;return o&&o.length>0&&(o.map((function(t){var n=Zde.generateUniqueKey({vid:r.vid,definition:t.definition||"",vtype:r.vtype,codecType:r.codecType});t.cacheKey=n,n&&!i&&e.preloader&&e.preloader.hasItemSameVid(n)&&((i=t).type="preload")})),i&&r.userSelectDefinition&&n.focusUserDefinition&&(console.log("[Index] getInitBitrate","preloadDefinition: ".concat(i.definition," userSelectDefinition:").concat(r.userSelectDefinition)),r.userSelectDefinition!==i.definition&&(i=null)),!i&&this.bitRateAdapter&&(this.bitRateAdapter.speed=qae.speed,(i=this.getDefinitonFromAdapter(o,r.userSelectDefinition))&&(i.type="bitRateAdapter"))),i&&i.url||(i="Array"===W.typeOf(r.url)&&r.url.length>0||"String"===W.typeOf(r.url)&&r.url?{url:r.url,definition:r.defaultDefinition,duration:r.duration||this.config.duration||0,bitrate:r.defaultBitrate||this._getBitrateByDefition(r.defaultDefinition),type:"default"}:o[o.length-1]),this.playerConfig.url=i.url,i.networkSpeed=qae.speed,i.fileSize=Yie.getFileSize(i.bitrate,r.duration),t.curDefinition=i,i}},{key:"_setPlayerSrc",value:function(e){var t=this.player;this._removeVideoSource(),"Array"===W.typeOf(e)?(t.video.removeAttribute("src"),!t._detachSourceEvents&&e.forEach((function(e){t.video.appendChild(W.createDom("source","",{src:"".concat(e.src),type:"".concat(e.type||"")}))})),t._attachSourceEvents(t.video,e),t.play()):(t.video.src=e,t.play()),t.mp4MseFlag=!1,t.emit("playertypechange")}},{key:"_removeVideoSource",value:function(e){var t=this.player,n=(e=e||t.video).children;if(n.length>0)for(t._detachSourceEvents(e);n.length>0;)e.removeChild(n[0])}},{key:"_getBitrateByDefition",value:function(e){var t=this.playerConfig,n=0;if(!t.definition||!t.definition.list)return n;for(var r=0;r<t.definition.list.length;r++){var i=t.definition.list[r];i.definition===e&&(n=i.bitrate)}return n}},{key:"_getDefinitionItem",value:function(e){for(var t=this.playerConfig,n=0;n<t.definition.list.length;n++){var r=t.definition.list[n];if(r.definition===e)return r}return null}},{key:"_initAbrDefinition",value:function(){var e=this.player,t=this.playerConfig;if(t.definition.list.length>0&&(e.curDefinition||(e.curDefinition=t.definition.list[0]),e.curDefinition.vwidth||Object.assign(e.curDefinition,this._getDefinitionItem(e.curDefinition.definition)),this._abrService.updateAbrCacheData()),this._abrService&&this._abrService.isCurrentAutoDefi){var n=t.definition.list.length;e.curDefinition=t.definition.list[n-1]}for(var r=0;r<t.definition.list.length;r++){var i=t.definition.list[r];e.curDefinition.definition===i.definition?i.selected=!0:i.selected=!1}console.log("resourceReady",t.definition.list.concat()),this.player.emit("resourceReady",t.definition.list);var o=e.curDefinition.bitrate;if(!o)for(var a=0;a<t.definition.list.length;a++){var s=t.definition.list[a];s.definition===e.curDefinition.definition&&(o=s.bitrate)}this._abrService.updateBitrate(o)}},{key:"_initAbrService",value:(n=dK(uK().mark((function e(){var t,n;return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.playerConfig,(n=this.config).autoBitrateOpts&&n.autoBitrateOpts.isOpenAutoDefi){e.next=3;break}return e.abrupt("return");case 3:return this._abrService=new lye(this,this.abrSwitchURL),e.next=6,this._abrService.init({video:t.definition.list.concat()});case 6:this._initAbrDefinition();case 7:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"_initMp4Kernel",value:function(){var e=this;this.firstFrameTime.newplayer_initkernel=Yie.nowTime()-this.firstFrameTime.newplayer,this.log("[===========], initMp4Kernel,",Yie.nowTime());var t=this.playerConfig,n=this.config,r=new ese;try{var i=this._defInited?null:this.getInitBitrate();if(this._defInited=!0,this.log("curDefinition",i),this.log("[_initMp4Kernel] ".concat(t.vid," curDefinition"),i),!this._handlerUrl(t.url))return r.reject(new Error("emptyUrl")),r;if(n.forceVideoPlay&&(this.codecType===yye||n.supportHevc))return this.useVideoLoad=!0,r.reject("forceVideoPlay"),r;var o=[];o.push(this._getLicense()),o.push(this._checkPreloader()),Promise.all(o).then((function(t){e.isDestroy&&r.reject(new Error("destroy"));var o=null;if(t&&t.length>0&&t[1]&&(o=t[1].data),o||!n.needPreloadCheck||e.codecType===vye&&!n.supportHevc)if(e._vtype&&"MP3"===e._vtype)e.useVideoLoad=!0,r.reject(new Error("vtype_not_MP4"));else{var a=n._mainURL;e._initMp4(a,o,{fileSize:i?i.fileSize:0}),e._initAbrService()}else e.useVideoLoad=!0,r.reject(new Error("no_preload"))})).catch((function(t){console.error(t),t.errorType="GET_LICENSE_ERROR",e.emit("error",t),e.changeState("LICENSE_ERROR",{d:i?i.definition:0}),r.reject(t)}))}catch(kye){r.reject(kye)}return r}},{key:"playerStartInit",value:function(e){var t=this;if(this.log("playerStartInit",this.player.hasStart),!this.isDestroy){if(!e||"__auto__"===e||"anytext"===e){var n=this.playerConfig,r=n.definition;if(r&&r.list&&r.list.length>0&&r.defaultDefinition&&(r.list.map((function(e){e.definition===r.defaultDefinition&&(n.url=e.url,t.player.curDefinition=e)})),!n.url||"__auto__"===e||"anytext"===e)){var i=r.list[0];e=i.url,n.url=i.url,this.player.curDefinition=i}}if(this.useVideoLoad)fye.call(this.player,e);else{this.player.mp4MseFlag=!0,this.bufferEndTime=-1,this._tm=(new Date).getTime(),this._reset();var o=this.playerConfig.vid;this.preloader&&this.preloader.cancelPreloadByVid(o),this.changeState("PLAYER_START_INIT"),this._awPromise.then((function(){if(!t.isDestroy){t.changeState("AW_OK INIT_MP4_KERNEL");var n=t._initMp4Kernel();t._initPromise=n,t._addPendingPromise(t._initPromise),n.then((function(n){t.isDestroy||(t.log("[Index] _initMp4Kernel.then vid:".concat(o," isDestroy").concat(t.isDestroy),n,t.mse?t.mse.url:""),t.mse&&(e=t.mse.url),t.changeState("PLAY_INIT_OK"),t._bindEvents(),t._startProgress())})).catch((function(n){var r=!!t._initPromise&&t._initPromise.isBreak;if(!t.isDestroy&&!r)if(console.error("_initMp4Kernel.catch: ".concat(o," isDestroy:").concat(t.isDestroy," _initPromise.isBreak:").concat(r),n),-499897!==n.errorCode){var i=n;i.errorCode||((i=new j(t.player,{errorType:"runtime",errorTypeCode:Cie.runtime,errorCode:Zie.other,vid:t.playerConfig.vid,errorMessage:null==n?void 0:n.message,mediaError:{code:Zie.other,message:null==n?void 0:n.message}})).url=e),t.changeState("PLAY_INIT_CATCH",{c:i.errorCode,m:i.message}),t.player.vtype="MP4_1",t.player.emit("playCatch",t.player.vtype,i)}else t._emitExpireEvent(n)})).finally((function(){if(t._initPromise){var n=t._initPromise.isBreak;t._initPromise&&t._removePendingPromise(t._initPromise),t._initPromise=null,t._usePaused&&(t.playerConfig.autoplay=!1),t.codecType===vye&&"Array"===W.typeOf(e)&&(e=e[0].src),t.log("_initMp4Kernel.finally:isDestroy".concat(t.isDestroy," _initPromise.isBreak:").concat(n)),t.log("[===========], playerStartInit,",Yie.nowTime()),t.changeState("PLAY_INIT_FINALLY"),!t.isDestroy&&!n&&fye.call(t.player,e)}}))}})).catch((function(n){t.log("_awPromise.error",n),t.changeState("PLAY_INIT_CATCH"),!t.isDestroy&&fye.call(t.player,e)})),this._abrService&&this._abrService.isCurrentInAbr()&&(this._abrService.enable(),this._abrService.execute())}}}},{key:"playNext",value:function(e){var t=this.player;this._defInited=!1,t.resetState(),t._currentTime=0,t._duration=0,t.isPlaying=!1,this._useVideoLoad=!1,t.pause(),this._reset(),e.vtype&&(this._vtype=e.vtype.toUpperCase()),t.setConfig(e);var n=this.codecType;this.codecType=e.codecType?e.codecType.toLowerCase():yye;var r=e[this.pluginName];r&&(this.config=Object.assign(this.config,r)),n!==this.codecType&&this.h265_h264_switch(this.playerConfig.mediaType||"video"),this.checkConfig(),this.initAwManager(),this.log("[Index] playNext",e),t.play(),this.emit("playnext")}},{key:"h265_h264_switch",value:function(e){this.log("h265_switch_h264");var t=this.player,n=W.createDom(e,"",this.getVideoConfig(this.playerConfig),"xgplayer-".concat(e,"-img"));this.removeVideo=t.video,n.muted=t.video.muted,n.volume=t.video.volume,t.video=n,t.attachVideoEvents(t.video)}},{key:"getVideoConfig",value:function(e){var t=Object.assign({},{controls:!1,autoplay:e.autoplay,playsinline:e.playsinline,"x5-playsinline":e.playsinline,"webkit-playsinline":e.playsinline,"x5-video-player-fullscreen":e["x5-video-player-fullscreen"]||e.x5VideoPlayerFullscreen,"x5-video-orientation":e["x5-video-orientation"]||e.x5VideoOrientation,airplay:e.airplay,"webkit-airplay":e.airplay,tabindex:2,mediaType:e.mediaType||"video"},e.videoConfig,e.videoAttributes);return e.loop&&(t.loop="loop"),t}},{key:"next",value:function(e){this.playNext(e)}},{key:"oldChangeDefinition",value:function(e,t){var n=this,r=this.config,i=this.player,o=this.playerConfig;i.emit(z,{from:t,to:e}),i.emit("waiting");var a=i.definitionList.filter((function(t){return t.definition===e.definition||t.definition===Number(e.definition)})),s=i.definitionList.filter((function(e){return e.definition===t.definition||e.definition===Number(t.definition)}));if(s.length>0&&(s[0].selected=!1),a.length>0){(e=a[0]).selected=!0,i.curDefinition=e,this.log("[oldChangeDefinition],currentTime,",i.currentTime,",from,",t,",to,",e);var u=i.currentTime,c=i.paused;this._changeDefState||(this._changeDefState={currentTime:u,paused:c},this.log("[oldChangeDefinition],currentTime,",i.currentTime,",pause,",c)),r.definition=e.definition,this.config.keyValue=e.keyValue,this.config.kid=e.kid,this.config.secretKey=e.secretKey,this.config.drm=e.drm,this.config.getLicenseUrl=e.getLicenseUrl,o.url=e.url,o.backupURL=e.backupURL,o.userSelectDefinition=e.definition,o.defaultDefinition=e.definition,r.focusUserDefinition=!0,i.currentTime=0,i.pause(),this._reset(),this._isMseInit=!1,this.eme=null,this._handlerUrl(e.url),this._changeDefineCanPlay&&i.off("canplay",this._changeDefineCanPlay),this._changeDefineCanPlay=function(){n.changeDefineCanPlay(u,c,t,e),n._changeDefineCanPlay=null},i.once("canplay",this._changeDefineCanPlay),this.player.video.load(),this.playerStartInit(o.url)}}},{key:"switchURL",value:function(e){if(this.useVideoLoad)mye.call(this.player,e);else{var t=this.player,n=this.playerConfig;this.config.keyValue=e.keyValue,n.url=e.url,n.backupURL=e.backupURL,t.currentTime=0,t.pause(),this.reset(),this._isMseInit=!1,this.eme=null,this._handlerUrl(e.url),t.video.removeAttribute("src"),this._removeVideoSource(),t.resetState()}}},{key:"_handlerUrl",value:function(e){var t,n=this.config,r=this.playerConfig;if(!e)return!1;var i=[];if("String"===W.typeOf(e))t=e,r.backupURL&&i.push(r.backupURL);else if("Array"===W.typeOf(e)&&e.length>0&&(t=e[0].src,e.length>1))for(var o=1;o<e.length;o++)i.push(Yie.extUrl(e[o].src,{__vid:r.vid}));return!(!t&&0===i.length)&&(n._mainURL=Yie.extUrl(t,{__vid:r.vid}),n._backupURL=i,!0)}},{key:"_firstFrameTime",value:function(){if(this.codecType===yye||this.config.supportHevc){if(this.firstFrameTime.new_loadeddata<0){this.firstFrameTime.loadst_loadeddata=Yie.nowTime()-this.loadstart,this.firstFrameTime.new_loadeddata=Yie.nowTime()-this.firstFrameTime.newplayer;var e={};for(var t in this.firstFrameTime)Object.prototype.hasOwnProperty.call(this.firstFrameTime,t)&&(this.log("======this.firstFrameTime======",t,", ",this.firstFrameTime[t]),e[t]=this.firstFrameTime[t])}}else if(this.codecType===vye){var n=this.player.video.getStats(),r=this.firstFrameTime.metaload,i=this.firstFrameTime.startMuxTime;this.firstFrameTime=n,this.firstFrameTime.metaload=r,this.firstFrameTime.startload_stmux=i,this.firstFrameTime.firstmux=this.mp4?this.mp4.firstFrameTime.firstmux:-1;for(var o=0;o<n.bootStats.length;o++)this.firstFrameTime[n.bootStats[o].action]=n.bootStats[o].dot;delete this.firstFrameTime.bootStats,this.log("======this.firstFrameTime===>>",JSON.stringify(this.firstFrameTime))}}},{key:"_bindEvents",value:function(){var e=this,t=this.config,n=this.player;this._isEventInit||(this.on("seeking",this._onSeeking),this.on("waiting",this._onWaiting),this.on("ended",this._onEnded),this.on("error",this._onVideoError),this.on("playing",this._onPlaying),this.on("detectGap",(function(){t.gapDegrade&&t.useEME&&(t.useEME=!1,e._replay())})),this.on("error",(function(t){e.changeState("video_error",{code:t.code,message:t.message,videoType:e.useVideoLoad})})),n.setEventsMiddleware({error:function(t,n){var r=t.originalEvent;e.changeState("video_error",{code:r.code,message:r.message,videoType:e.useVideoLoad}),e.log("error middleware",t,",useVideoLoad,",e.useVideoLoad),e.useVideoLoad&&n(t.eventName,r)}})),this._isEventInit=!0}},{key:"deleteVideo",value:function(){if(this.removeVideo){var e=this.removeVideo.parentNode;e&&e.removeChild(this.removeVideo),this.removeVideo=null,this.log("[_removeVideoSource]")}}},{key:"_unbindEvents",value:function(){this.off("seeking",this._onSeeking),this.off("waiting",this._onWaiting),this.off("ended",this._onEnded),this.off("playing",this._onPlaying),this._isEventInit=!1}},{key:"changeState",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._pTime||(this._pTime=Yie.nowTime());var n=Yie.nowTime()-this._pTime,r=Yie.nowTime()-this._sTime;this.log(">>>changeState[".concat(e,"]"),n,r,t),this.states.push({state:e,t1:n,t2:r,data:t}),this._pTime=Yie.nowTime();var i=Yie.nowTime()-this._pTime;t.state=e,i&&(t.t=i)}},{key:"checkIfCanPreload",value:function(){var e=this.player,t=this.useVideoLoad,n=this.config;if(n.isOpenPreload){var r=t?5:n.minBufferLength,i=e.currentTime+r;i=i>e.duration?e.duration:i;var o=(t?e.getBufferedRange(e.buffered):e.getBufferedRange(e.buffered2))[1]-i;e.currentTime>=r&&(o>0||Math.abs(o)<1)&&this.preloader&&this.preloader.checkCanPreloadNext()&&this.emit("PRELOAD_NEXT")}}},{key:"_getLicense",value:function(){var e=this,t=this.config,n=t.vid,r=t.kid,i=t.secretKey,o=new ese,a={method:"getLicense",success:0};if(r||i){var s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=new ese;if(n){hae("[getKeyValue]>before openBox");var o=r.awManager.openBox(n);if(hae("[getKeyValue]>after openBox: ",o),t){var a={clearKeys:{}};a.clearKeys[t]=o,i.resolve(a)}else i.resolve(o)}else{var s=nse(e,t,r.config.getLicenseUrl);s.id="requestPromise",r._addPendingPromise(s),s.then((function(e){if(r._removePendingPromise(s),r.awManager){hae("[getKeyValue]>before openBox");var n=r.awManager.openBox(e);hae("[getKeyValue]>after openBox: ",n);var o={clearKeys:{}};o.clearKeys[t]=n,i.resolve(o)}else i.reject({errDes:"awManager not exist, player destroyed"}),hae("[getKeyValue]>awManager not exist, player destroyed")})).catch((function(e){i.reject(e),hae("[getKeyValue]>requestPromise reject")}))}return i}(n,r,i,this);s.id="licensePromise",this._addPendingPromise(s),s.then((function(t){e._removePendingPromise(s),t.clearKeys?e.config.drm=t:e.config.keyValue=t,a.success=1,o.resolve(a)})).catch((function(t){e.log("licensePromise reject"),a.success=0,a.error=t,o.reject(a)}))}else a.success=0,o.resolve(a);return o}},{key:"softDecode",get:function(){var e,t;return"xg-video"===(null===(e=this.player)||void 0===e||null===(t=e.config)||void 0===t?void 0:t.mediaType)}},{key:"_initH265MseProxy",value:function(){this.player.video instanceof HTMLVideoElement&&this.h265_h264_switch(this.playerConfig.mediaType);var e=this.player.video;this.softDecode&&e.setPlayMode&&e.setPlayMode("VOD"),this.mseProxy=e,this.softDecode&&(this.player.forceDegradeToVideo=function(){},this.player.video.addEventListener("lowdecode",this._lowDecoder),this.player.video.addEventListener("error",this._onError))}},{key:"removeAndRejectInitPromise",value:function(e){this._initPromise&&(this._removePendingPromise(this._initPromise),this._initPromise.reject(e))}},{key:"_initMp4",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.firstFrameTime.initkernel_initmp4=Yie.nowTime()-this.firstFrameTime.newplayer-this.firstFrameTime.newplayer_initkernel;var i=this.config,o=this.player,a=this.playerConfig;this.mp4&&(this.mp4.off(Hae,this._onMp4MetaReady),this.mp4.off(jae,this._onMp4Error),this.mp4.off(zae,this._updateDrmConfig),this.mp4.off(Jae,this._onMp4Progress),this.mp4.off(Bae,this._onMp4DataCallBack),this.mp4.destroy(),this.mp4=null),this.changeState("MP4_NEW",{}),this.mp4=new qae(e,o.curDefinition.bitrate,{segmentDuration:i.segmentMinDuration,enableWorker:i.enableWorker,codecType:this.codecType,chunkSize:i.preloadSize,loadSize:800,duration:a.duration||0,fileSize:r.fileSize||0,playerId:this.playerId,vid:a.vid,useUrlRange:i.useUrlRange,retryCount:i.retryCount,retryDelay:i.retryDelay,onProcessMinLen:i.onProcessMinLen,supportHevc:i.supportHevc,reqOptions:i.reqOptions},this,null,n,this.config._backupURL,this.firstFrameTime,""),this.mp4.once(Hae,this._onMp4MetaReady),this.mp4.on(jae,this._onMp4Error),this.mp4.on(zae,this._updateDrmConfig),this.mp4.on(Jae,this._onMp4Progress),this.mp4.on(Bae,this._onMp4DataCallBack),this.mp4.on(Qae,(function(e){t.player&&t.player.emit("initialUrl",{url:e})})),this.mp4.MP4Loader.on(dye,(function(e){gye=e.speed,t.debugInfo.speed||(t.debugInfo.speed=[]),t.debugInfo.speed.push(gye),t.debugInfo.speed.length>10&&t.debugInfo.speed.shift(),t.emit(dye,e)})),this.changeState("MP4_INIT",{}),this.mp4.init(n)}},{key:"_checkPreloader",value:function(){var e=this,t=this.playerConfig,n=new ese,r={method:"checkPreloader",success:0,type:"error",cacheKey:""};this.changeState("CHECK_PRELOAD");var i=this.player.curDefinition,o=i.cacheKey?i.cacheKey:Zde.generateUniqueKey({vid:t.vid,definition:i.definition||"",vtype:t.vtype,codecType:t.codecType});return r.cacheKey=o,this.preloader&&o?this.preloader.getPreLoadData(o).then((function(t){console.log(">>>>check Preloader result",o,t),t?(e.preLoadData=t,e.emit("PRELOAD_INFO",e.preLoadData),r.success=1,r.data=t,e.changeState("PRELOAD_OK",{l:e.preLoadData.byteLength,ck:o}),t.mediaSegList&&t.mediaSegList.length>0||t.buffer&&t.buffer.byteLength>0?e.hitpreload=!0:e.hitpreload=!1,n.resolve(r)):(e.preLoadData=null,e.changeState("PRELOAD_ERROR",{t:0}),r.success=0,r.error=new Error("none_preload"),n.resolve(r))})):(this.changeState("PRELOAD_ERROR",{t:2}),r.success=0,r.error=new Error("no_preloader"),n.resolve(r)),n}},{key:"_initEME",value:function(e,t){var n=this.player,r=this.config,i=e.checkCodecH265();r.useEME=!(!1===r.useEME||i),this._updateDrmConfig(t),this.log("config.useEME: ",r.useEME);var o=r.drm;!this.eme&&o&&o.clearKeys&&r.useEME&&(this.eme=new ose(o)),r.useEME&&this.eme&&(this.eme.setOptions('video/mp4; codecs="avc1.64001E"','audio/mp4; codecs="mp4a.40.2"'),this.eme.SetupEME(n.video))}},{key:"_initMse",value:function(e){var t=this,n=this.playerConfig;this.mse&&(this.mse.destroy(),this.mse=null);var r=this.mp4&&this.mp4.checkCodecH265(),i=!!e.videoCodec,o=!!e.audioCodec,a=mK({},fre,{mimeType:"video/mp4",codec:i&&o?r?'video/mp4; codecs="hev1.1.6.L93.B0, mp4a.40.5"':'video/mp4; codecs="avc1.64001E, mp4a.40.5"':i?r?'video/mp4; codecs="hev1.1.6.L93.B0"':'video/mp4; codecs="avc1.64001E"':'video/mp4; codecs="mp4a.40.5"'});this.mse=new Are(n.mediaType,this.log.bind(this)),this.mse.on(gre,(function(e){t.firstFrameTime.initmse_sbopen=e.costtime,t._loadStartEventTime>0&&(t.firstFrameTime.mseopen=Yie.nowTime()-t._loadStartEventTime),t.changeState("MSE_OPEN")})),this.mse.on(bre,(function(e){t.firstFrameTime.initmse_sbopendone=e.costtime,t.changeState("MSE_OPEN_DONE"),t._isMseInit=!0,t._onTimeUpdate()})),this.mse.on(yre,(function(e){if(console.log("[MSE error]",e),e&&t.mse&&t.mse.isFull()){var r=t.player.getBufferedRange(t.player.buffered2);t._checkRemoveSourceBuffer(r,t.player.currentTime,!0)}else{var i=new j(t.player,{errorType:"runtime",errorTypeCode:Cie.runtime,errorCode:Zie.mseAppend,errorMessage:e.message,vid:n.vid,mediaError:{code:Zie.mseAppend,message:e.message}});t._errorHandler(i)}})),this.mse.on(vre,(function(e){var n=e.context,r=e.costtime;if(n&&n.isinit)t.firstFrameTime.metaready_initsegend=r,t.log("player appendBuffer end ==>>>",n||null,", costTime,",r),t.changeState("MSE_INITSEG_OK");else if(t.log("player appendBuffer end ==>>>",n||null,", costTime,",r,", opt,",e.name,",bufferRange,",t.player.getBufferedRange()),t.firstFrameTime.loadst_loadeddata<0&&(t._firstSegState<0&&t._onTimeUpdate(),t.firstFrameTime.apcnt++,t.firstFrameTime.aplen+=n?n.dataLen:0,t.firstFrameTime.data_ap+=r,t.changeState("APPEND_DATA_OK",{costime:r,dataLen:n?n.dataLen:0})),t.mse&&n.state&&n.fragIndex===t.mp4.timeRange.length-1){var i=t.player.buffered;t.bufferEndTime=i.end(i.length-1),t._isEnded(),t.log("loaded ended !!!==>>>",n.range,", fragIndex,",n.fragIndex,", bufferEndTime,",t.bufferEndTime,",meta_duration,",t.mp4.meta.duration)}})),this.changeState("MSE_INIT"),this.mse.init(a)}},{key:"_appendInitSeg",value:function(e){this.mp4&&this.mse&&(this.changeState("MSE_INITSEG"),this.log("[=======ready_append_init]",Yie.nowTime(),",mseDone,",!!this.mse&&this.mse.ready,",isopen,",!!this.mse&&this.mse.isMediaSourceOpen()),!this.mse.ready&&this.openMSE(),this.firstFrameTime.metaready_mseisopen=this.mse&&this.mse.ready?1:0,this.mse.appendBuffer(fre,e,{vid:this.playerConfig.vid,range:null,dataLen:e.byteLength,isinit:!0}),this.mp4.useEME&&this.eme&&this.eme.emit("encrypted"))}},{key:"_checkMetaInfo",value:function(e){var t=null;return e?null:(t={errorCode:Zie.metaError,errorMessage:"meta is null",errorType:"demux",errorTypeCode:Cie.demux},new j(this.player,sK(sK({},t),{},{vid:this.playerConfig.vid,mediaError:{code:t.errorCode,message:t.errorMessage}})))}},{key:"_stopProgress",value:function(){this._hasStartProgress=!1,this._requestTimer&&(this._requestTimer.stop(),this._requestTimer=null),this._bufferBreakTimer&&(clearTimeout(this._bufferBreakTimer),this._bufferBreakTimer=null,this._bufferBreakFlag=void 0)}},{key:"_bindNetworkStateChange",value:function(){window.addEventListener("online",this._onOnlineHandler),window.addEventListener("offline",this._onOfflineHandler)}},{key:"_unbindNetworkStateChange",value:function(){window.removeEventListener("online",this._onOnlineHandler),window.removeEventListener("offline",this._onOfflineHandler)}},{key:"_onSuperStart",value:function(e){var t=this,n=this.player;hae("_onSuperStart:".concat(e),this.mse),n.video.src=e,this.once("canplay",(function(){n.play(),t.on("waiting",t._onWaiting)}))}},{key:"openMSE",value:function(){var e=this.mse;!e.ready&&e.isMediaSourceOpen()&&(this.log("[=======主动调用_onSourceOpen start]",Yie.nowTime()),e._onSourceOpen(),this.log("[=======主动调用_onSourceOpen, end ]",Yie.nowTime(),"mseDone,",e.ready))}},{key:"_appendBuffer",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0,i=this.mse,o=this.playerConfig.vid;this.log("player appendBuffer start ==>>>",o,n.range,t.byteLength,", queueLen,",i&&i.opQueues[e]?i.opQueues[e].length:null),i.ready||(this.openMSE(),this.firstFrameTime.metaready_mseisopen=this.mse&&this.mse.ready?2:-1),i.appendBuffer(e,t,{vid:o,fragIndex:n.fragIndex,range:n.range,dataLen:t.byteLength,state:r})}},{key:"_loadData",value:(t=dK(uK().mark((function e(){return uK().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.onLine){e.next=2;break}return e.abrupt("return");case 2:if(this.mp4&&this._isMseInit){e.next=5;break}return this.log("loadData, player.mp4 null",this._isMseInit),e.abrupt("return");case 5:return this.loadstart<0&&(this.loadstart=Yie.nowTime()),e.prev=6,e.next=9,this.mp4.load(this._curLoadSegmentIdx,this._loadDataSuccess);case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(6),console.error("[Index] _loadData error",this.playerConfig.vid,e.t0);case 14:case"end":return e.stop()}}),e,this,[[6,11]])}))),function(){return t.apply(this,arguments)})},{key:"getDataBitRate",value:function(e){var t=this.mp4,n=this.playerConfig;if(!t)return 0;for(var r=t.getDataBitRate(e),i=n.definition.list,o=0,a=0;a<i.length;a++)if(i[a].bitrate===r){o=i[a];break}return o}},{key:"_loadStuckCheck",value:function(){var e=this,t=this.config,n=this.playerConfig,r=this.player;t.disableBufferBreakCheck||(r.currentTime-(this._lastCurrentTime||0)>.1||r.paused?1!==this._bufferBreakFlag&&2!==this._bufferBreakFlag||(this.log("视频没有卡死,重置卡死标记"),this._bufferBreakFlag=0,clearTimeout(this._bufferBreakTimer),this._bufferBreakFlag=null):this._bufferBreakFlag||(this._bufferBreakFlag=1,this.log("卡死计时开始! 持续".concat(1e4,"毫秒则确认卡死")),this._bufferBreakTimer=setTimeout((function(){e.isDestroy||(1===e._bufferBreakFlag&&(e._bufferBreakFlag=2,e.log("确认卡死!!!"),e._errorHandler(new j(e.player,{errorType:"runtime",errorTypeCode:Cie.runtime,errorCode:Zie.waitTimeout,errorMessage:"wait_timeout",vid:n.vid}))),e._bufferBreakTimer=null)}),1e4)),this._lastCurrentTime=r.currentTime)}},{key:"_doubleCheckBuffer",value:function(e){var t=this.player;if(!(e.startTime>t.currentTime))return!0;if(!t.video||!t.video.buffered)return!0;var n=t.video.buffered;if(1===n.length)return!0;for(var r=!1,i=0;i<n.length;i++){var o=n.start(i)-.5,a=n.end(i)+.5;if(o<=e.startTime&&e.endTime<=a){r=!0;break}}return r}},{key:"_onTimeUpdate",value:function(){var e=this,t=this.mse,n=this.mp4,r=this.player;if(this.useVideoLoad)this.checkIfCanPreload();else if(n){var i=n.timeRange;if(i&&!(i.length<1)&&1!==this._firstSegState){var o=r.getBufferedRange(r.buffered2);if((t||this.mseProxy)&&n&&n.canDownload){Yie.nowTime()-this._lastCheckTime>1e3&&(this._lastCheckTime=Yie.nowTime(),this._loadStuckCheck(),this._startUrlExpiredCheck(),this._checkRemoveSourceBuffer(o,r.currentTime));var a=r.paused?r.currentTime+this._minBufferLength:r.currentTime+this._maxBufferLength;o[1]-a<0&&i.every((function(t,n){if(t.downloaded){if(e._doubleCheckBuffer(t))return!0;t.downloaded=!1,t.isLoading=!1,e.log("".concat(n," download state error, no buffer, download again"))}t.startTime-r.currentTime<e._maxBufferLength?(e._curLoadSegmentIdx=n,e.log("[onTimeUpdate],load index==>>>, ",n,",IdxTimeRange, ",t.startTime,"-",t.endTime,",buffEnd, ",o[1],",playCurTime,",r.currentTime,", bufferLen,",o[1]-r.currentTime,",bufferRangeList,",e.player.buffered2?e.player.buffered2.bufferedList:null),e._loadData()):e.log("[onTimeUpdate] not load index==>>>",n,",IdxTimeRange, ",t.startTime,"-",t.endTime,",playCurTime,",r.currentTime,",bufferRangeList,",e.player.buffered2?e.player.buffered2.bufferedList:null)})),this.checkIfCanPreload(),this.playFlag&&!this._hasTriggerBufferThreshold&&this._startBufferCheck(),this._isEnded()}}}}},{key:"_reset",value:function(){for(var e in this.states=[],this.hitpreload=!1,this._sTime=Yie.nowTime(),this._usePaused=!1,this._firstSegState=-1,this.useVideoLoad=!1,this._isMseInit=!1,this.endofstream=!1,this._curLoadSegmentIdx=0,this.preLoadData=null,this.forPreloadTimeCache=null,this.playFlag=!1,this._waitAdjustTimeCnt=0,this._initPromise&&"pending"===this._initPromise.state&&this._initPromise.reject("DESTROYED"),clearTimeout(this.checkResumePlayTimer),this.checkResumePlayTimer=null,this._stopProgress(),this.mp4&&(this.mp4.off(Hae,this._onMp4MetaReady),this.mp4.off(jae,this._onMp4Error),this.mp4.off(zae,this._updateDrmConfig),this.mp4.off(Jae,this._onMp4Progress),this.mp4.off(Bae,this._onMp4DataCallBack),this.mp4.destroy(),this.mp4=null),this.mse&&(this.mse.destroy(),this.mse=null),this.mseProxy&&(this.player.video.removeEventListener("lowdecode",this._onDegrade),this.player.video.removeEventListener("error",this._onError)),this._clearMediaKeys(),this._unloadVideo(),this._cancelPendingPromises(),this._abrService&&(this._abrService.destroy(),this._abrService=null),this.firstFrameTime)Object.prototype.hasOwnProperty.call(this.firstFrameTime,e)&&(this.firstFrameTime[e]="apcnt"===e||"aplen"===e?0:"newplayer"===e?Yie.nowTime():-1);clearTimeout(this._waitInBufferTimer),this._waitInBufferTimer=null,this.loadstart=-1,this._loadStartEventTime=-1,this.startLoadData=-1}},{key:"removeErrorUrls",value:function(e,t,n){return-499897!==e.errorCode&&-499892!==e.errorCode||this._emitExpireEvent(e),n}},{key:"_errorHandler",value:function(e){var t=this.player,n=this.playerConfig,r=this.preLoadData;if(t){if(this.useVideoLoad)return console.log("useVideoLoad final error!!!!, ",n.vid,e),void this.emit("error",e);if("object"!==cK(e)){var i={};i.err=e,e=i}var o=t.paused;e.vid=n.vid,e.preloadHit=r&&r.byteLength>0?1:0,e.preloadCached=r?r.duration:0,e=new j(t,e),this.log("_errorHandle","preState is ".concat(o),e),!e.url&&(e.url=t.src),this.player.vtype="MP4_2",this.player.emit("playCatch",this.player.vtype,e),e.errd&&"object"===cK(e.errd)&&this.mp4&&(e.errd.url=this.mp4.url,e.url=this.mp4.url),e.codectype=this.codecType,this.emit("DATA_REPORT",e),this.mp4&&this.mp4.url&&this.removeErrorUrls(e,this.mp4.url,n.url),this.log("error task cancel"),this.mp4&&this.mp4.cancelLoading(),this._abrService&&this._abrService.disable(),this.mp4&&(this.mp4.canDownload=!1),this.mp4&&this.mp4.bufferCache&&this.mp4.bufferCache.clear(),this._startDegradedPlayback(e)}}},{key:"_startDegradedPlayback",value:function(e){var t=this;this.mp4&&(this.mp4.canDownload=!1);var n=this.player,r=this.playerConfig;this.endofstream=!1,this._currentTime=n.currentTime||0,this.player.pause(),this._reset(),this._replay=null,this.codecType===vye?(console.log("h265 err,degrade use 264 play",r.vid),this._onDegrade(e)):this.codecType===yye&&(this.config.drm?(this.config.drm&&Object.keys(this.config.drm).map((function(n){t.config.drm&&(e[n]=t.config.drm[n])})),console.log("final error !!!!, ",r.vid,e),this.emit("error",e)):(this.useVideoLoad=!0,this._setPlayerSrc(r.url),this.once("canplay",(function(){t._currentTime&&(n.currentTime=t._currentTime),!n.paused&&n.play()}))))}},{key:"_startProgress",value:function(){var e=this;this._hasStartProgress||(this._stopProgress(),this._requestTimer=new qce((function(){e._requestTimer&&e._onTimeUpdate()})),this._requestTimer.tickEvery(this._tickInSeconds),this._hasStartProgress=!0)}},{key:"_unloadVideo",value:function(){var e=this.player;try{this.log("unloadVideo src ".concat(e.video.src)),e.video&&e.video.src&&(e.video.removeAttribute("src"),e.video.load())}catch(Sye){this.log("unloadVideo error",Sye)}}},{key:"_addPendingPromise",value:function(e){this._pendingPromises.push(e)}},{key:"_removePendingPromise",value:function(e){this.log("removePendingPromise",e.id);var t=this._pendingPromises.indexOf(e);t>-1&&this._pendingPromises.splice(t,1)}},{key:"_cancelPendingPromises",value:function(){this._pendingPromises.length>0&&this._pendingPromises.forEach((function(e){e.reject("DESTROYED")})),this._pendingPromises=[]}},{key:"_onMediaExpired",value:function(){this._stopProgress(),this.emit(Cde.MEDIA_EXPIRED)}},{key:"_onDestroyWasm",value:function(){this.awManager&&(this.awManager.destroy(),this.awManager=null)}},{key:"_isEnded",value:function(){var e=this.player,t=this.mp4,n=e.bufferedPoint,r=n?n.end:0;return!this.endofstream&&this.bufferEndTime>0&&this.mse&&this.bufferEndTime-e.currentTime<.5&&(this.log("[check player isEnded],deal mse.endOfStream, currentTime,",e.currentTime,", bufferend,",r,", duration,",t.meta.duration),this.endofstream=!0,this.mse.endOfStream()),!!(t&&t.meta&&t.meta.duration-e.currentTime<.5)&&(this._stopProgress(),this.log("[check player isEnded],stopProgress and endOfStream,currentTime, ",e.currentTime,", bufferend,",r,", duration,",t.meta.duration),this.mse&&this.mse.endOfStream(),!0)}},{key:"_clearMediaKeys",value:function(){var e=this.player;e.video&&"function"==typeof e.video.setMediaKeys&&e.video.setMediaKeys(null).catch((function(){}))}},{key:"_checkRemoveSourceBuffer",value:function(e,t,n,r){var i=this,o=this.mse,a=this.mp4,s=this.player;if(o&&a&&s&&(n&&(clearTimeout(this._removeBufferTimer),this._removeBufferTimer=null),e||(e=s.getBufferedRange(s.buffered2)),t||(t=s.currentTime),!(!n&&Yie.nowTime()-this._checkRemoveBufferLastTime<=this.config.removeBufferLen||this.endofstream)&&(this._checkRemoveBufferLastTime=Yie.nowTime(),e&&e[0]>=0&&(t-e[0]>this.config.removeBufferLen||o.isFull())))){var u=r?e[1]:t-(o.isFull()?0:15),c=a.getFragmentIdx(u);if(c>=0&&(r||a.timeRange[c].startTime<t)){var l=Math.floor(Math.min(a.timeRange[c].startTime,e[1]));e[0]<l?(this.log("[checkremoveSourceBuffer], remove range==>>>",e[0],l),o.reuse(e[0],l)):o.isFull()&&!this._removeBufferTimer&&(this.log("[after 10s, go on checkremoveSourceBuffer], currentTime==>>>",t,", buffer start,",e[0]),this._removeBufferTimer=setTimeout((function(){i._checkRemoveSourceBuffer(null,null,!0)}),1e4))}}}},{key:"onMediaUpdate",value:function(e){var t=e.vid,n=e.kid,r=e.url,i=this.player,o=this.config;if(t===this.playerConfig.vid&&n===o.kid&&r){this.playerConfig.url=r,this._handlerUrl(r);var a=o._mainURL;return this.useVideoLoad?i.src=r:this.mp4&&this.mp4.update(a),!0}return!1}},{key:"enableAutoBuffer",value:function(e){var t=this;if(e){if(!this._allInitPromise)return void this.log("player destroyed!!");this._allInitPromise.then((function(){t.log("enableAutoBuffer true"),t._startProgress()}))}else this._stopProgress(),this.log("enableAutoBuffer false")}},{key:"bitRateAdapter",get:function(){return this.player&&this.player.plugins&&this.config.needAutoBitrate?this.player.plugins.bitrateselector:null}},{key:"getDefinitonFromAdapter",value:function(e,t){if(!this.bitRateAdapter)return null;var n=this.bitRateAdapter;return n.getSuitableBitrate?n.getSuitableBitrate(e,t):n.bitRateAdapter?n.bitRateAdapter.select(e):null}},{key:"addPreloader",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.playerId=this.playerId,this.preloader?this.preloader.addPreloader(e,this.playerId,this.playerConfig.vid):this.log("preloader has destroyed")}},{key:"addPreloaderList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.preloader?this.preloader.addPreloaderList(e,this.playerId,this.playerConfig.vid):this.log("preloader has destroyed")}},{key:"changeUserSelectDefinition",value:function(e){this.preloader&&e&&this.preloader.changeUserSelectDefinition(e)}},{key:"log",value:function(e){for(var t=this.playerConfig,n=t&&t.vid?"[Index]".concat(t.vid," ").concat(e):"[Index] ".concat(e),r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];hae.apply(void 0,[n].concat(i))}},{key:"_emitInitFail",value:function(e){this.log("initFail, reason:",e),this.emit(Cde.INIT_FAIL,e)}},{key:"emitParseError",value:function(){this.log("parseError"),this.emit(Cde.PARSE_ERROR)}},{key:"useVideoLoad",get:function(){return this._useVideoLoad},set:function(e){this._useVideoLoad=e}},{key:"ready",get:function(){return this._allInitPromise}},{key:"speed",get:function(){return parseInt(qae.speed,10)}},{key:"version",get:function(){return Rie}},{key:"realTimeSpeed",get:function(){return gye}},{key:"opQueueLen",get:function(){var e=this.mse&&this.mse.opQueues?this.mse.opQueues.video:[];return e?e.length:0}},{key:"loadSegmentTimeRange",get:function(){if(!this.mp4)return[0,0,0,0];var e=this.mp4.timeRange;if(e&&e.length>0&&this._curLoadSegmentIdx&&this._curLoadSegmentIdx<e.length){var t=e[this._curLoadSegmentIdx];if(t.isLoading){var n=this.mp4.getFragRange(this._curLoadSegmentIdx);return[Number(t.startTime),Number(t.endTime)].concat(_K(n))}}return[0,0,0,0]}},{key:"preloadState",get:function(){return this.preloader&&this.preloader.loadingCount}},{key:"moovSize",get:function(){return 0}},{key:"isDestroy",get:function(){return!this.player}},{key:"cancelPreloadTask",value:function(){this.preloader&&this.preloader.cancelLoading(this.player.playerId)}},{key:"CDNUrl",get:function(){var e=this.playerConfig.url,t=document.createElement("a");return t.href=e,t.host}},{key:"abrInstance",get:function(){return this._abrService?this._abrService.abrInstance:null}},{key:"_handleUrlExpire",value:function(){var e=this,t=this.config,n=this.player,r=n.paused;(new Date).getTime()/1e3>=this.urlExpireTimestamp&&this.urlExpireTimestamp>0&&!r&&t.getServerTime&&(n.serverTimeDiffPromise=n.serverTimeDiffPromise||t.getServerTime().catch((function(){return 0})),n.serverTimeDiffPromise.then((function(t){if(t&&(n.serverTimeDiff=(new Date).getTime()/1e3-t),(new Date).getTime()/1e3>=e.urlExpireTimestamp+n.serverTimeDiff){e.urlExpireTimestamp=(new Date).getTime()/1e3+86400;var r=new Pie("network",Zie[403]);e._emitExpireEvent(r)}})))}},{key:"_emitExpireEvent",value:function(e){var t=this.player,n=(new Date).getTime()/1e3;this.emitExpireTimestamp?n-this.emitExpireTimestamp>300&&(this.emitExpireTimestamp=n,t.emit("MEDIA_EXPIRED",e)):(this.emitExpireTimestamp=n,t.emit("MEDIA_EXPIRED",e))}}],[{key:"registerPreloader",value:function(e,t){e.vtype=Tde.MP4,Zde.BitRateAdapter=t,new Zde(e,this)}},{key:"pluginName",get:function(){return"Mp4EncryptPlayer"}},{key:"defaultConfig",get:function(){return{onlyInit:!1,useWaterLevel:!1,maxBufferLength:10,minBufferLength:5,tickInSeconds:.2,getLicenseUrl:"",xhrSetup:{},retryCount:1,retryDelay:1e3,preloadCacheType:1,needPreloadRangeList:!1,cdnHost:"",cdnBucket:"",isEncrypt:!1,isOpenPreload:!0,needPreloadCheck:!1,preloadTime:0,preloadMaxCacheCount:0,needAutoBitrate:!0,keyValue:null,drm:null,switchBitRateWay:!1,enableWorker:!1,bufferThreshold:10,removeBufferLen:40,focusUserDefinition:!1,resumePlayWaterLevel:2,waitJampBufferMaxCnt:3,waitingInBufferTimeOut:5e3,h265Degrade:!1,forceVideoPlay:!1,segmentMinDuration:2,supportHevc:void 0,H264Config:null}}},{key:"speed",get:function(){return gye}},{key:"realTimeSpeed",get:function(){return gye}},{key:"version",get:function(){return Rie}}]),i}(ne);bye.isSupported=function(){return Qce()&&zce()&&!Bce()},bye.isEMESupported=Jce,bye.isSupportedWithXgmse=function(){return zce()&&!Bce()},bye.isMediaSourceSupported=Qce,bye.isWebAssemblySupported=zce,bye.getPlayLicenses=nse,bye.CUSTOM_EVENTS=Cde,bye.Mp4Preloader=Zde;var Aye,_ye={};Aye=_ye,function(){var e="undefined"!=typeof window?window:R,t={};for(var n in function(e,t,n){var r,i="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){e!=Array.prototype&&e!=Object.prototype&&(e[t]=n.value)},o=void 0!==e&&e===this?this:void 0!==t&&null!=t?t:this;function a(){a=function(){},o.Symbol||(o.Symbol=u)}var s,u=(s=0,function(e){return"jscomp_symbol_"+(e||"")+s++});function c(){a();var e=o.Symbol.iterator;e||(e=o.Symbol.iterator=o.Symbol("iterator")),"function"!=typeof Array.prototype[e]&&i(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return l(this)}}),c=function(){}}function l(e){var t=0;return d((function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}))}function d(e){return c(),(e={next:e})[o.Symbol.iterator]=function(){return this},e}function h(e){c();var t=e[Symbol.iterator];return t?t.call(e):l(e)}function f(e,t){if(t){for(var n=o,r=e.split("."),a=0;a<r.length-1;a++){var s=r[a];s in n||(n[s]={}),n=n[s]}(s=t(a=n[r=r[r.length-1]]))!=a&&null!=s&&i(n,r,{configurable:!0,writable:!0,value:s})}}function p(e){return function(e){function t(t){return e.next(t)}function n(t){return e.throw(t)}return new Promise((function(r,i){!function e(o){o.done?r(o.value):Promise.resolve(o.value).then(t,n).then(e,i)}(e.next())}))}(e())}f("Promise",(function(e){function t(e){this.h=0,this.l=void 0,this.g=[];var t=this.i();try{e(t.resolve,t.reject)}catch(n){t.reject(n)}}function n(){this.g=null}function r(e){return e instanceof t?e:new t((function(t){t(e)}))}if(e)return e;n.prototype.h=function(e){null==this.g&&(this.g=[],this.j()),this.g.push(e)},n.prototype.j=function(){var e=this;this.i((function(){e.m()}))};var i=o.setTimeout;n.prototype.i=function(e){i(e,0)},n.prototype.m=function(){for(;this.g&&this.g.length;){var e=this.g;this.g=[];for(var t=0;t<e.length;++t){var n=e[t];e[t]=null;try{n()}catch(r){this.l(r)}}}this.g=null},n.prototype.l=function(e){this.i((function(){throw e}))},t.prototype.i=function(){function e(e){return function(r){n||(n=!0,e.call(t,r))}}var t=this,n=!1;return{resolve:e(this.C),reject:e(this.j)}},t.prototype.C=function(e){if(e===this)this.j(new TypeError("A Promise cannot resolve to itself"));else if(e instanceof t)this.F(e);else{e:switch(typeof e){case"object":var n=null!=e;break e;case"function":n=!0;break e;default:n=!1}n?this.A(e):this.m(e)}},t.prototype.A=function(e){var t=void 0;try{t=e.then}catch(n){return void this.j(n)}"function"==typeof t?this.J(t,e):this.m(e)},t.prototype.j=function(e){this.o(2,e)},t.prototype.m=function(e){this.o(1,e)},t.prototype.o=function(e,t){if(0!=this.h)throw Error("Cannot settle("+e+", "+t+"): Promise already settled in state"+this.h);this.h=e,this.l=t,this.u()},t.prototype.u=function(){if(null!=this.g){for(var e=0;e<this.g.length;++e)a.h(this.g[e]);this.g=null}};var a=new n;return t.prototype.F=function(e){var t=this.i();e.nc(t.resolve,t.reject)},t.prototype.J=function(e,t){var n=this.i();try{e.call(t,n.resolve,n.reject)}catch(r){n.reject(r)}},t.prototype.then=function(e,n){function r(e,t){return"function"==typeof e?function(t){try{i(e(t))}catch(n){o(n)}}:t}var i,o,a=new t((function(e,t){i=e,o=t}));return this.nc(r(e,i),r(n,o)),a},t.prototype.catch=function(e){return this.then(void 0,e)},t.prototype.nc=function(e,t){function n(){switch(r.h){case 1:e(r.l);break;case 2:t(r.l);break;default:throw Error("Unexpected state: "+r.h)}}var r=this;null==this.g?a.h(n):this.g.push(n)},t.resolve=r,t.reject=function(e){return new t((function(t,n){n(e)}))},t.race=function(e){return new t((function(t,n){for(var i=h(e),o=i.next();!o.done;o=i.next())r(o.value).nc(t,n)}))},t.all=function(e){var n=h(e),i=n.next();return i.done?r([]):new t((function(e,t){function o(t){return function(n){a[t]=n,0==--s&&e(a)}}var a=[],s=0;do{a.push(void 0),s++,r(i.value).nc(o(a.length-1),t),i=n.next()}while(!i.done)}))},t})),f("Promise.prototype.finally",(function(e){return e||function(e){return this.then((function(t){return Promise.resolve(e()).then((function(){return t}))}),(function(t){return Promise.resolve(e()).then((function(){throw t}))}))}}));var m,y="function"==typeof Object.create?Object.create:function(e){function t(){}return t.prototype=e,new t};if("function"==typeof Object.setPrototypeOf)m=Object.setPrototypeOf;else{var v;e:{var g={};try{g.__proto__={a:!0},v=g.a;break e}catch(s){}v=!1}m=v?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw new TypeError(e+" is not extensible");return e}:null}var b=m;function A(e,t){if(e.prototype=y(t.prototype),e.prototype.constructor=e,b)b(e,t);else for(var n in t)if("prototype"!=n)if(Object.defineProperties){var r=Object.getOwnPropertyDescriptor(t,n);r&&Object.defineProperty(e,n,r)}else e[n]=t[n];e.Lg=t.prototype}function _(){this.l=!1,this.i=null,this.B=void 0,this.s=1,this.h=this.j=0,this.o=this.g=null}function w(e){if(e.l)throw new TypeError("Generator is already running");e.l=!0}function S(e,t){e.g={ce:t,ne:!0},e.s=e.j||e.h}function k(e,t,n){return e.s=n,{value:t}}function T(e){e.s=0}function x(e,t,n){e.j=t,null!=n&&(e.h=n)}function E(e,t){e.j=0,e.h=t||0}function L(e,t){e.s=t,e.j=0}function I(e){e.j=0;var t=e.g.ce;return e.g=null,t}function R(e){e.o=[e.g],e.j=0,e.h=0}function Z(e,t){var n=e.o.splice(0)[0];(n=e.g=e.g||n)?n.ne?e.s=e.j||e.h:null!=n.I&&e.h<n.I?(e.s=n.I,e.g=null):e.s=e.h:e.s=t}function C(e){this.g=new _,this.h=e}function P(e,t,n,r){try{var i=t.call(e.g.i,n);if(!(i instanceof Object))throw new TypeError("Iterator result "+i+" is not an object");if(!i.done)return e.g.l=!1,i;var o=i.value}catch(a){return e.g.i=null,S(e.g,a),G(e)}return e.g.i=null,r.call(e.g,o),G(e)}function G(e){for(;e.g.s;)try{var t=e.h(e.g);if(t)return e.g.l=!1,{value:t.value,done:!1}}catch(n){e.g.B=void 0,S(e.g,n)}if(e.g.l=!1,e.g.g){if(t=e.g.g,e.g.g=null,t.ne)throw t.ce;return{value:t.return,done:!0}}return{value:void 0,done:!0}}function D(e){this.next=function(t){return w(e.g),e.g.i?t=P(e,e.g.i.next,t,e.g.m):(e.g.m(t),t=G(e)),t},this.throw=function(t){return w(e.g),e.g.i?t=P(e,e.g.i.throw,t,e.g.m):(S(e.g,t),t=G(e)),t},this.return=function(t){return function(e,t){w(e.g);var n=e.g.i;return n?P(e,"return"in n?n.return:function(e){return{value:e,done:!0}},t,e.g.return):(e.g.return(t),G(e))}(e,t)},c(),this[Symbol.iterator]=function(){return this}}function M(e,t){return D.prototype=e.prototype,new D(new C(t))}function V(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function X(e,t,n){e instanceof String&&(e=String(e));for(var r=e.length,i=0;i<r;i++){var o=e[i];if(t.call(n,o,i,e))return{le:i,Qe:o}}return{le:-1,Qe:void 0}}function W(e,t,n){if(null==e)throw new TypeError("The 'this' value for String.prototype."+n+" must not be null or undefined");if(t instanceof RegExp)throw new TypeError("First argument to String.prototype."+n+" must not be a regular expression");return e+""}_.prototype.m=function(e){this.B=e},_.prototype.return=function(e){this.g={return:e},this.s=this.h},_.prototype.I=function(e){this.s=e},f("Array.prototype.keys",(function(e){return e||function(){return function(e,t){c(),e instanceof String&&(e+="");var n=0,r={next:function(){if(n<e.length){var i=n++;return{value:t(i,e[i]),done:!1}}return r.next=function(){return{done:!0,value:void 0}},r.next()}};return r[Symbol.iterator]=function(){return r},r}(this,(function(e){return e}))}})),f("WeakMap",(function(e){function t(e){if(this.g=(s+=Math.random()+1).toString(),e){a(),c(),e=h(e);for(var t;!(t=e.next()).done;)t=t.value,this.set(t[0],t[1])}}function n(e){V(e,o)||i(e,o,{value:{}})}function r(e){var t=Object[e];t&&(Object[e]=function(e){return n(e),t(e)})}if(function(){if(!e||!Object.seal)return!1;try{var t=Object.seal({}),n=Object.seal({}),r=new e([[t,2],[n,3]]);return 2==r.get(t)&&3==r.get(n)&&(r.delete(t),r.set(n,4),!r.has(t)&&4==r.get(n))}catch(i){return!1}}())return e;var o="$jscomp_hidden_"+Math.random();r("freeze"),r("preventExtensions"),r("seal");var s=0;return t.prototype.set=function(e,t){if(n(e),!V(e,o))throw Error("WeakMap key fail: "+e);return e[o][this.g]=t,this},t.prototype.get=function(e){return V(e,o)?e[o][this.g]:void 0},t.prototype.has=function(e){return V(e,o)&&V(e[o],this.g)},t.prototype.delete=function(e){return!(!V(e,o)||!V(e[o],this.g))&&delete e[o][this.g]},t})),f("Map",(function(e){function t(){var e={};return e.Na=e.next=e.head=e}function n(e,t){var n=e.g;return d((function(){if(n){for(;n.head!=e.g;)n=n.Na;for(;n.next!=n.head;)return n=n.next,{done:!1,value:t(n)};n=null}return{done:!0,value:void 0}}))}function r(e,t){var n=t&&typeof t;"object"==n||"function"==n?o.has(t)?n=o.get(t):(n=""+ ++s,o.set(t,n)):n="p_"+t;var r=e.h[n];if(r&&V(e.h,n))for(var i=0;i<r.length;i++){var a=r[i];if(t!=t&&a.key!=a.key||t===a.key)return{id:n,list:r,index:i,ga:a}}return{id:n,list:r,index:-1,ga:void 0}}function i(e){if(this.h={},this.g=t(),this.size=0,e){e=h(e);for(var n;!(n=e.next()).done;)n=n.value,this.set(n[0],n[1])}}if(function(){if(!e||"function"!=typeof e||!e.prototype.entries||"function"!=typeof Object.seal)return!1;try{var t=Object.seal({x:4}),n=new e(h([[t,"s"]]));if("s"!=n.get(t)||1!=n.size||n.get({x:4})||n.set({x:4},"t")!=n||2!=n.size)return!1;var r=n.entries(),i=r.next();return!i.done&&i.value[0]==t&&"s"==i.value[1]&&!((i=r.next()).done||4!=i.value[0].x||"t"!=i.value[1]||!r.next().done)}catch(o){return!1}}())return e;a(),c();var o=new WeakMap;i.prototype.set=function(e,t){var n=r(this,e);return n.list||(n.list=this.h[n.id]=[]),n.ga?n.ga.value=t:(n.ga={next:this.g,Na:this.g.Na,head:this.g,key:e,value:t},n.list.push(n.ga),this.g.Na.next=n.ga,this.g.Na=n.ga,this.size++),this},i.prototype.delete=function(e){return!(!(e=r(this,e)).ga||!e.list||(e.list.splice(e.index,1),e.list.length||delete this.h[e.id],e.ga.Na.next=e.ga.next,e.ga.next.Na=e.ga.Na,e.ga.head=null,this.size--,0))},i.prototype.clear=function(){this.h={},this.g=this.g.Na=t(),this.size=0},i.prototype.has=function(e){return!!r(this,e).ga},i.prototype.get=function(e){return(e=r(this,e).ga)&&e.value},i.prototype.entries=function(){return n(this,(function(e){return[e.key,e.value]}))},i.prototype.keys=function(){return n(this,(function(e){return e.key}))},i.prototype.values=function(){return n(this,(function(e){return e.value}))},i.prototype.forEach=function(e,t){for(var n,r=this.entries();!(n=r.next()).done;)n=n.value,e.call(t,n[1],n[0],this)},i.prototype[Symbol.iterator]=i.prototype.entries;var s=0;return i})),f("Set",(function(e){function t(e){if(this.g=new Map,e){e=h(e);for(var t;!(t=e.next()).done;)this.add(t.value)}this.size=this.g.size}return function(){if(!e||"function"!=typeof e||!e.prototype.entries||"function"!=typeof Object.seal)return!1;try{var t=Object.seal({x:4}),n=new e(h([t]));if(!n.has(t)||1!=n.size||n.add(t)!=n||1!=n.size||n.add({x:4})!=n||2!=n.size)return!1;var r=n.entries(),i=r.next();return!i.done&&i.value[0]==t&&i.value[1]==t&&!(i=r.next()).done&&i.value[0]!=t&&4==i.value[0].x&&i.value[1]==i.value[0]&&r.next().done}catch(o){return!1}}()?e:(a(),c(),t.prototype.add=function(e){return this.g.set(e,e),this.size=this.g.size,this},t.prototype.delete=function(e){return e=this.g.delete(e),this.size=this.g.size,e},t.prototype.clear=function(){this.g.clear(),this.size=0},t.prototype.has=function(e){return this.g.has(e)},t.prototype.entries=function(){return this.g.entries()},t.prototype.values=function(){return this.g.values()},t.prototype.keys=t.prototype.values,t.prototype[Symbol.iterator]=t.prototype.values,t.prototype.forEach=function(e,t){var n=this;this.g.forEach((function(r){return e.call(t,r,r,n)}))},t)})),f("Array.prototype.findIndex",(function(e){return e||function(e,t){return X(this,e,t).le}})),f("Array.prototype.find",(function(e){return e||function(e,t){return X(this,e,t).Qe}})),f("String.prototype.startsWith",(function(e){return e||function(e,t){for(var n=W(this,e,"startsWith"),r=n.length,i=e.length,o=Math.max(0,Math.min(0|t,n.length)),a=0;a<i&&o<r;)if(n[o++]!=e[a++])return!1;return a>=i}})),f("Object.is",(function(e){return e||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}})),f("Array.prototype.includes",(function(e){return e||function(e,t){var n=this;n instanceof String&&(n=String(n));var r=n.length,i=t||0;for(0>i&&(i=Math.max(i+r,0));i<r;i++){var o=n[i];if(o===e||Object.is(o,e))return!0}return!1}})),f("String.prototype.includes",(function(e){return e||function(e,t){return-1!==W(this,e,"includes").indexOf(e,t||0)}})),f("Array.from",(function(e){return e||function(e,t,n){c(),t=null!=t?t:function(e){return e};var r=[],i=e[Symbol.iterator];if("function"==typeof i)for(e=i.call(e);!(i=e.next()).done;)r.push(t.call(n,i.value));else{i=e.length;for(var o=0;o<i;o++)r.push(t.call(n,e[o]))}return r}}));var O="function"==typeof Object.assign?Object.assign:function(e,t){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(r)for(var i in r)V(r,i)&&(e[i]=r[i])}return e};f("Object.assign",(function(e){return e||O}));var N=this;function U(e,t){var n,r=e.split("."),i=N;r[0]in i||!i.execScript||i.execScript("var "+r[0]);for(;r.length&&(n=r.shift());)r.length||void 0===t?i=i[n]?i[n]:i[n]={}:i[n]=t}function F(e,t){function n(){}n.prototype=t.prototype,e.Lg=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Wg=function(e,n,r){return t.prototype[n].apply(e,Array.prototype.slice.call(arguments,2))}}function Y(e){this.i=Math.exp(Math.log(.5)/e),this.h=this.g=0}function K(e,t,n){var r=Math.pow(e.i,t);n=n*(1-r)+r*e.g,isNaN(n)||(e.g=n,e.h+=t)}function j(e){return e.g/(1-Math.pow(e.i,e.h))}function H(){this.h=new Y(2),this.i=new Y(5),this.g=0}N.g=!0,H.prototype.getBandwidthEstimate=function(e){return 128e3>this.g?e:Math.min(j(this.h),j(this.i))};var B={sb:0,kc:function(){},ba:function(){},error:function(){},v:function(){},info:function(){},debug:function(){},K:function(){},O:function(){}};function J(e,t,n,r){for(var i=[],o=3;o<arguments.length;++o)i[o-3]=arguments[o];this.severity=e,this.category=t,this.code=n,this.data=i,this.handled=!1}e.console&&e.console.log.bind&&(B.ba=console.warn.bind(console),B.kc=console.error.bind(console),1<=B.sb&&(B.error=console.error.bind(console)),2<=B.sb&&(B.v=console.warn.bind(console)),3<=B.sb&&(B.info=console.info.bind(console)),4<=B.sb&&(B.debug=console.log.bind(console)),5<=B.sb&&(B.K=console.debug.bind(console)),6<=B.sb&&(B.O=console.debug.bind(console))),U("shaka.util.Error",J),J.prototype.toString=function(){return"shaka.util.Error "+JSON.stringify(this,null," ")},J.Severity={RECOVERABLE:1,CRITICAL:2},J.Category={NETWORK:1,TEXT:2,MEDIA:3,MANIFEST:4,STREAMING:5,DRM:6,PLAYER:7,CAST:8,STORAGE:9},J.Code={UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,REQUEST_FILTER_ERROR:1006,RESPONSE_FILTER_ERROR:1007,MALFORMED_TEST_URI:1008,UNEXPECTED_TEST_REQUEST:1009,INVALID_TEXT_HEADER:2e3,INVALID_TEXT_CUE:2001,UNABLE_TO_DETECT_ENCODING:2003,BAD_ENCODING:2004,INVALID_XML:2005,INVALID_MP4_TTML:2007,INVALID_MP4_VTT:2008,UNABLE_TO_EXTRACT_CUE_START_TIME:2009,BUFFER_READ_OUT_OF_BOUNDS:3e3,JS_INTEGER_OVERFLOW:3001,EBML_OVERFLOW:3002,EBML_BAD_FLOATING_POINT_SIZE:3003,MP4_SIDX_WRONG_BOX_TYPE:3004,MP4_SIDX_INVALID_TIMESCALE:3005,MP4_SIDX_TYPE_NOT_SUPPORTED:3006,WEBM_CUES_ELEMENT_MISSING:3007,WEBM_EBML_HEADER_ELEMENT_MISSING:3008,WEBM_SEGMENT_ELEMENT_MISSING:3009,WEBM_INFO_ELEMENT_MISSING:3010,WEBM_DURATION_ELEMENT_MISSING:3011,WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING:3012,WEBM_CUE_TIME_ELEMENT_MISSING:3013,MEDIA_SOURCE_OPERATION_FAILED:3014,MEDIA_SOURCE_OPERATION_THREW:3015,VIDEO_ERROR:3016,QUOTA_EXCEEDED_ERROR:3017,TRANSMUXING_FAILED:3018,UNABLE_TO_GUESS_MANIFEST_TYPE:4e3,DASH_INVALID_XML:4001,DASH_NO_SEGMENT_INFO:4002,DASH_EMPTY_ADAPTATION_SET:4003,DASH_EMPTY_PERIOD:4004,DASH_WEBM_MISSING_INIT:4005,DASH_UNSUPPORTED_CONTAINER:4006,DASH_PSSH_BAD_ENCODING:4007,DASH_NO_COMMON_KEY_SYSTEM:4008,DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED:4009,DASH_CONFLICTING_KEY_IDS:4010,UNPLAYABLE_PERIOD:4011,RESTRICTIONS_CANNOT_BE_MET:4012,NO_PERIODS:4014,HLS_PLAYLIST_HEADER_MISSING:4015,INVALID_HLS_TAG:4016,HLS_INVALID_PLAYLIST_HIERARCHY:4017,DASH_DUPLICATE_REPRESENTATION_ID:4018,HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND:4020,HLS_MASTER_PLAYLIST_NOT_PROVIDED:4022,HLS_REQUIRED_ATTRIBUTE_MISSING:4023,HLS_REQUIRED_TAG_MISSING:4024,HLS_COULD_NOT_GUESS_CODECS:4025,HLS_KEYFORMATS_NOT_SUPPORTED:4026,DASH_UNSUPPORTED_XLINK_ACTUATE:4027,DASH_XLINK_DEPTH_LIMIT:4028,HLS_COULD_NOT_PARSE_SEGMENT_START_TIME:4030,CONTENT_UNSUPPORTED_BY_BROWSER:4032,CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM:4033,HLS_AES_128_ENCRYPTION_NOT_SUPPORTED:4034,HLS_INTERNAL_SKIP_STREAM:4035,INVALID_STREAMS_CHOSEN:5005,NO_RECOGNIZED_KEY_SYSTEMS:6e3,REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE:6001,FAILED_TO_CREATE_CDM:6002,FAILED_TO_ATTACH_TO_VIDEO:6003,INVALID_SERVER_CERTIFICATE:6004,FAILED_TO_CREATE_SESSION:6005,FAILED_TO_GENERATE_LICENSE_REQUEST:6006,LICENSE_REQUEST_FAILED:6007,LICENSE_RESPONSE_REJECTED:6008,ENCRYPTED_CONTENT_WITHOUT_DRM_INFO:6010,NO_LICENSE_SERVER_GIVEN:6012,OFFLINE_SESSION_REMOVED:6013,EXPIRED:6014,SERVER_CERTIFICATE_REQUIRED:6015,INIT_DATA_TRANSFORM_ERROR:6016,LOAD_INTERRUPTED:7e3,OPERATION_ABORTED:7001,NO_VIDEO_ELEMENT:7002,CAST_API_UNAVAILABLE:8e3,NO_CAST_RECEIVERS:8001,ALREADY_CASTING:8002,UNEXPECTED_CAST_ERROR:8003,CAST_CANCELED_BY_USER:8004,CAST_CONNECTION_TIMED_OUT:8005,CAST_RECEIVER_APP_UNAVAILABLE:8006,STORAGE_NOT_SUPPORTED:9e3,INDEXED_DB_ERROR:9001,DEPRECATED_OPERATION_ABORTED:9002,REQUESTED_ITEM_NOT_FOUND:9003,MALFORMED_OFFLINE_URI:9004,CANNOT_STORE_LIVE_OFFLINE:9005,STORE_ALREADY_IN_PROGRESS:9006,NO_INIT_DATA_FOR_OFFLINE:9007,LOCAL_PLAYER_INSTANCE_REQUIRED:9008,NEW_KEY_OPERATION_NOT_SUPPORTED:9011,KEY_NOT_FOUND:9012,MISSING_STORAGE_CELL:9013};var z=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;function Q(e){var t;e instanceof Q?(q(this,e.Ba),this.pb=e.pb,this.Aa=e.Aa,$(this,e.Ob),this.pa=e.pa,ee(this,e.g.clone()),this.bb=e.bb):e&&(t=String(e).match(z))?(q(this,t[1]||"",!0),this.pb=te(t[2]||""),this.Aa=te(t[3]||"",!0),$(this,t[4]),this.pa=te(t[5]||"",!0),ee(this,t[6]||"",!0),this.bb=te(t[7]||"")):this.g=new ce(null)}function q(e,t,n){e.Ba=n?te(t,!0):t,e.Ba&&(e.Ba=e.Ba.replace(/:$/,""))}function $(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.Ob=t}else e.Ob=null}function ee(e,t,n){t instanceof ce?e.g=t:(n||(t=ne(t,se)),e.g=new ce(t))}function te(e,t){return e?t?decodeURI(e):decodeURIComponent(e):""}function ne(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,re),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function re(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}(r=Q.prototype).Ba="",r.pb="",r.Aa="",r.Ob=null,r.pa="",r.bb="",r.toString=function(){var e=[],t=this.Ba;if(t&&e.push(ne(t,ie,!0),":"),t=this.Aa){e.push("//");var n=this.pb;n&&e.push(ne(n,ie,!0),"@"),e.push(encodeURIComponent(t).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(t=this.Ob)&&e.push(":",String(t))}return(t=this.pa)&&(this.Aa&&"/"!=t.charAt(0)&&e.push("/"),e.push(ne(t,"/"==t.charAt(0)?ae:oe,!0))),(t=this.g.toString())&&e.push("?",t),(t=this.bb)&&e.push("#",ne(t,ue)),e.join("")},r.resolve=function(e){var t=this.clone();"data"===t.Ba&&(t=new Q);var n=!!e.Ba;n?q(t,e.Ba):n=!!e.pb,n?t.pb=e.pb:n=!!e.Aa,n?t.Aa=e.Aa:n=null!=e.Ob;var r=e.pa;if(n)$(t,e.Ob);else if(n=!!e.pa){if("/"!=r.charAt(0))if(this.Aa&&!this.pa)r="/"+r;else{var i=t.pa.lastIndexOf("/");-1!=i&&(r=t.pa.substr(0,i+1)+r)}if(".."==r||"."==r)r="";else if(-1!=r.indexOf("./")||-1!=r.indexOf("/.")){i=0==r.lastIndexOf("/",0),r=r.split("/");for(var o=[],a=0;a<r.length;){var s=r[a++];"."==s?i&&a==r.length&&o.push(""):".."==s?((1<o.length||1==o.length&&""!=o[0])&&o.pop(),i&&a==r.length&&o.push("")):(o.push(s),i=!0)}r=o.join("/")}}return n?t.pa=r:n=""!==e.g.toString(),n?ee(t,e.g.clone()):n=!!e.bb,n&&(t.bb=e.bb),t},r.clone=function(){return new Q(this)};var ie=/[#\/\?@]/g,oe=/[#\?:]/g,ae=/[#\?]/g,se=/[#\?@]/g,ue=/#/g;function ce(e){this.g=e||null}(r=ce.prototype).na=null,r.qc=null,r.add=function(e,t){if(!this.na&&(this.na={},this.qc=0,this.g))for(var n=this.g.split("&"),r=0;r<n.length;r++){var i=n[r].indexOf("="),o=null;if(0<=i){var a=n[r].substring(0,i);o=n[r].substring(i+1)}else a=n[r];a=decodeURIComponent(a.replace(/\+/g," ")),o=o||"",this.add(a,decodeURIComponent(o.replace(/\+/g," ")))}return this.g=null,(n=this.na.hasOwnProperty(e)&&this.na[e])||(this.na[e]=n=[]),n.push(t),this.qc++,this},r.toString=function(){if(this.g)return this.g;if(!this.na)return"";var e,t=[];for(e in this.na)for(var n=encodeURIComponent(e),r=this.na[e],i=0;i<r.length;i++){var o=n;""!==r[i]&&(o+="="+encodeURIComponent(r[i])),t.push(o)}return this.g=t.join("&")},r.clone=function(){var e=new ce;if(e.g=this.g,this.na){var t,n={};for(t in this.na)n[t]=this.na[t].concat();e.na=n,e.qc=this.qc}return e};var le={df:function(e,t){return e.reduce(function(e,t,n){return t.catch(e.bind(null,n))}.bind(null,t),Promise.reject())},Rc:function(e,t){return e.concat(t)},Bc:function(){},Ra:function(e){return null!=e}};function de(e,t){if(0==t.length)return e;var n=t.map((function(e){return new Q(e)}));return e.map((function(e){return new Q(e)})).map((function(e){return n.map(e.resolve.bind(e))})).reduce(le.Rc,[]).map((function(e){return e.toString()}))}function he(e,t){return{keySystem:e,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:t||[],keyIds:[]}}var fe={Za:"video",Sb:"audio",za:"text",Ug:"image",Sg:"application"},pe=1/15;function me(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.resolve=e,n.reject=t,n}function ye(e){if(!e)return"";239==(e=new Uint8Array(e))[0]&&187==e[1]&&191==e[2]&&(e=e.subarray(3)),e=_e(e),e=escape(e);try{return decodeURIComponent(e)}catch(t){throw new J(2,2,2004)}}function ve(e,t,n){if(!e)return"";if(!n&&0!=e.byteLength%2)throw B.error("Data has an incorrect length, must be even."),new J(2,2,2004);if(e instanceof ArrayBuffer)var r=e;else(n=new Uint8Array(e.byteLength)).set(new Uint8Array(e)),r=n.buffer;e=Math.floor(e.byteLength/2),n=new Uint16Array(e),r=new DataView(r);for(var i=0;i<e;i++)n[i]=r.getUint16(2*i,t);return _e(n)}function ge(e){var t=new Uint8Array(e);if(239==t[0]&&187==t[1]&&191==t[2])return ye(t);if(254==t[0]&&255==t[1])return ve(t.subarray(2),!1);if(255==t[0]&&254==t[1])return ve(t.subarray(2),!0);var n=function(e,t){return e.byteLength<=t||32<=e[t]&&126>=e[t]}.bind(null,t);if(B.debug("Unable to find byte-order-mark, making an educated guess."),0==t[0]&&0==t[2])return ve(e,!1);if(0==t[1]&&0==t[3])return ve(e,!0);if(n(0)&&n(1)&&n(2)&&n(3))return ye(e);throw new J(2,2,2003)}function be(e){e=encodeURIComponent(e),e=unescape(e);for(var t=new Uint8Array(e.length),n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t.buffer}function Ae(e,t){for(var n=new Uint8Array(2*e.length),r=new DataView(n.buffer),i=0;i<e.length;++i)r.setUint16(2*i,e.charCodeAt(i),t);return n.buffer}function _e(e){if(!we)for(var t=function(e){try{var t=new Uint8Array(e);return 0<String.fromCharCode.apply(null,t).length}catch(n){return!1}},n={size:65536};0<n.size;(n={size:n.size}).size/=2)if(t(n.size)){we=function(e){return function(t){for(var n="",r=0;r<t.length;r+=e.size)n+=String.fromCharCode.apply(null,t.subarray(r,r+e.size));return n}}(n);break}return we(e)}me.prototype.resolve=function(){},me.prototype.reject=function(){},U("shaka.util.StringUtils.fromUTF8",ye),U("shaka.util.StringUtils.fromUTF16",ve),U("shaka.util.StringUtils.fromBytesAutoDetect",ge),U("shaka.util.StringUtils.toUTF8",be),U("shaka.util.StringUtils.toUTF16",Ae);var we=null;U("shaka.util.StringUtils.resetFromCharCode",(function(){we=null}));var Se={Mc:function(t,n){var r=_e(t);return n=null==n||n,r=e.btoa(r).replace(/\+/g,"-").replace(/\//g,"_"),n?r:r.replace(/=*$/,"")}};function ke(){this.g=new muxjs.mp4.Transmuxer({keepOriginalTimestamps:!0}),this.h=null,this.l=[],this.i=[],this.j=!1,this.g.on("data",this.o.bind(this)),this.g.on("done",this.m.bind(this))}function Te(t,n){return!(!e.muxjs||"mp2t"!=t.toLowerCase().split(";")[0].split("/")[1])&&(n?MediaSource.isTypeSupported(xe(n,t)):MediaSource.isTypeSupported(xe("audio",t))||MediaSource.isTypeSupported(xe("video",t)))}function xe(e,t){var n=t.replace(/mp2t/i,"mp4");"audio"==e&&(n=n.replace("video","audio"));var r=/avc1\.(66|77|100)\.(\d+)/.exec(n);if(r){var i="avc1.",o=r[1],a=Number(r[2]);i=("66"==o?i+"4200":"77"==o?i+"4d00":i+"6400")+(a>>4).toString(16),i+=(15&a).toString(16),n=n.replace(r[0],i)}return n}function Ee(e){this.h=e,this.g=null}function Le(e){this.h=e,this.g=null}function Ie(e,t){var n={maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0};this.o=null==e.maxAttempts?n.maxAttempts:e.maxAttempts,this.j=null==e.baseDelay?n.baseDelay:e.baseDelay,this.m=null==e.fuzzFactor?n.fuzzFactor:e.fuzzFactor,this.l=null==e.backoffFactor?n.backoffFactor:e.backoffFactor,this.g=0,this.h=this.j,(this.i=void 0!==t&&t)&&(this.g=1)}function Re(e){return p((function t(){var n,r;return M(t,(function(t){switch(t.s){case 1:if(e.g>=e.o){if(!e.i)return t.return(Promise.reject());e.g=1,e.h=e.j}return n=e.g,e.g++,0==n?t.return():(r=e.h*(1+(2*Math.random()-1)*e.m),k(t,new Promise((function(e){new Le(e).V(r/1e3)})),2));case 2:e.h*=e.l,T(t)}}))}))}function Ze(e,t){this.promise=e,this.se=t,this.g=!1}function Ce(e){return new Ze(Promise.reject(e),(function(){return Promise.resolve()}))}function Pe(){var e=Promise.reject(new J(2,7,7001));return e.catch((function(){})),new Ze(e,(function(){return Promise.resolve()}))}function Ge(e){return new Ze(Promise.resolve(e),(function(){return Promise.resolve()}))}function De(e){return new Ze(e,(function(){return e.catch((function(){}))}))}function Me(e){return new Ze(Promise.all(e.map((function(e){return e.promise}))),(function(){return Promise.all(e.map((function(e){return e.abort()})))}))}function Ve(t,n){for(var r in n=void 0===n?{}:n)this[r]=n[r];this.defaultPrevented=this.cancelable=this.bubbles=!1,this.timeStamp=e.performance&&e.performance.now?e.performance.now():Date.now(),this.type=t,this.isTrusted=!1,this.target=this.currentTarget=null,this.g=!1}function Xe(){this.g={}}function We(){this.hd=new Xe,this.jc=this}function Oe(e){var t=new Set;return function e(n){switch(typeof n){case"undefined":case"boolean":case"number":case"string":case"symbol":case"function":return n;default:if(!n||n.buffer&&n.buffer.constructor==ArrayBuffer)return n;if(t.has(n))return null;var r=n.constructor==Array;if(n.constructor!=Object&&!r)return null;t.add(n);var i,o=r?[]:{};for(i in n)o[i]=e(n[i]);return r&&(o.length=n.length),o}}(e)}function Ne(e,t){return!("number"!=typeof e||"number"!=typeof t||!isNaN(e)||!isNaN(t))||e===t}function Ue(e,t){var n=e.indexOf(t);-1<n&&e.splice(n,1)}function Fe(e,t,n){if(n||(n=Ne),e.length!=t.length)return!1;t=t.slice();for(var r={},i=(e=h(e)).next();!i.done;r={item:r.item},i=e.next()){if(r.item=i.value,-1==(i=t.findIndex(function(e){return function(t){return n(e.item,t)}}(r))))return!1;t[i]=t[t.length-1],t.pop()}return 0==t.length}function Ye(){this.g=[]}function Ke(e,t){e.g.push(t.finally((function(){Ue(e.g,t)})))}function je(e){We.call(this),this.j=!1,this.l=new Ye,this.g=new Set,this.h=new Set,this.i=e||null}U("shaka.util.Uint8ArrayUtils.toBase64",Se.Mc),Se.Ja=function(t){t=e.atob(t.replace(/-/g,"+").replace(/_/g,"/"));for(var n=new Uint8Array(t.length),r=0;r<t.length;++r)n[r]=t.charCodeAt(r);return n},U("shaka.util.Uint8ArrayUtils.fromBase64",Se.Ja),Se.$c=function(t){for(var n=new Uint8Array(t.length/2),r=0;r<t.length;r+=2)n[r/2]=e.parseInt(t.substr(r,2),16);return n},U("shaka.util.Uint8ArrayUtils.fromHex",Se.$c),Se.Nc=function(e){for(var t="",n=0;n<e.length;++n){var r=e[n].toString(16);1==r.length&&(r="0"+r),t+=r}return t},U("shaka.util.Uint8ArrayUtils.toHex",Se.Nc),Se.Ha=function(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!=t.length)return!1;for(var n=0;n<e.length;++n)if(e[n]!=t[n])return!1;return!0},U("shaka.util.Uint8ArrayUtils.equal",Se.Ha),Se.concat=function(e){for(var t=[],n=0;n<arguments.length;++n)t[n]=arguments[n];for(var r=n=0;r<t.length;++r)n+=t[r].length;n=new Uint8Array(n);for(var i=r=0;i<t.length;++i)n.set(t[i],r),r+=t[i].length;return n},U("shaka.util.Uint8ArrayUtils.concat",Se.concat),ke.prototype.destroy=function(){return this.g.dispose(),this.g=null,Promise.resolve()},ke.prototype.o=function(e){this.i=e.captions;var t=new Uint8Array(e.data.byteLength+e.initSegment.byteLength);t.set(e.initSegment,0),t.set(e.data,e.initSegment.byteLength),this.l.push(t)},ke.prototype.m=function(){var e={data:Se.concat.apply(null,this.l),captions:this.i};this.h.resolve(e),this.j=!1},Ee.prototype.V=function(t){var n=this;this.stop();var r=!0,i=null;return this.g=function(){e.clearTimeout(i),r=!1},i=e.setTimeout((function(){r&&n.h()}),1e3*t),this},Ee.prototype.stop=function(){this.g&&(this.g(),this.g=null)},U("shaka.util.Timer",Le),Le.prototype.Lc=function(){return this.stop(),this.h(),this},Le.prototype.tickNow=Le.prototype.Lc,Le.prototype.V=function(e){var t=this;return this.stop(),this.g=new Ee((function(){t.h()})).V(e),this},Le.prototype.tickAfter=Le.prototype.V,Le.prototype.Oa=function(e){var t=this;return this.stop(),this.g=new Ee((function(){t.g.V(e),t.h()})).V(e),this},Le.prototype.tickEvery=Le.prototype.Oa,Le.prototype.stop=function(){this.g&&(this.g.stop(),this.g=null)},Le.prototype.stop=Le.prototype.stop,U("shaka.util.AbortableOperation",Ze),Ze.failed=Ce,Ze.aborted=Pe,Ze.completed=Ge,Ze.notAbortable=De,Ze.prototype.abort=function(){return this.g=!0,this.se()},Ze.prototype.abort=Ze.prototype.abort,Ze.all=Me,Ze.prototype.finally=function(e){return this.promise.then((function(){return e(!0)}),(function(){return e(!1)})),this},Ze.prototype.finally=Ze.prototype.finally,Ze.prototype.ca=function(e,t){function n(n){return function(s){if(i.g&&n)o.reject(a);else{var u=n?e:t;u?r=function(e,t,n){try{var r=e(t);return r&&r.promise&&r.abort?(n.resolve(r.promise),function(){return r.abort()}):(n.resolve(r),function(){return Promise.resolve(r).then((function(){}),(function(){}))})}catch(i){return n.reject(i),function(){return Promise.resolve()}}}(u,s,o):(n?o.resolve:o.reject)(s)}}}function r(){return o.reject(a),i.abort()}var i=this,o=new me,a=new J(2,7,7001);return this.promise.then(n(!0),n(!1)),new Ze(o,(function(){return r()}))},Ze.prototype.chain=Ze.prototype.ca,U("shaka.util.FakeEvent",Ve),Ve.prototype.preventDefault=function(){this.cancelable&&(this.defaultPrevented=!0)},Ve.prototype.stopImmediatePropagation=function(){this.g=!0},Ve.prototype.stopPropagation=function(){},(r=Xe.prototype).push=function(e,t){this.g.hasOwnProperty(e)?this.g[e].push(t):this.g[e]=[t]},r.get=function(e){return(e=this.g[e])?e.slice():null},r.getAll=function(){var e,t=[];for(e in this.g)t.push.apply(t,this.g[e]);return t},r.remove=function(e,t){var n=this.g[e];if(n)for(var r=0;r<n.length;++r)n[r]==t&&(n.splice(r,1),--r)},r.forEach=function(e){for(var t in this.g)e(t,this.g[t])},r.size=function(){return Object.keys(this.g).length},We.prototype.addEventListener=function(e,t){this.hd.push(e,t)},We.prototype.removeEventListener=function(e,t){this.hd.remove(e,t)},We.prototype.dispatchEvent=function(e){for(var t=this.hd.get(e.type)||[],n=0;n<t.length;++n){e.target=this.jc,e.currentTarget=this.jc;var r=t[n];try{r.handleEvent?r.handleEvent(e):r.call(this,e)}catch(kye){B.error("Uncaught exception in event handler",kye,kye?kye.message:null,kye?kye.stack:null)}if(e.g)break}return e.defaultPrevented},Ye.prototype.destroy=function(){var e=[];return this.g.forEach((function(t){t.promise.catch((function(){})),e.push(t.abort())})),this.g=[],Promise.all(e)},F(je,We),U("shaka.net.NetworkingEngine",je),je.RequestType={MANIFEST:0,SEGMENT:1,LICENSE:2,APP:3,TIMING:4},je.PluginPriority={FALLBACK:1,PREFERRED:2,APPLICATION:3};var He={};function Be(e,t,n){n=n||3;var r=He[e];(!r||n>=r.priority)&&(He[e]={priority:n,mg:t})}function Je(e,t){return{uris:e,method:"GET",body:null,headers:{},allowCrossSiteCredentials:!1,retryParameters:t,licenseRequestType:null,sessionId:null}}function ze(e,t,n,r,i,o,a){var s=new Q(n.uris[i]),u=s.Ba,c=!1;u||(q(s,u=(u=location.protocol).slice(0,-1)),n.uris[i]=s.toString()),u=u.toLowerCase();var l,d=(u=He[u])?u.mg:null;return d?De(Re(r)).ca((function(){return e.j?Pe():(l=Date.now(),d(n.uris[i],n,t,(function(n,r,i){e.i&&1==t&&(e.i(n,r),c=!0,a.g=i)})))})).ca((function(e){return null==e.timeMs&&(e.timeMs=Date.now()-l),{response:e,Nf:c}}),(function(s){if(s&&7001==s.code)throw s;if(e.j)return Pe();if(s&&1==s.severity)return e.dispatchEvent(new Ve("retry",{error:s instanceof J?s:null})),i=(i+1)%n.uris.length,ze(e,t,n,r,i,s,a);throw s||o})):Ce(new J(2,1,1e3,s))}function Qe(){this.g=0}function qe(e,t,n){Ze.call(this,e,t),this.h=n}function $e(){}function et(){this.g=new Xe}function tt(e,t,n,r){this.target=e,this.type=t,this.listener=n,this.g=function(e,t){if(null==t)return!1;if("boolean"==typeof t)return t;var n=new Set(["passive","capture"]);return Object.keys(t).filter((function(e){return!n.has(e)})),function(e){var t=nt;if(null==t){t=!1;try{var n={},r={get:function(){return t=!0,!1}};Object.defineProperty(n,"passive",r),Object.defineProperty(n,"capture",r),r=function(){},e.addEventListener("test",r,n),e.removeEventListener("test",r,n)}catch(kye){t=!1}nt=t}return t||!1}(e)?t:t.capture||!1}(e,r),this.target.addEventListener(t,n,this.g)}je.registerScheme=Be,je.unregisterScheme=function(e){delete He[e]},je.prototype.og=function(e){this.g.add(e)},je.prototype.registerRequestFilter=je.prototype.og,je.prototype.Ng=function(e){this.g.delete(e)},je.prototype.unregisterRequestFilter=je.prototype.Ng,je.prototype.bf=function(){this.g.clear()},je.prototype.clearAllRequestFilters=je.prototype.bf,je.prototype.pg=function(e){this.h.add(e)},je.prototype.registerResponseFilter=je.prototype.pg,je.prototype.Og=function(e){this.h.delete(e)},je.prototype.unregisterResponseFilter=je.prototype.Og,je.prototype.cf=function(){this.h.clear()},je.prototype.clearAllResponseFilters=je.prototype.cf,je.defaultRetryParameters=function(){return{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0}},je.makeRequest=Je,je.prototype.destroy=function(){return this.j=!0,this.g.clear(),this.h.clear(),this.l.destroy()},je.prototype.destroy=je.prototype.destroy,je.prototype.request=function(e,t){var n=this,r=new Qe;if(this.j){var i=Promise.reject(new J(2,7,7001));return i.catch((function(){})),new qe(i,(function(){return Promise.resolve()}),r)}t.method=t.method||"GET",t.headers=t.headers||{},t.retryParameters=t.retryParameters?Oe(t.retryParameters):{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0},t.uris=Oe(t.uris),i=function(e,t,n){for(var r=Ge(void 0),i={},o=(e=h(e.g)).next();!o.done;i={Gd:i.Gd},o=e.next())i.Gd=o.value,r=r.ca(function(e){return function(){return e.Gd(t,n)}}(i));return r.ca(void 0,(function(e){if(e&&7001==e.code)throw e;throw new J(2,1,1006,e)}))}(this,e,t);var o=i.ca((function(){return ze(n,e,t,new Ie(t.retryParameters,!1),0,null,r)})),a=o.ca((function(t){return function(e,t,n){for(var r=Ge(void 0),i=(e=h(e.h)).next();!i.done;i=e.next())r=r.ca(i.value.bind(null,t,n.response));return r.ca((function(){return n}),(function(e){if(e&&7001==e.code)throw e;var t=2;throw e instanceof J&&(t=e.severity),new J(t,1,1007,e)}))}(n,e,t)})),s=Date.now(),u=0;i.promise.then((function(){u=Date.now()-s}),(function(){}));var c=0;return o.promise.then((function(){c=Date.now()}),(function(){})),i=new qe((i=a.ca((function(t){var r=Date.now()-c,i=t.response;return i.timeMs+=u,i.timeMs+=r,t.Nf||!n.i||i.fromCache||1!=e||n.i(i.timeMs,i.data.byteLength),i}),(function(e){throw e&&(e.severity=2),e}))).promise,i.se,r),Ke(this.l,i),i},je.prototype.request=je.prototype.request,je.NumBytesRemainingClass=Qe,A(qe,Ze),je.PendingRequest=qe,qe.all=Me,qe.notAbortable=De,qe.completed=Ge,qe.aborted=Pe,qe.failed=Ce,U("shaka.util.IReleasable",$e),$e.prototype.release=function(){},U("shaka.util.EventManager",et),et.prototype.release=function(){this.nb(),this.g=null},et.prototype.release=et.prototype.release,et.prototype.H=function(e,t,n,r){this.g&&(e=new tt(e,t,n,r),this.g.push(t,e))},et.prototype.listen=et.prototype.H,et.prototype.ya=function(e,t,n,r){var i=this;this.H(e,t,(function r(o){i.ta(e,t,r),n(o)}),r)},et.prototype.listenOnce=et.prototype.ya,et.prototype.ta=function(e,t,n){if(this.g)for(var r=this.g.get(t)||[],i=(r=h(r)).next();!i.done;i=r.next())(i=i.value).target!=e||n!=i.listener&&n||(i.ta(),this.g.remove(t,i))},et.prototype.unlisten=et.prototype.ta,et.prototype.nb=function(){if(this.g){for(var e=this.g.getAll(),t=(e=h(e)).next();!t.done;t=e.next())t.value.ta();this.g.g={}}},et.prototype.removeAll=et.prototype.nb,tt.prototype.ta=function(){this.target.removeEventListener(this.type,this.listener,this.g),this.listener=this.target=null,this.g=!1},tt.prototype.unlisten=tt.prototype.ta;var nt=void 0;function rt(e){return new Q(e=ge(e)).Aa}function it(e,t,n){function r(e){new DataView(i.buffer).setUint32(o,e.byteLength,!0),o+=4,i.set(e,o),o+=e.byteLength}if(!n||!n.byteLength)throw new J(2,6,6015);t="string"==typeof t?new Uint8Array(Ae(t,!0)):new Uint8Array(t),e=Ae(e=ge(e),!0);var i=new Uint8Array(12+e.byteLength+t.byteLength+n.byteLength),o=0;return r(new Uint8Array(e)),r(t),r(new Uint8Array(n)),i}function ot(e,t){for(var n=[],r=h(e),i=r.next();!i.done;i=r.next())n.push(t(i.value));return n}function at(e,t){for(var n=h(e),r=n.next();!r.done;r=n.next())if(!t(r.value))return!1;return!0}function st(e){var t=new Map;return Object.keys(e).forEach((function(n){t.set(n,e[n])})),t}function ut(e){var t={};return e.forEach((function(e,n){t[n]=e})),t}function ct(e,t){var n=e;return t&&(n+='; codecs="'+t+'"'),n}function lt(e){return(e=e.split(/ *; */)).shift(),(e=e.find((function(e){return e.startsWith("codecs=")})))?e.split("=")[1].replace(/^"|"$/g,""):""}function dt(e){var t=(e=e.split("."))[0];return e.pop(),[t,e.join(".")]}U("shaka.util.FairPlayUtils.defaultGetContentId",rt),U("shaka.util.FairPlayUtils.initDataTransform",it);var ht=(new Map).set("codecs","codecs").set("frameRate","framerate").set("bandwidth","bitrate").set("width","width").set("height","height").set("channelsCount","channels");function ft(){return!(!e.MediaSource||!MediaSource.isTypeSupported)}function pt(e){return""!=bt().canPlayType(e)}function mt(){return gt("Tizen")}function yt(){return!!navigator.vendor&&navigator.vendor.includes("Apple")&&!mt()}function vt(){if(!yt())return null;var e=navigator.userAgent.match(/Version\/(\d+)/);return e||(e=navigator.userAgent.match(/OS (\d+)(?:_\d+)?/))?parseInt(e[1],10):null}function gt(e){return(navigator.userAgent||"").includes(e)}function bt(){return _t||(At||(At=new Le((function(){_t=null}))),(_t=document.getElementsByTagName("video")[0]||document.getElementsByTagName("audio")[0])||(_t=document.createElement("video")),At.V(1),_t)}var At=null,_t=null;function wt(e,t){var n=this;t=void 0===t?1:t,this.J=e,this.C=new Set,this.m=this.o=null,this.Z=!1,this.P=0,this.g=null,this.u=new et,this.h=new Map,this.F=[],this.A=new me,this.j=null,this.l=function(t){n.A.reject(t),e.onError(t)},this.wa=new Map,this.da=new Map,this.X=new Le((function(){return function(e){var t=e.wa,n=e.da;n.clear(),t.forEach((function(e,t){return n.set(t,e)})),(t=Array.from(n.values())).length&&t.every((function(e){return"expired"==e}))&&e.l(new J(2,6,6014)),e.J.Dc(ut(n))}(n)})),this.i=!1,this.ua=new me,this.L=!1,this.M=[],this.va=!1,this.ea=new Le((function(){!function(e){e.h.forEach((function(t,n){var r=t.xd,i=n.expiration;isNaN(i)&&(i=1/0),i!=r&&(e.J.onExpirationUpdated(n.sessionId,i),t.xd=i)}))}(n)})).Oa(t),this.A.catch((function(){}))}function St(e,t,n){return e.F=n,e.L=0<n.length,kt(e,t)}function kt(t,n){var r=function(t){if(0==(t=st(t.j.clearKeys)).size)return null;var n=[],r=[];t.forEach((function(e,t){var i=Se.$c(t),o=Se.$c(e);i={kty:"oct",kid:Se.Mc(i,!1),k:Se.Mc(o,!1)},n.push(i),r.push(i.kid)})),t=JSON.stringify({keys:n});var i=JSON.stringify({kids:r});return i=[{initData:new Uint8Array(be(i)),initDataType:"keyids"}],{keySystem:"org.w3.clearkey",licenseServerUri:"data:application/json;base64,"+e.btoa(t),distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:i,keyIds:[]}}(t);if(r)for(var i=h(n),o=i.next();!o.done;o=i.next())o.value.drmInfos=[r];for((r=n.some((function(e){return 0<e.drmInfos.length})))||function(e,t){var n=[];t.forEach((function(e,t){n.push({keySystem:t,licenseServerUri:e,distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[]})}));for(var r=h(e),i=r.next();!i.done;i=r.next())i.value.drmInfos=n}(n,o=st(t.j.servers)),o=(i=h(n)).next();!o.done;o=i.next())for(var a=(o=h(o.value.drmInfos)).next();!a.done;a=o.next())Nt(a.value,st(t.j.servers),st(t.j.advanced||{}));return o=function(e,t){for(var n=new Set,r=h(t),i=r.next();!i.done;i=r.next()){var o=h(i.value.drmInfos);for(i=o.next();!i.done;i=o.next())n.add(i.value)}for(r=h(n),i=r.next();!i.done;i=r.next())Nt(i.value,st(e.j.servers),st(e.j.advanced||{}));o=e.L?"required":"optional";var a=e.L?["persistent-license"]:["temporary"];for(r=new Map,n=h(n),i=n.next();!i.done;i=n.next())i=i.value,r.set(i.keySystem,{audioCapabilities:[],videoCapabilities:[],distinctiveIdentifier:"optional",persistentState:o,sessionTypes:a,label:i.keySystem,drmInfos:[]});for(n=h(t),i=n.next();!i.done;i=n.next()){o=(i=i.value).audio,a=i.video;var s=o?Zt(o):"",u=a?Zt(a):"",c=h(i.drmInfos);for(i=c.next();!i.done;i=c.next()){i=i.value;var l=r.get(i.keySystem);l.drmInfos.push(i),i.distinctiveIdentifierRequired&&(l.distinctiveIdentifier="required"),i.persistentStateRequired&&(l.persistentState="required"),o&&(l.audioCapabilities.push({robustness:i.audioRobustness||"",contentType:s}),"ac-3"==o.codecs.toLowerCase()&&mt()&&l.audioCapabilities.push({robustness:i.audioRobustness||"",contentType:ct(o.mimeType,"ec-3")})),a&&l.videoCapabilities.push({robustness:i.videoRobustness||"",contentType:u})}}return r}(t,n),o.size?(o=Ct(t,o),r?o:o.catch((function(){}))):(t.Z=!0,Promise.resolve())}function Tt(e){return p((function t(){var n;return M(t,(function(t){switch(t.s){case 1:if(!(e.o&&e.g&&e.g.serverCertificate&&e.g.serverCertificate.length)){t.I(0);break}return x(t,3),k(t,e.o.setServerCertificate(e.g.serverCertificate),5);case 5:t.B||B.v("Server certificates are not supported by the key system. The server certificate has been ignored."),L(t,0);break;case 3:return n=I(t),t.return(Promise.reject(new J(2,6,6004,n.message)))}}))}))}function xt(e){var t=e.g?e.g.initData:[];return t.forEach((function(t){return Et(e,t.initDataType,t.initData)})),e.F.forEach((function(t){return Pt(e,t)})),t.length||e.F.length||e.A.resolve(),e.A}function Et(e,t,n){for(var r=e.h.values(),i=(r=h(r)).next();!i.done;i=r.next())if(Se.Ha(n,i.value.initData)&&!gt("Tizen 2"))return void B.debug("Ignoring duplicate init data.");!function(e,t,n){try{if(e.L){B.K("Creating new persistent session");var r=e.o.createSession("persistent-license")}else B.K("Creating new temporary session"),r=e.o.createSession()}catch(i){return void e.l(new J(2,6,6005,i.message))}e.u.H(r,"message",e.ye.bind(e)),e.u.H(r,"keystatuseschange",e.we.bind(e)),e.h.set(r,{initData:n,loaded:!1,xd:1/0,Ga:null});try{n=e.j.initDataTransform(n,e.g)}catch(i){return t=i,i instanceof J||(t=new J(2,6,6016,i)),void e.l(t)}r.generateRequest(t,n).catch((function(t){if(!e.i){if(e.h.delete(r),t.errorCode&&t.errorCode.systemCode){var n=t.errorCode.systemCode;0>n&&(n+=Math.pow(2,32)),n="0x"+n.toString(16)}e.l(new J(2,6,6006,t.message,t,n))}}))}(e,t,n)}function Lt(e){return e?e.keySystem:""}function It(e,t){if(navigator.userAgent.match(/Edge\//))return!0;if(t=t.toLowerCase(),mt()&&t.includes('codecs="ac-3"')){var n=t.replace("ac-3","ec-3");return e.C.has(t)||e.C.has(n)}return e.C.has(t)}function Rt(e){return e=ot(e=e.h.keys(),(function(e){return e.sessionId})),Array.from(e)}function Zt(e){var t=ct(e.mimeType,e.codecs);return Te(t)?xe(e.type,t):t}function Ct(e,t){if(1==t.size&&t.has(""))return Promise.reject(new J(2,6,6e3));for(var n=h(t.values()),r=n.next();!r.done;r=n.next())0==(r=r.value).audioCapabilities.length&&delete r.audioCapabilities,0==r.videoCapabilities.length&&delete r.videoCapabilities;var i=n=new me;return[!0,!1].forEach(function(e){var n=this;t.forEach((function(t,r){t.drmInfos.some((function(e){return!!e.licenseServerUri}))==e&&(i=i.catch(function(){if(!this.i)return navigator.requestMediaKeySystemAccess(r,[t])}.bind(n)))}))}.bind(e)),i=(i=i.catch((function(){return Promise.reject(new J(2,6,6001))}))).then(function(e){if(this.i)return Promise.reject();this.C.clear();var n=e.getConfiguration(),r=n.videoCapabilities||[],i=h(n.audioCapabilities||[]);for(n=i.next();!n.done;n=i.next())this.C.add(n.value.contentType.toLowerCase());for(n=(r=h(r)).next();!n.done;n=r.next())this.C.add(n.value.contentType.toLowerCase());r=e.keySystem,i=[];var o=[],a=[],s=[];return function(e,t,n,r,i){e.forEach((function(e){if(t.includes(e.licenseServerUri)||t.push(e.licenseServerUri),e.serverCertificate&&(n.some((function(t){return Se.Ha(t,e.serverCertificate)}))||n.push(e.serverCertificate)),e.initData&&e.initData.forEach((function(e){r.some((function(t){return!(!t.keyId||t.keyId!=e.keyId)||t.initDataType==e.initDataType&&Se.Ha(t.initData,e.initData)}))||r.push(e)})),e.keyIds)for(var o=0;o<e.keyIds.length;++o)i.includes(e.keyIds[o])||i.push(e.keyIds[o])}))}((n=t.get(e.keySystem)).drmInfos,i,o,a,s),1<o.length&&B.v("Multiple unique server certificates found! Only the first will be used."),1<i.length&&B.v("Multiple unique license server URIs found! Only the first will be used."),this.g={keySystem:r,licenseServerUri:i[0],distinctiveIdentifierRequired:"required"==n.distinctiveIdentifier,persistentStateRequired:"required"==n.persistentState,audioRobustness:(n.audioCapabilities?n.audioCapabilities[0].robustness:"")||"",videoRobustness:(n.videoCapabilities?n.videoCapabilities[0].robustness:"")||"",serverCertificate:o[0],initData:a,keyIds:s},this.g.licenseServerUri?e.createMediaKeys():Promise.reject(new J(2,6,6012,this.g.keySystem))}.bind(e)).then(function(e){if(this.i)return Promise.reject();B.info("Created MediaKeys object for key system",this.g.keySystem),this.o=e,this.Z=!0}.bind(e)).catch(function(e){if(!this.i)return this.g=null,this.C.clear(),e instanceof J?Promise.reject(e):Promise.reject(new J(2,6,6002,e.message))}.bind(e)),n.reject(),i}function Pt(e,t){try{B.K("Attempting to load an offline session",t);var n=e.o.createSession("persistent-license")}catch(o){var r=new J(2,6,6005,o.message);return e.l(r),Promise.reject(r)}e.u.H(n,"message",e.ye.bind(e)),e.u.H(n,"keystatuseschange",e.we.bind(e));var i={initData:null,loaded:!1,xd:1/0,Ga:null};return e.h.set(n,i),n.load(t).then(function(e){return this.i?Promise.reject():(B.O("Loaded offline session",t,e),e?(i.loaded=!0,Ot(this)&&this.A.resolve(),n):(this.h.delete(n),void this.l(new J(2,6,6013))))}.bind(e),function(e){this.i||(this.h.delete(n),this.l(new J(2,6,6005,e.message)))}.bind(e))}function Gt(e,t){if(Lt(t).startsWith("com.apple.fps")){var n=t.serverCertificate;e=it(e,rt(e),n)}return e}function Dt(e,t){var n=t.target;B.K("Sending license request for session",n.sessionId,"of type",t.messageType);var r=e.h.get(n),i=e.g.licenseServerUri,o=e.j.advanced[e.g.keySystem];"individualization-request"==t.messageType&&o&&o.individualizationServer&&(i=o.individualizationServer),(i=Je([i],e.j.retryParameters)).body=t.message,i.method="POST",i.licenseRequestType=t.messageType,i.sessionId=n.sessionId,"com.microsoft.playready"!=e.g.keySystem&&"com.chromecast.playready"!=e.g.keySystem||function(e){var t=ve(e.body,!0,!0);if(t.includes("PlayReadyKeyMessage")){B.debug("Unwrapping PlayReady request.");for(var n=(t=(new DOMParser).parseFromString(t,"application/xml")).getElementsByTagName("HttpHeader"),r=0;r<n.length;++r)e.headers[n[r].getElementsByTagName("name")[0].textContent]=n[r].getElementsByTagName("value")[0].textContent;e.body=Se.Ja(t.getElementsByTagName("Challenge")[0].textContent).buffer}else B.debug("PlayReady request is already unwrapped."),e.headers["Content-Type"]="text/xml; charset=utf-8"}(i),e.g.keySystem.startsWith("com.apple.fps")&&e.j.fairPlayTransform&&function(e){var t=new Uint8Array(e.body);t="spc="+Se.Mc(t),e.headers["Content-Type"]="application/x-www-form-urlencoded",e.body=be(t)}(i);var a=Date.now();e.J.Ib.request(2,i).promise.then(function(e){return this.i?Promise.reject():(this.g.keySystem.startsWith("com.apple.fps")&&this.j.fairPlayTransform&&function(e){try{var t=ye(e.data)}catch(n){return}"<ckc>"===(t=t.trim()).substr(0,5)&&"</ckc>"===t.substr(-6)&&(t=t.slice(5,-6));try{t=JSON.parse(t).ckc}catch(n){}e.data=Se.Ja(t).buffer}(e),this.P+=(Date.now()-a)/1e3,B.K("Updating session",n.sessionId),n.update(e.data).then(function(){var e=this;this.J.onEvent(new Ve("drmsessionupdate")),r&&(r.Ga&&r.Ga.resolve(),new Le((function(){r.loaded=!0,Ot(e)&&e.A.resolve()})).V(Ft))}.bind(this)))}.bind(e),function(e){this.i||(e=new J(2,6,6007,e),this.l(e),r&&r.Ga&&r.Ga.reject(e))}.bind(e)).catch(function(e){this.i||(e=new J(2,6,6008,e.message),this.l(e),r&&r.Ga&&r.Ga.reject(e))}.bind(e))}function Mt(){var e=[{contentType:'video/mp4; codecs="avc1.42E01E"'},{contentType:'video/webm; codecs="vp8"'}],t=[{videoCapabilities:e,persistentState:"required",sessionTypes:["persistent-license"]},{videoCapabilities:e}],n=new Map;return e="org.w3.clearkey com.widevine.alpha com.microsoft.playready com.apple.fps.3_0 com.apple.fps.2_0 com.apple.fps.1_0 com.apple.fps com.adobe.primetime".split(" ").map((function(e){return r=e,p((function e(){var i,o,a;return M(e,(function(e){switch(e.s){case 1:return x(e,2),k(e,navigator.requestMediaKeySystemAccess(r,t),4);case 4:return i=e.B,a=!!(o=i.getConfiguration().sessionTypes)&&o.includes("persistent-license"),gt("Tizen 3")&&(a=!1),n.set(r,{persistentState:a}),k(e,i.createMediaKeys(),5);case 5:L(e,0);break;case 2:I(e),n.set(r,null),T(e)}}))}));var r})),Promise.all(e).then((function(){return ut(n)}))}function Vt(e,t){var n=t.audio,r=t.video;if(n&&n.encrypted&&!It(e,n=Zt(n))||r&&r.encrypted&&!It(e,r=Zt(r)))return!1;var i=Lt(e.g);return 0==t.drmInfos.length||t.drmInfos.some((function(e){return e.keySystem==i}))}function Xt(e,t){if(!e.length)return t;if(!t.length)return e;for(var n=[],r=0;r<e.length;r++)for(var i=0;i<t.length;i++)if(e[r].keySystem==t[i].keySystem){var o=e[r];i=t[i];var a=[];a=(a=a.concat(o.initData||[])).concat(i.initData||[]);var s=[];s=(s=s.concat(o.keyIds)).concat(i.keyIds),n.push({keySystem:o.keySystem,licenseServerUri:o.licenseServerUri||i.licenseServerUri,distinctiveIdentifierRequired:o.distinctiveIdentifierRequired||i.distinctiveIdentifierRequired,persistentStateRequired:o.persistentStateRequired||i.persistentStateRequired,videoRobustness:o.videoRobustness||i.videoRobustness,audioRobustness:o.audioRobustness||i.audioRobustness,serverCertificate:o.serverCertificate||i.serverCertificate,initData:a,keyIds:s});break}return n}function Wt(e){return p((function t(){var n;return M(t,(function(t){if(1===t.s)return n=Array.from(e.h.keys()),e.h.clear(),k(t,Promise.all(n.map((function(e){return p((function t(){return M(t,(function(t){switch(t.s){case 1:return B.K("Closing session",e.sessionId),x(t,2),k(t,function(e){return p((function t(){var n;return M(t,(function(t){switch(t.s){case 1:return n=new Promise((function(e,t){new Le(t).V(Ut)})),x(t,2),k(t,Promise.race([Promise.all([e.close(),e.closed]),n]),4);case 4:L(t,0);break;case 2:I(t),B.v("Timeout waiting for session close"),T(t)}}))}))}(e),4);case 4:L(t,0);break;case 2:I(t),T(t)}}))}))}))),0)}))}))}function Ot(e){return at(e=e.h.values(),(function(e){return e.loaded}))}function Nt(t,n,r){!t.keySystem||"org.w3.clearkey"==t.keySystem&&t.licenseServerUri||(n.size&&(n=n.get(t.keySystem)||"",t.licenseServerUri=n),t.keyIds||(t.keyIds=[]),(r=r.get(t.keySystem))&&(t.distinctiveIdentifierRequired||(t.distinctiveIdentifierRequired=r.distinctiveIdentifierRequired),t.persistentStateRequired||(t.persistentStateRequired=r.persistentStateRequired),t.videoRobustness||(t.videoRobustness=r.videoRobustness),t.audioRobustness||(t.audioRobustness=r.audioRobustness),t.serverCertificate||(t.serverCertificate=r.serverCertificate)),e.cast&&e.cast.__platform__&&"com.microsoft.playready"==t.keySystem&&(t.keySystem="com.chromecast.playready"))}(r=wt.prototype).destroy=function(){var e=this;return p((function t(){return M(t,(function(t){switch(t.s){case 1:return e.i?k(t,e.ua,0):(e.i=!0,k(t,function(e){return p((function t(){return M(t,(function(t){switch(t.s){case 1:return e.u.release(),e.u=null,e.A.reject(),e.ea.stop(),e.ea=null,e.X.stop(),e.X=null,k(t,Wt(e),2);case 2:if(!e.m){t.I(3);break}return x(t,4),k(t,e.m.setMediaKeys(null),6);case 6:L(t,5);break;case 4:I(t);case 5:e.m=null;case 3:e.g=null,e.C.clear(),e.o=null,e.F=[],e.j=null,e.l=null,e.J=null,T(t)}}))}))}(e),4));case 4:e.ua.resolve(),t.I(0)}}))}))},r.configure=function(e){this.j=e},r.Ub=function(e){var t=this;if(!this.o)return this.u.ya(e,"encrypted",(function(){t.l(new J(2,6,6010))})),Promise.resolve();this.m=e,this.u.ya(this.m,"play",(function(){for(var e=0;e<t.M.length;e++)Dt(t,t.M[e]);t.va=!0,t.M=[]})),"webkitCurrentPlaybackTargetIsWireless"in this.m&&this.u.H(this.m,"webkitcurrentplaybacktargetiswirelesschanged",(function(){return Wt(t)})),e=(e=this.m.setMediaKeys(this.o)).catch((function(e){return Promise.reject(new J(2,6,6003,e.message))}));var n=Tt(this);return Promise.all([e,n]).then((function(){if(t.i)return Promise.reject();xt(t),t.g.initData.length||t.F.length||t.u.H(t.m,"encrypted",(function(e){return Et(t,e.initDataType,new Uint8Array(e.initData))}))})).catch((function(e){if(!t.i)return Promise.reject(e)}))},r.Xb=function(){for(var e=1/0,t=this.h.keys(),n=(t=h(t)).next();!n.done;n=t.next())n=n.value,isNaN(n.expiration)||(e=Math.min(e,n.expiration));return e},r.ye=function(e){this.m&&this.j.delayLicenseRequestUntilPlayed&&this.m.paused&&!this.va?this.M.push(e):Dt(this,e)},r.we=function(e){e=e.target,B.O("Key status changed for session",e.sessionId);var t=this.h.get(e),n=!1;e.keyStatuses.forEach(function(e,r){if("string"==typeof r){var i=r;r=e,e=i}if("com.microsoft.playready"==this.g.keySystem&&16==r.byteLength&&(gt("Trident/")||navigator.userAgent.match(/Edge?\//))){var o=(i=new DataView(r)).getUint32(0,!0),a=i.getUint16(4,!0),s=i.getUint16(6,!0);i.setUint32(0,o,!1),i.setUint16(4,a,!1),i.setUint16(6,s,!1)}"com.microsoft.playready"==this.g.keySystem&&"status-pending"==e&&(e="usable"),"status-pending"!=e&&(t.loaded=!0),"expired"==e&&(n=!0),i=Se.Nc(new Uint8Array(r)),this.wa.set(i,e)}.bind(this));var r=e.expiration-Date.now();(0>r||n&&1e3>r)&&t&&!t.Ga&&(B.debug("Session has expired",e.sessionId),this.h.delete(e),e.close().catch((function(){}))),Ot(this)&&(this.A.resolve(),this.X.V(Yt))};var Ut=1,Ft=5,Yt=.5;function Kt(){this.g=new muxjs.mp4.CaptionParser,this.l=[],this.j={}}function jt(){}function Ht(e){return!e||1==e.length&&1e-6>e.end(0)-e.start(0)?null:e.length?e.end(e.length-1):null}function Bt(e,t,n){return n=void 0===n?0:n,!(!e||!e.length||1==e.length&&1e-6>e.end(0)-e.start(0)||t>e.end(e.length-1))&&t+n>=e.start(0)}function Jt(e,t){if(!e||!e.length||1==e.length&&1e-6>e.end(0)-e.start(0))return 0;for(var n=0,r=e.length-1;0<=r&&e.end(r)>t;--r)n+=e.end(r)-Math.max(e.start(r),t);return n}function zt(e){if(!e)return[];for(var t=[],n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}function Qt(e,t,n){this.startTime=e,this.direction=rn,this.endTime=t,this.payload=n,this.region=new hn,this.position=null,this.positionAlign=qt,this.size=0,this.textAlign=$t,this.writingMode=on,this.lineInterpretation=an,this.line=null,this.lineHeight="",this.lineAlign=sn,this.displayAlign=tn,this.fontSize=this.backgroundImage=this.backgroundColor=this.color="",this.fontWeight=cn,this.fontStyle=ln,this.fontFamily="",this.textDecoration=[],this.wrapLine=!0,this.id="",this.nestedCues=[],this.spacer=!1}Kt.prototype.init=function(e){var t=muxjs.mp4.probe;e=new Uint8Array(e),this.l=t.videoTrackIds(e),this.j=t.timescale(e),this.g.init()},Kt.prototype.h=function(e,t){var n=new Uint8Array(e);(n=this.g.parse(n,this.l,this.j))&&n.captions&&t(n.captions),this.g.clearParsedCaptions()},Kt.prototype.i=function(){this.g.resetCaptionStream()},jt.prototype.init=function(){},jt.prototype.h=function(){},jt.prototype.i=function(){},U("shaka.text.Cue",Qt),Qt.prototype.clone=function(){var e,t=new Qt(0,0,"");for(e in this)t[e]=this[e],t[e]&&t[e].constructor==Array&&(t[e]=t[e].slice());return t};var qt="auto";Qt.positionAlign={LEFT:"line-left",RIGHT:"line-right",CENTER:"center",AUTO:qt};var $t="center",en={LEFT:"left",RIGHT:"right",CENTER:$t,START:"start",END:"end"};Qt.textAlign=en;var tn="after",nn={BEFORE:"before",CENTER:"center",AFTER:tn};Qt.displayAlign=nn;var rn="ltr";Qt.direction={HORIZONTAL_LEFT_TO_RIGHT:rn,HORIZONTAL_RIGHT_TO_LEFT:"rtl"};var on="horizontal-tb";Qt.writingMode={HORIZONTAL_TOP_TO_BOTTOM:on,VERTICAL_LEFT_TO_RIGHT:"vertical-lr",VERTICAL_RIGHT_TO_LEFT:"vertical-rl"};var an=0;Qt.lineInterpretation={LINE_NUMBER:an,PERCENTAGE:1};var sn="start",un={CENTER:"center",START:sn,END:"end"};Qt.lineAlign=un;var cn=400;Qt.fontWeight={NORMAL:cn,BOLD:700};var ln="normal",dn={NORMAL:ln,ITALIC:"italic",OBLIQUE:"oblique"};function hn(){this.id="",this.regionAnchorY=this.regionAnchorX=this.viewportAnchorY=this.viewportAnchorX=0,this.height=this.width=100,this.viewportAnchorUnits=this.widthUnits=this.heightUnits=fn,this.scroll=pn}Qt.fontStyle=dn,Qt.textDecoration={UNDERLINE:"underline",LINE_THROUGH:"lineThrough",OVERLINE:"overline"},U("shaka.text.CueRegion",hn);var fn=1;hn.units={PX:0,PERCENTAGE:fn,LINES:2};var pn="";function mn(e){this.l=null,this.i=e,this.j=this.A=0,this.m=1/0,this.h=this.g=null,this.u="",this.o=new Map}hn.scrollMode={NONE:pn,UP:"up"};var yn={};function vn(t){return!!(yn[t]||e.muxjs&&"application/cea-608"==t)}function gn(e,t){"application/cea-608"!=t&&(e.l=new yn[t])}function bn(e,t,n,r,i){for(var o=n+" "+r,a=new Map,s=(t=h(t)).next();!s.done;s=t.next()){var u=s.value;s=u.stream,a.has(s)||a.set(s,new Map),a.get(s).has(o)||a.get(s).set(o,[]),u.startTime+=i,u.endTime+=i,u.startTime>=e.j&&u.startTime<e.m&&(u=new Qt(u.startTime,u.endTime,u.text),a.get(s).get(o).push(u),s==e.u&&e.i.append([u]))}for(o=(i=h(a.keys())).next();!o.done;o=i.next())for(o=o.value,e.o.has(o)||e.o.set(o,new Map),s=(t=h(a.get(o).keys())).next();!s.done;s=t.next())s=s.value,u=a.get(o).get(s),e.o.get(o).set(s,u);e.g=null==e.g?Math.max(n,e.j):Math.min(e.g,Math.max(n,e.j)),e.h=Math.max(e.h,Math.min(r,e.m))}function An(e,t,n){this.j=e,this.l=n,this.h={},this.g=null,this.i={},this.o=new et,this.F=!1,this.u={},this.A=t,this.C=new me,this.m=function(e,t){var n=new MediaSource;return e.o.ya(n,"sourceopen",(function(){URL.revokeObjectURL(e.J),t.resolve()})),e.J=_n(n),e.j.src=e.J,n}(this,this.C),this.J=""}U("shaka.text.TextEngine.registerParser",(function(e,t){yn[e]=t})),U("shaka.text.TextEngine.unregisterParser",(function(e){delete yn[e]})),mn.prototype.destroy=function(){return this.i=this.l=null,this.o.clear(),Promise.resolve()},mn.prototype.xc=function(e){try{return this.l.parseMedia(new Uint8Array(e),{periodStart:0,segmentStart:null,segmentEnd:0})[0].startTime}catch(t){throw new J(2,2,2009,t)}},mn.prototype.remove=function(e,t){return Promise.resolve().then(function(){!this.i||!this.i.remove(e,t)||null==this.g||t<=this.g||e>=this.h||(e<=this.g&&t>=this.h?this.g=this.h=null:e<=this.g&&t<this.h?this.g=t:e>this.g&&t>=this.h&&(this.h=e))}.bind(this))};var _n=e.URL.createObjectURL;function wn(e){var t=ct(e.mimeType,e.codecs),n=function(e){var t=[e.mimeType];return ht.forEach((function(n,r){var i=e[r];i&&t.push(n+'="'+i+'"')})),t.join(";")}(e);return vn(t)||MediaSource.isTypeSupported(n)||Te(t,e.type)}function Sn(e,t){e.g||(e.g=new mn(e.l)),gn(e.g,t)}function kn(e){return!e.m||"ended"==e.m.readyState}function Tn(e,t){if("text"==t)var n=e.g.g;else n=!(n=En(e,t))||1==n.length&&1e-6>n.end(0)-n.start(0)?null:1==n.length&&0>n.start(0)?0:n.length?n.start(0):null;return n}function xn(e,t){return"text"==t?e.g.h:Ht(En(e,t))}function En(e,t){try{return e.h[t].buffered}catch(n){return t in e.h&&B.error("failed to get buffered range for "+t,n),null}}function Ln(t,n,r,i,o,a){return"text"==n?function(e,t,n,r){return Promise.resolve().then(function(){if(this.l&&this.i)if(null==n||null==r)this.l.parseInit(new Uint8Array(t));else{var e={periodStart:this.A,segmentStart:n,segmentEnd:r};e=this.l.parseMedia(new Uint8Array(t),e).filter(function(e){return e.startTime>=this.j&&e.startTime<this.m}.bind(this)),this.i.append(e),null==this.g&&(this.g=Math.max(n,this.j)),this.h=Math.min(r,this.m)}}.bind(e))}(t.g,r,i,o):t.u[n]?function(e,t){e.j=!0,e.h=new me,e.l=[],e.i=[];var n=new Uint8Array(t);return e.g.push(n),e.g.flush(),e.j&&e.h.reject(new J(2,3,3018)),e.h}(t.u[n],r).then(function(e){return this.g||Sn(this,"text/vtt"),e.captions&&e.captions.length&&bn(this.g,e.captions,i,o,this.h.video.timestampOffset),Zn(this,n,this.Me.bind(this,n,e.data.buffer))}.bind(t)):(a&&e.muxjs&&(t.g||Sn(t,"text/vtt"),null==i&&null==o?t.A.init(r):t.A.h(r,(function(e){e.length&&bn(t.g,e,i,o,t.h.video.timestampOffset)}))),Zn(t,n,t.Me.bind(t,n,r)))}function In(e,t){var n=xn(e,"video")||0;!function(e,t,n){if(e.u=t,t=e.o.get(t))for(var r=h(t.keys()),i=r.next();!i.done;i=r.next())(i=t.get(i.value).filter((function(e){return e.endTime<=n})))&&e.i.append(i)}(e.g,t,n)}function Rn(e,t){return"text"==t?e.g?(e.A.i(),e.g.remove(0,1/0)):Promise.resolve():Zn(e,t,e.Ne.bind(e,t,0,e.m.duration))}function Zn(e,t,n){if(e.F)return Promise.reject();if(n={start:n,p:new me},e.i[t].push(n),1==e.i[t].length)try{n.start()}catch(r){"QuotaExceededError"==r.name?n.p.reject(new J(2,3,3017,t)):n.p.reject(new J(2,3,3015,r)),Pn(e,t)}return n.p}function Cn(e,t){if(e.F)return Promise.reject();var n,r=[];for(n in e.h){var i=new me,o={start:function(e){e.resolve()}.bind(null,i),p:i};e.i[n].push(o),r.push(i),1==e.i[n].length&&o.start()}return Promise.all(r).then(function(){try{t()}catch(r){var e=Promise.reject(new J(2,3,3015,r))}for(var n in this.h)Pn(this,n);return e}.bind(e),function(e){throw e}.bind(e))}function Pn(e,t){e.i[t].shift();var n=e.i[t][0];if(n)try{n.start()}catch(r){n.p.reject(new J(2,3,3015,r)),Pn(e,t)}}function Gn(e,t){return e=Mn(e),t=Mn(t),e.split("-")[0]==t.split("-")[0]}function Dn(e,t){e=Mn(e),t=Mn(t);var n=e.split("-"),r=t.split("-");return n[0]==r[0]&&1==n.length&&2==r.length}function Mn(e){var t=e.split("-");return e=t[0]||"",t=t[1]||"",e=e.toLowerCase(),e=Wn.get(e)||e,(t=t.toUpperCase())?e+"-"+t:e}function Vn(e){return e.language?Mn(e.language):e.audio&&e.audio.language?Mn(e.audio.language):e.video&&e.video.language?Mn(e.video.language):"und"}function Xn(e,t){for(var n=Mn(e),r=new Set,i=h(t),o=i.next();!o.done;o=i.next())r.add(Mn(o.value));for(o=(i=h(r)).next();!o.done;o=i.next())if((o=o.value)==n)return o;for(o=(i=h(r)).next();!o.done;o=i.next())if(Dn(o=o.value,n))return o;for(o=(i=h(r)).next();!o.done;o=i.next()){var a=o=o.value,s=n;if(a=Mn(a),s=Mn(s),a=a.split("-"),s=s.split("-"),2==a.length&&2==s.length&&a[0]==s[0])return o}for(o=(r=h(r)).next();!o.done;o=r.next())if(Dn(n,i=o.value))return i;return null}(r=An.prototype).destroy=function(){var e=this;this.F=!0;var t,n=[];for(t in this.i){var r=this.i[t],i=r[0];for(this.i[t]=r.slice(0,1),i&&n.push(i.p.catch(le.Bc)),i=1;i<r.length;++i)r[i].p.reject()}for(var o in this.g&&n.push(this.g.destroy()),this.l&&n.push(this.l.destroy()),this.u)n.push(this.u[o].destroy());return Promise.all(n).then((function(){e.o&&(e.o.release(),e.o=null),e.j&&(e.j.removeAttribute("src"),e.j.load(),e.j=null),e.m=null,e.g=null,e.l=null,e.h={},e.u={},e.A=null,e.i={}}))},r.init=function(e,t){var n=this;return p((function r(){var i;return M(r,(function(r){switch(r.s){case 1:return i=fe,k(r,n.C,2);case 2:e.forEach((function(e,r){var o=ct(e.mimeType,e.codecs);r==i.za?Sn(n,o):(!t&&MediaSource.isTypeSupported(o)||!Te(o,r)||(n.u[r]=new ke,o=xe(r,o)),o=n.m.addSourceBuffer(o),n.o.H(o,"error",n.Dg.bind(n,r)),n.o.H(o,"updateend",n.Lb.bind(n,r)),n.h[r]=o,n.i[r]=[])})),T(r)}}))}))},r.bd=function(e){if(e.total=zt(this.j.buffered),e.audio=zt(En(this,"audio")),e.video=zt(En(this,"video")),e.text=[],this.g){var t=this.g.g,n=this.g.h;null!=t&&null!=n&&e.text.push({start:t,end:n})}},r.remove=function(e,t,n){return"text"==e?this.g.remove(t,n):Zn(this,e,this.Ne.bind(this,e,t,n))},r.flush=function(e){return"text"==e?Promise.resolve():Zn(this,e,this.lf.bind(this,e))},r.endOfStream=function(e){return Cn(this,function(){kn(this)||(e?this.m.endOfStream(e):this.m.endOfStream())}.bind(this))},r.Fa=function(e){return Cn(this,function(){this.m.duration=e}.bind(this))},r.ha=function(){return this.m.duration},r.Me=function(e,t){this.h[e].appendBuffer(t)},r.Ne=function(e,t,n){n<=t?this.Lb(e):this.h[e].remove(t,n)},r.Ve=function(e){var t=this.h[e].appendWindowStart,n=this.h[e].appendWindowEnd;this.h[e].abort(),this.h[e].appendWindowStart=t,this.h[e].appendWindowEnd=n,this.Lb(e)},r.lf=function(e){this.j.currentTime-=.001,this.Lb(e)},r.Cg=function(e,t){0>t&&(t+=.001),this.h[e].timestampOffset=t,this.Lb(e)},r.zg=function(e,t,n){this.h[e].appendWindowStart=0,this.h[e].appendWindowEnd=n,this.h[e].appendWindowStart=t,this.Lb(e)},r.Dg=function(e){this.i[e][0].p.reject(new J(2,3,3014,this.j.error?this.j.error.code:0))},r.Lb=function(e){var t=this.i[e][0];t&&(t.p.resolve(),Pn(this,e))};var Wn=new Map([["aar","aa"],["abk","ab"],["afr","af"],["aka","ak"],["alb","sq"],["amh","am"],["ara","ar"],["arg","an"],["arm","hy"],["asm","as"],["ava","av"],["ave","ae"],["aym","ay"],["aze","az"],["bak","ba"],["bam","bm"],["baq","eu"],["bel","be"],["ben","bn"],["bih","bh"],["bis","bi"],["bod","bo"],["bos","bs"],["bre","br"],["bul","bg"],["bur","my"],["cat","ca"],["ces","cs"],["cha","ch"],["che","ce"],["chi","zh"],["chu","cu"],["chv","cv"],["cor","kw"],["cos","co"],["cre","cr"],["cym","cy"],["cze","cs"],["dan","da"],["deu","de"],["div","dv"],["dut","nl"],["dzo","dz"],["ell","el"],["eng","en"],["epo","eo"],["est","et"],["eus","eu"],["ewe","ee"],["fao","fo"],["fas","fa"],["fij","fj"],["fin","fi"],["fra","fr"],["fre","fr"],["fry","fy"],["ful","ff"],["geo","ka"],["ger","de"],["gla","gd"],["gle","ga"],["glg","gl"],["glv","gv"],["gre","el"],["grn","gn"],["guj","gu"],["hat","ht"],["hau","ha"],["heb","he"],["her","hz"],["hin","hi"],["hmo","ho"],["hrv","hr"],["hun","hu"],["hye","hy"],["ibo","ig"],["ice","is"],["ido","io"],["iii","ii"],["iku","iu"],["ile","ie"],["ina","ia"],["ind","id"],["ipk","ik"],["isl","is"],["ita","it"],["jav","jv"],["jpn","ja"],["kal","kl"],["kan","kn"],["kas","ks"],["kat","ka"],["kau","kr"],["kaz","kk"],["khm","km"],["kik","ki"],["kin","rw"],["kir","ky"],["kom","kv"],["kon","kg"],["kor","ko"],["kua","kj"],["kur","ku"],["lao","lo"],["lat","la"],["lav","lv"],["lim","li"],["lin","ln"],["lit","lt"],["ltz","lb"],["lub","lu"],["lug","lg"],["mac","mk"],["mah","mh"],["mal","ml"],["mao","mi"],["mar","mr"],["may","ms"],["mkd","mk"],["mlg","mg"],["mlt","mt"],["mon","mn"],["mri","mi"],["msa","ms"],["mya","my"],["nau","na"],["nav","nv"],["nbl","nr"],["nde","nd"],["ndo","ng"],["nep","ne"],["nld","nl"],["nno","nn"],["nob","nb"],["nor","no"],["nya","ny"],["oci","oc"],["oji","oj"],["ori","or"],["orm","om"],["oss","os"],["pan","pa"],["per","fa"],["pli","pi"],["pol","pl"],["por","pt"],["pus","ps"],["que","qu"],["roh","rm"],["ron","ro"],["rum","ro"],["run","rn"],["rus","ru"],["sag","sg"],["san","sa"],["sin","si"],["slk","sk"],["slo","sk"],["slv","sl"],["sme","se"],["smo","sm"],["sna","sn"],["snd","sd"],["som","so"],["sot","st"],["spa","es"],["sqi","sq"],["srd","sc"],["srp","sr"],["ssw","ss"],["sun","su"],["swa","sw"],["swe","sv"],["tah","ty"],["tam","ta"],["tat","tt"],["tel","te"],["tgk","tg"],["tgl","tl"],["tha","th"],["tib","bo"],["tir","ti"],["ton","to"],["tsn","tn"],["tso","ts"],["tuk","tk"],["tur","tr"],["twi","tw"],["uig","ug"],["ukr","uk"],["urd","ur"],["uzb","uz"],["ven","ve"],["vie","vi"],["vol","vo"],["wel","cy"],["wln","wa"],["wol","wo"],["xho","xh"],["yid","yi"],["yor","yo"],["zha","za"],["zho","zh"],["zul","zu"]]),On={$d:function(e,t){var n=e.periods.reduce((function(e,t){return e.concat(t.variants)}),[]);n=On.ee(n,t),n=On.Lf(n),n=On.jf(n);for(var r=On.kf(n),i=(n=h(e.periods)).next();!i.done;i=n.next())(i=i.value).variants=i.variants.filter((function(e){return On.he(e)==r||(B.debug("Dropping Variant (better codec available)",e),!1)}))},Lf:function(e){for(var t=new Xe,n=(e=h(e)).next();!n.done;n=e.next()){n=n.value;var r=On.he(n);t.push(r,n)}return t},jf:function(e){var t=0,n=new Map,r=e.size();return e.forEach((function(e,i){for(var o=h(i),a=o.next();!a.done;a=o.next()){var s=(a=a.value).video;if(s&&s.width&&s.height){s=s.width*s.height*(s.frameRate||1),n.has(s)||n.set(s,new Xe);var u=n.get(s);u.push(e,a),u.size()===r&&(t=Math.max(t,s))}}})),t?n.get(t):e},kf:function(e){var t="",n=1/0;return e.forEach((function(e,r){for(var i=0,o=0,a=h(r),s=a.next();!s.done;s=a.next())i+=s.value.bandwidth||0,++o;i/=o,B.debug("codecs",e,"avg bandwidth",i),i<n&&(t=e,n=i)})),t},he:function(e){var t="";e.video&&(t=dt(e.video.codecs)[0]);var n="";return e.audio&&(n=dt(e.audio.codecs)[0]),t+"-"+n},rd:function(e,t,n){function r(e,t,n){return e>=t&&e<=n}var i=e.video;return!(i&&i.width&&i.height&&(!r(i.width,t.minWidth,Math.min(t.maxWidth,n.width))||!r(i.height,t.minHeight,Math.min(t.maxHeight,n.height))||!r(i.width*i.height,t.minPixels,t.maxPixels))||e&&e.video&&e.video.frameRate&&!r(e.video.frameRate,t.minFrameRate,t.maxFrameRate)||!r(e.bandwidth,t.minBandwidth,t.maxBandwidth))},Xd:function(e,t,n){var r=!1;return e.forEach((function(e){var i=e.allowedByApplication;e.allowedByApplication=On.rd(e,t,n),i!=e.allowedByApplication&&(r=!0)})),r},filterNewPeriod:function(e,t,n,r){r.variants=r.variants.filter((function(r){if(e&&e.Z&&!Vt(e,r))return B.debug("Dropping variant - not compatible with key system",r),!1;var i=r.audio;return r=r.video,i&&!wn(i)?(B.debug("Dropping variant - audio not compatible with platform",On.fb(i)),!1):r&&!wn(r)||gt("Xbox One")&&r&&(r.width&&1920<r.width||r.height&&1080<r.height)&&r.codecs.includes("avc1.")?(B.debug("Dropping variant - video not compatible with platform",On.fb(r)),!1):i&&t&&!On.Yd(i,t)?(B.debug("Droping variant - not compatible with active audio","active audio",On.fb(t),"variant.audio",On.fb(i)),!1):!(r&&n&&!On.Yd(r,n)&&(B.debug("Droping variant - not compatible with active video","active video",On.fb(n),"variant.video",On.fb(r)),1))})),r.textStreams=r.textStreams.filter((function(e){var t=vn(ct(e.mimeType,e.codecs));return t||B.debug("Dropping text stream. Is not supported by the platform.",e),t}))},Yd:function(e,t){return e.mimeType==t.mimeType&&e.codecs.split(".")[0]==t.codecs.split(".")[0]},Oc:function(e){var t=e.audio,n=e.video,r=t?t.codecs:null,i=n?n.codecs:null,o=[];i&&o.push(i),r&&o.push(r);var a=[];n&&a.push(n.mimeType),t&&a.push(t.mimeType),a=a[0]||null;var s=[];t&&s.push(t.kind),n&&s.push(n.kind),s=s[0]||null;var u=new Set;return t&&t.roles.forEach((function(e){return u.add(e)})),n&&n.roles.forEach((function(e){return u.add(e)})),e={id:e.id,active:!1,type:"variant",bandwidth:e.bandwidth,language:e.language,label:null,kind:s,width:null,height:null,frameRate:null,pixelAspectRatio:null,mimeType:a,codecs:o.join(", "),audioCodec:r,videoCodec:i,primary:e.primary,roles:Array.from(u),audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioSamplingRate:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null},n&&(e.videoId=n.id,e.originalVideoId=n.originalId,e.width=n.width||null,e.height=n.height||null,e.frameRate=n.frameRate||null,e.pixelAspectRatio=n.pixelAspectRatio||null,e.videoBandwidth=n.bandwidth||null),t&&(e.audioId=t.id,e.originalAudioId=t.originalId,e.channelsCount=t.channelsCount,e.audioSamplingRate=t.audioSamplingRate,e.audioBandwidth=t.bandwidth||null,e.label=t.label,e.audioRoles=t.roles),e},Kc:function(e){return{id:e.id,active:!1,type:"text",bandwidth:0,language:e.language,label:e.label,kind:e.kind||null,width:null,height:null,frameRate:null,pixelAspectRatio:null,mimeType:e.mimeType,codecs:e.codecs||null,audioCodec:null,videoCodec:null,primary:e.primary,roles:e.roles,audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioSamplingRate:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:e.originalId}},gd:function(e){return e.__shaka_id||(e.__shaka_id=On.Uf++),e.__shaka_id},Uf:0,Of:function(e){var t=On.ke(e);return t.active="disabled"!=e.mode,t.type="text",t.originalTextId=e.id,"captions"==e.kind&&(t.mimeType="application/cea-608"),e.kind&&(t.roles=[e.kind]),t},je:function(e){var t=On.ke(e);return t.active=e.enabled,t.type="variant",t.originalAudioId=e.id,"main"==e.kind&&(t.primary=!0),e.kind&&(t.roles=[e.kind],t.audioRoles=[e.kind]),t},ke:function(e){return{id:On.gd(e),active:!1,type:"",bandwidth:0,language:Mn(e.language),label:e.label,kind:e.kind,width:null,height:null,frameRate:null,pixelAspectRatio:null,mimeType:null,codecs:null,audioCodec:null,videoCodec:null,primary:!1,roles:[],audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioSamplingRate:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null}},Gb:function(e){return e.allowedByApplication&&e.allowedByKeySystem},Bf:function(e){return e.filter((function(e){return On.Gb(e)}))},ee:function(e,t){for(var n=e.filter((function(e){return e.audio&&e.audio.channelsCount})),r=new Map,i=(n=h(n)).next();!i.done;i=n.next()){var o=(i=i.value).audio.channelsCount;r.has(o)||r.set(o,[]),r.get(o).push(i)}return 0==(n=Array.from(r.keys())).length?e:(i=n.filter((function(e){return e<=t}))).length?r.get(Math.max.apply(null,i)):r.get(Math.min.apply(null,n))},Wb:function(e,t,n){var r=e,i=e.filter((function(e){return e.primary}));i.length&&(r=i);var o=r.length?r[0].language:"";if(r=r.filter((function(e){return e.language==o})),t){var a=Xn(Mn(t),e.map((function(e){return e.language})));a&&(r=e.filter((function(e){return Mn(e.language)==a})))}if(n){if((e=On.de(r,n)).length)return e;B.v("No exact match for the text role could be found.")}else if((e=r.filter((function(e){return 0==e.roles.length}))).length)return e;return(e=r.map((function(e){return e.roles})).reduce(le.Rc,[])).length?On.de(r,e[0]):r},de:function(e,t){return e.filter((function(e){return e.roles.includes(t)}))},ie:function(e,t,n){for(var r=0;r<n.length;r++)if(n[r].audio==e&&n[r].video==t)return n[r];return null},Pf:function(e){return"audio"==e.type},Sf:function(e){return"video"==e.type},Kf:function(e){var t=[];return e.audio&&t.push(e.audio),e.video&&t.push(e.video),t},fb:function(e){return On.Pf(e)?"type=audio codecs="+e.codecs+" bandwidth="+e.bandwidth+" channelsCount="+e.channelsCount+" audioSamplingRate="+e.audioSamplingRate:On.Sf(e)?"type=video codecs="+e.codecs+" bandwidth="+e.bandwidth+" frameRate="+e.frameRate+" width="+e.width+" height="+e.height:"unexpected stream type"}};function Nn(){this.m=null,this.i=!1,this.h=new H,this.l=[],this.o=!1,this.g=this.j=null}function Un(e,t){return e&&(t=t.filter((function(t){return On.rd(t,e,{width:1/0,height:1/0})}))),t.sort((function(e,t){return e.bandwidth-t.bandwidth}))}function Fn(e,t){this.g=e,this.h=t}function Yn(e,t){var n=new Fn(2,6),r=Hn,i=r.g,o=n.h-i.h;(0<(n.g-i.g||o)?r.i:r.h)(r.g,n,e,t)}function Kn(e,t,n,r){B.ba([n,"has been deprecated and will be removed in",t,". We are currently at version",e,". Additional information:",r].join(" "))}function jn(e,t,n,r){B.kc([n,"has been deprecated and has been removed in",t,". We are now at version",e,". Additional information:",r].join(""))}U("shaka.abr.SimpleAbrManager",Nn),Nn.prototype.stop=function(){this.m=null,this.i=!1,this.l=[],this.j=null},Nn.prototype.stop=Nn.prototype.stop,Nn.prototype.init=function(e){this.m=e},Nn.prototype.init=Nn.prototype.init,Nn.prototype.chooseVariant=function(){var e=Un(this.g.restrictions,this.l),t=this.h.getBandwidthEstimate(this.g.defaultBandwidthEstimate);this.l.length&&!e.length&&(B.v("No variants met the ABR restrictions. Choosing a variant by lowest bandwidth."),e=[(e=Un(null,this.l))[0]]);for(var n=e[0]||null,r=0;r<e.length;++r){var i=e[r],o=i.bandwidth/this.g.bandwidthDowngradeTarget,a=(e[r+1]||{bandwidth:1/0}).bandwidth/this.g.bandwidthUpgradeTarget;B.O("Bandwidth ranges:",(i.bandwidth/1e6).toFixed(3),(o/1e6).toFixed(3),(a/1e6).toFixed(3)),t>=o&&t<=a&&(n=i)}return this.j=Date.now(),n},Nn.prototype.chooseVariant=Nn.prototype.chooseVariant,Nn.prototype.enable=function(){this.i=!0},Nn.prototype.enable=Nn.prototype.enable,Nn.prototype.disable=function(){this.i=!1},Nn.prototype.disable=Nn.prototype.disable,Nn.prototype.segmentDownloaded=function(e,t){B.O("Segment downloaded:","deltaTimeMs="+e,"numBytes="+t,"lastTimeChosenMs="+this.j,"enabled="+this.i);var n=this.h;if(!(16e3>t)){var r=8e3*t/e,i=e/1e3;n.g+=t,K(n.h,i,r),K(n.i,i,r)}if(null!=this.j&&this.i)e:{if(B.O("Suggesting Streams..."),this.o){if(Date.now()-this.j<1e3*this.g.switchInterval){B.O("Still within switch interval...");break e}}else{if(!(128e3<=this.h.g)){B.O("Still waiting for a good estimate...");break e}this.o=!0}n=this.chooseVariant(),r=this.h.getBandwidthEstimate(this.g.defaultBandwidthEstimate),B.debug("Calling switch_(), bandwidth="+Math.round(r/1e3)+" kbps"),this.m(n)}},Nn.prototype.segmentDownloaded=Nn.prototype.segmentDownloaded,Nn.prototype.getBandwidthEstimate=function(){return this.h.getBandwidthEstimate(this.g.defaultBandwidthEstimate)},Nn.prototype.getBandwidthEstimate=Nn.prototype.getBandwidthEstimate,Nn.prototype.setVariants=function(e){this.l=e},Nn.prototype.setVariants=Nn.prototype.setVariants,Nn.prototype.configure=function(e){this.g=e},Nn.prototype.configure=Nn.prototype.configure,Fn.prototype.toString=function(){return"v"+this.g+"."+this.h};var Hn=null,Bn="ended play playing pause pausing ratechange seeked seeking timeupdate volumechange".split(" "),Jn="buffered currentTime duration ended loop muted paused playbackRate seeking videoHeight videoWidth volume".split(" "),zn=["loop","playbackRate"],Qn=["pause","play"],qn="abrstatuschanged adaptation buffering drmsessionupdate emsg error expirationupdated largegap loading manifestparsed onstatechange onstateidle streaming textchanged texttrackvisibility timelineregionadded timelineregionenter timelineregionexit trackschanged unloading variantchanged".split(" "),$n={getAssetUri:2,getAudioLanguages:4,getAudioLanguagesAndRoles:4,getBufferedInfo:2,getConfiguration:2,getExpiration:2,getPlaybackRate:2,getTextLanguages:4,getTextLanguagesAndRoles:4,getTextTracks:2,getStats:5,getVariantTracks:2,isAudioOnly:10,isBuffering:1,isInProgress:1,isLive:10,isTextTrackVisible:1,keySystem:10,seekRange:1,usingEmbeddedTextTrack:2,getLoadMode:10},er={getPlayheadTimeAsDate:1,getPresentationStartTimeAsDate:20},tr=[["getConfiguration","configure"]],nr=[["isTextTrackVisible","setTextTrackVisibility"]],rr="addTextTrack cancelTrickPlay configure resetConfiguration retryStreaming selectAudioLanguage selectEmbeddedTextTrack selectTextLanguage selectTextTrack selectVariantTrack selectVariantsByLabel setTextTrackVisibility trickPlay".split(" "),ir=["attach","detach","load","unload"];function or(e){return JSON.stringify(e,(function(e,t){if("function"!=typeof t){if(t instanceof Event||t instanceof Ve){var n={};for(i in t){var r=t[i];r&&"object"==typeof r?"detail"==i&&(n[i]=r):i in Event||(n[i]=r)}return n}if(t instanceof Error){var i=new Set(["name","message","stack"]);for(n in t)i.add(n);for(n=(r=h(Object.getOwnPropertyNames(t))).next();!n.done;n=r.next())i.add(n.value);for(r={},n=(i=h(i)).next();!n.done;n=i.next())r[n=n.value]=t[n];i={__type__:"Error",contents:r}}else if(t instanceof TimeRanges)for(i={__type__:"TimeRanges",length:t.length,start:[],end:[]},n=0;n<t.length;++n)i.start.push(t.start(n)),i.end.push(t.end(n));else i=t instanceof Uint8Array?{__type__:"Uint8Array",entries:Array.from(t)}:"number"==typeof t?isNaN(t)?"NaN":isFinite(t)?t:0>t?"-Infinity":"Infinity":t;return i}}))}function ar(e){return JSON.parse(e,(function(e,t){if("NaN"==t)var n=NaN;else if("-Infinity"==t)n=-1/0;else if("Infinity"==t)n=1/0;else if(t&&"object"==typeof t&&"TimeRanges"==t.__type__)n=function(e){return{length:e.length,start:function(t){return e.start[t]},end:function(t){return e.end[t]}}}(t);else if(t&&"object"==typeof t&&"Uint8Array"==t.__type__)n=new Uint8Array(t.entries);else if(t&&"object"==typeof t&&"Error"==t.__type__){n=t.contents;var r,i=Error(n.message);for(r in n)i[r]=n[r];n=i}else n=t;return n}))}function sr(e,t,n,r,i,o){this.X=e,this.j=new Le(t),this.Z=n,this.u=!1,this.F=r,this.P=i,this.L=o,this.h=this.m=!1,this.M="",this.o=null,this.A=this.yd.bind(this),this.C=this.ag.bind(this),this.g={video:{},player:{}},this.J=0,this.i={},this.l=null,yr.add(this)}var ur=!1,cr=null;function lr(e){for(var t=h(yr),n=t.next();!n.done;n=t.next())dr(n.value,e)}function dr(e,t){B.debug("CastSender: onExistingSessionJoined");var n=e.L();e.l=new me,e.u=!0,e.Ad(n,t)}function hr(e){for(var t=h(yr),n=t.next();!n.done;n=t.next()){n=n.value;var r=e;B.debug("CastSender: receiver status",r),ur="available"==r,n.j.Lc()}}function fr(e){var t=cr;t.removeUpdateListener(e.A),t.removeMessageListener("urn:x-cast:com.google.shaka.v2",e.C)}function pr(e){for(var t in e.i){var n=e.i[t];delete e.i[t],n.reject(new J(1,7,7e3))}}function mr(e,t){var n=or(t),r=cr;try{r.sendMessage("urn:x-cast:com.google.shaka.v2",n,(function(){}),B.error)}catch(kye){throw B.error("Cast session sendMessage threw",kye),n=new J(2,8,8005,kye),e.F("player",new Ve("error",{detail:n})),e.Bb(),n}}(r=sr.prototype).destroy=function(){return yr.delete(this),pr(this),cr&&fr(this),this.j&&(this.j.stop(),this.j=null),this.P=this.F=null,this.h=this.m=!1,this.C=this.A=this.l=this.i=this.g=this.o=null,Promise.resolve()},r.la=function(){return this.h},r.Dd=function(){return this.M},r.init=function(){if(this.X.length)if(e.chrome&&chrome.cast&&chrome.cast.isAvailable){this.m=!0,this.j.Lc();var t=new chrome.cast.SessionRequest(this.X);t=new chrome.cast.ApiConfig(t,lr.bind(this),hr.bind(this),"origin_scoped"),chrome.cast.initialize(t,(function(){B.debug("CastSender: init")}),(function(e){B.error("CastSender: init error",e)})),ur&&this.j.V(.02),(t=cr)&&t.status!=chrome.cast.SessionStatus.STOPPED?(B.debug("CastSender: re-using existing connection"),dr(this,t)):cr=null}else e.__onGCastApiAvailable||(e.__onGCastApiAvailable=vr),e.__onGCastApiAvailable!=vr&&B.ba("A global Cast SDK hook is already installed! Shaka Player will be unable to receive a notification when the Cast SDK is ready.")},r.Md=function(e){this.o=e,this.h&&mr(this,{type:"appData",appData:this.o})},r.cast=function(e){return this.m?ur?this.h?Promise.reject(new J(1,8,8002)):(this.l=new me,chrome.cast.requestSession(this.Ad.bind(this,e),this.ve.bind(this)),this.l):Promise.reject(new J(1,8,8001)):Promise.reject(new J(1,8,8e3))},r.Bb=function(){if(this.h){if(pr(this),cr){fr(this);try{cr.stop((function(){}),(function(){}))}catch(s){}cr=null}this.yd()}},r.get=function(e,t){if("video"==e){if(Qn.includes(t))return this.Ee.bind(this,e,t)}else if("player"==e){if(er[t]&&!this.get("player","isLive")())return function(){};if(rr.includes(t))return this.Ee.bind(this,e,t);if(ir.includes(t))return this.rg.bind(this,e,t);if($n[t])return this.Be.bind(this,e,t)}return this.Be(e,t)},r.set=function(e,t,n){this.g[e][t]=n,mr(this,{type:"set",targetName:e,property:t,value:n})},r.Ad=function(e,t){B.debug("CastSender: onSessionInitiated"),cr=t,t.addUpdateListener(this.A),t.addMessageListener("urn:x-cast:com.google.shaka.v2",this.C),this.yd(),mr(this,{type:"init",initState:e,appData:this.o}),this.l.resolve()},r.ve=function(e){var t=8003;switch(e.code){case"cancel":t=8004;break;case"timeout":t=8005;break;case"receiver_unavailable":t=8006}this.l.reject(new J(2,8,t,e))},r.Be=function(e,t){return this.g[e][t]},r.Ee=function(e,t,n){for(var r=[],i=2;i<arguments.length;++i)r[i-2]=arguments[i];mr(this,{type:"call",targetName:e,methodName:t,args:r})},r.rg=function(e,t,n){for(var r=[],i=2;i<arguments.length;++i)r[i-2]=arguments[i];i=new me;var o=this.J.toString();this.J++,this.i[o]=i;try{mr(this,{type:"asyncCall",targetName:e,methodName:t,args:r,id:o})}catch(a){i.reject(a)}return i},r.yd=function(){var e=!!cr&&"connected"==cr.status;if(B.debug("CastSender: connection status",e),this.h&&!e){for(var t in this.P(),this.g)this.g[t]={};pr(this)}this.M=(this.h=e)?cr.receiver.friendlyName:"",this.j.Lc()},r.ag=function(e,t){var n=ar(t);switch(B.O("CastSender: message",n),n.type){case"event":var r=n.event;this.F(n.targetName,new Ve(r.type,r));break;case"update":for(var i in r=n.update)for(var o in n=this.g[i]||{},r[i])n[o]=r[i][o];this.u&&(this.Z(),this.u=!1);break;case"asyncComplete":if(i=n.id,n=n.error,o=this.i[i],delete this.i[i],o)if(n){for(r in i=new J(n.severity,n.category,n.code),n)i[r]=n[r];o.reject(i)}else o.resolve()}};var yr=new Set;function vr(e){if(e)for(var t=(e=h(yr)).next();!t.done;t=e.next())t.value.init()}function gr(e,t,n){var r=this;We.call(this),this.i=e,this.h=t,this.o=this.l=this.j=this.u=this.m=null,this.C=n,this.A=new Map,this.g=new sr(n,(function(){return _r(r)}),(function(){return wr(r)}),(function(e,t){return Tr(r,e,t)}),(function(){return Sr(r)}),(function(){return Ar(r)})),function(e){for(var t in e.g.init(),e.o=new et,Bn.forEach(function(e){this.o.H(this.i,e,this.L.bind(this))}.bind(e)),qn.forEach(function(e){this.o.H(this.h,e,this.F.bind(this))}.bind(e)),e.m={},e.i)Object.defineProperty(e.m,t,{configurable:!1,enumerable:!0,get:e.J.bind(e,t),set:e.M.bind(e,t)});e.u={},br(e,(function(t){Object.defineProperty(e.u,t,{configurable:!1,enumerable:!0,get:function(){return kr(e,t)}})})),function(e){var t=new Map;br(e,(function(n,r){if(t.has(r)){var i=t.get(r);n.length<i.length?e.A.set(n,i):e.A.set(i,n)}else t.set(r,n)}))}(e),e.j=new We,e.j.jc=e.m,e.l=new We,e.l.jc=e.u}(this)}function br(e,t){function n(e){return"constructor"!=e&&"function"==typeof r[e]&&!i.has(e)}var r=e.h,i=new Set;for(o in r)n(o)&&(i.add(o),t(o,r[o]));for(var o=Object.getPrototypeOf(r),a=Object.getPrototypeOf({});o&&o!=a;){for(var s=h(Object.getOwnPropertyNames(o)),u=s.next();!u.done;u=s.next())n(u=u.value)&&(i.add(u),t(u,r[u]));o=Object.getPrototypeOf(o)}}function Ar(e){var t={video:{},player:{},playerAfterLoad:{},manifest:e.h.tc(),startTime:null};return e.i.pause(),zn.forEach(function(e){t.video[e]=this.i[e]}.bind(e)),e.i.ended||(t.startTime=e.i.currentTime),tr.forEach(function(e){var n=e[1];e=this.h[e[0]](),t.player[n]=e}.bind(e)),nr.forEach(function(e){var n=e[1];e=this.h[e[0]](),t.playerAfterLoad[n]=e}.bind(e)),t}function _r(e){e.dispatchEvent(new Ve("caststatuschanged"))}function wr(e){e.j.dispatchEvent(new Ve(e.m.paused?"pause":"play"))}function Sr(e){tr.forEach(function(e){var t=e[1];e=this.g.get("player",e[0])(),this.h[t](e)}.bind(e));var t=e.g.get("player","getAssetUri")(),n=e.g.get("video","ended"),r=Promise.resolve(),i=e.i.autoplay,o=null;n||(o=e.g.get("video","currentTime")),t&&(e.i.autoplay=!1,r=e.h.load(t,o));var a={};zn.forEach(function(e){a[e]=this.g.get("video",e)}.bind(e)),r.then((function(){e.i&&(zn.forEach(function(e){this.i[e]=a[e]}.bind(e)),nr.forEach(function(e){var t=e[1];e=this.g.get("player",e[0])(),this.h[t](e)}.bind(e)),e.i.autoplay=i,t&&e.i.play())}),(function(t){e.h.dispatchEvent(new Ve("error",{detail:t}))}))}function kr(e,t){if(e.A.has(t)&&(t=e.A.get(t)),"addEventListener"==t)return e.l.addEventListener.bind(e.l);if("removeEventListener"==t)return e.l.removeEventListener.bind(e.l);if("getMediaElement"==t)return function(){return this.m}.bind(e);if("getSharedConfiguration"==t)return B.v("Can't share configuration across a network. Returning copy."),e.g.get("player","getConfiguration");if("getNetworkingEngine"==t)return e.g.la()&&B.v("NOTE: getNetworkingEngine() is always local!"),e.h.Yb.bind(e.h);if(e.g.la()){if("getManifest"==t||"drmInfo"==t)return function(){return B.ba(t+"() does not work while casting!"),null};if("getManifestUri"==t)return Yn("getManifestUri",'Please use "getAssetUri" instead.'),kr(e,"getAssetUri");if("attach"==t||"detach"==t)return function(){return B.ba(t+"() does not work while casting!"),Promise.resolve()}}return e.g.la()&&0==Object.keys(e.g.g.video).length&&$n[t]||!e.g.la()?e.h[t].bind(e.h):e.g.get("player",t)}function Tr(e,t,n){e.g.la()&&("video"==t?e.j.dispatchEvent(n):"player"==t&&e.l.dispatchEvent(n))}function xr(e,t,n,r){var i=this;We.call(this),this.g=e,this.h=t,this.i=new et,this.L={video:e,player:t},this.C=n||function(){},this.M=r||function(e){return e},this.F=!1,this.m=!0,this.l=0,this.A=!1,this.u=!0,this.o=this.j=null,this.J=new Le((function(){Lr(i)})),function(e){var t=cast.receiver.CastReceiverManager.getInstance();t.onSenderConnected=e.xe.bind(e),t.onSenderDisconnected=e.xe.bind(e),t.onSystemVolumeChanged=e.hf.bind(e),e.o=t.getCastMessageBus("urn:x-cast:com.google.cast.media"),e.o.onMessage=e.Wf.bind(e),e.j=t.getCastMessageBus("urn:x-cast:com.google.shaka.v2"),e.j.onMessage=e.fg.bind(e),t.start(),Bn.forEach(function(e){this.i.H(this.g,e,this.Ce.bind(this,"video"))}.bind(e)),qn.forEach(function(e){this.i.H(this.h,e,this.Ce.bind(this,"player"))}.bind(e)),cast.__platform__&&cast.__platform__.canDisplayType('video/mp4; codecs="avc1.640028"; width=3840; height=2160')?e.h.Nd(3840,2160):e.h.Nd(1920,1080),e.i.H(e.g,"loadeddata",function(){this.A=!0}.bind(e)),e.i.H(e.h,"loading",function(){this.m=!1,Er(this)}.bind(e)),e.i.H(e.g,"playing",function(){this.m=!1,Er(this)}.bind(e)),e.i.H(e.g,"pause",function(){Er(this)}.bind(e)),e.i.H(e.h,"unloading",function(){this.m=!0,Er(this)}.bind(e)),e.i.H(e.g,"ended",function(){var e=this;new Le((function(){e.g&&e.g.ended&&(e.m=!0,Er(e))})).V(5)}.bind(e))}(this)}function Er(e){Promise.resolve().then(function(){this.h&&(this.dispatchEvent(new Ve("caststatuschanged")),Ir(this)||Cr(this))}.bind(e))}function Lr(e){e.J.V(.5);var t={video:{},player:{}};if(Jn.forEach(function(e){t.video[e]=this.g[e]}.bind(e)),e.h.aa())for(var n in er)0==e.l%er[n]&&(t.player[n]=e.h[n]());for(var r in $n)0==e.l%$n[r]&&(t.player[r]=e.h[r]());(n=cast.receiver.CastReceiverManager.getInstance().getSystemVolume())&&(t.video.volume=n.level,t.video.muted=n.muted),e.A&&(e.l+=1),Zr(e,{type:"update",update:t},e.j),Ir(e)}function Ir(e){return!(!e.u||!e.g.duration&&!e.h.aa()||(Rr(e),e.u=!1,0))}function Rr(e,t){t=void 0===t?0:t;var n={contentId:e.h.tc(),streamType:e.h.aa()?"LIVE":"BUFFERED",contentType:""};e.h.aa()||(n.duration=e.g.duration),Cr(e,t,n)}function Zr(e,t,n,r){e.F&&(e=or(t),r?n.getCastChannel(r).send(e):n.broadcast(e))}function Cr(e,t,n){t=void 0===t?0:t,n=void 0===n?null:n;var r=e.g.playbackRate,i=Pr;r={mediaSessionId:0,playbackRate:r,playerState:i=e.m?i.IDLE:e.h.jd()?i.Re:e.g.paused?i.Te:i.Ue,currentTime:e.g.currentTime,supportedMediaCommands:63,volume:{level:e.g.volume,muted:e.g.muted}},n&&(r.media=n),Zr(e,{requestId:t,type:"MEDIA_STATUS",status:[r]},e.o)}F(gr,We),U("shaka.cast.CastProxy",gr),gr.prototype.destroy=function(e){return e&&this.g.Bb(),this.o&&(this.o.release(),this.o=null),e=[],this.h&&(e.push(this.h.destroy()),this.h=null),this.g&&(e.push(this.g.destroy()),this.g=null),this.u=this.m=this.i=null,Promise.all(e)},gr.prototype.destroy=gr.prototype.destroy,gr.prototype.Mf=function(){return this.m},gr.prototype.getVideo=gr.prototype.Mf,gr.prototype.Df=function(){return this.u},gr.prototype.getPlayer=gr.prototype.Df,gr.prototype.Ye=function(){return this.g.m&&ur},gr.prototype.canCast=gr.prototype.Ye,gr.prototype.la=function(){return this.g.la()},gr.prototype.isCasting=gr.prototype.la,gr.prototype.Dd=function(){return this.g.Dd()},gr.prototype.receiverName=gr.prototype.Dd,gr.prototype.cast=function(){var e=Ar(this);return this.g.cast(e).then(function(){if(this.h)return this.h.Ud()}.bind(this))},gr.prototype.cast=gr.prototype.cast,gr.prototype.Md=function(e){this.g.Md(e)},gr.prototype.setAppData=gr.prototype.Md,gr.prototype.Kg=function(){var e=this.g;if(e.h){var t=e.L();chrome.cast.requestSession(e.Ad.bind(e,t),e.ve.bind(e))}},gr.prototype.suggestDisconnect=gr.prototype.Kg,gr.prototype.af=function(e){var t=this;return p((function n(){return M(n,(function(n){switch(n.s){case 1:return e==t.C?n.return():(t.C=e,t.g.Bb(),k(n,t.g.destroy(),2));case 2:t.g=null,t.g=new sr(e,(function(){return _r(t)}),(function(){return wr(t)}),(function(e,n){return Tr(t,e,n)}),(function(){return Sr(t)}),(function(){return Ar(t)})),t.g.init(),T(n)}}))}))},gr.prototype.changeReceiverId=gr.prototype.af,gr.prototype.Bb=function(){this.g.Bb()},gr.prototype.forceDisconnect=gr.prototype.Bb,gr.prototype.J=function(e){if("addEventListener"==e)return this.j.addEventListener.bind(this.j);if("removeEventListener"==e)return this.j.removeEventListener.bind(this.j);if(this.g.la()&&0==Object.keys(this.g.g.video).length){var t=this.i[e];if("function"!=typeof t)return t}return this.g.la()?this.g.get("video",e):("function"==typeof(e=this.i[e])&&(e=e.bind(this.i)),e)},gr.prototype.M=function(e,t){this.g.la()?this.g.set("video",e,t):this.i[e]=t},gr.prototype.L=function(e){this.g.la()||this.j.dispatchEvent(new Ve(e.type,e))},gr.prototype.F=function(e){this.g.la()||this.l.dispatchEvent(e)},F(xr,We),U("shaka.cast.CastReceiver",xr),xr.prototype.isConnected=function(){return this.F},xr.prototype.isConnected=xr.prototype.isConnected,xr.prototype.Rf=function(){return this.m},xr.prototype.isIdle=xr.prototype.Rf,xr.prototype.destroy=function(){var e=this;return p((function t(){var n;return M(t,(function(t){switch(t.s){case 1:return e.i&&(e.i.release(),e.i=null),n=[],e.h&&(n.push(e.h.destroy()),e.h=null),e.J&&(e.J.stop(),e.J=null),e.g=null,e.L=null,e.C=null,e.F=!1,e.m=!0,e.j=null,e.o=null,k(t,Promise.all(n),2);case 2:cast.receiver.CastReceiverManager.getInstance().stop(),T(t)}}))}))},xr.prototype.destroy=xr.prototype.destroy,(r=xr.prototype).xe=function(){this.l=0,this.u=!0,this.F=0!=cast.receiver.CastReceiverManager.getInstance().getSenders().length,Er(this)},r.Ce=function(e,t){this.h&&(Lr(this),Zr(this,{type:"event",targetName:e,event:t},this.j))},r.hf=function(){var e=cast.receiver.CastReceiverManager.getInstance().getSystemVolume();e&&Zr(this,{type:"update",update:{video:{volume:e.level,muted:e.muted}}},this.j),Zr(this,{type:"event",targetName:"video",event:{type:"volumechange"}},this.j)},r.fg=function(e){var t=ar(e.data);switch(B.debug("CastReceiver: message",t),t.type){case"init":this.l=0,this.A=!1,this.u=!0,function(e,t,n){for(var r in t.player)e.h[r](t.player[r]);e.C(n),n=Promise.resolve();var i=e.g.autoplay;t.manifest&&(e.g.autoplay=!1,n=e.h.load(t.manifest,t.startTime)),n.then((function(){if(e.h){for(var n in t.video)e.g[n]=t.video[n];for(var r in t.playerAfterLoad)e.h[r](t.playerAfterLoad[r]);e.g.autoplay=i,t.manifest&&(e.g.play(),Cr(e))}}),(function(t){e.h.dispatchEvent(new Ve("error",{detail:t}))}))}(this,t.initState,t.appData),Lr(this);break;case"appData":this.C(t.appData);break;case"set":var n=t.targetName,r=t.property;if(t=t.value,"video"==n){var i=cast.receiver.CastReceiverManager.getInstance();if("volume"==r){i.setSystemVolumeLevel(t);break}if("muted"==r){i.setSystemVolumeMuted(t);break}}this.L[n][r]=t;break;case"call":(n=this.L[t.targetName])[t.methodName].apply(n,t.args);break;case"asyncCall":n=t.targetName,r=t.methodName,"player"==n&&"load"==r&&(this.l=0,this.A=!1),i=t.id,e=e.senderId;var o=this.L[n];t=o[r].apply(o,t.args),"player"==n&&"load"==r&&(t=t.then(function(){this.u=!0}.bind(this))),t.then(this.Je.bind(this,e,i,null),this.Je.bind(this,e,i))}},r.Wf=function(e){var t=ar(e.data);switch(B.debug("CastReceiver: message",t),t.type){case"PLAY":this.g.play(),Cr(this);break;case"PAUSE":this.g.pause(),Cr(this);break;case"SEEK":e=t.currentTime;var n=t.resumeState;null!=e&&(this.g.currentTime=Number(e)),n&&"PLAYBACK_START"==n?(this.g.play(),Cr(this)):n&&"PLAYBACK_PAUSE"==n&&(this.g.pause(),Cr(this));break;case"STOP":this.h.Ud().then(function(){this.h&&Cr(this)}.bind(this));break;case"GET_STATUS":Rr(this,Number(t.requestId));break;case"VOLUME":e=(n=t.volume).level,n=n.muted;var r=this.g.volume,i=this.g.muted;null!=e&&(this.g.volume=Number(e)),null!=n&&(this.g.muted=n),r==this.g.volume&&i==this.g.muted||Cr(this);break;case"LOAD":this.l=0,this.u=this.A=!1,e=t.media,n=t.currentTime,r=this.M(e.contentId),i=t.autoplay||!0,this.C(e.customData),i&&(this.g.autoplay=!0),this.h.load(r,n).then(function(){this.h&&Rr(this)}.bind(this)).catch(function(e){var n="LOAD_FAILED";7==e.category&&7e3==e.code&&(n="LOAD_CANCELLED"),Zr(this,{requestId:Number(t.requestId),type:n},this.o)}.bind(this));break;default:B.v("Unrecognized message type from the generic Chromecast controller!",t.type),Zr(this,{requestId:Number(t.requestId),type:"INVALID_REQUEST",reason:"INVALID_COMMAND"},this.o)}},r.Je=function(e,t,n){this.h&&Zr(this,{type:"asyncComplete",id:t,error:n},this.j,e)};var Pr={IDLE:"IDLE",Ue:"PLAYING",Re:"BUFFERING",Te:"PAUSED"};function Gr(e,t){this.S=e,this.h=t==Dr,this.g=0}U("shaka.util.DataViewReader",Gr);var Dr=1;function Mr(){throw new J(2,3,3e3)}function Vr(){this.i=[],this.h=[],this.g=!1}function Xr(e){for(var t=Fr(e);e.reader.Ca()&&!e.parser.g;)e.parser.Fc(e.start+t,e.reader,e.partialOkay)}function Wr(e){for(var t=Fr(e),n=e.reader.N();0<n&&!e.parser.g;--n)e.parser.Fc(e.start+t,e.reader,e.partialOkay)}function Or(e){return function(t){e(t.reader.mb(t.reader.S.byteLength-t.reader.ka()))}}function Nr(e){for(var t=0,n=0;n<e.length;n++)t=t<<8|e.charCodeAt(n);return t}function Ur(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)}function Fr(e){return 8+(e.has64BitSize?8:0)+(null!=e.flags?4:0)}function Yr(e){var t=this;this.g=[],this.h=[],this.data=[],(new Vr).box("moov",Xr).ma("pssh",(function(e){if(1<e.version)B.v("Unrecognized PSSH version found!");else{var n=e.reader.S;if(n=new Uint8Array(n.buffer,n.byteOffset-12,e.size),t.data.push(n),t.g.push(Se.Nc(e.reader.mb(16))),0<e.version){n=e.reader.N();for(var r=0;r<n;++r){var i=Se.Nc(e.reader.mb(16));t.h.push(i)}}}})).parse(e),0==this.data.length&&B.v("No pssh box found!")}Gr.Endianness={Tg:0,Vg:Dr},Gr.prototype.Ca=function(){return this.g<this.S.byteLength},Gr.prototype.hasMoreData=Gr.prototype.Ca,Gr.prototype.ka=function(){return this.g},Gr.prototype.getPosition=Gr.prototype.ka,Gr.prototype.sf=function(){return this.S.byteLength},Gr.prototype.getLength=Gr.prototype.sf,Gr.prototype.ra=function(){try{var e=this.S.getUint8(this.g);return this.g+=1,e}catch(t){Mr()}},Gr.prototype.readUint8=Gr.prototype.ra,Gr.prototype.dc=function(){try{var e=this.S.getUint16(this.g,this.h);return this.g+=2,e}catch(t){Mr()}},Gr.prototype.readUint16=Gr.prototype.dc,Gr.prototype.N=function(){try{var e=this.S.getUint32(this.g,this.h);return this.g+=4,e}catch(t){Mr()}},Gr.prototype.readUint32=Gr.prototype.N,Gr.prototype.De=function(){try{var e=this.S.getInt32(this.g,this.h);return this.g+=4,e}catch(t){Mr()}},Gr.prototype.readInt32=Gr.prototype.De,Gr.prototype.Pb=function(){try{if(this.h)var e=this.S.getUint32(this.g,!0),t=this.S.getUint32(this.g+4,!0);else t=this.S.getUint32(this.g,!1),e=this.S.getUint32(this.g+4,!1)}catch(n){Mr()}if(2097151<t)throw new J(2,3,3001);return this.g+=8,t*Math.pow(2,32)+e},Gr.prototype.readUint64=Gr.prototype.Pb,Gr.prototype.mb=function(e){this.g+e>this.S.byteLength&&Mr();var t=new Uint8Array(this.S.buffer,this.S.byteOffset+this.g,e);return this.g+=e,t},Gr.prototype.readBytes=Gr.prototype.mb,Gr.prototype.U=function(e){this.g+e>this.S.byteLength&&Mr(),this.g+=e},Gr.prototype.skip=Gr.prototype.U,Gr.prototype.Fe=function(e){this.g<e&&Mr(),this.g-=e},Gr.prototype.rewind=Gr.prototype.Fe,Gr.prototype.seek=function(e){(0>e||e>this.S.byteLength)&&Mr(),this.g=e},Gr.prototype.seek=Gr.prototype.seek,Gr.prototype.Cd=function(){for(var e=this.g;this.Ca()&&0!=this.S.getUint8(this.g);)this.g+=1;return e=new Uint8Array(this.S.buffer,this.S.byteOffset+e,this.g-e),this.g+=1,ye(e)},Gr.prototype.readTerminatedString=Gr.prototype.Cd,U("shaka.util.Mp4Parser",Vr),Vr.prototype.box=function(e,t){var n=Nr(e);return this.i[n]=0,this.h[n]=t,this},Vr.prototype.box=Vr.prototype.box,Vr.prototype.ma=function(e,t){var n=Nr(e);return this.i[n]=1,this.h[n]=t,this},Vr.prototype.fullBox=Vr.prototype.ma,Vr.prototype.stop=function(){this.g=!0},Vr.prototype.stop=Vr.prototype.stop,Vr.prototype.parse=function(e,t){var n=new Uint8Array(e);for(n=new Gr(new DataView(n.buffer,n.byteOffset,n.byteLength),0),this.g=!1;n.Ca()&&!this.g;)this.Fc(0,n,t)},Vr.prototype.parse=Vr.prototype.parse,Vr.prototype.Fc=function(e,t,n){var r=t.ka(),i=t.N(),o=t.N(),a=!1;switch(B.O("Parsing MP4 box",Ur(o)),i){case 0:i=t.S.byteLength-r;break;case 1:i=t.Pb(),a=!0}var s=this.h[o];if(s){var u=null,c=null;1==this.i[o]&&(u=(c=t.N())>>>24,c&=16777215),o=r+i,n&&o>t.S.byteLength&&(o=t.S.byteLength),o-=t.ka(),t=0<o?t.mb(o):new Uint8Array(0),s({parser:this,partialOkay:n||!1,version:u,flags:c,reader:t=new Gr(new DataView(t.buffer,t.byteOffset,t.byteLength),0),size:i,start:r+e,has64BitSize:a})}else t.U(Math.min(r+i-t.ka(),t.S.byteLength-t.ka()))},Vr.prototype.parseNext=Vr.prototype.Fc,Vr.children=Xr,Vr.sampleDescription=Wr,Vr.allData=Or,Vr.typeToString=Ur,Vr.headerSize=Fr;var Kr={sc:function(e,t){var n=Kr.Y(e,t);return 1!=n.length?null:n[0]},Yc:function(e,t,n){return 1!=(e=Kr.fe(e,t,n)).length?null:e[0]},Y:function(e,t){return Array.prototype.filter.call(e.childNodes,(function(e){return e instanceof Element&&e.tagName==t}))},fe:function(e,t,n){return Array.prototype.filter.call(e.childNodes,(function(e){return e instanceof Element&&e.localName==n&&e.namespaceURI==t}))},getAttributeNS:function(e,t,n){return e.hasAttributeNS(t,n)?e.getAttributeNS(t,n):null},uc:function(e){return Array.prototype.every.call(e.childNodes,(function(e){return e.nodeType==Node.TEXT_NODE||e.nodeType==Node.CDATA_SECTION_NODE}))?e.textContent.trim():null},R:function(e,t,n,r){r=void 0===r?null:r;var i=null;return null!=(e=e.getAttribute(t))&&(i=n(e)),null==i?r:i},jg:function(e){return e?(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e)&&(e+="Z"),e=Date.parse(e),isNaN(e)?null:Math.floor(e/1e3)):null},Ma:function(e){if(!e)return null;var t=/^P(?:([0-9]*)Y)?(?:([0-9]*)M)?(?:([0-9]*)D)?(?:T(?:([0-9]*)H)?(?:([0-9]*)M)?(?:([0-9.]*)S)?)?$/.exec(e);return t?(e=31536e3*Number(t[1]||null)+2592e3*Number(t[2]||null)+86400*Number(t[3]||null)+3600*Number(t[4]||null)+60*Number(t[5]||null)+Number(t[6]||null),isFinite(e)?e:null):(B.v("Invalid duration string:",e),null)},Hc:function(e){var t=/([0-9]+)-([0-9]+)/.exec(e);return t?(e=Number(t[1]),isFinite(e)?(t=Number(t[2]),isFinite(t)?{start:e,end:t}:null):null):null},parseInt:function(e){return 0==(e=Number(e))%1?e:null},Gc:function(e){return 0==(e=Number(e))%1&&0<e?e:null},Mb:function(e){return 0==(e=Number(e))%1&&0<=e?e:null},parseFloat:function(e){return e=Number(e),isNaN(e)?null:e},ff:function(e){var t;return e=(t=e.match(/^(\d+)\/(\d+)$/))?Number(t[1])/Number(t[2]):Number(e),isNaN(e)?null:e},Ae:function(e,t){var n=new DOMParser;try{var r=n.parseFromString(e,"text/xml")}catch(o){}if(r&&r.documentElement.tagName==t)var i=r.documentElement;return i&&0<i.getElementsByTagName("parsererror").length?null:i},ze:function(e,t){try{var n=ye(e);return Kr.Ae(n,t)}catch(r){}}},jr=(new Map).set("urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b","org.w3.clearkey").set("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine.alpha").set("urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95","com.microsoft.playready").set("urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95","com.microsoft.playready").set("urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb","com.adobe.primetime");function Hr(e,t,n){var r=function(e){for(var t=[],n=(e=h(e)).next();!n.done;n=e.next())(n=zr(n.value))&&t.push(n);return t}(e),i=null;e=[];var o=[],a=new Set(r.map((function(e){return e.keyId})));if(a.delete(null),1<a.size)throw new J(2,4,4010);if(n||(o=r.filter((function(e){return"urn:mpeg:dash:mp4protection:2011"!=e.Ge||(i=e.init||i,!1)}))).length&&(e=function(e,t,n){for(var r=[],i=(n=h(n)).next();!i.done;i=n.next()){i=i.value;var o=jr.get(i.Ge);if(o){var a;if(a=Kr.Yc(i.node,"urn:microsoft:playready","pro")){a=Se.Ja(a.textContent);var s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]),u=a.length,c=s.length+16+u,l=new ArrayBuffer(c),d=new Uint8Array(l),f=0;(l=new DataView(l)).setUint32(f,c),f+=4,l.setUint32(f,1886614376),f+=4,l.setUint32(f,0),f+=4,d.set(s,f),f+=s.length,l.setUint32(f,u),f+=4,d.set(a,f),a=[{initData:d,initDataType:"cenc",keyId:i.keyId}]}else a=null;a=he(o,i.init||e||a),(o=Jr.get(o))&&(a.licenseServerUri=o(i)),r.push(a)}else for(o=(i=h(i=t(i.node)||[])).next();!o.done;o=i.next())r.push(o.value)}return r}(i,t,o),0==e.length&&(e=[he("",i)])),r.length&&(n||!o.length))for(e=[],n=(t=h(jr.values())).next();!n.done;n=t.next())"org.w3.clearkey"!=(n=n.value)&&e.push(he(n,i));if(a=Array.from(a)[0]||null)for(n=(t=h(e)).next();!n.done;n=t.next())for(r=(n=h(n.value.initData)).next();!r.done;r=n.next())r.value.keyId=a;return{be:a,Xg:i,drmInfos:e,ge:!0}}var Br,Jr=(new Map).set("com.widevine.alpha",(function(e){return(e=Kr.Yc(e.node,"urn:microsoft","laurl"))&&e.getAttribute("licenseUrl")||""})).set("com.microsoft.playready",(function(e){return(e=Kr.Yc(e.node,"urn:microsoft:playready","pro"))&&(e=function(e){var t=0,n=new DataView(e).getUint32(t,!0);if(t+=4,n!==e.byteLength)return B.v("PlayReady Object with invalid length encountered."),[];t+=2,n=[];for(var r=new DataView(e);t<e.byteLength-1;){var i=r.getUint16(t,!0);t+=2;var o=r.getUint16(t,!0);t+=2;var a=new Uint8Array(e,t,o);n.push({type:i,value:a}),t+=o}return n}((e=Se.Ja(e.textContent)).buffer).filter((function(e){return 1===e.type}))[0])?(e=ve(e.value,!0),(e=Kr.Ae(e,"WRMHEADER"))?function(e){for(var t=(e=h(e.getElementsByTagName("DATA"))).next();!t.done;t=e.next())for(var n=(t=h(t.value.childNodes)).next();!n.done;n=t.next())if((n=n.value)instanceof Element&&"LA_URL"==n.tagName)return n.textContent;return""}(e):""):""}));function zr(e){var t=e.getAttribute("schemeIdUri"),n=Kr.getAttributeNS(e,"urn:mpeg:cenc:2013","default_KID"),r=Kr.fe(e,"urn:mpeg:cenc:2013","pssh").map(Kr.uc);if(!t)return B.error("Missing required schemeIdUri attribute on","ContentProtection element",e),null;if(t=t.toLowerCase(),n&&(n=n.replace(/-/g,"").toLowerCase()).includes(" "))throw new J(2,4,4009);var i=[];try{i=r.map((function(e){return{initDataType:"cenc",initData:Se.Ja(e),keyId:null}}))}catch(o){throw new J(2,4,4007)}return{node:e,Ge:t,keyId:n,init:0<i.length?i:null}}function Qr(t,n,r,i,o){var a={RepresentationID:n,Number:r,Bandwidth:i,Time:o};return t.replace(/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)([diouxX]))?\$/g,(function(n,r,i,o){if("$$"==n)return"$";var s=a[r];if(null==s)return B.v("URL template does not have an available substitution for identifier",'"'+r+'":',t),n;switch("RepresentationID"==r&&i&&(B.v("URL template should not contain a width specifier for identifier",'"RepresentationID":',t),i=void 0),"Time"==r&&(s=Math.round(s)),o){case void 0:case"d":case"i":case"u":n=s.toString();break;case"o":n=s.toString(8);break;case"x":n=s.toString(16);break;case"X":n=s.toString(16).toUpperCase();break;default:n=s.toString()}return i=e.parseInt(i,10)||1,Array(Math.max(0,i-n.length)+1).join("0")+n}))}function qr(e,t){var n=$r(e,t,"timescale"),r=1;n&&(r=Kr.Gc(n)||1),n=$r(e,t,"duration"),(n=Kr.Gc(n||""))&&(n/=r);var i=$r(e,t,"startNumber"),o=Number($r(e,t,"presentationTimeOffset"))||0,a=Kr.Mb(i||"");null!=i&&null!=a||(a=1);var s=ei(e,t,"SegmentTimeline");if(i=null,s){i=r;var u=e.$.duration||1/0;s=Kr.Y(s,"S");for(var c=[],l=-o,d=0;d<s.length;++d){var h=s[d],f=Kr.R(h,"t",Kr.Mb),p=Kr.R(h,"d",Kr.Mb),m=Kr.R(h,"r",Kr.parseInt);if(null!=f&&(f-=o),!p){B.v('"S" element must have a duration:','ignoring the remaining "S" elements.',h);break}if(f=null!=f?f:l,0>(m=m||0))if(d+1<s.length){if(null==(m=Kr.R(s[d+1],"t",Kr.Mb))){B.v('An "S" element cannot have a negative repeat','if the next "S" element does not have a valid start time:','ignoring the remaining "S" elements.',h);break}if(f>=m){B.v('An "S" element cannot have a negative repeat','if its start time exceeds the next "S" element\'s start time:','ignoring the remaining "S" elements.',h);break}m=Math.ceil((m-f)/p)-1}else{if(1/0==u){B.v('The last "S" element cannot have a negative repeat',"if the Period has an infinite duration:",'ignoring the last "S" element.',h);break}if(f/i>=u){B.v('The last "S" element cannot have a negative repeat',"if its start time exceeds the Period's duration:",'igoring the last "S" element.',h);break}m=Math.ceil((u*i-f)/p)-1}for(0<c.length&&f!=l&&(Math.abs((f-l)/i)>=pe&&B.v("SegmentTimeline contains a large gap/overlap:","the content may have errors in it.",h),c[c.length-1].end=f/i),h=0;h<=m;++h)l=f+p,c.push({start:f/i,end:l/i,Pg:f}),f=l}i=c}return{timescale:r,ia:n,ob:a,sa:o/r||0,Vd:o,W:i}}function $r(e,t,n){return[t(e.G),t(e.fa),t(e.qa)].filter(le.Ra).map((function(e){return e.getAttribute(n)})).reduce((function(e,t){return e||t}))}function ei(e,t,n){return[t(e.G),t(e.fa),t(e.qa)].filter(le.Ra).map((function(e){return Kr.sc(e,n)})).reduce((function(e,t){return e||t}))}function ti(e,t,n,r,i,o){if(o=void 0===o?0:o,Kr.getAttributeNS(e,"http://www.w3.org/1999/xlink","href")){var a=function(e,t,n,r,i,o){for(var a=Kr.getAttributeNS(e,"http://www.w3.org/1999/xlink","href"),s=Kr.getAttributeNS(e,"http://www.w3.org/1999/xlink","actuate")||"onRequest",u=0;u<e.attributes.length;u++){var c=e.attributes[u];"http://www.w3.org/1999/xlink"==c.namespaceURI&&(e.removeAttributeNS(c.namespaceURI,c.localName),--u)}if(5<=o)return Ce(new J(2,4,4028));if("onLoad"!=s)return Ce(new J(2,4,4027));var l=de([r],[a]);return i.request(0,Je(l,t)).ca((function(r){if(!(r=Kr.ze(r.data,e.tagName)))return Ce(new J(2,4,4001,a));for(;e.childNodes.length;)e.removeChild(e.childNodes[0]);for(;r.childNodes.length;){var s=r.childNodes[0];r.removeChild(s),e.appendChild(s)}for(s=0;s<r.attributes.length;s++){var u=r.attributes[s].nodeName,c=r.getAttribute(u);e.setAttribute(u,c)}return ti(e,t,n,l[0],i,o+1)}))}(e,t,n,r,i,o);return n&&(a=a.ca(void 0,(function(){return ti(e,t,n,r,i,o)}))),a}a=[];for(var s=0;s<e.childNodes.length;s++){var u=e.childNodes[s];u instanceof Element&&("urn:mpeg:dash:resolve-to-zero:2013"==Kr.getAttributeNS(u,"http://www.w3.org/1999/xlink","href")?(e.removeChild(u),--s):"SegmentTimeline"!=u.tagName&&a.push(ti(u,t,n,r,i,o)))}return Me(a).ca((function(){return e}))}function ni(e,t,n){this.i=e,this.h=t,this.g=n}function ri(e,t,n,r,i,o){this.position=e,this.startTime=t,this.endTime=n,this.i=r,this.h=i,this.g=o}function ii(e,t,n,r){var i,o=(new Vr).ma("sidx",(function(e){i=function(e,t,n,r){var i=[];r.reader.U(4);var o=r.reader.N();if(0==o)throw B.error("Invalid timescale."),new J(2,3,3005);if(0==r.version)var a=r.reader.N(),s=r.reader.N();else a=r.reader.Pb(),s=r.reader.Pb();r.reader.U(2);var u=r.reader.dc();for(e=e+r.size+s,s=0;s<u;s++){var c=r.reader.N(),l=(2147483648&c)>>>31;c&=2147483647;var d=r.reader.N();if(r.reader.U(4),1==l)throw B.error("Heirarchical SIDXs are not supported."),new J(2,3,3006);i.push(new ri(i.length,a/o-t,(a+d)/o-t,(function(){return n}),e,e+c-1)),a+=d,e+=c}return r.parser.stop(),i}(t,r,n,e)}));if(e&&o.parse(e),i)return i;throw B.error('Invalid box type, expected "sidx".'),new J(2,3,3004)}function oi(e){this.g=e}function ai(e,t){for(;e.g.length&&e.g[e.g.length-1].startTime>=t;)e.g.pop();for(;e.g.length&&0>=e.g[0].endTime;)e.g.shift();if(0!=e.g.length){var n=e.g[e.g.length-1];e.g[e.g.length-1]=new ri(n.position,n.startTime,t,n.i,n.h,n.g)}}function si(e){this.h=e,this.g=new Gr(e,0),Br||(Br=[new Uint8Array([255]),new Uint8Array([127,255]),new Uint8Array([63,255,255]),new Uint8Array([31,255,255,255]),new Uint8Array([15,255,255,255,255]),new Uint8Array([7,255,255,255,255,255]),new Uint8Array([3,255,255,255,255,255,255]),new Uint8Array([1,255,255,255,255,255,255,255])])}function ui(e){var t=ci(e);if(7<t.length)throw new J(2,3,3002);for(var n=0,r=0;r<t.length;r++)n=256*n+t[r];t=n,n=ci(e);e:{r=Se.Ha;for(var i=0;i<Br.length;i++)if(r(n,Br[i])){r=!0;break e}r=!1}if(r)n=e.h.byteLength-e.g.ka();else{if(8==n.length&&224&n[1])throw new J(2,3,3001);for(r=n[0]&(1<<8-n.length)-1,i=1;i<n.length;i++)r=256*r+n[i];n=r}return n=e.g.ka()+n<=e.h.byteLength?n:e.h.byteLength-e.g.ka(),r=new DataView(e.h.buffer,e.h.byteOffset+e.g.ka(),n),e.g.U(n),new li(t,r)}function ci(e){var t,n=e.g.ra();for(t=1;8>=t&&!(n&1<<8-t);t++);if(8<t)throw new J(2,3,3002);var r=new Uint8Array(t);for(r[0]=n,n=1;n<t;n++)r[n]=e.g.ra();return r}function li(e,t){this.id=e,this.g=t}function di(e){if(8<e.g.byteLength)throw new J(2,3,3002);if(8==e.g.byteLength&&224&e.g.getUint8(0))throw new J(2,3,3001);for(var t=0,n=0;n<e.g.byteLength;n++)t=256*t+e.g.getUint8(n);return t}function hi(){}function fi(e){var t=new si(e.g);if(179!=(e=ui(t)).id)throw B.v("Not a CueTime element."),new J(2,3,3013);if(e=di(e),183!=(t=ui(t)).id)throw B.v("Not a CueTrackPositions element."),new J(2,3,3012);t=new si(t.g);for(var n=0;t.Ca();){var r=ui(t);if(241==r.id){n=di(r);break}}return{Qg:e,qg:n}}function pi(e,t){var n=ei(e,t,"Initialization");if(!n)return null;var r=e.G.xa,i=n.getAttribute("sourceURL");i&&(r=de(e.G.xa,[i])),i=0;var o=null;return(n=Kr.R(n,"range",Kr.Hc))&&(i=n.start,o=n.end),new ni((function(){return r}),i,o)}function mi(e,t,n,r,i,o,a,s){var u=e.presentationTimeline,c=!e.zb||!e.$.ld,l=e.$.start,d=e.$.duration,h=t,f=null;return{createSegmentIndex:function(){var e=[h(r,i,o),"webm"==a?h(n.i(),n.h,n.g):null];return h=null,Promise.all(e).then((function(e){var t=e[0];e=e[1]||null,t="mp4"==a?ii(t,i,r,s):(new hi).parse(t,e,r,s),u.Jb(t,l),f=new oi(t),c&&ai(f,d)}))},findSegmentPosition:function(e){return f.find(e)},getSegmentReference:function(e){return f.get(e)}}}function yi(e){return e.ec}function vi(e,t){var n=pi(e,gi),r=function(e){return[e.G.Ua,e.fa.Ua,e.qa.Ua].filter(le.Ra).map((function(e){return Kr.Y(e,"SegmentURL")})).reduce((function(e,t){return 0<e.length?e:t})).map((function(t){return t.getAttribute("indexRange")&&!e.me&&(e.me=!0,B.v("We do not support the SegmentURL@indexRange attribute on SegmentList. We only use the SegmentList@duration attribute or SegmentTimeline, which must be accurate.")),{Tf:t.getAttribute("media"),start:(t=Kr.R(t,"mediaRange",Kr.Hc,{start:0,end:null})).start,end:t.end}}))}(e),i=qr(e,gi),o=i.ob;0==o&&(B.v("SegmentList@startNumber must be > 0"),o=1);var a=0;if(i.ia?a=i.ia*(o-1):i.W&&0<i.W.length&&(a=i.W[0].start),!(r={ia:i.ia,startTime:a,ob:o,sa:i.sa,W:i.W,jb:r}).ia&&!r.W&&1<r.jb.length)throw B.v("SegmentList does not contain sufficient segment information:","the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",e.G),new J(2,4,4002);if(!r.ia&&!e.$.duration&&!r.W&&1==r.jb.length)throw B.v("SegmentList does not contain sufficient segment information:","the SegmentList specifies one segment,","but does not specify a segment duration, period duration,","or timeline.",e.G),new J(2,4,4002);if(r.W&&0==r.W.length)throw B.v("SegmentList does not contain sufficient segment information:","the SegmentList has an empty timeline.",e.G),new J(2,4,4002);return o=i=null,e.qa.id&&e.G.id&&(i=t[o=e.qa.id+","+e.G.id]),a=function(e,t,n,r){var i=r.jb.length;r.W&&r.W.length!=r.jb.length&&(i=Math.min(r.W.length,r.jb.length),B.v("The number of items in the segment timeline and the number of segment","URLs do not match, truncating",r.jb.length,"to",i));for(var o=[],a=r.startTime,s=0;s<i;s++){var u=r.jb[s],c=de(n,[u.Tf]),l=void 0;l=null!=r.ia?a+r.ia:r.W?r.W[s].end:a+e,o.push(new ri(s+t,a,l,function(e){return e}.bind(null,c),u.start,u.end)),a=l}return o}(e.$.duration,r.ob,e.G.xa,r),i?(i.sd(a),o=e.presentationTimeline.$b(),i.Vc(o-e.$.start)):(e.presentationTimeline.Jb(a,e.$.start),i=new oi(a),o&&e.zb&&(t[o]=i)),e.zb&&e.$.ld||ai(i,e.$.duration),{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:i.find.bind(i),getSegmentReference:i.get.bind(i),initSegmentReference:n,sa:r.sa}}function gi(e){return e.Ua}function bi(e,t,n,r){var i=function(e){var t=$r(e,Ai,"initialization");if(!t)return null;var n=e.G.id,r=e.bandwidth||null,i=e.G.xa;return new ni((function(){var e=Qr(t,n,null,r,null);return de(i,[e])}),0,null)}(e),o=qr(e,Ai),a=$r(e,Ai,"media"),s=$r(e,Ai,"index");if(a=(o={ia:o.ia,timescale:o.timescale,ob:o.ob,sa:o.sa,Vd:o.Vd,W:o.W,qd:a,bc:s}).bc?1:0,a+=o.W?1:0,0==(a+=o.ia?1:0))throw B.error("SegmentTemplate does not contain any segment information:","the SegmentTemplate must contain either an index URL template","a SegmentTimeline, or a segment duration.",e.G),new J(2,4,4002);if(1!=a&&(B.v("SegmentTemplate containes multiple segment information sources:","the SegmentTemplate should only contain an index URL template,","a SegmentTimeline or a segment duration.",e.G),o.bc?(B.info("Using the index URL template by default."),o.W=null):B.info("Using the SegmentTimeline by default."),o.ia=null),!o.bc&&!o.qd)throw B.error("SegmentTemplate does not contain sufficient segment information:","the SegmentTemplate's media URL template is missing.",e.G),new J(2,4,4002);if(o.bc){if("mp4"!=(n=e.G.mimeType.split("/")[1])&&"webm"!=n)throw B.error("SegmentTemplate specifies an unsupported container type.",e.G),new J(2,4,4006);if("webm"==n&&!i)throw B.error("SegmentTemplate does not contain sufficient segment information:","the SegmentTemplate uses a WebM container,","but does not contain an initialization URL template.",e.G),new J(2,4,4005);r=Qr(o.bc,e.G.id,null,e.bandwidth||null,null),e=mi(e,t,i,r=de(e.G.xa,[r]),0,null,n,o.sa)}else o.ia?(r||(e.presentationTimeline.ud(o.ia),e.presentationTimeline.vd(e.$.start)),e=function(e,t){var n=e.$.duration,r=t.ia,i=t.ob,o=t.timescale,a=t.qd,s=e.bandwidth||null,u=e.G.id,c=e.G.xa;return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(e){return 0>e||n&&e>=n?null:Math.floor(e/r)},getSegmentReference:function(e){var t=e*r,l=t+r;return n&&(l=Math.min(l,n)),0>l||n&&t>=n?null:new ri(e,t,l,(function(){var n=Qr(a,u,e+i,s,t*o);return de(c,[n])}),0,null)}}}(e,o)):(a=t=null,e.qa.id&&e.G.id&&(t=n[a=e.qa.id+","+e.G.id]),s=function(e,t){for(var n=[],r=0;r<t.W.length;r++){var i=r+t.ob;n.push(new ri(i,t.W[r].start,t.W[r].end,function(e,t,n,r,i,o){return de(r,[e=Qr(e,t,i,n,o)]).map((function(e){return e.toString()}))}.bind(null,t.qd,e.G.id,e.bandwidth||null,e.G.xa,i,t.W[r].Pg+t.Vd),0,null))}return n}(e,o),r=!e.zb||!e.$.ld,t?(r&&ai(new oi(s),e.$.duration),t.sd(s),n=e.presentationTimeline.$b(),t.Vc(n-e.$.start)):(e.presentationTimeline.Jb(s,e.$.start),t=new oi(s),a&&e.zb&&(n[a]=t)),r&&ai(t,e.$.duration),e={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:t.find.bind(t),getSegmentReference:t.get.bind(t)});return{createSegmentIndex:e.createSegmentIndex,findSegmentPosition:e.findSegmentPosition,getSegmentReference:e.getSegmentReference,initSegmentReference:i,sa:o.sa}}function Ai(e){return e.gc}U("shaka.media.InitSegmentReference",ni),ni.prototype.Tc=function(){return this.i()},ni.prototype.createUris=ni.prototype.Tc,ni.prototype.dd=function(){return this.h},ni.prototype.getStartByte=ni.prototype.dd,ni.prototype.cd=function(){return this.g},ni.prototype.getEndByte=ni.prototype.cd,U("shaka.media.SegmentReference",ri),ri.prototype.ka=function(){return this.position},ri.prototype.getPosition=ri.prototype.ka,ri.prototype.xc=function(){return this.startTime},ri.prototype.getStartTime=ri.prototype.xc,ri.prototype.qf=function(){return this.endTime},ri.prototype.getEndTime=ri.prototype.qf,ri.prototype.Tc=function(){return this.i()},ri.prototype.createUris=ri.prototype.Tc,ri.prototype.dd=function(){return this.h},ri.prototype.getStartByte=ri.prototype.dd,ri.prototype.cd=function(){return this.g},ri.prototype.getEndByte=ri.prototype.cd,U("shaka.media.SegmentIndex",oi),oi.prototype.destroy=function(){return this.g=null,Promise.resolve()},oi.prototype.destroy=oi.prototype.destroy,oi.prototype.find=function(e){for(var t=this.g.length-1,n=t;0<=n;--n){var r=this.g[n],i=n<t?this.g[n+1].startTime:r.endTime;if(e>=r.startTime&&e<i)return r.position}return this.g.length&&e<this.g[0].startTime?this.g[0].position:null},oi.prototype.find=oi.prototype.find,oi.prototype.get=function(e){return 0==this.g.length||0>(e-=this.g[0].position)||e>=this.g.length?null:this.g[e]},oi.prototype.get=oi.prototype.get,oi.prototype.offset=function(e){for(var t=0;t<this.g.length;++t)this.g[t].startTime+=e,this.g[t].endTime+=e},oi.prototype.offset=oi.prototype.offset,oi.prototype.sd=function(e){for(var t=[],n=0,r=0;n<this.g.length&&r<e.length;){var i=this.g[n],o=e[r];i.startTime<o.startTime?(t.push(i),n++):(i.startTime>o.startTime?0==n?t.push(o):B.v("Refusing to rewrite original references on update!"):(.1<Math.abs(i.endTime-o.endTime)?t.push(new ri(i.position,o.startTime,o.endTime,o.i,o.h,o.g)):t.push(i),n++),r++)}for(;n<this.g.length;)t.push(this.g[n++]);if(t.length)for(n=t[t.length-1].position+1;r<e.length;)i=new ri(n++,(i=e[r++]).startTime,i.endTime,i.i,i.h,i.g),t.push(i);else t=e;this.g=t},oi.prototype.merge=oi.prototype.sd,oi.prototype.Vc=function(e){for(var t=0;t<this.g.length;++t)if(this.g[t].endTime>e)return void this.g.splice(0,t);this.g=[]},oi.prototype.evict=oi.prototype.Vc,si.prototype.Ca=function(){return this.g.Ca()},hi.prototype.parse=function(e,t,n,r){var i;if(440786851!=ui(t=new si(new DataView(t))).id)throw B.error("Not an EBML element."),new J(2,3,3008);var o=ui(t);if(408125543!=o.id)throw B.error("Not a Segment element."),new J(2,3,3009);for(t=o.g.byteOffset,o=new si(o.g),i=null;o.Ca();){var a=ui(o);if(357149030==a.id){i=a;break}}if(!i)throw B.error("Not an Info element."),new J(2,3,3010);for(o=new si(i.g),i=1e6,a=null;o.Ca();){var s=ui(o);if(2807729==s.id)i=di(s);else if(17545==s.id)if(4==(a=s).g.byteLength)a=a.g.getFloat32(0);else{if(8!=a.g.byteLength)throw new J(2,3,3003);a=a.g.getFloat64(0)}}if(null==a)throw new J(2,3,3011);if(i=a*(o=i/1e9),475249515!=(e=ui(new si(new DataView(e)))).id)throw B.error("Not a Cues element."),new J(2,3,3007);return function(e,t,n,r,i,o){function a(){return i}var s=[];e=new si(e.g);for(var u=null,c=null;e.Ca();){var l=ui(e);if(187==l.id){var d=fi(l);d&&(l=n*d.Qg,d=t+d.qg,null!=u&&s.push(new ri(s.length,u-o,l-o,a,c,d-1)),u=l,c=d)}}return null!=u&&s.push(new ri(s.length,u-o,r-o,a,c,null)),s}(e,t,o,i,n,r)};var _i={Nb:{},cc:{},Fd:function(e,t){_i.cc[e]=t}};function wi(e,t,n){this.j=e,this.Ic=t,this.m=this.l=1/0,this.g=1,this.h=this.i=null,this.u=0,this.A=!0,this.o=0,this.C=void 0===n||n}function Si(e,t,n,r){return e=Je(e,r),0==t&&null==n||(e.headers.Range=n?"bytes="+t+"-"+n:"bytes="+t+"-"),e}function ki(){var e=this;this.h=this.g=null,this.j=[],this.i=null,this.u=[],this.m=1,this.A={},this.C=0,this.F=new Y(5),this.o=new Le((function(){!function(e){p((function t(){var n,r;return M(t,(function(t){switch(t.s){case 1:return B.info("Updating manifest..."),n=0,x(t,2),k(t,Ti(e),4);case 4:n=t.B,L(t,3);break;case 2:r=I(t),e.h&&(r.severity=1,e.h.onError(r));case 3:if(!e.h)return t.return();Ii(e,n),T(t)}}))}))}(e)})),this.l=new Ye}function Ti(e){var t=Date.now(),n=e.h.networkingEngine.request(0,Je(e.j,e.g.retryParameters));return Ke(e.l,n),n.promise.then((function(t){if(e.h)return t.uri&&!e.j.includes(t.uri)&&e.j.unshift(t.uri),function(e,t,n){if(!(t=Kr.ze(t,"MPD")))throw new J(2,4,4001,n);return t=ti(t,e.g.retryParameters,e.g.dash.xlinkFailGracefully,n,e.h.networkingEngine),Ke(e.l,t),t.promise.then((function(t){return function(e,t,n){return p((function r(){var i,o,a,s,u,c,l,d,h,f,p,m,y,v,g,b,A,_,w,S,x,E,L,I;return M(r,(function(r){switch(r.s){case 1:s=le,c=[n],0<(l=(u=Kr).Y(t,"Location").map(u.uc).filter(s.Ra)).length&&(d=de(c,l),c=e.j=d),h=u.Y(t,"BaseURL").map(u.uc),f=de(c,h),p=e.g.dash.ignoreMinBufferTime,m=0,p||(m=u.R(t,"minBufferTime",u.Ma)),e.C=u.R(t,"minimumUpdatePeriod",u.Ma,-1),y=u.R(t,"availabilityStartTime",u.jg),v=u.R(t,"timeShiftBufferDepth",u.Ma),g=u.R(t,"maxSegmentDuration",u.Ma),b=t.getAttribute("type")||"static",A=e.g.dash.ignoreSuggestedPresentationDelay,_=null,A||(_=u.R(t,"suggestedPresentationDelay",u.Ma)),e.i?w=e.i.presentationTimeline:(S=Math.max(e.g.dash.defaultPresentationDelay,1.5*m),w=new wi(y,null!=_?_:S,e.g.dash.autoCorrectDrift));for(var R={zb:"static"!=b,presentationTimeline:w,qa:null,$:null,fa:null,G:null,bandwidth:0,me:!1},Z=f,C=Kr.R(t,"mediaPresentationDuration",Kr.Ma),P=[],G=0,D=Kr.Y(t,"Period"),M=0;M<D.length;M++){var V=D[M];G=Kr.R(V,"start",Kr.Ma,G);var X=Kr.R(V,"duration",Kr.Ma),W=null;if(M!=D.length-1){var O=Kr.R(D[M+1],"start",Kr.Ma);null!=O&&(W=O-G)}else null!=C&&(W=C-G);if(O=pe,W&&X&&Math.abs(W-X)>O&&B.v("There is a gap/overlap between Periods",V),null==W&&(W=X),V=xi(e,R,Z,{start:G,duration:W,node:V,ld:null==W||M==D.length-1}),P.push(V),X=R.qa.id,e.u.includes(X)||(e.u.push(X),e.i&&(e.h.filterNewPeriod(V),e.i.periods.push(V))),null==W){M!=D.length-1&&B.v("Skipping Period",M+1,"and any subsequent Periods:","Period",M+1,"does not have a valid start time.",P[M+1]),G=null;break}G+=W}if(null==e.i&&e.h.filterAllPeriods(P),null!=C?(G!=C&&B.v("@mediaPresentationDuration does not match the total duration of all","Periods."),i=P,o=C,a=!1):(i=P,o=G,a=!0),x=o,E=i,w.hc("static"==b),"static"!=b&&a||w.Fa(x||1/0),w.aa()&&!isNaN(e.g.availabilityWindowOverride)&&(v=e.g.availabilityWindowOverride),null==v&&(v=1/0),w.Pd(v),w.ud(g||1),e.i){r.I(0);break}if(e.i={presentationTimeline:w,periods:E,offlineSessionIds:[],minBufferTime:m||0},!w.Pe()){r.I(0);break}return L=u.Y(t,"UTCTiming"),k(r,function(e,t,n){n=n.map((function(e){return{scheme:e.getAttribute("schemeIdUri"),value:e.getAttribute("value")}}));var r=e.g.dash.clockSyncUri;return!n.length&&r&&n.push({scheme:"urn:mpeg:dash:utc:http-head:2014",value:r}),le.df(n,function(e){var n=e.scheme;switch(e=e.value,n){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":return Zi(this,t,e,"HEAD");case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":return Zi(this,t,e,"GET");case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":return n=Date.parse(e),isNaN(n)?0:n-Date.now();case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":return B.ba("NTP UTCTiming scheme is not supported"),Promise.reject();default:return B.ba("Unrecognized scheme in UTCTiming element",n),Promise.reject()}}.bind(e)).catch((function(){return B.ba("A UTCTiming element should always be given in live manifests! This content may not play on clients with bad clocks!"),0}))}(e,f,L),4);case 4:if(I=r.B,!e.h)return r.return();w.Ke(I),T(r)}}))}))}(e,t,n)}))}(e,t.data,t.uri)})).then((function(){var n=(Date.now()-t)/1e3;return K(e.F,1,n),n}))}function xi(e,t,n,r){if(t.qa=Ri(r.node,null,n),t.$=r,t.qa.id||(B.info("No Period ID given for Period with start time "+r.start+", Assigning a default"),t.qa.id="__shaka_period_"+r.start),Kr.Y(r.node,"EventStream").forEach(e.kg.bind(e,r.start,r.duration)),n=Kr.Y(r.node,"AdaptationSet").map(e.ig.bind(e,t)).filter(le.Ra),t.zb){t=[];for(var i=h(n),o=i.next();!o.done;o=i.next())for(var a=(o=h(o.value.tg)).next();!a.done;a=o.next())t.push(a.value);if(t.length!=new Set(t).size)throw new J(2,4,4018)}var s=n.filter((function(e){return!e.Td}));if(n.filter((function(e){return e.Td})).forEach((function(e){var t=e.Td.split(" ");s.forEach((function(n){t.includes(n.id)&&n.streams.forEach((function(t){t.trickModeVideo=e.streams.find((function(e){return dt(t.codecs)[0]==dt(e.codecs)[0]}))}))}))})),t=Ei(s,"video"),i=Ei(s,"audio"),!t.length&&!i.length)throw new J(2,4,4004);for(n=e.g.disableAudio,i.length&&!n||(i=[null]),n=e.g.disableVideo,t.length&&!n||(t=[null]),n=[],o=0;o<i.length;o++)for(a=0;a<t.length;a++)Li(e,i[o],t[a],n);if(t=[],!e.g.disableText)for(e=Ei(s,"text"),i=0;i<e.length;i++)t.push.apply(t,e[i].streams);return{startTime:r.start,textStreams:t,variants:n}}function Ei(e,t){return e.filter((function(e){return e.contentType==t}))}function Li(e,t,n,r){if(t||n)if(t&&n){var i=t.drmInfos,o=n.drmInfos;if(!i.length||!o.length||0<Xt(i,o).length){o=Xt(t.drmInfos,n.drmInfos);for(var a=0;a<t.streams.length;a++)for(var s=0;s<n.streams.length;s++)i=(n.streams[s].bandwidth||0)+(t.streams[a].bandwidth||0),i={id:e.m++,language:t.language,primary:t.pd||n.pd,audio:t.streams[a],video:n.streams[s],bandwidth:i,drmInfos:o,allowedByApplication:!0,allowedByKeySystem:!0},r.push(i)}}else for(o=t||n,a=0;a<o.streams.length;a++)i=o.streams[a].bandwidth||0,i={id:e.m++,language:o.language||"und",primary:o.pd,audio:t?o.streams[a]:null,video:n?o.streams[a]:null,bandwidth:i,drmInfos:o.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},r.push(i)}function Ii(e,t){0>e.C||e.o.V(Math.max(3,e.C-t,j(e.F)))}function Ri(e,t,n){t=t||{contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,wd:null,audioSamplingRate:null},n=n||t.xa;var r=Kr.Mb,i=Kr.ff,o=Kr.Y(e,"BaseURL").map(Kr.uc),a=e.getAttribute("contentType")||t.contentType,s=e.getAttribute("mimeType")||t.mimeType,u=e.getAttribute("codecs")||t.codecs;i=Kr.R(e,"frameRate",i)||t.frameRate;for(var c=e.getAttribute("sar")||t.pixelAspectRatio,l=Kr.Y(e,"InbandEventStream"),d=t.emsgSchemeIdUris.slice(),f=(l=h(l)).next();!f.done;f=l.next())f=f.value.getAttribute("schemeIdUri"),d.includes(f)||d.push(f);return l=function(e){for(var t=0;t<e.length;++t){var n=e[t],r=n.getAttribute("schemeIdUri");if(r&&(n=n.getAttribute("value")))switch(r){case"urn:mpeg:dash:outputChannelPositionList:2012":return n.trim().split(/ +/).length;case"urn:mpeg:dash:23003:3:audio_channel_configuration:2011":case"urn:dts:dash:audio_channel_configuration:2012":var i=parseInt(n,10);if(!i){B.v("Channel parsing failure! Ignoring scheme and value",r,n);continue}return i;case"tag:dolby.com,2014:dash:audio_channel_configuration:2011":case"urn:dolby:dash:audio_channel_configuration:2011":if(!(i=parseInt(n,16))){B.v("Channel parsing failure! Ignoring scheme and value",r,n);continue}for(e=0;i;)1&i&&++e,i>>=1;return e;default:B.v("Unrecognized audio channel scheme:",r,n)}}return null}(l=Kr.Y(e,"AudioChannelConfiguration"))||t.wd,f=Kr.R(e,"audioSamplingRate",r)||t.audioSamplingRate,a||(a=Ci(s,u)),{xa:de(n,o),ec:Kr.sc(e,"SegmentBase")||t.ec,Ua:Kr.sc(e,"SegmentList")||t.Ua,gc:Kr.sc(e,"SegmentTemplate")||t.gc,width:Kr.R(e,"width",r)||t.width,height:Kr.R(e,"height",r)||t.height,contentType:a,mimeType:s,codecs:u,frameRate:i,pixelAspectRatio:c,emsgSchemeIdUris:d,id:e.getAttribute("id"),wd:l,audioSamplingRate:f}}function Zi(e,t,n,r){return(t=Je(t=de(t,[n]),e.g.retryParameters)).method=r,t=e.h.networkingEngine.request(4,t),Ke(e.l,t),t.promise.then((function(e){if("HEAD"==r){if(!e.headers||!e.headers.date)return B.v("UTC timing response is missing","expected date header"),0;e=e.headers.date}else e=ye(e.data);return e=Date.parse(e),isNaN(e)?(B.v("Unable to parse date from UTC timing response"),0):e-Date.now()}))}function Ci(e,t){return vn(ct(e,t))?"text":e.split("/")[0]}function Pi(e,t,n,r){this.h=e,this.type=t,this.g=n,this.segments=r||null}function Gi(e,t,n,r){this.id=e,this.name=t,this.g=n,this.value=void 0===r?null:r}function Di(e,t){this.name=e,this.value=t}function Mi(e,t,n){return(e=e.getAttribute(t))?e.value:n||null}function Vi(e,t){this.h=t,this.g=e}U("shaka.media.ManifestParser.registerParserByExtension",_i.Fd),_i.Qb=function(e,t){_i.Nb[e]=t},U("shaka.media.ManifestParser.registerParserByMime",_i.Qb),_i.ng=function(){var e={};if(ft()){for(var t in _i.Nb)e[t]=!0;for(var n in _i.cc)e[n]=!0}t={mpd:"application/dash+xml",m3u8:"application/x-mpegurl",ism:"application/vnd.ms-sstr+xml"};for(var r=(n=h(["application/dash+xml","application/x-mpegurl","application/vnd.apple.mpegurl","application/vnd.ms-sstr+xml"])).next();!r.done;r=n.next())e[r=r.value]=ft()?!!_i.Nb[r]:pt(r);for(var i in t)e[i]=ft()?!!_i.cc[i]:pt(t[i]);return e},_i.create=function(e,t,n,r){return p((function i(){var o,a;return M(i,(function(i){switch(i.s){case 1:return x(i,2),k(i,_i.rf(e,t,n,r),4);case 4:return o=i.B,i.return(new o);case 2:throw(a=I(i)).severity=2,a}}))}))},_i.rf=function(e,t,n,r){return p((function i(){var o,a,s,u,c;return M(i,(function(i){switch(i.s){case 1:if(o=_i,r){if(a=o.Nb[r.toLowerCase()])return i.return(a);B.v("Could not determine manifest type using MIME type ",r)}if(s=o.getExtension(e)){if(u=o.cc[s])return i.return(u);B.v("Could not determine manifest type for extension ",s)}else B.v("Could not find extension for ",e);if(r){i.I(2);break}return k(i,o.zf(e,t,n),3);case 3:if(r=i.B){if(c=_i.Nb[r])return i.return(c);B.v("Could not determine manifest type using MIME type",r)}case 2:throw new J(2,4,4e3,e)}}))}))},_i.zf=function(e,t,n){return p((function r(){var i,o,a;return M(r,(function(r){switch(r.s){case 1:return(i=Je([e],n)).method="HEAD",k(r,t.request(0,i).promise,2);case 2:return o=r.B,a=o.headers["content-type"],r.return(a?a.toLowerCase().split(";").shift():"")}}))}))},_i.getExtension=function(e){return 1==(e=new Q(e).pa.split("/").pop().split(".")).length?"":e.pop().toLowerCase()},_i.isSupported=function(e,t){return!!ft()&&(t in _i.Nb||_i.getExtension(e)in _i.cc)},U("shaka.media.PresentationTimeline",wi),wi.prototype.ha=function(){return this.l},wi.prototype.getDuration=wi.prototype.ha,wi.prototype.xf=function(){return this.g},wi.prototype.getMaxSegmentDuration=wi.prototype.xf,wi.prototype.Fa=function(e){this.l=e},wi.prototype.setDuration=wi.prototype.Fa,wi.prototype.Ff=function(){return this.j},wi.prototype.getPresentationStartTime=wi.prototype.Ff,wi.prototype.Ke=function(e){this.u=e},wi.prototype.setClockOffset=wi.prototype.Ke,wi.prototype.hc=function(e){this.A=e},wi.prototype.setStatic=wi.prototype.hc,wi.prototype.Pd=function(e){this.m=e},wi.prototype.setSegmentAvailabilityDuration=wi.prototype.Pd,wi.prototype.Ag=function(e){this.Ic=e},wi.prototype.setDelay=wi.prototype.Ag,wi.prototype.pf=function(){return this.Ic},wi.prototype.getDelay=wi.prototype.pf,wi.prototype.Jb=function(e,t){if(0!=e.length){var n=e[e.length-1].endTime+t;this.vd(e[0].startTime+t),this.g=e.reduce((function(e,t){return Math.max(e,t.endTime-t.startTime)}),this.g),this.h=Math.max(this.h,n),null!=this.j&&this.C&&(this.j=(Date.now()+this.u)/1e3-this.h-this.g),B.K("notifySegments:","maxSegmentDuration="+this.g)}},wi.prototype.notifySegments=wi.prototype.Jb,wi.prototype.vd=function(e){this.i=null==this.i?e:Math.min(this.i,e)},wi.prototype.notifyMinSegmentStartTime=wi.prototype.vd,wi.prototype.ud=function(e){this.g=Math.max(this.g,e),B.K("notifyNewSegmentDuration:","maxSegmentDuration="+this.g)},wi.prototype.notifyMaxSegmentDuration=wi.prototype.ud,wi.prototype.offset=function(e){null!=this.i&&(this.i+=e),null!=this.h&&(this.h+=e)},wi.prototype.offset=wi.prototype.offset,wi.prototype.aa=function(){return 1/0==this.l&&!this.A},wi.prototype.isLive=wi.prototype.aa,wi.prototype.ib=function(){return 1/0!=this.l&&!this.A},wi.prototype.isInProgress=wi.prototype.ib,wi.prototype.$b=function(){if(1/0==this.m)return this.o;var e=this.Db()-this.m;return Math.max(this.o,e)},wi.prototype.getSegmentAvailabilityStart=wi.prototype.$b,wi.prototype.Le=function(e){this.o=e},wi.prototype.setUserSeekStart=wi.prototype.Le,wi.prototype.Db=function(){return this.aa()||this.ib()?Math.min(Math.max(0,(Date.now()+this.u)/1e3-this.g-this.j),this.l):this.l},wi.prototype.getSegmentAvailabilityEnd=wi.prototype.Db,wi.prototype.Zb=function(e){var t=Math.max(this.i,this.o);if(1/0==this.m)return Math.ceil(1e3*t)/1e3;var n=this.Db()-this.m;return e=Math.min(n+e,this.Ka()),Math.max(t,e)},wi.prototype.getSafeSeekRangeStart=wi.prototype.Zb,wi.prototype.Cb=function(){return this.Zb(0)},wi.prototype.getSeekRangeStart=wi.prototype.Cb,wi.prototype.Ka=function(){var e=this.aa()||this.ib()?this.Ic:0;return Math.max(0,this.Db()-e)},wi.prototype.getSeekRangeEnd=wi.prototype.Ka,wi.prototype.Pe=function(){return!(null==this.j||null!=this.h&&this.C)},wi.prototype.usingPresentationStartTime=wi.prototype.Pe,U("shaka.dash.DashParser",ki),(r=ki.prototype).configure=function(e){this.g=e},r.start=function(e,t){var n=this;return p((function r(){var i;return M(r,(function(r){switch(r.s){case 1:return n.j=[e],n.h=t,k(r,Ti(n),2);case 2:if(i=r.B,n.h&&Ii(n,i),!n.h)throw new J(2,7,7001);return r.return(n.i)}}))}))},r.stop=function(){return this.g=this.h=null,this.j=[],this.i=null,this.u=[],this.A={},null!=this.o&&(this.o.stop(),this.o=null),this.l.destroy()},r.update=function(){Ti(this).catch(function(e){this.h&&this.h.onError(e)}.bind(this))},r.onExpirationUpdated=function(){},r.ig=function(e,t){if(e.fa=Ri(t,e.qa,null),"image"==e.fa.contentType)return B.v("Skipping Image AdaptationSet",e.fa),null;var n=!1,r=Kr.Y(t,"Role"),i=r.map((function(e){return e.getAttribute("value")})).filter(le.Ra),o=void 0,a="text"==e.fa.contentType;a&&(o="subtitle");for(var s=0;s<r.length;s++){var u=r[s].getAttribute("schemeIdUri");if(null==u||"urn:mpeg:dash:role:2011"==u)switch(u=r[s].getAttribute("value"),u){case"main":n=!0;break;case"caption":case"subtitle":o=u}}var c=null,l=!1;Kr.Y(t,"EssentialProperty").forEach((function(e){"http://dashif.org/guidelines/trickmode"==e.getAttribute("schemeIdUri")?c=e.getAttribute("value"):l=!0})),s=Kr.Y(t,"Accessibility");var d=new Map;for(r={},u=(s=h(s)).next();!u.done;r={Vb:r.Vb},u=s.next()){var f=u.value;u=f.getAttribute("schemeIdUri"),f=f.getAttribute("value"),"urn:scte:dash:cc:cea-608:2015"==u||"urn:scte:dash:cc:cea-708:2015"==u?(r.Vb=1,null!=f?f.split(";").forEach(function(e){return function(t){if(t.includes("=")){var n=(t=t.split("="))[0].startsWith("CC")?t[0]:"CC"+t[0];t=t[1].split(",")[0].split(":").pop()}else n="CC"+e.Vb,e.Vb+=2;d.set(n,Mn(t))}}(r)):d.set("CC1","und")):"urn:mpeg:dash:role:2011"==u&&null!=f&&(i.push(f),"captions"==f&&(o="caption"))}if(l)return null;var p=Hr(r=Kr.Y(t,"ContentProtection"),this.g.dash.customScheme,this.g.dash.ignoreDrmInfo);if(r=Mn(t.getAttribute("lang")||"und"),s=t.getAttribute("label"),(u=Kr.Y(t,"Label"))&&u.length&&(u=u[0]).textContent&&(s=u.textContent),0==(i=(u=Kr.Y(t,"Representation")).map(this.lg.bind(this,e,p,o,r,s,n,i,d)).filter((function(e){return!!e}))).length){if(this.g.dash.ignoreEmptyAdaptationSet||a)return null;throw new J(2,4,4003)}return e.fa.contentType&&"application"!=e.fa.contentType||(e.fa.contentType=Ci(i[0].mimeType,i[0].codecs),i.forEach((function(t){t.type=e.fa.contentType}))),i.forEach((function(e){p.drmInfos.forEach((function(t){e.keyId&&t.keyIds.push(e.keyId)}))})),a=u.map((function(e){return e.getAttribute("id")})).filter(le.Ra),{id:e.fa.id||"__fake__"+this.m++,contentType:e.fa.contentType,language:r,pd:n,streams:i,drmInfos:p.drmInfos,Td:c,tg:a}},r.lg=function(e,t,n,r,i,o,a,s,u){if(e.G=Ri(u,e.fa,null),!function(e){var t=e.ec?1:0;return t+=e.Ua?1:0,0==(t+=e.gc?1:0)?"text"==e.contentType||"application"==e.contentType||(B.v("Representation does not contain a segment information source:","the Representation must contain one of SegmentBase, SegmentList,",'SegmentTemplate, or explicitly indicate that it is "text".',e),!1):(1!=t&&(B.v("Representation contains multiple segment information sources:","the Representation should only contain one of SegmentBase,","SegmentList, or SegmentTemplate.",e),e.ec?(B.info("Using SegmentBase by default."),e.Ua=null):B.info("Using SegmentList by default."),e.gc=null),!0)}(e.G))return B.v("Skipping Representation",e.G),null;e.bandwidth=Kr.R(u,"bandwidth",Kr.Gc)||0;var c=e.G.contentType;c="text"==c||"application"==c;try{var l=this.ug.bind(this);if(e.G.ec)var d=function(e,t){var n=Number($r(e,yi,"presentationTimeOffset"))||0,r=$r(e,yi,"timescale"),i=1;r&&(i=Kr.Gc(r)||1),n=n/i||0,r=pi(e,yi);var o=e.G.contentType;if(i=e.G.mimeType.split("/")[1],"text"!=o&&"mp4"!=i&&"webm"!=i)throw B.error("SegmentBase specifies an unsupported container type.",e.G),new J(2,4,4006);if("webm"==i&&!r)throw B.error("SegmentBase does not contain sufficient segment information:","the SegmentBase uses a WebM container,","but does not contain an Initialization element.",e.G),new J(2,4,4005);o=ei(e,yi,"RepresentationIndex");var a=$r(e,yi,"indexRange"),s=e.G.xa;if(a=Kr.Hc(a||""),o){var u=o.getAttribute("sourceURL");u&&(s=de(e.G.xa,[u])),a=Kr.R(o,"range",Kr.Hc,a)}if(!a)throw B.error("SegmentBase does not contain sufficient segment information:","the SegmentBase does not contain @indexRange","or a RepresentationIndex element.",e.G),new J(2,4,4002);return{createSegmentIndex:(i=mi(e,t,r,s,a.start,a.end,i,n)).createSegmentIndex,findSegmentPosition:i.findSegmentPosition,getSegmentReference:i.getSegmentReference,initSegmentReference:r,sa:n}}(e,l);else if(e.G.Ua)d=vi(e,this.A);else if(e.G.gc)d=bi(e,l,this.A,!!this.i);else{var h=e.G.xa,f=e.$.duration||0;d={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(e){return 0<=e&&e<f?1:null},getSegmentReference:function(e){return 1!=e?null:new ri(1,0,f,(function(){return h}),0,null)},initSegmentReference:null,sa:0}}}catch(p){if(c&&4002==p.code)return null;throw p}return u=function(e,t,n,r){var i=Hr(e,t,r);if(n.ge)e=1==n.drmInfos.length&&!n.drmInfos[0].keySystem,t=0==i.drmInfos.length,(0==n.drmInfos.length||e&&!t)&&(n.drmInfos=i.drmInfos),n.ge=!1;else if(0<i.drmInfos.length&&(n.drmInfos=n.drmInfos.filter((function(e){return i.drmInfos.some((function(t){return t.keySystem==e.keySystem}))})),0==n.drmInfos.length))throw new J(2,4,4008);return i.be||n.be}(u=Kr.Y(u,"ContentProtection"),this.g.dash.customScheme,t,this.g.dash.ignoreDrmInfo),{id:this.m++,originalId:e.G.id,createSegmentIndex:d.createSegmentIndex,findSegmentPosition:d.findSegmentPosition,getSegmentReference:d.getSegmentReference,initSegmentReference:d.initSegmentReference,presentationTimeOffset:d.sa,mimeType:e.G.mimeType,codecs:e.G.codecs,frameRate:e.G.frameRate,pixelAspectRatio:e.G.pixelAspectRatio,bandwidth:e.bandwidth,width:e.G.width,height:e.G.height,kind:n,encrypted:0<t.drmInfos.length,keyId:u,language:r,label:i,type:e.fa.contentType,primary:o,trickModeVideo:null,emsgSchemeIdUris:e.G.emsgSchemeIdUris,roles:a,channelsCount:e.G.wd,audioSamplingRate:e.G.audioSamplingRate,closedCaptions:s}},r.kg=function(e,t,n){var r=Kr.Mb,i=n.getAttribute("schemeIdUri")||"",o=n.getAttribute("value")||"",a=Kr.R(n,"timescale",r)||1;Kr.Y(n,"Event").forEach(function(n){var s=Kr.R(n,"presentationTime",r)||0,u=Kr.R(n,"duration",r)||0;u=(s=s/a+e)+u/a,null!=t&&(s=Math.min(s,e+t),u=Math.min(u,e+t)),n={schemeIdUri:i,value:o,startTime:s,endTime:u,id:n.getAttribute("id")||"",eventElement:n},this.h.onTimelineRegionAdded(n)}.bind(this))},r.ug=function(e,t,n){return e=Si(e,t,n,this.g.retryParameters),e=this.h.networkingEngine.request(1,e),Ke(this.l,e),e.promise.then((function(e){return e.data}))},_i.Fd("mpd",ki),_i.Qb("application/dash+xml",ki),_i.Qb("video/vnd.mpeg.dash.mpd",ki),Gi.prototype.toString=function(){var e="#"+this.name,t=this.g?this.g.map((function(e){return e.name+"="+(isNaN(Number(e.value))?'"'+e.value+'"':e.value)})):[];return this.value&&t.unshift(this.value),0<t.length&&(e+=":"+t.join(",")),e},Gi.prototype.getAttribute=function(e){var t=this.g.filter((function(t){return t.name==e}));return t.length?t[0]:null};var Xi={Ab:function(e,t){return e.filter((function(e){return e.name==t}))},cb:function(e,t){var n=Xi.Ab(e,t);return n.length?n[0]:null},Zc:function(e,t,n){return e.filter((function(e){var r=e.getAttribute("TYPE");return e=e.getAttribute("GROUP-ID"),r.value==t&&e.value==n}))},Sc:function(e,t){return de([e],[t])[0]},kd:function(e){return/^#(?!EXT)/m.test(e)}};function Wi(e){this.h=e,this.g=0}function Oi(e){Ni(e,/[ \t]+/gm)}function Ni(e,t){t.lastIndex=e.g;var n=t.exec(e.h);return n=null==n?null:{position:n.index,length:n[0].length,wg:n},e.g==e.h.length||null==n||n.position!=e.g?null:(e.g+=n.length,n.wg)}function Ui(e){return e.g==e.h.length?null:(e=Ni(e,/[^ \t\n]*/gm))?e[0]:null}function Fi(){this.g=0}function Yi(e,t,n){var r=(t=(t=ye(t)).replace(/\r\n|\r(?=[^\n]|$)/gm,"\n").trim()).split(/\n+/m);if(!/^#EXTM3U($|[ \t\n])/m.test(r[0]))throw new J(2,4,4015);t=0;for(var i=1;i<r.length;i++)if(!Xi.kd(r[i])){var o=ji(e,r[i]);if(--e.g,Hi.includes(o.name)){t=1;break}"EXT-X-STREAM-INF"==o.name&&(i+=1)}for(i=[],o=1;o<r.length;)if(Xi.kd(r[o]))o+=1;else{var a=ji(e,r[o]);if(Bi.includes(a.name)){if(1!=t)throw new J(2,4,4017);return new Pi(n,t,i,e=Ki(e,n,r=r.splice(o,r.length-o),i))}i.push(a),o+=1,"EXT-X-STREAM-INF"==a.name&&(a.g.push(new Di("URI",r[o])),o+=1)}return new Pi(n,t,i)}function Ki(e,t,n,r){var i=[],o=[];return n.forEach((function(n){if(/^(#EXT)/.test(n))n=ji(e,n),Hi.includes(n.name)?r.push(n):o.push(n);else{if(Xi.kd(n))return[];n=Xi.Sc(t,n.trim()),i.push(new Vi(n,o)),o=[]}})),i}function ji(e,t){var n=e.g++,r=t.match(/^#(EXT[^:]*)(?::(.*))?$/);if(!r)throw new J(2,4,4016,t);var i,o=r[1],a=r[2];if(r=[],a){var s;(s=Ni(a=new Wi(a),/^([^,=]+)(?:,|$)/g))&&(i=s[1]);for(var u=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g;s=Ni(a,u);)r.push(new Di(s[1],s[2]||s[3]))}return new Gi(n,o,r,i)}var Hi="EXT-X-TARGETDURATION EXT-X-MEDIA-SEQUENCE EXT-X-DISCONTINUITY-SEQUENCE EXT-X-PLAYLIST-TYPE EXT-X-MAP EXT-X-I-FRAMES-ONLY EXT-X-ENDLIST".split(" "),Bi="EXTINF EXT-X-BYTERANGE EXT-X-DISCONTINUITY EXT-X-PROGRAM-DATE-TIME EXT-X-KEY EXT-X-DATERANGE".split(" ");function Ji(e){try{var t=Ji.parse(e);return Ge({uri:e,Bd:e,data:t.data,headers:{"content-type":t.contentType}})}catch(n){return Ce(n)}}function zi(){var e=this;this.g=this.j=null,this.ea=1,this.L=new Map,this.Z=new Set,this.h=new Map,this.i=null,this.F="",this.C=new Fi,this.X=0,this.m=new Le((function(){!function(e){p((function t(){var n,r;return M(t,(function(t){switch(t.s){case 1:return B.info("Updating manifest..."),e.j?(x(t,2),k(t,e.update(),4)):t.return();case 4:n=e.X,e.m.V(n),L(t,0);break;case 2:if(r=I(t),!e.j)return t.return();r.severity=1,e.j.onError(r),e.m.V(.1),T(t)}}))}))}(e)})),this.l=vo,this.A=null,this.J=0,this.M=1/0,this.o=new Ye,this.P=[],this.u=new Map,this.da=!1}function Qi(e,t){return p((function n(){var r,i,o,a,s,u,c,l,d,h;return M(n,(function(n){switch(n.s){case 1:return r=Xi,i=go,o=t.We,k(n,mo(e,Je([o],e.g.retryParameters),0),2);case 2:if(a=n.B,1!=(s=Yi(e.C,a.data,a.uri)).type)throw new J(2,4,4017);return c=(u=r.cb(s.g,"EXT-X-MEDIA-SEQUENCE"))?Number(u.value):0,l=t.stream,k(n,oo(e,t.Pc,s,c,l.mimeType,l.codecs),3);case 3:d=n.B,t.fc.g=d,h=d[d.length-1],r.cb(s.g,"EXT-X-ENDLIST")&&(po(e,i.$a),e.i.Fa(h.endTime)),T(n)}}))}))}function qi(e){e.forEach((function(e){if(e){var t=e.stream.codecs.split(",");t=t.filter((function(e){return"mp4a.40.34"!=e})),e.stream.codecs=t.join(",")}}))}function $i(e,t,n,r,i){return{id:e.ea++,language:t?t.language:"und",primary:!!t&&t.primary||!!n&&n.primary,audio:t,video:n,bandwidth:r,drmInfos:i,allowedByApplication:!0,allowedByKeySystem:!0}}function eo(e,t,n){return p((function r(){var i,o,a,s,u,c,l,d,h,f,p;return M(r,(function(r){switch(r.s){case 1:if(i=uo(t,"URI"),e.h.has(i))return r.return(e.h.get(i));if(o=uo(t,"TYPE").toLowerCase(),a=fe,"subtitles"==o&&(o=a.za),s=Mn(Mi(t,"LANGUAGE","und")),u=Mi(t,"NAME"),c=t.getAttribute("DEFAULT"),l="YES"==c,d=Mi(t,"CHANNELS"),"audio"==o)if(d){var m=d.split("/")[0];m=parseInt(m,10)}else m=null;else m=null;return h=m,f=Mi(t,"CHARACTERISTICS"),k(r,to(e,i,n,o,s,l,u,h,null,f),2);case 2:return p=r.B,e.h.has(i)?r.return(e.h.get(i)):null==p?r.return(null):(e.L.set(t.id,p),e.h.set(i,p),r.return(p))}}))}))}function to(e,t,n,r,i,o,a,s,u,c){return p((function l(){var d,f,m,y,v,g,b,A,_,w,S,T,E,R,Z,C,P,G,D,V,X,W,O,N,U,F,Y,K;return M(l,(function(l){switch(l.s){case 1:return f=(d=Xi).Sc(e.F,t),k(l,mo(e,Je([f],e.g.retryParameters),0),2);case 2:if(m=l.B,f=m.uri,1!=(y=Yi(e.C,m.data,f)).type)throw new J(2,4,4017);v=[],y.segments.forEach((function(e){e=d.Ab(e.h,"EXT-X-KEY"),v.push.apply(v,e)})),g=!1,b=[],A=null;for(var j=h(v),H=j.next();!H.done;H=j.next())if(_=H.value,"NONE"!=(w=uo(_,"METHOD"))){if(g=!0,"AES-128"==w)return B.v("Unsupported HLS Encryption",w),e.da=!0,l.return(null);S=uo(_,"KEYFORMAT"),(E=(T=yo[S])?T(_):null)?(E.keyIds.length&&(A=E.keyIds[0]),b.push(E)):B.v("Unsupported HLS KEYFORMAT",S)}if(g&&!b.length)throw new J(2,4,4026);return function(e,t){var n=go,r=Xi.cb(t.g,"EXT-X-PLAYLIST-TYPE"),i=Xi.cb(t.g,"EXT-X-ENDLIST");i=r&&"VOD"==r.value||i,r=r&&"EVENT"==r.value&&!i,r=!i&&!r,i?po(e,n.$a):(po(e,r?n.Wd:n.Se),n=co(t.g,"EXT-X-TARGETDURATION"),n=Number(n.value),e.J=Math.max(n,e.J),e.M=Math.min(n,e.M))}(e,y),R=function(e,t){if(1==t.length)return t[0];var n=so(e,t);if(null!=n)return n;throw new J(2,4,4025,t)}(r,n),k(l,function(e,t,n,r){return p((function i(){var o,a,s,u,c,l,d,h,f,p;return M(i,(function(i){switch(i.s){case 1:return o=fe,a=r.segments[0].g,s=new Q(a),u=s.pa.split(".").pop(),c=fo[t],(l=c[u])?i.return(l):t==o.za?n&&"vtt"!=n&&"wvtt"!=n?i.return("application/mp4"):i.return("text/vtt"):((d=Je([a],e.g.retryParameters)).method="HEAD",k(i,mo(e,d,1),2));case 2:return h=i.B,(f=h.headers["content-type"])?i.return(f.split(";")[0]):(p=c.mp4,i.return(p))}}))}))}(e,r,R,y),3);case 3:return Z=l.B,ho.includes(Z)&&(R=""),P=(C=d.cb(y.g,"EXT-X-MEDIA-SEQUENCE"))?Number(C.value):0,x(l,4),k(l,oo(e,t,y,P,Z,R),6);case 6:G=l.B,L(l,5);break;case 4:if(4035==(D=I(l)).code)return B.ba("Skipping unsupported HLS stream",Z,t),l.return(null);throw D;case 5:if(V=G[0].startTime,X=G[G.length-1].endTime,W=X-V,O=new oi(G),N=no(y),U=void 0,"text"==r&&(U="subtitle"),F=[],c)for(H=(j=h(c.split(","))).next();!H.done;H=j.next())Y=H.value,F.push(Y);return K={id:e.ea++,originalId:a,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:O.find.bind(O),getSegmentReference:O.get.bind(O),initSegmentReference:N,presentationTimeOffset:0,mimeType:Z,codecs:R,kind:U,encrypted:g,keyId:A,language:i,label:a,type:r,primary:o,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:void 0,pixelAspectRatio:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:F,channelsCount:s,audioSamplingRate:null,closedCaptions:u},l.return({stream:K,fc:O,drmInfos:b,Pc:t,We:f,td:V,Yg:X,duration:W})}}))}))}function no(e){var t=Xi.Ab(e.g,"EXT-X-MAP");if(!t.length)return null;if(1<t.length)throw new J(2,4,4020);var n=uo(t=t[0],"URI"),r=Xi.Sc(e.h,n);return e=0,n=null,(t=Mi(t,"BYTERANGE"))&&(e=t.split("@"),t=Number(e[0]),n=(e=Number(e[1]))+t-1),new ni((function(){return[r]}),e,n)}function ro(e,t,n,r){var i=t.h,o=t.g;t=co(i,"EXTINF").value.split(","),t=r+Number(t[0]);var a=0,s=null;return(i=Xi.cb(i,"EXT-X-BYTERANGE"))&&(a=i.value.split("@"),i=Number(a[0]),s=(a=a[1]?Number(a[1]):e.g+1)+i-1),new ri(n,r,t,(function(){return[o]}),a,s)}function io(e){e.i&&(e.P.forEach((function(t){e.i.Jb(t,0)})),e.P=[])}function oo(e,t,n,r,i,o){return p((function a(){var s,u,c,l,d,h,f,m,y,v;return M(a,(function(a){switch(a.s){case 1:return s=n.segments,u=[],c=s[0].g,l=ro(null,s[0],r,0),d=no(n),k(a,function(e,t,n,r,i,o){return p((function a(){var s,u,c,l,d,h,f,p,m;return M(a,(function(a){switch(a.s){case 1:if(e.A){if(s=e.h.get(t),u=s.fc,c=u.get(r.position))return B.K("Found segment start time in previous manifest"),a.return(c.startTime);B.debug("Unable to find segment start time in previous manifest!")}if(B.K("Fetching segment to find start time"),i=i.toLowerCase(),ho.includes(i))throw B.ba("Raw formats are not yet supported. Skipping "+i),new J(1,4,4035);if("video/webm"==i)throw B.ba("WebM in HLS is not yet supported. Skipping."),new J(1,4,4035);if("video/mp4"!=i&&"audio/mp4"!=i){a.I(2);break}return l=[ao(e,r)],n&&l.push(ao(e,n)),k(a,Promise.all(l),3);case 3:return d=a.B,h=d[0],f=d[1]||d[0],a.return(function(e,t,n,r){var i=0;if((new Vr).box("moov",Xr).box("trak",Xr).box("mdia",Xr).ma("mdhd",(function(e){e.reader.U(0==e.version?8:16),i=e.reader.N(),e.parser.stop()})).parse(r,!0),!i)throw B.error("Unable to find timescale in init segment!"),new J(2,4,4030,e,t);var o=0,a=!1;if((new Vr).box("moof",Xr).box("traf",Xr).ma("tfdt",(function(e){o=(0==e.version?e.reader.N():e.reader.Pb())/i,a=!0,e.parser.stop()})).parse(n,!0),!a)throw new J(2,4,4030,e,t);return o}(t,h.uri,h.data,f.data));case 2:if("video/mp2t"!=i){a.I(4);break}return k(a,ao(e,r),5);case 5:return p=a.B,a.return(function(e,t,n){function r(){o.seek(a+188),71!=(s=o.ra())&&(o.seek(a+192),s=o.ra()),71!=s&&(o.seek(a+204),s=o.ra()),71!=s&&i(),o.Fe(1)}function i(){throw new J(2,4,4030,e,t)}for(var o=new Gr(new DataView(n),0),a=0,s=0;;)if(a=o.ka(),71!=(s=o.ra())&&i(),8191==(8191&(n=o.dc())))r();else if(16384&n){if(0!=(n=(48&o.ra())>>4)&&2!=n||i(),3==n&&(n=o.ra(),o.U(n)),1==o.N()>>8)return o.U(3),0!=(n=o.ra()>>6)&&1!=n||i(),0==o.ra()&&i(),(1073741824*((14&(n=o.ra()))>>1)+((65534&o.dc())<<14|(65534&o.dc())>>1))/9e4;r()}else r()}(t,p.uri,p.data));case 4:if("application/mp4"!=i&&!i.startsWith("text/")){a.I(6);break}return k(a,ao(e,r),7);case 7:return m=a.B,a.return(function(e,t,n){return vn(e=ct(e,t))?(gn(t=new mn(null),e),t.xc(n)):0}(i,o,m.data));case 6:throw new J(2,4,4030,t)}}))}))}(e,t,d,l,i,o),2);case 2:h=a.B,B.debug("First segment",c.split("/").pop(),"starts at",h);for(var g=0;g<s.length;++g)f=s[g],m=u[u.length-1],y=0==g?h:m.endTime,v=ro(m,f,r+g,y),u.push(v);return e.P.push(u),io(e),a.return(u)}}))}))}function ao(e,t){return p((function n(){var r,i,o,a,s,u;return M(n,(function(n){switch(n.s){case 1:return r=1,i=Si(t.i(),t.h,t.h+2048-1,e.g.retryParameters),o=Si(t.i(),t.h,t.g,e.g.retryParameters),e.g.hls.useFullSegmentsForStartTime?n.return(mo(e,o,r)):(x(n,2),k(n,mo(e,i,r),4));case 4:return a=n.B,n.return(a);case 2:if(7001==(s=I(n)).code)throw s;return B.ba("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS preflights.",i.uris[0]),k(n,mo(e,o,r),5);case 5:return u=n.B,n.return(u)}}))}))}function so(e,t){for(var n=lo[e],r=0;r<n.length;r++)for(var i=0;i<t.length;i++)if(n[r].test(t[i].trim()))return t[i].trim();return"text"==e?"":null}function uo(e,t){var n=e.getAttribute(t);if(!n)throw new J(2,4,4023,t);return n.value}function co(e,t){var n=Xi.cb(e,t);if(!n)throw new J(2,4,4024,t);return n}U("shaka.net.DataUriPlugin",Ji),Ji.parse=function(t){var n=t.split(":");if(2>n.length||"data"!=n[0])throw B.error("Bad data URI, failed to parse scheme"),new J(2,1,1004,t);if(2>(n=n.slice(1).join(":").split(",")).length)throw B.error("Bad data URI, failed to extract encoding and MIME type"),new J(2,1,1004,t);var r=n[0];t=e.decodeURIComponent(n.slice(1).join(",")),n=r.split(";"),r=n[0];var i=!1;return 1<n.length&&"base64"==n[n.length-1]&&(i=!0,n.pop()),{data:i?Se.Ja(t).buffer:be(t),contentType:r}},Be("data",Ji),U("shaka.hls.HlsParser",zi),(r=zi.prototype).configure=function(e){this.g=e},r.start=function(e,t){var n=this;return p((function r(){var i,o;return M(r,(function(r){switch(r.s){case 1:return n.j=t,k(r,mo(n,Je([e],n.g.retryParameters),0),2);case 2:return i=r.B,n.F=i.uri,k(r,function(e,t){return p((function n(){var r,i,o,a,s,u,c,l,d,f,m;return M(n,(function(n){switch(n.s){case 1:if(0!=(r=Yi(e.C,t,e.F)).type)throw new J(2,4,4022);return k(n,function(e,t){return p((function n(){var r,i,o,a,s,u,c,l,d,f,m,y;return M(n,(function(n){switch(n.s){case 1:return r=Xi,i=le,o=t.g,a=r.Ab(t.g,"EXT-X-MEDIA"),s=a.filter(function(e){return"SUBTITLES"==uo(e,"TYPE")}.bind(e)),u=s.map(function(e){var t=this;return p((function n(){var r;return M(n,(function(n){switch(n.s){case 1:return t.g.disableText?n.return(null):(x(n,2),k(n,function(e,t){return p((function n(){var r;return M(n,(function(n){switch(n.s){case 1:return uo(t,"TYPE"),k(n,eo(e,t,[]),2);case 2:return r=n.B,n.return(r.stream)}}))}))}(t,e),4));case 4:return n.return(n.B);case 2:if(r=I(n),t.g.hls.ignoreTextStreamFailures)return n.return(null);throw r}}))}))}.bind(e)),c=a.filter((function(e){return"CLOSED-CAPTIONS"==uo(e,"TYPE")})),function(e,t){for(var n=h(t),r=n.next();!r.done;r=n.next()){uo(r=r.value,"TYPE");var i=Mi(r,"LANGUAGE")||"und";i=Mn(i);var o=uo(r,"GROUP-ID");r=uo(r,"INSTREAM-ID"),e.u.get(o)||e.u.set(o,new Map),e.u.get(o).set(r,i)}}(e,c),k(n,Promise.all(u),2);case 2:return l=n.B,d=r.Ab(o,"EXT-X-STREAM-INF"),f=d.map(function(e){return function(e,t,n){return p((function r(){var i,o,a,s,u,c,l,d,f,m,y,v,g,b,A,_,w,S,T,x,E,L,I,R,Z,C,P,G,D;return M(r,(function(r){switch(r.s){case 1:return i=fe,o=Xi,a=[],e.g.disableVideo||a.push("avc1.42E01E"),e.g.disableAudio||a.push("mp4a.40.2"),s=a.join(","),u=Mi(t,"CODECS",s),c=function(e){for(var t=new Set,n=[],r=(e=h(e)).next();!r.done;r=e.next()){var i=dt(r=r.value)[0];t.has(i)?B.debug("Ignoring duplicate codec"):(n.push(r),t.add(i))}return n}(u.split(/\s*,\s*/)),l=t.getAttribute("RESOLUTION"),f=d=null,m=Mi(t,"FRAME-RATE"),y=Number(Mi(t,"AVERAGE-BANDWIDTH"))||Number(uo(t,"BANDWIDTH")),l&&(v=l.value.split("x"),d=v[0],f=v[1]),g=(g=o.Ab(n.g,"EXT-X-MEDIA")).filter((function(e){return"CLOSED-CAPTIONS"!=uo(e,"TYPE")})),g=g.filter((function(e){var t=Mi(e,"URI")||"";return"SUBTITLES"==(Mi(e,"TYPE")||"")||""!=t})),b=Mi(t,"AUDIO"),A=Mi(t,"VIDEO"),b?g=o.Zc(g,"AUDIO",b):A&&(g=o.Zc(g,"VIDEO",A)),(_=so(i.za,c))&&((w=Mi(t,"SUBTITLES"))&&(S=o.Zc(g,"SUBTITLES",w)).length&&(T=e.L.get(S[0].id))&&(T.stream.codecs=_),Ue(c,_)),x=g.map(function(e){return eo(this,e,c)}.bind(e)),E=[],L=[],k(r,Promise.all(x),2);case 2:if(R=(R=r.B).filter((function(e){return null!=e})),b?E=R:A&&(L=R),B.debug("Guessing stream type for",t.toString()),C=!1,E.length||L.length?E.length?(G=uo(t,"URI"),D=E[0].Pc,G==D?(B.debug("Guessing audio-only."),Z=i.Sb,C=!0):(B.debug("Guessing video."),Z=i.Za)):(B.debug("Guessing audio."),Z=i.Sb):1==c.length?(P=so(i.Za,c),l||m||P?(B.debug("Guessing video-only."),Z=i.Za):(B.debug("Guessing audio-only."),Z=i.Sb)):(B.debug("Guessing multiplexed audio+video."),Z=i.Za,c=[c.join(",")]),C){r.I(3);break}return k(r,function(e,t,n,r){return p((function i(){var o,a,s,u,c;return M(i,(function(i){switch(i.s){case 1:return o=fe,a=uo(t,"URI"),e.h.has(a)?i.return(e.h.get(a)):(s=Mi(t,"CLOSED-CAPTIONS"),u=null,r==o.Za&&s&&"NONE"!=s&&(u=e.u.get(s)),k(i,to(e,a,n,r,"und",!1,null,null,u,null),2));case 2:return null==(c=i.B)?i.return(null):e.h.has(a)?i.return(e.h.get(a)):(e.h.set(a,c),i.return(c))}}))}))}(e,t,c,Z),4);case 4:I=r.B;case 3:if(I)I.stream.type==i.Sb?E=[I]:L=[I];else if(null===I)return B.debug("streamInfo is null"),r.return([]);return L&&qi(L),E&&qi(E),r.return(function(e,t,n,r,i,o,a){n.forEach(function(e){(e=e.stream)&&(e.width=Number(i)||void 0,e.height=Number(o)||void 0,e.frameRate=Number(a)||void 0)}.bind(e));var s=!!e.g&&e.g.disableAudio;t.length&&!s||(t=[null]),s=!!e.g&&e.g.disableVideo,(!n.length||s)&&(n=[null]),s=[];for(var u=(t=h(t)).next();!u.done;u=t.next()){u=u.value;for(var c=h(n),l=c.next();!l.done;l=c.next()){var d=l.value;l=u?u.stream:null;var f=d?d.stream:null,p=u?u.drmInfos:null,m=d?d.drmInfos:null;d=(d?d.Pc:"")+" - "+(u?u.Pc:"");var y=void 0;if(l&&f){if(p.length&&m.length&&!(0<Xt(p,m).length)){B.v("Incompatible DRM info in HLS variant. Skipping.");continue}y=Xt(p,m)}else l?y=p:f&&(y=m);e.Z.has(d)?B.debug("Skipping variant which only differs in text streams."):(l=$i(e,l,f,r,y),s.push(l),e.Z.add(d))}}return s}(e,E,L,y,d,f,m))}}))}))}(this,e,t)}.bind(e)),k(n,Promise.all(f),3);case 3:return m=n.B,y=(y=m.reduce(i.Rc,[])).filter((function(e){return null!=e})),n.return({startTime:0,variants:y,textStreams:l.filter((function(e){return null!=e}))})}}))}))}(e,r),2);case 2:if(i=n.B,!e.j)throw new J(2,7,7001);if(e.da&&0==i.variants.length)throw B.info("No stream is created, because we don't support AES-128","encryption yet"),new J(2,4,4034);e.j.filterAllPeriods([i]),o=1/0,a=0,s=1/0;for(var y=h(e.h.values()),v=y.next();!v.done;v=y.next())u=v.value,o=Math.min(o,u.td),a=Math.max(a,u.td),"text"!=u.stream.type&&(s=Math.min(s,u.duration));if(e.l!=go.$a?(e.i=new wi(0,3*e.J),e.i.hc(!1)):(e.i=new wi(null,0),e.i.hc(!0)),io(e),e.l!=go.$a){for(e.X=e.M,c=go,e.l==c.Wd&&(l=e.i.Ic,isNaN(e.g.availabilityWindowOverride)||(l=e.g.availabilityWindowOverride),e.i.Pd(l)),d=0;95443.7176888889<=a;)d+=95443.7176888889,a-=95443.7176888889;if(d)for(B.debug("Offsetting live streams by",d,"to compensate for rollover"),v=(y=h(e.h.values())).next();!v.done;v=y.next())95443.7176888889>(f=v.value).td?(B.K("Offset applied to",f.stream.type),f.stream.presentationTimeOffset=-d,f.fc.offset(d)):B.K("Offset NOT applied to",f.stream.type)}else for(e.i.Fa(s),e.i.offset(-o),v=(y=h(e.h.values())).next();!v.done;v=y.next())(m=v.value).stream.presentationTimeOffset=o,m.fc.offset(-o),ai(m.fc,s);e.A={presentationTimeline:e.i,periods:[i],offlineSessionIds:[],minBufferTime:0},T(n)}}))}))}(n,i.data),3);case 3:return 0<(o=n.X)&&n.m.V(o),r.return(n.A)}}))}))},r.stop=function(){this.m&&(this.m.stop(),this.m=null);var e=[];return this.o&&(e.push(this.o.destroy()),this.o=null),this.g=this.j=null,this.L.clear(),this.Z.clear(),this.h.clear(),this.A=null,Promise.all(e)},r.update=function(){if(this.l!=go.$a){for(var e=[],t=h(this.h.values()),n=t.next();!n.done;n=t.next())e.push(Qi(this,n.value));return Promise.all(e)}},r.onExpirationUpdated=function(){};var lo={audio:[/^vorbis$/,/^opus$/,/^flac$/,/^mp4a/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]},ho=["audio/aac","audio/ac3","audio/ec3","audio/mpeg"],fo={audio:{mp4:"audio/mp4",mp4a:"audio/mp4",m4s:"audio/mp4",m4i:"audio/mp4",m4a:"audio/mp4",m4f:"audio/mp4",cmfa:"audio/mp4",ts:"video/mp2t",aac:"audio/aac",ac3:"audio/ac3",ec3:"audio/ec3",mp3:"audio/mpeg"},video:{mp4:"video/mp4",mp4v:"video/mp4",m4s:"video/mp4",m4i:"video/mp4",m4v:"video/mp4",m4f:"video/mp4",cmfv:"video/mp4",ts:"video/mp2t"},text:{mp4:"application/mp4",m4s:"application/mp4",m4i:"application/mp4",m4f:"application/mp4",cmft:"application/mp4",vtt:"text/vtt",ttml:"application/ttml+xml"}};function po(e,t){e.l=t,e.i&&e.i.hc(e.l==go.$a),e.l!=go.$a||e.m.stop()}function mo(e,t,n){if(!e.o)throw new J(2,7,7001);return t=e.j.networkingEngine.request(n,t),Ke(e.o,t),t.promise}var yo={"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(e){var t=uo(e,"METHOD");Yn("HLS SAMPLE-AES-CENC","SAMPLE-AES-CENC will no longer be supported, see Issue #1227");var n=["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"];return n.includes(t)?(t=uo(e,"URI"),t=Ji.parse(t),t=he("com.widevine.alpha",[{initDataType:"cenc",initData:t=new Uint8Array(t.data)}]),(e=Mi(e,"KEYID"))&&(t.keyIds=[e.toLowerCase().substr(2)]),t):(B.error("Widevine in HLS is only supported with [",n.join(", "),"], not",t),null)}},vo="VOD",go={$a:vo,Se:"EVENT",Wd:"LIVE"};function bo(){this.g=new Map}function Ao(e,t,n){_o(e,t).text=n}function _o(e,t){return e.g.has(t)||e.g.set(t,new wo),e.g.get(t)}function wo(){this.text=this.variant=null}function So(e,t){this.g=e,this.h=new Set([e]);for(var n=h(t=t||[]),r=n.next();!r.done;r=n.next())this.add(r.value)}function ko(e,t){var n;if(!(n=!!e.audio!=!!t.audio||!!e.video!=!!t.video||e.language!=t.language)&&(n=e.audio&&t.audio)){n=e.audio;var r=t.audio;n=!(n.channelsCount==r.channelsCount&&To(n,r)&&xo(n.roles,r.roles))}return!n&&(n=e.video&&t.video)&&(n=!(To(n=e.video,r=t.video)&&xo(n.roles,r.roles))),!n}function To(e,t){if(e.mimeType!=t.mimeType)return!1;var n=e.codecs.split(",").map((function(e){return dt(e)[0]})),r=t.codecs.split(",").map((function(e){return dt(e)[0]}));if(n.length!=r.length)return!1;n.sort(),r.sort();for(var i=0;i<n.length;i++)if(n[i]!=r[i])return!1;return!0}function xo(e,t){var n=new Set(e),r=new Set(t);if(n.delete("main"),r.delete("main"),n.size!=r.size)return!1;for(var i=(n=h(n)).next();!i.done;i=n.next())if(!r.has(i.value))return!1;return!0}function Eo(e){this.g=e,this.h=new Lo(e.language,"",e.audio&&e.audio.channelsCount?e.audio.channelsCount:0,"")}function Lo(e,t,n,r){this.i=e,this.j=t,this.g=n,this.h=void 0===r?"":r}function Io(){this.g=Co,this.h=(new Map).set(Co,2).set(Zo,1)}function Ro(e,t,n){e.h.set(Co,n).set(Zo,t)}_i.Fd("m3u8",zi),_i.Qb("application/x-mpegurl",zi),_i.Qb("application/vnd.apple.mpegurl",zi),So.prototype.add=function(e){return ko(this.g,e)?(this.h.add(e),!0):(B.v("Rejecting variant - not compatible with root."),!1)},So.prototype.values=function(){return this.h.values()},Eo.prototype.create=function(e){var t=this,n=e.filter((function(e){return ko(t.g,e)}));return n.length?new So(n[0],n):this.h.create(e)},Lo.prototype.create=function(e){var t=[];t=function(e,t){var n=Mn(t),r=Xn(n,e.map((function(e){return Vn(e)})));return r?e.filter((function(e){return r==Vn(e)})):[]}(e,this.i);var n=e.filter((function(e){return e.primary}));for((e=function(e,t){return e.filter((function(e){return!!e.audio&&(t?e.audio.roles.includes(t):0==e.audio.roles.length)}))}(t=t.length?t:n.length?n:e,this.j)).length?t=e:B.v("No exact match for variant role could be found."),this.g&&((e=On.ee(t,this.g)).length?t=e:B.v("No exact match for the channel count could be found.")),this.h&&(e=function(e,t){return e.filter((function(e){return!!e.audio&&e.audio.label.toLowerCase()==t.toLowerCase()}))}(t,this.h),e.length?t=e:B.v("No exact match for variant label could be found.")),e=new So(t[0]),n=(t=h(t)).next();!n.done;n=t.next())n=n.value,ko(e.g,n)&&e.add(n);return e};var Zo=0,Co=1;function Po(e,t){this.l=e,this.m=Do(e),this.g=e.g.currentTime,this.j=Date.now()/1e3,this.h=!1,this.o=t,this.i=function(){}}function Go(e){this.g=e}function Do(e){if(e.g.paused||0==e.g.playbackRate||0==e.g.buffered.length)var t=!1;else e:{t=e.g.buffered,e=e.g.currentTime;for(var n=0;n<t.length;n++){var r=t.start(n),i=t.end(n);if(!(e<r-.1||e>i-.5)){t=!0;break e}}t=!1}return t}function Mo(e,t,n,r,i){var o=this;this.g=e,this.F=t,this.C=n,this.u=i,this.j=new et,this.o=!1,this.A=e.readyState,this.i=!1,this.h=r,this.m=!1,this.j.H(e,"waiting",(function(){return Vo(o)})),this.l=new Le((function(){Vo(o)})).Oa(.25)}function Vo(e){if(0!=e.g.readyState){if(e.g.seeking){if(!e.o)return}else e.o=!1;if(!e.g.paused||0==e.g.currentTime){var t;if(e.g.readyState!=e.A&&(e.i=!1,e.A=e.g.readyState),!(t=!e.h)){var n=(t=e.h).l,r=Do(n),i=n.g.currentTime,o=Date.now()/1e3;t.g==i&&t.m==r||(t.j=o,t.g=i,t.m=r,t.h=!1),(r=(i=o-t.j)>=t.o&&r&&!t.h)&&(t.i(t.g,i),t.h=!0,t.g=n.g.currentTime),t=!r}if(t){o=e.C.smallGapLimit,t=e.g.currentTime;e:{if((n=e.g.buffered)&&n.length&&!(1==n.length&&1e-6>n.end(0)-n.start(0)))for(r=navigator.userAgent.match(/Edge\//)||gt("Trident/")||mt()||gt("CrKey")?.5:.1,i=0;i<n.length;i++)if(n.start(i)>t&&(0==i||n.end(i-1)-t<=r)){r=i;break e}r=null}if(null!=r&&(0!=r||e.m)){i=n.start(r);var a=e.F.Ka();if(!(i>=a)){o=(a=i-t)<=o;var s=!1;if(!(.001>a)){if(!o&&!e.i){e.i=!0;var u=new Ve("largegap",{currentTime:t,gapSize:a});u.cancelable=!0,e.u(u),e.C.jumpLargeGaps&&!u.defaultPrevented?s=!0:B.info("Ignoring large gap at",t,"size",a)}(o||s)&&(0==r?B.info("Jumping forward",a,"seconds because of gap before start time of",i):B.info("Jumping forward",a,"seconds because of gap starting at",n.end(r-1),"and ending at",i),e.g.currentTime=i)}}}}}}}function Xo(e){var t=this;this.i=e,this.g=new Set,this.h=new Le((function(){Wo(t,!1)})).Oa(.25)}function Wo(e,t){for(var n=h(e.g),r=n.next();!r.done;r=n.next())r.value.l(e.i.currentTime,t)}function Oo(e){for(var t=[],n=(e=h(e)).next();!n.done;n=e.next())for(var r=(n=h(n.value.variants)).next();!r.done;r=n.next())t.push(r.value);return t}function No(e,t){for(var n=null,r=h(e),i=r.next();!i.done;i=r.next())t>=(i=i.value).startTime&&(n=i);return n}function Uo(e){this.i=e,this.g=null,this.h=function(){}}function Fo(e){var t=this;this.g=e,this.j=!1,this.i=this.g.wc(),this.h=new Le((function(){t.g.pe(.25*t.i)}))}function Yo(e){e.h.stop();var t=e.j?0:e.i;if(0<=t)try{return void(e.g.wc()!=t&&e.g.Od(t))}catch(n){}e.h.Oa(.25),0!=e.g.wc()&&e.g.Od(0)}function Ko(e,t,n,r){t==HTMLMediaElement.HAVE_NOTHING||e.readyState>=t?r():(t=jo.get(t),n.ya(e,t,r))}Po.prototype.release=function(){this.l=null,this.i=function(){}},Mo.prototype.release=function(){this.j&&(this.j.release(),this.j=null),null!=this.l&&(this.l.stop(),this.l=null),this.h&&(this.h.release(),this.h=null),this.g=this.F=this.u=null},Mo.prototype.zd=function(){this.m=!0,Vo(this)},Xo.prototype.release=function(){this.h.stop();for(var e=h(this.g),t=e.next();!t.done;t=e.next())t.value.release();this.g.clear()},Uo.prototype.release=function(){this.g=this.i=null,this.h=function(){}},Uo.prototype.l=function(e){var t=this.g,n=this.i.periods;t!=(e=No(n,e)||n[0])&&this.h(e),this.g=e},Fo.prototype.release=function(){this.h&&(this.h.stop(),this.h=null),this.g=null},Fo.prototype.set=function(e){this.i=e,Yo(this)},Fo.prototype.vc=function(){return this.g.vc()};var jo=new Map([[HTMLMediaElement.HAVE_METADATA,"loadedmetadata"],[HTMLMediaElement.HAVE_CURRENT_DATA,"loadeddata"],[HTMLMediaElement.HAVE_FUTURE_DATA,"canplay"],[HTMLMediaElement.HAVE_ENOUGH_DATA,"canplaythrough"]]);function Ho(e,t,n){var r=this;this.g=e,this.l=t,this.j=n,this.m=!1,this.h=new et,this.i=new qo(e),Ko(this.g,HTMLMediaElement.HAVE_METADATA,this.h,(function(){zo(r,r.j)}))}function Bo(e){return e.m?e.g.currentTime:e.j}function Jo(e,t){0<e.g.readyState?$o(e.i,t):Ko(e.g,HTMLMediaElement.HAVE_METADATA,e.h,(function(){zo(e,e.j)}))}function zo(e,t){.001>Math.abs(e.g.currentTime-t)?Qo(e):(e.h.ya(e.g,"seeking",(function(){Qo(e)})),$o(e.i,0==e.g.currentTime?t:e.g.currentTime))}function Qo(e){e.m=!0,e.h.H(e.g,"seeking",(function(){return e.l()}))}function qo(e){var t=this;this.h=e,this.m=10,this.l=this.i=this.j=0,this.g=new Le((function(){0>=t.j?(B.v(["Failed to move playhead from",t.i,"to",t.l].join(" ")),t.g.stop()):t.h.currentTime!=t.i?t.g.stop():(t.h.currentTime=t.l,t.j--)}))}function $o(e,t){e.i=e.h.currentTime,e.l=t,e.j=e.m,e.h.currentTime=t,e.g.Oa(.1)}function ea(e){var t=this;this.g=e,this.j=!1,this.i=null,this.h=new et,Ko(this.g,HTMLMediaElement.HAVE_CURRENT_DATA,this.h,(function(){null==t.i?t.j=!0:(t.h.ya(t.g,"seeking",(function(){t.j=!0})),t.g.currentTime=Math.max(0,t.g.currentTime+t.i))}))}function ta(e,t,n,r,i,o){var a=this;this.i=e,this.g=t.presentationTimeline,this.J=t.minBufferTime||0,this.m=n,this.F=i,this.u=null,this.j=new Mo(e,t.presentationTimeline,n,function(e,t){if(!t.stallEnabled)return null;var n=t.stallSkip,r=new Po(new Go(e),t.stallThreshold);return function(e,t){e.i=t}(r,(function(t,r){B.debug("Stall detected at "+t+" for "+r+" seconds."),n?(B.debug("Seeking forward "+n+" seconds to break stall."),e.currentTime+=n):(B.debug("Pausing and unpausing to break stall."),e.pause(),e.play())})),r}(e,n),o),this.h=new Ho(e,(function(){e:{var e=a.j;e.o=!0,e.m=!1,e.i=!1,e=Bo(a.h);var t=ra(a,e);if(.001<Math.abs(t-e)){var n=Date.now()/1e3;if(!a.u||a.u<n-1){a.u=n,Jo(a.h,t),e=void 0;break e}}B.K("Seek to "+e),a.F(),e=void 0}return e}),function(e,t){return null==t?t=1/0>e.g.ha()?e.g.Cb():e.g.Ka():0>t&&(t=e.g.Ka()+t),na(e,ia(e,t))}(this,r)),this.o=new Le((function(){if(0!=a.i.readyState&&!a.i.paused){var e=Bo(a.h),t=a.g.Cb(),n=a.g.Ka();3>n-t&&(t=n-3),e<t&&(t=ra(a,e),B.info("Jumping forward "+(t-e)+" seconds to catch up with the seek range."),a.i.currentTime=t)}})).Oa(.25)}function na(e,t){var n=e.g.ha();return t>=n?n-e.m.durationBackoff:t}function ra(e,t){var n=Bt.bind(null,e.i.buffered),r=Math.max(e.J,e.m.rebufferingGoal),i=e.m.safeSeekOffset,o=e.g.Cb(),a=e.g.Ka(),s=e.g.ha();3>a-o&&(o=a-3);var u=e.g.Zb(r),c=e.g.Zb(i);return r=e.g.Zb(r+i),t>=s?(B.K("Playhead past duration."),na(e,t)):t>a?(B.K("Playhead past end."),a):t<o?n(c)?(B.K("Playhead before start & start is buffered"),c):(B.K("Playhead before start & start is unbuffered"),r):t>=u||n(t)?(B.K("Playhead in safe region or in buffered region."),t):(B.K("Playhead outside safe region & in unbuffered region."),r)}function ia(e,t){var n=e.g.Cb();return t<n||t>(n=e.g.Ka())?n:t}function oa(e){var t=this;this.h=function(){},this.g=new Set,this.j=e,this.i=new Le((function(){for(var e=t.j(),n=h(t.g),r=n.next();!r.done;r=n.next())(r=r.value).endTime<e.start&&t.g.delete(r)})).Oa(2)}function aa(e){var t=this;this.m=e,this.j=new Map,this.g=function(){},this.h=function(){},this.i=function(){},this.o=[{rb:null,qb:ua,hb:function(e,n){return t.g(e,n)}},{rb:sa,qb:ua,hb:function(e,n){return t.g(e,n)}},{rb:ca,qb:ua,hb:function(e,n){return t.g(e,n)}},{rb:ua,qb:sa,hb:function(e,n){return t.h(e,n)}},{rb:ua,qb:ca,hb:function(e,n){return t.h(e,n)}},{rb:sa,qb:ca,hb:function(e,n){return t.i(e,n)}},{rb:ca,qb:sa,hb:function(e,n){return t.i(e,n)}}]}Ho.prototype.release=function(){this.h&&(this.h.release(),this.h=null),null!=this.i&&(this.i.release(),this.i=null),this.l=function(){},this.g=null},qo.prototype.release=function(){this.g&&(this.g.stop(),this.g=null),this.h=null},ea.prototype.release=function(){this.h&&(this.h.release(),this.h=null),this.g=null},ea.prototype.A=function(e){this.i=this.j?this.i:e},ea.prototype.l=function(){return(this.j?this.g.currentTime:this.i)||0},ea.prototype.C=function(){},ta.prototype.release=function(){this.h&&(this.h.release(),this.h=null),this.j&&(this.j.release(),this.j=null),this.o&&(this.o.stop(),this.o=null),this.i=this.h=this.g=this.m=null,this.F=function(){}},ta.prototype.A=function(e){Jo(this.h,e)},ta.prototype.l=function(){var e=Bo(this.h);return 0<this.i.readyState&&!this.i.paused?ia(this,e):e},ta.prototype.C=function(){this.j.zd()},oa.prototype.release=function(){this.h=function(){},this.g.clear(),this.i.stop()},aa.prototype.release=function(){this.m=null,this.j.clear(),this.g=function(){},this.h=function(){},this.i=function(){}},aa.prototype.l=function(e,t){for(var n=h(this.m.g),r=n.next();!r.done;r=n.next()){r=r.value;var i=this.j.get(r),o=e<r.startTime?sa:e>r.endTime?ca:ua;this.j.set(r,o);for(var a=h(this.o),s=a.next();!s.done;s=a.next())(s=s.value).rb==i&&s.qb==o&&s.hb(r,t)}};var sa=1,ua=2,ca=3;function la(e,t){this.g=t,this.i=e,this.l=null,this.u=1,this.F=Promise.resolve(),this.m=[],this.o=new Map,this.h=new Map,this.C=!1,this.M=null,this.L=this.j=this.A=!1,this.J=0}function da(e){return fa(e,"audio")}function ha(e){return fa(e,"video")}function fa(e,t){var n=e.h.get(t);return n?n.Ta||n.stream:null}function pa(e,t){return p((function n(){var r,i,o,a,s,u,c,l,d;return M(n,(function(n){switch(n.s){case 1:return r=fe,k(n,Rn(e.g.T,r.za),2);case 2:return e.J++,e.L=!1,i=e.J,o=e.g.T,a=new Map,s=new Set,a.set(r.za,t),s.add(t),k(n,o.init(a,!1),3);case 3:return e.j?n.return():k(n,wa(e,s),4);case 4:if(e.j)return n.return();u=e.g.T.l.isTextVisible()||e.l.alwaysStreamText,e.J!=i||e.h.has(r.za)||e.L||!u||(c=e.g.eb(),l=Ra(e,c),d=Aa(t,l,0),e.h.set(r.za,d),Ga(e,d,0)),T(n)}}))}))}function ma(e,t){var n=e.h.get("video");if(n){var r=n.stream;if(r)if(B.debug("setTrickPlay",t),t){var i=r.trickModeVideo;i&&!n.Ta&&(B.debug("Engaging trick mode stream",i),va(e,i,!1,0,!1),n.Ta=r)}else(r=n.Ta)&&(B.debug("Restoring non-trick-mode stream",r),n.Ta=null,va(e,r,!0,0,!1))}}function ya(e,t,n,r){var i=!1;if(t.video){var o=va(e,t.video,n,r,!1);i=i||o}return t.audio&&(e=va(e,t.audio,n,r,!1),i=i||e),i}function va(e,t,n,r,i){var o=e.h.get(t.type);if(!o&&"text"==t.type&&e.l.ignoreTextStreamFailures)return pa(e,t),!0;if(!o)return!1;var a=Za(e,t),s=Array.from(e.h.values()).every((function(e){return e.oa==o.oa}));return n&&a!=o.oa&&s?(B.debug("switch: switching to stream in another Period; clearing buffer and changing Periods"),e.h.forEach((function(t){ga(e,t)})),!0):(o.Ta&&(B.debug("switch during trick play mode",t),t.trickModeVideo?(o.Ta=t,t=t.trickModeVideo,B.debug("switch found trick play stream",t)):(o.Ta=null,B.debug("switch found no special trick play stream"))),!(!(s=e.m[a])||!s.Rb||!(s=e.o.get(t.id))||!s.Rb||(o.stream!=t||i?("text"==t.type&&Sn(e.g.T,ct(t.mimeType,t.codecs)),o.stream=t,o.Ac=!0,B.debug("switch: switching to Stream "+Xa(o)),function(e,t,n){if(!t.lb)return!1;var r=e.g.eb(),i=xn(e.g.T,t.type),o=Ta(e,t,r,i,n);return n=o&&o.g?o.g-o.h:null,o&&!n&&(n=(o.endTime-o.xc())*t.stream.bandwidth/8),!isNaN(n)&&((o=t.stream.initSegmentReference)&&(n+=(o.g?o.g-o.h:null)||0),o=e.g.getBandwidthEstimate(),8*n/o<i-r-Math.max(e.i.minBufferTime||0,e.l.rebufferingGoal)||t.lb.h.g>n)}(e,o,a)&&(B.info("Aborting current segment request to switch."),o.lb.abort()),n&&(o.ab?o.Qc=!0:o.Sa?(o.Wa=!0,o.oc=r,o.Qc=!0):(Da(o),Pa(e,o,!0,r).catch((function(t){e.g&&e.g.onError(t)})))),0):(B.debug("switch: Stream "+Xa(o)+" already active"),1))))}function ga(e,t){var n=Xa(t);t.ab?B.debug(n,"clear: already clearing the buffer"):t.Wa?B.debug(n,"clear: already waiting"):t.Sa?(B.debug(n,"clear: currently updating"),t.Wa=!0,t.oc=0):null==Tn(e.g.T,t.type)?(B.debug(n,"clear: nothing buffered"),null==t.Pa&&Ga(e,t,0)):(B.debug(n,"clear: handling right now"),Da(t),Pa(e,t,!1,0).catch((function(t){e.g&&e.g.onError(t)})))}function ba(e,t,n,r,i){return p((function o(){var a,s,u,c,l,d,h;return M(o,(function(o){switch(o.s){case 1:return a=e.g.eb(),s=Ra(e,a),u=fe,c=new Map,l=new Set,t&&(c.set(u.Sb,t),l.add(t)),n&&(c.set(u.Za,n),l.add(n)),r&&(c.set(u.za,r),l.add(r)),d=e.g.T,h=e.l.forceTransmuxTS,k(o,d.init(c,h),2);case 2:return e.j?o.return():(function(e){var t=e.i.presentationTimeline.ha();1/0>t?e.g.T.Fa(t):e.g.T.Fa(Math.pow(2,32))}(e),k(o,wa(e,l),3));case 3:if(e.j)return o.return();c.forEach((function(t,n){if(!e.h.has(n)){var r=Aa(t,s,i);e.h.set(n,r),Ga(e,r,0)}})),T(o)}}))}))}function Aa(e,t,n){return{stream:e,type:e.type,Hb:null,La:null,Ta:null,Ac:!0,oa:t,endOfStream:!1,Sa:!1,Pa:null,Wa:!1,oc:0,Qc:!1,ab:!1,Ed:!1,ac:!1,Hd:n||0,lb:null}}function _a(e,t){var n=e.m[t];if(n)return B.debug("(all) Period "+t+" is being or has been set up"),n.promise;B.debug("(all) setting up Period "+t),n={promise:new me,Rb:!1},e.m[t]=n;for(var r=new Set,i=h(e.i.periods[t].variants),o=i.next();!o.done;o=i.next())(o=o.value).video&&r.add(o.video),o.video&&o.video.trickModeVideo&&r.add(o.video.trickModeVideo),o.audio&&r.add(o.audio);for(o=(i=h(e.i.periods[t].textStreams)).next();!o.done;o=i.next())r.add(o.value);return e.F=e.F.then(function(){if(!this.j)return wa(this,r)}.bind(e)).then(function(){this.j||(this.m[t].promise.resolve(),this.m[t].Rb=!0,B.K("(all) setup Period "+t))}.bind(e)).catch(function(e){this.j||(this.m[t].promise.catch((function(){})),this.m[t].promise.reject(),delete this.m[t],B.v("(all) failed to setup Period "+t),this.g.onError(e))}.bind(e)),n.promise}function wa(e,t){return p((function n(){var r,i,o,a,s,u,c;return M(n,(function(n){switch(n.s){case 1:r=[];for(var l=h(t),d=l.next();!d.done;d=l.next())i=d.value,(o=e.o.get(i.id))?(B.debug("(all) Stream "+i.id+" is being or has been set up"),r.push(o.promise)):(B.K("(all) setting up Stream "+i.id),e.o.set(i.id,{promise:new me,Rb:!1}),r.push(i.createSegmentIndex()));return x(n,2),k(n,Promise.all(r),4);case 4:if(e.j)return n.return();L(n,3);break;case 2:if(a=I(n),e.j)return n.return();for(d=(n=h(t)).next();!d.done;d=n.next())s=d.value,e.o.get(s.id).promise.catch((function(){})),e.o.get(s.id).promise.reject(),e.o.delete(s.id);throw a;case 3:for(d=(l=h(t)).next();!d.done;d=l.next())u=d.value,(c=e.o.get(u.id)).Rb||(c.promise.resolve(),c.Rb=!0,B.K("(all) setup Stream "+u.id));T(n)}}))}))}function Sa(e,t){if(!e.j){var n=Xa(t);if(!t.Sa&&null!=t.Pa&&!t.ab)if(t.Pa=null,t.Wa)B.debug(n,"skipping update and clearing the buffer"),Pa(e,t,t.Qc,t.oc);else{try{var r=function(e,t){if(La(t))return In(e.g.T,t.stream.originalId||""),null;var n=Xa(t),r=e.g.eb(),i=ka(e,t,r);B.O(n,"timeNeeded="+i);var o=Za(e,t.stream),a=Ra(e,i),s=function(e,t,n){return"text"==t?null==(e=e.g).h||e.h<n?0:e.h-Math.max(n,e.g):Jt(e=En(e,t),n)}(e.g.T,t.type,r);B.O(n,"update_:","presentationTime="+r,"bufferedAhead="+s);var u=Math.max(e.i.minBufferTime||0,e.l.rebufferingGoal,e.l.bufferingGoal)*e.u;if(i>=e.i.presentationTimeline.ha())return B.debug(n,"buffered to end of presentation"),t.endOfStream=!0,"video"==t.type&&(i=e.h.get("text"))&&"application/cea-608"==i.stream.mimeType&&(i.endOfStream=!0),null;if(t.endOfStream=!1,t.oa=a,a!=o)return B.debug(n,"need Period "+a,"presentationTime="+r,"timeNeeded="+i,"currentPeriodIndex="+o),null;if(s>=u)return B.O(n,"buffering goal met"),.5;if(n=xn(e.g.T,t.type),!(n=Ta(e,t,r,n,o)))return 1;var c=1/0;return Array.from(e.h.values()).forEach((function(t){La(t)||(t=ka(e,t,r),c=Math.min(c,t))})),i>=c+e.i.presentationTimeline.g?1:(t.Hd=0,function(e,t,n,r,i){var o=Xa(t),a=e.i.periods[r];B.K(o,"fetchAndAppend_:","presentationTime="+n,"currentPeriod.startTime="+a.startTime,"reference.position="+i.position,"reference.startTime="+i.startTime,"reference.endTime="+i.endTime);var s=t.stream,u=e.i.presentationTimeline.ha(),c=e.i.periods[r+1];r=function(e,t,n,r,i){if(!t.Ac)return Promise.resolve();var o=Xa(t);return n=e.i.periods[n].startTime-t.stream.presentationTimeOffset,B.K(o,"setting timestamp offset to "+n),B.K(o,"setting append window start to "+r),B.K(o,"setting append window end to "+i),r=function(e,t,n,r,i){return"text"==t?(e.g.A=n,(e=e.g).j=r,e.m=i,Promise.resolve()):Promise.all([Zn(e,t,e.Ve.bind(e,t)),Zn(e,t,e.Cg.bind(e,t,n)),Zn(e,t,e.zg.bind(e,t,r,i))])}(e.g.T,t.type,n,r,i),t.stream.initSegmentReference?(B.K(o,"fetching init segment"),e=Ca(e,t,t.stream.initSegmentReference).then(function(e){if(!this.j)return B.K(o,"appending init segment"),Ln(this.g.T,t.type,e,null,null,t.stream.closedCaptions&&0<t.stream.closedCaptions.size)}.bind(e)).catch((function(e){return t.Ac=!0,Promise.reject(e)})),Promise.all([r,e])):r}(e,t,r,Math.max(0,a.startTime-.1),c?c.startTime+.01:u),t.Sa=!0,t.Ac=!1,B.O(o,"fetching segment"),u=Ca(e,t,i),Promise.all([r,u]).then(function(e){if(!this.j&&!this.A)return function(e,t,n,r,i,o,a){var s=Xa(t),u=i.closedCaptions&&0<i.closedCaptions.size;return null!=i.emsgSchemeIdUris&&0<i.emsgSchemeIdUris.length&&(new Vr).ma("emsg",e.P.bind(e,r,o,i.emsgSchemeIdUris)).parse(a),function(e,t,n){var r=Xa(t);B.O(r,"checking buffer length");var i=Math.max(e.l.bufferBehind,e.i.presentationTimeline.g),o=Tn(e.g.T,t.type);if(null==o)return B.O(r,"buffer behind okay because nothing buffered:","presentationTime="+n,"bufferBehind="+i),Promise.resolve();var a=n-o,s=a-i;return.01>=s?(B.O(r,"buffer behind okay:","presentationTime="+n,"bufferedBehind="+a,"bufferBehind="+i,"underflow="+Math.abs(s)),Promise.resolve()):(B.K(r,"buffer behind too large:","presentationTime="+n,"bufferedBehind="+a,"bufferBehind="+i,"overflow="+s),e.g.T.remove(t.type,o,o+s).then(function(){this.j||B.K(r,"evicted "+s+" seconds")}.bind(e)))}(e,t,n).then(function(){if(!this.j)return B.K(s,"appending media segment"),Ln(this.g.T,t.type,a,o.startTime+r.startTime,o.endTime+r.startTime,u)}.bind(e)).then(function(){if(!this.j)return B.O(s,"appended media segment"),t.Hb=i,t.La=o,Promise.resolve()}.bind(e))}(this,t,n,a,s,i,e[1])}.bind(e)).then(function(){this.j||this.A||(t.Sa=!1,t.Ed=!1,t.Wa||this.g.zd(),Ga(this,t,0),function(e,t,n){if(!e.C){var r=Xa(t);if(1==(t=Array.from(e.h.values())).length&&"text"==t[0].type||(e.C=t.every((function(e){return"text"==e.type||!e.Wa&&!e.ab&&e.La}))),e.C){for(B.debug(r,"startup complete"),n=Za(e,n),e.m[n]||_a(e,n).then(function(){this.j||(B.K(r,"calling onCanSwitch()..."),this.g.te())}.bind(e)).catch(le.Bc),n=0;n<e.i.periods.length;++n)_a(e,n).catch(le.Bc);e.g.gg&&(B.K(r,"calling onStartupComplete()..."),e.g.gg())}}}(this,t,s),B.K(o,"finished fetch and append"))}.bind(e)).catch(function(e){this.j||this.A||(t.Sa=!1,"text"==t.type&&this.l.ignoreTextStreamFailures?(1001==e.code?B.v(o,"Text stream failed to download. Proceeding without it."):B.v(o,"Text stream failed to parse. Proceeding without it."),this.h.delete("text")):7001==e.code?(t.Sa=!1,t.Pa=null,Ga(this,t,0)):3017==e.code?function(e,t,n){var r=Xa(t);if(Array.from(e.h.values()).some((function(e){return e!=t&&e.Ed})))B.debug(r,"MediaSource threw QuotaExceededError:","waiting for another stream to recover...");else{var i=Math.round(100*e.u);if(20<i)e.u-=.2;else{if(!(4<i))return B.error(r,"MediaSource threw QuotaExceededError too many times"),t.ac=!0,e.A=!0,void e.g.onError(n);e.u-=.04}B.v(r,"MediaSource threw QuotaExceededError:","reducing buffering goals by "+(100-Math.round(100*e.u))+"%"),t.Ed=!0}Ga(e,t,4)}(this,t,e):(B.error(o,"failed fetch and append: code="+e.code),t.ac=!0,e.severity=2,Va(this,e)))}.bind(e))}(e,t,r,o,n),null)}(e,t);null!=r&&(Ga(e,t,r),t.ac=!1)}catch(kye){return void Va(e,kye)}r=Array.from(e.h.values()),function(e,t){var n=Xa(t),r=Za(e,t.stream);if(t.oa!=r){var i=t.oa,o=Array.from(e.h.values());o.every((function(e){return e.oa==i||La(e)}))?o.every(Ia)?(B.debug(n,"all need Period "+i),_a(e,i).then(function(){if(!this.j)if(o.every(function(e){var t=Ia(e),n=Za(this,e.stream);return!!La(e)||t&&e.oa==i&&n!=i}.bind(this))){var e=this.i.periods[i];B.K(n,"calling onChooseStreams()...");var t=this.g.ue(e),r=new Map;t.variant&&t.variant.video&&r.set("video",t.variant.video),t.variant&&t.variant.audio&&r.set("audio",t.variant.audio),t.text&&r.set("text",t.text);for(var a=(t=h(this.h.keys())).next();!a.done;a=t.next())if(a=a.value,!r.has(a)&&"text"!=a)return B.error(n,"invalid Streams chosen: missing "+a+" Stream"),void this.g.onError(new J(2,5,5005));for(a=(t=h(Array.from(r.keys()))).next();!a.done;a=t.next())if(a=a.value,!this.h.has(a)){if("text"!=a)return B.error(n,"invalid Streams chosen: unusable "+a+" Stream"),void this.g.onError(new J(2,5,5005));ba(this,null,null,r.get("text"),e.startTime),r.delete(a)}for(a=(t=h(Array.from(this.h.keys()))).next();!a.done;a=t.next()){a=a.value;var s=this.h.get(a),u=r.get(a);if(u){var c=La(s);c&&(s.oa=i,s.Hd=e.startTime),va(this,u,!1,0,!1),c&&La(s)||Ga(this,this.h.get(a),0)}else this.h.delete(a)}B.K(n,"calling onCanSwitch()..."),this.g.te()}else B.debug(n,"ignoring transition to Period",i,"since another is happening")}.bind(e)).catch(le.Bc)):B.debug(n,"all MediaStates need Period "+i+", but not all MediaStates are idle"):B.debug(n,"not all MediaStates need Period "+i)}}(e,t),e.C&&r.every((function(e){return e.endOfStream}))&&(B.K(n,"calling endOfStream()..."),e.g.T.endOfStream().then(function(){if(!this.j){var e=this.g.T.ha();0!=e&&e<this.i.presentationTimeline.ha()&&this.i.presentationTimeline.Fa(e)}}.bind(e)))}}}function ka(e,t,n){return t.Hb&&t.La?(n=Za(e,t.Hb),e.i.periods[n].startTime+t.La.endTime):Math.max(n,t.Hd)}function Ta(e,t,n,r,i){var o=Xa(t);return t.La&&t.stream==t.Hb?(r=t.La.position+1,B.O(o,"next position known:","position="+r),Ea(e,t,i,r)):(t.La?(B.K(o,"next position unknown: another Stream buffered"),o=Za(e,t.Hb),o=xa(e,t,e.i.periods[o].startTime+t.La.endTime,i)):(B.K(o,"next position unknown: nothing buffered"),o=xa(e,t,r||n,i)),null==o?null:(n=null,null==r&&(n=Ea(e,t,i,Math.max(0,o-1))),n||Ea(e,t,i,o)))}function xa(e,t,n,r){var i=Xa(t);return e=e.i.periods[r],B.debug(i,"looking up segment:","presentationTime="+n,"currentPeriod.startTime="+e.startTime),n=Math.max(0,n-e.startTime),null==(t=t.stream.findSegmentPosition(n))&&B.v(i,"cannot find segment:","currentPeriod.startTime="+e.startTime,"lookupTime="+n),t}function Ea(e,t,n,r){var i=Xa(t);return n=e.i.periods[n],(t=t.stream.getSegmentReference(r))?(e=(r=e.i.presentationTimeline).$b(),r=r.Db(),n.startTime+t.endTime<e||n.startTime+t.startTime>r?(B.O(i,"segment is not available:","currentPeriod.startTime="+n.startTime,"reference.startTime="+t.startTime,"reference.endTime="+t.endTime,"availabilityStart="+e,"availabilityEnd="+r),null):t):(B.K(i,"segment does not exist:","currentPeriod.startTime="+n.startTime,"position="+r),null)}function La(e){return e&&"text"==e.type&&"application/cea-608"==e.stream.mimeType}function Ia(e){return!e.Sa&&null==e.Pa&&!e.Wa&&!e.ab}function Ra(e,t){var n=No(e.i.periods,t+pe);return n?e.i.periods.indexOf(n):0}function Za(e,t){for(var n=e.i.periods,r=0;r<n.length;r++){for(var i=n[r],o=new Set,a=h(i.variants),s=a.next();!s.done;s=a.next())(s=s.value).audio&&o.add(s.audio),s.video&&o.add(s.video),s.video&&s.video.trickModeVideo&&o.add(s.video.trickModeVideo);for(a=(i=h(i.textStreams)).next();!a.done;a=i.next())o.add(a.value);if(o.has(t))return r}return-1}function Ca(e,t,n){var r=Si(n.i(),n.h,n.g,e.l.retryParameters);return B.O("fetching: reference=",n),e=e.g.Ib.request(1,r),t.lb=e,e.promise.then((function(e){return t.lb=null,e.data}))}function Pa(e,t,n,r){return p((function i(){var o,a,s,u;return M(i,(function(i){switch(i.s){case 1:return o=Xa(t),t.Wa=!1,t.Qc=!1,t.oc=0,t.ab=!0,t.Hb=null,t.La=null,B.debug(o,"clearing buffer"),r?(s=e.g.eb(),u=e.g.T.ha(),a=e.g.T.remove(t.type,s+r,u)):a=Rn(e.g.T,t.type).then(function(){if(!this.j&&n)return this.g.T.flush(t.type)}.bind(e)),k(i,a,2);case 2:if(e.j)return i.return();B.debug(o,"cleared buffer"),t.ab=!1,t.endOfStream=!1,Ga(e,t,0),T(i)}}))}))}function Ga(e,t,n){var r=Xa(t),i=t.type;"text"!=i||e.h.has(i)?(B.O(r,"updating in "+n+" seconds"),t.Pa=new Ee((function(){return p((function n(){var r;return M(n,(function(n){switch(n.s){case 1:return x(n,2),k(n,Sa(e,t),4);case 4:L(n,0);break;case 2:r=I(n),e.g&&e.g.onError(r),T(n)}}))}))})).V(n)):B.K(r,"Text stream is unloaded. No update is needed.")}function Da(e){null!=e.Pa&&(e.Pa.stop(),e.Pa=null)}function Ma(e){return p((function t(){return M(t,(function(t){if(1===t.s){if(e.lb)return k(t,e.lb.abort(),0);t.I(0)}}))}))}function Va(e,t){Re(e.M).then(function(){this.j||(this.g.onError(t),t.handled||this.l.failureCallback(t))}.bind(e))}function Xa(e){return"("+e.type+":"+e.stream.id+")"}function Wa(e,t,n,r,i,o){if(200<=n&&299>=n&&202!=n)return{uri:i||r,Bd:r,data:t,headers:e,fromCache:!!e["x-shaka-from-cache"]};i=null;try{i=ge(t)}catch(a){}throw B.debug("HTTP error text:",i),new J(401==n||403==n?2:1,1,1001,r,n,i,e,o)}function Oa(e,t,n,r){var i=new Oa.h;st(t.headers).forEach((function(e,t){i.append(t,e)}));var o=new Oa.g,a={Zd:!1,Oe:!1};if(e=new Ze(e=Oa.u(e,n,{body:t.body||void 0,headers:i,method:t.method,signal:o.signal,credentials:t.allowCrossSiteCredentials?"include":void 0},a,r),(function(){return a.Zd=!0,o.abort(),Promise.resolve()})),t=t.retryParameters.timeout){var s=new Le((function(){a.Oe=!0,o.abort()}));s.V(t/1e3),e.finally((function(){s.stop()}))}return e}function Na(e,t,n,r){var i=new Na.j,o=Date.now(),a=0;return new Ze(new Promise((function(s,u){for(var c in i.open(t.method,e,!0),i.responseType="arraybuffer",i.timeout=t.retryParameters.timeout,i.withCredentials=t.allowCrossSiteCredentials,i.onabort=function(){u(new J(1,1,7001,e,n))},i.onload=function(t){for(var r=(t=t.target).getAllResponseHeaders().trim().split("\r\n"),i={},o=(r=h(r)).next();!o.done;o=r.next())i[(o=o.value.split(": "))[0].toLowerCase()]=o.slice(1).join(": ");try{var a=Wa(i,t.response,t.status,e,t.responseURL,n);s(a)}catch(c){u(c)}},i.onerror=function(t){u(new J(1,1,1002,e,t,n))},i.ontimeout=function(){u(new J(1,1,1003,e,n))},i.onprogress=function(e){var t=Date.now();(100<t-o||e.lengthComputable&&e.loaded==e.total)&&(r(t-o,e.loaded-a,e.total-e.loaded),a=e.loaded,o=t)},t.headers)i.setRequestHeader(c.toLowerCase(),t.headers[c]);i.send(t.body)})),(function(){return i.abort(),Promise.resolve()}))}function Ua(){this.g=this.j=this.h=0,this.i=new Map,this.l=0}function Fa(e,t,n){this.m=e,this.h=new Map,this.i=!1,this.l=t,this.j=n,this.g=new Ua}function Ya(e,t,n,r,i,o){var a=function(e,t){e.h+=t;var n=e.l;return e.l++,e.i.set(n,t),n}(e.g,r);r=e.h.get(t)||Promise.resolve(),e.h.set(t,r.then((function(){return p((function t(){var r,s,u,c,l,d;return M(t,(function(t){switch(t.s){case 1:return k(t,function(e,t){return p((function n(){var r;return M(n,(function(n){switch(n.s){case 1:return k(n,e.m.request(1,t).promise,2);case 2:return r=n.B,n.return(r.data)}}))}))}(e,n),2);case 2:if(r=t.B,e.i)throw new J(2,9,7001);if(i)for(var h in s=new Uint8Array(r),(u=new Yr(s)).data)c=Number(h),l=u.data[c],d=u.g[c],e.j(l,d);return e.g.close(a,r.byteLength),h=e.g,e.l(0==h.h?0:h.j/h.h,e.g.g),t.return(o(r))}}))}))})))}function Ka(e,t){var n=this;this.i=e,this.h=e.objectStore(t),this.g=new me,e.onabort=function(e){e.preventDefault(),n.g.reject()},e.onerror=function(e){e.preventDefault(),n.g.reject()},e.oncomplete=function(){n.g.resolve()}}function ja(e,t){return new Promise((function(n,r){var i=e.h.openCursor();i.onerror=r,i.onsuccess=function(e){if(!(e=e.target.result))return n();t(e.key,e.value,e),e.continue()}}))}function Ha(e){this.h=e,this.g=[]}function Ba(e,t){return Ja(e,t,"readwrite")}function Ja(e,t,n){var r=new Ka(n=e.h.transaction([t],n),t);return e.g.push(r),r.promise().then((function(){Ue(e.g,r)}),(function(){Ue(e.g,r)})),r}function za(e,t,n){this.h=new Ha(e),this.i=t,this.g=n}function Qa(e){return Promise.reject(new J(2,9,9011,"Cannot add new value to "+e))}function qa(e,t,n,r){t=(e=Ba(e.h,t)).store();for(var i={},o=(n=h(n)).next();!o.done;i={key:i.key},o=n.next())i.key=o.value,t.delete(i.key).onsuccess=function(e){return function(){return r(e.key)}}(i);return e.promise()}function $a(e,t,n){return p((function r(){var i,o,a,s,u,c,l;return M(r,(function(r){switch(r.s){case 1:for(i=Ja(e.h,t,"readonly"),o=i.store(),a={},s=[],u={},c=h(n),l=c.next();!l.done;u={request:u.request,key:u.key},l=c.next())u.key=l.value,u.request=o.get(u.key),u.request.onsuccess=function(e){return function(){null==e.request.result&&s.push(e.key),a[e.key]=e.request.result}}(u);return k(r,i.promise(),2);case 2:if(s.length)throw new J(2,9,9012,"Could not find values for "+s);return r.return(n.map((function(e){return a[e]})))}}))}))}function es(e){this.g=new Ha(e)}function ts(){this.g=new Map}function ns(e,t,n){if(!(e=e.g.get(t)))throw new J(2,9,9013,"Could not find mechanism with name "+t);if(!(t=e.getCells().get(n)))throw new J(2,9,9013,"Could not find cell with name "+n);return t}function rs(e,t){is.set(e,t)}la.prototype.destroy=function(){var e=this;return p((function t(){var n,r;return M(t,(function(t){switch(t.s){case 1:n=[];for(var i=h(e.h.values()),o=i.next();!o.done;o=i.next())Da(r=o.value),n.push(Ma(r));return k(t,Promise.all(n),2);case 2:e.h.clear(),e.o.clear(),e.g=null,e.i=null,e.F=null,e.m=null,e.l=null,e.j=!0,T(t)}}))}))},la.prototype.configure=function(e){this.l=e,this.M=new Ie({maxAttempts:Math.max(e.retryParameters.maxAttempts,2),baseDelay:e.retryParameters.baseDelay,backoffFactor:e.retryParameters.backoffFactor,fuzzFactor:e.retryParameters.fuzzFactor,timeout:0},!0)},la.prototype.start=function(){var e=this;return p((function t(){var n,r,i;return M(t,(function(t){switch(t.s){case 1:return n=e.g.eb(),r=Ra(e,n),(i=e.g.ue(e.i.periods[r])).variant||i.text?k(t,ba(e,i.variant?i.variant.audio:null,i.variant?i.variant.video:null,i.text,n),2):(B.error("init: no Streams chosen"),t.return(new J(2,5,5005)));case 2:if(e.j)return t.return();B.debug("init: completed initial Stream setup"),e.g&&e.g.Yf&&(B.K("init: calling onInitialStreamsSetup()..."),e.g.Yf()),T(t)}}))}))},la.prototype.P=function(e,t,n,r){var i=r.reader.Cd(),o=r.reader.Cd(),a=r.reader.N(),s=r.reader.N(),u=r.reader.N(),c=r.reader.N();r=r.reader.mb(r.reader.S.byteLength-r.reader.ka()),e=e.startTime+t.startTime+s/a,n.includes(i)&&("urn:mpeg:dash:event:2012"==i?this.g.Zf():this.g.onEvent(new Ve("emsg",{detail:{startTime:e,endTime:e+u/a,schemeIdUri:i,value:o,timescale:a,presentationTimeDelta:s,eventDuration:u,id:c,messageData:r}})))},U("shaka.net.HttpFetchPlugin",Oa),Oa.u=function(e,t,n,r,i){return p((function o(){var a,s,u,c,l,d,h,f,m,y,v,g;return M(o,(function(o){switch(o.s){case 1:return a=Oa.l,s=Oa.i,d=l=0,h=Date.now(),x(o,2),k(o,a(e,n),4);case 4:return u=o.B,f=u.clone().body.getReader(),y=(m=u.headers.get("Content-Length"))?parseInt(m,10):0,new s({start:function(e){!function t(){return p((function n(){var r,o,a;return M(n,(function(n){switch(n.s){case 1:return x(n,2),k(n,f.read(),4);case 4:r=n.B,L(n,3);break;case 2:return o=I(n),B.K("error reading from stream",o.message),n.return();case 3:r.done||(l+=r.value.byteLength),(100<(a=Date.now())-h||r.done)&&(i(a-h,l-d,y-l),d=l,h=a),r.done?e.close():(e.enqueue(r.value),t()),T(n)}}))}))}()}}),k(o,u.arrayBuffer(),5);case 5:c=o.B,L(o,3);break;case 2:if(v=I(o),r.Zd)throw new J(1,1,7001,e,t);if(r.Oe)throw new J(1,1,1003,e,t);throw new J(1,1,1002,e,v,t);case 3:return g={},u.headers.forEach((function(e,t){g[t.trim()]=e})),o.return(Wa(g,c,u.status,e,u.url,t))}}))}))},Oa.isSupported=function(){if(!e.ReadableStream)return!1;try{new ReadableStream({})}catch(s){return!1}return!(!e.fetch||!e.AbortController)},Oa.isSupported=Oa.isSupported,Oa.l=e.fetch,Oa.g=e.AbortController,Oa.i=e.ReadableStream,Oa.h=e.Headers,Oa.isSupported()&&(Be("http",Oa,2),Be("https",Oa,2)),U("shaka.net.HttpXHRPlugin",Na),Na.j=e.XMLHttpRequest,Be("http",Na,1),Be("https",Na,1),Ua.prototype.close=function(e,t){if(this.i.has(e)){var n=this.i.get(e);this.i.delete(e),this.j+=n,this.g+=t}},Fa.prototype.destroy=function(){return this.i=!0,Promise.all(this.h.values()).then((function(){}),(function(){}))},Ka.prototype.abort=function(){try{this.i.abort()}catch(s){}return this.g.catch((function(){}))},Ka.prototype.store=function(){return this.h},Ka.prototype.promise=function(){return this.g},Ha.prototype.destroy=function(){return Promise.all(this.g.map((function(e){return e.abort()})))},(r=za.prototype).destroy=function(){return this.h.destroy()},r.hasFixedKeySpace=function(){return!0},r.addSegments=function(){return Qa(this.i)},r.removeSegments=function(e,t){return qa(this,this.i,e,t)},r.getSegments=function(e){var t=this;return p((function n(){var r;return M(n,(function(n){switch(n.s){case 1:return k(n,$a(t,t.i,e),2);case 2:return r=n.B,n.return(r.map((function(e){return t.ae(e)})))}}))}))},r.addManifests=function(){return Qa(this.g)},r.updateManifestExpiration=function(e,t){var n=Ba(this.h,this.g),r=n.store();return r.get(e).onsuccess=function(n){(n=n.target.result)&&(n.expiration=t,r.put(n,e))},n.promise()},r.removeManifests=function(e,t){return qa(this,this.g,e,t)},r.getManifests=function(e){var t=this;return p((function n(){var r;return M(n,(function(n){switch(n.s){case 1:return k(n,$a(t,t.g,e),2);case 2:return r=n.B,n.return(r.map((function(e){return t.pc(e)})))}}))}))},r.getAllManifests=function(){var e=this;return p((function t(){var n,r;return M(t,(function(t){switch(t.s){case 1:return n=Ja(e.h,e.g,"readonly"),r=new Map,k(t,ja(n,(function(t,n){r.set(t,e.pc(n))})),2);case 2:return k(t,n.promise(),3);case 3:return t.return(r)}}))}))},r.ae=function(e){return e},r.pc=function(e){return e},r.add=function(e,t){var n=this;return p((function r(){var i,o,a,s;return M(r,(function(r){switch(r.s){case 1:i=Ba(n.h,e),o=i.store(),a=[];for(var u=h(t),c=u.next();!c.done;c=u.next())s=c.value,o.add(s).onsuccess=function(e){a.push(e.target.result)};return k(r,i.promise(),2);case 2:return r.return(a)}}))}))},es.prototype.destroy=function(){return this.g.destroy()},es.prototype.getAll=function(){var e=this;return p((function t(){var n,r;return M(t,(function(t){switch(t.s){case 1:return n=Ja(e.g,"session-ids","readonly"),r=[],k(t,ja(n,(function(e,t){r.push(t)})),2);case 2:return k(t,n.promise(),3);case 3:return t.return(r)}}))}))},es.prototype.add=function(e){for(var t=Ba(this.g,"session-ids"),n=t.store(),r=(e=h(e)).next();!r.done;r=e.next())n.add(r.value);return t.promise()},es.prototype.remove=function(e){var t=this;return p((function n(){var r;return M(n,(function(n){switch(n.s){case 1:return k(n,ja(r=Ba(t.g,"session-ids"),(function(t,n,r){0<=e.indexOf(n.sessionId)&&r.delete()})),2);case 2:return k(n,r.promise(),0)}}))}))},ts.prototype.destroy=function(){for(var e=[],t=h(this.g.values()),n=t.next();!n.done;n=t.next())e.push(n.value.destroy());return this.g.clear(),Promise.all(e)},ts.prototype.init=function(){var e=this;is.forEach((function(t,n){var r=t();r?e.g.set(n,r):B.info("Skipping "+n+" as it is not supported on this platform")}));for(var t=[],n=h(this.g.values()),r=n.next();!r.done;r=n.next())t.push(r.value.init());return Promise.all(t)},ts.prototype.erase=function(){var e=this;return p((function t(){var n,r;return M(t,(function(t){switch(t.s){case 1:return n=Array.from(e.g.values()),(r=0<n.length)||is.forEach((function(e){(e=e())&&n.push(e)})),k(t,Promise.all(n.map((function(e){return e.erase()}))),2);case 2:if(!r)return k(t,Promise.all(n.map((function(e){return e.destroy()}))),0);t.I(0)}}))}))},U("shaka.offline.StorageMuxer.register",rs),U("shaka.offline.StorageMuxer.unregister",(function(e){is.delete(e)}));var is=new Map;function os(e){za.apply(this,arguments)}function as(e){return function(e){var t=e.streams.filter((function(e){return"audio"==e.contentType})),n=e.streams.filter((function(e){return"video"==e.contentType}));if(!t.every((function(e){return e.variantIds}))||!n.every((function(e){return e.variantIds}))){t.forEach((function(e){e.variantIds=[]})),n.forEach((function(e){e.variantIds=[]}));var r=0;if(n.length&&!t.length){B.debug("Found video-only content. Creating variants for video.");var i=r++;n.forEach((function(e){e.variantIds.push(i)}))}if(!n.length&&t.length){B.debug("Found audio-only content. Creating variants for audio.");var o=r++;t.forEach((function(e){e.variantIds.push(o)}))}n.length&&t.length&&(B.debug("Found audio-video content. Creating variants."),t.forEach((function(e){n.forEach((function(t){var n=r++;e.variantIds.push(n),t.variantIds.push(n)}))})))}}(e),e.streams.forEach((function(){})),{startTime:e.startTime,streams:e.streams.map(ss)}}function ss(e){var t=e.initSegmentUri?cs(e.initSegmentUri):null;return{id:e.id,originalId:null,primary:e.primary,presentationTimeOffset:e.presentationTimeOffset,contentType:e.contentType,mimeType:e.mimeType,codecs:e.codecs,frameRate:e.frameRate,pixelAspectRatio:void 0,kind:e.kind,language:e.language,label:e.label,width:e.width,height:e.height,initSegmentKey:t,encrypted:e.encrypted,keyId:e.keyId,segments:e.segments.map(us),variantIds:e.variantIds}}function us(e){var t=cs(e.uri);return{startTime:e.startTime,endTime:e.endTime,dataKey:t}}function cs(e){var t;if((t=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(e))||(t=/^offline:segment\/([0-9]+)$/.exec(e)))return Number(t[1]);throw new J(2,9,9004,"Could not parse uri "+e)}function ls(e,t,n,r){za.call(this,e,t,n),this.j=r}function ds(){this.l=this.i=this.h=this.g=this.j=null}function hs(e,t,n,r){this.g=e,this.l=t,this.j=n,this.i=r,this.h=["offline:",e,"/",t,"/",n,"/",r].join("")}function fs(e){if(null==(e=/^offline:([a-z]+)\/([^/]+)\/([^/]+)\/([0-9]+)$/.exec(e)))return null;var t=e[1];if("manifest"!=t&&"segment"!=t)return null;var n=e[2];if(!n)return null;var r=e[3];return r&&null!=t?new hs(t,n,r,Number(e[4])):null}function ps(e,t){this.h=e,this.g=t}function ms(e,t,n){var r=t.streams.filter((function(e){return"audio"==e.contentType})),i=t.streams.filter((function(e){return"video"==e.contentType}));return r=function(e,t,n){for(var r=new Set,i=h(t),o=i.next();!o.done;o=i.next()){var a=h(o.value.variantIds);for(o=a.next();!o.done;o=a.next())r.add(o.value)}for(i=h(n),o=i.next();!o.done;o=i.next())for(a=h(o.value.variantIds),o=a.next();!o.done;o=a.next())r.add(o.value);for(i=new Map,r=h(r),o=r.next();!o.done;o=r.next())o=o.value,i.set(o,{id:o,language:"",primary:!1,audio:null,video:null,bandwidth:0,drmInfos:[],allowedByApplication:!0,allowedByKeySystem:!0});for(t=h(t),r=t.next();!r.done;r=t.next())for(r=r.value,o=ys(e,r),a=h(r.variantIds),r=a.next();!r.done;r=a.next())(r=i.get(r.value)).language=o.language,r.primary=r.primary||o.primary,r.audio=o;for(n=h(n),t=n.next();!t.done;t=n.next())for(r=t.value,t=ys(e,r),o=h(r.variantIds),r=o.next();!r.done;r=o.next())(r=i.get(r.value)).primary=r.primary||t.primary,r.video=t;return i}(e,r,i),i=t.streams.filter((function(e){return"text"==e.contentType})).map((function(t){return ys(e,t)})),t.streams.forEach((function(r){r=r.segments.map((function(t,n){return vs(e,n,t)})),n.Jb(r,t.startTime)})),{startTime:t.startTime,variants:Array.from(r.values()),textStreams:i}}function ys(e,t){var n=t.segments.map((function(t,n){return vs(e,n,t)})),r=new oi(n);return n={id:t.id,originalId:t.originalId,createSegmentIndex:function(){return Promise.resolve()},findSegmentPosition:function(e){return r.find(e)},getSegmentReference:function(e){return r.get(e)},initSegmentReference:null,presentationTimeOffset:t.presentationTimeOffset,mimeType:t.mimeType,codecs:t.codecs,width:t.width||void 0,height:t.height||void 0,frameRate:t.frameRate||void 0,pixelAspectRatio:t.pixelAspectRatio||void 0,kind:t.kind,encrypted:t.encrypted,keyId:t.keyId,language:t.language,label:t.label||null,type:t.contentType,primary:t.primary,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,audioSamplingRate:null,closedCaptions:null},null!=t.initSegmentKey&&(n.initSegmentReference=function(e,t){var n=new hs("segment",e.h,e.g,t);return new ni((function(){return[n.toString()]}),0,null)}(e,t.initSegmentKey)),n}function vs(e,t,n){var r=new hs("segment",e.h,e.g,n.dataKey);return new ri(t,n.startTime,n.endTime,(function(){return[r.toString()]}),0,null)}function gs(){this.g=null}function bs(e){var t=fs(e);return t&&"manifest"==t.g?bs.m(e):t&&"segment"==t.g?bs.o(t.key(),t):Ce(new J(2,1,9004,e))}function As(e,t,n){return p((function r(){var i,o,a,s,u,c;return M(r,(function(r){switch(r.s){case 1:i=[];for(var l=[],d=h(n),f=d.next();!f.done;f=d.next()){f=f.value;for(var m=!1,y=h(l),v=y.next();!v.done;v=y.next())if(_s((v=v.value).info,f)){v.sessionIds.push(f.sessionId),m=!0;break}m||l.push({info:f,sessionIds:[f.sessionId]})}o=h(l),a=o.next();case 2:if(a.done){r.I(4);break}return s=a.value,u=function(e,t,n){return p((function r(){var i,o,a,s;return M(r,(function(r){switch(r.s){case 1:return i=new wt({Ib:t,onError:function(){},Dc:function(){},onExpirationUpdated:function(){},onEvent:function(){}}),x(r,2),i.configure(e),k(r,function(e,t,n,r,i,o){var a=new Map;return a.set(t,{audioCapabilities:i,videoCapabilities:o,distinctiveIdentifier:"optional",persistentState:"required",sessionTypes:["persistent-license"],label:t,drmInfos:[{keySystem:t,licenseServerUri:n,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:r,initData:null,keyIds:null}]}),Ct(e,a)}(i,n.info.keySystem,n.info.licenseUri,n.info.serverCertificate,n.info.audioCapabilities,n.info.videoCapabilities),4);case 4:L(r,3);break;case 2:return o=I(r),B.v("Error initializing EME",o),k(r,i.destroy(),5);case 5:case 9:return r.return([]);case 3:return x(r,6),k(r,Tt(i),8);case 8:L(r,7);break;case 6:return a=I(r),B.v("Error setting server certificate",a),k(r,i.destroy(),9);case 7:return s=[],k(r,Promise.all(n.sessionIds.map((function(e){return p((function t(){var n;return M(t,(function(t){switch(t.s){case 1:return x(t,2),k(t,function(e,t){return p((function n(){var r,i,o;return M(n,(function(n){switch(n.s){case 1:return k(n,Pt(e,t),2);case 2:return(r=n.B)?(i=[],(o=e.h.get(r))&&(o.Ga=new me,i.push(o.Ga)),B.O("Attempting to remove session",t),i.push(r.remove()),k(n,Promise.all(i),0)):(B.O("Ignoring attempt to remove missing session",t),n.return())}}))}))}(i,e),4);case 4:s.push(e),L(t,0);break;case 2:n=I(t),B.v("Error deleting offline session",n),T(t)}}))}))}))),10);case 10:return k(r,i.destroy(),11);case 11:return r.return(s)}}))}))}(e,t,s),k(r,u,5);case 5:c=r.B,i=i.concat(c),a=o.next(),r.I(2);break;case 4:return r.return(i)}}))}))}function _s(e,t){function n(e,t){return e.robustness==t.robustness&&e.contentType==t.contentType}return e.keySystem==t.keySystem&&e.licenseUri==t.licenseUri&&Fe(e.audioCapabilities,t.audioCapabilities,n)&&Fe(e.videoCapabilities,t.videoCapabilities,n)}function ws(e,t){var n={Ia:null,D:null,mimeType:null,startTime:null,Rd:null,uri:null},r=this;this.m=t,this.i=e,this.j=n,this.o=null,this.l=[],this.h=this.g=null,this.u=!0,this.A=Promise.resolve().then((function(){return function(e){return p((function t(){return M(t,(function(t){if(1===t.s){if(e.u){if(0==e.l.length||e.g&&!e.g.gb)var n=!1;else{e.g&&(e.g.Da.kb(),e.g=null);var r=(n=e.l.shift()).create(e.j);r?(n.Da.Kb(),e.g={node:r.node,payload:r.payload,gb:r.gb,Da:n.Da}):n.Da.Ec(),n=!0}return n?n=Promise.resolve():e.g?n=function(e){return p((function t(){var n,r;return M(t,(function(t){switch(t.s){case 1:return e.i=e.m.Af(e.i,e.j,e.g.node,e.g.payload),x(t,2),e.h=e.m.ef(e.i,e.j,e.g.payload),k(t,e.h.promise,4);case 4:e.h=null,e.i==e.g.node&&(e.g.Da.Cc(),e.g=null),L(t,0);break;case 2:return 7001==(n=I(t)).code?e.g.Da.kb():e.g.Da.onError(n),e.g=null,e.h=null,r=e,k(t,e.m.handleError(e.j,n),5);case 5:r.i=t.B,T(t)}}))}))}(e):(e.m.Xf(e.i),e.o=new me,n=e.o),k(t,n,1)}t.I(0)}}))}))}(r)}))}function Ss(e,t){var n={Kb:function(){},Cc:function(){},kb:function(){},onError:function(){},Ec:function(){},$g:function(){}};return e.l.push({create:t,Da:n}),e.h&&e.h.abort(),ks(e),n}function ks(e){e.o&&(e.o.resolve(),e.o=null)}function Ts(e){this.g=null;for(var t=0;t<e.textTracks.length;++t){var n=e.textTracks[t];n.mode="disabled","Shaka Player TextTrack"==n.label&&(this.g=n)}this.g||(this.g=e.addTextTrack("subtitles","Shaka Player TextTrack")),this.g.mode="hidden"}function xs(e){if(e.startTime>=e.endTime)return B.v("Invalid cue times: "+e.startTime+" - "+e.endTime),null;var t=new VTTCue(e.startTime,e.endTime,e.payload);t.lineAlign=e.lineAlign,t.positionAlign=e.positionAlign,e.size&&(t.size=e.size);try{t.align=e.textAlign}catch(n){}return"center"==e.textAlign&&"center"!=t.align&&(t.align="middle"),"vertical-lr"==e.writingMode?t.vertical="lr":"vertical-rl"==e.writingMode&&(t.vertical="rl"),1==e.lineInterpretation&&(t.snapToLines=!1),null!=e.line&&(t.line=e.line),null!=e.position&&(t.position=e.position),t}function Es(e,t){var n=e.mode;e.mode="showing"==n?"showing":"hidden";for(var r=e.cues,i=r.length-1;0<=i;i--){var o=r[i];o&&t(o)&&e.removeCue(o)}e.mode=n}function Ls(e,t,n,r,i){var o,a=i in r,s=!0;for(o in t){var u=i+"."+o,c=a?r[i]:n[o];a||o in n?void 0===t[o]?void 0===c||a?delete e[o]:e[o]=Oe(c):c.constructor==Object&&t[o]&&t[o].constructor==Object?(e[o]||(e[o]=Oe(c)),u=Ls(e[o],t[o],c,r,u),s=s&&u):typeof t[o]!=typeof c||null==t[o]||"function"!=typeof t[o]&&t[o].constructor!=c.constructor?(B.kc("Invalid config, wrong type for "+u),s=!1):("function"==typeof n[o]&&n[o].length!=t[o].length&&B.ba("Unexpected number of arguments for "+u),e[o]=t[o]):(B.kc("Invalid config, unrecognized key "+u),s=!1)}return s}function Is(e,t){for(var n={},r=n,i=0,o=0;!(0>(i=e.indexOf(".",i)));)0!=i&&"\\"==e[i-1]||(r[o=e.substring(o,i).replace(/\\\./g,".")]={},r=r[o],o=i+1),i+=1;return r[e.substring(o).replace(/\\\./g,".")]=t,n}function Rs(){}function Zs(){var e=5e5,t=1/0;navigator.connection&&(navigator.connection.downlink&&(e=1e6*navigator.connection.downlink),navigator.connection.saveData&&(t=360));var n={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0},servers:{},clearKeys:{},advanced:{},delayLicenseRequestUntilPlayed:!1,initDataTransform:Gt,fairPlayTransform:!0,updateExpirationTime:1},r={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0},availabilityWindowOverride:NaN,disableAudio:!1,disableVideo:!1,disableText:!1,dash:{customScheme:function(e){if(e)return null},clockSyncUri:"",ignoreDrmInfo:!1,xlinkFailGracefully:!1,defaultPresentationDelay:10,ignoreMinBufferTime:!1,autoCorrectDrift:!0,ignoreSuggestedPresentationDelay:!1,ignoreEmptyAdaptationSet:!1},hls:{ignoreTextStreamFailures:!1,useFullSegmentsForStartTime:!1}},i={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0},failureCallback:function(e){return B.error("Unhandled streaming error",e),[e]},rebufferingGoal:2,bufferingGoal:10,bufferBehind:30,ignoreTextStreamFailures:!1,alwaysStreamText:!1,startAtSegmentBoundary:!1,smallGapLimit:.5,jumpLargeGaps:!1,durationBackoff:1,forceTransmuxTS:!1,safeSeekOffset:5,stallEnabled:!0,stallThreshold:1,stallSkip:.1,useNativeHlsOnSafari:!0};(gt("Web0S")||mt()||gt("CrKey"))&&(i.stallSkip=0);var o={trackSelectionCallback:function(e){return p((function t(){return M(t,(function(t){if(1===t.s)return t.return(e)}))}))},progressCallback:function(e,t){return[e,t]},usePersistentLicense:!0},a={drm:n,manifest:r,streaming:i,offline:o,abrFactory:Nn,abr:{enabled:!0,defaultBandwidthEstimate:e,switchInterval:8,bandwidthUpgradeTarget:.85,bandwidthDowngradeTarget:.95,restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:t,minPixels:0,maxPixels:1/0,minFrameRate:0,maxFrameRate:1/0,minBandwidth:0,maxBandwidth:1/0}},preferredAudioLanguage:"",preferredTextLanguage:"",preferredVariantRole:"",preferredTextRole:"",preferredAudioChannelCount:2,restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minFrameRate:0,maxFrameRate:1/0,minBandwidth:0,maxBandwidth:1/0},playRangeStart:0,playRangeEnd:1/0,textDisplayFactory:function(){return null}};return o.trackSelectionCallback=function(e){return p((function t(){return M(t,(function(t){if(1===t.s)return t.return(function(e,t){var n=e.filter((function(e){return"variant"==e.type})),r=[],i=Xn(t,n.map((function(e){return e.language})));i&&(r=n.filter((function(e){return Mn(e.language)==i}))),0==r.length&&(r=n.filter((function(e){return e.primary}))),0==r.length&&(1<new Set(n.map((function(e){return e.language}))).size&&B.v("Could not choose a good audio track based on language preferences or primary tracks. An arbitrary language will be stored!"),r=n);var o=r.filter((function(e){return e.height&&480>=e.height}));if(o.length&&(o.sort((function(e,t){return t.height-e.height})),r=o.filter((function(e){return e.height==o[0].height}))),n=[],r.length){var a=Math.floor(r.length/2);r.sort((function(e,t){return e.bandwidth-t.bandwidth})),n.push(r[a])}for(r=h(e),a=r.next();!a.done;a=r.next())"text"==(a=a.value).type&&n.push(a);return n}(e,a.preferredAudioLanguage))}))}))},a}function Cs(e,t,n){var r={".drm.servers":"",".drm.clearKeys":"",".drm.advanced":{distinctiveIdentifierRequired:!1,persistentStateRequired:!1,videoRobustness:"",audioRobustness:"",serverCertificate:new Uint8Array(0),individualizationServer:""}};return Ls(e,t,n||Zs(),r,"")}function Ps(){this.g=null,this.h=[]}function Gs(e,t){if(null==e.g)e.g={timestamp:Date.now()/1e3,state:t,duration:0};else{var n=Date.now()/1e3;e.g.duration=n-e.g.timestamp,e.g.state!=t&&(e.h.push(e.g),e.g={timestamp:n,state:t,duration:0})}}function Ds(e,t){var n=0;e.g&&e.g.state==t&&(n+=e.g.duration);for(var r=h(e.h),i=r.next();!i.done;i=r.next())n+=(i=i.value).state==t?i.duration:0;return n}function Ms(){this.h=this.i=null,this.g=[]}function Vs(){this.j=this.C=this.m=this.h=this.o=this.u=this.A=this.l=this.F=NaN,this.g=new Ps,this.i=new Ms}function Xs(t,n){var r=this;We.call(this),this.o=Eu,this.g=null,this.ub=!1,this.l=new et,this.Uc=this.u=this.Tb=this.i=this.C=this.j=this.rc=this.L=this.ic=this.J=this.wb=this.A=this.M=this.m=this.X=null,this.re=1e9,this.lc=new Set,this.yb=!0,this.wa=null,this.qe=!1,this.oe=0,this.va=null,this.Z=new bo,this.h=zs(this),this.mc={width:1/0,height:1/0},this.F=null,this.tb=new Lo(this.h.preferredAudioLanguage,this.h.preferredVariantRole,this.h.preferredAudioChannelCount),this.ua=this.h.preferredTextLanguage,this.Xa=this.h.preferredTextRole,this.Wc=[],n&&n(this),this.X=function(e){return new je((function(t,n){e.u&&e.u.segmentDownloaded(t,n)}))}(this),this.l.H(e,"online",(function(){r.Id()})),this.P={name:"detach"},this.da={name:"attach"},this.Qa={name:"unload"},this.nd={name:"manifest-parser"},this.md={name:"manifest"},this.vb={name:"media-source"},this.ad={name:"drm-engine"},this.ea={name:"load"},this.od={name:"src-equals-drm-engine"},this.xb={name:"src-equals"};var i=new Map;i.set(this.da,(function(e,t){return De(function(e,t,n){return null==t.D&&(t.D=n.D,e.l.H(t.D,"error",(function(){var t=fu(e);t&&e.Va(t)}))),e.g=t.D,Promise.resolve()}(r,e,t))})),i.set(this.P,(function(e){return e.D&&(r.l.ta(e.D,"error"),e.D=null),r.g=null,De(e=Promise.resolve())})),i.set(this.Qa,(function(e){return De(Us(r,e))})),i.set(this.vb,(function(t){return t=function(t,n){return p((function r(){var i,o,a,s;return M(r,(function(r){switch(r.s){case 1:return i=e.muxjs?new Kt:new jt,o=t.h.textDisplayFactory,a=new o,t.fd=o,k(r,(s=new An(n.D,i,a)).C,2);case 2:t.M=s,T(r)}}))}))}(r,t),De(t)})),i.set(this.nd,(function(e,t){var n=function(e,t,n){return p((function r(){var i,o,a,s;return M(r,(function(r){switch(r.s){case 1:if(t.Ia=n.Ia,t.mimeType=n.mimeType,t.uri=n.uri,i=t.uri,o=e.X,e.Tb=i,t.Ia){e.C=t.Ia(),r.I(2);break}return a=e,k(r,_i.create(i,o,e.h.manifest.retryParameters,t.mimeType),3);case 3:a.C=r.B;case 2:s=Oe(e.h.manifest),n.D&&"AUDIO"===n.D.nodeName&&(s.disableVideo=!0),e.C.configure(s),T(r)}}))}))}(r,e,t);return De(n)})),i.set(this.md,(function(e){return function(e,t){var n=t.uri,r=e.X;e.rc=new oa((function(){return e.He()})),function(e,t){e.h=t}(e.rc,(function(t){hu(e,"timelineregionadded",t)}));var i={networkingEngine:r,filterNewPeriod:function(t){return e.Xc(t)},filterAllPeriods:function(t){return Qs(e,t)},onTimelineRegionAdded:function(t){var n=e.rc;e:{for(var r=h(n.g),i=r.next();!i.done;i=r.next())if((i=i.value).schemeIdUri==t.schemeIdUri&&i.id==t.id&&i.startTime==t.startTime&&i.endTime==t.endTime){r=i;break e}r=null}null==r&&(n.g.add(t),n.h(t))},onEvent:function(t){return e.dispatchEvent(t)},onError:function(t){return e.Va(t)}};return new Ze(Promise.resolve().then((function(){return p((function t(){var r;return M(t,(function(t){switch(t.s){case 1:return r=e,k(t,e.C.start(n,i),2);case 2:if(r.i=t.B,e.dispatchEvent(new Ve("manifestparsed")),0==e.i.periods.length)throw new J(2,4,4014);!function(e){function t(e){return e.video&&e.audio||e.video&&e.video.codecs.includes(",")}e.some((function(e){return e.variants.some(t)}))&&(B.debug("Found variant with audio and video content, so filtering out audio-only content in all periods."),e.forEach((function(e){e.variants=e.variants.filter(t)})))}(e.i.periods),T(t)}}))}))})),(function(){return B.info("Aborting parser step..."),e.C.stop()}))}(r,e)})),i.set(this.ad,(function(e){return e=function(e,t){return p((function n(){return M(n,(function(n){switch(n.s){case 1:return e.m=Fs(e,{Ib:e.X,onError:function(t){e.Va(t)},Dc:function(t){pu(e,t)},onExpirationUpdated:function(t,n){mu(e,t,n)},onEvent:function(t){e.dispatchEvent(t)}}),e.m.configure(e.h.drm),k(n,St(e.m,Oo(e.i.periods),e.i.offlineSessionIds),2);case 2:return k(n,e.m.Ub(t.D),3);case 3:Qs(e,e.i.periods),T(n)}}))}))}(r,e),De(e)})),i.set(this.ea,(function(e,t){return De(function(e,t,n){return p((function r(){var i,o,a,s,u,c,l,d,f,p;return M(r,(function(r){switch(r.s){case 1:return t.startTime=n.startTime,i=t.D,o=t.uri,e.Tb=o,e.J=new Fo({wc:function(){return t.D.playbackRate},vc:function(){return t.D.defaultPlaybackRate},Od:function(e){t.D.playbackRate=e},pe:function(e){t.D.currentTime+=e}}),e.F=new Vs,a=function(){return nu(e)},s=function(){return tu(e)},e.l.H(i,"playing",a),e.l.H(i,"pause",a),e.l.H(i,"ended",a),e.l.H(i,"ratechange",s),u=e.h.abrFactory,e.u&&e.Uc==u||(e.Uc=u,e.u=new u,e.u.configure(e.h.abr)),function(e,t){for(var n=0;n<t.length;n++){for(var r=t[n],i=new Map,o=h(r.variants),a=o.next();!a.done;a=o.next())if((a=a.value).video&&a.video.closedCaptions)for(var s=h((a=a.video).closedCaptions.keys()),u=s.next();!u.done;u=s.next())if(u=u.value,!i.has(u)){var c={id:e.re++,originalId:u,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,presentationTimeOffset:0,mimeType:"application/cea-608",codecs:"",kind:"caption",encrypted:!1,keyId:null,language:a.closedCaptions.get(u),label:null,type:"text",primary:!1,frameRate:void 0,pixelAspectRatio:void 0,trickModeVideo:null,emsgSchemeIdUris:null,roles:a.roles,channelsCount:null,audioSamplingRate:null,closedCaptions:null};i.set(u,c)}for(o=(i=h(i.values())).next();!o.done;o=i.next())r.textStreams.push(o.value)}}(e,e.i.periods),e.tb=new Lo(e.h.preferredAudioLanguage,e.h.preferredVariantRole,e.h.preferredAudioChannelCount),e.ua=e.h.preferredTextLanguage,e.Xa=e.h.preferredTextRole,function(e,t,n){0<t&&(e.aa()?B.v("|playRangeStart| has been configured for live content. Ignoring the setting."):e.Le(t)),n<e.ha()&&(e.aa()?B.v("|playRangeEnd| has been configured for live content. Ignoring the setting."):e.Fa(n))}(e.i.presentationTimeline,e.h.playRangeStart,e.h.playRangeEnd),e.u.init((function(t,n,r){n=void 0!==n&&n,r=void 0===r?0:r,B.debug("switch_");e:{for(var i=h(e.i.periods),o=i.next();!o.done;o=i.next())if((o=o.value).variants.includes(t)){i=o;break e}i=null}Bs(e,i,t,!0),e.j&&ya(e.j,t,n,r)&&au(e)})),e.A=function(e,t){return new ta(e.g,e.i,e.h.streaming,t,(function(){e.wb&&Wo(e.wb,!0),e.j&&function(e){function t(t){var i=e.g.T;return t="text"==t?null!=(t=i.g).g&&null!=t.h&&n>=t.g&&n<t.h:Bt(t=En(i,t),n,r)}var n=e.g.eb(),r=e.l.smallGapLimit,i=!1,o=Ra(e,n);if(at(e.h.values(),(function(e){return e.oa==o})))for(var a=h(e.h.keys()),s=a.next();!s.done;s=a.next())t(s=s.value)||(ga(e,e.h.get(s)),i=!0);else at(e.h.keys(),t)||(B.debug("(all): seeked: unbuffered seek: clearing all buffers"),e.h.forEach((function(t){ga(e,t)})),i=!0);i||B.debug("(all): seeked: buffered seek: presentationTime="+n)}(e.j),e.L&&Ks(e)}),(function(t){return e.dispatchEvent(t)}))}(e,t.startTime),e.wb=function(e){var t=new Uo(e.i);!function(e,t){e.h=t}(t,(function(){su(e)}));var n=new aa(e.rc);!function(e,t,n,r){e.g=t,e.h=n,e.i=r}(n,(function(t){hu(e,"timelineregionenter",t)}),(function(t){hu(e,"timelineregionexit",t)}),(function(t,n){n||(hu(e,"timelineregionenter",t),hu(e,"timelineregionexit",t))}));var r=new Xo(e.g);return r.g.add(t),r.g.add(n),r}(e),c=Math.max(e.i.minBufferTime,e.h.streaming.rebufferingGoal),Ys(e,c),e.j=function(e){return new la(e.i,{eb:function(){return e.A.l()},getBandwidthEstimate:function(){return e.u.getBandwidthEstimate()},T:e.M,Ib:e.X,ue:e.Vf.bind(e),te:e.Ze.bind(e),onError:e.Va.bind(e),onEvent:function(t){return e.dispatchEvent(t)},Zf:e.$f.bind(e),zd:e.eg.bind(e)})}(e),e.j.configure(e.h.streaming),On.$d(e.i,e.h.preferredAudioChannelCount),e.o=Lu,e.dispatchEvent(new Ve("streaming")),k(r,e.j.start(),2);case 2:e.h.streaming.startAtSegmentBoundary&&(l=e.A.l(),d=function(e,t){function n(e,t){if(!e)return null;var n=e.findSegmentPosition(t-o.startTime);return null==n?null:(n=e.getSegmentReference(n))?n.startTime+o.startTime:null}var r=da(e.j),i=ha(e.j),o=_u(e);return r=n(r,t),null!=(i=n(i,t))&&null!=r?Math.max(i,r):null!=i?i:null!=r?r:t}(e,l),e.A.A(d)),e.i.periods.forEach(e.Xc.bind(e)),su(e),au(e),f=_u(e)||e.i.periods[0],p=f.variants.some((function(e){return e.primary})),e.h.preferredAudioLanguage||p||B.v("No preferred audio language set. We will choose an arbitrary language initially"),ru(e,f.variants),e.l.ya(i,"loadedmetadata",(function(){e.F.h=Date.now()/1e3-n.Rd})),T(r)}}))}))}(r,e,t))})),i.set(this.od,(function(e,t){var n=function(e,t,n){return p((function r(){var i,o;return M(r,(function(r){switch(r.s){case 1:return i=fe,e.m=Fs(e,{Ib:e.X,onError:function(t){e.Va(t)},Dc:function(t){pu(e,t)},onExpirationUpdated:function(t,n){mu(e,t,n)},onEvent:function(t){e.dispatchEvent(t)}}),e.m.configure(e.h.drm),o={id:0,language:"und",primary:!1,audio:null,video:{id:0,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,presentationTimeOffset:0,mimeType:n.mimeType?n.mimeType.split(";")[0]:"video/mp4",codecs:n.mimeType?lt(n.mimeType):"",encrypted:!0,keyId:null,language:"und",label:null,type:i.Za,primary:!1,frameRate:void 0,pixelAspectRatio:void 0,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,audioSamplingRate:null,closedCaptions:null},bandwidth:100,drmInfos:[],allowedByApplication:!0,allowedByKeySystem:!0},k(r,St(e.m,[o],[]),2);case 2:return k(r,e.m.Ub(t.D),0)}}))}))}(r,e,t);return De(n)})),i.set(this.xb,(function(e,t){return function(e,t,n){function r(){return nu(e)}if(t.uri=n.uri,t.startTime=n.startTime,e.Tb=t.uri,e.F=new Vs,e.A=new ea(t.D),null!=t.startTime&&e.A.A(t.startTime),e.J=new Fo({wc:function(){return t.D.playbackRate},vc:function(){return t.D.defaultPlaybackRate},Od:function(e){t.D.playbackRate=e},pe:function(e){t.D.currentTime+=e}}),Ys(e,e.h.streaming.rebufferingGoal),e.l.H(t.D,"playing",r),e.l.H(t.D,"pause",r),e.l.H(t.D,"ended",r),e.l.H(t.D,"ratechange",(function(){return tu(e)})),"none"!=e.g.preload&&e.l.ya(t.D,"loadedmetadata",(function(){e.F.h=Date.now()/1e3-n.Rd})),e.g.audioTracks&&(e.l.H(e.g.audioTracks,"addtrack",(function(){return su(e)})),e.l.H(e.g.audioTracks,"removetrack",(function(){return su(e)})),e.l.H(e.g.audioTracks,"change",(function(){return su(e)}))),e.g.textTracks){var i=e.g.textTracks;e.l.H(i,"addtrack",(function(){return su(e)})),e.l.H(i,"removetrack",(function(){return su(e)})),e.l.H(i,"change",(function(){return su(e)}))}t.D.src=t.uri,(mt()||gt("Web0S"))&&t.D.load(),e.o=Iu,e.dispatchEvent(new Ve("streaming"));var o=new me;Ko(e.g,HTMLMediaElement.HAVE_METADATA,e.l,(function(){o.resolve()}));var a=!1;return e.Wc.push((function(){a=!0})),Ko(e.g,HTMLMediaElement.HAVE_CURRENT_DATA,e.l,(function(){return p((function t(){return M(t,(function(t){switch(t.s){case 1:if(a)return t.return();if(function(e){var t=e.h.preferredAudioLanguage;if(""!=t){e.Jd(t);var n=e.h.preferredVariantRole;""!=n&&e.Jd(t,n)}}(e),Hs(e).find((function(e){return"disabled"!=e.mode}))){t.I(2);break}return k(t,new Promise((function(t){e.l.ya(e.g.textTracks,"change",t),new Le(t).V(1)})),2);case 2:if(a)return t.return();!function(e){var t=e.h.preferredTextLanguage;if(""!=t){e.Kd(t);var n=e.h.preferredTextRole;""!=n&&e.Kd(t,n)}}(e),T(t)}}))}))})),e.g.error?o.reject(fu(e)):"none"==e.g.preload&&(B.ba('With <video preload="none">, the browser will not load anything until play() is called. We are unable to measure load latency in a meaningful way, and we cannot provide track info yet. Please do not use preload="none" with Shaka Player.'),o.resolve()),e.l.ya(e.g,"error",(function(){o.reject(fu(e))})),new Ze(o,(function(){return o.reject(new J(2,7,7001)),Promise.resolve()}))}(r,e,t)})),this.Ya=new ws(this.P,{Af:function(e,t,n,i){var o=null;return e==r.P&&(o=n==r.P?r.P:r.da),e==r.da&&(o=n==r.P||t.D!=i.D?r.P:n==r.da?r.da:n==r.vb||n==r.ea?r.vb:n==r.xb?r.od:null),e==r.vb&&(o=n==r.ea&&t.D==i.D?r.nd:r.Qa),e==r.nd&&(o=ku(r.ea,r.md,r.Qa,n,t,i)),e==r.md&&(o=ku(r.ea,r.ad,r.Qa,n,t,i)),e==r.ad&&(o=ku(r.ea,r.ea,r.Qa,n,t,i)),e==r.od&&(o=n==r.xb&&t.D==i.D?r.xb:r.Qa),e!=r.ea&&e!=r.xb||(o=r.Qa),e==r.Qa&&(o=i.D&&t.D==i.D?r.da:r.P),o},ef:function(e,t,n){return r.dispatchEvent(new Ve("onstatechange",{state:e.name})),i.get(e)(t,n)},handleError:function(e,t){return p((function n(){return M(n,(function(n){switch(n.s){case 1:return B.v("The walker saw an error:"),t instanceof J?B.v("Error Code:",t.code):(B.v("Error Message:",t.message),B.v("Error Stack:",t.stack)),k(n,Us(r,e),2);case 2:return n.return(e.D?r.da:r.P)}}))}))},Xf:function(e){r.dispatchEvent(new Ve("onstateidle",{state:e.name}))}}),t&&this.Ub(t,!0)}A(os,za),os.prototype.updateManifestExpiration=function(e,t){var n=Ba(this.h,this.g),r=n.store(),i=new me;return r.get(e).onsuccess=function(n){(n=n.target.result)?(n.expiration=t,r.put(n),i.resolve()):i.reject(new J(2,9,9012,"Could not find values for "+e))},n.promise().then((function(){return i}))},os.prototype.pc=function(e){return{originalManifestUri:e.originalManifestUri,duration:e.duration,size:e.size,expiration:null==e.expiration?1/0:e.expiration,periods:e.periods.map(as),sessionIds:e.sessionIds,drmInfo:e.drmInfo,appMetadata:e.appMetadata}},os.prototype.ae=function(e){return{data:e.data}},A(ls,za),ls.prototype.hasFixedKeySpace=function(){return this.j},ls.prototype.addSegments=function(e){return this.j?Qa(this.i):this.add(this.i,e)},ls.prototype.addManifests=function(e){return this.j?Qa(this.g):this.add(this.g,e)},ls.prototype.pc=function(e){return null==e.expiration&&(e.expiration=1/0),e},(r=ds.prototype).init=function(){var t=this,n=new me,r=e.indexedDB.open("shaka_offline_db",4);return r.onsuccess=function(e){e=e.target.result,t.j=e;var r=e.objectStoreNames;r.contains("manifest")&&r.contains("segment")?(B.debug("Mounting v1 idb storage cell"),r=new os(e,"segment","manifest")):r=null,t.g=r,(r=e.objectStoreNames).contains("manifest-v2")&&r.contains("segment-v2")?(B.debug("Mounting v2 idb storage cell"),r=new ls(e,"segment-v2","manifest-v2",!0)):r=null,t.h=r,(r=e.objectStoreNames).contains("manifest-v3")&&r.contains("segment-v3")?(B.debug("Mounting v3 idb storage cell"),r=new ls(e,"segment-v3","manifest-v3",!1)):r=null,t.i=r,e.objectStoreNames.contains("session-ids")?(B.debug("Mounting session ID idb storage cell"),e=new es(e)):e=null,t.l=e,n.resolve()},r.onupgradeneeded=function(e){e=e.target.result;for(var t=h(["segment-v3","manifest-v3","session-ids"]),n=t.next();!n.done;n=t.next())n=n.value,e.objectStoreNames.contains(n)||e.createObjectStore(n,{autoIncrement:!0})},r.onerror=function(e){n.reject(new J(2,9,9001,r.error)),e.preventDefault()},n},r.destroy=function(){var e=this;return p((function t(){return M(t,(function(t){switch(t.s){case 1:if(!e.g){t.I(2);break}return k(t,e.g.destroy(),2);case 2:if(!e.h){t.I(4);break}return k(t,e.h.destroy(),4);case 4:if(!e.i){t.I(6);break}return k(t,e.i.destroy(),6);case 6:if(!e.l){t.I(8);break}return k(t,e.l.destroy(),8);case 8:e.j&&e.j.close(),T(t)}}))}))},r.getCells=function(){var e=new Map;return this.g&&e.set("v1",this.g),this.h&&e.set("v2",this.h),this.i&&e.set("v3",this.i),e},r.getEmeSessionCell=function(){return this.l},r.erase=function(){var t=this;return p((function n(){return M(n,(function(n){switch(n.s){case 1:if(!t.g){n.I(2);break}return k(n,t.g.destroy(),2);case 2:if(!t.h){n.I(4);break}return k(n,t.h.destroy(),4);case 4:if(!t.i){n.I(6);break}return k(n,t.i.destroy(),6);case 6:return t.j&&t.j.close(),k(n,function(){var t=new me,n=e.indexedDB.deleteDatabase("shaka_offline_db");return n.onblocked=function(){B.v("Deleting","shaka_offline_db","is being blocked")},n.onsuccess=function(){t.resolve()},n.onerror=function(e){t.reject(new J(2,9,9001,n.error)),e.preventDefault()},t}(),8);case 8:return t.j=null,t.g=null,t.h=null,t.i=null,k(n,t.init(),0)}}))}))},rs("idb",(function(){return gt("CrKey")||!e.indexedDB?null:new ds})),hs.prototype.Ea=function(){return this.l},hs.prototype.ja=function(){return this.j},hs.prototype.key=function(){return this.i},hs.prototype.toString=function(){return this.h},(r=gs.prototype).configure=function(){},r.start=function(e){var t=this;return p((function n(){var r,i,o,a,s;return M(n,(function(n){switch(n.s){case 1:return r=fs(e),t.g=r,null==r||"manifest"!=r.g?n.return(Promise.reject(new J(2,1,9004,r))):(i=new ts,E(n,2),k(n,i.init(),4));case 4:return k(n,ns(i,r.Ea(),r.ja()),5);case 5:return k(n,n.B.getManifests([r.key()]),6);case 6:return o=n.B,a=o[0],s=new ps(r.Ea(),r.ja()),n.return(function(e,t){var n=new wi(null,0);n.Fa(t.duration);var r=t.periods.map((function(t){return ms(e,t,n)})),i=t.drmInfo?[t.drmInfo]:[];return t.drmInfo&&r.forEach((function(e){e.variants.forEach((function(e){e.drmInfos=i}))})),{presentationTimeline:n,minBufferTime:2,offlineSessionIds:t.sessionIds,periods:r}}(s,a));case 2:return R(n),k(n,i.destroy(),7);case 7:Z(n,0)}}))}))},r.stop=function(){return Promise.resolve()},r.update=function(){},r.onExpirationUpdated=function(e,t){var n=this;return p((function r(){var i,o,a,s,u,c,l,d;return M(r,(function(r){switch(r.s){case 1:return i=n.g,o=new ts,x(r,2,3),k(r,o.init(),5);case 5:return k(r,ns(o,i.Ea(),i.ja()),6);case 6:return k(r,(a=r.B).getManifests([i.key()]),7);case 7:if(s=r.B,u=s[0],c=u.sessionIds.includes(e),l=null==u.expiration||u.expiration>t,!c||!l){r.I(3);break}return B.debug("Updating expiration for stored content"),k(r,a.updateManifestExpiration(i.key(),t),3);case 3:return R(r),k(r,o.destroy(),10);case 10:Z(r,0);break;case 2:d=I(r),B.error("There was an error updating",i,d),r.I(3)}}))}))},_i.Qb("application/x-offline-manifest",gs),U("shaka.offline.OfflineScheme",bs),bs.m=function(e){return Ge(e={uri:e,Bd:e,data:new ArrayBuffer(0),headers:{"content-type":"application/x-offline-manifest"}})},bs.o=function(e,t){var n=new ts;return Ge(void 0).ca((function(){return n.init()})).ca((function(){return ns(n,t.Ea(),t.ja())})).ca((function(e){return e.getSegments([t.key()])})).ca((function(e){return{uri:t,Bd:t,data:e[0].data,headers:{}}})).finally((function(){return n.destroy()}))},Be("offline",bs),ws.prototype.destroy=function(){var e=this;return p((function t(){return M(t,(function(t){switch(t.s){case 1:return e.u=!1,e.h&&e.h.abort(),ks(e),k(t,e.A,2);case 2:e.g&&e.g.Da.kb();for(var n=h(e.l),r=n.next();!r.done;r=n.next())r.value.Da.kb();e.g=null,e.l=[],e.m=null,T(t)}}))}))},U("shaka.text.SimpleTextDisplayer",Ts),Ts.prototype.remove=function(e,t){return!!this.g&&(Es(this.g,(function(n){return n.startTime<t&&n.endTime>e})),!0)},Ts.prototype.remove=Ts.prototype.remove,Ts.prototype.append=function(e){var t=xs,n=e.map((function(e){if(e.nestedCues.length){var t=e.nestedCues.map((function(e){return e.spacer?"\n":e.payload+" "})).join("").replace(/ $/m,"");(e=e.clone()).nestedCues=[],e.payload=t}return e})),r=[];e=this.g.cues?Array.from(this.g.cues):[];for(var i={},o=(n=h(n)).next();!o.done;i={Fb:i.Fb},o=n.next())i.Fb=o.value,e.some(function(e){return function(t){return t.startTime==e.Fb.startTime&&t.endTime==e.Fb.endTime&&t.text==e.Fb.payload}}(i))||(o=t(i.Fb))&&r.push(o);r.slice().sort((function(e,t){return e.startTime!=t.startTime?e.startTime-t.startTime:e.endTime!=t.endTime?e.endTime-t.startTime:"line"in VTTCue.prototype?r.indexOf(t)-r.indexOf(e):r.indexOf(e)-r.indexOf(t)})).forEach(function(e){this.g.addCue(e)}.bind(this))},Ts.prototype.append=Ts.prototype.append,Ts.prototype.destroy=function(){return this.g&&Es(this.g,(function(){return!0})),this.g=null,Promise.resolve()},Ts.prototype.destroy=Ts.prototype.destroy,Ts.prototype.isTextVisible=function(){return"showing"==this.g.mode},Ts.prototype.isTextVisible=Ts.prototype.isTextVisible,Ts.prototype.setTextVisibility=function(e){this.g.mode=e?"showing":"hidden"},Ts.prototype.setTextVisibility=Ts.prototype.setTextVisibility,U("shaka.util.ConfigUtils.mergeConfigObjects",Ls),U("shaka.util.ConfigUtils.convertToConfigObject",Is),U("shaka.util.PlayerConfiguration",Rs),Rs.mergeConfigObjects=Cs,F(Xs,We),U("shaka.Player",Xs),Xs.prototype.destroy=function(){var e=this;return p((function t(){var n;return M(t,(function(t){switch(t.s){case 1:return e.o==xu?t.return():(e.o=xu,n=Ss(e.Ya,(function(){return{node:e.P,payload:{Ia:null,D:null,mimeType:null,startTime:null,Rd:null,uri:null},gb:!1}})),k(t,new Promise((function(t){n.Kb=function(){B.info("Preparing to destroy walker...")},n.Cc=function(){t(),e.dispatchEvent(new Ve("loaded"))},n.kb=function(){t()},n.onError=function(){t()},n.Ec=function(){t()}})),2));case 2:return k(t,e.Ya.destroy(),3);case 3:if(e.l&&(e.l.release(),e.l=null),e.Uc=null,e.u=null,e.h=null,!e.X){t.I(0);break}return k(t,e.X.destroy(),5);case 5:e.X=null,T(t)}}))}))},Xs.prototype.destroy=Xs.prototype.destroy,Xs.version="v2.5.23";var Ws=["2","5"];Hn=new function(e){this.g=e,this.i=Kn,this.h=jn}(new Fn(Number(Ws[0]),Number(Ws[1])));var Os=["output-restricted","internal-error"],Ns={};function Us(e,t){return p((function n(){var r;return M(n,(function(n){switch(n.s){case 1:return e.o!=xu&&(e.o=Eu),r=e.Wc.map((function(e){return e()})),e.Wc=[],k(n,Promise.all(r),2);case 2:if(e.dispatchEvent(new Ve("unloading")),t.Ia=null,t.mimeType=null,t.startTime=null,t.uri=null,t.D&&(e.l.ta(t.D,"loadedmetadata"),e.l.ta(t.D,"playing"),e.l.ta(t.D,"pause"),e.l.ta(t.D,"ended"),e.l.ta(t.D,"ratechange")),e.wb&&(e.wb.release(),e.wb=null),e.ic&&(e.ic.stop(),e.ic=null),!e.C){n.I(3);break}return k(n,e.C.stop(),4);case 4:e.C=null;case 3:if(!e.u){n.I(5);break}return k(n,e.u.stop(),5);case 5:if(!e.j){n.I(7);break}return k(n,e.j.destroy(),8);case 8:e.j=null;case 7:if(e.J&&(e.J.release(),e.J=null),e.A&&(e.A.release(),e.A=null),!e.M){n.I(9);break}return k(n,e.M.destroy(),10);case 10:e.M=null;case 9:if(!t.D||!t.D.src){n.I(11);break}return k(n,new Promise((function(e){return new Le(e).V(.1)})),12);case 12:t.D.removeAttribute("src"),t.D.load();case 11:if(!e.m){n.I(13);break}return k(n,e.m.destroy(),14);case 14:e.m=null;case 13:e.Z.g.clear(),e.Tb=null,e.L=null,e.lc.clear(),e.i=null,e.F=null,e.fd=null,e.yb=!0,eu(e),T(n)}}))}))}function Fs(e,t){return new wt(t,e.h.drm.updateExpirationTime)}function Ys(e,t){e.L=new Io,e.L.g=Zo,Ro(e.L,t,Math.min(.5,t/2)),eu(e),e.ic=new Le((function(){Ks(e)})).Oa(.25)}function Ks(e){switch(e.o){case Iu:var t=!!e.g.ended||Ht(e.g.buffered)>=e.g.duration-1;break;case Lu:e:if(e.g.ended||kn(e.M))t=!0;else{if(e.i.presentationTimeline.aa()){var n=e.i.presentationTimeline.Db();if(Ht(e.g.buffered)>=n){t=!0;break e}}t=!1}break;default:t=!1}var r=Jt(e.g.buffered,e.g.currentTime),i=t,o=(n=e.L).h.get(n.g);t=n.g,r=i||r>=o?Co:Zo,n.g=r,t!=r&&eu(e)}function js(e){if(e.C){var t=Oe(e.h.manifest);e.g&&"AUDIO"===e.g.nodeName&&(t.disableVideo=!0),e.C.configure(t)}if(e.m&&e.m.configure(e.h.drm),e.j){e.j.configure(e.h.streaming);try{e.i.periods.forEach(e.Xc.bind(e))}catch(o){e.Va(o)}var n=da(e.j),r=ha(e.j);t=_u(e),n=On.ie(n,r,t.variants),e.u&&n&&n.allowedByApplication&&n.allowedByKeySystem?ru(e,t.variants):(B.debug("Choosing new streams after changing configuration"),iu(e,t))}if(e.M&&(t=e.h.textDisplayFactory,e.fd!=t)){n=new t;var i=(r=e.M).l;r.l=n,i&&(n.setTextVisibility(i.isTextVisible()),i.destroy()),r.g&&(r.g.i=n),e.fd=t,e.j&&(n=(t=e.j).h.get("text"))&&va(t,n.stream,!0,0,!0)}e.u&&(e.u.configure(e.h.abr),e.h.abr.enabled&&!e.yb?e.u.enable():e.u.disable(),du(e)),e.L&&(t=e.h.streaming.rebufferingGoal,e.i&&(t=Math.max(t,e.i.minBufferTime)),Ro(e.L,t,Math.min(.5,t/2)))}function Hs(e){return Array.from(e.g.textTracks).filter((function(e){return"metadata"!=e.kind&&"chapters"!=e.kind&&"Shaka Player TextTrack"!=e.label}))}function Bs(e,t,n,r){_o(e.Z,t).variant=n,(e=e.F.i).i!=n&&(e.i=n,e.g.push({timestamp:Date.now()/1e3,id:n.id,type:"variant",fromAdaptation:r,bandwidth:n.bandwidth}))}function Js(e,t,n,r){Ao(e.Z,t,n),(e=e.F.i).h!=n&&(e.h=n,e.g.push({timestamp:Date.now()/1e3,id:n.id,type:"text",fromAdaptation:r,bandwidth:null}))}function zs(e){var t=Zs();return t.streaming.failureCallback=function(t){e.aa()&&[1001,1002,1003].includes(t.code)&&(t.severity=1,B.v("Live streaming error. Retrying automatically..."),e.Id())},t.textDisplayFactory=function(){return new Ts(e.g)},t}function Qs(e,t){var n=e.j?da(e.j):null,r=e.j?ha(e.j):null;if(t.forEach(On.filterNewPeriod.bind(null,e.m,n,r)),n=function(e,t){var n=0;return e.forEach((function(e){n+=t(e)?1:0})),n}(t,(function(e){return e.variants.some(On.Gb)})),0==n)throw new J(2,4,4032);if(n<t.length)throw new J(2,4,4011);t.forEach(function(e){On.Xd(e.variants,this.h.restrictions,this.mc)&&this.j&&_u(this)==e&&su(this),yu(this,e.variants)}.bind(e))}function qs(e,t,n,r){return n=void 0!==n&&n,r=void 0===r?0:r,e.yb?(e.wa=t,e.qe=n,e.oe=r,!0):((t=ya(e.j,t,n,r))&&uu(e),t)}function $s(e,t){if(e.yb)return e.va=t,!0;var n=va(e.j,t,!0,0,!1);return n&&cu(e),n}function eu(e){var t=e.jd();if(e.F&&e.L&&e.A){var n=e.J;n.j=t,Yo(n),nu(e)}e.dispatchEvent(new Ve("buffering",{buffering:t}))}function tu(e){var t=e.g.playbackRate;0!=t&&e.J.set(t)}function nu(e){if(e.F&&e.L){var t=e.F.g;e.L.g==Zo?Gs(t,"buffering"):e.g.paused?Gs(t,"paused"):e.g.ended?Gs(t,"ended"):Gs(t,"playing")}}function ru(e,t){try{yu(e,t)}catch(r){return e.Va(r),null}var n=t.filter((function(e){return On.Gb(e)}));return n=e.tb.create(n),e.u.setVariants(Array.from(n.values())),e.u.chooseVariant()}function iu(e,t){var n=ou(e,t,!1),r=On.Wb(t.textStreams,e.ua,e.Xa)[0]||null,i=!1;r&&(e.h.streaming.alwaysStreamText||e.zc())&&(Js(e,t,r,!0),i=$s(e,r)),(n||i)&&au(e)}function ou(e,t,n){n=void 0===n||n;var r=ru(e,t.variants),i=!1;return r&&(Bs(e,t,r,!0),i=qs(e,r,!0)),n&&i&&au(e),i}function au(e){vu(e,new Ve("adaptation"))}function su(e){vu(e,new Ve("trackschanged"))}function uu(e){vu(e,new Ve("variantchanged"))}function cu(e){vu(e,new Ve("textchanged"))}function lu(e){vu(e,new Ve("texttrackvisibility"))}function du(e){vu(e,new Ve("abrstatuschanged",{Zg:e.h.abr.enabled}))}function hu(e,t,n){e.dispatchEvent(new Ve(t,{detail:{schemeIdUri:n.schemeIdUri,value:n.value,startTime:n.startTime,endTime:n.endTime,id:n.id,eventElement:n.eventElement}}))}function fu(e){if(!e.g.error)return null;var t=e.g.error.code;if(1==t)return null;var n=e.g.error.msExtendedCode;return n&&(0>n&&(n+=Math.pow(2,32)),n=n.toString(16)),new J(2,3,3016,t,n,e.g.error.message)}function pu(e,t){if(e.j){var n=_u(e),r=!1,i=Object.keys(t);0==i.length&&B.v("Got a key status event without any key statuses, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks.");var o=1==i.length&&"00"==i[0];o&&B.v("Got a synthetic key status event, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks."),i.length&&e.i.periods.forEach((function(e){e.variants.forEach((function(e){On.Kf(e).forEach((function(n){var i=e.allowedByKeySystem;n.keyId&&(n=t[o?"00":n.keyId],e.allowedByKeySystem=!!n&&!Os.includes(n)),i!=e.allowedByKeySystem&&(r=!0)}))}))})),i=da(e.j);var a=ha(e.j);(i=On.ie(i,a,n.variants))&&!i.allowedByKeySystem&&(B.debug("Choosing new variants after key status changed"),ou(e,n)),r&&(su(e),ru(e,n.variants))}}function mu(e,t,n){e.C&&e.C.onExpirationUpdated&&e.C.onExpirationUpdated(t,n),e.dispatchEvent(new Ve("expirationupdated"))}function yu(e,t){var n=e.m?ut(e.m.da):{},r=Object.keys(n);r=r.length&&"00"==r[0];for(var i=!1,o=!1,a=[],s=[],u=h(t),c=u.next();!c.done;c=u.next()){var l=[];(c=c.value).audio&&l.push(c.audio),c.video&&l.push(c.video);for(var d=(l=h(l)).next();!d.done;d=l.next())if((d=d.value).keyId){var f=n[r?"00":d.keyId];f?Os.includes(f)&&(s.includes(f)||s.push(f)):a.includes(d.keyId)||a.push(d.keyId)}c.allowedByApplication?c.allowedByKeySystem&&(i=!0):o=!0}if(!i)throw new J(2,4,4012,{hasAppRestrictions:o,missingKeys:a,restrictedKeyStatuses:s})}function vu(e,t){p((function n(){return M(n,(function(n){switch(n.s){case 1:return k(n,Promise.resolve(),2);case 2:e.o!=xu&&e.dispatchEvent(t),T(n)}}))}))}function gu(e){for(var t=new Set,n=(e=h(e)).next();!n.done;n=e.next())(n=n.value).language?t.add(Mn(n.language)):t.add("und");return t}function bu(e){for(var t=new Map,n=(e=h(e)).next();!n.done;n=e.next()){var r=n.value;n="und";var i=[];for(r.language&&(n=Mn(r.language)),(i="variant"==r.type?r.audioRoles:r.roles)&&i.length||(i=[""]),t.has(n)||t.set(n,new Set),i=(r=h(i)).next();!i.done;i=r.next())i=i.value,t.get(n).add(i)}var o=[];return t.forEach((function(e,t){for(var n=h(e),r=n.next();!r.done;r=n.next())o.push({language:t,role:r.value})})),o}function Au(e){return null==(e=_u(e))?[]:e.variants.filter((function(e){return On.Gb(e)}))}function _u(e){for(var t=e.A.l(),n=null,r=(e=h(e.i.periods)).next();!r.done;r=e.next())(r=r.value).startTime<=t&&(n=r);return n}function wu(e){var t=_u(e);return _o(e.Z,t).variant}function Su(){return new J(2,7,7e3)}function ku(e,t,n,r,i,o){return r==e&&i.D==o.D&&i.uri==o.uri&&i.mimeType==o.mimeType&&i.Ia==o.Ia?t:n}function Tu(e){return new Promise((function(t,n){e.kb=function(){return n(Su())},e.Cc=function(){return t()},e.onError=function(e){return n(e)},e.Ec=function(){return n(Su())}}))}Xs.registerSupportPlugin=function(e,t){Ns[e]=t},Xs.isBrowserSupported=function(){if(!(e.Promise&&e.Uint8Array&&Array.prototype.forEach))return!1;var t=vt();return!(t&&12>t||!(e.MediaKeys&&e.navigator&&e.navigator.requestMediaKeySystemAccess&&e.MediaKeySystemAccess&&e.MediaKeySystemAccess.prototype.getConfiguration))&&(!!ft()||pt("application/x-mpegurl"))},Xs.probeSupport=function(){return Mt().then((function(e){for(var t=_i.ng(),n={},r=h('video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hev1.1.6.L93.90",video/mp4; codecs="hvc1.1.6.L93.90",video/mp4; codecs="hev1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="hvc1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="vp9",video/mp4; codecs="vp09.00.10.08",video/mp4; codecs="av01.0.01M.08",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",audio/mp4; codecs="opus",audio/mp4; codecs="flac",video/webm; codecs="vp8",video/webm; codecs="vp9",video/webm; codecs="vp09.00.10.08",audio/webm; codecs="vorbis",audio/webm; codecs="opus",video/mp2t; codecs="avc1.42E01E",video/mp2t; codecs="avc3.42E01E",video/mp2t; codecs="hvc1.1.6.L93.90",video/mp2t; codecs="mp4a.40.2",video/mp2t; codecs="ac-3",video/mp2t; codecs="ec-3",text/vtt,application/mp4; codecs="wvtt",application/ttml+xml,application/mp4; codecs="stpp"'.split(",")),i=r.next();!i.done;i=r.next()){n[i=i.value]=ft()?!!vn(i)||MediaSource.isTypeSupported(i)||Te(i):pt(i);var o=i.split(";")[0];n[o]=n[o]||n[i]}for(var a in e={manifest:t,media:n,drm:e},Ns)e[a]=Ns[a]();return e}))},Xs.prototype.Ub=function(e,t){if(t=void 0===t||t,this.o==xu)return Promise.reject(Su());var n={Ia:null,D:null,mimeType:null,startTime:null,Rd:null,uri:null};n.D=e,ft()||(t=!1);var r=t?this.vb:this.da,i=Ss(this.Ya,(function(){return{node:r,payload:n,gb:!1}}));return i.Kb=function(){return B.info("Starting attach...")},Tu(i)},Xs.prototype.attach=Xs.prototype.Ub,Xs.prototype.detach=function(){var e=this;if(this.o==xu)return Promise.reject(Su());var t=Ss(this.Ya,(function(){return{node:e.P,payload:{Ia:null,D:null,mimeType:null,startTime:null,Rd:null,uri:null},gb:!1}}));return t.Kb=function(){return B.info("Starting detach...")},Tu(t)},Xs.prototype.detach=Xs.prototype.detach,Xs.prototype.Ud=function(e){var t=this;if(e=void 0===e||e,this.o==xu)return Promise.reject(Su());ft()||(e=!1);var n={Ia:null,D:null,mimeType:null,startTime:null,Rd:null,uri:null},r=Ss(this.Ya,(function(r){var i=r.D&&e?t.vb:r.D?t.da:t.P;return n.D=r.D,{node:i,payload:n,gb:!1}}));return r.Kb=function(){return B.info("Starting unload...")},Tu(r)},Xs.prototype.unload=Xs.prototype.Ud,Xs.prototype.load=function(e,t,n){if(this.o==xu)return Promise.reject(Su());this.dispatchEvent(new Ve("loading"));var r={Ia:null,D:null,mimeType:null,startTime:null,Rd:null,uri:null};r.uri=e,r.Rd=Date.now()/1e3,n&&"string"!=typeof n&&(Yn("Loading with a manifest parser factory","Please register a manifest parser and for the mime-type."),r.Ia=function(){return new n}),n&&"string"==typeof n&&(r.mimeType=n),void 0!==t&&(r.startTime=t);var i=function(e,t){if(t.Ia)return!1;if(!ft())return!0;var n=t.mimeType,r=t.uri||"";return n||(n={mp4:"video/mp4",m4v:"video/mp4",m4a:"audio/mp4",webm:"video/webm",weba:"audio/webm",mkv:"video/webm",ts:"video/mp2t",ogv:"video/ogg",ogg:"audio/ogg",mpg:"video/mpeg",mpeg:"video/mpeg",m3u8:"application/x-mpegurl",mp3:"audio/mpeg",aac:"audio/aac",flac:"audio/flac",wav:"audio/wav"}[_i.getExtension(r)]),!!n&&""!=(t.D||bt()).canPlayType(n)&&(!_i.isSupported(r,n)||yt()&&e.h.streaming.useNativeHlsOnSafari)}(this,r)?this.xb:this.ea,o=Ss(this.Ya,(function(e){return null==e.D?null:(r.D=e.D,{node:i,payload:r,gb:!0})}));return o.Kb=function(){return B.info("Starting load of "+e+"...")},new Promise((function(e,t){o.Ec=function(){return t(new J(2,7,7002))},o.Cc=function(){return e()},o.kb=function(){return t(Su())},o.onError=function(e){return t(e)}}))},Xs.prototype.load=Xs.prototype.load,Xs.prototype.configure=function(e,t){2==arguments.length&&"string"==typeof e&&(e=Is(e,t));var n=Cs(this.h,e,zs(this));return js(this),n},Xs.prototype.configure=Xs.prototype.configure,Xs.prototype.getConfiguration=function(){var e=zs(this);return Cs(e,this.h,zs(this)),e},Xs.prototype.getConfiguration=Xs.prototype.getConfiguration,Xs.prototype.vg=function(){for(var e in this.h)delete this.h[e];Cs(this.h,zs(this),zs(this)),js(this)},Xs.prototype.resetConfiguration=Xs.prototype.vg,Xs.prototype.tf=function(){return this.o},Xs.prototype.getLoadMode=Xs.prototype.tf,Xs.prototype.yf=function(){return this.g},Xs.prototype.getMediaElement=Xs.prototype.yf,Xs.prototype.Yb=function(){return this.X},Xs.prototype.getNetworkingEngine=Xs.prototype.Yb,Xs.prototype.tc=function(){return this.Tb},Xs.prototype.getAssetUri=Xs.prototype.tc,Xs.prototype.wf=function(){return Yn("getManifestUri",'Please use "getAssetUri" instead.'),this.tc()},Xs.prototype.getManifestUri=Xs.prototype.wf,Xs.prototype.aa=function(){return this.i?this.i.presentationTimeline.aa():!(!this.g||!this.g.src)&&1/0==this.g.duration},Xs.prototype.isLive=Xs.prototype.aa,Xs.prototype.ib=function(){return!!this.i&&this.i.presentationTimeline.ib()},Xs.prototype.isInProgress=Xs.prototype.ib,Xs.prototype.Qf=function(){if(this.i){if(!this.i.periods.length)return!1;var e=this.i.periods[0].variants;return!!e.length&&!e[0].video}return!(!this.g||!this.g.src)&&(this.g.videoTracks?0==this.g.videoTracks.length:0==this.g.videoHeight)},Xs.prototype.isAudioOnly=Xs.prototype.Qf,Xs.prototype.He=function(){if(this.i){var e=this.i.presentationTimeline;return{start:e.Cb(),end:e.Ka()}}return this.g&&this.g.src&&(e=this.g.seekable).length?{start:e.start(0),end:e.end(e.length-1)}:{start:0,end:0}},Xs.prototype.seekRange=Xs.prototype.He,Xs.prototype.keySystem=function(){return Lt(this.drmInfo())},Xs.prototype.keySystem=Xs.prototype.keySystem,Xs.prototype.drmInfo=function(){return this.m?this.m.g:null},Xs.prototype.drmInfo=Xs.prototype.drmInfo,Xs.prototype.Xb=function(){return this.m?this.m.Xb():1/0},Xs.prototype.getExpiration=Xs.prototype.Xb,Xs.prototype.jd=function(){return!!this.L&&this.L.g==Zo},Xs.prototype.isBuffering=Xs.prototype.jd,Xs.prototype.Cf=function(){if(this.J){var e=this.J;e=e.j?0:e.i}else e=0;return e},Xs.prototype.getPlaybackRate=Xs.prototype.Cf,Xs.prototype.Mg=function(e){0==e?B.ba("A trick play rate of 0 is unsupported!"):(this.g.paused&&this.g.play(),this.J&&this.J.set(e),this.o==Lu&&ma(this.j,1<Math.abs(e)))},Xs.prototype.trickPlay=Xs.prototype.Mg,Xs.prototype.$e=function(){var e=this.J.vc();this.o==Iu&&this.J.set(e),this.o==Lu&&(this.J.set(e),ma(this.j,!1))},Xs.prototype.cancelTrickPlay=Xs.prototype.$e,Xs.prototype.ed=function(){if(this.i&&this.A){for(var e=wu(this),t=[],n=h(Au(this)),r=n.next();!r.done;r=n.next()){r=r.value;var i=On.Oc(r);i.active=r==e,t.push(i)}return t}return this.g&&this.g.audioTracks?Array.from(this.g.audioTracks).map((function(e){return On.je(e)})):[]},Xs.prototype.getVariantTracks=Xs.prototype.ed,Xs.prototype.Eb=function(){if(this.i&&this.A){for(var e=function(e){var t=_u(e);if(null==t)return null;if(!_o(e.Z,t).text){var n=On.Wb(t.textStreams,e.ua,e.Xa);n.length&&Ao(e.Z,t,n[0])}return _o(e.Z,t).text}(this),t=[],n=h(function(e){var t=_u(e);return null==t?[]:t.textStreams.filter((function(t){return!e.lc.has(t)}))}(this)),r=n.next();!r.done;r=n.next()){r=r.value;var i=On.Kc(r);i.active=r==e,t.push(i)}return t}return this.g&&this.g.src&&this.g.textTracks?Hs(this).map((function(e){return On.Of(e)})):[]},Xs.prototype.getTextTracks=Xs.prototype.Eb,Xs.prototype.Ld=function(e){if(this.i&&this.j){var t=_u(this),n=t.textStreams.find((function(t){return t.id==e.id}));n?(Js(this,t,n,!1),$s(this,n),this.ua=n.language):B.error("No stream with id",e.id)}else if(this.g&&this.g.src&&this.g.textTracks){for(n=(t=h(t=Hs(this))).next();!n.done;n=t.next())n=n.value,On.gd(n)==e.id?n.mode=this.ub?"showing":"hidden":n.mode="disabled";cu(this)}},Xs.prototype.selectTextTrack=Xs.prototype.Ld,Xs.prototype.xg=function(){Yn("selectEmbeddedTextTrack","If closed captions are signaled in the manifest, a text stream will be created to represent them. Please use SelectTextTrack.");var e=this.Eb().filter((function(e){return"application/cea-608"==e.mimeType}));0<e.length?this.Ld(e[0]):B.v("Unable to find the text track embedded in the video.")},Xs.prototype.selectEmbeddedTextTrack=Xs.prototype.xg,Xs.prototype.Rg=function(){Yn("usingEmbeddedTextTrack","If closed captions are signaled in the manifest, a text stream will be created to represent them. There should be no reason to know if the player is playing embedded text.");var e=this.Eb().filter((function(e){return e.active}))[0];return!!e&&"application/cea-608"==e.mimeType},Xs.prototype.usingEmbeddedTextTrack=Xs.prototype.Rg,Xs.prototype.Ie=function(e,t,n){if(n=void 0===n?0:n,this.i&&this.j){var r=_u(this);this.h.abr.enabled&&B.ba("Changing tracks while abr manager is enabled will likely result in the selected track being overriden. Consider disabling abr before calling selectVariantTrack().");var i=r.variants.find((function(t){return t.id==e.id}));i?On.Gb(i)?(Bs(this,r,i,!1),qs(this,i,t,n),this.tb=new Eo(i),ru(this,r.variants)):B.error("Unable to switch to restricted track",e.id):B.error("No variant with id",e.id)}else if(this.g&&this.g.audioTracks){for(n=(t=h(t=Array.from(this.g.audioTracks))).next();!n.done;n=t.next())n=n.value,On.gd(n)==e.id&&(n.enabled=!0);uu(this)}},Xs.prototype.selectVariantTrack=Xs.prototype.Ie,Xs.prototype.nf=function(){return bu(this.ed())},Xs.prototype.getAudioLanguagesAndRoles=Xs.prototype.nf,Xs.prototype.Jf=function(){return bu(this.Eb())},Xs.prototype.getTextLanguagesAndRoles=Xs.prototype.Jf,Xs.prototype.mf=function(){return Array.from(gu(this.ed()))},Xs.prototype.getAudioLanguages=Xs.prototype.mf,Xs.prototype.If=function(){return Array.from(gu(this.Eb()))},Xs.prototype.getTextLanguages=Xs.prototype.If,Xs.prototype.Jd=function(e,t){if(this.i&&this.A){var n=_u(this);if(this.tb=new Lo(e,t||"",0,""),!this.h.abr.enabled){var r=function(e,t){return e.video||t.video?e.video&&t.video?Math.abs((e.video.height||0)-(t.video.height||0))+Math.abs((e.video.width||0)-(t.video.width||0)):1/0:0},i=_u(this)||this.i.periods[0],o=_o(this.Z,i).variant,a=this.tb.create(i.variants);i=null;for(var s=(a=h(a.values())).next();!s.done;s=a.next())s=s.value,(!i||r(i,o)>r(s,o))&&(i=s);if(i)return n=On.Oc(i),void this.Ie(n,!0)}ou(this,n)}else if(this.g&&this.g.audioTracks){for(i=Array.from(this.g.audioTracks),n=Mn(e),o=r=null,a=(i=h(i)).next();!a.done;a=i.next())a=a.value,Mn((s=On.je(a)).language)==n&&(r=a,t?s.roles.includes(t)&&(o=a):0==s.roles.length&&(o=a));o?(o.enabled=!0,uu(this)):r&&(r.enabled=!0,uu(this))}},Xs.prototype.selectAudioLanguage=Xs.prototype.Jd,Xs.prototype.Kd=function(e,t){if(this.i&&this.A){var n=_u(this);this.ua=e,this.Xa=t||"";var r=On.Wb(n.textStreams,this.ua,this.Xa)[0]||null;r&&(Js(this,n,r,!1),(this.h.streaming.alwaysStreamText||this.zc())&&$s(this,r))}else{var i=Mn(e);(n=this.Eb().filter((function(e){return Mn(e.language)==i&&(!t||e.roles.includes(t))}))[0])&&this.Ld(n)}},Xs.prototype.selectTextLanguage=Xs.prototype.Kd,Xs.prototype.yg=function(e){if(this.i&&this.A){for(var t=_u(this),n=null,r=h(Au(this)),i=r.next();!i.done;i=r.next())if((i=i.value).audio.label==e){n=i;break}null==n?B.v("No variants were found with label: "+e+". Ignoring the request to switch."):(this.tb=new Lo(n.language,"",0,e),ou(this,t))}},Xs.prototype.selectVariantsByLabel=Xs.prototype.yg,Xs.prototype.zc=function(){var e=this.ub;return this.M?this.M.l.isTextVisible():this.g&&this.g.src&&this.g.textTracks?Hs(this).some((function(e){return"showing"==e.mode})):e},Xs.prototype.isTextTrackVisible=Xs.prototype.zc,Xs.prototype.Bg=function(e){var t=this;return p((function n(){var r,i,o,a;return M(n,(function(n){switch(n.s){case 1:if(t.ub==(r=!!e))return n.return();if(t.ub=r,t.o!=Lu){if(t.g&&t.g.src&&t.g.textTracks)for(var s=h(Hs(t)),u=s.next();!u.done;u=s.next())"disabled"!=(i=u.value).mode&&(i.mode=r?"showing":"hidden");n.I(2);break}if(t.M.l.setTextVisibility(r),t.h.streaming.alwaysStreamText){n.I(2);break}if(!r){!function(e){e.L=!0;var t=e.h.get("text");t&&(Da(t),Ma(t).catch((function(){})),e.h.delete("text"))}(t.j),n.I(2);break}if(fa(t.j,"text")){n.I(2);break}if(o=_u(t),!(0<(a=On.Wb(o.textStreams,t.ua,t.Xa)).length)){n.I(2);break}return k(n,pa(t.j,a[0]),2);case 2:lu(t),T(n)}}))}))},Xs.prototype.setTextTrackVisibility=Xs.prototype.Bg,Xs.prototype.Ef=function(){if(!this.aa())return B.v("getPlayheadTimeAsDate is for live streams!"),null;var e=this.Ya.j,t=0;if(this.A)t=this.A.l();else if(e){if(null==e.startTime)return new Date;t=e.startTime}return this.i?new Date(1e3*(this.i.presentationTimeline.j+this.g.currentTime)):this.g&&this.g.getStartDate?(e=this.g.getStartDate(),isNaN(e.getTime())?(B.v("EXT-X-PROGRAM-DATETIME required to get playhead time as Date!"),null):new Date(e.getTime()+1e3*t)):(B.v("No way to get playhead time as Date!"),null)},Xs.prototype.getPlayheadTimeAsDate=Xs.prototype.Ef,Xs.prototype.Gf=function(){if(!this.aa())return B.v("getPresentationStartTimeAsDate is for live streams!"),null;if(this.i)return new Date(1e3*this.i.presentationTimeline.j);if(this.g&&this.g.getStartDate){var e=this.g.getStartDate();return isNaN(e.getTime())?(B.v("EXT-X-PROGRAM-DATETIME required to get presentation start time as Date!"),null):e}return B.v("No way to get presentation start time as Date!"),null},Xs.prototype.getPresentationStartTimeAsDate=Xs.prototype.Gf,Xs.prototype.bd=function(){var e={total:[],audio:[],video:[],text:[]};return this.o==Iu&&(e.total=zt(this.g.buffered)),this.o==Lu&&this.M.bd(e),e},Xs.prototype.getBufferedInfo=Xs.prototype.bd,Xs.prototype.getStats=function(){if(this.o!=Lu&&this.o!=Iu)return{width:NaN,height:NaN,streamBandwidth:NaN,decodedFrames:NaN,droppedFrames:NaN,corruptedFrames:NaN,estimatedBandwidth:NaN,loadLatency:NaN,playTime:NaN,pauseTime:NaN,bufferingTime:NaN,licenseTime:NaN,switchHistory:[],stateHistory:[]};nu(this);var e=this.g;if(e.getVideoPlaybackQuality){e=e.getVideoPlaybackQuality();var t=this.F,n=Number(e.totalVideoFrames);t.A=Number(e.droppedVideoFrames),t.u=n,this.F.o=Number(e.corruptedVideoFrames)}e=this.m&&(e=this.m).P?e.P:NaN,this.F.m=e,this.o==Lu&&((e=wu(this))&&(this.F.C=e.bandwidth),e&&e.video&&(t=this.F,n=e.video.height||NaN,t.F=e.video.width||NaN,t.l=n),e=this.u.getBandwidthEstimate(),this.F.j=e);var r=this.F;e=r.F,t=r.l,n=r.C;for(var i=r.u,o=r.A,a=r.o,s=r.j,u=r.h,c=Ds(r.g,"playing"),l=Ds(r.g,"paused"),d=Ds(r.g,"buffering"),f=r.m,p=function(e){function t(e){return{timestamp:e.timestamp,state:e.state,duration:e.duration}}for(var n=[],r=h(e.h),i=r.next();!i.done;i=r.next())n.push(t(i.value));return e.g&&n.push(t(e.g)),n}(r.g),m=[],y=(r=h(r.i.g)).next();!y.done;y=r.next())y=y.value,m.push({timestamp:y.timestamp,id:y.id,type:y.type,fromAdaptation:y.fromAdaptation,bandwidth:y.bandwidth});return{width:e,height:t,streamBandwidth:n,decodedFrames:i,droppedFrames:o,corruptedFrames:a,estimatedBandwidth:s,loadLatency:u,playTime:c,pauseTime:l,bufferingTime:d,licenseTime:f,stateHistory:p,switchHistory:m}},Xs.prototype.getStats=Xs.prototype.getStats,Xs.prototype.addTextTrack=function(e,t,n,r,i,o){var a=this;return p((function s(){var u,c,l,d,h,f,p,m,y;return M(s,(function(s){switch(s.s){case 1:if(a.o==Iu)throw B.error("Cannot add text when loaded with src="),Error("State error!");if(a.o!=Lu)throw B.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");if(u=_u(a),c=fe,l=a.i.periods.indexOf(u),h=(d=l+1)>=a.i.periods.length?a.i.presentationTimeline.ha():a.i.periods[d].startTime,1/0==(f=h-u.startTime))throw new J(1,4,4033);return p=new ri(1,0,f,(function(){return[e]}),0,null),m={id:a.re++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return 1},getSegmentReference:function(e){return 1==e?p:null},initSegmentReference:null,presentationTimeOffset:0,mimeType:r,codecs:i||"",kind:n,encrypted:!1,keyId:null,language:t,label:o||null,type:c.za,primary:!1,frameRate:void 0,pixelAspectRatio:void 0,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,audioSamplingRate:null,closedCaptions:null},a.lc.add(m),u.textStreams.push(m),k(s,pa(a.j,m),2);case 2:return(y=fa(a.j,"text"))&&Ao(a.Z,u,y),a.lc.delete(m),B.debug("Choosing new streams after adding a text stream"),iu(a,u),su(a),s.return(On.Kc(m))}}))}))},Xs.prototype.addTextTrack=Xs.prototype.addTextTrack,Xs.prototype.Nd=function(e,t){this.mc.width=e,this.mc.height=t},Xs.prototype.setMaxHardwareResolution=Xs.prototype.Nd,Xs.prototype.Id=function(){if(this.o==Lu){var e=this.j;if(e.j)B.error("Unable to retry after StreamingEngine is destroyed!"),e=!1;else if(e.A)B.error("Unable to retry after StreamingEngine encountered a fatal error!"),e=!1;else{for(var t=h(e.h.values()),n=t.next();!n.done;n=t.next()){var r=Xa(n=n.value);n.ac&&(B.info(r,"Retrying after failure..."),n.ac=!1,Ga(e,n,.1))}e=!0}}else e=!1;return e},Xs.prototype.retryStreaming=Xs.prototype.Id,Xs.prototype.uf=function(){return this.i},Xs.prototype.getManifest=Xs.prototype.uf,Xs.prototype.vf=function(){return this.C?this.C.constructor:null},Xs.prototype.getManifestParserFactory=Xs.prototype.vf,(r=Xs.prototype).Xc=function(e){var t=this.j?da(this.j):null,n=this.j?ha(this.j):null;if(On.filterNewPeriod(this.m,t,n,e),!(t=e.variants).some(On.Gb))throw new J(2,4,4011);if(yu(this,e.variants),On.Xd(t,this.h.restrictions,this.mc)&&this.j&&_u(this)==e&&su(this),(e=this.m?this.m.g:null)&&this.m.o)for(n=(t=h(t)).next();!n.done;n=t.next())for(var r=(n=h(n.value.drmInfos)).next();!r.done;r=n.next())if((r=r.value).keySystem==e.keySystem)for(var i=(r=h(r.initData||[])).next();!i.done;i=r.next())i=i.value,Et(this.m,i.initDataType,i.initData)},r.Vf=function(e){B.debug("onChooseStreams_",e);try{B.O("onChooseStreams_, choosing variant from ",e.variants),B.O("onChooseStreams_, choosing text from ",e.textStreams),this.yb=!0,this.u.disable(),du(this),B.debug("Choosing new streams after period changed");var t=ru(this,e.variants),n=On.Wb(e.textStreams,this.ua,this.Xa)[0]||null;this.wa&&(e.variants.includes(this.wa)&&(t=this.wa),this.wa=null),this.va&&(e.textStreams.includes(this.va)&&(n=this.va),this.va=null),t&&Bs(this,e,t,!0),n&&Js(this,e,n,!0);var r=this.j,i=r.h.get("video");if(i)var o=r.i.periods[i.oa];else{var a=r.h.get("audio");o=a?r.i.periods[a.oa]:null}var s=t?t.audio:null;if(!o&&n){var u;if(u=s){e=n;var c=Mn(this.h.preferredTextLanguage),l=Mn(s.language),d=Mn(e.language);u=Gn(d,c)&&!Gn(l,d)}u&&(this.ub=!0),this.ub&&this.M.l.setTextVisibility(!0),lu(this)}var h=this.h.streaming.alwaysStreamText||this.zc()?{variant:t,text:n}:{variant:t,text:null};return B.O("onChooseStreams_, chose variant ",h.variant),B.O("onChooseStreams_, chose text ",h.text),h}catch(f){return this.Va(f),{variant:null,text:null}}},r.Ze=function(){B.debug("canSwitch_"),this.yb=!1,this.h.abr.enabled&&(this.u.enable(),du(this)),this.wa&&(ya(this.j,this.wa,this.qe,this.oe),uu(this),this.wa=null),this.va&&(va(this.j,this.va,!0,0,!1),cu(this),this.va=null)},r.$f=function(){this.C&&this.C.update&&this.C.update()},r.eg=function(){this.A&&this.A.C()},r.Va=function(e){if(this.o!=xu){var t=new Ve("error",{detail:e});this.dispatchEvent(t),t.defaultPrevented&&(e.handled=!0)}};var xu=0,Eu=1,Lu=2,Iu=3;function Ru(e,t){var n=ms(new ps(e.Ea(),e.ja()),t.periods[0],new wi(null,0)),r=t.appMetadata||{};return n=Zu(n),{offlineUri:e.toString(),originalManifestUri:t.originalManifestUri,duration:t.duration,size:t.size,expiration:t.expiration,tracks:n,appMetadata:r}}function Zu(e){for(var t=[],n=On.Bf(e.variants),r=(n=h(n)).next();!r.done;r=n.next())t.push(On.Oc(r.value));for(n=(e=h(e.textStreams)).next();!n.done;n=e.next())t.push(On.Kc(n.value));return t}function Cu(){this.g={}}function Pu(e,t){var n=t.audio,r=t.video;if(n&&!r&&(e.g[n.id]=n.bandwidth||t.bandwidth),!n&&r&&(e.g[r.id]=r.bandwidth||t.bandwidth),n&&r){var i=n.bandwidth||393216,o=r.bandwidth||t.bandwidth-i;0>=o&&(B.v("Audio bit rate consumes variants bandwidth. Setting video bandwidth to match variant's bandwidth."),o=t.bandwidth),e.g[n.id]=i,e.g[r.id]=o}}function Gu(e,t){var n=e.g[t];return null==n&&(n=0,B.error("Asking for bitrate of stream not given to the estimator")),0==n&&B.v("Using bitrate of 0, this stream won't affect progress"),n}function Du(e){this.g=!1,this.h=new me,this.i=e}function Mu(e){var t=new Xu;e.periods.forEach((function(e,n){var r=Ou(e.variants);if(0==n)for(var i=(r=h(r.g)).next();!i.done;i=r.next())t.add(i.value);else!function(e,t){e.g=e.g.filter((function(e){return Wu(t,e)}))}(t,r)}));for(var n=(e=h(e.periods)).next();!n.done;n=e.next())(n=n.value).variants=n.variants.filter((function(e){return Wu(t,new Vu(e))}))}function Vu(e){var t=e.audio;e=e.video,this.h=t?t.mimeType:null,this.g=t?t.codecs.split(".")[0]:null,this.j=e?e.mimeType:null,this.i=e?e.codecs.split(".")[0]:null}function Xu(){this.g=[]}function Wu(e,t){return e.g.some((function(e){return t.h==e.h&&t.g==e.g&&t.j==e.j&&t.i==e.i}))}function Ou(e){for(var t=new Xu,n=(e=h(e)).next();!n.done;n=e.next())t.add(new Vu(n.value));return t}function Nu(e){var t=this;if(e&&e.constructor!=Xs)throw new J(2,9,9008);this.h=this.g=null,e?(this.g=e.h,this.h=e.Yb()):(this.g=Zs(),this.h=new je),this.j=!1,this.i=[],this.l=[];var n=!e;this.m=new Du((function(){return p((function e(){var r;return M(e,(function(e){switch(e.s){case 1:return r=function(){},k(e,Promise.all(t.l.map((function(e){return e.then(r,r)}))),2);case 2:if(!n){e.I(3);break}return k(e,t.h.destroy(),3);case 3:t.g=null,t.h=null,T(e)}}))}))}))}function Uu(){if(ft())e:{for(var e=h(is.values()),t=e.next();!t.done;t=e.next())if(t=(t=t.value)()){t.destroy(),e=!0;break e}e=!1}else e=!1;return e}function Fu(e,t){for(var n=[],r=h(e.periods),i=r.next();!i.done;i=r.next())for(var o=(i=h(i.value.streams)).next();!o.done;o=i.next())o=o.value,t&&"video"==o.contentType?n.push({contentType:ct(o.mimeType,o.codecs),robustness:e.drmInfo.videoRobustness}):t||"audio"!=o.contentType||n.push({contentType:ct(o.mimeType,o.codecs),robustness:e.drmInfo.audioRobustness});return n}function Yu(e,t,n){return p((function r(){return M(r,(function(r){if(1===r.s)return k(r,function(e,t,n,r){return p((function i(){var o,a,s;return M(i,(function(i){switch(i.s){case 1:return r.drmInfo?(o=function(e){var t=Array.from(e.g.keys());if(!t.length)throw new J(2,9,9e3,"No supported storage mechanisms found");return e.g.get(t[0]).getEmeSessionCell()}(n),a=r.sessionIds.map((function(e){return{sessionId:e,keySystem:r.drmInfo.keySystem,licenseUri:r.drmInfo.licenseServerUri,serverCertificate:r.drmInfo.serverCertificate,audioCapabilities:Fu(r,!1),videoCapabilities:Fu(r,!0)}})),k(i,As(t,e,a),2)):i.return();case 2:return s=i.B,k(i,o.remove(s),3);case 3:return k(i,o.add(a.filter((function(e){return-1==s.indexOf(e.sessionId)}))),0)}}))}))}(e.h,e.g.drm,n,t),0)}))}))}function Ku(e,t,n,r){function i(){s+=1,e.g.offline.progressCallback(u,s/a)}var o=function(e){var t=[];return e.periods.forEach((function(e){e.streams.forEach((function(e){null!=e.initSegmentKey&&t.push(e.initSegmentKey),e.segments.forEach((function(e){t.push(e.dataKey)}))}))})),t}(r),a=o.length+1,s=0,u=Ru(n,r);return Promise.all([t.removeSegments(o,i),t.removeManifests([n.key()],i)])}function ju(e,t,n,r,i,o){var a={id:o.id,originalId:o.originalId,primary:o.primary,presentationTimeOffset:o.presentationTimeOffset||0,contentType:o.type,mimeType:o.mimeType,codecs:o.codecs,frameRate:o.frameRate,pixelAspectRatio:o.pixelAspectRatio,kind:o.kind,language:o.language,label:o.label,width:o.width||null,height:o.height||null,initSegmentKey:null,encrypted:o.encrypted,keyId:o.keyId,segments:[],variantIds:[]};i=i.presentationTimeline.$b();var s=o.id,u=o.initSegmentReference;return u&&(u=Si(u.i(),u.h,u.g,e.g.streaming.retryParameters),Ya(t,s,u,.5*Gu(r,o.id),!0,(function(t){return p((function r(){var i;return M(r,(function(r){switch(r.s){case 1:return k(r,n.addSegments([{data:t}]),2);case 2:i=r.B,e.i.push(i[0]),a.initSegmentKey=i[0],T(r)}}))}))}))),function(e,t,n){for(var r=null==(t=e.findSegmentPosition(t))?null:e.getSegmentReference(t);r;)n(r),r=e.getSegmentReference(++t)}(o,i,(function(i){var u=Si(i.i(),i.h,i.g,e.g.streaming.retryParameters);Ya(t,s,u,function(e,t,n){return n=n.endTime-n.startTime,Gu(e,t)*n}(r,o.id,i),!1,(function(t){return p((function r(){var o;return M(r,(function(r){switch(r.s){case 1:return k(r,n.addSegments([{data:t}]),2);case 2:o=r.B,e.i.push(o[0]),a.segments.push({startTime:i.startTime,endTime:i.endTime,dataKey:o[0]}),T(r)}}))}))}))})),a}function Hu(e){if(e.m.g)throw new J(2,9,7001)}function Bu(){if(!Uu())throw new J(2,9,9e3)}function Ju(e,t){return p((function n(){return M(n,(function(n){switch(n.s){case 1:return e.l.push(t),E(n,2),k(n,t,4);case 4:return n.return(n.B);case 2:R(n),Ue(e.l,t),Z(n,0)}}))}))}function zu(e){var t=new Set(e.variants.map((function(e){return e.video}))),n=new Set(e.variants.map((function(e){return e.audio})));e=e.textStreams,1<t.size&&B.v("Multiple video tracks selected to be stored");for(var r=(t=h(n)).next();!r.done;r=t.next()){r=r.value;for(var i=h(n),o=i.next();!o.done;o=i.next())r!=(o=o.value)&&r.language==o.language&&B.v("Similar audio tracks were selected to be stored",r.id,o.id)}for(t=(n=h(e)).next();!t.done;t=n.next())for(t=t.value,i=(r=h(e)).next();!i.done;i=r.next())t!=(i=i.value)&&t.language==i.language&&B.v("Similar text tracks were selected to be stored",t.id,i.id)}Xs.LoadMode={DESTROYED:xu,NOT_LOADED:Eu,MEDIA_SOURCE:Lu,SRC_EQUALS:Iu},Du.prototype.destroy=function(){var e=this;return this.g?this.h:(this.g=!0,this.i().then((function(){e.h.resolve()}),(function(){e.h.resolve()})))},Xu.prototype.add=function(e){Wu(this,e)||this.g.push(e)},U("shaka.offline.Storage",Nu),Nu.support=Uu,Nu.prototype.destroy=function(){return this.m.destroy()},Nu.prototype.destroy=Nu.prototype.destroy,Nu.prototype.configure=function(e,t){2==arguments.length&&"string"==typeof e&&(e=Is(e,t));var n=e,r=!1;return null!=n.trackSelectionCallback&&(r=!0,n.offline=n.offline||{},n.offline.trackSelectionCallback=n.trackSelectionCallback,delete n.trackSelectionCallback),null!=n.progressCallback&&(r=!0,n.offline=n.offline||{},n.offline.progressCallback=n.progressCallback,delete n.progressCallback),null!=n.usePersistentLicense&&(r=!0,n.offline=n.offline||{},n.offline.usePersistentLicense=n.usePersistentLicense,delete n.usePersistentLicense),r&&Yn("Storage.configure with OfflineConfig","Please configure storage with a player configuration."),Cs(this.g,e)},Nu.prototype.configure=Nu.prototype.configure,Nu.prototype.getConfiguration=function(){var e=Zs();return Cs(e,this.g,Zs()),e},Nu.prototype.getConfiguration=Nu.prototype.getConfiguration,Nu.prototype.Yb=function(){return this.h},Nu.prototype.getNetworkingEngine=Nu.prototype.Yb,Nu.prototype.store=function(e,t,n){var r=this;return Ju(this,function(e,t,n,r){return p((function i(){var o,a,s,u,c,l,d,f,m;return M(i,(function(i){switch(i.s){case 1:return Bu(),e.j?i.return(Promise.reject(new J(2,9,9006))):(e.j=!0,k(i,function(e,t,n){return p((function r(){var i,o,a,s,u,c;return M(r,(function(r){switch(r.s){case 1:return i=null,o=e.h,a={networkingEngine:o,filterAllPeriods:function(){},filterNewPeriod:function(){},onTimelineRegionAdded:function(){},onEvent:function(){},onError:function(e){i=e}},k(r,n(),2);case 2:return(s=r.B).configure(e.g.manifest),Hu(e),E(r,3),k(r,s.start(t,a),5);case 5:return u=r.B,Hu(e),c=function(e){for(var t=new Set,n=(e=h(e.periods)).next();!n.done;n=e.next()){for(var r=h((n=n.value).textStreams),i=r.next();!i.done;i=r.next())t.add(i.value);for(r=(n=h(n.variants)).next();!r.done;r=n.next())(r=r.value).audio&&t.add(r.audio),r.video&&t.add(r.video)}return t}(u),k(r,Promise.all(ot(c,(function(e){return e.createSegmentIndex()}))),6);case 6:if(Hu(e),i)throw i;return r.return(u);case 3:return R(r),k(r,s.stop(),7);case 7:Z(r,0)}}))}))}(e,t,r),2));case 2:if(o=i.B,Hu(e),o.presentationTimeline.aa()||o.presentationTimeline.ib())throw new J(2,9,9005,t);return a=null,s=new ts,c=u=null,x(i,3,4),k(i,function(e,t,n){return p((function r(){var i,o,a;return M(r,(function(r){switch(r.s){case 1:return i=new wt({Ib:e.h,onError:n,Dc:function(){},onExpirationUpdated:function(){},onEvent:function(){}}),o=Oo(t.periods),a=e.g,i.configure(a.drm),k(r,function(e,t,n){return e.F=[],e.L=n,kt(e,t)}(i,o,a.offline.usePersistentLicense),2);case 2:return k(r,Tt(i),3);case 3:return k(r,xt(i),4);case 4:return r.return(i)}}))}))}(e,o,(function(e){c=c||e})),6);case 6:if(a=i.B,Hu(e),c)throw c;return k(i,function(e,t,n){return p((function r(){var i,o;return M(r,(function(r){switch(r.s){case 1:return i={width:1/0,height:1/0},function(e,t,n){for(var r=(e=h(e.periods)).next();!r.done;r=e.next())(r=r.value).variants=r.variants.filter((function(e){return On.rd(e,t,n)}))}(t,e.g.restrictions,i),function(e){for(var t=(e=h(e.periods)).next();!t.done;t=e.next())(t=t.value).variants=t.variants.filter((function(e){var t=!0;return e.audio&&(t=t&&wn(e.audio)),e.video&&(t=t&&wn(e.video)),t}))}(t),function(e,t){for(var n=h(e.periods),r=n.next();!r.done;r=n.next())(r=r.value).variants=r.variants.filter((function(e){return Vt(t,e)}))}(t,n),Mu(t),o=e.g.preferredAudioChannelCount,On.$d(t,o),k(r,function(e,t){return p((function n(){var r,i,o,a;return M(n,(function(n){switch(n.s){case 1:r=null,i=h(e.periods),o=i.next();case 2:if(o.done){n.I(0);break}return a=o.value,r&&(a.variants=a.variants.filter((function(e){return Wu(r,new Vu(e))}))),k(n,t(a),5);case 5:r=Ou(a.variants),o=i.next(),n.I(2)}}))}))}(t,(function(t){return p((function n(){var r,i,o,a,s,u,c,l;return M(n,(function(n){switch(n.s){case 1:r=On,i=[];for(var d=h(t.variants),f=d.next();!f.done;f=d.next())o=f.value,i.push(r.Oc(o));for(f=(d=h(t.textStreams)).next();!f.done;f=d.next())a=f.value,i.push(r.Kc(a));return k(n,e.g.offline.trackSelectionCallback(i),2);case 2:for(s=n.B,u=new Set,c=new Set,f=(d=h(s)).next();!f.done;f=d.next())"variant"==(l=f.value).type&&u.add(l.id),"text"==l.type&&c.add(l.id);t.variants=t.variants.filter((function(e){return u.has(e.id)})),t.textStreams=t.textStreams.filter((function(e){return c.has(e.id)})),T(n)}}))}))})),2);case 2:(function(e){if(0==e.periods.length)throw new J(2,4,4014);for(var t=(e=h(e.periods)).next();!t.done;t=e.next())zu(t.value)})(t),T(r)}}))}))}(e,o,a),7);case 7:return k(i,s.init(),8);case 8:return Hu(e),k(i,function(e){var t=null;if(e.g.forEach((function(e,n){e.getCells().forEach((function(e,r){e.hasFixedKeySpace()||t||(t={path:{Ea:n,ja:r},ja:e})}))})),t)return t;throw new J(2,9,9013,"Could not find a cell that supports add-operations")}(s),9);case 9:return u=i.B,Hu(e),k(i,function(e,t,n,r,i,o){return p((function a(){var s,u,c,l,d,f,m,y,v,g;return M(a,(function(a){switch(a.s){case 1:return s=function(e,t,n){var r=null==t.expiration?1/0:t.expiration;return{offlineUri:null,originalManifestUri:e,duration:t.presentationTimeline.ha(),size:0,expiration:r,tracks:t=Zu(t.periods[0]),appMetadata:n}}(i,r,o),u=r.periods.some((function(e){return e.variants.some((function(e){return e.drmInfos&&e.drmInfos.length}))})),c=r.periods.some((function(e){return e.variants.some((function(e){return e.drmInfos.some((function(e){return e.initData&&e.initData.length}))}))})),d=null,(l=u&&!c)&&(f=n.g,d=Qu.get(f.keySystem)),m=new Fa(e.h,(function(t,n){s.size=n,e.g.offline.progressCallback(s,t)}),(function(t,r){l&&e.g.offline.usePersistentLicense&&d==r&&Et(n,"cenc",t)})),E(a,2),v=y=function(e,t,n,r,i,o,a){var s=new Cu,u=i.periods.map((function(r){return function(e,t,n,r,i,o){for(var a=h(o.variants),s=a.next();!s.done;s=a.next())Pu(r,s.value);for(a=h(o.textStreams),s=a.next();!s.done;s=a.next())r.g[s.value.id]=52;a=function(e){for(var t=new Set,n=h(e.textStreams),r=n.next();!r.done;r=n.next())t.add(r.value);for(e=h(e.variants),n=e.next();!n.done;n=e.next())(n=n.value).audio&&t.add(n.audio),n.video&&t.add(n.video);return t}(o);var u=new Map;for(a=h(a),s=a.next();!s.done;s=a.next()){var c=ju(e,t,n,r,i,s=s.value);u.set(s.id,c)}return o.variants.forEach((function(e){e.audio&&u.get(e.audio.id).variantIds.push(e.id),e.video&&u.get(e.video.id).variantIds.push(e.id)})),{startTime:o.startTime,streams:Array.from(u.values())}}(e,t,n,s,i,r)})),c=r.g,l=e.g.offline.usePersistentLicense;return c&&l&&(c.initData=[]),{originalManifestUri:o,duration:i.presentationTimeline.ha(),size:0,expiration:r.Xb(),periods:u,sessionIds:l?Rt(r):[],drmInfo:c,appMetadata:a}}(e,m,t,n,r,i,o),k(a,function(e){return p((function t(){return M(t,(function(t){switch(t.s){case 1:return k(t,Promise.all(e.h.values()),2);case 2:return t.return(e.g.g)}}))}))}(m),4);case 4:if(v.size=a.B,y.expiration=n.Xb(),g=Rt(n),y.sessionIds=e.g.offline.usePersistentLicense?g:[],u&&e.g.offline.usePersistentLicense&&!g.length)throw new J(2,9,9007);return a.return(y);case 2:return R(a),k(a,m.destroy(),5);case 5:Z(a,0)}}))}))}(e,u.ja,a,o,t,n),10);case 10:if(l=i.B,Hu(e),c)throw c;return k(i,u.ja.addManifests([l]),11);case 11:return d=i.B,Hu(e),f=new hs("manifest",u.path.Ea,u.path.ja,d[0]),i.return(Ru(f,l));case 4:return R(i),e.j=!1,e.i=[],k(i,s.destroy(),12);case 12:if(!a){i.I(13);break}return k(i,a.destroy(),13);case 13:Z(i,0);break;case 3:if(m=I(i),!u){i.I(15);break}return k(i,u.ja.removeSegments(e.i,(function(){})),15);case 15:throw c||m}}))}))}(this,e,t||{},(function(){return p((function t(){var i,o;return M(t,(function(t){switch(t.s){case 1:return n&&"string"!=typeof n?(Yn("Storing with a manifest parser factory","Please register a manifest parser and for the mime-type."),i=n,t.return(new i)):k(t,_i.create(e,r.h,r.g.manifest.retryParameters,n),2);case 2:return o=t.B,t.return(o)}}))}))})))},Nu.prototype.store=Nu.prototype.store,Nu.prototype.Hf=function(){return this.j},Nu.prototype.getStoreInProgress=Nu.prototype.Hf,Nu.prototype.remove=function(e){return Ju(this,function(e,t){return p((function n(){var r,i,o,a,s,u;return M(n,(function(n){switch(n.s){case 1:return Bu(),null==(r=fs(t))||"manifest"!=r.g?n.return(Promise.reject(new J(2,9,9004,t))):(i=r,o=new ts,E(n,2),k(n,o.init(),4));case 4:return k(n,ns(o,i.Ea(),i.ja()),5);case 5:return k(n,(a=n.B).getManifests([i.key()]),6);case 6:return s=n.B,u=s[0],k(n,Promise.all([Yu(e,u,o),Ku(e,a,i,u)]),2);case 2:return R(n),k(n,o.destroy(),8);case 8:Z(n,0)}}))}))}(this,e))},Nu.prototype.remove=Nu.prototype.remove,Nu.prototype.sg=function(){return Ju(this,function(e){return p((function t(){var n,r,i,o,a,s,u,c,l;return M(t,(function(t){switch(t.s){case 1:return Bu(),n=e.h,r=e.g.drm,i=new ts,o=!1,E(t,2),k(t,i.init(),4);case 4:for(a=[],function(e,t){e.g.forEach((function(e){t(e.getEmeSessionCell())}))}(i,(function(e){return a.push(e)})),s=Promise.resolve(),u={},c=h(a),l=c.next();!l.done;u={Jc:u.Jc},l=c.next())u.Jc=l.value,s=s.then(function(e){return function(){return p((function t(){var i,a;return M(t,(function(t){switch(t.s){case 1:return k(t,e.Jc.getAll(),2);case 2:return i=t.B,k(t,As(r,n,i),3);case 3:return a=t.B,k(t,e.Jc.remove(a),4);case 4:a.length!=i.length&&(o=!0),T(t)}}))}))}}(u));return k(t,s,2);case 2:return R(t),k(t,i.destroy(),6);case 6:Z(t,3);break;case 3:return t.return(!o)}}))}))}(this))},Nu.prototype.removeEmeSessions=Nu.prototype.sg,Nu.prototype.list=function(){return Ju(this,p((function e(){var t,n,r;return M(e,(function(e){switch(e.s){case 1:return Bu(),t=[],n=new ts,E(e,2),k(e,n.init(),4);case 4:return r=Promise.resolve(),function(e,t){e.g.forEach((function(e,n){e.getCells().forEach((function(e,r){t({Ea:n,ja:r},e)}))}))}(n,(function(e,n){r=r.then((function(){return p((function r(){return M(r,(function(r){switch(r.s){case 1:return k(r,n.getAllManifests(),2);case 2:r.B.forEach((function(n,r){var i=Ru(new hs("manifest",e.Ea,e.ja,r),n);t.push(i)})),T(r)}}))}))}))})),k(e,r,2);case 2:return R(e),k(e,n.destroy(),6);case 6:Z(e,3);break;case 3:return e.return(t)}}))})))},Nu.prototype.list=Nu.prototype.list,Nu.deleteAll=function(){return p((function e(){var t;return M(e,(function(e){switch(e.s){case 1:return t=new ts,E(e,2),k(e,t.erase(),2);case 2:return R(e),k(e,t.destroy(),5);case 5:Z(e,0)}}))}))};var Qu=(new Map).set("org.w3.clearkey","1077efecc0b24d02ace33c1e52e2fb4b").set("com.widevine.alpha","edef8ba979d64acea3c827dcd51d21ed").set("com.microsoft.playready","9a04f07998404286ab92e65be0885f95").set("com.adobe.primetime","f239e769efa348509c16a903c6932efb");Ns.offline=Uu,U("shaka.polyfill.installAll",(function(){for(var e=0;e<ec.length;++e)try{ec[e].Xe()}catch(t){B.ba("Error installing polyfill!",t)}}));var qu,$u,ec=[];function tc(e,t){for(var n={priority:t=t||0,Xe:e},r=0;r<ec.length;r++)if(ec[r].priority<t)return void ec.splice(r,0,n);ec.push(n)}function nc(e){var t=e.type.replace(/^(webkit|moz|MS)/,"").toLowerCase();if("function"==typeof Event)var n=new Event(t,e);else(n=document.createEvent("Event")).initEvent(t,e.bubbles,e.cancelable);e.target.dispatchEvent(n)}function rc(e,t,n){"input"==e&&"range"===this.type&&(e="change"),HTMLInputElement.prototype.originalAddEventListener.call(this,e,t,n)}function ic(){var e=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(t){for(var n=[],r=0;r<arguments.length;++r)n[r]=arguments[r];return(n=e.apply(this,n)).abort=function(){},n}}function oc(e,t){B.debug("PatchedMediaKeysApple.requestMediaKeySystemAccess");try{var n=new ac(e,t);return Promise.resolve(n)}catch(r){return Promise.reject(r)}}function ac(e,t){if(B.debug("PatchedMediaKeysApple.MediaKeySystemAccess"),this.keySystem=e,e.startsWith("com.apple.fps"))for(var n=h(t),r=n.next();!r.done;r=n.next()){var i=r.value;if("required"==i.persistentState)r=null;else{r={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:i.initDataTypes,sessionTypes:["temporary"],label:i.label};var o=!1,a=!1;if(i.audioCapabilities)for(var s=h(i.audioCapabilities),u=s.next();!u.done;u=s.next())if((u=u.value).contentType){o=!0;var c=u.contentType.split(";")[0];WebKitMediaKeys.isTypeSupported(this.keySystem,c)&&(r.audioCapabilities.push(u),a=!0)}if(i.videoCapabilities)for(u=(i=h(i.videoCapabilities)).next();!u.done;u=i.next())(s=u.value).contentType&&(o=!0,u=s.contentType.split(";")[0],WebKitMediaKeys.isTypeSupported(this.keySystem,u)&&(r.videoCapabilities.push(s),a=!0));o||(a=WebKitMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),r=a?r:null}if(r)return void(this.g=r)}throw(n=Error("Unsupported keySystem")).name="NotSupportedError",n.code=DOMException.NOT_SUPPORTED_ERR,n}function sc(e){B.debug("PatchedMediaKeysApple.setMediaKeys");var t=this.mediaKeys;return t&&t!=e&&cc(t,null),delete this.mediaKeys,(this.mediaKeys=e)?cc(e,this):Promise.resolve()}function uc(e){B.debug("PatchedMediaKeysApple.MediaKeys"),this.h=new WebKitMediaKeys(e),this.g=new et}function cc(e,t){if(e.g.nb(),!t)return Promise.resolve();e.g.H(t,"webkitneedkey",dc);try{return Ko(t,HTMLMediaElement.HAVE_METADATA,e.g,(function(){t.webkitSetMediaKeys(e.h)})),Promise.resolve()}catch(n){return Promise.reject(n)}}function lc(e){B.debug("PatchedMediaKeysApple.MediaKeySession"),We.call(this),this.h=null,this.l=e,this.i=this.g=null,this.j=new et,this.sessionId="",this.expiration=NaN,this.closed=new me,this.keyStatuses=new fc}function dc(e){if(B.debug("PatchedMediaKeysApple.onWebkitNeedKey_",e),e=new Uint8Array(e.initData),new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,!0)+4!=e.byteLength)throw new RangeError("Malformed FairPlay init data");e=be(e=ve(e.subarray(4),!0));var t=new Event("encrypted");t.initDataType="skd",t.initData=e,this.dispatchEvent(t)}function hc(e,t){var n=e.keyStatuses;n.size=null==t?0:1,n.g=t,e.dispatchEvent(new Ve("keystatuseschange"))}function fc(){this.size=0,this.g=void 0}function pc(e,t){B.debug("PatchedMediaKeysMs.requestMediaKeySystemAccess");try{var n=new mc(e,t);return Promise.resolve(n)}catch(r){return Promise.reject(r)}}function mc(e,t){B.debug("PatchedMediaKeysMs.MediaKeySystemAccess"),this.keySystem=e;for(var n=!1,r=0;r<t.length;++r){var i=t[r],o={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:i.initDataTypes,sessionTypes:["temporary"],label:i.label},a=!1;if(i.audioCapabilities)for(var s=0;s<i.audioCapabilities.length;++s){var u=i.audioCapabilities[s];if(u.contentType){a=!0;var c=u.contentType.split(";")[0];MSMediaKeys.isTypeSupported(this.keySystem,c)&&(o.audioCapabilities.push(u),n=!0)}}if(i.videoCapabilities)for(s=0;s<i.videoCapabilities.length;++s)(u=i.videoCapabilities[s]).contentType&&(a=!0,c=u.contentType.split(";")[0],MSMediaKeys.isTypeSupported(this.keySystem,c)&&(o.videoCapabilities.push(u),n=!0));if(a||(n=MSMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),"required"==i.persistentState&&(n=!1),n)return void(this.g=o)}throw(n=Error("Unsupported keySystem")).name="NotSupportedError",n.code=DOMException.NOT_SUPPORTED_ERR,n}function yc(e){B.debug("PatchedMediaKeysMs.setMediaKeys");var t=this.mediaKeys;return t&&t!=e&&gc(t,null),delete this.mediaKeys,(this.mediaKeys=e)?gc(e,this):Promise.resolve()}function vc(e){B.debug("PatchedMediaKeysMs.MediaKeys"),this.h=new MSMediaKeys(e),this.g=new et}function gc(e,t){if(e.g.nb(),!t)return Promise.resolve();e.g.H(t,"msneedkey",Ac);try{return Ko(t,HTMLMediaElement.HAVE_METADATA,e.g,(function(){t.msSetMediaKeys(e.h)})),Promise.resolve()}catch(n){return Promise.reject(n)}}function bc(e){B.debug("PatchedMediaKeysMs.MediaKeySession"),We.call(this),this.i=null,this.l=e,this.h=this.g=null,this.j=new et,this.sessionId="",this.expiration=NaN,this.closed=new me,this.keyStatuses=new wc}function Ac(e){if(B.debug("PatchedMediaKeysMs.onMsNeedKey_",e),e.initData){var t=document.createEvent("CustomEvent");t.initCustomEvent("encrypted",!1,!1,null),t.initDataType="cenc",t.initData=function(e){if(!e)return e;var t=new Yr(e);if(1>=t.data.length)return e;e=[];for(var n={},r=(t=h(t.data)).next();!r.done;n={yc:n.yc},r=t.next())n.yc=r.value,e.some(function(e){return function(t){return Se.Ha(t,e.yc)}}(n))||e.push(n.yc);return Se.concat.apply(Se,e instanceof Array?e:function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(h(e)))}(e.initData).buffer,this.dispatchEvent(t)}}function _c(e,t){var n=e.keyStatuses;n.size=null==t?0:1,n.g=t,e.dispatchEvent(new Ve("keystatuseschange"))}function wc(){this.size=0,this.g=void 0}function Sc(){return B.debug("PatchedMediaKeysNop.requestMediaKeySystemAccess"),Promise.reject(Error("The key system specified is not supported."))}function kc(e){return B.debug("PatchedMediaKeysNop.setMediaKeys"),null==e?Promise.resolve():Promise.reject(Error("MediaKeys not supported."))}function Tc(){throw new TypeError("Illegal constructor.")}function xc(){throw new TypeError("Illegal constructor.")}U("shaka.polyfill.register",tc),tc((function(){Ol()}),-1),tc((function(){if(e.Document){var t=Element.prototype;t.requestFullscreen=t.requestFullscreen||t.mozRequestFullScreen||t.msRequestFullscreen||t.webkitRequestFullscreen,(t=Document.prototype).exitFullscreen=t.exitFullscreen||t.mozCancelFullScreen||t.msExitFullscreen||t.webkitCancelFullScreen,"fullscreenElement"in document||(Object.defineProperty(document,"fullscreenElement",{get:function(){return document.mozFullScreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement||document.webkitFullscreenElement}}),Object.defineProperty(document,"fullscreenEnabled",{get:function(){return document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled}})),document.addEventListener("webkitfullscreenchange",nc),document.addEventListener("webkitfullscreenerror",nc),document.addEventListener("mozfullscreenchange",nc),document.addEventListener("mozfullscreenerror",nc),document.addEventListener("MSFullscreenChange",nc),document.addEventListener("MSFullscreenError",nc)}})),tc((function(){B.debug("InputEvent.install"),gt("Trident/")&&!HTMLInputElement.prototype.originalAddEventListener&&(B.info("Patching input event support on IE."),HTMLInputElement.prototype.originalAddEventListener=HTMLInputElement.prototype.addEventListener,HTMLInputElement.prototype.addEventListener=rc)})),tc((function(){navigator.languages||Object.defineProperty(navigator,"languages",{get:function(){return navigator.language?[navigator.language]:["en"]}})})),tc((function(){B.debug("mathRound.install")})),tc((function(){B.debug("MediaSource.install");var t=vt();e.MediaSource?e.cast&&cast.__platform__&&cast.__platform__.canDisplayType?(B.info("Patching Chromecast MSE bugs."),function(){var e=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(t){var n=t.split(/ *; */);return n.shift(),n.some((function(e){return e.startsWith("codecs=")}))?cast.__platform__.canDisplayType(t):e(t)}}()):t?(function(){var e=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(t){return"mp2t"!=t.split(/ *; */)[0].split("/")[1].toLowerCase()&&e(t)}}(),12>=t?(B.info("Patching Safari 11 & 12 MSE bugs."),ic(),function(){var e=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(t,n){return e.call(this,t,n-.001)}}()):(B.info("Patching Safari 13 MSE bugs."),ic())):gt("Tizen 2")||gt("Tizen 3")||gt("Tizen 4")?function(){var e=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(t){return"opus"!=dt(t)[0]&&e(t)}}():B.info("Using native MSE as-is."):B.info("No MSE implementation available.")})),ac.prototype.createMediaKeys=function(){B.debug("PatchedMediaKeysApple.MediaKeySystemAccess.createMediaKeys");var e=new uc(this.keySystem);return Promise.resolve(e)},ac.prototype.getConfiguration=function(){return B.debug("PatchedMediaKeysApple.MediaKeySystemAccess.getConfiguration"),this.g},uc.prototype.createSession=function(e){if(B.debug("PatchedMediaKeysApple.MediaKeys.createSession"),"temporary"!=(e=e||"temporary"))throw new TypeError("Session type "+e+" is unsupported on this platform.");return new lc(this.h)},uc.prototype.setServerCertificate=function(e){return B.debug("PatchedMediaKeysApple.MediaKeys.setServerCertificate"),Promise.resolve(!0)},F(lc,We),(r=lc.prototype).generateRequest=function(e,t){B.debug("PatchedMediaKeysApple.MediaKeySession.generateRequest"),this.g=new me;try{this.h=this.l.createSession("video/mp4",new Uint8Array(t)),this.sessionId=this.h.sessionId||"",this.j.H(this.h,"webkitkeymessage",this.Gg.bind(this)),this.j.H(this.h,"webkitkeyadded",this.Eg.bind(this)),this.j.H(this.h,"webkitkeyerror",this.Fg.bind(this)),hc(this,"status-pending")}catch(n){this.g.reject(n)}return this.g},r.load=function(){return B.debug("PatchedMediaKeysApple.MediaKeySession.load"),Promise.reject(Error("MediaKeySession.load not yet supported"))},r.update=function(e){B.debug("PatchedMediaKeysApple.MediaKeySession.update"),this.i=new me;try{this.h.update(new Uint8Array(e))}catch(t){this.i.reject(t)}return this.i},r.close=function(){B.debug("PatchedMediaKeysApple.MediaKeySession.close");try{this.h.close(),this.closed.resolve(),this.j.nb()}catch(s){this.closed.reject(s)}return this.closed},r.remove=function(){return B.debug("PatchedMediaKeysApple.MediaKeySession.remove"),Promise.reject(Error("MediaKeySession.remove is only applicable for persistent licenses, which are not supported on this platform"))},r.Gg=function(e){B.debug("PatchedMediaKeysApple.onWebkitKeyMessage_",e),this.g&&(this.g.resolve(),this.g=null),this.dispatchEvent(new Ve("message",{messageType:null==this.keyStatuses.g?"license-request":"license-renewal",message:e.message.buffer}))},r.Eg=function(e){B.debug("PatchedMediaKeysApple.onWebkitKeyAdded_",e),this.i&&(hc(this,"usable"),this.i.resolve(),this.i=null)},r.Fg=function(e){if(B.debug("PatchedMediaKeysApple.onWebkitKeyError_",e),(e=Error("EME PatchedMediaKeysApple key error")).errorCode=this.h.error,null!=this.g)this.g.reject(e),this.g=null;else if(null!=this.i)this.i.reject(e),this.i=null;else switch(this.h.error.code){case WebKitMediaKeyError.MEDIA_KEYERR_OUTPUT:case WebKitMediaKeyError.MEDIA_KEYERR_HARDWARECHANGE:hc(this,"output-not-allowed");break;default:hc(this,"internal-error")}},(r=fc.prototype).forEach=function(e){this.g&&e(this.g,qu)},r.get=function(e){if(this.has(e))return this.g},r.has=function(e){var t=qu;return!(!this.g||!Se.Ha(new Uint8Array(e),new Uint8Array(t)))},r.entries=function(){},r.keys=function(){},r.values=function(){},tc((function(){e.HTMLVideoElement&&e.WebKitMediaKeys&&(B.info("Using Apple-prefixed EME"),qu=new Uint8Array([0]).buffer,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=sc,e.MediaKeys=uc,e.MediaKeySystemAccess=ac,navigator.requestMediaKeySystemAccess=oc)})),mc.prototype.createMediaKeys=function(){B.debug("PatchedMediaKeysMs.MediaKeySystemAccess.createMediaKeys");var e=new vc(this.keySystem);return Promise.resolve(e)},mc.prototype.getConfiguration=function(){return B.debug("PatchedMediaKeysMs.MediaKeySystemAccess.getConfiguration"),this.g},vc.prototype.createSession=function(e){if(B.debug("PatchedMediaKeysMs.MediaKeys.createSession"),"temporary"!=(e=e||"temporary"))throw new TypeError("Session type "+e+" is unsupported on this platform.");return new bc(this.h)},vc.prototype.setServerCertificate=function(){return B.debug("PatchedMediaKeysMs.MediaKeys.setServerCertificate"),Promise.resolve(!1)},F(bc,We),(r=bc.prototype).generateRequest=function(e,t){B.debug("PatchedMediaKeysMs.MediaKeySession.generateRequest"),this.g=new me;try{this.i=this.l.createSession("video/mp4",new Uint8Array(t),null),this.j.H(this.i,"mskeymessage",this.dg.bind(this)),this.j.H(this.i,"mskeyadded",this.bg.bind(this)),this.j.H(this.i,"mskeyerror",this.cg.bind(this)),_c(this,"status-pending")}catch(n){this.g.reject(n)}return this.g},r.load=function(){return B.debug("PatchedMediaKeysMs.MediaKeySession.load"),Promise.reject(Error("MediaKeySession.load not yet supported"))},r.update=function(e){B.debug("PatchedMediaKeysMs.MediaKeySession.update"),this.h=new me;try{this.i.update(new Uint8Array(e))}catch(t){this.h.reject(t)}return this.h},r.close=function(){B.debug("PatchedMediaKeysMs.MediaKeySession.close");try{this.i.close(),this.closed.resolve(),this.j.nb()}catch(s){this.closed.reject(s)}return this.closed},r.remove=function(){return B.debug("PatchedMediaKeysMs.MediaKeySession.remove"),Promise.reject(Error("MediaKeySession.remove is only applicable for persistent licenses, which are not supported on this platform"))},r.dg=function(e){B.debug("PatchedMediaKeysMs.onMsKeyMessage_",e),this.g&&(this.g.resolve(),this.g=null),this.dispatchEvent(new Ve("message",{messageType:null==this.keyStatuses.g?"license-request":"license-renewal",message:e.message.buffer}))},r.bg=function(e){B.debug("PatchedMediaKeysMs.onMsKeyAdded_",e),this.g?(B.debug("Simulating completion for a PR persistent license."),_c(this,"usable"),this.g.resolve(),this.g=null):this.h&&(_c(this,"usable"),this.h.resolve(),this.h=null)},r.cg=function(e){if(B.debug("PatchedMediaKeysMs.onMsKeyError_",e),(e=Error("EME PatchedMediaKeysMs key error")).errorCode=this.i.error,null!=this.g)this.g.reject(e),this.g=null;else if(null!=this.h)this.h.reject(e),this.h=null;else switch(this.i.error.code){case MSMediaKeyError.MS_MEDIA_KEYERR_OUTPUT:case MSMediaKeyError.MS_MEDIA_KEYERR_HARDWARECHANGE:_c(this,"output-not-allowed");break;default:_c(this,"internal-error")}},(r=wc.prototype).forEach=function(e){this.g&&e(this.g,$u)},r.get=function(e){if(this.has(e))return this.g},r.has=function(e){var t=$u;return!(!this.g||!Se.Ha(new Uint8Array(e),new Uint8Array(t)))},r.entries=function(){},r.keys=function(){},r.values=function(){},tc((function(){!e.HTMLVideoElement||!e.MSMediaKeys||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration||(B.info("Using ms-prefixed EME v20140218"),$u=new Uint8Array([0]).buffer,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=yc,e.MediaKeys=vc,e.MediaKeySystemAccess=mc,navigator.requestMediaKeySystemAccess=pc)})),Tc.prototype.createSession=function(){},Tc.prototype.setServerCertificate=function(){},xc.prototype.getConfiguration=function(){},xc.prototype.createMediaKeys=function(){},tc((function(){!e.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration||(B.info("EME not available."),navigator.requestMediaKeySystemAccess=Sc,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=kc,e.MediaKeys=Tc,e.MediaKeySystemAccess=xc)}),-10);var Ec,Lc="";function Ic(e){return Lc?Lc+e.charAt(0).toUpperCase()+e.slice(1):e}function Rc(e,t){B.debug("PatchedMediaKeysWebkit.requestMediaKeySystemAccess");try{var n=new Cc(e,t);return Promise.resolve(n)}catch(r){return Promise.reject(r)}}function Zc(e){B.debug("PatchedMediaKeysWebkit.setMediaKeys");var t=this.mediaKeys;return t&&t!=e&&Gc(t,null),delete this.mediaKeys,(this.mediaKeys=e)&&Gc(e,this),Promise.resolve()}function Cc(e,t){B.debug("PatchedMediaKeysWebkit.MediaKeySystemAccess"),this.g=this.keySystem=e;var n=!1;"org.w3.clearkey"==e&&(this.g="webkit-org.w3.clearkey",n=!1);var r=!1,i=document.getElementsByTagName("video");i=i.length?i[0]:document.createElement("video");for(var o=0;o<t.length;++o){var a=t[o],s={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:a.initDataTypes,sessionTypes:["temporary"],label:a.label},u=!1;if(a.audioCapabilities)for(var c=0;c<a.audioCapabilities.length;++c){var l=a.audioCapabilities[c];if(l.contentType){u=!0;var d=l.contentType.split(";")[0];i.canPlayType(d,this.g)&&(s.audioCapabilities.push(l),r=!0)}}if(a.videoCapabilities)for(c=0;c<a.videoCapabilities.length;++c)(l=a.videoCapabilities[c]).contentType&&(u=!0,i.canPlayType(l.contentType,this.g)&&(s.videoCapabilities.push(l),r=!0));if(u||(r=i.canPlayType("video/mp4",this.g)||i.canPlayType("video/webm",this.g)),"required"==a.persistentState&&(n?(s.persistentState="required",s.sessionTypes=["persistent-license"]):r=!1),r)return void(this.h=s)}throw n="Unsupported keySystem","org.w3.clearkey"!=e&&"com.widevine.alpha"!=e||(n="None of the requested configurations were supported."),(n=Error(n)).name="NotSupportedError",n.code=DOMException.NOT_SUPPORTED_ERR,n}function Pc(e){B.debug("PatchedMediaKeysWebkit.MediaKeys"),this.l=e,this.h=null,this.g=new et,this.i=[],this.j={}}function Gc(e,t){e.h=t,e.g.nb();var n=Lc;t&&(e.g.H(t,n+"needkey",e.hg.bind(e)),e.g.H(t,n+"keymessage",e.Jg.bind(e)),e.g.H(t,n+"keyadded",e.Hg.bind(e)),e.g.H(t,n+"keyerror",e.Ig.bind(e)))}function Dc(e,t){var n=e.j[t];return n?(B.debug("PatchedMediaKeysWebkit.MediaKeys.findSession_",n),n):(n=e.i.shift())?(n.sessionId=t,e.j[t]=n,B.debug("PatchedMediaKeysWebkit.MediaKeys.findSession_",n),n):null}function Mc(e,t,n){B.debug("PatchedMediaKeysWebkit.MediaKeySession"),We.call(this),this.j=e,this.m=!1,this.g=this.h=null,this.i=t,this.l=n,this.sessionId="",this.expiration=NaN,this.closed=new me,this.keyStatuses=new Wc}function Vc(e,t,n){if(e.m)return Promise.reject(Error("The session is already initialized."));e.m=!0;try{if("persistent-license"==e.l)if(n)var r=new Uint8Array(be("LOAD_SESSION|"+n));else{var i=be("PERSISTENT|"),o=new Uint8Array(i.byteLength+t.byteLength);o.set(new Uint8Array(i),0),o.set(new Uint8Array(t),i.byteLength),r=o}else r=new Uint8Array(t)}catch(s){return Promise.reject(s)}e.h=new me;var a=Ic("generateKeyRequest");try{e.j[a](e.i,r)}catch(s){if("InvalidStateError"!=s.name)return e.h=null,Promise.reject(s);new Le((function(){try{e.j[a](e.i,r)}catch(t){e.h.reject(t),e.h=null}})).V(.01)}return e.h}function Xc(e,t){var n=e.keyStatuses;n.size=null==t?0:1,n.g=t,e.dispatchEvent(new Ve("keystatuseschange"))}function Wc(){this.size=0,this.g=void 0}function Oc(e){if("picture-in-picture"==(e=e.target).webkitPresentationMode){document.pictureInPictureElement=e;var t=new Event("enterpictureinpicture");e.dispatchEvent(t)}else document.pictureInPictureElement==e&&(document.pictureInPictureElement=null),t=new Event("leavepictureinpicture"),e.dispatchEvent(t)}function Nc(){return this.webkitSupportsPresentationMode("picture-in-picture")?(this.webkitSetPresentationMode("picture-in-picture"),document.pictureInPictureElement=this,Promise.resolve()):Promise.reject(Error("PiP not allowed by video element"))}function Uc(){var e=document.pictureInPictureElement;return e?(e.webkitSetPresentationMode("inline"),document.pictureInPictureElement=null,Promise.resolve()):Promise.reject(Error("No picture in picture element found"))}function Fc(){return!!this.hasAttribute("disablePictureInPicture")||!this.webkitSupportsPresentationMode("picture-in-picture")}function Yc(e){e?this.setAttribute("disablePictureInPicture",""):this.removeAttribute("disablePictureInPicture")}function Kc(){return{droppedVideoFrames:this.webkitDroppedFrameCount,totalVideoFrames:this.webkitDecodedFrameCount,corruptedVideoFrames:0,creationTime:NaN,totalFrameDelay:0}}function jc(t,n,r){return new e.TextTrackCue(t,n,r)}function Hc(t,n,r){return new e.TextTrackCue(t+"-"+n+"-"+r,t,n,r)}function Bc(){}Cc.prototype.createMediaKeys=function(){B.debug("PatchedMediaKeysWebkit.MediaKeySystemAccess.createMediaKeys");var e=new Pc(this.g);return Promise.resolve(e)},Cc.prototype.getConfiguration=function(){return B.debug("PatchedMediaKeysWebkit.MediaKeySystemAccess.getConfiguration"),this.h},(r=Pc.prototype).createSession=function(e){if(B.debug("PatchedMediaKeysWebkit.MediaKeys.createSession"),"temporary"!=(e=e||"temporary")&&"persistent-license"!=e)throw new TypeError("Session type "+e+" is unsupported on this platform.");var t=this.h||document.createElement("video");return t.src||(t.src="about:blank"),e=new Mc(t,this.l,e),this.i.push(e),e},r.setServerCertificate=function(){return B.debug("PatchedMediaKeysWebkit.MediaKeys.setServerCertificate"),Promise.resolve(!1)},r.hg=function(e){B.debug("PatchedMediaKeysWebkit.onWebkitNeedKey_",e);var t=document.createEvent("CustomEvent");t.initCustomEvent("encrypted",!1,!1,null),t.initDataType="cenc",e.initData instanceof ArrayBuffer?t.initData=e.initData:t.initData=e.initData.buffer,this.h.dispatchEvent(t)},r.Jg=function(e){B.debug("PatchedMediaKeysWebkit.onWebkitKeyMessage_",e);var t=Dc(this,e.sessionId);t?(e=new Ve("message",{messageType:null==t.keyStatuses.g?"licenserequest":"licenserenewal",message:e.message}),B.debug("PatchedMediaKeysWebkit.MediaKeySession.generated"),t.h&&(t.h.resolve(),t.h=null),t.dispatchEvent(e)):B.error("Session not found",e.sessionId)},r.Hg=function(e){B.debug("PatchedMediaKeysWebkit.onWebkitKeyAdded_",e),(e=Dc(this,e.sessionId))&&(B.debug("PatchedMediaKeysWebkit.MediaKeySession.ready"),Xc(e,"usable"),e.g&&e.g.resolve(),e.g=null)},r.Ig=function(e){B.debug("PatchedMediaKeysWebkit.onWebkitKeyError_",e);var t=Dc(this,e.sessionId);t&&t.handleError(e)},F(Mc,We),(r=Mc.prototype).handleError=function(e){B.debug("PatchedMediaKeysWebkit.MediaKeySession.handleError",e);var t=Error("EME v0.1b key error"),n=e.errorCode;n.systemCode=e.systemCode,t.errorCode=n,!e.sessionId&&this.h?(45==e.systemCode&&(t.message="Unsupported session type."),this.h.reject(t),this.h=null):e.sessionId&&this.g?(this.g.reject(t),this.g=null):(t=e.systemCode,e.errorCode.code==MediaKeyError.MEDIA_KEYERR_OUTPUT?Xc(this,"output-restricted"):Xc(this,1==t?"expired":"internal-error"))},r.Qd=function(e,t){if(this.g)this.g.then(this.Qd.bind(this,e,t)).catch(this.Qd.bind(this,e,t));else{if(this.g=e,"webkit-org.w3.clearkey"==this.i){var n=ye(t),r=JSON.parse(n);"oct"!=r.keys[0].kty&&(this.g.reject(Error("Response is not a valid JSON Web Key Set.")),this.g=null),n=Se.Ja(r.keys[0].k),r=Se.Ja(r.keys[0].kid)}else n=new Uint8Array(t),r=null;var i=Ic("addKey");try{this.j[i](this.i,n,r,this.sessionId)}catch(o){this.g.reject(o),this.g=null}}},r.generateRequest=function(e,t){return B.debug("PatchedMediaKeysWebkit.MediaKeySession.generateRequest"),Vc(this,t,null)},r.load=function(e){return B.debug("PatchedMediaKeysWebkit.MediaKeySession.load"),"persistent-license"==this.l?Vc(this,null,e):Promise.reject(Error("Not a persistent session."))},r.update=function(e){B.debug("PatchedMediaKeysWebkit.MediaKeySession.update",e);var t=new me;return this.Qd(t,e),t},r.close=function(){if(B.debug("PatchedMediaKeysWebkit.MediaKeySession.close"),"persistent-license"!=this.l){if(!this.sessionId)return this.closed.reject(Error("The session is not callable.")),this.closed;var e=Ic("cancelKeyRequest");try{this.j[e](this.i,this.sessionId)}catch(t){}}return this.closed.resolve(),this.closed},r.remove=function(){return B.debug("PatchedMediaKeysWebkit.MediaKeySession.remove"),"persistent-license"!=this.l?Promise.reject(Error("Not a persistent session.")):this.close()},(r=Wc.prototype).forEach=function(e){this.g&&e(this.g,Ec)},r.get=function(e){if(this.has(e))return this.g},r.has=function(e){var t=Ec;return!(!this.g||!Se.Ha(new Uint8Array(e),new Uint8Array(t)))},r.entries=function(){},r.keys=function(){},r.values=function(){},tc((function(){if(!(!e.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration)){if(HTMLMediaElement.prototype.webkitGenerateKeyRequest)B.info("Using webkit-prefixed EME v0.1b"),Lc="webkit";else{if(!HTMLMediaElement.prototype.generateKeyRequest)return;B.info("Using nonprefixed EME v0.1b")}Ec=new Uint8Array([0]).buffer,navigator.requestMediaKeySystemAccess=Rc,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=Zc,e.MediaKeys=Pc,e.MediaKeySystemAccess=Cc}})),tc((function(){if(e.HTMLVideoElement){var t=HTMLVideoElement.prototype;t.requestPictureInPicture&&document.exitPictureInPicture||!t.webkitSupportsPresentationMode||(B.debug("PiPWebkit.install"),document.pictureInPictureEnabled=!0,document.pictureInPictureElement=null,t.requestPictureInPicture=Nc,Object.defineProperty(t,"disablePictureInPicture",{get:Fc,set:Yc,enumerable:!0,configurable:!0}),document.exitPictureInPicture=Uc,document.addEventListener("webkitpresentationmodechanged",Oc,!0))}})),tc((function(){if(B.debug("VideoPlayPromise.install"),e.HTMLMediaElement){var t=HTMLMediaElement.prototype.play;HTMLMediaElement.prototype.play=function(){var e=t.apply(this);return e&&e.catch((function(){})),e}}})),tc((function(){if(e.HTMLVideoElement){var t=HTMLVideoElement.prototype;!t.getVideoPlaybackQuality&&"webkitDroppedFrameCount"in t&&(t.getVideoPlaybackQuality=Kc)}})),tc((function(){if(e.VTTCue)B.info("Using native VTTCue.");else if(e.TextTrackCue){var t=TextTrackCue.length;if(3==t)B.info("Using VTTCue polyfill from 3 argument TextTrackCue."),e.VTTCue=jc;else if(6==t)B.info("Using VTTCue polyfill from 6 argument TextTrackCue."),e.VTTCue=Hc;else{try{var n=!!jc(1,2,"")}catch(r){n=!1}n&&(B.info("Using VTTCue polyfill from 3 argument TextTrackCue."),e.VTTCue=jc)}}else B.error("VTTCue not available.")})),U("shaka.text.TtmlTextParser",Bc),Bc.prototype.parseInit=function(){},Bc.prototype.parseInit=Bc.prototype.parseInit,Bc.prototype.parseMedia=function(e,t){var n=ye(e),r=[],i=new DOMParser,o=null;if(""==n)return r;try{o=i.parseFromString(n,"text/xml")}catch(A){throw new J(2,2,2005,"Failed to parse TTML.")}if(o){if(n=o.getElementsByTagName("parsererror")[0])throw new J(2,2,2005,n.textContent);if(!(i=o.getElementsByTagName("tt")[0]))throw new J(2,2,2005,"TTML does not contain <tt> tag.");var a=Kr.getAttributeNS(i,"http://www.w3.org/ns/ttml#parameter","frameRate"),s=Kr.getAttributeNS(i,"http://www.w3.org/ns/ttml#parameter","subFrameRate"),u=Kr.getAttributeNS(i,"http://www.w3.org/ns/ttml#parameter","frameRateMultiplier"),c=Kr.getAttributeNS(i,"http://www.w3.org/ns/ttml#parameter","tickRate");if(o=i.getAttribute("xml:space")||"default",n=Kr.getAttributeNS(i,"http://www.w3.org/ns/ttml#styling","extent"),"default"!=o&&"preserve"!=o)throw new J(2,2,2005,"Invalid xml:space value: "+o);o="default"==o,a=new Al(a,s,u,c),s=ul(i.getElementsByTagName("metadata")[0]),u=ul(i.getElementsByTagName("styling")[0]),c=ul(i.getElementsByTagName("layout")[0]);for(var l=[],d=0;d<c.length;d++){var f,p,m=c[d],y=u,v=n,g=new hn,b=m.getAttribute("xml:id");b?(g.id=b,b=null,v&&(b=Qc.exec(v)||$c.exec(v)),v=b?Number(b[1]):null,b=b?Number(b[2]):null,(f=pl(m,y,"extent"))&&null!=(f=(p=Qc.exec(f))||$c.exec(f))&&(g.width=null!=v?100*Number(f[1])/v:Number(f[1]),g.height=null!=b?100*Number(f[2])/b:Number(f[2]),g.widthUnits=p||null!=v?fn:0,g.heightUnits=p||null!=b?fn:0),(m=pl(m,y,"origin"))&&null!=(f=(p=Qc.exec(m))||$c.exec(m))&&(g.viewportAnchorX=null!=v?100*Number(f[1])/v:Number(f[1]),g.viewportAnchorY=null!=b?100*Number(f[2])/b:Number(f[2]),g.viewportAnchorUnits=p||null!=v?fn:0)):(B.v("TtmlTextParser parser encountered a region with no id. Region will be ignored."),g=null),g&&l.push(g)}for(n=cl(i.getElementsByTagName("body")[0]),i=(n=h(n)).next();!i.done;i=n.next())(i=dl(i.value,t.periodStart,a,s,u,c,l,o,!1))&&r.push(i)}return r},Bc.prototype.parseMedia=Bc.prototype.parseMedia;var Jc,zc,Qc=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,qc=/^(\d+px|\d+em)$/,$c=/^(\d+)px (\d+)px$/,el=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,tl=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,nl=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,rl=/^(\d*(?:\.\d*)?)f$/,il=/^(\d*(?:\.\d*)?)t$/,ol=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,al={left:sn,center:"center",right:"end",start:sn,end:"end"},sl={left:"line-left",center:"center",right:"line-right"};function ul(e){var t=[];if(!e)return t;for(var n=h(e.childNodes),r=n.next();!r.done;r=n.next())(r=r.value).nodeType==Node.ELEMENT_NODE&&"br"!==r.nodeName&&(r=ul(r),t=t.concat(r));return t.length||t.push(e),t}function cl(e){if(!e)return[];for(var t=[],n=(e=h(e.childNodes)).next();!n.done;n=e.next())(n=n.value)instanceof Element&&(n.hasAttribute("begin")?t.push(n):t=t.concat(cl(n)));return t}function ll(e,t){for(var n="",r=h(e.childNodes),i=r.next();!i.done;i=r.next())"br"==(i=i.value).nodeName&&e.childNodes[0]!==i?n+="\n":i.childNodes&&0<i.childNodes.length?n+=ll(i,t):n+=t?i=(i=i.textContent.trim()).replace(/\s+/g," "):i.textContent;return n}function dl(e,t,n,r,i,o,a,s,u){if(u&&"br"==e.nodeName)return(e=new Qt(0,0,"")).spacer=!0,e;var c=/^[\s\n]*$/.test(e.textContent),l=e.nodeType==Node.ELEMENT_NODE&&!e.hasAttribute("begin")&&!e.hasAttribute("end");if(e.nodeType!=Node.ELEMENT_NODE||l&&c||l&&!u)return null;s="default"==(e.getAttribute("xml:space")||(s?"default":"preserve")),c=gl(e.getAttribute("begin"),n),l=gl(e.getAttribute("end"),n);var d=gl(e.getAttribute("dur"),n);if(null==l&&null!=d&&(l=c+d),!u&&(null==c||null==l))throw new J(2,2,2001);if(c=u&&null==c?0:c+t,l=u&&null==l?0:l+t,d="",u=[],Array.from(e.childNodes).find((function(e){return e.nodeType===Node.TEXT_NODE&&/\S+/.test(e.textContent)})))d=ll(e,s);else for(var f=h(e.childNodes),p=f.next();!p.done;p=f.next())(p=dl(p.value,t,n,r,i,o,a,s,!0))&&(p.startTime=p.startTime||c,p.endTime=p.endTime||l,u.push(p));if((t=new Qt(c,l,d)).nestedCues=u,(o=vl(e,"region",o,"")[0])&&o.getAttribute("xml:id")){var m=o.getAttribute("xml:id");t.region=a.filter((function(e){return e.id==m}))[0]}return function(e,t,n,r,i){"rtl"==fl(t,n,i,"direction")&&(e.direction="rtl");var o=fl(t,n,i,"writingMode");if("tb"==o||"tblr"==o?e.writingMode="vertical-lr":"tbrl"==o?e.writingMode="vertical-rl":"rltb"==o||"rl"==o?e.direction="rtl":o&&(e.direction=rn),(o=fl(t,n,i,"textAlign"))?(e.positionAlign=sl[o],e.lineAlign=al[o],e.textAlign=en[o.toUpperCase()]):e.textAlign="start",(o=fl(t,n,i,"displayAlign"))&&(e.displayAlign=nn[o.toUpperCase()]),(o=fl(t,n,i,"color"))&&(e.color=o),(o=fl(t,n,i,"backgroundColor"))&&(e.backgroundColor=o),(o=fl(t,n,i,"fontFamily"))&&(e.fontFamily=o),(o=fl(t,n,i,"fontWeight"))&&"bold"==o&&(e.fontWeight=700),(o=fl(t,n,i,"wrapOption"))&&"noWrap"==o&&(e.wrapLine=!1),(o=fl(t,n,i,"lineHeight"))&&o.match(qc)&&(e.lineHeight=o),(o=fl(t,n,i,"fontSize"))&&o.match(qc)&&(e.fontSize=o),(o=fl(t,n,i,"fontStyle"))&&(e.fontStyle=dn[o.toUpperCase()]),r){o=r.getAttribute("imageType")||r.getAttribute("imagetype");var a=r.getAttribute("encoding");r=r.textContent.trim(),"PNG"==o&&"Base64"==a&&r&&(e.backgroundImage="data:image/png;base64,"+r)}(n=pl(n,i,"textDecoration"))&&hl(e,n),(t=ml(t,i,"textDecoration"))&&hl(e,t)}(t,e,o,r=vl(e,"backgroundImage",r,"#","http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt")[0],i),t}function hl(e,t){for(var n=t.split(" "),r=0;r<n.length;r++)switch(n[r]){case"underline":e.textDecoration.includes("underline")||e.textDecoration.push("underline");break;case"noUnderline":e.textDecoration.includes("underline")&&Ue(e.textDecoration,"underline");break;case"lineThrough":e.textDecoration.includes("lineThrough")||e.textDecoration.push("lineThrough");break;case"noLineThrough":e.textDecoration.includes("lineThrough")&&Ue(e.textDecoration,"lineThrough");break;case"overline":e.textDecoration.includes("overline")||e.textDecoration.push("overline");break;case"noOverline":e.textDecoration.includes("overline")&&Ue(e.textDecoration,"overline")}}function fl(e,t,n,r){return(e=ml(e,n,r))?e:pl(t,n,r)}function pl(e,t,n){if(!e)return null;for(var r=ul(e),i=0;i<r.length;i++){var o=Kr.getAttributeNS(r[i],"http://www.w3.org/ns/ttml#styling",n);if(o)return o}return yl(e,t,n)}function ml(e,t,n){var r=Kr.getAttributeNS(e,"http://www.w3.org/ns/ttml#styling",n);return r||yl(e,t,n)}function yl(e,t,n){e=vl(e,"style",t,"");for(var r=null,i=0;i<e.length;i++){var o=Kr.getAttributeNS(e[i],"http://www.w3.org/ns/ttml#styling",n);o||(o=ml(e[i],t,n)),o&&(r=o)}return r}function vl(e,t,n,r,i){var o=[];if(!e||1>n.length)return o;var a=e;for(e=null;a&&!(e=i?Kr.getAttributeNS(a,i,t):a.getAttribute(t))&&(a=a.parentNode)instanceof Element;);if(t=e)for(i=(t=h(t=t.split(" "))).next();!i.done;i=t.next())for(i=i.value,a=(e=h(n)).next();!a.done;a=e.next())if(r+(a=a.value).getAttribute("xml:id")==i){o.push(a);break}return o}function gl(e,t){var n=null;if(el.test(e)){n=el.exec(e);var r=Number(n[1]),i=Number(n[2]),o=Number(n[3]),a=Number(n[4]);n=(o+=(a+=(Number(n[5])||0)/t.h)/t.frameRate)+60*i+3600*r}else tl.test(e)?n=bl(tl,e):nl.test(e)?n=bl(nl,e):rl.test(e)?(n=rl.exec(e),n=Number(n[1])/t.frameRate):il.test(e)?(n=il.exec(e),n=Number(n[1])/t.g):ol.test(e)&&(n=bl(ol,e));return n}function bl(e,t){var n=e.exec(t);return null==n||""==n[0]?null:(Number(n[4])||0)/1e3+(Number(n[3])||0)+60*(Number(n[2])||0)+3600*(Number(n[1])||0)}function Al(e,t,n,r){this.frameRate=Number(e)||30,this.h=Number(t)||1,this.g=Number(r),0==this.g&&(this.g=e?this.frameRate*this.h:1),n&&(e=/^(\d+) (\d+)$/g.exec(n))&&(this.frameRate*=Number(e[1])/Number(e[2]))}function _l(){this.g=new Bc}function wl(){}function Sl(e,t,n){var r;if(r=/^align:(start|middle|center|end|left|right)$/.exec(t))t=r[1],e.textAlign="middle"==t?$t:en[t.toUpperCase()];else if(r=/^vertical:(lr|rl)$/.exec(t))e.writingMode="lr"==r[1]?"vertical-lr":"vertical-rl";else if(r=/^size:([\d.]+)%$/.exec(t))e.size=Number(r[1]);else if(r=/^position:([\d.]+)%(?:,(line-left|line-right|center|start|end))?$/.exec(t))e.position=Number(r[1]),r[2]&&(t=r[2],e.positionAlign="line-left"==t||"start"==t?"line-left":"line-right"==t||"end"==t?"line-right":"center");else{if(!(r=/^region:(.*)$/.exec(t))){e:{if(n=/^line:([\d.]+)%(?:,(start|end|center))?$/.exec(t))e.lineInterpretation=1,e.line=Number(n[1]),n[2]&&(e.lineAlign=un[n[2].toUpperCase()]);else{if(!(n=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(t))){e=!1;break e}e.lineInterpretation=an,e.line=Number(n[1]),n[2]&&(e.lineAlign=un[n[2].toUpperCase()])}e=!0}return e}(t=function(e,t){var n=e.filter((function(e){return e.id==t}));return n.length?n[0]:(B.v("VTT parser could not find a region with id: ",t," The region will be ignored."),null)}(n,r[1]))&&(e.region=t)}return!0}function kl(e){if(null==(e=Ni(e,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3})/g)))return null;var t=Number(e[2]),n=Number(e[3]);return 59<t||59<n?null:Number(e[4])/1e3+n+60*t+3600*(Number(e[1])||0)}function Tl(){this.g=null}function xl(e,t,n){var r,i,o;return(new Vr).box("payl",Or((function(e){r=ye(e)}))).box("iden",Or((function(e){i=ye(e)}))).box("sttg",Or((function(e){o=ye(e)}))).parse(e),r?function(e,t,n,r,i){if(e=new Qt(r,i,e),t&&(e.id=t),n)for(t=new Wi(n),n=Ui(t);n;)Sl(e,n,[])||B.v("VTT parser encountered an invalid VTT setting: ",n," The setting will be ignored."),Oi(t),n=Ui(t);return e}(r,i,o,t,n):null}function El(){}function Ll(){Jc?console.debug("EmeEncryptionSchemePolyfill: Already installed."):navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration?(Jc=navigator.requestMediaKeySystemAccess,console.debug("EmeEncryptionSchemePolyfill: Waiting to detect encryptionScheme support."),navigator.requestMediaKeySystemAccess=Il):console.debug("EmeEncryptionSchemePolyfill: EME not found")}function Il(e,t){var n=this;return p((function r(){var i;return M(r,(function(r){switch(r.s){case 1:return console.assert(n==navigator,'bad "this" for requestMediaKeySystemAccess'),k(r,Jc.call(n,e,t),2);case 2:return Xl(i=r.B)?(console.debug("EmeEncryptionSchemePolyfill: Native encryptionScheme support found."),navigator.requestMediaKeySystemAccess=Jc,r.return(i)):(console.debug("EmeEncryptionSchemePolyfill: No native encryptionScheme support found. Patching encryptionScheme support."),navigator.requestMediaKeySystemAccess=Rl,r.return(Rl.call(n,e,t)))}}))}))}function Rl(e,t){var n=this;return p((function r(){var i,o,a,s,u,c,l,d;return M(r,(function(r){switch(r.s){case 1:console.assert(n==navigator,'bad "this" for requestMediaKeySystemAccess'),i=Vl(e),o=[];for(var f=h(t),p=f.next();!p.done;p=f.next())a=p.value,s=Zl(a.videoCapabilities,i),u=Zl(a.audioCapabilities,i),a.videoCapabilities&&a.videoCapabilities.length&&!s.length||a.audioCapabilities&&a.audioCapabilities.length&&!u.length||((c=Object.assign({},a)).videoCapabilities=s,c.audioCapabilities=u,o.push(c));if(!o.length)throw(l=Error("Unsupported keySystem or supportedConfigurations.")).name="NotSupportedError",l.code=DOMException.NOT_SUPPORTED_ERR,l;return k(r,Jc.call(n,e,o),2);case 2:return d=r.B,r.return(new Ml(d,i))}}))}))}function Zl(e,t){return e?e.filter((function(e){return!e.encryptionScheme||e.encryptionScheme==t})):e}function Cl(){}function Pl(){zc?console.debug("McEncryptionSchemePolyfill: Already installed."):navigator.mediaCapabilities?(zc=navigator.mediaCapabilities.decodingInfo,console.debug("McEncryptionSchemePolyfill: Waiting to detect encryptionScheme support."),navigator.mediaCapabilities.decodingInfo=Gl):console.debug("McEncryptionSchemePolyfill: MediaCapabilities not found")}function Gl(e){var t=this;return p((function n(){var r,i;return M(n,(function(n){switch(n.s){case 1:return console.assert(t==navigator.mediaCapabilities,'bad "this" for decodingInfo'),k(n,zc.call(t,e),2);case 2:return r=n.B,e.keySystemConfiguration?(i=r.keySystemAccess)&&Xl(i)?(console.debug("McEncryptionSchemePolyfill: Native encryptionScheme support found."),navigator.mediaCapabilities.decodingInfo=zc,n.return(r)):(console.debug("McEncryptionSchemePolyfill: No native encryptionScheme support found. Patching encryptionScheme support."),navigator.mediaCapabilities.decodingInfo=Dl,n.return(Dl.call(t,e))):n.return(r)}}))}))}function Dl(e){var t=this;return p((function n(){var r,i,o,a,s,u,c,l,d;return M(n,(function(n){switch(n.s){case 1:return console.assert(t==navigator.mediaCapabilities,'bad "this" for decodingInfo'),r=null,e.keySystemConfiguration&&(i=e.keySystemConfiguration,o=i.keySystem,a=i.audio&&i.audio.encryptionScheme,s=i.video&&i.video.encryptionScheme,r=Vl(o),u={powerEfficient:!1,smooth:!1,supported:!1,keySystemAccess:null,configuration:e},a&&a!=r||s&&s!=r)?n.return(u):k(n,zc.call(t,e),2);case 2:if((c=n.B).keySystemAccess){c.keySystemAccess=new Ml(c.keySystemAccess,r),n.I(3);break}if(!e.keySystemConfiguration){n.I(3);break}var h=e.keySystemConfiguration,f=[],p=[];return h.audio&&f.push({robustness:h.audio.robustness||"",contentType:e.audio.contentType}),h.video&&p.push({robustness:h.video.robustness||"",contentType:e.video.contentType}),h={initDataTypes:h.initDataType?[h.initDataType]:[],distinctiveIdentifier:h.distinctiveIdentifier,persistentState:h.persistentState,sessionTypes:h.sessionTypes},f.length&&(h.audioCapabilities=f),p.length&&(h.videoCapabilities=p),l=h,d=c,k(n,navigator.requestMediaKeySystemAccess(e.keySystemConfiguration.keySystem,[l]),5);case 5:d.keySystemAccess=n.B;case 3:return n.return(c)}}))}))}function Ml(e,t){this.h=e,this.g=t,this.keySystem=e.keySystem}function Vl(e){return e.startsWith("com.widevine")||e.startsWith("com.microsoft")||e.startsWith("com.adobe")||e.startsWith("org.w3")?"cenc":e.startsWith("com.apple")?"cbcs-1-9":(console.warn("EmeEncryptionSchemePolyfill: Unknown key system:",e,"Please contribute!"),null)}function Xl(e){var t=(e=e.getConfiguration()).audioCapabilities&&e.audioCapabilities[0];return!(!(e=e.videoCapabilities&&e.videoCapabilities[0]||t)||void 0===e.encryptionScheme)}function Wl(){}function Ol(){Ll(),Pl()}yn["application/ttml+xml"]=Bc,U("shaka.text.Mp4TtmlParser",_l),_l.prototype.parseInit=function(e){var t=!1;if((new Vr).box("moov",Xr).box("trak",Xr).box("mdia",Xr).box("minf",Xr).box("stbl",Xr).ma("stsd",Wr).box("stpp",(function(e){t=!0,e.parser.stop()})).parse(e),!t)throw new J(2,2,2007)},_l.prototype.parseInit=_l.prototype.parseInit,_l.prototype.parseMedia=function(e,t){var n=!1,r=[];if((new Vr).box("mdat",Or(function(e){n=!0,r=r.concat(this.g.parseMedia(e,t))}.bind(this))).parse(e),!n)throw new J(2,2,2007);return r},_l.prototype.parseMedia=_l.prototype.parseMedia,yn['application/mp4; codecs="stpp"']=_l,yn['application/mp4; codecs="stpp.ttml.im1t"']=_l,yn['application/mp4; codecs="stpp.TTML.im1t"']=_l,U("shaka.text.VttTextParser",wl),wl.prototype.parseInit=function(){},wl.prototype.parseInit=wl.prototype.parseInit,wl.prototype.parseMedia=function(e,t){var n=ye(e);if(n=(n=n.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n")).split(/\n{2,}/m),!/^WEBVTT($|[ \t\n])/m.test(n[0]))throw new J(2,2,2e3);var r=t.segmentStart;if(null==r&&(r=0,n[0].includes("X-TIMESTAMP-MAP"))){var i=n[0].match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),o=n[0].match(/MPEGTS:(\d+)/m);if(i&&o){if(null==(r=kl(new Wi(i[1]))))throw new J(2,2,2e3);r=t.periodStart+(Number(o[1])/9e4-r)}}o=[];var a=n[0].split("\n");for(i=1;i<a.length;i++)if(/^Region:/.test(a[i])){var s=new Wi(a[i]),u=new hn;Ui(s),Oi(s);for(var c=Ui(s);c;){var l;e:{var d=u,h=c;if(l=/^id=(.*)$/.exec(h))d.id=l[1];else if(l=/^width=(\d{1,2}|100)%$/.exec(h))d.width=Number(l[1]);else if(l=/^lines=(\d+)$/.exec(h))d.height=Number(l[1]),d.heightUnits=2;else if(l=/^regionanchor=(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(h))d.regionAnchorX=Number(l[1]),d.regionAnchorY=Number(l[2]);else if(l=/^viewportanchor=(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(h))d.viewportAnchorX=Number(l[1]),d.viewportAnchorY=Number(l[2]);else{if(!/^scroll=up$/.exec(h)){l=!1;break e}d.scroll="up"}l=!0}l||B.v("VTT parser encountered an invalid VTTRegion setting: ",c," The setting will be ignored."),Oi(s),c=Ui(s)}o.push(u)}for(i=[],s=1;s<n.length;s++){if(l=a=n[s].split("\n"),d=r,a=o,1==l.length&&!l[0]||/^NOTE($|[ \t])/.test(l[0])||"STYLE"==l[0])a=null;else{u=null,l[0].includes("--\x3e")||(u=l[0],l.splice(0,1)),h=kl(c=new Wi(l[0]));var f=Ni(c,/[ \t]+--\x3e[ \t]+/g),p=kl(c);if(null==h||null==f||null==p)throw new J(2,2,2001);for(l=new Qt(h+d,p+d,l.slice(1).join("\n").trim()),Oi(c),d=Ui(c);d;)Sl(l,d,a)||B.v("VTT parser encountered an invalid VTT setting: ",d," The setting will be ignored."),Oi(c),d=Ui(c);null!=u&&(l.id=u),a=l}a&&i.push(a)}return i},wl.prototype.parseMedia=wl.prototype.parseMedia,yn["text/vtt"]=wl,yn['text/vtt; codecs="vtt"']=wl,yn['text/vtt; codecs="wvtt"']=wl,U("shaka.text.Mp4VttParser",Tl),Tl.prototype.parseInit=function(e){var t=!1;if((new Vr).box("moov",Xr).box("trak",Xr).box("mdia",Xr).ma("mdhd",function(e){0==e.version?(e.reader.U(4),e.reader.U(4),this.g=e.reader.N(),e.reader.U(4)):(e.reader.U(8),e.reader.U(8),this.g=e.reader.N(),e.reader.U(8)),e.reader.U(4)}.bind(this)).box("minf",Xr).box("stbl",Xr).ma("stsd",Wr).box("wvtt",(function(){t=!0})).parse(e),!this.g)throw new J(2,2,2008);if(!t)throw new J(2,2,2008)},Tl.prototype.parseInit=Tl.prototype.parseInit,Tl.prototype.parseMedia=function(e,t){var n=this;if(!this.g)throw B.error("No init segment for MP4+VTT!"),new J(2,2,2008);var r,i=0,o=[],a=[],s=!1,u=!1,c=!1,l=null;if((new Vr).box("moof",Xr).box("traf",Xr).ma("tfdt",(function(e){s=!0,i=0==e.version?e.reader.N():e.reader.Pb()})).ma("tfhd",(function(e){var t=e.flags;(e=e.reader).U(4),1&t&&e.U(8),2&t&&e.U(4),l=8&t?e.N():null})).ma("trun",(function(e){u=!0;var t=e.version,n=e.flags,r=(e=e.reader).N();1&n&&e.U(4),4&n&&e.U(4);for(var i=[],a=0;a<r;a++){var s={duration:null,sampleSize:null,Sd:null};256&n&&(s.duration=e.N()),512&n&&(s.sampleSize=e.N()),1024&n&&e.U(4),2048&n&&(s.Sd=0==t?e.N():e.De()),i.push(s)}o=i})).box("mdat",Or((function(e){c=!0,r=e}))).parse(e),!c&&!s&&!u)throw new J(2,2,2008);var d=i,h=new Gr(new DataView(r.buffer,r.byteOffset,r.byteLength),0);return o.forEach((function(e){var r=e.duration||l,o=e.Sd?i+e.Sd:d;d=o+(r||0);var s=0;do{var u=h.N();s+=u;var c=h.N(),f=null;"vttc"==(c=Ur(c))?8<u&&(f=h.mb(u-8)):("vtte"!=c&&B.error("Unknown box "+c+"! Skipping!"),h.U(u-8)),r?f&&a.push(xl(f,t.periodStart+o/n.g,t.periodStart+d/n.g)):B.error("WVTT sample duration unknown, and no default found!")}while(e.sampleSize&&s<e.sampleSize)})),a.filter(le.Ra)},Tl.prototype.parseMedia=Tl.prototype.parseMedia,yn['application/mp4; codecs="wvtt"']=Tl,U("shaka.util.Dom.createHTMLElement",(function(e){return document.createElement(e)})),U("shaka.util.Dom.createVideoElement",(function(){var e=document.createElement("video");return e.muted=!0,e.width=600,e.height=400,e})),U("shaka.util.Dom.asHTMLElement",(function(e){return e})),U("shaka.util.Dom.asHTMLMediaElement",(function(e){return e})),U("shaka.util.Dom.removeAllChildren",(function(e){for(;e.firstChild;)e.removeChild(e.firstChild)})),U("EmeEncryptionSchemePolyfill",El),El.install=Ll,U("McEncryptionSchemePolyfill",Cl),Cl.install=Pl,Ml.prototype.getConfiguration=function(){var e=this.h.getConfiguration();if(e.videoCapabilities)for(var t=h(e.videoCapabilities),n=t.next();!n.done;n=t.next())n.value.encryptionScheme=this.g;if(e.audioCapabilities)for(n=(t=h(e.audioCapabilities)).next();!n.done;n=t.next())n.value.encryptionScheme=this.g;return e},Ml.prototype.createMediaKeys=function(){return this.h.createMediaKeys()},U("EncryptionSchemePolyfills",Wl),Wl.install=Ol,void 0!==n&&n.gf&&(n.gf=Wl)}.call(t,e,e,void 0),t.shaka)Aye[n]=t.shaka[n]}();var wye=Z(_ye);VePlayer.register([gi,ya,ul,tK,oK]),e.mp4=bye,e.shaka=class extends ne{constructor(e){super(e),r(this,"onAdaptation_",(()=>{this.shakaplayer.getVariantTracks().forEach((function(e){if(e.active)for(let t=0;t<this.content.length;++t){const n=this.content[t];n.value===e.id?n.selected=!0:n.selected=!1}}))})),wye.polyfill.installAll()}static get pluginName(){return"ShakaPlugin"}static get defaultConfig(){return{shakaOpts:{}}}static isSupported(){return wye.Player.isBrowserSupported()}afterCreate(){this.content=[],this.url=this.player.config.url,wye.Player.isBrowserSupported()&&this.on(J,(e=>{/^blob/.test(e)||(this.url=e,this.loadUrl(e))}))}beforePlayerInit(){if(!wye.Player.isBrowserSupported())throw new Error("Browser not supported!");this._initShaka()}destroy(){this.shakaplayer&&(this.shakaplayer.destroy(),this.shakaplayer=null)}_initShaka(){const{player:e}=this;this.shakaplayer=new wye.Player(e.video),this.shakaplayer.addEventListener("error",(e=>{console.error("Error code",e.detail.code,"object",e.detail)})),this.config.shakaOpts&&this.shakaplayer.configure(this.config.shakaOpts),this.shakaplayer.getNetworkingEngine().registerRequestFilter(((e,t)=>{e===wye.net.NetworkingEngine.RequestType.LICENSE&&(t.headers["CWIP-Auth-Header"]="VGhpc0lzQVRlc3QK")})),this.shakaplayer.addEventListener("adaptation",this.onAdaptation_);this.shakaplayer.configure({abr:{enabled:!1}}),this.loadUrl(this.url)}loadUrl(e){this.shakaplayer.load(e).then((()=>{console.log(" this.onTracksChanged_"),this.onTracksChanged_()})).catch((e=>{console.trace("event",e),console.error("Error code",e.detail.code,"object",e.detail)}))}onTracksChanged_(){this.updateVariantTracks_()}updateVariantTracks_(){const e=this.shakaplayer.getVariantTracks();e.sort((function(e,t){return e.bandwidth-t.bandwidth})),this.updateTrackOptions_(e)}updateTrackOptions_(e){const t={variant:function(e){let t="";return e.width&&e.height&&(t+=e.height+"P"),t}};this.content=[],e.forEach((e=>{const n={};n.textContent=t[e.type](e),n.track=e,n.value=e.id,n.selected=e.active,this.content.push(n)})),this.updateDefinition()}updateDefinition(){"mobile"!==F.device&&console.log("updateDefinition",this.content)}}}));
|