@volcengine/veplayer-plugin 2.0.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/README.md +1 -0
- package/esm/flv.d.ts +3 -0
- package/esm/hls.d.ts +3 -0
- package/esm/index.d.ts +6 -0
- package/esm/index.development.css +63 -0
- package/esm/index.development.js +83150 -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.flv.development.js +17622 -0
- package/esm/veplayer.plugin.flv.production.js +2 -0
- package/esm/veplayer.plugin.hls.development.js +21398 -0
- package/esm/veplayer.plugin.hls.production.js +2 -0
- package/esm/veplayer.plugin.mp4.development.js +33148 -0
- package/esm/veplayer.plugin.mp4.production.js +2 -0
- package/esm/veplayer.plugin.rtm.development.js +5469 -0
- package/esm/veplayer.plugin.rtm.production.js +2 -0
- package/esm/veplayer.plugin.shaka.development.js +15890 -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 +19094 -0
- package/esm/veplayer.plugin.xgvideo.production.js +2 -0
- package/esm/xgvideo.d.ts +3 -0
- package/package.json +155 -0
- package/umd/flv.d.ts +3 -0
- package/umd/hls.d.ts +3 -0
- package/umd/index.d.ts +6 -0
- package/umd/index.development.js +82776 -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.flv.development.js +17625 -0
- package/umd/veplayer.plugin.flv.production.js +1 -0
- package/umd/veplayer.plugin.hls.development.js +21402 -0
- package/umd/veplayer.plugin.hls.production.js +1 -0
- package/umd/veplayer.plugin.mp4.development.js +33152 -0
- package/umd/veplayer.plugin.mp4.production.js +1 -0
- package/umd/veplayer.plugin.rtm.development.js +5473 -0
- package/umd/veplayer.plugin.rtm.production.js +1 -0
- package/umd/veplayer.plugin.shaka.development.js +15894 -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 +19098 -0
- package/umd/veplayer.plugin.xgvideo.production.js +1 -0
- package/umd/xgvideo.d.ts +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e=Object.defineProperty,t=(t,n,r)=>(((t,n,r)=>{n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r})(t,"symbol"!=typeof n?n+"":n,r),r);function n(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 r(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){l(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,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},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",u=a.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(Z){c=function(e,t,n){return e[t]=n}}function l(e,t,n,i){var a=t&&t.prototype instanceof f?t:f,o=Object.create(a.prototype),s=new x(i||[]);return r(o,"_invoke",{value:w(e,n,s)}),o}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(Z){return{type:"throw",arg:Z}}}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,a,o,s){var u=d(e[r],e,a);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,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(l).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function w(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=S(o,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 a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):a:(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,a){void 0===a&&(a=Promise);var o=new _(l(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.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 o.type="throw",o.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 a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.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 a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(o)},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 a(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(c){return void n(c)}s.done?t(u):Promise.resolve(u).then(r,i)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){a(o,r,i,s,u,"next",e)}function u(e){a(o,r,i,s,u,"throw",e)}s(void 0)}))}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(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,y(r.key),r)}}function c(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t,n){return(t=y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(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&&f(e,t)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(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=h(e);if(t){var i=h(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 p(e)}(this,n)}}function y(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 v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function g(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var b=function(e){return e&&e.Math==Math&&e},A=b("object"==typeof globalThis&&globalThis)||b("object"==typeof window&&window)||b("object"==typeof self&&self)||b("object"==typeof v&&v)||function(){return this}()||Function("return this")(),_={},w=function(e){try{return!!e()}catch(t){return!0}},S=!w((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),k=!w((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),T=k,x=Function.prototype.call,E=T?x.bind(x):function(){return x.apply(x,arguments)},L={},Z={}.propertyIsEnumerable,I=Object.getOwnPropertyDescriptor,R=I&&!Z.call({1:2},1);L.f=R?function(e){var t=I(this,e);return!!t&&t.enumerable}:Z;var C,G,P=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},X=k,V=Function.prototype,D=V.call,M=X&&V.bind.bind(D,D),W=X?M:function(e){return function(){return D.apply(e,arguments)}},N=W,O=N({}.toString),U=N("".slice),F=function(e){return U(O(e),8,-1)},Y=w,K=F,H=Object,j=W("".split),B=Y((function(){return!H("z").propertyIsEnumerable(0)}))?function(e){return"String"==K(e)?j(e,""):H(e)}:H,J=function(e){return null==e},z=J,Q=TypeError,q=function(e){if(z(e))throw Q("Can't call method on "+e);return e},$=B,ee=q,te=function(e){return $(ee(e))},ne="object"==typeof document&&document.all,re={all:ne,IS_HTMLDDA:void 0===ne&&void 0!==ne},ie=re.all,ae=re.IS_HTMLDDA?function(e){return"function"==typeof e||e===ie}:function(e){return"function"==typeof e},oe=ae,se=re.all,ue=re.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:oe(e)||e===se}:function(e){return"object"==typeof e?null!==e:oe(e)},ce=A,le=ae,de=function(e,t){return arguments.length<2?(n=ce[e],le(n)?n:void 0):ce[e]&&ce[e][t];var n},he=W({}.isPrototypeOf),fe=de("navigator","userAgent")||"",pe=A,me=fe,ye=pe.process,ve=pe.Deno,ge=ye&&ye.versions||ve&&ve.version,be=ge&&ge.v8;be&&(G=(C=be.split("."))[0]>0&&C[0]<4?1:+(C[0]+C[1])),!G&&me&&(!(C=me.match(/Edge\/(\d+)/))||C[1]>=74)&&(C=me.match(/Chrome\/(\d+)/))&&(G=+C[1]);var Ae=G,_e=Ae,we=w,Se=!!Object.getOwnPropertySymbols&&!we((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&_e&&_e<41})),ke=Se&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Te=de,xe=ae,Ee=he,Le=Object,Ze=ke?function(e){return"symbol"==typeof e}:function(e){var t=Te("Symbol");return xe(t)&&Ee(t.prototype,Le(e))},Ie=String,Re=function(e){try{return Ie(e)}catch(t){return"Object"}},Ce=ae,Ge=Re,Pe=TypeError,Xe=function(e){if(Ce(e))return e;throw Pe(Ge(e)+" is not a function")},Ve=Xe,De=J,Me=function(e,t){var n=e[t];return De(n)?void 0:Ve(n)},We=E,Ne=ae,Oe=ue,Ue=TypeError,Fe={exports:{}},Ye=A,Ke=Object.defineProperty,He=function(e,t){try{Ke(Ye,e,{value:t,configurable:!0,writable:!0})}catch(n){Ye[e]=t}return t},je=He,Be="__core-js_shared__",Je=A[Be]||je(Be,{}),ze=Je;(Fe.exports=function(e,t){return ze[e]||(ze[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 Qe=Fe.exports,qe=q,$e=Object,et=function(e){return $e(qe(e))},tt=et,nt=W({}.hasOwnProperty),rt=Object.hasOwn||function(e,t){return nt(tt(e),t)},it=W,at=0,ot=Math.random(),st=it(1..toString),ut=function(e){return"Symbol("+(void 0===e?"":e)+")_"+st(++at+ot,36)},ct=A,lt=rt,dt=ut,ht=Se,ft=ke,pt=Qe("wks"),mt=ct.Symbol,yt=mt&&mt.for,vt=ft?mt:mt&&mt.withoutSetter||dt,gt=function(e){if(!lt(pt,e)||!ht&&"string"!=typeof pt[e]){var t="Symbol."+e;ht&<(mt,e)?pt[e]=mt[e]:pt[e]=ft&&yt?yt(t):vt(t)}return pt[e]},bt=E,At=ue,_t=Ze,wt=Me,St=function(e,t){var n,r;if("string"===t&&Ne(n=e.toString)&&!Oe(r=We(n,e)))return r;if(Ne(n=e.valueOf)&&!Oe(r=We(n,e)))return r;if("string"!==t&&Ne(n=e.toString)&&!Oe(r=We(n,e)))return r;throw Ue("Can't convert object to primitive value")},kt=TypeError,Tt=gt("toPrimitive"),xt=function(e,t){if(!At(e)||_t(e))return e;var n,r=wt(e,Tt);if(r){if(void 0===t&&(t="default"),n=bt(r,e,t),!At(n)||_t(n))return n;throw kt("Can't convert object to primitive value")}return void 0===t&&(t="number"),St(e,t)},Et=xt,Lt=Ze,Zt=function(e){var t=Et(e,"string");return Lt(t)?t:t+""},It=ue,Rt=A.document,Ct=It(Rt)&&It(Rt.createElement),Gt=function(e){return Ct?Rt.createElement(e):{}},Pt=Gt,Xt=!S&&!w((function(){return 7!=Object.defineProperty(Pt("div"),"a",{get:function(){return 7}}).a})),Vt=S,Dt=E,Mt=L,Wt=P,Nt=te,Ot=Zt,Ut=rt,Ft=Xt,Yt=Object.getOwnPropertyDescriptor;_.f=Vt?Yt:function(e,t){if(e=Nt(e),t=Ot(t),Ft)try{return Yt(e,t)}catch(n){}if(Ut(e,t))return Wt(!Dt(Mt.f,e,t),e[t])};var Kt={},Ht=S&&w((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),jt=ue,Bt=String,Jt=TypeError,zt=function(e){if(jt(e))return e;throw Jt(Bt(e)+" is not an object")},Qt=S,qt=Xt,$t=Ht,en=zt,tn=Zt,nn=TypeError,rn=Object.defineProperty,an=Object.getOwnPropertyDescriptor,on="enumerable",sn="configurable",un="writable";Kt.f=Qt?$t?function(e,t,n){if(en(e),t=tn(t),en(n),"function"==typeof e&&"prototype"===t&&"value"in n&&un in n&&!n[un]){var r=an(e,t);r&&r[un]&&(e[t]=n.value,n={configurable:sn in n?n[sn]:r[sn],enumerable:on in n?n[on]:r[on],writable:!1})}return rn(e,t,n)}:rn:function(e,t,n){if(en(e),t=tn(t),en(n),qt)try{return rn(e,t,n)}catch(r){}if("get"in n||"set"in n)throw nn("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var cn=Kt,ln=P,dn=S?function(e,t,n){return cn.f(e,t,ln(1,n))}:function(e,t,n){return e[t]=n,e},hn={exports:{}},fn=S,pn=rt,mn=Function.prototype,yn=fn&&Object.getOwnPropertyDescriptor,vn=pn(mn,"name"),gn={EXISTS:vn,PROPER:vn&&"something"===function(){}.name,CONFIGURABLE:vn&&(!fn||fn&&yn(mn,"name").configurable)},bn=ae,An=Je,_n=W(Function.toString);bn(An.inspectSource)||(An.inspectSource=function(e){return _n(e)});var wn,Sn,kn,Tn=An.inspectSource,xn=ae,En=A.WeakMap,Ln=xn(En)&&/native code/.test(String(En)),Zn=ut,In=Qe("keys"),Rn=function(e){return In[e]||(In[e]=Zn(e))},Cn={},Gn=Ln,Pn=A,Xn=ue,Vn=dn,Dn=rt,Mn=Je,Wn=Rn,Nn=Cn,On="Object already initialized",Un=Pn.TypeError,Fn=Pn.WeakMap;if(Gn||Mn.state){var Yn=Mn.state||(Mn.state=new Fn);Yn.get=Yn.get,Yn.has=Yn.has,Yn.set=Yn.set,wn=function(e,t){if(Yn.has(e))throw Un(On);return t.facade=e,Yn.set(e,t),t},Sn=function(e){return Yn.get(e)||{}},kn=function(e){return Yn.has(e)}}else{var Kn=Wn("state");Nn[Kn]=!0,wn=function(e,t){if(Dn(e,Kn))throw Un(On);return t.facade=e,Vn(e,Kn,t),t},Sn=function(e){return Dn(e,Kn)?e[Kn]:{}},kn=function(e){return Dn(e,Kn)}}var Hn={set:wn,get:Sn,has:kn,enforce:function(e){return kn(e)?Sn(e):wn(e,{})},getterFor:function(e){return function(t){var n;if(!Xn(t)||(n=Sn(t)).type!==e)throw Un("Incompatible receiver, "+e+" required");return n}}},jn=w,Bn=ae,Jn=rt,zn=S,Qn=gn.CONFIGURABLE,qn=Tn,$n=Hn.enforce,er=Hn.get,tr=Object.defineProperty,nr=zn&&!jn((function(){return 8!==tr((function(){}),"length",{value:8}).length})),rr=String(String).split("String"),ir=hn.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),(!Jn(e,"name")||Qn&&e.name!==t)&&(zn?tr(e,"name",{value:t,configurable:!0}):e.name=t),nr&&n&&Jn(n,"arity")&&e.length!==n.arity&&tr(e,"length",{value:n.arity});try{n&&Jn(n,"constructor")&&n.constructor?zn&&tr(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(i){}var r=$n(e);return Jn(r,"source")||(r.source=rr.join("string"==typeof t?t:"")),e};Function.prototype.toString=ir((function(){return Bn(this)&&er(this).source||qn(this)}),"toString");var ar=hn.exports,or=ae,sr=Kt,ur=ar,cr=He,lr=function(e,t,n,r){r||(r={});var i=r.enumerable,a=void 0!==r.name?r.name:t;if(or(n)&&ur(n,a,r),r.global)i?e[t]=n:cr(t,n);else{try{r.unsafe?e[t]&&(i=!0):delete e[t]}catch(o){}i?e[t]=n:sr.f(e,t,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return e},dr={},hr=Math.ceil,fr=Math.floor,pr=Math.trunc||function(e){var t=+e;return(t>0?fr:hr)(t)},mr=pr,yr=function(e){var t=+e;return t!=t||0===t?0:mr(t)},vr=yr,gr=Math.max,br=Math.min,Ar=function(e,t){var n=vr(e);return n<0?gr(n+t,0):br(n,t)},_r=yr,wr=Math.min,Sr=function(e){return e>0?wr(_r(e),9007199254740991):0},kr=Sr,Tr=function(e){return kr(e.length)},xr=te,Er=Ar,Lr=Tr,Zr=function(e){return function(t,n,r){var i,a=xr(t),o=Lr(a),s=Er(r,o);if(e&&n!=n){for(;o>s;)if((i=a[s++])!=i)return!0}else for(;o>s;s++)if((e||s in a)&&a[s]===n)return e||s||0;return!e&&-1}},Ir={includes:Zr(!0),indexOf:Zr(!1)},Rr=rt,Cr=te,Gr=Ir.indexOf,Pr=Cn,Xr=W([].push),Vr=function(e,t){var n,r=Cr(e),i=0,a=[];for(n in r)!Rr(Pr,n)&&Rr(r,n)&&Xr(a,n);for(;t.length>i;)Rr(r,n=t[i++])&&(~Gr(a,n)||Xr(a,n));return a},Dr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Mr=Vr,Wr=Dr.concat("length","prototype");dr.f=Object.getOwnPropertyNames||function(e){return Mr(e,Wr)};var Nr={};Nr.f=Object.getOwnPropertySymbols;var Or=de,Ur=dr,Fr=Nr,Yr=zt,Kr=W([].concat),Hr=Or("Reflect","ownKeys")||function(e){var t=Ur.f(Yr(e)),n=Fr.f;return n?Kr(t,n(e)):t},jr=rt,Br=Hr,Jr=_,zr=Kt,Qr=function(e,t,n){for(var r=Br(t),i=zr.f,a=Jr.f,o=0;o<r.length;o++){var s=r[o];jr(e,s)||n&&jr(n,s)||i(e,s,a(t,s))}},qr=w,$r=ae,ei=/#|\.prototype\./,ti=function(e,t){var n=ri[ni(e)];return n==ai||n!=ii&&($r(t)?qr(t):!!t)},ni=ti.normalize=function(e){return String(e).replace(ei,".").toLowerCase()},ri=ti.data={},ii=ti.NATIVE="N",ai=ti.POLYFILL="P",oi=ti,si=A,ui=_.f,ci=dn,li=lr,di=He,hi=Qr,fi=oi,pi=function(e,t){var n,r,i,a,o,s=e.target,u=e.global,c=e.stat;if(n=u?si:c?si[s]||di(s,{}):(si[s]||{}).prototype)for(r in t){if(a=t[r],i=e.dontCallGetSet?(o=ui(n,r))&&o.value:n[r],!fi(u?r:s+(c?".":"#")+r,e.forced)&&void 0!==i){if(typeof a==typeof i)continue;hi(a,i)}(e.sham||i&&i.sham)&&ci(a,"sham",!0),li(n,r,a,e)}},mi=F,yi=Array.isArray||function(e){return"Array"==mi(e)},vi=TypeError,gi=function(e){if(e>9007199254740991)throw vi("Maximum allowed index exceeded");return e},bi=Zt,Ai=Kt,_i=P,wi=function(e,t,n){var r=bi(t);r in e?Ai.f(e,r,_i(0,n)):e[r]=n},Si={};Si[gt("toStringTag")]="z";var ki="[object z]"===String(Si),Ti=ki,xi=ae,Ei=F,Li=gt("toStringTag"),Zi=Object,Ii="Arguments"==Ei(function(){return arguments}()),Ri=Ti?Ei: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(n){}}(t=Zi(e),Li))?n:Ii?Ei(t):"Object"==(r=Ei(t))&&xi(t.callee)?"Arguments":r},Ci=W,Gi=w,Pi=ae,Xi=Ri,Vi=Tn,Di=function(){},Mi=[],Wi=de("Reflect","construct"),Ni=/^\s*(?:class|function)\b/,Oi=Ci(Ni.exec),Ui=!Ni.exec(Di),Fi=function(e){if(!Pi(e))return!1;try{return Wi(Di,Mi,e),!0}catch(t){return!1}},Yi=function(e){if(!Pi(e))return!1;switch(Xi(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ui||!!Oi(Ni,Vi(e))}catch(t){return!0}};Yi.sham=!0;var Ki=!Wi||Gi((function(){var e;return Fi(Fi.call)||!Fi(Object)||!Fi((function(){e=!0}))||e}))?Yi:Fi,Hi=yi,ji=Ki,Bi=ue,Ji=gt("species"),zi=Array,Qi=function(e){var t;return Hi(e)&&(t=e.constructor,(ji(t)&&(t===zi||Hi(t.prototype))||Bi(t)&&null===(t=t[Ji]))&&(t=void 0)),void 0===t?zi:t},qi=function(e,t){return new(Qi(e))(0===t?0:t)},$i=w,ea=Ae,ta=gt("species"),na=function(e){return ea>=51||!$i((function(){var t=[];return(t.constructor={})[ta]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},ra=pi,ia=w,aa=yi,oa=ue,sa=et,ua=Tr,ca=gi,la=wi,da=qi,ha=na,fa=Ae,pa=gt("isConcatSpreadable"),ma=fa>=51||!ia((function(){var e=[];return e[pa]=!1,e.concat()[0]!==e})),ya=ha("concat"),va=function(e){if(!oa(e))return!1;var t=e[pa];return void 0!==t?!!t:aa(e)};function ga(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 ba(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ga(Object(n),!0).forEach((function(t){ka(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ga(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return 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){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wa(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,Ea(r.key),r)}}function Sa(e,t,n){return t&&wa(e.prototype,t),n&&wa(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ka(e,t,n){return(t=Ea(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ta(e){return function(e){if(Array.isArray(e))return xa(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 xa(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 xa(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 xa(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 Ea(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)}ra({target:"Array",proto:!0,arity:1,forced:!ma||!ya},{concat:function(e){var t,n,r,i,a,o=sa(this),s=da(o,0),u=0;for(t=-1,r=arguments.length;t<r;t++)if(va(a=-1===t?o:arguments[t]))for(i=ua(a),ca(u+i),n=0;n<i;n++,u++)n in a&&la(s,u,a[n]);else ca(u+1),la(s,u++,a);return s.length=u,s}});var La={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 a(e,t,r,a,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,a||e,o),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 o(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,a=r.length,o=new Array(a);i<a;i++)o[i]=r[i].fn;return o},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,a,o){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,a),!0;case 6:return l.fn.call(l.context,t,r,i,a,o),!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 a(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||i&&!s.once||r&&s.context!==r||o(this,a);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[a]=1===c.length?c[0]:c:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(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}(La);var Za=g(La.exports),Ia="undefined"!=typeof window&&window.location&&window.location.href.indexOf("xgplayerdebugger=1")>-1,Ra={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},Ca="%c[xgplayer]",Ga={config:{debug:Ia?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,[Ca,Ra.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,[Ca,Ra.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),a=1;a<r;a++)i[a-1]=arguments[a];(t=console)[n].apply(t,[Ca,Ra.error,e].concat(i))}}},Pa=function(){function e(t){_a(this,e),this.bufferedList=t}return Sa(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}(),Xa={};Xa.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,a=n[t];"video"===e||"audio"===e||"live-video"===e?a&&i.setAttribute(r,a):i.setAttribute(r,a)})),i},Xa.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&&Xa.addClass(i,n),t&&Object.keys(t).forEach((function(e){i.setAttribute(e,t[e])})),i):null}catch(a){return Ga.logError("util.createDomFromHtml",a),null}},Xa.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"===Aa(e.className)?e.getAttribute("class"):e.className;return n&&!!n.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},Xa.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){Xa.hasClass(e,t)||(e.className&&"object"===Aa(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},Xa.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){Xa.hasClass(e,t)&&t.split(/\s+/g).forEach((function(t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===Aa(e.className)?e.setAttribute("class",e.getAttribute("class").replace(n," ")):e.className=e.className.replace(n," ")}))}},Xa.toggleClass=function(e,t){e&&t.split(/\s+/g).forEach((function(t){Xa.hasClass(e,t)?Xa.removeClass(e,t):Xa.addClass(e,t)}))},Xa.classNames=function(){for(var e=arguments,t=[],n=function(n){"String"===Xa.typeOf(e[n])?t.push(e[n]):"Object"===Xa.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(" ")},Xa.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){Ga.logError("util.findDom",r),0===n.indexOf("#")&&(e=t.getElementById(n.slice(1)))}return e},Xa.getCss=function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},Xa.padStart=function(e,t,n){for(var r=String(n),i=t>>0,a=Math.ceil(i/r.length),o=[],s=String(e);a--;)o.push(r);return o.join("").substring(0,i-s.length)+s},Xa.format=function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=Xa.padStart(Math.floor(e/3600),2,0),n=Xa.padStart(Math.floor((e-3600*t)/60),2,0),r=Xa.padStart(Math.floor(e-3600*t-60*n),2,0);return("00"===t?[n,r]:[t,n,r]).join(":")},Xa.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},Xa.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},Xa.deepCopy=function(e,t){if("Object"===Xa.typeOf(t)&&"Object"===Xa.typeOf(e))return Object.keys(t).forEach((function(n){"Object"!==Xa.typeOf(t[n])||t[n]instanceof Node?"Array"===Xa.typeOf(t[n])?e[n]="Array"===Xa.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]:Xa.deepCopy(e[n],t[n])})),e},Xa.deepMerge=function(e,t){return Object.keys(t).map((function(n){var r;"Array"===Xa.typeOf(t[n])&&"Array"===Xa.typeOf(e[n])?"Array"===Xa.typeOf(e[n])&&(r=e[n]).push.apply(r,Ta(t[n])):Xa.typeOf(e[n])!==Xa.typeOf(t[n])||null===e[n]||"Object"!==Xa.typeOf(e[n])||t[n]instanceof window.Node?null!==t[n]&&(e[n]=t[n]):Xa.deepMerge(e[n],t[n])})),e},Xa.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},Xa.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""},Xa.setInterval=function(e,t,n,r){e._interval[t]||(e._interval[t]=window.setInterval(n.bind(e),r))},Xa.clearInterval=function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},Xa.setTimeout=function(e,t,n){e._timers||(e._timers=[]);var r=setTimeout((function(){t(),Xa.clearTimeout(e,r)}),n);return e._timers.push(r),r},Xa.clearTimeout=function(e,t){var n=e._timers;if("Array"===Xa.typeOf(n)){for(var r=0;r<n.length;r++)if(n[r]===t){n.splice(r,1),clearTimeout(t);break}}else clearTimeout(t)},Xa.clearAllTimers=function(e){var t=e._timers;"Array"===Xa.typeOf(t)&&(t.map((function(e){clearTimeout(e)})),e._timerIds=[])},Xa.createImgBtn=function(e,t,n,r){var i,a,o,s=Xa.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()),a=parseFloat(r.slice(0,r.indexOf(e)).trim()),o=e,!1)})),s.style.width="".concat(i).concat(o),s.style.height="".concat(a).concat(o),s.style.backgroundSize="".concat(i).concat(o," ").concat(a).concat(o),s.style.margin="start"===e?"-".concat(a/2).concat(o," auto auto -").concat(i/2).concat(o):"auto 5px auto 5px");return s},Xa.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)"},Xa.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},Xa.checkIsFunction=function(e){return e&&"function"==typeof e},Xa.checkIsObject=function(e){return null!==e&&"object"===Aa(e)},Xa.hide=function(e){e.style.display="none"},Xa.show=function(e,t){e.style.display=t||"block"},Xa.isUndefined=function(e){if(null==e)return!0},Xa.isNotNull=function(e){return!(null==e)},Xa.setStyleFromCsstext=function(e,t){t&&("String"===Xa.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]})))},Xa.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={},a={};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)?a[n[0]]=n[1]:i[n[0]]=n[1])}})),e.setAttribute("style",""),Object.keys(a).map((function(t){e.style[t]=a[t]})),i},Xa.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},Xa.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}},Xa.stopPropagation=function(e){e&&e.stopPropagation()},Xa.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},Xa.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},Xa.checkTouchSupport=function(){return"ontouchstart"in window},Xa.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 a=0;a<n.length;a++){var o=i.length;if(o){var s=i[o-1].end;n[a].start-s<t?n[a].end>s&&(i[o-1].end=n[a].end):i.push(n[a])}else i.push(n[a])}else i=n;return new Pa(i)},Xa.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}},Xa.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},Xa.getHostFromUrl=function(e){if("String"!==Xa.typeOf(e))return"";var t=e.split("/"),n="";return t.length>3&&t[2]&&(n=t[2]),n},Xa.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},Xa.isMSE=function(e){return!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},Xa.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)}))},Xa.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},Xa.adjustTimeByDuration=function(e,t,n){return t&&e&&(e>t||n&&e<t)?t:e},Xa.createPositionBar=function(e,t){var n=Xa.createDom("xg-bar","",{"data-index":-1},e);return t.appendChild(n),n},Xa.getTransformStyle=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0};return"scale(".concat(e.scale||1,") translate(").concat(e.x||0,"%, ").concat(e.y||0,"%) rotate(").concat(e.rotate||0,"deg)")},Xa.convertDeg=function(e){return Math.abs(e)<=1?360*e:e%360};var Va=/(Android)\s([\d.]+)/,Da=/(Version)\/([\d.]+)/,Ma=["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"],Wa={get device(){return Wa.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),a=/(?:iPad|PlayBook)/.test(e)||r&&!/(?:Mobile)/.test(e)||i&&/(?:Tablet)/.test(e),o=/(?:iPhone)/.test(e)&&!a,s=!(o||r||n||a),u=/(?:iPad|PlayBook)/.test(e);return{isTablet:a,isPhone:o,isIpad:u,isIos:o||u,isAndroid:r,isPc:s,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)?Da:Va)?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&&Ma.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),a=MediaSource.isTypeSupported(r.contentType);return Promise.resolve({supported:i&&a,smooth:!1,powerEfficient:!1})}catch(o){return Promise.resolve(t)}}},Na="3.0.7",Oa={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},Ua=Sa((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};_a(this,e);var r=t&&t.i18n?t.i18n.ERROR_TYPES:null;if(t.media){var i=n.mediaError?n.mediaError:t.media.error||{},a=t.duration,o=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;Oa[f]&&(f=Oa[f]);var p={playerVersion:Na,currentTime:o,duration:a,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:Xa.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:Na,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}})),Fa="error",Ya="destroy",Ka="urlchange",Ha="definition_change";function ja(e,t,n){for(var r=arguments.length,i=new Array(r>3?r-3:0),a=3;a<r;a++)i[a-3]=arguments[a];var o=t.call.apply(t,[e].concat(i));n&&"function"==typeof n&&(o&&o.then?o.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 Ba(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 a;(a=n.pre).call.apply(a,[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 o,s=(o=this.__hooks[e]).call.apply(o,[this,this].concat(Array.prototype.slice.call(arguments)));s?s.then?s.then((function(e){!1!==e&&ja.apply(void 0,[i,t,n.next].concat(Ta(r)))})).catch((function(e){throw e})):ja.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments))):void 0===s&&ja.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 ja.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments)))}.bind(this)}function Ja(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 za(e,t){var n=this.__hooks;n&&delete n[e]}function Qa(e,t){Ga.logError("[".concat(e,"] event or callback cant be undefined or null when call ").concat(t))}var qa=function(){function e(t){_a(this,e),Xa.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 Sa(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=Xa.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)})):Qa(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)})):Qa(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)})):Qa(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=ba(ba({},n),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,r)}}},{key:"hook",value:function(e,t){return Ba.call.apply(Ba,[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 Ja.call.apply(Ja,[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 za.call.apply(za,[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(),Xa.clearAllTimers(this),Xa.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 $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 eo(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){uo(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 to(){to=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:{},a=i.iterator||"@@iterator",o=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 a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new T(i||[]);return r(o,"_invoke",{value:_(e,n,s)}),o}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,a,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,a)&&(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,a,o,s){var u=l(e[r],e,a);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,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,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 a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):a:(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[a];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,o,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new A(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(g),u(g,s,"Generator"),u(g,a,(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 o.type="throw",o.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 a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.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 a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},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 no(e){return(no="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 ro(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(c){return void n(c)}s.done?t(u):Promise.resolve(u).then(r,i)}function io(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){ro(a,r,i,o,s,"next",e)}function s(e){ro(a,r,i,o,s,"throw",e)}o(void 0)}))}}function ao(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oo(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,wo(r.key),r)}}function so(e,t,n){return t&&oo(e.prototype,t),n&&oo(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function uo(e,t,n){return(t=wo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function co(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&&ho(e,t)}function lo(e){return(lo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ho(e,t){return(ho=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function fo(){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 po(e,t,n){return(po=fo()?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&&ho(i,n.prototype),i}).apply(null,arguments)}function mo(e){var t="function"==typeof Map?new Map:void 0;return mo=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 po(e,arguments,lo(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ho(r,e)},mo(e)}function yo(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function vo(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function go(e){var t=fo();return function(){var n,r=lo(e);if(t){var i=lo(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 vo(e)}(this,n)}}function bo(){return bo="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=lo(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}},bo.apply(this,arguments)}function Ao(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 _o(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 Ao(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)?Ao(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 a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function wo(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 So=Vr,ko=Dr,To=Object.keys||function(e){return So(e,ko)},xo=S,Eo=W,Lo=E,Zo=w,Io=To,Ro=Nr,Co=L,Go=et,Po=B,Xo=Object.assign,Vo=Object.defineProperty,Do=Eo([].concat),Mo=!Xo||Zo((function(){if(xo&&1!==Xo({b:1},Xo(Vo({},"a",{enumerable:!0,get:function(){Vo(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!=Xo({},e)[n]||Io(Xo({},t)).join("")!=r}))?function(e,t){for(var n=Go(e),r=arguments.length,i=1,a=Ro.f,o=Co.f;r>i;)for(var s,u=Po(arguments[i++]),c=a?Do(Io(u),a(u)):Io(u),l=c.length,d=0;l>d;)s=c[d++],xo&&!Lo(o,u,s)||(n[s]=u[s]);return n}:Xo,Wo=Mo;pi({target:"Object",stat:!0,arity:2,forced:Object.assign!==Wo},{assign:Wo});var No=Ri,Oo=ki?{}.toString:function(){return"[object "+No(this)+"]"};ki||lr(Object.prototype,"toString",Oo,{unsafe:!0});var Uo,Fo,Yo,Ko,Ho="process"==F(A.process),jo=ae,Bo=String,Jo=TypeError,zo=W,Qo=zt,qo=function(e){if("object"==typeof e||jo(e))return e;throw Jo("Can't set "+Bo(e)+" as a prototype")},$o=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=zo(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),t=n instanceof Array}catch(r){}return function(n,r){return Qo(n),qo(r),t?e(n,r):n.__proto__=r,n}}():void 0),es=Kt.f,ts=rt,ns=gt("toStringTag"),rs=function(e,t,n){e&&!n&&(e=e.prototype),e&&!ts(e,ns)&&es(e,ns,{configurable:!0,value:t})},is=de,as=Kt,os=S,ss=gt("species"),us=function(e){var t=is(e),n=as.f;os&&t&&!t[ss]&&n(t,ss,{configurable:!0,get:function(){return this}})},cs=he,ls=TypeError,ds=function(e,t){if(cs(t,e))return e;throw ls("Incorrect invocation")},hs=Ki,fs=Re,ps=TypeError,ms=function(e){if(hs(e))return e;throw ps(fs(e)+" is not a constructor")},ys=zt,vs=ms,gs=J,bs=gt("species"),As=function(e,t){var n,r=ys(e).constructor;return void 0===r||gs(n=ys(r)[bs])?t:vs(n)},_s=k,ws=Function.prototype,Ss=ws.apply,ks=ws.call,Ts="object"==typeof Reflect&&Reflect.apply||(_s?ks.bind(Ss):function(){return ks.apply(Ss,arguments)}),xs=F,Es=W,Ls=function(e){if("Function"===xs(e))return Es(e)},Zs=Xe,Is=k,Rs=Ls(Ls.bind),Cs=function(e,t){return Zs(e),void 0===t?e:Is?Rs(e,t):function(){return e.apply(t,arguments)}},Gs=de("document","documentElement"),Ps=W([].slice),Xs=TypeError,Vs=function(e,t){if(e<t)throw Xs("Not enough arguments");return e},Ds=/(?:ipad|iphone|ipod).*applewebkit/i.test(fe),Ms=A,Ws=Ts,Ns=Cs,Os=ae,Us=rt,Fs=w,Ys=Gs,Ks=Ps,Hs=Gt,js=Vs,Bs=Ds,Js=Ho,zs=Ms.setImmediate,Qs=Ms.clearImmediate,qs=Ms.process,$s=Ms.Dispatch,eu=Ms.Function,tu=Ms.MessageChannel,nu=Ms.String,ru=0,iu={},au="onreadystatechange";try{Uo=Ms.location}catch(S0){}var ou=function(e){if(Us(iu,e)){var t=iu[e];delete iu[e],t()}},su=function(e){return function(){ou(e)}},uu=function(e){ou(e.data)},cu=function(e){Ms.postMessage(nu(e),Uo.protocol+"//"+Uo.host)};zs&&Qs||(zs=function(e){js(arguments.length,1);var t=Os(e)?e:eu(e),n=Ks(arguments,1);return iu[++ru]=function(){Ws(t,void 0,n)},Fo(ru),ru},Qs=function(e){delete iu[e]},Js?Fo=function(e){qs.nextTick(su(e))}:$s&&$s.now?Fo=function(e){$s.now(su(e))}:tu&&!Bs?(Ko=(Yo=new tu).port2,Yo.port1.onmessage=uu,Fo=Ns(Ko.postMessage,Ko)):Ms.addEventListener&&Os(Ms.postMessage)&&!Ms.importScripts&&Uo&&"file:"!==Uo.protocol&&!Fs(cu)?(Fo=cu,Ms.addEventListener("message",uu,!1)):Fo=au in Hs("script")?function(e){Ys.appendChild(Hs("script"))[au]=function(){Ys.removeChild(this),ou(e)}}:function(e){setTimeout(su(e),0)});var lu,du,hu,fu,pu,mu,yu,vu,gu={set:zs,clear:Qs},bu=A,Au=/ipad|iphone|ipod/i.test(fe)&&void 0!==bu.Pebble,_u=/web0s(?!.*chrome)/i.test(fe),wu=A,Su=Cs,ku=_.f,Tu=gu.set,xu=Ds,Eu=Au,Lu=_u,Zu=Ho,Iu=wu.MutationObserver||wu.WebKitMutationObserver,Ru=wu.document,Cu=wu.process,Gu=wu.Promise,Pu=ku(wu,"queueMicrotask"),Xu=Pu&&Pu.value;Xu||(lu=function(){var e,t;for(Zu&&(e=Cu.domain)&&e.exit();du;){t=du.fn,du=du.next;try{t()}catch(S0){throw du?fu():hu=void 0,S0}}hu=void 0,e&&e.enter()},xu||Zu||Lu||!Iu||!Ru?!Eu&&Gu&&Gu.resolve?((yu=Gu.resolve(void 0)).constructor=Gu,vu=Su(yu.then,yu),fu=function(){vu(lu)}):Zu?fu=function(){Cu.nextTick(lu)}:(Tu=Su(Tu,wu),fu=function(){Tu(lu)}):(pu=!0,mu=Ru.createTextNode(""),new Iu(lu).observe(mu,{characterData:!0}),fu=function(){mu.data=pu=!pu}));var Vu=Xu||function(e){var t={fn:e,next:void 0};hu&&(hu.next=t),du||(du=t,fu()),hu=t},Du=A,Mu=function(e){try{return{error:!1,value:e()}}catch(S0){return{error:!0,value:S0}}},Wu=function(){this.head=null,this.tail=null};Wu.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 Nu=Wu,Ou=A.Promise,Uu="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Fu=!Uu&&!Ho&&"object"==typeof window&&"object"==typeof document,Yu=A,Ku=Ou,Hu=ae,ju=oi,Bu=Tn,Ju=gt,zu=Fu,Qu=Uu,qu=Ae;Ku&&Ku.prototype;var $u=Ju("species"),ec=!1,tc=Hu(Yu.PromiseRejectionEvent),nc={CONSTRUCTOR:ju("Promise",(function(){var e=Bu(Ku),t=e!==String(Ku);if(!t&&66===qu)return!0;if(!qu||qu<51||!/native code/.test(e)){var n=new Ku((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};if((n.constructor={})[$u]=r,!(ec=n.then((function(){}))instanceof r))return!0}return!t&&(zu||Qu)&&!tc})),REJECTION_EVENT:tc,SUBCLASSING:ec},rc={},ic=Xe,ac=TypeError,oc=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw ac("Bad Promise constructor");t=e,n=r})),this.resolve=ic(t),this.reject=ic(n)};rc.f=function(e){return new oc(e)};var sc,uc,cc,lc=pi,dc=Ho,hc=A,fc=E,pc=lr,mc=$o,yc=rs,vc=us,gc=Xe,bc=ae,Ac=ue,_c=ds,wc=As,Sc=gu.set,kc=Vu,Tc=function(e,t){var n=Du.console;n&&n.error&&(1==arguments.length?n.error(e):n.error(e,t))},xc=Mu,Ec=Nu,Lc=Hn,Zc=Ou,Ic=rc,Rc="Promise",Cc=nc.CONSTRUCTOR,Gc=nc.REJECTION_EVENT,Pc=nc.SUBCLASSING,Xc=Lc.getterFor(Rc),Vc=Lc.set,Dc=Zc&&Zc.prototype,Mc=Zc,Wc=Dc,Nc=hc.TypeError,Oc=hc.document,Uc=hc.process,Fc=Ic.f,Yc=Fc,Kc=!!(Oc&&Oc.createEvent&&hc.dispatchEvent),Hc="unhandledrejection",jc=function(e){var t;return!(!Ac(e)||!bc(t=e.then))&&t},Bc=function(e,t){var n,r,i,a=t.value,o=1==t.state,s=o?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{s?(o||(2===t.rejection&&$c(t),t.rejection=1),!0===s?n=a:(l&&l.enter(),n=s(a),l&&(l.exit(),i=!0)),n===e.promise?c(Nc("Promise-chain cycle")):(r=jc(n))?fc(r,n,u,c):u(n)):c(a)}catch(S0){l&&!i&&l.exit(),c(S0)}},Jc=function(e,t){e.notified||(e.notified=!0,kc((function(){for(var n,r=e.reactions;n=r.get();)Bc(n,e);e.notified=!1,t&&!e.rejection&&Qc(e)})))},zc=function(e,t,n){var r,i;Kc?((r=Oc.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),hc.dispatchEvent(r)):r={promise:t,reason:n},!Gc&&(i=hc["on"+e])?i(r):e===Hc&&Tc("Unhandled promise rejection",n)},Qc=function(e){fc(Sc,hc,(function(){var t,n=e.facade,r=e.value;if(qc(e)&&(t=xc((function(){dc?Uc.emit("unhandledRejection",r,n):zc(Hc,n,r)})),e.rejection=dc||qc(e)?2:1,t.error))throw t.value}))},qc=function(e){return 1!==e.rejection&&!e.parent},$c=function(e){fc(Sc,hc,(function(){var t=e.facade;dc?Uc.emit("rejectionHandled",t):zc("rejectionhandled",t,e.value)}))},el=function(e,t,n){return function(r){e(t,r,n)}},tl=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,Jc(e,!0))},nl=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw Nc("Promise can't be resolved itself");var r=jc(t);r?kc((function(){var n={done:!1};try{fc(r,t,el(nl,n,e),el(tl,n,e))}catch(S0){tl(n,S0,e)}})):(e.value=t,e.state=1,Jc(e,!1))}catch(S0){tl({done:!1},S0,e)}}};if(Cc&&(Wc=(Mc=function(e){_c(this,Wc),gc(e),fc(sc,this);var t=Xc(this);try{e(el(nl,t),el(tl,t))}catch(S0){tl(t,S0)}}).prototype,(sc=function(e){Vc(this,{type:Rc,done:!1,notified:!1,parent:!1,reactions:new Ec,rejection:!1,state:0,value:void 0})}).prototype=pc(Wc,"then",(function(e,t){var n=Xc(this),r=Fc(wc(this,Mc));return n.parent=!0,r.ok=!bc(e)||e,r.fail=bc(t)&&t,r.domain=dc?Uc.domain:void 0,0==n.state?n.reactions.add(r):kc((function(){Bc(r,n)})),r.promise})),uc=function(){var e=new sc,t=Xc(e);this.promise=e,this.resolve=el(nl,t),this.reject=el(tl,t)},Ic.f=Fc=function(e){return e===Mc||undefined===e?new uc(e):Yc(e)},bc(Zc)&&Dc!==Object.prototype)){cc=Dc.then,Pc||pc(Dc,"then",(function(e,t){var n=this;return new Mc((function(e,t){fc(cc,n,e,t)})).then(e,t)}),{unsafe:!0});try{delete Dc.constructor}catch(S0){}mc&&mc(Dc,Wc)}lc({global:!0,constructor:!0,wrap:!0,forced:Cc},{Promise:Mc}),yc(Mc,Rc,!1),vc(Rc);var rl={},il=rl,al=gt("iterator"),ol=Array.prototype,sl=function(e){return void 0!==e&&(il.Array===e||ol[al]===e)},ul=Ri,cl=Me,ll=J,dl=rl,hl=gt("iterator"),fl=function(e){if(!ll(e))return cl(e,hl)||cl(e,"@@iterator")||dl[ul(e)]},pl=E,ml=Xe,yl=zt,vl=Re,gl=fl,bl=TypeError,Al=function(e,t){var n=arguments.length<2?gl(e):t;if(ml(n))return yl(pl(n,e));throw bl(vl(e)+" is not iterable")},_l=E,wl=zt,Sl=Me,kl=function(e,t,n){var r,i;wl(e);try{if(!(r=Sl(e,"return"))){if("throw"===t)throw n;return n}r=_l(r,e)}catch(S0){i=!0,r=S0}if("throw"===t)throw n;if(i)throw r;return wl(r),n},Tl=Cs,xl=E,El=zt,Ll=Re,Zl=sl,Il=Tr,Rl=he,Cl=Al,Gl=fl,Pl=kl,Xl=TypeError,Vl=function(e,t){this.stopped=e,this.result=t},Dl=Vl.prototype,Ml=function(e,t,n){var r,i,a,o,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=Tl(t,l),y=function(e){return r&&Pl(r,"normal",e),new Vl(!0,e)},v=function(e){return d?(El(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=Gl(e)))throw Xl(Ll(e)+" is not iterable");if(Zl(i)){for(a=0,o=Il(e);o>a;a++)if((s=v(e[a]))&&Rl(Dl,s))return s;return new Vl(!1)}r=Cl(e,i)}for(u=h?e.next:r.next;!(c=xl(u,r)).done;){try{s=v(c.value)}catch(S0){Pl(r,"throw",S0)}if("object"==typeof s&&s&&Rl(Dl,s))return s}return new Vl(!1)},Wl=gt("iterator"),Nl=!1;try{var Ol=0,Ul={next:function(){return{done:!!Ol++}},return:function(){Nl=!0}};Ul[Wl]=function(){return this},Array.from(Ul,(function(){throw 2}))}catch(S0){}var Fl=function(e,t){if(!t&&!Nl)return!1;var n=!1;try{var r={};r[Wl]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(S0){}return n},Yl=Ou,Kl=nc.CONSTRUCTOR||!Fl((function(e){Yl.all(e).then(void 0,(function(){}))})),Hl=E,jl=Xe,Bl=rc,Jl=Mu,zl=Ml;pi({target:"Promise",stat:!0,forced:Kl},{all:function(e){var t=this,n=Bl.f(t),r=n.resolve,i=n.reject,a=Jl((function(){var n=jl(t.resolve),a=[],o=0,s=1;zl(e,(function(e){var u=o++,c=!1;s++,Hl(n,t,e).then((function(e){c||(c=!0,a[u]=e,--s||r(a))}),i)})),--s||r(a)}));return a.error&&i(a.value),n.promise}});var Ql=pi,ql=nc.CONSTRUCTOR,$l=Ou,ed=de,td=ae,nd=lr,rd=$l&&$l.prototype;if(Ql({target:"Promise",proto:!0,forced:ql,real:!0},{catch:function(e){return this.then(void 0,e)}}),td($l)){var id=ed("Promise").prototype.catch;rd.catch!==id&&nd(rd,"catch",id,{unsafe:!0})}var ad=E,od=Xe,sd=rc,ud=Mu,cd=Ml;pi({target:"Promise",stat:!0,forced:Kl},{race:function(e){var t=this,n=sd.f(t),r=n.reject,i=ud((function(){var i=od(t.resolve);cd(e,(function(e){ad(i,t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var ld=E,dd=rc;pi({target:"Promise",stat:!0,forced:nc.CONSTRUCTOR},{reject:function(e){var t=dd.f(this);return ld(t.reject,void 0,e),t.promise}});var hd=zt,fd=ue,pd=rc,md=function(e,t){if(hd(e),fd(t)&&t.constructor===e)return t;var n=pd.f(e);return(0,n.resolve)(t),n.promise},yd=pi,vd=nc.CONSTRUCTOR,gd=md;de("Promise"),yd({target:"Promise",stat:!0,forced:vd},{resolve:function(e){return gd(this,e)}});var bd={},Ad=S,_d=Ht,wd=Kt,Sd=zt,kd=te,Td=To;bd.f=Ad&&!_d?Object.defineProperties:function(e,t){Sd(e);for(var n,r=kd(t),i=Td(t),a=i.length,o=0;a>o;)wd.f(e,n=i[o++],r[n]);return e};var xd,Ed=zt,Ld=bd,Zd=Dr,Id=Cn,Rd=Gs,Cd=Gt,Gd="prototype",Pd="script",Xd=Rn("IE_PROTO"),Vd=function(){},Dd=function(e){return"<"+Pd+">"+e+"</"+Pd+">"},Md=function(e){e.write(Dd("")),e.close();var t=e.parentWindow.Object;return e=null,t},Wd=function(){try{xd=new ActiveXObject("htmlfile")}catch(S0){}var e,t,n;Wd="undefined"!=typeof document?document.domain&&xd?Md(xd):(t=Cd("iframe"),n="java"+Pd+":",t.style.display="none",Rd.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(Dd("document.F=Object")),e.close(),e.F):Md(xd);for(var r=Zd.length;r--;)delete Wd[Gd][Zd[r]];return Wd()};Id[Xd]=!0;var Nd=Object.create||function(e,t){var n;return null!==e?(Vd[Gd]=Ed(e),n=new Vd,Vd[Gd]=null,n[Xd]=e):n=Wd(),void 0===t?n:Ld.f(n,t)},Od=gt,Ud=Nd,Fd=Kt.f,Yd=Od("unscopables"),Kd=Array.prototype;null==Kd[Yd]&&Fd(Kd,Yd,{configurable:!0,value:Ud(null)});var Hd,jd,Bd,Jd=function(e){Kd[Yd][e]=!0},zd=!w((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Qd=rt,qd=ae,$d=et,eh=zd,th=Rn("IE_PROTO"),nh=Object,rh=nh.prototype,ih=eh?nh.getPrototypeOf:function(e){var t=$d(e);if(Qd(t,th))return t[th];var n=t.constructor;return qd(n)&&t instanceof n?n.prototype:t instanceof nh?rh:null},ah=w,oh=ae,sh=ue,uh=ih,ch=lr,lh=gt("iterator"),dh=!1;[].keys&&("next"in(Bd=[].keys())?(jd=uh(uh(Bd)))!==Object.prototype&&(Hd=jd):dh=!0),(!sh(Hd)||ah((function(){var e={};return Hd[lh].call(e)!==e})))&&(Hd={}),oh(Hd[lh])||ch(Hd,lh,(function(){return this}));var hh={IteratorPrototype:Hd,BUGGY_SAFARI_ITERATORS:dh},fh=hh.IteratorPrototype,ph=Nd,mh=P,yh=rs,vh=rl,gh=function(){return this},bh=function(e,t,n,r){var i=t+" Iterator";return e.prototype=ph(fh,{next:mh(+!r,n)}),yh(e,i,!1),vh[i]=gh,e},Ah=pi,_h=E,wh=ae,Sh=bh,kh=ih,Th=$o,xh=rs,Eh=dn,Lh=lr,Zh=rl,Ih=gn.PROPER,Rh=gn.CONFIGURABLE,Ch=hh.IteratorPrototype,Gh=hh.BUGGY_SAFARI_ITERATORS,Ph=gt("iterator"),Xh="keys",Vh="values",Dh="entries",Mh=function(){return this},Wh=function(e,t,n,r,i,a,o){Sh(n,t,r);var s,u,c,l=function(e){if(e===i&&m)return m;if(!Gh&&e in f)return f[e];switch(e){case Xh:case Vh:case Dh:return function(){return new n(this,e)}}return function(){return new n(this)}},d=t+" Iterator",h=!1,f=e.prototype,p=f[Ph]||f["@@iterator"]||i&&f[i],m=!Gh&&p||l(i),y="Array"==t&&f.entries||p;if(y&&(s=kh(y.call(new e)))!==Object.prototype&&s.next&&(kh(s)!==Ch&&(Th?Th(s,Ch):wh(s[Ph])||Lh(s,Ph,Mh)),xh(s,d,!0)),Ih&&i==Vh&&p&&p.name!==Vh&&(Rh?Eh(f,"name",Vh):(h=!0,m=function(){return _h(p,this)})),i)if(u={values:l(Vh),keys:a?m:l(Xh),entries:l(Dh)},o)for(c in u)(Gh||h||!(c in f))&&Lh(f,c,u[c]);else Ah({target:t,proto:!0,forced:Gh||h},u);return f[Ph]!==m&&Lh(f,Ph,m,{name:i}),Zh[t]=m,u},Nh=function(e,t){return{value:e,done:t}},Oh=te,Uh=Jd,Fh=rl,Yh=Hn,Kh=Kt.f,Hh=Wh,jh=Nh,Bh=S,Jh="Array Iterator",zh=Yh.set,Qh=Yh.getterFor(Jh),qh=Hh(Array,"Array",(function(e,t){zh(this,{type:Jh,target:Oh(e),index:0,kind:t})}),(function(){var e=Qh(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,jh(void 0,!0)):jh("keys"==n?r:"values"==n?t[r]:[r,t[r]],!1)}),"values"),$h=Fh.Arguments=Fh.Array;if(Uh("keys"),Uh("values"),Uh("entries"),Bh&&"values"!==$h.name)try{Kh($h,"name",{value:"values"})}catch(S0){}var ef=Ri,tf=String,nf=function(e){if("Symbol"===ef(e))throw TypeError("Cannot convert a Symbol value to a string");return tf(e)},rf=W,af=yr,of=nf,sf=q,uf=rf("".charAt),cf=rf("".charCodeAt),lf=rf("".slice),df=function(e){return function(t,n){var r,i,a=of(sf(t)),o=af(n),s=a.length;return o<0||o>=s?e?"":void 0:(r=cf(a,o))<55296||r>56319||o+1===s||(i=cf(a,o+1))<56320||i>57343?e?uf(a,o):r:e?lf(a,o,o+2):i-56320+(r-55296<<10)+65536}},hf={codeAt:df(!1),charAt:df(!0)},ff=hf.charAt,pf=nf,mf=Hn,yf=Wh,vf=Nh,gf="String Iterator",bf=mf.set,Af=mf.getterFor(gf);yf(String,"String",(function(e){bf(this,{type:gf,string:pf(e),index:0})}),(function(){var e,t=Af(this),n=t.string,r=t.index;return r>=n.length?vf(void 0,!0):(e=ff(n,r),t.index+=e.length,vf(e,!1))}));var _f={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},wf=Gt("span").classList,Sf=wf&&wf.constructor&&wf.constructor.prototype,kf=Sf===Object.prototype?void 0:Sf,Tf=A,xf=_f,Ef=kf,Lf=qh,Zf=dn,If=gt,Rf=If("iterator"),Cf=If("toStringTag"),Gf=Lf.values,Pf=function(e,t){if(e){if(e[Rf]!==Gf)try{Zf(e,Rf,Gf)}catch(S0){e[Rf]=Gf}if(e[Cf]||Zf(e,Cf,t),xf[t])for(var n in Lf)if(e[n]!==Lf[n])try{Zf(e,n,Lf[n])}catch(S0){e[n]=Lf[n]}}};for(var Xf in xf)Pf(Tf[Xf]&&Tf[Xf].prototype,Xf);Pf(Ef,"DOMTokenList");var Vf=w,Df=gt("iterator"),Mf=!Vf((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[Df]||"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})),Wf=ar,Nf=Kt,Of=function(e,t,n){return n.get&&Wf(n.get,t,{getter:!0}),n.set&&Wf(n.set,t,{setter:!0}),Nf.f(e,t,n)},Uf=zt,Ff=kl,Yf=Cs,Kf=E,Hf=et,jf=function(e,t,n,r){try{return r?t(Uf(n)[0],n[1]):t(n)}catch(S0){Ff(e,"throw",S0)}},Bf=sl,Jf=Ki,zf=Tr,Qf=wi,qf=Al,$f=fl,ep=Array,tp=function(e){var t=Hf(e),n=Jf(this),r=arguments.length,i=r>1?arguments[1]:void 0,a=void 0!==i;a&&(i=Yf(i,r>2?arguments[2]:void 0));var o,s,u,c,l,d,h=$f(t),f=0;if(!h||this===ep&&Bf(h))for(o=zf(t),s=n?new this(o):ep(o);o>f;f++)d=a?i(t[f],f):t[f],Qf(s,f,d);else for(l=(c=qf(t,h)).next,s=n?new this:[];!(u=Kf(l,c)).done;f++)d=a?jf(c,i,[u.value,f],!0):u.value,Qf(s,f,d);return s.length=f,s},np=Ar,rp=Tr,ip=wi,ap=Array,op=Math.max,sp=function(e,t,n){for(var r=rp(e),i=np(t,r),a=np(void 0===n?r:n,r),o=ap(op(a-i,0)),s=0;i<a;i++,s++)ip(o,s,e[i]);return o.length=s,o},up=W,cp=2147483647,lp=/[^\0-\u007E]/,dp=/[.\u3002\uFF0E\uFF61]/g,hp="Overflow: input needs wider integers to process",fp=RangeError,pp=up(dp.exec),mp=Math.floor,yp=String.fromCharCode,vp=up("".charCodeAt),gp=up([].join),bp=up([].push),Ap=up("".replace),_p=up("".split),wp=up("".toLowerCase),Sp=function(e){return e+22+75*(e<26)},kp=function(e,t,n){var r=0;for(e=n?mp(e/700):e>>1,e+=mp(e/t);e>455;)e=mp(e/35),r+=36;return mp(r+36*e/(e+38))},Tp=function(e){var t=[];e=function(e){for(var t=[],n=0,r=e.length;n<r;){var i=vp(e,n++);if(i>=55296&&i<=56319&&n<r){var a=vp(e,n++);56320==(64512&a)?bp(t,((1023&i)<<10)+(1023&a)+65536):(bp(t,i),n--)}else bp(t,i)}return t}(e);var n,r,i=e.length,a=128,o=0,s=72;for(n=0;n<e.length;n++)(r=e[n])<128&&bp(t,yp(r));var u=t.length,c=u;for(u&&bp(t,"-");c<i;){var l=cp;for(n=0;n<e.length;n++)(r=e[n])>=a&&r<l&&(l=r);var d=c+1;if(l-a>mp((cp-o)/d))throw fp(hp);for(o+=(l-a)*d,a=l,n=0;n<e.length;n++){if((r=e[n])<a&&++o>cp)throw fp(hp);if(r==a){for(var h=o,f=36;;){var p=f<=s?1:f>=s+26?26:f-s;if(h<p)break;var m=h-p,y=36-p;bp(t,yp(Sp(p+m%y))),h=mp(m/y),f+=36}bp(t,yp(Sp(h))),s=kp(o,d,c==u),o=0,c++}}o++,a++}return gp(t,"")},xp=lr,Ep=function(e,t,n){for(var r in t)xp(e,r,t[r],n);return e},Lp=sp,Zp=Math.floor,Ip=function(e,t){var n=e.length,r=Zp(n/2);return n<8?Rp(e,t):Cp(e,Ip(Lp(e,0,r),t),Ip(Lp(e,r),t),t)},Rp=function(e,t){for(var n,r,i=e.length,a=1;a<i;){for(r=a,n=e[a];r&&t(e[r-1],n)>0;)e[r]=e[--r];r!==a++&&(e[r]=n)}return e},Cp=function(e,t,n,r){for(var i=t.length,a=n.length,o=0,s=0;o<i||s<a;)e[o+s]=o<i&&s<a?r(t[o],n[s])<=0?t[o++]:n[s++]:o<i?t[o++]:n[s++];return e},Gp=Ip,Pp=pi,Xp=A,Vp=E,Dp=W,Mp=S,Wp=Mf,Np=lr,Op=Ep,Up=rs,Fp=bh,Yp=Hn,Kp=ds,Hp=ae,jp=rt,Bp=Cs,Jp=Ri,zp=zt,Qp=ue,qp=nf,$p=Nd,em=P,tm=Al,nm=fl,rm=Vs,im=Gp,am=gt("iterator"),om="URLSearchParams",sm=om+"Iterator",um=Yp.set,cm=Yp.getterFor(om),lm=Yp.getterFor(sm),dm=Object.getOwnPropertyDescriptor,hm=function(e){if(!Mp)return Xp[e];var t=dm(Xp,e);return t&&t.value},fm=hm("fetch"),pm=hm("Request"),mm=hm("Headers"),ym=pm&&pm.prototype,vm=mm&&mm.prototype,gm=Xp.RegExp,bm=Xp.TypeError,Am=Xp.decodeURIComponent,_m=Xp.encodeURIComponent,wm=Dp("".charAt),Sm=Dp([].join),km=Dp([].push),Tm=Dp("".replace),xm=Dp([].shift),Em=Dp([].splice),Lm=Dp("".split),Zm=Dp("".slice),Im=/\+/g,Rm=Array(4),Cm=function(e){return Rm[e-1]||(Rm[e-1]=gm("((?:%[\\da-f]{2}){"+e+"})","gi"))},Gm=function(e){try{return Am(e)}catch(S0){return e}},Pm=function(e){var t=Tm(e,Im," "),n=4;try{return Am(t)}catch(S0){for(;n;)t=Tm(t,Cm(n--),Gm);return t}},Xm=/[!'()~]|%20/g,Vm={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Dm=function(e){return Vm[e]},Mm=function(e){return Tm(_m(e),Xm,Dm)},Wm=Fp((function(e,t){um(this,{type:sm,iterator:tm(cm(e).entries),kind:t})}),"Iterator",(function(){var e=lm(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),Nm=function(e){this.entries=[],this.url=null,void 0!==e&&(Qp(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===wm(e,0)?Zm(e,1):e:qp(e)))};Nm.prototype={type:om,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,n,r,i,a,o,s,u=nm(e);if(u)for(n=(t=tm(e,u)).next;!(r=Vp(n,t)).done;){if(a=(i=tm(zp(r.value))).next,(o=Vp(a,i)).done||(s=Vp(a,i)).done||!Vp(a,i).done)throw bm("Expected sequence with length 2");km(this.entries,{key:qp(o.value),value:qp(s.value)})}else for(var c in e)jp(e,c)&&km(this.entries,{key:c,value:qp(e[c])})},parseQuery:function(e){if(e)for(var t,n,r=Lm(e,"&"),i=0;i<r.length;)(t=r[i++]).length&&(n=Lm(t,"="),km(this.entries,{key:Pm(xm(n)),value:Pm(Sm(n,"="))}))},serialize:function(){for(var e,t=this.entries,n=[],r=0;r<t.length;)e=t[r++],km(n,Mm(e.key)+"="+Mm(e.value));return Sm(n,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Om=function(){Kp(this,Um),um(this,new Nm(arguments.length>0?arguments[0]:void 0))},Um=Om.prototype;if(Op(Um,{append:function(e,t){rm(arguments.length,2);var n=cm(this);km(n.entries,{key:qp(e),value:qp(t)}),n.updateURL()},delete:function(e){rm(arguments.length,1);for(var t=cm(this),n=t.entries,r=qp(e),i=0;i<n.length;)n[i].key===r?Em(n,i,1):i++;t.updateURL()},get:function(e){rm(arguments.length,1);for(var t=cm(this).entries,n=qp(e),r=0;r<t.length;r++)if(t[r].key===n)return t[r].value;return null},getAll:function(e){rm(arguments.length,1);for(var t=cm(this).entries,n=qp(e),r=[],i=0;i<t.length;i++)t[i].key===n&&km(r,t[i].value);return r},has:function(e){rm(arguments.length,1);for(var t=cm(this).entries,n=qp(e),r=0;r<t.length;)if(t[r++].key===n)return!0;return!1},set:function(e,t){rm(arguments.length,1);for(var n,r=cm(this),i=r.entries,a=!1,o=qp(e),s=qp(t),u=0;u<i.length;u++)(n=i[u]).key===o&&(a?Em(i,u--,1):(a=!0,n.value=s));a||km(i,{key:o,value:s}),r.updateURL()},sort:function(){var e=cm(this);im(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,n=cm(this).entries,r=Bp(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 Wm(this,"keys")},values:function(){return new Wm(this,"values")},entries:function(){return new Wm(this,"entries")}},{enumerable:!0}),Np(Um,am,Um.entries,{name:"entries"}),Np(Um,"toString",(function(){return cm(this).serialize()}),{enumerable:!0}),Up(Om,om),Pp({global:!0,constructor:!0,forced:!Wp},{URLSearchParams:Om}),!Wp&&Hp(mm)){var Fm=Dp(vm.has),Ym=Dp(vm.set),Km=function(e){if(Qp(e)){var t,n=e.body;if(Jp(n)===om)return t=e.headers?new mm(e.headers):new mm,Fm(t,"content-type")||Ym(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),$p(e,{body:em(0,qp(n)),headers:em(0,t)})}return e};if(Hp(fm)&&Pp({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return fm(e,arguments.length>1?Km(arguments[1]):{})}}),Hp(pm)){var Hm=function(e){return Kp(this,ym),new pm(e,arguments.length>1?Km(arguments[1]):{})};ym.constructor=Hm,Hm.prototype=ym,Pp({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Hm})}}var jm,Bm=pi,Jm=S,zm=Mf,Qm=A,qm=Cs,$m=W,ey=lr,ty=Of,ny=ds,ry=rt,iy=Mo,ay=tp,oy=sp,sy=hf.codeAt,uy=function(e){var t,n,r=[],i=_p(Ap(wp(e),dp,"."),".");for(t=0;t<i.length;t++)n=i[t],bp(r,pp(lp,n)?"xn--"+Tp(n):n);return gp(r,".")},cy=nf,ly=rs,dy=Vs,hy={URLSearchParams:Om,getState:cm},fy=Hn,py=fy.set,my=fy.getterFor("URL"),yy=hy.URLSearchParams,vy=hy.getState,gy=Qm.URL,by=Qm.TypeError,Ay=Qm.parseInt,_y=Math.floor,wy=Math.pow,Sy=$m("".charAt),ky=$m(/./.exec),Ty=$m([].join),xy=$m(1..toString),Ey=$m([].pop),Ly=$m([].push),Zy=$m("".replace),Iy=$m([].shift),Ry=$m("".split),Cy=$m("".slice),Gy=$m("".toLowerCase),Py=$m([].unshift),Xy="Invalid scheme",Vy="Invalid host",Dy="Invalid port",My=/[a-z]/i,Wy=/[\d+-.a-z]/i,Ny=/\d/,Oy=/^0x/i,Uy=/^[0-7]+$/,Fy=/^\d+$/,Yy=/^[\da-f]+$/i,Ky=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Hy=/[\0\t\n\r #/:<>?@[\\\]^|]/,jy=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,By=/[\t\n\r]/g,Jy=function(e){var t,n,r,i;if("number"==typeof e){for(t=[],n=0;n<4;n++)Py(t,e%256),e=_y(e/256);return Ty(t,".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,n=1,r=null,i=0,a=0;a<8;a++)0!==e[a]?(i>n&&(t=r,n=i),r=null,i=0):(null===r&&(r=a),++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+=xy(e[n],16),n<7&&(t+=":")));return"["+t+"]"}return e},zy={},Qy=iy({},zy,{" ":1,'"':1,"<":1,">":1,"`":1}),qy=iy({},Qy,{"#":1,"?":1,"{":1,"}":1}),$y=iy({},qy,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),ev=function(e,t){var n=sy(e,0);return n>32&&n<127&&!ry(t,e)?e:encodeURIComponent(e)},tv={ftp:21,file:null,http:80,https:443,ws:80,wss:443},nv=function(e,t){var n;return 2==e.length&&ky(My,Sy(e,0))&&(":"==(n=Sy(e,1))||!t&&"|"==n)},rv=function(e){var t;return e.length>1&&nv(Cy(e,0,2))&&(2==e.length||"/"===(t=Sy(e,2))||"\\"===t||"?"===t||"#"===t)},iv=function(e){return"."===e||"%2e"===Gy(e)},av={},ov={},sv={},uv={},cv={},lv={},dv={},hv={},fv={},pv={},mv={},yv={},vv={},gv={},bv={},Av={},_v={},wv={},Sv={},kv={},Tv={},xv=function(e,t,n){var r,i,a,o=cy(e);if(t){if(i=this.parse(o))throw by(i);this.searchParams=null}else{if(void 0!==n&&(r=new xv(n,!0)),i=this.parse(o,null,r))throw by(i);(a=vy(new yy)).bindURL(this),this.searchParams=a}};xv.prototype={type:"URL",parse:function(e,t,n){var r,i,a,o,s,u=this,c=t||av,l=0,d="",h=!1,f=!1,p=!1;for(e=cy(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=Zy(e,jy,"")),e=Zy(e,By,""),r=ay(e);l<=r.length;){switch(i=r[l],c){case av:if(!i||!ky(My,i)){if(t)return Xy;c=sv;continue}d+=Gy(i),c=ov;break;case ov:if(i&&(ky(Wy,i)||"+"==i||"-"==i||"."==i))d+=Gy(i);else{if(":"!=i){if(t)return Xy;d="",c=sv,l=0;continue}if(t&&(u.isSpecial()!=ry(tv,d)||"file"==d&&(u.includesCredentials()||null!==u.port)||"file"==u.scheme&&!u.host))return;if(u.scheme=d,t)return void(u.isSpecial()&&tv[u.scheme]==u.port&&(u.port=null));d="","file"==u.scheme?c=gv:u.isSpecial()&&n&&n.scheme==u.scheme?c=uv:u.isSpecial()?c=hv:"/"==r[l+1]?(c=cv,l++):(u.cannotBeABaseURL=!0,Ly(u.path,""),c=Sv)}break;case sv:if(!n||n.cannotBeABaseURL&&"#"!=i)return Xy;if(n.cannotBeABaseURL&&"#"==i){u.scheme=n.scheme,u.path=oy(n.path),u.query=n.query,u.fragment="",u.cannotBeABaseURL=!0,c=Tv;break}c="file"==n.scheme?gv:lv;continue;case uv:if("/"!=i||"/"!=r[l+1]){c=lv;continue}c=fv,l++;break;case cv:if("/"==i){c=pv;break}c=wv;continue;case lv:if(u.scheme=n.scheme,i==jm)u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=oy(n.path),u.query=n.query;else if("/"==i||"\\"==i&&u.isSpecial())c=dv;else if("?"==i)u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=oy(n.path),u.query="",c=kv;else{if("#"!=i){u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=oy(n.path),u.path.length--,c=wv;continue}u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=oy(n.path),u.query=n.query,u.fragment="",c=Tv}break;case dv:if(!u.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,c=wv;continue}c=pv}else c=fv;break;case hv:if(c=fv,"/"!=i||"/"!=Sy(d,l+1))continue;l++;break;case fv:if("/"!=i&&"\\"!=i){c=pv;continue}break;case pv:if("@"==i){h&&(d="%40"+d),h=!0,a=ay(d);for(var m=0;m<a.length;m++){var y=a[m];if(":"!=y||p){var v=ev(y,$y);p?u.password+=v:u.username+=v}else p=!0}d=""}else if(i==jm||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(h&&""==d)return"Invalid authority";l-=ay(d).length+1,d="",c=mv}else d+=i;break;case mv:case yv:if(t&&"file"==u.scheme){c=Av;continue}if(":"!=i||f){if(i==jm||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(u.isSpecial()&&""==d)return Vy;if(t&&""==d&&(u.includesCredentials()||null!==u.port))return;if(o=u.parseHost(d))return o;if(d="",c=_v,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),d+=i}else{if(""==d)return Vy;if(o=u.parseHost(d))return o;if(d="",c=vv,t==yv)return}break;case vv:if(!ky(Ny,i)){if(i==jm||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()||t){if(""!=d){var g=Ay(d,10);if(g>65535)return Dy;u.port=u.isSpecial()&&g===tv[u.scheme]?null:g,d=""}if(t)return;c=_v;continue}return Dy}d+=i;break;case gv:if(u.scheme="file","/"==i||"\\"==i)c=bv;else{if(!n||"file"!=n.scheme){c=wv;continue}if(i==jm)u.host=n.host,u.path=oy(n.path),u.query=n.query;else if("?"==i)u.host=n.host,u.path=oy(n.path),u.query="",c=kv;else{if("#"!=i){rv(Ty(oy(r,l),""))||(u.host=n.host,u.path=oy(n.path),u.shortenPath()),c=wv;continue}u.host=n.host,u.path=oy(n.path),u.query=n.query,u.fragment="",c=Tv}}break;case bv:if("/"==i||"\\"==i){c=Av;break}n&&"file"==n.scheme&&!rv(Ty(oy(r,l),""))&&(nv(n.path[0],!0)?Ly(u.path,n.path[0]):u.host=n.host),c=wv;continue;case Av:if(i==jm||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&nv(d))c=wv;else if(""==d){if(u.host="",t)return;c=_v}else{if(o=u.parseHost(d))return o;if("localhost"==u.host&&(u.host=""),t)return;d="",c=_v}continue}d+=i;break;case _v:if(u.isSpecial()){if(c=wv,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=jm&&(c=wv,"/"!=i))continue}else u.fragment="",c=Tv;else u.query="",c=kv;break;case wv:if(i==jm||"/"==i||"\\"==i&&u.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=Gy(s=d))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(u.shortenPath(),"/"==i||"\\"==i&&u.isSpecial()||Ly(u.path,"")):iv(d)?"/"==i||"\\"==i&&u.isSpecial()||Ly(u.path,""):("file"==u.scheme&&!u.path.length&&nv(d)&&(u.host&&(u.host=""),d=Sy(d,0)+":"),Ly(u.path,d)),d="","file"==u.scheme&&(i==jm||"?"==i||"#"==i))for(;u.path.length>1&&""===u.path[0];)Iy(u.path);"?"==i?(u.query="",c=kv):"#"==i&&(u.fragment="",c=Tv)}else d+=ev(i,qy);break;case Sv:"?"==i?(u.query="",c=kv):"#"==i?(u.fragment="",c=Tv):i!=jm&&(u.path[0]+=ev(i,zy));break;case kv:t||"#"!=i?i!=jm&&("'"==i&&u.isSpecial()?u.query+="%27":u.query+="#"==i?"%23":ev(i,zy)):(u.fragment="",c=Tv);break;case Tv:i!=jm&&(u.fragment+=ev(i,Qy))}l++}},parseHost:function(e){var t,n,r;if("["==Sy(e,0)){if("]"!=Sy(e,e.length-1))return Vy;if(t=function(e){var t,n,r,i,a,o,s,u=[0,0,0,0,0,0,0,0],c=0,l=null,d=0,h=function(){return Sy(e,d)};if(":"==h()){if(":"!=Sy(e,1))return;d+=2,l=++c}for(;h();){if(8==c)return;if(":"!=h()){for(t=n=0;n<4&&ky(Yy,h());)t=16*t+Ay(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(!ky(Ny,h()))return;for(;ky(Ny,h());){if(a=Ay(h(),10),null===i)i=a;else{if(0==i)return;i=10*i+a}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(o=c-l,c=7;0!=c&&o>0;)s=u[c],u[c--]=u[l+o-1],u[l+--o]=s;else if(8!=c)return;return u}(Cy(e,1,-1)),!t)return Vy;this.host=t}else if(this.isSpecial()){if(e=uy(e),ky(Ky,e))return Vy;if(t=function(e){var t,n,r,i,a,o,s,u=Ry(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(a=10,i.length>1&&"0"==Sy(i,0)&&(a=ky(Oy,i)?16:8,i=Cy(i,8==a?1:2)),""===i)o=0;else{if(!ky(10==a?Fy:8==a?Uy:Yy,i))return e;o=Ay(i,a)}Ly(n,o)}for(r=0;r<t;r++)if(o=n[r],r==t-1){if(o>=wy(256,5-t))return null}else if(o>255)return null;for(s=Ey(n),r=0;r<n.length;r++)s+=n[r]*wy(256,3-r);return s}(e),null===t)return Vy;this.host=t}else{if(ky(Hy,e))return Vy;for(t="",n=ay(e),r=0;r<n.length;r++)t+=ev(n[r],zy);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return ry(tv,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&nv(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,n=e.username,r=e.password,i=e.host,a=e.port,o=e.path,s=e.query,u=e.fragment,c=t+":";return null!==i?(c+="//",e.includesCredentials()&&(c+=n+(r?":"+r:"")+"@"),c+=Jy(i),null!==a&&(c+=":"+a)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?o[0]:o.length?"/"+Ty(o,"/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},setHref:function(e){var t=this.parse(e);if(t)throw by(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new Ev(e.path[0]).origin}catch(S0){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+Jy(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(cy(e)+":",av)},getUsername:function(){return this.username},setUsername:function(e){var t=ay(cy(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var n=0;n<t.length;n++)this.username+=ev(t[n],$y)}},getPassword:function(){return this.password},setPassword:function(e){var t=ay(cy(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var n=0;n<t.length;n++)this.password+=ev(t[n],$y)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?Jy(e):Jy(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,mv)},getHostname:function(){var e=this.host;return null===e?"":Jy(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,yv)},getPort:function(){var e=this.port;return null===e?"":cy(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=cy(e))?this.port=null:this.parse(e,vv))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+Ty(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,_v))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=cy(e))?this.query=null:("?"==Sy(e,0)&&(e=Cy(e,1)),this.query="",this.parse(e,kv)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=cy(e))?("#"==Sy(e,0)&&(e=Cy(e,1)),this.fragment="",this.parse(e,Tv)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Ev=function(e){var t=ny(this,Lv),n=dy(arguments.length,1)>1?arguments[1]:void 0,r=py(t,new xv(e,!1,n));Jm||(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())},Lv=Ev.prototype,Zv=function(e,t){return{get:function(){return my(this)[e]()},set:t&&function(e){return my(this)[t](e)},configurable:!0,enumerable:!0}};if(Jm&&(ty(Lv,"href",Zv("serialize","setHref")),ty(Lv,"origin",Zv("getOrigin")),ty(Lv,"protocol",Zv("getProtocol","setProtocol")),ty(Lv,"username",Zv("getUsername","setUsername")),ty(Lv,"password",Zv("getPassword","setPassword")),ty(Lv,"host",Zv("getHost","setHost")),ty(Lv,"hostname",Zv("getHostname","setHostname")),ty(Lv,"port",Zv("getPort","setPort")),ty(Lv,"pathname",Zv("getPathname","setPathname")),ty(Lv,"search",Zv("getSearch","setSearch")),ty(Lv,"searchParams",Zv("getSearchParams")),ty(Lv,"hash",Zv("getHash","setHash"))),ey(Lv,"toJSON",(function(){return my(this).serialize()}),{enumerable:!0}),ey(Lv,"toString",(function(){return my(this).serialize()}),{enumerable:!0}),gy){var Iv=gy.createObjectURL,Rv=gy.revokeObjectURL;Iv&&ey(Ev,"createObjectURL",qm(Iv,gy)),Rv&&ey(Ev,"revokeObjectURL",qm(Rv,gy))}ly(Ev,"URL"),Bm({global:!0,constructor:!0,forced:!zm,sham:!Jm},{URL:Ev});var Cv=Cs,Gv=B,Pv=et,Xv=Tr,Vv=qi,Dv=W([].push),Mv=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,a=6==e,o=7==e,s=5==e||a;return function(u,c,l,d){for(var h,f,p=Pv(u),m=Gv(p),y=Cv(c,l),v=Xv(m),g=0,b=d||Vv,A=t?b(u,v):n||o?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:Dv(A,h)}else switch(e){case 4:return!1;case 7:Dv(A,h)}return a?-1:r||i?i:A}},Wv={forEach:Mv(0),map:Mv(1),filter:Mv(2),some:Mv(3),every:Mv(4),find:Mv(5),findIndex:Mv(6),filterReject:Mv(7)},Nv=w,Ov=function(e,t){var n=[][e];return!!n&&Nv((function(){n.call(null,t||function(){return 1},1)}))},Uv=Wv.forEach,Fv=Ov("forEach")?[].forEach:function(e){return Uv(this,e,arguments.length>1?arguments[1]:void 0)},Yv=A,Kv=_f,Hv=kf,jv=Fv,Bv=dn,Jv=function(e){if(e&&e.forEach!==jv)try{Bv(e,"forEach",jv)}catch(S0){e.forEach=jv}};for(var zv in Kv)Kv[zv]&&Jv(Yv[zv]&&Yv[zv].prototype);Jv(Hv);var Qv=et,qv=To;pi({target:"Object",stat:!0,forced:w((function(){qv(1)}))},{keys:function(e){return qv(Qv(e))}});var $v=pi,eg=yi,tg=Ki,ng=ue,rg=Ar,ig=Tr,ag=te,og=wi,sg=gt,ug=Ps,cg=na("slice"),lg=sg("species"),dg=Array,hg=Math.max;$v({target:"Array",proto:!0,forced:!cg},{slice:function(e,t){var n,r,i,a=ag(this),o=ig(a),s=rg(e,o),u=rg(void 0===t?o:t,o);if(eg(a)&&(n=a.constructor,(tg(n)&&(n===dg||eg(n.prototype))||ng(n)&&null===(n=n[lg]))&&(n=void 0),n===dg||void 0===n))return ug(a,s,u);for(r=new(void 0===n?dg:n)(hg(u-s,0)),i=0;s<u;s++,i++)s in a&&og(r,i,a[s]);return r.length=i,r}});var fg=S,pg=yi,mg=TypeError,yg=Object.getOwnPropertyDescriptor,vg=fg&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(S0){return S0 instanceof TypeError}}(),gg=Re,bg=TypeError,Ag=function(e,t){if(!delete e[t])throw bg("Cannot delete property "+gg(t)+" of "+gg(e))},_g=pi,wg=et,Sg=Ar,kg=yr,Tg=Tr,xg=vg?function(e,t){if(pg(e)&&!yg(e,"length").writable)throw mg("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},Eg=gi,Lg=qi,Zg=wi,Ig=Ag,Rg=na("splice"),Cg=Math.max,Gg=Math.min;_g({target:"Array",proto:!0,forced:!Rg},{splice:function(e,t){var n,r,i,a,o,s,u=wg(this),c=Tg(u),l=Sg(e,c),d=arguments.length;for(0===d?n=r=0:1===d?(n=0,r=c-l):(n=d-2,r=Gg(Cg(kg(t),0),c-l)),Eg(c+n-r),i=Lg(u,r),a=0;a<r;a++)(o=l+a)in u&&Zg(i,a,u[o]);if(i.length=r,n<r){for(a=l;a<c-r;a++)s=a+n,(o=a+r)in u?u[s]=u[o]:Ig(u,s);for(a=c;a>c-r+n;a--)Ig(u,a-1)}else if(n>r)for(a=c-r;a>l;a--)s=a+n-1,(o=a+r-1)in u?u[s]=u[o]:Ig(u,s);for(a=0;a<n;a++)u[a+l]=arguments[a+2];return xg(u,c-r+n),i}});var Pg,Xg,Vg=zt,Dg=function(){var e=Vg(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},Mg=w,Wg=A.RegExp,Ng=Mg((function(){var e=Wg("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),Og=Ng||Mg((function(){return!Wg("a","y").sticky})),Ug=Ng||Mg((function(){var e=Wg("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),Fg={BROKEN_CARET:Ug,MISSED_STICKY:Og,UNSUPPORTED_Y:Ng},Yg=w,Kg=A.RegExp,Hg=Yg((function(){var e=Kg(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),jg=w,Bg=A.RegExp,Jg=jg((function(){var e=Bg("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),zg=E,Qg=W,qg=nf,$g=Dg,eb=Fg,tb=Nd,nb=Hn.get,rb=Hg,ib=Jg,ab=Qe("native-string-replace",String.prototype.replace),ob=RegExp.prototype.exec,sb=ob,ub=Qg("".charAt),cb=Qg("".indexOf),lb=Qg("".replace),db=Qg("".slice),hb=(Xg=/b*/g,zg(ob,Pg=/a/,"a"),zg(ob,Xg,"a"),0!==Pg.lastIndex||0!==Xg.lastIndex),fb=eb.BROKEN_CARET,pb=void 0!==/()??/.exec("")[1];(hb||pb||fb||rb||ib)&&(sb=function(e){var t,n,r,i,a,o,s,u=this,c=nb(u),l=qg(e),d=c.raw;if(d)return d.lastIndex=u.lastIndex,t=zg(sb,d,l),u.lastIndex=d.lastIndex,t;var h=c.groups,f=fb&&u.sticky,p=zg($g,u),m=u.source,y=0,v=l;if(f&&(p=lb(p,"y",""),-1===cb(p,"g")&&(p+="g"),v=db(l,u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==ub(l,u.lastIndex-1))&&(m="(?: "+m+")",v=" "+v,y++),n=new RegExp("^(?:"+m+")",p)),pb&&(n=new RegExp("^"+m+"$(?!\\s)",p)),hb&&(r=u.lastIndex),i=zg(ob,f?n:u,v),f?i?(i.input=db(i.input,y),i[0]=db(i[0],y),i.index=u.lastIndex,u.lastIndex+=i[0].length):u.lastIndex=0:hb&&i&&(u.lastIndex=u.global?i.index+i[0].length:r),pb&&i&&i.length>1&&zg(ab,i[0],n,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&h)for(i.groups=o=tb(null),a=0;a<h.length;a++)o[(s=h[a])[0]]=i[s[1]];return i});var mb=sb;function yb(){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 vb(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}pi({target:"RegExp",proto:!0,forced:/./.exec!==mb},{exec:mb});var gb,bb=function(){function e(){ao(this,e)}return so(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(S0){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var n=[],r=0,i=e.length;r<i;r++){var a=n.length;if(a&&t){var o=n[a-1],s=o[1];if(e.start(r)-s<=t){var u=e.end(r);u>s&&(o[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,a=0,o=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],a=p[1],o=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:a,index:o,buffers:d,nextStart:s,nextEnd:u,prevStart:c,prevEnd:l,currentTime:n,behind:n-i,remaining:a?a-n:0,length:e.totalLength&&e.totalLength(d)}}}]),e}(),Ab="manifest",_b="network",wb="network_timeout",Sb="demux",kb="remux",Tb="media",xb="other",Eb={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"},Lb=(uo(gb={},Ab,{HLS:1100}),uo(gb,_b,2100),uo(gb,wb,2101),uo(gb,Sb,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400}),uo(gb,kb,{FMP4:4100,MP4:4200}),uo(gb,Tb,{MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203}),uo(gb,xb,8e3),gb),Zb=function(e){co(n,e);var t=go(n);function n(e,r,i,a,o){var s;return ao(this,n),(s=t.call(this,o||(null==i?void 0:i.message))).errorType=e===wb?_b:e,s.originError=i,s.ext=a,s.errorCode=Lb[e][r]||Lb[e],s.errorMessage=s.message,s.errorCode||(s.errorType=xb,s.errorCode=Lb[s.errorType]),s}return so(n,null,[{key:"create",value:function(e,t,r,i,a){return e instanceof n?e:(e instanceof Error&&(r=e,e=""),e||(e=xb),new n(e,t,r,i,a))}},{key:"network",value:function(e){var t;return new n(null!=e&&e.isTimeout?wb:_b,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}(mo(Error)),Ib="undefined"!=typeof window,Rb=S,Cb=gn.EXISTS,Gb=W,Pb=Kt.f,Xb=Function.prototype,Vb=Gb(Xb.toString),Db=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,Mb=Gb(Db.exec);Rb&&!Cb&&Pb(Xb,"name",{configurable:!0,get:function(){try{return Mb(Db,Vb(this))[1]}catch(S0){return""}}});var Wb=Wv.map;pi({target:"Array",proto:!0,forced:!na("map")},{map:function(e){return Wb(this,e,arguments.length>1?arguments[1]:void 0)}});var Nb=pi,Ob=de,Ub=Ts,Fb=E,Yb=W,Kb=w,Hb=yi,jb=ae,Bb=ue,Jb=Ze,zb=Ps,Qb=Se,qb=Ob("JSON","stringify"),$b=Yb(/./.exec),eA=Yb("".charAt),tA=Yb("".charCodeAt),nA=Yb("".replace),rA=Yb(1..toString),iA=/[\uD800-\uDFFF]/g,aA=/^[\uD800-\uDBFF]$/,oA=/^[\uDC00-\uDFFF]$/,sA=!Qb||Kb((function(){var e=Ob("Symbol")();return"[null]"!=qb([e])||"{}"!=qb({a:e})||"{}"!=qb(Object(e))})),uA=Kb((function(){return'"\\udf06\\ud834"'!==qb("\udf06\ud834")||'"\\udead"'!==qb("\udead")})),cA=function(e,t){var n=zb(arguments),r=t;if((Bb(t)||void 0!==e)&&!Jb(e))return Hb(t)||(t=function(e,t){if(jb(r)&&(t=Fb(r,this,e,t)),!Jb(t))return t}),n[1]=t,Ub(qb,null,n)},lA=function(e,t,n){var r=eA(n,t-1),i=eA(n,t+1);return $b(aA,e)&&!$b(oA,i)||$b(oA,e)&&!$b(aA,r)?"\\u"+rA(tA(e,0),16):e};qb&&Nb({target:"JSON",stat:!0,arity:3,forced:sA||uA},{stringify:function(e,t,n){var r=zb(arguments),i=Ub(sA?cA:qb,null,r);return uA&&"string"==typeof i?nA(i,iA,lA):i}});var dA=pi,hA=B,fA=te,pA=Ov,mA=W([].join),yA=hA!=Object,vA=pA("join",",");dA({target:"Array",proto:!0,forced:yA||!vA},{join:function(e){return mA(fA(this),void 0===e?",":e)}});var gA=Ir.includes,bA=Jd;pi({target:"Array",proto:!0,forced:w((function(){return!Array(1).includes()}))},{includes:function(e){return gA(this,e,arguments.length>1?arguments[1]:void 0)}}),bA("includes");var AA={DEBUG:1,LOG:2,WARN:3,ERROR:4},_A=["Boolean","Number","String","Undefined","Null","Date","Object"],wA=function(){function e(t,n){ao(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 so(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,[AA.DEBUG].concat(r)),e.disabled||(t=console).debug.apply(t,[this._prefix,SA()].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,[AA.LOG].concat(r)),e.disabled||(t=console).log.apply(t,[this._prefix,SA()].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,[AA.WARN].concat(r)),e.disabled||(t=console).warn.apply(t,[this._prefix,SA()].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,[AA.ERROR].concat(r)),e.disabled||(t=console).error.apply(t,[this._prefix,SA()].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 a=r.map((function(e){return TA(e)}));t=this._prefix+SA()+JSON.stringify(a)}catch(s){return}if(e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var o=this.logTextArray.shift();this.logSize-=o.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 SA(){return(new Date).toLocaleString()}function kA(e){if("object"!==no(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 TA(e,t,n){n||(n=1),t||(t=2);var r={};if(!e||"object"!==no(e))return e;var i=Object.prototype.toString.call(e).slice(8,-1);if(!_A.includes(i))return i;if(!(n>t)){for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n===t?r[a]=kA(e[a]):"object"===no(e[a])?r[a]=TA(e[a],t,n+1):r[a]=e[a]);return r}}uo(wA,"disabled",!0);var xA=function(){try{return Ib?window.MediaSource:null}catch(e){}}(),EA="appendBuffer",LA="removeBuffer",ZA=function(){function e(t,n){var r=this;ao(this,e),uo(this,"media",null),uo(this,"mediaSource",null),uo(this,"_openPromise",yb()),uo(this,"_queue",Object.create(null)),uo(this,"_sourceBuffer",Object.create(null)),uo(this,"_mseFullFlag",{}),uo(this,"_st",0),uo(this,"_opst",0),uo(this,"_logger",null),uo(this,"_config",null),uo(this,"_url",null),uo(this,"_onSBUpdateEnd",(function(e){var t=r._queue[e];if(t){var n=t.shift();if(n){var i=vb()-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)}}})),uo(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 Zb(Tb,Eb.MSE_APPEND_BUFFER,t)))}})),this._config=Object.assign(e.getDefaultConfig(),n),t&&this.bindMedia(t),this._logger=new wA("MSE"),this._config.openLog&&wA.enable()}var t,n,r;return so(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=vb()-e._st;e._logger.debug("MSE OPEN",r),t.removeEventListener("sourceopen",n),e._openPromise.resolve({costtime:r})})),this._openPromise=yb()}return this._openPromise}},{key:"bindMedia",value:(r=io(to().mark((function e(t){var n,r,i=this;return to().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&&xA){e.next=5;break}throw new Error("Param media or MediaSource does not exist");case 5:return this.media=t,n=this.mediaSource=new xA,this._st=vb(),r=function e(){var r=vb()-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=io(to().mark((function e(){var t,n,r,i=this;return to().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(S0){}Object.keys(this._sourceBuffer).forEach((function(e){try{t.removeSourceBuffer(i._sourceBuffer[e])}catch(S0){}}))}if(this.media){this.media.removeAttribute("src");try{this.media.load()}catch(S0){}this.media=null}this.mediaSource=null,this._openPromise=yb(),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(S0){throw new Zb(Tb,Eb.MSE_ADD_SB,S0)}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=vb(),null===(i=r._sourceBuffer[e])||void 0===i||i.appendBuffer(t))}),EA,n):Promise.resolve()}},{key:"remove",value:function(e,t,n,r){var i=this,a=!1;return this._mseFullFlag[e]&&(a=!0),this._enqueueOp(e,(function(){if(i.mediaSource){var a=i._sourceBuffer[e];t>=n||!a?i._onSBUpdateEnd(e):(i._opst=vb(),i._logger.debug("MSE REMOVE START",e,t,n,r),a.remove(t,n))}}),LA,r,a)}},{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,bb.end(bb.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 bb.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return bb.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return bb.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,t,n,r,i){var a=this;if(!this.mediaSource)return Promise.resolve();var o=this._queue[e]=this._queue[e]||[],s={exec:t,promise:yb(),opName:n,context:r};return i?(o.splice(0,0,s),this._mseFullFlag[e]=!1,this._startQueue(e)):o.push(s),this.isOpened?1===o.length&&this._startQueue(e):this._openPromise.then((function(){1===o.length&&a._startQueue(e)})),s.promise}},{key:"_enqueueBlockingOp",value:(t=io(to().mark((function e(t,n){var r,i,a=this;return to().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=a._queue[e],r=yb();i.push(r),t.push({exec:function(){return r.resolve()},promise:r,opName:n}),1===t.length&&a._startQueue(e)})),e.abrupt("return",Promise.all(i).then((function(){try{return t()}finally{r.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){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(S0){S0&&S0.message&&S0.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 Zb(Tb,Eb.MSE_FULL,S0))):(this._logger.error(S0),n.promise.reject(new Zb(Tb,Eb.MSE_OTHER,S0)),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(!xA)return!1;try{return xA.isTypeSupported(e)}catch(S0){return this._logger.error(e,S0),!1}}}]),e}();uo(ZA,"VIDEO","video"),uo(ZA,"AUDIO","audio");var IA=pi,RA=Ou,CA=w,GA=de,PA=ae,XA=As,VA=md,DA=lr,MA=RA&&RA.prototype;if(IA({target:"Promise",proto:!0,real:!0,forced:!!RA&&CA((function(){MA.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=XA(this,GA("Promise")),n=PA(e);return this.then(n?function(n){return VA(t,e()).then((function(){return n}))}:e,n?function(n){return VA(t,e()).then((function(){throw n}))}:e)}}),PA(RA)){var WA=GA("Promise").prototype.finally;MA.finally!==WA&&DA(MA,"finally",WA,{unsafe:!0})}var NA=Wv.filter;pi({target:"Array",proto:!0,forced:!na("filter")},{filter:function(e){return NA(this,e,arguments.length>1?arguments[1]:void 0)}});var OA,UA,FA,YA={exports:{}},KA="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,HA=KA,jA=S,BA=A,JA=ae,zA=ue,QA=rt,qA=Ri,$A=Re,e_=dn,t_=lr,n_=Kt.f,r_=he,i_=ih,a_=$o,o_=gt,s_=ut,u_=Hn.enforce,c_=Hn.get,l_=BA.Int8Array,d_=l_&&l_.prototype,h_=BA.Uint8ClampedArray,f_=h_&&h_.prototype,p_=l_&&i_(l_),m_=d_&&i_(d_),y_=Object.prototype,v_=BA.TypeError,g_=o_("toStringTag"),b_=s_("TYPED_ARRAY_TAG"),A_="TypedArrayConstructor",__=HA&&!!a_&&"Opera"!==qA(BA.opera),w_=!1,S_={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},k_={BigInt64Array:8,BigUint64Array:8},T_=function(e){var t=i_(e);if(zA(t)){var n=c_(t);return n&&QA(n,A_)?n[A_]:T_(t)}},x_=function(e){if(!zA(e))return!1;var t=qA(e);return QA(S_,t)||QA(k_,t)};for(OA in S_)(FA=(UA=BA[OA])&&UA.prototype)?u_(FA)[A_]=UA:__=!1;for(OA in k_)(FA=(UA=BA[OA])&&UA.prototype)&&(u_(FA)[A_]=UA);if((!__||!JA(p_)||p_===Function.prototype)&&(p_=function(){throw v_("Incorrect invocation")},__))for(OA in S_)BA[OA]&&a_(BA[OA],p_);if((!__||!m_||m_===y_)&&(m_=p_.prototype,__))for(OA in S_)BA[OA]&&a_(BA[OA].prototype,m_);if(__&&i_(f_)!==m_&&a_(f_,m_),jA&&!QA(m_,g_))for(OA in w_=!0,n_(m_,g_,{get:function(){return zA(this)?this[b_]:void 0}}),S_)BA[OA]&&e_(BA[OA],b_,OA);var E_={NATIVE_ARRAY_BUFFER_VIEWS:__,TYPED_ARRAY_TAG:w_&&b_,aTypedArray:function(e){if(x_(e))return e;throw v_("Target is not a typed array")},aTypedArrayConstructor:function(e){if(JA(e)&&(!a_||r_(p_,e)))return e;throw v_($A(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n,r){if(jA){if(n)for(var i in S_){var a=BA[i];if(a&&QA(a.prototype,e))try{delete a.prototype[e]}catch(S0){try{a.prototype[e]=t}catch(o){}}}m_[e]&&!n||t_(m_,e,n?t:__&&d_[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,n){var r,i;if(jA){if(a_){if(n)for(r in S_)if((i=BA[r])&&QA(i,e))try{delete i[e]}catch(S0){}if(p_[e]&&!n)return;try{return t_(p_,e,n?t:__&&p_[e]||t)}catch(S0){}}for(r in S_)!(i=BA[r])||i[e]&&!n||t_(i,e,t)}},getTypedArrayConstructor:T_,isView:function(e){if(!zA(e))return!1;var t=qA(e);return"DataView"===t||QA(S_,t)||QA(k_,t)},isTypedArray:x_,TypedArray:p_,TypedArrayPrototype:m_},L_=A,Z_=w,I_=Fl,R_=E_.NATIVE_ARRAY_BUFFER_VIEWS,C_=L_.ArrayBuffer,G_=L_.Int8Array,P_=!R_||!Z_((function(){G_(1)}))||!Z_((function(){new G_(-1)}))||!I_((function(e){new G_,new G_(null),new G_(1.5),new G_(e)}),!0)||Z_((function(){return 1!==new G_(new C_(2),1,void 0).length})),X_=yr,V_=Sr,D_=RangeError,M_=function(e){if(void 0===e)return 0;var t=X_(e),n=V_(t);if(t!==n)throw D_("Wrong length or index");return n},W_=Array,N_=Math.abs,O_=Math.pow,U_=Math.floor,F_=Math.log,Y_=Math.LN2,K_=et,H_=Ar,j_=Tr,B_=function(e){for(var t=K_(this),n=j_(t),r=arguments.length,i=H_(r>1?arguments[1]:void 0,n),a=r>2?arguments[2]:void 0,o=void 0===a?n:H_(a,n);o>i;)t[i++]=e;return t},J_=A,z_=W,Q_=S,q_=KA,$_=gn,ew=dn,tw=Ep,nw=w,rw=ds,iw=yr,aw=Sr,ow=M_,sw={pack:function(e,t,n){var r,i,a,o=W_(n),s=8*n-t-1,u=(1<<s)-1,c=u>>1,l=23===t?O_(2,-24)-O_(2,-77):0,d=e<0||0===e&&1/e<0?1:0,h=0;for((e=N_(e))!=e||e===1/0?(i=e!=e?1:0,r=u):(r=U_(F_(e)/Y_),e*(a=O_(2,-r))<1&&(r--,a*=2),(e+=r+c>=1?l/a:l*O_(2,1-c))*a>=2&&(r++,a/=2),r+c>=u?(i=0,r=u):r+c>=1?(i=(e*a-1)*O_(2,t),r+=c):(i=e*O_(2,c-1)*O_(2,t),r=0));t>=8;)o[h++]=255&i,i/=256,t-=8;for(r=r<<t|i,s+=t;s>0;)o[h++]=255&r,r/=256,s-=8;return o[--h]|=128*d,o},unpack:function(e,t){var n,r=e.length,i=8*r-t-1,a=(1<<i)-1,o=a>>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-o;else{if(l===a)return n?NaN:c?-1/0:1/0;n+=O_(2,t),l-=o}return(c?-1:1)*n*O_(2,l-t)}},uw=ih,cw=$o,lw=dr.f,dw=Kt.f,hw=B_,fw=sp,pw=rs,mw=$_.PROPER,yw=$_.CONFIGURABLE,vw=Hn.get,gw=Hn.set,bw="ArrayBuffer",Aw="DataView",_w="prototype",ww="Wrong index",Sw=J_[bw],kw=Sw,Tw=kw&&kw[_w],xw=J_[Aw],Ew=xw&&xw[_w],Lw=Object.prototype,Zw=J_.Array,Iw=J_.RangeError,Rw=z_(hw),Cw=z_([].reverse),Gw=sw.pack,Pw=sw.unpack,Xw=function(e){return[255&e]},Vw=function(e){return[255&e,e>>8&255]},Dw=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},Mw=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},Ww=function(e){return Gw(e,23,4)},Nw=function(e){return Gw(e,52,8)},Ow=function(e,t){dw(e[_w],t,{get:function(){return vw(this)[t]}})},Uw=function(e,t,n,r){var i=ow(n),a=vw(e);if(i+t>a.byteLength)throw Iw(ww);var o=vw(a.buffer).bytes,s=i+a.byteOffset,u=fw(o,s,s+t);return r?u:Cw(u)},Fw=function(e,t,n,r,i,a){var o=ow(n),s=vw(e);if(o+t>s.byteLength)throw Iw(ww);for(var u=vw(s.buffer).bytes,c=o+s.byteOffset,l=r(+i),d=0;d<t;d++)u[c+d]=l[a?d:t-d-1]};if(q_){var Yw=mw&&Sw.name!==bw;if(nw((function(){Sw(1)}))&&nw((function(){new Sw(-1)}))&&!nw((function(){return new Sw,new Sw(1.5),new Sw(NaN),1!=Sw.length||Yw&&!yw})))Yw&&yw&&ew(Sw,"name",bw);else{(kw=function(e){return rw(this,Tw),new Sw(ow(e))})[_w]=Tw;for(var Kw,Hw=lw(Sw),jw=0;Hw.length>jw;)(Kw=Hw[jw++])in kw||ew(kw,Kw,Sw[Kw]);Tw.constructor=kw}cw&&uw(Ew)!==Lw&&cw(Ew,Lw);var Bw=new xw(new kw(2)),Jw=z_(Ew.setInt8);Bw.setInt8(0,2147483648),Bw.setInt8(1,2147483649),!Bw.getInt8(0)&&Bw.getInt8(1)||tw(Ew,{setInt8:function(e,t){Jw(this,e,t<<24>>24)},setUint8:function(e,t){Jw(this,e,t<<24>>24)}},{unsafe:!0})}else Tw=(kw=function(e){rw(this,Tw);var t=ow(e);gw(this,{bytes:Rw(Zw(t),0),byteLength:t}),Q_||(this.byteLength=t)})[_w],Ew=(xw=function(e,t,n){rw(this,Ew),rw(e,Tw);var r=vw(e).byteLength,i=iw(t);if(i<0||i>r)throw Iw("Wrong offset");if(i+(n=void 0===n?r-i:aw(n))>r)throw Iw("Wrong length");gw(this,{buffer:e,byteLength:n,byteOffset:i}),Q_||(this.buffer=e,this.byteLength=n,this.byteOffset=i)})[_w],Q_&&(Ow(kw,"byteLength"),Ow(xw,"buffer"),Ow(xw,"byteLength"),Ow(xw,"byteOffset")),tw(Ew,{getInt8:function(e){return Uw(this,1,e)[0]<<24>>24},getUint8:function(e){return Uw(this,1,e)[0]},getInt16:function(e){var t=Uw(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=Uw(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return Mw(Uw(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return Mw(Uw(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return Pw(Uw(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return Pw(Uw(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){Fw(this,1,e,Xw,t)},setUint8:function(e,t){Fw(this,1,e,Xw,t)},setInt16:function(e,t){Fw(this,2,e,Vw,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){Fw(this,2,e,Vw,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){Fw(this,4,e,Dw,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){Fw(this,4,e,Dw,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){Fw(this,4,e,Ww,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){Fw(this,8,e,Nw,t,arguments.length>2?arguments[2]:void 0)}});pw(kw,bw),pw(xw,Aw);var zw={ArrayBuffer:kw,DataView:xw},Qw=ue,qw=Math.floor,$w=Number.isInteger||function(e){return!Qw(e)&&isFinite(e)&&qw(e)===e},eS=yr,tS=RangeError,nS=function(e){var t=eS(e);if(t<0)throw tS("The argument can't be less than 0");return t},rS=RangeError,iS=function(e,t){var n=nS(e);if(n%t)throw rS("Wrong offset");return n},aS=Ri,oS=W("".slice),sS=xt,uS=TypeError,cS=function(e){var t=sS(e,"number");if("number"==typeof t)throw uS("Can't convert number to bigint");return BigInt(t)},lS=Cs,dS=E,hS=ms,fS=et,pS=Tr,mS=Al,yS=fl,vS=sl,gS=function(e){return"Big"===oS(aS(e),0,3)},bS=E_.aTypedArrayConstructor,AS=cS,_S=ae,wS=ue,SS=$o,kS=function(e,t,n){var r,i;return SS&&_S(r=t.constructor)&&r!==n&&wS(i=r.prototype)&&i!==n.prototype&&SS(e,i),e},TS=pi,xS=A,ES=E,LS=S,ZS=P_,IS=E_,RS=zw,CS=ds,GS=P,PS=dn,XS=$w,VS=Sr,DS=M_,MS=iS,WS=Zt,NS=rt,OS=Ri,US=ue,FS=Ze,YS=Nd,KS=he,HS=$o,jS=dr.f,BS=function(e){var t,n,r,i,a,o,s,u,c=hS(this),l=fS(e),d=arguments.length,h=d>1?arguments[1]:void 0,f=void 0!==h,p=yS(l);if(p&&!vS(p))for(u=(s=mS(l,p)).next,l=[];!(o=dS(u,s)).done;)l.push(o.value);for(f&&d>2&&(h=lS(h,arguments[2])),n=pS(l),r=new(bS(c))(n),i=gS(r),t=0;n>t;t++)a=f?h(l[t],t):l[t],r[t]=i?AS(a):+a;return r},JS=Wv.forEach,zS=us,QS=Kt,qS=_,$S=kS,ek=Hn.get,tk=Hn.set,nk=Hn.enforce,rk=QS.f,ik=qS.f,ak=Math.round,ok=xS.RangeError,sk=RS.ArrayBuffer,uk=sk.prototype,ck=RS.DataView,lk=IS.NATIVE_ARRAY_BUFFER_VIEWS,dk=IS.TYPED_ARRAY_TAG,hk=IS.TypedArray,fk=IS.TypedArrayPrototype,pk=IS.aTypedArrayConstructor,mk=IS.isTypedArray,yk="BYTES_PER_ELEMENT",vk="Wrong length",gk=function(e,t){pk(e);for(var n=0,r=t.length,i=new e(r);r>n;)i[n]=t[n++];return i},bk=function(e,t){rk(e,t,{get:function(){return ek(this)[t]}})},Ak=function(e){var t;return KS(uk,e)||"ArrayBuffer"==(t=OS(e))||"SharedArrayBuffer"==t},_k=function(e,t){return mk(e)&&!FS(t)&&t in e&&XS(+t)&&t>=0},wk=function(e,t){return t=WS(t),_k(e,t)?GS(2,e[t]):ik(e,t)},Sk=function(e,t,n){return t=WS(t),!(_k(e,t)&&US(n)&&NS(n,"value"))||NS(n,"get")||NS(n,"set")||n.configurable||NS(n,"writable")&&!n.writable||NS(n,"enumerable")&&!n.enumerable?rk(e,t,n):(e[t]=n.value,e)};LS?(lk||(qS.f=wk,QS.f=Sk,bk(fk,"buffer"),bk(fk,"byteOffset"),bk(fk,"byteLength"),bk(fk,"length")),TS({target:"Object",stat:!0,forced:!lk},{getOwnPropertyDescriptor:wk,defineProperty:Sk}),YA.exports=function(e,t,n){var r=e.match(/\d+$/)[0]/8,i=e+(n?"Clamped":"")+"Array",a="get"+e,o="set"+e,s=xS[i],u=s,c=u&&u.prototype,l={},d=function(e,t){rk(e,t,{get:function(){return function(e,t){var n=ek(e);return n.view[a](t*r+n.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var a=ek(e);n&&(i=(i=ak(i))<0?0:i>255?255:255&i),a.view[o](t*r+a.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};lk?ZS&&(u=t((function(e,t,n,i){return CS(e,c),$S(US(t)?Ak(t)?void 0!==i?new s(t,MS(n,r),i):void 0!==n?new s(t,MS(n,r)):new s(t):mk(t)?gk(u,t):ES(BS,u,t):new s(DS(t)),e,u)})),HS&&HS(u,hk),JS(jS(s),(function(e){e in u||PS(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,n,i){CS(e,c);var a,o,s,l=0,h=0;if(US(t)){if(!Ak(t))return mk(t)?gk(u,t):ES(BS,u,t);a=t,h=MS(n,r);var f=t.byteLength;if(void 0===i){if(f%r)throw ok(vk);if((o=f-h)<0)throw ok(vk)}else if((o=VS(i)*r)+h>f)throw ok(vk);s=o/r}else s=DS(t),a=new sk(o=s*r);for(tk(e,{buffer:a,byteOffset:h,byteLength:o,length:s,view:new ck(a)});l<s;)d(e,l++)})),HS&&HS(u,hk),c=u.prototype=YS(fk)),c.constructor!==u&&PS(c,"constructor",u),nk(c).TypedArrayConstructor=u,dk&&PS(c,dk,i);var h=u!=s;l[i]=u,TS({global:!0,constructor:!0,forced:h,sham:!lk},l),yk in u||PS(u,yk,r),yk in c||PS(c,yk,r),zS(i)}):YA.exports=function(){};var kk=YA.exports;kk("Uint8",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var Tk=Tr,xk=yr,Ek=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("at",(function(e){var t=Ek(this),n=Tk(t),r=xk(e),i=r>=0?r:n+r;return i<0||i>=n?void 0:t[i]}));var Lk=et,Zk=Ar,Ik=Tr,Rk=Ag,Ck=Math.min,Gk=[].copyWithin||function(e,t){var n=Lk(this),r=Ik(n),i=Zk(e,r),a=Zk(t,r),o=arguments.length>2?arguments[2]:void 0,s=Ck((void 0===o?r:Zk(o,r))-a,r-i),u=1;for(a<i&&i<a+s&&(u=-1,a+=s-1,i+=s-1);s-- >0;)a in n?n[i]=n[a]:Rk(n,i),i+=u,a+=u;return n},Pk=E_,Xk=W(Gk),Vk=Pk.aTypedArray;(0,Pk.exportTypedArrayMethod)("copyWithin",(function(e,t){return Xk(Vk(this),e,t,arguments.length>2?arguments[2]:void 0)}));var Dk=Wv.every,Mk=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("every",(function(e){return Dk(Mk(this),e,arguments.length>1?arguments[1]:void 0)}));var Wk=B_,Nk=cS,Ok=Ri,Uk=E,Fk=w,Yk=E_.aTypedArray,Kk=E_.exportTypedArrayMethod,Hk=W("".slice);Kk("fill",(function(e){var t=arguments.length;Yk(this);var n="Big"===Hk(Ok(this),0,3)?Nk(e):+e;return Uk(Wk,this,n,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),Fk((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e})));var jk=Tr,Bk=As,Jk=E_.aTypedArrayConstructor,zk=E_.getTypedArrayConstructor,Qk=function(e){return Jk(Bk(e,zk(e)))},qk=function(e,t){for(var n=0,r=jk(t),i=new e(r);r>n;)i[n]=t[n++];return i},$k=Qk,eT=Wv.filter,tT=function(e,t){return qk($k(e),t)},nT=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("filter",(function(e){var t=eT(nT(this),e,arguments.length>1?arguments[1]:void 0);return tT(this,t)}));var rT=Wv.find,iT=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("find",(function(e){return rT(iT(this),e,arguments.length>1?arguments[1]:void 0)}));var aT=Wv.findIndex,oT=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("findIndex",(function(e){return aT(oT(this),e,arguments.length>1?arguments[1]:void 0)}));var sT=Cs,uT=B,cT=et,lT=Tr,dT=function(e){var t=1==e;return function(n,r,i){for(var a,o=cT(n),s=uT(o),u=sT(r,i),c=lT(s);c-- >0;)if(u(a=s[c],c,o))switch(e){case 0:return a;case 1:return c}return t?-1:void 0}},hT={findLast:dT(0),findLastIndex:dT(1)},fT=hT.findLast,pT=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("findLast",(function(e){return fT(pT(this),e,arguments.length>1?arguments[1]:void 0)}));var mT=hT.findLastIndex,yT=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("findLastIndex",(function(e){return mT(yT(this),e,arguments.length>1?arguments[1]:void 0)}));var vT=Wv.forEach,gT=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("forEach",(function(e){vT(gT(this),e,arguments.length>1?arguments[1]:void 0)}));var bT=Ir.includes,AT=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("includes",(function(e){return bT(AT(this),e,arguments.length>1?arguments[1]:void 0)}));var _T=Ir.indexOf,wT=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("indexOf",(function(e){return _T(wT(this),e,arguments.length>1?arguments[1]:void 0)}));var ST=A,kT=w,TT=W,xT=E_,ET=qh,LT=gt("iterator"),ZT=ST.Uint8Array,IT=TT(ET.values),RT=TT(ET.keys),CT=TT(ET.entries),GT=xT.aTypedArray,PT=xT.exportTypedArrayMethod,XT=ZT&&ZT.prototype,VT=!kT((function(){XT[LT].call([1])})),DT=!!XT&&XT.values&&XT[LT]===XT.values&&"values"===XT.values.name,MT=function(){return IT(GT(this))};PT("entries",(function(){return CT(GT(this))}),VT),PT("keys",(function(){return RT(GT(this))}),VT),PT("values",MT,VT||!DT,{name:"values"}),PT(LT,MT,VT||!DT,{name:"values"});var WT=E_.aTypedArray,NT=E_.exportTypedArrayMethod,OT=W([].join);NT("join",(function(e){return OT(WT(this),e)}));var UT=Ts,FT=te,YT=yr,KT=Tr,HT=Ov,jT=Math.min,BT=[].lastIndexOf,JT=!!BT&&1/[1].lastIndexOf(1,-0)<0,zT=HT("lastIndexOf"),QT=JT||!zT?function(e){if(JT)return UT(BT,this,arguments)||0;var t=FT(this),n=KT(t),r=n-1;for(arguments.length>1&&(r=jT(r,YT(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:BT,qT=Ts,$T=QT,ex=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return qT($T,ex(this),t>1?[e,arguments[1]]:[e])}));var tx=Wv.map,nx=Qk,rx=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("map",(function(e){return tx(rx(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(nx(e))(t)}))}));var ix=Xe,ax=et,ox=B,sx=Tr,ux=TypeError,cx=function(e){return function(t,n,r,i){ix(n);var a=ax(t),o=ox(a),s=sx(a),u=e?s-1:0,c=e?-1:1;if(r<2)for(;;){if(u in o){i=o[u],u+=c;break}if(u+=c,e?u<0:s<=u)throw ux("Reduce of empty array with no initial value")}for(;e?u>=0:s>u;u+=c)u in o&&(i=n(i,o[u],u,a));return i}},lx={left:cx(!1),right:cx(!0)},dx=lx.left,hx=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return dx(hx(this),e,t,t>1?arguments[1]:void 0)}));var fx=lx.right,px=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return fx(px(this),e,t,t>1?arguments[1]:void 0)}));var mx=E_.aTypedArray,yx=E_.exportTypedArrayMethod,vx=Math.floor;yx("reverse",(function(){for(var e,t=this,n=mx(t).length,r=vx(n/2),i=0;i<r;)e=t[i],t[i++]=t[--n],t[n]=e;return t}));var gx=A,bx=E,Ax=E_,_x=Tr,wx=iS,Sx=et,kx=w,Tx=gx.RangeError,xx=gx.Int8Array,Ex=xx&&xx.prototype,Lx=Ex&&Ex.set,Zx=Ax.aTypedArray,Ix=Ax.exportTypedArrayMethod,Rx=!kx((function(){var e=new Uint8ClampedArray(2);return bx(Lx,e,{length:1,0:3},1),3!==e[1]})),Cx=Rx&&Ax.NATIVE_ARRAY_BUFFER_VIEWS&&kx((function(){var e=new xx(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));Ix("set",(function(e){Zx(this);var t=wx(arguments.length>1?arguments[1]:void 0,1),n=Sx(e);if(Rx)return bx(Lx,this,n,t);var r=this.length,i=_x(n),a=0;if(i+t>r)throw Tx("Wrong length");for(;a<i;)this[t+a]=n[a++]}),!Rx||Cx);var Gx=Qk,Px=Ps,Xx=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("slice",(function(e,t){for(var n=Px(Xx(this),e,t),r=Gx(this),i=0,a=n.length,o=new r(a);a>i;)o[i]=n[i++];return o}),w((function(){new Int8Array(1).slice()})));var Vx=Wv.some,Dx=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("some",(function(e){return Vx(Dx(this),e,arguments.length>1?arguments[1]:void 0)}));var Mx=fe.match(/firefox\/(\d+)/i),Wx=!!Mx&&+Mx[1],Nx=/MSIE|Trident/.test(fe),Ox=fe.match(/AppleWebKit\/(\d+)\./),Ux=!!Ox&&+Ox[1],Fx=Ls,Yx=w,Kx=Xe,Hx=Gp,jx=Wx,Bx=Nx,Jx=Ae,zx=Ux,Qx=E_.aTypedArray,qx=E_.exportTypedArrayMethod,$x=A.Uint16Array,eE=$x&&Fx($x.prototype.sort),tE=!(!eE||Yx((function(){eE(new $x(2),null)}))&&Yx((function(){eE(new $x(2),{})}))),nE=!!eE&&!Yx((function(){if(Jx)return Jx<74;if(jx)return jx<67;if(Bx)return!0;if(zx)return zx<602;var e,t,n=new $x(516),r=Array(516);for(e=0;e<516;e++)t=e%4,n[e]=515-e,r[e]=e-2*t+3;for(eE(n,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(n[e]!==r[e])return!0}));qx("sort",(function(e){return void 0!==e&&Kx(e),nE?eE(this,e):Hx(Qx(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))}),!nE||tE);var rE=Sr,iE=Ar,aE=Qk,oE=E_.aTypedArray;(0,E_.exportTypedArrayMethod)("subarray",(function(e,t){var n=oE(this),r=n.length,i=iE(e,r);return new(aE(n))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,rE((void 0===t?r:iE(t,r))-i))}));var sE=Ts,uE=E_,cE=w,lE=Ps,dE=A.Int8Array,hE=uE.aTypedArray,fE=uE.exportTypedArrayMethod,pE=[].toLocaleString,mE=!!dE&&cE((function(){pE.call(new dE(1))}));fE("toLocaleString",(function(){return sE(pE,mE?lE(hE(this)):hE(this),lE(arguments))}),cE((function(){return[1,2].toLocaleString()!=new dE([1,2]).toLocaleString()}))||!cE((function(){dE.prototype.toLocaleString.call([1,2])})));var yE=E_.exportTypedArrayMethod,vE=w,gE=W,bE=A.Uint8Array,AE=bE&&bE.prototype||{},_E=[].toString,wE=gE([].join);vE((function(){_E.call({})}))&&(_E=function(){return wE(this)});var SE=AE.toString!=_E;yE("toString",_E,SE);var kE="fetch",TE="xhr",xE="arraybuffer",EE="text",LE="json",ZE=function(e){co(n,e);var t=go(n);function n(e,r,i,a){var o;return ao(this,n),uo(vo(o=t.call(this,a)),"retryCount",0),uo(vo(o),"isTimeout",!1),uo(vo(o),"loaderType",kE),uo(vo(o),"startTime",0),uo(vo(o),"endTime",0),uo(vo(o),"options",{}),o.url=e,o.request=r,o.response=i,o}return so(n)}(mo(Error)),IE=Ls,RE=lr,CE=mb,GE=w,PE=gt,XE=dn,VE=PE("species"),DE=RegExp.prototype,ME=function(e,t,n,r){var i=PE(e),a=!GE((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),o=a&&!GE((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[VE]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!a||!o||n){var s=IE(/./[i]),u=t(i,""[e],(function(e,t,n,r,i){var o=IE(e),u=t.exec;return u===CE||u===DE.exec?a&&!i?{done:!0,value:s(t,n,r)}:{done:!0,value:o(n,t,r)}:{done:!1}}));RE(String.prototype,e,u[0]),RE(DE,i,u[1])}r&&XE(DE[i],"sham",!0)},WE=hf.charAt,NE=function(e,t,n){return t+(n?WE(e,t).length:1)},OE=W,UE=et,FE=Math.floor,YE=OE("".charAt),KE=OE("".replace),HE=OE("".slice),jE=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,BE=/\$([$&'`]|\d{1,2})/g,JE=E,zE=zt,QE=ae,qE=F,$E=mb,eL=TypeError,tL=function(e,t){var n=e.exec;if(QE(n)){var r=JE(n,e,t);return null!==r&&zE(r),r}if("RegExp"===qE(e))return JE($E,e,t);throw eL("RegExp#exec called on incompatible receiver")},nL=Ts,rL=E,iL=W,aL=ME,oL=w,sL=zt,uL=ae,cL=J,lL=yr,dL=Sr,hL=nf,fL=q,pL=NE,mL=Me,yL=function(e,t,n,r,i,a){var o=n+e.length,s=r.length,u=BE;return void 0!==i&&(i=UE(i),u=jE),KE(a,u,(function(a,u){var c;switch(YE(u,0)){case"$":return"$";case"&":return e;case"`":return HE(t,0,n);case"'":return HE(t,o);case"<":c=i[HE(u,1,-1)];break;default:var l=+u;if(0===l)return a;if(l>s){var d=FE(l/10);return 0===d?a:d<=s?void 0===r[d-1]?YE(u,1):r[d-1]+YE(u,1):a}c=r[l-1]}return void 0===c?"":c}))},vL=tL,gL=gt("replace"),bL=Math.max,AL=Math.min,_L=iL([].concat),wL=iL([].push),SL=iL("".indexOf),kL=iL("".slice),TL="$0"==="a".replace(/./,"$0"),xL=!!/./[gL]&&""===/./[gL]("a","$0"),EL=!oL((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));aL("replace",(function(e,t,n){var r=xL?"$":"$0";return[function(e,n){var r=fL(this),i=cL(e)?void 0:mL(e,gL);return i?rL(i,e,r,n):rL(t,hL(r),e,n)},function(e,i){var a=sL(this),o=hL(e);if("string"==typeof i&&-1===SL(i,r)&&-1===SL(i,"$<")){var s=n(t,a,o,i);if(s.done)return s.value}var u=uL(i);u||(i=hL(i));var c=a.global;if(c){var l=a.unicode;a.lastIndex=0}for(var d=[];;){var h=vL(a,o);if(null===h)break;if(wL(d,h),!c)break;""===hL(h[0])&&(a.lastIndex=pL(o,dL(a.lastIndex),l))}for(var f,p="",m=0,y=0;y<d.length;y++){for(var v=hL((h=d[y])[0]),g=bL(AL(lL(h.index),o.length),0),b=[],A=1;A<h.length;A++)wL(b,void 0===(f=h[A])?f:String(f));var _=h.groups;if(u){var w=_L([v],b,g,o);void 0!==_&&wL(w,_);var S=hL(nL(i,void 0,w))}else S=yL(v,o,g,b,_,i);g>=m&&(p+=kL(o,m,g)+S,m=g+v.length)}return p+kL(o,m)}]}),!EL||!TL||xL),pi({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var LL=W(1..valueOf),ZL="\t\n\v\f\r \u2028\u2029\ufeff",IL=q,RL=nf,CL=ZL,GL=W("".replace),PL="["+CL+"]",XL=RegExp("^"+PL+PL+"*"),VL=RegExp(PL+PL+"*$"),DL=function(e){return function(t){var n=RL(IL(t));return 1&e&&(n=GL(n,XL,"")),2&e&&(n=GL(n,VL,"")),n}},ML={start:DL(1),end:DL(2),trim:DL(3)},WL=S,NL=A,OL=W,UL=oi,FL=lr,YL=rt,KL=kS,HL=he,jL=Ze,BL=xt,JL=w,zL=dr.f,QL=_.f,qL=Kt.f,$L=LL,eZ=ML.trim,tZ="Number",nZ=NL[tZ],rZ=nZ.prototype,iZ=NL.TypeError,aZ=OL("".slice),oZ=OL("".charCodeAt),sZ=function(e){var t,n,r,i,a,o,s,u,c=BL(e,"number");if(jL(c))throw iZ("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=eZ(c),43===(t=oZ(c,0))||45===t){if(88===(n=oZ(c,2))||120===n)return NaN}else if(48===t){switch(oZ(c,1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+c}for(o=(a=aZ(c,2)).length,s=0;s<o;s++)if((u=oZ(a,s))<48||u>i)return NaN;return parseInt(a,r)}return+c};if(UL(tZ,!nZ(" 0o1")||!nZ("0b1")||nZ("+0x1"))){for(var uZ,cZ=function(e){var t=arguments.length<1?0:nZ(function(e){var t=BL(e,"number");return"bigint"==typeof t?t:sZ(t)}(e)),n=this;return HL(rZ,n)&&JL((function(){$L(n)}))?KL(Object(t),n,cZ):t},lZ=WL?zL(nZ):"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(","),dZ=0;lZ.length>dZ;dZ++)YL(nZ,uZ=lZ[dZ])&&!YL(cZ,uZ)&&qL(cZ,uZ,QL(nZ,uZ));cZ.prototype=rZ,rZ.constructor=cZ,FL(NL,tZ,cZ,{constructor:!0})}var hZ=et,fZ=ih,pZ=zd;pi({target:"Object",stat:!0,forced:w((function(){fZ(1)})),sham:!pZ},{getPrototypeOf:function(e){return fZ(hZ(e))}});var mZ=Object.prototype.toString;function yZ(e){if("[object Object]"!==mZ.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function vZ(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 gZ(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function bZ(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]"===mZ.call(n)?t=t.toISOString():function(e){return null!==e&&"object"===no(e)}(t)&&(t=JSON.stringify(t)),"".concat(gZ(e),"=").concat(gZ(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 AZ(e,t,n,r,i,a,o,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:a,firstByteTime:o,endTime:Date.now(),priOptions:l},response:n}}function _Z(e,t){return Math.round(8*e*1e3/t/1024)}var wZ={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:"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"},SZ=2097152,kZ=function(e){co(r,e);var t,n=go(r);function r(){var e;return ao(this,r),uo(vo(e=n.call(this)),"_abortController",null),uo(vo(e),"_timeoutTimer",null),uo(vo(e),"_reader",null),uo(vo(e),"_response",null),uo(vo(e),"_aborted",!1),uo(vo(e),"_index",-1),uo(vo(e),"_range",null),uo(vo(e),"_receivedLength",0),uo(vo(e),"_running",!1),uo(vo(e),"_logger",null),uo(vo(e),"_vid",""),uo(vo(e),"_onProcessMinLen",0),uo(vo(e),"_onCancel",null),uo(vo(e),"_priOptions",null),e}return so(r,[{key:"load",value:function(e){var t,n=this,r=e.url,i=e.vid,a=e.timeout,o=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=bZ(r,p);var Z=vZ(d);Z&&(v=f?f.headers:E.headers=E.headers||(Headers?new Headers:{}),Headers&&v instanceof Headers?v.append("Range",Z):v.Range=Z),a&&(this._timeoutTimer=setTimeout((function(){if(L=!0,n.cancel(),c){var e=new ZE(r,E,null,"timeout");e.isTimeout=!0,c(e,{index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions})}}),a));var I=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=io(to().mark((function i(a){var c,l,f,p;return to().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(n._timeoutTimer),n._response=a,!n._aborted&&n._running){i.next=4;break}return i.abrupt("return");case 4:if(h&&(a=h(a,r)||a),a.ok){i.next=7;break}throw new ZE(r,E,a,"bad network response");case 7:if(c=Date.now(),o!==EE){i.next=15;break}return i.next=11,a.text();case 11:l=i.sent,n._running=!1,i.next=37;break;case 15:if(o!==LE){i.next=22;break}return i.next=18,a.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(a,s,I,c),i.abrupt("return");case 29:return i.next=31,a.arrayBuffer();case 31:l=i.sent,l=new Uint8Array(l),n._running=!1,f=Date.now()-I,p=_Z(l.byteLength,f),n.emit(wZ.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(AZ(l,!0,a,a.headers.get("Content-Length"),a.headers.get("age"),I,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 ZE?e:new ZE(r,E,null,null===(i=e)||void 0===i?void 0:i.message)).startTime=I,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=io(to().mark((function e(){return to().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(S0){}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 a=new ZE(e.url,"",e,"onProgress of bad response.body.getReader");return a.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(a)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(SZ),this._writeIdx=0);var o,s,u,c=this._reader=e.body.getReader(),l=function(){var a=io(to().mark((function a(){var d,h,f,p,m,y,v,g;return to().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return s=Date.now(),a.prev=1,a.next=4,c.read();case 4:o=a.sent,u=Date.now(),a.next=13;break;case 8:return a.prev=8,a.t0=a.catch(1),u=Date.now(),i._aborted||(i._running=!1,a.t0.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i.reject(a.t0)),a.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){a.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),a.abrupt("return");case 19:p=o.value?o.value.byteLength:0,i._receivedLength+=p,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",f,", end,",h+i._receivedLength,", done,",o.done),i._onProcessMinLen>0?i._writeIdx+p>=i._onProcessMinLen||o.done?((m=new Uint8Array(i._writeIdx+p)).set(i._cache.slice(0,i._writeIdx),0),p>0&&m.set(o.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",o.done,",len,",m.byteLength,", writeIdx,",i._writeIdx)):p>0&&i._writeIdx+p<SZ?(i._cache.set(o.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(o.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=o.value,(m&&m.byteLength>0||o.done)&&t(m,o.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),o.done?(v=Date.now()-n,g=_Z(i._receivedLength,v),i.emit(wZ.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,",o.done),i.resolve(AZ(o,!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 a.stop()}}),a,null,[[1,8]])})));return function(){return a.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}(Za);var TZ=gn.PROPER,xZ=w,EZ=ZL,LZ=ML.trim;pi({target:"String",proto:!0,forced:function(e){return xZ((function(){return!!EZ[e]()||"
"!=="
"[e]()||TZ&&EZ[e].name!==e}))}("trim")},{trim:function(){return LZ(this)}});var ZZ=function(e){co(n,e);var t=go(n);function n(){var e;return ao(this,n),uo(vo(e=t.call(this)),"_xhr",null),uo(vo(e),"_aborted",!1),uo(vo(e),"_timeoutTimer",null),uo(vo(e),"_range",null),uo(vo(e),"_receivedLength",0),uo(vo(e),"_url",null),uo(vo(e),"_onProgress",null),uo(vo(e),"_index",-1),uo(vo(e),"_headers",null),uo(vo(e),"_currentChunkSizeKB",384),uo(vo(e),"_timeout",null),uo(vo(e),"_xhr",null),uo(vo(e),"_withCredentials",null),uo(vo(e),"_startTime",-1),uo(vo(e),"_loadCompleteResolve",null),uo(vo(e),"_loadCompleteReject",null),uo(vo(e),"_runing",!1),uo(vo(e),"_logger",!1),uo(vo(e),"_vid",""),uo(vo(e),"_responseType",void 0),uo(vo(e),"_credentials",void 0),uo(vo(e),"_method",void 0),uo(vo(e),"_transformResponse",void 0),uo(vo(e),"_firstRtt",void 0),uo(vo(e),"_onCancel",null),uo(vo(e),"_priOptions",null),e}return so(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=bZ(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 ZE?e:new ZE(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===xE&&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 a=new ZE(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));a.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(a)},n.ontimeout=function(e){t.cancel();var n=new ZE(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=vZ(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(a){a.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(a)}}},{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 ZE(this._url,null,eo(eo({},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,a=null,o=!1,s=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===xE){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=_Z(this._receivedLength,l);this.emit(wZ.REAL_TIME_SPEED,{speed:d,len:this._receivedLength,time:l,vid:this._vid,index:this._index,range:[i,s+this._receivedLength],priOptions:this._priOptions})}a=c,o=!((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,",o)}else o=!0,a=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(a,o,{index:this._index,vid:this._vid,range:[i,s+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},h),o?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(AZ(this._onProgress?null:a,o,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,bo(lo(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=_o(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(a){r.e(a)}finally{r.f()}return n}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),n}(Za),IZ=["retry","retryDelay","onRetryError","transformError"],RZ=function(){function e(t,n){ao(this,e),this.promise=yb(),this.alive=!!n.onProgress,!n.logger&&(n.logger=new wA("Loader")),this._loaderType=t,this._loader=t===kE&&window.fetch?new kZ:new ZZ,this._config=n,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=n.retryCheckFunc,this._logger=n.logger}var t;return so(e,[{key:"exec",value:function(){var e=this,t=this._config,n=t.retry,r=t.retryDelay,i=t.onRetryError,a=t.transformError,o=yo(t,IZ),s=function(){var t=io(to().mark((function t(){var u,c,l;return to().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(o);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,a&&(c=a(c)||c),i&&e._retryCount>0&&i(c,e._retryCount,{index:o.index,vid:o.vid,range:o.range,priOptions:o.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,",o.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=io(to().mark((function e(){return to().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 CZ(e){return e&&!e.paused&&!e.ended&&0!==e.playbackRate&&0!==e.readyState}function GZ(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()}}function PZ(){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 XZ(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var VZ=function(e){co(r,e);var t,n=go(r);function r(e){var t;return ao(this,r),uo(vo(t=n.call(this,e)),"type",kE),uo(vo(t),"_queue",[]),uo(vo(t),"_alive",[]),uo(vo(t),"_currentTask",null),uo(vo(t),"_config",void 0),t._config=function(e){return eo({loaderType:kE,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:EE,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!==TE&&kZ.isSupported()||(t.type=TE),t.log=e.logger,t}return so(r,[{key:"isFetch",value:function(){return this.type===kE}},{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&&yZ(n.headers)&&(n.headers=Object.assign({},n.headers)),n.body&&yZ(n.body)&&(n.body=Object.assign({},n.body)),n.transformRequest&&(n=n.transformRequest(n)||n),n.logger=this.log;var r=new RZ(this.type,n);return r.loader.on(wZ.REAL_TIME_SPEED,(function(e){t.emit(wZ.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=io(to().mark((function e(){var t;return to().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,XZ();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 kZ.isSupported()}}]),r}(Za),DZ=function(){function e(){ao(this,e),uo(this,"_prevCurrentTime",0)}return so(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,a=0;if(this._prevCurrentTime===i){var o=bb.info(bb.get(e),i);if(!o.buffers.length)return;n&&o.nextStart||o.nextStart&&o.nextStart-i<t?a=o.nextStart+.1:o.end&&o.end-i>r&&!e.seeking&&(a=i+.1)}this._prevCurrentTime=i,a&&i!==a&&(e.currentTime=a)}}}]),e}(),MZ={exports:{}},WZ={},NZ=F,OZ=te,UZ=dr.f,FZ=sp,YZ="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];WZ.f=function(e){return YZ&&"Window"==NZ(e)?function(e){try{return UZ(e)}catch(S0){return FZ(YZ)}}(e):UZ(OZ(e))};var KZ=w((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),HZ=w,jZ=ue,BZ=F,JZ=KZ,zZ=Object.isExtensible,QZ=HZ((function(){zZ(1)}))||JZ?function(e){return!!jZ(e)&&((!JZ||"ArrayBuffer"!=BZ(e))&&(!zZ||zZ(e)))}:zZ,qZ=!w((function(){return Object.isExtensible(Object.preventExtensions({}))})),$Z=pi,eI=W,tI=Cn,nI=ue,rI=rt,iI=Kt.f,aI=dr,oI=WZ,sI=QZ,uI=qZ,cI=!1,lI=ut("meta"),dI=0,hI=function(e){iI(e,lI,{value:{objectID:"O"+dI++,weakData:{}}})},fI=MZ.exports={enable:function(){fI.enable=function(){},cI=!0;var e=aI.f,t=eI([].splice),n={};n[lI]=1,e(n).length&&(aI.f=function(n){for(var r=e(n),i=0,a=r.length;i<a;i++)if(r[i]===lI){t(r,i,1);break}return r},$Z({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:oI.f}))},fastKey:function(e,t){if(!nI(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!rI(e,lI)){if(!sI(e))return"F";if(!t)return"E";hI(e)}return e[lI].objectID},getWeakData:function(e,t){if(!rI(e,lI)){if(!sI(e))return!0;if(!t)return!1;hI(e)}return e[lI].weakData},onFreeze:function(e){return uI&&cI&&sI(e)&&!rI(e,lI)&&hI(e),e}};tI[lI]=!0;var pI=MZ.exports,mI=pi,yI=A,vI=W,gI=oi,bI=lr,AI=pI,_I=Ml,wI=ds,SI=ae,kI=J,TI=ue,xI=w,EI=Fl,LI=rs,ZI=kS,II=function(e,t,n){var r=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),a=r?"set":"add",o=yI[e],s=o&&o.prototype,u=o,c={},l=function(e){var t=vI(s[e]);bI(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!TI(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!TI(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!TI(e))&&t(this,0===e?0:e)}:function(e,n){return t(this,0===e?0:e,n),this})};if(gI(e,!SI(o)||!(i||s.forEach&&!xI((function(){(new o).entries().next()})))))u=n.getConstructor(t,e,r,a),AI.enable();else if(gI(e,!0)){var d=new u,h=d[a](i?{}:-0,1)!=d,f=xI((function(){d.has(1)})),p=EI((function(e){new o(e)})),m=!i&&xI((function(){for(var e=new o,t=5;t--;)e[a](t,t);return!e.has(-0)}));p||((u=t((function(e,t){wI(e,s);var n=ZI(new o,e,u);return kI(t)||_I(t,n[a],{that:n,AS_ENTRIES:r}),n}))).prototype=s,s.constructor=u),(f||m)&&(l("delete"),l("has"),r&&l("get")),(m||h)&&l(a),i&&s.clear&&delete s.clear}return c[e]=u,mI({global:!0,constructor:!0,forced:u!=o},c),LI(u,e),i||n.setStrong(u,e,r),u},RI=Kt.f,CI=Nd,GI=Ep,PI=Cs,XI=ds,VI=J,DI=Ml,MI=Wh,WI=Nh,NI=us,OI=S,UI=pI.fastKey,FI=Hn.set,YI=Hn.getterFor,KI={getConstructor:function(e,t,n,r){var i=e((function(e,i){XI(e,a),FI(e,{type:t,index:CI(null),first:void 0,last:void 0,size:0}),OI||(e.size=0),VI(i)||DI(i,e[r],{that:e,AS_ENTRIES:n})})),a=i.prototype,o=YI(t),s=function(e,t,n){var r,i,a=o(e),s=u(e,t);return s?s.value=n:(a.last=s={index:i=UI(t,!0),key:t,value:n,previous:r=a.last,next:void 0,removed:!1},a.first||(a.first=s),r&&(r.next=s),OI?a.size++:e.size++,"F"!==i&&(a.index[i]=s)),e},u=function(e,t){var n,r=o(e),i=UI(t);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key==t)return n};return GI(a,{clear:function(){for(var e=o(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,OI?e.size=0:this.size=0},delete:function(e){var t=this,n=o(t),r=u(t,e);if(r){var i=r.next,a=r.previous;delete n.index[r.index],r.removed=!0,a&&(a.next=i),i&&(i.previous=a),n.first==r&&(n.first=i),n.last==r&&(n.last=a),OI?n.size--:t.size--}return!!r},forEach:function(e){for(var t,n=o(this),r=PI(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)}}),GI(a,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)}}),OI&&RI(a,"size",{get:function(){return o(this).size}}),i},setStrong:function(e,t,n){var r=t+" Iterator",i=YI(t),a=YI(r);MI(e,t,(function(e,t){FI(this,{type:r,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=a(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)?WI("keys"==t?n.key:"values"==t?n.value:[n.key,n.value],!1):(e.target=void 0,WI(void 0,!0))}),n?"entries":"values",!n,!0),NI(t)}};II("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),KI);var HI=function(){function e(t){var n=this;ao(this,e),uo(this,"_seiSet",new Set),this.emitter=t,t.on(wZ.SEI,(function(e){e&&n._seiSet.add(e)}))}return so(e,[{key:"throw",value:function(e){var t=this;if(null!=e&&this._seiSet.size){var n=e-.2,r=e+.2,i=[];this._seiSet.forEach((function(e){e.time>=n&&e.time<=r&&i.push(e)})),i.forEach((function(e){t._seiSet.delete(e),t.emitter.emit(wZ.SEI_IN_TIME,e)}))}}},{key:"reset",value:function(){this._seiSet.clear()}}]),e}(),jI=function(){function e(){ao(this,e),uo(this,"_chunkSpeeds",[]),uo(this,"_speeds",[])}return so(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}(),BI=function(){function e(t){ao(this,e),uo(this,"encodeType",""),uo(this,"audioCodec",""),uo(this,"videoCodec",""),uo(this,"domain",""),uo(this,"fps",0),uo(this,"bitrate",0),uo(this,"width",0),uo(this,"height",0),uo(this,"samplerate",0),uo(this,"channelCount",0),uo(this,"gop",0),uo(this,"_bitsAccumulateSize",0),uo(this,"_bitsAccumulateDuration",0),this._timescale=t}return so(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:"setVideoMeta",value:function(e){this.width=e.width,this.height=e.height,this.videoCodec=e.codec,this.encodeType=e.codecType,e.fpsNum&&e.fpsDen&&(this.fps=e.fpsNum/e.fpsDen)}},{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){var n=e[0];null!=n&&n.duration&&(this.fps=Math.round(this._timescale/n.duration))}e.forEach((function(e){1===e.gopId&&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}(),JI=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;ao(this,e),uo(this,"_core",null),uo(this,"_samples",[]),this._core=t,this._timescale=n,this._stats=new BI(n),this._bindEvents()}return so(e,[{key:"getStats",value:function(){var e,t,n,r,i,a,o,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 eo(eo({},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===(a=this._core)||void 0===a||null===(o=a.bufferInfo())||void 0===o?void 0:o.remaining)||0,decodeFps:d})}},{key:"_bindEvents",value:function(){var e=this;this._core.on(wZ.DEMUXED_TRACK,(function(t){return e._stats.updateBitrate(t.samples)})),this._core.on(wZ.METADATA_PARSED,(function(t){"video"===t.type?e._stats.setVideoMeta(t.track):e._stats.setAudioMeta(t.track)})),this._core.on(wZ.TTFB,(function(t){e._stats.setDomain(t.responseUrl)}))}},{key:"reset",value:function(){this._samples=[],this._stats=new BI(this._timescale)}}]),e}();function zI(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function QI(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 qI(e,t,n){return t&&QI(e.prototype,t),n&&QI(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function $I(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eR(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&&nR(e,t)}function tR(e){return(tR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function nR(e,t){return(nR=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function rR(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 iR(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=tR(e);if(t){var i=tR(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return rR(this,n)}}function aR(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,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(u){s=!0,i=u}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||sR(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 oR(e){return function(e){if(Array.isArray(e))return uR(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||sR(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 sR(e,t){if(e){if("string"==typeof e)return uR(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)?uR(e,t):void 0}}function uR(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 cR=ue,lR=F,dR=gt("match"),hR=function(e){var t;return cR(e)&&(void 0!==(t=e[dR])?!!t:"RegExp"==lR(e))},fR=hR,pR=TypeError,mR=function(e){if(fR(e))throw pR("The method doesn't accept regular expressions");return e},yR=gt("match"),vR=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[yR]=!1,"/./"[e](t)}catch(r){}}return!1},gR=pi,bR=mR,AR=q,_R=nf,wR=vR,SR=W("".indexOf);gR({target:"String",proto:!0,forced:!wR("includes")},{includes:function(e){return!!~SR(_R(AR(this)),_R(bR(e)),arguments.length>1?arguments[1]:void 0)}});var kR="video",TR="audio",xR="metadata",ER="avc",LR="hevc",ZR="aac",IR="g7110a",RR="g7110m",CR="LARGE_AV_SHIFT",GR="LARGE_VIDEO_GAP",PR="LARGE_VIDEO_GAP_BETWEEN_CHUNK",XR="LARGE_AUDIO_GAP",VR="AUDIO_FILLED",DR="AUDIO_DROPPED",MR=function(){function e(){zI(this,e),$I(this,"id",1),$I(this,"type",kR),$I(this,"codecType",ER),$I(this,"pid",-1),$I(this,"hvcC",void 0),$I(this,"codec",""),$I(this,"timescale",0),$I(this,"formatTimescale",0),$I(this,"sequenceNumber",0),$I(this,"baseMediaDecodeTime",0),$I(this,"baseDts",0),$I(this,"duration",0),$I(this,"warnings",[]),$I(this,"samples",[]),$I(this,"pps",[]),$I(this,"sps",[]),$I(this,"vps",[]),$I(this,"fpsNum",0),$I(this,"fpsDen",0),$I(this,"sarRatio",[]),$I(this,"width",0),$I(this,"height",0),$I(this,"nalUnitSize",4),$I(this,"present",!1),$I(this,"isVideoEncryption",!1),$I(this,"isAudioEncryption",!1),$I(this,"isVideo",!0),$I(this,"kid",null),$I(this,"pssh",null),$I(this,"ext",void 0)}return qI(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}(),WR=function(){function e(){zI(this,e),$I(this,"id",2),$I(this,"type",TR),$I(this,"codecType",ZR),$I(this,"pid",-1),$I(this,"codec",""),$I(this,"sequenceNumber",0),$I(this,"sampleDuration",0),$I(this,"timescale",0),$I(this,"formatTimescale",0),$I(this,"baseMediaDecodeTime",0),$I(this,"duration",0),$I(this,"warnings",[]),$I(this,"samples",[]),$I(this,"baseDts",0),$I(this,"sampleSize",16),$I(this,"sampleRate",0),$I(this,"channelCount",0),$I(this,"objectType",0),$I(this,"sampleRateIndex",0),$I(this,"config",[]),$I(this,"present",!1),$I(this,"isVideoEncryption",!1),$I(this,"isAudioEncryption",!1),$I(this,"kid",null),$I(this,"ext",void 0)}return qI(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===ZR)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}}]),e}(),NR=function(){function e(t,n,r){zI(this,e),$I(this,"flag",{}),$I(this,"keyframe",!1),$I(this,"gopId",0),$I(this,"duration",0),$I(this,"size",0),$I(this,"units",[]),$I(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=n,r&&(this.units=r)}return qI(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}(),OR=qI((function e(t,n,r,i){zI(this,e),$I(this,"duration",1024),$I(this,"flag",{dependsOn:2,isNonSyncSample:0}),$I(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=n,this.size=n.byteLength,this.sampleOffset=i,r&&(this.duration=r)})),UR=qI((function e(t,n){zI(this,e),$I(this,"time",0),this.data=t,this.originPts=this.pts=n})),FR=function(e){eR(n,e);var t=iR(n);function n(){return zI(this,n),t.apply(this,arguments)}return qI(n)}(UR),YR=function(e){eR(n,e);var t=iR(n);function n(){return zI(this,n),t.apply(this,arguments)}return qI(n)}(UR),KR=function(){function e(){zI(this,e),$I(this,"id",3),$I(this,"type",xR),$I(this,"timescale",0),$I(this,"flvScriptSamples",[]),$I(this,"seiSamples",[])}return qI(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}(),HR=A.isFinite;pi({target:"Number",stat:!0},{isFinite:Number.isFinite||function(e){return"number"==typeof e&&HR(e)}});var jR=E,BR=rt,JR=he,zR=Dg,QR=RegExp.prototype,qR=function(e){var t=e.flags;return void 0!==t||"flags"in QR||BR(e,"flags")||!JR(QR,e)?t:jR(zR,e)},$R=gn.PROPER,eC=lr,tC=zt,nC=nf,rC=w,iC=qR,aC="toString",oC=RegExp.prototype[aC],sC=rC((function(){return"/a/b"!=oC.call({source:"a",flags:"b"})})),uC=$R&&oC.name!=aC;(sC||uC)&&eC(RegExp.prototype,aC,(function(){var e=tC(this);return"/"+nC(e.source)+"/"+nC(iC(e))}),{unsafe:!0});var cC=function(){function e(t){zI(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]")}return qI(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}();$I(cC,"disabled",!0);var lC,dC,hC=pi,fC=E,pC=ae,mC=zt,yC=nf,vC=(lC=!1,(dC=/[ac]/).exec=function(){return lC=!0,/./.exec.apply(this,arguments)},!0===dC.test("abc")&&lC),gC=/./.test;hC({target:"RegExp",proto:!0,forced:!vC},{test:function(e){var t=mC(this),n=yC(e),r=t.exec;if(!pC(r))return fC(gC,t,n);var i=fC(r,t,n);return null!==i&&(mC(i),!0)}});var bC="undefined"!=typeof window,AC=bC&&navigator.userAgent.toLocaleLowerCase(),_C=bC&&/^((?!chrome|android).)*safari/.test(AC),wC=bC&&AC.includes("firefox"),SC=bC&&AC.includes("android"),kC=function(){function e(){zI(this,e)}return qI(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 a=i,o=[],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]),o.push({pts:n+y*v,data:t.subarray(i+7+c,i+l)}),y++,i+=l}else i++;return{skip:a,remaining:i>=r?void 0:t.subarray(i),frames:o,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,a=e.FREQ[r];if(a){var o=e._getConfig(r,i,n);return{samplingFrequencyIndex:r,sampleRate:a,objectType:n,channelCount:i,config:o.config,codec:o.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,a=[];return wC?e>=6?(r=5,i=e-3):(r=2,i=e):SC?(r=2,i=e):(r=2===n||5===n?n:5,i=e,e>=6?i=e-3:1===t&&(r=2,i=e)),a[0]=r<<3,a[0]|=(14&e)>>1,a[1]=(1&e)<<7,a[1]|=t<<3,5===r&&(a[1]|=(14&i)>>1,a[2]=(1&i)<<7,a[2]|=8,a[3]=0),{config:a,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}();$I(kC,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var TC=1e3,xC=5e3,EC=function(){function e(t,n,r){zI(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._lastAudioExceptionGapDot=-1/0,this._lastAudioExceptionOverlapDot=-1/0,this._lastAudioExceptionLargeGapDot=-1/0,this._lastVideoExceptionLargeGapDot=-1/0,this._lastVideoExceptionChunkFirstDtsDot=-1/0}return qI(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,a=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(a,i),!r&&t&&(this._audioNextPts=this._videoNextDts=t),this._baseDtsInited&&(this._videoTimestampBreak||!this.videoTrack.exist())&&(this._audioTimestampBreak||!this.audioTrack.exist())&&this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(a),this._fixVideo(i),this.metadataTrack.exist()){var o=this.metadataTrack.timescale;this.metadataTrack.seiSamples.forEach((function(t){t.pts=t.originPts-e._baseDts,t.time=Math.max(0,t.pts)/o})),this.metadataTrack.flvScriptSamples.forEach((function(t){t.pts=t.originPts-e._baseDts,t.time=Math.max(0,t.pts)/o}))}i.samples.length&&(i.baseMediaDecodeTime=i.samples[0].dts),a.samples.length&&(a.baseMediaDecodeTime=a.samples[0].pts*a.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.fpsNum&&e.fpsDen)r=e.timescale*(e.fpsDen/e.fpsNum);else if(e.length>1){var i=e.samples[0],a=e.samples[n.length-1];r=Math.floor((a.dts-i.dts)/(n.length-1))}else r=this._lastVideoDuration||40;var o=n.pop();if(this._videoLastSample&&n.unshift(this._videoLastSample),this._videoLastSample=o,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:PR,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:o?o.dts-p:r)>1e3||c<0)&&(this._videoTimestampBreak++,Math.abs(p-this._lastVideoExceptionLargeGapDot)>5e3&&(this._lastVideoExceptionLargeGapDot=p,e.warnings.push({type:GR,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,a=1/0;n.length&&(e.baseDts=i=n[0].pts),r.length&&(t.baseDts=a=r[0].dts),this._baseDts=Math.min(i,a);var o=a-i;return Number.isFinite(o)&&Math.abs(o)>500&&t.warnings.push({type:CR,videoBaseDts:a,audioBasePts:i,baseDts:this._baseDts,delta:o}),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===ZR?kC.getFrameDuration(e.timescale,n):this._getG711Duration(e));var r=e.sampleDuration,i=e.codecType===ZR?1024:r*e.timescale/1e3;if(void 0===this._audioNextPts){var a=t[0];this._audioNextPts=a.pts}for(var o=0;o<t.length;o++){var s=this._audioNextPts,u=t[o],c=u.pts-s;if(0===o&&this._audioTimestampBreak>=5&&(s=this._audioNextPts=u.dts,c=0,this._audioTimestampBreak=0),!this._audioTimestampBreak&&c>=3*r&&c<=TC&&!_C){var l=this._getSilentFrame(e)||t[0].data.subarray(),d=Math.floor(c/r);Math.abs(u.pts-this._lastAudioExceptionGapDot)>xC&&(this._lastAudioExceptionGapDot=u.pts,e.warnings.push({type:VR,pts:u.pts,originPts:u.originPts,count:d,nextPts:s,refSampleDuration:r}));for(var h=0;h<d;h++){var f=new OR(Math.floor(this._audioNextPts+r)-Math.floor(this._audioNextPts),l,i);f.originPts=Math.floor(this._baseDts+s),t.splice(o,0,f),this._audioNextPts+=r,o++}o--}else c<=-3*r&&c>=-1e3?(Math.abs(u.pts-this._lastAudioExceptionOverlapDot)>xC&&(this._lastAudioExceptionOverlapDot=u.pts,e.warnings.push({type:DR,pts:u.pts,originPts:u.originPts,nextPts:s,refSampleDuration:r})),t.splice(o,1),o--):(Math.abs(c)>TC&&(this._audioTimestampBreak++,Math.abs(u.pts-this._lastAudioExceptionLargeGapDot)>xC&&(this._lastAudioExceptionLargeGapDot=u.pts,e.warnings.push({type:XR,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===ZR?kC.getSilentFrame(e.codec,e.channelCount):new Uint8Array(8*e.sampleDuration*e.channelCount)}}]),e}();function LC(){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 ZC(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 IC(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 RC(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 CC=function(){function e(){zI(this,e)}return qI(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=[],a=0;a+t<r;)if(n=ZC(e,a),3===t&&(n>>>=8),a+=t,n){if(a+n>r)break;i.push(e.subarray(a,a+n)),a+=n}return i}}},{key:"parseSEI",value:function(e,t){for(var n=e.length,r=t?2:1,i=0,a=0,o="";255===e[r];)i+=255,r++;for(i+=e[r++];255===e[r];)a+=255,r++;if(a+=e[r++],5===i&&n>r+16)for(var s=0;s<16;s++)o+=e[r].toString(16),r++;return{payload:e.subarray(r),type:i,size:a,uuid:o}}},{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,a=new Uint8Array(i),o=0;for(r=0;r<i;o++,r++)o===n[0]&&(o++,n.shift()),a[r]=e[o];return a}}]),e}(),GC=function(){function e(t){if(zI(this,e),$I(this,"_bytesAvailable",void 0),$I(this,"_bitsAvailable",0),$I(this,"_word",0),!t)throw new Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}return qI(e,[{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}(),PC=function(){function e(){zI(this,e)}return qI(e,null,[{key:"parseAVCDecoderConfigurationRecord",value:function(t){if(!(t.length<7)){for(var n,r,i=1+(3&t[4]),a=[],o=[],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,a.push(l),n||(n=e.parseSPS(CC.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&&(o.push(t.subarray(s,s+d)),s+=d);return{sps:n,spsArr:a,ppsArr:o,nalUnitSize:i}}}},{key:"parseSPS",value:function(e){var t=new GC(e);t.readUByte();var n=t.readUByte(),r=t.readUByte(),i=t.readUByte();t.skipUEG();var a=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 o=t.readUEG();if(o<=3&&(a=[0,420,422,444][o]),3===o&&t.skipBits(1),t.skipUEG(),t.skipUEG(),t.skipBits(1),t.readBool())for(var s=3!==o?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:IC(e.subarray(1,4)),profileIdc:n,profileCompatibility:r,levelIdc:i,chromaFormat:a,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}(),XC=function(){function e(){zI(this,e)}return qI(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,a,o,s,u=1+(3&t[21]),c=[],l=[],d=[],h=23,f=t[22],p=0;p<f;p++){a=63&t[h],o=t[h+1]<<8|t[h+2],h+=3;for(var m=0;m<o;m++)if(s=t[h]<<8|t[h+1],h+=2,s){switch(a){case 32:var y=t.subarray(h,h+s);r||(r=e.parseVPS(CC.removeEPB(y),n)),d.push(y);break;case 33:var v=t.subarray(h,h+s);i||(i=e.parseSPS(CC.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 GC(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 GC(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 a=n.chromaFormatIdc=r.readUEG(),o=420;a<=3&&(o=[0,420,422,444][a]);var s=0;3===a&&(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!==a&&2!==a||0!==s?1:2)*(c+u),f-=(1===a&&0===s?2:1)*(d+l));return{codec:"hev1.1.6.L93.B0",width:h,height:f,chromaFormat:o,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);for(var a=[],o=[],s=0;s<t;s++)a[s]=e.readBits(1),o[s]=e.readBits(1);t>0&&e.readBits(2*(8-t));for(var u=0;u<t;u++)0!==a[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!==o[u]&&e.readBits(8)}}]),e}(),VC=function(){function e(){zI(this,e)}return qI(e,null,[{key:"decode",value:function(t){for(var n=[],r=t,i=0,a=t.length;i<a;)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 o=(31&r[i])<<6|63&r[i+1];if(o>=128){n.push(String.fromCharCode(65535&o)),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}(),DC=function(){function e(){zI(this,e)}return qI(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,a=!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 o=e._parseString(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i));n=o.data,i+=o.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,a=!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=VC.decode(new Uint8Array(t.buffer,t.byteOffset+i,_))),i+=_;break;default:i=r}return{data:n,size:i,isEnd:a}}},{key:"_parseString",value:function(e){var t=e.getUint16(0),n="";return t>0&&(n=VC.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}(),MC=new cC("FlvDemuxer"),WC=function(){function e(t,n,r){zI(this,e),$I(this,"_headerParsed",!1),$I(this,"_remainingData",null),$I(this,"_gopId",0),$I(this,"_needAddMetaBeforeKeyFrameNal",!0),this.videoTrack=t||new MR,this.audioTrack=n||new WR,this.metadataTrack=r||new KR,this._fixer=new EC(this.videoTrack,this.audioTrack,this.metadataTrack)}return qI(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,a=this.videoTrack,o=this.metadataTrack;if(!n&&r||(this._remainingData=null,this._headerParsed=!1),n?(a.reset(),i.reset(),o.reset()):(a.samples=[],i.samples=[],o.seiSamples=[],o.flvScriptSamples=[],a.warnings=[],i.warnings=[],this._remainingData&&(t=LC(this._remainingData,t),this._remainingData=null)),!t.length)return{videoTrack:a,audioTrack:i,metadataTrack:o};var s=0;if(!this._headerParsed){if(!e.probe(t))throw new Error("Invalid flv file");i.present=(4&t[4])>>>2!=0,a.present=0!=(1&t[4]),this._headerParsed=!0,s=ZC(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):MC.warn("Invalid tag type: ".concat(u)),(h=ZC(t,s+=c))!==11+c&&MC.warn("Invalid PrevTagSize ".concat(h," (").concat(11+c,")")),s+=4;return s<f&&(this._remainingData=t.subarray(s)),i.formatTimescale=a.formatTimescale=a.timescale=o.timescale=1e3,i.timescale=i.sampleRate||0,!i.exist()&&i.hasSample()&&i.reset(),!a.exist()&&a.hasSample()&&a.reset(),{videoTrack:a,audioTrack:i,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:"_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 MC.warn("Unsupported sound format: ".concat(r)),void i.reset();if(10!==r){var a=(12&t[0])>>2,o=(2&t[0])>>1,s=1&t[0];i.sampleRate=e.AUDIO_RATE[a],i.sampleSize=o?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?IR:RR,r.sampleRate=8e3,r.codec=r.codecType,r.samples.push(new OR(t,e.subarray(1)))}},{key:"_parseAac",value:function(e,t){var n=this.audioTrack;if(n.codecType=ZR,0===e[1]){var r=kC.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(),MC.warn("Cannot parse AudioSpecificConfig",e))}else if(1===e[1]){if(null==t)return;n.samples.push(new OR(t,e.subarray(2)))}else MC.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],a=this.videoTrack;if(7!==i&&12!==i)return a.reset(),void MC.warn("Unsupported codecId: ".concat(i));var o=12===i;a.codecType=o?LR:ER;var s=e[1],u=(e[2]<<16|e[3]<<8|e[4])<<8>>8;if(0===s){var c=e.subarray(5),l=o?XC.parseHEVCDecoderConfigurationRecord(c):PC.parseAVCDecoderConfigurationRecord(c);if(l){var d=l.hvcC,h=l.sps,f=l.ppsArr,p=l.spsArr,m=l.vpsArr,y=l.nalUnitSize;d&&(a.hvcC=a.hvcC||d),h&&(a.codec=h.codec,a.width=h.width,a.height=h.height,a.sarRatio=h.sarRatio,a.fpsNum=h.fpsNum,a.fpsDen=h.fpsDen),p.length&&(a.sps=p),f.length&&(a.pps=f),m&&m.length&&(a.vps=m),y&&(a.nalUnitSize=y)}else MC.warn("Cannot parse ".concat(o?"HEVC":"AVC","DecoderConfigurationRecord"),e)}else if(1===s){var v=CC.parseAvcC(e.subarray(5),a.nalUnitSize);if((v=this._checkAddMetaNalToUnits(o,v,a))&&v.length){var g=new NR(t+u,t,v);1===r&&g.setToKeyframe(),a.samples.push(g),v.forEach((function(e){var r=o?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(!o&&5!==r||o&&5===r)break;g.setToKeyframe();break;case 6:case 39:case 40:if(!o&&6!==r||o&&6===r)break;n.metadataTrack.seiSamples.push(new YR(CC.parseSEI(CC.removeEPB(e),o),t+u))}})),g.keyframe&&this._gopId++,g.gopId=this._gopId}else MC.warn("Cannot parse NALUs",e)}else 2===s||MC.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 FR(DC.parse(e),t))}}],[{key:"probe",value:function(e){return 70===e[0]&&76===e[1]&&86===e[2]&&1===e[3]&&ZC(e,5)>=9}}]),e}();$I(WC,"AUDIO_RATE",[5500,11e3,22e3,44e3]);var NC=S,OC=Of,UC=Dg,FC=w,YC=A.RegExp,KC=YC.prototype;NC&&FC((function(){var e=!0;try{YC(".","d")}catch(S0){e=!1}var t={},n="",r=e?"dgimsy":"gimsy",i=function(e,r){Object.defineProperty(t,e,{get:function(){return n+=r,!0}})},a={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in e&&(a.hasIndices="d"),a)i(o,a[o]);return Object.getOwnPropertyDescriptor(KC,"flags").get.call(t)!==r||n!==r}))&&OC(KC,"flags",{configurable:!0,get:UC});var HC=yr,jC=nf,BC=q,JC=RangeError,zC=function(e){var t=jC(BC(this)),n="",r=HC(e);if(r<0||r==1/0)throw JC("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n},QC=W,qC=Sr,$C=nf,eG=q,tG=QC(zC),nG=QC("".slice),rG=Math.ceil,iG=function(e){return function(t,n,r){var i,a,o=$C(eG(t)),s=qC(n),u=o.length,c=void 0===r?" ":$C(r);return s<=u||""==c?o:((a=tG(c,rG((i=s-u)/c.length))).length>i&&(a=nG(a,0,i)),e?o+a:a+o)}},aG={start:iG(!1),end:iG(!0)},oG=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(fe),sG=aG.start;pi({target:"String",proto:!0,forced:oG},{padStart:function(e){return sG(this,e,arguments.length>1?arguments[1]:void 0)}});var uG=pi,cG=Wv.find,lG=Jd,dG="find",hG=!0;dG in[]&&Array(1)[dG]((function(){hG=!1})),uG({target:"Array",proto:!0,forced:hG},{find:function(e){return cG(this,e,arguments.length>1?arguments[1]:void 0)}}),lG(dG);var fG=tp;pi({target:"Array",stat:!0,forced:!Fl((function(e){Array.from(e)}))},{from:fG});var pG=us,mG="ArrayBuffer",yG=zw[mG];pi({global:!0,constructor:!0,forced:A[mG]!==yG},{ArrayBuffer:yG}),pG(mG);var vG=function(){function e(){zI(this,e),this.buffer=new Uint8Array(0)}return qI(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 a=new e(t),o=0;return r.forEach((function(e){a.set(e,o),o+=e.length})),a}(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}(),gG=Math.pow(2,32)-1,bG=function(){function e(){zI(this,e)}return qI(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),a=new Uint8Array(i);a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=255&i,a.set(e,4);var o=8;return n.forEach((function(e){a.set(e,o),o+=e.byteLength})),a}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===kR&&e.codecType===LR}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return LC(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],RC(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(oR(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(oR(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===kR?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]),a=e.esds(t.config),o=e.sinf(t.enca);return e.box(e.types.enca,i,a,o)}},{key:"encv",value:function(t){var n,r,i=t.sps.length>0?t.sps[0]:[],a=t.pps.length>0?t.pps[0]:[],o=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,o>>8&255,255&o,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,oR(i)).concat([1,a.length>>>8&255,255&a.length])).concat.apply(n,oR(a))),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(RC(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]),a=e.schi(t);return e.box(e.types.sinf,n,e.box(e.types.frma,r),e.box(e.types.schm,i),a)}},{key:"avc1hev1",value:function(t){var n=t.codecType===LR,r=n?e.types.hvc1:e.types.avc1,i=n?e.hvcC(t):e.avcC(t),a=[new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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?a.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&a.push(e.pasp(t.sarRatio)),e.box.apply(e,[r].concat(a))}},{key:"avcC",value:function(t){var n,r,i,a=[],o=[];return t.sps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,oR(e))})),t.pps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,oR(e))})),e.box(e.types.avcC,new Uint8Array((n=(r=[1,a[3],a[4],a[5],255,224|t.sps.length]).concat.apply(r,a).concat([t.pps.length])).concat.apply(n,o)))}},{key:"hvcC",value:function(t){var n=t.hvcC;if(n instanceof ArrayBuffer||n instanceof Uint8Array)return n;var r,i=t.vps,a=t.sps,o=t.pps;if(n){var s=n.generalProfileCompatibilityFlags,u=n.generalConstraintIndicatorFlags,c=(i.length&&1)+(a.length&&1)+(o.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,oR(e))};i.length&&(r.push(160,0,i.length),i.forEach(l)),a.length&&(r.push(161,0,a.length),a.forEach(l)),o.length&&(r.push(162,0,o.length),o.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=aR(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(oR(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(oR(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 a=e.saiz(t),o=e.saio(t),s=e.trun1(t),u=e.senc(t);return e.box(e.types.traf,n,r,a,o,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 vG;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 vG,r=vG.writeUint32(t.samples.length),i=null;if(t.isVideo){var a=t.videoSencLength;i=vG.writeUint32(16*t.samples.length+a+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=vG.writeUint32(16*t.samples.length+92))}else{var o=12*t.samples.length+124;t.isAudioEncryption&&(o=12*t.samples.length+8*t.audioSenc.length+177),i=vG.writeUint32(o)}return t.samples.forEach((function(e){n.write(vG.writeUint32(e.duration)),n.write(vG.writeUint32(e.size)),n.write(vG.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&n.write(vG.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 vG,r=t.samples.length,i=t.isVideo?16:8,a=t.isVideo?2:0,o=[],s=0;return t.isVideo?(o=t.videoSenc,s=t.videoSencLength):o=t.audioSenc,s=s||i*r,n.write(vG.writeUint32(16+s),e.types.senc,this.extension(0,a)),n.write(vG.writeUint32(r)),o.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(vG.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){n.write(vG.writeUint16(e.BytesOfClearData)),n.write(vG.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/(gG+1)),i=Math.floor(n%(gG+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 a=new Uint8Array(i);a.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 o=0;o<r;o++){var s=t[o],u=s.duration,c=s.size,l=s.flag,d=void 0===l?{}:l,h=s.cts,f=void 0===h?0:h;a.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*o)}return e.box(e.types.trun,a)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(oR(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===kR?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,LC(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,a=e.sampleDescIndex;r.set([t>>24,t>>16&255,t>>8&255,255&t,n>>24,n>>16&255,n>>8&255,255&n,a>>24,a>>16&255,a>>8&255,255&a],i),i+=12})),e.box(e.types.stsc,LC(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,LC(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,LC(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,LC(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,LC(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,a=t.samples[0].sampleOffset*r,o=8;t.samples.forEach((function(e){o+=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=o+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=o+16*t.samples.length+84)}else s=o+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=o+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,a>>24&255,a>>16&255,a>>8&255,255&a,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}();$I(bG,"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))),$I(bG,"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])}),$I(bG,"FTYPAVC1",bG.box(bG.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),$I(bG,"FTYPHEV1",bG.box(bG.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),$I(bG,"DINF",bG.box(bG.types.dinf,bG.box(bG.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),$I(bG,"VMHD",bG.box(bG.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),$I(bG,"SMHD",bG.box(bG.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),$I(bG,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),$I(bG,"STTS",bG.box(bG.types.stts,bG.StblTable)),$I(bG,"STSC",bG.box(bG.types.stsc,bG.StblTable)),$I(bG,"STSZ",bG.box(bG.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),$I(bG,"STCO",bG.box(bG.types.stco,bG.StblTable));var AG=function(){function e(t,n){zI(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=n}return qI(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}();$I(AG,"disabled",!0);var _G=function(){function e(t,n,r){zI(this,e),this.videoTrack=t,this.audioTrack=n;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new AG("FMP4Remuxer",!r||!r.openLog||!r.openLog)}return qI(e,[{key:"remux",value:function(){var e,t,n,r,i,a=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),l=u.exist(),d=[];return a&&(o&&o.initMerge?(c&&d.push(this.videoTrack),l&&d.push(this.audioTrack),n=bG.initSegment(d)):(c&&(e=bG.initSegment([this.videoTrack])),l&&(t=bG.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),a=new DataView(i.buffer),o=function(e,n,o,s){s=t[e];var u=0;s.units.forEach((function(e){a.setUint32(o,e.byteLength),o+=4,i.set(e,o),o+=e.byteLength,u+=4+e.byteLength})),s.size=u,c=o,r=s},s=0,u=t.length,c=0;s<u;s++)o(s,0,c,r);var l=bG.mdat(i);return LC(bG.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=bG.mdat(t);return LC(bG.moof([e]),n)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}();class wG{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 SG extends wG{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 SG(t,e)}toString(e=kG){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 a=0;a<i;a+=1){const e=n[a>>>2]>>>24-a%4*8&255;t[r+a>>>2]|=e<<24-(r+a)%4*8}else for(let a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>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 kG={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 SG(n,t/2)}},TG={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 SG(n,t)}},xG={stringify(e){try{return decodeURIComponent(escape(TG.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:e=>TG.parse(unescape(encodeURIComponent(e)))};class EG extends wG{constructor(){super(),this._minBufferSize=0}reset(){this._data=new SG,this._nDataBytes=0}_append(e){let t=e;"string"==typeof t&&(t=xG.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes}_process(e){let t;const{_data:n,blockSize:r}=this,i=n.words,a=n.sigBytes;let o=a/(4*r);o=e?Math.ceil(o):Math.max((0|o)-this._minBufferSize,0);const s=o*r,u=Math.min(4*s,a);if(s){for(let e=0;e<s;e+=r)this._doProcessBlock(i,e);t=i.splice(0,s),n.sigBytes-=u}return new SG(t,u)}clone(){const e=super.clone.call(this);return e._data=this._data.clone(),e}}class LG extends EG{constructor(e){super(),this.blockSize=16,this.cfg=Object.assign(new wG,e),this.reset()}static _createHelper(e){return(t,n)=>new e(n).finalize(t)}static _createHmacHelper(e){return(t,n)=>new ZG(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 ZG extends wG{constructor(e,t){super();const n=new e;this._hasher=n;let r=t;"string"==typeof r&&(r=xG.parse(r));const i=n.blockSize,a=4*i;r.sigBytes>a&&(r=n.finalize(t)),r.clamp();const o=r.clone();this._oKey=o;const s=r.clone();this._iKey=s;const u=o.words,c=s.words;for(let l=0;l<i;l+=1)u[l]^=1549556828,c[l]^=909522486;o.sigBytes=a,s.sigBytes=a,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 IG={stringify(e){const{words:t,sigBytes:n}=e,r=this._map;e.clamp();const i=[];for(let o=0;o<n;o+=3){const e=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255;for(let t=0;t<4&&o+.75*t<n;t+=1)i.push(r.charAt(e>>>6*(3-t)&63))}const a=r.charAt(64);if(a)for(;i.length%4;)i.push(a);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 a=0;a<t;a+=1)if(a%4){const t=n[e.charCodeAt(a-1)]<<a%4*2|n[e.charCodeAt(a)]>>>6-a%4*2;r[i>>>2]|=t<<24-i%4*8,i+=1}return SG.create(r,i)})(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},RG=[];for(let T0=0;T0<64;T0+=1)RG[T0]=4294967296*Math.abs(Math.sin(T0+1))|0;const CG=(e,t,n,r,i,a,o)=>{const s=e+(t&n|~t&r)+i+o;return(s<<a|s>>>32-a)+t},GG=(e,t,n,r,i,a,o)=>{const s=e+(t&r|n&~r)+i+o;return(s<<a|s>>>32-a)+t},PG=(e,t,n,r,i,a,o)=>{const s=e+(t^n^r)+i+o;return(s<<a|s>>>32-a)+t},XG=(e,t,n,r,i,a,o)=>{const s=e+(n^(t|~r))+i+o;return(s<<a|s>>>32-a)+t};class VG extends LG{_doReset(){this._hash=new SG([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],a=n[t+1],o=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=CG(A,_,w,S,i,7,RG[0]),S=CG(S,A,_,w,a,12,RG[1]),w=CG(w,S,A,_,o,17,RG[2]),_=CG(_,w,S,A,s,22,RG[3]),A=CG(A,_,w,S,u,7,RG[4]),S=CG(S,A,_,w,c,12,RG[5]),w=CG(w,S,A,_,l,17,RG[6]),_=CG(_,w,S,A,d,22,RG[7]),A=CG(A,_,w,S,h,7,RG[8]),S=CG(S,A,_,w,f,12,RG[9]),w=CG(w,S,A,_,p,17,RG[10]),_=CG(_,w,S,A,m,22,RG[11]),A=CG(A,_,w,S,y,7,RG[12]),S=CG(S,A,_,w,v,12,RG[13]),w=CG(w,S,A,_,g,17,RG[14]),_=CG(_,w,S,A,b,22,RG[15]),A=GG(A,_,w,S,a,5,RG[16]),S=GG(S,A,_,w,l,9,RG[17]),w=GG(w,S,A,_,m,14,RG[18]),_=GG(_,w,S,A,i,20,RG[19]),A=GG(A,_,w,S,c,5,RG[20]),S=GG(S,A,_,w,p,9,RG[21]),w=GG(w,S,A,_,b,14,RG[22]),_=GG(_,w,S,A,u,20,RG[23]),A=GG(A,_,w,S,f,5,RG[24]),S=GG(S,A,_,w,g,9,RG[25]),w=GG(w,S,A,_,s,14,RG[26]),_=GG(_,w,S,A,h,20,RG[27]),A=GG(A,_,w,S,v,5,RG[28]),S=GG(S,A,_,w,o,9,RG[29]),w=GG(w,S,A,_,d,14,RG[30]),_=GG(_,w,S,A,y,20,RG[31]),A=PG(A,_,w,S,c,4,RG[32]),S=PG(S,A,_,w,h,11,RG[33]),w=PG(w,S,A,_,m,16,RG[34]),_=PG(_,w,S,A,g,23,RG[35]),A=PG(A,_,w,S,a,4,RG[36]),S=PG(S,A,_,w,u,11,RG[37]),w=PG(w,S,A,_,d,16,RG[38]),_=PG(_,w,S,A,p,23,RG[39]),A=PG(A,_,w,S,v,4,RG[40]),S=PG(S,A,_,w,i,11,RG[41]),w=PG(w,S,A,_,s,16,RG[42]),_=PG(_,w,S,A,l,23,RG[43]),A=PG(A,_,w,S,f,4,RG[44]),S=PG(S,A,_,w,y,11,RG[45]),w=PG(w,S,A,_,b,16,RG[46]),_=PG(_,w,S,A,o,23,RG[47]),A=XG(A,_,w,S,i,6,RG[48]),S=XG(S,A,_,w,d,10,RG[49]),w=XG(w,S,A,_,g,15,RG[50]),_=XG(_,w,S,A,c,21,RG[51]),A=XG(A,_,w,S,y,6,RG[52]),S=XG(S,A,_,w,s,10,RG[53]),w=XG(w,S,A,_,p,15,RG[54]),_=XG(_,w,S,A,a,21,RG[55]),A=XG(A,_,w,S,h,6,RG[56]),S=XG(S,A,_,w,b,10,RG[57]),w=XG(w,S,A,_,l,15,RG[58]),_=XG(_,w,S,A,v,21,RG[59]),A=XG(A,_,w,S,u,6,RG[60]),S=XG(S,A,_,w,m,10,RG[61]),w=XG(w,S,A,_,o,15,RG[62]),_=XG(_,w,S,A,f,21,RG[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),a=n;t[15+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t[14+(r+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),e.sigBytes=4*(t.length+1),this._process();const o=this._hash,s=o.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 o}clone(){const e=super.clone.call(this);return e._hash=this._hash.clone(),e}}class DG extends wG{constructor(e){super(),this.cfg=Object.assign(new wG,{keySize:4,hasher:VG,iterations:1},e)}compute(e,t){let n;const{cfg:r}=this,i=r.hasher.create(),a=SG.create(),o=a.words,{keySize:s,iterations:u}=r;for(;o.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();a.concat(n)}return a.sigBytes=4*s,a}}class MG extends EG{constructor(e,t,n){super(),this.cfg=Object.assign(new wG,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?BG:HG;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()}}MG._ENC_XFORM_MODE=1,MG._DEC_XFORM_MODE=2,MG.keySize=4,MG.ivSize=4;class WG extends wG{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 NG(e,t,n){const r=e;let i;const a=this._iv;a?(i=a,this._iv=void 0):i=this._prevBlock;for(let o=0;o<n;o+=1)r[t+o]^=i[o]}class OG extends WG{}OG.Encryptor=class extends OG{processBlock(e,t){const n=this._cipher,{blockSize:r}=n;NG.call(this,e,t,r),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+r)}},OG.Decryptor=class extends OG{processBlock(e,t){const n=this._cipher,{blockSize:r}=n,i=e.slice(t,t+r);n.decryptBlock(e,t),NG.call(this,e,t,r),this._prevBlock=i}};const UG={pad(e,t){const n=4*t,r=n-e.sigBytes%n,i=r<<24|r<<16|r<<8|r,a=[];for(let s=0;s<r;s+=4)a.push(i);const o=SG.create(a,r);e.concat(o)},unpad(e){const t=e,n=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=n}};class FG extends MG{constructor(e,t,n){super(e,t,Object.assign({mode:OG,padding:UG},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 YG extends wG{constructor(e){super(),this.mixIn(e)}toString(e){return(e||this.formatter).stringify(this)}}const KG={stringify(e){let t;const{ciphertext:n,salt:r}=e;return t=r?SG.create([1398893684,1701076831]).concat(r).concat(n):n,t.toString(IG)},parse(e){let t;const n=IG.parse(e),r=n.words;return 1398893684===r[0]&&1701076831===r[1]&&(t=SG.create(r.slice(2,4)),r.splice(0,4),n.sigBytes-=16),YG.create({ciphertext:n,salt:t})}};class HG extends wG{static encrypt(e,t,n,r){const i=Object.assign(new wG,this.cfg,r),a=e.createEncryptor(n,i),o=a.finalize(t),s=a.cfg;return YG.create({ciphertext:o,key:n,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:a.blockSize,formatter:i.format})}static decrypt(e,t,n,r){let i=t;const a=Object.assign(new wG,this.cfg,r);i=this._parse(i,a.format);return e.createDecryptor(n,a).finalize(i.ciphertext)}static _parse(e,t){return"string"==typeof e?t.parse(e,this):e}}HG.cfg=Object.assign(new wG,{format:KG});const jG={execute(e,t,n,r){let i=r;i||(i=SG.random(8));const a=DG.create({keySize:t+n}).compute(e,i),o=SG.create(a.words.slice(t),4*n);return a.sigBytes=4*t,YG.create({key:a,iv:o,salt:i})}};class BG extends HG{static encrypt(e,t,n,r){const i=Object.assign(new wG,this.cfg,r),a=i.kdf.execute(n,e.keySize,e.ivSize);i.iv=a.iv;const o=HG.encrypt.call(this,e,t,a.key,i);return o.mixIn(a),o}static decrypt(e,t,n,r){let i=t;const a=Object.assign(new wG,this.cfg,r);i=this._parse(i,a.format);const o=a.kdf.execute(n,e.keySize,e.ivSize,i.salt);a.iv=o.iv;return HG.decrypt.call(this,e,i,o.key,a)}}BG.cfg=Object.assign(HG.cfg,{kdf:jG});const JG=[],zG=[],QG=[],qG=[],$G=[],eP=[],tP=[],nP=[],rP=[],iP=[],aP=[];for(let T0=0;T0<256;T0+=1)aP[T0]=T0<128?T0<<1:T0<<1^283;let oP=0,sP=0;for(let T0=0;T0<256;T0+=1){let e=sP^sP<<1^sP<<2^sP<<3^sP<<4;e=e>>>8^255&e^99,JG[oP]=e,zG[e]=oP;const t=aP[oP],n=aP[t],r=aP[n];let i=257*aP[e]^16843008*e;QG[oP]=i<<24|i>>>8,qG[oP]=i<<16|i>>>16,$G[oP]=i<<8|i>>>24,eP[oP]=i,i=16843009*r^65537*n^257*t^16843008*oP,tP[e]=i<<24|i>>>8,nP[e]=i<<16|i>>>16,rP[e]=i<<8|i>>>24,iP[e]=i,oP?(oP=t^aP[aP[aP[r^t]]],sP^=aP[aP[sP]]):(sP=1,oP=sP)}const uP=[0,1,2,4,8,16,32,64,128,27,54];class cP extends FG{_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 a=this._keySchedule;for(let s=0;s<i;s+=1)s<r?a[s]=n[s]:(e=a[s-1],s%r?r>6&&s%r==4&&(e=JG[e>>>24]<<24|JG[e>>>16&255]<<16|JG[e>>>8&255]<<8|JG[255&e]):(e=e<<8|e>>>24,e=JG[e>>>24]<<24|JG[e>>>16&255]<<16|JG[e>>>8&255]<<8|JG[255&e],e^=uP[s/r|0]<<24),a[s]=a[s-r]^e);this._invKeySchedule=[];const o=this._invKeySchedule;for(let s=0;s<i;s+=1){const t=i-s;e=s%4?a[t]:a[t-4],o[s]=s<4||t<=4?e:tP[JG[e>>>24]]^nP[JG[e>>>16&255]]^rP[JG[e>>>8&255]]^iP[JG[255&e]]}}encryptBlock(e,t){this._doCryptBlock(e,t,this._keySchedule,QG,qG,$G,eP,JG)}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,tP,nP,rP,iP,zG),r=n[t+1],n[t+1]=n[t+3],n[t+3]=r}_doCryptBlock(e,t,n,r,i,a,o,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]^a[h>>>8&255]^o[255&f]^n[p];p+=1;const t=r[d>>>24]^i[h>>>16&255]^a[f>>>8&255]^o[255&l]^n[p];p+=1;const s=r[h>>>24]^i[f>>>16&255]^a[l>>>8&255]^o[255&d]^n[p];p+=1;const u=r[f>>>24]^i[l>>>16&255]^a[d>>>8&255]^o[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}}cP.keySize=8;const lP=FG._createHelper(cP);class dP extends WG{}dP.Encryptor=class extends dP{processBlock(e,t){const n=e,r=this._cipher,{blockSize:i}=r,a=this._iv;let o=this._counter;a&&(this._counter=a.slice(0),o=this._counter,this._iv=void 0);const s=o.slice(0);r.encryptBlock(s,0),o[i-1]=o[i-1]+1|0;for(let u=0;u<i;u+=1)n[t+u]^=s[u]}},dP.Decryptor=dP.Encryptor;const hP={pad(){},unpad(){}};var fP=new wA("BufferService"),pP=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2e4;s(this,e),l(this,"flv",null),l(this,"_demuxer",new WC),l(this,"_remuxer",null),l(this,"_mse",null),l(this,"_softVideo",null),l(this,"_sourceCreated",!1),l(this,"_needInitSegment",!0),l(this,"_discontinuity",!0),l(this,"_contiguous",!1),l(this,"_initSegmentId",""),l(this,"_cachedBuffer",null),l(this,"_demuxStartTime",0),l(this,"_analyzeDuration",0),this.flv=t,this._analyzeDuration=r,n?this._softVideo=n:(this._remuxer=new _G(this._demuxer.videoTrack,this._demuxer.audioTrack),this._mse=new ZA,this._mse.bindMedia(t.media))}var t,n,a,u,d,h;return c(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:"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:(h=o(i().mark((function e(){var t,n=arguments;return i().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 h.apply(this,arguments)})},{key:"endOfStream",value:(d=o(i().mark((function e(){return i().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(wZ.BUFFEREOS);case 5:e.next=8;break;case 7:this._softVideo&&this._softVideo.endOfStream();case 8:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"updateDuration",value:(u=o(i().mark((function e(t){return i().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 fP.debug("update duration",t),e.next=7,this._mse.updateDuration(t);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"destroy",value:(a=o(i().mark((function e(){return i().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 a.apply(this,arguments)})},{key:"appendBuffer",value:(n=o(i().mark((function e(t){var n,r,a,o,s,u,c,l,d,h,f,p,m,y;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._cachedBuffer&&(t=PZ(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 Zb(Sb,Eb.FLV,e.t0);case 11:if(r=n.videoTrack,a=n.audioTrack,o=n.metadataTrack,s=r.exist(),u=a.exist(),!(!s&&r.present||!u&&a.present)){e.next=27;break}if(c=0,(l=s?r:u?a:void 0)&&l.samples.length&&(c=(l.samples[l.samples.length-1].originPts-l.samples[0].originPts)/l.timescale*1e3),!(c>this._analyzeDuration)){e.next=25;break}fP.warn("analyze duration exceeded, ".concat(c,"ms"),l),r.present=s,a.present=u,this.flv.emit(wZ.ANALYZE_DURATION_EXCEEDED,{duration:c}),e.next=27;break;case 25:return this._cachedBuffer=t,e.abrupt("return");case 27:if(d=r.type,h=a.type,this._fireEvents(r,a,o),this._discontinuity=!1,this._contiguous=!0,this._demuxStartTime=0,f=this._mse,this.flv.emit(wZ.DEMUXED_TRACK,r),(p="".concat(r.codec,"/").concat(r.width,"/").concat(r.height,"/").concat(a.codec,"/").concat(a.config))!==this._initSegmentId&&(this._needInitSegment=!0,this._initSegmentId=p,this._emitMetaParsedEvent(r,a)),!f){e.next=63;break}if(this._sourceCreated){e.next=45;break}return e.next=41,f.open();case 41:s&&(fP.log("codec: video/mp4;codecs=".concat(r.codec)),f.createSource(d,"video/mp4;codecs=".concat(r.codec))),u&&(fP.log("codec: audio/mp4;codecs=".concat(a.codec)),f.createSource(h,"audio/mp4;codecs=".concat(a.codec))),this._sourceCreated=!0,this.flv.emit(wZ.SOURCEBUFFER_CREATED);case 45:e.prev=45,m=this._remuxer.remux(this._needInitSegment),e.next=52;break;case 49:throw e.prev=49,e.t1=e.catch(45),new Zb(kb,Eb.FMP4,e.t1);case 52:if(!this._needInitSegment||m.videoInitSegment||m.audioInitSegment){e.next=54;break}return e.abrupt("return");case 54: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 63:this._softVideo&&this._softVideo.appendBuffer(r,a);case 64:case"end":return e.stop()}}),e,this,[[4,8],[45,49]])}))),function(e){return n.apply(this,arguments)})},{key:"evictBuffer",value:(t=o(i().mark((function e(t){var n,r,a,o=this;return i().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,!((a=r-t)<=0)){e.next=7;break}return e.abrupt("return");case 7:if(!(bb.start(bb.get(n))+1>=a)){e.next=10;break}return e.abrupt("return");case 10:return e.abrupt("return",this._mse.clearBuffer(0,a).then((function(){return o.flv.emit(wZ.REMOVE_BUFFER,{removeEnd:a})})));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(wZ.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.flv.emit(wZ.METADATA_PARSED,{type:"audio",track:t,meta:{codec:t.codec,channelCount:t.channelCount,sampleRate:t.sampleRate,timescale:t.timescale,baseDts:t.baseDts}}),fP.debug("track parsed",e,t)}},{key:"_fireEvents",value:function(e,t,n){var i=this;fP.debug(e.samples,t.samples),n.flvScriptSamples.forEach((function(e){i.flv.emit(wZ.FLV_SCRIPT_DATA,e),fP.debug("flvScriptData",e)})),e.samples.forEach((function(e){e.keyframe&&i.flv.emit(wZ.KEYFRAME,{pts:e.pts})})),e.warnings.forEach((function(e){var t;switch(e.type){case CR:t=wZ.LARGE_AV_FIRST_FRAME_GAP_DETECT;break;case GR:t=wZ.LARGE_VIDEO_DTS_GAP_DETECT;break;case PR:t=wZ.MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT}t&&i.flv.emit(wZ.STREAM_EXCEPTION,r(r({},e),{},{type:t})),fP.warn("video exception",e)})),t.warnings.forEach((function(e){var t;switch(e.type){case XR:t=wZ.LARGE_AUDIO_DTS_GAP_DETECT;break;case VR:t=wZ.AUDIO_GAP_DETECT;break;case DR:t=wZ.AUDIO_OVERLAP_DETECT}t&&i.flv.emit(wZ.STREAM_EXCEPTION,r(r({},e),{},{type:t})),fP.warn("audio exception",e)})),n.seiSamples.forEach((function(e){i.flv.emit(wZ.SEI,r(r({},e),{},{sei:{code:e.data.type,content:e.data.payload,dts:e.pts}}))}))}}]),e}();function mP(e,t){var n=0,r=e.length-1,i=0,a=0,o=r;for(t<e[0]&&(n=0,a=o+1);a<=o;){if((i=a+Math.floor((o-a)/2))===r||t>=e[i]&&t<e[i+1]){n=i;break}e[i]<t?a=i+1:o=i-1}return n}var yP=new wA("flv"),vP=function(e){d(g,e);var t,n,a,u,h,f,y,v=m(g);function g(e){var t,n;return s(this,g),l(p(t=v.call(this)),"media",null),l(p(t),"_loading",!1),l(p(t),"_opts",null),l(p(t),"_bufferService",null),l(p(t),"_gapService",null),l(p(t),"_stats",null),l(p(t),"_mediaLoader",null),l(p(t),"_maxChunkWaitTimer",null),l(p(t),"_tickTimer",null),l(p(t),"_tickInterval",500),l(p(t),"_urlSwitching",!1),l(p(t),"_seamlessSwitching",!1),l(p(t),"_keyframes",null),l(p(t),"_acceptRanges",!0),l(p(t),"_onProgress",function(){var e=o(i().mark((function e(n,r,a,o){var s,u,c,l,d,h,f,p;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=a.startTime,u=a.endTime,c=a.st,l=a.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(wZ.TTFB,{url:t._opts.url,responseUrl:o.url,elapsed:c?l-c:u-s}),t.emit(wZ.LOAD_RESPONSE_HEADERS,{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:t.isLive&&(null===(f=t._bufferService)||void 0===f||f.evictBuffer(t._opts.bufferBehind)),e.next=24;break;case 21:return e.prev=21,e.t0=e.catch(15),e.abrupt("return",t._emitError(Zb.create(e.t0)));case 24:if(t._urlSwitching&&(t._urlSwitching=!1,t.emit(wZ.SWITCH_URL_SUCCESS,{url:t._opts.url})),t._seamlessSwitching&&(t._seamlessSwitching=!1,t.media.play().catch((function(){})),t._tick()),!r||t.media.seeking){e.next=32;break}return t.emit(wZ.LOAD_COMPLETE),yP.debug("load done"),e.abrupt("return",t._end());case 32:(p=t._opts.maxReaderInterval)&&(clearTimeout(t._maxChunkWaitTimer),t._maxChunkWaitTimer=setTimeout((function(){yP.debug("onMaxChunkWait",p),t._end()}),p));case 34:case"end":return e.stop()}}),e,null,[[15,21]])})));return function(t,n,r,i){return e.apply(this,arguments)}}()),l(p(t),"_onRetryError",(function(e,n){yP.debug("load retry",e,n),t.emit(wZ.LOAD_RETRY,{error:Zb.network(e),retryTime:n})})),l(p(t),"_end",(function(){t._clear(),t._bufferService&&t._bufferService.endOfStream(),yP.debug("end stream")})),l(p(t),"_tick",(function(){clearTimeout(t._tickTimer);var e=p(t).media;if(e){t._tickTimer=setTimeout(t._tick,t._tickInterval);var n=bb.end(bb.get(e));if(!(n<.1)&&e.readyState){var r=t._opts;if(CZ(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()}}}})),l(p(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);t.isLive&&!t._loading&&r&&t.replay(void 0,!0)})),l(p(t),"_onSeeking",o(i().mark((function e(){var n,r,a,o,s;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.isLive||!t.seekable){e.next=14;break}if(n=t._keyframes.times,r=t._keyframes.filepositions,null!=n&&n.length&&null!=r&&r.length){e.next=5;break}return e.abrupt("return");case 5:if(a=t.media.currentTime,o=mP(t._keyframes.times,a),null!=(s=r[o])){e.next=10;break}return e.abrupt("return");case 10:return e.next=12,t._mediaLoader.cancel();case 12:t._loadData(null,[s]),t._bufferService.unContiguous(n[o]);case 14:case"end":return e.stop()}}),e)})))),l(p(t),"_onTimeupdate",(function(){if(t.media){var e=t._opts,n=t.media.currentTime;if(e.isLive&&e.maxLatency&&e.targetLatency){var r=bb.end(bb.get(t.media));r-n>=e.maxLatency&&(t.media.currentTime=r-e.targetLatency)}t._seiService.throw(n)}})),l(p(t),"_onFlvScriptData",(function(e){var n,r,i,a,o=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===(a=i.onMetaData)||void 0===a?void 0:a.duration;o&&(t._keyframes=o),!t._opts.isLive&&s&&t._bufferService.updateDuration(s)})),t._opts=((n=r({retryCount:3,retryDelay:1e3,loadTimeout:1e4,maxReaderInterval:5e3,preloadTime:5,isLive:!1,softDecode:!1,bufferBehind:10,maxJumpDistance:3,analyzeDuration:2e4,seamlesslyReload:!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 VZ(r(r({},t._opts.fetchOptions),{},{retry:t._opts.retryCount,retryDelay:t._opts.retryDelay,timeout:t._opts.loadTimeout,onRetryError:t._onRetryError,onProgress:t._onProgress,responseType:"arraybuffer"})),t._bufferService=new pP(p(t),t._opts.softDecode?t.media:void 0,t._opts.analyzeDuration),t._seiService=new HI(p(t)),t._bandwidthService=new jI,t._stats=new JI(p(t)),t._opts.softDecode||(t._gapService=new DZ),t.media.addEventListener("play",t._onPlay),t.media.addEventListener("seeking",t._onSeeking),t.media.addEventListener("timeupdate",t._onTimeupdate),t.on(wZ.FLV_SCRIPT_DATA,t._onFlvScriptData),t}return c(g,[{key:"version",get:function(){return"3.0.0-next.23"}},{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:"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]:.1;return bb.info(bb.get(this.media),null===(e=this.media)||void 0===e?void 0:e.currentTime,t)}},{key:"playbackQuality",value:function(){return GZ(this.media)}},{key:"load",value:(y=o(i().mark((function e(t){var n,r=arguments;return i().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),clearTimeout(this._tickTimer),this._tickTimer=setTimeout(this._tick,this._tickInterval);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"replay",value:(f=o(i().mark((function e(){var t,n,r=this,a=arguments;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:this._opts.seamlesslyReload,n=a.length>1?a[1]:void 0,this.media){e.next=4;break}return e.abrupt("return");case 4:if(!t){e.next=10;break}return e.next=7,this._clear();case 7:setTimeout((function(){r._loadData(r._opts.url),r._bufferService.seamlessSwitch(),r._seamlessSwitching=!0})),e.next=12;break;case 10:return e.next=12,this.load();case 12:return e.abrupt("return",this.media.play(!n).catch((function(){})));case 13:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"disconnect",value:function(){return yP.debug("disconnect!"),this._clear()}},{key:"switchURL",value:(h=o(i().mark((function e(t,n){var r=this;return i().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(n&&this._opts.isLive){e.next=7;break}return e.next=5,this.load(t);case 5:return this._urlSwitching=!0,e.abrupt("return",this.media.play(!0).catch((function(){})));case 7:return e.next=9,this._clear();case 9:setTimeout((function(){r._loadData(t),r._bufferService.seamlessSwitch(),r._urlSwitching=!0,r._seamlessSwitching=!0}));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"destroy",value:(u=o(i().mark((function e(){return i().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),e.next=9,Promise.all([this._clear(),this._bufferService.destroy()]);case 9:this.media=null,this._bufferService=null;case 11:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"_emitError",value:function(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];yP.table(e),yP.error(e),yP.error(null===(t=this.media)||void 0===t?void 0:t.error),this._urlSwitching&&(this._urlSwitching=!1,this._seamlessSwitching=!1,this.emit(wZ.SWITCH_URL_FAILED,e)),this.emit(wZ.ERROR,e),n&&(this._seiService.reset(),this._end())}},{key:"_reset",value:(a=o(i().mark((function e(){var t,n=arguments;return i().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:this._firstProgressEmit=!1;case 9:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"_loadData",value:(n=o(i().mark((function e(t,n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&(this._opts.url=t),t=this._opts.url){e.next=4;break}throw new Error("Source url is missing");case 4:if(this.emit(wZ.LOAD_START,{url:t}),yP.debug("load data, loading:",this._loading,t),!this._loading){e.next=9;break}return e.next=9,this._mediaLoader.cancel();case 9:return this._loading=!0,e.prev=10,e.next=13,this._mediaLoader.load({url:t,range:n});case 13:e.next=18;break;case 15:return e.prev=15,e.t0=e.catch(10),e.abrupt("return",this._emitError(Zb.network(e.t0)));case 18:case"end":return e.stop()}}),e,this,[[10,15]])}))),function(e,t){return n.apply(this,arguments)})},{key:"_clear",value:(t=o(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(clearTimeout(this._maxChunkWaitTimer),clearTimeout(this._tickTimer),!this._mediaLoader){e.next=5;break}return e.next=5,this._mediaLoader.cancel();case 5:this._loading=!1;case 6: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:ZA.isSupported()}},{key:"enableLogger",value:function(){wA.enable(),cC.enable()}},{key:"disableLogger",value:function(){wA.disable(),cC.disable()}}]),g}(Za);try{localStorage.getItem("xgd")?vP.enableLogger():vP.disableLogger()}catch(S0){}var gP=function(){function e(t,n){var i=this;s(this,e),l(this,"_onLowDecode",(function(){var e,t,n,a,o=i._opts,s=o.media,u=o.innerDegrade,c=o.backupURL;null===(e=i._plugin)||void 0===e||null===(t=e.player)||void 0===t||t.emit("lowdecode",s.degradeInfo),null===(n=i._plugin)||void 0===n||null===(a=n.player)||void 0===a||a.emit("core_event",r(r({},s.degradeInfo),{},{eventName:wZ.LOWDECODE})),1!==u&&3!==u||!c||i._degrade(c)})),l(this,"_degrade",(function(e){var t=i._plugin.player,n=t.video;if("MVideo"===(null==n?void 0:n.TAG)){var r=t.video.degradeVideo;t.video=r,n.degrade(e),e&&(t.config.url=e);var a=t.root.firstChild;"MVideo"===a.TAG&&t.root.replaceChild(r,a);var o=i._plugin.constructor.pluginName.toLowerCase();t.unRegisterPlugin(o),t.once("canplay",(function(){t.play()}))}})),l(this,"forceDegradeToVideo",(function(e){var t=i._opts.innerDegrade;1!==t&&3!==t||i._degrade(e)})),this._opts=t,this._plugin=n,this._init()}return c(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}(),bP=function(e){d(n,e);var t=m(n);function n(){var e;s(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return l(p(e=t.call.apply(t,[this].concat(i))),"flv",null),l(p(e),"pluginExtension",null),l(p(e),"getStats",(function(){var t;return null===(t=e.flv)||void 0===t?void 0:t.getStats()})),l(p(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})),l(p(e),"_onSwitchURL",(function(t,n){e.flv&&(e.player.config.url=t,e.flv.switchURL(t,n))})),l(p(e),"_onDefinitionChange",(function(t){var n=t.to;e.flv&&e.flv.switchURL(n)})),e}return c(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:"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,i=t.flv||{};if(null!==i.disconnectTime&&void 0!==i.disconnectTime||(i.disconnectTime=0),this.flv=new vP(r({softDecode:this.softDecode,isLive:t.isLive,media:this.player.video},i)),this.softDecode||qa.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 gP(r({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(Ka,this._onSwitchURL),this.on(Ya,this.destroy),this._transError(),this._transCoreEvent(wZ.TTFB),this._transCoreEvent(wZ.LOAD_START),this._transCoreEvent(wZ.LOAD_RESPONSE_HEADERS),this._transCoreEvent(wZ.LOAD_COMPLETE),this._transCoreEvent(wZ.LOAD_RETRY),this._transCoreEvent(wZ.SOURCEBUFFER_CREATED),this._transCoreEvent(wZ.ANALYZE_DURATION_EXCEEDED),this._transCoreEvent(wZ.REMOVE_BUFFER),this._transCoreEvent(wZ.BUFFEREOS),this._transCoreEvent(wZ.KEYFRAME),this._transCoreEvent(wZ.METADATA_PARSED),this._transCoreEvent(wZ.SEI),this._transCoreEvent(wZ.SEI_IN_TIME),this._transCoreEvent(wZ.FLV_SCRIPT_DATA),this._transCoreEvent(wZ.STREAM_EXCEPTION),this._transCoreEvent(wZ.SWITCH_URL_SUCCESS),this._transCoreEvent(wZ.SWITCH_URL_FAILED),this.flv.load(t.url,!0)}}},{key:"_transError",value:function(){var e=this;this.flv.on(wZ.ERROR,(function(t){e.player&&e.player.emit(Fa,new Ua(e.player,t))}))}},{key:"_transCoreEvent",value:function(e){var t=this;this.flv.on(e,(function(n){t.player&&t.player.emit("core_event",r(r({},n),{},{eventName:e}))}))}}],[{key:"pluginName",get:function(){return"flv"}},{key:"isSupported",value:function(e,t){return vP.isSupported(e,t)}}]),n}(qa);function AP(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 _P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?AP(Object(n),!0).forEach((function(t){ZP(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AP(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function wP(){wP=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:{},a=i.iterator||"@@iterator",o=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 a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new T(i||[]);return r(o,"_invoke",{value:_(e,n,s)}),o}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,a,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,a)&&(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,a,o,s){var u=l(e[r],e,a);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,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,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[a];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,o,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new A(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(g),u(g,s,"Generator"),u(g,a,(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 o.type="throw",o.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 a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.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 a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},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 SP(e){return(SP="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 kP(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(S0){return void n(S0)}s.done?t(u):Promise.resolve(u).then(r,i)}function TP(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){kP(a,r,i,o,s,"next",e)}function s(e){kP(a,r,i,o,s,"throw",e)}o(void 0)}))}}function xP(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function EP(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 LP(e,t,n){return t&&EP(e.prototype,t),n&&EP(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ZP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function IP(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&&CP(e,t)}function RP(e){return(RP=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function CP(e,t){return(CP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function GP(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function PP(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=RP(e);if(t){var i=RP(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 GP(e)}(this,n)}}function XP(e){return function(e){if(Array.isArray(e))return VP(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 VP(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 VP(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 VP(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}l(bP,"Flv",vP);var DP=A,MP=Ts,WP=ae,NP=Ps,OP=Vs,UP=/MSIE .\./.test(fe),FP=DP.Function,YP=function(e){return UP?function(t,n){var r=OP(arguments.length,1)>2,i=WP(t)?t:FP(t),a=r?NP(arguments,2):void 0;return e(r?function(){MP(i,this,a)}:i,n)}:e},KP={setTimeout:YP(DP.setTimeout),setInterval:YP(DP.setInterval)},HP=KP.setInterval;pi({global:!0,bind:!0,forced:A.setInterval!==HP},{setInterval:HP});var jP=KP.setTimeout;pi({global:!0,bind:!0,forced:A.setTimeout!==jP},{setTimeout:jP});var BP=Wv.every;pi({target:"Array",proto:!0,forced:!Ov("every")},{every:function(e){return BP(this,e,arguments.length>1?arguments[1]:void 0)}});var JP=pi,zP=Ir.indexOf,QP=Ov,qP=Ls([].indexOf),$P=!!qP&&1/qP([1],1,-0)<0,eX=QP("indexOf");JP({target:"Array",proto:!0,forced:$P||!eX},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return $P?qP(this,e,t)||0:zP(this,e,t)}});var tX=W,nX=Xe,rX=ue,iX=rt,aX=Ps,oX=k,sX=Function,uX=tX([].concat),cX=tX([].join),lX={},dX=oX?sX.bind:function(e){var t=nX(this),n=t.prototype,r=aX(arguments,1),i=function(){var n=uX(r,aX(arguments));return this instanceof i?function(e,t,n){if(!iX(lX,t)){for(var r=[],i=0;i<t;i++)r[i]="a["+i+"]";lX[t]=sX("C,a","return new C("+cX(r,",")+")")}return lX[t](e,n)}(t,n.length,n):t.apply(e,n)};return rX(n)&&(i.prototype=n),i},hX=dX;pi({target:"Function",proto:!0,forced:Function.bind!==hX},{bind:hX});pi({target:"Array",proto:!0,forced:[].forEach!=Fv},{forEach:Fv});var fX=W,pX=lr,mX=Date.prototype,yX="Invalid Date",vX="toString",gX=fX(mX[vX]),bX=fX(mX.getTime);String(new Date(NaN))!=yX&&pX(mX,vX,(function(){var e=bX(this);return e==e?gX(this):yX}));var AX=A,_X=w,wX=W,SX=nf,kX=ML.trim,TX=ZL,xX=AX.parseInt,EX=AX.Symbol,LX=EX&&EX.iterator,ZX=/^[+-]?0x/i,IX=wX(ZX.exec),RX=8!==xX(TX+"08")||22!==xX(TX+"0x16")||LX&&!_X((function(){xX(Object(LX))}))?function(e,t){var n=kX(SX(e));return xX(n,t>>>0||(IX(ZX,n)?16:10))}:xX;function CX(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 GX(e){return(GX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function PX(e,t){return(PX=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function XX(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function VX(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=GX(e);if(t){var i=GX(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 XX(e)}(this,n)}}function DX(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MX(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 WX(e,t,n){return t&&MX(e.prototype,t),n&&MX(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}pi({global:!0,forced:parseInt!=RX},{parseInt:RX});var NX=function(){function e(){var t,n;DX(this,e);var r=new Promise((function(e,r){t=e,n=r}));return r.resolve=t,r.reject=n,r}return WX(e,[{key:"resolve",value:function(e){}},{key:"reject",value:function(e){}}]),e}(),OX=pi,UX=Date,FX=W(UX.prototype.getTime);OX({target:"Date",stat:!0},{now:function(){return FX(new UX)}});var YX=function(){function e(){DX(this,e)}return WX(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}(),KX=function(){function e(){DX(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 WX(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(){YX.install()}}]),e}(),HX=pi,jX=Ls,BX=w,JX=zt,zX=Ar,QX=Sr,qX=As,$X=zw.ArrayBuffer,eV=zw.DataView,tV=eV.prototype,nV=jX($X.prototype.slice),rV=jX(tV.getUint8),iV=jX(tV.setUint8);HX({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:BX((function(){return!new $X(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(nV&&void 0===t)return nV(JX(this),e);for(var n=JX(this).byteLength,r=zX(e,n),i=zX(void 0===t?n:t,n),a=new(qX(this,$X))(QX(i-r)),o=new eV(this),s=new eV(a),u=0;r<i;)iV(s,u++,rV(o,r++));return a}});var aV=Ts,oV=E,sV=W,uV=ME,cV=zt,lV=J,dV=hR,hV=q,fV=As,pV=NE,mV=Sr,yV=nf,vV=Me,gV=sp,bV=tL,AV=mb,_V=w,wV=Fg.UNSUPPORTED_Y,SV=4294967295,kV=Math.min,TV=[].push,xV=sV(/./.exec),EV=sV(TV),LV=sV("".slice),ZV=!_V((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]}));uV("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=yV(hV(this)),i=void 0===n?SV:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!dV(e))return oV(t,r,e,i);for(var a,o,s,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,d=new RegExp(e.source,c+"g");(a=oV(AV,d,r))&&!((o=d.lastIndex)>l&&(EV(u,LV(r,l,a.index)),a.length>1&&a.index<r.length&&aV(TV,u,gV(a,1)),s=a[0].length,l=o,u.length>=i));)d.lastIndex===a.index&&d.lastIndex++;return l===r.length?!s&&xV(d,"")||EV(u,""):EV(u,LV(r,l)),u.length>i?gV(u,0,i):u}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:oV(t,this,e,n)}:t,[function(t,n){var i=hV(this),a=lV(t)?void 0:vV(t,e);return a?oV(a,t,i,n):oV(r,yV(i),t,n)},function(e,i){var a=cV(this),o=yV(e),s=n(r,a,o,i,r!==t);if(s.done)return s.value;var u=fV(a,RegExp),c=a.unicode,l=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.unicode?"u":"")+(wV?"g":"y"),d=new u(wV?"^(?:"+a.source+")":a,l),h=void 0===i?SV:i>>>0;if(0===h)return[];if(0===o.length)return null===bV(d,o)?[o]:[];for(var f=0,p=0,m=[];p<o.length;){d.lastIndex=wV?0:p;var y,v=bV(d,wV?LV(o,p):o);if(null===v||(y=kV(mV(d.lastIndex+(wV?p:0)),o.length))===f)p=pV(o,p,c);else{if(EV(m,LV(o,f,p)),m.length===h)return m;for(var g=1;g<=v.length-1;g++)if(EV(m,v[g]),m.length===h)return m;p=f=y}}return EV(m,LV(o,f)),m}]}),!ZV,wV);var IV=function(){function e(){DX(this,e),this.timeID=null,this.func=null}return WX(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}(),RV=CV&&!function(){var e="_localstorage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(t){return!0}}();function CV(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}var GV={length:RV?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(S0){}},getItem:function(e){try{return localStorage.getItem(e)}catch(S0){return null}},key:function(e){try{return localStorage.key(e)}catch(S0){return null}},setItem:function(e,t){try{localStorage.setItem(e,t)}catch(S0){}},removeItem:function(e){try{localStorage.removeItem(e)}catch(S0){}},isSupport:RV},PV="video",XV="appendBuffer",VV="removeBuffer",DV="mse_error",MV="updateend",WV="mse_open",NV="mse_open_done",OV=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&&PX(e,t)}(a,e);var t,n,r,i=VX(a);function a(e,t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(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(XX(n)),n._onSourceBufferError=n._onSourceBufferError.bind(XX(n)),n._onSourceBufferUpdateEnd=n._onSourceBufferUpdateEnd.bind(XX(n)),n._mseStart=UV(),n._appendStart=-1,n.mediaSource.addEventListener("sourceopen",n._onSourceOpen),n.opQueues={},n.sourceBuffers={},n.updateHanders={},n.errorHandlers={},n.logger=t||function(){},n._sourceOpenDonePromise=new NX,n._mseAppendFlag=!1,n._mseOpenTime=-1,n.mseFullFlag={},n}return t=a,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=PV)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=UV()-this._mseStart,console.log("[mseOpen]==> costtime",this._mseOpenTime),this.mediaSource.removeEventListener("sourceopen",this._onSourceOpen),this.emit(WV,{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,a=e.mediaSource.addSourceBuffer(i),o=function(){return e._onSourceBufferError(r)};a.addEventListener("error",o);var s=function(){return e._onSourceBufferUpdateEnd(r)};a.addEventListener("updateend",s),e.updateHanders={},e.sourceBuffers[r]=a,e.opQueues[r]=[],e.updateHanders[r]=s,e.errorHandlers[r]=o}()}catch(S0){S0.errtype="open_error",this.emit(DV,S0)}this.logger("[debug mse] mse init ready, readyState",this.mediaSource.readyState),this._mseAppendFlag=!0,this.emit(NV,{costtime:UV()-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(DV,{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(MV,{name:t.name,context:t.context,costtime:UV()-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)}),XV,n)}},{key:"_append",value:function(e,t,n){this._appendStart=UV(),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 a={handler:t,context:r,name:n};return this._mseAppendFlag?this._enQueue(e,a):this._sourceOpenDonePromise.then((function(){i._hasDestroyed||i._enQueue(e,a)})),a.p}}},{key:"_enQueue",value:function(e,t){this.opQueues[e]||(this.opQueues[e]=[]),this.mseFullFlag[e]&&t.name===VV?(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),a=function(e){var a=i[e],o=new NX,s={handler:function(){return o.resolve()},p:o,name:t};n.opQueues[a]||(n.opQueues[a]=[]),n.opQueues[a].push(s),r.push(o),1===n.opQueues[a].length&&s.handler()},o=0;o<i.length;o++)a(o);Promise.all(r).then((function(){try{e()}catch(a){console.log(a)}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[PV]}},{key:"handleOp",value:function(e){if(!this._hasDestroyed){var t=this.opQueues[e][0];if(t&&!this.mseFullFlag[e])try{t.handler()}catch(S0){S0&&S0.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(DV,{errtype:"append_error",context:t.context,errMsg:S0?S0.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===XV||this.opQueues[e][0].name===VV)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)}),VV,r)}},{key:"_remove",value:function(e,t,n,r){n<=t?this._onSourceBufferUpdateEnd(e):(this.logger("[debug mse],real removeBuffer, context,",r),this._appendStart=UV(),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(S0){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 a=this.updateHanders[n];r.removeEventListener("updateend",a)}}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&&CX(t.prototype,n),r&&CX(t,r),Object.defineProperty(t,"prototype",{writable:!1}),a}(Za),UV=function(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}};II("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),KI);var FV,YV={};Object.defineProperty(YV,"__esModule",{value:!0}),YV.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 a=!0,o=!1,s=void 0;try{for(var u,c=r[Symbol.iterator]();!(a=(u=c.next()).done);a=!0){t+=u.value.length}}catch(g){o=!0,s=g}finally{try{!a&&c.return&&c.return()}finally{if(o)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 KV=g(((FV=YV)&&FV.__esModule?FV:{default:FV}).default);function HV(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jV(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 BV(e,t,n){return t&&jV(e.prototype,t),n&&jV(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function JV(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zV(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,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(u){s=!0,i=u}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||qV(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 QV(e){return function(e){if(Array.isArray(e))return $V(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||qV(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 qV(e,t){if(e){if("string"==typeof e)return $V(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)?$V(e,t):void 0}}function $V(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 eD="video",tD="audio",nD="metadata",rD="avc",iD="hevc",aD="aac",oD="g7110a",sD="g7110m",uD=function(){function e(){HV(this,e),JV(this,"id",1),JV(this,"type",eD),JV(this,"codecType",rD),JV(this,"pid",-1),JV(this,"hvcC",void 0),JV(this,"codec",""),JV(this,"timescale",0),JV(this,"formatTimescale",0),JV(this,"sequenceNumber",0),JV(this,"baseMediaDecodeTime",0),JV(this,"baseDts",0),JV(this,"duration",0),JV(this,"warnings",[]),JV(this,"samples",[]),JV(this,"pps",[]),JV(this,"sps",[]),JV(this,"vps",[]),JV(this,"fpsNum",0),JV(this,"fpsDen",0),JV(this,"sarRatio",[]),JV(this,"width",0),JV(this,"height",0),JV(this,"nalUnitSize",4),JV(this,"present",!1),JV(this,"isVideoEncryption",!1),JV(this,"isAudioEncryption",!1),JV(this,"kid",null),JV(this,"pssh",null),JV(this,"ext",void 0)}return BV(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}(),cD=function(){function e(){HV(this,e),JV(this,"id",2),JV(this,"type",tD),JV(this,"codecType",aD),JV(this,"pid",-1),JV(this,"codec",""),JV(this,"sequenceNumber",0),JV(this,"sampleDuration",0),JV(this,"timescale",0),JV(this,"formatTimescale",0),JV(this,"baseMediaDecodeTime",0),JV(this,"duration",0),JV(this,"warnings",[]),JV(this,"samples",[]),JV(this,"baseDts",0),JV(this,"sampleSize",16),JV(this,"sampleRate",0),JV(this,"channelCount",0),JV(this,"objectType",0),JV(this,"sampleRateIndex",0),JV(this,"config",[]),JV(this,"present",!1),JV(this,"isVideoEncryption",!1),JV(this,"isAudioEncryption",!1),JV(this,"kid",null),JV(this,"ext",void 0)}return BV(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===aD)}},{key:"hasSample",value:function(){return!!this.samples.length}}]),e}(),lD=function(){function e(t,n,r){HV(this,e),JV(this,"flag",{}),JV(this,"keyframe",!1),JV(this,"gopId",0),JV(this,"duration",0),JV(this,"size",0),JV(this,"units",[]),JV(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=n,r&&(this.units=r)}return BV(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}(),dD=BV((function e(t,n,r,i){HV(this,e),JV(this,"duration",1024),JV(this,"flag",{dependsOn:2,isNonSyncSample:0}),JV(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=n,this.size=n.byteLength,this.sampleOffset=i,r&&(this.duration=r)})),hD=function(){function e(){HV(this,e),JV(this,"id",3),JV(this,"type",nD),JV(this,"timescale",0),JV(this,"flvScriptSamples",[]),JV(this,"seiSamples",[])}return BV(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}(),fD="undefined"!=typeof window,pD=fD&&navigator.userAgent.toLocaleLowerCase(),mD=fD&&pD.includes("firefox"),yD=fD&&pD.includes("android"),vD=function(){function e(){HV(this,e)}return BV(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 a=i,o=[],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]),o.push({pts:n+y*v,data:t.subarray(i+7+c,i+l)}),y++,i+=l}else i++;return{skip:a,remaining:i>=r?void 0:t.subarray(i),frames:o,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,a=e.FREQ[r];if(!a)throw new Error("Invalid sampling index: ".concat(r));var o=e._getConfig(r,i,n);return{samplingFrequencyIndex:r,sampleRate:a,objectType:n,channelCount:i,config:o.config,codec:o.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,a=[];return mD?e>=6?(r=5,i=e-3):(r=2,i=e):yD?(r=2,i=e):(r=2===n||5===n?n:5,i=e,e>=6?i=e-3:1===t&&(r=2,i=e)),a[0]=r<<3,a[0]|=(14&e)>>1,a[1]=(1&e)<<7,a[1]|=t<<3,5===r&&(a[1]|=(14&i)>>1,a[2]=(1&i)<<7,a[2]|=8,a[3]=0),{config:a,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 gD(){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}JV(vD,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var bD=Math.pow(2,32);function AD(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function _D(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 wD(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return _D(e,t)*bD+_D(e,t+4)}function SD(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 kD(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 TD=function(){function e(){HV(this,e)}return BV(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 a=0,o="",s=0;t.length>7;){if(a=_D(t),o=String.fromCharCode.apply(null,t.subarray(4,8)),s=8,1===a?(a=wD(t,8),s+=8):a||(a=t.length),!n[0]||o===n[0]){var u=t.subarray(0,a);if(!(n.length<2))return e.findBox(u.subarray(s),n.slice(1),r+s);i.push({start:r,size:a,headerSize:s,type:o,data:u})}r+=a,t=t.subarray(a)}return i}},{key:"tfhd",value:function(e){return ZD(e,!0,(function(e,t){e.trackId=_D(t);var n=4,r=1&e.flags,i=2&e.flags,a=8&e.flags,o=16&e.flags,s=32&e.flags;r&&(n+=4,e.baseDataOffset=_D(t,n),n+=4),i&&(e.sampleDescriptionIndex=_D(t,n),n+=4),a&&(e.defaultSampleDuration=_D(t,n),n+=4),o&&(e.defaultSampleSize=_D(t,n),n+=4),s&&(e.defaultSampleFlags=_D(t,n))}))}},{key:"sidx",value:function(e){return ZD(e,!0,(function(e,t){var n=0;e.reference_ID=_D(t,n),n+=4,e.timescale=_D(t,n),n+=4,0===e.version?(e.earliest_presentation_time=_D(t,n),n+=4,e.first_offset=_D(t,n),n+=4):(e.earliest_presentation_time=wD(t,n),n+=8,e.first_offset=wD(t,n),n+=8),n+=2,e.references=[];var r=AD(t,n);n+=2;for(var i=0;i<r;i++){var a={};e.references.push(a);var o=_D(t,n);n+=4,a.reference_type=o>>31&1,a.referenced_size=2147483647&o,a.subsegment_duration=_D(t,n),o=_D(t,n+=4),n+=4,a.starts_with_SAP=o>>31&1,a.SAP_type=o>>28&7,a.SAP_delta_time=268435455&o}}))}},{key:"moov",value:function(t){return ZD(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 ZD(e,!0,(function(e,t){var n=0;1===e.version?(e.timescale=_D(t,16),e.duration=wD(t,20),n+=28):(e.timescale=_D(t,8),e.duration=_D(t,12),n+=16),e.nextTrackId=_D(t,n+76)}))}},{key:"trak",value:function(t){return ZD(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 ZD(e,!0,(function(e,t){var n=0;1===e.version?(e.trackId=_D(t,16),e.duration=wD(t,24),n+=32):(e.trackId=_D(t,8),e.duration=_D(t,16),n+=20),e.width=_D(t,n+52),e.height=_D(t,n+56)}))}},{key:"mdia",value:function(t){return ZD(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 ZD(e,!0,(function(e,t){var n=0;1===e.version?(e.timescale=_D(t,16),e.duration=wD(t,20),n+=28):(e.timescale=_D(t,8),e.duration=_D(t,12),n+=16);var r=AD(t,n);e.language=String.fromCharCode(96+(r>>10&31),96+(r>>5&31),96+(31&r))}))}},{key:"hdlr",value:function(e){return ZD(e,!0,(function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}},{key:"minf",value:function(t){return ZD(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 ZD(e,!0,(function(e,t){e.graphicsmode=AD(t),e.opcolor=[AD(t,2),AD(t,4),AD(t,6)]}))}},{key:"smhd",value:function(e){return ZD(e,!0,(function(e,t){e.balance=AD(t)}))}},{key:"stbl",value:function(t){return ZD(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 ZD(e,!0,(function(e,t){var n=0,r=_D(t,n);n+=4,e.samples=[];for(var i=0;i<r;i++){var a={};if(a.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){a.subsamples=[];var o=AD(t,n);n+=2;for(var s=0;s<o;s++){var u={};u.BytesOfClearData=AD(t,n),n+=2,u.BytesOfProtectedData=_D(t,n),n+=4,a.subsamples.push(u)}}e.samples.push(a)}}))}},{key:"pssh",value:function(e){return ZD(e,!0,(function(e,t){for(var n=[],r=[],i=0,a=0;a<16;a++)r.push(ID(t[i+a]));if(i+=16,e.version>0){var o=_D(t,i);i+=4;for(var s=0;s<(""+o).length;s++)for(var u=0;u<16;u++){var c=t[i];i+=1,n.push(ID(c))}}var l=_D(t,i);e.data_size=l,i+=4,e.kid=n,e.system_id=r,e.buffer=t}))}},{key:"stsd",value:function(t){return ZD(t,!0,(function(t,n,r){t.entryCount=_D(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 ZD(t,!1,(function(t,n,r){t.channelCount=AD(n,16),t.samplesize=AD(n,18),t.sampleRate=_D(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 ZD(t,!1,(function(t,n,r){t.width=AD(n,24),t.height=AD(n,26),t.horizresolution=_D(n,28),t.vertresolution=_D(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 ZD(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(ID(t[n])),n+=1}))}},{key:"schi",value:function(t){return ZD(t,!1,(function(t,n,r){t.tenc=e.tenc(e.findBox(n,["tenc"],r)[0])}))}},{key:"sinf",value:function(t){return ZD(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 ZD(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 ZD(t,!1,(function(t,n,r){var i=ED(t,n),a=n.subarray(i);r+=i,t.avcC=e.avcC(e.findBox(a,["avcC"],r)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],r)[0])}))}},{key:"avcC",value:function(e){return ZD(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=AD(t,n);n+=2,e.sps.push(t.subarray(n,n+i)),n+=i}e.ppsLength=t[n],n+=1,e.pps=[];for(var a=0;a<e.ppsLength;a++){var o=AD(t,n);n+=2,e.pps.push(t.subarray(n,n+=o)),n+=o}}))}},{key:"hvc1",value:function(t){return ZD(t,!1,(function(t,n,r){var i=ED(t,n),a=n.subarray(i);r+=i,t.hvcC=e.hvcC(e.findBox(a,["hvcC"],r)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],r)[0])}))}},{key:"hvcC",value:function(e){return ZD(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=_D(n,2),t.generalConstraintIndicatorFlags=n.subarray(6,12),t.generalLevelIdc=n[12],t.avgFrameRate=AD(n,19),t.numOfArrays=n[22],t.vps=[],t.sps=[],t.pps=[];for(var i=23,a=0,o=0,s=0,u=0;u<t.numOfArrays;u++){a=63&n[i],o=AD(n,i+1),i+=3;for(var c,l=[],d=0;d<o;d++)s=AD(n,i),i+=2,l.push(n.subarray(i,i+s)),i+=s;if(32===a)(c=t.vps).push.apply(c,l);else if(33===a){var h;(h=t.sps).push.apply(h,l)}else if(34===a){var f;(f=t.pps).push.apply(f,l)}}}))}},{key:"pasp",value:function(e){return ZD(e,!1,(function(e,t){e.hSpacing=_D(t),e.vSpacing=_D(t,4)}))}},{key:"mp4a",value:function(t){return ZD(t,!1,(function(t,n,r){var i=LD(t,n);t.esds=e.esds(e.findBox(n.subarray(i),["esds"],r+i)[0])}))}},{key:"esds",value:function(e){return ZD(e,!0,(function(e,t){e.codec="mp4a.";for(var n=0,r=0,i=0,a=0;t.length;){for(a=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===a)t=t.subarray(n+3);else{if(4!==a){if(5===a){var o=e.config=t.subarray(n,n+i),s=(248&o[0])>>3;return 31===s&&o.length>=2&&(s=32+((7&o[0])<<3)+((224&o[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 ZD(e,!1,(function(e,t){LD(e,t)}))}},{key:"stts",value:function(e){return ZD(e,!0,(function(e,t){for(var n=_D(t),r=[],i=4,a=0;a<n;a++)r.push({count:_D(t,i),delta:_D(t,i+4)}),i+=8;e.entryCount=n,e.entries=r}))}},{key:"ctts",value:function(e){return ZD(e,!0,(function(e,t){var n=_D(t),r=[],i=4;if(1===e.version)for(var a=0;a<n;a++)r.push({count:_D(t,i),offset:_D(t,i+4)}),i+=8;else for(var o=0;o<n;o++)r.push({count:_D(t,i),offset:-(1+~_D(t,i+4))}),i+=8;e.entryCount=n,e.entries=r}))}},{key:"stsc",value:function(e){return ZD(e,!0,(function(e,t){for(var n=_D(t),r=[],i=4,a=0;a<n;a++)r.push({firstChunk:_D(t,i),samplesPerChunk:_D(t,i+4),sampleDescriptionIndex:_D(t,i+8)}),i+=12;e.entryCount=n,e.entries=r}))}},{key:"stsz",value:function(e){return ZD(e,!0,(function(e,t){var n=_D(t),r=_D(t,4),i=[];if(!n)for(var a=8,o=0;o<r;o++)i.push(_D(t,a)),a+=4;e.sampleSize=n,e.sampleCount=r,e.entrySizes=i}))}},{key:"stco",value:function(e){return ZD(e,!0,(function(e,t){for(var n=_D(t),r=[],i=4,a=0;a<n;a++)r.push(_D(t,i)),i+=4;e.entryCount=n,e.entries=r}))}},{key:"co64",value:function(e){return ZD(e,!0,(function(e,t){for(var n=_D(t),r=[],i=4,a=0;a<n;a++)r.push(wD(t,i)),i+=8;e.entryCount=n,e.entries=r}))}},{key:"stss",value:function(e){return ZD(e,!0,(function(e,t){for(var n=_D(t),r=[],i=4,a=0;a<n;a++)r.push(_D(t,i)),i+=4;e.entryCount=n,e.entries=r}))}},{key:"moof",value:function(t){return ZD(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 ZD(e,!0,(function(e,t){e.sequenceNumber=_D(t)}))}},{key:"traf",value:function(t){return ZD(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 ZD(e,!0,(function(e,t){var n=e.version,r=e.flags,i=t.length,a=e.sampleCount=_D(t),o=4;if(i>o&&1&r&&(e.dataOffset=-(1+~_D(t,o)),o+=4),i>o&&4&r&&(e.firstSampleFlags=_D(t,o),o+=4),e.samples=[],i>o)for(var s,u=0;u<a;u++)s={},256&r&&(s.duration=_D(t,o),o+=4),512&r&&(s.size=_D(t,o),o+=4),1024&r&&(s.flags=_D(t,o),o+=4),2048&r&&(s.cts=n?-(1+~_D(t,o+4)):_D(t,o),o+=4),e.samples.push(s)}))}},{key:"tfdt",value:function(e){return ZD(e,!0,(function(e,t){1===e.version?e.baseMediaDecodeTime=wD(t):e.baseMediaDecodeTime=_D(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,a=e.trak;if(a&&a.length){var o=a.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=a.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(o&&t){var u,c,l,d,h,f,p,m=t,y=null===(u=o.tkhd)||void 0===u?void 0:u.trackId;null!=y&&(m.id=o.tkhd.trackId),m.tkhdDuration=o.tkhd.duration,m.mvhdDurtion=e.mvhd.duration,m.mvhdTimecale=e.mvhd.timescale,m.timescale=m.formatTimescale=o.mdia.mdhd.timescale,m.duration=o.mdia.mdhd.duration||m.mvhdDurtion/m.mvhdTimecale*m.timescale;var v,g,b,A,_,w,S,k,T=o.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=iD,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=o.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=o.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=o.mdia.minf.stbl.senc&&o.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,Z,I,R,C,G,P,X=n,V=null===(x=s.tkhd)||void 0===x?void 0:x.trackId;null!=V&&(X.id=s.tkhd.trackId),X.tkhdDuration=s.tkhd.duration,X.mvhdDurtion=e.mvhd.duration,X.mvhdTimecale=e.mvhd.timescale,X.timescale=X.formatTimescale=s.mdia.mdhd.timescale,X.duration=s.mdia.mdhd.duration||X.mvhdDurtion/X.mvhdTimecale*X.timescale;var D,M,W,N,O,U,F,Y,K=s.mdia.minf.stbl.stsd.entries[0];switch(X.sampleSize=K.sampleSize,X.sampleRate=K.sampleRate,X.channelCount=K.channelCount,X.present=!0,K.type){case"alaw":X.codecType=X.codec=oD,X.sampleRate=8e3;break;case"ulaw":X.codecType=X.codec=sD,X.sampleRate=8e3;break;default:X.sampleDuration=vD.getFrameDuration(X.sampleRate,X.timescale),X.sampleRateIndex=vD.getRateIndexByRate(X.sampleRate),X.objectType=(null===(r=K.esds)||void 0===r?void 0:r.objectType)||2,K.esds&&(X.config=Array.from(K.esds.config)),X.codec=(null===(i=K.esds)||void 0===i?void 0:i.codec)||"mp4a.40.2"}if(X.sampleDuration=vD.getFrameDuration(X.sampleRate,X.timescale),X.objectType=(null===(E=K.esds)||void 0===E?void 0:E.objectType)||2,K.esds&&(K.esds.config?X.config=Array.from(K.esds.config):console.warn("esds config is null")),X.codec=(null===(L=K.esds)||void 0===L?void 0:L.codec)||"mp4a.40.2",X.sampleRateIndex=vD.getRateIndexByRate(X.sampleRate),X.ext={},X.ext.stss=null===(Z=s.mdia)||void 0===Z||null===(I=Z.minf)||void 0===I||null===(R=I.stbl)||void 0===R?void 0:R.stss,X.ext.ctts=null===(C=s.mdia)||void 0===C||null===(G=C.minf)||void 0===G||null===(P=G.stbl)||void 0===P?void 0:P.ctts,X.present=!0,K&&"enca"===K.type)X.isAudioEncryption=!0,K.data_format=null===(D=K.sinf)||void 0===D||null===(M=D.frma)||void 0===M?void 0:M.data_format,K.default_KID=null===(W=K.sinf)||void 0===W||null===(N=W.schi)||void 0===N?void 0:N.tenc.default_KID,K.default_IsEncrypted=null===(O=K.sinf)||void 0===O||null===(U=O.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,X.audioSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,X.useEME=e.useEME,X.kidValue=e.kidValue,X.enca=K}if(n&&(n.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!n&&n.isAudioEncryption),null!=t&&t.encv||null!=n&&n.enca){var H,j,B=null==t||null===(H=t.encv)||void 0===H?void 0:H.default_KID,J=null==n||null===(j=n.enca)||void 0===j?void 0:j.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 a=t.tfhd,o=t.tfdt,s=t.trun;if(a&&s){o&&(n&&n.id===a.trackId&&(n.baseMediaDecodeTime=o.baseMediaDecodeTime),r&&r.id===a.trackId&&(r.baseMediaDecodeTime=o.baseMediaDecodeTime));var u=a.defaultSampleSize||0,c=a.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[a.trackId]=[];for(var f=0;f<s.sampleCount;f++)i[a.trackId].push({offset:l,dts:d,duration:c,size:u}),d+=c,l+=u}else i[a.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,a;if(n){var o,s,u=null===(o=n.mdia)||void 0===o||null===(s=o.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=xD(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;a=xD(A,_,w,S)}return{videoSamples:i,audioSamples:a}}}}}]),e}();function xD(e,t,n,r,i,a){var o,s,u,c=[],l=null==i?void 0:i.entries,d=t.entries,h=r.entries,f=n.entrySizes,p=null==a?void 0:a.entries;p&&(o={},p.forEach((function(e){o[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=o[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 ED(e,t){return e.dataReferenceIndex=AD(t,6),e.width=AD(t,24),e.height=AD(t,26),e.horizresolution=_D(t,28),e.vertresolution=_D(t,32),e.frameCount=AD(t,40),e.depth=AD(t,74),78}function LD(e,t){return e.dataReferenceIndex=AD(t,6),e.channelCount=AD(t,16),e.sampleSize=AD(t,18),e.sampleRate=_D(t,24)/65536,28}function ZD(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 ID=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,a=Math.ceil(i/r.length),o=[],s=String(e);a--;)o.push(r);return o.join("").substring(0,i-s.length)+s}(Number(t).toString(16),2,0))})),e[0]},RD=function(){function e(){HV(this,e),this.buffer=new Uint8Array(0)}return BV(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=KV(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}(),CD=Math.pow(2,32)-1,GD=function(){function e(){HV(this,e)}return BV(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),a=new Uint8Array(i);a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=255&i,a.set(e,4);var o=8;return n.forEach((function(e){a.set(e,o),o+=e.byteLength})),a}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===eD&&e.codecType===iD}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return gD(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],kD(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(QV(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(QV(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===eD?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]),a=e.esds(t.config),o=e.sinf(t.enca);return e.box(e.types.enca,i,a,o)}},{key:"encv",value:function(t){var n,r,i=t.sps.length>0?t.sps[0]:[],a=t.pps.length>0?t.pps[0]:[],o=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,o>>8&255,255&o,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,QV(i)).concat([1,a.length>>>8&255,255&a.length])).concat.apply(n,QV(a))),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(kD(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]),a=e.schi(t);return e.box(e.types.sinf,n,e.box(e.types.frma,r),e.box(e.types.schm,i),a)}},{key:"avc1hev1",value:function(t){var n=t.codecType===iD,r=n?e.types.hvc1:e.types.avc1,i=n?e.hvcC(t):e.avcC(t),a=[new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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?a.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&a.push(e.pasp(t.sarRatio)),e.box.apply(e,[r].concat(a))}},{key:"avcC",value:function(t){var n,r,i,a=[],o=[];return t.sps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,QV(e))})),t.pps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,QV(e))})),e.box(e.types.avcC,new Uint8Array((n=(r=[1,a[3],a[4],a[5],255,224|t.sps.length]).concat.apply(r,a).concat([t.pps.length])).concat.apply(n,o)))}},{key:"hvcC",value:function(t){var n=t.hvcC;if(n instanceof ArrayBuffer||n instanceof Uint8Array)return n;var r,i=t.vps,a=t.sps,o=t.pps;if(n){var s=n.generalProfileCompatibilityFlags,u=n.generalConstraintIndicatorFlags,c=(i.length&&1)+(a.length&&1)+(o.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,QV(e))};i.length&&(r.push(160,0,i.length),i.forEach(l)),a.length&&(r.push(161,0,a.length),a.forEach(l)),o.length&&(r.push(162,0,o.length),o.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=zV(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(QV(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(QV(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),a=e.saio(t),o=e.trun1(t),s=e.senc(t);return e.box(e.types.traf,n,r,i,a,o,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 RD;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 RD,r=RD.writeUint32(t.samples.length),i=null;if(1===t.id){var a=t.videoSencLength;i=RD.writeUint32(16*t.samples.length+a+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=RD.writeUint32(16*t.samples.length+92))}else{var o=12*t.samples.length+124;t.isAudioEncryption&&(o=12*t.samples.length+8*t.audioSenc.length+177),i=RD.writeUint32(o)}return t.samples.forEach((function(e){n.write(RD.writeUint32(e.duration)),n.write(RD.writeUint32(e.size)),n.write(RD.writeUint32(e.keyframe?33554432:65536)),1===t.id&&n.write(RD.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 RD,r=t.samples.length,i=1===t.id?16:8,a=1===t.id?2:0,o=[],s=0;return 1===t.id?(o=t.videoSenc,s=t.videoSencLength):o=t.audioSenc,s=s||i*r,n.write(RD.writeUint32(16+s),e.types.senc,this.extension(0,a)),n.write(RD.writeUint32(r)),o.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(RD.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){n.write(RD.writeUint16(e.BytesOfClearData)),n.write(RD.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/(CD+1)),i=Math.floor(n%(CD+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 a=new Uint8Array(i);a.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 o=0;o<r;o++){var s=t[o],u=s.duration,c=s.size,l=s.flag,d=void 0===l?{}:l,h=s.cts,f=void 0===h?0:h;a.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*o)}return e.box(e.types.trun,a)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(QV(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===eD?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,gD(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,a=e.sampleDescIndex;r.set([t>>24,t>>16&255,t>>8&255,255&t,n>>24,n>>16&255,n>>8&255,255&n,a>>24,a>>16&255,a>>8&255,255&a],i),i+=12})),e.box(e.types.stsc,gD(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,gD(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,gD(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,gD(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,gD(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,a=t.samples[0].sampleOffset*r,o=8;t.samples.forEach((function(e){o+=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=o+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=o+16*t.samples.length+84)}else s=o+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=o+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,a>>24&255,a>>16&255,a>>8&255,255&a,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}();JV(GD,"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))),JV(GD,"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])}),JV(GD,"FTYPAVC1",GD.box(GD.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),JV(GD,"FTYPHEV1",GD.box(GD.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),JV(GD,"DINF",GD.box(GD.types.dinf,GD.box(GD.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),JV(GD,"VMHD",GD.box(GD.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),JV(GD,"SMHD",GD.box(GD.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),JV(GD,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),JV(GD,"STTS",GD.box(GD.types.stts,GD.StblTable)),JV(GD,"STSC",GD.box(GD.types.stsc,GD.StblTable)),JV(GD,"STSZ",GD.box(GD.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),JV(GD,"STCO",GD.box(GD.types.stco,GD.StblTable));var PD=function(){function e(t,n){HV(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=n}return BV(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}();JV(PD,"disabled",!0);var XD=function(){function e(t,n,r){HV(this,e),this.videoTrack=t,this.audioTrack=n;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new PD("FMP4Remuxer",!r||!r.openLog||!r.openLog)}return BV(e,[{key:"remux",value:function(){var e,t,n,r,i,a=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),l=u.exist(),d=[];return a&&(o&&o.initMerge?(c&&d.push(this.videoTrack),l&&d.push(this.audioTrack),n=GD.initSegment(d)):(c&&(e=GD.initSegment([this.videoTrack])),l&&(t=GD.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),a=new DataView(i.buffer),o=function(e,n,o,s){s=t[e];var u=0;s.units.forEach((function(e){a.setUint32(o,e.byteLength),o+=4,i.set(e,o),o+=e.byteLength,u+=4+e.byteLength})),s.size=u,c=o,r=s},s=0,u=t.length,c=0;s<u;s++)o(s,0,c,r);var l=GD.mdat(i);return e.isVideoEncryption||e.isAudioEncryption?gD(GD.styp(),GD.sidx(e),GD.moof([e]),l):gD(GD.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=GD.mdat(t);return e.isVideoEncryption||e.isAudioEncryption?gD(GD.styp(),GD.sidx(e),GD.moof([e]),n):gD(GD.moof([e]),n)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}(),VD={decryptWordArray:function(e,t,n){var r=kG.parse(t),i=kG.parse(SD(n)),a=SG.create(new Uint8Array(e)),o=lP.decrypt(YG.create({ciphertext:a}),r,{iv:i,mode:dP,padding:hP});return VD.wordArrayToUint8Array(o)},wordArrayToUint8Array:function(e){for(var t=e.sigBytes,n=e.words,r=new Uint8Array(t),i=0,a=0;i!==t;){var o=n[a++];if(r[i++]=(4278190080&o)>>>24,i===t)break;if(r[i++]=(16711680&o)>>>16,i===t)break;if(r[i++]=(65280&o)>>>8,i===t)break;r[i++]=255&o}return r}},DD=function(){function e(t,n,r,i){var a=this;HV(this,e),JV(this,"_videoSamples",[]),JV(this,"_audioSamples",[]),JV(this,"_lastRemainBuffer",[]),JV(this,"_lastRemainBufferStartPos",0),this.videoTrack=new uD,this.audioTrack=new cD,this.metadataTrack=r||new hD,this.log=new PD("MP4Demuxer",!i||!i.openLog||!i.openLog),t&&t.forEach((function(e){var t;(t=a._videoSamples).push.apply(t,QV(e.frames))})),n&&n.forEach((function(e){var t;(t=a._audioSamples).push.apply(t,QV(e.frames))}))}return BV(e,[{key:"parseSamples",value:function(e){if(!e)throw new Error("moov is required");if(this.videoTrack.codec||this.audioTrack.codec||(TD.moovToTrack(e,this.videoTrack,this.audioTrack),this.videoSenc=this.videoTrack.videoSenc,this.audioSenc=this.audioTrack.audioSenc),!this._audioSamples.length&&!this._videoSamples.length){var t=TD.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 a,o,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(!(a=this._videoSamples[h]))throw new Error("cannot found video frame #".concat(h));s=a.offset-t,o=e.subarray(s,s+a.size),(l=new lD(a.pts||a.dts,a.dts)).duration=a.duration,l.gopId=a.gopId,a.keyframe&&l.setToKeyframe();for(var p=0,m=o.length-1;p<m;)d=_D(o,p),p+=4,l.units.push(o.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(!(a=this._audioSamples[y]))throw new Error("cannot found video frame #".concat(y));s=a.offset-t,o=e.subarray(s,s+a.size),c.samples.push(new dD(a.dts,o,a.duration))}c.baseMediaDecodeTime=c.samples[0].dts}return{videoTrack:u,audioTrack:c,metadataTrack:this.metadataTrack}}},{key:"demuxPart",value:function(e,t,n,r,i,a,o){if(this.parseSamples(i),this.videoTrack.useEME=a,this.audioTrack.useEME=a,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(x){if(!(s<20))throw new Error("new Uint8Array error:,"+x.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 lD(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=o))}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 dD(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=o))}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;)_=_D(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 a=r[i],o=t.data,s=[],u=[],c=a.InitializationVector;if(a.subsamples&&a.subsamples.length)a.subsamples.forEach((function(e){var t=e.BytesOfClearData+e.BytesOfProtectedData,n=o.slice(0,t);s.push(n.slice(0,e.BytesOfClearData)),u.push(n.slice(e.BytesOfClearData)),o=o.slice(t)}));else{var l=t.size;s.push(o.slice(0,0)),u.push(o.slice(0,l)),o=o.slice(l)}var d=new RD;d.write.apply(d,u);var h=VD.decryptWordArray(d.buffer,n,c),f=new RD;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,a=t.audioSenc;t.samples.forEach((function(e,n){var r=a[n],o=VD.decryptWordArray(e.data,i,r.InitializationVector);t.samples[n].data=o}))}}}}],[{key:"probe",value:function(e){return TD.probe(e)}}]),e}(),MD="3.0.0-alpha.36-3",WD={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},ND={network:1003,format:1005,runtime:1002,other:9999,demux:1006,remux:1007};var OD=LP((function e(t,n,r){xP(this,e);var i=0,a=0;r&&r.range&&r.range.length>1&&(i=r.range[0],a=r.range[1]);var o=function(e){var t=0;switch(e){case 0:t=0;break;case-1:t=WD.networkError;break;case-2:t=WD.timeout;break;case-3:t=WD.contentError;break;default:t=e<500?WD[e]||e["4xx"]:WD[e]||e["5xx"]}return t}(n);return{errorCode:o,errorType:t,errorTypeCode:ND[t],errorMessage:(null==r?void 0:r.httpText)||(null==r?void 0:r.message),url:null==r?void 0:r.url,httpCode:n,version:MD,rangeStart:i,rangeEnd:a,ext:r,mediaError:{code:o,message:(null==r?void 0:r.httpText)||(null==r?void 0:r.message)}}})),UD=LP((function e(t,n,r){return xP(this,e),{errorCode:n,errorType:t,errorTypeCode:ND[t],version:MD,errorMessage:r.msg,ext:r,mediaError:{code:n,message:r.msg}}}));pi({target:"Array",stat:!0},{isArray:yi});var FD=E,YD=zt,KD=J,HD=Sr,jD=nf,BD=q,JD=Me,zD=NE,QD=tL;ME("match",(function(e,t,n){return[function(t){var n=BD(this),r=KD(t)?void 0:JD(t,e);return r?FD(r,t,n):new RegExp(t)[e](jD(n))},function(e){var r=YD(this),i=jD(e),a=n(t,r,i);if(a.done)return a.value;if(!r.global)return QD(r,i);var o=r.unicode;r.lastIndex=0;for(var s,u=[],c=0;null!==(s=QD(r,i));){var l=jD(s[0]);u[c]=l,""===l&&(r.lastIndex=zD(i,HD(r.lastIndex),o)),c++}return 0===c?null:u}]}));var qD={};function $D(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 eM(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$D(Object(n),!0).forEach((function(t){sM(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$D(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function tM(){tM=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:{},a=i.iterator||"@@iterator",o=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 a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new T(i||[]);return r(o,"_invoke",{value:_(e,n,s)}),o}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,a,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,a)&&(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,a,o,s){var u=l(e[r],e,a);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,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,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[a];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,o,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new A(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(g),u(g,s,"Generator"),u(g,a,(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 o.type="throw",o.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 a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.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 a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},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 nM(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(S0){return void n(S0)}s.done?t(u):Promise.resolve(u).then(r,i)}function rM(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){nM(a,r,i,o,s,"next",e)}function s(e){nM(a,r,i,o,s,"throw",e)}o(void 0)}))}}function iM(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aM(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&&aM(e.prototype,t),n&&aM(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function sM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uM(e){return(uM=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function cM(e,t){return(cM=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function lM(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function dM(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hM(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=uM(e);if(t){var i=uM(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 dM(e)}(this,n)}}function fM(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,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(u){s=!0,i=u}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||mM(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 pM(e){return function(e){if(Array.isArray(e))return yM(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||mM(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 mM(e,t){if(e){if("string"==typeof e)return yM(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)?yM(e,t):void 0}}function yM(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 vM(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 gM(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vM(Object(n),!0).forEach((function(t){xM(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vM(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function bM(){bM=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:{},a=i.iterator||"@@iterator",o=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 a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new T(i||[]);return r(o,"_invoke",{value:_(e,n,s)}),o}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,a,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,a)&&(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,a,o,s){var u=l(e[r],e,a);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,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,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[a];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,o,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new A(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(g),u(g,s,"Generator"),u(g,a,(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 o.type="throw",o.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 a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.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 a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},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 AM(e){return(AM="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 _M(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(S0){return void n(S0)}s.done?t(u):Promise.resolve(u).then(r,i)}function wM(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){_M(a,r,i,o,s,"next",e)}function s(e){_M(a,r,i,o,s,"throw",e)}o(void 0)}))}}function SM(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kM(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 TM(e,t,n){return t&&kM(e.prototype,t),n&&kM(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function xM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function EM(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&&ZM(e,t)}function LM(e){return(LM=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ZM(e,t){return(ZM=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function IM(){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 RM(e,t,n){return(RM=IM()?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&&ZM(i,n.prototype),i}).apply(null,arguments)}function CM(e){var t="function"==typeof Map?new Map:void 0;return CM=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 RM(e,arguments,LM(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ZM(r,e)},CM(e)}function GM(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function PM(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function XM(e){var t=IM();return function(){var n,r=LM(e);if(t){var i=LM(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 PM(e)}(this,n)}}function VM(){return VM="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=LM(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}},VM.apply(this,arguments)}function DM(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 MM(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 DM(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)?DM(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 a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function WM(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}qD.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 qD.findBox(e,t,n)}))}}else n.push(e);return(n=[].concat(n)).length>1?n:n[0]},qD.padStart=function(e,t,n){for(var r=String(n),i=t>>0,a=Math.ceil(i/r.length),o=[],s=String(e);a--;)o.push(r);return o.join("").substring(0,i-s.length)+s},qD.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(qD.padStart(Number(t).toString(16),2,0))})),e},qD.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},qD.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},qD.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},qD.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},qD.ArrayBufferToString=function(e){for(var t="",n=new Uint8Array(e),r=0;r<n.length;r++)t+=String.fromCharCode(n[r]);return t},qD.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},qD.toBase64=function(e,t){var n=qD.fromCharCode(e);t=void 0===t||t;var r=window.btoa(n).replace(/\+/g,"-").replace(/\//g,"_");return t?r:r.replace(/=*$/,"")},qD.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},qD.bufferToString=function(e){return("0"+Number(e).toString(16)).slice(-2).toUpperCase()},qD.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)},qD.formatIV=function(e){var t="";if(e.forEach((function(e){t+=qD.bufferToString(e)})),t.length<=32)for(var n=32-t.length,r=0;r<n;r++)t+="0";return t},qD.str2hex=function(e){if(""===e)return"";for(var t=[],n=0;n<e.length;n++)t.push(e.charCodeAt(n));return t},qD.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)}))},qD.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},qD.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(r){return console.error(r),!1}return!0}return!1},qD.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},qD.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},qD.nowTime=function(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}},qD.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(r){return e}},qD.getFileSize=function(e,t){try{return e&&t?parseInt(t*e/8,10):0}catch(n){return 0}},qD.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},qD.getFileSize=function(e,t){try{return e&&t?parseInt(t*e/8,10):0}catch(n){return 0}},qD.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),a=0;return n.every((function(e){return e&&(i.set(e,a),a+=e.byteLength),!0})),i},qD.getFragRange=function(e,t,n){var r=e<t.length?t[e]:null,i=e<n.length?n[e]:null,a=0,o=0;return e===t.length-1&&(a=-1),e===n.length-1&&(o=-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])+a||0,(null==i?void 0:i.range[1])+o||0)]};var NM=function(){function e(t){SM(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]")}return TM(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,WM()].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,WM()].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,WM()].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,WM()].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}();xM(NM,"disabled",!0);var OM="fetch",UM="xhr",FM="arraybuffer",YM="text",KM="json",HM=function(e){EM(n,e);var t=XM(n);function n(e,r,i,a){var o;return SM(this,n),xM(PM(o=t.call(this,a)),"retryCount",0),xM(PM(o),"isTimeout",!1),xM(PM(o),"loaderType",OM),xM(PM(o),"startTime",0),xM(PM(o),"endTime",0),o.url=e,o.request=r,o.response=i,o}return TM(n)}(CM(Error)),jM=Object.prototype.toString;function BM(e){if("[object Object]"!==jM.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function JM(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 zM(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function QM(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]"===jM.call(n)?t=t.toISOString():function(e){return null!==e&&"object"===AM(e)}(t)&&(t=JSON.stringify(t)),"".concat(zM(e),"=").concat(zM(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 qM(e,t,n,r,i,a,o,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:a,firstByteTime:o,endTime:Date.now(),priOptions:l},response:n}}function $M(e,t){return Math.round(8*e*1e3/t/1024)}var eW="real_time_speed",tW=2097152,nW=function(e){EM(r,e);var t,n=XM(r);function r(){var e;return SM(this,r),xM(PM(e=n.call(this)),"_abortController",null),xM(PM(e),"_timeoutTimer",null),xM(PM(e),"_reader",null),xM(PM(e),"_response",null),xM(PM(e),"_aborted",!1),xM(PM(e),"_index",-1),xM(PM(e),"_range",null),xM(PM(e),"_receivedLength",0),xM(PM(e),"_running",!1),xM(PM(e),"_logger",null),xM(PM(e),"_vid",""),xM(PM(e),"_onProcessMinLen",0),xM(PM(e),"_onCancel",null),xM(PM(e),"_priOptions",null),e}return TM(r,[{key:"load",value:function(e){var t,n=this,r=e.url,i=e.vid,a=e.timeout,o=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=QM(r,p);var Z=JM(d);Z&&((v=f?f.headers:E.headers=E.headers||new Headers)instanceof Headers?v.append("Range",Z):v.Range=Z),a&&(this._timeoutTimer=setTimeout((function(){if(L=!0,n.cancel(),c){var e=new HM(r,E,null,"timeout");e.isTimeout=!0,c(e,n._index)}}),a));var I=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=wM(bM().mark((function i(a){var c,l,f,p;return bM().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(n._timeoutTimer),n._response=a,!n._aborted&&n._running){i.next=4;break}return i.abrupt("return");case 4:if(h&&(a=h(a,r)||a),a.ok){i.next=7;break}throw new HM(r,E,a,"bad network response");case 7:if(c=Date.now(),o!==YM){i.next=15;break}return i.next=11,a.text();case 11:l=i.sent,n._running=!1,i.next=37;break;case 15:if(o!==KM){i.next=22;break}return i.next=18,a.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(a,s,I,c),i.abrupt("return");case 29:return i.next=31,a.arrayBuffer();case 31:l=i.sent,l=new Uint8Array(l),n._running=!1,f=Date.now()-I,p=$M(l.byteLength,f),n.emit(eW,{speed:p});case 37:n._logger.debug("[fetch load end], index,",u,",range,",d),e(qM(l,!0,a,a.headers.get("Content-Length"),a.headers.get("age"),I,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 HM?e:new HM(r,E,null,JSON.stringify(e))).startTime=I,e.endTime=Date.now(),e.isTimeout=L,t(e))}))}))}},{key:"cancel",value:(t=wM(bM().mark((function e(){return bM().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(S0){}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(HM(e.url,"",e,"onProgress of bad response.body.getReader"));this._onProcessMinLen>0&&(this._cache=new Uint8Array(tW),this._writeIdx=0);var a,o,s,u=this._reader=e.body.getReader(),c=function(){var l=wM(bM().mark((function l(){var d,h,f,p,m,y;return bM().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:return o=Date.now(),l.prev=1,l.next=4,u.read();case 4:a=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:o,endTime:s,priOptions:i._priOptions},e),l.abrupt("return");case 18:h=a.value?a.value.byteLength:0,i._receivedLength+=h,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",d,", end,",i._range[0]+i._receivedLength,", done,",a.done),i._onProcessMinLen>0?i._writeIdx+h>=i._onProcessMinLen||a.done?((f=new Uint8Array(i._writeIdx+h)).set(i._cache.slice(0,i._writeIdx),0),h>0&&f.set(a.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",a.done,",len,",f.byteLength,", writeIdx,",i._writeIdx)):h>0&&i._writeIdx+h<tW?(i._cache.set(a.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(a.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=a.value,(f&&f.byteLength>0||a.done)&&t(f,a.done,{range:[i._range[0]+i._receivedLength-(f?f.byteLength:0),i._range[0]+i._receivedLength],vid:i._vid,index:i._index,startTime:o,endTime:s,priOptions:i._priOptions},e),m=Date.now()-n,y=$M(i._receivedLength,m),i.emit(eW,{speed:y}),a.done?(i._running=!1,i._logger.debug("[fetchLoader onProgress end],task,",i._range,",done,",a.done),i.resolve(qM(a,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),o,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}(Za);var rW=function(e){EM(n,e);var t=XM(n);function n(){var e;return SM(this,n),xM(PM(e=t.call(this)),"_xhr",null),xM(PM(e),"_aborted",!1),xM(PM(e),"_timeoutTimer",null),xM(PM(e),"_range",null),xM(PM(e),"_receivedLength",0),xM(PM(e),"_url",null),xM(PM(e),"_onProgress",null),xM(PM(e),"_index",-1),xM(PM(e),"_headers",null),xM(PM(e),"_currentChunkSizeKB",384),xM(PM(e),"_timeout",null),xM(PM(e),"_xhr",null),xM(PM(e),"_withCredentials",null),xM(PM(e),"_startTime",-1),xM(PM(e),"_loadCompleteResolve",null),xM(PM(e),"_loadCompleteReject",null),xM(PM(e),"_runing",!1),xM(PM(e),"_logger",!1),xM(PM(e),"_vid",""),xM(PM(e),"_responseType",void 0),xM(PM(e),"_credentials",void 0),xM(PM(e),"_method",void 0),xM(PM(e),"_transformResponse",void 0),xM(PM(e),"_firstRtt",void 0),xM(PM(e),"_subRangeStartTime",void 0),xM(PM(e),"_onCancel",null),xM(PM(e),"_priOptions",null),e}return TM(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=QM(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 HM?e:new HM(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 HM(t._url,t._request,{status:0},"onerror");t._loadCompleteReject(n)},n.ontimeout=function(e){t.cancel();var n=new HM(t._url,t._request,{status:408},"timeout");t._onTimeout&&(n.isTimeout=!0,t._onTimeout(n,t._index)),t._loadCompleteReject(n)};var r=JM(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(a){this._loadCompleteReject(a)}}},{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 HM(this._url,null,gM(gM({},e.target.response),{},{status:t}),"bad response,status:"+t));var n,r=null,i=!1;if(this._responseType===FM){var a=new Uint8Array(e.target.response);if(n=this._range[0]+this._receivedLength,a&&a.byteLength>0){this._receivedLength+=a.byteLength;var o=Date.now()-this._subRangeStartTime,s=$M(this._receivedLength,o);this.emit(eW,{speed:s})}r=a,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,",a?a.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(qM(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,VM(LM(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=MM(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(a){r.e(a)}finally{r.f()}return n}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),n}(Za),iW=["retry","retryDelay","onRetryError","transformError"],aW=function(){function e(t,n){var r,i,a;SM(this,e),this.promise=((a=new Promise((function(e,t){r=e,i=t}))).used=!1,a.resolve=function(){return a.used=!0,r.apply(void 0,arguments)},a.reject=function(){return a.used=!0,i.apply(void 0,arguments)},a),this.alive=!!n.onProgress,!n.logger&&(n.logger=new NM("Loader")),this._loaderType=t,this._loader=t===OM?new nW:new rW,this._config=n,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._logger=n.logger}var t;return TM(e,[{key:"exec",value:function(){var e=this,t=this._config,n=t.retry,r=t.retryDelay,i=t.onRetryError,a=t.transformError,o=GM(t,iW),s=function(){var t=wM(bM().mark((function t(){var u,c;return bM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(o);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,a&&(c=a(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,",o.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=wM(bM().mark((function e(){return bM().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 oW(){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 sW(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var uW=function(e){EM(r,e);var t,n=XM(r);function r(e){var t;return SM(this,r),xM(PM(t=n.call(this,e)),"type",OM),xM(PM(t),"_queue",[]),xM(PM(t),"_alive",[]),xM(PM(t),"_currentTask",null),xM(PM(t),"_config",void 0),t._config=function(e){return gM({loaderType:OM,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:YM,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!==UM&&nW.isSupported()||(t.type=UM),t.log=e.logger,t}return TM(r,[{key:"isFetch",value:function(){return this.type===OM}},{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&&BM(n.headers)&&(n.headers=Object.assign({},n.headers)),n.body&&BM(n.body)&&(n.body=Object.assign({},n.body)),n.transformRequest&&(n=n.transformRequest(n)||n),n.logger=this.log;var r=new aW(this.type,n);return r.loader.on(eW,(function(e){t.emit(eW,e)})),this._queue.push(r),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),r.promise}},{key:"cancel",value:(t=wM(bM().mark((function e(){var t;return bM().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,sW();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 nW.isSupported()}}]),r}(Za);var cW=oM((function e(t,n){iM(this,e),this.type="file",this.message=t,this.data=n})),lW=function(){function e(){iM(this,e),sM(this,"_data",Object.create(null))}return oM(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 dW(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 a,o=[],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;a=(o=hW(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=hW(t,S,k,T,x,E,null,null,a)}return{videoSegments:o,audioSegments:s}}}}function hW(e,t,n,r,i,a,o,s,u){var c,l,d,h,f=[],p=[],m=[],y=r.entries,v=a.entries,g=i.entrySizes,b=null==o?void 0:o.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,Z=-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?(Z++,p.push([d]),m.push(d.duration)):(p[p.length-1].push(d),m[p.length-1]+=d.duration),d.gopId=Z),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 I=f.length;if(I&&(!o||f[0].keyframe)){var R,C=[],G=[],P=0,X=function(e){var n;R=G[G.length-1],C.push({index:C.length,startTime:(null===(n=C[C.length-1])||void 0===n?void 0:n.endTime)||G[0].startTime/t,endTime:(R.startTime+R.duration)/t,duration:e,range:[G[0].offset,R.offset+R.size],frames:G}),P=0,G=[]};if(o)for(var V=e*t,D=0,M=p.length;D<M;D++){var W;P+=m[D],(W=G).push.apply(W,pM(p[D])),D+1<M?(0===D||P>V)&&X(P/t):X(P/t)}else for(var N=(u=u||[])[0]||e,O=0;O<I;O++)G.push(f[O]),P+=f[O].duration,(O+1>=I||P/t>=N)&&(X(P/t),N=u[C.length]||e);return C}}function fW(e){var t="",n="",r=0,i=0,a=0,o=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)})),Z=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)})),I=null;if(L)if(I=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=I.width,i=I.height,u=null===(m=L.mdia)||void 0===m||null===(y=m.mdhd)||void 0===y?void 0:y.timescale,t=null===(v=I.avcC||I.hvcC)||void 0===v?void 0:v.codec,"encv"===I.type)d=null===(g=I.sinf)||void 0===g||null===(b=g.schi)||void 0===b?void 0:b.tenc.default_KID;if(Z)if(I=null===(A=Z.mdia)||void 0===A||null===(_=A.minf)||void 0===_||null===(w=_.stbl)||void 0===w?void 0:w.stsd.entries[0])if(a=I.channelCount,o=I.sampleRate,n=null===(S=I.esds)||void 0===S?void 0:S.codec,c=null===(k=Z.mdia)||void 0===k||null===(T=k.mdhd)||void 0===T?void 0:T.timescale,"enca"===I.type)d=d||(null===(x=I.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:a,audioSampleRate:o,duration:s,audioTimescale:c,moov:e}}}function pW(e){return"number"==typeof e&&!Number.isNaN(e)}var mW=["vid","cache"],yW=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&&cM(e,t)}(f,e);var t,n,r,i,a,o,s,u,c,l,d,h=hM(f);function f(e){var t;iM(this,f),sM(dM(t=h.call(this)),"vid",""),sM(dM(t),"url",""),sM(dM(t),"meta",{}),sM(dM(t),"downloadInfo",[]),sM(dM(t),"videoSegments",[]),sM(dM(t),"audioSegments",[]),sM(dM(t),"cache",null),sM(dM(t),"_currentSegmentIndex",-1),sM(dM(t),"_currentLoadingSegmentIndex",-1),sM(dM(t),"buffer",void 0),sM(dM(t),"_error",void 0),sM(dM(t),"_transformError",(function(e){return e})),t._config=eM({vid:"",moovEnd:8e4,segmentDuration:2,maxDownloadInfoSize:30,responseType:"arraybuffer",cache:null},e);var n=t._config,r=n.vid,i=n.cache,a=lM(n,mW);return t.cache=i||new lW,t.vid=r||a.url,t.url=a.url,a.transformError=t._transformError,t.logger=new NM("MP4Loader_"+t.vid),e.openLog&&NM.enable(),a.logger=t.logger,t._loader=new uW(a),t._loader.on(eW,(function(e){t.emit(eW,e)})),t}return oM(f,[{key:"isMetaLoaded",get:function(){return this.videoSegments.length||this.audioSegments.length}},{key:"setCurrentSegment",value:function(e){pW(e)&&(this._currentSegmentIndex=e)}},{key:"isLastSegment",value:function(e){var t,n;return!!pW(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=rM(tM().mark((function e(t){var n,r,i,a=arguments;return tM().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:t,r=a.length>2?a[2]:void 0,i=a.length>3?a[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=rM(tM().mark((function e(t){return tM().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=rM(tM().mark((function e(t,n,r,i){var a,o,s,u,c=this;return tM().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=fM(n,2),o=a[0],s=a[1],this._error=!1,this.logger.debug("[loadMetaProcess start], range,",[o,s]),u=function(){var e=rM(tM().mark((function e(n,a,u){var l,d,h,f,p,m,y,v;return tM().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&&(a=!0,c.logger.debug("[loadMetaProcess],data done,setstate true,[",o,s,"]")),a&&null!=u&&u.range&&u.range.length>0&&u.range[1]<s&&(a=!1,c.logger.debug("[loadMetaProcess],data not done,setstate false,[",o,s,"]")),c.logger.debug("[loadMetaProcess],task,[",o,s,"], range,",u.range,",dataLen,",n?n.byteLength:void 0,", state,",a,",err,",c._error),!c._error&&n&&n.byteLength>0&&r(n,a,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=oW(c.buffer,n),l=TD.findBox(c.buffer,["moov"])[0]){e.next=23;break}if(d=TD.findBox(c.buffer,["mdat"])[0],!a){e.next=23;break}if(d){e.next=18;break}return c._error=!0,r(null,a,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=TD.findBox(f.data,["moov"])[0]);case 23:if(!(l&&a&&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,",a),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=TD.moov(l)){e.next=33;break}return c._error=!0,r(null,a,u,{err:"cannot parse moov box"}),e.abrupt("return");case 33:if(m=dW(p,c._config.segmentDuration)){e.next=38;break}return c._error=!0,r(null,a,u,{err:"cannot parse segments"}),e.abrupt("return");case 38:c.meta=fW(p),y=m.videoSegments,v=m.audioSegments,c.videoSegments=y,c.audioSegments=v,c.logger.debug("[loadMetaProcess] moov ok"),r(void 0,a,{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([o,s||this._config.moovEnd],t,eM({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=rM(tM().mark((function e(t,n,r){var i,a,o,s,u,c,l,d,h;return tM().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(a=e.sent){e.next=7;break}return e.abrupt("return");case 7:if(i.push(a),o=TD.findBox(a.data,["moov"])[0]){e.next=23;break}if(s=TD.findBox(a.data,["mdat"])[0]){e.next=13;break}throw new cW("cannot find moov or mdat box",a.data);case 13:return u=s.start+s.size,e.next=16,this.loadData([u],t,r);case 16:if(a=e.sent){e.next=19;break}return e.abrupt("return");case 19:if(i.push(a),o=TD.findBox(a.data,["moov"],u)[0]){e.next=23;break}throw new cW("cannot find moov box",a.data);case 23:if(!(o.size>o.data.length)){e.next=31;break}return e.next=26,this.loadData([a.data.length,o.start+o.size-1],t,r);case 26:if(a=e.sent){e.next=29;break}return e.abrupt("return");case 29:i.push(a),o.data=oW(o.data,a.data);case 31:if(c=TD.moov(o)){e.next=34;break}throw new cW("cannot parse moov box",o.data);case 34:if(l=dW(c,this._config.segmentDuration)){e.next=37;break}throw new cW("cannot parse segments",o.data);case 37:return this.meta=fW(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=rM(tM().mark((function e(t,n){var r,i,a,o,s,u=arguments;return tM().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 a=this.getSegmentByTime(t),o=a.video,s=a.audio,e.abrupt("return",this._loadSegment(o,s,n,r,i));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"loadNextSegment",value:(o=rM(tM().mark((function e(t){var n,r,i,a,o=arguments;return tM().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(o.length>1&&void 0!==o[1])||o[1],r=o.length>2&&void 0!==o[2]?o[2]:{},this.isMetaLoaded){e.next=5;break}return e.next=5,this.loadMeta();case 5:return i=this.videoSegments[this._currentSegmentIndex+1],a=this.audioSegments[this._currentSegmentIndex+1],e.abrupt("return",this._loadSegment(i,a,t,n,r));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"preload",value:(a=rM(tM().mark((function e(t){var n,r,i,a,o,s,u,c=this;return tM().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,a=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 o=this.videoSegments.slice(0,a),s=this.audioSegments.slice(0,a),u=function(){var e=rM(tM().mark((function e(t){return tM().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t>a)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,c._loadSegment(o[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 a.apply(this,arguments)})},{key:"cancel",value:function(){return this._loader.cancel()}},{key:"reset",value:(i=rM(tM().mark((function e(){var t=arguments;return tM().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=rM(tM().mark((function e(){return tM().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=rM(tM().mark((function e(t,n,r,i,a){var o,s;return tM().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 o=(null==t?void 0:t.index)||(null==n?void 0:n.index)||0,this._currentLoadingSegmentIndex=o,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,a);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=o),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,a){return n.apply(this,arguments)})},{key:"loadData",value:(t=rM(tM().mark((function e(t,n,r){var i,a,o;return tM().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(a=e.sent){e.next=10;break}return e.next=7,this._loader.load(this.url,eM({range:t,vid:this.vid},r));case 7:o=e.sent,e.next=11;break;case 10:o={data:a,state:!0,options:{fromCache:!0,range:t,vid:this.vid}};case 11:if(o){e.next=13;break}return e.abrupt("return");case 13:return a||(o.data&&this.downloadInfo.push({startTime:o.startTime,endTime:o.endTime,size:o.data.byteLength,range:t}),this.downloadInfo&&this.downloadInfo.length>this._config.maxDownloadInfoSize&&(this.downloadInfo=this.downloadInfo.slice(-this._config.maxDownloadInfoSize))),e.abrupt("return",o);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}(Za),vW=function(){try{return"undefined"!=typeof localStorage&&"setItem"in window.localStorage&&!!window.localStorage.setItem}catch(e){return!1}}()&&!function(){var e="_localstorage_support_test";try{return window.localStorage.setItem(e,!0),window.localStorage.removeItem(e),!1}catch(t){return!0}}(),gW=bW();function bW(){if(vW)try{return!!window.localStorage.getItem("playerlog")}catch(e){return!1}return!1}function AW(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];gW&&console.log&&(t=console).log.apply(t,["[logger]",qD.nowTime(),e].concat(r))}var _W={"x-cache":"x_cache","x-response-sinfo":"server_ip","x-response-cinfo":"x-response-cinfo"};function wW(e){var t={};return Object.keys(_W).forEach((function(n){var r=_W[n];e&&e.get&&e.get(n)&&(t[r]=e.get(n))})),t}var SW=[{range:[0,90],size:614400},{range:[90,120],size:1228800},{range:[120,Number.MAX_VALUE],size:2048e3}];function kW(e,t,n){var r=n>51200?Math.min(n,t):t;if(!e)return r;for(var i=0;i<SW.length;i++)if(e>=SW[i].range[0]&&e<SW[i].range[1]){r=Math.min(Math.max(r,SW[i].size),n>0?n:t);break}return r}var TW="IWZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIHQodCxlKXt2YXIgcj1PYmplY3Qua2V5cyh0KTtpZihPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbj1PYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKHQpO2UmJihuPW4uZmlsdGVyKChmdW5jdGlvbihlKXtyZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcih0LGUpLmVudW1lcmFibGV9KSkpLHIucHVzaC5hcHBseShyLG4pfXJldHVybiByfWZ1bmN0aW9uIGUoZSl7Zm9yKHZhciByPTE7cjxhcmd1bWVudHMubGVuZ3RoO3IrKyl7dmFyIG49bnVsbCE9YXJndW1lbnRzW3JdP2FyZ3VtZW50c1tyXTp7fTtyJTI/dChPYmplY3QobiksITApLmZvckVhY2goKGZ1bmN0aW9uKHQpe28oZSx0LG5bdF0pfSkpOk9iamVjdC5nZXRPd25Qcm9wZXJ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aWRlb1RyYWNrLHRoaXMuTVA0RGVtdXhlci5hdWRpb1RyYWNrLHtvcGVuTG9nOnRoaXMub3BlbmxvZ30pKSx0aGlzLkZNUDRSZW11eGVyKXt2YXIgcz10aGlzLkZNUDRSZW11eGVyLnJlbXV4KHRoaXMuX25lZWRJbml0U2VnbWVudCx7aW5pdE1lcmdlOiEwfSk7cy5pbml0U2VnbWVudCYmKHRoaXMuX25lZWRJbml0U2VnbWVudD0hMSksYT17YnVmZmVyOkF2LmNvbmNhdERhdGEocy5hdWRpb1NlZ21lbnQscy52aWRlb1NlZ21lbnQpLHJhbmdlOm4uY29udGV4dC5yYW5nZSxzdGF0ZTpuLmNvbnRleHQuc3RhdGUsY29udGV4dDp7cmFuZ2U6bi5jb250ZXh0LnJhbmdlLGZyYWdJbmRleDpuLmNvbnRleHQuZnJhZ0luZGV4LHN0YXJ0UHRzOk1hdGgubWluKG8udmlkZW9UcmFjay5zdGFydFB0cyxvLmF1ZGlvVHJhY2suc3RhcnRQdHMpLGVuZFB0czpNYXRoLm1heChvLnZpZGVvVHJhY2suZW5kUHRzLG8uYXVkaW9UcmFjay5lbmRQdHMpfSxpbml0U2VnOnMuaW5pdFNlZ21lbnR9fXRoaXMucG9zdE1lc3NhZ2Uoe21ldGhvZDoidHJhbnNtdXgiLGlkOnQuZGF0YS5pZCxhcmdzOmUoe30sYSl9KTticmVhaztjYXNlInJlc2V0Ijp0aGlzLkZNUDRSZW11eGVyJiZ0aGlzLkZNUDRSZW11eGVyLnJlc2V0KCksdGhpcy5NUDREZW11eGVyJiZ0aGlzLk1QNERlbXV4ZXIucmVzZXQoKSx0aGlzLkZNUDRSZW11eGVyPW51bGwsdGhpcy5NUDREZW11eGVyPW51bGwsdGhpcy5fbmVlZEluaXRTZWdtZW50PSEwfX19KCk7Cg==",xW="undefined"!=typeof window&&window.Blob&&new Blob([atob(TW)],{type:"text/javascript;charset=utf-8"});function EW(){var e=xW&&(window.URL||window.webkitURL).createObjectURL(xW);try{return e?new Worker(e,{}):new Worker("data:application/javascript;base64,"+TW,{type:"module"})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var LW=function(e){IP(n,e);var t=PP(n);function n(e){var r;return xP(this,n),(r=t.call(this)).openlog=e.openLog,r.codecType=e.codecType,r.supportHevc=e.supportHevc,r.worker=new EW,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 LP(n,[{key:"transmux",value:function(e,t,n,r,i,a,o,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:a,useEME:o,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}(Za),ZW="error",IW="metaReady",RW="moov_request_Progress",CW="progress_event",GW="updateEME",PW="chaneg_url",XW=function(e){IP(d,e);var t,n,r,i,a,o,s,u,c,l=PP(d);function d(e,t,n,r){var i,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[],o=arguments.length>7?arguments[7]:void 0,s=arguments.length>8?arguments[8]:void 0;if(xP(this,d),ZP(GP(i=l.call(this)),"onprogressDataArrive",function(){var e=TP(wP().mark((function e(t,n,r){var a;return wP().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t&&t.byteLength>0&&((a=i.timeRange[r.index].range)&&r.range[1]>=a[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:qD.nowTime(),startLoadMetaTime:-1},i.url=e,i.backUrl=a||[],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=o||{},i._logTag=s||"",i.CHUNK_SIZE=kW(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 yW(_P(_P({segmentDuration:n.segmentDuration,url:e,vid:n.vid+"-"+t,retry:n.retryCount||2,retryDelay:n.retryDelay||1e3,timeout:3e3},n.reqOptions),{},{openLog:bW()})),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 LW({id:i.workerSequence,codecType:n.codecType,supportHevc:i.options.supportHevc,openLog:bW()}),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=qD.nowTime()-i.timeRecord.startMuxTime),i._loadSuccessCallBack&&i._loadSuccessCallBack(t)}))}catch(S0){i.log("Error in worker:",S0),i.enableWorker=!1,i.transmuxerWorkerControl=null}return i.enableWorker||(i.MP4Demuxer=null,i.FMP4Remuxer=null),i.seekTime=-1,i}return LP(d,[{key:"changeBitRate",value:(c=TP(wP().mark((function e(t){return wP().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(PW,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 a=e.slice(t,n);return i.range=[t,n],i.state=!0,{buffer:a,context:i,state:!0}}var o=e.byteLength-1,s=e.slice(t,o);return i.range=[t,o],{context:i,buffer:s,state:!1}}return null}catch(u){return console.error("[MP4] _getByPreload",t,n,u),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),a=1;a<r;a++)i[a-1]=arguments[a];AW.apply(void 0,[n].concat(i))}},{key:"errorHandler",value:(u=TP(wP().mark((function e(t,n){var r,i,a,o,s,u,c,l,d,h=arguments;return wP().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,a=t.message,o=this.options?this.options.vid:"",s=null,this._isPending=!0,!i){e.next=33;break}if(u=wW(i.headers),s=new OD("network",i.status,{httpText:i.httpText,message:a,url:i.url,headers:u}),console.log("[MP4] [".concat(o,"] 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(o,"] 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(PW,this.url);case 18:if(this.emit(CW,{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(o,"] errorHandler backUpUrl is null emit error")),this.emit(ZW,s),e.next=36;break;case 33:console.log("[MP4] [".concat(o,"] errorHandler,"),t),s=t,this.emit(ZW,s);case 36:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"init",value:(s=TP(wP().mark((function e(t){var n,r,i,a,o,s,u,c;return wP().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(PW,this.url),this.meta=null,n=t.meta,r=t.mediaSegList,i=t.buffer,a=t.fileSize,o=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:o}:i&&(this.size=a,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",qD.nowTime()),this.emit(IW,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:(o=TP(wP().mark((function e(){var t,n,r,i,a=this,o=arguments;return wP().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=!(o.length>0&&void 0!==o[0])||o[0],e.prev=1,n=qD.nowTime(),this._metaLoading=!0,this.log("getMetaInfo start, bitRate,",this._bitRate),this.bufferLoaded=new Uint8Array(0),r=0,i=function(){var e=TP(wP().mark((function e(i,o,s,u){var c,l;return wP().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a.log("getMetaInfo onProgressHandle, dataLen,",i?i.byteLength:-1,", state,",o,",range,",JSON.stringify(s.range)),!u){e.next=7;break}return e.next=4,a.cancelLoading();case 4:return c=new UD(ND.demux,WD.metaError,{msg:JSON.stringify(u)}),a.errorHandler(c,"getMetaInfo"),e.abrupt("return");case 7:i&&s.range[0]===r&&(a.bufferLoaded=KV(Uint8Array,a.bufferLoaded,new Uint8Array(i)),r+=i.byteLength),s.meta&&!a.meta&&(a.firstFrameTime.metaload=qD.nowTime()-n,l=s.meta,a.videoTrak=l.videoSegments,a.audioTrak=l.audioSegments,a.timeRange=a.getTimeRange(),a.meta=_P(_P({},l.meta),{},{ext:{videoTrak:a.videoTrak,audioTrak:a.audioTrak}}),l.bufferLoaded=a.bufferLoaded,a._bitRateInfoMap.set(a._bitRate,l),a.log("meta reach, bitRate,",a._bitRate),t&&a.emit(IW,a.meta)),a.meta&&o&&(a.log("[getMetaInfo req end]"),a._metaLoading=!1),a.meta&&(i||o)&&(a.log("emit moov_req_progress"),a.emit(RW));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 o.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:(a=TP(wP().mark((function e(){var t,n;return wP().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=_P(_P({},n.meta),{},{ext:{videoTrak:this.videoTrak,audioTrak:this.audioTrak}}),this.emit(GW,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(GW,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 a.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,a=null;this.videoTrak&&(a=e<this.videoTrak.length?this.videoTrak[e]:this.videoTrak[this.videoTrak.length-1]);var o=null;this.audioTrak&&(o=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=a)||void 0===t?void 0:t.range[0])||1/0,(null===(n=o)||void 0===n?void 0:n.range[0])||1/0),Math.max((null===(r=a)||void 0===r?void 0:r.range[1])+s||0,(null===(i=o)||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=TP(wP().mark((function e(t,n){var r,i,a,o;return wP().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),(a=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(a)):(this.log("loadFragment,",t,",bitRate,",this._bitRate,",range,",JSON.stringify(i)),this.seekTime>0?(o=this.getSubRange(t,this.seekTime,i),this.loadFragment(t,o),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],a=1,o=!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(VW),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(;a<u.length;a++){var h=u[a].startTime/c;if(l<=t&&t<h&&n[0]<u[a-1].offset){r=u[a-1].offset,o=!0,this.log(">>>>>getSubRange video end, startTime,",l,",endTime,",h,",startRange,",r,", keyFrameIndex,",a-1);break}l=h}!o&&l<=t&&t<s.endTime+.8&&(r=u[a-1].offset,this.log(">>>>>getSubRange video last, startTime,",l,",endTime,",s.endTime,",startRange,",r))}if(a=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;a=Math.floor((t*m-p[0].startTime)/f.frames[0].duration);for(var y=(a=Math.min(p.length-1,a))>0?p[a-1].startTime/m:p[0].startTime/m;a>=0&&a<p.length;)if(a>0&&y>t)y=p[a-=1].startTime/m;else{var v=(p[a].startTime+p[a].duration)/m;if(y<=t&&t<v&&n[0]<p[a].offset){i=p[a].offset,o=!0,this.log(">>>>>getSubRange audio end, startTime,",y,",endTime,",v,",startRange,",i,", index,",a);break}y=v,a++}}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,a=n.initSeg,o=0;o<i.length;o++)if(i[o].index===e){r=o;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?a:void 0}}return null}},{key:"_mux",value:function(e,t,n,r){this.firstFrameTime.firstmux<0&&this.timeRecord.startMuxTime<0&&(this.timeRecord.startMuxTime=qD.nowTime(),this.firstFrameTime.startMuxTime=qD.nowTime()-this.timeRecord.startLoadTime);var i=this.getSamplesRange(n,"video"),a=this.getSamplesRange(n,"audio"),o=[t,t+e.byteLength];if(this.transmuxerWorkerControl){var s={range:o,state:r,fragIndex:n};this.log("[transmuxerworker start] ,range, ",JSON.stringify(o),",dataLen,",e.byteLength,s),this.transmuxerWorkerControl.transmux(this.workerSequence,e,t,i,a,this.meta.moov,this.useEME,this.kidValue,s)}else try{this.MP4Demuxer||(this.MP4Demuxer=new DD(this.videoTrak,this.audioTrak,null,{openLog:bW()}));var u,c=this.MP4Demuxer.demuxPart(e,t,i,a,this.meta.moov,this.useEME,this.kidValue);this.FMP4Remuxer||this.checkCodecH265()&&!this.options.supportHevc||(this.FMP4Remuxer=new XD(this.MP4Demuxer.videoTrack,this.MP4Demuxer.audioTrack,{openLog:bW()})),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:o});d.initSegment&&(this._needInitSegment=!1),u={buffer:qD.concatData(d.audioSegment,d.videoSegment),range:o,state:r,context:{range:o,fragIndex:n,timeRange:l},initSeg:d.initSegment}}else u={videoTrack:c.videoTrack,audioTrack:c.audioTrack,buffer:null,range:o,state:r,context:{range:o,fragIndex:n,timeRange:l}};this.firstFrameTime.firstmux<0&&this.timeRecord.startMuxTime>0&&(this.firstFrameTime.firstmux=qD.nowTime()-this.timeRecord.startMuxTime),this._loadSuccessCallBack&&this._loadSuccessCallBack(u)}catch(f){console.error("mux err:",f);var h=new UD(ND.remux,WD.muxError,{msg:JSON.stringify(f)});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=TP(wP().mark((function e(t,n){var r,i,a,o;return wP().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=qD.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(a=Math.max(n[0],this.bufferLoadedPos),!((o=new Uint8Array(this.bufferLoaded.slice(a,n[1]))).byteLength>0)){e.next=24;break}return this.bufferLoadedPos=a+o.byteLength,this.log("[mp4.loadFragment] has part data: ",a,a+o.byteLength),this._mux(o,a,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(s){this.errorHandler(s,"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=TP(wP().mark((function e(t,n,r){var i,a,o;return wP().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(a=e.sent,this.log("loadAllFragmentData after",JSON.stringify(i),a),a&&a.data){e.next=11;break}return r(new Error("response null")),e.abrupt("return");case 11:o=a.data,this._loadSuccessCallBack=n,this._mux(o,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=TP(wP().mark((function e(){return wP().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}(Za);function VW(e){if(e.keyframe)return e}var DW=function(){function e(){var t,n;xP(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 LP(e,[{key:"resolve",value:function(e){}},{key:"reject",value:function(e){}}]),e}(),MW=LP((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,a=t.type,o=void 0===a?"arraybuffer":a,s=t.data,u=void 0===s?{}:s;return xP(this,e),new Promise((function(e,t){var r=new window.XMLHttpRequest,a=i.toUpperCase(),s=[];if(o&&(r.responseType=o),Object.keys(u).map((function(e){s.push("k=".concat(u[e]))})),"GET"===a)r.open(a,"".concat(n,"?").concat(s.join("&"))),r.send();else{if("POST"!==a)throw new Error("xhr ".concat(a," is not supported"));r.open(a,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 WW(e,t,n){var r=new DW;return new MW({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 a=i.play_licenses[e][t];r.resolve(a)}else r.reject()})).catch((function(){r.reject()})),r}var NW={playBtnClick:function(e,t,n,r){e.paused||e.waitingMoreBuffer&&(e.waitingMoreBuffer=!1),r.call(e,t,n)}},OW={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){AW(">>>>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?(AW("progress 起播或seek结束"),i[1]-n.currentTime>=(n.config.canplayWaterLevel||1)||i[1]>n.duration-1?(AW("progress 出起播水位"),n.play()):(AW("progress 未出起播水位"),n.emit("waiting"))):(AW("progress video卡顿结束"),i[1]-n.currentTime>=(n.config.bufferWaterLevel||5)||i[1]>n.duration-1?(AW("progress 出卡顿水位"),n.play()):(AW("progress 未出卡顿水位"),n.emit("waiting"))))}t(r,e)},playing:function(e,t){var n=e.player,r=e.eventName;AW("playing");var i=n.getBufferedRange(n.buffered2);if(0===i[0]&&0===i[1])return AW("playing 当前播放时刻没有缓存 未出水位"),n.waitingMoreBuffer=!0,n.pause(),void t.call("waiting",e);void 0===n.inWaitingStart||n.isSeekingStart?(AW("playing 起播或seek结束"),i[1]-n.currentTime>=(n.config.canplayWaterLevel||1)||i[1]>n.duration-1?(AW("playing 出起播水位"),n.waitingMoreBuffer=!1,n.isSeekingStart=!1,t(r,e)):(AW("playing 未出起播水位"),n.waitingMoreBuffer=!0,n.pause(),t.call("waiting",e))):(AW("playing video卡顿结束"),i[1]-n.currentTime>=(n.config.bufferWaterLevel||5)||i[1]>n.duration-1?(AW("playing 出卡顿水位"),n.waitingMoreBuffer=!1,t(r,e)):(AW("playing 未出卡顿水位"),n.waitingMoreBuffer=!0,n.pause(),t.call("waiting",e)))}};var UW=function(e){IP(n,e);var t=PP(n);function n(e){var r;return xP(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 LP(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],a=qD.fromHex(t),o=qD.fromHex(n),s={kty:"oct",kid:qD.toBase64(a,!1),k:qD.toBase64(o,!1)};r.push(s),i.push(s.kid)}));var a={keys:r},o=JSON.stringify(a);n.target.update(qD.StringToArrayBuffer(o)).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,a,o=this;e.sessions=[],n=this,r="encrypted",i=function(){var t=JSON.stringify({kids:["0123456789abcdef0123456789abcdef"]}),n=new Uint8Array(qD.toUTF8(t));o.EnsureMediaKeysCreated(e,o.KEYSYSTEM_TYPE,o.options).then((function(){var t=e.mediaKeys.createSession();return e.sessions.push(t),t.addEventListener("message",o.UpdateSessionFunc(o.keys)),t.addEventListener("keystatuseschange",o.KeysChange),t.generateRequest("keyids",n.buffer)}),o.bail(" failed to ensure MediaKeys on HTMLMediaElement")).then((function(){}),o.bail(" Failed to generate request."))},a?(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,a)):n.on(r,(function(e){i(e)}))}}]),n}(Za),FW=function(){function e(){xP(this,e),this.queue=[]}return LP(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}();pi({target:"Array",proto:!0,forced:QT!==[].lastIndexOf},{lastIndexOf:QT});var YW=pi,KW=w,HW=te,jW=_.f,BW=S,JW=KW((function(){jW(1)}));YW({target:"Object",stat:!0,forced:!BW||JW,sham:!BW},{getOwnPropertyDescriptor:function(e,t){return jW(HW(e),t)}});var zW=pi,QW=S,qW=Kt.f;zW({target:"Object",stat:!0,forced:Object.defineProperty!==qW,sham:!QW},{defineProperty:qW}),kk("Int8",(function(e){return function(t,n,r){return e(this,t,n,r)}})),kk("Int16",(function(e){return function(t,n,r){return e(this,t,n,r)}})),kk("Int32",(function(e){return function(t,n,r){return e(this,t,n,r)}})),kk("Uint16",(function(e){return function(t,n,r){return e(this,t,n,r)}})),kk("Uint32",(function(e){return function(t,n,r){return e(this,t,n,r)}})),kk("Float32",(function(e){return function(t,n,r){return e(this,t,n,r)}})),kk("Float64",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var $W=pi,eN=w,tN=Math.imul;$W({target:"Math",stat:!0,forced:eN((function(){return-5!=tN(4294967295,5)||2!=tN.length}))},{imul:function(e,t){var n=65535,r=+e,i=+t,a=n&r,o=n&i;return 0|a*o+((n&r>>>16)*o+a*(n&i>>>16)<<16>>>0)}});var nN=Math.sign||function(e){var t=+e;return 0==t||t!=t?t:t<0?-1:1},rN=Math.abs,iN=Math.pow,aN=iN(2,-52),oN=iN(2,-23),sN=iN(2,127)*(2-oN),uN=iN(2,-126);pi({target:"Math",stat:!0},{fround:Math.fround||function(e){var t,n,r=+e,i=rN(r),a=nN(r);return i<uN?a*function(e){return e+1/aN-1/aN}(i/uN/oN)*uN*oN:(n=(t=(1+oN/aN)*i)-(t-i))>sN||n!=n?a*(1/0):a*n}});var cN=pi,lN=Math.floor,dN=Math.log,hN=Math.LOG2E;cN({target:"Math",stat:!0},{clz32:function(e){var t=e>>>0;return t?31-lN(dN(t+.5)*hN):32}}),pi({target:"Math",stat:!0},{trunc:pr});var fN,pN=pi,mN=Ls,yN=_.f,vN=Sr,gN=nf,bN=mR,AN=q,_N=vR,wN=mN("".startsWith),SN=mN("".slice),kN=Math.min,TN=_N("startsWith");pN({target:"String",proto:!0,forced:!!(TN||(fN=yN(String.prototype,"startsWith"),!fN||fN.writable))&&!TN},{startsWith:function(e){var t=gN(AN(this));bN(e);var n=vN(kN(arguments.length>1?arguments[1]:void 0,t.length)),r=gN(e);return wN?wN(t,r,n):SN(t,n,n+r.length)===r}});var xN,EN=(xN="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 a,o="";if(document.currentScript&&(o=document.currentScript.src),xN&&(o=xN),o=0!==o.indexOf("blob:")?o.substr(0,o.lastIndexOf("/")+1):"","object"!==("undefined"==typeof window?"undefined":SP(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(){O("Module.arguments has been replaced with plain arguments_")}}),n.thisProgram&&n.thisProgram,Object.getOwnPropertyDescriptor(n,"thisProgram")||Object.defineProperty(n,"thisProgram",{configurable:!0,get:function(){O("Module.thisProgram has been replaced with plain thisProgram")}}),n.quit&&n.quit,Object.getOwnPropertyDescriptor(n,"quit")||Object.defineProperty(n,"quit",{configurable:!0,get:function(){O("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(){O("Module.read has been replaced with plain read_")}}),Object.getOwnPropertyDescriptor(n,"readAsync")||Object.defineProperty(n,"readAsync",{configurable:!0,get:function(){O("Module.readAsync has been replaced with plain readAsync")}}),Object.getOwnPropertyDescriptor(n,"readBinary")||Object.defineProperty(n,"readBinary",{configurable:!0,get:function(){O("Module.readBinary has been replaced with plain readBinary")}}),le=function(){O("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(){O("Module.wasmBinary has been replaced with plain wasmBinary")}}),n.noExitRuntime&&n.noExitRuntime,Object.getOwnPropertyDescriptor(n,"noExitRuntime")||Object.defineProperty(n,"noExitRuntime",{configurable:!0,get:function(){O("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&&O("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,a=n,o=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,a=0,o=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:{a:{o:{s:{u:{c:{l:{if((e|=0)>>>0<=244){if(3&(n=(o=s[261])>>>(e=(l=e>>>0<11?16:e+11&-8)>>>3))){e=(n=s[1092+(a=(r=e+(1&(-1^n))|0)<<3)>>2])+8|0,(0|(i=s[n+8>>2]))!=(0|(a=a+1084|0))?(s[i+12>>2]=a,s[a+8>>2]=i):(v=1044,g=_(r)&o,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):(o=_(r)&o,s[261]=o),e=n+8|0,s[n+4>>2]=3|l,a=(r<<=3)-l|0,s[4+(d=n+l|0)>>2]=1|a,s[n+r>>2]=a,h&&(n=1084+((r=h>>>3)<<3)|0,i=s[266],(r=1<<r)&o?r=s[n+8>>2]:(s[261]=r|o,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]=a;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=(a=(-8&s[e+4>>2])-l|0)>>>0<i>>>0)?a:i,n=r?e:n,r=e;if(f=s[n+24>>2],(0|(a=s[n+12>>2]))!=(0|n)){e=s[n+8>>2],s[e+12>>2]=a,s[a+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,a=e,(e=s[(r=e+20|0)>>2])||(r=a+16|0,e=s[a+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,o=0,(n>>>=8)&&(o=31,l>>>0>16777215||(o=28+((e=((o=(n<<=i=n+1048320>>>16&8)<<(e=n+520192>>>16&4))<<(n=o+245760>>>16&2)>>>15)-(n|e|i)|0)<<1|l>>>e+21&1)|0));d:{h:{if(i=s[1348+(o<<2)>>2])for(n=l<<(31==(0|o)?0:25-(o>>>1)|0),e=0;;){if(!((d=(-8&s[i+4>>2])-l|0)>>>0>=r>>>0||(a=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|a)){if(!(e=(0-(e=2<<o)|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,a=n?e:a,e=(n=s[e+16>>2])||s[e+20>>2];);}if(!(!a|r>>>0>=s[263]-l>>>0)){if(d=s[a+24>>2],(0|a)!=(0|(n=s[a+12>>2]))){e=s[a+8>>2],s[e+12>>2]=n,s[n+8>>2]=e;break n}if(!(e=s[(i=a+20|0)>>2])){if(!(e=s[a+16>>2]))break u;i=a+16|0}for(;o=i,n=e,(e=s[(i=e+20|0)>>2])||(i=n+16|0,e=s[n+16>>2]););s[o>>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=a=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=(o=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 a;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 o;if(o=r,(i=(e=s[380])+-1|0)&n&&(o=(r-n|0)+(n+i&0-e)|0),o>>>0<=l>>>0|o>>>0>2147483646)break o;if((e=s[371])&&(d=(i=s[369])+o|0)>>>0<=i>>>0|d>>>0>e>>>0)break o;if((0|n)!=(0|(e=y(o))))break l;break i}if((o=d&o-i)>>>0>2147483646)break o;if((0|(n=y(o)))==(s[e>>2]+s[e+4>>2]|0))break s;e=n}if(n=e,!(l+48>>>0<=o>>>0|o>>>0>2147483646|-1==(0|e))){if((e=(e=s[381])+(a-o|0)&0-e)>>>0>2147483646)break i;if(-1!=(0|y(e))){o=e+o|0;break i}y(0-o|0);break o}if(-1!=(0|n))break i;break o}a=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((o=e-n|0)>>>0<=l+40>>>0)break r}e=s[369]+o|0,s[369]=e,e>>>0>c[370]&&(s[370]=e);i:{a:{o:{if(r=s[267]){for(e=1492;;){if(((i=s[e>>2])+(a=s[e+4>>2])|0)==(0|n))break o;if(!(e=s[e+8>>2]))break}break a}for(n>>>0>=(e=s[265])>>>0&&e||(s[265]=n),e=0,s[374]=o,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=o+-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]=a+o,n=(e=r+8&7?-8-r&7:0)+r|0,s[267]=n,e=(i=s[264]+o|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<(a=s[265])>>>0&&(s[265]=n,a=0),i=n+o|0,e=1492;a:{o:{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&&(a=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]+o,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 o}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 o}if(1==(3&(r=s[n+4>>2]))){p=-8&r;c:if(r>>>0<=255){if(a=r>>>3,r=s[n+8>>2],(0|(i=s[n+12>>2]))==(0|r)){v=1044,g=s[261]&_(a),s[v>>2]=g;break c}s[r+12>>2]=i,s[i+8>>2]=r}else{if(h=s[n+24>>2],(0|(o=s[n+12>>2]))==(0|n))if((l=s[(i=n+20|0)>>2])||(l=s[(i=n+16|0)>>2])){for(;r=i,o=l,(l=s[(i=l+20|0)>>2])||(i=o+16|0,l=s[o+16>>2]););s[r>>2]=0}else o=0;else r=s[n+8>>2],s[r+12>>2]=o,s[o+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]=o,o)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]=o,!o)break c}s[o+24>>2]=h,(r=s[n+16>>2])&&(s[o+16>>2]=r,s[r+24>>2]=o),(r=s[n+20>>2])&&(s[o+20>>2]=r,s[r+24>>2]=o)}}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 o}if(n=0,(i=e>>>8)&&(n=31,e>>>0>16777215||(n=28+((n=((l=(i<<=a=i+1048320>>>16&8)<<(n=i+520192>>>16&4))<<(i=l+245760>>>16&2)>>>15)-(i|n|a)|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])&(a=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+(a=(4&n)+r|0)>>2]))break}s[a+16>>2]=d}else s[262]=i|a,s[r>>2]=d;s[d+24>>2]=r,s[d+12>>2]=d,s[d+8>>2]=d;break o}for(d=(e=o+-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=(a+(a+-39&7?39-a&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]=o,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<a>>>0;);if((0|r)==(0|i))break i;if(s[i+4>>2]=-2&s[i+4>>2],a=i-r|0,s[r+4>>2]=1|a,s[i>>2]=a,a>>>0<=255){e=1084+((n=a>>>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=a>>>8)&&(e=31,a>>>0>16777215||(e=28+((e=((d=(i<<=o=i+1048320>>>16&8)<<(e=i+520192>>>16&4))<<(i=d+245760>>>16&2)>>>15)-(i|e|o)|0)<<1|a>>>e+21&1)|0)),s[(n=r)+28>>2]=e,n=1348+(e<<2)|0,(i=s[262])&(o=1<<e)){for(e=a<<(31==(0|e)?0:25-(e>>>1)|0),n=s[n>>2];;){if(i=n,(0|a)==(-8&s[n+4>>2]))break a;if(n=e>>>29,e<<=1,!(n=s[16+(o=i+(4&n)|0)>>2]))break}s[o+16>>2]=r,s[r+24>>2]=i}else s[262]=i|o,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[a+28>>2];r:{if(s[(i=1348+(e<<2)|0)>>2]==(0|a)){if(s[i>>2]=n,n)break r;h=_(e)&h,s[262]=h;break n}if(s[d+(s[d+16>>2]==(0|a)?16:20)>>2]=n,!n)break n}s[n+24>>2]=d,(e=s[a+16>>2])&&(s[n+16>>2]=e,s[e+24>>2]=n),(e=s[a+20>>2])&&(s[n+20>>2]=e,s[e+24>>2]=n)}n:if(r>>>0<=15)e=r+l|0,s[a+4>>2]=3|e,s[4+(e=e+a|0)>>2]=1|s[e+4>>2];else if(s[a+4>>2]=3|l,s[4+(i=a+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<<=o=l+1048320>>>16&8)<<(e=l+520192>>>16&4))<<(l=d+245760>>>16&2)>>>15)-(l|e|o)|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+(o=(4&l)+n|0)>>2]))break}s[o+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=a+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]=a,a)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]=a,!a)break t}s[a+24>>2]=f,(e=s[n+16>>2])&&(s[a+16>>2]=e,s[e+24>>2]=a),(e=s[n+20>>2])&&(s[a+20>>2]=e,s[e+24>>2]=a)}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,a=s[266],(r=1<<r)&o?r=s[e+8>>2]:(s[261]=r|o,r=e),s[e+8>>2]=a,s[r+12>>2]=a,s[a+12>>2]=e,s[a+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,a=0,o=0,u=0,l=0,d=0;e:if(e|=0){a=(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[a+4>>2])))return s[263]=e,s[a+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(;o=i,(t=s[(i=(n=t)+20|0)>>2])||(i=n+16|0,t=s[n+16>>2]););s[o>>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(!(a>>>0<=r>>>0)&&1&(n=s[a+4>>2])){t:{if(!(2&n)){if(s[267]==(0|a)){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|a))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[a+8>>2]))==(0|(i=s[a+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[a+24>>2],(0|a)==(0|(n=s[a+12>>2])))if((t=s[(i=a+20|0)>>2])||(t=s[(i=a+16|0)>>2])){for(;o=i,(t=s[(i=(n=t)+20|0)>>2])||(i=n+16|0,t=s[n+16>>2]););s[o>>2]=0}else n=0;else t=s[a+8>>2],s[t+12>>2]=n,s[n+8>>2]=t;if(u){i=s[a+28>>2];r:{if(s[(t=1348+(i<<2)|0)>>2]==(0|a)){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|a)?16:20)>>2]=n,!n)break n}s[n+24>>2]=u,(t=s[a+16>>2])&&(s[n+16>>2]=t,s[t+24>>2]=n),(t=s[a+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[a+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)<<(o=t+245760>>>16&2)>>>15)-(o|i|u)|0)<<1|e>>>t+21&1)|0)),s[(n=r)+28>>2]=t,o=1348+(t<<2)|0;t:if((i=s[262])&(n=1<<t)){i=e<<(31==(0|t)?0:25-(t>>>1)|0),n=s[o>>2];n:{for(;;){if(t=n,(-8&s[n+4>>2])==(0|e))break n;if(n=i>>>29,i<<=1,!(n=s[16+(o=t+(4&n)|0)>>2]))break}s[o+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[o>>2]=r,s[r+12>>2]=r,s[r+24>>2]=o,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]||(a[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,a[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,a=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,a){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[a>>2]=c+-48,c=47+(t-c|0)|0,s[r>>2]=c,f=n,p=v(c),s[f>>2]=p,l=s[a>>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,o[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[a>>2]}if((0|c)>0)for(;t=s[n>>2]+h|0,h=h+1|0,o[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,a=0,s=0,c=0,l=0;if((0|t)>=1)for(i=85,a=250;r=A(n),s=u[0|(c=e+n|0)],l=r,r=1&n,o[0|c]=l+(21+((s^(r?i:a))<<24>>24)|0),a=r?a: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}(o[0|e]),s[n>>2]=r,i=v(a=t-r|0),o[i+(a=a+-1|0)|0]=0,(0|a)>=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;o[0|n]=u[0|t],o[n+1|0]=u[t+1|0],o[n+2|0]=u[t+2|0],o[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(o[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(;o[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(),a=n+t|0;if(n<a&&a<65536){var d=new ArrayBuffer(l(a,65536)),h=new e.Int8Array(d);h.set(o),o=h,o=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"!==SP(h)&&O("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||O("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,a=n+r-1,o=0;o<e.length;++o){var s=e.charCodeAt(o);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o)),s<=127){if(n>=a)break;t[n++]=s}else if(s<=2047){if(n+1>=a)break;t[n++]=192|s>>6,t[n++]=128|63&s}else if(s<=65535){if(n+2>=a)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|63&s}else{if(n+3>=a)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 Z(){m(0==(3&x)),A[1+(x>>2)]=34821223,A[2+(x>>2)]=2310721022,b[0]=1668509029}function I(){var e=A[1+(x>>2)],t=A[2+(x>>2)];34821223==e&&2310721022==t||O("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]&&O("Runtime error: The application has corrupted its heap memory area (address zero)!")}function R(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(){O("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=[],G=[],P=[],X=[],V=!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 D=0,M=null,W=null,N={};function O(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(t){e=t}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(){O("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,H="aw.wasm";function j(){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))}(H);if(e)return e;if(!a)throw"both async and sync fetching of the wasm failed"}catch(t){O(t)}}Y(H)||(K=H,H=n.locateFile?n.locateFile(K,o):o+K),G.push({func:function(){ue()}});var B="function"==typeof atob?atob:function(e){var t,n,r,i,a,o,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|(a=s.indexOf(e.charAt(c++)))>>2,r=(3&a)<<6|(o=s.indexOf(e.charAt(c++))),u+=String.fromCharCode(t),64!==a&&(u+=String.fromCharCode(n)),64!==o&&(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(t){console.error("emscripten_realloc_buffer: Attempted to grow heap from "+y.byteLength+" bytes to "+e+" bytes, but got error: "+t)}}(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(D--,n.monitorRunDependencies&&n.monitorRunDependencies(D),e?(m(N[e]),delete N[e]):c("warning: run dependency removed without ID"),0==D&&(null!==M&&(clearInterval(M),M=null),W)){var t=W;W=null,t()}}("wasm-instantiate")}e="wasm-instantiate",D++,n.monitorRunDependencies&&n.monitorRunDependencies(D),e?(m(!N[e]),N[e]=1,null===M&&"undefined"!=typeof setInterval&&(M=setInterval((function(){if(p)return clearInterval(M),void(M=null);var e=!1;for(var t in N)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 a=n;function o(e){m(n===a,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),a=null,r(e.instance)}function u(e){return(!s&&i&&"function"==typeof fetch?fetch(H,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+H+"'";return e.arrayBuffer()})).catch((function(){return j()})):new Promise((function(e,t){e(j())}))).then((function(e){return h.instantiate(e,t)})).then(e,(function(e){c("failed to asynchronously prepare wasm: "+e),O(e)}))}if(n.instantiateWasm)try{return n.instantiateWasm(t,r)}catch(l){return c("Module.instantiateWasm callback failed with error: "+l),!1}return function(){if(s||"function"!=typeof h.instantiateStreaming||Y(H)||"function"!=typeof fetch)return u(o);fetch(H,{credentials:"same-origin"}).then((function(e){return h.instantiateStreaming(e,t).then(o,(function(e){c("wasm streaming compile failed: "+e),c("falling back to ArrayBuffer instantiation"),u(o)}))}))}(),{}}(),Q=z.__wasm_call_ctors;z.__wasm_call_ctors=function(){return m(V,"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(V,"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(V,"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(V,"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(V,"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(V,"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(V,"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(V,"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 ae=z.stackAlloc;z.stackAlloc=function(){return m(V,"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 oe=z.stackRestore;z.stackRestore=function(){return m(V,"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 se=z.__growWasmMemory;z.__growWasmMemory=function(){return m(V,"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(V,"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(V,"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(V,"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(V,"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(V,"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(V,"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(V,"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(V,"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(V,"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(V,"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(V,"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||(I(),m(!V),V=!0,R(G),I(),R(P),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(I(),n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)e=n.postRun.shift(),X.unshift(e);var e;R(X)}()))}D>0||(Z(),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;R(C)}(),D>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),t()}),1)):t(),I()))}if(n.asm=z,n.intArrayFromString=function(e,t,n){var r=n>0?n:S(e)+1,i=new Array(r),a=w(e,i,0,i.length);return t&&(i.length=a),i},Object.getOwnPropertyDescriptor(n,"intArrayToString")||(n.intArrayToString=function(){O("'intArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"ccall")||(n.ccall=function(){O("'ccall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"cwrap")||(n.cwrap=function(){O("'cwrap' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"setValue")||(n.setValue=function(){O("'setValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getValue")||(n.getValue=function(){O("'getValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"allocate")||(n.allocate=function(){O("'allocate' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getMemory")||(n.getMemory=function(){O("'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(){O("'AsciiToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stringToAscii")||(n.stringToAscii=function(){O("'stringToAscii' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"UTF8ArrayToString")||(n.UTF8ArrayToString=function(){O("'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 a="";t<i;){var o=e[t++];if(128&o){var s=63&e[t++];if(192!=(224&o)){var u=63&e[t++];if(224==(240&o)?o=(15&o)<<12|s<<6|u:(240!=(248&o)&&l("Invalid UTF-8 leading byte 0x"+o.toString(16)+" encountered when deserializing a UTF-8 string on the asm.js/wasm heap to a JS string!"),o=(7&o)<<18|s<<12|u<<6|63&e[t++]),o<65536)a+=String.fromCharCode(o);else{var c=o-65536;a+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else a+=String.fromCharCode((31&o)<<6|s)}else a+=String.fromCharCode(o)}return a}(g,e,t):""},Object.getOwnPropertyDescriptor(n,"stringToUTF8Array")||(n.stringToUTF8Array=function(){O("'stringToUTF8Array' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stringToUTF8")||(n.stringToUTF8=function(){O("'stringToUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"lengthBytesUTF8")||(n.lengthBytesUTF8=function(){O("'lengthBytesUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"UTF16ToString")||(n.UTF16ToString=function(){O("'UTF16ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stringToUTF16")||(n.stringToUTF16=function(){O("'stringToUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"lengthBytesUTF16")||(n.lengthBytesUTF16=function(){O("'lengthBytesUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"UTF32ToString")||(n.UTF32ToString=function(){O("'UTF32ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stringToUTF32")||(n.stringToUTF32=function(){O("'stringToUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"lengthBytesUTF32")||(n.lengthBytesUTF32=function(){O("'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(){O("'stackTrace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addOnPreRun")||(n.addOnPreRun=function(){O("'addOnPreRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addOnInit")||(n.addOnInit=function(){O("'addOnInit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addOnPreMain")||(n.addOnPreMain=function(){O("'addOnPreMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addOnExit")||(n.addOnExit=function(){O("'addOnExit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addOnPostRun")||(n.addOnPostRun=function(){O("'addOnPostRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"writeStringToMemory")||(n.writeStringToMemory=function(){O("'writeStringToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"writeArrayToMemory")||(n.writeArrayToMemory=function(){O("'writeArrayToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"writeAsciiToMemory")||(n.writeAsciiToMemory=function(){O("'writeAsciiToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addRunDependency")||(n.addRunDependency=function(){O("'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(){O("'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(){O("'ENV' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"FS")||(n.FS=function(){O("'FS' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"FS_createFolder")||(n.FS_createFolder=function(){O("'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(){O("'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(){O("'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(){O("'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(){O("'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(){O("'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(){O("'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(){O("'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(){O("'GL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"dynamicAlloc")||(n.dynamicAlloc=function(){O("'dynamicAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"loadDynamicLibrary")||(n.loadDynamicLibrary=function(){O("'loadDynamicLibrary' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"loadWebAssemblyModule")||(n.loadWebAssemblyModule=function(){O("'loadWebAssemblyModule' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getLEB")||(n.getLEB=function(){O("'getLEB' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getFunctionTables")||(n.getFunctionTables=function(){O("'getFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"alignFunctionTables")||(n.alignFunctionTables=function(){O("'alignFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"registerFunctions")||(n.registerFunctions=function(){O("'registerFunctions' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addFunction")||(n.addFunction=function(){O("'addFunction' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"removeFunction")||(n.removeFunction=function(){O("'removeFunction' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getFuncWrapper")||(n.getFuncWrapper=function(){O("'getFuncWrapper' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"prettyPrint")||(n.prettyPrint=function(){O("'prettyPrint' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"makeBigInt")||(n.makeBigInt=function(){O("'makeBigInt' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"dynCall")||(n.dynCall=function(){O("'dynCall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getCompilerSetting")||(n.getCompilerSetting=function(){O("'getCompilerSetting' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stackSave")||(n.stackSave=function(){O("'stackSave' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stackRestore")||(n.stackRestore=function(){O("'stackRestore' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stackAlloc")||(n.stackAlloc=function(){O("'stackAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"establishStackSpace")||(n.establishStackSpace=function(){O("'establishStackSpace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"print")||(n.print=function(){O("'print' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"printErr")||(n.printErr=function(){O("'printErr' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getTempRet0")||(n.getTempRet0=function(){O("'getTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"setTempRet0")||(n.setTempRet0=function(){O("'setTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"callMain")||(n.callMain=function(){O("'callMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"abort")||(n.abort=function(){O("'abort' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),n.Pointer_stringify=function(e,t){O("this function has been removed - you should use UTF8ToString(ptr, maxBytesToRead) instead!")},Object.getOwnPropertyDescriptor(n,"warnOnce")||(n.warnOnce=function(){O("'warnOnce' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),n.writeStackCookie=Z,n.checkStackCookie=I,n.abortStackOverflow=function(e){O("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(){O("'intArrayFromBase64' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"tryParseAsDataURI")||(n.tryParseAsDataURI=function(){O("'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(){O("'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(){O("'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(){O("'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(){O("'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(){O("'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}),LN=function(){function e(t,n){xP(this,e),this.cdnHost=t,this.cdnBucket=n}return LP(e,[{key:"init",value:function(){var e=new DW;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),EN(this.module),e}},{key:"openBox",value:function(e){try{var t=window.atob(e),n=qD.str2hex(t),r=this.module._malloc(Number(n.length));this.module.HEAP8.set(n,r);var i=this.module._openBox(Number(r),n.length),a=this.module.UTF8ToString(i);return this.module._free(r),a}catch(S0){}}},{key:"destroy",value:function(){this.module=null}}]),e}(),ZN=Wv.some;pi({target:"Array",proto:!0,forced:!Ov("some")},{some:function(e){return ZN(this,e,arguments.length>1?arguments[1]:void 0)}});var IN={},RN=gt;IN.f=RN;var CN=A,GN=rt,PN=IN,XN=Kt.f,VN=E,DN=de,MN=gt,WN=lr,NN=pi,ON=A,UN=E,FN=W,YN=S,KN=Se,HN=w,jN=rt,BN=he,JN=zt,zN=te,QN=Zt,qN=nf,$N=P,eO=Nd,tO=To,nO=dr,rO=WZ,iO=Nr,aO=_,oO=Kt,sO=bd,uO=L,cO=lr,lO=Qe,dO=Cn,hO=ut,fO=gt,pO=IN,mO=function(e){var t=CN.Symbol||(CN.Symbol={});GN(t,e)||XN(t,e,{value:PN.f(e)})},yO=function(){var e=DN("Symbol"),t=e&&e.prototype,n=t&&t.valueOf,r=MN("toPrimitive");t&&!t[r]&&WN(t,r,(function(e){return VN(n,this)}),{arity:1})},vO=rs,gO=Hn,bO=Wv.forEach,AO=Rn("hidden"),_O="Symbol",wO="prototype",SO=gO.set,kO=gO.getterFor(_O),TO=Object[wO],xO=ON.Symbol,EO=xO&&xO[wO],LO=ON.TypeError,ZO=ON.QObject,IO=aO.f,RO=oO.f,CO=rO.f,GO=uO.f,PO=FN([].push),XO=lO("symbols"),VO=lO("op-symbols"),DO=lO("wks"),MO=!ZO||!ZO[wO]||!ZO[wO].findChild,WO=YN&&HN((function(){return 7!=eO(RO({},"a",{get:function(){return RO(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=IO(TO,t);r&&delete TO[t],RO(e,t,n),r&&e!==TO&&RO(TO,t,r)}:RO,NO=function(e,t){var n=XO[e]=eO(EO);return SO(n,{type:_O,tag:e,description:t}),YN||(n.description=t),n},OO=function(e,t,n){e===TO&&OO(VO,t,n),JN(e);var r=QN(t);return JN(n),jN(XO,r)?(n.enumerable?(jN(e,AO)&&e[AO][r]&&(e[AO][r]=!1),n=eO(n,{enumerable:$N(0,!1)})):(jN(e,AO)||RO(e,AO,$N(1,{})),e[AO][r]=!0),WO(e,r,n)):RO(e,r,n)},UO=function(e,t){JN(e);var n=zN(t),r=tO(n).concat(HO(n));return bO(r,(function(t){YN&&!UN(FO,n,t)||OO(e,t,n[t])})),e},FO=function(e){var t=QN(e),n=UN(GO,this,t);return!(this===TO&&jN(XO,t)&&!jN(VO,t))&&(!(n||!jN(this,t)||!jN(XO,t)||jN(this,AO)&&this[AO][t])||n)},YO=function(e,t){var n=zN(e),r=QN(t);if(n!==TO||!jN(XO,r)||jN(VO,r)){var i=IO(n,r);return!i||!jN(XO,r)||jN(n,AO)&&n[AO][r]||(i.enumerable=!0),i}},KO=function(e){var t=CO(zN(e)),n=[];return bO(t,(function(e){jN(XO,e)||jN(dO,e)||PO(n,e)})),n},HO=function(e){var t=e===TO,n=CO(t?VO:zN(e)),r=[];return bO(n,(function(e){!jN(XO,e)||t&&!jN(TO,e)||PO(r,XO[e])})),r};KN||(xO=function(){if(BN(EO,this))throw LO("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?qN(arguments[0]):void 0,t=hO(e),n=function(e){this===TO&&UN(n,VO,e),jN(this,AO)&&jN(this[AO],t)&&(this[AO][t]=!1),WO(this,t,$N(1,e))};return YN&&MO&&WO(TO,t,{configurable:!0,set:n}),NO(t,e)},cO(EO=xO[wO],"toString",(function(){return kO(this).tag})),cO(xO,"withoutSetter",(function(e){return NO(hO(e),e)})),uO.f=FO,oO.f=OO,sO.f=UO,aO.f=YO,nO.f=rO.f=KO,iO.f=HO,pO.f=function(e){return NO(fO(e),e)},YN&&(RO(EO,"description",{configurable:!0,get:function(){return kO(this).description}}),cO(TO,"propertyIsEnumerable",FO,{unsafe:!0}))),NN({global:!0,constructor:!0,wrap:!0,forced:!KN,sham:!KN},{Symbol:xO}),bO(tO(DO),(function(e){mO(e)})),NN({target:_O,stat:!0,forced:!KN},{useSetter:function(){MO=!0},useSimple:function(){MO=!1}}),NN({target:"Object",stat:!0,forced:!KN,sham:!YN},{create:function(e,t){return void 0===t?eO(e):UO(eO(e),t)},defineProperty:OO,defineProperties:UO,getOwnPropertyDescriptor:YO}),NN({target:"Object",stat:!0,forced:!KN},{getOwnPropertyNames:KO}),yO(),vO(xO,_O),dO[AO]=!0;var jO=Se&&!!Symbol.for&&!!Symbol.keyFor,BO=pi,JO=de,zO=rt,QO=nf,qO=Qe,$O=jO,eU=qO("string-to-symbol-registry"),tU=qO("symbol-to-string-registry");BO({target:"Symbol",stat:!0,forced:!$O},{for:function(e){var t=QO(e);if(zO(eU,t))return eU[t];var n=JO("Symbol")(t);return eU[t]=n,tU[n]=t,n}});var nU=pi,rU=rt,iU=Ze,aU=Re,oU=jO,sU=Qe("symbol-to-string-registry");nU({target:"Symbol",stat:!0,forced:!oU},{keyFor:function(e){if(!iU(e))throw TypeError(aU(e)+" is not a symbol");if(rU(sU,e))return sU[e]}});var uU=Nr,cU=et;pi({target:"Object",stat:!0,forced:!Se||w((function(){uU.f(1)}))},{getOwnPropertySymbols:function(e){var t=uU.f;return t?t(cU(e)):[]}});var lU=pi,dU=S,hU=A,fU=W,pU=rt,mU=ae,yU=he,vU=nf,gU=Kt.f,bU=Qr,AU=hU.Symbol,_U=AU&&AU.prototype;if(dU&&mU(AU)&&(!("description"in _U)||void 0!==AU().description)){var wU={},SU=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:vU(arguments[0]),t=yU(_U,this)?new AU(e):void 0===e?AU():AU(e);return""===e&&(wU[t]=!0),t};bU(SU,AU),SU.prototype=_U,_U.constructor=SU;var kU="Symbol(test)"==String(AU("test")),TU=fU(_U.valueOf),xU=fU(_U.toString),EU=/^Symbol\((.*)\)[^)]+$/,LU=fU("".replace),ZU=fU("".slice);gU(_U,"description",{configurable:!0,get:function(){var e=TU(this);if(pU(wU,e))return"";var t=xU(e),n=kU?ZU(t,7,-1):LU(t,EU,"$1");return""===n?void 0:n}}),lU({global:!0,constructor:!0,forced:!0},{Symbol:SU})}var IU=E_.aTypedArrayConstructor;function RU(){var e=window.navigator.userAgent,t=e.indexOf("MSIE "),n=e.indexOf("Trident/");return t>0||n>0}function CU(){var e,t,n,r,i,a,o,s;return!(!navigator.requestMediaKeySystemAccess||(r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),i=RU(),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)}))),a=n,o=navigator.userAgent.indexOf("Firefox")>0,s=navigator.userAgent.indexOf("Edge")>0,r||i||a||o||s))}function GU(){try{if("object"===("undefined"==typeof WebAssembly?"undefined":SP(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(t){console.log(t)}return!1}function PU(){var e=window.MediaSource=window.MediaSource||window.WebKitMediaSource;return e&&"function"==typeof e.isTypeSupported}(0,E_.exportTypedArrayStaticMethod)("of",(function(){for(var e=0,t=arguments.length,n=new(IU(this))(t);t>e;)n[e]=arguments[e++];return n}),P_);var XU=function(){function e(t){xP(this,e),this.onTick_=t,this.cancelPending_=null}return LP(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}(),VU=A,DU=w,MU=nf,WU=ML.trim,NU=ZL,OU=W("".charAt),UU=VU.parseFloat,FU=VU.Symbol,YU=FU&&FU.iterator,KU=1/UU(NU+"-0")!=-1/0||YU&&!DU((function(){UU(Object(YU))}))?function(e){var t=WU(MU(e)),n=UU(t);return 0===n&&"-"==OU(t,0)?-0:n}:UU;pi({global:!0,forced:parseFloat!=KU},{parseFloat:KU});var HU="PRELOAD_NEXT",jU="PRELOAD_SEG_DONE",BU="PREPARE",JU="IDLE",zU="FINISH",QU=1,qU=0,$U=1;function eF(e){return(eF="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 tF(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nF(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 rF(e,t,n){return t&&nF(e.prototype,t),n&&nF(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var iF,aF,oF={exports:{}},sF={exports:{}},uF=function(e){return null!=e},cF=uF,lF={object:!0,function:!0,undefined:!0},dF=function(e){return!!cF(e)&&hasOwnProperty.call(lF,typeof e)},hF=function(e){if(!dF(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(S0){return!1}},fF=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(S0){return!1}return!hF(e)},pF=/^\s*class[\s{/}]/,mF=Function.prototype.toString;var yF,vF,gF,bF,AF,_F,wF,SF,kF=function(e){return null!=e};function TF(){return bF?gF:(bF=1,gF=(aF?iF:(aF=1,iF=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}))()?Object.keys:function(){if(vF)return yF;vF=1;var e=kF,t=Object.keys;return yF=function(n){return t(e(n)?Object(n):n)}}())}var xF,EF,LF=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(SF)return wF;SF=1;var e=TF(),t=function(){if(_F)return AF;_F=1;var e=kF;return AF=function(t){if(!e(t))throw new TypeError("Cannot use null or undefined");return t}}(),n=Math.max;return wF=function(r,i){var a,o,s,u=n(arguments.length,2);for(r=Object(t(r)),s=function(e){try{r[e]=i[e]}catch(t){a||(a=t)}},o=1;o<u;++o)e(i=arguments[o]).forEach(s);if(void 0!==a)throw a;return r},wF}(),ZF=kF,IF=Array.prototype.forEach,RF=Object.create,CF="razdwatrzy";var GF="function"==typeof CF.contains&&!0===CF.contains("dwa")&&!1===CF.contains("foo")?String.prototype.contains:function(){if(EF)return xF;EF=1;var e=String.prototype.indexOf;return xF=function(t){return e.call(this,t,arguments[1])>-1},xF}(),PF=uF,XF=function(e){return!!fF(e)&&!pF.test(mF.call(e))},VF=LF,DF=function(e){var t=RF(null);return IF.call(arguments,(function(e){ZF(e)&&function(e,t){var n;for(n in e)t[n]=e[n]}(Object(e),t)})),t},MF=GF,WF=sF.exports=function(e,t){var n,r,i,a,o;return arguments.length<2||"string"!=typeof e?(a=t,t=e,e=null):a=arguments[2],PF(e)?(n=MF.call(e,"c"),r=MF.call(e,"e"),i=MF.call(e,"w")):(n=i=!0,r=!1),o={value:t,configurable:n,enumerable:r,writable:i},a?VF(DF(a),o):o};WF.gs=function(e,t,n){var r,i,a,o;return"string"!=typeof e?(a=n,n=t,t=e,e=null):a=arguments[3],PF(t)?XF(t)?PF(n)?XF(n)||(a=n,n=void 0):n=void 0:(a=t,t=n=void 0):t=void 0,PF(e)?(r=MF.call(e,"c"),i=MF.call(e,"e")):(r=!0,i=!1),o={get:t,set:n,configurable:r,enumerable:i},a?VF(DF(a),o):o};var NF=sF.exports,OF=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e};!function(e,t){var n,r,i,a,o,s,u,c=NF,l=OF,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,a;return l(t),a=this,n.call(this,e,r=function(){i.call(a,e,r),d.call(t,this,arguments)}),r.__eeOnceListener__=t,this},a=function(e){var t,n,r,i,a;if(y.call(this,"__ee__")&&(i=this.__ee__[e]))if("object"==typeof i){for(n=arguments.length,a=new Array(n-1),t=1;t<n;++t)a[t-1]=arguments[t];for(i=i.slice(),t=0;r=i[t];++t)d.call(r,this,a)}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,a=new Array(n-1),t=1;t<n;++t)a[t-1]=arguments[t];d.call(i,this,a)}},o={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,a;if(l(t),!y.call(this,"__ee__"))return this;if(!(n=this.__ee__)[e])return this;if("object"==typeof(r=n[e]))for(a=0;i=r[a];++a)i!==t&&i.__eeOnceListener__!==t||(2===r.length?n[e]=r[a?0:1]:r.splice(a,1));else r!==t&&r.__eeOnceListener__!==t||delete n[e];return this},emit:a},s={on:c(n),once:c(r),off:c(i),emit:c(a)},u=m({},s),e.exports=t=function(e){return null==e?f(u):m(Object(e),s)},t.methods=o}(oF,oF.exports);var UF=g(oF.exports),FF=pi,YF=W,KF=Xe,HF=et,jF=Tr,BF=Ag,JF=nf,zF=w,QF=Gp,qF=Ov,$F=Wx,eY=Nx,tY=Ae,nY=Ux,rY=[],iY=YF(rY.sort),aY=YF(rY.push),oY=zF((function(){rY.sort(void 0)})),sY=zF((function(){rY.sort(null)})),uY=qF("sort"),cY=!zF((function(){if(tY)return tY<70;if(!($F&&$F>3)){if(eY)return!0;if(nY)return nY<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++)rY.push({k:t+r,v:n})}for(rY.sort((function(e,t){return t.v-e.v})),r=0;r<rY.length;r++)t=rY[r].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));FF({target:"Array",proto:!0,forced:oY||!sY||!uY||!cY},{sort:function(e){void 0!==e&&KF(e);var t=HF(this);if(cY)return void 0===e?iY(t):iY(t,e);var n,r,i=[],a=jF(t);for(r=0;r<a;r++)r in t&&aY(i,t[r]);for(QF(i,function(e){return function(t,n){return void 0===n?-1:void 0===t?1:void 0!==e?+e(t,n)||0:JF(t)>JF(n)?1:-1}}(e)),n=jF(i),r=0;r<n;)t[r]=i[r++];for(;r<a;)BF(t,r++);return t}});var lY=S,dY=W,hY=To,fY=te,pY=dY(L.f),mY=dY([].push),yY=function(e){return function(t){for(var n,r=fY(t),i=hY(r),a=i.length,o=0,s=[];a>o;)n=i[o++],lY&&!pY(r,n)||mY(s,e?[n,r[n]]:r[n]);return s}},vY={entries:yY(!0),values:yY(!1)},gY=vY.values;pi({target:"Object",stat:!0},{values:function(e){return gY(e)}});var bY=kF,AY={function:!0,object:!0},_Y=function(e){return bY(e)&&AY[typeof e]||!1},wY=function(e){if(!_Y(e))throw new TypeError(e+" is not an Object");return e},SY=Object.prototype.hasOwnProperty,kY=function(e){var t,n=arguments[1];if(wY(e),void 0===n)SY.call(e,"__ee__")&&delete e.__ee__;else{if(!(t=SY.call(e,"__ee__")&&e.__ee__))return;t[n]&&delete t[n]}},TY=g(kY),xY=function(){function e(t,n,r,i,a){tF(this,e),UF(this),this.state=BU,this.options=t||{},this.logger=t.logger||function(){},this._preloadManager=n,this.player=n.player;var o=r.handlers,s=r.predictInst,u=r.readyPromise;this._predictInst=s,this._handlers=o,this._predictInstReadyPromise=u,this._toLoadList=[],this.retryCount=0,this._cachedHandler=i,this._cachedDataHanlder=a,this.cnt=0}return rF(e,[{key:"start",value:function(){var e=this,t=new NX;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),a=e._predictInst.cachedData;e._cachedDataHanlder(Object.assign({vid:e.options.vid},{data:a}));var o=Object.assign(i,e.options);n.onTransform(o).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=zU,void this.emit(jU,!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=JU,e.emit(jU)})).catch((function(t){e.requestError(),e.emit(jU,!1)}))}},{key:"requestError",value:function(){this.retryCount++,this.state=JU,this.retryCount>=10&&(this.state=zU),this.emit("ONE_STEP_DONE"),this.logger("preload request error")}},{key:"cancelLoading",value:function(){this._toLoadList=[]}},{key:"destroy",value:function(){TY(this)}}]),e}();var EY=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(e){}}();function LY(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function ZY(e){return"string"!=typeof e&&(console.warn("".concat(e," used as a key, but it is not a string.")),e=String(e)),e}var IY={},RY="readonly",CY="readwrite";function GY(e){var t=IY[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 PY(e,t){return new Promise((function(n,r){if(IY[e.name]=IY[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);GY(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=EY.open.apply(EY,i);t&&(a.onupgradeneeded=function(t){var n=a.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.')}}),a.onerror=function(e){e.preventDefault(),r(a.error)},a.onsuccess=function(){n(a.result),function(e){var t=IY[e.name].deferredOperations.pop();if(t)t.resolve(),t.promise}(e)}}))}function XY(e){return PY(e,!1)}function VY(e){return PY(e,!0)}function DY(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 a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function MY(e){GY(e);for(var t=IY[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,XY(e).then((function(t){return e.db=t,DY(e)?VY(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=IY[e.name].deferredOperations.pop();if(n)n.reject(t),n.promise}(e,t),t}))}function WY(e,t,n,r){void 0===r&&(r=1);try{var i=e.db.transaction(e.storeName,t);n(null,i)}catch(a){if(r>0&&(!e.db||"InvalidStateError"===a.name||"NotFoundError"===a.name))return Promise.resolve().then((function(){if(!e.db||"NotFoundError"===a.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),VY(e)})).then((function(){return MY(e).then((function(){WY(e,t,n,r-1)}))})).catch(n);n(a)}}var NY=function(){function e(){tF(this,e)}return rF(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=IY[n.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},IY[n.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=t._fullyReady);var a=[];function o(){return Promise.resolve()}for(var s=0;s<i.forages.length;s++){var u=i.forages[s];u!==t&&a.push(u._initReady().catch(o))}var c=i.forages.slice(0);return t._ready=Promise.all(a).then((function(){return n.db=i.db,XY(n)})).then((function(e){return n.db=e,DY(n,t._defaultConfig.version)?VY(n):e})).then((function(e){n.db=i.db=e,t._dbInfo=n;for(var r=0;r<c.length;r++){var a=c[r];a!==t&&(a._dbInfo.db=n.db,a._dbInfo.version=n.version)}})),t._ready}},{key:"probeSupport",get:function(){return function(){try{if(!EY||!EY.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(n){return!1}}()}},{key:"getItem",value:function(e,t){var n=this;e=ZY(e);var r=new Promise((function(t,r){n.ready().then((function(){WY(n._dbInfo,RY,(function(i,a){if(i)return r(i);try{var o=a.objectStore(n._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),t(e)},o.onerror=function(){r(o.error)}}catch(s){r(s)}}))})).catch(r)}));return LY(r,t),r}},{key:"setItem",value:function(e,t,n){var r=this;e=ZY(e);var i=new Promise((function(n,i){r.ready().then((function(){return r._dbInfo,t})).then((function(t){WY(r._dbInfo,CY,(function(a,o){if(a)return i(a);try{var s=o.objectStore(r._dbInfo.storeName);null===t&&(t=void 0);var u=s.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),n(t)},o.onabort=o.onerror=function(){var e=u.error?u.error:u.transaction.error;i(e)}}catch(c){i(c)}}))})).catch(i)}));return LY(i,n),i}},{key:"removeItem",value:function(e,t){var n=this;e=ZY(e);var r=new Promise((function(t,r){n.ready().then((function(){WY(n._dbInfo,CY,(function(i,a){if(i)return r(i);try{var o=a.objectStore(n._dbInfo.storeName).delete(e);a.oncomplete=function(){t()},a.onerror=function(){r(o.error)},a.onabort=function(){var e=o.error?o.error:o.transaction.error;r(e)}}catch(s){r(s)}}))})).catch(r)}));return LY(r,t),r}},{key:"clear",value:function(e){var t=this,n=new Promise((function(e,n){t.ready().then((function(){WY(t._dbInfo,CY,(function(r,i){if(r)return n(r);try{var a=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=a.error?a.error:a.transaction.error;n(e)}}catch(o){n(o)}}))})).catch(n)}));return LY(n,e),n}},{key:"length",value:function(e){var t=this,n=new Promise((function(e,n){t.ready().then((function(){WY(t._dbInfo,RY,(function(r,i){if(r)return n(r);try{var a=i.objectStore(t._dbInfo.storeName).count();a.onsuccess=function(){e(a.result)},a.onerror=function(){n(a.error)}}catch(o){n(o)}}))})).catch(n)}));return LY(n,e),n}},{key:"all",value:function(e){var t=this,n=new Promise((function(e,n){t.ready().then((function(){WY(t._dbInfo,RY,(function(r,i){if(r)return n(r);try{var a=i.objectStore(t._dbInfo.storeName).openCursor(),o=[];a.onsuccess=function(){var t=a.result;t?(o.push({key:t.key,value:t.value}),t.continue()):e(o)},a.onerror=function(){n(a.error)}}catch(s){n(s)}}))})).catch(n)}));return LY(n,e),n}},{key:"_fullyReady",value:function(e){var t=this,n=t._initReady().then((function(){var e=IY[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}(),OY=function(){function e(){tF(this,e)}return rF(e,[{key:"_initStorage",value:function(e){var t=e.name+"_"+e.storeName;return this.key=t,window[t]&&"object"===eF(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 LY(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}(),UY={description:"",name:"__PRE_CACHE__",storeName:"keyvaluepairs",version:1},FY="__PRE_CACHE__KEYS",YY=function(){function e(t,n){tF(this,e);var r=n===QU?OY:NY;this._driver=new r,this._driver._initStorage(UY).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 NX,this.init()}return rF(e,[{key:"getCachedKeysFromLocal",value:function(){var e=GV.getItem(FY);if(e)for(var t=e.split("|"),n=0;n<t.length;n++){var r=t[n],i=this._getCacheKeyInfos(r),a=i.time,o=i.cachedKey;this._allCachedKeys[o]=1,this._allCachedTimeKeys[o]=a}}},{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),a=i.time,o=i.cachedKey;this._allCachedKeys[o]=1,this._allCachedTimeKeys[o]=a,t.push(r)}var s=t.join("|");GV.setItem(FY,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 OY,e._driver._initStorage(UY)),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 a=0;a<i.length;a++)e.removeItem(i[a].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 a=this._genTimeKey(e,i);return n=n?function(){r._getAll(),n()}:function(){r._getAll()},this._driver.setItem(a,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}(),KY=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;tF(this,e),UF(this),this._preloadDataList=[],this._currentPreloadInst=null,this._dashPreloadList=[],this.autoPreload=t.autoPreload||!1,this._onPreloadNext=this.onPreloadNextReady.bind(this),this.on(HU,this._onPreloadNext),this._preloaderConfigs={},this.update(t,n,r),this._cacheInst=new YY(t.preloadMaxCacheCount,t.preloadCacheType),this._preloadCacheProgress={},this._ptag_=!0,this._cachedDatas={}}return rF(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,a=e.loaded,o=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:a,isInitSegment:o}}},{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(HU)}},{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 xY(t,this,r,(function(t){e.onCacheSegment(t)}),(function(t){e.onCachePredict(t)})),this._currentPreloadInst.on(jU,this.onPreloadSegDone.bind(this)),this._currentPreloadInst.start().then((function(){e._currentPreloadInst.preloadSeg()})).catch((function(){e._currentPreloadInst=null}))}}}else null!=this._currentPreloadInst&&(this._currentPreloadInst.state===JU?this._currentPreloadInst.preloadSeg():this._currentPreloadInst.state===zU?(this._currentPreloadInst.destroy(),this._currentPreloadInst=null):this._currentPreloadInst.state===BU&&(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(HU))}},{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(HU,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,a=e.bitrate,o=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?qU:$U),p+=b.total,v+=b.loaded}return{media_type:u,preload_type:i,stream_bitrate:a,header_size:f,content_total_size:p,start_time:c||-1,state_info:{set_duration:o,set_size:s,current_header_download_size:m,current_content_download_size:v,header_download_state:y,content_download_state:v===p?qU:$U}}}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:""),a=window[i];if(a&&a._ptag_)return a.update(t,n,r),a;var o=new e(t,n,r);return window[i]=o,o}}]),e}();KY.GLOBAL_KEY="__preloadcontext__";var HY=function(){function e(t){tF(this,e),UF(this),this.options=t,this.promisePolyfill(),this.before(),this.check(),this._preloadManager=KY.getInstance(t,this.handlers,this.predictInst),this.loadingTasks=[]}return rF(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(HU)}},{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(n){}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}(),jY={MP4:"MP4",DASH:"DASH",HLS:"HLS"},BY="h264",JY="h265",zY={DURATION:0,SIZE:1},QY=null,qY=function(e){IP(n,e);var t=PP(n);function n(){return xP(this,n),t.apply(this,arguments)}return LP(n,[{key:"init",value:function(){return Promise.resolve()}},{key:"preloadPredict",value:function(e){return e}}]),n}(function(){function e(){tF(this,e),this.bandwidth2item={},this._mediaInfos=null,this.__p__=!0}return rF(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}()),$Y=function(e){IP(o,e);var t,n,r,i,a=PP(o);function o(e,t){var n;return xP(this,o),e.vtype=jY.MP4,(n=a.call(this,e)).player=t,n.loadingCount=0,n._mp4=null,n._loader=null,n._pendingPromise=null,n.playerId=t.playerId,n}return LP(o,[{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];AW.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||jY.MP4,a=t.codecType||BY,s=e.getUserSelectDefinition(),u=e.checkCacheKey(r,n,s,i,a);if(console.log("[Preloader] ".concat(r," codecType:").concat(a," 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=o.generateUniqueKey({vid:r,definition:l,vtype:i,codecType:a});AW("[Preloader] ".concat(r," start duration:").concat(c.duration," cacheKey:").concat(f));var p=_P({vid:r,definition:l,preloadTime:d,preloadSize:h,cacheKey:f,codecType:a,vtype:i},c);return e.loadingCount++,e.start(p)},onRequest:function(t,n){var r=t.url,i=t.range,a=t.extData;return e.getData(r,i,a,n)}},this.loggerConfig={logger:function(){},openLog:!1},this.predictInst=new qY(this.loggerConfig)}},{key:"start",value:function(e){var t=this,n={mediaInfos:{dynamic_video_list:[],dynamic_audio_list:[]},onObtain:function(){var e=new DW;return e.resolve(n.mediaInfos),e},onTransform:function(n){var r=new DW;t._pendingPromise=r;var i=e.preloadTime,a=e.codecType;return i&&(a!==JY||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(o.BitRateAdapter)r=o.BitRateAdapter.getSuitableBitrate(e,n),this.log("Mp4Preloader.BitRateAdapter",r);else{for(var i=0,a=0;a<e.length;a++){if(e[a].definition===t){i=a;break}}r=e[i]}return r||(r=e[0]),r}},{key:"getPreLoadData",value:function(e){var t=this,n=new DW;return this.getItemSameVid(e).then((function(e){if(t.log("getPreLoadData",e.value),e.value){var r=e.value,i=r.mediaSegList,a=r.meta,o=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:o,vtype:y,codecType:v,definition:d,bitrate:r.bitrate,cacheKey:l,duration:f||0,byteLength:h,from:m,meta:a};o===zY.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=TP(wP().mark((function e(t,n){var r,i,a,o,s,u,c,l,d,h,f,p,m,y,v,g,b,A,_=this;return wP().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new DW,i=n.mediaSegList,a=n.meta,o=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:o,definition:s,cacheKey:t,type:u,from:m,meta:a,fileSize:p,bitrate:b},u===zY.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,a&&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===zY.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,a,o){var s=e.mediaSegList;if(e.type===zY.SIZE||-1===i)return e.buffer=KV(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=a||[0,0];return u>-1?(t&&(s[u].buffer=KV(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!==o[1]&&(r=s[u].range[1]>=o[1]),s[u].state=r):(e.duration=l[1],s.push({buffer:t,range:n||[],index:i,totalRange:o||[],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]:jY.MP4,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:BY;if(n){var a=o.generateUniqueKey({vid:e,definition:n,vtype:r,codecType:i});return this.hasItemSameVid(a)?a:null}for(var s=0;s<t.length;s++){var u=o.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,a=e.preloadTime,o=e.definition,s=e.duration,u=e.bitrate,c=e.codecType,l=e.vtype,d=null;if(d="Array"===qD.typeOf(e.url)?e.url.length>1?e.url[1].src:e.url[0].src:e.url){d=qD.extUrl(d,{__vid:r});var h=a>=this.options.segmentMinDuration?this.options.segmentMinDuration:a;this.log("loadByPreloadTime","".concat(e.cacheKey,", definition:").concat(e.definition,",segmentMinDuration:").concat(h),e);var f=qD.getFileSize(u,s);this._mp4=new XW(d,u,_P({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(zY.DURATION,{vid:r,preloadTime:a,definition:o,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=TP(wP().mark((function e(t){var n,r,i,a,o,s,u,c,l,d,h,f,p,m,y,v,g,b=this;return wP().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.vid,r=t.cacheKey,i=t.definition,a=t.duration,o=t.bitrate,s=t.codecType,u=t.vtype,c=this.options,l="Array"===qD.typeOf(t.url)?t.url[0].src:t.url){e.next=6;break}return this._endLoadChunk(),e.abrupt("return");case 6:return l=qD.extUrl(l,{__vid:n}),d=qD.getFileSize(o,a),h=kW(a,8e5,d),this.log("".concat(n,"loadByChunkSize"),t.cacheKey,t.definition,h,t),f=this.getInitCacheData(zY.SIZE,{vid:n,definition:i,cacheKey:r,codecType:s,vtype:u,fileSize:d,bitrate:o||0}),this.MP4Loader=new yW(_P(_P({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=KV(Uint8Array,p,new Uint8Array(e)),m+=e.byteLength),n.meta){b.MP4Loader.cancel();var i=n.meta,a=i.videoSegments,o=i.audioSegments;v=_P(_P({},i.meta),{},{ext:{videoTrak:a,audioTrak:o}}),f.meta=v,f.buffer=p,f.byteLength=p.byteLength,b.setPreLoadData(r,f),y=qD.getFragRange(0,a,o),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=TP(wP().mark((function e(t,n){var r,i,a,o,s,u,c,l;return wP().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.vid,i=t.cacheKey,a=t.buffer,e.prev=1,e.next=4,this.MP4Loader.loadData(n,this.MP4Loader.cache,{});case 4:o=e.sent,this.log("".concat(r," _loadOneChunk"),n,o),s=o.response,(u=o.data)?(this._endLoadChunk(),s&&s.headers&&(c=qD.getFileSize(s.headers))&&(t.fileSize=c),l=KV(Uint8Array,a,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=TP(wP().mark((function e(t,n,r){var i,a,o,s,u,c,l=this;return wP().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(i=n.preloadTime,a=n.vid,console.log("[Preloader] ".concat(a," startLoadByFragments")),o=[],s=0;s<this._mp4.timeRange.length;s++)this._mp4.timeRange[s].startTime<=i&&o.push(s);return u=function(e){l.log("[Preloader] _failedCallback",e),l._endLoadFragments()},c=function(){var e=TP(wP().mark((function e(n){var r,i,a,s,d,h,f,p,m;return wP().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,a=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,a,d,f,p),console.log("[Preloader] ".concat(t.cacheKey," _successCallback"),d,a,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>=o.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 a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o=new DW;return this.getData(e,t,a,!1).then((function(e){r.createFragment(new Uint8Array(e.res),t[0]-r.mdatStart,n,{range:t,context:e.context}).then((function(e){o.resolve(e)}))})),o}},{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:o.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 a=[parseInt(r[2]),parseInt(r[3])],o=[parseInt(i[2]),parseInt(i[3])];if(o[0]>=a[0]&&o[1]>o[0]&&o[1]<=a[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=[],a=[];t._preloadDataList.map((function(t){return t.playerId!==e?i.push(t):a.push(t.data.vid),t})),this.log("cancelLoading",e,a.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=jY.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,a=i.vid,o=i.vtype,s=this.checkIfExistInList(a);console.log("[Preloader] addPreloaderList checkIfExistInList",a,a===t,s),t&&a===t||s||(o||(e[r].data.vtype=jY.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 zY}},{key:"BitRateAdapter",get:function(){return QY},set:function(e){QY=e}},{key:"generateUniqueKey",value:function(e){var t=e.vid,n=e.mediaType,r=e.definition,i=e.codecType,a=e.vtype;return n=n||"video",r=r||"-1",i=i||BY,a=a||jY.MP4,t?"".concat(t,"#").concat(n,"#").concat(i,"#").concat(a,"#").concat(r):null}}]),o}(HY),eK={MEDIA_EXPIRED:"MEDIA_EXPIRED",INIT_FAIL:"INIT_FAIL",PARSE_ERROR:"PARSE_ERROR",PLAYER_LOG:"PLAYER_LOG",BUFFERED_RESET:"BUFFERED_RESET"},tK=lx.left,nK=Ae,rK=Ho;pi({target:"Array",proto:!0,forced:!Ov("reduce")||!rK&&nK>79&&nK<83},{reduce:function(e){var t=arguments.length;return tK(this,e,t,t>1?arguments[1]:void 0)}});var iK=function(){function e(t,n){xP(this,e),this.player=t,this.mediaElem=t.video,this.config=n,this.timer=new IV,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 LP(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&&(AW("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,a=this._getIndex(t,i,r);if(null!==a&&(0!==a||t&&t.length)){var o=t.start(a)+.1;if(!(o>this.mediaElem.duration)){var s=o-i,u=s<=n;s<e.BROWSER_GAP_TOLERANCE||u&&(!0!==this.config.disableGapSetPosition&&(AW("onGapJump this.mediaElem.currentTime"),this.mediaElem.currentTime=this.isSafari?o+.1:o),this.player&&this.player.emit("detectGap"),AW("gapJump gapIndex",a,"isGapSamll",u,"jumpLargeGap",!1,"currentTime",this.mediaElem.currentTime),.08!==o&&this.player&&this.player.emit("log",{type:"oneevent",end_type:"gap",vid:this.player.config.vid,ext:{video_postion:Math.floor(1e3*o)}}))}}}}}},{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,a=0;a<r.length;a++){if(r[a].start>t&&(0===a||r[a-1].end-t<=n)){i=a;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}();iK.BROWSER_GAP_TOLERANCE=.001;var aK="danger_d_speed";var oK=function(){function e(t,n,r,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{logger:function(){},openLog:!1};DX(this,e),this.bitrate=n,this.segment_duration=i||5e3,this.logger=a.logger,this.openLog=a.openLog,this.cdnHost=t.cdnHost,this._loadedPromise=new NX,this._wasmPromise=new NX,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 o=t.progressTimer||1e3,s=this.autoBitrateOpts.startInterval||o;this.initInterval=.8*s,this._prealodMethod=t.preloadmethod||0,this._videoWidth=0,this._videoHeight=0,this._hasDeviceInfoChanged=!0,this.updateMediaInfos(r,!1)}return WX(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},a=JSON.stringify(i);this.module.ccall("parseMPD","null",["string"],[a])}catch(S0){}}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(GV.getItem(aK))||0,this.logger("initSpeed connect",t)}catch(S0){}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(S0){t=null,console.log("getPreloadBitrate",S0)}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(S0){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}();oK.SPPED_CACHE=aK;var sK=pi,uK=Ts,cK=dX,lK=ms,dK=zt,hK=ue,fK=Nd,pK=w,mK=de("Reflect","construct"),yK=Object.prototype,vK=[].push,gK=pK((function(){function e(){}return!(mK((function(){}),[],e)instanceof e)})),bK=!pK((function(){mK((function(){}))})),AK=gK||bK;function _K(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 wK(e){return function(e){if(Array.isArray(e))return _K(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 _K(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)?_K(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 SK(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kK(e,t){return(kK=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function TK(e){return(TK="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 xK(e){return(xK=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}sK({target:"Reflect",stat:!0,forced:AK,sham:AK},{construct:function(e,t){lK(e),dK(t);var n=arguments.length<3?e:lK(arguments[2]);if(bK&&!gK)return mK(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 uK(vK,r,t),new(uK(cK,e,r))}var i=n.prototype,a=fK(hK(i)?i:yK),o=uK(e,a,t);return hK(o)?o:a}});var EK=pi,LK=W,ZK=yr,IK=LL,RK=zC,CK=w,GK=RangeError,PK=String,XK=Math.floor,VK=LK(RK),DK=LK("".slice),MK=LK(1..toFixed),WK=function(e,t,n){return 0===t?n:t%2==1?WK(e,t-1,n*e):WK(e*e,t/2,n)},NK=function(e,t,n){for(var r=-1,i=n;++r<6;)i+=t*e[r],e[r]=i%1e7,i=XK(i/1e7)},OK=function(e,t){for(var n=6,r=0;--n>=0;)r+=e[n],e[n]=XK(r/t),r=r%t*1e7},UK=function(e){for(var t=6,n="";--t>=0;)if(""!==n||0===t||0!==e[t]){var r=PK(e[t]);n=""===n?r:n+VK("0",7-r.length)+r}return n};function FK(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=xK(e);if(t){var i=xK(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===TK(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return SK(e)}(this,n)}}EK({target:"Number",proto:!0,forced:CK((function(){return"0.000"!==MK(8e-5,3)||"1"!==MK(.9,0)||"1.25"!==MK(1.255,2)||"1000000000000000128"!==MK(0xde0b6b3a7640080,0)}))||!CK((function(){MK({})}))},{toFixed:function(e){var t,n,r,i,a=IK(this),o=ZK(e),s=[0,0,0,0,0,0],u="",c="0";if(o<0||o>20)throw GK("Incorrect fraction digits");if(a!=a)return"NaN";if(a<=-1e21||a>=1e21)return PK(a);if(a<0&&(u="-",a=-a),a>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}(a*WK(2,69,1))-69)<0?a*WK(2,-t,1):a/WK(2,t,1),n*=4503599627370496,(t=52-t)>0){for(NK(s,0,n),r=o;r>=7;)NK(s,1e7,0),r-=7;for(NK(s,WK(10,r,1),0),r=t-1;r>=23;)OK(s,1<<23),r-=23;OK(s,1<<r),NK(s,1,1),OK(s,2),c=UK(s)}else NK(s,0,n),NK(s,1<<-t,0),c=UK(s)+VK("0",o);return c=o>0?u+((i=c.length)<=o?"0."+VK("0",o-i)+c:DK(c,0,i-o)+"."+DK(c,i-o)):u+c}});var YK,KK="ABR_CHANGE_A",HK="UPDATE_AUTO_DESC",jK="MAX_BUFFER_CHANGE",BK=0,JK=1,zK=-1,QK=0,qK=1,$K={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"},eH=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&&kK(e,t)}(n,e);var t=FK(n);function n(e,r,i,a,o){var s,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{logger:function(){},openLog:!1};DX(this,n),(s=t.call(this,r,i,a,o,u)).player=e,s.timerId=0,s.isOpenAutoDefi=!!s.autoBitrateOpts.isOpenAutoDefi,s.onPlayrateChange=s._onPlayrateChange.bind(SK(s)),s.onPlay=s._onPlay.bind(SK(s)),s._stop=s.stop.bind(SK(s)),s._bufferRange=new Map,s._sortedBufferRange=[],s._lastCheckResolutionStamp=0,s._currentDefinition=null,s._isSeeking=!1,s._waitingStartTime=0,s._stallCount=0,s._seekState=BK,s._stallState=QK,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(SK(s))},{evt:"addVideoBufferEnd",handler:s._bufferRangeUpdate.bind(SK(s))},{evt:"canplay",handler:s._updateAutoDesc.bind(SK(s))},{evt:"play",handler:s._onplayStart.bind(SK(s))},{evt:jK,handler:s._onMaxBufferChange.bind(SK(s))},{evt:"seeking",handler:s._onSeeking.bind(SK(s))},{evt:"seeked",handler:s._onSeekEnd.bind(SK(s))},{evt:"waiting",handler:s._onWaiting.bind(SK(s))},{evt:"playing",handler:s._onPlaying.bind(SK(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,KX.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($K),l=0;l<c.length;l++){var d=c[l],h=$K[d];s._avgStatItems[h]=new tH}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 WX(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=zK:this._seekState=JK,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=qK}),200))}},{key:"_onPlaying",value:function(){this._waitingStartTime=0,this._stallState=QK,clearTimeout(this._stallId)}},{key:"initFps",value:function(){this.fpsDetection=new KX,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,a=arguments,o=n&&!r;clearTimeout(r),r=setTimeout((function(){r=null,n||e.apply(i,a)}),t),o&&e.apply(i,a)}),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,a=this._sortedBufferRange.length-1,o=null;i<=a;){var s=Math.floor(i+(a-i)/2),u=this._sortedBufferRange[s];if(r<u.start)a=s-1;else{if(!(r>=u.end)){o=u;break}i=s+1}}if(o){var c=this._bitrateToDefitionConfig.get(o.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(HK,{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=wK(this._bufferRange.values());this._sortedBufferRange=n.sort((function(e,t){return e.start-t.start})),this.avgStat($K.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(S0){this.logger("abr: loadeddata error",S0),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(S0){}}},{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=BK,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)},a=this.autoBitrateOpts.noStallCheckTime||5,o=this.openLog;this.logger("openTime:",e,"this.logger",o),this.module._updateSwitchInfo(i.low,i.high,a,o,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(t){this.logger("updatePreloadCacheInfo",t),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(i){this.logger("_updatePreloadInfo err",i)}}},{key:"_loopAbr",value:function(e){var t;this._tickCount++;var n=[];try{this.updateDeviceInfo();var r=this.updateBufferInfo(e),i=r.downloadSpeed,a=r.buffer;t=this.module._getPredictedBitrate(this.bitrate,this._abrMethod);for(var o=0;o<7;o++)n.push(this.module.HEAP32[t/Int32Array.BYTES_PER_ELEMENT+o]);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(a," 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(KK,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(S0){this.logger("abr error",S0),console.log("error",S0)}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($K.PLAYBACK_BITRATE,this._currentItem.bitrate),this.avgStat($K.DOWNLOAD_NETWORK_SPEED,1e3*e*8),this.avgStat($K.PREDICT_NETWORK_SPEED,t),this.avgStat($K.BUFFER_LENGTH,this.bufferLength),this.avgStat($K.QOE,this.getQoeRelValue(0)),n>0&&(this._switchCount++,this._switchBitrate+=n),this._abr_play_info.is_hint){var i=this,a=((new Date).getTime()-this.openTimeMs)/1e3;a=parseFloat(a.toFixed(2)),this._abr_play_info.playback_info.internet_speed_record.push([a,i.downloadSpeed]),this._abr_play_info.playback_info.play_bitrate_record.push([a,i.nowBitrate]),this._abr_play_info.playback_info.buffer_length_record.push([a,i.bufferLength]),this._abr_play_info.playback_info.play_speed_record.push([a,this.player.playbackRate]),this._abr_play_info.playback_info.qoe_record.push([a,this.getQoeRelValue(0)]),this._abr_play_info.playback_info.qoe_a_record.push([a,this.getQoeRelValue(1)]),this._abr_play_info.playback_info.qoe_b_record.push([a,this.getQoeRelValue(2)]),this._abr_play_info.playback_info.qoe_c_record.push([a,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($K),n=0;n<t.length;n++){var r=t[n],i=$K[r],a=this._avgStatItems[i];e[i]=a.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}(oK),tH=function(){function e(){DX(this,e),this.total=0,this.count=0}return WX(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}(),nH="FIXED",rH="AUTO",iH=function(){function e(t,n){var r=this;xP(this,e),ZP(this,"_onAbrChange",(function(e,t,n,i){var a=r._pluginInst.player,o=r.bitrateMap[e],s=r.bitrateMap[t],u=o.definition,c=s&&s.definition?s.definition:u;console.log("[ABR] _onAbrChange ",u,c),u!==c&&(r._abrSwitchHandler(s),a.emit("ABR_CHANGE",{prev:u,cur:c,prevName:o.definitionName,curName:s.definitionName,abrInfo:i}))})),ZP(this,"_onAutoDescChange",(function(e){var t=e.definition,n=e.reset,i=e.fps,a=e.item;r.updateAutoDefiDesc(t,n,i,a)})),this._pluginInst=t;var i=this._pluginInst.config.autoBitrateOpts||{};this.isPlayAutoDefi=eH.getIsPlayAutoDefi(i),this.isOpenAutoDefi=!!i.isOpenAutoDefi,this.isCurrentAutoDefi=this.isOpenAutoDefi&&this.isPlayAutoDefi,this.bitrateMap={},this.defiIdMap={},this._abrSwitchHandler=n}var t;return LP(e,[{key:"_destroyAbr",value:function(){var e=this._pluginInst.player;this.abrInstance&&(e&&e.off(HK,this._onAutoDescChange),this.abrInstance.destroy(),this.abrInstance=null)}},{key:"init",value:(t=TP(wP().mark((function e(t){var n,r,i,a;return wP().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isOpenAutoDefi){e.next=2;break}return e.abrupt("return",{type:nH});case 2:return n=this._pluginInst,r=n.player,i=n.playerConfig,a=n.config,r.on(HK,this._onAutoDescChange),this.bitrateMap={},this.defiIdMap={},this.abrInstance=new eH(r,a,0,{dynamic_video_list:i.definition.list.concat()},5e3,{logger:AW,openLog:gW}),e.next=9,this.abrInstance.init(t);case 9:r.on(KK,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?nH:rH}}},{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,a=i.player,o=(i.config.autoBitrateOpts||{}).autoDefiText||"auto";a.emit("ABR_AUTO_DESC_CHANGE",o,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,a=r.autoBitrateOpts||{},o=i.definition.list,s=!1;if(o.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=a.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(KK,this._onAbrChange),this._destroyAbr()}}]),e}(),aH="real_time_speed",oH=null,sH=null,uH=null,cH=null,lH="h264",dH="h265",hH=0,fH=function(e){IP(i,e);var t,n,r=PP(i);function i(e){var t;return xP(this,i),ZP(GP(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))})),ZP(GP(t),"_retryHook",(function(){var e=GP(t),n=e.player,r=e.playerConfig,i=e.config,a=n.currentTime;if(t.codecType!==dH||i.supportHevc){t._defInited=!1;var o=t.config,s=o.drm,u=o.kid,c=o.secretKey,l=o.keyValue;if(s||u||c||l)t.initAwManager(),t.playerStartInit(r.url);else{if(t.useVideoLoad=!0,"Array"===Xa.typeOf(r.url)){var d=r.url.length;n.video.src=r.url[d-1].src}else n.video.src=r.url;n.currentTime=a,n.play()}}else t.log("h265 retryHook ",r.vid),t._onDegrade("retry");return!1})),ZP(GP(t),"_playHook",(function(e){t._usePaused=!1})),ZP(GP(t),"_pauseHook",(function(e){t._usePaused=!0})),ZP(GP(t),"abrSwitchURL",function(){var e=TP(wP().mark((function e(n){var r,i,a,o,s,u;return wP().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=GP(t),i=r.playerConfig,a=i.definition.list,o=0,s=0;case 4:if(!(s<a.length)){e.next=11;break}if(n.definition!==a[s].definition){e.next=8;break}return o=s,e.abrupt("break",11);case 8:s++,e.next=4;break;case 11:u=t.player.curDefinition,t.changeDefinition(a[o],u,!0);case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),ZP(GP(t),"changeDefineCanPlay",(function(e,n,r,i){var a=GP(t).player;a.ended?a.currentTime=0:(t.log("[oldChangeDefinition],this._changeDefState,",t._changeDefState),a.currentTime=t._changeDefState?t._changeDefState.currentTime:e,(t._changeDefState?t._changeDefState.paused:n)?a.pause():a.play(),t._changeDefState=null,a.emit("after_definition_change",{from:r,to:i}))})),ZP(GP(t),"changeDefinition",(function(e,n,r){var i=GP(t),a=i.player,o=i.playerConfig,s=i.mp4;if(n||(n=a.curDefinition),t.useVideoLoad)return"__auto__"===e.url&&(e.url=a.config.definition.list[0].url),void uH.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<o.definition.list.length;l++)e.definition===o.definition.list[l].definition&&(e.bitrate=o.definition.list[l].bitrate);a.emit(Ha,{from:n,to:e}),setTimeout((function(){t._abrService&&t._abrService.updateAutoDefiDesc(a.curDefinition.definition,!u)})),c&&(e=a.curDefinition),t.log("[switchBitrate:CBS],switch bitRate, ",e.bitrate)}a.curDefinition=e;var d=a.definitionList.filter((function(e){return e.definition===a.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(TP(wP().mark((function n(){var i,u,c,l,d,h;return wP().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(o.url=e.url,o.backupURL=e.backupURL,i=0,u=!1,t._abrService&&t._abrService.isCurrentInAbr()?(c=a.getBufferedRange(a.buffered2),(i=c[1])<a.currentTime&&(i=a.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,",a.currentTime,",bufferRange,",c)):(i=a.currentTime,u=!0),(l=s.getFragmentIdx(i))<0&&(l=t._curLoadSegmentIdx),t.log("switchBitrate:point,",l,",startTime,",s.timeRange[l].startTime,",currentTime,",a.currentTime),u&&a.emit("definitionSwitchTime",s.timeRange[l].startTime+1),t.changeState("changeDefinition",{abr:r,fragIndex:l,startTime:s.timeRange[l].startTime,currentTime:a.currentTime}),!s){n.next=14;break}return n.next=13,s.cancelLoading();case 13:s._metaLoading&&(s._metaLoading=!1);case 14:return!((d=a.getBufferedRange(a.buffered))[1]>0&&d[1]-a.currentTime>5)||t._abrService&&t._abrService.isCurrentInAbr()||(t.mse.clearOpqueues(PV),t.mse.reuse(a.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},a.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})})))})),ZP(GP(t),"_onVideoError",(function(e){t.log("video err,",e)})),ZP(GP(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,",qD.nowTime());var e=GP(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 a=r.getBufferedRange(r.buffered2);a[1]-r.currentTime<i?(r.paused||(r.pause(),t.log("[!!!!!buffer not rich, pause],time,",qD.nowTime(),", currentTime, ",r.currentTime,", bufferEnd,",a[1])),clearTimeout(t.checkResumePlayTimer),t.checkResumePlayTimer=setTimeout(t._onPlaying,i/2*1e3)):r.paused&&(t.log("[!!!!!buffer rich, play],time,",qD.nowTime(),", currentTime, ",r.currentTime,", bufferEnd,",a[1]),clearTimeout(t.checkResumePlayTimer),t.checkResumePlayTimer=null,r.play())}}else t.checkResumePlayTimer>0&&(clearTimeout(t.checkResumePlayTimer),t.checkResumePlayTimer=null,r.paused&&r.play())})),ZP(GP(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()})),ZP(GP(t),"_onError",(function(e){console.log("H265 onError: ".concat(t.playerConfig.vid," "),e,", h265Degrade, ",t.config.h265Degrade),t._onDegrade(e)})),ZP(GP(t),"_onDegrade",(function(e){var n,r,i=GP(t),a=i.player,o=i.playerConfig,s=i.config;a.video.removeEventListener("lowdecode",t._onDegrade),a.video.removeEventListener("error",t._onError),null===(n=t.mp4)||void 0===n||n.destroy();var u=a.currentTime;if(console.log("[h265 degrade], vid,",o.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:lH};(null==o||null===(r=o.H264DefinitionList)||void 0===r?void 0:r.length)>0?(a.config.definition.list=o.H264DefinitionList,a.config.url=o.H264DefinitionList[0].url,a.config.defaultBitrate=o.H264DefinitionList[0].bitrate,a.config.defaultDefinition=o.H264DefinitionList[0].definition,a.playNext(l),a.once("canplay",(function(){a.currentTime=u}))):(console.error("H265 error,degrade h264 but no h264 url"),t.emit("error",e))})),ZP(GP(t),"_onMp4MetaReady",(function(e){console.log(">>>>_onMp4MetaReady",qD.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!==dH||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(s){t.removeAndRejectInitPromise(s),console.error("[Index] ".concat(n," _initEME error"),s);var a=new Ua(t.player,{errorType:"runtime",errorTypeCode:ND.runtime,errorCode:WD.other1,errorMessage:null==s?void 0:s.message,vid:n,mediaError:{code:WD.other1,message:null==s?void 0:s.message}});t._errorHandler(a)}if(t.mp4&&t.mp4.timeRange){var o=[];t.mp4.timeRange.every((function(e){return o.push({startTime:e.startTime,endTime:e.endTime}),!0})),t.emit("KEYFRAMETIME",o)}t._loadData()})),ZP(GP(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)})),ZP(GP(t),"_onMp4Progress",(function(e){t.emit("progress_event",e)})),ZP(GP(t),"_onMp4DataCallBack",(function(){t.mse&&!t.mse.ready&&t.openMSE(),t._isMseInit&&t._onTimeUpdate()})),ZP(GP(t),"_updateDrmConfig",(function(e){var n=GP(t),r=n.config,i=n.mp4;e.kid&&r.keyValue?r.drm={clearKeys:ZP({},e.kid,r.keyValue)}:!e.kid&&r.keyValue&&(r.useEME=!1),i.useEME=r.useEME;var a=r.drm;r.useEME||(i.kidValue=r.keyValue||(a&&a.clearKeys?a.clearKeys[Object.keys(a.clearKeys)[0]]:null)),t.eme&&a&&a.clearKeys&&r.useEME&&t.eme.updateDrm(a)})),ZP(GP(t),"_onVideoTimeUpdate",(function(){t.useVideoLoad||null!==t._requestTimer||!t._offineLine&&t._startProgress(),t.useVideoLoad&&t.checkIfCanPreload()})),ZP(GP(t),"_onBufferedReset",(function(e){t.mp4&&t.mp4.videoTrak&&t.mp4.resetFragmentLoadState(0)})),ZP(GP(t),"_onOnlineHandler",(function(){t._offineLine=!1;var e=GP(t).config;t.log("online useVideoLoad:",t.useVideoLoad,t._hasStartProgressBack),t.useVideoLoad?t.player.src=e._mainURL:(t._hasStartProgressBack&&t._startProgress(),t._hasStartProgressBack=!1)})),ZP(GP(t),"_onOfflineHandler",(function(){t._offineLine=!0,t.log("offline, ",t._hasStartProgress),t._hasStartProgress&&(t._stopProgress(),t._hasStartProgressBack=!0)})),ZP(GP(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=qD.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,a=e.videoTrack,o=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(PV,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&&(a&&a.samples.length>0||o&&o.samples.length>0)){var l=a.samples.length>0?a.samples[0].sampleOffset:-1,d=a.samples.length>0?a.samples[a.samples.length-1].sampleOffset:-1,h=o.samples.length>0?o.samples[0].sampleOffset:-1,f=o.samples.length>0?o.samples[o.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(a,o)}}catch(m){t.changeState("APPEND_DATA_ERROR"),t.log("appendBuffer error",m);var p=new Ua(t.player,{errorType:"runtime",errorTypeCode:ND.runtime,errorCode:WD.mse,vid:t.player.config.vid,errorMessage:m.message,mediaError:{code:WD.mse,message:m.message}});t._errorHandler(p)}}})),ZP(GP(t),"_onWaiting",(function(){var e=GP(t),n=e.player,r=e.config,i=e.playerConfig;clearTimeout(t._waitInBufferTimer),t._waitInBufferTimer=null;var a=n.currentTime;console.log("[>>>>onWaiting],currentTime, ",a,qD.nowTime());var o=n.bufferedPoint;o.end>0&&o.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,",a,qD.nowTime())}),r.waitingInBufferTimeOut):t._errorHandler(new Ua(t.player,{errorType:"waitInBuffer",errorTypeCode:ND.runtime,errorCode:WD.onWaitInBufferRange,errorMessage:"onWait_in_buffer",vid:i.vid})))})),ZP(GP(t),"_onEnded",(function(){t.log("[player.onEnded], stopProgress"),t.player&&t.off("waiting",t._onWaiting),t._stopProgress()})),ZP(GP(t),"_onReplay",(function(){var e=GP(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)}))})),ZP(GP(t),"_onSeeking",TP(wP().mark((function e(){var n,r,i,a,o,s,u,c,l,d,h;return wP().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=GP(t),r=n.player,i=n.mp4,a=r.currentTime,t.changeState("seeking",{curTime:a}),t.log("[seekTime], curTime,",a,",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,o=r.bufferedPoint,s=!1,u=0,!(o.end>0)){e.next=23;break}if(s=!0,u=i.getFragmentIdx(o.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=o.end,u<0&&(u=t._curLoadSegmentIdx),t.log("[seeking in buffered range], seekTime ",a,",bufferRange,",o.start,"-",o.end,", fragIndex,",u);case 23:return s||(i.seekTime=a,(u=i.getFragmentIdx(a))<0&&(u=t._curLoadSegmentIdx),t.log("[seekTime out buffer range], curTime,",a,", Idx,",u),c=GP(t),(l=c.mse)&&l.isFull()&&(d=r.buffered2.bufferedList,h=d[d.length-1],l.clearOpqueues(PV),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 DW,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=qD.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():lH,t.playerConfig.vtype&&(t._vtype=t.playerConfig.vtype.toUpperCase()),t.firstFrameTime={newplayer:qD.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=qD.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 LP(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,OV.isSupported('video/mp4; codecs="avc1.64001E, mp4a.40.5"')&&(void 0===n.supportHevc&&null!=Wa&&Wa.isHevcSupported&&null!=Wa&&Wa.isHevcSupported()&&this.player.video instanceof HTMLVideoElement&&(n.supportHevc=!0),CU()||(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=NW),!t.videoEventMiddleware&&r.setEventsMiddleware(OW)),this.gapJumpInst=new iK(this.player,this.playerConfig),this.preloader=n.isOpenPreload?new $Y(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(eK.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=qD.nowTime(),e.codecType!==dH||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===lH?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,a=0;a<n.length&&(r=n.start(a),i=n.end(a),!(r<=e.video.currentTime&&e.video.currentTime<=i));a++);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||(qa.defineGetterOrSetter(e,{__url:{get:function(){return t.mse?t.mse.url:e.config.url},configurable:!0},downloadSpeed:{get:function(){return hH/8},configurable:!0},playerVersion:{get:function(){return MD},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,a,o,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!==(a=t.mp4)&&void 0!==a&&a.timeRange?t.mp4.timeRange[t._curLoadSegmentIdx]:{},waitIdx:t.debugInfo.loadIndx,waitTimeRange:null!==(o=t.mp4)&&void 0!==o&&o.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=oH,this.player._startInit=sH,this.player.changeDefinition=uH,this.player.switchURL=cH,this._unbindNetworkStateChange(),e.video&&e.video.removeEventListener(eK.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 LN(t.cdnHost,t.cdnBucket));var n=new DW;if(n.id="aw",this._awPromise=n,t.isEncrypt){var r=new FW;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&&(oH=this.player.playNext),this.player.playNext=function(){e.playNext.apply(e,arguments)},sH=this.player._startInit,cH=this.player.switchURL,uH=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,a=t.definitionList;return a&&a.length>0&&(a.map((function(t){var n=$Y.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=XW.speed,(i=this.getDefinitonFromAdapter(a,r.userSelectDefinition))&&(i.type="bitRateAdapter"))),i&&i.url||(i="Array"===Xa.typeOf(r.url)&&r.url.length>0||"String"===Xa.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"}:a[a.length-1]),this.playerConfig.url=i.url,i.networkSpeed=XW.speed,i.fileSize=qD.getFileSize(i.bitrate,r.duration),t.curDefinition=i,i}},{key:"_setPlayerSrc",value:function(e){var t=this.player;this._removeVideoSource(),"Array"===Xa.typeOf(e)?(t.video.removeAttribute("src"),!t._detachSourceEvents&&e.forEach((function(e){t.video.appendChild(Xa.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 a=e.curDefinition.bitrate;if(!a)for(var o=0;o<t.definition.list.length;o++){var s=t.definition.list[o];s.definition===e.curDefinition.definition&&(a=s.bitrate)}this._abrService.updateBitrate(a)}},{key:"_initAbrService",value:(n=TP(wP().mark((function e(){var t,n;return wP().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 iH(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=qD.nowTime()-this.firstFrameTime.newplayer,this.log("[===========], initMp4Kernel,",qD.nowTime());var t=this.playerConfig,n=this.config,r=new DW;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===lH||n.supportHevc))return this.useVideoLoad=!0,r.reject("forceVideoPlay"),r;var a=[];a.push(this._getLicense()),a.push(this._checkPreloader()),Promise.all(a).then((function(t){e.isDestroy&&r.reject(new Error("destroy"));var a=null;if(t&&t.length>0&&t[1]&&(a=t[1].data),a||!n.needPreloadCheck||e.codecType===dH&&!n.supportHevc)if(e._vtype&&"MP3"===e._vtype)e.useVideoLoad=!0,r.reject(new Error("vtype_not_MP4"));else{var o=n._mainURL;e._initMp4(o,a,{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(o){r.reject(o)}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)sH.call(this.player,e);else{this.player.mp4MseFlag=!0,this.bufferEndTime=-1,this._tm=(new Date).getTime(),this._reset();var a=this.playerConfig.vid;this.preloader&&this.preloader.cancelPreloadByVid(a),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(a," 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(a," isDestroy:").concat(t.isDestroy," _initPromise.isBreak:").concat(r),n),-499897!==n.errorCode){var i=n;i.errorCode||((i=new Ua(t.player,{errorType:"runtime",errorTypeCode:ND.runtime,errorCode:WD.other,vid:t.playerConfig.vid,errorMessage:null==n?void 0:n.message,mediaError:{code:WD.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===dH&&"Array"===Xa.typeOf(e)&&(e=e[0].src),t.log("_initMp4Kernel.finally:isDestroy".concat(t.isDestroy," _initPromise.isBreak:").concat(n)),t.log("[===========], playerStartInit,",qD.nowTime()),t.changeState("PLAY_INIT_FINALLY"),!t.isDestroy&&!n&&sH.call(t.player,e)}}))}})).catch((function(n){t.log("_awPromise.error",n),t.changeState("PLAY_INIT_CATCH"),!t.isDestroy&&sH.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():lH;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=Xa.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,a=this.playerConfig;i.emit(Ha,{from:t,to:e}),i.emit("waiting");var o=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),o.length>0){(e=o[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,a.url=e.url,a.backupURL=e.backupURL,a.userSelectDefinition=e.definition,a.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(a.url)}}},{key:"switchURL",value:function(e){if(this.useVideoLoad)cH.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"===Xa.typeOf(e))t=e,r.backupURL&&i.push(r.backupURL);else if("Array"===Xa.typeOf(e)&&e.length>0&&(t=e[0].src,e.length>1))for(var a=1;a<e.length;a++)i.push(qD.extUrl(e[a].src,{__vid:r.vid}));return!(!t&&0===i.length)&&(n._mainURL=qD.extUrl(t,{__vid:r.vid}),n._backupURL=i,!0)}},{key:"_firstFrameTime",value:function(){if(this.codecType===lH||this.config.supportHevc){if(this.firstFrameTime.new_loadeddata<0){this.firstFrameTime.loadst_loadeddata=qD.nowTime()-this.loadstart,this.firstFrameTime.new_loadeddata=qD.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===dH){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 a=0;a<n.bootStats.length;a++)this.firstFrameTime[n.bootStats[a].action]=n.bootStats[a].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=qD.nowTime());var n=qD.nowTime()-this._pTime,r=qD.nowTime()-this._sTime;this.log(">>>changeState[".concat(e,"]"),n,r,t),this.states.push({state:e,t1:n,t2:r,data:t}),this._pTime=qD.nowTime();var i=qD.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 a=(t?e.getBufferedRange(e.buffered):e.getBufferedRange(e.buffered2))[1]-i;e.currentTime>=r&&(a>0||Math.abs(a)<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,a=new DW,o={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 DW;if(n){AW("[getKeyValue]>before openBox");var a=r.awManager.openBox(n);if(AW("[getKeyValue]>after openBox: ",a),t){var o={clearKeys:{}};o.clearKeys[t]=a,i.resolve(o)}else i.resolve(a)}else{var s=WW(e,t,r.config.getLicenseUrl);s.id="requestPromise",r._addPendingPromise(s),s.then((function(e){if(r._removePendingPromise(s),r.awManager){AW("[getKeyValue]>before openBox");var n=r.awManager.openBox(e);AW("[getKeyValue]>after openBox: ",n);var a={clearKeys:{}};a.clearKeys[t]=n,i.resolve(a)}else i.reject({errDes:"awManager not exist, player destroyed"}),AW("[getKeyValue]>awManager not exist, player destroyed")})).catch((function(e){i.reject(e),AW("[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,o.success=1,a.resolve(o)})).catch((function(t){e.log("licensePromise reject"),o.success=0,o.error=t,a.reject(o)}))}else o.success=0,a.resolve(o);return a}},{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=qD.nowTime()-this.firstFrameTime.newplayer-this.firstFrameTime.newplayer_initkernel;var i=this.config,a=this.player,o=this.playerConfig;this.mp4&&(this.mp4.off(IW,this._onMp4MetaReady),this.mp4.off(ZW,this._onMp4Error),this.mp4.off(GW,this._updateDrmConfig),this.mp4.off(CW,this._onMp4Progress),this.mp4.off(RW,this._onMp4DataCallBack),this.mp4.destroy(),this.mp4=null),this.changeState("MP4_NEW",{}),this.mp4=new XW(e,a.curDefinition.bitrate,{segmentDuration:i.segmentMinDuration,enableWorker:i.enableWorker,codecType:this.codecType,chunkSize:i.preloadSize,loadSize:800,duration:o.duration||0,fileSize:r.fileSize||0,playerId:this.playerId,vid:o.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(IW,this._onMp4MetaReady),this.mp4.on(ZW,this._onMp4Error),this.mp4.on(GW,this._updateDrmConfig),this.mp4.on(CW,this._onMp4Progress),this.mp4.on(RW,this._onMp4DataCallBack),this.mp4.on(PW,(function(e){t.player&&t.player.emit("initialUrl",{url:e})})),this.mp4.MP4Loader.on(aH,(function(e){hH=e.speed,t.debugInfo.speed||(t.debugInfo.speed=[]),t.debugInfo.speed.push(hH),t.debugInfo.speed.length>10&&t.debugInfo.speed.shift(),t.emit(aH,e)})),this.changeState("MP4_INIT",{}),this.mp4.init(n)}},{key:"_checkPreloader",value:function(){var e=this,t=this.playerConfig,n=new DW,r={method:"checkPreloader",success:0,type:"error",cacheKey:""};this.changeState("CHECK_PRELOAD");var i=this.player.curDefinition,a=i.cacheKey?i.cacheKey:$Y.generateUniqueKey({vid:t.vid,definition:i.definition||"",vtype:t.vtype,codecType:t.codecType});return r.cacheKey=a,this.preloader&&a?this.preloader.getPreLoadData(a).then((function(t){console.log(">>>>check Preloader result",a,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:a}),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 a=r.drm;!this.eme&&a&&a.clearKeys&&r.useEME&&(this.eme=new UW(a)),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,a=!!e.audioCodec,o=ZP({},PV,{mimeType:"video/mp4",codec:i&&a?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 OV(n.mediaType,this.log.bind(this)),this.mse.on(WV,(function(e){t.firstFrameTime.initmse_sbopen=e.costtime,t._loadStartEventTime>0&&(t.firstFrameTime.mseopen=qD.nowTime()-t._loadStartEventTime),t.changeState("MSE_OPEN")})),this.mse.on(NV,(function(e){t.firstFrameTime.initmse_sbopendone=e.costtime,t.changeState("MSE_OPEN_DONE"),t._isMseInit=!0,t._onTimeUpdate()})),this.mse.on(DV,(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 Ua(t.player,{errorType:"runtime",errorTypeCode:ND.runtime,errorCode:WD.mseAppend,errorMessage:e.message,vid:n.vid,mediaError:{code:WD.mseAppend,message:e.message}});t._errorHandler(i)}})),this.mse.on(MV,(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(o)}},{key:"_appendInitSeg",value:function(e){this.mp4&&this.mse&&(this.changeState("MSE_INITSEG"),this.log("[=======ready_append_init]",qD.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(PV,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:WD.metaError,errorMessage:"meta is null",errorType:"demux",errorTypeCode:ND.demux},new Ua(this.player,_P(_P({},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;AW("_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]",qD.nowTime()),e._onSourceOpen(),this.log("[=======主动调用_onSourceOpen, end ]",qD.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,a=this.playerConfig.vid;this.log("player appendBuffer start ==>>>",a,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:a,fragIndex:n.fragIndex,range:n.range,dataLen:t.byteLength,state:r})}},{key:"_loadData",value:(t=TP(wP().mark((function e(){return wP().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=qD.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,a=0,o=0;o<i.length;o++)if(i[o].bitrate===r){a=i[o];break}return a}},{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 Ua(e.player,{errorType:"runtime",errorTypeCode:ND.runtime,errorCode:WD.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 a=n.start(i)-.5,o=n.end(i)+.5;if(a<=e.startTime&&e.endTime<=o){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 a=r.getBufferedRange(r.buffered2);if((t||this.mseProxy)&&n&&n.canDownload){qD.nowTime()-this._lastCheckTime>1e3&&(this._lastCheckTime=qD.nowTime(),this._loadStuckCheck(),this._startUrlExpiredCheck(),this._checkRemoveSourceBuffer(a,r.currentTime));var o=r.paused?r.currentTime+this._minBufferLength:r.currentTime+this._maxBufferLength;a[1]-o<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, ",a[1],",playCurTime,",r.currentTime,", bufferLen,",a[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=qD.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(IW,this._onMp4MetaReady),this.mp4.off(ZW,this._onMp4Error),this.mp4.off(GW,this._updateDrmConfig),this.mp4.off(CW,this._onMp4Progress),this.mp4.off(RW,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?qD.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"!==SP(e)){var i={};i.err=e,e=i}var a=t.paused;e.vid=n.vid,e.preloadHit=r&&r.byteLength>0?1:0,e.preloadCached=r?r.duration:0,e=new Ua(t,e),this.log("_errorHandle","preState is ".concat(a),e),!e.url&&(e.url=t.src),this.player.vtype="MP4_2",this.player.emit("playCatch",this.player.vtype,e),e.errd&&"object"===SP(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===dH?(console.log("h265 err,degrade use 264 play",r.vid),this._onDegrade(e)):this.codecType===lH&&(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 XU((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(S0){this.log("unloadVideo error",S0)}}},{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(eK.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,a=this.mse,o=this.mp4,s=this.player;if(a&&o&&s&&(n&&(clearTimeout(this._removeBufferTimer),this._removeBufferTimer=null),e||(e=s.getBufferedRange(s.buffered2)),t||(t=s.currentTime),!(!n&&qD.nowTime()-this._checkRemoveBufferLastTime<=this.config.removeBufferLen||this.endofstream)&&(this._checkRemoveBufferLastTime=qD.nowTime(),e&&e[0]>=0&&(t-e[0]>this.config.removeBufferLen||a.isFull())))){var u=r?e[1]:t-(a.isFull()?0:15),c=o.getFragmentIdx(u);if(c>=0&&(r||o.timeRange[c].startTime<t)){var l=Math.floor(Math.min(o.timeRange[c].startTime,e[1]));e[0]<l?(this.log("[checkremoveSourceBuffer], remove range==>>>",e[0],l),a.reuse(e[0],l)):a.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,a=this.config;if(t===this.playerConfig.vid&&n===a.kid&&r){this.playerConfig.url=r,this._handlerUrl(r);var o=a._mainURL;return this.useVideoLoad?i.src=r:this.mp4&&this.mp4.update(o),!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),a=1;a<r;a++)i[a-1]=arguments[a];AW.apply(void 0,[n].concat(i))}},{key:"_emitInitFail",value:function(e){this.log("initFail, reason:",e),this.emit(eK.INIT_FAIL,e)}},{key:"emitParseError",value:function(){this.log("parseError"),this.emit(eK.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(XW.speed,10)}},{key:"version",get:function(){return MD}},{key:"realTimeSpeed",get:function(){return hH}},{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(XP(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 OD("network",WD[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=jY.MP4,$Y.BitRateAdapter=t,new $Y(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 hH}},{key:"realTimeSpeed",get:function(){return hH}},{key:"version",get:function(){return MD}}]),i}(qa);function pH(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 mH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pH(Object(n),!0).forEach((function(t){wH(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pH(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function yH(){yH=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:{},a=i.iterator||"@@iterator",o=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 a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new T(i||[]);return r(o,"_invoke",{value:_(e,n,s)}),o}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,a,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,a)&&(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,a,o,s){var u=l(e[r],e,a);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,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,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 a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):a:(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[a];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,o,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new A(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(g),u(g,s,"Generator"),u(g,a,(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 o.type="throw",o.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 a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.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 a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},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 vH(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(S0){return void n(S0)}s.done?t(u):Promise.resolve(u).then(r,i)}function gH(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){vH(a,r,i,o,s,"next",e)}function s(e){vH(a,r,i,o,s,"throw",e)}o(void 0)}))}}function bH(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function AH(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,LH(r.key),r)}}function _H(e,t,n){return t&&AH(e.prototype,t),n&&AH(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function wH(e,t,n){return(t=LH(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SH(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&&TH(e,t)}function kH(e){return(kH=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function TH(e,t){return(TH=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function xH(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function EH(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=kH(e);if(t){var i=kH(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 xH(e)}(this,n)}}function LH(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 ZH(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 IH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ZH(Object(n),!0).forEach((function(t){MH(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZH(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function RH(){RH=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:{},a=i.iterator||"@@iterator",o=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 a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new T(i||[]);return r(o,"_invoke",{value:_(e,n,s)}),o}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,a,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,a)&&(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,a,o,s){var u=l(e[r],e,a);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,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,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 a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):a:(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[a];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,o,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new A(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(g),u(g,s,"Generator"),u(g,a,(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 o.type="throw",o.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 a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.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 a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},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 CH(e){return(CH="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 GH(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(S0){return void n(S0)}s.done?t(u):Promise.resolve(u).then(r,i)}function PH(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){GH(a,r,i,o,s,"next",e)}function s(e){GH(a,r,i,o,s,"throw",e)}o(void 0)}))}}function XH(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VH(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,QH(r.key),r)}}function DH(e,t,n){return t&&VH(e.prototype,t),n&&VH(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function MH(e,t,n){return(t=QH(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function WH(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&&OH(e,t)}function NH(e){return(NH=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function OH(e,t){return(OH=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function UH(){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 FH(e,t,n){return(FH=UH()?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&&OH(i,n.prototype),i}).apply(null,arguments)}function YH(e){var t="function"==typeof Map?new Map:void 0;return YH=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 FH(e,arguments,NH(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),OH(r,e)},YH(e)}function KH(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function HH(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jH(e){var t=UH();return function(){var n,r=NH(e);if(t){var i=NH(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 HH(e)}(this,n)}}function BH(){return BH="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=NH(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}},BH.apply(this,arguments)}function JH(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 zH(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 JH(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)?JH(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 a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function QH(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)}fH.isSupported=function(){return PU()&&GU()&&!RU()},fH.isEMESupported=CU,fH.isSupportedWithXgmse=function(){return GU()&&!RU()},fH.isMediaSourceSupported=PU,fH.isWebAssemblySupported=GU,fH.getPlayLicenses=WW,fH.CUSTOM_EVENTS=eK,fH.Mp4Preloader=$Y;var qH="network",$H="network_timeout",ej="network_forbidden",tj="network_notfound",nj="network_range_not_satisfiable",rj="demux",ij="remux",aj="media",oj="drm",sj="other",uj="runtime",cj=(MH(YK={},"manifest",{HLS:1100,DASH:1200}),MH(YK,qH,2100),MH(YK,$H,2101),MH(YK,ej,2103),MH(YK,tj,2104),MH(YK,nj,2116),MH(YK,rj,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),MH(YK,ij,{FMP4:4100,MP4:4200}),MH(YK,aj,{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}),MH(YK,oj,{LICENSE:7100,CUSTOM_LICENSE:7200}),MH(YK,sj,8e3),MH(YK,uj,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002,WAITING_TIMEOUT_ERROR:9003}),YK),lj=function(e){WH(n,e);var t=jH(n);function n(e,r,i,a,o){var s;return XH(this,n),(s=t.call(this,o||(null==i?void 0:i.message))).errorType=e===$H?qH:e,s.originError=i,s.ext=a,s.errorCode=cj[e][r]||cj[e],s.errorMessage=s.message,s.errorCode||(s.errorType=sj,s.errorCode=cj[s.errorType]),s}return DH(n,null,[{key:"create",value:function(e,t,r,i,a){return e instanceof n?e:(e instanceof Error&&(r=e,e=""),e||(e=sj),new n(e,t,r,i,a))}},{key:"network",value:function(e){var t;return new n(null!=e&&e.isTimeout?$H:qH,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}(YH(Error)),dj={DEBUG:1,LOG:2,WARN:3,ERROR:4},hj=["Boolean","Number","String","Undefined","Null","Date","Object"],fj=function(){function e(t,n){XH(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 DH(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,[dj.DEBUG].concat(r)),e.disabled||(t=console).debug.apply(t,[this._prefix,pj()].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,[dj.LOG].concat(r)),e.disabled||(t=console).log.apply(t,[this._prefix,pj()].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,[dj.WARN].concat(r)),e.disabled||(t=console).warn.apply(t,[this._prefix,pj()].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,[dj.ERROR].concat(r)),e.disabled||(t=console).error.apply(t,[this._prefix,pj()].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 a=r.map((function(e){return yj(e)}));t=this._prefix+pj()+JSON.stringify(a)}catch(s){return}if(e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var o=this.logTextArray.shift();this.logSize-=o.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 pj(){return(new Date).toLocaleString()}function mj(e){if("object"!==CH(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 yj(e,t,n){n||(n=1),t||(t=2);var r={};if(!e||"object"!==CH(e))return e;var i=Object.prototype.toString.call(e).slice(8,-1);if(!hj.includes(i))return i;if(!(n>t)){for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n===t?r[a]=mj(e[a]):"object"===CH(e[a])?r[a]=yj(e[a],t,n+1):r[a]=e[a]);return r}}MH(fj,"disabled",!0);var vj="fetch",gj="xhr",bj="arraybuffer",Aj="text",_j="json",wj=function(e){WH(n,e);var t=jH(n);function n(e,r,i,a){var o;return XH(this,n),MH(HH(o=t.call(this,a)),"retryCount",0),MH(HH(o),"isTimeout",!1),MH(HH(o),"loaderType",vj),MH(HH(o),"startTime",0),MH(HH(o),"endTime",0),MH(HH(o),"options",{}),o.url=e,o.request=r,o.response=i,o}return DH(n)}(YH(Error)),Sj=Object.prototype.toString;function kj(e){if("[object Object]"!==Sj.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function Tj(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 xj(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ej(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]"===Sj.call(n)?t=t.toISOString():function(e){return null!==e&&"object"===CH(e)}(t)&&(t=JSON.stringify(t)),"".concat(xj(e),"=").concat(xj(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 Lj(e,t,n,r,i,a,o,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:a,firstByteTime:o,endTime:Date.now(),priOptions:l},response:n}}function Zj(e,t){return Math.round(8*e*1e3/t/1024)}var Ij="error",Rj="core.ttfb",Cj="core.loadstart",Gj="core.loadresponseheaders",Pj="core.loadcomplete",Xj="core.loadretry",Vj="core.metadataparsed",Dj="real_time_speed",Mj=2097152,Wj=function(e){WH(r,e);var t,n=jH(r);function r(){var e;return XH(this,r),MH(HH(e=n.call(this)),"_abortController",null),MH(HH(e),"_timeoutTimer",null),MH(HH(e),"_reader",null),MH(HH(e),"_response",null),MH(HH(e),"_aborted",!1),MH(HH(e),"_index",-1),MH(HH(e),"_range",null),MH(HH(e),"_receivedLength",0),MH(HH(e),"_running",!1),MH(HH(e),"_logger",null),MH(HH(e),"_vid",""),MH(HH(e),"_onProcessMinLen",0),MH(HH(e),"_onCancel",null),MH(HH(e),"_priOptions",null),e}return DH(r,[{key:"load",value:function(e){var t,n=this,r=e.url,i=e.vid,a=e.timeout,o=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=Ej(r,p);var Z=Tj(d);Z&&(v=f?f.headers:E.headers=E.headers||(Headers?new Headers:{}),Headers&&v instanceof Headers?v.append("Range",Z):v.Range=Z),a&&(this._timeoutTimer=setTimeout((function(){if(L=!0,n.cancel(),c){var e=new wj(r,E,null,"timeout");e.isTimeout=!0,c(e,{index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions})}}),a));var I=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=PH(RH().mark((function i(a){var c,l,f,p;return RH().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(n._timeoutTimer),n._response=a,!n._aborted&&n._running){i.next=4;break}return i.abrupt("return");case 4:if(h&&(a=h(a,r)||a),a.ok){i.next=7;break}throw new wj(r,E,a,"bad network response");case 7:if(c=Date.now(),o!==Aj){i.next=15;break}return i.next=11,a.text();case 11:l=i.sent,n._running=!1,i.next=37;break;case 15:if(o!==_j){i.next=22;break}return i.next=18,a.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(a,s,I,c),i.abrupt("return");case 29:return i.next=31,a.arrayBuffer();case 31:l=i.sent,l=new Uint8Array(l),n._running=!1,f=Date.now()-I,p=Zj(l.byteLength,f),n.emit(Dj,{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(Lj(l,!0,a,a.headers.get("Content-Length"),a.headers.get("age"),I,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 wj?e:new wj(r,E,null,null===(i=e)||void 0===i?void 0:i.message)).startTime=I,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=PH(RH().mark((function e(){return RH().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(S0){}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 a=new wj(e.url,"",e,"onProgress of bad response.body.getReader");return a.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(a)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(Mj),this._writeIdx=0);var o,s,u,c=this._reader=e.body.getReader(),l=function(){var a=PH(RH().mark((function a(){var d,h,f,p,m,y,v,g;return RH().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return s=Date.now(),a.prev=1,a.next=4,c.read();case 4:o=a.sent,u=Date.now(),a.next=13;break;case 8:return a.prev=8,a.t0=a.catch(1),u=Date.now(),i._aborted||(i._running=!1,a.t0.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i.reject(a.t0)),a.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){a.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),a.abrupt("return");case 19:p=o.value?o.value.byteLength:0,i._receivedLength+=p,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",f,", end,",h+i._receivedLength,", done,",o.done),i._onProcessMinLen>0?i._writeIdx+p>=i._onProcessMinLen||o.done?((m=new Uint8Array(i._writeIdx+p)).set(i._cache.slice(0,i._writeIdx),0),p>0&&m.set(o.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",o.done,",len,",m.byteLength,", writeIdx,",i._writeIdx)):p>0&&i._writeIdx+p<Mj?(i._cache.set(o.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(o.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=o.value,(m&&m.byteLength>0||o.done)&&t(m,o.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),o.done?(v=Date.now()-n,g=Zj(i._receivedLength,v),i.emit(Dj,{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,",o.done),i.resolve(Lj(o,!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 a.stop()}}),a,null,[[1,8]])})));return function(){return a.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}(Za);var Nj=function(e){WH(n,e);var t=jH(n);function n(){var e;return XH(this,n),MH(HH(e=t.call(this)),"_xhr",null),MH(HH(e),"_aborted",!1),MH(HH(e),"_timeoutTimer",null),MH(HH(e),"_range",null),MH(HH(e),"_receivedLength",0),MH(HH(e),"_url",null),MH(HH(e),"_onProgress",null),MH(HH(e),"_index",-1),MH(HH(e),"_headers",null),MH(HH(e),"_currentChunkSizeKB",384),MH(HH(e),"_timeout",null),MH(HH(e),"_xhr",null),MH(HH(e),"_withCredentials",null),MH(HH(e),"_startTime",-1),MH(HH(e),"_loadCompleteResolve",null),MH(HH(e),"_loadCompleteReject",null),MH(HH(e),"_runing",!1),MH(HH(e),"_logger",!1),MH(HH(e),"_vid",""),MH(HH(e),"_responseType",void 0),MH(HH(e),"_credentials",void 0),MH(HH(e),"_method",void 0),MH(HH(e),"_transformResponse",void 0),MH(HH(e),"_firstRtt",void 0),MH(HH(e),"_onCancel",null),MH(HH(e),"_priOptions",null),e}return DH(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=Ej(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 wj?e:new wj(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===bj&&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 a=new wj(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));a.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(a)},n.ontimeout=function(e){t.cancel();var n=new wj(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=Tj(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(a){a.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(a)}}},{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 wj(this._url,null,IH(IH({},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,a=null,o=!1,s=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===bj){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=Zj(this._receivedLength,l);this.emit(Dj,{speed:d,len:this._receivedLength,time:l,vid:this._vid,index:this._index,range:[i,s+this._receivedLength],priOptions:this._priOptions})}a=c,o=!((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,",o)}else o=!0,a=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(a,o,{index:this._index,vid:this._vid,range:[i,s+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},h),o?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(Lj(this._onProgress?null:a,o,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,BH(NH(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=zH(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(a){r.e(a)}finally{r.f()}return n}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),n}(Za),Oj=["retry","retryDelay","onRetryError","transformError"],Uj=function(){function e(t,n){var r,i,a;XH(this,e),this.promise=((a=new Promise((function(e,t){r=e,i=t}))).used=!1,a.resolve=function(){return a.used=!0,r.apply(void 0,arguments)},a.reject=function(){return a.used=!0,i.apply(void 0,arguments)},a),this.alive=!!n.onProgress,!n.logger&&(n.logger=new fj("Loader")),this._loaderType=t,this._loader=t===vj&&window.fetch?new Wj:new Nj,this._config=n,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=n.retryCheckFunc,this._logger=n.logger}var t;return DH(e,[{key:"exec",value:function(){var e=this,t=this._config,n=t.retry,r=t.retryDelay,i=t.onRetryError,a=t.transformError,o=KH(t,Oj),s=function(){var t=PH(RH().mark((function t(){var u,c,l;return RH().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(o);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,a&&(c=a(c)||c),i&&e._retryCount>0&&i(c,e._retryCount,{index:o.index,vid:o.vid,range:o.range,priOptions:o.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,",o.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=PH(RH().mark((function e(){return RH().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 Fj(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var Yj=function(e){WH(r,e);var t,n=jH(r);function r(e){var t;return XH(this,r),MH(HH(t=n.call(this,e)),"type",vj),MH(HH(t),"_queue",[]),MH(HH(t),"_alive",[]),MH(HH(t),"_currentTask",null),MH(HH(t),"_config",void 0),t._config=function(e){return IH({loaderType:vj,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:Aj,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!==gj&&Wj.isSupported()||(t.type=gj),t.log=e.logger,t}return DH(r,[{key:"isFetch",value:function(){return this.type===vj}},{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&&kj(n.headers)&&(n.headers=Object.assign({},n.headers)),n.body&&kj(n.body)&&(n.body=Object.assign({},n.body)),n.transformRequest&&(n=n.transformRequest(n)||n),n.logger=this.log;var r=new Uj(this.type,n);return r.loader.on(Dj,(function(e){t.emit(Dj,e)})),this._queue.push(r),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),r.promise}},{key:"cancel",value:(t=PH(RH().mark((function e(){var t;return RH().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,Fj();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 Wj.isSupported()}}]),r}(Za),Kj="core.rtcstatechange",Hj={},jj={},Bj={exports:{}},Jj=Bj.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(Jj).forEach((function(e){Jj[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}));var zj=Bj.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 a=e.push?{}:i?n[e.name]:n;!function(e,n,r,i){if(i&&!r)n[i]=t(e[1]);else for(var a=0;a<r.length;a+=1)null!=e[a+1]&&(n[r[a]]=t(e[a+1]))}(r.match(e.reg),a,e.names,e.name),e.push&&n[e.push].push(a)},r=zj,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},a=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(a.push({rtp:[],fmtp:[]}),o=a[a.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,o,i)}})),t.media=a,t};var a=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(a,{})},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(a,{})}))},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}}))}))}}(jj);var Qj=zj,qj=/%[sdv%]/g,$j=function(e){var t=1,n=arguments,r=n.length;return e.replace(qj,(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""}}))},eB=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 a=t.names[i];t.name?r.push(n[t.name][a]):r.push(n[t.names[i]])}else r.push(n[t.name]);return $j.apply(null,r)},tB=["v","o","s","i","u","e","p","c","b","t","r","z","a"],nB=["i","c","b","a"],rB=jj,iB=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||tB,r=t.innerOrder||nB,i=[];return n.forEach((function(t){Qj[t].forEach((function(n){n.name in e&&null!=e[n.name]?i.push(eB(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){i.push(eB(t,n,e))}))}))})),e.media.forEach((function(e){i.push(eB("m",Qj.m[0],e)),r.forEach((function(t){Qj[t].forEach((function(n){n.name in e&&null!=e[n.name]?i.push(eB(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){i.push(eB(t,n,e))}))}))}))})),i.join("\r\n")+"\r\n"};Hj.write=iB,Hj.parse=rB.parse,Hj.parseParams=rB.parseParams,Hj.parseFmtpConfig=rB.parseFmtpConfig,Hj.parsePayloads=rB.parsePayloads,Hj.parseRemoteCandidates=rB.parseRemoteCandidates,Hj.parseImageAttributes=rB.parseImageAttributes,Hj.parseSimulcastStreamList=rB.parseSimulcastStreamList;var aB=new fj("rts"),oB=function(e){SH(i,e);var t,n,r=EH(i);function i(e){var t;return bH(this,i),wH(xH(t=r.call(this)),"_url",""),wH(xH(t),"_pc",null),wH(xH(t),"_audioTransceicer",null),wH(xH(t),"_videoTransceicer",null),wH(xH(t),"_mediaStream",null),wH(xH(t),"_media",null),wH(xH(t),"_opts",null),wH(xH(t),"_loader",null),wH(xH(t),"_retry",0),wH(xH(t),"_waitingTimer",0),wH(xH(t),"_rctConnectStartTs",0),wH(xH(t),"_onTrack",(function(e){if(aB.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)})),wH(xH(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))})),wH(xH(t),"_onLoadedData",(function(){aB.log("loadeddata emit"),t.getStatsSnapshoot().then((function(e){t.emit(Vj,{type:"video",elapsed:Date.now()-t._rctConnectStartTs,meta:e.video}),t.emit(Vj,{type:"audio",elapsed:Date.now()-t._rctConnectStartTs,meta:e.audio})}))})),wH(xH(t),"_onLoaderRetry",(function(e,n){t.emit(Xj,{error:lj.network(e),retryTime:n})})),t._opts=function(e){return mH({retryCount:0,retryDelay:1e3,loadTimeout:5e3,stallInterval:400,delayHint:0},e)}(e),t._media=t._opts.media,t._loader=new Yj(mH(mH({},e.fetchOptions),{},{responseType:"json",method:"POST",retry:t._opts.retryCount,retryDelay:t._opts.retryDelay,timeout:t._opts.loadTimeout,onRetryError:t._onLoaderRetry,logger:aB})),t._retry=t._opts.retryCount,t._bindMediaEvent(),t}return _H(i,[{key:"pc",get:function(){return this._pc}},{key:"audioTrack",get:function(){return this._audio}},{key:"videoTack",get:function(){return this._video}},{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,a,o,s,u,c,l,d,h,f,p,m,y,v,g,b,A,_,w,S,k,T,x,E,L,Z,I=null==e?void 0:e.filter((function(e){return"video"===e.type}))[0],R=null==e?void 0:e.filter((function(e){return"audio"===e.type}))[0];return{video:I?{codec:null===(t=I.codec)||void 0===t?void 0:t.mimeType,payloadType:null===(n=I.codec)||void 0===n?void 0:n.payloadType,sdpFmtpLine:null===(r=I.codec)||void 0===r?void 0:r.sdpFmtpLine,bytesReceived:null===(i=I.inboundRtp)||void 0===i?void 0:i.bytesReceived,firCount:null===(a=I.inboundRtp)||void 0===a?void 0:a.firCount,pliCount:null===(o=I.inboundRtp)||void 0===o?void 0:o.pliCount,frameHeight:null===(s=I.inboundRtp)||void 0===s?void 0:s.frameHeight,frameWidth:null===(u=I.inboundRtp)||void 0===u?void 0:u.frameWidth,framesDecoded:null===(c=I.inboundRtp)||void 0===c?void 0:c.framesDecoded,framesDropped:null===(l=I.inboundRtp)||void 0===l?void 0:l.framesDropped,framesPerSecond:null===(d=I.inboundRtp)||void 0===d?void 0:d.framesPerSecond,framesReceived:null===(h=I.inboundRtp)||void 0===h?void 0:h.framesReceived,jitter:null===(f=I.inboundRtp)||void 0===f?void 0:f.jitter,jitterBufferDelay:null===(p=I.inboundRtp)||void 0===p?void 0:p.jitterBufferDelay,keyFramesDecoded:null===(m=I.inboundRtp)||void 0===m?void 0:m.keyFramesDecoded,nackCount:null===(y=I.inboundRtp)||void 0===y?void 0:y.nackCount,packetsLost:null===(v=I.inboundRtp)||void 0===v?void 0:v.packetsLost,packetsReceived:null===(g=I.inboundRtp)||void 0===g?void 0:g.packetsReceived}:void 0,audio:R?{codec:null===(b=R.codec)||void 0===b?void 0:b.mimeType,payloadType:null===(A=R.codec)||void 0===A?void 0:A.payloadType,sdpFmtpLine:null===(_=R.codec)||void 0===_?void 0:_.sdpFmtpLine,bytesReceived:null===(w=R.inboundRtp)||void 0===w?void 0:w.bytesReceived,audioLevel:null===(S=R.inboundRtp)||void 0===S?void 0:S.audioLevel,jitter:null===(k=R.inboundRtp)||void 0===k?void 0:k.jitter,jitterBufferDelay:null===(T=R.inboundRtp)||void 0===T?void 0:T.jitterBufferDelay,packetsLost:null===(x=R.inboundRtp)||void 0===x?void 0:x.packetsLost,packetsReceived:null===(E=R.inboundRtp)||void 0===E?void 0:E.packetsReceived,totalSamplesDuration:null===(L=R.inboundRtp)||void 0===L?void 0:L.totalSamplesDuration,totalSamplesReceived:null===(Z=R.inboundRtp)||void 0===Z?void 0:Z.totalSamplesReceived}:void 0}}(e)}))}},{key:"load",value:(n=gH(yH().mark((function e(t){var n,r=this;return yH().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(lj.create(sj,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(aB.warn("onconnectionstatechange:",t.connectionState),e.emit(Kj,{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(lj.network(new Error("rtc connect failed")));e._retry--,e.load(e._url)}"connected"===t.connectionState&&e.emit(Rj,{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=gH(yH().mark((function e(){var t,n,r,i,a,o,s,u,c,l,d,h;return yH().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 aB.log("local offer"),aB.log(n.sdp),(i=Hj.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=Hj.write(i),aB.log("local offer modified:\n",n.sdp),e.next=22,t.setLocalDescription(n);case 22:return e.prev=22,s=/_?session_id=([^&$]+)/.exec(this._url),u=s?s[1]:Date.now()+"",this.emit(Cj,{url:this._url,offersdp:n.sdp,sessionId:u}),c=Date.now(),e.next=29,this._loader.load(this._url,{body:JSON.stringify({sessionId:u,version:"1.0-html",localSdp:n})});case 29:if(l=e.sent,this.emit(Gj,{headers:l.response.headers}),200===(null==(d=null==l?void 0:l.data)?void 0:d.code)){e.next=34;break}throw new Error("code: ".concat(null==d?void 0:d.code,", message:").concat(null==d?void 0:d.message));case 34:return aB.log("answer:"),aB.log(null===(a=d.remoteSdp)||void 0===a?void 0:a.sdp),this.emit(Pj,{url:this._url,elapsed:Date.now()-c,answersdp:null===(o=d.remoteSdp)||void 0===o?void 0:o.sdp}),(h=Hj.parse(d.remoteSdp.sdp)).media.forEach((function(e){e.fingerprint.hash=e.fingerprint.hash.toUpperCase()})),d.remoteSdp.sdp=Hj.write(h),aB.log("answer modified:\n",d.remoteSdp.sdp),this._rctConnectStartTs=Date.now(),e.next=44,this._pc.setRemoteDescription(d.remoteSdp);case 44:e.next=49;break;case 46:e.prev=46,e.t0=e.catch(22),this._emitError(lj.network(e.t0));case 49:case"end":return e.stop()}}),e,this,[[22,46]])}))),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(Ij,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(){fj.enable()}},{key:"disableLogger",value:function(){fj.disable()}}]),i}(Za);try{localStorage.getItem("xgd")?oB.enableLogger():oB.disableLogger()}catch(S0){}function sB(){return!(!window.RTCPeerConnection||!window.RTCPeerConnection.prototype.addTransceiver)}var uB=function(e){SH(r,e);var t,n=EH(r);function r(){var e;bH(this,r);for(var t=arguments.length,i=new Array(t),a=0;a<t;a++)i[a]=arguments[a];return wH(xH(e=n.call.apply(n,[this].concat(i))),"_rts",null),wH(xH(e),"_rtsOpts",null),wH(xH(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 oB(mH({media:e.player.video},r)),e._rts.load(n.url)})),wH(xH(e),"_onSwitchURL",(function(t){e._rts&&(e.player.config.url=t,e._rts.switchURL(t))})),e}return _H(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:"version",get:function(){return"0.2.0-alpha.3"}},{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(Ka,this._onSwitchURL),this.on(Ya,this.destroy),this._transErrorEvent(),this._transCoreEvent(Cj),this._transCoreEvent(Pj),this._transCoreEvent(Rj),this._transCoreEvent(Gj),this._transCoreEvent(Xj),this._transCoreEvent(Vj),this._transCoreEvent(Kj);try{qa.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(Ij,(function(t){if(e.player){var n=new Ua(e.player,t),r=e._rtsOpts,i=r.backupConstruct,a=r.backupURL;if(a){var o,s=e.player;s.emit("core_event",mH(mH({},{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!==(o=s.video)&&void 0!==o&&o.srcObject&&(s.video.srcObject=null),s.config.url=a,i?s.registerPlugin(i).beforePlayerInit():s.video.src=a}else e.player.emit(Fa,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",mH(mH({},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 sB()}},{key:"getCapacity",value:function(){return function(){if(!sB())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,a;aB.log(t.sdp);var o=Hj.parse(t.sdp),s=null===(n=o.media)||void 0===n?void 0:n.filter((function(e){return"video"===e.type}))[0],u=null===(r=o.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===(a=u.rtp)||void 0===a?void 0:a.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=gH(yH().mark((function e(t){var n,i,a,o,s;return yH().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,a=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,a=null===(o=s.video)||void 0===o?void 0:o.filter((function(e){return"H264"===e.codec&&(!t||-1!==e.config.indexOf(t))})).length;case 10:return e.abrupt("return",!!a);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}(qa);function cB(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 lB(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?cB(Object(n),!0).forEach((function(t){gB(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cB(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function dB(){dB=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:{},a=i.iterator||"@@iterator",o=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 a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new T(i||[]);return r(o,"_invoke",{value:_(e,n,s)}),o}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,a,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,a)&&(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,a,o,s){var u=l(e[r],e,a);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,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,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 a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):a:(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[a];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,o,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new A(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(g),u(g,s,"Generator"),u(g,a,(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 o.type="throw",o.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 a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.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 a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},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 hB(e){return(hB="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 fB(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(S0){return void n(S0)}s.done?t(u):Promise.resolve(u).then(r,i)}function pB(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){fB(a,r,i,o,s,"next",e)}function s(e){fB(a,r,i,o,s,"throw",e)}o(void 0)}))}}function mB(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yB(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,LB(r.key),r)}}function vB(e,t,n){return t&&yB(e.prototype,t),n&&yB(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function gB(e,t,n){return(t=LB(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bB(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&&_B(e,t)}function AB(e){return(AB=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _B(e,t){return(_B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function wB(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function SB(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=AB(e);if(t){var i=AB(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 wB(e)}(this,n)}}function kB(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,a,o,s=[],u=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=a.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&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}(e,t)||xB(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 TB(e){return function(e){if(Array.isArray(e))return EB(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||xB(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 xB(e,t){if(e){if("string"==typeof e)return EB(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)?EB(e,t):void 0}}function EB(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 LB(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 ZB(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function IB(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 RB(e,t,n){return t&&IB(e.prototype,t),n&&IB(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function CB(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GB(e){return(GB=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function PB(e,t){return(PB=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function XB(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 VB(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=GB(e);if(t){var i=GB(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return XB(this,n)}}function DB(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,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(u){s=!0,i=u}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||WB(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 MB(e){return function(e){if(Array.isArray(e))return NB(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||WB(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 WB(e,t){if(e){if("string"==typeof e)return NB(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)?NB(e,t):void 0}}function NB(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 OB="video",UB="audio",FB="metadata",YB="avc",KB="hevc",HB="aac",jB="g7110a",BB="g7110m",JB="LARGE_AV_SHIFT",zB="LARGE_VIDEO_GAP",QB="LARGE_VIDEO_GAP_BETWEEN_CHUNK",qB="LARGE_AUDIO_GAP",$B="AUDIO_FILLED",eJ="AUDIO_DROPPED",tJ=function(){function e(){ZB(this,e),CB(this,"id",1),CB(this,"type",OB),CB(this,"codecType",YB),CB(this,"pid",-1),CB(this,"hvcC",void 0),CB(this,"codec",""),CB(this,"timescale",0),CB(this,"formatTimescale",0),CB(this,"sequenceNumber",0),CB(this,"baseMediaDecodeTime",0),CB(this,"baseDts",0),CB(this,"duration",0),CB(this,"warnings",[]),CB(this,"samples",[]),CB(this,"pps",[]),CB(this,"sps",[]),CB(this,"vps",[]),CB(this,"fpsNum",0),CB(this,"fpsDen",0),CB(this,"sarRatio",[]),CB(this,"width",0),CB(this,"height",0),CB(this,"nalUnitSize",4),CB(this,"present",!1),CB(this,"isVideoEncryption",!1),CB(this,"isAudioEncryption",!1),CB(this,"isVideo",!0),CB(this,"kid",null),CB(this,"pssh",null),CB(this,"ext",void 0)}return RB(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}(),nJ=function(){function e(){ZB(this,e),CB(this,"id",2),CB(this,"type",UB),CB(this,"codecType",HB),CB(this,"pid",-1),CB(this,"codec",""),CB(this,"sequenceNumber",0),CB(this,"sampleDuration",0),CB(this,"timescale",0),CB(this,"formatTimescale",0),CB(this,"baseMediaDecodeTime",0),CB(this,"duration",0),CB(this,"warnings",[]),CB(this,"samples",[]),CB(this,"baseDts",0),CB(this,"sampleSize",16),CB(this,"sampleRate",0),CB(this,"channelCount",0),CB(this,"objectType",0),CB(this,"sampleRateIndex",0),CB(this,"config",[]),CB(this,"present",!1),CB(this,"isVideoEncryption",!1),CB(this,"isAudioEncryption",!1),CB(this,"kid",null),CB(this,"ext",void 0)}return RB(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===HB)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}}]),e}(),rJ=function(){function e(t,n,r){ZB(this,e),CB(this,"flag",{}),CB(this,"keyframe",!1),CB(this,"gopId",0),CB(this,"duration",0),CB(this,"size",0),CB(this,"units",[]),CB(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=n,r&&(this.units=r)}return RB(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}(),iJ=RB((function e(t,n,r,i){ZB(this,e),CB(this,"duration",1024),CB(this,"flag",{dependsOn:2,isNonSyncSample:0}),CB(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=n,this.size=n.byteLength,this.sampleOffset=i,r&&(this.duration=r)})),aJ=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&&PB(e,t)}(n,e);var t=VB(n);function n(){return ZB(this,n),t.apply(this,arguments)}return RB(n)}(RB((function e(t,n){ZB(this,e),CB(this,"time",0),this.data=t,this.originPts=this.pts=n}))),oJ=function(){function e(){ZB(this,e),CB(this,"id",3),CB(this,"type",FB),CB(this,"timescale",0),CB(this,"flvScriptSamples",[]),CB(this,"seiSamples",[])}return RB(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}(),sJ=function(){function e(t){ZB(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]")}return RB(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}();CB(sJ,"disabled",!0);var uJ="undefined"!=typeof window,cJ=uJ&&navigator.userAgent.toLocaleLowerCase(),lJ=uJ&&/^((?!chrome|android).)*safari/.test(cJ),dJ=uJ&&cJ.includes("firefox"),hJ=uJ&&cJ.includes("android"),fJ=function(){function e(){ZB(this,e)}return RB(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 a=i,o=[],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]),o.push({pts:n+y*v,data:t.subarray(i+7+c,i+l)}),y++,i+=l}else i++;return{skip:a,remaining:i>=r?void 0:t.subarray(i),frames:o,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,a=e.FREQ[r];if(a){var o=e._getConfig(r,i,n);return{samplingFrequencyIndex:r,sampleRate:a,objectType:n,channelCount:i,config:o.config,codec:o.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,a=[];return dJ?e>=6?(r=5,i=e-3):(r=2,i=e):hJ?(r=2,i=e):(r=2===n||5===n?n:5,i=e,e>=6?i=e-3:1===t&&(r=2,i=e)),a[0]=r<<3,a[0]|=(14&e)>>1,a[1]=(1&e)<<7,a[1]|=t<<3,5===r&&(a[1]|=(14&i)>>1,a[2]=(1&i)<<7,a[2]|=8,a[3]=0),{config:a,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 pJ(){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}CB(fJ,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var mJ=Math.pow(2,32);function yJ(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function vJ(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 gJ(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return vJ(e,t)*mJ+vJ(e,t+4)}function bJ(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 AJ(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 _J=function(){function e(){ZB(this,e)}return RB(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=[],a=0;a+t<r;)if(n=vJ(e,a),3===t&&(n>>>=8),a+=t,n){if(a+n>r)break;i.push(e.subarray(a,a+n)),a+=n}return i}}},{key:"parseSEI",value:function(e,t){for(var n=e.length,r=t?2:1,i=0,a=0,o="";255===e[r];)i+=255,r++;for(i+=e[r++];255===e[r];)a+=255,r++;if(a+=e[r++],5===i&&n>r+16)for(var s=0;s<16;s++)o+=e[r].toString(16),r++;return{payload:e.subarray(r),type:i,size:a,uuid:o}}},{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,a=new Uint8Array(i),o=0;for(r=0;r<i;o++,r++)o===n[0]&&(o++,n.shift()),a[r]=e[o];return a}}]),e}(),wJ=function(){function e(t){if(ZB(this,e),CB(this,"_bytesAvailable",void 0),CB(this,"_bitsAvailable",0),CB(this,"_word",0),!t)throw new Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}return RB(e,[{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}(),SJ=function(){function e(){ZB(this,e)}return RB(e,null,[{key:"parseAVCDecoderConfigurationRecord",value:function(t){if(!(t.length<7)){for(var n,r,i=1+(3&t[4]),a=[],o=[],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,a.push(l),n||(n=e.parseSPS(_J.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&&(o.push(t.subarray(s,s+d)),s+=d);return{sps:n,spsArr:a,ppsArr:o,nalUnitSize:i}}}},{key:"parseSPS",value:function(e){var t=new wJ(e);t.readUByte();var n=t.readUByte(),r=t.readUByte(),i=t.readUByte();t.skipUEG();var a=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 o=t.readUEG();if(o<=3&&(a=[0,420,422,444][o]),3===o&&t.skipBits(1),t.skipUEG(),t.skipUEG(),t.skipBits(1),t.readBool())for(var s=3!==o?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:bJ(e.subarray(1,4)),profileIdc:n,profileCompatibility:r,levelIdc:i,chromaFormat:a,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}(),kJ=function(){function e(){ZB(this,e)}return RB(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,a,o,s,u=1+(3&t[21]),c=[],l=[],d=[],h=23,f=t[22],p=0;p<f;p++){a=63&t[h],o=t[h+1]<<8|t[h+2],h+=3;for(var m=0;m<o;m++)if(s=t[h]<<8|t[h+1],h+=2,s){switch(a){case 32:var y=t.subarray(h,h+s);r||(r=e.parseVPS(_J.removeEPB(y),n)),d.push(y);break;case 33:var v=t.subarray(h,h+s);i||(i=e.parseSPS(_J.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 wJ(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 wJ(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 a=n.chromaFormatIdc=r.readUEG(),o=420;a<=3&&(o=[0,420,422,444][a]);var s=0;3===a&&(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!==a&&2!==a||0!==s?1:2)*(c+u),f-=(1===a&&0===s?2:1)*(d+l));return{codec:"hev1.1.6.L93.B0",width:h,height:f,chromaFormat:o,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);for(var a=[],o=[],s=0;s<t;s++)a[s]=e.readBits(1),o[s]=e.readBits(1);t>0&&e.readBits(2*(8-t));for(var u=0;u<t;u++)0!==a[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!==o[u]&&e.readBits(8)}}]),e}(),TJ=9e4,xJ=45e4,EJ=9e4,LJ=function(){function e(t,n,r){ZB(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 RB(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,a=this.audioTrack,o=i.samples,s=a.samples;if(o.length||s.length){var u=o[0],c=s[0],l=0;if(o.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)>EJ&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=t)}if(this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(a),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),a.samples.length&&(a.baseMediaDecodeTime=a.samples[0].pts*a.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,a,o=n.length,s=0,u=n[0],c=n[1],l=this._videoNextDts-u.dts;if(Math.abs(l)>45e3)u.dts+=l,u.pts+=l,e.warnings.push({type:QB,nextDts:this._videoNextDts,firstSampleDts:u.dts,nextSampleDts:null===(i=n[1])||void 0===i?void 0:i.dts,sampleDuration:l}),c&&Math.abs(c.dts-u.dts)>EJ&&(this._videoTimestampBreak=!0,n.forEach((function(e,t){0!==t&&(e.dts+=l,e.pts+=l)})));if(e.fpsNum&&e.fpsDen)a=e.timescale*(e.fpsDen/e.fpsNum);else{var d=e.samples[0],h=e.samples[o-1];a=1===o?9e3:Math.floor((h.dts-d.dts)/(o-1))}for(var f=0;f<o;f++){var p=n[f].dts,m=n[f+1];if((s=f<o-1?m.dts-p:n[f-1]?Math.min(p-n[f-1].dts,a):a)>EJ||s<0){this._videoTimestampBreak=!0,s=this._audioTimestampBreak?a:Math.max(s,2700);var y=this._audioNextPts||0;m&&m.dts>y&&(s=a),e.warnings.push({type:zB,time:p/e.timescale,dts:p,originDts:n[f].originDts,nextDts:this._videoNextDts,sampleDuration:s,refSampleDuration:a})}n[f].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,a=1/0;n.length&&(e.baseDts=i=n[0].pts),r.length&&(t.baseDts=a=r[0].dts),this._baseDts=Math.min(i,a);var o=a-i;return Number.isFinite(o)&&Math.abs(o)>45e3&&t.warnings.push({type:JB,videoBaseDts:a,audioBasePts:i,baseDts:this._baseDts,delta:o}),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=fJ.getFrameDuration(e.timescale,n));var r=e.sampleDuration;if(void 0===this._audioNextPts){var i=t[0];this._audioNextPts=i.pts}for(var a=0;a<t.length;a++){var o=this._audioNextPts,s=t[a],u=s.pts-o;if(!this._audioTimestampBreak&&u>=3*r&&u<=TJ&&!lJ){var c=fJ.getSilentFrame(e.codec,e.channelCount)||t[0].data.subarray(),l=Math.floor(u/r);Math.abs(s.pts-this._lastAudioExceptionGapDot)>xJ&&(this._lastAudioExceptionGapDot=s.pts),e.warnings.push({type:$B,pts:s.pts,originPts:s.originPts,count:l,nextPts:o,refSampleDuration:r});for(var d=0;d<l;d++){var h=new iJ(Math.floor(o),c);h.originPts=Math.floor(this._baseDts+o),t.splice(a,0,h),this._audioNextPts+=r,a++}a--}else u<=-3*r&&u>=-9e4?(Math.abs(s.pts-this._lastAudioExceptionOverlapDot)>xJ&&(this._lastAudioExceptionOverlapDot=s.pts,e.warnings.push({type:eJ,pts:s.pts,originPts:s.originPts,nextPts:o,refSampleDuration:r})),t.splice(a,1),a--):(Math.abs(u)>=TJ&&(this._audioTimestampBreak=!0,Math.abs(s.pts-this._lastAudioExceptionLargeGapDot)>xJ&&(this._lastAudioExceptionLargeGapDot=s.pts,e.warnings.push({type:qB,time:s.pts/1e3,pts:s.pts,originPts:s.originPts,nextPts:o,sampleDuration:u,refSampleDuration:r}))),s.dts=s.pts=o,this._audioNextPts+=r)}}}]),e}(),ZJ=new sJ("TsDemuxer"),IJ=function(){function e(t,n,r){ZB(this,e),CB(this,"_pmtId",-1),CB(this,"_remainingPacketData",null),CB(this,"_videoPesData",[]),CB(this,"_audioPesData",[]),CB(this,"_gopId",0),this.videoTrack=t||new tJ,this.audioTrack=n||new nJ,this.metadataTrack=r||new oJ,this._fixer=new LJ(this.videoTrack,this.audioTrack,this.metadataTrack)}return RB(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,a=this.metadataTrack;t&&(this._pmtId=-1,i.reset(),r.reset(),a.reset()),!n||t?(this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[]):(i.samples=[],r.samples=[],a.seiSamples=[],i.warnings=[],r.warnings=[],this._remainingPacketData&&(e=pJ(this._remainingPacketData,e),this._remainingPacketData=null));var o=e.length,s=o%188;s&&(this._remainingPacketData=e.subarray(o-s),o-=s);for(var u=i.pid,c=r.pid,l=0;l<o;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=YB,i.pid=u=m;break;case 36:if(-1!==u)break;i.codecType=KB,i.pid=u=m;break;default:ZJ.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:ZJ.warn("Unknown pid: ".concat(h))}}return this._parseVideoData(),this._parseAudioData(),r.formatTimescale=i.formatTimescale=i.timescale=a.timescale=9e4,r.timescale=r.sampleRate||0,{videoTrack:i,audioTrack:r,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:"_parseVideoData",value:function(){if(this._videoPesData.length){var t=e._parsePES(pJ.apply(void 0,MB(this._videoPesData)));if(t){var n=_J.parseAnnexB(t.data);n?this._createVideoSample(n,t.pts,t.dts):ZJ.warn("Cannot parse avc units",t),this._videoPesData=[]}else ZJ.warn("Cannot parse video pes",this._videoPesData)}}},{key:"_createVideoSample",value:function(e,t,n){var r=this;if(e.length){var i=this.videoTrack,a=i.codecType===KB,o=new rJ(t,n);e.forEach((function(e){var n=a?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(!a&&5!==n||a&&5===n)break;o.setToKeyframe(),r._gopId++;break;case 6:case 39:case 40:if(!a&&6!==n||a&&6===n)break;return void r.metadataTrack.seiSamples.push(new aJ(_J.parseSEI(_J.removeEPB(e),a),t));case 32:if(!a)break;if(!i.vps.length){var s=kJ.parseVPS(_J.removeEPB(e),i.hvcC);i.hvcC=i.hvcC||s,i.vps=[e]}break;case 7:case 33:if(!a&&7!==n||a&&7===n)break;if(!i.sps.length){var u=_J.removeEPB(e),c=a?kJ.parseSPS(u,i.hvcC):SJ.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(!a&&8!==n||a&&8===n)break;i.pps.length||(i.pps=[e])}o.units.push(e)})),o.gopId=this._gopId,this._pushVideoSample(i,o)}}},{key:"_pushVideoSample",value:function(e,t){if(t.units.length)if(null===t.pts||void 0===t.pts){ZJ.warn("Video sample no pts",t);var n=e.samples[e.samples.length-1];n?(t.pts=n.pts,t.dts=n.dts):ZJ.warn("Drop video sample",t)}else e.samples.push(t)}},{key:"_parseAudioData",value:function(){if(this._audioPesData.length){var t=e._parsePES(pJ.apply(void 0,MB(this._audioPesData)));t?(this._parseAacData(t),this._audioPesData=[]):ZJ.warn("Cannot parse audio pes",this._audioPesData)}}},{key:"_parseAacData",value:function(e){var t=this.audioTrack,n=e.pts;if(null==n){if(ZJ.warn("AAC pes not pts",t),!t.samples.length||!t.sampleRate)return;n=t.samples[t.samples.length-1].pts+fJ.getFrameDuration(t.sampleRate)}var r,i=fJ.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,MB(i.frames.map((function(e){return new iJ(e.pts,e.data)})))),i.skip&&ZJ.warn("Skip aac adts ".concat(i.skip," bits")),i.remaining&&ZJ.warn("Remaining aac adts ".concat(i.remaining," bits"))):ZJ.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,a=e[7];return 192&a&&(r=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&a?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}(),RJ=function(){function e(){ZB(this,e)}return RB(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 a=0,o="",s=0;t.length>7;){if(a=vJ(t),o=String.fromCharCode.apply(null,t.subarray(4,8)),s=8,1===a?(a=gJ(t,8),s+=8):a||(a=t.length),!n[0]||o===n[0]){var u=t.subarray(0,a);if(!(n.length<2))return e.findBox(u.subarray(s),n.slice(1),r+s);i.push({start:r,size:a,headerSize:s,type:o,data:u})}r+=a,t=t.subarray(a)}return i}},{key:"tfhd",value:function(e){return XJ(e,!0,(function(e,t){e.trackId=vJ(t);var n=4,r=1&e.flags,i=2&e.flags,a=8&e.flags,o=16&e.flags,s=32&e.flags;r&&(n+=4,e.baseDataOffset=vJ(t,n),n+=4),i&&(e.sampleDescriptionIndex=vJ(t,n),n+=4),a&&(e.defaultSampleDuration=vJ(t,n),n+=4),o&&(e.defaultSampleSize=vJ(t,n),n+=4),s&&(e.defaultSampleFlags=vJ(t,n))}))}},{key:"sidx",value:function(e){return XJ(e,!0,(function(e,t){var n=0;e.reference_ID=vJ(t,n),n+=4,e.timescale=vJ(t,n),n+=4,0===e.version?(e.earliest_presentation_time=vJ(t,n),n+=4,e.first_offset=vJ(t,n),n+=4):(e.earliest_presentation_time=gJ(t,n),n+=8,e.first_offset=gJ(t,n),n+=8),n+=2,e.references=[];var r=yJ(t,n);n+=2;for(var i=0;i<r;i++){var a={};e.references.push(a);var o=vJ(t,n);n+=4,a.reference_type=o>>31&1,a.referenced_size=2147483647&o,a.subsegment_duration=vJ(t,n),o=vJ(t,n+=4),n+=4,a.starts_with_SAP=o>>31&1,a.SAP_type=o>>28&7,a.SAP_delta_time=268435455&o}}))}},{key:"moov",value:function(t){return XJ(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 XJ(e,!0,(function(e,t){var n=0;1===e.version?(e.timescale=vJ(t,16),e.duration=gJ(t,20),n+=28):(e.timescale=vJ(t,8),e.duration=vJ(t,12),n+=16),e.nextTrackId=vJ(t,n+76)}))}},{key:"trak",value:function(t){return XJ(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 XJ(e,!0,(function(e,t){var n=0;1===e.version?(e.trackId=vJ(t,16),e.duration=gJ(t,24),n+=32):(e.trackId=vJ(t,8),e.duration=vJ(t,16),n+=20),e.width=vJ(t,n+52),e.height=vJ(t,n+56)}))}},{key:"mdia",value:function(t){return XJ(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 XJ(e,!0,(function(e,t){var n=0;1===e.version?(e.timescale=vJ(t,16),e.duration=gJ(t,20),n+=28):(e.timescale=vJ(t,8),e.duration=vJ(t,12),n+=16);var r=yJ(t,n);e.language=String.fromCharCode(96+(r>>10&31),96+(r>>5&31),96+(31&r))}))}},{key:"hdlr",value:function(e){return XJ(e,!0,(function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}},{key:"minf",value:function(t){return XJ(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 XJ(e,!0,(function(e,t){e.graphicsmode=yJ(t),e.opcolor=[yJ(t,2),yJ(t,4),yJ(t,6)]}))}},{key:"smhd",value:function(e){return XJ(e,!0,(function(e,t){e.balance=yJ(t)}))}},{key:"stbl",value:function(t){return XJ(t,!1,(function(t,n,r){var i,a,o;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===(a=i.sinf)||void 0===a||null===(o=a.schi)||void 0===o?void 0:o.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 XJ(e,!0,(function(e,n){var r=0,i=vJ(n,r);r+=4,e.samples=[];for(var a=0;a<i;a++){for(var o={InitializationVector:[]},s=0;s<t;s++)o.InitializationVector[s]=n[r+s];if(r+=t,2&e.flags){o.subsamples=[];var u=yJ(n,r);r+=2;for(var c=0;c<u;c++){var l={};l.BytesOfClearData=yJ(n,r),r+=2,l.BytesOfProtectedData=vJ(n,r),r+=4,o.subsamples.push(l)}}e.samples.push(o)}}))}},{key:"pssh",value:function(e){return XJ(e,!0,(function(e,t){for(var n=[],r=[],i=0,a=0;a<16;a++)r.push(VJ(t[i+a]));if(i+=16,e.version>0){var o=vJ(t,i);i+=4;for(var s=0;s<(""+o).length;s++)for(var u=0;u<16;u++){var c=t[i];i+=1,n.push(VJ(c))}}var l=vJ(t,i);e.data_size=l,i+=4,e.kid=n,e.system_id=r,e.buffer=t}))}},{key:"stsd",value:function(t){return XJ(t,!0,(function(t,n,r){t.entryCount=vJ(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 XJ(t,!1,(function(t,n,r){t.channelCount=yJ(n,16),t.samplesize=yJ(n,18),t.sampleRate=vJ(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 XJ(t,!1,(function(t,n,r){t.width=yJ(n,24),t.height=yJ(n,26),t.horizresolution=vJ(n,28),t.vertresolution=vJ(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 XJ(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(VJ(t[n])),n+=1}))}},{key:"schi",value:function(t){return XJ(t,!1,(function(t,n,r){t.tenc=e.tenc(e.findBox(n,["tenc"],r)[0])}))}},{key:"sinf",value:function(t){return XJ(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 XJ(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 XJ(t,!1,(function(t,n,r){var i=GJ(t,n),a=n.subarray(i);r+=i,t.avcC=e.avcC(e.findBox(a,["avcC"],r)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],r)[0])}))}},{key:"avcC",value:function(e){return XJ(e,!1,(function(e,t){e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=bJ([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=yJ(t,n);n+=2,e.sps.push(t.subarray(n,n+i)),n+=i}e.ppsLength=t[n],n+=1,e.pps=[];for(var a=0;a<e.ppsLength;a++){var o=yJ(t,n);n+=2,e.pps.push(t.subarray(n,n+=o)),n+=o}}))}},{key:"hvc1",value:function(t){return XJ(t,!1,(function(t,n,r){var i=GJ(t,n),a=n.subarray(i);r+=i,t.hvcC=e.hvcC(e.findBox(a,["hvcC"],r)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],r)[0])}))}},{key:"hvcC",value:function(e){return XJ(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=vJ(n,2),t.generalConstraintIndicatorFlags=n.subarray(6,12),t.generalLevelIdc=n[12],t.avgFrameRate=yJ(n,19),t.numOfArrays=n[22],t.vps=[],t.sps=[],t.pps=[];for(var i=23,a=0,o=0,s=0,u=0;u<t.numOfArrays;u++){a=63&n[i],o=yJ(n,i+1),i+=3;for(var c,l=[],d=0;d<o;d++)s=yJ(n,i),i+=2,l.push(n.subarray(i,i+s)),i+=s;if(32===a)(c=t.vps).push.apply(c,l);else if(33===a){var h;(h=t.sps).push.apply(h,l)}else if(34===a){var f;(f=t.pps).push.apply(f,l)}}}))}},{key:"pasp",value:function(e){return XJ(e,!1,(function(e,t){e.hSpacing=vJ(t),e.vSpacing=vJ(t,4)}))}},{key:"mp4a",value:function(t){return XJ(t,!1,(function(t,n,r){var i=PJ(t,n);t.esds=e.esds(e.findBox(n.subarray(i),["esds"],r+i)[0])}))}},{key:"esds",value:function(e){return XJ(e,!0,(function(e,t){e.codec="mp4a.";for(var n=0,r=0,i=0,a=0;t.length;){for(a=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===a)t=t.subarray(n+3);else{if(4!==a){if(5===a){var o=e.config=t.subarray(n,n+i),s=(248&o[0])>>3;return 31===s&&o.length>=2&&(s=32+((7&o[0])<<3)+((224&o[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 XJ(e,!1,(function(e,t){PJ(e,t)}))}},{key:"stts",value:function(e){return XJ(e,!0,(function(e,t){for(var n=vJ(t),r=[],i=4,a=0;a<n;a++)r.push({count:vJ(t,i),delta:vJ(t,i+4)}),i+=8;e.entryCount=n,e.entries=r}))}},{key:"ctts",value:function(e){return XJ(e,!0,(function(e,t){var n=vJ(t),r=[],i=4;if(1===e.version)for(var a=0;a<n;a++)r.push({count:vJ(t,i),offset:vJ(t,i+4)}),i+=8;else for(var o=0;o<n;o++)r.push({count:vJ(t,i),offset:-(1+~vJ(t,i+4))}),i+=8;e.entryCount=n,e.entries=r}))}},{key:"stsc",value:function(e){return XJ(e,!0,(function(e,t){for(var n=vJ(t),r=[],i=4,a=0;a<n;a++)r.push({firstChunk:vJ(t,i),samplesPerChunk:vJ(t,i+4),sampleDescriptionIndex:vJ(t,i+8)}),i+=12;e.entryCount=n,e.entries=r}))}},{key:"stsz",value:function(e){return XJ(e,!0,(function(e,t){var n=vJ(t),r=vJ(t,4),i=[];if(!n)for(var a=8,o=0;o<r;o++)i.push(vJ(t,a)),a+=4;e.sampleSize=n,e.sampleCount=r,e.entrySizes=i}))}},{key:"stco",value:function(e){return XJ(e,!0,(function(e,t){for(var n=vJ(t),r=[],i=4,a=0;a<n;a++)r.push(vJ(t,i)),i+=4;e.entryCount=n,e.entries=r}))}},{key:"co64",value:function(e){return XJ(e,!0,(function(e,t){for(var n=vJ(t),r=[],i=4,a=0;a<n;a++)r.push(gJ(t,i)),i+=8;e.entryCount=n,e.entries=r}))}},{key:"stss",value:function(e){return XJ(e,!0,(function(e,t){for(var n=vJ(t),r=[],i=4,a=0;a<n;a++)r.push(vJ(t,i)),i+=4;e.entryCount=n,e.entries=r}))}},{key:"moof",value:function(t){return XJ(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 XJ(e,!0,(function(e,t){e.sequenceNumber=vJ(t)}))}},{key:"traf",value:function(t){return XJ(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 XJ(e,!0,(function(e,t){var n=e.version,r=e.flags,i=t.length,a=e.sampleCount=vJ(t),o=4;if(i>o&&1&r&&(e.dataOffset=-(1+~vJ(t,o)),o+=4),i>o&&4&r&&(e.firstSampleFlags=vJ(t,o),o+=4),e.samples=[],i>o)for(var s,u=0;u<a;u++)s={},256&r&&(s.duration=vJ(t,o),o+=4),512&r&&(s.size=vJ(t,o),o+=4),1024&r&&(s.flags=vJ(t,o),o+=4),2048&r&&(s.cts=n?-(1+~vJ(t,o+4)):vJ(t,o),o+=4),e.samples.push(s)}))}},{key:"tfdt",value:function(e){return XJ(e,!0,(function(e,t){1===e.version?e.baseMediaDecodeTime=gJ(t):e.baseMediaDecodeTime=vJ(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,a=e.trak;if(a&&a.length){var o=a.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=a.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(o&&t){var u,c,l,d,h,f,p,m=t,y=null===(u=o.tkhd)||void 0===u?void 0:u.trackId;null!=y&&(m.id=o.tkhd.trackId),m.tkhdDuration=o.tkhd.duration,m.mvhdDurtion=e.mvhd.duration,m.mvhdTimecale=e.mvhd.timescale,m.timescale=m.formatTimescale=o.mdia.mdhd.timescale,m.duration=o.mdia.mdhd.duration||m.mvhdDurtion/m.mvhdTimecale*m.timescale;var v,g,b,A,_,w,S,k,T=o.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=KB,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=o.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=o.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=o.mdia.minf.stbl.senc&&o.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,Z,I,R,C,G,P,X=n,V=null===(x=s.tkhd)||void 0===x?void 0:x.trackId;null!=V&&(X.id=s.tkhd.trackId),X.tkhdDuration=s.tkhd.duration,X.mvhdDurtion=e.mvhd.duration,X.mvhdTimecale=e.mvhd.timescale,X.timescale=X.formatTimescale=s.mdia.mdhd.timescale,X.duration=s.mdia.mdhd.duration||X.mvhdDurtion/X.mvhdTimecale*X.timescale;var D,M,W,N,O,U,F,Y,K=s.mdia.minf.stbl.stsd.entries[0];switch(X.sampleSize=K.sampleSize,X.sampleRate=K.sampleRate,X.channelCount=K.channelCount,X.present=!0,K.type){case"alaw":X.codecType=X.codec=jB,X.sampleRate=8e3;break;case"ulaw":X.codecType=X.codec=BB,X.sampleRate=8e3;break;default:X.sampleDuration=fJ.getFrameDuration(X.sampleRate,X.timescale),X.sampleRateIndex=fJ.getRateIndexByRate(X.sampleRate),X.objectType=(null===(r=K.esds)||void 0===r?void 0:r.objectType)||2,K.esds&&(X.config=Array.from(K.esds.config)),X.codec=(null===(i=K.esds)||void 0===i?void 0:i.codec)||"mp4a.40.2"}if(X.sampleDuration=fJ.getFrameDuration(X.sampleRate,X.timescale),X.objectType=(null===(E=K.esds)||void 0===E?void 0:E.objectType)||2,K.esds&&(K.esds.config?X.config=Array.from(K.esds.config):console.warn("esds config is null")),X.codec=(null===(L=K.esds)||void 0===L?void 0:L.codec)||"mp4a.40.2",X.sampleRateIndex=fJ.getRateIndexByRate(X.sampleRate),X.ext={},X.ext.stss=null===(Z=s.mdia)||void 0===Z||null===(I=Z.minf)||void 0===I||null===(R=I.stbl)||void 0===R?void 0:R.stss,X.ext.ctts=null===(C=s.mdia)||void 0===C||null===(G=C.minf)||void 0===G||null===(P=G.stbl)||void 0===P?void 0:P.ctts,X.present=!0,K&&"enca"===K.type)X.isAudioEncryption=!0,K.data_format=null===(D=K.sinf)||void 0===D||null===(M=D.frma)||void 0===M?void 0:M.data_format,K.default_KID=null===(W=K.sinf)||void 0===W||null===(N=W.schi)||void 0===N?void 0:N.tenc.default_KID,K.default_IsEncrypted=null===(O=K.sinf)||void 0===O||null===(U=O.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,X.audioSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,X.useEME=e.useEME,X.kidValue=e.kidValue,X.enca=K}if(n&&(n.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!n&&n.isAudioEncryption),null!=t&&t.encv||null!=n&&n.enca){var H,j,B=null==t||null===(H=t.encv)||void 0===H?void 0:H.default_KID,J=null==n||null===(j=n.enca)||void 0===j?void 0:j.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 a=t.tfhd,o=t.tfdt,s=t.trun;if(a&&s){o&&(n&&n.id===a.trackId&&(n.baseMediaDecodeTime=o.baseMediaDecodeTime),r&&r.id===a.trackId&&(r.baseMediaDecodeTime=o.baseMediaDecodeTime));var u=a.defaultSampleSize||0,c=a.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[a.trackId]=[];for(var f=0;f<s.sampleCount;f++)i[a.trackId].push({offset:l,dts:d,duration:c,size:u}),d+=c,l+=u}else i[a.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,a;if(n){var o,s,u=null===(o=n.mdia)||void 0===o||null===(s=o.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=CJ(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;a=CJ(A,_,w,S)}return{videoSamples:i,audioSamples:a}}}}}]),e}();function CJ(e,t,n,r,i,a){var o,s,u,c=[],l=null==i?void 0:i.entries,d=t.entries,h=r.entries,f=n.entrySizes,p=null==a?void 0:a.entries;p&&(o={},p.forEach((function(e){o[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=o[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 GJ(e,t){return e.dataReferenceIndex=yJ(t,6),e.width=yJ(t,24),e.height=yJ(t,26),e.horizresolution=vJ(t,28),e.vertresolution=vJ(t,32),e.frameCount=yJ(t,40),e.depth=yJ(t,74),78}function PJ(e,t){return e.dataReferenceIndex=yJ(t,6),e.channelCount=yJ(t,16),e.sampleSize=yJ(t,18),e.sampleRate=vJ(t,24)/65536,28}function XJ(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 VJ=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,a=Math.ceil(i/r.length),o=[],s=String(e);a--;)o.push(r);return o.join("").substring(0,i-s.length)+s}(Number(t).toString(16),2,0))})),e[0]},DJ=function(){function e(t,n,r){ZB(this,e),this.videoTrack=t||new tJ,this.audioTrack=n||new nJ,this.metadataTrack=r||new oJ}return RB(e,[{key:"demux",value:function(e,t){var n=this.videoTrack,r=this.audioTrack,i=n.exist(),a=r.exist();if(n.samples=[],r.samples=[],t){if(!a){var o=RJ.findBox(t,["moov"])[0];if(!o)throw new Error("cannot found moov box");RJ.moovToTrack(RJ.moov(o),null,r)}var s=RJ.findBox(t,["moof"])[0];if(s){var u=RJ.moofToSamples(RJ.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 iJ(e.dts+c,n,e.duration))}))}}}if(e){if(!i&&!a){var d=RJ.findBox(e,["moov"])[0];if(!d)throw new Error("cannot found moov box");RJ.moovToTrack(RJ.moov(d),n,r)}var h=RJ.findBox(e,["moof"])[0];if(h){var f,p=RJ.moofToSamples(RJ.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 rJ((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 a=0,o=i.length-1;a<o;)f=vJ(i,a),a+=4,r.units.push(i.subarray(a,a+f)),a+=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 iJ(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 RJ.probe(e)}}]),e}();var MJ=function(){function e(){ZB(this,e),this.buffer=new Uint8Array(0)}return RB(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 a=new e(t),o=0;return r.forEach((function(e){a.set(e,o),o+=e.length})),a}(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}(),WJ=Math.pow(2,32)-1,NJ=function(){function e(){ZB(this,e)}return RB(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),a=new Uint8Array(i);a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=255&i,a.set(e,4);var o=8;return n.forEach((function(e){a.set(e,o),o+=e.byteLength})),a}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===OB&&e.codecType===KB}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return pJ(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],AJ(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(MB(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(MB(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===OB?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]),a=e.esds(t.config),o=e.sinf(t.enca);return e.box(e.types.enca,i,a,o)}},{key:"encv",value:function(t){var n,r,i=t.sps.length>0?t.sps[0]:[],a=t.pps.length>0?t.pps[0]:[],o=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,o>>8&255,255&o,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,MB(i)).concat([1,a.length>>>8&255,255&a.length])).concat.apply(n,MB(a))),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(AJ(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]),a=e.schi(t);return e.box(e.types.sinf,n,e.box(e.types.frma,r),e.box(e.types.schm,i),a)}},{key:"avc1hev1",value:function(t){var n=t.codecType===KB,r=n?e.types.hvc1:e.types.avc1,i=n?e.hvcC(t):e.avcC(t),a=[new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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?a.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&a.push(e.pasp(t.sarRatio)),e.box.apply(e,[r].concat(a))}},{key:"avcC",value:function(t){var n,r,i,a=[],o=[];return t.sps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,MB(e))})),t.pps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,MB(e))})),e.box(e.types.avcC,new Uint8Array((n=(r=[1,a[3],a[4],a[5],255,224|t.sps.length]).concat.apply(r,a).concat([t.pps.length])).concat.apply(n,o)))}},{key:"hvcC",value:function(t){var n=t.hvcC;if(n instanceof ArrayBuffer||n instanceof Uint8Array)return n;var r,i=t.vps,a=t.sps,o=t.pps;if(n){var s=n.generalProfileCompatibilityFlags,u=n.generalConstraintIndicatorFlags,c=(i.length&&1)+(a.length&&1)+(o.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,MB(e))};i.length&&(r.push(160,0,i.length),i.forEach(l)),a.length&&(r.push(161,0,a.length),a.forEach(l)),o.length&&(r.push(162,0,o.length),o.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=DB(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(MB(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(MB(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 a=e.saiz(t),o=e.saio(t),s=e.trun1(t),u=e.senc(t);return e.box(e.types.traf,n,r,a,o,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 MJ;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 MJ,r=MJ.writeUint32(t.samples.length),i=null;if(t.isVideo){var a=t.videoSencLength;i=MJ.writeUint32(16*t.samples.length+a+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=MJ.writeUint32(16*t.samples.length+92))}else{var o=12*t.samples.length+124;t.isAudioEncryption&&(o=12*t.samples.length+8*t.audioSenc.length+177),i=MJ.writeUint32(o)}return t.samples.forEach((function(e){n.write(MJ.writeUint32(e.duration)),n.write(MJ.writeUint32(e.size)),n.write(MJ.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&n.write(MJ.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 MJ,r=t.samples.length,i=t.isVideo?16:8,a=t.isVideo?2:0,o=[],s=0;return t.isVideo?(o=t.videoSenc,s=t.videoSencLength):o=t.audioSenc,s=s||i*r,n.write(MJ.writeUint32(16+s),e.types.senc,this.extension(0,a)),n.write(MJ.writeUint32(r)),o.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(MJ.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){n.write(MJ.writeUint16(e.BytesOfClearData)),n.write(MJ.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/(WJ+1)),i=Math.floor(n%(WJ+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 a=new Uint8Array(i);a.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 o=0;o<r;o++){var s=t[o],u=s.duration,c=s.size,l=s.flag,d=void 0===l?{}:l,h=s.cts,f=void 0===h?0:h;a.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*o)}return e.box(e.types.trun,a)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(MB(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===OB?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,pJ(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,a=e.sampleDescIndex;r.set([t>>24,t>>16&255,t>>8&255,255&t,n>>24,n>>16&255,n>>8&255,255&n,a>>24,a>>16&255,a>>8&255,255&a],i),i+=12})),e.box(e.types.stsc,pJ(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,pJ(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,pJ(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,pJ(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,pJ(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,a=t.samples[0].sampleOffset*r,o=8;t.samples.forEach((function(e){o+=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=o+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=o+16*t.samples.length+84)}else s=o+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=o+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,a>>24&255,a>>16&255,a>>8&255,255&a,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}();CB(NJ,"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))),CB(NJ,"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])}),CB(NJ,"FTYPAVC1",NJ.box(NJ.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),CB(NJ,"FTYPHEV1",NJ.box(NJ.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),CB(NJ,"DINF",NJ.box(NJ.types.dinf,NJ.box(NJ.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),CB(NJ,"VMHD",NJ.box(NJ.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),CB(NJ,"SMHD",NJ.box(NJ.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),CB(NJ,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),CB(NJ,"STTS",NJ.box(NJ.types.stts,NJ.StblTable)),CB(NJ,"STSC",NJ.box(NJ.types.stsc,NJ.StblTable)),CB(NJ,"STSZ",NJ.box(NJ.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),CB(NJ,"STCO",NJ.box(NJ.types.stco,NJ.StblTable));var OJ=function(){function e(t,n){ZB(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=n}return RB(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}();CB(OJ,"disabled",!0);var UJ=function(){function e(t,n,r){ZB(this,e),this.videoTrack=t,this.audioTrack=n;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new OJ("FMP4Remuxer",!r||!r.openLog||!r.openLog)}return RB(e,[{key:"remux",value:function(){var e,t,n,r,i,a=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),l=u.exist(),d=[];return a&&(o&&o.initMerge?(c&&d.push(this.videoTrack),l&&d.push(this.audioTrack),n=NJ.initSegment(d)):(c&&(e=NJ.initSegment([this.videoTrack])),l&&(t=NJ.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),a=new DataView(i.buffer),o=function(e,n,o,s){s=t[e];var u=0;s.units.forEach((function(e){a.setUint32(o,e.byteLength),o+=4,i.set(e,o),o+=e.byteLength,u+=4+e.byteLength})),s.size=u,c=o,r=s},s=0,u=t.length,c=0;s<u;s++)o(s,0,c,r);var l=NJ.mdat(i);return pJ(NJ.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=NJ.mdat(t);return pJ(NJ.moof([e]),n)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}(),FJ=Kt.f,YJ=S,KJ=A,HJ=W,jJ=oi,BJ=kS,JJ=dn,zJ=dr.f,QJ=he,qJ=hR,$J=nf,ez=qR,tz=Fg,nz=function(e,t,n){n in e||FJ(e,n,{configurable:!0,get:function(){return t[n]},set:function(e){t[n]=e}})},rz=lr,iz=w,az=rt,oz=Hn.enforce,sz=us,uz=Hg,cz=Jg,lz=gt("match"),dz=KJ.RegExp,hz=dz.prototype,fz=KJ.SyntaxError,pz=HJ(hz.exec),mz=HJ("".charAt),yz=HJ("".replace),vz=HJ("".indexOf),gz=HJ("".slice),bz=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Az=/a/g,_z=/a/g,wz=new dz(Az)!==Az,Sz=tz.MISSED_STICKY,kz=tz.UNSUPPORTED_Y,Tz=YJ&&(!wz||Sz||uz||cz||iz((function(){return _z[lz]=!1,dz(Az)!=Az||dz(_z)==_z||"/a/i"!=dz(Az,"i")})));if(jJ("RegExp",Tz)){for(var xz=function(e,t){var n,r,i,a,o,s,u=QJ(hz,this),c=qJ(e),l=void 0===t,d=[],h=e;if(!u&&c&&l&&e.constructor===xz)return e;if((c||QJ(hz,e))&&(e=e.source,l&&(t=ez(h))),e=void 0===e?"":$J(e),t=void 0===t?"":$J(t),h=e,uz&&"dotAll"in Az&&(r=!!t&&vz(t,"s")>-1)&&(t=yz(t,/s/g,"")),n=t,Sz&&"sticky"in Az&&(i=!!t&&vz(t,"y")>-1)&&kz&&(t=yz(t,/y/g,"")),cz&&(a=function(e){for(var t,n=e.length,r=0,i="",a=[],o={},s=!1,u=!1,c=0,l="";r<=n;r++){if("\\"===(t=mz(e,r)))t+=mz(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:pz(bz,gz(e,r+1))&&(r+=2,u=!0),i+=t,c++;continue;case">"===t&&u:if(""===l||az(o,l))throw new fz("Invalid capture group name");o[l]=!0,a[a.length]=[l,c],u=!1,l="";continue}u?l+=t:i+=t}return[i,a]}(e),e=a[0],d=a[1]),o=BJ(dz(e,t),u?this:hz,xz),(r||i||d.length)&&(s=oz(o),r&&(s.dotAll=!0,s.raw=xz(function(e){for(var t,n=e.length,r=0,i="",a=!1;r<=n;r++)"\\"!==(t=mz(e,r))?a||"."!==t?("["===t?a=!0:"]"===t&&(a=!1),i+=t):i+="[\\s\\S]":i+=t+mz(e,++r);return i}(e),n)),i&&(s.sticky=!0),d.length&&(s.groups=d)),e!==h)try{JJ(o,"source",""===h?"(?:)":h)}catch(S0){}return o},Ez=zJ(dz),Lz=0;Ez.length>Lz;)nz(xz,dz,Ez[Lz++]);hz.constructor=xz,xz.prototype=hz,rz(KJ,"RegExp",xz,{constructor:!0})}sz("RegExp");var Zz=S,Iz=Fg.MISSED_STICKY,Rz=F,Cz=Of,Gz=Hn.get,Pz=RegExp.prototype,Xz=TypeError;Zz&&Iz&&Cz(Pz,"sticky",{configurable:!0,get:function(){if(this!==Pz){if("RegExp"===Rz(this))return!!Gz(this).sticky;throw Xz("Incompatible receiver, RegExp required")}}});var Vz=function(){function e(){mB(this,e);var t=window.crypto||window.msCrypto;this.subtle=t&&(t.subtle||t.webkitSubtle),this.externalDecryptor=null}var t,n;return vB(e,[{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=pB(dB().mark((function e(t){var n;return dB().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",PZ(t.map,n));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_decryptData",value:(t=pB(dB().mark((function e(t,n,r){var i;return dB().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}(),Dz=lB(lB({},wZ),{},{STREAM_PARSED:"core.streamparsed",NO_AUDIO_TRACK:"core.noaudiotrack",SUBTITLE_SEGMENTS:"core.subtitlesegments",SUBTITLE_PLAYLIST:"core.subtitleplaylist",SEI_PAYLOAD_TIME:"core.seipayloadtime"}),Mz=new wA("Transmuxer"),Wz=function(){function e(t,n,r){mB(this,e),gB(this,"_initSegmentId",""),this.hls=t,this._demuxer=n?new DJ:new IJ,this._isMP4=n,r&&(this._remuxer=new UJ(this._demuxer.videoTrack,this._demuxer.audioTrack))}return vB(e,[{key:"transmux",value:function(e,t,n,r,i,a){var o=this._demuxer;try{this._isMP4?o.demux(e,t):o.demuxAndFix(PZ(e,t),n,r,i)}catch(S0){throw new Zb(Sb,Eb.HLS,S0)}var s=o.videoTrack,u=o.audioTrack,c=o.metadataTrack,l="".concat(s.codec,"/").concat(s.width,"/").concat(s.height,"/").concat(u.codec,"/").concat(u.config);if(l!==this._initSegmentId&&(this._initSegmentId=l,a=!0),this._fireEvents(s,u,c,n||a),this.hls.emit(Dz.DEMUXED_TRACK,s),!this._remuxer)return[s,u];try{var d=this._remuxer.remux(a),h=d.videoInitSegment,f=d.videoSegment,p=d.audioInitSegment,m=d.audioSegment,y=PZ(h,f),v=PZ(p,m);return[y?{codec:s.codec,data:y}:void 0,v?{codec:u.codec,data:v}:void 0]}catch(S0){throw new Zb(kb,Eb.FMP4,S0)}}},{key:"_fireEvents",value:function(e,t,n,r){var i=this;Mz.debug(e.samples,t.samples),r&&(e.exist()&&this.hls.emit(Dz.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(Dz.METADATA_PARSED,{type:"audio",track:t,meta:{codec:t.codec,channelCount:t.channelCount,sampleRate:t.sampleRate,timescale:t.timescale,baseDts:t.baseDts}}),Mz.debug("discontinuity",e,t)),e.warnings.forEach((function(e){var t;switch(e.type){case JB:t=Dz.LARGE_AV_FIRST_FRAME_GAP_DETECT;break;case zB:t=Dz.LARGE_VIDEO_DTS_GAP_DETECT;break;case QB:t=Dz.MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT}t&&i.hls.emit(Dz.STREAM_EXCEPTION,lB(lB({},e),{},{type:t})),Mz.warn("video exception",e)})),t.warnings.forEach((function(e){var t;switch(e.type){case qB:t=Dz.LARGE_AUDIO_DTS_GAP_DETECT;break;case $B:t=Dz.AUDIO_GAP_DETECT;break;case eJ:t=Dz.AUDIO_OVERLAP_DETECT}t&&i.hls.emit(Dz.STREAM_EXCEPTION,lB(lB({},e),{},{type:t})),Mz.warn("audio exception",e)})),e.samples.forEach((function(e){e.keyframe&&i.hls.emit(Dz.KEYFRAME,{pts:e.pts})})),n.seiSamples.forEach((function(e){i.hls.emit(Dz.SEI,lB(lB({},e),{},{originPts:e.originPts/90,sei:{code:e.data.type,content:e.data.payload,dts:e.pts}}))}))}}]),e}(),Nz=new wA("BufferService"),Oz=function(){function e(t){if(mB(this,e),gB(this,"_decryptor",new Vz),gB(this,"_transmuxer",null),gB(this,"_mse",null),gB(this,"_softVideo",null),gB(this,"_sourceCreated",!1),gB(this,"_needInitSegment",!0),gB(this,"_directAppend",!1),this.hls=t,t.config.softDecode)this._softVideo=t.media;else if(this._mse=new ZA,t.config.url){var n=this._mse.bindMedia(t.media);n&&n.then&&n.then((function(){t&&t.emit("sourceAttached")}))}t.config.decryptor&&(this._decryptor.externalDecryptor=t.config.decryptor)}var t,n,r,i,a,o,s,u,c;return vB(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:"updateDuration",value:(c=pB(dB().mark((function e(t){return dB().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Nz.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(IJ.probe(i))this._transmuxer||(this._transmuxer=new Wz(this.hls,!1,!this._softVideo));else{if(!RJ.probe(i))throw new Zb(xb,null,null,null,"unsupported stream");if(this._softVideo)this._transmuxer||(this._transmuxer=new Wz(this.hls,!0));else{this._directAppend=!0;var a=!1;e&&!n&&RJ.findBox(e,["moov","trak"]).forEach((function(e){var t=RJ.findBox(e.data,["trak","mdia","minf","stbl","stsd"])[0];if(t){var i=RJ.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 o;r=(null===(o=i.esds)||void 0===o?void 0:o.codec)||"mp4a.40.2",a=!0}}})),t&&!r&&RJ.findBox(t,["moov","trak","mdia","minf","stbl","stsd"]).forEach((function(e){var t=RJ.stsd(e).entries[0];t&&t.esds&&(r=t.esds.codec)})),e&&!n&&(n="avc1.42e01e"),t&&!r&&(r="mp4a.40.2"),a&&(n+=", ".concat(r),r=""),this._createMseSource(n,r)}}this._softVideo&&(this._sourceCreated=!0)}}}},{key:"appendBuffer",value:(u=pB(dB().mark((function e(t,n,r,i,a,o,s){var u,c,l,d,h,f,p,m,y;return dB().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(ZA.VIDEO,r)),i&&u.push(this._mse.append(ZA.AUDIO,i)),e.abrupt("return",Promise.all(u));case 7:if(c=this._needInitSegment||a,l=this._transmuxer.transmux(r,i,a,o,s,this._needInitSegment||a),d=kB(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(Dz.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(ZA.VIDEO,h.data)),f&&y.push(m.append(ZA.AUDIO,f.data)),e.abrupt("return",Promise.all(y));case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,a,o){return u.apply(this,arguments)})},{key:"removeBuffer",value:(s=pB(dB().mark((function e(){var t,n,r,i=this,a=arguments;return dB().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:0,n=a.length>1&&void 0!==a[1]?a[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(wZ.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:(o=pB(dB().mark((function e(t){var n,r,i;return dB().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(!(bb.start(bb.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 o.apply(this,arguments)})},{key:"clearAllBuffer",value:(a=pB(dB().mark((function e(){return dB().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 a.apply(this,arguments)})},{key:"decryptBuffer",value:function(e,t){return this._decryptor.decrypt(e,t)}},{key:"reset",value:(i=pB(dB().mark((function e(){var t,n=arguments;return dB().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=7;break}return this._sourceCreated=!1,e.next=5,this._mse.unbindMedia();case 5:return e.next=7,this._mse.bindMedia(this.hls.media);case 7:this._transmuxer=null,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=pB(dB().mark((function e(){return dB().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(wZ.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=pB(dB().mark((function e(t,n){return dB().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=pB(dB().mark((function e(){var t;return dB().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._mse,this._mse=null,this._softVideo=null,!t){e.next=6;break}return e.next=6,t.unbindMedia();case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_createMseSource",value:function(e,t){Nz.debug("create mse source, videoCodec=".concat(e,", audioCodec=").concat(t));var n=this._mse;n&&(e&&(n.createSource(ZA.VIDEO,"video/mp4;codecs=".concat(e)),this._sourceCreated=!0),t&&(n.createSource(ZA.AUDIO,"audio/mp4;codecs=".concat(t)),this._sourceCreated=!0),this.hls.emit(wZ.SOURCEBUFFER_CREATED))}},{key:"_handleCodecChange",value:function(e,t){var n=this._mse;[{type:ZA.VIDEO,codecs:null==e?void 0:e.codec},{type:ZA.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 a=r.split(",")[0];new RegExp(a,"ig").test(i.mimeType)||n.changeType(t,"".concat(t,"/mp4;codecs=").concat(r))}}))}},{key:"seamlessSwitch",value:function(){this._needInitSegment=!0}}]),e}();var Uz=vB((function e(){mB(this,e),gB(this,"version",0),gB(this,"streams",[]),gB(this,"isMaster",!0)})),Fz="AUDIO",Yz="SUBTITLE",Kz=vB((function e(){mB(this,e),gB(this,"id",0),gB(this,"url",""),gB(this,"default",!1),gB(this,"autoSelect",!1),gB(this,"forced",!1),gB(this,"group",""),gB(this,"name",""),gB(this,"lang",""),gB(this,"segments",[]),gB(this,"endSN",0)})),Hz=function(e){bB(n,e);var t=SB(n);function n(){var e;mB(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return gB(wB(e=t.call.apply(t,[this].concat(i))),"mediaType",Fz),gB(wB(e),"channels",0),e}return vB(n)}(Kz),jz=function(e){bB(n,e);var t=SB(n);function n(){var e;mB(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return gB(wB(e=t.call.apply(t,[this].concat(i))),"mediaType",Yz),e}return vB(n)}(Kz),Bz=vB((function e(){mB(this,e),gB(this,"id",0),gB(this,"bitrate",0),gB(this,"width",0),gB(this,"height",0),gB(this,"name",""),gB(this,"url",""),gB(this,"audioCodec",""),gB(this,"videoCodec",""),gB(this,"textCodec",""),gB(this,"audioGroup",""),gB(this,"audioStreams",[]),gB(this,"subtitleStreams",[]),gB(this,"closedCaptionsStream",[])})),Jz=vB((function e(){mB(this,e),gB(this,"version",0),gB(this,"url",""),gB(this,"type",""),gB(this,"startCC",0),gB(this,"endCC",0),gB(this,"startSN",0),gB(this,"endSN",0),gB(this,"totalDuration",0),gB(this,"targetDuration",0),gB(this,"live",!0),gB(this,"segments",[])})),zz=function(){function e(){mB(this,e),gB(this,"sn",0),gB(this,"cc",0),gB(this,"url",""),gB(this,"title",""),gB(this,"start",0),gB(this,"duration",0),gB(this,"key",null),gB(this,"byteRange",null),gB(this,"isInitSegment",!1),gB(this,"initSegment",null),gB(this,"isLast",!1),gB(this,"hasAudio",!1),gB(this,"hasVideo",!1)}return vB(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}(),Qz=function(){function e(t){mB(this,e),gB(this,"method",""),gB(this,"url",""),gB(this,"iv",null),gB(this,"keyFormat",""),gB(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 vB(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}(),qz=/^#(EXT[^:]*)(?::(.*))?$/,$z=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g,eQ=/^(?:[a-zA-Z0-9+\-.]+:)?\/\//,tQ=/^((?:[a-zA-Z0-9+\-.]+:)?\/\/[^/?#]*)?([^?#]*\/)?/;function nQ(e){var t=e.match(qz);if(t&&t[1])return[t[1].replace("EXT-X-",""),t[2]]}function rQ(e){for(var t={},n=$z.exec(e);n;)t[n[1]]=n[2]||n[3],n=$z.exec(e);return t}function iQ(e,t){if(!t||!e||eQ.test(e))return e;var n=tQ.exec(t);return n?"/"===e[0]?n[1]+e:n[1]+n[2]+e:e}var aQ={audio:[/^mp4a/,/^vorbis$/,/^opus$/,/^flac$/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]};function oQ(e,t){var n=aQ[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 sQ=function(){function e(){mB(this,e)}return vB(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;if(!t.includes("#EXTM3U"))throw new Error("Invalid m3u8 file");var r=function(e){return e.split(/[\r\n]/).map((function(e){return e.trim()})).filter(Boolean)}(t);return e.isMediaPlaylist(t)?function(e,t){var n=new Jz;n.url=t;for(var r,i=new zz,a=null,o=null,s=0,u=0,c=0,l=0,d=!1;(r=e[l++])&&!d;)if("#"===r[0]){var h=nQ(r);if(h){var f=kB(h,2),p=f[0],m=f[1];switch(p){case"VERSION":n.version=parseInt(m);break;case"PLAYLIST-TYPE":n.type=null==m?void 0:m.toUpperCase();break;case"TARGETDURATION":n.targetDuration=parseFloat(m);break;case"ENDLIST":var y=n.segments[n.segments.length-1];y&&(y.isLast=!0),n.live=!1,d=!0;break;case"MEDIA-SEQUENCE":u=n.startSN=parseInt(m);break;case"DISCONTINUITY-SEQUENCE":c=n.startCC=parseInt(m);break;case"DISCONTINUITY":c++;break;case"BYTERANGE":i.setByteRange(m,n.segments[n.segments.length-1]);break;case"EXTINF":var v=kB(m.split(","),2),g=v[0],b=v[1];i.start=s,i.duration=parseFloat(g),s+=i.duration,i.title=b;break;case"KEY":var A=rQ(m);if("NONE"===A.METHOD){o=null;break}if("AES-128"!==A.METHOD)throw new Error("encrypt ".concat(A.METHOD,"/").concat(A.KEYFORMAT," is not supported"));if((o=new Qz).method=A.METHOD,o.url=/^blob:/.test(A.URI)?A.URI:iQ(A.URI,t),o.keyFormat=A.KEYFORMAT||"identity",o.keyFormatVersions=A.KEYFORMATVERSIONS,A.IV){var _=A.IV.slice(2);_=(1&_.length?"0":"")+_,o.iv=new Uint8Array(_.length/2);for(var w=0,S=_.length/2;w<S;w++)o.iv[w]=parseInt(_.slice(2*w,2*w+2),16)}break;case"MAP":var k=rQ(m);i.url=iQ(k.URI,t),k.BYTERANGE&&i.setByteRange(k.BYTERANGE),i.isInitSegment=!0,i.sn=0,o&&(i.key=o.clone(0)),a=i,i=new zz}}}else i.sn=u,i.cc=c,i.url=iQ(r,t),o&&(i.key=o.clone(u)),a&&(i.initSegment=a),n.segments.push(i),i=new zz,u++;var T=n.segments[n.segments.length-1];return T&&(n.endSN=T.sn),n.totalDuration=s,n.endCC=c,n}(r,n):function(e,t){for(var n,r=new Uz,i=0,a=[],o=[];n=e[i++];){var s=nQ(n);if(s){var u=kB(s,2),c=u[0],l=u[1];if("VERSION"===c)r.version=parseInt(l);else if("MEDIA"===c&&l){var d=rQ(l),h=void 0;switch(d.TYPE){case"AUDIO":h=new Hz;break;case"SUBTITLES":h=new jz;break;default:h=new Kz}h.url=iQ(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&&a.push(h),"SUBTITLES"===d.TYPE&&o.push(h)}else if("STREAM-INF"===c&&l){var f=new Bz,p=rQ(l);if(f.bitrate=parseInt(p["AVERAGE-BANDWIDTH"]||p.BANDWIDTH),f.name=p.NAME,f.url=iQ(e[i++],t),p.RESOLUTION){var m=kB(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=oQ("video",g),f.audioCodec=oQ("audio",g),f.textCodec=oQ("text",g)}f.audioGroup=p.AUDIO,f.subtitleGroup=p.SUBTITLES,r.streams.push(f)}}}return r.streams.forEach((function(e,t){e.id=t})),a.length&&(a.forEach((function(e,t){e.id=t})),r.streams.forEach((function(e){e.audioGroup&&(e.audioStreams=a.filter((function(t){return t.group===e.audioGroup})))}))),o.length&&(o.forEach((function(e,t){e.id=t})),r.streams.forEach((function(e){e.subtitleGroup&&(e.subtitleStreams=o.filter((function(t){return t.group===e.subtitleGroup})))}))),r}(r,n)}},{key:"isMediaPlaylist",value:function(e){return e.includes("#EXTINF:")||e.includes("#EXT-X-TARGETDURATION:")}}]),e}(),uQ=function(){function e(t){var n=this;mB(this,e),gB(this,"_onLoaderRetry",(function(e,t){n.hls.emit(Dz.LOAD_RETRY,{error:Zb.network(e),retryTime:t})})),this.hls=t,this._timer=null;var r=this.hls.config,i=r.retryCount,a=r.retryDelay,o=r.loadTimeout,s=r.fetchOptions;this._loader=new VZ(lB(lB({},s),{},{responseType:"text",retry:i,retryDelay:a,timeout:o,onRetryError:this._onLoaderRetry})),this._audioLoader=new VZ(lB(lB({},s),{},{responseType:"text",retry:i,retryDelay:a,timeout:o,onRetryError:this._onLoaderRetry})),this._subtitleLoader=new VZ(lB(lB({},s),{},{responseType:"text",retry:i,retryDelay:a,timeout:o,onRetryError:this._onLoaderRetry}))}var t;return vB(e,[{key:"load",value:(t=pB(dB().mark((function e(t,n,r){var i,a,o,s,u,c,l,d,h,f,p,m,y,v;return dB().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(u=e.sent,c=kB(u,3),l=c[0],d=c[1],h=c[2],l){e.next=13;break}return e.abrupt("return",[]);case 13:a=l.data,n?(o=null==d?void 0:d.data,s=null==h?void 0:h.data):s=null==d?void 0:d.data,e.next=20;break;case 17:throw e.prev=17,e.t0=e.catch(3),Zb.network(e.t0);case 20:if(f=this.hls.config.onPreM3U8Parse,e.prev=21,f&&(a=f(a)||a,o&&(o=f(o,!0)||o),s&&(s=f(s,!0)||s)),p=sQ.parse(a,t),!1!==(null===(v=p)||void 0===v?void 0:v.live)||!p.segments||p.segments.length){e.next=26;break}throw new Error("empty segments list");case 26:o&&(m=sQ.parse(o,n)),s&&(y=sQ.parse(s,r)),e.next=33;break;case 30:throw e.prev=30,e.t1=e.catch(21),new Zb(Ab,Eb.HLS,e.t1);case 33:return p&&(p.isMaster?this.hls.emit(Dz.HLS_MANIFEST_LOADED,{playlist:p}):this.hls.emit(Dz.HLS_LEVEL_LOADED,{playlist:p})),e.abrupt("return",[p,m,y]);case 35:case"end":return e.stop()}}),e,this,[[3,17],[21,30]])}))),function(e,n,r){return t.apply(this,arguments)})},{key:"poll",value:function(e,t,n,r,i,a){var o=this;clearTimeout(this._timer),a=a||3e3;var s=this.hls.config.pollRetryCount,u=function(){var c=pB(dB().mark((function c(){var l;return dB().wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return clearTimeout(o._timer),c.prev=1,c.next=4,o.load(e,t,n);case 4:if((l=c.sent)[0]){c.next=7;break}return c.abrupt("return");case 7:s=o.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:o._timer=setTimeout(u,a);case 16:case"end":return c.stop()}}),c,null,[[1,11]])})));return function(){return c.apply(this,arguments)}}();this._timer=setTimeout(u,a)}},{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 cQ(e,t,n){return t>n&&(n=t),Math.min(Math.max(e,t),n)}var lQ=pi,dQ=Wv.findIndex,hQ=Jd,fQ="findIndex",pQ=!0;fQ in[]&&Array(1)[fQ]((function(){pQ=!1})),lQ({target:"Array",proto:!0,forced:pQ},{findIndex:function(e){return dQ(this,e,arguments.length>1?arguments[1]:void 0)}}),hQ(fQ);var mQ=function(){function e(t,n,r){mB(this,e),gB(this,"live",void 0),gB(this,"id",0),gB(this,"bitrate",0),gB(this,"width",0),gB(this,"height",0),gB(this,"name",""),gB(this,"url",""),gB(this,"audioCodec",""),gB(this,"videoCodec",""),gB(this,"textCodec",""),gB(this,"startCC",0),gB(this,"endCC",0),gB(this,"startSN",0),gB(this,"endSN",-1),gB(this,"totalDuration",0),gB(this,"targetDuration",0),gB(this,"snDiff",null),gB(this,"segments",[]),gB(this,"audioStreams",[]),gB(this,"subtitleStreams",[]),gB(this,"closedCaptions",[]),gB(this,"currentAudioStream",null),gB(this,"currentSubtitleStream",null),this.update(t,n,r)}return vB(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,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:"_clearSegments",value:function(e,t){for(var n=0,r=this.segments,i=0,a=r.length;i<a;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=n[n.length-1],i=(null==r?void 0:r.sn)||-1;if(i<e.endSN&&e.segments.length){var a=e.segments.findIndex((function(e){return e.sn===i})),o=a<0?e.segments:e.segments.slice(a+1);if(n.length&&o.length){var s=r.end;o.forEach((function(e){e.start=s,s=e.end}));var u=(null==r?void 0:r.cc)||-1;u>o[0].cc&&o.forEach((function(e){return e.cc+=u}))}return t.endSN=e.endSN,t.segments=n.concat(o),o}}else t.segments=e.segments}}]),e}(),yQ=function(){function e(t){mB(this,e),gB(this,"streams",[]),gB(this,"currentStream",null),gB(this,"dvrWindow",0),gB(this,"_segmentPointer",-1),this.hls=t}return vB(e,[{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:"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:"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=cQ(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 a=t[t.length-1];if(Math.abs(e-a.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 mQ(e)})),this.currentStream=this.streams[0];else if(Array.isArray(e.segments)){var i=this.currentStream;if(i){i.update(e,t,n);var a=i.updateSubtitle(n);a&&this.hls.emit(Dz.SUBTITLE_SEGMENTS,{list:a})}else this.reset(),this.currentStream=this.streams[0]=new mQ(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}(),vQ=function(){function e(t){var n=this;mB(this,e),gB(this,"error",null),gB(this,"_emitOnLoaded",(function(e,t){var r=e.data,i=e.response,a=e.option||{},o=a.firstByteTime,s=a.startTime,u=a.endTime,c=a.contentLength,l=u-s;n._bandwidthService.addRecord(c||r.byteLength,l),n.hls.emit(wZ.SPEED,{time:l,byteLength:c,url:t}),n.hls.emit(wZ.LOAD_COMPLETE,{url:t,elapsed:l||0}),n.hls.emit(wZ.TTFB,{url:t,responseUrl:i.url,elapsed:o-s}),n.hls.emit(wZ.LOAD_RESPONSE_HEADERS,{headers:i.headers})})),gB(this,"_onLoaderRetry",(function(e,t){n.hls.emit(wZ.LOAD_RETRY,{error:Zb.network(e),retryTime:t})})),this.hls=t,this._bandwidthService=new jI,this._mapCache={},this._keyCache={};var r=this.hls.config,i=r.retryCount,a=r.retryDelay,o=r.loadTimeout,s=r.fetchOptions;this._segmentLoader=new VZ(lB(lB({},s),{},{responseType:"arraybuffer",retry:i,retryDelay:a,timeout:o,onRetryError:this._onLoaderRetry})),this._audioSegmentLoader=new VZ(lB(lB({},s),{},{responseType:"arraybuffer",retry:i,retryDelay:a,timeout:o,onRetryError:this._onLoaderRetry})),this._keyLoader=new VZ(lB(lB({},s),{},{responseType:"arraybuffer",retry:i,retryDelay:a,timeout:o,onRetryError:this._onLoaderRetry}))}var t,n;return vB(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=pB(dB().mark((function e(t,n,r){var i,a,o,s,u,c,l,d,h,f,p,m,y,v,g,b=this;return dB().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=[],this.hls.emit(wZ.LOAD_START,{url:n.url}),l[0]=t.load(n.url),r&&n.initSegment&&(h=n.initSegment.url,(a=this._mapCache[h])||(this.hls.emit(wZ.LOAD_START,{url:h}),l[1]=t.load(h).then((function(e){e&&(Object.keys(b._mapCache)>30&&(b._mapCache={}),a=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(wZ.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,(o=this._keyCache[p])||(this.hls.emit(wZ.LOAD_START,{url:p}),l[3]=this._keyLoader.load(p).then((function(e){e&&(o=b._keyCache[p]=e.data,b._emitOnLoaded(e,p))})))),e.next=8,Promise.all(l);case 8:if(m=e.sent,y=kB(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:a,key:o,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=pB(dB().mark((function e(){return dB().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}(),gQ=new wA("hls"),bQ=function(e){bB(m,e);var t,n,r,i,a,o,s,u,c,l,d,h,f,p=SB(m);function m(e){var t,n,r;return mB(this,m),gB(wB(t=p.call(this)),"version",m.version),gB(wB(t),"media",null),gB(wB(t),"config",null),gB(wB(t),"_manifestLoader",null),gB(wB(t),"_segmentLoader",null),gB(wB(t),"_playlist",null),gB(wB(t),"_bufferService",null),gB(wB(t),"_gapService",null),gB(wB(t),"_seiService",null),gB(wB(t),"_stats",null),gB(wB(t),"_prevSegSn",null),gB(wB(t),"_prevSegCc",null),gB(wB(t),"_tickTimer",null),gB(wB(t),"_tickInterval",500),gB(wB(t),"_segmentProcessing",!1),gB(wB(t),"_reloadOnPlay",!1),gB(wB(t),"_switchUrlOpts",null),gB(wB(t),"_loadSegment",pB(dB().mark((function e(){var n,r;return dB().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.media.currentTime,r=t._playlist.currentSegment,t._playlist.nextSegment&&!(r&&!t.isLive&&r.end-n>=t.config.preloadTime)){e.next=7;break}return e.abrupt("return");case 7:return e.abrupt("return",t._loadSegmentDirect());case 8:case"end":return e.stop()}}),e)})))),gB(wB(t),"_onPlay",pB(dB().mark((function e(){return dB().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(clearTimeout(t._disconnectTimer),!t._reloadOnPlay){e.next=6;break}t._reloadOnPlay=!1,t.replay(!0),e.next=9;break;case 6:return e.next=8,t._loadSegment();case 8:t._startTick();case 9:case"end":return e.stop()}}),e)})))),gB(wB(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()})),gB(wB(t),"_onSeeking",pB(dB().mark((function e(){var n,r,i,a,o,s,u;return dB().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(n=t.media.currentTime,!(r=t._playlist.seekRange)){e.next=9;break}if(!((i=cQ(n,r[0]+.1,r[1]-.1))>=0&&Math.abs(n-i)>=.1)){e.next=9;break}return t.media.currentTime=i,e.abrupt("return");case 9:if(!(a=t._playlist.currentSegment)){e.next=14;break}if(!((o=bb.info(bb.get(t.media),n,.1)).end&&Math.abs(o.end-a.end)<.2)){e.next=14;break}return e.abrupt("return");case 14:if(s=t._playlist.findSegmentIndexByTime(n),u=t._playlist.getSegmentByIndex(s),null!=s&&u&&(!t._segmentProcessing||u!==t._playlist.nextSegment)){e.next=18;break}return e.abrupt("return");case 18:return gQ.debug("seek to",n,u),t._playlist.setNextSegmentByIndex(s),t._stopTick(),e.next=23,t._segmentLoader.cancel();case 23:return e.next=25,t._loadSegmentDirect();case 25:t._startTick();case 26:case"end":return e.stop()}}),e)})))),gB(wB(t),"_onTimeupdate",(function(){if(t.media){var e=t.config;if(e.isLive&&e.maxLatency&&e.targetLatency&&t.media){var n=t._playlist.liveEdge;if(!n)return;var r=n-t.media.currentTime;r>=e.maxLatency&&(gQ.debug("latency jump, currentTime:".concat(t.media.currentTime,", liveEdge:").concat(n,", latency=").concat(r)),t.media.currentTime=n-e.targetLatency)}t._seiService.throw(t.media.currentTime),t.config.allowedStreamTrackChange&&!t.config.softDecode&&t._checkStreamTrackChange(t.media.currentTime)}})),gB(wB(t),"_tick",(function(){if(t.media){t._startTick();var e=t.media,n=bb.get(e),r=t._segmentLoader.error;if(r){(!e.readyState||t.bufferInfo(.5).remaining<1)&&(r.fatal=!0,t._emitError(Zb.network(r)))}else bb.end(n)<.1||!e.readyState||(CZ(e)?(t._loadSegment(),t._gapService&&t._gapService.do(e,t.config.maxJumpDistance,t.isLive)):e.readyState<2&&t._gapService&&t._gapService.do(e,t.config.maxJumpDistance,!e.currentTime||t.isLive))}})),t.config=(r=(null==(n=e)?void 0:n.media)||document.createElement("video"),e=lB(lB({maxPlaylistSize:50,retryCount:3,retryDelay:1e3,pollRetryCount:2,loadTimeout:1e4,preloadTime:30,softDecode:!1,bufferBehind:10,maxJumpDistance:3,startTime:0,targetLatency:10,maxLatency:20,allowedStreamTrackChange:!0},n),{},{media:r})),t.media=t.config.media,t._manifestLoader=new uQ(wB(t)),t._segmentLoader=new vQ(wB(t)),t._playlist=new yQ(wB(t)),t._bufferService=new Oz(wB(t)),t._seiService=new HI(wB(t)),e.softDecode||(t._gapService=new DZ),t._stats=new JI(wB(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 vB(m,[{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 bb.info(bb.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 GZ(this.media)}},{key:"load",value:(f=pB(dB().mark((function e(t){var n,r=arguments;return dB().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 f.apply(this,arguments)})},{key:"_loadData",value:(h=pB(dB().mark((function e(t){var n,r,i,a,o,s,u,c,l,d;return dB().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&(t=t.trim()),t){e.next=3;break}throw this._emitError(new Zb(xb,Eb.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===(a=this._switchUrlOpts)||void 0===a?void 0:a.bitrate),o=this._getSeamlessSwitchPoint(),this.config.startTime=o,s=this._playlist.findSegmentIndexByTime(o),!(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=29;break}if(!this.isLive){e.next=25;break}this._bufferService.setLiveSeekableRange(0,4294967295),gQ.log("totalDuration first time got",this._playlist.totalDuration),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),e.next=29;break;case 25:return e.next=27,this._bufferService.updateDuration(r.totalDuration);case 27:(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));case 29:return e.next=31,this._loadSegment();case 31:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"replay",value:(d=pB(dB().mark((function e(t){return dB().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.config.startTime=0,!this.config.softDecode){e.next=5;break}this.load(),e.next=7;break;case 5:return e.next=7,this.load();case 7:return this._reloadOnPlay=!1,e.abrupt("return",this.media.play(!t));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"switchURL",value:(l=pB(dB().mark((function e(t){var n,r,i,a,o,s,u,c=arguments;return dB().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=hB(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),o=(a=n).seamless,s=a.startTime,this.config.url=t,this.config.startTime=s,this._switchUrlOpts=n,o){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(Dz.SWITCH_URL_FAILED,e.t2),e.t2;case 33:return this._reloadOnPlay=!1,u&&this.emit(Dz.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 l.apply(this,arguments)})},{key:"switchStream",value:(c=pB(dB().mark((function e(t){var n,r,i,a,o,s=arguments;return dB().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(a=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(Zb.create(e.t0));case 19:if(r.currentAudioStream&&a.audioStreams.length>2&&(o=r.currentAudioStream.id,a.currentAudioStream=a.audioStreams.find((function(e){return e.id===o}))||a.currentAudioStream),this._playlist.currentStream=a,e.prev=21,!this.isLive&&a.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",a);case 37:case"end":return e.stop()}}),e,this,[[8,16],[21,31]])}))),function(e){return c.apply(this,arguments)})},{key:"switchAudioStream",value:(u=pB(dB().mark((function e(t){var n,r,i,a,o=arguments;return dB().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(o.length>1&&void 0!==o[1])||o[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(a=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(Zb.create(e.t0));case 21:if(r.currentAudioStream=a,e.prev=22,!this.isLive&&a.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",a);case 38:case"end":return e.stop()}}),e,this,[[10,18],[22,32]])}))),function(e){return u.apply(this,arguments)})},{key:"switchSubtitleStream",value:(s=pB(dB().mark((function e(t){return dB().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 s.apply(this,arguments)})},{key:"destroy",value:(o=pB(dB().mark((function e(){return dB().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(),this._seiService.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 o.apply(this,arguments)})},{key:"_loadM3U8",value:(a=pB(dB().mark((function e(t){var n,r,i,a;return dB().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._manifestLoader.load(t);case 3:r=e.sent,i=kB(r,1),n=i[0],e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(0),this._emitError(Zb.create(e.t0));case 11:if(n){e.next=13;break}return e.abrupt("return");case 13:if(this._playlist.upsertPlaylist(n),!n.isMaster){e.next=18;break}return null!==(a=this._playlist.currentStream.subtitleStreams)&&void 0!==a&&a.length&&this.emit(Dz.SUBTITLE_PLAYLIST,{list:this._playlist.currentStream.subtitleStreams}),e.next=18,this._refreshM3U8();case 18:return this.emit(Dz.STREAM_PARSED),e.abrupt("return",n);case 20:case"end":return e.stop()}}),e,this,[[0,8]])}))),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(Zb.create(null,null,new Error("m3u8 url is not defined")));var i=r.url,a=null===(e=r.currentAudioStream)||void 0===e?void 0:e.url,o=null===(t=r.currentSubtitleStream)||void 0===t?void 0:t.url;return this._manifestLoader.load(i,a,o).then((function(e){var t=kB(e,3),r=t[0],s=t[1],u=t[2];r&&(n._playlist.upsertPlaylist(r,s,u),n.isLive&&n._pollM3U8(i,a,o))})).catch((function(e){throw n._emitError(Zb.create(e))}))}},{key:"_pollM3U8",value:function(e,t,n){var r,i=this,a=this._playlist.isEmpty;this._manifestLoader.poll(e,t,n,(function(e,t,n){i._playlist.upsertPlaylist(e,t,n),i._playlist.clearOldSegment(),e&&a&&!i._playlist.isEmpty&&i._loadSegment(),a&&(a=i._playlist.isEmpty)}),(function(e){i._emitError(Zb.create(e))}),1e3*((null===(r=this._playlist.lastSegment)||void 0===r?void 0:r.duration)||0))}},{key:"_loadSegmentDirect",value:(i=pB(dB().mark((function e(){var t,n,r;return dB().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._playlist.nextSegment){e.next=3;break}return e.abrupt("return");case 3:return n=!1,r=null,e.prev=5,this._segmentProcessing=!0,e.next=9,this._reqAndBufferSegment(t,this._playlist.getAudioSegment(t));case 9:n=e.sent,e.next=15;break;case 12:e.prev=12,e.t0=e.catch(5),r=e.t0;case 15:return e.prev=15,this._segmentProcessing=!1,e.finish(15);case 18:if(!r){e.next=20;break}return e.abrupt("return",this._emitError(Zb.create(r)));case 20:return n&&(this._urlSwitching&&(this._urlSwitching=!1,this.emit(Dz.SWITCH_URL_SUCCESS,{url:this.config.url})),this._playlist.moveSegmentPointer(),t.isLast?this._end():this._loadSegment()),e.abrupt("return",n);case 22:case"end":return e.stop()}}),e,this,[[5,12,15,18]])}))),function(){return i.apply(this,arguments)})},{key:"_reqAndBufferSegment",value:(r=pB(dB().mark((function e(t,n){var r,i,a,o,s,u,c,l;return dB().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t?t.cc:n.cc,a=this._prevSegCc!==i,o=[],e.prev=3,e.next=6,this._segmentLoader.load(t,n,a);case 6:o=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(o[0]){e.next=16;break}return e.abrupt("return");case 16:return e.next=18,(r=this._bufferService).decryptBuffer.apply(r,TB(o));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),e.next=27,this._bufferService.appendBuffer(t,n,s[0],s[1],a,this._prevSegSn===u-1,c);case 27:return e.next=29,this._bufferService.evictBuffer(this.config.bufferBehind);case 29:return this._prevSegCc=i,this._prevSegSn=u,e.abrupt("return",!0);case 32:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e,t){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=pB(dB().mark((function e(){return dB().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=pB(dB().mark((function e(){var t,n=arguments;return dB().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]&&n[0],this._reloadOnPlay=!1,this._prevSegSn=null,this._prevSegCc=null,this._switchUrlOpts=null,this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),this._stats.reset(),e.next=11,this._clear();case 11:return e.abrupt("return",this._bufferService.reset(t));case 12:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_end",value:function(){this._clear(),this._bufferService.endOfStream()}},{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=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!1===(null===(t=e.originError)||void 0===t?void 0:t.fatal)?gQ.warn(e):(gQ.table(e),gQ.error(e),gQ.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(Dz.SWITCH_URL_FAILED,e)),this.emit(Dz.ERROR,e),i&&this._end(),this._seiService.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),a=null===(n=this._stats)||void 0===n?void 0:n.getStats().downloadSpeed;if(a&&i)t+=i.duration*this._playlist.currentStream.bitrate/a+1;else t+=5}return t}}],[{key:"isSupported",value:function(e){return e&&"video"!==e&&"audio"!==e?"undefined"!=typeof WebAssembly:ZA.isSupported()}},{key:"enableLogger",value:function(){wA.enable(),sJ.enable()}},{key:"disableLogger",value:function(){wA.disable(),sJ.disable()}}]),m}(Za);gB(bQ,"version","3.0.0-next.36-1");try{localStorage.getItem("xgd")?bQ.enableLogger():bQ.disableLogger()}catch(S0){}var AQ=function(){function e(t,n){var r=this;mB(this,e),gB(this,"_opts",null),gB(this,"_plugin",null),gB(this,"_onLowDecode",(function(){var e,t,n,i,a=r._opts,o=a.media,s=a.innerDegrade;null===(e=r._plugin)||void 0===e||null===(t=e.player)||void 0===t||t.emit("lowdecode",o.degradeInfo),null===(n=r._plugin)||void 0===n||null===(i=n.player)||void 0===i||i.emit("core_event",lB(lB({},o.degradeInfo),{},{eventName:Dz.LOWDECODE})),1===s&&r._degrade(o.src)})),gB(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 a=t.root.firstChild;"MVideo"===a.TAG&&t.root.replaceChild(i,a);var o=r._plugin.constructor.pluginName.toLowerCase();t.unRegisterPlugin(o),t.once("canplay",(function(){t.play()}))}})),gB(this,"forceDegradeToVideo",(function(e){1===r._opts.innerDegrade&&r._degrade(e)})),this._opts=t,this._plugin=n,this._init()}return vB(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 _Q=function(e){bB(n,e);var t=SB(n);function n(){var e;mB(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return gB(wB(e=t.call.apply(t,[this].concat(i))),"hls",null),gB(wB(e),"pluginExtension",null),gB(wB(e),"getStats",(function(){var t;return null===(t=e.hls)||void 0===t?void 0:t.getStats()})),gB(wB(e),"destroy",(function(){var t;e.hls&&(e.hls.destroy(),e.hls=null),null===(t=e.pluginExtension)||void 0===t||t.destroy(),e.pluginExtension=null})),gB(wB(e),"_onSwitchSubtitle",(function(t){var n,r=t.lang;null===(n=e.hls)||void 0===n||n.switchSubtitleStream(r)})),gB(wB(e),"_onSwitchURL",(function(t,n){var r=wB(e),i=r.player,a=r.hls;if(a){var o=function(e,t){var n={startTime:t.player.currentTime};switch(hB(e)){case"boolean":n.seamless=e;break;case"object":Object.assign(n,e)}return n}(n,wB(e));i.config.url=t,a.switchURL(t,o).catch((function(e){}))}})),e}return vB(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,t=this,n=new Promise((function(t,n){e=t})),r=this.player.config;if(r.url||r.__allowHlsEmptyUrl__){this.hls&&this.hls.destroy(),this.player.switchURL=this._onSwitchURL;var i,a,o=r.hls||{};if(o.innerDegrade=o.innerDegrade||r.innerDegrade,null!==o.disconnectTime&&void 0!==o.disconnectTime||(o.disconnectTime=0),this.hls=new bQ(lB({softDecode:this.softDecode,isLive:r.isLive,media:this.player.media||this.player.video,startTime:r.startTime,url:r.url},o)),this.softDecode)e(!0);else qa.defineGetterOrSetter(this.player,{url:{get:function(){var e,n;return null===(e=t.hls)||void 0===e||null===(n=e.media)||void 0===n?void 0:n.src},configurable:!0}}),null!==(i=this.hls.media)&&void 0!==i&&i.src?this.hls.on("sourceAttached",(function(){e(!0)})):e(!0);if(this.softDecode&&(this.pluginExtension=new AQ(lB({isLive:r.isLive,media:this.player.video},o),this),this.player.forceDegradeToVideo=function(){for(var e,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return null===(e=t.pluginExtension)||void 0===e?void 0:e.forceDegradeToVideo.apply(e,r)}),r.isLive)null===(a=this.player)||void 0===a||a.useHooks("replay",(function(){var e;return null===(e=t.hls)||void 0===e?void 0:e.replay()}));return this.on("switch_subtitle",this._onSwitchSubtitle),this.on(Ka,this._onSwitchURL),this.on(Ya,this.destroy),this._transError(),this._transCoreEvent(wZ.TTFB),this._transCoreEvent(wZ.LOAD_START),this._transCoreEvent(wZ.LOAD_RESPONSE_HEADERS),this._transCoreEvent(wZ.LOAD_COMPLETE),this._transCoreEvent(wZ.LOAD_RETRY),this._transCoreEvent(wZ.SOURCEBUFFER_CREATED),this._transCoreEvent(wZ.REMOVE_BUFFER),this._transCoreEvent(wZ.BUFFEREOS),this._transCoreEvent(wZ.KEYFRAME),this._transCoreEvent(wZ.METADATA_PARSED),this._transCoreEvent(wZ.SEI),this._transCoreEvent(wZ.SEI_IN_TIME),this._transCoreEvent(wZ.SPEED),this._transCoreEvent(wZ.HLS_MANIFEST_LOADED),this._transCoreEvent(wZ.HLS_LEVEL_LOADED),this._transCoreEvent(wZ.STREAM_EXCEPTION),this._transCoreEvent(wZ.SWITCH_URL_SUCCESS),this._transCoreEvent(wZ.SWITCH_URL_FAILED),this._transCoreEvent(Dz.NO_AUDIO_TRACK),this._transCoreEvent(Dz.STREAM_PARSED),this._transCoreEvent(Dz.SUBTITLE_SEGMENTS),this._transCoreEvent(Dz.SUBTITLE_PLAYLIST),r.url&&this.hls.load(r.url,!0).catch((function(e){})),n}e()}},{key:"_transError",value:function(){var e=this;this.hls.on(Dz.ERROR,(function(t){e.player&&e.player.emit(Fa,new Ua(e.player,t))}))}},{key:"_transCoreEvent",value:function(e){var t=this;this.hls.on(e,(function(n){t.player&&(t.player.emit("core_event",lB(lB({},n),{},{eventName:e})),e===wZ.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:Dz.SEI_PAYLOAD_TIME,time:t.rtmp_dts})}catch(n){}}}],[{key:"pluginName",get:function(){return"hls"}},{key:"isSupported",value:function(e,t){return bQ.isSupported(e,t)}}]),n}(qa);gB(_Q,"Hls",bQ),gB(_Q,"EVENT",Dz);var wQ,SQ={};wQ=SQ,function(){var e="undefined"!=typeof window?window:v,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)},a=void 0!==e&&e===this?this:void 0!==t&&null!=t?t:this;function o(){o=function(){},a.Symbol||(a.Symbol=u)}var s,u=(s=0,function(e){return"jscomp_symbol_"+(e||"")+s++});function c(){o();var e=a.Symbol.iterator;e||(e=a.Symbol.iterator=a.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})[a.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=a,r=e.split("."),o=0;o<r.length-1;o++){var s=r[o];s in n||(n[s]={}),n=n[s]}(s=t(o=n[r=r[r.length-1]]))!=o&&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(a){a.done?r(a.value):Promise.resolve(a.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=a.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)o.h(this.g[e]);this.g=null}};var o=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){a(n)}}:t}var i,a,o=new t((function(e,t){i=e,a=t}));return this.nc(r(e,i),r(n,a)),o},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?o.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),a=i.next();!a.done;a=i.next())r(a.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 a(t){return function(n){o[t]=n,0==--s&&e(o)}}var o=[],s=0;do{o.push(void 0),s++,r(i.value).nc(a(o.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 Z(e){e.j=0;var t=e.g.ce;return e.g=null,t}function I(e){e.o=[e.g],e.j=0,e.h=0}function R(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 G(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 a=i.value}catch(o){return e.g.i=null,S(e.g,o),P(e)}return e.g.i=null,r.call(e.g,a),P(e)}function P(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 X(e){this.next=function(t){return w(e.g),e.g.i?t=G(e,e.g.i.next,t,e.g.m):(e.g.m(t),t=P(e)),t},this.throw=function(t){return w(e.g),e.g.i?t=G(e,e.g.i.throw,t,e.g.m):(S(e.g,t),t=P(e)),t},this.return=function(t){return function(e,t){w(e.g);var n=e.g.i;return n?G(e,"return"in n?n.return:function(e){return{value:e,done:!0}},t,e.g.return):(e.g.return(t),P(e))}(e,t)},c(),this[Symbol.iterator]=function(){return this}}function V(e,t){return X.prototype=e.prototype,new X(new C(t))}function D(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function M(e,t,n){e instanceof String&&(e=String(e));for(var r=e.length,i=0;i<r;i++){var a=e[i];if(t.call(n,a,i,e))return{le:i,Qe:a}}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){o(),c(),e=h(e);for(var t;!(t=e.next()).done;)t=t.value,this.set(t[0],t[1])}}function n(e){D(e,a)||i(e,a,{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 a="$jscomp_hidden_"+Math.random();r("freeze"),r("preventExtensions"),r("seal");var s=0;return t.prototype.set=function(e,t){if(n(e),!D(e,a))throw Error("WeakMap key fail: "+e);return e[a][this.g]=t,this},t.prototype.get=function(e){return D(e,a)?e[a][this.g]:void 0},t.prototype.has=function(e){return D(e,a)&&D(e[a],this.g)},t.prototype.delete=function(e){return!(!D(e,a)||!D(e[a],this.g))&&delete e[a][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?a.has(t)?n=a.get(t):(n=""+ ++s,a.set(t,n)):n="p_"+t;var r=e.h[n];if(r&&D(e.h,n))for(var i=0;i<r.length;i++){var o=r[i];if(t!=t&&o.key!=o.key||t===o.key)return{id:n,list:r,index:i,ga:o}}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(a){return!1}}())return e;o(),c();var a=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(a){return!1}}()?e:(o(),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 M(this,e,t).le}})),f("Array.prototype.find",(function(e){return e||function(e,t){return M(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,a=Math.max(0,Math.min(0|t,n.length)),o=0;o<i&&a<r;)if(n[a++]!=e[o++])return!1;return o>=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 a=n[i];if(a===e||Object.is(a,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 a=0;a<i;a++)r.push(t.call(n,e[a]))}return r}}));var N="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)D(r,i)&&(e[i]=r[i])}return e};f("Object.assign",(function(e){return e||N}));var O=this;function U(e,t){var n,r=e.split("."),i=O;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 H(e){return e.g/(1-Math.pow(e.i,e.h))}function j(){this.h=new Y(2),this.i=new Y(5),this.g=0}O.g=!0,j.prototype.getBandwidthEstimate=function(e){return 128e3>this.g?e:Math.min(H(this.h),H(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=[],a=3;a<arguments.length;++a)i[a-3]=arguments[a];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)?oe:ae,!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 a=[],o=0;o<r.length;){var s=r[o++];"."==s?i&&o==r.length&&a.push(""):".."==s?((1<a.length||1==a.length&&""!=a[0])&&a.pop(),i&&o==r.length&&a.push("")):(a.push(s),i=!0)}r=a.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,ae=/[#\?:]/g,oe=/[#\?]/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("="),a=null;if(0<=i){var o=n[r].substring(0,i);a=n[r].substring(i+1)}else o=n[r];o=decodeURIComponent(o.replace(/\+/g," ")),a=a||"",this.add(o,decodeURIComponent(a.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 a=n;""!==r[i]&&(a+="="+encodeURIComponent(r[i])),t.push(a)}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.",a=r[1],o=Number(r[2]);i=("66"==a?i+"4200":"77"==a?i+"4d00":i+"6400")+(o>>4).toString(16),i+=(15&o).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 Ze(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 Ie(e){return p((function t(){var n,r;return V(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 Re(e,t){this.promise=e,this.se=t,this.g=!1}function Ce(e){return new Re(Promise.reject(e),(function(){return Promise.resolve()}))}function Ge(){var e=Promise.reject(new J(2,7,7001));return e.catch((function(){})),new Re(e,(function(){return Promise.resolve()}))}function Pe(e){return new Re(Promise.resolve(e),(function(){return Promise.resolve()}))}function Xe(e){return new Re(e,(function(){return e.catch((function(){}))}))}function Ve(e){return new Re(Promise.all(e.map((function(e){return e.promise}))),(function(){return Promise.all(e.map((function(e){return e.abort()})))}))}function De(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 Me(){this.g={}}function We(){this.hd=new Me,this.jc=this}function Ne(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,a=r?[]:{};for(i in n)a[i]=e(n[i]);return r&&(a.length=n.length),a}}(e)}function Oe(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=Oe),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 He(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",Re),Re.failed=Ce,Re.aborted=Ge,Re.completed=Pe,Re.notAbortable=Xe,Re.prototype.abort=function(){return this.g=!0,this.se()},Re.prototype.abort=Re.prototype.abort,Re.all=Ve,Re.prototype.finally=function(e){return this.promise.then((function(){return e(!0)}),(function(){return e(!1)})),this},Re.prototype.finally=Re.prototype.finally,Re.prototype.ca=function(e,t){function n(n){return function(s){if(i.g&&n)a.reject(o);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,a):(n?a.resolve:a.reject)(s)}}}function r(){return a.reject(o),i.abort()}var i=this,a=new me,o=new J(2,7,7001);return this.promise.then(n(!0),n(!1)),new Re(a,(function(){return r()}))},Re.prototype.chain=Re.prototype.ca,U("shaka.util.FakeEvent",De),De.prototype.preventDefault=function(){this.cancelable&&(this.defaultPrevented=!0)},De.prototype.stopImmediatePropagation=function(){this.g=!0},De.prototype.stopPropagation=function(){},(r=Me.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(i){B.error("Uncaught exception in event handler",i,i?i.message:null,i?i.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(He,We),U("shaka.net.NetworkingEngine",He),He.RequestType={MANIFEST:0,SEGMENT:1,LICENSE:2,APP:3,TIMING:4},He.PluginPriority={FALLBACK:1,PREFERRED:2,APPLICATION:3};var je={};function Be(e,t,n){n=n||3;var r=je[e];(!r||n>=r.priority)&&(je[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,a,o){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=je[u])?u.mg:null;return d?Xe(Ie(r)).ca((function(){return e.j?Ge():(l=Date.now(),d(n.uris[i],n,t,(function(n,r,i){e.i&&1==t&&(e.i(n,r),c=!0,o.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 Ge();if(s&&1==s.severity)return e.dispatchEvent(new De("retry",{error:s instanceof J?s:null})),i=(i+1)%n.uris.length,ze(e,t,n,r,i,s,o);throw s||a})):Ce(new J(2,1,1e3,s))}function Qe(){this.g=0}function qe(e,t,n){Re.call(this,e,t),this.h=n}function $e(){}function et(){this.g=new Me}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(i){t=!1}nt=t}return t||!1}(e)?t:t.capture||!1}(e,r),this.target.addEventListener(t,n,this.g)}He.registerScheme=Be,He.unregisterScheme=function(e){delete je[e]},He.prototype.og=function(e){this.g.add(e)},He.prototype.registerRequestFilter=He.prototype.og,He.prototype.Ng=function(e){this.g.delete(e)},He.prototype.unregisterRequestFilter=He.prototype.Ng,He.prototype.bf=function(){this.g.clear()},He.prototype.clearAllRequestFilters=He.prototype.bf,He.prototype.pg=function(e){this.h.add(e)},He.prototype.registerResponseFilter=He.prototype.pg,He.prototype.Og=function(e){this.h.delete(e)},He.prototype.unregisterResponseFilter=He.prototype.Og,He.prototype.cf=function(){this.h.clear()},He.prototype.clearAllResponseFilters=He.prototype.cf,He.defaultRetryParameters=function(){return{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0}},He.makeRequest=Je,He.prototype.destroy=function(){return this.j=!0,this.g.clear(),this.h.clear(),this.l.destroy()},He.prototype.destroy=He.prototype.destroy,He.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?Ne(t.retryParameters):{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0},t.uris=Ne(t.uris),i=function(e,t,n){for(var r=Pe(void 0),i={},a=(e=h(e.g)).next();!a.done;i={Gd:i.Gd},a=e.next())i.Gd=a.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 a=i.ca((function(){return ze(n,e,t,new Ze(t.retryParameters,!1),0,null,r)})),o=a.ca((function(t){return function(e,t,n){for(var r=Pe(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 a.promise.then((function(){c=Date.now()}),(function(){})),i=new qe((i=o.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},He.prototype.request=He.prototype.request,He.NumBytesRemainingClass=Qe,A(qe,Re),He.PendingRequest=qe,qe.all=Ve,qe.notAbortable=Xe,qe.completed=Pe,qe.aborted=Ge,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(a){i.ta(e,t,r),n(a)}),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(a,e.byteLength,!0),a+=4,i.set(e,a),a+=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),a=0;return r(new Uint8Array(e)),r(t),r(new Uint8Array(n)),i}function at(e,t){for(var n=[],r=h(e),i=r.next();!i.done;i=r.next())n.push(t(i.value));return n}function ot(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),a=Se.$c(e);i={kty:"oct",kid:Se.Mc(i,!1),k:Se.Mc(a,!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),a=i.next();!a.done;a=i.next())a.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,a=st(t.j.servers)),a=(i=h(n)).next();!a.done;a=i.next())for(var o=(a=h(a.value.drmInfos)).next();!o.done;o=a.next())Ot(o.value,st(t.j.servers),st(t.j.advanced||{}));return a=function(e,t){for(var n=new Set,r=h(t),i=r.next();!i.done;i=r.next()){var a=h(i.value.drmInfos);for(i=a.next();!i.done;i=a.next())n.add(i.value)}for(r=h(n),i=r.next();!i.done;i=r.next())Ot(i.value,st(e.j.servers),st(e.j.advanced||{}));a=e.L?"required":"optional";var o=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:a,sessionTypes:o,label:i.keySystem,drmInfos:[]});for(n=h(t),i=n.next();!i.done;i=n.next()){a=(i=i.value).audio,o=i.video;var s=a?Rt(a):"",u=o?Rt(o):"",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"),a&&(l.audioCapabilities.push({robustness:i.audioRobustness||"",contentType:s}),"ac-3"==a.codecs.toLowerCase()&&mt()&&l.audioCapabilities.push({robustness:i.audioRobustness||"",contentType:ct(a.mimeType,"ec-3")})),o&&l.videoCapabilities.push({robustness:i.videoRobustness||"",contentType:u})}}return r}(t,n),a.size?(a=Ct(t,a),r?a:a.catch((function(){}))):(t.Z=!0,Promise.resolve())}function Tt(e){return p((function t(){var n;return V(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=Z(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 Gt(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 Zt(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 It(e){return e=at(e=e.h.keys(),(function(e){return e.sessionId})),Array.from(e)}function Rt(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 a=[],o=[],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 a=0;a<e.keyIds.length;++a)i.includes(e.keyIds[a])||i.push(e.keyIds[a])}))}((n=t.get(e.keySystem)).drmInfos,i,a,o,s),1<a.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:a[0],initData:o,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 Gt(e,t){try{B.K("Attempting to load an offline session",t);var n=e.o.createSession("persistent-license")}catch(a){var r=new J(2,6,6005,a.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,Nt(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 Pt(e,t){if(Lt(t).startsWith("com.apple.fps")){var n=t.serverCertificate;e=it(e,rt(e),n)}return e}function Xt(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,a=e.j.advanced[e.g.keySystem];"individualization-request"==t.messageType&&a&&a.individualizationServer&&(i=a.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 o=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()-o)/1e3,B.K("Updating session",n.sessionId),n.update(e.data).then(function(){var e=this;this.J.onEvent(new De("drmsessionupdate")),r&&(r.Ga&&r.Ga.resolve(),new Le((function(){r.loaded=!0,Nt(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 Vt(){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,a,o;return V(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,o=!!(a=i.getConfiguration().sessionTypes)&&a.includes("persistent-license"),gt("Tizen 3")&&(o=!1),n.set(r,{persistentState:o}),k(e,i.createMediaKeys(),5);case 5:L(e,0);break;case 2:Z(e),n.set(r,null),T(e)}}))}));var r})),Promise.all(e).then((function(){return ut(n)}))}function Dt(e,t){var n=t.audio,r=t.video;if(n&&n.encrypted&&!Zt(e,n=Rt(n))||r&&r.encrypted&&!Zt(e,r=Rt(r)))return!1;var i=Lt(e.g);return 0==t.drmInfos.length||t.drmInfos.some((function(e){return e.keySystem==i}))}function Mt(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 a=e[r];i=t[i];var o=[];o=(o=o.concat(a.initData||[])).concat(i.initData||[]);var s=[];s=(s=s.concat(a.keyIds)).concat(i.keyIds),n.push({keySystem:a.keySystem,licenseServerUri:a.licenseServerUri||i.licenseServerUri,distinctiveIdentifierRequired:a.distinctiveIdentifierRequired||i.distinctiveIdentifierRequired,persistentStateRequired:a.persistentStateRequired||i.persistentStateRequired,videoRobustness:a.videoRobustness||i.videoRobustness,audioRobustness:a.audioRobustness||i.audioRobustness,serverCertificate:a.serverCertificate||i.serverCertificate,initData:o,keyIds:s});break}return n}function Wt(e){return p((function t(){var n;return V(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 V(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 V(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:Z(t),B.v("Timeout waiting for session close"),T(t)}}))}))}(e),4);case 4:L(t,0);break;case 2:Z(t),T(t)}}))}))}))),0)}))}))}function Nt(e){return ot(e=e.h.values(),(function(e){return e.loaded}))}function Ot(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 V(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 V(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:Z(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++)Xt(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):Xt(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 a=(i=new DataView(r)).getUint32(0,!0),o=i.getUint16(4,!0),s=i.getUint16(6,!0);i.setUint32(0,a,!1),i.setUint16(4,o,!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(){}))),Nt(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 Ht(){}function jt(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=an,this.lineInterpretation=on,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()},Ht.prototype.init=function(){},Ht.prototype.h=function(){},Ht.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 an="horizontal-tb";Qt.writingMode={HORIZONTAL_TOP_TO_BOTTOM:an,VERTICAL_LEFT_TO_RIGHT:"vertical-lr",VERTICAL_RIGHT_TO_LEFT:"vertical-rl"};var on=0;Qt.lineInterpretation={LINE_NUMBER:on,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 a=n+" "+r,o=new Map,s=(t=h(t)).next();!s.done;s=t.next()){var u=s.value;s=u.stream,o.has(s)||o.set(s,new Map),o.get(s).has(a)||o.get(s).set(a,[]),u.startTime+=i,u.endTime+=i,u.startTime>=e.j&&u.startTime<e.m&&(u=new Qt(u.startTime,u.endTime,u.text),o.get(s).get(a).push(u),s==e.u&&e.i.append([u]))}for(a=(i=h(o.keys())).next();!a.done;a=i.next())for(a=a.value,e.o.has(a)||e.o.set(a,new Map),s=(t=h(o.get(a).keys())).next();!s.done;s=t.next())s=s.value,u=o.get(a).get(s),e.o.get(a).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:jt(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,a,o){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,a):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,a,this.h.video.timestampOffset),Rn(this,n,this.Me.bind(this,n,e.data.buffer))}.bind(t)):(o&&e.muxjs&&(t.g||Sn(t,"text/vtt"),null==i&&null==a?t.A.init(r):t.A.h(r,(function(e){e.length&&bn(t.g,e,i,a,t.h.video.timestampOffset)}))),Rn(t,n,t.Me.bind(t,n,r)))}function Zn(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 In(e,t){return"text"==t?e.g?(e.A.i(),e.g.remove(0,1/0)):Promise.resolve():Rn(e,t,e.Ne.bind(e,t,0,e.m.duration))}function Rn(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)),Gn(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,a={start:function(e){e.resolve()}.bind(null,i),p:i};e.i[n].push(a),r.push(i),1==e.i[n].length&&a.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)Gn(this,n);return e}.bind(e),function(e){throw e}.bind(e))}function Gn(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)),Gn(e,t)}}function Pn(e,t){return e=Vn(e),t=Vn(t),e.split("-")[0]==t.split("-")[0]}function Xn(e,t){e=Vn(e),t=Vn(t);var n=e.split("-"),r=t.split("-");return n[0]==r[0]&&1==n.length&&2==r.length}function Vn(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 Dn(e){return e.language?Vn(e.language):e.audio&&e.audio.language?Vn(e.audio.language):e.video&&e.video.language?Vn(e.video.language):"und"}function Mn(e,t){for(var n=Vn(e),r=new Set,i=h(t),a=i.next();!a.done;a=i.next())r.add(Vn(a.value));for(a=(i=h(r)).next();!a.done;a=i.next())if((a=a.value)==n)return a;for(a=(i=h(r)).next();!a.done;a=i.next())if(Xn(a=a.value,n))return a;for(a=(i=h(r)).next();!a.done;a=i.next()){var o=a=a.value,s=n;if(o=Vn(o),s=Vn(s),o=o.split("-"),s=s.split("-"),2==o.length&&2==s.length&&o[0]==s[0])return a}for(a=(r=h(r)).next();!a.done;a=r.next())if(Xn(n,i=a.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 a in this.g&&n.push(this.g.destroy()),this.l&&n.push(this.l.destroy()),this.u)n.push(this.u[a].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 V(r,(function(r){switch(r.s){case 1:return i=fe,k(r,n.C,2);case 2:e.forEach((function(e,r){var a=ct(e.mimeType,e.codecs);r==i.za?Sn(n,a):(!t&&MediaSource.isTypeSupported(a)||!Te(a,r)||(n.u[r]=new ke,a=xe(r,a)),a=n.m.addSourceBuffer(a),n.o.H(a,"error",n.Dg.bind(n,r)),n.o.H(a,"updateend",n.Lb.bind(n,r)),n.h[r]=a,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):Rn(this,e,this.Ne.bind(this,e,t,n))},r.flush=function(e){return"text"==e?Promise.resolve():Rn(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(),Gn(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"]]),Nn={$d:function(e,t){var n=e.periods.reduce((function(e,t){return e.concat(t.variants)}),[]);n=Nn.ee(n,t),n=Nn.Lf(n),n=Nn.jf(n);for(var r=Nn.kf(n),i=(n=h(e.periods)).next();!i.done;i=n.next())(i=i.value).variants=i.variants.filter((function(e){return Nn.he(e)==r||(B.debug("Dropping Variant (better codec available)",e),!1)}))},Lf:function(e){for(var t=new Me,n=(e=h(e)).next();!n.done;n=e.next()){n=n.value;var r=Nn.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 a=h(i),o=a.next();!o.done;o=a.next()){var s=(o=o.value).video;if(s&&s.width&&s.height){s=s.width*s.height*(s.frameRate||1),n.has(s)||n.set(s,new Me);var u=n.get(s);u.push(e,o),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,a=0,o=h(r),s=o.next();!s.done;s=o.next())i+=s.value.bandwidth||0,++a;i/=a,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=Nn.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&&!Dt(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",Nn.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",Nn.fb(r)),!1):i&&t&&!Nn.Yd(i,t)?(B.debug("Droping variant - not compatible with active audio","active audio",Nn.fb(t),"variant.audio",Nn.fb(i)),!1):!(r&&n&&!Nn.Yd(r,n)&&(B.debug("Droping variant - not compatible with active video","active video",Nn.fb(n),"variant.video",Nn.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,a=[];i&&a.push(i),r&&a.push(r);var o=[];n&&o.push(n.mimeType),t&&o.push(t.mimeType),o=o[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:o,codecs:a.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=Nn.Uf++),e.__shaka_id},Uf:0,Of:function(e){var t=Nn.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=Nn.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:Nn.gd(e),active:!1,type:"",bandwidth:0,language:Vn(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 Nn.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 a=(i=i.value).audio.channelsCount;r.has(a)||r.set(a,[]),r.get(a).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 a=r.length?r[0].language:"";if(r=r.filter((function(e){return e.language==a})),t){var o=Mn(Vn(t),e.map((function(e){return e.language})));o&&(r=e.filter((function(e){return Vn(e.language)==o})))}if(n){if((e=Nn.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?Nn.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 Nn.Pf(e)?"type=audio codecs="+e.codecs+" bandwidth="+e.bandwidth+" channelsCount="+e.channelsCount+" audioSamplingRate="+e.audioSamplingRate:Nn.Sf(e)?"type=video codecs="+e.codecs+" bandwidth="+e.bandwidth+" frameRate="+e.frameRate+" width="+e.width+" height="+e.height:"unexpected stream type"}};function On(){this.m=null,this.i=!1,this.h=new j,this.l=[],this.o=!1,this.g=this.j=null}function Un(e,t){return e&&(t=t.filter((function(t){return Nn.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=jn,i=r.g,a=n.h-i.h;(0<(n.g-i.g||a)?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 Hn(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",On),On.prototype.stop=function(){this.m=null,this.i=!1,this.l=[],this.j=null},On.prototype.stop=On.prototype.stop,On.prototype.init=function(e){this.m=e},On.prototype.init=On.prototype.init,On.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],a=i.bandwidth/this.g.bandwidthDowngradeTarget,o=(e[r+1]||{bandwidth:1/0}).bandwidth/this.g.bandwidthUpgradeTarget;B.O("Bandwidth ranges:",(i.bandwidth/1e6).toFixed(3),(a/1e6).toFixed(3),(o/1e6).toFixed(3)),t>=a&&t<=o&&(n=i)}return this.j=Date.now(),n},On.prototype.chooseVariant=On.prototype.chooseVariant,On.prototype.enable=function(){this.i=!0},On.prototype.enable=On.prototype.enable,On.prototype.disable=function(){this.i=!1},On.prototype.disable=On.prototype.disable,On.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)}},On.prototype.segmentDownloaded=On.prototype.segmentDownloaded,On.prototype.getBandwidthEstimate=function(){return this.h.getBandwidthEstimate(this.g.defaultBandwidthEstimate)},On.prototype.getBandwidthEstimate=On.prototype.getBandwidthEstimate,On.prototype.setVariants=function(e){this.l=e},On.prototype.setVariants=On.prototype.setVariants,On.prototype.configure=function(e){this.g=e},On.prototype.configure=On.prototype.configure,Fn.prototype.toString=function(){return"v"+this.g+"."+this.h};var jn=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 ar(e){return JSON.stringify(e,(function(e,t){if("function"!=typeof t){if(t instanceof Event||t instanceof De){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 or(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,a){this.X=e,this.j=new Le(t),this.Z=n,this.u=!1,this.F=r,this.P=i,this.L=a,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=ar(t),r=cr;try{r.sendMessage("urn:x-cast:com.google.shaka.v2",n,(function(){}),B.error)}catch(i){throw B.error("Cast session sendMessage threw",i),n=new J(2,8,8005,i),e.F("player",new De("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 a=this.J.toString();this.J++,this.i[a]=i;try{mr(this,{type:"asyncCall",targetName:e,methodName:t,args:r,id:a})}catch(o){i.reject(o)}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=or(t);switch(B.O("CastSender: message",n),n.type){case"event":var r=n.event;this.F(n.targetName,new De(r.type,r));break;case"update":for(var i in r=n.update)for(var a in n=this.g[i]||{},r[i])n[a]=r[i][a];this.u&&(this.Z(),this.u=!1);break;case"asyncComplete":if(i=n.id,n=n.error,a=this.i[i],delete this.i[i],a)if(n){for(r in i=new J(n.severity,n.category,n.code),n)i[r]=n[r];a.reject(i)}else a.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(a in r)n(a)&&(i.add(a),t(a,r[a]));for(var a=Object.getPrototypeOf(r),o=Object.getPrototypeOf({});a&&a!=o;){for(var s=h(Object.getOwnPropertyNames(a)),u=s.next();!u.done;u=s.next())n(u=u.value)&&(i.add(u),t(u,r[u]));a=Object.getPrototypeOf(a)}}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 De("caststatuschanged"))}function wr(e){e.j.dispatchEvent(new De(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,a=null;n||(a=e.g.get("video","currentTime")),t&&(e.i.autoplay=!1,r=e.h.load(t,a));var o={};zn.forEach(function(e){o[e]=this.g.get("video",e)}.bind(e)),r.then((function(){e.i&&(zn.forEach(function(e){this.i[e]=o[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 De("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 De("caststatuschanged")),Zr(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),Rr(e,{type:"update",update:t},e.j),Zr(e)}function Zr(e){return!(!e.u||!e.g.duration&&!e.h.aa()||(Ir(e),e.u=!1,0))}function Ir(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 Rr(e,t,n,r){e.F&&(e=ar(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=Gr;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),Rr(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 V(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 De(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 V(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),Rr(this,{type:"event",targetName:e,event:t},this.j))},r.hf=function(){var e=cast.receiver.CastReceiverManager.getInstance().getSystemVolume();e&&Rr(this,{type:"update",update:{video:{volume:e.level,muted:e.muted}}},this.j),Rr(this,{type:"event",targetName:"video",event:{type:"volumechange"}},this.j)},r.fg=function(e){var t=or(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 De("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 a=this.L[n];t=a[r].apply(a,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=or(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":Ir(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&&Ir(this)}.bind(this)).catch(function(e){var n="LOAD_FAILED";7==e.category&&7e3==e.code&&(n="LOAD_CANCELLED"),Rr(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),Rr(this,{requestId:Number(t.requestId),type:"INVALID_REQUEST",reason:"INVALID_COMMAND"},this.o)}},r.Je=function(e,t,n){this.h&&Rr(this,{type:"asyncComplete",id:t,error:n},this.j,e)};var Gr={IDLE:"IDLE",Ue:"PLAYING",Re:"BUFFERING",Te:"PAUSED"};function Pr(e,t){this.S=e,this.h=t==Xr,this.g=0}U("shaka.util.DataViewReader",Pr);var Xr=1;function Vr(){throw new J(2,3,3e3)}function Dr(){this.i=[],this.h=[],this.g=!1}function Mr(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 Nr(e){return function(t){e(t.reader.mb(t.reader.S.byteLength-t.reader.ka()))}}function Or(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 Dr).box("moov",Mr).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!")}Pr.Endianness={Tg:0,Vg:Xr},Pr.prototype.Ca=function(){return this.g<this.S.byteLength},Pr.prototype.hasMoreData=Pr.prototype.Ca,Pr.prototype.ka=function(){return this.g},Pr.prototype.getPosition=Pr.prototype.ka,Pr.prototype.sf=function(){return this.S.byteLength},Pr.prototype.getLength=Pr.prototype.sf,Pr.prototype.ra=function(){try{var e=this.S.getUint8(this.g);return this.g+=1,e}catch(t){Vr()}},Pr.prototype.readUint8=Pr.prototype.ra,Pr.prototype.dc=function(){try{var e=this.S.getUint16(this.g,this.h);return this.g+=2,e}catch(t){Vr()}},Pr.prototype.readUint16=Pr.prototype.dc,Pr.prototype.N=function(){try{var e=this.S.getUint32(this.g,this.h);return this.g+=4,e}catch(t){Vr()}},Pr.prototype.readUint32=Pr.prototype.N,Pr.prototype.De=function(){try{var e=this.S.getInt32(this.g,this.h);return this.g+=4,e}catch(t){Vr()}},Pr.prototype.readInt32=Pr.prototype.De,Pr.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){Vr()}if(2097151<t)throw new J(2,3,3001);return this.g+=8,t*Math.pow(2,32)+e},Pr.prototype.readUint64=Pr.prototype.Pb,Pr.prototype.mb=function(e){this.g+e>this.S.byteLength&&Vr();var t=new Uint8Array(this.S.buffer,this.S.byteOffset+this.g,e);return this.g+=e,t},Pr.prototype.readBytes=Pr.prototype.mb,Pr.prototype.U=function(e){this.g+e>this.S.byteLength&&Vr(),this.g+=e},Pr.prototype.skip=Pr.prototype.U,Pr.prototype.Fe=function(e){this.g<e&&Vr(),this.g-=e},Pr.prototype.rewind=Pr.prototype.Fe,Pr.prototype.seek=function(e){(0>e||e>this.S.byteLength)&&Vr(),this.g=e},Pr.prototype.seek=Pr.prototype.seek,Pr.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)},Pr.prototype.readTerminatedString=Pr.prototype.Cd,U("shaka.util.Mp4Parser",Dr),Dr.prototype.box=function(e,t){var n=Or(e);return this.i[n]=0,this.h[n]=t,this},Dr.prototype.box=Dr.prototype.box,Dr.prototype.ma=function(e,t){var n=Or(e);return this.i[n]=1,this.h[n]=t,this},Dr.prototype.fullBox=Dr.prototype.ma,Dr.prototype.stop=function(){this.g=!0},Dr.prototype.stop=Dr.prototype.stop,Dr.prototype.parse=function(e,t){var n=new Uint8Array(e);for(n=new Pr(new DataView(n.buffer,n.byteOffset,n.byteLength),0),this.g=!1;n.Ca()&&!this.g;)this.Fc(0,n,t)},Dr.prototype.parse=Dr.prototype.parse,Dr.prototype.Fc=function(e,t,n){var r=t.ka(),i=t.N(),a=t.N(),o=!1;switch(B.O("Parsing MP4 box",Ur(a)),i){case 0:i=t.S.byteLength-r;break;case 1:i=t.Pb(),o=!0}var s=this.h[a];if(s){var u=null,c=null;1==this.i[a]&&(u=(c=t.N())>>>24,c&=16777215),a=r+i,n&&a>t.S.byteLength&&(a=t.S.byteLength),a-=t.ka(),t=0<a?t.mb(a):new Uint8Array(0),s({parser:this,partialOkay:n||!1,version:u,flags:c,reader:t=new Pr(new DataView(t.buffer,t.byteOffset,t.byteLength),0),size:i,start:r+e,has64BitSize:o})}else t.U(Math.min(r+i-t.ka(),t.S.byteLength-t.ka()))},Dr.prototype.parseNext=Dr.prototype.Fc,Dr.children=Mr,Dr.sampleDescription=Wr,Dr.allData=Nr,Dr.typeToString=Ur,Dr.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(a){}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){}}},Hr=(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 jr(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 a=[],o=new Set(r.map((function(e){return e.keyId})));if(o.delete(null),1<o.size)throw new J(2,4,4010);if(n||(a=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 a=Hr.get(i.Ge);if(a){var o;if(o=Kr.Yc(i.node,"urn:microsoft:playready","pro")){o=Se.Ja(o.textContent);var s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]),u=o.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(o,f),o=[{initData:d,initDataType:"cenc",keyId:i.keyId}]}else o=null;o=he(a,i.init||e||o),(a=Jr.get(a))&&(o.licenseServerUri=a(i)),r.push(o)}else for(a=(i=h(i=t(i.node)||[])).next();!a.done;a=i.next())r.push(a.value)}return r}(i,t,a),0==e.length&&(e=[he("",i)])),r.length&&(n||!a.length))for(e=[],n=(t=h(Hr.values())).next();!n.done;n=t.next())"org.w3.clearkey"!=(n=n.value)&&e.push(he(n,i));if(o=Array.from(o)[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=o;return{be:o,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 a=r.getUint16(t,!0);t+=2;var o=new Uint8Array(e,t,a);n.push({type:i,value:o}),t+=a}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(a){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,a){var o={RepresentationID:n,Number:r,Bandwidth:i,Time:a};return t.replace(/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)([diouxX]))?\$/g,(function(n,r,i,a){if("$$"==n)return"$";var s=o[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)),a){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"),a=Number($r(e,t,"presentationTimeOffset"))||0,o=Kr.Mb(i||"");null!=i&&null!=o||(o=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=-a,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-=a),!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:o,sa:a/r||0,Vd:a,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,a){if(a=void 0===a?0:a,Kr.getAttributeNS(e,"http://www.w3.org/1999/xlink","href")){var o=function(e,t,n,r,i,a){for(var o=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<=a)return Ce(new J(2,4,4028));if("onLoad"!=s)return Ce(new J(2,4,4027));var l=de([r],[o]);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,o));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,a+1)}))}(e,t,n,r,i,a);return n&&(o=o.ca(void 0,(function(){return ti(e,t,n,r,i,a)}))),o}o=[];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&&o.push(ti(u,t,n,r,i,a)))}return Ve(o).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,a){this.position=e,this.startTime=t,this.endTime=n,this.i=r,this.h=i,this.g=a}function ii(e,t,n,r){var i,a=(new Dr).ma("sidx",(function(e){i=function(e,t,n,r){var i=[];r.reader.U(4);var a=r.reader.N();if(0==a)throw B.error("Invalid timescale."),new J(2,3,3005);if(0==r.version)var o=r.reader.N(),s=r.reader.N();else o=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,o/a-t,(o+d)/a-t,(function(){return n}),e,e+c-1)),o+=d,e+=c}return r.parser.stop(),i}(t,r,n,e)}));if(e&&a.parse(e),i)return i;throw B.error('Invalid box type, expected "sidx".'),new J(2,3,3004)}function ai(e){this.g=e}function oi(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 Pr(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 a=null;return(n=Kr.R(n,"range",Kr.Hc))&&(i=n.start,a=n.end),new ni((function(){return r}),i,a)}function mi(e,t,n,r,i,a,o,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,a),"webm"==o?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"==o?ii(t,i,r,s):(new hi).parse(t,e,r,s),u.Jb(t,l),f=new ai(t),c&&oi(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),a=i.ob;0==a&&(B.v("SegmentList@startNumber must be > 0"),a=1);var o=0;if(i.ia?o=i.ia*(a-1):i.W&&0<i.W.length&&(o=i.W[0].start),!(r={ia:i.ia,startTime:o,ob:a,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 a=i=null,e.qa.id&&e.G.id&&(i=t[a=e.qa.id+","+e.G.id]),o=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 a=[],o=r.startTime,s=0;s<i;s++){var u=r.jb[s],c=de(n,[u.Tf]),l=void 0;l=null!=r.ia?o+r.ia:r.W?r.W[s].end:o+e,a.push(new ri(s+t,o,l,function(e){return e}.bind(null,c),u.start,u.end)),o=l}return a}(e.$.duration,r.ob,e.G.xa,r),i?(i.sd(o),a=e.presentationTimeline.$b(),i.Vc(a-e.$.start)):(e.presentationTimeline.Jb(o,e.$.start),i=new ai(o),a&&e.zb&&(t[a]=i)),e.zb&&e.$.ld||oi(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),a=qr(e,Ai),o=$r(e,Ai,"media"),s=$r(e,Ai,"index");if(o=(a={ia:a.ia,timescale:a.timescale,ob:a.ob,sa:a.sa,Vd:a.Vd,W:a.W,qd:o,bc:s}).bc?1:0,o+=a.W?1:0,0==(o+=a.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!=o&&(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),a.bc?(B.info("Using the index URL template by default."),a.W=null):B.info("Using the SegmentTimeline by default."),a.ia=null),!a.bc&&!a.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(a.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(a.bc,e.G.id,null,e.bandwidth||null,null),e=mi(e,t,i,r=de(e.G.xa,[r]),0,null,n,a.sa)}else a.ia?(r||(e.presentationTimeline.ud(a.ia),e.presentationTimeline.vd(e.$.start)),e=function(e,t){var n=e.$.duration,r=t.ia,i=t.ob,a=t.timescale,o=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(o,u,e+i,s,t*a);return de(c,[n])}),0,null)}}}(e,a)):(o=t=null,e.qa.id&&e.G.id&&(t=n[o=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,a){return de(r,[e=Qr(e,t,i,n,a)]).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,a),r=!e.zb||!e.$.ld,t?(r&&oi(new ai(s),e.$.duration),t.sd(s),n=e.presentationTimeline.$b(),t.Vc(n-e.$.start)):(e.presentationTimeline.Jb(s,e.$.start),t=new ai(s),o&&e.zb&&(n[o]=t)),r&&oi(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:a.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",ai),ai.prototype.destroy=function(){return this.g=null,Promise.resolve()},ai.prototype.destroy=ai.prototype.destroy,ai.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},ai.prototype.find=ai.prototype.find,ai.prototype.get=function(e){return 0==this.g.length||0>(e-=this.g[0].position)||e>=this.g.length?null:this.g[e]},ai.prototype.get=ai.prototype.get,ai.prototype.offset=function(e){for(var t=0;t<this.g.length;++t)this.g[t].startTime+=e,this.g[t].endTime+=e},ai.prototype.offset=ai.prototype.offset,ai.prototype.sd=function(e){for(var t=[],n=0,r=0;n<this.g.length&&r<e.length;){var i=this.g[n],a=e[r];i.startTime<a.startTime?(t.push(i),n++):(i.startTime>a.startTime?0==n?t.push(a):B.v("Refusing to rewrite original references on update!"):(.1<Math.abs(i.endTime-a.endTime)?t.push(new ri(i.position,a.startTime,a.endTime,a.i,a.h,a.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},ai.prototype.merge=ai.prototype.sd,ai.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=[]},ai.prototype.evict=ai.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 a=ui(t);if(408125543!=a.id)throw B.error("Not a Segment element."),new J(2,3,3009);for(t=a.g.byteOffset,a=new si(a.g),i=null;a.Ca();){var o=ui(a);if(357149030==o.id){i=o;break}}if(!i)throw B.error("Not an Info element."),new J(2,3,3010);for(a=new si(i.g),i=1e6,o=null;a.Ca();){var s=ui(a);if(2807729==s.id)i=di(s);else if(17545==s.id)if(4==(o=s).g.byteLength)o=o.g.getFloat32(0);else{if(8!=o.g.byteLength)throw new J(2,3,3003);o=o.g.getFloat64(0)}}if(null==o)throw new J(2,3,3011);if(i=o*(a=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,a){function o(){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-a,l-a,o,c,d-1)),u=l,c=d)}}return null!=u&&s.push(new ri(s.length,u-a,r-a,o,c,null)),s}(e,t,a,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 V(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=Z(t),e.h&&(r.severity=1,e.h.onError(r));case 3:if(!e.h)return t.return();Zi(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,a,o,s,u,c,l,d,h,f,p,m,y,v,g,b,A,_,w,S,x,E,L,Z;return V(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 I={zb:"static"!=b,presentationTimeline:w,qa:null,$:null,fa:null,G:null,bandwidth:0,me:!1},R=f,C=Kr.R(t,"mediaPresentationDuration",Kr.Ma),G=[],P=0,X=Kr.Y(t,"Period"),V=0;V<X.length;V++){var D=X[V];P=Kr.R(D,"start",Kr.Ma,P);var M=Kr.R(D,"duration",Kr.Ma),W=null;if(V!=X.length-1){var N=Kr.R(X[V+1],"start",Kr.Ma);null!=N&&(W=N-P)}else null!=C&&(W=C-P);if(N=pe,W&&M&&Math.abs(W-M)>N&&B.v("There is a gap/overlap between Periods",D),null==W&&(W=M),D=xi(e,I,R,{start:P,duration:W,node:D,ld:null==W||V==X.length-1}),G.push(D),M=I.qa.id,e.u.includes(M)||(e.u.push(M),e.i&&(e.h.filterNewPeriod(D),e.i.periods.push(D))),null==W){V!=X.length-1&&B.v("Skipping Period",V+1,"and any subsequent Periods:","Period",V+1,"does not have a valid start time.",G[V+1]),P=null;break}P+=W}if(null==e.i&&e.h.filterAllPeriods(G),null!=C?(P!=C&&B.v("@mediaPresentationDuration does not match the total duration of all","Periods."),i=G,a=C,o=!1):(i=G,a=P,o=!0),x=a,E=i,w.hc("static"==b),"static"!=b&&o||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 Ri(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 Ri(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(Z=r.B,!e.h)return r.return();w.Ke(Z),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=Ii(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),a=i.next();!a.done;a=i.next())for(var o=(a=h(a.value.tg)).next();!o.done;o=a.next())t.push(o.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=[],a=0;a<i.length;a++)for(o=0;o<t.length;o++)Li(e,i[a],t[o],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,a=n.drmInfos;if(!i.length||!a.length||0<Mt(i,a).length){a=Mt(t.drmInfos,n.drmInfos);for(var o=0;o<t.streams.length;o++)for(var s=0;s<n.streams.length;s++)i=(n.streams[s].bandwidth||0)+(t.streams[o].bandwidth||0),i={id:e.m++,language:t.language,primary:t.pd||n.pd,audio:t.streams[o],video:n.streams[s],bandwidth:i,drmInfos:a,allowedByApplication:!0,allowedByKeySystem:!0},r.push(i)}}else for(a=t||n,o=0;o<a.streams.length;o++)i=a.streams[o].bandwidth||0,i={id:e.m++,language:a.language||"und",primary:a.pd,audio:t?a.streams[o]:null,video:n?a.streams[o]:null,bandwidth:i,drmInfos:a.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},r.push(i)}function Zi(e,t){0>e.C||e.o.V(Math.max(3,e.C-t,H(e.F)))}function Ii(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,a=Kr.Y(e,"BaseURL").map(Kr.uc),o=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,o||(o=Ci(s,u)),{xa:de(n,a),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:o,mimeType:s,codecs:u,frameRate:i,pixelAspectRatio:c,emsgSchemeIdUris:d,id:e.getAttribute("id"),wd:l,audioSamplingRate:f}}function Ri(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 Gi(e,t,n,r){this.h=e,this.type=t,this.g=n,this.segments=r||null}function Pi(e,t,n,r){this.id=e,this.name=t,this.g=n,this.value=void 0===r?null:r}function Xi(e,t){this.name=e,this.value=t}function Vi(e,t,n){return(e=e.getAttribute(t))?e.value:n||null}function Di(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 a,o;return V(i,(function(i){switch(i.s){case 1:return x(i,2),k(i,_i.rf(e,t,n,r),4);case 4:return a=i.B,i.return(new a);case 2:throw(o=Z(i)).severity=2,o}}))}))},_i.rf=function(e,t,n,r){return p((function i(){var a,o,s,u,c;return V(i,(function(i){switch(i.s){case 1:if(a=_i,r){if(o=a.Nb[r.toLowerCase()])return i.return(o);B.v("Could not determine manifest type using MIME type ",r)}if(s=a.getExtension(e)){if(u=a.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,a.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,a,o;return V(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 a=r.B,o=a.headers["content-type"],r.return(o?o.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 V(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&&Zi(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=Ii(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),a=void 0,o="text"==e.fa.contentType;o&&(a="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":a=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,Vn(t))}}(r)):d.set("CC1","und")):"urn:mpeg:dash:role:2011"==u&&null!=f&&(i.push(f),"captions"==f&&(a="caption"))}if(l)return null;var p=jr(r=Kr.Y(t,"ContentProtection"),this.g.dash.customScheme,this.g.dash.ignoreDrmInfo);if(r=Vn(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,a,r,s,n,i,d)).filter((function(e){return!!e}))).length){if(this.g.dash.ignoreEmptyAdaptationSet||o)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)}))})),o=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:o}},r.lg=function(e,t,n,r,i,a,o,s,u){if(e.G=Ii(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 a=e.G.contentType;if(i=e.G.mimeType.split("/")[1],"text"!=a&&"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);a=ei(e,yi,"RepresentationIndex");var o=$r(e,yi,"indexRange"),s=e.G.xa;if(o=Kr.Hc(o||""),a){var u=a.getAttribute("sourceURL");u&&(s=de(e.G.xa,[u])),o=Kr.R(a,"range",Kr.Hc,o)}if(!o)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,o.start,o.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=jr(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:a,trickModeVideo:null,emsgSchemeIdUris:e.G.emsgSchemeIdUris,roles:o,channelsCount:e.G.wd,audioSamplingRate:e.G.audioSamplingRate,closedCaptions:s}},r.kg=function(e,t,n){var r=Kr.Mb,i=n.getAttribute("schemeIdUri")||"",a=n.getAttribute("value")||"",o=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/o+e)+u/o,null!=t&&(s=Math.min(s,e+t),u=Math.min(u,e+t)),n={schemeIdUri:i,value:a,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),Pi.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},Pi.prototype.getAttribute=function(e){var t=this.g.filter((function(t){return t.name==e}));return t.length?t[0]:null};var Mi={Ab:function(e,t){return e.filter((function(e){return e.name==t}))},cb:function(e,t){var n=Mi.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 Ni(e){Oi(e,/[ \t]+/gm)}function Oi(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=Oi(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(!Mi.kd(r[i])){var a=Hi(e,r[i]);if(--e.g,ji.includes(a.name)){t=1;break}"EXT-X-STREAM-INF"==a.name&&(i+=1)}for(i=[],a=1;a<r.length;)if(Mi.kd(r[a]))a+=1;else{var o=Hi(e,r[a]);if(Bi.includes(o.name)){if(1!=t)throw new J(2,4,4017);return new Gi(n,t,i,e=Ki(e,n,r=r.splice(a,r.length-a),i))}i.push(o),a+=1,"EXT-X-STREAM-INF"==o.name&&(o.g.push(new Xi("URI",r[a])),a+=1)}return new Gi(n,t,i)}function Ki(e,t,n,r){var i=[],a=[];return n.forEach((function(n){if(/^(#EXT)/.test(n))n=Hi(e,n),ji.includes(n.name)?r.push(n):a.push(n);else{if(Mi.kd(n))return[];n=Mi.Sc(t,n.trim()),i.push(new Di(n,a)),a=[]}})),i}function Hi(e,t){var n=e.g++,r=t.match(/^#(EXT[^:]*)(?::(.*))?$/);if(!r)throw new J(2,4,4016,t);var i,a=r[1],o=r[2];if(r=[],o){var s;(s=Oi(o=new Wi(o),/^([^,=]+)(?:,|$)/g))&&(i=s[1]);for(var u=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g;s=Oi(o,u);)r.push(new Xi(s[1],s[2]||s[3]))}return new Pi(n,a,r,i)}var ji="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 Pe({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 V(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=Z(t),!e.j)return t.return();r.severity=1,e.j.onError(r),e.m.V(.1),T(t)}}))}))}(e)})),this.l=ya,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,a,o,s,u,c,l,d,h;return V(n,(function(n){switch(n.s){case 1:return r=Mi,i=va,a=t.We,k(n,pa(e,Je([a],e.g.retryParameters),0),2);case 2:if(o=n.B,1!=(s=Yi(e.C,o.data,o.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,aa(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")&&(fa(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 ea(e,t,n){return p((function r(){var i,a,o,s,u,c,l,d,h,f,p;return V(r,(function(r){switch(r.s){case 1:if(i=ua(t,"URI"),e.h.has(i))return r.return(e.h.get(i));if(a=ua(t,"TYPE").toLowerCase(),o=fe,"subtitles"==a&&(a=o.za),s=Vn(Vi(t,"LANGUAGE","und")),u=Vi(t,"NAME"),c=t.getAttribute("DEFAULT"),l="YES"==c,d=Vi(t,"CHANNELS"),"audio"==a)if(d){var m=d.split("/")[0];m=parseInt(m,10)}else m=null;else m=null;return h=m,f=Vi(t,"CHARACTERISTICS"),k(r,ta(e,i,n,a,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 ta(e,t,n,r,i,a,o,s,u,c){return p((function l(){var d,f,m,y,v,g,b,A,_,w,S,T,E,I,R,C,G,P,X,D,M,W,N,O,U,F,Y,K;return V(l,(function(l){switch(l.s){case 1:return f=(d=Mi).Sc(e.F,t),k(l,pa(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 H=h(v),j=H.next();!j.done;j=H.next())if(_=j.value,"NONE"!=(w=ua(_,"METHOD"))){if(g=!0,"AES-128"==w)return B.v("Unsupported HLS Encryption",w),e.da=!0,l.return(null);S=ua(_,"KEYFORMAT"),(E=(T=ma[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=va,r=Mi.cb(t.g,"EXT-X-PLAYLIST-TYPE"),i=Mi.cb(t.g,"EXT-X-ENDLIST");i=r&&"VOD"==r.value||i,r=r&&"EVENT"==r.value&&!i,r=!i&&!r,i?fa(e,n.$a):(fa(e,r?n.Wd:n.Se),n=ca(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),I=function(e,t){if(1==t.length)return t[0];var n=sa(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 a,o,s,u,c,l,d,h,f,p;return V(i,(function(i){switch(i.s){case 1:return a=fe,o=r.segments[0].g,s=new Q(o),u=s.pa.split(".").pop(),c=ha[t],(l=c[u])?i.return(l):t==a.za?n&&"vtt"!=n&&"wvtt"!=n?i.return("application/mp4"):i.return("text/vtt"):((d=Je([o],e.g.retryParameters)).method="HEAD",k(i,pa(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,I,y),3);case 3:return R=l.B,da.includes(R)&&(I=""),G=(C=d.cb(y.g,"EXT-X-MEDIA-SEQUENCE"))?Number(C.value):0,x(l,4),k(l,aa(e,t,y,G,R,I),6);case 6:P=l.B,L(l,5);break;case 4:if(4035==(X=Z(l)).code)return B.ba("Skipping unsupported HLS stream",R,t),l.return(null);throw X;case 5:if(D=P[0].startTime,M=P[P.length-1].endTime,W=M-D,N=new ai(P),O=na(y),U=void 0,"text"==r&&(U="subtitle"),F=[],c)for(j=(H=h(c.split(","))).next();!j.done;j=H.next())Y=j.value,F.push(Y);return K={id:e.ea++,originalId:o,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:N.find.bind(N),getSegmentReference:N.get.bind(N),initSegmentReference:O,presentationTimeOffset:0,mimeType:R,codecs:I,kind:U,encrypted:g,keyId:A,language:i,label:o,type:r,primary:a,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:N,drmInfos:b,Pc:t,We:f,td:D,Yg:M,duration:W})}}))}))}function na(e){var t=Mi.Ab(e.g,"EXT-X-MAP");if(!t.length)return null;if(1<t.length)throw new J(2,4,4020);var n=ua(t=t[0],"URI"),r=Mi.Sc(e.h,n);return e=0,n=null,(t=Vi(t,"BYTERANGE"))&&(e=t.split("@"),t=Number(e[0]),n=(e=Number(e[1]))+t-1),new ni((function(){return[r]}),e,n)}function ra(e,t,n,r){var i=t.h,a=t.g;t=ca(i,"EXTINF").value.split(","),t=r+Number(t[0]);var o=0,s=null;return(i=Mi.cb(i,"EXT-X-BYTERANGE"))&&(o=i.value.split("@"),i=Number(o[0]),s=(o=o[1]?Number(o[1]):e.g+1)+i-1),new ri(n,r,t,(function(){return[a]}),o,s)}function ia(e){e.i&&(e.P.forEach((function(t){e.i.Jb(t,0)})),e.P=[])}function aa(e,t,n,r,i,a){return p((function o(){var s,u,c,l,d,h,f,m,y,v;return V(o,(function(o){switch(o.s){case 1:return s=n.segments,u=[],c=s[0].g,l=ra(null,s[0],r,0),d=na(n),k(o,function(e,t,n,r,i,a){return p((function o(){var s,u,c,l,d,h,f,p,m;return V(o,(function(o){switch(o.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"),o.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(),da.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){o.I(2);break}return l=[oa(e,r)],n&&l.push(oa(e,n)),k(o,Promise.all(l),3);case 3:return d=o.B,h=d[0],f=d[1]||d[0],o.return(function(e,t,n,r){var i=0;if((new Dr).box("moov",Mr).box("trak",Mr).box("mdia",Mr).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 a=0,o=!1;if((new Dr).box("moof",Mr).box("traf",Mr).ma("tfdt",(function(e){a=(0==e.version?e.reader.N():e.reader.Pb())/i,o=!0,e.parser.stop()})).parse(n,!0),!o)throw new J(2,4,4030,e,t);return a}(t,h.uri,h.data,f.data));case 2:if("video/mp2t"!=i){o.I(4);break}return k(o,oa(e,r),5);case 5:return p=o.B,o.return(function(e,t,n){function r(){a.seek(o+188),71!=(s=a.ra())&&(a.seek(o+192),s=a.ra()),71!=s&&(a.seek(o+204),s=a.ra()),71!=s&&i(),a.Fe(1)}function i(){throw new J(2,4,4030,e,t)}for(var a=new Pr(new DataView(n),0),o=0,s=0;;)if(o=a.ka(),71!=(s=a.ra())&&i(),8191==(8191&(n=a.dc())))r();else if(16384&n){if(0!=(n=(48&a.ra())>>4)&&2!=n||i(),3==n&&(n=a.ra(),a.U(n)),1==a.N()>>8)return a.U(3),0!=(n=a.ra()>>6)&&1!=n||i(),0==a.ra()&&i(),(1073741824*((14&(n=a.ra()))>>1)+((65534&a.dc())<<14|(65534&a.dc())>>1))/9e4;r()}else r()}(t,p.uri,p.data));case 4:if("application/mp4"!=i&&!i.startsWith("text/")){o.I(6);break}return k(o,oa(e,r),7);case 7:return m=o.B,o.return(function(e,t,n){return vn(e=ct(e,t))?(gn(t=new mn(null),e),t.xc(n)):0}(i,a,m.data));case 6:throw new J(2,4,4030,t)}}))}))}(e,t,d,l,i,a),2);case 2:h=o.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=ra(m,f,r+g,y),u.push(v);return e.P.push(u),ia(e),o.return(u)}}))}))}function oa(e,t){return p((function n(){var r,i,a,o,s,u;return V(n,(function(n){switch(n.s){case 1:return r=1,i=Si(t.i(),t.h,t.h+2048-1,e.g.retryParameters),a=Si(t.i(),t.h,t.g,e.g.retryParameters),e.g.hls.useFullSegmentsForStartTime?n.return(pa(e,a,r)):(x(n,2),k(n,pa(e,i,r),4));case 4:return o=n.B,n.return(o);case 2:if(7001==(s=Z(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,pa(e,a,r),5);case 5:return u=n.B,n.return(u)}}))}))}function sa(e,t){for(var n=la[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 ua(e,t){var n=e.getAttribute(t);if(!n)throw new J(2,4,4023,t);return n.value}function ca(e,t){var n=Mi.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,a;return V(r,(function(r){switch(r.s){case 1:return n.j=t,k(r,pa(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,a,o,s,u,c,l,d,f,m;return V(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,a,o,s,u,c,l,d,f,m,y;return V(n,(function(n){switch(n.s){case 1:return r=Mi,i=le,a=t.g,o=r.Ab(t.g,"EXT-X-MEDIA"),s=o.filter(function(e){return"SUBTITLES"==ua(e,"TYPE")}.bind(e)),u=s.map(function(e){var t=this;return p((function n(){var r;return V(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 V(n,(function(n){switch(n.s){case 1:return ua(t,"TYPE"),k(n,ea(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=Z(n),t.g.hls.ignoreTextStreamFailures)return n.return(null);throw r}}))}))}.bind(e)),c=o.filter((function(e){return"CLOSED-CAPTIONS"==ua(e,"TYPE")})),function(e,t){for(var n=h(t),r=n.next();!r.done;r=n.next()){ua(r=r.value,"TYPE");var i=Vi(r,"LANGUAGE")||"und";i=Vn(i);var a=ua(r,"GROUP-ID");r=ua(r,"INSTREAM-ID"),e.u.get(a)||e.u.set(a,new Map),e.u.get(a).set(r,i)}}(e,c),k(n,Promise.all(u),2);case 2:return l=n.B,d=r.Ab(a,"EXT-X-STREAM-INF"),f=d.map(function(e){return function(e,t,n){return p((function r(){var i,a,o,s,u,c,l,d,f,m,y,v,g,b,A,_,w,S,T,x,E,L,Z,I,R,C,G,P,X;return V(r,(function(r){switch(r.s){case 1:return i=fe,a=Mi,o=[],e.g.disableVideo||o.push("avc1.42E01E"),e.g.disableAudio||o.push("mp4a.40.2"),s=o.join(","),u=Vi(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=Vi(t,"FRAME-RATE"),y=Number(Vi(t,"AVERAGE-BANDWIDTH"))||Number(ua(t,"BANDWIDTH")),l&&(v=l.value.split("x"),d=v[0],f=v[1]),g=(g=a.Ab(n.g,"EXT-X-MEDIA")).filter((function(e){return"CLOSED-CAPTIONS"!=ua(e,"TYPE")})),g=g.filter((function(e){var t=Vi(e,"URI")||"";return"SUBTITLES"==(Vi(e,"TYPE")||"")||""!=t})),b=Vi(t,"AUDIO"),A=Vi(t,"VIDEO"),b?g=a.Zc(g,"AUDIO",b):A&&(g=a.Zc(g,"VIDEO",A)),(_=sa(i.za,c))&&((w=Vi(t,"SUBTITLES"))&&(S=a.Zc(g,"SUBTITLES",w)).length&&(T=e.L.get(S[0].id))&&(T.stream.codecs=_),Ue(c,_)),x=g.map(function(e){return ea(this,e,c)}.bind(e)),E=[],L=[],k(r,Promise.all(x),2);case 2:if(I=(I=r.B).filter((function(e){return null!=e})),b?E=I:A&&(L=I),B.debug("Guessing stream type for",t.toString()),C=!1,E.length||L.length?E.length?(P=ua(t,"URI"),X=E[0].Pc,P==X?(B.debug("Guessing audio-only."),R=i.Sb,C=!0):(B.debug("Guessing video."),R=i.Za)):(B.debug("Guessing audio."),R=i.Sb):1==c.length?(G=sa(i.Za,c),l||m||G?(B.debug("Guessing video-only."),R=i.Za):(B.debug("Guessing audio-only."),R=i.Sb)):(B.debug("Guessing multiplexed audio+video."),R=i.Za,c=[c.join(",")]),C){r.I(3);break}return k(r,function(e,t,n,r){return p((function i(){var a,o,s,u,c;return V(i,(function(i){switch(i.s){case 1:return a=fe,o=ua(t,"URI"),e.h.has(o)?i.return(e.h.get(o)):(s=Vi(t,"CLOSED-CAPTIONS"),u=null,r==a.Za&&s&&"NONE"!=s&&(u=e.u.get(s)),k(i,ta(e,o,n,r,"und",!1,null,null,u,null),2));case 2:return null==(c=i.B)?i.return(null):e.h.has(o)?i.return(e.h.get(o)):(e.h.set(o,c),i.return(c))}}))}))}(e,t,c,R),4);case 4:Z=r.B;case 3:if(Z)Z.stream.type==i.Sb?E=[Z]:L=[Z];else if(null===Z)return B.debug("streamInfo is null"),r.return([]);return L&&qi(L),E&&qi(E),r.return(function(e,t,n,r,i,a,o){n.forEach(function(e){(e=e.stream)&&(e.width=Number(i)||void 0,e.height=Number(a)||void 0,e.frameRate=Number(o)||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<Mt(p,m).length)){B.v("Incompatible DRM info in HLS variant. Skipping.");continue}y=Mt(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]),a=1/0,o=0,s=1/0;for(var y=h(e.h.values()),v=y.next();!v.done;v=y.next())u=v.value,a=Math.min(a,u.td),o=Math.max(o,u.td),"text"!=u.stream.type&&(s=Math.min(s,u.duration));if(e.l!=va.$a?(e.i=new wi(0,3*e.J),e.i.hc(!1)):(e.i=new wi(null,0),e.i.hc(!0)),ia(e),e.l!=va.$a){for(e.X=e.M,c=va,e.l==c.Wd&&(l=e.i.Ic,isNaN(e.g.availabilityWindowOverride)||(l=e.g.availabilityWindowOverride),e.i.Pd(l)),d=0;95443.7176888889<=o;)d+=95443.7176888889,o-=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(-a),v=(y=h(e.h.values())).next();!v.done;v=y.next())(m=v.value).stream.presentationTimeOffset=a,m.fc.offset(-a),oi(m.fc,s);e.A={presentationTimeline:e.i,periods:[i],offlineSessionIds:[],minBufferTime:0},T(n)}}))}))}(n,i.data),3);case 3:return 0<(a=n.X)&&n.m.V(a),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!=va.$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 la={audio:[/^vorbis$/,/^opus$/,/^flac$/,/^mp4a/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]},da=["audio/aac","audio/ac3","audio/ec3","audio/mpeg"],ha={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 fa(e,t){e.l=t,e.i&&e.i.hc(e.l==va.$a),e.l!=va.$a||e.m.stop()}function pa(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 ma={"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(e){var t=ua(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=ua(e,"URI"),t=Ji.parse(t),t=he("com.widevine.alpha",[{initDataType:"cenc",initData:t=new Uint8Array(t.data)}]),(e=Vi(e,"KEYID"))&&(t.keyIds=[e.toLowerCase().substr(2)]),t):(B.error("Widevine in HLS is only supported with [",n.join(", "),"], not",t),null)}},ya="VOD",va={$a:ya,Se:"EVENT",Wd:"LIVE"};function ga(){this.g=new Map}function ba(e,t,n){Aa(e,t).text=n}function Aa(e,t){return e.g.has(t)||e.g.set(t,new _a),e.g.get(t)}function _a(){this.text=this.variant=null}function wa(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 Sa(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&&ka(n,r)&&Ta(n.roles,r.roles))}return!n&&(n=e.video&&t.video)&&(n=!(ka(n=e.video,r=t.video)&&Ta(n.roles,r.roles))),!n}function ka(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 Ta(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 xa(e){this.g=e,this.h=new Ea(e.language,"",e.audio&&e.audio.channelsCount?e.audio.channelsCount:0,"")}function Ea(e,t,n,r){this.i=e,this.j=t,this.g=n,this.h=void 0===r?"":r}function La(){this.g=Ra,this.h=(new Map).set(Ra,2).set(Ia,1)}function Za(e,t,n){e.h.set(Ra,n).set(Ia,t)}_i.Fd("m3u8",zi),_i.Qb("application/x-mpegurl",zi),_i.Qb("application/vnd.apple.mpegurl",zi),wa.prototype.add=function(e){return Sa(this.g,e)?(this.h.add(e),!0):(B.v("Rejecting variant - not compatible with root."),!1)},wa.prototype.values=function(){return this.h.values()},xa.prototype.create=function(e){var t=this,n=e.filter((function(e){return Sa(t.g,e)}));return n.length?new wa(n[0],n):this.h.create(e)},Ea.prototype.create=function(e){var t=[];t=function(e,t){var n=Vn(t),r=Mn(n,e.map((function(e){return Dn(e)})));return r?e.filter((function(e){return r==Dn(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=Nn.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 wa(t[0]),n=(t=h(t)).next();!n.done;n=t.next())n=n.value,Sa(e.g,n)&&e.add(n);return e};var Ia=0,Ra=1;function Ca(e,t){this.l=e,this.m=Pa(e),this.g=e.g.currentTime,this.j=Date.now()/1e3,this.h=!1,this.o=t,this.i=function(){}}function Ga(e){this.g=e}function Pa(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 Xa(e,t,n,r,i){var a=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 Va(a)})),this.l=new Le((function(){Va(a)})).Oa(.25)}function Va(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=Pa(n),i=n.g.currentTime,a=Date.now()/1e3;t.g==i&&t.m==r||(t.j=a,t.g=i,t.m=r,t.h=!1),(r=(i=a-t.j)>=t.o&&r&&!t.h)&&(t.i(t.g,i),t.h=!0,t.g=n.g.currentTime),t=!r}if(t){a=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 o=e.F.Ka();if(!(i>=o)){a=(o=i-t)<=a;var s=!1;if(!(.001>o)){if(!a&&!e.i){e.i=!0;var u=new De("largegap",{currentTime:t,gapSize:o});u.cancelable=!0,e.u(u),e.C.jumpLargeGaps&&!u.defaultPrevented?s=!0:B.info("Ignoring large gap at",t,"size",o)}(a||s)&&(0==r?B.info("Jumping forward",o,"seconds because of gap before start time of",i):B.info("Jumping forward",o,"seconds because of gap starting at",n.end(r-1),"and ending at",i),e.g.currentTime=i)}}}}}}}function Da(e){var t=this;this.i=e,this.g=new Set,this.h=new Le((function(){Ma(t,!1)})).Oa(.25)}function Ma(e,t){for(var n=h(e.g),r=n.next();!r.done;r=n.next())r.value.l(e.i.currentTime,t)}function Wa(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 Na(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 Oa(e){this.i=e,this.g=null,this.h=function(){}}function Ua(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 Fa(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 Ya(e,t,n,r){t==HTMLMediaElement.HAVE_NOTHING||e.readyState>=t?r():(t=Ka.get(t),n.ya(e,t,r))}Ca.prototype.release=function(){this.l=null,this.i=function(){}},Xa.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},Xa.prototype.zd=function(){this.m=!0,Va(this)},Da.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()},Oa.prototype.release=function(){this.g=this.i=null,this.h=function(){}},Oa.prototype.l=function(e){var t=this.g,n=this.i.periods;t!=(e=Na(n,e)||n[0])&&this.h(e),this.g=e},Ua.prototype.release=function(){this.h&&(this.h.stop(),this.h=null),this.g=null},Ua.prototype.set=function(e){this.i=e,Fa(this)},Ua.prototype.vc=function(){return this.g.vc()};var Ka=new Map([[HTMLMediaElement.HAVE_METADATA,"loadedmetadata"],[HTMLMediaElement.HAVE_CURRENT_DATA,"loadeddata"],[HTMLMediaElement.HAVE_FUTURE_DATA,"canplay"],[HTMLMediaElement.HAVE_ENOUGH_DATA,"canplaythrough"]]);function Ha(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 Qa(e),Ya(this.g,HTMLMediaElement.HAVE_METADATA,this.h,(function(){Ja(r,r.j)}))}function ja(e){return e.m?e.g.currentTime:e.j}function Ba(e,t){0<e.g.readyState?qa(e.i,t):Ya(e.g,HTMLMediaElement.HAVE_METADATA,e.h,(function(){Ja(e,e.j)}))}function Ja(e,t){.001>Math.abs(e.g.currentTime-t)?za(e):(e.h.ya(e.g,"seeking",(function(){za(e)})),qa(e.i,0==e.g.currentTime?t:e.g.currentTime))}function za(e){e.m=!0,e.h.H(e.g,"seeking",(function(){return e.l()}))}function Qa(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 qa(e,t){e.i=e.h.currentTime,e.l=t,e.j=e.m,e.h.currentTime=t,e.g.Oa(.1)}function $a(e){var t=this;this.g=e,this.j=!1,this.i=null,this.h=new et,Ya(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 eo(e,t,n,r,i,a){var o=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 Xa(e,t.presentationTimeline,n,function(e,t){if(!t.stallEnabled)return null;var n=t.stallSkip,r=new Ca(new Ga(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),a),this.h=new Ha(e,(function(){e:{var e=o.j;e.o=!0,e.m=!1,e.i=!1,e=ja(o.h);var t=no(o,e);if(.001<Math.abs(t-e)){var n=Date.now()/1e3;if(!o.u||o.u<n-1){o.u=n,Ba(o.h,t),e=void 0;break e}}B.K("Seek to "+e),o.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),to(e,ro(e,t))}(this,r)),this.o=new Le((function(){if(0!=o.i.readyState&&!o.i.paused){var e=ja(o.h),t=o.g.Cb(),n=o.g.Ka();3>n-t&&(t=n-3),e<t&&(t=no(o,e),B.info("Jumping forward "+(t-e)+" seconds to catch up with the seek range."),o.i.currentTime=t)}})).Oa(.25)}function to(e,t){var n=e.g.ha();return t>=n?n-e.m.durationBackoff:t}function no(e,t){var n=Bt.bind(null,e.i.buffered),r=Math.max(e.J,e.m.rebufferingGoal),i=e.m.safeSeekOffset,a=e.g.Cb(),o=e.g.Ka(),s=e.g.ha();3>o-a&&(a=o-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."),to(e,t)):t>o?(B.K("Playhead past end."),o):t<a?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 ro(e,t){var n=e.g.Cb();return t<n||t>(n=e.g.Ka())?n:t}function io(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 ao(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:so,hb:function(e,n){return t.g(e,n)}},{rb:oo,qb:so,hb:function(e,n){return t.g(e,n)}},{rb:uo,qb:so,hb:function(e,n){return t.g(e,n)}},{rb:so,qb:oo,hb:function(e,n){return t.h(e,n)}},{rb:so,qb:uo,hb:function(e,n){return t.h(e,n)}},{rb:oo,qb:uo,hb:function(e,n){return t.i(e,n)}},{rb:uo,qb:oo,hb:function(e,n){return t.i(e,n)}}]}Ha.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},Qa.prototype.release=function(){this.g&&(this.g.stop(),this.g=null),this.h=null},$a.prototype.release=function(){this.h&&(this.h.release(),this.h=null),this.g=null},$a.prototype.A=function(e){this.i=this.j?this.i:e},$a.prototype.l=function(){return(this.j?this.g.currentTime:this.i)||0},$a.prototype.C=function(){},eo.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(){}},eo.prototype.A=function(e){Ba(this.h,e)},eo.prototype.l=function(){var e=ja(this.h);return 0<this.i.readyState&&!this.i.paused?ro(this,e):e},eo.prototype.C=function(){this.j.zd()},io.prototype.release=function(){this.h=function(){},this.g.clear(),this.i.stop()},ao.prototype.release=function(){this.m=null,this.j.clear(),this.g=function(){},this.h=function(){},this.i=function(){}},ao.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),a=e<r.startTime?oo:e>r.endTime?uo:so;this.j.set(r,a);for(var o=h(this.o),s=o.next();!s.done;s=o.next())(s=s.value).rb==i&&s.qb==a&&s.hb(r,t)}};var oo=1,so=2,uo=3;function co(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 lo(e){return fo(e,"audio")}function ho(e){return fo(e,"video")}function fo(e,t){var n=e.h.get(t);return n?n.Ta||n.stream:null}function po(e,t){return p((function n(){var r,i,a,o,s,u,c,l,d;return V(n,(function(n){switch(n.s){case 1:return r=fe,k(n,In(e.g.T,r.za),2);case 2:return e.J++,e.L=!1,i=e.J,a=e.g.T,o=new Map,s=new Set,o.set(r.za,t),s.add(t),k(n,a.init(o,!1),3);case 3:return e.j?n.return():k(n,wo(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=Io(e,c),d=Ao(t,l,0),e.h.set(r.za,d),Po(e,d,0)),T(n)}}))}))}function mo(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),vo(e,i,!1,0,!1),n.Ta=r)}else(r=n.Ta)&&(B.debug("Restoring non-trick-mode stream",r),n.Ta=null,vo(e,r,!0,0,!1))}}function yo(e,t,n,r){var i=!1;if(t.video){var a=vo(e,t.video,n,r,!1);i=i||a}return t.audio&&(e=vo(e,t.audio,n,r,!1),i=i||e),i}function vo(e,t,n,r,i){var a=e.h.get(t.type);if(!a&&"text"==t.type&&e.l.ignoreTextStreamFailures)return po(e,t),!0;if(!a)return!1;var o=Ro(e,t),s=Array.from(e.h.values()).every((function(e){return e.oa==a.oa}));return n&&o!=a.oa&&s?(B.debug("switch: switching to stream in another Period; clearing buffer and changing Periods"),e.h.forEach((function(t){go(e,t)})),!0):(a.Ta&&(B.debug("switch during trick play mode",t),t.trickModeVideo?(a.Ta=t,t=t.trickModeVideo,B.debug("switch found trick play stream",t)):(a.Ta=null,B.debug("switch found no special trick play stream"))),!(!(s=e.m[o])||!s.Rb||!(s=e.o.get(t.id))||!s.Rb||(a.stream!=t||i?("text"==t.type&&Sn(e.g.T,ct(t.mimeType,t.codecs)),a.stream=t,a.Ac=!0,B.debug("switch: switching to Stream "+Mo(a)),function(e,t,n){if(!t.lb)return!1;var r=e.g.eb(),i=xn(e.g.T,t.type),a=To(e,t,r,i,n);return n=a&&a.g?a.g-a.h:null,a&&!n&&(n=(a.endTime-a.xc())*t.stream.bandwidth/8),!isNaN(n)&&((a=t.stream.initSegmentReference)&&(n+=(a.g?a.g-a.h:null)||0),a=e.g.getBandwidthEstimate(),8*n/a<i-r-Math.max(e.i.minBufferTime||0,e.l.rebufferingGoal)||t.lb.h.g>n)}(e,a,o)&&(B.info("Aborting current segment request to switch."),a.lb.abort()),n&&(a.ab?a.Qc=!0:a.Sa?(a.Wa=!0,a.oc=r,a.Qc=!0):(Xo(a),Go(e,a,!0,r).catch((function(t){e.g&&e.g.onError(t)})))),0):(B.debug("switch: Stream "+Mo(a)+" already active"),1))))}function go(e,t){var n=Mo(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&&Po(e,t,0)):(B.debug(n,"clear: handling right now"),Xo(t),Go(e,t,!1,0).catch((function(t){e.g&&e.g.onError(t)})))}function bo(e,t,n,r,i){return p((function a(){var o,s,u,c,l,d,h;return V(a,(function(a){switch(a.s){case 1:return o=e.g.eb(),s=Io(e,o),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(a,d.init(c,h),2);case 2:return e.j?a.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(a,wo(e,l),3));case 3:if(e.j)return a.return();c.forEach((function(t,n){if(!e.h.has(n)){var r=Ao(t,s,i);e.h.set(n,r),Po(e,r,0)}})),T(a)}}))}))}function Ao(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 _o(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),a=i.next();!a.done;a=i.next())(a=a.value).video&&r.add(a.video),a.video&&a.video.trickModeVideo&&r.add(a.video.trickModeVideo),a.audio&&r.add(a.audio);for(a=(i=h(e.i.periods[t].textStreams)).next();!a.done;a=i.next())r.add(a.value);return e.F=e.F.then(function(){if(!this.j)return wo(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 wo(e,t){return p((function n(){var r,i,a,o,s,u,c;return V(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,(a=e.o.get(i.id))?(B.debug("(all) Stream "+i.id+" is being or has been set up"),r.push(a.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(o=Z(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 o;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 So(e,t){if(!e.j){var n=Mo(t);if(!t.Sa&&null!=t.Pa&&!t.ab)if(t.Pa=null,t.Wa)B.debug(n,"skipping update and clearing the buffer"),Go(e,t,t.Qc,t.oc);else{try{var r=function(e,t){if(Lo(t))return Zn(e.g.T,t.stream.originalId||""),null;var n=Mo(t),r=e.g.eb(),i=ko(e,t,r);B.O(n,"timeNeeded="+i);var a=Ro(e,t.stream),o=Io(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=o,o!=a)return B.debug(n,"need Period "+o,"presentationTime="+r,"timeNeeded="+i,"currentPeriodIndex="+a),null;if(s>=u)return B.O(n,"buffering goal met"),.5;if(n=xn(e.g.T,t.type),!(n=To(e,t,r,n,a)))return 1;var c=1/0;return Array.from(e.h.values()).forEach((function(t){Lo(t)||(t=ko(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 a=Mo(t),o=e.i.periods[r];B.K(a,"fetchAndAppend_:","presentationTime="+n,"currentPeriod.startTime="+o.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 a=Mo(t);return n=e.i.periods[n].startTime-t.stream.presentationTimeOffset,B.K(a,"setting timestamp offset to "+n),B.K(a,"setting append window start to "+r),B.K(a,"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([Rn(e,t,e.Ve.bind(e,t)),Rn(e,t,e.Cg.bind(e,t,n)),Rn(e,t,e.zg.bind(e,t,r,i))])}(e.g.T,t.type,n,r,i),t.stream.initSegmentReference?(B.K(a,"fetching init segment"),e=Co(e,t,t.stream.initSegmentReference).then(function(e){if(!this.j)return B.K(a,"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,o.startTime-.1),c?c.startTime+.01:u),t.Sa=!0,t.Ac=!1,B.O(a,"fetching segment"),u=Co(e,t,i),Promise.all([r,u]).then(function(e){if(!this.j&&!this.A)return function(e,t,n,r,i,a,o){var s=Mo(t),u=i.closedCaptions&&0<i.closedCaptions.size;return null!=i.emsgSchemeIdUris&&0<i.emsgSchemeIdUris.length&&(new Dr).ma("emsg",e.P.bind(e,r,a,i.emsgSchemeIdUris)).parse(o),function(e,t,n){var r=Mo(t);B.O(r,"checking buffer length");var i=Math.max(e.l.bufferBehind,e.i.presentationTimeline.g),a=Tn(e.g.T,t.type);if(null==a)return B.O(r,"buffer behind okay because nothing buffered:","presentationTime="+n,"bufferBehind="+i),Promise.resolve();var o=n-a,s=o-i;return.01>=s?(B.O(r,"buffer behind okay:","presentationTime="+n,"bufferedBehind="+o,"bufferBehind="+i,"underflow="+Math.abs(s)),Promise.resolve()):(B.K(r,"buffer behind too large:","presentationTime="+n,"bufferedBehind="+o,"bufferBehind="+i,"overflow="+s),e.g.T.remove(t.type,a,a+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,o,a.startTime+r.startTime,a.endTime+r.startTime,u)}.bind(e)).then(function(){if(!this.j)return B.O(s,"appended media segment"),t.Hb=i,t.La=a,Promise.resolve()}.bind(e))}(this,t,n,o,s,i,e[1])}.bind(e)).then(function(){this.j||this.A||(t.Sa=!1,t.Ed=!1,t.Wa||this.g.zd(),Po(this,t,0),function(e,t,n){if(!e.C){var r=Mo(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=Ro(e,n),e.m[n]||_o(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)_o(e,n).catch(le.Bc);e.g.gg&&(B.K(r,"calling onStartupComplete()..."),e.g.gg())}}}(this,t,s),B.K(a,"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(a,"Text stream failed to download. Proceeding without it."):B.v(a,"Text stream failed to parse. Proceeding without it."),this.h.delete("text")):7001==e.code?(t.Sa=!1,t.Pa=null,Po(this,t,0)):3017==e.code?function(e,t,n){var r=Mo(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}Po(e,t,4)}(this,t,e):(B.error(a,"failed fetch and append: code="+e.code),t.ac=!0,e.severity=2,Do(this,e)))}.bind(e))}(e,t,r,a,n),null)}(e,t);null!=r&&(Po(e,t,r),t.ac=!1)}catch(i){return void Do(e,i)}r=Array.from(e.h.values()),function(e,t){var n=Mo(t),r=Ro(e,t.stream);if(t.oa!=r){var i=t.oa,a=Array.from(e.h.values());a.every((function(e){return e.oa==i||Lo(e)}))?a.every(Zo)?(B.debug(n,"all need Period "+i),_o(e,i).then(function(){if(!this.j)if(a.every(function(e){var t=Zo(e),n=Ro(this,e.stream);return!!Lo(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 o=(t=h(this.h.keys())).next();!o.done;o=t.next())if(o=o.value,!r.has(o)&&"text"!=o)return B.error(n,"invalid Streams chosen: missing "+o+" Stream"),void this.g.onError(new J(2,5,5005));for(o=(t=h(Array.from(r.keys()))).next();!o.done;o=t.next())if(o=o.value,!this.h.has(o)){if("text"!=o)return B.error(n,"invalid Streams chosen: unusable "+o+" Stream"),void this.g.onError(new J(2,5,5005));bo(this,null,null,r.get("text"),e.startTime),r.delete(o)}for(o=(t=h(Array.from(this.h.keys()))).next();!o.done;o=t.next()){o=o.value;var s=this.h.get(o),u=r.get(o);if(u){var c=Lo(s);c&&(s.oa=i,s.Hd=e.startTime),vo(this,u,!1,0,!1),c&&Lo(s)||Po(this,this.h.get(o),0)}else this.h.delete(o)}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 ko(e,t,n){return t.Hb&&t.La?(n=Ro(e,t.Hb),e.i.periods[n].startTime+t.La.endTime):Math.max(n,t.Hd)}function To(e,t,n,r,i){var a=Mo(t);return t.La&&t.stream==t.Hb?(r=t.La.position+1,B.O(a,"next position known:","position="+r),Eo(e,t,i,r)):(t.La?(B.K(a,"next position unknown: another Stream buffered"),a=Ro(e,t.Hb),a=xo(e,t,e.i.periods[a].startTime+t.La.endTime,i)):(B.K(a,"next position unknown: nothing buffered"),a=xo(e,t,r||n,i)),null==a?null:(n=null,null==r&&(n=Eo(e,t,i,Math.max(0,a-1))),n||Eo(e,t,i,a)))}function xo(e,t,n,r){var i=Mo(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 Eo(e,t,n,r){var i=Mo(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 Lo(e){return e&&"text"==e.type&&"application/cea-608"==e.stream.mimeType}function Zo(e){return!e.Sa&&null==e.Pa&&!e.Wa&&!e.ab}function Io(e,t){var n=Na(e.i.periods,t+pe);return n?e.i.periods.indexOf(n):0}function Ro(e,t){for(var n=e.i.periods,r=0;r<n.length;r++){for(var i=n[r],a=new Set,o=h(i.variants),s=o.next();!s.done;s=o.next())(s=s.value).audio&&a.add(s.audio),s.video&&a.add(s.video),s.video&&s.video.trickModeVideo&&a.add(s.video.trickModeVideo);for(o=(i=h(i.textStreams)).next();!o.done;o=i.next())a.add(o.value);if(a.has(t))return r}return-1}function Co(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 Go(e,t,n,r){return p((function i(){var a,o,s,u;return V(i,(function(i){switch(i.s){case 1:return a=Mo(t),t.Wa=!1,t.Qc=!1,t.oc=0,t.ab=!0,t.Hb=null,t.La=null,B.debug(a,"clearing buffer"),r?(s=e.g.eb(),u=e.g.T.ha(),o=e.g.T.remove(t.type,s+r,u)):o=In(e.g.T,t.type).then(function(){if(!this.j&&n)return this.g.T.flush(t.type)}.bind(e)),k(i,o,2);case 2:if(e.j)return i.return();B.debug(a,"cleared buffer"),t.ab=!1,t.endOfStream=!1,Po(e,t,0),T(i)}}))}))}function Po(e,t,n){var r=Mo(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 V(n,(function(n){switch(n.s){case 1:return x(n,2),k(n,So(e,t),4);case 4:L(n,0);break;case 2:r=Z(n),e.g&&e.g.onError(r),T(n)}}))}))})).V(n)):B.K(r,"Text stream is unloaded. No update is needed.")}function Xo(e){null!=e.Pa&&(e.Pa.stop(),e.Pa=null)}function Vo(e){return p((function t(){return V(t,(function(t){if(1===t.s){if(e.lb)return k(t,e.lb.abort(),0);t.I(0)}}))}))}function Do(e,t){Ie(e.M).then(function(){this.j||(this.g.onError(t),t.handled||this.l.failureCallback(t))}.bind(e))}function Mo(e){return"("+e.type+":"+e.stream.id+")"}function Wo(e,t,n,r,i,a){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(o){}throw B.debug("HTTP error text:",i),new J(401==n||403==n?2:1,1,1001,r,n,i,e,a)}function No(e,t,n,r){var i=new No.h;st(t.headers).forEach((function(e,t){i.append(t,e)}));var a=new No.g,o={Zd:!1,Oe:!1};if(e=new Re(e=No.u(e,n,{body:t.body||void 0,headers:i,method:t.method,signal:a.signal,credentials:t.allowCrossSiteCredentials?"include":void 0},o,r),(function(){return o.Zd=!0,a.abort(),Promise.resolve()})),t=t.retryParameters.timeout){var s=new Le((function(){o.Oe=!0,a.abort()}));s.V(t/1e3),e.finally((function(){s.stop()}))}return e}function Oo(e,t,n,r){var i=new Oo.j,a=Date.now(),o=0;return new Re(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={},a=(r=h(r)).next();!a.done;a=r.next())i[(a=a.value.split(": "))[0].toLowerCase()]=a.slice(1).join(": ");try{var o=Wo(i,t.response,t.status,e,t.responseURL,n);s(o)}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-a||e.lengthComputable&&e.loaded==e.total)&&(r(t-a,e.loaded-o,e.total-e.loaded),o=e.loaded,a=t)},t.headers)i.setRequestHeader(c.toLowerCase(),t.headers[c]);i.send(t.body)})),(function(){return i.abort(),Promise.resolve()}))}function Uo(){this.g=this.j=this.h=0,this.i=new Map,this.l=0}function Fo(e,t,n){this.m=e,this.h=new Map,this.i=!1,this.l=t,this.j=n,this.g=new Uo}function Yo(e,t,n,r,i,a){var o=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 V(t,(function(t){switch(t.s){case 1:return k(t,function(e,t){return p((function n(){var r;return V(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(o,r.byteLength),h=e.g,e.l(0==h.h?0:h.j/h.h,e.g.g),t.return(a(r))}}))}))})))}function Ko(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 Ho(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 jo(e){this.h=e,this.g=[]}function Bo(e,t){return Jo(e,t,"readwrite")}function Jo(e,t,n){var r=new Ko(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 zo(e,t,n){this.h=new jo(e),this.i=t,this.g=n}function Qo(e){return Promise.reject(new J(2,9,9011,"Cannot add new value to "+e))}function qo(e,t,n,r){t=(e=Bo(e.h,t)).store();for(var i={},a=(n=h(n)).next();!a.done;i={key:i.key},a=n.next())i.key=a.value,t.delete(i.key).onsuccess=function(e){return function(){return r(e.key)}}(i);return e.promise()}function $o(e,t,n){return p((function r(){var i,a,o,s,u,c,l;return V(r,(function(r){switch(r.s){case 1:for(i=Jo(e.h,t,"readonly"),a=i.store(),o={},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=a.get(u.key),u.request.onsuccess=function(e){return function(){null==e.request.result&&s.push(e.key),o[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 o[e]})))}}))}))}function es(e){this.g=new jo(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)}co.prototype.destroy=function(){var e=this;return p((function t(){var n,r;return V(t,(function(t){switch(t.s){case 1:n=[];for(var i=h(e.h.values()),a=i.next();!a.done;a=i.next())Xo(r=a.value),n.push(Vo(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)}}))}))},co.prototype.configure=function(e){this.l=e,this.M=new Ze({maxAttempts:Math.max(e.retryParameters.maxAttempts,2),baseDelay:e.retryParameters.baseDelay,backoffFactor:e.retryParameters.backoffFactor,fuzzFactor:e.retryParameters.fuzzFactor,timeout:0},!0)},co.prototype.start=function(){var e=this;return p((function t(){var n,r,i;return V(t,(function(t){switch(t.s){case 1:return n=e.g.eb(),r=Io(e,n),(i=e.g.ue(e.i.periods[r])).variant||i.text?k(t,bo(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)}}))}))},co.prototype.P=function(e,t,n,r){var i=r.reader.Cd(),a=r.reader.Cd(),o=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/o,n.includes(i)&&("urn:mpeg:dash:event:2012"==i?this.g.Zf():this.g.onEvent(new De("emsg",{detail:{startTime:e,endTime:e+u/o,schemeIdUri:i,value:a,timescale:o,presentationTimeDelta:s,eventDuration:u,id:c,messageData:r}})))},U("shaka.net.HttpFetchPlugin",No),No.u=function(e,t,n,r,i){return p((function a(){var o,s,u,c,l,d,h,f,m,y,v,g;return V(a,(function(a){switch(a.s){case 1:return o=No.l,s=No.i,d=l=0,h=Date.now(),x(a,2),k(a,o(e,n),4);case 4:return u=a.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,a,o;return V(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 a=Z(n),B.K("error reading from stream",a.message),n.return();case 3:r.done||(l+=r.value.byteLength),(100<(o=Date.now())-h||r.done)&&(i(o-h,l-d,y-l),d=l,h=o),r.done?e.close():(e.enqueue(r.value),t()),T(n)}}))}))}()}}),k(a,u.arrayBuffer(),5);case 5:c=a.B,L(a,3);break;case 2:if(v=Z(a),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})),a.return(Wo(g,c,u.status,e,u.url,t))}}))}))},No.isSupported=function(){if(!e.ReadableStream)return!1;try{new ReadableStream({})}catch(s){return!1}return!(!e.fetch||!e.AbortController)},No.isSupported=No.isSupported,No.l=e.fetch,No.g=e.AbortController,No.i=e.ReadableStream,No.h=e.Headers,No.isSupported()&&(Be("http",No,2),Be("https",No,2)),U("shaka.net.HttpXHRPlugin",Oo),Oo.j=e.XMLHttpRequest,Be("http",Oo,1),Be("https",Oo,1),Uo.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}},Fo.prototype.destroy=function(){return this.i=!0,Promise.all(this.h.values()).then((function(){}),(function(){}))},Ko.prototype.abort=function(){try{this.i.abort()}catch(s){}return this.g.catch((function(){}))},Ko.prototype.store=function(){return this.h},Ko.prototype.promise=function(){return this.g},jo.prototype.destroy=function(){return Promise.all(this.g.map((function(e){return e.abort()})))},(r=zo.prototype).destroy=function(){return this.h.destroy()},r.hasFixedKeySpace=function(){return!0},r.addSegments=function(){return Qo(this.i)},r.removeSegments=function(e,t){return qo(this,this.i,e,t)},r.getSegments=function(e){var t=this;return p((function n(){var r;return V(n,(function(n){switch(n.s){case 1:return k(n,$o(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 Qo(this.g)},r.updateManifestExpiration=function(e,t){var n=Bo(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 qo(this,this.g,e,t)},r.getManifests=function(e){var t=this;return p((function n(){var r;return V(n,(function(n){switch(n.s){case 1:return k(n,$o(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 V(t,(function(t){switch(t.s){case 1:return n=Jo(e.h,e.g,"readonly"),r=new Map,k(t,Ho(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,a,o,s;return V(r,(function(r){switch(r.s){case 1:i=Bo(n.h,e),a=i.store(),o=[];for(var u=h(t),c=u.next();!c.done;c=u.next())s=c.value,a.add(s).onsuccess=function(e){o.push(e.target.result)};return k(r,i.promise(),2);case 2:return r.return(o)}}))}))},es.prototype.destroy=function(){return this.g.destroy()},es.prototype.getAll=function(){var e=this;return p((function t(){var n,r;return V(t,(function(t){switch(t.s){case 1:return n=Jo(e.g,"session-ids","readonly"),r=[],k(t,Ho(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=Bo(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 V(n,(function(n){switch(n.s){case 1:return k(n,Ho(r=Bo(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 V(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 as(e){zo.apply(this,arguments)}function os(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 a=r++;t.forEach((function(e){e.variantIds.push(a)}))}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){zo.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),a=i.next();!a.done;a=i.next()){var o=h(a.value.variantIds);for(a=o.next();!a.done;a=o.next())r.add(a.value)}for(i=h(n),a=i.next();!a.done;a=i.next())for(o=h(a.value.variantIds),a=o.next();!a.done;a=o.next())r.add(a.value);for(i=new Map,r=h(r),a=r.next();!a.done;a=r.next())a=a.value,i.set(a,{id:a,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,a=ys(e,r),o=h(r.variantIds),r=o.next();!r.done;r=o.next())(r=i.get(r.value)).language=a.language,r.primary=r.primary||a.primary,r.audio=a;for(n=h(n),t=n.next();!t.done;t=n.next())for(r=t.value,t=ys(e,r),a=h(r.variantIds),r=a.next();!r.done;r=a.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 ai(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,a,o,s,u,c;return V(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]})}a=h(l),o=a.next();case 2:if(o.done){r.I(4);break}return s=o.value,u=function(e,t,n){return p((function r(){var i,a,o,s;return V(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,a){var o=new Map;return o.set(t,{audioCapabilities:i,videoCapabilities:a,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,o)}(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 a=Z(r),B.v("Error initializing EME",a),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 o=Z(r),B.v("Error setting server certificate",o),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 V(t,(function(t){switch(t.s){case 1:return x(t,2),k(t,function(e,t){return p((function n(){var r,i,a;return V(n,(function(n){switch(n.s){case 1:return k(n,Gt(e,t),2);case 2:return(r=n.B)?(i=[],(a=e.h.get(r))&&(a.Ga=new me,i.push(a.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=Z(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),o=a.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 V(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 V(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=Z(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 a=r[i];a&&t(a)&&e.removeCue(a)}e.mode=n}function Ls(e,t,n,r,i){var a,o=i in r,s=!0;for(a in t){var u=i+"."+a,c=o?r[i]:n[a];o||a in n?void 0===t[a]?void 0===c||o?delete e[a]:e[a]=Ne(c):c.constructor==Object&&t[a]&&t[a].constructor==Object?(e[a]||(e[a]=Ne(c)),u=Ls(e[a],t[a],c,r,u),s=s&&u):typeof t[a]!=typeof c||null==t[a]||"function"!=typeof t[a]&&t[a].constructor!=c.constructor?(B.kc("Invalid config, wrong type for "+u),s=!1):("function"==typeof n[a]&&n[a].length!=t[a].length&&B.ba("Unexpected number of arguments for "+u),e[a]=t[a]):(B.kc("Invalid config, unrecognized key "+u),s=!1)}return s}function Zs(e,t){for(var n={},r=n,i=0,a=0;!(0>(i=e.indexOf(".",i)));)0!=i&&"\\"==e[i-1]||(r[a=e.substring(a,i).replace(/\\\./g,".")]={},r=r[a],a=i+1),i+=1;return r[e.substring(a).replace(/\\\./g,".")]=t,n}function Is(){}function Rs(){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:Pt,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 a={trackSelectionCallback:function(e){return p((function t(){return V(t,(function(t){if(1===t.s)return t.return(e)}))}))},progressCallback:function(e,t){return[e,t]},usePersistentLicense:!0},o={drm:n,manifest:r,streaming:i,offline:a,abrFactory:On,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 a.trackSelectionCallback=function(e){return p((function t(){return V(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=Mn(t,n.map((function(e){return e.language})));i&&(r=n.filter((function(e){return Vn(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 a=r.filter((function(e){return e.height&&480>=e.height}));if(a.length&&(a.sort((function(e,t){return t.height-e.height})),r=a.filter((function(e){return e.height==a[0].height}))),n=[],r.length){var o=Math.floor(r.length/2);r.sort((function(e,t){return e.bandwidth-t.bandwidth})),n.push(r[o])}for(r=h(e),o=r.next();!o.done;o=r.next())"text"==(o=o.value).type&&n.push(o);return n}(e,o.preferredAudioLanguage))}))}))},o}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||Rs(),r,"")}function Gs(){this.g=null,this.h=[]}function Ps(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 Xs(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 Vs(){this.h=this.i=null,this.g=[]}function Ds(){this.j=this.C=this.m=this.h=this.o=this.u=this.A=this.l=this.F=NaN,this.g=new Gs,this.i=new Vs}function Ms(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 ga,this.h=zs(this),this.mc={width:1/0,height:1/0},this.F=null,this.tb=new Ea(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 He((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 Xe(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,Xe(e=Promise.resolve())})),i.set(this.Qa,(function(e){return Xe(Us(r,e))})),i.set(this.vb,(function(t){return t=function(t,n){return p((function r(){var i,a,o,s;return V(r,(function(r){switch(r.s){case 1:return i=e.muxjs?new Kt:new Ht,a=t.h.textDisplayFactory,o=new a,t.fd=a,k(r,(s=new An(n.D,i,o)).C,2);case 2:t.M=s,T(r)}}))}))}(r,t),Xe(t)})),i.set(this.nd,(function(e,t){var n=function(e,t,n){return p((function r(){var i,a,o,s;return V(r,(function(r){switch(r.s){case 1:if(t.Ia=n.Ia,t.mimeType=n.mimeType,t.uri=n.uri,i=t.uri,a=e.X,e.Tb=i,t.Ia){e.C=t.Ia(),r.I(2);break}return o=e,k(r,_i.create(i,a,e.h.manifest.retryParameters,t.mimeType),3);case 3:o.C=r.B;case 2:s=Ne(e.h.manifest),n.D&&"AUDIO"===n.D.nodeName&&(s.disableVideo=!0),e.C.configure(s),T(r)}}))}))}(r,e,t);return Xe(n)})),i.set(this.md,(function(e){return function(e,t){var n=t.uri,r=e.X;e.rc=new io((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 Re(Promise.resolve().then((function(){return p((function t(){var r;return V(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 De("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 V(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,Wa(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),Xe(e)})),i.set(this.ea,(function(e,t){return Xe(function(e,t,n){return p((function r(){var i,a,o,s,u,c,l,d,f,p;return V(r,(function(r){switch(r.s){case 1:return t.startTime=n.startTime,i=t.D,a=t.uri,e.Tb=a,e.J=new Ua({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 Ds,o=function(){return nu(e)},s=function(){return tu(e)},e.l.H(i,"playing",o),e.l.H(i,"pause",o),e.l.H(i,"ended",o),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,a=h(r.variants),o=a.next();!o.done;o=a.next())if((o=o.value).video&&o.video.closedCaptions)for(var s=h((o=o.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:o.closedCaptions.get(u),label:null,type:"text",primary:!1,frameRate:void 0,pixelAspectRatio:void 0,trickModeVideo:null,emsgSchemeIdUris:null,roles:o.roles,channelsCount:null,audioSamplingRate:null,closedCaptions:null};i.set(u,c)}for(a=(i=h(i.values())).next();!a.done;a=i.next())r.textStreams.push(a.value)}}(e,e.i.periods),e.tb=new Ea(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),a=i.next();!a.done;a=i.next())if((a=a.value).variants.includes(t)){i=a;break e}i=null}Bs(e,i,t,!0),e.j&&yo(e.j,t,n,r)&&ou(e)})),e.A=function(e,t){return new eo(e.g,e.i,e.h.streaming,t,(function(){e.wb&&Ma(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,a=Io(e,n);if(ot(e.h.values(),(function(e){return e.oa==a})))for(var o=h(e.h.keys()),s=o.next();!s.done;s=o.next())t(s=s.value)||(go(e,e.h.get(s)),i=!0);else ot(e.h.keys(),t)||(B.debug("(all): seeked: unbuffered seek: clearing all buffers"),e.h.forEach((function(t){go(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 Oa(e.i);!function(e,t){e.h=t}(t,(function(){su(e)}));var n=new ao(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 Da(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 co(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),Nn.$d(e.i,e.h.preferredAudioChannelCount),e.o=Lu,e.dispatchEvent(new De("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-a.startTime);return null==n?null:(n=e.getSegmentReference(n))?n.startTime+a.startTime:null}var r=lo(e.j),i=ho(e.j),a=_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),ou(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,a;return V(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),a={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,[a],[]),2);case 2:return k(r,e.m.Ub(t.D),0)}}))}))}(r,e,t);return Xe(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 Ds,e.A=new $a(t.D),null!=t.startTime&&e.A.A(t.startTime),e.J=new Ua({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=Zu,e.dispatchEvent(new De("streaming"));var a=new me;Ya(e.g,HTMLMediaElement.HAVE_METADATA,e.l,(function(){a.resolve()}));var o=!1;return e.Wc.push((function(){o=!0})),Ya(e.g,HTMLMediaElement.HAVE_CURRENT_DATA,e.l,(function(){return p((function t(){return V(t,(function(t){switch(t.s){case 1:if(o)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),js(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(o)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?a.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.'),a.resolve()),e.l.ya(e.g,"error",(function(){a.reject(fu(e))})),new Re(a,(function(){return a.reject(new J(2,7,7001)),Promise.resolve()}))}(r,e,t)})),this.Ya=new ws(this.P,{Af:function(e,t,n,i){var a=null;return e==r.P&&(a=n==r.P?r.P:r.da),e==r.da&&(a=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&&(a=n==r.ea&&t.D==i.D?r.nd:r.Qa),e==r.nd&&(a=ku(r.ea,r.md,r.Qa,n,t,i)),e==r.md&&(a=ku(r.ea,r.ad,r.Qa,n,t,i)),e==r.ad&&(a=ku(r.ea,r.ea,r.Qa,n,t,i)),e==r.od&&(a=n==r.xb&&t.D==i.D?r.xb:r.Qa),e!=r.ea&&e!=r.xb||(a=r.Qa),e==r.Qa&&(a=i.D&&t.D==i.D?r.da:r.P),a},ef:function(e,t,n){return r.dispatchEvent(new De("onstatechange",{state:e.name})),i.get(e)(t,n)},handleError:function(e,t){return p((function n(){return V(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 De("onstateidle",{state:e.name}))}}),t&&this.Ub(t,!0)}A(as,zo),as.prototype.updateManifestExpiration=function(e,t){var n=Bo(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}))},as.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(os),sessionIds:e.sessionIds,drmInfo:e.drmInfo,appMetadata:e.appMetadata}},as.prototype.ae=function(e){return{data:e.data}},A(ls,zo),ls.prototype.hasFixedKeySpace=function(){return this.j},ls.prototype.addSegments=function(e){return this.j?Qo(this.i):this.add(this.i,e)},ls.prototype.addManifests=function(e){return this.j?Qo(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 as(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 V(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 V(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,a,o,s;return V(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 a=n.B,o=a[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,o));case 2:return I(n),k(n,i.destroy(),7);case 7:R(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,a,o,s,u,c,l,d;return V(r,(function(r){switch(r.s){case 1:return i=n.g,a=new ts,x(r,2,3),k(r,a.init(),5);case 5:return k(r,ns(a,i.Ea(),i.ja()),6);case 6:return k(r,(o=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,o.updateManifestExpiration(i.key(),t),3);case 3:return I(r),k(r,a.destroy(),10);case 10:R(r,0);break;case 2:d=Z(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 Pe(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 Pe(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 V(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={},a=(n=h(n)).next();!a.done;i={Fb:i.Fb},a=n.next())i.Fb=a.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))||(a=t(i.Fb))&&r.push(a);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",Zs),U("shaka.util.PlayerConfiguration",Is),Is.mergeConfigObjects=Cs,F(Ms,We),U("shaka.Player",Ms),Ms.prototype.destroy=function(){var e=this;return p((function t(){var n;return V(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 De("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)}}))}))},Ms.prototype.destroy=Ms.prototype.destroy,Ms.version="v2.5.23";var Ws=["2","5"];jn=new function(e){this.g=e,this.i=Kn,this.h=Hn}(new Fn(Number(Ws[0]),Number(Ws[1])));var Ns=["output-restricted","internal-error"],Os={};function Us(e,t){return p((function n(){var r;return V(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 De("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 La,e.L.g=Ia,Za(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 Zu:var t=!!e.g.ended||jt(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(jt(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,a=(n=e.L).h.get(n.g);t=n.g,r=i||r>=a?Ra:Ia,n.g=r,t!=r&&eu(e)}function Hs(e){if(e.C){var t=Ne(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(a){e.Va(a)}var n=lo(e.j),r=ho(e.j);t=_u(e),n=Nn.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"))&&vo(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)),Za(e.L,t,Math.min(.5,t/2)))}function js(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){Aa(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){ba(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=Rs();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?lo(e.j):null,r=e.j?ho(e.j):null;if(t.forEach(Nn.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(Nn.Gb)})),0==n)throw new J(2,4,4032);if(n<t.length)throw new J(2,4,4011);t.forEach(function(e){Nn.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=yo(e.j,t,n,r))&&uu(e),t)}function $s(e,t){if(e.yb)return e.va=t,!0;var n=vo(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,Fa(n),nu(e)}e.dispatchEvent(new De("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==Ia?Ps(t,"buffering"):e.g.paused?Ps(t,"paused"):e.g.ended?Ps(t,"ended"):Ps(t,"playing")}}function ru(e,t){try{yu(e,t)}catch(r){return e.Va(r),null}var n=t.filter((function(e){return Nn.Gb(e)}));return n=e.tb.create(n),e.u.setVariants(Array.from(n.values())),e.u.chooseVariant()}function iu(e,t){var n=au(e,t,!1),r=Nn.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)&&ou(e)}function au(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&&ou(e),i}function ou(e){vu(e,new De("adaptation"))}function su(e){vu(e,new De("trackschanged"))}function uu(e){vu(e,new De("variantchanged"))}function cu(e){vu(e,new De("textchanged"))}function lu(e){vu(e,new De("texttrackvisibility"))}function du(e){vu(e,new De("abrstatuschanged",{Zg:e.h.abr.enabled}))}function hu(e,t,n){e.dispatchEvent(new De(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 a=1==i.length&&"00"==i[0];a&&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){Nn.Kf(e).forEach((function(n){var i=e.allowedByKeySystem;n.keyId&&(n=t[a?"00":n.keyId],e.allowedByKeySystem=!!n&&!Ns.includes(n)),i!=e.allowedByKeySystem&&(r=!0)}))}))})),i=lo(e.j);var o=ho(e.j);(i=Nn.ie(i,o,n.variants))&&!i.allowedByKeySystem&&(B.debug("Choosing new variants after key status changed"),au(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 De("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,a=!1,o=[],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?Ns.includes(f)&&(s.includes(f)||s.push(f)):o.includes(d.keyId)||o.push(d.keyId)}c.allowedByApplication?c.allowedByKeySystem&&(i=!0):a=!0}if(!i)throw new J(2,4,4012,{hasAppRestrictions:a,missingKeys:o,restrictedKeyStatuses:s})}function vu(e,t){p((function n(){return V(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(Vn(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=Vn(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 a=[];return t.forEach((function(e,t){for(var n=h(e),r=n.next();!r.done;r=n.next())a.push({language:t,role:r.value})})),a}function Au(e){return null==(e=_u(e))?[]:e.variants.filter((function(e){return Nn.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 Aa(e.Z,t).variant}function Su(){return new J(2,7,7e3)}function ku(e,t,n,r,i,a){return r==e&&i.D==a.D&&i.uri==a.uri&&i.mimeType==a.mimeType&&i.Ia==a.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())}}))}Ms.registerSupportPlugin=function(e,t){Os[e]=t},Ms.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"))},Ms.probeSupport=function(){return Vt().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 a=i.split(";")[0];n[a]=n[a]||n[i]}for(var o in e={manifest:t,media:n,drm:e},Os)e[o]=Os[o]();return e}))},Ms.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)},Ms.prototype.attach=Ms.prototype.Ub,Ms.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)},Ms.prototype.detach=Ms.prototype.detach,Ms.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)},Ms.prototype.unload=Ms.prototype.Ud,Ms.prototype.load=function(e,t,n){if(this.o==xu)return Promise.reject(Su());this.dispatchEvent(new De("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,a=Ss(this.Ya,(function(e){return null==e.D?null:(r.D=e.D,{node:i,payload:r,gb:!0})}));return a.Kb=function(){return B.info("Starting load of "+e+"...")},new Promise((function(e,t){a.Ec=function(){return t(new J(2,7,7002))},a.Cc=function(){return e()},a.kb=function(){return t(Su())},a.onError=function(e){return t(e)}}))},Ms.prototype.load=Ms.prototype.load,Ms.prototype.configure=function(e,t){2==arguments.length&&"string"==typeof e&&(e=Zs(e,t));var n=Cs(this.h,e,zs(this));return Hs(this),n},Ms.prototype.configure=Ms.prototype.configure,Ms.prototype.getConfiguration=function(){var e=zs(this);return Cs(e,this.h,zs(this)),e},Ms.prototype.getConfiguration=Ms.prototype.getConfiguration,Ms.prototype.vg=function(){for(var e in this.h)delete this.h[e];Cs(this.h,zs(this),zs(this)),Hs(this)},Ms.prototype.resetConfiguration=Ms.prototype.vg,Ms.prototype.tf=function(){return this.o},Ms.prototype.getLoadMode=Ms.prototype.tf,Ms.prototype.yf=function(){return this.g},Ms.prototype.getMediaElement=Ms.prototype.yf,Ms.prototype.Yb=function(){return this.X},Ms.prototype.getNetworkingEngine=Ms.prototype.Yb,Ms.prototype.tc=function(){return this.Tb},Ms.prototype.getAssetUri=Ms.prototype.tc,Ms.prototype.wf=function(){return Yn("getManifestUri",'Please use "getAssetUri" instead.'),this.tc()},Ms.prototype.getManifestUri=Ms.prototype.wf,Ms.prototype.aa=function(){return this.i?this.i.presentationTimeline.aa():!(!this.g||!this.g.src)&&1/0==this.g.duration},Ms.prototype.isLive=Ms.prototype.aa,Ms.prototype.ib=function(){return!!this.i&&this.i.presentationTimeline.ib()},Ms.prototype.isInProgress=Ms.prototype.ib,Ms.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)},Ms.prototype.isAudioOnly=Ms.prototype.Qf,Ms.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}},Ms.prototype.seekRange=Ms.prototype.He,Ms.prototype.keySystem=function(){return Lt(this.drmInfo())},Ms.prototype.keySystem=Ms.prototype.keySystem,Ms.prototype.drmInfo=function(){return this.m?this.m.g:null},Ms.prototype.drmInfo=Ms.prototype.drmInfo,Ms.prototype.Xb=function(){return this.m?this.m.Xb():1/0},Ms.prototype.getExpiration=Ms.prototype.Xb,Ms.prototype.jd=function(){return!!this.L&&this.L.g==Ia},Ms.prototype.isBuffering=Ms.prototype.jd,Ms.prototype.Cf=function(){if(this.J){var e=this.J;e=e.j?0:e.i}else e=0;return e},Ms.prototype.getPlaybackRate=Ms.prototype.Cf,Ms.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&&mo(this.j,1<Math.abs(e)))},Ms.prototype.trickPlay=Ms.prototype.Mg,Ms.prototype.$e=function(){var e=this.J.vc();this.o==Zu&&this.J.set(e),this.o==Lu&&(this.J.set(e),mo(this.j,!1))},Ms.prototype.cancelTrickPlay=Ms.prototype.$e,Ms.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=Nn.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 Nn.je(e)})):[]},Ms.prototype.getVariantTracks=Ms.prototype.ed,Ms.prototype.Eb=function(){if(this.i&&this.A){for(var e=function(e){var t=_u(e);if(null==t)return null;if(!Aa(e.Z,t).text){var n=Nn.Wb(t.textStreams,e.ua,e.Xa);n.length&&ba(e.Z,t,n[0])}return Aa(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=Nn.Kc(r);i.active=r==e,t.push(i)}return t}return this.g&&this.g.src&&this.g.textTracks?js(this).map((function(e){return Nn.Of(e)})):[]},Ms.prototype.getTextTracks=Ms.prototype.Eb,Ms.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=js(this))).next();!n.done;n=t.next())n=n.value,Nn.gd(n)==e.id?n.mode=this.ub?"showing":"hidden":n.mode="disabled";cu(this)}},Ms.prototype.selectTextTrack=Ms.prototype.Ld,Ms.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.")},Ms.prototype.selectEmbeddedTextTrack=Ms.prototype.xg,Ms.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},Ms.prototype.usingEmbeddedTextTrack=Ms.prototype.Rg,Ms.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?Nn.Gb(i)?(Bs(this,r,i,!1),qs(this,i,t,n),this.tb=new xa(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,Nn.gd(n)==e.id&&(n.enabled=!0);uu(this)}},Ms.prototype.selectVariantTrack=Ms.prototype.Ie,Ms.prototype.nf=function(){return bu(this.ed())},Ms.prototype.getAudioLanguagesAndRoles=Ms.prototype.nf,Ms.prototype.Jf=function(){return bu(this.Eb())},Ms.prototype.getTextLanguagesAndRoles=Ms.prototype.Jf,Ms.prototype.mf=function(){return Array.from(gu(this.ed()))},Ms.prototype.getAudioLanguages=Ms.prototype.mf,Ms.prototype.If=function(){return Array.from(gu(this.Eb()))},Ms.prototype.getTextLanguages=Ms.prototype.If,Ms.prototype.Jd=function(e,t){if(this.i&&this.A){var n=_u(this);if(this.tb=new Ea(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],a=Aa(this.Z,i).variant,o=this.tb.create(i.variants);i=null;for(var s=(o=h(o.values())).next();!s.done;s=o.next())s=s.value,(!i||r(i,a)>r(s,a))&&(i=s);if(i)return n=Nn.Oc(i),void this.Ie(n,!0)}au(this,n)}else if(this.g&&this.g.audioTracks){for(i=Array.from(this.g.audioTracks),n=Vn(e),a=r=null,o=(i=h(i)).next();!o.done;o=i.next())o=o.value,Vn((s=Nn.je(o)).language)==n&&(r=o,t?s.roles.includes(t)&&(a=o):0==s.roles.length&&(a=o));a?(a.enabled=!0,uu(this)):r&&(r.enabled=!0,uu(this))}},Ms.prototype.selectAudioLanguage=Ms.prototype.Jd,Ms.prototype.Kd=function(e,t){if(this.i&&this.A){var n=_u(this);this.ua=e,this.Xa=t||"";var r=Nn.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=Vn(e);(n=this.Eb().filter((function(e){return Vn(e.language)==i&&(!t||e.roles.includes(t))}))[0])&&this.Ld(n)}},Ms.prototype.selectTextLanguage=Ms.prototype.Kd,Ms.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 Ea(n.language,"",0,e),au(this,t))}},Ms.prototype.selectVariantsByLabel=Ms.prototype.yg,Ms.prototype.zc=function(){var e=this.ub;return this.M?this.M.l.isTextVisible():this.g&&this.g.src&&this.g.textTracks?js(this).some((function(e){return"showing"==e.mode})):e},Ms.prototype.isTextTrackVisible=Ms.prototype.zc,Ms.prototype.Bg=function(e){var t=this;return p((function n(){var r,i,a,o;return V(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(js(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&&(Xo(t),Vo(t).catch((function(){})),e.h.delete("text"))}(t.j),n.I(2);break}if(fo(t.j,"text")){n.I(2);break}if(a=_u(t),!(0<(o=Nn.Wb(a.textStreams,t.ua,t.Xa)).length)){n.I(2);break}return k(n,po(t.j,o[0]),2);case 2:lu(t),T(n)}}))}))},Ms.prototype.setTextTrackVisibility=Ms.prototype.Bg,Ms.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)},Ms.prototype.getPlayheadTimeAsDate=Ms.prototype.Ef,Ms.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},Ms.prototype.getPresentationStartTimeAsDate=Ms.prototype.Gf,Ms.prototype.bd=function(){var e={total:[],audio:[],video:[],text:[]};return this.o==Zu&&(e.total=zt(this.g.buffered)),this.o==Lu&&this.M.bd(e),e},Ms.prototype.getBufferedInfo=Ms.prototype.bd,Ms.prototype.getStats=function(){if(this.o!=Lu&&this.o!=Zu)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,a=r.A,o=r.o,s=r.j,u=r.h,c=Xs(r.g,"playing"),l=Xs(r.g,"paused"),d=Xs(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:a,corruptedFrames:o,estimatedBandwidth:s,loadLatency:u,playTime:c,pauseTime:l,bufferingTime:d,licenseTime:f,stateHistory:p,switchHistory:m}},Ms.prototype.getStats=Ms.prototype.getStats,Ms.prototype.addTextTrack=function(e,t,n,r,i,a){var o=this;return p((function s(){var u,c,l,d,h,f,p,m,y;return V(s,(function(s){switch(s.s){case 1:if(o.o==Zu)throw B.error("Cannot add text when loaded with src="),Error("State error!");if(o.o!=Lu)throw B.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");if(u=_u(o),c=fe,l=o.i.periods.indexOf(u),h=(d=l+1)>=o.i.periods.length?o.i.presentationTimeline.ha():o.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:o.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:a||null,type:c.za,primary:!1,frameRate:void 0,pixelAspectRatio:void 0,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,audioSamplingRate:null,closedCaptions:null},o.lc.add(m),u.textStreams.push(m),k(s,po(o.j,m),2);case 2:return(y=fo(o.j,"text"))&&ba(o.Z,u,y),o.lc.delete(m),B.debug("Choosing new streams after adding a text stream"),iu(o,u),su(o),s.return(Nn.Kc(m))}}))}))},Ms.prototype.addTextTrack=Ms.prototype.addTextTrack,Ms.prototype.Nd=function(e,t){this.mc.width=e,this.mc.height=t},Ms.prototype.setMaxHardwareResolution=Ms.prototype.Nd,Ms.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=Mo(n=n.value);n.ac&&(B.info(r,"Retrying after failure..."),n.ac=!1,Po(e,n,.1))}e=!0}}else e=!1;return e},Ms.prototype.retryStreaming=Ms.prototype.Id,Ms.prototype.uf=function(){return this.i},Ms.prototype.getManifest=Ms.prototype.uf,Ms.prototype.vf=function(){return this.C?this.C.constructor:null},Ms.prototype.getManifestParserFactory=Ms.prototype.vf,(r=Ms.prototype).Xc=function(e){var t=this.j?lo(this.j):null,n=this.j?ho(this.j):null;if(Nn.filterNewPeriod(this.m,t,n,e),!(t=e.variants).some(Nn.Gb))throw new J(2,4,4011);if(yu(this,e.variants),Nn.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=Nn.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 a=r.i.periods[i.oa];else{var o=r.h.get("audio");a=o?r.i.periods[o.oa]:null}var s=t?t.audio:null;if(!a&&n){var u;if(u=s){e=n;var c=Vn(this.h.preferredTextLanguage),l=Vn(s.language),d=Vn(e.language);u=Pn(d,c)&&!Pn(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&&(yo(this.j,this.wa,this.qe,this.oe),uu(this),this.wa=null),this.va&&(vo(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 De("error",{detail:e});this.dispatchEvent(t),t.defaultPrevented&&(e.handled=!0)}};var xu=0,Eu=1,Lu=2,Zu=3;function Iu(e,t){var n=ms(new ps(e.Ea(),e.ja()),t.periods[0],new wi(null,0)),r=t.appMetadata||{};return n=Ru(n),{offlineUri:e.toString(),originalManifestUri:t.originalManifestUri,duration:t.duration,size:t.size,expiration:t.expiration,tracks:n,appMetadata:r}}function Ru(e){for(var t=[],n=Nn.Bf(e.variants),r=(n=h(n)).next();!r.done;r=n.next())t.push(Nn.Oc(r.value));for(n=(e=h(e.textStreams)).next();!n.done;n=e.next())t.push(Nn.Kc(n.value));return t}function Cu(){this.g={}}function Gu(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,a=r.bandwidth||t.bandwidth-i;0>=a&&(B.v("Audio bit rate consumes variants bandwidth. Setting video bandwidth to match variant's bandwidth."),a=t.bandwidth),e.g[n.id]=i,e.g[r.id]=a}}function Pu(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 Xu(e){this.g=!1,this.h=new me,this.i=e}function Vu(e){var t=new Mu;e.periods.forEach((function(e,n){var r=Nu(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 Du(e))}))}function Du(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 Mu(){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 Nu(e){for(var t=new Mu,n=(e=h(e)).next();!n.done;n=e.next())t.add(new Du(n.value));return t}function Ou(e){var t=this;if(e&&e.constructor!=Ms)throw new J(2,9,9008);this.h=this.g=null,e?(this.g=e.h,this.h=e.Yb()):(this.g=Rs(),this.h=new He),this.j=!1,this.i=[],this.l=[];var n=!e;this.m=new Xu((function(){return p((function e(){var r;return V(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 a=(i=h(i.value.streams)).next();!a.done;a=i.next())a=a.value,t&&"video"==a.contentType?n.push({contentType:ct(a.mimeType,a.codecs),robustness:e.drmInfo.videoRobustness}):t||"audio"!=a.contentType||n.push({contentType:ct(a.mimeType,a.codecs),robustness:e.drmInfo.audioRobustness});return n}function Yu(e,t,n){return p((function r(){return V(r,(function(r){if(1===r.s)return k(r,function(e,t,n,r){return p((function i(){var a,o,s;return V(i,(function(i){switch(i.s){case 1:return r.drmInfo?(a=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),o=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,o),2)):i.return();case 2:return s=i.B,k(i,a.remove(s),3);case 3:return k(i,a.add(o.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/o)}var a=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),o=a.length+1,s=0,u=Iu(n,r);return Promise.all([t.removeSegments(a,i),t.removeManifests([n.key()],i)])}function Hu(e,t,n,r,i,a){var o={id:a.id,originalId:a.originalId,primary:a.primary,presentationTimeOffset:a.presentationTimeOffset||0,contentType:a.type,mimeType:a.mimeType,codecs:a.codecs,frameRate:a.frameRate,pixelAspectRatio:a.pixelAspectRatio,kind:a.kind,language:a.language,label:a.label,width:a.width||null,height:a.height||null,initSegmentKey:null,encrypted:a.encrypted,keyId:a.keyId,segments:[],variantIds:[]};i=i.presentationTimeline.$b();var s=a.id,u=a.initSegmentReference;return u&&(u=Si(u.i(),u.h,u.g,e.g.streaming.retryParameters),Yo(t,s,u,.5*Pu(r,a.id),!0,(function(t){return p((function r(){var i;return V(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]),o.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)}(a,i,(function(i){var u=Si(i.i(),i.h,i.g,e.g.streaming.retryParameters);Yo(t,s,u,function(e,t,n){return n=n.endTime-n.startTime,Pu(e,t)*n}(r,a.id,i),!1,(function(t){return p((function r(){var a;return V(r,(function(r){switch(r.s){case 1:return k(r,n.addSegments([{data:t}]),2);case 2:a=r.B,e.i.push(a[0]),o.segments.push({startTime:i.startTime,endTime:i.endTime,dataKey:a[0]}),T(r)}}))}))}))})),o}function ju(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 V(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:I(n),Ue(e.l,t),R(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),a=i.next();!a.done;a=i.next())r!=(a=a.value)&&r.language==a.language&&B.v("Similar audio tracks were selected to be stored",r.id,a.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)}Ms.LoadMode={DESTROYED:xu,NOT_LOADED:Eu,MEDIA_SOURCE:Lu,SRC_EQUALS:Zu},Xu.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()})))},Mu.prototype.add=function(e){Wu(this,e)||this.g.push(e)},U("shaka.offline.Storage",Ou),Ou.support=Uu,Ou.prototype.destroy=function(){return this.m.destroy()},Ou.prototype.destroy=Ou.prototype.destroy,Ou.prototype.configure=function(e,t){2==arguments.length&&"string"==typeof e&&(e=Zs(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)},Ou.prototype.configure=Ou.prototype.configure,Ou.prototype.getConfiguration=function(){var e=Rs();return Cs(e,this.g,Rs()),e},Ou.prototype.getConfiguration=Ou.prototype.getConfiguration,Ou.prototype.Yb=function(){return this.h},Ou.prototype.getNetworkingEngine=Ou.prototype.Yb,Ou.prototype.store=function(e,t,n){var r=this;return Ju(this,function(e,t,n,r){return p((function i(){var a,o,s,u,c,l,d,f,m;return V(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,a,o,s,u,c;return V(r,(function(r){switch(r.s){case 1:return i=null,a=e.h,o={networkingEngine:a,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),ju(e),E(r,3),k(r,s.start(t,o),5);case 5:return u=r.B,ju(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(at(c,(function(e){return e.createSegmentIndex()}))),6);case 6:if(ju(e),i)throw i;return r.return(u);case 3:return I(r),k(r,s.stop(),7);case 7:R(r,0)}}))}))}(e,t,r),2));case 2:if(a=i.B,ju(e),a.presentationTimeline.aa()||a.presentationTimeline.ib())throw new J(2,9,9005,t);return o=null,s=new ts,c=u=null,x(i,3,4),k(i,function(e,t,n){return p((function r(){var i,a,o;return V(r,(function(r){switch(r.s){case 1:return i=new wt({Ib:e.h,onError:n,Dc:function(){},onExpirationUpdated:function(){},onEvent:function(){}}),a=Wa(t.periods),o=e.g,i.configure(o.drm),k(r,function(e,t,n){return e.F=[],e.L=n,kt(e,t)}(i,a,o.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,a,(function(e){c=c||e})),6);case 6:if(o=i.B,ju(e),c)throw c;return k(i,function(e,t,n){return p((function r(){var i,a;return V(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 Nn.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 Dt(t,e)}))}(t,n),Vu(t),a=e.g.preferredAudioChannelCount,Nn.$d(t,a),k(r,function(e,t){return p((function n(){var r,i,a,o;return V(n,(function(n){switch(n.s){case 1:r=null,i=h(e.periods),a=i.next();case 2:if(a.done){n.I(0);break}return o=a.value,r&&(o.variants=o.variants.filter((function(e){return Wu(r,new Du(e))}))),k(n,t(o),5);case 5:r=Nu(o.variants),a=i.next(),n.I(2)}}))}))}(t,(function(t){return p((function n(){var r,i,a,o,s,u,c,l;return V(n,(function(n){switch(n.s){case 1:r=Nn,i=[];for(var d=h(t.variants),f=d.next();!f.done;f=d.next())a=f.value,i.push(r.Oc(a));for(f=(d=h(t.textStreams)).next();!f.done;f=d.next())o=f.value,i.push(r.Kc(o));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,a,o),7);case 7:return k(i,s.init(),8);case 8:return ju(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,ju(e),k(i,function(e,t,n,r,i,a){return p((function o(){var s,u,c,l,d,f,m,y,v,g;return V(o,(function(o){switch(o.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=Ru(t.periods[0]),appMetadata:n}}(i,r,a),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 Fo(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(o,2),v=y=function(e,t,n,r,i,a,o){var s=new Cu,u=i.periods.map((function(r){return function(e,t,n,r,i,a){for(var o=h(a.variants),s=o.next();!s.done;s=o.next())Gu(r,s.value);for(o=h(a.textStreams),s=o.next();!s.done;s=o.next())r.g[s.value.id]=52;o=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}(a);var u=new Map;for(o=h(o),s=o.next();!s.done;s=o.next()){var c=Hu(e,t,n,r,i,s=s.value);u.set(s.id,c)}return a.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:a.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:a,duration:i.presentationTimeline.ha(),size:0,expiration:r.Xb(),periods:u,sessionIds:l?It(r):[],drmInfo:c,appMetadata:o}}(e,m,t,n,r,i,a),k(o,function(e){return p((function t(){return V(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=o.B,y.expiration=n.Xb(),g=It(n),y.sessionIds=e.g.offline.usePersistentLicense?g:[],u&&e.g.offline.usePersistentLicense&&!g.length)throw new J(2,9,9007);return o.return(y);case 2:return I(o),k(o,m.destroy(),5);case 5:R(o,0)}}))}))}(e,u.ja,o,a,t,n),10);case 10:if(l=i.B,ju(e),c)throw c;return k(i,u.ja.addManifests([l]),11);case 11:return d=i.B,ju(e),f=new hs("manifest",u.path.Ea,u.path.ja,d[0]),i.return(Iu(f,l));case 4:return I(i),e.j=!1,e.i=[],k(i,s.destroy(),12);case 12:if(!o){i.I(13);break}return k(i,o.destroy(),13);case 13:R(i,0);break;case 3:if(m=Z(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,a;return V(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 a=t.B,t.return(a)}}))}))})))},Ou.prototype.store=Ou.prototype.store,Ou.prototype.Hf=function(){return this.j},Ou.prototype.getStoreInProgress=Ou.prototype.Hf,Ou.prototype.remove=function(e){return Ju(this,function(e,t){return p((function n(){var r,i,a,o,s,u;return V(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,a=new ts,E(n,2),k(n,a.init(),4));case 4:return k(n,ns(a,i.Ea(),i.ja()),5);case 5:return k(n,(o=n.B).getManifests([i.key()]),6);case 6:return s=n.B,u=s[0],k(n,Promise.all([Yu(e,u,a),Ku(e,o,i,u)]),2);case 2:return I(n),k(n,a.destroy(),8);case 8:R(n,0)}}))}))}(this,e))},Ou.prototype.remove=Ou.prototype.remove,Ou.prototype.sg=function(){return Ju(this,function(e){return p((function t(){var n,r,i,a,o,s,u,c,l;return V(t,(function(t){switch(t.s){case 1:return Bu(),n=e.h,r=e.g.drm,i=new ts,a=!1,E(t,2),k(t,i.init(),4);case 4:for(o=[],function(e,t){e.g.forEach((function(e){t(e.getEmeSessionCell())}))}(i,(function(e){return o.push(e)})),s=Promise.resolve(),u={},c=h(o),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,o;return V(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 o=t.B,k(t,e.Jc.remove(o),4);case 4:o.length!=i.length&&(a=!0),T(t)}}))}))}}(u));return k(t,s,2);case 2:return I(t),k(t,i.destroy(),6);case 6:R(t,3);break;case 3:return t.return(!a)}}))}))}(this))},Ou.prototype.removeEmeSessions=Ou.prototype.sg,Ou.prototype.list=function(){return Ju(this,p((function e(){var t,n,r;return V(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 V(r,(function(r){switch(r.s){case 1:return k(r,n.getAllManifests(),2);case 2:r.B.forEach((function(n,r){var i=Iu(new hs("manifest",e.Ea,e.ja,r),n);t.push(i)})),T(r)}}))}))}))})),k(e,r,2);case 2:return I(e),k(e,n.destroy(),6);case 6:R(e,3);break;case 3:return e.return(t)}}))})))},Ou.prototype.list=Ou.prototype.list,Ou.deleteAll=function(){return p((function e(){var t;return V(e,(function(e){switch(e.s){case 1:return t=new ts,E(e,2),k(e,t.erase(),2);case 2:return I(e),k(e,t.destroy(),5);case 5:R(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");Os.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 ac(e,t){B.debug("PatchedMediaKeysApple.requestMediaKeySystemAccess");try{var n=new oc(e,t);return Promise.resolve(n)}catch(r){return Promise.reject(r)}}function oc(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 a=!1,o=!1;if(i.audioCapabilities)for(var s=h(i.audioCapabilities),u=s.next();!u.done;u=s.next())if((u=u.value).contentType){a=!0;var c=u.contentType.split(";")[0];WebKitMediaKeys.isTypeSupported(this.keySystem,c)&&(r.audioCapabilities.push(u),o=!0)}if(i.videoCapabilities)for(u=(i=h(i.videoCapabilities)).next();!u.done;u=i.next())(s=u.value).contentType&&(a=!0,u=s.contentType.split(";")[0],WebKitMediaKeys.isTypeSupported(this.keySystem,u)&&(r.videoCapabilities.push(s),o=!0));a||(o=WebKitMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),r=o?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 Ya(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 De("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],a={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:i.initDataTypes,sessionTypes:["temporary"],label:i.label},o=!1;if(i.audioCapabilities)for(var s=0;s<i.audioCapabilities.length;++s){var u=i.audioCapabilities[s];if(u.contentType){o=!0;var c=u.contentType.split(";")[0];MSMediaKeys.isTypeSupported(this.keySystem,c)&&(a.audioCapabilities.push(u),n=!0)}}if(i.videoCapabilities)for(s=0;s<i.videoCapabilities.length;++s)(u=i.videoCapabilities[s]).contentType&&(o=!0,c=u.contentType.split(";")[0],MSMediaKeys.isTypeSupported(this.keySystem,c)&&(a.videoCapabilities.push(u),n=!0));if(o||(n=MSMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),"required"==i.persistentState&&(n=!1),n)return void(this.g=a)}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 Ya(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 De("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(){Nl()}),-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.")})),oc.prototype.createMediaKeys=function(){B.debug("PatchedMediaKeysApple.MediaKeySystemAccess.createMediaKeys");var e=new uc(this.keySystem);return Promise.resolve(e)},oc.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 De("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=oc,navigator.requestMediaKeySystemAccess=ac)})),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 De("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 Zc(e){return Lc?Lc+e.charAt(0).toUpperCase()+e.slice(1):e}function Ic(e,t){B.debug("PatchedMediaKeysWebkit.requestMediaKeySystemAccess");try{var n=new Cc(e,t);return Promise.resolve(n)}catch(r){return Promise.reject(r)}}function Rc(e){B.debug("PatchedMediaKeysWebkit.setMediaKeys");var t=this.mediaKeys;return t&&t!=e&&Pc(t,null),delete this.mediaKeys,(this.mediaKeys=e)&&Pc(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 a=0;a<t.length;++a){var o=t[a],s={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:o.initDataTypes,sessionTypes:["temporary"],label:o.label},u=!1;if(o.audioCapabilities)for(var c=0;c<o.audioCapabilities.length;++c){var l=o.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(o.videoCapabilities)for(c=0;c<o.videoCapabilities.length;++c)(l=o.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"==o.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 Gc(e){B.debug("PatchedMediaKeysWebkit.MediaKeys"),this.l=e,this.h=null,this.g=new et,this.i=[],this.j={}}function Pc(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 Xc(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 Vc(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 Dc(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|"),a=new Uint8Array(i.byteLength+t.byteLength);a.set(new Uint8Array(i),0),a.set(new Uint8Array(t),i.byteLength),r=a}else r=new Uint8Array(t)}catch(s){return Promise.reject(s)}e.h=new me;var o=Zc("generateKeyRequest");try{e.j[o](e.i,r)}catch(s){if("InvalidStateError"!=s.name)return e.h=null,Promise.reject(s);new Le((function(){try{e.j[o](e.i,r)}catch(t){e.h.reject(t),e.h=null}})).V(.01)}return e.h}function Mc(e,t){var n=e.keyStatuses;n.size=null==t?0:1,n.g=t,e.dispatchEvent(new De("keystatuseschange"))}function Wc(){this.size=0,this.g=void 0}function Nc(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 Oc(){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 Hc(t,n,r){return new e.TextTrackCue(t,n,r)}function jc(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 Gc(this.g);return Promise.resolve(e)},Cc.prototype.getConfiguration=function(){return B.debug("PatchedMediaKeysWebkit.MediaKeySystemAccess.getConfiguration"),this.h},(r=Gc.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 Vc(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=Xc(this,e.sessionId);t?(e=new De("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=Xc(this,e.sessionId))&&(B.debug("PatchedMediaKeysWebkit.MediaKeySession.ready"),Mc(e,"usable"),e.g&&e.g.resolve(),e.g=null)},r.Ig=function(e){B.debug("PatchedMediaKeysWebkit.onWebkitKeyError_",e);var t=Xc(this,e.sessionId);t&&t.handleError(e)},F(Vc,We),(r=Vc.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?Mc(this,"output-restricted"):Mc(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=Zc("addKey");try{this.j[i](this.i,n,r,this.sessionId)}catch(a){this.g.reject(a),this.g=null}}},r.generateRequest=function(e,t){return B.debug("PatchedMediaKeysWebkit.MediaKeySession.generateRequest"),Dc(this,t,null)},r.load=function(e){return B.debug("PatchedMediaKeysWebkit.MediaKeySession.load"),"persistent-license"==this.l?Dc(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=Zc("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=Ic,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=Rc,e.MediaKeys=Gc,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=Oc,Object.defineProperty(t,"disablePictureInPicture",{get:Fc,set:Yc,enumerable:!0,configurable:!0}),document.exitPictureInPicture=Uc,document.addEventListener("webkitpresentationmodechanged",Nc,!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=Hc;else if(6==t)B.info("Using VTTCue polyfill from 6 argument TextTrackCue."),e.VTTCue=jc;else{try{var n=!!Hc(1,2,"")}catch(r){n=!1}n&&(B.info("Using VTTCue polyfill from 3 argument TextTrackCue."),e.VTTCue=Hc)}}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,a=null;if(""==n)return r;try{a=i.parseFromString(n,"text/xml")}catch(A){throw new J(2,2,2005,"Failed to parse TTML.")}if(a){if(n=a.getElementsByTagName("parsererror")[0])throw new J(2,2,2005,n.textContent);if(!(i=a.getElementsByTagName("tt")[0]))throw new J(2,2,2005,"TTML does not contain <tt> tag.");var o=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(a=i.getAttribute("xml:space")||"default",n=Kr.getAttributeNS(i,"http://www.w3.org/ns/ttml#styling","extent"),"default"!=a&&"preserve"!=a)throw new J(2,2,2005,"Invalid xml:space value: "+a);a="default"==a,o=new Al(o,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,o,s,u,c,l,a,!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$/,al=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,ol={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,a,o,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,a,o,s,!0))&&(p.startTime=p.startTime||c,p.endTime=p.endTime||l,u.push(p));if((t=new Qt(c,l,d)).nestedCues=u,(a=vl(e,"region",a,"")[0])&&a.getAttribute("xml:id")){var m=a.getAttribute("xml:id");t.region=o.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 a=fl(t,n,i,"writingMode");if("tb"==a||"tblr"==a?e.writingMode="vertical-lr":"tbrl"==a?e.writingMode="vertical-rl":"rltb"==a||"rl"==a?e.direction="rtl":a&&(e.direction=rn),(a=fl(t,n,i,"textAlign"))?(e.positionAlign=sl[a],e.lineAlign=ol[a],e.textAlign=en[a.toUpperCase()]):e.textAlign="start",(a=fl(t,n,i,"displayAlign"))&&(e.displayAlign=nn[a.toUpperCase()]),(a=fl(t,n,i,"color"))&&(e.color=a),(a=fl(t,n,i,"backgroundColor"))&&(e.backgroundColor=a),(a=fl(t,n,i,"fontFamily"))&&(e.fontFamily=a),(a=fl(t,n,i,"fontWeight"))&&"bold"==a&&(e.fontWeight=700),(a=fl(t,n,i,"wrapOption"))&&"noWrap"==a&&(e.wrapLine=!1),(a=fl(t,n,i,"lineHeight"))&&a.match(qc)&&(e.lineHeight=a),(a=fl(t,n,i,"fontSize"))&&a.match(qc)&&(e.fontSize=a),(a=fl(t,n,i,"fontStyle"))&&(e.fontStyle=dn[a.toUpperCase()]),r){a=r.getAttribute("imageType")||r.getAttribute("imagetype");var o=r.getAttribute("encoding");r=r.textContent.trim(),"PNG"==a&&"Base64"==o&&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,a,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 a=Kr.getAttributeNS(r[i],"http://www.w3.org/ns/ttml#styling",n);if(a)return a}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 a=Kr.getAttributeNS(e[i],"http://www.w3.org/ns/ttml#styling",n);a||(a=ml(e[i],t,n)),a&&(r=a)}return r}function vl(e,t,n,r,i){var a=[];if(!e||1>n.length)return a;var o=e;for(e=null;o&&!(e=i?Kr.getAttributeNS(o,i,t):o.getAttribute(t))&&(o=o.parentNode)instanceof Element;);if(t=e)for(i=(t=h(t=t.split(" "))).next();!i.done;i=t.next())for(i=i.value,o=(e=h(n)).next();!o.done;o=e.next())if(r+(o=o.value).getAttribute("xml:id")==i){a.push(o);break}return a}function gl(e,t){var n=null;if(el.test(e)){n=el.exec(e);var r=Number(n[1]),i=Number(n[2]),a=Number(n[3]),o=Number(n[4]);n=(a+=(o+=(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):al.test(e)&&(n=bl(al,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=on,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=Oi(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,a;return(new Dr).box("payl",Nr((function(e){r=ye(e)}))).box("iden",Nr((function(e){i=ye(e)}))).box("sttg",Nr((function(e){a=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."),Ni(t),n=Ui(t);return e}(r,i,a,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=Zl):console.debug("EmeEncryptionSchemePolyfill: EME not found")}function Zl(e,t){var n=this;return p((function r(){var i;return V(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 Ml(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=Il,r.return(Il.call(n,e,t)))}}))}))}function Il(e,t){var n=this;return p((function r(){var i,a,o,s,u,c,l,d;return V(r,(function(r){switch(r.s){case 1:console.assert(n==navigator,'bad "this" for requestMediaKeySystemAccess'),i=Dl(e),a=[];for(var f=h(t),p=f.next();!p.done;p=f.next())o=p.value,s=Rl(o.videoCapabilities,i),u=Rl(o.audioCapabilities,i),o.videoCapabilities&&o.videoCapabilities.length&&!s.length||o.audioCapabilities&&o.audioCapabilities.length&&!u.length||((c=Object.assign({},o)).videoCapabilities=s,c.audioCapabilities=u,a.push(c));if(!a.length)throw(l=Error("Unsupported keySystem or supportedConfigurations.")).name="NotSupportedError",l.code=DOMException.NOT_SUPPORTED_ERR,l;return k(r,Jc.call(n,e,a),2);case 2:return d=r.B,r.return(new Vl(d,i))}}))}))}function Rl(e,t){return e?e.filter((function(e){return!e.encryptionScheme||e.encryptionScheme==t})):e}function Cl(){}function Gl(){zc?console.debug("McEncryptionSchemePolyfill: Already installed."):navigator.mediaCapabilities?(zc=navigator.mediaCapabilities.decodingInfo,console.debug("McEncryptionSchemePolyfill: Waiting to detect encryptionScheme support."),navigator.mediaCapabilities.decodingInfo=Pl):console.debug("McEncryptionSchemePolyfill: MediaCapabilities not found")}function Pl(e){var t=this;return p((function n(){var r,i;return V(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)&&Ml(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=Xl,n.return(Xl.call(t,e))):n.return(r)}}))}))}function Xl(e){var t=this;return p((function n(){var r,i,a,o,s,u,c,l,d;return V(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,a=i.keySystem,o=i.audio&&i.audio.encryptionScheme,s=i.video&&i.video.encryptionScheme,r=Dl(a),u={powerEfficient:!1,smooth:!1,supported:!1,keySystemAccess:null,configuration:e},o&&o!=r||s&&s!=r)?n.return(u):k(n,zc.call(t,e),2);case 2:if((c=n.B).keySystemAccess){c.keySystemAccess=new Vl(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 Vl(e,t){this.h=e,this.g=t,this.keySystem=e.keySystem}function Dl(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 Ml(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 Nl(){Ll(),Gl()}yn["application/ttml+xml"]=Bc,U("shaka.text.Mp4TtmlParser",_l),_l.prototype.parseInit=function(e){var t=!1;if((new Dr).box("moov",Mr).box("trak",Mr).box("mdia",Mr).box("minf",Mr).box("stbl",Mr).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 Dr).box("mdat",Nr(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),a=n[0].match(/MPEGTS:(\d+)/m);if(i&&a){if(null==(r=kl(new Wi(i[1]))))throw new J(2,2,2e3);r=t.periodStart+(Number(a[1])/9e4-r)}}a=[];var o=n[0].split("\n");for(i=1;i<o.length;i++)if(/^Region:/.test(o[i])){var s=new Wi(o[i]),u=new hn;Ui(s),Ni(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."),Ni(s),c=Ui(s)}a.push(u)}for(i=[],s=1;s<n.length;s++){if(l=o=n[s].split("\n"),d=r,o=a,1==l.length&&!l[0]||/^NOTE($|[ \t])/.test(l[0])||"STYLE"==l[0])o=null;else{u=null,l[0].includes("--\x3e")||(u=l[0],l.splice(0,1)),h=kl(c=new Wi(l[0]));var f=Oi(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()),Ni(c),d=Ui(c);d;)Sl(l,d,o)||B.v("VTT parser encountered an invalid VTT setting: ",d," The setting will be ignored."),Ni(c),d=Ui(c);null!=u&&(l.id=u),o=l}o&&i.push(o)}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 Dr).box("moov",Mr).box("trak",Mr).box("mdia",Mr).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",Mr).box("stbl",Mr).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,a=[],o=[],s=!1,u=!1,c=!1,l=null;if((new Dr).box("moof",Mr).box("traf",Mr).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=[],o=0;o<r;o++){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)}a=i})).box("mdat",Nr((function(e){c=!0,r=e}))).parse(e),!c&&!s&&!u)throw new J(2,2,2008);var d=i,h=new Pr(new DataView(r.buffer,r.byteOffset,r.byteLength),0);return a.forEach((function(e){var r=e.duration||l,a=e.Sd?i+e.Sd:d;d=a+(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&&o.push(xl(f,t.periodStart+a/n.g,t.periodStart+d/n.g)):B.error("WVTT sample duration unknown, and no default found!")}while(e.sampleSize&&s<e.sampleSize)})),o.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=Gl,Vl.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},Vl.prototype.createMediaKeys=function(){return this.h.createMediaKeys()},U("EncryptionSchemePolyfills",Wl),Wl.install=Nl,void 0!==n&&n.gf&&(n.gf=Wl)}.call(t,e,e,void 0),t.shaka)wQ[n]=t.shaka[n]}();var kQ=g(SQ);function TQ(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 xQ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?TQ(Object(n),!0).forEach((function(t){GQ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):TQ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function EQ(){EQ=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:{},a=i.iterator||"@@iterator",o=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 a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new T(i||[]);return r(o,"_invoke",{value:_(e,n,s)}),o}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,a,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,a)&&(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,a,o,s){var u=l(e[r],e,a);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,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,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[a];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,o,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new A(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(g),u(g,s,"Generator"),u(g,a,(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 o.type="throw",o.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 a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.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 a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},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 LQ(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(S0){return void n(S0)}s.done?t(u):Promise.resolve(u).then(r,i)}function ZQ(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){LQ(a,r,i,o,s,"next",e)}function s(e){LQ(a,r,i,o,s,"throw",e)}o(void 0)}))}}function IQ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function RQ(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 CQ(e,t,n){return t&&RQ(e.prototype,t),n&&RQ(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function GQ(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function PQ(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&&VQ(e,t)}function XQ(e){return(XQ=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function VQ(e,t){return(VQ=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function DQ(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function MQ(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=XQ(e);if(t){var i=XQ(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 DQ(e)}(this,n)}}function WQ(){return WQ="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=XQ(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}},WQ.apply(this,arguments)}function NQ(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,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(u){s=!0,i=u}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||UQ(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 OQ(e){return function(e){if(Array.isArray(e))return FQ(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||UQ(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 UQ(e,t){if(e){if("string"==typeof e)return FQ(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)?FQ(e,t):void 0}}function FQ(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 YQ=pi,KQ=w,HQ=WZ.f;YQ({target:"Object",stat:!0,forced:KQ((function(){return!Object.getOwnPropertyNames(1)}))},{getOwnPropertyNames:HQ});var jQ=KU;pi({target:"Number",stat:!0,forced:Number.parseFloat!=jQ},{parseFloat:jQ});var BQ=Jd;pi({target:"Array",proto:!0},{fill:B_}),BQ("fill");var JQ,zQ=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},QQ=function(){return"wakeLock"in navigator},qQ=function(){function e(){var t=this;IQ(this,e),this.enabled=!1,QQ()?(this._wakeLock=null,this.handleVisibilityChange=function(){null!==t._wakeLock&&t.visible&&t.enable()},document.addEventListener("visibilitychange",this.handleVisibilityChange),document.addEventListener("fullscreenchange",this.handleVisibilityChange)):zQ()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.no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OSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBF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WC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/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 CQ(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(QQ()&&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(zQ())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(){QQ()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):zQ()?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 $Q(){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 eq(){var e=JQ||(JQ=document.querySelector("#hackAudioPP"));e?!1===e.paused&&!1===e.muted||(e.muted=!1,e.play().catch((function(e){console.log("bgAudio: ",e.message)}))):$Q()}var tq=new(function(){function e(){var t=this;IQ(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,a,o,s,u,c,l,d){var h;if(t._status){var f=n,p=[r,i,a,o,s,u,c,l,d].filter((function(e){return void 0!==e}));(h=console)[e].apply(h,["["+f+"]:"].concat(OQ(p)))}}}))}return CQ(e,[{key:"enable",get:function(){return this._status}},{key:"long",get:function(){return"2"===this._level}}]),e}());function nq(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 rq="xg-video",iq=!1;try{iq=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(k0){}var aq={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:iq?6:8,maxDecodeOnceFirstTime:8,maxDecodeOnceWebcodec:20};function oq(){return rq}function sq(){return aq}function uq(){var e="undefined"!=typeof customElements&&customElements.get(rq);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 cq(){if("undefined"==typeof customElements)return!1;var e=customElements.get(rq);return iq&&!(null==e||!e.h265SimdUrl)}function lq(){if("undefined"==typeof customElements)return!1;var e=customElements.get(rq);return!!window.SharedArrayBuffer&&!(null==e||!e.h265ThreadUrl)}var dq=!1;try{var hq,fq;dq="1"===(null===(hq=localStorage)||void 0===hq||null===(fq=hq.getItem)||void 0===fq?void 0:fq.call(hq,"_sds"))}catch(k0){}var pq=0,mq=0,yq=0,vq=!1;function gq(e){localStorage.setItem("xgv_dis",e),2===e&&localStorage.setItem("xgv_dist",(new Date).getTime())}function bq(){if(!0===(!!vq||0!==sq().evaluateVVCount&&(pq===sq().evaluateVVCount&&(yq=mq/pq),yq>=sq().disabledByLowdecodePrecent&&(vq=!0),vq)))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<sq().disabledDuration)return!0;Aq()}}function Aq(){localStorage.removeItem("xgv_dist"),localStorage.removeItem("xgv_dis")}var _q={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},wq=["waiting","canplay","play","playing","pause","seeking","seeked","loadeddata","loadedmetadata","timeupdate","durationchange","volumechange","progress","error","ended","resize","loadstart","decodefps","lowdecode","largeavgap","firstframe"],Sq={AUDIO_READY:"audio_ready",AUDIO_NOT_ALLOWED_AUTOPLAY:"audio_not_allowed_autoplay",AUDIO_WAITING:"audio_waiting",AUDIO_SYNC_DTS:"audio_sync_dts"},kq={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"},Tq={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"},xq={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"},Eq=function(e){PQ(n,e);var t=MQ(n);function n(e,r){var i;return IQ(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 CQ(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(Tq.APPEND_CHUNKS,this._appendChunk.bind(this)),this._parent.on(Tq.RESET_BASE_DTS,this._resetDts.bind(this)),this._parent.on(Tq.START_RENDER,this._startRender.bind(this)),this._parent.on(Tq.DO_PLAY,this._doPlay.bind(this)),this._parent.on(Tq.DO_PAUSE,this._doPause.bind(this)),this._parent.on(Tq.DO_SEEK,this._doSeek.bind(this)),this._parent.on(Tq.DESTROY,this._destroy.bind(this)),this._parent.on(Tq.CHASE_FRAME,this._doChaseFrame.bind(this)),this._parent.on(Tq.SINGLE_TRACK,(function(t){e._singleTrack=t})),this._parent.on(Tq.SET_PLAY_MODE,(function(t){e._isLive="LIVE"===t})),this._parent.on(Tq.INNER_DEGRADE,(function(){e._innerDegrade=!0})),this._parent.on(Tq.SET_VIDEO_DURATION,(function(t){e.duration=t}))}}]),n}(Za),Lq=function(){function e(t){IQ(this,e),this.TAG="AudioTimeRange",this._parent=t,this._buffers=[],this._duration=0,this._baseDts=0,this._lastBuffer=null}return CQ(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 a=e.getChannelData(i),o=0;o<r;o++)a[o]=a[o]*o/r;for(var s=n-r;s<n;s++)a[s]=a[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,a=i+t,o={start:i,end:a,startDts:n,source:e,duration:t,delay:r};if(tq.log(this.TAG,"add new buffer range, startDts:".concat(n,", [").concat(o.start," , ").concat(o.end,"]")),!this._buffers.filter((function(e){return e.start===i})).length)return this._buffers.push(o),this.isLive&&(this._duration=a),o.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 a=e[i];Math.abs(r.end-a.start)<.5?r.end=a.end:(n.push(r),r={start:a.start,end:a.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 tq.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}(),Zq=[-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],Iq=[-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],Rq=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 Cq={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=Zq[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=Iq[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 a,o=function(e,t,n){return e/t/n}(t.byteLength,n,i),s=e.createBuffer(n,o,r),u=new DataView(t),c=0;c<n;c++)for(var l=s.getChannelData(c),d=void 0,h=0;h<o;h++)d=u.getUint16(h*(2*n)+2*c,!0),l[h]=(a=d)>=32768?-(65536-a)/32768:a/32767;return{audioBuffer:s,duration:o/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 a=t.byteLength+7;return i[3]=i[3]|3&a>>11,i[4]=255&a>>3,i[5]=224&a<<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 a=new Uint8Array(n),o=0,s=0,u=e.length;s<u;s++)t&&s%t==0||(a.set(e[s],o),o+=e[s].byteLength);return a},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=Rq}},Gq="create new AudioContext error",Pq=function(e){PQ(i,e);var t,n,r=MQ(i);function i(e,t){var n;return IQ(this,i),GQ(DQ(n=r.call(this,e,t)),"doPause",n._doPause),n.TAG="AudioRender",n._timeRange=new Lq(DQ(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(DQ(n)),n._initAudioCtx(e.volume||.6),n._bindEvents(),n}return CQ(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;tq.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,tq.log(this.TAG,"webAudio state:",this._audioCtx.state),$Q(),this._bindAudioCtxEvent(),this._audioCtx.suspend()):(tq.warn(this.TAG,"create webaudio error!"),void setTimeout((function(){t._emitTimelineEvents(Tq.PLAY_EVENT,_q.ERROR,t._assembleErr(Gq))})))}},{key:"_bindAudioCtxEvent",value:function(){var e=this;this._onStateChange=function(){e._audioCtx&&"running"===e._audioCtx.state&&e._ready&&e._emitTimelineEvents(Tq.PLAY_EVENT,_q.PLAYING)},this._audioCtx.addEventListener("statechange",this._onStateChange)}},{key:"_bindEvents",value:function(){var e=this;WQ(XQ(i.prototype),"_bindEvents",this).call(this),this._parent.on(xq.CHASE_AUDIO_FRAME,this._doChaseFrame.bind(this)),this._parent.on(Tq.UPDATE_VOLUME,(function(t){e._gainNode&&(e._gainNode.gain.value=Number.isFinite(t)?t:1,e._emitTimelineEvents(Tq.PLAY_EVENT,_q.VOLUME_CHANGE))})),this._parent.on(Tq.END_OF_STREAM,(function(){var t;e._endOfStream=!0,e.noAudio||null!==(t=e._timeRange)&&void 0!==t&&t.hasBuffer()||null==e||e._emitTimelineEvents(Tq.PLAY_EVENT,_q.ENDED)}))}},{key:"_appendChunk",value:function(e,t){if(!this.noAudio){this._meta||(this._meta=t,tq.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&&(tq.log(this.TAG,"_doChaseFrame","startTime:",r.start,"buffeLength:",this.buffered.end(0)-r.start),this._reInitAudioCtx(r.start).then((function(){t._startRender(),t._emitTimelineEvents(Tq.PLAY_EVENT,_q.TIMEUPDATE)})).catch((function(e){})))}},{key:"_decodeAACWrapper",value:(n=ZQ(EQ().mark((function e(){var t,n,r,i,a,o,s,u,c,l;return EQ().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(a=parseInt(i/3-1)||1,o=parseInt(t/a),s=[],u=0;u<a;u++)u<a-1?s.push(this._sampleQueue.slice(u*o,(u+1)*o)):s.push(this._sampleQueue.slice(u*o));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(Tq.UPDATE_SEGMENT_END,l.end)),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(12),this._emitTimelineEvents(Tq.PLAY_EVENT,_q.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=ZQ(EQ().mark((function e(t){var n;return EQ().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;Cq.checkRefillFrame(e);var i=e.map((function(e){return Cq.packageAACToAdts(t._meta,e)})),a=Cq.concatAdts(i,0);return new Promise((function(e,i){var o=t._audioCtx.decodeAudioData(a.buffer,(function(i){if(t._timeRange){if(t._lastAudioBufferInfo&&t.isLive){var a=t._lastAudioBufferInfo,o=a.dts+a.duration;(r=n.dts-o)>1&&(t._timeRange._duration+=r/1e3,tq.log(t.TAG,"_decodeAAC","audio data dts is not continue, last end dts:",o,",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,tq.log(t.TAG,"_decodeAAC","set ready true start=",s),t.emit(Sq.AUDIO_READY,s))}t._emitTimelineEvents(Tq.PLAY_EVENT,_q.PROGRESS),t._emitTimelineEvents(Tq.PLAY_EVENT,_q.DURATION_CHANGE),e()}}),i);o.catch&&o.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,a=0;this._sampleQueue.forEach((function(e,t){0===t&&(i=e.dts),r.set(e.data,a),a+=e.data.byteLength})),this._sampleQueue=[];try{var o=this._meta,s=o.codecType,u=o.channelCount,c=o.sampleSize,l=o.sampleRate,d=Cq.decodeG711(r,s),h=Cq.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,tq.log(this.TAG,"_decodeG711","set ready true"),this.emit(Sq.AUDIO_READY,m)),this._emitTimelineEvents(Tq.PLAY_EVENT,_q.PROGRESS),this._emitTimelineEvents(Tq.PLAY_EVENT,_q.DURATION_CHANGE)}catch(k0){this._emitTimelineEvents(Tq.PLAY_EVENT,_q.ERROR,this._assembleErr("ERROR_MSG.DECODE_ERR:".concat(k0&&k0.message)))}}}},{key:"_onSourceBufferEnded",value:function(){this._isSourceBufferEnd=!0,tq.long&&tq.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&&(tq.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(Sq.AUDIO_READY)):n:(this._endOfStream||!this._isLive)&&this.currentTime-this.duration>-.5?(this._emitTimelineEvents(Tq.PLAY_EVENT,_q.TIMEUPDATE),void this._emitTimelineEvents(Tq.PLAY_EVENT,_q.ENDED)):(this._ready=!1,this._audioCtx.suspend(),this.emit(Sq.AUDIO_WAITING),void(e&&(this._onAudioReady||(this._onAudioReady=function(e){t._ajustSeekTime(e)}),this.removeListener(Sq.AUDIO_READY,this._onAudioReady),this.once(Sq.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){})),eq()),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(k0){}t.startDts&&this._emitTimelineEvents(Tq.SYNC_DTS,t.startDts)}}}},{key:"_destroy",value:function(){tq.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}(Eq);function Xq(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vq(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 Dq(e,t,n){return t&&Vq(e.prototype,t),n&&Vq(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mq(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wq(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,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(u){s=!0,i=u}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||Oq(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 Nq(e){return function(e){if(Array.isArray(e))return Uq(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Oq(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 Oq(e,t){if(e){if("string"==typeof e)return Uq(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)?Uq(e,t):void 0}}function Uq(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 Fq="video",Yq="hevc";function Kq(){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 Hq(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 jq=function(){function e(){Xq(this,e),this.buffer=new Uint8Array(0)}return Dq(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 a=new e(t),o=0;return r.forEach((function(e){a.set(e,o),o+=e.length})),a}(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}(),Bq=Math.pow(2,32)-1,Jq=function(){function e(){Xq(this,e)}return Dq(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),a=new Uint8Array(i);a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=255&i,a.set(e,4);var o=8;return n.forEach((function(e){a.set(e,o),o+=e.byteLength})),a}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===Fq&&e.codecType===Yq}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return Kq(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],Hq(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(Nq(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(Nq(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===Fq?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]),a=e.esds(t.config),o=e.sinf(t.enca);return e.box(e.types.enca,i,a,o)}},{key:"encv",value:function(t){var n,r,i=t.sps.length>0?t.sps[0]:[],a=t.pps.length>0?t.pps[0]:[],o=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,o>>8&255,255&o,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,Nq(i)).concat([1,a.length>>>8&255,255&a.length])).concat.apply(n,Nq(a))),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(Hq(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]),a=e.schi(t);return e.box(e.types.sinf,n,e.box(e.types.frma,r),e.box(e.types.schm,i),a)}},{key:"avc1hev1",value:function(t){var n=t.codecType===Yq,r=n?e.types.hvc1:e.types.avc1,i=n?e.hvcC(t):e.avcC(t),a=[new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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?a.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&a.push(e.pasp(t.sarRatio)),e.box.apply(e,[r].concat(a))}},{key:"avcC",value:function(t){var n,r,i,a=[],o=[];return t.sps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,Nq(e))})),t.pps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,Nq(e))})),e.box(e.types.avcC,new Uint8Array((n=(r=[1,a[3],a[4],a[5],255,224|t.sps.length]).concat.apply(r,a).concat([t.pps.length])).concat.apply(n,o)))}},{key:"hvcC",value:function(t){var n=t.hvcC;if(n instanceof ArrayBuffer||n instanceof Uint8Array)return n;var r,i=t.vps,a=t.sps,o=t.pps;if(n){var s=n.generalProfileCompatibilityFlags,u=n.generalConstraintIndicatorFlags,c=(i.length&&1)+(a.length&&1)+(o.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,Nq(e))};i.length&&(r.push(160,0,i.length),i.forEach(l)),a.length&&(r.push(161,0,a.length),a.forEach(l)),o.length&&(r.push(162,0,o.length),o.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=Wq(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(Nq(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(Nq(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 a=e.saiz(t),o=e.saio(t),s=e.trun1(t),u=e.senc(t);return e.box(e.types.traf,n,r,a,o,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 jq;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 jq,r=jq.writeUint32(t.samples.length),i=null;if(t.isVideo){var a=t.videoSencLength;i=jq.writeUint32(16*t.samples.length+a+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=jq.writeUint32(16*t.samples.length+92))}else{var o=12*t.samples.length+124;t.isAudioEncryption&&(o=12*t.samples.length+8*t.audioSenc.length+177),i=jq.writeUint32(o)}return t.samples.forEach((function(e){n.write(jq.writeUint32(e.duration)),n.write(jq.writeUint32(e.size)),n.write(jq.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&n.write(jq.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 jq,r=t.samples.length,i=t.isVideo?16:8,a=t.isVideo?2:0,o=[],s=0;return t.isVideo?(o=t.videoSenc,s=t.videoSencLength):o=t.audioSenc,s=s||i*r,n.write(jq.writeUint32(16+s),e.types.senc,this.extension(0,a)),n.write(jq.writeUint32(r)),o.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(jq.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){n.write(jq.writeUint16(e.BytesOfClearData)),n.write(jq.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/(Bq+1)),i=Math.floor(n%(Bq+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 a=new Uint8Array(i);a.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 o=0;o<r;o++){var s=t[o],u=s.duration,c=s.size,l=s.flag,d=void 0===l?{}:l,h=s.cts,f=void 0===h?0:h;a.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*o)}return e.box(e.types.trun,a)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(Nq(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===Fq?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,Kq(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,a=e.sampleDescIndex;r.set([t>>24,t>>16&255,t>>8&255,255&t,n>>24,n>>16&255,n>>8&255,255&n,a>>24,a>>16&255,a>>8&255,255&a],i),i+=12})),e.box(e.types.stsc,Kq(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,Kq(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,Kq(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,Kq(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,Kq(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,a=t.samples[0].sampleOffset*r,o=8;t.samples.forEach((function(e){o+=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=o+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=o+16*t.samples.length+84)}else s=o+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=o+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,a>>24&255,a>>16&255,a>>8&255,255&a,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}();Mq(Jq,"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))),Mq(Jq,"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])}),Mq(Jq,"FTYPAVC1",Jq.box(Jq.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),Mq(Jq,"FTYPHEV1",Jq.box(Jq.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),Mq(Jq,"DINF",Jq.box(Jq.types.dinf,Jq.box(Jq.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),Mq(Jq,"VMHD",Jq.box(Jq.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),Mq(Jq,"SMHD",Jq.box(Jq.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),Mq(Jq,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),Mq(Jq,"STTS",Jq.box(Jq.types.stts,Jq.StblTable)),Mq(Jq,"STSC",Jq.box(Jq.types.stsc,Jq.StblTable)),Mq(Jq,"STSZ",Jq.box(Jq.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),Mq(Jq,"STCO",Jq.box(Jq.types.stco,Jq.StblTable));var zq=function(){function e(t,n){Xq(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=n}return Dq(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}();Mq(zq,"disabled",!0);var Qq=function(){function e(t,n,r){Xq(this,e),this.videoTrack=t,this.audioTrack=n;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new zq("FMP4Remuxer",!r||!r.openLog||!r.openLog)}return Dq(e,[{key:"remux",value:function(){var e,t,n,r,i,a=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),l=u.exist(),d=[];return a&&(o&&o.initMerge?(c&&d.push(this.videoTrack),l&&d.push(this.audioTrack),n=Jq.initSegment(d)):(c&&(e=Jq.initSegment([this.videoTrack])),l&&(t=Jq.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),a=new DataView(i.buffer),o=function(e,n,o,s){s=t[e];var u=0;s.units.forEach((function(e){a.setUint32(o,e.byteLength),o+=4,i.set(e,o),o+=e.byteLength,u+=4+e.byteLength})),s.size=u,c=o,r=s},s=0,u=t.length,c=0;s<u;s++)o(s,0,c,r);var l=Jq.mdat(i);return Kq(Jq.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=Jq.mdat(t);return Kq(Jq.moof([e]),n)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}(),qq=function(){function e(t,n){Xq(this,e),this.videoTrack=t,this.audioTrack=n}return Dq(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()),a=(null==t?void 0:t.exist())&&(null==t?void 0:t.hasSample());return i&&a?n=this._remuxMix(e,t):i?n=this._remuxTrack(e):a&&(r=this._remuxTrack(t)),e&&(e.samples=[]),t&&(t.samples=[]),{videoSegment:n,audioSegment:r}}},{key:"_remuxMix",value:function(e,t){var n=Jq.ftyp([e,t]),r=this._remuxData(e,n.byteLength+8),i=r.mdatData,a=r.chunkOffset,o=this._remuxData(t,a).mdatData,s=Jq.mdat(Kq(i,o)),u=Jq.moovMP4([e,t]);return e.ext=void 0,t.ext=void 0,e.samples=[],t.samples=[],Kq(n,s,u)}},{key:"_remuxTrack",value:function(e){var t=Jq.ftyp([e]),n=this._remuxData(e,t.byteLength+8).mdatData,r=Jq.mdat(n),i=Jq.moovMP4([e]);return e.ext=void 0,e.samples=[],Kq(t,r,i)}},{key:"_remuxData",value:function(e,t){var n=e.type===Fq,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 a,o=new Uint8Array(i),s=new DataView(o.buffer),u=e.ext={stts:[],stsc:[],stsz:[],stco:[],stss:[],ctts:[]},c=0,l=0,d=r.length,h=0;h<d;h++){l+=(a=r[h]).duration;var f=n?0:a.size;n?a.units.forEach((function(e){s.setUint32(c,e.byteLength),c+=4,o.set(e,c),c+=e.byteLength,f+=4+e.byteLength})):(o.set(a.data,c),c+=f),a.size=f,u.stsz.push(f),n&&this._fillCttsSamples(u.ctts,a.cts),this._fillSttsSamples(u.stts,a,r[h+1]),this._fillStcoSamples(u.stco,h,1,t),t+=f,n&&a.keyframe&&u.stss.push(h+1)}return e.duration=l,this._fillStscSamples(u.stsc,d,1),{mdatData:o,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 $q(){$q=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:{},a=i.iterator||"@@iterator",o=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 a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new T(i||[]);return r(o,"_invoke",{value:_(e,n,s)}),o}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,a,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(x([])));v&&v!==t&&n.call(v,a)&&(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,a,o,s){var u=l(e[r],e,a);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,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,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[a];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,o,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new A(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(g),u(g,s,"Generator"),u(g,a,(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 o.type="throw",o.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 a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.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 a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},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 e$(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(S0){return void n(S0)}s.done?t(u):Promise.resolve(u).then(r,i)}function t$(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){e$(a,r,i,o,s,"next",e)}function s(e){e$(a,r,i,o,s,"throw",e)}o(void 0)}))}}function n$(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r$(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 i$(e,t,n){return t&&r$(e.prototype,t),n&&r$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a$(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o$(e){return(o$=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s$(e,t){return(s$=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function u$(){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(k0){return!1}}function c$(e,t,n){return(c$=u$()?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&&s$(i,n.prototype),i}).apply(null,arguments)}function l$(e){var t="function"==typeof Map?new Map:void 0;return l$=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 c$(e,arguments,o$(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s$(r,e)},l$(e)}function d$(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 h$(){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 f$(){try{return parseInt(performance.now(),10)}catch(k0){return(new Date).getTime()}}var p$,m$=function(){function e(){n$(this,e)}return i$(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(S0){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var n=[],r=0,i=e.length;r<i;r++){var a=n.length;if(a&&t){var o=n[a-1],s=o[1];if(e.start(r)-s<=t){var u=e.end(r);u>s&&(o[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,a=0,o=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],a=p[1],o=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:a,index:o,buffers:d,nextStart:s,nextEnd:u,prevStart:c,prevEnd:l,currentTime:n,behind:n-i,remaining:a?a-n:0,length:e.totalLength&&e.totalLength(d)}}}]),e}(),y$="network",v$="network_timeout",g$="demux",b$="remux",A$="media",_$="other",w$={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"},S$=(a$(p$={},"manifest",{HLS:1100}),a$(p$,y$,2100),a$(p$,v$,2101),a$(p$,g$,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400}),a$(p$,b$,{FMP4:4100,MP4:4200}),a$(p$,A$,{MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203}),a$(p$,_$,8e3),p$),k$=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&&s$(e,t)}(i,e);var t,n,r=(t=i,n=u$(),function(){var e,r=o$(t);if(n){var i=o$(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return d$(this,e)});function i(e,t,n,a,o){var s;return n$(this,i),(s=r.call(this,o||(null==n?void 0:n.message))).errorType=e===v$?y$:e,s.originError=n,s.ext=a,s.errorCode=S$[e][t]||S$[e],s.errorMessage=s.message,s.errorCode||(s.errorType=_$,s.errorCode=S$[s.errorType]),s}return i$(i,null,[{key:"create",value:function(e,t,n,r,a){return e instanceof i?e:(e instanceof Error&&(n=e,e=""),e||(e=_$),new i(e,t,n,r,a))}},{key:"network",value:function(e){var t;return new i(null!=e&&e.isTimeout?v$:y$,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}(l$(Error)),T$="undefined"!=typeof window,x$=function(){function e(t){n$(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]")}return i$(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,f$()].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,f$()].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,f$()].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,f$()].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}();a$(x$,"disabled",!0);var E$=function(){try{return T$?window.MediaSource:null}catch(k0){}}(),L$="appendBuffer",Z$="removeBuffer",I$=function(){function e(t,n){var r=this;n$(this,e),a$(this,"media",null),a$(this,"mediaSource",null),a$(this,"_openPromise",h$()),a$(this,"_queue",Object.create(null)),a$(this,"_sourceBuffer",Object.create(null)),a$(this,"_mseFullFlag",{}),a$(this,"_st",0),a$(this,"_opst",0),a$(this,"_logger",null),a$(this,"_config",null),a$(this,"_url",null),a$(this,"_onSBUpdateEnd",(function(e){var t=r._queue[e];if(t){var n=t.shift();if(n){var i=f$()-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)}}})),a$(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 k$(A$,w$.MSE_APPEND_BUFFER,t)))}})),this._config=Object.assign(e.getDefaultConfig(),n),t&&this.bindMedia(t),this._logger=new x$("MSE"),this._config.openLog&&x$.enable()}var t,n,r;return i$(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=f$()-e._st;e._logger.debug("MSE OPEN",r),t.removeEventListener("sourceopen",n),e._openPromise.resolve({costtime:r})})),this._openPromise=h$()}return this._openPromise}},{key:"bindMedia",value:(r=t$($q().mark((function e(t){var n,r,i=this;return $q().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&&E$){e.next=5;break}throw new Error("Param media or MediaSource does not exist");case 5:return this.media=t,n=this.mediaSource=new E$,this._st=f$(),r=function e(){var r=f$()-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=t$($q().mark((function e(){var t,n,r,i=this;return $q().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(S0){}Object.keys(this._sourceBuffer).forEach((function(e){try{t.removeSourceBuffer(i._sourceBuffer[e])}catch(S0){}}))}if(this.media){this.media.removeAttribute("src");try{this.media.load()}catch(S0){}this.media=null}this.mediaSource=null,this._openPromise=h$(),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(S0){throw new k$(A$,w$.MSE_ADD_SB,S0)}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=f$(),null===(i=r._sourceBuffer[e])||void 0===i||i.appendBuffer(t))}),L$,n):Promise.resolve()}},{key:"remove",value:function(e,t,n,r){var i=this,a=!1;return this._mseFullFlag[e]&&(a=!0),this._enqueueOp(e,(function(){if(i.mediaSource){var a=i._sourceBuffer[e];t>=n||!a?i._onSBUpdateEnd(e):(i._opst=f$(),i._logger.debug("MSE REMOVE START",e,t,n,r),a.remove(t,n))}}),Z$,r,a)}},{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,m$.end(m$.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 m$.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return m$.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return m$.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,t,n,r,i){var a=this;if(!this.mediaSource)return Promise.resolve();var o=this._queue[e]=this._queue[e]||[],s={exec:t,promise:h$(),opName:n,context:r};return i?(o.splice(0,0,s),this._mseFullFlag[e]=!1,this._startQueue(e)):o.push(s),this.isOpened?1===o.length&&this._startQueue(e):this._openPromise.then((function(){1===o.length&&a._startQueue(e)})),s.promise}},{key:"_enqueueBlockingOp",value:(t=t$($q().mark((function e(t,n){var r,i,a=this;return $q().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=a._queue[e],r=h$();i.push(r),t.push({exec:function(){return r.resolve()},promise:r,opName:n}),1===t.length&&a._startQueue(e)})),e.abrupt("return",Promise.all(i).then((function(){try{return t()}finally{r.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){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(S0){S0&&S0.message&&S0.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 k$(A$,w$.MSE_FULL,S0))):(this._logger.error(S0),n.promise.reject(new k$(A$,w$.MSE_OTHER,S0)),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(!E$)return!1;try{return E$.isTypeSupported(e)}catch(S0){return this._logger.error(e,S0),!1}}}]),e}();a$(I$,"VIDEO","video"),a$(I$,"AUDIO","audio");var R$={"mp4a.40.5":1,"mp4a.40.2":2},C$=.05,G$=new(function(){function e(){IQ(this,e),GQ(this,"_queue",[]),"undefined"!=typeof document&&(this._tempMedia=document.createElement("video"))}return CQ(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=R$[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}()),P$=function(e){PQ(a,e);var t,n,r,i=MQ(a);function a(e,t){var n;return IQ(this,a),GQ(DQ(n=i.call(this,e,t)),"_media",void 0),GQ(DQ(n),"_isTempMedia",!1),GQ(DQ(n),"_mse",void 0),GQ(DQ(n),"_remuxer",null),GQ(DQ(n),"_codec",""),GQ(DQ(n),"_sourceCreated",!1),GQ(DQ(n),"_needInitSegment",!0),GQ(DQ(n),"_seekNoSideEffect",!1),GQ(DQ(n),"_startRendered",!1),GQ(DQ(n),"_firstTimeAppendedBuffer",!1),GQ(DQ(n),"_sampleQueue",[]),GQ(DQ(n),"_inProcessing",!1),GQ(DQ(n),"_duration",0),GQ(DQ(n),"_mediaCache",G$),GQ(DQ(n),"_resetDts",(function(){})),GQ(DQ(n),"_onCanplay",(function(){n._ready||(n._ready=!0,n.emit(Sq.AUDIO_READY))})),GQ(DQ(n),"_onPlaying",(function(){n._parent.ready&&(n._audioCanAutoplay=!0,n._emitTimelineEvents(Tq.PLAY_EVENT,_q.PLAYING))})),GQ(DQ(n),"_onWaiting",(function(){if(!n._seekNoSideEffect){try{for(var e,t=n._media.buffered,r=n._media.currentTime,i=0,a=0,o=t.length;a<o;a++)t.start(a)<r&&t.end(a)>r&&(i=t.end(a)-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=DQ(n))||void 0===e||e._emitTimelineEvents(Tq.PLAY_EVENT,_q.ENDED))}catch(k0){}n._ready=!1,n.emit(Sq.AUDIO_WAITING)}})),GQ(DQ(n),"_onSeeked",(function(){n._seekNoSideEffect||n._isLive?n._seekNoSideEffect=!1:(tq.log(n.TAG,"seeked"),n._ready||(n._media.pause(),n._ready=!0,n.emit(Sq.AUDIO_READY)))})),GQ(DQ(n),"_onProgress",(function(){if(n._media.readyState<=1){var e=n._getBufferGap();e>0&&e<1&&(n._media.currentTime+=e+C$,tq.warn(n.TAG,"progress, gap=",e))}n._emitTimelineEvents(Tq.PLAY_EVENT,_q.PROGRESS),n._emitTimelineEvents(Tq.PLAY_EVENT,_q.DURATION_CHANGE)})),GQ(DQ(n),"_onEnded",(function(){var e;tq.log(n.TAG,"ended!"),null===(e=DQ(n))||void 0===e||e._emitTimelineEvents(Tq.PLAY_EVENT,_q.ENDED)})),GQ(DQ(n),"_onOnceProgress",(function(){if(n._media.buffered.length){var e=n._media.buffered.start(0);e&&(n._media.currentTime=e+C$,tq.log(n.TAG,"start gap:",e)),n._media.removeEventListener("progress",n._onOnceProgress)}})),GQ(DQ(n),"_onError",(function(){var e;n._emitTimelineEvents(Tq.PLAY_EVENT,_q.ERROR,n._assembleErr("audio error: ".concat(null===(e=n._media.error)||void 0===e?void 0:e.message),3))})),GQ(DQ(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=xQ(xQ({},t),{},{exist:function(){return!0},hasSample:function(){return!0},samples:[]}),tq.warn(n.TAG,"audio set metadata",n._meta),void n._doAppendWrapper();n._meta.sampleRate!==t.sampleRate&&(tq.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()}})),GQ(DQ(n),"_doAppend",function(){var e=ZQ(EQ().mark((function e(t){var r,i,a;return EQ().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n._remuxer||(n._remuxer=new Qq({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,tq.log(n.TAG,"video/mp4;codecs=".concat(n._codec)),n._mse.createSource(t.type,"video/mp4;codecs=".concat(n._codec)),n.analyse.addAudioMseOpend(),tq.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,a=[],i.audioInitSegment&&a.push(n._mse.append(t.type,i.audioInitSegment)),i.audioSegment&&a.push(n._mse.append(t.type,i.audioSegment)),e.abrupt("return",Promise.all(a).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)}}()),GQ(DQ(n),"_doPlay",(function(){n._media.play().catch((function(){}))})),GQ(DQ(n),"_doPause",(function(){n._media.pause()})),GQ(DQ(n),"_doSeek",(function(e){n._ready=!1,n._media.currentTime=e})),GQ(DQ(n),"_doChaseFrame",(function(e){var t=e.position;n._seekNoSideEffect=!0,n._media.currentTime=t})),GQ(DQ(n),"_startRender",(function(){tq.log(n.TAG,"start render"),n._startRendered=!0,n._media.play().catch((function(){}))})),n.TAG="AudioMseRender",n._reuseMse=sq().reuseMseForAudio,n._initMedia(),n}return CQ(a,[{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||!G$.hasCached)return tq.log(this.TAG,"init media and mse directly"),this._media=document.createElement("video"),this._media.autoplay=!0,this._mse=new I$,this._bindEvents(),this._bindMediaEvents(),void this._mse.bindMedia(this._media);tq.log(this.TAG,"bind media temporary"),this._media=G$.tempMedia,this._bindEvents(),this._isTempMedia=!0}},{key:"_switchMedia",value:function(e){var t=this._media,n=G$.getCachedMedia(R$[e]);n?(tq.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=C$,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;WQ(XQ(a.prototype),"_bindEvents",this).call(this),this._parent.on(xq.CHASE_AUDIO_FRAME,this._doChaseFrame),this._parent.on(Tq.UPDATE_VOLUME,(function(t){e._media.volume=t,e._emitTimelineEvents(Tq.PLAY_EVENT,_q.VOLUME_CHANGE)})),this._parent.on(Tq.END_OF_STREAM,(function(){var t;e.reuseMseForAudio||(null===(t=e._mse)||void 0===t||t.endOfStream())})),this._parent.on(Tq.SET_PLAYBACKRATE,(function(t){tq.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=ZQ(EQ().mark((function e(t){return EQ().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:tq.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=ZQ(EQ().mark((function e(){var t;return EQ().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(Tq.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(Tq.PLAY_EVENT,_q.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(){tq.log(e.TAG,"auto play by checkAutoPlay!"),e._audioCanAutoplay=!0})).catch((function(){tq.warn(e.TAG,"can’t auto play!"),e._audioCanAutoplay=!1,e.emit(Sq.AUDIO_NOT_ALLOWED_AUTOPLAY)})).finally((function(){e._media.volume=n,e._startRendered||(e._media.pause(),tq.log(e.TAG,"auto paused by checkAutoPlay!")),e._media.removeEventListener("canplay",t)}))}))}},{key:"_destroy",value:(t=ZQ(EQ().mark((function e(){var t,n,r;return EQ().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(tq.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(),G$.cacheMedia({codec:this._codec,media:this._media,mse:this._mse}),tq.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 sq().audioWithMse&&!!window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="mp4a.40.5"')}}]),a}(Eq),X$=function(){function e(t){IQ(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 CQ(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 a=e[i];Math.abs(r.end-a.start)<.1?r.end=a.end:(n.push(r),r={start:a.start,end:a.end})}return n.push(r),n}},{key:"_caclBaseDts",value:function(e){-1===this._baseDts&&e&&(this._baseDts=e.dts,tq.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 a=e[r-1]||this._currentFrameQueue[this._currentFrameQueue.length-1];a?this._lastDuration+=(a.dts-this._baseDts)/1e3:this._lastDuration=this._duration,tq.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 a=n/(e[t-1].dts-e[0].dts);this._bitrate=parseInt(8e3*a)}},{key:"_beforeAppendVodBuffer",value:function(e){var t=this;if(e.length){for(var n=[],r=[],i=0,a=e.length;i<a;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;tq.enable&&tq.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 a;null!==(a=e[i].frames[0])&&void 0!==a&&a.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,tq.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,tq.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),tq.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 tq.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 V$(e){var t;(null===(t=e.buffer)||void 0===t?void 0:t.close)&&e.buffer.close()}var D$=function(){function e(t){IQ(this,e),this.TAG="FrameQueue",this._parent=t,this._lastGopId=0,this._frames=[]}return CQ(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):V$(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)||(V$(t),!1)}))}},{key:"empty",value:function(){this._frames.forEach((function(e){return V$(e)})),this._frames=[]}},{key:"destroy",value:function(){this.empty(),this._lastGopId=0}}]),e}(),M$=new(function(){function e(){IQ(this,e),GQ(this,"_queue",[]),GQ(this,"TAG","FrameRenderCache")}return CQ(e,[{key:"cacheCvs",value:function(e){this._queue.push(e),tq.log(this.TAG,"cache canvas!")}},{key:"getCachedCvs",value:function(){var e=this._queue.pop();return e&&tq.log(this.TAG,"get cached canvas!"),e}}]),e}()),W$=function(){function e(t,n){IQ(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=M$,this._initMeta(),this._initContextGL(),this.contextGL&&(this._initProgram(),this._initBuffers(),this._initTextures())}return CQ(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),tq.log("FrameRender","use=",i,this.configs.glCtxOptions);break}catch(k0){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 a=e.createProgram();e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS)||console.log("Program failed to compile: "+e.getProgramInfoLog(a)),e.useProgram(a);var o=e.getUniformLocation(a,"YUV2RGB");e.uniformMatrix4fv(o,!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=a}},{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 a=e.getAttribLocation(t,"texturePos");e.enableVertexAttribArray(a),e.vertexAttribPointer(a,2,e.FLOAT,!1,0,0),this.texturePosBuffer=i;var o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o),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=o;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(),a=e.getUniformLocation(t,"uSampler");e.uniform1i(a,1),this.uTextureRef=i;var o=this._initTexture(),s=e.getUniformLocation(t,"vSampler");e.uniform1i(s,2),this.vTextureRef=o,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 a=r*n,o=i*n/2;444!==this.chroma&&422!==this.chroma||(o*=2);var s={yData:(e=new Uint8Array(e)).subarray(0,a),uData:e.subarray(a,a+o),vData:e.subarray(a+o,a+o+o)};this._drawPictureGL420(s,t,n,r,i)}},{key:"_drawPictureGL420",value:function(e,t,n,r,i){var a=this.contextGL,o=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)),a.viewport(S,k,T,x);var E=new Float32Array([1,0,0,0,1,1,0,1]);a.bindBuffer(a.ARRAY_BUFFER,o),a.bufferData(a.ARRAY_BUFFER,E,a.DYNAMIC_DRAW);var L=new Float32Array([1,0,0,0,1,1,0,1]);a.bindBuffer(a.ARRAY_BUFFER,s),a.bufferData(a.ARRAY_BUFFER,L,a.DYNAMIC_DRAW);var Z=new Float32Array([1,0,0,0,1,1,0,1]);a.bindBuffer(a.ARRAY_BUFFER,u),a.bufferData(a.ARRAY_BUFFER,Z,a.DYNAMIC_DRAW),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,c),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,m,y,0,a.LUMINANCE,a.UNSIGNED_BYTE,h),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,l),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,v,g,0,a.LUMINANCE,a.UNSIGNED_BYTE,f),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,d),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,b,A,0,a.LUMINANCE,a.UNSIGNED_BYTE,p),a.drawArrays(a.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(S0){console.error(this.TAG,"_drawPicture2d",e,e.dom,S0,S0.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),M$.cacheCvs(this.canvas))}}]),e}(),N$=function(){function e(t){IQ(this,e),GQ(this,"_lowDecodeThreshold",sq().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 CQ(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)),tq.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=[],tq.log(this.TAG,"解码效率过低,应该降级"),this._parent.emit(kq.DECODE_LOW_FPS))):this._parent.emit(kq.DECODE_LOW_FPS)}}]),e}(),O$=[],U$=function(){function e(t){var n=this;IQ(this,e),GQ(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=O$.pop()||new Worker(URL.createObjectURL(r)),this._bindEvent()}return CQ(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),O$.push(this._worker),tq.log("TickTimer","unbind timer event"),this._worker=null,this._task=null)}}]),e}(),F$=function(e){PQ(n,e);var t=MQ(n);function n(e,r){var i;return IQ(this,n),(i=t.call(this,e,r))._timeRange=new X$(DQ(i)),i._decodeEstimate=new N$(DQ(i)),i._frameQueue=new D$(DQ(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(DQ(i)),i._tickTimer=new U$(i._render),i._initCanvas(e),i._bindEvents(),i}return CQ(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||nq(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||nq(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(Tq.PLAY_EVENT,_q.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=M$.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;WQ(XQ(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,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=e._canvas,s=o.width,u=o.height,c=r*s/u,l=n*u/s,d=n-c,h=r-l,f=d*i+"px",p=h*a+"px";e._canvas.style.left=f,e._canvas.style.top=p,tq.warn(e.TAG,"cvsWidth=".concat(s,", cvsHeight=").concat(u,", scaleCvsWidth=").concat(c,", scaleCvsHeight=").concat(l)),tq.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(kq.UPDATE_VIDEO_FILLTYPE,(function(n,r){var i=r.width,a=r.height,o=e._canvas,s=o.width,u=o.height,c=!i||i/a>s/u;if(tq.warn(e.TAG,"UPDATE_VIDEO_FILLTYPE isGapX =",c,"type =",n,s,u,i,a),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:a},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:a},.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<a)&&(s/i>u/a?e._canvas.style.width="100%":e._canvas.style.height="100%")})),this._parent.on(kq.UPDATE_VIDEO_COVER_POSITION,t),this._parent.on(Tq.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 a=e._timeRange.nextFrame();t=t||i||a&&a.dts||0}if(e.audioSyncDts=t,i&&i-t>500&&e._emitTimelineEvents(Tq.PLAY_EVENT,_q.LARGE_AV_GAP,{aDts:t,vDts:i,frameLength:e._frameQueue.length,currentTime:e._parent.currentTime,duration:e._parent.duration}),tq.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 o=e._timeRange.nextFrame();if(o){var s=(o.dts-o.baseDts)/1e3;e._parent.currentTime-s>1&&(tq.warn(e.TAG,"丢帧!"),e.ajustSeekTime(e._parent.currentTime))}}})),this._parent.on(Tq.UPDATE_GL_OPTIONS,(function(t){e._config.glCtxOptions=t})),this._parent.on(Tq.UPDATE_SEGMENT_END,this._updateSegmentEnd.bind(this)),this.on(kq.AUTO_RUN,this._startRender.bind(this)),this._parent.on(Tq.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){tq.warn(this.TAG,"video set metadata"),this._meta=t;var n=t&&t.frameRate&&t.frameRate.fps;n?tq.log(this.TAG,"detect fps:",n):tq.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),tq.warn(this.TAG,"set seeking status=",!1)),this.inSeeking))return tq.log(this.TAG,"drop frame"),void V$(e);this._isLive?this._frameQueue.append(e):this._frameQueue.appendVodFrame(e),t&&t(),this._ready||this.readyState>=1&&this._whenReady()}}},{key:"_startRender",value:function(){tq.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(kq.VIDEO_READY),this.noAudio&&this._emitTimelineEvents(Tq.PLAY_EVENT,_q.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}(Eq),Y$=function(e){PQ(n,e);var t=MQ(n);function n(e){var r;return IQ(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 CQ(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{tq.log(this.TAG,"_initVideo, basePTS:",e.dts),this._setVideoSrc(n,t),this._video.paused&&this._videoPlay("_initVideo")}catch(k0){console.error(this.TAG,"_initVideo, load error",k0)}}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(k0){console.error(this.TAG,"_setVideoSrc",k0)}}},{key:"_videoPlay",value:function(e){var t=this,n=this._video;if(tq.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,tq.log(t.TAG,"_videoPlay success")})).catch((function(e){console.error(t.TAG,"_videoPlay failed,",e.message),t._playFailed=!0,t.emit(xq.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(){tq.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)),tq.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){tq.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&&(tq.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}),tq.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(xq.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(xq.APPEND_VIDEO,t),setTimeout((function(){tq.log(e.TAG,"onloadeddata, setTimeout firstEmit:",e.firstEmit),e._getFirstFrame()}),40)):(tq.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(xq.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&&(tq.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 a,o=null,s=Date.now();try{o=(a=this._getImageData(i)).imageData}catch(k0){console.error(k0,a,this._canvasList.length)}this._lastPts=i;var u=Date.now()-s;return this._totleTime+=u,this.emit(xq.DECODED,o,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,a=r;this._width&&this._height&&(i=this._width,a=this._height),a>this._maxVideoHeight&&(a=this._maxVideoHeight,i=parseInt(a*(n/r))),(e=this._canvasList.shift())||(console.warn(this.TAG,"_getImageData, _canvansList length is 0"),e=this._createCanvas()),e.width=i,e.height=a;var o=e.dom,s=e.ctx;if(this._currentCanvasHeight=a,!o)return{imageData:e};o.width!==i&&(o.width=i,o.height=a);try{r&&n&&i&&a&&s.drawImage(t,0,0,n,r,0,0,i,a)}catch(k0){console.error(this.TAG,"_getImageData, drawImage:",k0)}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 tq.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}(Za),K$=[{base:720,level:1},{base:540,level:2},{base:360,level:3},{base:280,level:4}],H$=function(e){PQ(n,e);var t=MQ(n);function n(e,r){var i;return IQ(this,n),(i=t.call(this)).TAG="VideoDecoderController",i._decoder=new Y$(e),i._remux=new qq,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(DQ(i)),i}return CQ(n,[{key:"_bindEvents",value:function(){var e=this;document.addEventListener("visibilitychange",this._onVisibilityChange.bind(this)),this._decoder.on(xq.APPEND_VIDEO,this._onAppendVideo.bind(this)),this._decoder.on(xq.PLAY_FAILED,this._onPlayFailed.bind(this)),this._decoder.on("error",this._onError.bind(this)),this._decoder.on(xq.DECODED,this._onDecoded.bind(this)),this._decoder.on(xq.FIRST_FRAME,this._onFirstFrame.bind(this)),this._decoder.on(xq.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(OQ(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),tq.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(xq.PLAY_FAILED,e)}},{key:"_onAppendVideo",value:function(e){this._parent.emit(xq.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(xq.DECODED,n),this._lastPts=t}},{key:"_onFirstFrame",value:function(e,t){var n=this._buildFrameInfo(e,t);this._parent.emit(xq.FIRST_FRAME,n)}},{key:"_onFragmentEnd",value:function(e,t){var n=this;tq.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&&(tq.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,tq.log(this.TAG,"checkReady trigger ready"),this._parent.emit(xq.READY))}},{key:"_checkDataReady",value:function(){this._isDataReady=!0,this._checkReady()}},{key:"_reduceResolution",value:function(e){if(tq.log(this.TAG,"_reduceResolution","currentLevel:",this._currentLevel,"endLevel:",this._endLevel),this._videoHeight>720&&(tq.log(this.TAG,"_reduceResolution","trigger DECODE_LOW_FPS"),this._parent.emit(kq.DECODE_LOW_FPS)),e&&e<20?(this._minFPSTime++,this._decoder.emit("fpsreduce",e)):this._minFPSTime=0,this._currentLevel>=this._endLevel)return tq.log(this.TAG,"_reduceResolution","trigger DECODE_LOW_FPS",this._currentLevel,this._endLevel),void this._parent.emit(kq.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 tq.log(this.TAG,"_reduceResolution","trigger DECODE_LOW_FPS, _currentLevel: ",this._currentLevel),void this._parent.emit(kq.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 K$.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(k0){tq.log(this.TAG,k0)}}},{key:"_pushBlob",value:function(e){tq.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;tq.log(this.TAG,"_handleKeyFrameVideo","startDts:",n,"endDts:",r,"samples length:",t.length),this.endDts&&i>Math.floor(1e3/this._metaFPS)+1&&tq.log(this.TAG,"_handleKeyFrame, keyFrame dts:",n,"sample length:",t.length,"endDts:",r,"delay:",i);var a=r-n;if(this._fDuration||(this._fDuration=a),a<1500)return void tq.log(this.TAG,"_handleKeyFrame gopDuration :",a,"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(k0){console.error(this.TAG,"_handleKeyFrameVideo",k0)}}},{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 tq.error(this.TAG,"_onRendend","imageObj. is error",e)}},{key:"checkValidBlob",value:function(e){this._filterBlob(e)}},{key:"chaseVideoFrame",value:function(e){tq.log(this.TAG,e,e.frame.dts,this.currentFragmentDts);var t=e.frame.dts;if(this._startDts=t,t===this.currentFragmentDts){if(tq.log(this.TAG,"_onChaseFrame","_inDecodeId:",this._inDecodeId,"currentFragmentDts:",this.currentFragmentDts),this._inDecodeId>0&&this._inDecodeId<t)return tq.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 tq.log(this.TAG,"_onChaseFrame, _inDecodeId === startDts, startDts:",t),this.stopDecode(),void this.reStrartDecode(this._currentInfo);-1===this._inDecodeId&&(tq.log(this.TAG,"_onChaseFrame","_inDecodeId==-1"),this.startDecode())}t>this.currentFragmentDts&&(tq.log(this.TAG,"_onChaseFrame, startDts > currentFragmentDts, startDts:",t,"currentFragmentDts:",this.currentFragmentDts),this.stopDecode(),this._emptyBlobList()),t<this.currentFragmentDts&&(tq.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,tq.log("".concat(this.TAG," has inited")),this._isInit=!0,this._checkReady())}},{key:"reStrartDecode",value:function(e){if(e)try{tq.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(k0){console.error("load error",k0)}}},{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)tq.log(this.TAG,"startDecode","this decoder is in decoding");else{var e=this._getBlobLength();if(this._decoder&&e){tq.log(this.TAG,"startDecode","blob url length:",e);var t=this._shiftBlob()||{};try{tq.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(k0){console.error(this.TAG,"startDecode","load error",k0)}}}}},{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(tq.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(k0){console.error(k0)}}},{key:"destroy",value:function(){this._blobURLList=[],this._decoder.destroy()}},{key:"empty",value:function(){if(tq.log("empty"),this._decoder){var e=this._decoder._canvasList;return tq.log(this.TAG,"empty >>>>>>>>>>>>>>>>>>length:",e.length),e.forEach((function(e){e.dom&&(tq.log("clear >>>>>>>>>>>>>>>>>>"),e.dom.width=0,e.dom.height=0,e.dom=null)})),e.length}}},{key:"isIDLE",get:function(){return tq.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}(Za),j$=function(e){PQ(n,e);var t=MQ(n);function n(e,r){var i;return IQ(this,n),(i=t.call(this,e,r)).TAG="VideoRenderFromVideo",i._videoDecodeController=new H$(e,DQ(i)),i._canAutoPlay=!0,i._videoDecode=e.videoDecode,i._chaseToFrame=null,i}return CQ(n,[{key:"videoDecode",get:function(){return this._videoDecode},set:function(e){this._videoDecode=e}},{key:"_bindEvents",value:function(){var e=this;WQ(XQ(n.prototype),"_bindEvents",this).call(this),this.on("keyFrame",this._onKeyFrame.bind(this)),this.on(xq.READY,this._onReady.bind(this)),this.on(xq.DECODED,this._onDecoded.bind(this)),this.on(xq.PLAY_FAILED,this._onPlayFailed.bind(this)),this.on("error",this._onError.bind(this)),this.on(xq.APPEND_VIDEO,this._onAppendVideo.bind(this)),this.on(xq.FIRST_FRAME,this._onFirstFrame.bind(this)),this._parent.on(xq.CHASE_VIDEO_FRAME,this._onChaseVideoFrame.bind(this)),this._parent.on(Tq.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(k0){cosole.error(this.TAG,"onAppendVideo",k0)}}},{key:"_onKeyFrame",value:function(){tq.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(Tq.PLAY_EVENT,_q.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 W$(e,this)}catch(k0){this._emitTimelineEvents(Tq.PLAY_EVENT,_q.ERROR,this._assembleErr(k0&&k0.message))}}this._startDecode()}},{key:"_onFirstFrame",value:function(e){tq.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(xq.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||(tq.log(this.TAG,"_initDecoder"),this._videoDecodeController.isInit||this._videoDecodeController.init(this._meta),this._isInit=!0)}},{key:"_receiveFrame",value:function(e){WQ(XQ(n.prototype),"_receiveFrame",this).call(this,e),this._videoDecodeController.checkMaxFrames(this._frameQueue._frames.length)}},{key:"_setMetadata",value:function(e){tq.warn(this.TAG,"video set metadata",e),this._meta=e;var t=e.fpsNum/e.fpsDen;t?tq.log(this.TAG,"detect fps:",t):tq.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(){tq.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 a=i.dts-r;if(a<-150){this.lastPrecise;var o=this._frameQueue.frames,s=this._getDeleteFrames(o,r),u=s.deleteFrames,c=s.useFrames;return o.splice(0),c.forEach((function(e){o.push(e)})),u.forEach((function(e){t._videoDecodeController.frameRendend(e.buffer)})),this._videoDecodeController.emit("renderDelay",a,this._frameQueue._frames.length),void this._videoDecodeController.checkMinFrames(this._frameQueue.length)}if(!(!e&&a>30&&a<6e4)){Math.abs(this._lastTimeupdate-i.dts)>250&&(this._emitTimelineEvents(Tq.PLAY_EVENT,_q.TIMEUPDATE),this._lastTimeupdate=i.dts),tq.long&&tq.log(this.TAG,"render delay:".concat(a," , 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(Tq.PLAY_EVENT,"firstframe")),this._videoDecodeController.frameRendend(n.buffer),this._frameQueue.shift(),this._videoDecodeController.checkMinFrames(this._frameQueue.length),this._videoDecodeController.emit("renderDelay",a,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 tq.log(this.TAG,"_render","not first frame return");var d=this._videoDecodeController;if(tq.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(kq.VIDEO_WAITING)}this._checkToDecode()}}},{key:"_updateSegmentEnd",value:function(){}},{key:"_destroy",value:function(e){this._empty(),WQ(XQ(n.prototype),"destroy",this).call(this,e),this._videoDecodeController.destroy()}},{key:"_doPause",value:function(){tq.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}(F$),B$=function(e){PQ(n,e);var t=MQ(n);function n(e){var r;return IQ(this,n),GQ(DQ(r=t.call(this)),"_parent",null),GQ(DQ(r),"_decoderReady",!1),GQ(DQ(r),"_inDecoding",!1),GQ(DQ(r),"_toDecodeFirstframe",!0),GQ(DQ(r),"_id",(new Date).getMilliseconds()),GQ(DQ(r),"_workerErrorCallback",null),GQ(DQ(r),"_workerMessageCallback",null),GQ(DQ(r),"_decoderWorker",null),r._parent=e,r}return CQ(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),tq.enable&&tq.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,a=this,o=1e3*e,s=null===(t=this._parent)||void 0===t||null===(n=t._timeRange)||void 0===n?void 0:n.getFramesForPreciseSeek(o),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),tq.enable&&tq.log(this.TAG,"doDecode ".concat(s.length," frames for precise seek")),s.forEach((function(e,t){a._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?sq().maxDecodeOnceFirstTime:this.maxDecodeOnce;1===r&&n.resetDecodeDot(performance.now());for(var a=[];i>0;){var o=t&&t.getFrame();if(!o)break;a.push(o),o.gopId&&o.gopId-1==0&&n.updateGopCount(),i--}return a}}}},{key:"_doDecodeInternal",value:function(e,t,n){null!=e&&e.meta&&(this.meta=e.meta,tq.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}(Za),J$="IWZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBlPW51bGwsdD1bXSxzPTAsYT0hMTtzZWxmLmFkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLChmdW5jdGlvbihvKXtzd2l0Y2goby5kYXRhLm1zZyl7Y2FzZSJjb25maWd1cmF0aW9uIjplPW5ldyBzZWxmLlZpZGVvRGVjb2Rlcih7b3V0cHV0OmZ1bmN0aW9uKG8pe2E9ITAscyYmY2xlYXJUaW1lb3V0KHMpO3ZhciBuPXQuc2hpZnQoKTtuP3NlbGYucG9zdE1lc3NhZ2Uoe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2YXIgZD1uLmJ5dGVMZW5ndGgtNCxjPW5ldyBEYXRhVmlldyhuZXcgQXJyYXlCdWZmZXIoNCkpO2Muc2V0VWludDMyKDAsZCwhMSksbi5zZXQobmV3IFVpbnQ4QXJyYXkoYy5idWZmZXIpLDApLGkua2V5ZnJhbWUmJmUuZmx1c2goKTt2YXIgcj1uZXcgc2VsZi5FbmNvZGVkVmlkZW9DaHVuayh7dHlwZTppLmtleWZyYW1lPyJrZXkiOiJkZWx0YSIsdGltZXN0YW1wOmkucHRzLGRhdGE6bn0pO2UuZGVjb2RlKHIpO2JyZWFrO2Nhc2UiZGVzdHJveSI6ZSYmKGUuZmx1c2goKSxlLmNsb3NlKCkpLGNsZWFyVGltZW91dChzKTticmVhaztjYXNlImNoZWNrRGVjb2RlIjpzZWxmLnBvc3RNZXNzYWdlKHt0eXBlOiJDSEVDS19UT19ERUNPREUiLGRhdGE6MD09PU1hdGguYWJzKGUuZGVjb2RlUXVldWVTaXplLXQubGVuZ3RoKX0pfX0pKX0oKTsK",z$="undefined"!=typeof window&&window.Blob&&new Blob([atob(J$)],{type:"text/javascript;charset=utf-8"});function Q$(){var e=z$&&(window.URL||window.webkitURL).createObjectURL(z$);try{return e?new Worker(e,{}):new Worker("data:application/javascript;base64,"+J$,{type:"module"})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var q$=sq().maxDecodeOnceWebcodec,$$=function(e){PQ(n,e);var t=MQ(n);function n(){var e;IQ(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return GQ(DQ(e=t.call.apply(t,[this].concat(i))),"TAG","WebCodecController"),GQ(DQ(e),"_decoderMode",5),GQ(DQ(e),"_maxDecodeOnce",q$),GQ(DQ(e),"_continueDecodeThreshold",q$/2),GQ(DQ(e),"_avccpushed",!1),e}return CQ(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;tq.log(this.TAG,"start init webcodec worker");var t=new Q$;t.onMessage=function(t){var n,r;switch(t.data.type){case"DECODER_READY":tq.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 sq().h264WithWebcodec&&!!window.VideoDecoder&&!1!==n.canUse}}]),n}(B$),e0="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIHNoaW1JbXBvcnRTY3JpcHRzKHNyYyl7cmV0dXJuIGZldGNoKHNyYykudGhlbigoZnVuY3Rpb24oZSl7cmV0dXJuIGUudGV4dCgpfSkpLnRoZW4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0YSI6c2VsZi5tZXRhPXQubWV0YSxkZWNvZGVyLnVwZGF0ZU1ldGEodC5tZXRhKTticmVhaztjYXNlImluaXREZWNvZGVyIjpkZWNvZGVyLmRlY29kZSh0LmRhdGEpO2JyZWFrO2Nhc2UiZGVjb2RlIjpkZWNvZGVyLmRlY29kZSh0LmRhdGEsdC5pbmZvKTticmVhaztjYXNlImZsdXNoIjpkZWNvZGVyLmZsdXNoKCk7YnJlYWs7Y2FzZSJmaW5pc2hfZmxhZyI6c2VsZi5wb3N0TWVzc2FnZSh7bXNnOiJCQVRDSF9GSU5JU0hfRkxBRyJ9KTticmVhaztjYXNlImRlc3RvcnkiOmRlY29kZXIuZGVzdHJveSgpfX1lbHNlIHNlbGYucG9zdE1lc3NhZ2Uoe21zZzoiRVJST1I6aW52YWxpZCBtZXNzYWdlIn0pfX0pKCk7Cg==",t0="undefined"!=typeof window&&window.Blob&&new Blob([atob(e0)],{type:"text/javascript;charset=utf-8"});function n0(){var e=t0&&(window.URL||window.webkitURL).createObjectURL(t0);try{return e?new Worker(e,{}):new Worker("data:application/javascript;base64,"+e0,{type:"module"})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var r0="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIHNoaW1JbXBvcnRTY3JpcHRzKHNyYyl7cmV0dXJuIGZldGNoKHNyYykudGhlbigoZnVuY3Rpb24oZSl7cmV0dXJuIGUudGV4dCgpfSkpLnRoZW4oKGZ1bmN0aW9uKHRleHQpe3NlbGYuZXhwb3J0cz17fSxldmFsKHRleHQpLHNlbGYubT1leHBvcnRzLm19KSl9dmFyIE1BWF9TVFJFQU1fQlVGRkVSX0xFTkdUSD01MjQyODgwLEJBVENIX0RFQ09ERV9TSVpFPTgsaW5pdFRzPTAsRGVjb2Rlcj1mdW5jdGlvbihlKXt0aGlzLmluaXRlZD0hMSx0aGlzLmluZm9JZD0wLHRoaXMuc2VsZj1lLHRoaXMubWV0YT1lLm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U5JVF9GQUlMRUQiLGxvZzplLm1lc3NhZ2V9KX0pKX1zZWxmLm9ubWVzc2FnZT1mdW5jdGlvbihlKXt2YXIgdD1lLmRhdGE7aWYoImluaXQiPT09dC5tc2d8fCJwcmVsb2FkIj09PXQubXNnfHxkZWNvZGVyKXN3aXRjaCh0Lm1zZyl7Y2FzZSJwcmVsb2FkIjppbml0KHQudXJsKSxCQVRDSF9ERUNPREVfU0laRT10LmJhdGNoRGVjb2RlQ291bnQ7YnJlYWs7Y2FzZSJpbml0IjpzZWxmLm1ldGE9dC5tZXRhLEJBVENIX0RFQ09ERV9TSVpFPXQuYmF0Y2hEZWNvZGVDb3VudCxpbml0KHQudXJsKTticmVhaztjYXNlInVwZGF0ZW1ldGEiOnNlbGYubWV0YT10Lm1ldGEsZGVjb2Rlci51cGRhdGVNZXRhKHQubWV0YSk7YnJlYWs7Y2FzZSJpbml0RGVjb2RlciI6ZGVjb2Rlci5mcmFtZUxlbnNPZmZzZXQmJmRlY29kZXIuYmF0Y2hEZWNvZGUoITApLGRlY29kZXIuZmx1c2goKSxkZWNvZGVyLmRlY29kZSh0LmRhdGEpO2JyZWFrO2Nhc2UiZGVjb2RlIjpkZWNvZGVyLnN0b3JlQnVmZmVyKHQuZGF0YSx0LmluZm8pO2JyZWFrO2Nhc2UiZmx1c2giOmRlY29kZXIuZmx1c2goKTticmVhaztjYXNlImZpbmlzaF9mbGFnIjpzZWxmLnBvc3RNZXNzYWdlKHttc2c6IkJBVENIX0ZJTklTSF9GTEFHIn0pO2JyZWFrO2Nhc2UiZGVzdG9yeSI6ZGVjb2Rlci5kZXN0cm95KCl9fX0pKCk7Cg==",i0="undefined"!=typeof window&&window.Blob&&new Blob([atob(r0)],{type:"text/javascript;charset=utf-8"});function a0(){var e=i0&&(window.URL||window.webkitURL).createObjectURL(i0);try{return e?new Worker(e,{}):new Worker("data:application/javascript;base64,"+r0,{type:"module"})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var o0="KGZ1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atob(o0)],{type:"text/javascript;charset=utf-8"});function u0(){var e=s0&&(window.URL||window.webkitURL).createObjectURL(s0);try{return e?new Worker(e,{}):new Worker("data:application/javascript;base64,"+o0,{type:"module"})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var c0=new(function(){function e(){IQ(this,e),GQ(this,"_queue",[]),GQ(this,"_pendingDecoder",null),GQ(this,"TAG","DecoderCache")}return CQ(e,[{key:"genDecoder",value:function(e){return this._initDecoder(e)}},{key:"_initDecoder",value:function(e){var t=this,n=sq(),r=n.preloadDecoder,i=n.maxDecodeOnceWasm;e=e||r;var a,o,s=uq(),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&&(cq()?(a=new n0,o=c,h=2):lq()&&sq().canUseThreadMode?(a=new a0,o=d,h=1):(a=new n0,o=l,h=3)),"h264"===e&&(a=new u0,o=u,h=3),!a)return Promise.resolve();var f,p,m,y=((m=new Promise((function(e,t){f=e,p=t}))).resolve=f,m.reject=p,m);a.postMessage({msg:"preload",batchDecodeCount:i,url:o}),this._pendingDecoder=a,a.id=Date.now()+parseInt(1e3*Math.random()),a.isHevc="h265"===e,a.using=!1,a.ready=!1,tq.log(this.TAG,"start init decoder worker, id=",a.id,"hevc=",a.isHevc,"mode=",h);var v=function e(n){t._pendingDecoder=null;var r=n.data.msg;switch("DECODER_READY"!==r&&"INIT_FAILED"!==r||(a.removeEventListener("message",e),a.removeEventListener("error",g)),r){case"DECODER_READY":tq.log(t.TAG,"decoder worker inited!, id=",a.id,"cost:",n.data.cost),a.ready=!0,a.using||t._queue.push(a),y.resolve();break;case"INIT_FAILED":tq.log(t.TAG,"decoder worker init failed!",n.data.log),y.reject(n.data.log)}},g=function e(t){a.removeEventListener("message",v),a.removeEventListener("error",e),y.reject(null==t?void 0:t.message)};return a.addEventListener("message",v),a.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),tq.log(this.TAG,"cache decoder, id=",e.id),"h265"===sq().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,tq.warn(this.TAG,"get cached decoder, id=".concat(t.id,", ready=").concat(t.ready)),t}}]),e}()),l0=sq().maxDecodeOnceWasm,d0=function(e){PQ(n,e);var t=MQ(n);function n(){var e;IQ(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return GQ(DQ(e=t.call.apply(t,[this].concat(i))),"TAG","WasmController"),GQ(DQ(e),"_avccpushed",!1),GQ(DQ(e),"_maxDecodeOnce",l0),GQ(DQ(e),"_continueDecodeThreshold",l0/2),GQ(DQ(e),"_wasmInitCost",0),GQ(DQ(e),"_threadSupported",lq()&&sq().canUseThreadMode),GQ(DQ(e),"_simdSuppported",cq()),GQ(DQ(e),"_decoderMode",window.WebAssembly?3:4),e}return CQ(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=uq(),n=t.H264_DECODER_URL,r=t.H265_DECODER_URL,i=t.H265_THREAD_DECODER_URL,a=t.H265_SIMD_DECODER_URL,o=t.ASM_H264_DECODER_URL,s=t.ASM_H265_DECODER_URL;return tq.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?a:3===this._decoderMode?r:s)?{decoder:1===this._decoderMode?new a0:new n0,url:e}:void this._workerErrorCallback("no found decoder url, decodeMode:".concat(this._decoderMode)):(e=4===this._decoderMode?o:n)?{decoder:new u0,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=c0.getCachedDecoder(this.isHevc);if(e)return tq.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}),tq.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:l0,url:r}),this._decoderWorker=n)}},{key:"_bindWorkerEvent",value:function(e){var t=this,n=function(n,r){tq.log(t.TAG,"worker failed: ",n,r),t._terminateWorker(e),t._decoderWorker=null,!1===sq().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,a;switch(r.data.msg){case"DECODER_READY":if(tq.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(kq.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===(a=i.info)||void 0===a?void 0:a.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){tq.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),a=0;n.forEach((function(e){i.set([0,0,0,1],a),a+=4,i.set(e,a),a+=e.byteLength})),e.postMessage({msg:"initDecoder",data:i})}},{key:"destroy",value:function(){if(this._decoderWorker)return sq().reuseWasmDecoder?(this._offWorkerBind(this._decoderWorker),void c0.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,tq.log(this.TAG,"flush decoder and unbind worker event")}},{key:"_terminateWorker",value:function(e){this._offWorkerBind(e),e.postMessage({msg:"destroy"}),e.terminate(),tq.log(this.TAG,"destroy decoder worker")}}]),n}(B$),h0=function(e){PQ(n,e);var t=MQ(n);function n(){var e;IQ(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return GQ(DQ(e=t.call.apply(t,[this].concat(i))),"TAG","VideoRenderWithDecoder"),GQ(DQ(e),"_hideRenderFlag",0),GQ(DQ(e),"_recentMeta",null),GQ(DQ(e),"_inChaseFrame",!1),GQ(DQ(e),"_decoderErrorCallback",(function(t){e._emitTimelineEvents(Tq.PLAY_EVENT,_q.ERROR,e._assembleErr(t,1))})),GQ(DQ(e),"_decoderMessageCallback",(function(t){var n,r,i,a=t.type,o=t.data;switch(a){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(DQ(e),e._meta),tq.warn(e.TAG,"reuse canvas and context")):(e._frameRender=new W$(s,DQ(e)),tq.log(e.TAG,"create frameRender with config",s))}catch(k0){e._emitTimelineEvents(Tq.PLAY_EVENT,_q.ERROR,e._assembleErr(k0&&k0.message,2))}}e._startDecode();break;case"RECEIVE_FRAME":if(e._inChaseFrame&&(null===(n=e._decodeController)||void 0===n||!n.webcodec))return;e._receiveFrame(o);break;case"BATCH_FINISH":null===(r=DQ(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 CQ(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;tq.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){tq.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(Tq.PLAY_EVENT,_q.LOADEDMETADATA),this._recentMeta=this._meta=Object.assign({},e,{samples:null}),tq.warn(this.TAG,"video set metadata",this._meta,"configuration:",this.configuration);var r=e.fpsNum/e.fpsDen;r?tq.log(this.TAG,"detect fps:",r):tq.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(Tq.PLAY_EVENT,_q.DURATION_CHANGE)}}}},{key:"_selectDecoder",value:function(){if(!this.isHevc&&$$.isSupported())return this._decodeController=new $$(this),void(this._decodeEstimate.webcodec=!0);this._decodeController=new d0(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(Tq.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(Tq.PLAY_EVENT,_q.TIMEUPDATE,{pts:r.originPts/90}),this._lastTimeupdate=r.dts),tq.long&&tq.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 a=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()-a,this._checkToDecode()}}else{var o;if(tq.log(this.TAG,"lack frame, ","inDecoding:",null===(o=this._decodeController)||void 0===o?void 0:o.inDecoding),this._checkToDecode(),this.noAudio){var s;if(!this.isLive&&Math.abs(this.currentTime-this.duration)<.5)return null==this||this._emitTimelineEvents(Tq.PLAY_EVENT,_q.TIMEUPDATE),null==this||this._emitTimelineEvents(Tq.PLAY_EVENT,_q.ENDED),void(null===(s=this._timeRange)||void 0===s||s.clean());this._timeRange.frameLength||(this._ready=!1,this.emit(kq.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(Tq.SYNC_DTS,t.dts)}},{key:"_destroy",value:function(e){var t;tq.log(this.TAG,"destroy video render"),WQ(XQ(n.prototype),"destroy",this).call(this,e),null===(t=this._decodeController)||void 0===t||t.destroy(),this._decodeController=null}}]),n}(F$),f0=.1,p0=function(e){PQ(n,e);var t=MQ(n);function n(e,r){var i;return IQ(this,n),(i=t.call(this)).TAG="TimeLine",i._parent=r,i._seeking=!1,i.audioRender=P$.isSupported()?new P$(e,DQ(i)):new Pq(e,DQ(i)),i.videoRender=new h0(e,DQ(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 CQ(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 j$(t,this):new h0(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+f0&&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(xq.REMUX,(function(t){e.videoRender.setRemux(t)})),this.on(xq.CHASE_VIDEO_FRAME_END,(function(t){e.emit(xq.CHASE_AUDIO_FRAME,t)})),this.audioRender.on(Sq.AUDIO_READY,(function(){tq.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 sq().preciseSeek>e.duration&&e.currentTime>f0?(e.audioRender.seekNoSideEffect({position:e.currentTime+f0}),void e.videoRender.ajustSeekTime(e.currentTime,!0)):(e.audioRender.seekNoSideEffect({position:t.position+f0}),void e.videoRender.ajustSeekTime(t.position));e.videoRender.ajustSeekTime(e.currentTime)}catch(k0){}}),10),e._readyStatus.video&&e._startRender(),e._readyStatus.audio=!0,e._startPlayed||e.analyse.addAudioReady()})),this.audioRender.on(Sq.AUDIO_NOT_ALLOWED_AUTOPLAY,(function(){e._emitReady&&e.pause()})),this.audioRender.on(Sq.AUDIO_WAITING,(function(){!e.noAudio&&e.currentTime&&(tq.warn(e.TAG,"lack data, audio waiting,currentTime:",e.currentTime),e.emit(Tq.PLAY_EVENT,_q.TIMEUPDATE),e.emit(Tq.PLAY_EVENT,_q.WAITING),e.emit(Tq.DO_PAUSE),e._readyStatus.audio=!1)})),this.videoRender.on(kq.VIDEO_WAITING,(function(){tq.warn(e.TAG,"lack data, video waiting"),e.emit(Tq.PLAY_EVENT,_q.WAITING),e.emit(Tq.DO_PAUSE),e._readyStatus.video=!1})),this.videoRender.on(kq.VIDEO_READY,(function(){tq.log(e.TAG,"video ready!"),e._startPlayed||e.analyse.addVideoReady(),e._readyStatus.audio&&e._startRender("video"),e._readyStatus.video=!0})),this.videoRender.on(kq.DECODE_LOW_FPS,(function(){e.currentTime<2||(e.analyse.increaseLowDecodeCount(),e._lowdecodeEmited||(mq++,e._lowdecodeEmited=!0),e.emit(Tq.PLAY_EVENT,_q.LOW_DECODE))})),this.on(Tq.SINGLE_TRACK,(function(t){e._singleTrack=t,1!==t&&2!==t||(e._readyStatus.audio=!0),3===t&&(e._readyStatus.video=!0),e.emit(Tq.SYNC_DTS,0)})),this.on(Tq.DESTROY,(function(){e.removeAllListeners(),e.videoRender=null,e.audioRender=null})),this.on(Tq.DO_PLAY,(function(){e.emit(Tq.START_RENDER),e._paused=!1,e._lastSeekTime=1e-4,e.noAudio&&e.emit(Tq.SYNC_DTS,0)}))}},{key:"_startRender",value:function(e){if(!this._parent.error&&this.videoRender){if(this.noAudio&&this.emit(Tq.SYNC_DTS,0),this.videoRender.forceRender(),!this.isLive&&this._paused&&this.seeking&&this._checkInBuffer())return tq.log(this.TAG,"set seeking = false"),this._seeking=!1,this.emit(Tq.PLAY_EVENT,_q.SEEKED),void tq.groupEnd();this._startPlayed||(this.analyse.addFirstframe(),this.emit(Tq.PLAY_EVENT,_q.LOADEDDATA),this.emit(Tq.PLAY_EVENT,_q.FIRST_FRAME),this._startPlayed=!0),tq.log(this.TAG,"emit canplay"),this.emit(Tq.PLAY_EVENT,_q.CANPLAY),this._parent.autoplay?(tq.warn(this.TAG,"startRender: time=",this.currentTime,"paused:",this.paused,"seeking:",this.seeking),this.emit(Tq.START_RENDER,e)):(this._parent.autoplay=!0,this.emit(Tq.PLAY_EVENT,_q.PAUSE)),this.emit(Tq.READY),this._emitReady=!0,this._seeking&&this._checkInBuffer()&&(tq.log(this.TAG,"set seeking = false"),this._seeking=!1,this.emit(Tq.PLAY_EVENT,_q.SEEKED),tq.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(Tq.PLAY_EVENT,_q.ERROR,t)}return!1}return!0}},{key:"appendBuffer",value:function(e,t){this.emit(Tq.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(tq.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(Tq.DO_PAUSE);r=!0})).catch((function(){})),setTimeout((function(){return tq.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:(tq.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(Tq.DO_PAUSE),this._paused=!0,this.emit(Tq.PLAY_EVENT,_q.PAUSE))}},{key:"seek",value:function(e){var t=this;if(this._seeking&&tq.groupEnd(),this.isLive){if(this.currentTime<f0||!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 tq.log(this.TAG,"seek, !!!!!!!!!can not seek, audioCanSeek:",r,"videoCanSeek:",i);tq.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(xq.CHASE_VIDEO_FRAME,n)):this.emit(Tq.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),tq.group(this.TAG,"start seek to:".concat(e,", set seeking status=true")),this._seeking=!0,this.videoRender.setSeekingStatus(!0),this.noAudio?(this.emit(Tq.SYNC_DTS,this.videoRender.getDtsOfTime(e)),this.videoRender.ajustSeekTime(e)):this._resetReadyStatus(),this.emit(Tq.DO_SEEK,e),new Promise((function(e){t.emit(Tq.PLAY_EVENT,_q.SEEKING),e()}))))}}]),n}(Za),m0=vY.entries;pi({target:"Object",stat:!0},{entries:function(e){return m0(e)}});var y0={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},v0=Object.entries(y0),g0=function(){function e(){IQ(this,e),GQ(this,"_dot",[]),GQ(this,"_currentLowDecodeCount",0)}return CQ(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:v0.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:pq,lowdecodeVV:mq,h265FailureRate:Number((100*yq).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 a=e[r];a.action===y0.SEEKING&&(n=a.dot),a.action===y0.SEEKED&&t.push(a.dot-n)}return t}},{key:"addFirstData",value:function(){this._dot.push({action:y0.FIRST_DATA,dot:this._getTimestap()})}},{key:"addAudioBoundMedia",value:function(){this._dot.push({action:y0.AUDIO_BOUND_MEDIA,dot:this._getTimestap()})}},{key:"addAudioMseOpenStart",value:function(){this._dot.push({action:y0.AUDIO_MSE_OPEN_START,dot:this._getTimestap()})}},{key:"addAudioMseOpend",value:function(){this._dot.push({action:y0.AUDIO_MSE_OPEND,dot:this._getTimestap()})}},{key:"addAudioFirstTimeAppended",value:function(){this._dot.push({action:y0.AUDIO_FIRSTTIME_APPENDED,dot:this._getTimestap()})}},{key:"addAudioReady",value:function(){this._dot.push({action:y0.AUDIO_READY,dot:this._getTimestap()})}},{key:"addWasmInit",value:function(){this._dot.push({action:y0.WASM_WORKER_INIT,dot:this._getTimestap()})}},{key:"addWasmReady",value:function(){this._dot.push({action:y0.WASM_WORKER_READY,dot:this._getTimestap()})}},{key:"addFirstFrameToDecode",value:function(){this._dot.push({action:y0.FIRST_FRAME_TODECODE,dot:this._getTimestap()})}},{key:"addVideoReady",value:function(){this._dot.push({action:y0.VIDEO_READY,dot:this._getTimestap()})}},{key:"addFirstframe",value:function(){this._dot.push({action:y0.FIRST_FRAME,dot:this._getTimestap()})}},{key:"addWaiting",value:function(){this._dot.push({action:y0.WAITIGN,dot:this._getTimestap()})}},{key:"addSeeking",value:function(){this._dot.push({action:y0.SEEKING,dot:this._getTimestap()})}},{key:"addSeeked",value:function(){this._dot.push({action:y0.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}(),b0=1,A0=2,_0=3,w0=function(e){PQ(n,e);var t=MQ(n);function n(){var e,r,i,a,o,s;return IQ(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"===sq().preloadDecoder,e._hevc||(e._degradeVideo=document.createElement("video")),e._debounceSeek=(r=e._seek.bind(DQ(e)),i=300,a=Date.now(),o=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&&(a=Date.now(),s=!1,r.apply(void 0,t)),u-a>i?(a=u,r.apply(void 0,t)):(o&&window.clearTimeout(o),o=setTimeout((function(){r.apply(void 0,t)}),i))}),e._onTouchEnd=e._onTouchEnd.bind(DQ(e)),e.analyse=new g0,e}return CQ(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(k0){}return 0},set:function(e){try{this[t]=e}catch(k0){}}})}}))}},{key:"addEventListener",value:function(e,t,r){WQ(XQ(n.prototype),"addEventListener",this).call(this,e,t,r),this._degradeVideo&&this._eventsBackup.push([e,t,r])}},{key:"removeEventListener",value:function(e,t,r){WQ(XQ(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;WQ(XQ(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 p0({volume:this.volume,canvas:this.querySelector("canvas"),videoContext:this.videoContext,videoDecode:this.videoDecode,maxVideoHeight:this.getAttribute("maxVideoHeight"),endLevel:parseInt(this.getAttribute("endLevel"))},this),tq.log(this.TAG,"timeline init"),this._noSleep=new qQ,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(Tq.INNER_DEGRADE),this.timeline.emit(Tq.SET_PLAY_MODE,this._isLive?"LIVE":"VOD"),this.timeline.emit(Tq.SET_PLAYBACKRATE,this.playbackRate),this.muted=this.muted)}},{key:"_bindEvents",value:function(){var e=this;this.timeline.on(Tq.PLAY_EVENT,(function(t,n){var r;t===_q.LOADEDDATA&&(e.querySelector("canvas")||(tq.log(e.TAG,"_bindEvents, appendChild canvas"),e.appendChild(e.canvas)),e.canvas.style.display="block",null===(r=e.timeline)||void 0===r||r.emit(Tq.SET_PLAYBACKRATE,e.playbackRate));if(t!==_q.LOADEDMETADATA&&t!==_q.RESIZE||Promise.resolve().then((function(){e.updateVideoPostion()})),t===_q.ERROR){if(tq.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===_q.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(wq[t],e.degradeInfo);if(t===_q.LARGE_AV_GAP&&(e.unsyncInfo=n),t===_q.ENDED){if(e.paused)return;e.pause()}t===_q.PROGRESS&&e._noSleep.toPlay(),t===_q.WAITING&&e.analyse.addWaiting(),t===_q.SEEKING&&e.analyse.addSeeking(),t===_q.SEEKED&&e.analyse.addSeeked(),e._innerDispatchEvent(wq[t],n)}))}},{key:"_disabled",value:function(e){(this.innerDegrade||e)&&(e?sq().disabledWhenErrorOccur&&gq(1):sq().evaluateVVCount||(this.decodeFps/this.fps<=.6&&this.bitrate<2e6?gq(1):gq(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=NQ(e,3),a=i[0],o=i[1],s=i[2];WQ(XQ(n.prototype),"removeEventListener",t).call(t,a,o,s),null===(r=t._degradeVideo)||void 0===r||r.addEventListener(a,o,s)})),this._eventsBackup=[],e&&(this._degradeVideo.muted=!1,this._degradeVideo.src=e,this._degradeVideo.load())}},{key:"disconnectedCallback",value:function(){tq.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;tq.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(){eq(),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){tq.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(Tq.DO_PLAY),this._innerDispatchEvent("play"),Promise.resolve();this.destroy(),this._init(),n=setTimeout((function(){try{t._innerDispatchEvent("waiting")}catch(k0){}}),300)}return this._playRequest||!this.timeline.ready||this.timeline.paused?(tq.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(){tq.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=JQ||(JQ=document.querySelector("#hackAudioPP")))&&e.pause()}catch(k0){}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),a=(null==t?void 0:t.duration)/((null==t?void 0:t.formatTimescale)||1/0);tq.warn(this.TAG,"video firstDts:".concat(n&&n.dts," , audio firstDts:").concat(r&&r.dts," videoTrack.duration=").concat(i,", audioTrack.duration=").concat(a)),this._logFirstFrame=!0,(i||a)&&(this.setPlayMode("VOD"),this.timeline.emit(Tq.SET_PLAY_MODE,this._isLive?"LIVE":"VOD"),this.duration=Math.min(i||a,a||i)),this.analyse.addFirstData()}this.lowlatency&&(tq.warn(this.TAG,"single track! type=",b0),this.timeline.emit(Tq.SINGLE_TRACK,b0)),t.exist()||(tq.warn(this.TAG,"single track! type=",A0),this.timeline.emit(Tq.SINGLE_TRACK,A0)),e.exist()||(tq.warn(this.TAG,"single track! type=",_0),this.timeline.emit(Tq.SINGLE_TRACK,_0))}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(Tq.SET_METADATA,"audio",e)}},{key:"setVideoMeta",value:function(e){!this._isLive&&this._vMeta||(this.timeline.emit(Tq.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(Tq.END_OF_STREAM))}},{key:"updateVideoPostion",value:function(){var e;null===(e=this.timeline)||void 0===e||e.emit(kq.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(),tq.log(this.TAG,"call destroy"),this.timeline.emit(Tq.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(kq.UPDATE_VIDEO_COVER_POSITION,this.containerLayout,e,t),this._degradeVideo&&(this._degradeVideo.style.objectPosition="".concat(100*e,"% ").concat(100*t,"%"))}},{key:"setVideoDecode",value:function(){tq.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(Tq.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(Tq.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(Tq.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){tq.log(this.TAG,"set src ",e),this.setAttribute("src",e),this._vMeta=null,this.play(!0),this.timeline||this._init(),this._innerDispatchEvent("loadstart"),pq++}},{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(Tq.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(Tq.UPDATE_GL_OPTIONS,e)}},{key:"__error",get:function(){return this._err},set:function(e){this.timeline.emit(Tq.PLAY_EVENT,_q.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,a=e.h265Url,o=e.h265ThreadUrl,s=e.h265SimdUrl;n.h264Url=t,n.h265Url=a,n.h265AsmUrl=i,n.h264AsmUrl=r,n.h265ThreadUrl=o,n.h265SimdUrl=s}},{key:"getDecodeCapacity",value:function(){return sq()}},{key:"getDeviceCapacity",value:function(){return{simd:iq,thread:lq(),nbCpu:navigator.hardwareConcurrency}}},{key:"setDecodeCapacity",value:function(e){var t;t=e,aq=Object.assign({},aq,t),e.preloadDecoder&&c0.genDecoder().catch((function(){}))}},{key:"genDecoder",value:function(e){return c0.genDecoder(e)}},{key:"cleanDisabled",value:function(){Aq()}},{key:"isSupported",value:function(){return!!function(){if("undefined"==typeof customElements)return!1;if(dq)return!0;var e=!1,t=!1;try{var n=new(window.AudioContext||window.webkitAudioContext);n.close(),n=null,e=!0}catch(k0){}try{for(var r=document.createElement("canvas"),i=["webgl","experimental-webgl","moz-webgl","webkit-3d"],a=0;a<i.length;a++){var o=r.getContext(i[a]);if(o){o=null,r=null,t=!0;break}}dq=e&&t&&!!WebAssembly,localStorage.setItem("_sds",dq?1:0)}catch(k0){}return dq}()&&!1===bq()}}]),n}("undefined"!=typeof HTMLElement?HTMLElement:function(){});GQ(w0,"decoderCache",c0);w0.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"}),w0.setEleName=function(e){!function(e){rq=e}(e);var t=function(e){PQ(n,e);var t=MQ(n);function n(){return IQ(this,n),t.apply(this,arguments)}return CQ(n)}(w0);customElements.get(oq())||customElements.define(oq(),t)};try{customElements.get(oq())||customElements.define(oq(),w0)}catch(k0){}VePlayer.register("plugin:flv",bP),VePlayer.register("plugin:mp4",fH),VePlayer.register("plugin:rtm",uB),VePlayer.register("plugin:hls",_Q),VePlayer.register("plugin:shaka",class extends qa{constructor(e){super(e),t(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}}))})),kQ.polyfill.installAll()}static get pluginName(){return"ShakaPlugin"}static get defaultConfig(){return{shakaOpts:{}}}static isSupported(){return kQ.Player.isBrowserSupported()}afterCreate(){this.content=[],this.url=this.player.config.url,kQ.Player.isBrowserSupported()&&this.on(Ka,(e=>{/^blob/.test(e)||(this.url=e,this.loadUrl(e))}))}beforePlayerInit(){if(!kQ.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 kQ.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===kQ.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"!==Wa.device&&console.log("updateDefinition",this.content)}}),VePlayer.register("plugin:xgvideo",w0)}));
|