@byteplus/veplayer 1.1.0-alpha.2

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.
@@ -0,0 +1,2 @@
1
+ // @byteplus/veplayer@1.1.0-alpha.2 Built @Tue, 09 May 2023 02:51:35 GMT
2
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VePlayer=t()}(this,(function(){"use strict";function ownKeys$7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2$5(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$7(Object(r),!0).forEach((function(t){_defineProperty$6(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$7(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime$2(){_regeneratorRuntime$2=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(w){s=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var i,o,a,s,l=t&&t.prototype instanceof h?t:h,d=Object.create(l.prototype),p=new S(n||[]);return d._invoke=(i=e,o=r,a=p,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(a.method=e,a.arg=t;;){var r=a.delegate;if(r){var n=b(r,a);if(n){if(n===u)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";var l=c(i,o,a);if("normal"===l.type){if(s=a.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:a.done}}"throw"===l.type&&(s="completed",a.method="throw",a.arg=l.arg)}}),d}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(w){return{type:"throw",arg:w}}}e.wrap=l;var u={};function h(){}function d(){}function p(){}var f={};s(f,i,(function(){return this}));var g=Object.getPrototypeOf,y=g&&g(g($([])));y&&y!==t&&r.call(y,i)&&(f=y);var v=p.prototype=h.prototype=Object.create(f);function m(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(i,o,a,s){var l=c(e[i],e,o);if("throw"!==l.type){var u=l.arg,h=u.value;return h&&"object"==typeof h&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(h).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function b(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,u;var i=n.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,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function T(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 E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function $(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return d.prototype=p,s(v,"constructor",p),s(p,"constructor",d),d.displayName=s(p,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,a,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},m(_.prototype),s(_.prototype,o,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new _(l(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(v),s(v,a,"Generator"),s(v,i,(function(){return this})),s(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=$,S.prototype={constructor:S,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(E),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;E(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:$(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function _typeof$4(e){return(_typeof$4="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 asyncGeneratorStep$3(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(c){return void r(c)}s.done?t(l):Promise.resolve(l).then(n,i)}function _asyncToGenerator$3(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){asyncGeneratorStep$3(o,n,i,a,s,"next",e)}function s(e){asyncGeneratorStep$3(o,n,i,a,s,"throw",e)}a(void 0)}))}}function _classCallCheck$5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$6(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$6(e,t,r){return t&&_defineProperties$6(e.prototype,t),r&&_defineProperties$6(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$6(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$5(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&&_setPrototypeOf$5(e,t)}function _getPrototypeOf$5(e){return(_getPrototypeOf$5=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$5(e,t){return(_setPrototypeOf$5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$5(){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 _objectWithoutPropertiesLoose$1(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}function _objectWithoutProperties$1(e,t){if(null==e)return{};var r,n,i=_objectWithoutPropertiesLoose$1(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function _assertThisInitialized$5(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$5(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 _assertThisInitialized$5(e)}function _createSuper$5(e){var t=_isNativeReflectConstruct$5();return function(){var r,n=_getPrototypeOf$5(e);if(t){var i=_getPrototypeOf$5(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$5(this,r)}}function _superPropBase$3(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf$5(e)););return e}function _get$3(){return _get$3="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=_superPropBase$3(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},_get$3.apply(this,arguments)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray$2(e,t)||_nonIterableRest()}function _toConsumableArray$1(e){return _arrayWithoutHoles$1(e)||_iterableToArray$1(e)||_unsupportedIterableToArray$2(e)||_nonIterableSpread$1()}function _arrayWithoutHoles$1(e){if(Array.isArray(e))return _arrayLikeToArray$2(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray$1(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(l){s=!0,i=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}}function _unsupportedIterableToArray$2(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$2(e,t):void 0}}function _arrayLikeToArray$2(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _nonIterableSpread$1(){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 _nonIterableRest(){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 _createForOfIteratorHelper$1(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray$2(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function listCacheClear(){this.__data__=[],this.size=0}function eq(e,t){return e===t||e!=e&&t!=t}function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}var arrayProto=Array.prototype,splice$1=arrayProto.splice;function listCacheDelete(e){var t=this.__data__,r=assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():splice$1.call(t,r,1),--this.size,!0)}function listCacheGet(e){var t=this.__data__,r=assocIndexOf(t,e);return r<0?void 0:t[r][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function ListCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function stackClear(){this.__data__=new ListCache,this.size=0}function stackDelete(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function stackGet(e){return this.__data__.get(e)}function stackHas(e){return this.__data__.has(e)}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var freeGlobal="object"==("undefined"==typeof global?"undefined":_typeof$4(global))&&global&&global.Object===Object&&global,freeGlobal$1=freeGlobal,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof$4(self))&&self&&self.Object===Object&&self,root=freeGlobal$1||freeSelf||Function("return this")(),root$1=root,_Symbol$2=root$1.Symbol,_Symbol$3=_Symbol$2,objectProto$f=Object.prototype,hasOwnProperty$d=objectProto$f.hasOwnProperty,nativeObjectToString$1=objectProto$f.toString,symToStringTag$1=_Symbol$3?_Symbol$3.toStringTag:void 0;function getRawTag(e){var t=hasOwnProperty$d.call(e,symToStringTag$1),r=e[symToStringTag$1];try{e[symToStringTag$1]=void 0;var n=!0}catch(o){}var i=nativeObjectToString$1.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),i}var objectProto$e=Object.prototype,nativeObjectToString=objectProto$e.toString;function objectToString$1(e){return nativeObjectToString.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol$3?_Symbol$3.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString$1(e)}function isObject$o(e){var t=_typeof$4(e);return null!=e&&("object"==t||"function"==t)}var asyncTag="[object AsyncFunction]",funcTag$2="[object Function]",genTag$1="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$1(e){if(!isObject$o(e))return!1;var t=baseGetTag(e);return t==funcTag$2||t==genTag$1||t==asyncTag||t==proxyTag}var coreJsData=root$1["__core-js_shared__"],coreJsData$1=coreJsData,maskSrcKey=(uid2=/[^.]+$/.exec(coreJsData$1&&coreJsData$1.keys&&coreJsData$1.keys.IE_PROTO||""),uid2?"Symbol(src)_1."+uid2:""),uid2;function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource(e){if(null!=e){try{return funcToString$1.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$d=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$c=objectProto$d.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$c).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){return!(!isObject$o(e)||isMasked(e))&&(isFunction$1(e)?reIsNative:reIsHostCtor).test(toSource(e))}function getValue(e,t){return null==e?void 0:e[t]}function getNative(e,t){var r=getValue(e,t);return baseIsNative(r)?r:void 0}var Map$1=getNative(root$1,"Map"),Map$2=Map$1,nativeCreate=getNative(Object,"create"),nativeCreate$1=nativeCreate;function hashClear(){this.__data__=nativeCreate$1?nativeCreate$1(null):{},this.size=0}function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var HASH_UNDEFINED$2="__lodash_hash_undefined__",objectProto$c=Object.prototype,hasOwnProperty$b=objectProto$c.hasOwnProperty;function hashGet(e){var t=this.__data__;if(nativeCreate$1){var r=t[e];return r===HASH_UNDEFINED$2?void 0:r}return hasOwnProperty$b.call(t,e)?t[e]:void 0}var objectProto$b=Object.prototype,hasOwnProperty$a=objectProto$b.hasOwnProperty;function hashHas(e){var t=this.__data__;return nativeCreate$1?void 0!==t[e]:hasOwnProperty$a.call(t,e)}var HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nativeCreate$1&&void 0===t?HASH_UNDEFINED$1:t,this}function Hash(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$2||ListCache),string:new Hash}}function isKeyable(e){var t=_typeof$4(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function getMapData(e,t){var r=e.__data__;return isKeyable(t)?r["string"==typeof t?"string":"hash"]:r.map}function mapCacheDelete(e){var t=getMapData(this,e).delete(e);return this.size-=t?1:0,t}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function MapCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet,MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var LARGE_ARRAY_SIZE$1=200;function stackSet(e,t){var r=this.__data__;if(r instanceof ListCache){var n=r.__data__;if(!Map$2||n.length<LARGE_ARRAY_SIZE$1-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new MapCache(n)}return r.set(e,t),this.size=r.size,this}function Stack(e){var t=this.__data__=new ListCache(e);this.size=t.size}function arrayEach(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}Stack.prototype.clear=stackClear,Stack.prototype.delete=stackDelete,Stack.prototype.get=stackGet,Stack.prototype.has=stackHas,Stack.prototype.set=stackSet;var defineProperty$e=function(){try{var e=getNative(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),defineProperty$f=defineProperty$e;function baseAssignValue(e,t,r){"__proto__"==t&&defineProperty$f?defineProperty$f(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var objectProto$a=Object.prototype,hasOwnProperty$9=objectProto$a.hasOwnProperty;function assignValue(e,t,r){var n=e[t];hasOwnProperty$9.call(e,t)&&eq(n,r)&&(void 0!==r||t in e)||baseAssignValue(e,t,r)}function copyObject(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],l=n?n(r[s],e[s],s,r,e):void 0;void 0===l&&(l=e[s]),i?baseAssignValue(r,s,l):assignValue(r,s,l)}return r}function baseTimes(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function isObjectLike(e){return null!=e&&"object"==_typeof$4(e)}var argsTag$3="[object Arguments]";function baseIsArguments(e){return isObjectLike(e)&&baseGetTag(e)==argsTag$3}var objectProto$9=Object.prototype,hasOwnProperty$8=objectProto$9.hasOwnProperty,propertyIsEnumerable$2=objectProto$9.propertyIsEnumerable,isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike(e)&&hasOwnProperty$8.call(e,"callee")&&!propertyIsEnumerable$2.call(e,"callee")},isArguments$1=isArguments,isArray$6=Array.isArray,isArray$7=isArray$6;function stubFalse(){return!1}var freeExports$2="object"==("undefined"==typeof exports?"undefined":_typeof$4(exports))&&exports&&!exports.nodeType&&exports,freeModule$2=freeExports$2&&"object"==("undefined"==typeof module?"undefined":_typeof$4(module))&&module&&!module.nodeType&&module,moduleExports$2=freeModule$2&&freeModule$2.exports===freeExports$2,Buffer$1=moduleExports$2?root$1.Buffer:void 0,nativeIsBuffer=Buffer$1?Buffer$1.isBuffer:void 0,isBuffer=nativeIsBuffer||stubFalse,isBuffer$1=isBuffer,MAX_SAFE_INTEGER$2=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(e,t){var r=_typeof$4(e);return!!(t=null==t?MAX_SAFE_INTEGER$2:t)&&("number"==r||"symbol"!=r&&reIsUint.test(e))&&e>-1&&e%1==0&&e<t}var MAX_SAFE_INTEGER$1=9007199254740991;function isLength(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=MAX_SAFE_INTEGER$1}var argsTag$2="[object Arguments]",arrayTag$2="[object Array]",boolTag$3="[object Boolean]",dateTag$3="[object Date]",errorTag$2="[object Error]",funcTag$1="[object Function]",mapTag$5="[object Map]",numberTag$3="[object Number]",objectTag$3="[object Object]",regexpTag$3="[object RegExp]",setTag$5="[object Set]",stringTag$3="[object String]",weakMapTag$2="[object WeakMap]",arrayBufferTag$3="[object ArrayBuffer]",dataViewTag$4="[object DataView]",float32Tag$2="[object Float32Array]",float64Tag$2="[object Float64Array]",int8Tag$2="[object Int8Array]",int16Tag$2="[object Int16Array]",int32Tag$2="[object Int32Array]",uint8Tag$2="[object Uint8Array]",uint8ClampedTag$2="[object Uint8ClampedArray]",uint16Tag$2="[object Uint16Array]",uint32Tag$2="[object Uint32Array]",typedArrayTags={};function baseIsTypedArray(e){return isObjectLike(e)&&isLength(e.length)&&!!typedArrayTags[baseGetTag(e)]}function baseUnary(e){return function(t){return e(t)}}typedArrayTags[float32Tag$2]=typedArrayTags[float64Tag$2]=typedArrayTags[int8Tag$2]=typedArrayTags[int16Tag$2]=typedArrayTags[int32Tag$2]=typedArrayTags[uint8Tag$2]=typedArrayTags[uint8ClampedTag$2]=typedArrayTags[uint16Tag$2]=typedArrayTags[uint32Tag$2]=!0,typedArrayTags[argsTag$2]=typedArrayTags[arrayTag$2]=typedArrayTags[arrayBufferTag$3]=typedArrayTags[boolTag$3]=typedArrayTags[dataViewTag$4]=typedArrayTags[dateTag$3]=typedArrayTags[errorTag$2]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag$5]=typedArrayTags[numberTag$3]=typedArrayTags[objectTag$3]=typedArrayTags[regexpTag$3]=typedArrayTags[setTag$5]=typedArrayTags[stringTag$3]=typedArrayTags[weakMapTag$2]=!1;var freeExports$1="object"==("undefined"==typeof exports?"undefined":_typeof$4(exports))&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&"object"==("undefined"==typeof module?"undefined":_typeof$4(module))&&module&&!module.nodeType&&module,moduleExports$1=freeModule$1&&freeModule$1.exports===freeExports$1,freeProcess=moduleExports$1&&freeGlobal$1.process,nodeUtil=function(){try{var e=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return e||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(t){}}(),nodeUtil$1=nodeUtil,nodeIsTypedArray=nodeUtil$1&&nodeUtil$1.isTypedArray,isTypedArray$2=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,isTypedArray$3=isTypedArray$2,objectProto$8=Object.prototype,hasOwnProperty$7=objectProto$8.hasOwnProperty;function arrayLikeKeys(e,t){var r=isArray$7(e),n=!r&&isArguments$1(e),i=!r&&!n&&isBuffer$1(e),o=!r&&!n&&!i&&isTypedArray$3(e),a=r||n||i||o,s=a?baseTimes(e.length,String):[],l=s.length;for(var c in e)!t&&!hasOwnProperty$7.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||isIndex(c,l))||s.push(c);return s}var objectProto$7=Object.prototype;function isPrototype(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||objectProto$7)}function overArg(e,t){return function(r){return e(t(r))}}var nativeKeys$1=overArg(Object.keys,Object),nativeKeys$2=nativeKeys$1,objectProto$6=Object.prototype,hasOwnProperty$6=objectProto$6.hasOwnProperty;function baseKeys(e){if(!isPrototype(e))return nativeKeys$2(e);var t=[];for(var r in Object(e))hasOwnProperty$6.call(e,r)&&"constructor"!=r&&t.push(r);return t}function isArrayLike(e){return null!=e&&isLength(e.length)&&!isFunction$1(e)}function keys$4(e){return isArrayLike(e)?arrayLikeKeys(e):baseKeys(e)}function baseAssign(e,t){return e&&copyObject(t,keys$4(t),e)}function nativeKeysIn(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}var objectProto$5=Object.prototype,hasOwnProperty$5=objectProto$5.hasOwnProperty;function baseKeysIn(e){if(!isObject$o(e))return nativeKeysIn(e);var t=isPrototype(e),r=[];for(var n in e)("constructor"!=n||!t&&hasOwnProperty$5.call(e,n))&&r.push(n);return r}function keysIn(e){return isArrayLike(e)?arrayLikeKeys(e,!0):baseKeysIn(e)}function baseAssignIn(e,t){return e&&copyObject(t,keysIn(t),e)}var freeExports="object"==("undefined"==typeof exports?"undefined":_typeof$4(exports))&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&"object"==("undefined"==typeof module?"undefined":_typeof$4(module))&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,Buffer=moduleExports?root$1.Buffer:void 0,allocUnsafe=Buffer?Buffer.allocUnsafe:void 0;function cloneBuffer(e,t){if(t)return e.slice();var r=e.length,n=allocUnsafe?allocUnsafe(r):new e.constructor(r);return e.copy(n),n}function copyArray(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function arrayFilter(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}function stubArray(){return[]}var objectProto$4=Object.prototype,propertyIsEnumerable$1=objectProto$4.propertyIsEnumerable,nativeGetSymbols$1=Object.getOwnPropertySymbols,getSymbols=nativeGetSymbols$1?function(e){return null==e?[]:(e=Object(e),arrayFilter(nativeGetSymbols$1(e),(function(t){return propertyIsEnumerable$1.call(e,t)})))}:stubArray,getSymbols$1=getSymbols;function copySymbols(e,t){return copyObject(e,getSymbols$1(e),t)}function arrayPush(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var getPrototype=overArg(Object.getPrototypeOf,Object),getPrototype$1=getPrototype,nativeGetSymbols=Object.getOwnPropertySymbols,getSymbolsIn=nativeGetSymbols?function(e){for(var t=[];e;)arrayPush(t,getSymbols$1(e)),e=getPrototype$1(e);return t}:stubArray,getSymbolsIn$1=getSymbolsIn;function copySymbolsIn(e,t){return copyObject(e,getSymbolsIn$1(e),t)}function baseGetAllKeys(e,t,r){var n=t(e);return isArray$7(e)?n:arrayPush(n,r(e))}function getAllKeys(e){return baseGetAllKeys(e,keys$4,getSymbols$1)}function getAllKeysIn(e){return baseGetAllKeys(e,keysIn,getSymbolsIn$1)}var DataView$2=getNative(root$1,"DataView"),DataView$3=DataView$2,Promise$2=getNative(root$1,"Promise"),Promise$3=Promise$2,Set$1=getNative(root$1,"Set"),Set$2=Set$1,WeakMap$2=getNative(root$1,"WeakMap"),WeakMap$3=WeakMap$2,mapTag$4="[object Map]",objectTag$2="[object Object]",promiseTag="[object Promise]",setTag$4="[object Set]",weakMapTag$1="[object WeakMap]",dataViewTag$3="[object DataView]",dataViewCtorString=toSource(DataView$3),mapCtorString=toSource(Map$2),promiseCtorString=toSource(Promise$3),setCtorString=toSource(Set$2),weakMapCtorString=toSource(WeakMap$3),getTag=baseGetTag;(DataView$3&&getTag(new DataView$3(new ArrayBuffer(1)))!=dataViewTag$3||Map$2&&getTag(new Map$2)!=mapTag$4||Promise$3&&getTag(Promise$3.resolve())!=promiseTag||Set$2&&getTag(new Set$2)!=setTag$4||WeakMap$3&&getTag(new WeakMap$3)!=weakMapTag$1)&&(getTag=function(e){var t=baseGetTag(e),r=t==objectTag$2?e.constructor:void 0,n=r?toSource(r):"";if(n)switch(n){case dataViewCtorString:return dataViewTag$3;case mapCtorString:return mapTag$4;case promiseCtorString:return promiseTag;case setCtorString:return setTag$4;case weakMapCtorString:return weakMapTag$1}return t});var getTag$1=getTag,objectProto$3=Object.prototype,hasOwnProperty$4=objectProto$3.hasOwnProperty;function initCloneArray(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&hasOwnProperty$4.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var Uint8Array$3=root$1.Uint8Array,Uint8Array$4=Uint8Array$3;function cloneArrayBuffer(e){var t=new e.constructor(e.byteLength);return new Uint8Array$4(t).set(new Uint8Array$4(e)),t}function cloneDataView(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var reFlags=/\w*$/;function cloneRegExp(e){var t=new e.constructor(e.source,reFlags.exec(e));return t.lastIndex=e.lastIndex,t}var symbolProto$2=_Symbol$3?_Symbol$3.prototype:void 0,symbolValueOf$1=symbolProto$2?symbolProto$2.valueOf:void 0;function cloneSymbol(e){return symbolValueOf$1?Object(symbolValueOf$1.call(e)):{}}function cloneTypedArray(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var boolTag$2="[object Boolean]",dateTag$2="[object Date]",mapTag$3="[object Map]",numberTag$2="[object Number]",regexpTag$2="[object RegExp]",setTag$3="[object Set]",stringTag$2="[object String]",symbolTag$3="[object Symbol]",arrayBufferTag$2="[object ArrayBuffer]",dataViewTag$2="[object DataView]",float32Tag$1="[object Float32Array]",float64Tag$1="[object Float64Array]",int8Tag$1="[object Int8Array]",int16Tag$1="[object Int16Array]",int32Tag$1="[object Int32Array]",uint8Tag$1="[object Uint8Array]",uint8ClampedTag$1="[object Uint8ClampedArray]",uint16Tag$1="[object Uint16Array]",uint32Tag$1="[object Uint32Array]";function initCloneByTag(e,t,r){var n=e.constructor;switch(t){case arrayBufferTag$2:return cloneArrayBuffer(e);case boolTag$2:case dateTag$2:return new n(+e);case dataViewTag$2:return cloneDataView(e,r);case float32Tag$1:case float64Tag$1:case int8Tag$1:case int16Tag$1:case int32Tag$1:case uint8Tag$1:case uint8ClampedTag$1:case uint16Tag$1:case uint32Tag$1:return cloneTypedArray(e,r);case mapTag$3:return new n;case numberTag$2:case stringTag$2:return new n(e);case regexpTag$2:return cloneRegExp(e);case setTag$3:return new n;case symbolTag$3:return cloneSymbol(e)}}var objectCreate$1=Object.create,baseCreate=function(){function e(){}return function(t){if(!isObject$o(t))return{};if(objectCreate$1)return objectCreate$1(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),baseCreate$1=baseCreate;function initCloneObject(e){return"function"!=typeof e.constructor||isPrototype(e)?{}:baseCreate$1(getPrototype$1(e))}var mapTag$2="[object Map]";function baseIsMap(e){return isObjectLike(e)&&getTag$1(e)==mapTag$2}var nodeIsMap=nodeUtil$1&&nodeUtil$1.isMap,isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap,isMap$1=isMap,setTag$2="[object Set]";function baseIsSet(e){return isObjectLike(e)&&getTag$1(e)==setTag$2}var nodeIsSet=nodeUtil$1&&nodeUtil$1.isSet,isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet,isSet$1=isSet,CLONE_DEEP_FLAG$1=1,CLONE_FLAT_FLAG=2,CLONE_SYMBOLS_FLAG$1=4,argsTag$1="[object Arguments]",arrayTag$1="[object Array]",boolTag$1="[object Boolean]",dateTag$1="[object Date]",errorTag$1="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag$1="[object Map]",numberTag$1="[object Number]",objectTag$1="[object Object]",regexpTag$1="[object RegExp]",setTag$1="[object Set]",stringTag$1="[object String]",symbolTag$2="[object Symbol]",weakMapTag="[object WeakMap]",arrayBufferTag$1="[object ArrayBuffer]",dataViewTag$1="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",cloneableTags={};function baseClone(e,t,r,n,i,o){var a,s=t&CLONE_DEEP_FLAG$1,l=t&CLONE_FLAT_FLAG,c=t&CLONE_SYMBOLS_FLAG$1;if(r&&(a=i?r(e,n,i,o):r(e)),void 0!==a)return a;if(!isObject$o(e))return e;var u=isArray$7(e);if(u){if(a=initCloneArray(e),!s)return copyArray(e,a)}else{var h=getTag$1(e),d=h==funcTag||h==genTag;if(isBuffer$1(e))return cloneBuffer(e,s);if(h==objectTag$1||h==argsTag$1||d&&!i){if(a=l||d?{}:initCloneObject(e),!s)return l?copySymbolsIn(e,baseAssignIn(a,e)):copySymbols(e,baseAssign(a,e))}else{if(!cloneableTags[h])return i?e:{};a=initCloneByTag(e,h,s)}}o||(o=new Stack);var p=o.get(e);if(p)return p;o.set(e,a),isSet$1(e)?e.forEach((function(n){a.add(baseClone(n,t,r,n,e,o))})):isMap$1(e)&&e.forEach((function(n,i){a.set(i,baseClone(n,t,r,i,e,o))}));var f=u?void 0:(c?l?getAllKeysIn:getAllKeys:l?keysIn:keys$4)(e);return arrayEach(f||e,(function(n,i){f&&(n=e[i=n]),assignValue(a,i,baseClone(n,t,r,i,e,o))})),a}cloneableTags[argsTag$1]=cloneableTags[arrayTag$1]=cloneableTags[arrayBufferTag$1]=cloneableTags[dataViewTag$1]=cloneableTags[boolTag$1]=cloneableTags[dateTag$1]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag$1]=cloneableTags[numberTag$1]=cloneableTags[objectTag$1]=cloneableTags[regexpTag$1]=cloneableTags[setTag$1]=cloneableTags[stringTag$1]=cloneableTags[symbolTag$2]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0,cloneableTags[errorTag$1]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=!1;var CLONE_DEEP_FLAG=1,CLONE_SYMBOLS_FLAG=4;function cloneDeep(e){return baseClone(e,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG)}var HASH_UNDEFINED="__lodash_hash_undefined__";function setCacheAdd(e){return this.__data__.set(e,HASH_UNDEFINED),this}function setCacheHas(e){return this.__data__.has(e)}function SetCache(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new MapCache;++t<r;)this.add(e[t])}function arraySome(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function cacheHas(e,t){return e.has(t)}SetCache.prototype.add=SetCache.prototype.push=setCacheAdd,SetCache.prototype.has=setCacheHas;var COMPARE_PARTIAL_FLAG$5=1,COMPARE_UNORDERED_FLAG$3=2;function equalArrays(e,t,r,n,i,o){var a=r&COMPARE_PARTIAL_FLAG$5,s=e.length,l=t.length;if(s!=l&&!(a&&l>s))return!1;var c=o.get(e),u=o.get(t);if(c&&u)return c==t&&u==e;var h=-1,d=!0,p=r&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(o.set(e,t),o.set(t,e);++h<s;){var f=e[h],g=t[h];if(n)var y=a?n(g,f,h,t,e,o):n(f,g,h,e,t,o);if(void 0!==y){if(y)continue;d=!1;break}if(p){if(!arraySome(t,(function(e,t){if(!cacheHas(p,t)&&(f===e||i(f,e,r,n,o)))return p.push(t)}))){d=!1;break}}else if(f!==g&&!i(f,g,r,n,o)){d=!1;break}}return o.delete(e),o.delete(t),d}function mapToArray(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function setToArray(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var COMPARE_PARTIAL_FLAG$4=1,COMPARE_UNORDERED_FLAG$2=2,boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",mapTag="[object Map]",numberTag="[object Number]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag$1="[object Symbol]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",symbolProto$1=_Symbol$3?_Symbol$3.prototype:void 0,symbolValueOf=symbolProto$1?symbolProto$1.valueOf:void 0;function equalByTag(e,t,r,n,i,o,a){switch(r){case dataViewTag:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case arrayBufferTag:return!(e.byteLength!=t.byteLength||!o(new Uint8Array$4(e),new Uint8Array$4(t)));case boolTag:case dateTag:case numberTag:return eq(+e,+t);case errorTag:return e.name==t.name&&e.message==t.message;case regexpTag:case stringTag:return e==t+"";case mapTag:var s=mapToArray;case setTag:var l=n&COMPARE_PARTIAL_FLAG$4;if(s||(s=setToArray),e.size!=t.size&&!l)return!1;var c=a.get(e);if(c)return c==t;n|=COMPARE_UNORDERED_FLAG$2,a.set(e,t);var u=equalArrays(s(e),s(t),n,i,o,a);return a.delete(e),u;case symbolTag$1:if(symbolValueOf)return symbolValueOf.call(e)==symbolValueOf.call(t)}return!1}var COMPARE_PARTIAL_FLAG$3=1,objectProto$2=Object.prototype,hasOwnProperty$3=objectProto$2.hasOwnProperty;function equalObjects(e,t,r,n,i,o){var a=r&COMPARE_PARTIAL_FLAG$3,s=getAllKeys(e),l=s.length;if(l!=getAllKeys(t).length&&!a)return!1;for(var c=l;c--;){var u=s[c];if(!(a?u in t:hasOwnProperty$3.call(t,u)))return!1}var h=o.get(e),d=o.get(t);if(h&&d)return h==t&&d==e;var p=!0;o.set(e,t),o.set(t,e);for(var f=a;++c<l;){var g=e[u=s[c]],y=t[u];if(n)var v=a?n(y,g,u,t,e,o):n(g,y,u,e,t,o);if(!(void 0===v?g===y||i(g,y,r,n,o):v)){p=!1;break}f||(f="constructor"==u)}if(p&&!f){var m=e.constructor,_=t.constructor;m==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof m&&m instanceof m&&"function"==typeof _&&_ instanceof _||(p=!1)}return o.delete(e),o.delete(t),p}var COMPARE_PARTIAL_FLAG$2=1,argsTag="[object Arguments]",arrayTag="[object Array]",objectTag="[object Object]",objectProto$1=Object.prototype,hasOwnProperty$2=objectProto$1.hasOwnProperty;function baseIsEqualDeep(e,t,r,n,i,o){var a=isArray$7(e),s=isArray$7(t),l=a?arrayTag:getTag$1(e),c=s?arrayTag:getTag$1(t),u=(l=l==argsTag?objectTag:l)==objectTag,h=(c=c==argsTag?objectTag:c)==objectTag,d=l==c;if(d&&isBuffer$1(e)){if(!isBuffer$1(t))return!1;a=!0,u=!1}if(d&&!u)return o||(o=new Stack),a||isTypedArray$3(e)?equalArrays(e,t,r,n,i,o):equalByTag(e,t,l,r,n,i,o);if(!(r&COMPARE_PARTIAL_FLAG$2)){var p=u&&hasOwnProperty$2.call(e,"__wrapped__"),f=h&&hasOwnProperty$2.call(t,"__wrapped__");if(p||f){var g=p?e.value():e,y=f?t.value():t;return o||(o=new Stack),i(g,y,r,n,o)}}return!!d&&(o||(o=new Stack),equalObjects(e,t,r,n,i,o))}function baseIsEqual(e,t,r,n,i){return e===t||(null==e||null==t||!isObjectLike(e)&&!isObjectLike(t)?e!=e&&t!=t:baseIsEqualDeep(e,t,r,n,baseIsEqual,i))}var COMPARE_PARTIAL_FLAG$1=1,COMPARE_UNORDERED_FLAG$1=2;function baseIsMatch(e,t,r,n){var i=r.length,o=i,a=!n;if(null==e)return!o;for(e=Object(e);i--;){var s=r[i];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){var l=(s=r[i])[0],c=e[l],u=s[1];if(a&&s[2]){if(void 0===c&&!(l in e))return!1}else{var h=new Stack;if(n)var d=n(c,u,l,e,t,h);if(!(void 0===d?baseIsEqual(u,c,COMPARE_PARTIAL_FLAG$1|COMPARE_UNORDERED_FLAG$1,n,h):d))return!1}}return!0}function isStrictComparable(e){return e==e&&!isObject$o(e)}function getMatchData(e){for(var t=keys$4(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,isStrictComparable(i)]}return t}function matchesStrictComparable(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}function baseMatches(e){var t=getMatchData(e);return 1==t.length&&t[0][2]?matchesStrictComparable(t[0][0],t[0][1]):function(r){return r===e||baseIsMatch(r,e,t)}}var symbolTag="[object Symbol]";function isSymbol$7(e){return"symbol"==_typeof$4(e)||isObjectLike(e)&&baseGetTag(e)==symbolTag}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,t){if(isArray$7(e))return!1;var r=_typeof$4(e);return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol$7(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var FUNC_ERROR_TEXT$2="Expected a function";function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT$2);var r=function r(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(memoize.Cache||MapCache),r}memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var t=memoize(e,(function(e){return r.size===MAX_MEMOIZE_SIZE&&r.clear(),e})),r=t.cache;return t}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(rePropName,(function(e,r,n,i){t.push(n?i.replace(reEscapeChar,"$1"):r||e)})),t})),stringToPath$1=stringToPath;function arrayMap(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var INFINITY$2=1/0,symbolProto=_Symbol$3?_Symbol$3.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString(e){if("string"==typeof e)return e;if(isArray$7(e))return arrayMap(e,baseToString)+"";if(isSymbol$7(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-INFINITY$2?"-0":t}function toString$l(e){return null==e?"":baseToString(e)}function castPath(e,t){return isArray$7(e)?e:isKey(e,t)?[e]:stringToPath$1(toString$l(e))}var INFINITY$1=1/0;function toKey(e){if("string"==typeof e||isSymbol$7(e))return e;var t=e+"";return"0"==t&&1/e==-INFINITY$1?"-0":t}function baseGet(e,t){for(var r=0,n=(t=castPath(t,e)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:void 0}function get$2(e,t,r){var n=null==e?void 0:baseGet(e,t);return void 0===n?r:n}function baseHasIn(e,t){return null!=e&&t in Object(e)}function hasPath(e,t,r){for(var n=-1,i=(t=castPath(t,e)).length,o=!1;++n<i;){var a=toKey(t[n]);if(!(o=null!=e&&r(e,a)))break;e=e[a]}return o||++n!=i?o:!!(i=null==e?0:e.length)&&isLength(i)&&isIndex(a,i)&&(isArray$7(e)||isArguments$1(e))}function hasIn(e,t){return null!=e&&hasPath(e,t,baseHasIn)}var COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;function baseMatchesProperty(e,t){return isKey(e)&&isStrictComparable(t)?matchesStrictComparable(toKey(e),t):function(r){var n=get$2(r,e);return void 0===n&&n===t?hasIn(r,e):baseIsEqual(t,n,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG)}}function identity(e){return e}function baseProperty(e){return function(t){return null==t?void 0:t[e]}}function basePropertyDeep(e){return function(t){return baseGet(t,e)}}function property(e){return isKey(e)?baseProperty(toKey(e)):basePropertyDeep(e)}function baseIteratee(e){return"function"==typeof e?e:null==e?identity:"object"==_typeof$4(e)?isArray$7(e)?baseMatchesProperty(e[0],e[1]):baseMatches(e):property(e)}function baseFindIndex(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function baseIsNaN(e){return e!=e}function strictIndexOf(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function baseIndexOf(e,t,r){return t==t?strictIndexOf(e,t,r):baseFindIndex(e,baseIsNaN,r)}function arrayIncludes$1(e,t){return!!(null==e?0:e.length)&&baseIndexOf(e,t,0)>-1}function arrayIncludesWith(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function noop$1(){}var INFINITY=1/0,createSet=Set$2&&1/setToArray(new Set$2([,-0]))[1]==INFINITY?function(e){return new Set$2(e)}:noop$1,createSet$1=createSet,LARGE_ARRAY_SIZE=200;function baseUniq(e,t,r){var n=-1,i=arrayIncludes$1,o=e.length,a=!0,s=[],l=s;if(r)a=!1,i=arrayIncludesWith;else if(o>=LARGE_ARRAY_SIZE){var c=t?null:createSet$1(e);if(c)return setToArray(c);a=!1,i=cacheHas,l=new SetCache}else l=t?[]:s;e:for(;++n<o;){var u=e[n],h=t?t(u):u;if(u=r||0!==u?u:0,a&&h==h){for(var d=l.length;d--;)if(l[d]===h)continue e;t&&l.push(h),s.push(u)}else i(l,h,r)||(l!==s&&l.push(h),s.push(u))}return s}function uniqBy(e,t){return e&&e.length?baseUniq(e,baseIteratee(t)):[]}var CodecType=function(e){return e.H265="h265",e.H264="h264",e}(CodecType||{}),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},proxy=function(){var e,t=null;function r(e){return!!e&&("object"===_typeof$4(e)||"function"==typeof e)}function n(e){if(null!==e&&!r(e))throw new TypeError("Object prototype may only be an Object or null: "+e)}var i=Object,o=Boolean(i.create)||!({__proto__:null}instanceof i),a=i.create||(o?function(e){return n(e),{__proto__:e}}:function(e){if(n(e),null===e)throw new SyntaxError("Native Object.create is required to create objects with null prototype");var t=function(){};return t.prototype=e,new t}),s=function(){return null},l=i.getPrototypeOf||([].__proto__===Array.prototype?function(e){var t=e.__proto__;return r(t)?t:null}:s);return e=function(c,u){if(void 0===(this&&this instanceof e?this.constructor:void 0))throw new TypeError("Constructor Proxy requires 'new'");if(!r(c)||!r(u))throw new TypeError("Cannot create proxy with a non-object as target or handler");var h=function(){};t=function(){c=null,h=function(e){throw new TypeError("Cannot perform '".concat(e,"' on a proxy that has been revoked"))}},setTimeout((function(){t=null}),0);var d=u;for(var p in u={get:null,set:null,apply:null,construct:null},d){if(!(p in u))throw new TypeError("Proxy polyfill does not support trap '".concat(p,"'"));u[p]=d[p]}"function"==typeof d&&(u.apply=d.apply.bind(d));var f,g=l(c),y=!1,v=!1;"function"==typeof c?(f=function(){var e=this&&this.constructor===f,t=Array.prototype.slice.call(arguments);if(h(e?"construct":"apply"),e&&u.construct)return u.construct.call(this,c,t);if(!e&&u.apply)return u.apply(c,this,t);if(e){t.unshift(c);var r=c.bind.apply(c,t);return new r}return c.apply(this,t)},y=!0):c instanceof Array?(f=[],v=!0):f=o||null!==g?a(g):{};var m=u.get?function(e){return h("get"),u.get(this,e,f)}:function(e){return h("get"),this[e]},_=u.set?function(e,t){h("set"),u.set(this,e,t,f)}:function(e,t){h("set"),this[e]=t},b=i.getOwnPropertyNames(c),T={};b.forEach((function(e){if(!y&&!v||!(e in f)){var t=i.getOwnPropertyDescriptor(c,e),r={enumerable:Boolean(t.enumerable),get:m.bind(c,e),set:_.bind(c,e)};i.defineProperty(f,e,r),T[e]=!0}}));var E=!0;if(y||v){var S=i.setPrototypeOf||([].__proto__===Array.prototype?function(e,t){return n(t),e.__proto__=t,e}:s);g&&S(f,g)||(E=!1)}if(u.get||!E)for(var $ in c)T[$]||i.defineProperty(f,$,{get:m.bind(c,$)});return i.seal(c),i.seal(f),f},e.revocable=function(r,n){return{proxy:new e(r,n),revoke:t}},e},Proxy$1=proxy(),MyProxy=function(){function e(){_classCallCheck$5(this,e),this.subscribeId=0,this.watcherMap=new Map}return _createClass$6(e,[{key:"observe",value:function(e){var t=this,r=new Proxy$1(e,{set:function(e,n,i){var o=Reflect.get(e,n);Reflect.set(e,n,i);var a=t.watcherMap.get(r);return a&&(t.flushCallback(a),t.flushPropertyCallback(a,n,o,i)),!0}});return this.watcherMap.set(r,{pending:!1,queue:[],property:{}}),r}},{key:"subscribe",value:function(e,t){var r=this.watcherMap.get(e);if(r)return this.subscribeId++,r.queue.push({id:this.subscribeId,callback:t}),this.subscribeId}},{key:"unsubscribe",value:function(e,t){var r=this.watcherMap.get(e);if(r){var n=r.queue,i=n.findIndex((function(e){return e.id===t}));void 0!==i&&i>-1&&n.splice(i,1)}}},{key:"subscribeProperty",value:function(e,t,r){var n=this.watcherMap.get(e);n&&(this.subscribeId++,n.property[t]||(n.property[t]={pending:!1,timer:0,pre:null,queue:[]}),n.property[t].queue.push({id:this.subscribeId,callback:r}))}},{key:"unsubscribeProperty",value:function(e,t,r){var n=this.watcherMap.get(e);if(n){var i=n.property[t];if(i){var o=i.queue,a=o.findIndex((function(e){return e.id===r}));void 0!==a&&a>-1&&o.splice(a,1)}}}},{key:"flushCallback",value:function(e){e.pending||(e.pending=!0,setTimeout((function(){e.queue.forEach((function(e){return e.callback()})),e.pending=!1}),0))}},{key:"flushPropertyCallback",value:function(e,t,r,n){var i=e.property[t];i&&(clearTimeout(i.timer),!1===i.pending&&(i.pending=!0,i.pre=r),i.timer=setTimeout((function(){i.queue.forEach((function(e){return e.callback(i.pre,n)})),i.pending=!1}),0))}}]),e}(),MyProxy$1=new MyProxy;function ownKeys$6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2$4(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$6(Object(r),!0).forEach((function(t){_defineProperty$5(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$6(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof$3(e){return(_typeof$3="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 _classCallCheck$4(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$5(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey$3(n.key),n)}}function _createClass$5(e,t,r){return t&&_defineProperties$5(e.prototype,t),r&&_defineProperties$5(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$5(e,t,r){return(t=_toPropertyKey$3(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$4(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&&_setPrototypeOf$4(e,t)}function _getPrototypeOf$4(e){return(_getPrototypeOf$4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$4(e,t){return(_setPrototypeOf$4=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$4(){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 _assertThisInitialized$4(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$4(e,t){if(t&&("object"===_typeof$4(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$4(e)}function _createSuper$4(e){var t=_isNativeReflectConstruct$4();return function(){var r,n=_getPrototypeOf$4(e);if(t){var i=_getPrototypeOf$4(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$4(this,r)}}function _superPropBase$2(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf$4(e)););return e}function _get$2(){return _get$2="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=_superPropBase$2(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},_get$2.apply(this,arguments)}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray$1(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray$1(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$1(e,t):void 0}}function _arrayLikeToArray$1(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _nonIterableSpread(){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 _toPrimitive$3(e,t){if("object"!==_typeof$4(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==_typeof$4(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey$3(e){var t=_toPrimitive$3(e,"string");return"symbol"===_typeof$4(t)?t:String(t)}var check=function(e){return e&&e.Math==Math&&e},global$H=check("object"==("undefined"==typeof globalThis?"undefined":_typeof$4(globalThis))&&globalThis)||check("object"==("undefined"==typeof window?"undefined":_typeof$4(window))&&window)||check("object"==("undefined"==typeof self?"undefined":_typeof$4(self))&&self)||check("object"==_typeof$4(commonjsGlobal)&&commonjsGlobal)||function(){return this}()||Function("return this")(),objectGetOwnPropertyDescriptor={},fails$L=function(e){try{return!!e()}catch(t){return!0}},fails$K=fails$L,descriptors=!fails$K((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),fails$J=fails$L,functionBindNative=!fails$J((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),NATIVE_BIND$4=functionBindNative,call$u=Function.prototype.call,functionCall=NATIVE_BIND$4?call$u.bind(call$u):function(){return call$u.apply(call$u,arguments)},objectPropertyIsEnumerable={},$propertyIsEnumerable$2={}.propertyIsEnumerable,getOwnPropertyDescriptor$5=Object.getOwnPropertyDescriptor,NASHORN_BUG=getOwnPropertyDescriptor$5&&!$propertyIsEnumerable$2.call({1:2},1);objectPropertyIsEnumerable.f=NASHORN_BUG?function(e){var t=getOwnPropertyDescriptor$5(this,e);return!!t&&t.enumerable}:$propertyIsEnumerable$2;var createPropertyDescriptor$7=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},NATIVE_BIND$3=functionBindNative,FunctionPrototype$3=Function.prototype,call$t=FunctionPrototype$3.call,uncurryThisWithBind=NATIVE_BIND$3&&FunctionPrototype$3.bind.bind(call$t,call$t),functionUncurryThisRaw=NATIVE_BIND$3?uncurryThisWithBind:function(e){return function(){return call$t.apply(e,arguments)}},uncurryThisRaw$1=functionUncurryThisRaw,toString$k=uncurryThisRaw$1({}.toString),stringSlice$a=uncurryThisRaw$1("".slice),classofRaw$2=function(e){return stringSlice$a(toString$k(e),8,-1)},classofRaw$1=classofRaw$2,uncurryThisRaw=functionUncurryThisRaw,functionUncurryThis=function(e){if("Function"===classofRaw$1(e))return uncurryThisRaw(e)},uncurryThis$J=functionUncurryThis,fails$I=fails$L,classof$g=classofRaw$2,$Object$4=Object,split$3=uncurryThis$J("".split),indexedObject=fails$I((function(){return!$Object$4("z").propertyIsEnumerable(0)}))?function(e){return"String"==classof$g(e)?split$3(e,""):$Object$4(e)}:$Object$4,isNullOrUndefined$7=function(e){return null==e},isNullOrUndefined$6=isNullOrUndefined$7,$TypeError$k=TypeError,requireObjectCoercible$a=function(e){if(isNullOrUndefined$6(e))throw $TypeError$k("Can't call method on "+e);return e},IndexedObject$5=indexedObject,requireObjectCoercible$9=requireObjectCoercible$a,toIndexedObject$c=function(e){return IndexedObject$5(requireObjectCoercible$9(e))},documentAll$2="object"==("undefined"==typeof document?"undefined":_typeof$4(document))&&document.all,IS_HTMLDDA=void 0===documentAll$2&&void 0!==documentAll$2,documentAll_1={all:documentAll$2,IS_HTMLDDA:IS_HTMLDDA},$documentAll$1=documentAll_1,documentAll$1=$documentAll$1.all,isCallable$u=$documentAll$1.IS_HTMLDDA?function(e){return"function"==typeof e||e===documentAll$1}:function(e){return"function"==typeof e},isCallable$t=isCallable$u,$documentAll=documentAll_1,documentAll=$documentAll.all,isObject$n=$documentAll.IS_HTMLDDA?function(e){return"object"==_typeof$4(e)?null!==e:isCallable$t(e)||e===documentAll}:function(e){return"object"==_typeof$4(e)?null!==e:isCallable$t(e)},global$G=global$H,isCallable$s=isCallable$u,aFunction=function(e){return isCallable$s(e)?e:void 0},getBuiltIn$d=function(e,t){return arguments.length<2?aFunction(global$G[e]):global$G[e]&&global$G[e][t]},uncurryThis$I=functionUncurryThis,objectIsPrototypeOf=uncurryThis$I({}.isPrototypeOf),getBuiltIn$c=getBuiltIn$d,engineUserAgent=getBuiltIn$c("navigator","userAgent")||"",global$F=global$H,userAgent$6=engineUserAgent,process$3=global$F.process,Deno$1=global$F.Deno,versions=process$3&&process$3.versions||Deno$1&&Deno$1.version,v8=versions&&versions.v8,match,version$2;v8&&(match=v8.split("."),version$2=match[0]>0&&match[0]<4?1:+(match[0]+match[1])),!version$2&&userAgent$6&&(match=userAgent$6.match(/Edge\/(\d+)/),(!match||match[1]>=74)&&(match=userAgent$6.match(/Chrome\/(\d+)/),match&&(version$2=+match[1])));var engineV8Version=version$2,V8_VERSION$3=engineV8Version,fails$H=fails$L,symbolConstructorDetection=!!Object.getOwnPropertySymbols&&!fails$H((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&V8_VERSION$3&&V8_VERSION$3<41})),NATIVE_SYMBOL$6=symbolConstructorDetection,useSymbolAsUid=NATIVE_SYMBOL$6&&!Symbol.sham&&"symbol"==_typeof$4(Symbol.iterator),getBuiltIn$b=getBuiltIn$d,isCallable$r=isCallable$u,isPrototypeOf$9=objectIsPrototypeOf,USE_SYMBOL_AS_UID$1=useSymbolAsUid,$Object$3=Object,isSymbol$6=USE_SYMBOL_AS_UID$1?function(e){return"symbol"==_typeof$4(e)}:function(e){var t=getBuiltIn$b("Symbol");return isCallable$r(t)&&isPrototypeOf$9(t.prototype,$Object$3(e))},$String$4=String,tryToString$7=function(e){try{return $String$4(e)}catch(t){return"Object"}},isCallable$q=isCallable$u,tryToString$6=tryToString$7,$TypeError$j=TypeError,aCallable$b=function(e){if(isCallable$q(e))return e;throw $TypeError$j(tryToString$6(e)+" is not a function")},aCallable$a=aCallable$b,isNullOrUndefined$5=isNullOrUndefined$7,getMethod$6=function(e,t){var r=e[t];return isNullOrUndefined$5(r)?void 0:aCallable$a(r)},call$s=functionCall,isCallable$p=isCallable$u,isObject$m=isObject$n,$TypeError$i=TypeError,ordinaryToPrimitive$1=function(e,t){var r,n;if("string"===t&&isCallable$p(r=e.toString)&&!isObject$m(n=call$s(r,e)))return n;if(isCallable$p(r=e.valueOf)&&!isObject$m(n=call$s(r,e)))return n;if("string"!==t&&isCallable$p(r=e.toString)&&!isObject$m(n=call$s(r,e)))return n;throw $TypeError$i("Can't convert object to primitive value")},shared$7={exports:{}},isPure=!1,global$E=global$H,defineProperty$d=Object.defineProperty,defineGlobalProperty$3=function(e,t){try{defineProperty$d(global$E,e,{value:t,configurable:!0,writable:!0})}catch(r){global$E[e]=t}return t},global$D=global$H,defineGlobalProperty$2=defineGlobalProperty$3,SHARED="__core-js_shared__",store$3=global$D[SHARED]||defineGlobalProperty$2(SHARED,{}),sharedStore=store$3,store$2=sharedStore;(shared$7.exports=function(e,t){return store$2[e]||(store$2[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.0/LICENSE",source:"https://github.com/zloirock/core-js"});var requireObjectCoercible$8=requireObjectCoercible$a,$Object$2=Object,toObject$h=function(e){return $Object$2(requireObjectCoercible$8(e))},uncurryThis$H=functionUncurryThis,toObject$g=toObject$h,hasOwnProperty$1=uncurryThis$H({}.hasOwnProperty),hasOwnProperty_1=Object.hasOwn||function(e,t){return hasOwnProperty$1(toObject$g(e),t)},uncurryThis$G=functionUncurryThis,id=0,postfix=Math.random(),toString$j=uncurryThis$G(1..toString),uid$4=function(e){return"Symbol("+(void 0===e?"":e)+")_"+toString$j(++id+postfix,36)},global$C=global$H,shared$6=shared$7.exports,hasOwn$m=hasOwnProperty_1,uid$3=uid$4,NATIVE_SYMBOL$5=symbolConstructorDetection,USE_SYMBOL_AS_UID=useSymbolAsUid,WellKnownSymbolsStore$1=shared$6("wks"),_Symbol$1=global$C.Symbol,symbolFor=_Symbol$1&&_Symbol$1.for,createWellKnownSymbol=USE_SYMBOL_AS_UID?_Symbol$1:_Symbol$1&&_Symbol$1.withoutSetter||uid$3,wellKnownSymbol$u=function(e){if(!hasOwn$m(WellKnownSymbolsStore$1,e)||!NATIVE_SYMBOL$5&&"string"!=typeof WellKnownSymbolsStore$1[e]){var t="Symbol."+e;NATIVE_SYMBOL$5&&hasOwn$m(_Symbol$1,e)?WellKnownSymbolsStore$1[e]=_Symbol$1[e]:WellKnownSymbolsStore$1[e]=USE_SYMBOL_AS_UID&&symbolFor?symbolFor(t):createWellKnownSymbol(t)}return WellKnownSymbolsStore$1[e]},call$r=functionCall,isObject$l=isObject$n,isSymbol$5=isSymbol$6,getMethod$5=getMethod$6,ordinaryToPrimitive=ordinaryToPrimitive$1,wellKnownSymbol$t=wellKnownSymbol$u,$TypeError$h=TypeError,TO_PRIMITIVE=wellKnownSymbol$t("toPrimitive"),toPrimitive$3=function(e,t){if(!isObject$l(e)||isSymbol$5(e))return e;var r,n=getMethod$5(e,TO_PRIMITIVE);if(n){if(void 0===t&&(t="default"),r=call$r(n,e,t),!isObject$l(r)||isSymbol$5(r))return r;throw $TypeError$h("Can't convert object to primitive value")}return void 0===t&&(t="number"),ordinaryToPrimitive(e,t)},toPrimitive$2=toPrimitive$3,isSymbol$4=isSymbol$6,toPropertyKey$5=function(e){var t=toPrimitive$2(e,"string");return isSymbol$4(t)?t:t+""},global$B=global$H,isObject$k=isObject$n,document$3=global$B.document,EXISTS$1=isObject$k(document$3)&&isObject$k(document$3.createElement),documentCreateElement$2=function(e){return EXISTS$1?document$3.createElement(e):{}},DESCRIPTORS$n=descriptors,fails$G=fails$L,createElement$1=documentCreateElement$2,ie8DomDefine=!DESCRIPTORS$n&&!fails$G((function(){return 7!=Object.defineProperty(createElement$1("div"),"a",{get:function(){return 7}}).a})),DESCRIPTORS$m=descriptors,call$q=functionCall,propertyIsEnumerableModule$2=objectPropertyIsEnumerable,createPropertyDescriptor$6=createPropertyDescriptor$7,toIndexedObject$b=toIndexedObject$c,toPropertyKey$4=toPropertyKey$5,hasOwn$l=hasOwnProperty_1,IE8_DOM_DEFINE$1=ie8DomDefine,$getOwnPropertyDescriptor$2=Object.getOwnPropertyDescriptor;objectGetOwnPropertyDescriptor.f=DESCRIPTORS$m?$getOwnPropertyDescriptor$2:function(e,t){if(e=toIndexedObject$b(e),t=toPropertyKey$4(t),IE8_DOM_DEFINE$1)try{return $getOwnPropertyDescriptor$2(e,t)}catch(r){}if(hasOwn$l(e,t))return createPropertyDescriptor$6(!call$q(propertyIsEnumerableModule$2.f,e,t),e[t])};var objectDefineProperty={},DESCRIPTORS$l=descriptors,fails$F=fails$L,v8PrototypeDefineBug=DESCRIPTORS$l&&fails$F((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),isObject$j=isObject$n,$String$3=String,$TypeError$g=TypeError,anObject$l=function(e){if(isObject$j(e))return e;throw $TypeError$g($String$3(e)+" is not an object")},DESCRIPTORS$k=descriptors,IE8_DOM_DEFINE=ie8DomDefine,V8_PROTOTYPE_DEFINE_BUG$1=v8PrototypeDefineBug,anObject$k=anObject$l,toPropertyKey$3=toPropertyKey$5,$TypeError$f=TypeError,$defineProperty$1=Object.defineProperty,$getOwnPropertyDescriptor$1=Object.getOwnPropertyDescriptor,ENUMERABLE="enumerable",CONFIGURABLE$1="configurable",WRITABLE="writable";objectDefineProperty.f=DESCRIPTORS$k?V8_PROTOTYPE_DEFINE_BUG$1?function(e,t,r){if(anObject$k(e),t=toPropertyKey$3(t),anObject$k(r),"function"==typeof e&&"prototype"===t&&"value"in r&&WRITABLE in r&&!r[WRITABLE]){var n=$getOwnPropertyDescriptor$1(e,t);n&&n[WRITABLE]&&(e[t]=r.value,r={configurable:CONFIGURABLE$1 in r?r[CONFIGURABLE$1]:n[CONFIGURABLE$1],enumerable:ENUMERABLE in r?r[ENUMERABLE]:n[ENUMERABLE],writable:!1})}return $defineProperty$1(e,t,r)}:$defineProperty$1:function(e,t,r){if(anObject$k(e),t=toPropertyKey$3(t),anObject$k(r),IE8_DOM_DEFINE)try{return $defineProperty$1(e,t,r)}catch(n){}if("get"in r||"set"in r)throw $TypeError$f("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var DESCRIPTORS$j=descriptors,definePropertyModule$7=objectDefineProperty,createPropertyDescriptor$5=createPropertyDescriptor$7,createNonEnumerableProperty$a=DESCRIPTORS$j?function(e,t,r){return definePropertyModule$7.f(e,t,createPropertyDescriptor$5(1,r))}:function(e,t,r){return e[t]=r,e},makeBuiltIn$3={exports:{}},DESCRIPTORS$i=descriptors,hasOwn$k=hasOwnProperty_1,FunctionPrototype$2=Function.prototype,getDescriptor=DESCRIPTORS$i&&Object.getOwnPropertyDescriptor,EXISTS=hasOwn$k(FunctionPrototype$2,"name"),PROPER=EXISTS&&"something"===function(){}.name,CONFIGURABLE=EXISTS&&(!DESCRIPTORS$i||DESCRIPTORS$i&&getDescriptor(FunctionPrototype$2,"name").configurable),functionName={EXISTS:EXISTS,PROPER:PROPER,CONFIGURABLE:CONFIGURABLE},uncurryThis$F=functionUncurryThis,isCallable$o=isCallable$u,store$1=sharedStore,functionToString$1=uncurryThis$F(Function.toString);isCallable$o(store$1.inspectSource)||(store$1.inspectSource=function(e){return functionToString$1(e)});var inspectSource$3=store$1.inspectSource,global$A=global$H,isCallable$n=isCallable$u,WeakMap$1=global$A.WeakMap,weakMapBasicDetection=isCallable$n(WeakMap$1)&&/native code/.test(String(WeakMap$1)),shared$5=shared$7.exports,uid$2=uid$4,keys$3=shared$5("keys"),sharedKey$4=function(e){return keys$3[e]||(keys$3[e]=uid$2(e))},hiddenKeys$5={},NATIVE_WEAK_MAP=weakMapBasicDetection,global$z=global$H,isObject$i=isObject$n,createNonEnumerableProperty$9=createNonEnumerableProperty$a,hasOwn$j=hasOwnProperty_1,shared$4=sharedStore,sharedKey$3=sharedKey$4,hiddenKeys$4=hiddenKeys$5,OBJECT_ALREADY_INITIALIZED="Object already initialized",TypeError$7=global$z.TypeError,WeakMap=global$z.WeakMap,set$2,get$1,has,enforce=function(e){return has(e)?get$1(e):set$2(e,{})},getterFor=function(e){return function(t){var r;if(!isObject$i(t)||(r=get$1(t)).type!==e)throw TypeError$7("Incompatible receiver, "+e+" required");return r}};if(NATIVE_WEAK_MAP||shared$4.state){var store=shared$4.state||(shared$4.state=new WeakMap);store.get=store.get,store.has=store.has,store.set=store.set,set$2=function(e,t){if(store.has(e))throw TypeError$7(OBJECT_ALREADY_INITIALIZED);return t.facade=e,store.set(e,t),t},get$1=function(e){return store.get(e)||{}},has=function(e){return store.has(e)}}else{var STATE=sharedKey$3("state");hiddenKeys$4[STATE]=!0,set$2=function(e,t){if(hasOwn$j(e,STATE))throw TypeError$7(OBJECT_ALREADY_INITIALIZED);return t.facade=e,createNonEnumerableProperty$9(e,STATE,t),t},get$1=function(e){return hasOwn$j(e,STATE)?e[STATE]:{}},has=function(e){return hasOwn$j(e,STATE)}}var internalState={set:set$2,get:get$1,has:has,enforce:enforce,getterFor:getterFor},fails$E=fails$L,isCallable$m=isCallable$u,hasOwn$i=hasOwnProperty_1,DESCRIPTORS$h=descriptors,CONFIGURABLE_FUNCTION_NAME$2=functionName.CONFIGURABLE,inspectSource$2=inspectSource$3,InternalStateModule$9=internalState,enforceInternalState$3=InternalStateModule$9.enforce,getInternalState$8=InternalStateModule$9.get,defineProperty$c=Object.defineProperty,CONFIGURABLE_LENGTH=DESCRIPTORS$h&&!fails$E((function(){return 8!==defineProperty$c((function(){}),"length",{value:8}).length})),TEMPLATE=String(String).split("String"),makeBuiltIn$2=makeBuiltIn$3.exports=function(e,t,r){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!hasOwn$i(e,"name")||CONFIGURABLE_FUNCTION_NAME$2&&e.name!==t)&&(DESCRIPTORS$h?defineProperty$c(e,"name",{value:t,configurable:!0}):e.name=t),CONFIGURABLE_LENGTH&&r&&hasOwn$i(r,"arity")&&e.length!==r.arity&&defineProperty$c(e,"length",{value:r.arity});try{r&&hasOwn$i(r,"constructor")&&r.constructor?DESCRIPTORS$h&&defineProperty$c(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(i){}var n=enforceInternalState$3(e);return hasOwn$i(n,"source")||(n.source=TEMPLATE.join("string"==typeof t?t:"")),e};Function.prototype.toString=makeBuiltIn$2((function(){return isCallable$m(this)&&getInternalState$8(this).source||inspectSource$2(this)}),"toString");var isCallable$l=isCallable$u,definePropertyModule$6=objectDefineProperty,makeBuiltIn$1=makeBuiltIn$3.exports,defineGlobalProperty$1=defineGlobalProperty$3,defineBuiltIn$i=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(isCallable$l(r)&&makeBuiltIn$1(r,o,n),n.global)i?e[t]=r:defineGlobalProperty$1(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(a){}i?e[t]=r:definePropertyModule$6.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},objectGetOwnPropertyNames={},ceil=Math.ceil,floor$8=Math.floor,mathTrunc=Math.trunc||function(e){var t=+e;return(t>0?floor$8:ceil)(t)},trunc=mathTrunc,toIntegerOrInfinity$d=function(e){var t=+e;return t!=t||0===t?0:trunc(t)},toIntegerOrInfinity$c=toIntegerOrInfinity$d,max$4=Math.max,min$6=Math.min,toAbsoluteIndex$7=function(e,t){var r=toIntegerOrInfinity$c(e);return r<0?max$4(r+t,0):min$6(r,t)},toIntegerOrInfinity$b=toIntegerOrInfinity$d,min$5=Math.min,toLength$8=function(e){return e>0?min$5(toIntegerOrInfinity$b(e),9007199254740991):0},toLength$7=toLength$8,lengthOfArrayLike$i=function(e){return toLength$7(e.length)},toIndexedObject$a=toIndexedObject$c,toAbsoluteIndex$6=toAbsoluteIndex$7,lengthOfArrayLike$h=lengthOfArrayLike$i,createMethod$6=function(e){return function(t,r,n){var i,o=toIndexedObject$a(t),a=lengthOfArrayLike$h(o),s=toAbsoluteIndex$6(n,a);if(e&&r!=r){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},arrayIncludes={includes:createMethod$6(!0),indexOf:createMethod$6(!1)},uncurryThis$E=functionUncurryThis,hasOwn$h=hasOwnProperty_1,toIndexedObject$9=toIndexedObject$c,indexOf$1=arrayIncludes.indexOf,hiddenKeys$3=hiddenKeys$5,push$a=uncurryThis$E([].push),objectKeysInternal=function(e,t){var r,n=toIndexedObject$9(e),i=0,o=[];for(r in n)!hasOwn$h(hiddenKeys$3,r)&&hasOwn$h(n,r)&&push$a(o,r);for(;t.length>i;)hasOwn$h(n,r=t[i++])&&(~indexOf$1(o,r)||push$a(o,r));return o},enumBugKeys$3=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],internalObjectKeys$1=objectKeysInternal,enumBugKeys$2=enumBugKeys$3,hiddenKeys$2=enumBugKeys$2.concat("length","prototype");objectGetOwnPropertyNames.f=Object.getOwnPropertyNames||function(e){return internalObjectKeys$1(e,hiddenKeys$2)};var objectGetOwnPropertySymbols={};objectGetOwnPropertySymbols.f=Object.getOwnPropertySymbols;var getBuiltIn$a=getBuiltIn$d,uncurryThis$D=functionUncurryThis,getOwnPropertyNamesModule$1=objectGetOwnPropertyNames,getOwnPropertySymbolsModule$3=objectGetOwnPropertySymbols,anObject$j=anObject$l,concat$3=uncurryThis$D([].concat),ownKeys$5=getBuiltIn$a("Reflect","ownKeys")||function(e){var t=getOwnPropertyNamesModule$1.f(anObject$j(e)),r=getOwnPropertySymbolsModule$3.f;return r?concat$3(t,r(e)):t},hasOwn$g=hasOwnProperty_1,ownKeys$4=ownKeys$5,getOwnPropertyDescriptorModule$2=objectGetOwnPropertyDescriptor,definePropertyModule$5=objectDefineProperty,copyConstructorProperties$2=function(e,t,r){for(var n=ownKeys$4(t),i=definePropertyModule$5.f,o=getOwnPropertyDescriptorModule$2.f,a=0;a<n.length;a++){var s=n[a];hasOwn$g(e,s)||r&&hasOwn$g(r,s)||i(e,s,o(t,s))}},fails$D=fails$L,isCallable$k=isCallable$u,replacement=/#|\.prototype\./,isForced$4=function(e,t){var r=data[normalize(e)];return r==POLYFILL||r!=NATIVE&&(isCallable$k(t)?fails$D(t):!!t)},normalize=isForced$4.normalize=function(e){return String(e).replace(replacement,".").toLowerCase()},data=isForced$4.data={},NATIVE=isForced$4.NATIVE="N",POLYFILL=isForced$4.POLYFILL="P",isForced_1=isForced$4,global$y=global$H,getOwnPropertyDescriptor$4=objectGetOwnPropertyDescriptor.f,createNonEnumerableProperty$8=createNonEnumerableProperty$a,defineBuiltIn$h=defineBuiltIn$i,defineGlobalProperty=defineGlobalProperty$3,copyConstructorProperties$1=copyConstructorProperties$2,isForced$3=isForced_1,_export=function(e,t){var r,n,i,o,a,s=e.target,l=e.global,c=e.stat;if(r=l?global$y:c?global$y[s]||defineGlobalProperty(s,{}):(global$y[s]||{}).prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(a=getOwnPropertyDescriptor$4(r,n))&&a.value:r[n],!isForced$3(l?n:s+(c?".":"#")+n,e.forced)&&void 0!==i){if(_typeof$4(o)==_typeof$4(i))continue;copyConstructorProperties$1(o,i)}(e.sham||i&&i.sham)&&createNonEnumerableProperty$8(o,"sham",!0),defineBuiltIn$h(r,n,o,e)}},uncurryThis$C=functionUncurryThis,aCallable$9=aCallable$b,NATIVE_BIND$2=functionBindNative,bind$c=uncurryThis$C(uncurryThis$C.bind),functionBindContext=function(e,t){return aCallable$9(e),void 0===t?e:NATIVE_BIND$2?bind$c(e,t):function(){return e.apply(t,arguments)}},classof$f=classofRaw$2,isArray$5=Array.isArray||function(e){return"Array"==classof$f(e)},wellKnownSymbol$s=wellKnownSymbol$u,TO_STRING_TAG$4=wellKnownSymbol$s("toStringTag"),test$1={};test$1[TO_STRING_TAG$4]="z";var toStringTagSupport="[object z]"===String(test$1),TO_STRING_TAG_SUPPORT$2=toStringTagSupport,isCallable$j=isCallable$u,classofRaw=classofRaw$2,wellKnownSymbol$r=wellKnownSymbol$u,TO_STRING_TAG$3=wellKnownSymbol$r("toStringTag"),$Object$1=Object,CORRECT_ARGUMENTS="Arguments"==classofRaw(function(){return arguments}()),tryGet=function(e,t){try{return e[t]}catch(r){}},classof$e=TO_STRING_TAG_SUPPORT$2?classofRaw:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=tryGet(t=$Object$1(e),TO_STRING_TAG$3))?r:CORRECT_ARGUMENTS?classofRaw(t):"Object"==(n=classofRaw(t))&&isCallable$j(t.callee)?"Arguments":n},uncurryThis$B=functionUncurryThis,fails$C=fails$L,isCallable$i=isCallable$u,classof$d=classof$e,getBuiltIn$9=getBuiltIn$d,inspectSource$1=inspectSource$3,noop=function(){},empty=[],construct$1=getBuiltIn$9("Reflect","construct"),constructorRegExp=/^\s*(?:class|function)\b/,exec$6=uncurryThis$B(constructorRegExp.exec),INCORRECT_TO_STRING=!constructorRegExp.exec(noop),isConstructorModern=function(e){if(!isCallable$i(e))return!1;try{return construct$1(noop,empty,e),!0}catch(t){return!1}},isConstructorLegacy=function(e){if(!isCallable$i(e))return!1;switch(classof$d(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return INCORRECT_TO_STRING||!!exec$6(constructorRegExp,inspectSource$1(e))}catch(t){return!0}};isConstructorLegacy.sham=!0;var isConstructor$4=!construct$1||fails$C((function(){var e;return isConstructorModern(isConstructorModern.call)||!isConstructorModern(Object)||!isConstructorModern((function(){e=!0}))||e}))?isConstructorLegacy:isConstructorModern,isArray$4=isArray$5,isConstructor$3=isConstructor$4,isObject$h=isObject$n,wellKnownSymbol$q=wellKnownSymbol$u,SPECIES$6=wellKnownSymbol$q("species"),$Array$4=Array,arraySpeciesConstructor$1=function(e){var t;return isArray$4(e)&&(t=e.constructor,(isConstructor$3(t)&&(t===$Array$4||isArray$4(t.prototype))||isObject$h(t)&&null===(t=t[SPECIES$6]))&&(t=void 0)),void 0===t?$Array$4:t},arraySpeciesConstructor=arraySpeciesConstructor$1,arraySpeciesCreate$3=function(e,t){return new(arraySpeciesConstructor(e))(0===t?0:t)},bind$b=functionBindContext,uncurryThis$A=functionUncurryThis,IndexedObject$4=indexedObject,toObject$f=toObject$h,lengthOfArrayLike$g=lengthOfArrayLike$i,arraySpeciesCreate$2=arraySpeciesCreate$3,push$9=uncurryThis$A([].push),createMethod$5=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(l,c,u,h){for(var d,p,f=toObject$f(l),g=IndexedObject$4(f),y=bind$b(c,u),v=lengthOfArrayLike$g(g),m=0,_=h||arraySpeciesCreate$2,b=t?_(l,v):r||a?_(l,0):void 0;v>m;m++)if((s||m in g)&&(p=y(d=g[m],m,f),e))if(t)b[m]=p;else if(p)switch(e){case 3:return!0;case 5:return d;case 6:return m;case 2:push$9(b,d)}else switch(e){case 4:return!1;case 7:push$9(b,d)}return o?-1:n||i?i:b}},arrayIteration={forEach:createMethod$5(0),map:createMethod$5(1),filter:createMethod$5(2),some:createMethod$5(3),every:createMethod$5(4),find:createMethod$5(5),findIndex:createMethod$5(6),filterReject:createMethod$5(7)},objectDefineProperties={},internalObjectKeys=objectKeysInternal,enumBugKeys$1=enumBugKeys$3,objectKeys$4=Object.keys||function(e){return internalObjectKeys(e,enumBugKeys$1)},DESCRIPTORS$g=descriptors,V8_PROTOTYPE_DEFINE_BUG=v8PrototypeDefineBug,definePropertyModule$4=objectDefineProperty,anObject$i=anObject$l,toIndexedObject$8=toIndexedObject$c,objectKeys$3=objectKeys$4;objectDefineProperties.f=DESCRIPTORS$g&&!V8_PROTOTYPE_DEFINE_BUG?Object.defineProperties:function(e,t){anObject$i(e);for(var r,n=toIndexedObject$8(t),i=objectKeys$3(t),o=i.length,a=0;o>a;)definePropertyModule$4.f(e,r=i[a++],n[r]);return e};var getBuiltIn$8=getBuiltIn$d,html$2=getBuiltIn$8("document","documentElement"),anObject$h=anObject$l,definePropertiesModule$1=objectDefineProperties,enumBugKeys=enumBugKeys$3,hiddenKeys$1=hiddenKeys$5,html$1=html$2,documentCreateElement$1=documentCreateElement$2,sharedKey$2=sharedKey$4,GT=">",LT="<",PROTOTYPE$2="prototype",SCRIPT="script",IE_PROTO$1=sharedKey$2("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(e){return LT+SCRIPT+GT+e+LT+"/"+SCRIPT+GT},NullProtoObjectViaActiveX=function(e){e.write(scriptTag("")),e.close();var t=e.parentWindow.Object;return e=null,t},NullProtoObjectViaIFrame=function(){var e,t=documentCreateElement$1("iframe"),r="java"+SCRIPT+":";return t.style.display="none",html$1.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(scriptTag("document.F=Object")),e.close(),e.F},activeXDocument,_NullProtoObject=function(){try{activeXDocument=new ActiveXObject("htmlfile")}catch(t){}_NullProtoObject="undefined"!=typeof document?document.domain&&activeXDocument?NullProtoObjectViaActiveX(activeXDocument):NullProtoObjectViaIFrame():NullProtoObjectViaActiveX(activeXDocument);for(var e=enumBugKeys.length;e--;)delete _NullProtoObject[PROTOTYPE$2][enumBugKeys[e]];return _NullProtoObject()};hiddenKeys$1[IE_PROTO$1]=!0;var objectCreate=Object.create||function(e,t){var r;return null!==e?(EmptyConstructor[PROTOTYPE$2]=anObject$h(e),r=new EmptyConstructor,EmptyConstructor[PROTOTYPE$2]=null,r[IE_PROTO$1]=e):r=_NullProtoObject(),void 0===t?r:definePropertiesModule$1.f(r,t)},wellKnownSymbol$p=wellKnownSymbol$u,create$5=objectCreate,defineProperty$b=objectDefineProperty.f,UNSCOPABLES=wellKnownSymbol$p("unscopables"),ArrayPrototype$1=Array.prototype;null==ArrayPrototype$1[UNSCOPABLES]&&defineProperty$b(ArrayPrototype$1,UNSCOPABLES,{configurable:!0,value:create$5(null)});var addToUnscopables$4=function(e){ArrayPrototype$1[UNSCOPABLES][e]=!0},$$G=_export,$find$1=arrayIteration.find,addToUnscopables$3=addToUnscopables$4,FIND="find",SKIPS_HOLES$1=!0;FIND in[]&&Array(1)[FIND]((function(){SKIPS_HOLES$1=!1})),$$G({target:"Array",proto:!0,forced:SKIPS_HOLES$1},{find:function(e){return $find$1(this,e,arguments.length>1?arguments[1]:void 0)}}),addToUnscopables$3(FIND);var es_object_toString={},TO_STRING_TAG_SUPPORT$1=toStringTagSupport,classof$c=classof$e,objectToString=TO_STRING_TAG_SUPPORT$1?{}.toString:function(){return"[object "+classof$c(this)+"]"},TO_STRING_TAG_SUPPORT=toStringTagSupport,defineBuiltIn$g=defineBuiltIn$i,toString$i=objectToString;TO_STRING_TAG_SUPPORT||defineBuiltIn$g(Object.prototype,"toString",toString$i,{unsafe:!0});var es_array_concat={},$TypeError$e=TypeError,MAX_SAFE_INTEGER=9007199254740991,doesNotExceedSafeInteger$2=function(e){if(e>MAX_SAFE_INTEGER)throw $TypeError$e("Maximum allowed index exceeded");return e},toPropertyKey$2=toPropertyKey$5,definePropertyModule$3=objectDefineProperty,createPropertyDescriptor$4=createPropertyDescriptor$7,createProperty$5=function(e,t,r){var n=toPropertyKey$2(t);n in e?definePropertyModule$3.f(e,n,createPropertyDescriptor$4(0,r)):e[n]=r},fails$B=fails$L,wellKnownSymbol$o=wellKnownSymbol$u,V8_VERSION$2=engineV8Version,SPECIES$5=wellKnownSymbol$o("species"),arrayMethodHasSpeciesSupport$5=function(e){return V8_VERSION$2>=51||!fails$B((function(){var t=[];return(t.constructor={})[SPECIES$5]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},$$F=_export,fails$A=fails$L,isArray$3=isArray$5,isObject$g=isObject$n,toObject$e=toObject$h,lengthOfArrayLike$f=lengthOfArrayLike$i,doesNotExceedSafeInteger$1=doesNotExceedSafeInteger$2,createProperty$4=createProperty$5,arraySpeciesCreate$1=arraySpeciesCreate$3,arrayMethodHasSpeciesSupport$4=arrayMethodHasSpeciesSupport$5,wellKnownSymbol$n=wellKnownSymbol$u,V8_VERSION$1=engineV8Version,IS_CONCAT_SPREADABLE=wellKnownSymbol$n("isConcatSpreadable"),IS_CONCAT_SPREADABLE_SUPPORT=V8_VERSION$1>=51||!fails$A((function(){var e=[];return e[IS_CONCAT_SPREADABLE]=!1,e.concat()[0]!==e})),SPECIES_SUPPORT=arrayMethodHasSpeciesSupport$4("concat"),isConcatSpreadable=function(e){if(!isObject$g(e))return!1;var t=e[IS_CONCAT_SPREADABLE];return void 0!==t?!!t:isArray$3(e)},FORCED$8=!IS_CONCAT_SPREADABLE_SUPPORT||!SPECIES_SUPPORT;$$F({target:"Array",proto:!0,arity:1,forced:FORCED$8},{concat:function(e){var t,r,n,i,o,a=toObject$e(this),s=arraySpeciesCreate$1(a,0),l=0;for(t=-1,n=arguments.length;t<n;t++)if(isConcatSpreadable(o=-1===t?a:arguments[t]))for(i=lengthOfArrayLike$f(o),doesNotExceedSafeInteger$1(l+i),r=0;r<i;r++,l++)r in o&&createProperty$4(s,l,o[r]);else doesNotExceedSafeInteger$1(l+1),createProperty$4(s,l++,o);return s.length=l,s}});var web_domCollections_forEach={},domIterables={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},documentCreateElement=documentCreateElement$2,classList=documentCreateElement("span").classList,DOMTokenListPrototype$2=classList&&classList.constructor&&classList.constructor.prototype,domTokenListPrototype=DOMTokenListPrototype$2===Object.prototype?void 0:DOMTokenListPrototype$2,fails$z=fails$L,arrayMethodIsStrict$4=function(e,t){var r=[][e];return!!r&&fails$z((function(){r.call(null,t||function(){return 1},1)}))},$forEach$2=arrayIteration.forEach,arrayMethodIsStrict$3=arrayMethodIsStrict$4,STRICT_METHOD$3=arrayMethodIsStrict$3("forEach"),arrayForEach=STRICT_METHOD$3?[].forEach:function(e){return $forEach$2(this,e,arguments.length>1?arguments[1]:void 0)},global$x=global$H,DOMIterables$1=domIterables,DOMTokenListPrototype$1=domTokenListPrototype,forEach$1=arrayForEach,createNonEnumerableProperty$7=createNonEnumerableProperty$a,handlePrototype$1=function(e){if(e&&e.forEach!==forEach$1)try{createNonEnumerableProperty$7(e,"forEach",forEach$1)}catch(t){e.forEach=forEach$1}};for(var COLLECTION_NAME$1 in DOMIterables$1)DOMIterables$1[COLLECTION_NAME$1]&&handlePrototype$1(global$x[COLLECTION_NAME$1]&&global$x[COLLECTION_NAME$1].prototype);handlePrototype$1(DOMTokenListPrototype$1);var es_object_keys={},$$E=_export,toObject$d=toObject$h,nativeKeys=objectKeys$4,fails$y=fails$L,FAILS_ON_PRIMITIVES$1=fails$y((function(){nativeKeys(1)}));$$E({target:"Object",stat:!0,forced:FAILS_ON_PRIMITIVES$1},{keys:function(e){return nativeKeys(toObject$d(e))}});var uncurryThis$z=functionUncurryThis,arraySlice$c=uncurryThis$z([].slice),$$D=_export,isArray$2=isArray$5,isConstructor$2=isConstructor$4,isObject$f=isObject$n,toAbsoluteIndex$5=toAbsoluteIndex$7,lengthOfArrayLike$e=lengthOfArrayLike$i,toIndexedObject$7=toIndexedObject$c,createProperty$3=createProperty$5,wellKnownSymbol$m=wellKnownSymbol$u,arrayMethodHasSpeciesSupport$3=arrayMethodHasSpeciesSupport$5,nativeSlice=arraySlice$c,HAS_SPECIES_SUPPORT$3=arrayMethodHasSpeciesSupport$3("slice"),SPECIES$4=wellKnownSymbol$m("species"),$Array$3=Array,max$3=Math.max;$$D({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$3},{slice:function(e,t){var r,n,i,o=toIndexedObject$7(this),a=lengthOfArrayLike$e(o),s=toAbsoluteIndex$5(e,a),l=toAbsoluteIndex$5(void 0===t?a:t,a);if(isArray$2(o)&&(r=o.constructor,(isConstructor$2(r)&&(r===$Array$3||isArray$2(r.prototype))||isObject$f(r)&&null===(r=r[SPECIES$4]))&&(r=void 0),r===$Array$3||void 0===r))return nativeSlice(o,s,l);for(n=new(void 0===r?$Array$3:r)(max$3(l-s,0)),i=0;s<l;s++,i++)s in o&&createProperty$3(n,i,o[s]);return n.length=i,n}});var es_regexp_exec={},classof$b=classof$e,$String$2=String,toString$h=function(e){if("Symbol"===classof$b(e))throw TypeError("Cannot convert a Symbol value to a string");return $String$2(e)},anObject$g=anObject$l,regexpFlags$1=function(){var e=anObject$g(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},fails$x=fails$L,global$w=global$H,$RegExp$2=global$w.RegExp,UNSUPPORTED_Y$3=fails$x((function(){var e=$RegExp$2("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),MISSED_STICKY$2=UNSUPPORTED_Y$3||fails$x((function(){return!$RegExp$2("a","y").sticky})),BROKEN_CARET=UNSUPPORTED_Y$3||fails$x((function(){var e=$RegExp$2("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),regexpStickyHelpers={BROKEN_CARET:BROKEN_CARET,MISSED_STICKY:MISSED_STICKY$2,UNSUPPORTED_Y:UNSUPPORTED_Y$3},fails$w=fails$L,global$v=global$H,$RegExp$1=global$v.RegExp,regexpUnsupportedDotAll=fails$w((function(){var e=$RegExp$1(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),fails$v=fails$L,global$u=global$H,$RegExp=global$u.RegExp,regexpUnsupportedNcg=fails$v((function(){var e=$RegExp("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),call$p=functionCall,uncurryThis$y=functionUncurryThis,toString$g=toString$h,regexpFlags=regexpFlags$1,stickyHelpers$2=regexpStickyHelpers,shared$3=shared$7.exports,create$4=objectCreate,getInternalState$7=internalState.get,UNSUPPORTED_DOT_ALL$1=regexpUnsupportedDotAll,UNSUPPORTED_NCG$1=regexpUnsupportedNcg,nativeReplace=shared$3("native-string-replace",String.prototype.replace),nativeExec=RegExp.prototype.exec,patchedExec=nativeExec,charAt$a=uncurryThis$y("".charAt),indexOf=uncurryThis$y("".indexOf),replace$8=uncurryThis$y("".replace),stringSlice$9=uncurryThis$y("".slice),UPDATES_LAST_INDEX_WRONG=(re12=/a/,re22=/b*/g,call$p(nativeExec,re12,"a"),call$p(nativeExec,re22,"a"),0!==re12.lastIndex||0!==re22.lastIndex),re12,re22,UNSUPPORTED_Y$2=stickyHelpers$2.BROKEN_CARET,NPCG_INCLUDED=void 0!==/()??/.exec("")[1],PATCH=UPDATES_LAST_INDEX_WRONG||NPCG_INCLUDED||UNSUPPORTED_Y$2||UNSUPPORTED_DOT_ALL$1||UNSUPPORTED_NCG$1;PATCH&&(patchedExec=function(e){var t,r,n,i,o,a,s,l=this,c=getInternalState$7(l),u=toString$g(e),h=c.raw;if(h)return h.lastIndex=l.lastIndex,t=call$p(patchedExec,h,u),l.lastIndex=h.lastIndex,t;var d=c.groups,p=UNSUPPORTED_Y$2&&l.sticky,f=call$p(regexpFlags,l),g=l.source,y=0,v=u;if(p&&(f=replace$8(f,"y",""),-1===indexOf(f,"g")&&(f+="g"),v=stringSlice$9(u,l.lastIndex),l.lastIndex>0&&(!l.multiline||l.multiline&&"\n"!==charAt$a(u,l.lastIndex-1))&&(g="(?: "+g+")",v=" "+v,y++),r=new RegExp("^(?:"+g+")",f)),NPCG_INCLUDED&&(r=new RegExp("^"+g+"$(?!\\s)",f)),UPDATES_LAST_INDEX_WRONG&&(n=l.lastIndex),i=call$p(nativeExec,p?r:l,v),p?i?(i.input=stringSlice$9(i.input,y),i[0]=stringSlice$9(i[0],y),i.index=l.lastIndex,l.lastIndex+=i[0].length):l.lastIndex=0:UPDATES_LAST_INDEX_WRONG&&i&&(l.lastIndex=l.global?i.index+i[0].length:n),NPCG_INCLUDED&&i&&i.length>1&&call$p(nativeReplace,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&d)for(i.groups=a=create$4(null),o=0;o<d.length;o++)a[(s=d[o])[0]]=i[s[1]];return i});var regexpExec$3=patchedExec,$$C=_export,exec$5=regexpExec$3;$$C({target:"RegExp",proto:!0,forced:/./.exec!==exec$5},{exec:exec$5});var $$B=_export,call$o=functionCall,isCallable$h=isCallable$u,anObject$f=anObject$l,toString$f=toString$h,DELEGATES_TO_EXEC=(execCalled=!1,re=/[ac]/,re.exec=function(){return execCalled=!0,/./.exec.apply(this,arguments)},!0===re.test("abc")&&execCalled),execCalled,re,nativeTest=/./.test;$$B({target:"RegExp",proto:!0,forced:!DELEGATES_TO_EXEC},{test:function(e){var t=anObject$f(this),r=toString$f(e),n=t.exec;if(!isCallable$h(n))return call$o(nativeTest,t,r);var i=call$o(n,t,r);return null!==i&&(anObject$f(i),!0)}});var es_array_join={},$$A=_export,uncurryThis$x=functionUncurryThis,IndexedObject$3=indexedObject,toIndexedObject$6=toIndexedObject$c,arrayMethodIsStrict$2=arrayMethodIsStrict$4,nativeJoin=uncurryThis$x([].join),ES3_STRINGS=IndexedObject$3!=Object,STRICT_METHOD$2=arrayMethodIsStrict$2("join",",");$$A({target:"Array",proto:!0,forced:ES3_STRINGS||!STRICT_METHOD$2},{join:function(e){return nativeJoin(toIndexedObject$6(this),void 0===e?",":e)}});var es_array_splice={},DESCRIPTORS$f=descriptors,isArray$1=isArray$5,$TypeError$d=TypeError,getOwnPropertyDescriptor$3=Object.getOwnPropertyDescriptor,SILENT_ON_NON_WRITABLE_LENGTH_SET=DESCRIPTORS$f&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}(),arraySetLength=SILENT_ON_NON_WRITABLE_LENGTH_SET?function(e,t){if(isArray$1(e)&&!getOwnPropertyDescriptor$3(e,"length").writable)throw $TypeError$d("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},tryToString$5=tryToString$7,$TypeError$c=TypeError,deletePropertyOrThrow$3=function(e,t){if(!delete e[t])throw $TypeError$c("Cannot delete property "+tryToString$5(t)+" of "+tryToString$5(e))},$$z=_export,toObject$c=toObject$h,toAbsoluteIndex$4=toAbsoluteIndex$7,toIntegerOrInfinity$a=toIntegerOrInfinity$d,lengthOfArrayLike$d=lengthOfArrayLike$i,setArrayLength=arraySetLength,doesNotExceedSafeInteger=doesNotExceedSafeInteger$2,arraySpeciesCreate=arraySpeciesCreate$3,createProperty$2=createProperty$5,deletePropertyOrThrow$2=deletePropertyOrThrow$3,arrayMethodHasSpeciesSupport$2=arrayMethodHasSpeciesSupport$5,HAS_SPECIES_SUPPORT$2=arrayMethodHasSpeciesSupport$2("splice"),max$2=Math.max,min$4=Math.min;$$z({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$2},{splice:function(e,t){var r,n,i,o,a,s,l=toObject$c(this),c=lengthOfArrayLike$d(l),u=toAbsoluteIndex$4(e,c),h=arguments.length;for(0===h?r=n=0:1===h?(r=0,n=c-u):(r=h-2,n=min$4(max$2(toIntegerOrInfinity$a(t),0),c-u)),doesNotExceedSafeInteger(c+r-n),i=arraySpeciesCreate(l,n),o=0;o<n;o++)(a=u+o)in l&&createProperty$2(i,o,l[a]);if(i.length=n,r<n){for(o=u;o<c-n;o++)s=o+r,(a=o+n)in l?l[s]=l[a]:deletePropertyOrThrow$2(l,s);for(o=c;o>c-n+r;o--)deletePropertyOrThrow$2(l,o-1)}else if(r>n)for(o=c-n;o>u;o--)s=o+r-1,(a=o+n-1)in l?l[s]=l[a]:deletePropertyOrThrow$2(l,s);for(o=0;o<r;o++)l[o+u]=arguments[o+2];return setArrayLength(l,c-n+r),i}});var es_promise={},classof$a=classofRaw$2,global$t=global$H,engineIsNode="process"==classof$a(global$t.process),isCallable$g=isCallable$u,$String$1=String,$TypeError$b=TypeError,aPossiblePrototype$1=function(e){if("object"==_typeof$4(e)||isCallable$g(e))return e;throw $TypeError$b("Can't set "+$String$1(e)+" as a prototype")},uncurryThis$w=functionUncurryThis,anObject$e=anObject$l,aPossiblePrototype=aPossiblePrototype$1,objectSetPrototypeOf=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=uncurryThis$w(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return anObject$e(r),aPossiblePrototype(n),t?e(r,n):r.__proto__=n,r}}():void 0),defineProperty$a=objectDefineProperty.f,hasOwn$f=hasOwnProperty_1,wellKnownSymbol$l=wellKnownSymbol$u,TO_STRING_TAG$2=wellKnownSymbol$l("toStringTag"),setToStringTag$7=function(e,t,r){e&&!r&&(e=e.prototype),e&&!hasOwn$f(e,TO_STRING_TAG$2)&&defineProperty$a(e,TO_STRING_TAG$2,{configurable:!0,value:t})},getBuiltIn$7=getBuiltIn$d,definePropertyModule$2=objectDefineProperty,wellKnownSymbol$k=wellKnownSymbol$u,DESCRIPTORS$e=descriptors,SPECIES$3=wellKnownSymbol$k("species"),setSpecies$3=function(e){var t=getBuiltIn$7(e),r=definePropertyModule$2.f;DESCRIPTORS$e&&t&&!t[SPECIES$3]&&r(t,SPECIES$3,{configurable:!0,get:function(){return this}})},isPrototypeOf$8=objectIsPrototypeOf,$TypeError$a=TypeError,anInstance$5=function(e,t){if(isPrototypeOf$8(t,e))return e;throw $TypeError$a("Incorrect invocation")},isConstructor$1=isConstructor$4,tryToString$4=tryToString$7,$TypeError$9=TypeError,aConstructor$3=function(e){if(isConstructor$1(e))return e;throw $TypeError$9(tryToString$4(e)+" is not a constructor")},anObject$d=anObject$l,aConstructor$2=aConstructor$3,isNullOrUndefined$4=isNullOrUndefined$7,wellKnownSymbol$j=wellKnownSymbol$u,SPECIES$2=wellKnownSymbol$j("species"),speciesConstructor$4=function(e,t){var r,n=anObject$d(e).constructor;return void 0===n||isNullOrUndefined$4(r=anObject$d(n)[SPECIES$2])?t:aConstructor$2(r)},NATIVE_BIND$1=functionBindNative,FunctionPrototype$1=Function.prototype,apply$a=FunctionPrototype$1.apply,call$n=FunctionPrototype$1.call,functionApply="object"==("undefined"==typeof Reflect?"undefined":_typeof$4(Reflect))&&Reflect.apply||(NATIVE_BIND$1?call$n.bind(apply$a):function(){return call$n.apply(apply$a,arguments)}),$TypeError$8=TypeError,validateArgumentsLength$4=function(e,t){if(e<t)throw $TypeError$8("Not enough arguments");return e},userAgent$5=engineUserAgent,engineIsIos=/(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$5),global$s=global$H,apply$9=functionApply,bind$a=functionBindContext,isCallable$f=isCallable$u,hasOwn$e=hasOwnProperty_1,fails$u=fails$L,html=html$2,arraySlice$b=arraySlice$c,createElement=documentCreateElement$2,validateArgumentsLength$3=validateArgumentsLength$4,IS_IOS$1=engineIsIos,IS_NODE$3=engineIsNode,set$1=global$s.setImmediate,clear$1=global$s.clearImmediate,process$2=global$s.process,Dispatch=global$s.Dispatch,Function$2=global$s.Function,MessageChannel=global$s.MessageChannel,String$1=global$s.String,counter=0,queue$1={},ONREADYSTATECHANGE="onreadystatechange",$location,defer,channel,port;try{$location=global$s.location}catch(error){}var run=function(e){if(hasOwn$e(queue$1,e)){var t=queue$1[e];delete queue$1[e],t()}},runner=function(e){return function(){run(e)}},listener$1=function(e){run(e.data)},post=function(e){global$s.postMessage(String$1(e),$location.protocol+"//"+$location.host)};set$1&&clear$1||(set$1=function(e){validateArgumentsLength$3(arguments.length,1);var t=isCallable$f(e)?e:Function$2(e),r=arraySlice$b(arguments,1);return queue$1[++counter]=function(){apply$9(t,void 0,r)},defer(counter),counter},clear$1=function(e){delete queue$1[e]},IS_NODE$3?defer=function(e){process$2.nextTick(runner(e))}:Dispatch&&Dispatch.now?defer=function(e){Dispatch.now(runner(e))}:MessageChannel&&!IS_IOS$1?(channel=new MessageChannel,port=channel.port2,channel.port1.onmessage=listener$1,defer=bind$a(port.postMessage,port)):global$s.addEventListener&&isCallable$f(global$s.postMessage)&&!global$s.importScripts&&$location&&"file:"!==$location.protocol&&!fails$u(post)?(defer=post,global$s.addEventListener("message",listener$1,!1)):defer=ONREADYSTATECHANGE in createElement("script")?function(e){html.appendChild(createElement("script"))[ONREADYSTATECHANGE]=function(){html.removeChild(this),run(e)}}:function(e){setTimeout(runner(e),0)});var task$1={set:set$1,clear:clear$1},userAgent$4=engineUserAgent,global$r=global$H,engineIsIosPebble=/ipad|iphone|ipod/i.test(userAgent$4)&&void 0!==global$r.Pebble,userAgent$3=engineUserAgent,engineIsWebosWebkit=/web0s(?!.*chrome)/i.test(userAgent$3),global$q=global$H,bind$9=functionBindContext,getOwnPropertyDescriptor$2=objectGetOwnPropertyDescriptor.f,macrotask=task$1.set,IS_IOS=engineIsIos,IS_IOS_PEBBLE=engineIsIosPebble,IS_WEBOS_WEBKIT=engineIsWebosWebkit,IS_NODE$2=engineIsNode,MutationObserver$1=global$q.MutationObserver||global$q.WebKitMutationObserver,document$2=global$q.document,process$1=global$q.process,Promise$1=global$q.Promise,queueMicrotaskDescriptor=getOwnPropertyDescriptor$2(global$q,"queueMicrotask"),queueMicrotask=queueMicrotaskDescriptor&&queueMicrotaskDescriptor.value,flush,head,last,notify$1,toggle,node,promise,then;queueMicrotask||(flush=function(){var e,t;for(IS_NODE$2&&(e=process$1.domain)&&e.exit();head;){t=head.fn,head=head.next;try{t()}catch(error){throw head?notify$1():last=void 0,error}}last=void 0,e&&e.enter()},IS_IOS||IS_NODE$2||IS_WEBOS_WEBKIT||!MutationObserver$1||!document$2?!IS_IOS_PEBBLE&&Promise$1&&Promise$1.resolve?(promise=Promise$1.resolve(void 0),promise.constructor=Promise$1,then=bind$9(promise.then,promise),notify$1=function(){then(flush)}):IS_NODE$2?notify$1=function(){process$1.nextTick(flush)}:(macrotask=bind$9(macrotask,global$q),notify$1=function(){macrotask(flush)}):(toggle=!0,node=document$2.createTextNode(""),new MutationObserver$1(flush).observe(node,{characterData:!0}),notify$1=function(){node.data=toggle=!toggle}));var microtask$1=queueMicrotask||function(e){var t={fn:e,next:void 0};last&&(last.next=t),head||(head=t,notify$1()),last=t},global$p=global$H,hostReportErrors$1=function(e,t){var r=global$p.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},perform$3=function(e){try{return{error:!1,value:e()}}catch(error){return{error:!0,value:error}}},Queue$1=function(){this.head=null,this.tail=null};Queue$1.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 queue=Queue$1,global$o=global$H,promiseNativeConstructor=global$o.Promise,engineIsDeno="object"==("undefined"==typeof Deno?"undefined":_typeof$4(Deno))&&Deno&&"object"==_typeof$4(Deno.version),IS_DENO$1=engineIsDeno,IS_NODE$1=engineIsNode,engineIsBrowser=!IS_DENO$1&&!IS_NODE$1&&"object"==("undefined"==typeof window?"undefined":_typeof$4(window))&&"object"==("undefined"==typeof document?"undefined":_typeof$4(document)),global$n=global$H,NativePromiseConstructor$4=promiseNativeConstructor,isCallable$e=isCallable$u,isForced$2=isForced_1,inspectSource=inspectSource$3,wellKnownSymbol$i=wellKnownSymbol$u,IS_BROWSER=engineIsBrowser,IS_DENO=engineIsDeno,V8_VERSION=engineV8Version;NativePromiseConstructor$4&&NativePromiseConstructor$4.prototype;var SPECIES$1=wellKnownSymbol$i("species"),SUBCLASSING=!1,NATIVE_PROMISE_REJECTION_EVENT$1=isCallable$e(global$n.PromiseRejectionEvent),FORCED_PROMISE_CONSTRUCTOR$5=isForced$2("Promise",(function(){var e=inspectSource(NativePromiseConstructor$4),t=e!==String(NativePromiseConstructor$4);if(!t&&66===V8_VERSION)return!0;if(!V8_VERSION||V8_VERSION<51||!/native code/.test(e)){var r=new NativePromiseConstructor$4((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[SPECIES$1]=n,!(SUBCLASSING=r.then((function(){}))instanceof n))return!0}return!t&&(IS_BROWSER||IS_DENO)&&!NATIVE_PROMISE_REJECTION_EVENT$1})),promiseConstructorDetection={CONSTRUCTOR:FORCED_PROMISE_CONSTRUCTOR$5,REJECTION_EVENT:NATIVE_PROMISE_REJECTION_EVENT$1,SUBCLASSING:SUBCLASSING},newPromiseCapability$2={},aCallable$8=aCallable$b,$TypeError$7=TypeError,PromiseCapability=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw $TypeError$7("Bad Promise constructor");t=e,r=n})),this.resolve=aCallable$8(t),this.reject=aCallable$8(r)};newPromiseCapability$2.f=function(e){return new PromiseCapability(e)};var $$y=_export,IS_NODE=engineIsNode,global$m=global$H,call$m=functionCall,defineBuiltIn$f=defineBuiltIn$i,setPrototypeOf$5=objectSetPrototypeOf,setToStringTag$6=setToStringTag$7,setSpecies$2=setSpecies$3,aCallable$7=aCallable$b,isCallable$d=isCallable$u,isObject$e=isObject$n,anInstance$4=anInstance$5,speciesConstructor$3=speciesConstructor$4,task=task$1.set,microtask=microtask$1,hostReportErrors=hostReportErrors$1,perform$2=perform$3,Queue=queue,InternalStateModule$8=internalState,NativePromiseConstructor$3=promiseNativeConstructor,PromiseConstructorDetection=promiseConstructorDetection,newPromiseCapabilityModule$3=newPromiseCapability$2,PROMISE="Promise",FORCED_PROMISE_CONSTRUCTOR$4=PromiseConstructorDetection.CONSTRUCTOR,NATIVE_PROMISE_REJECTION_EVENT=PromiseConstructorDetection.REJECTION_EVENT,NATIVE_PROMISE_SUBCLASSING=PromiseConstructorDetection.SUBCLASSING,getInternalPromiseState=InternalStateModule$8.getterFor(PROMISE),setInternalState$7=InternalStateModule$8.set,NativePromisePrototype$2=NativePromiseConstructor$3&&NativePromiseConstructor$3.prototype,PromiseConstructor=NativePromiseConstructor$3,PromisePrototype=NativePromisePrototype$2,TypeError$6=global$m.TypeError,document$1=global$m.document,process=global$m.process,newPromiseCapability$1=newPromiseCapabilityModule$3.f,newGenericPromiseCapability=newPromiseCapability$1,DISPATCH_EVENT=!!(document$1&&document$1.createEvent&&global$m.dispatchEvent),UNHANDLED_REJECTION="unhandledrejection",REJECTION_HANDLED="rejectionhandled",PENDING=0,FULFILLED=1,REJECTED=2,HANDLED=1,UNHANDLED=2,Internal,OwnPromiseCapability,PromiseWrapper,nativeThen,isThenable=function(e){var t;return!(!isObject$e(e)||!isCallable$d(t=e.then))&&t},callReaction=function(e,t){var r,n,i,o=t.value,a=t.state==FULFILLED,s=a?e.ok:e.fail,l=e.resolve,c=e.reject,u=e.domain;try{s?(a||(t.rejection===UNHANDLED&&onHandleUnhandled(t),t.rejection=HANDLED),!0===s?r=o:(u&&u.enter(),r=s(o),u&&(u.exit(),i=!0)),r===e.promise?c(TypeError$6("Promise-chain cycle")):(n=isThenable(r))?call$m(n,r,l,c):l(r)):c(o)}catch(error){u&&!i&&u.exit(),c(error)}},notify=function(e,t){e.notified||(e.notified=!0,microtask((function(){for(var r,n=e.reactions;r=n.get();)callReaction(r,e);e.notified=!1,t&&!e.rejection&&onUnhandled(e)})))},dispatchEvent=function(e,t,r){var n,i;DISPATCH_EVENT?((n=document$1.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),global$m.dispatchEvent(n)):n={promise:t,reason:r},!NATIVE_PROMISE_REJECTION_EVENT&&(i=global$m["on"+e])?i(n):e===UNHANDLED_REJECTION&&hostReportErrors("Unhandled promise rejection",r)},onUnhandled=function(e){call$m(task,global$m,(function(){var t,r=e.facade,n=e.value;if(isUnhandled(e)&&(t=perform$2((function(){IS_NODE?process.emit("unhandledRejection",n,r):dispatchEvent(UNHANDLED_REJECTION,r,n)})),e.rejection=IS_NODE||isUnhandled(e)?UNHANDLED:HANDLED,t.error))throw t.value}))},isUnhandled=function(e){return e.rejection!==HANDLED&&!e.parent},onHandleUnhandled=function(e){call$m(task,global$m,(function(){var t=e.facade;IS_NODE?process.emit("rejectionHandled",t):dispatchEvent(REJECTION_HANDLED,t,e.value)}))},bind$8=function(e,t,r){return function(n){e(t,n,r)}},internalReject=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=REJECTED,notify(e,!0))},internalResolve=function e(t,r,n){if(!t.done){t.done=!0,n&&(t=n);try{if(t.facade===r)throw TypeError$6("Promise can't be resolved itself");var i=isThenable(r);i?microtask((function(){var n={done:!1};try{call$m(i,r,bind$8(e,n,t),bind$8(internalReject,n,t))}catch(error){internalReject(n,error,t)}})):(t.value=r,t.state=FULFILLED,notify(t,!1))}catch(error){internalReject({done:!1},error,t)}}};if(FORCED_PROMISE_CONSTRUCTOR$4&&(PromiseConstructor=function(e){anInstance$4(this,PromisePrototype),aCallable$7(e),call$m(Internal,this);var t=getInternalPromiseState(this);try{e(bind$8(internalResolve,t),bind$8(internalReject,t))}catch(error){internalReject(t,error)}},PromisePrototype=PromiseConstructor.prototype,Internal=function(e){setInternalState$7(this,{type:PROMISE,done:!1,notified:!1,parent:!1,reactions:new Queue,rejection:!1,state:PENDING,value:void 0})},Internal.prototype=defineBuiltIn$f(PromisePrototype,"then",(function(e,t){var r=getInternalPromiseState(this),n=newPromiseCapability$1(speciesConstructor$3(this,PromiseConstructor));return r.parent=!0,n.ok=!isCallable$d(e)||e,n.fail=isCallable$d(t)&&t,n.domain=IS_NODE?process.domain:void 0,r.state==PENDING?r.reactions.add(n):microtask((function(){callReaction(n,r)})),n.promise})),OwnPromiseCapability=function(){var e=new Internal,t=getInternalPromiseState(e);this.promise=e,this.resolve=bind$8(internalResolve,t),this.reject=bind$8(internalReject,t)},newPromiseCapabilityModule$3.f=newPromiseCapability$1=function(e){return e===PromiseConstructor||e===PromiseWrapper?new OwnPromiseCapability(e):newGenericPromiseCapability(e)},isCallable$d(NativePromiseConstructor$3)&&NativePromisePrototype$2!==Object.prototype)){nativeThen=NativePromisePrototype$2.then,NATIVE_PROMISE_SUBCLASSING||defineBuiltIn$f(NativePromisePrototype$2,"then",(function(e,t){var r=this;return new PromiseConstructor((function(e,t){call$m(nativeThen,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete NativePromisePrototype$2.constructor}catch(error){}setPrototypeOf$5&&setPrototypeOf$5(NativePromisePrototype$2,PromisePrototype)}$$y({global:!0,constructor:!0,wrap:!0,forced:FORCED_PROMISE_CONSTRUCTOR$4},{Promise:PromiseConstructor}),setToStringTag$6(PromiseConstructor,PROMISE,!1),setSpecies$2(PROMISE);var iterators={},wellKnownSymbol$h=wellKnownSymbol$u,Iterators$4=iterators,ITERATOR$9=wellKnownSymbol$h("iterator"),ArrayPrototype=Array.prototype,isArrayIteratorMethod$3=function(e){return void 0!==e&&(Iterators$4.Array===e||ArrayPrototype[ITERATOR$9]===e)},classof$9=classof$e,getMethod$4=getMethod$6,isNullOrUndefined$3=isNullOrUndefined$7,Iterators$3=iterators,wellKnownSymbol$g=wellKnownSymbol$u,ITERATOR$8=wellKnownSymbol$g("iterator"),getIteratorMethod$5=function(e){if(!isNullOrUndefined$3(e))return getMethod$4(e,ITERATOR$8)||getMethod$4(e,"@@iterator")||Iterators$3[classof$9(e)]},call$l=functionCall,aCallable$6=aCallable$b,anObject$c=anObject$l,tryToString$3=tryToString$7,getIteratorMethod$4=getIteratorMethod$5,$TypeError$6=TypeError,getIterator$4=function(e,t){var r=arguments.length<2?getIteratorMethod$4(e):t;if(aCallable$6(r))return anObject$c(call$l(r,e));throw $TypeError$6(tryToString$3(e)+" is not iterable")},call$k=functionCall,anObject$b=anObject$l,getMethod$3=getMethod$6,iteratorClose$2=function(e,t,r){var n,i;anObject$b(e);try{if(!(n=getMethod$3(e,"return"))){if("throw"===t)throw r;return r}n=call$k(n,e)}catch(error){i=!0,n=error}if("throw"===t)throw r;if(i)throw n;return anObject$b(n),r},bind$7=functionBindContext,call$j=functionCall,anObject$a=anObject$l,tryToString$2=tryToString$7,isArrayIteratorMethod$2=isArrayIteratorMethod$3,lengthOfArrayLike$c=lengthOfArrayLike$i,isPrototypeOf$7=objectIsPrototypeOf,getIterator$3=getIterator$4,getIteratorMethod$3=getIteratorMethod$5,iteratorClose$1=iteratorClose$2,$TypeError$5=TypeError,Result=function(e,t){this.stopped=e,this.result=t},ResultPrototype=Result.prototype,iterate$2=function(e,t,r){var n,i,o,a,s,l,c,u=r&&r.that,h=!(!r||!r.AS_ENTRIES),d=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),g=bind$7(t,u),y=function(e){return n&&iteratorClose$1(n,"normal",e),new Result(!0,e)},v=function(e){return h?(anObject$a(e),f?g(e[0],e[1],y):g(e[0],e[1])):f?g(e,y):g(e)};if(d)n=e.iterator;else if(p)n=e;else{if(!(i=getIteratorMethod$3(e)))throw $TypeError$5(tryToString$2(e)+" is not iterable");if(isArrayIteratorMethod$2(i)){for(o=0,a=lengthOfArrayLike$c(e);a>o;o++)if((s=v(e[o]))&&isPrototypeOf$7(ResultPrototype,s))return s;return new Result(!1)}n=getIterator$3(e,i)}for(l=d?e.next:n.next;!(c=call$j(l,n)).done;){try{s=v(c.value)}catch(error){iteratorClose$1(n,"throw",error)}if("object"==_typeof$4(s)&&s&&isPrototypeOf$7(ResultPrototype,s))return s}return new Result(!1)},wellKnownSymbol$f=wellKnownSymbol$u,ITERATOR$7=wellKnownSymbol$f("iterator"),SAFE_CLOSING=!1;try{var called=0,iteratorWithReturn={next:function(){return{done:!!called++}},return:function(){SAFE_CLOSING=!0}};iteratorWithReturn[ITERATOR$7]=function(){return this},Array.from(iteratorWithReturn,(function(){throw 2}))}catch(error){}var checkCorrectnessOfIteration$2=function(e,t){if(!t&&!SAFE_CLOSING)return!1;var r=!1;try{var n={};n[ITERATOR$7]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(error){}return r},NativePromiseConstructor$2=promiseNativeConstructor,checkCorrectnessOfIteration$1=checkCorrectnessOfIteration$2,FORCED_PROMISE_CONSTRUCTOR$3=promiseConstructorDetection.CONSTRUCTOR,promiseStaticsIncorrectIteration=FORCED_PROMISE_CONSTRUCTOR$3||!checkCorrectnessOfIteration$1((function(e){NativePromiseConstructor$2.all(e).then(void 0,(function(){}))})),$$x=_export,call$i=functionCall,aCallable$5=aCallable$b,newPromiseCapabilityModule$2=newPromiseCapability$2,perform$1=perform$3,iterate$1=iterate$2,PROMISE_STATICS_INCORRECT_ITERATION$1=promiseStaticsIncorrectIteration;$$x({target:"Promise",stat:!0,forced:PROMISE_STATICS_INCORRECT_ITERATION$1},{all:function(e){var t=this,r=newPromiseCapabilityModule$2.f(t),n=r.resolve,i=r.reject,o=perform$1((function(){var r=aCallable$5(t.resolve),o=[],a=0,s=1;iterate$1(e,(function(e){var l=a++,c=!1;s++,call$i(r,t,e).then((function(e){c||(c=!0,o[l]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise}});var $$w=_export,FORCED_PROMISE_CONSTRUCTOR$2=promiseConstructorDetection.CONSTRUCTOR,NativePromiseConstructor$1=promiseNativeConstructor,getBuiltIn$6=getBuiltIn$d,isCallable$c=isCallable$u,defineBuiltIn$e=defineBuiltIn$i,NativePromisePrototype$1=NativePromiseConstructor$1&&NativePromiseConstructor$1.prototype;if($$w({target:"Promise",proto:!0,forced:FORCED_PROMISE_CONSTRUCTOR$2,real:!0},{catch:function(e){return this.then(void 0,e)}}),isCallable$c(NativePromiseConstructor$1)){var method$1=getBuiltIn$6("Promise").prototype.catch;NativePromisePrototype$1.catch!==method$1&&defineBuiltIn$e(NativePromisePrototype$1,"catch",method$1,{unsafe:!0})}var $$v=_export,call$h=functionCall,aCallable$4=aCallable$b,newPromiseCapabilityModule$1=newPromiseCapability$2,perform=perform$3,iterate=iterate$2,PROMISE_STATICS_INCORRECT_ITERATION=promiseStaticsIncorrectIteration;$$v({target:"Promise",stat:!0,forced:PROMISE_STATICS_INCORRECT_ITERATION},{race:function(e){var t=this,r=newPromiseCapabilityModule$1.f(t),n=r.reject,i=perform((function(){var i=aCallable$4(t.resolve);iterate(e,(function(e){call$h(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var $$u=_export,call$g=functionCall,newPromiseCapabilityModule=newPromiseCapability$2,FORCED_PROMISE_CONSTRUCTOR$1=promiseConstructorDetection.CONSTRUCTOR;$$u({target:"Promise",stat:!0,forced:FORCED_PROMISE_CONSTRUCTOR$1},{reject:function(e){var t=newPromiseCapabilityModule.f(this);return call$g(t.reject,void 0,e),t.promise}});var anObject$9=anObject$l,isObject$d=isObject$n,newPromiseCapability=newPromiseCapability$2,promiseResolve$2=function(e,t){if(anObject$9(e),isObject$d(t)&&t.constructor===e)return t;var r=newPromiseCapability.f(e);return(0,r.resolve)(t),r.promise},$$t=_export,getBuiltIn$5=getBuiltIn$d,FORCED_PROMISE_CONSTRUCTOR=promiseConstructorDetection.CONSTRUCTOR,promiseResolve$1=promiseResolve$2;getBuiltIn$5("Promise"),$$t({target:"Promise",stat:!0,forced:FORCED_PROMISE_CONSTRUCTOR},{resolve:function(e){return promiseResolve$1(this,e)}});var es_function_name={},DESCRIPTORS$d=descriptors,FUNCTION_NAME_EXISTS=functionName.EXISTS,uncurryThis$v=functionUncurryThis,defineProperty$9=objectDefineProperty.f,FunctionPrototype=Function.prototype,functionToString=uncurryThis$v(FunctionPrototype.toString),nameRE=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,regExpExec$2=uncurryThis$v(nameRE.exec),NAME$1="name";DESCRIPTORS$d&&!FUNCTION_NAME_EXISTS&&defineProperty$9(FunctionPrototype,NAME$1,{configurable:!0,get:function(){try{return regExpExec$2(nameRE,functionToString(this))[1]}catch(error){return""}}});var $$s=_export;$$s({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var es_number_constructor={},isCallable$b=isCallable$u,isObject$c=isObject$n,setPrototypeOf$4=objectSetPrototypeOf,inheritIfRequired$3=function(e,t,r){var n,i;return setPrototypeOf$4&&isCallable$b(n=t.constructor)&&n!==r&&isObject$c(i=n.prototype)&&i!==r.prototype&&setPrototypeOf$4(e,i),e},uncurryThis$u=functionUncurryThis,thisNumberValue$2=uncurryThis$u(1..valueOf),whitespaces$3="\t\n\v\f\r                 \u2028\u2029\ufeff",uncurryThis$t=functionUncurryThis,requireObjectCoercible$7=requireObjectCoercible$a,toString$e=toString$h,whitespaces$2=whitespaces$3,replace$7=uncurryThis$t("".replace),whitespace="["+whitespaces$2+"]",ltrim=RegExp("^"+whitespace+whitespace+"*"),rtrim=RegExp(whitespace+whitespace+"*$"),createMethod$4=function(e){return function(t){var r=toString$e(requireObjectCoercible$7(t));return 1&e&&(r=replace$7(r,ltrim,"")),2&e&&(r=replace$7(r,rtrim,"")),r}},stringTrim={start:createMethod$4(1),end:createMethod$4(2),trim:createMethod$4(3)},DESCRIPTORS$c=descriptors,global$l=global$H,uncurryThis$s=functionUncurryThis,isForced$1=isForced_1,defineBuiltIn$d=defineBuiltIn$i,hasOwn$d=hasOwnProperty_1,inheritIfRequired$2=inheritIfRequired$3,isPrototypeOf$6=objectIsPrototypeOf,isSymbol$3=isSymbol$6,toPrimitive$1=toPrimitive$3,fails$t=fails$L,getOwnPropertyNames$3=objectGetOwnPropertyNames.f,getOwnPropertyDescriptor$1=objectGetOwnPropertyDescriptor.f,defineProperty$8=objectDefineProperty.f,thisNumberValue$1=thisNumberValue$2,trim$1=stringTrim.trim,NUMBER="Number",NativeNumber=global$l[NUMBER],NumberPrototype=NativeNumber.prototype,TypeError$5=global$l.TypeError,arraySlice$a=uncurryThis$s("".slice),charCodeAt$3=uncurryThis$s("".charCodeAt),toNumeric=function(e){var t=toPrimitive$1(e,"number");return"bigint"==typeof t?t:toNumber$1(t)},toNumber$1=function(e){var t,r,n,i,o,a,s,l,c=toPrimitive$1(e,"number");if(isSymbol$3(c))throw TypeError$5("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=trim$1(c),43===(t=charCodeAt$3(c,0))||45===t){if(88===(r=charCodeAt$3(c,2))||120===r)return NaN}else if(48===t){switch(charCodeAt$3(c,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+c}for(a=(o=arraySlice$a(c,2)).length,s=0;s<a;s++)if((l=charCodeAt$3(o,s))<48||l>i)return NaN;return parseInt(o,n)}return+c};if(isForced$1(NUMBER,!NativeNumber(" 0o1")||!NativeNumber("0b1")||NativeNumber("+0x1"))){for(var NumberWrapper=function(e){var t=arguments.length<1?0:NativeNumber(toNumeric(e)),r=this;return isPrototypeOf$6(NumberPrototype,r)&&fails$t((function(){thisNumberValue$1(r)}))?inheritIfRequired$2(Object(t),r,NumberWrapper):t},keys$2=DESCRIPTORS$c?getOwnPropertyNames$3(NativeNumber):"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(","),j$1=0,key$1;keys$2.length>j$1;j$1++)hasOwn$d(NativeNumber,key$1=keys$2[j$1])&&!hasOwn$d(NumberWrapper,key$1)&&defineProperty$8(NumberWrapper,key$1,getOwnPropertyDescriptor$1(NativeNumber,key$1));NumberWrapper.prototype=NumberPrototype,NumberPrototype.constructor=NumberWrapper,defineBuiltIn$d(global$l,NUMBER,NumberWrapper,{constructor:!0})}var es_array_map={},$$r=_export,$map$1=arrayIteration.map,arrayMethodHasSpeciesSupport$1=arrayMethodHasSpeciesSupport$5,HAS_SPECIES_SUPPORT$1=arrayMethodHasSpeciesSupport$1("map");$$r({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$1},{map:function(e){return $map$1(this,e,arguments.length>1?arguments[1]:void 0)}});var fails$s=fails$L,correctPrototypeGetter=!fails$s((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),hasOwn$c=hasOwnProperty_1,isCallable$a=isCallable$u,toObject$b=toObject$h,sharedKey$1=sharedKey$4,CORRECT_PROTOTYPE_GETTER$1=correctPrototypeGetter,IE_PROTO=sharedKey$1("IE_PROTO"),$Object=Object,ObjectPrototype$4=$Object.prototype,objectGetPrototypeOf=CORRECT_PROTOTYPE_GETTER$1?$Object.getPrototypeOf:function(e){var t=toObject$b(e);if(hasOwn$c(t,IE_PROTO))return t[IE_PROTO];var r=t.constructor;return isCallable$a(r)&&t instanceof r?r.prototype:t instanceof $Object?ObjectPrototype$4:null},fails$r=fails$L,isCallable$9=isCallable$u,isObject$b=isObject$n,getPrototypeOf$3=objectGetPrototypeOf,defineBuiltIn$c=defineBuiltIn$i,wellKnownSymbol$e=wellKnownSymbol$u,ITERATOR$6=wellKnownSymbol$e("iterator"),BUGGY_SAFARI_ITERATORS$1=!1,IteratorPrototype$2,PrototypeOfArrayIteratorPrototype,arrayIterator;[].keys&&(arrayIterator=[].keys(),"next"in arrayIterator?(PrototypeOfArrayIteratorPrototype=getPrototypeOf$3(getPrototypeOf$3(arrayIterator)),PrototypeOfArrayIteratorPrototype!==Object.prototype&&(IteratorPrototype$2=PrototypeOfArrayIteratorPrototype)):BUGGY_SAFARI_ITERATORS$1=!0);var NEW_ITERATOR_PROTOTYPE=!isObject$b(IteratorPrototype$2)||fails$r((function(){var e={};return IteratorPrototype$2[ITERATOR$6].call(e)!==e}));NEW_ITERATOR_PROTOTYPE&&(IteratorPrototype$2={}),isCallable$9(IteratorPrototype$2[ITERATOR$6])||defineBuiltIn$c(IteratorPrototype$2,ITERATOR$6,(function(){return this}));var iteratorsCore={IteratorPrototype:IteratorPrototype$2,BUGGY_SAFARI_ITERATORS:BUGGY_SAFARI_ITERATORS$1},IteratorPrototype$1=iteratorsCore.IteratorPrototype,create$3=objectCreate,createPropertyDescriptor$3=createPropertyDescriptor$7,setToStringTag$5=setToStringTag$7,Iterators$2=iterators,returnThis$1=function(){return this},iteratorCreateConstructor=function(e,t,r,n){var i=t+" Iterator";return e.prototype=create$3(IteratorPrototype$1,{next:createPropertyDescriptor$3(+!n,r)}),setToStringTag$5(e,i,!1),Iterators$2[i]=returnThis$1,e},$$q=_export,call$f=functionCall,FunctionName$1=functionName,isCallable$8=isCallable$u,createIteratorConstructor$1=iteratorCreateConstructor,getPrototypeOf$2=objectGetPrototypeOf,setPrototypeOf$3=objectSetPrototypeOf,setToStringTag$4=setToStringTag$7,createNonEnumerableProperty$6=createNonEnumerableProperty$a,defineBuiltIn$b=defineBuiltIn$i,wellKnownSymbol$d=wellKnownSymbol$u,Iterators$1=iterators,IteratorsCore=iteratorsCore,PROPER_FUNCTION_NAME$3=FunctionName$1.PROPER,CONFIGURABLE_FUNCTION_NAME$1=FunctionName$1.CONFIGURABLE,IteratorPrototype=IteratorsCore.IteratorPrototype,BUGGY_SAFARI_ITERATORS=IteratorsCore.BUGGY_SAFARI_ITERATORS,ITERATOR$5=wellKnownSymbol$d("iterator"),KEYS="keys",VALUES="values",ENTRIES="entries",returnThis=function(){return this},iteratorDefine=function(e,t,r,n,i,o,a){createIteratorConstructor$1(r,t,n);var s,l,c,u=function(e){if(e===i&&g)return g;if(!BUGGY_SAFARI_ITERATORS&&e in p)return p[e];switch(e){case KEYS:case VALUES:case ENTRIES:return function(){return new r(this,e)}}return function(){return new r(this)}},h=t+" Iterator",d=!1,p=e.prototype,f=p[ITERATOR$5]||p["@@iterator"]||i&&p[i],g=!BUGGY_SAFARI_ITERATORS&&f||u(i),y="Array"==t&&p.entries||f;if(y&&(s=getPrototypeOf$2(y.call(new e)))!==Object.prototype&&s.next&&(getPrototypeOf$2(s)!==IteratorPrototype&&(setPrototypeOf$3?setPrototypeOf$3(s,IteratorPrototype):isCallable$8(s[ITERATOR$5])||defineBuiltIn$b(s,ITERATOR$5,returnThis)),setToStringTag$4(s,h,!0)),PROPER_FUNCTION_NAME$3&&i==VALUES&&f&&f.name!==VALUES&&(CONFIGURABLE_FUNCTION_NAME$1?createNonEnumerableProperty$6(p,"name",VALUES):(d=!0,g=function(){return call$f(f,this)})),i)if(l={values:u(VALUES),keys:o?g:u(KEYS),entries:u(ENTRIES)},a)for(c in l)(BUGGY_SAFARI_ITERATORS||d||!(c in p))&&defineBuiltIn$b(p,c,l[c]);else $$q({target:t,proto:!0,forced:BUGGY_SAFARI_ITERATORS||d},l);return p[ITERATOR$5]!==g&&defineBuiltIn$b(p,ITERATOR$5,g,{name:i}),Iterators$1[t]=g,l},createIterResultObject$2=function(e,t){return{value:e,done:t}},toIndexedObject$5=toIndexedObject$c,addToUnscopables$2=addToUnscopables$4,Iterators=iterators,InternalStateModule$7=internalState,defineProperty$7=objectDefineProperty.f,defineIterator$1=iteratorDefine,createIterResultObject$1=createIterResultObject$2,DESCRIPTORS$b=descriptors,ARRAY_ITERATOR="Array Iterator",setInternalState$6=InternalStateModule$7.set,getInternalState$6=InternalStateModule$7.getterFor(ARRAY_ITERATOR),es_array_iterator=defineIterator$1(Array,"Array",(function(e,t){setInternalState$6(this,{type:ARRAY_ITERATOR,target:toIndexedObject$5(e),index:0,kind:t})}),(function(){var e=getInternalState$6(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,createIterResultObject$1(void 0,!0)):createIterResultObject$1("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),values=Iterators.Arguments=Iterators.Array;if(addToUnscopables$2("keys"),addToUnscopables$2("values"),addToUnscopables$2("entries"),DESCRIPTORS$b&&"values"!==values.name)try{defineProperty$7(values,"name",{value:"values"})}catch(error){}var global$k=global$H,DOMIterables=domIterables,DOMTokenListPrototype=domTokenListPrototype,ArrayIteratorMethods=es_array_iterator,createNonEnumerableProperty$5=createNonEnumerableProperty$a,wellKnownSymbol$c=wellKnownSymbol$u,ITERATOR$4=wellKnownSymbol$c("iterator"),TO_STRING_TAG$1=wellKnownSymbol$c("toStringTag"),ArrayValues=ArrayIteratorMethods.values,handlePrototype=function(e,t){if(e){if(e[ITERATOR$4]!==ArrayValues)try{createNonEnumerableProperty$5(e,ITERATOR$4,ArrayValues)}catch(error){e[ITERATOR$4]=ArrayValues}if(e[TO_STRING_TAG$1]||createNonEnumerableProperty$5(e,TO_STRING_TAG$1,t),DOMIterables[t])for(var r in ArrayIteratorMethods)if(e[r]!==ArrayIteratorMethods[r])try{createNonEnumerableProperty$5(e,r,ArrayIteratorMethods[r])}catch(error){e[r]=ArrayIteratorMethods[r]}}};for(var COLLECTION_NAME in DOMIterables)handlePrototype(global$k[COLLECTION_NAME]&&global$k[COLLECTION_NAME].prototype,COLLECTION_NAME);handlePrototype(DOMTokenListPrototype,"DOMTokenList");var es_array_filter={},$$p=_export,$filter$1=arrayIteration.filter,arrayMethodHasSpeciesSupport=arrayMethodHasSpeciesSupport$5,HAS_SPECIES_SUPPORT=arrayMethodHasSpeciesSupport("filter");$$p({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT},{filter:function(e){return $filter$1(this,e,arguments.length>1?arguments[1]:void 0)}});var DESCRIPTORS$a=descriptors,uncurryThis$r=functionUncurryThis,call$e=functionCall,fails$q=fails$L,objectKeys$2=objectKeys$4,getOwnPropertySymbolsModule$2=objectGetOwnPropertySymbols,propertyIsEnumerableModule$1=objectPropertyIsEnumerable,toObject$a=toObject$h,IndexedObject$2=indexedObject,$assign=Object.assign,defineProperty$6=Object.defineProperty,concat$2=uncurryThis$r([].concat),objectAssign=!$assign||fails$q((function(){if(DESCRIPTORS$a&&1!==$assign({b:1},$assign(defineProperty$6({},"a",{enumerable:!0,get:function(){defineProperty$6(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=$assign({},e)[r]||objectKeys$2($assign({},t)).join("")!=n}))?function(e,t){for(var r=toObject$a(e),n=arguments.length,i=1,o=getOwnPropertySymbolsModule$2.f,a=propertyIsEnumerableModule$1.f;n>i;)for(var s,l=IndexedObject$2(arguments[i++]),c=o?concat$2(objectKeys$2(l),o(l)):objectKeys$2(l),u=c.length,h=0;u>h;)s=c[h++],DESCRIPTORS$a&&!call$e(a,l,s)||(r[s]=l[s]);return r}:$assign,$$o=_export,assign$4=objectAssign;$$o({target:"Object",stat:!0,arity:2,forced:Object.assign!==assign$4},{assign:assign$4});var eventemitter3={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),l=r?r+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,o,a){var s=r?r+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,i),!0;case 5:return u.fn.call(u.context,t,n,i,o),!0;case 6:return u.fn.call(u.context,t,n,i,o,a),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var d,p=u.length;for(c=0;c<p;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,n);break;case 4:u[c].fn.call(u[c].context,t,n,i);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];u[c].fn.apply(u[c].context,l)}}return!0},s.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||i&&!s[l].once||n&&s[l].context!==n)&&c.push(s[l]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(eventemitter3);var EventEmitter=eventemitter3.exports,es_string_match={},uncurryThis$q=functionUncurryThis,defineBuiltIn$a=defineBuiltIn$i,regexpExec$2=regexpExec$3,fails$p=fails$L,wellKnownSymbol$b=wellKnownSymbol$u,createNonEnumerableProperty$4=createNonEnumerableProperty$a,SPECIES=wellKnownSymbol$b("species"),RegExpPrototype$4=RegExp.prototype,fixRegexpWellKnownSymbolLogic=function(e,t,r,n){var i=wellKnownSymbol$b(e),o=!fails$p((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!fails$p((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[SPECIES]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=uncurryThis$q(/./[i]),l=t(i,""[e],(function(e,t,r,n,i){var a=uncurryThis$q(e),l=t.exec;return l===regexpExec$2||l===RegExpPrototype$4.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));defineBuiltIn$a(String.prototype,e,l[0]),defineBuiltIn$a(RegExpPrototype$4,i,l[1])}n&&createNonEnumerableProperty$4(RegExpPrototype$4[i],"sham",!0)},uncurryThis$p=functionUncurryThis,toIntegerOrInfinity$9=toIntegerOrInfinity$d,toString$d=toString$h,requireObjectCoercible$6=requireObjectCoercible$a,charAt$9=uncurryThis$p("".charAt),charCodeAt$2=uncurryThis$p("".charCodeAt),stringSlice$8=uncurryThis$p("".slice),createMethod$3=function(e){return function(t,r){var n,i,o=toString$d(requireObjectCoercible$6(t)),a=toIntegerOrInfinity$9(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=charCodeAt$2(o,a))<55296||n>56319||a+1===s||(i=charCodeAt$2(o,a+1))<56320||i>57343?e?charAt$9(o,a):n:e?stringSlice$8(o,a,a+2):i-56320+(n-55296<<10)+65536}},stringMultibyte={codeAt:createMethod$3(!1),charAt:createMethod$3(!0)},charAt$8=stringMultibyte.charAt,advanceStringIndex$3=function(e,t,r){return t+(r?charAt$8(e,t).length:1)},call$d=functionCall,anObject$8=anObject$l,isCallable$7=isCallable$u,classof$8=classofRaw$2,regexpExec$1=regexpExec$3,$TypeError$4=TypeError,regexpExecAbstract=function(e,t){var r=e.exec;if(isCallable$7(r)){var n=call$d(r,e,t);return null!==n&&anObject$8(n),n}if("RegExp"===classof$8(e))return call$d(regexpExec$1,e,t);throw $TypeError$4("RegExp#exec called on incompatible receiver")},call$c=functionCall,fixRegExpWellKnownSymbolLogic$2=fixRegexpWellKnownSymbolLogic,anObject$7=anObject$l,isNullOrUndefined$2=isNullOrUndefined$7,toLength$6=toLength$8,toString$c=toString$h,requireObjectCoercible$5=requireObjectCoercible$a,getMethod$2=getMethod$6,advanceStringIndex$2=advanceStringIndex$3,regExpExec$1=regexpExecAbstract;fixRegExpWellKnownSymbolLogic$2("match",(function(e,t,r){return[function(t){var r=requireObjectCoercible$5(this),n=isNullOrUndefined$2(t)?void 0:getMethod$2(t,e);return n?call$c(n,t,r):new RegExp(t)[e](toString$c(r))},function(e){var n=anObject$7(this),i=toString$c(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return regExpExec$1(n,i);var a=n.unicode;n.lastIndex=0;for(var s,l=[],c=0;null!==(s=regExpExec$1(n,i));){var u=toString$c(s[0]);l[c]=u,""===u&&(n.lastIndex=advanceStringIndex$2(i,toLength$6(n.lastIndex),a)),c++}return 0===c?null:l}]}));var es_regexp_constructor={},isObject$a=isObject$n,classof$7=classofRaw$2,wellKnownSymbol$a=wellKnownSymbol$u,MATCH$2=wellKnownSymbol$a("match"),isRegexp=function(e){var t;return isObject$a(e)&&(void 0!==(t=e[MATCH$2])?!!t:"RegExp"==classof$7(e))},call$b=functionCall,hasOwn$b=hasOwnProperty_1,isPrototypeOf$5=objectIsPrototypeOf,regExpFlags=regexpFlags$1,RegExpPrototype$3=RegExp.prototype,regexpGetFlags=function(e){var t=e.flags;return void 0!==t||"flags"in RegExpPrototype$3||hasOwn$b(e,"flags")||!isPrototypeOf$5(RegExpPrototype$3,e)?t:call$b(regExpFlags,e)},defineProperty$5=objectDefineProperty.f,proxyAccessor$1=function(e,t,r){r in e||defineProperty$5(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},DESCRIPTORS$9=descriptors,global$j=global$H,uncurryThis$o=functionUncurryThis,isForced=isForced_1,inheritIfRequired$1=inheritIfRequired$3,createNonEnumerableProperty$3=createNonEnumerableProperty$a,getOwnPropertyNames$2=objectGetOwnPropertyNames.f,isPrototypeOf$4=objectIsPrototypeOf,isRegExp$2=isRegexp,toString$b=toString$h,getRegExpFlags$1=regexpGetFlags,stickyHelpers$1=regexpStickyHelpers,proxyAccessor=proxyAccessor$1,defineBuiltIn$9=defineBuiltIn$i,fails$o=fails$L,hasOwn$a=hasOwnProperty_1,enforceInternalState$2=internalState.enforce,setSpecies$1=setSpecies$3,wellKnownSymbol$9=wellKnownSymbol$u,UNSUPPORTED_DOT_ALL=regexpUnsupportedDotAll,UNSUPPORTED_NCG=regexpUnsupportedNcg,MATCH$1=wellKnownSymbol$9("match"),NativeRegExp=global$j.RegExp,RegExpPrototype$2=NativeRegExp.prototype,SyntaxError$1=global$j.SyntaxError,exec$4=uncurryThis$o(RegExpPrototype$2.exec),charAt$7=uncurryThis$o("".charAt),replace$6=uncurryThis$o("".replace),stringIndexOf$2=uncurryThis$o("".indexOf),stringSlice$7=uncurryThis$o("".slice),IS_NCG=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,re1=/a/g,re2=/a/g,CORRECT_NEW=new NativeRegExp(re1)!==re1,MISSED_STICKY$1=stickyHelpers$1.MISSED_STICKY,UNSUPPORTED_Y$1=stickyHelpers$1.UNSUPPORTED_Y,BASE_FORCED=DESCRIPTORS$9&&(!CORRECT_NEW||MISSED_STICKY$1||UNSUPPORTED_DOT_ALL||UNSUPPORTED_NCG||fails$o((function(){return re2[MATCH$1]=!1,NativeRegExp(re1)!=re1||NativeRegExp(re2)==re2||"/a/i"!=NativeRegExp(re1,"i")}))),handleDotAll=function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=charAt$7(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+charAt$7(e,++n);return i},handleNCG=function(e){for(var t,r=e.length,n=0,i="",o=[],a={},s=!1,l=!1,c=0,u="";n<=r;n++){if("\\"===(t=charAt$7(e,n)))t+=charAt$7(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:exec$4(IS_NCG,stringSlice$7(e,n+1))&&(n+=2,l=!0),i+=t,c++;continue;case">"===t&&l:if(""===u||hasOwn$a(a,u))throw new SyntaxError$1("Invalid capture group name");a[u]=!0,o[o.length]=[u,c],l=!1,u="";continue}l?u+=t:i+=t}return[i,o]};if(isForced("RegExp",BASE_FORCED)){for(var RegExpWrapper=function(e,t){var r,n,i,o,a,s,l=isPrototypeOf$4(RegExpPrototype$2,this),c=isRegExp$2(e),u=void 0===t,h=[],d=e;if(!l&&c&&u&&e.constructor===RegExpWrapper)return e;if((c||isPrototypeOf$4(RegExpPrototype$2,e))&&(e=e.source,u&&(t=getRegExpFlags$1(d))),e=void 0===e?"":toString$b(e),t=void 0===t?"":toString$b(t),d=e,UNSUPPORTED_DOT_ALL&&"dotAll"in re1&&(n=!!t&&stringIndexOf$2(t,"s")>-1)&&(t=replace$6(t,/s/g,"")),r=t,MISSED_STICKY$1&&"sticky"in re1&&(i=!!t&&stringIndexOf$2(t,"y")>-1)&&UNSUPPORTED_Y$1&&(t=replace$6(t,/y/g,"")),UNSUPPORTED_NCG&&(e=(o=handleNCG(e))[0],h=o[1]),a=inheritIfRequired$1(NativeRegExp(e,t),l?this:RegExpPrototype$2,RegExpWrapper),(n||i||h.length)&&(s=enforceInternalState$2(a),n&&(s.dotAll=!0,s.raw=RegExpWrapper(handleDotAll(e),r)),i&&(s.sticky=!0),h.length&&(s.groups=h)),e!==d)try{createNonEnumerableProperty$3(a,"source",""===d?"(?:)":d)}catch(error){}return a},keys$1=getOwnPropertyNames$2(NativeRegExp),index$4=0;keys$1.length>index$4;)proxyAccessor(RegExpWrapper,NativeRegExp,keys$1[index$4++]);RegExpPrototype$2.constructor=RegExpWrapper,RegExpWrapper.prototype=RegExpPrototype$2,defineBuiltIn$9(global$j,"RegExp",RegExpWrapper,{constructor:!0})}setSpecies$1("RegExp");var makeBuiltIn=makeBuiltIn$3.exports,defineProperty$4=objectDefineProperty,defineBuiltInAccessor$2=function(e,t,r){return r.get&&makeBuiltIn(r.get,t,{getter:!0}),r.set&&makeBuiltIn(r.set,t,{setter:!0}),defineProperty$4.f(e,t,r)},DESCRIPTORS$8=descriptors,MISSED_STICKY=regexpStickyHelpers.MISSED_STICKY,classof$6=classofRaw$2,defineBuiltInAccessor$1=defineBuiltInAccessor$2,getInternalState$5=internalState.get,RegExpPrototype$1=RegExp.prototype,$TypeError$3=TypeError;DESCRIPTORS$8&&MISSED_STICKY&&defineBuiltInAccessor$1(RegExpPrototype$1,"sticky",{configurable:!0,get:function(){if(this!==RegExpPrototype$1){if("RegExp"===classof$6(this))return!!getInternalState$5(this).sticky;throw $TypeError$3("Incompatible receiver, RegExp required")}}});var es_regexp_toString={},PROPER_FUNCTION_NAME$2=functionName.PROPER,defineBuiltIn$8=defineBuiltIn$i,anObject$6=anObject$l,$toString$3=toString$h,fails$n=fails$L,getRegExpFlags=regexpGetFlags,TO_STRING$1="toString",RegExpPrototype=RegExp.prototype,nativeToString=RegExpPrototype[TO_STRING$1],NOT_GENERIC=fails$n((function(){return"/a/b"!=nativeToString.call({source:"a",flags:"b"})})),INCORRECT_NAME=PROPER_FUNCTION_NAME$2&&nativeToString.name!=TO_STRING$1;(NOT_GENERIC||INCORRECT_NAME)&&defineBuiltIn$8(RegExp.prototype,TO_STRING$1,(function(){var e=anObject$6(this);return"/"+$toString$3(e.source)+"/"+$toString$3(getRegExpFlags(e))}),{unsafe:!0});var es_string_split={},toAbsoluteIndex$3=toAbsoluteIndex$7,lengthOfArrayLike$b=lengthOfArrayLike$i,createProperty$1=createProperty$5,$Array$2=Array,max$1=Math.max,arraySliceSimple=function(e,t,r){for(var n=lengthOfArrayLike$b(e),i=toAbsoluteIndex$3(t,n),o=toAbsoluteIndex$3(void 0===r?n:r,n),a=$Array$2(max$1(o-i,0)),s=0;i<o;i++,s++)createProperty$1(a,s,e[i]);return a.length=s,a},apply$8=functionApply,call$a=functionCall,uncurryThis$n=functionUncurryThis,fixRegExpWellKnownSymbolLogic$1=fixRegexpWellKnownSymbolLogic,anObject$5=anObject$l,isNullOrUndefined$1=isNullOrUndefined$7,isRegExp$1=isRegexp,requireObjectCoercible$4=requireObjectCoercible$a,speciesConstructor$2=speciesConstructor$4,advanceStringIndex$1=advanceStringIndex$3,toLength$5=toLength$8,toString$a=toString$h,getMethod$1=getMethod$6,arraySlice$9=arraySliceSimple,callRegExpExec=regexpExecAbstract,regexpExec=regexpExec$3,stickyHelpers=regexpStickyHelpers,fails$m=fails$L,UNSUPPORTED_Y=stickyHelpers.UNSUPPORTED_Y,MAX_UINT32=4294967295,min$3=Math.min,$push=[].push,exec$3=uncurryThis$n(/./.exec),push$8=uncurryThis$n($push),stringSlice$6=uncurryThis$n("".slice),SPLIT_WORKS_WITH_OVERWRITTEN_EXEC=!fails$m((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]}));fixRegExpWellKnownSymbolLogic$1("split",(function(e,t,r){var n;return n="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,r){var n=toString$a(requireObjectCoercible$4(this)),i=void 0===r?MAX_UINT32:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!isRegExp$1(e))return call$a(t,n,e,i);for(var o,a,s,l=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),u=0,h=new RegExp(e.source,c+"g");(o=call$a(regexpExec,h,n))&&!((a=h.lastIndex)>u&&(push$8(l,stringSlice$6(n,u,o.index)),o.length>1&&o.index<n.length&&apply$8($push,l,arraySlice$9(o,1)),s=o[0].length,u=a,l.length>=i));)h.lastIndex===o.index&&h.lastIndex++;return u===n.length?!s&&exec$3(h,"")||push$8(l,""):push$8(l,stringSlice$6(n,u)),l.length>i?arraySlice$9(l,0,i):l}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:call$a(t,this,e,r)}:t,[function(t,r){var i=requireObjectCoercible$4(this),o=isNullOrUndefined$1(t)?void 0:getMethod$1(t,e);return o?call$a(o,t,i,r):call$a(n,toString$a(i),t,r)},function(e,i){var o=anObject$5(this),a=toString$a(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var l=speciesConstructor$2(o,RegExp),c=o.unicode,u=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(UNSUPPORTED_Y?"g":"y"),h=new l(UNSUPPORTED_Y?"^(?:"+o.source+")":o,u),d=void 0===i?MAX_UINT32:i>>>0;if(0===d)return[];if(0===a.length)return null===callRegExpExec(h,a)?[a]:[];for(var p=0,f=0,g=[];f<a.length;){h.lastIndex=UNSUPPORTED_Y?0:f;var y,v=callRegExpExec(h,UNSUPPORTED_Y?stringSlice$6(a,f):a);if(null===v||(y=min$3(toLength$5(h.lastIndex+(UNSUPPORTED_Y?f:0)),a.length))===p)f=advanceStringIndex$1(a,f,c);else{if(push$8(g,stringSlice$6(a,p,f)),g.length===d)return g;for(var m=1;m<=v.length-1;m++)if(push$8(g,v[m]),g.length===d)return g;f=p=y}}return push$8(g,stringSlice$6(a,p)),g}]}),!SPLIT_WORKS_WITH_OVERWRITTEN_EXEC,UNSUPPORTED_Y);var es_string_replace={},uncurryThis$m=functionUncurryThis,toObject$9=toObject$h,floor$7=Math.floor,charAt$6=uncurryThis$m("".charAt),replace$5=uncurryThis$m("".replace),stringSlice$5=uncurryThis$m("".slice),SUBSTITUTION_SYMBOLS=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,SUBSTITUTION_SYMBOLS_NO_NAMED=/\$([$&'`]|\d{1,2})/g,getSubstitution$1=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,l=SUBSTITUTION_SYMBOLS_NO_NAMED;return void 0!==i&&(i=toObject$9(i),l=SUBSTITUTION_SYMBOLS),replace$5(o,l,(function(o,l){var c;switch(charAt$6(l,0)){case"$":return"$";case"&":return e;case"`":return stringSlice$5(t,0,r);case"'":return stringSlice$5(t,a);case"<":c=i[stringSlice$5(l,1,-1)];break;default:var u=+l;if(0===u)return o;if(u>s){var h=floor$7(u/10);return 0===h?o:h<=s?void 0===n[h-1]?charAt$6(l,1):n[h-1]+charAt$6(l,1):o}c=n[u-1]}return void 0===c?"":c}))},apply$7=functionApply,call$9=functionCall,uncurryThis$l=functionUncurryThis,fixRegExpWellKnownSymbolLogic=fixRegexpWellKnownSymbolLogic,fails$l=fails$L,anObject$4=anObject$l,isCallable$6=isCallable$u,isNullOrUndefined=isNullOrUndefined$7,toIntegerOrInfinity$8=toIntegerOrInfinity$d,toLength$4=toLength$8,toString$9=toString$h,requireObjectCoercible$3=requireObjectCoercible$a,advanceStringIndex=advanceStringIndex$3,getMethod=getMethod$6,getSubstitution=getSubstitution$1,regExpExec=regexpExecAbstract,wellKnownSymbol$8=wellKnownSymbol$u,REPLACE=wellKnownSymbol$8("replace"),max=Math.max,min$2=Math.min,concat$1=uncurryThis$l([].concat),push$7=uncurryThis$l([].push),stringIndexOf$1=uncurryThis$l("".indexOf),stringSlice$4=uncurryThis$l("".slice),maybeToString=function(e){return void 0===e?e:String(e)},REPLACE_KEEPS_$0="$0"==="a".replace(/./,"$0"),REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE=!!/./[REPLACE]&&""===/./[REPLACE]("a","$0"),REPLACE_SUPPORTS_NAMED_GROUPS=!fails$l((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));fixRegExpWellKnownSymbolLogic("replace",(function(e,t,r){var n=REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE?"$":"$0";return[function(e,r){var n=requireObjectCoercible$3(this),i=isNullOrUndefined(e)?void 0:getMethod(e,REPLACE);return i?call$9(i,e,n,r):call$9(t,toString$9(n),e,r)},function(e,i){var o=anObject$4(this),a=toString$9(e);if("string"==typeof i&&-1===stringIndexOf$1(i,n)&&-1===stringIndexOf$1(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var l=isCallable$6(i);l||(i=toString$9(i));var c=o.global;if(c){var u=o.unicode;o.lastIndex=0}for(var h=[];;){var d=regExpExec(o,a);if(null===d)break;if(push$7(h,d),!c)break;""===toString$9(d[0])&&(o.lastIndex=advanceStringIndex(a,toLength$4(o.lastIndex),u))}for(var p="",f=0,g=0;g<h.length;g++){for(var y=toString$9((d=h[g])[0]),v=max(min$2(toIntegerOrInfinity$8(d.index),a.length),0),m=[],_=1;_<d.length;_++)push$7(m,maybeToString(d[_]));var b=d.groups;if(l){var T=concat$1([y],m,v,a);void 0!==b&&push$7(T,b);var E=toString$9(apply$7(i,void 0,T))}else E=getSubstitution(y,a,v,m,b,i);v>=f&&(p+=stringSlice$4(a,f,v)+E,f=v+y.length)}return p+stringSlice$4(a,f)}]}),!REPLACE_SUPPORTS_NAMED_GROUPS||!REPLACE_KEEPS_$0||REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);var es_string_trim={},PROPER_FUNCTION_NAME$1=functionName.PROPER,fails$k=fails$L,whitespaces$1=whitespaces$3,non="​…᠎",stringTrimForced=function(e){return fails$k((function(){return!!whitespaces$1[e]()||non[e]()!==non||PROPER_FUNCTION_NAME$1&&whitespaces$1[e].name!==e}))},$$n=_export,$trim=stringTrim.trim,forcedStringTrimMethod=stringTrimForced;$$n({target:"String",proto:!0,forced:forcedStringTrimMethod("trim")},{trim:function(){return $trim(this)}});var arraySlice$8=arraySliceSimple,floor$6=Math.floor,mergeSort=function e(t,r){var n=t.length,i=floor$6(n/2);return n<8?insertionSort(t,r):merge(t,e(arraySlice$8(t,0,i),r),e(arraySlice$8(t,i),r),r)},insertionSort=function(e,t){for(var r,n,i=e.length,o=1;o<i;){for(n=o,r=e[o];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==o++&&(e[n]=r)}return e},merge=function(e,t,r,n){for(var i=t.length,o=r.length,a=0,s=0;a<i||s<o;)e[a+s]=a<i&&s<o?n(t[a],r[s])<=0?t[a++]:r[s++]:a<i?t[a++]:r[s++];return e},arraySort$1=mergeSort,userAgent$2=engineUserAgent,firefox=userAgent$2.match(/firefox\/(\d+)/i),engineFfVersion=!!firefox&&+firefox[1],UA=engineUserAgent,engineIsIeOrEdge=/MSIE|Trident/.test(UA),userAgent$1=engineUserAgent,webkit=userAgent$1.match(/AppleWebKit\/(\d+)\./),engineWebkitVersion=!!webkit&&+webkit[1],$$m=_export,uncurryThis$k=functionUncurryThis,aCallable$3=aCallable$b,toObject$8=toObject$h,lengthOfArrayLike$a=lengthOfArrayLike$i,deletePropertyOrThrow$1=deletePropertyOrThrow$3,toString$8=toString$h,fails$j=fails$L,internalSort$1=arraySort$1,arrayMethodIsStrict$1=arrayMethodIsStrict$4,FF$1=engineFfVersion,IE_OR_EDGE$1=engineIsIeOrEdge,V8$1=engineV8Version,WEBKIT$1=engineWebkitVersion,test=[],nativeSort$1=uncurryThis$k(test.sort),push$6=uncurryThis$k(test.push),FAILS_ON_UNDEFINED=fails$j((function(){test.sort(void 0)})),FAILS_ON_NULL=fails$j((function(){test.sort(null)})),STRICT_METHOD$1=arrayMethodIsStrict$1("sort"),STABLE_SORT$1=!fails$j((function(){if(V8$1)return V8$1<70;if(!(FF$1&&FF$1>3)){if(IE_OR_EDGE$1)return!0;if(WEBKIT$1)return WEBKIT$1<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)test.push({k:t+n,v:r})}for(test.sort((function(e,t){return t.v-e.v})),n=0;n<test.length;n++)t=test[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}})),FORCED$7=FAILS_ON_UNDEFINED||!FAILS_ON_NULL||!STRICT_METHOD$1||!STABLE_SORT$1,getSortCompare$1=function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:toString$8(t)>toString$8(r)?1:-1}};$$m({target:"Array",proto:!0,forced:FORCED$7},{sort:function(e){void 0!==e&&aCallable$3(e);var t=toObject$8(this);if(STABLE_SORT$1)return void 0===e?nativeSort$1(t):nativeSort$1(t,e);var r,n,i=[],o=lengthOfArrayLike$a(t);for(n=0;n<o;n++)n in t&&push$6(i,t[n]);for(internalSort$1(i,getSortCompare$1(e)),r=lengthOfArrayLike$a(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)deletePropertyOrThrow$1(t,n++);return t}});var XG_DEBUG_OPEN="undefined"!=typeof window&&window.location&&window.location.href.indexOf("xgplayerdebugger=1")>-1,STYLE={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},XGTAG="%c[xgplayer]",XG_DEBUG={config:{debug:XG_DEBUG_OPEN?3:0},logInfo:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this.config.debug>=3&&(t=console).log.apply(t,[XGTAG,STYLE.info,e].concat(n))},logWarn:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this.config.debug>=1&&(t=console).warn.apply(t,[XGTAG,STYLE.warn,e].concat(n))},logError:function(e){var t;if(!(this.config.debug<1)){for(var r=this.config.debug>=2?"trace":"error",n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];(t=console)[r].apply(t,[XGTAG,STYLE.error,e].concat(i))}}};function bindDebug(e){e.logInfo=XG_DEBUG.logInfo.bind(e),e.logWarn=XG_DEBUG.logWarn.bind(e),e.logError=XG_DEBUG.logError.bind(e)}var XgplayerTimeRange=function(){function e(t){_classCallCheck$4(this,e),this.bufferedList=t}return _createClass$5(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}(),util={};function checkIsIn(e,t){for(var r=0,n=t.length;r<n;r++)if(e.indexOf(t[r])>-1)return!0;return!1}function isObject$9(e){var t=_typeof$3(e);return null!==e&&("object"===t||"function"===t)}function debounce$2(e,t,r){var n,i,o,a,s,l,c=0,u=!1,h=!1,d=!0,p=!t&&0!==t&&"function"==typeof window.requestAnimationFrame;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var r=n,o=i;return n=i=void 0,c=t,a=e.apply(o,r)}function g(e,t){return p?(window.cancelAnimationFrame(s),window.requestAnimationFrame(e)):setTimeout(e,t)}function y(e){return c=e,s=g(m,t),u?f(e):a}function v(e){var r=e-l;return void 0===l||r>=t||r<0||h&&e-c>=o}function m(){var e=Date.now();if(v(e))return _(e);s=g(m,function(e){var r=e-c,n=t-(e-l);return h?Math.min(n,o-r):n}(e))}function _(e){return s=void 0,d&&n?f(e):(n=i=void 0,a)}function b(){for(var e=Date.now(),r=v(e),o=arguments.length,c=new Array(o),u=0;u<o;u++)c[u]=arguments[u];if(n=c,i=this,l=e,r){if(void 0===s)return y(l);if(h)return s=g(m,t),f(l)}return void 0===s&&(s=g(m,t)),a}return t=+t||0,isObject$9(r)&&(u=!!r.leading,o=(h="maxWait"in r)?Math.max(+r.maxWait||0,t):o,d="trailing"in r?!!r.trailing:d),b.cancel=function(){void 0!==s&&function(e){if(p)return window.cancelAnimationFrame(e);clearTimeout(e)}(s),c=0,n=l=i=s=void 0},b.flush=function(){return void 0===s?a:_(Date.now())},b.pending=function(){return void 0!==s},b}function throttle$1(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return isObject$9(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),debounce$2(e,t,{leading:n,trailing:i,maxWait:t})}function getLang$1(){var e=(document.documentElement.getAttribute("lang")||navigator.language||"zh-cn").toLocaleLowerCase();return"zh-cn"===e&&(e="zh"),e}function checkIsCurrentVideo(e,t,r){if(e){var n=e.getAttribute(r);return!(!n||n!==t||"VIDEO"!==e.tagName&&"AUDIO"!==e.tagName)}}util.createDom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=document.createElement(e);return i.className=n,i.innerHTML=t,Object.keys(r).forEach((function(t){var n=t,o=r[t];"video"===e||"audio"===e||"live-video"===e?o&&i.setAttribute(n,o):i.setAttribute(n,o)})),i},util.createDomFromHtml=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";try{var n=document.createElement("div");n.innerHTML=e;var i=n.children;return n=null,i.length>0?(i=i[0],r&&util.addClass(i,r),t&&Object.keys(t).forEach((function(e){i.setAttribute(e,t[e])})),i):null}catch(o){return XG_DEBUG.logError("util.createDomFromHtml",o),null}},util.hasClass=function(e,t){if(!e||!t)return!1;try{return Array.prototype.some.call(e.classList,(function(e){return e===t}))}catch(n){var r=e.className&&"object"===_typeof$3(e.className)?e.getAttribute("class"):e.className;return r&&!!r.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},util.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(r){util.hasClass(e,t)||(e.className&&"object"===_typeof$3(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},util.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(r){util.hasClass(e,t)&&t.split(/\s+/g).forEach((function(t){var r=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===_typeof$3(e.className)?e.setAttribute("class",e.getAttribute("class").replace(r," ")):e.className=e.className.replace(r," ")}))}},util.toggleClass=function(e,t){e&&t.split(/\s+/g).forEach((function(t){util.hasClass(e,t)?util.removeClass(e,t):util.addClass(e,t)}))},util.classNames=function(){for(var e=arguments,t=[],r=function(r){"String"===util.typeOf(e[r])?t.push(e[r]):"Object"===util.typeOf(e[r])&&Object.keys(e[r]).map((function(n){e[r][n]&&t.push(n)}))},n=0;n<arguments.length;n++)r(n);return t.join(" ")},util.findDom=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,r=arguments.length>1?arguments[1]:void 0;try{e=t.querySelector(r)}catch(n){XG_DEBUG.logError("util.findDom",n),0===r.indexOf("#")&&(e=t.getElementById(r.slice(1)))}return e},util.getCss=function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},util.padStart=function(e,t,r){for(var n=String(r),i=t>>0,o=Math.ceil(i/n.length),a=[],s=String(e);o--;)a.push(n);return a.join("").substring(0,i-s.length)+s},util.format=function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=util.padStart(Math.floor(e/3600),2,0),r=util.padStart(Math.floor((e-3600*t)/60),2,0),n=util.padStart(Math.floor(e-3600*t-60*r),2,0);return("00"===t?[r,n]:[t,r,n]).join(":")},util.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},util.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},util.deepCopy=function(e,t){if("Object"===util.typeOf(t)&&"Object"===util.typeOf(e))return Object.keys(t).forEach((function(r){"Object"!==util.typeOf(t[r])||t[r]instanceof Node?"Array"===util.typeOf(t[r])?e[r]="Array"===util.typeOf(e[r])?e[r].concat(t[r]):t[r]:e[r]=t[r]:void 0===e[r]||void 0===e[r]?e[r]=t[r]:util.deepCopy(e[r],t[r])})),e},util.deepMerge=function(e,t){return Object.keys(t).map((function(r){var n;"Array"===util.typeOf(t[r])&&"Array"===util.typeOf(e[r])?"Array"===util.typeOf(e[r])&&(n=e[r]).push.apply(n,_toConsumableArray(t[r])):util.typeOf(e[r])!==util.typeOf(t[r])||null===e[r]||"Object"!==util.typeOf(e[r])||t[r]instanceof window.Node?null!==t[r]&&(e[r]=t[r]):util.deepMerge(e[r],t[r])})),e},util.getBgImage=function(e){var t=(e.currentStyle||window.getComputedStyle(e,null)).backgroundImage;if(!t||"none"===t)return"";var r=document.createElement("a");return r.href=t.replace(/url\("|"\)/g,""),r.href},util.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""},util.setInterval=function(e,t,r,n){e._interval[t]||(e._interval[t]=window.setInterval(r.bind(e),n))},util.clearInterval=function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},util.setTimeout=function(e,t,r){e._timers||(e._timers=[]);var n=setTimeout((function(){t(),util.clearTimeout(e,n)}),r);return e._timers.push(n),n},util.clearTimeout=function(e,t){var r=e._timers;if("Array"===util.typeOf(r)){for(var n=0;n<r.length;n++)if(r[n]===t){r.splice(n,1),clearTimeout(t);break}}else clearTimeout(t)},util.clearAllTimers=function(e){var t=e._timers;"Array"===util.typeOf(t)&&(t.map((function(e){clearTimeout(e)})),e._timerIds=[])},util.createImgBtn=function(e,t,r,n){var i,o,a,s=util.createDom("xg-".concat(e),"",{},"xgplayer-".concat(e,"-img"));(s.style.backgroundImage='url("'.concat(t,'")'),r&&n)&&(["px","rem","em","pt","dp","vw","vh","vm","%"].every((function(e){return!(r.indexOf(e)>-1&&n.indexOf(e)>-1)||(i=parseFloat(r.slice(0,r.indexOf(e)).trim()),o=parseFloat(n.slice(0,n.indexOf(e)).trim()),a=e,!1)})),s.style.width="".concat(i).concat(a),s.style.height="".concat(o).concat(a),s.style.backgroundSize="".concat(i).concat(a," ").concat(o).concat(a),s.style.margin="start"===e?"-".concat(o/2).concat(a," auto auto -").concat(i/2).concat(a):"auto 5px auto 5px");return s},util.Hex2RGBA=function(e,t){var r=[];if(/^\#[0-9A-F]{3}$/i.test(e)){var n="#";e.replace(/[0-9A-F]/gi,(function(e){n+=e+e})),e=n}return/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,(function(e){r.push(parseInt(e,16))})),"rgba(".concat(r.join(","),", ").concat(t,")")):"rgba(255, 255, 255, 0.1)"},util.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},util.checkIsFunction=function(e){return e&&"function"==typeof e},util.checkIsObject=function(e){return null!==e&&"object"===_typeof$3(e)},util.hide=function(e){e.style.display="none"},util.show=function(e,t){e.style.display=t||"block"},util.isUndefined=function(e){if(null==e)return!0},util.setStyleFromCsstext=function(e,t){t&&("String"===util.typeOf(t)?t.replace(/\s+/g,"").split(";").map((function(t){if(t){var r=t.split(":");r.length>1&&(e.style[r[0]]=r[1])}})):Object.keys(t).map((function(r){e.style[r]=t[r]})))},util.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"],r=e.style.cssText;if(!r)return{};var n=r.replace(/\s+/g,"").split(";"),i={},o={};return n.map((function(e){if(e){var r=e.split(":");r.length>1&&(checkIsIn(r[0],t)?i[r[0]]=r[1]:o[r[0]]=r[1])}})),e.setAttribute("style",""),Object.keys(o).map((function(t){e.style[t]=o[t]})),i},util.getStyleFromCsstext=function(e){var t=e.style.cssText;if(!t)return{};var r=t.replace(/\s+/g,"").split(";"),n={};return r.map((function(e){if(e){var t=e.split(":");t.length>1&&(n[t[0]]=t[1])}})),n},util.preloadImg=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(e){var n=new window.Image;n.onload=function(e){n=null,t&&t(e)},n.onerror=function(e){n=null,r&&r(e)},n.src=e}},util.stopPropagation=function(e){e&&(e.stopPropagation(),e.cancelable&&e.preventDefault())},util.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},util.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},util.checkTouchSupport=function(){return"ontouchstart"in window},util.getBuffered2=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,r=[],n=0;n<e.length;n++)r.push({start:e.start(n)<.5?0:e.start(n),end:e.end(n)});r.sort((function(e,t){var r=e.start-t.start;return r||t.end-e.end}));var i=[];if(t)for(var o=0;o<r.length;o++){var a=i.length;if(a){var s=i[a-1].end;r[o].start-s<t?r[o].end>s&&(i[a-1].end=r[o].end):i.push(r[o])}else i.push(r[o])}else i=r;return new XgplayerTimeRange(i)},util.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}},util.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},util.getHostFromUrl=function(e){if("String"!==util.typeOf(e))return"";var t=e.split("/"),r="";return t.length>3&&t[2]&&(r=t[2]),r},util.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},util.isMSE=function(e){return!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},util.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}t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=parseInt(window.performance.now()));var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}));return r},util.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t};var VERSION_REG={android:/(Android)\s([\d.]+)/,ios:/(Version)\/([\d.]+)/},H264_MIMETYPES=["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"],sniffer$1={get device(){return sniffer$1.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(r){return t[r].test(e)})))[0]},get os(){if("undefined"==typeof navigator)return{};var e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),r=/(?:SymbianOS)/.test(e)||t,n=/(?:Android)/.test(e),i=/(?:Firefox)/.test(e),o=/(?:iPad|PlayBook)/.test(e)||n&&!/(?:Mobile)/.test(e)||i&&/(?:Tablet)/.test(e),a=/(?:iPhone)/.test(e)&&!o,s=!(a||n||r||o),l=/(?:iPad|PlayBook)/.test(e);return{isTablet:o,isPhone:a,isIpad:l,isIos:a||l,isAndroid:n,isPc:s,isSymbian:r,isWindowsPhone:t,isFireFox:i}},get osVersion(){if("undefined"==typeof navigator)return 0;var e=navigator.userAgent,t="",r=(t=/(?:iPhone)|(?:iPad|PlayBook)/.test(e)?VERSION_REG.ios:VERSION_REG.android)?t.exec(e):[];if(r&&r.length>=3){var n=r[2].split(".");return n.length>0?parseInt(n[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&&H264_MIMETYPES.map((function(r){"probably"===t.canPlayType('video/mp4; codecs="'.concat(r,'"'))&&(e.isSupport=!0,e.mime+="||".concat(r))})),this.supportResult=e,t=null,e},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 r=e.video||{},n=e.audio||{};try{var i=MediaSource.isTypeSupported(r.contentType),o=MediaSource.isTypeSupported(n.contentType);return Promise.resolve({supported:i&&o,smooth:!1,powerEfficient:!1})}catch(a){return Promise.resolve(t)}}},version$1="3.0.0-next.54",ERROR_TYPE_MAP={1:"network",2:"network",3:"decoder",4:"format"},Errors=_createClass$5((function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};_classCallCheck$4(this,e);var n=t&&t.i18n?t.i18n.ERROR_TYPES:null;if(t.media){var i=r.mediaError?r.mediaError:t.media.error||{},o=t.duration,a=t.currentTime,s=t.ended,l=t.src,c=t.currentSrc,u=t.media,h=u.readyState,d=u.networkState,p={playerVersion:version$1,currentTime:a,duration:o,ended:s,readyState:h,networkState:d,src:l||c,errorType:r.errorType,errorCode:r.errorCode||i.code,message:r.errorMessage||i.message,mediaError:i,originError:r.originError?r.originError.stack:"",host:util.getHostFromUrl(l||c)};return r.ext&&Object.keys(r.ext).map((function(e){p[e]=r.ext[e]})),p}if(arguments.length>1){for(var f={playerVersion:version$1,domain:document.domain},g=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],y=0;y<arguments.length;y++)f[g[y]]=arguments[y];return f.ex=n?(n[arguments[0]]||{}).msg:"",f}})),PLAY="play",PLAYING="playing",ENDED="ended",PAUSE="pause",ERROR$3="error",SEEKING="seeking",SEEKED="seeked",TIME_UPDATE="timeupdate",WAITING="waiting",CANPLAY="canplay",CANPLAY_THROUGH="canplaythrough",DURATION_CHANGE="durationchange",VOLUME_CHANGE="volumechange",LOADED_DATA="loadeddata",RATE_CHANGE="ratechange",PROGRESS="progress",LOAD_START="loadstart",EMPTIED="emptied",STALLED="stalled",SUSPEND="suspend",ABORT="abort",BUFFER_CHANGE="bufferedChange",PLAYER_FOCUS="focus",PLAYER_BLUR="blur",READY="ready",URL_NULL="urlNull",AUTOPLAY_STARTED="autoplay_started",AUTOPLAY_PREVENTED="autoplay_was_prevented",COMPLETE="complete",REPLAY="replay",DESTROY="destroy",URL_CHANGE="urlchange",DOWNLOAD_SPEED_CHANGE="download_speed_change",FULLSCREEN_CHANGE="fullscreen_change",CSS_FULLSCREEN_CHANGE="cssFullscreen_change",MINI_STATE_CHANGE="mini_state_change",DEFINITION_CHANGE="definition_change",BEFORE_DEFINITION_CHANGE="before_definition_change",AFTER_DEFINITION_CHANGE="after_definition_change",SEI_PARSED="SEI_PARSED",RETRY="retry",VIDEO_RESIZE="video_resize",PIP_CHANGE="pip_change",ROTATE="rotate",SCREEN_SHOT="screenShot",PLAYNEXT="playnext",SHORTCUT="shortcut",XGLOG="xglog",USER_ACTION="user_action",RESET="reset",SWITCH_SUBTITLE="switch_subtitle",VIDEO_EVENTS=["play","playing","ended","pause","error","seeking","seeked","timeupdate","waiting","canplay","canplaythrough","durationchange","volumechange","loadeddata","ratechange","progress","loadstart","emptied","stalled","suspend","abort","lowdecode"],STATS_EVENTS$1={STATS_INFO:"stats_info",STATS_DOWNLOAD:"stats_download",STATS_RESET:"stats_reset"},FPS_STUCK="fps_stuck",Events=Object.freeze(Object.defineProperty({__proto__:null,ABORT:ABORT,AFTER_DEFINITION_CHANGE:AFTER_DEFINITION_CHANGE,AUTOPLAY_PREVENTED:AUTOPLAY_PREVENTED,AUTOPLAY_STARTED:AUTOPLAY_STARTED,BEFORE_DEFINITION_CHANGE:BEFORE_DEFINITION_CHANGE,BUFFER_CHANGE:BUFFER_CHANGE,CANPLAY:CANPLAY,CANPLAY_THROUGH:CANPLAY_THROUGH,COMPLETE:COMPLETE,CSS_FULLSCREEN_CHANGE:CSS_FULLSCREEN_CHANGE,DEFINITION_CHANGE:DEFINITION_CHANGE,DESTROY:DESTROY,DOWNLOAD_SPEED_CHANGE:DOWNLOAD_SPEED_CHANGE,DURATION_CHANGE:DURATION_CHANGE,EMPTIED:EMPTIED,ENDED:ENDED,ERROR:ERROR$3,FPS_STUCK:FPS_STUCK,FULLSCREEN_CHANGE:FULLSCREEN_CHANGE,LOADED_DATA:LOADED_DATA,LOAD_START:LOAD_START,MINI_STATE_CHANGE:MINI_STATE_CHANGE,PAUSE:PAUSE,PIP_CHANGE:PIP_CHANGE,PLAY:PLAY,PLAYER_BLUR:PLAYER_BLUR,PLAYER_FOCUS:PLAYER_FOCUS,PLAYING:PLAYING,PLAYNEXT:PLAYNEXT,PROGRESS:PROGRESS,RATE_CHANGE:RATE_CHANGE,READY:READY,REPLAY:REPLAY,RESET:RESET,RETRY:RETRY,ROTATE:ROTATE,SCREEN_SHOT:SCREEN_SHOT,SEEKED:SEEKED,SEEKING:SEEKING,SEI_PARSED:SEI_PARSED,SHORTCUT:SHORTCUT,STALLED:STALLED,STATS_EVENTS:STATS_EVENTS$1,SUSPEND:SUSPEND,SWITCH_SUBTITLE:SWITCH_SUBTITLE,TIME_UPDATE:TIME_UPDATE,URL_CHANGE:URL_CHANGE,URL_NULL:URL_NULL,USER_ACTION:USER_ACTION,VIDEO_EVENTS:VIDEO_EVENTS,VIDEO_RESIZE:VIDEO_RESIZE,VOLUME_CHANGE:VOLUME_CHANGE,WAITING:WAITING,XGLOG:XGLOG},Symbol.toStringTag,{value:"Module"}));function emitVideoEvent(e,t){this&&this.emit&&("error"===e?this.errorHandler(e,t.error):this.emit(e,t))}function getVideoEventHandler(e,t){return function(r,n){var i={player:t,eventName:e,originalEvent:r,detail:r.detail||{},timeStamp:r.timeStamp,currentTime:t.currentTime,duration:t.duration,paused:t.paused,ended:t.ended,isInternalOp:!!t._internalOp[r.type],muted:t.muted,volume:t.volume,host:util.getHostFromUrl(t.currentSrc),vtype:t.vtype};if(t.removeInnerOP(r.type),"timeupdate"===e&&(t._currentTime=t.media&&t.media.currentTime),"ratechange"===e){var o=t.media?t.media.playbackRate:0;if(o&&t._rate===o)return;t._rate=t.media&&t.media.playbackRate}if("durationchange"===e&&(t._duration=t.media.duration),"volumechange"===e&&(i.isMutedChange=t._lastMuted!==t.muted,t._lastMuted=t.muted),"error"===e&&(i.error=n||t.video.error),t.mediaEventMiddleware[e]){var a=emitVideoEvent.bind(t,e,i);try{t.mediaEventMiddleware[e].call(t,i,a)}catch(s){throw emitVideoEvent.call(t,e,i),s}}else emitVideoEvent.call(t,e,i)}}var MediaProxy=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n;_classCallCheck$4(this,r),(n=t.call(this,e))._hasStart=!1,n._currentTime=0,n._duration=0,n._internalOp={},n._lastMuted=!1,n.vtype="MP4",n._rate=-1,n.mediaConfig=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:0|e.tabindex,mediaType:e.mediaType||"video"},e.videoConfig,e.videoAttributes);var i=e["x5-video-player-type"]||e.x5VideoPlayerType;return sniffer$1.isWeixin&&sniffer$1.os.isAndroid&&i&&(n.mediaConfig["x5-video-player-type"]=i,delete n.mediaConfig.playsinline,delete n.mediaConfig["webkit-playsinline"],delete n.mediaConfig["x5-playsinline"]),e.loop&&(n.mediaConfig.loop="loop"),n.media=util.createDom(n.mediaConfig.mediaType,"",n.mediaConfig,""),e.defaultPlaybackRate&&(n.media.defaultPlaybackRate=n.media.playbackRate=e.defaultPlaybackRate),"Number"===util.typeOf(e.volume)&&(n.volume=e.volume),e.autoplayMuted&&(n.media.muted=!0,n._lastMuted=!0),e.autoplay&&(n.media.autoplay=!0),n._interval={},n.mediaEventMiddleware={},n.attachVideoEvents(),n}return _createClass$5(r,[{key:"setEventsMiddleware",value:function(e){var t=this;Object.keys(e).map((function(r){t.mediaEventMiddleware[r]=e[r]}))}},{key:"removeEventsMiddleware",value:function(e){var t=this;Object.keys(e).map((function(e){delete t.mediaEventMiddleware[e]}))}},{key:"attachVideoEvents",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.media;this._evHandlers||(this._evHandlers=VIDEO_EVENTS.map((function(t){var r="on".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));return"function"==typeof e[r]&&e.on(t,e[r]),_defineProperty$5({},t,getVideoEventHandler(t,e))}))),this._evHandlers.forEach((function(e){var r=Object.keys(e)[0];t.addEventListener(r,e[r],!1)}))}},{key:"detachVideoEvents",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.media;this._evHandlers.forEach((function(e){var r=Object.keys(e)[0];t.removeEventListener(r,e[r],!1)})),this._evHandlers.forEach((function(t){var r=Object.keys(t)[0],n="on".concat(r.charAt(0).toUpperCase()).concat(r.slice(1));"function"==typeof e[n]&&e.off(r,e[n])})),this._evHandlers=null}},{key:"_attachSourceEvents",value:function(e,t){var r=this;e.removeAttribute("src"),e.load(),t.forEach((function(e){r.media.appendChild(util.createDom("source","",{src:"".concat(e.src),type:"".concat(e.type||"")}))}));var n=e.children;if(n){this._videoSourceCount=n.length;for(var i=null,o=0;o<this._evHandlers.length;o++)if("error"===Object.keys(this._evHandlers[o])[0]){i=this._evHandlers[o];break}!this._sourceError&&(this._sourceError=function(e){if(r._videoSourceCount--,0===r._videoSourceCount){var t={code:4,message:"sources load error"};i?i.error(e,t):r.errorHandler("error",t)}});for(var a=0;a<n.length;a++)n[a].addEventListener("error",this._sourceError)}}},{key:"_detachSourceEvents",value:function(e){var t=e.children;if(t&&0!==t.length&&this._sourceError){for(var r=0;r<t.length;r++)t[r].removeEventListener("error",this._sourceError);for(;t.length>0;)e.removeChild(t[0])}}},{key:"errorHandler",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.media&&(this.media.error||t)){var r=this.media.error||t,n=r.code?ERROR_TYPE_MAP[r.code]:"other";r.message;this.media.currentSrc||(r={code:6,message:"empty_src"}),this.emit(e,new Errors(this,{errorType:n,errorCode:r.code,errorMessage:r.message||"",mediaError:r}))}}},{key:"destroy",value:function(){for(var e in this.media&&(this.media.pause&&(this.media.pause(),this.media.muted=!0),this.media.removeAttribute("src"),this.media.load()),this._currentTime=0,this._duration=0,this.mediaConfig=null,this._interval)Object.prototype.hasOwnProperty.call(this._interval,e)&&(clearInterval(this._interval[e]),this._interval[e]=null);this.detachVideoEvents(),this.media=null,this.mediaEventMiddleware={},this.removeAllListeners()}},{key:"video",get:function(){return this.media}},{key:"play",value:function(){return this.media?this.media.play():null}},{key:"pause",value:function(){this.media&&this.media.pause()}},{key:"load",value:function(){this.media&&this.media.load()}},{key:"canPlayType",value:function(e){return!!this.media&&this.media.canPlayType(e)}},{key:"getBufferedRange",value:function(e){var t=[0,0];if(!this.media)return t;e||(e=this.media.buffered);var r=this.media.currentTime;if(e)for(var n=0,i=e.length;n<i&&(t[0]=e.start(n),t[1]=e.end(n),!(t[0]<=r&&r<=t[1]));n++);return t[0]-r<=0&&r-t[1]<=0?t:[0,0]}},{key:"autoplay",get:function(){return!!this.media&&this.media.autoplay},set:function(e){this.media&&(this.media.autoplay=e)}},{key:"buffered",get:function(){return this.media?this.media.buffered:null}},{key:"buffered2",get:function(){return this.media&&this.media.buffered?util.getBuffered2(this.media.buffered):null}},{key:"bufferedPoint",get:function(){var e={start:0,end:0};if(!this.media)return e;var t=this.media.buffered;if(!t||0===t.length)return e;for(var r=0;r<t.length;r++)if((t.start(r)<=this.currentTime||t.start(r)<.1)&&t.end(r)>=this.currentTime)return{start:t.start(r),end:t.end(r)};return e}},{key:"crossOrigin",get:function(){return this.media?this.media.crossOrigin:""},set:function(e){this.media&&(this.media.crossOrigin=e)}},{key:"currentSrc",get:function(){return this.media?this.media.currentSrc:""},set:function(e){this.media&&(this.media.currentSrc=e)}},{key:"currentTime",get:function(){return this.media?void 0!==this.media.currentTime?this.media.currentTime:this._currentTime:0},set:function(e){this.media&&(this.media.currentTime=e)}},{key:"defaultMuted",get:function(){return!!this.media&&this.media.defaultMuted},set:function(e){this.media&&(this.media.defaultMuted=e)}},{key:"duration",get:function(){return this._duration}},{key:"ended",get:function(){return!!this.media&&this.media.ended}},{key:"error",get:function(){return this.media.error}},{key:"errorNote",get:function(){if(!this.media.error)return"";return["MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED"][this.media.error.code-1]}},{key:"loop",get:function(){return!!this.media&&this.media.loop},set:function(e){this.media&&(this.media.loop=e)}},{key:"muted",get:function(){return!!this.media&&this.media.muted},set:function(e){this.media&&this.media.muted!==e&&(this._lastMuted=this.media.muted,this.media.muted=e)}},{key:"networkState",get:function(){return this.media.networkStat}},{key:"paused",get:function(){return!this.media||this.media.paused}},{key:"playbackRate",get:function(){return this.media?this.media.playbackRate:0},set:function(e){this.media&&e!==1/0&&(this.media.defaultPlaybackRate=e,this.media.playbackRate=e)}},{key:"played",get:function(){return this.media?this.media.played:null}},{key:"preload",get:function(){return!!this.media&&this.media.preload},set:function(e){this.media&&(this.media.preload=e)}},{key:"readyState",get:function(){return this.media.readyState}},{key:"seekable",get:function(){return!!this.media&&this.media.seekable}},{key:"seeking",get:function(){return!!this.media&&this.media.seeking}},{key:"src",get:function(){return this.media?this.media.src:""},set:function(e){this.media&&(this.emit(URL_CHANGE,e),this.emit(WAITING),this._currentTime=0,this._duration=0,/^blob/.test(this.media.currentSrc)||/^blob/.test(this.media.src)?this.onWaiting():(this._detachSourceEvents(this.media),"Array"===util.typeOf(e)?this._attachSourceEvents(this.media,e):e?this.media.src=e:this.media.removeAttribute("src"),this.load()))}},{key:"volume",get:function(){return this.media?this.media.volume:0},set:function(e){e!==1/0&&this.media&&(this.media.volume=e)}},{key:"addInnerOP",value:function(e){this._internalOp[e]=!0}},{key:"removeInnerOP",value:function(e){delete this._internalOp[e]}},{key:"emit",value:function(e,t){for(var n,i=arguments.length,o=new Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];(n=_get$2(_getPrototypeOf$4(r.prototype),"emit",this)).call.apply(n,[this,e,t].concat(o))}},{key:"on",value:function(e,t){for(var n,i=arguments.length,o=new Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];(n=_get$2(_getPrototypeOf$4(r.prototype),"on",this)).call.apply(n,[this,e,t].concat(o))}},{key:"once",value:function(e,t){for(var n,i=arguments.length,o=new Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];(n=_get$2(_getPrototypeOf$4(r.prototype),"once",this)).call.apply(n,[this,e,t].concat(o))}},{key:"off",value:function(e,t){for(var n,i=arguments.length,o=new Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];(n=_get$2(_getPrototypeOf$4(r.prototype),"off",this)).call.apply(n,[this,e,t].concat(o))}},{key:"offAll",value:function(){_get$2(_getPrototypeOf$4(r.prototype),"removeAllListeners",this).call(this)}}]),r}(EventEmitter),INDEXDB=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{name:"xgplayer",version:1,db:null,ojstore:{name:"xg-m4a",keypath:"vid"}};_classCallCheck$4(this,e),this.indexedDB=window.indexedDB||window.webkitindexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange,this.myDB=t}return _createClass$5(e,[{key:"openDB",value:function(e){var t=this,r=this,n=this.myDB.version||1,i=r.indexedDB.open(r.myDB.name,n);i.onerror=function(e){},i.onsuccess=function(n){t.myDB.db=n.target.result,e.call(r)},i.onupgradeneeded=function(e){var t=e.target.result;e.target.transaction,t.objectStoreNames.contains(r.myDB.ojstore.name)||t.createObjectStore(r.myDB.ojstore.name,{keyPath:r.myDB.ojstore.keypath})}}},{key:"deletedb",value:function(){this.indexedDB.deleteDatabase(this.myDB.name)}},{key:"closeDB",value:function(){this.myDB.db.close()}},{key:"addData",value:function(e,t){for(var r,n=this.myDB.db.transaction(e,"readwrite").objectStore(e),i=0;i<t.length;i++)(r=n.add(t[i])).onerror=function(){},r.onsuccess=function(){}}},{key:"putData",value:function(e,t){for(var r,n=this.myDB.db.transaction(e,"readwrite").objectStore(e),i=0;i<t.length;i++)(r=n.put(t[i])).onerror=function(){},r.onsuccess=function(){}}},{key:"getDataByKey",value:function(e,t,r){var n=this,i=this.myDB.db.transaction(e,"readwrite").objectStore(e).get(t);i.onerror=function(){r.call(n,null)},i.onsuccess=function(e){var t=e.target.result;r.call(n,t)}}},{key:"deleteData",value:function(e,t){this.myDB.db.transaction(e,"readwrite").objectStore(e).delete(t)}},{key:"clearData",value:function(e){this.myDB.db.transaction(e,"readwrite").objectStore(e).clear()}}]),e}(),FULLSCREEN_EVENTS=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],GET_FULLSCREEN_API=["requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen"],EXIT_FULLSCREEN_API=["exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen"],PLATER_ID="data-xgplayerid";function callHandler(e,t,r){for(var n=arguments.length,i=new Array(n>3?n-3:0),o=3;o<n;o++)i[o-3]=arguments[o];var a=t.call.apply(t,[e].concat(i));r&&"function"==typeof r&&(a&&a.then?a.then((function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];r.call.apply(r,[e].concat(n))})):r.call.apply(r,[e].concat(i)))}function hook(e,t){var r=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 n=arguments,i=this;if(r.pre)try{var o;(o=r.pre).call.apply(o,[this].concat(Array.prototype.slice.call(arguments)))}catch(l){throw l.message="[pluginName: ".concat(this.pluginName,":").concat(e,":pre error] >> ").concat(l.message),l}if(this.__hooks&&this.__hooks[e])try{var a,s=(a=this.__hooks[e]).call.apply(a,[this,this].concat(Array.prototype.slice.call(arguments)));s?s.then?s.then((function(e){!1!==e&&callHandler.apply(void 0,[i,t,r.next].concat(_toConsumableArray(n)))})).catch((function(e){throw e})):callHandler.apply(void 0,[this,t,r.next].concat(Array.prototype.slice.call(arguments))):void 0===s&&callHandler.apply(void 0,[this,t,r.next].concat(Array.prototype.slice.call(arguments)))}catch(l){throw l.message="[pluginName: ".concat(this.pluginName,":").concat(e,"] >> ").concat(l.message),l}else callHandler.apply(void 0,[this,t,r.next].concat(Array.prototype.slice.call(arguments)))}.bind(this)}function useHooks(e,t){var r=this.__hooks;if(r)return r.hasOwnProperty(e)?(r&&(r[e]=t),!0):(console.warn("has no supported hook which name [".concat(e,"]")),!1)}function removeHooks(e,t){var r=this.__hooks;r&&delete r[e]}function usePluginHooks(e){if(this.plugins&&this.plugins[e.toLowerCase()]){for(var t=this.plugins[e.toLowerCase()],r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return t.useHooks&&t.useHooks.apply(t,n)}}function removePluginHooks(e){if(this.plugins&&this.plugins[e.toLowerCase()]){var t=this.plugins[e.toLowerCase()];if(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return t.removeHooks&&t.removeHooks.apply(t,n)}}}function hooksDescriptor(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}))}})}function delHooksDescriptor(e){e.__hooks=null}function runHooks(e,t,r){for(var n=arguments.length,i=new Array(n>3?n-3:0),o=3;o<n;o++)i[o-3]=arguments[o];if(!e.__hooks||!e.__hooks[t])return r.call.apply(r,[e,e].concat(i));var a,s=(a=e.__hooks[t]).call.apply(a,[e,e].concat(i));if(s&&s.then)s.then((function(t){return!1===t?null:r.call.apply(r,[e,e].concat(i))})).catch((function(e){console.warn("[runHooks]".concat(t," reject"),e.message)}));else if(!1!==s)return r.call.apply(r,[e,e].concat(i))}function showErrorMsg(e,t){XG_DEBUG.logError("[".concat(e,"] event or callback cant be undefined or null when call ").concat(t))}var BasePlugin=function(){function e(t){_classCallCheck$4(this,e),util.checkIsFunction(this.beforeCreate)&&this.beforeCreate(t),hooksDescriptor(this),this.__args=t,this.__events={},this.__onceEvents={},this.config=t.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(t)}return _createClass$5(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=util.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 r=this;e&&t&&this.player?"string"==typeof e?(this.__events[e]=t,this.player.on(e,t)):Array.isArray(e)&&e.forEach((function(e){r.__events[e]=t,r.player.on(e,t)})):showErrorMsg(this.pluginName,"plugin.on(event, callback)")}},{key:"once",value:function(e,t){var r=this;e&&t&&this.player?"string"==typeof e?(this.__onceEvents[e]=t,this.player.once(e,t)):Array.isArray(e)&&e.forEach((function(n){r.__onceEvents[n]=t,r.player.once(e,t)})):showErrorMsg(this.pluginName,"plugin.once(event, callback)")}},{key:"off",value:function(e,t){var r=this;e&&t&&this.player?"string"==typeof e?(delete this.__events[e],this.player.off(e,t)):Array.isArray(e)&&e.forEach((function(n){delete r.__events[e],r.player.off(n,t)})):showErrorMsg(this.pluginName,"plugin.off(event, callback)")}},{key:"offAll",value:function(){var e=this;["__events","__onceEvents"].forEach((function(t){Object.keys(e[t]).forEach((function(r){e[t][r]&&e.off(r,e[t][r]),r&&delete e[t][r]}))})),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(e){var t;if(this.player){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];(t=this.player).emit.apply(t,[e].concat(n))}}},{key:"emitUserAction",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this.player){var n=_objectSpread2$4(_objectSpread2$4({},r),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,n)}}},{key:"hook",value:function(e,t){return hook.call.apply(hook,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return useHooks.call.apply(useHooks,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return removeHooks.call.apply(removeHooks,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"registerPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.player)return r&&(t.pluginName=r),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,r=this.pluginName;this.offAll(),util.clearAllTimers(this),util.checkIsFunction(this.destroy)&&this.destroy(),["player","playerConfig","pluginName","logger","__args","__hooks"].map((function(t){e[t]=null})),t.unRegisterPlugin(r),delHooksDescriptor(this)}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&Object.defineProperty(e,r,t[r])}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]),e}(),DOCUMENT_NODE_TYPE=9;if("undefined"!=typeof Element&&!Element.prototype.matches){var proto=Element.prototype;proto.matches=proto.matchesSelector||proto.mozMatchesSelector||proto.msMatchesSelector||proto.oMatchesSelector||proto.webkitMatchesSelector}function closest$2(e,t){for(;e&&e.nodeType!==DOCUMENT_NODE_TYPE;){if("function"==typeof e.matches&&e.matches(t))return e;e=e.parentNode}}var closest_1=closest$2,closest$1=closest_1;function _delegate(e,t,r,n,i){var o=listener.apply(this,arguments);return e.addEventListener(r,o,i),{destroy:function(){e.removeEventListener(r,o,i)}}}function delegate(e,t,r,n,i){return"function"==typeof e.addEventListener?_delegate.apply(null,arguments):"function"==typeof r?_delegate.bind(null,document).apply(null,arguments):("string"==typeof e&&(e=document.querySelectorAll(e)),Array.prototype.map.call(e,(function(e){return _delegate(e,t,r,n,i)})))}function listener(e,t,r,n){return function(r){r.delegateTarget=closest$1(r.target,t),r.delegateTarget&&n.call(e,r)}}var delegate_1=delegate,ROOT_TYPES={CONTROLS:"controls",ROOT:"root"},POSITIONS$a={ROOT:"root",ROOT_LEFT:"rootLeft",ROOT_RIGHT:"rootRight",ROOT_TOP:"rootTop",CONTROLS_LEFT:"controlsLeft",CONTROLS_RIGTH:"controlsRight",CONTROLS_RIGHT:"controlsRight",CONTROLS_CENTER:"controlsCenter",CONTROLS:"controls"};function isUrl$1(e){return!!e&&(e.indexOf&&/^(?:http|data:|\/)/.test(e))}function mergeIconClass(e,t){return"object"===_typeof$3(e)&&e.class&&"string"==typeof e.class?"".concat(t," ").concat(e.class):t}function mergeIconAttr(e,t){return"object"===_typeof$3(e)&&e.attr&&"object"===_typeof$3(e.attr)&&Object.keys(e.attr).map((function(r){t[r]=e.attr[r]})),t}function createIcon(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=null;if(e instanceof window.Element)return util.addClass(e,r),Object.keys(n).map((function(t){e.setAttribute(t,n[t])})),e;if(isUrl$1(e)||isUrl$1(e.url))return n.src=isUrl$1(e)?e:e.url||"",o=util.createDom(e.tag||"img","",n,"xg-img ".concat(r));if("function"==typeof e)try{return(o=e())instanceof window.Element?(util.addClass(o,r),Object.keys(n).map((function(e){o.setAttribute(e,n[e])})),o):(XG_DEBUG.logWarn("warn>>icons.".concat(t," in config of plugin named [").concat(i,"] is a function mast return an Element Object")),null)}catch(a){return XG_DEBUG.logError("Plugin named [".concat(i,"]:createIcon"),a),null}return"string"==typeof e?util.createDomFromHtml(e,n,r):(XG_DEBUG.logWarn("warn>>icons.".concat(t," in config of plugin named [").concat(i,"] is invalid")),null)}function registerIconsObj(e,t){var r=t.config.icons||t.playerConfig.icons;Object.keys(e).map((function(n){var i=e[n],o=i&&i.class?i.class:"",a=i&&i.attr?i.attr:{},s=null;r&&r[n]&&(o=mergeIconClass(r[n],o),a=mergeIconAttr(r[n],a),s=createIcon(r[n],n,o,a,t.pluginName)),!s&&i&&(s=createIcon(i.icon?i.icon:i,a,o,{},t.pluginName)),t.icons[n]=s}))}function registerTextObj(e,t){Object.keys(e).map((function(r){Object.defineProperty(t.langText,r,{get:function(){var n=t.lang,i=t.i18n;return i[r]?i[r]:e[r]&&e[r][n]||""}})}))}var Plugin=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck$4(this,r),(e=t.call(this,n)).__delegates=[],e}return _createClass$5(r,[{key:"__init",value:function(e){if(_get$2(_getPrototypeOf$4(r.prototype),"__init",this).call(this,e),e.root){var t=e.root,n=null;this.icons={},this.root=null,this.parent=null,registerIconsObj(this.registerIcons()||{},this),this.langText={},registerTextObj(this.registerLanguageTexts()||{},this);var i="";try{i=this.render()}catch(s){throw XG_DEBUG.logError("Plugin:".concat(this.pluginName,":render"),s),new Error("Plugin:".concat(this.pluginName,":render:").concat(s.message))}if(i)(n=r.insert(i,t,e.index)).setAttribute("data-index",e.index);else{if(!e.tag)return;(n=util.createDom(e.tag,"",e.attr,e.name)).setAttribute("data-index",e.index),t.appendChild(n)}this.root=n,this.parent=t;var o=this.config.attr||{},a=this.config.style||{};this.setAttr(o),this.setStyle(a),this.config.index&&this.root.setAttribute("data-index",this.config.index),this.__registerChildren()}}},{key:"__registerChildren",value:function(){var e=this;if(this.root){this._children=[];var t=this.children();t&&"object"===_typeof$3(t)&&Object.keys(t).length>0&&Object.keys(t).map((function(r){var n,i,o=r,a=t[o],s={root:e.root};"function"==typeof a?(n=e.config[o]||{},i=a):"object"===_typeof$3(a)&&"function"==typeof a.plugin&&(n=a.options?util.deepCopy(e.config[o]||{},a.options):e.config[o]||{},i=a.plugin),s.config=n,void 0!==n.index&&(s.index=n.index),n.root&&(s.root=n.root),e.registerPlugin(i,s,o)}))}}},{key:"updateLang",value:function(e){e||(e=this.lang);var t=this.root,r=this.i18n,n=this.langText;t&&function e(t,r){for(var n=0;n<t.children.length;n++)t.children[n].children.length>0?e(t.children[n],r):r(t.children[n])}(t,(function(t){var i=t.getAttribute&&t.getAttribute("lang-key");if(i){var o=r[i.toUpperCase()]||n[i];o&&(t.innerHTML="function"==typeof o?o(e):o)}}))}},{key:"lang",get:function(){return this.player.lang}},{key:"changeLangTextKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=this.i18n||{},n=this.langText;e.setAttribute&&e.setAttribute("lang-key",t);var i=r[t]||n[t]||"";i&&(e.innerHTML=i)}},{key:"plugins",value:function(){return this._children}},{key:"children",value:function(){return{}}},{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]:"";t.root=t.root||this.root;var i=_get$2(_getPrototypeOf$4(r.prototype),"registerPlugin",this).call(this,e,t,n);return this._children.push(i),i}},{key:"registerIcons",value:function(){return{}}},{key:"registerLanguageTexts",value:function(){return{}}},{key:"find",value:function(e){if(this.root)return this.root.querySelector(e)}},{key:"bind",value:function(e,t,n){var i=this;if(arguments.length<3&&"function"==typeof t)Array.isArray(e)?e.forEach((function(e){i.bindEL(e,t)})):this.bindEL(e,t);else{var o=r.delegate.call(this,this.root,e,t,n);this.__delegates=this.__delegates.concat(o)}}},{key:"unbind",value:function(e,t){var r=this;if(arguments.length<3&&"function"==typeof t)Array.isArray(e)?e.forEach((function(e){r.unbindEL(e,t)})):this.unbindEL(e,t);else for(var n="".concat(e,"_").concat(t),i=0;i<this.__delegates.length;i++)if(this.__delegates[i].key===n){this.__delegates[i].destroy(),this.__delegates.splice(i,1);break}}},{key:"setStyle",value:function(e,t){var r=this;if(this.root)return"String"===util.typeOf(e)?this.root.style[e]=t:void("Object"===util.typeOf(e)&&Object.keys(e).map((function(t){r.root.style[t]=e[t]})))}},{key:"setAttr",value:function(e,t){var r=this;if(this.root)return"String"===util.typeOf(e)?this.root.setAttribute(e,t):void("Object"===util.typeOf(e)&&Object.keys(e).map((function(t){r.root.setAttribute(t,e[t])})))}},{key:"setHtml",value:function(e,t){this.root&&(this.root.innerHTML=e,"function"==typeof t&&t())}},{key:"bindEL",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.root&&"on".concat(e)in this.root&&"function"==typeof t&&this.root.addEventListener(e,t,r)}},{key:"unbindEL",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.root&&"on".concat(e)in this.root&&"function"==typeof t&&this.root.removeEventListener(e,t,r)}},{key:"show",value:function(e){if(this.root)return this.root.style.display=void 0!==e?e:"block","none"===window.getComputedStyle(this.root,null).getPropertyValue("display")?this.root.style.display="block":void 0}},{key:"hide",value:function(){this.root&&(this.root.style.display="none")}},{key:"appendChild",value:function(e,t){if(!this.root)return null;if(arguments.length<2&&arguments[0]instanceof window.Element)return this.root.appendChild(arguments[0]);if(!(t&&t instanceof window.Element))return null;try{return"string"==typeof e?this.find(e).appendChild(t):e.appendChild(t)}catch(r){return XG_DEBUG.logError("Plugin:appendChild",r),null}}},{key:"render",value:function(){return""}},{key:"destroy",value:function(){}},{key:"__destroy",value:function(){var e=this,t=this.player;this.__delegates.map((function(e){e.destroy()})),this.__delegates=[],this._children instanceof Array&&(this._children.map((function(e){t.unRegisterPlugin(e.pluginName)})),this._children=null),this.root&&(this.root.hasOwnProperty("remove")?this.root.remove():this.root.parentNode&&this.root.parentNode.removeChild(this.root)),_get$2(_getPrototypeOf$4(r.prototype),"__destroy",this).call(this),this.icons={},["root","parent"].map((function(t){e[t]=null}))}}],[{key:"insert",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=t.children.length,i=Number(r),o=e instanceof window.Node;if(n){for(var a=0,s=null,l="";a<n;a++){s=t.children[a];var c=Number(s.getAttribute("data-index"));if(c>=i){l="beforebegin";break}c<i&&(l="afterend")}return o?"afterend"===l?t.appendChild(e):t.insertBefore(e,s):s.insertAdjacentHTML(l,e),"afterend"===l?t.children[t.children.length-1]:t.children[a]}return o?t.appendChild(e):t.insertAdjacentHTML("beforeend",e),t.children[t.children.length-1]}},{key:"defaultConfig",get:function(){return{}}},{key:"delegate",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=[];if(e instanceof window.Node&&"function"==typeof n)if(Array.isArray(r))r.forEach((function(r){var a=delegate_1(e,t,r,n,i);a.key="".concat(t,"_").concat(r),o.push(a)}));else{var a=delegate_1(e,t,r,n,i);a.key="".concat(t,"_").concat(r),o.push(a)}return o}},{key:"ROOT_TYPES",get:function(){return ROOT_TYPES}},{key:"POSITIONS",get:function(){return POSITIONS$a}}]),r}(BasePlugin),charAt$5=stringMultibyte.charAt,toString$7=toString$h,InternalStateModule$6=internalState,defineIterator=iteratorDefine,createIterResultObject=createIterResultObject$2,STRING_ITERATOR="String Iterator",setInternalState$5=InternalStateModule$6.set,getInternalState$4=InternalStateModule$6.getterFor(STRING_ITERATOR);defineIterator(String,"String",(function(e){setInternalState$5(this,{type:STRING_ITERATOR,string:toString$7(e),index:0})}),(function(){var e,t=getInternalState$4(this),r=t.string,n=t.index;return n>=r.length?createIterResultObject(void 0,!0):(e=charAt$5(r,n),t.index+=e.length,createIterResultObject(e,!1))}));var ResizeObserver$1=function(){function e(){var t=this;if(_classCallCheck$4(this,e),_defineProperty$5(this,"__trigger",(function(e){var r=(new Date).getTime();t.timeStamp=r;for(var n=0;n<e.length;n++)t.__runHandler(e[n].target)})),this.__handlers=[],this.timeStamp=0,this.observer=null,window.ResizeObserver)try{this.observer=new window.ResizeObserver(throttle$1(this.__trigger,100,{trailing:!0})),this.timeStamp=(new Date).getTime()}catch(r){console.error(r)}}return _createClass$5(e,[{key:"addObserver",value:function(e,t){if(this.observer){this.observer&&this.observer.observe(e);for(var r=e.getAttribute(PLATER_ID),n=this.__handlers,i=-1,o=0;o<n.length;o++)n[o]&&e===n[o].target&&(i=o);i>-1?this.__handlers[i].handler=t:this.__handlers.push({target:e,handler:t,playerId:r})}}},{key:"unObserver",value:function(e){var t=-1;this.__handlers.map((function(r,n){e===r.target&&(t=n)}));try{this.observer&&this.observer.unobserve(e)}catch(r){}this.observer&&this.observer.unobserve(e),t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e){for(var t=this.__handlers,r=0;r<t.length;r++)if(t[r]&&e===t[r].target){try{t[r].handler(e)}catch(error){console.error(error)}return!0}return!1}}]),e}(),resizeObserver$1=null;function addObserver$1(e,t){return resizeObserver$1||(resizeObserver$1=new ResizeObserver$1),resizeObserver$1.addObserver(e,t),resizeObserver$1}function unObserver$1(e,t){resizeObserver$1.unObserver(e,t)}var pluginsManager={pluginGroup:{},init:function(e){var t=e._pluginInfoId;t||(t=(new Date).getTime(),e._pluginInfoId=t),!e.config.closeResizeObserver&&addObserver$1(e.root,(function(){e.resize()})),0===Object.keys(this.pluginGroup).length&&(e.isUserActive=!0),this.pluginGroup[t]={_player:e,_originalOptions:e.config||{},_plugins:{}}},checkPlayerRoot:function(e){if(this.pluginGroup){for(var t=Object.keys(this.pluginGroup),r=0;r<t.length;r++){var n=this.pluginGroup[t[r]]._player;if(n.root===e)return n}return null}return null},formatPluginInfo:function(e,t){var r=null,n=null;return e.plugin&&"function"==typeof e.plugin?(r=e.plugin,n=e.options):(r=e,n={}),t&&(n.config=t||{}),{PLUFGIN:r,options:n}},checkPluginIfExits:function(e,t){for(var r=0;r<t.length;r++)if(e.toLowerCase()===t[r].pluginName.toLowerCase())return!0;return!1},getRootByConfig:function(e,t){for(var r=Object.keys(t),n=null,i=0;i<r.length;i++)if(e.toLowerCase()===r[i].toLowerCase()){n=t[r[i]];break}return"Object"===util.typeOf(n)?{root:n.root,position:n.position}:{}},lazyRegister:function(e,t){var r=this,n=t.timeout||1500;return Promise.race([t.loader().then((function(t){var n;n=t&&t.__esModule?t.default:t,r.register(e,n,t.options)})),new Promise((function(e,t){setTimeout((function(){t(new Error("timeout"))}),n)}))])},register:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e&&t&&"function"==typeof t&&void 0!==t.prototype){var n=e._pluginInfoId;if(n&&this.pluginGroup[n]){this.pluginGroup[n]._plugins||(this.pluginGroup[n]._plugins={});var i=this.pluginGroup[n]._plugins,o=this.pluginGroup[n]._originalOptions;r.player=this.pluginGroup[n]._player;var a=r.pluginName||t.pluginName;if(!a)throw new Error("The property pluginName is necessary");if(!t.isSupported||t.isSupported(e.config.mediaType,e.config.codecType)){r.config||(r.config={});for(var s=Object.keys(o),l=0;l<s.length;l++)if(a.toLowerCase()===s[l].toLowerCase()){var c=o[s[l]];"Object"===util.typeOf(c)?r.config=Object.assign({},r.config,o[s[l]]):"Boolean"===util.typeOf(c)&&(r.config.disable=!c);break}t.defaultConfig&&Object.keys(t.defaultConfig).forEach((function(e){void 0===r.config[e]&&(r.config[e]=t.defaultConfig[e])})),r.root?"string"==typeof r.root&&(r.root=e[r.root]):r.root=e.root,r.index=r.config.index||0;try{i[a.toLowerCase()]&&(this.unRegister(n,a.toLowerCase()),console.warn("the is one plugin with same pluginName [".concat(a,"] exist, destroy the old instance")));var u=new t(r);return i[a.toLowerCase()]=u,i[a.toLowerCase()].func=t,u&&"function"==typeof u.afterCreate&&u.afterCreate(),u}catch(h){throw console.error(h),h}}else console.warn("not supported plugin [".concat(a,"]"))}}},unRegister:function(e,t){e._pluginInfoId&&(e=e._pluginInfoId),t=t.toLowerCase();try{var r=this.pluginGroup[e]._plugins[t];r&&(r.pluginName&&r.__destroy(),delete this.pluginGroup[e]._plugins[t])}catch(n){console.error("[unRegister:".concat(t,"] cgid:[").concat(e,"] error"),n)}},deletePlugin:function(e,t){var r=e._pluginInfoId;r&&this.pluginGroup[r]&&this.pluginGroup[r]._plugins&&delete this.pluginGroup[r]._plugins[t]},getPlugins:function(e){var t=e._pluginInfoId;return t&&this.pluginGroup[t]?this.pluginGroup[t]._plugins:{}},findPlugin:function(e,t){var r=e._pluginInfoId;if(!r||!this.pluginGroup[r])return null;var n=t.toLowerCase();return this.pluginGroup[r]._plugins[n]},beforeInit:function(e){var t=this;function r(e){return e&&e.then?e:new Promise((function(e){e()}))}return new Promise((function(n){if(t.pluginGroup)return(e._loadingPlugins&&e._loadingPlugins.length?Promise.all(e._loadingPlugins):Promise.resolve()).then((function(){var i=e._pluginInfoId;if(t.pluginGroup[i]){var o=t.pluginGroup[i]._plugins,a=[];Object.keys(o).forEach((function(e){if(o[e]&&o[e].beforePlayerInit)try{var t=o[e].beforePlayerInit();a.push(r(t))}catch(n){throw a.push(r(null)),n}})),Promise.all([].concat(a)).then((function(){n()})).catch((function(e){console.error(e),n()}))}else n()}))}))},afterInit:function(e){var t=e._pluginInfoId;if(t&&this.pluginGroup[t]){var r=this.pluginGroup[t]._plugins;Object.keys(r).forEach((function(e){r[e]&&r[e].afterPlayerInit&&r[e].afterPlayerInit()}))}},setLang:function(e,t){var r=t._pluginInfoId;if(r&&this.pluginGroup[r]){var n=this.pluginGroup[r]._plugins;Object.keys(n).forEach((function(t){if(n[t].updateLang)n[t].updateLang(e);else try{n[t].lang=e}catch(error){console.warn("".concat(t," setLang"))}}))}},reRender:function(e){var t=this,r=e._pluginInfoId;if(r&&this.pluginGroup[r]){var n=[],i=this.pluginGroup[r]._plugins;Object.keys(i).forEach((function(e){"controls"!==e&&i[e]&&(n.push({plugin:i[e].func,options:i[e].__args}),t.unRegister(r,e))})),n.forEach((function(r){t.register(e,r.plugin,r.options)}))}},onPluginsReady:function(e){var t=e._pluginInfoId;if(t&&this.pluginGroup[t]){var r=this.pluginGroup[t]._plugins||{};Object.keys(r).forEach((function(e){r[e].onPluginsReady&&"function"==typeof r[e].onPluginsReady&&r[e].onPluginsReady()}))}},setCurrentUserActive:function(e,t){if(this.pluginGroup[e]){if(!t)return this.pluginGroup[e]._player.isUserActive=t,e;for(var r=Object.keys(this.pluginGroup),n=0;n<r.length;n++){var i=this.pluginGroup[r[n]];i&&i._player&&(this.pluginGroup[r[n]]._player.isUserActive=!1)}return this.pluginGroup[e]._player.isUserActive=t,e}},getCurrentUseActiveId:function(){if(this.pluginGroup){for(var e=Object.keys(this.pluginGroup),t=0;t<e.length;t++){var r=this.pluginGroup[e[t]];if(r&&r._player&&r._player.isUserActive)return e[t]}return null}},destroy:function(e){var t=e._pluginInfoId;if(this.pluginGroup[t]){unObserver$1(e.root);for(var r=this.pluginGroup[t]._plugins,n=0,i=Object.keys(r);n<i.length;n++){var o=i[n];this.unRegister(t,o)}var a=e.isUseActive;if(delete this.pluginGroup[t],delete e._pluginInfoId,a){var s=Object.keys(this.pluginGroup);s.length>0&&this.setCurrentUserActive(s[s.length-1],!0)}}}},STATE_CLASS={DEFAULT:"xgplayer",DEFAULT_SKIN:"xgplayer-skin-default",ENTER:"xgplayer-is-enter",PAUSED:"xgplayer-pause",PLAYING:"xgplayer-playing",ENDED:"xgplayer-ended",CANPLAY:"xgplayer-canplay",LOADING:"xgplayer-isloading",ERROR:"xgplayer-is-error",REPLAY:"xgplayer-replay",NO_START:"xgplayer-nostart",ACTIVE:"xgplayer-active",INACTIVE:"xgplayer-inactive",FULLSCREEN:"xgplayer-is-fullscreen",CSS_FULLSCREEN:"xgplayer-is-cssfullscreen",ROTATE_FULLSCREEN:"xgplayer-rotate-fullscreen",PARENT_ROTATE_FULLSCREEN:"xgplayer-rotate-parent",PARENT_FULLSCREEN:"xgplayer-fullscreen-parent",INNER_FULLSCREEN:"xgplayer-fullscreen-inner",NO_CONTROLS:"no-controls",FLEX_CONTROLS:"flex-controls",CONTROLS_FOLLOW:"controls-follow",CONTROLS_AUTOHIDE:"controls-autohide",TOP_BAR_AUTOHIDE:"top-bar-autohide",NOT_ALLOW_AUTOPLAY:"not-allow-autoplay",SEEKING:"seeking",PC:"xgplayer-pc",MOBILE:"xgplayer-mobile",MINI:"xgplayer-mini"};function getDefaultConfig$1(){return{id:"",el:null,url:"",domEventType:"default",nullUrlStart:!1,width:600,height:337.5,fluid:!1,fitVideoSize:"fixed",videoFillMode:"auto",volume:.6,autoplay:!1,autoplayMuted:!1,loop:!1,isLive:!1,zoom:1,videoInit:!0,poster:"",isMobileSimulateMode:!1,defaultPlaybackRate:1,execBeforePluginsCall:null,allowSeekAfterEnded:!0,enableContextmenu:!0,closeVideoClick:!1,closeVideoDblclick:!1,closePlayerBlur:!1,closeDelayBlur:!1,leavePlayerTime:3e3,closePlayVideoFocus:!1,closePauseVideoFocus:!1,closeFocusVideoFocus:!0,closeControlsBlur:!0,topBarAutoHide:!0,videoAttributes:{},startTime:0,seekedStatus:"play",miniprogress:!1,disableSwipeHandler:function(){},enableSwipeHandler:function(){},ignores:[],whitelist:[],inactive:3e3,lang:getLang$1(),controls:!0,marginControls:!1,fullscreenTarget:null,screenShot:!1,rotate:!1,pip:!1,download:!1,mini:!1,cssFullscreen:!0,keyShortcut:!0,presets:[],plugins:[],playbackRate:1,definition:{list:[]},playsinline:!0,customDuration:0,timeOffset:0,icons:{},i18n:[],tabindex:0,thumbnail:null,videoConfig:{},commonStyle:{progressColor:"",playedColor:"",cachedColor:"",sliderBtnStyle:{},volumeColor:""}}}var usePreset=function(e,t){var r,n,i=t.preset&&t.options?new t.preset(t.options,e.config):new t({},e.config),o=i.plugins,a=void 0===o?[]:o,s=i.ignores,l=void 0===s?[]:s,c=i.icons,u=void 0===c?{}:c,h=i.i18n,d=void 0===h?[]:h;e.config.plugins||(e.config.plugins=[]),e.config.ignores||(e.config.ignores=[]),(r=e.config.plugins).push.apply(r,_toConsumableArray(a)),(n=e.config.ignores).push.apply(n,_toConsumableArray(l)),Object.keys(u).map((function(t){e.config.icons[t]||(e.config.icons[t]=u[t])}));var p=e.config.i18n||[];d.push.apply(d,_toConsumableArray(p)),e.config.i18n=d},Controls=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return _defineProperty$5(_assertThisInitialized$4(e=t.call.apply(t,[this].concat(i))),"onMouseEnter",(function(t){var r=_assertThisInitialized$4(e),n=r.player;r.playerConfig.closeControlsBlur&&n.focus({autoHide:!1})})),_defineProperty$5(_assertThisInitialized$4(e),"onMouseLeave",(function(){_assertThisInitialized$4(e).player.focus()})),e}return _createClass$5(r,[{key:"beforeCreate",value:function(e){e.config.mode||"mobile"!==sniffer$1.device||(e.config.mode="flex"),e.player.config.marginControls&&(e.config.autoHide=!1)}},{key:"afterCreate",value:function(){var e=this,t=this.config,r=t.disable,n=t.height,i=t.mode;if(!r){"flex"===i&&this.player.addClass(STATE_CLASS.FLEX_CONTROLS);var o={height:"".concat(n,"px")};Object.keys(o).map((function(t){e.root.style[t]=o[t]})),this.left=this.find("xg-left-grid"),this.center=this.find("xg-center-grid"),this.right=this.find("xg-right-grid"),this.innerRoot=this.find("xg-inner-controls"),this.on(MINI_STATE_CHANGE,(function(t){t?util.addClass(e.root,"mini-controls"):util.removeClass(e.root,"mini-controls")}));var a=this.playerConfig.isMobileSimulateMode;"mobile"!==sniffer$1.device&&"mobile"!==a&&(this.bind("mouseenter",this.onMouseEnter),this.bind("mouseleave",this.onMouseLeave))}}},{key:"focus",value:function(){this.player.focus({autoHide:!1})}},{key:"focusAwhile",value:function(){this.player.focus({autoHide:!0})}},{key:"blur",value:function(){this.player.blur({ignorePaused:!0})}},{key:"recoverAutoHide",value:function(){this.config.autoHide&&util.addClass(this.root,STATE_CLASS.CONTROLS_AUTOHIDE)}},{key:"pauseAutoHide",value:function(){util.removeClass(this.root,STATE_CLASS.CONTROLS_AUTOHIDE)}},{key:"show",value:function(){util.addClass(this.root,"show")}},{key:"hide",value:function(){util.removeClass(this.root,"show")}},{key:"mode",get:function(){return this.config.mode}},{key:"registerPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if(this.root){var i=e.defaultConfig||{};if(!t.root){var o=t.position?t.position:t.config&&t.config.position?t.config.position:i.position;switch(o){case POSITIONS$a.CONTROLS_LEFT:t.root=this.left;break;case POSITIONS$a.CONTROLS_RIGHT:t.root=this.right;break;case POSITIONS$a.CONTROLS_CENTER:t.root=this.center;break;case POSITIONS$a.CONTROLS:t.root=this.root;break;default:t.root=this.left}return _get$2(_getPrototypeOf$4(r.prototype),"registerPlugin",this).call(this,e,t,n)}}}},{key:"destroy",value:function(){"mobile"!==sniffer$1.device&&(this.unbind("mouseenter",this.onMouseEnter),this.unbind("mouseleave",this.onMouseLeave))}},{key:"render",value:function(){var e=this.config,t=e.mode,r=e.autoHide,n=e.initShow;if(!e.disable){var i=util.classNames({"xgplayer-controls":!0},{"flex-controls":"flex"===t},{"bottom-controls":"bottom"===t},_defineProperty$5({},STATE_CLASS.CONTROLS_AUTOHIDE,r),{"xgplayer-controls-initshow":n||!r});return'<xg-controls class="'.concat(i,'" unselectable="on" onselectstart="return false">\n <xg-inner-controls class="xg-inner-controls xg-pos">\n <xg-left-grid class="xg-left-grid">\n </xg-left-grid>\n <xg-center-grid class="xg-center-grid"></xg-center-grid>\n <xg-right-grid class="xg-right-grid">\n </xg-right-grid>\n </xg-inner-controls>\n </xg-controls>')}}}],[{key:"pluginName",get:function(){return"controls"}},{key:"defaultConfig",get:function(){return{disable:!1,autoHide:!0,mode:"",initShow:!1}}}]),r}(Plugin),EN={LANG:"en",TEXT:{ERROR_TYPES:{network:{code:1,msg:"video download error"},mse:{code:2,msg:"stream append error"},parse:{code:3,msg:"parsing error"},format:{code:4,msg:"wrong format"},decoder:{code:5,msg:"decoding error"},runtime:{code:6,msg:"grammatical errors"},timeout:{code:7,msg:"play timeout"},other:{code:8,msg:"other errors"}},HAVE_NOTHING:"There is no information on whether audio/video is ready",HAVE_METADATA:"Audio/video metadata is ready ",HAVE_CURRENT_DATA:"Data about the current play location is available, but there is not enough data to play the next frame/millisecond",HAVE_FUTURE_DATA:"Current and at least one frame of data is available",HAVE_ENOUGH_DATA:"The available data is sufficient to start playing",NETWORK_EMPTY:"Audio/video has not been initialized",NETWORK_IDLE:"Audio/video is active and has been selected for resources, but no network is used",NETWORK_LOADING:"The browser is downloading the data",NETWORK_NO_SOURCE:"No audio/video source was found",MEDIA_ERR_ABORTED:"The fetch process is aborted by the user",MEDIA_ERR_NETWORK:"An error occurred while downloading",MEDIA_ERR_DECODE:"An error occurred while decoding",MEDIA_ERR_SRC_NOT_SUPPORTED:"Audio/video is not supported",REPLAY:"Replay",ERROR:"Network is offline",PLAY_TIPS:"Play",PAUSE_TIPS:"Pause",PLAYNEXT_TIPS:"Play next",DOWNLOAD_TIPS:"Download",ROTATE_TIPS:"Rotate",RELOAD_TIPS:"Reload",FULLSCREEN_TIPS:"Fullscreen",EXITFULLSCREEN_TIPS:"Exit fullscreen",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"Exit cssfullscreen",TEXTTRACK:"Caption",PIP:"PIP",SCREENSHOT:"Screenshot",LIVE:"LIVE",OFF:"Off",OPEN:"Open",MINI_DRAG:"Click and hold to drag",MINISCREEN:"Miniscreen",REFRESH_TIPS:"Please Try",REFRESH:"Refresh",FORWARD:"forward",LIVE_TIP:"Live"}},XGI18nLang={lang:{},langKeys:[],textKeys:[]};function deepMerge(e,t){return Object.keys(t).forEach((function(r){var n,i=util.typeOf(t[r]),o=util.typeOf(e[r]);"Array"===i?("Array"!==o&&(e[r]=[]),(n=e[r]).push.apply(n,_toConsumableArray(t[r]))):"Object"===i?("Object"!==o&&(e[r]={}),deepMerge(e[r],t[r])):e[r]=t[r]})),e}function updateKeys(){Object.keys(XGI18nLang.lang.en).map((function(e){XGI18nLang.textKeys[e]=e}))}function extend(e,t){var r=[];if(t||(t=XGI18nLang),t.lang){r="Array"!==util.typeOf(e)?Object.keys(e).map((function(t){return{LANG:"zh"===t?"zh-cn":t,TEXT:e[t]}})):e;var n=t.lang;r.map((function(e){"zh"===e.LANG&&(e.LANG="zh-cn"),n[e.LANG]?deepMerge(n[e.LANG]||{},e.TEXT||{}):use(e,t)})),updateKeys()}}function use(e,t){var r=e.LANG;if(t||(t=XGI18nLang),t.lang){var n=e.TEXT||{};"zh"===r&&(r="zh-cn"),t.lang[r]?deepMerge(t.lang[r],n):(t.langKeys.push(r),t.lang[r]=n),updateKeys()}}function init$1(e){var t,r={lang:{},langKeys:[],textKeys:{},pId:e};return deepMerge(r.lang,XGI18nLang.lang),(t=r.langKeys).push.apply(t,_toConsumableArray(XGI18nLang.langKeys)),deepMerge(r.textKeys,XGI18nLang.textKeys),r}use(EN);var I18N={get textKeys(){return XGI18nLang.textKeys},get langKeys(){return XGI18nLang.langKeys},get lang(){var e={};return XGI18nLang.langKeys.map((function(t){e[t]=XGI18nLang.lang[t]})),XGI18nLang.lang["zh-cn"]&&(e.zh=XGI18nLang.lang["zh-cn"]||{}),e},extend:extend,use:use,init:init$1},STATES={INITIAL:1,READY:2,ATTACHING:3,ATTACHED:4,NOTALLOW:5,RUNNING:6,ENDED:7,DESTROYED:8},STATE_ARRAY=["ERROR","INITIAL","READY","ATTACHING","ATTACHED","NOTALLOW","RUNNING","ENDED","DESTROYED"],PlAYER_HOOKS=["play","pause","replay","retry"],REAL_TIME_SPEED=0,AVG_SPEED=0,Player=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n;_classCallCheck$4(this,r);var i=util.deepMerge(getDefaultConfig$1(),e);_defineProperty$5(_assertThisInitialized$4(n=t.call(this,i)),"canPlayFunc",(function(){if(n.config){var e=n.config,t=e.autoplay,r=e.startTime,i=e.defaultPlaybackRate;XG_DEBUG.logInfo("player","canPlayFunc, startTime",r),r&&(n.currentTime=r>n.duration?n.duration:r,n.config.startTime=0),n.playbackRate=i,(t||n._useAutoplay)&&n.mediaPlay(),n.off(CANPLAY,n.canPlayFunc),n.removeClass(STATE_CLASS.ENTER)}})),_defineProperty$5(_assertThisInitialized$4(n),"onFullscreenChange",(function(e,t){var r=function(){util.setTimeout(_assertThisInitialized$4(n),(function(){n.resize()}),100)},i=util.getFullScreenEl();n._fullActionFrom?n._fullActionFrom="":n.emit(USER_ACTION,{eventType:"system",action:"switch_fullscreen",pluginName:"player",currentTime:n.currentTime,duration:n.duration,props:[{prop:"fullscreen",from:!0,to:!1}]});var o=checkIsCurrentVideo(i,n.playerId,PLATER_ID);if(t||i&&(i===n._fullscreenEl||o))r(),!n.config.closeFocusVideoFocus&&n.media.focus(),n.fullscreen=!0,n.changeFullStyle(n.root,i,STATE_CLASS.FULLSCREEN),n.emit(FULLSCREEN_CHANGE,!0,n._fullScreenOffset),n.cssfullscreen&&n.exitCssFullscreen();else if(n.fullscreen){r();var a=_assertThisInitialized$4(n),s=a._fullScreenOffset;a.config.needFullscreenScroll?(window.scrollTo(s.left,s.top),util.setTimeout(_assertThisInitialized$4(n),(function(){n.fullscreen=!1,n._fullScreenOffset=null}),100)):(!n.config.closeFocusVideoFocus&&n.media.focus(),n.fullscreen=!1,n._fullScreenOffset=null),n.cssfullscreen?n.removeClass(STATE_CLASS.FULLSCREEN):n.recoverFullStyle(n.root,n._fullscreenEl,STATE_CLASS.FULLSCREEN),n._fullscreenEl=null,n.emit(FULLSCREEN_CHANGE,!1)}})),_defineProperty$5(_assertThisInitialized$4(n),"_onWebkitbeginfullscreen",(function(e){n._fullscreenEl=n.media,n.onFullscreenChange(e,!0)})),_defineProperty$5(_assertThisInitialized$4(n),"_onWebkitendfullscreen",(function(e){n.onFullscreenChange(e,!1)})),hooksDescriptor(_assertThisInitialized$4(n),PlAYER_HOOKS),n.config=i,n._pluginInfoId=util.generateSessionId(),bindDebug(_assertThisInitialized$4(n));var o=n.constructor.defaultPreset;if(n.config.presets.length){var a=n.config.presets.indexOf("default");a>=0&&o&&(n.config.presets[a]=o)}else o&&n.config.presets.push(o);if(n.userTimer=null,n.waitTimer=null,n._state=STATES.INITIAL,n.isError=!1,n._hasStart=!1,n.isSeeking=!1,n.isCanplay=!1,n._useAutoplay=!1,n.rotateDeg=0,n.isActive=!1,n.fullscreen=!1,n.cssfullscreen=!1,n.isRotateFullscreen=!1,n._fullscreenEl=null,n._cssfullscreenEl=null,n.curDefinition=null,n._orgCss="",n._fullScreenOffset=null,n._videoHeight=0,n._videoWidth=0,n._accPlayed={t:0,acc:0,loopAcc:0},n.innerContainer=null,n.controls=null,n.topBar=null,n.root=null,n.__i18n=I18N.init(n._pluginInfoId),sniffer$1.os.isAndroid&&sniffer$1.osVersion>0&&sniffer$1.osVersion<6&&(n.config.autoplay=!1),n.database=new INDEXDB,n.isUserActive=!1,!n._initDOM())return console.error(new Error("can't find the dom which id is ".concat(n.config.id," or this.config.el does not exist"))),_possibleConstructorReturn$4(n);var s=n.config,l=s.definition,c=void 0===l?{}:l;if(!s.url&&c.list&&c.list.length>0){var u=c.list.find((function(e){return e.definition&&e.definition===c.defaultDefinition}));u||(c.defaultDefinition=c.list[0].definition,u=c.list[0]),n.config.url=u.url,n.curDefinition=u}return n._bindEvents(),n._registerPresets(),n._registerPlugins(),pluginsManager.onPluginsReady(_assertThisInitialized$4(n)),n.getInitDefinition(),n.setState(STATES.READY),util.setTimeout(_assertThisInitialized$4(n),(function(){n.emit(READY)}),0),n.onReady&&n.onReady(),(n.config.videoInit||n.config.autoplay)&&(!n.hasStart||n.state<STATES.ATTACHED)&&n.start(),n}return _createClass$5(r,[{key:"_initDOM",value:function(){var e=this;if(this.root=this.config.id?document.getElementById(this.config.id):null,!this.root){var t=this.config.el;if(!t||1!==t.nodeType)return this.emit(ERROR$3,new Errors("use",this.config.vid,{line:32,handle:"Constructor",msg:"container id can't be empty"})),console.error("this.confg.id or this.config.el can't be empty"),!1;this.root=t}var r=pluginsManager.checkPlayerRoot(this.root);r&&(XG_DEBUG.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize"),r.destroy()),this.root.setAttribute(PLATER_ID,this.playerId),pluginsManager.init(this),this._initBaseDoms();var n=this.constructor.XgVideoProxy;if(n&&this.mediaConfig.mediaType===n.mediaType){var i=this.innerContainer||this.root;this.detachVideoEvents(this.media);var o=new n(i,this.config,this.mediaConfig);this.attachVideoEvents(o),this.media=o}if(this.media.setAttribute(PLATER_ID,this.playerId),this.config.controls){var a=this.config.controls.root||null,s=pluginsManager.register(this,Controls,{root:a});this.controls=s}var l="mobile"===this.config.isMobileSimulateMode?"mobile":sniffer$1.device;if(this.addClass("".concat(STATE_CLASS.DEFAULT," ").concat(STATE_CLASS.INACTIVE," xgplayer-").concat(l," ").concat(this.config.controls?"":STATE_CLASS.NO_CONTROLS)),this.config.autoplay?this.addClass(STATE_CLASS.ENTER):this.addClass(STATE_CLASS.NO_START),this.config.fluid){var c=this.config,u=c.width,h=c.height;"number"==typeof u&&"number"==typeof h||(u=600,h=337.5);var d={width:"100%",height:"0","max-width":"100%","padding-top":"".concat(100*h/u,"%")};Object.keys(d).forEach((function(t){e.root.style[t]=d[t]}))}else["width","height"].forEach((function(t){e.config[t]&&("number"!=typeof e.config[t]?e.root.style[t]=e.config[t]:e.root.style[t]="".concat(e.config[t],"px"))}));return!0}},{key:"_initBaseDoms",value:function(){this.topBar=util.createDom("xg-bar","",{"data-index":-1},"xg-top-bar"),this.leftBar=util.createDom("xg-bar","",{"data-index":-1},"xg-left-bar"),this.rightBar=util.createDom("xg-bar","",{"data-index":-1},"xg-right-bar"),this.config.marginControls&&(this.innerContainer=util.createDom("xg-video-container","",{"data-index":-1},"xg-video-container"),this.root.appendChild(this.innerContainer)),this.config.topBarAutoHide&&util.addClass(this.topBar,STATE_CLASS.TOP_BAR_AUTOHIDE),this.root.appendChild(this.topBar),this.root.appendChild(this.leftBar),this.root.appendChild(this.rightBar)}},{key:"_bindEvents",value:function(){var e=this;["focus","blur"].forEach((function(t){e.on(t,e["on"+t.charAt(0).toUpperCase()+t.slice(1)])})),FULLSCREEN_EVENTS.forEach((function(t){document&&document.addEventListener(t,e.onFullscreenChange)})),sniffer$1.os.isIos&&(this.media.addEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.addEventListener("webkitendfullscreen",this._onWebkitendfullscreen)),this.once(LOADED_DATA,this.resize),this.playFunc=function(){e.config.closeFocusVideoFocus||e.media.focus()},this.once(PLAY,this.playFunc)}},{key:"_unbindEvents",value:function(){var e=this;this.root.removeEventListener("mousemove",this.mousemoveFunc),FULLSCREEN_EVENTS.forEach((function(t){document.removeEventListener(t,e.onFullscreenChange)})),this.playFunc&&this.off(PLAY,this.playFunc),this.off(CANPLAY,this.canPlayFunc),this.media.removeEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.removeEventListener("webkitendfullscreen",this._onWebkitendfullscreen)}},{key:"_startInit",value:function(e){var t=this;if(this.media&&(e&&""!==e&&("Array"!==util.typeOf(e)||0!==e.length)||(e="",this.emit(URL_NULL),XG_DEBUG.logWarn("config.url is null, please get url and run player._startInit(url)"),!this.config.nullUrlStart))){this._detachSourceEvents(this.media),"Array"===util.typeOf(e)&&e.length>0?this._attachSourceEvents(this.media,e):this.media.src&&this.media.src===e?e||this.media.removeAttribute("src"):this.media.src=e,"Number"===util.typeOf(this.config.volume)&&(this.volume=this.config.volume);var r=this.innerContainer?this.innerContainer:this.root;this.media instanceof window.Element&&!r.contains(this.media)&&r.insertBefore(this.media,r.firstChild);var n=this.media.readyState;XG_DEBUG.logInfo("_startInit readyState",n),this.config.autoplay&&(!/^blob/.test(this.media.currentSrc)&&!/^blob/.test(this.media.src)&&this.load(),(sniffer$1.os.isIpad||sniffer$1.os.isPhone)&&this.mediaPlay()),n>=2?this.canPlayFunc():this.once(CANPLAY,this.canPlayFunc),(!this.hasStart||this.state<STATES.ATTACHED)&&pluginsManager.afterInit(this),this.hasStart=!0,this.setState(STATES.ATTACHED),util.setTimeout(this,(function(){t.emit(COMPLETE)}),0)}}},{key:"_registerPlugins",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._loadingPlugins=[];var r=this.config.ignores||[],n=this.config.plugins||[],i=this.config.i18n||[];t&&I18N.extend(i,this.__i18n);var o=r.join("||").toLowerCase().split("||"),a=this.plugins;n.forEach((function(r){try{var n=r.plugin?r.plugin.pluginName:r.pluginName;if(n&&o.indexOf(n.toLowerCase())>-1)return null;if(!t&&a[n.toLowerCase()])return;if(r.lazy&&r.loader){var i=pluginsManager.lazyRegister(e,r);return void(r.forceBeforeInit&&(i.then((function(){e._loadingPlugins.splice(e._loadingPlugins.indexOf(i),1)})).catch((function(t){XG_DEBUG.logError("_registerPlugins:loadingPlugin",t),e._loadingPlugins.splice(e._loadingPlugins.indexOf(i),1)})),e._loadingPlugins.push(i)))}return e.registerPlugin(r)}catch(s){XG_DEBUG.logError("_registerPlugins:",s)}}))}},{key:"_registerPresets",value:function(){var e=this;this.config.presets.forEach((function(t){usePreset(e,t)}))}},{key:"_getRootByPosition",value:function(e){var t=null;switch(e){case POSITIONS$a.ROOT_RIGHT:t=this.rightBar;break;case POSITIONS$a.ROOT_LEFT:t=this.leftBar;break;case POSITIONS$a.ROOT_TOP:t=this.topBar;break;default:t=this.innerContainer||this.root}return t}},{key:"registerPlugin",value:function(e,t){var r=pluginsManager.formatPluginInfo(e,t),n=r.PLUFGIN,i=r.options,o=this.config.plugins;!pluginsManager.checkPluginIfExits(n.pluginName,o)&&o.push(n);var a=pluginsManager.getRootByConfig(n.pluginName,this.config);a.root&&(i.root=a.root),a.position&&(i.position=a.position);var s=i.position?i.position:i.config&&i.config.position||n.defaultConfig&&n.defaultConfig.position;return!i.root&&"string"==typeof s&&s.indexOf("controls")>-1?this.controls&&this.controls.registerPlugin(n,i,n.pluginName):(i.root||(i.root=this._getRootByPosition(s)),pluginsManager.register(this,n,i))}},{key:"deregister",value:function(e){"string"==typeof e?pluginsManager.unRegister(this,e):e instanceof BasePlugin&&pluginsManager.unRegister(this,e.pluginName)}},{key:"unRegisterPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.deregister(e),t&&this.removePluginFromConfig(e)}},{key:"removePluginFromConfig",value:function(e){var t;if("string"==typeof e?t=e:e instanceof BasePlugin&&(t=e.pluginName),t)for(var r=this.config.plugins.length-1;r>-1;r--){if(this.config.plugins[r].pluginName.toLowerCase()===t.toLowerCase()){this.config.plugins.splice(r,1);break}}}},{key:"plugins",get:function(){return pluginsManager.getPlugins(this)}},{key:"getPlugin",value:function(e){var t=pluginsManager.findPlugin(this,e);return t&&t.pluginName?t:null}},{key:"addClass",value:function(e){this.root&&(util.hasClass(this.root,e)||util.addClass(this.root,e))}},{key:"removeClass",value:function(e){this.root&&util.removeClass(this.root,e)}},{key:"hasClass",value:function(e){if(this.root)return util.hasClass(this.root,e)}},{key:"setAttribute",value:function(e,t){this.root&&this.root.setAttribute(e,t)}},{key:"removeAttribute",value:function(e,t){this.root&&this.root.removeAttribute(e,t)}},{key:"start",value:function(e){var t=this;if(!(this.state>STATES.ATTACHING))return e||this.config.url||this.getInitDefinition(),this.hasStart=!0,this.setState(STATES.ATTACHING),this._registerPlugins(!1),pluginsManager.beforeInit(this).then((function(){if(t.config)return e||(e=t.url||t.config.url),t._startInit(e)})).catch((function(e){throw e.fileName="player",e.lineNumber="236",XG_DEBUG.logError("start:beforeInit:",e),e}))}},{key:"switchURL",value:function(e,t){var r=this,n=e;"Object"===util.typeOf(e)&&(n=e.url);var i=this.currentTime,o=this.paused&&!this.isError;return this.src=n,new Promise((function(e){var t=function(){r.currentTime=i,o&&r.once("canplay",(function(){r.pause()})),e()};sniffer$1.os.isAndroid?r.once("timeupdate",(function(){t()})):r.once("canplay",(function(){t()})),r.play()}))}},{key:"videoPlay",value:function(){this.mediaPlay()}},{key:"mediaPlay",value:function(){var e=this;if(!this.hasStart&&this.state<STATES.ATTACHED)return this.removeClass(STATE_CLASS.NO_START),this.addClass(STATE_CLASS.ENTER),this.start(),void(this._useAutoplay=!0);this.state<STATES.RUNNING&&(this.removeClass(STATE_CLASS.NO_START),!this.isCanplay&&this.addClass(STATE_CLASS.ENTER));var t=_get$2(_getPrototypeOf$4(r.prototype),"play",this).call(this);return void 0!==t&&t&&t.then?t.then((function(){e.removeClass(STATE_CLASS.NOT_ALLOW_AUTOPLAY),e.addClass(STATE_CLASS.PLAYING),e.state<STATES.RUNNING&&(XG_DEBUG.logInfo(">>>>playPromise.then"),e.setState(STATES.RUNNING),e.emit(AUTOPLAY_STARTED))})).catch((function(t){if(XG_DEBUG.logWarn(">>>>playPromise.catch",t.name),e.media&&e.media.error)return e.onError(),void e.removeClass(STATE_CLASS.ENTER);"NotAllowedError"===t.name&&(e._errorTimer=util.setTimeout(e,(function(){e._errorTimer=null,e.emit(AUTOPLAY_PREVENTED),e.addClass(STATE_CLASS.NOT_ALLOW_AUTOPLAY),e.removeClass(STATE_CLASS.ENTER),e.pause(),e.setState(STATES.NOTALLOW)}),0))})):(XG_DEBUG.logWarn("video.play not return promise"),this.state<STATES.RUNNING&&(this.setState(STATES.RUNNING),this.removeClass(STATE_CLASS.NOT_ALLOW_AUTOPLAY),this.removeClass(STATE_CLASS.NO_START),this.removeClass(STATE_CLASS.ENTER),this.addClass(STATE_CLASS.PLAYING),this.emit(AUTOPLAY_STARTED))),t}},{key:"mediaPause",value:function(){_get$2(_getPrototypeOf$4(r.prototype),"pause",this).call(this)}},{key:"videoPause",value:function(){_get$2(_getPrototypeOf$4(r.prototype),"pause",this).call(this)}},{key:"play",value:function(){var e=this;this.removeClass(STATE_CLASS.PAUSED),runHooks(this,"play",(function(){e.mediaPlay()}))}},{key:"pause",value:function(){var e=this;runHooks(this,"pause",(function(){_get$2(_getPrototypeOf$4(r.prototype),"pause",e).call(e)}))}},{key:"seek",value:function(e,t){var r=this;if(this.media&&!Number.isNaN(Number(e)||!this.hasStart)){var n=this.config,i=n.isSeekedPlay,o=n.seekedStatus,a=t||(i?"play":o);e=e<0?0:e>this.duration?parseInt(this.duration,10):e,this.once(CANPLAY,(function(){switch(r.removeClass(STATE_CLASS.ENTER),r.isSeeking=!1,a){case"play":r.play();break;case"pause":r.pause();break;default:!r.paused&&r.play()}})),this.state<STATES.RUNNING?(this.removeClass(STATE_CLASS.NO_START),this.addClass(STATE_CLASS.ENTER),this.currentTime=e,"play"===a&&this.play()):this.currentTime=e}}},{key:"getInitDefinition",value:function(){var e=this,t=this.config,r=t.definition;!t.url&&r&&r.list&&r.list.length>0&&r.defaultDefinition&&r.list.map((function(t){t.definition===r.defaultDefinition&&(e.config.url=t.url,e.curDefinition=t)}))}},{key:"changeDefinition",value:function(e,t){var r=this,n=this.config.definition;if(Array.isArray(null==n?void 0:n.list)&&n.list.forEach((function(t){(null==e?void 0:e.definition)===t.definition&&(r.curDefinition=t)})),null!=e&&e.bitrate&&"number"!=typeof e.bitrate&&(e.bitrate=parseInt(e.bitrate,10)||0),this.emit(DEFINITION_CHANGE,{from:t,to:e}),this.hasStart){var i=this.switchURL(e.url,_objectSpread2$4({seamless:!1!==n.seamless&&"undefined"!=typeof MediaSource&&"function"==typeof MediaSource.isTypeSupported},e));i&&i.then?i.then((function(){r.emit(AFTER_DEFINITION_CHANGE,{from:t,to:e})})):this.emit(AFTER_DEFINITION_CHANGE,{from:t,to:e})}else this.config.url=e.url}},{key:"reload",value:function(){this.load(),this.reloadFunc=function(){this.play()},this.once(LOADED_DATA,this.reloadFunc)}},{key:"resetState",value:function(){var e=this,t=[STATE_CLASS.NOT_ALLOW_AUTOPLAY,STATE_CLASS.PLAYING,STATE_CLASS.NO_START,STATE_CLASS.PAUSED,STATE_CLASS.REPLAY,STATE_CLASS.ENTER,STATE_CLASS.ENDED,STATE_CLASS.ERROR,STATE_CLASS.LOADING];this.hasStart=!1,this.isError=!1,this._useAutoplay=!1,this.mediaPause(),this._accPlayed.acc=0,this._accPlayed.t=0,this._accPlayed.loopAcc=0,t.forEach((function(t){e.removeClass(t)})),this.addClass(STATE_CLASS.ENTER),this.emit(RESET)}},{key:"reset",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1?arguments[1]:void 0;this.resetState();var n=this.plugins;if(n&&(t.map((function(t){e.deregister(t)})),r)){var i=getDefaultConfig$1();Object.keys(this.config).keys((function(t){"undefined"===e.config[t]||"plugins"!==t&&"presets"!==t&&"el"!==t&&"id"!==t||(e.config[t]=i[t])}))}}},{key:"destroy",value:function(){var e=this,t=this.innerContainer,n=this.root,i=this.media;if(n&&i){if(this.hasStart=!1,this._useAutoplay=!1,n.removeAttribute(PLATER_ID),this.updateAcc("destroy"),this._unbindEvents(),this._detachSourceEvents(this.media),util.clearAllTimers(this),this.emit(DESTROY),pluginsManager.destroy(this),delHooksDescriptor(this),_get$2(_getPrototypeOf$4(r.prototype),"destroy",this).call(this),this.fullscreen&&this._fullscreenEl===this.root&&this.exitFullscreen(),t)for(var o=t.children,a=0;a<o.length;a++)t.removeChild(o[a]);!t&&i instanceof window.Node&&n.contains(i)&&n.removeChild(i),["topBar","leftBar","rightBar","innerContainer"].map((function(t){e[t]&&n.removeChild(e[t]),e[t]=null}));var s=n.className.split(" ");s.length>0?n.className=s.filter((function(e){return e.indexOf("xgplayer")<0})).join(" "):n.className="",this.removeAttribute("data-xgfill"),["isSeeking","isCanplay","isActive","cssfullscreen","fullscreen"].forEach((function(t){e[t]=!1}))}}},{key:"replay",value:function(){var e=this;this.removeClass(STATE_CLASS.ENDED),this.currentTime=0,this.isSeeking=!1,runHooks(this,"replay",(function(){e.once(CANPLAY,(function(){var t=e.mediaPlay();t&&t.catch&&t.catch((function(e){console.log(e)}))})),e.play(),e.emit(REPLAY),e.onPlay()}))}},{key:"retry",value:function(){var e=this;this.removeClass(STATE_CLASS.ERROR),this.addClass(STATE_CLASS.LOADING),runHooks(this,"retry",(function(){var t=e.currentTime;e.src=e.config.url,!e.config.isLive&&(e.currentTime=t),e.once(CANPLAY,(function(){e.mediaPlay()}))}))}},{key:"changeFullStyle",value:function(e,t,r,n){e&&(n||(n=STATE_CLASS.PARENT_FULLSCREEN),this._orgCss||(this._orgCss=util.filterStyleFromText(e)),util.addClass(e,r),t&&t!==e&&!this._orgPCss&&(this._orgPCss=util.filterStyleFromText(t),util.addClass(t,n),t.setAttribute(PLATER_ID,this.playerId)))}},{key:"recoverFullStyle",value:function(e,t,r,n){n||(n=STATE_CLASS.PARENT_FULLSCREEN),this._orgCss&&(util.setStyleFromCsstext(e,this._orgCss),this._orgCss=""),util.removeClass(e,r),t&&t!==e&&this._orgPCss&&(util.setStyleFromCsstext(t,this._orgPCss),this._orgPCss="",util.removeClass(t,n),t.removeAttribute(PLATER_ID))}},{key:"getFullscreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget,t=this.root,r=this.media;e||(e=t),this._fullScreenOffset={top:util.scrollTop(),left:util.scrollLeft()},this._fullscreenEl=e,this._fullActionFrom="get";var n=util.getFullScreenEl();if(n!==this._fullscreenEl)try{for(var i=0;i<GET_FULLSCREEN_API.length;i++){var o=GET_FULLSCREEN_API[i];if(e[o]){var a="webkitRequestFullscreen"===o?e.webkitRequestFullscreen(window.Element.ALLOW_KEYBOARD_INPUT):e[o]();return a&&a.then?a:Promise.resolve()}}return r.fullscreenEnabled||r.webkitSupportsFullscreen?(r.webkitEnterFullscreen(),Promise.resolve()):Promise.reject(new Error("call getFullscreen fail"))}catch(s){return Promise.reject(new Error("call getFullscreen fail"))}else this.onFullscreenChange()}},{key:"exitFullscreen",value:function(e){if(this.isRotateFullscreen&&this.exitRotateFullscreen(),this._fullscreenEl||util.getFullScreenEl()){this.root;var t=this.media;this._fullActionFrom="exit";try{for(var r=0;r<EXIT_FULLSCREEN_API.length;r++){var n=EXIT_FULLSCREEN_API[r];if(document[n]){var i=document[n]();return i&&i.then?i:Promise.resolve()}}return t&&t.webkitSupportsFullscreen?(t.webkitExitFullScreen(),Promise.resolve()):Promise.reject(new Error("call exitFullscreen fail"))}catch(o){return Promise.reject(new Error("call exitFullscreen fail"))}}}},{key:"getCssFullscreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget;this.isRotateFullscreen?this.exitRotateFullscreen():this.fullscreen&&this.exitFullscreen();var t=e?"".concat(STATE_CLASS.INNER_FULLSCREEN," ").concat(STATE_CLASS.CSS_FULLSCREEN):STATE_CLASS.CSS_FULLSCREEN;this.changeFullStyle(this.root,e,t);var r=this.config.fullscreen,n=void 0===r?{}:r,i=!0===n.useCssFullscreen||"function"==typeof n.useCssFullscreen&&n.useCssFullscreen();i&&(this.fullscreen=!0,this.emit(FULLSCREEN_CHANGE,!0)),this._cssfullscreenEl=e,this.cssfullscreen=!0,this.emit(CSS_FULLSCREEN_CHANGE,!0)}},{key:"exitCssFullscreen",value:function(){var e=this._cssfullscreenEl?"".concat(STATE_CLASS.INNER_FULLSCREEN," ").concat(STATE_CLASS.CSS_FULLSCREEN):STATE_CLASS.CSS_FULLSCREEN;if(this.fullscreen){var t=this.config.fullscreen,r=void 0===t?{}:t;!0===r.useCssFullscreen||"function"==typeof r.useCssFullscreen&&r.useCssFullscreen()?(this.recoverFullStyle(this.root,this._cssfullscreenEl,e),this.fullscreen=!1,this.emit(FULLSCREEN_CHANGE,!1)):this.removeClass(e)}else this.recoverFullStyle(this.root,this._cssfullscreenEl,e);this._cssfullscreenEl=null,this.cssfullscreen=!1,this.emit(CSS_FULLSCREEN_CHANGE,!1)}},{key:"getRotateFullscreen",value:function(e){this.cssfullscreen&&this.exitCssFullscreen(e);var t=e?"".concat(STATE_CLASS.INNER_FULLSCREEN," ").concat(STATE_CLASS.ROTATE_FULLSCREEN):STATE_CLASS.ROTATE_FULLSCREEN;this._fullscreenEl=e||this.root,this.changeFullStyle(this.root,e,t,STATE_CLASS.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!0,this.fullscreen=!0,this.setRotateDeg(90),this.emit(FULLSCREEN_CHANGE,!0)}},{key:"exitRotateFullscreen",value:function(e){var t=this._fullscreenEl!==this.root?"".concat(STATE_CLASS.INNER_FULLSCREEN," ").concat(STATE_CLASS.ROTATE_FULLSCREEN):STATE_CLASS.ROTATE_FULLSCREEN;this.recoverFullStyle(this.root,this._fullscreenEl,t,STATE_CLASS.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!1,this.fullscreen=!1,this.setRotateDeg(0),this.emit(FULLSCREEN_CHANGE,!1)}},{key:"setRotateDeg",value:function(e){90===window.orientation||-90===window.orientation?this.rotateDeg=0:this.rotateDeg=e}},{key:"focus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{autoHide:!this.config.closeDelayBlur,delay:this.config.inactive};this.isActive?this.onFocus(e):this.emit(PLAYER_FOCUS,_objectSpread2$4({paused:this.paused,ended:this.ended},e))}},{key:"blur",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{ignorePaused:!1};this.isActive?this.emit(PLAYER_BLUR,_objectSpread2$4({paused:this.paused,ended:this.ended},e)):this.onBlur(e)}},{key:"onFocus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.autoHide,n=void 0===r?!this.config.closePlayerBlur:r,i=t.delay,o=void 0===i?this.config.inactive:i;this.isActive=!0,this.removeClass(STATE_CLASS.INACTIVE),this.userTimer&&(util.clearTimeout(this,this.userTimer),this.userTimer=null),n?this.userTimer=util.setTimeout(this,(function(){e.userTimer=null,e.blur()}),o):this.userTimer&&(util.clearTimeout(this,this.userTimer),this.userTimer=null)}},{key:"onBlur",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.ignorePaused,r=void 0!==t&&t;if(this.isActive){var n=this.config.closePauseVideoFocus;this.isActive=!1,(r||n||!this.paused&&!this.ended)&&this.addClass(STATE_CLASS.INACTIVE)}}},{key:"onEmptied",value:function(){this.updateAcc("emptied")}},{key:"onCanplay",value:function(){this.removeClass(STATE_CLASS.ENTER),this.removeClass(STATE_CLASS.ERROR),this.removeClass(STATE_CLASS.LOADING),this.isCanplay=!0,this.waitTimer&&util.clearTimeout(this,this.waitTimer)}},{key:"onLoadeddata",value:function(){this.isError=!1}},{key:"onLoadstart",value:function(){this.removeClass(STATE_CLASS.ERROR)}},{key:"onPlay",value:function(){this.state===STATES.ENDED&&this.setState(STATES.RUNNING),this.removeClass(STATE_CLASS.PAUSED),this.ended&&this.removeClass(STATE_CLASS.ENDED),!this.config.closePlayVideoFocus&&this.focus()}},{key:"onPause",value:function(){this.addClass(STATE_CLASS.PAUSED),this.updateAcc("pause"),this.config.closePauseVideoFocus||(this.userTimer&&(util.clearTimeout(this,this.userTimer),this.userTimer=null),this.focus())}},{key:"onEnded",value:function(){this.updateAcc("ended"),this.addClass(STATE_CLASS.ENDED),this.setState(STATES.ENDED)}},{key:"onError",value:function(){this.isError=!0,this.updateAcc("error"),this.removeClass(STATE_CLASS.NOT_ALLOW_AUTOPLAY),this.removeClass(STATE_CLASS.NO_START),this.removeClass(STATE_CLASS.ENTER),this.removeClass(STATE_CLASS.LOADING),this.addClass(STATE_CLASS.ERROR)}},{key:"onSeeking",value:function(){this.isSeeking||this.updateAcc("seeking"),this.isSeeking=!0,this.addClass(STATE_CLASS.SEEKING)}},{key:"onSeeked",value:function(){this.isSeeking=!1,this.waitTimer&&util.clearTimeout(this,this.waitTimer),this.removeClass(STATE_CLASS.LOADING),this.removeClass(STATE_CLASS.SEEKING)}},{key:"onWaiting",value:function(){var e=this;this.waitTimer&&util.clearTimeout(this,this.waitTimer),this.updateAcc("waiting"),this.waitTimer=util.setTimeout(this,(function(){e.addClass(STATE_CLASS.LOADING),util.clearTimeout(e,e.waitTimer),e.waitTimer=null}),200)}},{key:"onPlaying",value:function(){var e=this;this.isError=!1,[STATE_CLASS.NO_START,STATE_CLASS.PAUSED,STATE_CLASS.ENDED,STATE_CLASS.ERROR,STATE_CLASS.REPLAY,STATE_CLASS.LOADING].forEach((function(t){e.removeClass(t)}))}},{key:"onTimeupdate",value:function(){!this._videoHeight&&this.resize(),(this.waitTimer||this.hasClass(STATE_CLASS.LOADING))&&this.media.readyState>2&&(this.removeClass(STATE_CLASS.LOADING),util.clearTimeout(this,this.waitTimer),this.waitTimer=null),!this.paused&&this.state<STATES.RUNNING&&this.duration&&(this.setState(STATES.RUNNING),this.emit(AUTOPLAY_STARTED)),this._accPlayed.t||this.paused||this.ended||(this._accPlayed.t=(new Date).getTime())}},{key:"onVolumechange",value:function(){"Number"===util.typeOf(this.config.volume)&&(this.config.volume=this.volume)}},{key:"onRatechange",value:function(){this.config.defaultPlaybackRate=this.playbackRate}},{key:"emitUserAction",value:function(e,t,r){if(this.media&&t&&e){var n="String"===util.typeOf(e)?e:e.type||"";r.props&&"Array"!==util.typeOf(r.props)&&(r.props=[r.props]),this.emit(USER_ACTION,_objectSpread2$4({eventType:n,action:t,currentTime:this.currentTime,duration:this.duration,ended:this.ended,event:e},r))}}},{key:"updateAcc",value:function(e){if(this._accPlayed.t){var t=(new Date).getTime()-this._accPlayed.t;this._accPlayed.acc+=t,this._accPlayed.t=0,("ended"===e||this.ended)&&(this._accPlayed.loopAcc=this._accPlayed.acc)}}},{key:"checkBuffer",value:function(e){var t=this.media.buffered;if(!t||0===t.length||!this.duration)return!0;for(var r=e||this.media.currentTime||.2,n=t.length,i=0;i<n;i++)if(t.start(i)<=r&&t.end(i)>r)return!0;return!1}},{key:"position",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{h:0,y:0,x:0,w:0};if(this.media&&e&&e.h){var t=1/e.h,r=1!==t?"scale(".concat(t,")"):"",n=0,i=0;e.y&&(i=(100-100*e.h)/2-100*e.y),e.w&&e.x&&(n=(100-100*e.w)/2-100*e.x),r+=" translate(".concat(n,"%, ").concat(i,"%)"),this.media.style.transform=r,this.media.style.webkitTransform=r}}},{key:"setConfig",value:function(e){var t=this;e&&Object.keys(e).map((function(r){if("plugins"!==r){t.config[r]=e[r];var n=t.plugins[r.toLowerCase()];n&&"Function"===util.typeOf(n.setConfig)&&n.setConfig(e[r])}}))}},{key:"playNext",value:function(e){this.resetState(),this.setConfig(e),this._currentTime=0,this._duration=0,this.play(),this.emit(PLAYNEXT,e)}},{key:"resize",value:function(){var e=this;if(this.media){var t=this.media,r=t.videoWidth,n=t.videoHeight,i=this.config,o=i.fitVideoSize,a=i.videoFillMode;if("fill"!==a&&"cover"!==a||this.setAttribute("data-xgfill",a),n&&r){this._videoHeight=n,this._videoWidth=r;var s=this.root.getBoundingClientRect(),l=this.controls&&this.innerContainer?this.controls.root.getBoundingClientRect().height:0,c=s.width,u=s.height-l,h=parseInt(r/n*1e3,10),d=parseInt(c/u*1e3,10),p=c,f=u,g={};"auto"===o&&d>h||"fixWidth"===o?(f=c/h*1e3,this.config.fluid?g.paddingTop="".concat(100*f/p,"%"):g.height="".concat(f+l,"px")):("auto"===o&&d<h||"fixHeight"===o)&&(p=h*u/1e3,g.width="".concat(p,"px")),this.fullscreen||this.cssfullscreen||Object.keys(g).forEach((function(t){e.root.style[t]=g[t]})),("fillHeight"===a&&d<h||"fillWidth"===a&&d>h)&&this.setAttribute("data-xgfill","cover");var y={videoScale:h,vWidth:p,vHeight:f,cWidth:p,cHeight:f+l};this.emit(VIDEO_RESIZE,y)}}}},{key:"updateObjectPosition",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.media.updateObjectPosition?this.media.updateObjectPosition(e,t):this.media.style.objectPosition="".concat(100*e,"% ").concat(100*t,"%")}},{key:"setState",value:function(e){XG_DEBUG.logInfo("setState","state from:".concat(STATE_ARRAY[this.state]," to:").concat(STATE_ARRAY[e])),this._state=e}},{key:"state",get:function(){return this._state}},{key:"isFullscreen",get:function(){return this.fullscreen}},{key:"isCssfullScreen",get:function(){return this.cssfullscreen}},{key:"hasStart",get:function(){return this._hasStart},set:function(e){"boolean"==typeof e&&(this._hasStart=e,!1===e&&this.setState(STATES.READY),this.emit("hasstart"))}},{key:"isPlaying",get:function(){return this._state===STATES.RUNNING||this._state===STATES.ENDED},set:function(e){e?this.setState(STATES.RUNNING):this._state>=STATES.RUNNING&&this.setState(STATES.ATTACHED)}},{key:"definitionList",get:function(){return this.config&&this.config.definition&&this.config.definition.list||[]},set:function(e){var t=this,r=this.config.definition,n=null,i=null;r.list=e,this.emit("resourceReady",e),e.forEach((function(e){var o;(null===(o=t.curDefinition)||void 0===o?void 0:o.definition)===e.definition&&(n=e),r.defaultDefinition===e.definition&&(i=e)})),!i&&e.length>0&&(i=e[0]),n?this.changeDefinition(n):i&&this.changeDefinition(i)}},{key:"videoFrameInfo",get:function(){var e={total:0,dropped:0,corrupted:0,droppedRate:0,droppedDuration:0};if(!this.media||!this.media.getVideoPlaybackQuality)return e;var t=this.media.getVideoPlaybackQuality();return e.dropped=t.droppedVideoFrames||0,e.total=t.totalVideoFrames||0,e.corrupted=t.corruptedVideoFrames||0,e.total>0&&(e.droppedRate=e.dropped/e.total*100,e.droppedDuration=parseInt(this.cumulateTime/e.total*e.dropped,0)),e}},{key:"lang",get:function(){return this.config.lang},set:function(e){0!==I18N.langKeys.filter((function(t){return t===e})).length||"zh"===e?(this.config.lang=e,pluginsManager.setLang(e,this)):console.error("Sorry, set lang fail, because the language [".concat(e,"] is not supported now, list of all supported languages is [").concat(I18N.langKeys.join(),"] "))}},{key:"i18n",get:function(){var e=this.config.lang;return"zh"===e&&(e="zh-cn"),this.__i18n.lang[e]||this.__i18n.lang.en}},{key:"i18nKeys",get:function(){return this.__i18n.textKeys||{}}},{key:"version",get:function(){return version$1}},{key:"playerId",get:function(){return this._pluginInfoId}},{key:"url",get:function(){return this.__url||this.config.url},set:function(e){this.__url=e}},{key:"poster",get:function(){return this.plugins.poster?this.plugins.poster.config.poster:this.config.poster},set:function(e){this.plugins.poster&&this.plugins.poster.update(e)}},{key:"readyState",get:function(){return _get$2(_getPrototypeOf$4(r.prototype),"readyState",this)}},{key:"error",get:function(){var e=_get$2(_getPrototypeOf$4(r.prototype),"error",this);return this.i18n[e]||e}},{key:"networkState",get:function(){return _get$2(_getPrototypeOf$4(r.prototype),"networkState",this)}},{key:"fullscreenChanging",get:function(){return!(null===this._fullScreenOffset)}},{key:"cumulateTime",get:function(){var e=this._accPlayed;return this.updateAcc("get"),e.acc}},{key:"zoom",get:function(){return this.config.zoom},set:function(e){this.config.zoom=e}},{key:"avgSpeed",get:function(){return AVG_SPEED},set:function(e){AVG_SPEED=e}},{key:"realTimeSpeed",get:function(){return REAL_TIME_SPEED},set:function(e){REAL_TIME_SPEED=e}},{key:"hook",value:function(e,t){return hook.call.apply(hook,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){return useHooks.call.apply(useHooks,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,t){return removeHooks.call.apply(removeHooks,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"usePluginHooks",value:function(e,t,r){for(var n=arguments.length,i=new Array(n>3?n-3:0),o=3;o<n;o++)i[o-3]=arguments[o];return usePluginHooks.call.apply(usePluginHooks,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removePluginHooks",value:function(e,t,r){for(var n=arguments.length,i=new Array(n>3?n-3:0),o=3;o<n;o++)i[o-3]=arguments[o];return removePluginHooks.call.apply(removePluginHooks,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"setUserActive",value:function(e,t){"boolean"==typeof t&&t!==this.muted&&(this.addInnerOP("volumechange"),this.muted=t),pluginsManager.setCurrentUserActive(this.playerId,e)}}],[{key:"debugger",get:function(){return XG_DEBUG.config.debug},set:function(e){XG_DEBUG.config.debug=e}},{key:"getCurrentUserActivePlayerId",value:function(){return pluginsManager.getCurrentUseActiveId()}},{key:"setCurrentUserActive",value:function(e,t){pluginsManager.setCurrentUserActive(e,t)}},{key:"isHevcSupported",value:function(){return sniffer$1.isHevcSupported()}},{key:"probeConfigSupported",value:function(e){return sniffer$1.probeConfigSupported(e)}},{key:"install",value:function(e,t){r.plugins||(r.plugins={}),r.plugins[e]||(r.plugins[e]=t)}},{key:"use",value:function(e,t){r.plugins||(r.plugins={}),r.plugins[e]=t}}]),r}(MediaProxy);function now$2(){return(new Date).getTime()}_defineProperty$5(Player,"defaultPreset",null),_defineProperty$5(Player,"XgVideoProxy",null);var LOG_TYPES$1={LOAD_START:"loadstart",LOADED_DATA:"loadeddata",FIRST_FRAME:"firstFrame",WAIT_START:"waitingStart",WAIT_END:"waitingEnd",SEEK_START:"seekStart",SEEK_END:"seekEnd"},XGLogger=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return _defineProperty$5(_assertThisInitialized$4(e=t.call.apply(t,[this].concat(i))),"_onTimeupdate",(function(){e._state.isTimeUpdate=!0,e._state.autoplayStart&&(XG_DEBUG.logInfo("[xgLogger]".concat(e.player.playerId," _onTimeupdate")),e._sendFF("onTimeupdate"))})),_defineProperty$5(_assertThisInitialized$4(e),"_onAutoplayStart",(function(){XG_DEBUG.logInfo("[xgLogger]".concat(e.player.playerId," _onAutoplayStart")),e._state.autoplayStart=!0,e.vt&&e._sendFF("onAutoplayStart")})),_defineProperty$5(_assertThisInitialized$4(e),"_onReset",(function(){e._state={autoplayStart:!1,isFFLoading:!1,isTimeUpdate:!1,isFFSend:!1,isLs:!1},e.vt=0,e.pt=0,e.fvt=0,e.newPointTime=now$2(),e.loadedCostTime=0,e.startCostTime=0,e._isSeeking=!1,e.seekingStart=0,e.waitingStart=0,e.fixedWaitingStart=0,e._isWaiting=!1,e._waitTimer&&util.clearTimeout(_assertThisInitialized$4(e),e._waitTimer),e._waittTimer&&util.clearTimeout(_assertThisInitialized$4(e),e._waittTimer),e._waitTimer=null,e._waittTimer=null,e._waitType=0})),_defineProperty$5(_assertThisInitialized$4(e),"_onSeeking",(function(){e.seekingStart||(e.suspendWaitingStatus("seek"),e.seekingStart=now$2(),e.emitLog(LOG_TYPES$1.SEEK_START,{start:now$2()}))})),_defineProperty$5(_assertThisInitialized$4(e),"_onSeeked",(function(){e.suspendSeekingStatus("seeked")})),_defineProperty$5(_assertThisInitialized$4(e),"_onWaitingLoadStart",(function(){e._isWaiting||e.vt||(e._isWaiting=!0,e.waitingStart=now$2(),e.fixedWaitingStart=now$2(),e._waitType=1,e.emitLog(LOG_TYPES$1.WAIT_START,{fixedStart:e.fixedWaitingStart,start:e.waitingStart,type:1,endType:"loadstart"}))})),_defineProperty$5(_assertThisInitialized$4(e),"_onWaiting",(function(){!e._isWaiting&&e.vt&&(e._isWaiting=!0,e.vt?e.seekingStart?e._waitType=2:e._waitType=0:e._waitType=1,e.fixedWaitingStart=now$2(),e._waitTimer=util.setTimeout(_assertThisInitialized$4(e),(function(){e._isWaiting&&(e.waitingStart=now$2(),util.clearTimeout(_assertThisInitialized$4(e),e._waitTimer),e._waitTimer=null,e._startWaitTimeout(),e.emitLog(LOG_TYPES$1.WAIT_START,{fixedStart:e.fixedWaitingStart,start:e.waitingStart,type:e._waitType,endType:2===e._waitType?"seek":"playing"}))}),200))})),_defineProperty$5(_assertThisInitialized$4(e),"_onError",(function(){e.suspendSeekingStatus("error"),e.suspendWaitingStatus("error")})),_defineProperty$5(_assertThisInitialized$4(e),"_onPlaying",(function(){e._isWaiting&&e.suspendWaitingStatus("playing")})),e}return _createClass$5(r,[{key:"afterCreate",value:function(){var e=this;this._onReset(),this._waitType="firstFrame",this._initOnceEvents(),this.newPointTime=now$2(),this.loadedCostTime=0,this.startCostTime=0,this.on(LOAD_START,(function(){var t=e._state,r=t.autoplayStart,n=t.isFFSend;e.startCostTime=now$2()-e.newPointTime,XG_DEBUG.logInfo("[xgLogger]".concat(e.player.playerId," LOAD_START"),"autoplayStart:".concat(r," isFFSend:").concat(n," startCostTime:").concat(e.startCostTime," newPointTime").concat(e.newPointTime)),n||(!t.isLs&&e.emitLog(LOG_TYPES$1.LOAD_START,{}),t.isLs=!0,t.isTimeUpdate=!1,t.isFFLoading=!0,e.pt=now$2(),e.vt=0,e.fvt=0,e._initOnceEvents(),e._onWaitingLoadStart())})),this.on(LOADED_DATA,(function(){e.vt=now$2(),e.fvt=e.vt-e.pt,e.loadedCostTime=e.vt-e.newPointTime;var t=e._state,r=t.isTimeUpdate,n=t.isFFSend,i=t.autoplayStart;XG_DEBUG.logInfo("[xgLogger]".concat(e.player.playerId," LOADED_DATA"),"fvt:".concat(e.fvt," isTimeUpdate:").concat(e._state.isTimeUpdate," loadedCostTime:").concat(e.loadedCostTime)),r&&i&&e._sendFF("loadedData"),n||e.emitLog(LOG_TYPES$1.LOADED_DATA,{}),e.suspendWaitingStatus("loadeddata")})),this.on(SEEKING,this._onSeeking),this.on(SEEKED,this._onSeeked),this.on(DESTROY,(function(){e.endState("destroy")})),this.on(URL_CHANGE,(function(){e.endState("urlChange"),XG_DEBUG.logInfo("[xgLogger]".concat(e.player.playerId," URL_CHANGE")),e._state.isFFSend&&e._onReset()})),this.on([PLAYING,CANPLAY],this._onPlaying),this.on(WAITING,this._onWaiting),this.on(ERROR$3,this._onError),this.on(RESET,(function(){XG_DEBUG.logInfo("[xgLogger]".concat(e.player.playerId," RESET")),e.endState("reset"),e._initOnceEvents(),e._onReset()}))}},{key:"_initOnceEvents",value:function(){this.off(AUTOPLAY_STARTED,this._onAutoplayStart),this.off(TIME_UPDATE,this._onTimeupdate),this.once(AUTOPLAY_STARTED,this._onAutoplayStart),this.once(TIME_UPDATE,this._onTimeupdate)}},{key:"_sendFF",value:function(e){this.s=now$2();var t=this._state,r=t.isFFLoading,n=t.isFFSend;XG_DEBUG.logInfo("[xgLogger]".concat(this.player.playerId," _sendFF"),"".concat(e," fvt:").concat(this.fvt," isFFLoading:").concat(r," !isFFSend:").concat(!n)),this.vt>0&&r&&!n&&(XG_DEBUG.logInfo("[xgLogger]".concat(this.player.playerId," emitLog_firstFrame"),e),this._state.isFFLoading=!1,this._state.isFFSend=!0,this.emitLog(LOG_TYPES$1.FIRST_FRAME,{fvt:this.fvt,costTime:this.fvt,vt:this.vt,startCostTime:this.startCostTime,loadedCostTime:this.loadedCostTime}))}},{key:"_startWaitTimeout",value:function(){var e=this;this._waittTimer&&util.clearTimeout(this,this._waittTimer),this._waittTimer=util.setTimeout(this,(function(){e.suspendWaitingStatus("timeout"),util.clearTimeout(e,e._waittTimer),e._waittTimer=null}),this.config.waitTimeout)}},{key:"endState",value:function(e){this.suspendWaitingStatus(e),this.suspendSeekingStatus(e)}},{key:"suspendSeekingStatus",value:function(e){if(this.seekingStart){var t=now$2(),r=t-this.seekingStart;this.seekingStart=0,this.emitLog(LOG_TYPES$1.SEEK_END,{end:t,costTime:r,endType:e})}}},{key:"suspendWaitingStatus",value:function(e){if(this._waitTimer&&(util.clearTimeout(this,this._waitTimer),this._waitTimer=null),this._waittTimer&&(util.clearTimeout(this,this._waittTimer),this._waittTimer=null),this._isWaiting=!1,this.waitingStart){var t=now$2(),r=t-this.waitingStart,n=t-this.fixedWaitingStart,i=this.config.waitTimeout;this._isWaiting=!1,this.waitingStart=0,this.fixedWaitingStart=0,this.emitLog(LOG_TYPES$1.WAIT_END,{fixedCostTime:n>i?i:n,costTime:r>i?i:r,type:"loadeddata"===e?1:this._waitType,endType:2===this._waitType?"seek":e})}}},{key:"emitLog",value:function(e,t){var r=this.player;this.emit(XGLOG,_objectSpread2$4({t:now$2(),host:util.getHostFromUrl(r.currentSrc),vtype:r.vtype,eventType:e,currentTime:this.player.currentTime,readyState:r.video.readyState,networkState:r.video.networkState},t))}}],[{key:"pluginName",get:function(){return"xgLogger"}},{key:"defaultConfig",get:function(){return{waitTimeout:1e4}}}]),r}(Plugin);function ReplaySvg(){return(new DOMParser).parseFromString('<svg class="xgplayer-replay-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 78 78" width="78" height="78">\n <path fill="#fff" transform="translate(20, 20)" d="M8.22708362,13.8757234 L11.2677371,12.6472196 C11.7798067,12.4403301 12.3626381,12.6877273 12.5695276,13.1997969 L12.9441342,14.1269807 C13.1510237,14.6390502 12.9036264,15.2218816 12.3915569,15.4287712 L6.8284538,17.6764107 L5.90126995,18.0510173 C5.38920044,18.2579068 4.80636901,18.0105096 4.5994795,17.49844 L1.97723335,11.0081531 C1.77034384,10.4960836 2.0177411,9.91325213 2.52981061,9.70636262 L3.45699446,9.33175602 C3.96906396,9.12486652 4.5518954,9.37226378 4.75878491,9.88433329 L5.67885163,12.1615783 C7.99551726,6.6766934 13.3983951,3 19.5,3 C27.7842712,3 34.5,9.71572875 34.5,18 C34.5,26.2842712 27.7842712,33 19.5,33 C15.4573596,33 11.6658607,31.3912946 8.87004692,28.5831991 C8.28554571,27.9961303 8.28762719,27.0463851 8.87469603,26.4618839 C9.46176488,25.8773827 10.4115101,25.8794641 10.9960113,26.466533 C13.2344327,28.7147875 16.263503,30 19.5,30 C26.127417,30 31.5,24.627417 31.5,18 C31.5,11.372583 26.127417,6 19.5,6 C14.4183772,6 9.94214483,9.18783811 8.22708362,13.8757234 Z"></path>\n</svg>\n',"image/svg+xml").firstChild}var Replay=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){return _classCallCheck$4(this,r),t.apply(this,arguments)}return _createClass$5(r,[{key:"registerIcons",value:function(){return{replay:ReplaySvg}}},{key:"afterCreate",value:function(){var e=this;Plugin.insert(this.icons.replay,this.root,0),this.__handleReplay=this.hook("replayClick",(function(){e.player.replay()}),{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.bind(".xgplayer-replay",["click","touchend"],this.__handleReplay),this.on(ENDED,(function(){if(e.playerConfig.loop||util.addClass(e.player.root,"replay"),!e.config.disable){e.show();var t=e.root.querySelector("path");if(t){var r=window.getComputedStyle(t).getPropertyValue("transform");if("string"==typeof r&&r.indexOf("none")>-1)return null;t.setAttribute("transform",r)}}})),this.on(PLAY,(function(){e.hide()}))}},{key:"handleReplay",value:function(e){e.preventDefault(),e.stopPropagation(),this.player.replay(),util.removeClass(this.player.root,"replay")}},{key:"show",value:function(){this.config.disable||(this.root.style.display="flex")}},{key:"enable",value:function(){this.config.disable=!1}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){this.unbind(".xgplayer-replay",["click","touchend"],this.__handleReplay)}},{key:"render",value:function(){return'<xg-replay class="xgplayer-replay">\n <xg-replay-txt class="xgplayer-replay-txt" lang-key="'.concat(this.i18nKeys.REPLAY,'">').concat(this.i18n.REPLAY,"</xg-replay-txt>\n </xg-replay>")}}],[{key:"pluginName",get:function(){return"replay"}},{key:"defaultConfig",get:function(){return{disable:!1}}}]),r}(Plugin),Poster=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){return _classCallCheck$4(this,r),t.apply(this,arguments)}return _createClass$5(r,[{key:"isEndedShow",get:function(){return this.config.isEndedShow},set:function(e){this.config.isEndedShow=e}},{key:"hide",value:function(){util.addClass(this.root,"hide")}},{key:"show",value:function(){util.removeClass(this.root,"hide")}},{key:"beforeCreate",value:function(e){"string"==typeof e.player.config.poster&&(e.config.poster=e.player.config.poster)}},{key:"afterCreate",value:function(){var e=this;this.on(ENDED,(function(){e.isEndedShow&&util.removeClass(e.root,"hide")})),this.config.hideCanplay?(this.once(TIME_UPDATE,(function(){e.onTimeUpdate()})),this.on(URL_CHANGE,(function(){util.removeClass(e.root,"hide"),util.addClass(e.root,"xg-showplay"),e.once(TIME_UPDATE,(function(){e.onTimeUpdate()}))}))):this.on(PLAY,(function(){util.addClass(e.root,"hide")}))}},{key:"onTimeUpdate",value:function(){var e=this;this.player.currentTime?util.removeClass(this.root,"xg-showplay"):this.once(TIME_UPDATE,(function(){e.onTimeUpdate()}))}},{key:"update",value:function(e){e&&(this.config.poster=e,this.root.style.backgroundImage="url(".concat(e,")"))}},{key:"render",value:function(){var e=this.config,t=e.poster,r=e.hideCanplay,n=t?"background-image:url(".concat(t,");"):"";return'<xg-poster class="xgplayer-poster '.concat(r?"xg-showplay":"",'" style="').concat(n,'">\n </xg-poster>')}}],[{key:"pluginName",get:function(){return"poster"}},{key:"defaultConfig",get:function(){return{isEndedShow:!0,hideCanplay:!1,poster:""}}}]),r}(Plugin);function PlaySvg(){return(new DOMParser).parseFromString('<svg class="play" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M576,363L810,512L576,661zM342,214L576,363L576,661L342,810z"></path>\n</svg>\n',"image/svg+xml").firstChild}function PauseSvg(){return(new DOMParser).parseFromString('<svg class="pause" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598,214h170v596h-170v-596zM256 810v-596h170v596h-170z"></path>\n</svg>\n',"image/svg+xml").firstChild}var AnimateMap={};function addAnimate(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{start:null,end:null};AnimateMap[e]&&window.clearTimeout(AnimateMap[e].id),AnimateMap[e]={},r.start&&r.start(),AnimateMap[e].id=window.setTimeout((function(){r.end&&r.end(),window.clearTimeout(AnimateMap[e].id),delete AnimateMap[e]}),t)}function clearAnimation(){Object.keys(AnimateMap).map((function(e){window.clearTimeout(AnimateMap[e].id),delete AnimateMap[e]}))}var Start=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n;return _classCallCheck$4(this,r),_defineProperty$5(_assertThisInitialized$4(n=t.call(this,e)),"onAutoplayStart",(function(){if(!n.autoPlayStart){var e="auto"===n.config.mode?"auto-hide":"hide";util.addClass(n.root,e),n.autoPlayStart=!0,n.onPlayPause("play")}})),n.autoPlayStart=!1,n}return _createClass$5(r,[{key:"afterCreate",value:function(){var e=this,t=this.player,r=this.playerConfig;this.initIcons(),this.once(READY,(function(){r&&(r.lang&&"en"===r.lang?util.addClass(t.root,"lang-is-en"):"jp"===r.lang&&util.addClass(t.root,"lang-is-jp"))})),this.on(AUTOPLAY_STARTED,this.onAutoplayStart),r.autoplay||this.show(),this.on(AUTOPLAY_PREVENTED,(function(){var t="auto"===e.config.mode?"auto-hide":"hide";e.setAttr("data-state","play"),util.removeClass(e.root,t),e.show()})),this.on(PLAY,(function(){e.onPlayPause("play")})),this.on(PAUSE,(function(){e.onPlayPause("pause")})),this.clickHandler=this.hook("startClick",this.switchPausePlay,{pre:function(t){t.cancelable&&t.preventDefault(),t.stopPropagation();var r=e.player.paused;e.emitUserAction(t,"switch_play_pause",{props:"paused",from:r,to:!r})}}),this.bind(["click","touchend"],this.clickHandler)}},{key:"registerIcons",value:function(){return{startPlay:{icon:PlaySvg,class:"xg-icon-play"},startPause:{icon:PauseSvg,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild("xg-start-inner",e.startPlay),this.appendChild("xg-start-inner",e.startPause)}},{key:"hide",value:function(){util.addClass(this.root,"hide")}},{key:"show",value:function(){util.removeClass(this.root,"hide")}},{key:"focusHide",value:function(){util.addClass(this.root,"focus-hide")}},{key:"recover",value:function(){util.removeClass(this.root,"focus-hide")}},{key:"switchStatus",value:function(e){e?this.setAttr("data-state",this.player.paused?"pause":"play"):this.setAttr("data-state",this.player.paused?"play":"pause")}},{key:"animate",value:function(e){var t=this;addAnimate("pauseplay",400,{start:function(){util.addClass(t.root,"interact"),t.show(),t.switchStatus(!0)},end:function(){util.removeClass(t.root,"interact"),!e&&t.hide()}})}},{key:"switchPausePlay",value:function(e){var t=this.player;(e.cancelable&&e.preventDefault(),e.stopPropagation(),t.state<STATES.READY)||(this.player.paused||t.state!==STATES.RUNNING?t.play():t.pause())}},{key:"onPlayPause",value:function(e){var t=this.config,r=this.player;if(!(r.state<STATES.RUNNING)&&this.autoPlayStart){if("show"===t.mode)return this.switchStatus(),void this.show();if("auto"!==t.mode){if(t.isShowPause&&r.paused&&!r.ended||t.isShowEnd&&r.ended)return this.switchStatus(),void this.show();if(t.disableAnimate)return this.switchStatus(),void this.hide();if("play"===e)this.autoPlayStart?this.animate():this.hide();else{if(!this.autoPlayStart||r.ended)return;this.animate()}}else this.switchStatus()}}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.clickHandler),clearAnimation()}},{key:"render",value:function(){var e=this.playerConfig.autoplay?"auto"===this.config.mode?"auto-hide":"hide":"";return'\n <xg-start class="xgplayer-start '.concat(e,'">\n <xg-start-inner></xg-start-inner>\n </xg-start>')}}],[{key:"pluginName",get:function(){return"start"}},{key:"defaultConfig",get:function(){return{isShowPause:!1,isShowEnd:!1,disableAnimate:!1,mode:"hide"}}}]),r}(Plugin),Enter=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){return _classCallCheck$4(this,r),t.apply(this,arguments)}return _createClass$5(r,[{key:"render",value:function(){var e=this.config.innerHtml,t=util.createDom("xg-enter","",{},"xgplayer-enter");if(e&&e instanceof window.HTMLElement)t.appendChild(e);else if(e&&"string"==typeof e)t.innerHTML=e;else{for(var r="",n=1;n<=12;n++)r+='<div class="xgplayer-enter-bar'.concat(n,'"></div>');t.innerHTML='<div class="xgplayer-enter-spinner">'.concat(r,"</div>")}return t}}],[{key:"pluginName",get:function(){return"enter"}},{key:"defaultConfig",get:function(){return{innerHtml:"",logo:""}}}]),r}(Plugin),MiniScreenIcon=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){return _classCallCheck$4(this,r),t.apply(this,arguments)}return _createClass$5(r,[{key:"afterCreate",value:function(){this.getMini=this.getMini.bind(this),this.exitMini=this.exitMini.bind(this),this.bind("click",this.getMini)}},{key:"getMini",value:function(){this.config.onClick&&this.config.onClick()}},{key:"exitMini",value:function(){this.config.onClick&&this.config.onClick()}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.getMini)}},{key:"render",value:function(){var e="MINISCREEN";return'\n <xg-icon class="xgplayer-miniicon">\n <div class="xgplayer-icon btn-text"><span class="icon-text" lang-key="'.concat(this.i18nKeys[e],'">').concat(this.i18n[e],"</span></div>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"miniscreenIcon"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.CONTROLS_RIGHT,index:10}}}]),r}(Plugin);function getStyleSize(e){var t=parseFloat(e);return-1===e.indexOf("%")&&!Number.isNaN(t)&&t}var measurements=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],measurementsLength=measurements.length;function getZeroSize(){for(var e={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},t=0;t<measurementsLength;t++){e[measurements[t]]=0}return e}function getStyle(e){return window.getComputedStyle(e)}function getSize(e){if("string"==typeof e&&(e=document.querySelector(e)),e&&"object"===_typeof$3(e)&&e.nodeType){var t=getStyle(e);if("none"===t.display)return getZeroSize();var r={};r.width=e.offsetWidth,r.height=e.offsetHeight;for(var n=r.isBorderBox="border-box"===t.boxSizing,i=0;i<measurementsLength;i++){var o=measurements[i],a=t[o],s=parseFloat(a);r[o]=Number.isNaN(s)?0:s}var l=r.paddingLeft+r.paddingRight,c=r.paddingTop+r.paddingBottom,u=r.marginLeft+r.marginRight,h=r.marginTop+r.marginBottom,d=r.borderLeftWidth+r.borderRightWidth,p=r.borderTopWidth+r.borderBottomWidth,f=n,g=getStyleSize(t.width);!1!==g&&(r.width=g+(f?0:l+d));var y=getStyleSize(t.height);return!1!==y&&(r.height=y+(f?0:c+p)),r.innerWidth=r.width-(l+d),r.innerHeight=r.height-(c+p),r.outerWidth=r.width+u,r.outerHeight=r.height+h,r}}function getTouch$1(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(n.identifier===t)return n}}var EVENTS$3={START:"dragStart",MOVE:"dragMove",ENDED:"dragEnded"},POST_START_EVENTS={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]},Draggabilly=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck$4(this,r),(n=t.call(this)).isEnabled=!0,n.isDragging=!1,n.isDown=!1,n.position={},n.downPoint={},n.dragPoint={x:0,y:0},n.startPos={x:0,y:0},n._root=e instanceof Element?e:document.querySelector(e),n._handlerDom=i.handle instanceof Element?i.handle:document.querySelector(i.handle),n._root&&n._handlerDom?(n._bindStartEvent(),n):_possibleConstructorReturn$4(n)}return _createClass$5(r,[{key:"_bindStartEvent",value:function(){var e=this;"ontouchstart"in window?this._startKey="touchstart":this._startKey="mousedown",this["on".concat(this._startKey)]=this["on".concat(this._startKey)].bind(this),this._handlerDom.addEventListener(this._startKey,this["on".concat(this._startKey)]),POST_START_EVENTS[this._startKey].map((function(t){e["on".concat(t)]=e["on".concat(t)].bind(e)}))}},{key:"_unbindStartEvent",value:function(){this._handlerDom.removeEventListener(this._startKey,this["on".concat(this._startKey)])}},{key:"_bindPostStartEvents",value:function(e){var t=this;if(e){var r=POST_START_EVENTS[this._startKey];r.map((function(e){window.addEventListener(e,t["on".concat(e)])})),this._boundPointerEvents=r}}},{key:"_unbindPostStartEvents",value:function(){var e=this;this._boundPointerEvents&&(this._boundPointerEvents.map((function(t){window.removeEventListener(t,e["on".concat(t)])})),delete this._boundPointerEvents)}},{key:"enable",value:function(){this.isEnabled=!0}},{key:"disable",value:function(){this.isEnabled=!1,this.isDragging&&this.onUp()}},{key:"onDocUp",value:function(e){this.onUp()}},{key:"animate",value:function(){var e=this;this.isDragging&&(this.positionDrag(),window.requestAnimationFrame((function(){e.animate()})))}},{key:"positionDrag",value:function(){var e="translate3d(".concat(this.dragPoint.x,"px, ").concat(this.dragPoint.y,"px, 0)");this._root.style.transform=e,this._root.style.webKitTransform=e}},{key:"setLeftTop",value:function(){this._root.style.left=this.position.x+"px",this._root.style.top=this.position.y+"px"}},{key:"onmousedown",value:function(e){this.dragStart(e,e)}},{key:"onmousemove",value:function(e){this.dragMove(e,e)}},{key:"onmouseup",value:function(e){this.dragEnd(e,e)}},{key:"ontouchstart",value:function(e){var t=e.changedTouches[0];this.dragStart(e,t),this.touchIdentifier=void 0!==t.pointerId?t.pointerId:t.identifier,e.preventDefault()}},{key:"ontouchmove",value:function(e){var t=getTouch$1(e.changedTouches,this.touchIdentifier);t&&this.dragMove(e,t)}},{key:"ontouchend",value:function(e){var t=getTouch$1(e.changedTouches,this.touchIdentifier);t&&this.dragEnd(e,t),e.preventDefault()}},{key:"ontouchcancel",value:function(e){var t=getTouch$1(e.changedTouches,this.touchIdentifier);t&&this.dragCancel(e,t)}},{key:"dragStart",value:function(e,t){if(this._root&&!this.isDown&&this.isEnabled){this.downPoint=t,this.dragPoint.x=0,this.dragPoint.y=0,this._getPosition();var r=getSize(this._root);this.startPos.x=this.position.x,this.startPos.y=this.position.y,this.startPos.maxY=window.innerHeight-r.height,this.startPos.maxX=window.innerWidth-r.width,this.setLeftTop(),this.isDown=!0,this._bindPostStartEvents(e)}}},{key:"dragRealStart",value:function(e,t){this.isDragging=!0,this.animate(),this.emit(EVENTS$3.START,this.startPos)}},{key:"dragEnd",value:function(e,t){this._root&&(this._unbindPostStartEvents(),this.isDragging&&(this._root.style.transform="",this.setLeftTop(),this.emit(EVENTS$3.ENDED)),this.presetInfo())}},{key:"_dragPointerMove",value:function(e,t){var r={x:t.pageX-this.downPoint.pageX,y:t.pageY-this.downPoint.pageY};return!this.isDragging&&this.hasDragStarted(r)&&this.dragRealStart(e,t),r}},{key:"dragMove",value:function(e,t){if(e=e||window.event,this.isDown){var r=this.startPos,n=r.x,i=r.y,o=this._dragPointerMove(e,t),a=o.x,s=o.y;a=this.checkContain("x",a,n),s=this.checkContain("y",s,i),this.position.x=n+a,this.position.y=i+s,this.dragPoint.x=a,this.dragPoint.y=s,this.emit(EVENTS$3.MOVE,this.position)}}},{key:"dragCancel",value:function(e,t){this.dragEnd(e,t)}},{key:"presetInfo",value:function(){this.isDragging=!1,this.startPos={x:0,y:0},this.dragPoint={x:0,y:0},this.isDown=!1}},{key:"destroy",value:function(){this._unbindStartEvent(),this._unbindPostStartEvents(),this.isDragging&&this.dragEnd(),this.removeAllListeners(),this._handlerDom=null}},{key:"hasDragStarted",value:function(e){return Math.abs(e.x)>3||Math.abs(e.y)>3}},{key:"checkContain",value:function(e,t,r){return t+r<0?0-r:"x"===e&&t+r>this.startPos.maxX?this.startPos.maxX-r:"y"===e&&t+r>this.startPos.maxY?this.startPos.maxY-r:t}},{key:"_getPosition",value:function(){var e=window.getComputedStyle(this._root),t=this._getPositionCoord(e.left,"width"),r=this._getPositionCoord(e.top,"height");this.position.x=Number.isNaN(t)?0:t,this.position.y=Number.isNaN(r)?0:r,this._addTransformPosition(e)}},{key:"_addTransformPosition",value:function(e){var t=e.transform;if(0===t.indexOf("matrix")){var r=t.split(","),n=0===t.indexOf("matrix3d")?12:4,i=parseInt(r[n],10),o=parseInt(r[n+1],10);this.position.x+=i,this.position.y+=o}}},{key:"_getPositionCoord",value:function(e,t){if(-1!==e.indexOf("%")){var r=getSize(this._root.parentNode);return r?parseFloat(e)/100*r[t]:0}return parseInt(e,10)}}]),r}(EventEmitter),MiniScreen=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n;_classCallCheck$4(this,r),_defineProperty$5(_assertThisInitialized$4(n=t.call(this,e)),"onCancelClick",(function(e){n.exitMini(),n.isClose=!0})),_defineProperty$5(_assertThisInitialized$4(n),"onCenterClick",(function(e){var t=_assertThisInitialized$4(n).player;t.paused?t.play():t.pause()})),_defineProperty$5(_assertThisInitialized$4(n),"onScroll",(function(e){if(!(!window.scrollY&&0!==window.scrollY||Math.abs(window.scrollY-n.pos.scrollY)<50)){var t=parseInt(util.getCss(n.player.root,"height"));t+=n.config.scrollTop,n.pos.scrollY=window.scrollY,window.scrollY>t+5?!n.isMini&&!n.isClose&&n.getMini():window.scrollY<=t&&(n.isMini&&n.exitMini(),n.isClose=!1)}})),n.isMini=!1,n.isClose=!1;var i=_assertThisInitialized$4(n).config;return n.pos={left:i.left<0?window.innerWidth-i.width-20:i.left,top:i.top<0?window.innerHeight-i.height-20:i.top,height:n.config.height,width:n.config.width,scrollY:window.scrollY||0},n.lastStyle=null,n}return _createClass$5(r,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.mini&&(e.config.isShowIcon=e.player.config.mini)}},{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.on(PAUSE,(function(){e.setAttr("data-state","pause")})),this.on(PLAY,(function(){e.setAttr("data-state","play")}))}},{key:"onPluginsReady",value:function(){var e=this,t=this.player;if(!this.config.disable){if(this.config.isShowIcon){var r={config:{onClick:function(){e.getMini()}}};t.controls.registerPlugin(MiniScreenIcon,r,MiniScreenIcon.pluginName)}var n=util.checkTouchSupport()?"touchend":"click";this.bind(".mini-cancel-btn",n,this.onCancelClick),this.bind(".play-icon",n,this.onCenterClick),this.config.disableDrag||(this._draggabilly=new Draggabilly(this.player.root,{handle:this.root})),this.config.isScrollSwitch&&window.addEventListener("scroll",this.onScroll)}}},{key:"registerIcons",value:function(){return{play:{icon:PlaySvg,class:"xg-icon-play"},pause:{icon:PauseSvg,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".play-icon",e.play),this.appendChild(".play-icon",e.pause)}},{key:"getMini",value:function(){var e=this;if(!this.isMini){var t=this.player,r=this.playerConfig,n=this.config.target||this.player.root;this.lastStyle={},util.addClass(t.root,"xgplayer-mini"),["width","height","top","left"].map((function(t){e.lastStyle[t]=n.style[t],n.style[t]="".concat(e.pos[t],"px")})),r.fluid&&(n.style["padding-top"]=""),this.emit(MINI_STATE_CHANGE,!0),t.isMini=this.isMini=!0}}},{key:"exitMini",value:function(){var e=this;if(!this.isMini)return!1;var t=this.player,r=this.playerConfig,n=this.config.target||this.player.root;util.removeClass(t.root,"xgplayer-mini"),this.lastStyle&&Object.keys(this.lastStyle).map((function(t){n.style[t]=e.lastStyle[t]})),this.lastStyle=null,r.fluid&&(t.root.style.width="100%",t.root.style.height="0",t.root.style["padding-top"]="".concat(100*r.height/r.width,"%")),this.emit(MINI_STATE_CHANGE,!1),this.isMini=t.isMini=!1}},{key:"destroy",value:function(){window.removeEventListener("scroll",this.onScroll);var e=util.checkTouchSupport()?"touchend":"click";this.unbind(".mini-cancel-btn",e,this.onCancelClick),this.unbind(".play-icon",e,this.onCenterClick),this._draggabilly&&this._draggabilly.destroy(),this._draggabilly=null,this.exitMini()}},{key:"render",value:function(){if(!this.config.disable)return'\n <xg-mini-layer class="xg-mini-layer">\n <xg-mini-header class="xgplayer-mini-header">\n <div lang-key="'.concat(this.i18nKeys.MINI_DRAG,'">').concat(this.i18n.MINI_DRAG,'</div>\n </xg-mini-header>\n <div class="mini-cancel-btn">\n <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">\n <path fill="#fff" fill-rule="evenodd" d="M3.99 3.49a1 1 0 0 1 1.414 0L10 8.085l4.596-4.595a1 1 0 1 1 1.414 1.414L11.414 9.5l4.596 4.596a1 1 0 0 1 .084 1.32l-.084.094a1 1 0 0 1-1.414 0L10 10.914 5.404 15.51a1 1 0 0 1-1.414-1.414L8.585 9.5 3.99 4.904a1 1 0 0 1-.084-1.32z"></path>\n </svg>\n </div>\n <div class="play-icon">\n </div>\n </xg-mini-layer>')}}],[{key:"pluginName",get:function(){return"miniscreen"}},{key:"defaultConfig",get:function(){return{index:10,disable:!1,width:320,height:180,left:-1,top:-1,isShowIcon:!1,isScrollSwitch:!1,scrollTop:0,disableDrag:!1}}}]),r}(Plugin),MOUSE_EVENTS={mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousemove:"onMouseMove"},HOOKS=["videoClick","videoDbClick"],PCPlugin=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return _defineProperty$5(_assertThisInitialized$4(e=t.call.apply(t,[this].concat(i))),"onMouseMove",(function(t){var r=_assertThisInitialized$4(e),n=r.player,i=r.playerConfig;n.isActive||(n.focus({autoHide:!i.closeDelayBlur}),!i.closeFocusVideoFocus&&n.media.focus())})),_defineProperty$5(_assertThisInitialized$4(e),"onMouseEnter",(function(t){var r=_assertThisInitialized$4(e),n=r.playerConfig,i=r.player;!n.closeFocusVideoFocus&&i.media.focus(),n.closeDelayBlur?i.focus({autoHide:!1}):i.focus()})),_defineProperty$5(_assertThisInitialized$4(e),"onMouseLeave",(function(t){var r=e.playerConfig,n=r.closePlayerBlur,i=r.leavePlayerTime,o=r.closeDelayBlur;n||o||(i?e.player.focus({autoHide:!0,delay:i}):e.player.blur())})),_defineProperty$5(_assertThisInitialized$4(e),"onVideoClick",(function(t){var r=_assertThisInitialized$4(e),n=r.player,i=r.playerConfig;t.target&&i.closeVideoClick||t.target!==n.root&&t.target!==n.media&&t.target!==n.innerContainer&&t.target!==n.media.__canvas||(t.preventDefault(),i.closeVideoStopPropagation||t.stopPropagation(),e._clickCount++,e.clickTimer&&(clearTimeout(e.clickTimer),e.clickTimer=null),e.clickTimer=setTimeout((function(){e._clickCount&&(e._clickCount--,runHooks(_assertThisInitialized$4(e),HOOKS[0],(function(t,r){e.switchPlayPause(r.e)}),{e:t,paused:n.paused}),clearTimeout(e.clickTimer),e.clickTimer=null)}),300))})),_defineProperty$5(_assertThisInitialized$4(e),"onVideoDblClick",(function(t){var r=_assertThisInitialized$4(e),n=r.player;r.playerConfig.closeVideoDblclick||!t.target||t.target!==n.media&&t.target!==n.media.__canvas||(e._clickCount<2?e._clickCount=0:(e._clickCount=0,e.clickTimer&&(clearTimeout(e.clickTimer),e.clickTimer=null),t.preventDefault(),t.stopPropagation(),runHooks(_assertThisInitialized$4(e),HOOKS[1],(function(t,r){e.emitUserAction(r.e,"switch_fullscreen",{props:"fullscreen",from:n.fullscreen,to:!n.fullscreen}),n.fullscreen?n.exitFullscreen():n.getFullscreen()}),{e:t,fullscreen:n.fullscreen})))})),e}return _createClass$5(r,[{key:"afterCreate",value:function(){var e=this;this._clickCount=0,HOOKS.map((function(t){e.__hooks[t]=null})),"mobile"===this.playerConfig.isMobileSimulateMode||"mobile"===sniffer$1.device&&!sniffer$1.os.isIpad||this.initEvents()}},{key:"initEvents",value:function(){var e=this,t=this.player,r=t.video,n=t.root,i=this.playerConfig.enableContextmenu;n&&n.addEventListener("click",this.onVideoClick,!1),n&&n.addEventListener("dblclick",this.onVideoDblClick,!1),Object.keys(MOUSE_EVENTS).map((function(t){n.addEventListener(t,e[MOUSE_EVENTS[t]],!1)})),i&&r&&r.addEventListener("contextmenu",this.onContextmenu,!1)}},{key:"switchPlayPause",value:function(e){var t=this.player;this.emitUserAction(e,"switch_play_pause",{props:"paused",from:t.paused,to:!t.paused}),t.ended?t.duration!==1/0&&t.duration>0&&t.replay():t.paused?t.play():t.pause()}},{key:"onContextmenu",value:function(e){(e=e||window.event).preventDefault&&e.preventDefault(),e.stopPropagation?e.stopPropagation():(e.returnValue=!1,e.cancelBubble=!0)}},{key:"destroy",value:function(){var e=this,t=this.player,r=t.video,n=t.root;this.clickTimer&&clearTimeout(this.clickTimer),n.removeEventListener("click",this.onVideoClick,!1),n.removeEventListener("dblclick",this.onVideoDblClick,!1),r.removeEventListener("contextmenu",this.onContextmenu,!1),Object.keys(MOUSE_EVENTS).map((function(t){n.removeEventListener(t,e[MOUSE_EVENTS[t]],!1)}))}}],[{key:"pluginName",get:function(){return"pc"}},{key:"defaultConfig",get:function(){return{}}}]),r}(BasePlugin),es_number_toFixed={},toIntegerOrInfinity$7=toIntegerOrInfinity$d,toString$6=toString$h,requireObjectCoercible$2=requireObjectCoercible$a,$RangeError$5=RangeError,stringRepeat=function(e){var t=toString$6(requireObjectCoercible$2(this)),r="",n=toIntegerOrInfinity$7(e);if(n<0||n==1/0)throw $RangeError$5("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},$$l=_export,uncurryThis$j=functionUncurryThis,toIntegerOrInfinity$6=toIntegerOrInfinity$d,thisNumberValue=thisNumberValue$2,$repeat=stringRepeat,fails$i=fails$L,$RangeError$4=RangeError,$String=String,floor$5=Math.floor,repeat=uncurryThis$j($repeat),stringSlice$3=uncurryThis$j("".slice),nativeToFixed=uncurryThis$j(1..toFixed),pow$2=function e(t,r,n){return 0===r?n:r%2==1?e(t,r-1,n*t):e(t*t,r/2,n)},log$1=function(e){for(var t=0,r=e;r>=4096;)t+=12,r/=4096;for(;r>=2;)t+=1,r/=2;return t},multiply=function(e,t,r){for(var n=-1,i=r;++n<6;)i+=t*e[n],e[n]=i%1e7,i=floor$5(i/1e7)},divide=function(e,t){for(var r=6,n=0;--r>=0;)n+=e[r],e[r]=floor$5(n/t),n=n%t*1e7},dataToString=function(e){for(var t=6,r="";--t>=0;)if(""!==r||0===t||0!==e[t]){var n=$String(e[t]);r=""===r?n:r+repeat("0",7-n.length)+n}return r},FORCED$6=fails$i((function(){return"0.000"!==nativeToFixed(8e-5,3)||"1"!==nativeToFixed(.9,0)||"1.25"!==nativeToFixed(1.255,2)||"1000000000000000128"!==nativeToFixed(0xde0b6b3a7640080,0)}))||!fails$i((function(){nativeToFixed({})}));$$l({target:"Number",proto:!0,forced:FORCED$6},{toFixed:function(e){var t,r,n,i,o=thisNumberValue(this),a=toIntegerOrInfinity$6(e),s=[0,0,0,0,0,0],l="",c="0";if(a<0||a>20)throw $RangeError$4("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return $String(o);if(o<0&&(l="-",o=-o),o>1e-21)if(r=(t=log$1(o*pow$2(2,69,1))-69)<0?o*pow$2(2,-t,1):o/pow$2(2,t,1),r*=4503599627370496,(t=52-t)>0){for(multiply(s,0,r),n=a;n>=7;)multiply(s,1e7,0),n-=7;for(multiply(s,pow$2(10,n,1),0),n=t-1;n>=23;)divide(s,1<<23),n-=23;divide(s,1<<n),multiply(s,1,1),divide(s,2),c=dataToString(s)}else multiply(s,0,r),multiply(s,1<<-t,0),c=dataToString(s)+repeat("0",a);return c=a>0?l+((i=c.length)<=a?"0."+repeat("0",a-i)+c:stringSlice$3(c,0,i-a)+"."+stringSlice$3(c,i-a)):l+c}});var EVENTS$2={PRESS:"press",PRESS_END:"pressend",DOUBlE_CLICK:"doubleclick",CLICK:"click",TOUCH_MOVE:"touchmove",TOUCH_START:"touchstart",TOUCH_END:"touchend"},TOUCHS={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},MOUSES={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"};function getTouch(e){return e&&e.length>0?e[e.length-1]:null}function preventToucheDefault(e){var t=navigator.userAgent;/(?:iPhone|iPad)/.test(t)&&e.cancelable&&e.preventDefault()}function getDefaultConfig(){return{pressDelay:600,dbClickDelay:200,disablePress:!1,disableDbClick:!1,miniStep:2,needPreventDefault:!0}}var Touche=function(){function e(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{eventType:"touch"};_classCallCheck$4(this,e),this._pos={moving:!1,start:!1,x:0,y:0},this.config=getDefaultConfig(),Object.keys(n).map((function(e){r.config[e]=n[e]})),this.root=t,this.events="mouse"===n.eventType?MOUSES:TOUCHS,this.pressIntrvalId=null,this.dbIntrvalId=null,this.__handlers={},this._initEvent()}return _createClass$5(e,[{key:"_initEvent",value:function(){this.onTouchStart=this.onTouchStart.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onTouchCancel=this.onTouchCancel.bind(this),this.root.addEventListener(this.events.start,this.onTouchStart)}},{key:"__setPress",value:function(e){var t=this,r=this.config;this.pressIntrvalId&&this.__clearPress(),this.pressIntrvalId=setTimeout((function(){t.trigger(EVENTS$2.PRESS,e),t._pos.press=!0,t.__clearPress()}),r.pressDelay)}},{key:"__clearPress",value:function(){window.clearTimeout(this.pressIntrvalId),this.pressIntrvalId=null}},{key:"__setDb",value:function(e){var t=this,r=this.config;if(this.dbIntrvalId)return this.__clearDb(),void this.trigger(EVENTS$2.DOUBlE_CLICK,e);this.dbIntrvalId=setTimeout((function(){t.__clearDb(),t._pos.start||t._pos.press||t._pos.moving||t.trigger(EVENTS$2.CLICK,e)}),r.dbClickDelay)}},{key:"__clearDb",value:function(){clearTimeout(this.dbIntrvalId),this.dbIntrvalId=null}},{key:"on",value:function(e,t){this.__handlers[e]||(this.__handlers[e]=[]),this.__handlers[e].push(t)}},{key:"off",value:function(e,t){if(this.__handlers[e]){for(var r=this.__handlers[e],n=-1,i=0;i<r.length;i++)if(r[i]===t){n=i;break}n>=0&&this.__handlers[e].splice(n,1)}}},{key:"trigger",value:function(e,t){this.__handlers[e]&&this.__handlers[e].map((function(r){try{r(t)}catch(error){console.error("trigger>>:".concat(e),error)}}))}},{key:"onTouchStart",value:function(e){var t=this._pos,r=this.root;this.config.needPreventDefault&&preventToucheDefault(e);var n=getTouch(e.touches);t.x=n?parseInt(n.pageX,10):e.pageX,t.y=n?parseInt(n.pageX,10):e.pageX,t.start=!0,this.__setPress(e),r.addEventListener(this.events.end,this.onTouchEnd),r.addEventListener(this.events.cancel,this.onTouchCancel),r.addEventListener(this.events.move,this.onTouchMove),this.trigger(EVENTS$2.TOUCH_START,e)}},{key:"onTouchCancel",value:function(e){this.onTouchEnd(e)}},{key:"onTouchEnd",value:function(e){var t=this._pos,r=this.root;this.config.needPreventDefault&&preventToucheDefault(e),this.__clearPress(),r.removeEventListener(this.events.cancel,this.onTouchCancel),r.removeEventListener(this.events.end,this.onTouchEnd),r.removeEventListener(this.events.move,this.onTouchMove),e.moving=t.moving,e.press=t.press,t.press&&this.trigger(EVENTS$2.PRESS_END,e),this.trigger(EVENTS$2.TOUCH_END,e),!t.press&&!t.moving&&this.__setDb(e),t.press=!1,t.start=!1,t.moving=!1}},{key:"onTouchMove",value:function(e){var t=this._pos,r=this.config,n=getTouch(e.touches),i=n?parseInt(n.pageX,10):e.pageX,o=n?parseInt(n.pageY,10):e.pageX,a=i-t.x,s=o-t.y;Math.abs(s)<r.miniStep&&Math.abs(a)<r.miniStep||(this.__clearPress(),t.press&&this.trigger(EVENTS$2.PRESS_END,e),t.press=!1,t.moving=!0,this.trigger(EVENTS$2.TOUCH_MOVE,e))}},{key:"destroy",value:function(){var e=this,t={touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"};Object.keys(t).map((function(r){e.root.removeEventListener("touchend",e[t[r]])}))}}]),e}();function SeekTipIcon(){return(new DOMParser).parseFromString('<svg width="20" height="9" viewBox="0 0 8 9" fill="none" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <path opacity="0.54"\n d="M7.5 3.63397C8.16667 4.01887 8.16667 4.98113 7.5 5.36603L1.5 8.83013C0.833334 9.21503 0 8.7339 0 7.9641L0 1.0359C0 0.266098 0.833333 -0.215027 1.5 0.169873L7.5 3.63397Z"\n fill="white" />\n <path transform="translate(5 0)" d="M7.5 3.63397C8.16667 4.01887 8.16667 4.98113 7.5 5.36603L1.5 8.83013C0.833334 9.21503 0 8.7339 0 7.9641L0 1.0359C0 0.266098 0.833333 -0.215027 1.5 0.169873L7.5 3.63397Z" fill="white"/>\n</svg>',"image/svg+xml").firstChild}var ACTIONS={AUTO:"auto",SEEKING:"seeking",PLAYBACK:"playbackrate",LIGHT:""},MobilePlugin=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n;return _classCallCheck$4(this,r),_defineProperty$5(_assertThisInitialized$4(n=t.call(this,e)),"onTouchStart",(function(e){var t=_assertThisInitialized$4(n),r=t.player,i=t.config,o=t.pos,a=t.playerConfig,s=n.getTouche(e);if(s&&!i.disableGesture&&n.duration>0&&!r.ended){o.isStart=!0,util.checkIsFunction(a.disableSwipeHandler)&&a.disableSwipeHandler(),n.find(".xg-dur").innerHTML=util.format(n.duration);var l=n.root.getBoundingClientRect();90===r.rotateDeg?(o.top=l.left,o.left=l.top,o.width=l.height,o.height=l.width):(o.top=l.top,o.left=l.left,o.width=l.width,o.height=l.height);var c=parseInt(s.pageX-o.left,10),u=parseInt(s.pageY-o.top,10);o.x=90===r.rotateDeg?u:c,o.y=90===r.rotateDeg?c:u,o.scopeL=i.scopeL*o.width,o.scopeR=(1-i.scopeR)*o.width,o.scopeM1=o.width*(1-i.scopeM)/2,o.scopeM2=o.width-o.scopeM1}})),_defineProperty$5(_assertThisInitialized$4(n),"onTouchMove",(function(e){var t=n.getTouche(e),r=_assertThisInitialized$4(n),i=r.pos,o=r.config,a=r.player;if(t&&!o.disableGesture&&n.duration&&i.isStart){var s=o.miniMoveStep,l=o.hideControlsActive,c=parseInt(t.pageX-i.left,10),u=parseInt(t.pageY-i.top,10),h=90===a.rotateDeg?u:c,d=90===a.rotateDeg?c:u;if(Math.abs(h-i.x)>s||Math.abs(d-i.y)>s){var p=h-i.x,f=d-i.y,g=i.scope;if(-1===g&&(0===(g=n.checkScope(h,d,p,f,i))&&(l?a.blur():a.focus({autoHide:!1}),!i.time&&(i.time=parseInt(1e3*a.currentTime,10)+1e3*n.timeOffset)),i.scope=g),-1===g||g>0&&!o.gestureY||0===g&&!o.gestureX)return;e.cancelable&&e.preventDefault(),n.executeMove(p,f,g,i.width,i.height),i.x=h,i.y=d}}})),_defineProperty$5(_assertThisInitialized$4(n),"onTouchEnd",(function(e){var t=_assertThisInitialized$4(n),r=t.player,i=t.pos,o=t.playerConfig;if(i.isStart){i.scope>-1&&e.cancelable&&e.preventDefault();var a=n.config,s=a.disableGesture,l=a.gestureX;!s&&l?(n.endLastMove(i.scope),setTimeout((function(){r.getPlugin("progress")&&r.getPlugin("progress").resetSeekState()}),10)):i.time=0,i.scope=-1,n.resetPos(),util.checkIsFunction(o.enableSwipeHandler)&&o.enableSwipeHandler(),n.changeAction(ACTIONS.AUTO)}})),_defineProperty$5(_assertThisInitialized$4(n),"onRootTouchMove",(function(e){!n.config.disableGesture&&n.config.gestureX&&n.checkIsRootTarget(e)&&(e.stopPropagation(),n.pos.isStart?n.onTouchMove(e):n.onTouchStart(e))})),_defineProperty$5(_assertThisInitialized$4(n),"onRootTouchEnd",(function(e){n.pos.isStart&&n.checkIsRootTarget(e)&&(e.stopPropagation(),n.onTouchEnd(e))})),n.pos={isStart:!1,x:0,y:0,time:0,volume:0,rate:1,light:0,width:0,height:0,scopeL:0,scopeR:0,scopeM1:0,scopeM2:0,scope:-1},n.timer=null,n}return _createClass$5(r,[{key:"duration",get:function(){return this.playerConfig.customDuration||this.player.duration}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"registerIcons",value:function(){return{seekTipIcon:{icon:SeekTipIcon,class:"xg-seek-pre"}}}},{key:"afterCreate",value:function(){var e=this,t=this.playerConfig,r=this.config,n=this.player;!0===t.closeVideoDblclick&&(r.closedbClick=!0),this.resetPos(),util.isUndefined(t.disableGesture)||(r.disableGesture=!!t.disableGesture),this.appendChild(".xg-seek-icon",this.icons.seekTipIcon),this.xgMask=util.createDom("xg-mask","",{},"xgmask"),n.root.appendChild(this.xgMask),this.initCustomStyle(),this.registerThumbnail();var i=this.domEventType;this.touch=new Touche(this.root,{eventType:i,needPreventDefault:!this.config.disableGesture}),this.root.addEventListener("contextmenu",(function(e){e.preventDefault()})),n.root.addEventListener("touchmove",this.onRootTouchMove,!0),n.root.addEventListener("touchend",this.onRootTouchEnd,!0),this.on(DURATION_CHANGE,(function(){var t=e.player,r=e.config;1e3*t.duration<r.moveDuration&&(r.moveDuration=1e3*t.duration)})),this.on([CANPLAY,ENDED],(function(){var t=e.pos,r=t.time;!t.isStart&&r>0&&(e.pos.time=0)}));var o={touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",press:"onPress",pressend:"onPressEnd",click:"onClick",doubleclick:"onDbClick"};if(Object.keys(o).map((function(t){e.touch.on(t,(function(r){e[o[t]](r)}))})),!r.disableActive){var a=n.plugins.progress;a&&(a.addCallBack("dragmove",(function(t){e.activeSeekNote(t.currentTime,t.forward)})),a.addCallBack("dragend",(function(){e.changeAction(ACTIONS.AUTO)})))}}},{key:"registerThumbnail",value:function(){var e=this.player.plugins.thumbnail;if(e&&e.usable){this.thumbnail=e.createThumbnail(null,"mobile-thumbnail");var t=this.find(".time-preview");t.insertBefore(this.thumbnail,t.children[0])}}},{key:"initCustomStyle",value:function(){var e=(this.playerConfig||{}).commonStyle,t=e.playedColor,r=e.progressColor;t&&(this.find(".xg-curbar").style.backgroundColor=t,this.find(".xg-cur").style.color=t),r&&(this.find(".xg-bar").style.backgroundColor=r,this.find(".time-preview").style.color=r),this.config.disableTimeProgress&&util.addClass(this.find(".xg-timebar"),"hide")}},{key:"resetPos",value:function(){var e=this;this.pos?(this.pos.isStart=!1,this.pos.scope=-1,["x","y","width","height","scopeL","scopeR","scopeM1","scopeM2"].map((function(t){e.pos[t]=0}))):this.pos={isStart:!1,x:0,y:0,volume:0,rate:1,light:0,width:0,height:0,scopeL:0,scopeR:0,scopeM1:0,scopeM2:0,scope:-1,time:0}}},{key:"changeAction",value:function(e){var t=this.player;this.root.setAttribute("data-xg-action",e);var r=t.plugins.start;r&&r.recover()}},{key:"getTouche",value:function(e){this.player.rotateDeg;var t=e.touches&&e.touches.length>0?e.touches[e.touches.length-1]:e;return{pageX:t.pageX,pageY:t.pageY}}},{key:"checkScope",value:function(e,t,r,n,i){var o=i.width,a=-1;if(e<0||e>o)return a;var s=0===n?Math.abs(r):Math.abs(r/n);return Math.abs(r)>0&&s>=1.73&&e>i.scopeM1&&e<i.scopeM2?a=0:(0===Math.abs(r)||s<=.57)&&(a=e<i.scopeL?1:e>i.scopeR?2:3),a}},{key:"executeMove",value:function(e,t,r,n,i){switch(r){case 0:this.updateTime(e/n*this.config.scopeM);break;case 1:this.updateBrightness(t/i);break;case 2:sniffer$1.os.isIos||this.updateVolume(t/i)}}},{key:"endLastMove",value:function(e){var t=this,r=this.pos,n=this.player,i=this.config,o=(r.time-this.timeOffset)/1e3;if(0===e)n.seek(Number(o).toFixed(1)),i.hideControlsEnd?n.blur():n.focus(),this.timer=setTimeout((function(){t.pos.time=0}),500);this.changeAction(ACTIONS.AUTO)}},{key:"checkIsRootTarget",value:function(e){var t=this.player.plugins||{};return(!t.progress||!t.progress.root.contains(e.target))&&(t.start&&t.start.root.contains(e.target)||t.controls&&t.controls.root.contains(e.target))}},{key:"sendUseAction",value:function(e){var t=this.player.paused;this.emitUserAction(e,"switch_play_pause",{prop:"paused",from:t,to:!t})}},{key:"onClick",value:function(e){var t=this.player,r=this.config,n=this.playerConfig;t.state<STATES.RUNNING?n.closeVideoClick||(this.sendUseAction(util.createEvent("click")),t.play()):!r.closedbClick||n.closeVideoClick?t.isActive?t.blur():t.focus():n.closeVideoClick||((t.isActive||r.focusVideoClick)&&(this.emitUserAction("click","switch_play_pause"),this.switchPlayPause()),t.focus())}},{key:"onDbClick",value:function(e){var t=this.config,r=this.player;!t.closedbClick&&r.state>=STATES.RUNNING&&(this.sendUseAction(util.createEvent("dblclick")),this.switchPlayPause())}},{key:"onPress",value:function(e){var t=this.pos,r=this.config,n=this.player;r.disablePress||(t.rate=this.player.playbackRate,this.emitUserAction("press","change_rate",{prop:"playbackRate",from:n.playbackRate,to:r.pressRate}),n.playbackRate=r.pressRate,this.changeAction(ACTIONS.PLAYBACK))}},{key:"onPressEnd",value:function(e){var t=this.pos,r=this.config,n=this.player;r.disablePress||(this.emitUserAction("pressend","change_rate",{prop:"playbackRate",from:n.playbackRate,to:t.rate}),n.playbackRate=t.rate,t.rate=1,this.changeAction(ACTIONS.AUTO))}},{key:"updateTime",value:function(e){var t=this.player,r=this.config,n=this.player.duration;e=Number(e.toFixed(4));var i=parseInt(e*r.moveDuration,10)+this.timeOffset;i=(i+=this.pos.time)<0?0:i>1e3*n?1e3*n-200:i,t.getPlugin("time")&&t.getPlugin("time").updateTime(i/1e3),t.getPlugin("progress")&&t.getPlugin("progress").updatePercent(i/1e3/this.duration,!0),this.activeSeekNote(i/1e3,e>0),r.isTouchingSeek&&t.seek(Number((i-this.timeOffset)/1e3).toFixed(1)),this.pos.time=i}},{key:"updateVolume",value:function(e){this.player.rotateDeg&&(e=-e);var t=this.player,r=this.pos;if(e=parseInt(100*e,10),r.volume+=e,!(Math.abs(r.volume)<10)){var n=parseInt(10*t.volume,10)-parseInt(r.volume/10,10);n=n>10?10:n<1?0:n,t.volume=n/10,r.volume=0}}},{key:"updateBrightness",value:function(e){this.player.rotateDeg&&(e=-e);var t=this.pos,r=this.config,n=this.xgMask,i=t.light+.8*e;i=i>r.maxDarkness?r.maxDarkness:i<0?0:i,n&&(n.style.backgroundColor="rgba(0,0,0,".concat(i,")")),t.light=i}},{key:"activeSeekNote",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.player,n=this.config,i=!(this.duration!==1/0&&this.duration>0);if(e&&"number"==typeof e&&!i&&!n.disableActive){e<0?e=0:e>r.duration&&(e=r.duration-.2),this.changeAction(ACTIONS.SEEKING);var o=r.plugins.start;o&&o.focusHide(),this.find(".xg-dur").innerHTML=util.format(this.duration),this.find(".xg-cur").innerHTML=util.format(e),this.find(".xg-curbar").style.width="".concat(e/this.duration*100,"%"),t?util.removeClass(this.find(".xg-seek-show"),"xg-back"):util.addClass(this.find(".xg-seek-show"),"xg-back"),this.updateThumbnails(e)}}},{key:"updateThumbnails",value:function(e){var t=this.player.plugins.thumbnail;t&&t.usable&&this.thumbnail&&t.update(this.thumbnail,e,160,90)}},{key:"switchPlayPause",value:function(){var e=this.player;if(e.state<STATES.ATTACHED)return!1;e.ended||(e.paused?e.play():e.pause())}},{key:"disableGesture",value:function(){this.config.disableGesture=!1}},{key:"enableGesture",value:function(){this.config.disableGesture=!0}},{key:"destroy",value:function(){var e=this.player;this.timer&&clearTimeout(this.timer),this.thumbnail=null,e.root.removeChild(this.xgMask),this.xgMask=null,this.touch&&this.touch.destroy(),this.touch=null,e.root.removeEventListener("touchmove",this.onRootTouchMove,!0),e.root.removeEventListener("touchend",this.onRootTouchEnd,!0)}},{key:"render",value:function(){var e="normal"!==this.config.gradient?"gradient ".concat(this.config.gradient):"gradient";return'\n <xg-trigger class="trigger">\n <div class="'.concat(e,'"></div>\n <div class="time-preview">\n <div class="xg-seek-show ').concat(this.config.disableSeekIcon?" hide-seek-icon":"",'">\n <i class="xg-seek-icon"></i>\n <span class="xg-cur">00:00</span>\n <span>/</span>\n <span class="xg-dur">00:00</span>\n </div>\n <div class="xg-bar xg-timebar">\n <div class="xg-curbar"></div>\n </div>\n </div>\n <div class="xg-playbackrate xg-top-note">\n <span><i>').concat(this.config.pressRate,"X</i>").concat(this.i18n.FORWARD,"</span>\n </div>\n </xg-trigger>\n ")}}],[{key:"pluginName",get:function(){return"mobile"}},{key:"defaultConfig",get:function(){return{index:0,disableGesture:!1,gestureX:!0,gestureY:!0,gradient:"normal",isTouchingSeek:!1,miniMoveStep:5,miniYPer:5,scopeL:.25,scopeR:.25,scopeM:.9,pressRate:2,darkness:!0,maxDarkness:.8,disableActive:!1,disableTimeProgress:!1,hideControlsActive:!1,hideControlsEnd:!1,moveDuration:36e4,closedbClick:!1,disablePress:!0,disableSeekIcon:!1,focusVideoClick:!1}}}]),r}(Plugin);function preventDefault(e){e.preventDefault(),e.returnValue=!1}function isDisableTag(e){var t=e.tagName;return!("INPUT"!==t&&"TEXTAREA"!==t&&!e.isContentEditable)}var Keyboard=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return _defineProperty$5(_assertThisInitialized$4(e=t.call.apply(t,[this].concat(i))),"onBodyKeyDown",(function(t){var r=t||window.event;if(e.player&&(e.player.isUserActive||e.config.isIgnoreUserActive)&&!(e.config.disable||e.config.disableBodyTrigger||!e.checkIsVisible()||r.metaKey||r.altKey||r.ctrlKey)){var n=r.keyCode;return!(r.target!==document.body&&(!e.config.isGlobalTrigger||isDisableTag(r.target))||!e.checkCode(n,!0))&&(preventDefault(r),e.handleKeyCode(n,t),!1)}})),_defineProperty$5(_assertThisInitialized$4(e),"onKeydown",(function(t){var r=t||window.event;if(!(e.config.disable||e.config.disableRootTrigger||r.metaKey||r.altKey||r.ctrlKey)&&(e.player.isUserActive||e.config.isIgnoreUserActive)&&(e.player.isUserActive||e.config.isIgnoreUserActive)){if(!r||37!==r.keyCode&&!e.checkCode(r.keyCode)||r.target!==e.player.root&&r.target!==e.player.video&&r.target!==e.player.controls.el)return!0;preventDefault(r),e.handleKeyCode(r.keyCode,t)}})),e}return _createClass$5(r,[{key:"mergekeyCodeMap",value:function(){var e=this,t=this.config.keyCodeMap;t&&Object.keys(t).map((function(r){e.keyCodeMap[r]?["keyCode","action","disable","isBodyTarget"].map((function(n){t[r][n]&&(e.keyCodeMap[r][n]=t[r][n])})):e.keyCodeMap[r]=t[r]}))}},{key:"afterCreate",value:function(){this.config.disable=!this.playerConfig.keyShortcut;var e="function"==typeof this.config.seekStep?this.config.seekStep(this.player):this.config.seekStep;e&&"number"==typeof e&&(this.seekStep=e),this.keyCodeMap={space:{keyCode:32,action:"playPause",disable:!1,noBodyTarget:!1},up:{keyCode:38,action:"upVolume",disable:!1,noBodyTarget:!0},down:{keyCode:40,action:"downVolume",disable:!1,noBodyTarget:!0},left:{keyCode:37,action:"seekBack",disable:!1},right:{keyCode:39,action:"seek",disable:!1},esc:{keyCode:27,action:"exitFullscreen",disable:!1}},this.mergekeyCodeMap(),this.player.root.addEventListener("keydown",this.onKeydown),document.addEventListener("keydown",this.onBodyKeyDown)}},{key:"checkIsVisible",value:function(){if(!this.config.checkVisible)return!0;var e=this.player.root.getBoundingClientRect(),t=e.height,r=e.top,n=e.bottom,i=window.innerHeight;return!(r<0&&r<0-.9*t||n>0&&n-i>.9*t)}},{key:"checkCode",value:function(e,t){var r=this,n=!1;return Object.keys(this.keyCodeMap).map((function(i){r.keyCodeMap[i]&&e===r.keyCodeMap[i].keyCode&&!r.keyCodeMap[i].disable&&(n=!t||t&&!r.keyCodeMap[i].noBodyTarget)})),n}},{key:"downVolume",value:function(e){var t=this.player,r=parseFloat((t.volume-.1).toFixed(1)),n={volume:{from:t.volume,to:r}};this.emitUserAction(e,"change_volume",{props:n}),t.volume=r>=0?r:0}},{key:"upVolume",value:function(e){var t=this.player,r=parseFloat((t.volume+.1).toFixed(1)),n={volume:{from:t.volume,to:r}};this.emitUserAction(e,"change_volume",{props:n}),t.volume=r<=1?r:1}},{key:"seek",value:function(e){var t=this.player,r=t.currentTime,n=t.duration,i=r,o={currentTime:{from:r,to:i=r+this.seekStep<=n?r+this.seekStep:n-1}};this.emitUserAction(e,"seek",{props:o}),this.player.currentTime=i}},{key:"seekBack",value:function(e){var t=this.player.currentTime,r=0;t-this.seekStep>=0&&(r=t-this.seekStep);var n={currentTime:{from:t,to:r}};this.emitUserAction(e,"seek",{props:n}),this.player.currentTime=r}},{key:"playPause",value:function(e){var t=this.player;t&&(this.emitUserAction(e,"switch_play_pause"),t.paused?t.play():t.pause())}},{key:"exitFullscreen",value:function(e){var t=this.player,r=t.fullscreen,n=t.cssfullscreen;r&&(this.emitUserAction("keyup","switch_fullscreen",{prop:"fullscreen",from:r,to:!r}),t.exitFullscreen()),n&&(this.emitUserAction("keyup","switch_css_fullscreen",{prop:"cssfullscreen",from:n,to:!n}),t.exitCssFullscreen())}},{key:"handleKeyCode",value:function(e,t){var r=this;Object.keys(this.keyCodeMap).map((function(n){var i=r.keyCodeMap[n],o=i.action,a=i.keyCode,s=i.disable;a!==e||s||("function"==typeof o?o(t,r.player):"string"==typeof o&&"function"==typeof r[o]&&r[o](t,r.player),r.emit(SHORTCUT,_objectSpread2$4({key:n,target:t.target},r.keyCodeMap[n])))}))}},{key:"destroy",value:function(){this.player.root.removeEventListener("keydown",this.onKeydown),document.removeEventListener("keydown",this.onBodyKeyDown)}},{key:"disable",value:function(){this.config.disable=!0}},{key:"enable",value:function(){this.config.disable=!1}}],[{key:"pluginName",get:function(){return"keyboard"}},{key:"defaultConfig",get:function(){return{seekStep:10,checkVisible:!0,disableBodyTrigger:!1,disableRootTrigger:!1,isGlobalTrigger:!1,keyCodeMap:{},disable:!1,isIgnoreUserActive:!1}}}]),r}(BasePlugin);function loadingIcon(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="-5 -5 110 110">\n <path d="M100,50A50,50,0,1,1,50,0" stroke-width="5" stroke="#ddd" stroke-dasharray="236" fill="none"></path>\n</svg>\n',"image/svg+xml").firstChild}var Loading=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){return _classCallCheck$4(this,r),t.apply(this,arguments)}return _createClass$5(r,[{key:"registerIcons",value:function(){return{loadingIcon:loadingIcon}}},{key:"afterCreate",value:function(){this.appendChild("xg-loading-inner",this.icons.loadingIcon)}},{key:"render",value:function(){return'\n <xg-loading class="xgplayer-loading">\n <xg-loading-inner></xg-loading-inner>\n </xg-loading>'}}],[{key:"pluginName",get:function(){return"loading"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.ROOT}}}]),r}(Plugin),$$k=_export,$findIndex$1=arrayIteration.findIndex,addToUnscopables$1=addToUnscopables$4,FIND_INDEX="findIndex",SKIPS_HOLES=!0;FIND_INDEX in[]&&Array(1)[FIND_INDEX]((function(){SKIPS_HOLES=!1})),$$k({target:"Array",proto:!0,forced:SKIPS_HOLES},{findIndex:function(e){return $findIndex$1(this,e,arguments.length>1?arguments[1]:void 0)}}),addToUnscopables$1(FIND_INDEX);var TPL=[{tag:"xg-cache",className:"xgplayer-progress-cache",styleKey:"cachedColor"},{tag:"xg-played",className:"xgplayer-progress-played",styleKey:"playedColor"}],InnerList=function(){function e(t){_classCallCheck$4(this,e),this.fragments=t.fragments||[],this._callBack=t.actionCallback,this.fragConfig={fragFocusClass:t.fragFocusClass||"inner-focus-point",fragAutoFocus:!!t.fragAutoFocus,fragClass:t.fragClass||""},this.style=t.style||{playedColor:"",cachedColor:"",progressColor:""},this.duration=0,this.cachedIndex=0,this.playedIndex=0,this.focusIndex=-1}return _createClass$5(e,[{key:"updateDuration",value:function(e){var t=this;this.duration=e;var r=0,n=this.fragments;this.fragments=n.map((function(e){return e.start=parseInt(r,10),e.end=parseInt(r+e.percent*t.duration,10),e.duration=parseInt(e.percent*t.duration,10),r+=e.percent*t.duration,e}))}},{key:"updateProgress",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"played",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{newIndex:0,curIndex:0,millisecond:0},r=this.progressList,n=this.fragments,i=t.newIndex,o=t.curIndex,a=t.millisecond;i!==o&&r.map((function(t,r){r<i?t[e].style.width="100%":r>i&&(t[e].style.width=0)}));var s=n[i],l=0===a?0:(a-s.start)/s.duration;r[i][e].style.width=l<0?0:"".concat(100*l,"%")}},{key:"updateFocus",value:function(e){if(this.fragConfig.fragAutoFocus&&!(this.fragments.length<2))if(e){var t=this.findIndex(1e3*e.currentTime,this.focusIndex);if(t!==this.focusIndex){this.focusIndex>-1&&this.unHightLight(this.focusIndex),this.setHightLight(t);var r={index:t,preIndex:this.focusIndex,fragment:this.fragments[this.focusIndex]};this.focusIndex=t,this._callBack&&this._callBack(r)}}else if(this.focusIndex>-1){this.unHightLight(this.focusIndex);var n={index:-1,preIndex:this.focusIndex,fragment:null};this._callBack&&this._callBack(n),this.focusIndex=-1}}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cached:0,played:0},t=arguments.length>1?arguments[1]:void 0;if(!this.duration||parseInt(1e3*t,10)!==this.duration){if(!t&&0!==t)return;this.updateDuration(parseInt(1e3*t,10))}var r=this.playedIndex,n=this.cachedIndex;if("Undefined"!==util.typeOf(e.played)){var i=this.findIndex(1e3*e.played,r);this.updateProgress("played",{newIndex:i,curIndex:r,millisecond:parseInt(1e3*e.played,10)}),this.playedIndex=i}if("Undefined"!==util.typeOf(e.cached)){var o=this.findIndex(1e3*e.cached,n);this.updateProgress("cached",{newIndex:o,curIndex:n,millisecond:parseInt(1e3*e.cached,10)}),this.cachedIndex=o}}},{key:"findIndex",value:function(e,t){var r=this.fragments;if(1===r.length)return 0;if(t>-1&&e>r[t].start&&e<r[t].end)return t;if(e>r[r.length-1].start)return r.length-1;for(var n=0;n<r.length;n++)if(e>r[n].start&&e<=r[n].end){t=n;break}return t}},{key:"findHightLight",value:function(){for(var e=this.root.children,t=0;t<e.length;t++)if(util.hasClass(e[t],this.fragConfig.fragFocusClass))return{dom:e[t],pos:e[t].getBoundingClientRect()}}},{key:"findFragment",value:function(e){var t=this.root.children;return e<0||e>=t.length?null:{dom:t[e],pos:t[e].getBoundingClientRect()}}},{key:"unHightLight",value:function(){for(var e=this.root.children,t=0;t<e.length;t++)util.removeClass(e[t],this.fragConfig.fragFocusClass)}},{key:"setHightLight",value:function(e){var t=this.root.children;if(e<t.length)return util.addClass(t[e],this.fragConfig.fragFocusClass),{dom:t[e],pos:t[e].getBoundingClientRect()}}},{key:"destroy",value:function(){this.progressList=null,this.fragments=null,this.root.innerHTML=""}},{key:"reset",value:function(e){var t=this;if(Object.keys(this.fragConfig).forEach((function(r){void 0!==e[r]&&(t.fragConfig[r]=e[r])})),e.fragments){if(this.fragments=0===e.fragments.length?[{percent:1}]:e.fragments,this.updateDuration(this.duration),this.playedIndex=0,this.cachedIndex=0,this.root)for(var r=this.root.children;r.length>0;)this.root.removeChild(r[0]);this.render()}}},{key:"render",value:function(){var e=this,t=this.style.progressColor;if(this.root||(this.root=util.createDom("xg-inners","",{},"progress-list")),this.fragments){var r=this.fragConfig,n=r.fragClass,i=r.fragFocusClass;this.progressList=this.fragments.map((function(r){var o=util.createDom("xg-inner","",{style:t?"background:".concat(t,"; flex: ").concat(r.percent):"flex: ".concat(r.percent)},"".concat(r.isFocus?i:""," xgplayer-progress-inner ").concat(n));return e.root.appendChild(o),TPL.forEach((function(t){o.appendChild(util.createDom(t.tag,"",{style:t.styleKey?"background: ".concat(e.style[t.styleKey],"; width:0;"):"width:0;"},t.className))})),{cached:o.children[0],played:o.children[1]}}))}return this.root}}]),e}(),FRAGMENT_FOCUS_CLASS={POINT:"inner-focus-point",HIGHLIGHT:"inner-focus-highlight"},Progress=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n;return _classCallCheck$4(this,r),_defineProperty$5(_assertThisInitialized$4(n=t.call(this,e)),"onMoveOnly",(function(e,t){var r=_assertThisInitialized$4(n),i=r.pos,o=r.config,a=r.player,s=t;if(e){util.event(e);var l=util.getEventPos(e,a.zoom),c=90===a.rotateDeg?l.clientY:l.clientX;if(i.moving&&Math.abs(i.x-c)<o.miniMoveStep)return;i.moving=!0,i.x=c,s=n.computeTime(e,c)}n.triggerCallbacks("dragmove",s,e),n._updateInnerFocus(s)})),_defineProperty$5(_assertThisInitialized$4(n),"onBodyClick",(function(e){n.pos.isLocked&&(n.pos.isLocked=!1,e.preventDefault(),e.stopPropagation())})),_defineProperty$5(_assertThisInitialized$4(n),"_mouseDownHandler",(function(e,t){n._state.time=t.currentTime,n.updateWidth(t.currentTime,t.percent,0),n._updateInnerFocus(t)})),_defineProperty$5(_assertThisInitialized$4(n),"_mouseUpHandler",(function(e,t){_assertThisInitialized$4(n).pos.moving&&n.updateWidth(t.currentTime,t.percent,2)})),_defineProperty$5(_assertThisInitialized$4(n),"_mouseMoveHandler",(function(e,t){var r=_assertThisInitialized$4(n),i=r._state,o=r.pos,a=r.config,s=r.player;i.time<t.currentTime?t.forward=!0:t.forward=!1,i.time=t.currentTime,o.isDown&&!o.moving&&(o.moving=!0,a.isPauseMoving&&s.pause(),n.triggerCallbacks("dragstart",t,e),n.emitUserAction("drag","dragstart",t)),n.updateWidth(t.currentTime,t.percent,1),n.triggerCallbacks("dragmove",t,e),n._updateInnerFocus(t)})),_defineProperty$5(_assertThisInitialized$4(n),"onMouseDown",(function(e){var t=_assertThisInitialized$4(n),r=t._state,i=t.player,o=t.pos,a=t.config,s=t.playerConfig,l=util.getEventPos(e,i.zoom),c=90===i.rotateDeg?l.clientY:l.clientX;if(!(i.isMini||a.closeMoveSeek||!s.allowSeekAfterEnded&&i.ended)){e.stopPropagation(),n.focus(),util.checkIsFunction(s.disableSwipeHandler)&&s.disableSwipeHandler(),util.checkIsFunction(a.onMoveStart)&&a.onMoveStart(),util.event(e),o.x=c,o.isDown=!0,o.moving=!1,r.prePlayTime=i.currentTime,i.focus({autoHide:!1}),n.isProgressMoving=!0,util.addClass(n.progressBtn,"active");var u=n.computeTime(e,c);return u.prePlayTime=r.prePlayTime,n._mouseDownHandlerHook(e,u),"touchstart"===e.type?(n.root.addEventListener("touchmove",n.onMouseMove),n.root.addEventListener("touchend",n.onMouseUp)):(n.unbind("mousemove",n.onMoveOnly),document.addEventListener("mousemove",n.onMouseMove,!1),document.addEventListener("mouseup",n.onMouseUp,!1)),!0}})),_defineProperty$5(_assertThisInitialized$4(n),"onMouseUp",(function(e){var t=_assertThisInitialized$4(n),r=t.player,i=t.config,o=t.pos,a=t.playerConfig,s=t._state;e.stopPropagation(),e.preventDefault(),util.checkIsFunction(a.enableSwipeHandler)&&a.enableSwipeHandler(),util.checkIsFunction(i.onMoveEnd)&&i.onMoveEnd(),util.event(e),util.removeClass(n.progressBtn,"active");var l=n.computeTime(e,o.x);l.prePlayTime=s.prePlayTime,o.moving?(n.triggerCallbacks("dragend",l,e),n.emitUserAction("drag","dragend",l)):(n.triggerCallbacks("click",l,e),n.emitUserAction("click","click",l)),n._mouseUpHandlerHook(e,l),o.moving=!1,o.isDown=!1,o.x=0,o.y=0,o.isLocked=!0,s.prePlayTime=0,s.time=0,"touchend"===e.type?(n.root.removeEventListener("touchmove",n.onMouseMove),n.root.removeEventListener("touchend",n.onMouseUp),n.blur()):(document.removeEventListener("mousemove",n.onMouseMove,!1),document.removeEventListener("mouseup",n.onMouseUp,!1),o.isEnter?"mobile"!==a.isMobileSimulateMode&&n.bind("mousemove",n.onMoveOnly):n.onMouseLeave(e)),util.setTimeout(_assertThisInitialized$4(n),(function(){n.resetSeekState()}),10),r.focus()})),_defineProperty$5(_assertThisInitialized$4(n),"onMouseMove",(function(e){var t=_assertThisInitialized$4(n),r=t._state,i=t.pos,o=t.player,a=t.config;util.checkTouchSupport()&&e.preventDefault(),util.event(e);var s=util.getEventPos(e,o.zoom),l=90===o.rotateDeg?s.clientY:s.clientX,c=Math.abs(i.x-l);if(!(i.moving&&c<a.miniMoveStep||!i.moving&&c<a.miniStartStep)){i.x=l;var u=n.computeTime(e,l);u.prePlayTime=r.prePlayTime,n._mouseMoveHandlerHook(e,u)}})),_defineProperty$5(_assertThisInitialized$4(n),"onMouseOut",(function(e){n.triggerCallbacks("mouseout",null,e)})),_defineProperty$5(_assertThisInitialized$4(n),"onMouseOver",(function(e){n.triggerCallbacks("mouseover",null,e)})),_defineProperty$5(_assertThisInitialized$4(n),"onMouseEnter",(function(e){var t=_assertThisInitialized$4(n),r=t.player,i=t.pos;if(!(i.isDown||i.isEnter||r.isMini||!r.config.allowSeekAfterEnded&&r.ended)){i.isEnter=!0,n.bind("mousemove",n.onMoveOnly),n.bind("mouseleave",n.onMouseLeave),util.event(e);var o=util.getEventPos(e,r.zoom),a=90===r.rotateDeg?o.clientY:o.clientX,s=n.computeTime(e,a);n.triggerCallbacks("mouseenter",s,e),n.focus()}})),_defineProperty$5(_assertThisInitialized$4(n),"onMouseLeave",(function(e){n.triggerCallbacks("mouseleave",null,e),n.unlock(),n._updateInnerFocus(null)})),_defineProperty$5(_assertThisInitialized$4(n),"onVideoResize",(function(){var e=n.pos,t=e.x,r=e.isDown;if(e.isEnter&&!r){var i=n.computeTime(null,t);n.onMoveOnly(null,i)}})),n.useable=!1,n.isProgressMoving=!1,n.__dragCallBacks=[],n._state={now:-1,direc:0,time:0,prePlayTime:-1},n._disableBlur=!1,n}return _createClass$5(r,[{key:"duration",get:function(){return this.playerConfig.customDuration||this.player.duration}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"changeState",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.useable=e}},{key:"_initInner",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=_objectSpread2$4(_objectSpread2$4({fragments:t},r),{},{actionCallback:function(t){e.emitUserAction("fragment_focus","fragment_focus",t)}});this.innerList?this.innerList.reset(n):(this.innerList=new InnerList(n),this.outer.insertBefore(this.innerList.render(),this.outer.children[0]),["findHightLight","unHightLight","setHightLight","findFragment"].map((function(t){e[t]=e.innerList[t].bind(e.innerList)})))}},{key:"_updateInnerFocus",value:function(e){this.innerList&&this.innerList.updateFocus(e)}},{key:"afterCreate",value:function(){var e=this;if(!this.config.disable&&!this.playerConfig.isLive){this.pos={x:0,y:0,moving:!1,isDown:!1,isEnter:!1,isLocked:!1},this.outer=this.find("xg-outer");var t=this.config,r=t.fragFocusClass,n=t.fragAutoFocus,i=t.fragClass;this._initInner(this.config.fragments,{fragFocusClass:r,fragAutoFocus:n,fragClass:i,style:this.playerConfig.commonStyle||{}}),"mobile"===sniffer$1.device&&(this.config.isDragingSeek=!1,this.isMobile=!0),this.progressBtn=this.find(".xgplayer-progress-btn"),this.on(DURATION_CHANGE,(function(){e.onMouseLeave()})),this.on(TIME_UPDATE,(function(){e.onTimeupdate()})),this.on(SEEKED,(function(){e.onTimeupdate(),e.onCacheUpdate()})),this.on(PROGRESS,(function(){e.onCacheUpdate()})),this.on(ENDED,(function(){e.onCacheUpdate(),e._state.now=0})),this.on(EMPTIED,(function(){e.onReset()})),this.on(VIDEO_RESIZE,(function(){e.onVideoResize()})),this.bindDomEvents(),this.initCustomStyle()}}},{key:"setConfig",value:function(e){var t=this,r=null;Object.keys(e).forEach((function(n){t.config[n]=e[n],"fragments"===n&&(r=e[n])})),r&&this._initInner(r,e)}},{key:"initCustomStyle",value:function(){var e=(this.playerConfig||{}).commonStyle.sliderBtnStyle,t=this.progressBtn;e&&("string"==typeof e?t.style.boxShadow=e:"object"===_typeof$3(e)&&Object.keys(e).map((function(r){t.style[r]=e[r]})))}},{key:"triggerCallbacks",value:function(e,t,r){this.__dragCallBacks.length>0&&this.__dragCallBacks.map((function(n){if(n&&n.handler&&n.type===e)try{n.handler(t,r)}catch(error){console.error("[XGPLAYER][triggerCallbacks] ".concat(n," error"),error)}}))}},{key:"addCallBack",value:function(e,t){t&&"function"==typeof t&&this.__dragCallBacks.push({type:e,handler:t})}},{key:"removeCallBack",value:function(e,t){var r=this.__dragCallBacks,n=-1;r.map((function(r,i){r&&r.type===e&&r.handler===t&&(n=i)})),n>-1&&r.splice(n,1)}},{key:"unlock",value:function(){var e=this.player,t=this.pos;t.isEnter=!1,e.isMini||(this.unbind("mousemove",this.onMoveOnly),t.isDown?this.unbind("mouseleave",this.onMouseLeave):this.blur())}},{key:"bindDomEvents",value:function(){var e=this.player,t=e.controls,r=e.config;this._mouseDownHandlerHook=this.hook("dragstart",this._mouseDownHandler),this._mouseUpHandlerHook=this.hook("dragend",this._mouseUpHandler),this._mouseMoveHandlerHook=this.hook("drag",this._mouseMoveHandler),"touch"!==this.domEventType&&"compatible"!==this.domEventType||(this.root.addEventListener("touchstart",this.onMouseDown),t&&(t.root&&t.root.addEventListener("touchmove",util.stopPropagation),t.center&&t.center.addEventListener("touchend",util.stopPropagation))),"mouse"!==this.domEventType&&"compatible"!==this.domEventType||(this.bind("mousedown",this.onMouseDown),"mobile"!==r.isMobileSimulateMode&&this.bind("mouseenter",this.onMouseEnter),this.bind("mouseover",this.onMouseOver),this.bind("mouseout",this.onMouseOut),this.player.root.addEventListener("click",this.onBodyClick,!0))}},{key:"focus",value:function(){this.player.controls.pauseAutoHide(),util.addClass(this.root,"active")}},{key:"blur",value:function(){this._disableBlur||(this.player.controls.recoverAutoHide(),util.removeClass(this.root,"active"))}},{key:"disableBlur",value:function(){this._disableBlur=!0}},{key:"enableBlur",value:function(){this._disableBlur=!1}},{key:"updateWidth",value:function(e,t,r){var n=this.config,i=this.player;if(!n.isCloseClickSeek||0!==r){var o=e>=i.duration?i.duration-n.endedDiff:Number(e).toFixed(1);this.updatePercent(t),this.updateTime(e),(1!==r||n.isDragingSeek&&"audio"!==i.config.mediaType)&&(this._state.now=o,this._state.direc=o>i.currentTime?0:1,i.seek(o))}}},{key:"computeTime",value:function(e,t){var r,n,i=this.player,o=this.root.getBoundingClientRect(),a=o.width,s=o.height,l=o.top,c=o.left,u=t;90===i.rotateDeg?(r=s,n=l):(r=a,n=c);var h=u-n,d=(h=h>r?r:h<0?0:h)/r;return{percent:d=d<0?0:d>1?1:d,currentTime:parseInt(d*this.duration*1e3,10)/1e3,offset:h,width:r,left:n,e:e}}},{key:"updateTime",value:function(e){var t=this.player,r=this.duration;e>r?e=r:e<0&&(e=0);var n=t.plugins.time;n&&n.updateTime(e)}},{key:"resetSeekState",value:function(){this.isProgressMoving=!1;var e=this.player.plugins.time;e&&e.resetActive()}},{key:"updatePercent",value:function(e,t){if(this.isProgressMoving=!0,!this.config.disable){e=e>1?1:e<0?0:e,this.progressBtn.style.left="".concat(100*e,"%"),this.innerList.update({played:e*this.duration},this.duration);var r=this.player.plugins.miniprogress;r&&r.update({played:e*this.duration},this.duration)}}},{key:"onTimeupdate",value:function(){var e=this.player,t=this._state,r=this.duration;if(!(e.isSeeking||this.isProgressMoving||e.state<STATES.RUNNING)){if(t.now>-1){var n=parseInt(1e3*t.now,10)-parseInt(1e3*e.currentTime,10);if(0===t.direc&&n>300||1===t.direc&&n>-300)return void(t.now=-1);t.now=-1}var i=this.timeOffset+e.currentTime;this.innerList.update({played:i},r),this.progressBtn.style.left="".concat(i/r*100,"%");var o=this.player.plugins.miniprogress;o&&o.update({played:i},r)}}},{key:"onCacheUpdate",value:function(){var e=this.player,t=this.duration;if(e){var r=e.bufferedPoint;this.innerList.update({cached:r.end},t);var n=this.player.plugins.miniprogress;n&&n.update({cached:r.end},t)}}},{key:"onReset",value:function(){this.innerList.update({played:0,cached:0},0);var e=this.player.plugins.miniprogress;e&&e.update({cached:0,played:0},0)}},{key:"destroy",value:function(){var e=this.player,t=e.controls;this.thumbnailPlugin=null,this.innerList.destroy(),this.innerList=null;var r=this.domEventType;"touch"!==r&&"compatible"!==r||(this.root.removeEventListener("touchstart",this.onMouseDown),this.root.removeEventListener("touchmove",this.onMouseMove),this.root.removeEventListener("touchend",this.onMouseUp),t&&(t.root&&t.root.removeEventListener("touchmove",util.stopPropagation),t.center&&t.center.removeEventListener("touchend",util.stopPropagation))),"mouse"!==r&&"compatible"!==r||(this.unbind("mousedown",this.onMouseDown),this.unbind("mouseenter",this.onMouseEnter),this.unbind("mousemove",this.onMoveOnly),this.unbind("mouseleave",this.onMouseLeave),document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),e.root.removeEventListener("click",this.onBodyClick,!0))}},{key:"render",value:function(){if(!this.config.disable&&!this.playerConfig.isLive){var e=this.player.controls?this.player.controls.config.mode:"";return'\n <xg-progress class="xgplayer-progress '.concat("bottom"===e?"xgplayer-progress-bottom":"",'">\n <xg-outer class="xgplayer-progress-outer">\n <xg-progress-btn class="xgplayer-progress-btn"></xg-progress-btn>\n </xg-outer>\n </xg-progress>\n ')}}}],[{key:"pluginName",get:function(){return"progress"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.CONTROLS_CENTER,index:0,disable:!1,isDragingSeek:!0,closeMoveSeek:!1,isPauseMoving:!1,isCloseClickSeek:!1,fragments:[{percent:1}],fragFocusClass:FRAGMENT_FOCUS_CLASS.POINT,fragClass:"",fragAutoFocus:!1,miniMoveStep:5,miniStartStep:2,onMoveStart:function(){},onMoveEnd:function(){},endedDiff:.2}}},{key:"FRAGMENT_FOCUS_CLASS",get:function(){return FRAGMENT_FOCUS_CLASS}}]),r}(Plugin),Fullscreen$1=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return _defineProperty$5(_assertThisInitialized$4(e=t.call.apply(t,[this].concat(i))),"_onMouseenter",(function(t){e.emit("icon_mouseenter",{pluginName:e.pluginName})})),_defineProperty$5(_assertThisInitialized$4(e),"_onMouseLeave",(function(t){e.emit("icon_mouseleave",{pluginName:e.pluginName})})),e}return _createClass$5(r,[{key:"afterCreate",value:function(){this.bind("mouseenter",this._onMouseenter),this.bind("mouseleave",this._onMouseLeave)}},{key:"destroy",value:function(){this.unbind("mouseenter",this._onMouseenter),this.unbind("mouseleave",this._onMouseLeave)}}]),r}(Plugin),Play=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){return _classCallCheck$4(this,r),t.apply(this,arguments)}return _createClass$5(r,[{key:"afterCreate",value:function(){var e=this;_get$2(_getPrototypeOf$4(r.prototype),"afterCreate",this).call(this);var t=this.player;this.config.disable||(this.initIcons(),this.btnClick=this.btnClick.bind(this),this.bind(["touchend","click"],this.btnClick),this.on([PAUSE,ERROR$3],(function(){e.animate(t.paused)})),this.on(PLAY,(function(){e.animate(t.paused)})),this.animate(!0))}},{key:"registerIcons",value:function(){return{play:{icon:PlaySvg,class:"xg-icon-play"},pause:{icon:PauseSvg,class:"xg-icon-pause"}}}},{key:"btnClick",value:function(e){e.preventDefault(),e.stopPropagation();var t=this.player;return this.emitUserAction(e,"switch_play_pause",{prop:"paused",from:t.paused,to:!t.paused}),t.ended?t.replay():t.paused?(t.play(),this.animate(!1)):(t.pause(),this.animate(!0)),!1}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.play),this.appendChild(".xgplayer-icon",e.pause)}},{key:"animate",value:function(e){var t=this.i18nKeys,r=this.find(".xg-tips");e?(this.setAttr("data-state","pause"),r&&this.changeLangTextKey(r,t.PLAY_TIPS)):(this.setAttr("data-state","play"),r&&this.changeLangTextKey(r,t.PAUSE_TIPS))}},{key:"destroy",value:function(){_get$2(_getPrototypeOf$4(r.prototype),"destroy",this).call(this),this.unbind(["touchend","click"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-play">\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="'.concat(this.i18nKeys.PLAY_TIPS,'">').concat(this.i18n.PLAY_TIPS,"</div>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"play"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.CONTROLS_LEFT,index:0,disable:!1}}}]),r}(Fullscreen$1);function BackSVG(){return(new DOMParser).parseFromString('<svg width="32px" height="40px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <path d="M11.2374369,14 L17.6187184,7.61871843 C17.9604272,7.27700968 17.9604272,6.72299032 17.6187184,6.38128157 C17.2770097,6.03957281 16.7229903,6.03957281 16.3812816,6.38128157 L9.38128157,13.3812816 C9.03957281,13.7229903 9.03957281,14.2770097 9.38128157,14.6187184 L16.3812816,21.6187184 C16.7229903,21.9604272 17.2770097,21.9604272 17.6187184,21.6187184 C17.9604272,21.2770097 17.9604272,20.7229903 17.6187184,20.3812816 L11.2374369,14 L11.2374369,14 Z" fill="#FFFFFF"></path>\n </g>\n</svg>',"image/svg+xml").firstChild}var TopBackIcon=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){return _classCallCheck$4(this,r),t.apply(this,arguments)}return _createClass$5(r,[{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.onClick=function(t){t.preventDefault(),t.stopPropagation(),e.config.onClick(t)},this.bind(["click","touchend"],this.onClick)}},{key:"registerIcons",value:function(){return{screenBack:{icon:BackSVG,class:"xg-fullscreen-back"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(this.root,e.screenBack)}},{key:"show",value:function(){util.addClass(this.root,"show")}},{key:"hide",value:function(){util.removeClass(this.root,"show")}},{key:"render",value:function(){return'<xg-icon class="xgplayer-back">\n </xg-icon>'}}],[{key:"pluginName",get:function(){return"topbackicon"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.ROOT_TOP,index:0}}}]),r}(Plugin);function FullScreenSvg(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598 214h212v212h-84v-128h-128v-84zM726 726v-128h84v212h-212v-84h128zM214 426v-212h212v84h-128v128h-84zM298 598v128h128v84h-212v-212h84z"></path>\n</svg>\n',"image/svg+xml").firstChild}function ExitFullScreenSvg(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M682 342h128v84h-212v-212h84v128zM598 810v-212h212v84h-128v128h-84zM342 342v-128h84v212h-212v-84h128zM214 682v-84h212v212h-84v-128h-128z"></path>\n</svg>\n',"image/svg+xml").firstChild}var Fullscreen=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return _defineProperty$5(_assertThisInitialized$4(e=t.call.apply(t,[this].concat(i))),"_onOrientationChange",(function(t){e.player.fullscreen&&e.config.rotateFullscreen&&(90===window.orientation||-90===window.orientation?e.player.setRotateDeg(0):e.player.setRotateDeg(90))})),e}return _createClass$5(r,[{key:"afterCreate",value:function(){var e=this;_get$2(_getPrototypeOf$4(r.prototype),"afterCreate",this).call(this);var t=this.config,n=this.playerConfig;if(!t.disable){t.target&&(this.playerConfig.fullscreenTarget=this.config.target);var i=util.getFullScreenEl();n.fullscreenTarget===i&&this.player.getFullscreen().catch((function(e){})),this.initIcons(),this.handleFullscreen=this.hook("fullscreenChange",this.toggleFullScreen,{pre:function(t){var r=e.player.fullscreen;e.emitUserAction(t,"switch_fullscreen",{prop:"fullscreen",from:r,to:!r})}}),this.bind(".xgplayer-fullscreen",["touchend","click"],this.handleFullscreen),this.on(FULLSCREEN_CHANGE,(function(t){var r=e.find(".xg-tips");r&&e.changeLangTextKey(r,t?e.i18nKeys.EXITFULLSCREEN_TIPS:e.i18nKeys.FULLSCREEN_TIPS),e.animate(t)})),this.config.needBackIcon&&(this.topBackIcon=this.player.registerPlugin({plugin:TopBackIcon,options:{config:{onClick:function(t){e.handleFullscreen(t)}}}})),"mobile"===sniffer$1.device&&window.addEventListener("orientationchange",this._onOrientationChange)}}},{key:"registerIcons",value:function(){return{fullscreen:{icon:FullScreenSvg,class:"xg-get-fullscreen"},exitFullscreen:{icon:ExitFullScreenSvg,class:"xg-exit-fullscreen"}}}},{key:"destroy",value:function(){_get$2(_getPrototypeOf$4(r.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon","mobile"===sniffer$1.device?"touchend":"click",this.handleFullscreen),"mobile"===sniffer$1.device&&window.removeEventListener("orientationchange",this._onOrientationChange)}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.fullscreen),this.appendChild(".xgplayer-icon",e.exitFullscreen)}},{key:"toggleFullScreen",value:function(e){e&&(e.preventDefault(),e.stopPropagation());var t=this.player,r=this.config;!0===r.useCssFullscreen||"function"==typeof r.useCssFullscreen&&r.useCssFullscreen()?(t.fullscreen?t.exitCssFullscreen():t.getCssFullscreen(),this.animate(t.fullscreen)):r.rotateFullscreen?(t.fullscreen?t.exitRotateFullscreen():t.getRotateFullscreen(),this.animate(t.fullscreen)):r.switchCallback&&"function"==typeof r.switchCallback?r.switchCallback(t.fullscreen):t.fullscreen?t.exitFullscreen():t.getFullscreen().catch((function(e){}))}},{key:"animate",value:function(e){e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.topBackIcon&&(e?(this.topBackIcon.show(),this.hide()):(this.topBackIcon.hide(),this.show()))}},{key:"show",value:function(){_get$2(_getPrototypeOf$4(r.prototype),"show",this).call(this)}},{key:"hide",value:function(){_get$2(_getPrototypeOf$4(r.prototype),"hide",this).call(this)}},{key:"render",value:function(){if(!this.config.disable){var e="FULLSCREEN_TIPS";return'<xg-icon class="xgplayer-fullscreen">\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="'.concat(this.i18nKeys[e],'">').concat(this.i18n[e],"</div>\n </xg-icon>")}}}],[{key:"pluginName",get:function(){return"fullscreen"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.CONTROLS_RIGHT,index:0,useCssFullscreen:!1,rotateFullscreen:!1,switchCallback:null,target:null,disable:!1,needBackIcon:!1}}}]),r}(Fullscreen$1),Time=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n;return _classCallCheck$4(this,r),(n=t.call(this,e)).isActiving=!1,n}return _createClass$5(r,[{key:"duration",get:function(){return this.playerConfig.customDuration||this.player.duration}},{key:"currentTime",get:function(){return this.player.currentTime||0}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"afterCreate",value:function(){var e=this,t=this.player.controls.config.mode;this.mode="flex"===t?"flex":"normal",this.config.disable||("flex"===this.mode&&(this.createCenterTime(),this.hide()),this.durationDom=this.find(".time-duration"),this.timeDom=this.find(".time-current"),this.on(DURATION_CHANGE,(function(){e.onTimeUpdate()})),this.on(TIME_UPDATE,(function(){e.onTimeUpdate()})),this.on(EMPTIED,(function(){e.onReset()})))}},{key:"show",value:function(){"flex"!==this.mode&&_get$2(_getPrototypeOf$4(r.prototype),"show",this).call(this)}},{key:"onTimeUpdate",value:function(){var e=this.player;if(!(this.config.disable||this.isActiving||e.state<STATES.RUNNING&&e.state!==STATES.ATTACHED)){var t=this.currentTime+this.timeOffset;"flex"===this.mode?(this.centerCurDom.innerHTML=util.format(t),this.duration!==1/0&&this.duration>0&&(this.centerDurDom.innerHTML=util.format(this.duration))):(this.timeDom.innerHTML=util.format(t),this.duration!==1/0&&this.duration>0&&(this.durationDom.innerHTML=util.format(this.duration)))}}},{key:"onReset",value:function(){"flex"===this.mode?(this.centerCurDom.innerHTML=util.format(0),this.centerDurDom.innerHTML=util.format(0)):(this.timeDom.innerHTML=util.format(0),this.durationDom.innerHTML=util.format(0))}},{key:"createCenterTime",value:function(){var e=this.player;if(e.controls&&e.controls.center){var t=e.controls.center;this.centerCurDom=util.createDom("xg-icon","00:00",{},"xgplayer-time left"),this.centerDurDom=util.createDom("xg-icon","00:00",{},"xgplayer-time right"),t.children.length>0?t.insertBefore(this.centerCurDom,t.children[0]):t.appendChild(this.centerCurDom),t.appendChild(this.centerDurDom)}}},{key:"afterPlayerInit",value:function(){var e=this.config;this.duration===1/0||this.playerConfig.isLive?(util.hide(this.durationDom),util.hide(this.timeDom),util.hide(this.find(".time-separator")),util.show(this.find(".time-live-tag"))):util.hide(this.find(".time-live-tag")),e.hide?this.hide():this.show()}},{key:"changeLiveState",value:function(e){e?(util.hide(this.durationDom),util.hide(this.timeDom),util.hide(this.find(".time-separator")),util.show(this.find(".time-live-tag"))):(util.hide(this.find(".time-live-tag")),util.show(this.find(".time-separator")),util.show(this.durationDom),util.show(this.timeDom))}},{key:"updateTime",value:function(e){this.isActiving=!0,!e&&0!==e||e>this.duration||("flex"!==this.mode?this.timeDom.innerHTML=util.format(e):this.centerCurDom.innerHTML=util.format(e))}},{key:"resetActive",value:function(){var e=this,t=this.player,r=function(){e.isActiving=!1};this.off(SEEKED,r),t.isSeeking?this.once(SEEKED,r):this.isActiving=!1}},{key:"destroy",value:function(){var e=this.player.controls.center;this.centerCurDom&&e.removeChild(this.centerCurDom),this.centerCurDom=null,this.centerDurDom&&e.removeChild(this.centerDurDom),this.centerDurDom=null}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-time">\n <span class="time-current">00:00</span>\n <span class="time-separator">/</span>\n <span class="time-duration">00:00</span>\n <span class="time-live-tag">'.concat(this.i18n.LIVE_TIP,"</span>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"time"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.CONTROLS_LEFT,index:2,disable:!1}}}]),r}(Plugin);function volumeLargeSvg(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M940.632 837.632l-72.192-72.192c65.114-64.745 105.412-154.386 105.412-253.44s-40.299-188.695-105.396-253.424l-0.016-0.016 72.192-72.192c83.639 83.197 135.401 198.37 135.401 325.632s-51.762 242.434-135.381 325.612l-0.020 0.020zM795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021z"></path>\n</svg>\n',"image/svg+xml").firstChild}function volumeSmallSvg(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021zM795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021z"></path>\n</svg>\n',"image/svg+xml").firstChild}function volumeMutedSvg(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M920.4 439.808l-108.544-109.056-72.704 72.704 109.568 108.544-109.056 108.544 72.704 72.704 108.032-109.568 108.544 109.056 72.704-72.704-109.568-108.032 109.056-108.544-72.704-72.704-108.032 109.568z"></path>\n</svg>\n',"image/svg+xml").firstChild}var Volume=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return _defineProperty$5(_assertThisInitialized$4(e=t.call.apply(t,[this].concat(i))),"onBarMousedown",(function(t){var r=_assertThisInitialized$4(e).player,n=e.find(".xgplayer-bar");util.event(t);var i=n.getBoundingClientRect(),o=util.getEventPos(t,r.zoom),a=i.height-(o.clientY-i.top);if(o.h=a,o.barH=i.height,e.pos=o,!(a<-2))return e.updateVolumePos(a,t),document.addEventListener("mouseup",e.onBarMouseUp),e._d.isStart=!0,!1})),_defineProperty$5(_assertThisInitialized$4(e),"onBarMouseMove",(function(t){var r=_assertThisInitialized$4(e)._d;if(r.isStart){var n=_assertThisInitialized$4(e),i=n.pos,o=n.player;t.preventDefault(),t.stopPropagation(),util.event(t);var a=util.getEventPos(t,o.zoom);r.isMoving=!0;var s=i.h-a.clientY+i.clientY;s>i.barH||e.updateVolumePos(s,t)}})),_defineProperty$5(_assertThisInitialized$4(e),"onBarMouseUp",(function(t){util.event(t),document.removeEventListener("mouseup",e.onBarMouseUp);var r=_assertThisInitialized$4(e)._d;r.isStart=!1,r.isMoving=!1})),_defineProperty$5(_assertThisInitialized$4(e),"onMouseenter",(function(t){e._d.isActive=!0,e.focus(),e.emit("icon_mouseenter",{pluginName:e.pluginName})})),_defineProperty$5(_assertThisInitialized$4(e),"onMouseleave",(function(t){e._d.isActive=!1,e.unFocus(100,!1,t),e.emit("icon_mouseleave",{pluginName:e.pluginName})})),_defineProperty$5(_assertThisInitialized$4(e),"onVolumeChange",(function(t){if(e.player){var r=e.player,n=r.muted,i=r.volume;e._d.isMoving||(e.find(".xgplayer-drag").style.height=n||0===i?"4px":"".concat(100*i,"%"),e.config.showValueLabel&&e.updateVolumeValue()),e.animate(n,i)}})),e}return _createClass$5(r,[{key:"registerIcons",value:function(){return{volumeSmall:{icon:volumeSmallSvg,class:"xg-volume-small"},volumeLarge:{icon:volumeLargeSvg,class:"xg-volume"},volumeMuted:{icon:volumeMutedSvg,class:"xg-volume-mute"}}}},{key:"afterCreate",value:function(){var e=this;if(this._timerId=null,this._d={isStart:!1,isMoving:!1,isActive:!1},!this.config.disable){this.initIcons();var t=this.playerConfig,r=t.commonStyle,n=t.volume;r.volumeColor&&(this.find(".xgplayer-drag").style.backgroundColor=r.volumeColor),this.changeMutedHandler=this.hook("mutedChange",(function(t){e.changeMuted(t)}),{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this._onMouseenterHandler=this.hook("mouseenter",this.onMouseenter),this._onMouseleaveHandler=this.hook("mouseleave",this.onMouseleave),"mobile"!==sniffer$1.device&&"mobile"!==this.playerConfig.isMobileSimulateMode&&(this.bind("mouseenter",this._onMouseenterHandler),this.bind(["blur","mouseleave"],this._onMouseleaveHandler),this.bind(".xgplayer-slider","mousedown",this.onBarMousedown),this.bind(".xgplayer-slider","mousemove",this.onBarMouseMove),this.bind(".xgplayer-slider","mouseup",this.onBarMouseUp)),this.bind(".xgplayer-icon",["touchend","click"],this.changeMutedHandler),this.on(VOLUME_CHANGE,this.onVolumeChange),this.once(LOADED_DATA,this.onVolumeChange),"Number"!==util.typeOf(n)&&(this.player.volume=this.config.default),this.onVolumeChange()}}},{key:"updateVolumePos",value:function(e,t){var r=this.player,n=this.find(".xgplayer-drag"),i=this.find(".xgplayer-bar");if(i&&n){var o=parseInt(e/i.getBoundingClientRect().height*1e3,10);n.style.height="".concat(e,"px");var a=Math.max(Math.min(o/1e3,1),0),s={volume:{from:r.volume,to:a}};r.muted&&(s.muted={from:!0,to:!1}),this.emitUserAction(t,"change_volume",{muted:r.muted,volume:r.volume,props:s}),r.volume=Math.max(Math.min(o/1e3,1),0),r.muted&&(r.muted=!1),this.config.showValueLabel&&this.updateVolumeValue()}}},{key:"updateVolumeValue",value:function(){var e=this.player,t=e.volume,r=e.muted,n=this.find(".xgplayer-value-label"),i=Math.max(Math.min(t,1),0);n.innerText=r?0:Math.ceil(100*i)}},{key:"focus",value:function(){this.player.focus({autoHide:!1}),this._timerId&&(util.clearTimeout(this,this._timerId),this._timerId=null),util.addClass(this.root,"slide-show")}},{key:"unFocus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,i=this._d,o=this.player;i.isActive||(this._timerId&&(util.clearTimeout(this,this._timerId),this._timerId=null),this._timerId=util.setTimeout(this,(function(){i.isActive||(r?o.blur():o.focus(),util.removeClass(e.root,"slide-show"),i.isStart&&e.onBarMouseUp(n)),e._timerId=null}),t))}},{key:"changeMuted",value:function(e){e&&e.stopPropagation();var t=this.player;this._d.isStart&&this.onBarMouseUp(e),this.emitUserAction(e,"change_muted",{muted:t.muted,volume:t.volume,props:{muted:{from:t.muted,to:!t.muted}}}),t.volume>0&&(t.muted=!t.muted),t.volume<.01&&(t.volume=this.config.miniVolume)}},{key:"animate",value:function(e,t){e||0===t?this.setAttr("data-state","mute"):t<.5&&this.icons.volumeSmall?this.setAttr("data-state","small"):this.setAttr("data-state","normal")}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.volumeSmall),this.appendChild(".xgplayer-icon",e.volumeLarge),this.appendChild(".xgplayer-icon",e.volumeMuted)}},{key:"destroy",value:function(){this._timerId&&(util.clearTimeout(this,this._timerId),this._timerId=null),this.unbind("mouseenter",this.onMouseenter),this.unbind(["blur","mouseleave"],this.onMouseleave),this.unbind(".xgplayer-slider","mousedown",this.onBarMousedown),this.unbind(".xgplayer-slider","mousemove",this.onBarMouseMove),this.unbind(".xgplayer-slider","mouseup",this.onBarMouseUp),document.removeEventListener("mouseup",this.onBarMouseUp),this.unbind(".xgplayer-icon","mobile"===sniffer$1.device?"touchend":"click",this.changeMutedHandler)}},{key:"render",value:function(){if(!this.config.disable){var e=this.config.default||this.player.volume,t=this.config.showValueLabel;return'\n <xg-icon class="xgplayer-volume" data-state="normal">\n <div class="xgplayer-icon">\n </div>\n <xg-slider class="xgplayer-slider">\n '.concat(t?'<div class="xgplayer-value-label">'.concat(100*e,"</div>"):"",'\n <div class="xgplayer-bar">\n <xg-drag class="xgplayer-drag" style="height: ').concat(100*e,'%"></xg-drag>\n </div>\n </xg-slider>\n </xg-icon>')}}}],[{key:"pluginName",get:function(){return"volume"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.CONTROLS_RIGHT,index:1,disable:!1,showValueLabel:!1,default:.6,miniVolume:.2}}}]),r}(Plugin);function RotateSvg(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="-4 -6 40 40" fill="none">\n <g clip-path="url(#clip0)">\n <path transform="scale(1.5 1.5)" d="M11.6665 9.16663H4.1665C2.78579 9.16663 1.6665 10.2859 1.6665 11.6666V15.8333C1.6665 17.214 2.78579 18.3333 4.1665 18.3333H11.6665C13.0472 18.3333 14.1665 17.214 14.1665 15.8333V11.6666C14.1665 10.2859 13.0472 9.16663 11.6665 9.16663Z" fill="white"/>\n <path transform="scale(1.5 1.5)" fill-rule="evenodd" clip-rule="evenodd" d="M3.88148 4.06298C3.75371 4.21005 3.67667 4.40231 3.67749 4.61242C3.67847 4.87253 3.79852 5.10435 3.98581 5.25646L6.99111 8.05895C7.32771 8.37283 7.85502 8.35443 8.16891 8.01782C8.48279 7.68122 8.46437 7.15391 8.12778 6.84003L6.62061 5.43457L9.8198 5.4224C9.82848 5.42239 9.8372 5.42221 9.84591 5.4219C10.9714 5.38233 12.0885 5.6285 13.0931 6.13744C14.0976 6.64635 14.957 7.40148 15.5908 8.33234C16.2246 9.2632 16.6122 10.3394 16.7177 11.4606C16.823 12.5819 16.6427 13.7115 16.1934 14.7442C16.0098 15.1661 16.203 15.6571 16.6251 15.8408C17.0471 16.0243 17.5381 15.8311 17.7216 15.4091C18.2833 14.1183 18.5087 12.7063 18.3771 11.3047C18.2453 9.90318 17.7607 8.55792 16.9684 7.39433C16.1761 6.23073 15.1021 5.28683 13.8463 4.65065C12.5946 4.01651 11.203 3.70872 9.80072 3.75583L6.43415 3.76862L7.96326 2.12885C8.27715 1.79225 8.25872 1.26494 7.92213 0.951061C7.58553 0.63718 7.05822 0.655585 6.74433 0.99219L3.90268 4.0395C3.89545 4.04724 3.88841 4.05509 3.88154 4.06303L3.88148 4.06298Z" fill="white"/>\n </g>\n <defs>\n <clipPath id="clip0">\n <rect width="40" height="40" fill="white"/>\n </clipPath>\n </defs>\n</svg>\n',"image/svg+xml").firstChild}var Rotate=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n;return _classCallCheck$4(this,r),(n=t.call(this,e)).rotateDeg=n.config.rotateDeg||0,n}return _createClass$5(r,[{key:"afterCreate",value:function(){var e=this;this.config.disable||(_get$2(_getPrototypeOf$4(r.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.rotate),this.onBtnClick=this.onBtnClick.bind(this),this.bind(".xgplayer-icon",["click","touchend"],this.onBtnClick),this.on(VIDEO_RESIZE,(function(){e.rotateDeg&&util.setTimeout(e,(function(){e.updateRotateDeg(e.rotateDeg,e.config.innerRotate)}),100)})),this.rotateDeg&&this.updateRotateDeg(this.rotateDeg,this.config.innerRotate))}},{key:"destroy",value:function(){_get$2(_getPrototypeOf$4(r.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon",["click","touchend"],this.onBtnClick)}},{key:"onBtnClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"rotate"),this.rotate(this.config.clockwise,this.config.innerRotate,1)}},{key:"updateRotateDeg",value:function(e,t){var r=this.player;e||(e=0);var n=this.player,i=n.root,o=n.innerContainer,a=this.player.media,s=i.offsetWidth,l=o&&t?o.offsetHeight:i.offsetHeight,c="100%",u="100%",h=0,d=0;.75!==e&&.25!==e||(c="".concat(l,"px"),u="".concat(s,"px"),h=-(l-s)/2,d=-(s-l)/2);var p="translate(".concat(h,"px,").concat(d,"px) rotate(").concat(e,"turn)"),f={transformOrigin:"center center",transform:p,webKitTransform:p,height:u,width:c},g=t?a:i,y=t?r.getPlugin("poster"):null;Object.keys(f).map((function(e){g.style[e]=f[e],y&&y.root&&(y.root.style[e]=f[e])}))}},{key:"rotate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=this.player;this.rotateDeg||(this.rotateDeg=0);var i=e?1:-1;this.rotateDeg=(this.rotateDeg+1+.25*i*r)%1,this.updateRotateDeg(this.rotateDeg,t),n.emit(ROTATE,360*this.rotateDeg)}},{key:"registerIcons",value:function(){return{rotate:RotateSvg}}},{key:"render",value:function(){if(!this.config.disable)return'\n <xg-icon class="xgplayer-rotate">\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="'.concat(this.i18nKeys.ROTATE_TIPS,'">\n ').concat(this.i18n.ROTATE_TIPS,"\n </div>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"rotate"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.CONTROLS_RIGHT,index:6,innerRotate:!0,clockwise:!1,rotateDeg:0,disable:!1}}}]),r}(Fullscreen$1);function PipIcon(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M16.5 4.3H3.5C3.38954 4.3 3.3 4.38954 3.3 4.5V15.5C3.3 15.6105 3.38954 15.7 3.5 15.7H8.50005L8.50006 17.5H3.5C2.39543 17.5 1.5 16.6046 1.5 15.5V4.5C1.5 3.39543 2.39543 2.5 3.5 2.5H16.5C17.6046 2.5 18.5 3.39543 18.5 4.5V8.5H16.7V4.5C16.7 4.38954 16.6105 4.3 16.5 4.3ZM12 11.5C11.4477 11.5 11 11.9477 11 12.5L11 16.5C11 17.0523 11.4478 17.5 12 17.5H17.5C18.0523 17.5 18.5 17.0523 18.5 16.5L18.5 12.5C18.5 11.9477 18.0523 11.5 17.5 11.5H12Z"\n fill="white" />\n</svg>',"image/svg+xml").firstChild}function PipIconExit(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M16.5 4.3H3.5C3.38954 4.3 3.3 4.38954 3.3 4.5V15.5C3.3 15.6105 3.38954 15.7 3.5 15.7H8.50005L8.50006 17.5H3.5C2.39543 17.5 1.5 16.6046 1.5 15.5V4.5C1.5 3.39543 2.39543 2.5 3.5 2.5H16.5C17.6046 2.5 18.5 3.39543 18.5 4.5V8.5H16.7V4.5C16.7 4.38954 16.6105 4.3 16.5 4.3ZM12 11.5C11.4477 11.5 11 11.9477 11 12.5L11 16.5C11 17.0523 11.4478 17.5 12 17.5H17.5C18.0523 17.5 18.5 17.0523 18.5 16.5L18.5 12.5C18.5 11.9477 18.0523 11.5 17.5 11.5H12Z"\n fill="white" />\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M9.4998 7.7C9.77595 7.7 9.9998 7.47614 9.9998 7.2V6.5C9.9998 6.22386 9.77595 6 9.4998 6H5.5402L5.52754 6.00016H5.5C5.22386 6.00016 5 6.22401 5 6.50016V10.4598C5 10.7359 5.22386 10.9598 5.5 10.9598H6.2C6.47614 10.9598 6.7 10.7359 6.7 10.4598V8.83005L8.76983 10.9386C8.96327 11.1357 9.27984 11.1386 9.47691 10.9451L9.97645 10.4548C10.1735 10.2613 10.1764 9.94476 9.983 9.7477L7.97289 7.7H9.4998Z"\n fill="white" />\n</svg>',"image/svg+xml").firstChild}var PresentationMode={PIP:"picture-in-picture",INLINE:"inline",FULLSCREEN:"fullscreen"},PIP=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return _defineProperty$5(_assertThisInitialized$4(e=t.call.apply(t,[this].concat(i))),"switchPIP",(function(t){if(!e.isPIPAvailable())return!1;t.stopPropagation(),e.isPip?(e.exitPIP(),e.emitUserAction(t,"change_pip",{props:"pip",from:!0,to:!1}),e.setAttr("data-state","normal")):4===e.player.media.readyState&&(e.requestPIP(),e.emitUserAction(t,"change_pip",{props:"pip",from:!1,to:!0}),e.setAttr("data-state","pip"))})),e}return _createClass$5(r,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.pip&&(e.config.showIcon=e.player.config.pip)}},{key:"afterCreate",value:function(){var e=this;this.isPIPAvailable()&&(_get$2(_getPrototypeOf$4(r.prototype),"afterCreate",this).call(this),this.pMode=PresentationMode.INLINE,this.initPipEvents(),this.config.showIcon&&this.initIcons(),this.once(COMPLETE,(function(){e.config.showIcon&&(util.removeClass(e.find(".xgplayer-icon"),"xg-icon-disable"),e.bind("click",e.switchPIP))})))}},{key:"registerIcons",value:function(){return{pipIcon:{icon:PipIcon,class:"xg-get-pip"},pipIconExit:{icon:PipIconExit,class:"xg-exit-pip"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.pipIcon),this.appendChild(".xgplayer-icon",e.pipIconExit)}},{key:"initPipEvents",value:function(){var e=this,t=this.player;this.leavePIPCallback=function(){var r=t.paused;util.setTimeout(e,(function(){!r&&t.mediaPlay()}),0),!r&&t.mediaPlay(),e.setAttr("data-state","normal"),t.emit(PIP_CHANGE,!1)},this.enterPIPCallback=function(r){t.emit(PIP_CHANGE,!0),e.pipWindow=r.pictureInPictureWindow,e.setAttr("data-state","pip")},this.onWebkitpresentationmodechanged=function(r){var n=t.media.webkitPresentationMode;e.pMode===PresentationMode.FULLSCREEN&&n!==PresentationMode.FULLSCREEN&&t.onFullscreenChange(null,!1),e.pMode=n,n===PresentationMode.PIP?e.enterPIPCallback(r):n===PresentationMode.INLINE&&e.leavePIPCallback(r)},t.media&&(t.media.addEventListener("enterpictureinpicture",this.enterPIPCallback),t.media.addEventListener("leavepictureinpicture",this.leavePIPCallback),r.checkWebkitSetPresentationMode(t.media)&&t.media.addEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged))}},{key:"requestPIP",value:function(){var e=this.player,t=this.playerConfig;if(this.isPIPAvailable()&&!this.isPip)try{var n=t.poster;return n&&(e.media.poster="String"===util.typeOf(n)?n:n.poster),r.checkWebkitSetPresentationMode(e.media)?e.media.webkitSetPresentationMode("picture-in-picture"):e.media.requestPictureInPicture(),!0}catch(i){return console.error("requestPiP",i),!1}}},{key:"exitPIP",value:function(){var e=this.player;try{return this.isPIPAvailable()&&this.isPip&&(r.checkWebkitSetPresentationMode(e.media)?e.media.webkitSetPresentationMode("inline"):document.exitPictureInPicture()),!0}catch(t){return console.error("exitPIP",t),!1}}},{key:"isPip",get:function(){var e=this.player;return document.pictureInPictureElement&&document.pictureInPictureElement===e.media||e.media.webkitPresentationMode===PresentationMode.PIP}},{key:"isPIPAvailable",value:function(){var e=this.player.media;return("Boolean"!==util.typeOf(document.pictureInPictureEnabled)||document.pictureInPictureEnabled)&&("Boolean"===util.typeOf(e.disablePictureInPicture)&&!e.disablePictureInPicture||e.webkitSupportsPresentationMode&&"Function"===util.typeOf(e.webkitSetPresentationMode))}},{key:"destroy",value:function(){_get$2(_getPrototypeOf$4(r.prototype),"destroy",this).call(this);var e=this.player;e.media.removeEventListener("enterpictureinpicture",this.enterPIPCallback),e.media.removeEventListener("leavepictureinpicture",this.leavePIPCallback),r.checkWebkitSetPresentationMode(e.media)&&e.media.removeEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged),this.exitPIP(),this.unbind("click",this.btnClick)}},{key:"render",value:function(){if(this.config.showIcon&&this.isPIPAvailable())return'<xg-icon class="xgplayer-pip">\n <div class="xgplayer-icon xg-icon-disable">\n </div>\n <div class="xg-tips" lang-key="'.concat(this.i18nKeys.PIP,'">').concat(this.i18n.PIP,"</div>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"pip"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.CONTROLS_RIGHT,index:6,showIcon:!1}}},{key:"checkWebkitSetPresentationMode",value:function(e){return"function"==typeof e.webkitSetPresentationMode}}]),r}(Fullscreen$1);function Next(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="40" viewBox="10 0 24 40">\n <path transform="scale(0.038 0.028)" d="M800 380v768h-128v-352l-320 320v-704l320 320v-352z"></path>\n</svg>\n',"image/svg+xml").firstChild}var PlayNextIcon=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n;return _classCallCheck$4(this,r),_defineProperty$5(_assertThisInitialized$4(n=t.call(this,e)),"playNext",(function(e){var t=_assertThisInitialized$4(n).player;e.preventDefault(),e.stopPropagation(),n.idx+1<n.config.urlList.length?(n.idx++,n.nextHandler(n.config.urlList[n.idx],n.idx),t.emit(PLAYNEXT,n.idx+1)):(n.nextHandler(),t.emit(PLAYNEXT))})),n.idx=-1,n}return _createClass$5(r,[{key:"afterCreate",value:function(){this.config.urlList&&0!==this.config.urlList.length&&(this.appendChild(".xgplayer-icon",this.icons.playNext),this.initEvents())}},{key:"registerIcons",value:function(){return{playNext:Next}}},{key:"initEvents",value:function(){this.nextHandler=this.hook("nextClick",this.changeSrc);var e="mobile"===sniffer$1.device?"touchend":"click";this.bind(e,this.playNext),this.show()}},{key:"changeSrc",value:function(e){var t=this.player;e&&(t.pause(),t.currentTime=0,t.switchURL?t.switchURL(e):t.src=e,t.config.url=e,t.play())}},{key:"destroy",value:function(){this.unbind(["touchend","click"],this.playNext)}},{key:"render",value:function(){if(this.config.urlList&&0!==this.config.urlList.length)return'\n <xg-icon class="xgplayer-playnext">\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="PLAYNEXT_TIPS">'.concat(this.i18n.PLAYNEXT_TIPS,"</div>\n </xg-icon>\n ")}}],[{key:"pluginName",get:function(){return"playNext"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.CONTROLS_LEFT,index:1,url:null,urlList:[]}}}]),r}(Plugin),download={exports:{}},module2;module2=download,module2.exports=function e(t,r,n){var i,o,a=window,s="application/octet-stream",l=n||s,c=t,u=!r&&!n&&c,h=document.createElement("a"),d=function(e){return String(e)},p=a.Blob||a.MozBlob||a.WebKitBlob||d,f=r||"download";if(p=p.call?p.bind(a):Blob,"true"===String(this)&&(l=(c=[c,l])[0],c=c[1]),u&&u.length<2048&&(f=u.split("/").pop().split("?")[0],h.href=u,-1!==h.href.indexOf(u))){var g=new XMLHttpRequest;return g.open("GET",u,!0),g.responseType="blob",g.onload=function(t){e(t.target.response,f,s)},setTimeout((function(){g.send()}),0),g}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(c)){if(!(c.length>2096103.424&&p!==d))return navigator.msSaveBlob?navigator.msSaveBlob(_(c),f):b(c);l=(c=_(c)).type||s}else if(/([\x80-\xff])/.test(c)){for(var y=0,v=new Uint8Array(c.length),m=v.length;y<m;++y)v[y]=c.charCodeAt(y);c=new p([v],{type:l})}function _(e){for(var t=e.split(/[:;,]/),r=t[1],n=("base64"==t[2]?atob:decodeURIComponent)(t.pop()),i=n.length,o=0,a=new Uint8Array(i);o<i;++o)a[o]=n.charCodeAt(o);return new p([a],{type:r})}function b(e,t){if("download"in h)return h.href=e,h.setAttribute("download",f),h.className="download-js-link",h.innerHTML="downloading...",h.style.display="none",document.body.appendChild(h),setTimeout((function(){h.click(),document.body.removeChild(h),!0===t&&setTimeout((function(){a.URL.revokeObjectURL(h.href)}),250)}),66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(e)&&(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,s)),window.open(e)||confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")&&(location.href=e),!0;var r=document.createElement("iframe");document.body.appendChild(r),!t&&/^data:/.test(e)&&(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,s)),r.src=e,setTimeout((function(){document.body.removeChild(r)}),333)}if(i=c instanceof p?c:new p([c],{type:l}),navigator.msSaveBlob)return navigator.msSaveBlob(i,f);if(a.URL)b(a.URL.createObjectURL(i),!0);else{if("string"==typeof i||i.constructor===d)try{return b("data:"+l+";base64,"+a.btoa(i))}catch(T){return b("data:"+l+","+encodeURIComponent(i))}(o=new FileReader).onload=function(e){b(this.result)},o.readAsDataURL(i)}return!0};var downloadUtil=download.exports;function DownloadSvg(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24">\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g transform="translate(-488.000000, -340.000000)" fill="#FFFFFF">\n <g id="Group-2">\n <g id="volme_big-copy" transform="translate(488.000000, 340.000000)">\n <rect id="Rectangle-18" x="11" y="4" width="2" height="12" rx="1"></rect>\n <rect id="Rectangle-2" x="3" y="18" width="18" height="2" rx="1"></rect>\n <rect id="Rectangle-2" transform="translate(4.000000, 17.500000) rotate(90.000000) translate(-4.000000, -17.500000) " x="1.5" y="16.5" width="5" height="2" rx="1"></rect><rect id="Rectangle-2-Copy-3" transform="translate(20.000000, 17.500000) rotate(90.000000) translate(-20.000000, -17.500000) " x="17.5" y="16.5" width="5" height="2" rx="1"></rect>\n <path d="M9.48791171,8.26502656 L9.48791171,14.2650266 C9.48791171,14.8173113 9.04019646,15.2650266 8.48791171,15.2650266 C7.93562696,15.2650266 7.48791171,14.8173113 7.48791171,14.2650266 L7.48791171,7.26502656 C7.48791171,6.71274181 7.93562696,6.26502656 8.48791171,6.26502656 L15.4879117,6.26502656 C16.0401965,6.26502656 16.4879117,6.71274181 16.4879117,7.26502656 C16.4879117,7.81731131 16.0401965,8.26502656 15.4879117,8.26502656 L9.48791171,8.26502656 Z" id="Combined-Shape" transform="translate(11.987912, 10.765027) scale(1, -1) rotate(45.000000) translate(-11.987912, -10.765027) "></path>\n </g>\n </g>\n </g>\n </g>\n</svg>\n',"image/svg+xml").firstChild}var Download=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n;return _classCallCheck$4(this,r),_defineProperty$5(_assertThisInitialized$4(n=t.call(this,e)),"download",(function(e){if(!n.isLock){n.emitUserAction(e,"download");var t=n.getAbsoluteURL(n.player.src);downloadUtil(t),n.isLock=!0,n.timer=window.setTimeout((function(){n.isLock=!1,window.clearTimeout(n.timer),n.timer=null}),300)}})),n.timer=null,n.isLock=!1,n}return _createClass$5(r,[{key:"afterCreate",value:function(){_get$2(_getPrototypeOf$4(r.prototype),"afterCreate",this).call(this),this.config.disable||(this.appendChild(".xgplayer-icon",this.icons.download),this.bind(["click","touchend"],this.download))}},{key:"registerIcons",value:function(){return{download:DownloadSvg}}},{key:"getAbsoluteURL",value:function(e){if(!e.match(/^https?:\/\//)){var t=document.createElement("div");t.innerHTML='<a href="'.concat(e,'">x</a>'),e=t.firstChild.href}return e}},{key:"destroy",value:function(){_get$2(_getPrototypeOf$4(r.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.download),window.clearTimeout(this.timer),this.timer=null}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-download">\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="'.concat(this.i18nKeys.DOWNLOAD_TIPS,'">').concat(this.i18n.DOWNLOAD_TIPS,"</div>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"download"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.CONTROLS_RIGHT,index:3,disable:!0}}}]),r}(Fullscreen$1),ScreenShot=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){return _classCallCheck$4(this,r),t.apply(this,arguments)}return _createClass$5(r,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.screenShot&&(e.config.disable=!e.player.config.screenShot)}},{key:"afterCreate",value:function(){_get$2(_getPrototypeOf$4(r.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.screenshotIcon);var e=this.config;this.initSize=function(t){e.fitVideo&&(e.width=t.vWidth,e.height=t.vHeight)},this.once(VIDEO_RESIZE,this.initSize)}},{key:"onPluginsReady",value:function(){this.show(),this.onClickBtn=this.onClickBtn.bind(this),this.bind(["click","touchend"],this.onClickBtn)}},{key:"saveScreenShot",value:function(e,t){var r=document.createElement("a");r.href=e,r.download=t;var n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),r.dispatchEvent(n)}},{key:"createCanvans",value:function(e,t){var r=document.createElement("canvas");this.canvasCtx=r.getContext("2d"),this.canvas=r,r.width=e||this.config.width,r.height=t||this.config.height}},{key:"onClickBtn",value:function(e){var t=this;e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"shot"),this.shot().then((function(e){t.emit(SCREEN_SHOT,e),t.saveScreenShot(e,t.config.name+t.config.format)}))}},{key:"shot",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{quality:.92,type:"image/png"},i=this.config,o=this.player,a=n.quality||i.quality,s=n.type||i.type;return new Promise((function(n,l){var c=null;o.media.canvas?c=o.media.canvas:(r.canvas?(r.canvas.width=e||i.width,r.canvas.height=t||i.height):r.createCanvans(e,t),r.canvasCtx.drawImage(o.media,0,0,e||i.width,t||i.height),c=r.canvas);var u=c.toDataURL(s,a).replace(s,"image/octet-stream");n(u=u.replace(/^data:image\/[^;]+/,"data:application/octet-stream"))}))}},{key:"registerIcons",value:function(){return{screenshotIcon:null}}},{key:"destroy",value:function(){_get$2(_getPrototypeOf$4(r.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.onClickBtn),this.off(VIDEO_RESIZE,this.initSize)}},{key:"render",value:function(){if(!this.config.disable){var e=this.icons.screenshotIcon?"xgplayer-icon":"xgplayer-icon btn-text",t="SCREENSHOT";return'\n <xg-icon class="xgplayer-shot">\n <div class="'.concat(e,'">\n ').concat(this.icons.screenshotIcon?"":'<span lang-key="'.concat(this.i18nKeys[t],'">').concat(this.i18n[t],"</span>")," \n </div>\n </xg-icon>")}}}],[{key:"pluginName",get:function(){return"screenShot"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.CONTROLS_RIGHT,index:5,quality:.92,type:"image/png",format:".png",width:600,height:337,fitVideo:!0,disable:!1,name:"screenshot"}}}]),r}(Fullscreen$1),OptionList=function(){function e(t){_classCallCheck$4(this,e),this.config=t.config,this.parent=t.root,this.root=util.createDom("ul","",{},"xg-options-list ".concat(this.config.className)),t.root.appendChild(this.root),this.onItemClick=this.onItemClick.bind(this),this.renderItemList();var r="mobile"===sniffer$1.device?"touchend":"click";this._delegates=Plugin.delegate.call(this,this.root,"li",r,this.onItemClick)}return _createClass$5(e,[{key:"renderItemList",value:function(e){var t=this,r=this.config,n=this.root;e?r.data=e:e=r.data,r.style&&Object.keys(r.style).map((function(e){n.style[e]=r[e]})),e.length>0&&(this.attrKeys=Object.keys(e[0])),this.root.innerHTML="",e.map((function(e,r){var n=e.selected?"option-item selected":"option-item";e["data-index"]=r,t.root.appendChild(util.createDom("li","<span>".concat(e.showText,"</span>"),e,n))}))}},{key:"onItemClick",value:function(e){e.delegateTarget||(e.delegateTarget=e.target);var t=e.delegateTarget;if(t&&util.hasClass(t,"selected"))return!1;var r="function"==typeof this.config.onItemClick?this.config.onItemClick:null,n=this.root.querySelector(".selected");util.addClass(t,"selected"),n&&util.removeClass(n,"selected"),r(e,{from:n?this.getAttrObj(n,this.attrKeys):null,to:this.getAttrObj(t,this.attrKeys)})}},{key:"getAttrObj",value:function(e,t){if(!e||!t)return{};var r={};t.map((function(t){r[t]=e.getAttribute(t)}));var n=e.getAttribute("data-index");return n&&(r.index=Number(n)),r}},{key:"show",value:function(){util.removeClass(this.root,"hide"),util.addClass(this.root,"active")}},{key:"hide",value:function(){util.removeClass(this.root,"active"),util.addClass(this.root,"hide")}},{key:"destroy",value:function(){this._delegates&&(this._delegates.map((function(e){e.destroy&&e.destroy()})),this._delegates=null),this.root.innerHTML=null,this.parent.removeChild(this.root),this.root=null}}]),e}(),IS_MOBILE$2="mobile"===sniffer$1.device,OptionsIcon=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n;return _classCallCheck$4(this,r),_defineProperty$5(_assertThisInitialized$4(n=t.call(this,e)),"onEnter",(function(e){e.preventDefault(),e.stopPropagation(),n.emit("icon_mouseenter",{pluginName:n.pluginName}),n.onToggle(!0)})),_defineProperty$5(_assertThisInitialized$4(n),"onLeave",(function(e){e.preventDefault(),e.stopPropagation(),n.emit("icon_mouseleave",{pluginName:n.pluginName}),n.isActive&&n.onToggle(!1)})),n.isIcons=!1,n.isActive=!1,n.curValue=null,n.curIndex=0,n}return _createClass$5(r,[{key:"updateLang",value:function(e){this.renderItemList(this.config.list,this.curIndex)}},{key:"afterCreate",value:function(){var e=this,t=this.config;this.initIcons(),IS_MOBILE$2&&"middle"!==t.listType&&(t.listType="rightSide"),t.hidePortrait&&util.addClass(this.root,"portrait"),this.once(CANPLAY,(function(){t.list&&t.list.length>0&&(e.renderItemList(t.list),e.show())})),IS_MOBILE$2&&this.on(PLAYER_FOCUS,(function(){e.isActive&&(e.optionsList&&e.optionsList.hide(),e.isActive=!1)})),this.activeEvent=IS_MOBILE$2?"touchend":"mouseenter",this.bind(this.activeEvent,this.onEnter),this.bind("mouseleave",this.onLeave),this.isIcons&&this.bind("click",this.onIconClick)}},{key:"initIcons",value:function(){var e=this,t=this.icons,r=Object.keys(t),n=!1;r.length>0&&(r.forEach((function(r){e.appendChild(".xgplayer-icon",t[r]),!n&&(n=t[r])})),this.isIcons=n),n||(this.appendChild(".xgplayer-icon",util.createDom("span","",{},"icon-text")),util.addClass(this.find(".xgplayer-icon"),"btn-text"))}},{key:"show",value:function(){!this.config.list||this.config.list.length<2||util.addClass(this.root,"show")}},{key:"hide",value:function(){util.removeClass(this.root,"show")}},{key:"getTextByLang",value:function(e,t,r){if(void 0===e)return"";var n=this.config.list;!r&&(r=this.player.lang),t=!t||util.isUndefined(e[t])?"text":t,"number"==typeof e&&(e=n[e]);try{return"object"===_typeof$3(e[t])?e[t][r]||e[t].zh:e[t]}catch(i){return console.warn(i),""}}},{key:"onToggle",value:function(e){if(e!==this.isActive){var t=this.player.controls,r=this.config.listType;e?("rightSide"===r?t.blur():t.focus(),this.optionsList&&this.optionsList.show()):("rightSide"===r?t.focus():t.focusAwhile(),this.optionsList&&this.optionsList.hide()),this.isActive=e}}},{key:"onItemClick",value:function(e,t){e.preventDefault(),e.stopPropagation();var r=this.config,n=r.listType,i=r.list;(IS_MOBILE$2||"rightSide"===n)&&this.onToggle(!1),this.curIndex=t.to.index,this.curItem=i[this.curIndex],this.changeCurrentText(),this.onToggle(!1)}},{key:"onIconClick",value:function(e){}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,t=e[this.curIndex<e.length?this.curIndex:0];t&&(this.find(".icon-text").innerHTML=this.getTextByLang(t,"iconText"))}}},{key:"renderItemList",value:function(e,t){var r=this,n=this.config,i=this.optionsList,o=this.player;if("number"==typeof t&&(this.curIndex=t,this.curItem=n.list[t]),i)return i.renderItemList(e),void this.changeCurrentText();var a={config:{data:e||[],className:"rightSide"===n.listType?"right-side":"",onItemClick:function(e,t){r.onItemClick(e,t)}},root:"rightSide"===n.listType?o.root:this.root};this.config.isShowIcon&&(this.optionsList=new OptionList(a),this.changeCurrentText(),this.show())}},{key:"destroy",value:function(){this.unbind(this.activeEvent,this.onToggle),this.unbind("mouseleave",this.onToggle),this.optionsList&&(this.optionsList.destroy(),this.optionsList=null)}},{key:"render",value:function(){if(this.config.isShowIcon)return'<xg-icon class="xg-options-icon '.concat(this.config.className||"",'">\n <div class="xgplayer-icon">\n </div>\n </xg-icon>')}}],[{key:"pluginName",get:function(){return"optionsIcon"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.CONTROLS_RIGHT,index:100,list:[],listType:"middle",listStyle:{},hidePortrait:!0,isShowIcon:!1}}}]),r}(Plugin),DefinitionIcon=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n;return _classCallCheck$4(this,r),(n=t.call(this,e)).curTime=0,n.isPaused=!0,n}return _createClass$5(r,[{key:"beforeCreate",value:function(e){var t=e.config.list;Array.isArray(t)&&t.length>0&&(e.config.list=t.map((function(e){return!e.text&&e.name&&(e.text=e.name),e.text||(e.text=e.definition),e})))}},{key:"afterCreate",value:function(){var e=this;_get$2(_getPrototypeOf$4(r.prototype),"afterCreate",this).call(this),this.on("resourceReady",(function(t){e.changeDefinitionList(t)})),this.on(DEFINITION_CHANGE,(function(t){e.renderItemList(e.config.list,t.to)})),this.player.definitionList.length<2&&this.hide()}},{key:"show",value:function(){!this.config.list||this.config.list.length<2||util.addClass(this.root,"show")}},{key:"initDefinition",value:function(){var e=this.config,t=e.list,r=e.defaultDefinition;if(t.length>0){var n=null;t.map((function(e){e.definition===r&&(n=e)})),n||(n=t[0]),this.changeDefinition(n)}}},{key:"renderItemList",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.list||[],n=arguments.length>1?arguments[1]:void 0,i=n&&n.definition?n.definition:this.config.defaultDefinition;n&&t.forEach((function(e){e.selected=!1}));var o=0,a=t.map((function(t,r){var n=_objectSpread2$4(_objectSpread2$4({},t),{},{showText:e.getTextByLang(t)||t.definition,selected:!1});return(t.selected||t.definition&&t.definition==i)&&(n.selected=!0,o=r),n}));_get$2(_getPrototypeOf$4(r.prototype),"renderItemList",this).call(this,a,o)}},{key:"changeDefinitionList",value:function(e){Array.isArray(e)&&(this.config.list=e.map((function(e){return!e.text&&e.name&&(e.text=e.name),e.text||(e.text=e.definition),e})),this.renderItemList(),this.config.list.length<2?this.hide():this.show())}},{key:"changeDefinition",value:function(e,t){this.player.changeDefinition(e,t)}},{key:"onItemClick",value:function(e,t){var n=this.player.definitionList;_get$2(_getPrototypeOf$4(r.prototype),"onItemClick",this).apply(this,arguments),this.emitUserAction(e,"change_definition",{from:t.from,to:t.to});for(var i=0;i<n.length;i++)t.to&&n[i].definition===t.to.definition&&(t.to.url=n[i].url),t.from&&n[i].definition===t.from.definition&&(t.from.url=n[i].url);this.player.changeDefinition(t.to,t.from)}}],[{key:"pluginName",get:function(){return"definition"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.CONTROLS_RIGHT,index:3,list:[],defaultDefinition:"",disable:!1,hidePortrait:!1,className:"xgplayer-definition",isShowIcon:!0}}}]),r}(OptionsIcon),PlaybackRate=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n;return _classCallCheck$4(this,r),(n=t.call(this,e)).curRate=1,n}return _createClass$5(r,[{key:"beforeCreate",value:function(e){var t=e.player.config.playbackRate,r=t?Array.isArray(t)?t:e.config.list:[];Array.isArray(r)&&(e.config.list=r.map((function(e){return"number"==typeof e?e={rate:e,text:"".concat(e,"x")}:!e.text&&e.rate&&(e.text="".concat(e.rate,"x")),e})))}},{key:"afterCreate",value:function(){var e=this;_get$2(_getPrototypeOf$4(r.prototype),"afterCreate",this).call(this),this.on(RATE_CHANGE,(function(){e.curValue!==e.player.playbackRate&&e.renderItemList()})),this.renderItemList()}},{key:"show",value:function(){this.config.list&&0!==this.config.list.length&&_get$2(_getPrototypeOf$4(r.prototype),"show",this).call(this)}},{key:"onItemClick",value:function(e,t){_get$2(_getPrototypeOf$4(r.prototype),"onItemClick",this).apply(this,arguments);var n=e.delegateTarget,i=Number(n.getAttribute("rate"));if(!i||i===this.curValue)return!1;var o={playbackRate:{from:this.player.playbackRate,to:i}};this.emitUserAction(e,"change_rate",{props:o}),this.curValue=i,this.player.playbackRate=i}},{key:"renderItemList",value:function(){var e=this,t=this.player.playbackRate||1;this.curValue=t;var n=-1,i=this.config.list.map((function(r,i){var o={rate:r.rate};return o.rate===t&&(o.selected=!0,n=i),o.showText=e.getTextByLang(r),o}));_get$2(_getPrototypeOf$4(r.prototype),"renderItemList",this).call(this,i,n)}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,t=e[this.curIndex<e.length?this.curIndex:0],r="";r=!t||this.curIndex<0?"".concat(this.player.playbackRate,"x"):this.getTextByLang(t,"iconText"),this.find(".icon-text").innerHTML=r}}},{key:"destroy",value:function(){_get$2(_getPrototypeOf$4(r.prototype),"destroy",this).call(this)}}],[{key:"pluginName",get:function(){return"playbackRate"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.CONTROLS_RIGHT,index:4,list:[2,1.5,1,.75,.5],className:"xgplayer-playbackrate",isShowIcon:!0,hidePortrait:!1}}}]),r}(OptionsIcon);function CssFullSceenSvg(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">\n <path fill="#fff" transform="scale(1.3, 1.3)" class=\'path_full\' d="M9,10v1a.9.9,0,0,1-1,1,.9.9,0,0,1-1-1V9A.9.9,0,0,1,8,8h2a.9.9,0,0,1,1,1,.9.9,0,0,1-1,1Zm6,4V13a1,1,0,0,1,2,0v2a.9.9,0,0,1-1,1H14a1,1,0,0,1,0-2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>\n</svg>\n',"image/svg+xml").firstChild}function ExitCssFullSceenSvg(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">\n <path fill="#fff" transform="scale(1.3, 1.3)" d="M9,10V9a.9.9,0,0,1,1-1,.9.9,0,0,1,1,1v2a.9.9,0,0,1-1,1H8a.9.9,0,0,1-1-1,.9.9,0,0,1,1-1Zm6,4v1a1,1,0,0,1-2,0V13a.9.9,0,0,1,1-1h2a1,1,0,0,1,0,2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>\n</svg>\n',"image/svg+xml").firstChild}var CssFullScreen=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){return _classCallCheck$4(this,r),t.apply(this,arguments)}return _createClass$5(r,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.cssFullscreen&&(e.config.disable=!e.player.config.cssFullscreen)}},{key:"afterCreate",value:function(){var e=this;_get$2(_getPrototypeOf$4(r.prototype),"afterCreate",this).call(this),this.config.disable||(this.config.target&&(this.playerConfig.fullscreenTarget=this.config.target),this.initIcons(),this.on(CSS_FULLSCREEN_CHANGE,(function(t){e.animate(t)})),this.btnClick=this.btnClick.bind(this),this.handleCssFullscreen=this.hook("cssFullscreen_change",this.btnClick,{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.bind(["click","touchend"],this.handleCssFullscreen))}},{key:"initIcons",value:function(){var e=this.icons,t=this.find(".xgplayer-icon");t.appendChild(e.cssFullscreen),t.appendChild(e.exitCssFullscreen)}},{key:"btnClick",value:function(e){e.preventDefault(),e.stopPropagation();var t=this.player.isCssfullScreen;this.emitUserAction(e,"switch_cssfullscreen",{cssfullscreen:t}),t?this.player.exitCssFullscreen():this.player.getCssFullscreen()}},{key:"animate",value:function(e){this.root&&(e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.switchTips(e))}},{key:"switchTips",value:function(e){var t=this.i18nKeys,r=this.find(".xg-tips");r&&this.changeLangTextKey(r,e?t.EXITCSSFULLSCREEN_TIPS:t.CSSFULLSCREEN_TIPS)}},{key:"registerIcons",value:function(){return{cssFullscreen:{icon:CssFullSceenSvg,class:"xg-get-cssfull"},exitCssFullscreen:{icon:ExitCssFullSceenSvg,class:"xg-exit-cssfull"}}}},{key:"destroy",value:function(){_get$2(_getPrototypeOf$4(r.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class=\'xgplayer-cssfullscreen\'>\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="'.concat(this.i18nKeys.CSSFULLSCREEN_TIPS,'">').concat(this.i18n.CSSFULLSCREEN_TIPS,"</div>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"cssFullscreen"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$a.CONTROLS_RIGHT,index:1,disable:!1,target:null}}}]),r}(Fullscreen$1),ErrorPlugin$1=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){return _classCallCheck$4(this,r),t.apply(this,arguments)}return _createClass$5(r,[{key:"afterCreate",value:function(){var e=this;this.clickHandler=this.hook("errorRetry",this.errorRetry,{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.onError=this.hook("showError",this.handleError),this.bind(".xgplayer-error-refresh","click",this.clickHandler),this.on(ERROR$3,(function(t){e.onError(t)}))}},{key:"errorRetry",value:function(e){this.emitUserAction(e,"error_retry",{}),this.player.retry()}},{key:"handleError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.player,r=e.errorType,n=t.errorNote?this.i18n[t.errorNote]:"";if(!n)switch(r){case"decoder":n=this.i18n.MEDIA_ERR_DECODE;break;case"network":n=this.i18n.MEDIA_ERR_NETWORK;break;default:n=this.i18n.MEDIA_ERR_SRC_NOT_SUPPORTED}this.find(".xgplayer-error-text").innerHTML=n,this.find(".xgplayer-error-tips").innerHTML="".concat(this.i18n.REFRESH_TIPS,'<span class="xgplayer-error-refresh">').concat(this.i18n.REFRESH,"</span>")}},{key:"destroy",value:function(){this.unbind(".xgplayer-error-refresh","click",this.clickHandler)}},{key:"render",value:function(){return'<xg-error class="xgplayer-error">\n <div class="xgplayer-errornote">\n <span class="xgplayer-error-text"></span>\n <span class="xgplayer-error-tips"><em class="xgplayer-error-refresh"></em></span>\n </div>\n </xg-error>'}}],[{key:"pluginName",get:function(){return"error"}}]),r}(Plugin),Prompt=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){return _classCallCheck$4(this,r),t.apply(this,arguments)}return _createClass$5(r,[{key:"afterCreate",value:function(){var e=this;this.intervalId=0,this.customConfig=null,this.bind(".highlight",["click","touchend"],(function(t){(e.config.onClick||e.customOnClick)&&(t.preventDefault(),t.stopPropagation(),e.customOnClick?e.customOnClick(t):e.config.onClick(t))})),this.player.showPrompt=function(){e.show.apply(e,arguments)},this.player.hidePrompt=function(){e.hide()}}},{key:"setStyle",value:function(e){var t=this;Object.keys(e).map((function(r){t.root.style[r]=e[r]}))}},{key:"show",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(e){this.customOnClick=n;var i=this.config.interval;this.intervalId&&(clearTimeout(this.intervalId),this.intervalId=null),util.addClass(this.root,"show"),"arrow"===r.mode&&util.addClass(this.root,"arrow"),this.find(".xgplayer-prompt-detail").innerHTML="string"==typeof e?e:"".concat(e.text||"")+"".concat(e.highlight?'<i class="highlight">'.concat(e.highlight,"</i>"):""),r.style&&this.setStyle(r.style);var o="boolean"==typeof r.autoHide?r.autoHide:this.config.autoHide;if(o){var a=r.interval||i;this.intervalId=setTimeout((function(){t.hide()}),a)}}}},{key:"hide",value:function(){util.removeClass(this.root,"show"),util.removeClass(this.root,"arrow"),this.root.removeAttribute("style"),this.customOnClick=null}},{key:"render",value:function(){return'<xg-prompt class="xgplayer-prompt '.concat(STATE_CLASS.CONTROLS_FOLLOW,'">\n <span class="xgplayer-prompt-detail"></span>\n </xg-prompt>')}}],[{key:"pluginName",get:function(){return"prompt"}},{key:"defaultConfig",get:function(){return{interval:3e3,style:{},mode:"arrow",autoHide:!0,detail:{text:"",highlight:""},onClick:function(){}}}}]),r}(Plugin),ISPOT={time:0,text:"",id:1,duration:1,color:"#fff",style:{},width:6,height:6};function mergeISPOT(e){Object.keys(ISPOT).map((function(t){void 0===e[t]&&(e[t]=ISPOT[t])}))}var APIS={_updateDotDom:function(e,t){if(t){var r=this.calcuPosition(e.time,e.duration),n=e.style||{};n.left="".concat(r.left,"%"),n.width="".concat(r.width,"%"),t.setAttribute("data-text",e.text),t.setAttribute("data-time",e.time),r.isMini?util.addClass(t,"mini"):util.removeClass(t,"mini"),Object.keys(n).map((function(e){t.style[e]=n[e]}))}},initDots:function(){var e=this;this._ispots.map((function(t){e.createDot(t,!1)})),this.ispotsInit=!0},createDot:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.player.plugins.progress;if(r&&(t&&(mergeISPOT(e),this._ispots.push(e)),this.ispotsInit||!t)){var n=this.calcuPosition(e.time,e.duration),i=e.style||{};i.left="".concat(n.left,"%"),i.width="".concat(n.width,"%");var o="xgspot_".concat(e.id," xgplayer-spot");n.isMini&&(o+=" mini");var a=util.createDom("xg-spot",e.template||"",{"data-text":e.text,"data-time":e.time,"data-id":e.id},o);Object.keys(i).map((function(e){a.style[e]=i[e]})),r.outer&&r.outer.appendChild(a)}},findDot:function(e){if(this.player.plugins.progress){var t=this._ispots.filter((function(t,r){return t.id===e}));return t.length>0?t[0]:null}},updateDot:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.player.plugins.progress;if(r){var n=this.findDot(e.id);if(n&&Object.keys(e).map((function(t){n[t]=e[t]})),this.ispotsInit){var i=r.find('xg-spot[data-id="'.concat(e.id,'"]'));i&&(this._updateDotDom(e,i),t&&this.showDot(e.id))}}},deleteDot:function(e){var t=this._ispots,r=this.player.plugins.progress;if(r){for(var n=[],i=0;i<t.length;i++)t[i].id===e&&n.push(i);for(var o=n.length-1;o>=0;o--)if(t.splice(n[o],1),this.ispotsInit){var a=r.find('xg-spot[data-id="'.concat(e,'"]'));a&&a.parentElement.removeChild(a)}}},deleteAllDots:function(){var e=this.player.plugins.progress;if(e)if(this.ispotsInit){for(var t=e.root.getElementsByTagName("xg-spot"),r=t.length-1;r>=0;r--)e.outer.removeChild(t[r]);this._ispots=[]}else this._ispots=[]},updateAllDots:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.player.plugins.progress;if(r)if(this.ispotsInit){this._ispots=[];var n=r.root.getElementsByTagName("xg-spot"),i=n.length;if(i>t.length)for(var o=i-1;o>t.length-1;o--)r.outer.removeChild(n[o]);t.forEach((function(t,r){r<i?(n[r].setAttribute("data-id","".concat(t.id)),e._ispots.push(t),e.updateDot(t)):e.createDot(t)}))}else this._ispots=t},updateDuration:function(){var e=this,t=this.player.plugins.progress;t&&this._ispots.forEach((function(r){var n=t.find('xg-spot[data-id="'.concat(r.id,'"]'));e._updateDotDom(r,n)}))},getAllDotsDom:function(){var e=this.player.plugins.progress;return e?e.root.getElementsByTagName("xg-spot"):[]},getDotDom:function(e){var t=this.player.plugins.progress;if(t)return t.find('xg-spot[data-id="'.concat(e,'"]'))}};function initDotsAPI(e){var t=e.config,r=e.player;Object.keys(APIS).map((function(t){e[t]=APIS[t].bind(e)}));var n=r.config.progressDot||t.ispots||[];e._ispots=n.map((function(e){return mergeISPOT(e),e})),e.ispotsInit=!1,e.on(DURATION_CHANGE,(function(){e.ispotsInit?e.updateDuration():e.initDots()}))}var CALLBACK_MAP={dragmove:"onProgressMove",dragstart:"onProgressDragStart",dragend:"onProgressDragEnd",click:"onProgressClick",mouseover:"onProgressMouseOver",mouseenter:"onProgressMove"},ProgressPreview=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n;return _classCallCheck$4(this,r),_defineProperty$5(_assertThisInitialized$4(n=t.call(this,e)),"onMousemove",(function(e){n.config.disable||(util.hasClass(e.target,"xg-spot-content")&&n.config.isHideThumbnailHover?n.player.plugins.progress.onMouseLeave(e):(n._state.f||util.hasClass(e.target,"xg-spot-content"))&&(util.event(e),e.stopPropagation()))})),_defineProperty$5(_assertThisInitialized$4(n),"onMousedown",(function(e){n.config.disable||(n._state.f||util.hasClass(e.target,"xg-spot-content"))&&(util.event(e),e.stopPropagation())})),_defineProperty$5(_assertThisInitialized$4(n),"onMouseup",(function(e){if(n.isDrag){var t=n.player.plugins.progress;t&&t.pos&&(t.onMouseUp(e),!t.pos.isEnter&&t.onMouseLeave(e))}})),_defineProperty$5(_assertThisInitialized$4(n),"onDotMouseLeave",(function(e){if(!n.config.disable){n._curDot.removeEventListener("mouseleave",n.onDotMouseLeave),n.blurDot(e.target),n._curDot=null;var t=n.player.plugins.progress;t&&t.enableBlur(),n.show()}})),_defineProperty$5(_assertThisInitialized$4(n),"onProgressMouseOver",(function(e,t){if(!n.config.disable&&util.hasClass(t.target,"xgplayer-spot")&&!n._curDot){n._curDot=t.target,n.focusDot(t.target),n._curDot.children.length>0&&n.hide();var r=n.player.plugins.progress;r&&r.disableBlur(),n._curDot.addEventListener("mouseleave",n.onDotMouseLeave)}})),n._ispots=[],n.videoPreview=null,n.videothumbnail=null,n.thumbnail=null,n.timeStr="",n._state={now:0,f:!1},n}return _createClass$5(r,[{key:"beforeCreate",value:function(e){var t=e.player.plugins.progress;t&&(e.root=t.root)}},{key:"afterCreate",value:function(){var e=this;this._curDot=null,this.handlerSpotClick=this.hook("spotClick",(function(t,r){r.time&&e.player.seek(r.time)})),this.transformTimeHook=this.hook("transformTime",(function(t){e.setTimeContent(util.format(t))})),initDotsAPI(this),this.on(DURATION_CHANGE,(function(){e.show()})),this.config.disable&&this.disable(),this.extTextRoot=this.find(".xg-spot-ext-text")}},{key:"setConfig",value:function(e){var t=this;e&&Object.keys(e).map((function(r){t.config[r]=e[r]}))}},{key:"onPluginsReady",value:function(){this.player.plugins.progress&&(this.previewLine=this.find(".xg-spot-line"),this.timePoint=this.find(".xgplayer-progress-point"),this.timeText=this.find(".xg-spot-time"),this.tipText=this.find(".spot-inner-text"),this._hasThumnail=!1,this.registerThumbnail(),this.bindEvents())}},{key:"bindEvents",value:function(){var e=this,t=this.player.plugins.progress;if(t&&(Object.keys(CALLBACK_MAP).map((function(r){e[CALLBACK_MAP[r]]=e[CALLBACK_MAP[r]].bind(e),t.addCallBack(r,e[CALLBACK_MAP[r]])})),"mobile"!==sniffer$1.device)){this.bind(".xg-spot-info","mousemove",this.onMousemove),this.bind(".xg-spot-info","mousedown",this.onMousedown),this.bind(".xg-spot-info","mouseup",this.onMouseup);var r=this.hook("previewClick",(function(){}));this.handlerPreviewClick=function(t){t.stopPropagation(),r(parseInt(1e3*e._state.now,10)/1e3,t)},this.bind(".xg-spot-content","mouseup",this.handlerPreviewClick)}}},{key:"onProgressMove",value:function(e,t){!this.config.disable&&this.player.duration&&this.updatePosition(e.offset,e.width,e.currentTime,e.e)}},{key:"onProgressDragStart",value:function(e){!this.config.disable&&this.player.duration&&(this.isDrag=!0,this.videoPreview&&util.addClass(this.videoPreview,"show"))}},{key:"onProgressDragEnd",value:function(e){!this.config.disable&&this.player.duration&&(this.isDrag=!1,this.videoPreview&&util.removeClass(this.videoPreview,"show"))}},{key:"onProgressClick",value:function(e,t){if(!this.config.disable&&util.hasClass(t.target,"xgplayer-spot")){t.stopPropagation(),t.preventDefault();var r={};["time","id","text"].map((function(e){r[e]=t.target.getAttribute("data-".concat(e))})),r.time&&(r.time=Number(r.time)),this.handlerSpotClick(t,r)}}},{key:"updateLinePos",value:function(e,t){var r=this.root,n=this.previewLine,i=this.timePoint,o=this.player,a=this.config,s="flex"===o.controls.mode,l=r.getBoundingClientRect().width;if(l){var c,u,h=i.getBoundingClientRect().width,d=e-(l=this._hasThumnail&&l<a.width?a.width:l)/2;d<0&&!s?(d=0,c=e-l/2,!this.thumbnail&&(u=e-l/2-h/2)):d>t-l&&!s?(c=d-(t-l),!this.thumbnail&&(u=d-(t-l)-h/2),d=t-l):(c=0,!this.thumbnail&&(u=-h/2)),void 0!==c&&(n.style.transform="translateX(".concat(c.toFixed(2),"px)")),void 0!==u&&(i.style.transform="translateX(".concat(u.toFixed(2),"px)")),r.style.transform="translateX(".concat(d.toFixed(2),"px) translateZ(0)")}}},{key:"updateTimeText",value:function(e){var t=this.timeText,r=this.timePoint;t.textContent=e,!this.thumbnail&&(r.textContent=e)}},{key:"updatePosition",value:function(e,t,r,n){var i=this.root,o=this.config,a=this._state;if(i){this.updateLinePos(e,t),a.now=r,this.transformTimeHook(r);var s=this.timeStr;n&&n.target&&util.hasClass(n.target,"xgplayer-spot")?(this.showTips(n.target.getAttribute("data-text"),!1,s),this.focusDot(n.target),a.f=!0,o.isFocusDots&&a.f&&(a.now=parseInt(n.target.getAttribute("data-time"),10))):o.defaultText?(a.f=!1,this.showTips(o.defaultText,!0,s)):(a.f=!1,this.hideTips("")),this.updateTimeText(s),this.updateThumbnails(a.now)}}},{key:"setTimeContent",value:function(e){this.timeStr=e}},{key:"updateThumbnails",value:function(e){var t=this.player,r=this.videoPreview,n=this.config,i=t.plugins.thumbnail;if(i&&i.usable){this.thumbnail&&i.update(this.thumbnail,e,n.width,n.height);var o=r&&r.getBoundingClientRect();this.videothumbnail&&i.update(this.videothumbnail,e,o.width,o.height)}}},{key:"registerThumbnail",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("mobile"!==sniffer$1.device){var t=this.player,r=this.config,n=t.getPlugin("thumbnail");if(n&&n.setConfig(e),n&&n.usable&&r.isShowThumbnail){util.removeClass(this.root,"short-line no-thumbnail"),"short"===r.mode&&util.addClass(this.root,"short-line"),this._hasThumnail=!0;var i=this.find(".xg-spot-thumbnail");this.thumbnail=n.createThumbnail(i,"progress-thumbnail"),r.isShowCoverPreview&&(this.videoPreview=util.createDom("xg-video-preview","",{},"xgvideo-preview"),t.root.appendChild(this.videoPreview),this.videothumbnail=n.createThumbnail(this.videoPreview,"xgvideo-thumbnail")),this.updateThumbnails(0)}else util.addClass(this.root,"short-line no-thumbnail")}}},{key:"calcuPosition",value:function(e,t){var r=this.player.plugins.progress,n=this.player,i=r.root.getBoundingClientRect().width,o=n.duration/i*6;return e+t>n.duration&&(t=n.duration-e),n.duration,n.duration,{left:e/n.duration*100,width:t/n.duration*100,isMini:t<o}}},{key:"showDot",value:function(e){var t=this.findDot(e);if(t){var r=this.root.getBoundingClientRect().width,n=t.time/this.player.duration*r;this.updatePosition(n,r,t.time)}}},{key:"focusDot",value:function(e,t){e&&(t||(t=e.getAttribute("data-id")),util.addClass(e,"active"),this._activeDotId=t)}},{key:"blurDot",value:function(e){if(!e){var t=this._activeDotId;e=this.getDotDom(t)}e&&(util.removeClass(e,"active"),this._activeDotId=null)}},{key:"showTips",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";util.addClass(this.root,"no-timepoint"),e&&(util.addClass(this.find(".xg-spot-content"),"show-text"),t&&"production"===this.config.mode?(util.addClass(this.root,"product"),this.tipText.textContent=e):(util.removeClass(this.root,"product"),this.tipText.textContent=this._hasThumnail?e:"".concat(r," ").concat(e)))}},{key:"hideTips",value:function(){util.removeClass(this.root,"no-timepoint"),this.tipText.textContent="",util.removeClass(this.find(".xg-spot-content"),"show-text"),util.removeClass(this.root,"product")}},{key:"hide",value:function(){util.addClass(this.root,"hide")}},{key:"show",value:function(){util.removeClass(this.root,"hide")}},{key:"enable",value:function(){var e=this.config,t=this.playerConfig;this.config.disable=!1,this.show(),!this.thumbnail&&e.isShowThumbnail&&this.registerThumbnail(t.thumbnail||{})}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){var e=this,t=this.player.plugins.progress;t&&Object.keys(CALLBACK_MAP).map((function(r){t.removeCallBack(r,e[CALLBACK_MAP[r]])})),this.videothumbnail=null,this.thumbnail=null,this.videoPreview&&this.player.root.removeChild(this.videoPreview),this.unbind(".xg-spot-info","mousemove",this.onMousemove),this.unbind(".xg-spot-info","mousedown",this.onMousedown),this.unbind(".xg-spot-info","mouseup",this.onMouseup),this.unbind(".xg-spot-content","mouseup",this.handlerPreviewClick)}},{key:"render",value:function(){return"mobile"===sniffer$1.device||"mobile"===this.playerConfig.isMobileSimulateMode?"":'<div class="xg-spot-info hide '.concat("short"===this.config.mode?"short-line":"",'">\n <div class="xg-spot-content">\n <div class="xg-spot-thumbnail">\n <span class="xg-spot-time"></span>\n </div>\n <div class="xg-spot-text"><span class="spot-inner-text"></span></div>\n </div>\n <div class="xgplayer-progress-point">00:00</div>\n <div class="xg-spot-ext-text"></div>\n <div class="xg-spot-line"></div>\n </div>')}}],[{key:"pluginName",get:function(){return"progresspreview"}},{key:"defaultConfig",get:function(){return{index:1,miniWidth:6,ispots:[],defaultText:"",isFocusDots:!0,isHideThumbnailHover:!0,isShowThumbnail:!0,isShowCoverPreview:!1,mode:"",disable:!1,width:160,height:90}}}]),r}(Plugin),Thumbnail=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(e){var n;return _classCallCheck$4(this,r),(n=t.call(this,e)).ratio=1,n.interval=null,n._preloadMark={},n}return _createClass$5(r,[{key:"afterCreate",value:function(){var e=this;this.usable&&this.initThumbnail(),this.on([DURATION_CHANGE],(function(){var t=e.config,r=t.pic_num,n=t.interval;e.usable&&(e.interval=n>0?n:Math.round(1e3*e.player.duration/r)/1e3)}))}},{key:"setConfig",value:function(e){var t=this;if(e){var r=Object.keys(e);r.length<1||(r.forEach((function(r){t.config[r]=e[r]})),this.usable&&this.initThumbnail())}}},{key:"usable",get:function(){var e=this.config,t=e.urls,r=e.pic_num;return t&&t.length>0&&r>0}},{key:"initThumbnail",value:function(){var e=this.config,t=e.width,r=e.height,n=e.pic_num,i=e.interval;this.ratio=t/r*100,this.interval=i||Math.round(this.player.duration/n),this._preloadMark={}}},{key:"getUrlByIndex",value:function(e){return e>=0&&e<this.config.urls.length?this.config.urls[e]:""}},{key:"preload",value:function(e){var t=this;if(!this._preloadMark[e]){var r=this.config.urls,n=r.length,i=[];e>0&&i.push(e-1),i.push(e),e>0&&e<n-1&&i.push(e+1),i.map((function(e){!t._preloadMark[e]&&e>=0&&e<n&&(t._preloadMark[e]=1,util.preloadImg(r[e],(function(){t._preloadMark[e]=2})))}))}}},{key:"getPosition",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.config,i=n.pic_num,o=n.row,a=n.col,s=n.width,l=n.height;this.interval=Math.round(this.player.duration/i);var c=Math.ceil(e/this.interval),u=(c=c>i?i:c)<o*a?0:Math.ceil(c/(o*a))-1,h=c-u*(a*o),d=h>0?Math.ceil(h/a)-1:0,p=h>0?h-d*a-1:0,f=0,g=0;if(t&&r){var y=t/r;y<s/l?f=(g=r)*(s/l):g=(f=t)/(s/l)}else r?t||(f=(g=r||l)*(s/l)):g=(f=t||s)/(s/l);var v=this.getUrlByIndex(u);return{urlIndex:u,rowIndex:d,colIndex:p,url:v,height:g,width:f,style:{backgroundImage:"url(".concat(v,")"),backgroundSize:"".concat(f*a,"px auto"),backgroundPosition:"-".concat(p*f,"px -").concat(d*g,"px"),width:"".concat(f,"px"),height:"".concat(g,"px")}}}},{key:"update",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=this.config,a=o.pic_num,s=o.urls;if(!(a<=0)&&s&&0!==s.length){var l=this.getPosition(t,r,n);this.preload(l.urlIndex),Object.keys(l.style).map((function(t){e.style[t]=l.style[t]})),Object.keys(i).map((function(t){e.style[t]=i[t]}))}}},{key:"changeConfig",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setConfig(e)}},{key:"createThumbnail",value:function(e,t){var r=util.createDom("xg-thumbnail","",{},"thumbnail ".concat(t));return e&&e.appendChild(r),r}}],[{key:"pluginName",get:function(){return"thumbnail"}},{key:"defaultConfig",get:function(){return{isShow:!1,urls:[],pic_num:0,col:0,row:0,height:90,width:160,scale:1,className:"",hidePortrait:!1}}}]),r}(Plugin),MiniProgress=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){return _classCallCheck$4(this,r),t.apply(this,arguments)}return _createClass$5(r,[{key:"afterCreate",value:function(){}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cached:0,played:0},t=arguments.length>1?arguments[1]:void 0;t&&this.root&&(e.cached&&(this.find("xg-mini-progress-cache").style.width="".concat(e.cached/t*100,"%")),e.played&&(this.find("xg-mini-progress-played").style.width="".concat(e.played/t*100,"%")))}},{key:"render",value:function(){if(this.playerConfig.progress&&this.playerConfig.miniprogress)return'<xg-mini-progress class="xg-mini-progress">\n <xg-mini-progress-cache class="xg-mini-progress-cache"></xg-mini-progress-cache>\n <xg-mini-progress-played class="xg-mini-progress-played"></xg-mini-progress-played>\n </xg-mini-progress>'}}],[{key:"pluginName",get:function(){return"MiniProgress"}},{key:"defaultConfig",get:function(){return{}}}]),r}(Plugin),MODES={REAL_TIME:"realtime",FIRST_FRAME:"firstframe",FRAME_RATE:"framerate",POSTER:"poster"};function nowTime$1(){try{return parseInt(window.performance.now(),10)}catch(e){return(new Date).getTime()}}function checkIsSupportCanvas(){try{return!!document.createElement("canvas").getContext}catch(e){return!1}}var isSupportCanvas=null,DynamicBg=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return _defineProperty$5(_assertThisInitialized$4(e=t.call.apply(t,[this].concat(i))),"onLoadedData",(function(t){e.player&&(e._frameCount=e.config.startFrameCount,e.renderOnTimeupdate(t),e.off(TIME_UPDATE,e.renderOnTimeupdate),e.on(TIME_UPDATE,e.renderOnTimeupdate))})),_defineProperty$5(_assertThisInitialized$4(e),"renderOnTimeupdate",(function(t){e._frameCount>0?(e.renderOnce(),e._frameCount--):(e._isLoaded=!0,e.off(TIME_UPDATE,e.renderOnTimeupdate),!e.player.paused&&e._checkIfCanStart()&&e.start())})),_defineProperty$5(_assertThisInitialized$4(e),"start",(function(){var t=e.player.media,r=nowTime$1(),n=e.checkVideoIsSupport(t);n&&e.canvasCtx&&(e.stop(),t.videoWidth&&t.videoHeight&&(e.videoPI=t.videoHeight>0?parseInt(t.videoWidth/t.videoHeight*100,10):0,(e.config.mode===MODES.REAL_TIME||r-e.preTime>=e.interval)&&(t&&t.videoWidth&&e.update(n,e.videoPI),e.preTime=r)),e.frameId=util.requestAnimationFrame(e.start))})),_defineProperty$5(_assertThisInitialized$4(e),"stop",(function(){e.frameId&&(util.cancelAnimationFrame(e.frameId),e.frameId=null)})),e}return _createClass$5(r,[{key:"afterCreate",value:function(){var e=this;!0===this.playerConfig.dynamicBg&&(this.config.disable=!1),r.isSupport||(this.config.disable=!0);var t=this.config,n=t.disable,i=t.mode,o=t.frameRate;n||(this._pos={width:0,height:0,rwidth:0,rheight:0,x:0,y:0,pi:0},this.isStart=!1,this._isLoaded=!1,this.videoPI=0,this.preTime=0,this.interval=parseInt(1e3/o,10),this.canvas=null,this.canvasCtx=null,this._frameCount=0,this.once(COMPLETE,(function(){e.player&&(e.init(),e.player.paused||e.start())})),i!==MODES.POSTER&&(i!==MODES.FIRST_FRAME&&(this.on(EMPTIED,(function(){e.stop()})),this.on(PLAY,(function(){e._checkIfCanStart()&&e.start()})),this.on(PAUSE,(function(){e.stop()}))),this.on(LOADED_DATA,this.onLoadedData),this.on(LOAD_START,(function(){e._isLoaded=!1,e.stop()}))))}},{key:"init",value:function(){var e=this.player,t=this.config;this.canvasFilter=r.supportCanvasFilter();try{var n=this.config.isInnerRender&&e.innerContainer||e.root;n.insertAdjacentHTML("afterbegin",'<div class="xgplayer-dynamic-bg"><canvas>\n </canvas><xgmask></xgmask></div>'),this.root=n.children[0],this.canvas=this.find("canvas"),this.canvasFilter||(this.canvas.style.filter=t.filter,this.canvas.style.webkitFilter=t.filter),this.mask=this.find("xgmask"),t.addMask&&(this.mask.style.background=t.maskBg),this.canvasCtx=this.canvas.getContext("2d"),this.renderByPoster()}catch(i){XG_DEBUG.logError("plugin:DynamicBg",i)}}},{key:"checkVideoIsSupport",value:function(e){if(!e)return null;var t=e&&e instanceof window.HTMLVideoElement?e:e.canvas?e.canvas:e.flyVideo?e.flyVideo:null;if(t&&("safari"!==sniffer$1.browser||!/^blob/.test(t.currentSrc)&&!/^blob/.test(t.src)))return t;var r=t?t.tagName.toLowerCase():"";return"canvas"===r||"img"===r?t:null}},{key:"renderByPoster",value:function(){var e=this.playerConfig.poster;if(e){var t="String"===util.typeOf(e)?e:"String"===util.typeOf(e.poster)?e.poster:null;this.updateImg(t)}}},{key:"_checkIfCanStart",value:function(){var e=this.config.mode;return this._isLoaded&&e!==MODES.FIRST_FRAME&&e!==MODES.POSTER}},{key:"renderOnce",value:function(){var e=this.player.media;if(e.videoWidth&&e.videoHeight){this.videoPI=parseInt(e.videoWidth/e.videoHeight*100,10);var t=this.checkVideoIsSupport(e);t&&e.videoWidth&&this.update(t,this.videoPI)}}},{key:"updateImg",value:function(e){var t=this;if(e){var r=this.canvas.getBoundingClientRect(),n=r.width,i=r.height,o=new window.Image;o.onload=function(){if(t.canvas&&!t.frameId&&!t.isStart){t.canvas.height=i,t.canvas.width=n;var e=parseInt(n/i*100,10);t.update(o,e),o=null}},o.src=e}}},{key:"update",value:function(e,t){if(this.canvas&&this.canvasCtx&&t)try{var r=this._pos,n=this.config,i=this.canvas.getBoundingClientRect(),o=i.width,a=i.height;if(o!==r.width||a!==r.height||r.pi!==t){var s=parseInt(o/a*100,10);r.pi=t,r.width=this.canvas.width=o,r.height=this.canvas.height=a;var l=a,c=o;s<t?c=parseInt(a*t/100,10):s>t&&(l=parseInt(100*o/t,10)),r.rwidth=c*n.multiple,r.rheight=l*n.multiple,r.x=(o-r.rwidth)/2,r.y=(a-r.rheight)/2}this.canvasFilter&&(this.canvasCtx.filter=n.filter),this.canvasCtx.drawImage(e,r.x,r.y,r.rwidth,r.rheight)}catch(u){XG_DEBUG.logError("plugin:DynamicBg",u)}}},{key:"destroy",value:function(){this.stop(),this.canvasCtx=null,this.canvas=null}},{key:"render",value:function(){return""}}],[{key:"pluginName",get:function(){return"dynamicBg"}},{key:"defaultConfig",get:function(){return{isInnerRender:!1,disable:!0,mode:"framerate",frameRate:10,filter:"blur(50px)",startFrameCount:2,addMask:!0,multiple:1.2,maskBg:"rgba(0,0,0,0.7)"}}},{key:"isSupport",get:function(){return"boolean"==typeof isSupportCanvas?isSupportCanvas:isSupportCanvas=checkIsSupportCanvas()}},{key:"supportCanvasFilter",value:function(){return!("safari"===sniffer$1.browser||"firefox"===sniffer$1.browser)}}]),r}(Plugin),ZH={LANG:"zh-cn",TEXT:{ERROR_TYPES:{network:{code:1,msg:"视频下载错误"},mse:{code:2,msg:"流追加错误"},parse:{code:3,msg:"解析错误"},format:{code:4,msg:"格式错误"},decoder:{code:5,msg:"解码错误"},runtime:{code:6,msg:"语法错误"},timeout:{code:7,msg:"播放超时"},other:{code:8,msg:"其他错误"}},HAVE_NOTHING:"没有关于音频/视频是否就绪的信息",HAVE_METADATA:"音频/视频的元数据已就绪",HAVE_CURRENT_DATA:"关于当前播放位置的数据是可用的,但没有足够的数据来播放下一帧/毫秒",HAVE_FUTURE_DATA:"当前及至少下一帧的数据是可用的",HAVE_ENOUGH_DATA:"可用数据足以开始播放",NETWORK_EMPTY:"音频/视频尚未初始化",NETWORK_IDLE:"音频/视频是活动的且已选取资源,但并未使用网络",NETWORK_LOADING:"浏览器正在下载数据",NETWORK_NO_SOURCE:"未找到音频/视频来源",MEDIA_ERR_ABORTED:"取回过程被用户中止",MEDIA_ERR_NETWORK:"网络错误",MEDIA_ERR_DECODE:"解码错误",MEDIA_ERR_SRC_NOT_SUPPORTED:"不支持的音频/视频格式",REPLAY:"重播",ERROR:"网络连接似乎出现了问题",PLAY_TIPS:"播放",PAUSE_TIPS:"暂停",PLAYNEXT_TIPS:"下一集",DOWNLOAD_TIPS:"下载",ROTATE_TIPS:"旋转",RELOAD_TIPS:"重新载入",FULLSCREEN_TIPS:"进入全屏",EXITFULLSCREEN_TIPS:"退出全屏",CSSFULLSCREEN_TIPS:"进入样式全屏",EXITCSSFULLSCREEN_TIPS:"退出样式全屏",TEXTTRACK:"字幕",PIP:"画中画",SCREENSHOT:"截图",LIVE:"正在直播",OFF:"关闭",OPEN:"开启",MINI_DRAG:"点击按住可拖动视频",MINISCREEN:"小屏幕",REFRESH_TIPS:"请试试",REFRESH:"刷新",FORWARD:"快进中",LIVE_TIP:"直播"}},$$j=_export,getBuiltIn$4=getBuiltIn$d,apply$6=functionApply,call$8=functionCall,uncurryThis$i=functionUncurryThis,fails$h=fails$L,isArray=isArray$5,isCallable$5=isCallable$u,isObject$8=isObject$n,isSymbol$2=isSymbol$6,arraySlice$7=arraySlice$c,NATIVE_SYMBOL$4=symbolConstructorDetection,$stringify=getBuiltIn$4("JSON","stringify"),exec$2=uncurryThis$i(/./.exec),charAt$4=uncurryThis$i("".charAt),charCodeAt$1=uncurryThis$i("".charCodeAt),replace$4=uncurryThis$i("".replace),numberToString$1=uncurryThis$i(1..toString),tester=/[\uD800-\uDFFF]/g,low=/^[\uD800-\uDBFF]$/,hi=/^[\uDC00-\uDFFF]$/,WRONG_SYMBOLS_CONVERSION=!NATIVE_SYMBOL$4||fails$h((function(){var e=getBuiltIn$4("Symbol")();return"[null]"!=$stringify([e])||"{}"!=$stringify({a:e})||"{}"!=$stringify(Object(e))})),ILL_FORMED_UNICODE=fails$h((function(){return'"\\udf06\\ud834"'!==$stringify("\udf06\ud834")||'"\\udead"'!==$stringify("\udead")})),stringifyWithSymbolsFix=function(e,t){var r=arraySlice$7(arguments),n=t;if((isObject$8(t)||void 0!==e)&&!isSymbol$2(e))return isArray(t)||(t=function(e,t){if(isCallable$5(n)&&(t=call$8(n,this,e,t)),!isSymbol$2(t))return t}),r[1]=t,apply$6($stringify,null,r)},fixIllFormed=function(e,t,r){var n=charAt$4(r,t-1),i=charAt$4(r,t+1);return exec$2(low,e)&&!exec$2(hi,i)||exec$2(hi,e)&&!exec$2(low,n)?"\\u"+numberToString$1(charCodeAt$1(e,0),16):e};$stringify&&$$j({target:"JSON",stat:!0,arity:3,forced:WRONG_SYMBOLS_CONVERSION||ILL_FORMED_UNICODE},{stringify:function(e,t,r){var n=arraySlice$7(arguments),i=apply$6(WRONG_SYMBOLS_CONVERSION?stringifyWithSymbolsFix:$stringify,null,n);return ILL_FORMED_UNICODE&&"string"==typeof i?replace$4(i,tester,fixIllFormed):i}});var fails$g=fails$L,wellKnownSymbol$7=wellKnownSymbol$u,IS_PURE=isPure,ITERATOR$3=wellKnownSymbol$7("iterator"),urlConstructorDetection=!fails$g((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,n){t.delete("b"),r+=n+e})),IS_PURE&&!e.toJSON||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[ITERATOR$3]||"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"!==r||"x"!==new URL("http://x",void 0).host})),anObject$3=anObject$l,iteratorClose=iteratorClose$2,callWithSafeIterationClosing$1=function(e,t,r,n){try{return n?t(anObject$3(r)[0],r[1]):t(r)}catch(error){iteratorClose(e,"throw",error)}},bind$6=functionBindContext,call$7=functionCall,toObject$7=toObject$h,callWithSafeIterationClosing=callWithSafeIterationClosing$1,isArrayIteratorMethod$1=isArrayIteratorMethod$3,isConstructor=isConstructor$4,lengthOfArrayLike$9=lengthOfArrayLike$i,createProperty=createProperty$5,getIterator$2=getIterator$4,getIteratorMethod$2=getIteratorMethod$5,$Array$1=Array,arrayFrom$1=function(e){var t=toObject$7(e),r=isConstructor(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=bind$6(i,n>2?arguments[2]:void 0));var a,s,l,c,u,h,d=getIteratorMethod$2(t),p=0;if(!d||this===$Array$1&&isArrayIteratorMethod$1(d))for(a=lengthOfArrayLike$9(t),s=r?new this(a):$Array$1(a);a>p;p++)h=o?i(t[p],p):t[p],createProperty(s,p,h);else for(u=(c=getIterator$2(t,d)).next,s=r?new this:[];!(l=call$7(u,c)).done;p++)h=o?callWithSafeIterationClosing(c,i,[l.value,p],!0):l.value,createProperty(s,p,h);return s.length=p,s},uncurryThis$h=functionUncurryThis,maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexNonASCII=/[^\0-\u007E]/,regexSeparators=/[.\u3002\uFF0E\uFF61]/g,OVERFLOW_ERROR="Overflow: input needs wider integers to process",baseMinusTMin=base-tMin,$RangeError$3=RangeError,exec$1=uncurryThis$h(regexSeparators.exec),floor$4=Math.floor,fromCharCode=String.fromCharCode,charCodeAt=uncurryThis$h("".charCodeAt),join$4=uncurryThis$h([].join),push$5=uncurryThis$h([].push),replace$3=uncurryThis$h("".replace),split$2=uncurryThis$h("".split),toLowerCase$1=uncurryThis$h("".toLowerCase),ucs2decode=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=charCodeAt(e,r++);if(i>=55296&&i<=56319&&r<n){var o=charCodeAt(e,r++);56320==(64512&o)?push$5(t,((1023&i)<<10)+(1023&o)+65536):(push$5(t,i),r--)}else push$5(t,i)}return t},digitToBasic=function(e){return e+22+75*(e<26)},adapt=function(e,t,r){var n=0;for(e=r?floor$4(e/damp):e>>1,e+=floor$4(e/t);e>baseMinusTMin*tMax>>1;)e=floor$4(e/baseMinusTMin),n+=base;return floor$4(n+(baseMinusTMin+1)*e/(e+skew))},encode$1=function(e){var t,r,n=[],i=(e=ucs2decode(e)).length,o=initialN,a=0,s=initialBias;for(t=0;t<e.length;t++)(r=e[t])<128&&push$5(n,fromCharCode(r));var l=n.length,c=l;for(l&&push$5(n,delimiter);c<i;){var u=maxInt;for(t=0;t<e.length;t++)(r=e[t])>=o&&r<u&&(u=r);var h=c+1;if(u-o>floor$4((maxInt-a)/h))throw $RangeError$3(OVERFLOW_ERROR);for(a+=(u-o)*h,o=u,t=0;t<e.length;t++){if((r=e[t])<o&&++a>maxInt)throw $RangeError$3(OVERFLOW_ERROR);if(r==o){for(var d=a,p=base;;){var f=p<=s?tMin:p>=s+tMax?tMax:p-s;if(d<f)break;var g=d-f,y=base-f;push$5(n,fromCharCode(digitToBasic(f+g%y))),d=floor$4(g/y),p+=base}push$5(n,fromCharCode(digitToBasic(d))),s=adapt(a,h,c==l),a=0,c++}}a++,o++}return join$4(n,"")},stringPunycodeToAscii=function(e){var t,r,n=[],i=split$2(replace$3(toLowerCase$1(e),regexSeparators,"."),".");for(t=0;t<i.length;t++)r=i[t],push$5(n,exec$1(regexNonASCII,r)?"xn--"+encode$1(r):r);return join$4(n,".")},defineBuiltIn$7=defineBuiltIn$i,defineBuiltIns$2=function(e,t,r){for(var n in t)defineBuiltIn$7(e,n,t[n],r);return e},$$i=_export,global$i=global$H,call$6=functionCall,uncurryThis$g=functionUncurryThis,DESCRIPTORS$7=descriptors,USE_NATIVE_URL$1=urlConstructorDetection,defineBuiltIn$6=defineBuiltIn$i,defineBuiltIns$1=defineBuiltIns$2,setToStringTag$3=setToStringTag$7,createIteratorConstructor=iteratorCreateConstructor,InternalStateModule$5=internalState,anInstance$3=anInstance$5,isCallable$4=isCallable$u,hasOwn$9=hasOwnProperty_1,bind$5=functionBindContext,classof$5=classof$e,anObject$2=anObject$l,isObject$7=isObject$n,$toString$2=toString$h,create$2=objectCreate,createPropertyDescriptor$2=createPropertyDescriptor$7,getIterator$1=getIterator$4,getIteratorMethod$1=getIteratorMethod$5,validateArgumentsLength$2=validateArgumentsLength$4,wellKnownSymbol$6=wellKnownSymbol$u,arraySort=arraySort$1,ITERATOR$2=wellKnownSymbol$6("iterator"),URL_SEARCH_PARAMS="URLSearchParams",URL_SEARCH_PARAMS_ITERATOR=URL_SEARCH_PARAMS+"Iterator",setInternalState$4=InternalStateModule$5.set,getInternalParamsState=InternalStateModule$5.getterFor(URL_SEARCH_PARAMS),getInternalIteratorState=InternalStateModule$5.getterFor(URL_SEARCH_PARAMS_ITERATOR),getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,safeGetBuiltIn=function(e){if(!DESCRIPTORS$7)return global$i[e];var t=getOwnPropertyDescriptor(global$i,e);return t&&t.value},nativeFetch=safeGetBuiltIn("fetch"),NativeRequest=safeGetBuiltIn("Request"),Headers$1=safeGetBuiltIn("Headers"),RequestPrototype=NativeRequest&&NativeRequest.prototype,HeadersPrototype=Headers$1&&Headers$1.prototype,RegExp$1=global$i.RegExp,TypeError$4=global$i.TypeError,decodeURIComponent$1=global$i.decodeURIComponent,encodeURIComponent$1=global$i.encodeURIComponent,charAt$3=uncurryThis$g("".charAt),join$3=uncurryThis$g([].join),push$4=uncurryThis$g([].push),replace$2=uncurryThis$g("".replace),shift$1=uncurryThis$g([].shift),splice=uncurryThis$g([].splice),split$1=uncurryThis$g("".split),stringSlice$2=uncurryThis$g("".slice),plus=/\+/g,sequences=Array(4),percentSequence=function(e){return sequences[e-1]||(sequences[e-1]=RegExp$1("((?:%[\\da-f]{2}){"+e+"})","gi"))},percentDecode=function(e){try{return decodeURIComponent$1(e)}catch(error){return e}},deserialize=function(e){var t=replace$2(e,plus," "),r=4;try{return decodeURIComponent$1(t)}catch(error){for(;r;)t=replace$2(t,percentSequence(r--),percentDecode);return t}},find=/[!'()~]|%20/g,replacements={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},replacer=function(e){return replacements[e]},_serialize=function(e){return replace$2(encodeURIComponent$1(e),find,replacer)},URLSearchParamsIterator=createIteratorConstructor((function(e,t){setInternalState$4(this,{type:URL_SEARCH_PARAMS_ITERATOR,iterator:getIterator$1(getInternalParamsState(e).entries),kind:t})}),"Iterator",(function(){var e=getInternalIteratorState(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),URLSearchParamsState=function(e){this.entries=[],this.url=null,void 0!==e&&(isObject$7(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===charAt$3(e,0)?stringSlice$2(e,1):e:$toString$2(e)))};URLSearchParamsState.prototype={type:URL_SEARCH_PARAMS,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,l=getIteratorMethod$1(e);if(l)for(r=(t=getIterator$1(e,l)).next;!(n=call$6(r,t)).done;){if(o=(i=getIterator$1(anObject$2(n.value))).next,(a=call$6(o,i)).done||(s=call$6(o,i)).done||!call$6(o,i).done)throw TypeError$4("Expected sequence with length 2");push$4(this.entries,{key:$toString$2(a.value),value:$toString$2(s.value)})}else for(var c in e)hasOwn$9(e,c)&&push$4(this.entries,{key:c,value:$toString$2(e[c])})},parseQuery:function(e){if(e)for(var t,r,n=split$1(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=split$1(t,"="),push$4(this.entries,{key:deserialize(shift$1(r)),value:deserialize(join$3(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],push$4(r,_serialize(e.key)+"="+_serialize(e.value));return join$3(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var URLSearchParamsConstructor=function(){anInstance$3(this,URLSearchParamsPrototype);var e=arguments.length>0?arguments[0]:void 0;setInternalState$4(this,new URLSearchParamsState(e))},URLSearchParamsPrototype=URLSearchParamsConstructor.prototype;if(defineBuiltIns$1(URLSearchParamsPrototype,{append:function(e,t){validateArgumentsLength$2(arguments.length,2);var r=getInternalParamsState(this);push$4(r.entries,{key:$toString$2(e),value:$toString$2(t)}),r.updateURL()},delete:function(e){validateArgumentsLength$2(arguments.length,1);for(var t=getInternalParamsState(this),r=t.entries,n=$toString$2(e),i=0;i<r.length;)r[i].key===n?splice(r,i,1):i++;t.updateURL()},get:function(e){validateArgumentsLength$2(arguments.length,1);for(var t=getInternalParamsState(this).entries,r=$toString$2(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){validateArgumentsLength$2(arguments.length,1);for(var t=getInternalParamsState(this).entries,r=$toString$2(e),n=[],i=0;i<t.length;i++)t[i].key===r&&push$4(n,t[i].value);return n},has:function(e){validateArgumentsLength$2(arguments.length,1);for(var t=getInternalParamsState(this).entries,r=$toString$2(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){validateArgumentsLength$2(arguments.length,1);for(var r,n=getInternalParamsState(this),i=n.entries,o=!1,a=$toString$2(e),s=$toString$2(t),l=0;l<i.length;l++)(r=i[l]).key===a&&(o?splice(i,l--,1):(o=!0,r.value=s));o||push$4(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=getInternalParamsState(this);arraySort(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=getInternalParamsState(this).entries,n=bind$5(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new URLSearchParamsIterator(this,"keys")},values:function(){return new URLSearchParamsIterator(this,"values")},entries:function(){return new URLSearchParamsIterator(this,"entries")}},{enumerable:!0}),defineBuiltIn$6(URLSearchParamsPrototype,ITERATOR$2,URLSearchParamsPrototype.entries,{name:"entries"}),defineBuiltIn$6(URLSearchParamsPrototype,"toString",(function(){return getInternalParamsState(this).serialize()}),{enumerable:!0}),setToStringTag$3(URLSearchParamsConstructor,URL_SEARCH_PARAMS),$$i({global:!0,constructor:!0,forced:!USE_NATIVE_URL$1},{URLSearchParams:URLSearchParamsConstructor}),!USE_NATIVE_URL$1&&isCallable$4(Headers$1)){var headersHas=uncurryThis$g(HeadersPrototype.has),headersSet=uncurryThis$g(HeadersPrototype.set),wrapRequestOptions=function(e){if(isObject$7(e)){var t,r=e.body;if(classof$5(r)===URL_SEARCH_PARAMS)return t=e.headers?new Headers$1(e.headers):new Headers$1,headersHas(t,"content-type")||headersSet(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),create$2(e,{body:createPropertyDescriptor$2(0,$toString$2(r)),headers:createPropertyDescriptor$2(0,t)})}return e};if(isCallable$4(nativeFetch)&&$$i({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return nativeFetch(e,arguments.length>1?wrapRequestOptions(arguments[1]):{})}}),isCallable$4(NativeRequest)){var RequestConstructor=function(e){return anInstance$3(this,RequestPrototype),new NativeRequest(e,arguments.length>1?wrapRequestOptions(arguments[1]):{})};RequestPrototype.constructor=RequestConstructor,RequestConstructor.prototype=RequestPrototype,$$i({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:RequestConstructor})}}var web_urlSearchParams_constructor={URLSearchParams:URLSearchParamsConstructor,getState:getInternalParamsState},$$h=_export,DESCRIPTORS$6=descriptors,USE_NATIVE_URL=urlConstructorDetection,global$h=global$H,bind$4=functionBindContext,uncurryThis$f=functionUncurryThis,defineBuiltIn$5=defineBuiltIn$i,defineBuiltInAccessor=defineBuiltInAccessor$2,anInstance$2=anInstance$5,hasOwn$8=hasOwnProperty_1,assign$3=objectAssign,arrayFrom=arrayFrom$1,arraySlice$6=arraySliceSimple,codeAt=stringMultibyte.codeAt,toASCII=stringPunycodeToAscii,$toString$1=toString$h,setToStringTag$2=setToStringTag$7,validateArgumentsLength$1=validateArgumentsLength$4,URLSearchParamsModule=web_urlSearchParams_constructor,InternalStateModule$4=internalState,setInternalState$3=InternalStateModule$4.set,getInternalURLState=InternalStateModule$4.getterFor("URL"),URLSearchParams$1=URLSearchParamsModule.URLSearchParams,getInternalSearchParamsState=URLSearchParamsModule.getState,NativeURL=global$h.URL,TypeError$3=global$h.TypeError,parseInt$1=global$h.parseInt,floor$3=Math.floor,pow$1=Math.pow,charAt$2=uncurryThis$f("".charAt),exec=uncurryThis$f(/./.exec),join$2=uncurryThis$f([].join),numberToString=uncurryThis$f(1..toString),pop=uncurryThis$f([].pop),push$3=uncurryThis$f([].push),replace$1=uncurryThis$f("".replace),shift=uncurryThis$f([].shift),split=uncurryThis$f("".split),stringSlice$1=uncurryThis$f("".slice),toLowerCase=uncurryThis$f("".toLowerCase),unshift=uncurryThis$f([].unshift),INVALID_AUTHORITY="Invalid authority",INVALID_SCHEME="Invalid scheme",INVALID_HOST="Invalid host",INVALID_PORT="Invalid port",ALPHA=/[a-z]/i,ALPHANUMERIC=/[\d+-.a-z]/i,DIGIT=/\d/,HEX_START=/^0x/i,OCT=/^[0-7]+$/,DEC=/^\d+$/,HEX=/^[\da-f]+$/i,FORBIDDEN_HOST_CODE_POINT=/[\0\t\n\r #%/:<>?@[\\\]^|]/,FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT=/[\0\t\n\r #/:<>?@[\\\]^|]/,LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,TAB_AND_NEW_LINE=/[\t\n\r]/g,EOF,parseIPv4=function(e){var t,r,n,i,o,a,s,l=split(e,".");if(l.length&&""==l[l.length-1]&&l.length--,(t=l.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=l[n]))return e;if(o=10,i.length>1&&"0"==charAt$2(i,0)&&(o=exec(HEX_START,i)?16:8,i=stringSlice$1(i,8==o?1:2)),""===i)a=0;else{if(!exec(10==o?DEC:8==o?OCT:HEX,i))return e;a=parseInt$1(i,o)}push$3(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=pow$1(256,5-t))return null}else if(a>255)return null;for(s=pop(r),n=0;n<r.length;n++)s+=r[n]*pow$1(256,3-n);return s},parseIPv6=function(e){var t,r,n,i,o,a,s,l=[0,0,0,0,0,0,0,0],c=0,u=null,h=0,d=function(){return charAt$2(e,h)};if(":"==d()){if(":"!=charAt$2(e,1))return;h+=2,u=++c}for(;d();){if(8==c)return;if(":"!=d()){for(t=r=0;r<4&&exec(HEX,d());)t=16*t+parseInt$1(d(),16),h++,r++;if("."==d()){if(0==r)return;if(h-=r,c>6)return;for(n=0;d();){if(i=null,n>0){if(!("."==d()&&n<4))return;h++}if(!exec(DIGIT,d()))return;for(;exec(DIGIT,d());){if(o=parseInt$1(d(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;h++}l[c]=256*l[c]+i,2!=++n&&4!=n||c++}if(4!=n)return;break}if(":"==d()){if(h++,!d())return}else if(d())return;l[c++]=t}else{if(null!==u)return;h++,u=++c}}if(null!==u)for(a=c-u,c=7;0!=c&&a>0;)s=l[c],l[c--]=l[u+a-1],l[u+--a]=s;else if(8!=c)return;return l},findLongestZeroSequence=function(e){for(var t=null,r=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r&&(t=n,r=i),t},serializeHost=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)unshift(t,e%256),e=floor$3(e/256);return join$2(t,".")}if("object"==_typeof$4(e)){for(t="",n=findLongestZeroSequence(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=numberToString(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},C0ControlPercentEncodeSet={},fragmentPercentEncodeSet=assign$3({},C0ControlPercentEncodeSet,{" ":1,'"':1,"<":1,">":1,"`":1}),pathPercentEncodeSet=assign$3({},fragmentPercentEncodeSet,{"#":1,"?":1,"{":1,"}":1}),userinfoPercentEncodeSet=assign$3({},pathPercentEncodeSet,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),percentEncode=function(e,t){var r=codeAt(e,0);return r>32&&r<127&&!hasOwn$8(t,e)?e:encodeURIComponent(e)},specialSchemes={ftp:21,file:null,http:80,https:443,ws:80,wss:443},isWindowsDriveLetter=function(e,t){var r;return 2==e.length&&exec(ALPHA,charAt$2(e,0))&&(":"==(r=charAt$2(e,1))||!t&&"|"==r)},startsWithWindowsDriveLetter=function(e){var t;return e.length>1&&isWindowsDriveLetter(stringSlice$1(e,0,2))&&(2==e.length||"/"===(t=charAt$2(e,2))||"\\"===t||"?"===t||"#"===t)},isSingleDot=function(e){return"."===e||"%2e"===toLowerCase(e)},isDoubleDot=function(e){return".."===(e=toLowerCase(e))||"%2e."===e||".%2e"===e||"%2e%2e"===e},SCHEME_START={},SCHEME={},NO_SCHEME={},SPECIAL_RELATIVE_OR_AUTHORITY={},PATH_OR_AUTHORITY={},RELATIVE={},RELATIVE_SLASH={},SPECIAL_AUTHORITY_SLASHES={},SPECIAL_AUTHORITY_IGNORE_SLASHES={},AUTHORITY={},HOST={},HOSTNAME={},PORT={},FILE={},FILE_SLASH={},FILE_HOST={},PATH_START={},PATH={},CANNOT_BE_A_BASE_URL_PATH={},QUERY={},FRAGMENT={},URLState=function e(t,r,n){var i,o,a,s=$toString$1(t);if(r){if(o=this.parse(s))throw TypeError$3(o);this.searchParams=null}else{if(void 0!==n&&(i=new e(n,!0)),o=this.parse(s,null,i))throw TypeError$3(o);(a=getInternalSearchParamsState(new URLSearchParams$1)).bindURL(this),this.searchParams=a}};URLState.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s=this,l=t||SCHEME_START,c=0,u="",h=!1,d=!1,p=!1;for(e=$toString$1(e),t||(s.scheme="",s.username="",s.password="",s.host=null,s.port=null,s.path=[],s.query=null,s.fragment=null,s.cannotBeABaseURL=!1,e=replace$1(e,LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE,"")),e=replace$1(e,TAB_AND_NEW_LINE,""),n=arrayFrom(e);c<=n.length;){switch(i=n[c],l){case SCHEME_START:if(!i||!exec(ALPHA,i)){if(t)return INVALID_SCHEME;l=NO_SCHEME;continue}u+=toLowerCase(i),l=SCHEME;break;case SCHEME:if(i&&(exec(ALPHANUMERIC,i)||"+"==i||"-"==i||"."==i))u+=toLowerCase(i);else{if(":"!=i){if(t)return INVALID_SCHEME;u="",l=NO_SCHEME,c=0;continue}if(t&&(s.isSpecial()!=hasOwn$8(specialSchemes,u)||"file"==u&&(s.includesCredentials()||null!==s.port)||"file"==s.scheme&&!s.host))return;if(s.scheme=u,t)return void(s.isSpecial()&&specialSchemes[s.scheme]==s.port&&(s.port=null));u="","file"==s.scheme?l=FILE:s.isSpecial()&&r&&r.scheme==s.scheme?l=SPECIAL_RELATIVE_OR_AUTHORITY:s.isSpecial()?l=SPECIAL_AUTHORITY_SLASHES:"/"==n[c+1]?(l=PATH_OR_AUTHORITY,c++):(s.cannotBeABaseURL=!0,push$3(s.path,""),l=CANNOT_BE_A_BASE_URL_PATH)}break;case NO_SCHEME:if(!r||r.cannotBeABaseURL&&"#"!=i)return INVALID_SCHEME;if(r.cannotBeABaseURL&&"#"==i){s.scheme=r.scheme,s.path=arraySlice$6(r.path),s.query=r.query,s.fragment="",s.cannotBeABaseURL=!0,l=FRAGMENT;break}l="file"==r.scheme?FILE:RELATIVE;continue;case SPECIAL_RELATIVE_OR_AUTHORITY:if("/"!=i||"/"!=n[c+1]){l=RELATIVE;continue}l=SPECIAL_AUTHORITY_IGNORE_SLASHES,c++;break;case PATH_OR_AUTHORITY:if("/"==i){l=AUTHORITY;break}l=PATH;continue;case RELATIVE:if(s.scheme=r.scheme,i==EOF)s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=arraySlice$6(r.path),s.query=r.query;else if("/"==i||"\\"==i&&s.isSpecial())l=RELATIVE_SLASH;else if("?"==i)s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=arraySlice$6(r.path),s.query="",l=QUERY;else{if("#"!=i){s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=arraySlice$6(r.path),s.path.length--,l=PATH;continue}s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=arraySlice$6(r.path),s.query=r.query,s.fragment="",l=FRAGMENT}break;case RELATIVE_SLASH:if(!s.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,l=PATH;continue}l=AUTHORITY}else l=SPECIAL_AUTHORITY_IGNORE_SLASHES;break;case SPECIAL_AUTHORITY_SLASHES:if(l=SPECIAL_AUTHORITY_IGNORE_SLASHES,"/"!=i||"/"!=charAt$2(u,c+1))continue;c++;break;case SPECIAL_AUTHORITY_IGNORE_SLASHES:if("/"!=i&&"\\"!=i){l=AUTHORITY;continue}break;case AUTHORITY:if("@"==i){h&&(u="%40"+u),h=!0,o=arrayFrom(u);for(var f=0;f<o.length;f++){var g=o[f];if(":"!=g||p){var y=percentEncode(g,userinfoPercentEncodeSet);p?s.password+=y:s.username+=y}else p=!0}u=""}else if(i==EOF||"/"==i||"?"==i||"#"==i||"\\"==i&&s.isSpecial()){if(h&&""==u)return INVALID_AUTHORITY;c-=arrayFrom(u).length+1,u="",l=HOST}else u+=i;break;case HOST:case HOSTNAME:if(t&&"file"==s.scheme){l=FILE_HOST;continue}if(":"!=i||d){if(i==EOF||"/"==i||"?"==i||"#"==i||"\\"==i&&s.isSpecial()){if(s.isSpecial()&&""==u)return INVALID_HOST;if(t&&""==u&&(s.includesCredentials()||null!==s.port))return;if(a=s.parseHost(u))return a;if(u="",l=PATH_START,t)return;continue}"["==i?d=!0:"]"==i&&(d=!1),u+=i}else{if(""==u)return INVALID_HOST;if(a=s.parseHost(u))return a;if(u="",l=PORT,t==HOSTNAME)return}break;case PORT:if(!exec(DIGIT,i)){if(i==EOF||"/"==i||"?"==i||"#"==i||"\\"==i&&s.isSpecial()||t){if(""!=u){var v=parseInt$1(u,10);if(v>65535)return INVALID_PORT;s.port=s.isSpecial()&&v===specialSchemes[s.scheme]?null:v,u=""}if(t)return;l=PATH_START;continue}return INVALID_PORT}u+=i;break;case FILE:if(s.scheme="file","/"==i||"\\"==i)l=FILE_SLASH;else{if(!r||"file"!=r.scheme){l=PATH;continue}if(i==EOF)s.host=r.host,s.path=arraySlice$6(r.path),s.query=r.query;else if("?"==i)s.host=r.host,s.path=arraySlice$6(r.path),s.query="",l=QUERY;else{if("#"!=i){startsWithWindowsDriveLetter(join$2(arraySlice$6(n,c),""))||(s.host=r.host,s.path=arraySlice$6(r.path),s.shortenPath()),l=PATH;continue}s.host=r.host,s.path=arraySlice$6(r.path),s.query=r.query,s.fragment="",l=FRAGMENT}}break;case FILE_SLASH:if("/"==i||"\\"==i){l=FILE_HOST;break}r&&"file"==r.scheme&&!startsWithWindowsDriveLetter(join$2(arraySlice$6(n,c),""))&&(isWindowsDriveLetter(r.path[0],!0)?push$3(s.path,r.path[0]):s.host=r.host),l=PATH;continue;case FILE_HOST:if(i==EOF||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&isWindowsDriveLetter(u))l=PATH;else if(""==u){if(s.host="",t)return;l=PATH_START}else{if(a=s.parseHost(u))return a;if("localhost"==s.host&&(s.host=""),t)return;u="",l=PATH_START}continue}u+=i;break;case PATH_START:if(s.isSpecial()){if(l=PATH,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=EOF&&(l=PATH,"/"!=i))continue}else s.fragment="",l=FRAGMENT;else s.query="",l=QUERY;break;case PATH:if(i==EOF||"/"==i||"\\"==i&&s.isSpecial()||!t&&("?"==i||"#"==i)){if(isDoubleDot(u)?(s.shortenPath(),"/"==i||"\\"==i&&s.isSpecial()||push$3(s.path,"")):isSingleDot(u)?"/"==i||"\\"==i&&s.isSpecial()||push$3(s.path,""):("file"==s.scheme&&!s.path.length&&isWindowsDriveLetter(u)&&(s.host&&(s.host=""),u=charAt$2(u,0)+":"),push$3(s.path,u)),u="","file"==s.scheme&&(i==EOF||"?"==i||"#"==i))for(;s.path.length>1&&""===s.path[0];)shift(s.path);"?"==i?(s.query="",l=QUERY):"#"==i&&(s.fragment="",l=FRAGMENT)}else u+=percentEncode(i,pathPercentEncodeSet);break;case CANNOT_BE_A_BASE_URL_PATH:"?"==i?(s.query="",l=QUERY):"#"==i?(s.fragment="",l=FRAGMENT):i!=EOF&&(s.path[0]+=percentEncode(i,C0ControlPercentEncodeSet));break;case QUERY:t||"#"!=i?i!=EOF&&("'"==i&&s.isSpecial()?s.query+="%27":s.query+="#"==i?"%23":percentEncode(i,C0ControlPercentEncodeSet)):(s.fragment="",l=FRAGMENT);break;case FRAGMENT:i!=EOF&&(s.fragment+=percentEncode(i,fragmentPercentEncodeSet))}c++}},parseHost:function(e){var t,r,n;if("["==charAt$2(e,0)){if("]"!=charAt$2(e,e.length-1))return INVALID_HOST;if(!(t=parseIPv6(stringSlice$1(e,1,-1))))return INVALID_HOST;this.host=t}else if(this.isSpecial()){if(e=toASCII(e),exec(FORBIDDEN_HOST_CODE_POINT,e))return INVALID_HOST;if(null===(t=parseIPv4(e)))return INVALID_HOST;this.host=t}else{if(exec(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT,e))return INVALID_HOST;for(t="",r=arrayFrom(e),n=0;n<r.length;n++)t+=percentEncode(r[n],C0ControlPercentEncodeSet);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return hasOwn$8(specialSchemes,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&isWindowsDriveLetter(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,a=e.path,s=e.query,l=e.fragment,c=t+":";return null!==i?(c+="//",e.includesCredentials()&&(c+=r+(n?":"+n:"")+"@"),c+=serializeHost(i),null!==o&&(c+=":"+o)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+join$2(a,"/"):"",null!==s&&(c+="?"+s),null!==l&&(c+="#"+l),c},setHref:function(e){var t=this.parse(e);if(t)throw TypeError$3(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new URLConstructor(e.path[0]).origin}catch(error){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+serializeHost(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse($toString$1(e)+":",SCHEME_START)},getUsername:function(){return this.username},setUsername:function(e){var t=arrayFrom($toString$1(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=percentEncode(t[r],userinfoPercentEncodeSet)}},getPassword:function(){return this.password},setPassword:function(e){var t=arrayFrom($toString$1(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=percentEncode(t[r],userinfoPercentEncodeSet)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?serializeHost(e):serializeHost(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,HOST)},getHostname:function(){var e=this.host;return null===e?"":serializeHost(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,HOSTNAME)},getPort:function(){var e=this.port;return null===e?"":$toString$1(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=$toString$1(e))?this.port=null:this.parse(e,PORT))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+join$2(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,PATH_START))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=$toString$1(e))?this.query=null:("?"==charAt$2(e,0)&&(e=stringSlice$1(e,1)),this.query="",this.parse(e,QUERY)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=$toString$1(e))?("#"==charAt$2(e,0)&&(e=stringSlice$1(e,1)),this.fragment="",this.parse(e,FRAGMENT)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var URLConstructor=function(e){var t=anInstance$2(this,URLPrototype),r=validateArgumentsLength$1(arguments.length,1)>1?arguments[1]:void 0,n=setInternalState$3(t,new URLState(e,!1,r));DESCRIPTORS$6||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},URLPrototype=URLConstructor.prototype,accessorDescriptor=function(e,t){return{get:function(){return getInternalURLState(this)[e]()},set:t&&function(e){return getInternalURLState(this)[t](e)},configurable:!0,enumerable:!0}};if(DESCRIPTORS$6&&(defineBuiltInAccessor(URLPrototype,"href",accessorDescriptor("serialize","setHref")),defineBuiltInAccessor(URLPrototype,"origin",accessorDescriptor("getOrigin")),defineBuiltInAccessor(URLPrototype,"protocol",accessorDescriptor("getProtocol","setProtocol")),defineBuiltInAccessor(URLPrototype,"username",accessorDescriptor("getUsername","setUsername")),defineBuiltInAccessor(URLPrototype,"password",accessorDescriptor("getPassword","setPassword")),defineBuiltInAccessor(URLPrototype,"host",accessorDescriptor("getHost","setHost")),defineBuiltInAccessor(URLPrototype,"hostname",accessorDescriptor("getHostname","setHostname")),defineBuiltInAccessor(URLPrototype,"port",accessorDescriptor("getPort","setPort")),defineBuiltInAccessor(URLPrototype,"pathname",accessorDescriptor("getPathname","setPathname")),defineBuiltInAccessor(URLPrototype,"search",accessorDescriptor("getSearch","setSearch")),defineBuiltInAccessor(URLPrototype,"searchParams",accessorDescriptor("getSearchParams")),defineBuiltInAccessor(URLPrototype,"hash",accessorDescriptor("getHash","setHash"))),defineBuiltIn$5(URLPrototype,"toJSON",(function(){return getInternalURLState(this).serialize()}),{enumerable:!0}),defineBuiltIn$5(URLPrototype,"toString",(function(){return getInternalURLState(this).serialize()}),{enumerable:!0}),NativeURL){var nativeCreateObjectURL=NativeURL.createObjectURL,nativeRevokeObjectURL=NativeURL.revokeObjectURL;nativeCreateObjectURL&&defineBuiltIn$5(URLConstructor,"createObjectURL",bind$4(nativeCreateObjectURL,NativeURL)),nativeRevokeObjectURL&&defineBuiltIn$5(URLConstructor,"revokeObjectURL",bind$4(nativeRevokeObjectURL,NativeURL))}setToStringTag$2(URLConstructor,"URL"),$$h({global:!0,constructor:!0,forced:!USE_NATIVE_URL,sham:!DESCRIPTORS$6},{URL:URLConstructor});var INFO="info",STATS_EVENTS=STATS_EVENTS$1,Stats=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return _defineProperty$5(_assertThisInitialized$4(e=t.call.apply(t,[this].concat(i))),"_recordUserActions",(function(t){var r=e._getTime(),n=Object.assign({},t,{msg:t.msg||t.action});e._stats[INFO].push(_objectSpread2$4(_objectSpread2$4({type:"userAction"},r),{},{payload:n}))})),_defineProperty$5(_assertThisInitialized$4(e),"_onReset",(function(){e.reset()})),_defineProperty$5(_assertThisInitialized$4(e),"_recordInfo",(function(t){e.info(t)})),_defineProperty$5(_assertThisInitialized$4(e),"_downloadStats",(function(){var t=e.getStats(),r=new Blob([JSON.stringify(t)],{type:"application/json"}),n=window.URL.createObjectURL(r),i=document.createElement("a");i.style.display="none",i.href=n,i.download="player.txt",i.disabled=!1,i.click()})),e}return _createClass$5(r,[{key:"_getTime",value:function(){return{timestamp:Date.now(),timeFormat:(new Date).toISOString()}}},{key:"afterCreate",value:function(){this.reset(),this.on(USER_ACTION,this._recordUserActions),this.on(STATS_EVENTS.STATS_INFO,this._recordInfo),this.on(STATS_EVENTS.STATS_DOWNLOAD,this._downloadStats),this.on(STATS_EVENTS.STATS_RESET,this._onReset)}},{key:"destroy",value:function(){this.offAll()}},{key:"downloadStats",value:function(){this._downloadStats()}},{key:"info",value:function(e){e.profile?this._infoProfile(e):this._info(e)}},{key:"_info",value:function(e){var t=this._getTime();this._stats[INFO].push(_objectSpread2$4(_objectSpread2$4({},t),{},{payload:e}))}},{key:"_infoProfile",value:function(e){if(e&&e.startMs){var t=_objectSpread2$4({cat:"function",dur:Date.now()-e.startMs,name:e.name||e.msg,ph:"X",pid:0,tid:0,ts:e.startMs,profile:!0},e);this._info(t)}else console.warn("infoProfile need object data, include startMs")}},{key:"reset",value:function(){var e;this._stats=(_defineProperty$5(e={},INFO,[]),_defineProperty$5(e,"media",{}),e)}},{key:"getStats",value:function(){for(var e=this.player.media,t=[],r=0;r<e.buffered.length;r++)t.push({start:e.buffered.start(r),end:e.buffered.end(r)});var n={currentTime:e.currentTime,readyState:e.readyState,buffered:t,paused:e.paused,ended:e.ended};return this._stats.media=n,{raw:this._stats,timestat:this._getTimeStats(),profile:this._getProfile()}}},{key:"_getTimeStats",value:function(){return this._stats[INFO].map((function(e){var t=e.payload.data,r="";try{t instanceof Error?r=t.msg:void 0!==t&&(r=JSON.stringify(t))}catch(error){console.log("err",error)}return"[".concat(e.timeFormat,"] : ").concat(e.payload.msg," ").concat(r," ")}))}},{key:"_getProfile",value:function(){var e={traceEvents:[]};return this._stats[INFO].forEach((function(t){t.payload.profile&&e.traceEvents.push(t.payload)})),e}}],[{key:"pluginName",get:function(){return"stats"}},{key:"defaultConfig",get:function(){return{}}}]),r}(BasePlugin),GapJump=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return _defineProperty$5(_assertThisInitialized$4(e=t.call.apply(t,[this].concat(i))),"onGapJump",(function(){var t=_assertThisInitialized$4(e),n=t.player,i=t.config;if(n.media.readyState!==HTMLMediaElement.HAVE_NOTHING){if(n.media.seeking){if(!e.seekingEventReceived)return}else e.seekingEventReceived=!1;if(!n.media.paused||0===n.media.currentTime||!e.hasPlayed){var o=n.media.buffered,a=i.smallGapLimit||.5,s=i.gapDetectionThreshold||.3,l=n.media.currentTime,c=e._getIndex(o,l,s);if(null!==c&&0!==c){console.log("GapJump bufferRange ",o.start(c),o.end(c));var u=o.start(c)+.1;if(!(u>n.media.duration)){var h=u-l,d=h<=a;h<r.BROWSER_GAP_TOLERANCE||d&&(!1!==i.useGapJump&&(n.media.currentTime=e.isSafari?u+.1:u),e.player&&e.player.emit("detectGap"),console.log("gapJump gapIndex",c," isGapSamll:",d," currentTime:",n.media.currentTime," jumpSize:",l-n.media.currentTime),.08!==u&&n&&n.emit("log",{type:"oneevent",end_type:"gap",vid:n.config.vid,ext:{video_postion:Math.floor(1e3*u)}}))}}}}})),e}return _createClass$5(r,[{key:"afterCreate",value:function(){var e=this;!1!==this.config.useGapJump&&(this.hasPlayed=!1,this.seekingEventReceived=!1,this.isSafari=/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),this.on(WAITING,this.onGapJump),this.on(PLAY,(function(){e.hasPlayed=!0})),this.on(SEEKING,(function(){e.seekingEventReceived=!0})))}},{key:"_getIndex",value:function(e,t,r){if(!e||!e.length)return null;if(1===e.length&&e.end(0)-e.start(0)<1e-6)return null;for(var n=this._getBuffered(e),i=null,o=0;o<n.length;o++){if(n[o].start>t&&(0===o||n[o-1].end-t<=r)){i=o;break}}return i}},{key:"_getBuffered",value:function(e){if(!e)return[];for(var t=[],r=0;r<e.length;r++)t.push({start:e.start(r),end:e.end(r)});return t}}],[{key:"pluginName",get:function(){return"gapJump"}},{key:"defaultConfig",get:function(){return{useGapJump:!1,smallGapLimit:.5,gapDetectionThreshold:.3}}}]),r}(Plugin);GapJump.BROWSER_GAP_TOLERANCE=.001;var WaitingTimeoutJump=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return _defineProperty$5(_assertThisInitialized$4(e=t.call.apply(t,[this].concat(i))),"onWaiting",(function(){var t=_assertThisInitialized$4(e).config;e.jumpCnt>t.jumpCntMax||e.timer||!1===t.useWaitingTimeoutJump||(e.timer=setTimeout(e.onJump,1e3*t.waitingTime))})),_defineProperty$5(_assertThisInitialized$4(e),"onJump",(function(){var t=_assertThisInitialized$4(e),r=t.player,n=t.config;if(clearTimeout(e.timer),e.timer=null,!(e.jumpCnt>n.jumpCntMax||!1===n.useWaitingTimeoutJump||r.media.paused&&0!==r.media.currentTime&&e.hasPlayed)){e.jumpSize=n.jumpSize*(e.jumpCnt+1),e.jumpCnt===n.jumpSize&&e.jumpSize<6&&(e.jumpSize=6);var i=r.currentTime+e.jumpSize;i>r.media.duration||(console.log("waitintTimeout, currentTime:",r.currentTime,", jumpTo:",i),e.jumpCnt++,r.currentTime=i)}})),e}return _createClass$5(r,[{key:"afterCreate",value:function(){var e=this,t=this.config,r=t.useWaitingTimeoutJump,n=t.jumpSize;!1!==r&&(this.hasPlayed=!1,this.jumpCnt=0,this.timer=null,this.jumpSize=n,this.on(WAITING,this.onWaiting),this.on([PLAYING,CANPLAY],(function(){clearTimeout(e.timer),e.timer=null,e.jumpSize=e.config.jumpSize})),this.on(PLAY,(function(){e.hasPlayed=!0})))}}],[{key:"pluginName",get:function(){return"waitingTimeoutJump"}},{key:"defaultConfig",get:function(){return{useWaitingTimeoutJump:!1,waitingTime:15,jumpSize:2,jumpCntMax:4}}}]),r}(Plugin),TestSpeed=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return _defineProperty$5(_assertThisInitialized$4(e=t.call.apply(t,[this].concat(i))),"getSpeed",(function(t){if(e.speedListCache.length<=0)return 0;var r=0;return e.speedListCache.map((function(e){r+=e})),Math.floor(r/e.speedListCache.length)})),_defineProperty$5(_assertThisInitialized$4(e),"_onRealSpeedChange",(function(t){t.speed&&e.appendList(t.speed)})),_defineProperty$5(_assertThisInitialized$4(e),"testSpeed",(function(){if(clearTimeout(e.timer),e.timer=null,e.player&&e.config.openSpeed){var t=e.config,r=t.url,n=t.loadSize,i=t.testCnt,o=t.testTimeStep,a=r+(r.indexOf("?")<0?"?testst=":"&testst=")+Date.now();if(!(e.cnt>=i)){e.cnt++;try{var s=(new Date).getTime(),l=null,c=new XMLHttpRequest;e.xhr=c,c.open("GET",a);var u={},h=Math.floor(10*Math.random());u.Range="bytes="+h+"-"+(n+h),u&&Object.keys(u).forEach((function(e){c.setRequestHeader(e,u[e])})),c.onreadystatechange=function(){if(4===c.readyState){e.xhr=null,l=(new Date).getTime();var t=c.getResponseHeader("Content-Length")/1024*8,r=Math.round(1e3*t/(l-s));e.appendList(r),e.timer=setTimeout(e.testSpeed,o)}},c.send()}catch(d){console.error(d)}}}})),_defineProperty$5(_assertThisInitialized$4(e),"appendList",(function(t){var r=e.config.saveSpeedMax;e.speedListCache.length>=r&&e.speedListCache.shift(),e.speedListCache.push(t),e.player&&(e.player.realTimeSpeed=t),e.updateSpeed()})),_defineProperty$5(_assertThisInitialized$4(e),"updateSpeed",(function(){var t=e.getSpeed(),r=_assertThisInitialized$4(e).player;!r||r.avgSpeed&&t===r.avgSpeed||(r.avgSpeed=t,r.emit(DOWNLOAD_SPEED_CHANGE,{speed:t,realTimeSpeed:r.realTimeSpeed}))})),e}return _createClass$5(r,[{key:"afterCreate",value:function(){var e=this;this.speedListCache=[];var t=this.config,r=t.openSpeed,n=t.testTimeStep;this.timer=null,this.cnt=0,this.xhr=null,r&&(this.on("real_time_speed",this._onRealSpeedChange),this.on([LOADED_DATA,REPLAY],(function(){util.isMSE(e.player.video)||(e.speedListCache=[],e.cnt=0,e.timer=setTimeout(e.testSpeed,n))})))}},{key:"openSpeed",get:function(){return this.config.openSpeed},set:function(e){if(this.config.openSpeed=e,!e&&this.timer)return clearTimeout(this.timer),void(this.timer=null);if(this.config.openSpeed){if(this.timer)return;this.timer=setTimeout(this.testSpeed,this.config.testTimeStep)}}},{key:"destroy",value:function(){clearTimeout(this.timer),this.timer=null,this.xhr&&4!==this.xhr.readyState&&(this.xhr.cancel(),this.xhr=null)}}],[{key:"pluginName",get:function(){return"testspeed"}},{key:"defaultConfig",get:function(){return{openSpeed:!1,testCnt:3,loadSize:204800,testTimeStep:3e3,url:"",saveSpeedMax:5}}}]),r}(Plugin),FpsDetect=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){return _classCallCheck$4(this,r),t.apply(this,arguments)}return _createClass$5(r,[{key:"afterCreate",value:function(){var e=this,t=this.player,r=this.config;(this.timer=null,this._lastDecodedFrames=0,this._currentStuckCount=0,this._lastCheckPoint=null,r.disabled)||t.media.getVideoPlaybackQuality&&(this.on(PLAY,(function(){e._startTick()})),this.on(PAUSE,(function(){e._stopTick()})),this.on(ENDED,(function(){e._stopTick()})),this.on(EMPTIED,(function(){e._stopTick()})))}},{key:"_startTick",value:function(){var e=this;this._stopTick(),this._timer=setTimeout((function(){e._checkDecodeFPS(),e._startTick()}),this.config.tick)}},{key:"_stopTick",value:function(){clearTimeout(this._timer),this._timer=null}},{key:"_checkStuck",value:function(e){var t=this.player.media,r=document.hidden,n=t.paused;if("boolean"==typeof r&&!r&&!n){for(var i=t.currentTime,o=t.buffered,a=!1,s=0;s<o.length;s++){var l=o.start(s),c=o.end(s);if(l<=i&&i<=c-1){a=!0;break}}4===t.readyState&&a&&(this._currentStuckCount>this.config.stuckCount?(this.emit(FPS_STUCK),this._currentStuckCount=0):(this.config.reportFrame,this._currentStuckCount++))}}},{key:"_checkDecodeFPS",value:function(){if(this.player.media){var e=this.player.media.getVideoPlaybackQuality().totalVideoFrames,t=performance.now();if(e&&this._lastCheckPoint){var r=e-this._lastDecodedFrames;this._checkStuck(r)}this._lastDecodedFrames=e,this._lastCheckPoint=t}}},{key:"destroy",value:function(){this._stopTick()}}],[{key:"pluginName",get:function(){return"FpsDetect"}},{key:"defaultConfig",get:function(){return{disabled:!1,tick:1e3,stuckCount:3,reportFrame:0}}}]),r}(Plugin);I18N.use(ZH);var DefaultPreset=_createClass$5((function e(t,r){var n,i,o;_classCallCheck$4(this,e);var a=r&&"mobile"===r.isMobileSimulateMode,s=r.isLive,l=[].concat(s?[]:[Progress,MiniProgress,ProgressPreview,Time],[Play,Fullscreen,Rotate,PlayNextIcon,DefinitionIcon,PlaybackRate,Download,ScreenShot,Volume,PIP]),c=[Replay,Poster,Start,Loading,Enter,ErrorPlugin$1,Prompt,Thumbnail,MiniScreen];this.plugins=[Stats,XGLogger].concat(_toConsumableArray(l),c,[GapJump,WaitingTimeoutJump]);var u=a?"mobile":sniffer$1.device;switch(u){case"pc":(n=this.plugins).push.apply(n,[Keyboard,PCPlugin,CssFullScreen,TestSpeed,FpsDetect]);break;case"mobile":(i=this.plugins).push.apply(i,[MobilePlugin]);break;default:(o=this.plugins).push.apply(o,[Keyboard,PCPlugin,CssFullScreen])}(sniffer$1.os.isIpad||"pc"===u)&&this.plugins.push(DynamicBg),sniffer$1.os.isIpad&&this.plugins.push(PCPlugin),this.ignores=[],this.i18n=[]})),PresetPlayer=function(e){_inherits$4(r,e);var t=_createSuper$4(r);function r(){return _classCallCheck$4(this,r),t.apply(this,arguments)}return _createClass$5(r)}(Player);_defineProperty$5(PresetPlayer,"defaultPreset",DefaultPreset),_defineProperty$5(PresetPlayer,"Util",util),_defineProperty$5(PresetPlayer,"Sniffer",sniffer$1),_defineProperty$5(PresetPlayer,"Errors",Errors),_defineProperty$5(PresetPlayer,"Events",Events),_defineProperty$5(PresetPlayer,"Plugin",Plugin),_defineProperty$5(PresetPlayer,"BasePlugin",BasePlugin),_defineProperty$5(PresetPlayer,"I18N",I18N),_defineProperty$5(PresetPlayer,"STATE_CLASS",STATE_CLASS);var zhHk={LANG:"zh-hk",TEXT:{ERROR_TYPES:{network:{code:1,msg:"視頻下載錯誤"},mse:{code:2,msg:"劉追加錯誤"},parse:{code:3,msg:"解析錯誤"},format:{code:4,msg:"格式錯誤"},decoder:{code:5,msg:"解碼錯誤"},runtime:{code:6,msg:"語法錯誤"},timeout:{code:7,msg:"播放超時"},other:{code:8,msg:"其他錯誤"}},HAVE_NOTHING:"沒有關於音頻/視頻是否就緒的信息",HAVE_METADATA:"音頻/視頻的元數據已就緒",HAVE_CURRENT_DATA:"關於當前播放位置的數據是可用的,但沒有足夠的數據來播放下壹幀/毫秒",HAVE_FUTURE_DATA:"當前及至少下壹幀的數據是可用的",HAVE_ENOUGH_DATA:"可用數據足以開始播放",NETWORK_EMPTY:"音頻/視頻尚未初始化",NETWORK_IDLE:"音頻/視頻是活動的且已選取資源,但並未使用網絡",NETWORK_LOADING:"瀏覽器正在下載數據",NETWORK_NO_SOURCE:"未找到音頻/視頻來源",MEDIA_ERR_ABORTED:"取回過程被用戶中止",MEDIA_ERR_NETWORK:"下載錯誤",MEDIA_ERR_DECODE:"解碼錯誤",MEDIA_ERR_SRC_NOT_SUPPORTED:"不支持的音頻/視頻格式",REPLAY:"重播",ERROR:"網絡連接似乎出現了問題",PLAY_TIPS:"播放",PAUSE_TIPS:"暫停",PLAYNEXT_TIPS:"下壹集",DOWNLOAD_TIPS:"下載",ROTATE_TIPS:"旋轉",RELOAD_TIPS:"重新載入",FULLSCREEN_TIPS:"進入全屏",EXITFULLSCREEN_TIPS:"退出全屏",CSSFULLSCREEN_TIPS:"進入樣式全屏",EXITCSSFULLSCREEN_TIPS:"退出樣式全屏",TEXTTRACK:"字幕",PIP:"畫中畫",SCREENSHOT:"截圖",LIVE:"正在直播",OFF:"關閉",OPEN:"開啟",MINI_DRAG:"點擊按住可拖動視頻",MINISCREEN:"小屏幕",REFRESH_TIPS:"請試試",REFRESH:"刷新",FORWARD:"快进中",LIVE_TIP:"直播"}},jp$1={LANG:"jp",TEXT:{ERROR_TYPES:{network:{code:1,msg:"ビデオダウンロードエラー"},mse:{code:2,msg:"ストリーム追加エラー"},parse:{code:3,msg:"解析エラー"},format:{code:4,msg:"間違ったフォーマット"},decoder:{code:5,msg:"デコードエラー"},runtime:{code:6,msg:"文法エラー"},timeout:{code:7,msg:"再生タイムアウト"},other:{code:8,msg:"その他のエラー"}},HAVE_NOTHING:"オーディオ/ビデオが準備できているか情報がありません",HAVE_METADATA:"オーディオ/ビデオのメタデータは準備できています",HAVE_CURRENT_DATA:"現在の再生位置に関するデータは利用可能ですが、次のフレーム/ミリ秒を再生するのに十分なデータがありません",HAVE_FUTURE_DATA:"現在、少なくとも次のフレームのデータが利用可能です",HAVE_ENOUGH_DATA:"利用可能なデータは再生を開始するのに十分です",NETWORK_EMPTY:"オーディオ/ビデオが初期化されていません",NETWORK_IDLE:"オーディオ/ビデオはアクティブでリソースが選択されていますが、ネットワークが使用されていません",NETWORK_LOADING:"ブラウザーはデータをダウンロードしています",NETWORK_NO_SOURCE:"オーディオ/ビデオ のソースが見つかりません",MEDIA_ERR_ABORTED:"ユーザーによってフェッチプロセスが中止されました",MEDIA_ERR_NETWORK:"ダウンロード中にエラーが発生しました",MEDIA_ERR_DECODE:"デコード中にエラーが発生しました",MEDIA_ERR_SRC_NOT_SUPPORTED:"オーディオ/ビデオ の形式がサポートされていません",REPLAY:"リプレイ",ERROR:"ネットワークの接続に問題が発生しました",PLAY_TIPS:"プレイ",PAUSE_TIPS:"一時停止",PLAYNEXT_TIPS:"次をプレイ",DOWNLOAD_TIPS:"ダウンロード",ROTATE_TIPS:"回転",RELOAD_TIPS:"再読み込み",FULLSCREEN_TIPS:"フルスクリーン",EXITFULLSCREEN_TIPS:"フルスクリーンを終了",CSSFULLSCREEN_TIPS:"シアターモード",EXITCSSFULLSCREEN_TIPS:"シアターモードを終了",TEXTTRACK:"字幕",PIP:"ミニプレーヤー",SCREENSHOT:"スクリーンショット",LIVE:"生放送",OFF:"オフ",OPEN:"開いた",MINI_DRAG:"ボタンを押して働画をドラッグする",MINISCREEN:"小さな画面",REFRESH:"リフレッシュ",REFRESH_TIPS:"してみてください",FORWARD:"早送り",LIVE_TIP:"生放送"}};function ownKeys$3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2$3(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$3(Object(r),!0).forEach((function(t){_defineProperty$4(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$3(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof$2(e){return(_typeof$2="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 _classCallCheck$3(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$4(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey$2(n.key),n)}}function _createClass$4(e,t,r){return t&&_defineProperties$4(e.prototype,t),r&&_defineProperties$4(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$4(e,t,r){return(t=_toPropertyKey$2(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$3(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&&_setPrototypeOf$3(e,t)}function _getPrototypeOf$3(e){return(_getPrototypeOf$3=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$3(e,t){return(_setPrototypeOf$3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$3(){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 _assertThisInitialized$3(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$3(e,t){if(t&&("object"===_typeof$4(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$3(e)}function _createSuper$3(e){var t=_isNativeReflectConstruct$3();return function(){var r,n=_getPrototypeOf$3(e);if(t){var i=_getPrototypeOf$3(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$3(this,r)}}function _superPropBase$1(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf$3(e)););return e}function _get$1(){return _get$1="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=_superPropBase$1(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},_get$1.apply(this,arguments)}function _toPrimitive$2(e,t){if("object"!==_typeof$4(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==_typeof$4(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey$2(e){var t=_toPrimitive$2(e,"string");return"symbol"===_typeof$4(t)?t:String(t)}var es_promise_finally={},$$g=_export,NativePromiseConstructor=promiseNativeConstructor,fails$f=fails$L,getBuiltIn$3=getBuiltIn$d,isCallable$3=isCallable$u,speciesConstructor$1=speciesConstructor$4,promiseResolve=promiseResolve$2,defineBuiltIn$4=defineBuiltIn$i,NativePromisePrototype=NativePromiseConstructor&&NativePromiseConstructor.prototype,NON_GENERIC=!!NativePromiseConstructor&&fails$f((function(){NativePromisePrototype.finally.call({then:function(){}},(function(){}))}));if($$g({target:"Promise",proto:!0,real:!0,forced:NON_GENERIC},{finally:function(e){var t=speciesConstructor$1(this,getBuiltIn$3("Promise")),r=isCallable$3(e);return this.then(r?function(r){return promiseResolve(t,e()).then((function(){return r}))}:e,r?function(r){return promiseResolve(t,e()).then((function(){throw r}))}:e)}}),isCallable$3(NativePromiseConstructor)){var method=getBuiltIn$3("Promise").prototype.finally;NativePromisePrototype.finally!==method&&defineBuiltIn$4(NativePromisePrototype,"finally",method,{unsafe:!0})}var $$f=_export,$includes$1=arrayIncludes.includes,fails$e=fails$L,addToUnscopables=addToUnscopables$4,BROKEN_ON_SPARSE=fails$e((function(){return!Array(1).includes()}));$$f({target:"Array",proto:!0,forced:BROKEN_ON_SPARSE},{includes:function(e){return $includes$1(this,e,arguments.length>1?arguments[1]:void 0)}}),addToUnscopables("includes");var isRegExp=isRegexp,$TypeError$2=TypeError,notARegexp=function(e){if(isRegExp(e))throw $TypeError$2("The method doesn't accept regular expressions");return e},wellKnownSymbol$5=wellKnownSymbol$u,MATCH=wellKnownSymbol$5("match"),correctIsRegexpLogic=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[MATCH]=!1,"/./"[e](t)}catch(n){}}return!1},$$e=_export,uncurryThis$e=functionUncurryThis,notARegExp=notARegexp,requireObjectCoercible$1=requireObjectCoercible$a,toString$5=toString$h,correctIsRegExpLogic=correctIsRegexpLogic,stringIndexOf=uncurryThis$e("".indexOf);$$e({target:"String",proto:!0,forced:!correctIsRegExpLogic("includes")},{includes:function(e){return!!~stringIndexOf(toString$5(requireObjectCoercible$1(this)),toString$5(notARegExp(e)),arguments.length>1?arguments[1]:void 0)}});var VTT_CHECK=/^WEBVTT/,VTT_STYLE=/^STYLE+$/,VTT_CUE=/^\:\:cue/,VTT_CUEND=/^}+$/,ASS_CHECK=/^\[Script Info\].*/,TIME_REGEX_LIST=[/[0-9]{1,3}:[0-9]{2}:[0-9]{2}\.[0-9]{1,3}-->[0-9]{1,3}:[0-9]{2}:[0-9]{2}\.[0-9]{1,3}/,/[0-9]{1,2}:[0-9]{2}\.[0-9]{1,3}-->[0-9]{1,2}:[0-9]{2}\.[0-9]{1,3}/,/[0-9]{1,2}\.[0-9]{1,3}-->[0-9]{1,2}\.[0-9]{1,3}/],MAX_COUNT=50,ASS_FORMAT=/^Format:\s/,ASS_STYLE=/^Style:\s/,ASS_DIALOGUE=/^Dialogue:\s/;function getSecond(e){var t=e.length;return 3===t?(60*(60*Number(e[0])+Number(e[1]))*1e3+1e3*Number(e[2]))/1e3:2===t?(60*Number(e[0])*1e3+1e3*Number(e[1]))/1e3:Number(e[0])}function isNumber$1(e){return/^(\-|\+)?\d+(\.\d+)?$/.test(e)}function htmlEncodeAll(e){return e}function getByIndex(e,t){return e>=0&&e<t.length?t[e]:""}var SubTitleParser=function(){function e(){_classCallCheck$3(this,e)}return _createClass$4(e,null,[{key:"parseJson",value:function(e){for(var t=[],r=0,n=0;n<e.length;n++){if(r>=MAX_COUNT&&(r=0),0===r){var i={start:e[n].start,list:[e[n]],end:e[n].end};t.push(i)}else t[t.length-1].list.push(e[n]),t[t.length-1].end=e[n].end;r++}return t}},{key:"parse",value:function(t,r){var n=e.checkFormat(t);n||r({format:n});try{var i=[];"ass"===n?i=e.parseASS(t):"vtt"===n&&(i=e.parseVTT(t)),r({format:n,list:i.list,styles:i.styles})}catch(error){console.error(error),r({format:n},error)}}},{key:"parseASSItem",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=e.split(","),n={},i="";try{var o=r.length-t.length;return i=htmlEncodeAll(i=(i=o>0?r.splice(t.length-1,o+1).join(",")+"":r[r.length-1]+"").replace(/\\n+/g,"")),r[t.length-1]=i,t.map((function(e,t){"end"===e||"start"===e?n[e]=getSecond(r[t].split(":")):"text"===e?n[e]=[r[t]]:"layer"===e?(n[e]=[r[t]],n.textTag=[r[t]]):n[e]="style"===e?[r[t]]:Number(r[t])?Number(r[t]):r[t]})),n}catch(error){return console.error(error),{}}}},{key:"parseASS",value:function(t){for(var r=t.split("\n"),n=[],i=0,o=0,a=[],s=[],l=null;i<r.length;){if(ASS_FORMAT.test(r[i]))s=(s=r[i].replace(ASS_FORMAT,"").replace(/\s+/g,"").split(",")).map((function(e){return e.toLocaleLowerCase()}));else if(ASS_STYLE.test(r[i]))a.push(r[i].replace(ASS_STYLE,"").replace(/\s+/g,""));else if(ASS_DIALOGUE.test(r[i])){var c=e.parseASSItem(r[i].replace(ASS_DIALOGUE,""),s);if(l&&c.start===l.start&&c.end===l.end)try{var u=l,h=u.text,d=u.textTag,p=u.style;h.push(c.text[0]),d.push(c.textTag[0]),p.push(c.style[0])}catch(error){console.error(error)}else{l=c;var f=null;o%MAX_COUNT==0?((f={start:l.start,end:l.end,list:[]}).list.push(l),n.push(f)):((f=n[n.length-1]).end=l.end,f.list.push(l)),o++}}i++}return{list:n,style:{}}}},{key:"parseVTTStyle",value:function(e,t){var r=e.split(":");if(r.length>1){var n=r[0].trim().split("-"),i="";n.length>1?n.map((function(e,t){i+=0===t?e:e.charAt(0).toUpperCase()+e.slice(1)})):i=n[0],t[i]=r[1].trim().replace(/;$/,"")}return t}},{key:"parseVTT",value:function(e){for(var t=(e=e.replace(VTT_CHECK,"")).split("\n"),r=[],n=0,i=0,o=null,a=!1,s=!1,l=null,c=null,u=[];n<t.length;){var h=getByIndex(n,t).trim();if(!h||a&&isNumber$1(h))a=!h;else if(VTT_CUE.test(h)&&VTT_STYLE.test(getByIndex(n-1,t).trim())){s=!0;var d=/\((.+?)\)/g.exec(h);c=d?d[1]:"",l=""}else if(s)VTT_CUEND.test(h)?(u.push({key:c,style:l}),l=null,c=null,s=!1):l+=h;else if(h){a=!1;var p=this.checkIsTime(t[n]);if(p){var f=this.parseVttTime(p);if(!o||f.start!==o.start||f.end!==o.end){(o=f).text=[],o.textTag=[];var g=null;i%MAX_COUNT==0?((g={start:o.start,end:o.end,list:[]}).list.push(o),r.push(g)):((g=r[r.length-1]).end=o.end,g.list.push(o)),i++}}else if(o){var y=o,v=y.text,m=y.textTag,_=this.parseVttText(t[n]);v.push(_.text),m.push(_.tag)}a=!1}n++}return{list:r,styles:u}}},{key:"checkIsTime",value:function(e){e=e.replace(/\s+/g,"");for(var t=0,r=null;t<TIME_REGEX_LIST.length&&!(r=TIME_REGEX_LIST[t].exec(e));)t++;return r?r[0]:null}},{key:"parseVttText",value:function(e){var t=/^(<?.+?>)/g.exec(e),r="",n="default";if(t){n=t[0].replace(/\<|\>|\&/g,"");var i=RegExp("^<".concat(n,">(([\\s\\S])*?)</").concat(n,">$")).exec(e);i?r=i[1]:(r=e,n="")}else r=e;for(var o=/<(\w+).(\w+)>/g,a=o.exec(r);a&&a.length>2;)r=r.replace(a[0],"<".concat(a[1],' class="').concat(a[2],'">')),a=o.exec(r);return{tag:n,text:htmlEncodeAll(r.replace(/\\n+/g,"<br/>"))}}},{key:"parseVttTime",value:function(e){var t,r=e.split("--\x3e"),n=0;if(2===r.length){var i=r[0].split(":"),o=r[1].split(":");t=getSecond(i),n=getSecond(o)}return{start:t,end:n,time:e}}},{key:"isVTT",value:function(e){return VTT_CHECK.test(e)}},{key:"isASS",value:function(e){return ASS_CHECK.test(e)}},{key:"checkFormat",value:function(e){return e?VTT_CHECK.test(e)?"vtt":ASS_CHECK.test(e)?"ass":null:null}}]),e}(),ERROR$2=[{code:0,msg:"SUCCESS"},{code:1,msg:"LOAD_ERROR"},{code:2,msg:"PARSER_ERROR"},{code:3,msg:"FORMAT_NOT_SUPPORTED"},{code:4,msg:"ID_OR_LANGUAGE_NOT_EXIST"},{code:5,msg:"PARAMETERS_ERROR"},{code:6,msg:"ABORT"},{code:7,msg:"UNKNOWN"},{code:8,msg:"DATA_ERROR:subtitle.url is null"},{code:9,msg:"DATA_ERROR:subtitle.url length is 0"}];function _ERROR(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={code:ERROR$2[e].code,msg:ERROR$2[e].msg};return Object.keys(t).map((function(e){r[e]=t[e]})),r}var XHR$1=_createClass$4((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.url,n=t.method,i=void 0===n?"GET":n,o=t.type,a=void 0===o?"arraybuffer":o,s=t.timeout,l=void 0===s?1e4:s,c=t.data,u=void 0===c?{}:c,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck$3(this,e),new Promise((function(e,t){var n=new window.XMLHttpRequest,o=i.toUpperCase(),s=[];if(a&&(n.responseType=a),l&&(n.timeout=l),Object.keys(u).forEach((function(e){s.push("k=".concat(u[e]))})),n.onload=function(){200===n.status||206===n.status?e({context:h,res:n}):t(new Error({context:h,res:n,type:"error"}))},n.onerror=function(e){t(new Error({context:h,res:n,type:"error"}))},n.ontimeout=function(e){t(new Error({context:h,res:n,type:"error"}))},n.onabort=function(){t(new Error({context:h,res:n,type:"error"}))},"GET"===o)n.open(o,"".concat(r)),n.send();else{if("post"!==o)throw new Error("xhr ".concat(o," is not supported"));n.open(o,r),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.send(s.join("&"))}}))})),ProxyPromise=function(){function e(){var t,r;_classCallCheck$3(this,e);var n=new Promise((function(e,n){t=e,r=n}));return n.resolve=function(e){t(e),n.state="fulfilled"},n.reject=function(e){r(e),n.state="rejected",n.isBreak="DESTROYED"===e},n.state="pending",n}return _createClass$4(e,[{key:"resolve",value:function(e){}},{key:"reject",value:function(e){}}]),e}();function hasClass$1(e,t){if(!e)return!1;if(e.classList)return Array.prototype.some.call(e.classList,(function(e){return e===t}));var r=e.className&&"object"===_typeof$2(e.className)?e.getAttribute("class"):e.className;return r&&!!r.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}function addClass$1(e,t){e&&(e.classList?t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.add(t)})):hasClass$1(e,t)||(e.className&&"object"===_typeof$2(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t))}function removeClass$1(e,t){e&&(e.classList?t.split(/\s+/g).forEach((function(t){e.classList.remove(t)})):hasClass$1(e,t)&&t.split(/\s+/g).forEach((function(t){var r=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===_typeof$2(e.className)?e.setAttribute("class",e.getAttribute("class").replace(r," ")):e.className=e.className.replace(r," ")})))}function findIndexByTime(e,t,r){var n=t.length;if(n<1)return-1;if(t[r=r<0?0:r>=n?n-1:r].start<=e&&e<t[r].end)return r;for(var i=t[r].end<=e?r+1:0;i<n;i++){if(t[i].start<=e&&e<t[i].end)return i;if(e>t[i].end&&i+1<n&&e<t[i+1].start)return-1;if(e>t[i].end&&i+1>=n)return-1}return-1}function findCIndexByTime(e,t,r){var n=t.length;if(n<1)return[];var i=[];if((r=r<0?0:r>=n?n-1:r)<n)for(var o=t[r].end<=e?r:0;o<n&&(t[o].start<=e&&e<t[o].end&&i.push(o),!(e<t[o].start));o++);return i}function getItemsByIndex(e,t,r){if(0===e.length||t<0||t>e.length-1)return[];var n=e[t].list;if(0===r.length)return[];var i=n.splice(r[0],r.length);return t>0&&e.splice(0,t),0===n.length&&e.splice(0,1),i}function typeOf(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}function createDom(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=document.createElement(e);return i.className=n,i.innerHTML=t,Object.keys(r).forEach((function(t){var n=t,o=r[t];"video"===e||"audio"===e||"live-video"===e?o&&i.setAttribute(n,o):i.setAttribute(n,o)})),i}function isMobile(){var e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),r=/(?:SymbianOS)/.test(e)||t,n=/(?:Android)/.test(e),i=/(?:Firefox)/.test(e),o=/(?:iPad|PlayBook)/.test(e)||n&&!/(?:Mobile)/.test(e)||i&&/(?:Tablet)/.test(e);return/(?:iPhone)/.test(e)&&!o||n||r||o}function addCSS(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r="";e.map((function(e){r+=" ".concat(t," ").concat(e.key," {").concat(e.style,"}")}));var n=document.createElement("style"),i=document.head||document.getElementsByTagName("head")[0];if(n.type="text/css",n.id="ssss",n.styleSheet){var o=function(){try{n.styleSheet.cssText=r}catch(e){}};n.styleSheet.disabled?setTimeout(o,10):o()}else{var a=document.createTextNode(r);n.appendChild(a)}i.appendChild(n)}function parse(e,t,r){if(r||(r=new ProxyPromise),"json"===t){var n=SubTitleParser.parseJson(e);r.resolve({list:n,format:"json"})}else"string"===t&&SubTitleParser.parse(e,(function(e,t){if(t){var n=_ERROR(2,t);r.reject(n,{format:e.format})}else if(e.format)r.resolve({styles:e.styles,list:e.list,format:e.format});else{var i=_ERROR(3);r.reject(i)}}));return r}function loadSubTitle(e,t){return t||(t=new ProxyPromise),new XHR$1({url:e.url,type:"text"}).then((function(r){parse(r.res.response,"string").then((function(r){t.resolve(_objectSpread2$3(_objectSpread2$3({},r),e))})).catch((function(e){t.reject(e)}))})).catch((function(r){var n=_ERROR(1,_objectSpread2$3({statusText:r.statusText,status:r.status,type:r.type,message:"http load error",url:e.src},e));t.reject(n)})),t}function checkSubtitle(e,t){return!!(e.id&&t.id&&e.id===t.id||e.language&&t.language&&e.language===t.language)}var ResizeObserver=function(){function e(){var t=this;_classCallCheck$3(this,e),this.__handlers=[],window.ResizeObserver&&(this.observer=new window.ResizeObserver((function(e){t.__trigger(e)})))}return _createClass$4(e,[{key:"addObserver",value:function(e,t){if(this.observer){this.observer&&this.observer.observe(e);for(var r=this.__handlers,n=-1,i=0;i<r.length;i++)r[i]&&e===r[i].target&&(n=i);n>-1?this.__handlers[n].handler.push(t):this.__handlers.push({target:e,handler:[t]})}}},{key:"unObserver",value:function(e){var t=-1;this.__handlers.map((function(r,n){e===r.target&&(t=n)})),this.observer&&this.observer.unobserve(e),t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e,t){for(var r=this.__handlers,n=0;n<r.length;n++)if(r[n]&&e===r[n].target){r[n].handler&&r[n].handler.forEach((function(r){try{r(e,t)}catch(error){console.error(error)}}));break}}},{key:"__trigger",value:function(e){var t=this;e.map((function(e){var r=e.contentRect;t.__runHandler(e.target,r)}))}}]),e}(),resizeObserver=null;function addObserver(e,t){resizeObserver||(resizeObserver=new ResizeObserver),resizeObserver.addObserver(e,t)}function unObserver(e,t){resizeObserver&&resizeObserver.unObserver(e,t)}var EVENTS$1={RESIZE:"resize",CHANGE:"change",OFF:"off",UPDATE:"update"};function formatUrl(e){var t=[];return e&&"String"===typeOf(e)?t.push({url:e,index:0,start:-1,end:-1}):"Array"===typeOf(e)&&e.forEach((function(e,r){t.push({url:e.url||e.src,index:r,start:e.start||-1,end:e.end||-1})})),t}var IS_MOBILE$1=!1,Subtitle$1=function(e){_inherits$3(r,e);var t=_createSuper$3(r);function r(e){var n;return _classCallCheck$3(this,r),_defineProperty$4(_assertThisInitialized$3(n=t.call(this)),"_onTimeupdate",(function(){if(n._isOpen){var e=n.player.video,t=e.videoWidth,r=e.videoHeight;!n._videoMeta.scale&&t&&r&&n._onResize(n.player.root);var i=n._getPlayerCurrentTime();Math.round(Math.abs(1e3*i-n._ctime))<200||(n._ctime=1e3*i,n.currentText&&n.currentText.list&&("live"===n.config.updateMode?n._liveUpdate(i):n._update(i)))}})),_defineProperty$4(_assertThisInitialized$3(n),"getItemsByIndex",void 0),_defineProperty$4(_assertThisInitialized$3(n),"_onResize",(function(e){var t=_assertThisInitialized$3(n),r=t._videoMeta;if(t.config.domRender){if(e&&e instanceof window.Element||(e=n.player.root),n._iId&&(clearTimeout(n._iId),n._iId=null),!r.scale){if(!n.player.video)return;var i=n.player.video,o=i.videoWidth,a=i.videoHeight;if(!o||!a)return;r.videoWidth=o,r.videoHeight=a,r.scale=parseInt(a/o*100,10)}n.__startResize(e)}})),_defineProperty$4(_assertThisInitialized$3(n),"_onCoreEvents",(function(e){try{switch(e.eventName){case"core.subtitlesegments":n._onSubtitleSegment(e.list||[]);break;case"core.subtitleplaylist":n._onSubtitlePlaylist(e.list||[]);break;case"core.seipayloadtime":n._onCoreSeiintime(e)}}catch(t){console.error(t)}})),_defineProperty$4(_assertThisInitialized$3(n),"destroy",(function(){n.detachPlayer(),n.removeAllListeners(),n.player=null,n.textTrack=null})),IS_MOBILE$1=isMobile(),n.currentText=null,n.currentExtText=null,n.textTrack=[],n._cid=-1,n._gid=-1,n._cids=[],n._iId=null,n._iC=0,n.player=null,n.root=null,n.config={line:"double",bottom:0,mode:"stroke",defaultOpen:!1,baseSizeX:49,baseSizeY:28,minSize:16,minMobileSize:13,fitVideo:!0,offsetBottom:2,fontColor:"#fff",domRender:!0,updateMode:"vod",debugger:!1},n._ctime=0,n._loadingTrack={},Object.keys(n.config).map((function(t){void 0!==e[t]&&null!==e[t]&&(n.config[t]=e[t])})),n._isOpen=n.config.defaultOpen||!1,n._videoMeta={scale:0,videoHeight:0,videoWidth:0,lwidth:0,lheight:0,vWidth:0,vHeight:0,vBottom:0,vLeft:0,marginBottom:0},e.subTitles&&"Array"===typeOf(e.subTitles)?(e.player&&n.attachPlayer(e.player),n.seiTime=0,n.lastSeiTime=0,n._curTexts=[],n.setSubTitles(e.subTitles,n.config.defaultOpen),n):_possibleConstructorReturn$3(n)}return _createClass$4(r,[{key:"version",get:function(){return"1.1.0-alpha.2"}},{key:"setSubTitles",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=this._isOpen||r;n&&this.innerRoot&&this.switchOff(),this.currentText=null,this.textTrack=[],t.forEach((function(t){var r={};Object.keys(t).map((function(e){r[e]=t[e]})),r.url=formatUrl(r.url),r.isDefault&&(e.currentText=r),e.textTrack.push(r)})),this._log("setSubTitles",i),i&&this.switch().catch((function(t){e._log("[switch]",t)})),this.currentText&&this._loadTrack(this.currentText).then((function(t){e.addStyles(t)})),this.emit("reset",{list:this.textTrack,isOpen:i})}},{key:"updateSubTitle",value:function(e){for(var t=this,r=-1,n=0;n<this.textTrack.length;n++)if(checkSubtitle(e,this.textTrack[n])){r=n;break}if(this._log("updateSubTitle",r,e),r>-1){var i=checkSubtitle(this.currentText,this.textTrack[r]);if(this._log("updateSubTitle","_isCurrent",i,"this.isOpen",this.isOpen,this.currentText),!i)return;var o=formatUrl(e.url);this.isOpen?(o.forEach((function(e){t.textTrack[r].url.push(e)})),this._log("updateSubTitle _loadTrackUrls",this.textTrack[r]),this._loadTrackUrls(this.currentText,2)):this.textTrack[r].url=o}}},{key:"addStyles",value:function(e){var t=e.styles,r=e.format;t&&"vtt"===r&&(t.map((function(e){e.key||(e.key="xg-text-track-span")})),addCSS(t,"xg-text-track"))}},{key:"attachPlayer",value:function(e){var t=this;if(this._log("attachPlayer"),e){this.player&&this.detachPlayer();var r=this.config,n=r.fontColor,i=r.mode,o=r.fitVideo,a=r.domRender;this.player=e,a&&(this.root=document.createElement("xg-text-track"),this.root.className="xg-text-track",!this._isOpen&&addClass$1(this.root,"text-track-hide"),!o&&addClass$1(this.root,"text-track-no-fitvideo"),i&&addClass$1(this.root,"text-track-".concat(i)),this.innerRoot=document.createElement("xg-text-track-inner"),this.root.appendChild(this.innerRoot),n&&(this.root.style.color=n),this.currentText&&["language","id","label"].map((function(e){t.root.setAttribute("data-".concat(e),t.currentText[e]||"")})),this.player.root.appendChild(this.root),addObserver(e.root,this._onResize)),this.player.on("destroy",this.destroy),this.player.on("timeupdate",this._onTimeupdate),this.player.on("core_event",this._onCoreEvents),this._isOpen&&this.switch().catch((function(e){t._log("[switch]",e)}))}}},{key:"detachPlayer",value:function(){var e=this.player,t=this.config;e&&(e.off("destroy",this.destroy),e.off("timeupdate",this._onTimeupdate),e.on("core_event",this._onCoreEvents),t.domRender&&(e.root&&(unObserver(e.root,this._onResize),e.root.removeChild(this.root)),this.innerRoot=null,this.root=null),this.player=null)}},{key:"switch",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:"",language:""};return this._log("switch",t),this._loadingTrack=t,new Promise((function(r,n){if(t.id||t.language)if(e.currentText&&checkSubtitle(t,e.currentText))e._loadingTrack={},e._updateCurrent(e.currentText),e.switchOn(),r(_ERROR(0));else{var i=null;e.__removeByTime(e._curTexts,0);for(var o=0;o<e.textTrack.length;o++)if(checkSubtitle(t,e.textTrack[o])){i=e.textTrack[o];break}if(e._log("nextSubtitle",i),i)e._emitPlayerSwitch(e.currentText,i),i.list?(e._loadingTrack={},e._updateCurrent(i),e.switchOn(),r(_ERROR(0))):(e._log("this._loadTrack",i),e._updateCurrent(i),e._loadTrack(i).then((function(t){if(e.addStyles(t),e._loadingTrack.id===i.id||e._loadingTrack.language===t.language)e._loadingTrack={},e._updateCurrent(t),e.switchOn(),r(_ERROR(0));else{var o=_ERROR(6,{message:"check _loadingTrack fail id: ".concat(e._loadingTrack.id," nextSubtitle:").concat(t.id)});n(o)}})).catch((function(e){n(e)})));else{var a=_ERROR(4,new Error("The is no subtitle with id:[{".concat(t.id,"}] or language:[").concat(t.language,"]")));n(a)}}else{if(e.currentText){e._loadingTrack={},e._updateCurrent(e.currentText),e.switchOn();var s=_ERROR(0,{message:"switch default subtitle success"});return void r(s)}var l=_ERROR(5,{message:"no default subtitle"});n(l)}}))}},{key:"switchExt",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:"",language:""};return new Promise((function(r,n){if(t.id||t.language){for(var i=null,o=0;o<e.textTrack.length;o++)if(checkSubtitle(t,e.textTrack[o])){i=e.textTrack[o];break}i&&!checkSubtitle(i,e.currentText)&&e._loadTrack(i).then((function(t){e.currentExtText=t,r(_ERROR(0))}))}else e.currentExtText=null,r(_ERROR(0))}))}},{key:"switchOn",value:function(){this._log("switchOn"),this._isOpen=!0,this.show(),this.emit(EVENTS$1.CHANGE,this.currentText)}},{key:"switchOff",value:function(){this._isOpen=!1,this.hide(),this.emit(EVENTS$1.OFF)}},{key:"isOpen",get:function(){return this._isOpen}},{key:"_log",value:function(){if(this.config.debugger){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=console).log.apply(e,["[xgSubtitle]"].concat(r))}}},{key:"_loadTrack",value:function(e){var t=this;this._log("_loadTrack",e.language,e);var r=new ProxyPromise,n="",i="";if(e.json?(n="json",i=e.json):e.stringContent&&!e.url&&(n="string",i=e.stringContent),i)return parse(i,n).then((function(t){e.format=t.format,e.styles=t.styles,e.list=t.list,r.resolve(e)})).catch((function(e){r.reject(e)})),r;var o=e.url;return 0===o.length?(r.resolve(e),r):(loadSubTitle(o.splice(0,1)[0]).then((function(n){e.format=n.format,e.styles=n.styles,e.list||(e.list=[]),t._pushList(e.list,n.list),o.length>1&&t._loadTrackUrls(e,2),r.resolve(e)})).catch((function(e){r.reject(e)})),r)}},{key:"_emitPlayerSwitch",value:function(e,t){e&&"live"===this.config.updateMode&&(e.list=[],e.url=[]);var r=_objectSpread2$3({lang:t.language},t);this._log("emit subtile_switch ",t,r),this.player&&this.player.emit("switch_subtitle",r)}},{key:"_loadTrackUrls",value:function(e,t,r){var n=this,i=e.url.length,o=i>t?e.url.splice(0,t):e.url.splice(0,i),a=o.length;this._log("_loadTrackUrls",e.language,i,o.length,a),o.forEach((function(t,i){loadSubTitle(_objectSpread2$3(_objectSpread2$3({},t),{},{index:i})).then((function(t){e.format=t.format,e.styles=t.format,e.list||(e.list=[]),n._pushList(e.list,t.list),a--})).catch((function(e){a--})).finally((function(t){0===a&&(r&&r.resolve(e),n._loadTrackUrls(e,2))}))}))}},{key:"_freshUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{url:""},r=-1;e.url.forEach((function(e,n){e.url===t.url&&(r=n)})),r>-1&&e.url.splice(r,1)}},{key:"_pushList",value:function(e,t){var r=t[0].start,n=t[t.length-1].end;if(0===e.length||r>=e[e.length-1].end)t.forEach((function(t){e.push(t)}));else{for(var i=-1,o=0;o<e.length;o++)if(e[o].start>n){i=o;break}i>-1&&t.forEach((function(t,r){e.splice(i+r,0,t)}))}return e}},{key:"_updateCurrent",value:function(e){var t=this;this.currentText=e,this.config.domRender&&this.root&&(["language","id","label"].map((function(e){t.root.setAttribute("data-".concat(e),t.currentText[e]||"")})),this.__remove(this._cids)),this._cids=[],this._gid=-1,this._cid=-1,this._curTexts=[];var r=this._getPlayerCurrentTime();r&&("live"===this.config.updateMode?this._liveUpdate(r):this._update(r))}},{key:"__loadAll",value:function(){var e=this;this.textTrack.forEach((function(t){e._loadTrack(t)}))}},{key:"getDelCid",value:function(e,t){for(var r=[],n=0;n<e.length;n++)t.includes(e[n])||r.push(e[n]);return r}},{key:"getNewCid",value:function(e,t){for(var r=[],n=0;n<t.length;n++)e.includes(t[n])||r.push(t[n]);return r}},{key:"_liveUpdate",value:function(e){var t=this;if(this.currentText&&this.currentText.list&&this.currentText.list.length){var r=[],n=findIndexByTime(e,this.currentText.list,this._gid);if(n>-1&&(r=findCIndexByTime(e,this.currentText.list[n].list,this._cid)),this.__removeByTime(this._curTexts,e),this._log("_liveUpdate",e,n,r,this.currentText.list[0].list[0].start,this.currentText.list[0].list[0].end),r.length>0){var i=getItemsByIndex(this.currentText.list,n,r),o=this._curTexts.length,a=o>0?this._curTexts[o-1].index:0;i.forEach((function(e,r){e.index=r+a,t._curTexts.push(e)})),this.__render(i)}this.emit("update",this._curTexts)}}},{key:"_update",value:function(e){var t=this;if(this.currentText&&this.currentText.list&&this.currentText.list.length){var r=findIndexByTime(e,this.currentText.list,this._gid),n=[];if(r>-1&&(n=findCIndexByTime(e,this.currentText.list[r].list,this._cid)),n.length<1)return this._cids.length>0&&this.config.domRender&&this.__remove(this._cids),void(this._cids=[]);if(this._cids!==n||r!==this._gid){this._gid=r,this._cid=n[0];var i=this.getDelCid(this._cids,n),o=this.getNewCid(this._cids,n);this._cids=n,this.config.domRender&&this.__remove(i);var a=[];o.map((function(e){var n=t.currentText.list[r].list[e];n.index=e,a.push(n)})),this.currentExtText&&o.map((function(e){var n=t.currentText.list[r].list[e];n.index=e,a.push(n)})),this.emit("update",a),this.__render(a,e)}}}},{key:"_getPlayerCurrentTime",value:function(){if(!this.player)return 0;var e=this.player.currentTime;return parseInt(1e3*e+1e3*this.seiTime-1e3*this.lastSeiTime,10)/1e3}},{key:"_onSubtitlePlaylist",value:function(e){this._log("_onSubtitlePlaylist",e);var t=e.map((function(e){return{label:e.name,language:e.lang,id:e.id,isDefault:e.default,url:[],mUrl:e.url}}));this.setSubTitles(t)}},{key:"_onSubtitleSegment",value:function(e){if(this._log("_onSubtitleSegment",e.length,e[0].lang,e[0].sn,e[e.length-1].sn,e[0].start,e[e.length-1].end),e&&0!==e.length){var t={language:e[0].lang,url:e.map((function(e){return{id:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end}}))};checkSubtitle(t,this.currentText)&&this.updateSubTitle(t)}}},{key:"_onCoreSeiintime",value:function(e){try{var t=e.time/1e3;this._log("_onCoreSeiintime sei",t,this.seiTime,this.lastSeiTime),this.seiTime=t,this.lastSeiTime=this.player?this.player.currentTime:0}catch(r){}}},{key:"resize",value:function(e,t){var r,n=this,i=this.config,o=i.baseSizeX,a=i.baseSizeY,s=i.minMobileSize,l=i.minSize,c=i.fitVideo,u=i.offsetBottom,h=this._videoMeta.scale;this._videoMeta.lwidth=e,this._videoMeta.lheight=t;var d=0;t/e*100>=h?(d=parseInt(h*e,10)/100,r=e):(d=t,r=parseInt(t/h*100,10)),this._videoMeta.vWidth=r,this._videoMeta.vHeight=d;var p=0,f=0;h>120?(p=a,f=parseInt(p*d/1080,10)):(p=o,f=parseInt(p*r/1920,10));var g=IS_MOBILE$1?s:l,y={fontSize:f=f<g?g:f>p?p:f},v=parseInt((t-d)/2,10),m=parseInt((e-r)/2,10),_=parseInt(d*u,10)/100;this._videoMeta.vBottom=v,this._videoMeta.vLeft=m,this._videoMeta.marginBottom=_,c&&(y.bottom=v+_,y.left=y.right=m),Object.keys(y).map((function(e){n.root.style[e]="".concat(y[e],"px")})),this.emit(EVENTS$1.RESIZE,{vLeft:m,vBottom:v,marginBottom:_,vWidth:r,vHeight:d,fontSize:f,scale:h})}},{key:"__startResize",value:function(e){var t=this,r=e.getBoundingClientRect(),n=this._videoMeta,i=r.width,o=r.height;if(this._iId&&(clearTimeout(this._iId),this._iId=null),i>0&&o>0&&(i!==n.lwidth||o!==n.lheight))this._iC=0,this.resize(i,o);else{if(this._iC>=5)return void(this._iC=0);this._iC++,this._iId=setTimeout((function(){t.__startResize(e)}),50)}}},{key:"__removeByTime",value:function(e,t){for(var r=[],n=0;n<e.length;n++)(!t||e[n].end<t)&&r.push(n);0!==r.length&&(e.splice(r[0],r.length),this.config.domRender&&this.__remove(r))}},{key:"__remove",value:function(e){var t=this;if(e&&!(e.length<1)){for(var r=this.innerRoot.children,n=[],i=0;i<r.length;i++){var o=Number(r[i].getAttribute("data-index"));e.includes(o)&&n.push(r[i])}n.map((function(e){t.innerRoot.removeChild(e)}))}}},{key:"__render",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._log("__render",t.length,this.config.domRender),t.length>0&&this.config.domRender&&t.map((function(t){var r="text-track-".concat(e.config.line);t.text.map((function(n,i){i>0&&(r+=" text-track-deputy");var o={"data-start":t.start,"data-end":t.end,"data-index":t.index};e.innerRoot.appendChild(createDom("xg-text-track-span",n,o,r))}))}))}},{key:"show",value:function(){this.config.domRender&&removeClass$1(this.root,"text-track-hide")}},{key:"hide",value:function(){this.config.domRender&&(addClass$1(this.root,"text-track-hide"),this.innerRoot.innerHTML="")}},{key:"emit",value:function(e,t){for(var n,i=arguments.length,o=new Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];(n=_get$1(_getPrototypeOf$3(r.prototype),"emit",this)).call.apply(n,[this,e,t].concat(o))}},{key:"on",value:function(e,t){for(var n,i=arguments.length,o=new Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];(n=_get$1(_getPrototypeOf$3(r.prototype),"on",this)).call.apply(n,[this,e,t].concat(o))}},{key:"once",value:function(e,t){for(var n,i=arguments.length,o=new Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];(n=_get$1(_getPrototypeOf$3(r.prototype),"once",this)).call.apply(n,[this,e,t].concat(o))}},{key:"off",value:function(e,t){for(var n,i=arguments.length,o=new Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];(n=_get$1(_getPrototypeOf$3(r.prototype),"off",this)).call.apply(n,[this,e,t].concat(o))}},{key:"offAll",value:function(){_get$1(_getPrototypeOf$3(r.prototype),"removeAllListeners",this).call(this)}},{key:"marginBottom",get:function(){var e=this._videoMeta,t=e.bottom,r=e.marginBottom;return this.config.fitVideo?t+r:r}}]),r}(EventEmitter),DefinitionLinked={origin:{index:1,next:"uhd",prev:null},uhd:{index:2,next:"hd",prev:"origin"},hd:{index:3,next:"sd",prev:"uhd"},sd:{index:4,next:"ld",prev:"hd"},ld:{index:5,next:"ao",prev:"sd"},ao:{index:6,next:null,prev:"ld"}},PLAYER_LANGS=["zh","en","jp","zh-hk"],PLAYER_MODE={NORMAL:0,INNER:1,FULLSCREEN:2},VIDEO_STATUS_TYPE=function(e){return e[e.VALID=10]="VALID",e[e.TRANSCODING=30]="TRANSCODING",e[e.NO_SET_AUDIT=1e3]="NO_SET_AUDIT",e[e.OFFLINE=1002]="OFFLINE",e[e.NO_AUTH=2001]="NO_AUTH",e[e.UN_AUTH=2002]="UN_AUTH",e}(VIDEO_STATUS_TYPE||{}),MIN_EXPIRE_INTERVAL=300,dayjs_min={exports:{}};!function(e,t){e.exports=function(){var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",o="minute",a="hour",s="day",l="week",c="month",u="quarter",h="year",d="date",p="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||t[0])+"]"}},v=function(e,t,r){var n=String(e);return!n||n.length>=t?e:""+Array(t+1-n.length).join(r)+e},m={s:v,z:function(e){var t=-e.utcOffset(),r=Math.abs(t),n=Math.floor(r/60),i=r%60;return(t<=0?"+":"-")+v(n,2,"0")+":"+v(i,2,"0")},m:function e(t,r){if(t.date()<r.date())return-e(r,t);var n=12*(r.year()-t.year())+(r.month()-t.month()),i=t.clone().add(n,c),o=r-i<0,a=t.clone().add(n+(o?-1:1),c);return+(-(n+(r-i)/(o?i-a:a-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:h,w:l,d:s,D:d,h:a,m:o,s:i,ms:n,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},_="en",b={};b[_]=y;var T=function(e){return e instanceof C},E=function e(t,r,n){var i;if(!t)return _;if("string"==typeof t){var o=t.toLowerCase();b[o]&&(i=o),r&&(b[o]=r,i=o);var a=t.split("-");if(!i&&a.length>1)return e(a[0])}else{var s=t.name;b[s]=t,i=s}return!n&&i&&(_=i),i||!n&&_},S=function(e,t){if(T(e))return e.clone();var r="object"==_typeof$4(t)?t:{};return r.date=e,r.args=arguments,new C(r)},$=m;$.l=E,$.i=T,$.w=function(e,t){return S(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var C=function(){function y(e){this.$L=E(e.locale,null,!0),this.parse(e)}var v=y.prototype;return v.parse=function(e){this.$d=function(e){var t=e.date,r=e.utc;if(null===t)return new Date(NaN);if($.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var n=t.match(f);if(n){var i=n[2]-1||0,o=(n[7]||"0").substring(0,3);return r?new Date(Date.UTC(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)):new Date(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)}}return new Date(t)}(e),this.$x=e.x||{},this.init()},v.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},v.$utils=function(){return $},v.isValid=function(){return!(this.$d.toString()===p)},v.isSame=function(e,t){var r=S(e);return this.startOf(t)<=r&&r<=this.endOf(t)},v.isAfter=function(e,t){return S(e)<this.startOf(t)},v.isBefore=function(e,t){return this.endOf(t)<S(e)},v.$g=function(e,t,r){return $.u(e)?this[t]:this.set(r,e)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(e,t){var r=this,n=!!$.u(t)||t,u=$.p(e),p=function(e,t){var i=$.w(r.$u?Date.UTC(r.$y,t,e):new Date(r.$y,t,e),r);return n?i:i.endOf(s)},f=function(e,t){return $.w(r.toDate()[e].apply(r.toDate("s"),(n?[0,0,0,0]:[23,59,59,999]).slice(t)),r)},g=this.$W,y=this.$M,v=this.$D,m="set"+(this.$u?"UTC":"");switch(u){case h:return n?p(1,0):p(31,11);case c:return n?p(1,y):p(0,y+1);case l:var _=this.$locale().weekStart||0,b=(g<_?g+7:g)-_;return p(n?v-b:v+(6-b),y);case s:case d:return f(m+"Hours",0);case a:return f(m+"Minutes",1);case o:return f(m+"Seconds",2);case i:return f(m+"Milliseconds",3);default:return this.clone()}},v.endOf=function(e){return this.startOf(e,!1)},v.$set=function(e,t){var r,l=$.p(e),u="set"+(this.$u?"UTC":""),p=(r={},r[s]=u+"Date",r[d]=u+"Date",r[c]=u+"Month",r[h]=u+"FullYear",r[a]=u+"Hours",r[o]=u+"Minutes",r[i]=u+"Seconds",r[n]=u+"Milliseconds",r)[l],f=l===s?this.$D+(t-this.$W):t;if(l===c||l===h){var g=this.clone().set(d,1);g.$d[p](f),g.init(),this.$d=g.set(d,Math.min(this.$D,g.daysInMonth())).$d}else p&&this.$d[p](f);return this.init(),this},v.set=function(e,t){return this.clone().$set(e,t)},v.get=function(e){return this[$.p(e)]()},v.add=function(n,u){var d,p=this;n=Number(n);var f=$.p(u),g=function(e){var t=S(p);return $.w(t.date(t.date()+Math.round(e*n)),p)};if(f===c)return this.set(c,this.$M+n);if(f===h)return this.set(h,this.$y+n);if(f===s)return g(1);if(f===l)return g(7);var y=(d={},d[o]=t,d[a]=r,d[i]=e,d)[f]||1,v=this.$d.getTime()+n*y;return $.w(v,this)},v.subtract=function(e,t){return this.add(-1*e,t)},v.format=function(e){var t=this,r=this.$locale();if(!this.isValid())return r.invalidDate||p;var n=e||"YYYY-MM-DDTHH:mm:ssZ",i=$.z(this),o=this.$H,a=this.$m,s=this.$M,l=r.weekdays,c=r.months,u=function(e,r,i,o){return e&&(e[r]||e(t,n))||i[r].slice(0,o)},h=function(e){return $.s(o%12||12,e,"0")},d=r.meridiem||function(e,t,r){var n=e<12?"AM":"PM";return r?n.toLowerCase():n},f={YY:String(this.$y).slice(-2),YYYY:this.$y,M:s+1,MM:$.s(s+1,2,"0"),MMM:u(r.monthsShort,s,c,3),MMMM:u(c,s),D:this.$D,DD:$.s(this.$D,2,"0"),d:String(this.$W),dd:u(r.weekdaysMin,this.$W,l,2),ddd:u(r.weekdaysShort,this.$W,l,3),dddd:l[this.$W],H:String(o),HH:$.s(o,2,"0"),h:h(1),hh:h(2),a:d(o,a,!0),A:d(o,a,!1),m:String(a),mm:$.s(a,2,"0"),s:String(this.$s),ss:$.s(this.$s,2,"0"),SSS:$.s(this.$ms,3,"0"),Z:i};return n.replace(g,(function(e,t){return t||f[e]||i.replace(":","")}))},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(n,d,p){var f,g=$.p(d),y=S(n),v=(y.utcOffset()-this.utcOffset())*t,m=this-y,_=$.m(this,y);return _=(f={},f[h]=_/12,f[c]=_,f[u]=_/3,f[l]=(m-v)/6048e5,f[s]=(m-v)/864e5,f[a]=m/r,f[o]=m/t,f[i]=m/e,f)[g]||m,p?_:$.a(_)},v.daysInMonth=function(){return this.endOf(c).$D},v.$locale=function(){return b[this.$L]},v.locale=function(e,t){if(!e)return this.$L;var r=this.clone(),n=E(e,t,!0);return n&&(r.$L=n),r},v.clone=function(){return $.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},y}(),w=C.prototype;return S.prototype=w,[["$ms",n],["$s",i],["$m",o],["$H",a],["$W",s],["$M",c],["$y",h],["$D",d]].forEach((function(e){w[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),S.extend=function(e,t){return e.$i||(e(t,C,S),e.$i=!0),S},S.locale=E,S.isDayjs=T,S.unix=function(e){return S(1e3*e)},S.en=b[_],S.Ls=b,S.p={},S}()}(dayjs_min);var dayjs=dayjs_min.exports,utc$1={exports:{}};!function(e,t){var r,n,i;e.exports=(r="minute",n=/[+-]\d\d(?::?\d\d)?/g,i=/([+-]|\d\d)/g,function(e,t,o){var a=t.prototype;o.utc=function(e){return new t({date:e,utc:!0,args:arguments})},a.utc=function(e){var t=o(this.toDate(),{locale:this.$L,utc:!0});return e?t.add(this.utcOffset(),r):t},a.local=function(){return o(this.toDate(),{locale:this.$L,utc:!1})};var s=a.parse;a.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),s.call(this,e)};var l=a.init;a.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else l.call(this)};var c=a.utcOffset;a.utcOffset=function(e,t){var o=this.$utils().u;if(o(e))return this.$u?0:o(this.$offset)?c.call(this):this.$offset;if("string"==typeof e&&null===(e=function(e){void 0===e&&(e="");var t=e.match(n);if(!t)return null;var r=(""+t[0]).match(i)||["-",0,0],o=r[0],a=60*+r[1]+ +r[2];return 0===a?0:"+"===o?a:-a}(e)))return this;var a=Math.abs(e)<=16?60*e:e,s=this;if(t)return s.$offset=a,s.$u=0===e,s;if(0!==e){var l=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(s=this.local().add(a+l,r)).$offset=a,s.$x.$localOffset=l}else s=this.utc();return s};var u=a.format;a.format=function(e){var t=e||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return u.call(this,t)},a.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},a.isUTC=function(){return!!this.$u},a.toISOString=function(){return this.toDate().toISOString()},a.toString=function(){return this.toDate().toUTCString()};var h=a.toDate;a.toDate=function(e){return"s"===e&&this.$offset?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():h.call(this)};var d=a.diff;a.diff=function(e,t,r){if(e&&this.$u===e.$u)return d.call(this,e,t,r);var n=this.local(),i=o(e).local();return d.call(n,i,t,r)}})}(utc$1);var utc=utc$1.exports,dist=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==_typeof$4(e)&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=22)}([function(e,t,r){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,r){var n=r(12)("wks"),i=r(13),o=r(0).Symbol,a="function"==typeof o;(e.exports=function(e){return n[e]||(n[e]=a&&o[e]||(a?o:i)("Symbol."+e))}).store=n},function(e,t,r){var n=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=n)},function(e,t,r){var n=r(4);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},function(e,t,r){var n="function"==typeof Symbol&&"symbol"==_typeof$4(Symbol.iterator)?function(e){return _typeof$4(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$4(e)};e.exports=function(e){return"object"===(void 0===e?"undefined":n(e))?null!==e:"function"==typeof e}},function(e,t,r){var n=r(6);e.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,r){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,r){e.exports=!r(15)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t,r){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,r){var n=r(3),i=r(26),o=r(27),a=Object.defineProperty;t.f=r(7)?Object.defineProperty:function(e,t,r){if(n(e),t=o(t,!0),n(r),i)try{return a(e,t,r)}catch(s){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},function(e,t,r){e.exports=!1},function(e,t,r){var n=r(8),i=r(1)("toStringTag"),o="Arguments"==n(function(){return arguments}());e.exports=function(e){var t,r,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(r){}}(t=Object(e),i))?r:o?n(t):"Object"==(a=n(t))&&"function"==typeof t.callee?"Arguments":a}},function(e,t,r){var n=r(2),i=r(0),o=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:n.version,mode:r(10)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t,r){var n=0,i=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+i).toString(36))}},function(e,t,r){var n=r(9),i=r(28);e.exports=r(7)?function(e,t,r){return n.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},function(e,t,r){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t,r){var n=r(4),i=r(0).document,o=n(i)&&n(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t,r){var n=r(0),i=r(14),o=r(18),a=r(13)("src"),s=r(29),l=(""+s).split("toString");r(2).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,r,s){var c="function"==typeof r;c&&(o(r,"name")||i(r,"name",t)),e[t]!==r&&(c&&(o(r,a)||i(r,a,e[t]?""+e[t]:l.join(String(t)))),e===n?e[t]=r:s?e[t]?e[t]=r:i(e,t,r):(delete e[t],i(e,t,r)))})(Function.prototype,"toString",(function(){return"function"==typeof this&&this[a]||s.call(this)}))},function(e,t,r){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,r){e.exports={}},function(e,t,r){var n,i,o,a=r(5),s=r(38),l=r(39),c=r(16),u=r(0),h=u.process,d=u.setImmediate,p=u.clearImmediate,f=u.MessageChannel,g=u.Dispatch,y=0,v={},m=function(){var e=+this;if(v.hasOwnProperty(e)){var t=v[e];delete v[e],t()}},_=function(e){m.call(e.data)};d&&p||(d=function(e){for(var t=[],r=1;arguments.length>r;)t.push(arguments[r++]);return v[++y]=function(){s("function"==typeof e?e:Function(e),t)},n(y),y},p=function(e){delete v[e]},"process"==r(8)(h)?n=function(e){h.nextTick(a(m,e,1))}:g&&g.now?n=function(e){g.now(a(m,e,1))}:f?(o=(i=new f).port2,i.port1.onmessage=_,n=a(o.postMessage,o,1)):u.addEventListener&&"function"==typeof postMessage&&!u.importScripts?(n=function(e){u.postMessage(e+"","*")},u.addEventListener("message",_,!1)):n="onreadystatechange"in c("script")?function(e){l.appendChild(c("script")).onreadystatechange=function(){l.removeChild(this),m.call(e)}}:function(e){setTimeout(a(m,e,1),0)}),e.exports={set:d,clear:p}},function(e,t,r){var n=r(6);function i(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=n(t),this.reject=n(r)}e.exports.f=function(e){return new i(e)}},function(e,t,r){e.exports=r(23)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),r(24);var n,i=(n=r(48))&&n.__esModule?n:{default:n};t.default={url:i.default},e.exports=t.default},function(e,t,r){var n,i,o,a,s=r(10),l=r(0),c=r(5),u=r(11),h=r(25),d=r(4),p=r(6),f=r(30),g=r(31),y=r(37),v=r(20).set,m=r(40)(),_=r(21),b=r(41),T=r(42),E=r(43),S=l.TypeError,$=l.process,C=$&&$.versions,w=C&&C.v8||"",P=l.Promise,k="process"==u($),O=function(){},I=i=_.f,A=!!function(){try{var e=P.resolve(1),t=(e.constructor={})[r(1)("species")]=function(e){e(O,O)};return(k||"function"==typeof PromiseRejectionEvent)&&e.then(O)instanceof t&&0!==w.indexOf("6.6")&&-1===T.indexOf("Chrome/66")}catch(n){}}(),R=function(e){var t;return!(!d(e)||"function"!=typeof(t=e.then))&&t},x=function(e,t){if(!e._n){e._n=!0;var r=e._c;m((function(){for(var n=e._v,i=1==e._s,o=0,a=function(t){var r,o,a,s=i?t.ok:t.fail,l=t.resolve,c=t.reject,u=t.domain;try{s?(i||(2==e._h&&M(e),e._h=1),!0===s?r=n:(u&&u.enter(),r=s(n),u&&(u.exit(),a=!0)),r===t.promise?c(S("Promise-chain cycle")):(o=R(r))?o.call(r,l,c):l(r)):c(n)}catch(h){u&&!a&&u.exit(),c(h)}};r.length>o;)a(r[o++]);e._c=[],e._n=!1,t&&!e._h&&D(e)}))}},D=function(e){v.call(l,(function(){var t,r,n,i=e._v,o=L(e);if(o&&(t=b((function(){k?$.emit("unhandledRejection",i,e):(r=l.onunhandledrejection)?r({promise:e,reason:i}):(n=l.console)&&n.error&&n.error("Unhandled promise rejection",i)})),e._h=k||L(e)?2:1),e._a=void 0,o&&t.e)throw t.v}))},L=function(e){return 1!==e._h&&0===(e._a||e._c).length},M=function(e){v.call(l,(function(){var t;k?$.emit("rejectionHandled",e):(t=l.onrejectionhandled)&&t({promise:e,reason:e._v})}))},N=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),x(t,!0))},U=function e(t){var r,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw S("Promise can't be resolved itself");(r=R(t))?m((function(){var i={_w:n,_d:!1};try{r.call(t,c(e,i,1),c(N,i,1))}catch(o){N.call(i,o)}})):(n._v=t,n._s=1,x(n,!1))}catch(i){N.call({_w:n,_d:!1},i)}}};A||(P=function(e){f(this,P,"Promise","_h"),p(e),n.call(this);try{e(c(U,this,1),c(N,this,1))}catch(t){N.call(this,t)}},(n=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=r(44)(P.prototype,{then:function(e,t){var r=I(y(this,P));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=k?$.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&x(this,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),o=function(){var e=new n;this.promise=e,this.resolve=c(U,e,1),this.reject=c(N,e,1)},_.f=I=function(e){return e===P||e===a?new o(e):i(e)}),h(h.G+h.W+h.F*!A,{Promise:P}),r(45)(P,"Promise"),r(46)("Promise"),a=r(2).Promise,h(h.S+h.F*!A,"Promise",{reject:function(e){var t=I(this);return(0,t.reject)(e),t.promise}}),h(h.S+h.F*(s||!A),"Promise",{resolve:function(e){return E(s&&this===a?P:this,e)}}),h(h.S+h.F*!(A&&r(47)((function(e){P.all(e).catch(O)}))),"Promise",{all:function(e){var t=this,r=I(t),n=r.resolve,i=r.reject,o=b((function(){var r=[],o=0,a=1;g(e,!1,(function(e){var s=o++,l=!1;r.push(void 0),a++,t.resolve(e).then((function(e){l||(l=!0,r[s]=e,--a||n(r))}),i)})),--a||n(r)}));return o.e&&i(o.v),r.promise},race:function(e){var t=this,r=I(t),n=r.reject,i=b((function(){g(e,!1,(function(e){t.resolve(e).then(r.resolve,n)}))}));return i.e&&n(i.v),r.promise}})},function(e,t,r){var n=r(0),i=r(2),o=r(14),a=r(17),s=r(5),l=function e(t,r,l){var c,u,h,d,p=t&e.F,f=t&e.G,g=t&e.P,y=t&e.B,v=f?n:t&e.S?n[r]||(n[r]={}):(n[r]||{}).prototype,m=f?i:i[r]||(i[r]={}),_=m.prototype||(m.prototype={});for(c in f&&(l=r),l)h=((u=!p&&v&&void 0!==v[c])?v:l)[c],d=y&&u?s(h,n):g&&"function"==typeof h?s(Function.call,h):h,v&&a(v,c,h,t&e.U),m[c]!=h&&o(m,c,d),g&&_[c]!=h&&(_[c]=h)};n.core=i,l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t,r){e.exports=!r(7)&&!r(15)((function(){return 7!=Object.defineProperty(r(16)("div"),"a",{get:function(){return 7}}).a}))},function(e,t,r){var n=r(4);e.exports=function(e,t){if(!n(e))return e;var r,i;if(t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;if("function"==typeof(r=e.valueOf)&&!n(i=r.call(e)))return i;if(!t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t,r){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,r){e.exports=r(12)("native-function-to-string",Function.toString)},function(e,t,r){e.exports=function(e,t,r,n){if(!(e instanceof t)||void 0!==n&&n in e)throw TypeError(r+": incorrect invocation!");return e}},function(e,t,r){var n=r(5),i=r(32),o=r(33),a=r(3),s=r(34),l=r(36),c={},u={},h=e.exports=function(e,t,r,h,d){var p,f,g,y,v=d?function(){return e}:l(e),m=n(r,h,t?2:1),_=0;if("function"!=typeof v)throw TypeError(e+" is not iterable!");if(o(v)){for(p=s(e.length);p>_;_++)if((y=t?m(a(f=e[_])[0],f[1]):m(e[_]))===c||y===u)return y}else for(g=v.call(e);!(f=g.next()).done;)if((y=i(g,m,f.value,t))===c||y===u)return y};h.BREAK=c,h.RETURN=u},function(e,t,r){var n=r(3);e.exports=function(e,t,r,i){try{return i?t(n(r)[0],r[1]):t(r)}catch(a){var o=e.return;throw void 0!==o&&n(o.call(e)),a}}},function(e,t,r){var n=r(19),i=r(1)("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(n.Array===e||o[i]===e)}},function(e,t,r){var n=r(35),i=Math.min;e.exports=function(e){return e>0?i(n(e),9007199254740991):0}},function(e,t,r){var n=Math.ceil,i=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?i:n)(e)}},function(e,t,r){var n=r(11),i=r(1)("iterator"),o=r(19);e.exports=r(2).getIteratorMethod=function(e){if(null!=e)return e[i]||e["@@iterator"]||o[n(e)]}},function(e,t,r){var n=r(3),i=r(6),o=r(1)("species");e.exports=function(e,t){var r,a=n(e).constructor;return void 0===a||null==(r=n(a)[o])?t:i(r)}},function(e,t,r){e.exports=function(e,t,r){var n=void 0===r;switch(t.length){case 0:return n?e():e.call(r);case 1:return n?e(t[0]):e.call(r,t[0]);case 2:return n?e(t[0],t[1]):e.call(r,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(r,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(r,t[0],t[1],t[2],t[3])}return e.apply(r,t)}},function(e,t,r){var n=r(0).document;e.exports=n&&n.documentElement},function(e,t,r){var n=r(0),i=r(20).set,o=n.MutationObserver||n.WebKitMutationObserver,a=n.process,s=n.Promise,l="process"==r(8)(a);e.exports=function(){var e,t,r,c=function(){var n,i;for(l&&(n=a.domain)&&n.exit();e;){i=e.fn,e=e.next;try{i()}catch(o){throw e?r():t=void 0,o}}t=void 0,n&&n.enter()};if(l)r=function(){a.nextTick(c)};else if(!o||n.navigator&&n.navigator.standalone)if(s&&s.resolve){var u=s.resolve(void 0);r=function(){u.then(c)}}else r=function(){i.call(n,c)};else{var h=!0,d=document.createTextNode("");new o(c).observe(d,{characterData:!0}),r=function(){d.data=h=!h}}return function(n){var i={fn:n,next:void 0};t&&(t.next=i),e||(e=i,r()),t=i}}},function(e,t,r){e.exports=function(e){try{return{e:!1,v:e()}}catch(t){return{e:!0,v:t}}}},function(e,t,r){var n=r(0).navigator;e.exports=n&&n.userAgent||""},function(e,t,r){var n=r(3),i=r(4),o=r(21);e.exports=function(e,t){if(n(e),i(t)&&t.constructor===e)return t;var r=o.f(e);return(0,r.resolve)(t),r.promise}},function(e,t,r){var n=r(17);e.exports=function(e,t,r){for(var i in t)n(e,i,t[i],r);return e}},function(e,t,r){var n=r(9).f,i=r(18),o=r(1)("toStringTag");e.exports=function(e,t,r){e&&!i(e=r?e:e.prototype,o)&&n(e,o,{configurable:!0,value:t})}},function(e,t,r){var n=r(0),i=r(9),o=r(7),a=r(1)("species");e.exports=function(e){var t=n[e];o&&t&&!t[a]&&i.f(t,a,{configurable:!0,get:function(){return this}})}},function(e,t,r){var n=r(1)("iterator"),i=!1;try{var o=[7][n]();o.return=function(){i=!0},Array.from(o,(function(){throw 2}))}catch(a){}e.exports=function(e,t){if(!t&&!i)return!1;var r=!1;try{var o=[7],a=o[n]();a.next=function(){return{done:r=!0}},o[n]=function(){return a},e(o)}catch(s){}return r}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==_typeof$4(Symbol.iterator)?function(e){return _typeof$4(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$4(e)};t.default=function(e,t,r){if(e&&t){var i=void 0;try{i=(0,o.getUri)(e,t,r)}catch(s){return Promise.reject(s.message)}return new a.default({type:"json",method:"GET",url:i}).then((function(e){return e&&e.response?"string"==typeof e.response?JSON.parse(e.response).Result:"object"===n(e.response)?e.response.Result:e.response:e}))}return Promise.reject("vid, host and token can't be empty")};var i,o=r(49),a=(i=r(51))&&i.__esModule?i:{default:i};e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getUri=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{e=JSON.parse((0,n.decode)(e))}catch(s){throw new Error("base64 decode error: "+s.message)}var i=[];for(var o in r)i.push(o+"="+r[o]);var a=(/^http/.test(t)?t:"//"+t)+"?"+e.GetPlayInfoToken+"&ssl=true";return i.length>0&&(a+="&"+i.join("&")),a};var n=r(50)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.decode=function(e){var t,r,n,i,o,a,s,l=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1];for(a=e.length,o=0,s="";o<a;){do{t=l[255&e.charCodeAt(o++)]}while(o<a&&-1===t);if(-1===t)break;do{r=l[255&e.charCodeAt(o++)]}while(o<a&&-1===r);if(-1===r)break;s+=String.fromCharCode(t<<2|(48&r)>>4);do{if(61==(n=255&e.charCodeAt(o++)))return s;n=l[n]}while(o<a&&-1===n);if(-1===n)break;s+=String.fromCharCode((15&r)<<4|(60&n)>>2);do{if(61==(i=255&e.charCodeAt(o++)))return s;i=l[i]}while(o<a&&-1===i);if(-1===i)break;s+=String.fromCharCode((3&n)<<6|i)}return s}},function(e,t,r){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.url,i=t.method,o=void 0===i?"GET":i,a=(t.type,t.data),s=void 0===a?{}:a,l=t.headers,c=void 0===l?{}:l;return n(this,e),new Promise((function(e,t){var n=new window.XMLHttpRequest,i=o.toUpperCase(),a=[];for(var l in s)a.push(l+"="+s[l]);if("GET"!==i)throw new Error("xhr "+i+" is not supported");for(var u in n.open(i,""+r,!0),n.responseType="",c)n.setRequestHeader(u,""+c[u]);n.send(),n.onload=function(){200===n.status||206===n.status?e(n):t(n)},n.onerror=function(){t(n)},n.ontimeout=function(){t(n)}}))},e.exports=t.default}]);dayjs.extend(utc);var VideoFileTypes=function(e){return e.VIDEO="video",e.EVIDEO="evideo",e}(VideoFileTypes||{}),safeJSONDecode=function(e){try{return JSON.parse(e)}catch(t){return console.warn("[utils/json] decode fail: ".concat(e),t),null}},parseToken=function(e){if(e){var t={},r=isBase64(e)?window.atob(e):e,n=safeJSONDecode(r);if(n&&"string"==typeof n.GetPlayInfoToken)n.GetPlayInfoToken.split("&").map((function(e){var r=e.split("=");r[0]&&r[1]&&(t[r[0]]=r[1])}));return t}},getQueryParams=function(e){var t={};return e.split("&").map((function(e){var r=e.split("=");r[0]&&r[1]&&(t[r[0]]=r[1])})),t},isEncryptPlay=function(e){var t,r;if(null==e||!e.playAuthToken)return!1;var n=parseToken(null==e?void 0:e.playAuthToken),i=null!==(t=null==n||null===(r=n.FileType)||void 0===r?void 0:r.toLowerCase())&&void 0!==t?t:"video";return!!n&&("evideo"===i||"eaudio"===i)},getFormat=function(e){var t,r,n;if(null==e||!e.playAuthToken)return"";var i=parseToken(null==e?void 0:e.playAuthToken),o=null!==(t=null==i||null===(r=i.FileType)||void 0===r?void 0:r.toLowerCase())&&void 0!==t?t:"video",a=null==i||null===(n=i.Format)||void 0===n?void 0:n.toLowerCase();return a||(Object.values(VideoFileTypes).includes(o)?"mp4":"m4a")},isTokenExpired=function(e){if(!e["X-Expires"]||!e["X-Date"])return!1;var t=parseInt(e["X-Expires"]);if(isNaN(t))return!1;var r=e["X-Date"].replace(/T/g," ").replace(/Z/g,""),n=dayjs.utc(r,"YYYYMMDD hhmmss");return!!n.isValid()&&n.add(t,"seconds").isBefore(dayjs())};function getPlayInfoByAuthToken(e){var t=e.playAuthToken,r=e.playDomain,n=e.reqParams,i=void 0===n?{}:n,o=e.definitionMap,a=e.needThumbs,s=void 0!==a&&a,l=e.needBarrageMask,c=void 0!==l&&l;if(t){var u=_objectSpread2$5(_objectSpread2$5({},i),{},{NeedThumbs:s?1:0,NeedBarrageMask:c?1:0});return new Promise((function(e,n){dist.url(t,r,u).then((function(t){var r=t.Data||t,n=r.Status,i=r.PlayInfoList,a=void 0===i?[]:i,s=r.PosterUrl,l=r.Vid,c=r.Duration,u=r.BarrageMaskUrl,h=r.ThumbInfoList,d=void 0===h?[]:h;if(n===VIDEO_STATUS_TYPE.VALID&&a.length){var p=a.map((function(e){return _objectSpread2$5(_objectSpread2$5({vid:l,lineId:1,lineName:"1",url:e.MainPlayUrl,streamType:e.Format,backUrlList:[e.BackupPlayUrl],bitrate:e.Bitrate,size:e.Size,kid:e.PlayAuthId,vwidth:e.Width,vheight:e.Height,codec:e.Codec},e),getDefinitionInfo(e,o))})).sort((function(e,t){return t.Bitrate&&e.Bitrate?t.Bitrate-e.Bitrate:-1}));e({playList:p,poster:s,vid:l,duration:c,dashOpts:t.Data?t:{Data:t},thumbs:d,barrageMaskUrl:u})}else e({playList:[],poster:s,vid:l,duration:c,dashOpts:t.Data?t:{Data:t},thumbs:d,barrageMaskUrl:u}),console.error("HAS NO VIDEO INFORMATION CORRECTLY, PLEASE CHECK THE TOKEN.")})).catch((function(e){console.log("err",e),n(e)}))}))}return Promise.resolve()}function retryByError(e,t,r,n){return _retryByError.apply(this,arguments)}function _retryByError(){return(_retryByError=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(t,r,n,i){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t();case 3:case 15:return e.abrupt("return",e.sent);case 6:if(e.prev=6,e.t0=e.catch(0),!--r||!n(e.t0)){e.next=12;break}return e.abrupt("return",retryByError(t,r,n,i));case 12:if(!i||"function"!=typeof i){e.next=16;break}return e.next=15,i(e.t0);case 16:throw e.t0;case 17:case"end":return e.stop()}}),e,null,[[0,6]])})))).apply(this,arguments)}var formatDemotePriority=function(e){return(null==e?void 0:e.length)&&e.reduce((function(t,r,n){return t[r]={next:n+1>=e.length?null:e[n+1],pre:0===n?null:e[n-1]},t}),{})},getDefinitionInfo=function(e,t){if(!e||!e.Definition&&!e.Quality)return{definition:"240P"};var r=e.Definition||e.Quality;if(t){var n=t[r];return n?"string"==typeof n?{definition:n}:_objectSpread2$5({},n||{}):{definition:r}}return{definition:r}},IntervalTimer=function(){function e(){_classCallCheck$5(this,e),this.timeID=null,this.func=null}return _createClass$6(e,[{key:"repeat",value:function(e,t){this.timeID=1,this.repeatInterval(e,t)}},{key:"repeatInterval",value:function(e,t){var r=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(),r.repeatInterval(e,t)}),t)))}},{key:"clear",value:function(){clearTimeout(this.timeID),this.timeID=null}}]),e}(),XHR=_createClass$6((function e(t){var r=t.url,n=t.method,i=void 0===n?"GET":n,o=t.type,a=t.timeout,s=void 0===a?1e4:a,l=t.body,c=t.xhrSetup,u=t.cache,h=void 0===u||u;return _classCallCheck$5(this,e),new Promise((function(e,t){var n=new window.XMLHttpRequest,a=i.toUpperCase();if("GET"!==a&&"POST"!==a&&"HEAD"!==a)throw new Error("XHR ".concat(a," is not allowed"));if(o&&(n.responseType=o),s&&(n.timeout=s),n.onload=function(){200===n.status||206===n.status?e(n):t(n)},n.onerror=function(){t(n)},n.ontimeout=function(){t(n)},n.onabort=function(){t(n)},"GET"===a&&!h){var u=/\?/gi.test(r)?"&":"?";r+="".concat(u,"_=").concat((new Date).getTime())}if(n.open(a,"".concat(r),!0),c)try{c(n,r)}catch(d){console.error("xhr setup failure: ".concat(d.stack||d.message))}switch(a){case"POST":"text"===o&&n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.send(l);break;case"GET":case"HEAD":n.send()}}))})),isHls=function(e){return e&&0<e.toLowerCase().indexOf(".m3u8")},isMp4=function(e){return e&&0<e.toLowerCase().indexOf(".mp4")},isFlv=function(e){return e&&0<e.toLowerCase().indexOf(".flv")},isRtm=function(e){return e&&0<e.toLowerCase().indexOf(".sdp")},isDash=function(e){return e&&0<e.toLowerCase().indexOf(".mpd")},getStreamType=function(e){return isHls(e)?"hls":isFlv(e)?"flv":isRtm(e)?"rtm":isMp4(e)?"mp4":isDash(e)?"dash":"mp4"},retPromise$1=function(e){return e&&e.then?e:new Promise((function(e){e(null)}))},addUrlParam=function(e,t){if(!t)return e;var r=Object.entries(t).map((function(e){var t=_slicedToArray(e,2),r=t[0],n=t[1];return"".concat(r,"=").concat(null!=n?n:"")})).join("&");return e+=(-1===e.indexOf("?")?"?":"&")+r},getPluginConfig=function(e,t){var r;if(t&&e)return Object.keys(e).map((function(n){n.toLowerCase()===t.toLowerCase()&&(r=e[n])})),r},handleIcons=function(e){var t={};return e&&Object.entries(e).forEach((function(e){var r=_slicedToArray(e,2),n=r[0],i=r[1];i&&"string"!=typeof i&&(t[n]=i)})),t},isHevcSupported=function(){var e=window.navigator.userAgent.toLocaleLowerCase(),t=/(iphone)/.test(e)||/(ipad)/.test(e),r=/(quark)/.test(e);return!!(t&&!r||window.MediaSource&&window.MediaSource.isTypeSupported&&(window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||window.MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"')))};function isBase64(e){return/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/.test(e)}function getLang(){var e=(document.documentElement.getAttribute("lang")||navigator.language||"zh-cn").toLocaleLowerCase();return"zh-cn"===e&&(e="zh"),e}function exeFunTimeoutWarn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=setTimeout((function(){r&&console.warn(r),n=null}),t);return e.then?e.then((function(){return clearTimeout(n)})):(clearTimeout(n),n=null),e}function isUrl(e){return!!e&&(e.indexOf&&/^(?:http|data:|\/)/.test(e))}function retry(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return new Promise((function(n,i){e().then(n).catch((function(o){setTimeout((function(){1!==t?retry(e,t-1,r).then(n,i):i(o)}),r)}))}))}function isMSESupport(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if(!window.MediaSource)return!1;try{return window.MediaSource.isTypeSupported(e)}catch(error){return console.error("mse error",error),!1}}var matchHtmlRegExp=/["'&<>]/;function escapeHtml(e){var t,r=""+e,n=matchHtmlRegExp.exec(r);if(!n)return r;var i,o="",a=0;for(i=n.index;i<r.length;i++){switch(r.charCodeAt(i)){case 34:t="&quot;";break;case 38:t="&amp;";break;case 39:t="&#x27;";break;case 60:t="&lt;";break;case 62:t="&gt;";break;default:continue}a!==i&&(o+=r.substring(a,i)),a=i+1,o+=t}return a!==i?o+r.substring(a,i):o}var PLATFORM_API={playDomain:"//vod.byteplusapi.com"},_excluded$2=["options","type","isLive","id","root","plugins","defaultConfig","languages","url","codec","playList","streamType","isMobile","useSoftDecoding","enableH265Degrade","checkExpireInterval","expireDetectType","onMediaExpired","onTokenExpired","platform","unionId","isMusic"],PlayerData=function(){function e(t){_classCallCheck$5(this,e),this.id="",this.type="",this.isLive=!1,this.options=null,this.isMobile=!1,this.playList=[],this.plugins=[],this.openSoftDecoding=!1,this.current={lineId:0,language:"",definition:"",streamType:"",codec:void 0};var r=t.options,n=t.type,i=t.isLive,o=t.id,a=t.root,s=t.plugins,l=void 0===s?[]:s,c=t.defaultConfig,u=t.languages;t.url;var h=t.codec;t.playList,t.streamType;var d=t.isMobile,p=void 0!==d&&d,f=t.useSoftDecoding,g=void 0!==f&&f,y=t.enableH265Degrade,v=void 0!==y&&y,m=t.checkExpireInterval,_=void 0===m?400:m,b=t.expireDetectType,T=void 0===b?[]:b,E=t.onMediaExpired,S=t.onTokenExpired,$=t.platform,C=t.unionId,w=t.isMusic,P=void 0!==w&&w,k=_objectWithoutProperties$1(t,_excluded$2);this.configs=t,this.options=Object.assign({},r,k),this.options.poster="string"==typeof this.options.poster?escapeHtml(this.options.poster):void 0,this.options.icons=handleIcons(this.options.icons),this.id=o,this.root=a,this.type=n,this.isLive=!!(null!=i?i:"live"===n),this.defaultConfig=c,this.languageData=this.initI18nData(u),this.isMobile=p||"mobile"===sniffer$1.device,this.openSoftDecoding=g,this.enableH265Degrade=v,this.codec=h,this.checkExpireInterval=_,this.expireDetectType=T,this.onMediaExpired=E,this.onTokenExpired=S,this.initPlayData(t),this.current=MyProxy$1.observe(this.current),this.playList=MyProxy$1.observe(this.playList),this.plugins=_toConsumableArray$1(l),this.isMusic=P,this.platform=$,this.unionId=C,this.apiMap=PLATFORM_API}return _createClass$6(e,[{key:"initPlayData",value:function(e){var t=this.initPlaylistAndGetCurrent(e);this.initCurrent(t)}},{key:"initPlaylistAndGetCurrent",value:function(e){var t,r=e.url,n=e.playList,i=e.streamType,o=void 0===i?"":i,a=null;if(n&&(this.playList=_toConsumableArray$1(n)),r)if(0===this.playList.length)this.playList=[_objectSpread2$5(_objectSpread2$5({},this.current),{},{url:r,streamType:o})];else{var s=this.getUrlList({url:r});s.length>0?a=s[0]:console.log("默认url不在Playlist中")}var l=this.getCurrentByDefaultConfig();return l&&(a=l),null!==(t=a)&&void 0!==t?t:this.playList[0]}},{key:"isCurrentH265",value:function(){return!!this.codec&&this.codec.replace(".","").toLowerCase()===CodecType.H265}},{key:"getCurrentByDefaultConfig",value:function(){if(this.defaultConfig){var e=this.defaultConfig,t=e.type,r=e.isLive,n=e.lineId,i=void 0===n?"":n,o=e.definition,a=void 0===o?"":o;if((null!=r?r:"live"===t)===this.isLive){if(!i&&!a)return console.log("默认配置未设置默认线路或默认清晰度"),void(this.isHitDefault=!1);var s=this.getUrlList({lineId:i,definition:a});return s.length>0?(this.isHitDefault=!0,s[0]):(console.log("playlist中没有满足默认配置的流"),void(this.isHitDefault=!1))}}}},{key:"initCurrent",value:function(e){var t=this;Object.keys(this.current).forEach((function(r){t.current[r]=null==e?void 0:e[r]}));var r=(null==e?void 0:e.codec)||(null==e?void 0:e.Codec);r&&1===this.playList.length&&(this.codec=r)}},{key:"initI18nData",value:function(e){var t=[jp$1,zhHk],r=e&&Object.entries(e).reduce((function(e,r){var n=_slicedToArray(r,2),i=n[0],o=n[1];return PLAYER_LANGS.includes(i)?e.push({LANG:"zh"===i?"zh-cn":i,TEXT:o}):t.push({LANG:i,TEXT:o}),e}),[]);return{extraLangList:t,extendLangList:r}}},{key:"getCurrentUrl",value:function(){var e;return null===(e=this.getCurrentStreams()[0])||void 0===e?void 0:e.url}},{key:"getCurrentStreamType",value:function(){var e=this.getCurrentStreams();if(e.length){var t=e[0],r=t.url;return t.streamType||getStreamType(r)}return this.configs.streamType}},{key:"getCurrentStreams",value:function(){var e=this.current;return this.getUrlList(e)}},{key:"getLineList",value:function(){return cloneDeep(uniqBy(this.playList,"lineId"))}},{key:"getLineListByLineId",value:function(e){return this.playList.filter((function(t){var r;return(null==e?void 0:e.toString())===(null===(r=t.lineId)||void 0===r?void 0:r.toString())}))}},{key:"getDefinitionListByLineId",value:function(e){return cloneDeep(uniqBy(this.getLineListByLineId(e),"definition"))}},{key:"getUrlList",value:function(e){return this.playList.filter((function(t){return Object.keys(e).every((function(r){var n,i,o=(null===(n=e[r])||void 0===n?void 0:n.toString())===(null===(i=t[r])||void 0===i?void 0:i.toString()),a=!e[r];return o||a}))}))}},{key:"getNextDefinition",value:function(){var e,t,r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=arguments.length>1?arguments[1]:void 0,i=r?"next":"prev",o=this.current,a=o.definition,s=o.lineId;if(a){var l=null===(e=this.getCurrentStreams())||void 0===e?void 0:e[0],c="auto"===a?l.mapDefinition:a,u=formatDemotePriority(n)||DefinitionLinked,h=Object.keys(u);if(h.includes(c)){for(var d=null===(t=u[c])||void 0===t?void 0:t[i],p=this.getDefinitionListByLineId(s);0===p.filter((function(e){return e.definition===d})).length&&d;){var f;d=null===(f=u[d])||void 0===f?void 0:f[i]}if(d)return"auto"===a&&d&&(l.mapDefinition=d),this.getUrlList({lineId:s,definition:d});console.log("已经降至最低级")}}}}]),e}(),index_tcpy={exports:{}},esnext_string_at={},$$d=_export,charAt$1=stringMultibyte.charAt,requireObjectCoercible=requireObjectCoercible$a,toIntegerOrInfinity$5=toIntegerOrInfinity$d,toString$4=toString$h;$$d({target:"String",proto:!0,forced:!0},{at:function(e){var t=toString$4(requireObjectCoercible(this)),r=t.length,n=toIntegerOrInfinity$5(e),i=n>=0?n:r+n;return i<0||i>=r?void 0:charAt$1(t,i)}});var es_symbol={},objectGetOwnPropertyNamesExternal={},classof$4=classofRaw$2,toIndexedObject$4=toIndexedObject$c,$getOwnPropertyNames$1=objectGetOwnPropertyNames.f,arraySlice$5=arraySliceSimple,windowNames="object"==("undefined"==typeof window?"undefined":_typeof$4(window))&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],getWindowNames=function(e){try{return $getOwnPropertyNames$1(e)}catch(error){return arraySlice$5(windowNames)}};objectGetOwnPropertyNamesExternal.f=function(e){return windowNames&&"Window"==classof$4(e)?getWindowNames(e):$getOwnPropertyNames$1(toIndexedObject$4(e))};var wellKnownSymbolWrapped={},wellKnownSymbol$4=wellKnownSymbol$u;wellKnownSymbolWrapped.f=wellKnownSymbol$4;var global$g=global$H,path$1=global$g,path=path$1,hasOwn$7=hasOwnProperty_1,wrappedWellKnownSymbolModule$1=wellKnownSymbolWrapped,defineProperty$3=objectDefineProperty.f,wellKnownSymbolDefine=function(e){var t=path.Symbol||(path.Symbol={});hasOwn$7(t,e)||defineProperty$3(t,e,{value:wrappedWellKnownSymbolModule$1.f(e)})},call$5=functionCall,getBuiltIn$2=getBuiltIn$d,wellKnownSymbol$3=wellKnownSymbol$u,defineBuiltIn$3=defineBuiltIn$i,symbolDefineToPrimitive=function(){var e=getBuiltIn$2("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=wellKnownSymbol$3("toPrimitive");t&&!t[n]&&defineBuiltIn$3(t,n,(function(e){return call$5(r,this)}),{arity:1})},$$c=_export,global$f=global$H,call$4=functionCall,uncurryThis$d=functionUncurryThis,DESCRIPTORS$5=descriptors,NATIVE_SYMBOL$3=symbolConstructorDetection,fails$d=fails$L,hasOwn$6=hasOwnProperty_1,isPrototypeOf$3=objectIsPrototypeOf,anObject$1=anObject$l,toIndexedObject$3=toIndexedObject$c,toPropertyKey$1=toPropertyKey$5,$toString=toString$h,createPropertyDescriptor$1=createPropertyDescriptor$7,nativeObjectCreate=objectCreate,objectKeys$1=objectKeys$4,getOwnPropertyNamesModule=objectGetOwnPropertyNames,getOwnPropertyNamesExternal=objectGetOwnPropertyNamesExternal,getOwnPropertySymbolsModule$1=objectGetOwnPropertySymbols,getOwnPropertyDescriptorModule$1=objectGetOwnPropertyDescriptor,definePropertyModule$1=objectDefineProperty,definePropertiesModule=objectDefineProperties,propertyIsEnumerableModule=objectPropertyIsEnumerable,defineBuiltIn$2=defineBuiltIn$i,shared$2=shared$7.exports,sharedKey=sharedKey$4,hiddenKeys=hiddenKeys$5,uid$1=uid$4,wellKnownSymbol$2=wellKnownSymbol$u,wrappedWellKnownSymbolModule=wellKnownSymbolWrapped,defineWellKnownSymbol=wellKnownSymbolDefine,defineSymbolToPrimitive=symbolDefineToPrimitive,setToStringTag$1=setToStringTag$7,InternalStateModule$3=internalState,$forEach$1=arrayIteration.forEach,HIDDEN=sharedKey("hidden"),SYMBOL="Symbol",PROTOTYPE$1="prototype",setInternalState$2=InternalStateModule$3.set,getInternalState$3=InternalStateModule$3.getterFor(SYMBOL),ObjectPrototype$3=Object[PROTOTYPE$1],$Symbol=global$f.Symbol,SymbolPrototype$1=$Symbol&&$Symbol[PROTOTYPE$1],TypeError$2=global$f.TypeError,QObject=global$f.QObject,nativeGetOwnPropertyDescriptor$1=getOwnPropertyDescriptorModule$1.f,nativeDefineProperty$1=definePropertyModule$1.f,nativeGetOwnPropertyNames=getOwnPropertyNamesExternal.f,nativePropertyIsEnumerable=propertyIsEnumerableModule.f,push$2=uncurryThis$d([].push),AllSymbols=shared$2("symbols"),ObjectPrototypeSymbols=shared$2("op-symbols"),WellKnownSymbolsStore=shared$2("wks"),USE_SETTER=!QObject||!QObject[PROTOTYPE$1]||!QObject[PROTOTYPE$1].findChild,setSymbolDescriptor=DESCRIPTORS$5&&fails$d((function(){return 7!=nativeObjectCreate(nativeDefineProperty$1({},"a",{get:function(){return nativeDefineProperty$1(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=nativeGetOwnPropertyDescriptor$1(ObjectPrototype$3,t);n&&delete ObjectPrototype$3[t],nativeDefineProperty$1(e,t,r),n&&e!==ObjectPrototype$3&&nativeDefineProperty$1(ObjectPrototype$3,t,n)}:nativeDefineProperty$1,wrap$1=function(e,t){var r=AllSymbols[e]=nativeObjectCreate(SymbolPrototype$1);return setInternalState$2(r,{type:SYMBOL,tag:e,description:t}),DESCRIPTORS$5||(r.description=t),r},$defineProperty=function(e,t,r){e===ObjectPrototype$3&&$defineProperty(ObjectPrototypeSymbols,t,r),anObject$1(e);var n=toPropertyKey$1(t);return anObject$1(r),hasOwn$6(AllSymbols,n)?(r.enumerable?(hasOwn$6(e,HIDDEN)&&e[HIDDEN][n]&&(e[HIDDEN][n]=!1),r=nativeObjectCreate(r,{enumerable:createPropertyDescriptor$1(0,!1)})):(hasOwn$6(e,HIDDEN)||nativeDefineProperty$1(e,HIDDEN,createPropertyDescriptor$1(1,{})),e[HIDDEN][n]=!0),setSymbolDescriptor(e,n,r)):nativeDefineProperty$1(e,n,r)},$defineProperties=function(e,t){anObject$1(e);var r=toIndexedObject$3(t),n=objectKeys$1(r).concat($getOwnPropertySymbols(r));return $forEach$1(n,(function(t){DESCRIPTORS$5&&!call$4($propertyIsEnumerable$1,r,t)||$defineProperty(e,t,r[t])})),e},$create=function(e,t){return void 0===t?nativeObjectCreate(e):$defineProperties(nativeObjectCreate(e),t)},$propertyIsEnumerable$1=function(e){var t=toPropertyKey$1(e),r=call$4(nativePropertyIsEnumerable,this,t);return!(this===ObjectPrototype$3&&hasOwn$6(AllSymbols,t)&&!hasOwn$6(ObjectPrototypeSymbols,t))&&(!(r||!hasOwn$6(this,t)||!hasOwn$6(AllSymbols,t)||hasOwn$6(this,HIDDEN)&&this[HIDDEN][t])||r)},$getOwnPropertyDescriptor=function(e,t){var r=toIndexedObject$3(e),n=toPropertyKey$1(t);if(r!==ObjectPrototype$3||!hasOwn$6(AllSymbols,n)||hasOwn$6(ObjectPrototypeSymbols,n)){var i=nativeGetOwnPropertyDescriptor$1(r,n);return!i||!hasOwn$6(AllSymbols,n)||hasOwn$6(r,HIDDEN)&&r[HIDDEN][n]||(i.enumerable=!0),i}},$getOwnPropertyNames=function(e){var t=nativeGetOwnPropertyNames(toIndexedObject$3(e)),r=[];return $forEach$1(t,(function(e){hasOwn$6(AllSymbols,e)||hasOwn$6(hiddenKeys,e)||push$2(r,e)})),r},$getOwnPropertySymbols=function(e){var t=e===ObjectPrototype$3,r=nativeGetOwnPropertyNames(t?ObjectPrototypeSymbols:toIndexedObject$3(e)),n=[];return $forEach$1(r,(function(e){!hasOwn$6(AllSymbols,e)||t&&!hasOwn$6(ObjectPrototype$3,e)||push$2(n,AllSymbols[e])})),n};NATIVE_SYMBOL$3||($Symbol=function(){if(isPrototypeOf$3(SymbolPrototype$1,this))throw TypeError$2("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?$toString(arguments[0]):void 0,t=uid$1(e),r=function e(r){this===ObjectPrototype$3&&call$4(e,ObjectPrototypeSymbols,r),hasOwn$6(this,HIDDEN)&&hasOwn$6(this[HIDDEN],t)&&(this[HIDDEN][t]=!1),setSymbolDescriptor(this,t,createPropertyDescriptor$1(1,r))};return DESCRIPTORS$5&&USE_SETTER&&setSymbolDescriptor(ObjectPrototype$3,t,{configurable:!0,set:r}),wrap$1(t,e)},SymbolPrototype$1=$Symbol[PROTOTYPE$1],defineBuiltIn$2(SymbolPrototype$1,"toString",(function(){return getInternalState$3(this).tag})),defineBuiltIn$2($Symbol,"withoutSetter",(function(e){return wrap$1(uid$1(e),e)})),propertyIsEnumerableModule.f=$propertyIsEnumerable$1,definePropertyModule$1.f=$defineProperty,definePropertiesModule.f=$defineProperties,getOwnPropertyDescriptorModule$1.f=$getOwnPropertyDescriptor,getOwnPropertyNamesModule.f=getOwnPropertyNamesExternal.f=$getOwnPropertyNames,getOwnPropertySymbolsModule$1.f=$getOwnPropertySymbols,wrappedWellKnownSymbolModule.f=function(e){return wrap$1(wellKnownSymbol$2(e),e)},DESCRIPTORS$5&&(nativeDefineProperty$1(SymbolPrototype$1,"description",{configurable:!0,get:function(){return getInternalState$3(this).description}}),defineBuiltIn$2(ObjectPrototype$3,"propertyIsEnumerable",$propertyIsEnumerable$1,{unsafe:!0}))),$$c({global:!0,constructor:!0,wrap:!0,forced:!NATIVE_SYMBOL$3,sham:!NATIVE_SYMBOL$3},{Symbol:$Symbol}),$forEach$1(objectKeys$1(WellKnownSymbolsStore),(function(e){defineWellKnownSymbol(e)})),$$c({target:SYMBOL,stat:!0,forced:!NATIVE_SYMBOL$3},{useSetter:function(){USE_SETTER=!0},useSimple:function(){USE_SETTER=!1}}),$$c({target:"Object",stat:!0,forced:!NATIVE_SYMBOL$3,sham:!DESCRIPTORS$5},{create:$create,defineProperty:$defineProperty,defineProperties:$defineProperties,getOwnPropertyDescriptor:$getOwnPropertyDescriptor}),$$c({target:"Object",stat:!0,forced:!NATIVE_SYMBOL$3},{getOwnPropertyNames:$getOwnPropertyNames}),defineSymbolToPrimitive(),setToStringTag$1($Symbol,SYMBOL),hiddenKeys[HIDDEN]=!0;var NATIVE_SYMBOL$2=symbolConstructorDetection,symbolRegistryDetection=NATIVE_SYMBOL$2&&!!Symbol.for&&!!Symbol.keyFor,$$b=_export,getBuiltIn$1=getBuiltIn$d,hasOwn$5=hasOwnProperty_1,toString$3=toString$h,shared$1=shared$7.exports,NATIVE_SYMBOL_REGISTRY$1=symbolRegistryDetection,StringToSymbolRegistry=shared$1("string-to-symbol-registry"),SymbolToStringRegistry$1=shared$1("symbol-to-string-registry");$$b({target:"Symbol",stat:!0,forced:!NATIVE_SYMBOL_REGISTRY$1},{for:function(e){var t=toString$3(e);if(hasOwn$5(StringToSymbolRegistry,t))return StringToSymbolRegistry[t];var r=getBuiltIn$1("Symbol")(t);return StringToSymbolRegistry[t]=r,SymbolToStringRegistry$1[r]=t,r}});var $$a=_export,hasOwn$4=hasOwnProperty_1,isSymbol$1=isSymbol$6,tryToString$1=tryToString$7,shared=shared$7.exports,NATIVE_SYMBOL_REGISTRY=symbolRegistryDetection,SymbolToStringRegistry=shared("symbol-to-string-registry");$$a({target:"Symbol",stat:!0,forced:!NATIVE_SYMBOL_REGISTRY},{keyFor:function(e){if(!isSymbol$1(e))throw TypeError(tryToString$1(e)+" is not a symbol");if(hasOwn$4(SymbolToStringRegistry,e))return SymbolToStringRegistry[e]}});var $$9=_export,NATIVE_SYMBOL$1=symbolConstructorDetection,fails$c=fails$L,getOwnPropertySymbolsModule=objectGetOwnPropertySymbols,toObject$6=toObject$h,FORCED$5=!NATIVE_SYMBOL$1||fails$c((function(){getOwnPropertySymbolsModule.f(1)}));$$9({target:"Object",stat:!0,forced:FORCED$5},{getOwnPropertySymbols:function(e){var t=getOwnPropertySymbolsModule.f;return t?t(toObject$6(e)):[]}});var es_symbol_description={},$$8=_export,DESCRIPTORS$4=descriptors,global$e=global$H,uncurryThis$c=functionUncurryThis,hasOwn$3=hasOwnProperty_1,isCallable$2=isCallable$u,isPrototypeOf$2=objectIsPrototypeOf,toString$2=toString$h,defineProperty$2=objectDefineProperty.f,copyConstructorProperties=copyConstructorProperties$2,NativeSymbol=global$e.Symbol,SymbolPrototype=NativeSymbol&&NativeSymbol.prototype;if(DESCRIPTORS$4&&isCallable$2(NativeSymbol)&&(!("description"in SymbolPrototype)||void 0!==NativeSymbol().description)){var EmptyStringDescriptionStore={},SymbolWrapper=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:toString$2(arguments[0]),t=isPrototypeOf$2(SymbolPrototype,this)?new NativeSymbol(e):void 0===e?NativeSymbol():NativeSymbol(e);return""===e&&(EmptyStringDescriptionStore[t]=!0),t};copyConstructorProperties(SymbolWrapper,NativeSymbol),SymbolWrapper.prototype=SymbolPrototype,SymbolPrototype.constructor=SymbolWrapper;var NATIVE_SYMBOL="Symbol(test)"==String(NativeSymbol("test")),thisSymbolValue=uncurryThis$c(SymbolPrototype.valueOf),symbolDescriptiveString=uncurryThis$c(SymbolPrototype.toString),regexp=/^Symbol\((.*)\)[^)]+$/,replace=uncurryThis$c("".replace),stringSlice=uncurryThis$c("".slice);defineProperty$2(SymbolPrototype,"description",{configurable:!0,get:function(){var e=thisSymbolValue(this);if(hasOwn$3(EmptyStringDescriptionStore,e))return"";var t=symbolDescriptiveString(e),r=NATIVE_SYMBOL?stringSlice(t,7,-1):replace(t,regexp,"$1");return""===r?void 0:r}}),$$8({global:!0,constructor:!0,forced:!0},{Symbol:SymbolWrapper})}(function(module,exports){var t;t=function(){var __assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function __rest(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&(r[n[i]]=e[n[i]])}return r}function __values(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function __read(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}var Hook=function(){function e(){this._hooks={},this._cache=[],this._hooksCache={}}return e.prototype.on=function(e,t){e&&t&&"function"==typeof t&&(this._hooks[e]||(this._hooks[e]=[]),this._hooks[e].push(t))},e.prototype.once=function(e,t){var r=this;e&&t&&"function"==typeof t&&this.on(e,(function n(i){t(i),r.off(e,n)}))},e.prototype.off=function(e,t){if(e&&this._hooks[e]&&this._hooks[e].length)if(t){var r=this._hooks[e].indexOf(t);-1!==r&&this._hooks[e].splice(r,1)}else this._hooks[e]=[]},e.prototype.emit=function(e,t,r){if(r){if(!e)return;-1!==this._cache.indexOf(r)?this._emit(e,t):(this._hooksCache.hasOwnProperty(r)||(this._hooksCache[r]={}),this._hooksCache[r].hasOwnProperty(e)||(this._hooksCache[r][e]=[]),this._hooksCache[r][e].push(t))}else this._emit(e,t)},e.prototype._emit=function(e,t){e&&this._hooks[e]&&this._hooks[e].length&&__spread(this._hooks[e]).forEach((function(e){try{e(t)}catch(r){}}))},e.prototype.set=function(e){e&&-1===this._cache.indexOf(e)&&this._cache.push(e)},e}(),isObject$1=function(e){return null!=e&&"[object Object]"==Object.prototype.toString.call(e)},isNumber=function(e){return"number"==typeof e&&!isNaN(e)},isString=function(e){return"string"==typeof e},isArray=function(e){return Array.isArray(e)},getIndex=(lastEventId=+Date.now()+Number((""+Math.random()).slice(2,8)),function(){return lastEventId+=1}),lastEventId,decrypto=function(e,t,r){if("string"==typeof e&&"number"==typeof t&&"number"==typeof r){var n,i=[];r=r<=25?r:r%25;var o=String.fromCharCode(r+97);n=e.split(o);for(var a=0;a<n.length;a++){var s=parseInt(n[a],r);s=1*s^t;var l=String.fromCharCode(s);i.push(l)}return i.join("")}},decodeUrl=function(e){return decrypto(e,64,25)},beforePageUnload=function(e){navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)?window.addEventListener("pagehide",e,!1):window.addEventListener("beforeunload",e,!1)},getIframeUrl=function(){try{return JSON.parse(atob(window.name))||void 0}catch(e2){return}},loadScript=function(e,t,r){var n=document.createElement("script");n.src=e,n.onerror=function(){r(e)},n.onload=function(){t()},document.getElementsByTagName("head")[0].appendChild(n)},isSupVisChange=function(){var e=0;return["hidden","msHidden","webkitHidden"].forEach((function(t){void 0!==document[t]&&(e=1)})),e},selfAdjust=function(e,t){void 0===e&&(e=function(){}),void 0===t&&(t=1e3);var r,n=Date.now()+t;return r=window.setTimeout((function i(){var o=Date.now()-n;e(),n+=t,r=window.setTimeout(i,Math.max(0,t-o))}),t),function(){window.clearTimeout(r)}},parseURL=function(e){var t=document.createElement("a");return t.href=e,t},parseUrlQuery=function(e){var t={};try{var r=parseURL(e).search;(r=r.slice(1)).split("&").forEach((function(e){var r,n,i=e.split("=");i.length&&(r=i[0],n=i[1]);try{t[r]=decodeURIComponent(void 0===n?"":n)}catch(o){t[r]=n}}))}catch(n){}return t},hashCode=function(e){for(var t=0,r=0,n=(e+="").length,i=0;i<n;i++)((t=31*t+e.charCodeAt(r++))>0x7fffffffffff||t<-0x800000000000)&&(t&=0xffffffffffff);return t<0&&(t+=0x7ffffffffffff),t};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var js_cookie=createCommonjsModule((function(e,t){var r;r=function(){function e(){for(var e=0,t={};e<arguments.length;e++){var r=arguments[e];for(var n in r)t[n]=r[n]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function r(n){function i(){}function o(t,r,o){if("undefined"!=typeof document){"number"==typeof(o=e({path:"/"},i.defaults,o)).expires&&(o.expires=new Date(1*new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var a=JSON.stringify(r);/^[\{\[]/.test(a)&&(r=a)}catch(c){}r=n.write?n.write(r,t):encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s="";for(var l in o)o[l]&&(s+="; "+l,!0!==o[l]&&(s+="="+o[l].split(";")[0]));return document.cookie=t+"="+r+s}}function a(e,r){if("undefined"!=typeof document){for(var i={},o=document.cookie?document.cookie.split("; "):[],a=0;a<o.length;a++){var s=o[a].split("="),l=s.slice(1).join("=");r||'"'!==l.charAt(0)||(l=l.slice(1,-1));try{var c=t(s[0]);if(l=(n.read||n)(l,c)||t(l),r)try{l=JSON.parse(l)}catch(u){}if(i[c]=l,e===c)break}catch(u){}}return e?i[e]:i}}return i.set=o,i.get=function(e){return a(e,!1)},i.getJSON=function(e){return a(e,!0)},i.remove=function(t,r){o(t,"",e(r,{expires:-1}))},i.defaults={},i.withConverter=r,i}((function(){}))},e.exports=r()})),_getCookie=function(e,t){try{return js_cookie.get(e,{domain:t||document.domain})}catch(r){return""}},_setCookie=function(e,t,r,n){try{var i=n||document.domain,o=+new Date+(r||6048e5);js_cookie.set(e,t,{expires:new Date(o),path:"/",domain:i})}catch(a){}},Memory=function(){function e(){this.cache={}}return e.prototype.setItem=function(e,t){this.cache[e]=t},e.prototype.getItem=function(e){return this.cache[e]},e.prototype.removeItem=function(e){this.cache[e]=void 0},e.prototype.getCookie=function(e,t){return _getCookie(e,t)},e.prototype.setCookie=function(e,t,r,n){_setCookie(e,t,r,n)},e}();function isSupportLS(){try{return localStorage.setItem("_ranger-test-key","hi"),localStorage.getItem("_ranger-test-key"),localStorage.removeItem("_ranger-test-key"),!0}catch(e2){return!1}}function isSupportSession(){try{return sessionStorage.setItem("_ranger-test-key","hi"),sessionStorage.getItem("_ranger-test-key"),sessionStorage.removeItem("_ranger-test-key"),!0}catch(e2){return!1}}var local={getItem:function(e){try{var t=localStorage.getItem(e),r=t;try{t&&"string"==typeof t&&(r=JSON.parse(t))}catch(n){}return r||{}}catch(n){}return{}},setItem:function(e,t){try{var r="string"==typeof t?t:JSON.stringify(t);localStorage.setItem(e,r)}catch(n){}},removeItem:function(e){try{localStorage.removeItem(e)}catch(t){}},getCookie:function(e,t){return _getCookie(e,t)},setCookie:function(e,t,r,n){_setCookie(e,t,r,n)},isSupportLS:isSupportLS()},session={getItem:function(e){try{var t=sessionStorage.getItem(e),r=t;try{t&&"string"==typeof t&&(r=JSON.parse(t))}catch(n){}return r||{}}catch(n){}return{}},setItem:function(e,t){try{var r="string"==typeof t?t:JSON.stringify(t);sessionStorage.setItem(e,r)}catch(n){}},removeItem:function(e){try{sessionStorage.removeItem(e)}catch(t){}},getCookie:function(e,t){return _getCookie(e,t)},setCookie:function(e,t,r,n){_setCookie(e,t,r,n)},isSupportSession:isSupportSession()},Storage=function(){function e(e,t){this._storage=t&&"session"===t?session:!e&&local.isSupportLS?local:new Memory}return e.prototype.getItem=function(e){return this._storage.getItem(e)},e.prototype.setItem=function(e,t){this._storage.setItem(e,t)},e.prototype.getCookie=function(e,t){return this._storage.getCookie(e,t)},e.prototype.setCookie=function(e,t,r,n){this._storage.setCookie(e,t,r,n)},e.prototype.removeItem=function(e){this._storage.removeItem(e)},e}(),UTM=function(e,t,r,n){var i=new Storage(!1),o=new Storage(!1,"session"),a=e?"_tea_utm_cache_"+e:"_tea_utm_cache",s=e?"_$utm_from_url_"+e:"_$utm_from_url",l={},c=["tr_shareuser","tr_admaster","tr_param1","tr_param2","tr_param3","tr_param4","$utm_from_url"],u={ad_id:Number(t.ad_id)||void 0,campaign_id:Number(t.campaign_id)||void 0,creative_id:Number(t.creative_id)||void 0,utm_source:t.utm_source,utm_medium:t.utm_medium,utm_campaign:t.utm_campaign,utm_term:t.utm_term,utm_content:t.utm_content,tr_shareuser:t.tr_shareuser,tr_admaster:t.tr_admaster,tr_param1:t.tr_param1,tr_param2:t.tr_param2,tr_param3:t.tr_param3,tr_param4:t.tr_param4};try{var h=!1;for(var d in u)u[d]&&(-1!==c.indexOf(d)?(l.hasOwnProperty("tracer_data")||(l.tracer_data={}),l.tracer_data[d]=u[d]):l[d]=u[d],h=!0);if(h)o.setItem(s,"1"),i.setCookie(a,JSON.stringify(l),n,r);else{var p=i.getCookie(a,r);p&&(l=JSON.parse(p))}o.getItem(s)&&(l.hasOwnProperty("tracer_data")||(l.tracer_data={}),l.tracer_data.$utm_from_url=1)}catch(f){return u}return l},Client=function(){function e(e,t,r){this.appid=e,this.domain=t,this.userAgent=window.navigator.userAgent,this.appVersion=window.navigator.appVersion,this.cookie_expire=r}return e.prototype.init=function(){var e=window.navigator.userAgent,t=window.navigator.language,r=document.referrer,n=r?parseURL(r).hostname:"",i=parseUrlQuery(window.location.href),o=/Mobile|htc|mini|Android|iP(ad|od|hone)/.test(this.appVersion)?"wap":"web";this.utm=UTM(this.appid,i,this.domain,this.cookie_expire);var a=this.browser(),s=this.os();return{browser:a.browser,browser_version:a.browser_version,platform:o,os_name:s.os_name,os_version:s.os_version,userAgent:e,screen_width:window.screen&&window.screen.width,screen_height:window.screen&&window.screen.height,device_model:this.getDeviceModel(s.os_name),language:t,referrer:r,referrer_host:n,utm:this.utm,latest_data:this.last(r,n)}},e.prototype.last=function(e,t){var r="",n="",i="",o=location.hostname,a=!1;if(e&&t&&o!==t){r=e,n=t,a=!0;var s=parseUrlQuery(e);s.keyword&&(i=s.keyword)}return{$latest_referrer:r,$latest_referrer_host:n,$latest_search_keyword:i,isLast:a}},e.prototype.browser=function(){var e,t,r="",n=""+parseFloat(this.appVersion),i=this.userAgent;return-1!==i.indexOf("Edge")||-1!==i.indexOf("Edg")?(r="Microsoft Edge",-1!==i.indexOf("Edge")?(e=i.indexOf("Edge"),n=i.substring(e+5)):(e=i.indexOf("Edg"),n=i.substring(e+4))):-1!==(e=i.indexOf("MSIE"))?(r="Microsoft Internet Explorer",n=i.substring(e+5)):-1!==(e=i.indexOf("Lark"))?(r="Lark",n=i.substring(e+5,e+11)):-1!==i.indexOf("Chrome")?-1!==(e=i.indexOf("TTWebView"))?(r="TTWebView",n=i.substring(e+10,e+23)):(-1!==(e=i.indexOf("Chrome"))||-1!==(e=i.indexOf("Chrome")))&&(r="Chrome",n=i.substring(e+7)):-1!==i.indexOf("Safari")?-1!==(e=i.indexOf("Safari"))&&(r="Safari",n=i.substring(e+7),-1!==(e=i.indexOf("Version"))&&(n=i.substring(e+8))):-1!==(e=i.indexOf("Firefox"))&&(r="Firefox",n=i.substring(e+8)),-1!==(t=n.indexOf(";"))&&(n=n.substring(0,t)),-1!==(t=n.indexOf(" "))&&(n=n.substring(0,t)),-1!==(t=n.indexOf(")"))&&(n=n.substring(0,t)),{browser:r,browser_version:n}},e.prototype.os=function(){for(var e="",t="",r=[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0|Windows NT 10.1)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Android",r:/Android/},{s:"Sun OS",r:/SunOS/},{s:"Linux",r:/(Linux|X11)/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/}],n=0;n<r.length;n++){var i=r[n];if(i.r.test(this.userAgent)){"Mac OS X"===(e=i.s)&&this.isNewIpad()&&(e="iOS");break}}var o,a,s=function(e,t){var r=e.exec(t);return r&&r[1]?r[1]:""},l=function(e,t){var r=RegExp("(?:^|[^A-Z0-9-_]|[^A-Z0-9-]_|sprd-)(?:"+e+")","i").exec(t);return r?r.slice(1)[0]:""};switch(/Windows/.test(e)&&(t=s(/Windows (.*)/,e),e="windows"),e){case"Mac OS X":t=l("Mac[ +]OS[ +]X(?:[ /](?:Version )?(\\d+(?:[_\\.]\\d+)+))?",this.userAgent),e="mac";break;case"Android":(a=s(/Android ([\.\_\d]+)/,o=this.userAgent))||(a=s(/Android\/([\.\_\d]+)/,o)),t=a,e="android";break;case"iOS":t=this.isNewIpad()?l("Mac[ +]OS[ +]X(?:[ /](?:Version )?(\\d+(?:[_\\.]\\d+)+))?",this.userAgent):(t=/OS (\d+)_(\d+)_?(\d+)?/.exec(this.appVersion))?t[1]+"."+t[2]+"."+(0|t[3]):"",e="ios"}return{os_name:e,os_version:t}},e.prototype.getDeviceModel=function(e){var t="";try{if("android"===e)navigator.userAgent.split(";").forEach((function(e){e.indexOf("Build/")>-1&&(t=e.slice(0,e.indexOf("Build/")))}));else if("ios"===e||"mac"===e||"windows"===e)if(this.isNewIpad())t="iPad";else{var r=navigator.userAgent.replace("Mozilla/5.0 (",""),n=r.indexOf(";");t=r.slice(0,n)}}catch(i){return t.trim()}return t.trim()},e.prototype.isNewIpad=function(){return void 0!==this.userAgent&&"MacIntel"===navigator.platform&&"number"==typeof navigator.maxTouchPoints&&navigator.maxTouchPoints>1},e}(),LOG_URL={sg:"1fz22z22z1nz21z4mz4bz4bz21z1ez18z1jz1gz49z1kz1az21z4az19z27z22z1cz1mz24z1cz20z21z1cz18z4az1az1mz1k",va:"1fz22z22z1nz21z4mz4bz4bz1kz18z1jz1gz24z18z49z1kz1az21z4az19z27z22z1cz1mz24z1cz20z21z1cz18z4az1az1mz1k"},AB_DOMAINS={va:"1fz22z22z1nz21z4mz4bz4bz22z1mz19z1jz1mz1ez4az1gz22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k",sg:"1fz22z22z1nz21z4mz4bz4bz22z1mz19z1jz1mz1ez4az22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k",in:"1fz22z22z1nz21z4mz4bz4bz22z1mz19z1jz1mz1ez4az1gz22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k"},SDK_USE_TYPE="npm",SDK_TYPE=SDK_USE_TYPE,LOG_URL_TCPY={sg:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z49z21z1ez4az22z1gz1iz22z1mz1iz24z4az1az1mz1k",va:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z49z24z18z4az22z1gz1iz22z1mz1iz24z4az1az1mz1k",in:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z49z24z18z49z23z21z1cz18z21z22z4ez18z4az22z1gz1iz22z1mz1iz24z4az1az1mz1k"},LOG_URL_TTP={sg:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z4az23z21z4az22z1gz1iz22z1mz1iz24z4az1az1mz1k",va:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z4az23z21z4az22z1gz1iz22z1mz1iz4az1az1mz1k"},SDK_VERSION="5.0.31_oversea",VISUAL_EDITOR_RANGERS="https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/visual-editor-rangers.js",VISUAL_AB_CORE="https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/visual-ab-core.js",VISUAL_AB_LOADER="https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/visual-ab-loader.js",HOT_PIC_URL="https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/heatmap-core",VISUAL_URL_INSPECTOR="https://lf16-data.bytepluscdn.com/obj/data-static-sg/log-sdk/collect/tester-event-inspector",EventCheck=function(){function e(e,t){this.collector=e,this.config=t,this.eventNameWhiteList=["__bav_page","__bav_beat","__bav_page_statistics","__bav_click","__bav_page_exposure"],this.paramsNameWhiteList=["$inactive","$inline","$target_uuid_list","$source_uuid","$is_spider","$source_id","$is_first_time","_staging_flag"],this.regStr=new RegExp("^[a-zA-Z0-9][a-z0-9A-Z_.-]{1,255}$")}return e.prototype.checkVerify=function(e){var t=this;if(!e||!e.length)return!1;var r=e[0];if(!r)return!1;var n=r.events,i=r.header;if(!n||!n.length)return!1;var o=!0;return n.forEach((function(e){if(!e)return o=!1,void(e.checkEvent="事件异常");t.checkEventName(e.event)||(o=!1,e.checkEvent="事件名不能以 $ or __开头"),t.checkEventParams(e.params)||(o=!1,e.checkParams="属性名不能以 $ or __开头")})),this.checkEventParams(i)||(o=!1),o},e.prototype.checkEventName=function(e){return!!e&&this.calculate(e,"event")},e.prototype.checkEventParams=function(e){var t=e;if("string"==typeof e&&(t=JSON.parse(t)),!Object.keys(t).length)return!0;for(var r in t)return!(!this.calculate(r,"params")||"string"==typeof t[r]&&t[r].length>1024&&(console.warn("params: "+r+" can not over 1024 byte, please check;"),1));return!0},e.prototype.calculate=function(e,t){return-1!==("event"===t?this.eventNameWhiteList:this.paramsNameWhiteList).indexOf(e)||!new RegExp("^\\$").test(e)&&!new RegExp("^__").test(e)||(console.warn(("event"===t?"event":"params")+" name: "+e+" can not start with $ or __, pleace check;"),!1)},e}(),Types,DebuggerMesssge$1,e,e2;e=Types||(Types={}),e.Init="init",e.Config="config",e.Start="start",e.Ready="ready",e.TokenComplete="token-complete",e.TokenStorage="token-storage",e.TokenFetch="token-fetch",e.TokenError="token-error",e.ConfigUuid="config-uuid",e.ConfigWebId="config-webid",e.ConfigDomain="config-domain",e.CustomWebId="custom-webid",e.TokenChange="token-change",e.TokenReset="token-reset",e.ConfigTransform="config-transform",e.EnvTransform="env-transform",e.SessionReset="session-reset",e.SessionResetTime="session-reset-time",e.Event="event",e.Events="events",e.EventNow="event-now",e.CleanEvents="clean-events",e.BeconEvent="becon-event",e.SubmitBefore="submit-before",e.SubmitScuess="submit-scuess",e.SubmitAfter="submit-after",e.SubmitError="submit-error",e.SubmitVerify="submit-verify",e.Stay="stay",e.ResetStay="reset-stay",e.StayReady="stay-ready",e.SetStay="set-stay",e.RouteChange="route-change",e.RouteReady="route-ready",e.Ab="ab",e.AbVar="ab-var",e.AbAllVars="ab-all-vars",e.AbConfig="ab-config",e.AbExternalVersion="ab-external-version",e.AbVersionChangeOn="ab-version-change-on",e.AbVersionChangeOff="ab-version-change-off",e.AbOpenLayer="ab-open-layer",e.AbCloseLayer="ab-close-layer",e.AbReady="ab-ready",e.AbComplete="ab-complete",e.AbTimeout="ab-timeout",e.Profile="profile",e.ProfileSet="profile-set",e.ProfileSetOnce="profile-set-once",e.ProfileUnset="profile-unset",e.ProfileIncrement="profile-increment",e.ProfileAppend="profile-append",e.ProfileClear="profile-clear",e.Autotrack="autotrack",e.AutotrackReady="autotrack-ready",e.CepReady="cep-ready",e.TracerReady="tracer-ready",e.sessionRecord="session-record",e.SessionRecordStart="session-record-start",e.SessionRecordPause="session-record-pause",e.SessionRecordEnd="session-record-end",e.SessionRecordReport="session-record-report",e2=DebuggerMesssge$1||(DebuggerMesssge$1={}),e2.DEBUGGER_MESSAGE="debugger-message",e2.DEBUGGER_MESSAGE_SDK="debugger-message-sdk",e2.DEBUGGER_MESSAGE_FETCH="debugger-message-fetch",e2.DEBUGGER_MESSAGE_FETCH_RESULT="debugger-message-fetch-result",e2.DEBUGGER_MESSAGE_EVENT="debugger-message-event",e2.DEVTOOL_WEB_READY="devtool-web-ready";var Types$1=Types,undef=void 0,date=new Date,timeZoneMin=date.getTimezoneOffset(),timezone=parseInt(""+-timeZoneMin/60,10),tz_offset=60*timeZoneMin,COOKIE_EXPIRE=6048e5,ConfigManager=function(){function e(e,t){this.is_first_time=!0,this.configPersist=!1,this.initConfig=t,this.collect=e;var r=new Client(t.app_id,t.cookie_domain||"",t.cookie_expire||COOKIE_EXPIRE).init();this.eventCheck=new EventCheck(e,t);var n="__tea_cache_first_"+t.app_id;this.configKey="__tea_cache_config_"+t.app_id,this.sessionStorage=new Storage(!1,"session"),this.localStorage=new Storage(!1,"local"),this.channelUrl="tcpy"===t.channel_type||"ttp"===t.channel_type?{WEBID_URL:"/v1/user/webid",TOB_URL:"",REPORT_URL:"/v1/list"}:{WEBID_URL:"/webid",TOB_URL:"/tobid",REPORT_URL:"/list"},t.configPersist&&(this.configPersist=!0,this.storage=1===t.configPersist?this.sessionStorage:this.localStorage);var i=this.localStorage.getItem(n);i&&1==i?this.is_first_time=!1:(this.is_first_time=!0,this.localStorage.setItem(n,"1")),this.envInfo={user:{user_unique_id:undef,user_type:undef,user_id:undef,user_is_auth:undef,user_is_login:undef,device_id:undef,web_id:undef,ip_addr_id:undef,user_unique_id_type:undef},header:{app_id:undef,app_name:undef,app_install_id:undef,install_id:undef,app_package:undef,app_channel:undef,app_version:undef,ab_version:undef,os_name:r.os_name,os_version:r.os_version,device_model:r.device_model,ab_client:undef,traffic_type:undef,client_ip:undef,device_brand:undef,os_api:undef,access:undef,language:r.language,region:undef,app_language:undef,app_region:undef,creative_id:r.utm.creative_id,ad_id:r.utm.ad_id,campaign_id:r.utm.campaign_id,log_type:undef,rnd:undef,platform:r.platform,sdk_version:SDK_VERSION,sdk_lib:"js",province:undef,city:undef,timezone:timezone,tz_offset:tz_offset,tz_name:undef,sim_region:undef,carrier:undef,resolution:r.screen_width+"x"+r.screen_height,browser:r.browser,browser_version:r.browser_version,referrer:r.referrer,referrer_host:r.referrer_host,width:r.screen_width,height:r.screen_height,screen_width:r.screen_width,screen_height:r.screen_height,utm_term:r.utm.utm_term,utm_content:r.utm.utm_content,utm_source:r.utm.utm_source,utm_medium:r.utm.utm_medium,utm_campaign:r.utm.utm_campaign,tracer_data:JSON.stringify(r.utm.tracer_data),custom:{},wechat_unionid:undef,wechat_openid:undef}},this.ab_version="",this.evtParams={},this.reportErrorCallback=function(){},this.isLast=!1,this.setCustom(r),this.initDomain(),this.initABData()}return e.prototype.initDomain=function(e){var t=this.initConfig.channel_domain;if(t)this.domain=t;else{var r=e||this.initConfig.channel,n=this.initConfig&&this.initConfig.channel_type?"tcpy"===this.initConfig.channel_type?LOG_URL_TCPY[r]:LOG_URL_TTP[r]:LOG_URL[r];this.domain=decodeUrl(n)}},e.prototype.setDomain=function(e){this.customDomain=!0,this.domain=e},e.prototype.getDomain=function(e){return this.customDomain||e&&this.initDomain(e),this.domain},e.prototype.initABData=function(){var e="__tea_sdk_ab_version_"+this.initConfig.app_id,t=null;if(this.initConfig.ab_cross){var r=this.localStorage.getCookie(e,this.initConfig.ab_cookie_domain);t=r?JSON.parse(r):null}else t=this.localStorage.getItem(e);this.setAbCache(t)},e.prototype.setAbCache=function(e){this.ab_cache=e},e.prototype.getAbCache=function(){return this.ab_cache},e.prototype.setAbVersion=function(e){this.ab_version=e},e.prototype.getAbVersion=function(){return this.ab_version},e.prototype.getUrl=function(e){var t="";switch(e){case"event":t=this.initConfig.report_url||this.channelUrl.REPORT_URL;break;case"webid":t=this.channelUrl.WEBID_URL;break;case"tobid":t=this.channelUrl.TOB_URL}var r="";return this.initConfig.caller&&(r="?sdk_version="+SDK_VERSION+"&sdk_name=web&app_id="+this.initConfig.app_id+"&caller="+this.initConfig.caller),""+this.getDomain()+t+r},e.prototype.setCustom=function(e){if(e&&e.latest_data&&e.latest_data.isLast)for(var t in delete e.latest_data.isLast,this.isLast=!0,e.latest_data)this.envInfo.header.custom[t]=e.latest_data[t]},e.prototype.set=function(e){var t=this;Object.keys(e).forEach((function(r){void 0!==e[r]&&null!==e[r]||t.delete(r);try{t.eventCheck.calculate(r,"config")}catch(a){}if("traffic_type"===r&&t.isLast&&(t.envInfo.header.custom.$latest_traffic_source_type=e[r]),"evtParams"===r)t.evtParams=__assign({},t.evtParams||{},e.evtParams||{});else if("_staging_flag"===r)t.evtParams=__assign({},t.evtParams||{},{_staging_flag:e._staging_flag});else if("reportErrorCallback"===r&&"function"==typeof e[r])t.reportErrorCallback=e[r];else{var n="",i="";if(r.indexOf(".")>-1){var o=r.split(".");n=o[0],i=o[1]}n?"user"===n||"header"===n?t.envInfo[n][i]=e[r]:t.envInfo.header.custom[i]=e[r]:Object.hasOwnProperty.call(t.envInfo.user,r)?["user_type","ip_addr_id"].indexOf(r)>-1?t.envInfo.user[r]=e[r]?Number(e[r]):e[r]:["user_id","web_id","user_unique_id","user_unique_id_type"].indexOf(r)>-1?t.envInfo.user[r]=e[r]?String(e[r]):e[r]:["user_is_auth","user_is_login"].indexOf(r)>-1?t.envInfo.user[r]=Boolean(e[r]):"device_id"===r&&(t.envInfo.user[r]=e[r]):Object.hasOwnProperty.call(t.envInfo.header,r)?t.envInfo.header[r]=e[r]:t.envInfo.header.custom[r]=e[r]}}))},e.prototype.get=function(e){try{return e?"evtParams"===e?this.evtParams:"reportErrorCallback"===e?this[e]:Object.hasOwnProperty.call(this.envInfo.user,e)?this.envInfo.user[e]:Object.hasOwnProperty.call(this.envInfo.header,e)?this.envInfo.header[e]:JSON.parse(JSON.stringify(this.envInfo[e])):JSON.parse(JSON.stringify(this.envInfo))}catch(t){console.log("get config stringify error "),this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:t.message})}},e.prototype.setStore=function(e){try{if(!this.configPersist)return;var t=this.storage.getItem(this.configKey)||{};if(t&&Object.keys(e).length){var r=Object.assign(e,t);this.storage.setItem(this.configKey,r)}}catch(n){console.log("setStore error"),this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:n.message})}},e.prototype.getStore=function(){try{if(!this.configPersist)return null;var e=this.storage.getItem(this.configKey)||{};return e&&Object.keys(e).length?e:null}catch(t){return this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:t.message}),null}},e.prototype.delete=function(e){try{if(!this.configPersist)return;var t=this.storage.getItem(this.configKey)||{};t&&Object.hasOwnProperty.call(t,e)&&(delete t[e],this.storage.setItem(this.configKey,t))}catch(r){this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:r.message}),console.log("delete error")}},e}(),Logger=function(){function e(e,t){this.isLog=t||!1,this.name=e||""}return e.prototype.info=function(e){this.isLog&&console.log("%c %s","color: yellow; background-color: black;","[instance: "+this.name+"] "+e)},e.prototype.warn=function(e){this.isLog&&console.warn("[instance: "+this.name+"] "+e)},e.prototype.error=function(e){this.isLog&&console.error("[instance: "+this.name+"] "+e)},e.prototype.throw=function(e){throw this.error(this.name),new Error(e)},e}(),AppBridge=function(){function e(e,t){this.collect=e,this.native=t}var t=e.prototype;return t.bridgeInject=function(){try{return!!this.native&&(AppLogBridge?(console.log("AppLogBridge is injected"),!0):(console.log("AppLogBridge is not inject"),!1))}catch(e){return console.log("AppLogBridge is not inject"),!1}},t.bridgeReady=function(){var e=this;return new Promise((function(t,r){try{e.bridgeInject()?AppLogBridge.hasStarted((function(e){console.log("AppLogBridge is started? : "+e),e?t(!0):r(!1)})):r(!1)}catch(n){console.log("AppLogBridge, error:"+JSON.stringify(n.stack)),r(!1)}}))},t.setNativeAppId=function(e){try{AppLogBridge.setNativeAppId(JSON.stringify(e)),console.log("change bridge appid, event report with appid: "+e)}catch(t){console.error("setNativeAppId error")}},t.setConfig=function(e){var t=this;try{Object.keys(e).forEach((function(r){"user_unique_id"===r?t.setUserUniqueId(e[r]):e[r]?t.addHeaderInfo(r,e[r]):t.removeHeaderInfo(r)}))}catch(r){console.error("setConfig error")}},t.setUserUniqueId=function(e){try{AppLogBridge.setUserUniqueId(e)}catch(t){console.error("setUserUniqueId error")}},t.addHeaderInfo=function(e,t){try{AppLogBridge.addHeaderInfo(e,t)}catch(r){console.error("addHeaderInfo error")}},t.setHeaderInfo=function(e){try{AppLogBridge.setHeaderInfo(JSON.stringify(e))}catch(t){console.error("setHeaderInfo error")}},t.removeHeaderInfo=function(e){try{AppLogBridge.removeHeaderInfo(e)}catch(t){console.error("removeHeaderInfo error")}},t.reportPv=function(e){this.onEventV3("predefine_pageview",e)},t.onEventV3=function(e,t){try{AppLogBridge.onEventV3(e,t),this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_EVENT,info:"bridge埋点上报",time:Date.now(),data:[{events:[{event:e,params:t}]}],code:200,status:"success"})}catch(r){console.error("onEventV3 error")}},t.profileSet=function(e){try{AppLogBridge.profileSet(e)}catch(t){console.error("profileSet error")}},t.profileSetOnce=function(e){try{AppLogBridge.profileSetOnce(e)}catch(t){console.error("profileSetOnce error")}},t.profileIncrement=function(e){try{AppLogBridge.profileIncrement(e)}catch(t){console.error("profileIncrement error")}},t.profileUnset=function(e){try{AppLogBridge.profileUnset(e)}catch(t){console.error("profileUnset error")}},t.profileAppend=function(e){try{AppLogBridge.profileAppend(e)}catch(t){console.error("profileAppend error")}},e}(),ERROR={NO_URL:4001,IMG_ON:4e3,IMG_CATCH:4002,BEACON_FALSE:4003,XHR_ON:500,RESPONSE:5001,TIMEOUT:5005};function fetch$1(e,t,r,n,i,o,a,s,l){try{var c=new XMLHttpRequest,u=s||"POST";c.open(u,""+e,!0),c.setRequestHeader("Content-Type","application/json; charset=utf-8"),a&&c.setRequestHeader("X-MCS-AppKey",""+a),n&&(c.withCredentials=!0),c.onload=function(){if(i){var e=null;if(c.responseText){try{e=JSON.parse(c.responseText)}catch(r){e={}}i(e,t)}}},r&&(c.timeout=r,c.ontimeout=function(){o&&o(t,ERROR.TIMEOUT)}),c.onerror=function(){c.abort(),o&&o(t,ERROR.XHR_ON)},l?c.send(t):c.send(JSON.stringify(t))}catch(h){}}var GIF_URL="/gif",ERROR$1={NO_URL:4001,IMG_ON:4e3,IMG_CATCH:4002,BEACON_FALSE:4003,XHR_ON:500,RESPONSE:5001,TIMEOUT:5005},isSupportBeacon=function(){return!(!window.navigator||!window.navigator.sendBeacon)},encodePayload=function(e){var t="";for(var r in e)e.hasOwnProperty(r)&&void 0!==e[r]&&(t+="&"+r+"="+encodeURIComponent(JSON.stringify(e[r])));return"&"===t[0]?t.slice(1):t},sendByImg=function(e,t,r,n){try{var i,o=e.match(/\/v\d\//);i=o?o[0]:-1!==e.indexOf("/v1/")?"/v1/":"/v2/";var a=e.split(i)[0];if(!a)return void n(e,t,ERROR$1.NO_URL);t.forEach((function(i){var o=encodePayload(i),s=new Image(1,1);s.onload=function(){s=null,r&&r()},s.onerror=function(){s=null,n&&n(e,t,ERROR$1.IMG_ON)},s.src=""+a+GIF_URL+"?"+o}))}catch(s){n&&n(e,t,ERROR$1.IMG_CATCH,s.message)}},request=function(e,t,r,n,i,o,a,s){var l=window.navigator.userAgent;if(-1===window.navigator.appName.indexOf("Microsoft Internet Explorer")||-1===l.indexOf("MSIE 8.0")&&-1===l.indexOf("MSIE 9.0")){if(a)return isSupportBeacon()?void(window.navigator.sendBeacon(e,JSON.stringify(t))?i():o(e,t,ERROR$1.BEACON_FALSE)):void sendByImg(e,t,i,o)}else sendByImg(e,t,i,o);fetch$1(e,t,r,n,i,o,"","",s)},Event=function(){function e(){this.eventLimit=50,this.enable_ttwebid=!1,this.eventCache=[],this.beconEventCache=[]}return e.prototype.apply=function(e,t){var r=this;this.collect=e,this.config=t,this.configManager=e.configManager,this.eventCheck=new EventCheck(e,t),this.cacheStorgae=new Storage(!0),this.localStorage=new Storage(!1),this.maxReport=t.max_report||10,this.reportTime=t.reportTime||30,this.timeout=t.timeout||1e5,this.enable_ttwebid=t.enable_ttwebid,this.reportUrl=this.configManager.getUrl("event"),this.eventKey="__tea_cache_events_"+this.configManager.get("app_id"),this.beconKey="__tea_cache_events_becon_"+this.configManager.get("app_id"),this.abKey="__tea_sdk_ab_version_"+this.configManager.get("app_id"),this.collect.on(Types$1.Ready,(function(){r.reportAll(!1)})),this.collect.on(Types$1.ConfigDomain,(function(){r.reportUrl=r.configManager.getUrl("event")})),this.collect.on(Types$1.Event,(function(e){r.event(e)})),this.collect.on(Types$1.BeconEvent,(function(e){r.beconEvent(e)})),this.collect.on(Types$1.CleanEvents,(function(){r.reportAll(!1)})),this.linster()},e.prototype.linster=function(){var e=this;window.addEventListener("unload",(function(){e.reportAll(!0)}),!1),beforePageUnload((function(){e.reportAll(!0)})),document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e.reportAll(!0)}),!1)},e.prototype.reportAll=function(e){this.report(e),this.reportBecon()},e.prototype.event=function(e){var t=this;try{var r=__spread(e,this.cacheStorgae.getItem(this.eventKey)||[]);if(this.cacheStorgae.setItem(this.eventKey,r),this.reportTimeout&&clearTimeout(this.reportTimeout),r.length>=this.maxReport)this.report(!1);else{var n=this.reportTime;this.reportTimeout=setTimeout((function(){t.report(!1),t.reportTimeout=null}),n)}}catch(i){this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:i.message})}},e.prototype.beconEvent=function(e){var t=__spread(e,this.cacheStorgae.getItem(this.beconKey)||[]);this.cacheStorgae.setItem(this.beconKey,t),this.collect.destroyInstance||this.collect.tokenManager.getReady()&&this.collect.sdkReady&&(this.cacheStorgae.removeItem(this.beconKey),this.send(this.split(this.merge(t)),!0))},e.prototype.reportBecon=function(){if(!this.collect.destroyInstance&&this.collect.tokenManager.getReady()&&this.collect.sdkReady){var e=this.cacheStorgae.getItem(this.beconKey)||[];e&&e.length&&(this.cacheStorgae.removeItem(this.beconKey),this.send(this.split(this.merge(e)),!0))}},e.prototype.report=function(e){if(!this.collect.destroyInstance&&this.collect.tokenManager.getReady()&&this.collect.sdkReady){var t=this.cacheStorgae.getItem(this.eventKey)||[];t.length&&(this.cacheStorgae.removeItem(this.eventKey),this.sliceEvent(t,e))}},e.prototype.sliceEvent=function(e,t){if(e.length>this.eventLimit)for(var r=0;r<e.length;r+=this.eventLimit){var n;n=e.slice(r,r+this.eventLimit);var i=this.split(this.merge(n));this.send(i,t)}else i=this.split(this.merge(e)),this.send(i,t)},e.prototype.merge=function(e,t){var r=this,n=this.configManager.get(),i=n.header,o=n.user;i.custom=JSON.stringify(i.custom);var a=this.configManager.get("evtParams"),s=this.configManager.get("user_unique_id_type"),l=e.map((function(e){try{Object.keys(a).length&&!t&&(e.params=__assign({},a,e.params)),s&&(e.params.$user_unique_id_type=s);var n=r.configManager.getAbCache();return n&&n.uuid&&n.uuid===o.user_unique_id&&r.configManager.getAbVersion()&&(e.ab_sdk_version=r.configManager.getAbVersion()),e.session_id=r.collect.sessionManager.getSessionId(),e.params=JSON.stringify(e.params),e}catch(i){return r.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:i.message}),e}})),c=JSON.parse(JSON.stringify({events:l,user:o,header:i}));c.local_time=Math.floor(Date.now()/1e3),c.user_unique_type=this.config.enable_ttwebid?this.config.user_unique_type:void 0,c.verbose=1;var u=[];return u.push(c),u},e.prototype.split=function(e){return e.map((function(e){var t=[];return t.push(e),t}))},e.prototype.send=function(e,t){var r=this;e.length&&(this.config.disable_track_event||e.forEach((function(e){try{var n=JSON.parse(JSON.stringify(e));r.config.filter&&((n=r.config.filter(n))||console.warn("filter must return data !!")),r.collect.eventFilter&&n&&((n=r.collect.eventFilter(n))||console.warn("filterEvent api must return data !!"));var i=n||e,o=JSON.parse(JSON.stringify(i));if(r.eventCheck.checkVerify(o),!i.length)return;r.collect.emit(Types$1.SubmitBefore,i),r.collect.emit(Types$1.SubmitVerify,i),request(r.reportUrl,i,r.timeout,r.enable_ttwebid,(function(e,t){e&&0!==e.e?(r.collect.emit(Types$1.SubmitError,{type:"f_data",eventData:t,errorCode:e.e,response:e}),r.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_EVENT,info:"埋点上报失败",time:Date.now(),data:o,code:e.e,failType:"数据异常",status:"fail"})):(r.collect.emit(Types$1.SubmitScuess,{eventData:t,res:e}),r.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_EVENT,info:"埋点上报成功",time:Date.now(),data:o,code:200,status:"success"}))}),(function(e,t){r.configManager.get("reportErrorCallback")(e,t),r.collect.emit(Types$1.SubmitError,{type:"f_net",eventData:e,errorCode:t}),r.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_EVENT,info:"埋点上报网络异常",time:Date.now(),data:o,code:t,failType:"网络异常",status:"fail"})}),t,!1),r.collect.emit(Types$1.SubmitAfter,i)}catch(a){console.warn("something error, "+JSON.stringify(a.stack)),r.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:a.message})}})))},e}(),b=function e(t){return t?(t^16*Math.random()>>t/4).toString(10):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)},localWebId=function(){return b().replace(/-/g,"").slice(0,19)},Token=function(){function e(){this.cacheToken={},this.enableCookie=!1,this.enable_ttwebid=!1,this.enableCustomWebid=!1}return e.prototype.apply=function(e,t){var r=this;this.collect=e,this.config=t,this.configManager=this.collect.configManager,this.storage=new Storage(!1),this.tokenKey="__tea_cache_tokens_"+t.app_id,this.enable_ttwebid=t.enable_ttwebid,this.enableCustomWebid=t.enable_custom_webid,this.collect.on(Types$1.ConfigUuid,(function(e){r.setUuid(e)})),this.collect.on(Types$1.ConfigWebId,(function(e){r.setWebId(e)})),this.enableCookie=t.cross_subdomain,this.expiresTime=t.cookie_expire||6048e5,this.cookieDomain=t.cookie_domain||"",this.checkStorage()},e.prototype.checkStorage=function(){var e=this;if(this.enableCookie){var t=this.storage.getCookie(this.tokenKey,this.cookieDomain);this.cacheToken=t&&"string"==typeof t?JSON.parse(t):{}}else this.cacheToken=this.storage.getItem(this.tokenKey)||{};this.tokenType=this.cacheToken&&this.cacheToken._type_?this.cacheToken._type_:"default","custom"!==this.tokenType||this.enableCustomWebid?this.enableCustomWebid?this.collect.on(Types$1.CustomWebId,(function(){e.tokenReady=!0,e.collect.emit(Types$1.TokenComplete)})):this.checkEnv()||(this.enable_ttwebid?this.completeTtWid(this.cacheToken):this.check()):this.remoteWebid()},e.prototype.check=function(){this.cacheToken&&this.cacheToken.web_id?this.complete(this.cacheToken):this.config.disable_webid?this.complete({web_id:localWebId(),user_unique_id:this.configManager.get("user_unique_id")||localWebId()}):this.remoteWebid()},e.prototype.checkEnv=function(){var e=window.navigator.userAgent;if(-1!==e.indexOf("miniProgram")||-1!==e.indexOf("MiniProgram")){var t=parseUrlQuery(window.location.href);return!(!t||!t.Web_ID||(this.complete({web_id:""+t.Web_ID,user_unique_id:this.configManager.get("user_unique_id")||""+t.Web_ID}),0))}return!1},e.prototype.remoteWebid=function(){var e=this,t=this.configManager.getUrl("webid"),r={app_key:this.config.app_key,app_id:this.config.app_id,url:location.href,user_agent:window.navigator.userAgent,referer:document.referrer,user_unique_id:""};this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 发起WEBID请求",logType:"fetch",level:"info",time:Date.now(),data:r}),fetch$1(t,r,3e3,!1,(function(t){t&&0===t.e?e.complete({web_id:e.configManager.get("web_id")||t.web_id,user_unique_id:e.configManager.get("user_unique_id")||t.web_id}):(e.collect.emit(Types$1.TokenError),console.warn("[]appid: "+e.config.app_id+" webid error, init error~")),e.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"WEBID请求成功",logType:"fetch",level:"info",time:Date.now(),data:t})}),(function(){e.collect.emit(Types$1.TokenError),e.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"WEBID请求网络异常",logType:"fetch",level:"error",time:Date.now(),data:null}),console.warn("[]appid: "+e.config.app_id+", get webid error, init error~")}))},e.prototype.complete=function(e){var t=e.web_id,r=e.user_unique_id;e.timestamp=Date.now(),this.collect.configManager.set({web_id:t,user_unique_id:r}),this.setStorage(e),this.tokenReady=!0,this.collect.emit(Types$1.TokenComplete)},e.prototype.completeTtWid=function(e){var t=e.user_unique_id||"",r=this.configManager.get("user_unique_id");(r||t)&&this.configManager.set({user_unique_id:r||t}),this.setStorage(e),this.tokenReady=!0,this.collect.emit(Types$1.TokenComplete)},e.prototype.setUuid=function(e){if(e&&-1===["null","undefined","Null","None"].indexOf(e)){var t=String(e),r=this.configManager.get("user_unique_id"),n=this.cacheToken&&this.cacheToken.user_unique_id;if(t===r&&t===n)return;this.configManager.set({user_unique_id:t}),this.cacheToken||(this.cacheToken={}),this.cacheToken.user_unique_id=t,this.cacheToken.timestamp=Date.now(),this.setStorage(this.cacheToken),this.collect.emit(Types$1.TokenChange,"uuid"),this.collect.emit(Types$1.SessionReset)}else this.clearUuid()},e.prototype.clearUuid=function(){this.config.enable_ttwebid||this.configManager.get("web_id")&&(this.configManager.set({user_unique_id:this.configManager.get("web_id")}),this.cacheToken&&this.cacheToken.web_id&&(this.cacheToken.user_unique_id=this.cacheToken.web_id,this.cacheToken.timestamp=Date.now(),this.setStorage(this.cacheToken)),this.collect.emit(Types$1.TokenReset))},e.prototype.setWebId=function(e){if(e&&!this.config.enable_ttwebid){this.cacheToken&&this.cacheToken.web_id?this.cacheToken.web_id!==e&&(this.cacheToken.user_unique_id=this.cacheToken.web_id===this.cacheToken.user_unique_id?e:this.cacheToken.user_unique_id,this.cacheToken.web_id=e):(this.cacheToken={},this.cacheToken.web_id=e,this.cacheToken.user_unique_id=e),this.cacheToken.timestamp=Date.now();var t=this.configManager.get("web_id"),r=this.configManager.get("user_unique_id");r&&r!==t||(this.configManager.set({user_unique_id:e}),this.collect.emit(Types$1.TokenChange,"uuid")),t!==e&&(this.configManager.set({web_id:e}),this.collect.emit(Types$1.TokenChange,"webid")),this.setStorage(this.cacheToken)}},e.prototype.setStorage=function(e){e._type_=this.enableCustomWebid?"custom":"default",delete e["diss".split("").reverse().join("")],this.enableCookie||this.enable_ttwebid?(this.storage.setCookie(this.tokenKey,e,this.expiresTime,this.cookieDomain),this.enable_ttwebid&&(delete e.web_id,this.storage.setItem(this.tokenKey,e))):this.storage.setItem(this.tokenKey,e),this.cacheToken=e},e.prototype.getReady=function(){return this.tokenReady},e.prototype.getTobId=function(){var e=this,t=this.configManager.getUrl("tobid");return new Promise((function(r){fetch$1(t,{app_id:e.config.app_id,user_unique_id:e.configManager.get("user_unique_id"),web_id:e.configManager.get("web_id"),user_unique_id_type:e.configManager.get("user_unique_id_type")},3e4,e.enable_ttwebid,(function(e){e&&0===e.e?r(e.tobid):r("")}),(function(){r("")}))}))},e}(),sessionId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},Session=function(){function e(){}return e.prototype.apply=function(e,t){var r=this;this.collect=e,this.storage=new Storage(!1,"session"),this.sessionKey="__tea_session_id_"+t.app_id,this.expireTime=t.expireTime||18e5,this.disableSession=t.disable_session,this.disableSession||(this.setSessionId(),this.collect.on(Types$1.SessionReset,(function(){r.resetSessionId()})),this.collect.on(Types$1.SessionResetTime,(function(){r.updateSessionIdTime()})))},e.prototype.updateSessionIdTime=function(){var e=this.storage.getItem(this.sessionKey);if(e&&e.sessionId){var t=e.timestamp;Date.now()-t>this.expireTime?e={sessionId:sessionId(),timestamp:Date.now()}:e.timestamp=Date.now(),this.storage.setItem(this.sessionKey,e),this.resetExpTime()}},e.prototype.setSessionId=function(){var e=this,t=this.storage.getItem(this.sessionKey);t&&t.sessionId?t.timestamp=Date.now():t={sessionId:sessionId(),timestamp:Date.now()},this.storage.setItem(this.sessionKey,t),this.sessionExp=setInterval((function(){e.checkEXp()}),this.expireTime)},e.prototype.getSessionId=function(){var e=this.storage.getItem(this.sessionKey);return this.disableSession?"":e&&e.sessionId?e.sessionId:""},e.prototype.resetExpTime=function(){var e=this;this.sessionExp&&(clearInterval(this.sessionExp),this.sessionExp=setInterval((function(){e.checkEXp()}),this.expireTime))},e.prototype.resetSessionId=function(){var e={sessionId:sessionId(),timestamp:Date.now()};this.storage.setItem(this.sessionKey,e)},e.prototype.checkEXp=function(){var e=this.storage.getItem(this.sessionKey);e&&e.sessionId&&Date.now()-e.timestamp+30>=this.expireTime&&(e={sessionId:sessionId(),timestamp:Date.now()},this.storage.setItem(this.sessionKey,e))},e}(),AutoBase=function(e){var t=e.app_id,r=e.channel,n=e.onTokenReady,i=LOG_URL[r]+"/webid",o=new Storage(!1),a="__tea_cache_tokens_"+t,s=o.getItem(a);s&&s.web_id?n(s.web_id):request(i,{app_key:"",app_id:t,url:location.href,user_agent:window.navigator.userAgent,referer:document.referrer},3e3,!1,(function(e){if(e&&0===e.e){n(e.web_id);var t={web_id:e.web_id,user_unique_id:e.web_id,timestamp:Date.now()};o.setItem(a,t)}else n("")}),(function(){n("")}),!0)},Debugger=function(){function e(e,t){this.devToolReady=!1,this.devToolOrigin="*",this.sendAlready=!1,this.collect=e,this.config=t,this.app_id=t.app_id,this.filterEvent=["__bav_page","__bav_beat","__bav_page_statistics","__bav_click","__bav_page_exposure","bav2b_page","bav2b_beat","bav2b_page_statistics","bav2b_click","bav2b_page_exposure","_be_active","predefine_pageview","__profile_set","__profile_set_once","__profile_increment","__profile_unset","__profile_append","predefine_page_alive","predefine_page_close","abtest_exposure"],this.load()}return e.prototype.loadScript=function(e){try{var t=document.createElement("script");t.src=e,t.onerror=function(){console.log("load DevTool render fail")},t.onload=function(){console.log("load DevTool render success")},document.getElementsByTagName("body")[0].appendChild(t)}catch(r){console.log("devTool load fail, "+r.message)}},e.prototype.load=function(){try{this.loadBaseInfo(),this.loadHook();var e=parseUrlQuery(window.location.href);if(!e.open_devtool_web||parseInt(e.app_id)!==this.app_id)return;this.addLintener(),this.loadDebuggerModule(),this.loadDevTool()}catch(t){console.log("debug fail, "+t.message)}},e.prototype.loadDevTool=function(){this.loadScript("https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/devtool/debug-web.js")},e.prototype.loadBaseInfo=function(){var e=this;this.info=[{title:"基本信息",type:1,infoName:{app_id:this.config.app_id,channel:this.config.channel,"上报域名":this.collect.configManager.getDomain(),"SDK版本":SDK_VERSION,"SDK引入方式":SDK_TYPE}},{title:"用户信息",type:2,infoName:{uuid:this.collect.configManager.get("user").user_unique_id||"",web_id:this.collect.configManager.get("user").web_id||"",ssid:"点击获取SSID"}},{title:"公共参数信息",type:2,infoName:{"浏览器":this.collect.configManager.get("browser"),"浏览器版本":this.collect.configManager.get("browser_version"),"平台":this.collect.configManager.get("platform"),"设备型号":this.collect.configManager.get("device_model"),"操作系统":this.collect.configManager.get("os_name"),"操作系统版本":this.collect.configManager.get("os_version"),"屏幕分辨率":this.collect.configManager.get("os_version"),"来源":this.collect.configManager.get("referrer"),"自定义信息":""}},{title:"配置信息",type:3,infoName:{"全埋点":!!this.config.autotrack,"停留时长":!!this.config.enable_stay_duration}},{title:"A/B配置信息",type:4,infoName:{"A/B实验":!!this.config.enable_ab_test}},{title:"客户端信息",type:3,infoName:{"打通开关":!!this.config.Native}}],this.log=[],this.event=[],this.collect.on(Types$1.Ready,(function(){e.info[1].infoName.uuid=e.collect.configManager.get("user").user_unique_id,e.info[1].infoName.web_id=e.collect.configManager.get("user").web_id,e.info[2].infoName["自定义信息"]=JSON.stringify(e.collect.configManager.get("custom")),e.config.enable_ab_test&&(e.info[4].infoName["已曝光VID"]=e.collect.configManager.getAbVersion(),e.info[4].infoName["A/B域名"]=e.config.ab_channel_domain||decodeUrl(AB_DOMAINS[e.config.channel]),e.info[4].infoName["全部配置"]=e.collect.configManager.getAbData()),e.config.Native&&(e.info[5].infoName["是否打通"]=!!e.collect.bridgeReport)}))},e.prototype.loadHook=function(){var e=this;this.collect.on(DebuggerMesssge$1.DEBUGGER_MESSAGE,(function(t){switch(t.type){case DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK:var r={time:t.time,type:t.logType||"sdk",level:t.level,name:t.info,show:!0,levelShow:!0,needDesc:!!t.data};return t.data&&(r.desc={content:JSON.stringify(t.data)}),e.updateLog(r),t.secType&&"AB"===t.secType?(e.info[4].infoName["已曝光VID"]=e.collect.configManager.getAbVersion(),e.info[4].infoName["全部配置"]=e.collect.configManager.getAbData()):"USER"===t.secType&&(e.info[1].infoName.uuid=e.collect.configManager.get("user").user_unique_id,e.info[1].infoName.web_id=e.collect.configManager.get("user").web_id),void e.updateInfo();case DebuggerMesssge$1.DEBUGGER_MESSAGE_EVENT:if(t.data&&t.data.length){var n=t.data[0],i=n.events;if(!i.length)return;i.forEach((function(r){r.checkShow=!0,r.searchShow=!0,r.success=t.status,r.type=-1!==e.filterEvent.indexOf(r.event)?"sdk":"cus",r.type=e.collect.bridgeReport?"bridge":r.type,r.info="","fail"===t.status&&(r.info={message:"code: "+t.code+", msg: "+t.failType})})),e.updateEvent(n)}return}}))},e.prototype.addLintener=function(){var e=this;window.addEventListener("message",(function(t){if(t&&t.data&&"devtool:web:ready"===t.data.type){if(e.devToolOrigin=t.origin,e.devToolReady=!0,e.sendAlready)return;console.log("inittttt"),e.sendData("devtool:web:init",{info:e.info,log:e.log,event:e.event}),e.sendAlready=!0}t&&t.data&&"devtool:web:ssid"===t.data.type&&e.collect.getToken((function(t){e.info[1].infoName.ssid=t.tobid,e.updateInfo()}))}))},e.prototype.sendData=function(e,t){try{var r={type:e,payload:t};(window.opener||window.parent).postMessage(r,this.devToolOrigin)}catch(n){}},e.prototype.updateInfo=function(){this.devToolReady&&this.sendData("devtool:web:info",this.info)},e.prototype.updateLog=function(e){this.devToolReady?this.sendData("devtool:web:log",e):this.log.push(e)},e.prototype.updateEvent=function(e){this.devToolReady?this.sendData("devtool:web:event",e):this.event.push(e)},e.prototype.loadDebuggerModule=function(){var e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.appendChild(document.createTextNode("#debugger-applog-web {\n position: absolute;\n width: 90px;\n height: 30px;\n background: #23c243;\n border-radius: 6px;\n color: #fff;\n font-size: 12px;\n bottom: 5%;\n right: 10%;\n text-align: center;\n line-height: 30px;\n cursor: pointer;\n z-index:100;\n }")),e.appendChild(t);var r=document.createElement("div");r.innerHTML='<div id="debugger-applog-web" class="debugger-applog-web">AppLog调试</div>';var n=document.createElement("div");n.innerHTML='<div id="debugger-container" class="debugger-container"></div>',document.getElementsByTagName("body")[0].appendChild(r),document.getElementsByTagName("body")[0].appendChild(n),document.getElementById("debugger-applog-web").addEventListener("click",(function(){(window.opener||window.parent).postMessage({type:"devtool:web:open-draw"},location.origin)}))},e}(),sdk_type="base";sdk_type="full";var Collector$1=function(){function e(e){this.disableAutoPageView=!1,this.bridgeReport=!1,this.staging=!1,this.pluginInstances=[],this.sended=!1,this.started=!1,this.destroyInstance=!1,this.sdkReady=!1,this.adapters={},this.name=e,this.hook=new Hook,this.remotePlugin=new Map,this.Types=Types$1,this.adapters.fetch=fetch$1,this.adapters.storage=Storage}return e.usePlugin=function(t,r,n){if(r){for(var i=!1,o=0,a=e.plugins.length;o<a;o++)if(e.plugins[o].name===r){e.plugins[o].plugin=t,e.plugins[o].options=n||{},i=!0;break}i||e.plugins.push({name:r,plugin:t,options:n})}else e.plugins.push({plugin:t})},e.prototype.usePlugin=function(e,t,r){e&&("full"===sdk_type&&this.remotePlugin.get(e)?console.info("your sdk version has "+e+" already ~"):t?"string"==typeof t?this.remotePlugin.get(e)||this.remotePlugin.set(e,{src:t,call:r}):this.remotePlugin.get(e)||this.remotePlugin.set(e,{instance:t}):this.remotePlugin.get(e)||this.remotePlugin.set(e,"sdk"))},e.prototype.init=function(t){var r=this;if(this.inited)console.warn("[instance: "+this.name+"], every instance's api: init, can be call only one time!");else if(t&&isObject$1(t))if(t.app_id&&isNumber(t.app_id))if(!t.app_key||isString(t.app_key)){var n=t.channel_type&&"tcpy"===t.channel_type?["sg","va","in"]:["sg","va"];t.channel_domain||-1!==n.indexOf(t.channel)||(console.warn("channel must "+n.join(" ,")+"!!!"),t.channel="sg"),this.inited=!0,this.logger=new Logger(this.name,t.log),this.appBridge=new AppBridge(this,t.enable_native),this.bridgeReport=this.appBridge.bridgeInject(),this.configManager=new ConfigManager(this,t),this.debugger=new Debugger(this,t),this.initConfig=t,this.emit(Types$1.Init),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行INIT",data:t,level:"info",time:Date.now()}),t.disable_auto_pv&&(this.disableAutoPageView=!0),this.bridgeReport||(this.configManager.set({app_id:t.app_id}),this.eventManager=new Event,this.tokenManager=new Token,this.sessionManager=new Session,Promise.all([new Promise((function(e){r.once(Types$1.TokenComplete,(function(){e(!0)}))})),new Promise((function(e){r.once(Types$1.Start,(function(){e(!0)}))}))]).then((function(){try{e.plugins.reduce((function(e,t){var n=t.plugin,i=t.options,o=Object.assign(r.initConfig,i),a=new n;return a.apply(r,o),e.push(a),e}),r.pluginInstances)}catch(n){console.log("load plugin error, "+n.message),r.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:n.message})}r.sdkReady=!0,r.emit(Types$1.Ready),r.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 初始化完成",time:Date.now(),level:"info",data:r.configManager.get("user")}),r.logger.info("appid: "+t.app_id+", userInfo:"+JSON.stringify(r.configManager.get("user"))),r.logger.info("appid: "+t.app_id+", sdk is ready, version is "+SDK_VERSION+", you can report now !!!"),t.disable_auto_pv&&(r.disableAutoPageView=!0);try{(t.enable_ab_test||t.autotrack)&&(window.opener||window.parent).postMessage("[tea-sdk]ready","*")}catch(n){r.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:n.message})}r.pageView(),r.on(Types$1.TokenChange,(function(e){"webid"===e&&r.pageView(),r.logger.info("appid: "+t.app_id+" token change, new userInfo:"+JSON.stringify(r.configManager.get("user"))),r.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 设置了用户信息",time:Date.now(),secType:"USER",level:"info",data:r.configManager.get("user")})})),r.on(Types$1.TokenReset,(function(){r.logger.info("appid: "+t.app_id+" token reset, new userInfo:"+JSON.stringify(r.configManager.get("user"))),r.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 重置了用户信息",time:Date.now(),secType:"USER",level:"info",data:r.configManager.get("user")})})),r.on(Types$1.RouteChange,(function(e){e.init||t.disable_route_report||r.pageView()}));try{(window.opener||window.parent).postMessage("[tea-sdk]ready","*")}catch(n){}})),this.tokenManager.apply(this,t),this.eventManager.apply(this,t),this.sessionManager.apply(this,t)),this.inited=!0}else console.warn("app_key param is error, must be string, please check!");else console.warn("app_id param is error, must be number, please check!");else console.warn("init params error,please check")},e.prototype.config=function(e){if(this.inited)if(e&&isObject$1(e))if(this.bridgeReport)this.appBridge.setConfig(e);else{e._staging_flag&&1===e._staging_flag&&(this.staging=!0),e.disable_auto_pv&&(this.disableAutoPageView=!0,delete e.disable_auto_pv);var t=__assign({},e);if(this.initConfig&&this.initConfig.configPersist){var r=this.configManager.getStore();r&&(t=Object.assign(r,e)),this.configManager.setStore(e)}t.web_id,t.user_unique_id;var n=__rest(t,["web_id","user_unique_id"]);t.hasOwnProperty("web_id")&&this.emit(Types$1.ConfigWebId,t.web_id),t.hasOwnProperty("user_unique_id")&&this.emit(Types$1.ConfigUuid,t.user_unique_id),this.configManager.set(n),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行CONFIG",level:"info",time:Date.now(),data:t})}else console.warn("config params is error, please check");else console.warn("config must be use after function init")},e.prototype.setDomain=function(e){this.configManager&&this.configManager.setDomain(e),this.emit(Types$1.ConfigDomain)},e.prototype.getConfig=function(e){return this.configManager.get(e)},e.prototype.send=function(){this.start()},e.prototype.start=function(){this.inited&&!this.sended&&(this.sended=!0,this.emit(Types$1.Start),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行START",level:"info",time:Date.now()}),this.bridgeReport&&(this.pageView(),this.emit(Types$1.Ready)))},e.prototype.event=function(e,t){var r=this;try{var n=[];if(Array.isArray(e))e.forEach((function(e){var t=r.processEvent(e[0],e[1]||{});t&&n.push(t)}));else{var i=this.processEvent(e,t);if(!i)return;n.push(i)}this.bridgeReport?n.forEach((function(e){var t=e.event,n=e.params;r.appBridge.onEventV3(t,JSON.stringify(n))})):n.length&&(this.emit(Types$1.Event,n),this.emit(Types$1.SessionResetTime))}catch(o){console.warn("something error, please check"),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:o.message})}},e.prototype.beconEvent=function(e,t){if(Array.isArray(e))console.warn("beconEvent not support batch report, please check");else{var r=[],n=this.processEvent(e,t||{});n&&(r.push(n),r.length&&(this.emit(Types$1.BeconEvent,r),this.emit(Types$1.SessionResetTime)))}},e.prototype.processEvent=function(e,t){void 0===t&&(t={});try{if(!e)return this.logger.warn("eventName is null, please check"),null;var r=e;/^event\./.test(e)&&(r=e.slice(6));var n=t;"object"!=typeof n&&(n={}),n.profile?delete n.profile:n.event_index=getIndex();var i=void 0;return n.local_ms?(i=n.local_ms,delete n.local_ms):i=+new Date,{event:r,params:n,local_time_ms:i,is_bav:this.initConfig&&this.initConfig.autotrack?1:0}}catch(o){return this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:o.message}),{event:e,params:t}}},e.prototype.filterEvent=function(e){this.eventFilter=e},e.prototype.on=function(e,t){this.hook.on(e,t)},e.prototype.once=function(e,t){this.hook.once(e,t)},e.prototype.off=function(e,t){this.hook.off(e,t)},e.prototype.emit=function(e,t,r){this.hook.emit(e,t,r)},e.prototype.set=function(e){this.hook.set(e)},e.prototype.pageView=function(){this.disableAutoPageView||this.predefinePageView()},e.prototype.predefinePageView=function(e){void 0===e&&(e={});var t={title:document.title||location.pathname,url:location.href,url_path:location.pathname,time:Date.now(),referrer:window.document.referrer,$is_first_time:""+this.configManager.is_first_time},r=__assign({},t,e);this.event("predefine_pageview",r)},e.prototype.clearEventCache=function(){this.emit(Types$1.CleanEvents)},e.prototype.setWebIDviaUnionID=function(e){if(e){var t=hashCode(e);this.config({web_id:""+t,wechat_unionid:e}),this.emit(Types$1.CustomWebId)}},e.prototype.setWebId=function(e){this.config({web_id:""+e})},e.prototype.setWebIDviaOpenID=function(e){if(e){var t=hashCode(e);this.config({web_id:""+t,wechat_openid:e}),this.emit(Types$1.CustomWebId)}},e.prototype.setNativeAppId=function(e){this.bridgeReport&&this.appBridge.setNativeAppId(e)},e.prototype.resetStayDuration=function(e,t,r){this.emit(Types$1.ResetStay,{url_path:e,title:t,url:r},Types$1.Stay)},e.prototype.resetStayParams=function(e,t,r){void 0===e&&(e=""),void 0===t&&(t=""),void 0===r&&(r=""),this.emit(Types$1.SetStay,{url_path:e,title:t,url:r},Types$1.Stay)},e.prototype.getToken=function(e,t){var r=this,n=!1,i=function(t){if(!n){n=!0;var i=r.configManager.get().user;return t&&(i.tobid=t,i["diss".split("").reverse().join("")]=t),e(__assign({},i))}},o=function(){r.tokenManager.getTobId().then((function(e){i(e)}))};this.sdkReady?o():(t&&setTimeout((function(){i()}),t),this.on(Types$1.Ready,(function(){o()})))},e.prototype.profileSet=function(e){this.bridgeReport?this.appBridge.profileSet(JSON.stringify(e)):this.emit(Types$1.ProfileSet,e,Types$1.Profile),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行profileSet",level:"info",time:Date.now(),data:e})},e.prototype.profileSetOnce=function(e){this.bridgeReport?this.appBridge.profileSetOnce(JSON.stringify(e)):this.emit(Types$1.ProfileSetOnce,e,Types$1.Profile),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行profileSetOnce",level:"info",time:Date.now(),data:e})},e.prototype.profileIncrement=function(e){this.bridgeReport?this.appBridge.profileIncrement(JSON.stringify(e)):this.emit(Types$1.ProfileIncrement,e,Types$1.Profile),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行profileIncrement",level:"info",time:Date.now(),data:e})},e.prototype.profileUnset=function(e){this.bridgeReport?this.appBridge.profileUnset(e):this.emit(Types$1.ProfileUnset,e,Types$1.Profile),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行profileUnset",level:"info",time:Date.now(),data:e})},e.prototype.profileAppend=function(e){this.bridgeReport?this.appBridge.profileAppend(JSON.stringify(e)):this.emit(Types$1.ProfileAppend,e,Types$1.Profile),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行profileAppend",level:"info",time:Date.now(),data:e})},e.prototype.setExternalAbVersion=function(e){this.emit(Types$1.AbExternalVersion,"string"==typeof e&&e?(""+e).trim():null,Types$1.Ab)},e.prototype.getVar=function(e,t,r){this.emit(Types$1.AbVar,{name:e,defaultValue:t,callback:r},Types$1.Ab)},e.prototype.getABconfig=function(e,t){this.emit(Types$1.AbConfig,{params:e,callback:t},Types$1.Ab)},e.prototype.getAbSdkVersion=function(){return this.configManager.getAbVersion()},e.prototype.onAbSdkVersionChange=function(e){var t=this;return this.emit(Types$1.AbVersionChangeOn,e,Types$1.Ab),function(){t.emit(Types$1.AbVersionChangeOff,e,Types$1.Ab)}},e.prototype.offAbSdkVersionChange=function(e){this.emit(Types$1.AbVersionChangeOff,e,Types$1.Ab)},e.prototype.openOverlayer=function(){this.emit(Types$1.AbOpenLayer,"",Types$1.Ab)},e.prototype.closeOverlayer=function(){this.emit(Types$1.AbCloseLayer,"",Types$1.Ab)},e.prototype.getAllVars=function(e){this.emit(Types$1.AbAllVars,e,Types$1.Ab)},e.prototype.sessionRecordStart=function(){this.emit(Types$1.SessionRecordStart,Types$1.sessionRecord)},e.prototype.sessionRecordPause=function(){this.emit(Types$1.SessionRecordPause,Types$1.sessionRecord)},e.prototype.sessionRecordEnd=function(){this.emit(Types$1.SessionRecordEnd,Types$1.sessionRecord)},e.prototype.sessionRecordReport=function(e){this.emit(Types$1.SessionRecordReport,{callback:e},Types$1.sessionRecord)},e.prototype.autoInitializationRangers=function(e){AutoBase(e)},e.prototype.destoryInstace=function(){this.destroyInstance||(this.destroyInstance=!0,this.off(Types$1.TokenComplete))},e.plugins=[],e}(),STYLE_ID="__rangers_ab_style__";function openOverlayer(){if(!document.getElementById(STYLE_ID)){var e="body { opacity: 0 !important; }",t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.id=STYLE_ID,r.type="text/css",r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e)),t.appendChild(r)}}function closeOverlayer(){var e=document.getElementById(STYLE_ID);e&&e.parentElement.removeChild(e)}var msgQueueMap={},allowdOrigins=[],addAllowdOrigin=function(e){e.length&&e.forEach((function(e){allowdOrigins.push(e)}))};function dispatchMsg(e,t,r,n){var i=e&&e.source||window.opener||window.parent,o=e&&e.origin||n||"*",a={type:t,payload:r};i.postMessage(JSON.stringify(a),o)}function receiveMsg(e,t){msgQueueMap[e]=msgQueueMap[e]||[],msgQueueMap[e].push(t)}function processMsg(e){if(allowdOrigins.some((function(e){return"*"===e}))||allowdOrigins.some((function(t){return e.origin.indexOf(t)>-1}))){var t=e.data;if("string"==typeof e.data)try{t=JSON.parse(e.data)}catch(i){t=void 0}if(!t)return;var r=t.type,n=t.payload;msgQueueMap[r]&&msgQueueMap[r].forEach((function(t){"function"==typeof t&&t(e,n)}))}}function init(e,t){var r=__assign({},e);delete r.filter,(window.opener||window.parent).postMessage({type:"tea:sdk:info",config:r,version:t},"*"),window.addEventListener("message",processMsg,!1)}var VISUAL_URL="",isLoaded=!1;function loadEditorScript(e){var t=e.event,r=e.editorUrl;e.collectInstance,e.fromSession,isLoaded||(isLoaded=!0,loadScript(r,(function(){dispatchMsg(t,"abEditorScriptloadSuccess")}),(function(){t&&dispatchMsg(t,"abEditorScriptloadError"),isLoaded=!1})))}function readyToLoadEditor(e,t){window.TEAVisualEditor=window.TEAVisualEditor||{},addAllowdOrigin(["*"]);var r,n="";init(t,SDK_VERSION);var i="";try{var o=window.performance.getEntriesByType("resource");if(o&&o.length&&(o.forEach((function(e){"script"===e.initiatorType&&e.name&&-1!==e.name.indexOf("collect")&&(i=e.name)})),i||document.currentScript&&(i=document.currentScript.src),i&&(r=i.split("/"))&&r.length)){n="https:/";for(var a=2;a<r.length&&a!==r.length-1;a++)n=n+"/"+r[a];n+="/visual-ab-core"}}catch(s){}receiveMsg("tea:openVisualABEditor",(function(r){var i=r.data;if("string"==typeof r.data)try{i=JSON.parse(r.data)}catch(s){i=void 0}if(i){var o=i.lang;if(i.appId!==t.app_id)return dispatchMsg(r,"appIdError"),void console.error("abtest appid is not belong the page appid please check");var a=i.version;VISUAL_URL=a&&n?n+(a?"."+a:".1.0.1")+".js?query="+Date.now():VISUAL_AB_CORE+"?query="+Date.now(),window.TEAVisualEditor.lang=o,window.TEAVisualEditor.__ab_domin=t.channel_domain||"",loadEditorScript({event:r,editorUrl:VISUAL_URL,collectInstance:e})}}))}var loadMuiltlink=function(e,t){window.TEAVisualEditor=window.TEAVisualEditor||{},window.TEAVisualEditor.appId=t.app_id,receiveMsg("tea:openTesterEventInspector",(function(t){var r=t.data;if("string"==typeof t.data)try{r=JSON.parse(t.data)}catch(a){r=void 0}if(r){var n=r.referrer,i=r.lang,o=r.appId;window.TEAVisualEditor.__editor_ajax_domain=n||"",window.TEAVisualEditor.__ab_appId=o||"",window.TEAVisualEditor.lang=i||"",loadEditorScript({event:t,editorUrl:VISUAL_URL_INSPECTOR+".js?query="+Date.now(),collectInstance:e})}}))},loadVisual=function(e){window.TEAVisualEditor=window.TEAVisualEditor||{},window.TEAVisualEditor.__ab_config=e,loadScript(VISUAL_AB_LOADER+"?query="+Date.now(),(function(){console.log("load visual render success")}),(function(){console.log("load visual render fail")}))},CallbackType;!function(e){e[e.Var=0]="Var",e[e.All=1]="All"}(CallbackType||(CallbackType={}));var STORAGE_EXPRIRE=2592e6,API="/service/2/abtest_config/",Ab=function(){function e(){this.fetchStatus="no",this.refreshFetchStatus="complete",this.versions=[],this.extVersions=[],this.mulilinkVersions=[],this.enable_multilink=!1,this.enable_ab_visual=!1,this.editMode=!1,this.callbacks=[],this.data=null,this.changeListener=new Map,this.readyStatus=!1,this.exposureCache=[]}return e.prototype.apply=function(e,t){var r=this;if(this.collect=e,this.config=t,this.config.enable_ab_test){var n=t.enable_multilink,i=t.ab_channel_domain,o=t.enable_ab_visual,a=t.ab_cross,s=t.ab_cookie_domain,l=i||decodeUrl(AB_DOMAINS[t.channel||"sg"]),c=e.adapters,u=c.storage,h=c.fetch;this.cacheStorgae=new u(!1),this.fetch=h,this.enable_multilink=n,this.enable_ab_visual=o,this.abKey="__tea_sdk_ab_version_"+t.app_id,this.ab_cross=a,this.ab_cookie_domain=s||"",this.fetchUrl=""+l+API,this.reportUrl=""+e.configManager.getUrl("event"),this.exposureLimit=t.exposure_limit||20,this.ab_batch_time=t.ab_batch_time||500;var d=this.collect.Types;this.types=d,this.collect.on(d.TokenChange,(function(e){"uuid"===e&&r.readyStatus&&(r.clearCache(),r.fetchAB())})),this.collect.on(d.AbVar,(function(e){var t=e.name,n=e.defaultValue,i=e.callback;r.getVar(t,n,i)})),this.collect.on(d.AbAllVars,(function(e){r.getAllVars(e)})),this.collect.on(d.AbConfig,(function(e){var t=e.params,n=e.callback;r.getABconfig(t,n)})),this.collect.on(d.AbExternalVersion,(function(e){r.setExternalAbVersion(e)})),this.collect.on(d.AbOpenLayer,(function(){r.openOverlayer()})),this.collect.on(d.AbCloseLayer,(function(){r.closeOverlayer()})),this.collect.on(d.AbVersionChangeOn,(function(e){r.changeListener.set(e,e)})),this.collect.on(d.AbVersionChangeOff,(function(e){r.changeListener.get(e)&&r.changeListener.delete(e)})),this.loadMode(),(this.enable_ab_visual||this.enable_multilink)&&this.openOverlayer(this.config.multilink_timeout_ms||500),this.checkLocal(),this.ready("ab"),this.readyStatus||(this.fetchAB(),this.readyStatus=!0),this.collect.emit(d.AbReady)}},e.prototype.ready=function(e){var t=this;if(this.collect.set(e),this.collect.hook._hooksCache.hasOwnProperty(e)){var r=this.collect.hook._hooksCache[e];if(!Object.keys(r).length)return;var n=function(e){r[e].length&&r[e].forEach((function(r){t.collect.hook.emit(e,r)}))};for(var i in r)n(i)}},e.prototype.loadMode=function(){var e=getIframeUrl(),t="";if(e){var r=e.scenario,n=e.href;r?(this.editMode=!0,t=r):!n||-1===n.indexOf("datatester")&&-1===n.indexOf("visual-editor")||(this.editMode=!0,t="visual-editor")}this.enable_ab_visual&&(readyToLoadEditor(this.collect,this.config),"visual-editor"===t)?this.collect.destoryInstace():this.enable_multilink&&loadMuiltlink(this.collect,this.config)},e.prototype.checkLocal=function(){var e=this.getABCache(),t=e.ab_version,r=e.ab_ext_version,n=e.ab_version_multilink,i=e.data,o=this.checkFromUrl();o?this.mulilinkVersions.push(o):this.mulilinkVersions=n||[],this.extVersions=r||[],this.versions=t||[],this.data=i;var a=this.versions.concat(this.extVersions);this.enable_multilink&&(a=a.concat(this.mulilinkVersions)),this.configVersions(a.join(","))},e.prototype.checkFromUrl=function(){var e=parseUrlQuery(window.location.href);return e&&e.vid?e.vid:""},e.prototype.updateVersions=function(){var e=this.extVersions.length?this.versions.concat(this.extVersions):this.versions;this.enable_multilink&&(e=e.concat(this.mulilinkVersions)),this.configVersions(e.join(",")),this.updateABCache(),this.changeListener.size>0&&this.changeListener.forEach((function(t){"function"==typeof t&&t(e)}))},e.prototype.configVersions=function(e){this.collect.configManager.setAbVersion(e)},e.prototype.getVar=function(e,t,r){if(!e)throw new Error("variable must not be empty");if(void 0===t)throw new Error("variable no default value");if("function"!=typeof r)throw new Error("callback must be a function");var n={name:e,defaultValue:t,callback:r,type:CallbackType.Var};"complete"===this.fetchStatus&&"complete"===this.refreshFetchStatus?this.getRealVar(n,e):this.callbacks.push(n)},e.prototype.getRealVar=function(e,t){var r=e.name,n=e.defaultValue,i=e.callback,o=this.data;if(o){if(isObject$1(o[r])){var a=o[r].vid;return"$ab_url"===t?this.mulilinkVersions.includes(a)||this.mulilinkVersions.push(a):this.versions.includes(a)||this.versions.push(a),this.updateVersions(),this.fechEvent(a,t,n),i(o[r].val),void this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,secType:"AB",info:"SDK 曝光了实验"+r,level:"info",time:Date.now(),data:o[r]})}this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,secType:"AB",info:"SDK 调用getVar",level:"info",time:Date.now(),data:n}),i(n)}else i(n)},e.prototype.getAllVars=function(e){if("function"!=typeof e)throw new Error("callback must be a function");var t={callback:e,type:CallbackType.All};"complete"===this.fetchStatus&&"complete"===this.refreshFetchStatus?this.getRealAllVars(t):this.callbacks.push(t)},e.prototype.getRealAllVars=function(e){(0,e.callback)(this.data?JSON.parse(JSON.stringify(this.data)):{}),this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,secType:"AB",info:"SDK 调用getAllVars",level:"info",time:Date.now(),data:this.data})},e.prototype.fechEvent=function(e,t,r){try{if(this.config.disable_track_event)return;if(!e)return;var n=this.collect.configManager.get(),i=n.header,o=n.user,a=this.getABCache();if(a&&a.uuid&&a.uuid!==o.user_unique_id)return;var s={event:"abtest_exposure",ab_sdk_version:""+e,params:JSON.stringify({app_id:this.config.appId,ab_url:"$ab_url"===t?r:window.location.href}),local_time_ms:Date.now()};i.custom=JSON.stringify(i.custom);var l={events:[s],user:o,header:i};"$ab_url"===t&&window.navigator.sendBeacon?window.navigator.sendBeacon(this.reportUrl,JSON.stringify([l])):this.reportExposure(l)}catch(c){this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:c.message})}},e.prototype.reportExposure=function(e){var t=this;this.exposureCache.push(e),this.reportTimeout&&clearTimeout(this.reportTimeout),this.exposureCache.length>=this.exposureLimit?this.report():this.reportTimeout=setTimeout((function(){t.report(),clearTimeout(t.reportTimeout)}),this.ab_batch_time)},e.prototype.report=function(){var e=this;this.fetch(this.reportUrl,this.exposureCache,2e4),this.exposureCache.forEach((function(t){e.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_EVENT,info:"埋点上报成功",time:Date.now(),data:[t],code:200,status:"success"})})),this.exposureCache=[]},e.prototype.setExternalAbVersion=function(e){this.extVersions=[e],this.updateVersions()},e.prototype.getABconfig=function(e,t){var r=Object.keys(e);r&&r.length&&this.collect.configManager.set(e),this.fetchAB(t)},e.prototype.get=function(e){if(this.ab_cross){var t=this.cacheStorgae.getCookie(e,this.ab_cookie_domain);return t?JSON.parse(t):null}return this.cacheStorgae.getItem(e)},e.prototype.set=function(e,t){this.ab_cross?this.cacheStorgae.setCookie(e,t,STORAGE_EXPRIRE,this.ab_cookie_domain):this.cacheStorgae.setItem(e,t),this.collect.configManager.setAbCache(t)},e.prototype.getABCache=function(e){var t={ab_version:[],ab_ext_version:[],ab_version_multilink:[],data:null,timestamp:+new Date,uuid:""};return t=this.get(this.abKey)||t,Date.now()-t.timestamp>=STORAGE_EXPRIRE?(this.cacheStorgae.removeItem(this.abKey),null):e?t[e]:t},e.prototype.updateABCache=function(){var e=this.getABCache();e.ab_version_multilink=this.mulilinkVersions,e.ab_ext_version=this.extVersions,e.ab_version=this.versions,e.timestamp=Date.now(),this.set(this.abKey,e)},e.prototype.setAbCache=function(e){var t=this.getABCache();t.data=this.data,t.uuid=e,t.timestamp=Date.now(),this.set(this.abKey,t)},e.prototype.clearCache=function(){this.refreshFetchStatus="ing",this.data={},this.extVersions=[],this.mulilinkVersions=[],this.versions=[]},e.prototype.openOverlayer=function(e){var t=this;if(openOverlayer(),e)var r=setTimeout((function(){t.closeOverlayer(),clearTimeout(r)}),e)},e.prototype.closeOverlayer=function(){closeOverlayer()},e.prototype.fetchComplete=function(e,t){var r=this;if(e&&"[object Object]"==Object.prototype.toString.call(e)){this.data=e,this.setAbCache(t);var n=[];Object.keys(e).forEach((function(t){var r=e[t].vid;r&&n.push(r)})),this.versions=this.versions.filter((function(e){return n.includes(e)}));var i=e.$ab_url,o=e.$ab_modification;if(o&&o.val&&this.enable_ab_visual){if(this.collect.destroyInstance)return;this.getVar("$ab_modification",window.location.href,(function(){loadVisual(o.val),r.closeOverlayer()}))}else if(i&&this.enable_multilink){this.mulilinkVersions=this.mulilinkVersions.filter((function(e){return n.includes(e)}));var a=i.val,s=i.vid;a&&s&&this.getVar("$ab_url",a,(function(){r.editMode||(a!==window.location.href?setTimeout((function(){if(!r.collect.destroyInstance){var e=""+a;e=-1===e.indexOf("http")?"https://"+e:e,parseURL(e).host!==location.host?e=e+"&vid="+s:window.history.replaceState("","",e),window.location.href=e}}),100):r.closeOverlayer())}))}this.updateVersions()}else this.closeOverlayer();this.callbacks.forEach((function(e){return r[e.type===CallbackType.Var?"getRealVar":"getRealAllVars"](e,"")})),this.callbacks=[]},e.prototype.fetchAB=function(e){var t=this,r=this.collect.configManager.get(),n={header:__assign({aid:this.config.app_id},r.user||{},r.header||{},{ab_sdk_version:this.collect.configManager.getAbVersion(),ab_url:window.location.href})};this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 发起AB实验请求",level:"info",logType:"fetch",time:Date.now(),data:n}),this.fetch(this.fetchUrl,n,this.config.ab_timeout||3e3,!1,(function(n){t.fetchStatus="complete",t.refreshFetchStatus="complete";var i=n.data;"success"===n.message?(t.fetchComplete(i,r.user.user_unique_id),e&&e(i)):(t.fetchComplete(null,r.user.user_unique_id),e&&e(null)),t.collect.emit(t.types.AbComplete,i),t.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,secType:"AB",info:"AB实验请求成功",level:"info",logType:"fetch",time:Date.now(),data:i})}),(function(){t.fetchStatus="complete",t.refreshFetchStatus="complete",t.fetchComplete(null,r.user.user_unique_id),t.collect.emit(t.types.AbTimeout),e&&e(null),t.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,secType:"AB",info:"AB实验请求网络异常",level:"error",logType:"fetch",time:Date.now()})}))},e.prototype.filterUrl=function(e){try{var t="";-1!==e.indexOf("&multilink=true")?t="&multilink=true[\0-ÿ]*":-1!==e.indexOf("?multilink=true")&&(t="\\?multilink=true[\0-ÿ]*");var r=new RegExp(t,"g");e=e.replace(r,"")}catch(n){}return e},e}(),Et=function(){function e(){}return e.prototype.apply=function(e,t){var r=this,n=e.adapters.fetch;if(t.event_verify_url)if("string"==typeof t.event_verify_url){if(this.url=t.event_verify_url+"/v1/list_test",this.url){var i=e.Types;e.on(i.SubmitBefore,(function(e){n(r.url,e,3e4)}))}}else console.log("please use correct et_test url")},e}(),Alive=function(){function e(e,t){this.maxDuration=432e5,this.aliveDTime=6e4,this.options={aliveName:"predefine_page_alive",params:{}},this.collect=e,this.config=t,this.pageStartTime=Date.now(),this.sessionStartTime=this.pageStartTime,this.timerHandler=null,isObject$1(t.enable_stay_duration)&&(this.options=Object.assign(this.options,t.enable_stay_duration))}return e.prototype.setParams=function(e,t,r){this.set_path=e,this.set_url=r,this.set_title=t},e.prototype.enable=function(e,t,r){this.url_path=e,this.url=r,this.title=t,this.disableCallback=this.enablePageAlive()},e.prototype.disable=function(){this.disableCallback(),this.pageStartTime=Date.now()},e.prototype.sendEvent=function(e,t){void 0===t&&(t=!1);var r=t?this.aliveDTime:Date.now()-this.sessionStartTime;r<0||r>this.aliveDTime||Date.now()-this.pageStartTime>this.maxDuration||(this.collect.beconEvent(this.options.aliveName,__assign({url_path:this.getParams("url_path"),title:this.getParams("title"),url:this.getParams("url"),duration:r,is_support_visibility_change:isSupVisChange(),startTime:this.sessionStartTime,hidden:document.visibilityState,leave:e},this.options.params)),this.sessionStartTime=Date.now())},e.prototype.getParams=function(e){switch(e){case"url_path":return this.set_path||this.url_path||location.pathname;case"title":return this.set_title||this.title||document.title||location.pathname;case"url":return this.set_url||this.url||location.href}},e.prototype.setUpTimer=function(){var e=this;return this.timerHandler&&clearInterval(this.timerHandler),setInterval((function(){Date.now()-e.sessionStartTime>e.aliveDTime&&e.sendEvent(!1,!0)}),1e3)},e.prototype.visibilitychange=function(){"hidden"===document.visibilityState?this.timerHandler&&(clearInterval(this.timerHandler),this.sendEvent(!1)):"visible"===document.visibilityState&&(this.sessionStartTime=Date.now(),this.timerHandler=this.setUpTimer())},e.prototype.beforeunload=function(){document.hidden||this.sendEvent(!0)},e.prototype.enablePageAlive=function(){var e=this;this.timerHandler=this.setUpTimer();var t=this.visibilitychange.bind(this),r=this.beforeunload.bind(this);return document.addEventListener("visibilitychange",t),beforePageUnload(r),function(){e.beforeunload(),document.removeEventListener("visibilitychange",t),window.removeEventListener("beforeunload",r),window.removeEventListener("pagehide",r)}},e}(),Close=function(){function e(e,t){var r=this;this.maxDuration=432e5,this.aliveDTime=6e4,this.options={closeName:"predefine_page_close",params:{}},this.visibilitychange=function(){"hidden"===document.visibilityState?r.activeEndTime=Date.now():"visible"===document.visibilityState&&(r.activeEndTime&&(r.totalTime+=r.activeEndTime-r.activeStartTime,r.activeTimes+=1),r.activeEndTime=void 0,r.activeStartTime=Date.now())},this.beforeunload=function(){if(r.totalTime+=(r.activeEndTime||Date.now())-r.activeStartTime,r.config.autotrack)try{window.sessionStorage.setItem("_tea_cache_duration",JSON.stringify({duration:r.totalTime,page_title:document.title||location.pathname}))}catch(e){}r.sendEventPageClose()},this.collect=e,this.config=t,this.maxDuration=t.maxDuration||864e5,this.pageStartTime=Date.now(),isObject$1(t.enable_stay_duration)&&(this.options=Object.assign(this.options,t.enable_stay_duration)),this.resetData()}return e.prototype.setParams=function(e,t,r){this.set_path=e,this.set_url=r,this.set_title=t},e.prototype.enable=function(e,t,r){this.url_path=e,this.url=r,this.title=t,this.disableCallback=this.enablePageClose()},e.prototype.disable=function(){this.disableCallback()},e.prototype.resetData=function(){this.activeStartTime=void 0===this.activeStartTime?this.pageStartTime:Date.now(),this.activeEndTime=void 0,this.activeTimes=1,this.totalTime=0},e.prototype.sendEventPageClose=function(){var e=Date.now()-this.pageStartTime;this.totalTime<0||e<0||this.totalTime>=this.maxDuration||(this.collect.beconEvent(this.options.closeName,__assign({url_path:this.getParams("url_path"),title:this.getParams("title"),url:this.getParams("url"),active_times:this.activeTimes,duration:this.totalTime,total_duration:e,is_support_visibility_change:isSupVisChange()},this.options.params)),this.pageStartTime=Date.now(),this.resetData())},e.prototype.getParams=function(e){switch(e){case"url_path":return this.set_path||this.url_path||location.pathname;case"title":return this.set_title||this.title||document.title||location.pathname;case"url":return this.set_url||this.url||location.href}},e.prototype.enablePageClose=function(){var e=this,t=this.visibilitychange.bind(this),r=this.beforeunload.bind(this);return document.addEventListener("visibilitychange",t),beforePageUnload(r),function(){e.beforeunload(),document.removeEventListener("visibilitychange",t),window.removeEventListener("beforeunload",r),window.removeEventListener("pagehide",r)}},e}(),Stay=function(){function e(){}return e.prototype.apply=function(e,t){var r=this;if(this.collect=e,this.config=t,this.config.enable_stay_duration){this.title=document.title||location.pathname,this.url=location.href,this.url_path=location.pathname,this.pageAlive=new Alive(e,t),this.pageClose=new Close(e,t);var n=this.collect.Types;this.collect.on(n.ResetStay,(function(e){var t=e.url_path,n=e.title,i=e.url;r.resetStayDuration(t,n,i)})),this.collect.on(n.RouteChange,(function(e){e.init||t.disable_route_report||r.resetStayDuration()})),this.collect.on(n.SetStay,(function(e){var t=e.url_path,n=e.title,i=e.url;r.setStayParmas(t,n,i)})),this.enable(this.url_path,this.title,this.url),this.ready(n.Stay),this.collect.emit(n.StayReady)}},e.prototype.ready=function(e){var t=this;if(this.collect.set(e),this.collect.hook._hooksCache.hasOwnProperty(e)){var r=this.collect.hook._hooksCache[e];if(!Object.keys(r).length)return;var n=function(e){r[e].length&&r[e].forEach((function(r){t.collect.hook.emit(e,r)}))};for(var i in r)n(i)}},e.prototype.enable=function(e,t,r){this.pageAlive.enable(e,t,r),this.pageClose.enable(e,t,r)},e.prototype.disable=function(){this.pageAlive.disable(),this.pageClose.disable()},e.prototype.setStayParmas=function(e,t,r){void 0===e&&(e=""),void 0===t&&(t=""),void 0===r&&(r=""),this.pageAlive.setParams(e,t,r),this.pageClose.setParams(e,t,r),this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行 resetStayParams",level:"info",time:Date.now(),data:{url_path:e,title:t,url:r}})},e.prototype.reset=function(e,t,r){this.disable(),this.enable(e,t,r)},e.prototype.resetStayDuration=function(e,t,r){this.reset(e,t,r),this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行 resetStayDuration",level:"info",time:Date.now(),data:{url_path:e,title:t,url:r}})},e}(),Profile=function(){function e(){}return e.prototype.apply=function(e,t){var r=this;this.collect=e,this.config=t,this.duration=6e4,this.reportUrl=e.configManager.getDomain()+"/profile/list";var n=e.Types,i=e.adapters.fetch;this.eventCheck=new EventCheck(e,t),this.fetch=i,this.cache={},this.collect.on(n.ProfileSet,(function(e){r.setProfile(e)})),this.collect.on(n.ProfileSetOnce,(function(e){r.setOnceProfile(e)})),this.collect.on(n.ProfileUnset,(function(e){r.unsetProfile(e)})),this.collect.on(n.ProfileIncrement,(function(e){r.incrementProfile(e)})),this.collect.on(n.ProfileAppend,(function(e){r.appendProfile(e)})),this.collect.on(n.ProfileClear,(function(){r.cache={}})),this.ready(n.Profile)},e.prototype.ready=function(e){var t=this;if(this.collect.set(e),this.collect.hook._hooksCache.hasOwnProperty(e)){var r=this.collect.hook._hooksCache[e];if(!Object.keys(r).length)return;var n=function(e){r[e].length&&r[e].forEach((function(r){t.collect.hook.emit(e,r)}))};for(var i in r)n(i)}},e.prototype.report=function(e,t){void 0===t&&(t={});try{if(this.config.disable_track_event)return;var r=[];r.push(this.collect.processEvent(e,t));var n=this.collect.eventManager.merge(r);this.fetch(this.reportUrl,n),this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_EVENT,info:"埋点上报成功",time:Date.now(),data:n,code:200,status:"success"})}catch(i){this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:i.message})}},e.prototype.setProfile=function(e){var t=this.formatParams(e);t&&Object.keys(t).length&&(this.pushCache(t),this.report("__profile_set",__assign({},t,{profile:!0})))},e.prototype.setOnceProfile=function(e){var t=this.formatParams(e,!0);t&&Object.keys(t).length&&(this.pushCache(t),this.report("__profile_set_once",__assign({},t,{profile:!0})))},e.prototype.incrementProfile=function(e){e?this.report("__profile_increment",__assign({},e,{profile:!0})):console.warn("please check the params, must be object!!!")},e.prototype.unsetProfile=function(e){if(e){var t={};t[e]="1",this.report("__profile_unset",__assign({},t,{profile:!0}))}else console.warn("please check the key, must be string!!!")},e.prototype.appendProfile=function(e){if(e){var t={};for(var r in e)"string"==typeof e[r]||"Array"===Object.prototype.toString.call(e[r]).slice(8,-1)?t[r]=e[r]:console.warn("please check the value of param: "+r+", must be string or array !!!");Object.keys(t).length&&this.report("__profile_append",__assign({},t,{profile:!0}))}else console.warn("please check the params, must be object!!!")},e.prototype.pushCache=function(e){var t=this;Object.keys(e).forEach((function(r){t.cache[r]={val:t.clone(e[r]),timestamp:Date.now()}}))},e.prototype.formatParams=function(e,t){var r=this;void 0===t&&(t=!1);try{if(!e||"[object Object]"!==Object.prototype.toString.call(e))return void console.warn("please check the params type, must be object !!!");var n={};for(var i in e)"string"==typeof e[i]||"number"==typeof e[i]||"Array"===Object.prototype.toString.call(e[i]).slice(8,-1)?n[i]=e[i]:console.warn("please check the value of params:"+i+", must be string,number,Array !!!");var o=Object.keys(n);if(!o.length)return;if(!this.eventCheck.checkEventParams(n))return;var a=Date.now();return o.filter((function(n){var i=r.cache[n];return t?!i:!(i&&r.compare(i.val,e[n])&&a-i.timestamp<r.duration)})).reduce((function(e,t){return e[t]=n[t],e}),{})}catch(s){this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:s.message}),console.log("error")}},e.prototype.compare=function(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch(r){return this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:r.message}),!1}},e.prototype.clone=function(e){try{return JSON.parse(JSON.stringify(e))}catch(t){return this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:t.message}),e}},e.prototype.unReady=function(){console.warn("sdk is not ready, please use this api after start")},e}(),HeartBeat=function(){function e(){var e=this;this.setInterval=function(){e.clearIntervalFunc=selfAdjust((function(){e.isSessionhasEvent&&e.endCurrentSession()}),e.sessionInterval)},this.clearInterval=function(){e.clearIntervalFunc&&e.clearIntervalFunc()}}return e.prototype.apply=function(e,t){var r=this;if(this.collect=e,!t.disable_heartbeat){this.sessionInterval=6e4,this.startTime=0,this.lastTime=0,this.setInterval();var n=this.collect.Types;this.collect.on(n.SessionReset,(function(){r.process()}))}},e.prototype.endCurrentSession=function(){this.collect.event("_be_active",{start_time:this.startTime,end_time:this.lastTime,url:window.location.href,referrer:window.document.referrer,title:document.title||location.pathname}),this.isSessionhasEvent=!1,this.startTime=0},e.prototype.process=function(){this.isSessionhasEvent||(this.isSessionhasEvent=!0,this.startTime=+new Date);var e=this.lastTime||+new Date;this.lastTime=+new Date,this.lastTime-e>this.sessionInterval&&(this.clearInterval(),this.endCurrentSession(),this.setInterval())},e}(),Monitor=function(){function e(){}return e.prototype.apply=function(e,t){var r=this;if(this.collect=e,this.config=t,!this.config.channel_domain&&!t.disable_track_event&&!t.disable_sdk_monitor){var n=e.adapters.fetch;this.fetch=n,this.url=e.configManager.getUrl("event");var i=this.collect.Types;this.collect.on(i.Ready,(function(){r.sdkOnload()})),this.collect.on(i.SubmitError,(function(e){var t=e.type,n=e.eventData,i=e.errorCode;"f_data"===t&&r.sdkError(n,i)}))}},e.prototype.sdkOnload=function(){var e=this;try{var t=this.collect.configManager.get(),r=t.header,n=t.user,i=r.app_id,o=r.app_name,a=r.sdk_version,s=n.web_id,l={events:[{event:"onload",params:JSON.stringify({app_id:i,app_name:o||"",sdk_version:a,sdk_type:SDK_TYPE,sdk_config:this.config,sdk_desc:"TOC_OVERSEA"}),local_time_ms:Date.now()}],user:{user_unique_id:s},header:{}};setTimeout((function(){e.fetch(e.url,[l],3e4,!1,(function(){}),(function(){}),"566f58151b0ed37e")}),16)}catch(c){}},e.prototype.sdkError=function(e,t){var r=this;try{var n=e[0],i=n.user,o=n.header,a=[];e.forEach((function(e){e.events.forEach((function(e){a.push(e)}))}));var s={events:a.map((function(e){return{event:"on_error",params:JSON.stringify({error_code:t,app_id:o.app_id,app_name:o.app_name||"",error_event:e.event,sdk_version:o.sdk_version,local_time_ms:e.local_time_ms,tea_event_index:Date.now(),params:e.params,header:JSON.stringify(o),user:JSON.stringify(i)}),local_time_ms:Date.now()}})),user:{user_unique_id:i.user_unique_id},header:{}};setTimeout((function(){r.fetch(r.url,[s],3e4,!1,(function(){}),(function(){}),"566f58151b0ed37e")}),16)}catch(l){}},e}();function isNeedElement(e,t){if(void 0===t&&(t="list"),!e)return!1;if(t&&"list"===t){if(["LI","TR","DL"].includes(e.nodeName))return!0;if(e.dataset&&e.dataset.hasOwnProperty("teaIdx"))return!0;if(e.hasAttribute&&e.hasAttribute("data-tea-idx"))return!0}else{if(["A","BUTTON"].includes(e.nodeName))return!0;if(e.dataset&&e.dataset.hasOwnProperty("teaContainer"))return!0;if(e.hasAttribute&&e.hasAttribute("data-tea-container"))return!0}return!1}var isAttrFilter=function(e,t){return!!hasAttributes(e,t)};function getContainer(e){for(var t=e;t&&!isNeedElement(t,"container");){if("HTML"===t.nodeName||"BODY"===t.nodeName)return e;t=t.parentElement}return t||e}function getNodeText(e){var t="";return 3===e.nodeType?t=e.textContent.trim():e.dataset&&e.dataset.hasOwnProperty("teaTitle")||e.hasAttribute("ata-tea-title")?t=e.getAttribute("data-tea-title"):e.hasAttribute("title")?t=e.getAttribute("title"):"INPUT"===e.nodeName&&["button","submit"].includes(e.getAttribute("type"))?t=e.getAttribute("value"):"IMG"===e.nodeName&&e.getAttribute("alt")&&(t=e.getAttribute("alt")),t.slice(0,200)}function getText(e){var t=getContainer(e),r=[];return function e(t){var n=getNodeText(t);if(n&&-1===r.indexOf(n)&&r.push(n),t.childNodes.length>0)for(var i=t.childNodes,o=0;o<i.length;o++)8!==i[o].nodeType&&e(i[o])}(t),r}function getTextSingle(e){var t=getContainer(e),r="";return function e(t){var n=getNodeText(t);if(n&&(r+=n),t.childNodes.length>0)for(var i=t.childNodes,o=0;o<i.length;o++)3===i[o].nodeType&&e(i[o])}(t),r}function ignore(e){for(var t=e;t&&t.parentNode;){if(t.hasAttribute("data-tea-ignore"))return!0;if("HTML"===t.nodeName||"body"===t.nodeName)return!1;t=t.parentNode}return!1}var hasAttribute=function(e,t){return e.hasAttribute?e.hasAttribute(t):e.attributes?!(!e.attributes[t]||!e.attributes[t].specified):void 0},hasAttributes=function(e,t){if("string"==typeof t)return hasAttribute(e,t);if(isArray(t)){for(var r=!1,n=0;n<t.length;n++)if(hasAttribute(e,t[n])){r=!0;break}return r}},getAttributes=function(e,t){var r={};if("string"==typeof t)hasAttribute(e,t)&&(r.attrs=e.getAttribute(t));else if(isArray(t))for(var n=0;n<t.length;n++)hasAttribute(e,t[n])&&(r[t[n]]=e.getAttribute(t[n]));return r},elementLevel=function(e){if(e.children.length){var t=e.children;return![].slice.call(t).some((function(e){return e.children.length>0}))}return!0},isSVG=function(e){if("svg"===e.tagName.toLowerCase())return!0;for(var t=e.parentElement,r=!1;t;)"svg"===t.tagName.toLowerCase()?(t=null,r=!0):t=t.parentElement;return r};function isTrack(e,t){if(1!==e.nodeType)return!1;if(!t.svg&&isSVG(e))return!1;if(["HTML","BODY"].includes(e.tagName.toUpperCase()))return!1;var r=e;return!("none"===r.style.display||!isNeedElement(r,"container")&&!elementLevel(r)&&!t.svg)}var Listener=function(){function e(e,t,r){var n=this;this.clickEvent=function(e){isTrack(e.target,n.options)&&n.eventHandel({eventType:"dom",eventName:"click"},e)},this.changeEvent=function(e){n.eventHandel({eventType:"dom",eventName:"change"},e)},this.submitEvent=function(e){n.eventHandel({eventType:"dom",eventName:"submit"},e)},this.getPageViewEvent=function(e,t){t&&"pushState"===t&&n.eventHandel({eventType:"dom",eventName:"beat"},__assign({beat_type:0},e)),n.eventHandel({eventType:"dom",eventName:"page_view"},e)},this.getPageLoadEvent=function(e){n.eventHandel({eventType:"dom",eventName:"page_statistics"},{lcp:e})},this.config=r.getConfig().eventConfig,this.collect=t,this.options=e,this.beatTime=e.beat,this.statistics=!1}return e.prototype.init=function(e){this.eventHandel=e;var t=this.config.mode;this.addListener(t)},e.prototype.addListener=function(e){var t=this;if("proxy-capturing"===e&&(this.config.click&&window.document.addEventListener("click",this.clickEvent,!0),this.config.change&&window.document.addEventListener("change",this.changeEvent,!0),this.config.submit&&window.document.addEventListener("submit",this.submitEvent,!0),this.config.pv&&this.collect.on("route-change",(function(e){var r=e.config,n=e.name;t.getPageViewEvent(r,n)})),this.config.beat)){try{"complete"===document.readyState?this.beatEvent(this.beatTime):window.addEventListener("load",(function(){t.beatEvent(t.beatTime)}));var r=0,n=null;window.addEventListener("scroll",(function(){clearTimeout(n),n=setTimeout(i,500),r=document.documentElement.scrollTop||document.body.scrollTop}));var i=function(){(document.documentElement.scrollTop||document.body.scrollTop)==r&&t.eventHandel({eventType:"dom",eventName:"beat"},{beat_type:1})}}catch(a){}try{var o=window.performance&&window.performance.getEntriesByType("paint");o&&o.length?(new PerformanceObserver((function(e){var r=e.getEntries(),n=r[r.length-1],i=n.renderTime||n.loadTime;t.statistics||(t.getPageLoadEvent(i),t.statistics=!0)})).observe({entryTypes:["largest-contentful-paint"]}),setTimeout((function(){t.statistics||(t.getPageLoadEvent(o[0].startTime||0),t.statistics=!0)}),2e3)):this.getPageLoadEvent(0)}catch(a){this.getPageLoadEvent(0)}}},e.prototype.removeListener=function(){window.document.removeEventListener("click",this.clickEvent,!0),window.document.removeEventListener("change",this.changeEvent,!0),window.document.removeEventListener("submit",this.submitEvent,!0)},e.prototype.beatEvent=function(e){var t=this;try{var r;this.eventHandel({eventType:"dom",eventName:"beat"},{beat_type:3}),this.beatTime&&(r=setInterval((function(){t.eventHandel({eventType:"dom",eventName:"beat"},{beat_type:2})}),e)),beforePageUnload((function(){t.eventHandel({eventType:"dom",eventName:"beat",eventSend:"becon"},{beat_type:0}),t.beatTime&&clearInterval(r)}))}catch(n){}},e}(),defaultConfig$1={eventConfig:{mode:"proxy-capturing",submit:!1,click:!0,change:!1,pv:!0,beat:!0,hashTag:!1,impr:!1},scoutConfig:{mode:"xpath"}},Config=function(){function e(e,t){this.config=e,this.config.eventConfig=Object.assign(this.config.eventConfig,t)}return e.prototype.getConfig=function(){return this.config},e.prototype.setConfig=function(e){return this.config=e},e}();function getPositionData(e){if(e){var t=e.getBoundingClientRect(),r=t.width,n=t.height;return{left:t.left,top:t.top,element_width:r,element_height:n}}}function getEventData(e,t){void 0===e&&(e={}),void 0===t&&(t={});var r=e.clientX,n=e.clientY,i=t.left,o=t.top,a=r-i>=0?r-i:0,s=n-o>=0?n-o:0;return{touch_x:Math.floor(a),touch_y:Math.floor(s)}}function getXpath(e){for(var t=[];null!==e.parentElement;)t.push(e),e=e.parentElement;var r=[],n=[];return t.forEach((function(e){var t=getXpathIndex(e),i=t.str,o=t.index;r.unshift(i),n.unshift(o)})),{element_path:"/"+r.join("/"),positions:n}}function getXpathIndex(e){if(null===e)return{str:"",index:0};var t=0,r=e.parentElement;if(r)for(var n=r.children,i=0;i<n.length&&n[i]!==e;i++)n[i].nodeName===e.nodeName&&t++;return{str:[e.nodeName.toLowerCase(),isNeedElement(e,"list")?"[]":""].join(""),index:t}}function getElementData(e,t,r,n){var i={},o=getPositionData(t),a=getEventData(e,o),s=o.element_width,l=o.element_height,c=a.touch_x,u=a.touch_y,h=getXpath(t),d=h.element_path,p=h.positions,f=getText(t),g=window.performance.timing.navigationStart,y=Date.now()-g,v=p.map((function(e){return""+e})),m=null;if(window.TEAVisualEditor&&window.TEAVisualEditor.getOriginXpath&&(m=window.TEAVisualEditor.getOriginXpath({xpath:d,positions:v})),i.element_path=m&&m.xpath||d,i.positions=m&&m.positions||v,n&&!n.text&&(i.texts=f,i.element_title=getTextSingle(t)),i.element_id=t.getAttribute("id")||"",i.element_class_name=t.getAttribute("class")||"",i.element_type=t.nodeType,i.element_width=Math.floor(s),i.element_height=Math.floor(l),i.touch_x=c,i.touch_y=u,i.page_manual_key="",i.elememt_manual_key="",i.since_page_start_ms=y,i.page_start_ms=g,i.page_path=location.pathname,i.page_host=location.host,r.track_attr&&isAttrFilter(t,r.track_attr)){var _=getAttributes(t,r.track_attr);for(var b in _)i[b]=_[b]}var T=getContainer(t);return"A"===T.tagName&&(i.href=T.getAttribute("href")),"IMG"===t.tagName&&(i.src=t.getAttribute("src")),i}var getEventData$1=function(e,t,r,n,i){return __assign({event:e},getElementData(t,r,n,i),{is_html:1,page_key:window.location.href,page_title:document.title})},getExtraEventData=function(e,t){try{if("bav2b_change"===e)return t.hasAttribute("data-tea-track")?{value:t.value}:{}}catch(r){return{}}},EventHandle=function(){function e(e,t){this.ignore={text:!0},this.initConfig=e,this.options=t,this.eventName=t&&"tea"===t.custom?{click:"__bav_click",page:"__bav_page",beat:"__bav_beat",static:"__bav_page_statistics",exposure:"__bav_page_exposure"}:{click:"bav2b_click",page:"bav2b_page",beat:"bav2b_beat",static:"bav2b_page_statistics",exposure:"bav2b_exposure"},t&&!0===t.text&&(this.ignore.text=!1),t&&t.exposure&&t.exposure.eventName&&(this.eventName.exposure=t.exposure.eventName)}return e.prototype.handleEvent=function(e,t){try{if(ignore(e.target))return null;var r="bav2b_click";switch(t){case"click":return r=this.eventName.click,getEventData$1(r,e,e.target,this.options,this.ignore);case"exposure":return r=this.eventName.exposure,getEventData$1(r,e,e.target,this.options,this.ignore);case"change":return __assign({},getEventData$1(r="bav2b_change",e,e.target,this.options),getExtraEventData(r,e.target));case"submit":return getEventData$1(r="bav2b_submit",e,e.target,this.options)}}catch(n){return console.error(n),null}},e.prototype.handleViewEvent=function(e){e.event=this.eventName.page,e.page_title=document.title,e.page_total_width=window.innerWidth,e.page_total_height=window.innerHeight;try{var t=window.sessionStorage.getItem("_tea_cache_duration");if(t){var r=JSON.parse(t);e.refer_page_duration_ms=r?r.duration:""}e.scroll_width=document.documentElement.scrollLeft?document.documentElement.scrollLeft+window.innerWidth:window.innerWidth,e.scroll_height=document.documentElement.scrollTop?document.documentElement.scrollTop+window.innerHeight:window.innerHeight,e.page_start_ms=window.performance.timing.navigationStart}catch(n){console.log("page event error "+JSON.stringify(n))}return e},e.prototype.handleStatisticsEvent=function(e){var t={};t.event=this.eventName.static,t.is_html=1,t.page_key=location.href,t.refer_page_key=document.referrer||"",t.page_title=document.title,t.page_manual_key=this.initConfig.autotrack.page_manual_key||"",t.refer_page_manual_key="";try{var r=e.lcp,n=window.performance.timing,i=n.loadEventEnd-n.navigationStart;t.page_init_cost_ms=parseInt(r||(i>0?i:0)),t.page_start_ms=n.navigationStart}catch(o){console.log("page_statistics event error "+JSON.stringify(o))}return t},e.prototype.handleBeadtEvent=function(e){e.event=this.eventName.beat,e.page_key=window.location.href,e.is_html=1,e.page_title=document.title,e.page_manual_key=this.initConfig.autotrack.page_manual_key||"";try{e.page_viewport_width=window.innerWidth,e.page_viewport_height=window.innerHeight,e.page_total_width=document.documentElement.scrollWidth,e.page_total_height=document.documentElement.scrollHeight,e.scroll_width=document.documentElement.scrollLeft+window.innerWidth,e.scroll_height=document.documentElement.scrollTop+window.innerHeight,e.since_page_start_ms=Date.now()-window.performance.timing.navigationStart,e.page_start_ms=window.performance.timing.navigationStart}catch(t){console.log("beat event error "+JSON.stringify(t))}return e},e}(),Request=function(){function e(e){this.collect=e,this.eventNameList=["report_click_event","report_change_event","report_submit_event","report_exposure_event","report_page_view_event","report_page_statistics_event","report_beat_event"]}return e.prototype.send=function(e,t){var r=e.eventSend,n=t.event;delete t.event,r&&"becon"===r?this.collect.beconEvent(n,t):this.collect.event(n,t)},e.prototype.get=function(e,t){var r=Object.assign({headers:{"content-type":"application/json"},method:"GET"},t);fetch(e,r)},e.prototype.post=function(e,t){var r=Object.assign({headers:{"content-type":"application/json"},method:"POST"},t);fetch(e,r)},e}(),COOKIE_KEY="_TEA_VE_OPEN",COOKIE_KEY_HOST="_TEA_VE_APIHOST",COOKIE_LANG="lang",COOKIE_EDIT_VERISON="_VISUAL_EDITOR_V",COOKIE_EDIT_URL="_VISUAL_EDITOR_U";function checkSession(){return"1"===js_cookie.get(COOKIE_KEY)}function checkSessionHost(){var e=js_cookie.get(COOKIE_KEY_HOST);try{e=JSON.parse(e)}catch(t){}return e}function checkEditUrl(){return js_cookie.get(COOKIE_EDIT_URL)}function setSession(){try{var e=window.TEAVisualEditor.lang=window.TEAVisualEditor.lang||js_cookie.get(COOKIE_LANG),t=window.TEAVisualEditor.__editor_ajax_domain=window.TEAVisualEditor.__editor_ajax_domain||js_cookie.get(COOKIE_KEY_HOST),r=window.TEAVisualEditor.__editor_verison=window.TEAVisualEditor.__editor_verison||js_cookie.get(COOKIE_EDIT_VERISON),n=window.TEAVisualEditor.__editor_url=window.TEAVisualEditor.__editor_url||js_cookie.get(COOKIE_EDIT_URL),i=+new Date,o=new Date(i+18e5);js_cookie.set(COOKIE_KEY,"1",{expires:o}),js_cookie.set(COOKIE_KEY_HOST,t,{expires:o}),js_cookie.set(COOKIE_EDIT_URL,n,{expires:o}),js_cookie.set(COOKIE_LANG,e,{expires:o}),js_cookie.set(COOKIE_EDIT_VERISON,r||"",{expires:o})}catch(a){console.log("set cookie err")}}var isLoaded$1=!1;function loadEditorScript$1(e){var t=e.event,r=e.editorUrl,n=e.autoTrackInstance;isLoaded$1||(isLoaded$1=!0,loadScript(r,(function(){dispatchMsg(t,"editorScriptloadSuccess"),n.destroy()}),(function(){t&&dispatchMsg(t,"editorScriptloadError"),isLoaded$1=!1})))}function readyToLoadEditor$1(e,t){window.TEAVisualEditor=window.TEAVisualEditor||{};var r="",n=VISUAL_EDITOR_RANGERS+"?query="+Date.now();window.TEAVisualEditor.appId=t.app_id;var i=t.channel_domain,o="";if(addAllowdOrigin(["*"]),i){var a,s="";try{var l=window.performance.getEntriesByType("resource");if(l&&l.length&&(l.forEach((function(e){"script"===e.initiatorType&&e.name&&-1!==e.name.indexOf("collect")&&(s=e.name)})),s&&(a=s.split("/"))&&a.length)){o="https:/";for(var c=2;c<a.length&&c!==a.length-1;c++)o=o+"/"+a[c];if(o&&o.indexOf("/5.0")){var u=o.split("/5.0");o=u[0]||o}}}catch(p){}}if(init(t,SDK_VERSION),checkSession()){var h=checkSessionHost(),d="";h&&(window.TEAVisualEditor.__editor_ajax_domain=h,d=checkEditUrl()),loadEditorScript$1({event:null,editorUrl:d||n,autoTrackInstance:e}),setSession()}else try{receiveMsg("tea:openVisualEditor",(function(t){var a=t.data;if("string"==typeof t.data)try{a=JSON.parse(t.data)}catch(p){a=void 0}if(a){var s=a.referrer,l=a.lang;if(s&&(window.TEAVisualEditor.__editor_ajax_domain=s),r=n,i){var c=a.version;r=o?o+(c?"/visual-editor-rangers-v"+c:"/visual-editor-rangers-v1.0.0")+".js":n,window.TEAVisualEditor.__editor_verison=c}window.TEAVisualEditor.__editor_url=r,window.TEAVisualEditor.lang=l,loadEditorScript$1({event:t,editorUrl:r,autoTrackInstance:e}),setSession()}})),window.TEAVisualEditor.openAutotrackEditor=function(){loadEditorScript$1({event:null,editorUrl:window.TEAVisualEditor.__editor_url,autoTrackInstance:e})}}catch(p){console.log("receive message error")}try{receiveMsg("tea:openHeatMapCore",(function(r){var n=HOT_PIC_URL,i=r.data.app_id;i&&i!==t.app_id||loadEditorScript$1({event:r,editorUrl:n+".js?query="+Date.now(),autoTrackInstance:e})}))}catch(p){console.log("openHeatMapCore error")}}var Observer=function(){function e(e){this._instance=null,this._intersection=e,this.init()}return e.prototype.init=function(){var e=this;this._instance=new MutationObserver((function(t){t.forEach((function(t){"attributes"===t.type&&e.attributeChangeObserve(t),"childList"===t.type&&e.modifyNodeObserve(t)}))})),this._instance.observe(document.body,{childList:!0,attributes:!0,subtree:!0,attributeOldValue:!1})},e.prototype.attributeChangeObserve=function(e){e.target.hasAttribute("data-exposure")?this.exposureAdd(e,"mutation"):this.exposureRemove(e)},e.prototype.modifyNodeObserve=function(e){var t=this;Array.prototype.forEach.call(e.addedNodes,(function(e){1===e.nodeType&&e.hasAttribute("data-exposure")&&t.exposureAdd(e,"intersect"),t.mapChild(e,t.exposureAdd)})),Array.prototype.forEach.call(e.removedNodes,(function(e){1===e.nodeType&&e.hasAttribute("data-exposure")&&t.exposureRemove(e),t.mapChild(e,t.exposureRemove)}))},e.prototype.mapChild=function(e,t){var r=this;1===e.nodeType&&e.children.length&&Array.prototype.forEach.call(e.children,(function(e){1===e.nodeType&&e.hasAttribute("data-exposure")&&t(e),r.mapChild(e,t)}))},e.prototype.exposureAdd=function(e,t){this._intersection.exposureAdd(e,t)},e.prototype.exposureRemove=function(e){this._intersection.exposureRemove(e)},e._exposure_observer=null,e}(),Intersection=function(){function e(t,r){this.count=1,this.instance=this.buildObserver(),this.observeMap=e._observer_map,t.autotrack.exposure.ratio?this.Ratio=t.autotrack.exposure.ratio:0===t.autotrack.exposure.ratio?this.Ratio=0:this.Ratio=.5,this.EventHandle=r}return e.prototype.buildObserver=function(){var t=this;if(!e._observer_instance)return IntersectionObserver&&(e._observer_instance=new IntersectionObserver((function(e){e.forEach((function(e){t.observeMap.get(e.target._observeId)&&t.exposureEvent(e)}))}),{threshold:[.01,.25,.5,.75,1]})),e._observer_instance},e.prototype.exposureAdd=function(e,t){var r=e;"mutation"===t&&(r=e.target);var n=r._observeId;if(n||this.observeMap.has(n)){if(!1===r.visible){var i=r.getBoundingClientRect(),o=i.top,a=i.left,s=i.right,l=i.bottom;o>=0&&l<=window.innerHeight&&a>=0&&s<=window.innerWidth&&(r.visible=!0,this.EventHandle({eventType:"dom",eventName:"exposure"},e))}}else r._observeId=this.count,r.visible=!1,this.observeMap.set(this.count,r),this.observe(r),this.count++},e.prototype.exposureRemove=function(e){this.observeMap.has(e._observeId)&&(this.observeMap.delete(e._observeId),this.unobserve(e))},e.prototype.exposureEvent=function(e){if(e.intersectionRatio>=this.Ratio&&e.isIntersecting){if("0"===e.target.style.opacity||"hidden"===e.target.style.visibility)return;if(!0===e.target.visible)return;e.target.visible=!0,this.EventHandle({eventType:"dom",eventName:"exposure"},e)}else e.target.visible=!1},e.prototype.observe=function(e){this.instance.observe(e)},e.prototype.unobserve=function(e){this.instance.unobserve(e)},e._observer_instance=null,e._observer_map=new Map,e}(),Exposure=function(){function e(e,t){e.autotrack&&e.autotrack.exposure&&(this._intersection=new Intersection(e,t),this._observer=new Observer(this._intersection),this.initObserver())}return e.prototype.initObserver=function(){var e=this;Array.prototype.forEach.call(document.querySelectorAll("[data-exposure]"),(function(t){e._intersection.exposureAdd(t,"intersect")}))},e}(),defaultOpt={hashTag:!1,impr:!1},AutoTrack=function(){function e(){}return e.prototype.apply=function(e,t){if(this.autoTrackStart=!1,this.collect=e,this.config=t,t.autotrack){var r=e.Types;t.autotrack&&t.autotrack.collect_url&&!t.autotrack.collect_url()||(this.ready(r.Autotrack),this.collect.emit(r.AutotrackReady))}},e.prototype.ready=function(e){this.collect.set(e);var t=this.config.autotrack;t="object"==typeof t?t:{},t=Object.assign(defaultOpt,t),this.destroyed=!1,this.options=t,this.Config=new Config(defaultConfig$1,this.options),this.Exposure=new Exposure(this.config,this.handle.bind(this)),this.Listener=new Listener(t,this.collect,this.Config),this.EventHandle=new EventHandle(this.config,t),this.Request=new Request(this.collect),this.autoTrackStart=!0,this.init(),readyToLoadEditor$1(this,this.config)},e.prototype.init=function(){this.Listener.init(this.handle.bind(this))},e.prototype.handle=function(e,t){"dom"===e.eventType&&this.handleDom(e,t)},e.prototype.handleDom=function(e,t){try{var r=e.eventName;if("click"===r||"exposure"===r||"change"===r||"submit"===r){var n=this.EventHandle.handleEvent(t,r);null!==n&&this.Request.send({eventType:"custom",eventName:"report_"+r+"_event",extra:{methods:"GET"}},n)}else if("page_view"===r||"page_statistics"===r){var i;i="page_view"===r?this.EventHandle.handleViewEvent(t):this.EventHandle.handleStatisticsEvent(t),this.Request.send({eventType:"custom",eventName:"report_${eventName}_event",extra:{methods:"GET"}},i)}else if("beat"===r){var o=this.EventHandle.handleBeadtEvent(t),a=e.eventSend;this.Request.send({eventType:"custom",eventName:"report_${eventName}_event",extra:{methods:"GET"},eventSend:a},o)}}catch(s){console.log("handel dom event error "+JSON.stringify(s))}},e.prototype.destroy=function(){if(!this.autoTrackStart)return console.warn("engine is undefined, make sure you have called autoTrack.start()");this.autoTrackStart=!1,this.Listener.removeListener()},e}(),State;!function(e){e.Net="net",e.FailNet="f_net",e.FailData="f_data"}(State||(State={}));var EventList={pv:["predefine_pageview"],sdk:["_be_active","predefine_page_alive","predefine_page_close","__profile_set","__profile_set_once","__profile_increment","__profile_unset","__profile_append"],autotrack:["bav2b_click","bav2b_page","bav2b_beat","bav2b_page_statistics","__bav_click","__bav_page","__bav_beat","__bav_page_statistics"]},Tracer=function(){function e(){}return e.prototype.apply=function(e,t){var r=this;if(this.ready=t.app_id&&t.enable_tracer&&!t.disable_track_event,this.ready){this.limit={pv:1,sdk:3,autotrack:3,log:3},this.errorCode={f_net:0,f_data:0},this.tracerCache=new Map,this.collect=e,this.appid=t.app_id,this.reportUrl=e.configManager.getUrl("event");var n=this.collect.Types,i=e.adapters.fetch;this.fetch=i,this.collect.on(n.Event,(function(e){isArray(e)?e.forEach((function(e){r.addCount("log")})):r.addCount("log")})),this.collect.on(n.SubmitError,(function(e){var t=e.type,n=e.eventDate,i=e.errorCode,o=e.response;r.addErrorCount(n,t,i,o)})),this.listener(),this.collect.emit(n.TracerReady)}},e.prototype.addCount=function(e,t,r){void 0===t&&(t="net"),void 0===r&&(r=1);try{this.tracerCache||(this.tracerCache=new Map);var n=void 0;if(this.tracerCache.has(e))(i=this.tracerCache.get(e)).has(t)?(n=i.get(t).params.count,n++,i.set(t,this.processTracer(n,e,t))):(n=r,i.set(t,this.processTracer(r,e,t)));else{var i=new Map;n=r,i.set(t,this.processTracer(r,e,t)),this.tracerCache.set(e,i)}"net"===t&&n>=this.limit[e]&&this.report(!1)}catch(o){console.log(o)}},e.prototype.addErrorCount=function(e,t,r,n){var i=this;try{if(e&&e.length){var o=e[0].events;o&&o.length&&("f_data"===t?(n&&n.hasOwnProperty("sc")?this.addCount("log",t,o.length-n.sc):this.addCount("log",t,o.length),this.errorCode[t]=r):o.forEach((function(e){var n="log";for(var o in EventList)if(-1!==EventList[o].indexOf(e.event)){n=o;break}i.addCount(n,t,1),i.errorCode[t]=r})))}}catch(a){}},e.prototype.report=function(e){if(this.tracerCache){var t=[];this.tracerCache.forEach((function(e){console.log(e),e.forEach((function(e){t.push(e)}))})),t&&t.length&&this.sendTracer(t,e)}},e.prototype.sendTracer=function(e,t){try{var r=this.collect.eventManager.merge(e);t&&window.navigator.sendBeacon?window.navigator.sendBeacon(this.reportUrl,JSON.stringify(r)):this.fetch(this.reportUrl,r),this.tracerCache=null}catch(n){}},e.prototype.processTracer=function(e,t,r){try{var n={count:e,state:r,key:t,params_for_special:"applog_trace",aid:this.appid,platform:"web",_staging_flag:1,sdk_version:SDK_VERSION};"f_net"!==r&&"f_data"!==r||(n.errorCode=this.errorCode[r]);var i=this.collect.processEvent("applog_trace",n);if(i&&i.event)return delete i.is_bav,i}catch(o){console.warn("something error")}},e.prototype.listener=function(){var e=this;document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e.leavePage()})),beforePageUnload((function(){e.leavePage()}))},e.prototype.leavePage=function(){this.report(!0)},e}(),dayjs_min=createCommonjsModule((function(e,t){e.exports=function(){var e="millisecond",t="second",r="minute",n="hour",i="day",o="week",a="month",s="quarter",l="year",c="date",u="Invalid Date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,d=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,p={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},f=function(e,t,r){var n=String(e);return!n||n.length>=t?e:""+Array(t+1-n.length).join(r)+e},g={s:f,z:function(e){var t=-e.utcOffset(),r=Math.abs(t),n=Math.floor(r/60),i=r%60;return(t<=0?"+":"-")+f(n,2,"0")+":"+f(i,2,"0")},m:function e(t,r){if(t.date()<r.date())return-e(r,t);var n=12*(r.year()-t.year())+(r.month()-t.month()),i=t.clone().add(n,a),o=r-i<0,s=t.clone().add(n+(o?-1:1),a);return+(-(n+(r-i)/(o?i-s:s-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(u){return{M:a,y:l,w:o,d:i,D:c,h:n,m:r,s:t,ms:e,Q:s}[u]||String(u||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},y="en",v={};v[y]=p;var m=function(e){return e instanceof E},_=function(e,t,r){var n;if(!e)return y;if("string"==typeof e)v[e]&&(n=e),t&&(v[e]=t,n=e);else{var i=e.name;v[i]=e,n=i}return!r&&n&&(y=n),n||!r&&y},b=function(e,t){if(m(e))return e.clone();var r="object"==typeof t?t:{};return r.date=e,r.args=arguments,new E(r)},T=g;T.l=_,T.i=m,T.w=function(e,t){return b(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function p(e){this.$L=_(e.locale,null,!0),this.parse(e)}var f=p.prototype;return f.parse=function(e){this.$d=function(e){var t=e.date,r=e.utc;if(null===t)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var n=t.match(h);if(n){var i=n[2]-1||0,o=(n[7]||"0").substring(0,3);return r?new Date(Date.UTC(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)):new Date(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)}}return new Date(t)}(e),this.$x=e.x||{},this.init()},f.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},f.$utils=function(){return T},f.isValid=function(){return!(this.$d.toString()===u)},f.isSame=function(e,t){var r=b(e);return this.startOf(t)<=r&&r<=this.endOf(t)},f.isAfter=function(e,t){return b(e)<this.startOf(t)},f.isBefore=function(e,t){return this.endOf(t)<b(e)},f.$g=function(e,t,r){return T.u(e)?this[t]:this.set(r,e)},f.unix=function(){return Math.floor(this.valueOf()/1e3)},f.valueOf=function(){return this.$d.getTime()},f.startOf=function(e,s){var u=this,h=!!T.u(s)||s,d=T.p(e),p=function(e,t){var r=T.w(u.$u?Date.UTC(u.$y,t,e):new Date(u.$y,t,e),u);return h?r:r.endOf(i)},f=function(e,t){return T.w(u.toDate()[e].apply(u.toDate("s"),(h?[0,0,0,0]:[23,59,59,999]).slice(t)),u)},g=this.$W,y=this.$M,v=this.$D,m="set"+(this.$u?"UTC":"");switch(d){case l:return h?p(1,0):p(31,11);case a:return h?p(1,y):p(0,y+1);case o:var _=this.$locale().weekStart||0,b=(g<_?g+7:g)-_;return p(h?v-b:v+(6-b),y);case i:case c:return f(m+"Hours",0);case n:return f(m+"Minutes",1);case r:return f(m+"Seconds",2);case t:return f(m+"Milliseconds",3);default:return this.clone()}},f.endOf=function(e){return this.startOf(e,!1)},f.$set=function(o,s){var u,h=T.p(o),d="set"+(this.$u?"UTC":""),p=(u={},u[i]=d+"Date",u[c]=d+"Date",u[a]=d+"Month",u[l]=d+"FullYear",u[n]=d+"Hours",u[r]=d+"Minutes",u[t]=d+"Seconds",u[e]=d+"Milliseconds",u)[h],f=h===i?this.$D+(s-this.$W):s;if(h===a||h===l){var g=this.clone().set(c,1);g.$d[p](f),g.init(),this.$d=g.set(c,Math.min(this.$D,g.daysInMonth())).$d}else p&&this.$d[p](f);return this.init(),this},f.set=function(e,t){return this.clone().$set(e,t)},f.get=function(e){return this[T.p(e)]()},f.add=function(e,s){var c,u=this;e=Number(e);var h=T.p(s),d=function(t){var r=b(u);return T.w(r.date(r.date()+Math.round(t*e)),u)};if(h===a)return this.set(a,this.$M+e);if(h===l)return this.set(l,this.$y+e);if(h===i)return d(1);if(h===o)return d(7);var p=(c={},c[r]=6e4,c[n]=36e5,c[t]=1e3,c)[h]||1,f=this.$d.getTime()+e*p;return T.w(f,this)},f.subtract=function(e,t){return this.add(-1*e,t)},f.format=function(e){var t=this,r=this.$locale();if(!this.isValid())return r.invalidDate||u;var n=e||"YYYY-MM-DDTHH:mm:ssZ",i=T.z(this),o=this.$H,a=this.$m,s=this.$M,l=r.weekdays,c=r.months,h=function(e,r,i,o){return e&&(e[r]||e(t,n))||i[r].substr(0,o)},p=function(e){return T.s(o%12||12,e,"0")},f=r.meridiem||function(e,t,r){var n=e<12?"AM":"PM";return r?n.toLowerCase():n},g={YY:String(this.$y).slice(-2),YYYY:this.$y,M:s+1,MM:T.s(s+1,2,"0"),MMM:h(r.monthsShort,s,c,3),MMMM:h(c,s),D:this.$D,DD:T.s(this.$D,2,"0"),d:String(this.$W),dd:h(r.weekdaysMin,this.$W,l,2),ddd:h(r.weekdaysShort,this.$W,l,3),dddd:l[this.$W],H:String(o),HH:T.s(o,2,"0"),h:p(1),hh:p(2),a:f(o,a,!0),A:f(o,a,!1),m:String(a),mm:T.s(a,2,"0"),s:String(this.$s),ss:T.s(this.$s,2,"0"),SSS:T.s(this.$ms,3,"0"),Z:i};return n.replace(d,(function(e,t){return t||g[e]||i.replace(":","")}))},f.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},f.diff=function(e,c,u){var h,d=T.p(c),p=b(e),f=6e4*(p.utcOffset()-this.utcOffset()),g=this-p,y=T.m(this,p);return y=(h={},h[l]=y/12,h[a]=y,h[s]=y/3,h[o]=(g-f)/6048e5,h[i]=(g-f)/864e5,h[n]=g/36e5,h[r]=g/6e4,h[t]=g/1e3,h)[d]||g,u?y:T.a(y)},f.daysInMonth=function(){return this.endOf(a).$D},f.$locale=function(){return v[this.$L]},f.locale=function(e,t){if(!e)return this.$L;var r=this.clone(),n=_(e,t,!0);return n&&(r.$L=n),r},f.clone=function(){return T.w(this.$d,this)},f.toDate=function(){return new Date(this.valueOf())},f.toJSON=function(){return this.isValid()?this.toISOString():null},f.toISOString=function(){return this.$d.toISOString()},f.toString=function(){return this.$d.toUTCString()},p}(),S=E.prototype;return b.prototype=S,[["$ms",e],["$s",t],["$m",r],["$H",n],["$W",i],["$M",a],["$y",l],["$D",c]].forEach((function(e){S[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),b.extend=function(e,t){return e.$i||(e(t,E,b),e.$i=!0),b},b.locale=_,b.isDayjs=m,b.unix=function(e){return b(1e3*e)},b.en=v[y],b.Ls=v,b.p={},b}()})),duration=createCommonjsModule((function(e,t){var r,n,i,o,a,s,l,c,u,h,d,p,f,g,y,v,m;e.exports=(a=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,c=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,u={years:s=31536e6,months:l=2592e6,days:o=864e5,hours:i=36e5,minutes:6e4,seconds:1e3,milliseconds:1,weeks:6048e5},h=function(e){return e instanceof m},d=function(e,t,r){return new m(e,r,t.$l)},p=function(e){return n.p(e)+"s"},f=function(e){return e<0},g=function(e){return f(e)?Math.ceil(e):Math.floor(e)},y=function(e){return Math.abs(e)},v=function(e,t){return e?f(e)?{negative:!0,format:""+y(e)+t}:{negative:!1,format:""+e+t}:{negative:!1,format:""}},m=function(){function e(e,t,r){var n=this;if(this.$d={},this.$l=r,void 0===e&&(this.$ms=0,this.parseFromMilliseconds()),t)return d(e*u[p(t)],this);if("number"==typeof e)return this.$ms=e,this.parseFromMilliseconds(),this;if("object"==typeof e)return Object.keys(e).forEach((function(t){n.$d[p(t)]=e[t]})),this.calMilliseconds(),this;if("string"==typeof e){var i=e.match(c);if(i){var o=i.slice(2).map((function(e){return Number(e)}));return this.$d.years=o[0],this.$d.months=o[1],this.$d.weeks=o[2],this.$d.days=o[3],this.$d.hours=o[4],this.$d.minutes=o[5],this.$d.seconds=o[6],this.calMilliseconds(),this}}return this}var t=e.prototype;return t.calMilliseconds=function(){var e=this;this.$ms=Object.keys(this.$d).reduce((function(t,r){return t+(e.$d[r]||0)*u[r]}),0)},t.parseFromMilliseconds=function(){var e=this.$ms;this.$d.years=g(e/s),e%=s,this.$d.months=g(e/l),e%=l,this.$d.days=g(e/o),e%=o,this.$d.hours=g(e/i),e%=i,this.$d.minutes=g(e/6e4),e%=6e4,this.$d.seconds=g(e/1e3),e%=1e3,this.$d.milliseconds=e},t.toISOString=function(){var e=v(this.$d.years,"Y"),t=v(this.$d.months,"M"),r=+this.$d.days||0;this.$d.weeks&&(r+=7*this.$d.weeks);var n=v(r,"D"),i=v(this.$d.hours,"H"),o=v(this.$d.minutes,"M"),a=this.$d.seconds||0;this.$d.milliseconds&&(a+=this.$d.milliseconds/1e3);var s=v(a,"S"),l=e.negative||t.negative||n.negative||i.negative||o.negative||s.negative,c=i.format||o.format||s.format?"T":"",u=(l?"-":"")+"P"+e.format+t.format+n.format+c+i.format+o.format+s.format;return"P"===u||"-P"===u?"P0D":u},t.toJSON=function(){return this.toISOString()},t.format=function(e){var t=e||"YYYY-MM-DDTHH:mm:ss",r={Y:this.$d.years,YY:n.s(this.$d.years,2,"0"),YYYY:n.s(this.$d.years,4,"0"),M:this.$d.months,MM:n.s(this.$d.months,2,"0"),D:this.$d.days,DD:n.s(this.$d.days,2,"0"),H:this.$d.hours,HH:n.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:n.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:n.s(this.$d.seconds,2,"0"),SSS:n.s(this.$d.milliseconds,3,"0")};return t.replace(a,(function(e,t){return t||String(r[e])}))},t.as=function(e){return this.$ms/u[p(e)]},t.get=function(e){var t=this.$ms,r=p(e);return"milliseconds"===r?t%=1e3:t="weeks"===r?g(t/u[r]):this.$d[r],0===t?0:t},t.add=function(e,t,r){var n;return n=t?e*u[p(t)]:h(e)?e.$ms:d(e,this).$ms,d(this.$ms+n*(r?-1:1),this)},t.subtract=function(e,t){return this.add(e,t,!0)},t.locale=function(e){var t=this.clone();return t.$l=e,t},t.clone=function(){return d(this.$ms,this)},t.humanize=function(e){return r().add(this.$ms,"ms").locale(this.$l).fromNow(!e)},t.milliseconds=function(){return this.get("milliseconds")},t.asMilliseconds=function(){return this.as("milliseconds")},t.seconds=function(){return this.get("seconds")},t.asSeconds=function(){return this.as("seconds")},t.minutes=function(){return this.get("minutes")},t.asMinutes=function(){return this.as("minutes")},t.hours=function(){return this.get("hours")},t.asHours=function(){return this.as("hours")},t.days=function(){return this.get("days")},t.asDays=function(){return this.as("days")},t.weeks=function(){return this.get("weeks")},t.asWeeks=function(){return this.as("weeks")},t.months=function(){return this.get("months")},t.asMonths=function(){return this.as("months")},t.years=function(){return this.get("years")},t.asYears=function(){return this.as("years")},e}(),function(e,t,i){r=i,n=i().$utils(),i.duration=function(e,t){var r=i.locale();return d(e,{$l:r},t)},i.isDuration=h;var o=t.prototype.add,a=t.prototype.subtract;t.prototype.add=function(e,t){return h(e)&&(e=e.asMilliseconds()),o.bind(this)(e,t)},t.prototype.subtract=function(e,t){return h(e)&&(e=e.asMilliseconds()),a.bind(this)(e,t)}})}));dayjs_min.extend(duration);var ignoreList=["__cep_sdk_onboard","__cep_trigger_sdk","_be_active"],moreOP=["and","or","not"],CepRule=function(){function CepRule(){this.support=!0,this.currentPlan=1,this.shouldSendEvent=!1,this.staing=!1,this.test=!1,this.cepReady=!1,this.eventCache=[]}return CepRule.prototype.apply=function(e,t){var r=this;if(this.collect=e,this.config=t,this.config.cep){var n=e.adapters,i=n.fetch,o=n.storage,a=e.Types;this.types=a,this.storage=new o(!1),this.fetch=i,this.configManager=e.configManager,this.url=t.cep_url?""+t.cep_url:e.configManager.getDomain()+"/service/2/cep_settings/",this.reportUrl=e.configManager.getUrl("event"),this.key="__tea_cep_plan_"+t.app_id,this.quotasKey="__tea_cep_plan_quotas_"+t.app_id,this.isWait=!1,this.eventCache=[],this.test=e.configManager.staging,this.collect.on(a.SubmitAfter,(function(e){r.matchEvent(e)})),this.init()}},CepRule.prototype.init=function(){var e=this,t=!0,r=0,n=0,i=0,o=!1,a=this.storage.getItem(this.key)||{};if(a&&Object.keys(a).length&&(o=!0,r=a.last_update_time,n=a.fetch_interval,i=a.config_version||0,t=Date.now()-r>1e3*n),t){var s=this.configManager.get(),l=s.header,c=s.user;this.fetch(this.url,{header:l,user:c,local_time:Date.now(),config_version:i},1e4,!1,(function(t){t&&0===t.code?(a.fetch_interval=t.fetch_interval,a.data=t.data,a.last_update_time=Date.now(),a.config_version=t.config_version,e.clearQuotas(),e.initState(t.data),e.storage.setItem(e.key,a),t.data.forEach((function(t){e.event("__cep_sdk_onboard",t.plan_id)}))):304!==t.code&&400!==t.code||!o?console.log("code: "+t.code+", request error,please try leater"):(console.log("code: "+t.code+", use old rules~"),a.last_update_time=Date.now(),e.storage.setItem(e.key,a),e.initState(a.data))}),(function(){o?(e.planData=a.data,e.initState(a.data)):(e.support=!1,console.log("request error,please try leater"))}))}else a.last_update_time=Date.now(),this.storage.setItem(this.key,a),console.log("rule still work, use cache"),this.initState(a.data)},CepRule.prototype.initState=function(e){var t=this;e&&e.length&&(this.stateArray=new Map,this.waitArray=new Map,this.planData=e,e.forEach((function(e){var r=new Map;if(e.pattern&&e.pattern.events){var n=1===e.pattern.events.length;e.pattern.events.forEach((function(e){r.set(e.id,{id:e.id,isMatch:!1,event:null,after:e.after||null,connection:e.connection||null,window:e.window||null,matchTime:0,initTime:Date.now(),singleRule:n})})),t.stateArray.set(e.plan_id,{patternState:r,singleRule:n,pattern:{aid:e.aid,biz_id:e.biz_id,end_time:e.end_time,start_time:e.start_time,web_sdk_version:e.web_sdk_version,stage:e.stage},quotas:e.quotas})}})),this.cepReady=!0,this.dealCache(),this.collect.emit(this.types.CepReady))},CepRule.prototype.check=function(e){var t=Date.now();return Date.now()>1e3*e.end_time?(console.log("event rules:"+e.plan_id+" is over"),!1):t<1e3*e.start_time||t>1e3*e.end_time?(console.log("rule:"+e.plan_id+" time error"),!1):(this.staing="testing"===e.staing,!(SDK_VERSION<e.web_sdk_version&&(this.support=!1,console.log("you sdk version is old,please update to "+e.web_sdk_version+" at least"),1)))},CepRule.prototype.dealCache=function(){var e=this;if(this.eventCache.length){var t=1;this.eventCache.forEach((function(r){e.matchEvent(r),t++})),t===this.eventCache.length&&(this.eventCache=[])}},CepRule.prototype.matchEvent=function(e){if(this.support&&(!this.staing||this.test)&&e&&e.length)try{if(!this.cepReady)return void this.eventCache.push(e);var t=e[0],r=t.header,n=t.user,i=t.events;i.length&&i.reverse();for(var o=0;o<i.length;o++){var a=i[o].event;if(-1!==ignoreList.indexOf(a))return!1;this.matchRule(r,n,i[o])}}catch(s){return this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:s.message}),void console.log(s.message)}},CepRule.prototype.matchRule=function(e,t,r){try{for(var n=0;n<this.planData.length;n++){var i=this.planData[n],o=i.plan_id;if(this.check(i)&&this.checkQuotas(o)&&i.pattern&&i.pattern.events)for(var a=i.pattern.events,s=0;s<a.length;s++)if(this.rule(e,t,r,a[s].condition)){var l=this.stateArray.get(o).patternState,c=l.get(a[s].id);if(this.stateArray.get(o).singleRule){this.changeStatus(o,a[s].id,r),this.publish([r],o,a[s].id);break}if(!c.isMatch){c.after&&l.get(c.after).isMatch?this.changeStatus(o,a[s].id,r):c.after||this.changeStatus(o,a[s].id,r);break}}}this.statusCheck()}catch(u){return this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:u.message}),void console.log(u.message)}},CepRule.prototype.changeStatus=function(e,t,r){var n=this.stateArray.get(e),i=n.patternState.get(t);i.isMatch=!0,i.event=r,i.matchTime=r.local_time_ms||Date.now(),n.patternState.set(t,i),this.stateArray.set(e,n)},CepRule.prototype.statusCheck=function(){var e,t,r,n;try{for(var i=__values(this.stateArray),o=i.next();!o.done;o=i.next()){var a=__read(o.value,2),s=a[0],l=a[1],c=l.patternState;if(l.isSingle)break;try{for(var u=__values(c),h=u.next();!h.done;h=u.next()){var d=__read(h.value,2),p=d[0],f=d[1];if(f.after&&(!f.after||c.get(f.after).isMatch)){if("NOT_FOLLOWED_BY"===f.connection){f.isMatch?this.reset(s,p):Date.now()-c.get(f.after).matchTime>f.window?this.publish([c.get(f.after).event,f.event],s,p):this.startWait(s,p,f);break}f.isMatch?f.matchTime-c.get(f.after).matchTime<=f.window?this.publish([c.get(f.after).event,f.event],s,p):this.reset(s,p):Date.now()-c.get(f.after).matchTime>f.window?this.reset(s,p):this.startWait(s,p,f);break}}}catch(g){r={error:g}}finally{try{h&&!h.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}}}catch(y){e={error:y}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},CepRule.prototype.startWait=function(e,t,r){var n=this;try{this.waitArray.get(e)||this.waitArray.set(e,new Map);var i=this.waitArray.get(e);if(!i.get(t)){var o=setTimeout((function(){var i=n.stateArray.get(e).patternState,o=i.get(t);if("NOT_FOLLOWED_BY"===o.connection)!o.isMatch&&i.get(o.after).isMatch||o.matchTime-i.get(o.after).matchTime>r.window?((a=n.waitArray.get(e).get(t)).triggerWait=!0,n.waitArray.set(e,n.waitArray.get(e).set(t,a)),n.publish([i.get(o.after).event],e,t)):n.reset(e,t);else if("FOLLOWED_BY"===o.connection){var a;o.isMatch&&i.get(o.after).isMatch?((a=n.waitArray.get(e).get(t)).triggerWait=!0,n.waitArray.set(e,n.waitArray.get(e).set(t,a)),n.publish([i.get(o.after).event],e,t)):n.reset(e,t)}}),r.window);i.set(t,{waitFn:o,triggerWait:!1}),this.waitArray.set(e,i)}}catch(a){this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:a.message}),console.log(a.message,a.stack)}},CepRule.prototype.rule=function(e,t,r,n){var i=this;try{var o=r.event,a=r.params;if(a=JSON.parse(a),-1!==moreOP.indexOf(n.op)){if(n.conditions&&n.conditions.length){var s=n.conditions,l=0,c=new Map;c.set(l,{op:n.op,result:void 0,resultList:[],resultKey:[],resultLength:s.length}),function r(n,s){for(var u=0;u<n.length;u++)if(l++,-1!==moreOP.indexOf(n[u].op)&&n[u].hasOwnProperty("conditions"))c.set(l,{op:n[u].op,result:void 0,fatherKey:s,resultList:[],resultKey:[],resultLength:n[u].conditions.length}),r(n[u].conditions,l);else{var h=i.scope(n[u].key),d=h.scope,p=h.key,f=h.key2,g=d?"header"===d?f?JSON.parse(e[f])[p]:e[p]:"user"===d?t[p]:a[p]:o,y=i.calculate(n[u].op,g,n[u].value);c.set(l,{op:n[u].op,result:y,fatherKey:s})}}(s,l);for(var u=c.get(0);void 0===u.result||u.resultList.length<u.resultLength;)c.forEach((function(e,t){if(void 0!==e.result&&void 0!==e.fatherKey){var r=c.get(e.fatherKey);r.resultList.length<r.resultLength&&-1===r.resultKey.indexOf(t)&&(r.resultKey.push(t),r.resultList.push(e.result),c.set(e.fatherKey,r))}})),c.forEach((function(e){e.resultList&&e.resultList.length===e.resultLength&&("and"===e.op&&(e.result=-1===e.resultList.indexOf(!1)),"or"===e.op&&(e.result=-1!==e.resultList.indexOf(!0)))}));return c.get(0).result}return!1}var h=this.scope(n.key),d=h.scope,p=h.key,f=h.key2,g=d?"header"===d?f?JSON.parse(e[f])[p]:e[p]:"user"===d?t[p]:a[p]:o;return this.calculate(n.op,g,n.value)}catch(y){return this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:y.message}),console.log(y.message),!1}},CepRule.prototype.publish=function(e,t,r){try{var n=this.configManager.get().user,i={biz_id:this.stateArray.get(t).pattern.biz_id,plan_id:t,uid:n.user_id||"",did:n.device_id||"",uuid:n.user_unique_id,events:e,extra:{url:window.location.href}};this.collect.emit("__cep_match",i),(window.opener||window.parent).postMessage({type:"__cep_match",data:i},"*"),this.event("__cep_trigger_sdk",t),this.addQuotas(t),this.reset(t,r),console.log(this.stateArray)}catch(o){return this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:o.message}),void console.log(o.message)}},CepRule.prototype.addQuotas=function(e){var t=this.stateArray.get(e).quotas;if(t&&t.length){var r=this.storage.getItem(this.quotasKey)||{};r[e]||(r[e]={value:0,lastTime:Date.now()});var n=r[e].value;0===n&&(r[e].lastTime=Date.now()),r[e].value=n+1,this.storage.setItem(this.quotasKey,r)}},CepRule.prototype.checkQuotas=function(e){var t=this.stateArray.get(e).quotas,r=this.storage.getItem(this.quotasKey)||{};if(r[e]||(r[e]={value:0,lastTime:Date.now()}),t&&t.length){var n=t[0].granularity,i=t[0].value;if("per_keyid"!==t[0].type)return!0;var o=this.release(n);return"all"===o?!(r[e].value>=i&&(console.log("plan:"+e+" limit"),1)):Date.now()-r[e].lastTime>=o?(r[e].value=0,r[e].lastTime=Date.now(),this.storage.setItem(this.quotasKey,r),!0):!(r[e].value>=i&&(console.log("plan:"+e+" limit"),1))}return!0},CepRule.prototype.clearQuotas=function(){this.storage.setItem(this.quotasKey,null)},CepRule.prototype.release=function(e){if("all"===e)return e;var t=dayjs_min.duration(e);return t?t.asMilliseconds():"all"},CepRule.prototype.reset=function(e,t){var r=this.stateArray.get(e);if(r.singleRule){var n=r.patternState.get(t);n.isMatch=!1,n.event=null,n.matchTime=0,n.initTime=Date.now(),r.patternState.set(t,n)}else r.patternState.forEach((function(e){e.isMatch=!1,e.event=null,e.matchTime=0,e.initTime=Date.now()}));this.stateArray.set(e,r);var i=this.waitArray.get(e);i&&i.get(t)&&(clearTimeout(i.get(t).waitFn),i.delete(t))},CepRule.prototype.event=function(e,t){try{var r={event:e,params:JSON.stringify({plan_id:t||"",biz_id:this.stateArray.get(t).pattern.biz_id}),local_time_ms:Date.now()},n=this.configManager.get(),i=n.header,o=n.user;i.custom=JSON.stringify(i.custom);var a={events:[r],user:o,header:i};this.fetch(this.reportUrl,[a])}catch(s){return this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:s.message}),void console.log(s.message)}},CepRule.prototype.scope=function(e){var t="",r="";if(e.indexOf(".")>-1){var n=e.split(".");t=n[0],e=n[1],"header"===t&&"custom"===e&&(e=n[2],r=n[1])}return{scope:t,key:e,key2:r}},CepRule.prototype.calculate=function(op,paramA,paramB){try{if("="===op)return paramA===paramB;if(-1!==["=","<",">",">=","<=","!="].indexOf(op))return eval(""+paramA+op+paramB);if(-1!==["in","contains"].indexOf(op))return-1!==paramB.indexOf(paramA);if(-1!==["is not null","is null"].indexOf(op))return"is null"===op?null==paramA:null!=paramA;if(-1!==["startswith","endswith"].indexOf(op)){if("startswith"===op)return 0===paramA.indexOf(paramB);var start=paramA.length-paramB.length,str=paramA.substr(start,paramB.length);return str===paramB}}catch(e2){return this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e2.message}),console.log(e2.message),!1}},CepRule}(),pluginExtendList={autotrack:{src:{sg:"https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/5.0/plugin/autotrack.js",va:"https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/5.0/plugin/autotrack.js"},object:"LogAutoTrack"},ab:{src:{sg:"https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/5.0/plugin/ab.js",va:"https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/5.0/plugin/ab.js"},object:"LogAb"},stay:{src:{sg:"https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/5.0/plugin/stay.js",va:"https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/5.0/plugin/stay.js"},object:"LogStay"},route:{src:{sg:"https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/5.0/plugin/route.js",va:"https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/5.0/plugin/route.js"},object:"LogRoute"},cep:{src:{sg:"https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/5.0/plugin/cep.js",va:"https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/5.0/plugin/cep.js"},object:"LogCep"},tracer:{src:{sg:"https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/5.0/plugin/tracer.js",va:"https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/5.0/plugin/tracer.js"},object:"LogTracer"},visual:{src:{sg:"https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/5.0/plugin/visual.js",va:"https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/5.0/plugin/visual.js"},object:"LogVisual"}},getLogPluginSpace=function(){return"undefined"!=typeof window?(window.LogPluginObject||(window.LogPluginObject={}),window.LogPluginObject):null},pluginObject=getLogPluginSpace(),PluginExtend=function(){function e(){}return e.prototype.apply=function(e,t){this._plugin={},this.config=t,this.collect=e,this.channel=t.channel||"cn",this.loadExtend()},e.prototype.loadExtend=function(){var e=this;try{this.collect.remotePlugin.forEach((function(t,r){if("sdk"===t)if(pluginExtendList.hasOwnProperty(r)){var n=pluginExtendList[r].object,i=""+pluginExtendList[r].src[e.channel];e.exist(r,n,i)}else console.warn("your "+r+" is not exist,please check plugin name");else"object"==typeof t&&(t.src?e.exist(r,t.call,t.src):e.process(r,t.instance,"INSTANCE"))}))}catch(t){this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:t.message}),console.log("load extend error")}},e.prototype.exist=function(e,t,r){var n=this;pluginObject[t]?(this.process(e,pluginObject[t]),console.log("已有"+e+"插件,避免重复加载~")):this.loadPlugin(e,r,(function(){n.process(e,pluginObject[t]),console.log(" %c %s %s %s","color: yellow; background-color: black;","–","load plugin:"+e+" success","-")}),(function(){console.log(" %c %s %s %s","color: red; background-color: yellow;","–","load plugin:"+e+" error","-")}))},e.prototype.process=function(e,t,r){try{if(r){var n=new t;n.apply&&n.apply(this.collect,this.config),console.log("excude "+e+" success")}else t&&t(this.collect,this.config)}catch(i){this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:i.message}),console.log("excude "+e+" error, message:"+i.message)}},e.prototype.loadPlugin=function(e,t,r,n){var i=this;try{var o=document.createElement("script");o.src=t,this._plugin[e]||(this._plugin[e]=[]),this._plugin[e].push(r),o.onerror=function(){n(t)},o.onload=function(){i._plugin[e].forEach((function(e){e()}))},document.getElementsByTagName("head")[0].appendChild(o)}catch(a){this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:a.message})}},e}(),Verify=function(){function e(){this.verifyReady=!1,this.waitTime=5e3,this.cleanStatus=!1}return e.prototype.apply=function(e,t){var r=this;this.collector=e,this.config=t;var n=e.adapters.storage;this.cacheStorgae=new n(!1,"session"),this.eventStorage=[],this.collector.on("submit-verify",(function(e){e&&e.length&&r.eventStore(e[0])})),this.checkCache()},e.prototype.checkCache=function(){var e=this;this.verifyCookieKey="__applog_verify_set_"+this.config.app_id,this.cacheStorgae.getCookie(this.verifyCookieKey);var t=this.cacheStorgae.getItem(this.verifyCookieKey);this.sign=t&&t.sign||"",this.origin=t&&t.origin||"*";var r=setTimeout((function(){e.cleanVerify(),clearTimeout(r),e.collector.off("submit-verify")}),this.waitTime);window.addEventListener("message",(function(t){t&&t.data&&"simulator:verify"===t.data.type&&(clearTimeout(r),e.receMessage(t))}),!0)},e.prototype.receMessage=function(e){if(!this.cleanStatus){var t=e.data;this.verifyReady=!0,this.sign=t.sign,this.origin=e.origin,this.cacheStorgae.setItem(this.verifyCookieKey,JSON.stringify({sign:t.sign,origin:e.origin})),this.eventStorage.length&&this.postVerify(this.eventStorage,t.sign,e.origin)}},e.prototype.eventStore=function(e){this.cleanStatus||(this.verifyReady?this.postVerify(e,this.sign,this.origin):this.eventStorage.push(e))},e.prototype.cleanVerify=function(){this.cleanStatus=!0,this.eventStorage=[]},e.prototype.postVerify=function(e,t,r){try{var n=[];isArray(e)?e.forEach((function(e){n.push(e)})):n.push(e);var i={type:"simulator:verify:event",sign:t,pageUrl:window.location.href,events:n};(window.opener||window.parent).postMessage(i,r)}catch(o){console.log("web verify post message error ~")}},e}(),RuotePage=function(){function e(){this.autotrack=!1,this.spa=!1,this.cache={},this.allowHash=!1}return e.prototype.apply=function(e,t){if(t.spa||t.autotrack){var r=e.Types;this.collect=e,this.config=t,this.appid=t.app_id,this.allowHash=t.allow_hash,this.fncArray=new Map,this.setKey(),this.setLocation(),this.hack(),this.init(),this.listener(),e.emit(r.RouteReady)}},e.prototype.setKey=function(){var e=this.collect.adapters.storage;this.storage=new e(!1),this.cache_key="__tea_cache_refer_"+this.appid,this.cache={refer_key:location.href,refer_title:document.title||location.pathname,refer_manual_key:""},this.config.autotrack&&"object"==typeof this.config.autotrack&&this.config.autotrack.page_manual_key&&(this.cache.refer_manual_key=this.config.autotrack.page_manual_key),this.storage.setItem(this.cache_key,this.cache)},e.prototype.hack=function(){var e=this,t=window.history.pushState;history.pushState=function(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];"function"==typeof history.onpushstate&&history.onpushstate({state:r});var o=t.call.apply(t,__spread([history,r],n));if(e.lastLocation!==location.href){var a=e.getPopStateChangeEventData();return e.lastLocation=location.href,e.sendPv(a,"pushState"),o}};var r=history.replaceState;history.replaceState=function(t){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];"function"==typeof history.onreplacestate&&history.onreplacestate({state:t});var o=r.call.apply(r,__spread([history,t],n));if(e.lastLocation!==location.href){var a=e.getPopStateChangeEventData();return e.lastLocation=location.href,e.sendPv(a),o}}},e.prototype.setLocation=function(){"undefined"!=typeof window&&(this.lastLocation=window.location.href)},e.prototype.init=function(){var e=this.getPopStateChangeEventData();this.collect.emit("route-change",{config:e,init:!0})},e.prototype.listener=function(){var e=this,t=null;window.addEventListener("hashchange",(function(r){if(e.lastLocation!==window.location.href&&(clearTimeout(t),e.allowHash)){e.lastLocation=window.location.href;var n=e.getPopStateChangeEventData();e.sendPv(n)}})),window.addEventListener("popstate",(function(r){e.lastLocation!==window.location.href&&(t=setTimeout((function(){e.lastLocation=window.location.href;var t=e.getPopStateChangeEventData();e.sendPv(t)}),10))}))},e.prototype.getPopStateChangeEventData=function(){var e=this.pageConfig();return e.is_back=0,e},e.prototype.pageConfig=function(){try{var e,t,r=this.storage.getItem(this.cache_key)||{};e=document.referrer?document.referrer:r&&r.refer_key||"";var n=this.storage.getItem("__tea_cache_first_"+this.appid);return t=!n||1!=n,{is_html:1,url:location.href,referrer:e,page_key:location.href,refer_page_key:e,page_title:document.title||location.pathname,page_manual_key:this.config.autotrack&&this.config.autotrack.page_manual_key||"",refer_page_manual_key:r&&r.refer_manual_key||"",refer_page_title:r&&r.refer_title||"",page_path:location.pathname,page_host:location.host,is_first_time:""+t}}catch(i){return this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:i.message}),{}}},e.prototype.sendPv=function(e,t){this.collect.emit("route-change",{config:e,init:!1})},e}();Collector$1.usePlugin(PluginExtend,"extend"),Collector$1.usePlugin(Tracer,"tracer"),Collector$1.usePlugin(Ab,"ab"),Collector$1.usePlugin(Stay,"stay"),Collector$1.usePlugin(AutoTrack,"autotrack"),Collector$1.usePlugin(Verify,"verify"),Collector$1.usePlugin(Et,"et"),Collector$1.usePlugin(Profile,"profile"),Collector$1.usePlugin(CepRule,"cep"),Collector$1.usePlugin(HeartBeat,"heartbeat"),Collector$1.usePlugin(Monitor,"monitor"),Collector$1.usePlugin(RuotePage,"route"),Collector$1.usePlugin(Tracer,"tracer"),new Collector$1("default");var Collector$1$1=Collector$1;function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return(_typeof="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 _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==typeof t?t:String(t)}var DEBUG="undefined"!=typeof window&&window.location.href.indexOf("loggerdebug")>-1;function computeWatchDur(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=0,r=0;r<e.length;r++)isNaN(Number(e[r].end))||isNaN(Number(e[r].begin))||e[r].begin<0||e[r].end<0||e[r].end<e[r].begin||(t+=e[r].end-e[r].begin);return parseInt(1e3*t,10)}function getHostFromUrl(e){if(null==e||""===e||"string"!=typeof e)return"";var t=e.split("/"),r="";return t.length>3&&t[2]&&(r=t[2]),r}function generateSessionId(e){var t=(new Date).getTime();try{e=parseInt(e)}catch(e2){e=0}return t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=window.performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))}function isType(e){return function(t){return Object.prototype.toString.call(t)==="[object ".concat(e,"]")}}function getResponseHeaders(e){var t={};if(e instanceof window.XMLHttpRequest)try{e.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((function(e){var r=e.split(": "),n=r.shift(),i=r.join(": ");t[n]=i}))}catch(r){}return t}function log(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];DEBUG&&(t=console).log.apply(t,["[logger]",e].concat(n))}function nowTime(){try{return Math.round(window.performance.now())}catch(e2){return(new Date).getTime()}}function curTimestamp(){return(new Date).getTime()}function formatData(e,t){var r={ext:e.ext||{},data:{}};return Object.keys(e).map((function(n){t[n]?r.data[t[n]]=e[n]:"ext"!==n&&(r.ext[n]=e[n])})),r}function getXhr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(r,n){try{e||n(new Error("url is undefined"));var i=nowTime(),o=i,a={},s=new window.XMLHttpRequest;s.open("get",e),s.onreadystatechange=function(){2===s.readyState&&(a.headers=getResponseHeaders(s),a.connectTime=nowTime()-o,a.status=s.status,a.statusText=s.statusText,i=nowTime())},s.onload=function(){r(a)},s.onprogress=function(e){var t,r=nowTime()-i;t=parseInt(e.loaded/1e3/(r/1e3),10),a.speed=0|t,a.costTime=r},s.onerror=function(e){a.status||(a.status=-1,a.costTime=nowTime()-i),n(a)},s.ontimeout=function(){a.status||(a.status=-2,a.costTime=nowTime()-i),r(a)},s.onabort=function(){r(a)},s.responseType="arraybuffer",s.timeout=t.timeout||1e4,s.setRequestHeader("Range","bytes=".concat(t.range||"0-1048576")),s.send()}catch(e2){n(e2)}}))}function checkVideoSrcIsEmpty(e){return!e||window.location.href.indexOf(e)>-1}function checkIsBlob(e){return!!e&&/^blob:/.test(e)}var KEYMAP={x_response_sinfo:"x-response-sinfo",x_response_cache:"x-response-cache",x_response_cinfo:"x-response-cinfo"};function transformHeader(e){if(!e)return{};var t={};return Object.keys(KEYMAP).map((function(r){if(e[r]||"string"!=typeof KEYMAP[r]){if(!e[r]&&KEYMAP[r]instanceof Array){var n=KEYMAP[r].filter((function(t){return void 0!==e[t]}));n.length>0?t[r]=e[n[0]]:t[r]=""}}else t[r]=e[KEYMAP[r]]||""})),t}function appendData(e,t){return!e||"string"!=typeof t&&"number"!=typeof t?t:e+""+t}function typeOf(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}function parseTempData(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return Object.keys(t).map((function(n){e[n]="append"===r?appendData(e[n],t[n]):t[n]})),e}function hasClass(e,t){if(!e||!t)return!1;try{return Array.prototype.some.call(e.classList,(function(e){return e===t}))}catch(e2){var r=e.className&&"object"===_typeof(e.className)?e.getAttribute("class"):e.className;return r&&!!r.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}}function formatDefinition(e){return"String"===typeOf(e)?e.replace("P","p"):e?"Number"===typeOf(e)?"".concat(e):void 0:""}function toJsonString(e){try{return JSON.stringify(e)}catch(e2){return""}}function checkUrlIsExpired(e){if(!e||"String"!==typeOf(e))return 0;var t=0;try{var r=new RegExp("(\\?|&)x-tos-expires=([^&]*)(&|$)"),n=e.match(r);if(null!==n)t=parseInt(n[2],10);else{var i=e.split("/");i.length>5&&8===i[4].length&&(t=parseInt(i[4],16))}return t>0?t<parseInt((new Date).getTime()/1e3,10)?1:2:0}catch(e2){return 0}}var ENTRIES=[],MAX_COUNT=30;function findPerformanceInfo(e){var t={};try{e=e.replace(/^http:|^https:/,"");for(var r=ENTRIES||[],n=function(n){if(r[n].name.replace(/^http:|^https:/,"")===e)return["domainLookupEnd","domainLookupStart","startTime","requestStart","responseEnd","responseStart","connectStart","connectEnd","fetchStart"].map((function(e){t[e]=Math.round(r[n][e])})),t.url=r[n].name,t.duration=Math.round(r[n].duration),t.domainDuration=t.domainLookupEnd-t.domainLookupStart,t.connectDuration=t.connectEnd-t.connectStart,"break"},i=r.length-1;i>=0&&"break"!==n(i);i--);return t}catch(e2){return t}}function addPerformaceObserver(){try{new window.PerformanceObserver((function(e,t){var r=e.getEntriesByType("resource");ENTRIES.length>MAX_COUNT&&ENTRIES.splice(0,ENTRIES.length-MAX_COUNT);for(var n=0;n<r.length;n++)ENTRIES.push(r[n])})).observe({entryTypes:["resource"]})}catch(e2){console.warn("PerformanceObserver not support",e2)}}"undefined"!=typeof window&&addPerformaceObserver();var REPORT_EVENTS={ONE_PLAY:"videoplayer_oneplay",ONE_OPERA:"videoplayer_oneopera",ONE_ERROR:"videoplayer_oneerror",ONE_EVENT:"videoplayer_oneevent",ONE_TEMP:"videoplayer_onetemp"},ERROR_TYPES={data:1e3,runtime:1002,parse:1004,network:1003,no_error_handler:9997,custom_error:9998,other:9999,notSupport:1005},ERROR_CODES={1:-499991,2:-499992,3:-499993,4:-499994,5:-499995},PLAYBACK_STATE={STOP:0,PLAYING:1,PAUSE:2,ERROR:3,LOADING:4},LOAD_STATES={UNKNOWN:0,PLAYABLE:1,STALLED:2,ERROR:3},ENDED_TYPE={ERROR:1,NEXT:2,ENDED:3,UNLOAD:4,DESTROY:5,PLAY_CATCH:6,PLAY_ERROR:7},LOGTYPES={RETRY:"error_retry",ONEERROR:"oneerror",ONEEVENT:"oneevent",ONETEMP:"onetemp"},CACHE_FILE_TYPE={NO_CACHE:0,CACHED:1},MAX_TIME=432e5,MAX_COST=36e5,COMMON_KEYS=["tag","subtag","device_type"],MIN_WAITIONG=200,MAX_STALL_TIME=6e4,isSupport=_isLocalStorageUsable();function probeSupport(){try{return"undefined"!=typeof localStorage&&"setItem"in window.localStorage&&!!window.localStorage.setItem}catch(e2){return!1}}function checkIfLocalStorageThrows(){var e="_localstorage_support_test";try{return window.localStorage.setItem(e,!0),window.localStorage.removeItem(e),!1}catch(e2){return!0}}function _isLocalStorageUsable(){return probeSupport()&&!checkIfLocalStorageThrows()}var Strorage=isSupport?window.localStorage:{},LOGKEY="__xgplayerlogkey",LOCAL_LOG={set:function(e){try{var t=this.get();t.push(e),Strorage.setItem(LOGKEY,JSON.stringify(t))}catch(r){}},get:function(){try{var e=Strorage.getItem(LOGKEY);return e?JSON.parse(e):[]}catch(t){return[]}},remove:function(){try{Strorage.removeItem(LOGKEY)}catch(e2){}},clear:function(){try{Strorage.clear()}catch(e2){}}},RegMap=[{key:"QQBrowser",reg:/(qqbrowser)\/([\d.]+)/},{key:"QIHU360EE",reg:/qihu 360ee/},{key:"QIHU360SE",reg:/qihu 360se/},{key:"2345Explorer",reg:/(2345explorer)\/([\d.]+)/},{key:"Sogou",reg:/(metasr)/},{key:"Wexin",reg:/(micromessenger)\/([\d.]+)/},{key:"Openlanguage",reg:/(openlanguage)\/([\d.]+)/},{key:"NewsArticle",reg:/(newsarticle)\/([\d.]+)/},{key:"VideoArticle",reg:/(videoarticle)\/([\d.]+)/},{key:"Hotsoon",reg:/(live_stream)_([\d.]+)/},{key:"Aweme",reg:/(aweme)_([\d.]+)/},{key:"Lark",reg:/(lark)\/([\d.]+)/},{key:"PlayStation",reg:/(playstation)/},{key:"BingPreview",reg:/(bingpreview)\/([\d.]+)/},{key:"Baiduspider",reg:/(baiduspider-render)\/([\d.]+)/},{key:"YandexBot",reg:/(yandexbot)\/([\d.]+)/},{key:"Chrome",reg:/(chrome)\/([\d.]+)/},{key:"Safari",reg:/(version)\/([\d.]+)\s*(safari)/}],IERegMap=[{key:"Trident",reg:/(rv:)([\d.]+)/},{key:"Trident",reg:/(msie)\s*([\d.]+)/}];function isSupportMP4(){var e={isSupport:!1,mime:""};if("undefined"==typeof document)return e;var t=document.createElement("video");return"function"==typeof t.canPlayType?(["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"].map((function(r){"probably"===t.canPlayType('video/mp4; codecs="'.concat(r,'"'))&&(e.isSupport=!0,e.mime+="||".concat(r))})),e):(t=null,e)}var SPIDER_UA=["Baiduspider","YandexBot"];function checkIsSpider(e,t){var r=!1;return SPIDER_UA.map((function(t){t===e&&(r=!0)})),/(\+http|; http|\(http):\/\/([\w.]+\/?)\S*/.test(t)&&(r=!0),r}function detect(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e=e.toLocaleLowerCase();var t=/(iphone)/.test(e)||/(ipad)/.test(e),r=/(android)/.test(e),n=/(windows phone)/.test(e),i=t||r||n,o={isIOS:t,isAndroid:r,isMobile:i,isPC:!i,isPad:/(ipad)/.test(e)},a=isSupportMP4();o.isSupportMP4=a.isSupport,o.mime=a.mime;var s="",l=0,c=[],u=RegMap;/trident/.test(e)&&(u=IERegMap);for(var h=0;h<u.length;h++)if(c=u[h].reg.exec(e)){s=u[h].key,l=c.length>2?c[2]:"";break}if(s)o["is".concat(s)]=!0,o.name=s,o.appVersion=l;else{var d=checkIs360();d&&(o.name="360EE")}if(o.name&&"Trident"!==o.name){var p=/(trident)/.exec(e);p&&(o.name=o.name?"".concat(o.name,"_Trident"):"Trident")}return o.isSpider=checkIsSpider(o.name),o}function checkIs360(){var e=navigator.mimeTypes;if(e){for(var t=0;t<e.length;t++){if(e[t].type&&e[t].type.indexOf("360")>-1)return!0;if(e[t].type&&e[t].type.indexOf("application/vnd.chromium.remoting-viewer")>-1)return!0;if(e[t].description&&e[t].description.indexOf("360")>-1)return!0}return!1}}var Browser="undefined"!=typeof navigator&&detect(navigator.userAgent);function isHevcSupported(){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"'))}function probeConfigSupported(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 r=e.video||{},n=e.audio||{};try{var i=MediaSource.isTypeSupported(r.contentType),o=MediaSource.isTypeSupported(n.contentType);return Promise.resolve({supported:i&&o,smooth:!1,powerEfficient:!1})}catch(e2){return Promise.resolve(t)}}var defaultConfig={range:"0-1048576",timer:6e4,timeout:15e3},SpeedCheckTask=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,e),Object.keys(defaultConfig).map((function(e){void 0!==t[e]&&null!==t[e]||(t[e]=defaultConfig[e])})),this.options=t,this._headers={},this.intervalId=null,this.ishangUp=!1,this._data={contentLength:0,statusText:"",status:-1,speed:0,costTime:0,connectTime:0,contentType:""},this.url=[]}return _createClass(e,[{key:"setData",value:function(e,t){var r=this;if(Object.keys(e).map((function(t){"headers"!==t&&(r._data[t]=e[t])})),e.headers&&Object.keys(e.headers).length>0){this._headers=transformHeader(e.headers),e.headers["content-type"]&&(this._data.contentType=e.headers["content-type"]);var n=(e.headers["content-range"]||"").split("/");n&&n.length>1&&(this._data.contentLength=parseInt(n[1]))}}},{key:"contentLength",get:function(){return this._data.length||0}},{key:"trigger",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"start",n=this.options;this.url=e,!this.url||"start"!==r&&(this.ishangUp||this.intervalId)?log("task>>cant`t trigger url",this.ishangUp,this.intervalId):(log("task>>trigger url ",e),this.ishangUp=!0,this.intervalId&&this.clear(),this.intervalId=setTimeout((function(){t.clear()}),"start"===r?500:n.timer),getXhr(this.url,{range:"start"===r?"0-1024":n.range,timeout:n.timeout}).then((function(e){log("getXhr>>check result ",e),t.setData(e||{}),t.ishangUp=!1})).catch((function(e){log("getXhr>>error ",e),t.ishangUp=!1,t._data.status=-1})))}},{key:"url",get:function(){return this.options.url},set:function(e){e&&(this.options.url=e)}},{key:"serverIp",get:function(){return this._headers.x_response_sinfo||""}},{key:"headers",get:function(){return this._headers||{}}},{key:"status",get:function(){return this._data.status||-1}},{key:"speed",get:function(){return this._data.speed}},{key:"clear",value:function(){clearTimeout(this.intervalId),this.intervalId=null}}]),e}(),VERSION="0.11.15";log("xgVodLogger version is ".concat(VERSION));var isObject=isType("Object"),TEA_ID=1300,LS_KEY="__tea_cache_tokens_".concat(TEA_ID),DEFAULT_INTERVAL=-1,AB_SDK_VERSION="",Collector=null,__support=Browser.isSupportMP4?1:0;__support=isHevcSupported()?__support+2:__support,probeConfigSupported({type:"file",video:{contentType:'video/mp4;codecs="hev1.1.6.L120.90"',width:1920,height:1080,bitrate:1e4,framerate:30}}).then((function(e){e&&e.supported&&(__support+=1)})).catch((function(e){}));var XGPlayerAppLogger=function(){function e(t,r){var n=this;if(_classCallCheck(this,e),_defineProperty(this,"initializeUrlLog",(function(e){var t=e&&e.url?e.url:"String"===typeOf(e)?e:"";"String"!==typeOf(t)&&(t=""),n.urlLog={initial_url:t,initial_host:getHostFromUrl(t),initial_ip:""}})),_defineProperty(this,"onXgLogCache",(function(){var e,t,r=null===(e=n.player)||void 0===e?void 0:e.getLogCache();r&&(n._templog={vtype:null===(t=n.player)||void 0===t?void 0:t.vtype,log:r},n.onOneTemp())})),_defineProperty(this,"onMediaFormatError",(function(e){n.onOneEvent({end_type:(e.error_type||"")+"Error"})})),_defineProperty(this,"onDrmTypeChange",(function(e){n.addIfExist("drm_type",{drm_type:e},n._options)})),_defineProperty(this,"onReplayBtnClick",(function(){n.resetLoggerParams()})),_defineProperty(this,"onBeforeDefinitionChange",(function(){n.resLogs.ldst=nowTime(),n._endType="switch"})),_defineProperty(this,"onDefinitionChange",(function(e){var t=e.from,r=e.to;n.changeResolution({from:t,to:r,startTime:n.resLogs.ldst,operaType:"switch"}),log("onDefinitionChange from:".concat(t,", to:").concat(r))})),_defineProperty(this,"onDefiChangeSuccess",(function(){log("onDefinitionChangeSuccess"),n.updateVideoSize(),n.triggerTask("start")})),_defineProperty(this,"onAbrChange",(function(e){var t=e.prev,r=e.cur,i=e.abrInfo;if(n.player.abrInstance){var o=n.player.abrInstance.eventInfo;log("abrChange",o),o.last_definition=t,o.now_definition=r,n.abrInfo.abr_event_info.video_switch.push(o),n.changeResolution({from:t,to:r,startTime:nowTime(),operaType:"abr_switch",abrInfo:i})}})),_defineProperty(this,"onAbrPrestallEnd",(function(e){n.abrInfo.abr_user_info.cancel_abr=e?1:0})),_defineProperty(this,"onTimeUpdate",(function(){var e=n.playlogs,t=n.resLogs,r=n.player;if(n.errorLog.try_err_c=0,e.vt||1!==n.startStep||(e.vt=curTimestamp(),log("onTimeUpdate: first frame inited","currentTime11:".concat(r.currentTime," vt-pt:").concat(e.vt-e.pt," vt-nt:").concat(e.vt-e.nt," vt-rt:").concat(e.vt-e.rt)),n.startStep=2),!t.initial_resolution){var i=r.currentDefitionFromPler&&r.currentDefitionFromPlayer.definition?r.currentDefitionFromPlayer.definition:r.config.defaultDefinition||r.video.videoHeight+"p"||"";i=formatDefinition(i),t.initial_resolution=i}t.final_resolution||(t.final_resolution=t.initial_resolution);var o=e.played.length;o<1?e.played.push({begin:r.currentTime,end:-1}):e.played[o-1].end=r.currentTime;var a=t.played.length;a<1?t.played.push({begin:r.currentTime,end:-1}):t.played[a-1].end=r.currentTime,n.lastVideoTime=r.currentTime||0})),_defineProperty(this,"onCanplay",(function(){log("onCanplay","this.startStep:".concat(n.startStep," ").concat(curTimestamp())),n.setVt()})),_defineProperty(this,"onLoadeddata",(function(){log("onLoadeddata","this.startStep:".concat(n.startStep," ").concat(curTimestamp())),n.setVt(),n.updateVideoSize()})),_defineProperty(this,"onLoadStart",(function(){var e=checkVideoSrcIsEmpty(n.player.currentSrc);n.triggerTask("start"),log("onLoadStart","this.startStep:".concat(n.startStep," ").concat(curTimestamp()," isSrcEmpty:").concat(e," player.src:").concat(n.player.src)),0!==n.startStep||e||"visible"!==document.visibilityState||n.setPt()})),_defineProperty(this,"onDashStateChange",(function(e){log("onDashStateChange","this.startStep:".concat(n.startStep," ").concat(nowTime()," state:").concat(e));var t=n.playlogs;if(n.startStep<2)switch(e){case"player_start":t.dash_pst=nowTime();break;case"wasm_start":t.dash_wst=nowTime();break;case"wasm_ready":t.dash_wrt=nowTime();break;case"init_finished":t.dash_ift=nowTime();break;case"core_start":t.dash_cst=nowTime();break;case"start_play":t.dash_spt=nowTime()}})),_defineProperty(this,"onBufferedChange",(function(){var e=n.player.video&&n.player.video.buffered;if(e){var t=e.length;t>0&&e.end(t-1)+1>n.player.duration&&(n.bft=curTimestamp())}})),_defineProperty(this,"onPlayerInited",(function(){log("player init"),n._playerCreatedTime=curTimestamp(),n.playlogs.rt=curTimestamp()})),_defineProperty(this,"onNotAutoPlay",(function(){log("onNotAutoPlay","autoplay:".concat(n.isAutoplay)),0===n.isAutoplay?n.isAutoplay=2:1===n.isAutoplay&&(n.isAutoplay=3)})),_defineProperty(this,"onDashError",(function(e){e=e||{};var t=n.errorLog;t.last_errors.push(e.errorCode),t.accu_errc++,n.onOneError({errorType:e.errorTypeCode,code:e.errorCode,url:e.url||"",headers:e.headers||{}},0)})),_defineProperty(this,"onPlayerError",(function(e){e=e||{};var t=n.errorLog,r=n.player;if(log("onPlayerError","this.player.type:".concat(n.player.type," this.player.replayRunning:").concat(n.player.replayRunning," isSupportMP4:").concat(Browser.isSupportMP4," isPC:").concat(Browser.isPC)),log("onPlayerError",e),n.load_state=LOAD_STATES.ERROR,n._endType="error",n.suspendWaitingStatus("onPlayerError"),"dash"!==r.type||!r.replayRunning){if(e.url||(e.url=n.player.currentSrc),Browser.isPC&&!Browser.isSupportMP4||Browser.isSpider)return t.errc=ERROR_CODES[5],t.errt=ERROR_TYPES.notSupport,n.onOneError({errorType:t.errt,code:t.errc,url:e.url,headers:e.headers||{},message:e.message||""},0),void(n._isOnePlayReport=!0);t.errt=e.errorTypeCode||(e.errorType&&ERROR_TYPES[e.errorType]?ERROR_TYPES[e.errorType]:9999),e.errorCode?t.errc=e.errorCode>0&&ERROR_CODES[e.errorCode]?ERROR_CODES[e.errorCode]:e.errorCode:e.code&&(t.errc=e.code>0&&ERROR_CODES[e.code]?ERROR_CODES[e.code]:e.code),t.last_errors.push(t.errc),0===t.fir_errc&&(t.fir_errc=t.errc),n.onOnePlay(ENDED_TYPE.ERROR),n.onOneTemp(ENDED_TYPE.ERROR),n.sendDegradeLog("playCatch_end",n.playlogs.degrade);var i=!1;!n._options.needXhrCheck||4!==e.errorCode&&2!==e.errorCode||(i=!0),n.onOneError({endState:ENDED_TYPE.PLAY_ERROR,errorType:t.errt,code:t.errc,url:e.url,headers:e.headers||{},message:e.message||""},0,i),n.sendEventsQueue()}})),_defineProperty(this,"onPlayInterfaceInfo",(function(e){log("onPlayInterfaceInfo",e);var t=n.errorLog,r=n.apiLog,i=n.playlogs;if(e&&Object.keys(e).map((function(t){"code"===t?r.vsc=e[t]:"message"===t?r.vsc_message=e.message||"success,视频可正常播放":r[t]=e[t]})),i.at=e.timestamep||(new Date).getTime(),(!e.error||-9988!==e.error.errc)&&(r.vsc=e.code||10,r.vsc_message=e.message||"success,视频可正常播放",e.error)){var o=e.error;t.errt=1e3,t.errc=o.errc||-9998,t.last_errors.push(o.errc||-9998),0===t.fir_errc&&(t.fir_errc=o.errc||-9998),t.accu_errc++,1===t.accu_errc&&(t.fir_errt=nowTime()),n.onOneError({errorType:1e3,code:o.errc||-9998,url:"",headers:{}})}})),_defineProperty(this,"onProgressEvent",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=n.netLog;if(e.speed){var r=e.speed>1e6?Math.floor(e.speed/1e3):e.speed;t.downloadSpeed=r,t.totalSpeed+=r,t.rqCount++}"oversize"!==e.type&&t.requestCount++,e.connectTime&&(t.connectCost=e.connectTime);var i=t.rqCount<7?100:e.costTime>=5e3?20:10;if(!("success"===e.type&&parseInt(100*Math.random(),10)<=i)){var o=findPerformanceInfo(e.cdnUrl),a=e.xhr||{},s=e.type?"progress_".concat(e.type):"progress",l=e.headers;l||(l=getResponseHeaders(a));var c=_objectSpread2(_objectSpread2({},l=transformHeader(l)),{},{download_speed:t.downloadSpeed,connect_cost:t.connectCost,c_dur:o.connectDuration||0,d_dur:o.domainDuration||0,r_dur:o.duration||0,rqtt:(new Date).getTime(),x_cache:l.x_response_cache||"",server_ip:l.x_response_sinfo});e.status?t.status=e.status:a&&a instanceof window.XMLHttpRequest&&(t.status=a.status||0),c.status=t.status;var u=e.cdnUrl||e.url;"error"===e.type&&n.merror.cdn.push(_objectSpread2(_objectSpread2({costTime:e.costTime,cur_play_pos:e.pos,cdn_url:u,cdn_host:getHostFromUrl(u)},c),l)),n.onOneEvent({costTime:e.costTime,vid:e.vid,end_type:s,cur_play_pos:e.pos,cdn_url:u,cdn_host:getHostFromUrl(u)},c,"error"===e.type?0:2)}})),_defineProperty(this,"onNext",(function(e){if(log("onNext:startStep:",n.startStep),n.startStep>0){if(n._reportInvalidVV(ENDED_TYPE.NEXT))return;n.onOnePlay(ENDED_TYPE.NEXT),n.onOneTemp(ENDED_TYPE.NEXT),n.sendEventsQueue()}n.vtype=null,n.playlogs.lc=0,n.resetLoggerParams()})),_defineProperty(this,"onNextEnded",(function(){var e=n.player,t=n.resLogs,r=formatDefinition(e.config.defaultDefinition||"");t.initial_resolution=r,t.final_resolution=r})),_defineProperty(this,"onXgLogWaiting",(function(e){var t=n.playlogs,r=n.resLogs,i=n.stall;if(n._options.checkByInnerLog&&0===e.type){log("onXgLogWaiting",e);var o=e.endType,a=e.costTime,s=e.start,l={download_speed:n.realSpeed,avg_speed:n.avgSpeed,mse_op:n.mp4MseOpLength,mp4_load_range:n.mp4LoadSegmentTimeRange,bitrate:n.curBitrate};if("waitingStart"===e.eventType)return n.onOneEvent({costTime:a,end_type:"waitstart"},l,2),void n.appendStallInfo("start",s);if("waitingEnd"===e.eventType){var c=nowTime();log("onXgLogWaiting>>".concat(o,"|costTime:").concat(a," vt:").concat(t.vt)),n.appendStallInfo("end",c,o),t.bc++,n.checkInBuffer(n.player.currentTime)?(t.de_bu_acu_t+=a,t.dbc++):(t.nbc++,t.n_bu_acu_t+=a),r.bc++,t.bu_acu_t+=a,r.bu_acu_t+=a,i.stall_end=c,i.stall_last_interval=i.stall_end-i.stall_start,i.stall_acc_time+=i.stall_last_interval,1===i.sc&&(i.first_buf_endt=c),n.onOneEvent({costTime:a,end_type:"waitend"},l,2)}}})),_defineProperty(this,"onSeeking",(function(){if(!checkVideoSrcIsEmpty(n.player.src)){var e=n.resLogs,t=n.playlogs,r=n.player,i=n.seekLog;log("onSeeking","currentTime:".concat(r.currentTime)),0===n.startStep&&n.setPt(),n.suspendWaitingStatus("seek"),n.isSeeking&&n.suspendSeekStatus("seek",!1),n.isSeeking=!0,t.played.push({begin:n.player.currentTime,end:-1}),e.played.push({begin:n.player.currentTime,end:-1}),i.lastSeekStartTime=nowTime(),i.seekBefore=n.lastVideoTime.toString(),i.intervalId=setTimeout((function(){n.isSeeking&&n.suspendSeekStatus("seekTimeout",!0)}),MAX_STALL_TIME)}})),_defineProperty(this,"onSeeked",(function(){checkVideoSrcIsEmpty(n.player.src)||n.isSeeking&&n.suspendSeekStatus("seeked",!0)})),_defineProperty(this,"onPlaying",(function(){n.suspendWaitingStatus("play"),n.load_state=LOAD_STATES.PLAYABLE;var e=nowTime();n.pauseLog.isPausing&&(n.pauseLog.isPausing=!1,n.pauseLog.pause_acu_t+=e-n.pauseLog.pause_start)})),_defineProperty(this,"onPlayCatch",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorTypeCode:0,errorCode:0,url:"",headers:{},status:0};if(log("onPlayCatch",e,t),e){switch(e){case"mp42dash":n.vtype="DASH_2";break;case"dash2mp4":n.vtype="MP4_2";break;case"dash1mp4":n.vtype="MP4_1";break;default:n.vtype=e}var r=n.errorLog,i=n.playlogs,o=n.merror;o.playCatch.push(_objectSpread2({errc:t.errorCode,errt:t.errorType},t.headers)),n.setBr("playcatch"),r.accu_errc++,r.try_err_c++,r.fir_errc=t.errorCode,t.errorCode&&r.last_errors.push(t.errorCode),n.suspendWaitingStatus("playcatch"),n.sendDegradeLog("playCatch",i.degrade,{cdn_url:t.url}),i.degrade=e,n.onOneError({errorType:t.errorTypeCode,code:t.errorCode,url:t.url||"",status:t.httpCode||t.status,headers:t.headers||{},vid:t.vid||n.vid,preload_hit:t.preloadHit||0,preload_cached:t.preloadCached||0,endState:ENDED_TYPE.PLAY_CATCH,costTime:t.costTime,message:t.errorMessage||t.message},0)}})),_defineProperty(this,"onMediaExpied",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{errorType:"",errorTypeCode:0,errorCode:0,url:"",headers:{},status:0},t=n.errorLog,r=n.playlogs;log("onMediaExpied",e),n.suspendWaitingStatus("expied"),n.setBr("expied"),t.accu_errc++,t.try_err_c++,t.last_errors.push(e.errorCode),r.at=(new Date).getTime(),n.merror.expied.push(_objectSpread2({errorType:e.errorTypeCode||e.errorType,code:e.errorCode,url:e.url||"",status:e.status},transformHeader(e.headers||{}))),n.onOneError({errorType:e.errorTypeCode||e.errorType,code:e.errorCode,url:e.url||"",status:e.status,headers:e.headers||{}},0)})),_defineProperty(this,"onLog",(function(e){log("onLog",e);var t=e.type;if(delete e.type,t)switch(t){case LOGTYPES.RETRY:break;case LOGTYPES.ONETEMP:n._templog||(n._templog={}),n._templog=parseTempData(n._templog,e.data,e.action),n._templog.preload_hit&&(n._cacheFile=CACHE_FILE_TYPE.CACHED);break;case LOGTYPES.ONEERROR:var r=n.errorLog;r.accu_errc++,r.try_err_c++,n.setBr("mp4error"),r.last_errors.push(e.code),n.onOneError(e,0);break;case LOGTYPES.ONEEVENT:var i=formatData(e,{costTime:"costTime",vid:"vid",end_type:"end_type",pos:"cur_play_pos",cdnUrl:"cdn_url"});i.ext&&["start","end"].map((function(e){i.ext[e]&&(i.ext["ext_".concat(e)]=i.ext[e],delete i.ext[e])})),n.onOneEvent(i.data,i.ext,2)}})),_defineProperty(this,"onPlay",(function(){log("onPlay","this.startStep :".concat(n.startStep," this.isEnded:").concat(n.isEnded)),n.isEnded&&(n.resetLoggerParams(),n.setPt())})),_defineProperty(this,"onPause",(function(){log("onPause");var e=n.pauseLog;e.isPausing=!0,e.pause_start=nowTime()})),_defineProperty(this,"onWaiting",(function(){var e=n.stall,t=n._options;n.updateCurBuffer("onWaiting"),t.checkByInnerLog||(log("onWaiting>","isSeeking:".concat(n.isSeeking," startStep:").concat(n.startStep," intervalId:").concat(e.intervalId)),n.isSeeking||0===n.playlogs.vt||n.inWaitingStart>0||(e.intervalId&&(window.clearTimeout(e.intervalId),e.intervalId=null),n.inWaitingStart=nowTime(),e.intervalId=window.setTimeout((function(){var e=n.stall;log("stall.intervalId>>".concat(e.intervalId," cost: ").concat(nowTime()-n.inWaitingStart)),n._endType="wait",n.load_state=LOAD_STATES.STALLED,n.vtype.indexOf("MP4")>-1&&n.player.currentTime>10&&n.task&&(n.triggerTask("waiting",n.initial_url),n.requestCount++),e.stall_start=n.inWaitingStart,1===e.sc&&(e.first_buf_startt=n.inWaitingStart),window.clearTimeout(e.intervalId),e.intervalId=null,n.startWaitingStatus(n.inWaitingStart,nowTime()-n.inWaitingStart),e.intervalId=setTimeout((function(){n.inWaitingStart>0&&n.suspendWaitingStatus("waitTimeout")}),MAX_STALL_TIME)}),MIN_WAITIONG)))})),_defineProperty(this,"onEnded",(function(){if(n.initial_url){log("onEnded","watchDur:".concat(n.watchDur," vt:").concat(n.vt," pt:").concat(n.pt)),n.isEnded=!0;var e=n.resLogs.df;n.changeResolution({from:e,to:e,startTime:nowTime(),operaType:"leave_switch",endType:"ended"}),n.onOnePlay(ENDED_TYPE.ENDED),n.sendDegradeLog("playCatch_end",n.playlogs.degrade),n.onOneTemp(ENDED_TYPE.ENDED),n.sendEventsQueue(),n.playlogs.lc++}})),_defineProperty(this,"onUnload",(function(){0!==n.startStep&&n.initial_url&&(n.onOneTemp(ENDED_TYPE.UNLOAD),n.sendDegradeLog("playCatch_end",n.playlogs.degrade),n._reportInvalidVV(ENDED_TYPE.UNLOAD)||n.onOnePlay(ENDED_TYPE.UNLOAD,!0))})),_defineProperty(this,"onVisibilitychange",(function(){var e=n.playlogs.vt;"visible"===document.visibilityState&&(e||n.setPt())})),_defineProperty(this,"onDestroy",(function(){log("onDestroy:this.startStep:".concat(n.startStep," initial_url:").concat(n.initial_url," ").concat(!!n.initial_url)),n.onOnePlay(ENDED_TYPE.DESTROY),n.startStep>0&&n.initial_url&&(n.onOneTemp(ENDED_TYPE.DESTROY),n.sendDegradeLog("playCatch_end",n.playlogs.degrade));var e=n.resLogs.df;n.changeResolution({from:e,to:e,startTime:nowTime(),operaType:"leave_switch",endType:"destroy"}),n.sendEventsQueue(),Browser.isPC?window.removeEventListener("beforeunload",n.onUnload):(Browser.isMobile||Browser.isPad)&&window.removeEventListener("pagehide",n.onUnload),document.removeEventListener("visibilitychange",n.onVisibilitychange),n.listeners.forEach((function(e){n.player.off(e.evt,e.handler)})),n.clearTimers(),n.player.off("destroy",n.onDestroy),n.task&&n.task.clear()})),_defineProperty(this,"onOnePlay",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(log("onOnePlay _isOnePlayReport:".concat(n._isOnePlayReport," isLeave: ").concat(t," endState:").concat(e)),!n._isOnePlayReport){var r=n.errorLog,i=n.playlogs,o=n.abrInfo,a=n.resLogs,s=n.player,l=n.apiLog,c=n.pauseLog,u=n.stall,h=n.netLog,d=n.watchDur;n._isOnePlayReport=!0;var p=curTimestamp(),f=n.getBufferTime(s),g=n.getPerformance();n.setExt();var y=_objectSpread2(_objectSpread2(_objectSpread2({local_time:(new Date).getTime(),log_type:"video_playq",plugin_exception:0,player_create_exception:"",v:n.vid,initial_url:n.initial_url,initial_host:n.initial_host,initial_ip:n.curHeaders.x_response_sinfo||0,initial_type:n.initial_type},n.curHeaders),{},{initial_resolution:a.initial_resolution,final_resolution:a.final_resolution,pt:n.pt,prepare_start_time:i.nt,prepare_end_time:i.rt||curTimestamp(),vt:n.vt,lt:n.lt,lpt:n.lpt,fvt:n.fvt,nvt:n.nvt,bft:n.bft,sc:n.seekLog.sc,sat:n.seekLog.sat,bc:n.bc,dbc:i.dbc||0,nbc:i.nbc||0,video_net_s:n.videoNetworkState,status:n.curStatus,first_buf_startt:u.first_buf_startt,first_buf_endt:u.first_buf_endt,lc:i.lc,bu_acu_t:n.bu_acu_t>MAX_TIME?0:n.bu_acu_t,de_bu_acu_t:i.de_bu_acu_t||0,n_bu_acu_t:i.n_bu_acu_t||0,pause_acu_t:c.pause_acu_t,cur_play_pos:n.cur_play_pos,load_state:n.load_state,play_speed:n.playbackRate,playback_state:n.playback_state,end_state:e,watch_dur:d>MAX_TIME?0:d,switch_resolution_c:n.switchResolutionCount,is_start_play_automatically:n.isAutoplay,start_time:n.start_time,finish:n.finish,errt:r.errt,errc:r.errc,vsc:l.vsc,vsc_message:l.vsc_message,api_str:l.api_str,auth:l.auth||l.logid,width:n.videoWidth,height:n.videoHeight,vd:n.vd,video_length:parseInt(f.video,10),audio_length:parseInt(f.audio,10),df:n.resolution,lf:a.lf,play_c:0,player_created_t:n.player_created_t,fir_errt:r.fir_errt,fir_errc:r.fir_errc,lv_method:0,ldst:a.ldst,ldet:a.ldet,is_disable_short_seek:0,mute:n.mute,volume:n.volume,download_speed:n.realSpeed?n.realSpeed:n.task&&n.task.speed?n.task.speed:h.downloadSpeed,avg_speed:n.avgSpeed?n.avgSpeed:h.rqCount>0?parseInt(h.totalSpeed/h.rqCount,10):0,bitrate:n.curBitrate,preload_state:n.preloadState,preload_hit:n.preLoadData.hit||0,preload_cached:n.preLoadData.duration||n.preLoadData.byteLength||0,mdl_req_num:h.requestCount,watingcost:n.watingCost,br:i.br,fbrt:i.fbrt,try_err_c:r.try_err_c,accu_errc:r.accu_errc,dash_pst:n.dash_pst,dash_wst:n.dash_wst,dash_wrt:n.dash_wrt,dash_ift:n.dash_ift,dash_cst:n.dash_cst,dash_spt:n.dash_spt,dash_break:2===s.dashBufferBreak?1:0,merror:toJsonString(n.merror),ex:toJsonString(n.exInfo),perf:toJsonString(g),bufs:toJsonString(n.buffers.allBuffer),vs:a.vs,vds:a.vds,vps:a.vps},n.buffers.curBuffer),{},{degrade:i.degrade,cache_file:n._cacheFile});if(0!==n.vt&&(y.et=p),s&&s.dashState&&(y.dash_state=s.dashState),s.abrInstance){var v=s.abrInstance;if(n.updateAbrInfo(o,v,s.playbackRate),v.getAbrVVStats){var m=v.getAbrVVStats();Object.keys(m).forEach((function(e){y[e]=m[e]}))}}if(o.abr_init_opts=s.config.autoBitrateOpts||{},y.abr_info=toJsonString(n.abrInfo),t){var _=!n._options.disableLocalCache;n.reportLog(REPORT_EVENTS.ONE_PLAY,y,_?1:0)}else n.reportLog(REPORT_EVENTS.ONE_PLAY,y)}})),_defineProperty(this,"onOneEvent",(function(e){var t=e.costTime,r=e.vid,i=e.end_type,o=e.cur_play_pos,a=e.cdn_url,s=e.cdn_host,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=arguments.length>2?arguments[2]:void 0;log("onOneEvent",i);var u=n.buffers.curBuffer,h=_objectSpread2({local_time:(new Date).getTime(),v:r||n.vid,cost_time:t,end_type:i||n.end_type,cdn_url:a||n.url,cdn_host:s||"",initial_type:n.initial_type,resolution:n.resolution,play_speed:n.playbackRate,first_frame_interval:nowTime()-n.pt,last_switch_interval:n.getLastInterval("lastSwitchStartTime",n.resLogs,!1),last_seek_interval:n.updateSeekPt(!1),last_event_interval:n.getLastInterval("lastEventTime"),cur_play_pos:o||n.cur_play_pos,video_ready_s:n.videoReadyState,video_seeking:n.videoSeeking,video_paused:n.videoPaused,bufs:toJsonString(n.buffers.allBuffer),retry_count:n._retryCount,at:n.playlogs.at,stay_seconds:parseInt(((new Date).getTime()-n.playlogs.at)/1e3,10),preload_state:n.preloadState,preload_hit:n.preLoadData.hit,preload_cached:n.preLoadData.duration||n.preLoadData.byteLength},u);if("waitstart"===i&&"function"==typeof n._options.getPageFPS){var d=n._options.getPageFPS();h.cur_fps=d.curFPS||0,h.avg_fps=d.avgFPS||0}var p=n.player;p&&p.dashState&&(h.dash_state=n.player.dashState),Object.keys(l).forEach((function(e){h[e]=l[e]})),h.ex=toJsonString(n.getPlayerExt()),n.addIfExist("drm_type",n._options,h),n.reportLog(REPORT_EVENTS.ONE_EVENT,h,c)})),_defineProperty(this,"onOneTemp",(function(){if(log("onOneTemp>>",!n._templog),n._templog){var e=n.player,t=n.playlogs,r=n.pauseLog,i=n.errorLog,o=n.resLogs,a=n.watchDur,s=_objectSpread2(_objectSpread2(_objectSpread2({local_time:(new Date).getTime()},n._templog),{},{v:n.vid,initial_type:n.initial_type,pt:n.pt,vt:n.vt,lt:n.lt,fvt:n.fvt,bc:n.bc,bu_acu_t:n.bu_acu_t>MAX_TIME?0:n.bu_acu_t,pause_acu_t:r.pause_acu_t,cur_play_pos:n.cur_play_pos,watch_dur:a>MAX_TIME?0:a,finish:n.finish,errt:i.errt,errc:i.errc,vd:n.vd,df:n.resolution,lf:o.lf,br:t.br,fbrt:t.fbrt,try_err_c:i.try_err_c,accu_errc:i.accu_errc,dash_break:2===e.dashBufferBreak?1:0,bufs:toJsonString(n.buffers.allBuffer),vs:o.vs,vds:o.vds,vps:o.vps},n.buffers.curBuffer),{},{degrade:t.degrade});0!==n.vt&&(s.et=curTimestamp()),["drm_type","dynamic_type"].forEach((function(e){n.addIfExist(e,n._options,s)})),n.reportLog(REPORT_EVENTS.ONE_TEMP,s,0),n._templog=null}})),this.player=t,void 0===this.player||null===this.player)throw new Error("player is ".concat(this.player));if(r&&r.line_app_id){r.isTask&&(this.task=new SpeedCheckTask),this.eventQueue=[],this._instanceCreateTime=(new Date).getTime(),r.codec_type=r.codec_type||"h264",this._options=r,!this._options.maxQueueCount&&(this._options.maxQueueCount=5),this.line_app_id=parseInt(r.line_app_id,10)||0,this.line_user_id=(r.line_user_id||"").toString(),this.playerCoreVersion=t.version,this.playerVersion=r.playerVersion,this.closeSeekLog=r.closeSeekLog||!1,this.start_time=1e3*(r.start_time||0),this._initial_resolution="",this.__vtype=null,this.__dt="",this.resetLoggerParams();try{this.initializeTracker(),this.sendLocalLog(),this.bindEvt(),log("logger constructor:"+this.player.video)}catch(e2){console.error(e2)}}else console.warn("player.config.vodLogOpts.line_app_id is necessary for plugin xgVodLogger")}return _createClass(e,[{key:"resetLoggerParams",value:function(){log("resetLoggerParams");var e=this.playlogs?this.playlogs.lc:0;this.playlogs={nt:curTimestamp(),vt:0,rt:this.isEnded?curTimestamp():0,at:0,pt:0,bu_acu_t:0,bc:0,br:0,fbrt:"",dbc:0,de_bu_acu_t:0,nbc:0,n_bu_acu_t:0,played:[{begin:0,end:-1}],dash_pst:0,dash_wst:0,dash_wrt:0,dash_ift:0,dash_cst:0,dash_spt:0,interruptCount:0,degrade:"none",lc:e},this.degradeLog={bu_acu_t:0,bc:0,watch_dur:0,hasSendEnd:!1},this.buffers={allBuffer:[],curBuffer:{buf_diff:0,buf_s_pos:0,buf_e_pos:0,buf_include:0}},this.netLog={downloadSpeed:0,requestCount:0,connectCost:0,totalSpeed:0,rqCount:0,status:0},this.merror={cdn:[],player:[],playCatch:[],expied:[]},this.exInfo={stall:[]},this._templog=null,this._isOnePlayReport=!1,this.startStep=0,this.bft=0,this.initializeLogDatas(),this.initializeUrlLog()}},{key:"initializeLogDatas",value:function(){this.startStep=0,this.inWaitingStart=0,this.lastVideoTime=0,this._endType="",this._retryCount=0,this.lastOperaTime=DEFAULT_INTERVAL,this.lastEventTime=DEFAULT_INTERVAL,this.seekLog={intervalId:0,lastSeekStartTime:nowTime(),seekBefore:0,sat:0,sc:0},this.resLogs={lastSwitchStartTime:DEFAULT_INTERVAL,switch_count:0,abr_switch_count:0,initial_resolution:"",final_resolution:"",ldst:0,ldet:0,df:"",lf:"",played:[],bc:0,bu_acu_t:0,sc:0,sat:0,buf:0,lbuf:0,lplayed:0,vs:0,vds:0,vps:0,vis:0,bitrate:0},this.apiLog={code:0,message:"",logid:"",api:"",auth:"",error:{}},this.errorLog={accu_errc:0,try_err_c:0,errt:0,errc:0,fir_errt:0,fir_errc:Browser.isSupportMP4?0:1005,last_errors:[]},this.pauseLog={pause_acu_t:0,isPausing:!1,pause_start:0},this.stall={intervalId:0,stall_count:0,first_buf_startt:0,first_buf_endt:0,stall_start:0,stall_end:0,stall_last_interval:0,stall_acc_time:0},this._playerCreatedTime=0,this.load_state=LOAD_STATES.UNKNOWN,this.lv_method=6,this.isSeeking=!1,this.isEnded=!1,this.startStep=0,this.isAutoplay=this.player.config&&this.player.config.autoplay?1:0,this.abrInfo={abr_general_info:{},abr_event_info:{video_switch:[],video_stall:[],video_exit:{}},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:[]}},abr_user_info:{cancel_abr:0},abr_init_opts:this.player.config.autoBitrateOpts||{}},this._cacheFile=CACHE_FILE_TYPE.NO_CACHE}},{key:"initSessionId",value:function(){var e="0";try{e=window.localStorage.getItem(LS_KEY).web_id||"0"}catch(t){e="0"}this._sessionId=generateSessionId(e),log("sessionId ".concat(this._sessionId))}},{key:"initializeTracker",value:function(){var e=this,t=this._options;if(window.__xgplayer_vod_log__)this.tracker=window.__xgplayer_vod_log__;else{this.tracker=window.__xgplayer_vod_log__=new Collector("tracker");var r=t.channel||"cn",n={app_id:"cn"===(r="va"===r||"sg"===r?r:"cn")?TEA_ID:1300===TEA_ID?323254:TEA_ID,channel:r,log:!1,disable_sdk_monitor:!0};t.channelDomain&&(n.channel_domain=t.channelDomain),n.enable_ab_test=!!t.enableAbTest,this.tracker.init(n)}this.initSessionId();var i=navigator?navigator.hardwareConcurrency:0,o=navigator?navigator.deviceMemory:0;this.commonParams={play_type:0,source_type:"vid",sdk_version:VERSION,pc:this.playerCoreVersion,pv:this.playerVersion,line_app_id:this.line_app_id,line_user_id:this.line_user_id,app_version:t.appVersion||"",platform:Browser.isPad?"pad":Browser.isMobile?"mobile":"pc",cpu_core:Number(i)||0,memory_size:Number(o)||0,support:__support,webdriver:navigator&&navigator.webdriver?1:0},log("commonParams ",this.commonParams);var a={evtParams:this.commonParams,disable_auto_pv:!0};log("Browser.name ",Browser.name),!Browser.name||Browser.isChrome||Browser.isSafari||(a.browser=Browser.name,Browser.appVersion&&(a.browser_version=Browser.appVersion)),this.line_user_id&&(a.user_unique_id=this.line_user_id,a.web_id=this.line_user_id),t.referrer&&(a.referrer=t.referrer,a.referrer_host=getHostFromUrl(t.referrer)),t.ext&&Object.keys(t.ext).map((function(r){e.exInfo[r]=t.ext[r]})),this.tracker.config(a),this.tracker.start()}},{key:"resetDefiInfo",value:function(){var e=this.resLogs;e.played=[],e.bc=0,e.bu_acu_t=0,e.sc=0,e.sat=0}},{key:"sendLocalLog",value:function(){var e=this,t=LOCAL_LOG.get();LOCAL_LOG.remove(),t.map((function(t){Object.keys(t).map((function(r){if(log("sendLocalLog",r,t[r]),e.player){e.player.emit("abLog",r,t[r]);var n=e._options.sendLocalCallback;n&&"function"==typeof n&&n(r,t[r])}e._track(r,t[r])}))}))}},{key:"_track",value:function(e,t){"function"==typeof this.tracker?this.tracker(e,t):this.tracker.event(e,t)}},{key:"bindEvt",value:function(){var e=this;this.listeners=[{evt:"play",handler:this.onPlay},{evt:"playing",handler:this.onPlaying},{evt:"pause",handler:this.onPause},{evt:"waiting",handler:this.onWaiting},{evt:"playInterfaceInfo",handler:this.onPlayInterfaceInfo},{evt:"DRM_ERROR",handler:this.onDashError},{evt:"ended",handler:this.onEnded},{evt:"loadeddata",handler:this.onLoadeddata},{evt:"loadstart",handler:this.onLoadStart},{evt:"canplay",handler:this.onCanplay},{evt:"dashStateChange",handler:this.onDashStateChange},{evt:"autoplay was prevented",handler:this.onNotAutoPlay},{evt:"autoplay_was_prevented",handler:this.onNotAutoPlay},{evt:"seeking",handler:this.onSeeking},{evt:"seeked",handler:this.onSeeked},{evt:"complete",handler:this.onPlayerInited},{evt:"timeupdate",handler:this.onTimeUpdate},{evt:"bufferedChange",handler:this.onBufferedChange},{evt:"beforeDefinitionChange",handler:this.onBeforeDefinitionChange},{evt:"definitionChange",handler:this.onDefinitionChange},{evt:"definitionChangeSuccess",handler:this.onDefiChangeSuccess},{evt:"drmTypeChange",handler:this.onDrmTypeChange},{evt:"replayBtnClick",handler:this.onReplayBtnClick},{evt:"initialUrl",handler:this.initializeUrlLog},{evt:"ABR_CHANGE",handler:this.onAbrChange},{evt:"playCatch",handler:this.onPlayCatch},{evt:"log",handler:this.onLog},{evt:"ABR_PRESTALL_END",handler:this.onAbrPrestallEnd},{evt:"progress_event",handler:this.onProgressEvent},{evt:"logger_next",handler:this.onNext},{evt:"playnext",handler:this.onNext},{evt:"nextEnded",handler:this.onNextEnded},{evt:"media_format_error",handler:this.onMediaFormatError},{evt:"xglog",handler:this.onXgLogWaiting},{evt:"xglog_cache",handler:this.onXgLogCache}];var t=this.player.config.errorKey;log(">>>errorKey",t);var r={evt:"error",handler:this.onPlayerError};t&&(r.evt=t),this.listeners.push(r),this.listeners.forEach((function(t){e.player.on(t.evt,t.handler)})),this.bindUnload()}},{key:"addIfExist",value:function(e,t,r){if(isObject(t)){var n=t[e];null!=n&&(r[e]=n)}}},{key:"changeResolution",value:function(e){var t=e.from,r=e.to,n=e.startTime,i=e.operaType,o=e.abrInfo,a=e.endType,s=void 0===a?"":a,l=this.resLogs;t=formatDefinition(t),r=formatDefinition(r),l.ldet=nowTime(),l.df=r,l.lf=t,l.final_resolution=r,l.switch_count++;var c=l.ldet-n,u={bc:l.bc,bu_acu_t:l.bu_acu_t,sc:l.sc,sat:l.sat,watch_dur:computeWatchDur(l.played)};o&&(u.abrInfo=o),this.updateVds(),this.resetDefiInfo(),this._options.closeResolutionLog||this.onOneOperator({costTime:c,operaType:i,endType:s,stateBefore:t,stateAfter:r},u,0)}},{key:"getLastInterval",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=t[e],i=nowTime(),o=n===DEFAULT_INTERVAL?DEFAULT_INTERVAL:i-n;return r&&(t[e]=i),o}},{key:"updateSeekPt",value:function(e){return this.getLastInterval("lastSeekStartTime",this.seekLog,e)}},{key:"_reportInvalidVV",value:function(e){return!!this._isInvaidVV()&&(this.onOneError({endState:e,errorType:9998,code:-1,url:this.player.currentSrc,headers:{}},0),this._isOnePlayReport=!0,!0)}},{key:"_isInvaidVV",value:function(){return 0===this.vt&&-1===this.curStatus}},{key:"bindUnload",value:function(){Browser.isPC?window.addEventListener("beforeunload",this.onUnload):(Browser.isMobile||Browser.isPad)&&window.addEventListener("pagehide",this.onUnload),document.addEventListener("visibilitychange",this.onVisibilitychange),this.player.once("destroy",this.onDestroy)}},{key:"clearTimers",value:function(){var e=this.seekLog,t=this.stall;e.intervalId&&window.clearTimeout(e.intervalId),t.intervalId&&window.clearTimeout(t.intervalId)}},{key:"sendDegradeLog",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"playCatch",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};log("sendDegradeLog",e,t,r);var n=this.degradeLog;if(!(n.hasSendEnd||"playCatch_end"===e&&"none"===t)){"playCatch_end"===e&&(n.hasSendEnd=!0);var i=this.bu_acu_t-n.bu_acu_t;this.onOneEvent({costTime:this.vd,vid:this.vid,end_type:e,cur_play_pos:this.player.currentTime,cdn_url:r.url},_objectSpread2({degrade:t,vt:this.vt,pt:this.pt,fvt:this.fvt,bc:this.bc-n.bc,bu_acu_t:i>MAX_TIME?0:i,watch_dur:this.watchDur-n.watch_dur},r),0)}}},{key:"getBufferTime",value:function(e){var t=0,r=0,n=e.video&&e.video.buffered;if(n){for(var i=n.length,o=0,a=0;a<i;a++)o+=n.end(a)-n.start(a);t=r=1e3*o}return{video:t,audio:r}}},{key:"updateAbrInfo",value:function(e,t,r){e.abr_general_info=t.generalInfo,e.abr_event_info.video_exit={local_time_ms:(new Date).getTime(),buffer_length:t.bufferLength,internet_speed:t.downloadSpeed,now_bitrate:t.nowBitrate,play_speed:r},t.getAbrPlayInfo&&(e.abr_play_info=t.getAbrPlayInfo())}},{key:"getPerformance",value:function(){return this.player.performance||{}}},{key:"setExt",value:function(){var e=this,t=this.player.ext||{};t.performance&&delete t.performance,Object.keys(t).map((function(r){"performance"!==r&&(e.exInfo[r]=t[r])}))}},{key:"onOneOperator",value:function(e){var t=e.costTime,r=e.operaType,n=e.stateBefore,i=e.stateAfter,o=e.endType,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,l=this.getLastInterval("lastOperaTime"),c={local_time:(new Date).getTime(),v:this.vid,opera_type:r,state_before:n,state_after:i,cost_time:t,end_type:o||this.end_type,cdn_url:this.url,resolution:this.resolution,last_interval:l,bufs:toJsonString(this.buffers.allBuffer),cur_play_pos:this.cur_play_pos,retry_count:this._retryCount},u=this.player;u&&u.dashState&&(c.dash_state=this.player.dashState),Object.keys(a).forEach((function(e){c[e]=a[e]})),this.addIfExist("drm_type",this._options,c),this.reportLog(REPORT_EVENTS.ONE_OPERA,c,s)}},{key:"onOneError",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{errorType:0,code:0,url:"",headers:{},costTime:0,vid:"",message:"",preload_hit:0,preload_cached:0},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];log("onOneError",t);var i=this.errorLog,o=this.apiLog,a=this.resLogs,s=this.player,l=this.playlogs,c=transformHeader(t.headers||{}),u=this.getPerformance();this.setExt();var h=_objectSpread2(_objectSpread2(_objectSpread2({v:t.vid||this.vid,video_pos:this.cur_play_pos,local_time:(new Date).getTime(),cost_time:t&&t.costTime?t.costTime:0,errt:t.errorType,errc:t.code,es:this.es,cdn_url:t.url||this.url,bufs:toJsonString(this.buffers.allBuffer),resolution:a.final_resolution,last_errors:i.last_errors.join(";"),vsc:o.vsc,vsc_message:t.message||o.vsc_message,server_ip:c.x_response_sinfo||0,initial_url:this.initial_url,initial_host:this.initial_host},c),{},{cur_play_pos:this.cur_play_pos},this.buffers.curBuffer),{},{degrade:l.degrade,end_state:t.endState||ENDED_TYPE.ERROR,preload_hit:t.preload_hit||0,preload_cached:t.preload_cached||0,ex:toJsonString(this.exInfo),pref:toJsonString(u),video_ready_s:this.videoReadyState});s&&s.dashState&&(h.dash_state=s.dashState);var d=this.player.currentSrc,p=checkIsBlob(d)?checkIsBlob(t.url)?this.initial_url:t.url:d,f={connectTime:0,status:0,statusText:"",isexpired:0,isBlob:checkIsBlob(d)?1:0};if(n&&"String"===typeOf(p)){var g={};getXhr(p,{range:"0-8",timeout:2e3}).then((function(e){log("getXhr>>check result ",e);var t=transformHeader(e.headers||{});h.server_ip=t.x_response_sinfo,g=_objectSpread2(_objectSpread2({},f),{},{statusText:e.statusText||"",status:e.status||0,connectTime:0|e.connectTime,sinfo:t.x_response_sinfo||"",cinfo:t.x_response_cinfo||""})})).catch((function(e){g=_objectSpread2(_objectSpread2({},f),{},{statusText:-2===e.status?"timeout":"error",status:e.status})})).finally((function(){var t=checkUrlIsExpired(p);g.isexpired=t,h.net=toJsonString(g),e.reportLog(REPORT_EVENTS.ONE_ERROR,h,r)}))}else h.net=toJsonString(f),this.reportLog(REPORT_EVENTS.ONE_ERROR,h,r)}},{key:"reportLog",value:function(t,r,n){var i=this,o=this._options,a=this.player.ABTestTag,s=this.commonParams;!r.player_sessionid&&(r.player_sessionid=this.sessionId),!r.web_url&&(r.web_url=window.location.href),r.user_agent=navigator.userAgent,r.dynamic_type=this.dynamicType;var l="Array"===typeOf(o.absdkVersion)?o.absdkVersion.join(","):o.absdkVersion;r.absdkVersion=l||e.AB_SDK_VERSION,null!=a&&(r.abtest_tag=a);var c=this._options;if(r.codec_type=this.codecType,isObject(c)&&(COMMON_KEYS.forEach((function(e){i.addIfExist(e,c,r)})),Object.keys(s).forEach((function(e){i.addIfExist(e,s,r)})),r.vtype=this.vtype),1===n){var u={};return u[t]=r,void LOCAL_LOG.set(u)}2!==n?(this.player&&this.player.emit("abLog",t,r),this._track(t,r)):this.addEventsQueue(t,r)}},{key:"addEventsQueue",value:function(e,t){this.eventQueue.push({event:e,params:t}),this.eventQueue.length>=this._options.maxQueueCount&&this.sendEventsQueue()}},{key:"sendEventsQueue",value:function(){for(;this.eventQueue.length>0;){var e=this.eventQueue.pop();this._track(e.event,e.params)}}},{key:"startWaitingStatus",value:function(e,t){this.onOneEvent({costTime:t,end_type:"waitstart"},{},2),this.appendStallInfo("start",e),this.updateCurBuffer("startWaitingStatus")}},{key:"triggerTask",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"start",t=arguments.length>1?arguments[1]:void 0;log("triggerTask>>",e);var r=checkVideoSrcIsEmpty(t=t||this.player.src);!r&&this.vtype.indexOf("MP4")>-1&&this.task&&this.task.trigger(t,e)}},{key:"appendStallInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"start",t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;if(!this.player.ext){this.exInfo.stall||(this.exInfo.stall=[]);var n=this.exInfo.stall;if("start"===e){n.length>6&&n.splice(0,n.length-6);var i=this.buffers.curBuffer;n.push({start:t,end:-1,endType:"waitstart",cost:0,cur:this.cur_play_pos,buf_s:i.buf_s_pos,buf_e:i.buf_e_pos,buf_i:i.buf_include})}else if("end"===e){var o=n.length-1;if(o<0)return;n[o].end<0&&(n[o].end=t,n[o].endType=r,n[o].cost=t-n[o].start)}log("appendStallInfo",n)}}},{key:"suspendWaitingStatus",value:function(e){var t=nowTime(),r=this.playlogs,n=this.resLogs,i=this.stall,o=this.inWaitingStart;if(!(o<=0||this.isSeeking||r.vt<=0)){if(log("suspendWaitingStatus>>".concat(e,"|costTime:").concat(t-o," isSeeking:").concat(this.isSeeking," vt:").concat(r.vt)),this.appendStallInfo("end",t,e),t-o>MIN_WAITIONG){var a=t-this.inWaitingStart;if(r.bc++,this.checkInBuffer(this.player.currentTime)?(r.de_bu_acu_t+=a,r.dbc++):(r.nbc++,r.n_bu_acu_t+=a),n.bc++,r.bu_acu_t+=a,n.bu_acu_t+=a,i.stall_end=t,i.stall_last_interval=i.stall_end-i.stall_start,i.stall_acc_time+=i.stall_last_interval,1===i.sc&&(i.first_buf_endt=t),this.player.abrInstance&&!this.isSeeking&&this.playlogs.vt){var s=this.player.abrInstance;this.abrInfo.abr_event_info.video_stall.push({local_time_ms:(new Date).getTime(),stall_duration:parseFloat((a/1e3).toFixed(2)),buffer_length:s.bufferLength,internet_speed:s.downloadSpeed,now_bitrate:s.nowBitrate,play_speed:this.player.playbackRate,is_abr:s.isCurrentInAbr?1:0})}this.onOneEvent({costTime:a,end_type:e||"wait"},{},2)}this._endType="",this.load_state=LOAD_STATES.PLAYABLE,this.inWaitingStart=0,window.clearTimeout(i.intervalId),i.intervalId=null}}},{key:"suspendSeekStatus",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isSeeking){var r=this.seekLog,n=this.resLogs,i=this.player,o=nowTime()-r.lastSeekStartTime;log("suspendSeekStatus>>","".concat(e," currentTime:").concat(i.currentTime," costTime:").concat(o," sat:").concat(r.sat," resLogs.sat:").concat(n.sat)),r.intervalId&&window.clearTimeout(r.intervalId),r.intervalId=null,this.isSeeking=!1;var a=this._endType="seek",s=r.seekBefore,l=(i.currentTime||0).toString();r.sc++,r.sat+=o>MAX_COST?0:o,n.sc++,n.sat+=o>MAX_COST?0:o,this.updateSeekPt(!0),!this.closeSeekLog&&t&&this.onOneOperator({costTime:o,operaType:a,stateBefore:s,stateAfter:l,endType:e})}}},{key:"setPt",value:function(){var e=this.playlogs;this.startStep=1,!e.pt&&this.player.currentTime&&(this.isSeeking=!0),e.pt||(e.pt=curTimestamp(),log("setPt","init pt :".concat(e.pt,", document.visibilityState:").concat(document.visibilityState)))}},{key:"setVt",value:function(){var e=this.playlogs;1===this.startStep&&(e.vt||(e.vt=curTimestamp(),log("setVt: first frame inited","vt-pt:".concat(e.vt-e.pt," vt-nt:").concat(e.vt-e.nt))),this.startStep=2)}},{key:"setBr",value:function(e){var t=this.playlogs;t.vt>0&&(0===t.br&&(t.fbrt=e||""),t.br++)}},{key:"codecType",get:function(){var e=this.player;return e&&e.config&&e.config.codecType?e.config.codecType:this._options.codec_type||"h264"}},{key:"url",get:function(){var e=this.player;return e&&e.config?e.config.url:""}},{key:"vid",get:function(){var e=this.player;return e&&e.config?e.config.vid:""}},{key:"bc",get:function(){return this.playlogs.bc}},{key:"bu_acu_t",get:function(){return this.playlogs.bu_acu_t}},{key:"pt",get:function(){return this.playlogs.pt||curTimestamp()}},{key:"vt",get:function(){var e=this.playlogs,t=e.vt;return e.pt>0?t:0}},{key:"fvt",get:function(){var e=this.playlogs,t=e.vt,r=e.pt;return t>0&&r>0?parseInt(t-r,10):0}},{key:"nvt",get:function(){var e=this.playlogs,t=e.vt,r=e.nt;return t>0&&r>0?parseInt(t-r,10):0}},{key:"dash_pst",get:function(){return this.playlogs.dash_pst}},{key:"dash_wst",get:function(){return this.playlogs.dash_wst}},{key:"dash_wrt",get:function(){return this.playlogs.dash_wrt}},{key:"dash_ift",get:function(){return this.playlogs.dash_ift}},{key:"dash_cst",get:function(){return this.playlogs.dash_cst}},{key:"dash_spt",get:function(){return this.playlogs.dash_spt}},{key:"vd",get:function(){var e=this.player;return e.duration&&"number"==typeof e.duration&&e.duration>0?parseInt(1e3*e.duration,10):e.config.duration&&"number"==typeof e.config.duration?parseInt(1e3*e.config.duration,10):0}},{key:"cur_play_pos",get:function(){return parseInt(1e3*this.player.currentTime,10)}},{key:"volume",get:function(){return this.player.volume}},{key:"buffer_time",get:function(){var e=0;try{var t=this.player.getBufferedRange();e=t[1]-t[0]}catch(e2){e=0}return e}},{key:"player_created_t",get:function(){return this._playerCreatedTime}},{key:"playbackRate",get:function(){return this.player.playbackRate}},{key:"mute",get:function(){return this.player.muted?0:1}},{key:"videoWidth",get:function(){var e=this.player;return e&&e.video?e.video.videoWidth:0}},{key:"videoHeight",get:function(){var e=this.player;return e&&e.video?e.video.videoHeight:0}},{key:"preload",get:function(){var e=this.player;return!(!e||!e.video)&&e.video.preload}},{key:"initial_url",get:function(){var e=this.player.currentSrc;return e.indexOf("blob:")>-1&&this.urlLog.initial_url?this.urlLog.initial_url:checkVideoSrcIsEmpty(e)?"":e}},{key:"initial_host",get:function(){var e=this.player.currentSrc;return e.indexOf("blob:")>-1&&this.urlLog.initial_host?this.urlLog.initial_host:getHostFromUrl(checkVideoSrcIsEmpty(e)?"":e)}},{key:"curHeaders",get:function(){var e=this.player,t=this.task;return e&&e.__dash__&&e.__dash__.curReqVideoSegInfo?transformHeader(e.__dash__.curReqVideoSegInfo.headers||{}):t?t.headers:{}}},{key:"curStatus",get:function(){var e=this.task,t=this.vtype,r=this.netLog;return t.indexOf("MP4")>-1?e?e.status:0:r.status}},{key:"play_type",get:function(){return 0}},{key:"resolution",get:function(){var e=this.player.curDefinition;return e?e.definition+"":this.resLogs.df}},{key:"sessionId",get:function(){return this._sessionId}},{key:"finish",get:function(){return this.isEnded?1:0}},{key:"end_type",get:function(){return this._endType}},{key:"avgSpeed",get:function(){return this.player&&this.player.avgSpeed?this.player.avgSpeed:0}},{key:"realSpeed",get:function(){return this.player&&this.player.realTimeSpeed?this.player.realTimeSpeed:0}},{key:"mp4MseOpLength",get:function(){if(!this.player||!this.player.plugins)return-1;var e=this.player.plugins.mp4encryptplayer;return e?e.opQueueLen||0:-1}},{key:"mp4LoadSegmentTimeRange",get:function(){if(!this.player||!this.player.plugins)return"";var e=this.player.plugins.mp4encryptplayer;return e?e.loadSegmentTimeRange.join(","):""}},{key:"preLoadData",get:function(){if(!this.player||!this.player.plugins)return[];var e=this.player.plugins.mp4encryptplayer;if(e&&e.preLoadData)return{hit:1,duration:e.preLoadData.duration,length:e.preLoadData.byteLength};var t=this.player.stat||{};if(t.preLoadData){var r=t.preLoadData.length;return{hit:r>0,length:r}}return{hit:0,duration:0,length:0}}},{key:"preloadState",get:function(){if(!this.player||!this.player.plugins)return 0;if(void 0!==this.player.preloadState)return this.player.preloadState||0;var e=this.player.plugins.mp4encryptplayer;return e&&e.preloadState?e.preloadState:0}},{key:"curBitrate",get:function(){var e=this.player,t=e.config,r=e.curDefinition;return r&&r.bitrate?r.bitrate:t.defaultBitrate?t.defaultBitrate:0}},{key:"videoReadyState",get:function(){var e=this.player;return e&&e.video?e.video.readyState:-1}},{key:"videoSeeking",get:function(){var e=this.player;return e&&e.video&&e.video.seeking?1:0}},{key:"videoPaused",get:function(){var e=this.player;return e&&e.video&&e.video.paused?1:0}},{key:"switchResolutionCount",get:function(){return this.resLogs.switch_count}},{key:"isError",get:function(){return this.player._isError||this.player.video.error}},{key:"isPlaying",get:function(){return hasClass(this.player.root,"xgplayer-playing")}},{key:"isStop",get:function(){return hasClass(this.player.root,"xgplayer-ended")||hasClass(this.player.root,"xgplayer-nostart")}},{key:"isPause",get:function(){return hasClass(this.player.root,"xgplayer-pause")}},{key:"isLoading",get:function(){return hasClass(this.player.root,"xgplayer-isloading")}},{key:"es",get:function(){return this.isPlaying?"playing":"beforePlay"}},{key:"lt",get:function(){var e=0;return 0===this.vt&&(log("lt init",this.playlogs.lt),e=curTimestamp()),e}},{key:"lpt",get:function(){return this.lt?this.lt-this.pt:0}},{key:"playback_state",get:function(){return this.isError?PLAYBACK_STATE.ERROR:this.isStop?PLAYBACK_STATE.STOP:this.isPause?PLAYBACK_STATE.PAUSE:this.isLoading?PLAYBACK_STATE.LOADING:PLAYBACK_STATE.PLAYING}},{key:"is_start_play_automatically",get:function(){return this.isAutoplay+""}},{key:"watchDur",get:function(){var e=this.player,t=this.playlogs,r=e.cumulateTime?e.cumulateTime:computeWatchDur(t.played);return r>=0?r:0}},{key:"vtype",get:function(){return this.__vtype?this.__vtype:(this.player?this.player.vtype||this.player.config.vtype:"")||(this.player.dash?"DASH":this._options.vtype||"MP4")},set:function(e){this.__vtype=e}},{key:"getPlayerExt",value:function(){var e=this.player.ext;if(e)return e}},{key:"watingCost",get:function(){if(this.inWaitingStart>0){var e=nowTime()-this.inWaitingStart;return e>MAX_COST?0:e}return 0}},{key:"videoNetworkState",get:function(){var e=this.player;return e&&e.video?e.video.networkState:-1}},{key:"eagleid",get:function(){var e=this.player;return e&&e.__dash__&&e.__dash__.curReqVideoSegInfo?(e.__dash__.curReqVideoSegInfo.headers||{}).eagleid:""}},{key:"initial_type",get:function(){var e=this.player.config||{};return e&&e.vodLogOpts&&void 0!==e.vodLogOpts.currentDashType?parseInt(e.vodLogOpts.currentDashType,10):-1}},{key:"dynamicType",get:function(){var e=this.player;return this.__dt?this.__dt:e&&e.__dash__&&e.__dash__.dash&&e.__dash__.dash.mpd?(this.__dt=e.__dash__.dash.mpd.dashType,this.__dt):""}},{key:"updateCurBuffer",value:function(e){var t=this.player,r=t.buffered,n=t.currentTime,i={buf_s_pos:0,buf_e_pos:0,buf_include:0,buf_diff:0},o=[];if(!r||r.length<1)return i;for(var a=-1,s=-1,l=parseInt(1e3*n,10),c=r.length-1;c>-1;c--){var u=parseInt(1e3*r.start(c),10),h=parseInt(1e3*r.end(c),10);o.push({start:u,end:h}),l>u&&l<h?(i.buf_include=1,i.buf_s_pos=u,i.buf_e_pos=h,i.buf_diff=h-l):l<u&&(a<0||u-l<a)?(a=u-l,s=c):l>h&&(a<0||l-h<a)&&(a=l-h,s=c)}1!==i.buf_include&&(s<0&&(s=r.length-1),i.buf_s_pos=parseInt(1e3*r.start(s),10),i.buf_e_pos=parseInt(1e3*r.end(s),10)),this.buffers.allBuffer=o,this.buffers.curBuffer=i}},{key:"checkInBuffer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.player.buffered;if(!r)return!1;e=parseInt(1e3*e,10);for(var n=0;n<r.length;n++){var i=parseInt(1e3*r.start(n),10)+t,o=parseInt(1e3*r.end(n),10)+t;if(e>i&&e<o)return!0}return!1}},{key:"updateVideoSize",value:function(){var e=this._options,t=this.player,r=this.resLogs,n=0,i=0;if(t.__dash__&&t.__dash__.dash&&t.__dash__.dash.mpd.mediaList){var o=t.__dash__.dash.mpd.mediaList.video,a=o[o.selectedIdx];log("updateVideoSize》》videoItem",a),i=a?a.bitrate||a.bandwidth:0,n=a?a.size:0}else{var s=this.player.curDefinition;s?(i=s.bitrate||t.config.bitrate||0,n=parseInt(s.bitrate*t.duration/8,10)):(n=e.videoSize||t.config.videoSize||0,i=e.bitrate||t.config.bitrate||0)}log("updateVideoSize","bitrate:".concat(i,", vs:").concat(n)),n&&(r.vs=n,r.vis=parseInt(n/t.duration,10),r.bitrate=i||r.vis)}},{key:"updateVds",value:function(){var e=this.resLogs,t=this.playlogs,r=this.player;if(0!==e.vis){for(var n=parseInt(computeWatchDur(t.played)/1e3,10),i=r.buffered,o=0,a=0;a<i.length;a++)o+=parseInt(i.end(a)-i.start(a),10);log("updateVds","pdur:".concat(n," bdur:").concat(o," \n lbuf:").concat(e.lbuf," lplayed:").concat(e.lplayed," bitrate: ").concat(e.bitrate," vis:").concat(e.vis," vs:").concat(e.vs)),e.vps+=parseInt((n-e.lplayed)*e.vis,10),e.vds+=parseInt((o-e.lbuf)*e.vis,10),e.lplayed=n,e.lbuf=o}else log("updateVds","vis:".concat(e.vis))}}],[{key:"TEA_ID",get:function(){return TEA_ID},set:function(e){LS_KEY="__tea_cache_tokens_".concat(TEA_ID=e)}},{key:"AB_SDK_VERSION",get:function(){return AB_SDK_VERSION},set:function(e){AB_SDK_VERSION="Array"===typeOf(e)?e.join(","):e}},{key:"Collector",set:function(e){Collector=e}},{key:"defaultConfig",value:function(){return{line_app_id:"",line_user_id:"",isTask:!1,codec_type:"",playerCoreVersion:"",playerVersion:"",start_time:0,maxQueueCount:5,channel:"cn",channelDomain:"",absdkVersion:"",checkByInnerLog:!0,drm_type:0,vtype:"MP4",tag:"普通视频",subtag:"",dynamic_type:"",sendLocalCallback:function(e,t){},disableLocalCache:!1,closeResolutionLog:!1,closeSeekLog:!1,needXhrCheck:!1}}}]),e}();XGPlayerAppLogger.TEA_ID=323254,XGPlayerAppLogger.Collector=Collector$1$1;var xgVodLogger=function(e){if(e&&e.player){var t=e.player.config.vodLogOpts||{};e.player.vodLogger=new XGPlayerAppLogger(e.player,t),e.player.plugins.xgVodLogger=e.player.vodLogger}else this.vodLogger=new XGPlayerAppLogger(this,this.config.vodLogOpts||{})};return xgVodLogger.pluginName="__xgVodLogger",xgVodLogger.playerConfig={},xgVodLogger.Collector=Collector$1$1,xgVodLogger.setABSdkVersion=function(e){XGPlayerAppLogger.AB_SDK_VERSION=e},xgVodLogger},module.exports=t(es_array_concat,es_array_map,es_object_keys,esnext_string_at,es_object_toString,es_regexp_toString,web_domCollections_forEach,es_number_constructor,es_function_name,es_array_join,es_promise,es_promise_finally,es_array_splice,es_number_toFixed,es_regexp_exec,es_string_replace,es_string_split,es_string_trim,es_array_filter,es_string_match,es_regexp_constructor,es_symbol,es_symbol_description)})(index_tcpy);var xgVodLogger=index_tcpy.exports,_ERR_CODE;function ownKeys$2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2$2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$2(Object(r),!0).forEach((function(t){_defineProperty$3(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$2(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime$1(){_regeneratorRuntime$1=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(k){l=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var o=t&&t.prototype instanceof d?t:d,a=Object.create(o.prototype),s=new C(i||[]);return n(a,"_invoke",{value:T(e,r,s)}),a}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(k){return{type:"throw",arg:k}}}e.wrap=c;var h={};function d(){}function p(){}function f(){}var g={};l(g,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(w([])));v&&v!==t&&r.call(v,o)&&(g=v);var m=f.prototype=d.prototype=Object.create(g);function _(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function i(n,o,a,s){var l=u(e[n],e,o);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==_typeof$4(h)&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(h).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(l.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function T(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=E(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=u(e,t,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}function E(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,E(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=u(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,h;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function 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 $(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function w(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 n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:P}}function P(){return{value:void 0,done:!0}}return p.prototype=f,n(m,"constructor",{value:f,configurable:!0}),n(f,"constructor",{value:p,configurable:!0}),p.displayName=l(f,s,"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,f):(e.__proto__=f,l(e,s,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},_(b.prototype),l(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new b(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},_(m),l(m,s,"Generator"),l(m,o,(function(){return this})),l(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=w,C.prototype={constructor:C,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($),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),$(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;$(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function asyncGeneratorStep$2(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(error){return void r(error)}s.done?t(l):Promise.resolve(l).then(n,i)}function _asyncToGenerator$2(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){asyncGeneratorStep$2(o,n,i,a,s,"next",e)}function s(e){asyncGeneratorStep$2(o,n,i,a,s,"throw",e)}a(void 0)}))}}function _classCallCheck$2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey$1(n.key),n)}}function _createClass$3(e,t,r){return t&&_defineProperties$3(e.prototype,t),r&&_defineProperties$3(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$3(e,t,r){return(t=_toPropertyKey$1(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$2(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&&_setPrototypeOf$2(e,t)}function _getPrototypeOf$2(e){return(_getPrototypeOf$2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$2(e,t){return(_setPrototypeOf$2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$2(){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 _assertThisInitialized$2(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$2(e,t){if(t&&("object"===_typeof$4(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$2(e)}function _createSuper$2(e){var t=_isNativeReflectConstruct$2();return function(){var r,n=_getPrototypeOf$2(e);if(t){var i=_getPrototypeOf$2(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$2(this,r)}}function _toPrimitive$1(e,t){if("object"!==_typeof$4(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==_typeof$4(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey$1(e){var t=_toPrimitive$1(e,"string");return"symbol"===_typeof$4(t)?t:String(t)}function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2$1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$1(Object(r),!0).forEach((function(t){_defineProperty$2(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(k){l=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var o=t&&t.prototype instanceof d?t:d,a=Object.create(o.prototype),s=new C(i||[]);return n(a,"_invoke",{value:T(e,r,s)}),a}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(k){return{type:"throw",arg:k}}}e.wrap=c;var h={};function d(){}function p(){}function f(){}var g={};l(g,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(w([])));v&&v!==t&&r.call(v,o)&&(g=v);var m=f.prototype=d.prototype=Object.create(g);function _(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function i(n,o,a,s){var l=u(e[n],e,o);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==_typeof$4(h)&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(h).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(l.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function T(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=E(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=u(e,t,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}function E(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,E(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=u(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,h;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function 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 $(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function w(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 n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:P}}function P(){return{value:void 0,done:!0}}return p.prototype=f,n(m,"constructor",{value:f,configurable:!0}),n(f,"constructor",{value:p,configurable:!0}),p.displayName=l(f,s,"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,f):(e.__proto__=f,l(e,s,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},_(b.prototype),l(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new b(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},_(m),l(m,s,"Generator"),l(m,o,(function(){return this})),l(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=w,C.prototype={constructor:C,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($),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),$(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;$(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function _typeof$1(e){return(_typeof$1="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 asyncGeneratorStep$1(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(error){return void r(error)}s.done?t(l):Promise.resolve(l).then(n,i)}function _asyncToGenerator$1(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){asyncGeneratorStep$1(o,n,i,a,s,"next",e)}function s(e){asyncGeneratorStep$1(o,n,i,a,s,"throw",e)}a(void 0)}))}}function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$2(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass$2(e,t,r){return t&&_defineProperties$2(e.prototype,t),r&&_defineProperties$2(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$2(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$1(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&&_setPrototypeOf$1(e,t)}function _getPrototypeOf$1(e){return(_getPrototypeOf$1=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$1(e,t){return(_setPrototypeOf$1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$1(){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 _construct(e,t,r){return(_construct=_isNativeReflectConstruct$1()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&_setPrototypeOf$1(i,r.prototype),i}).apply(null,arguments)}function _isNativeFunction(e){return-1!==Function.toString.call(e).indexOf("[native code]")}function _wrapNativeSuper(e){var t="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function(e){if(null===e||!_isNativeFunction(e))return e;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 _construct(e,arguments,_getPrototypeOf$1(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf$1(r,e)},_wrapNativeSuper(e)}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}function _objectWithoutProperties(e,t){if(null==e)return{};var r,n,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function _assertThisInitialized$1(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$1(e,t){if(t&&("object"===_typeof$4(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$1(e)}function _createSuper$1(e){var t=_isNativeReflectConstruct$1();return function(){var r,n=_getPrototypeOf$1(e);if(t){var i=_getPrototypeOf$1(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$1(this,r)}}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf$1(e)););return e}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=_superPropBase(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},_get.apply(this,arguments)}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function _toPrimitive(e,t){if("object"!==_typeof$4(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==_typeof$4(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof$4(t)?t:String(t)}function createPublicPromise(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.used=!1,r.resolve=function(){return r.used=!0,e.apply(void 0,arguments)},r.reject=function(){return r.used=!0,t.apply(void 0,arguments)},r}var ERR={MANIFEST:"manifest",NETWORK:"network",NETWORK_TIMEOUT:"network_timeout",DEMUX:"demux",REMUX:"remux",MEDIA:"media",DRM:"drm",OTHER:"other",SUB_TYPES:{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"}},ERR_CODE=(_ERR_CODE={},_defineProperty$2(_ERR_CODE,ERR.MANIFEST,{HLS:1100}),_defineProperty$2(_ERR_CODE,ERR.NETWORK,2100),_defineProperty$2(_ERR_CODE,ERR.NETWORK_TIMEOUT,2101),_defineProperty$2(_ERR_CODE,ERR.DEMUX,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400}),_defineProperty$2(_ERR_CODE,ERR.REMUX,{FMP4:4100,MP4:4200}),_defineProperty$2(_ERR_CODE,ERR.MEDIA,{MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203}),_defineProperty$2(_ERR_CODE,ERR.OTHER,8e3),_ERR_CODE),StreamingError=function(e){_inherits$1(r,e);var t=_createSuper$1(r);function r(e,n,i,o,a){var s;return _classCallCheck$1(this,r),(s=t.call(this,a||(null==i?void 0:i.message))).errorType=e===ERR.NETWORK_TIMEOUT?ERR.NETWORK:e,s.originError=i,s.ext=o,s.errorCode=ERR_CODE[e][n]||ERR_CODE[e],s.errorMessage=s.message,s.errorCode||(s.errorType=ERR.OTHER,s.errorCode=ERR_CODE[s.errorType]),s}return _createClass$2(r,null,[{key:"create",value:function(e,t,n,i,o){return e instanceof r?e:(e instanceof Error&&(n=e,e=""),e||(e=ERR.OTHER),new r(e,t,n,i,o))}},{key:"network",value:function(e){var t;return new r(null!=e&&e.isTimeout?ERR.NETWORK_TIMEOUT:ERR.NETWORK,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})}}]),r}(_wrapNativeSuper(Error)),LogCacheLevel={DEBUG:1,LOG:2,WARN:3,ERROR:4},LOG_MAX_SIZE=204800,SIMPLE_TYPE=["Boolean","Number","String","Undefined","Null","Date","Object"],Logger$1=function(){function e(t,r){_classCallCheck$1(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=(null==r?void 0:r.disabled)||!0,this.logCacheLevel=(null==r?void 0:r.logCacheLevel)||3,this.logMaxSize=(null==r?void 0:r.logMaxSize)||LOG_MAX_SIZE,this.logSize=0,this.logTextArray=[]}return _createClass$2(e,[{key:"debug",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[LogCacheLevel.DEBUG].concat(n)),e.disabled||(t=console).debug.apply(t,[this._prefix,nowTime()].concat(n))}},{key:"log",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[LogCacheLevel.LOG].concat(n)),e.disabled||(t=console).log.apply(t,[this._prefix,nowTime()].concat(n))}},{key:"warn",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[LogCacheLevel.WARN].concat(n)),e.disabled||(t=console).warn.apply(t,[this._prefix,nowTime()].concat(n))}},{key:"error",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[LogCacheLevel.ERROR].concat(n)),e.disabled||(t=console).error.apply(t,[this._prefix,nowTime()].concat(n))}},{key:"logCache",value:function(e){if(!(e<this.logCacheLevel)){var t="";try{for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var o=n.map((function(e){return logable(e)}));t=this._prefix+nowTime()+JSON.stringify(o)}catch(s){return}if(e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var a=this.logTextArray.shift();this.logSize-=a.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function nowTime(){return(new Date).toLocaleString()}function reduceDepth(e){if("object"!==_typeof$1(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 logable(e,t,r){r||(r=1),t||(t=2);var n={};if(!e||"object"!==_typeof$1(e))return e;var i=Object.prototype.toString.call(e).slice(8,-1);if(!SIMPLE_TYPE.includes(i))return i;if(!(r>t)){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r===t?n[o]=reduceDepth(e[o]):"object"===_typeof$1(e[o])?n[o]=logable(e[o],t,r+1):n[o]=e[o]);return n}}_defineProperty$2(Logger$1,"disabled",!0);var typedArrayConstructor={exports:{}},arrayBufferBasicDetection="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,NATIVE_ARRAY_BUFFER$1=arrayBufferBasicDetection,DESCRIPTORS$3=descriptors,global$d=global$H,isCallable$1=isCallable$u,isObject$6=isObject$n,hasOwn$2=hasOwnProperty_1,classof$3=classof$e,tryToString=tryToString$7,createNonEnumerableProperty$2=createNonEnumerableProperty$a,defineBuiltIn$1=defineBuiltIn$i,defineProperty$1=objectDefineProperty.f,isPrototypeOf$1=objectIsPrototypeOf,getPrototypeOf$1=objectGetPrototypeOf,setPrototypeOf$2=objectSetPrototypeOf,wellKnownSymbol$1=wellKnownSymbol$u,uid=uid$4,InternalStateModule$2=internalState,enforceInternalState$1=InternalStateModule$2.enforce,getInternalState$2=InternalStateModule$2.get,Int8Array$4=global$d.Int8Array,Int8ArrayPrototype$1=Int8Array$4&&Int8Array$4.prototype,Uint8ClampedArray$1=global$d.Uint8ClampedArray,Uint8ClampedArrayPrototype=Uint8ClampedArray$1&&Uint8ClampedArray$1.prototype,TypedArray$1=Int8Array$4&&getPrototypeOf$1(Int8Array$4),TypedArrayPrototype$2=Int8ArrayPrototype$1&&getPrototypeOf$1(Int8ArrayPrototype$1),ObjectPrototype$2=Object.prototype,TypeError$1=global$d.TypeError,TO_STRING_TAG=wellKnownSymbol$1("toStringTag"),TYPED_ARRAY_TAG$1=uid("TYPED_ARRAY_TAG"),TYPED_ARRAY_CONSTRUCTOR="TypedArrayConstructor",NATIVE_ARRAY_BUFFER_VIEWS$2=NATIVE_ARRAY_BUFFER$1&&!!setPrototypeOf$2&&"Opera"!==classof$3(global$d.opera),TYPED_ARRAY_TAG_REQUIRED=!1,NAME,Constructor,Prototype,TypedArrayConstructorsList={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},BigIntArrayConstructorsList={BigInt64Array:8,BigUint64Array:8},isView=function(e){if(!isObject$6(e))return!1;var t=classof$3(e);return"DataView"===t||hasOwn$2(TypedArrayConstructorsList,t)||hasOwn$2(BigIntArrayConstructorsList,t)},getTypedArrayConstructor$1=function e(t){var r=getPrototypeOf$1(t);if(isObject$6(r)){var n=getInternalState$2(r);return n&&hasOwn$2(n,TYPED_ARRAY_CONSTRUCTOR)?n[TYPED_ARRAY_CONSTRUCTOR]:e(r)}},isTypedArray$1=function(e){if(!isObject$6(e))return!1;var t=classof$3(e);return hasOwn$2(TypedArrayConstructorsList,t)||hasOwn$2(BigIntArrayConstructorsList,t)},aTypedArray$p=function(e){if(isTypedArray$1(e))return e;throw TypeError$1("Target is not a typed array")},aTypedArrayConstructor$3=function(e){if(isCallable$1(e)&&(!setPrototypeOf$2||isPrototypeOf$1(TypedArray$1,e)))return e;throw TypeError$1(tryToString(e)+" is not a typed array constructor")},exportTypedArrayMethod$q=function(e,t,r,n){if(DESCRIPTORS$3){if(r)for(var i in TypedArrayConstructorsList){var o=global$d[i];if(o&&hasOwn$2(o.prototype,e))try{delete o.prototype[e]}catch(error){try{o.prototype[e]=t}catch(a){}}}TypedArrayPrototype$2[e]&&!r||defineBuiltIn$1(TypedArrayPrototype$2,e,r?t:NATIVE_ARRAY_BUFFER_VIEWS$2&&Int8ArrayPrototype$1[e]||t,n)}},exportTypedArrayStaticMethod=function(e,t,r){var n,i;if(DESCRIPTORS$3){if(setPrototypeOf$2){if(r)for(n in TypedArrayConstructorsList)if((i=global$d[n])&&hasOwn$2(i,e))try{delete i[e]}catch(error){}if(TypedArray$1[e]&&!r)return;try{return defineBuiltIn$1(TypedArray$1,e,r?t:NATIVE_ARRAY_BUFFER_VIEWS$2&&TypedArray$1[e]||t)}catch(error){}}for(n in TypedArrayConstructorsList)!(i=global$d[n])||i[e]&&!r||defineBuiltIn$1(i,e,t)}};for(NAME in TypedArrayConstructorsList)Constructor=global$d[NAME],Prototype=Constructor&&Constructor.prototype,Prototype?enforceInternalState$1(Prototype)[TYPED_ARRAY_CONSTRUCTOR]=Constructor:NATIVE_ARRAY_BUFFER_VIEWS$2=!1;for(NAME in BigIntArrayConstructorsList)Constructor=global$d[NAME],Prototype=Constructor&&Constructor.prototype,Prototype&&(enforceInternalState$1(Prototype)[TYPED_ARRAY_CONSTRUCTOR]=Constructor);if((!NATIVE_ARRAY_BUFFER_VIEWS$2||!isCallable$1(TypedArray$1)||TypedArray$1===Function.prototype)&&(TypedArray$1=function(){throw TypeError$1("Incorrect invocation")},NATIVE_ARRAY_BUFFER_VIEWS$2))for(NAME in TypedArrayConstructorsList)global$d[NAME]&&setPrototypeOf$2(global$d[NAME],TypedArray$1);if((!NATIVE_ARRAY_BUFFER_VIEWS$2||!TypedArrayPrototype$2||TypedArrayPrototype$2===ObjectPrototype$2)&&(TypedArrayPrototype$2=TypedArray$1.prototype,NATIVE_ARRAY_BUFFER_VIEWS$2))for(NAME in TypedArrayConstructorsList)global$d[NAME]&&setPrototypeOf$2(global$d[NAME].prototype,TypedArrayPrototype$2);if(NATIVE_ARRAY_BUFFER_VIEWS$2&&getPrototypeOf$1(Uint8ClampedArrayPrototype)!==TypedArrayPrototype$2&&setPrototypeOf$2(Uint8ClampedArrayPrototype,TypedArrayPrototype$2),DESCRIPTORS$3&&!hasOwn$2(TypedArrayPrototype$2,TO_STRING_TAG))for(NAME in TYPED_ARRAY_TAG_REQUIRED=!0,defineProperty$1(TypedArrayPrototype$2,TO_STRING_TAG,{get:function(){return isObject$6(this)?this[TYPED_ARRAY_TAG$1]:void 0}}),TypedArrayConstructorsList)global$d[NAME]&&createNonEnumerableProperty$2(global$d[NAME],TYPED_ARRAY_TAG$1,NAME);var arrayBufferViewCore={NATIVE_ARRAY_BUFFER_VIEWS:NATIVE_ARRAY_BUFFER_VIEWS$2,TYPED_ARRAY_TAG:TYPED_ARRAY_TAG_REQUIRED&&TYPED_ARRAY_TAG$1,aTypedArray:aTypedArray$p,aTypedArrayConstructor:aTypedArrayConstructor$3,exportTypedArrayMethod:exportTypedArrayMethod$q,exportTypedArrayStaticMethod:exportTypedArrayStaticMethod,getTypedArrayConstructor:getTypedArrayConstructor$1,isView:isView,isTypedArray:isTypedArray$1,TypedArray:TypedArray$1,TypedArrayPrototype:TypedArrayPrototype$2},global$c=global$H,fails$b=fails$L,checkCorrectnessOfIteration=checkCorrectnessOfIteration$2,NATIVE_ARRAY_BUFFER_VIEWS$1=arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS,ArrayBuffer$2=global$c.ArrayBuffer,Int8Array$3=global$c.Int8Array,typedArrayConstructorsRequireWrappers=!NATIVE_ARRAY_BUFFER_VIEWS$1||!fails$b((function(){Int8Array$3(1)}))||!fails$b((function(){new Int8Array$3(-1)}))||!checkCorrectnessOfIteration((function(e){new Int8Array$3,new Int8Array$3(null),new Int8Array$3(1.5),new Int8Array$3(e)}),!0)||fails$b((function(){return 1!==new Int8Array$3(new ArrayBuffer$2(2),1,void 0).length})),toIntegerOrInfinity$4=toIntegerOrInfinity$d,toLength$3=toLength$8,$RangeError$2=RangeError,toIndex$2=function(e){if(void 0===e)return 0;var t=toIntegerOrInfinity$4(e),r=toLength$3(t);if(t!==r)throw $RangeError$2("Wrong length or index");return r},$Array=Array,abs=Math.abs,pow=Math.pow,floor$2=Math.floor,log=Math.log,LN2=Math.LN2,pack=function(e,t,r){var n,i,o,a=$Array(r),s=8*r-t-1,l=(1<<s)-1,c=l>>1,u=23===t?pow(2,-24)-pow(2,-77):0,h=e<0||0===e&&1/e<0?1:0,d=0;for((e=abs(e))!=e||e===1/0?(i=e!=e?1:0,n=l):(n=floor$2(log(e)/LN2),e*(o=pow(2,-n))<1&&(n--,o*=2),(e+=n+c>=1?u/o:u*pow(2,1-c))*o>=2&&(n++,o/=2),n+c>=l?(i=0,n=l):n+c>=1?(i=(e*o-1)*pow(2,t),n+=c):(i=e*pow(2,c-1)*pow(2,t),n=0));t>=8;)a[d++]=255&i,i/=256,t-=8;for(n=n<<t|i,s+=t;s>0;)a[d++]=255&n,n/=256,s-=8;return a[--d]|=128*h,a},unpack=function(e,t){var r,n=e.length,i=8*n-t-1,o=(1<<i)-1,a=o>>1,s=i-7,l=n-1,c=e[l--],u=127&c;for(c>>=7;s>0;)u=256*u+e[l--],s-=8;for(r=u&(1<<-s)-1,u>>=-s,s+=t;s>0;)r=256*r+e[l--],s-=8;if(0===u)u=1-a;else{if(u===o)return r?NaN:c?-1/0:1/0;r+=pow(2,t),u-=a}return(c?-1:1)*r*pow(2,u-t)},ieee754={pack:pack,unpack:unpack},toObject$5=toObject$h,toAbsoluteIndex$2=toAbsoluteIndex$7,lengthOfArrayLike$8=lengthOfArrayLike$i,arrayFill$1=function(e){for(var t=toObject$5(this),r=lengthOfArrayLike$8(t),n=arguments.length,i=toAbsoluteIndex$2(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:toAbsoluteIndex$2(o,r);a>i;)t[i++]=e;return t},global$b=global$H,uncurryThis$b=functionUncurryThis,DESCRIPTORS$2=descriptors,NATIVE_ARRAY_BUFFER=arrayBufferBasicDetection,FunctionName=functionName,createNonEnumerableProperty$1=createNonEnumerableProperty$a,defineBuiltIns=defineBuiltIns$2,fails$a=fails$L,anInstance$1=anInstance$5,toIntegerOrInfinity$3=toIntegerOrInfinity$d,toLength$2=toLength$8,toIndex$1=toIndex$2,IEEE754=ieee754,getPrototypeOf=objectGetPrototypeOf,setPrototypeOf$1=objectSetPrototypeOf,getOwnPropertyNames$1=objectGetOwnPropertyNames.f,defineProperty=objectDefineProperty.f,arrayFill=arrayFill$1,arraySlice$4=arraySliceSimple,setToStringTag=setToStringTag$7,InternalStateModule$1=internalState,PROPER_FUNCTION_NAME=FunctionName.PROPER,CONFIGURABLE_FUNCTION_NAME=FunctionName.CONFIGURABLE,getInternalState$1=InternalStateModule$1.get,setInternalState$1=InternalStateModule$1.set,ARRAY_BUFFER="ArrayBuffer",DATA_VIEW="DataView",PROTOTYPE="prototype",WRONG_LENGTH$1="Wrong length",WRONG_INDEX="Wrong index",NativeArrayBuffer=global$b[ARRAY_BUFFER],$ArrayBuffer=NativeArrayBuffer,ArrayBufferPrototype$1=$ArrayBuffer&&$ArrayBuffer[PROTOTYPE],$DataView=global$b[DATA_VIEW],DataViewPrototype=$DataView&&$DataView[PROTOTYPE],ObjectPrototype$1=Object.prototype,Array$1=global$b.Array,RangeError$3=global$b.RangeError,fill=uncurryThis$b(arrayFill),reverse=uncurryThis$b([].reverse),packIEEE754=IEEE754.pack,unpackIEEE754=IEEE754.unpack,packInt8=function(e){return[255&e]},packInt16=function(e){return[255&e,e>>8&255]},packInt32=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},unpackInt32=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},packFloat32=function(e){return packIEEE754(e,23,4)},packFloat64=function(e){return packIEEE754(e,52,8)},addGetter$1=function(e,t){defineProperty(e[PROTOTYPE],t,{get:function(){return getInternalState$1(this)[t]}})},get=function(e,t,r,n){var i=toIndex$1(r),o=getInternalState$1(e);if(i+t>o.byteLength)throw RangeError$3(WRONG_INDEX);var a=getInternalState$1(o.buffer).bytes,s=i+o.byteOffset,l=arraySlice$4(a,s,s+t);return n?l:reverse(l)},set=function(e,t,r,n,i,o){var a=toIndex$1(r),s=getInternalState$1(e);if(a+t>s.byteLength)throw RangeError$3(WRONG_INDEX);for(var l=getInternalState$1(s.buffer).bytes,c=a+s.byteOffset,u=n(+i),h=0;h<t;h++)l[c+h]=u[o?h:t-h-1]};if(NATIVE_ARRAY_BUFFER){var INCORRECT_ARRAY_BUFFER_NAME=PROPER_FUNCTION_NAME&&NativeArrayBuffer.name!==ARRAY_BUFFER;if(fails$a((function(){NativeArrayBuffer(1)}))&&fails$a((function(){new NativeArrayBuffer(-1)}))&&!fails$a((function(){return new NativeArrayBuffer,new NativeArrayBuffer(1.5),new NativeArrayBuffer(NaN),1!=NativeArrayBuffer.length||INCORRECT_ARRAY_BUFFER_NAME&&!CONFIGURABLE_FUNCTION_NAME})))INCORRECT_ARRAY_BUFFER_NAME&&CONFIGURABLE_FUNCTION_NAME&&createNonEnumerableProperty$1(NativeArrayBuffer,"name",ARRAY_BUFFER);else{$ArrayBuffer=function(e){return anInstance$1(this,ArrayBufferPrototype$1),new NativeArrayBuffer(toIndex$1(e))},$ArrayBuffer[PROTOTYPE]=ArrayBufferPrototype$1;for(var keys=getOwnPropertyNames$1(NativeArrayBuffer),j=0,key;keys.length>j;)(key=keys[j++])in $ArrayBuffer||createNonEnumerableProperty$1($ArrayBuffer,key,NativeArrayBuffer[key]);ArrayBufferPrototype$1.constructor=$ArrayBuffer}setPrototypeOf$1&&getPrototypeOf(DataViewPrototype)!==ObjectPrototype$1&&setPrototypeOf$1(DataViewPrototype,ObjectPrototype$1);var testView=new $DataView(new $ArrayBuffer(2)),$setInt8=uncurryThis$b(DataViewPrototype.setInt8);testView.setInt8(0,2147483648),testView.setInt8(1,2147483649),!testView.getInt8(0)&&testView.getInt8(1)||defineBuiltIns(DataViewPrototype,{setInt8:function(e,t){$setInt8(this,e,t<<24>>24)},setUint8:function(e,t){$setInt8(this,e,t<<24>>24)}},{unsafe:!0})}else $ArrayBuffer=function(e){anInstance$1(this,ArrayBufferPrototype$1);var t=toIndex$1(e);setInternalState$1(this,{bytes:fill(Array$1(t),0),byteLength:t}),DESCRIPTORS$2||(this.byteLength=t)},ArrayBufferPrototype$1=$ArrayBuffer[PROTOTYPE],$DataView=function(e,t,r){anInstance$1(this,DataViewPrototype),anInstance$1(e,ArrayBufferPrototype$1);var n=getInternalState$1(e).byteLength,i=toIntegerOrInfinity$3(t);if(i<0||i>n)throw RangeError$3("Wrong offset");if(i+(r=void 0===r?n-i:toLength$2(r))>n)throw RangeError$3(WRONG_LENGTH$1);setInternalState$1(this,{buffer:e,byteLength:r,byteOffset:i}),DESCRIPTORS$2||(this.buffer=e,this.byteLength=r,this.byteOffset=i)},DataViewPrototype=$DataView[PROTOTYPE],DESCRIPTORS$2&&(addGetter$1($ArrayBuffer,"byteLength"),addGetter$1($DataView,"buffer"),addGetter$1($DataView,"byteLength"),addGetter$1($DataView,"byteOffset")),defineBuiltIns(DataViewPrototype,{getInt8:function(e){return get(this,1,e)[0]<<24>>24},getUint8:function(e){return get(this,1,e)[0]},getInt16:function(e){var t=get(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=get(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return unpackInt32(get(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return unpackInt32(get(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return unpackIEEE754(get(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return unpackIEEE754(get(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){set(this,1,e,packInt8,t)},setUint8:function(e,t){set(this,1,e,packInt8,t)},setInt16:function(e,t){set(this,2,e,packInt16,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){set(this,2,e,packInt16,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){set(this,4,e,packInt32,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){set(this,4,e,packInt32,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){set(this,4,e,packFloat32,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){set(this,8,e,packFloat64,t,arguments.length>2?arguments[2]:void 0)}});setToStringTag($ArrayBuffer,ARRAY_BUFFER),setToStringTag($DataView,DATA_VIEW);var arrayBuffer={ArrayBuffer:$ArrayBuffer,DataView:$DataView},isObject$5=isObject$n,floor$1=Math.floor,isIntegralNumber$1=Number.isInteger||function(e){return!isObject$5(e)&&isFinite(e)&&floor$1(e)===e},toIntegerOrInfinity$2=toIntegerOrInfinity$d,$RangeError$1=RangeError,toPositiveInteger$1=function(e){var t=toIntegerOrInfinity$2(e);if(t<0)throw $RangeError$1("The argument can't be less than 0");return t},toPositiveInteger=toPositiveInteger$1,$RangeError=RangeError,toOffset$2=function(e,t){var r=toPositiveInteger(e);if(r%t)throw $RangeError("Wrong offset");return r},classof$2=classof$e,uncurryThis$a=functionUncurryThis,slice$1=uncurryThis$a("".slice),isBigIntArray$1=function(e){return"Big"===slice$1(classof$2(e),0,3)},toPrimitive=toPrimitive$3,$TypeError$1=TypeError,toBigInt$2=function(e){var t=toPrimitive(e,"number");if("number"==typeof t)throw $TypeError$1("Can't convert number to bigint");return BigInt(t)},bind$3=functionBindContext,call$3=functionCall,aConstructor$1=aConstructor$3,toObject$4=toObject$h,lengthOfArrayLike$7=lengthOfArrayLike$i,getIterator=getIterator$4,getIteratorMethod=getIteratorMethod$5,isArrayIteratorMethod=isArrayIteratorMethod$3,isBigIntArray=isBigIntArray$1,aTypedArrayConstructor$2=arrayBufferViewCore.aTypedArrayConstructor,toBigInt$1=toBigInt$2,typedArrayFrom$1=function(e){var t,r,n,i,o,a,s,l,c=aConstructor$1(this),u=toObject$4(e),h=arguments.length,d=h>1?arguments[1]:void 0,p=void 0!==d,f=getIteratorMethod(u);if(f&&!isArrayIteratorMethod(f))for(l=(s=getIterator(u,f)).next,u=[];!(a=call$3(l,s)).done;)u.push(a.value);for(p&&h>2&&(d=bind$3(d,arguments[2])),r=lengthOfArrayLike$7(u),n=new(aTypedArrayConstructor$2(c))(r),i=isBigIntArray(n),t=0;r>t;t++)o=p?d(u[t],t):u[t],n[t]=i?toBigInt$1(o):+o;return n},$$7=_export,global$a=global$H,call$2=functionCall,DESCRIPTORS$1=descriptors,TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS=typedArrayConstructorsRequireWrappers,ArrayBufferViewCore$q=arrayBufferViewCore,ArrayBufferModule=arrayBuffer,anInstance=anInstance$5,createPropertyDescriptor=createPropertyDescriptor$7,createNonEnumerableProperty=createNonEnumerableProperty$a,isIntegralNumber=isIntegralNumber$1,toLength$1=toLength$8,toIndex=toIndex$2,toOffset$1=toOffset$2,toPropertyKey=toPropertyKey$5,hasOwn$1=hasOwnProperty_1,classof$1=classof$e,isObject$4=isObject$n,isSymbol=isSymbol$6,create$1=objectCreate,isPrototypeOf=objectIsPrototypeOf,setPrototypeOf=objectSetPrototypeOf,getOwnPropertyNames=objectGetOwnPropertyNames.f,typedArrayFrom=typedArrayFrom$1,forEach=arrayIteration.forEach,setSpecies=setSpecies$3,definePropertyModule=objectDefineProperty,getOwnPropertyDescriptorModule=objectGetOwnPropertyDescriptor,InternalStateModule=internalState,inheritIfRequired=inheritIfRequired$3,getInternalState=InternalStateModule.get,setInternalState=InternalStateModule.set,enforceInternalState=InternalStateModule.enforce,nativeDefineProperty=definePropertyModule.f,nativeGetOwnPropertyDescriptor=getOwnPropertyDescriptorModule.f,round=Math.round,RangeError$2=global$a.RangeError,ArrayBuffer$1=ArrayBufferModule.ArrayBuffer,ArrayBufferPrototype=ArrayBuffer$1.prototype,DataView$1=ArrayBufferModule.DataView,NATIVE_ARRAY_BUFFER_VIEWS=ArrayBufferViewCore$q.NATIVE_ARRAY_BUFFER_VIEWS,TYPED_ARRAY_TAG=ArrayBufferViewCore$q.TYPED_ARRAY_TAG,TypedArray=ArrayBufferViewCore$q.TypedArray,TypedArrayPrototype$1=ArrayBufferViewCore$q.TypedArrayPrototype,aTypedArrayConstructor$1=ArrayBufferViewCore$q.aTypedArrayConstructor,isTypedArray=ArrayBufferViewCore$q.isTypedArray,BYTES_PER_ELEMENT="BYTES_PER_ELEMENT",WRONG_LENGTH="Wrong length",fromList=function(e,t){aTypedArrayConstructor$1(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},addGetter=function(e,t){nativeDefineProperty(e,t,{get:function(){return getInternalState(this)[t]}})},isArrayBuffer=function(e){var t;return isPrototypeOf(ArrayBufferPrototype,e)||"ArrayBuffer"==(t=classof$1(e))||"SharedArrayBuffer"==t},isTypedArrayIndex=function(e,t){return isTypedArray(e)&&!isSymbol(t)&&t in e&&isIntegralNumber(+t)&&t>=0},wrappedGetOwnPropertyDescriptor=function(e,t){return t=toPropertyKey(t),isTypedArrayIndex(e,t)?createPropertyDescriptor(2,e[t]):nativeGetOwnPropertyDescriptor(e,t)},wrappedDefineProperty=function(e,t,r){return t=toPropertyKey(t),!(isTypedArrayIndex(e,t)&&isObject$4(r)&&hasOwn$1(r,"value"))||hasOwn$1(r,"get")||hasOwn$1(r,"set")||r.configurable||hasOwn$1(r,"writable")&&!r.writable||hasOwn$1(r,"enumerable")&&!r.enumerable?nativeDefineProperty(e,t,r):(e[t]=r.value,e)};DESCRIPTORS$1?(NATIVE_ARRAY_BUFFER_VIEWS||(getOwnPropertyDescriptorModule.f=wrappedGetOwnPropertyDescriptor,definePropertyModule.f=wrappedDefineProperty,addGetter(TypedArrayPrototype$1,"buffer"),addGetter(TypedArrayPrototype$1,"byteOffset"),addGetter(TypedArrayPrototype$1,"byteLength"),addGetter(TypedArrayPrototype$1,"length")),$$7({target:"Object",stat:!0,forced:!NATIVE_ARRAY_BUFFER_VIEWS},{getOwnPropertyDescriptor:wrappedGetOwnPropertyDescriptor,defineProperty:wrappedDefineProperty}),typedArrayConstructor.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=global$a[i],l=s,c=l&&l.prototype,u={},h=function(e,t){nativeDefineProperty(e,t,{get:function(){return function(e,t){var r=getInternalState(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=getInternalState(e);r&&(i=(i=round(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};NATIVE_ARRAY_BUFFER_VIEWS?TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS&&(l=t((function(e,t,r,i){return anInstance(e,c),inheritIfRequired(isObject$4(t)?isArrayBuffer(t)?void 0!==i?new s(t,toOffset$1(r,n),i):void 0!==r?new s(t,toOffset$1(r,n)):new s(t):isTypedArray(t)?fromList(l,t):call$2(typedArrayFrom,l,t):new s(toIndex(t)),e,l)})),setPrototypeOf&&setPrototypeOf(l,TypedArray),forEach(getOwnPropertyNames(s),(function(e){e in l||createNonEnumerableProperty(l,e,s[e])})),l.prototype=c):(l=t((function(e,t,r,i){anInstance(e,c);var o,a,s,u=0,d=0;if(isObject$4(t)){if(!isArrayBuffer(t))return isTypedArray(t)?fromList(l,t):call$2(typedArrayFrom,l,t);o=t,d=toOffset$1(r,n);var p=t.byteLength;if(void 0===i){if(p%n)throw RangeError$2(WRONG_LENGTH);if((a=p-d)<0)throw RangeError$2(WRONG_LENGTH)}else if((a=toLength$1(i)*n)+d>p)throw RangeError$2(WRONG_LENGTH);s=a/n}else s=toIndex(t),o=new ArrayBuffer$1(a=s*n);for(setInternalState(e,{buffer:o,byteOffset:d,byteLength:a,length:s,view:new DataView$1(o)});u<s;)h(e,u++)})),setPrototypeOf&&setPrototypeOf(l,TypedArray),c=l.prototype=create$1(TypedArrayPrototype$1)),c.constructor!==l&&createNonEnumerableProperty(c,"constructor",l),enforceInternalState(c).TypedArrayConstructor=l,TYPED_ARRAY_TAG&&createNonEnumerableProperty(c,TYPED_ARRAY_TAG,i);var d=l!=s;u[i]=l,$$7({global:!0,constructor:!0,forced:d,sham:!NATIVE_ARRAY_BUFFER_VIEWS},u),BYTES_PER_ELEMENT in l||createNonEnumerableProperty(l,BYTES_PER_ELEMENT,n),BYTES_PER_ELEMENT in c||createNonEnumerableProperty(c,BYTES_PER_ELEMENT,n),setSpecies(i)}):typedArrayConstructor.exports=function(){};var createTypedArrayConstructor=typedArrayConstructor.exports;createTypedArrayConstructor("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var ArrayBufferViewCore$p=arrayBufferViewCore,lengthOfArrayLike$6=lengthOfArrayLike$i,toIntegerOrInfinity$1=toIntegerOrInfinity$d,aTypedArray$o=ArrayBufferViewCore$p.aTypedArray,exportTypedArrayMethod$p=ArrayBufferViewCore$p.exportTypedArrayMethod;exportTypedArrayMethod$p("at",(function(e){var t=aTypedArray$o(this),r=lengthOfArrayLike$6(t),n=toIntegerOrInfinity$1(e),i=n>=0?n:r+n;return i<0||i>=r?void 0:t[i]}));var toObject$3=toObject$h,toAbsoluteIndex$1=toAbsoluteIndex$7,lengthOfArrayLike$5=lengthOfArrayLike$i,deletePropertyOrThrow=deletePropertyOrThrow$3,min$1=Math.min,arrayCopyWithin=[].copyWithin||function(e,t){var r=toObject$3(this),n=lengthOfArrayLike$5(r),i=toAbsoluteIndex$1(e,n),o=toAbsoluteIndex$1(t,n),a=arguments.length>2?arguments[2]:void 0,s=min$1((void 0===a?n:toAbsoluteIndex$1(a,n))-o,n-i),l=1;for(o<i&&i<o+s&&(l=-1,o+=s-1,i+=s-1);s-- >0;)o in r?r[i]=r[o]:deletePropertyOrThrow(r,i),i+=l,o+=l;return r},uncurryThis$9=functionUncurryThis,ArrayBufferViewCore$o=arrayBufferViewCore,$ArrayCopyWithin=arrayCopyWithin,u$ArrayCopyWithin=uncurryThis$9($ArrayCopyWithin),aTypedArray$n=ArrayBufferViewCore$o.aTypedArray,exportTypedArrayMethod$o=ArrayBufferViewCore$o.exportTypedArrayMethod;exportTypedArrayMethod$o("copyWithin",(function(e,t){return u$ArrayCopyWithin(aTypedArray$n(this),e,t,arguments.length>2?arguments[2]:void 0)}));var ArrayBufferViewCore$n=arrayBufferViewCore,$every=arrayIteration.every,aTypedArray$m=ArrayBufferViewCore$n.aTypedArray,exportTypedArrayMethod$n=ArrayBufferViewCore$n.exportTypedArrayMethod;exportTypedArrayMethod$n("every",(function(e){return $every(aTypedArray$m(this),e,arguments.length>1?arguments[1]:void 0)}));var ArrayBufferViewCore$m=arrayBufferViewCore,$fill=arrayFill$1,toBigInt=toBigInt$2,classof=classof$e,call$1=functionCall,uncurryThis$8=functionUncurryThis,fails$9=fails$L,aTypedArray$l=ArrayBufferViewCore$m.aTypedArray,exportTypedArrayMethod$m=ArrayBufferViewCore$m.exportTypedArrayMethod,slice=uncurryThis$8("".slice),CONVERSION_BUG=fails$9((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e}));exportTypedArrayMethod$m("fill",(function(e){var t=arguments.length;aTypedArray$l(this);var r="Big"===slice(classof(this),0,3)?toBigInt(e):+e;return call$1($fill,this,r,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),CONVERSION_BUG);var lengthOfArrayLike$4=lengthOfArrayLike$i,arrayFromConstructorAndList$1=function(e,t){for(var r=0,n=lengthOfArrayLike$4(t),i=new e(n);n>r;)i[r]=t[r++];return i},ArrayBufferViewCore$l=arrayBufferViewCore,speciesConstructor=speciesConstructor$4,aTypedArrayConstructor=ArrayBufferViewCore$l.aTypedArrayConstructor,getTypedArrayConstructor=ArrayBufferViewCore$l.getTypedArrayConstructor,typedArraySpeciesConstructor$4=function(e){return aTypedArrayConstructor(speciesConstructor(e,getTypedArrayConstructor(e)))},arrayFromConstructorAndList=arrayFromConstructorAndList$1,typedArraySpeciesConstructor$3=typedArraySpeciesConstructor$4,typedArrayFromSpeciesAndList=function(e,t){return arrayFromConstructorAndList(typedArraySpeciesConstructor$3(e),t)},ArrayBufferViewCore$k=arrayBufferViewCore,$filter=arrayIteration.filter,fromSpeciesAndList=typedArrayFromSpeciesAndList,aTypedArray$k=ArrayBufferViewCore$k.aTypedArray,exportTypedArrayMethod$l=ArrayBufferViewCore$k.exportTypedArrayMethod;exportTypedArrayMethod$l("filter",(function(e){var t=$filter(aTypedArray$k(this),e,arguments.length>1?arguments[1]:void 0);return fromSpeciesAndList(this,t)}));var ArrayBufferViewCore$j=arrayBufferViewCore,$find=arrayIteration.find,aTypedArray$j=ArrayBufferViewCore$j.aTypedArray,exportTypedArrayMethod$k=ArrayBufferViewCore$j.exportTypedArrayMethod;exportTypedArrayMethod$k("find",(function(e){return $find(aTypedArray$j(this),e,arguments.length>1?arguments[1]:void 0)}));var ArrayBufferViewCore$i=arrayBufferViewCore,$findIndex=arrayIteration.findIndex,aTypedArray$i=ArrayBufferViewCore$i.aTypedArray,exportTypedArrayMethod$j=ArrayBufferViewCore$i.exportTypedArrayMethod;exportTypedArrayMethod$j("findIndex",(function(e){return $findIndex(aTypedArray$i(this),e,arguments.length>1?arguments[1]:void 0)}));var bind$2=functionBindContext,IndexedObject$1=indexedObject,toObject$2=toObject$h,lengthOfArrayLike$3=lengthOfArrayLike$i,createMethod$2=function(e){var t=1==e;return function(r,n,i){for(var o,a=toObject$2(r),s=IndexedObject$1(a),l=bind$2(n,i),c=lengthOfArrayLike$3(s);c-- >0;)if(l(o=s[c],c,a))switch(e){case 0:return o;case 1:return c}return t?-1:void 0}},arrayIterationFromLast={findLast:createMethod$2(0),findLastIndex:createMethod$2(1)},ArrayBufferViewCore$h=arrayBufferViewCore,$findLast=arrayIterationFromLast.findLast,aTypedArray$h=ArrayBufferViewCore$h.aTypedArray,exportTypedArrayMethod$i=ArrayBufferViewCore$h.exportTypedArrayMethod;exportTypedArrayMethod$i("findLast",(function(e){return $findLast(aTypedArray$h(this),e,arguments.length>1?arguments[1]:void 0)}));var ArrayBufferViewCore$g=arrayBufferViewCore,$findLastIndex=arrayIterationFromLast.findLastIndex,aTypedArray$g=ArrayBufferViewCore$g.aTypedArray,exportTypedArrayMethod$h=ArrayBufferViewCore$g.exportTypedArrayMethod;exportTypedArrayMethod$h("findLastIndex",(function(e){return $findLastIndex(aTypedArray$g(this),e,arguments.length>1?arguments[1]:void 0)}));var ArrayBufferViewCore$f=arrayBufferViewCore,$forEach=arrayIteration.forEach,aTypedArray$f=ArrayBufferViewCore$f.aTypedArray,exportTypedArrayMethod$g=ArrayBufferViewCore$f.exportTypedArrayMethod;exportTypedArrayMethod$g("forEach",(function(e){$forEach(aTypedArray$f(this),e,arguments.length>1?arguments[1]:void 0)}));var ArrayBufferViewCore$e=arrayBufferViewCore,$includes=arrayIncludes.includes,aTypedArray$e=ArrayBufferViewCore$e.aTypedArray,exportTypedArrayMethod$f=ArrayBufferViewCore$e.exportTypedArrayMethod;exportTypedArrayMethod$f("includes",(function(e){return $includes(aTypedArray$e(this),e,arguments.length>1?arguments[1]:void 0)}));var ArrayBufferViewCore$d=arrayBufferViewCore,$indexOf=arrayIncludes.indexOf,aTypedArray$d=ArrayBufferViewCore$d.aTypedArray,exportTypedArrayMethod$e=ArrayBufferViewCore$d.exportTypedArrayMethod;exportTypedArrayMethod$e("indexOf",(function(e){return $indexOf(aTypedArray$d(this),e,arguments.length>1?arguments[1]:void 0)}));var global$9=global$H,fails$8=fails$L,uncurryThis$7=functionUncurryThis,ArrayBufferViewCore$c=arrayBufferViewCore,ArrayIterators=es_array_iterator,wellKnownSymbol=wellKnownSymbol$u,ITERATOR$1=wellKnownSymbol("iterator"),Uint8Array$2=global$9.Uint8Array,arrayValues=uncurryThis$7(ArrayIterators.values),arrayKeys=uncurryThis$7(ArrayIterators.keys),arrayEntries=uncurryThis$7(ArrayIterators.entries),aTypedArray$c=ArrayBufferViewCore$c.aTypedArray,exportTypedArrayMethod$d=ArrayBufferViewCore$c.exportTypedArrayMethod,TypedArrayPrototype=Uint8Array$2&&Uint8Array$2.prototype,GENERIC=!fails$8((function(){TypedArrayPrototype[ITERATOR$1].call([1])})),ITERATOR_IS_VALUES=!!TypedArrayPrototype&&TypedArrayPrototype.values&&TypedArrayPrototype[ITERATOR$1]===TypedArrayPrototype.values&&"values"===TypedArrayPrototype.values.name,typedArrayValues=function(){return arrayValues(aTypedArray$c(this))};exportTypedArrayMethod$d("entries",(function(){return arrayEntries(aTypedArray$c(this))}),GENERIC),exportTypedArrayMethod$d("keys",(function(){return arrayKeys(aTypedArray$c(this))}),GENERIC),exportTypedArrayMethod$d("values",typedArrayValues,GENERIC||!ITERATOR_IS_VALUES,{name:"values"}),exportTypedArrayMethod$d(ITERATOR$1,typedArrayValues,GENERIC||!ITERATOR_IS_VALUES,{name:"values"});var ArrayBufferViewCore$b=arrayBufferViewCore,uncurryThis$6=functionUncurryThis,aTypedArray$b=ArrayBufferViewCore$b.aTypedArray,exportTypedArrayMethod$c=ArrayBufferViewCore$b.exportTypedArrayMethod,$join=uncurryThis$6([].join);exportTypedArrayMethod$c("join",(function(e){return $join(aTypedArray$b(this),e)}));var apply$5=functionApply,toIndexedObject$2=toIndexedObject$c,toIntegerOrInfinity=toIntegerOrInfinity$d,lengthOfArrayLike$2=lengthOfArrayLike$i,arrayMethodIsStrict=arrayMethodIsStrict$4,min=Math.min,$lastIndexOf$1=[].lastIndexOf,NEGATIVE_ZERO=!!$lastIndexOf$1&&1/[1].lastIndexOf(1,-0)<0,STRICT_METHOD=arrayMethodIsStrict("lastIndexOf"),FORCED$4=NEGATIVE_ZERO||!STRICT_METHOD,arrayLastIndexOf=FORCED$4?function(e){if(NEGATIVE_ZERO)return apply$5($lastIndexOf$1,this,arguments)||0;var t=toIndexedObject$2(this),r=lengthOfArrayLike$2(t),n=r-1;for(arguments.length>1&&(n=min(n,toIntegerOrInfinity(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:$lastIndexOf$1,ArrayBufferViewCore$a=arrayBufferViewCore,apply$4=functionApply,$lastIndexOf=arrayLastIndexOf,aTypedArray$a=ArrayBufferViewCore$a.aTypedArray,exportTypedArrayMethod$b=ArrayBufferViewCore$a.exportTypedArrayMethod;exportTypedArrayMethod$b("lastIndexOf",(function(e){var t=arguments.length;return apply$4($lastIndexOf,aTypedArray$a(this),t>1?[e,arguments[1]]:[e])}));var ArrayBufferViewCore$9=arrayBufferViewCore,$map=arrayIteration.map,typedArraySpeciesConstructor$2=typedArraySpeciesConstructor$4,aTypedArray$9=ArrayBufferViewCore$9.aTypedArray,exportTypedArrayMethod$a=ArrayBufferViewCore$9.exportTypedArrayMethod;exportTypedArrayMethod$a("map",(function(e){return $map(aTypedArray$9(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(typedArraySpeciesConstructor$2(e))(t)}))}));var aCallable$2=aCallable$b,toObject$1=toObject$h,IndexedObject=indexedObject,lengthOfArrayLike$1=lengthOfArrayLike$i,$TypeError=TypeError,createMethod$1=function(e){return function(t,r,n,i){aCallable$2(r);var o=toObject$1(t),a=IndexedObject(o),s=lengthOfArrayLike$1(o),l=e?s-1:0,c=e?-1:1;if(n<2)for(;;){if(l in a){i=a[l],l+=c;break}if(l+=c,e?l<0:s<=l)throw $TypeError("Reduce of empty array with no initial value")}for(;e?l>=0:s>l;l+=c)l in a&&(i=r(i,a[l],l,o));return i}},arrayReduce={left:createMethod$1(!1),right:createMethod$1(!0)},ArrayBufferViewCore$8=arrayBufferViewCore,$reduce=arrayReduce.left,aTypedArray$8=ArrayBufferViewCore$8.aTypedArray,exportTypedArrayMethod$9=ArrayBufferViewCore$8.exportTypedArrayMethod;exportTypedArrayMethod$9("reduce",(function(e){var t=arguments.length;return $reduce(aTypedArray$8(this),e,t,t>1?arguments[1]:void 0)}));var ArrayBufferViewCore$7=arrayBufferViewCore,$reduceRight=arrayReduce.right,aTypedArray$7=ArrayBufferViewCore$7.aTypedArray,exportTypedArrayMethod$8=ArrayBufferViewCore$7.exportTypedArrayMethod;exportTypedArrayMethod$8("reduceRight",(function(e){var t=arguments.length;return $reduceRight(aTypedArray$7(this),e,t,t>1?arguments[1]:void 0)}));var ArrayBufferViewCore$6=arrayBufferViewCore,aTypedArray$6=ArrayBufferViewCore$6.aTypedArray,exportTypedArrayMethod$7=ArrayBufferViewCore$6.exportTypedArrayMethod,floor=Math.floor;exportTypedArrayMethod$7("reverse",(function(){for(var e,t=this,r=aTypedArray$6(t).length,n=floor(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var global$8=global$H,call=functionCall,ArrayBufferViewCore$5=arrayBufferViewCore,lengthOfArrayLike=lengthOfArrayLike$i,toOffset=toOffset$2,toIndexedObject$1=toObject$h,fails$7=fails$L,RangeError$1=global$8.RangeError,Int8Array$2=global$8.Int8Array,Int8ArrayPrototype=Int8Array$2&&Int8Array$2.prototype,$set=Int8ArrayPrototype&&Int8ArrayPrototype.set,aTypedArray$5=ArrayBufferViewCore$5.aTypedArray,exportTypedArrayMethod$6=ArrayBufferViewCore$5.exportTypedArrayMethod,WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS=!fails$7((function(){var e=new Uint8ClampedArray(2);return call($set,e,{length:1,0:3},1),3!==e[1]})),TO_OBJECT_BUG=WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS&&ArrayBufferViewCore$5.NATIVE_ARRAY_BUFFER_VIEWS&&fails$7((function(){var e=new Int8Array$2(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));exportTypedArrayMethod$6("set",(function(e){aTypedArray$5(this);var t=toOffset(arguments.length>1?arguments[1]:void 0,1),r=toIndexedObject$1(e);if(WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS)return call($set,this,r,t);var n=this.length,i=lengthOfArrayLike(r),o=0;if(i+t>n)throw RangeError$1("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS||TO_OBJECT_BUG);var ArrayBufferViewCore$4=arrayBufferViewCore,typedArraySpeciesConstructor$1=typedArraySpeciesConstructor$4,fails$6=fails$L,arraySlice$3=arraySlice$c,aTypedArray$4=ArrayBufferViewCore$4.aTypedArray,exportTypedArrayMethod$5=ArrayBufferViewCore$4.exportTypedArrayMethod,FORCED$3=fails$6((function(){new Int8Array(1).slice()}));exportTypedArrayMethod$5("slice",(function(e,t){for(var r=arraySlice$3(aTypedArray$4(this),e,t),n=typedArraySpeciesConstructor$1(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),FORCED$3);var ArrayBufferViewCore$3=arrayBufferViewCore,$some=arrayIteration.some,aTypedArray$3=ArrayBufferViewCore$3.aTypedArray,exportTypedArrayMethod$4=ArrayBufferViewCore$3.exportTypedArrayMethod;exportTypedArrayMethod$4("some",(function(e){return $some(aTypedArray$3(this),e,arguments.length>1?arguments[1]:void 0)}));var global$7=global$H,uncurryThis$5=functionUncurryThis,fails$5=fails$L,aCallable$1=aCallable$b,internalSort=arraySort$1,ArrayBufferViewCore$2=arrayBufferViewCore,FF=engineFfVersion,IE_OR_EDGE=engineIsIeOrEdge,V8=engineV8Version,WEBKIT=engineWebkitVersion,aTypedArray$2=ArrayBufferViewCore$2.aTypedArray,exportTypedArrayMethod$3=ArrayBufferViewCore$2.exportTypedArrayMethod,Uint16Array=global$7.Uint16Array,nativeSort=Uint16Array&&uncurryThis$5(Uint16Array.prototype.sort),ACCEPT_INCORRECT_ARGUMENTS=!(!nativeSort||fails$5((function(){nativeSort(new Uint16Array(2),null)}))&&fails$5((function(){nativeSort(new Uint16Array(2),{})}))),STABLE_SORT=!!nativeSort&&!fails$5((function(){if(V8)return V8<74;if(FF)return FF<67;if(IE_OR_EDGE)return!0;if(WEBKIT)return WEBKIT<602;var e,t,r=new Uint16Array(516),n=Array(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(nativeSort(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0})),getSortCompare=function(e){return function(t,r){return void 0!==e?+e(t,r)||0:r!=r?-1:t!=t?1:0===t&&0===r?1/t>0&&1/r<0?1:-1:t>r}};exportTypedArrayMethod$3("sort",(function(e){return void 0!==e&&aCallable$1(e),STABLE_SORT?nativeSort(this,e):internalSort(aTypedArray$2(this),getSortCompare(e))}),!STABLE_SORT||ACCEPT_INCORRECT_ARGUMENTS);var ArrayBufferViewCore$1=arrayBufferViewCore,toLength=toLength$8,toAbsoluteIndex=toAbsoluteIndex$7,typedArraySpeciesConstructor=typedArraySpeciesConstructor$4,aTypedArray$1=ArrayBufferViewCore$1.aTypedArray,exportTypedArrayMethod$2=ArrayBufferViewCore$1.exportTypedArrayMethod;exportTypedArrayMethod$2("subarray",(function(e,t){var r=aTypedArray$1(this),n=r.length,i=toAbsoluteIndex(e,n);return new(typedArraySpeciesConstructor(r))(r.buffer,r.byteOffset+i*r.BYTES_PER_ELEMENT,toLength((void 0===t?n:toAbsoluteIndex(t,n))-i))}));var global$6=global$H,apply$3=functionApply,ArrayBufferViewCore=arrayBufferViewCore,fails$4=fails$L,arraySlice$2=arraySlice$c,Int8Array$1=global$6.Int8Array,aTypedArray=ArrayBufferViewCore.aTypedArray,exportTypedArrayMethod$1=ArrayBufferViewCore.exportTypedArrayMethod,$toLocaleString=[].toLocaleString,TO_LOCALE_STRING_BUG=!!Int8Array$1&&fails$4((function(){$toLocaleString.call(new Int8Array$1(1))})),FORCED$2=fails$4((function(){return[1,2].toLocaleString()!=new Int8Array$1([1,2]).toLocaleString()}))||!fails$4((function(){Int8Array$1.prototype.toLocaleString.call([1,2])}));exportTypedArrayMethod$1("toLocaleString",(function(){return apply$3($toLocaleString,TO_LOCALE_STRING_BUG?arraySlice$2(aTypedArray(this)):aTypedArray(this),arraySlice$2(arguments))}),FORCED$2);var exportTypedArrayMethod=arrayBufferViewCore.exportTypedArrayMethod,fails$3=fails$L,global$5=global$H,uncurryThis$4=functionUncurryThis,Uint8Array$1=global$5.Uint8Array,Uint8ArrayPrototype=Uint8Array$1&&Uint8Array$1.prototype||{},arrayToString=[].toString,join$1=uncurryThis$4([].join);fails$3((function(){arrayToString.call({})}))&&(arrayToString=function(){return join$1(this)});var IS_NOT_ARRAY_METHOD=Uint8ArrayPrototype.toString!=arrayToString;exportTypedArrayMethod("toString",arrayToString,IS_NOT_ARRAY_METHOD);var LoaderType={FETCH:"fetch",XHR:"xhr"},ResponseType={ARRAY_BUFFER:"arraybuffer",TEXT:"text",JSON:"json"},NetError=function(e){_inherits$1(r,e);var t=_createSuper$1(r);function r(e,n,i,o){var a;return _classCallCheck$1(this,r),_defineProperty$2(_assertThisInitialized$1(a=t.call(this,o)),"retryCount",0),_defineProperty$2(_assertThisInitialized$1(a),"isTimeout",!1),_defineProperty$2(_assertThisInitialized$1(a),"loaderType",LoaderType.FETCH),_defineProperty$2(_assertThisInitialized$1(a),"startTime",0),_defineProperty$2(_assertThisInitialized$1(a),"endTime",0),_defineProperty$2(_assertThisInitialized$1(a),"options",{}),a.url=e,a.request=n,a.response=i,a}return _createClass$2(r)}(_wrapNativeSuper(Error)),$$6=_export,fails$2=fails$L,toObject=toObject$h,nativeGetPrototypeOf=objectGetPrototypeOf,CORRECT_PROTOTYPE_GETTER=correctPrototypeGetter,FAILS_ON_PRIMITIVES=fails$2((function(){nativeGetPrototypeOf(1)}));$$6({target:"Object",stat:!0,forced:FAILS_ON_PRIMITIVES,sham:!CORRECT_PROTOTYPE_GETTER},{getPrototypeOf:function(e){return nativeGetPrototypeOf(toObject(e))}});var toString$1=Object.prototype.toString;function isObject$3(e){return null!==e&&"object"===_typeof$1(e)}function isPlainObject(e){if("[object Object]"!==toString$1.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function isDate(e){return"[object Date]"===toString$1.call(e)}function getRangeValue(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 encode(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function setUrlParams(e,t){if(e){if(!t)return e;var r,n=Object.keys(t).map((function(e){if(null!=(r=t[e]))return Array.isArray(r)?e+="[]":r=[r],r.map((function(t){return isDate(t)?t=t.toISOString():isObject$3(t)&&(t=JSON.stringify(t)),"".concat(encode(e),"=").concat(encode(t))})).join("&")})).filter(Boolean).join("&");if(n){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}}function createResponse(e,t,r,n,i,o,a,s,l,c,u){return i=null!=i?parseFloat(i):null,n=parseInt(n||"0",10),Number.isNaN(n)&&(n=0),{data:e,done:t,option:{range:l,vid:c,index:s,contentLength:n,age:i,startTime:o,firstByteTime:a,endTime:Date.now(),priOptions:u},response:r}}function calculateSpeed(e,t){return Math.round(8*e*1e3/t/1024)}var EVENT={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"},CACHESIZE=2097152,FetchLoader=function(e){_inherits$1(n,e);var t,r=_createSuper$1(n);function n(){var e;return _classCallCheck$1(this,n),_defineProperty$2(_assertThisInitialized$1(e=r.call(this)),"_abortController",null),_defineProperty$2(_assertThisInitialized$1(e),"_timeoutTimer",null),_defineProperty$2(_assertThisInitialized$1(e),"_reader",null),_defineProperty$2(_assertThisInitialized$1(e),"_response",null),_defineProperty$2(_assertThisInitialized$1(e),"_aborted",!1),_defineProperty$2(_assertThisInitialized$1(e),"_index",-1),_defineProperty$2(_assertThisInitialized$1(e),"_range",null),_defineProperty$2(_assertThisInitialized$1(e),"_receivedLength",0),_defineProperty$2(_assertThisInitialized$1(e),"_running",!1),_defineProperty$2(_assertThisInitialized$1(e),"_logger",null),_defineProperty$2(_assertThisInitialized$1(e),"_vid",""),_defineProperty$2(_assertThisInitialized$1(e),"_onProcessMinLen",0),_defineProperty$2(_assertThisInitialized$1(e),"_onCancel",null),_defineProperty$2(_assertThisInitialized$1(e),"_priOptions",null),e}return _createClass$2(n,[{key:"load",value:function(e){var t,r=this,n=e.url,i=e.vid,o=e.timeout,a=e.responseType,s=e.onProgress,l=e.index,c=e.onTimeout,u=e.onCancel,h=e.range,d=e.transformResponse,p=e.request,f=e.params,g=e.logger,y=e.method,v=e.headers,m=e.body,_=e.mode,b=e.credentials,T=e.cache,E=e.redirect,S=e.referrer,$=e.referrerPolicy,C=e.onProcessMinLen,w=e.priOptions;this._logger=g,this._aborted=!1,this._onProcessMinLen=C,this._onCancel=u,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=l,this._range=h||[0,0],this._vid=i||n,this._priOptions=w||{};var P={method:y,headers:v,body:m,mode:_,credentials:b,cache:T,redirect:E,referrer:S,referrerPolicy:$,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},k=!1;clearTimeout(this._timeoutTimer),n=setUrlParams(n,f);var O=getRangeValue(h);O&&(v=p?p.headers:P.headers=P.headers||(Headers?new Headers:{}),Headers&&v instanceof Headers?v.append("Range",O):v.Range=O),o&&(this._timeoutTimer=setTimeout((function(){if(k=!0,r.cancel(),c){var e=new NetError(n,P,null,"timeout");e.isTimeout=!0,c(e,{index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions})}}),o));var I=Date.now();return this._logger.debug("[fetch load start], index,",l,",range,",h),new Promise((function(e,t){fetch(p||n,p?void 0:P).then(function(){var i=_asyncToGenerator$1(_regeneratorRuntime().mark((function i(o){var c,u,p,f;return _regeneratorRuntime().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(r._timeoutTimer),r._response=o,!r._aborted&&r._running){i.next=4;break}return i.abrupt("return");case 4:if(d&&(o=d(o,n)||o),o.ok){i.next=7;break}throw new NetError(n,P,o,"bad network response");case 7:if(c=Date.now(),a!==ResponseType.TEXT){i.next=15;break}return i.next=11,o.text();case 11:u=i.sent,r._running=!1,i.next=37;break;case 15:if(a!==ResponseType.JSON){i.next=22;break}return i.next=18,o.json();case 18:u=i.sent,r._running=!1,i.next=37;break;case 22:if(!s){i.next=29;break}return r.resolve=e,r.reject=t,r._loadChunk(o,s,I,c),i.abrupt("return");case 29:return i.next=31,o.arrayBuffer();case 31:u=i.sent,u=new Uint8Array(u),r._running=!1,p=Date.now()-I,f=calculateSpeed(u.byteLength,p),r.emit(EVENT.REAL_TIME_SPEED,{speed:f,len:u.byteLength,time:p,vid:r._vid,index:r._index,range:r._range,priOptions:r._priOptions});case 37:r._logger.debug("[fetch load end], index,",l,",range,",h),e(createResponse(u,!0,o,o.headers.get("Content-Length"),o.headers.get("age"),I,c,l,h,r._vid,r._priOptions));case 39:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}()).catch((function(e){var i;clearTimeout(r._timeoutTimer),r._running=!1,r._aborted&&!k||((e=e instanceof NetError?e:new NetError(n,P,null,null===(i=e)||void 0===i?void 0:i.message)).startTime=I,e.endTime=Date.now(),e.isTimeout=k,e.options={index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions},t(e))}))}))}},{key:"cancel",value:(t=_asyncToGenerator$1(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().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(error){}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,r,n){var i=this;if(!e.body||!e.body.getReader){this._running=!1;var o=new NetError(e.url,"",e,"onProgress of bad response.body.getReader");return o.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(o)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(CACHESIZE),this._writeIdx=0);var a,s,l,c=this._reader=e.body.getReader(),u=function(){var o=_asyncToGenerator$1(_regeneratorRuntime().mark((function o(){var h,d,p,f,g,y,v,m;return _regeneratorRuntime().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return s=Date.now(),o.prev=1,o.next=4,c.read();case 4:a=o.sent,l=Date.now(),o.next=13;break;case 8:return o.prev=8,o.t0=o.catch(1),l=Date.now(),i._aborted||(i._running=!1,o.t0.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i.reject(o.t0)),o.abrupt("return");case 13:if(d=(null===(h=i._range)||void 0===h?void 0:h.length)>0?i._range[0]:0,p=d+i._receivedLength,!i._aborted){o.next=19;break}return i._running=!1,t(void 0,!1,{range:[p,p],vid:i._vid,index:i._index,startTime:s,endTime:l,st:r,firstByteTime:n,priOptions:i._priOptions},e),o.abrupt("return");case 19:f=a.value?a.value.byteLength:0,i._receivedLength+=f,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",p,", end,",d+i._receivedLength,", done,",a.done),i._onProcessMinLen>0?i._writeIdx+f>=i._onProcessMinLen||a.done?((g=new Uint8Array(i._writeIdx+f)).set(i._cache.slice(0,i._writeIdx),0),f>0&&g.set(a.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",a.done,",len,",g.byteLength,", writeIdx,",i._writeIdx)):f>0&&i._writeIdx+f<CACHESIZE?(i._cache.set(a.value,i._writeIdx),i._writeIdx+=f,i._logger.debug("【fetchLoader,onProgress cache】,len,",f,", writeIdx,",i._writeIdx)):f>0&&(y=new Uint8Array(i._writeIdx+f+2048),i._logger.debug("【fetchLoader,onProgress extra start】,size,",i._writeIdx+f+2048,", datalen,",f,", writeIdx,",i._writeIdx),y.set(i._cache.slice(0,i._writeIdx),0),f>0&&y.set(a.value,i._writeIdx),i._writeIdx+=f,delete i._cache,i._cache=y,i._logger.debug("【fetchLoader,onProgress extra end】,len,",f,", writeIdx,",i._writeIdx)):g=a.value,(g&&g.byteLength>0||a.done)&&t(g,a.done,{range:[i._range[0]+i._receivedLength-(g?g.byteLength:0),i._range[0]+i._receivedLength],vid:i._vid,index:i._index,startTime:s,endTime:l,st:r,firstByteTime:n,priOptions:i._priOptions},e),a.done?(v=Date.now()-r,m=calculateSpeed(i._receivedLength,v),i.emit(EVENT.REAL_TIME_SPEED,{speed:m,len:i._receivedLength,time:v,vid:i._vid,index:i._index,range:i._range,priOptions:i._priOptions}),i._running=!1,i._logger.debug("[fetchLoader onProgress end],task,",i._range,",done,",a.done),i.resolve(createResponse(a,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),r,n,i._index,i._range,i._vid,i._priOptions))):u();case 25:case"end":return o.stop()}}),o,null,[[1,8]])})));return function(){return o.apply(this,arguments)}}();u()}},{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)}}]),n}(EventEmitter);function getConfig(e){return _objectSpread2$1({loaderType:LoaderType.FETCH,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:ResponseType.TEXT,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)}var XhrLoader=function(e){_inherits$1(r,e);var t=_createSuper$1(r);function r(){var e;return _classCallCheck$1(this,r),_defineProperty$2(_assertThisInitialized$1(e=t.call(this)),"_xhr",null),_defineProperty$2(_assertThisInitialized$1(e),"_aborted",!1),_defineProperty$2(_assertThisInitialized$1(e),"_timeoutTimer",null),_defineProperty$2(_assertThisInitialized$1(e),"_range",null),_defineProperty$2(_assertThisInitialized$1(e),"_receivedLength",0),_defineProperty$2(_assertThisInitialized$1(e),"_url",null),_defineProperty$2(_assertThisInitialized$1(e),"_onProgress",null),_defineProperty$2(_assertThisInitialized$1(e),"_index",-1),_defineProperty$2(_assertThisInitialized$1(e),"_headers",null),_defineProperty$2(_assertThisInitialized$1(e),"_currentChunkSizeKB",384),_defineProperty$2(_assertThisInitialized$1(e),"_timeout",null),_defineProperty$2(_assertThisInitialized$1(e),"_xhr",null),_defineProperty$2(_assertThisInitialized$1(e),"_withCredentials",null),_defineProperty$2(_assertThisInitialized$1(e),"_startTime",-1),_defineProperty$2(_assertThisInitialized$1(e),"_loadCompleteResolve",null),_defineProperty$2(_assertThisInitialized$1(e),"_loadCompleteReject",null),_defineProperty$2(_assertThisInitialized$1(e),"_runing",!1),_defineProperty$2(_assertThisInitialized$1(e),"_logger",!1),_defineProperty$2(_assertThisInitialized$1(e),"_vid",""),_defineProperty$2(_assertThisInitialized$1(e),"_responseType",void 0),_defineProperty$2(_assertThisInitialized$1(e),"_credentials",void 0),_defineProperty$2(_assertThisInitialized$1(e),"_method",void 0),_defineProperty$2(_assertThisInitialized$1(e),"_transformResponse",void 0),_defineProperty$2(_assertThisInitialized$1(e),"_firstRtt",void 0),_defineProperty$2(_assertThisInitialized$1(e),"_onCancel",null),_defineProperty$2(_assertThisInitialized$1(e),"_priOptions",null),e}return _createClass$2(r,[{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=setUrlParams(e.url,e.params);var r=Date.now();return new Promise((function(e,r){t._loadCompleteResolve=e,t._loadCompleteReject=r,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof NetError?e:new NetError(t._url,t._request)).startTime=r,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===ResponseType.ARRAY_BUFFER&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,r=this._range[0]+this._receivedLength,n=this._range[1];t<this._range[1]-r&&(n=r+t),e=[r,n],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 r=this._xhr=new XMLHttpRequest;r.open(this._method||"GET",this._url,!0),r.responseType=this._responseType,this._timeout&&(r.timeout=this._timeout),r.withCredentials=this._withCredentials,r.onload=this._onLoad.bind(this),r.onreadystatechange=this._onReadyStatechange.bind(this),r.onerror=function(e){var r,n,i;t._running=!1;var o=new NetError(t._url,t._request,null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.response,"xhr.onerror.status:"+(null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.status)+",statusText,"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.statusText));o.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(o)},r.ontimeout=function(e){t.cancel();var r=new NetError(t._url,t._request,{status:408},"timeout");t._onTimeout&&(r.isTimeout=!0,t._onTimeout(r,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),r.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(r)};var n=this._headers||{},i=getRangeValue(e);i&&(n.Range=i),n&&Object.keys(n).forEach((function(e){r.setRequestHeader(e,n[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),r.send(this._body)}catch(o){o.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(o)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t,r=e.target.status;if(r<200||r>299){var n=new NetError(this._url,null,_objectSpread2$1(_objectSpread2$1({},e.target.response),{},{status:r}),"bad response,status:"+r);return n.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(n)}var i,o=null,a=!1,s=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===ResponseType.ARRAY_BUFFER){var l,c=new Uint8Array(e.target.response);if(i=s+this._receivedLength,c&&c.byteLength>0){this._receivedLength+=c.byteLength;var u=Date.now()-this._startTime,h=calculateSpeed(this._receivedLength,u);this.emit(EVENT.REAL_TIME_SPEED,{speed:h,len:this._receivedLength,time:u,vid:this._vid,index:this._index,range:[i,s+this._receivedLength],priOptions:this._priOptions})}o=c,a=!((null===(l=this._range)||void 0===l?void 0:l.length)>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",i,"end ",s+this._receivedLength,",dataLen,",c?c.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",a)}else a=!0,o=e.target.response;var d={ok:r>=200&&r<300,status:r,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(d=this._transformResponse(d,this._url)||d),this._onProgress&&this._onProgress(o,a,{index:this._index,vid:this._vid,range:[i,s+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},d),a?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(createResponse(this._onProgress?null:o,a,d,d.headers["content-length"],d.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,_get(_getPrototypeOf$1(r.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,r={},n=_createForOfIteratorHelper(e.getAllResponseHeaders().trim().split("\r\n"));try{for(n.s();!(t=n.n()).done;){var i=t.value.split(": ");r[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(o){n.e(o)}finally{n.f()}return r}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),r}(EventEmitter),_excluded$1=["retry","retryDelay","onRetryError","transformError"],Task=function(){function e(t,r){_classCallCheck$1(this,e),this.promise=createPublicPromise(),this.alive=!!r.onProgress,!r.logger&&(r.logger=new Logger$1("Loader")),this._loaderType=t,this._loader=t===LoaderType.FETCH&&window.fetch?new FetchLoader:new XhrLoader,this._config=r,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=r.retryCheckFunc,this._logger=r.logger}var t;return _createClass$2(e,[{key:"exec",value:function(){var e=this,t=this._config,r=t.retry,n=t.retryDelay,i=t.onRetryError,o=t.transformError,a=_objectWithoutProperties(t,_excluded$1),s=function(){var t=_asyncToGenerator$1(_regeneratorRuntime().mark((function t(){var l,c,u;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(a);case 3:l=t.sent,e.promise.resolve(l),t.next=27;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,c=t.t0,o&&(c=o(c)||c),i&&e._retryCount>0&&i(c,e._retryCount,{index:a.index,vid:a.vid,range:a.range,priOptions:a.priOptions}),e._retryCount++,u=!0,e._retryCheckFunc&&(u=e._retryCheckFunc(t.t0)),!(u&&e._retryCount<=r)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",a.range),e._retryTimer=setTimeout(s,n),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=_asyncToGenerator$1(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().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 sleep(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var NetLoader=function(e){_inherits$1(n,e);var t,r=_createSuper$1(n);function n(e){var t;return _classCallCheck$1(this,n),_defineProperty$2(_assertThisInitialized$1(t=r.call(this,e)),"type",LoaderType.FETCH),_defineProperty$2(_assertThisInitialized$1(t),"_queue",[]),_defineProperty$2(_assertThisInitialized$1(t),"_alive",[]),_defineProperty$2(_assertThisInitialized$1(t),"_currentTask",null),_defineProperty$2(_assertThisInitialized$1(t),"_config",void 0),t._config=getConfig(e),t._config.loaderType!==LoaderType.XHR&&FetchLoader.isSupported()||(t.type=LoaderType.XHR),t.log=e.logger,t}return _createClass$2(n,[{key:"isFetch",value:function(){return this.type===LoaderType.FETCH}},{key:"load",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?r=e:r.url=e||r.url||this._config.url,(r=Object.assign({},this._config,r)).params&&(r.params=Object.assign({},r.params)),r.headers&&isPlainObject(r.headers)&&(r.headers=Object.assign({},r.headers)),r.body&&isPlainObject(r.body)&&(r.body=Object.assign({},r.body)),r.transformRequest&&(r=r.transformRequest(r)||r),r.logger=this.log;var n=new Task(this.type,r);return n.loader.on(EVENT.REAL_TIME_SPEED,(function(e){t.emit(EVENT.REAL_TIME_SPEED,e)})),this._queue.push(n),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),n.promise}},{key:"cancel",value:(t=_asyncToGenerator$1(_regeneratorRuntime().mark((function e(){var t;return _regeneratorRuntime().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,sleep();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,r;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(r=e._alive)||void 0===r?void 0:r.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return FetchLoader.isSupported()}}]),n}(EventEmitter),EXTEND_EVENTS={RTC_STATE_CHANGE:"core.rtcstatechange"},lib={},parser$1={},grammar$2={exports:{}},grammar$1=grammar$2.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(grammar$1).forEach((function(e){grammar$1[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},r=function(e,r,n){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:i?r[e.name]:r;!function(e,r,n,i){if(i&&!n)r[i]=t(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(r[n[o]]=t(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},n=grammar$2.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(n[t]||[]).length;s+=1){var l=n[t][s];if(l.reg.test(i))return r(l,a,i)}})),t.media=o,t};var o=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],n=e.split(" ").map(t),i=0;i<n.length;i+=3)r.push({component:n[i],ip:n[i+1],port:n[i+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var r,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}(parser$1);var grammar=grammar$2.exports,formatRegExp=/%[sdv%]/g,format=function(e){var t=1,r=arguments,n=r.length;return e.replace(formatRegExp,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},makeLine=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return format.apply(null,n)},defaultOuterOrder=["v","o","s","i","u","e","p","c","b","t","r","z","a"],defaultInnerOrder=["i","c","b","a"],writer$1=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 r=t.outerOrder||defaultOuterOrder,n=t.innerOrder||defaultInnerOrder,i=[];return r.forEach((function(t){grammar[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(makeLine(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(makeLine(t,r,e))}))}))})),e.media.forEach((function(e){i.push(makeLine("m",grammar.m[0],e)),n.forEach((function(t){grammar[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(makeLine(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(makeLine(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"},parser=parser$1,writer=writer$1;function getOption(e){return _objectSpread2$2({retryCount:0,retryDelay:1e3,loadTimeout:5e3,stallInterval:400,delayHint:0},e)}function _getStats(e){var t=[];return e.forEach((function(e){"inbound-rtp"===e.type&&t.push(e)})),t.map((function(t){var r=e.get(t.codecId),n=e.get(t.trackId);return{type:t.mediaType,inboundRtp:t,codec:r,track:n}}))}function getStats(e){return new Promise((function(t){var r;null===(r=e.getStats(null))||void 0===r||r.then((function(e){t(_getStats(e))}))})).catch((function(){}))}function getStatsSnapshoot(e){var t,r,n,i,o,a,s,l,c,u,h,d,p,f,g,y,v,m,_,b,T,E,S,$,C,w,P,k,O,I=null==e?void 0:e.filter((function(e){return"video"===e.type}))[0],A=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===(r=I.codec)||void 0===r?void 0:r.payloadType,sdpFmtpLine:null===(n=I.codec)||void 0===n?void 0:n.sdpFmtpLine,bytesReceived:null===(i=I.inboundRtp)||void 0===i?void 0:i.bytesReceived,firCount:null===(o=I.inboundRtp)||void 0===o?void 0:o.firCount,pliCount:null===(a=I.inboundRtp)||void 0===a?void 0:a.pliCount,frameHeight:null===(s=I.inboundRtp)||void 0===s?void 0:s.frameHeight,frameWidth:null===(l=I.inboundRtp)||void 0===l?void 0:l.frameWidth,framesDecoded:null===(c=I.inboundRtp)||void 0===c?void 0:c.framesDecoded,framesDropped:null===(u=I.inboundRtp)||void 0===u?void 0:u.framesDropped,framesPerSecond:null===(h=I.inboundRtp)||void 0===h?void 0:h.framesPerSecond,framesReceived:null===(d=I.inboundRtp)||void 0===d?void 0:d.framesReceived,jitter:null===(p=I.inboundRtp)||void 0===p?void 0:p.jitter,jitterBufferDelay:null===(f=I.inboundRtp)||void 0===f?void 0:f.jitterBufferDelay,keyFramesDecoded:null===(g=I.inboundRtp)||void 0===g?void 0:g.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===(m=I.inboundRtp)||void 0===m?void 0:m.packetsReceived}:void 0,audio:A?{codec:null===(_=A.codec)||void 0===_?void 0:_.mimeType,payloadType:null===(b=A.codec)||void 0===b?void 0:b.payloadType,sdpFmtpLine:null===(T=A.codec)||void 0===T?void 0:T.sdpFmtpLine,bytesReceived:null===(E=A.inboundRtp)||void 0===E?void 0:E.bytesReceived,audioLevel:null===(S=A.inboundRtp)||void 0===S?void 0:S.audioLevel,jitter:null===($=A.inboundRtp)||void 0===$?void 0:$.jitter,jitterBufferDelay:null===(C=A.inboundRtp)||void 0===C?void 0:C.jitterBufferDelay,packetsLost:null===(w=A.inboundRtp)||void 0===w?void 0:w.packetsLost,packetsReceived:null===(P=A.inboundRtp)||void 0===P?void 0:P.packetsReceived,totalSamplesDuration:null===(k=A.inboundRtp)||void 0===k?void 0:k.totalSamplesDuration,totalSamplesReceived:null===(O=A.inboundRtp)||void 0===O?void 0:O.totalSamplesReceived}:void 0}}lib.write=writer,lib.parse=parser.parse,lib.parseParams=parser.parseParams,lib.parseFmtpConfig=parser.parseFmtpConfig,lib.parsePayloads=parser.parsePayloads,lib.parseRemoteCandidates=parser.parseRemoteCandidates,lib.parseImageAttributes=parser.parseImageAttributes,lib.parseSimulcastStreamList=parser.parseSimulcastStreamList;var logger=new Logger$1("rts"),Rts=function(e){_inherits$2(i,e);var t,r,n=_createSuper$2(i);function i(e){var t;return _classCallCheck$2(this,i),_defineProperty$3(_assertThisInitialized$2(t=n.call(this)),"_url",""),_defineProperty$3(_assertThisInitialized$2(t),"_pc",null),_defineProperty$3(_assertThisInitialized$2(t),"_audioTransceicer",null),_defineProperty$3(_assertThisInitialized$2(t),"_videoTransceicer",null),_defineProperty$3(_assertThisInitialized$2(t),"_mediaStream",null),_defineProperty$3(_assertThisInitialized$2(t),"_media",null),_defineProperty$3(_assertThisInitialized$2(t),"_opts",null),_defineProperty$3(_assertThisInitialized$2(t),"_loader",null),_defineProperty$3(_assertThisInitialized$2(t),"_retry",0),_defineProperty$3(_assertThisInitialized$2(t),"_waitingTimer",0),_defineProperty$3(_assertThisInitialized$2(t),"_rctConnectStartTs",0),_defineProperty$3(_assertThisInitialized$2(t),"_onTrack",(function(e){if(logger.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 r=t._media.play();r&&r.catch&&r.catch((function(e){}))}t._mediaStream.addTrack(e.track)})),_defineProperty$3(_assertThisInitialized$2(t),"_mockWaitingByTimeupdate",(function(){var e,r;"connected"!==(null===(e=t._pc)||void 0===e?void 0:e.connectionState)&&"connected"!==(null===(r=t._pc)||void 0===r?void 0:r.iceConnectionState)||(clearTimeout(t._waitingTimer),t._waitingTimer=setTimeout((function(){t._media.paused||t.emit("waiting")}),t._opts.stallInterval))})),_defineProperty$3(_assertThisInitialized$2(t),"_onLoadedData",(function(){logger.log("loadeddata emit"),t.getStatsSnapshoot().then((function(e){t.emit(EVENT.METADATA_PARSED,{type:"video",elapsed:Date.now()-t._rctConnectStartTs,meta:e.video}),t.emit(EVENT.METADATA_PARSED,{type:"audio",elapsed:Date.now()-t._rctConnectStartTs,meta:e.audio})}))})),_defineProperty$3(_assertThisInitialized$2(t),"_onLoaderRetry",(function(e,r){t.emit(EVENT.LOAD_RETRY,{error:StreamingError.network(e),retryTime:r})})),t._opts=getOption(e),t._media=t._opts.media,t._loader=new NetLoader(_objectSpread2$2(_objectSpread2$2({},e.fetchOptions),{},{responseType:"json",method:"POST",retry:t._opts.retryCount,retryDelay:t._opts.retryDelay,timeout:t._opts.loadTimeout,onRetryError:t._onLoaderRetry})),t._retry=t._opts.retryCount,t._bindMediaEvent(),t}return _createClass$3(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 getStats(this._pc)}},{key:"getStatsSnapshoot",value:function(){return this.getStats().then((function(e){return getStatsSnapshoot(e)}))}},{key:"load",value:(r=_asyncToGenerator$2(_regeneratorRuntime$1().mark((function e(t){var r,n=this;return _regeneratorRuntime$1().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._disconnect(),this._url=t,this._retry=this._opts.retryCount,r=this._pc,e.prev=4,this._pc=new RTCPeerConnection,this._bindRTCEvents(),e.next=9,this._connect(t);case 9:r&&r.close(),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),setTimeout((function(){return n._emitError(StreamingError.create(ERR.OTHER,null,e.t0))}));case 15:case"end":return e.stop()}}),e,this,[[4,12]])}))),function(e){return r.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(logger.warn("onconnectionstatechange:",t.connectionState),e.emit(EXTEND_EVENTS.RTC_STATE_CHANGE,{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(StreamingError.network(new Error("rtc connect failed")));e._retry--,e.load(e._url)}"connected"===t.connectionState&&e.emit(EVENT.TTFB,{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=_asyncToGenerator$2(_regeneratorRuntime$1().mark((function e(){var t,r,n,i,o,a,s,l,c,u;return _regeneratorRuntime$1().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"}),(n=this._opts.delayHint)&&(this._audioTransceicer.receiver.playoutDelayHint=n,this._audioTransceicer.receiver.jitterBufferDelayHint=n,this._videoTransceicer.receiver.playoutDelayHint=n,this._videoTransceicer.receiver.jitterBufferDelayHint=n),e.next=8,t.createOffer();case 8:r=e.sent,e.next=14;break;case 11:return e.next=13,t.createOffer({iceRestart:!0,offerToReceiveAudio:!0,offerToReceiveVideo:!0});case 13:r=e.sent;case 14:return logger.log("local offer"),logger.log(r.sdp),(i=lib.parse(r.sdp)).media.filter((function(e){return"audio"===e.type})).forEach((function(e){var t,r=null===(t=e.rtp.filter((function(e){return"opus"===e.codec}))[0])||void 0===t?void 0:t.payload;r&&e.fmtp.forEach((function(e){e.payload===r&&(e.config="minptime=10;stereo=1;useinbandfec=1")}))})),r.sdp=lib.write(i),logger.log("local offer modified:\n",r.sdp),e.next=22,t.setLocalDescription(r);case 22:return e.prev=22,a=/_?session_id=([^&$]+)/.exec(this._url),s=a?a[1]:Date.now()+"",this.emit(EVENT.LOAD_START,{url:this._url}),this._rctConnectStartTs=Date.now(),e.next=29,this._loader.load(this._url,{body:JSON.stringify({sessionId:s,version:"1.0-html",localSdp:r})});case 29:if(l=e.sent,this.emit(EVENT.LOAD_RESPONSE_HEADERS,{headers:l.response.headers}),200===(null==(c=null==l?void 0:l.data)?void 0:c.code)){e.next=34;break}throw new Error("code: ".concat(null==c?void 0:c.code,", message:").concat(null==c?void 0:c.message));case 34:return logger.log("answer:"),logger.log(null===(o=c.remoteSdp)||void 0===o?void 0:o.sdp),(u=lib.parse(c.remoteSdp.sdp)).media.forEach((function(e){e.fingerprint.hash=e.fingerprint.hash.toUpperCase()})),c.remoteSdp.sdp=lib.write(u),logger.log("answer modified:\n",c.remoteSdp.sdp),e.next=42,this._pc.setRemoteDescription(c.remoteSdp);case 42:e.next=47;break;case 44:e.prev=44,e.t0=e.catch(22),this._emitError(StreamingError.network(e.t0));case 47:case"end":return e.stop()}}),e,this,[[22,44]])}))),function(){return t.apply(this,arguments)})},{key:"_disconnect",value:function(){this._audioTransceicer=null,this._videoTransceicer=null,this._mediaStream=null}},{key:"_emitError",value:function(e){this.emit(EVENT.ERROR,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._loader=null,this._media=null}}],[{key:"enableLogger",value:function(){Logger$1.enable()}},{key:"disableLogger",value:function(){Logger$1.disable()}}]),i}(EventEmitter);try{localStorage.getItem("xgd")?Rts.enableLogger():Rts.disableLogger()}catch(error){}function isSupported(){return!(!window.RTCPeerConnection||!window.RTCPeerConnection.prototype.addTransceiver)}function getCapacity(){if(!isSupported())return Promise.reject("RTCPeerConnection no support");var e;try{(e=new RTCPeerConnection({sdpSemantics:"unified-plan"})).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 r,n,i,o,a=lib.parse(t.sdp),s=null===(r=a.media)||void 0===r?void 0:r.filter((function(e){return"video"===e.type}))[0],l=null===(n=a.media)||void 0===n?void 0:n.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})),u=null==l||null===(o=l.rtp)||void 0===o?void 0:o.filter((function(e){return"opus"===e.codec})),h=null==s?void 0:s.fmtp,d=null==l?void 0:l.fmtp;return h&&c.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})),d&&u.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})),e.close(),{video:c,audio:u}}))}var RtsPlugin=function(e){_inherits$2(r,e);var t=_createSuper$2(r);function r(){var e;_classCallCheck$2(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return _defineProperty$3(_assertThisInitialized$2(e=t.call.apply(t,[this].concat(i))),"_rts",null),_defineProperty$3(_assertThisInitialized$2(e),"_rtsOpts",null),_defineProperty$3(_assertThisInitialized$2(e),"_init",(function(){var t;null===(t=e._rts)||void 0===t||t.destroy();var r=e.player.config,n=r.rts||{};e._rtsOpts=n,e._rts=new Rts(_objectSpread2$2({media:e.player.video},n)),e._rts.load(r.url)})),_defineProperty$3(_assertThisInitialized$2(e),"_onSwitchURL",(function(t){e._rts&&(e.player.config.url=t,e._rts.switchURL(t))})),e}return _createClass$3(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.1.11"}},{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(URL_CHANGE,this._onSwitchURL),this.on(DESTROY,this.destroy),this._transErrorEvent(),this._transCoreEvent(EVENT.LOAD_START),this._transCoreEvent(EVENT.TTFB),this._transCoreEvent(EVENT.LOAD_RESPONSE_HEADERS),this._transCoreEvent(EVENT.LOAD_RETRY),this._transCoreEvent(EVENT.METADATA_PARSED),this._transCoreEvent(EXTEND_EVENTS.RTC_STATE_CHANGE);try{BasePlugin.defineGetterOrSetter(this.player,{__url:{get:function(){try{return URL.createObjectURL(new MediaSource)}catch(n){var e,r;null!==(e=t.player)&&void 0!==e&&null!==(r=e.video)&&void 0!==r&&r.srcObject||(t.player.video.srcObject=new MediaStream)}}}})}catch(r){}}},{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(EVENT.ERROR,(function(t){if(e.player){var r=new Errors(e.player,t),n=e._rtsOpts,i=n.backupConstruct,o=n.backupURL;if(o){var a,s=e.player;s.emit("core_event",_objectSpread2$2(_objectSpread2$2({},{url:s.config.url,code:r.errorCode,message:r.message,httpCode:r.httpCode}),{},{eventName:"core.degrade"})),s.emit("degrade",{url:s.config.url,code:r.errorCode,message:r.message,httpCode:r.httpCode}),s.unRegisterPlugin("rts"),e._rts=null,s.rts=null,null!==(a=s.video)&&void 0!==a&&a.srcObject&&(s.video.srcObject=null),s.config.url=o,i?s.registerPlugin(i).beforePlayerInit():s.video.src=o}else e.player.emit(ERROR$3,r)}})),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(r){t.player&&t.player.emit("core_event",_objectSpread2$2(_objectSpread2$2({},r),{},{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 isSupported()}},{key:"getCapacity",value:function(){return getCapacity()}}]),r}(BasePlugin);function apply$2(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var nativeMax$1=Math.max;function overRest(e,t,r){return t=nativeMax$1(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=nativeMax$1(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),apply$2(e,this,s)}}function constant(e){return function(){return e}}var baseSetToString=defineProperty$f?function(e,t){return defineProperty$f(e,"toString",{configurable:!0,enumerable:!1,value:constant(t),writable:!0})}:identity,baseSetToString$1=baseSetToString,HOT_COUNT=800,HOT_SPAN=16,nativeNow=Date.now;function shortOut(e){var t=0,r=0;return function(){var n=nativeNow(),i=HOT_SPAN-(n-r);if(r=n,i>0){if(++t>=HOT_COUNT)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var setToString=shortOut(baseSetToString$1),setToString$1=setToString;function baseRest(e,t){return setToString$1(overRest(e,t,identity),e+"")}function isIterateeCall(e,t,r){if(!isObject$o(r))return!1;var n=_typeof$4(t);return!!("number"==n?isArrayLike(r)&&isIndex(t,r.length):"string"==n&&t in r)&&eq(r[t],e)}function createAssigner(e){return baseRest((function(t,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,a&&isIterateeCall(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++n<i;){var s=r[n];s&&e(t,s,n,o)}return t}))}var objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,assign$1=createAssigner((function(e,t){if(isPrototype(t)||isArrayLike(t))copyObject(t,keys$4(t),e);else for(var r in t)hasOwnProperty.call(t,r)&&assignValue(e,r,t[r])})),assign$2=assign$1,RtmPlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(){return _classCallCheck$5(this,r),t.apply(this,arguments)}return _createClass$6(r,[{key:"beforeCreate",value:function(e){var t=(e.player.config.rtm||{}).backupStreamType,r={flv:window.FlvPlayer,hls:window.HlsPlayer};e.player.config.rts=assign$2({},e.player.config.rtm,{backupConstruct:r[t]})}},{key:"afterCreate",value:function(){var e=this.player;e.on("degrade",(function(){e.unRegisterPlugin("rtm")}))}}],[{key:"pluginName",get:function(){return"rtm"}}]),r}(RtsPlugin),SDKEvents=function(e){return e.PLAYER_CREATED_FINISH="player_create_finish",e.PLAYER_REBUILD="player_rebuild",e.NOT_SUPPORT_HARDWARE_DECODER="not_support_hardware_decoder",e.NOT_SUPPORT_SOFT_DECODER="not_support_soft_decoder",e.TOKEN_EXPIRED="playAuthToken_expired",e.UMD_LOAD_FAIL="umd_load_fail",e}(SDKEvents||{}),PluginEvents=function(e){return e.DANMU_CHANGE="danmu_change",e.TIME_SHIFT_CHANGE="time_shift_change",e.AI_SUBTITLE_LANG_CHANGE="ai_subtitle_lang_change",e.AI_SUBTITLE_MATCH="ai_subtitle_match",e.CANCEL_UNMUTE="cancel_unmute",e.REFRESH_CLICK="refresh_click",e.PLAY_BACKUP_CHANGE="play_backup_change",e.PLAY_BACKUP_CHANGE_FINISH="play_backup_change_finish",e.PLAY_ERROR_BUTTON_CLICK="play_error_button_click",e.PlAY_URL_CHANGE="play_url_change",e.SHOW_PLAY_ERROR="show_play_error",e.PLAYER_EXTEND_BUTTON="player_extend_button",e.LONG_WAITING="long_waiting",e.OFTEN_WAITING="often_waiting",e.DEFINITION_DEMOTE="definition_demote",e.LARKWINDOW_CHANGE="larkWindow_change",e.PANEL_MODE_CHANGE="panel_mode_change",e.INNER_DEFINITION_CHANGE="inner_definition_change",e.LINE_CHANGE="line_change",e.GET_PLAY_URL_ERR="get_play_url_err",e.MEDIA_EXPIRED="MEDIA_EXPIRED",e.MIRROR_CHANGE="mirror_change",e.TIME_SCALE_CHANGE="time_scale_change",e.MUSIC_MODE_CHANGE="music_mode_change",e.MUSIC_CHANGE="music_change",e.MUSIC_LIST_CHANGE="music_list_change",e}(PluginEvents||{}),Event$2=Object.freeze(Object.defineProperty({__proto__:null,SDKEvents:SDKEvents,PluginEvents:PluginEvents},Symbol.toStringTag,{value:"Module"})),CONTROL_ICON_INDEX={sdkDefinitionPlugin:3,DanmuPlugin:3,sdkMultilinePlugin:4,mirrorPlugin:5,Subtitle:6},MultilinePlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),(n=t.call(this,e)).playerData=null,n.playerData=n.playerConfig.playerData,n}return _createClass$6(r,[{key:"beforeCreate",value:function(e){var t=e.player.config.playerData,r=t.getLineList(),n=t.current.lineId;Array.isArray(r)&&r.length>0&&(e.config.list=r.map((function(t){return t.text=e.player.i18n[t.lineTextKey]||t.lineTextKey,t}))),e.config.defaultLine=n}},{key:"afterCreate",value:function(){_get$3(_getPrototypeOf$5(r.prototype),"afterCreate",this).call(this),this.config.list.length<2&&this.hide()}},{key:"afterPlayerInit",value:function(){}},{key:"renderItemList",value:function(){var e=this,t=this.config,n=t.list,i=t.defaultLine,o=0,a=n.map((function(t,r){var n,a={lineId:t.lineId||"",showText:e.i18n[t.lineTextKey]||t.lineTextKey,isCurrent:!1,selected:!1};return util.isUndefined(t.lineId)||(null===(n=t.lineId)||void 0===n?void 0:n.toString())!==(null==i?void 0:i.toString())||(a.isCurrent=!0,a.selected=!0,o=r),a}));_get$3(_getPrototypeOf$5(r.prototype),"renderItemList",this).call(this,a,o)}},{key:"onItemClick",value:function(e,t){this.player.emit(PluginEvents.LINE_CHANGE,{from:this.playerData.current.lineId,to:t.to.lineId}),this.playerData.current.lineId=t.to.lineId,this.player.emit(SDKEvents.PLAYER_REBUILD)}}],[{key:"pluginName",get:function(){return"sdkMultilinePlugin"}},{key:"defaultConfig",get:function(){return{position:Plugin.POSITIONS.CONTROLS_RIGHT,index:CONTROL_ICON_INDEX.sdkMultilinePlugin,list:[],defaultLine:0,className:"xgplayer-multiline",hidePortrait:!1,isShowIcon:!0}}}]),r}(OptionsIcon),DefinitionPlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),(n=t.call(this,e)).playerData=null,n.toastInfo={},n.canChange=!0,n.playerData=n.playerConfig.playerData,n.dataMonitoring(),n}return _createClass$6(r,[{key:"registerLanguageTexts",value:function(){return{switching:{jp:"に切り替える",en:"Switching to",zh:"正在切换至","zh-hk":"正在切換至"}}}},{key:"beforeCreate",value:function(e){this.toastInfo={},this.canChange=!0;var t=this.getConfig(e.player),r=t.defaultDefinition,n=t.list;e.config.defaultDefinition=r,e.config.list=n}},{key:"getConfig",value:function(e){var t=this,r={list:[],defaultDefinition:""},n=e.config.playerData;this.toastInfo={},this.canChange=!0;var i=n.current,o=i.lineId,a=i.definition,s=n.getDefinitionListByLineId(o);return Array.isArray(s)&&s.length>0&&(r.list=s.map((function(r){return r.text||(r.text=t.getShowText(e.i18n,r)),r}))),r.defaultDefinition=a,r}},{key:"dataMonitoring",value:function(){var e=this;MyProxy$1.subscribeProperty(this.playerData.current,"definition",(function(t,r){if(e.canChange&&t!==r&&e.player){var n=e.config.list,i=(void 0===n?[]:n).find((function(e){return e.definition===r}));i&&i.url&&(e.player.changeDefinition(_objectSpread2$5(_objectSpread2$5({},i),{},{definition:r,url:i.url})),e.player.emit(PluginEvents.INNER_DEFINITION_CHANGE,{from:t,to:r,url:i.url}),e.player.emit(PluginEvents.PlAY_URL_CHANGE,{url:i.url,from:PluginEvents.INNER_DEFINITION_CHANGE}),e.renderItemList(r),setTimeout((function(){e.player.ended?e.player.replay():e.player.paused&&e.player.play()}),1e3))}}))}},{key:"showToast",value:function(e){var t,r=this,n=null===(t=this.player)||void 0===t?void 0:t.getPlugin("sdkToastPlugin");if(n){var i=e.showText,o=n.add("".concat(this.langText.switching).concat(i,"..."),0,!0);this.toastInfo[o]={showTime:Date.now(),delayClose:!1},setTimeout((function(){var e;null!==(e=r.toastInfo[o])&&void 0!==e&&e.delayClose&&(n.remove(o),r.toastInfo[o].delayClose=!1)}),2e3),this.player.once(AFTER_DEFINITION_CHANGE,(function(){var e;Date.now()-(null===(e=r.toastInfo[o])||void 0===e?void 0:e.showTime)>2e3?n.remove(o):r.toastInfo[o].delayClose=!0}))}}},{key:"afterCreate",value:function(){_get$3(_getPrototypeOf$5(r.prototype),"afterCreate",this).call(this),this.config.list&&this.config.list.length>0&&(this.config.list.length<2?this.hide():(this.renderItemList(this.config.list),this.show()))}},{key:"afterPlayerInit",value:function(){}},{key:"getShowText",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return e[t.definitionTextKey]||t.definitionTextKey||t.definition}},{key:"renderItemList",value:function(e){var t=this,n=this.config,i=n.list,o=n.defaultDefinition,a=0,s=i.map((function(r,n){var i={url:r.url,definition:r.definition||"",showText:t.getShowText(t.i18n,r),isCurrent:!1,selected:!1},s="string"==typeof e?r.definition===e:r.definition===o;return!util.isUndefined(r.definition)&&s&&(i.isCurrent=!0,i.selected=!0,a=n),i}));_get$3(_getPrototypeOf$5(r.prototype),"renderItemList",this).call(this,s,a)}},{key:"onItemClick",value:function(e,t){this.showToast(t.to),this.playerData.current.definition=t.to.definition}}],[{key:"pluginName",get:function(){return"sdkDefinitionPlugin"}},{key:"defaultConfig",get:function(){return{position:Plugin.POSITIONS.CONTROLS_RIGHT,index:CONTROL_ICON_INDEX.sdkDefinitionPlugin,list:[],defaultDefinition:"",hidePortrait:!1,className:"xgplayer-definition",isShowIcon:!0}}}]),r}(OptionsIcon),UnmutePlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),(n=t.call(this,e)).state={isSupportAutoplay:!0,showUnmuteBt:!1},n}return _createClass$6(r,[{key:"beforePlayerInit",value:function(){}},{key:"afterPlayerInit",value:function(){}},{key:"afterCreate",value:function(){this.player.autoplay&&this.player.config.autoplayMuted&&this.initEvents()}},{key:"registerLanguageTexts",value:function(){return{unmute:{jp:"ミュートを解除する",en:"Click to unmute",zh:"点击取消静音","zh-hk":"點擊取消靜音"}}}},{key:"updateLang",value:function(){this.renderUnmuteBt()}},{key:"initEvents",value:function(){this.player.once("autoplay_was_prevented",this.handleAutoplayPrevented.bind(this)),this.player.once("autoplay_started",this.handleAutoplayStart.bind(this)),this.player.once("volumechange",this.handleVolumechange.bind(this))}},{key:"handleAutoplayPrevented",value:function(){console.warn("静音自动启播失败"),this.state.isSupportAutoplay=!1,this.player.muted=!1}},{key:"handleAutoplayStart",value:function(){this.state.isSupportAutoplay?(this.state.showUnmuteBt=!0,this.renderUnmuteBt()):this.player.muted=!1}},{key:"handleVolumechange",value:function(){this.state.showUnmuteBt=!1,this.renderUnmuteBt(),this.player.paused&&this.player.readyState>=1&&this.player.play()}},{key:"renderUnmuteBt",value:function(){var e=this.root;if(e&&(e.innerHTML="",this.state.showUnmuteBt)){var t=this.langText.unmute,r=util.createDom("div",t,void 0,"xgplayer-unmute-bt");e.appendChild(r),this.bind(".xgplayer-unmute-bt","click",this.cancelUnmute.bind(this))}}},{key:"cancelUnmute",value:function(){this.player.muted=!1,this.state.showUnmuteBt=!1,this.renderUnmuteBt(),this.player.emit(PluginEvents.CANCEL_UNMUTE)}},{key:"destroy",value:function(){this.player.off("autoplay_was_prevented",this.handleAutoplayPrevented.bind(this)),this.player.off("autoplay_started",this.handleAutoplayStart.bind(this)),this.player.off("volumechange",this.handleVolumechange.bind(this))}},{key:"render",value:function(){return'<div class="xgplayer-unmute"></div>'}}],[{key:"pluginName",get:function(){return"sdkUnmutePlugin"}},{key:"defaultConfig",get:function(){return{position:Plugin.POSITIONS.ROOT}}}]),r}(Plugin);function refreshSVG$1(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M10 2.488a7.48 7.48 0 00-4.154 1.253.908.908 0 101.005 1.512 5.695 5.695 0 018.844 4.746h-.908a.33.33 0 00-.264.528l1.816 2.422a.33.33 0 00.529 0l1.815-2.422A.33.33 0 0018.42 10h-.908A7.511 7.511 0 0010 2.49zM2.489 10a7.511 7.511 0 0011.665 6.26.908.908 0 00-1.005-1.513A5.695 5.695 0 014.305 10h.908a.33.33 0 00.264-.528L3.66 7.05a.33.33 0 00-.528 0L1.317 9.47a.33.33 0 00.264.53h.908z" fill="#fff"/></svg>',"image/svg+xml").firstChild}var now=function(){return root$1.Date.now()},now$1=now,reWhitespace=/\s/;function trimmedEndIndex(e){for(var t=e.length;t--&&reWhitespace.test(e.charAt(t)););return t}var reTrimStart=/^\s+/;function baseTrim(e){return e?e.slice(0,trimmedEndIndex(e)+1).replace(reTrimStart,""):e}var NAN=NaN,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt;function toNumber(e){if("number"==typeof e)return e;if(isSymbol$7(e))return NAN;if(isObject$o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=isObject$o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=baseTrim(e);var r=reIsBinary.test(e);return r||reIsOctal.test(e)?freeParseInt(e.slice(2),r?2:8):reIsBadHex.test(e)?NAN:+e}var FUNC_ERROR_TEXT$1="Expected a function",nativeMax=Math.max,nativeMin=Math.min;function debounce$1(e,t,r){var n,i,o,a,s,l,c=0,u=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT$1);function p(t){var r=n,o=i;return n=i=void 0,c=t,a=e.apply(o,r)}function f(e){return c=e,s=setTimeout(y,t),u?p(e):a}function g(e){var r=e-l;return void 0===l||r>=t||r<0||h&&e-c>=o}function y(){var e=now$1();if(g(e))return v(e);s=setTimeout(y,function(e){var r=t-(e-l);return h?nativeMin(r,o-(e-c)):r}(e))}function v(e){return s=void 0,d&&n?p(e):(n=i=void 0,a)}function m(){var e=now$1(),r=g(e);if(n=arguments,i=this,l=e,r){if(void 0===s)return f(l);if(h)return clearTimeout(s),s=setTimeout(y,t),p(l)}return void 0===s&&(s=setTimeout(y,t)),a}return t=toNumber(t)||0,isObject$o(r)&&(u=!!r.leading,o=(h="maxWait"in r)?nativeMax(toNumber(r.maxWait)||0,t):o,d="trailing"in r?!!r.trailing:d),m.cancel=function(){void 0!==s&&clearTimeout(s),c=0,n=l=i=s=void 0},m.flush=function(){return void 0===s?a:v(now$1())},m}var POSITIONS$9=Plugin.POSITIONS,RefreshPlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(){return _classCallCheck$5(this,r),t.apply(this,arguments)}return _createClass$6(r,[{key:"afterCreate",value:function(){this.appendChild(".xgplayer-icon",this.icons.refresh),this.initEvents()}},{key:"registerIcons",value:function(){return{refresh:{icon:refreshSVG$1,class:"xgplayer-refresh-svg"}}}},{key:"registerLanguageTexts",value:function(){return{refresh:{jp:"リフレッシュ",en:"Refresh",zh:"刷新","zh-hk":"刷新"}}}},{key:"initEvents",value:function(){this.handleRefresh=debounce$1(this.handleRefresh.bind(this),200);var e="mobile"===sniffer$1.device?"touchend":"click";this.bind(e,this.handleRefresh),this.show()}},{key:"handleRefresh",value:function(e){var t=this.player;t&&(e.preventDefault(),e.stopPropagation(),t.addClass("xgplayer-is-enter"),t.pause(),t.emit(PluginEvents.REFRESH_CLICK),setTimeout((function(){t&&t.retry(),t.once("canplay",(function(){t.removeClass("xgplayer-is-enter")}))})))}},{key:"destroy",value:function(){this.unbind(["touchend","click"],this.handleRefresh)}},{key:"render",value:function(){return'\n <xg-icon class="xgplayer-refresh">\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="refresh">'.concat(this.langText.refresh,"</div>\n </xg-icon>\n ")}}],[{key:"pluginName",get:function(){return"refresh"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$9.CONTROLS_LEFT,index:1}}}]),r}(Plugin);function MoreIconSVG(){return(new DOMParser).parseFromString('<svg width="18" height="18" viewBox="0 0 23 22" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M5.75 11C5.75 11.9665 4.9665 12.75 4 12.75C3.0335 12.75 2.25 11.9665 2.25 11C2.25 10.0335 3.0335 9.25 4 9.25C4.9665 9.25 5.75 10.0335 5.75 11ZM13.25 11C13.25 11.9665 12.4665 12.75 11.5 12.75C10.5335 12.75 9.75 11.9665 9.75 11C9.75 10.0335 10.5335 9.25 11.5 9.25C12.4665 9.25 13.25 10.0335 13.25 11ZM19 12.75C19.9665 12.75 20.75 11.9665 20.75 11C20.75 10.0335 19.9665 9.25 19 9.25C18.0335 9.25 17.25 10.0335 17.25 11C17.25 11.9665 18.0335 12.75 19 12.75Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}var MoreButtonPlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),(n=t.call(this,e)).panel=null,n.panelContainer=null,n}return _createClass$6(r,[{key:"beforePlayerInit",value:function(){}},{key:"afterPlayerInit",value:function(){}},{key:"afterCreate",value:function(){this.renderMoreIcon()}},{key:"updateLang",value:function(e){if(this.panelContainer){var t=this.panelContainer.querySelectorAll(".panel-icon-bt-text"),r=this.getAndSplitList().extraList;t.forEach((function(t){var n,i,o=Number(t.getAttribute("plugin-index"));null!==(n=r[o])&&void 0!==n&&null!==(i=n.textTips)&&void 0!==i&&i[e]&&(t.innerHTML=r[o].textTips[e])}))}}},{key:"registerIcons",value:function(){return{more:{icon:MoreIconSVG,class:"xgplayer-more-svg"}}}},{key:"getAndSplitList",value:function(){var e,t,r,n,i,o=(null!==(e=this.player.config.ignores)&&void 0!==e?e:[]).map((function(e){return e.toLowerCase()})),a=this.config.iconPlugins.filter((function(e){return!o.includes(e.pluginName.toLowerCase())}));return a.length>this.config.maxShowNum+1?(n=a.slice(0,this.config.maxShowNum),i=a.slice(-(a.length-this.config.maxShowNum))):n=_toConsumableArray$1(a),{list:null!==(t=n)&&void 0!==t?t:[],extraList:null!==(r=i)&&void 0!==r?r:[]}}},{key:"children",value:function(){var e=this,t=this.getAndSplitList().list,r={};return t.forEach((function(t){r[t.pluginName]={plugin:t,options:{root:e.root}}})),r}},{key:"renderMoreIcon",value:function(){var e=this,t=this.getAndSplitList().extraList;if(0!==t.length){var r=this.root,n=util.createDom("div","",{},"xgplayer-icon");n.appendChild(this.icons.more),n.addEventListener("click",(function(){e.renderPanel(t)}));var i=util.createDom("xg-icon","",{"data-index":0},"xgplayer-more");i.appendChild(n),r.appendChild(i)}}},{key:"renderPanel",value:function(e){var t=this;this.panelContainer||(this.panelContainer=util.createDom("div","",{},"panel-content"),e.forEach((function(e,r){var n,i,o=util.createDom("div","",{},"panel-icon-bt"),a=util.createDom("div","",{},"panel-icon-svg");o.appendChild(a),t.registerExtraPlugin(e,a);var s="zh-cn"===t.player.lang?"zh":t.player.lang,l=null!==(n=null===(i=e.textTips)||void 0===i?void 0:i[s])&&void 0!==n?n:e.pluginName;o.appendChild(util.createDom("span",l,{"plugin-index":r},"panel-icon-bt-text")),t.panelContainer.appendChild(o)}))),this.player.panel.showPanel(this.panelContainer)}},{key:"registerExtraPlugin",value:function(e,t){this.player.registerPlugin({plugin:e,options:{root:t}})}},{key:"destroy",value:function(){}},{key:"render",value:function(){return'<div class="xgplayer-rightTop-iconList"></div>'}}],[{key:"pluginName",get:function(){return"MoreButtonPlugin"}},{key:"defaultConfig",get:function(){return{position:Plugin.POSITIONS.ROOT_TOP,iconPlugins:[],maxShowNum:2}}}]),r}(Plugin);function ErrorImg(){return(new DOMParser).parseFromString('<svg width="150" height="162" viewBox="0 0 150 162" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M127.718 112.831H6.13675C4.19663 112.831 2.25651 108.974 2.90322 104.475C3.54993 99.9761 8.07687 99.9761 13.8972 99.9761C11.9571 97.4052 9.37028 88.4069 15.8373 81.3369C22.3044 74.2668 25.5379 74.2668 34.5918 75.5526C33.9451 63.9837 47.526 34.4178 77.2744 35.0605C107.023 35.7032 116.077 54.3421 119.957 63.3404C129.011 62.6976 147.765 66.554 149.706 87.1214C151.258 103.575 135.694 111.117 127.718 112.831Z" fill="#F1F4F8"/>\n<path d="M44.9346 91.6022L43.6782 99.8032" stroke="#D0D6E0" stroke-width="2" stroke-linecap="round"/>\n<path d="M47.3545 125.695L48.6109 117.494" stroke="#D0D6E0" stroke-width="2" stroke-linecap="round"/>\n<path d="M31.5347 97.7378L38.7295 101.869" stroke="#D0D6E0" stroke-width="2" stroke-linecap="round"/>\n<path d="M60.7544 119.559L53.5595 115.428" stroke="#D0D6E0" stroke-width="2" stroke-linecap="round"/>\n<path d="M69.6755 44.5318L138.35 26.0209C139.115 25.8148 139.804 26.5367 139.563 27.2909L121.081 85.1146C120.982 85.4243 120.739 85.6665 120.429 85.7641L52.0645 107.28C51.2996 107.521 50.5766 106.809 50.8062 106.04L68.9776 45.2111C69.0768 44.879 69.3409 44.622 69.6755 44.5318Z" fill="#D0D6E0" stroke="#D0D6E0" stroke-width="4" stroke-linecap="round"/>\n<path d="M83.1285 52.7415C91.6454 54.3438 107.322 62.0019 101.894 79.8155" stroke="white" stroke-width="3" stroke-linecap="round"/>\n<path d="M84.138 62.3385C88.3894 63.1384 96.2148 66.9611 93.5053 75.8531" stroke="white" stroke-width="3" stroke-linecap="round"/>\n<ellipse cx="83.6417" cy="71.98" rx="3.08443" ry="3.07025" transform="rotate(12.6375 83.6417 71.98)" fill="white"/>\n<path d="M43.4699 110.358C39.5425 109.114 30.6316 108.203 26.4077 114.511C21.1278 122.397 36.5031 152.755 2.11053 160.141" stroke="#D0D6E0" stroke-width="2" stroke-linecap="round"/>\n</svg>\n',"image/svg+xml").firstChild}var ErrorPlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),(n=t.call(this,e)).playerData=null,n.state={showError:!1,retryTimes:0,idx:0},n._errDetailList=[],n.playerData=e.player.config.playerData,n}return _createClass$6(r,[{key:"afterCreate",value:function(){var e,t,r;this.initEvents(),this.errNoteMap={other:null!==(e=null===(t=this.i18n.ERROR_TYPES)||void 0===t||null===(r=t.other)||void 0===r?void 0:r.msg)&&void 0!==e?e:"error",1:this.i18n.MEDIA_ERR_ABORTED,2:this.i18n.MEDIA_ERR_NETWORK,3:this.i18n.MEDIA_ERR_DECODE,4:this.i18n.MEDIA_ERR_SRC_NOT_SUPPORTED,2100:this.i18n.NETWORK_ERROR,2101:this.i18n.NETWORK_TIMEOUT,9100:this.i18n.GET_URL_ERR_BY_TOKEN,9101:this.i18n.PLAY_AUTH_TOKEN_EXPIRED,9102:this.i18n.HLS_KEY_TOKEN_EXPIRED,5200:this.i18n.MEDIA_SOURCE_CANNOT_PLAY_TYPE}}},{key:"registerLanguageTexts",value:function(){return{clickButton:{jp:"リフレッシュ",en:"Refresh",zh:"刷新","zh-hk":"刷新"},errorTips:{jp:"再生中にエラーが発生しました。[更新]をクリックして試してください",en:"An error occurred while playing, click refresh to try",zh:"播放发生错误,点击刷新试试吧","zh-hk":"播放發生錯誤,點擊刷新試試吧"}}}},{key:"registerIcons",value:function(){return{errorImg:{icon:ErrorImg,class:"xgplayer-error-svg"}}}},{key:"updateLang",value:function(){if(this.$errorDom){var e=this.$errorDom.querySelector(".xgplayer-error-tips");if(e){var t,r,n=null!==(t=null===(r=this.config.errorTipsText)||void 0===r?void 0:r[this.lang])&&void 0!==t?t:this.langText.errorTips;e.innerHTML=n}var i=this.$errorDom.querySelector(".xgplayer-error-button");i&&(i.innerHTML=this.langText.clickButton)}}},{key:"initEvents",value:function(){this.player.on(ERROR$3,this.handleError.bind(this)),this.playerData.isLive&&(this.player.on(ENDED,this.handleEnd.bind(this)),this.player.on(PluginEvents.REFRESH_CLICK,this.closeError.bind(this))),this.on(CANPLAY,this.closeError.bind(this)),this.on(PLAY,this.closeError.bind(this))}},{key:"handleError",value:function(e){this.player&&this.player.pause(),this.config.isNeedDemoteBack?(this.state.showError=!1,this.changeMainOrBackup()):this.state.showError=!0,this.renderError(e)}},{key:"handleEnd",value:function(){this.player&&this.player.pause(),this.config.isNeedDemoteBack&&this.changeMainOrBackup()}},{key:"getRetryList",value:function(){var e,t=this.playerData.getCurrentStreams()[0];return[null==t?void 0:t.url].concat(_toConsumableArray$1(null!==(e=null==t?void 0:t.backUrlList)&&void 0!==e?e:[]))}},{key:"changeMainOrBackup",value:function(){var e=this;this.player.addClass(STATE_CLASS.ENTER);var t=this.getRetryList(),r=this.config.retryLoopNum*t.length,n=(t.indexOf(this.player.config.url)+1)%t.length;this.state.idx=n;var i=t[n];if(!i||this.state.retryTimes===r)return this.player.removeClass(STATE_CLASS.ENTER),this.state.retryTimes===r&&this.player.emit(PluginEvents.PLAY_BACKUP_CHANGE_FINISH),this.state.showError=!0,this.renderError(),void this.resetTimes();this.player.once("canplay",(function(){e.state.retryTimes=0})),console.log("重试第".concat(this.state.retryTimes,"次"),i),this.player.emit(PluginEvents.PLAY_BACKUP_CHANGE,{currentUrl:this.player.config.url,nextUrl:i,retryTimes:this.state.retryTimes}),this.changeUrl(i),this.state.retryTimes=this.state.retryTimes+1}},{key:"changeUrl",value:function(e){this.player.config.url=e,this.player.switchURL(e,!1),this.player.emit(PluginEvents.PlAY_URL_CHANGE,{url:e,from:PluginEvents.PLAY_BACKUP_CHANGE})}},{key:"resetTimes",value:function(){this.state.retryTimes=0,this.state.idx=0}},{key:"renderError",value:function(e){var t=this.root;t&&(t.innerHTML="",t.style.display="none",this.state.showError&&(this.player.emit(PluginEvents.SHOW_PLAY_ERROR),t.style.display="block",t.appendChild(this.getErrorDom(e))))}},{key:"addErrDetail",value:function(e){Array.isArray(e)?this._errDetailList=[].concat(_toConsumableArray$1(this._errDetailList),_toConsumableArray$1(e)):this._errDetailList.push(e)}},{key:"getErrorDom",value:function(e){var t=this;if(!this.$errorDom){var r,n;if(this.$errorDom=util.createDom("div","",void 0,"xgplayer-error-cover"),this.config.errorImg){var i=util.createDom("div","",void 0,"xgplayer-error-img");i.appendChild(this.icons.errorImg),this.$errorDom.appendChild(i)}if(this.config.errorTips){var o="";if(e){var a,s,l=e.errorCode,c=this.player.errorNote?this.i18n[this.player.errorNote]:"";if(!c)c=null!==(a=null!==(s=this.errNoteMap[l])&&void 0!==s?s:this.errNoteMap.other)&&void 0!==a?a:"error";o=c}else{var u,h;o=null!==(u=null===(h=this.config.errorTipsText)||void 0===h?void 0:h[this.lang])&&void 0!==u?u:this.langText.errorTips}var d=util.createDom("div",o,void 0,"xgplayer-error-tips");this.$errorDom.appendChild(d)}if(this.config.isNeedRefreshButton){var p=util.createDom("div",this.langText.clickButton,void 0,"xgplayer-error-button");this.bind(".xgplayer-error-button","click",this.handleButtonClick.bind(this)),this.$errorDom.appendChild(p)}if(null!==(r=this._errDetailList)&&void 0!==r&&r.length)null===(n=this._errDetailList)||void 0===n||n.forEach((function(e){var r="function"==typeof e?e():e;if(r){var n=util.createDom("div","".concat(r.label,": ").concat(r.value),void 0,"xgplayer-error-detail-info");t.$errorDom.appendChild(n)}}));this.emit("sdkerrorplugin_render",this.$errorDom)}return this.$errorDom}},{key:"handleButtonClick",value:function(){var e,t;null===(e=this.player)||void 0===e||e.emit(PluginEvents.PLAY_ERROR_BUTTON_CLICK),null===(t=this.player)||void 0===t||t.retry(),this.closeError()}},{key:"closeError",value:function(){this.state.showError=!1,this.renderError()}},{key:"destroy",value:function(){this.player.off(ERROR$3,this.handleError.bind(this)),this.playerData.isLive&&this.player.off(ENDED,this.handleEnd.bind(this))}},{key:"render",value:function(){return'<xgplayer-error class="xgplayer-error"></xgplayer-error>'}}],[{key:"pluginName",get:function(){return"sdkErrorPlugin"}},{key:"defaultConfig",get:function(){return{errorImg:!0,errorTips:!0,isNeedRefreshButton:!0,isNeedDemoteBack:!1,retryLoopNum:1,errorTipsText:null,position:Plugin.POSITIONS.ROOT}}}]),r}(Plugin);function danmuActiveSVG$1(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M16.5 4.106h-13a.3.3 0 00-.3.3v11.186a.3.3 0 00.3.3h7.111v1.7H3.5a2 2 0 01-2-2V4.406a2 2 0 012-2h13a2 2 0 012 2V10h-1.7V4.406a.3.3 0 00-.3-.3zM6 7.722c0-.42.34-.76.76-.76h6.58a.76.76 0 110 1.52H6.76a.76.76 0 01-.76-.76zm0 3.037c0-.42.34-.759.76-.759h3.543a.76.76 0 110 1.519H6.76a.76.76 0 01-.76-.76z" fill="#fff"/><circle cx="15.1" cy="14.201" r="3.4" fill="#3370FF"/><path fill-rule="evenodd" clip-rule="evenodd" d="M13.185 13.756a.5.5 0 01.707 0l.866.866 1.78-1.78a.5.5 0 11.707.707l-2.133 2.134a.5.5 0 01-.707 0l-1.22-1.22a.5.5 0 010-.707z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function Default(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M16.5 4.106h-13a.3.3 0 00-.3.3v11.186a.3.3 0 00.3.3h7.111v1.7H3.5a2 2 0 01-2-2V4.406a2 2 0 012-2h13a2 2 0 012 2V10h-1.7V4.406a.3.3 0 00-.3-.3zM6 7.722c0-.42.34-.76.76-.76h6.58a.76.76 0 110 1.52H6.76a.76.76 0 01-.76-.76zm0 3.037c0-.42.34-.759.76-.759h3.543a.76.76 0 110 1.519H6.759a.76.76 0 01-.759-.76zm7.202 2.303a2.2 2.2 0 003.011 3.011l-3.011-3.01zm3.915 1.992a2.2 2.2 0 00-2.896-2.896l2.896 2.896zm1.383-.879a3.4 3.4 0 11-6.8 0 3.4 3.4 0 016.8 0z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function resetIcon(){return(new DOMParser).parseFromString('<svg fill="none" stroke="currentColor" stroke-width="4" viewBox="0 0 48 48" width="1em" height="1em"\n class="arco-icon arco-icon-refresh">\n <path\n d="M38.837 18C36.463 12.136 30.715 8 24 8 15.163 8 8 15.163 8 24s7.163 16 16 16c7.455 0 13.72-5.1 15.496-12M40 8v10H30">\n </path>\n</svg>',"image/svg+xml").firstChild}function ownerDocument(e){return e&&e.ownerDocument||document}function activeElement(e){void 0===e&&(e=ownerDocument());try{var t=e.activeElement;return t&&t.nodeName?t:null}catch(r){return e.body}}function hasClass(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}function addClass(e,t){e.classList?e.classList.add(t):hasClass(e,t)||("string"==typeof e.className?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}var canUseDOM=!("undefined"==typeof window||!window.document||!window.document.createElement),optionsSupported=!1,onceSupported=!1;try{var options={get passive(){return optionsSupported=!0},get once(){return onceSupported=optionsSupported=!0}};canUseDOM&&(window.addEventListener("test",options,options),window.removeEventListener("test",options,!0))}catch(e2){}function addEventListener(e,t,r,n){if(n&&"boolean"!=typeof n&&!onceSupported){var i=n.once,o=n.capture,a=r;!onceSupported&&i&&(a=r.__once||function e(n){this.removeEventListener(t,e,o),r.call(this,n)},r.__once=a),e.addEventListener(t,a,optionsSupported?n:o)}e.addEventListener(t,r,n)}function ownerWindow(e){var t=ownerDocument(e);return t&&t.defaultView||window}function getComputedStyle(e,t){return ownerWindow(e).getComputedStyle(e,t)}var rUpper=/([A-Z])/g;function hyphenate(e){return e.replace(rUpper,"-$1").toLowerCase()}var msPattern=/^ms-/;function hyphenateStyleName(e){return hyphenate(e).replace(msPattern,"-ms-")}var supportedTransforms=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function isTransform(e){return!(!e||!supportedTransforms.test(e))}function style(e,t){var r="",n="";if("string"==typeof t)return e.style.getPropertyValue(hyphenateStyleName(t))||getComputedStyle(e).getPropertyValue(hyphenateStyleName(t));Object.keys(t).forEach((function(i){var o=t[i];o||0===o?isTransform(i)?n+=i+"("+o+") ":r+=hyphenateStyleName(i)+": "+o+";":e.style.removeProperty(hyphenateStyleName(i))})),n&&(r+="transform: "+n+";"),e.style.cssText+=";"+r}function removeEventListener(e,t,r,n){var i=n&&"boolean"!=typeof n?n.capture:n;e.removeEventListener(t,r,i),r.__once&&e.removeEventListener(t,r.__once,i)}function listen(e,t,r,n){return addEventListener(e,t,r,n),function(){removeEventListener(e,t,r,n)}}function triggerEvent(e,t,r,n){if(void 0===r&&(r=!1),void 0===n&&(n=!0),e){var i=document.createEvent("HTMLEvents");i.initEvent(t,r,n),e.dispatchEvent(i)}}function parseDuration(e){var t=style(e,"transitionDuration")||"",r=-1===t.indexOf("ms")?1e3:1;return parseFloat(t)*r}function emulateTransitionEnd(e,t,r){void 0===r&&(r=5);var n=!1,i=setTimeout((function(){n||triggerEvent(e,"transitionend",!0)}),t+r),o=listen(e,"transitionend",(function(){n=!0}),{once:!0});return function(){clearTimeout(i),o()}}function transitionEnd(e,t,r,n){null==r&&(r=parseDuration(e)||0);var i=emulateTransitionEnd(e,r,n),o=listen(e,"transitionend",t);return function(){i(),o()}}var reset={transition:"","transition-duration":"","transition-delay":"","transition-timing-function":""};function _animate(e){var t=e.node,r=e.properties,n=e.duration,i=void 0===n?200:n,o=e.easing,a=e.callback,s=[],l={},c="";Object.keys(r).forEach((function(e){var t=r[e];isTransform(e)?c+=e+"("+t+") ":(l[e]=t,s.push(hyphenate(e)))})),c&&(l.transform=c,s.push("transform")),i>0&&(l.transition=s.join(", "),l["transition-duration"]=i/1e3+"s",l["transition-delay"]="0s",l["transition-timing-function"]=o||"linear");var u=transitionEnd(t,(function(e){e.target===e.currentTarget&&(style(t,reset),a&&a.call(this,e))}),i);return t.clientLeft,style(t,l),{cancel:function(){u(),style(t,reset)}}}function animate(e,t,r,n,i){if(!("nodeType"in e))return _animate(e);if(!t)throw new Error("must include properties to animate");return"function"==typeof n&&(i=n,n=""),_animate({node:e,properties:t,duration:r,easing:n,callback:i})}var prev=(new Date).getTime();function fallback(e){var t=(new Date).getTime(),r=Math.max(0,16-(t-prev)),n=setTimeout(e,r);return prev=t,n}var vendors=["","webkit","moz","o","ms"],cancelMethod="clearTimeout",rafImpl=fallback,getKey=function(e,t){return e+(e?t[0].toUpperCase()+t.substr(1):t)+"AnimationFrame"};canUseDOM&&vendors.some((function(e){var t=getKey(e,"request");return t in window&&(cancelMethod=getKey(e,"cancel"),rafImpl=function(e){return window[t](e)}),!!rafImpl}));var cancel=function(e){"function"==typeof window[cancelMethod]&&window[cancelMethod](e)},request$1=rafImpl,matchesImpl;function attribute(e,t,r){if(e){if(void 0===r)return e.getAttribute(t);r||""===r?e.setAttribute(t,String(r)):e.removeAttribute(t)}}function childElements(e){return e?Array.from(e.children):[]}function clear(e){if(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}return null}function matches(e,t){if(!matchesImpl){var r=document.body,n=r.matches||r.matchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector||r.msMatchesSelector;matchesImpl=function(e,t){return n.call(e,t)}}return matchesImpl(e,t)}function closest(e,t,r){e.closest&&!r&&e.closest(t);var n=e;do{if(matches(n,t))return n;n=n.parentElement}while(n&&n!==r&&n.nodeType===document.ELEMENT_NODE);return null}function contains(e,t){return e.contains?e.contains(t):e.compareDocumentPosition?e===t||!!(16&e.compareDocumentPosition(t)):void 0}var toArray$1=Function.prototype.bind.call(Function.prototype.call,[].slice);function childNodes(e){return e?toArray$1(e.childNodes):[]}var toArray=Function.prototype.bind.call(Function.prototype.call,[].slice);function qsa(e,t){return toArray(e.querySelectorAll(t))}function filterEvents(e,t){return function(r){var n=r.currentTarget,i=r.target;qsa(n,e).some((function(e){return contains(e,i)}))&&t.call(this,r)}}function isDocument(e){return"nodeType"in e&&e.nodeType===document.DOCUMENT_NODE}function isWindow(e){return"window"in e&&e.window===e?e:isDocument(e)&&e.defaultView||!1}function getscrollAccessor(e){var t="pageXOffset"===e?"scrollLeft":"scrollTop";return function(r,n){var i=isWindow(r);if(void 0===n)return i?i[e]:r[t];i?i.scrollTo(i[e],n):r[t]=n}}var scrollLeft=getscrollAccessor("pageXOffset"),scrollTop=getscrollAccessor("pageYOffset");function offset(e){var t=ownerDocument(e),r={top:0,left:0,height:0,width:0},n=t&&t.documentElement;return n&&contains(n,e)?(void 0!==e.getBoundingClientRect&&(r=e.getBoundingClientRect()),r={top:r.top+scrollTop(n)-(n.clientTop||0),left:r.left+scrollLeft(n)-(n.clientLeft||0),width:r.width,height:r.height}):r}function height(e,t){var r=isWindow(e);return r?r.innerHeight:t?e.clientHeight:offset(e).height}function insertAfter(e,t){return e&&t&&t.parentNode?(t.nextSibling?t.parentNode.insertBefore(e,t.nextSibling):t.parentNode.appendChild(e),e):null}var regExpInputs=/^(?:input|select|textarea|button)$/i;function isInput(e){return!!e&&regExpInputs.test(e.nodeName)}function isVisible(e){return!!e&&!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}function collectSiblings(e,t,r){void 0===t&&(t=null),void 0===r&&(r=null);for(var n=[];e;e=e.nextElementSibling)if(e!==t){if(r&&matches(e,r))break;n.push(e)}return n}function nextUntil(e,t){return collectSiblings(e,e,t)}var isHTMLElement=function(e){return!!e&&"offsetParent"in e};function offsetParent(e){for(var t=ownerDocument(e),r=e&&e.offsetParent;isHTMLElement(r)&&"HTML"!==r.nodeName&&"static"===style(r,"position");)r=r.offsetParent;return r||t.documentElement}function collectElements(e,t){var r=null,n=[];for(r=e?e[t]:null;r&&9!==r.nodeType;)n.push(r),r=r[t]||null;return n}function parents(e){return collectElements(e,"parentElement")}function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_extends.apply(this,arguments)}var nodeName=function(e){return e.nodeName&&e.nodeName.toLowerCase()},size;function position(e,t){var r,n={top:0,left:0};if("fixed"===style(e,"position"))r=e.getBoundingClientRect();else{var i=t||offsetParent(e);r=offset(e),"html"!==nodeName(i)&&(n=offset(i));var o=String(style(i,"borderTopWidth")||0);n.top+=parseInt(o,10)-scrollTop(i)||0;var a=String(style(i,"borderLeftWidth")||0);n.left+=parseInt(a,10)-scrollLeft(i)||0}var s=String(style(e,"marginTop")||0),l=String(style(e,"marginLeft")||0);return _extends({},r,{top:r.top-n.top-(parseInt(s,10)||0),left:r.left-n.left-(parseInt(l,10)||0)})}function prepend(e,t){return e&&t?(t.firstElementChild?t.insertBefore(e,t.firstElementChild):t.appendChild(e),e):null}function remove(e){return e&&e.parentNode?(e.parentNode.removeChild(e),e):null}function replaceClassName(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function removeClass(e,t){e.classList?e.classList.remove(t):"string"==typeof e.className?e.className=replaceClassName(e.className,t):e.setAttribute("class",replaceClassName(e.className&&e.className.baseVal||"",t))}function scrollbarSize(e){if((!size&&0!==size||e)&&canUseDOM){var t=document.createElement("div");t.style.position="absolute",t.style.top="-9999px",t.style.width="50px",t.style.height="50px",t.style.overflow="scroll",document.body.appendChild(t),size=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return size}function scrollParent(e,t){var r=style(e,"position"),n="absolute"===r,i=e.ownerDocument;if("fixed"===r)return i||document;for(;(e=e.parentNode)&&!isDocument(e);){var o=n&&"static"===style(e,"position"),a=(style(e,"overflow")||"")+(style(e,"overflow-y")||"")+style(e,"overflow-x");if(!o&&(/(auto|scroll)/.test(a)&&(t||height(e)<e.scrollHeight)))return e}return i||document}function scrollTo(e,t){var r=offset(e),n={top:0,left:0};if(e){var i=t||scrollParent(e),o=isWindow(i),a=scrollTop(i),s=height(i,!0);o||(n=offset(i));var l=(r={top:r.top-n.top,left:r.left-n.left,height:r.height,width:r.width}).height,c=r.top+(o?0:a),u=c+l;a=a>c?c:u>a+s?u-s:a;var h=request$1((function(){return scrollTop(i,a)}));return function(){return cancel(h)}}}function siblings(e){return collectSiblings(e&&e.parentElement?e.parentElement.firstElementChild:null,e)}var regExpNbspEntity=/&nbsp;/gi,regExpNbspHex=/\xA0/g,regExpSpaces=/\s+([^\s])/gm;function text(e,t,r){void 0===t&&(t=!0),void 0===r&&(r=!0);var n="";return e&&(n=(e.textContent||"").replace(regExpNbspEntity," ").replace(regExpNbspHex," "),t&&(n=n.trim()),r&&(n=n.replace(regExpSpaces," $1"))),n}function toggleClass(e,t){e.classList?e.classList.toggle(t):hasClass(e,t)?removeClass(e,t):addClass(e,t)}function getWidth(e,t){var r=isWindow(e);return r?r.innerWidth:t?e.clientWidth:offset(e).width}var helpers={addEventListener:addEventListener,removeEventListener:removeEventListener,triggerEvent:triggerEvent,animate:animate,filter:filterEvents,listen:listen,style:style,getComputedStyle:getComputedStyle,attribute:attribute,activeElement:activeElement,ownerDocument:ownerDocument,ownerWindow:ownerWindow,requestAnimationFrame:request$1,cancelAnimationFrame:cancel,matches:matches,height:height,width:getWidth,offset:offset,offsetParent:offsetParent,position:position,contains:contains,scrollbarSize:scrollbarSize,scrollLeft:scrollLeft,scrollParent:scrollParent,scrollTo:scrollTo,scrollTop:scrollTop,querySelectorAll:qsa,closest:closest,addClass:addClass,removeClass:removeClass,hasClass:hasClass,toggleClass:toggleClass,transitionEnd:transitionEnd,childNodes:childNodes,childElements:childElements,nextUntil:nextUntil,parents:parents,siblings:siblings,clear:clear,insertAfter:insertAfter,isInput:isInput,isVisible:isVisible,prepend:prepend,remove:remove,text:text},FUNC_ERROR_TEXT="Expected a function";function throttle(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT);return isObject$o(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),debounce$1(e,t,{leading:n,maxWait:t,trailing:i})}var Slider=function(){function e(t,r){_classCallCheck$5(this,e),this.ticks=[],this.range=[0,100],this.currentValue=0,this.currentTick={name:"",val:0,renderVal:0},this.buttonStatus=1,this.startClientX=0,this.wrapperWidth=1,this.wrapperLeft=0,this.handleChange=function(){},this.parent=t,this.ticks=r.ticks,this.itemProps=r,this.sliderTitle=document.createElement("div"),this.sliderTitle.innerHTML=r.name,this.sliderContent=document.createElement("div"),this.sliderValue=document.createElement("div"),this.wrapper=document.createElement("div"),this.inner=document.createElement("div"),this.button=document.createElement("div"),helpers.addClass(this.wrapper,"wrapper"),helpers.addClass(this.parent,"xg-player-slider"),helpers.addClass(this.sliderContent,"line-slider"),helpers.addClass(this.sliderTitle,"line-title"),helpers.addClass(this.sliderValue,"line-value"),this.renderTicks(),this.rendInner(),this.parent.appendChild(this.sliderTitle),this.parent.appendChild(this.sliderContent),this.parent.appendChild(this.sliderValue),this.sliderContent.appendChild(this.wrapper),this.bindEvents(),this.setValue(r.defaultValue)}return _createClass$6(e,[{key:"renderTicks",value:function(){var e=this.wrapper,t=document.createElement("div");helpers.addClass(t,"ticks");for(var r=1;r<this.ticks.length-1;r++){var n=this.ticks[r],i=document.createElement("div");helpers.addClass(i,"tick"),helpers.style(i,{left:n.val+"%"}),t.appendChild(i)}e.appendChild(t)}},{key:"rendInner",value:function(){var e=this.wrapper,t=this.inner;helpers.addClass(t,"inner");var r=this.button;helpers.addClass(r,"button"),e.appendChild(t),e.appendChild(r)}},{key:"bindEvents",value:function(){helpers.addEventListener(this.wrapper,"click",this.onClick.bind(this)),helpers.addEventListener(this.button,"touchstart",this.onTouchStart.bind(this)),helpers.addEventListener(this.button,"touchmove",throttle(this.onTouchmove.bind(this),30)),helpers.addEventListener(this.button,"touchend",this.onTouchend.bind(this)),helpers.addEventListener(this.button,"touchcancel",this.onTouchend.bind(this))}},{key:"setValue",value:function(e){var t=this;if(e>this.range[1]||e<this.range[0])return!1;this.currentTick=this.getCurrentTick(e),this.currentValue=this.currentTick.val;var r=this.currentValue+"%";return setTimeout((function(){helpers.style(t.inner,{width:r}),helpers.style(t.button,{left:r})})),this.sliderValue.innerHTML=this.currentTick.name,this.handleChange(this.currentValue),!0}},{key:"renderText",value:function(e){var t=this;this.ticks=e.ticks,this.itemProps=e,this.sliderTitle.innerHTML=e.name,this.currentTick=this.ticks.filter((function(e){return e.val===t.currentValue}))[0],this.sliderValue.innerHTML=this.currentTick.name}},{key:"onChange",value:function(e){this.handleChange=e}},{key:"getCurrentTick",value:function(e){for(var t=0;t<this.ticks.length-1;t++)if(this.ticks[t].val<=e&&this.ticks[t+1].val>=e)return e-this.ticks[t].val>this.ticks[t+1].val-e?this.ticks[t+1]:this.ticks[t];return this.ticks[0]}},{key:"onMousedown",value:function(e){this.startClientX=e.clientX,this.onStart()}},{key:"onTouchStart",value:function(e){e.stopPropagation(),this.startClientX=e.touches[0].clientX,this.onStart()}},{key:"onStart",value:function(){this.buttonStatus=2;var e=helpers.offset(this.wrapper);this.wrapperWidth=e.width,this.wrapperLeft=e.left}},{key:"onMousemove",value:function(e){if(2===this.buttonStatus){var t=e.clientX-this.startClientX;this.onMove(t)}}},{key:"onTouchmove",value:function(e){e.stopPropagation();var t=e.touches[0].clientX-this.startClientX;this.onMove(t)}},{key:"onMove",value:function(e){var t=this.startClientX+e;if(!(t-this.wrapperLeft<0||t-this.wrapperLeft>this.wrapperWidth)){this.startClientX=this.startClientX+e;var r=(this.startClientX-this.wrapperLeft)*(this.range[1]-this.range[0])/this.wrapperWidth;helpers.style(this.inner,{width:r+"%"}),helpers.style(this.button,{left:r+"%"})}}},{key:"onMouseup",value:function(e){console.log("mouse up",e.clientX),this.onEnd()}},{key:"onTouchend",value:function(){this.onEnd()}},{key:"onEnd",value:function(){this.buttonStatus=3;var e=(this.startClientX-this.wrapperLeft)*(this.range[1]-this.range[0])/this.wrapperWidth;this.setValue(e)}},{key:"onClick",value:function(e){e.stopPropagation();var t=helpers.offset(this.wrapper);this.wrapperWidth=t.width,this.wrapperLeft=t.left;var r=(e.clientX-this.wrapperLeft)*(this.range[1]-this.range[0])/this.wrapperWidth;this.setValue(r)}}]),e}(),zh={danmuSwitch:"弹幕开关",danmuSetting:"弹幕设置",openDanmu:"打开弹幕",reset:"重置",opacity:"不透明度",area:"显示区域",speed:"弹幕速度",fontSize:"字体大小",danmuMask:"智能挡板",screen0:"1/4屏",screen1:"半屏",screen2:"3/4屏",screen3:"全屏",opacity0:"0",opacity1:"1/3",opacity2:"2/3",opacity3:"1",speed0:"0.25",speed1:"0.5",speed2:"正常",speed3:"1.25",speed4:"1.5",speed5:"2",fontSize0:"极小",fontSize1:"适中",fontSize2:"极大"},en={danmuSwitch:"Barrage switch",danmuSetting:"Barrage settings",openDanmu:"Open Barrage",reset:"Reset",opacity:"Opacity",area:"Display area",speed:"Barrage speed",fontSize:"Font size",danmuMask:"Intelligent blocking",screen0:"1/4 screen",screen1:"Half screen",screen2:"3/4 screen",screen3:"Full screen",opacity0:"0",opacity1:"1/3",opacity2:"2/3",opacity3:"1",speed0:"0.25",speed1:"0.5",speed2:"Normal",speed3:"1.25",speed4:"1.5",speed5:"2",fontSize0:"Minimal",fontSize1:"Moderate",fontSize2:"Great"},jp=en,zhHK={danmuSwitch:"彈幕開關",danmuSetting:"彈幕設置",openDanmu:"打開彈幕",reset:"重置",opacity:"不透明度",area:"顯示區域",speed:"彈幕速度",fontSize:"字體大小",danmuMask:"智能擋板",screen0:"1/4屏",screen1:"半屏",screen2:"3/4屏",screen3:"全屏",opacity0:"0",opacity1:"1/3",opacity2:"2/3",opacity3:"1",speed0:"0.25",speed1:"0.5",speed2:"正常",speed3:"1.25",speed4:"1.5",speed5:"2",fontSize0:"極小",fontSize1:"適中",fontSize2:"極大"},lang={zh:zh,"zh-cn":zh,en:en,jp:jp,"zh-hk":zhHK},State=function(){function e(t){_classCallCheck$5(this,e),this.curLang="en",this._defaultConfig={opacity:99,area:99,fontSize:50,speed:40,active:!1,usePanel:!0,danmuItems:[],maskConfig:{maskUrl:"",maskOffset:0,interval:200},maskActive:!1,external:[]},Object.assign(this._defaultConfig,t)}return _createClass$6(e,[{key:"updateLang",value:function(e){this.curLang=e,this.curLangMap=lang[e]||lang.en;var t=this.curLangMap;this.sliderItemsProps=[{key:"opacity",name:t.opacity,defaultValue:99,ticks:[{name:t.opacity0,val:0,renderVal:0},{name:t.opacity1,val:33,renderVal:.33},{name:t.opacity2,val:66,renderVal:.66},{name:t.opacity3,val:99,renderVal:1}]},{key:"area",name:t.area,defaultValue:99,ticks:[{name:t.screen0,val:0,renderVal:1/4},{name:t.screen1,val:33,renderVal:.5},{name:t.screen2,val:66,renderVal:3/4},{name:t.screen3,val:99,renderVal:1}]},{key:"speed",name:t.speed,defaultValue:40,ticks:[{name:t.speed0,val:0,renderVal:1/4},{name:t.speed1,val:20,renderVal:.5},{name:t.speed2,val:40,renderVal:1},{name:t.speed3,val:60,renderVal:5/4},{name:t.speed4,val:80,renderVal:1.5},{name:t.speed5,val:100,renderVal:2}]},{key:"fontSize",name:t.fontSize,defaultValue:50,ticks:[{name:t.fontSize0,val:0,renderVal:14},{name:t.fontSize1,val:50,renderVal:16},{name:t.fontSize2,val:100,renderVal:20}]}],this._defaultConfig.external.forEach((function(t){t.name=t.lang[e]||t.lang.en}))}},{key:"getConfig",value:function(){return this._defaultConfig}},{key:"updateConfig",value:function(e){Object.assign(this._defaultConfig,e)}},{key:"updateComments",value:function(e){this._defaultConfig.danmuItems=e}},{key:"getRenderVal",value:function(e,t){var r=this.sliderItemsProps.find((function(t){return t.key===e}))||this.sliderItemsProps[0];return(r.ticks.find((function(e){return e.val===t}))||r.ticks[0]).renderVal}}]),e}(),NormalSpeed=1e4,Container=function(){function e(t){_classCallCheck$5(this,e),this.state=t,this.root=util.createDom("xg-danmu"),helpers.addClass(this.root,"xgplayer-danmu-container")}var t;return _createClass$6(e,[{key:"initDanmuContainer",value:function(){var e=this.state.getConfig(),t=e.opacity,r=void 0===t?1:t,n=e.fontSize,i=void 0===n?16:n,o=e.area,a=void 0===o?1:o,s=e.danmuItems,l=void 0===s?[]:s,c=e.active,u=e.speed,h=void 0===u?40:u,d=(c?l:[]).map((function(e){return!e.style&&(e.style={}),e})),p={container:this.root,comments:d,live:!1,area:{start:0,end:this.state.getRenderVal("area",a)}};this.danmuJs=new window["danmu.js"](p),this.setOpacity(this.state.getRenderVal("opacity",r)),this.setFontSize(this.state.getRenderVal("fontSize",i)),this.setSpeed(this.state.getRenderVal("speed",h))}},{key:"start",value:function(){this.danmuJs.start()}},{key:"pause",value:function(){this.danmuJs.pause()}},{key:"play",value:function(){this.danmuJs.play()}},{key:"stop",value:function(){this.danmuJs.stop()}},{key:"resize",value:function(){this.danmuJs.resize()}},{key:"sendDanmu",value:function(e){this.state.getConfig().active&&this.danmuJs.sendComment(e)}},{key:"clear",value:function(){this.danmuJs.clear()}},{key:"setProperty",value:function(e,t){return"opacity"===e?this.setOpacity(this.state.getRenderVal(e,t)):"area"===e?this.setArea(this.state.getRenderVal(e,t)):"speed"===e?this.setSpeed(this.state.getRenderVal(e,t)):"fontSize"===e?this.setFontSize(this.state.getRenderVal(e,t)):void 0}},{key:"setOpacity",value:function(e){this.danmuJs.setOpacity(e)}},{key:"setFontSize",value:function(e){this.danmuJs.setFontSize(e)}},{key:"setArea",value:function(e){this.danmuJs.setArea({start:0,end:this.state.getRenderVal("area",e)})}},{key:"setSpeed",value:function(e){this.danmuJs.setAllDuration("scroll",NormalSpeed/e)}},{key:"destroy",value:(t=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.danmuJs){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.danmuJs.stop();case 4:return e.next=6,this.danmuJs.destroy();case 6:this.danmuJs=null,this.root.parentNode.removeChild(this.root),this.root=null;case 10:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),Panel=function(){function e(t){_classCallCheck$5(this,e),this.state=t,this.root=document.createElement("div"),helpers.addClass(this.root,"panel-box"),helpers.addEventListener(this.root,"click",(function(e){e.stopPropagation()}))}return _createClass$6(e,[{key:"destroy",value:function(){this.root.parentNode&&this.root.parentNode.removeChild(this.root),this.root=null}}]),e}(),Switch=function(){function e(t){_classCallCheck$5(this,e),this.callback=function(){},this.key=t.key,this.name=t.name,this.value=t.value,this.root=document.createElement("div"),helpers.addClass(this.root,"xg-player-switch-wrapper"),this.render()}return _createClass$6(e,[{key:"render",value:function(){var e=this;if(!this.root.childNodes.length){var t=document.createElement("div");this.$left=t,helpers.addClass(t,"left"),t.innerHTML=this.name;var r=document.createElement("div");this.$right=r,helpers.addClass(r,"right"),r.innerHTML='<label class="switch">\n <input type="checkbox">\n <span class="slider round"></span>\n </label>',this.root.appendChild(t),this.root.appendChild(r);var n=this.$right.querySelector("input");helpers.addEventListener(this.$right,"click",debounce$1((function(t){t.stopPropagation(),e.value=!e.value,e.value?null==n||n.setAttribute("checked","checked"):null==n||n.removeAttribute("checked"),e.callback(e.value)}),50))}var i=this.$right.querySelector("input");this.value?null==i||i.setAttribute("checked","checked"):i.removeAttribute("checked"),i.checked=this.value}},{key:"renderName",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.$left.innerHTML=e}},{key:"onChange",value:function(e){this.callback=e}}]),e}(),isPC="pc"===sniffer$1.device,MIN_INTERVAL=300,POSITIONS$8=Plugin.POSITIONS,DanmuPlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),(n=t.call(this,e)).seekCost=window.performance.now(),n.eventBus=new EventEmitter,window["danmu.js"]?(n.state=new State(e.config),n.state.updateLang(n.player.lang),n.iconWrap=document.createElement("div"),helpers.addClass(n.iconWrap,"icon-warp"),n.tipsWrap=document.createElement("div"),helpers.addClass(n.tipsWrap,"tips-wrap"),n.container=new Container(n.state),n.panel=new Panel(n.state),n):_possibleConstructorReturn$5(n)}return _createClass$6(r,[{key:"afterCreate",value:function(){var e;null===(e=this.player.root)||void 0===e||e.appendChild(this.container.root),this.renderIcon(),this.renderBox(),this.root.appendChild(this.iconWrap),isPC&&(this.state.getConfig().usePanel&&this.root.appendChild(this.panel.root),this.renderTips(),helpers.addClass(this.panel.root,"pc-panel"),this.root.appendChild(this.tipsWrap)),this.initEvents(),this.container.initDanmuContainer()}},{key:"afterPlayerInit",value:function(){this.initDanmuMask()}},{key:"updateLang",value:function(e){this.state.updateLang(this.player.lang),this.eventBus.emit("updateLang")}},{key:"registerIcons",value:function(){return{open:{icon:danmuActiveSVG$1,class:"xgplayer-danmu-open-svg"},close:{icon:Default,class:"xgplayer-danmu-close-svg"},reset:{icon:resetIcon,class:"xgplayer-danmu-reset-svg"}}}},{key:"initEvents",value:function(){isPC?this.bindPCEvent():this.bindMobileEvent(),this.bindPlayerEvent()}},{key:"bindPlayerEvent",value:function(){var e=this;this.once(TIME_UPDATE,(function(){e.container.start()})),this.on(PAUSE,(function(){e.container.pause()})),this.on(PLAY,(function(){e.container.play()})),this.on(SEEKING,(function(){e.seekCost=window.performance.now(),e.container.stop()})),this.on(SEEKED,debounce$1((function(){e.container.start()}),MIN_INTERVAL)),this.on([FULLSCREEN_CHANGE,CSS_FULLSCREEN_CHANGE,MINI_STATE_CHANGE],(function(){e.container.resize(),e.handleResize()})),this.on(PIP_CHANGE,this.handlePIP.bind(this))}},{key:"bindPCEvent",value:function(){var e=this;helpers.addEventListener(this.root,"click",this.onClick.bind(this)),helpers.addEventListener(this.root,"mouseenter",(function(){var t=e.state.getConfig().active,r=e.player.controls;"rightSide"===e.config.listType?r.blur():r.focus(),t?(helpers.style(e.panel.root,{display:"block"}),helpers.style(e.tipsWrap,{display:"none"})):(helpers.style(e.panel.root,{display:"none"}),helpers.style(e.tipsWrap,{display:"block"}))})),helpers.addEventListener(this.root,"mouseleave",(function(){var t=e.player.controls;"rightSide"===e.config.listType?t.focus():t.focusAwhile(),helpers.style(e.panel.root,{display:"none"}),helpers.style(e.tipsWrap,{display:"none"})}))}},{key:"bindMobileEvent",value:function(){var e=this;helpers.addEventListener(this.root,"click",(function(){e.state.getConfig().usePanel?e.player.panel.showPanel(e.panel.root):e.onClick()}))}},{key:"onClick",value:function(){this.toggleDanmu(),this.renderIcon()}},{key:"toggleDanmu",value:function(){var e=this.state.getConfig(),t=e.active,r=e.maskActive,n=!t;n?(this.state.updateConfig({active:n}),r&&this.initMask()):(null==this||this.container.clear(),this.destroyMask(),this.state.updateConfig({active:n})),this.player.emit(PluginEvents.DANMU_CHANGE,{active:n}),this.danmuSwitchInSettingPanel&&(this.danmuSwitchInSettingPanel.value=n,this.danmuSwitchInSettingPanel.render())}},{key:"renderIcon",value:function(){this.iconWrap.innerHTML="",this.state.getConfig().active?this.iconWrap.appendChild(this.icons.open):this.iconWrap.appendChild(this.icons.close)}},{key:"renderTips",value:function(){this.tipsWrap.innerHTML=this.state.curLangMap.openDanmu}},{key:"renderBox",value:function(){var e=this;this.panel.root.innerHTML="";var t=document.createElement("div");helpers.addClass(t,"box-header"),t.innerHTML='<div class="header-setting">'+this.state.curLangMap.danmuSetting+'</div> <div class="header-reset"></div>';var r=t.querySelector(".header-reset");r.appendChild(this.icons.reset),helpers.addEventListener(r,"click",(function(t){t.stopPropagation(),e.eventBus.emit("reset")}),{capture:!0});var n=document.createElement("span");n.innerHTML=this.state.curLangMap.reset,r.appendChild(n),this.eventBus.on("updateLang",(function(){n.innerHTML=e.state.curLangMap.reset,t.querySelector(".header-setting").innerHTML=e.state.curLangMap.danmuSetting})),this.panel.root.appendChild(t),isPC||this.renderTurnOff(),this.renderSliders(),this.renderSwitches()}},{key:"renderTurnOff",value:function(){var e=this,t={name:this.state.curLangMap.danmuSwitch,key:"active",value:this.state.getConfig().active||!1},r=new Switch(t);this.danmuSwitchInSettingPanel=r,this.panel.root.appendChild(r.root),r.onChange((function(t){e.toggleDanmu(),e.renderIcon()})),this.eventBus.on("updateLang",(function(){r.renderName(e.state.curLangMap.danmuSwitch)}))}},{key:"renderSwitches",value:function(){var e,t=this;null===(e=this.state.getConfig().external)||void 0===e||e.forEach((function(e){var r=new Switch(e);t.panel.root.appendChild(r.root),t.eventBus.on("updateLang",(function(){r.renderName(e.name)})),r.onChange((function(r){var n=t.state.getConfig().external||[];n.forEach((function(t){t.key===e.key&&(t.value=r)})),t.state.updateConfig({external:n}),t.player.emit(PluginEvents.DANMU_CHANGE,{external:n})}))}))}},{key:"renderSliders",value:function(){var e=this;this.state.sliderItemsProps.forEach((function(t,r){var n,i,o=document.createElement("div"),a=new Slider(o,t);null!=(null===(n=e.state.getConfig())||void 0===n?void 0:n[t.key])&&a.setValue(null===(i=e.state.getConfig())||void 0===i?void 0:i[t.key]);a.onChange((function(r){e.state.updateConfig(_defineProperty$6({},t.key,r)),console.log("val",e.state.getConfig()),e.player.emit(PluginEvents.DANMU_CHANGE,_defineProperty$6({},t.key,r)),e.container.setProperty(t.key,r)})),e.eventBus.on("reset",(function(){a.setValue(t.defaultValue)})),e.eventBus.on("updateLang",(function(){a.renderText(e.state.sliderItemsProps[r])})),e.panel.root.appendChild(o)}))}},{key:"sendDanmu",value:function(e){return this.container.sendDanmu(e)}},{key:"updateConfig",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.state.updateConfig(e)}},{key:"getConfig",value:function(){return this.state.getConfig()}},{key:"initDanmuMask",value:function(){if(this.player){var e=this.state.getConfig(),t=e.maskConfig,r=e.active,n=e.maskActive;t.maskUrl&&(this.renderDanmuMaskTurnOff(),r&&n&&this.initMask())}}},{key:"renderDanmuMaskTurnOff",value:function(){var e=this,t={name:this.state.curLangMap.danmuMask,key:"maskActive",value:this.state.getConfig().maskActive||!1},r=new Switch(t);this.panel.root.appendChild(r.root),r.onChange((function(t){e.state.updateConfig({maskActive:t}),t?e.initMask():e.destroyMask(),e.renderIcon()})),this.eventBus.on("updateLang",(function(){r.renderName(e.state.curLangMap.danmuMask)}))}},{key:"initMask",value:function(){this.destroyMask();var e=this.state.getConfig(),t=e.maskConfig,r=e.maskActive,n=e.active;t.maskUrl&&r&&n&&(window.DanmuMask&&"function"==typeof window.DanmuMask&&(this.mask=new window.DanmuMask({player:this.player,url:t.maskUrl,originStart:t.maskOffset,interval:t.interval})),this.mask.init())}},{key:"destroyMask",value:function(){this.mask&&(this.mask.destroy(),this.mask=null)}},{key:"handleResize",value:function(){var e,t,r,n;if(this.mask){var i=this.player;this.mask.setContainerSize(null!==(e=null==i||null===(t=i.root)||void 0===t?void 0:t.offsetWidth)&&void 0!==e?e:0,null!==(r=null==i||null===(n=i.root)||void 0===n?void 0:n.offsetHeight)&&void 0!==r?r:0)}}},{key:"handlePIP",value:function(e){e?this.destroyMask():this.initMask()}},{key:"destroy",value:function(){this.destroyMask(),this.container.destroy(),this.panel.destroy()}},{key:"render",value:function(){return'<div class="xgplayer-danmu"></div>'}}],[{key:"pluginName",get:function(){return"DanmuPlugin"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$8.CONTROLS_RIGHT,index:CONTROL_ICON_INDEX.DanmuPlugin}}}]),r}(Plugin),uncurryThis$3=functionUncurryThis,aCallable=aCallable$b,isObject$2=isObject$n,hasOwn=hasOwnProperty_1,arraySlice$1=arraySlice$c,NATIVE_BIND=functionBindNative,$Function=Function,concat=uncurryThis$3([].concat),join=uncurryThis$3([].join),factories={},construct=function(e,t,r){if(!hasOwn(factories,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";factories[t]=$Function("C,a","return new C("+join(n,",")+")")}return factories[t](e,r)},functionBind=NATIVE_BIND?$Function.bind:function(e){var t=aCallable(this),r=t.prototype,n=arraySlice$1(arguments,1),i=function(){var r=concat(n,arraySlice$1(arguments));return this instanceof i?construct(t,r.length,r):t.apply(e,r)};return isObject$2(r)&&(i.prototype=r),i},$$5=_export,getBuiltIn=getBuiltIn$d,apply$1=functionApply,bind$1=functionBind,aConstructor=aConstructor$3,anObject=anObject$l,isObject$1=isObject$n,create=objectCreate,fails$1=fails$L,nativeConstruct=getBuiltIn("Reflect","construct"),ObjectPrototype=Object.prototype,push$1=[].push,NEW_TARGET_BUG=fails$1((function(){function e(){}return!(nativeConstruct((function(){}),[],e)instanceof e)})),ARGS_BUG=!fails$1((function(){nativeConstruct((function(){}))})),FORCED$1=NEW_TARGET_BUG||ARGS_BUG;function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$1(e,t,r){return t&&_defineProperties$1(e.prototype,t),r&&_defineProperties$1(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _inherits(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&&_setPrototypeOf(e,t)}function _typeof(e){return(_typeof="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 _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn(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 _assertThisInitialized(e)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _defineProperty$1(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}$$5({target:"Reflect",stat:!0,forced:FORCED$1,sham:FORCED$1},{construct:function(e,t){aConstructor(e),anObject(t);var r=arguments.length<3?e:aConstructor(arguments[2]);if(ARGS_BUG&&!NEW_TARGET_BUG)return nativeConstruct(e,t,r);if(e==r){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 n=[null];return apply$1(push$1,n,t),new(apply$1(bind$1,e,n))}var i=r.prototype,o=create(isObject$1(i)?i:ObjectPrototype),a=apply$1(e,o,t);return isObject$1(a)?a:o}});var uncurryThis$2=functionUncurryThis,defineBuiltIn=defineBuiltIn$i,DatePrototype=Date.prototype,INVALID_DATE="Invalid Date",TO_STRING="toString",nativeDateToString=uncurryThis$2(DatePrototype[TO_STRING]),thisTimeValue=uncurryThis$2(DatePrototype.getTime);String(new Date(NaN))!=INVALID_DATE&&defineBuiltIn(DatePrototype,TO_STRING,(function(){var e=thisTimeValue(this);return e==e?nativeDateToString(this):INVALID_DATE}));var $$4=_export,bind=functionBind;$$4({target:"Function",proto:!0,forced:Function.bind!==bind},{bind:bind});var global$4=global$H,apply=functionApply,isCallable=isCallable$u,userAgent=engineUserAgent,arraySlice=arraySlice$c,validateArgumentsLength=validateArgumentsLength$4,MSIE=/MSIE .\./.test(userAgent),Function$1=global$4.Function,wrap=function(e){return MSIE?function(t,r){var n=validateArgumentsLength(arguments.length,1)>2,i=isCallable(t)?t:Function$1(t),o=n?arraySlice(arguments,2):void 0;return e(n?function(){apply(i,this,o)}:i,r)}:e},schedulersFix={setTimeout:wrap(global$4.setTimeout),setInterval:wrap(global$4.setInterval)},$$3=_export,global$3=global$H,setInterval$1=schedulersFix.setInterval;$$3({global:!0,bind:!0,forced:global$3.setInterval!==setInterval$1},{setInterval:setInterval$1});var $$2=_export,global$2=global$H,setTimeout$1=schedulersFix.setTimeout;$$2({global:!0,bind:!0,forced:global$2.setTimeout!==setTimeout$1},{setTimeout:setTimeout$1});var DESCRIPTORS=descriptors,uncurryThis$1=functionUncurryThis,objectKeys=objectKeys$4,toIndexedObject=toIndexedObject$c,$propertyIsEnumerable=objectPropertyIsEnumerable.f,propertyIsEnumerable=uncurryThis$1($propertyIsEnumerable),push=uncurryThis$1([].push),createMethod=function(e){return function(t){for(var r,n=toIndexedObject(t),i=objectKeys(n),o=i.length,a=0,s=[];o>a;)r=i[a++],DESCRIPTORS&&!propertyIsEnumerable(n,r)||push(s,e?[r,n[r]]:n[r]);return s}},objectToArray={entries:createMethod(!0),values:createMethod(!1)},$$1=_export,$values=objectToArray.values;$$1({target:"Object",stat:!0},{values:function(e){return $values(e)}});var global$1=global$H,fails=fails$L,uncurryThis=functionUncurryThis,toString=toString$h,trim=stringTrim.trim,whitespaces=whitespaces$3,charAt=uncurryThis("".charAt),$parseFloat$1=global$1.parseFloat,_Symbol=global$1.Symbol,ITERATOR=_Symbol&&_Symbol.iterator,FORCED=1/$parseFloat$1(whitespaces+"-0")!=-1/0||ITERATOR&&!fails((function(){$parseFloat$1(Object(ITERATOR))})),numberParseFloat=FORCED?function(e){var t=trim(toString(e)),r=$parseFloat$1(t);return 0===r&&"-"==charAt(t,0)?-0:r}:$parseFloat$1,$=_export,$parseFloat=numberParseFloat;function debounce(e,t,r){var n;return function(){var i=this,o=arguments,a=function(){n=null,r||e.apply(i,o)},s=r&&!n;clearTimeout(n),n=setTimeout(a,t),s&&e.apply(i,o)}}$({global:!0,forced:parseFloat!=$parseFloat},{parseFloat:$parseFloat});var EVENTS={MENU_REPORT:"MENU_REPORT",MENU_LOG:"MENU_LOG"},INFO_TYPES={VID:5,TYPE:10,CODECS:20,SPEED:30,BUFFER:40,PLAY_QUALITY:50,SCHEME:60,RESOLUTION:70,VIEWPORT:80,VOLUME:90,CDN:100,P2P:110,PLAYER_VERSION:120},LOG_TYPES={MENU:0,INTERACT:1,CONTEXTMENU:2},MENU_TYPES={STATS:0,REPORT:1},INTERACT_TYPES={CLOSE:0,COPY:1},CONTEXTMENU_TYPES={SHOW:0,HIDE:1},LOG_EVENTS={STATS:"STATS",REPORT:"REPORT",CLOSE:"CLOSE",COPY:"COPY",CONTEXTMENU_SHOW:"CONTEXTMENU_SHOW",CONTEXTMENU_HIDE:"CONTEXTMENU_HIDE"},events=Object.freeze(Object.defineProperty({__proto__:null,CONTEXTMENU_TYPES:CONTEXTMENU_TYPES,EVENTS:EVENTS,INFO_TYPES:INFO_TYPES,INTERACT_TYPES:INTERACT_TYPES,LOG_EVENTS:LOG_EVENTS,LOG_TYPES:LOG_TYPES,MENU_TYPES:MENU_TYPES},Symbol.toStringTag,{value:"Module"})),_cn,_en;function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,n=_getPrototypeOf(e);if(t){var i=_getPrototypeOf(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _isNativeReflectConstruct(){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(e2){return!1}}var LANG_CONFIGS={cn:(_cn={},_defineProperty$1(_cn,INFO_TYPES.VID,"VID"),_defineProperty$1(_cn,INFO_TYPES.TYPE,"类型"),_defineProperty$1(_cn,INFO_TYPES.CODECS,"编码"),_defineProperty$1(_cn,INFO_TYPES.SPEED,"加载速度"),_defineProperty$1(_cn,INFO_TYPES.BUFFER,"缓冲时长"),_defineProperty$1(_cn,INFO_TYPES.PLAY_QUALITY,"丢帧率"),_defineProperty$1(_cn,INFO_TYPES.SCHEME,"视频协议"),_defineProperty$1(_cn,INFO_TYPES.RESOLUTION,"分辨率"),_defineProperty$1(_cn,INFO_TYPES.VIEWPORT,"视图尺寸"),_defineProperty$1(_cn,INFO_TYPES.VOLUME,"音量大小"),_defineProperty$1(_cn,INFO_TYPES.CDN,"CDN"),_defineProperty$1(_cn,INFO_TYPES.P2P,"P2P"),_defineProperty$1(_cn,INFO_TYPES.PLAYER_VERSION,"播放器版本"),_cn),en:(_en={},_defineProperty$1(_en,INFO_TYPES.VID,"Video ID"),_defineProperty$1(_en,INFO_TYPES.TYPE,"Video Type"),_defineProperty$1(_en,INFO_TYPES.CODECS,"Codecs"),_defineProperty$1(_en,INFO_TYPES.SPEED,"Connection Speed"),_defineProperty$1(_en,INFO_TYPES.BUFFER,"Buffer Health"),_defineProperty$1(_en,INFO_TYPES.PLAY_QUALITY,"Dropped Frames"),_defineProperty$1(_en,INFO_TYPES.SCHEME,"Protocol"),_defineProperty$1(_en,INFO_TYPES.RESOLUTION,"Res"),_defineProperty$1(_en,INFO_TYPES.VIEWPORT,"Viewport"),_defineProperty$1(_en,INFO_TYPES.VOLUME,"Volume"),_defineProperty$1(_en,INFO_TYPES.CDN,"CDN"),_defineProperty$1(_en,INFO_TYPES.P2P,"P2P"),_defineProperty$1(_en,INFO_TYPES.PLAYER_VERSION,"Player Version"),_en)},MenuPlugin=function(e){_inherits(r,e);var t=_createSuper(r);function r(){return _classCallCheck(this,r),t.apply(this,arguments)}return _createClass$1(r,[{key:"afterCreate",value:function(){}},{key:"onPluginsReady",value:function(){var e=this.player.plugins.stats;this.menuInst=new Menu(this.player,this.config||{},e)}}],[{key:"pluginName",get:function(){return"MenuPlugin"}},{key:"defaultConfig",get:function(){return{enableDebug:!0}}}]),r}(BasePlugin),ReportIcon='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.71429 5C5.3198 5 5 5.3198 5 5.71429V14.2857C5 14.6802 5.3198 15 5.71429 15H14.2857C14.6802 15 15 14.6802 15 14.2857V10C15 9.44772 15.4477 9 16 9C16.5523 9 17 9.44772 17 10V14.2857C17 15.7848 15.7848 17 14.2857 17H5.71429C4.21523 17 3 15.7848 3 14.2857V5.71429C3 4.21523 4.21523 3 5.71429 3H10C10.5523 3 11 3.44772 11 4C11 4.55228 10.5523 5 10 5H5.71429Z" fill="currentColor"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16.7071 3.29289C17.0976 3.68342 17.0976 4.31658 16.7071 4.70711L10.7071 10.7071C10.3166 11.0976 9.68342 11.0976 9.29289 10.7071C8.90237 10.3166 8.90237 9.68342 9.29289 9.29289L15.2929 3.29289C15.6834 2.90237 16.3166 2.90237 16.7071 3.29289Z" fill="currentColor"/></svg>',StatsIcon='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 10C9 9.44771 9.44771 9 10 9C10.5523 9 11 9.44772 11 10V13C11 13.5523 10.5523 14 10 14C9.44771 14 9 13.5523 9 13V10Z" fill="currentColor"/><path d="M10 6C9.44771 6 9 6.44772 9 7C9 7.55228 9.44771 8 10 8C10.5523 8 11 7.55228 11 7C11 6.44772 10.5523 6 10 6Z" fill="currentColor"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10ZM10 16C13.3137 16 16 13.3137 16 10C16 6.68629 13.3137 4 10 4C6.68629 4 4 6.68629 4 10C4 13.3137 6.68629 16 10 16Z" fill="currentColor"/></svg>',CloseIcon$1='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M16.1231 4.08053C16.5136 4.47105 16.5136 5.10422 16.1231 5.49474L11.453 10.1648L16.1231 14.8349C16.5136 15.2254 16.5136 15.8586 16.1231 16.2491C15.7326 16.6397 15.0994 16.6397 14.7089 16.2491L10.0388 11.579L5.36873 16.2491C4.9782 16.6397 4.34504 16.6397 3.95451 16.2491C3.56399 15.8586 3.56399 15.2254 3.95451 14.8349L8.6246 10.1648L3.95451 5.49474C3.56399 5.10422 3.56399 4.47105 3.95451 4.08053C4.34504 3.69001 4.9782 3.69001 5.36873 4.08053L10.0388 8.75061L14.7089 4.08053C15.0994 3.69 15.7326 3.69 16.1231 4.08053Z" fill="currentColor"/></svg>',CopyIcon='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M6 3C5.44772 3 5 3.44772 5 4C5 4.55228 5.44772 5 6 5H13.5C14.3284 5 15 5.67157 15 6.5V14C15 14.5523 15.4477 15 16 15C16.5523 15 17 14.5523 17 14V6.5C17 4.567 15.433 3 13.5 3H6ZM4 8H12V16H4L4 8ZM2 8C2 6.89543 2.89543 6 4 6H12C13.1046 6 14 6.89543 14 8V16C14 17.1046 13.1046 18 12 18H4C2.89543 18 2 17.1046 2 16V8ZM5.75 9.5C5.33579 9.5 5 9.83579 5 10.25C5 10.6642 5.33579 11 5.75 11H10.25C10.6642 11 11 10.6642 11 10.25C11 9.83579 10.6642 9.5 10.25 9.5H5.75ZM5 13.75C5 13.3358 5.33579 13 5.75 13H10.25C10.6642 13 11 13.3358 11 13.75C11 14.1642 10.6642 14.5 10.25 14.5H5.75C5.33579 14.5 5 14.1642 5 13.75Z" fill="currentColor"/></g></svg>',Menu=function(){function e(t,r,n){_classCallCheck(this,e),this.player=t,this.options=r||{},this.statsPlugin=n;var i={report:ReportIcon,stats:StatsIcon,close:CloseIcon$1,copy:CopyIcon},o=Object.assign({},i,this.options.icons);this.options.icons=o,this.playerInstance="dash_"+(new Date).getTime(),window[this.playerInstance]=this.player,this.menuItems=[{name:"视频统计信息",handler:this.showPanelInfo.bind(this),type:MENU_TYPES.STATS,icon:o.stats,eventName:LOG_EVENTS.STATS},{name:"播放问题反馈",handler:this._handleReport.bind(this),type:MENU_TYPES.REPORT,icon:o.report,eventName:LOG_EVENTS.REPORT}],this.playerHandler=[{evt:"RESOLUTION_UPDATE",handler:this._resolutionUpdate.bind(this)},{evt:"menusegment",handler:this._recordLastSegment.bind(this)},{evt:"resourceReady",handler:this._startup.bind(this)},{evt:"canplay",handler:this._startup.bind(this)},{evt:"ended",handler:this.destroyDOM.bind(this)},{evt:"destroy",handler:this.destroy.bind(this)},{evt:"playertypechange",handler:this.destroyDOM.bind(this)},{evt:"codecsupdate",handler:this._codecsUpdate.bind(this)}];for(var a=0;a<this.playerHandler.length;a++){var s=this.playerHandler[a],l=s.evt,c=s.handler;this.player.on(l,c)}this.debugInfo={ua:navigator.userAgent,version:this.player.playerVersion},this._pollTimer=null,this.hasInitDOM=!1,this._cacheMap={},this.menuHandler=this._menuHandler.bind(this),this.munuHideHandler=this._munuHideHandler.bind(this),this.rootClickHandler=this._rootClickHandler.bind(this),this._initDatas()}return _createClass$1(e,[{key:"_reset",value:function(){this.hasInitDOM=!1,this._cacheMap={},this._lastSegment=null}},{key:"_noop",value:function(){}},{key:"_recordLastSegment",value:function(e){this._lastSegment=e}},{key:"_resolutionUpdate",value:function(e){if(!this._cacheUpdate(INFO_TYPES.RESOLUTION)){var t=this.infoItems[INFO_TYPES.RESOLUTION];e?(t.value=e,this.updateInfoItem(t)):(t.hide=!0,this.createPanelInfo())}}},{key:"_codecsUpdate",value:function(e){if(!this._cacheUpdate(INFO_TYPES.CODECS)){var t=this.infoItems[INFO_TYPES.CODECS];t.value=e,this.updateInfoItem(t)}}},{key:"_cacheUpdate",value:function(e){return!this.hasInitDOM&&(this._cacheMap[e]=!0,!0)}},{key:"_handleReport",value:function(){for(var e=this.player.video.readyState,t=this.player.video.buffered,r=[],n=0;n<t.length;n++){var i=t.start(n),o=t.end(n);r.push({start:i,end:o})}var a={readyState:e,curTime:this.player.video.currentTime,err:this.player.video.error||-1,buffer:r},s=Object.assign({debug_date:new Date,type:this.type},this.debugInfo,{videoInfo:a});this._lastSegment&&(s.segment=this._lastSegment),this.options.enableDebug&&this.statsPlugin&&(s.stats=this.statsPlugin.getStats()),this.player.emit(EVENTS.MENU_REPORT,s)}},{key:"_startup",value:function(){if(!this.hasInitDOM){this.type=this.player.currentFormat,this._initDatas(),this._initDOM();for(var e=Object.keys(this._cacheMap),t=0;t<e.length;t++){var r=e[t],n=this.infoItems[r];this.updateInfoItem(n,!0)}}}},{key:"_initDatas",value:function(){var e;this.parentNode=this.player.root,this._isPlayQualitySupported=this.player.video&&"function"==typeof this.player.video.getVideoPlaybackQuality;var t=this.player.playerType,r=LANG_CONFIGS.cn,n=this.options.lang||"cn";this.langConfig=this.options.langConfig||LANG_CONFIGS[n]||r,this.infoItems=(_defineProperty$1(e={},INFO_TYPES.VID,{name:"VID",value:this.player.config.vid,render:renderPlainText,hide:!this.player.config.vid,key:"vid"}),_defineProperty$1(e,INFO_TYPES.TYPE,{name:"类型",value:t,render:renderPlainText,key:"player_type"}),_defineProperty$1(e,INFO_TYPES.CODECS,{name:"编码",value:this.player.menuCodeType,render:renderPlainText,key:"menuCodeType",hide:!this.player.menuCodeType}),_defineProperty$1(e,INFO_TYPES.SPEED,{name:"加载速度",value:0,render:renderPlainText,posfix:" KB/s",hide:!this._isMenusHide("speed"),key:"speed"}),_defineProperty$1(e,INFO_TYPES.BUFFER,{name:"缓冲时长",value:0,render:renderPlainText,posfix:"s",key:"buffer"}),_defineProperty$1(e,INFO_TYPES.PLAY_QUALITY,{name:"丢帧率",value:{droppedVideoFrames:0,totalVideoFrames:0},render:renderPlayQuality,hide:null===this.player.video.getVideoPlaybackQuality,key:"frames_info"}),_defineProperty$1(e,INFO_TYPES.SCHEME,{name:"视频协议",value:"HTTPS",render:renderPlainText,key:"scheme"}),_defineProperty$1(e,INFO_TYPES.CDN,{name:"CDN",value:this.player.CDNUrl?this.player.CDNUrl:"false",render:renderPlainText,hide:!this._isMenusHide("cdn"),key:"CDN"}),_defineProperty$1(e,INFO_TYPES.P2P,{name:"P2P",value:"false",render:renderPlainText,hide:!0,key:"p2p"}),_defineProperty$1(e,INFO_TYPES.RESOLUTION,{name:"分辨率",value:{width:0,height:0,fps:void 0},render:renderResolution,hide:!this._isMenusHide("resolution"),key:"resolution"}),_defineProperty$1(e,INFO_TYPES.VIEWPORT,{name:"视图尺寸",value:{width:0,height:0},render:renderResolution,key:"viewport"}),_defineProperty$1(e,INFO_TYPES.VOLUME,{name:"音量大小",value:(100*this.player.config.volume).toFixed(0)+"%",render:renderPlainText,key:"volume"}),_defineProperty$1(e,INFO_TYPES.PLAYER_VERSION,{name:"播放器版本",value:this.player.playerVersion,render:renderPlainText,key:"player_version"}),e);for(var i=Object.keys(this.infoItems),o=0;o<i.length;o++){var a=i[o];this.infoItems[a].type=a}for(var s=this.options.infoItems||[],l=0;l<s.length;l++){var c=s[l];c.name&&c.type&&c.key?(c.render&&isFunction(c.render)||(c.render=renderPlainText),this.infoItems[c.type]=c):warn("".concat(c.name))}}},{key:"_isMenusHide",value:function(e){return!0===(this.player.supportMenus||{})[e]}},{key:"renderItemByType",value:function(e,t){var r=this.infoItems[e];r?(r.value=t,this._cacheUpdate(e)||this.updateInfoItem(r)):warn("".concat(e," item null"))}},{key:"_initDOM",value:function(){if(this.parentNode&&util){this.hasInitDOM=!0;var e=document.createDocumentFragment(),t=document.createElement("xg-menu");util.addClass(t,"xg-menu"),this.rightMenu=t;for(var r=this.menuItems.filter((function(e){return!e.hide})),n=0;n<r.length;n++)e.appendChild(this.createMenuItem(r[n]));t.appendChild(e),this.toggle(this.rightMenu,!1),this.parentNode.appendChild(t),this.parentNode.addEventListener("contextmenu",this.menuHandler,!1),document.addEventListener("click",this.munuHideHandler,!1),this.parentNode.addEventListener("click",this.rootClickHandler,!0),this.createPanelInfo(),this.bindEvents(),this.tick()}}},{key:"_menuHandler",value:function(e){if(e.preventDefault(),e.stopPropagation(),this.isPIPMode())return!1;var t=this.getOffset(),r=e.clientX-t.x+document.body.scrollLeft+document.documentElement.scrollLeft,n=e.clientY-t.y+document.body.scrollTop+document.documentElement.scrollTop,i=this.parentNode.clientWidth,o=this.parentNode.clientHeight;this.toggle(this.rightMenu,!0);var a=this.rightMenu.offsetWidth,s=this.rightMenu.offsetHeight,l=r+a>i?i-a:r,c=n+s>o?o-s:n;this.rightMenu.style.left=l+"px",this.rightMenu.style.top=c+"px",this.emitLog(LOG_TYPES.CONTEXTMENU,CONTEXTMENU_TYPES.SHOW,LOG_EVENTS.CONTEXTMENU_SHOW)}},{key:"getOffset",value:function(){for(var e=this.parentNode,t=0,r=0;e&&!Number.isNaN(e.offsetLeft)&&!Number.isNaN(e.offsetTop);)t+=e.offsetLeft-e.scrollLeft,r+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:r}}},{key:"_munuHideHandler",value:function(){this.rightMenu&&"block"===this.rightMenu.style.display&&this.emitLog(LOG_TYPES.CONTEXTMENU,CONTEXTMENU_TYPES.HIDE,LOG_EVENTS.CONTEXTMENU_HIDE),this.toggle(this.rightMenu,!1)}},{key:"_rootClickHandler",value:function(e){"block"===this.rightMenu.style.display&&e.target===this.player.video&&(e.stopPropagation(),e.preventDefault(),this._munuHideHandler())}},{key:"tick",value:function(){var e=this;this._pollTimer=setTimeout((function(){clearTimeout(e._pollTimer),e._poll(),e.tick(),e.isPIPMode()&&(e.toggle(e.rightMenu,!1),e.toggle(e.panelInfo,!1))}),500)}},{key:"_poll",value:function(){var e=this.bufferLength,t=this.infoItems[INFO_TYPES.BUFFER];if(t.value=e,this.updateInfoItem(t),this.player.video.getVideoPlaybackQuality){var r=this.player.video.getVideoPlaybackQuality(),n=this.infoItems[INFO_TYPES.PLAY_QUALITY];n.value={totalVideoFrames:r.totalVideoFrames,droppedVideoFrames:r.droppedVideoFrames},this.updateInfoItem(n)}var i=this.infoItems[INFO_TYPES.SPEED];if(!i.hide){var o=Math.floor(this.player.downloadSpeed);i.value=o,this.updateInfoItem(i)}}},{key:"bindEvents",value:function(){var e=this,t=this.player.video;this.handleVolumeChange=this._handleVolumeChange.bind(this),t.addEventListener("volumechange",this.handleVolumeChange);t.addEventListener("DOMNodeInserted",(function r(){t.removeEventListener("DOMNodeInserted",r),e._onWinElemSizeChange()})),this.onWinSizeChange=debounce(this._onWinElemSizeChange.bind(this),1e3,!1),window.addEventListener("resize",this.onWinSizeChange),e._onWinElemSizeChange()}},{key:"_onWinElemSizeChange",value:function(){if(this.player&&this.player.video){var e=this.player.video.getBoundingClientRect(),t=this.infoItems[INFO_TYPES.VIEWPORT];if(t.value={width:Math.floor(e.width),height:Math.floor(e.height)},this._cacheUpdate(INFO_TYPES.VIEWPORT))return;this.updateInfoItem(t)}}},{key:"_handleVolumeChange",value:function(){var e=this.infoItems[INFO_TYPES.VOLUME];e.value=(100*this.player.video.volume).toFixed(0)+"%",this._cacheUpdate(INFO_TYPES.VOLUME)||this.updateInfoItem(e)}},{key:"createMenuItem",value:function(e){var t=this,r=document.createElement("div");if(r.classList.add("v-menu-item"),e.clsName&&r.classList.add(e.clsName),e.icon){var n=document.createElement("div");util.addClass(n,"menu-item-icon"),n.innerHTML=e.icon,r.appendChild(n)}var i=document.createElement("div");return util.addClass(i,"menu-item-content"),i.textContent=e.name,r.appendChild(i),!1!==r.clickable&&r.addEventListener("click",(function(r){r.stopPropagation(),r.preventDefault(),t.toggle(t.rightMenu,!1),e.handler(),t.emitLog(LOG_TYPES.MENU,e.type,e.eventName)})),r}},{key:"createIconBtn",value:function(e,t,r,n){var i=document.createElement("div");return util.addClass(i,e),i.innerHTML=t+"<div class='svg-hover'>".concat(r,"</div>"),n.appendChild(i),i}},{key:"createPanelInfo",value:function(){var e=this,t=document.createElement("xg-panel-info");util.addClass(t,"xg-panel-info"),this.createIconBtn("xg-info-close xg-interact-icon",this.options.icons.close,"关闭",t).addEventListener("click",(function(){e.toggle(t,!1),e.panelVisible=!1,e.emitLog(LOG_TYPES.INTERACT,INTERACT_TYPES.CLOSE,LOG_EVENTS.CLOSE)})),this.createIconBtn("xg-info-copy xg-interact-icon",this.options.icons.copy,"复制",t).addEventListener("click",(function(){for(var t=Object.values(e.infoItems).filter((function(e){return!e.hide})),r={},n=0;n<t.length;n++){var i=t[n],o=i.key,a=void 0;a=e.options.connectPrefix&&i.posfix?"".concat(i.value).concat(i.posfix):i.value,r[o]=a}e.options.enableDebug&&e.statsPlugin&&Object.assign(r,{stats:e.statsPlugin.getStats()}),e.copyToClipboard(JSON.stringify(r)),e.emitLog(LOG_TYPES.INTERACT,INTERACT_TYPES.COPY,LOG_EVENTS.COPY)}));var r=document.createElement("ul");util.addClass(r,"xg-panel-detail");for(var n=Object.values(this.infoItems).filter((function(e){return!e.hide})),i=document.createDocumentFragment(),o=0;o<n.length;o++){var a=this.createInfoItem(n[o]);i.appendChild(a)}r.appendChild(i),t.appendChild(r),this.panelInfo=t,this.player.root.appendChild(t)}},{key:"createInfoItem",value:function(e){var t=document.createElement("li");return e.elem=t,this.updateInfoItem(e),t}},{key:"showPanelInfo",value:function(){this.toggle(this.panelInfo,!0),this.panelVisible=!0;for(var e=Object.values(this.infoItems).filter((function(e){return!e.hide})),t=0;t<e.length;t++)this.updateInfoItem(e[t])}},{key:"copyToClipboard",value:function(e){var t=document.createElement("textarea");t.style.height="0px",t.style.width="1px",document.body.appendChild(t),t.value=e,t.select(),document.execCommand("copy"),document.body.removeChild(t)}},{key:"updateInfoItem",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.panelVisible||t){var r=e.elem;removeAllChildren(r);var n=document.createElement("label"),i=this.langConfig[e.type]||e.name;n.textContent=i+"",util.addClass(n,"xg-item-label"),r.appendChild(n);var o=document.createElement("span"),a=e.ctx||null,s=e.render.call(a,e.value);s instanceof Element?o.appendChild(s):o.textContent="".concat(s).concat(e.posfix?e.posfix:""),r.appendChild(o)}}},{key:"toggle",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e&&(e.style.display=t?"block":"none")}},{key:"bufferLength",get:function(){var e=this.player.getBufferedRange(),t=this.player.video.currentTime,r=e[1]-Math.max(e[0],t);return r=Math.max(0,r).toFixed(2),parseFloat(r)}},{key:"destroyDOM",value:function(){this.parentNode.removeEventListener("contextmenu",this.menuHandler),document.removeEventListener("click",this.munuHideHandler,!1),this.parentNode.removeEventListener("click",this.rootClickHandler,!0),this._reset(),this.removeElement(this.rightMenu),this.removeElement(this.panelInfo),this.rightMenu=null,this.panelInfo=null,this._pollTimer&&clearTimeout(this._pollTimer)}},{key:"destroy",value:function(){this.destroyDOM(),this.destroyEvents()}},{key:"destroyEvents",value:function(){for(var e=0;e<this.playerHandler.length;e++){var t=this.playerHandler[e],r=t.evt,n=t.handler;this.player.off(r,n)}window.removeEventListener("resize",this.onWinSizeChange)}},{key:"removeElement",value:function(e){e&&e.parentNode&&e.parentNode.removeChild(e)}},{key:"isPIPMode",value:function(){return util.hasClass(this.parentNode,"xgplayer-pip-active")}},{key:"emitLog",value:function(e,t,r){this.player.emit(EVENTS.MENU_LOG,{logType:e,code:t,event:r})}}]),e}();function renderPlainText(e){return e}function renderPlayQuality(e){var t=e.droppedVideoFrames,r=e.totalVideoFrames,n=0;n=0===r?0:t/r*100;var i=document.createElement("span"),o=document.createElement("span");o.textContent=t,i.appendChild(o);var a=document.createElement("span");return a.textContent="/".concat(r,", ").concat(n.toFixed(2),"%"),i.appendChild(a),i}function renderResolution(e){var t=e.width,r=e.height,n=e.fps;return"".concat(t," * ").concat(r).concat(void 0!==n?" / ".concat(n,"fps"):"")}function removeAllChildren(e){for(;e&&e.firstChild;)e.removeChild(e.firstChild)}function warn(e){console&&console.warn&&console.warn(e)}function isFunction(e){return"[object Function]"===Object.prototype.toString.call(e)}MenuPlugin.MenuEvents=events,MenuPlugin.Menu=Menu;var NativeSubTitle=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),_defineProperty$6(_assertThisInitialized$5(n=t.call(this)),"_onChange",(function(e){var t=n._media.textTracks;if(t&&0!==t.length){for(var r=[],i=[],o=-1,a=0;a<t.length;a++){var s=t[a];"subtitles"===s.kind&&(r.push({id:s.id||s.language,language:s.language,text:s.label,isDefault:"showing"===s.mode}),-1===o&&"showing"===s.mode&&(o=a),i.push(s.language))}i.join("|")!==n._languages?(n._languages=i.join("|"),n.emit("reset",{list:r,isOpen:o>-1})):-1===o?n.emit("off"):n.curIndex!==o&&n.emit("change",r[o]),n.curIndex=o}})),n._media=e,n._list=[],n._languages="",n.curIndex=-1,n._init(),n}return _createClass$6(r,[{key:"_init",value:function(){var e=this._media.textTracks;e?(e.addEventListener("change",this._onChange),e.addEventListener("addtrack",this._onChange)):console.warn("current browser not support native subtitle")}},{key:"switch",value:function(e){var t=this;return new Promise((function(r,n){if(!e)return n({code:1,message:"no subtitle data"});for(var i=t._media.textTracks,o=0;o<i.length;o++){var a=i[o];a.language===e.language?a.mode="showing":"showing"===a.mode&&(a.mode="disabled")}return r({code:0})}))}},{key:"switchOff",value:function(){for(var e=this._media.textTracks,t=0;t<e.length;t++)e[t].mode="disabled";this.curIndex=-1}},{key:"destroy",value:function(){this._media.textTracks.removeEventListener("change",this._onChange),this._media=null,this._list=[],this._languages="",this.curIndex=-1}}]),r}(EventEmitter);function OpenIcon(){return(new DOMParser).parseFromString('<svg width="18" height="16" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2 0.5C0.895431 0.5 0 1.39543 0 2.5V13.5C0 14.6046 0.89543 15.5 2 15.5H16C17.1046 15.5 18 14.6046 18 13.5V2.5C18 1.39543 17.1046 0.5 16 0.5H2ZM7.49634 11.0454C8.00741 10.606 8.29061 10.0037 8.34595 9.23877H6.8811C6.84855 9.67171 6.71997 9.99235 6.49536 10.2007C6.27401 10.4058 5.93709 10.5083 5.48462 10.5083C4.98332 10.5083 4.61548 10.3309 4.3811 9.97607C4.14998 9.62126 4.03442 9.05973 4.03442 8.2915V7.75439C4.04093 7.01872 4.16463 6.47673 4.40552 6.12842C4.64966 5.77686 5.01587 5.60107 5.50415 5.60107C5.95337 5.60107 6.28703 5.70524 6.50513 5.91357C6.72648 6.11865 6.85506 6.45068 6.89087 6.90967H8.35571C8.27759 6.1154 7.98787 5.49854 7.48657 5.05908C6.98527 4.61963 6.32446 4.3999 5.50415 4.3999C4.9117 4.3999 4.39087 4.53988 3.94165 4.81982C3.49569 5.09652 3.15226 5.49528 2.91138 6.01611C2.67049 6.53695 2.55005 7.13916 2.55005 7.82275V8.25732C2.55005 9.32829 2.81047 10.1714 3.3313 10.7866C3.85539 11.3986 4.57316 11.7046 5.48462 11.7046C6.31795 11.7046 6.98853 11.4849 7.49634 11.0454ZM14.5393 11.0454C15.0504 10.606 15.3336 10.0037 15.3889 9.23877H13.9241C13.8915 9.67171 13.7629 9.99235 13.5383 10.2007C13.317 10.4058 12.9801 10.5083 12.5276 10.5083C12.0263 10.5083 11.6584 10.3309 11.4241 9.97607C11.193 9.62126 11.0774 9.05973 11.0774 8.2915V7.75439C11.0839 7.01872 11.2076 6.47673 11.4485 6.12842C11.6926 5.77686 12.0588 5.60107 12.5471 5.60107C12.9963 5.60107 13.33 5.70524 13.5481 5.91357C13.7695 6.11865 13.898 6.45068 13.9338 6.90967H15.3987C15.3206 6.1154 15.0308 5.49854 14.5295 5.05908C14.0282 4.61963 13.3674 4.3999 12.5471 4.3999C11.9547 4.3999 11.4338 4.53988 10.9846 4.81982C10.5387 5.09652 10.1952 5.49528 9.95435 6.01611C9.71346 6.53695 9.59302 7.13916 9.59302 7.82275V8.25732C9.59302 9.32829 9.85343 10.1714 10.3743 10.7866C10.8984 11.3986 11.6161 11.7046 12.5276 11.7046C13.3609 11.7046 14.0315 11.4849 14.5393 11.0454Z" fill="white"/>\n</svg>',"image/svg+xml").firstChild}function CloseIcon(){return(new DOMParser).parseFromString('<svg width="18" height="16" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.49609 11.0454C8.00716 10.606 8.29037 10.0037 8.3457 9.23877H6.88086C6.84831 9.67171 6.71973 9.99235 6.49512 10.2007C6.27376 10.4058 5.93685 10.5083 5.48438 10.5083C4.98307 10.5083 4.61523 10.3309 4.38086 9.97607C4.14974 9.62126 4.03418 9.05973 4.03418 8.2915V7.75439C4.04069 7.01872 4.16439 6.47673 4.40527 6.12842C4.64941 5.77686 5.01562 5.60107 5.50391 5.60107C5.95312 5.60107 6.28678 5.70524 6.50488 5.91357C6.72624 6.11865 6.85482 6.45068 6.89062 6.90967H8.35547C8.27734 6.1154 7.98763 5.49854 7.48633 5.05908C6.98503 4.61963 6.32422 4.3999 5.50391 4.3999C4.91146 4.3999 4.39062 4.53988 3.94141 4.81982C3.49544 5.09652 3.15202 5.49528 2.91113 6.01611C2.67025 6.53695 2.5498 7.13916 2.5498 7.82275V8.25732C2.5498 9.32829 2.81022 10.1714 3.33105 10.7866C3.85514 11.3986 4.57292 11.7046 5.48438 11.7046C6.31771 11.7046 6.98828 11.4849 7.49609 11.0454Z" fill="white"/>\n<path d="M14.5391 11.0454C15.0501 10.606 15.3333 10.0037 15.3887 9.23877H13.9238C13.8913 9.67171 13.7627 9.99235 13.5381 10.2007C13.3167 10.4058 12.9798 10.5083 12.5273 10.5083C12.026 10.5083 11.6582 10.3309 11.4238 9.97607C11.1927 9.62126 11.0771 9.05973 11.0771 8.2915V7.75439C11.0837 7.01872 11.2074 6.47673 11.4482 6.12842C11.6924 5.77686 12.0586 5.60107 12.5469 5.60107C12.9961 5.60107 13.3298 5.70524 13.5479 5.91357C13.7692 6.11865 13.8978 6.45068 13.9336 6.90967H15.3984C15.3203 6.1154 15.0306 5.49854 14.5293 5.05908C14.028 4.61963 13.3672 4.3999 12.5469 4.3999C11.9544 4.3999 11.4336 4.53988 10.9844 4.81982C10.5384 5.09652 10.195 5.49528 9.9541 6.01611C9.71322 6.53695 9.59277 7.13916 9.59277 7.82275V8.25732C9.59277 9.32829 9.85319 10.1714 10.374 10.7866C10.8981 11.3986 11.6159 11.7046 12.5273 11.7046C13.3607 11.7046 14.0312 11.4849 14.5391 11.0454Z" fill="white"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.5C0 1.39543 0.895431 0.5 2 0.5H16C17.1046 0.5 18 1.39543 18 2.5V13.5C18 14.6046 17.1046 15.5 16 15.5H2C0.89543 15.5 0 14.6046 0 13.5V2.5ZM2 2.3H16C16.1105 2.3 16.2 2.38954 16.2 2.5V13.5C16.2 13.6105 16.1105 13.7 16 13.7H2C1.88954 13.7 1.8 13.6105 1.8 13.5V2.5C1.8 2.38954 1.88954 2.3 2 2.3Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}var index_min$1="",POSITIONS$7=Plugin.POSITIONS,IS_MOBILE="mobile"===sniffer$1.device,DEFAULT_CLOSE_TYPE="text-close";function formatList(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=-1;return e.map((function(e,r){e.id||e.language||(e.id=""+r),!e.url&&(e.url=e.src),!e.text&&(e.text=e.label),!e.language&&(e.language=e.srclang),void 0===e.isDefault&&(e.isDefault=e.default),(e.isDefault||e.default)&&(t<0?t=r:e.isDefault=e.default=!1)})),t}var Subtitle=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;_classCallCheck$5(this,r),(n=t.call(this,e)).isOpenState=!0,n.optionList=null,n.currentLang="",n.handlerClickSwitch=function(e,t){e.stopPropagation(),e.preventDefault(),n.subTitles&&(t.type===DEFAULT_CLOSE_TYPE?n.switchOffSubtitle():n.switchSubTitle({language:t.language,id:t.id}))},n.onPlayerFocus=function(e){n.subTitles&&n.config.style.follow&&n.rePosition()},n.onPlayerBlur=function(e){n.subTitles&&n.config.style.follow&&!n.playerConfig.marginControls&&n.subTitles.root&&(n.subTitles.root.style.transform="translate(0, 0)")};var i=e.player;return e.config,i.config.isLive&&(e.config.updateMode="live",sniffer$1.os.isIos&&(e.config.mode="native")),n}return _createClass$6(r,[{key:"afterCreate",value:function(){var e=this.config.list,t=void 0===e?[]:e;this.curIndex=-1,this.curItem=null;var n=formatList(t);_get$3(_getPrototypeOf$5(r.prototype),"afterCreate",this).call(this),"native"===this.config.mode?this._initNativeSubtitle(n):this._initExtSubTitle(n)}},{key:"_initNativeSubtitle",value:function(e){var t=this.player;t._subTitles||(t._subTitles=new NativeSubTitle(t.video)),this.subTitles=t._subTitles,this.subTitles.on("off",this._onOff.bind(this)),this.subTitles.on("change",this._onChange.bind(this)),this.subTitles.on("reset",this._onListReset.bind(this)),this._renderList(e)}},{key:"_initExtSubTitle",value:function(e){var t=this.config,r=t.list,n=void 0===r?[]:r,i=t.style,o=t.isDefaultOpen,a={subTitles:n,defaultOpen:o,debugger:!1,updateMode:t.updateMode};this.isOpenState=o,Object.keys(i).map((function(e){a[e]=i[e]})),!this.playerConfig.marginControls&&this.player.controls.root&&(this.on(PLAYER_FOCUS,this.onPlayerFocus),this.on(PLAYER_BLUR,this.onPlayerBlur));var s=this.player;s._subTitles?s._subTitles._isOpen&&(e=this.getSubTitleIndex(this.config.list,s._subTitles.currentText)):(s._subTitles=new Subtitle$1(a),s._subTitles.attachPlayer(this.player),this.changeTipText()),this.subTitles=s._subTitles,this.subTitles.on("off",this._onOff.bind(this)),this.subTitles.on("change",this._onChange.bind(this)),this.subTitles.on("reset",this._onListReset.bind(this)),i.follow&&this.subTitles.root&&util.addClass(this.subTitles.root,"follow-control"),this._renderList(e)}},{key:"_renderList",value:function(e){var t=this.config,r=t.list,n=void 0===r?[]:r,i=t.isDefaultOpen;n.length&&(i&&e<0?(n[0].isDefault=!0,this.curIndex=0,this.curItem=n[0]):(this.curIndex=e,this.curItem=n[e])),this.appendChild(".xgplayer-icon",this.icons.vttSubOpen),this.appendChild(".xgplayer-icon",this.icons.vttSubClose),this.creatOptionList(),this.initEvents(),this.isOpenState?util.addClass(this.root,"isOpen"):util.addClass(this.root,"isClose")}},{key:"_onOff",value:function(){this.noShowSubtitle()}},{key:"_onChange",value:function(e){var t=this.getSubTitleIndex(this.config.list,e);t<0||this.updateCurItem(t,e)}},{key:"_onListReset",value:function(e){this.updateList(e)}},{key:"updateCurItem",value:function(e,t){this.curIndex=e,this.curItem=this.config.list[e-1],this.renderItemList(),this.emit("subtitle_change",_objectSpread2$5({off:!1,isListUpdate:!1,list:[]},t))}},{key:"initEvents",value:function(){this.bind(["click"],this.handleButtonChange.bind(this)),this.bind(["mouseenter"],this.showList.bind(this)),this.bind(["mouseleave"],this.hideList.bind(this)),this._delegates=[]}},{key:"handleButtonChange",value:function(e){e.preventDefault(),e.stopPropagation(),e.delegateTarget||(IS_MOBILE?this.showMobilePanel():this.isOpenState?this.switchOffSubtitle():this.openSubtitle())}},{key:"showList",value:function(){var e;!IS_MOBILE&&this.isOpenState&&(null===(e=this.optionList)||void 0===e||e.show())}},{key:"hideList",value:function(){var e;!IS_MOBILE&&this.isOpenState&&(null===(e=this.optionList)||void 0===e||e.hide())}},{key:"openSubtitle",value:function(){this.curIndex>-1&&this.curItem&&this.switchSubTitle(this.curItem)}},{key:"getSubTitleIndex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{id:"",language:""},r=-1;return t&&(t.id||t.language)?(e.forEach((function(e,n){e.id!==t.id&&e.language!==t.language||(r=n)})),r):r}},{key:"registerIcons",value:function(){return{vttSubOpen:{icon:OpenIcon,class:"xgplayer-vttsub-open-svg"},vttSubClose:{icon:CloseIcon,class:"xgplayer-vttsub-close-svg"}}}},{key:"registerLanguageTexts",value:function(){return{sub:{jp:"字幕",en:"Subtitles",zh:"字幕","zh-hk":"字幕"},subOpen:{jp:"字幕をオンにする",en:"Show subtitles",zh:"开启字幕","zh-hk":"開啟字幕"},subClose:{jp:"クローズドキャプション",en:"Hide subtitles",zh:"关闭字幕","zh-hk":"關閉字幕"}}}},{key:"creatOptionList",value:function(){var e=this;if(!IS_MOBILE){var t={config:{data:this.getList(),className:"",onItemClick:function(t,r){e.handlerClickSwitch(t,null==r?void 0:r.to)}},root:this.root};this.optionList=new OptionList(t)}}},{key:"getList",value:function(){var e=this;return this.config.list.map((function(t,r){return r===e.curIndex&&e.isOpenState?(t.isCurrent=!0,t.selected=!0):(t.isCurrent=!1,t.selected=!1),t.showText=e.getTextByLang(t),t}))}},{key:"renderOptionList",value:function(){this.optionList.renderItemList(this.getList())}},{key:"switchSubTitle",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:"",language:""},r=-1;if(t&&(t.id||t.language)&&(this.config.list.map((function(e,n){e.id+""==t.id+""&&e.language+""==t.language+""&&(r=n)})),!(r<0||this.isOpenState&&r===this.curIndex)))return this.subTitles.switch(t).then((function(n){0===n.code&&(t.off=!1,t.isListUpdate=!1,t.list=[],e.curIndex=r,e.curItem=e.config.list[r],e.isOpenState=!0,util.removeClass(e.root,"isClose"),util.addClass(e.root,"isOpen"),e.renderItemList(),e.changeTipText(),e.emit("subtitle_change",t))})).catch((function(e){return console.error("switch subtitle err: ",e)}))}},{key:"switchOffSubtitle",value:function(){this.subTitles.switchOff(),this.noShowSubtitle()}},{key:"noShowSubtitle",value:function(){var e;this.emit("subtitle_change",{off:!0,isListUpdate:!1,list:[]}),this.isOpenState=!1,util.addClass(this.root,"isClose"),util.removeClass(this.root,"isOpen"),this.renderItemList(),this.changeTipText(),null===(e=this.optionList)||void 0===e||e.hide()}},{key:"renderItemList",value:function(){IS_MOBILE?this.updatePanel():this.renderOptionList()}},{key:"updateSubtitles",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e&&(this.updateList(),this.subTitles&&this.subTitles.setSubTitles(this.config.list,this.curIndex>-1,t))}},{key:"updateList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.list){var t=[];e.list.map((function(e){t.push(e)}));var r,n=formatList(t);if(e.isOpen)this.isOpenState=!0,this.curIndex=n,this.curItem=n>-1?t[n]:null,util.removeClass(this.root,"isClose"),util.addClass(this.root,"isOpen");else this.isOpenState=!1,this.curIndex=-1,this.curItem=null,util.removeClass(this.root,"isOpen"),util.addClass(this.root,"isClose"),this.changeTipText(),null===(r=this.optionList)||void 0===r||r.hide();if(this.config.list=t,t.length>0){var i;if(!IS_MOBILE)null===(i=this.optionList)||void 0===i||i.hide()}else{var o,a;if(this.switchOffSubtitle(),IS_MOBILE?this.showMobilePanel():null===(o=this.optionList)||void 0===o||o.show(),!IS_MOBILE)null===(a=this.optionList)||void 0===a||a.hide();this.hide()}this.renderItemList()}}},{key:"changeTipText",value:function(){this.isOpenState?this.find(".xg-tips").innerHTML=this.langText.subClose:this.find(".xg-tips").innerHTML=this.langText.subOpen}},{key:"showMobilePanel",value:function(){var e,t=this.renderPanel();null===(e=this.player.panel)||void 0===e||e.showPanel(t,this.langText.sub,!0)}},{key:"updatePanel",value:function(){var e,t=this.renderPanel();null===(e=this.player.panel)||void 0===e||e.updatePanel(t)}},{key:"renderPanel",value:function(){var e=this,t=_toConsumableArray$1(this.config.list),r=util.createDom("div","",{},"ai-panel-content");t.map((function(t,n){var i=_objectSpread2$5({language:t.language||t.srclang,"data-id":t.id,selected:e.isOpenState&&e.curIndex===n,showText:e.getTextByLang(t)},t),o=e.renderPanelItem(i);r.appendChild(o)}));var n={showText:this.langText.subClose,"data-type":DEFAULT_CLOSE_TYPE,selected:!this.isOpenState};return r.appendChild(this.renderPanelItem(n)),r}},{key:"renderPanelItem",value:function(e){var t=this,r=e.showText,n=e.selected,i=util.createDom("div","",{language:e.language,"data-id":e["data-id"],"data-type":e["data-type"]},"panel-Item ".concat(n?"select-in":""));i.innerHTML=r;var o=IS_MOBILE?"touchend":"click",a=Plugin.delegate(i,".panel-Item",o,(function(r){e["data-type"]===DEFAULT_CLOSE_TYPE?(r.stopPropagation(),r.preventDefault(),t.switchOffSubtitle()):t.handlerClickSwitch(r,e)}));return this._delegates.push(a),i}},{key:"getTextByLang",value:function(e,t,r){if(void 0===e)return"";var n=this.config.list;return!r&&(r=this.player.lang),t=!t||util.isUndefined(e[t])?"text":t,"number"==typeof e&&(e=n[e]),"object"===_typeof$4(e[t])?e[t][r]||e[t].zh:e[t]||""}},{key:"rePosition",value:function(){var e=this.config.style.fitVideo,t=0-this.player.controls.root.getBoundingClientRect().height;if(e){var r=this.player,n=r.video,i=r.root.getBoundingClientRect(),o=i.height,a=i.width,s=n.videoHeight,l=n.videoWidth,c=parseInt(s/l*100,10)*a/100;c>o&&(c=o);var u=(o-c)/2-t;u<0&&(this.subTitles.root.style.transform="translate(0, ".concat(u,"px)"))}else this.subTitles.root.style.transform="translate(0, ".concat(t,"px)")}},{key:"destroy",value:function(){var e;this.subTitles&&(this.subTitles.destroy(),this.subTitles=null),this.unbind(["click"],this.handleButtonChange.bind(this)),this.unbind(["mouseenter"],this.showList.bind(this)),this.unbind(["mouseleave"],this.hideList.bind(this)),null===(e=this.optionList)||void 0===e||e.destroy(),this._delegates&&this._delegates.length>0&&(this._delegates.map((function(e){Array.isArray(e)&&e.map((function(e){e.destroy&&e.destroy()})),e.destroy&&e.destroy()})),this._delegates=null),_get$3(_getPrototypeOf$5(r.prototype),"destroy",this).call(this)}},{key:"render",value:function(){return'\n <xg-icon class="xgplayer-vttsub">\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="vttSubOpen">'.concat(this.langText.subOpen,"</div>\n </xg-icon>\n ")}}],[{key:"pluginName",get:function(){return"Subtitle"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$7.CONTROLS_RIGHT,index:CONTROL_ICON_INDEX.Subtitle,list:[],isDefaultOpen:!0,style:{follow:!0,mode:"stroke",followBottom:50,fitVideo:!0,offsetBottom:4,baseSizeX:49,baseSizeY:28,minSize:16,minMobileSize:13,line:"double",fontColor:"#fff"},isShowIcon:!0,mode:"external",updateMode:"vod"}}}]),r}(Plugin),index$3="",ToastPlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),(n=t.call(this,e)).toastNumber=0,n.toastMaps={},n}return _createClass$6(r,[{key:"beforePlayerInit",value:function(){}},{key:"afterPlayerInit",value:function(){}},{key:"afterCreate",value:function(){}},{key:"destroy",value:function(){}},{key:"add",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this.toastNumber+1;this.toastNumber=i;var o=this.renderToast(e,n,i);return this.root.appendChild(o),this.toastMaps[i]=o,r&&setTimeout((function(){t.remove(i)}),r),i}},{key:"remove",value:function(e){var t=this.toastMaps[e];t&&(this.root.contains(t)&&this.root.removeChild(t),delete this.toastMaps[e])}},{key:"renderToast",value:function(e,t,r){var n=this,i=util.createDom("div","",void 0,"toast-container"),o=util.checkIsObject(e)?e:util.createDom("div",e,void 0,"toast-txt");if(i.appendChild(o),t){var a=util.createDom("span","×",void 0,"toast-close-bt");a.addEventListener("click",(function(){n.remove(r)})),i.appendChild(a)}return i}},{key:"render",value:function(){return'<xg-sdk-toast class="xgplayer-sdk-toast"></xg-sdk-toast>'}}],[{key:"pluginName",get:function(){return"sdkToastPlugin"}},{key:"defaultConfig",get:function(){return{index:5}}}]),r}(Plugin),Hook=function(){function e(){_classCallCheck$5(this,e),this._hooks={},this._cache=[],this._hooksCache={}}return _createClass$6(e,[{key:"on",value:function(e,t){e&&t&&"function"==typeof t&&(this._hooks[e]||(this._hooks[e]=[]),this._hooks[e].push(t))}},{key:"once",value:function(e,t){var r=this;if(e&&t&&"function"==typeof t){this.on(e,(function n(i){t(i),r.off(e,n)}))}}},{key:"off",value:function(e,t){if(e&&this._hooks[e]&&this._hooks[e].length)if(t){var r=this._hooks[e].indexOf(t);-1!==r&&this._hooks[e].splice(r,1)}else this._hooks[e]=[]}},{key:"emit",value:function(e,t,r){if(r){if(!e)return;-1!==this._cache.indexOf(r)?this._emit(e,t):(this._hooksCache.hasOwnProperty(r)||(this._hooksCache[r]={}),this._hooksCache[r].hasOwnProperty(e)||(this._hooksCache[r][e]=[]),this._hooksCache[r][e].push(t))}else this._emit(e,t)}},{key:"_emit",value:function(e,t){e&&this._hooks[e]&&this._hooks[e].length&&_toConsumableArray$1(this._hooks[e]).forEach((function(e){try{e(t)}catch(e2){}}))}},{key:"set",value:function(e){e&&-1===this._cache.indexOf(e)&&this._cache.push(e)}}]),e}(),isObject=function(e){return null!=e&&"[object Object]"==Object.prototype.toString.call(e)},isNumber=function(e){return"number"==typeof e&&!isNaN(e)},isString=function(e){return"string"==typeof e},getIndex=(lastEventId2=+Date.now()+Number("".concat(Math.random()).slice(2,8)),function(){return lastEventId2+=1}),lastEventId2,decrypto=function(e,t,r){if("string"==typeof e&&"number"==typeof t&&"number"==typeof r){var n,i=[];r=r<=25?r:r%25;var o=String.fromCharCode(r+97);n=e.split(o);for(var a=0;a<n.length;a++){var s=parseInt(n[a],r);s=1*s^t;var l=String.fromCharCode(s);i.push(l)}return i.join("")}},decodeUrl=function(e){return decrypto(e,64,25)},beforePageUnload=function(e){!!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)?window.addEventListener("pagehide",e,!1):window.addEventListener("beforeunload",e,!1)},parseURL=function(e){var t=document.createElement("a");return t.href=e,t},parseUrlQuery=function(e){var t={};try{var r=parseURL(e).search;(r=r.slice(1)).split("&").forEach((function(e){var r,n,i=e.split("=");i.length&&(r=i[0],n=i[1]);try{t[r]=decodeURIComponent(void 0===n?"":n)}catch(e2){t[r]=n}}))}catch(e2){}return t},hashCode=function(e){for(var t=0,r=0,n=(e+="").length,i=0;i<n;i++)((t=31*t+e.charCodeAt(r++))>0x7fffffffffff||t<-0x800000000000)&&(t&=0xffffffffffff);return t<0&&(t+=0x7ffffffffffff),t};function assign(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}var defaultConverter={read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function init(e,t){function r(r,n,i){if("undefined"!=typeof document){"number"==typeof(i=assign({},t,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),r=encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var a in i)i[a]&&(o+="; "+a,!0!==i[a]&&(o+="="+i[a].split(";")[0]));return document.cookie=r+"="+e.write(n,r)+o}}return Object.create({set:r,get:function(t){if("undefined"!=typeof document&&(!arguments.length||t)){for(var r=document.cookie?document.cookie.split("; "):[],n={},i=0;i<r.length;i++){var o=r[i].split("="),a=o.slice(1).join("=");try{var s=decodeURIComponent(o[0]);if(n[s]=e.read(a,s),t===s)break}catch(e2){}}return t?n[t]:n}},remove:function(e,t){r(e,"",assign({},t,{expires:-1}))},withAttributes:function(e){return init(this.converter,assign({},this.attributes,e))},withConverter:function(e){return init(assign({},this.converter,e),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var api=init(defaultConverter,{path:"/"}),_getCookie=function(e,t){try{return api.get(e,{domain:t||document.domain})}catch(e2){return""}},_setCookie=function(e,t,r,n){try{var i=n||document.domain,o=+new Date+(r||6048e5);api.set(e,t,{expires:new Date(o),path:"/",domain:i})}catch(e2){}},Memory=function(){function e(){_classCallCheck$5(this,e),this.cache={}}return _createClass$6(e,[{key:"setItem",value:function(e,t){this.cache[e]=t}},{key:"getItem",value:function(e){return this.cache[e]}},{key:"removeItem",value:function(e){this.cache[e]=void 0}},{key:"getCookie",value:function(e,t){return _getCookie(e,t)}},{key:"setCookie",value:function(e,t,r,n){_setCookie(e,t,r,n)}}]),e}();function isSupportLS(){try{return localStorage.setItem("_ranger-test-key","hi"),localStorage.getItem("_ranger-test-key"),localStorage.removeItem("_ranger-test-key"),!0}catch(e2){return!1}}function isSupportSession(){try{return sessionStorage.setItem("_ranger-test-key","hi"),sessionStorage.getItem("_ranger-test-key"),sessionStorage.removeItem("_ranger-test-key"),!0}catch(e2){return!1}}var local={getItem:function(e){try{var t=localStorage.getItem(e),r=t;try{t&&"string"==typeof t&&(r=JSON.parse(t))}catch(e2){}return r||{}}catch(e2){}return{}},setItem:function(e,t){try{var r="string"==typeof t?t:JSON.stringify(t);localStorage.setItem(e,r)}catch(e2){}},removeItem:function(e){try{localStorage.removeItem(e)}catch(e2){}},getCookie:function(e,t){return _getCookie(e,t)},setCookie:function(e,t,r,n){_setCookie(e,t,r,n)},isSupportLS:isSupportLS()},session={getItem:function(e){try{var t=sessionStorage.getItem(e),r=t;try{t&&"string"==typeof t&&(r=JSON.parse(t))}catch(e2){}return r||{}}catch(e2){}return{}},setItem:function(e,t){try{var r="string"==typeof t?t:JSON.stringify(t);sessionStorage.setItem(e,r)}catch(e2){}},removeItem:function(e){try{sessionStorage.removeItem(e)}catch(e2){}},getCookie:function(e,t){return _getCookie(e,t)},setCookie:function(e,t,r,n){_setCookie(e,t,r,n)},isSupportSession:isSupportSession()},Storage=function(){function e(t,r){_classCallCheck$5(this,e),this._storage=r&&"session"===r?session:!t&&local.isSupportLS?local:new Memory}return _createClass$6(e,[{key:"getItem",value:function(e){return this._storage.getItem(e)}},{key:"setItem",value:function(e,t){this._storage.setItem(e,t)}},{key:"getCookie",value:function(e,t){return this._storage.getCookie(e,t)}},{key:"setCookie",value:function(e,t,r,n){this._storage.setCookie(e,t,r,n)}},{key:"removeItem",value:function(e){this._storage.removeItem(e)}}]),e}(),UTM=function(e,t,r,n){var i=new Storage(!1),o=new Storage(!1,"session"),a=e?"_tea_utm_cache_".concat(e):"_tea_utm_cache",s=e?"_$utm_from_url_".concat(e):"_$utm_from_url",l={},c=["tr_shareuser","tr_admaster","tr_param1","tr_param2","tr_param3","tr_param4","$utm_from_url"],u={ad_id:Number(t.ad_id)||void 0,campaign_id:Number(t.campaign_id)||void 0,creative_id:Number(t.creative_id)||void 0,utm_source:t.utm_source,utm_medium:t.utm_medium,utm_campaign:t.utm_campaign,utm_term:t.utm_term,utm_content:t.utm_content,tr_shareuser:t.tr_shareuser,tr_admaster:t.tr_admaster,tr_param1:t.tr_param1,tr_param2:t.tr_param2,tr_param3:t.tr_param3,tr_param4:t.tr_param4};try{var h=!1;for(var d in u)u[d]&&(-1!==c.indexOf(d)?(l.hasOwnProperty("tracer_data")||(l.tracer_data={}),l.tracer_data[d]=u[d]):l[d]=u[d],h=!0);if(h)o.setItem(s,"1"),i.setCookie(a,JSON.stringify(l),n,r);else{var p=i.getCookie(a,r);p&&(l=JSON.parse(p))}o.getItem(s)&&(l.hasOwnProperty("tracer_data")||(l.tracer_data={}),l.tracer_data.$utm_from_url=1)}catch(e2){return u}return l},Client=function(){function e(t,r,n){_classCallCheck$5(this,e),this.appid=t,this.domain=r,this.userAgent=window.navigator.userAgent,this.appVersion=window.navigator.appVersion,this.cookie_expire=n}return _createClass$6(e,[{key:"init",value:function(){var e=window.navigator.userAgent,t=window.navigator.language,r=document.referrer,n=r?parseURL(r).hostname:"",i=parseUrlQuery(window.location.href),o=/Mobile|htc|mini|Android|iP(ad|od|hone)/.test(this.appVersion)?"wap":"web";this.utm=UTM(this.appid,i,this.domain,this.cookie_expire);var a=this.browser(),s=this.os();return{browser:a.browser,browser_version:a.browser_version,platform:o,os_name:s.os_name,os_version:s.os_version,userAgent:e,screen_width:window.screen&&window.screen.width,screen_height:window.screen&&window.screen.height,device_model:this.getDeviceModel(s.os_name),language:t,referrer:r,referrer_host:n,utm:this.utm,latest_data:this.last(r,n)}}},{key:"last",value:function(e,t){var r="",n="",i="",o=location.hostname,a=!1;if(e&&t&&o!==t){r=e,n=t,a=!0;var s=parseUrlQuery(e);s.keyword&&(i=s.keyword)}return{$latest_referrer:r,$latest_referrer_host:n,$latest_search_keyword:i,isLast:a}}},{key:"browser",value:function(){var e,t,r="",n="".concat(parseFloat(this.appVersion)),i=this.userAgent;return-1!==i.indexOf("Edge")||-1!==i.indexOf("Edg")?(r="Microsoft Edge",-1!==i.indexOf("Edge")?(e=i.indexOf("Edge"),n=i.substring(e+5)):(e=i.indexOf("Edg"),n=i.substring(e+4))):-1!==(e=i.indexOf("MSIE"))?(r="Microsoft Internet Explorer",n=i.substring(e+5)):-1!==(e=i.indexOf("Lark"))?(r="Lark",n=i.substring(e+5,e+11)):-1!==(e=i.indexOf("MetaSr"))?(r="sougoubrowser",n=i.substring(e+7,e+10)):-1!==i.indexOf("MQQBrowser")||-1!==i.indexOf("QQBrowser")?(r="qqbrowser",-1!==i.indexOf("MQQBrowser")?(e=i.indexOf("MQQBrowser"),n=i.substring(e+11,e+15)):-1!==i.indexOf("QQBrowser")&&(e=i.indexOf("QQBrowser"),n=i.substring(e+10,e+17))):-1!==i.indexOf("Chrome")?-1!==(e=i.indexOf("MicroMessenger"))?(r="weixin",n=i.substring(e+15,e+20)):-1!==(e=i.indexOf("360"))?(r="360browser",n=i.substring(i.indexOf("Chrome")+7)):-1!==i.indexOf("baidubrowser")||-1!==i.indexOf("BIDUBrowser")?(-1!==i.indexOf("baidubrowser")?(e=i.indexOf("baidubrowser"),n=i.substring(e+13,e+16)):-1!==i.indexOf("BIDUBrowser")&&(e=i.indexOf("BIDUBrowser"),n=i.substring(e+12,e+15)),r="baidubrowser"):-1!==(e=i.indexOf("xiaomi"))?-1!==i.indexOf("openlanguagexiaomi")?(r="openlanguage xiaomi",n=i.substring(e+7,e+13)):(r="xiaomi",n=i.substring(e-7,e-1)):-1!==(e=i.indexOf("TTWebView"))?(r="TTWebView",n=i.substring(e+10,e+23)):(-1!==(e=i.indexOf("Chrome"))||-1!==(e=i.indexOf("Chrome")))&&(r="Chrome",n=i.substring(e+7)):-1!==i.indexOf("Safari")?-1!==(e=i.indexOf("QQ"))?(r="qqbrowser",n=i.substring(e+10,e+16)):-1!==(e=i.indexOf("Safari"))&&(r="Safari",n=i.substring(e+7),-1!==(e=i.indexOf("Version"))&&(n=i.substring(e+8))):-1!==(e=i.indexOf("Firefox"))?(r="Firefox",n=i.substring(e+8)):-1!==(e=i.indexOf("MicroMessenger"))?(r="weixin",n=i.substring(e+15,e+20)):-1!==(e=i.indexOf("QQ"))&&(r="qqbrowser",n=i.substring(e+3,e+8)),-1!==(t=n.indexOf(";"))&&(n=n.substring(0,t)),-1!==(t=n.indexOf(" "))&&(n=n.substring(0,t)),-1!==(t=n.indexOf(")"))&&(n=n.substring(0,t)),{browser:r,browser_version:n}}},{key:"os",value:function(){for(var e="",t="",r=[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0|Windows NT 10.1)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Android",r:/Android/},{s:"Sun OS",r:/SunOS/},{s:"Linux",r:/(Linux|X11)/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/}],n=0;n<r.length;n++){var i=r[n];if(i.r.test(this.userAgent)){"Mac OS X"===(e=i.s)&&this.isNewIpad()&&(e="iOS");break}}var o=function(e,t){var r=e.exec(t);return r&&r[1]?r[1]:""},a=function(e,t){var r=RegExp("(?:^|[^A-Z0-9-_]|[^A-Z0-9-]_|sprd-)(?:".concat(e,")"),"i").exec(t);return r?r.slice(1)[0]:""};/Windows/.test(e)&&(t=o(/Windows (.*)/,e),e="windows");var s,l;switch(e){case"Mac OS X":t=a("Mac[ +]OS[ +]X(?:[ /](?:Version )?(\\d+(?:[_\\.]\\d+)+))?",this.userAgent),e="mac";break;case"Android":s=this.userAgent,(l=o(/Android ([\.\_\d]+)/,s))||(l=o(/Android\/([\.\_\d]+)/,s)),t=l,e="android";break;case"iOS":t=this.isNewIpad()?a("Mac[ +]OS[ +]X(?:[ /](?:Version )?(\\d+(?:[_\\.]\\d+)+))?",this.userAgent):(t=/OS (\d+)_(\d+)_?(\d+)?/.exec(this.appVersion))?"".concat(t[1],".").concat(t[2],".").concat(0|t[3]):"",e="ios"}return{os_name:e,os_version:t}}},{key:"getDeviceModel",value:function(e){var t="";try{if("android"===e)navigator.userAgent.split(";").forEach((function(e){e.indexOf("Build/")>-1&&(t=e.slice(0,e.indexOf("Build/")))}));else if("ios"===e||"mac"===e||"windows"===e)if(this.isNewIpad())t="iPad";else{var r=navigator.userAgent.replace("Mozilla/5.0 (",""),n=r.indexOf(";");t=r.slice(0,n)}}catch(e2){return t.trim()}return t.trim()}},{key:"isNewIpad",value:function(){return void 0!==this.userAgent&&"MacIntel"===navigator.platform&&"number"==typeof navigator.maxTouchPoints&&navigator.maxTouchPoints>1}}]),e}(),LOG;LOG={cn:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z4az28z1gz1hz1gz1cz18z1nz1gz4az1az1mz1k",sg:"1fz22z22z1nz21z4mz4bz4bz21z1ez18z1jz1gz49z1kz1az21z4az19z27z22z1cz1mz24z1cz20z21z1cz18z4az1az1mz1k",va:"1fz22z22z1nz21z4mz4bz4bz1kz18z1jz1gz24z18z49z1kz1az21z4az19z27z22z1cz1mz24z1cz20z21z1cz18z4az1az1mz1k"};var AB_DOMAINS={cn:"1fz22z22z1nz21z4mz4bz4bz22z1mz19z1jz1mz1ez4az1az22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k",va:"1fz22z22z1nz21z4mz4bz4bz22z1mz19z1jz1mz1ez4az1gz22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k",sg:"1fz22z22z1nz21z4mz4bz4bz22z1mz19z1jz1mz1ez4az22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k"},LOG_URL=LOG,SDK_VERSION="5.0.29",SDK_USE_TYPE="npm",SDK_TYPE=SDK_USE_TYPE,Types=function(e){return e.Init="init",e.Config="config",e.Start="start",e.Ready="ready",e.TokenComplete="token-complete",e.TokenStorage="token-storage",e.TokenFetch="token-fetch",e.TokenError="token-error",e.ConfigUuid="config-uuid",e.ConfigWebId="config-webid",e.ConfigDomain="config-domain",e.CustomWebId="custom-webid",e.TokenChange="token-change",e.TokenReset="token-reset",e.ConfigTransform="config-transform",e.EnvTransform="env-transform",e.SessionReset="session-reset",e.SessionResetTime="session-reset-time",e.Event="event",e.Events="events",e.EventNow="event-now",e.CleanEvents="clean-events",e.BeconEvent="becon-event",e.SubmitBefore="submit-before",e.SubmitScuess="submit-scuess",e.SubmitAfter="submit-after",e.SubmitError="submit-error",e.SubmitVerify="submit-verify",e.Stay="stay",e.ResetStay="reset-stay",e.StayReady="stay-ready",e.SetStay="set-stay",e.RouteChange="route-change",e.RouteReady="route-ready",e.Ab="ab",e.AbVar="ab-var",e.AbAllVars="ab-all-vars",e.AbConfig="ab-config",e.AbExternalVersion="ab-external-version",e.AbVersionChangeOn="ab-version-change-on",e.AbVersionChangeOff="ab-version-change-off",e.AbOpenLayer="ab-open-layer",e.AbCloseLayer="ab-close-layer",e.AbReady="ab-ready",e.AbComplete="ab-complete",e.Profile="profile",e.ProfileSet="profile-set",e.ProfileSetOnce="profile-set-once",e.ProfileUnset="profile-unset",e.ProfileIncrement="profile-increment",e.ProfileAppend="profile-append",e.ProfileClear="profile-clear",e.Autotrack="autotrack",e.AutotrackReady="autotrack-ready",e.CepReady="cep-ready",e.TracerReady="tracer-ready",e}(Types||{}),DebuggerMesssge$1=function(e){return e.DEBUGGER_MESSAGE="debugger-message",e.DEBUGGER_MESSAGE_SDK="debugger-message-sdk",e.DEBUGGER_MESSAGE_FETCH="debugger-message-fetch",e.DEBUGGER_MESSAGE_FETCH_RESULT="debugger-message-fetch-result",e.DEBUGGER_MESSAGE_EVENT="debugger-message-event",e.DEVTOOL_WEB_READY="devtool-web-ready",e}(DebuggerMesssge$1||{}),undef=void 0,date=new Date,timeZoneMin=date.getTimezoneOffset(),timezone=parseInt("".concat(-timeZoneMin/60),10),tz_offset=60*timeZoneMin,WEBID_URL="/webid",TOB_URL="/tobid",REPORT_URL="/list",COOKIE_EXPIRE=6048e5,ConfigManager=function(){function e(t,r){_classCallCheck$5(this,e),this.is_first_time=!0,this.configPersist=!1,this.initConfig=r,this.collect=t;var n=new Client(r.app_id,r.cookie_domain||"",r.cookie_expire||COOKIE_EXPIRE).init(),i="__tea_cache_first_".concat(r.app_id);this.configKey="__tea_cache_config_".concat(r.app_id),this.sessionStorage=new Storage(!1,"session"),this.localStorage=new Storage(!1,"local"),r.configPersist&&(this.configPersist=!0,this.storage=1===r.configPersist?this.sessionStorage:this.localStorage);var o=this.localStorage.getItem(i);o&&"1"===o?this.is_first_time=!1:(this.is_first_time=!0,this.localStorage.setItem(i,"1")),this.envInfo={user:{user_unique_id:undef,user_type:undef,user_id:undef,user_is_auth:undef,user_is_login:undef,device_id:undef,web_id:undef,ip_addr_id:undef,user_unique_id_type:undef},header:{app_id:undef,app_name:undef,app_install_id:undef,install_id:undef,app_package:undef,app_channel:undef,app_version:undef,os_name:n.os_name,os_version:n.os_version,device_model:n.device_model,ab_client:undef,traffic_type:undef,client_ip:undef,device_brand:undef,os_api:undef,access:undef,language:n.language,region:undef,app_language:undef,app_region:undef,ab_version:undef,creative_id:n.utm.creative_id,ad_id:n.utm.ad_id,campaign_id:n.utm.campaign_id,log_type:undef,rnd:undef,platform:n.platform,sdk_version:SDK_VERSION,sdk_lib:"js",province:undef,city:undef,timezone:timezone,tz_offset:tz_offset,tz_name:undef,sim_region:undef,carrier:undef,resolution:"".concat(n.screen_width,"x").concat(n.screen_height),browser:n.browser,browser_version:n.browser_version,referrer:n.referrer,referrer_host:n.referrer_host,width:n.screen_width,height:n.screen_height,screen_width:n.screen_width,screen_height:n.screen_height,utm_term:n.utm.utm_term,utm_content:n.utm.utm_content,utm_source:n.utm.utm_source,utm_medium:n.utm.utm_medium,utm_campaign:n.utm.utm_campaign,tracer_data:JSON.stringify(n.utm.tracer_data),custom:{},wechat_unionid:undef,wechat_openid:undef}},this.ab_version="",this.evtParams={},this.reportErrorCallback=function(){},this.initDomain()}return _createClass$6(e,[{key:"initDomain",value:function(){var e=this.initConfig.channel_domain;if(e)this.domain=e;else{var t=this.initConfig.channel;this.domain=decodeUrl(LOG_URL[t])}}},{key:"setDomain",value:function(e){this.domain=e}},{key:"getDomain",value:function(){return this.domain}},{key:"setAbVersion",value:function(e){this.ab_version=e}},{key:"getAbVersion",value:function(){return this.ab_version}},{key:"setAbData",value:function(e){this.ab_data=e}},{key:"getAbData",value:function(){return this.ab_data||{}}},{key:"getUrl",value:function(e){var t="";switch(e){case"event":t=this.initConfig.report_url||REPORT_URL;break;case"webid":t=WEBID_URL;break;case"tobid":t=TOB_URL}var r="";return this.initConfig.caller&&(r="?sdk_version=".concat(SDK_VERSION,"&sdk_name=web&app_id=").concat(this.initConfig.app_id,"&caller=").concat(this.initConfig.caller)),"".concat(this.getDomain()).concat(t).concat(r)}},{key:"set",value:function(e){var t=this;Object.keys(e).forEach((function(r){if(void 0!==e[r]&&null!==e[r]||t.delete(r),"evtParams"===r)t.evtParams=_objectSpread2$5(_objectSpread2$5({},t.evtParams||{}),e.evtParams||{});else if("_staging_flag"===r)t.evtParams=_objectSpread2$5(_objectSpread2$5({},t.evtParams||{}),{},{_staging_flag:e._staging_flag});else if("reportErrorCallback"===r&&"function"==typeof e[r])t.reportErrorCallback=e[r];else{var n="",i="";if(r.indexOf(".")>-1){var o=r.split(".");n=o[0],i=o[1]}n?"user"===n||"header"===n?t.envInfo[n][i]=e[r]:t.envInfo.header.custom[i]=e[r]:t.envInfo.user.hasOwnProperty(r)?["user_type","ip_addr_id"].indexOf(r)>-1?t.envInfo.user[r]=e[r]?Number(e[r]):e[r]:["user_id","web_id","user_unique_id","user_unique_id_type"].indexOf(r)>-1?t.envInfo.user[r]=e[r]?String(e[r]):e[r]:["user_is_auth","user_is_login"].indexOf(r)>-1?t.envInfo.user[r]=Boolean(e[r]):"device_id"===r&&(t.envInfo.user[r]=e[r]):t.envInfo.header.hasOwnProperty(r)?t.envInfo.header[r]=e[r]:t.envInfo.header.custom[r]=e[r]}}))}},{key:"get",value:function(e){try{return e?"evtParams"===e?this.evtParams:"reportErrorCallback"===e?this[e]:this.envInfo.user.hasOwnProperty(e)?this.envInfo.user[e]:this.envInfo.header.hasOwnProperty(e)?this.envInfo.header[e]:JSON.parse(JSON.stringify(this.envInfo[e])):JSON.parse(JSON.stringify(this.envInfo))}catch(e2){console.log("get config stringify error "),this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e2.message})}}},{key:"setStore",value:function(e){try{if(!this.configPersist)return;var t=this.storage.getItem(this.configKey)||{};if(t&&Object.keys(e).length){var r=Object.assign(e,t);this.storage.setItem(this.configKey,r)}}catch(e2){this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e2.message})}}},{key:"getStore",value:function(){try{if(!this.configPersist)return null;var e=this.storage.getItem(this.configKey);return e&&Object.keys(e).length?e:null}catch(e2){return this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e2.message}),null}}},{key:"delete",value:function(e){try{if(!this.configPersist)return;var t=this.storage.getItem(this.configKey);t&&t.hasOwnProperty(e)&&(delete t[e],this.storage.setItem(this.configKey,t))}catch(e2){this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e2.message})}}}]),e}(),Logger=function(){function e(t,r){_classCallCheck$5(this,e),this.isLog=r||!1,this.name=t||""}return _createClass$6(e,[{key:"info",value:function(e){this.isLog&&console.log("%c %s","color: yellow; background-color: black;","[instance: ".concat(this.name,"] ")+e)}},{key:"warn",value:function(e){this.isLog&&console.warn("[instance: ".concat(this.name,"] ")+e)}},{key:"error",value:function(e){this.isLog&&console.error("[instance: ".concat(this.name,"] ")+e)}},{key:"throw",value:function(e){throw this.error(this.name),new Error(e)}}]),e}(),AppBridge=function(){function e(t,r){_classCallCheck$5(this,e),this.collect=t,this.native=r}return _createClass$6(e,[{key:"bridgeInject",value:function(){try{return!!this.native&&(AppLogBridge?(console.log("AppLogBridge is injected"),!0):(console.log("AppLogBridge is not inject"),!1))}catch(e2){return console.log("AppLogBridge is not inject"),!1}}},{key:"bridgeReady",value:function(){var e=this;return new Promise((function(t,r){try{e.bridgeInject()?AppLogBridge.hasStarted((function(e){console.log("AppLogBridge is started? : ".concat(e)),e?t(!0):r(!1)})):r(!1)}catch(e2){console.log("AppLogBridge, error:".concat(JSON.stringify(e2.stack))),r(!1)}}))}},{key:"setNativeAppId",value:function(e){try{AppLogBridge.setNativeAppId(JSON.stringify(e)),console.log("change bridge appid, event report with appid: ".concat(e))}catch(e2){console.error("setNativeAppId error")}}},{key:"setConfig",value:function(e){var t=this;try{Object.keys(e).forEach((function(r){"user_unique_id"===r?t.setUserUniqueId(e[r]):e[r]?t.addHeaderInfo(r,e[r]):t.removeHeaderInfo(r)}))}catch(e2){console.error("setConfig error")}}},{key:"setUserUniqueId",value:function(e){try{AppLogBridge.setUserUniqueId(e)}catch(e2){console.error("setUserUniqueId error")}}},{key:"addHeaderInfo",value:function(e,t){try{AppLogBridge.addHeaderInfo(e,t)}catch(e2){console.error("addHeaderInfo error")}}},{key:"setHeaderInfo",value:function(e){try{AppLogBridge.setHeaderInfo(JSON.stringify(e))}catch(e2){console.error("setHeaderInfo error")}}},{key:"removeHeaderInfo",value:function(e){try{AppLogBridge.removeHeaderInfo(e)}catch(e2){console.error("removeHeaderInfo error")}}},{key:"reportPv",value:function(e){this.onEventV3("predefine_pageview",e)}},{key:"onEventV3",value:function(e,t){try{AppLogBridge.onEventV3(e,t),this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_EVENT,info:"bridge埋点上报",time:Date.now(),data:[{events:[{event:e,params:t}]}],code:200,status:"success"})}catch(e2){console.error("onEventV3 error")}}},{key:"profileSet",value:function(e){try{AppLogBridge.profileSet(e)}catch(error){console.error("profileSet error")}}},{key:"profileSetOnce",value:function(e){try{AppLogBridge.profileSetOnce(e)}catch(error){console.error("profileSetOnce error")}}},{key:"profileIncrement",value:function(e){try{AppLogBridge.profileIncrement(e)}catch(error){console.error("profileIncrement error")}}},{key:"profileUnset",value:function(e){try{AppLogBridge.profileUnset(e)}catch(error){console.error("profileUnset error")}}},{key:"profileAppend",value:function(e){try{AppLogBridge.profileAppend(e)}catch(error){console.error("profileAppend error")}}}]),e}(),ERROR$1={NO_URL:4001,IMG_ON:4e3,IMG_CATCH:4002,BEACON_FALSE:4003,XHR_ON:500,RESPONSE:5001,TIMEOUT:5005};function fetch$1(e,t,r,n,i,o,a,s,l){try{var c=new XMLHttpRequest,u=s||"POST";c.open(u,"".concat(e),!0),c.setRequestHeader("Content-Type","application/json; charset=utf-8"),a&&c.setRequestHeader("X-MCS-AppKey","".concat(a)),n&&(c.withCredentials=!0),c.onload=function(){if(i){var e=null;if(c.responseText){try{e=JSON.parse(c.responseText)}catch(e2){e={}}i(e,t)}}},r&&(c.timeout=r,c.ontimeout=function(){o&&o(t,ERROR$1.TIMEOUT)}),c.onerror=function(){c.abort(),o&&o(t,ERROR$1.XHR_ON)},l?c.send(t):c.send(JSON.stringify(t))}catch(e2){}}var GIF_URL="/gif",ERROR={NO_URL:4001,IMG_ON:4e3,IMG_CATCH:4002,BEACON_FALSE:4003,XHR_ON:500,RESPONSE:5001,TIMEOUT:5005},isSupportBeacon=function(){return!(!window.navigator||!window.navigator.sendBeacon)},encodePayload=function(e){var t="";for(var r in e)e.hasOwnProperty(r)&&void 0!==e[r]&&(t+="&".concat(r,"=").concat(encodeURIComponent(JSON.stringify(e[r]))));return t="&"===t[0]?t.slice(1):t},sendByImg=function(e,t,r,n){try{var i=e.match(/\/v\d\//),o="";o=i?i[0]:-1!==e.indexOf("/v1/")?"/v1/":"/v2/";var a=e.split(o)[0];if(!a)return void n(e,t,ERROR.NO_URL);t.forEach((function(i){var o=encodePayload(i),s=new Image(1,1);s.onload=function(){s=null,r&&r()},s.onerror=function(){s=null,n&&n(e,t,ERROR.IMG_ON)},s.src="".concat(a).concat(GIF_URL,"?").concat(o)}))}catch(e2){n&&n(e,t,ERROR.IMG_CATCH,e2.message)}},request=function(e,t,r,n,i,o,a,s){var l=window.navigator.userAgent;if(-1===window.navigator.appName.indexOf("Microsoft Internet Explorer")||-1===l.indexOf("MSIE 8.0")&&-1===l.indexOf("MSIE 9.0")){if(a)return isSupportBeacon()?void(window.navigator.sendBeacon(e,JSON.stringify(t))?i():o(e,t,ERROR.BEACON_FALSE)):void sendByImg(e,t,i,o)}else sendByImg(e,t,i,o);fetch$1(e,t,r,n,i,o,"","",s)},EventCheck=function(){function e(t,r){_classCallCheck$5(this,e),this.collector=t,this.config=r,this.eventNameWhiteList=["__bav_page","__bav_beat","__bav_page_statistics","__bav_click","__bav_page_exposure"],this.paramsNameWhiteList=["$inactive","$inline","$target_uuid_list","$source_uuid","$is_spider","$source_id","$is_first_time","_staging_flag"],this.regStr=new RegExp("^[a-zA-Z0-9][a-z0-9A-Z_.-]{1,255}$")}return _createClass$6(e,[{key:"checkVerify",value:function(e){var t=this;if(!e||!e.length)return!1;var r=e[0];if(!r)return!1;var n=r.events,i=r.header;if(!n||!n.length)return!1;var o=!0;return n.forEach((function(e){t.checkEventName(e.event)||(o=!1,e.checkEvent="事件名不能以 $ or __开头"),t.checkEventParams(e.params)||(o=!1,e.checkParams="属性名不能以 $ or __开头")})),this.checkEventParams(i)||(o=!1),o}},{key:"checkEventName",value:function(e){return!!e&&this.calculate(e,"event")}},{key:"checkEventParams",value:function(e){var t=e;if("string"==typeof e&&(t=JSON.parse(t)),!Object.keys(t).length)return!0;for(var r in t)return!!this.calculate(r,"params")&&(!("string"==typeof t[r]&&t[r].length>1024)||(console.warn("params: ".concat(r," can not over 1024 byte, please check;")),!1));return!0}},{key:"calculate",value:function(e,t){return-1!==("event"===t?this.eventNameWhiteList:this.paramsNameWhiteList).indexOf(e)||(this.regStr.test(e)?!new RegExp("^\\$").test(e)&&!new RegExp("^__").test(e)||(console.warn("".concat("event"===t?"event":"params"," name: ").concat(e," can not start with $ or __, pleace check;")),!1):(console.warn("".concat("event"===t?"event":"params"," name: ").concat(e," is illegal, can not start with $ or __, pleace check;")),!1))}}]),e}(),Event$1=function(){function e(){_classCallCheck$5(this,e),this.eventLimit=50,this.enable_ttwebid=!1,this.eventCache=[],this.beconEventCache=[]}return _createClass$6(e,[{key:"apply",value:function(e,t){var r=this;this.collect=e,this.config=t,this.configManager=e.configManager,this.eventCheck=new EventCheck(e,t),this.cacheStorgae=new Storage(!0),this.localStorage=new Storage(!1),this.maxReport=t.max_report||10,this.reportTime=t.reportTime||30,this.timeout=t.timeout||1e5,this.enable_ttwebid=t.enable_ttwebid,this.reportUrl=this.configManager.getUrl("event"),this.eventKey="__tea_cache_events_".concat(this.configManager.get("app_id")),this.beconKey="__tea_cache_events_becon_".concat(this.configManager.get("app_id")),this.abKey="__tea_sdk_ab_version_".concat(this.configManager.get("app_id")),this.collect.on(Types.Ready,(function(){r.reportAll(!1)})),this.collect.on(Types.ConfigDomain,(function(){r.reportUrl=r.configManager.getUrl("event")})),this.collect.on(Types.Event,(function(e){r.event(e)})),this.collect.on(Types.BeconEvent,(function(e){r.beconEvent(e)})),this.collect.on(Types.CleanEvents,(function(){r.reportAll(!1)})),this.linster()}},{key:"linster",value:function(){var e=this;window.addEventListener("unload",(function(){e.reportAll(!0)}),!1),beforePageUnload((function(){e.reportAll(!0)})),document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e.reportAll(!0)}),!1)}},{key:"reportAll",value:function(e){this.report(e),this.reportBecon()}},{key:"event",value:function(e){var t=this;try{var r=this.cacheStorgae.getItem(this.eventKey)||[],n=[].concat(_toConsumableArray$1(e),_toConsumableArray$1(r));if(this.cacheStorgae.setItem(this.eventKey,n),this.reportTimeout&&clearTimeout(this.reportTimeout),n.length>=this.maxReport)this.report(!1);else{var i=this.reportTime;this.reportTimeout=setTimeout((function(){t.report(!1),t.reportTimeout=null}),i)}}catch(e2){this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e2.message})}}},{key:"beconEvent",value:function(e){var t=this.cacheStorgae.getItem(this.beconKey)||[],r=[].concat(_toConsumableArray$1(e),_toConsumableArray$1(t));this.cacheStorgae.setItem(this.beconKey,r),this.collect.destroyInstance||this.collect.tokenManager.getReady()&&this.collect.sdkReady&&(this.cacheStorgae.removeItem(this.beconKey),this.send(this.split(this.merge(r)),!0))}},{key:"reportBecon",value:function(){if(!this.collect.destroyInstance&&this.collect.tokenManager.getReady()&&this.collect.sdkReady){var e=this.cacheStorgae.getItem(this.beconKey)||[];e&&e.length&&(this.cacheStorgae.removeItem(this.beconKey),this.send(this.split(this.merge(e)),!0))}}},{key:"report",value:function(e){if(!this.collect.destroyInstance&&this.collect.tokenManager.getReady()&&this.collect.sdkReady){var t=this.cacheStorgae.getItem(this.eventKey)||[];t.length&&(this.cacheStorgae.removeItem(this.eventKey),this.sliceEvent(t,e))}}},{key:"sliceEvent",value:function(e,t){if(e.length>this.eventLimit)for(var r=0;r<e.length;r+=this.eventLimit){var n;n=e.slice(r,r+this.eventLimit);var i=this.split(this.merge(n));this.send(i,t)}else{var o=this.split(this.merge(e));this.send(o,t)}}},{key:"merge",value:function(e,t){var r=this,n=this.configManager.get(),i=n.header,o=n.user;i.custom=JSON.stringify(i.custom);var a=this.configManager.get("evtParams"),s=this.configManager.get("user_unique_id_type"),l=e.map((function(e){try{Object.keys(a).length&&!t&&(e.params=_objectSpread2$5(_objectSpread2$5({},a),e.params)),s&&(e.params.$user_unique_id_type=s);var n=r.localStorage.getItem(r.abKey);return n&&n.uuid&&n.uuid===o.user_unique_id&&r.configManager.getAbVersion()&&(e.ab_sdk_version=r.configManager.getAbVersion()),e.session_id=r.collect.sessionManager.getSessionId(),e.params=JSON.stringify(e.params),e}catch(e2){return r.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e2.message}),e}})),c=JSON.parse(JSON.stringify({events:l,user:o,header:i}));c.local_time=Math.floor(Date.now()/1e3),c.user_unique_type=this.config.enable_ttwebid?this.config.user_unique_type:void 0;var u=[];return u.push(c),u}},{key:"split",value:function(e){return e=e.map((function(e){var t=[];return t.push(e),t}))}},{key:"send",value:function(e,t){var r=this;e.length&&e.forEach((function(e){try{var n=JSON.parse(JSON.stringify(e));r.config.filter&&((n=r.config.filter(n))||console.warn("filter must return data !!")),r.collect.eventFilter&&n&&((n=r.collect.eventFilter(n))||console.warn("filterEvent api must return data !!"));var i=n||e;if(r.eventCheck.checkVerify(i),!i.length)return;r.collect.emit(Types.SubmitBefore,i),r.collect.emit(Types.SubmitVerify,i),request(r.reportUrl,i,r.timeout,r.enable_ttwebid,(function(e,t){e&&0!==e.e?(r.collect.emit(Types.SubmitError,{type:"f_data",eventData:t,errorCode:e.e,response:e}),r.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_EVENT,info:"埋点上报失败",time:Date.now(),data:i,code:e.e,failType:"数据异常",status:"fail"})):(r.collect.emit(Types.SubmitScuess,{eventData:t,res:e}),r.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_EVENT,info:"埋点上报成功",time:Date.now(),data:i,code:200,status:"success"}))}),(function(e,t){r.configManager.get("reportErrorCallback")(e,t),r.collect.emit(Types.SubmitError,{type:"f_net",eventData:e,errorCode:t}),r.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_EVENT,info:"埋点上报网络异常",time:Date.now(),data:i,code:t,failType:"网络异常",status:"fail"})}),t,!1),r.collect.emit(Types.SubmitAfter,i)}catch(e2){console.warn("something error, ".concat(JSON.stringify(e2.stack))),r.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e2.message})}}))}}]),e}(),b=function e(t){return t?(t^16*Math.random()>>t/4).toString(10):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)},localWebId=function(){return b().replace(/-/g,"").slice(0,19)},Token=function(){function e(){_classCallCheck$5(this,e),this.cacheToken={},this.enableCookie=!1,this.enable_ttwebid=!1,this.enableCustomWebid=!1}return _createClass$6(e,[{key:"apply",value:function(e,t){var r=this;this.collect=e,this.config=t,this.configManager=this.collect.configManager,this.storage=new Storage(!1),this.tokenKey="__tea_cache_tokens_".concat(t.app_id),this.enable_ttwebid=t.enable_ttwebid,this.enableCustomWebid=t.enable_custom_webid,this.collect.on(Types.ConfigUuid,(function(e){r.setUuid(e)})),this.collect.on(Types.ConfigWebId,(function(e){r.setWebId(e)})),this.enableCookie=t.cross_subdomain,this.expiresTime=t.cookie_expire||6048e5,this.cookieDomain=t.cookie_domain||"",this.checkStorage()}},{key:"checkStorage",value:function(){var e=this;if(this.enableCookie){var t=this.storage.getCookie(this.tokenKey,this.cookieDomain);this.cacheToken=t&&"string"==typeof t?JSON.parse(t):{}}else this.cacheToken=this.storage.getItem(this.tokenKey)||{};this.tokenType=this.cacheToken&&this.cacheToken._type_?this.cacheToken._type_:"default","custom"!==this.tokenType||this.enableCustomWebid?this.enableCustomWebid?this.collect.on(Types.CustomWebId,(function(){e.tokenReady=!0,e.collect.emit(Types.TokenComplete)})):this.checkEnv()||(this.enable_ttwebid?this.completeTtWid(this.cacheToken):this.check()):this.remoteWebid()}},{key:"check",value:function(){this.cacheToken&&this.cacheToken.web_id?this.complete(this.cacheToken):this.config.disable_webid?this.complete({web_id:localWebId(),user_unique_id:this.configManager.get("user_unique_id")||localWebId()}):this.remoteWebid()}},{key:"checkEnv",value:function(){var e=window.navigator.userAgent;if(-1!==e.indexOf("miniProgram")||-1!==e.indexOf("MiniProgram")){var t=parseUrlQuery(window.location.href);return!(!t||!t.Web_ID)&&(this.complete({web_id:"".concat(t.Web_ID),user_unique_id:this.configManager.get("user_unique_id")||"".concat(t.Web_ID)}),!0)}return!1}},{key:"remoteWebid",value:function(){var e=this,t=this.configManager.getUrl("webid"),r={app_key:this.config.app_key,app_id:this.config.app_id,url:location.href,user_agent:window.navigator.userAgent,referer:document.referrer,user_unique_id:""};this.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 发起WEBID请求",logType:"fetch",level:"info",time:Date.now(),data:r}),fetch$1(t,r,3e3,!1,(function(t){t&&0===t.e?e.complete({web_id:e.configManager.get("web_id")||t.web_id,user_unique_id:e.configManager.get("user_unique_id")||t.web_id}):(e.collect.emit(Types.TokenError),console.warn("[]appid: ".concat(e.config.app_id," webid error, init error~"))),e.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"WEBID请求成功",logType:"fetch",level:"info",time:Date.now(),data:t})}),(function(){e.collect.emit(Types.TokenError),e.collect.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"WEBID请求网络异常",logType:"fetch",level:"error",time:Date.now(),data:null}),console.warn("[]appid: ".concat(e.config.app_id,", get webid error, init error~"))}))}},{key:"complete",value:function(e){var t=e.web_id,r=e.user_unique_id;e.timestamp=Date.now(),this.collect.configManager.set({web_id:t,user_unique_id:r}),this.setStorage(e),this.tokenReady=!0,this.collect.emit(Types.TokenComplete)}},{key:"completeTtWid",value:function(e){var t=e.user_unique_id||"",r=this.configManager.get("user_unique_id");(r||t)&&this.configManager.set({user_unique_id:r||t}),this.setStorage(e),this.tokenReady=!0,this.collect.emit(Types.TokenComplete)}},{key:"setUuid",value:function(e){if(e&&-1===["null","undefined","Null","None"].indexOf(e)){var t=String(e),r=this.configManager.get("user_unique_id"),n=this.cacheToken&&this.cacheToken.user_unique_id;if(t===r&&t===n)return;this.configManager.set({user_unique_id:t}),this.cacheToken||(this.cacheToken={}),this.cacheToken.user_unique_id=t,this.cacheToken.timestamp=Date.now(),this.setStorage(this.cacheToken),this.collect.emit(Types.TokenChange,"uuid"),this.collect.emit(Types.SessionReset)}else this.clearUuid()}},{key:"clearUuid",value:function(){this.config.enable_ttwebid||this.configManager.get("web_id")&&(this.configManager.set({user_unique_id:this.configManager.get("web_id")}),this.cacheToken&&this.cacheToken.web_id&&(this.cacheToken.user_unique_id=this.cacheToken.web_id,this.cacheToken.timestamp=Date.now(),this.setStorage(this.cacheToken)),this.collect.emit(Types.TokenReset))}},{key:"setWebId",value:function(e){if(e&&!this.config.enable_ttwebid){this.cacheToken&&this.cacheToken.web_id?this.cacheToken.web_id!==e&&(this.cacheToken.user_unique_id=this.cacheToken.web_id===this.cacheToken.user_unique_id?e:this.cacheToken.user_unique_id,this.cacheToken.web_id=e):(this.cacheToken={},this.cacheToken.web_id=e,this.cacheToken.user_unique_id=e),this.cacheToken.timestamp=Date.now();var t=this.configManager.get("web_id"),r=this.configManager.get("user_unique_id");r&&r!==t||(this.configManager.set({user_unique_id:e}),this.collect.emit(Types.TokenChange,"uuid")),t!==e&&(this.configManager.set({web_id:e}),this.collect.emit(Types.TokenChange,"webid")),this.setStorage(this.cacheToken)}}},{key:"setStorage",value:function(e){e._type_=this.enableCustomWebid?"custom":"default",delete e["diss".split("").reverse().join("")],this.enableCookie||this.enable_ttwebid?(this.storage.setCookie(this.tokenKey,e,this.expiresTime,this.cookieDomain),this.enable_ttwebid&&(delete e.web_id,this.storage.setItem(this.tokenKey,e))):this.storage.setItem(this.tokenKey,e),this.cacheToken=e}},{key:"getReady",value:function(){return this.tokenReady}},{key:"getTobId",value:function(){var e=this,t=this.configManager.getUrl("tobid");return new Promise((function(r){fetch$1(t,{app_id:e.config.app_id,user_unique_id:e.configManager.get("user_unique_id"),web_id:e.configManager.get("web_id"),user_unique_id_type:e.configManager.get("user_unique_id_type")},3e4,e.enable_ttwebid,(function(e){e&&0===e.e?r(e.tobid):r("")}),(function(){r("")}))}))}}]),e}(),sessionId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},Session=function(){function e(){_classCallCheck$5(this,e)}return _createClass$6(e,[{key:"apply",value:function(e,t){var r=this;this.collect=e,this.storage=new Storage(!1,"session"),this.sessionKey="__tea_session_id_".concat(t.app_id),this.expireTime=t.expireTime||18e5,this.disableSession=t.disable_session,this.disableSession||(this.setSessionId(),this.collect.on(Types.SessionReset,(function(){r.resetSessionId()})),this.collect.on(Types.SessionResetTime,(function(){r.updateSessionIdTime()})))}},{key:"updateSessionIdTime",value:function(){var e=this.storage.getItem(this.sessionKey);if(e&&e.sessionId){var t=e.timestamp;Date.now()-t>this.expireTime?e={sessionId:sessionId(),timestamp:Date.now()}:e.timestamp=Date.now(),this.storage.setItem(this.sessionKey,e),this.resetExpTime()}}},{key:"setSessionId",value:function(){var e=this,t=this.storage.getItem(this.sessionKey);t&&t.sessionId?t.timestamp=Date.now():t={sessionId:sessionId(),timestamp:Date.now()},this.storage.setItem(this.sessionKey,t),this.sessionExp=setInterval((function(){e.checkEXp()}),this.expireTime)}},{key:"getSessionId",value:function(){var e=this.storage.getItem(this.sessionKey);return this.disableSession?"":e&&e.sessionId?e.sessionId:""}},{key:"resetExpTime",value:function(){var e=this;this.sessionExp&&(clearInterval(this.sessionExp),this.sessionExp=setInterval((function(){e.checkEXp()}),this.expireTime))}},{key:"resetSessionId",value:function(){var e={sessionId:sessionId(),timestamp:Date.now()};this.storage.setItem(this.sessionKey,e)}},{key:"checkEXp",value:function(){var e=this.storage.getItem(this.sessionKey);e&&e.sessionId&&(Date.now()-e.timestamp+30>=this.expireTime&&(e={sessionId:sessionId(),timestamp:Date.now()},this.storage.setItem(this.sessionKey,e)))}}]),e}(),AutoBase=function(e){var t=e.app_id,r=e.channel,n=e.onTokenReady,i="".concat(LOG_URL[r],"/webid"),o=new Storage(!1),a="__tea_cache_tokens_".concat(t),s=o.getItem(a);s&&s.web_id?n(s.web_id):request(i,{app_key:"",app_id:t,url:location.href,user_agent:window.navigator.userAgent,referer:document.referrer},3e3,!1,(function(e){if(e&&0===e.e){n(e.web_id);var t={web_id:e.web_id,user_unique_id:e.web_id,timestamp:Date.now()};o.setItem(a,t)}else n("")}),(function(){n("")}),!0)},Debugger=function(){function e(t,r){_classCallCheck$5(this,e),this.devToolReady=!1,this.devToolOrigin="*",this.sendAlready=!1,this.collect=t,this.config=r,this.app_id=r.app_id,this.filterEvent=["__bav_page","__bav_beat","__bav_page_statistics","__bav_click","__bav_page_exposure","bav2b_page","bav2b_beat","bav2b_page_statistics","bav2b_click","bav2b_page_exposure","_be_active","predefine_pageview","__profile_set","__profile_set_once","__profile_increment","__profile_unset","__profile_append","predefine_page_alive","predefine_page_close","abtest_exposure"],this.load()}return _createClass$6(e,[{key:"loadScript",value:function(e){try{var t=document.createElement("script");t.src=e,t.onerror=function(){console.log("load DevTool render fail")},t.onload=function(){console.log("load DevTool render success")},document.getElementsByTagName("body")[0].appendChild(t)}catch(e2){console.log("devTool load fail, ".concat(e2.message))}}},{key:"load",value:function(){try{this.loadBaseInfo(),this.loadHook();var e=parseUrlQuery(window.location.href);if(!e.open_devtool_web||parseInt(e.app_id)!==this.app_id)return;this.addLintener(),this.loadDebuggerModule(),this.loadDevTool()}catch(e2){console.log("debug fail, ".concat(e2.message))}}},{key:"loadDevTool",value:function(){this.loadScript("https://lf3-cdn-tos.bytescm.com/obj/static/log-sdk/collect/devtool/debug-web.js")}},{key:"loadBaseInfo",value:function(){var e=this;this.info=[{title:"基本信息",type:1,infoName:{app_id:this.config.app_id,channel:this.config.channel,"上报域名":this.collect.configManager.getDomain(),"SDK版本":SDK_VERSION,"SDK引入方式":SDK_TYPE}},{title:"用户信息",type:2,infoName:{uuid:this.collect.configManager.get("user").user_unique_id||"",web_id:this.collect.configManager.get("user").web_id||"",ssid:"点击获取SSID"}},{title:"公共参数信息",type:2,infoName:{"浏览器":this.collect.configManager.get("browser"),"浏览器版本":this.collect.configManager.get("browser_version"),"平台":this.collect.configManager.get("platform"),"设备型号":this.collect.configManager.get("device_model"),"操作系统":this.collect.configManager.get("os_name"),"操作系统版本":this.collect.configManager.get("os_version"),"屏幕分辨率":this.collect.configManager.get("os_version"),"来源":this.collect.configManager.get("referrer"),"自定义信息":""}},{title:"配置信息",type:3,infoName:{"全埋点":!!this.config.autotrack,"停留时长":!!this.config.enable_stay_duration}},{title:"A/B配置信息",type:4,infoName:{"A/B实验":!!this.config.enable_ab_test}},{title:"客户端信息",type:3,infoName:{"打通开关":!!this.config.Native}}],this.log=[],this.event=[],this.collect.on(Types.Ready,(function(){e.info[1].infoName.uuid=e.collect.configManager.get("user").user_unique_id,e.info[1].infoName.web_id=e.collect.configManager.get("user").web_id,e.info[2].infoName["自定义信息"]=JSON.stringify(e.collect.configManager.get("custom")),e.config.enable_ab_test&&(e.info[4].infoName["已曝光VID"]=e.collect.configManager.getAbVersion(),e.info[4].infoName["A/B域名"]=e.config.ab_channel_domain||decodeUrl(AB_DOMAINS[e.config.channel]),e.info[4].infoName["全部配置"]=e.collect.configManager.getAbData()),e.config.Native&&(e.info[5].infoName["是否打通"]=!!e.collect.bridgeReport)}))}},{key:"loadHook",value:function(){var e=this;this.collect.on(DebuggerMesssge$1.DEBUGGER_MESSAGE,(function(t){switch(t.type){case DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK:var r={time:t.time,type:t.logType||"sdk",level:t.level,name:t.info,show:!0,levelShow:!0,needDesc:!!t.data};return t.data&&(r.desc={content:JSON.stringify(t.data)}),e.updateLog(r),t.secType&&"AB"===t.secType?(e.info[4].infoName["已曝光VID"]=e.collect.configManager.getAbVersion(),e.info[4].infoName["全部配置"]=e.collect.configManager.getAbData()):"USER"===t.secType&&(e.info[1].infoName.uuid=e.collect.configManager.get("user").user_unique_id,e.info[1].infoName.web_id=e.collect.configManager.get("user").web_id),void e.updateInfo();case DebuggerMesssge$1.DEBUGGER_MESSAGE_EVENT:if(t.data&&t.data.length){var n=t.data[0],i=n.events;if(!i.length)return;i.forEach((function(r){r.checkShow=!0,r.searchShow=!0,r.success=t.status,r.type=-1!==e.filterEvent.indexOf(r.event)?"sdk":"cus",r.type=e.collect.bridgeReport?"bridge":r.type,r.info="","fail"===t.status&&(r.info={message:"code: ".concat(t.code,", msg: ").concat(t.failType)})})),e.updateEvent(n)}return}}))}},{key:"addLintener",value:function(){var e=this;window.addEventListener("message",(function(t){if(t&&t.data&&"devtool:web:ready"===t.data.type){if(e.devToolOrigin=t.origin,e.devToolReady=!0,e.sendAlready)return;console.log("inittttt"),e.sendData("devtool:web:init",{info:e.info,log:e.log,event:e.event}),e.sendAlready=!0}t&&t.data&&"devtool:web:ssid"===t.data.type&&e.collect.getToken((function(t){e.info[1].infoName.ssid=t.tobid,e.updateInfo()}))}))}},{key:"sendData",value:function(e,t){try{var r={type:e,payload:t};(window.opener||window.parent).postMessage(r,this.devToolOrigin)}catch(e2){}}},{key:"updateInfo",value:function(){this.devToolReady&&this.sendData("devtool:web:info",this.info)}},{key:"updateLog",value:function(e){this.devToolReady?this.sendData("devtool:web:log",e):this.log.push(e)}},{key:"updateEvent",value:function(e){this.devToolReady?this.sendData("devtool:web:event",e):this.event.push(e)}},{key:"loadDebuggerModule",value:function(){var e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.appendChild(document.createTextNode("#debugger-applog-web {\n position: absolute;\n width: 90px;\n height: 30px;\n background: #23c243;\n border-radius: 6px;\n color: #fff;\n font-size: 12px;\n bottom: 5%;\n right: 10%;\n text-align: center;\n line-height: 30px;\n cursor: pointer;\n z-index:100;\n }")),e.appendChild(t);var r=document.createElement("div");r.innerHTML='<div id="debugger-applog-web" class="debugger-applog-web">AppLog调试</div>';var n=document.createElement("div");n.innerHTML='<div id="debugger-container" class="debugger-container"></div>',document.getElementsByTagName("body")[0].appendChild(r),document.getElementsByTagName("body")[0].appendChild(n),document.getElementById("debugger-applog-web").addEventListener("click",(function(){(window.opener||window.parent).postMessage({type:"devtool:web:open-draw"},location.origin)}))}}]),e}(),_excluded=["web_id","user_unique_id"],_Collector=function(){function e(t){_classCallCheck$5(this,e),this.disableAutoPageView=!1,this.bridgeReport=!1,this.staging=!1,this.pluginInstances=[],this.sended=!1,this.started=!1,this.destroyInstance=!1,this.sdkReady=!1,this.adapters={},this.name=t,this.hook=new Hook,this.remotePlugin=new Map,this.Types=Types,this.adapters.fetch=fetch$1,this.adapters.storage=Storage}return _createClass$6(e,[{key:"usePlugin",value:function(e,t,r){e&&(t?"string"==typeof t?this.remotePlugin.get(e)||this.remotePlugin.set(e,{src:t,call:r}):this.remotePlugin.get(e)||this.remotePlugin.set(e,{instance:t}):this.remotePlugin.get(e)||this.remotePlugin.set(e,"sdk"))}},{key:"init",value:function(t){var r=this;this.inited?console.warn("[instance: ".concat(this.name,"], every instance's api: init, can be call only one time!")):t&&isObject(t)?t.app_id&&isNumber(t.app_id)?!t.app_key||isString(t.app_key)?(t.channel_domain||-1!==["cn","sg","va"].indexOf(t.channel)||(console.warn("channel must be `cn`, `sg`,`va` !!!"),t.channel="cn"),this.logger=new Logger(this.name,t.log),this.appBridge=new AppBridge(this,t.Native),this.bridgeReport=this.appBridge.bridgeInject(),this.configManager=new ConfigManager(this,t),this.debugger=new Debugger(this,t),this.initConfig=t,this.emit(Types.Init),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行INIT",data:t,level:"info",time:Date.now()}),t.disable_auto_pv&&(this.disableAutoPageView=!0),this.bridgeReport||(this.configManager.set({app_id:t.app_id}),this.eventManager=new Event$1,this.tokenManager=new Token,this.sessionManager=new Session,Promise.all([new Promise((function(e){r.once(Types.TokenComplete,(function(){e(!0)}))})),new Promise((function(e){r.once(Types.Start,(function(){e(!0)}))}))]).then((function(){try{e.plugins.reduce((function(e,t){var n=t.plugin,i=t.options,o=Object.assign(r.initConfig,i),a=new n;return a.apply(r,o),e.push(a),e}),r.pluginInstances)}catch(e2){console.log("load plugin error, ".concat(e2.message)),r.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e2.message})}r.sdkReady=!0,r.emit(Types.Ready),r.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 初始化完成",time:Date.now(),level:"info",data:r.configManager.get("user")}),r.logger.info("appid: ".concat(t.app_id,", userInfo:").concat(JSON.stringify(r.configManager.get("user")))),r.logger.info("appid: ".concat(t.app_id,", sdk is ready, version is ").concat(SDK_VERSION,", you can report now !!!")),t.disable_auto_pv&&(r.disableAutoPageView=!0);try{(t.enable_ab_test||t.autotrack)&&(window.opener||window.parent).postMessage("[tea-sdk]ready","*")}catch(e2){r.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e2.message})}r.pageView(),r.on(Types.TokenChange,(function(e){"webid"===e&&r.pageView(),r.logger.info("appid: ".concat(t.app_id," token change, new userInfo:").concat(JSON.stringify(r.configManager.get("user")))),r.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 设置了用户信息",time:Date.now(),secType:"USER",level:"info",data:r.configManager.get("user")})})),r.on(Types.TokenReset,(function(){r.logger.info("appid: ".concat(t.app_id," token reset, new userInfo:").concat(JSON.stringify(r.configManager.get("user")))),r.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 重置了用户信息",time:Date.now(),secType:"USER",level:"info",data:r.configManager.get("user")})})),r.on(Types.RouteChange,(function(e){e.init||t.disable_route_report||r.pageView()}));try{(window.opener||window.parent).postMessage("[tea-sdk]ready","*")}catch(e2){}})),this.tokenManager.apply(this,t),this.eventManager.apply(this,t),this.sessionManager.apply(this,t)),this.inited=!0):console.warn("app_key param is error, must be string, please check!"):console.warn("app_id param is error, must be number, please check!"):console.warn("init params error,please check")}},{key:"config",value:function(e){if(this.inited)if(e&&isObject(e))if(this.bridgeReport)this.appBridge.setConfig(e);else{e._staging_flag&&1===e._staging_flag&&(this.staging=!0),e.disable_auto_pv&&(this.disableAutoPageView=!0,delete e.disable_auto_pv);var t=_objectSpread2$5({},e);if(this.initConfig&&this.initConfig.configPersist){var r=this.configManager.getStore();r&&(t=Object.assign(r,e)),this.configManager.setStore(e)}var n=t;n.web_id,n.user_unique_id;var i=_objectWithoutProperties$1(n,_excluded);t.hasOwnProperty("web_id")&&this.emit(Types.ConfigWebId,t.web_id),t.hasOwnProperty("user_unique_id")&&this.emit(Types.ConfigUuid,t.user_unique_id),this.configManager.set(i),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行CONFIG",level:"info",time:Date.now(),data:t})}else console.warn("config params is error, please check");else console.warn("config must be use after function init")}},{key:"setDomain",value:function(e){this.configManager&&this.configManager.setDomain(e),this.emit(Types.ConfigDomain)}},{key:"getConfig",value:function(e){return this.configManager.get(e)}},{key:"send",value:function(){this.start()}},{key:"start",value:function(){this.inited&&!this.sended&&(this.sended=!0,this.emit(Types.Start),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行START",level:"info",time:Date.now()}),this.bridgeReport&&(this.pageView(),this.emit(Types.Ready)))}},{key:"event",value:function(e,t){var r=this;try{if(this.initConfig&&this.initConfig.disable_track_event)return;var n=[];Array.isArray(e)?e.forEach((function(e){n.push(r.processEvent(e[0],e[1]||{}))})):n.push(this.processEvent(e,t)),this.bridgeReport?n.forEach((function(e){var t=e.event,n=e.params;r.appBridge.onEventV3(t,JSON.stringify(n))})):n.length&&(this.emit(Types.Event,n),this.emit(Types.SessionResetTime))}catch(e2){console.warn("something error, please check"),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e2.message})}}},{key:"beconEvent",value:function(e,t){if(!this.initConfig||!this.initConfig.disable_track_event)if(Array.isArray(e))console.warn("beconEvent not support batch report, please check");else{var r=[];r.push(this.processEvent(e,t||{})),r.length&&(this.emit(Types.BeconEvent,r),this.emit(Types.SessionResetTime))}}},{key:"processEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{var r=/^event\./,n=e;r.test(e)&&(n=e.slice(6));var i,o=t;"object"!==_typeof$4(o)&&(o={}),o.profile?delete o.profile:o.event_index=getIndex(),o.local_ms?(i=o.local_ms,delete o.local_ms):i=+new Date;var a={event:n,params:o,local_time_ms:i,is_bav:this.initConfig&&this.initConfig.autotrack?1:0};return a}catch(e2){return this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e2.message}),{event:e,params:t}}}},{key:"filterEvent",value:function(e){this.eventFilter=e}},{key:"on",value:function(e,t){this.hook.on(e,t)}},{key:"once",value:function(e,t){this.hook.once(e,t)}},{key:"off",value:function(e,t){this.hook.off(e,t)}},{key:"emit",value:function(e,t,r){this.hook.emit(e,t,r)}},{key:"set",value:function(e){this.hook.set(e)}},{key:"pageView",value:function(){this.disableAutoPageView||this.predefinePageView()}},{key:"predefinePageView",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={title:document.title||location.pathname,url:location.href,url_path:location.pathname,time:Date.now(),referrer:window.document.referrer,$is_first_time:"".concat(this.configManager.is_first_time)},r=_objectSpread2$5(_objectSpread2$5({},t),e);this.event("predefine_pageview",r)}},{key:"clearEventCache",value:function(){this.emit(Types.CleanEvents)}},{key:"setWebIDviaUnionID",value:function(e){if(e){var t=hashCode(e);this.config({web_id:"".concat(t),wechat_unionid:e}),this.emit(Types.CustomWebId)}}},{key:"setWebId",value:function(e){this.config({web_id:"".concat(e)})}},{key:"setWebIDviaOpenID",value:function(e){if(e){var t=hashCode(e);this.config({web_id:"".concat(t),wechat_openid:e}),this.emit(Types.CustomWebId)}}},{key:"setNativeAppId",value:function(e){this.bridgeReport&&this.appBridge.setNativeAppId(e)}},{key:"resetStayDuration",value:function(e,t,r){this.emit(Types.ResetStay,{url_path:e,title:t,url:r},Types.Stay)}},{key:"resetStayParams",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";this.emit(Types.SetStay,{url_path:e,title:t,url:r},Types.Stay)}},{key:"getToken",value:function(e,t){var r=this,n=!1,i=function(t){if(!n){n=!0;var i=r.configManager.get().user;return t&&(i.tobid=t,i["diss".split("").reverse().join("")]=t),e(_objectSpread2$5({},i))}},o=function(){r.tokenManager.getTobId().then((function(e){i(e)}))};this.sdkReady?o():(t&&setTimeout((function(){i()}),t),this.on(Types.Ready,(function(){o()})))}},{key:"profileSet",value:function(e){this.bridgeReport?this.appBridge.profileSet(JSON.stringify(e)):this.emit(Types.ProfileSet,e,Types.Profile),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行profileSet",level:"info",time:Date.now(),data:e})}},{key:"profileSetOnce",value:function(e){this.bridgeReport?this.appBridge.profileSetOnce(JSON.stringify(e)):this.emit(Types.ProfileSetOnce,e,Types.Profile),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行profileSetOnce",level:"info",time:Date.now(),data:e})}},{key:"profileIncrement",value:function(e){this.bridgeReport?this.appBridge.profileIncrement(JSON.stringify(e)):this.emit(Types.ProfileIncrement,e,Types.Profile),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行profileIncrement",level:"info",time:Date.now(),data:e})}},{key:"profileUnset",value:function(e){this.bridgeReport?this.appBridge.profileUnset(e):this.emit(Types.ProfileUnset,e,Types.Profile),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行profileUnset",level:"info",time:Date.now(),data:e})}},{key:"profileAppend",value:function(e){this.bridgeReport?this.appBridge.profileAppend(JSON.stringify(e)):this.emit(Types.ProfileAppend,e,Types.Profile),this.emit(DebuggerMesssge$1.DEBUGGER_MESSAGE,{type:DebuggerMesssge$1.DEBUGGER_MESSAGE_SDK,info:"SDK 执行profileAppend",level:"info",time:Date.now(),data:e})}},{key:"setExternalAbVersion",value:function(e){this.emit(Types.AbExternalVersion,"string"==typeof e&&e?"".concat(e).trim():null,Types.Ab)}},{key:"getVar",value:function(e,t,r){this.emit(Types.AbVar,{name:e,defaultValue:t,callback:r},Types.Ab)}},{key:"getABconfig",value:function(e,t){this.emit(Types.AbConfig,{params:e,callback:t},Types.Ab)}},{key:"getAbSdkVersion",value:function(){return this.configManager.getAbVersion()}},{key:"onAbSdkVersionChange",value:function(e){var t=this;return this.emit(Types.AbVersionChangeOn,e,Types.Ab),function(){t.emit(Types.AbVersionChangeOff,e,Types.Ab)}}},{key:"offAbSdkVersionChange",value:function(e){this.emit(Types.AbVersionChangeOff,e,Types.Ab)}},{key:"openOverlayer",value:function(){this.emit(Types.AbOpenLayer,"",Types.Ab)}},{key:"closeOverlayer",value:function(){this.emit(Types.AbCloseLayer,"",Types.Ab)}},{key:"getAllVars",value:function(e){this.emit(Types.AbAllVars,e,Types.Ab)}},{key:"autoInitializationRangers",value:function(e){AutoBase(e)}},{key:"destoryInstace",value:function(){this.destroyInstance||(this.destroyInstance=!0,this.off(Types.TokenComplete))}}],[{key:"usePlugin",value:function(t,r,n){if(r){for(var i=!1,o=0,a=e.plugins.length;o<a;o++){if(e.plugins[o].name===r){e.plugins[o].plugin=t,e.plugins[o].options=n||{},i=!0;break}}i||e.plugins.push({name:r,plugin:t,options:n})}else e.plugins.push({plugin:t})}}]),e}(),Collector=_Collector;function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function asyncGeneratorStep(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(error){return void r(error)}s.done?t(l):Promise.resolve(l).then(n,i)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){asyncGeneratorStep(o,n,i,a,s,"next",e)}function s(e){asyncGeneratorStep(o,n,i,a,s,"throw",e)}a(void 0)}))}}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}Collector.plugins=[];var runtime_1=createCommonjsModule((function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(A){l=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i=t&&t.prototype instanceof y?t:y,o=Object.create(i.prototype),a=new k(n||[]);return o._invoke=function(e,t,r){var n=h;return function(i,o){if(n===p)throw new Error("Generator is already running");if(n===f){if("throw"===i)throw o;return I()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=C(a,r);if(s){if(s===g)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=f,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var l=u(e,t,r);if("normal"===l.type){if(n=r.done?f:d,l.arg===g)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n=f,r.method="throw",r.arg=l.arg)}}}(e,r,a),o}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(A){return{type:"throw",arg:A}}}e.wrap=c;var h="suspendedStart",d="suspendedYield",p="executing",f="completed",g={};function y(){}function v(){}function m(){}var _={};_[o]=function(){return this};var b=Object.getPrototypeOf,T=b&&b(b(O([])));T&&T!==r&&n.call(T,o)&&(_=T);var E=m.prototype=y.prototype=Object.create(_);function S(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function $(e,t){function r(i,o,a,s){var l=u(e[i],e,o);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"===_typeof$4(h)&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(h).then((function(e){c.value=e,a(c)}),(function(e){return r("throw",e,a,s)}))}s(l.arg)}var i;this._invoke=function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}}function C(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,C(e,r),"throw"===r.method))return g;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var i=u(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var o=i.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function w(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 P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function O(e){if(e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:I}}function I(){return{value:t,done:!0}}return v.prototype=E.constructor=m,m.constructor=v,v.displayName=l(m,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,l(e,s,"GeneratorFunction")),e.prototype=Object.create(E),e},e.awrap=function(e){return{__await:e}},S($.prototype),$.prototype[a]=function(){return this},e.AsyncIterator=$,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new $(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},S(E),l(E,s,"Generator"),E[o]=function(){return this},E.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=O,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},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 r=this;function i(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(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 o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),P(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;P(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}(e.exports);try{regeneratorRuntime=t}catch(r){Function("r","regeneratorRuntime = r")(t)}})),device_id_key="xgplayer_device_id",user_id_key="xgplayer_user_id",getCookie=function(e){if(!document.cookie)return null;for(var t=document.cookie.split(";"),r=0,n=t.length;r<n;r++){var i=t[r];if(t[r].indexOf(e)>=0)return i.split("=")[1]||null}},genRandomID=function(e){return String(Math.floor(Math.random()*Math.pow(10,e)))},getDeviceID=function(){var e=getCookie(device_id_key);if(e)return e;var t=genRandomID(11);return document.cookie=device_id_key+"="+t+";max-age=31536000;path=/",t},getUserId=function(){var e=getCookie(user_id_key);if(e)return e;var t=genRandomID(12);return document.cookie=user_id_key+"="+t+";max-age=31536000;path=/",t},getLogId=function(){return genRandomID(12)};function getBrowser(){var e=navigator.userAgent.toLowerCase(),t={},r={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:e.indexOf("chrome")>-1&&e.indexOf("safari")>-1,Firefox:e.indexOf("firefox")>-1,Opera:e.indexOf("opera")>-1,Safari:e.indexOf("safari")>-1&&-1==e.indexOf("chrome"),Edge:e.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(e),WeixinBrowser:/MicroMessenger/i.test(e)};for(var n in r)if(r[n]){var i="";if("IE"===n)i=e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2];else if("Chrome"===n){for(var o in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[o].type&&(n="360");var a=e.match(/chrome\/([\d.]+)/);i=a?a[1]:"-1"}else if("Firefox"===n){var s=e.match(/firefox\/([\d.]+)/);i=s?s[1]:"-1"}else if("Opera"===n){var l=e.match(/opera\/([\d.]+)/);i=l?l[1]:"-1"}else if("Safari"===n){var c=e.match(/version\/([\d.]+)/);i=c?c[1]:"-1"}else if("Edge"===n){var u=e.match(/edge\/([\d.]+)/);i=u?u[1]:"-1"}else if("QQBrowser"===n){var h=e.match(/qqbrowser\/([\d.]+)/);i=h?h[1]:"-1"}t.type=n,t.versions=parseInt(i)}return t}var sniffer={get device(){return sniffer.os.isPc?"pc":"mobile"},get browser(){var e=getBrowser();return e.type+"_"+e.versions},get os(){var e=navigator.userAgent;navigator.platform.toLowerCase();var t=/(?:Windows Phone)/.test(e),r=/(?:SymbianOS)/.test(e)||t,n=/(?:Android)/.test(e),i=/(?:Firefox)/.test(e),o=/(?:iPad|PlayBook)/.test(e)||n&&!/(?:Mobile)/.test(e)||i&&/(?:Tablet)/.test(e),a=/(?:iPhone)/.test(e)&&!o;return{isTablet:o,isPhone:a,isAndroid:n,isPc:!(a||n||r||o),isSymbian:r,isWindowsPhone:t,isFireFox:i}},get operation_os(){for(var e=navigator.userAgent,t=[{s:"windows",r:/(Windows 10.0|Windows NT 10.0|Windows NT 10.1|Windows 8.1|Windows NT 6.3|Windows 8|Windows NT 6.2|Windows 7|Windows NT 6.1)/},{s:"android",r:/Android/},{s:"linux",r:/(Linux|X11)/},{s:"ios",r:/(iPhone|iPad|iPod)/},{s:"mac",r:/Mac OS X/},{s:"mac",r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/}],r=0;r<t.length;r++){var n=t[r];if(n.r.test(e))return n.s}return"unknown"}};function getCurrentTime(){return(new Date).getTime()}function getPlayFormat(e){var t="unknown";return"string"!=typeof e?t:e.indexOf(".flv")>-1?"flv":e.indexOf(".m3u8")>-1?"m3u8":e.indexOf(".mp4")>-1?"mp4":e.indexOf(".sdp")>-1?"rts":t}function getPlayerCore(e){if(e.plugins){if(e.plugins.flv)return e.plugins.flv;if(e.plugins.hls)return e.plugins.hls;if(e.plugins.rts)return e.plugins.rts;if(e.plugins.flvlive)return e.plugins.flvlive;if(e.plugins.hlslive)return e.plugins.hlslive;if(e.plugins.hlsvod)return e.plugins.hlsvod;if(e.plugins.hlslivemobile)return e.plugins.hlslivemobile;if(e.plugins.flvlivemobile)return e.plugins.flvlivemobile}return e.newHls||e.newFlv||e.__core__||e.flv}function getDefaultOptions(e){return{device_id:e.device_id||getDeviceID(),user_id:e.user_id||getUserId(),error_report_stop:!!e.error_report_stop,project_key:e.project_key||"xigua_live",product_line:e.product_line||"live",onReport:e.onReport||function(){}}}function getDefaultLog(){return{start_play:{start_play_time:0,event_key:"start_play"},first_frame:{start:0,first_frame_view:0,event_key:"first_frame",first_sei_delay:0,ntp_sync:0,ntp_delta:0,ttfb:-1,ttdb:-1,ttfb_end:0},first_frame_failed:{code:void 0,msg:"",event_key:"first_frame_failed"},stall_start:{ready_state:-1,stall_start_time:0,event_key:"stall_start"},stalling:{event_key:"stalling"},stall:{reason:0,stall_start:0,stall_end:0,ready_state:0,event_key:"stall"},play_stop:{code:0,stop_time:0,drop_percent:0,is_stream_received:0,stall_count:0,stall_time:0,retry_count:0,duration:0,stall_count_per_100sec:0,stall_time_per_100sec:0,event_key:"play_stop",dns_parse_time:-1,redirect:-1,ttfb:-1,buffered:[],is_firstframe_received:0,meta:null},playing:{index:0,stall_count:0,stall_time:0,play_time:1e4,retry_count:0,is_last:0,video_buffer_time:0,audio_buffer_time:0,speed_switch_count:0,speed_switch_info:"none",download_speed:0,decode_fps:0,render_fps:0,drop_count:0,drop_percent:0,sei_source:"",sei_delay:0,ntp_sync:0,ntp_delta:0,event_key:"playing",stop_time:0,duration:0,stall_count_per_100sec:0,stall_time_per_100sec:0},play_error:{code:void 0,info:"",event_key:"play_error"},play_low_decode:{fps:-1,decode_fps:-1,bitrate:-1,url:-1,msg:"",event_key:"play_low_decode"},play_av_unsync:{aDts:-1,vDts:-1,frameLength:-1,currentTime:-1,duration:0,event_key:"play_av_unsync"},play_loadstream:{loadstream_url:"",event_key:"play_loadstream"},play_stream_loaded:{event_key:"play_stream_loaded"},play_metadata_loaded:{metadata_type:"",event_key:"play_metadata_loaded"},stream_exception:{event_key:"stream_exception"},pause:{event_key:"pause"},play_url_change:{event_key:"play_url_change"},source_opened:{event_key:"source_opened"},source_updateend:{event_key:"source_updateend"},play_result:{event_key:"play_result",result:0,threshold:15e3,is_threshold:0},degrade:{event_key:"degrade",payload:{}}}}function getCommonLog(e){var t=e.player,r=t.config.mediaType;return _objectSpread2({project_key:e.project_key,live_sdk_version:getPlayerCore(t)||t.hlsOps?"2":"-1",player_sdk_version:t.version,logger_version:"1.0.0-alpha.9",report_version:"5",product_line:e.product_line,user_id:e.user_id,device_id:e.device_id,logger_id:getLogId(),app_name:e.app_name,cdn_ip:e.cdn_ip,is_wasm:+(!!r&&"video"!==r),review_is_live:t.config.isLive?2:1,aid:e.aid,live_id:e.live_id||e.aid+"-"+e.user_id+"-"+Date.now(),is_preview:e.is_preview?1:0,codec_type:e.codec_type||"h264",width:Math.floor(t.config.width),height:Math.floor(t.config.height),browser:sniffer.browser,ua:navigator.userAgent,href:window.location.href,timestamp:0,logger_init_time:Date.now(),play_current_time:0,cdn_play_url:t.config.url&&t.config.url.startsWith("//")?window.location.protocol+t.config.url:t.config.url,play_format:getPlayFormat(t.config.url)},e.ext)}function Utf8ArrayToStr(e){var t,r,n,i,o,a;for(t="",n=e.length,r=0;r<n;)switch((i=e[r++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:t+=String.fromCharCode(i);break;case 12:case 13:o=e[r++],t+=String.fromCharCode((31&i)<<6|63&o);break;case 14:o=e[r++],a=e[r++],t+=String.fromCharCode((15&i)<<12|(63&o)<<6|(63&a)<<0)}return t}var getResourceTiming=function(e){var t=performance.getEntriesByType("resource").filter((function(t){return t.name===e}));if(t.length){var r=t[0],n=t[t.length-1];return{dns_parse_time:Number.parseInt(r.domainLookupEnd-r.domainLookupStart),redirect:Number.parseInt(r.redirectEnd-r.redirectStart),ttfb:Number.parseInt(n.responseStart-n.requestStart)}}return{dns_parse_time:-1,redirect:-1,ttfb:-1}},video_error={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"},channelMapAppId={cn:7497,va:7997},Tea=new Collector("xglive"),Manage=function(){function e(e){var t=e.user_id,r=e.device_id,n=e.channel,i=void 0===n?"cn":n,o=e.channel_domain;if(!Tea.inited){var a={app_id:channelMapAppId[i],channel:i};o&&(a.channel_domain=o),Tea.init(a),Tea.start(),Tea.inited=!0}var s={};t&&(s.user_unique_id=t),r&&(s.device_id=r),Tea.config(s),this.logOptions=e,this._player=e.player}var t=e.prototype;return t.push=function(e){var t=this._player.config.url;this._player.video&&(e.play_current_time=this._player.currentTime),e.cdn_play_url=t&&t.startsWith("//")?window.location.protocol+t:t,e.play_format=getPlayFormat(t),e.timestamp=getCurrentTime(),this.send(e)},t.send=function(e){e.event_key&&(this.logOptions.onReport&&this.logOptions.onReport(e.event_key,e),Tea.event(e.event_key,_objectSpread2({},e)))},e}(),navgatorOnlineSupported=function(){return void 0!==navigator.onLine},navigatorConnectionType=function(){var e=navigator.connection;return e&&(e.effectiveType||e.type)},getNetStat=function(){return navgatorOnlineSupported()?navigator.onLine?navigatorConnectionType()||sniffer.device:"none":"unknown"},videoEvts=["play","playing","pause","ended","error","seeking","seeked","timeupdate","waiting","canplay","canplaythrough","durationchange","ratechange","volumechange","loadeddata"],isSafari=!1,LoggerControl=function(){function e(e){this.options=e,this.logger=new XgLiveLogger(e),this.restart=this.restart.bind(this),this.bindUrlChange(),isSafari=sniffer.browser.includes("Safari")}var t=e.prototype;return t.restart=function(e){this.destroy("string"!=typeof e&&Boolean(e)),this.logger=new XgLiveLogger(this.options),this.bindUrlChange(),this.logger.reportStartPlay(),this.logger.handlePlayerComlete()},t.bindUrlChange=function(){this.options&&this.options.player&&!this.options.manual_restart&&this.options.player.on("urlchange",this.restart)},t.setNTP=function(e){this.logger.setNTP(e)},t.updateExt=function(e){this.options.ext=Object.assign(this.options.ext||{},e),this.logger&&this.logger.updateExt(e)},t.destroy=function(e){this.logger.destroy(e),this.logger=null,this.options&&this.options.player&&!this.options.manual_restart&&this.options.player.off("urlchange",this.restart)},e}(),XgLiveLogger=function(){function e(e){if(!e.player)throw new Error("option player is necessary");this.options=Object.assign({},e,getDefaultOptions(e)),this._player=this.options.player,this._url=this._player.config.url,this.project_key=e.project_key||"xigua_live",this.product_line=e.product_line||"live",this.ntpDelta=this.options.ntp?Date.now()-this.options.ntp:0,this.inWaitingStart=0,this.errorNumber=0,this.tempDroppedFrameCount=0,this.tempTotalFrameCount=0;this.options.reportURL?this.options.reportURL:this.options.overseas||"https://log.isnssdk.com/video/v1/live_log/".replace("isnssdk","snssdk"),this._logmanager=new Manage(this.options),this.init(),this.started=!1,this.destroyed=!1,this.completed=!1,this.firstFrameViewed=!1,this.cacheRtcStats={}}var t=e.prototype;return t.setNTP=function(e){this.options&&(this.options.ntp=e,this.ntpDelta=Date.now()-this.options.ntp)},t.init=function(){this.bindCtx(),this.initLog(),this.initEvt()},t.bindCtx=function(){this.handlePlayerComlete=this.handlePlayerComlete.bind(this),this.handlePlayerPlaying=this.handlePlayerPlaying.bind(this),this.destroyFunc=this.destroyFunc.bind(this),this.handleUserLeave=this.handleUserLeave.bind(this),this.handlePlayerError=this.handlePlayerError.bind(this),this.handlePlayerReady=this.handlePlayerReady.bind(this),this.handlePlayerWaiting=this.handlePlayerWaiting.bind(this),this.handleAVUnsync=this.handleAVUnsync.bind(this),this.handlePlayerPause=this.handlePlayerPause.bind(this),this.handleTTFB=this.handleTTFB.bind(this),this.handleUrlChange=this.handleUrlChange.bind(this),this.handleKeyframe=this.handleKeyframe.bind(this),this.handleSourceOpen=this.handleSourceOpen.bind(this),this.handleBufferAppend=this.handleBufferAppend.bind(this),this.handleCoreEvent=this.handleCoreEvent.bind(this),this.handleDegrade=this.handleDegrade.bind(this)},t.initLog=function(){var e=this,t=this.options,r=t.player,n=void 0!==r.hlsOps;this.commonParams=_objectSpread2({os:sniffer.operation_os},getCommonLog(t)),this.log=Object.assign({},getDefaultLog());var i=this;for(var o in this.log){var a=function(t){Object.defineProperty(e.log[o],t,{get:function(){return null==this["_"+t]?i.commonParams[t]:this["_"+t]},set:function(e){this["_"+t]=e},enumerable:!0})};for(var s in this.commonParams)a(s);n&&Object.defineProperty(this.log[o],"m3u8",{get:function(){if(r.__core__){var e=r.__core__.m3u8Text;return e?e.slice(0,25e4):""}return""},enumerable:!0}),Object.defineProperty(this.log[o],"volume",{get:function(){if(r&&r.video)return r.volume||0},enumerable:!0}),Object.defineProperty(this.log[o],"access",{get:function(){return getNetStat()},enumerable:!0})}},t.updateExt=function(e){for(var t in this.log)for(var r in e)this.log[t][r]=e[r]},t.reportStartPlay=function(){this.started||(this.started=!0,this.log.start_play.start_play_time=this.log.start_play.timestamp=getCurrentTime(),this.logmanager.push(this.log.start_play,!0))},t.initWindowListener=function(){"pc"===sniffer.device?window.addEventListener("beforeunload",this.handleUserLeave):"mobile"===sniffer.device&&(window.addEventListener("beforeunload",this.handleUserLeave),window.addEventListener("pagehide",this.handleUserLeave))},t.removeWindowListener=function(){"pc"===sniffer.device?window.removeEventListener("beforeunload",this.handleUserLeave):"mobile"===sniffer.device&&(window.removeEventListener("beforeunload",this.handleUserLeave),window.removeEventListener("pagehide",this.handleUserLeave))},t.initEvt=function(){var e=this,t=this.player;videoEvts.forEach((function(t){e["handleVideo"+t+"Evt"]=function(){e["handleVideo"+t]&&e["handleVideo"+t]()},e.initWindowListener(),e.bindVideoEvt(t,e["handleVideo"+t+"Evt"])})),t.once("error",this.handlePlayerError),t.once("complete",this.handlePlayerComlete),t.once("playing",this.handlePlayerPlaying),t.once("timeupdate",this.handlePlayerPlaying),t.once("destroy",this.destroyFunc),t.on("ready",this.handlePlayerReady),t.on("waiting",this.handlePlayerWaiting),t.on("pause",this.handlePlayerPause),t.on("urlchange",this.handleUrlChange),t.once("sourceopen",this.handleSourceOpen),t.once("bufferappend",this.handleBufferAppend),t.on("core_event",this.handleCoreEvent),t.on("degrade",this.handleDegrade),this.hiJackPlayerStart()},t.handleCoreEvent=function(e){var t=e.eventName,r=e.headers,n=e.pts,i=e.type,o=e.meta,a=e.sei,s=e.decodeFps,l=e.url;switch(t){case"core.ttfb":this.handleTTFB(e);break;case"core.loadresponseheaders":var c=r.get("X-Server-Ip");void 0!==this.player.hlsOps&&(this.log.play_stop.review_ts_count+=1),c&&(this.commonParams.cdn_ip=c);break;case"core.loadretry":this.log.play_stop.retry_count++;break;case"core.keyframe":this.handleKeyframe(n);break;case"core.metadataparsed":this.handleMetaDataLoaded(i,o);break;case"core.sei":this.handleSEIParsed(a);break;case"core.lowdecode":this.commonParams.is_wasm&&(Object.assign(this.log.play_low_decode,e||{}),this.log.play_low_decode.decode_fps=s,this.log.play_low_decode.timestamp=getCurrentTime(),this.logmanager.push(this.log.play_low_decode,!0),this.commonParams.is_wasm=0);break;case"core.largeavgap":this.handleAVUnsync(e);break;case"core.loadstart":this.handlePlayerLoadStream(l);break;case"core.loadcomplete":this.handlePlayerLoadedStream();break;case"core.streamexception":this.handleStreamException(e)}},t.handleDegrade=function(e){this.log.degrade.payload=e,this.logmanager.push(this.log.degrade,!0)},t.hiJackPlayerStart=function(){var e=arguments,t=this;this.player._start=this.player.start;var r=this.player;r.start=function(){try{if(r._start)return r._start.apply(r,Array.prototype.slice.call(e,0))}catch(e2){}t.destroyed||t.handlePlayerComlete()}},t.handleTTFB=function(e){var t=e||{},r=t.end,n=t.elapsed;this.log.first_frame.ttfb=n||-1,this.log.first_frame.ttfb_end=r||0},t.handleUrlChange=function(e){this.logmanager.push(Object.assign(this.log.play_url_change,{url:e,timestamp:getCurrentTime()}))},t.handleKeyframe=function(e){this.log.play_stop.is_firstframe_received=1,this.log.play_stop.firstframe_pts=e},t.handleSourceOpen=function(){this.log.source_opened.timestamp=getCurrentTime(),this.logmanager.push(this.log.source_opened)},t.handleBufferAppend=function(){this.log.source_updateend.timestamp=getCurrentTime(),this.logmanager.push(this.log.source_updateend)},t.handlePlayerPause=function(){this.log.pause.timestamp=getCurrentTime(),this.logmanager.push(this.log.pause,!0)},t.handlePlayerError=function(e){this.errorNumber=1;var t=e.errorType,r=e.errorCode;Object.assign(this.log.play_error,_objectSpread2({timestamp:getCurrentTime(),code:r||("parse"===t?31:21),info:e.message,detail:JSON.stringify(e)},this.videoSize)),this.logmanager.push(this.log.play_error,!0),this.destroyed||(0===this.log.first_frame.first_frame_view&&(Object.assign(this.log.first_frame_failed,{code:r||("parse"===t?31:21),msg:e.message}),void 0!==this.log.first_frame_failed.timestamp&&(this.log.first_frame_failed.timestamp=getCurrentTime()),this.logmanager.push(this.log.first_frame_failed,!0),this.log.play_result.is_threshold||(this.clearPlayResultTimer(),this.log.play_result.reason=e.message||"first frame failed",this.logmanager.push(this.log.play_result,!0))),this.options.error_report_stop?this.handleUserLeave():this.updatePlayStopParams())},t.handlePlayerLoadStream=function(e){if("string"==typeof e){var t=this.log.play_loadstream;t.timestamp=getCurrentTime(),t.loadstream_url=e,this.logmanager.push(t)}},t.handlePlayerLoadedStream=function(){var e=this.log.play_stream_loaded;e.timestamp=getCurrentTime(),this.logmanager.push(e)},t.handleSEIParsed=function(e){var t=this.log,r=t.playing,n=t.first_frame;if(100===e.code){var i=Utf8ArrayToStr(e.content);i=i.slice(i.indexOf("{"),i.lastIndexOf("}")+1);try{var o=JSON.parse(i),a=this.getPlayerBuffer()+this.ntpTime-o.ts;r.sei_delay=a,r.sei_source=o.source,r.ntp_sync=this.options.ntp?1:0,r.ntp_delta=this.ntp_delta,n.first_sei_delay=a,n.ntp_sync=this.options.ntp?1:0,n.ntp_delta=this.ntp_delta}catch(e2){}}},t.handleMetaDataLoaded=function(e,t){this.log.play_stop.meta=this.log.play_stop.meta||{},e&&(this.log.play_stop.meta[e]=t),this.log.play_metadata_loaded.timestamp=getCurrentTime(),this.log.play_metadata_loaded.metadata_type=e,t&&(this.log.play_metadata_loaded.meta=t,this.log.play_metadata_loaded.codec=t.codec,this.commonParams.codec_type=t.codec),t||(this.log.play_metadata_loaded.meta=void 0,this.log.play_metadata_loaded.codec=void 0,"video"===e&&(this.commonParams.codec_type="unknown")),this.logmanager.push(this.log.play_metadata_loaded)},t.handleAVUnsync=function(e){Object.assign(this.log.play_av_unsync,e||{}),this.log.play_av_unsync.timestamp=getCurrentTime(),this.logmanager.push(this.log.play_av_unsync,!1)},t.handleStreamException=function(e){this.logmanager.push(Object.assign({},this.log.stream_exception,e))},t.handlePlayerComlete=function(){this.completed||(this.completed=!0,this.core=getPlayerCore(this.player),this.core&&(this.commonParams.live_sdk_version="2"),(this.player.config.autoplay||this.player.config.videoInit)&&this.reportStartPlay())},t.getPlayerBuffer=function(){var e=this.player.video.buffered;if(e){var t=Math.max(0,e.length-1);try{var r=Number.parseInt(1e3*(e.end(t)-this.player.video.currentTime));return this.log.playing.audio_buffer_time=this.log.playing.video_buffer_time=r,r}catch(e2){return 0}}},t.getPlayerDownloadSpeed=function(){if(this.core&&this.core.core)return this.core.core.speedInfo().speed},t.getPlayerQuality=function(){var e=this.player.video;if(e.getVideoPlaybackQuality){var t=e.getVideoPlaybackQuality();this.log.playing.drop_count=t.droppedVideoFrames-this.tempDroppedFrameCount,this.log.playing.drop_percent=Number.parseFloat(this.tempTotalFrameCount/t.totalVideoFrames).toFixed(1),this.log.play_stop.drop_percent=Number.parseFloat(t.droppedVideoFrames/t.totalVideoFrames).toFixed(1),this.tempDroppedFrameCount=t.droppedVideoFrames,this.tempTotalFrameCount=t.totalVideoFrames}},t.getExtraStats=function(){var e=_asyncToGenerator(runtime_1.mark((function e(t,r){return runtime_1.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){if(isSafari||"undefined"!==window.InstallTrigger)return e();try{t.getStats((function(t){t.result().forEach((function(e){var t={};e.names().forEach((function(r){t[r]=e.stat(r)})),t.id=e.id,t.type=e.type,t.timestamp=e.timestamp,"ssrc"===e.type?(null!=t.googAccelerateRate&&(r.accelerate_rate=t.googAccelerateRate),"audio"===t.mediaType?(r.audio_jitter_buffer_ms=t.googJitterBufferMs,r.audio_rtt_ms=t.googRtt,r.expand_rate=t.googExpandRate):"video"===t.mediaType&&(r.video_rtt_ms=t.googRtt,r.video_codec_name=t.googCodecName)):"VideoBwe"===e.type&&(r.video_recv_retransmit_bps=t.googRetransmitBitrate)})),e()}))}catch(error){e()}})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),t.getRtcStats=function(){var e=_asyncToGenerator(runtime_1.mark((function e(t){var r,n,i,o,a=this;return runtime_1.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.player.plugins.rts&&this.player.plugins.rts.pc){e.next=3;break}return e.abrupt("return");case 3:return n={},e.next=6,r.getStats();case 6:return i=e.sent,o=t-this.log.playing.timestamp,i.forEach((function(e){var t=e.type,r=e.mediaType,i=e.bytesReceived,s=e.packetsReceived,l=e.audioLevel,c=e.concealmentEvents,u=e.remoteTimestamp,h=e.timestamp,d=e.framesDropped,p=e.framesPerSecond,f=e.keyFramesDecoded,g=e.totalDecodeTime,y=e.framesDecoded,v=e.firCount,m=e.frameHeight,_=e.frameWidth,b=e.framesReceived,T=e.jitterBufferDelay,E=e.jitterBufferEmittedCount,S=e.jitter,$=e.nackCount,C=e.packetsLost,w=e.pliCount,P=e.totalSamplesReceived,k=e.concealedSamples;switch(t){case"inbound-rtp":"audio"===r?(n.audio_bytes_received=i,n.audio_packets_lost=C,n.audio_packets_received=s,n.audio_volume=-10*Math.log10(Math.pow(l,2))*255,n.concealment_event=c,n.audio_fraction_lost=C/s,null!=a.cacheRtcStats.totalSamplesReceived&&(n.audio_dec_sample_rate=(P-a.cacheRtcStats.totalSamplesReceived)/o),a.cacheRtcStats.totalSamplesReceived=P,n.concealed_samples=k,n.total_samples_received=P):(n.frames_dropped_by_framebuffer=d,n.frame_buffer_out_interval=p,n.iframes_jitter_buffer_out=f,n.video_bytes_received=i,n.video_dec_elapse=1e3*g,n.video_decoded_delay_ms=n.video_dec_elapse/y,n.video_fir_count=v,n.video_fraction_lost=C/s,n.video_frame_height=m,n.video_frame_width=_,null!=a.cacheRtcStats.framesDecoded&&(n.video_framerate_decoder_output=(y-a.cacheRtcStats.framesDecoded)/o),a.cacheRtcStats.framesDecoded=y,null!=a.cacheRtcStats.framesReceived&&(n.video_framerate_recv=(b-a.cacheRtcStats.framesReceived)/o),a.cacheRtcStats.framesReceived=b,n.video_jb_min_delay=T/E*1e3,n.video_jitter=1e3*S,n.video_nack_count=$,n.video_packets_lost=C,n.video_packets_received=s,n.video_pli_count=w);break;case"remote-outbound-rtp":n.e2e_delay_ms=h-u}n.total_delay=n.e2e_delay_ms+n.video_decoded_delay_ms+n.video_jb_min_delay})),e.next=11,this.getExtraStats(r,n);case 11:this.log.playing.rtc_stats=n;case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.reportPlaying=function(){var e=_asyncToGenerator(runtime_1.mark((function e(t){var r,n,i,o,a,s;return runtime_1.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.commonParams.is_wasm&&(this.commonParams.fps=this.player.video.fps,this.log.playing.render_fps=this.player.video.fps,this.log.playing.decode_fps=this.player.video.decodeFps),this.log.playing.index++,r=this.log.playing.timestamp,this.inWaitingStart&&this.inWaitingStart<getCurrentTime()&&(n=Math.min(this.options.playingInterval||this.log.playing.play_time,getCurrentTime()-Math.max(this.inWaitingStart,r))),this.getPlayerQuality(),this.getPlayerBuffer(),this.options.downloadSpeedInterval||(this.log.playing.current_speed=this.getPlayerDownloadSpeed()),i=getCurrentTime(),e.next=10,this.getRtcStats(i);case 10:o=i-r,a=(n>200?n:0)+this.log.playing.stall_time,s=(n>200?1:0)+this.log.playing.stall_count,this.options.aggregationDowngradeStallTime&&(this.log.playing.aggregation_downgrade_stall=(n>this.options.aggregationDowngradeStallTime?n:0)+(this.log.playing.aggregation_downgrade_stall||0)),Object.assign(this.log.playing,_objectSpread2({timestamp:i,stop_time:i,duration:t?0:o/1e3,stall_time_per_100sec:a/o*100,stall_count_per_100sec:1e3*s/o*100,stall_count:s,stall_time:a,play_current_time:this.player.currentTime},this.videoSize)),this.logmanager.push(Object.assign({},this.log.playing,{play_time:t?0:o}),!0),this.log.playing.download_speed_array=[],this.log.playing.stall_time=0,this.log.playing.stall_count=0,this.options.aggregationDowngradeStallTime&&(this.log.playing.aggregation_downgrade_stall=0);case 20:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.handlePlayerPlaying=function(){var e=_asyncToGenerator(runtime_1.mark((function e(){var t,r=this;return runtime_1.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.player&&this.player.video.readyState<3)){e.next=2;break}return e.abrupt("return");case 2:return this.player.off("playing",this.handlePlayerPlaying),this.player.off("timeupdate",this.handlePlayerPlaying),e.next=6,this.reportPlaying(!0);case 6:this.clearPlayingInterval(),t=this.options.playingInterval||this.log.playing.play_time,this.intervalId=setInterval(_asyncToGenerator(runtime_1.mark((function e(){return runtime_1.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(Math.abs(Date.now()-r.log.playing.timestamp-t)<100||Date.now()-r.log.playing.timestamp>=t)){e.next=3;break}return e.next=3,r.reportPlaying();case 3:case"end":return e.stop()}}),e)}))),1e3),this.clearStallTimer(),this.handleVideoplaying(),this.started||this.reportStartPlay(),this.saveBuffered();case 13:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.handlePlayerReady=function(){var e=this;this.log.start_play.start_play_time=getCurrentTime(),this.player.config.autoplay&&this.reportStartPlay(),this.options.playResultThreshold&&(this.log.play_result.threshold=this.options.playResultThreshold),this.clearPlayResultTimer(),this.playResultTimer=setTimeout((function(){e.log.play_result.is_threshold=1,e.logmanager.push(e.log.play_result,!0)}),this.log.play_result.threshold)},t.handlePlayerWaiting=function(){var e=this;!this.inWaitingStart&&this.log.first_frame.timestamp&&(this.log.stall.timestamp=this.inWaitingStart=this.log.stall.stall_start=getCurrentTime(),this.log.stall_start.ready_state=this.log.stall.ready_state=this.player.video.readyState,this.log.stall_start.timestamp=getCurrentTime(),this.log.stall_start.stall_start_time=getCurrentTime(),this.log.stall_start.video_buffer_time=this.player.video.readyState,this.log.stall_start.play_current_time=this.player.currentTime,this.log.stall.play_current_time=this.player.currentTime,this.log.stall_start.buffered=this.getBuffered(),this.log.stall.buffered=this.log.stall_start.buffered,this.log.stall.current_speed=this.getPlayerDownloadSpeed(),Object.assign(this.log.stall_start,this.videoSize),this.clearStallTimer(),this.stallStartTimer=setTimeout((function(){e.logmanager.push(e.log.stall_start,!0)}),205))},t.handleVideoseeking=function(){this.player&&this.player.video&&this.inWaitingStart&&this.player.video.duration<1/0&&(this.inWaitingStart=0,this.clearStallTimer())},t.handleVideoseeked=function(){this.player&&this.player.video&&this.inWaitingStart&&this.player.video.duration<1/0&&(this.inWaitingStart=0,this.log.play_stop.stall_count>0&&this.log.play_stop.stall_count--)},t.handleVideoplay=function(){this.reportStartPlay(),this.removeVideoEvt("play",this.handleVideoplay)},t.handleVideotimeupdate=function(){Math.abs(this.player.currentTime-this.log.stall_start.play_current_time)>.2&&this.stallEnd(),this.saveBuffered()},t.handleVideocanplay=function(){this.stallEnd(),this.reportFirstframe()},t.handleVideoplaying=function(){this.stallEnd(),this.log.play_stop.is_stream_received=1;var e=getCurrentTime();this.reportStartPlay(),this.log.first_frame.start=e},t.stallEnd=function(){this.clearStallTimer();var e=getCurrentTime();if(this.inWaitingStart){var t=e-this.inWaitingStart;t>200&&(this.log.play_stop.stall_count++,this.log.play_stop.stall_time+=e-this.inWaitingStart,this.log.playing.stall_time+=e-Math.max(this.inWaitingStart,this.log.playing.timestamp),this.log.stall.stall_end=e,this.log.stall.timestamp=getCurrentTime(),this.log.playing.stall_count++,Object.assign(this.log.stall,_objectSpread2({},this.videoSize)),this.logmanager.push(this.log.stall,!0)),this.options.aggregationDowngradeStallTime&&t>this.options.aggregationDowngradeStallTime&&(this.log.playing.aggregation_downgrade_stall=(this.log.playing.aggregation_downgrade_stall||0)+(e-Math.max(this.inWaitingStart,this.log.playing.timestamp)))}this.inWaitingStart=0},t.handleVideoloadeddata=function(){this.reportFirstframe()},t.handleVideoratechange=function(){this.log.playing.speed_switch_count++,this.log.playing.speed_switch_info=this.player.video.playbackRate},t.handleVideoended=function(){this.clearPlayingInterval(),this.clearStallTimer(),Object.assign(this.log.playing,_objectSpread2({timestamp:getCurrentTime(),is_last:1},this.videoSize)),this.logmanager.push(this.log.playing)},t.handleVideoerror=function(){var e=this;this.errorNumber=1;var t=this.player.video.error;Object.assign(this.log.play_error,_objectSpread2(_objectSpread2({timestamp:getCurrentTime()},this.videoSize),t&&{code:t.code,info:t.message})),this.logmanager.push(this.log.play_error,!0),0!==e.log.first_frame.first_frame_view||e.log.first_frame_failed.code||t&&(e.log.first_frame_failed.code=t.code,e.log.first_frame_failed.msg=video_error[t.code],void 0!==e.log.first_frame_failed.timestamp&&(e.log.first_frame_failed.timestamp=getCurrentTime()),e.logmanager.push(e.log.first_frame_failed,!0),e.log.play_result.is_threshold||(e.log.play_result.reason=video_error[t.code]||"first frame failed",e.clearPlayResultTimer(),e.logmanager.push(e.log.play_result,!0))),e.options.error_report_stop?e.handleUserLeave():e.updatePlayStopParams()},t.handleVideopause=function(){this.stallEnd(),this.clearPlayingInterval(),this.clearStallTimer(),clearTimeout(this.collectDownloadSpeedTimer),this.player.once("playing",this.handlePlayerPlaying),this.player.once("timeupdate",this.handlePlayerPlaying)},t.destroyFunc=function(e){var t=this;this.destroyed||(e||this.handleUserLeave(),this.destroyed=!0,"pc"===sniffer.device?window.removeEventListener("beforeunload",this.handleUserLeave):"mobile"===sniffer.device&&window.removeEventListener("pagehide",this.handleUserLeave),videoEvts.forEach((function(e){t.removeVideoEvt(e,t["handleVideo"+e+"Evt"])})),this.player&&(this.player._start&&(this.player.start=this.player._start,delete this.player._start),this.player.off("destroy",this.destroyFunc),this.player.off("complete",this.handlePlayerComlete),this.player.off("playing",this.handlePlayerPlaying),this.player.off("timeupdate",this.handlePlayerPlaying),this.player.off("ready",this.handlePlayerReady),this.player.off("waiting",this.handlePlayerWaiting),this.player.off("largeavgap",this.handleAVUnsync),this.player.off("error",this.handlePlayerError),this.player.off("SEI_PARSED",this.handleSEIParsed),this.player.off("pause",this.handlePlayerPause),this.player.off("ttfb",this.handleTTFB),this.player.off("urlchange",this.handleUrlChange),this.player.off("isKeyframe",this.handleKeyframe),this.player.off("sourceopen",this.handleSourceOpen),this.player.off("bufferappend",this.handleBufferAppend),this.player.off("core_event",this.handleCoreEvent),this.player.off("degrade",this.handleDegrade),this.clearPlayingInterval(),this.clearStallTimer(),clearTimeout(this.collectDownloadSpeedTimer),this._player=null))},t.handleUserLeave=function(){!this.destroyed&&this.started&&(this.destroyed=!0,this.updatePlayStopParams(),this.reportPlayStop(),this.clearPlayingInterval(),this.clearStallTimer(),clearTimeout(this.collectDownloadSpeedTimer),this.removeWindowListener())},t.saveBuffered=function(){try{var e=this.getBuffered();e&&e.length&&(this.log.play_stop.buffered=e)}catch(error){}},t.getBuffered=function(){try{for(var e=[],t=this.player.video,r=0;r<t.buffered.length;r++)e.push([t.buffered.start(r),t.buffered.end(r)]);return e}catch(error){}},t.reportPlayStop=function(){this.log.play_stop.play_current_time=this.player.currentTime||this.log.playing.play_current_time,this.saveBuffered(),this.logmanager.push(this.log.play_stop,!0)},t.reportFirstframe=function(){if(!this.firstFrameViewed){this.firstFrameViewed=!0;var e=getCurrentTime();Object.assign(this.log.first_frame,_objectSpread2({first_frame_view:e-this.log.start_play.start_play_time||e,timestamp:e},this.videoSize)),this.log.first_frame.ttfb_end&&(this.log.first_frame.ttdb=e-this.log.first_frame.ttfb_end),this.logmanager.push(this.log.first_frame,!0),this.clearPlayResultTimer(),this.log.play_result.result=1,this.logmanager.push(this.log.play_result,!0),this.log.play_stop.is_stream_received=1}},t.updatePlayStopParams=function(){var e=getResourceTiming(this._url),t=getCurrentTime();this.playedTime=t-this.log.start_play.start_play_time;var r=this.log.play_stop;Object.assign(r,_objectSpread2({},0===r.stall_count&&{stall_time:0})),this.inWaitingStart&&t-this.inWaitingStart>200&&(r.stall_time+=t-this.inWaitingStart),this.inWaitingStart=0,Object.assign(r,_objectSpread2({stall_time_per_100sec:r.stall_time/this.playedTime*100,stall_count_per_100sec:1e3*r.stall_count/this.playedTime*100},e)),0===this.log.play_stop.stall_count_per_100sec&&(this.log.play_stop.stall_time_per_100sec=0),this.log.play_stop.stall_time_per_100sec>100||this.log.play_stop.stall_time_per_100sec<0||(this.log.playing.index?(Object.assign(this.log.playing,_objectSpread2({timestamp:getCurrentTime(),is_last:1},this.videoSize)),this.logmanager.push(this.log.playing,!0)):(this.log.play_stop.error_code=this.log.play_error.code,this.log.play_stop.error_info=this.log.play_error.info),t=getCurrentTime(),Object.assign(r,_objectSpread2({timestamp:t,stop_time:t,duration:this.playedTime/1e3,play_time:this.playedTime/1e3},this.videoSize)),0===this.errorNumber&&(r.play_time_on_no_frame=r.stop_time-this.log.start_play.start_play_time))},t.clearPlayingInterval=function(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)},t.clearStallTimer=function(){clearTimeout(this.stallStartTimer)},t.clearPlayResultTimer=function(){clearTimeout(this.playResultTimer)},t.destroy=function(e){this.destroyFunc(!e)},t.bindVideoEvt=function(e,t){this.player&&this.player.video.addEventListener(e,t,!1)},t.removeVideoEvt=function(e,t){this.player&&this.player.video&&this.player.video.removeEventListener(e,t,!1)},t.send=function(e,t){this.logmanager.send(e,t)},_createClass(e,[{key:"videoSize",get:function(){return this.player?{width:this.player.video.videoWidth,height:this.player.video.videoHeight}:{width:0,height:0}}},{key:"player",get:function(){return this._player}},{key:"logmanager",get:function(){return this._logmanager}},{key:"ntpTime",get:function(){return Date.now()-this.ntpDelta}}]),e}(),LiveLogger=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(){return _classCallCheck$5(this,r),t.apply(this,arguments)}return _createClass$6(r,[{key:"afterCreate",value:function(){var e,t,r=this;this.config.enable&&(this.config.appId?(this.openLog(),null===(e=this.player.plugins)||void 0===e||null===(t=e.sdkerrorplugin)||void 0===t||t.addErrDetail((function(){var e,t,n;if(r._liveLogger)return{label:"userId",value:null===(e=r._liveLogger)||void 0===e||null===(t=e.logger)||void 0===t||null===(n=t.options)||void 0===n?void 0:n.user_id}}))):console.info("not found appid, logger is closed"))}},{key:"startLog",value:function(){this._liveLogger=new LoggerControl({player:this.player,aid:this.config.appId,project_key:this.config.appId,app_name:this.config.appId,channel_domain:"//mcs.volceapplog.com"})}},{key:"closeLog",value:function(){this._liveLogger.destroy(),this._liveLogger=null}},{key:"openLog",value:function(){!this._liveLogger&&this.startLog()}}],[{key:"pluginName",get:function(){return"liveLogger"}},{key:"defaultConfig",get:function(){return{appId:"",enable:!0}}}]),r}(Plugin);const hls={name:"HlsPlayer",url:"//lf16-unpkg-i18n.byted-static.com/obj/unpkg-va/xgplayer-hls/3.0.0-next.36-1/dist/index.min.js"},flv={name:"FlvPlayer",url:"//lf16-unpkg-i18n.byted-static.com/obj/unpkg-va/xgplayer-flv/3.0.0-next.23/dist/index.min.js"},XGVideo={name:"XGVideo",url:"//lf16-unpkg-i18n.byted-static.com/obj/unpkg-va/byted/xgplayer-xgvideo/0.1.16/dist/index.min.js"},hlsEncrypt={name:"EncryptHlsPlugin",url:"//lf16-unpkg-i18n.byted-static.com/obj/unpkg-va/byted/xgplayer-encrypt-hls/4.0.5-alpha.0/dist/index.min.js"},dash={name:"DashPlugin",url:"//lf16-unpkg-i18n.byted-static.com/obj/unpkg-va/byted/xgplayer-encrypt/3.3.0/dist/index.min.js"},shaka={name:"ShakaPlugin",url:"//lf16-unpkg-i18n.byted-static.com/obj/unpkg-va/xgplayer-shaka/3.0.0-alpha.1/dist/index.min.js"},mp4Encrypt={name:"Mp4EncryptPlayer",url:"//lf16-unpkg-i18n.byted-static.com/obj/unpkg-va/byted/xgplayer-encrypt-mp4/3.0.0-alpha.36-25/dist/index.min.js"},danmujs={name:"danmu.js",url:"//lf16-unpkg-i18n.byted-static.com/obj/unpkg-va/danmu.js/0.6.4/dist/index.js"},danmuMask={name:"DanmuMask",url:"//lf16-unpkg-i18n.byted-static.com/obj/unpkg-va/byted/danmu-mask/0.3.6/browser/index.js"},subtitle={name:"XgSubtitle",url:"//lf16-unpkg-i18n.byted-static.com/obj/unpkg-va/xgplayer-subtitles/1.0.22/dist/index.min.js"},streamprobe={name:"StreamProbe",url:"//lf16-unpkg-i18n.byted-static.com/obj/unpkg-va/byted/streamprobe/1.0.2/dist/index.min.js"};var umdUrlMap={hls:hls,flv:flv,XGVideo:XGVideo,hlsEncrypt:hlsEncrypt,dash:dash,shaka:shaka,mp4Encrypt:mp4Encrypt,danmujs:danmujs,danmuMask:danmuMask,subtitle:subtitle,streamprobe:streamprobe},umdLoader=function(){function e(){_classCallCheck$5(this,e),this.umdUrlMap=umdUrlMap,this.backupUmdUrlMap={},this.jsLoadMap={}}return _createClass$6(e,[{key:"updateBackupMap",value:function(e){this.backupUmdUrlMap=e}},{key:"loadExtraCdn",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return new Promise((function(r,n){var i=t?document.createElement("script"):document.createElement("link");t?i.src=e:(i.rel="stylesheet",i.type="text/css",i.href=e),document.body.appendChild(i),i.onerror=function(){n("url: ".concat(e))},i.onload=i.onreadystatechange=function(){this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(i.onload=i.onreadystatechange=null,r())}}))}},{key:"loadPlugins",value:function(e,t){var r=this;if(this.umdUrlMap[e]){var n="".concat(e,"_load");return new Promise((function(i){if(Reflect.get(r.jsLoadMap,n))i(r.jsLoadMap[n]);else{var o=r.umdUrlMap[e],a=function(t){r.failCallback&&"function"==typeof r.failCallback&&r.failCallback&&r.failCallback(e,t),i(null)};if(!o)return console.error("".concat(e," umd info not exit")),a(void 0);var s=o.name,l=o.url;if(s&&window[s])return r.jsLoadMap[n]=window[s],t&&t(),i(r.jsLoadMap[n]);retry((function(){return r.loadExtraCdn(l,!0)}),2).then((function(){s?(r.jsLoadMap[n]=window[s],t&&t(),i(window[s])):(r.jsLoadMap[n]=!0,t&&t(),i(null))})).catch((function(o){var l=r.backupUmdUrlMap[e];return l?isUrl(l)?void r.loadExtraCdn(r.backupUmdUrlMap[e]).then((function(){r.jsLoadMap[n]=window[s],t&&t(),i(r.jsLoadMap[n])})).catch((function(t){console.error("load ".concat(e," error, ").concat(t)),a(void 0)})):(console.error("umdUrlMap.".concat(e," isn't a valid url")),a(void 0)):(console.error("load ".concat(e," error, ").concat(o)),a(o))}))}}))}}}]),e}(),sdkUmdLoader=new umdLoader;function createSDKPreset(e){return _createSDKPreset.apply(this,arguments)}function _createSDKPreset(){return(_createSDKPreset=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(t){var r,n,i,o,a,s,l,c,u,h,d,p,f,g,y,v,m,_,b,T,E,S;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=t.isLive,o=void 0!==i&&i,a=t.type,s=t.isMobile,l=void 0!==s&&s,c=t.playerData,u=t.getSoftOptionTask,h=["default",getDefaultPreset(o)],d=c.openSoftDecoding,p=c.isMusic,f=c.configs,g=!(null===(r=c.playList)||void 0===r||null===(n=r[0])||void 0===n||!n.kid),y=getPluginConfig(f,"EncryptHlsPlugin"),v=!!y||"hls"===a&&g,m=[],_=[],l?h.push(getMobilePreset({isLive:o,playerData:c})):h.push(getPCPreset({isLive:o,playerData:c})),e.t0=a,e.next="flv"===e.t0?12:"rtm"===e.t0?14:"dash"===e.t0?16:18;break;case 12:return _.push(_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(){var t,r;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l){e.next=8;break}if(!isMSESupport()&&!d){e.next=6;break}return e.next=4,sdkUmdLoader.loadPlugins("flv");case 4:t=e.sent,m.push(t);case 6:e.next=12;break;case 8:return e.next=10,sdkUmdLoader.loadPlugins("flv");case 10:r=e.sent,m.push(r);case 12:case"end":return e.stop()}}),e)})))()),e.abrupt("break",19);case 14:return _.push(_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([sdkUmdLoader.loadPlugins("hls"),sdkUmdLoader.loadPlugins("flv")]);case 2:m.push(RtmPlugin);case 3:case"end":return e.stop()}}),e)})))()),e.abrupt("break",19);case 16:return _.push(_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(){var t;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!f.url){e.next=5;break}return e.next=3,sdkUmdLoader.loadPlugins("shaka");case 3:t=e.sent,m.push(t);case 5:case"end":return e.stop()}}),e)})))()),e.abrupt("break",19);case 18:return e.abrupt("break",19);case 19:return p||!o&&!getPluginConfig(c.options,"DanmuPlugin")||_.push(_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(){var t;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([sdkUmdLoader.loadPlugins("danmujs"),sdkUmdLoader.loadPlugins("danmuMask")]);case 2:(t=e.sent)[0]&&t[1]&&m.push(DanmuPlugin);case 4:case"end":return e.stop()}}),e)})))()),getPluginConfig(c.options,"Subtitle")&&c.plugins.every((function(e){return"subtitle"!==e.pluginName.toLowerCase()}))&&m.push(Subtitle),e.next=23,Promise.all([u(),getPluginByConfig({isMobile:l,isLive:o,openSoftDecoding:d,type:a,isHlsEncrypt:v,playerData:c,plugins:m})].concat(_));case 23:return b=e.sent,T=_slicedToArray(b,2),E=T[0],S=T[1],e.abrupt("return",{presets:h,softDecodingOption:E,plugins:[].concat(m,_toConsumableArray$1(S)).filter(Boolean)});case 28:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function getDefaultPreset(e){var t=[ErrorPlugin,ToastPlugin,UnmutePlugin];return e&&t.push(RefreshPlugin,LiveLogger),_createClass$6((function e(){_classCallCheck$5(this,e),this.plugins=t,this.ignores=["error"]}))}function getMobilePreset(e){var t,r=e.isLive,n=e.playerData,i=["error","playbackRate"],o=n.configs,a=getPluginConfig(o,"EncryptHlsPlugin"),s=null==o||null===(t=o.autoBitrateOpts)||void 0===t?void 0:t.isOpenAutoDefi;null!=a&&a.playAuthToken||s||i.push("definition");var l=["time","playnext","progress","progresspreview","replay","playbackRate","discontinue","PlaybackRateMobilePlugin"],c=[MoreButtonPlugin];return _createClass$6((function e(){_classCallCheck$5(this,e),this.plugins=c,this.ignores=r?[].concat(l,i):[].concat(i)}))}function getPCPreset(e){var t,r=e.isLive,n=e.playerData,i=["cssfullscreen"],o=["time","playnext","progress","progresspreview","replay","playbackRate","discontinue"],a=r?[MultilinePlugin]:[],s=n.configs,l=getPluginConfig(s,"EncryptHlsPlugin"),c=null==s||null===(t=s.autoBitrateOpts)||void 0===t?void 0:t.isOpenAutoDefi;return null!=l&&l.playAuthToken||c||(i.push("definition"),a.push(DefinitionPlugin)),_createClass$6((function e(){_classCallCheck$5(this,e),this.plugins=a,this.ignores=r?[].concat(o,i):[].concat(i)}))}function getPluginByConfig(e){return _getPluginByConfig.apply(this,arguments)}function _getPluginByConfig(){return(_getPluginByConfig=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(t){var r,n,i,o,a,s,l,c,u,h,d,p,f,g,y,v,m,_,b,T,E,S,$,C,w;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.isMobile,a=t.isLive,s=t.openSoftDecoding,l=t.type,c=t.isHlsEncrypt,u=t.playerData,h=t.plugins,d=[],p=u.configs,f=u.options,g=!(null===(r=u.playList)||void 0===r||null===(n=r[0])||void 0===n||!n.kid)||isEncryptPlay(null==p?void 0:p.getVideoByToken),"hls"!==l){e.next=28;break}if(!c){e.next=12;break}return e.next=8,sdkUmdLoader.loadPlugins("hlsEncrypt");case 8:y=e.sent,d.push(y),e.next=28;break;case 12:if(!o){e.next=24;break}if(v=getPluginConfig(f,"Subtitle"),m=a&&v,_=(isMSESupport()||window.WebAssembly)&&s,b=p.enableHlsMSE,a&&!_&&!m&&!b){e.next=22;break}return e.next=20,sdkUmdLoader.loadPlugins("hls");case 20:T=e.sent,d.push(T);case 22:e.next=28;break;case 24:return e.next=26,sdkUmdLoader.loadPlugins("hls");case 26:E=e.sent,d.push(E);case 28:if(("dash"!==l||p.url)&&!getPluginConfig(f,"DASHPlugin")){e.next=33;break}return e.next=31,sdkUmdLoader.loadPlugins("dash");case 31:null!=(C=e.sent)&&null!==(S=C.encryptUtils)&&void 0!==S&&null!==($=S.isSupported)&&void 0!==$&&$.call(S)&&h.push(C);case 33:if(getPluginConfig(f,"vodLogOpts")&&d.push(xgVodLogger),p.enableContextmenu&&d.push(MenuPlugin),!(p.enableMp4MSE||getPluginConfig(f,"Mp4EncryptPlayer")||"mp4"===l&&(g||null!=p&&null!==(i=p.autoBitrateOpts)&&void 0!==i&&i.isOpenAutoDefi||u.openSoftDecoding))){e.next=40;break}return e.next=38,sdkUmdLoader.loadPlugins("mp4Encrypt");case 38:w=e.sent,d.push(w);case 40:return e.abrupt("return",d.filter((function(e){var t,r,n,i,o;return"encrypthlsplugin"===(null==e||null===(t=e.pluginName)||void 0===t?void 0:t.toLowerCase())?!(null==e||null===(n=e.isSupported)||void 0===n||!n.call(e))||(console.warn("The current browser environment does not support encrypted playback of HLS format videos"),!1):"dashplugin"!==(null==e||null===(r=e.pluginName)||void 0===r?void 0:r.toLowerCase())||(!(null==e||null===(i=e.encryptUtils)||void 0===i||null===(o=i.isSupported)||void 0===o||!o.call(i))||(console.warn("The current browser environment does not support DASH format video playback"),!1))})));case 41:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function danmuSettingsSVG$1(){return(new DOMParser).parseFromString('<svg width="22" height="19" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd" opacity=".6"><path d="M-4-4h28v28H-4z"/><path d="M1 19a1 1 0 01-1-1V1a1 1 0 011-1h17.2a1 1 0 011 1v3.75h-.001l.001 1.475a.9.9 0 11-1.8 0V1.8H1.8v15.4h8.442l-.029.019h.296a.89.89 0 01.017 1.78h7.691L18.2 19H1z" fill="#FFF" fill-rule="nonzero"/><path d="M5.507 7.698L5.33 9.279h2.511c0 2.015-.075 3.362-.2 4.042-.151.68-.792 1.054-1.934 1.124-.327 0-.653-.023-1.005-.047l-.339-1.136c.327.035.678.059 1.03.059.628 0 .98-.188 1.067-.563.088-.374.138-1.183.138-2.424H4l.352-3.679h2.122V5.132H4.113V4.09h3.654v3.608h-2.26zm3.089-2.214h1.507A8.91 8.91 0 009.16 4.03l1.193-.375c.351.469.665.96.93 1.5l-.792.328h1.733a14.68 14.68 0 00.93-1.921l1.242.41a8.956 8.956 0 01-.854 1.51H15v4.933h-2.587v.902h2.446l-1.014 1.148h-1.432v2.097h-1.28v-2.097h-2.99v-1.148h2.99v-.902H8.595V5.484zm5.249 3.912v-.913h-1.432v.913h1.432zm-2.713 0v-.913H9.764v.913h1.368zm-1.368-1.92h1.368v-.961H9.764v.96zm2.65-.961v.96h1.43v-.96h-1.43z" fill="#FFF" fill-rule="nonzero"/><path d="M17.595 9.84l2.957 1.69a1.2 1.2 0 01.605 1.041v3.358c0 .43-.23.828-.605 1.041l-2.957 1.69a1.2 1.2 0 01-1.19 0l-2.957-1.69a1.2 1.2 0 01-.605-1.041V12.57c0-.43.23-.828.605-1.041l2.957-1.69a1.2 1.2 0 011.19 0zM17 12.47c-.994 0-1.8.797-1.8 1.781a1.79 1.79 0 001.8 1.781c.994 0 1.8-.797 1.8-1.781a1.79 1.79 0 00-1.8-1.781z" fill="#FFF"/></g></svg>',"image/svg+xml").firstChild}function fullscreenActiveSVG$1(){return(new DOMParser).parseFromString('<svg width="21" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.892 2h4.445v1.778H3.892v4.444H2.114V3.778C2.114 2.796 2.91 2 3.892 2zm4.445 16v-4.444c0-.982-.796-1.778-1.778-1.778H2.114v1.778h2.944L2.264 16.35a.9.9 0 001.272 1.273l2.988-2.987a.918.918 0 00.035-.037V18h1.778zm8-6.222v4.444h-4.445V18h4.445c.981 0 1.777-.796 1.777-1.778v-4.444h-1.777zM11.892 2v4.445c0 .981.796 1.777 1.778 1.777h4.444V6.445H15.17l2.568-2.568a.9.9 0 10-1.273-1.273L13.67 5.4V2h-1.778z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function fullscreenDefaultSVG$1(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.778 2h4.444v1.778H3.778v4.444H2V3.778C2 2.796 2.796 2 3.778 2zM2 11.778v4.444C2 17.204 2.796 18 3.778 18h4.444v-1.778H4.823l2.313-2.313a.9.9 0 00-1.272-1.273l-2.086 2.086v-2.944H2zm14.222 0v4.444h-4.444V18h4.444c.982 0 1.778-.796 1.778-1.778v-4.444h-1.778zM18 8.222V3.778C18 2.796 17.204 2 16.222 2h-4.444v1.778h2.945l-2.587 2.586a.9.9 0 101.273 1.273l2.813-2.813v3.398H18z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function pauseSVG$1(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="5.313" y="3.75" width="3.125" height="12.5" rx=".625" fill="#fff"/><rect x="11.563" y="3.75" width="3.125" height="12.5" rx=".625" fill="#fff"/></svg>',"image/svg+xml").firstChild}function playSVG$1(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.121 8.299a2 2 0 010 3.402l-7.94 4.91c-1.332.825-3.051-.133-3.051-1.7V5.09c0-1.567 1.72-2.525 3.052-1.701l7.939 4.911z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function playNextSVG$1(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.03 8.312a2 2 0 010 3.376l-7.642 4.858c-1.332.847-3.073-.11-3.073-1.687V5.14c0-1.577 1.741-2.534 3.073-1.687l7.642 4.858z" fill="#fff"/><path d="M13 3.5a.5.5 0 01.5-.5h1a.5.5 0 01.5.5v13a.5.5 0 01-.5.5h-1a.5.5 0 01-.5-.5v-13z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function replaySVG(){return(new DOMParser).parseFromString('<svg width="72" height="72" viewBox="0 0 72 72" xmlns="http://www.w3.org/2000/svg"><g fill="#FFF" fill-rule="evenodd"><circle fill-opacity=".3" cx="36" cy="36" r="36"/><path d="M40.167 32.667a.833.833 0 01-.834-.834v-1.666c0-.46.373-.834.834-.834h5.409a11.653 11.653 0 00-9.576-5c-6.443 0-11.667 5.224-11.667 11.667S29.557 47.667 36 47.667c5.285 0 9.749-3.514 11.183-8.333h3.445C49.112 46.014 43.138 51 36 51c-8.284 0-15-6.716-15-15 0-8.284 6.716-15 15-15 4.713 0 8.918 2.173 11.668 5.572l-.001-4.739c0-.46.373-.833.833-.833h1.667c.46 0 .833.373.833.833V31c0 .879-.68 1.598-1.542 1.662l-.125.005h-9.166z"/></g></svg>',"image/svg+xml").firstChild}function startPlaySVG(){return(new DOMParser).parseFromString('<svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="60" height="60" rx="30" fill="#000" fill-opacity=".4"/><path d="M40.243 28.3a2 2 0 010 3.401L24.06 41.712c-1.332.825-3.052-.134-3.052-1.7V19.988c0-1.566 1.72-2.525 3.052-1.7l16.184 10.01z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function volumeLargeSVG(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M9.867 2.5h.55c.44 0 .799.34.83.771l.003.062v13.334c0 .44-.34.799-.771.83l-.062.003h-.55a.833.833 0 01-.444-.128l-.064-.045-4.867-3.744a.831.831 0 01-.322-.59l-.003-.07V7.077c0-.235.099-.458.271-.615l.054-.045L9.36 2.673a.832.832 0 01.43-.17l.078-.003h.55-.55zm6.767 2.278A7.474 7.474 0 0118.75 10a7.477 7.477 0 01-2.128 5.234.4.4 0 01-.57-.004l-.587-.586a.442.442 0 01.005-.617A5.812 5.812 0 0017.083 10c0-1.557-.61-2.97-1.603-4.017a.442.442 0 01-.003-.615l.586-.586a.4.4 0 01.57-.004zM2.5 6.667c.23 0 .417.186.417.416v5.834c0 .23-.187.416-.417.416h-.833a.417.417 0 01-.417-.416V7.083c0-.23.187-.416.417-.416H2.5zm11.768.46A4.153 4.153 0 0115.417 10c0 1.12-.442 2.137-1.162 2.886a.388.388 0 01-.555-.007l-.577-.578c-.176-.176-.156-.467.009-.655A2.49 2.49 0 0013.75 10a2.49 2.49 0 00-.61-1.636c-.163-.188-.182-.477-.006-.653l.578-.578a.388.388 0 01.556-.006z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function volumeMutedSVG(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.045 2.5h.55c.44 0 .8.34.831.771l.003.062v13.334c0 .44-.34.799-.771.83l-.063.003h-.55a.833.833 0 01-.443-.128l-.065-.045-4.866-3.744a.831.831 0 01-.323-.59l-.003-.07V7.077c0-.235.1-.458.272-.615l.054-.045 4.866-3.744a.832.832 0 01.43-.17l.078-.003h.55-.55zM2.68 6.667c.23 0 .416.186.416.416v5.834c0 .23-.186.416-.416.416h-.834a.417.417 0 01-.416-.416V7.083c0-.23.186-.416.416-.416h.834zm10.467.294a.417.417 0 01.59 0l1.767 1.768L17.27 6.96a.417.417 0 01.589 0l.59.59a.417.417 0 010 .589L16.68 9.908l1.768 1.767c.15.15.162.387.035.55l-.035.04-.589.589a.417.417 0 01-.59 0l-1.767-1.768-1.768 1.768a.417.417 0 01-.59 0l-.588-.59a.417.417 0 010-.589l1.767-1.768-1.767-1.767a.417.417 0 01-.035-.55l.035-.04.589-.589z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function volumeSmallSVG(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M9.867 2.5h.55c.44 0 .799.34.83.771l.003.062v13.334c0 .44-.34.799-.771.83l-.062.003h-.55a.833.833 0 01-.444-.128l-.064-.045-4.867-3.744a.831.831 0 01-.322-.59l-.003-.07V7.077c0-.235.099-.458.271-.615l.054-.045L9.36 2.673a.832.832 0 01.43-.17l.078-.003h.55-.55zM2.5 6.667c.23 0 .417.186.417.416v5.834c0 .23-.187.416-.417.416h-.833a.417.417 0 01-.417-.416V7.083c0-.23.187-.416.417-.416H2.5zm11.768.46A4.153 4.153 0 0115.417 10c0 1.12-.442 2.137-1.162 2.886a.388.388 0 01-.555-.007l-.577-.578c-.176-.176-.156-.467.009-.655A2.49 2.49 0 0013.75 10a2.49 2.49 0 00-.61-1.636c-.163-.188-.182-.477-.006-.653l.578-.578a.388.388 0 01.556-.006z" fill="#fff"/></svg>',"image/svg+xml").firstChild}var iconsOption$1={startPlay:startPlaySVG,play:playSVG$1,pause:pauseSVG$1,fullscreen:fullscreenDefaultSVG$1,exitFullscreen:fullscreenActiveSVG$1,playNext:playNextSVG$1,replay:replaySVG,refresh:refreshSVG$1,danmuSetting:danmuSettingsSVG$1,openDanmu:Default,closeDanmu:danmuActiveSVG$1,volumeLarge:volumeLargeSVG,volumeMuted:volumeMutedSVG,volumeSmall:volumeSmallSVG},initOption$1={whitelist:[""],widescreen:!0,width:"100%",height:"100%",lang:getLang(),fitVideoSize:!1,inactive:2e3,playsinline:!0,keyShortcut:"off",closeVideoClick:!0,closeVideoDblclick:!0,closePlayerBlur:!1,closeControlsBlur:!1,closePlayVideoFocus:!0,leavePlayerTime:0,mini:!1,pip:{position:"controlsRight",index:2.5,showIcon:!0},volume:{index:2.6},miniscreen:{left:window.innerWidth-360,top:window.innerHeight-450},time:{index:3},icons:_objectSpread2$5({},iconsOption$1),flv:{retryCount:0},hls:{retryCount:0}},liveOption$1={isLive:!0,closeVideoClick:!0,autoplay:!0,autoplayMuted:!0,preloadTime:8,start:{isShowPause:!1,isShowEnd:!1,mode:"hide",disableAnimate:!0},retry:{count:0}},vodOption$1={isLive:!1,closeVideoClick:!1,defaultPlaybackRate:1,closeVideoStopPropagation:!0,autoplay:!1,autoplayMuted:!1,playbackRate:[2,1.5,1.25,{rate:1,iconText:{zh:"倍速",en:"Speed",jp:"Speed"}},.75,.5],start:{isShowPause:!0,isShowEnd:!1,mode:"hide",disableAnimate:!0},progresspreview:{isShowCoverPreview:!0},progress:{isPauseMoving:!0}};function createPlayerOption$1(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=_objectSpread2$5({},initOption$1),r=_objectSpread2$5({},e?liveOption$1:vodOption$1);return _objectSpread2$5(_objectSpread2$5({},t),r)}function danmuSVG(){return(new DOMParser).parseFromString('<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.746 12.444a1 1 0 00-.62.216L1.75 13.75V2.166c0-.23.187-.417.417-.417h11.666c.23 0 .417.187.417.417v6.687c.44.044.86.156 1.25.326V2.167c0-.92-.746-1.667-1.667-1.667H2.167C1.247.5.5 1.246.5 2.167V14.61a.833.833 0 001.35.653l1.71-1.354a1 1 0 01.621-.216h5.543a4.195 4.195 0 01-.02-1.25H3.745z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M4.5 4a.5.5 0 00-.5.5V5a.5.5 0 00.5.5h5A.5.5 0 0010 5v-.5a.5.5 0 00-.5-.5h-5zm2.333 4.167a.5.5 0 00-.5.5v.666a.5.5 0 00.5.5h4.292c.311-.266.662-.487 1.042-.653v-.513a.5.5 0 00-.5-.5H6.834zm-3 .5a.5.5 0 01.5-.5H5a.5.5 0 01.5.5v.666a.5.5 0 01-.5.5h-.667a.5.5 0 01-.5-.5v-.666z" fill="#fff"/><path d="M11 4.5a.5.5 0 01.5-.5h.5a.5.5 0 01.5.5V5a.5.5 0 01-.5.5h-.5A.5.5 0 0111 5v-.5z" fill="#fff"/><circle cx="13.833" cy="13" r="3.333" fill="#3370FF"/><path d="M15.591 12.011l-2.133 2.134-1.22-1.22" stroke="#fff" stroke-linecap="round" stroke-linejoin="round"/></svg>',"image/svg+xml").firstChild}function danmuActiveSVG(){return(new DOMParser).parseFromString('<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.746 12.444a1 1 0 00-.62.216L1.75 13.75V2.166c0-.23.187-.417.417-.417h11.666c.23 0 .417.187.417.417v6.687c.44.044.86.156 1.25.326V2.167c0-.92-.746-1.667-1.667-1.667H2.167C1.247.5.5 1.246.5 2.167V14.61a.833.833 0 001.35.653l1.71-1.354a1 1 0 01.621-.216h5.543a4.195 4.195 0 01-.02-1.25H3.745z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M4.5 4a.5.5 0 00-.5.5V5a.5.5 0 00.5.5h5A.5.5 0 0010 5v-.5a.5.5 0 00-.5-.5h-5zm2.333 4.167a.5.5 0 00-.5.5v.666a.5.5 0 00.5.5h4.292c.311-.266.662-.487 1.042-.653v-.513a.5.5 0 00-.5-.5H6.834zm-3 .5a.5.5 0 01.5-.5H5a.5.5 0 01.5.5v.666a.5.5 0 01-.5.5h-.667a.5.5 0 01-.5-.5v-.666z" fill="#fff"/><path d="M11 4.5a.5.5 0 01.5-.5h.5a.5.5 0 01.5.5V5a.5.5 0 01-.5.5h-.5A.5.5 0 0111 5v-.5z" fill="#fff"/><circle cx="13.833" cy="13" r="2.733" stroke="#fff" stroke-width="1.2"/><path fill="#fff" d="M12.833 10.77l3.473 3.472-1.063 1.064-3.474-3.473z"/></svg>',"image/svg+xml").firstChild}function danmuSettingsSVG(){return(new DOMParser).parseFromString('<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.746 12.444a1 1 0 00-.62.216L1.75 13.75V2.166c0-.23.187-.417.417-.417h11.666c.23 0 .417.187.417.417v6.687c.44.044.86.156 1.25.326V2.167c0-.92-.746-1.667-1.667-1.667H2.167C1.247.5.5 1.246.5 2.167V14.61a.833.833 0 001.35.653l1.71-1.354a1 1 0 01.621-.216h5.543a4.195 4.195 0 01-.02-1.25H3.745z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M4.5 4a.5.5 0 00-.5.5V5a.5.5 0 00.5.5h5A.5.5 0 0010 5v-.5a.5.5 0 00-.5-.5h-5zm2.333 4.167a.5.5 0 00-.5.5v.666a.5.5 0 00.5.5h4.292c.311-.266.662-.487 1.042-.653v-.513a.5.5 0 00-.5-.5H6.834zm-3 .5a.5.5 0 01.5-.5H5a.5.5 0 01.5.5v.666a.5.5 0 01-.5.5h-.667a.5.5 0 01-.5-.5v-.666z" fill="#fff"/><path d="M11 4.5a.5.5 0 01.5-.5h.5a.5.5 0 01.5.5V5a.5.5 0 01-.5.5h-.5A.5.5 0 0111 5v-.5z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M14.387 10.134a1 1 0 00-1 0l-1.887 1.09a1 1 0 00-.5.865v2.179a1 1 0 00.5.866l1.887 1.09a1 1 0 001 0l1.886-1.09a1 1 0 00.5-.866v-2.179a1 1 0 00-.5-.866l-1.886-1.089zm-.5 4.711a1.667 1.667 0 100-3.333 1.667 1.667 0 000 3.333z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function fullscreenActiveSVG(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M17.5 8.333h-4.167c-.92 0-1.666-.746-1.666-1.666V2.5h1.666v4.167H17.5v1.666zM2.5 6.667v1.666h4.167c.92 0 1.666-.746 1.666-1.666V2.5H6.667v4.167H2.5zM2.5 13.333h4.167V17.5h1.666v-4.167c0-.92-.746-1.666-1.666-1.666H2.5v1.666zM13.333 17.5v-4.167H17.5v-1.666h-4.167c-.92 0-1.666.746-1.666 1.666V17.5h1.666z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function fullscreenDefaultSVG(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.125 3a.375.375 0 00-.375.375v.75c0 .207.168.375.375.375H15.5v3.375c0 .207.168.375.375.375h.75A.375.375 0 0017 7.875v-4.5A.375.375 0 0016.625 3h-4.5zm0 12.5a.375.375 0 00-.375.375v.75c0 .207.168.375.375.375h4.5a.375.375 0 00.375-.375v-4.5a.375.375 0 00-.375-.375h-.75a.375.375 0 00-.375.375V15.5h-3.375zM3 3.375C3 3.168 3.168 3 3.375 3h4.5c.207 0 .375.168.375.375v.75a.375.375 0 01-.375.375H4.5v3.375a.375.375 0 01-.375.375h-.75A.375.375 0 013 7.875v-4.5zM7.875 15.5H4.5v-3.375a.375.375 0 00-.375-.375h-.75a.375.375 0 00-.375.375v4.5c0 .207.168.375.375.375h4.5a.375.375 0 00.375-.375v-.75a.375.375 0 00-.375-.375z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function pauseSVG(){return(new DOMParser).parseFromString('<svg style="\n height: 18px;\n width: 18px;\n" width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="7.438" y="5.25" width="4.375" height="17.5" rx=".875" fill="#fff"/><rect x="16.188" y="5.25" width="4.375" height="17.5" rx=".875" fill="#fff"/></svg>',"image/svg+xml").firstChild}function playSVG(){return(new DOMParser).parseFromString('<svg style="\n height: 18px;\n width: 18px;\n" width="28" height="28" fill="none" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg"><path d="M19.77 11.619c1.768 1.094 1.768 3.668 0 4.762L8.653 23.257c-1.865 1.154-4.273-.188-4.273-2.381V7.125c0-2.194 2.408-3.536 4.273-2.382L19.77 11.62z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function playNextSVG(){return(new DOMParser).parseFromString('<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M4.77 4.124l8.358 5.07c.38.23.486.704.238 1.056a.807.807 0 01-.238.22L4.77 15.543c-.38.231-.889.132-1.137-.221a.723.723 0 01-.134-.417V4.762c0-.421.368-.762.822-.762.159 0 .316.042.449.124z" stroke="#fff" stroke-width="1.5"/><path d="M15.5 4.5A.5.5 0 0116 4h.5a.5.5 0 01.5.5v11a.5.5 0 01-.5.5H16a.5.5 0 01-.5-.5v-11z" fill="#fff"/></svg>',"image/svg+xml").firstChild}function refreshSVG(){return(new DOMParser).parseFromString('<svg width="18" height="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="M0 0h18v18H0z"/><path d="M10.875 7.5a.375.375 0 01-.375-.375v-.75c0-.207.168-.375.375-.375h2.434a5.25 5.25 0 10.723 4.5h1.55a6.75 6.75 0 11-1.332-5.743V2.626c0-.207.168-.375.375-.375h.75c.207 0 .375.168.375.375V6.75a.75.75 0 01-.694.748L15 7.5h-4.125z" fill="#FFF"/></g></svg>',"image/svg+xml").firstChild}var iconsOption={startPlay:startPlaySVG,play:playSVG,pause:pauseSVG,fullscreen:fullscreenDefaultSVG,exitFullscreen:fullscreenActiveSVG,playNext:playNextSVG,replay:replaySVG,refresh:refreshSVG,danmuSetting:danmuSettingsSVG,openDanmu:danmuSVG,closeDanmu:danmuActiveSVG,volumeLarge:volumeLargeSVG,volumeMuted:volumeMutedSVG,volumeSmall:volumeSmallSVG};sniffer$1.os.isAndroid;var initOption={width:"100%",height:"100%",lang:getLang(),playsinline:!0,closeVideoClick:!0,closeVideoTouch:!0,whitelist:[""],"x5-video-player-type":"h5-page","x5-video-player-fullscreen":!1,"x5-video-orientation":"landscape|portrait",enterTips:{background:"linear-gradient(90deg,#000,#49e6d3,#49e6d3,#138afc,#000)"},retainPlay:!0,start:{isShowPause:!0,isShowEnd:!0,disableAnimate:!1},fullscreen:{useCssFullscreen:!1},plugins:[],time:{mode:"pc",index:2.5},controls:{mode:"flex"},danmusettings:{index:"2"},danmuicon:{index:"3"},cusPlaybackRatePlugin:{needCheck:!0,needPanel:!1},icons:_objectSpread2$5({},iconsOption),flv:{innerDegrade:1,retryCount:0},hls:{innerDegrade:1,retryCount:0}},liveOption={isLive:!0,closeVideoClick:!0,autoplay:!0,autoplayMuted:!0,start:{isShowPause:!1,isShowEnd:!1,disableAnimate:!1,mode:"hide"},retry:{count:0},longwaiting:{duration:3e4},mobile:{gestureY:!1,gestureX:!1,disableActive:!0}},vodOption={isLive:!1,closeVideoClick:!1,autoplay:!1,autoplayMuted:!1,playbackRate:[2,1.5,1.25,{rate:1,iconText:"倍速",en:"speed",jp:"speed"},.75,.5],defaultPlaybackRate:1,closeVideoStopPropagation:!0,mobile:{gestureY:!1},start:{isShowPause:!0,isShowEnd:!1,disableAnimate:!1,mode:"hide"}};function createPlayerOption(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=_objectSpread2$5({},initOption),r=_objectSpread2$5({},e?liveOption:vodOption);return _objectSpread2$5(_objectSpread2$5({},t),r)}var POSITIONS$6=Plugin.POSITIONS,extendPlugin=function(e){var t="mobile"===sniffer$1.device,r=e.pluginName,n=void 0===r?"ExtendPlugin".concat(Math.random().toString().slice(-5)):r,i=e.type,o=void 0===i?t?"inner":"normal":i,a=e.position,s=void 0===a?POSITIONS$6.CONTROLS_LEFT:a,l=e.icon,c=void 0===l?Default:l,u=e.index,h=void 0===u?1:u,d=e.hideAtFullScreen,p=void 0===d||d,f=e.tips,g=void 0===f?{jp:"custom",en:"custom",zh:"自定义","zh-hk":"自定义"}:f;return function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(){return _classCallCheck$5(this,r),t.apply(this,arguments)}return _createClass$6(r,[{key:"afterCreate",value:function(){var e;this.appendChild(".xgplayer-icon",this.icons[n]),this.initEvents(),p&&null!==(e=this.player)&&void 0!==e&&e.fullscreen&&this.handleFullScreenChange()}},{key:"registerIcons",value:function(){return _defineProperty$6({},n,{icon:c,class:"xgplayer-extendicon-svg"})}},{key:"updateIcons",value:function(e){var t=this.find(".xgplayer-icon");t&&(t.innerHTML=e)}},{key:"registerLanguageTexts",value:function(){return _defineProperty$6({},n,g)}},{key:"initEvents",value:function(){this.handleCallback=debounce$1(this.handleCallback.bind(this),200);var e,t="mobile"===sniffer$1.device?"touchend":"click";(this.bind(t,this.handleCallback),this.show(),p)&&(null===(e=this.player)||void 0===e||e.on(FULLSCREEN_CHANGE,this.handleFullScreenChange.bind(this)))}},{key:"handleFullScreenChange",value:function(){var e,t=this.player;null===(e=this.player)||void 0===e||e.changePluginsIcon(n,!(null!=t&&t.fullscreen))}},{key:"handleCallback",value:function(e){var t=this.player;t&&(e.preventDefault(),e.stopPropagation(),t.emit(PluginEvents.PLAYER_EXTEND_BUTTON,n))}},{key:"destroy",value:function(){var e;(this.unbind(["touchend","click"],this.handleCallback),p)&&(null===(e=this.player)||void 0===e||e.off(FULLSCREEN_CHANGE,this.handleFullScreenChange.bind(this)))}},{key:"render",value:function(){return'\n <xg-icon class="xgplayer-extend-icon">\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="'.concat(n,'">').concat(this.langText[n],"</div>\n </xg-icon>\n ")}}],[{key:"isExtendPlugin",get:function(){return!0}},{key:"type",get:function(){return o}},{key:"textTips",get:function(){return g}},{key:"pluginName",get:function(){return n}},{key:"defaultConfig",get:function(){return{position:s,index:h}}}]),r}(Plugin)},MobilePlayerPanel=function(){function e(t){var r,n;_classCallCheck$5(this,e);var i=t.config,o=t.root,a=t.player;this.config=i,this.parent=o,this.player=a,this.mode=null!==(r=null==i?void 0:i.mode)&&void 0!==r?r:PLAYER_MODE.INNER,this.isAutoChange=null!==(n=null==i?void 0:i.isAutoChange)&&void 0!==n&&n,this.isShow=!1,this.initEvents(),this.renderPanel()}var t;return _createClass$6(e,[{key:"initEvents",value:function(){var e;this.isAutoChange&&(window.addEventListener("orientationchange",this.handleOrientationChange.bind(this)),null===(e=this.player)||void 0===e||e.on(FULLSCREEN_CHANGE,this.handleOrientationChange.bind(this)))}},{key:"handleOrientationChange",value:function(){var e,t,r,n=[90,-90,"90","-90"].includes(window.orientation);null!==(e=this.player)&&void 0!==e&&e.fullscreen&&n?this.changeMode(PLAYER_MODE.FULLSCREEN):this.changeMode(null!==(t=null===(r=this.config)||void 0===r?void 0:r.mode)&&void 0!==t?t:PLAYER_MODE.INNER)}},{key:"changeConfig",value:function(e){this.config=e}},{key:"changeMode",value:function(e){this.mode=e,this.player.emit(PluginEvents.PANEL_MODE_CHANGE,{mode:e}),this.destroy(),this.renderPanel()}},{key:"renderPanel",value:function(){var e="xg-mobile-panel panel-".concat(["normal","inner","fullscreen"][this.mode]);switch(this.root=util.createDom("div","",{},e),this.parent&&(this.parent.appendChild(this.root),this.hide()),this.bind("click",this.handleHide.bind(this)),this.mode){case PLAYER_MODE.NORMAL:var t=util.createDom("div","",{},"xg-mobile-panel-content");this.root.appendChild(t),this.container=t,t.addEventListener("click",(function(e){e.stopPropagation(),e.preventDefault()}));break;case PLAYER_MODE.INNER:this.container=this.root;break;case PLAYER_MODE.FULLSCREEN:var r=util.createDom("div","",{},"xg-mobile-panel-content");this.root.appendChild(r),this.container=r,r.addEventListener("click",(function(e){e.stopPropagation(),e.preventDefault()}))}}},{key:"showPanel",value:(t=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(t){var r,n=this,i=arguments;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i.length>1&&void 0!==i[1]?i[1]:"",i.length>2&&void 0!==i[2]&&i[2]&&util.addClass(t,"item-list-panel-content"),this.setTitle(r),!this.children){e.next=9;break}return e.next=7,this.hide();case 7:return setTimeout((function(){n.children=t,n.container&&(n.title&&n.container.appendChild(n.title),n.container.appendChild(t)),n.show()})),e.abrupt("return");case 9:this.children=t,this.container&&(this.title&&this.container.appendChild(this.title),this.container.appendChild(t)),this.show();case 12:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"updatePanel",value:function(e){this.children&&util.hasClass(this.children,"item-list-panel-content")&&util.addClass(e,"item-list-panel-content"),this.children=e,this.container&&(this.container.innerHTML="",this.title&&this.container.appendChild(this.title),this.container.appendChild(e)),this.show()}},{key:"setTitle",value:function(e){e&&this.mode!==PLAYER_MODE.INNER?this.title?this.title.innerHTML=e:this.title=this.renderTitle(e):this.title=void 0}},{key:"renderTitle",value:function(e){return util.createDom("div",e,{},"xg-mobile-panel-title")}},{key:"show",value:function(){this.isShow=!0,util.removeClass(this.root,"hide"),util.addClass(this.root,"active")}},{key:"hide",value:function(){this.isShow=!1,util.removeClass(this.root,"active"),util.addClass(this.root,"hide"),this.container&&(this.container.innerHTML="")}},{key:"handleHide",value:function(e){e.stopPropagation(),e.preventDefault(),this.hide()}},{key:"bind",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.root&&"on".concat(e)in this.root&&"function"==typeof t&&this.root.addEventListener(e,t,r)}},{key:"destroy",value:function(){var e;this.parent&&this.root&&this.parent.removeChild(this.root),window.removeEventListener("orientationchange",this.handleOrientationChange.bind(this)),null===(e=this.player)||void 0===e||e.off(FULLSCREEN_CHANGE,this.handleOrientationChange.bind(this))}}]),e}();function DefinitionIconSVG(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M16 3.8001H4C3.55817 3.8001 3.2 4.15827 3.2 4.6001V12.6001C3.2 13.0419 3.55817 13.4001 4 13.4001H16C16.4418 13.4001 16.8 13.0419 16.8 12.6001V4.6001C16.8 4.15827 16.4418 3.8001 16 3.8001ZM4 2.6001C2.89543 2.6001 2 3.49553 2 4.6001V12.6001C2 13.7047 2.89543 14.6001 4 14.6001H16C17.1046 14.6001 18 13.7047 18 12.6001V4.6001C18 3.49553 17.1046 2.6001 16 2.6001H4ZM5.0249 6.24509V11.6001H5.9024V9.23009H8.6174V11.6001H9.4949V6.24509H8.6174V8.48009H5.9024V6.24509H5.0249ZM10.5474 6.24509V11.6001H12.5049C13.3749 11.6001 14.0274 11.3601 14.4774 10.8801C14.9049 10.4226 15.1224 9.77009 15.1224 8.92259C15.1224 8.06759 14.9049 7.41509 14.4774 6.96509C14.0274 6.48509 13.3749 6.24509 12.5049 6.24509H10.5474ZM11.4249 6.99509H12.3399C13.0074 6.99509 13.4949 7.14509 13.8024 7.45259C14.1024 7.75259 14.2524 8.24759 14.2524 8.92259C14.2524 9.58259 14.1024 10.0701 13.8024 10.3851C13.4949 10.6926 13.0074 10.8501 12.3399 10.8501H11.4249V6.99509ZM4.15 16.1001C3.79101 16.1001 3.5 16.3911 3.5 16.7501C3.5 17.1091 3.79101 17.4001 4.15 17.4001H15.85C16.209 17.4001 16.5 17.1091 16.5 16.7501C16.5 16.3911 16.209 16.1001 15.85 16.1001H4.15Z" fill="#ffffff"/>\n</svg>',"image/svg+xml").firstChild}var POSITIONS$5=Plugin.POSITIONS,DefinitionMobilePlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),(n=t.call(this,e)).toastInfo={},n.playerData=null,n.playerData=e.player.config.playerData,n.dataMonitoring(),n}return _createClass$6(r,[{key:"dataMonitoring",value:function(){var e=this;this.playerData&&MyProxy$1.subscribeProperty(this.playerData.current,"definition",(function(t,r){if(t!==r&&e.player){var n=e.playerData.current.lineId,i=e.playerData.getDefinitionListByLineId(n).find((function(e){return e.definition===r}));i&&i.url&&(e.player.changeDefinition(_objectSpread2$5(_objectSpread2$5({},i),{},{definition:r,url:i.url})),e.updatePanel(),e.player.emit(PluginEvents.INNER_DEFINITION_CHANGE,{from:t,to:r,url:i.url}),e.player.emit(PluginEvents.PlAY_URL_CHANGE,{url:i.url,from:PluginEvents.INNER_DEFINITION_CHANGE}),setTimeout((function(){e.player.ended?e.player.replay():e.player.paused&&e.player.play()}),1e3))}}))}},{key:"registerIcons",value:function(){return{definition:{icon:DefinitionIconSVG,class:"xgplayer-definition-svg"}}}},{key:"registerLanguageTexts",value:function(){return{definition:{jp:"明快さ",en:"Definition",zh:"清晰度","zh-hk":"清晰度"},definitionSelect:{jp:"クラリティセレクション",en:"Definition Choose",zh:"清晰度选择","zh-hk":"清晰度選擇"},switching:{jp:"に切り替える",en:"Switching to",zh:"正在切换至","zh-hk":"正在切換至"}}}},{key:"afterCreate",value:function(){this.toastInfo={},this.appendChild(".xgplayer-icon",this.icons.definition),this.initEvents()}},{key:"afterPlayerInit",value:function(){}},{key:"initEvents",value:function(){this.bind(["click"],this.handleButtonChange.bind(this))}},{key:"handleButtonChange",value:function(){var e=this.renderItemList();this.renderPanel(e)}},{key:"renderItemList",value:function(){var e=this,t=this.playerData.current.lineId,r=this.playerData.getDefinitionListByLineId(t),n=util.createDom("div","",{},"definition-panel-content");return r.forEach((function(t){var r=e.renderItem(t);n.appendChild(r)})),n}},{key:"renderItem",value:function(e){var t=this,r=this.playerData.current.definition,n=util.createDom("div","",{},"panel-Item ".concat(r===e.definition?"select-in":""));return n.innerHTML=this.getShowText(this.i18n,e),n.addEventListener("click",(function(r){r.stopPropagation(),r.preventDefault(),t.showToast(e),t.playerData.current.definition=e.definition})),n}},{key:"getShowText",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return e[t.definitionTextKey]||t.definitionTextKey||t.definition}},{key:"showToast",value:function(e){var t,r=this,n=null===(t=this.player)||void 0===t?void 0:t.getPlugin("sdkToastPlugin");if(n){var i=this.getShowText(this.i18n,e),o=n.add("".concat(this.langText.switching).concat(i,"..."),0,!0),a=Date.now();this.toastInfo[o]={showTime:a,delayClose:!1},setTimeout((function(){var e;null!==(e=r.toastInfo[o])&&void 0!==e&&e.delayClose&&(n.remove(o),r.toastInfo[o].delayClose=!1)}),2e3),this.player.once(AFTER_DEFINITION_CHANGE,(function(){var e;Date.now()-(null===(e=r.toastInfo[o])||void 0===e?void 0:e.showTime)>2e3?n.remove(o):r.toastInfo[o].delayClose=!0}))}}},{key:"renderPanel",value:function(e){var t,r;null===(t=this.player)||void 0===t||null===(r=t.panel)||void 0===r||r.showPanel(e,this.langText.definitionSelect,!0)}},{key:"updatePanel",value:function(){var e,t,r=this.renderItemList();null===(e=this.player)||void 0===e||null===(t=e.panel)||void 0===t||t.updatePanel(r)}},{key:"destroy",value:function(){this.unbind(["click"],this.handleButtonChange.bind(this))}},{key:"render",value:function(){return'\n <xg-icon class="xgplayer-mobile-definition">\n <div class="xgplayer-icon">\n </div>\n </xg-icon>\n '}}],[{key:"pluginName",get:function(){return"DefinitionMobilePlugin"}},{key:"textTips",get:function(){return{jp:"明快さ",en:"Definition",zh:"清晰度","zh-hk":"清晰度"}}},{key:"defaultConfig",get:function(){return{position:POSITIONS$5.CONTROLS_RIGHT,index:2.7}}}]),r}(Plugin);function LineIconSVG(){return(new DOMParser).parseFromString('<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M12.7123 1C11.85 1 11.1173 1.55472 10.8516 2.32675L4.94973 2.32675C3.16413 2.32675 1.71662 3.77427 1.71662 5.55987C1.71662 7.34547 3.16413 8.79298 4.94973 8.79298L11.0483 8.79298L11.1134 8.79418C11.9936 8.82748 12.697 9.55166 12.697 10.44C12.697 11.3497 11.9596 12.0871 11.05 12.0871H5.01323C4.67882 11.4781 4.03143 11.0654 3.28763 11.0654C2.20111 11.0654 1.32031 11.9462 1.32031 13.0327C1.32031 14.1192 2.20111 15 3.28763 15C4.14992 15 4.88264 14.4452 5.14834 13.6732H11.05C12.8356 13.6732 14.2831 12.2256 14.2831 10.44C14.2831 8.65444 12.8356 7.20693 11.05 7.20693L4.94973 7.20693C4.04009 7.20693 3.30267 6.46951 3.30267 5.55987C3.30267 4.65022 4.04009 3.91281 4.94973 3.91281L10.9866 3.91281C11.321 4.52183 11.9685 4.93464 12.7123 4.93464C13.7988 4.93464 14.6796 4.05384 14.6796 2.96732C14.6796 1.8808 13.7988 1 12.7123 1ZM12.7123 2.18954C12.2827 2.18954 11.9345 2.53777 11.9345 2.96732C11.9345 3.39688 12.2827 3.7451 12.7123 3.7451C13.1418 3.7451 13.4901 3.39688 13.4901 2.96732C13.4901 2.53777 13.1418 2.18954 12.7123 2.18954ZM2.50986 13.0327C2.50986 12.6031 2.85808 12.2549 3.28763 12.2549C3.71719 12.2549 4.06541 12.6031 4.06541 13.0327C4.06541 13.4622 3.71719 13.8105 3.28763 13.8105C2.85808 13.8105 2.50986 13.4622 2.50986 13.0327Z" fill="#FFFFFF"/>\n</svg>',"image/svg+xml").firstChild}var POSITIONS$4=Plugin.POSITIONS,LineMobilePlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),(n=t.call(this,e)).playerData=null,n.playerData=e.player.config.playerData,n.dataMonitoring(),n}return _createClass$6(r,[{key:"dataMonitoring",value:function(){var e=this;this.playerData&&MyProxy$1.subscribeProperty(this.playerData.current,"definition",(function(t,r){if(t!==r&&e.player){var n=e.playerData.getCurrentUrl();e.player.changeDefinition({definition:r,url:n}),e.updatePanel(),setTimeout((function(){e.player.paused&&e.player.play()}),1e3)}}))}},{key:"registerIcons",value:function(){return{line:{icon:LineIconSVG,class:"xgplayer-line-svg"}}}},{key:"registerLanguageTexts",value:function(){return{line:{jp:"ライン",en:"Line",zh:"线路","zh-hk":"線路"},lineSelect:{jp:"ライン選ぶ",en:"Line Choose",zh:"线路选择","zh-hk":"線路選擇"}}}},{key:"afterCreate",value:function(){this.appendChild(".xgplayer-icon",this.icons.line),this.initEvents()}},{key:"afterPlayerInit",value:function(){}},{key:"initEvents",value:function(){this.bind(["click"],this.handleButtonChange.bind(this))}},{key:"handleButtonChange",value:function(){var e=this.renderItemList();this.renderPanel(e)}},{key:"renderItemList",value:function(){var e=this,t=this.playerData.getLineList(),r=util.createDom("div","",{},"line-panel-content");return t.forEach((function(t){var n=e.renderItem(t);r.appendChild(n)})),r}},{key:"renderItem",value:function(e){var t=this,r=this.playerData.current.lineId,n=util.createDom("div","",{},"panel-Item ".concat(r===e.lineId?"select-in":""));return n.innerHTML=this.i18n[e.lineTextKey]||e.lineTextKey,n.addEventListener("click",(function(r){r.stopPropagation(),r.preventDefault(),t.player.emit(PluginEvents.LINE_CHANGE,{from:t.playerData.current.lineId,to:e.lineId}),t.playerData.current.lineId=e.lineId,t.player.emit(SDKEvents.PLAYER_REBUILD)})),n}},{key:"renderPanel",value:function(e){var t,r;null===(t=this.player)||void 0===t||null===(r=t.panel)||void 0===r||r.showPanel(e,this.langText.lineSelect,!0)}},{key:"updatePanel",value:function(){var e,t=this.renderItemList();null===(e=this.player)||void 0===e||e.panel.updatePanel(t)}},{key:"destroy",value:function(){this.unbind(["click"],this.handleButtonChange.bind(this))}},{key:"render",value:function(){return'\n <xg-icon class="xgplayer-mobile-line">\n <div class="xgplayer-icon">\n </div>\n </xg-icon>\n '}}],[{key:"pluginName",get:function(){return"LineMobilePlugin"}},{key:"textTips",get:function(){return{jp:"ライン",en:"Line",zh:"线路","zh-hk":"線路"}}},{key:"defaultConfig",get:function(){return{position:POSITIONS$4.CONTROLS_RIGHT,index:2.8}}}]),r}(Plugin);function RateIconSVG(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M14.6879 3.64579C14.7387 3.60575 14.7387 3.52868 14.6879 3.48864L13.3089 2.40296C13.2433 2.35132 13.147 2.39805 13.147 2.48153V4.6529C13.147 4.73639 13.2433 4.78312 13.3089 4.73147L14.6879 3.64579ZM4 2.61914H11.3001V3.91914H4C3.6134 3.91914 3.3 4.23254 3.3 4.61914V15.6191C3.3 16.0057 3.6134 16.3191 4 16.3191H16C16.3866 16.3191 16.7 16.0057 16.7 15.6191V6.75253H18V15.6191C18 16.7237 17.1046 17.6191 16 17.6191H4C2.89543 17.6191 2 16.7237 2 15.6191V4.61914C2 3.51457 2.89543 2.61914 4 2.61914ZM17.7879 3.48864C17.8388 3.52868 17.8388 3.60575 17.7879 3.64579L16.4089 4.73147C16.3433 4.78312 16.2471 4.73639 16.2471 4.6529V2.48153C16.2471 2.39805 16.3433 2.35132 16.4089 2.40296L17.7879 3.48864ZM6.82584 7.37256C6.26886 7.37256 5.82039 7.56063 5.48042 7.93677C5.14768 8.29121 4.98131 8.75415 4.97408 9.33282H5.82039C5.83485 8.92775 5.92166 8.61671 6.08079 8.41418C6.23993 8.19717 6.47863 8.08867 6.7969 8.08867C7.09347 8.08867 7.31771 8.15377 7.46961 8.29121C7.61428 8.42864 7.69385 8.63841 7.69385 8.92052C7.69385 9.20986 7.57811 9.48473 7.35388 9.7379C7.20921 9.8898 6.97774 10.0851 6.645 10.3166C6.04462 10.7289 5.64679 11.0471 5.45872 11.2642C5.11151 11.6548 4.94514 12.1105 4.94514 12.6385H8.54739V11.8935H6.00122C6.11696 11.6331 6.43523 11.3293 6.96327 10.982C7.46961 10.6421 7.83128 10.3672 8.03382 10.1502C8.36656 9.7813 8.54016 9.37622 8.54016 8.92775C8.54016 8.46481 8.38102 8.09591 8.06275 7.80657C7.73725 7.51723 7.32494 7.37256 6.82584 7.37256ZM9.90445 11.5463C9.74532 11.5463 9.60788 11.5969 9.50661 11.7126C9.39088 11.8211 9.34025 11.9586 9.34025 12.1177C9.34025 12.2768 9.39088 12.407 9.50661 12.5228C9.60788 12.624 9.74532 12.6819 9.90445 12.6819C10.0636 12.6819 10.1938 12.624 10.3095 12.5228C10.418 12.407 10.4759 12.2768 10.4759 12.1177C10.4759 11.9586 10.418 11.8211 10.3095 11.7126C10.1938 11.5969 10.0636 11.5463 9.90445 11.5463ZM11.665 8.12484C11.9977 7.6185 12.4679 7.37256 13.0755 7.37256C13.6759 7.37256 14.1461 7.6185 14.486 8.12484C14.8043 8.60225 14.9635 9.24602 14.9635 10.0562C14.9635 10.8663 14.8043 11.5101 14.486 11.9875C14.1461 12.4866 13.6759 12.7398 13.0755 12.7398C12.4679 12.7398 11.9977 12.4866 11.665 11.9875C11.3467 11.5101 11.1876 10.8663 11.1876 10.0562C11.1876 9.24602 11.3467 8.60225 11.665 8.12484ZM13.9435 8.77585C13.7699 8.31291 13.4806 8.08867 13.0755 8.08867C12.6632 8.08867 12.3739 8.31291 12.2075 8.77585C12.0918 9.08689 12.0339 9.51366 12.0339 10.0562C12.0339 10.5914 12.0918 11.0182 12.2075 11.3365C12.3739 11.7922 12.6632 12.0237 13.0755 12.0237C13.4806 12.0237 13.7699 11.7922 13.9435 11.3365C14.0593 11.0182 14.1171 10.5914 14.1171 10.0562C14.1171 9.51366 14.0593 9.08689 13.9435 8.77585Z" fill="#ffffff"/>\n</svg>',"image/svg+xml").firstChild}var POSITIONS$3=Plugin.POSITIONS,PlaybackRateMobilePlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),(n=t.call(this,e)).playerData=null,n.state={currentRate:1,isSupport:!0},n.playerData=e.player.config.playerData,n}return _createClass$6(r,[{key:"registerIcons",value:function(){return{playbackRate:{icon:RateIconSVG,class:"xgplayer-rate-svg"}}}},{key:"registerLanguageTexts",value:function(){return{rate:{jp:"倍速",en:"PlaybackRate",zh:"倍速","zh-hk":"倍速"},rateSelect:{jp:"倍速選ぶ",en:"PlaybackRate",zh:"倍速选择","zh-hk":"倍速選擇"}}}},{key:"afterCreate",value:function(){this.appendChild(".xgplayer-icon",this.icons.playbackRate),this.initEvents(),this.state.currentRate=this.player.playbackRate||1}},{key:"afterPlayerInit",value:function(){}},{key:"initEvents",value:function(){var e=this;this.bind(["click"],this.renderList.bind(this)),this.on(RATE_CHANGE,(function(){var t,r;e.state.currentRate!==e.player.playbackRate&&(e.state.currentRate=e.player.playbackRate,null!==(t=e.player)&&void 0!==t&&null!==(r=t.panel)&&void 0!==r&&r.isShow&&e.updatePanel())}))}},{key:"renderList",value:function(){var e=this.renderItemList();this.renderPanel(e)}},{key:"renderItemList",value:function(){var e=this,t=util.createDom("div","",{},"playbackRate-panel-content");return this.config.list.forEach((function(r){var n=e.renderItem(r);t.appendChild(n)})),t}},{key:"renderItem",value:function(e){var t=this,r=isObject$o(e)?e:{textKey:e+"X",value:e},n=util.createDom("div","",{},"panel-Item ".concat(this.state.currentRate===r.value?"select-in":""));return n.innerHTML=this.i18n[r.textKey]||r.textKey,n.addEventListener("click",(function(e){e.stopPropagation(),e.preventDefault(),t.emit(RATE_CHANGE,{from:t.player.playbackRate,to:r.value}),t.state.currentRate=r.value,t.player.playbackRate=r.value,t.updatePanel()})),n}},{key:"renderPanel",value:function(e){var t,r;null===(t=this.player)||void 0===t||null===(r=t.panel)||void 0===r||r.showPanel(e,this.langText.rateSelect,!0)}},{key:"updatePanel",value:function(){var e,t=this.renderItemList();null===(e=this.player)||void 0===e||e.panel.updatePanel(t)}},{key:"destroy",value:function(){this.unbind(["click"],this.renderList.bind(this))}},{key:"render",value:function(){return'\n <xg-icon class="xgplayer-mobile-playBackRate">\n <div class="xgplayer-icon">\n </div>\n </xg-icon>\n '}}],[{key:"pluginName",get:function(){return"PlaybackRateMobilePlugin"}},{key:"textTips",get:function(){return{jp:"倍速",en:"PlaybackRate",zh:"倍速","zh-hk":"倍速"}}},{key:"defaultConfig",get:function(){return{position:POSITIONS$3.CONTROLS_RIGHT,index:2.9,list:[2,1.5,1.25,1,.75,.5],default:1}}}]),r}(Plugin),SdkPlugin=function(){function e(t){_classCallCheck$5(this,e),this.__args=null,this.sdk=null,this.playerData=null,this.player=null,this._emitter=null,this.beforeCreate&&"function"==typeof this.beforeCreate&&this.beforeCreate(),this.__args=t,this.pluginName="",this.__init(t)}return _createClass$6(e,[{key:"beforeCreate",value:function(){}},{key:"afterCreate",value:function(){}},{key:"beforePlayerCreate",value:function(){}},{key:"afterPlayerCreate",value:function(){}},{key:"destroy",value:function(){}},{key:"__init",value:function(t){var r=this;e.defineGetterOrSetter(this,{sdk:{get:function(){return t.sdk},configurable:!0},player:{get:function(){return t.sdk.getPlayerInstance()},configurable:!0},playerData:{get:function(){return t.sdk.playerData},configurable:!0},pluginName:{get:function(){return t.pluginName?t.pluginName.toLowerCase():r.constructor.pluginName.toLowerCase()},configurable:!0},_emitter:{get:function(){return t.sdk._emitter},configurable:!0}})}},{key:"__destroy",value:function(){var e=this,t=this.sdk,r=this.pluginName;this.destroy&&"function"==typeof this.destroy&&this.destroy(),["sdk","player","playerData","pluginName","_emitter"].map((function(t){Object.defineProperty(e,t,{writable:!0})})),Object.keys(this).map((function(t){e[t]=null,delete e[t]})),Object.setPrototypeOf&&Object.setPrototypeOf(this,null),delete t._sdkPlugins[r]}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var r in t)Object.defineProperty(e,r,t[r])}},{key:"pluginName",get:function(){return"pluginName"}}]),e}(),defaultConfig={playAuthToken:"",needDefinitionList:!0},AuthToken=function(e){_inherits$5(a,e);var t,r,n,i,o=_createSuper$5(a);function a(e){var t;return _classCallCheck$5(this,a),(t=o.call(this,e)).isPlayByToken=!1,t.isEncrypt=!1,t.config=null,t.retryCount=1,t.init(),t}return _createClass$6(a,[{key:"beforePlayerCreate",value:(i=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isPlayByToken){e.next=3;break}return e.next=3,this.getConfig();case 3:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"getConfig",value:(n=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(){var t,r,n,i,o,a,s,l,c,u,h,d,p,f,g,y,v,m,_,b;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!isTokenExpired(this.tokenInfo)){e.next=8;break}return console.error("playAuthToken is expired, please check or update your playAuthToken"),this.sdk.emit(SDKEvents.TOKEN_EXPIRED,{type:"playAuthToken",token:this.tokenInfo}),i={errorType:"token",errorCode:9101,errorMessage:"playAuthToken has expired",ext:{token:this.tokenInfo,config:this.config},originError:void 0},null===(n=this.sdk)||void 0===n||n.delayError.push(i),e.abrupt("return");case 8:if(!this.keyTokenInfo){e.next=16;break}if(!isTokenExpired(this.keyTokenInfo)){e.next=16;break}return console.error("keyToken is expired, please check or update your keyToken"),this.sdk.emit(SDKEvents.TOKEN_EXPIRED,{type:"keyToken",token:this.keyTokenInfo}),a={errorType:"token",errorCode:9102,errorMessage:"keyToken for hls encrypt play has expired",ext:{token:this.keyTokenInfo,config:this.config},originError:void 0},null===(o=this.sdk)||void 0===o||o.delayError.push(a),e.abrupt("return");case 16:return s=getFormat(this.config),this.playerData.codec=(null===(t=this.tokenInfo)||void 0===t||null===(r=t.Codec)||void 0===r?void 0:r.toLowerCase())||CodecType.H264,e.next=20,this.getVideos();case 20:if(e.t0=e.sent,e.t0){e.next=23;break}e.t0={};case 23:return l=e.t0,c=l.playList,u=void 0===c?[]:c,h=l.poster,d=l.vid,p=l.dashOpts,f=l.thumbs,g=l.barrageMaskUrl,e.next=33,this.getPrivateDrmInfo(u,d,s);case 33:this.playerData.options.vid=d,this.config.needPoster&&h&&(this.playerData.options.poster=h),this.config.needThumbs&&f.length>0&&this.getThumbnailConfig(f),this.config.needBarrageMask&&g&&this.getBarrageMaskUrl(g),u.length>0?(this.isEncrypt=!!u[0].kid,"hls"===s&&this.isEncrypt&&this.getEncryptHlsConfig({vid:d,playList:u}),("dash"===s||this.playerData.configs.DASHPlugin)&&this.getDashPluginConfig({vid:d,dashOpts:p,playList:u}),y=this.playerData.configs,v=y.autoBitrateOpts,m=y.Mp4EncryptPlayer,_=y.enableMp4MSE,("mp4"===s&&this.isEncrypt||"mp4"===s&&null!=v&&v.isOpenAutoDefi||m||_)&&this.getMp4EncryptConfig({vid:d,playList:u}),"dash"===s||this.playerData.configs.DASHPlugin?(b=u.filter((function(e){return"video"===e.FileType}))).length&&(this.playerData.playList=b,this.playerData.initCurrent(b[0])):(this.playerData.playList=this.config.needDefinitionList?u:[u[0]],this.playerData.initCurrent(this.playerData.playList[0]))):console.error("got no video by playAuthToken"),e.next=43;break;case 40:e.prev=40,e.t1=e.catch(0),console.error(e.t1);case 43:case"end":return e.stop()}}),e,this,[[0,40]])}))),function(){return n.apply(this,arguments)})},{key:"getVideos",value:(r=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(){var t,r,n=this;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=function(e){var t,r;try{100006===get$2(JSON.parse(e.response),"ResponseMetadata.Error.CodeN")&&(console.error("playAuthToken is expired, please check or update your playAuthToken"),n.sdk.emit(SDKEvents.TOKEN_EXPIRED,e))}catch(o){console.log(o)}null===(t=n._emitter)||void 0===t||t.emit(PluginEvents.GET_PLAY_URL_ERR,e);var i={errorType:"token",errorCode:9100,errorMessage:"get play url error by playAuthToken, please check playAuthToken",ext:{},originError:e};null===(r=n.sdk)||void 0===r||r.delayError.push(i)},r=function(){var e=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(r){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(502!==(null==r?void 0:r.status)||!n.playerData.apiMap.backupPlayDomain){e.next=7;break}return n.playerData.apiMap.playDomain=n.playerData.apiMap.backupPlayDomain,e.next=4,retryByError((function(){return getPlayInfoByAuthToken(_objectSpread2$5(_objectSpread2$5({},n.playerData.apiMap),n.config))}),n.retryCount,(function(e){return 502===e.status}),t);case 4:return e.abrupt("return",e.sent);case 7:t(r);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e.next=4,retryByError((function(){return getPlayInfoByAuthToken(_objectSpread2$5(_objectSpread2$5({},n.playerData.apiMap),n.config))}),this.retryCount,(function(e){return 502===e.status}),r);case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getPrivateDrmInfo",value:(t=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(t,r,n){var i,o,a,s,l,c,u=this;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.config.getDrmAuthToken||"function"!=typeof this.config.getDrmAuthToken||!this.playerData.unionId){e.next=34;break}if(this.sessionId=(new Date).getTime().toString(),"hls"!==n){e.next=9;break}return e.next=5,sdkUmdLoader.loadPlugins("hlsEncrypt");case 5:o=e.sent,i=o.updateUnionInfo(this.playerData.unionId,this.sessionId),e.next=21;break;case 9:if("dash"!==n){e.next=16;break}return e.next=12,sdkUmdLoader.loadPlugins("dash");case 12:a=e.sent,i=a.updateUnionInfo(this.playerData.unionId,this.sessionId),e.next=21;break;case 16:if("mp4"!==n){e.next=21;break}return e.next=19,sdkUmdLoader.loadPlugins("mp4Encrypt");case 19:s=e.sent,i=s.updateUnionInfo(this.playerData.unionId,this.sessionId);case 21:if(i){e.next=23;break}return e.abrupt("return");case 23:return l=_toConsumableArray$1(new Set(t.map((function(e){return e.kid})))).join(","),e.prev=24,e.next=27,exeFunTimeoutWarn(retPromise$1(this.config.getDrmAuthToken(l,r,i)),200,"The execution time of obtaining privateDrmAuthToken by getDrmAuthToken function of options has exceeded more than 200ms");case 27:(c=e.sent)&&"string"==typeof c&&(this.privateDrmAuthToken=c,t.forEach((function(e){e.drmKeyToken=u.privateDrmAuthToken}))),e.next=34;break;case 31:e.prev=31,e.t0=e.catch(24),console.error("get privaterDrmToken fail");case 34:case"end":return e.stop()}}),e,this,[[24,31]])}))),function(e,r,n){return t.apply(this,arguments)})},{key:"getEncryptHlsConfig",value:function(e){var t,r=e||{},n=r.playList,i=r.vid,o=this.config,a=o.playDomain,s=o.keyToken,l=o.getKeyType,c=o.keyDomain,u=_objectSpread2$5({},this.playerData.configs.EncryptHlsPlugin||{}),h=null==n||null===(t=n[0])||void 0===t?void 0:t.kid;if(s)this.playerData.options.EncryptHlsPlugin=_objectSpread2$5({keyToken:s,playDomain:a||this.playerData.apiMap.playDomain,getKeyType:l||"TOP",keyDomain:c||this.playerData.apiMap.keyDomain},u);else if(this.privateDrmAuthToken&&this.sessionId){var d=getQueryParams(this.privateDrmAuthToken),p=parseInt(d["X-Expires"]),f=isNaN(p)?30:p;this.playerData.options.EncryptHlsPlugin=_objectSpread2$5({vid:i,kid:h,useUnionInfoDRM:!0,keyTokenExpiredDuration:f,drmKeyToken:this.privateDrmAuthToken,sessionId:this.sessionId,playDomain:a||this.playerData.apiMap.playDomain},u)}}},{key:"getThumbnailConfig",value:function(e){var t=e[0],r=_objectSpread2$5({},this.playerData.configs.thumbnail||{});this.playerData.options.thumbnail=_objectSpread2$5({pic_num:t.CaptureNum,urls:t.StoreUrls,width:t.CellWidth,height:t.CellHeight,col:t.ImgXLen,row:t.ImgYLen},r)}},{key:"getBarrageMaskUrl",value:function(e){var t,r,n=_objectSpread2$5({},(null===(t=this.playerData.configs)||void 0===t||null===(r=t.DanmuPlugin)||void 0===r?void 0:r.maskConfig)||{});this.playerData.configs.DanmuPlugin?(this.playerData.options.DanmuPlugin.active=!0,this.playerData.options.DanmuPlugin.maskActive=!0,this.playerData.options.DanmuPlugin.maskConfig=_objectSpread2$5({maskUrl:e},n)):this.playerData.options.DanmuPlugin={active:!0,maskActive:!0,maskConfig:_objectSpread2$5({maskUrl:e},n)}}},{key:"getDashPluginConfig",value:function(e){var t,r,n=e||{},i=n.vid,o=n.playList,a=n.dashOpts,s=this.config.playDomain,l=_objectSpread2$5({},(null===(t=this.playerData.configs)||void 0===t?void 0:t.DASHPlugin)||{}),c=null==o||null===(r=o[0])||void 0===r?void 0:r.kid;if(this.privateDrmAuthToken&&this.sessionId){var u=getQueryParams(this.privateDrmAuthToken),h=parseInt(u["X-Expires"]),d=isNaN(h)?30:h;this.playerData.options.DASHPlugin=_objectSpread2$5({playInfoType:"TOP",vid:i,dashOpts:a,defaultFormat:"dash",definitionText:this.config.definitionMap,kid:c,useUnionInfoDRM:!0,keyTokenExpiredDuration:d,sessionId:this.sessionId,drmKeyToken:this.privateDrmAuthToken,playDomain:s||this.playerData.apiMap.playDomain},l)}}},{key:"getMp4EncryptConfig",value:function(e){var t,r,n=e.playList,i=e.vid,o=this.config.playDomain,a=null==n||null===(t=n[0])||void 0===t?void 0:t.kid,s=_objectSpread2$5({},(null===(r=this.playerData.configs)||void 0===r?void 0:r.Mp4EncryptPlayer)||{});if(this.isEncrypt){if(this.privateDrmAuthToken&&this.sessionId){var l=getQueryParams(this.privateDrmAuthToken),c=parseInt(l["X-Expires"]),u=isNaN(c)?30:c;this.playerData.options.Mp4EncryptPlayer=_objectSpread2$5({vid:i,useEME:!1,isEncrypt:!0,bitrate:null==n?void 0:n[0].Bitrate,kid:a,drmKeyToken:this.privateDrmAuthToken,useUnionInfoDRM:!0,keyTokenExpiredDuration:u,sessionId:this.sessionId,playDomain:o||this.playerData.apiMap.playDomain},s)}}else this.playerData.options.Mp4EncryptPlayer=_objectSpread2$5({vid:i,bitrate:null==n?void 0:n[0].Bitrate},s)}},{key:"init",value:function(){var e=this.playerData.configs.getVideoByToken,t=void 0===e?{}:e;this.initConfig(t)}},{key:"initConfig",value:function(e){if(this.isPlayByToken=!!e.playAuthToken,this.isPlayByToken){if(this.config=Object.assign(defaultConfig,e),this.tokenInfo=parseToken(e.playAuthToken),e.keyToken){var t=isBase64(e.keyToken)?window.atob(e.keyToken):e.keyToken;this.keyTokenInfo=getQueryParams(t)}e.retryCount&&(this.retryCount=e.retryCount)}}},{key:"switchAuthToken",value:function(e){return this.initConfig(e),this.getConfig()}}],[{key:"pluginName",get:function(){return"AuthToken"}}]),a}(SdkPlugin),sdkPluginManager={init:function(e){var t;e&&(null!==(t=e.playerData)&&void 0!==t&&t.isLive?e.sdkPlugins=[]:e.sdkPlugins=[AuthToken],e._sdkPlugins={})},registerPlugin:function(e,t){if(e&&t){var r=null,n=null;e.plugin&&"function"==typeof e.plugin?(r=e.plugin,n=e.options):(r=e,n={}),n.sdk=t;var i=n.pluginName||r.pluginName;if(!i)throw new Error("The property pluginName is necessary");var o=t._sdkPlugins;try{o[i.toLowerCase()]&&this.unRegister(i);var a=new r(n);return o[i.toLowerCase()]=a,o[i.toLowerCase()].func=r,a&&"function"==typeof a.afterCreate&&a.afterCreate(),a}catch(s){console.error(s)}}},unRegister:function(e,t){if(e&&t){e=e.toLowerCase();try{var r=t._sdkPlugins[e];r&&(r.pluginName&&r.__destroy(),delete t._sdkPlugins[e])}catch(n){console.error(n)}}},beforePlayerCreate:function(e){if(e){e._sdkPlugins||this.init(e);for(var t=e._sdkPlugins,r=[],n=0,i=Object.keys(t);n<i.length;n++){var o=i[n];if(t[o]&&t[o].beforePlayerCreate)try{var a=t[o].beforePlayerCreate();r.push(retPromise$1(a))}catch(e2){throw r.push(retPromise$1(null)),e2}}return new Promise((function(e){Promise.all([].concat(r)).then((function(){e(null)})).catch((function(t){console.error(t),e(null)}))}))}},afterPlayerCreate:function(e){if(e)for(var t=e._sdkPlugins,r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];if(t[i]&&t[i].beforePlayerCreate)try{t[i].afterPlayerCreate()}catch(e2){throw e2}}},destroy:function(e){if(e){for(var t=e._sdkPlugins,r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];this.unRegister(i,e)}delete e._sdkPlugins}}};const name="@byteplus/veplayer",version="1.1.0-alpha.2",main="dist/index.min.js",module$1="dist/index.min.js",typings="dist/index.d.ts",sideEffects=["*.css","*.less"],files=["dist"],unpkg=!0,unpkgFiles=["*"],scripts={"test:e2e":"echo 'test'",lint:"npx lint-staged",dev:"libd dev demo","dev:vod":"libd dev demo/vod","dev:hth":"libd dev fixtures/hth",build:"libd build",release:"libd release",doc:"docg",changelog:"libd changelog -s"},author="",license="BSD-3-Clause",devDependencies={"@babel/runtime-corejs3":"^7.20.13","@byted/docg":"^0.5.1","@byted/docg-plugin-sdkhub":"^0.1.5","@byted/libd":"1.1.21","@commitlint/cli":"^16.2.1","@commitlint/config-conventional":"^16.2.1","@types/lodash":"^4.14.178","@typescript-eslint/eslint-plugin":"^5.12.0","@typescript-eslint/parser":"^5.12.0","cross-env":"^7.0.3",eslint:"^8.9.0","eslint-config-prettier":"^6.7.0","eslint-plugin-jest":"^23.20.0","eslint-plugin-prettier":"^3.1.0","git-cz":"^4.7.6",husky:"^8.0.1",less:"^4.1.2","lint-staged":"^11.1.2","node-fetch":"2.6.2","postcss-less":"^6.0.0",prettier:"^2.2.1","rollup-plugin-visualizer":"^5.9.0",shelljs:"^0.8.5",stylelint:"^14.5.2","stylelint-config-standard":"^24.0.0","stylelint-prettier":"^2.0.0",typescript:"^4.5.5"},dependencies={"@byted/xgplayer-app-logger":"^0.11.15","@byted/xgplayer-live-logger":"1.0.0-alpha.9","@byted/xgplayer-rts":"0.1.11","@byted/xgplayer-vod-menu":"3.0.3",dayjs:"^1.11.6","dom-helpers":"^5.2.1",eventemitter3:"^4.0.7","globalthis-polyfill":"^1.0.0","js-cookie":"^3.0.1","lodash-es":"^4.17.21","proxy-polyfill":"^0.3.2",xgplayer:"3.0.0-next.54","xgplayer-service":"^0.4.2"},publishConfig={tag:"alpha",access:"public",registry:"https://registry.npmjs.org"},browserslist=["> 0.1%","iOS > 10","android >= 5","Chrome > 40","ChromeAndroid >= 39","not dead","IE 11"];var pkgJson={name:name,version:version,main:main,module:module$1,typings:typings,sideEffects:sideEffects,files:files,unpkg:unpkg,unpkgFiles:unpkgFiles,scripts:scripts,author:author,license:license,devDependencies:devDependencies,dependencies:dependencies,"lint-staged":{"*.{less}":'stylelint --fix "src/**/*.less" --custom-syntax postcss-less',"*.{js,jsx,ts,tsx}":["eslint --fix"]},publishConfig:publishConfig,browserslist:browserslist},defaultExtendLang=[{LANG:"en",TEXT:{MEDIA_ERR_SRC_NOT_SUPPORTED:"Audio/video is not supported or no playable source found",GET_URL_ERR_BY_TOKEN:"Failed to get video url",PLAY_AUTH_TOKEN_EXPIRED:"Token has expired",HLS_KEY_TOKEN_EXPIRED:"Play certificate has expired",MEDIA_SOURCE_CANNOT_PLAY_TYPE:"Video type cannot play",NETWORK_ERROR:"Network error",NETWORK_TIMEOUT:"Network timeout"}},{LANG:"zh",TEXT:{MEDIA_ERR_SRC_NOT_SUPPORTED:"音/视频格式不支持,或未找到可用资源",GET_URL_ERR_BY_TOKEN:"获取视频地址失败",PLAY_AUTH_TOKEN_EXPIRED:"token已过期",HLS_KEY_TOKEN_EXPIRED:"播放凭证已过期",MEDIA_SOURCE_CANNOT_PLAY_TYPE:"不支持的视频格式",NETWORK_ERROR:"网络错误",NETWORK_TIMEOUT:"网络超时"}},{LANG:"zh-hk",TEXT:{MEDIA_ERR_SRC_NOT_SUPPORTED:"音/視頻格式不支持,或未找到可用資源",GET_URL_ERR_BY_TOKEN:"獲取視頻地址失敗",PLAY_AUTH_TOKEN_EXPIRED:"Token已過期",HLS_KEY_TOKEN_EXPIRED:"播放憑證已過期",MEDIA_SOURCE_CANNOT_PLAY_TYPE:"不支持的視頻格式",NETWORK_ERROR:"網絡錯誤",NETWORK_TIMEOUT:"網絡超時"}},{LANG:"jp",TEXT:{MEDIA_ERR_SRC_NOT_SUPPORTED:"オーディオ/ビデオ形式がサポートされていないか、利用可能なリソースが見つかりませんでした",GET_URL_ERR_BY_TOKEN:"動画の URL を取得できませんでした",PLAY_AUTH_TOKEN_EXPIRED:"playAuthTokenは期限切れです",HLS_KEY_TOKEN_EXPIRED:"プレイ証明書の有効期限が切れています",MEDIA_SOURCE_CANNOT_PLAY_TYPE:"サポートされていないビデオ形式",NETWORK_ERROR:"ネットワークエラー",NETWORK_TIMEOUT:"ネットワークタイムアウト"}}],Xhr=function(){function e(t,r){_classCallCheck$5(this,e),this.url=t;var n=new window.XMLHttpRequest;n.target=this,n.responseType="arraybuffer",n.open("get",t),n.onload=function(){200!==n.status&&206!==n.status||r&&r instanceof Function&&r(n.response)},n.onerror=function(e){},this.xhr=n,this.run()}return _createClass$6(e,[{key:"cancel",value:function(){this.xhr.abort()}},{key:"run",value:function(){1===this.xhr.readyState&&this.xhr.send()}}]),e}(),PLAY_MODES={ORDER:"order",SLOOP:"sloop",LOOP:"loop",RANDOM:"random"},CLASS_NAME="xgplayer-music";function _randomIndex(e,t,r){var n=Math.floor(Math.random()*(t-e)+e);return n===r?(n>t/2?t/=2:e=t/2,t-e>2?_randomIndex(e,t,r):n):n}var Music=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(){var e;return _classCallCheck$5(this,r),(e=t.apply(this,arguments))._onEnded=function(){if("order"===e.mode&&e.index+1>=e.list.length)return e.player.pause(),void(e.player.currentTime=0);switch(e.mode){case PLAY_MODES.SLOOP:e.change();break;case PLAY_MODES.ORDER:case PLAY_MODES.LOOP:default:e.next()}},e._onDurationChange=function(){var t=e.config.abCycle;e._initABCycle(t,e.player)},e._onTimeUpdate=function(){var t=_assertThisInitialized$5(e),r=t.config,n=t.player;if(!e.halfPass&&n.currentTime>n.duration/2&&e.confirmOrder(),r.abCycle){var i=r.abCycle,o=i.end>n.duration?n.duration:i.end;n.currentTime>=o?(i.loop||(n.pause(),e.emit("abCycle_ended")),n.currentTime=i.start||0):n.currentTime<i.start&&(n.currentTime=i.start||0)}},e}return _createClass$6(r,[{key:"afterCreate",value:function(){var e,t,r,n,i,o,a,s,l,c,u=this.player,h=this.playerConfig;(util.addClass(u.root,CLASS_NAME),this.halfPass=!1,this.list=this.config.list||[],this.emit(PluginEvents.MUSIC_LIST_CHANGE,this.list),this.nextIndex=-1,this.prevIndex=-1,this.history=[],this.disable=!(this.list.length>0),!h.url&&this.list.length>0)&&(h.url=null===(e=this.list)||void 0===e||null===(t=e[0])||void 0===t?void 0:t.src);h.poster||(h.poster=null===(r=this.list)||void 0===r||null===(n=r[0])||void 0===n?void 0:n.poster);h.title||(h.title=null!==(i=null===(o=this.list)||void 0===o||null===(a=o[0])||void 0===a?void 0:a.title)&&void 0!==i?i:"");h.vid||(h.vid=null!==(s=null===(l=this.list)||void 0===l||null===(c=l[0])||void 0===c?void 0:c.vid)&&void 0!==s?s:"");this._curInfo={src:h.url,poster:h.poster,title:h.title,vid:h.vid},this.index=0,this.on(TIME_UPDATE,this._onTimeUpdate),this.on(ENDED,this._onEnded),this.on(DURATION_CHANGE,this._onDurationChange),this.config.offline&&this.checkOffline(this._curInfo.src,this._curInfo.vid).then((function(e){0===e.code&&(h.url=e.url,u.state>=4&&(u.src=e.url))})).catch((function(e){console.error(e)}))}},{key:"destroy",value:function(){util.removeClass(this.player.root,CLASS_NAME)}},{key:"_nextCompute",value:function(){if(!this.disable)switch(this.mode){case PLAY_MODES.SLOOP:this.nextIndex=this.index;break;case PLAY_MODES.ORDER:case PLAY_MODES.LOOP:this.index+1<this.list.length?this.nextIndex=this.index+1:this.nextIndex=0;break;default:this.nextIndex=_randomIndex(0,this.list.length,this.index)}}},{key:"_prevCompute",value:function(){if(!this.disable)switch(this.mode){case PLAY_MODES.SLOOP:this.nextIndex=this.index;break;case PLAY_MODES.ORDER:case PLAY_MODES.LOOP:this.index-1>=0?this.prevIndex=this.index-1:this.prevIndex=this.list.length-1;break;default:this.prevIndex=_randomIndex(0,this.list.length,this.index)}}},{key:"_emitChange",value:function(){this.emit(PluginEvents.MUSIC_CHANGE,this._curInfo)}},{key:"_initABCycle",value:function(e,t){var r=t.plugins.progresspreview;if(e&&t){var n=e.end>this.player.duration?this.player.duration:e.end,i=e.start>this.player.duration?0:e.start,o={id:t.playerId,time:e.start,duration:n-i,text:e.text,color:e.color};r.findDot(o.id)?r.updateDot(o):r.createDot(o)}else r.findDot(t.playerId)&&r.deleteDot(t.playerId)}},{key:"random",value:function(){if(this.list.length<0)return null;var e=_randomIndex(0,this.list.length,this.index);return this.list[e]}},{key:"next",value:function(){this.disable||(this.halfPass||(this.halfPass=!0,this._nextCompute()),this.index=this.nextIndex,this.change())}},{key:"prev",value:function(){this.disable||(this.halfPass||(this.halfPass=!0,this._prevCompute()),this.index=this.prevIndex,this.change())}},{key:"forward",value:function(){var e=this.player,t=this.config.timeScale;e.currentTime=e.currentTime+t<e.duration?e.currentTime+t:e.duration-.1}},{key:"backward",value:function(){var e=this.player,t=this.config.timeScale;e.currentTime=e.currentTime-t>0?e.currentTime-t:0}},{key:"add",value:function(e){this.list.push({src:e.src,title:e.title,vid:e.vid,poster:e.poster}),this.disable=!(this.list.length>0),this.emit(PluginEvents.MUSIC_LIST_CHANGE,this.list)}},{key:"remove",value:function(e){var t=-1;this.list.every((function(r,n){return r.vid!==e||(t=n,!1)})),t>-1&&(this.list.splice(t,1),this.emit(PluginEvents.MUSIC_LIST_CHANGE,this.list)),this.disable=!(this.list.length>0)}},{key:"setAbCycle",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};e&&"Object"===util.typeOf(e)?this.config.abCycle=_objectSpread2$5({},e):this.config.abCycle=_objectSpread2$5({start:e||0,end:t||this.player.duration,loop:r},n),this._initABCycle(this.config.abCycle,this.player)}},{key:"removeAbCycle",value:function(){this.config.abCycle=null,this._initABCycle(null,this.player)}},{key:"updateList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.removeAbCycle(),this.player.pause(),this.player.currentTime=0,this.list=e,this.nextIndex=0,this.index=0,this.change(),this.disable=!(this.list.length>0),this.emit(PluginEvents.MUSIC_LIST_CHANGE,this.list)}},{key:"setIndex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;e<0||e>=this.list.length||(this.nextIndex=e,this.index=e,this.change())}},{key:"change",value:function(){var e=this;if(!this.disable){var t=this.player,r=this.list,n=this.index,i=r[n].vid;this.halfPass=!1,this.checkOffline(r[n].src,i).then((function(r){e._curInfo={title:e.list[e.index].title||"",vid:e.list[e.index].vid,poster:e.list[e.index].poster||"",src:r.url},t.playNext({url:r.url,vid:e.list[e.index].vid||0,poster:e.list[e.index].poster||"",autoplay:!0}),t.off("timeupdate",e._emitChange.bind(e)),t.once("timeupdate",e._emitChange.bind(e)),t.play()}))}}},{key:"checkOffline",value:function(e,t){var r=this;return new Promise((function(n,i){if(!r.config.offline||r.disable)return n({url:e,code:-1,vid:t});var o=r.player.database;o.openDB((function(){o.getDataByKey(o.myDB.ojstore.name,t,(function(r){setTimeout((function(){o.closeDB()}),5e3),n(r?{url:URL.createObjectURL(r.blob),code:0,vid:r.vid}:{url:e,code:-2,vid:t})}))}))}))}},{key:"confirmOrder",value:function(){this.halfPass=!0,this._nextCompute(),this._prevCompute(),this.config.preloadNext&&this.preload(this.nextIndex)}},{key:"preload",value:function(e){if(!(e<0||e>=this.list.length)){var t=this.list[e],r=this.player;this.checkOffline(t.src,t.vid).then((function(e){if(-2===e.code){var n=t.vid;new Xhr(t.src,(function(e){r.database.openDB((function(){r.database.addData(r.database.myDB.ojstore.name,[{vid:n,blob:new Blob([e],{type:'audio/mp4; codecs="mp4a.40.5"'})}]),setTimeout((function(){r.database.closeDB()}),5e3)}))}))}}))}}},{key:"timeScale",get:function(){return this.config.timeScale||15},set:function(e){this.config.timeScale=e,this.emit(PluginEvents.TIME_SCALE_CHANGE,e)}},{key:"mode",get:function(){return this.config.mode||PLAY_MODES.RANDOM},set:function(e){Object.values(PLAY_MODES).includes(e)&&(this.config.mode=e,this.emit(PluginEvents.MUSIC_MODE_CHANGE,e))}}],[{key:"pluginName",get:function(){return"music"}},{key:"defaultConfig",get:function(){return{offline:!1,preloadNext:!0,abCycle:null,timeScale:15,mode:PLAY_MODES.ORDER,list:[]}}},{key:"ModeType",get:function(){return Object.keys(PLAY_MODES).map((function(e){return PLAY_MODES[e]}))}}]),r}(BasePlugin),MusicCover=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(){return _classCallCheck$5(this,r),t.apply(this,arguments)}return _createClass$6(r,[{key:"afterCreate",value:function(){var e=this;this.on(PluginEvents.MUSIC_CHANGE,(function(t){if(t&&t.poster){var r=e.find("img");r?r.src=t.poster:e.root.innerHTML="<img src=".concat(t.poster,' alt=""/>'),e.show()}else e.hide()}))}},{key:"render",value:function(){var e,t,r=this.playerConfig;return r.poster||null!=r&&null!==(e=r.url)&&void 0!==e&&e[0].poster?'<xg-icon class="xgplayer-cover">\n <img src="'.concat(r.poster||(null==r||null===(t=r.url)||void 0===t?void 0:t[0].poster),'" alt="">\n </xg-icon>'):'<xg-icon class="xgplayer-cover"></xg-icon>'}}],[{key:"pluginName",get:function(){return"musiccover"}},{key:"defaultConfig",get:function(){return{index:0,position:Plugin.POSITIONS.CONTROLS_LEFT}}}]),r}(Plugin);function backwardIcon(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M10.2478 0C6.32662 0 2.94593 2.3143 1.39715 5.65152L0.558008 5.42701C0.321533 5.36365 0.0784664 5.50398 0.0151043 5.74046C-0.00971985 5.8331 -0.00382614 5.9313 0.0319023 6.02031L1.13271 8.76283C1.22391 8.99003 1.48202 9.10028 1.70921 9.00908C1.74819 8.99344 1.78475 8.97233 1.81779 8.94639L4.14238 7.12171C4.33496 6.97055 4.36853 6.69189 4.21737 6.49932C4.15815 6.42387 4.07605 6.36967 3.98341 6.34485L3.14176 6.1196C4.46348 3.53919 7.14942 1.77312 10.2478 1.77312C14.6545 1.77312 18.2269 5.34545 18.2269 9.75215C18.2269 14.1589 14.6545 17.7312 10.2478 17.7312C6.45067 17.7312 3.273 15.0787 2.4666 11.5256L0.656528 11.5254C1.49041 16.0647 5.46745 19.5043 10.2478 19.5043C15.6338 19.5043 20 15.1381 20 9.75215C20 4.36619 15.6338 0 10.2478 0Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}var MusicBackward=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(){var e;return _classCallCheck$5(this,r),(e=t.apply(this,arguments)).onClick=function(t){var r=_assertThisInitialized$5(e).player;t.preventDefault(),t.stopPropagation(),r.plugins.music.backward()},e}return _createClass$6(r,[{key:"afterCreate",value:function(){var e=this;this.initIcons();["click","touchstart"].forEach((function(t){e.bind(t,e.onClick)})),this.timeScaleDom=this.find(".xgplayer-timescale"),this.on(PluginEvents.TIME_SCALE_CHANGE,(function(t){e.timeScaleDom.innerHTML=t}))}},{key:"registerIcons",value:function(){return{musicBackward:{icon:backwardIcon,class:"xg-icon-mbackward"}}}},{key:"registerLanguageTexts",value:function(){return{backward:{jp:"あとずさりする",en:"MusicBackward",zh:"后退","zh-hk":"後退"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.musicBackward)}},{key:"destroy",value:function(){var e=this;["click","touchstart"].forEach((function(t){e.unbind(t,e.onClick)}))}},{key:"render",value:function(){var e=this.player.plugins.music.config.timeScale||15;return'<xg-icon class="xgplayer-backward">\n <div class="xgplayer-icon">\n <span class="xgplayer-timescale">'.concat(e,'</span>\n </div>\n <div class="xg-tips" lang-key="backward">').concat(this.langText.backward,"</div>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"musicbackword"}},{key:"defaultConfig",get:function(){return{index:1,position:Plugin.POSITIONS.CONTROLS_LEFT}}}]),r}(Plugin),MusicPrev=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(){var e;return _classCallCheck$5(this,r),(e=t.apply(this,arguments)).onClick=function(t){var r=_assertThisInitialized$5(e).player;t.preventDefault(),t.stopPropagation(),r.plugins.music.prev()},e}return _createClass$6(r,[{key:"afterCreate",value:function(){var e=this;this.initIcons();["click","touchstart"].forEach((function(t){e.bind(t,e.onClick)})),this.updateVisible(),this.on(PluginEvents.MUSIC_LIST_CHANGE,this.updateVisible.bind(this))}},{key:"updateVisible",value:function(){var e,t,r;(null===(e=this.player.plugins)||void 0===e||null===(t=e.music)||void 0===t||null===(r=t.list)||void 0===r?void 0:r.length)>1?this.show():this.hide()}},{key:"registerIcons",value:function(){return{musicPrev:{icon:' <svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_20323_25783)">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M21.2 1.20196V22.798C21.2 23.7867 20.0711 24.3511 19.28 23.7579L4.88002 12.9598C4.24002 12.4799 4.24002 11.5201 4.88002 11.0402L19.28 0.242135C20.0711 -0.35107 21.2 0.213286 21.2 1.20196Z" fill="white"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.8 0.00219727C4.13137 0.00219727 4.4 0.270826 4.4 0.602197V23.3978C4.4 23.7292 4.13137 23.9978 3.8 23.9978H2.6C2.26863 23.9978 2 23.7292 2 23.3978V0.602197C2 0.270826 2.26863 0.00219727 2.6 0.00219727H3.8Z" fill="white"/>\n </g>\n <defs>\n <clipPath id="clip0_20323_25783">\n <rect width="24" height="24" fill="white"/>\n </clipPath>\n </defs>\n </svg>\n ',class:"xg-icon-mprev"}}}},{key:"registerLanguageTexts",value:function(){return{musicPrev:{jp:"前の曲",en:"MusicPrev",zh:"上一首","zh-hk":"上一首"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.musicPrev)}},{key:"destroy",value:function(){var e=this;["click","touchstart"].forEach((function(t){e.unbind(t,e.onClick)}))}},{key:"render",value:function(){return'<xg-icon class="xgplayer-next">\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="musicPrev">'.concat(this.langText.musicPrev,"</div>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"musicprev"}},{key:"defaultConfig",get:function(){return{index:2,position:Plugin.POSITIONS.CONTROLS_LEFT}}}]),r}(Plugin);function forwardIcon(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M9.75215 0C13.6734 0 17.0541 2.3143 18.6029 5.65152L19.442 5.42701C19.6785 5.36365 19.9215 5.50398 19.9849 5.74046C20.0097 5.8331 20.0038 5.9313 19.9681 6.02031L18.8673 8.76283C18.7761 8.99003 18.518 9.10028 18.2908 9.00908C18.2518 8.99344 18.2152 8.97233 18.1822 8.94639L15.8576 7.12171C15.665 6.97055 15.6315 6.69189 15.7826 6.49932C15.8419 6.42387 15.9239 6.36967 16.0166 6.34485L16.8582 6.1196C15.5365 3.53919 12.8506 1.77312 9.75215 1.77312C5.34545 1.77312 1.77312 5.34545 1.77312 9.75215C1.77312 14.1589 5.34545 17.7312 9.75215 17.7312C13.5493 17.7312 16.727 15.0787 17.5334 11.5256L19.3435 11.5254C18.5096 16.0647 14.5325 19.5043 9.75215 19.5043C4.36619 19.5043 0 15.1381 0 9.75215C0 4.36619 4.36619 0 9.75215 0Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}var MusicForward=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(){var e;return _classCallCheck$5(this,r),(e=t.apply(this,arguments)).onClick=function(t){var r=_assertThisInitialized$5(e).player;t.preventDefault(),t.stopPropagation(),r.plugins.music.forward()},e}return _createClass$6(r,[{key:"afterCreate",value:function(){var e=this;this.initIcons();["click","touchstart"].forEach((function(t){e.bind(t,e.onClick)})),this.timeScaleDom=this.find(".xgplayer-timescale"),this.on(PluginEvents.TIME_SCALE_CHANGE,(function(t){e.timeScaleDom.innerHTML=t}))}},{key:"registerIcons",value:function(){return{musicForward:{icon:forwardIcon,class:"xg-icon-mforward"}}}},{key:"registerLanguageTexts",value:function(){return{forward:{jp:"早送り",en:"MusicForward",zh:"快进","zh-hk":"快進"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.musicForward)}},{key:"destroy",value:function(){var e=this;["click","touchstart"].forEach((function(t){e.unbind(t,e.onClick)}))}},{key:"render",value:function(){var e=this.player.plugins.music.config.timeScale||15;return'<xg-icon class="xgplayer-forward">\n <div class="xgplayer-icon">\n <span class="xgplayer-timescale">'.concat(e,'</span>\n </div>\n <div class="xg-tips" lang-key="forward">').concat(this.langText.forward,"</div>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"musicforward"}},{key:"defaultConfig",get:function(){return{index:5,position:Plugin.POSITIONS.CONTROLS_LEFT}}}]),r}(Plugin),MusicNext=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(){var e;return _classCallCheck$5(this,r),(e=t.apply(this,arguments)).onClick=function(t){var r=_assertThisInitialized$5(e).player;t.preventDefault(),t.stopPropagation(),r.plugins.music.next()},e}return _createClass$6(r,[{key:"afterCreate",value:function(){var e=this;this.initIcons();["click","touchstart"].forEach((function(t){e.bind(t,e.onClick)})),this.updateVisible(),this.on(PluginEvents.MUSIC_LIST_CHANGE,this.updateVisible.bind(this))}},{key:"updateVisible",value:function(){var e,t,r;(null===(e=this.player.plugins)||void 0===e||null===(t=e.music)||void 0===t||null===(r=t.list)||void 0===r?void 0:r.length)>1?this.show():this.hide()}},{key:"registerIcons",value:function(){return{musicNext:{icon:' <svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_20323_25776)">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.92 0.242135L18.32 11.0402C18.96 11.5201 18.96 12.4799 18.32 12.9598L3.92 23.7579C3.12892 24.3511 2 23.7867 2 22.798V1.20196C2 0.213286 3.12892 -0.35107 3.92 0.242135Z" fill="white"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M20.6 0.00219727C20.9314 0.00219727 21.2 0.270826 21.2 0.602197V23.3978C21.2 23.7292 20.9314 23.9978 20.6 23.9978H19.4C19.0687 23.9978 18.8 23.7292 18.8 23.3978V0.602197C18.8 0.270826 19.0687 0.00219727 19.4 0.00219727H20.6Z" fill="white"/>\n </g>\n <defs>\n <clipPath id="clip0_20323_25776">\n <rect width="24" height="24" fill="white"/>\n </clipPath>\n </defs>\n </svg>\n ',class:"xg-icon-mnext"}}}},{key:"registerLanguageTexts",value:function(){return{musicNext:{jp:"次の曲",en:"MusicNext",zh:"下一首","zh-hk":"下一首"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.musicNext)}},{key:"destroy",value:function(){var e=this;["click","touchstart"].forEach((function(t){e.unbind(t,e.onClick)}))}},{key:"render",value:function(){return'<xg-icon class="xgplayer-next">\n <div class="xgplayer-icon"></div>\n <div class="xg-tips" lang-key="musicNext">'.concat(this.langText.musicNext,"</div>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"musicnext"}},{key:"defaultConfig",get:function(){return{index:4,position:Plugin.POSITIONS.CONTROLS_LEFT}}}]),r}(Plugin),MusicMeta=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(){return _classCallCheck$5(this,r),t.apply(this,arguments)}return _createClass$6(r,[{key:"afterCreate",value:function(){var e=this;this.on(PluginEvents.MUSIC_CHANGE,(function(t){t&&t.title?e.root.innerHTML="".concat(t.title):e.root.innerHTML=""}))}},{key:"render",value:function(){var e=this.playerConfig;return'<xg-title class="xgplayer-name">\n '.concat(e.title||"","\n </xg-title>")}}],[{key:"pluginName",get:function(){return"musicmeta"}},{key:"defaultConfig",get:function(){return{index:0,position:Plugin.POSITIONS.CONTROLS_LEFT}}}]),r}(Plugin);function OrderSvg(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g clip-path="url(#clip0_20779_14791)">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M39 8C39.5523 8 40 8.44772 40 9V11C40 11.5523 39.5523 12 39 12H7C6.44772 12 6 11.5523 6 11V9C6 8.44772 6.44772 8 7 8H39ZM30 23C30 22.4477 29.5523 22 29 22H7C6.44772 22 6 22.4477 6 23V25C6 25.5523 6.44772 26 7 26H29C29.5523 26 30 25.5523 30 25V23ZM46.0725 31C46.0725 31.2113 46.0056 31.4173 45.8812 31.5882L39.845 39.888C39.5202 40.3346 38.8948 40.4334 38.4481 40.1086C38.3635 40.047 38.2891 39.9726 38.2275 39.888L32.1913 31.5882C31.8665 31.1415 31.9652 30.5161 32.4119 30.1913C32.5828 30.067 32.7887 30 33 30H37V19.5C37 19.2239 37.2239 19 37.5 19H40.5C40.7761 19 41 19.2239 41 19.5V30H45.0725C45.6248 30 46.0725 30.4477 46.0725 31ZM29 36C29.5523 36 30 36.4477 30 37V39C30 39.5523 29.5523 40 29 40H7C6.44772 40 6 39.5523 6 39V37C6 36.4477 6.44772 36 7 36H29Z" fill="white"/>\n</g>\n<defs>\n<clipPath id="clip0_20779_14791">\n<rect width="48" height="48" fill="white"/>\n</clipPath>\n</defs>\n</svg>\n',"image/svg+xml").firstChild}function LoopSvg(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g clip-path="url(#clip0_20731_14771)">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M42.0018 23V29.024C42.0018 34.569 37.5247 39.064 32.0018 39.064H17.9999V42.6585C17.9999 43.2108 17.5522 43.6585 16.9999 43.6585C16.7991 43.6585 16.603 43.598 16.437 43.485L8.20729 37.8803C7.75081 37.5694 7.63278 36.9473 7.94366 36.4908C8.01331 36.3886 8.10134 36.3001 8.20327 36.23L16.433 30.5662C16.888 30.2531 17.5106 30.3681 17.8237 30.8231C17.9385 30.9899 17.9999 31.1875 17.9999 31.39V35.048H32.0018C35.3155 35.048 38.0018 32.351 38.0018 29.024V23H42.0018ZM31.0019 5.89087C31.2027 5.89087 31.3988 5.95132 31.5648 6.06434L39.7945 11.6691C40.251 11.98 40.369 12.602 40.0582 13.0585C39.9885 13.1608 39.9005 13.2492 39.7986 13.3194L31.5688 18.9831C31.1139 19.2962 30.4912 19.1812 30.1781 18.7263C30.0633 18.5595 30.0019 18.3618 30.0019 18.1593V14.5013H16C12.6863 14.5013 10 17.1984 10 20.5254V26.5494H6V20.5254C6 14.9804 10.4772 10.4853 16 10.4853H30.0019V6.89087C30.0019 6.33858 30.4496 5.89087 31.0019 5.89087Z" fill="white"/>\n</g>\n<defs>\n<clipPath id="clip0_20731_14771">\n<rect width="48" height="48" fill="white"/>\n</clipPath>\n</defs>\n</svg>\n',"image/svg+xml").firstChild}function RandomSvg(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g clip-path="url(#clip0_20731_14777)">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M35.0194 27.9598C35.2314 27.9598 35.4379 28.0272 35.6091 28.1522L41.8863 32.736C42.3323 33.0617 42.4298 33.6873 42.1041 34.1333C42.0419 34.2186 41.9665 34.2934 41.8809 34.3551L35.6037 38.875C35.1556 39.1977 34.5306 39.096 34.2079 38.6478C34.0853 38.4776 34.0194 38.2732 34.0194 38.0635V35.5556C30.1354 35.5195 27.7656 34.3892 25.642 31.7548C26.4304 30.621 27.1705 29.3627 27.8834 27.9788C29.5719 30.6143 31.112 31.5275 34.0194 31.5546V28.9598C34.0194 28.4075 34.4671 27.9598 35.0194 27.9598ZM35.0112 7.94434C35.2205 7.94434 35.4246 8.01001 35.5946 8.13211L41.8792 12.6458C42.3278 12.968 42.4303 13.5928 42.1081 14.0414C42.0464 14.1273 41.9715 14.2028 41.8861 14.2652L35.6015 18.8607C35.1557 19.1867 34.53 19.0895 34.204 18.6437C34.0787 18.4724 34.0112 18.2657 34.0112 18.0535V15.4606C29.9521 15.4984 28.443 17.234 25.7897 23.0253C25.4916 23.6778 25.333 24.0244 25.1845 24.3452C21.6243 32.0396 17.983 35.4364 10.0186 35.5591H6V31.5394L9.98762 31.5397C16.0421 31.4462 18.5555 29.1016 21.5376 22.6568C21.6818 22.3451 21.8361 22.0079 22.1364 21.3507C25.3774 14.2767 27.8951 11.4978 34.0112 11.4409V8.94434C34.0112 8.39205 34.4589 7.94434 35.0112 7.94434ZM10.0186 11.4409C14.8213 11.5149 18.0519 12.7794 20.6407 15.459C19.9655 16.6111 19.3108 17.8933 18.6522 19.3098C16.5567 16.6161 14.0817 15.5236 9.98762 15.4604L6 15.4606V11.4409H10.0186Z" fill="white"/>\n</g>\n<defs>\n<clipPath id="clip0_20731_14777">\n<rect width="48" height="48" fill="white"/>\n</clipPath>\n</defs>\n</svg>\n',"image/svg+xml").firstChild}function SloopSvg(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g clip-path="url(#clip0_20731_14784)">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M42.0018 22.1091V28.1331C42.0018 33.6781 37.5247 38.1732 32.0018 38.1732H17.9999V41.7676C17.9999 42.3199 17.5522 42.7676 16.9999 42.7676C16.7991 42.7676 16.603 42.7072 16.437 42.5941L8.20729 36.9894C7.75081 36.6785 7.63278 36.0564 7.94366 35.6C8.01331 35.4977 8.10134 35.4092 8.20327 35.3391L16.433 29.6754C16.888 29.3623 17.5106 29.4773 17.8237 29.9322C17.9385 30.099 17.9999 30.2967 17.9999 30.4991V34.1572H32.0018C35.3155 34.1572 38.0018 31.4601 38.0018 28.1331V22.1091H42.0018ZM26.05 18V29.664H23.19V21.08L21 22.852V19.772L23.19 18H26.05ZM31.0019 5C31.2027 5 31.3988 5.06045 31.5648 5.17347L39.7945 10.7782C40.251 11.0891 40.369 11.7112 40.0582 12.1677C39.9885 12.2699 39.9005 12.3584 39.7986 12.4285L31.5688 18.0922C31.1139 18.4054 30.4912 18.2904 30.1781 17.8354C30.0633 17.6686 30.0019 17.4709 30.0019 17.2685V13.6105H16C12.6863 13.6105 10 16.3075 10 19.6345V25.6585H6V19.6345C6 14.0895 10.4772 9.59443 16 9.59443H30.0019V6C30.0019 5.44772 30.4496 5 31.0019 5Z" fill="white"/>\n</g>\n<defs>\n<clipPath id="clip0_20731_14784">\n<rect width="48" height="48" fill="white"/>\n</clipPath>\n</defs>\n</svg>\n',"image/svg+xml").firstChild}var MusicMode=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(){return _classCallCheck$5(this,r),t.apply(this,arguments)}return _createClass$6(r,[{key:"afterCreate",value:function(){var e,t,n,i=this;if(_get$3(_getPrototypeOf$5(r.prototype),"afterCreate",this).call(this),this.player.plugins.music&&!this.config.disable){this.initIcons(),this.btnClick=this.btnClick.bind(this),this.bind(["touchend","click"],this.btnClick),this.on(PluginEvents.MUSIC_MODE_CHANGE,(function(e){i.animate(e)}));var o=null===(e=this.player.plugins)||void 0===e||null===(t=e.music)||void 0===t||null===(n=t.config)||void 0===n?void 0:n.mode;this.animate(o),this.updateVisible(),this.on(PluginEvents.MUSIC_LIST_CHANGE,this.updateVisible.bind(this))}}},{key:"updateVisible",value:function(){var e,t,r;(null===(e=this.player.plugins)||void 0===e||null===(t=e.music)||void 0===t||null===(r=t.list)||void 0===r?void 0:r.length)>1?this.show():this.hide()}},{key:"registerIcons",value:function(){return{order:{icon:OrderSvg,class:"xg-icon-order"},loop:{icon:LoopSvg,class:"xg-icon-loop"},sloop:{icon:SloopSvg,class:"xg-icon-sloop"},random:{icon:RandomSvg,class:"xg-icon-random"}}}},{key:"registerLanguageTexts",value:function(){return{order:{jp:"順番に遊ぶ",en:"Play in order",zh:"顺序播放","zh-hk":"順序播放"},loop:{jp:"リストループ",en:"List loop",zh:"列表循环","zh-hk":"列表循環"},sloop:{jp:"シングルサイクル",en:"Single loop",zh:"单曲循环","zh-hk":"單曲循環"},random:{jp:"シャッフル再生",en:"Play in shuffle",zh:"随机播放","zh-hk":"隨機播放"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.order),this.appendChild(".xgplayer-icon",e.sloop),this.appendChild(".xgplayer-icon",e.loop),this.appendChild(".xgplayer-icon",e.random)}},{key:"btnClick",value:function(e){var t,r,n;e.preventDefault(),e.stopPropagation();var i=null===(t=this.player.plugins)||void 0===t||null===(r=t.music)||void 0===r||null===(n=r.config)||void 0===n?void 0:n.mode,o=Music.ModeType.findIndex((function(e){return e===i})),a=0;o+1<Music.ModeType.length&&(a=o+1),this.player.plugins.music.mode=Music.ModeType[a]}},{key:"animate",value:function(e){switch(e){case PLAY_MODES.ORDER:this.setAttr("data-state","order"),this.changeLangTextKey(this.find(".xg-tips"),"order");break;case PLAY_MODES.LOOP:this.setAttr("data-state","loop"),this.changeLangTextKey(this.find(".xg-tips"),"loop");break;case PLAY_MODES.SLOOP:this.setAttr("data-state","sloop"),this.changeLangTextKey(this.find(".xg-tips"),"sloop");break;case PLAY_MODES.RANDOM:this.setAttr("data-state","random"),this.changeLangTextKey(this.find(".xg-tips"),"random");break;default:this.setAttr("data-state","order"),this.changeLangTextKey(this.find(".xg-tips"),"order")}}},{key:"destroy",value:function(){this.unbind(["touchend","click"],this.btnClick)}},{key:"render",value:function(){return'\n <xg-icon class="xgplayer-music-mode">\n <div class="xgplayer-icon"></div>\n <div class="xg-tips" lang-key="musicMode">'.concat(this.langText.order,"</div>\n </xg-icon>\n ")}}],[{key:"pluginName",get:function(){return"MusicMode"}},{key:"defaultConfig",get:function(){return{position:Plugin.POSITIONS.CONTROLS_RIGHT,index:9,disable:!1}}}]),r}(Plugin);function musicPlaySVG(){return(new DOMParser).parseFromString('<svg width="30" height="30" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g clip-path="url(#clip0_20323_25753)">\n<g filter="url(#filter0_d_20323_25753)">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M25 0C38.8071 0 50 11.1929 50 25C50 38.8071 38.8071 50 25 50C11.1929 50 0 38.8071 0 25C0 11.1929 11.1929 0 25 0Z" fill="#1664FF"/>\n</g>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M19.3863 11.7091L37.5681 23.0728C38.9924 23.9629 38.9924 26.0372 37.5681 26.9273L19.3863 38.2909C17.8726 39.237 15.9091 38.1488 15.9091 36.3637V13.6364C15.9091 11.8513 17.8726 10.763 19.3863 11.7091Z" fill="white"/>\n</g>\n<defs>\n<filter id="filter0_d_20323_25753" x="-8" y="-6" width="66" height="66" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">\n<feFlood flood-opacity="0" result="BackgroundImageFix"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dy="2"/>\n<feGaussianBlur stdDeviation="4"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>\n<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_20323_25753"/>\n<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_20323_25753" result="shape"/>\n</filter>\n<clipPath id="clip0_20323_25753">\n<rect width="50" height="50" fill="white"/>\n</clipPath>\n</defs>\n</svg>\n',"image/svg+xml").firstChild}function musicPauseSVG(){return(new DOMParser).parseFromString('<svg width="30" height="30" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g clip-path="url(#clip0_20330_26170)">\n<g filter="url(#filter0_d_20330_26170)">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M25 0C38.8071 0 50 11.1929 50 25C50 38.8071 38.8071 50 25 50C11.1929 50 0 38.8071 0 25C0 11.1929 11.1929 0 25 0Z" fill="#1664FF"/>\n</g>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M20.75 11C21.4404 11 22 11.6044 22 12.35V36.65C22 37.3956 21.4404 38 20.75 38H18.25C17.5596 38 17 37.3956 17 36.65V12.35C17 11.6044 17.5596 11 18.25 11H20.75Z" fill="white"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M31.75 11C32.4404 11 33 11.6044 33 12.35V36.65C33 37.3956 32.4404 38 31.75 38H29.25C28.5596 38 28 37.3956 28 36.65V12.35C28 11.6044 28.5596 11 29.25 11H31.75Z" fill="white"/>\n</g>\n<defs>\n<filter id="filter0_d_20330_26170" x="-8" y="-6" width="66" height="66" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">\n<feFlood flood-opacity="0" result="BackgroundImageFix"/>\n<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>\n<feOffset dy="2"/>\n<feGaussianBlur stdDeviation="4"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>\n<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_20330_26170"/>\n<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_20330_26170" result="shape"/>\n</filter>\n<clipPath id="clip0_20330_26170">\n<rect width="50" height="50" fill="white"/>\n</clipPath>\n</defs>\n</svg>\n',"image/svg+xml").firstChild}var index$2="";function initMusicConfig(e){if("Object"!==util.typeOf(e.controls))e.controls={mode:"flex",initShow:!0};else{var t=e.controls;e.controls=_objectSpread2$5({mode:"flex",initShow:!0},t)}var r=e.play||{};e.play=_objectSpread2$5({index:3},r),e.marginControls=!0,e.icons=_objectSpread2$5({play:musicPlaySVG,pause:musicPauseSVG},e.icons||{})}var MusicPreset=_createClass$6((function e(t,r){_classCallCheck$5(this,e),initMusicConfig(r);var n="mobile"===sniffer$1.device;this.plugins=[Music,MusicMeta,MusicCover].concat(_toConsumableArray$1(n?[]:[MusicBackward,MusicPrev,MusicForward,MusicNext,MusicMode])),this.ignores=["start","cssFullScreen","fullscreen","pip","enter","replay","pc","loading","poster","error","playbackrate","mobile"]})),index_min="";window&&!window.Player&&(window.Player=PresetPlayer);var VePlayer=function(){function e(t){_classCallCheck$5(this,e),this.player=null,this.mountingDom=null,this.playerContainer=null,this.mobilePanel=null,this._isFirstCreated=!0,this.sdkPlugins=[],this._sdkPlugins={},this.delayError=[],this.isFirstEmitted=!0,this._init(t)}var t,r,n,i,o,a;return _createClass$6(e,[{key:"_init",value:function(e){this.initUmdLoader(e),this.playerData=new PlayerData(e),this._emitter=new EventEmitter,this.on(SDKEvents.TOKEN_EXPIRED,this.onTokenExpiredAction.bind(this)),this._initSdkPlugins(),this.renderDom(),this.createPlayer(),this._initI18N(this.playerData.languageData)}},{key:"_initSdkPlugins",value:function(){var e=this;sdkPluginManager.init(this),_toConsumableArray$1(this.sdkPlugins).map((function(t){return sdkPluginManager.registerPlugin(t,e)}))}},{key:"initCheckExpire",value:function(){var e=this;this.checkExpireTimer=new IntervalTimer,this.checkExpireTimer.repeat((function(){e.onRepeat()}),this.playerData.checkExpireInterval)}},{key:"initUmdLoader",value:function(e){var t=this;this.sdkUmdLoader=sdkUmdLoader,this.sdkUmdLoader.failCallback=function(e,r){return t.umdLoadErr(e,r)},e.umdUrlMap&&"object"===_typeof$4(e.umdUrlMap)&&this.sdkUmdLoader.updateBackupMap(e.umdUrlMap)}},{key:"umdLoadErr",value:function(e,t){this.emit(SDKEvents.UMD_LOAD_FAIL,{name:e,error:t})}},{key:"onRepeat",value:function(){var e,t=this,r=this.playerData.expireDetectType;r.indexOf("getUrlTime")>-1&&(this.getUrlTime&&null!==(e=this.player)&&void 0!==e&&e.duration&&(new Date).getTime()/1e3>this.getUrlTime+3300+this.player.duration+500&&(this.getUrlTime=0,this.emitExpireEvent()));r.indexOf("xhrStatus")>-1&&this._playOriginalUrl&&Math.random()<1/7.5&&new XHR({url:this._playOriginalUrl,method:"HEAD"}).catch((function(e){e&&void 0!==e.status&&(t.isFirstEmitted?(t.emitExpireEvent(),t.isFirstEmitted=!1):(t.expireCount=void 0===t.expireCount?1:t.expireCount+1,t.expireCount>3&&(t.expireCount=0,t.emitExpireEvent())))}))}},{key:"emitExpireEvent",value:function(){var e=this.player,t=(new Date).getTime()/1e3;e.emitExpireTimestamp?t-e.emitExpireTimestamp>MIN_EXPIRE_INTERVAL&&(e.emitExpireTimestamp=t,e.emit("MEDIA_EXPIRED")):(e.emitExpireTimestamp=t,e.emit("MEDIA_EXPIRED"))}},{key:"getUrlTimestamp",value:function(e){if(e){var t;e.startsWith("//")&&(e=location.protocol+e);try{var r,n=_createForOfIteratorHelper$1(new URL(e).searchParams);try{for(n.s();!(r=n.n()).done;){var i=_slicedToArray(r.value,2),o=i[0],a=i[1];if("auth_key"===o||"sign"===o){var s=parseInt(a.split("-")[0]);if(!isNaN(s)){t=s;break}}}}catch(h){n.e(h)}finally{n.f()}}catch(h){console.error(h)}try{var l,c=null===(l=new URL(e).pathname.split("/"))||void 0===l?void 0:l[2];if(c){var u=parseInt(c,16);isNaN(u)||(t=u)}}catch(h){console.error(h)}this.getUrlTime=t||(new Date).getTime()/1e3}}},{key:"on",value:function(e,t){this._emitter.on(e,t)}},{key:"emit",value:function(e,t){this._emitter.emit(e,t)}},{key:"once",value:function(e,t){this._emitter.once(e,t)}},{key:"off",value:function(e,t){this._emitter.off(e,t)}},{key:"renderDom",value:function(){var e=this.playerData,t=e.id,r=e.root,n=document.createElement("div");this.playerContainer=n;var i=r||document.querySelector("#".concat(t));i&&(i.appendChild(n),this.mountingDom=i)}},{key:"renderPoster",value:function(){if(this.playerContainer){var e=this.playerData.options,t=e.poster,r=void 0===t?"":t,n=e.width,i=e.height;r&&(this.playerContainer.style.cssText='background: url("'.concat(r,'");\n background-size: cover;\n width:').concat(n?n+"px":"100%",";\n height:").concat(i?i+"px":"100%",";\n "))}}},{key:"createPlayer",value:(a=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(){var t,r,n,i,o,a,s,l,c,u,h,d,p,f,g,y,v,m,_,b,T,E,S,$,C,w,P,k,O,I,A,R,x,D=this;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._destroyPlayer();case 2:return e.next=4,this.beforePlayerCreate();case 4:return a=this.playerData,s=a.isLive,l=a.options,c=a.plugins,u=a.isMobile,h=a.openSoftDecoding,d=a.configs,p=a.isMusic,f=this.playerData.getCurrentUrl(),g=this.playerData.getCurrentStreamType()||getFormat(null==d?void 0:d.getVideoByToken),getPluginConfig(d,"EncryptHlsPlugin")||f&&g||p?(this._playOriginalUrl=f,this.getUrlTimestamp(f)):(console.warn("url is empty or streamType is empty: url:".concat(f,", streamType").concat(g)),this.renderPoster()),y={defaultDefinition:null===(t=this.playerData.playList[0])||void 0===t?void 0:t.definition,list:this.playerData.playList},v=function(){var e=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,D.getSoftDecodingOption(h,f,g);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.next=13,createSDKPreset({isLive:s,isMobile:u,type:g,playerData:this.playerData,getSoftOptionTask:v});case 13:return m=e.sent,_=m.presets,b=m.softDecodingOption,T=m.plugins,E=u?createPlayerOption(s):createPlayerOption$1(s),S=this._analyzeExtendPlugins(),$=S.basicPlugins,C=void 0===$?[]:$,w=S.iconPlugins,P=void 0===w?[]:w,k=this.playerData.getLineList(),O=this.playerData.current.lineId,I=this.playerData.getDefinitionListByLineId(O),A=_objectSpread2$5(_objectSpread2$5(_objectSpread2$5(_objectSpread2$5({},E),l),b||{}),{},{definition:y,icons:_objectSpread2$5(_objectSpread2$5(_objectSpread2$5({},E.icons),p?{play:musicPlaySVG,pause:musicPauseSVG}:{}),null!==(r=null==l?void 0:l.icons)&&void 0!==r?r:{}),MoreButtonPlugin:{iconPlugins:[].concat(_toConsumableArray$1(null!==(n=null===(i=l.MoreButtonPlugin)||void 0===i?void 0:i.iconPlugins)&&void 0!==n?n:[]),_toConsumableArray$1(P),[PlaybackRateMobilePlugin])},playerData:this.playerData}),k.length>1&&A.MoreButtonPlugin.iconPlugins.push(LineMobilePlugin),I.length>1&&A.MoreButtonPlugin.iconPlugins.push(DefinitionMobilePlugin),this.setDefaultConfigOptions(A),R=[].concat(_toConsumableArray$1(C),_toConsumableArray$1(c),_toConsumableArray$1(T)),A.ignores=[].concat(_toConsumableArray$1(null!==(o=null==A?void 0:A.ignores)&&void 0!==o?o:[]),_toConsumableArray$1(p?["sdkErrorPlugin","sdkToastPlugin","MoreButtonPlugin","DanmuPlugin"]:[])),this._isFirstCreated?this._isFirstCreated=!1:(A.autoplayMuted=!1,A.ignores=[].concat(_toConsumableArray$1(null!==(x=null==A?void 0:A.ignores)&&void 0!==x?x:[]),["sdkUnmutePlugin"])),this.setPluginConfig(A),this.player=new PresetPlayer(_objectSpread2$5(_objectSpread2$5(p?{el:this.playerContainer,controls:{mode:"flex",initShow:!0},marginControls:!0,presets:[].concat(_toConsumableArray$1(_),[MusicPreset]),mediaType:["mp4","hls"].includes(g)?"video":"audio",url:f}:{el:this.playerContainer,presets:_,url:f,isLive:s},A),{},{plugins:_toConsumableArray$1(R)})),this.player.playerData=this.playerData,this._emitter.emit(SDKEvents.PLAYER_CREATED_FINISH),this.afterPlayerCreate(),e.abrupt("return",this.player);case 35:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"setPluginConfig",value:function(e){var t,r=this.playerData,n=r.apiMap,i=r.configs,o=r.unionInfo,a=r.playList,s=this.playerData.getCurrentStreamType()||getFormat(null==i?void 0:i.getVideoByToken),l=getPluginConfig(i,"EncryptHlsPlugin"),c=getPluginConfig(i,"Mp4EncryptPlayer"),u=getPluginConfig(i,"DASHPlugin"),h=getPluginConfig(i,"vodLogOpts"),d=!(null==a||null===(t=a[0])||void 0===t||!t.kid)||!!l;l&&(e.EncryptHlsPlugin=_objectSpread2$5({playDomain:n.playDomain,getKeyType:"TOP"},l)),c&&(e.Mp4EncryptPlayer=_objectSpread2$5({playDomain:n.playDomain,getKeyType:"TOP"},c)),u&&(e.DASHPlugin=_objectSpread2$5({playDomain:n.playDomain,getKeyType:"TOP"},u)),i.privateDrmAuthToken&&i.kid&&o&&("hls"===s?e.EncryptHlsPlugin=_objectSpread2$5({kid:i.kid,drmKeyToken:i.privateDrmAuthToken,playDomain:n.playDomain},l||{}):"dash"===s?e.DASHPlugin=_objectSpread2$5({kid:i.kid,drmKeyToken:i.privateDrmAuthToken,playDomain:n.playDomain},u||{}):"mp4"===s&&(e.Mp4EncryptPlayer=_objectSpread2$5({kid:i.kid,drmKeyToken:i.privateDrmAuthToken,playDomain:n.playDomain},c||{}))),h&&(e.vodLogOpts=_objectSpread2$5({vtype:(s||"mp4").toUpperCase(),drm_type:d?1:0,playerVersion:pkgJson.version,channel:"sg"},h))}},{key:"detectCodec",value:(o=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(t){var r,n,i,o,a;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,sdkUmdLoader.loadPlugins("streamprobe");case 3:if(e.t0=e.sent,e.t0){e.next=6;break}e.t0={};case 6:if(r=e.t0,!(n=r.LoadProbe)){e.next=14;break}return e.next=11,null===(i=new n)||void 0===i?void 0:i.parseUrl(t);case 11:o=e.sent,"bytevc1"===(a=(o||{}).codec)?this.playerData.codec=CodecType.H265:"avc"===a&&(this.playerData.codec=CodecType.H264);case 14:e.next=19;break;case 16:e.prev=16,e.t1=e.catch(0),console.warn("detect codec error: ",e.t1);case 19:case"end":return e.stop()}}),e,this,[[0,16]])}))),function(e){return o.apply(this,arguments)})},{key:"setDefaultConfigOptions",value:function(e){if(this._isFirstCreated){var t=this.playerData,r=t.defaultConfig,n=t.isHitDefault;if(r){var i=null!=r?r:{},o=i.volume,a=i.startTime,s=i.DanmuPlugin,l=i.LiveSubtitlesIconPlugin;if(o&&(e.volume=e.volume?_objectSpread2$5(_objectSpread2$5({},e.volume),{},{default:o}):o),n){var c,u;if(a&&(e.startTime=a),s)e.DanmuPlugin=_objectSpread2$5(_objectSpread2$5({},null!==(c=e.DanmuPlugin)&&void 0!==c?c:{}),s);if(l)e.LiveSubtitlesIconPlugin=_objectSpread2$5(_objectSpread2$5({},null!==(u=e.LiveSubtitlesIconPlugin)&&void 0!==u?u:{}),l)}}}}},{key:"getCurrentPlayerConfig",value:function(){var e,t,r=this.playerData,n=r.isLive,i=r.current,o=i.lineId,a={type:n?"live":"vod",isLive:n,definition:i.definition,lineId:o,volume:null!==(e=this.player.volume)&&void 0!==e?e:.6};n||(a.startTime=null!==(t=this.player.currentTime)&&void 0!==t?t:0);return _objectSpread2$5({},a)}},{key:"_analyzeExtendPlugins",value:function(){var e,t=this.playerData.options,r=t.extendPlugin||[],n=null!==(e=null==t?void 0:t.ignore)&&void 0!==e?e:[],i=[],o=[];return r.forEach((function(e){var t=extendPlugin(e);"inner"!==t.type||n[e.pluginName]?i.push(t):o.push(t)})),{basicPlugins:i,iconPlugins:o}}},{key:"beforePlayerCreate",value:(i=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,sdkPluginManager.beforePlayerCreate(this);case 2:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"afterPlayerCreate",value:function(){var e=this.playerData.isMobile;this._mountingPlayerPanel(e),this._mountingExtendMethods(),this._bindSdkEvents(),this._bindPlayerEvents(),this._setPlayerInfo(),sdkPluginManager.afterPlayerCreate(this),this.emitDelayError()}},{key:"emitDelayError",value:function(){var e=this;setTimeout((function(){e.player&&e.delayError.forEach((function(t){var r=new Errors(e.player,t);e.player.emit("error",r)})),e.delayError=[]}),0)}},{key:"_setPlayerInfo",value:function(){var e,t;if(this.player){this.player.playerVersion=pkgJson.version;var r=this.playerData.getCurrentStreamType()||getFormat(null===(e=this.playerData)||void 0===e||null===(t=e.configs)||void 0===t?void 0:t.getVideoByToken);this.player.playerType||(this.player.playerType=r)}}},{key:"_mountingPlayerPanel",value:function(e){var t,r=this.playerData,n=r.options,i=r.isLive;this.player&&e&&(this.mobilePanel=new MobilePlayerPanel({config:null!==(t=n.panel)&&void 0!==t?t:{mode:i?PLAYER_MODE.INNER:PLAYER_MODE.NORMAL,isAutoChange:!0},root:this.player.root,player:this.player}),this.player.panel=this.mobilePanel)}},{key:"_bindPlayerEvents",value:function(){this.player&&(this.player.on(SDKEvents.PLAYER_REBUILD,this.createPlayer.bind(this)),this.player.on(PluginEvents.MEDIA_EXPIRED,this.onMediaExpiredAction.bind(this)),this.player.once(COMPLETE,this.emitDelayError.bind(this)))}},{key:"onMediaExpiredAction",value:function(){var e,t,r=this;if(null!==(e=this.playerData)&&void 0!==e&&e.onMediaExpired&&"function"==typeof(null===(t=this.playerData)||void 0===t?void 0:t.onMediaExpired)){var n=retPromise$1(this.playerData.onMediaExpired());null!=n&&n.then&&n.then((function(e){return r.playNext(e)}))}}},{key:"onTokenExpiredAction",value:function(){var e,t,r=this;if(null!==(e=this.playerData)&&void 0!==e&&e.onTokenExpired&&"function"==typeof(null===(t=this.playerData)||void 0===t?void 0:t.onTokenExpired)){var n=retPromise$1(this.playerData.onTokenExpired());null!=n&&n.then&&n.then((function(e){return r.updateAuthToken(e)}))}}},{key:"_bindSdkEvents",value:function(){var e=this;[].concat(_toConsumableArray$1(Object.values(PluginEvents)),_toConsumableArray$1(Object.values(SDKEvents)),_toConsumableArray$1(Object.values(Events))).forEach((function(t){"string"==typeof t&&e.player.on(t,(function(){for(var r,n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];(r=e._emitter).emit.apply(r,[t].concat(i))}))}))}},{key:"_mountingExtendMethods",value:function(){this.player&&(this.player.changePluginsIcon=this.changePluginsIcon.bind(this))}},{key:"_offPlayerEvents",value:function(){this.player&&this.player.off(SDKEvents.PLAYER_REBUILD,this.createPlayer.bind(this))}},{key:"changePluginsIcon",value:function(e,t){var r;if(this.player){var n=this.player.getPlugin(e);if(n&&null!=n&&n.root){var i=util.hasClass(null==n?void 0:n.parent,"panel-icon-svg")?null==n||null===(r=n.parent)||void 0===r?void 0:r.parentNode:null==n?void 0:n.root;i&&(t?util.show(i,"block"):util.hide(i))}}}},{key:"getSdkPlugin",value:function(e){var t=this._sdkPlugins[e.toLowerCase()];return t&&t.pluginName?t:null}},{key:"switchAuthToken",value:function(e){var t=this,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=r?0:this.player.currentTime,i=this.getSdkPlugin("AuthToken"),o=this.player.paused&&!this.player.isError,a=this.player.state,s=this.player.getPlugin("sdkDefinitionPlugin");return s&&(s.canChange=!1),new Promise((function(r,l){i?i.switchAuthToken(e).then((function(){var e,i=t.playerData.getCurrentUrl();t._playOriginalUrl=i;var c={defaultDefinition:null===(e=t.playerData.playList[0])||void 0===e?void 0:e.definition,list:t.playerData.playList};if(s&&(s.config=s.getConfig(t.player),s.renderItemList(),s.canChange=!0),t.player){var u=_objectSpread2$5(_objectSpread2$5({},t.playerData.options),{},{definition:c,startTime:n,url:i});if(t.player.playNext(u),6===a)t.player.once(CANPLAY,(function(){o&&t.player.pause(),r()}));else{var h=u.autoplay||u.autoplayMuted;t.player.once(CANPLAY,(function(){h?t.player.play():t.player.pause(),r()}))}}else console.error("no player created"),l()})):(console.error("current is not playAuthToken play"),l())}))}},{key:"updateAuthToken",value:function(e){var t=this,r=this.player.config,n=this.getSdkPlugin("AuthToken");return new Promise((function(i,o){n?n.switchAuthToken(e).then((function(){var e=t.playerData.getCurrentUrl();if(t._playOriginalUrl=e,t.getUrlTimestamp(e),t.player){t.player.resetState(),t.player.setConfig(_objectSpread2$5(_objectSpread2$5(_objectSpread2$5({},r),t.playerData.options),{},{url:e}));var n=t.player.start(e);n&&n.then?n.then((function(){return i()})):i()}else console.error("player not created"),o()})):(console.error("current is not playAuthToken play"),o())}))}},{key:"src",get:function(){var e;return null===(e=this.player)||void 0===e?void 0:e.src},set:function(e){this.player&&(this.player.src=e)}},{key:"switchURL",value:function(e){var t=this;this.resetUrlState(e);var r=this.player.switchURL(e,!1),n=this.player.currentTime;return r&&r.then?r:new Promise((function(e){var r=t.player.paused&&!t.player.isError,i=function(){t.player.currentTime=n,r&&t.player.once(CANPLAY,(function(){t.player.pause()})),e()};sniffer$1.os.isAndroid?t.once("timeupdate",(function(){i()})):t.once(CANPLAY,(function(){i()})),t.player.play()}))}},{key:"next",value:function(e){var t,r=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=n?0:this.player.currentTime,o=this.playerData.configs,a=_objectSpread2$5(_objectSpread2$5({},o),{},{startTime:i,autoplay:!0},e);return null!=e&&null!==(t=e.getVideoByToken)&&void 0!==t&&t.playAuthToken&&(a.streamType=getFormat(null==e?void 0:e.getVideoByToken)||"mp4"),this.destroy().then((function(){return r._init(a)})).catch((function(e){console.error("next_error",e)}))}},{key:"playNext",value:function(e){var t,r,n=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return Promise.reject();var o=e.url,a=e.getVideoByToken,s=!(null===(t=this.player)||void 0===t||null===(r=t.plugins)||void 0===r||!r.dashplugin),l=this.player.paused&&!this.player.isError,c=i?0:this.player.currentTime;if(o){this.resetUrlState(o);var u=this.player.config,h=this.player.state,d=_objectSpread2$5(_objectSpread2$5({},u),{},{startTime:c},e);return this.setPluginConfig(d),this.player.playNext(d),new Promise((function(e,t){if(n.player.once(ERROR$3,(function(e){t(e)})),6===h)n.player.once(EMPTIED,(function(){n.player.once(CANPLAY,(function(){l&&n.player.pause(),e(void 0)}))}));else{var r=d.autoplay||d.autoplayMuted;n.player.once(EMPTIED,(function(){n.player.once(CANPLAY,(function(){r?n.player.play():n.player.pause(),e(void 0)}))}))}}))}if(null!=a&&a.playAuthToken){var p,f=this.playerData.getCurrentStreamType()||getFormat(null===(p=this.playerData.configs)||void 0===p?void 0:p.getVideoByToken),g=e.streamType||getFormat(null==e?void 0:e.getVideoByToken)||"mp4";return f!==g?this.next(e,i):s?dist.url(null==a?void 0:a.playAuthToken,this.playerData.apiMap.playDomain).then((function(e){var t=getPluginConfig(n.player.config,"DASHPlugin");t.dashOpts={Data:e},n.player.plugins.dashplugin.next(n.player.currentTime,"MEDIA_EXPIRED",t,!0)})):this.switchAuthToken(a,i)}return this.next(e,i)}},{key:"resetUrlState",value:function(e){this.playerData.playList=[],this.playerData.initPlayData(_objectSpread2$5(_objectSpread2$5({},this.playerData.configs),{},{url:e})),this._playOriginalUrl=e,this.getUrlTimestamp(e)}},{key:"_destroyPlayer",value:(n=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(){var t,r;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._offPlayerEvents(),e.next=3,null===(t=this.mobilePanel)||void 0===t?void 0:t.destroy();case 3:return e.next=5,null===(r=this.player)||void 0===r?void 0:r.destroy();case 5:this.player=null;case 6:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"getPlayerInstance",value:function(){return this.player}},{key:"getSoftDecodingOption",value:(r=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(t,r,n){var i,o,a,s,l,c,u,h,d,p,f,g;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=this.playerData,a=o.enableH265Degrade,s=o.codec,l=o.configs,c=isEncryptPlay(null==l?void 0:l.getVideoByToken),u=!!(l.enableMp4MSE||getPluginConfig(this.playerData.options,"Mp4EncryptPlayer")||"mp4"===n&&(c||null!=l&&null!==(i=l.autoBitrateOpts)&&void 0!==i&&i.isOpenAutoDefi)),!t){e.next=20;break}return e.next=6,sdkUmdLoader.loadPlugins("XGVideo");case 6:if(!(null==(h=e.sent)?void 0:h.isSupported())){e.next=14;break}return s&&h.setDecodeCapacity({preloadDecoder:this.playerData.codec,wasmFallbackToAsm:!1,reuseWasmDecoder:!1,disabledWhenErrorOccur:!1}),this.setH265SoftPlayList(),e.abrupt("return",{mediaType:u?this.playerData.isCurrentH265()?"xg-video":"video":"xg-video",innerDegrade:1,codecType:null!=s?s:"h264"});case 14:this.emit(SDKEvents.NOT_SUPPORT_SOFT_DECODER),d={errorType:"decoder",errorCode:3,errorMessage:"soft decode is not support by current browser",ext:{},originError:void 0},this.delayError.push(d),console.error("soft decode is not support by current browser");case 18:e.next=46;break;case 20:if(!a||s){e.next=23;break}return e.next=23,this.detectCodec(r);case 23:if(!this.playerData.isCurrentH265()||isHevcSupported()){e.next=46;break}if(!a){e.next=42;break}return e.next=27,sdkUmdLoader.loadPlugins("XGVideo");case 27:if(!(null==(p=e.sent)?void 0:p.isSupported())){e.next=36;break}return null==p||p.setDecodeCapacity({preloadDecoder:this.playerData.codec,wasmFallbackToAsm:!1,reuseWasmDecoder:!1,disabledWhenErrorOccur:!1}),this.setH265SoftPlayList(),this.playerData.openSoftDecoding=!0,e.abrupt("return",{mediaType:u?this.playerData.isCurrentH265()?"xg-video":"video":"xg-video",innerDegrade:1,codecType:this.playerData.codec});case 36:this.emit(SDKEvents.NOT_SUPPORT_SOFT_DECODER),f={errorType:"decoder",errorCode:3,errorMessage:"soft decode is not support by current browser",ext:{},originError:void 0},this.delayError.push(f),console.error("soft decode is not support by current browser");case 40:e.next=46;break;case 42:this.emit(SDKEvents.NOT_SUPPORT_HARDWARE_DECODER),g={ext:{},originError:void 0,errorType:"decoder",errorCode:3,errorMessage:"h265 hardware decode is not supported by this browser"},this.delayError.push(g),console.error("h265 hardware decode is not supported by this browser");case 46:return e.abrupt("return",{});case 47:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"setH265SoftPlayList",value:function(){if(this.playerData.isCurrentH265()){var e=this.playerData.playList;e.length>1&&(this.playerData.playList=e.filter((function(e){var t;return(null==e||null===(t=e.codec)||void 0===t?void 0:t.toLowerCase())===CodecType.H265}))),this.playerData.initCurrent(this.playerData.playList[0])}}},{key:"_initI18N",value:function(e){var t=e.extraLangList,r=e.extendLangList;null==t||t.forEach((function(e){I18N.use(e)})),r&&I18N.extend(r),I18N.extend(defaultExtendLang)}},{key:"musicMode",get:function(){var e,t;return null===(e=this.player.plugins)||void 0===e||null===(t=e.music)||void 0===t?void 0:t.mode},set:function(e){var t;null!==(t=this.player.plugins)&&void 0!==t&&t.music&&(this.player.plugins.music.mode=e)}},{key:"musicTimeScale",get:function(){var e,t;return null===(e=this.player.plugins)||void 0===e||null===(t=e.music)||void 0===t?void 0:t.timeScale},set:function(e){var t;null!==(t=this.player.plugins)&&void 0!==t&&t.music&&(this.player.plugins.music.timeScale=e)}},{key:"musicList",get:function(){var e,t;return null===(e=this.player.plugins)||void 0===e||null===(t=e.music)||void 0===t?void 0:t.list},set:function(e){var t,r;null===(t=this.player.plugins)||void 0===t||null===(r=t.music)||void 0===r||r.updateList(e)}},{key:"musicAdd",value:function(e){var t,r,n;null===(t=this.player.plugins)||void 0===t||null===(r=t.music)||void 0===r||null===(n=r.add)||void 0===n||n.call(r,e)}},{key:"musicRandom",value:function(){var e,t,r;return null===(e=this.player.plugins)||void 0===e||null===(t=e.music)||void 0===t||null===(r=t.random)||void 0===r?void 0:r.call(t)}},{key:"musicNext",value:function(){var e,t,r;null===(e=this.player.plugins)||void 0===e||null===(t=e.music)||void 0===t||null===(r=t.next)||void 0===r||r.call(t)}},{key:"musicPrev",value:function(){var e,t,r;null===(e=this.player.plugins)||void 0===e||null===(t=e.music)||void 0===t||null===(r=t.prev)||void 0===r||r.call(t)}},{key:"musicSetIndex",value:function(e){var t,r,n;null===(t=this.player.plugins)||void 0===t||null===(r=t.music)||void 0===r||null===(n=r.setIndex)||void 0===n||n.call(r,e)}},{key:"musicForward",value:function(){var e,t,r;null===(e=this.player.plugins)||void 0===e||null===(t=e.music)||void 0===t||null===(r=t.forward)||void 0===r||r.call(t)}},{key:"musicBackward",value:function(){var e,t,r;null===(e=this.player.plugins)||void 0===e||null===(t=e.music)||void 0===t||null===(r=t.backward)||void 0===r||r.call(t)}},{key:"musicRemove",value:function(e){var t,r,n;null===(t=this.player.plugins)||void 0===t||null===(r=t.music)||void 0===r||null===(n=r.remove)||void 0===n||n.call(r,e)}},{key:"musicSetAbCycle",value:function(e,t,r,n){var i,o,a;null===(i=this.player.plugins)||void 0===i||null===(o=i.music)||void 0===o||null===(a=o.setAbCycle)||void 0===a||a.call(o,e,t,r,n)}},{key:"musicRemoveAbCycle",value:function(){var e,t,r;null===(e=this.player.plugins)||void 0===e||null===(t=e.music)||void 0===t||null===(r=t.removeAbCycle)||void 0===r||r.call(t)}},{key:"destroy",value:(t=_asyncToGenerator$3(_regeneratorRuntime$2().mark((function e(){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._destroyPlayer();case 2:this.checkExpireTimer&&(this.checkExpireTimer.clear(),this.checkExpireTimer=null),this.mountingDom&&this.mountingDom.removeChild(this.playerContainer),this._emitter.removeAllListeners(),this._emitter=null,sdkPluginManager.destroy(this);case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}();function getI18N(){return I18N}VePlayer.isMSESupported=isMSESupport,VePlayer.isRTMSupported=RtmPlugin.isSupported,VePlayer.playerVersion=pkgJson.version;var index$1="",aisub="",aisubIcon="",index="";function Uint8ArrayToString(e){var t=String.fromCharCode.apply(null,e);return t.slice(t.indexOf("{"),t.lastIndexOf("}")+1)}var LiveSubTitlesPlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),(n=t.call(this,e)).state={showLang:"",subTitleList:[],rtmpDtsGap:0,dtsBase:0,showingSubtitle:"",currentSub:null},n.clearLineTimer=null,n.showTimer=null,n.state.showLang=e.showLang,n}return _createClass$6(r,[{key:"beforePlayerInit",value:function(){var e=this;this.on(TIME_UPDATE,this.handleVideoTimeupdate.bind(this)),this.on(PAUSE,this.onPause.bind(this)),this.on(PLAY,this.onPlay.bind(this)),this.on(DESTROY,this.destroy.bind(this)),this.on(URL_CHANGE,this.clearRtmpDtsGap.bind(this)),this.on(SEI_PARSED,this.handleSEIParsed.bind(this)),this.on("core_event",(function(t){"core.sei"===t.eventName&&e.handleSEIParsed(t.sei,t.originPts)}))}},{key:"onPause",value:function(){this.clearSubTitle(!1)}},{key:"onPlay",value:function(){this.clearSubTitle(!0)}},{key:"destroy",value:function(){this.clearSubTitle(!0),this.off(TIME_UPDATE,this.handleVideoTimeupdate.bind(this)),this.off(SEI_PARSED,this.handleSEIParsed.bind(this)),this.off(PAUSE,this.onPause.bind(this)),this.off(PLAY,this.onPlay.bind(this)),this.off(DESTROY,this.destroy.bind(this)),this.off(URL_CHANGE,this.clearRtmpDtsGap.bind(this))}},{key:"clearRtmpDtsGap",value:function(){this.state.rtmpDtsGap=0,this.state.dtsBase=0,this.clearSubTitle(!0)}},{key:"clearSubTitle",value:function(e){if(this.state.subTitleList=[],this.state.showingSubtitle="",this.state.currentSub=null,clearTimeout(this.showTimer),clearTimeout(this.clearLineTimer),e){var t=this.find(".xgplayer-subtitles-inner");t&&this.resetDom(t)}}},{key:"getIsSoft",value:function(){var e;return"LIVE-VIDEO"===(null!==(e=this.player.video)&&void 0!==e?e:{}).tagName}},{key:"handleVideoTimeupdate",value:function(e){var t,r,n=this.player.video.currentTime,i=this.getIsSoft(),o=(null==e||null===(t=e.detail)||void 0===t?void 0:t.pts)/1e3,a=i?o:n;if(this.state.showLang&&a&&this.player.isPlaying){var s=this.findSubTitleByTime(a);s&&s.text!==this.state.showingSubtitle&&null!==(r=s.wordpiece)&&void 0!==r&&r.length&&(this.renderSubtitle(s),this.player.emit(PluginEvents.AI_SUBTITLE_MATCH,{subTitle:s,lang:this.state.showLang}),this.state.subTitleList.length>1e3&&(this.state.subTitleList=this.state.subTitleList.filter((function(e){return e.timestamp+e.duration/1e3>=a}))))}}},{key:"renderSubtitle",value:function(e){var t=this,r=this.root,n=this.find(".xgplayer-subtitles-inner"),i=this.find(".xgplayer-subtitles-helper");if(n){this.clearLineTimer&&clearTimeout(this.clearLineTimer),this.showTimer&&(clearTimeout(this.showTimer),this.showSurplus());var o=this.createNewDom(n);this.state.showingSubtitle=e.text,this.state.currentSub={subObj:e,dom:o,index:0};var a=Date.now(),s="",l=0;!function c(){var u,h=e.wordpiece,d=void 0===h?[]:h,p=e.delimiter;if(l===d.length)return s="",t.showTimer=null,void(t.clearLineTimer=setTimeout((function(){t.resetDom(n),t.clearLineTimer=null}),1e3));var f=d[l].duration-(Date.now()-a-d[l].OffsetMs);if(f<0)for(;f<0&&l<d.length-1;)s=s+p+d[l+=1].text,f=d[l].duration-(Date.now()-a-d[l].OffsetMs);else s=s+p+d[l].text;i.textContent=s;var g=null!==(u=null==r?void 0:r.offsetWidth)&&void 0!==u?u:300;i.offsetWidth>g&&(o=t.createNewDom(n),t.state.currentSub.dom=o,s=d[l].text),o.textContent=s,t.showTimer=setTimeout(c,f),l+=1,t.state.currentSub.index=l}()}}},{key:"handleSEIParsed",value:function(e,t){var r=e.dts;if(5===e.code)try{var n="string"==typeof e.content?e.content:Uint8ArrayToString(e.content),i=JSON.parse(n).rtmp_dts;if(i&&r){var o=t||r;this.state.rtmpDtsGap=i-o}}catch(e2){}}},{key:"insertSubTitle",value:function(){for(var e,t=this,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];n.forEach((function(e){e.timestamp=t.adjustSubTitleTime(e.timestamp)})),(e=this.state.subTitleList).push.apply(e,n)}},{key:"setCurrentLang",value:function(e){this.state.showLang=e,this.player.emit(PluginEvents.AI_SUBTITLE_LANG_CHANGE,e)}},{key:"adjustSubTitleTime",value:function(e){var t,r,n,i,o,a,s,l;if(this.getIsSoft())return(e-this.state.rtmpDtsGap)/1e3;var c=(null===(t=this.player)||void 0===t||null===(r=t.plugins)||void 0===r?void 0:r.flvlive)||(null===(n=this.player)||void 0===n||null===(i=n.plugins)||void 0===i?void 0:i.hlslive);if(c){var u,h,d,p,f,g,y,v=null!==(u=null==c||null===(h=c._context)||void 0===h||null===(d=h.getInstance("COMPATIBILITY"))||void 0===d?void 0:d._videoLargeGap)&&void 0!==u?u:0,m=null==c||null===(p=c._context)||void 0===p?void 0:p.getInstance("MP4_REMUXER"),_=null!==(f=null!==(g=null===(y=m.remuxer)||void 0===y?void 0:y.videoDtsBase)&&void 0!==g?g:null==m?void 0:m.videoDtsBase)&&void 0!==f?f:0;return this.state.dtsBase=_-v,(e+v-_-this.state.rtmpDtsGap)/1e3}var b=(null===(o=this.player)||void 0===o||null===(a=o.plugins)||void 0===a?void 0:a.flv)||(null===(s=this.player)||void 0===s||null===(l=s.plugins)||void 0===l?void 0:l.hls);if(b){var T,E,S,$=null===(T=b.core._bufferService)||void 0===T||null===(E=T._demuxer)||void 0===E||null===(S=E._fixer)||void 0===S?void 0:S._baseDts;return this.state.dtsBase=$,(e-$-this.state.rtmpDtsGap)/1e3}return(e-this.state.rtmpDtsGap)/1e3}},{key:"findSubTitleByTime",value:function(e){var t=this,r=this.state.subTitleList,n=r.findIndex((function(r){var n=t.player,i=r.lang===t.state.showLang,o=((null==n?void 0:n.__curUrl)||n.config.url)===r.url,a=r.timestamp;return a+r.duration/1e3>=e&&a<=e&&o&&i}));if(!(n<0)){var i=r.splice(0,n+1),o=i[i.length-1];return this.splitSubTitle(o)}}},{key:"splitSubTitle",value:function(e){var t="en"===e.lang?" ":"",r=e.text.split(t);if(!e.wordpiece){var n=e.duration/r.length,i=r.map((function(e,t){return{text:e,OffsetMs:n*t,duration:n}}));return _objectSpread2$5(_objectSpread2$5({},e),{},{delimiter:t,textArr:r,wordpiece:i})}return _objectSpread2$5(_objectSpread2$5({},e),{},{delimiter:t,textArr:r})}},{key:"showSurplus",value:function(){var e,t=this;if(this.state.currentSub){var r=this.state.currentSub,n=r.index,i=r.subObj,o=r.dom,a=null!=i?i:{},s=a.wordpiece,l=a.delimiter;if(!(n>=s.length)){var c=this.find(".xgplayer-subtitles-helper"),u=this.find(".xgplayer-subtitles-inner"),h=this.root,d=null!==(e=null==h?void 0:h.offsetWidth)&&void 0!==e?e:300,p=s.length,f=o.textContent;s.slice(n,p).forEach((function(e){f=f+l+e.text,c.textContent=f,c.offsetWidth>d&&(t.state.currentSub.dom=t.createNewDom(u),f=e.text),t.state.currentSub.dom.textContent=f}))}}}},{key:"createNewDom",value:function(e){if(e){e.children.length>2&&e.firstElementChild&&e.removeChild(e.firstElementChild);var t=document.createElement("span");if(e.appendChild(t),e.children.length>2){var r=e.classList.contains("scroll-1"),n=e.classList.contains("scroll-2");r&&e.classList.replace("scroll-1","scroll-2"),n&&e.classList.replace("scroll-2","scroll-1"),r||n||e.classList.add("scroll-1")}return t}}},{key:"test",value:function(){var e=this,t=this.splitSubTitle({duration:1e4,lang:"zh",text:"你呼吸 已改变 停滞于某段流年 离别的你我 才明白挥霍有期限,逝去的人不曾走远 像 突如其来温暖我的晴天 像 倾盆大雨我躲避的屋檐",timestamp:0,url:"xxx"});this.renderSubtitle(t),setTimeout((function(){e.test()}),1e4)}},{key:"getPlayTime",value:function(){var e=this,t=this.getIsSoft();this.on(TIME_UPDATE,(function(r){if(t){var n,i={pts:null==r||null===(n=r.detail)||void 0===n?void 0:n.pts,rtmpDtsGap:e.state.rtmpDtsGap};i.timestamp=i.pts+i.rtmpDtsGap,console.log("直播当前时间戳:",i.timestamp,i)}else{var o={currentTime:1e3*e.player.video.currentTime,dtsBase:e.state.dtsBase,rtmpDtsGap:e.state.rtmpDtsGap};o.timestamp=o.currentTime+o.dtsBase+o.rtmpDtsGap,console.log("直播当前时间戳:",o.timestamp,o)}}))}},{key:"resetDom",value:function(e){e&&(this.state.currentSub=null,e&&(e.innerHTML="",e.classList.remove("scroll-1","scroll-2")))}},{key:"render",value:function(){return'<xg-subtitles class="xgplayer-subtitles"><xg-subtitles-inner class="xgplayer-subtitles-inner"></xg-subtitles-inner><xg-subtitles-helper class="xgplayer-subtitles-helper"></xg-helper></xg-subtitles>'}}],[{key:"pluginName",get:function(){return"LiveSubtitlesPlugin"}},{key:"defaultConfig",get:function(){return{position:Plugin.POSITIONS.ROOT,showLang:""}}}]),r}(Plugin),POSITIONS$2=Plugin.POSITIONS,LiveSubtitlesIconPlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),(n=t.call(this,e)).isMobile="mobile"===sniffer$1.device,n.isOpenState=!0,n.optionList=null,n.currentLang="",n}return _createClass$6(r,[{key:"afterCreate",value:function(){this.appendChild(".xgplayer-icon",this.icons.aiSubOpen),this.appendChild(".xgplayer-icon",this.icons.aiSubClose),this.renderOptionList(),this.initEvents(),this.currentLang=this.config.default,this.config.defaultOpen?this.open(!0):this.close()}},{key:"afterPlayerInit",value:function(){this.config.defaultOpen&&this.changeSubTitleLang(this.config.default,!0)}},{key:"registerIcons",value:function(){return{aiSubOpen:{icon:OpenIcon,class:"xgplayer-aisub-open-svg"},aiSubClose:{icon:CloseIcon,class:"xgplayer-aisub-close-svg"}}}},{key:"registerLanguageTexts",value:function(){return{sub:{jp:"AI 字幕",en:"AI Subtitles",zh:"AI 字幕","zh-hk":"AI 字幕"},subOpen:{jp:"字幕をオンにする",en:"Show subtitles",zh:"开启字幕","zh-hk":"開啟字幕"},subClose:{jp:"クローズドキャプション",en:"Hide subtitles",zh:"关闭字幕","zh-hk":"關閉字幕"}}}},{key:"children",value:function(){return{LiveSubTitlesPlugin:{plugin:LiveSubTitlesPlugin,options:{root:this.player.root,showLang:this.currentLang}}}}},{key:"initEvents",value:function(){this.bind(["click"],this.handleButtonChange.bind(this)),this.bind(["mouseenter"],this.showPanel.bind(this)),this.bind(["mouseleave"],this.hidePanel.bind(this))}},{key:"handleButtonChange",value:function(){(this.close=this.close.bind(this),this.open=this.open.bind(this),this.isMobile)?this.showMobilePanel():(this.isOpenState?this.close:this.open)()}},{key:"showMobilePanel",value:function(){var e,t=this.renderItemList();null===(e=this.player.panel)||void 0===e||e.showPanel(t,this.langText.sub,!0)}},{key:"renderItemList",value:function(){var e=this,t=_toConsumableArray$1(this.config.list),r=util.createDom("div","",{},"ai-panel-content");return t.push({key:"",showText:this.langText.subClose}),t.forEach((function(t){var n=e.renderItem(t);r.appendChild(n)})),r}},{key:"renderItem",value:function(e){var t=this,r=""===e.key&&!this.isOpenState||this.currentLang===e.key&&this.isOpenState,n=util.createDom("div","",{},"panel-Item ".concat(r?"select-in":""));return n.innerHTML=e.showText,n.addEventListener("click",(function(r){r.stopPropagation(),r.preventDefault(),t.changeSubTitleLang(e.key),t.updatePanel()})),n}},{key:"updatePanel",value:function(){var e,t=this.renderItemList();null===(e=this.player.panel)||void 0===e||e.updatePanel(t)}},{key:"showPanel",value:function(){var e;!this.isMobile&&this.isOpenState&&(null===(e=this.optionList)||void 0===e||e.show())}},{key:"hidePanel",value:function(){var e;!this.isMobile&&this.isOpenState&&(null===(e=this.optionList)||void 0===e||e.hide())}},{key:"open",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isOpenState=!0,util.removeClass(this.root,"isClose"),util.addClass(this.root,"isOpen"),!e&&this.showPanel(),this.toggleSubTitle()}},{key:"close",value:function(){var e;this.isOpenState=!1,util.removeClass(this.root,"isOpen"),util.addClass(this.root,"isClose"),null===(e=this.optionList)||void 0===e||e.hide(),this.toggleSubTitle()}},{key:"renderOptionList",value:function(){var e,t=this;if(!((null===(e=this.config.list)||void 0===e?void 0:e.length)<2||this.isMobile)){var r={config:{data:this.config.list.map((function(e){return e.key===t.config.default&&(e.isCurrent=!0,e.selected=!0),e})),className:"",onItemClick:function(e,r){var n;e.stopPropagation(),e.preventDefault(),t.changeSubTitleLang(null===(n=r.to)||void 0===n?void 0:n.key)}},root:this.root};this.optionList=new OptionList(r)}}},{key:"changeSubTitleLang",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.currentLang=e,e?this.open(t):this.close()}},{key:"toggleSubTitle",value:function(){var e;null===(e=this.player.getPlugin("LiveSubtitlesPlugin"))||void 0===e||e.setCurrentLang(this.isOpenState?this.currentLang:"")}},{key:"destroy",value:function(){var e;this.unbind(["click"],this.handleButtonChange.bind(this)),this.unbind(["mouseenter"],this.showPanel.bind(this)),this.unbind(["mouseleave"],this.hidePanel.bind(this)),null===(e=this.optionList)||void 0===e||e.destroy()}},{key:"render",value:function(){return'\n <xg-icon class="xgplayer-aisub">\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="subOpen">'.concat(this.langText.subOpen,"</div>\n </xg-icon>\n ")}}],[{key:"pluginName",get:function(){return"LiveSubtitlesIconPlugin"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$2.CONTROLS_RIGHT,index:2.7,defaultOpen:!0,default:"en",list:[{key:"zh",showText:"中文"},{key:"en",showText:"En"}]}}}]),r}(Plugin),DefinitionDemotePlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),(n=t.call(this,e)).waitings=[],n.longWaitingEmitTime=0,n.waitingStartTime=0,n.playerData=null,n.isNeedShowTips=!0,n.playerData=n.playerConfig.playerData,n}return _createClass$6(r,[{key:"registerLanguageTexts",value:function(){return{definition_demote_txt:{jp:"現在のネットワークは不安定です。に切り替えることをお勧めします",en:"The current network is unstable, it is recommended to switch to ",zh:"当前网络不稳定,建议切换到","zh-hk":"當前網絡不穩定,建議切換到"}}}},{key:"afterCreate",value:function(){this.bindCtx(),this.bindEvents()}},{key:"bindCtx",value:function(){this._count=this._count.bind(this),this._time=this._time.bind(this),this._waiting=this._waiting.bind(this),this._clearTime=this._clearTime.bind(this)}},{key:"bindEvents",value:function(){var e=this;this.on(WAITING,this._waiting),this.on(PLAYING,this._clearTime),this.on(PAUSE,this._clearTime),this.on(TIME_UPDATE,this._clearTime),this.on(PLAY,this._clearTime),this.on(CANPLAY,(function(){e.isNeedShowTips=!0})),this.config.isNeedAutoDemote&&this.player.on(PluginEvents.LONG_WAITING,this.demote.bind(this))}},{key:"_waiting",value:function(){this._count(),this._time()}},{key:"_count",value:function(){var e=Date.now();if(this.waitings.push(e),this.waitings.length===this.config.oftenWaitingCount){var t=this.waitings.shift();t&&e-t<=this.config.oftenWaitingTime&&(this.player.emit(PluginEvents.OFTEN_WAITING),this.clearState())}}},{key:"_time",value:function(){var e=this;if(this.timer)console.log("连续触发了waiting,距离上次waiting时间:",Date.now()-this.waitingStartTime);else{this.waitingStartTime=Date.now();var t=this.player.currentTime;this.timer=setTimeout((function(){e.player&&e.player.currentTime<=t+.1&&(console.log("waiting持续时间超过 ".concat(e.config.longWaitingTime," 秒")),e.player.emit(PluginEvents.LONG_WAITING),e.clearState())}),this.config.longWaitingTime)}}},{key:"_clearTime",value:function(){this.waitingStartTime&&console.log("waiting持续时长:",Date.now()-this.waitingStartTime),this.clearState()}},{key:"clearState",value:function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.waitings.length>0&&(this.waitings=[]),this.waitingStartTime&&(this.waitingStartTime=0)}},{key:"demote",value:function(){if(this.playerData){var e=this.playerData.getNextDefinition(!0,this.config.demotePriority),t=null==e?void 0:e[0];if(t){var r=t.definition;if(r){var n=this.playerData.current.definition;if(this.player.emit(PluginEvents.DEFINITION_DEMOTE,{currentDef:n,willChangeDef:r,next:t}),"auto"===n){var i=t.url;this.changeUrl(i)}else r!==n&&this.showToast(t)}}}}},{key:"changeUrl",value:function(e){this.player&&e&&(this.player.config.url=e,this.player.switchURL(e,!1),this.player.emit(PluginEvents.PlAY_URL_CHANGE,{url:e,from:"definition_demote"}))}},{key:"showToast",value:function(e){var t,r=this,n=null===(t=this.player)||void 0===t?void 0:t.getPlugin("sdkToastPlugin");if(n&&this.isNeedShowTips){var i=this.i18n[e.definitionTextKey]||e.definitionTextKey||e.definition,o=util.createDom("div",this.langText.definition_demote_txt,void 0,"toast-txt"),a=util.createDom("span",i,void 0,"toast-txt-bt");o.appendChild(a);var s=n.add(o,5e3,!0);a.addEventListener("click",(function(){r.playerData&&(r.playerData.current.definition=e.definition,n.remove(s))})),this.isNeedShowTips=!1,setTimeout((function(){r.isNeedShowTips=!0}),3e4)}}},{key:"destroy",value:function(){this.clearState()}}],[{key:"pluginName",get:function(){return"DefinitionDemotePlugin"}},{key:"defaultConfig",get:function(){return{oftenWaitingCount:3,oftenWaitingTime:5e3,longWaitingTime:5e3,isNeedAutoDemote:!1,demotePriority:[]}}}]),r}(Plugin),formatTime=function(e){var t=Math.floor(e/3600),r=e%3600,n=Math.floor(r/60),i=Math.round(r%60);return t>0?(n<10&&(n="0"+n),i<10&&(i="0"+i),"".concat(t,":").concat(n,":").concat(i)):(i<10&&(i="0"+i),"".concat(n,":").concat(i))},POSITIONS$1=Plugin.POSITIONS,UpperLimit=604800,MinMoveTime=6,TimeShiftPlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(){var e;return _classCallCheck$5(this,r),(e=t.apply(this,arguments)).isMobile="mobile"===sniffer$1.device,e.playedBar=null,e.cachedBar=null,e.innerBar=null,e.progressBtn=null,e.progressPoint=null,e.backLiveBt=null,e.cardDomList=[],e.initTime=0,e.liveGap=0,e.shiftTimeGap=0,e.isProgressMoving=!1,e.isPlayTimeShift=!1,e.liveUrl="",e.onBodyClick=function(e){e.preventDefault(),e.stopPropagation(),util.event(e)},e}return _createClass$6(r,[{key:"duration",get:function(){var e,t=this.liveGap+Math.floor(Date.now()/1e3-this.initTime),r=(null!==(e=this.config)&&void 0!==e?e:{}).maxMoveTime;return r&&t>r?r:t>UpperLimit?UpperLimit:t}},{key:"registerLanguageTexts",value:function(){return{BACKLIVE:{jp:"ライブに戻る",en:"Back to live",zh:"返回直播","zh-hk":"返回直播"}}}},{key:"updateLang",value:function(){this.backLiveBt&&(this.backLiveBt.innerHTML=this.langText.BACKLIVE)}},{key:"afterCreate",value:function(){this.liveUrl=this.player.config.url,this.playedBar=this.find(".xgplayer-progress-played"),this.cachedBar=this.find(".xgplayer-progress-cache"),this.progressBtn=this.find(".xgplayer-progress-btn"),this.progressPoint=this.find(".xgplayer-shift-progress-point"),this.innerBar=this.find(".xgplayer-progress-inner"),this.createBackLiveBtDom(),this.clacTime(),this.initEvents(),this.bindDomEvents(),this.isMobile||this.createTimeShiftCard()}},{key:"clacTime",value:function(){var e,t=null!==(e=this.config)&&void 0!==e?e:{},r=t.livingStartTime,n=t.currentTime;this.initTime=Math.floor(Date.now()/1e3),this.liveGap=Math.floor(n-r)}},{key:"initEvents",value:function(){this.on(TIME_UPDATE,this.handleTimeUpdate.bind(this))}},{key:"bindDomEvents",value:function(){if(this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.tipsUpdate=this.tipsUpdate.bind(this),this.isMobile){this.bind("touchstart",this.handleMouseDown);var e=this.player.controls;e&&(e.root&&e.root.addEventListener("touchmove",util.stopPropagation),e.center&&e.center.addEventListener("touchend",util.stopPropagation))}else this.bind("mousedown",this.handleMouseDown),this.bind("mouseenter",this.handleMouseEnter)}},{key:"handleTimeUpdate",value:function(){this.isProgressMoving||this.progressUpdate()}},{key:"handleMouseDown",value:function(e){if(e.target!==this.backLiveBt){this.onBodyClick(e),this.focus(),util.addClass(this.progressBtn,"active");var t=this.computeTime(e);this.updateShiftTime(t.percent),this.isProgressMoving=!0,this.isMobile?(this.bind("touchmove",this.handleMouseMove),this.bind("touchend",this.handleMouseUp)):(document.addEventListener("mousemove",this.handleMouseMove,!1),document.addEventListener("mouseup",this.handleMouseUp,!1))}}},{key:"handleMouseMove",value:function(e){this.onBodyClick(e);var t=this.computeTime(e);this.updateShiftTime(t.percent)}},{key:"handleMouseUp",value:function(e){this.onBodyClick(e),this.isProgressMoving=!1,util.removeClass(this.progressBtn,"active"),this.changeTimeUrl(),this.isMobile?(this.unbind("touchmove",this.handleMouseMove),this.unbind("touchend",this.handleMouseUp)):(document.removeEventListener("mousemove",this.handleMouseMove,!1),document.removeEventListener("mouseup",this.handleMouseUp,!1))}},{key:"handleMouseEnter",value:function(e){this.bind("mouseleave",this.handleMouseLeave),this.bind("mousemove",this.tipsUpdate),this.tipsUpdate(e),this.focus()}},{key:"handleMouseLeave",value:function(){this.unbind("mouseleave",this.handleMouseLeave),this.unbind("mousemove",this.tipsUpdate),this.blur()}},{key:"focus",value:function(){this.player.controls.pauseAutoHide(),util.addClass(this.root,"active")}},{key:"blur",value:function(){this.player.controls.recoverAutoHide(),util.removeClass(this.root,"active")}},{key:"computeTime",value:function(e){var t,r,n,i=this.player,o=this.root.getBoundingClientRect(),a=o.width,s=o.height,l=o.top,c=o.left,u=util.getEventPos(e,i.zoom);90===i.rotateDeg?(t=s,r=l,n=u.clientY):(t=a,r=c,n=u.clientX);var h=n-r,d=(h=h>t?t:h<0?0:h)/t;return{percent:d=d<0?0:d>1?1:d,offset:h,width:t,left:r,e:e}}},{key:"tipsUpdate",value:function(e){var t=this.computeTime(e),r=Math.floor(this.duration*(1-t.percent));this.progressPoint.style.left="".concat(100*t.percent,"%"),this.progressPoint.innerHTML="-".concat(formatTime(r))}},{key:"updateShiftTime",value:function(e){this.shiftTimeGap=Math.floor(this.duration*(1-e)),this.progressUpdate()}},{key:"getCurrentProgress",value:function(){return Math.floor(this.duration-this.shiftTimeGap)}},{key:"progressUpdate",value:function(){var e=this.getCurrentProgress()/this.duration;this.progressBtn.style.left="".concat(100*e,"%"),this.playedBar.style.width="".concat(100*e,"%"),this.cardProcessUpdate()}},{key:"changeTimeShift",value:function(e){var t=this.calcCardProcess(e);t<0||(this.updateShiftTime(t),this.changeTimeUrl())}},{key:"changeTimeUrl",value:function(){var e=this.config.timeShiftUrl,t="";this.isPlayTimeShift=!0,this.toggleBackButton();var r=this.shiftTimeGap<MinMoveTime?MinMoveTime:this.shiftTimeGap;t=e?e.replace("{}",r):addUrlParam(this.liveUrl,{timeshift:r}),this.player.src=t,this.player.config.url=t,this.player.emit(PluginEvents.TIME_SHIFT_CHANGE,!0),this.player.emit(PluginEvents.PlAY_URL_CHANGE,{shiftUrl:t,from:PluginEvents.TIME_SHIFT_CHANGE})}},{key:"createBackLiveBtDom",value:function(){var e,t=this;if(this.backLiveBt)return this.backLiveBt;this.backLiveBt=util.createDom("xg-back-live-bt",this.langText.BACKLIVE,void 0,"xgplayer-back-live-bt"),this.backLiveBt.addEventListener("click",(function(e){t.onBodyClick(e),t.backLive()})),null===(e=this.player.root)||void 0===e||e.appendChild(this.backLiveBt)}},{key:"backLive",value:function(){this.liveUrl&&(this.player.src=this.liveUrl,this.player.config.url=this.liveUrl,this.shiftTimeGap=0,this.isPlayTimeShift=!1,this.toggleBackButton(),this.player.emit(PluginEvents.TIME_SHIFT_CHANGE,!1),this.player.emit(PluginEvents.PlAY_URL_CHANGE,{url:this.liveUrl,from:PluginEvents.TIME_SHIFT_CHANGE}))}},{key:"toggleBackButton",value:function(){this.backLiveBt&&(this.backLiveBt.style.display=this.isPlayTimeShift?"flex":"none")}},{key:"updateCardList",value:function(e){this.config.cardList=_toConsumableArray$1(e),this.clearCardDom(),this.createTimeShiftCard()}},{key:"clearCardDom",value:function(){var e=this;this.cardDomList.forEach((function(t){t.dom&&e.innerBar.contains(t.dom)&&e.innerBar.removeChild(t.dom)})),this.cardDomList=[]}},{key:"createTimeShiftCard",value:function(){var e,t=this;(null===(e=this.config.cardList)||void 0===e?void 0:e.length)<=0||this.config.cardList.forEach((function(e){t.renderCard(e)}))}},{key:"renderCard",value:function(e){if(e.img){var t=util.createDom("xg-card","",void 0,"xgplayer-shift-progress-card"),r=util.createDom("img","",{src:e.img},"xgplayer-shift-progress-card-img"),n=util.createDom("div","",void 0,"xgplayer-shift-progress-card-point");t.appendChild(r),t.appendChild(n),this.cardDomList.push(_objectSpread2$5(_objectSpread2$5({},e),{},{dom:t}))}}},{key:"cardProcessUpdate",value:function(){var e=this;0!==this.cardDomList.length&&this.cardDomList.forEach((function(t){if(t.dom){var r=e.calcCardProcess(t.timestamp);if(!(r>1)){var n=e.innerBar.contains(t.dom);r<0?n&&e.innerBar.removeChild(t.dom):(n||e.innerBar.appendChild(t.dom),t.dom.style.left="".concat(100*r,"%"))}}}))}},{key:"calcCardProcess",value:function(e){var t,r=null!==(t=this.config)&&void 0!==t?t:{},n=r.maxMoveTime,i=r.livingStartTime,o=this.liveGap+Math.floor(Date.now()/1e3-this.initTime);return n&&o>n&&(i=o-n),e<i?-1:(e-i)/this.duration}},{key:"destroy",value:function(){if(this.off(TIME_UPDATE,this.handleTimeUpdate.bind(this)),this.isMobile){this.unbind("touchstart",this.handleMouseDown);var e=this.player.controls;e&&(e.root&&e.root.removerEventListener("touchmove",util.stopPropagation),e.center&&e.center.removerEventListener("touchend",util.stopPropagation))}else this.unbind("mousedown",this.handleMouseDown),this.unbind("mouseenter",this.handleMouseEnter);var t;this.backLiveBt&&(null===(t=this.player.root)||void 0===t||t.removeChild(this.backLiveBt),this.backLiveBt=null)}},{key:"render",value:function(){if(this.config.disable)return"";var e=this.player.controls?this.player.controls.config.mode:"";return'\n <xg-progress class="xgplayer-progress '.concat("bottom"===e?"xgplayer-progress-bottom":"",' xgplayer-shift">\n <xg-outer class="xgplayer-progress-outer">\n <xg-inners class="progress-list">\n <xg-inner class="xgplayer-progress-inner" style="flex: 1">\n <xg-cache class="xgplayer-progress-cache" style="width: 100%;"></xg-cache>\n <xg-played class="xgplayer-progress-played" style="width: 100%;"></xg-played>\n </xg-inner>\n </xg-inners>\n <xg-progress-btn class="xgplayer-progress-btn"></xg-progress-btn>\n <xg-point class="xgplayer-shift-progress-point">00:00</xg-point>\n </xg-outer>\n </xg-progress>\n ')}}],[{key:"pluginName",get:function(){return"TimeShiftPlugin"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$1.CONTROLS_CENTER,livingStartTime:Date.now()/1e3,maxMoveTime:0,currentTime:Date.now()/1e3,timeShiftUrl:"",cardList:[]}}}]),r}(Plugin);function GetMirrorSvg(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.5 0.199997C8.5 0.0895386 8.5896 0 8.69995 0H9.30005C9.4104 0 9.5 0.0895386 9.5 0.199997V1.8C9.5 1.91046 9.4104 2 9.30005 2H8.69995C8.5896 2 8.5 1.91046 8.5 1.8V0.199997Z" fill="white"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M0 1.95424C0 1.85173 0.0773926 1.76582 0.179443 1.75529L7.27954 1.02277C7.34546 1.01596 7.40649 1.04182 7.44751 1.08664C7.47998 1.12207 7.5 1.16936 7.5 1.22171V14.7783C7.5 14.8969 7.39746 14.9894 7.27954 14.9773L0.179443 14.2447C0.0773926 14.2342 0 14.1483 0 14.0458V1.95424ZM1.5 12.873V3.12701L6 2.66273V13.3373L1.5 12.873Z" fill="white"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M18 1.95424C18 1.85173 17.9226 1.76582 17.8206 1.75529L10.7205 1.02277C10.6025 1.01059 10.5 1.10313 10.5 1.22171V14.7783C10.5 14.8969 10.6025 14.9894 10.7205 14.9773L17.8206 14.2447C17.9226 14.2342 18 14.1483 18 14.0458V1.95424ZM16.5 3.12701L12 2.66273V13.3373L16.5 12.873V3.12701Z" fill="white"/>\n <path d="M8.69995 3C8.5896 3 8.5 3.08954 8.5 3.2V4.8C8.5 4.91046 8.5896 5 8.69995 5H9.30005C9.32642 5 9.35156 4.9949 9.37451 4.98564C9.39111 4.97896 9.40674 4.97011 9.4209 4.95944C9.46899 4.92293 9.5 4.8651 9.5 4.8V3.2C9.5 3.14664 9.47925 3.09818 9.44507 3.06232C9.40869 3.02393 9.35718 3 9.30005 3H8.69995Z" fill="white"/>\n <path d="M8.5 6.2C8.5 6.08954 8.5896 6 8.69995 6H9.30005C9.34277 6 9.38232 6.01344 9.41479 6.03635C9.46631 6.07254 9.5 6.13234 9.5 6.2V7.8C9.5 7.85072 9.48096 7.89703 9.44995 7.9323C9.41821 7.96826 9.37354 7.99272 9.32373 7.99861C9.31592 7.99953 9.30811 8 9.30005 8H8.69995C8.5896 8 8.5 7.91046 8.5 7.8V6.2Z" fill="white"/>\n <path d="M8.53711 9.08395C8.51367 9.11667 8.5 9.15674 8.5 9.20001V10.8C8.5 10.9105 8.5896 11 8.69995 11H9.30005C9.4104 11 9.5 10.9105 9.5 10.8V9.20001C9.5 9.08954 9.4104 9 9.30005 9H8.69995C8.68384 9 8.66821 9.00189 8.65332 9.00546C8.60571 9.01688 8.5647 9.04529 8.53711 9.08395Z" fill="white"/>\n <path d="M8.5 12.2C8.5 12.1371 8.52905 12.081 8.57446 12.0443C8.60864 12.0166 8.65234 12 8.69995 12H9.30005C9.4104 12 9.5 12.0895 9.5 12.2V13.8C9.5 13.8664 9.46753 13.9253 9.41772 13.9616C9.38477 13.9857 9.34399 14 9.30005 14H8.69995C8.5896 14 8.5 13.9105 8.5 13.8V12.2Z" fill="white"/>\n <path d="M8.69995 15C8.5896 15 8.5 15.0895 8.5 15.2V15.8C8.5 15.9105 8.5896 16 8.69995 16H9.30005C9.4104 16 9.5 15.9105 9.5 15.8V15.2C9.5 15.0895 9.4104 15 9.30005 15H8.69995Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}function ExitMirrorSvg(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.5 0.2C8.5 0.0895431 8.58954 0 8.7 0H9.3C9.41046 0 9.5 0.0895431 9.5 0.2V1.8C9.5 1.91046 9.41046 2 9.3 2H8.7C8.58954 2 8.5 1.91046 8.5 1.8V0.2Z" fill="white"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M0 1.95424C0 1.85173 0.0775055 1.76582 0.179474 1.7553L7.27947 1.02276C7.39742 1.01059 7.5 1.10313 7.5 1.2217V14.7783C7.5 14.8969 7.39742 14.9894 7.27947 14.9773L0.179474 14.2447C0.0775053 14.2342 0 14.1483 0 14.0458V1.95424ZM1.5 12.873V3.12702L6 2.66273V13.3373L1.5 12.873Z" fill="white"/>\n <path d="M17.8205 1.7553C17.9225 1.76582 18 1.85173 18 1.95424V14.0458C18 14.1483 17.9225 14.2342 17.8205 14.2447L10.7205 14.9773C10.6026 14.9894 10.5 14.8969 10.5 14.7783V1.2217C10.5 1.10313 10.6026 1.01059 10.7205 1.02276L17.8205 1.7553Z" fill="white"/>\n <path d="M8.7 3C8.58954 3 8.5 3.08954 8.5 3.2V4.8C8.5 4.91046 8.58954 5 8.7 5H9.3C9.41046 5 9.5 4.91046 9.5 4.8V3.2C9.5 3.08954 9.41046 3 9.3 3H8.7Z" fill="white"/>\n <path d="M8.5 6.2C8.5 6.08954 8.58954 6 8.7 6H9.3C9.41046 6 9.5 6.08954 9.5 6.2V7.8C9.5 7.91046 9.41046 8 9.3 8H8.7C8.58954 8 8.5 7.91046 8.5 7.8V6.2Z" fill="white"/>\n <path d="M8.7 9C8.58954 9 8.5 9.08954 8.5 9.2V10.8C8.5 10.9105 8.58954 11 8.7 11H9.3C9.41046 11 9.5 10.9105 9.5 10.8V9.2C9.5 9.08954 9.41046 9 9.3 9H8.7Z" fill="white"/>\n <path d="M8.5 12.2C8.5 12.0895 8.58954 12 8.7 12H9.3C9.41046 12 9.5 12.0895 9.5 12.2V13.8C9.5 13.9105 9.41046 14 9.3 14H8.7C8.58954 14 8.5 13.9105 8.5 13.8V12.2Z" fill="white"/>\n <path d="M8.7 15C8.58954 15 8.5 15.0895 8.5 15.2V15.8C8.5 15.9105 8.58954 16 8.7 16H9.3C9.41046 16 9.5 15.9105 9.5 15.8V15.2C9.5 15.0895 9.41046 15 9.3 15H8.7Z" fill="white"/>\n</svg>\n',"image/svg+xml").firstChild}var POSITIONS=Plugin.POSITIONS,MirrorStateKeys={GetMirror:"getMirror",ExitMirror:"exitMirror"},MirrorPlugin=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),(n=t.call(this,e)).isEnableMirror=!0,n.isEnableMirror=n.config.defaultEnable,n}return _createClass$6(r,[{key:"afterCreate",value:function(){this.config.disable||(this.initIcons(),this.btnClick=this.btnClick.bind(this),this.bind(["touchend","click"],this.btnClick),this.updateMirrorState(this.isEnableMirror))}},{key:"registerIcons",value:function(){var e;return _defineProperty$6(e={},MirrorStateKeys.GetMirror,{icon:GetMirrorSvg,class:"xg-get-mirror"}),_defineProperty$6(e,MirrorStateKeys.ExitMirror,{icon:ExitMirrorSvg,class:"xg-exit-mirror"}),e}},{key:"initIcons",value:function(){var e=this.icons,t=this.find(".xgplayer-icon");t.appendChild(e[MirrorStateKeys.GetMirror]),t.appendChild(e[MirrorStateKeys.ExitMirror])}},{key:"registerLanguageTexts",value:function(){return{getMirror:{jp:"ミラーを開く",en:"Turn on mirroring",zh:"开启镜像","zh-hk":"開啟鏡像"},exitMirror:{jp:"ミラーを閉じる",en:"Turn off mirroring",zh:"关闭镜像","zh-hk":"關閉鏡像"}}}},{key:"btnClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.isEnableMirror?this.action(!1):this.action(!0)}},{key:"action",value:function(e){this.isEnableMirror=e,this.updateMirrorState(this.isEnableMirror),this.player.emit(PluginEvents.MIRROR_CHANGE,this.isEnableMirror)}},{key:"updateMirrorState",value:function(e){var t=this.player;e?t.addClass("xgplayer-mirror"):t.removeClass("xgplayer-mirror"),this.animate(e)}},{key:"animate",value:function(e){this.root&&(e?this.setAttr("data-state","enable"):this.setAttr("data-state","normal"),this.switchTips(e))}},{key:"switchTips",value:function(e){this.changeLangTextKey(this.find(".xg-tips"),e?MirrorStateKeys.ExitMirror:MirrorStateKeys.GetMirror)}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class=\'xgplayer-mirror-icon\'>\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="mirror">'.concat(this.langText[MirrorStateKeys.GetMirror],"</div>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"mirrorPlugin"}},{key:"defaultConfig",get:function(){return{position:POSITIONS.CONTROLS_RIGHT,index:CONTROL_ICON_INDEX.mirrorPlugin,disable:!1,defaultEnable:!1}}}]),r}(Plugin);function retPromise(e){return e&&e.then?e:new Promise((function(t){t(e)}))}var MemoryPlay=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(e){var n;return _classCallCheck$5(this,r),(n=t.call(this,e)).memoryId="",n.canJump=!1,n.saveTimeFun=util.checkIsFunction(n.config.saveTime)?n.config.saveTime:n.saveTimeByStorage,n.getTimeFun=util.checkIsFunction(n.config.getTime)?n.config.getTime:n.getTimeByStorage,n.startTime=0,n.memoryId=n.config.memoryId,n.showToast=n.showToast.bind(_assertThisInitialized$5(n)),n}return _createClass$6(r,[{key:"registerLanguageTexts",value:function(){return{preText:{jp:"に位置付けられました",en:"Has located for you to ",zh:"已为您定位至","zh-hk":"已為您定位至"}}}},{key:"children",value:function(){return{toast:ToastPlugin}}},{key:"afterCreate",value:function(){this.once(CANPLAY,this.showToast)}},{key:"beforePlayerInit",value:function(){return this.memoryId||(this.playerConfig.vid?this.memoryId=this.playerConfig.vid:this.player.url&&(this.memoryId=this.player.url.replace(/\?.*$/,""))),this.setSave(),this.getTime()}},{key:"destroy",value:function(){0!==this.player.currentTime&&this.player.currentTime!==this.player.duration&&this.saveTimeFun(this.memoryId,this.player.currentTime)}},{key:"getTime",value:function(){var e=this;return new Promise((function(t){retPromise(e.getTimeFun(e.memoryId)).then((function(r){var n=parseFloat(r);isNaN(n)||0===n?console.warn("the time got is invalid",r):(e.startTime=n,e.canJump=!0,e.playerConfig.startTime=e.startTime,"mobile"===sniffer$1.device&&e.player.once("canplay",(function(){e.player.currentTime=e.startTime}))),t()})).catch((function(e){console.error("getTime function occur error",e),t()}))}))}},{key:"setSave",value:function(){var e=this;document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&0!==e.player.currentTime&&e.player.currentTime!==e.player.duration&&e.saveTimeFun(e.memoryId,e.player.currentTime)})),document.addEventListener("pagehide",(function(){0!==e.player.currentTime&&e.player.currentTime!==e.player.duration&&e.saveTimeFun(e.memoryId,e.player.currentTime)})),window.addEventListener("beforeunload",(function(){0!==e.player.currentTime&&e.player.currentTime!==e.player.duration&&e.saveTimeFun(e.memoryId,e.player.currentTime)}))}},{key:"showToast",value:function(){if(this.canJump){var e,t=null===(e=this.player)||void 0===e?void 0:e.getPlugin("sdkToastPlugin");if(!t)return;var r=util.format(this.startTime);t.add("".concat(this.langText.preText).concat(r),4e3,!0)}}},{key:"saveTimeByStorage",value:function(e,t){localStorage.setItem(e,t)}},{key:"getTimeByStorage",value:function(e){return localStorage.getItem(e)}}],[{key:"pluginName",get:function(){return"memoryPlay"}},{key:"defaultConfig",get:function(){return{getTime:null,saveTime:null,memoryId:""}}}]),r}(Plugin),LiveInfoPanel=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(){var e;return _classCallCheck$5(this,r),(e=t.apply(this,arguments))._infoItems=[],e}return _createClass$6(r,[{key:"streamType",get:function(){return this.playerConfig.playerData.getCurrentStreamType()}},{key:"afterCreate",value:function(){var e=this;["flv","hls"].includes(this.streamType)?(this.player.on("error",(function(){return e._handleError()})),this.player.on("loadeddata",(function(){return e._handleLoadedData()}))):this.close()}},{key:"registerLanguageTexts",value:function(){return{DECODEFPS:{en:"decodeFps",zh:"解码效率"},DECODECOST:{en:"decodeCost",zh:"解码消耗"},FORMAT:{en:"format",zh:"格式"},FPS:{en:"fps",zh:"帧率"},BITRATE:{en:"birate",zh:"码率"},GOP:{en:"GOP",zh:"GOP"},RESOLUTION:{en:"resolution",zh:"分辨率"},ENCODETYPE:{en:"encodeType",zh:"编码方式"},BUFFEREND:{en:"bufferEnd",zh:"buffer水位"},CURRENTTIME:{en:"currentTime",zh:"播放进度"}}}},{key:"_getDefaultInfo",value:function(e){var t={h265Title:{key:"h265Title",label:"H265解码",type:"title"},decodeEfficiency:{key:"decodeEfficiency",label:"解码效率",labelTextKey:"DECODEFPS",value:e.decodeFps,render:function(e){return e+"frames/s"}},decodeCost:{key:"decodeCost",label:"解码消耗",labelTextKey:"DECODECOST",value:e.decodeFps,render:function(e){return e?(1e3/e).toFixed()+"ms":""}}};return _objectSpread2$5({format:{key:"format",label:"格式",labelTextKey:"FORMAT",value:e.format},framerate:{key:"framerate",label:"帧率",labelTextKey:"FPS",value:e.fps,render:function(e){return"".concat(e," fps")}},bitrate:{key:"bitrate",label:"码率",labelTextKey:"BITRATE",value:e.bitrate,render:function(e){return"".concat(e/1e3," kbps")}},gop:{key:"gop",label:"GOP",labelTextKey:"GOP",value:e.gop,render:function(e){return"".concat(e," frames")}},resolution:{key:"resolution",label:"视频分辨率",labelTextKey:"RESOLUTION",value:{width:e.width,height:e.height},render:function(e){return"".concat(e.width," * ").concat(e.height)}},encodeType:{key:"encodeType",label:"编码方式",labelTextKey:"ENCODETYPE",value:e.encodeType},bufferEnd:{key:"bufferEnd",label:"buffer水位",labelTextKey:"BUFFEREND",value:e.bufferEnd},currentTime:{key:"currentTime",label:"播放进度",labelTextKey:"CURRENTTIME",value:e.currentTime,render:function(e){return e?e.toFixed(6)+"s":""}}},e.isOpenSoftDecoding&&this.config.showH265Info?t:{})}},{key:"_init",value:function(){var e=this,t=this._initDom(this._getInfoListData());this._infoItems=new Proxy(t,{set:function(t,r,n){return e._updateDom(t[r].dom,n),Reflect.set(t,r,n)}}),this._tick()}},{key:"_getStats",value:function(){var e,t;return"flv"===this.streamType?null===(e=this.player.plugins.flv)||void 0===e?void 0:e.getStats():"hls"===this.streamType?null===(t=this.player.plugins.hls)||void 0===t?void 0:t.getStats():{}}},{key:"_getInfoListData",value:function(){var e=this._getStats()||{};return this._getDefaultInfo(Object.assign(e,{format:"".concat(this.streamType,"_live"),isOpenSoftDecoding:"live-video"==this.playerConfig.mediaType}))}},{key:"_initDom",value:function(e){var t=this,r=this.find(".veplayer-livepanel-container");return r.innerHTML="",Object.values(e).forEach((function(e){var n=util.createDom("veplayer-livepanel-div","",void 0,"veplayer-livepanel-container-row");"title"===e.type?t._updateTitle(n,e):t._updateDom(n,e),r.appendChild(n),e.dom=n})),e}},{key:"_updateTitle",value:function(e,t){e.innerHTML="";var r=util.createDom("veplayer-livepanel-span",t.label,void 0,"veplayer-livepanel-container-row-title");e.appendChild(r)}},{key:"_updateDom",value:function(e,t){e.innerHTML="";var r=util.createDom("veplayer-livepanel-span",this._renderLabel(t),void 0,"veplayer-livepanel-container-row-label");if(e.appendChild(r),"title"!==t.type){var n=util.createDom("veplayer-livepanel-span",this._renderValue(t));e.appendChild(n)}}},{key:"_renderLabel",value:function(e){return e.labelTextKey&&this.langText[e.labelTextKey]}},{key:"_renderValue",value:function(e){return e.render?e.render(e.value):e.value}},{key:"_handleDataChange",value:function(){var e=this,t=this._getInfoListData();Object.values(this._infoItems).forEach((function(r){"title"!==r.type&&e._renderValue(r)!==e._renderValue(t[r.key])&&(e._infoItems[r.key]=_objectSpread2$5(_objectSpread2$5({},r),t[r.key]))}))}},{key:"_tick",value:function(){var e=this;this._pollTimer=setTimeout((function(){clearTimeout(e._pollTimer),e._poll(),e._tick()}),500)}},{key:"_poll",value:function(){this._handleDataChange()}},{key:"destroy",value:function(){clearTimeout(this._pollTimer)}},{key:"_handleError",value:function(){this._close()}},{key:"_handleLoadedData",value:function(){this.config.visible&&this._open()}},{key:"_open",value:function(){var e=this.find(".veplayer-livepanel-container");util.removeClass(e,"veplayer-livepanel-hidden"),this._init()}},{key:"_close",value:function(){var e=this.find(".veplayer-livepanel-container");util.addClass(e,"veplayer-livepanel-hidden"),clearTimeout(this._pollTimer)}},{key:"open",value:function(){this._open(),this.config.visible=!0}},{key:"close",value:function(){this._close(),this.config.visible=!1}},{key:"render",value:function(){return'\n <xg-livepanel class="xgplayer-livepanel">\n <xg-livepanel-container class="veplayer-livepanel-container '.concat(!this.config.visible&&"veplayer-livepanel-hidden",'">\n </xg-livepanel-container></xg-livepanel>\n ')}}],[{key:"pluginName",get:function(){return"LiveInfoPanel"}},{key:"defaultConfig",get:function(){return{visible:!0,showH265Info:!1}}}]),r}(Plugin),VePlayerUmd=function(e){_inherits$5(r,e);var t=_createSuper$5(r);function r(){return _classCallCheck$5(this,r),t.apply(this,arguments)}return _createClass$6(r)}(VePlayer);return VePlayerUmd.Music=MusicPreset,VePlayerUmd.LiveSubtitlesIconPlugin=LiveSubtitlesIconPlugin,VePlayerUmd.LiveSubtitlesPlugin=LiveSubTitlesPlugin,VePlayerUmd.DefinitionDemotePlugin=DefinitionDemotePlugin,VePlayerUmd.TimeShiftPlugin=TimeShiftPlugin,VePlayerUmd.MirrorPlugin=MirrorPlugin,VePlayerUmd.MemoryPlay=MemoryPlay,VePlayerUmd.Subtitle=Subtitle,VePlayerUmd.Service=dist,VePlayerUmd.LiveInfoPanel=LiveInfoPanel,VePlayerUmd.Event=Event$2,VePlayerUmd.getI18N=getI18N,VePlayerUmd.BasePlugin=BasePlugin,VePlayerUmd.Plugin=Plugin,VePlayerUmd.Sniffer=sniffer$1,VePlayerUmd.Util=util,VePlayerUmd.STATE_CLASS=STATE_CLASS,VePlayerUmd.I18N=I18N,VePlayerUmd.STATES=STATES,VePlayerUmd}));