@volcengine/veplayer 2.4.2-rc.4 → 2.4.2-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  var Codec=function(e){return e.H265="h265",e.H264="h264",e}(Codec||{}),Degradation=function(e){return e.SoftFirst="soft-first",e.H264First="h264-first",e}(Degradation||{}),DecodeType=function(e){return e.Software="software",e.Hardware="hardware",e}(DecodeType||{}),commonjsGlobal$1="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var check=function(e){return e&&e.Math==Math&&e},global$p=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof commonjsGlobal$1&&commonjsGlobal$1)||function(){return this}()||commonjsGlobal$1||Function("return this")(),fails$B=function(e){try{return!!e()}catch(e){return!0}},fails$A=fails$B,functionBindNative=!fails$A((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),NATIVE_BIND$4=functionBindNative,FunctionPrototype$3=Function.prototype,apply$6=FunctionPrototype$3.apply,call$s=FunctionPrototype$3.call,functionApply="object"==typeof Reflect&&Reflect.apply||(NATIVE_BIND$4?call$s.bind(apply$6):function(){return call$s.apply(apply$6,arguments)}),NATIVE_BIND$3=functionBindNative,FunctionPrototype$2=Function.prototype,call$r=FunctionPrototype$2.call,uncurryThisWithBind=NATIVE_BIND$3&&FunctionPrototype$2.bind.bind(call$r,call$r),functionUncurryThis=NATIVE_BIND$3?uncurryThisWithBind:function(e){return function(){return call$r.apply(e,arguments)}},uncurryThis$D=functionUncurryThis,toString$h=uncurryThis$D({}.toString),stringSlice$5=uncurryThis$D("".slice),classofRaw$2=function(e){return stringSlice$5(toString$h(e),8,-1)},classofRaw$1=classofRaw$2,uncurryThis$C=functionUncurryThis,functionUncurryThisClause=function(e){if("Function"===classofRaw$1(e))return uncurryThis$C(e)},documentAll$2="object"==typeof 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$p=$documentAll$1.IS_HTMLDDA?function(e){return"function"==typeof e||e===documentAll$1}:function(e){return"function"==typeof e},objectGetOwnPropertyDescriptor={},fails$z=fails$B,descriptors=!fails$z((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),NATIVE_BIND$2=functionBindNative,call$q=Function.prototype.call,functionCall=NATIVE_BIND$2?call$q.bind(call$q):function(){return call$q.apply(call$q,arguments)},objectPropertyIsEnumerable={},$propertyIsEnumerable$2={}.propertyIsEnumerable,getOwnPropertyDescriptor$b=Object.getOwnPropertyDescriptor,NASHORN_BUG=getOwnPropertyDescriptor$b&&!$propertyIsEnumerable$2.call({1:2},1);objectPropertyIsEnumerable.f=NASHORN_BUG?function(e){var t=getOwnPropertyDescriptor$b(this,e);return!!t&&t.enumerable}:$propertyIsEnumerable$2;var match,version$1,createPropertyDescriptor$8=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},uncurryThis$B=functionUncurryThis,fails$y=fails$B,classof$g=classofRaw$2,$Object$4=Object,split$3=uncurryThis$B("".split),indexedObject=fails$y((function(){return!$Object$4("z").propertyIsEnumerable(0)}))?function(e){return"String"==classof$g(e)?split$3(e,""):$Object$4(e)}:$Object$4,isNullOrUndefined$6=function(e){return null==e},isNullOrUndefined$5=isNullOrUndefined$6,$TypeError$k=TypeError,requireObjectCoercible$8=function(e){if(isNullOrUndefined$5(e))throw $TypeError$k("Can't call method on "+e);return e},IndexedObject$3=indexedObject,requireObjectCoercible$7=requireObjectCoercible$8,toIndexedObject$c=function(e){return IndexedObject$3(requireObjectCoercible$7(e))},isCallable$o=isCallable$p,$documentAll=documentAll_1,documentAll=$documentAll.all,isObject$o=$documentAll.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:isCallable$o(e)||e===documentAll}:function(e){return"object"==typeof e?null!==e:isCallable$o(e)},path$x={},path$w=path$x,global$o=global$p,isCallable$n=isCallable$p,aFunction=function(e){return isCallable$n(e)?e:void 0},getBuiltIn$h=function(e,t){return arguments.length<2?aFunction(path$w[e])||aFunction(global$o[e]):path$w[e]&&path$w[e][t]||global$o[e]&&global$o[e][t]},uncurryThis$A=functionUncurryThis,objectIsPrototypeOf=uncurryThis$A({}.isPrototypeOf),engineUserAgent="undefined"!=typeof navigator&&String(navigator.userAgent)||"",global$n=global$p,userAgent$6=engineUserAgent,process$4=global$n.process,Deno$1=global$n.Deno,versions=process$4&&process$4.versions||Deno$1&&Deno$1.version,v8=versions&&versions.v8;v8&&(version$1=(match=v8.split("."))[0]>0&&match[0]<4?1:+(match[0]+match[1])),!version$1&&userAgent$6&&(!(match=userAgent$6.match(/Edge\/(\d+)/))||match[1]>=74)&&(match=userAgent$6.match(/Chrome\/(\d+)/))&&(version$1=+match[1]);var engineV8Version=version$1,V8_VERSION$3=engineV8Version,fails$x=fails$B,global$m=global$p,$String$5=global$m.String,symbolConstructorDetection=!!Object.getOwnPropertySymbols&&!fails$x((function(){var e=Symbol();return!$String$5(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&V8_VERSION$3&&V8_VERSION$3<41})),NATIVE_SYMBOL$5=symbolConstructorDetection,useSymbolAsUid=NATIVE_SYMBOL$5&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,getBuiltIn$g=getBuiltIn$h,isCallable$m=isCallable$p,isPrototypeOf$u=objectIsPrototypeOf,USE_SYMBOL_AS_UID$1=useSymbolAsUid,$Object$3=Object,isSymbol$6=USE_SYMBOL_AS_UID$1?function(e){return"symbol"==typeof e}:function(e){var t=getBuiltIn$g("Symbol");return isCallable$m(t)&&isPrototypeOf$u(t.prototype,$Object$3(e))},$String$4=String,tryToString$7=function(e){try{return $String$4(e)}catch(e){return"Object"}},isCallable$l=isCallable$p,tryToString$6=tryToString$7,$TypeError$j=TypeError,aCallable$j=function(e){if(isCallable$l(e))return e;throw $TypeError$j(tryToString$6(e)+" is not a function")},aCallable$i=aCallable$j,isNullOrUndefined$4=isNullOrUndefined$6,getMethod$3=function(e,t){var r=e[t];return isNullOrUndefined$4(r)?void 0:aCallable$i(r)},call$p=functionCall,isCallable$k=isCallable$p,isObject$n=isObject$o,$TypeError$i=TypeError,ordinaryToPrimitive$1=function(e,t){var r,n;if("string"===t&&isCallable$k(r=e.toString)&&!isObject$n(n=call$p(r,e)))return n;if(isCallable$k(r=e.valueOf)&&!isObject$n(n=call$p(r,e)))return n;if("string"!==t&&isCallable$k(r=e.toString)&&!isObject$n(n=call$p(r,e)))return n;throw $TypeError$i("Can't convert object to primitive value")},shared$7={exports:{}},isPure=!0,global$l=global$p,defineProperty$e=Object.defineProperty,defineGlobalProperty$1=function(e,t){try{defineProperty$e(global$l,e,{value:t,configurable:!0,writable:!0})}catch(r){global$l[e]=t}return t},global$k=global$p,defineGlobalProperty=defineGlobalProperty$1,SHARED="__core-js_shared__",store$4=global$k[SHARED]||defineGlobalProperty(SHARED,{}),sharedStore=store$4,store$3=sharedStore;(shared$7.exports=function(e,t){return store$3[e]||(store$3[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.30.2",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.30.2/LICENSE",source:"https://github.com/zloirock/core-js"});var sharedExports=shared$7.exports,requireObjectCoercible$6=requireObjectCoercible$8,$Object$2=Object,toObject$e=function(e){return $Object$2(requireObjectCoercible$6(e))},uncurryThis$z=functionUncurryThis,toObject$d=toObject$e,hasOwnProperty=uncurryThis$z({}.hasOwnProperty),hasOwnProperty_1=Object.hasOwn||function(e,t){return hasOwnProperty(toObject$d(e),t)},uncurryThis$y=functionUncurryThis,id$1=0,postfix=Math.random(),toString$g=uncurryThis$y(1..toString),uid$4=function(e){return"Symbol("+(void 0===e?"":e)+")_"+toString$g(++id$1+postfix,36)},global$j=global$p,shared$6=sharedExports,hasOwn$m=hasOwnProperty_1,uid$3=uid$4,NATIVE_SYMBOL$4=symbolConstructorDetection,USE_SYMBOL_AS_UID=useSymbolAsUid,Symbol$5=global$j.Symbol,WellKnownSymbolsStore$2=shared$6("wks"),createWellKnownSymbol=USE_SYMBOL_AS_UID?Symbol$5.for||Symbol$5:Symbol$5&&Symbol$5.withoutSetter||uid$3,wellKnownSymbol$q=function(e){return hasOwn$m(WellKnownSymbolsStore$2,e)||(WellKnownSymbolsStore$2[e]=NATIVE_SYMBOL$4&&hasOwn$m(Symbol$5,e)?Symbol$5[e]:createWellKnownSymbol("Symbol."+e)),WellKnownSymbolsStore$2[e]},call$o=functionCall,isObject$m=isObject$o,isSymbol$5=isSymbol$6,getMethod$2=getMethod$3,ordinaryToPrimitive=ordinaryToPrimitive$1,wellKnownSymbol$p=wellKnownSymbol$q,$TypeError$h=TypeError,TO_PRIMITIVE=wellKnownSymbol$p("toPrimitive"),toPrimitive$7=function(e,t){if(!isObject$m(e)||isSymbol$5(e))return e;var r,n=getMethod$2(e,TO_PRIMITIVE);if(n){if(void 0===t&&(t="default"),r=call$o(n,e,t),!isObject$m(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$6=toPrimitive$7,isSymbol$4=isSymbol$6,toPropertyKey$4=function(e){var t=toPrimitive$6(e,"string");return isSymbol$4(t)?t:t+""},global$i=global$p,isObject$l=isObject$o,document$3=global$i.document,EXISTS$1=isObject$l(document$3)&&isObject$l(document$3.createElement),documentCreateElement$1=function(e){return EXISTS$1?document$3.createElement(e):{}},DESCRIPTORS$l=descriptors,fails$w=fails$B,createElement$1=documentCreateElement$1,ie8DomDefine=!DESCRIPTORS$l&&!fails$w((function(){return 7!=Object.defineProperty(createElement$1("div"),"a",{get:function(){return 7}}).a})),DESCRIPTORS$k=descriptors,call$n=functionCall,propertyIsEnumerableModule$2=objectPropertyIsEnumerable,createPropertyDescriptor$7=createPropertyDescriptor$8,toIndexedObject$b=toIndexedObject$c,toPropertyKey$3=toPropertyKey$4,hasOwn$l=hasOwnProperty_1,IE8_DOM_DEFINE$1=ie8DomDefine,$getOwnPropertyDescriptor$2=Object.getOwnPropertyDescriptor;objectGetOwnPropertyDescriptor.f=DESCRIPTORS$k?$getOwnPropertyDescriptor$2:function(e,t){if(e=toIndexedObject$b(e),t=toPropertyKey$3(t),IE8_DOM_DEFINE$1)try{return $getOwnPropertyDescriptor$2(e,t)}catch(e){}if(hasOwn$l(e,t))return createPropertyDescriptor$7(!call$n(propertyIsEnumerableModule$2.f,e,t),e[t])};var fails$v=fails$B,isCallable$j=isCallable$p,replacement=/#|\.prototype\./,isForced$2=function(e,t){var r=data[normalize(e)];return r==POLYFILL||r!=NATIVE&&(isCallable$j(t)?fails$v(t):!!t)},normalize=isForced$2.normalize=function(e){return String(e).replace(replacement,".").toLowerCase()},data=isForced$2.data={},NATIVE=isForced$2.NATIVE="N",POLYFILL=isForced$2.POLYFILL="P",isForced_1=isForced$2,uncurryThis$x=functionUncurryThisClause,aCallable$h=aCallable$j,NATIVE_BIND$1=functionBindNative,bind$q=functionUncurryThisClause(functionUncurryThisClause.bind),functionBindContext=function(e,t){return aCallable$h(e),void 0===t?e:NATIVE_BIND$1?bind$q(e,t):function(){return e.apply(t,arguments)}},objectDefineProperty={},DESCRIPTORS$j=descriptors,fails$u=fails$B,v8PrototypeDefineBug=DESCRIPTORS$j&&fails$u((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),isObject$k=isObject$o,$String$3=String,$TypeError$g=TypeError,anObject$h=function(e){if(isObject$k(e))return e;throw $TypeError$g($String$3(e)+" is not an object")},DESCRIPTORS$i=descriptors,IE8_DOM_DEFINE=ie8DomDefine,V8_PROTOTYPE_DEFINE_BUG$1=v8PrototypeDefineBug,anObject$g=anObject$h,toPropertyKey$2=toPropertyKey$4,$TypeError$f=TypeError,$defineProperty$1=Object.defineProperty,$getOwnPropertyDescriptor$1=Object.getOwnPropertyDescriptor,ENUMERABLE="enumerable",CONFIGURABLE$1="configurable",WRITABLE="writable";objectDefineProperty.f=DESCRIPTORS$i?V8_PROTOTYPE_DEFINE_BUG$1?function(e,t,r){if(anObject$g(e),t=toPropertyKey$2(t),anObject$g(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$g(e),t=toPropertyKey$2(t),anObject$g(r),IE8_DOM_DEFINE)try{return $defineProperty$1(e,t,r)}catch(e){}if("get"in r||"set"in r)throw $TypeError$f("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var DESCRIPTORS$h=descriptors,definePropertyModule$4=objectDefineProperty,createPropertyDescriptor$6=createPropertyDescriptor$8,createNonEnumerableProperty$9=DESCRIPTORS$h?function(e,t,r){return definePropertyModule$4.f(e,t,createPropertyDescriptor$6(1,r))}:function(e,t,r){return e[t]=r,e},global$h=global$p,apply$5=functionApply,uncurryThis$w=functionUncurryThisClause,isCallable$i=isCallable$p,getOwnPropertyDescriptor$a=objectGetOwnPropertyDescriptor.f,isForced$1=isForced_1,path$v=path$x,bind$p=functionBindContext,createNonEnumerableProperty$8=createNonEnumerableProperty$9,hasOwn$k=hasOwnProperty_1,wrapConstructor=function(e){var t=function(r,n,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,i)}return apply$5(e,this,arguments)};return t.prototype=e.prototype,t},_export=function(e,t){var r,n,i,o,a,s,l,c,u,p=e.target,f=e.global,d=e.stat,h=e.proto,y=f?global$h:d?global$h[p]:(global$h[p]||{}).prototype,g=f?path$v:path$v[p]||createNonEnumerableProperty$8(path$v,p,{})[p],_=g.prototype;for(o in t)n=!(r=isForced$1(f?o:p+(d?".":"#")+o,e.forced))&&y&&hasOwn$k(y,o),s=g[o],n&&(l=e.dontCallGetSet?(u=getOwnPropertyDescriptor$a(y,o))&&u.value:y[o]),a=n&&l?l:t[o],n&&typeof s==typeof a||(c=e.bind&&n?bind$p(a,global$h):e.wrap&&n?wrapConstructor(a):h&&isCallable$i(a)?uncurryThis$w(a):a,(e.sham||a&&a.sham||s&&s.sham)&&createNonEnumerableProperty$8(c,"sham",!0),createNonEnumerableProperty$8(g,o,c),h&&(hasOwn$k(path$v,i=p+"Prototype")||createNonEnumerableProperty$8(path$v,i,{}),createNonEnumerableProperty$8(path$v[i],o,a),e.real&&_&&(r||!_[o])&&createNonEnumerableProperty$8(_,o,a)))},classof$f=classofRaw$2,isArray$d=Array.isArray||function(e){return"Array"==classof$f(e)},ceil$1=Math.ceil,floor$3=Math.floor,mathTrunc=Math.trunc||function(e){var t=+e;return(t>0?floor$3:ceil$1)(t)},trunc2=mathTrunc,toIntegerOrInfinity$6=function(e){var t=+e;return t!=t||0===t?0:trunc2(t)},toIntegerOrInfinity$5=toIntegerOrInfinity$6,min$4=Math.min,toLength$3=function(e){return e>0?min$4(toIntegerOrInfinity$5(e),9007199254740991):0},toLength$2=toLength$3,lengthOfArrayLike$d=function(e){return toLength$2(e.length)},$TypeError$e=TypeError,MAX_SAFE_INTEGER=9007199254740991,doesNotExceedSafeInteger$3=function(e){if(e>MAX_SAFE_INTEGER)throw $TypeError$e("Maximum allowed index exceeded");return e},toPropertyKey$1=toPropertyKey$4,definePropertyModule$3=objectDefineProperty,createPropertyDescriptor$5=createPropertyDescriptor$8,createProperty$6=function(e,t,r){var n=toPropertyKey$1(t);n in e?definePropertyModule$3.f(e,n,createPropertyDescriptor$5(0,r)):e[n]=r},wellKnownSymbol$o=wellKnownSymbol$q,TO_STRING_TAG$4=wellKnownSymbol$o("toStringTag"),test$2={};test$2[TO_STRING_TAG$4]="z";var toStringTagSupport="[object z]"===String(test$2),TO_STRING_TAG_SUPPORT$2=toStringTagSupport,isCallable$h=isCallable$p,classofRaw=classofRaw$2,wellKnownSymbol$n=wellKnownSymbol$q,TO_STRING_TAG$3=wellKnownSymbol$n("toStringTag"),$Object$1=Object,CORRECT_ARGUMENTS="Arguments"==classofRaw(function(){return arguments}()),tryGet=function(e,t){try{return e[t]}catch(e){}},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$h(t.callee)?"Arguments":n},uncurryThis$v=functionUncurryThis,isCallable$g=isCallable$p,store$2=sharedStore,functionToString=uncurryThis$v(Function.toString);isCallable$g(store$2.inspectSource)||(store$2.inspectSource=function(e){return functionToString(e)});var inspectSource$2=store$2.inspectSource,uncurryThis$u=functionUncurryThis,fails$t=fails$B,isCallable$f=isCallable$p,classof$d=classof$e,getBuiltIn$f=getBuiltIn$h,inspectSource$1=inspectSource$2,noop=function(){},empty=[],construct$7=getBuiltIn$f("Reflect","construct"),constructorRegExp=/^\s*(?:class|function)\b/,exec$4=uncurryThis$u(constructorRegExp.exec),INCORRECT_TO_STRING=!constructorRegExp.exec(noop),isConstructorModern=function(e){if(!isCallable$f(e))return!1;try{return construct$7(noop,empty,e),!0}catch(e){return!1}},isConstructorLegacy=function(e){if(!isCallable$f(e))return!1;switch(classof$d(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return INCORRECT_TO_STRING||!!exec$4(constructorRegExp,inspectSource$1(e))}catch(e){return!0}};isConstructorLegacy.sham=!0;var isConstructor$4=!construct$7||fails$t((function(){var e;return isConstructorModern(isConstructorModern.call)||!isConstructorModern(Object)||!isConstructorModern((function(){e=!0}))||e}))?isConstructorLegacy:isConstructorModern,isArray$c=isArray$d,isConstructor$3=isConstructor$4,isObject$j=isObject$o,wellKnownSymbol$m=wellKnownSymbol$q,SPECIES$5=wellKnownSymbol$m("species"),$Array$3=Array,arraySpeciesConstructor$1=function(e){var t;return isArray$c(e)&&(t=e.constructor,(isConstructor$3(t)&&(t===$Array$3||isArray$c(t.prototype))||isObject$j(t)&&null===(t=t[SPECIES$5]))&&(t=void 0)),void 0===t?$Array$3:t},arraySpeciesConstructor=arraySpeciesConstructor$1,arraySpeciesCreate$3=function(e,t){return new(arraySpeciesConstructor(e))(0===t?0:t)},fails$s=fails$B,wellKnownSymbol$l=wellKnownSymbol$q,V8_VERSION$2=engineV8Version,SPECIES$4=wellKnownSymbol$l("species"),arrayMethodHasSpeciesSupport$5=function(e){return V8_VERSION$2>=51||!fails$s((function(){var t=[];return(t.constructor={})[SPECIES$4]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},$$1p=_export,fails$r=fails$B,isArray$b=isArray$d,isObject$i=isObject$o,toObject$c=toObject$e,lengthOfArrayLike$c=lengthOfArrayLike$d,doesNotExceedSafeInteger$2=doesNotExceedSafeInteger$3,createProperty$5=createProperty$6,arraySpeciesCreate$2=arraySpeciesCreate$3,arrayMethodHasSpeciesSupport$4=arrayMethodHasSpeciesSupport$5,wellKnownSymbol$k=wellKnownSymbol$q,V8_VERSION$1=engineV8Version,IS_CONCAT_SPREADABLE=wellKnownSymbol$k("isConcatSpreadable"),IS_CONCAT_SPREADABLE_SUPPORT=V8_VERSION$1>=51||!fails$r((function(){var e=[];return e[IS_CONCAT_SPREADABLE]=!1,e.concat()[0]!==e})),isConcatSpreadable=function(e){if(!isObject$i(e))return!1;var t=e[IS_CONCAT_SPREADABLE];return void 0!==t?!!t:isArray$b(e)},FORCED$a=!IS_CONCAT_SPREADABLE_SUPPORT||!arrayMethodHasSpeciesSupport$4("concat");$$1p({target:"Array",proto:!0,arity:1,forced:FORCED$a},{concat:function(e){var t,r,n,i,o,a=toObject$c(this),s=arraySpeciesCreate$2(a,0),l=0;for(t=-1,n=arguments.length;t<n;t++)if(isConcatSpreadable(o=-1===t?a:arguments[t]))for(i=lengthOfArrayLike$c(o),doesNotExceedSafeInteger$2(l+i),r=0;r<i;r++,l++)r in o&&createProperty$5(s,l,o[r]);else doesNotExceedSafeInteger$2(l+1),createProperty$5(s,l++,o);return s.length=l,s}});var classof$c=classof$e,$String$2=String,toString$f=function(e){if("Symbol"===classof$c(e))throw TypeError("Cannot convert a Symbol value to a string");return $String$2(e)},objectDefineProperties={},toIntegerOrInfinity$4=toIntegerOrInfinity$6,max$3=Math.max,min$3=Math.min,toAbsoluteIndex$6=function(e,t){var r=toIntegerOrInfinity$4(e);return r<0?max$3(r+t,0):min$3(r,t)},toIndexedObject$a=toIndexedObject$c,toAbsoluteIndex$5=toAbsoluteIndex$6,lengthOfArrayLike$b=lengthOfArrayLike$d,createMethod$6=function(e){return function(t,r,n){var i,o=toIndexedObject$a(t),a=lengthOfArrayLike$b(o),s=toAbsoluteIndex$5(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)},hiddenKeys$6={},uncurryThis$t=functionUncurryThis,hasOwn$j=hasOwnProperty_1,toIndexedObject$9=toIndexedObject$c,indexOf$7=arrayIncludes.indexOf,hiddenKeys$5=hiddenKeys$6,push$i=uncurryThis$t([].push),objectKeysInternal=function(e,t){var r,n=toIndexedObject$9(e),i=0,o=[];for(r in n)!hasOwn$j(hiddenKeys$5,r)&&hasOwn$j(n,r)&&push$i(o,r);for(;t.length>i;)hasOwn$j(n,r=t[i++])&&(~indexOf$7(o,r)||push$i(o,r));return o},enumBugKeys$3=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],internalObjectKeys$1=objectKeysInternal,enumBugKeys$2=enumBugKeys$3,objectKeys$4=Object.keys||function(e){return internalObjectKeys$1(e,enumBugKeys$2)},DESCRIPTORS$g=descriptors,V8_PROTOTYPE_DEFINE_BUG=v8PrototypeDefineBug,definePropertyModule$2=objectDefineProperty,anObject$f=anObject$h,toIndexedObject$8=toIndexedObject$c,objectKeys$3=objectKeys$4;objectDefineProperties.f=DESCRIPTORS$g&&!V8_PROTOTYPE_DEFINE_BUG?Object.defineProperties:function(e,t){anObject$f(e);for(var r,n=toIndexedObject$8(t),i=objectKeys$3(t),o=i.length,a=0;o>a;)definePropertyModule$2.f(e,r=i[a++],n[r]);return e};var activeXDocument,getBuiltIn$e=getBuiltIn$h,html$2=getBuiltIn$e("document","documentElement"),shared$5=sharedExports,uid$2=uid$4,keys$d=shared$5("keys"),sharedKey$4=function(e){return keys$d[e]||(keys$d[e]=uid$2(e))},anObject$e=anObject$h,definePropertiesModule$1=objectDefineProperties,enumBugKeys$1=enumBugKeys$3,hiddenKeys$4=hiddenKeys$6,html$1=html$2,documentCreateElement=documentCreateElement$1,sharedKey$3=sharedKey$4,GT=">",LT="<",PROTOTYPE$1="prototype",SCRIPT="script",IE_PROTO$1=sharedKey$3("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("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},NullProtoObject=function(){try{activeXDocument=new ActiveXObject("htmlfile")}catch(e){}NullProtoObject="undefined"!=typeof document?document.domain&&activeXDocument?NullProtoObjectViaActiveX(activeXDocument):NullProtoObjectViaIFrame():NullProtoObjectViaActiveX(activeXDocument);for(var e=enumBugKeys$1.length;e--;)delete NullProtoObject[PROTOTYPE$1][enumBugKeys$1[e]];return NullProtoObject()};hiddenKeys$4[IE_PROTO$1]=!0;var objectCreate=Object.create||function(e,t){var r;return null!==e?(EmptyConstructor[PROTOTYPE$1]=anObject$e(e),r=new EmptyConstructor,EmptyConstructor[PROTOTYPE$1]=null,r[IE_PROTO$1]=e):r=NullProtoObject(),void 0===t?r:definePropertiesModule$1.f(r,t)},objectGetOwnPropertyNames={},internalObjectKeys=objectKeysInternal,enumBugKeys=enumBugKeys$3,hiddenKeys$3=enumBugKeys.concat("length","prototype");objectGetOwnPropertyNames.f=Object.getOwnPropertyNames||function(e){return internalObjectKeys(e,hiddenKeys$3)};var objectGetOwnPropertyNamesExternal={},toAbsoluteIndex$4=toAbsoluteIndex$6,lengthOfArrayLike$a=lengthOfArrayLike$d,createProperty$4=createProperty$6,$Array$2=Array,max$2=Math.max,arraySliceSimple=function(e,t,r){for(var n=lengthOfArrayLike$a(e),i=toAbsoluteIndex$4(t,n),o=toAbsoluteIndex$4(void 0===r?n:r,n),a=$Array$2(max$2(o-i,0)),s=0;i<o;i++,s++)createProperty$4(a,s,e[i]);return a.length=s,a},classof$b=classofRaw$2,toIndexedObject$7=toIndexedObject$c,$getOwnPropertyNames$1=objectGetOwnPropertyNames.f,arraySlice$7=arraySliceSimple,windowNames="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],getWindowNames=function(e){try{return $getOwnPropertyNames$1(e)}catch(e){return arraySlice$7(windowNames)}};objectGetOwnPropertyNamesExternal.f=function(e){return windowNames&&"Window"==classof$b(e)?getWindowNames(e):$getOwnPropertyNames$1(toIndexedObject$7(e))};var objectGetOwnPropertySymbols={};objectGetOwnPropertySymbols.f=Object.getOwnPropertySymbols;var createNonEnumerableProperty$7=createNonEnumerableProperty$9,defineBuiltIn$8=function(e,t,r,n){return n&&n.enumerable?e[t]=r:createNonEnumerableProperty$7(e,t,r),e},defineProperty$d=objectDefineProperty,defineBuiltInAccessor$5=function(e,t,r){return defineProperty$d.f(e,t,r)},wellKnownSymbolWrapped={},wellKnownSymbol$j=wellKnownSymbol$q;wellKnownSymbolWrapped.f=wellKnownSymbol$j;var set$7,get$9,has$2,path$u=path$x,hasOwn$i=hasOwnProperty_1,wrappedWellKnownSymbolModule$1=wellKnownSymbolWrapped,defineProperty$c=objectDefineProperty.f,wellKnownSymbolDefine=function(e){var t=path$u.Symbol||(path$u.Symbol={});hasOwn$i(t,e)||defineProperty$c(t,e,{value:wrappedWellKnownSymbolModule$1.f(e)})},call$m=functionCall,getBuiltIn$d=getBuiltIn$h,wellKnownSymbol$i=wellKnownSymbol$q,defineBuiltIn$7=defineBuiltIn$8,symbolDefineToPrimitive=function(){var e=getBuiltIn$d("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=wellKnownSymbol$i("toPrimitive");t&&!t[n]&&defineBuiltIn$7(t,n,(function(e){return call$m(r,this)}),{arity:1})},TO_STRING_TAG_SUPPORT$1=toStringTagSupport,classof$a=classof$e,objectToString$1=TO_STRING_TAG_SUPPORT$1?{}.toString:function(){return"[object "+classof$a(this)+"]"},TO_STRING_TAG_SUPPORT=toStringTagSupport,defineProperty$b=objectDefineProperty.f,createNonEnumerableProperty$6=createNonEnumerableProperty$9,hasOwn$h=hasOwnProperty_1,toString$e=objectToString$1,wellKnownSymbol$h=wellKnownSymbol$q,TO_STRING_TAG$2=wellKnownSymbol$h("toStringTag"),setToStringTag$9=function(e,t,r,n){if(e){var i=r?e:e.prototype;hasOwn$h(i,TO_STRING_TAG$2)||defineProperty$b(i,TO_STRING_TAG$2,{configurable:!0,value:t}),n&&!TO_STRING_TAG_SUPPORT&&createNonEnumerableProperty$6(i,"toString",toString$e)}},global$g=global$p,isCallable$e=isCallable$p,WeakMap$1=global$g.WeakMap,weakMapBasicDetection=isCallable$e(WeakMap$1)&&/native code/.test(String(WeakMap$1)),NATIVE_WEAK_MAP=weakMapBasicDetection,global$f=global$p,isObject$h=isObject$o,createNonEnumerableProperty$5=createNonEnumerableProperty$9,hasOwn$g=hasOwnProperty_1,shared$4=sharedStore,sharedKey$2=sharedKey$4,hiddenKeys$2=hiddenKeys$6,OBJECT_ALREADY_INITIALIZED="Object already initialized",TypeError$5=global$f.TypeError,WeakMap=global$f.WeakMap,enforce=function(e){return has$2(e)?get$9(e):set$7(e,{})},getterFor=function(e){return function(t){var r;if(!isObject$h(t)||(r=get$9(t)).type!==e)throw TypeError$5("Incompatible receiver, "+e+" required");return r}};if(NATIVE_WEAK_MAP||shared$4.state){var store$1=shared$4.state||(shared$4.state=new WeakMap);store$1.get=store$1.get,store$1.has=store$1.has,store$1.set=store$1.set,set$7=function(e,t){if(store$1.has(e))throw TypeError$5(OBJECT_ALREADY_INITIALIZED);return t.facade=e,store$1.set(e,t),t},get$9=function(e){return store$1.get(e)||{}},has$2=function(e){return store$1.has(e)}}else{var STATE=sharedKey$2("state");hiddenKeys$2[STATE]=!0,set$7=function(e,t){if(hasOwn$g(e,STATE))throw TypeError$5(OBJECT_ALREADY_INITIALIZED);return t.facade=e,createNonEnumerableProperty$5(e,STATE,t),t},get$9=function(e){return hasOwn$g(e,STATE)?e[STATE]:{}},has$2=function(e){return hasOwn$g(e,STATE)}}var internalState={set:set$7,get:get$9,has:has$2,enforce:enforce,getterFor:getterFor},bind$o=functionBindContext,uncurryThis$s=functionUncurryThis,IndexedObject$2=indexedObject,toObject$b=toObject$e,lengthOfArrayLike$9=lengthOfArrayLike$d,arraySpeciesCreate$1=arraySpeciesCreate$3,push$h=uncurryThis$s([].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,p){for(var f,d,h=toObject$b(l),y=IndexedObject$2(h),g=bind$o(c,u),_=lengthOfArrayLike$9(y),v=0,m=p||arraySpeciesCreate$1,$=t?m(l,_):r||a?m(l,0):void 0;_>v;v++)if((s||v in y)&&(d=g(f=y[v],v,h),e))if(t)$[v]=d;else if(d)switch(e){case 3:return!0;case 5:return f;case 6:return v;case 2:push$h($,f)}else switch(e){case 4:return!1;case 7:push$h($,f)}return o?-1:n||i?i:$}},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)},$$1o=_export,global$e=global$p,call$l=functionCall,uncurryThis$r=functionUncurryThis,DESCRIPTORS$f=descriptors,NATIVE_SYMBOL$3=symbolConstructorDetection,fails$q=fails$B,hasOwn$f=hasOwnProperty_1,isPrototypeOf$t=objectIsPrototypeOf,anObject$d=anObject$h,toIndexedObject$6=toIndexedObject$c,toPropertyKey=toPropertyKey$4,$toString$2=toString$f,createPropertyDescriptor$4=createPropertyDescriptor$8,nativeObjectCreate=objectCreate,objectKeys$2=objectKeys$4,getOwnPropertyNamesModule$2=objectGetOwnPropertyNames,getOwnPropertyNamesExternal=objectGetOwnPropertyNamesExternal,getOwnPropertySymbolsModule$3=objectGetOwnPropertySymbols,getOwnPropertyDescriptorModule$3=objectGetOwnPropertyDescriptor,definePropertyModule$1=objectDefineProperty,definePropertiesModule=objectDefineProperties,propertyIsEnumerableModule$1=objectPropertyIsEnumerable,defineBuiltIn$6=defineBuiltIn$8,defineBuiltInAccessor$4=defineBuiltInAccessor$5,shared$3=sharedExports,sharedKey$1=sharedKey$4,hiddenKeys$1=hiddenKeys$6,uid$1=uid$4,wellKnownSymbol$g=wellKnownSymbol$q,wrappedWellKnownSymbolModule=wellKnownSymbolWrapped,defineWellKnownSymbol$l=wellKnownSymbolDefine,defineSymbolToPrimitive$1=symbolDefineToPrimitive,setToStringTag$8=setToStringTag$9,InternalStateModule$7=internalState,$forEach$1=arrayIteration.forEach,HIDDEN=sharedKey$1("hidden"),SYMBOL="Symbol",PROTOTYPE="prototype",setInternalState$7=InternalStateModule$7.set,getInternalState$2=InternalStateModule$7.getterFor(SYMBOL),ObjectPrototype$2=Object[PROTOTYPE],$Symbol=global$e.Symbol,SymbolPrototype=$Symbol&&$Symbol[PROTOTYPE],TypeError$4=global$e.TypeError,QObject=global$e.QObject,nativeGetOwnPropertyDescriptor$1=getOwnPropertyDescriptorModule$3.f,nativeDefineProperty=definePropertyModule$1.f,nativeGetOwnPropertyNames=getOwnPropertyNamesExternal.f,nativePropertyIsEnumerable=propertyIsEnumerableModule$1.f,push$g=uncurryThis$r([].push),AllSymbols=shared$3("symbols"),ObjectPrototypeSymbols=shared$3("op-symbols"),WellKnownSymbolsStore$1=shared$3("wks"),USE_SETTER=!QObject||!QObject[PROTOTYPE]||!QObject[PROTOTYPE].findChild,setSymbolDescriptor=DESCRIPTORS$f&&fails$q((function(){return 7!=nativeObjectCreate(nativeDefineProperty({},"a",{get:function(){return nativeDefineProperty(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=nativeGetOwnPropertyDescriptor$1(ObjectPrototype$2,t);n&&delete ObjectPrototype$2[t],nativeDefineProperty(e,t,r),n&&e!==ObjectPrototype$2&&nativeDefineProperty(ObjectPrototype$2,t,n)}:nativeDefineProperty,wrap=function(e,t){var r=AllSymbols[e]=nativeObjectCreate(SymbolPrototype);return setInternalState$7(r,{type:SYMBOL,tag:e,description:t}),DESCRIPTORS$f||(r.description=t),r},$defineProperty=function(e,t,r){e===ObjectPrototype$2&&$defineProperty(ObjectPrototypeSymbols,t,r),anObject$d(e);var n=toPropertyKey(t);return anObject$d(r),hasOwn$f(AllSymbols,n)?(r.enumerable?(hasOwn$f(e,HIDDEN)&&e[HIDDEN][n]&&(e[HIDDEN][n]=!1),r=nativeObjectCreate(r,{enumerable:createPropertyDescriptor$4(0,!1)})):(hasOwn$f(e,HIDDEN)||nativeDefineProperty(e,HIDDEN,createPropertyDescriptor$4(1,{})),e[HIDDEN][n]=!0),setSymbolDescriptor(e,n,r)):nativeDefineProperty(e,n,r)},$defineProperties=function(e,t){anObject$d(e);var r=toIndexedObject$6(t),n=objectKeys$2(r).concat($getOwnPropertySymbols(r));return $forEach$1(n,(function(t){DESCRIPTORS$f&&!call$l($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(e),r=call$l(nativePropertyIsEnumerable,this,t);return!(this===ObjectPrototype$2&&hasOwn$f(AllSymbols,t)&&!hasOwn$f(ObjectPrototypeSymbols,t))&&(!(r||!hasOwn$f(this,t)||!hasOwn$f(AllSymbols,t)||hasOwn$f(this,HIDDEN)&&this[HIDDEN][t])||r)},$getOwnPropertyDescriptor=function(e,t){var r=toIndexedObject$6(e),n=toPropertyKey(t);if(r!==ObjectPrototype$2||!hasOwn$f(AllSymbols,n)||hasOwn$f(ObjectPrototypeSymbols,n)){var i=nativeGetOwnPropertyDescriptor$1(r,n);return!i||!hasOwn$f(AllSymbols,n)||hasOwn$f(r,HIDDEN)&&r[HIDDEN][n]||(i.enumerable=!0),i}},$getOwnPropertyNames=function(e){var t=nativeGetOwnPropertyNames(toIndexedObject$6(e)),r=[];return $forEach$1(t,(function(e){hasOwn$f(AllSymbols,e)||hasOwn$f(hiddenKeys$1,e)||push$g(r,e)})),r},$getOwnPropertySymbols=function(e){var t=e===ObjectPrototype$2,r=nativeGetOwnPropertyNames(t?ObjectPrototypeSymbols:toIndexedObject$6(e)),n=[];return $forEach$1(r,(function(e){!hasOwn$f(AllSymbols,e)||t&&!hasOwn$f(ObjectPrototype$2,e)||push$g(n,AllSymbols[e])})),n};NATIVE_SYMBOL$3||(defineBuiltIn$6(SymbolPrototype=($Symbol=function(){if(isPrototypeOf$t(SymbolPrototype,this))throw TypeError$4("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?$toString$2(arguments[0]):void 0,t=uid$1(e),r=function(e){this===ObjectPrototype$2&&call$l(r,ObjectPrototypeSymbols,e),hasOwn$f(this,HIDDEN)&&hasOwn$f(this[HIDDEN],t)&&(this[HIDDEN][t]=!1),setSymbolDescriptor(this,t,createPropertyDescriptor$4(1,e))};return DESCRIPTORS$f&&USE_SETTER&&setSymbolDescriptor(ObjectPrototype$2,t,{configurable:!0,set:r}),wrap(t,e)})[PROTOTYPE],"toString",(function(){return getInternalState$2(this).tag})),defineBuiltIn$6($Symbol,"withoutSetter",(function(e){return wrap(uid$1(e),e)})),propertyIsEnumerableModule$1.f=$propertyIsEnumerable$1,definePropertyModule$1.f=$defineProperty,definePropertiesModule.f=$defineProperties,getOwnPropertyDescriptorModule$3.f=$getOwnPropertyDescriptor,getOwnPropertyNamesModule$2.f=getOwnPropertyNamesExternal.f=$getOwnPropertyNames,getOwnPropertySymbolsModule$3.f=$getOwnPropertySymbols,wrappedWellKnownSymbolModule.f=function(e){return wrap(wellKnownSymbol$g(e),e)},DESCRIPTORS$f&&defineBuiltInAccessor$4(SymbolPrototype,"description",{configurable:!0,get:function(){return getInternalState$2(this).description}})),$$1o({global:!0,constructor:!0,wrap:!0,forced:!NATIVE_SYMBOL$3,sham:!NATIVE_SYMBOL$3},{Symbol:$Symbol}),$forEach$1(objectKeys$2(WellKnownSymbolsStore$1),(function(e){defineWellKnownSymbol$l(e)})),$$1o({target:SYMBOL,stat:!0,forced:!NATIVE_SYMBOL$3},{useSetter:function(){USE_SETTER=!0},useSimple:function(){USE_SETTER=!1}}),$$1o({target:"Object",stat:!0,forced:!NATIVE_SYMBOL$3,sham:!DESCRIPTORS$f},{create:$create,defineProperty:$defineProperty,defineProperties:$defineProperties,getOwnPropertyDescriptor:$getOwnPropertyDescriptor}),$$1o({target:"Object",stat:!0,forced:!NATIVE_SYMBOL$3},{getOwnPropertyNames:$getOwnPropertyNames}),defineSymbolToPrimitive$1(),setToStringTag$8($Symbol,SYMBOL),hiddenKeys$1[HIDDEN]=!0;var NATIVE_SYMBOL$2=symbolConstructorDetection,symbolRegistryDetection=NATIVE_SYMBOL$2&&!!Symbol.for&&!!Symbol.keyFor,$$1n=_export,getBuiltIn$c=getBuiltIn$h,hasOwn$e=hasOwnProperty_1,toString$d=toString$f,shared$2=sharedExports,NATIVE_SYMBOL_REGISTRY$1=symbolRegistryDetection,StringToSymbolRegistry=shared$2("string-to-symbol-registry"),SymbolToStringRegistry$1=shared$2("symbol-to-string-registry");$$1n({target:"Symbol",stat:!0,forced:!NATIVE_SYMBOL_REGISTRY$1},{for:function(e){var t=toString$d(e);if(hasOwn$e(StringToSymbolRegistry,t))return StringToSymbolRegistry[t];var r=getBuiltIn$c("Symbol")(t);return StringToSymbolRegistry[t]=r,SymbolToStringRegistry$1[r]=t,r}});var $$1m=_export,hasOwn$d=hasOwnProperty_1,isSymbol$3=isSymbol$6,tryToString$5=tryToString$7,shared$1=sharedExports,NATIVE_SYMBOL_REGISTRY=symbolRegistryDetection,SymbolToStringRegistry=shared$1("symbol-to-string-registry");$$1m({target:"Symbol",stat:!0,forced:!NATIVE_SYMBOL_REGISTRY},{keyFor:function(e){if(!isSymbol$3(e))throw TypeError(tryToString$5(e)+" is not a symbol");if(hasOwn$d(SymbolToStringRegistry,e))return SymbolToStringRegistry[e]}});var uncurryThis$q=functionUncurryThis,arraySlice$6=uncurryThis$q([].slice),uncurryThis$p=functionUncurryThis,isArray$a=isArray$d,isCallable$d=isCallable$p,classof$9=classofRaw$2,toString$c=toString$f,push$f=uncurryThis$p([].push),getJsonReplacerFunction=function(e){if(isCallable$d(e))return e;if(isArray$a(e)){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];"string"==typeof i?push$f(r,i):"number"!=typeof i&&"Number"!=classof$9(i)&&"String"!=classof$9(i)||push$f(r,toString$c(i))}var o=r.length,a=!0;return function(e,t){if(a)return a=!1,t;if(isArray$a(this))return t;for(var n=0;n<o;n++)if(r[n]===e)return t}}},$$1l=_export,getBuiltIn$b=getBuiltIn$h,apply$4=functionApply,call$k=functionCall,uncurryThis$o=functionUncurryThis,fails$p=fails$B,isCallable$c=isCallable$p,isSymbol$2=isSymbol$6,arraySlice$5=arraySlice$6,getReplacerFunction=getJsonReplacerFunction,NATIVE_SYMBOL$1=symbolConstructorDetection,$String$1=String,$stringify=getBuiltIn$b("JSON","stringify"),exec$3=uncurryThis$o(/./.exec),charAt$5=uncurryThis$o("".charAt),charCodeAt$2=uncurryThis$o("".charCodeAt),replace$5=uncurryThis$o("".replace),numberToString$1=uncurryThis$o(1..toString),tester=/[\uD800-\uDFFF]/g,low=/^[\uD800-\uDBFF]$/,hi=/^[\uDC00-\uDFFF]$/,WRONG_SYMBOLS_CONVERSION=!NATIVE_SYMBOL$1||fails$p((function(){var e=getBuiltIn$b("Symbol")();return"[null]"!=$stringify([e])||"{}"!=$stringify({a:e})||"{}"!=$stringify(Object(e))})),ILL_FORMED_UNICODE=fails$p((function(){return'"\\udf06\\ud834"'!==$stringify("\udf06\ud834")||'"\\udead"'!==$stringify("\udead")})),stringifyWithSymbolsFix=function(e,t){var r=arraySlice$5(arguments),n=getReplacerFunction(t);if(isCallable$c(n)||void 0!==e&&!isSymbol$2(e))return r[1]=function(e,t){if(isCallable$c(n)&&(t=call$k(n,this,$String$1(e),t)),!isSymbol$2(t))return t},apply$4($stringify,null,r)},fixIllFormed=function(e,t,r){var n=charAt$5(r,t-1),i=charAt$5(r,t+1);return exec$3(low,e)&&!exec$3(hi,i)||exec$3(hi,e)&&!exec$3(low,n)?"\\u"+numberToString$1(charCodeAt$2(e,0),16):e};$stringify&&$$1l({target:"JSON",stat:!0,arity:3,forced:WRONG_SYMBOLS_CONVERSION||ILL_FORMED_UNICODE},{stringify:function(e,t,r){var n=arraySlice$5(arguments),i=apply$4(WRONG_SYMBOLS_CONVERSION?stringifyWithSymbolsFix:$stringify,null,n);return ILL_FORMED_UNICODE&&"string"==typeof i?replace$5(i,tester,fixIllFormed):i}});var $$1k=_export,NATIVE_SYMBOL=symbolConstructorDetection,fails$o=fails$B,getOwnPropertySymbolsModule$2=objectGetOwnPropertySymbols,toObject$a=toObject$e,FORCED$9=!NATIVE_SYMBOL||fails$o((function(){getOwnPropertySymbolsModule$2.f(1)}));$$1k({target:"Object",stat:!0,forced:FORCED$9},{getOwnPropertySymbols:function(e){var t=getOwnPropertySymbolsModule$2.f;return t?t(toObject$a(e)):[]}});var defineWellKnownSymbol$k=wellKnownSymbolDefine;defineWellKnownSymbol$k("asyncIterator");var defineWellKnownSymbol$j=wellKnownSymbolDefine;defineWellKnownSymbol$j("hasInstance");var defineWellKnownSymbol$i=wellKnownSymbolDefine;defineWellKnownSymbol$i("isConcatSpreadable");var defineWellKnownSymbol$h=wellKnownSymbolDefine;defineWellKnownSymbol$h("iterator");var defineWellKnownSymbol$g=wellKnownSymbolDefine;defineWellKnownSymbol$g("match");var defineWellKnownSymbol$f=wellKnownSymbolDefine;defineWellKnownSymbol$f("matchAll");var defineWellKnownSymbol$e=wellKnownSymbolDefine;defineWellKnownSymbol$e("replace");var defineWellKnownSymbol$d=wellKnownSymbolDefine;defineWellKnownSymbol$d("search");var defineWellKnownSymbol$c=wellKnownSymbolDefine;defineWellKnownSymbol$c("species");var defineWellKnownSymbol$b=wellKnownSymbolDefine;defineWellKnownSymbol$b("split");var defineWellKnownSymbol$a=wellKnownSymbolDefine,defineSymbolToPrimitive=symbolDefineToPrimitive;defineWellKnownSymbol$a("toPrimitive"),defineSymbolToPrimitive();var getBuiltIn$a=getBuiltIn$h,defineWellKnownSymbol$9=wellKnownSymbolDefine,setToStringTag$7=setToStringTag$9;defineWellKnownSymbol$9("toStringTag"),setToStringTag$7(getBuiltIn$a("Symbol"),"Symbol");var defineWellKnownSymbol$8=wellKnownSymbolDefine;defineWellKnownSymbol$8("unscopables");var global$d=global$p,setToStringTag$6=setToStringTag$9;setToStringTag$6(global$d.JSON,"JSON",!0);var IteratorPrototype$1,PrototypeOfArrayIteratorPrototype,arrayIterator,path$t=path$x,symbol$5=path$t.Symbol,iterators={},DESCRIPTORS$e=descriptors,hasOwn$c=hasOwnProperty_1,FunctionPrototype$1=Function.prototype,getDescriptor=DESCRIPTORS$e&&Object.getOwnPropertyDescriptor,EXISTS=hasOwn$c(FunctionPrototype$1,"name"),PROPER=EXISTS&&"something"===function(){}.name,CONFIGURABLE=EXISTS&&(!DESCRIPTORS$e||DESCRIPTORS$e&&getDescriptor(FunctionPrototype$1,"name").configurable),functionName={EXISTS:EXISTS,PROPER:PROPER,CONFIGURABLE:CONFIGURABLE},fails$n=fails$B,correctPrototypeGetter=!fails$n((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),hasOwn$b=hasOwnProperty_1,isCallable$b=isCallable$p,toObject$9=toObject$e,sharedKey=sharedKey$4,CORRECT_PROTOTYPE_GETTER$1=correctPrototypeGetter,IE_PROTO=sharedKey("IE_PROTO"),$Object=Object,ObjectPrototype$1=$Object.prototype,objectGetPrototypeOf=CORRECT_PROTOTYPE_GETTER$1?$Object.getPrototypeOf:function(e){var t=toObject$9(e);if(hasOwn$b(t,IE_PROTO))return t[IE_PROTO];var r=t.constructor;return isCallable$b(r)&&t instanceof r?r.prototype:t instanceof $Object?ObjectPrototype$1:null},fails$m=fails$B,isCallable$a=isCallable$p,isObject$g=isObject$o,create$d=objectCreate,getPrototypeOf$9=objectGetPrototypeOf,defineBuiltIn$5=defineBuiltIn$8,wellKnownSymbol$f=wellKnownSymbol$q,ITERATOR$8=wellKnownSymbol$f("iterator"),BUGGY_SAFARI_ITERATORS$1=!1;[].keys&&("next"in(arrayIterator=[].keys())?(PrototypeOfArrayIteratorPrototype=getPrototypeOf$9(getPrototypeOf$9(arrayIterator)))!==Object.prototype&&(IteratorPrototype$1=PrototypeOfArrayIteratorPrototype):BUGGY_SAFARI_ITERATORS$1=!0);var NEW_ITERATOR_PROTOTYPE=!isObject$g(IteratorPrototype$1)||fails$m((function(){var e={};return IteratorPrototype$1[ITERATOR$8].call(e)!==e}));isCallable$a((IteratorPrototype$1=NEW_ITERATOR_PROTOTYPE?{}:create$d(IteratorPrototype$1))[ITERATOR$8])||defineBuiltIn$5(IteratorPrototype$1,ITERATOR$8,(function(){return this}));var iteratorsCore={IteratorPrototype:IteratorPrototype$1,BUGGY_SAFARI_ITERATORS:BUGGY_SAFARI_ITERATORS$1},IteratorPrototype=iteratorsCore.IteratorPrototype,create$c=objectCreate,createPropertyDescriptor$3=createPropertyDescriptor$8,setToStringTag$5=setToStringTag$9,Iterators$5=iterators,returnThis$1=function(){return this},iteratorCreateConstructor=function(e,t,r,n){var i=t+" Iterator";return e.prototype=create$c(IteratorPrototype,{next:createPropertyDescriptor$3(+!n,r)}),setToStringTag$5(e,i,!1,!0),Iterators$5[i]=returnThis$1,e},uncurryThis$n=functionUncurryThis,aCallable$g=aCallable$j,functionUncurryThisAccessor=function(e,t,r){try{return uncurryThis$n(aCallable$g(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},isCallable$9=isCallable$p,$String=String,$TypeError$d=TypeError,aPossiblePrototype$1=function(e){if("object"==typeof e||isCallable$9(e))return e;throw $TypeError$d("Can't set "+$String(e)+" as a prototype")},uncurryThisAccessor=functionUncurryThisAccessor,anObject$c=anObject$h,aPossiblePrototype=aPossiblePrototype$1,objectSetPrototypeOf=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=uncurryThisAccessor(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return anObject$c(r),aPossiblePrototype(n),t?e(r,n):r.__proto__=n,r}}():void 0),$$1j=_export,call$j=functionCall,FunctionName=functionName,createIteratorConstructor$1=iteratorCreateConstructor,getPrototypeOf$8=objectGetPrototypeOf,setToStringTag$4=setToStringTag$9,defineBuiltIn$4=defineBuiltIn$8,wellKnownSymbol$e=wellKnownSymbol$q,Iterators$4=iterators,IteratorsCore=iteratorsCore,PROPER_FUNCTION_NAME$1=FunctionName.PROPER;FunctionName.CONFIGURABLE,IteratorsCore.IteratorPrototype;var BUGGY_SAFARI_ITERATORS=IteratorsCore.BUGGY_SAFARI_ITERATORS,ITERATOR$7=wellKnownSymbol$e("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&&y)return y;if(!BUGGY_SAFARI_ITERATORS&&e in d)return d[e];switch(e){case KEYS:case VALUES:case ENTRIES:return function(){return new r(this,e)}}return function(){return new r(this)}},p=t+" Iterator",f=!1,d=e.prototype,h=d[ITERATOR$7]||d["@@iterator"]||i&&d[i],y=!BUGGY_SAFARI_ITERATORS&&h||u(i),g="Array"==t&&d.entries||h;if(g&&(s=getPrototypeOf$8(g.call(new e)))!==Object.prototype&&s.next&&(setToStringTag$4(s,p,!0,!0),Iterators$4[p]=returnThis),PROPER_FUNCTION_NAME$1&&i==VALUES&&h&&h.name!==VALUES&&(f=!0,y=function(){return call$j(h,this)}),i)if(l={values:u(VALUES),keys:o?y:u(KEYS),entries:u(ENTRIES)},a)for(c in l)(BUGGY_SAFARI_ITERATORS||f||!(c in d))&&defineBuiltIn$4(d,c,l[c]);else $$1j({target:t,proto:!0,forced:BUGGY_SAFARI_ITERATORS||f},l);return a&&d[ITERATOR$7]!==y&&defineBuiltIn$4(d,ITERATOR$7,y,{name:i}),Iterators$4[t]=y,l},createIterResultObject$3=function(e,t){return{value:e,done:t}},toIndexedObject$5=toIndexedObject$c,Iterators$3=iterators,InternalStateModule$6=internalState;objectDefineProperty.f;var defineIterator$2=iteratorDefine,createIterResultObject$2=createIterResultObject$3,ARRAY_ITERATOR="Array Iterator",setInternalState$6=InternalStateModule$6.set,getInternalState$1=InternalStateModule$6.getterFor(ARRAY_ITERATOR);defineIterator$2(Array,"Array",(function(e,t){setInternalState$6(this,{type:ARRAY_ITERATOR,target:toIndexedObject$5(e),index:0,kind:t})}),(function(){var e=getInternalState$1(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,createIterResultObject$2(void 0,!0)):createIterResultObject$2("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),Iterators$3.Arguments=Iterators$3.Array;var 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},DOMIterables$3=domIterables,global$c=global$p,classof$8=classof$e,createNonEnumerableProperty$4=createNonEnumerableProperty$9,Iterators$2=iterators,wellKnownSymbol$d=wellKnownSymbol$q,TO_STRING_TAG$1=wellKnownSymbol$d("toStringTag");for(var COLLECTION_NAME in DOMIterables$3){var Collection=global$c[COLLECTION_NAME],CollectionPrototype=Collection&&Collection.prototype;CollectionPrototype&&classof$8(CollectionPrototype)!==TO_STRING_TAG$1&&createNonEnumerableProperty$4(CollectionPrototype,TO_STRING_TAG$1,COLLECTION_NAME),Iterators$2[COLLECTION_NAME]=Iterators$2.Array}var parent$2M=symbol$5,symbol$4=parent$2M,defineWellKnownSymbol$7=wellKnownSymbolDefine;defineWellKnownSymbol$7("dispose");var parent$2L=symbol$4,symbol$3=parent$2L,defineWellKnownSymbol$6=wellKnownSymbolDefine;defineWellKnownSymbol$6("asyncDispose");var $$1i=_export,getBuiltIn$9=getBuiltIn$h,uncurryThis$m=functionUncurryThis,Symbol$4=getBuiltIn$9("Symbol"),keyFor2=Symbol$4.keyFor,thisSymbolValue$1=uncurryThis$m(Symbol$4.prototype.valueOf);$$1i({target:"Symbol",stat:!0},{isRegistered:function(e){try{return void 0!==keyFor2(thisSymbolValue$1(e))}catch(e){return!1}}});for(var $$1h=_export,shared=sharedExports,getBuiltIn$8=getBuiltIn$h,uncurryThis$l=functionUncurryThis,isSymbol$1=isSymbol$6,wellKnownSymbol$c=wellKnownSymbol$q,Symbol$3=getBuiltIn$8("Symbol"),$isWellKnown=Symbol$3.isWellKnown,getOwnPropertyNames4=getBuiltIn$8("Object","getOwnPropertyNames"),thisSymbolValue=uncurryThis$l(Symbol$3.prototype.valueOf),WellKnownSymbolsStore=shared("wks"),i$2=0,symbolKeys=getOwnPropertyNames4(Symbol$3),symbolKeysLength=symbolKeys.length;i$2<symbolKeysLength;i$2++)try{var symbolKey=symbolKeys[i$2];isSymbol$1(Symbol$3[symbolKey])&&wellKnownSymbol$c(symbolKey)}catch(e){}$$1h({target:"Symbol",stat:!0,forced:!0},{isWellKnown:function(e){if($isWellKnown&&$isWellKnown(e))return!0;try{for(var t=thisSymbolValue(e),r=0,n=getOwnPropertyNames4(WellKnownSymbolsStore),i=n.length;r<i;r++)if(WellKnownSymbolsStore[n[r]]==t)return!0}catch(e){}return!1}});var defineWellKnownSymbol$5=wellKnownSymbolDefine;defineWellKnownSymbol$5("matcher");var defineWellKnownSymbol$4=wellKnownSymbolDefine;defineWellKnownSymbol$4("metadataKey");var defineWellKnownSymbol$3=wellKnownSymbolDefine;defineWellKnownSymbol$3("observable");var defineWellKnownSymbol$2=wellKnownSymbolDefine;defineWellKnownSymbol$2("metadata");var defineWellKnownSymbol$1=wellKnownSymbolDefine;defineWellKnownSymbol$1("patternMatch");var defineWellKnownSymbol=wellKnownSymbolDefine;defineWellKnownSymbol("replaceAll");var parent$2K=symbol$3,symbol$2=parent$2K,symbol$1=symbol$2,_Symbol$1=getDefaultExportFromCjs(symbol$1),uncurryThis$k=functionUncurryThis,toIntegerOrInfinity$3=toIntegerOrInfinity$6,toString$b=toString$f,requireObjectCoercible$5=requireObjectCoercible$8,charAt$4=uncurryThis$k("".charAt),charCodeAt$1=uncurryThis$k("".charCodeAt),stringSlice$4=uncurryThis$k("".slice),createMethod$4=function(e){return function(t,r){var n,i,o=toString$b(requireObjectCoercible$5(t)),a=toIntegerOrInfinity$3(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=charCodeAt$1(o,a))<55296||n>56319||a+1===s||(i=charCodeAt$1(o,a+1))<56320||i>57343?e?charAt$4(o,a):n:e?stringSlice$4(o,a,a+2):i-56320+(n-55296<<10)+65536}},stringMultibyte={codeAt:createMethod$4(!1),charAt:createMethod$4(!0)},charAt$3=stringMultibyte.charAt,toString$a=toString$f,InternalStateModule$5=internalState,defineIterator$1=iteratorDefine,createIterResultObject$1=createIterResultObject$3,STRING_ITERATOR="String Iterator",setInternalState$5=InternalStateModule$5.set,getInternalState=InternalStateModule$5.getterFor(STRING_ITERATOR);defineIterator$1(String,"String",(function(e){setInternalState$5(this,{type:STRING_ITERATOR,string:toString$a(e),index:0})}),(function(){var e,t=getInternalState(this),r=t.string,n=t.index;return n>=r.length?createIterResultObject$1(void 0,!0):(e=charAt$3(r,n),t.index+=e.length,createIterResultObject$1(e,!1))}));var WrappedWellKnownSymbolModule$2=wellKnownSymbolWrapped,iterator$5=WrappedWellKnownSymbolModule$2.f("iterator"),parent$2J=iterator$5,iterator$4=parent$2J,parent$2I=iterator$4,iterator$3=parent$2I,parent$2H=iterator$3,iterator$2=parent$2H,iterator$1=iterator$2,_Symbol$iterator$1=getDefaultExportFromCjs(iterator$1);function _typeof$1(e){return(_typeof$1="function"==typeof _Symbol$1&&"symbol"==typeof _Symbol$iterator$1?function(e){return typeof e}:function(e){return e&&"function"==typeof _Symbol$1&&e.constructor===_Symbol$1&&e!==_Symbol$1.prototype?"symbol":typeof e})(e)}var defineProperty$a={exports:{}},$$1g=_export,DESCRIPTORS$d=descriptors,defineProperty$9=objectDefineProperty.f;$$1g({target:"Object",stat:!0,forced:Object.defineProperty!==defineProperty$9,sham:!DESCRIPTORS$d},{defineProperty:defineProperty$9});var path$s=path$x,Object$4=path$s.Object,defineProperty$8=defineProperty$a.exports=function(e,t,r){return Object$4.defineProperty(e,t,r)};Object$4.defineProperty.sham&&(defineProperty$8.sham=!0);var definePropertyExports=defineProperty$a.exports,parent$2G=definePropertyExports,defineProperty$7=parent$2G,parent$2F=defineProperty$7,defineProperty$6=parent$2F,parent$2E=defineProperty$6,defineProperty$5=parent$2E,defineProperty$4=defineProperty$5,_Object$defineProperty$1=getDefaultExportFromCjs(defineProperty$4),$$1f=_export,DESCRIPTORS$c=descriptors,create$b=objectCreate;$$1f({target:"Object",stat:!0,sham:!DESCRIPTORS$c},{create:create$b});var path$r=path$x,Object$3=path$r.Object,create$a=function(e,t){return Object$3.create(e,t)},parent$2D=create$a,create$9=parent$2D,parent$2C=create$9,create$8=parent$2C,parent$2B=create$8,create$7=parent$2B,create$6=create$7,_Object$create=getDefaultExportFromCjs(create$6),$$1e=_export,fails$l=fails$B,toObject$8=toObject$e,nativeGetPrototypeOf=objectGetPrototypeOf,CORRECT_PROTOTYPE_GETTER=correctPrototypeGetter,FAILS_ON_PRIMITIVES$3=fails$l((function(){nativeGetPrototypeOf(1)}));$$1e({target:"Object",stat:!0,forced:FAILS_ON_PRIMITIVES$3,sham:!CORRECT_PROTOTYPE_GETTER},{getPrototypeOf:function(e){return nativeGetPrototypeOf(toObject$8(e))}});var path$q=path$x,getPrototypeOf$7=path$q.Object.getPrototypeOf,parent$2A=getPrototypeOf$7,getPrototypeOf$6=parent$2A,parent$2z=getPrototypeOf$6,getPrototypeOf$5=parent$2z,parent$2y=getPrototypeOf$5,getPrototypeOf$4=parent$2y,getPrototypeOf$3=getPrototypeOf$4,_Object$getPrototypeOf$1=getDefaultExportFromCjs(getPrototypeOf$3),fails$k=fails$B,arrayMethodIsStrict$5=function(e,t){var r=[][e];return!!r&&fails$k((function(){r.call(null,t||function(){return 1},1)}))},$forEach=arrayIteration.forEach,arrayMethodIsStrict$4=arrayMethodIsStrict$5,STRICT_METHOD$2=arrayMethodIsStrict$4("forEach"),arrayForEach=STRICT_METHOD$2?[].forEach:function(e){return $forEach(this,e,arguments.length>1?arguments[1]:void 0)},$$1d=_export,forEach$7=arrayForEach;$$1d({target:"Array",proto:!0,forced:[].forEach!=arrayForEach},{forEach:arrayForEach});var path$p=path$x,entryVirtual$p=function(e){return path$p[e+"Prototype"]},entryVirtual$o=entryVirtual$p,forEach$6=entryVirtual$o("Array").forEach,parent$2x=forEach$6,forEach$5=parent$2x,classof$7=classof$e,hasOwn$a=hasOwnProperty_1,isPrototypeOf$s=objectIsPrototypeOf,method$m=forEach$5,ArrayPrototype$i=Array.prototype,DOMIterables$2={DOMTokenList:!0,NodeList:!0},forEach$4=function(e){var t=e.forEach;return e===ArrayPrototype$i||isPrototypeOf$s(ArrayPrototype$i,e)&&t===ArrayPrototype$i.forEach||hasOwn$a(DOMIterables$2,classof$7(e))?method$m:t},parent$2w=forEach$4,forEach$3=parent$2w,parent$2v=forEach$3,forEach$2=parent$2v,forEach$1=forEach$2,_forEachInstanceProperty=getDefaultExportFromCjs(forEach$1),DESCRIPTORS$b=descriptors,isArray$9=isArray$d,$TypeError$c=TypeError,getOwnPropertyDescriptor$9=Object.getOwnPropertyDescriptor,SILENT_ON_NON_WRITABLE_LENGTH_SET=DESCRIPTORS$b&&!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$9(e)&&!getOwnPropertyDescriptor$9(e,"length").writable)throw $TypeError$c("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},$$1c=_export,toObject$7=toObject$e,lengthOfArrayLike$8=lengthOfArrayLike$d,setArrayLength$1=arraySetLength,doesNotExceedSafeInteger$1=doesNotExceedSafeInteger$3,fails$j=fails$B,INCORRECT_TO_LENGTH=fails$j((function(){return 4294967297!==[].push.call({length:4294967296},1)})),properErrorOnNonWritableLength=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}},FORCED$8=INCORRECT_TO_LENGTH||!properErrorOnNonWritableLength();$$1c({target:"Array",proto:!0,arity:1,forced:FORCED$8},{push:function(e){var t=toObject$7(this),r=lengthOfArrayLike$8(t),n=arguments.length;doesNotExceedSafeInteger$1(r+n);for(var i=0;i<n;i++)t[r]=arguments[i],r++;return setArrayLength$1(t,r),r}});var entryVirtual$n=entryVirtual$p,push$e=entryVirtual$n("Array").push,isPrototypeOf$r=objectIsPrototypeOf,method$l=push$e,ArrayPrototype$h=Array.prototype,push$d=function(e){var t=e.push;return e===ArrayPrototype$h||isPrototypeOf$r(ArrayPrototype$h,e)&&t===ArrayPrototype$h.push?method$l:t},parent$2u=push$d,push$c=parent$2u,parent$2t=push$c,push$b=parent$2t,parent$2s=push$b,push$a=parent$2s,push$9=push$a,_pushInstanceProperty=getDefaultExportFromCjs(push$9),$$1b=_export,setPrototypeOf$7=objectSetPrototypeOf;$$1b({target:"Object",stat:!0},{setPrototypeOf:setPrototypeOf$7});var path$o=path$x,setPrototypeOf$6=path$o.Object.setPrototypeOf,parent$2r=setPrototypeOf$6,setPrototypeOf$5=parent$2r,parent$2q=setPrototypeOf$5,setPrototypeOf$4=parent$2q,parent$2p=setPrototypeOf$4,setPrototypeOf$3=parent$2p,setPrototypeOf$2=setPrototypeOf$3,_Object$setPrototypeOf$1=getDefaultExportFromCjs(setPrototypeOf$2),getBuiltIn$7=getBuiltIn$h,uncurryThis$j=functionUncurryThis,getOwnPropertyNamesModule$1=objectGetOwnPropertyNames,getOwnPropertySymbolsModule$1=objectGetOwnPropertySymbols,anObject$b=anObject$h,concat$9=uncurryThis$j([].concat),ownKeys$5=getBuiltIn$7("Reflect","ownKeys")||function(e){var t=getOwnPropertyNamesModule$1.f(anObject$b(e)),r=getOwnPropertySymbolsModule$1.f;return r?concat$9(t,r(e)):t},hasOwn$9=hasOwnProperty_1,ownKeys$4=ownKeys$5,getOwnPropertyDescriptorModule$2=objectGetOwnPropertyDescriptor,definePropertyModule=objectDefineProperty,copyConstructorProperties$1=function(e,t,r){for(var n=ownKeys$4(t),i=definePropertyModule.f,o=getOwnPropertyDescriptorModule$2.f,a=0;a<n.length;a++){var s=n[a];hasOwn$9(e,s)||r&&hasOwn$9(r,s)||i(e,s,o(t,s))}},isObject$f=isObject$o,createNonEnumerableProperty$3=createNonEnumerableProperty$9,installErrorCause$1=function(e,t){isObject$f(t)&&"cause"in t&&createNonEnumerableProperty$3(e,"cause",t.cause)},uncurryThis$i=functionUncurryThis,$Error$1=Error,replace$4=uncurryThis$i("".replace),TEST=String($Error$1("zxcasd").stack),V8_OR_CHAKRA_STACK_ENTRY=/\n\s*at [^:]*:[^\n]*/,IS_V8_OR_CHAKRA_STACK=V8_OR_CHAKRA_STACK_ENTRY.test(TEST),errorStackClear=function(e,t){if(IS_V8_OR_CHAKRA_STACK&&"string"==typeof e&&!$Error$1.prepareStackTrace)for(;t--;)e=replace$4(e,V8_OR_CHAKRA_STACK_ENTRY,"");return e},fails$i=fails$B,createPropertyDescriptor$2=createPropertyDescriptor$8,errorStackInstallable=!fails$i((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",createPropertyDescriptor$2(1,7)),7!==e.stack)})),createNonEnumerableProperty$2=createNonEnumerableProperty$9,clearErrorStack=errorStackClear,ERROR_STACK_INSTALLABLE=errorStackInstallable,captureStackTrace=Error.captureStackTrace,errorStackInstall=function(e,t,r,n){ERROR_STACK_INSTALLABLE&&(captureStackTrace?captureStackTrace(e,t):createNonEnumerableProperty$2(e,"stack",clearErrorStack(r,n)))},wellKnownSymbol$b=wellKnownSymbol$q,Iterators$1=iterators,ITERATOR$6=wellKnownSymbol$b("iterator"),ArrayPrototype$g=Array.prototype,isArrayIteratorMethod$2=function(e){return void 0!==e&&(Iterators$1.Array===e||ArrayPrototype$g[ITERATOR$6]===e)},classof$6=classof$e,getMethod$1=getMethod$3,isNullOrUndefined$3=isNullOrUndefined$6,Iterators=iterators,wellKnownSymbol$a=wellKnownSymbol$q,ITERATOR$5=wellKnownSymbol$a("iterator"),getIteratorMethod$a=function(e){if(!isNullOrUndefined$3(e))return getMethod$1(e,ITERATOR$5)||getMethod$1(e,"@@iterator")||Iterators[classof$6(e)]},call$i=functionCall,aCallable$f=aCallable$j,anObject$a=anObject$h,tryToString$4=tryToString$7,getIteratorMethod$9=getIteratorMethod$a,$TypeError$b=TypeError,getIterator$3=function(e,t){var r=arguments.length<2?getIteratorMethod$9(e):t;if(aCallable$f(r))return anObject$a(call$i(r,e));throw $TypeError$b(tryToString$4(e)+" is not iterable")},call$h=functionCall,anObject$9=anObject$h,getMethod=getMethod$3,iteratorClose$2=function(e,t,r){var n,i;anObject$9(e);try{if(!(n=getMethod(e,"return"))){if("throw"===t)throw r;return r}n=call$h(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return anObject$9(n),r},bind$n=functionBindContext,call$g=functionCall,anObject$8=anObject$h,tryToString$3=tryToString$7,isArrayIteratorMethod$1=isArrayIteratorMethod$2,lengthOfArrayLike$7=lengthOfArrayLike$d,isPrototypeOf$q=objectIsPrototypeOf,getIterator$2=getIterator$3,getIteratorMethod$8=getIteratorMethod$a,iteratorClose$1=iteratorClose$2,$TypeError$a=TypeError,Result=function(e,t){this.stopped=e,this.result=t},ResultPrototype=Result.prototype,iterate$l=function(e,t,r){var n,i,o,a,s,l,c,u=r&&r.that,p=!(!r||!r.AS_ENTRIES),f=!(!r||!r.IS_RECORD),d=!(!r||!r.IS_ITERATOR),h=!(!r||!r.INTERRUPTED),y=bind$n(t,u),g=function(e){return n&&iteratorClose$1(n,"normal",e),new Result(!0,e)},_=function(e){return p?(anObject$8(e),h?y(e[0],e[1],g):y(e[0],e[1])):h?y(e,g):y(e)};if(f)n=e.iterator;else if(d)n=e;else{if(!(i=getIteratorMethod$8(e)))throw $TypeError$a(tryToString$3(e)+" is not iterable");if(isArrayIteratorMethod$1(i)){for(o=0,a=lengthOfArrayLike$7(e);a>o;o++)if((s=_(e[o]))&&isPrototypeOf$q(ResultPrototype,s))return s;return new Result(!1)}n=getIterator$2(e,i)}for(l=f?e.next:n.next;!(c=call$g(l,n)).done;){try{s=_(c.value)}catch(e){iteratorClose$1(n,"throw",e)}if("object"==typeof s&&s&&isPrototypeOf$q(ResultPrototype,s))return s}return new Result(!1)},toString$9=toString$f,normalizeStringArgument$1=function(e,t){return void 0===e?arguments.length<2?"":t:toString$9(e)},$$1a=_export,isPrototypeOf$p=objectIsPrototypeOf,getPrototypeOf$2=objectGetPrototypeOf,setPrototypeOf$1=objectSetPrototypeOf,copyConstructorProperties=copyConstructorProperties$1,create$5=objectCreate,createNonEnumerableProperty$1=createNonEnumerableProperty$9,createPropertyDescriptor$1=createPropertyDescriptor$8,installErrorCause=installErrorCause$1,installErrorStack=errorStackInstall,iterate$k=iterate$l,normalizeStringArgument=normalizeStringArgument$1,wellKnownSymbol$9=wellKnownSymbol$q,TO_STRING_TAG=wellKnownSymbol$9("toStringTag"),$Error=Error,push$8=[].push,$AggregateError=function(e,t){var r,n=isPrototypeOf$p(AggregateErrorPrototype,this);setPrototypeOf$1?r=setPrototypeOf$1($Error(),n?getPrototypeOf$2(this):AggregateErrorPrototype):(r=n?this:create$5(AggregateErrorPrototype),createNonEnumerableProperty$1(r,TO_STRING_TAG,"Error")),void 0!==t&&createNonEnumerableProperty$1(r,"message",normalizeStringArgument(t)),installErrorStack(r,$AggregateError,r.stack,1),arguments.length>2&&installErrorCause(r,arguments[2]);var i=[];return iterate$k(e,push$8,{that:i}),createNonEnumerableProperty$1(r,"errors",i),r};setPrototypeOf$1?setPrototypeOf$1($AggregateError,$Error):copyConstructorProperties($AggregateError,$Error,{name:!0});var AggregateErrorPrototype=$AggregateError.prototype=create$5($Error.prototype,{constructor:createPropertyDescriptor$1(1,$AggregateError),message:createPropertyDescriptor$1(1,""),name:createPropertyDescriptor$1(1,"AggregateError")});$$1a({global:!0,constructor:!0,arity:2},{AggregateError:$AggregateError});var $location,defer,channel,port,classof$5=classofRaw$2,engineIsNode="undefined"!=typeof process&&"process"==classof$5(process),getBuiltIn$6=getBuiltIn$h,defineBuiltInAccessor$3=defineBuiltInAccessor$5,wellKnownSymbol$8=wellKnownSymbol$q,DESCRIPTORS$a=descriptors,SPECIES$3=wellKnownSymbol$8("species"),setSpecies$2=function(e){var t=getBuiltIn$6(e);DESCRIPTORS$a&&t&&!t[SPECIES$3]&&defineBuiltInAccessor$3(t,SPECIES$3,{configurable:!0,get:function(){return this}})},isPrototypeOf$o=objectIsPrototypeOf,$TypeError$9=TypeError,anInstance$5=function(e,t){if(isPrototypeOf$o(t,e))return e;throw $TypeError$9("Incorrect invocation")},isConstructor$2=isConstructor$4,tryToString$2=tryToString$7,$TypeError$8=TypeError,aConstructor$3=function(e){if(isConstructor$2(e))return e;throw $TypeError$8(tryToString$2(e)+" is not a constructor")},anObject$7=anObject$h,aConstructor$2=aConstructor$3,isNullOrUndefined$2=isNullOrUndefined$6,wellKnownSymbol$7=wellKnownSymbol$q,SPECIES$2=wellKnownSymbol$7("species"),speciesConstructor$2=function(e,t){var r,n=anObject$7(e).constructor;return void 0===n||isNullOrUndefined$2(r=anObject$7(n)[SPECIES$2])?t:aConstructor$2(r)},$TypeError$7=TypeError,validateArgumentsLength$4=function(e,t){if(e<t)throw $TypeError$7("Not enough arguments");return e},userAgent$5=engineUserAgent,engineIsIos=/(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$5),global$b=global$p,apply$3=functionApply,bind$m=functionBindContext,isCallable$8=isCallable$p,hasOwn$8=hasOwnProperty_1,fails$h=fails$B,html=html$2,arraySlice$4=arraySlice$6,createElement=documentCreateElement$1,validateArgumentsLength$3=validateArgumentsLength$4,IS_IOS$1=engineIsIos,IS_NODE$4=engineIsNode,set$6=global$b.setImmediate,clear=global$b.clearImmediate,process$3=global$b.process,Dispatch=global$b.Dispatch,Function$1=global$b.Function,MessageChannel=global$b.MessageChannel,String$1=global$b.String,counter=0,queue$2={},ONREADYSTATECHANGE="onreadystatechange";fails$h((function(){$location=global$b.location}));var run=function(e){if(hasOwn$8(queue$2,e)){var t=queue$2[e];delete queue$2[e],t()}},runner=function(e){return function(){run(e)}},eventListener=function(e){run(e.data)},globalPostMessageDefer=function(e){global$b.postMessage(String$1(e),$location.protocol+"//"+$location.host)};set$6&&clear||(set$6=function(e){validateArgumentsLength$3(arguments.length,1);var t=isCallable$8(e)?e:Function$1(e),r=arraySlice$4(arguments,1);return queue$2[++counter]=function(){apply$3(t,void 0,r)},defer(counter),counter},clear=function(e){delete queue$2[e]},IS_NODE$4?defer=function(e){process$3.nextTick(runner(e))}:Dispatch&&Dispatch.now?defer=function(e){Dispatch.now(runner(e))}:MessageChannel&&!IS_IOS$1?(port=(channel=new MessageChannel).port2,channel.port1.onmessage=eventListener,defer=bind$m(port.postMessage,port)):global$b.addEventListener&&isCallable$8(global$b.postMessage)&&!global$b.importScripts&&$location&&"file:"!==$location.protocol&&!fails$h(globalPostMessageDefer)?(defer=globalPostMessageDefer,global$b.addEventListener("message",eventListener,!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$6,clear:clear},Queue$2=function(){this.head=null,this.tail=null};Queue$2.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var notify$1,toggle,node,promise$6,then,queue$1=Queue$2,userAgent$4=engineUserAgent,engineIsIosPebble=/ipad|iphone|ipod/i.test(userAgent$4)&&"undefined"!=typeof Pebble,userAgent$3=engineUserAgent,engineIsWebosWebkit=/web0s(?!.*chrome)/i.test(userAgent$3),global$a=global$p,bind$l=functionBindContext,getOwnPropertyDescriptor$8=objectGetOwnPropertyDescriptor.f,macrotask=task$1.set,Queue$1=queue$1,IS_IOS=engineIsIos,IS_IOS_PEBBLE=engineIsIosPebble,IS_WEBOS_WEBKIT=engineIsWebosWebkit,IS_NODE$3=engineIsNode,MutationObserver=global$a.MutationObserver||global$a.WebKitMutationObserver,document$2=global$a.document,process$2=global$a.process,Promise$1=global$a.Promise,queueMicrotaskDescriptor=getOwnPropertyDescriptor$8(global$a,"queueMicrotask"),microtask$1=queueMicrotaskDescriptor&&queueMicrotaskDescriptor.value;if(!microtask$1){var queue=new Queue$1,flush=function(){var e,t;for(IS_NODE$3&&(e=process$2.domain)&&e.exit();t=queue.get();)try{t()}catch(e){throw queue.head&&notify$1(),e}e&&e.enter()};IS_IOS||IS_NODE$3||IS_WEBOS_WEBKIT||!MutationObserver||!document$2?!IS_IOS_PEBBLE&&Promise$1&&Promise$1.resolve?((promise$6=Promise$1.resolve(void 0)).constructor=Promise$1,then=bind$l(promise$6.then,promise$6),notify$1=function(){then(flush)}):IS_NODE$3?notify$1=function(){process$2.nextTick(flush)}:(macrotask=bind$l(macrotask,global$a),notify$1=function(){macrotask(flush)}):(toggle=!0,node=document$2.createTextNode(""),new MutationObserver(flush).observe(node,{characterData:!0}),notify$1=function(){node.data=toggle=!toggle}),microtask$1=function(e){queue.head||notify$1(),queue.add(e)}}var microtask_1=microtask$1,hostReportErrors$1=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(e){}},perform$6=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},global$9=global$p,promiseNativeConstructor=global$9.Promise,engineIsDeno="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,IS_DENO$1=engineIsDeno,IS_NODE$2=engineIsNode,engineIsBrowser=!IS_DENO$1&&!IS_NODE$2&&"object"==typeof window&&"object"==typeof document,global$8=global$p,NativePromiseConstructor$5=promiseNativeConstructor,isCallable$7=isCallable$p,isForced=isForced_1,inspectSource=inspectSource$2,wellKnownSymbol$6=wellKnownSymbol$q,IS_BROWSER=engineIsBrowser,IS_DENO=engineIsDeno,V8_VERSION=engineV8Version,NativePromisePrototype$2=NativePromiseConstructor$5&&NativePromiseConstructor$5.prototype,SPECIES$1=wellKnownSymbol$6("species"),SUBCLASSING=!1,NATIVE_PROMISE_REJECTION_EVENT$1=isCallable$7(global$8.PromiseRejectionEvent),FORCED_PROMISE_CONSTRUCTOR$5=isForced("Promise",(function(){var e=inspectSource(NativePromiseConstructor$5),t=e!==String(NativePromiseConstructor$5);if(!t&&66===V8_VERSION)return!0;if(!NativePromisePrototype$2.catch||!NativePromisePrototype$2.finally)return!0;if(!V8_VERSION||V8_VERSION<51||!/native code/.test(e)){var r=new NativePromiseConstructor$5((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$e=aCallable$j,$TypeError$6=TypeError,PromiseCapability=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw $TypeError$6("Bad Promise constructor");t=e,r=n})),this.resolve=aCallable$e(t),this.reject=aCallable$e(r)};newPromiseCapability$2.f=function(e){return new PromiseCapability(e)};var $$19=_export,IS_NODE$1=engineIsNode,global$7=global$p,call$f=functionCall,defineBuiltIn$3=defineBuiltIn$8,setToStringTag$3=setToStringTag$9,setSpecies$1=setSpecies$2,aCallable$d=aCallable$j,isCallable$6=isCallable$p,isObject$e=isObject$o,anInstance$4=anInstance$5,speciesConstructor$1=speciesConstructor$2,task=task$1.set,microtask=microtask_1,hostReportErrors=hostReportErrors$1,perform$5=perform$6,Queue=queue$1,InternalStateModule$4=internalState,NativePromiseConstructor$4=promiseNativeConstructor,PromiseConstructorDetection=promiseConstructorDetection,newPromiseCapabilityModule$6=newPromiseCapability$2,PROMISE="Promise",FORCED_PROMISE_CONSTRUCTOR$4=PromiseConstructorDetection.CONSTRUCTOR,NATIVE_PROMISE_REJECTION_EVENT=PromiseConstructorDetection.REJECTION_EVENT;PromiseConstructorDetection.SUBCLASSING;var Internal,OwnPromiseCapability,PromiseWrapper,getInternalPromiseState=InternalStateModule$4.getterFor(PROMISE),setInternalState$4=InternalStateModule$4.set,NativePromisePrototype$1=NativePromiseConstructor$4&&NativePromiseConstructor$4.prototype,PromiseConstructor=NativePromiseConstructor$4,PromisePrototype=NativePromisePrototype$1,TypeError$3=global$7.TypeError,document$1=global$7.document,process$1=global$7.process,newPromiseCapability$1=newPromiseCapabilityModule$6.f,newGenericPromiseCapability=newPromiseCapability$1,DISPATCH_EVENT=!!(document$1&&document$1.createEvent&&global$7.dispatchEvent),UNHANDLED_REJECTION="unhandledrejection",REJECTION_HANDLED="rejectionhandled",PENDING=0,FULFILLED=1,REJECTED=2,HANDLED=1,UNHANDLED=2,isThenable=function(e){var t;return!(!isObject$e(e)||!isCallable$6(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$3("Promise-chain cycle")):(n=isThenable(r))?call$f(n,r,l,c):l(r)):c(o)}catch(e){u&&!i&&u.exit(),c(e)}},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$7.dispatchEvent(n)):n={promise:t,reason:r},!NATIVE_PROMISE_REJECTION_EVENT&&(i=global$7["on"+e])?i(n):e===UNHANDLED_REJECTION&&hostReportErrors("Unhandled promise rejection",r)},onUnhandled=function(e){call$f(task,global$7,(function(){var t,r=e.facade,n=e.value;if(isUnhandled(e)&&(t=perform$5((function(){IS_NODE$1?process$1.emit("unhandledRejection",n,r):dispatchEvent(UNHANDLED_REJECTION,r,n)})),e.rejection=IS_NODE$1||isUnhandled(e)?UNHANDLED:HANDLED,t.error))throw t.value}))},isUnhandled=function(e){return e.rejection!==HANDLED&&!e.parent},onHandleUnhandled=function(e){call$f(task,global$7,(function(){var t=e.facade;IS_NODE$1?process$1.emit("rejectionHandled",t):dispatchEvent(REJECTION_HANDLED,t,e.value)}))},bind$k=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){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw TypeError$3("Promise can't be resolved itself");var n=isThenable(t);n?microtask((function(){var r={done:!1};try{call$f(n,t,bind$k(internalResolve,r,e),bind$k(internalReject,r,e))}catch(t){internalReject(r,t,e)}})):(e.value=t,e.state=FULFILLED,notify(e,!1))}catch(t){internalReject({done:!1},t,e)}}};FORCED_PROMISE_CONSTRUCTOR$4&&(PromisePrototype=(PromiseConstructor=function(e){anInstance$4(this,PromisePrototype),aCallable$d(e),call$f(Internal,this);var t=getInternalPromiseState(this);try{e(bind$k(internalResolve,t),bind$k(internalReject,t))}catch(e){internalReject(t,e)}}).prototype,(Internal=function(e){setInternalState$4(this,{type:PROMISE,done:!1,notified:!1,parent:!1,reactions:new Queue,rejection:!1,state:PENDING,value:void 0})}).prototype=defineBuiltIn$3(PromisePrototype,"then",(function(e,t){var r=getInternalPromiseState(this),n=newPromiseCapability$1(speciesConstructor$1(this,PromiseConstructor));return r.parent=!0,n.ok=!isCallable$6(e)||e,n.fail=isCallable$6(t)&&t,n.domain=IS_NODE$1?process$1.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$k(internalResolve,t),this.reject=bind$k(internalReject,t)},newPromiseCapabilityModule$6.f=newPromiseCapability$1=function(e){return e===PromiseConstructor||e===PromiseWrapper?new OwnPromiseCapability(e):newGenericPromiseCapability(e)}),$$19({global:!0,constructor:!0,wrap:!0,forced:FORCED_PROMISE_CONSTRUCTOR$4},{Promise:PromiseConstructor}),setToStringTag$3(PromiseConstructor,PROMISE,!1,!0),setSpecies$1(PROMISE);var wellKnownSymbol$5=wellKnownSymbol$q,ITERATOR$4=wellKnownSymbol$5("iterator"),SAFE_CLOSING=!1;try{var called=0,iteratorWithReturn={next:function(){return{done:!!called++}},return:function(){SAFE_CLOSING=!0}};iteratorWithReturn[ITERATOR$4]=function(){return this},Array.from(iteratorWithReturn,(function(){throw 2}))}catch(e){}var checkCorrectnessOfIteration$2=function(e,t){if(!t&&!SAFE_CLOSING)return!1;var r=!1;try{var n={};n[ITERATOR$4]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},NativePromiseConstructor$3=promiseNativeConstructor,checkCorrectnessOfIteration$1=checkCorrectnessOfIteration$2,FORCED_PROMISE_CONSTRUCTOR$3=promiseConstructorDetection.CONSTRUCTOR,promiseStaticsIncorrectIteration=FORCED_PROMISE_CONSTRUCTOR$3||!checkCorrectnessOfIteration$1((function(e){NativePromiseConstructor$3.all(e).then(void 0,(function(){}))})),$$18=_export,call$e=functionCall,aCallable$c=aCallable$j,newPromiseCapabilityModule$5=newPromiseCapability$2,perform$4=perform$6,iterate$j=iterate$l,PROMISE_STATICS_INCORRECT_ITERATION$3=promiseStaticsIncorrectIteration;$$18({target:"Promise",stat:!0,forced:PROMISE_STATICS_INCORRECT_ITERATION$3},{all:function(e){var t=this,r=newPromiseCapabilityModule$5.f(t),n=r.resolve,i=r.reject,o=perform$4((function(){var r=aCallable$c(t.resolve),o=[],a=0,s=1;iterate$j(e,(function(e){var l=a++,c=!1;s++,call$e(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 $$17=_export,FORCED_PROMISE_CONSTRUCTOR$2=promiseConstructorDetection.CONSTRUCTOR,NativePromiseConstructor$2=promiseNativeConstructor;promiseNativeConstructor&&promiseNativeConstructor.prototype,$$17({target:"Promise",proto:!0,forced:FORCED_PROMISE_CONSTRUCTOR$2,real:!0},{catch:function(e){return this.then(void 0,e)}});var $$16=_export,call$d=functionCall,aCallable$b=aCallable$j,newPromiseCapabilityModule$4=newPromiseCapability$2,perform$3=perform$6,iterate$i=iterate$l,PROMISE_STATICS_INCORRECT_ITERATION$2=promiseStaticsIncorrectIteration;$$16({target:"Promise",stat:!0,forced:PROMISE_STATICS_INCORRECT_ITERATION$2},{race:function(e){var t=this,r=newPromiseCapabilityModule$4.f(t),n=r.reject,i=perform$3((function(){var i=aCallable$b(t.resolve);iterate$i(e,(function(e){call$d(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var $$15=_export,call$c=functionCall,newPromiseCapabilityModule$3=newPromiseCapability$2,FORCED_PROMISE_CONSTRUCTOR$1=promiseConstructorDetection.CONSTRUCTOR;$$15({target:"Promise",stat:!0,forced:FORCED_PROMISE_CONSTRUCTOR$1},{reject:function(e){var t=newPromiseCapabilityModule$3.f(this);return call$c(t.reject,void 0,e),t.promise}});var anObject$6=anObject$h,isObject$d=isObject$o,newPromiseCapability=newPromiseCapability$2,promiseResolve$2=function(e,t){if(anObject$6(e),isObject$d(t)&&t.constructor===e)return t;var r=newPromiseCapability.f(e);return(0,r.resolve)(t),r.promise},$$14=_export,getBuiltIn$5=getBuiltIn$h,IS_PURE$1=isPure,NativePromiseConstructor$1=promiseNativeConstructor,FORCED_PROMISE_CONSTRUCTOR=promiseConstructorDetection.CONSTRUCTOR,promiseResolve$1=promiseResolve$2,PromiseConstructorWrapper=getBuiltIn$5("Promise"),CHECK_WRAPPER=!FORCED_PROMISE_CONSTRUCTOR;$$14({target:"Promise",stat:!0,forced:IS_PURE$1},{resolve:function(e){return promiseResolve$1(CHECK_WRAPPER&&this===PromiseConstructorWrapper?NativePromiseConstructor$1:this,e)}});var $$13=_export,call$b=functionCall,aCallable$a=aCallable$j,newPromiseCapabilityModule$2=newPromiseCapability$2,perform$2=perform$6,iterate$h=iterate$l,PROMISE_STATICS_INCORRECT_ITERATION$1=promiseStaticsIncorrectIteration;$$13({target:"Promise",stat:!0,forced:PROMISE_STATICS_INCORRECT_ITERATION$1},{allSettled:function(e){var t=this,r=newPromiseCapabilityModule$2.f(t),n=r.resolve,i=r.reject,o=perform$2((function(){var r=aCallable$a(t.resolve),i=[],o=0,a=1;iterate$h(e,(function(e){var s=o++,l=!1;a++,call$b(r,t,e).then((function(e){l||(l=!0,i[s]={status:"fulfilled",value:e},--a||n(i))}),(function(e){l||(l=!0,i[s]={status:"rejected",reason:e},--a||n(i))}))})),--a||n(i)}));return o.error&&i(o.value),r.promise}});var $$12=_export,call$a=functionCall,aCallable$9=aCallable$j,getBuiltIn$4=getBuiltIn$h,newPromiseCapabilityModule$1=newPromiseCapability$2,perform$1=perform$6,iterate$g=iterate$l,PROMISE_STATICS_INCORRECT_ITERATION=promiseStaticsIncorrectIteration,PROMISE_ANY_ERROR="No one promise resolved";$$12({target:"Promise",stat:!0,forced:PROMISE_STATICS_INCORRECT_ITERATION},{any:function(e){var t=this,r=getBuiltIn$4("AggregateError"),n=newPromiseCapabilityModule$1.f(t),i=n.resolve,o=n.reject,a=perform$1((function(){var n=aCallable$9(t.resolve),a=[],s=0,l=1,c=!1;iterate$g(e,(function(e){var u=s++,p=!1;l++,call$a(n,t,e).then((function(e){p||c||(c=!0,i(e))}),(function(e){p||c||(p=!0,a[u]=e,--l||o(new r(a,PROMISE_ANY_ERROR)))}))})),--l||o(new r(a,PROMISE_ANY_ERROR))}));return a.error&&o(a.value),n.promise}});var $$11=_export,NativePromiseConstructor=promiseNativeConstructor,fails$g=fails$B,getBuiltIn$3=getBuiltIn$h,isCallable$5=isCallable$p,speciesConstructor=speciesConstructor$2,promiseResolve=promiseResolve$2,NativePromisePrototype=NativePromiseConstructor&&NativePromiseConstructor.prototype,NON_GENERIC=!!NativePromiseConstructor&&fails$g((function(){NativePromisePrototype.finally.call({then:function(){}},(function(){}))}));$$11({target:"Promise",proto:!0,real:!0,forced:NON_GENERIC},{finally:function(e){var t=speciesConstructor(this,getBuiltIn$3("Promise")),r=isCallable$5(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)}});var path$n=path$x,promise$5=path$n.Promise,parent$2o=promise$5,promise$4=parent$2o,parent$2n=promise$4,promise$3=parent$2n,$$10=_export,newPromiseCapabilityModule=newPromiseCapability$2,perform=perform$6;$$10({target:"Promise",stat:!0,forced:!0},{try:function(e){var t=newPromiseCapabilityModule.f(this),r=perform(e);return(r.error?t.reject:t.resolve)(r.value),t.promise}});var parent$2m=promise$3,promise$2=parent$2m,promise$1=promise$2,_Promise$1=getDefaultExportFromCjs(promise$1),$$$=_export,uncurryThis$h=functionUncurryThis,isArray$8=isArray$d,nativeReverse=uncurryThis$h([].reverse),test$1=[1,2];$$$({target:"Array",proto:!0,forced:String(test$1)===String(test$1.reverse())},{reverse:function(){return isArray$8(this)&&(this.length=this.length),nativeReverse(this)}});var entryVirtual$m=entryVirtual$p,reverse$6=entryVirtual$m("Array").reverse,isPrototypeOf$n=objectIsPrototypeOf,method$k=reverse$6,ArrayPrototype$f=Array.prototype,reverse$5=function(e){var t=e.reverse;return e===ArrayPrototype$f||isPrototypeOf$n(ArrayPrototype$f,e)&&t===ArrayPrototype$f.reverse?method$k:t},parent$2l=reverse$5,reverse$4=parent$2l,parent$2k=reverse$4,reverse$3=parent$2k,parent$2j=reverse$3,reverse$2=parent$2j,reverse$1=reverse$2,_reverseInstanceProperty$1=getDefaultExportFromCjs(reverse$1),$$_=_export,isArray$7=isArray$d,isConstructor$1=isConstructor$4,isObject$c=isObject$o,toAbsoluteIndex$3=toAbsoluteIndex$6,lengthOfArrayLike$6=lengthOfArrayLike$d,toIndexedObject$4=toIndexedObject$c,createProperty$3=createProperty$6,wellKnownSymbol$4=wellKnownSymbol$q,arrayMethodHasSpeciesSupport$3=arrayMethodHasSpeciesSupport$5,nativeSlice=arraySlice$6,HAS_SPECIES_SUPPORT$3=arrayMethodHasSpeciesSupport$3("slice"),SPECIES=wellKnownSymbol$4("species"),$Array$1=Array,max$1=Math.max;$$_({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$3},{slice:function(e,t){var r,n,i,o=toIndexedObject$4(this),a=lengthOfArrayLike$6(o),s=toAbsoluteIndex$3(e,a),l=toAbsoluteIndex$3(void 0===t?a:t,a);if(isArray$7(o)&&(r=o.constructor,(isConstructor$1(r)&&(r===$Array$1||isArray$7(r.prototype))||isObject$c(r)&&null===(r=r[SPECIES]))&&(r=void 0),r===$Array$1||void 0===r))return nativeSlice(o,s,l);for(n=new(void 0===r?$Array$1:r)(max$1(l-s,0)),i=0;s<l;s++,i++)s in o&&createProperty$3(n,i,o[s]);return n.length=i,n}});var entryVirtual$l=entryVirtual$p,slice$6=entryVirtual$l("Array").slice,isPrototypeOf$m=objectIsPrototypeOf,method$j=slice$6,ArrayPrototype$e=Array.prototype,slice$5=function(e){var t=e.slice;return e===ArrayPrototype$e||isPrototypeOf$m(ArrayPrototype$e,e)&&t===ArrayPrototype$e.slice?method$j:t},parent$2i=slice$5,slice$4=parent$2i,parent$2h=slice$4,slice$3=parent$2h,parent$2g=slice$3,slice$2=parent$2g,slice$1=slice$2,_sliceInstanceProperty$1=getDefaultExportFromCjs(slice$1);function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=_Object$defineProperty$1||function(e,t,r){e[t]=r.value},i="function"==typeof _Symbol$1?_Symbol$1:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,t,r){return _Object$defineProperty$1(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var o=t&&t.prototype instanceof f?t:f,a=_Object$create(o.prototype),s=new P(i||[]);return n(a,"_invoke",{value:$(e,r,s)}),a}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var p={};function f(){}function d(){}function h(){}var y={};l(y,o,(function(){return this}));var g=_Object$getPrototypeOf$1&&_Object$getPrototypeOf$1(_Object$getPrototypeOf$1(T([])));g&&g!==t&&r.call(g,o)&&(y=g);var _=h.prototype=f.prototype=_Object$create(y);function v(e){var t;_forEachInstanceProperty(t=["next","throw","return"]).call(t,(function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){function i(n,o,a,s){var l=u(e[n],e,o);if("throw"!==l.type){var c=l.arg,p=c.value;return p&&"object"==_typeof$1(p)&&r.call(p,"__await")?t.resolve(p.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(p).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 $(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=b(a,r);if(s){if(s===p)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===p)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}function b(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,b(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var i=u(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;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,p):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function S(e){var t,r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),_pushInstanceProperty(t=this.tryEntries).call(t,r)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],_forEachInstanceProperty(e).call(e,S,this),this.reset(!0)}function T(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:I}}function I(){return{value:void 0,done:!0}}return d.prototype=h,n(_,"constructor",{value:h,configurable:!0}),n(h,"constructor",{value:d,configurable:!0}),d.displayName=l(h,s,"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$1?_Object$setPrototypeOf$1(e,h):(e.__proto__=h,l(e,s,"GeneratorFunction")),e.prototype=_Object$create(_),e},e.awrap=function(e){return{__await:e}},v(m.prototype),l(m.prototype,a,(function(){return this})),e.AsyncIterator=m,e.async=function(t,r,n,i,o){void 0===o&&(o=_Promise$1);var a=new m(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},v(_),l(_,s,"Generator"),l(_,o,(function(){return this})),l(_,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)_pushInstanceProperty(r).call(r,n);return _reverseInstanceProperty$1(r).call(r),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=T,P.prototype={constructor:P,reset:function(e){var t;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,_forEachInstanceProperty(t=this.tryEntries).call(t,E),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+_sliceInstanceProperty$1(n).call(n,1))&&(this[n]=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,p):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),p},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),p}},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:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},e}function asyncGeneratorStep(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void r(e)}s.done?t(l):_Promise$1.resolve(l).then(n,i)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new _Promise$1((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)}))}}var $$Z=_export,isArray$6=isArray$d;$$Z({target:"Array",stat:!0},{isArray:isArray$6});var path$m=path$x,isArray$5=path$m.Array.isArray,parent$2f=isArray$5,isArray$4=parent$2f,parent$2e=isArray$4,isArray$3=parent$2e,parent$2d=isArray$3,isArray$2=parent$2d,isArray$1=isArray$2,_Array$isArray=getDefaultExportFromCjs(isArray$1);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 _arrayWithoutHoles$1(e){if(_Array$isArray(e))return _arrayLikeToArray$1(e)}var getIteratorMethod$7=getIteratorMethod$a,getIteratorMethod_1=getIteratorMethod$7,parent$2c=getIteratorMethod_1,getIteratorMethod$6=parent$2c,parent$2b=getIteratorMethod$6,getIteratorMethod$5=parent$2b,parent$2a=getIteratorMethod$5,getIteratorMethod$4=parent$2a,getIteratorMethod$3=getIteratorMethod$4,_getIteratorMethod$1=getDefaultExportFromCjs(getIteratorMethod$3),anObject$5=anObject$h,iteratorClose=iteratorClose$2,callWithSafeIterationClosing$1=function(e,t,r,n){try{return n?t(anObject$5(r)[0],r[1]):t(r)}catch(t){iteratorClose(e,"throw",t)}},bind$j=functionBindContext,call$9=functionCall,toObject$6=toObject$e,callWithSafeIterationClosing=callWithSafeIterationClosing$1,isArrayIteratorMethod=isArrayIteratorMethod$2,isConstructor3=isConstructor$4,lengthOfArrayLike$5=lengthOfArrayLike$d,createProperty$2=createProperty$6,getIterator$1=getIterator$3,getIteratorMethod$2=getIteratorMethod$a,$Array=Array,arrayFrom$1=function(e){var t=toObject$6(e),r=isConstructor3(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=bind$j(i,n>2?arguments[2]:void 0));var a,s,l,c,u,p,f=getIteratorMethod$2(t),d=0;if(!f||this===$Array&&isArrayIteratorMethod(f))for(a=lengthOfArrayLike$5(t),s=r?new this(a):$Array(a);a>d;d++)p=o?i(t[d],d):t[d],createProperty$2(s,d,p);else for(u=(c=getIterator$1(t,f)).next,s=r?new this:[];!(l=call$9(u,c)).done;d++)p=o?callWithSafeIterationClosing(c,i,[l.value,d],!0):l.value,createProperty$2(s,d,p);return s.length=d,s},$$Y=_export,from$7=arrayFrom$1,checkCorrectnessOfIteration=checkCorrectnessOfIteration$2,INCORRECT_ITERATION=!checkCorrectnessOfIteration((function(e){Array.from(e)}));$$Y({target:"Array",stat:!0,forced:INCORRECT_ITERATION},{from:from$7});var path$l=path$x,from$6=path$l.Array.from,parent$29=from$6,from$5=parent$29,parent$28=from$5,from$4=parent$28,parent$27=from$4,from$3=parent$27,from$2=from$3,_Array$from$1=getDefaultExportFromCjs(from$2);function _iterableToArray$1(e){if(void 0!==_Symbol$1&&null!=_getIteratorMethod$1(e)||null!=e["@@iterator"])return _Array$from$1(e)}function _unsupportedIterableToArray$1(e,t){var r;if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,t);var n=_sliceInstanceProperty$1(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?_Array$from$1(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray$1(e,t):void 0}}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 _toConsumableArray$1(e){return _arrayWithoutHoles$1(e)||_iterableToArray$1(e)||_unsupportedIterableToArray$1(e)||_nonIterableSpread$1()}function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var WrappedWellKnownSymbolModule$1=wellKnownSymbolWrapped,toPrimitive$5=WrappedWellKnownSymbolModule$1.f("toPrimitive"),parent$26=toPrimitive$5,toPrimitive$4=parent$26,parent$25=toPrimitive$4,toPrimitive$3=parent$25,parent$24=toPrimitive$3,toPrimitive$2=parent$24,toPrimitive$1=toPrimitive$2,_Symbol$toPrimitive$1=getDefaultExportFromCjs(toPrimitive$1);function _toPrimitive$1(e,t){if("object"!==_typeof$1(e)||null===e)return e;var r=e[_Symbol$toPrimitive$1];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==_typeof$1(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$1(t)?t:String(t)}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$1(e,_toPropertyKey$1(n.key),n)}}function _createClass$2(e,t,r){return t&&_defineProperties$2(e.prototype,t),r&&_defineProperties$2(e,r),_Object$defineProperty$1(e,"prototype",{writable:!1}),e}function _defineProperty$2(e,t,r){return(t=_toPropertyKey$1(t))in e?_Object$defineProperty$1(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var path$k=path$x,getOwnPropertySymbols$5=path$k.Object.getOwnPropertySymbols,parent$23=getOwnPropertySymbols$5,getOwnPropertySymbols$4=parent$23,parent$22=getOwnPropertySymbols$4,getOwnPropertySymbols$3=parent$22,parent$21=getOwnPropertySymbols$3,getOwnPropertySymbols$2=parent$21,getOwnPropertySymbols$1=getOwnPropertySymbols$2,_Object$getOwnPropertySymbols$1=getDefaultExportFromCjs(getOwnPropertySymbols$1),$$X=_export,uncurryThis$g=functionUncurryThisClause,$indexOf=arrayIncludes.indexOf,arrayMethodIsStrict$3=arrayMethodIsStrict$5,nativeIndexOf=uncurryThis$g([].indexOf),NEGATIVE_ZERO$1=!!nativeIndexOf&&1/nativeIndexOf([1],1,-0)<0,FORCED$7=NEGATIVE_ZERO$1||!arrayMethodIsStrict$3("indexOf");$$X({target:"Array",proto:!0,forced:FORCED$7},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return NEGATIVE_ZERO$1?nativeIndexOf(this,e,t)||0:$indexOf(this,e,t)}});var entryVirtual$k=entryVirtual$p,indexOf$6=entryVirtual$k("Array").indexOf,isPrototypeOf$l=objectIsPrototypeOf,method$i=indexOf$6,ArrayPrototype$d=Array.prototype,indexOf$5=function(e){var t=e.indexOf;return e===ArrayPrototype$d||isPrototypeOf$l(ArrayPrototype$d,e)&&t===ArrayPrototype$d.indexOf?method$i:t},parent$20=indexOf$5,indexOf$4=parent$20,parent$1$=indexOf$4,indexOf$3=parent$1$,parent$1_=indexOf$3,indexOf$2=parent$1_,indexOf$1=indexOf$2,_indexOfInstanceProperty$1=getDefaultExportFromCjs(indexOf$1),$$W=_export,toObject$5=toObject$e,nativeKeys=objectKeys$4,fails$f=fails$B,FAILS_ON_PRIMITIVES$2=fails$f((function(){nativeKeys(1)}));$$W({target:"Object",stat:!0,forced:FAILS_ON_PRIMITIVES$2},{keys:function(e){return nativeKeys(toObject$5(e))}});var path$j=path$x,keys$c=path$j.Object.keys,parent$1Z=keys$c,keys$b=parent$1Z,parent$1Y=keys$b,keys$a=parent$1Y,parent$1X=keys$a,keys$9=parent$1X,keys$8=keys$9,_Object$keys$1=getDefaultExportFromCjs(keys$8);function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n,i={},o=_Object$keys$1(e);for(n=0;n<o.length;n++)r=o[n],_indexOfInstanceProperty$1(t).call(t,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$1){var o=_Object$getOwnPropertySymbols$1(e);for(n=0;n<o.length;n++)r=o[n],_indexOfInstanceProperty$1(t).call(t,r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var $$V=_export,$filter=arrayIteration.filter,arrayMethodHasSpeciesSupport$2=arrayMethodHasSpeciesSupport$5,HAS_SPECIES_SUPPORT$2=arrayMethodHasSpeciesSupport$2("filter");$$V({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$2},{filter:function(e){return $filter(this,e,arguments.length>1?arguments[1]:void 0)}});var entryVirtual$j=entryVirtual$p,filter$6=entryVirtual$j("Array").filter,isPrototypeOf$k=objectIsPrototypeOf,method$h=filter$6,ArrayPrototype$c=Array.prototype,filter$5=function(e){var t=e.filter;return e===ArrayPrototype$c||isPrototypeOf$k(ArrayPrototype$c,e)&&t===ArrayPrototype$c.filter?method$h:t},parent$1W=filter$5,filter$4=parent$1W,parent$1V=filter$4,filter$3=parent$1V,parent$1U=filter$3,filter$2=parent$1U,filter$1=filter$2,_filterInstanceProperty$1=getDefaultExportFromCjs(filter$1),getOwnPropertyDescriptor$7={exports:{}},$$U=_export,fails$e=fails$B,toIndexedObject$3=toIndexedObject$c,nativeGetOwnPropertyDescriptor=objectGetOwnPropertyDescriptor.f,DESCRIPTORS$9=descriptors,FORCED$6=!DESCRIPTORS$9||fails$e((function(){nativeGetOwnPropertyDescriptor(1)}));$$U({target:"Object",stat:!0,forced:FORCED$6,sham:!DESCRIPTORS$9},{getOwnPropertyDescriptor:function(e,t){return nativeGetOwnPropertyDescriptor(toIndexedObject$3(e),t)}});var path$i=path$x,Object$2=path$i.Object,getOwnPropertyDescriptor$6=getOwnPropertyDescriptor$7.exports=function(e,t){return Object$2.getOwnPropertyDescriptor(e,t)};Object$2.getOwnPropertyDescriptor.sham&&(getOwnPropertyDescriptor$6.sham=!0);var getOwnPropertyDescriptorExports=getOwnPropertyDescriptor$7.exports,parent$1T=getOwnPropertyDescriptorExports,getOwnPropertyDescriptor$5=parent$1T,parent$1S=getOwnPropertyDescriptor$5,getOwnPropertyDescriptor$4=parent$1S,parent$1R=getOwnPropertyDescriptor$4,getOwnPropertyDescriptor$3=parent$1R,getOwnPropertyDescriptor$2=getOwnPropertyDescriptor$3,_Object$getOwnPropertyDescriptor$1=getDefaultExportFromCjs(getOwnPropertyDescriptor$2),$$T=_export,DESCRIPTORS$8=descriptors,ownKeys$3=ownKeys$5,toIndexedObject$2=toIndexedObject$c,getOwnPropertyDescriptorModule$1=objectGetOwnPropertyDescriptor,createProperty$1=createProperty$6;$$T({target:"Object",stat:!0,sham:!DESCRIPTORS$8},{getOwnPropertyDescriptors:function(e){for(var t,r,n=toIndexedObject$2(e),i=getOwnPropertyDescriptorModule$1.f,o=ownKeys$3(n),a={},s=0;o.length>s;)void 0!==(r=i(n,t=o[s++]))&&createProperty$1(a,t,r);return a}});var path$h=path$x,getOwnPropertyDescriptors$5=path$h.Object.getOwnPropertyDescriptors,parent$1Q=getOwnPropertyDescriptors$5,getOwnPropertyDescriptors$4=parent$1Q,parent$1P=getOwnPropertyDescriptors$4,getOwnPropertyDescriptors$3=parent$1P,parent$1O=getOwnPropertyDescriptors$3,getOwnPropertyDescriptors$2=parent$1O,getOwnPropertyDescriptors$1=getOwnPropertyDescriptors$2,_Object$getOwnPropertyDescriptors$1=getDefaultExportFromCjs(getOwnPropertyDescriptors$1),defineProperties$7={exports:{}},$$S=_export,DESCRIPTORS$7=descriptors,defineProperties$6=objectDefineProperties.f;$$S({target:"Object",stat:!0,forced:Object.defineProperties!==defineProperties$6,sham:!DESCRIPTORS$7},{defineProperties:defineProperties$6});var path$g=path$x,Object$1=path$g.Object,defineProperties$5=defineProperties$7.exports=function(e,t){return Object$1.defineProperties(e,t)};Object$1.defineProperties.sham&&(defineProperties$5.sham=!0);var definePropertiesExports=defineProperties$7.exports,parent$1N=definePropertiesExports,defineProperties$4=parent$1N,parent$1M=defineProperties$4,defineProperties$3=parent$1M,parent$1L=defineProperties$3,defineProperties$2=parent$1L,defineProperties$1=defineProperties$2,_Object$defineProperties$1=getDefaultExportFromCjs(defineProperties$1);function ownKeys$2(e,t){var r=_Object$keys$1(e);if(_Object$getOwnPropertySymbols$1){var n=_Object$getOwnPropertySymbols$1(e);t&&(n=_filterInstanceProperty$1(n).call(n,(function(t){return _Object$getOwnPropertyDescriptor$1(e,t).enumerable}))),_pushInstanceProperty(r).apply(r,n)}return r}function _objectSpread2$2(e){for(var t=1;t<arguments.length;t++){var r,n,i=null!=arguments[t]?arguments[t]:{};t%2?_forEachInstanceProperty(r=ownKeys$2(Object(i),!0)).call(r,(function(t){_defineProperty$2(e,t,i[t])})):_Object$getOwnPropertyDescriptors$1?_Object$defineProperties$1(e,_Object$getOwnPropertyDescriptors$1(i)):_forEachInstanceProperty(n=ownKeys$2(Object(i))).call(n,(function(t){_Object$defineProperty$1(e,t,_Object$getOwnPropertyDescriptor$1(i,t))}))}return e}var entryVirtual$i=entryVirtual$p,concat$8=entryVirtual$i("Array").concat,isPrototypeOf$j=objectIsPrototypeOf,method$g=concat$8,ArrayPrototype$b=Array.prototype,concat$7=function(e){var t=e.concat;return e===ArrayPrototype$b||isPrototypeOf$j(ArrayPrototype$b,e)&&t===ArrayPrototype$b.concat?method$g:t},parent$1K=concat$7,concat$6=parent$1K,parent$1J=concat$6,concat$5=parent$1J,parent$1I=concat$5,concat$4=parent$1I,concat$3=concat$4,concat$2=concat$3,_concatInstanceProperty=getDefaultExportFromCjs(concat$2),$$R=_export,$find=arrayIteration.find,FIND="find",SKIPS_HOLES$1=!0;FIND in[]&&Array(1)[FIND]((function(){SKIPS_HOLES$1=!1})),$$R({target:"Array",proto:!0,forced:SKIPS_HOLES$1},{find:function(e){return $find(this,e,arguments.length>1?arguments[1]:void 0)}});var entryVirtual$h=entryVirtual$p,find$7=entryVirtual$h("Array").find,isPrototypeOf$i=objectIsPrototypeOf,method$f=find$7,ArrayPrototype$a=Array.prototype,find$6=function(e){var t=e.find;return e===ArrayPrototype$a||isPrototypeOf$i(ArrayPrototype$a,e)&&t===ArrayPrototype$a.find?method$f:t},parent$1H=find$6,find$5=parent$1H,parent$1G=find$5,find$4=parent$1G,parent$1F=find$4,find$3=parent$1F,find$2=find$3,find$1=find$2,_findInstanceProperty=getDefaultExportFromCjs(find$1),internalMetadata={exports:{}},fails$d=fails$B,arrayBufferNonExtensible=fails$d((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),fails$c=fails$B,isObject$b=isObject$o,classof$4=classofRaw$2,ARRAY_BUFFER_NON_EXTENSIBLE=arrayBufferNonExtensible,$isExtensible=Object.isExtensible,FAILS_ON_PRIMITIVES$1=fails$c((function(){$isExtensible(1)})),objectIsExtensible=FAILS_ON_PRIMITIVES$1||ARRAY_BUFFER_NON_EXTENSIBLE?function(e){return!!isObject$b(e)&&((!ARRAY_BUFFER_NON_EXTENSIBLE||"ArrayBuffer"!=classof$4(e))&&(!$isExtensible||$isExtensible(e)))}:$isExtensible,fails$b=fails$B,freezing=!fails$b((function(){return Object.isExtensible(Object.preventExtensions({}))})),$$Q=_export,uncurryThis$f=functionUncurryThis,hiddenKeys=hiddenKeys$6,isObject$a=isObject$o,hasOwn$7=hasOwnProperty_1,defineProperty$3=objectDefineProperty.f,getOwnPropertyNamesModule=objectGetOwnPropertyNames,getOwnPropertyNamesExternalModule=objectGetOwnPropertyNamesExternal,isExtensible2=objectIsExtensible,uid=uid$4,FREEZING$1=freezing,REQUIRED=!1,METADATA=uid("meta"),id=0,setMetadata=function(e){defineProperty$3(e,METADATA,{value:{objectID:"O"+id++,weakData:{}}})},fastKey$1=function(e,t){if(!isObject$a(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!hasOwn$7(e,METADATA)){if(!isExtensible2(e))return"F";if(!t)return"E";setMetadata(e)}return e[METADATA].objectID},getWeakData=function(e,t){if(!hasOwn$7(e,METADATA)){if(!isExtensible2(e))return!0;if(!t)return!1;setMetadata(e)}return e[METADATA].weakData},onFreeze$1=function(e){return FREEZING$1&&REQUIRED&&isExtensible2(e)&&!hasOwn$7(e,METADATA)&&setMetadata(e),e},enable=function(){meta.enable=function(){},REQUIRED=!0;var e=getOwnPropertyNamesModule.f,t=uncurryThis$f([].splice),r={};r[METADATA]=1,e(r).length&&(getOwnPropertyNamesModule.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===METADATA){t(n,i,1);break}return n},$$Q({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:getOwnPropertyNamesExternalModule.f}))},meta=internalMetadata.exports={enable:enable,fastKey:fastKey$1,getWeakData:getWeakData,onFreeze:onFreeze$1};hiddenKeys[METADATA]=!0;var internalMetadataExports=internalMetadata.exports,$$P=_export,global$6=global$p,InternalMetadataModule=internalMetadataExports,fails$a=fails$B,createNonEnumerableProperty=createNonEnumerableProperty$9,iterate$f=iterate$l,anInstance$3=anInstance$5,isCallable$4=isCallable$p,isObject$9=isObject$o,setToStringTag$2=setToStringTag$9,defineProperty$2=objectDefineProperty.f,forEach2=arrayIteration.forEach,DESCRIPTORS$6=descriptors,InternalStateModule$3=internalState,setInternalState$3=InternalStateModule$3.set,internalStateGetterFor$1=InternalStateModule$3.getterFor,collection$1=function(e,t,r){var n,i=-1!==e.indexOf("Map"),o=-1!==e.indexOf("Weak"),a=i?"set":"add",s=global$6[e],l=s&&s.prototype,c={};if(DESCRIPTORS$6&&isCallable$4(s)&&(o||l.forEach&&!fails$a((function(){(new s).entries().next()})))){var u=(n=t((function(t,r){setInternalState$3(anInstance$3(t,u),{type:e,collection:new s}),null!=r&&iterate$f(r,t[a],{that:t,AS_ENTRIES:i})}))).prototype,p=internalStateGetterFor$1(e);forEach2(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var t="add"==e||"set"==e;!(e in l)||o&&"clear"==e||createNonEnumerableProperty(u,e,(function(r,n){var i=p(this).collection;if(!t&&o&&!isObject$9(r))return"get"==e&&void 0;var a=i[e](0===r?0:r,n);return t?this:a}))})),o||defineProperty$2(u,"size",{configurable:!0,get:function(){return p(this).collection.size}})}else n=r.getConstructor(t,e,i,a),InternalMetadataModule.enable();return setToStringTag$2(n,e,!1,!0),c[e]=n,$$P({global:!0,forced:!0},c),o||r.setStrong(n,e,i),n},defineBuiltIn$2=defineBuiltIn$8,defineBuiltIns$2=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:defineBuiltIn$2(e,n,t[n],r);return e},create$4=objectCreate,defineBuiltInAccessor$2=defineBuiltInAccessor$5,defineBuiltIns$1=defineBuiltIns$2,bind$i=functionBindContext,anInstance$2=anInstance$5,isNullOrUndefined$1=isNullOrUndefined$6,iterate$e=iterate$l,defineIterator=iteratorDefine,createIterResultObject=createIterResultObject$3,setSpecies=setSpecies$2,DESCRIPTORS$5=descriptors,fastKey=internalMetadataExports.fastKey,InternalStateModule$2=internalState,setInternalState$2=InternalStateModule$2.set,internalStateGetterFor=InternalStateModule$2.getterFor,collectionStrong$1={getConstructor:function(e,t,r,n){var i=e((function(e,i){anInstance$2(e,o),setInternalState$2(e,{type:t,index:create$4(null),first:void 0,last:void 0,size:0}),DESCRIPTORS$5||(e.size=0),isNullOrUndefined$1(i)||iterate$e(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=internalStateGetterFor(t),s=function(e,t,r){var n,i,o=a(e),s=l(e,t);return s?s.value=r:(o.last=s={index:i=fastKey(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),DESCRIPTORS$5?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},l=function(e,t){var r,n=a(e),i=fastKey(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return defineBuiltIns$1(o,{clear:function(){for(var e=a(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,DESCRIPTORS$5?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=l(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),DESCRIPTORS$5?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=bind$i(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!l(this,e)}}),defineBuiltIns$1(o,r?{get:function(e){var t=l(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),DESCRIPTORS$5&&defineBuiltInAccessor$2(o,"size",{configurable:!0,get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=internalStateGetterFor(t),o=internalStateGetterFor(n);defineIterator(e,t,(function(e,t){setInternalState$2(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?createIterResultObject("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,createIterResultObject(void 0,!0))}),r?"entries":"values",!r,!0),setSpecies(t)}},collection=collection$1,collectionStrong=collectionStrong$1;collection("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),collectionStrong);var path$f=path$x,map$c=path$f.Map,parent$1E=map$c,map$b=parent$1E,parent$1D=map$b,map$a=parent$1D,bind$h=functionBindContext,call$8=functionCall,aCallable$8=aCallable$j,aConstructor$1=aConstructor$3,isNullOrUndefined=isNullOrUndefined$6,iterate$d=iterate$l,push$7=[].push,collectionFrom=function(e){var t,r,n,i,o=arguments.length,a=o>1?arguments[1]:void 0;return aConstructor$1(this),(t=void 0!==a)&&aCallable$8(a),isNullOrUndefined(e)?new this:(r=[],t?(n=0,i=bind$h(a,o>2?arguments[2]:void 0),iterate$d(e,(function(e){call$8(push$7,r,i(e,n++))}))):iterate$d(e,push$7,{that:r}),new this(r))},$$O=_export,from$1=collectionFrom;$$O({target:"Map",stat:!0,forced:!0},{from:from$1});var arraySlice$3=arraySlice$6,collectionOf=function(){return new this(arraySlice$3(arguments))},$$N=_export,of2=collectionOf;$$N({target:"Map",stat:!0,forced:!0},{of:of2});var tryToString$1=tryToString$7,aMap$e=function(e){if("object"==typeof e&&"size"in e&&"has"in e&&"get"in e&&"set"in e&&"delete"in e&&"entries"in e)return e;throw TypeError(tryToString$1(e)+" is not a map")},caller$1=function(e,t){return 1==t?function(t,r){return t[e](r)}:function(t,r,n){return t[e](r,n)}},getBuiltIn$2=getBuiltIn$h,caller=caller$1,Map$5=getBuiltIn$2("Map"),mapHelpers={Map:Map$5,set:caller("set",2),get:caller("get",1),has:caller("has",1),remove:caller("delete",1),proto:Map$5.prototype},$$M=_export,aMap$d=aMap$e,remove=mapHelpers.remove;$$M({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:function(){for(var e,t=aMap$d(this),r=!0,n=0,i=arguments.length;n<i;n++)e=remove(t,arguments[n]),r=r&&e;return!!r}});var $$L=_export,aMap$c=aMap$e,MapHelpers$4=mapHelpers,get$8=MapHelpers$4.get,has$1=MapHelpers$4.has,set$5=MapHelpers$4.set;$$L({target:"Map",proto:!0,real:!0,forced:!0},{emplace:function(e,t){var r,n,i=aMap$c(this);return has$1(i,e)?(r=get$8(i,e),"update"in t&&(r=t.update(r,e,i),set$5(i,e,r)),r):(n=t.insert(e,i),set$5(i,e,n),n)}});var call$7=functionCall,iterateSimple$1=function(e,t,r){for(var n,i,o=r||e.next;!(n=call$7(o,e)).done;)if(void 0!==(i=t(n.value)))return i},iterateSimple=iterateSimple$1,mapIterate=function(e,t,r){return r?iterateSimple(e.entries(),(function(e){return t(e[1],e[0])})):e.forEach(t)},$$K=_export,bind$g=functionBindContext,aMap$b=aMap$e,iterate$c=mapIterate;$$K({target:"Map",proto:!0,real:!0,forced:!0},{every:function(e){var t=aMap$b(this),r=bind$g(e,arguments.length>1?arguments[1]:void 0);return!1!==iterate$c(t,(function(e,n){if(!r(e,n,t))return!1}),!0)}});var $$J=_export,bind$f=functionBindContext,aMap$a=aMap$e,MapHelpers$3=mapHelpers,iterate$b=mapIterate,Map$4=MapHelpers$3.Map,set$4=MapHelpers$3.set;$$J({target:"Map",proto:!0,real:!0,forced:!0},{filter:function(e){var t=aMap$a(this),r=bind$f(e,arguments.length>1?arguments[1]:void 0),n=new Map$4;return iterate$b(t,(function(e,i){r(e,i,t)&&set$4(n,i,e)})),n}});var $$I=_export,bind$e=functionBindContext,aMap$9=aMap$e,iterate$a=mapIterate;$$I({target:"Map",proto:!0,real:!0,forced:!0},{find:function(e){var t=aMap$9(this),r=bind$e(e,arguments.length>1?arguments[1]:void 0),n=iterate$a(t,(function(e,n){if(r(e,n,t))return{value:e}}),!0);return n&&n.value}});var $$H=_export,bind$d=functionBindContext,aMap$8=aMap$e,iterate$9=mapIterate;$$H({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function(e){var t=aMap$8(this),r=bind$d(e,arguments.length>1?arguments[1]:void 0),n=iterate$9(t,(function(e,n){if(r(e,n,t))return{key:n}}),!0);return n&&n.key}});var $$G=_export,call$6=functionCall,uncurryThis$e=functionUncurryThis,isCallable$3=isCallable$p,aCallable$7=aCallable$j,iterate$8=iterate$l,Map$3=mapHelpers.Map,push$6=uncurryThis$e([].push);$$G({target:"Map",stat:!0,forced:!0},{groupBy:function(e,t){var r=new(isCallable$3(this)?this:Map$3);aCallable$7(t);var n=aCallable$7(r.has),i=aCallable$7(r.get),o=aCallable$7(r.set);return iterate$8(e,(function(e){var a=t(e);call$6(n,r,a)?push$6(call$6(i,r,a),e):call$6(o,r,a,[e])})),r}});var sameValueZero$1=function(e,t){return e===t||e!=e&&t!=t},$$F=_export,sameValueZero=sameValueZero$1,aMap$7=aMap$e,iterate$7=mapIterate;$$F({target:"Map",proto:!0,real:!0,forced:!0},{includes:function(e){return!0===iterate$7(aMap$7(this),(function(t){if(sameValueZero(t,e))return!0}),!0)}});var $$E=_export,call$5=functionCall,iterate$6=iterate$l,isCallable$2=isCallable$p,aCallable$6=aCallable$j,Map$2=mapHelpers.Map;$$E({target:"Map",stat:!0,forced:!0},{keyBy:function(e,t){var r=new(isCallable$2(this)?this:Map$2);aCallable$6(t);var n=aCallable$6(r.set);return iterate$6(e,(function(e){call$5(n,r,t(e),e)})),r}});var $$D=_export,aMap$6=aMap$e,iterate$5=mapIterate;$$D({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function(e){var t=iterate$5(aMap$6(this),(function(t,r){if(t===e)return{key:r}}),!0);return t&&t.key}});var $$C=_export,bind$c=functionBindContext,aMap$5=aMap$e,MapHelpers$2=mapHelpers,iterate$4=mapIterate,Map$1=MapHelpers$2.Map,set$3=MapHelpers$2.set;$$C({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function(e){var t=aMap$5(this),r=bind$c(e,arguments.length>1?arguments[1]:void 0),n=new Map$1;return iterate$4(t,(function(e,i){set$3(n,r(e,i,t),e)})),n}});var $$B=_export,bind$b=functionBindContext,aMap$4=aMap$e,MapHelpers$1=mapHelpers,iterate$3=mapIterate,Map=MapHelpers$1.Map,set$2=MapHelpers$1.set;$$B({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function(e){var t=aMap$4(this),r=bind$b(e,arguments.length>1?arguments[1]:void 0),n=new Map;return iterate$3(t,(function(e,i){set$2(n,i,r(e,i,t))})),n}});var $$A=_export,aMap$3=aMap$e,iterate$2=iterate$l,set$1=mapHelpers.set;$$A({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function(e){for(var t=aMap$3(this),r=arguments.length,n=0;n<r;)iterate$2(arguments[n++],(function(e,r){set$1(t,e,r)}),{AS_ENTRIES:!0});return t}});var $$z=_export,aCallable$5=aCallable$j,aMap$2=aMap$e,iterate$1=mapIterate,$TypeError$5=TypeError;$$z({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=aMap$2(this),r=arguments.length<2,n=r?void 0:arguments[1];if(aCallable$5(e),iterate$1(t,(function(i,o){r?(r=!1,n=i):n=e(n,i,o,t)})),r)throw $TypeError$5("Reduce of empty map with no initial value");return n}});var $$y=_export,bind$a=functionBindContext,aMap$1=aMap$e,iterate=mapIterate;$$y({target:"Map",proto:!0,real:!0,forced:!0},{some:function(e){var t=aMap$1(this),r=bind$a(e,arguments.length>1?arguments[1]:void 0);return!0===iterate(t,(function(e,n){if(r(e,n,t))return!0}),!0)}});var $$x=_export,aCallable$4=aCallable$j,aMap=aMap$e,MapHelpers=mapHelpers,$TypeError$4=TypeError,get$7=MapHelpers.get,has=MapHelpers.has,set=MapHelpers.set;$$x({target:"Map",proto:!0,real:!0,forced:!0},{update:function(e,t){var r=aMap(this),n=arguments.length;aCallable$4(t);var i=has(r,e);if(!i&&n<3)throw $TypeError$4("Updating absent value");var o=i?get$7(r,e):aCallable$4(n>2?arguments[2]:void 0)(e,r);return set(r,e,t(o,e,r)),r}});var call$4=functionCall,aCallable$3=aCallable$j,isCallable$1=isCallable$p,anObject$4=anObject$h,$TypeError$3=TypeError,mapUpsert=function(e,t){var r,n=anObject$4(this),i=aCallable$3(n.get),o=aCallable$3(n.has),a=aCallable$3(n.set),s=arguments.length>2?arguments[2]:void 0;if(!isCallable$1(t)&&!isCallable$1(s))throw $TypeError$3("At least one callback required");return call$4(o,n,e)?(r=call$4(i,n,e),isCallable$1(t)&&(r=t(r),call$4(a,n,e,r))):isCallable$1(s)&&(r=s(),call$4(a,n,e,r)),r},$$w=_export,upsert$1=mapUpsert;$$w({target:"Map",proto:!0,real:!0,forced:!0},{upsert:upsert$1});var $$v=_export,upsert2=mapUpsert;$$v({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:upsert2});var parent$1C=map$a,map$9=parent$1C,map$8=map$9,_Map$1=getDefaultExportFromCjs(map$8),map$7=map$8,_Map=getDefaultExportFromCjs(map$7),$$u=_export,$map=arrayIteration.map,arrayMethodHasSpeciesSupport$1=arrayMethodHasSpeciesSupport$5,HAS_SPECIES_SUPPORT$1=arrayMethodHasSpeciesSupport$1("map");$$u({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$1},{map:function(e){return $map(this,e,arguments.length>1?arguments[1]:void 0)}});var entryVirtual$g=entryVirtual$p,map$6=entryVirtual$g("Array").map,isPrototypeOf$h=objectIsPrototypeOf,method$e=map$6,ArrayPrototype$9=Array.prototype,map$5=function(e){var t=e.map;return e===ArrayPrototype$9||isPrototypeOf$h(ArrayPrototype$9,e)&&t===ArrayPrototype$9.map?method$e:t},parent$1B=map$5,map$4=parent$1B,parent$1A=map$4,map$3=parent$1A,parent$1z=map$3,map$2=parent$1z,map$1=map$2,map2=map$1,_mapInstanceProperty=getDefaultExportFromCjs(map2),promise=promise$1,_Promise=getDefaultExportFromCjs(promise),filter3=filter$1,_filterInstanceProperty=getDefaultExportFromCjs(filter3),$$t=_export,$includes=arrayIncludes.includes,fails$9=fails$B,BROKEN_ON_SPARSE=fails$9((function(){return!Array(1).includes()}));$$t({target:"Array",proto:!0,forced:BROKEN_ON_SPARSE},{includes:function(e){return $includes(this,e,arguments.length>1?arguments[1]:void 0)}});var entryVirtual$f=entryVirtual$p,includes$7=entryVirtual$f("Array").includes,isObject$8=isObject$o,classof$3=classofRaw$2,wellKnownSymbol$3=wellKnownSymbol$q,MATCH$1=wellKnownSymbol$3("match"),isRegexp=function(e){var t;return isObject$8(e)&&(void 0!==(t=e[MATCH$1])?!!t:"RegExp"==classof$3(e))},isRegExp=isRegexp,$TypeError$2=TypeError,notARegexp=function(e){if(isRegExp(e))throw $TypeError$2("The method doesn't accept regular expressions");return e},wellKnownSymbol$2=wellKnownSymbol$q,MATCH=wellKnownSymbol$2("match"),correctIsRegexpLogic=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[MATCH]=!1,"/./"[e](t)}catch(e){}}return!1},$$s=_export,uncurryThis$d=functionUncurryThis,notARegExp$1=notARegexp,requireObjectCoercible$4=requireObjectCoercible$8,toString$8=toString$f,correctIsRegExpLogic$1=correctIsRegexpLogic,stringIndexOf=uncurryThis$d("".indexOf);$$s({target:"String",proto:!0,forced:!correctIsRegExpLogic$1("includes")},{includes:function(e){return!!~stringIndexOf(toString$8(requireObjectCoercible$4(this)),toString$8(notARegExp$1(e)),arguments.length>1?arguments[1]:void 0)}});var entryVirtual$e=entryVirtual$p,includes$6=entryVirtual$e("String").includes,isPrototypeOf$g=objectIsPrototypeOf,arrayMethod=includes$7,stringMethod=includes$6,ArrayPrototype$8=Array.prototype,StringPrototype$5=String.prototype,includes$5=function(e){var t=e.includes;return e===ArrayPrototype$8||isPrototypeOf$g(ArrayPrototype$8,e)&&t===ArrayPrototype$8.includes?arrayMethod:"string"==typeof e||e===StringPrototype$5||isPrototypeOf$g(StringPrototype$5,e)&&t===StringPrototype$5.includes?stringMethod:t},parent$1y=includes$5,includes$4=parent$1y,parent$1x=includes$4,includes$3=parent$1x,parent$1w=includes$3,includes$2=parent$1w,includes$1=includes$2,includes4=includes$1,_includesInstanceProperty=getDefaultExportFromCjs(includes4),indexOf2=indexOf$1,_indexOfInstanceProperty=getDefaultExportFromCjs(indexOf2),keys$7=keys$8,_Object$keys=getDefaultExportFromCjs(keys$7),slice2=slice$1,_sliceInstanceProperty=getDefaultExportFromCjs(slice2),tryToString=tryToString$7,$TypeError$1=TypeError,deletePropertyOrThrow$2=function(e,t){if(!delete e[t])throw $TypeError$1("Cannot delete property "+tryToString(t)+" of "+tryToString(e))},$$r=_export,toObject$4=toObject$e,toAbsoluteIndex$2=toAbsoluteIndex$6,toIntegerOrInfinity$2=toIntegerOrInfinity$6,lengthOfArrayLike$4=lengthOfArrayLike$d,setArrayLength=arraySetLength,doesNotExceedSafeInteger=doesNotExceedSafeInteger$3,arraySpeciesCreate=arraySpeciesCreate$3,createProperty=createProperty$6,deletePropertyOrThrow$1=deletePropertyOrThrow$2,arrayMethodHasSpeciesSupport=arrayMethodHasSpeciesSupport$5,HAS_SPECIES_SUPPORT=arrayMethodHasSpeciesSupport("splice"),max=Math.max,min$2=Math.min;$$r({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT},{splice:function(e,t){var r,n,i,o,a,s,l=toObject$4(this),c=lengthOfArrayLike$4(l),u=toAbsoluteIndex$2(e,c),p=arguments.length;for(0===p?r=n=0:1===p?(r=0,n=c-u):(r=p-2,n=min$2(max(toIntegerOrInfinity$2(t),0),c-u)),doesNotExceedSafeInteger(c+r-n),i=arraySpeciesCreate(l,n),o=0;o<n;o++)(a=u+o)in l&&createProperty(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$1(l,s);for(o=c;o>c-n+r;o--)deletePropertyOrThrow$1(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$1(l,s);for(o=0;o<r;o++)l[o+u]=arguments[o+2];return setArrayLength(l,c-n+r),i}});var entryVirtual$d=entryVirtual$p,splice$7=entryVirtual$d("Array").splice,isPrototypeOf$f=objectIsPrototypeOf,method$d=splice$7,ArrayPrototype$7=Array.prototype,splice$6=function(e){var t=e.splice;return e===ArrayPrototype$7||isPrototypeOf$f(ArrayPrototype$7,e)&&t===ArrayPrototype$7.splice?method$d:t},parent$1v=splice$6,splice$5=parent$1v,parent$1u=splice$5,splice$4=parent$1u,parent$1t=splice$4,splice$3=parent$1t,splice$2=splice$3,splice$1=splice$2,_spliceInstanceProperty=getDefaultExportFromCjs(splice$1),$$q=_export;$$q({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var path$e=path$x,isNan$5=path$e.Number.isNaN,parent$1s=isNan$5,isNan$4=parent$1s,parent$1r=isNan$4,isNan$3=parent$1r,parent$1q=isNan$3,isNan$2=parent$1q,isNan$1=isNan$2,isNan=isNan$1,_Number$isNaN=getDefaultExportFromCjs(isNan),whitespaces$4="\t\n\v\f\r                 \u2028\u2029\ufeff",uncurryThis$c=functionUncurryThis,requireObjectCoercible$3=requireObjectCoercible$8,toString$7=toString$f,whitespaces$3=whitespaces$4,replace$3=uncurryThis$c("".replace),ltrim=RegExp("^["+whitespaces$3+"]+"),rtrim=RegExp("(^|[^"+whitespaces$3+"])["+whitespaces$3+"]+$"),createMethod$3=function(e){return function(t){var r=toString$7(requireObjectCoercible$3(t));return 1&e&&(r=replace$3(r,ltrim,"")),2&e&&(r=replace$3(r,rtrim,"$1")),r}},stringTrim={start:createMethod$3(1),end:createMethod$3(2),trim:createMethod$3(3)},global$5=global$p,fails$8=fails$B,uncurryThis$b=functionUncurryThis,toString$6=toString$f,trim$8=stringTrim.trim,whitespaces$2=whitespaces$4,$parseInt$1=global$5.parseInt,Symbol$2=global$5.Symbol,ITERATOR$3=Symbol$2&&Symbol$2.iterator,hex=/^[+-]?0x/i,exec$2=uncurryThis$b(hex.exec),FORCED$5=8!==$parseInt$1(whitespaces$2+"08")||22!==$parseInt$1(whitespaces$2+"0x16")||ITERATOR$3&&!fails$8((function(){$parseInt$1(Object(ITERATOR$3))})),numberParseInt=FORCED$5?function(e,t){var r=trim$8(toString$6(e));return $parseInt$1(r,t>>>0||(exec$2(hex,r)?16:10))}:$parseInt$1,$$p=_export,$parseInt=numberParseInt;$$p({global:!0,forced:parseInt!=numberParseInt},{parseInt:numberParseInt});var path$d=path$x,_parseInt$c=path$d.parseInt,parent$1p=_parseInt$c,_parseInt$b=parent$1p,parent$1o=_parseInt$b,_parseInt$a=parent$1o,parent$1n=_parseInt$a,_parseInt$9=parent$1n,_parseInt$8=_parseInt$9,_parseInt$6=_parseInt$8,_parseInt$7=getDefaultExportFromCjs(_parseInt$6),entryVirtual$c=entryVirtual$p,keys$6=entryVirtual$c("Array").keys,parent$1m=keys$6,keys$5=parent$1m,classof$2=classof$e,hasOwn$6=hasOwnProperty_1,isPrototypeOf$e=objectIsPrototypeOf,method$c=keys$5,ArrayPrototype$6=Array.prototype,DOMIterables$1={DOMTokenList:!0,NodeList:!0},keys$4=function(e){var t=e.keys;return e===ArrayPrototype$6||isPrototypeOf$e(ArrayPrototype$6,e)&&t===ArrayPrototype$6.keys||hasOwn$6(DOMIterables$1,classof$2(e))?method$c:t},parent$1l=keys$4,keys$3=parent$1l,parent$1k=keys$3,keys$2=parent$1k,keys$1=keys$2,keys3=keys$1,_keysInstanceProperty=getDefaultExportFromCjs(keys3),DESCRIPTORS$4=descriptors,uncurryThis$a=functionUncurryThis,call$3=functionCall,fails$7=fails$B,objectKeys$1=objectKeys$4,getOwnPropertySymbolsModule=objectGetOwnPropertySymbols,propertyIsEnumerableModule=objectPropertyIsEnumerable,toObject$3=toObject$e,IndexedObject$1=indexedObject,$assign=Object.assign,defineProperty$1=Object.defineProperty,concat$1=uncurryThis$a([].concat),objectAssign=!$assign||fails$7((function(){if(DESCRIPTORS$4&&1!==$assign({b:1},$assign(defineProperty$1({},"a",{enumerable:!0,get:function(){defineProperty$1(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$1($assign({},t)).join("")!=n}))?function(e,t){for(var r=toObject$3(e),n=arguments.length,i=1,o=getOwnPropertySymbolsModule.f,a=propertyIsEnumerableModule.f;n>i;)for(var s,l=IndexedObject$1(arguments[i++]),c=o?concat$1(objectKeys$1(l),o(l)):objectKeys$1(l),u=c.length,p=0;u>p;)s=c[p++],DESCRIPTORS$4&&!call$3(a,l,s)||(r[s]=l[s]);return r}:$assign,$$o=_export,assign$7=objectAssign;$$o({target:"Object",stat:!0,arity:2,forced:Object.assign!==assign$7},{assign:assign$7});var path$c=path$x,assign$6=path$c.Object.assign,parent$1j=assign$6,assign$5=parent$1j,parent$1i=assign$5,assign$4=parent$1i,parent$1h=assign$4,assign$3=parent$1h,assign$2=assign$3,assign$1=assign$2,_Object$assign=getDefaultExportFromCjs(assign$1),getOwnPropertySymbols2=getOwnPropertySymbols$1,_Object$getOwnPropertySymbols=getDefaultExportFromCjs(getOwnPropertySymbols2),getOwnPropertyDescriptor$1=getOwnPropertyDescriptor$2,_Object$getOwnPropertyDescriptor=getDefaultExportFromCjs(getOwnPropertyDescriptor$1),getOwnPropertyDescriptors2=getOwnPropertyDescriptors$1,_Object$getOwnPropertyDescriptors=getDefaultExportFromCjs(getOwnPropertyDescriptors2),defineProperties4=defineProperties$1,_Object$defineProperties=getDefaultExportFromCjs(defineProperties4),defineProperty5=defineProperty$4,_Object$defineProperty=getDefaultExportFromCjs(defineProperty5),symbol=symbol$1,_Symbol=getDefaultExportFromCjs(symbol),iterator=iterator$1,_Symbol$iterator=getDefaultExportFromCjs(iterator),setPrototypeOf=setPrototypeOf$2,_Object$setPrototypeOf=getDefaultExportFromCjs(setPrototypeOf),getPrototypeOf$1=getPrototypeOf$3,_Object$getPrototypeOf=getDefaultExportFromCjs(getPrototypeOf$1),uncurryThis$9=functionUncurryThis,aCallable$2=aCallable$j,isObject$7=isObject$o,hasOwn$5=hasOwnProperty_1,arraySlice$2=arraySlice$6,NATIVE_BIND=functionBindNative,$Function=Function,concat2=uncurryThis$9([].concat),join$4=uncurryThis$9([].join),factories={},construct$6=function(e,t,r){if(!hasOwn$5(factories,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";factories[t]=$Function("C,a","return new C("+join$4(n,",")+")")}return factories[t](e,r)},functionBind=NATIVE_BIND?$Function.bind:function(e){var t=aCallable$2(this),r=t.prototype,n=arraySlice$2(arguments,1),i=function(){var r=concat2(n,arraySlice$2(arguments));return this instanceof i?construct$6(t,r.length,r):t.apply(e,r)};return isObject$7(r)&&(i.prototype=r),i},$$n=_export,getBuiltIn$1=getBuiltIn$h,apply$2=functionApply,bind$9=functionBind,aConstructor=aConstructor$3,anObject$3=anObject$h,isObject$6=isObject$o,create$3=objectCreate,fails$6=fails$B,nativeConstruct=getBuiltIn$1("Reflect","construct"),ObjectPrototype=Object.prototype,push$5=[].push,NEW_TARGET_BUG=fails$6((function(){function e(){}return!(nativeConstruct((function(){}),[],e)instanceof e)})),ARGS_BUG=!fails$6((function(){nativeConstruct((function(){}))})),FORCED$4=NEW_TARGET_BUG||ARGS_BUG;$$n({target:"Reflect",stat:!0,forced:FORCED$4,sham:FORCED$4},{construct:function(e,t){aConstructor(e),anObject$3(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$2(push$5,n,t),new(apply$2(bind$9,e,n))}var i=r.prototype,o=create$3(isObject$6(i)?i:ObjectPrototype),a=apply$2(e,o,t);return isObject$6(a)?a:o}});var path$b=path$x,construct$5=path$b.Reflect.construct,parent$1g=construct$5,construct$4=parent$1g,parent$1f=construct$4,construct$3=parent$1f,parent$1e=construct$3,construct$2=parent$1e,construct$1=construct$2,_Reflect$construct$1=getDefaultExportFromCjs(construct$1),construct2=construct$1,_Reflect$construct=getDefaultExportFromCjs(construct2),hasOwn$4=hasOwnProperty_1,isDataDescriptor$1=function(e){return void 0!==e&&(hasOwn$4(e,"value")||hasOwn$4(e,"writable"))},$$m=_export,call$2=functionCall,isObject$5=isObject$o,anObject$2=anObject$h,isDataDescriptor=isDataDescriptor$1,getOwnPropertyDescriptorModule=objectGetOwnPropertyDescriptor,getPrototypeOf2=objectGetPrototypeOf;function get$6(e,t){var r,n,i=arguments.length<3?e:arguments[2];return anObject$2(e)===i?e[t]:(r=getOwnPropertyDescriptorModule.f(e,t))?isDataDescriptor(r)?r.value:void 0===r.get?void 0:call$2(r.get,i):isObject$5(n=getPrototypeOf2(e))?get$6(n,t,i):void 0}$$m({target:"Reflect",stat:!0},{get:get$6});var path$a=path$x,get$5=path$a.Reflect.get,parent$1d=get$5,get$4=parent$1d,parent$1c=get$4,get$3=parent$1c,parent$1b=get$3,get$2=parent$1b,get$1=get$2,_Reflect$get$1=getDefaultExportFromCjs(get$1),get=get$1,_Reflect$get=getDefaultExportFromCjs(get),getIteratorMethod$1=getIteratorMethod$3,_getIteratorMethod=getDefaultExportFromCjs(getIteratorMethod$1),from3=from$2,_Array$from=getDefaultExportFromCjs(from3),toPrimitive=toPrimitive$1,_Symbol$toPrimitive=getDefaultExportFromCjs(toPrimitive);function ownKeys$1(e,t){var r=_Object$keys(e);if(_Object$getOwnPropertySymbols){var n=_Object$getOwnPropertySymbols(e);t&&(n=_filterInstanceProperty(n).call(n,(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$1(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 _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$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,_toPropertyKey(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 _defineProperty$1(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 _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$1(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$1(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf$1(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 _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _iterableToArray(e){if(void 0!==_Symbol&&null!=_getIteratorMethod(e)||null!=e["@@iterator"])return _Array$from(e)}function _unsupportedIterableToArray(e,t){var r;if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=_sliceInstanceProperty(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?_Array$from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_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 _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(e,t){if("object"!==_typeof$1(e)||null===e)return e;var r=e[_Symbol$toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==_typeof$1(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$1(t)?t:String(t)}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?_sliceInstanceProperty(n).call(n,1):n);return _Object$getOwnPropertySymbols?_concatInstanceProperty(i).call(i,_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],p=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),p){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(p-1);c<p;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var f,d=u.length;for(c=0;c<d;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),p){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(f=1,l=new Array(p-1);f<p;f++)l[f-1]=arguments[f];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 eventemitter3Exports=eventemitter3.exports,EventEmitter=getDefaultExportFromCjs(eventemitter3Exports),toIntegerOrInfinity$1=toIntegerOrInfinity$6,toString$5=toString$f,requireObjectCoercible$2=requireObjectCoercible$8,$RangeError$2=RangeError,stringRepeat=function(e){var t=toString$5(requireObjectCoercible$2(this)),r="",n=toIntegerOrInfinity$1(e);if(n<0||n==1/0)throw $RangeError$2("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},uncurryThis$8=functionUncurryThis,toLength$1=toLength$3,toString$4=toString$f,$repeat=stringRepeat,requireObjectCoercible$1=requireObjectCoercible$8,repeat$8=uncurryThis$8($repeat),stringSlice$3=uncurryThis$8("".slice),ceil=Math.ceil,createMethod$2=function(e){return function(t,r,n){var i,o,a=toString$4(requireObjectCoercible$1(t)),s=toLength$1(r),l=a.length,c=void 0===n?" ":toString$4(n);return s<=l||""==c?a:((o=repeat$8(c,ceil((i=s-l)/c.length))).length>i&&(o=stringSlice$3(o,0,i)),e?a+o:o+a)}},stringPad={start:createMethod$2(!1),end:createMethod$2(!0)},userAgent$2=engineUserAgent,stringPadWebkitBug=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(userAgent$2),$$l=_export,$padStart=stringPad.start,WEBKIT_BUG=stringPadWebkitBug;$$l({target:"String",proto:!0,forced:WEBKIT_BUG},{padStart:function(e){return $padStart(this,e,arguments.length>1?arguments[1]:void 0)}});var entryVirtual$b=entryVirtual$p,padStart$6=entryVirtual$b("String").padStart,isPrototypeOf$d=objectIsPrototypeOf,method$b=padStart$6,StringPrototype$4=String.prototype,padStart$5=function(e){var t=e.padStart;return"string"==typeof e||e===StringPrototype$4||isPrototypeOf$d(StringPrototype$4,e)&&t===StringPrototype$4.padStart?method$b:t},parent$1a=padStart$5,padStart$4=parent$1a,parent$19=padStart$4,padStart$3=parent$19,parent$18=padStart$3,padStart$2=parent$18,padStart$1=padStart$2,padStart2=padStart$1,_padStartInstanceProperty=getDefaultExportFromCjs(padStart2),global$4=global$p,fails$5=fails$B,uncurryThis$7=functionUncurryThis,toString$3=toString$f,trim$7=stringTrim.trim,whitespaces$1=whitespaces$4,charAt$2=uncurryThis$7("".charAt),$parseFloat$1=global$4.parseFloat,Symbol$1=global$4.Symbol,ITERATOR$2=Symbol$1&&Symbol$1.iterator,FORCED$3=1/$parseFloat$1(whitespaces$1+"-0")!=-1/0||ITERATOR$2&&!fails$5((function(){$parseFloat$1(Object(ITERATOR$2))})),numberParseFloat=FORCED$3?function(e){var t=trim$7(toString$3(e)),r=$parseFloat$1(t);return 0===r&&"-"==charAt$2(t,0)?-0:r}:$parseFloat$1,$$k=_export,$parseFloat=numberParseFloat;$$k({global:!0,forced:parseFloat!=numberParseFloat},{parseFloat:numberParseFloat});var path$9=path$x,_parseFloat$c=path$9.parseFloat,parent$17=_parseFloat$c,_parseFloat$b=parent$17,parent$16=_parseFloat$b,_parseFloat$a=parent$16,parent$15=_parseFloat$a,_parseFloat$9=parent$15,_parseFloat$8=_parseFloat$9,_parseFloat$6=_parseFloat$8,_parseFloat$7=getDefaultExportFromCjs(_parseFloat$6),PROPER_FUNCTION_NAME=functionName.PROPER,fails$4=fails$B,whitespaces=whitespaces$4,non="​…᠎",stringTrimForced=function(e){return fails$4((function(){return!!whitespaces[e]()||non[e]()!==non||PROPER_FUNCTION_NAME&&whitespaces[e].name!==e}))},$$j=_export,$trim=stringTrim.trim,forcedStringTrimMethod=stringTrimForced;$$j({target:"String",proto:!0,forced:forcedStringTrimMethod("trim")},{trim:function(){return $trim(this)}});var entryVirtual$a=entryVirtual$p,trim$6=entryVirtual$a("String").trim,isPrototypeOf$c=objectIsPrototypeOf,method$a=trim$6,StringPrototype$3=String.prototype,trim$5=function(e){var t=e.trim;return"string"==typeof e||e===StringPrototype$3||isPrototypeOf$c(StringPrototype$3,e)&&t===StringPrototype$3.trim?method$a:t},parent$14=trim$5,trim$4=parent$14,parent$13=trim$4,trim$3=parent$13,parent$12=trim$3,trim$2=parent$12,trim$1=trim$2,trim2=trim$1,_trimInstanceProperty=getDefaultExportFromCjs(trim2),arraySlice$1=arraySliceSimple,floor$2=Math.floor,mergeSort=function(e,t){var r=e.length,n=floor$2(r/2);return r<8?insertionSort(e,t):merge2(e,mergeSort(arraySlice$1(e,0,n),t),mergeSort(arraySlice$1(e,n),t),t)},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},merge2=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$1=engineUserAgent,firefox=userAgent$1.match(/firefox\/(\d+)/i),engineFfVersion=!!firefox&&+firefox[1],UA=engineUserAgent,engineIsIeOrEdge=/MSIE|Trident/.test(UA),userAgent=engineUserAgent,webkit=userAgent.match(/AppleWebKit\/(\d+)\./),engineWebkitVersion=!!webkit&&+webkit[1],$$i=_export,uncurryThis$6=functionUncurryThis,aCallable$1=aCallable$j,toObject$2=toObject$e,lengthOfArrayLike$3=lengthOfArrayLike$d,deletePropertyOrThrow=deletePropertyOrThrow$2,toString$2=toString$f,fails$3=fails$B,internalSort=arraySort$1,arrayMethodIsStrict$2=arrayMethodIsStrict$5,FF=engineFfVersion,IE_OR_EDGE=engineIsIeOrEdge,V8=engineV8Version,WEBKIT=engineWebkitVersion,test=[],nativeSort=uncurryThis$6(test.sort),push$4=uncurryThis$6(test.push),FAILS_ON_UNDEFINED=fails$3((function(){test.sort(void 0)})),FAILS_ON_NULL=fails$3((function(){test.sort(null)})),STRICT_METHOD$1=arrayMethodIsStrict$2("sort"),STABLE_SORT=!fails$3((function(){if(V8)return V8<70;if(!(FF&&FF>3)){if(IE_OR_EDGE)return!0;if(WEBKIT)return WEBKIT<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$2=FAILS_ON_UNDEFINED||!FAILS_ON_NULL||!STRICT_METHOD$1||!STABLE_SORT,getSortCompare=function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:toString$2(t)>toString$2(r)?1:-1}};$$i({target:"Array",proto:!0,forced:FORCED$2},{sort:function(e){void 0!==e&&aCallable$1(e);var t=toObject$2(this);if(STABLE_SORT)return void 0===e?nativeSort(t):nativeSort(t,e);var r,n,i=[],o=lengthOfArrayLike$3(t);for(n=0;n<o;n++)n in t&&push$4(i,t[n]);for(internalSort(i,getSortCompare(e)),r=lengthOfArrayLike$3(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)deletePropertyOrThrow(t,n++);return t}});var _context$3,entryVirtual$9=entryVirtual$p,sort$6=entryVirtual$9("Array").sort,isPrototypeOf$b=objectIsPrototypeOf,method$9=sort$6,ArrayPrototype$5=Array.prototype,sort$5=function(e){var t=e.sort;return e===ArrayPrototype$5||isPrototypeOf$b(ArrayPrototype$5,e)&&t===ArrayPrototype$5.sort?method$9:t},parent$11=sort$5,sort$4=parent$11,parent$10=sort$4,sort$3=parent$10,parent$$=sort$3,sort$2=parent$$,sort$1=sort$2,sort2=sort$1,_sortInstanceProperty=getDefaultExportFromCjs(sort2),XG_DEBUG_OPEN="undefined"!=typeof window&&window.location&&_indexOfInstanceProperty(_context$3=window.location.href).call(_context$3,"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,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];this.config.debug>=3&&(r=console).log.apply(r,_concatInstanceProperty(t=[XGTAG,STYLE.info,e]).call(t,i))},logWarn:function(e){for(var t,r,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];this.config.debug>=1&&(r=console).warn.apply(r,_concatInstanceProperty(t=[XGTAG,STYLE.warn,e]).call(t,i))},logError:function(e){var t,r;if(!(this.config.debug<1)){for(var n=this.config.debug>=2?"trace":"error",i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];(r=console)[n].apply(r,_concatInstanceProperty(t=[XGTAG,STYLE.error,e]).call(t,o))}}};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(this,e),this.bufferedList=t}return _createClass$1(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$1={};function checkIsIn(e,t){for(var r=0,n=t.length;r<n;r++)if(_indexOfInstanceProperty(e).call(e,t[r])>-1)return!0;return!1}function isObject$4(e){var t=_typeof(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,p=!1,f=!0,d=!t&&0!==t&&"function"==typeof window.requestAnimationFrame;if("function"!=typeof e)throw new TypeError("Expected a function");function h(t){var r=n,o=i;return n=i=void 0,c=t,a=e.apply(o,r)}function y(e,t){return d?(window.cancelAnimationFrame(s),window.requestAnimationFrame(e)):setTimeout(e,t)}function g(e){var r=e-l;return void 0===l||r>=t||r<0||p&&e-c>=o}function _(){var e=Date.now();if(g(e))return v(e);s=y(_,function(e){var r=e-c,n=t-(e-l);return p?Math.min(n,o-r):n}(e))}function v(e){return s=void 0,f&&n?h(e):(n=i=void 0,a)}function m(){for(var e=Date.now(),r=g(e),o=arguments.length,f=new Array(o),d=0;d<o;d++)f[d]=arguments[d];if(n=f,i=this,l=e,r){if(void 0===s)return function(e){return c=e,s=y(_,t),u?h(e):a}(l);if(p)return s=y(_,t),h(l)}return void 0===s&&(s=y(_,t)),a}return t=+t||0,isObject$4(r)&&(u=!!r.leading,o=(p="maxWait"in r)?Math.max(+r.maxWait||0,t):o,f="trailing"in r?!!r.trailing:f),m.cancel=function(){void 0!==s&&function(e){if(d)return window.cancelAnimationFrame(e);clearTimeout(e)}(s),c=0,n=l=i=s=void 0},m.flush=function(){return void 0===s?a:v(Date.now())},m.pending=function(){return void 0!==s},m}function throttle(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return isObject$4(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(){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$1.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$1.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$1.addClass(i,r),t&&_Object$keys(t).forEach((function(e){i.setAttribute(e,t[e])})),i):null}catch(e){return XG_DEBUG.logError("util.createDomFromHtml",e),null}},util$1.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(e.className)?e.getAttribute("class"):e.className;return r&&!!r.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},util$1.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$1.hasClass(e,t)||(e.className&&"object"===_typeof(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},util$1.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$1.hasClass(e,t)&&t.split(/\s+/g).forEach((function(t){var r=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===_typeof(e.className)?e.setAttribute("class",e.getAttribute("class").replace(r," ")):e.className=e.className.replace(r," ")}))}},util$1.toggleClass=function(e,t){e&&t.split(/\s+/g).forEach((function(t){util$1.hasClass(e,t)?util$1.removeClass(e,t):util$1.addClass(e,t)}))},util$1.classNames=function(){for(var e=arguments,t=[],r=function(r){if("String"===util$1.typeOf(e[r]))t.push(e[r]);else if("Object"===util$1.typeOf(e[r])){var n;_mapInstanceProperty(n=_Object$keys(e[r])).call(n,(function(n){e[r][n]&&t.push(n)}))}},n=0;n<arguments.length;n++)r(n);return t.join(" ")},util$1.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===_indexOfInstanceProperty(r).call(r,"#")&&(e=t.getElementById(_sliceInstanceProperty(r).call(r,1)))}return e},util$1.getCss=function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},util$1.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$1.format=function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=_padStartInstanceProperty(util$1).call(util$1,Math.floor(e/3600),2,0),r=_padStartInstanceProperty(util$1).call(util$1,Math.floor((e-3600*t)/60),2,0),n=_padStartInstanceProperty(util$1).call(util$1,Math.floor(e-3600*t-60*r),2,0);return("00"===t?[r,n]:[t,r,n]).join(":")},util$1.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$1.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},util$1.deepCopy=function(e,t){if("Object"===util$1.typeOf(t)&&"Object"===util$1.typeOf(e))return _Object$keys(t).forEach((function(r){if("Object"!==util$1.typeOf(t[r])||t[r]instanceof Node)if("Array"===util$1.typeOf(t[r])){var n;e[r]="Array"===util$1.typeOf(e[r])?_concatInstanceProperty(n=e[r]).call(n,t[r]):t[r]}else e[r]=t[r];else void 0===e[r]||void 0===e[r]?e[r]=t[r]:util$1.deepCopy(e[r],t[r])})),e},util$1.deepMerge=function(e,t){var r;return _mapInstanceProperty(r=_Object$keys(t)).call(r,(function(r){var n;"Array"===util$1.typeOf(t[r])&&"Array"===util$1.typeOf(e[r])?"Array"===util$1.typeOf(e[r])&&(n=e[r]).push.apply(n,_toConsumableArray(t[r])):util$1.typeOf(e[r])!==util$1.typeOf(t[r])||null===e[r]||"Object"!==util$1.typeOf(e[r])||t[r]instanceof window.Node?null!==t[r]&&(e[r]=t[r]):util$1.deepMerge(e[r],t[r])})),e},util$1.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$1.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$1.setInterval=function(e,t,r,n){e._interval[t]||(e._interval[t]=window.setInterval(r.bind(e),n))},util$1.clearInterval=function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},util$1.setTimeout=function(e,t,r){e._timers||(e._timers=[]);var n=setTimeout((function(){t(),util$1.clearTimeout(e,n)}),r);return e._timers.push(n),n},util$1.clearTimeout=function(e,t){var r=e._timers;if("Array"===util$1.typeOf(r)){for(var n=0;n<r.length;n++)if(r[n]===t){_spliceInstanceProperty(r).call(r,n,1),clearTimeout(t);break}}else clearTimeout(t)},util$1.clearAllTimers=function(e){var t=e._timers;"Array"===util$1.typeOf(t)&&(_mapInstanceProperty(t).call(t,(function(e){clearTimeout(e)})),e._timerIds=[])},util$1.createImgBtn=function(e,t,r,n){var i,o,a,s,l,c,u,p,f,d,h,y=util$1.createDom("xg-".concat(e),"",{},"xgplayer-".concat(e,"-img"));(y.style.backgroundImage='url("'.concat(t,'")'),r&&n)&&(["px","rem","em","pt","dp","vw","vh","vm","%"].every((function(e){var t,i;return!(_indexOfInstanceProperty(r).call(r,e)>-1&&_indexOfInstanceProperty(n).call(n,e)>-1)||(c=_parseFloat$7(_trimInstanceProperty(t=_sliceInstanceProperty(r).call(r,0,_indexOfInstanceProperty(r).call(r,e))).call(t)),u=_parseFloat$7(_trimInstanceProperty(i=_sliceInstanceProperty(n).call(n,0,_indexOfInstanceProperty(n).call(n,e))).call(i)),p=e,!1)})),y.style.width=_concatInstanceProperty(i="".concat(c)).call(i,p),y.style.height=_concatInstanceProperty(o="".concat(u)).call(o,p),y.style.backgroundSize=_concatInstanceProperty(a=_concatInstanceProperty(s=_concatInstanceProperty(l="".concat(c)).call(l,p," ")).call(s,u)).call(a,p),y.style.margin="start"===e?_concatInstanceProperty(f=_concatInstanceProperty(d=_concatInstanceProperty(h="-".concat(u/2)).call(h,p," auto auto -")).call(d,c/2)).call(f,p):"auto 5px auto 5px");return y},util$1.Hex2RGBA=function(e,t){var r,n=[];if(/^\#[0-9A-F]{3}$/i.test(e)){var i="#";e.replace(/[0-9A-F]/gi,(function(e){i+=e+e})),e=i}return/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,(function(e){n.push(_parseInt$7(e,16))})),_concatInstanceProperty(r="rgba(".concat(n.join(","),", ")).call(r,t,")")):"rgba(255, 255, 255, 0.1)"},util$1.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},util$1.checkIsFunction=function(e){return e&&"function"==typeof e},util$1.checkIsObject=function(e){return null!==e&&"object"===_typeof(e)},util$1.hide=function(e){e.style.display="none"},util$1.show=function(e,t){e.style.display=t||"block"},util$1.isUndefined=function(e){if(null==e)return!0},util$1.isNotNull=function(e){return!(null==e)},util$1.setStyleFromCsstext=function(e,t){if(t)if("String"===util$1.typeOf(t)){var r=t.replace(/\s+/g,"").split(";");_mapInstanceProperty(r).call(r,(function(t){if(t){var r=t.split(":");r.length>1&&(e.style[r[0]]=r[1])}}))}else{var n;_mapInstanceProperty(n=_Object$keys(t)).call(n,(function(r){e.style[r]=t[r]}))}},util$1.filterStyleFromText=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],n=e.style.cssText;if(!n)return{};var i=n.replace(/\s+/g,"").split(";"),o={},a={};return _mapInstanceProperty(i).call(i,(function(e){if(e){var t=e.split(":");t.length>1&&(checkIsIn(t[0],r)?o[t[0]]=t[1]:a[t[0]]=t[1])}})),e.setAttribute("style",""),_mapInstanceProperty(t=_Object$keys(a)).call(t,(function(t){e.style[t]=a[t]})),o},util$1.getStyleFromCsstext=function(e){var t=e.style.cssText;if(!t)return{};var r=t.replace(/\s+/g,"").split(";"),n={};return _mapInstanceProperty(r).call(r,(function(e){if(e){var t=e.split(":");t.length>1&&(n[t[0]]=t[1])}})),n},util$1.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$1.stopPropagation=function(e){e&&e.stopPropagation()},util$1.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},util$1.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},util$1.checkTouchSupport=function(){return"ontouchstart"in window},util$1.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)});_sortInstanceProperty(r).call(r,(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$1.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$1.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},util$1.getHostFromUrl=function(e){if("String"!==util$1.typeOf(e))return"";var t=e.split("/"),r="";return t.length>3&&t[2]&&(r=t[2]),r},util$1.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},util$1.isMSE=function(e){return e.media&&(e=e.media),!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},util$1.isBlob=function(e){return"string"==typeof e&&/^blob/.test(e)},util$1.generateSessionId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=(new Date).getTime();try{e=_parseInt$7(e)}catch(t){e=0}return t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=_parseInt$7(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)}))},util$1.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},util$1.adjustTimeByDuration=function(e,t,r){return t&&e&&(e>t||r&&e<t)?t:e},util$1.createPositionBar=function(e,t){var r=util$1.createDom("xg-bar","",{"data-index":-1},e);return t.appendChild(r),r},util$1.getTransformStyle=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n={scale:"".concat(t.scale||1),translate:_concatInstanceProperty(e="".concat(t.x||0,"%, ")).call(e,t.y||0,"%"),rotate:"".concat(t.rotate||0,"deg")};return _Object$keys(n).forEach((function(e){var t,i=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),o=_concatInstanceProperty(t="".concat(e,"(")).call(t,n[e],")");i.test(r)?(i.lastIndex=-1,r=r.replace(i,o)):r+="".concat(o," ")})),r},util$1.convertDeg=function(e){return Math.abs(e)<=1?360*e:e%360},util$1.getIndexByTime=function(e,t){var r=t.length,n=-1;if(r<1)return n;if(e<=t[0].end||r<2)n=0;else if(e>t[r-1].end)n=r-1;else for(var i=1;i<r;i++)if(e>t[i-1].end&&e<=t[i].end){n=i;break}return n},util$1.getOffsetCurrentTime=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n=-1;if((n=r>=0&&r<t.length?r:util$1.getIndexByTime(e,t))<0)return-1;var i=t.length,o=t[n],a=o.start,s=o.end,l=o.cTime,c=o.offset;return e<a?l:e>=a&&e<=s?e-c:e>s&&n>=i-1?s:-1},util$1.getCurrentTimeByOffset=function(e,t){var r=-1;if(!t||t.length<0)return e;for(var n=0;n<t.length;n++)if(e<=t[n].duration){r=n;break}if(-1!==r){var i=t[r].start;return r-1<0?i+e:i+(e-t[r-1].duration)}return e};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(){var e,t;if("undefined"==typeof navigator)return"";var r=navigator.userAgent.toLowerCase(),n={ie:/rv:([\d.]+)\) like gecko/,firefox:/firefox\/([\d.]+)/,chrome:/chrome\/([\d.]+)/,opera:/opera.([\d.]+)/,safari:/version\/([\d.]+).*safari/};return _concatInstanceProperty(e=[]).call(e,_filterInstanceProperty(t=_Object$keys(n)).call(t,(function(e){return n[e].test(r)})))[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)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,a=o||n&&!/(?:Mobile)/.test(e)||i&&/(?:Tablet)/.test(e),s=/(?:iPhone)/.test(e)&&!a;return{isTablet:a,isPhone:s,isIpad:o,isIos:s||o,isAndroid:n,isPc:!(s||n||r||a),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$7(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&&_mapInstanceProperty(H264_MIMETYPES).call(H264_MIMETYPES,(function(r){"probably"===t.canPlayType('video/mp4; codecs="'.concat(r,'"'))&&(e.isSupport=!0,e.mime+="||".concat(r))})),this.supportResult=e,t=null,e},isMSESupport:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if("undefined"==typeof MediaSource||!MediaSource)return!1;try{return MediaSource.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}},isHevcSupported:function(){return!("undefined"==typeof MediaSource||!MediaSource.isTypeSupported)&&(MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"'))},probeConfigSupported:function(e){var t={supported:!1,smooth:!1,powerEfficient:!1};if(!e||"undefined"==typeof navigator)return _Promise.resolve(t);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(e);var 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(e){return _Promise.resolve(t)}}},version="3.0.19-rc.0",ERROR_TYPE_MAP={1:"media",2:"media",3:"media",4:"media",5:"media",6:"media"},ERROR_MAP={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},Errors=_createClass$1((function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};_classCallCheck(this,e);var n=t&&t.i18n?t.i18n.ERROR_TYPES:null;if(t.media){var i,o=r.mediaError?r.mediaError:t.media.error||{},a=t.duration,s=t.currentTime,l=t.ended,c=t.src,u=t.currentSrc,p=t.media,f=p.readyState,d=p.networkState,h=r.errorCode||o.code;ERROR_MAP[h]&&(h=ERROR_MAP[h]);var y={playerVersion:version,currentTime:s,duration:a,ended:l,readyState:f,networkState:d,src:c||u,errorType:r.errorType,errorCode:h,message:r.errorMessage||o.message,mediaError:o,originError:r.originError?r.originError.stack:"",host:util$1.getHostFromUrl(c||u)};return r.ext&&_mapInstanceProperty(i=_Object$keys(r.ext)).call(i,(function(e){y[e]=r.ext[e]})),y}if(arguments.length>1){for(var g={playerVersion:version,domain:document.domain},_=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],v=0;v<arguments.length;v++)g[_[v]]=arguments[v];return g.ex=n?(n[arguments[0]]||{}).msg:"",g}})),PLAY="play",PLAYING="playing",ENDED="ended",PAUSE="pause",ERROR$2="error",SEEKING="seeking",SEEKED="seeked",TIME_UPDATE="timeupdate",WAITING="waiting",CANPLAY="canplay",CANPLAY_THROUGH="canplaythrough",DURATION_CHANGE="durationchange",VOLUME_CHANGE="volumechange",LOADED_DATA="loadeddata",LOADED_METADATA="loadedmetadata",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",LEAVE_PLAYER="leaveplayer",ENTER_PLAYER="enterplayer",LOADING="loading",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",SOURCE_ERROR="source_error",SOURCE_SUCCESS="source_success",SWITCH_SUBTITLE="switch_subtitle",VIDEO_EVENTS=["play","playing","ended","pause","error","seeking","seeked","timeupdate","waiting","canplay","canplaythrough","durationchange","volumechange","loadeddata","loadedmetadata","ratechange","progress","loadstart","emptied","stalled","suspend","abort","lowdecode"],STATS_EVENTS={STATS_INFO:"stats_info",STATS_DOWNLOAD:"stats_download",STATS_RESET:"stats_reset"},FPS_STUCK="fps_stuck",XGEvents=Object.freeze({__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,ENTER_PLAYER:ENTER_PLAYER,ERROR:ERROR$2,FPS_STUCK:FPS_STUCK,FULLSCREEN_CHANGE:FULLSCREEN_CHANGE,LEAVE_PLAYER:LEAVE_PLAYER,LOADED_DATA:LOADED_DATA,LOADED_METADATA:LOADED_METADATA,LOADING:LOADING,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,SOURCE_ERROR:SOURCE_ERROR,SOURCE_SUCCESS:SOURCE_SUCCESS,STALLED:STALLED,STATS_EVENTS:STATS_EVENTS,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});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$1.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(r){throw emitVideoEvent.call(t,e,i),r}}else emitVideoEvent.call(t,e,i)}}var MediaProxy=function(e){_inherits$1(r,EventEmitter);var t=_createSuper$1(r);function r(e){var n;_classCallCheck(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","data-index":-1},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"),e.autoplayMuted&&!Object.prototype.hasOwnProperty.call(n.mediaConfig,"muted")&&(n.mediaConfig.muted=!0),n.media=util$1.createDom(n.mediaConfig.mediaType,"",n.mediaConfig,""),e.defaultPlaybackRate&&(n.media.defaultPlaybackRate=n.media.playbackRate=e.defaultPlaybackRate),"Number"===util$1.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$1(r,[{key:"setEventsMiddleware",value:function(e){var t,r=this;_mapInstanceProperty(t=_Object$keys(e)).call(t,(function(t){r.mediaEventMiddleware[t]=e[t]}))}},{key:"removeEventsMiddleware",value:function(e){var t,r=this;_mapInstanceProperty(t=_Object$keys(e)).call(t,(function(e){delete r.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=_mapInstanceProperty(VIDEO_EVENTS).call(VIDEO_EVENTS,(function(t){var r,n=_concatInstanceProperty(r="on".concat(t.charAt(0).toUpperCase())).call(r,_sliceInstanceProperty(t).call(t,1));return"function"==typeof e[n]&&e.on(t,e[n]),_defineProperty$1({},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,n=_Object$keys(t)[0],i=_concatInstanceProperty(r="on".concat(n.charAt(0).toUpperCase())).call(r,_sliceInstanceProperty(n).call(n,1));"function"==typeof e[i]&&e.off(n,e[i])})),this._evHandlers=null}},{key:"_attachSourceEvents",value:function(e,t){var r=this;e.removeAttribute("src"),e.load(),t.forEach((function(e,t){r.media.appendChild(util$1.createDom("source","",{src:"".concat(e.src),type:"".concat(e.type||""),"data-index":t+1}))}));var n=e.children;if(n){this._videoSourceCount=n.length,this._videoSourceIndex=n.length,this._vLoadeddata=function(e){r.emit(SOURCE_SUCCESS,{src:e.target.currentSrc,host:util$1.getHostFromUrl(e.target.currentSrc)})};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){var t=_parseInt$7(e.target.getAttribute("data-index"),10);if(r._videoSourceIndex--,0===r._videoSourceIndex||t>=r._videoSourceCount){var n={code:4,message:"sources_load_error"};i?i.error(e,n):r.errorHandler("error",n)}var o=ERROR_TYPE_MAP[4];r.emit(SOURCE_ERROR,new Errors(r,{errorType:o,errorCode:4,errorMessage:"sources_load_error",mediaError:{code:4,message:"sources_load_error"},src:e.target.src}))});for(var a=0;a<n.length;a++)n[a].addEventListener("error",this._sourceError);e.addEventListener("loadeddata",this._vLoadeddata)}}},{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]);this._vLoadeddata&&e.removeEventListener("loadeddata",this._vLoadeddata)}}},{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},set:function(e){this.media=e}},{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$1.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.networkState}},{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,util$1.isMSE(this.media)?this.onWaiting():(this._detachSourceEvents(this.media),"Array"===util$1.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:"aspectRatio",get:function(){return this.media?this.media.videoWidth/this.media.videoHeight:0}},{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,o=arguments.length,a=new Array(o>2?o-2:0),s=2;s<o;s++)a[s-2]=arguments[s];(i=_get$1(_getPrototypeOf$1(r.prototype),"emit",this)).call.apply(i,_concatInstanceProperty(n=[this,e,t]).call(n,a))}},{key:"on",value:function(e,t){for(var n,i,o=arguments.length,a=new Array(o>2?o-2:0),s=2;s<o;s++)a[s-2]=arguments[s];(i=_get$1(_getPrototypeOf$1(r.prototype),"on",this)).call.apply(i,_concatInstanceProperty(n=[this,e,t]).call(n,a))}},{key:"once",value:function(e,t){for(var n,i,o=arguments.length,a=new Array(o>2?o-2:0),s=2;s<o;s++)a[s-2]=arguments[s];(i=_get$1(_getPrototypeOf$1(r.prototype),"once",this)).call.apply(i,_concatInstanceProperty(n=[this,e,t]).call(n,a))}},{key:"off",value:function(e,t){for(var n,i,o=arguments.length,a=new Array(o>2?o-2:0),s=2;s<o;s++)a[s-2]=arguments[s];(i=_get$1(_getPrototypeOf$1(r.prototype),"off",this)).call.apply(i,_concatInstanceProperty(n=[this,e,t]).call(n,a))}},{key:"offAll",value:function(){_get$1(_getPrototypeOf$1(r.prototype),"removeAllListeners",this).call(this)}}]),r}(),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(this,e),this.indexedDB=window.indexedDB||window.webkitindexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange,this.myDB=t}return _createClass$1(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,i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];var s,l=t.call.apply(t,_concatInstanceProperty(n=[e]).call(n,o));r&&"function"==typeof r&&(l&&l.then?l.then((function(){for(var t,n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];r.call.apply(r,_concatInstanceProperty(t=[e]).call(t,i))})):r.call.apply(r,_concatInstanceProperty(s=[e]).call(s,o)))}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,i=arguments,o=this;if(r.pre)try{var a,s;(s=r.pre).call.apply(s,_concatInstanceProperty(a=[this]).call(a,_sliceInstanceProperty(Array.prototype).call(arguments)))}catch(t){var l,c;throw t.message=_concatInstanceProperty(l=_concatInstanceProperty(c="[pluginName: ".concat(this.pluginName,":")).call(c,e,":pre error] >> ")).call(l,t.message),t}if(this.__hooks&&this.__hooks[e])try{var u,p,f,d=(p=this.__hooks[e]).call.apply(p,_concatInstanceProperty(u=[this,this]).call(u,_sliceInstanceProperty(Array.prototype).call(arguments)));if(d)if(d.then)d.then((function(e){var n;!1!==e&&callHandler.apply(void 0,_concatInstanceProperty(n=[o,t,r.next]).call(n,_toConsumableArray(i)))})).catch((function(e){throw e}));else callHandler.apply(void 0,_concatInstanceProperty(f=[this,t,r.next]).call(f,_sliceInstanceProperty(Array.prototype).call(arguments)));else if(void 0===d){var h;callHandler.apply(void 0,_concatInstanceProperty(h=[this,t,r.next]).call(h,_sliceInstanceProperty(Array.prototype).call(arguments)))}}catch(t){var y,g;throw t.message=_concatInstanceProperty(y=_concatInstanceProperty(g="[pluginName: ".concat(this.pluginName,":")).call(g,e,"] >> ")).call(y,t.message),t}else callHandler.apply(void 0,_concatInstanceProperty(n=[this,t,r.next]).call(n,_sliceInstanceProperty(Array.prototype).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&&_mapInstanceProperty(t).call(t,(function(t){e.__hooks[t]=null})),_Object$defineProperty(e,"hooks",{get:function(){var t;return e.__hooks&&_mapInstanceProperty(t=_Object$keys(e.__hooks)).call(t,(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];var a;if(!e.__hooks||!e.__hooks[t])return r.call.apply(r,_concatInstanceProperty(a=[e,e]).call(a,i));var s,l,c=(l=e.__hooks[t]).call.apply(l,_concatInstanceProperty(s=[e,e]).call(s,i));if(c&&c.then)c.then((function(t){var n;return!1===t?null:r.call.apply(r,_concatInstanceProperty(n=[e,e]).call(n,i))})).catch((function(e){console.warn("[runHooks]".concat(t," reject"),e.message)}));else if(!1!==c){var u;return r.call.apply(r,_concatInstanceProperty(u=[e,e]).call(u,i))}}function showErrorMsg(e,t){var r;XG_DEBUG.logError(_concatInstanceProperty(r="[".concat(e,"] event or callback cant be undefined or null when call ")).call(r,t))}var BasePlugin=function(){function e(t){_classCallCheck(this,e),util$1.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$1(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$1.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,r;if(this.player){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];(r=this.player).emit.apply(r,_concatInstanceProperty(t=[e]).call(t,i))}}},{key:"emitUserAction",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this.player){var n=_objectSpread2$1(_objectSpread2$1({},r),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,n)}}},{key:"hook",value:function(e,t){var r;return hook.call.apply(hook,_concatInstanceProperty(r=[this]).call(r,_sliceInstanceProperty(Array.prototype).call(arguments)))}},{key:"useHooks",value:function(e,t){for(var r,n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return useHooks.call.apply(useHooks,_concatInstanceProperty(r=[this]).call(r,_sliceInstanceProperty(Array.prototype).call(arguments)))}},{key:"removeHooks",value:function(e,t){for(var r,n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return removeHooks.call.apply(removeHooks,_concatInstanceProperty(r=[this]).call(r,_sliceInstanceProperty(Array.prototype).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,t=this,r=this.player,n=this.pluginName;this.offAll(),util$1.clearAllTimers(this),util$1.checkIsFunction(this.destroy)&&this.destroy(),_mapInstanceProperty(e=["player","playerConfig","pluginName","logger","__args","__hooks"]).call(e,(function(e){t[e]=null})),r.unRegisterPlugin(n),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$1(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$1,closest=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)),_mapInstanceProperty(Array.prototype).call(e,(function(e){return _delegate(e,t,r,n,i)})))}function listener(e,t,r,n){return function(r){r.delegateTarget=closest(r.target,t),r.delegateTarget&&n.call(e,r)}}var delegate_1=delegate,_delegate$1=getDefaultExportFromCjs(delegate_1),ROOT_TYPES={CONTROLS:"controls",ROOT:"root"},POSITIONS$2={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"},PLUGIN_STATE_CLASS={ICON_DISABLE:"xg-icon-disable",ICON_HIDE:"xg-icon-hide"};function isUrl(e){return!!e&&(_indexOfInstanceProperty(e)&&/^(?:http|data:|\/)/.test(e))}function mergeIconClass(e,t){var r;return"object"===_typeof(e)&&e.class&&"string"==typeof e.class?_concatInstanceProperty(r="".concat(t," ")).call(r,e.class):t}function mergeIconAttr(e,t){var r;"object"===_typeof(e)&&e.attr&&"object"===_typeof(e.attr)&&_mapInstanceProperty(r=_Object$keys(e.attr)).call(r,(function(r){t[r]=e.attr[r]}));return t}function createIcon(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",s=null;if(e instanceof window.Element)return util$1.addClass(e,i),_mapInstanceProperty(n=_Object$keys(o)).call(n,(function(t){e.setAttribute(t,o[t])})),e;if(isUrl(e)||isUrl(e.url))return o.src=isUrl(e)?e:e.url||"",s=util$1.createDom(e.tag||"img","",o,"xg-img ".concat(i));if("function"==typeof e)try{var l,c;return(s=e())instanceof window.Element?(util$1.addClass(s,i),_mapInstanceProperty(l=_Object$keys(o)).call(l,(function(e){s.setAttribute(e,o[e])})),s):(XG_DEBUG.logWarn(_concatInstanceProperty(c="warn>>icons.".concat(t," in config of plugin named [")).call(c,a,"] is a function mast return an Element Object")),null)}catch(e){return XG_DEBUG.logError("Plugin named [".concat(a,"]:createIcon"),e),null}return"string"==typeof e?util$1.createDomFromHtml(e,o,i):(XG_DEBUG.logWarn(_concatInstanceProperty(r="warn>>icons.".concat(t," in config of plugin named [")).call(r,a,"] is invalid")),null)}function registerIconsObj(e,t){var r,n=t.config.icons||t.playerConfig.icons;_mapInstanceProperty(r=_Object$keys(e)).call(r,(function(r){var i=e[r],o=i&&i.class?i.class:"",a=i&&i.attr?i.attr:{},s=null;n&&n[r]&&(o=mergeIconClass(n[r],o),a=mergeIconAttr(n[r],a),s=createIcon(n[r],r,o,a,t.pluginName)),!s&&i&&(s=createIcon(i.icon?i.icon:i,a,o,{},t.pluginName)),t.icons[r]=s}))}function registerTextObj(e,t){var r;_mapInstanceProperty(r=_Object$keys(e)).call(r,(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$1(r,BasePlugin);var t=_createSuper$1(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,r),(e=t.call(this,n)).__delegates=[],e}return _createClass$1(r,[{key:"__init",value:function(e){if(_get$1(_getPrototypeOf$1(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(e){var o;throw XG_DEBUG.logError("Plugin:".concat(this.pluginName,":render"),e),new Error(_concatInstanceProperty(o="Plugin:".concat(this.pluginName,":render:")).call(o,e.message))}if(i)(n=r.insert(i,t,e.index)).setAttribute("data-index",e.index);else{if(!e.tag)return;(n=util$1.createDom(e.tag,"",e.attr,e.name)).setAttribute("data-index",e.index),t.appendChild(n)}this.root=n,this.parent=t;var a=this.config.attr||{},s=this.config.style||{};this.setAttr(a),this.setStyle(s),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,r=this.children();if(r&&"object"===_typeof(r))if(_Object$keys(r).length>0)_mapInstanceProperty(t=_Object$keys(r)).call(t,(function(t){var n,i,o=t,a=r[o],s={root:e.root};"function"==typeof a?(n=e.config[o]||{},i=a):"object"===_typeof(a)&&"function"==typeof a.plugin&&(n=a.options?util$1.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:"disable",value:function(){this.config.disable=!0,util$1.addClass(_findInstanceProperty(this).call(this,".xgplayer-icon"),PLUGIN_STATE_CLASS.ICON_DISABLE)}},{key:"enable",value:function(){this.config.disable=!1,util$1.removeClass(_findInstanceProperty(this).call(this,".xgplayer-icon"),PLUGIN_STATE_CLASS.ICON_DISABLE)}},{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$1(_getPrototypeOf$1(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,a=r.delegate.call(this,this.root,e,t,n);this.__delegates=_concatInstanceProperty(o=this.__delegates).call(o,a)}}},{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,i=_concatInstanceProperty(n="".concat(e,"_")).call(n,t),o=0;o<this.__delegates.length;o++)if(this.__delegates[o].key===i){var a;this.__delegates[o].destroy(),_spliceInstanceProperty(a=this.__delegates).call(a,o,1);break}}},{key:"setStyle",value:function(e,t){var r,n=this;if(this.root)return"String"===util$1.typeOf(e)?this.root.style[e]=t:void("Object"===util$1.typeOf(e)&&_mapInstanceProperty(r=_Object$keys(e)).call(r,(function(t){n.root.style[t]=e[t]})))}},{key:"setAttr",value:function(e,t){var r,n=this;if(this.root)return"String"===util$1.typeOf(e)?this.root.setAttribute(e,t):void("Object"===util$1.typeOf(e)&&_mapInstanceProperty(r=_Object$keys(e)).call(r,(function(t){n.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?_findInstanceProperty(this).call(this,e).appendChild(t):e.appendChild(t)}catch(e){return XG_DEBUG.logError("Plugin:appendChild",e),null}}},{key:"render",value:function(){return""}},{key:"destroy",value:function(){}},{key:"__destroy",value:function(){var e,t,n,i=this,o=this.player;(_mapInstanceProperty(e=this.__delegates).call(e,(function(e){e.destroy()})),this.__delegates=[],this._children instanceof Array)&&(_mapInstanceProperty(n=this._children).call(n,(function(e){o.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$1(_getPrototypeOf$1(r.prototype),"__destroy",this).call(this),this.icons={},_mapInstanceProperty(t=["root","parent"]).call(t,(function(e){i[e]=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,s=_delegate$1(e,t,r,n,i);s.key=_concatInstanceProperty(a="".concat(t,"_")).call(a,r),o.push(s)}));else{var a,s=_delegate$1(e,t,r,n,i);s.key=_concatInstanceProperty(a="".concat(t,"_")).call(a,r),o.push(s)}return o}},{key:"ROOT_TYPES",get:function(){return ROOT_TYPES}},{key:"POSITIONS",get:function(){return POSITIONS$2}}]),r}(),ResizeObserver=function(){function e(){var t=this;if(_classCallCheck(this,e),_defineProperty$1(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(this.__trigger,100,{trailing:!0})),this.timeStamp=(new Date).getTime()}catch(e){console.error(e)}}return _createClass$1(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,r,n=-1;_mapInstanceProperty(t=this.__handlers).call(t,(function(t,r){e===t.target&&(n=r)}));try{this.observer&&this.observer.unobserve(e)}catch(e){}this.observer&&this.observer.unobserve(e),n>-1&&_spliceInstanceProperty(r=this.__handlers).call(r,n,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(e){console.error(e)}return!0}return!1}}]),e}(),resizeObserver=null;function addObserver(e,t){return resizeObserver||(resizeObserver=new ResizeObserver),resizeObserver.addObserver(e,t),resizeObserver}function unObserver(e,t){resizeObserver.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(e.root,(function(){e.resize()})),this.pluginGroup[t]={_originalOptions:e.config||{},_plugins:{}}},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$1.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=e;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$1.typeOf(c)?r.config=_Object$assign({},r.config,o[s[l]]):"Boolean"===util$1.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(e){throw console.error(e),e}}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(r){var n;console.error(_concatInstanceProperty(n="[unRegister:".concat(t,"] cgid:[")).call(n,e,"] error"),r)}},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,o=e._pluginInfoId;if(t.pluginGroup[o]){var a=t.pluginGroup[o]._plugins,s=[];_Object$keys(a).forEach((function(e){if(a[e]&&a[e].beforePlayerInit)try{var t=a[e].beforePlayerInit();s.push(r(t))}catch(e){throw s.push(r(null)),e}})),_Promise.all(_concatInstanceProperty(i=[]).call(i,s)).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(e){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()}))}},destroy:function(e){var t=e._pluginInfoId;if(this.pluginGroup[t]){unObserver(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)}delete this.pluginGroup[t],delete e._pluginInfoId}}},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(){},preProcessUrl:null,ignores:[],whitelist:[],inactive:3e3,lang:getLang(),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:{},isHideTips:!1,minWaitDelay:200,commonStyle:{progressColor:"",playedColor:"",cachedColor:"",sliderBtnStyle:{},volumeColor:""}}}var usePreset=function(e,t){var r,n,i,o=t.preset&&t.options?new t.preset(t.options,e.config):new t({},e.config),a=o.plugins,s=void 0===a?[]:a,l=o.ignores,c=void 0===l?[]:l,u=o.icons,p=void 0===u?{}:u,f=o.i18n,d=void 0===f?[]:f;e.config.plugins||(e.config.plugins=[]),e.config.ignores||(e.config.ignores=[]),(n=e.config.plugins).push.apply(n,_toConsumableArray(s)),(i=e.config.ignores).push.apply(i,_toConsumableArray(c)),_mapInstanceProperty(r=_Object$keys(p)).call(r,(function(t){e.config.icons[t]||(e.config.icons[t]=p[t])}));var h=e.config.i18n||[];d.push.apply(d,_toConsumableArray(h)),e.config.i18n=d},Controls=function(e){_inherits$1(r,Plugin);var t=_createSuper$1(r);function r(){var e,n;_classCallCheck(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$1(_assertThisInitialized$1(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,o))),"onMouseEnter",(function(e){var t=_assertThisInitialized$1(n),r=t.player;t.playerConfig.closeControlsBlur&&r.focus({autoHide:!1})})),_defineProperty$1(_assertThisInitialized$1(n),"onMouseLeave",(function(e){_assertThisInitialized$1(n).player.focus()})),n}return _createClass$1(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,t=this,r=this.config,n=r.disable,i=r.height,o=r.mode;if(!n){"flex"===o&&this.player.addClass(STATE_CLASS.FLEX_CONTROLS);var a={height:"".concat(i,"px")};_mapInstanceProperty(e=_Object$keys(a)).call(e,(function(e){t.root.style[e]=a[e]})),this.left=_findInstanceProperty(this).call(this,"xg-left-grid"),this.center=_findInstanceProperty(this).call(this,"xg-center-grid"),this.right=_findInstanceProperty(this).call(this,"xg-right-grid"),this.innerRoot=_findInstanceProperty(this).call(this,"xg-inner-controls"),this.on(MINI_STATE_CHANGE,(function(e){e?util$1.addClass(t.root,"mini-controls"):util$1.removeClass(t.root,"mini-controls")}));var s=this.playerConfig.isMobileSimulateMode;"mobile"!==sniffer$1.device&&"mobile"!==s&&(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$1.addClass(this.root,STATE_CLASS.CONTROLS_AUTOHIDE)}},{key:"pauseAutoHide",value:function(){util$1.removeClass(this.root,STATE_CLASS.CONTROLS_AUTOHIDE)}},{key:"show",value:function(e){this.root.style.display="",this.player.focus()}},{key:"hide",value:function(){this.root.style.display="none"}},{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){switch(t.position?t.position:t.config&&t.config.position?t.config.position:i.position){case POSITIONS$2.CONTROLS_LEFT:t.root=this.left;break;case POSITIONS$2.CONTROLS_RIGHT:t.root=this.right;break;case POSITIONS$2.CONTROLS_CENTER:t.root=this.center;break;case POSITIONS$2.CONTROLS:t.root=this.root;break;default:t.root=this.left}return _get$1(_getPrototypeOf$1(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$1.classNames({"xgplayer-controls":!0},{"flex-controls":"flex"===t},{"bottom-controls":"bottom"===t},_defineProperty$1({},STATE_CLASS.CONTROLS_AUTOHIDE,r),{"xgplayer-controls-initshow":n||!r});return'<xg-controls class="'.concat(i,'" unselectable="on">\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}(),EN$2={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$1.typeOf(t[r]),o=util$1.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(){var e;_mapInstanceProperty(e=_Object$keys(XGI18nLang.lang.en)).call(e,(function(e){XGI18nLang.textKeys[e]=e}))}function extend(e,t){var r=[];if(t||(t=XGI18nLang),t.lang){var n;if("Array"!==util$1.typeOf(e))r=_mapInstanceProperty(n=_Object$keys(e)).call(n,(function(t){return{LANG:"zh"===t?"zh-cn":t,TEXT:e[t]}}));else r=e;var i=t.lang;_mapInstanceProperty(r).call(r,(function(e){"zh"===e.LANG&&(e.LANG="zh-cn"),i[e.LANG]?deepMerge(i[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 init2(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$2);var I18N={get textKeys(){return XGI18nLang.textKeys},get langKeys(){return XGI18nLang.langKeys},get lang(){var e,t={};return _mapInstanceProperty(e=XGI18nLang.langKeys).call(e,(function(e){t[e]=XGI18nLang.lang[e]})),XGI18nLang.lang["zh-cn"]&&(t.zh=XGI18nLang.lang["zh-cn"]||{}),t},extend:extend,use:use,init:init2},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"],store={},instance=null,InstManager=function(e){_inherits$1(r,eventemitter3Exports.EventEmitter);var t=_createSuper$1(r);function r(){return _classCallCheck(this,r),t.apply(this,arguments)}return _createClass$1(r,[{key:"add",value:function(e){e&&(store[e.playerId]=e,1===_Object$keys(store).length&&this.setActive(e.playerId,!0))}},{key:"remove",value:function(e){e&&(e.isUserActive,delete store[e.playerId])}},{key:"_iterate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(var r in store)if(Object.prototype.hasOwnProperty.call(store,r)){var n=store[r];if(t){if(e(n))break}else e(n)}}},{key:"forEach",value:function(e){this._iterate(e)}},{key:"find",value:function(e){var t=null;return this._iterate((function(r){var n=e(r);return n&&(t=r),n}),!0),t}},{key:"findAll",value:function(e){var t=[];return this._iterate((function(r){e(r)&&t.push(r)})),t}},{key:"setActive",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(store[e])return t?this.forEach((function(t){e===t.playerId?(t.isUserActive=!0,t.isInstNext=!1):t.isUserActive=!1})):store[e].isUserActive=t,e}},{key:"getActiveId",value:function(){for(var e=_Object$keys(store),t=0;t<e.length;t++){var r=store[e[t]];if(r&&r.isUserActive)return e[t]}return null}},{key:"setNext",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(store[e])return t?this.forEach((function(t){e===t.playerId?(t.isUserActive=!1,t.isInstNext=!0):t.isInstNext=!1})):store[e].isInstNext=t,e}}],[{key:"getInstance",value:function(){return instance||(instance=new r),instance}}]),r}();function checkPlayerRoot(e){for(var t=_Object$keys(store),r=0;r<t.length;r++){var n=store[t[r]];if(n.root===e)return n}return null}var PlAYER_HOOKS=["play","pause","replay","retry"],REAL_TIME_SPEED=0,AVG_SPEED=0,instManager=null,Player=function(e){_inherits$1(r,MediaProxy);var t=_createSuper$1(r);function r(e){var n;_classCallCheck(this,r);var i=util$1.deepMerge(getDefaultConfig$1(),e);_defineProperty$1(_assertThisInitialized$1(n=t.call(this,i)),"canPlayFunc",(function(){if(n.config){var e=n.config,t=e.autoplay,r=e.defaultPlaybackRate;XG_DEBUG.logInfo("player","canPlayFunc, startTime",n.__startTime),n.__startTime>0&&n.duration>0&&(n.currentTime=n.__startTime>n.duration?n.duration:n.__startTime,n.__startTime=-1),n.playbackRate=r,(t||n._useAutoplay)&&n.mediaPlay(),n.off(CANPLAY,n.canPlayFunc),n.removeClass(STATE_CLASS.ENTER)}})),_defineProperty$1(_assertThisInitialized$1(n),"onFullscreenChange",(function(e,t){var r=function(){util$1.setTimeout(_assertThisInitialized$1(n),(function(){n.resize()}),100)},i=util$1.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$1(n),s=a._fullScreenOffset;if(a.config.needFullscreenScroll?(window.scrollTo(s.left,s.top),util$1.setTimeout(_assertThisInitialized$1(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);else{var l=n._fullscreenEl;l||!n.root.contains(e.target)&&e.target!==n.root||(l=e.target),n.recoverFullStyle(n.root,l,STATE_CLASS.FULLSCREEN)}n._fullscreenEl=null,n.emit(FULLSCREEN_CHANGE,!1)}})),_defineProperty$1(_assertThisInitialized$1(n),"_onWebkitbeginfullscreen",(function(e){n._fullscreenEl=n.media,n.onFullscreenChange(e,!0)})),_defineProperty$1(_assertThisInitialized$1(n),"_onWebkitendfullscreen",(function(e){n.onFullscreenChange(e,!1)})),hooksDescriptor(_assertThisInitialized$1(n),PlAYER_HOOKS),n.config=i,n._pluginInfoId=util$1.generateSessionId(),bindDebug(_assertThisInitialized$1(n));var o=n.constructor.defaultPreset;if(n.config.presets.length){var a,s=_indexOfInstanceProperty(a=n.config.presets).call(a,"default");s>=0&&o&&(n.config.presets[s]=o)}else o&&n.config.presets.push(o);if(n.userTimer=null,n.waitTimer=null,n.handleSource=!0,n._state=STATES.INITIAL,n.isError=!1,n._hasStart=!1,n.isSeeking=!1,n.isCanplay=!1,n._useAutoplay=!1,n.__startTime=-1,n.rotateDeg=0,n.isActive=!1,n.fullscreen=!1,n.cssfullscreen=!1,n.isRotateFullscreen=!1,n._fullscreenEl=null,n.timeSegments=[],n._cssfullscreenEl=null,n.curDefinition=null,n._orgCss="",n._fullScreenOffset=null,n._videoHeight=0,n._videoWidth=0,n.videoPos={pi:1,scale:0,rotate:-1,x:0,y:0,h:-1,w:-1,vy:0,vx:0},n.sizeInfo={width:0,height:0,left:0,top:0},n._accPlayed={t:0,acc:0,loopAcc:0},n._offsetInfo={currentTime:-1,duration: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._onceSeekCanplay=null,n._isPauseBeforeSeek=0,n.innerStates={isActiveLocked:!1},n.instManager=instManager,!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$1(n);var l=n.config,c=l.definition,u=void 0===c?{}:c;if(!l.url&&u.list&&u.list.length>0){var p,f=_findInstanceProperty(p=u.list).call(p,(function(e){return e.definition&&e.definition===u.defaultDefinition}));f||(u.defaultDefinition=u.list[0].definition,f=u.list[0]),n.config.url=f.url,n.curDefinition=f}return n._bindEvents(),n._registerPresets(),n._registerPlugins(),pluginsManager.onPluginsReady(_assertThisInitialized$1(n)),n.getInitDefinition(),n.setState(STATES.READY),util$1.setTimeout(_assertThisInitialized$1(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$1(r,[{key:"_initDOM",value:function(){var e,t,r,n,i=this;if(this.root=this.config.id?document.getElementById(this.config.id):null,!this.root){var o=this.config.el;if(!o||1!==o.nodeType)return this.emit(ERROR$2,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=o}var a=checkPlayerRoot(this.root);a&&(XG_DEBUG.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize"),a.destroy()),this.root.setAttribute(PLATER_ID,this.playerId),null===(n=instManager)||void 0===n||n.add(this),pluginsManager.init(this),this._initBaseDoms();var s=this.constructor.XgVideoProxy;if(s&&this.mediaConfig.mediaType===s.mediaType){var l=this.innerContainer||this.root;this.detachVideoEvents(this.media);var c=new s(l,this.config,this.mediaConfig);this.attachVideoEvents(c),this.media=c}if(this.media.setAttribute(PLATER_ID,this.playerId),this.config.controls){var u=this.config.controls.root||null,p=pluginsManager.register(this,Controls,{root:u});this.controls=p}var f="mobile"===this.config.isMobileSimulateMode?"mobile":sniffer$1.device;if(this.addClass(_concatInstanceProperty(e=_concatInstanceProperty(t=_concatInstanceProperty(r="".concat(STATE_CLASS.DEFAULT," ")).call(r,STATE_CLASS.INACTIVE," xgplayer-")).call(t,f," ")).call(e,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 d=this.config,h=d.width,y=d.height;"number"==typeof h&&"number"==typeof y||(h=600,y=337.5);var g={width:"100%",height:"0","max-width":"100%","padding-top":"".concat(100*y/h,"%")};_Object$keys(g).forEach((function(e){i.root.style[e]=g[e]}))}else["width","height"].forEach((function(e){i.config[e]&&("number"!=typeof i.config[e]?i.root.style[e]=i.config[e]:i.root.style[e]="".concat(i.config[e],"px"))}));var _=this.root.getBoundingClientRect(),v=_.width,m=_.height,$=_.left,b=_.top;return this.sizeInfo.width=v,this.sizeInfo.height=m,this.sizeInfo.left=$,this.sizeInfo.top=b,!0}},{key:"_initBaseDoms",value:function(){this.topBar=null,this.leftBar=null,this.rightBar=null,this.config.marginControls&&(this.innerContainer=util$1.createDom("xg-video-container","",{"data-index":-1},"xg-video-container"),this.root.appendChild(this.innerContainer))}},{key:"_bindEvents",value:function(){var e=this;["focus","blur"].forEach((function(t){e.on(t,e["on"+t.charAt(0).toUpperCase()+_sliceInstanceProperty(t).call(t,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:"_clearUserTimer",value:function(){this.userTimer&&(util$1.clearTimeout(this,this.userTimer),this.userTimer=null)}},{key:"_startInit",value:function(e){var t=this;if(this.media&&(e&&""!==e&&("Array"!==util$1.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.handleSource&&(this._detachSourceEvents(this.media),"Array"===util$1.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$1.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&&(!util$1.isMSE(this.media)&&this.load(),(sniffer$1.os.isIpad||sniffer$1.os.isPhone)&&this.mediaPlay());var i=this.config.startTime;this.__startTime=i>0?i:-1,this.config.startTime=0,n>=2&&this.duration>0?this.canPlayFunc():this.on(CANPLAY,this.canPlayFunc),(!this.hasStart||this.state<STATES.ATTACHED)&&pluginsManager.afterInit(this),this.hasStart=!0,this.setState(STATES.ATTACHED),util$1.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&&_indexOfInstanceProperty(o).call(o,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(){var t,r;_spliceInstanceProperty(t=e._loadingPlugins).call(t,_indexOfInstanceProperty(r=e._loadingPlugins).call(r,i),1)})).catch((function(t){var r,n;XG_DEBUG.logError("_registerPlugins:loadingPlugin",t),_spliceInstanceProperty(r=e._loadingPlugins).call(r,_indexOfInstanceProperty(n=e._loadingPlugins).call(n,i),1)})),e._loadingPlugins.push(i)))}return e.registerPlugin(r)}catch(e){XG_DEBUG.logError("_registerPlugins:",e)}}))}},{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$2.ROOT_RIGHT:this.rightBar||(this.rightBar=util$1.createPositionBar("xg-right-bar",this.root)),t=this.rightBar;break;case POSITIONS$2.ROOT_LEFT:this.leftBar||(this.leftBar=util$1.createPositionBar("xg-left-bar",this.root)),t=this.leftBar;break;case POSITIONS$2.ROOT_TOP:this.topBar||(this.topBar=util$1.createPositionBar("xg-top-bar",this.root),this.config.topBarAutoHide&&util$1.addClass(this.topBar,STATE_CLASS.TOP_BAR_AUTOHIDE)),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&&_indexOfInstanceProperty(s).call(s,"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()){var n;_spliceInstanceProperty(n=this.config.plugins).call(n,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$1.hasClass(this.root,e)||util$1.addClass(this.root,e))}},{key:"removeClass",value:function(e){this.root&&util$1.removeClass(this.root,e)}},{key:"hasClass",value:function(e){if(this.root)return util$1.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){e||(e=t.url||t.config.url);var r=t._preProcessUrl(e);return t._startInit(r.url)}})).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$1.typeOf(e)&&(n=e.url),n=this._preProcessUrl(n).url;var i=this.currentTime;this.__startTime=i;var o=this.paused&&!this.isError;return this.src=n,new _Promise((function(e,t){var i=function(e){r.off("timeupdate",a),r.off("canplay",a),t(e)},a=function(){r.duration>0&&r.__startTime>0&&(r.currentTime=r.__startTime,r.__startTime=-1),o&&r.pause(),r.off("error",i),e(!0)};r.once("error",i),n?(sniffer$1.os.isAndroid?r.once("timeupdate",a):r.once("canplay",a),r.play()):r.errorHandler("error",{code:6,message:"empty_src"})}))}},{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$1(_getPrototypeOf$1(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$1.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$1(_getPrototypeOf$1(r.prototype),"pause",this).call(this)}},{key:"videoPause",value:function(){_get$1(_getPrototypeOf$1(r.prototype),"pause",this).call(this)}},{key:"play",value:function(){var e=this;return this.removeClass(STATE_CLASS.PAUSED),runHooks(this,"play",(function(){return e.mediaPlay()}))}},{key:"pause",value:function(){var e=this;runHooks(this,"pause",(function(){_get$1(_getPrototypeOf$1(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$7(this.duration,10):e,!this._isPauseBeforeSeek&&(this._isPauseBeforeSeek=this.paused?2:1),this._onceSeekCanplay&&this.off(SEEKED,this._onceSeekCanplay),this._onceSeekCanplay=function(){switch(r.removeClass(STATE_CLASS.ENTER),r.isSeeking=!1,a){case"play":r.play();break;case"pause":r.pause();break;default:r._isPauseBeforeSeek>1||r.paused?r.pause():r.play()}r._isPauseBeforeSeek=0,r._onceSeekCanplay=null},this.once(SEEKED,this._onceSeekCanplay),this.state<STATES.RUNNING?(this.removeClass(STATE_CLASS.NO_START),this.currentTime=e,this.play()):this.currentTime=e}}},{key:"getInitDefinition",value:function(){var e,t=this,r=this.config,n=r.definition;!r.url&&n&&n.list&&n.list.length>0&&n.defaultDefinition&&_mapInstanceProperty(e=n.list).call(e,(function(e){e.definition===n.defaultDefinition&&(t.config.url=e.url,t.curDefinition=e)}))}},{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$7(e.bitrate,10)||0),this.emit(DEFINITION_CHANGE,{from:t,to:e}),this.hasStart){var i=this.switchURL(e.url,_objectSpread2$1({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.NO_START),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;if(this.resetState(),this.plugins&&(_mapInstanceProperty(t).call(t,(function(t){e.deregister(t)})),r)){var n,i=getDefaultConfig$1();_keysInstanceProperty(n=_Object$keys(this.config)).call(n,(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,t,n=this,i=this.innerContainer,o=this.root,a=this.media;if(o&&a){if(this.hasStart=!1,this._useAutoplay=!1,o.removeAttribute(PLATER_ID),this.updateAcc("destroy"),this._unbindEvents(),this._detachSourceEvents(this.media),util$1.clearAllTimers(this),this.emit(DESTROY),null===(t=instManager)||void 0===t||t.remove(this),pluginsManager.destroy(this),delHooksDescriptor(this),_get$1(_getPrototypeOf$1(r.prototype),"destroy",this).call(this),this.fullscreen&&this._fullscreenEl===this.root&&this.exitFullscreen(),i)for(var s=i.children,l=0;l<s.length;l++)i.removeChild(s[l]);!i&&a instanceof window.Node&&o.contains(a)&&o.removeChild(a),_mapInstanceProperty(e=["topBar","leftBar","rightBar","innerContainer"]).call(e,(function(e){n[e]&&o.removeChild(n[e]),n[e]=null}));var c=o.className.split(" ");c.length>0?o.className=_filterInstanceProperty(c).call(c,(function(e){return _indexOfInstanceProperty(e).call(e,"xgplayer")<0})).join(" "):o.className="",this.removeAttribute("data-xgfill"),["isSeeking","isCanplay","isActive","cssfullscreen","fullscreen"].forEach((function(e){n[e]=!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(SEEKED,(function(){var t=e.mediaPlay();t&&t.catch&&t.catch((function(e){console.log(e)}))})),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,r=e.config.url,n=util$1.isMSE(e.media)?{url:r}:e._preProcessUrl(r);e.src=n.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$1.filterStyleFromText(e)),util$1.addClass(e,r),t&&t!==e&&!this._orgPCss&&(this._orgPCss=util$1.filterStyleFromText(t),util$1.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$1.setStyleFromCsstext(e,this._orgCss),this._orgCss=""),util$1.removeClass(e,r),t&&t!==e&&this._orgPCss&&(util$1.setStyleFromCsstext(t,this._orgPCss),this._orgPCss="",util$1.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;if("video"!==e&&"media"!==e||(e=this[e]),e||(e=t),this._fullScreenOffset={top:util$1.scrollTop(),left:util$1.scrollLeft()},this._fullscreenEl=e,this._fullActionFrom="get",util$1.getFullScreenEl()===this._fullscreenEl)return this.onFullscreenChange(),_Promise.resolve();try{for(var n=0;n<GET_FULLSCREEN_API.length;n++){var i=GET_FULLSCREEN_API[n];if(e[i]){var o="webkitRequestFullscreen"===i?e.webkitRequestFullscreen(window.Element.ALLOW_KEYBOARD_INPUT):e[i]();return o&&o.then?o:_Promise.resolve()}}return r.fullscreenEnabled||r.webkitSupportsFullscreen?(r.webkitEnterFullscreen(),_Promise.resolve()):_Promise.reject(new Error("call getFullscreen fail"))}catch(e){return _Promise.reject(new Error("call getFullscreen fail"))}}},{key:"exitFullscreen",value:function(e){if(this.isRotateFullscreen&&this.exitRotateFullscreen(),this._fullscreenEl||util$1.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(e){return _Promise.reject(new Error("call exitFullscreen fail"))}}}},{key:"getCssFullscreen",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget;this.isRotateFullscreen?this.exitRotateFullscreen():this.fullscreen&&this.exitFullscreen();var r=t?_concatInstanceProperty(e="".concat(STATE_CLASS.INNER_FULLSCREEN," ")).call(e,STATE_CLASS.CSS_FULLSCREEN):STATE_CLASS.CSS_FULLSCREEN;this.changeFullStyle(this.root,t,r);var n=this.config.fullscreen,i=void 0===n?{}:n;(!0===i.useCssFullscreen||"function"==typeof i.useCssFullscreen&&i.useCssFullscreen())&&(this.fullscreen=!0,this.emit(FULLSCREEN_CHANGE,!0)),this._cssfullscreenEl=t,this.cssfullscreen=!0,this.emit(CSS_FULLSCREEN_CHANGE,!0)}},{key:"exitCssFullscreen",value:function(){var e,t=this._cssfullscreenEl?_concatInstanceProperty(e="".concat(STATE_CLASS.INNER_FULLSCREEN," ")).call(e,STATE_CLASS.CSS_FULLSCREEN):STATE_CLASS.CSS_FULLSCREEN;if(this.fullscreen){var r=this.config.fullscreen,n=void 0===r?{}:r;!0===n.useCssFullscreen||"function"==typeof n.useCssFullscreen&&n.useCssFullscreen()?(this.recoverFullStyle(this.root,this._cssfullscreenEl,t),this.fullscreen=!1,this.emit(FULLSCREEN_CHANGE,!1)):this.removeClass(t)}else this.recoverFullStyle(this.root,this._cssfullscreenEl,t);this._cssfullscreenEl=null,this.cssfullscreen=!1,this.emit(CSS_FULLSCREEN_CHANGE,!1)}},{key:"getRotateFullscreen",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget;this.cssfullscreen&&this.exitCssFullscreen(t);var r=t?_concatInstanceProperty(e="".concat(STATE_CLASS.INNER_FULLSCREEN," ")).call(e,STATE_CLASS.ROTATE_FULLSCREEN):STATE_CLASS.ROTATE_FULLSCREEN;this._fullscreenEl=t||this.root,this.changeFullStyle(this.root,t,r,STATE_CLASS.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!0,this.fullscreen=!0,this.setRotateDeg(90),this._rootStyle=this.root.getAttribute("style"),this.root.style.width="".concat(window.innerHeight,"px"),this.emit(FULLSCREEN_CHANGE,!0)}},{key:"exitRotateFullscreen",value:function(e){var t,r=this._fullscreenEl!==this.root?_concatInstanceProperty(t="".concat(STATE_CLASS.INNER_FULLSCREEN," ")).call(t,STATE_CLASS.ROTATE_FULLSCREEN):STATE_CLASS.ROTATE_FULLSCREEN;this.recoverFullStyle(this.root,this._fullscreenEl,r,STATE_CLASS.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!1,this.fullscreen=!1,this.setRotateDeg(0),this.emit(FULLSCREEN_CHANGE,!1),this._rootStyle&&(this.root.style.style=this._rootStyle,this._rootStyle=!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$1({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._clearUserTimer(),this.emit(PLAYER_BLUR,_objectSpread2$1({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]:{autoHide:!0,delay:3e3},r=this.innerStates;if(this.isActive=!0,this.removeClass(STATE_CLASS.INACTIVE),this._clearUserTimer(),void 0!==t.isLock&&(r.isActiveLocked=t.isLock),!1===t.autoHide||!0===t.isLock||r.isActiveLocked)this._clearUserTimer();else{var n=t&&t.delay?t.delay:this.config.inactive;this.userTimer=util$1.setTimeout(this,(function(){e.userTimer=null,e.blur()}),n)}}},{key:"onBlur",value:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).ignorePaused,t=void 0!==e&&e;if(!this.innerStates.isActiveLocked){var r=this.config.closePauseVideoFocus;this.isActive=!1,(t||r||!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$1.clearTimeout(this,this.waitTimer)}},{key:"onLoadeddata",value:function(){this.isError=!1,this.isSeeking=!1,this.__startTime>0&&this.duration>0&&(this.currentTime=this.__startTime,this.__startTime=-1)}},{key:"onLoadstart",value:function(){this.removeClass(STATE_CLASS.ERROR),this.isCanplay=!1}},{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._clearUserTimer(),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$1.clearTimeout(this,this.waitTimer),this.removeClass(STATE_CLASS.LOADING),this.removeClass(STATE_CLASS.SEEKING)}},{key:"onWaiting",value:function(){var e=this;this.waitTimer&&util$1.clearTimeout(this,this.waitTimer),this.updateAcc("waiting"),this.waitTimer=util$1.setTimeout(this,(function(){e.addClass(STATE_CLASS.LOADING),e.emit(LOADING),util$1.clearTimeout(e,e.waitTimer),e.waitTimer=null}),this.config.minWaitDelay)}},{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)})),this._accPlayed.t||this.paused||this.ended||(this._accPlayed.t=(new Date).getTime())}},{key:"onTimeupdate",value:function(){!this._videoHeight&&this.media.videoHeight&&this.resize(),(this.waitTimer||this.hasClass(STATE_CLASS.LOADING))&&this.media.readyState>2&&(this.removeClass(STATE_CLASS.LOADING),util$1.clearTimeout(this,this.waitTimer),this.waitTimer=null),!this.paused&&this.state===STATES.NOTALLOW&&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$1.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$1.typeOf(e)?e:e.type||"";r.props&&"Array"!==util$1.typeOf(r.props)&&(r.props=[r.props]),this.emit(USER_ACTION,_objectSpread2$1({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=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{startDiff:0,endDiff:0})||{},r=t.startDiff,n=void 0===r?0:r,i=t.endDiff,o=void 0===i?0:i,a=this.media.buffered;if(!a||0===a.length||!this.duration)return!0;for(var s=e||this.media.currentTime||.2,l=a.length,c=0;c<l;c++)if(a.start(c)+n<=s&&a.end(c)-o>s)return!0;return!1}},{key:"resizePosition",value:function(){var e=this.videoPos,t=e.vy,r=e.vx,n=e.h,i=e.w,o=this.videoPos.rotate;if(!(o<0&&n<0&&i<0)){var a=this.videoPos._pi;if(!a&&this.media.videoHeight&&(a=this.media.videoWidth/this.media.videoHeight*100),a){this.videoPos.pi=a;var s={rotate:o=o<0?0:o},l=0,c=0,u=1,p=Math.abs(o/90),f=this.root,d=this.innerContainer,h=f.offsetWidth,y=d?d.offsetHeight:f.offsetHeight,g=y,_=h;if(p%2==0)u=n>0?100/n:i>0?100/i:1,s.scale=u,l=t>0?(100-n)/2-t:0,s.y=2===p?0-l:l,c=r>0?(100-i)/2-r:0,s.x=2===p?0-c:c,this.media.style.width="".concat(_,"px"),this.media.style.height="".concat(g,"px");else if(p%2==1){g=h;var v=y-h;c=-v/2/(_=y)*100,s.x=3===p?c+t/2:c-t/2,l=v/2/g*100,s.y=3===p?l+r/2:l-r/2,s.scale=u,this.media.style.width="".concat(_,"px"),this.media.style.height="".concat(g,"px")}var m=util$1.getTransformStyle(s,this.media.style.transform||this.media.style.webkitTransform);this.media.style.transform=m,this.media.style.webkitTransform=m}}}},{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=this.videoPos;t.h=100*e.h||0,t.w=100*e.w||0,t.vx=100*e.x||0,t.vy=100*e.y||0,this.resizePosition()}}},{key:"setConfig",value:function(e){var t,r=this;e&&_mapInstanceProperty(t=_Object$keys(e)).call(t,(function(t){if("plugins"!==t){r.config[t]=e[t];var n=r.plugins[t.toLowerCase()];n&&"Function"===util$1.typeOf(n.setConfig)&&n.setConfig(e[t])}}))}},{key:"playNext",value:function(e){var t=this;this.resetState(),this.setConfig(e),this._currentTime=0,this._duration=0,runHooks(this,"playnext",(function(){t.start(),t.emit(PLAYNEXT,e)}))}},{key:"resize",value:function(){var e=this;if(this.media){var t=this.root.getBoundingClientRect();this.sizeInfo.width=t.width,this.sizeInfo.height=t.height,this.sizeInfo.left=t.left,this.sizeInfo.top=t.top;var r=this.media,n=r.videoWidth,i=r.videoHeight,o=this.config,a=o.fitVideoSize,s=o.videoFillMode;if("fill"!==s&&"cover"!==s&&"contain"!==s||this.setAttribute("data-xgfill",s),i&&n){this._videoHeight=i,this._videoWidth=n;var l=this.controls&&this.innerContainer?this.controls.root.getBoundingClientRect().height:0,c=t.width,u=t.height-l,p=_parseInt$7(n/i*1e3,10),f=_parseInt$7(c/u*1e3,10),d=c,h=u,y={};"auto"===a&&f>p||"fixWidth"===a?(h=c/p*1e3,this.config.fluid?y.paddingTop="".concat(100*h/d,"%"):y.height="".concat(h+l,"px")):("auto"===a&&f<p||"fixHeight"===a)&&(d=p*u/1e3,y.width="".concat(d,"px")),this.fullscreen||this.cssfullscreen||_Object$keys(y).forEach((function(t){e.root.style[t]=y[t]})),("fillHeight"===s&&f<p||"fillWidth"===s&&f>p)&&this.setAttribute("data-xgfill","cover");var g={videoScale:p,vWidth:d,vHeight:h,cWidth:d,cHeight:h+l};this.resizePosition(),this.emit(VIDEO_RESIZE,g)}}}},{key:"updateObjectPosition",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.media.updateObjectPosition?this.media.updateObjectPosition(t,r):this.media.style.objectPosition=_concatInstanceProperty(e="".concat(100*t,"% ")).call(e,100*r,"%")}},{key:"setState",value:function(e){var t;XG_DEBUG.logInfo("setState",_concatInstanceProperty(t="state from:".concat(STATE_ARRAY[this.state]," to:")).call(t,STATE_ARRAY[e])),this._state=e}},{key:"_preProcessUrl",value:function(e,t){var r=this.config,n=r.preProcessUrl,i=r.preProcessUrlOptions,o=_Object$assign({},i,t);return util$1.isBlob(e)||"function"!=typeof n?{url:e}:n(e,o)}},{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$7(this.cumulateTime/e.total*e.dropped,0)),e}},{key:"lang",get:function(){return this.config.lang},set:function(e){var t,r;0!==_filterInstanceProperty(t=I18N.langKeys).call(t,(function(t){return t===e})).length||"zh"===e?(this.config.lang=e,pluginsManager.setLang(e,this)):console.error(_concatInstanceProperty(r="Sorry, set lang fail, because the language [".concat(e,"] is not supported now, list of all supported languages is [")).call(r,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}},{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$1(_getPrototypeOf$1(r.prototype),"readyState",this)}},{key:"error",get:function(){var e=_get$1(_getPrototypeOf$1(r.prototype),"error",this);return this.i18n[e]||e}},{key:"networkState",get:function(){return _get$1(_getPrototypeOf$1(r.prototype),"networkState",this)}},{key:"fullscreenChanging",get:function(){return!(null===this._fullScreenOffset)}},{key:"cumulateTime",get:function(){var e=this._accPlayed,t=e.acc,r=e.t;return r?(new Date).getTime()-r+t:t}},{key:"zoom",get:function(){return this.config.zoom},set:function(e){this.config.zoom=e}},{key:"videoRotateDeg",get:function(){return this.videoPos.rotate},set:function(e){(e=util$1.convertDeg(e))%90==0&&e!==this.videoPos.rotate&&(this.videoPos.rotate=e,this.resizePosition())}},{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:"offsetCurrentTime",get:function(){return this._offsetInfo.currentTime||0},set:function(e){this._offsetInfo.currentTime=e}},{key:"offsetDuration",get:function(){return this._offsetInfo.duration||0},set:function(e){this._offsetInfo.duration=e||0}},{key:"hook",value:function(e,t){var r;return hook.call.apply(hook,_concatInstanceProperty(r=[this]).call(r,_sliceInstanceProperty(Array.prototype).call(arguments)))}},{key:"useHooks",value:function(e,t){var r;return useHooks.call.apply(useHooks,_concatInstanceProperty(r=[this]).call(r,_sliceInstanceProperty(Array.prototype).call(arguments)))}},{key:"removeHooks",value:function(e,t){var r;return removeHooks.call.apply(removeHooks,_concatInstanceProperty(r=[this]).call(r,_sliceInstanceProperty(Array.prototype).call(arguments)))}},{key:"usePluginHooks",value:function(e,t,r){for(var n,i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return usePluginHooks.call.apply(usePluginHooks,_concatInstanceProperty(n=[this]).call(n,_sliceInstanceProperty(Array.prototype).call(arguments)))}},{key:"removePluginHooks",value:function(e,t,r){for(var n,i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return removePluginHooks.call.apply(removePluginHooks,_concatInstanceProperty(n=[this]).call(n,_sliceInstanceProperty(Array.prototype).call(arguments)))}},{key:"setUserActive",value:function(e,t){var r;"boolean"==typeof t&&t!==this.muted&&(this.addInnerOP("volumechange"),util$1.typeOf(t)===Boolean&&(this.muted=t)),null===(r=instManager)||void 0===r||r.setActive(this.playerId,e)}}],[{key:"debugger",get:function(){return XG_DEBUG.config.debug},set:function(e){XG_DEBUG.config.debug=e}},{key:"instManager",get:function(){return instManager},set:function(e){instManager=e}},{key:"getCurrentUserActivePlayerId",value:function(){var e;return null===(e=instManager)||void 0===e?void 0:e.getActiveId()}},{key:"setCurrentUserActive",value:function(e,t){var r;null===(r=instManager)||void 0===r||r.setActive(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}();_defineProperty$1(Player,"defaultPreset",null),_defineProperty$1(Player,"XgVideoProxy",null),Player.instManager=InstManager.getInstance();var index_min="";function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var $$h=_export,bind$8=functionBind;$$h({target:"Function",proto:!0,forced:Function.bind!==bind$8},{bind:bind$8});var _ERROR_INFO,_ERROR_TYPE_INFO,entryVirtual$8=entryVirtual$p,bind$7=entryVirtual$8("Function").bind,isPrototypeOf$a=objectIsPrototypeOf,method$8=bind$7,FunctionPrototype=Function.prototype,bind$6=function(e){var t=e.bind;return e===FunctionPrototype||isPrototypeOf$a(FunctionPrototype,e)&&t===FunctionPrototype.bind?method$8:t},parent$_=bind$6,bind$5=parent$_,parent$Z=bind$5,bind$4=parent$Z,parent$Y=bind$4,bind$3=parent$Y,bind$2=bind$3,_bindInstanceProperty=getDefaultExportFromCjs(bind$2);function _setPrototypeOf(e,t){var r;return(_setPrototypeOf=_Object$setPrototypeOf$1?_bindInstanceProperty(r=_Object$setPrototypeOf$1).call(r):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$1(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _getPrototypeOf(e){var t;return(_getPrototypeOf=_Object$setPrototypeOf$1?_bindInstanceProperty(t=_Object$getPrototypeOf$1).call(t):function(e){return e.__proto__||_Object$getPrototypeOf$1(e)})(e)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!_Reflect$construct$1)return!1;if(_Reflect$construct$1.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(_Reflect$construct$1(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof$1(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 _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,n=_getPrototypeOf(e);if(t){var i=_getPrototypeOf(this).constructor;r=_Reflect$construct$1(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _isNativeFunction(e){var t;return-1!==_indexOfInstanceProperty$1(t=Function.toString.call(e)).call(t,"[native code]")}function _construct(e,t,r){var n;_isNativeReflectConstruct()?_construct=_bindInstanceProperty(n=_Reflect$construct$1).call(n):_construct=function(e,t,r){var n=[null];_pushInstanceProperty(n).apply(n,t);var i=new(_bindInstanceProperty(Function).apply(e,n));return r&&_setPrototypeOf(i,r.prototype),i};return _construct.apply(null,arguments)}function _wrapNativeSuper(e){var t="function"==typeof _Map$1?new _Map$1: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(this).constructor)}return r.prototype=_Object$create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(r,e)},_wrapNativeSuper(e)}var Level=function(e){return e.Fatal="Fatal",e.Error="Error",e}(Level||{}),ErrorCode$1=function(e){return e[e.MANIFEST_HLS_ERROR=1100]="MANIFEST_HLS_ERROR",e[e.MANIFEST_DASH_ERROR=1200]="MANIFEST_DASH_ERROR",e[e.NETWORK=2100]="NETWORK",e[e.NETWORK_TIMEOUT=2101]="NETWORK_TIMEOUT",e[e.NETWORK_FORBIDDEN=2103]="NETWORK_FORBIDDEN",e[e.NETWORK_NOTFOUND=2104]="NETWORK_NOTFOUND",e[e.NETWORK_RANGE_NOT_SATISFIABLE=2116]="NETWORK_RANGE_NOT_SATISFIABLE",e[e.DEMUX_FLV_ERROR=3100]="DEMUX_FLV_ERROR",e[e.DEMUX_HLS_ERROR=3200]="DEMUX_HLS_ERROR",e[e.DEMUX_MP4_ERROR=3300]="DEMUX_MP4_ERROR",e[e.DEMUX_FMP4_ERROR=3400]="DEMUX_FMP4_ERROR",e[e.DEMUX_SIDX_ERROR=3410]="DEMUX_SIDX_ERROR",e[e.REMUX_FMP4_ERROR=4100]="REMUX_FMP4_ERROR",e[e.REMUX_MP4_ERROR=4200]="REMUX_MP4_ERROR",e[e.MEDIA_ERR_ABORTED=5101]="MEDIA_ERR_ABORTED",e[e.MEDIA_ERR_NETWORK=5102]="MEDIA_ERR_NETWORK",e[e.MEDIA_ERR_DECODE=5103]="MEDIA_ERR_DECODE",e[e.MEDIA_ERR_SRC_NOT_SUPPORTED=5104]="MEDIA_ERR_SRC_NOT_SUPPORTED",e[e.MEDIA_ERR_CODEC_NOT_SUPPORTED=5105]="MEDIA_ERR_CODEC_NOT_SUPPORTED",e[e.MEDIA_ERR_URL_EMPTY=5106]="MEDIA_ERR_URL_EMPTY",e[e.MEDIA_MSE_ADD_SB=5200]="MEDIA_MSE_ADD_SB",e[e.MEDIA_MSE_APPEND_BUFFER=5201]="MEDIA_MSE_APPEND_BUFFER",e[e.MEDIA_MSE_OTHER=5202]="MEDIA_MSE_OTHER",e[e.MEDIA_MSE_FULL=5203]="MEDIA_MSE_FULL",e[e.MEDIA_MSE_HIJACK=5204]="MEDIA_MSE_HIJACK",e[e.MEDIA_EME_HIJACK=5301]="MEDIA_EME_HIJACK",e[e.DRM_LICENSE=7100]="DRM_LICENSE",e[e.DRM_CUSTOM_LICENSE=7200]="DRM_CUSTOM_LICENSE",e[e.OTHER=8e3]="OTHER",e[e.RUNTIME_NO_CANPLAY_ERROR=9001]="RUNTIME_NO_CANPLAY_ERROR",e[e.RUNTIME_BUFFERBREAK_ERROR=9002]="RUNTIME_BUFFERBREAK_ERROR",e[e.RUNTIME_BWAITING_TIMEOUT_ERROR=9002]="RUNTIME_BWAITING_TIMEOUT_ERROR",e[e.MODULE_LOAD_ERROR=110]="MODULE_LOAD_ERROR",e.UNKNOWN="UNKNOWN",e}(ErrorCode$1||{}),ERROR_INFO=(_defineProperty$2(_ERROR_INFO={},2100,{messageTextKey:"NETWORK",level:"Error"}),_defineProperty$2(_ERROR_INFO,2101,{messageTextKey:"NETWORK_TIMEOUT",level:"Error"}),_defineProperty$2(_ERROR_INFO,2103,{messageTextKey:"NETWORK_FORBIDDEN",level:"Error"}),_defineProperty$2(_ERROR_INFO,2104,{messageTextKey:"NETWORK_NOTFOUND",level:"Error"}),_defineProperty$2(_ERROR_INFO,5101,{messageTextKey:"MEDIA_ERR_ABORTED",level:"Error"}),_defineProperty$2(_ERROR_INFO,5102,{messageTextKey:"MEDIA_ERR_NETWORK",level:"Error"}),_defineProperty$2(_ERROR_INFO,5103,{messageTextKey:"MEDIA_ERR_DECODE",level:"Error"}),_defineProperty$2(_ERROR_INFO,5104,{messageTextKey:"MEDIA_ERR_SRC_NOT_SUPPORTED",level:"Error"}),_defineProperty$2(_ERROR_INFO,5105,{messageTextKey:"MEDIA_ERR_CODEC_NOT_SUPPORTED",level:"Error"}),_defineProperty$2(_ERROR_INFO,5106,{messageTextKey:"MEDIA_ERR_URL_EMPTY",level:"Error"}),_defineProperty$2(_ERROR_INFO,110,{messageTextKey:"MODULE_LOAD_ERROR",level:"Fatal"}),_defineProperty$2(_ERROR_INFO,7100,{messageTextKey:"DRM_LICENSE",level:"Fatal"}),_ERROR_INFO),ERROR_TYPE_INFO=(_defineProperty$2(_ERROR_TYPE_INFO={},"manifest",{messageTextKey:"MANIFEST",level:"Error"}),_defineProperty$2(_ERROR_TYPE_INFO,"network",{messageTextKey:"NETWORK",level:"Error"}),_defineProperty$2(_ERROR_TYPE_INFO,"demux",{messageTextKey:"DEMUX",level:"Error"}),_defineProperty$2(_ERROR_TYPE_INFO,"remux",{messageTextKey:"REMUX",level:"Error"}),_defineProperty$2(_ERROR_TYPE_INFO,"media",{messageTextKey:"MEDIA",level:"Error"}),_defineProperty$2(_ERROR_TYPE_INFO,"drm",{messageTextKey:"DRM",level:"Error"}),_defineProperty$2(_ERROR_TYPE_INFO,"other",{messageTextKey:"OTHER",level:"Error"}),_defineProperty$2(_ERROR_TYPE_INFO,"runtime",{messageTextKey:"RUNTIME",level:"Error"}),_ERROR_TYPE_INFO),VeError$1=function(e){_inherits(r,_wrapNativeSuper(Error));var t=_createSuper(r);function r(e,n){var i,o,a,s,l,c,u;_classCallCheck$1(this,r);var p="string"==typeof e?{message:e}:e,f=null!==(i=null!==(o=null!==(a=null==n?void 0:n.getText(null==p?void 0:p.messageTextKey))&&void 0!==a?a:null==p?void 0:p.message)&&void 0!==o?o:null==p||null===(s=p.error)||void 0===s?void 0:s.message)&&void 0!==i?i:null==n?void 0:n.getText("UNKNOWN");return _defineProperty$2(_assertThisInitialized(u=t.call(this,f)),"errorCode",void 0),_defineProperty$2(_assertThisInitialized(u),"level",void 0),_defineProperty$2(_assertThisInitialized(u),"ext",void 0),u.errorCode=null!==(l=null==p?void 0:p.errorCode)&&void 0!==l?l:"UNKNOWN",u.level=null!==(c=null==p?void 0:p.level)&&void 0!==c?c:"Error",u.ext=null==p?void 0:p.ext,u}return _createClass$2(r)}();function create$2(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return new VeError$1(_objectSpread2$2(_objectSpread2$2({errorCode:e},ERROR_INFO[e]),t),r)}function transform$1(e,t){var r,n,i=ERROR_INFO[e.errorCode]||ERROR_TYPE_INFO[e.errorType],o=e.errorCode;return new VeError$1({messageTextKey:null==i?void 0:i.messageTextKey,message:null!==(r=null==e?void 0:e.message)&&void 0!==r?r:o,errorCode:o,level:null!==(n=null==i?void 0:i.level)&&void 0!==n?n:"Error",ext:e},t)}var Poster=function(e){_inherits$1(r,Plugin);var t=_createSuper$1(r);function r(){return _classCallCheck(this,r),t.apply(this,arguments)}return _createClass$1(r,[{key:"isEndedShow",get:function(){return this.config.isEndedShow},set:function(e){this.config.isEndedShow=e}},{key:"hide",value:function(){util$1.addClass(this.root,"hide")}},{key:"show",value:function(e){util$1.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$1.removeClass(e.root,"hide")})),this.config.hideCanplay?(this.once(TIME_UPDATE,(function(){e.onTimeUpdate()})),this.on(URL_CHANGE,(function(){util$1.removeClass(e.root,"hide"),util$1.addClass(e.root,"xg-showplay"),e.once(TIME_UPDATE,(function(){e.onTimeUpdate()}))}))):this.on(PLAY,(function(){util$1.addClass(e.root,"hide")}))}},{key:"setConfig",value:function(e){var t=this;_Object$keys(e).forEach((function(r){t.config[r]=e[r]}));var r=this.config.poster;this.update(r)}},{key:"onTimeUpdate",value:function(){var e=this;this.player.currentTime?util$1.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:"getBgSize",value:function(e){var t="";switch(e){case"cover":t="cover";break;case"contain":t="contain";break;case"fixHeight":t="auto 100%";break;default:t=""}return t?"background-size: ".concat(t,";"):""}},{key:"render",value:function(){var e,t,r=this.config,n=r.poster,i=r.hideCanplay,o=r.fillMode,a=r.notHidden,s=this.getBgSize(o),l=n?_concatInstanceProperty(e="background-image:url(".concat(n,");")).call(e,s):s;return _concatInstanceProperty(t='<xg-poster class="xgplayer-poster '.concat(a?"xg-not-hidden":i?"xg-showplay":"",'" style="')).call(t,l,'">\n </xg-poster>')}}],[{key:"pluginName",get:function(){return"poster"}},{key:"defaultConfig",get:function(){return{isEndedShow:!0,hideCanplay:!1,notHidden:!1,poster:"",fillMode:"fixWidth"}}}]),r}();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};return 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),AnimateMap[e].id}function clearAnimation(e){var t;e?window.clearTimeout(e):_mapInstanceProperty(t=_Object$keys(AnimateMap)).call(t,(function(e){window.clearTimeout(AnimateMap[e].id),delete AnimateMap[e]}))}var Start=function(e){_inherits$1(r,Plugin);var t=_createSuper$1(r);function r(e){var n;return _classCallCheck(this,r),_defineProperty$1(_assertThisInitialized$1(n=t.call(this,e)),"onPlayerReset",(function(){n.autoPlayStart=!1;var e="auto"===n.config.mode?"auto-hide":"hide";n.setAttr("data-state","play"),util$1.removeClass(n.root,e),n.show()})),_defineProperty$1(_assertThisInitialized$1(n),"onAutoplayStart",(function(){if(!n.autoPlayStart){var e="auto"===n.config.mode?"auto-hide":"hide";util$1.addClass(n.root,e),n.autoPlayStart=!0,n.onPlayPause("play")}})),n.autoPlayStart=!1,n}return _createClass$1(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$1.addClass(t.root,"lang-is-en"):"jp"===r.lang&&util$1.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$1.removeClass(e.root,t),e.show()})),this.on(PLAY,(function(){e.onPlayPause("play")})),this.on(PAUSE,(function(){e.onPlayPause("pause")})),this.on(RESET,(function(){e.onPlayerReset()})),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$1.addClass(this.root,"hide")}},{key:"show",value:function(e){util$1.removeClass(this.root,"hide")}},{key:"focusHide",value:function(){util$1.addClass(this.root,"focus-hide")}},{key:"recover",value:function(){util$1.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;this._animateId=addAnimate("pauseplay",400,{start:function(){util$1.addClass(t.root,"interact"),t.show(),t.switchStatus(!0)},end:function(){util$1.removeClass(t.root,"interact"),!e&&t.hide(),t._animateId=null}})}},{key:"endAnimate",value:function(){util$1.removeClass(this.root,"interact"),clearAnimation(this._animateId),this._animateId=null}},{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&&!(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(),this.show(),void this.endAnimate();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(this._animateId)}},{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}(),Enter=function(e){_inherits$1(r,Plugin);var t=_createSuper$1(r);function r(){return _classCallCheck(this,r),t.apply(this,arguments)}return _createClass$1(r,[{key:"render",value:function(){var e=this.config.innerHtml,t=util$1.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}();function xgIconTips(e,t,r){try{var n,i;return _concatInstanceProperty(n=_concatInstanceProperty(i=' <div class="xg-tips '.concat(r?"hide":" ",'" lang-key="')).call(i,e.i18nKeys[t],'">\n ')).call(n,e.i18n[t],"\n </div>")}catch(e){return'<div class="xg-tips hide"></div>'}}var MiniScreenIcon=function(e){_inherits$1(r,Plugin);var t=_createSuper$1(r);function r(){return _classCallCheck(this,r),t.apply(this,arguments)}return _createClass$1(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,t="MINISCREEN";return _concatInstanceProperty(e='\n <xg-icon class="xgplayer-miniicon">\n <div class="xgplayer-icon btn-text"><span class="icon-text" lang-key="'.concat(this.i18nKeys[t],'">')).call(e,this.i18n[t],"</span></div>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"miniscreenIcon"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$2.CONTROLS_RIGHT,index:10}}}]),r}();function getStyleSize(e){var t=_parseFloat$7(e);return-1===_indexOfInstanceProperty(e).call(e,"%")&&!_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(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$7(a);r[o]=_Number$isNaN(s)?0:s}var l=r.paddingLeft+r.paddingRight,c=r.paddingTop+r.paddingBottom,u=r.marginLeft+r.marginRight,p=r.marginTop+r.marginBottom,f=r.borderLeftWidth+r.borderRightWidth,d=r.borderTopWidth+r.borderBottomWidth,h=n,y=getStyleSize(t.width);!1!==y&&(r.width=y+(h?0:l+f));var g=getStyleSize(t.height);return!1!==g&&(r.height=g+(h?0:c+d)),r.innerWidth=r.width-(l+f),r.innerHeight=r.height-(c+d),r.outerWidth=r.width+u,r.outerHeight=r.height+p,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$1={START:"dragStart",MOVE:"dragMove",ENDED:"dragEnded"},POST_START_EVENTS={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]},Draggabilly=function(e){_inherits$1(r,EventEmitter);var t=_createSuper$1(r);function r(e){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck(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$1(n)}return _createClass$1(r,[{key:"_bindStartEvent",value:function(){var e,t=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)]),_mapInstanceProperty(e=POST_START_EVENTS[this._startKey]).call(e,(function(e){t["on".concat(e)]=t["on".concat(e)].bind(t)}))}},{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];_mapInstanceProperty(r).call(r,(function(e){window.addEventListener(e,t["on".concat(e)])})),this._boundPointerEvents=r}}},{key:"_unbindPostStartEvents",value:function(){var e,t=this;this._boundPointerEvents&&(_mapInstanceProperty(e=this._boundPointerEvents).call(e,(function(e){window.removeEventListener(e,t["on".concat(e)])})),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,t=_concatInstanceProperty(e="translate3d(".concat(this.dragPoint.x,"px, ")).call(e,this.dragPoint.y,"px, 0)");this._root.style.transform=t,this._root.style.webKitTransform=t}},{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$1.START,this.startPos)}},{key:"dragEnd",value:function(e,t){this._root&&(this._unbindPostStartEvents(),this.isDragging&&(this._root.style.transform="",this.setLeftTop(),this.emit(EVENTS$1.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$1.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===_indexOfInstanceProperty(t).call(t,"matrix")){var r=t.split(","),n=0===_indexOfInstanceProperty(t).call(t,"matrix3d")?12:4,i=_parseInt$7(r[n],10),o=_parseInt$7(r[n+1],10);this.position.x+=i,this.position.y+=o}}},{key:"_getPositionCoord",value:function(e,t){if(-1!==_indexOfInstanceProperty(e).call(e,"%")){var r=getSize(this._root.parentNode);return r?_parseFloat$7(e)/100*r[t]:0}return _parseInt$7(e,10)}}]),r}(),MiniScreen=function(e){_inherits$1(r,Plugin);var t=_createSuper$1(r);function r(e){var n;_classCallCheck(this,r),_defineProperty$1(_assertThisInitialized$1(n=t.call(this,e)),"onCancelClick",(function(e){n.exitMini(),n.isClose=!0})),_defineProperty$1(_assertThisInitialized$1(n),"onCenterClick",(function(e){var t=_assertThisInitialized$1(n).player;t.paused?t.play():t.pause()})),_defineProperty$1(_assertThisInitialized$1(n),"onScroll",(function(e){if(!(!window.scrollY&&0!==window.scrollY||Math.abs(window.scrollY-n.pos.scrollY)<50)){var t=_parseInt$7(util$1.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$1(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$1(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$1.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,t=this;if(!this.isMini){var r=this.player,n=this.playerConfig,i=this.config.target||this.player.root;this.lastStyle={},util$1.addClass(r.root,"xgplayer-mini"),_mapInstanceProperty(e=["width","height","top","left"]).call(e,(function(e){t.lastStyle[e]=i.style[e],i.style[e]="".concat(t.pos[e],"px")})),n.fluid&&(i.style["padding-top"]=""),this.emit(MINI_STATE_CHANGE,!0),r.isMini=this.isMini=!0}}},{key:"exitMini",value:function(){var e=this;if(!this.isMini)return!1;var t,r=this.player,n=this.playerConfig,i=this.config.target||this.player.root;(util$1.removeClass(r.root,"xgplayer-mini"),this.lastStyle)&&_mapInstanceProperty(t=_Object$keys(this.lastStyle)).call(t,(function(t){i.style[t]=e.lastStyle[t]}));this.lastStyle=null,n.fluid&&(r.root.style.width="100%",r.root.style.height="0",r.root.style["padding-top"]="".concat(100*n.height/n.width,"%")),this.emit(MINI_STATE_CHANGE,!1),this.isMini=r.isMini=!1}},{key:"destroy",value:function(){window.removeEventListener("scroll",this.onScroll);var e=util$1.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 '.concat(xgIconTips(this,"MINI_DRAG",this.playerConfig.isHideTips),'\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}(),MOUSE_EVENTS={mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousemove:"onMouseMove"},HOOKS$1=["videoClick","videoDbClick"],PCPlugin=function(e){_inherits$1(r,BasePlugin);var t=_createSuper$1(r);function r(){var e,n;_classCallCheck(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$1(_assertThisInitialized$1(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,o))),"onMouseMove",(function(e){var t=_assertThisInitialized$1(n),r=t.player,i=t.playerConfig;r.isActive||(r.focus({autoHide:!i.closeDelayBlur}),!i.closeFocusVideoFocus&&r.media.focus())})),_defineProperty$1(_assertThisInitialized$1(n),"onMouseEnter",(function(e){var t=_assertThisInitialized$1(n),r=t.playerConfig,i=t.player;!r.closeFocusVideoFocus&&i.media.focus(),r.closeDelayBlur?i.focus({autoHide:!1}):i.focus(),n.emit(ENTER_PLAYER)})),_defineProperty$1(_assertThisInitialized$1(n),"onMouseLeave",(function(e){var t=n.playerConfig,r=t.closePlayerBlur,i=t.leavePlayerTime,o=t.closeDelayBlur;r||o||(i?n.player.focus({autoHide:!0,delay:i}):n.player.blur({ignorePaused:!0})),n.emit(LEAVE_PLAYER)})),_defineProperty$1(_assertThisInitialized$1(n),"onVideoClick",(function(e){var t=_assertThisInitialized$1(n),r=t.player,i=t.playerConfig;e.target&&i.closeVideoClick||e.target!==r.root&&e.target!==r.media&&e.target!==r.innerContainer&&e.target!==r.media.__canvas||(e.preventDefault(),i.closeVideoStopPropagation||e.stopPropagation(),n._clickCount++,n.clickTimer&&(clearTimeout(n.clickTimer),n.clickTimer=null),n.clickTimer=setTimeout((function(){n._clickCount&&(n._clickCount--,runHooks(_assertThisInitialized$1(n),HOOKS$1[0],(function(e,t){n.switchPlayPause(t.e)}),{e:e,paused:r.paused}),clearTimeout(n.clickTimer),n.clickTimer=null)}),300))})),_defineProperty$1(_assertThisInitialized$1(n),"onVideoDblClick",(function(e){var t=_assertThisInitialized$1(n),r=t.player,i=t.playerConfig;i.closeVideoDblclick||!e.target||e.target!==r.media&&e.target!==r.media.__canvas||(!i.closeVideoClick&&n._clickCount<2?n._clickCount=0:(n._clickCount=0,n.clickTimer&&(clearTimeout(n.clickTimer),n.clickTimer=null),e.preventDefault(),e.stopPropagation(),runHooks(_assertThisInitialized$1(n),HOOKS$1[1],(function(e,t){n.emitUserAction(t.e,"switch_fullscreen",{props:"fullscreen",from:r.fullscreen,to:!r.fullscreen}),r.fullscreen?r.exitFullscreen():r.getFullscreen()}),{e:e,fullscreen:r.fullscreen})))})),n}return _createClass$1(r,[{key:"afterCreate",value:function(){var e=this;this._clickCount=0,_mapInstanceProperty(HOOKS$1).call(HOOKS$1,(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,t=this,r=this.player,n=r.media,i=r.root,o=this.playerConfig.enableContextmenu;i&&i.addEventListener("click",this.onVideoClick,!1),i&&i.addEventListener("dblclick",this.onVideoDblClick,!1),_mapInstanceProperty(e=_Object$keys(MOUSE_EVENTS)).call(e,(function(e){i.addEventListener(e,t[MOUSE_EVENTS[e]],!1)})),!o&&n&&n.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,t=this,r=this.player,n=r.video,i=r.root;this.clickTimer&&clearTimeout(this.clickTimer),i.removeEventListener("click",this.onVideoClick,!1),i.removeEventListener("dblclick",this.onVideoDblClick,!1),n.removeEventListener("contextmenu",this.onContextmenu,!1),_mapInstanceProperty(e=_Object$keys(MOUSE_EVENTS)).call(e,(function(e){i.removeEventListener(e,t[MOUSE_EVENTS[e]],!1)}))}}],[{key:"pluginName",get:function(){return"pc"}},{key:"defaultConfig",get:function(){return{}}}]),r}(),EVENTS={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 getDefaultConfig(){return{pressDelay:600,dbClickDelay:200,disablePress:!1,disableDbClick:!1,miniStep:2,needPreventDefault:!0}}var Touche=function(){function e(t){var r,n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{eventType:"touch"};_classCallCheck(this,e),_defineProperty$1(this,"onTouchStart",(function(e){var t=n._pos,r=n.root,i=getTouch(e.touches);t.x=i?_parseInt$7(i.pageX,10):e.pageX,t.y=i?_parseInt$7(i.pageX,10):e.pageX,t.start=!0,n.__setPress(e),r.addEventListener(n.events.end,n.onTouchEnd),r.addEventListener(n.events.cancel,n.onTouchCancel),r.addEventListener(n.events.move,n.onTouchMove),n.trigger(EVENTS.TOUCH_START,e)})),_defineProperty$1(this,"onTouchCancel",(function(e){n.onTouchEnd(e)})),_defineProperty$1(this,"onTouchEnd",(function(e){var t=n._pos,r=n.root;n.__clearPress(),r.removeEventListener(n.events.cancel,n.onTouchCancel),r.removeEventListener(n.events.end,n.onTouchEnd),r.removeEventListener(n.events.move,n.onTouchMove),e.moving=t.moving,e.press=t.press,t.press&&n.trigger(EVENTS.PRESS_END,e),n.trigger(EVENTS.TOUCH_END,e),!t.press&&!t.moving&&n.__setDb(e),t.press=!1,t.start=!1,t.moving=!1})),_defineProperty$1(this,"onTouchMove",(function(e){var t=n._pos,r=n.config,i=getTouch(e.touches),o=i?_parseInt$7(i.pageX,10):e.pageX,a=i?_parseInt$7(i.pageY,10):e.pageX,s=o-t.x,l=a-t.y;Math.abs(l)<r.miniStep&&Math.abs(s)<r.miniStep||(n.__clearPress(),t.press&&n.trigger(EVENTS.PRESS_END,e),t.press=!1,t.moving=!0,n.trigger(EVENTS.TOUCH_MOVE,e))})),this._pos={moving:!1,start:!1,x:0,y:0},this.config=getDefaultConfig(),_mapInstanceProperty(r=_Object$keys(i)).call(r,(function(e){n.config[e]=i[e]})),this.root=t,this.events="mouse"===i.eventType?MOUSES:TOUCHS,this.pressIntrvalId=null,this.dbIntrvalId=null,this.__handlers={},this._initEvent()}return _createClass$1(e,[{key:"_initEvent",value:function(){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.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.DOUBlE_CLICK,e);this.dbIntrvalId=setTimeout((function(){t.__clearDb(),t._pos.start||t._pos.press||t._pos.moving||t.trigger(EVENTS.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,n=this.__handlers[e],i=-1,o=0;o<n.length;o++)if(n[o]===t){i=o;break}if(i>=0)_spliceInstanceProperty(r=this.__handlers[e]).call(r,i,1)}}},{key:"trigger",value:function(e,t){var r;this.__handlers[e]&&_mapInstanceProperty(r=this.__handlers[e]).call(r,(function(r){try{r(t)}catch(t){console.error("trigger>>:".concat(e),t)}}))}},{key:"destroy",value:function(){var e=this,t={touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"};_Object$keys(t).forEach((function(r){e.root.removeEventListener(r,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:""},HOOKS=["videoClick","videoDbClick"],MobilePlugin=function(e){_inherits$1(r,Plugin);var t=_createSuper$1(r);function r(e){var n;return _classCallCheck(this,r),_defineProperty$1(_assertThisInitialized$1(n=t.call(this,e)),"onTouchStart",(function(e){var t=_assertThisInitialized$1(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,n.timer&&clearTimeout(n.timer),util$1.checkIsFunction(a.disableSwipeHandler)&&a.disableSwipeHandler(),_findInstanceProperty(n).call(n,".xg-dur").innerHTML=util$1.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$7(s.pageX-o.left,10),u=_parseInt$7(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$1(_assertThisInitialized$1(n),"onTouchMove",(function(e){var t=n.getTouche(e),r=_assertThisInitialized$1(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$7(t.pageX-i.left,10),u=_parseInt$7(t.pageY-i.top,10),p=90===a.rotateDeg?u:c,f=90===a.rotateDeg?c:u;if(Math.abs(p-i.x)>s||Math.abs(f-i.y)>s){var d=p-i.x,h=f-i.y,y=i.scope;if(-1===y&&(0===(y=n.checkScope(p,f,d,h,i))&&(l?a.blur():a.focus({autoHide:!1}),!i.time&&(i.time=_parseInt$7(1e3*a.currentTime,10)+1e3*n.timeOffset)),i.scope=y),-1===y||y>0&&!o.gestureY||0===y&&!o.gestureX)return;n.executeMove(d,h,y,i.width,i.height),i.x=p,i.y=f}}})),_defineProperty$1(_assertThisInitialized$1(n),"onTouchEnd",(function(e){var t=_assertThisInitialized$1(n),r=t.player,i=t.pos,o=t.playerConfig;if(setTimeout((function(){r.getPlugin("progress")&&r.getPlugin("progress").resetSeekState()}),10),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):i.time=0,i.scope=-1,n.resetPos(),util$1.checkIsFunction(o.enableSwipeHandler)&&o.enableSwipeHandler(),n.changeAction(ACTIONS.AUTO)}})),_defineProperty$1(_assertThisInitialized$1(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$1(_assertThisInitialized$1(n),"onRootTouchEnd",(function(e){n.pos.scope>-1&&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$1(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,t=this;_mapInstanceProperty(HOOKS).call(HOOKS,(function(e){t.__hooks[e]=null}));var r=this.playerConfig,n=this.config,i=this.player;!0===r.closeVideoDblclick&&(n.closedbClick=!0),this.resetPos(),util$1.isUndefined(r.disableGesture)||(n.disableGesture=!!r.disableGesture),this.appendChild(".xg-seek-icon",this.icons.seekTipIcon),this.xgMask=util$1.createDom("xg-mask","",{},"xgmask"),i.root.appendChild(this.xgMask),this.initCustomStyle(),this.registerThumbnail();var o="mouse"===this.domEventType?"mouse":"touch";this.touch=new Touche(this.root,{eventType:o,needPreventDefault:!this.config.disableGesture}),this.root.addEventListener("contextmenu",(function(e){e.preventDefault()})),i.root.addEventListener("touchmove",this.onRootTouchMove,!0),i.root.addEventListener("touchend",this.onRootTouchEnd,!0),i.root.addEventListener("touchcancel",this.onRootTouchEnd,!0);var a=this.player.controls;a&&a.center&&(a.center.addEventListener("touchmove",this.onRootTouchMove,!0),a.center.addEventListener("touchend",this.onRootTouchEnd,!0),a.center.addEventListener("touchcancel",this.onRootTouchEnd,!0)),this.on(DURATION_CHANGE,(function(){var e=t.player,r=t.config;1e3*e.duration<r.moveDuration&&(r.moveDuration=1e3*e.duration)})),this.on([CANPLAY,ENDED],(function(){var e=t.pos,r=e.time;!e.isStart&&r>0&&(t.pos.time=0)}));var s={touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",press:"onPress",pressend:"onPressEnd",click:"onClick",doubleclick:"onDbClick"};if(_mapInstanceProperty(e=_Object$keys(s)).call(e,(function(e){t.touch.on(e,(function(r){t[s[e]](r)}))})),!n.disableActive){var l=i.plugins.progress;l&&(l.addCallBack("dragmove",(function(e){t.activeSeekNote(e.currentTime,e.forward)})),["dragend","click"].forEach((function(e){l.addCallBack(e,(function(){t.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=_findInstanceProperty(this).call(this,".time-preview");t.insertBefore(this.thumbnail,t.children[0])}}},{key:"initCustomStyle",value:function(){var e=(this.playerConfig||{}).commonStyle,t=e.playedColor,r=e.progressColor,n=e.timePreviewStyle,i=e.curTimeColor,o=e.durationColor;t&&(_findInstanceProperty(this).call(this,".xg-curbar").style.backgroundColor=t);r&&(_findInstanceProperty(this).call(this,".xg-bar").style.backgroundColor=r);if(n){var a=_findInstanceProperty(this).call(this,".time-preview");_Object$keys(n).forEach((function(e){a.style[e]=n[e]}))}var s=i||t,l=o;s&&(_findInstanceProperty(this).call(this,".xg-cur").style.color=s),l&&(_findInstanceProperty(this).call(this,".xg-dur").style.color=l),this.config.disableTimeProgress&&util$1.addClass(_findInstanceProperty(this).call(this,".xg-timebar"),"hide")}},{key:"resetPos",value:function(){var e,t=this;this.pos?(this.pos.isStart=!1,this.pos.scope=-1,_mapInstanceProperty(e=["x","y","width","height","scopeL","scopeR","scopeM1","scopeM2"]).call(e,(function(e){t.pos[e]=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:"clickHandler",value:function(e){var t=this.player,r=this.config,n=this.playerConfig;t.state<STATES.RUNNING?n.closeVideoClick||(this.sendUseAction(util$1.createEvent("click")),t.play()):!r.closedbClick||n.closeVideoClick?t.isActive?t.blur():t.focus():n.closeVideoClick||((t.isActive||r.focusVideoClick)&&(this.sendUseAction(util$1.createEvent("click")),this.switchPlayPause()),t.focus())}},{key:"dbClickHandler",value:function(e){var t=this.config,r=this.player;!t.closedbClick&&r.state>=STATES.RUNNING&&(this.sendUseAction(util$1.createEvent("dblclick")),this.switchPlayPause())}},{key:"onClick",value:function(e){var t=this,r=this.player;runHooks(this,HOOKS[0],(function(e,r){t.clickHandler(r.e)}),{e:e,paused:r.paused})}},{key:"onDbClick",value:function(e){var t=this,r=this.player;runHooks(this,HOOKS[1],(function(e,r){t.dbClickHandler(r.e)}),{e:e,paused:r.paused})}},{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$7(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$7(100*e,10),r.volume+=e,!(Math.abs(r.volume)<10)){var n=_parseInt$7(10*t.volume,10)-_parseInt$7(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;if(o&&o.focusHide(),_findInstanceProperty(this).call(this,".xg-dur").innerHTML=util$1.format(this.duration),_findInstanceProperty(this).call(this,".xg-cur").innerHTML=util$1.format(e),_findInstanceProperty(this).call(this,".xg-curbar").style.width="".concat(e/this.duration*100,"%"),t)util$1.removeClass(_findInstanceProperty(this).call(this,".xg-seek-show"),"xg-back");else util$1.addClass(_findInstanceProperty(this).call(this,".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),e.root.removeEventListener("touchcancel",this.onRootTouchEnd,!0);var t=this.player.controls;t&&t.center&&(t.center.removeEventListener("touchmove",this.onRootTouchMove,!0),t.center.removeEventListener("touchend",this.onRootTouchEnd,!0),t.center.removeEventListener("touchcancel",this.onRootTouchEnd,!0))}},{key:"render",value:function(){var e,t,r,n="normal"!==this.config.gradient?"gradient ".concat(this.config.gradient):"gradient";return _concatInstanceProperty(e=_concatInstanceProperty(t=_concatInstanceProperty(r='\n <xg-trigger class="trigger">\n <div class="'.concat(n,'"></div>\n <div class="time-preview">\n <div class="xg-seek-show ')).call(r,this.config.disableSeekIcon?" hide-seek-icon":"",'">\n <i class="xg-seek-icon"></i>\n <span class="xg-cur">00:00</span>\n <span class="xg-separator">/</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>')).call(t,this.config.pressRate,"X</i>")).call(e,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}(),$$g=_export,repeat$7=stringRepeat;$$g({target:"String",proto:!0},{repeat:repeat$7});var entryVirtual$7=entryVirtual$p,repeat$6=entryVirtual$7("String").repeat,isPrototypeOf$9=objectIsPrototypeOf,method$7=repeat$6,StringPrototype$2=String.prototype,repeat$5=function(e){var t=e.repeat;return"string"==typeof e||e===StringPrototype$2||isPrototypeOf$9(StringPrototype$2,e)&&t===StringPrototype$2.repeat?method$7:t},parent$X=repeat$5,repeat$4=parent$X,parent$W=repeat$4,repeat$3=parent$W,parent$V=repeat$3,repeat$2=parent$V,repeat$1=repeat$2,repeat2=repeat$1,_repeatInstanceProperty=getDefaultExportFromCjs(repeat2);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$1(r,BasePlugin);var t=_createSuper$1(r);function r(){var e,n;_classCallCheck(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$1(_assertThisInitialized$1(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,o))),"onBodyKeyDown",(function(e){if(n.player){var t=e||window.event,r=t.keyCode,i=_assertThisInitialized$1(n),o=i._keyState,a=i.player,s=n.config,l=s.disable,c=s.disableBodyTrigger,u=s.isIgnoreUserActive;l||c||!a.isUserActive&&!u||isDisableTag(t.target)||!n.checkIsVisible()||t.metaKey||t.altKey||t.ctrlKey?o.isBodyKeyDown=!1:(_repeatInstanceProperty(e)||o.isKeyDown||((t.target===document.body||n.config.isGlobalTrigger&&!isDisableTag(t.target))&&n.checkCode(r,!0)&&(o.isBodyKeyDown=!0),document.addEventListener("keyup",n.onBodyKeyUp)),o.isBodyKeyDown&&n.handleKeyDown(t))}})),_defineProperty$1(_assertThisInitialized$1(n),"onBodyKeyUp",(function(e){n.player&&(document.removeEventListener("keyup",n.onBodyKeyUp),n.handleKeyUp(e))})),_defineProperty$1(_assertThisInitialized$1(n),"onKeydown",(function(e){if(n.player){var t=e||window.event,r=_assertThisInitialized$1(n)._keyState;if(!_repeatInstanceProperty(t)){if(n.config.disable||n.config.disableRootTrigger||t.metaKey||t.altKey||t.ctrlKey)return;!t||37!==t.keyCode&&!n.checkCode(t.keyCode)||t.target!==n.player.root&&t.target!==n.player.video&&t.target!==n.player.controls.el||(r.isKeyDown=!0),n.player.root.addEventListener("keyup",n.onKeyup)}r.isKeyDown&&n.handleKeyDown(t)}})),_defineProperty$1(_assertThisInitialized$1(n),"onKeyup",(function(e){n.player&&(n.player.root.removeEventListener("keyup",n.onKeyup),n.handleKeyUp(e))})),n}return _createClass$1(r,[{key:"mergekeyCodeMap",value:function(){var e,t=this,r=this.config.keyCodeMap;r&&_mapInstanceProperty(e=_Object$keys(r)).call(e,(function(e){var n;t.keyCodeMap[e]?_mapInstanceProperty(n=["keyCode","action","disable","pressAction","disablePress","isBodyTarget"]).call(n,(function(n){r[e][n]&&(t.keyCodeMap[e][n]=r[e][n])})):t.keyCodeMap[e]=r[e]}))}},{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,disablePress:!1,noBodyTarget:!1},up:{keyCode:38,action:"upVolume",disable:!1,disablePress:!1,noBodyTarget:!0},down:{keyCode:40,action:"downVolume",disable:!1,disablePress:!1,noBodyTarget:!0},left:{keyCode:37,action:"seekBack",disablePress:!1,disable:!1},right:{keyCode:39,action:"seek",pressAction:"changePlaybackRate",disablePress:!1,disable:!1},esc:{keyCode:27,action:"exitFullscreen",disablePress:!0,disable:!1}},this.mergekeyCodeMap(),this._keyState={isKeyDown:!1,isBodyKeyDown:!1,isPress:!1,tt:0,playbackRate:0},this.player.root.addEventListener("keydown",this.onKeydown),document.addEventListener("keydown",this.onBodyKeyDown)}},{key:"setConfig",value:function(e){var t=this;_Object$keys(e).forEach((function(r){t.config[r]=e[r]}))}},{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,n=this,i=!1;return _mapInstanceProperty(r=_Object$keys(this.keyCodeMap)).call(r,(function(r){n.keyCodeMap[r]&&e===n.keyCodeMap[r].keyCode&&!n.keyCodeMap[r].disable&&(i=!t||t&&!n.keyCodeMap[r].noBodyTarget)})),i}},{key:"downVolume",value:function(e){var t=this.player;if(!(t.volume<=0)){var r=_parseFloat$7((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;if(!(t.volume>=1)){var r=_parseFloat$7((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.offsetCurrentTime,i=t.duration,o=t.offsetDuration,a=t.timeSegments,s=n>-1?n:r,l=o||i,c=_repeatInstanceProperty(e)&&this.seekStep>=4?_parseInt$7(this.seekStep/2,10):this.seekStep;s+c<=l?s+=c:s=l;var u=util$1.getCurrentTimeByOffset(s,a),p={currentTime:{from:r,to:u}};this.emitUserAction(e,"seek",{props:p}),this.player.currentTime=u}},{key:"seekBack",value:function(e){var t=this.player,r=t.currentTime,n=t.offsetCurrentTime,i=t.timeSegments,o=(n>-1?n:r)-(_repeatInstanceProperty(e)?_parseInt$7(this.seekStep/2,10):this.seekStep);o<0&&(o=0);var a={currentTime:{from:r,to:o=util$1.getCurrentTimeByOffset(o,i)}};this.emitUserAction(e,"seek",{props:a}),this.player.currentTime=o}},{key:"changePlaybackRate",value:function(e){var t=this._keyState,r=this.config,n=this.player;0===t.playbackRate&&(t.playbackRate=n.playbackRate,n.playbackRate=r.playbackRate)}},{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:"handleKeyDown",value:function(e){var t=this._keyState;if(_repeatInstanceProperty(e)){t.isPress=!0;var r=Date.now();if(r-t.tt<200)return;t.tt=r}this.handleKeyCode(e.keyCode,e,t.isPress)}},{key:"handleKeyUp",value:function(e){var t=this._keyState;t.playbackRate>0&&(this.player.playbackRate=t.playbackRate,t.playbackRate=0),t.isKeyDown=!1,t.isPress=!1,t.tt=0}},{key:"handleKeyCode",value:function(e,t,r){for(var n=_Object$keys(this.keyCodeMap),i=0;i<n.length;i++){var o=this.keyCodeMap[n[i]],a=o.action,s=o.keyCode,l=o.disable,c=o.pressAction,u=o.disablePress;if(s===e){if(!(l||r&&u)){var p=r&&c||a;"function"==typeof p?a(t,this.player,r):"string"==typeof p&&"function"==typeof this[p]&&this[p](t,this.player,r),this.emit(SHORTCUT,_objectSpread2$1({key:n[i],target:t.target,isPress:r},this.keyCodeMap[n[i]]))}preventDefault(t),t.stopPropagation();break}}}},{key:"destroy",value:function(){this.player.root.removeEventListener("keydown",this.onKeydown),document.removeEventListener("keydown",this.onBodyKeyDown),this.player.root.removeEventListener("keyup",this.onKeyup),document.removeEventListener("keyup",this.onBodyKeyUp)}},{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:!1,disableBodyTrigger:!1,disableRootTrigger:!1,isGlobalTrigger:!0,keyCodeMap:{},disable:!1,playbackRate:2,isIgnoreUserActive:!0}}}]),r}();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$1(r,Plugin);var t=_createSuper$1(r);function r(){return _classCallCheck(this,r),t.apply(this,arguments)}return _createClass$1(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$2.ROOT}}}]),r}(),$$f=_export,$findIndex=arrayIteration.findIndex,FIND_INDEX="findIndex",SKIPS_HOLES=!0;FIND_INDEX in[]&&Array(1)[FIND_INDEX]((function(){SKIPS_HOLES=!1})),$$f({target:"Array",proto:!0,forced:SKIPS_HOLES},{findIndex:function(e){return $findIndex(this,e,arguments.length>1?arguments[1]:void 0)}});var entryVirtual$6=entryVirtual$p,findIndex$6=entryVirtual$6("Array").findIndex,isPrototypeOf$8=objectIsPrototypeOf,method$6=findIndex$6,ArrayPrototype$4=Array.prototype,findIndex$5=function(e){var t=e.findIndex;return e===ArrayPrototype$4||isPrototypeOf$8(ArrayPrototype$4,e)&&t===ArrayPrototype$4.findIndex?method$6:t},parent$U=findIndex$5,findIndex$4=parent$U,parent$T=findIndex$4,findIndex$3=parent$T,parent$S=findIndex$3,findIndex$2=parent$S,findIndex$1=findIndex$2,findIndex2=findIndex$1,_findIndexInstanceProperty=getDefaultExportFromCjs(findIndex2),Icon=function(e){_inherits$1(r,Plugin);var t=_createSuper$1(r);function r(){var e,n;_classCallCheck(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$1(_assertThisInitialized$1(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,o))),"_onMouseenter",(function(e){n.emit("icon_mouseenter",{pluginName:n.pluginName})})),_defineProperty$1(_assertThisInitialized$1(n),"_onMouseLeave",(function(e){n.emit("icon_mouseleave",{pluginName:n.pluginName})})),n}return _createClass$1(r,[{key:"afterCreate",value:function(){this.bind("mouseenter",this._onMouseenter),this.bind("mouseleave",this._onMouseLeave),this.config.disable&&this.disable()}},{key:"destroy",value:function(){this.unbind("mouseenter",this._onMouseenter),this.unbind("mouseleave",this._onMouseLeave)}}]),r}(),Play$1=function(e){_inherits$1(r,Icon);var t=_createSuper$1(r);function r(){return _classCallCheck(this,r),t.apply(this,arguments)}return _createClass$1(r,[{key:"afterCreate",value:function(){var e=this;_get$1(_getPrototypeOf$1(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$2,EMPTIED],(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){if(this.player){var t=this.i18nKeys,r=_findInstanceProperty(this).call(this,".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$1(_getPrototypeOf$1(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 '.concat(xgIconTips(this,"PLAY_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"play"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$2.CONTROLS_LEFT,index:0,disable:!1}}}]),r}();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$1(r,Plugin);var t=_createSuper$1(r);function r(){return _classCallCheck(this,r),t.apply(this,arguments)}return _createClass$1(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$1.addClass(this.root,"show")}},{key:"hide",value:function(){util$1.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$2.ROOT_TOP,index:0}}}]),r}();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$1(r,Icon);var t=_createSuper$1(r);function r(){var e,n;_classCallCheck(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$1(_assertThisInitialized$1(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,o))),"_onOrientationChange",(function(e){n.player.fullscreen&&n.config.rotateFullscreen&&(90===window.orientation||-90===window.orientation?n.player.setRotateDeg(0):n.player.setRotateDeg(90))})),n}return _createClass$1(r,[{key:"afterCreate",value:function(){var e=this;_get$1(_getPrototypeOf$1(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$1.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=_findInstanceProperty(e).call(e,".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$1(_getPrototypeOf$1(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(),r.useScreenOrientation&&this.unlockScreen()):(t.getFullscreen().catch((function(e){})),r.useScreenOrientation&&t.aspectRatio>1&&this.lockScreen(r.lockOrientationType))}},{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:"render",value:function(){if(!this.config.disable){return'<xg-icon class="xgplayer-fullscreen">\n <div class="xgplayer-icon">\n </div>\n '.concat(xgIconTips(this,"FULLSCREEN_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}},{key:"lockScreen",value:function(e){try{screen.orientation.lock(e).catch((function(e){}))}catch(e){}}},{key:"unlockScreen",value:function(){try{screen.orientation.unlock().catch((function(e){}))}catch(e){}}}],[{key:"pluginName",get:function(){return"fullscreen"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$2.CONTROLS_RIGHT,index:0,useCssFullscreen:!1,rotateFullscreen:!1,useScreenOrientation:!1,lockOrientationType:"landscape",switchCallback:null,target:null,disable:!1,needBackIcon:!1}}}]),r}();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$1(r,Plugin);var t=_createSuper$1(r);function r(){var e,n;_classCallCheck(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$1(_assertThisInitialized$1(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,o))),"onBarMousedown",(function(e){var t=_assertThisInitialized$1(n).player,r=_findInstanceProperty(n).call(n,".xgplayer-bar");util$1.event(e);var i=r.getBoundingClientRect(),o=util$1.getEventPos(e,t.zoom),a=i.height-(o.clientY-i.top);if(o.h=a,o.barH=i.height,n.pos=o,!(a<-2))return n.updateVolumePos(a,e),document.addEventListener("mouseup",n.onBarMouseUp),n._d.isStart=!0,!1})),_defineProperty$1(_assertThisInitialized$1(n),"onBarMouseMove",(function(e){var t=_assertThisInitialized$1(n)._d;if(t.isStart){var r=_assertThisInitialized$1(n),i=r.pos,o=r.player;e.preventDefault(),e.stopPropagation(),util$1.event(e);var a=util$1.getEventPos(e,o.zoom);t.isMoving=!0;var s=i.h-a.clientY+i.clientY;s>i.barH||n.updateVolumePos(s,e)}})),_defineProperty$1(_assertThisInitialized$1(n),"onBarMouseUp",(function(e){util$1.event(e),document.removeEventListener("mouseup",n.onBarMouseUp);var t=_assertThisInitialized$1(n)._d;t.isStart=!1,t.isMoving=!1})),_defineProperty$1(_assertThisInitialized$1(n),"onMouseenter",(function(e){n._d.isActive=!0,n.focus(),n.emit("icon_mouseenter",{pluginName:n.pluginName})})),_defineProperty$1(_assertThisInitialized$1(n),"onMouseleave",(function(e){n._d.isActive=!1,n.unFocus(100,!1,e),n.emit("icon_mouseleave",{pluginName:n.pluginName})})),_defineProperty$1(_assertThisInitialized$1(n),"onVolumeChange",(function(e){if(n.player){var t=n.player,r=t.muted,i=t.volume;n._d.isMoving||(_findInstanceProperty(n).call(n,".xgplayer-drag").style.height=r||0===i?"4px":"".concat(100*i,"%"),n.config.showValueLabel&&n.updateVolumeValue()),n.animate(r,i)}})),n}return _createClass$1(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;if(r.volumeColor)_findInstanceProperty(this).call(this,".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$1.typeOf(n)&&(this.player.volume=this.config.default),this.onVolumeChange()}}},{key:"updateVolumePos",value:function(e,t){var r=this.player,n=_findInstanceProperty(this).call(this,".xgplayer-drag"),i=_findInstanceProperty(this).call(this,".xgplayer-bar");if(i&&n){var o=_parseInt$7(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=_findInstanceProperty(this).call(this,".xgplayer-value-label"),i=Math.max(Math.min(t,1),0);n.innerText=r?0:Math.round(100*i)}},{key:"focus",value:function(){this.player.focus({autoHide:!1}),this._timerId&&(util$1.clearTimeout(this,this._timerId),this._timerId=null),util$1.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$1.clearTimeout(this,this._timerId),this._timerId=null),this._timerId=util$1.setTimeout(this,(function(){i.isActive||(r?o.blur():o.focus(),util$1.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$1.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(){var e;if(!this.config.disable){var t=this.config.default||this.player.volume,r=this.config.showValueLabel;return _concatInstanceProperty(e='\n <xg-icon class="xgplayer-volume" data-state="normal">\n <div class="xgplayer-icon">\n </div>\n <xg-slider class="xgplayer-slider">\n '.concat(r?'<div class="xgplayer-value-label">'.concat(100*t,"</div>"):"",'\n <div class="xgplayer-bar">\n <xg-drag class="xgplayer-drag" style="height: ')).call(e,100*t,'%"></xg-drag>\n </div>\n </xg-slider>\n </xg-icon>')}}}],[{key:"pluginName",get:function(){return"volume"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$2.CONTROLS_RIGHT,index:1,disable:!1,showValueLabel:!1,default:.6,miniVolume:.2}}}]),r}();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$1(r,Icon);var t=_createSuper$1(r);function r(){var e,n;_classCallCheck(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$1(_assertThisInitialized$1(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,o))),"switchPIP",(function(e){if(!n.isPIPAvailable())return!1;e.stopPropagation&&e.stopPropagation(),n.isPip?(n.exitPIP(),n.emitUserAction(e,"change_pip",{props:"pip",from:!0,to:!1}),n.setAttr("data-state","normal")):4===n.player.media.readyState&&(n.requestPIP(),n.emitUserAction(e,"change_pip",{props:"pip",from:!1,to:!0}),n.setAttr("data-state","pip"))})),n}return _createClass$1(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$1(_getPrototypeOf$1(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$1.removeClass(_findInstanceProperty(e).call(e,".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$1.setTimeout(e,(function(){!r&&t.mediaPlay()}),0),!r&&t.mediaPlay(),e.setAttr("data-state","normal"),e.pipWindow=null,t.emit(PIP_CHANGE,!1)},this.enterPIPCallback=function(r){t.emit(PIP_CHANGE,!0),null!=r&&r.pictureInPictureWindow&&(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:"copyStyleIntoPiPWindow",value:function(e){var t,r,n=_filterInstanceProperty(t=_mapInstanceProperty(r=_toConsumableArray(document.styleSheets)).call(r,(function(t){try{var r;return _mapInstanceProperty(r=_toConsumableArray(t.cssRules)).call(r,(function(e){return e.cssText})).join("")}catch(r){var n=document.createElement("link");n.rel="stylesheet",n.type=t.type,n.media=t.media,n.href=t.href,e.document.head.appendChild(n)}return""}))).call(t,Boolean).join("\n"),i=document.createElement("style");i.textContent=n,e.document.head.appendChild(i)}},{key:"requestPIP",value:function(){var e=this,t=this.player,n=this.playerConfig,i=this.config;if(this.isPIPAvailable()&&!this.isPip)try{var o=n.poster;if(o&&(t.media.poster="String"===util$1.typeOf(o)?o:o.poster),i.preferDocument&&this.isDocPIPAvailable()){var a={};if(i.width&&i.height)a.width=i.width,a.height=i.height;else{var s=t.root.getBoundingClientRect();a.width=s.width,a.height=s.height}documentPictureInPicture.requestWindow(a).then((function(r){var n=i.docPiPNode,o=i.docPiPStyle;e.enterPIPCallback();var a=n||t.root,s=a.parentElement,l=a.previousSibling,c=a.nextSibling;e.copyStyleIntoPiPWindow(r);var u=document.createElement("style");if(u.append("body{padding:0; margin:0;}"),o){var p="";"string"==typeof o?p=o:"function"==typeof o&&(p=o.call(i)),p&&u.append(p)}else a===t.root&&u.append("\n .xgplayer{width: 100%!important; height: 100%!important;}\n ");r.document.head.append(u),r.document.body.append(a),r.addEventListener("pagehide",(function(t){s&&(c?s.insertBefore(a,c):l?s.insertBefore(a,l.nextSibling):s.appendChild(a)),e.leavePIPCallback()}),{once:!0})}))}else r.checkWebkitSetPresentationMode(t.media)?t.media.webkitSetPresentationMode("picture-in-picture"):t.media.requestPictureInPicture();return!0}catch(e){return console.error("requestPiP",e),!1}}},{key:"exitPIP",value:function(){var e=this.player;try{var t;if(this.isPIPAvailable()&&this.isPip)this.isDocPIPAvailable()&&null!==(t=documentPictureInPicture)&&void 0!==t&&t.window?documentPictureInPicture.window.close():r.checkWebkitSetPresentationMode(e.media)?e.media.webkitSetPresentationMode("inline"):document.exitPictureInPicture();return!0}catch(e){return console.error("exitPIP",e),!1}}},{key:"isPip",get:function(){var e,t=this.player;return!(!this.isDocPIPAvailable()||null===(e=documentPictureInPicture)||void 0===e||!e.window)||document.pictureInPictureElement&&document.pictureInPictureElement===t.media||t.media.webkitPresentationMode===PresentationMode.PIP}},{key:"isPIPAvailable",value:function(){var e=this.player.media;return("Boolean"!==util$1.typeOf(document.pictureInPictureEnabled)||document.pictureInPictureEnabled)&&("Boolean"===util$1.typeOf(e.disablePictureInPicture)&&!e.disablePictureInPicture||e.webkitSupportsPresentationMode&&"Function"===util$1.typeOf(e.webkitSetPresentationMode))||this.isDocPIPAvailable()}},{key:"isDocPIPAvailable",value:function(){return"documentPictureInPicture"in window&&/^(https|file)/.test(location.protocol)}},{key:"destroy",value:function(){_get$1(_getPrototypeOf$1(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 '.concat(xgIconTips(this,"PIP",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"pip"}},{key:"defaultConfig",get:function(){return{position:POSITIONS$2.CONTROLS_RIGHT,index:6,showIcon:!1,preferDocument:!1,width:void 0,height:void 0,docPiPNode:void 0,docPiPStyle:void 0}}},{key:"checkWebkitSetPresentationMode",value:function(e){return"function"==typeof e.webkitSetPresentationMode}}]),r}(),fails$2=fails$B,wellKnownSymbol$1=wellKnownSymbol$q,DESCRIPTORS$3=descriptors,IS_PURE=isPure,ITERATOR$1=wellKnownSymbol$1("iterator"),urlConstructorDetection=!fails$2((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.size&&(IS_PURE||!DESCRIPTORS$3)||!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$1]||"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})),uncurryThis$5=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$1=RangeError,exec$1=uncurryThis$5(regexSeparators.exec),floor$1=Math.floor,fromCharCode$1=String.fromCharCode,charCodeAt=uncurryThis$5("".charCodeAt),join$3=uncurryThis$5([].join),push$3=uncurryThis$5([].push),replace$2=uncurryThis$5("".replace),split$2=uncurryThis$5("".split),toLowerCase$1=uncurryThis$5("".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$3(t,((1023&i)<<10)+(1023&o)+65536):(push$3(t,i),r--)}else push$3(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$1(e/damp):e>>1,e+=floor$1(e/t);e>baseMinusTMin*tMax>>1;)e=floor$1(e/baseMinusTMin),n+=base;return floor$1(n+(baseMinusTMin+1)*e/(e+skew))},encode=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$3(n,fromCharCode$1(r));var l=n.length,c=l;for(l&&push$3(n,delimiter);c<i;){var u=maxInt;for(t=0;t<e.length;t++)(r=e[t])>=o&&r<u&&(u=r);var p=c+1;if(u-o>floor$1((maxInt-a)/p))throw $RangeError$1(OVERFLOW_ERROR);for(a+=(u-o)*p,o=u,t=0;t<e.length;t++){if((r=e[t])<o&&++a>maxInt)throw $RangeError$1(OVERFLOW_ERROR);if(r==o){for(var f=a,d=base;;){var h=d<=s?tMin:d>=s+tMax?tMax:d-s;if(f<h)break;var y=f-h,g=base-h;push$3(n,fromCharCode$1(digitToBasic(h+y%g))),f=floor$1(y/g),d+=base}push$3(n,fromCharCode$1(digitToBasic(f))),s=adapt(a,p,c==l),a=0,c++}}a++,o++}return join$3(n,"")},stringPunycodeToAscii=function(e){var t,r,n=[],i=split$2(replace$2(toLowerCase$1(e),regexSeparators,"."),".");for(t=0;t<i.length;t++)r=i[t],push$3(n,exec$1(regexNonASCII,r)?"xn--"+encode(r):r);return join$3(n,".")},$$e=_export,global$3=global$p,call$1=functionCall,uncurryThis$4=functionUncurryThis,DESCRIPTORS$2=descriptors,USE_NATIVE_URL$2=urlConstructorDetection,defineBuiltIn$1=defineBuiltIn$8,defineBuiltInAccessor$1=defineBuiltInAccessor$5,defineBuiltIns=defineBuiltIns$2,setToStringTag$1=setToStringTag$9,createIteratorConstructor=iteratorCreateConstructor,InternalStateModule$1=internalState,anInstance$1=anInstance$5,isCallable=isCallable$p,hasOwn$3=hasOwnProperty_1,bind$1=functionBindContext,classof$1=classof$e,anObject$1=anObject$h,isObject$3=isObject$o,$toString$1=toString$f,create$1=objectCreate,createPropertyDescriptor=createPropertyDescriptor$8,getIterator=getIterator$3,getIteratorMethod=getIteratorMethod$a,validateArgumentsLength$2=validateArgumentsLength$4,wellKnownSymbol=wellKnownSymbol$q,arraySort=arraySort$1,ITERATOR=wellKnownSymbol("iterator"),URL_SEARCH_PARAMS="URLSearchParams",URL_SEARCH_PARAMS_ITERATOR=URL_SEARCH_PARAMS+"Iterator",setInternalState$1=InternalStateModule$1.set,getInternalParamsState=InternalStateModule$1.getterFor(URL_SEARCH_PARAMS),getInternalIteratorState=InternalStateModule$1.getterFor(URL_SEARCH_PARAMS_ITERATOR),getOwnPropertyDescriptor5=Object.getOwnPropertyDescriptor,safeGetBuiltIn=function(e){if(!DESCRIPTORS$2)return global$3[e];var t=getOwnPropertyDescriptor5(global$3,e);return t&&t.value},nativeFetch=safeGetBuiltIn("fetch"),NativeRequest=safeGetBuiltIn("Request"),Headers=safeGetBuiltIn("Headers"),RequestPrototype=NativeRequest&&NativeRequest.prototype,HeadersPrototype=Headers&&Headers.prototype,RegExp$1=global$3.RegExp,TypeError$2=global$3.TypeError,decodeURIComponent$1=global$3.decodeURIComponent,encodeURIComponent$1=global$3.encodeURIComponent,charAt$1=uncurryThis$4("".charAt),join$2=uncurryThis$4([].join),push$2=uncurryThis$4([].push),replace$1=uncurryThis$4("".replace),shift$1=uncurryThis$4([].shift),splice2=uncurryThis$4([].splice),split$1=uncurryThis$4("".split),stringSlice$2=uncurryThis$4("".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(t){return e}},deserialize=function(e){var t=replace$1(e,plus," "),r=4;try{return decodeURIComponent$1(t)}catch(e){for(;r;)t=replace$1(t,percentSequence(r--),percentDecode);return t}},find3=/[!'()~]|%20/g,replacements={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},replacer=function(e){return replacements[e]},serialize=function(e){return replace$1(encodeURIComponent$1(e),find3,replacer)},URLSearchParamsIterator=createIteratorConstructor((function(e,t){setInternalState$1(this,{type:URL_SEARCH_PARAMS_ITERATOR,iterator:getIterator(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$3(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===charAt$1(e,0)?stringSlice$2(e,1):e:$toString$1(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(e);if(l)for(r=(t=getIterator(e,l)).next;!(n=call$1(r,t)).done;){if(o=(i=getIterator(anObject$1(n.value))).next,(a=call$1(o,i)).done||(s=call$1(o,i)).done||!call$1(o,i).done)throw TypeError$2("Expected sequence with length 2");push$2(this.entries,{key:$toString$1(a.value),value:$toString$1(s.value)})}else for(var c in e)hasOwn$3(e,c)&&push$2(this.entries,{key:c,value:$toString$1(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$2(this.entries,{key:deserialize(shift$1(r)),value:deserialize(join$2(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],push$2(r,serialize(e.key)+"="+serialize(e.value));return join$2(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var URLSearchParamsConstructor=function(){anInstance$1(this,URLSearchParamsPrototype);var e=setInternalState$1(this,new URLSearchParamsState(arguments.length>0?arguments[0]:void 0));DESCRIPTORS$2||(this.length=e.entries.length)},URLSearchParamsPrototype=URLSearchParamsConstructor.prototype;if(defineBuiltIns(URLSearchParamsPrototype,{append:function(e,t){validateArgumentsLength$2(arguments.length,2);var r=getInternalParamsState(this);push$2(r.entries,{key:$toString$1(e),value:$toString$1(t)}),DESCRIPTORS$2||this.length++,r.updateURL()},delete:function(e){validateArgumentsLength$2(arguments.length,1);for(var t=getInternalParamsState(this),r=t.entries,n=$toString$1(e),i=0;i<r.length;)r[i].key===n?splice2(r,i,1):i++;DESCRIPTORS$2||(this.length=r.length),t.updateURL()},get:function(e){validateArgumentsLength$2(arguments.length,1);for(var t=getInternalParamsState(this).entries,r=$toString$1(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$1(e),n=[],i=0;i<t.length;i++)t[i].key===r&&push$2(n,t[i].value);return n},has:function(e){validateArgumentsLength$2(arguments.length,1);for(var t=getInternalParamsState(this).entries,r=$toString$1(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$1(e),s=$toString$1(t),l=0;l<i.length;l++)(r=i[l]).key===a&&(o?splice2(i,l--,1):(o=!0,r.value=s));o||push$2(i,{key:a,value:s}),DESCRIPTORS$2||(this.length=i.length),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$1(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$1(URLSearchParamsPrototype,ITERATOR,URLSearchParamsPrototype.entries,{name:"entries"}),defineBuiltIn$1(URLSearchParamsPrototype,"toString",(function(){return getInternalParamsState(this).serialize()}),{enumerable:!0}),DESCRIPTORS$2&&defineBuiltInAccessor$1(URLSearchParamsPrototype,"size",{get:function(){return getInternalParamsState(this).entries.length},configurable:!0,enumerable:!0}),setToStringTag$1(URLSearchParamsConstructor,URL_SEARCH_PARAMS),$$e({global:!0,constructor:!0,forced:!USE_NATIVE_URL$2},{URLSearchParams:URLSearchParamsConstructor}),!USE_NATIVE_URL$2&&isCallable(Headers)){var headersHas=uncurryThis$4(HeadersPrototype.has),headersSet=uncurryThis$4(HeadersPrototype.set),wrapRequestOptions=function(e){if(isObject$3(e)){var t,r=e.body;if(classof$1(r)===URL_SEARCH_PARAMS)return t=e.headers?new Headers(e.headers):new Headers,headersHas(t,"content-type")||headersSet(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),create$1(e,{body:createPropertyDescriptor(0,$toString$1(r)),headers:createPropertyDescriptor(0,t)})}return e};if(isCallable(nativeFetch)&&$$e({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return nativeFetch(e,arguments.length>1?wrapRequestOptions(arguments[1]):{})}}),isCallable(NativeRequest)){var RequestConstructor=function(e){return anInstance$1(this,RequestPrototype),new NativeRequest(e,arguments.length>1?wrapRequestOptions(arguments[1]):{})};RequestPrototype.constructor=RequestConstructor,RequestConstructor.prototype=RequestPrototype,$$e({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:RequestConstructor})}}var EOF,web_urlSearchParams_constructor={URLSearchParams:URLSearchParamsConstructor,getState:getInternalParamsState},$$d=_export,DESCRIPTORS$1=descriptors,USE_NATIVE_URL$1=urlConstructorDetection,global$2=global$p,bind2=functionBindContext,uncurryThis$3=functionUncurryThis,defineBuiltIn=defineBuiltIn$8,defineBuiltInAccessor=defineBuiltInAccessor$5,anInstance=anInstance$5,hasOwn$2=hasOwnProperty_1,assign2=objectAssign,arrayFrom=arrayFrom$1,arraySlice=arraySliceSimple,codeAt$1=stringMultibyte.codeAt,toASCII=stringPunycodeToAscii,$toString=toString$f,setToStringTag=setToStringTag$9,validateArgumentsLength$1=validateArgumentsLength$4,URLSearchParamsModule=web_urlSearchParams_constructor,InternalStateModule=internalState,setInternalState=InternalStateModule.set,getInternalURLState=InternalStateModule.getterFor("URL"),URLSearchParams$1=URLSearchParamsModule.URLSearchParams,getInternalSearchParamsState=URLSearchParamsModule.getState,NativeURL=global$2.URL,TypeError$1=global$2.TypeError,parseInt$2=global$2.parseInt,floor=Math.floor,pow=Math.pow,charAt=uncurryThis$3("".charAt),exec=uncurryThis$3(/./.exec),join$1=uncurryThis$3([].join),numberToString=uncurryThis$3(1..toString),pop=uncurryThis$3([].pop),push$1=uncurryThis$3([].push),replace=uncurryThis$3("".replace),shift=uncurryThis$3([].shift),split=uncurryThis$3("".split),stringSlice$1=uncurryThis$3("".slice),toLowerCase=uncurryThis$3("".toLowerCase),unshift=uncurryThis$3([].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_C0_CONTROL_OR_SPACE=/^[\u0000-\u0020]+/,TRAILING_C0_CONTROL_OR_SPACE=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,TAB_AND_NEW_LINE=/[\t\n\r]/g,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(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$2(i,o)}push$1(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=pow(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(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,p=0,f=function(){return charAt(e,p)};if(":"==f()){if(":"!=charAt(e,1))return;p+=2,u=++c}for(;f();){if(8==c)return;if(":"!=f()){for(t=r=0;r<4&&exec(HEX,f());)t=16*t+parseInt$2(f(),16),p++,r++;if("."==f()){if(0==r)return;if(p-=r,c>6)return;for(n=0;f();){if(i=null,n>0){if(!("."==f()&&n<4))return;p++}if(!exec(DIGIT,f()))return;for(;exec(DIGIT,f());){if(o=parseInt$2(f(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;p++}l[c]=256*l[c]+i,2!=++n&&4!=n||c++}if(4!=n)return;break}if(":"==f()){if(p++,!f())return}else if(f())return;l[c++]=t}else{if(null!==u)return;p++,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(e/256);return join$1(t,".")}if("object"==typeof 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=assign2({},C0ControlPercentEncodeSet,{" ":1,'"':1,"<":1,">":1,"`":1}),pathPercentEncodeSet=assign2({},fragmentPercentEncodeSet,{"#":1,"?":1,"{":1,"}":1}),userinfoPercentEncodeSet=assign2({},pathPercentEncodeSet,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),percentEncode=function(e,t){var r=codeAt$1(e,0);return r>32&&r<127&&!hasOwn$2(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(e,0))&&(":"==(r=charAt(e,1))||!t&&"|"==r)},startsWithWindowsDriveLetter=function(e){var t;return e.length>1&&isWindowsDriveLetter(stringSlice$1(e,0,2))&&(2==e.length||"/"===(t=charAt(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){var n,i,o,a=$toString(e);if(t){if(i=this.parse(a))throw TypeError$1(i);this.searchParams=null}else{if(void 0!==r&&(n=new URLState(r,!0)),i=this.parse(a,null,n))throw TypeError$1(i);(o=getInternalSearchParamsState(new URLSearchParams$1)).bindURL(this),this.searchParams=o}};URLState.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s=this,l=t||SCHEME_START,c=0,u="",p=!1,f=!1,d=!1;for(e=$toString(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(e,LEADING_C0_CONTROL_OR_SPACE,""),e=replace(e,TRAILING_C0_CONTROL_OR_SPACE,"$1")),e=replace(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$2(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$1(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(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(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(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(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(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(u,c+1))continue;c++;break;case SPECIAL_AUTHORITY_IGNORE_SLASHES:if("/"!=i&&"\\"!=i){l=AUTHORITY;continue}break;case AUTHORITY:if("@"==i){p&&(u="%40"+u),p=!0,o=arrayFrom(u);for(var h=0;h<o.length;h++){var y=o[h];if(":"!=y||d){var g=percentEncode(y,userinfoPercentEncodeSet);d?s.password+=g:s.username+=g}else d=!0}u=""}else if(i==EOF||"/"==i||"?"==i||"#"==i||"\\"==i&&s.isSpecial()){if(p&&""==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||f){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?f=!0:"]"==i&&(f=!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 _=parseInt$2(u,10);if(_>65535)return INVALID_PORT;s.port=s.isSpecial()&&_===specialSchemes[s.scheme]?null:_,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(r.path),s.query=r.query;else if("?"==i)s.host=r.host,s.path=arraySlice(r.path),s.query="",l=QUERY;else{if("#"!=i){startsWithWindowsDriveLetter(join$1(arraySlice(n,c),""))||(s.host=r.host,s.path=arraySlice(r.path),s.shortenPath()),l=PATH;continue}s.host=r.host,s.path=arraySlice(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$1(arraySlice(n,c),""))&&(isWindowsDriveLetter(r.path[0],!0)?push$1(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$1(s.path,"")):isSingleDot(u)?"/"==i||"\\"==i&&s.isSpecial()||push$1(s.path,""):("file"==s.scheme&&!s.path.length&&isWindowsDriveLetter(u)&&(s.host&&(s.host=""),u=charAt(u,0)+":"),push$1(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(e,0)){if("]"!=charAt(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$2(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$1(a,"/"):"",null!==s&&(c+="?"+s),null!==l&&(c+="#"+l),c},setHref:function(e){var t=this.parse(e);if(t)throw TypeError$1(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(e){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(e)+":",SCHEME_START)},getUsername:function(){return this.username},setUsername:function(e){var t=arrayFrom($toString(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(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(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=$toString(e))?this.port=null:this.parse(e,PORT))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+join$1(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(e))?this.query=null:("?"==charAt(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(e))?("#"==charAt(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(this,URLPrototype),r=validateArgumentsLength$1(arguments.length,1)>1?arguments[1]:void 0,n=setInternalState(t,new URLState(e,!1,r));DESCRIPTORS$1||(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$1&&(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(URLPrototype,"toJSON",(function(){return getInternalURLState(this).serialize()}),{enumerable:!0}),defineBuiltIn(URLPrototype,"toString",(function(){return getInternalURLState(this).serialize()}),{enumerable:!0}),NativeURL){var nativeCreateObjectURL=NativeURL.createObjectURL,nativeRevokeObjectURL=NativeURL.revokeObjectURL;nativeCreateObjectURL&&defineBuiltIn(URLConstructor,"createObjectURL",bind2(nativeCreateObjectURL,NativeURL)),nativeRevokeObjectURL&&defineBuiltIn(URLConstructor,"revokeObjectURL",bind2(nativeRevokeObjectURL,NativeURL))}setToStringTag(URLConstructor,"URL"),$$d({global:!0,constructor:!0,forced:!USE_NATIVE_URL$1,sham:!DESCRIPTORS$1},{URL:URLConstructor});var $$c=_export,getBuiltIn=getBuiltIn$h,fails$1=fails$B,validateArgumentsLength=validateArgumentsLength$4,toString$1=toString$f,USE_NATIVE_URL=urlConstructorDetection,URL$1=getBuiltIn("URL"),THROWS_WITHOUT_ARGUMENTS=USE_NATIVE_URL&&fails$1((function(){URL$1.canParse()}));$$c({target:"URL",stat:!0,forced:!THROWS_WITHOUT_ARGUMENTS},{canParse:function(e){var t=validateArgumentsLength(arguments.length,1),r=toString$1(e),n=t<2||void 0===arguments[1]?void 0:toString$1(arguments[1]);try{return!!new URL$1(r,n)}catch(e){return!1}}});var path$8=path$x,url$5=path$8.URL,parent$R=url$5,url$4=parent$R,parent$Q=url$4,url$3=parent$Q,parent$P=url$3,url$2=parent$P,url$1=url$2,url=url$1,_URL=getDefaultExportFromCjs(url),OptionList=function(){function e(t){_classCallCheck(this,e),this.config=t.config,this.parent=t.root,this.root=util$1.createDom("ul","",{},"xg-options-list xg-list-slide-scroll ".concat(this.config.className)),t.root.appendChild(this.root);var r=this.config.maxHeight;r&&this.setStyle({maxHeight:r}),this.onItemClick=this.onItemClick.bind(this),this.renderItemList();var n="touch"===this.config.domEventType?"touchend":"click";this._delegates=Plugin.delegate.call(this,this.root,"li",n,this.onItemClick)}return _createClass$1(e,[{key:"renderItemList",value:function(e){var t,r=this,n=this.config,i=this.root;(e?n.data=e:e=n.data,n.style)&&_mapInstanceProperty(t=_Object$keys(n.style)).call(t,(function(e){i.style[e]=n[e]}));e.length>0&&(this.attrKeys=_Object$keys(e[0])),this.root.innerHTML="",_mapInstanceProperty(e).call(e,(function(e,t){var n=e.selected?"option-item selected":"option-item";e["data-index"]=t,r.root.appendChild(util$1.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$1.hasClass(t,"selected"))return!1;var r="function"==typeof this.config.onItemClick?this.config.onItemClick:null,n=this.root.querySelector(".selected");util$1.addClass(t,"selected"),n&&util$1.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={};_mapInstanceProperty(t).call(t,(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$1.removeClass(this.root,"hide"),util$1.addClass(this.root,"active")}},{key:"hide",value:function(){util$1.removeClass(this.root,"active"),util$1.addClass(this.root,"hide")}},{key:"setStyle",value:function(e){var t=this;_Object$keys(e).forEach((function(r){t.root.style[r]=e[r]}))}},{key:"destroy",value:function(){var e;this._delegates&&(_mapInstanceProperty(e=this._delegates).call(e,(function(e){e.destroy&&e.destroy()})),this._delegates=null);this.root.innerHTML=null,this.parent.removeChild(this.root),this.root=null}}]),e}(),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:"直播"}},path$7=path$x,apply$1=functionApply;path$7.JSON||(path$7.JSON={stringify:JSON.stringify});var stringify$5=function(e,t,r){return apply$1(path$7.JSON.stringify,null,arguments)},parent$O=stringify$5,stringify$4=parent$O,parent$N=stringify$4,stringify$3=parent$N,parent$M=stringify$3,stringify$2=parent$M,stringify$1=stringify$2,stringify2=stringify$1,_JSON$stringify=getDefaultExportFromCjs(stringify2),WrappedWellKnownSymbolModule=wellKnownSymbolWrapped,toStringTag$5=WrappedWellKnownSymbolModule.f("toStringTag"),parent$L=toStringTag$5,toStringTag$4=parent$L,parent$K=toStringTag$4,toStringTag$3=parent$K,parent$J=toStringTag$3,toStringTag$2=parent$J,toStringTag$1=toStringTag$2,toStringTag=toStringTag$1,_Symbol$toStringTag=getDefaultExportFromCjs(toStringTag),$$b=_export,uncurryThis$2=functionUncurryThisClause;objectGetOwnPropertyDescriptor.f;var toLength=toLength$3,toString4=toString$f,notARegExp=notARegexp,requireObjectCoercible=requireObjectCoercible$8,correctIsRegExpLogic=correctIsRegexpLogic,nativeStartsWith=uncurryThis$2("".startsWith),stringSlice=uncurryThis$2("".slice),min$1=Math.min,CORRECT_IS_REGEXP_LOGIC=correctIsRegExpLogic("startsWith");$$b({target:"String",proto:!0,forced:!CORRECT_IS_REGEXP_LOGIC},{startsWith:function(e){var t=toString4(requireObjectCoercible(this));notARegExp(e);var r=toLength(min$1(arguments.length>1?arguments[1]:void 0,t.length)),n=toString4(e);return nativeStartsWith?nativeStartsWith(t,n,r):stringSlice(t,r,r+n.length)===n}});var entryVirtual$5=entryVirtual$p,startsWith$6=entryVirtual$5("String").startsWith,isPrototypeOf$7=objectIsPrototypeOf,method$5=startsWith$6,StringPrototype$1=String.prototype,startsWith$5=function(e){var t=e.startsWith;return"string"==typeof e||e===StringPrototype$1||isPrototypeOf$7(StringPrototype$1,e)&&t===StringPrototype$1.startsWith?method$5:t},parent$I=startsWith$5,startsWith$4=parent$I,parent$H=startsWith$4,startsWith$3=parent$H,parent$G=startsWith$3,startsWith$2=parent$G,startsWith$1=startsWith$2,startsWith2=startsWith$1,_startsWithInstanceProperty=getDefaultExportFromCjs(startsWith2),toObject$1=toObject$e,toAbsoluteIndex$1=toAbsoluteIndex$6,lengthOfArrayLike$2=lengthOfArrayLike$d,arrayFill=function(e){for(var t=toObject$1(this),r=lengthOfArrayLike$2(t),n=arguments.length,i=toAbsoluteIndex$1(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:toAbsoluteIndex$1(o,r);a>i;)t[i++]=e;return t},$$a=_export,fill$7=arrayFill;$$a({target:"Array",proto:!0},{fill:fill$7});var _EVENT_TRANSFORMATION,entryVirtual$4=entryVirtual$p,fill$6=entryVirtual$4("Array").fill,isPrototypeOf$6=objectIsPrototypeOf,method$4=fill$6,ArrayPrototype$3=Array.prototype,fill$5=function(e){var t=e.fill;return e===ArrayPrototype$3||isPrototypeOf$6(ArrayPrototype$3,e)&&t===ArrayPrototype$3.fill?method$4:t},parent$F=fill$5,fill$4=parent$F,parent$E=fill$4,fill$3=parent$E,parent$D=fill$3,fill$2=parent$D,fill$1=fill$2,fill2=fill$1,_fillInstanceProperty=getDefaultExportFromCjs(fill2),BaseEvents={SEI:"sei",PLAYER_CREATE_FINISH:"playerCreateFinish",FALLBACK_ERROR:"fallbackError",FALLBACK:"fallback",AUTOPLAY_STARTED:"autoplayStarted",AUTOPLAY_PREVENTED:"autoplayWasPrevented",DOWNLOAD_SPEED_CHANGE:"downloadSpeedChange",FULLSCREEN_CHANGE:"fullscreenChange",CSS_FULLSCREEN_CHANGE:"cssFullscreenChange",MINI_STATE_CHANGE:"miniStateChange",DEFINITION_CHANGE:"definitionChange",BEFORE_DEFINITION_CHANGE:"beforeDefinitionChange",AFTER_DEFINITION_CHANGE:"afterDefinitionChange",VIDEO_RESIZE:"videoResize",PIP_CHANGE:"pipChange",USER_ACTION:"userAction",AUTOPLAY_UNMUTE:"autoplayUnmute",LONG_WAITING:"longWaiting",DEFINITION_FALLBACK:"definitionFallback",AUTOPLAY_FAIL:"autoplayFail",AUTOPLAY_SUCCESS:"autoplaySuccess",ERROR_REFRESH_CLICK:"errorRefreshClick",SOURCE_CHANGE:"sourceChange",ABR_SWITCH_START:"abrSwitchStart",ABR_SWITCH_SUCCESS:"abrSwitchSuccess",ABR_SWITCH_FAILED:"abrSwitchFailed"},Events$1=_objectSpread2$2(_objectSpread2$2({},XGEvents),BaseEvents),EVENT_TRANSFORMATION=(_defineProperty$2(_EVENT_TRANSFORMATION={},BaseEvents.SEI,{event:"core_event",shouldCallback:function(e){return"core.sei"===(null==e?void 0:e.eventName)}}),_defineProperty$2(_EVENT_TRANSFORMATION,BaseEvents.AUTOPLAY_STARTED,{event:AUTOPLAY_STARTED}),_defineProperty$2(_EVENT_TRANSFORMATION,BaseEvents.AUTOPLAY_PREVENTED,{event:AUTOPLAY_PREVENTED}),_defineProperty$2(_EVENT_TRANSFORMATION,BaseEvents.FULLSCREEN_CHANGE,{event:FULLSCREEN_CHANGE}),_defineProperty$2(_EVENT_TRANSFORMATION,BaseEvents.CSS_FULLSCREEN_CHANGE,{event:CSS_FULLSCREEN_CHANGE}),_defineProperty$2(_EVENT_TRANSFORMATION,BaseEvents.MINI_STATE_CHANGE,{event:MINI_STATE_CHANGE}),_defineProperty$2(_EVENT_TRANSFORMATION,BaseEvents.DEFINITION_CHANGE,{event:DEFINITION_CHANGE}),_defineProperty$2(_EVENT_TRANSFORMATION,BaseEvents.BEFORE_DEFINITION_CHANGE,{event:BEFORE_DEFINITION_CHANGE}),_defineProperty$2(_EVENT_TRANSFORMATION,BaseEvents.AFTER_DEFINITION_CHANGE,{event:AFTER_DEFINITION_CHANGE}),_defineProperty$2(_EVENT_TRANSFORMATION,BaseEvents.VIDEO_RESIZE,{event:VIDEO_RESIZE}),_defineProperty$2(_EVENT_TRANSFORMATION,BaseEvents.PIP_CHANGE,{event:PIP_CHANGE}),_defineProperty$2(_EVENT_TRANSFORMATION,BaseEvents.USER_ACTION,{event:USER_ACTION}),_defineProperty$2(_EVENT_TRANSFORMATION,BaseEvents.DOWNLOAD_SPEED_CHANGE,{event:DOWNLOAD_SPEED_CHANGE}),_defineProperty$2(_EVENT_TRANSFORMATION,BaseEvents.ABR_SWITCH_START,{event:"switch_definition_start"}),_defineProperty$2(_EVENT_TRANSFORMATION,BaseEvents.ABR_SWITCH_SUCCESS,{event:"switch_definition_success"}),_defineProperty$2(_EVENT_TRANSFORMATION,BaseEvents.ABR_SWITCH_FAILED,{event:"switch_definition_fail"}),_EVENT_TRANSFORMATION);function transform(e,t){var r=EVENT_TRANSFORMATION[e];if(r){return{xgEventName:r.event,xgCallback:t?r.shouldCallback?function(){for(var e,n,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];null!==(e=r.shouldCallback)&&void 0!==e&&e.call.apply(e,_concatInstanceProperty(n=[r]).call(n,o))&&(null==t||t.apply(void 0,o))}:t:void 0}}return{xgEventName:e,xgCallback:t}}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}function _arrayWithHoles(e){if(_Array$isArray(e))return e}function _iterableToArrayLimit(e,t){var r=null==e?null:void 0!==_Symbol$1&&_getIteratorMethod$1(e)||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=o.call(r)).done)&&(_pushInstanceProperty(s).call(s,n.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}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 _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray$1(e,t)||_nonIterableRest()}var DESCRIPTORS=descriptors,uncurryThis$1=functionUncurryThis,objectKeys=objectKeys$4,toIndexedObject$1=toIndexedObject$c,$propertyIsEnumerable=objectPropertyIsEnumerable.f,propertyIsEnumerable3=uncurryThis$1($propertyIsEnumerable),push2=uncurryThis$1([].push),createMethod$1=function(e){return function(t){for(var r,n=toIndexedObject$1(t),i=objectKeys(n),o=i.length,a=0,s=[];o>a;)r=i[a++],DESCRIPTORS&&!propertyIsEnumerable3(n,r)||push2(s,e?[r,n[r]]:n[r]);return s}},objectToArray={entries:createMethod$1(!0),values:createMethod$1(!1)},$$9=_export,$entries=objectToArray.entries;$$9({target:"Object",stat:!0},{entries:function(e){return $entries(e)}});var path$6=path$x,entries$c=path$6.Object.entries,parent$C=entries$c,entries$b=parent$C,parent$B=entries$b,entries$a=parent$B,parent$A=entries$a,entries$9=parent$A,entries$8=entries$9,entries$7=entries$8,_Object$entries=getDefaultExportFromCjs(entries$7);function escapeIcons(e){var t={};return _Object$entries(null!=e?e:{}).forEach((function(e){var r=_slicedToArray(e,2),n=r[0],i=r[1];"string"==typeof i?console.warn("icons.".concat(n," has been removed")):t[n]=i})),t}var aCallable=aCallable$j,toObject=toObject$e,IndexedObject=indexedObject,lengthOfArrayLike$1=lengthOfArrayLike$d,$TypeError=TypeError,createMethod=function(e){return function(t,r,n,i){aCallable(r);var o=toObject(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),right:createMethod(!0)},$$8=_export,$reduce=arrayReduce.left,arrayMethodIsStrict$1=arrayMethodIsStrict$5,CHROME_VERSION=engineV8Version,IS_NODE=engineIsNode,CHROME_BUG=!IS_NODE&&engineV8Version>79&&engineV8Version<83,FORCED$1=CHROME_BUG||!arrayMethodIsStrict$1("reduce");$$8({target:"Array",proto:!0,forced:FORCED$1},{reduce:function(e){var t=arguments.length;return $reduce(this,e,t,t>1?arguments[1]:void 0)}});var entryVirtual$3=entryVirtual$p,reduce$6=entryVirtual$3("Array").reduce,isPrototypeOf$5=objectIsPrototypeOf,method$3=reduce$6,ArrayPrototype$2=Array.prototype,reduce$5=function(e){var t=e.reduce;return e===ArrayPrototype$2||isPrototypeOf$5(ArrayPrototype$2,e)&&t===ArrayPrototype$2.reduce?method$3:t},parent$z=reduce$5,reduce$4=parent$z,parent$y=reduce$4,reduce$3=parent$y,parent$x=reduce$3,reduce$2=parent$x,reduce$1=reduce$2,reduce3=reduce$1,_reduceInstanceProperty=getDefaultExportFromCjs(reduce3);function arrayToList(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t={url:e[0],next:null},r=t,n=1;n<e.length;n++){var i=n===e.length-1?t:null,o={url:e[n],next:i};r.next=o,r=o}return t}var Definition=function(){function e(t){var r;_classCallCheck$1(this,e),_defineProperty$2(this,"definition",void 0),_defineProperty$2(this,"source",void 0),_defineProperty$2(this,"text",void 0),_defineProperty$2(this,"fallbackUrl",void 0),_defineProperty$2(this,"urls",void 0),_defineProperty$2(this,"_currentUrlRef",void 0);var n=t.url,i=t.definition,o=t.text,a=t.source,s=t.fallbackUrls;this.definition=i,this.text=o,this.source=a,this.urls=_concatInstanceProperty(r=[n]).call(r,_toConsumableArray$1(null!=s?s:[])),this.fallbackUrl=arrayToList(this.urls),this._currentUrlRef=this.fallbackUrl}return _createClass$2(e,[{key:"url",get:function(){return this._currentUrlRef.url},set:function(e){this._currentUrlRef.url=e}},{key:"next",value:function(){var e=this._currentUrlRef.next;
2
- /* istanbul ignore next -- @preserve */return e&&(this._currentUrlRef=e),this._currentUrlRef}}]),e}(),Source=function(){function e(t,r,n){var i=this;_classCallCheck$1(this,e),_defineProperty$2(this,"name",void 0),_defineProperty$2(this,"text",void 0),_defineProperty$2(this,"definitions",void 0),this.definitions=_mapInstanceProperty(t).call(t,(function(e){return new Definition(_Object$assign({},e,{source:i}))})),this.name=r,this.text=n}return _createClass$2(e,[{key:"defaultDefinition",get:function(){return this.definitions[0]}},{key:"add",value:function(e){this.definitions.push(e)}}],[{key:"normalize",value:function(t){if(void 0===t)throw new Error('"input" cannot be undefined');var r=void 0,n=void 0,i=void 0;if("string"==typeof t?r=t:Array.isArray(t)?i=t:(r=t.url,n=t.fallbackUrls,i=t.sources),"string"==typeof r)return e.normalizeUrl(r,n);if(Array.isArray(i)){if(0===i.length)throw new Error('"sources" cannot be an empty array');return _mapInstanceProperty(i).call(i,(function(t){var r;return new e(_mapInstanceProperty(r=t.definitions).call(r,(function(e){return"string"==typeof e?{url:e,definition:"unknown"}:e})),t.name,t.text)}))}return[]}},{key:"normalizeUrl",value:function(t,r){var n=new e([],"unknown");return n.add(new Definition({definition:"unknown",url:t,source:n,fallbackUrls:r})),[n]}}]),e}(),SourceManager=function(){function e(t){var r,n,i,o;_classCallCheck$1(this,e),_defineProperty$2(this,"defaultSource",void 0),_defineProperty$2(this,"defaultDefinition",void 0),_defineProperty$2(this,"maxFallbackRound",void 0),_defineProperty$2(this,"_currentDefinition",void 0),_defineProperty$2(this,"_sources",void 0),_defineProperty$2(this,"_fallbackCount",0);var a=t.url,s=t.defaultDefinition,l=t.defaultSource,c=t.sources,u=t.maxFallbackRound;this.defaultDefinition=s,this.defaultSource=l,this.maxFallbackRound=null!=u?u:1,this._sources=c;var p=a?_findInstanceProperty(this).call(this,a):null===(r=_findInstanceProperty(n=this.sources).call(n,(function(e){return void 0===l||e.name===l})))||void 0===r?void 0:_findInstanceProperty(i=r.definitions).call(i,(function(e){return void 0===s||e.definition===s}));this._currentDefinition=null!=p?p:null===(o=this._sources)||void 0===o||null===(o=o[0])||void 0===o||null===(o=o.definitions)||void 0===o?void 0:o[0]}return _createClass$2(e,[{key:"sources",get:function(){return this._sources}},{key:"definition",get:function(){return this._currentDefinition}},{key:"source",get:function(){var e;return null===(e=this.definition)||void 0===e?void 0:e.source}},{key:"url",get:function(){var e;return null===(e=this.definition)||void 0===e?void 0:e.url},set:function(e){this.definition&&(this.definition.url=e)}},{key:"find",value:function(e,t){var r,n,i,o,a,s=this;if("string"==typeof e)return _findInstanceProperty(o=_reduceInstanceProperty(a=this.sources).call(a,(function(e,t){return _concatInstanceProperty(e).call(e,t.definitions)}),[])).call(o,(function(t){return t.url===e}));var l=_findInstanceProperty(r=this.sources).call(r,(function(t){var r,n;return t.name===(null!==(r=null==e?void 0:e.source)&&void 0!==r?r:null===(n=s.source)||void 0===n?void 0:n.name)})),c=null==l?void 0:_findInstanceProperty(n=l.definitions).call(n,(function(t){var r,n;return t.definition===(null!==(r=null==e?void 0:e.definition)&&void 0!==r?r:null===(n=s.definition)||void 0===n?void 0:n.definition)}));return c||(null!=t&&t.fallbackToFirstDefinition&&null!=l&&null!==(i=l.definitions)&&void 0!==i&&i.length?null==l?void 0:l.definitions[0]:void 0)}},{key:"fallback",value:function(){var e;if(this._fallbackCount++,!(this._fallbackCount>=this.maxFallbackRound*this.definition.urls.length)){var t=null===(e=this._currentDefinition)||void 0===e?void 0:e.next();return null==t?void 0:t.url}this.resetFallback()}},{key:"switch",value:function(e){return this._currentDefinition=e,this.resetFallback(),e}},{key:"updateSources",value:function(e,t){var r,n,i,o,a;return this._sources=Source.normalize(e),this._currentDefinition=null!==(r=_findInstanceProperty(this).call(this,null!=t?t:{source:null!==(n=this.defaultSource)&&void 0!==n?n:null===(i=this._currentDefinition)||void 0===i?void 0:i.source.name,definition:null!==(o=this.defaultDefinition)&&void 0!==o?o:null===(a=this._currentDefinition)||void 0===a?void 0:a.definition}))&&void 0!==r?r:this._sources[0].definitions[0],this.resetFallback(),this}},{key:"resetFallback",value:function(){this._fallbackCount=0}}]),e}();function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _get(){var e;"undefined"!=typeof Reflect&&_Reflect$get$1?_get=_bindInstanceProperty(e=_Reflect$get$1).call(e):_get=function(e,t,r){var n=_superPropBase(e,t);if(n){var i=_Object$getOwnPropertyDescriptor$1(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}};return _get.apply(this,arguments)}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 error="",Error$1=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(){var e,n;_classCallCheck$1(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$2(_assertThisInitialized(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,o))),"_error",void 0),n}return _createClass$2(r,[{key:"_errorTip",get:function(){var e,t,r,n=this.player.config.i18nManager,i=null===(e=this._error)||void 0===e?void 0:e.errorCode;return this.config.errorTipsText?n.normalize(this.config.errorTipsText):_concatInstanceProperty(t="".concat(i?"[".concat(i,"] "):"")).call(t,null===(r=this._error)||void 0===r?void 0:r.message)}},{key:"afterCreate",value:function(){this._handleRefresh=this._handleRefresh.bind(this),this._focus=this._focus.bind(this),this._initEvents(),this._initIcons(),"mobile"===sniffer$1.device&&this.bind("touchend",this._focus),this.bind(".veplayer-error-refresh","click",this._handleRefresh)}},{key:"registerIcons",value:function(){return{error:{icon:ErrorImg,class:"veplayer-error-svg"}}}},{key:"updateLang",value:function(){this.config.showRefresh&&this._renderRefresh(),this._renderExtraTips()}},{key:"showError",value:function(e){this._error=e instanceof VeError$1?e:transform$1(e),this.config.showErrorTip&&this._renderText(this._errorTip),this._renderExtraTips(),_get(_getPrototypeOf(r.prototype),"show",this).call(this)}},{key:"hideError",value:function(){_get(_getPrototypeOf(r.prototype),"hide",this).call(this)}},{key:"destroy",value:function(){"mobile"===sniffer$1.device&&this.unbind("touchend",this._focus),this.unbind(".veplayer-error-refresh","click",this._handleRefresh),this.off(Events$1.FALLBACK_ERROR,this.showError.bind(this)),this.off(CANPLAY,this.hideError.bind(this))}},{key:"render",value:function(){var e,t=this.player.config.i18nManager;return _concatInstanceProperty(e='<veplayer-error class="veplayer-error">\n <div class="veplayer-error-cover">\n '.concat(this.config.showErrorImg?'<div class="veplayer-error-img"></div>':"",'\n <div class="veplayer-error-tips"></div>\n ')).call(e,this.config.showRefresh?'<div class="veplayer-error-refresh">'.concat(t.getText("ERROR_REFRESH"),"</div>"):"",'\n <div class="veplayer-error-extra"></div>\n </div>\n </veplayer-error>')}},{key:"_focus",value:function(){this.player.focus({autoHide:!0})}},{key:"_initIcons",value:function(){this.config.showErrorImg&&this.appendChild(".veplayer-error-img",this.icons.error)}},{key:"_initEvents",value:function(){this.on(Events$1.FALLBACK_ERROR,this.showError.bind(this)),this.on(CANPLAY,this.hideError.bind(this)),this.on(PLAY,this.hideError.bind(this)),this.on(RETRY,this.hideError.bind(this))}},{key:"_renderText",value:function(e){var t=_findInstanceProperty(this).call(this,".veplayer-error-tips");t&&(t.innerText=e)}},{key:"_renderExtraTips",value:function(){var e,t=this,r=_findInstanceProperty(this).call(this,".veplayer-error-extra");r&&(r.innerHTML="");var n=this.player.config.i18nManager;null===(e=this.config.extraTips)||void 0===e||e.forEach((function(e){if(e){var r,i=util$1.createDom("div",_concatInstanceProperty(r="".concat(n.normalize(e.label),": ")).call(r,n.normalize(e.value)),void 0,"veplayer-error-detail-info");t.appendChild(".veplayer-error-extra",i)}}))}},{key:"_handleRefresh",value:function(){var e,t;null===(e=this.player)||void 0===e||e.emit(Events$1.ERROR_REFRESH_CLICK),null===(t=this.player)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.veplayer)||void 0===t||t.retry(),this.hideError()}},{key:"_renderRefresh",value:function(){var e,t=this.player.config.i18nManager,r=_findInstanceProperty(this).call(this,".veplayer-error-refresh");r&&(r.innerHTML=null!==(e=t.getText("ERROR_REFRESH"))&&void 0!==e?e:"")}}],[{key:"pluginName",get:function(){return"error"}},{key:"defaultConfig",get:function(){return{showErrorImg:!0,showErrorTip:!0,showRefresh:!0,errorTipsText:"",extraTips:[],position:Plugin.POSITIONS.ROOT}}}]),r}(),toast="",DURATION=2e3,Toast=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(){var e,n;_classCallCheck$1(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$2(_assertThisInitialized(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,o))),"_toastNumber",0),_defineProperty$2(_assertThisInitialized(n),"_toastMap",{}),n}return _createClass$2(r,[{key:"toast",value:function(e,t){var r=this,n=t||{},i=n.duration,o=void 0===i?DURATION:i,a=n.closable,s=void 0!==a&&a,l=this._toastNumber+1;this._toastNumber=l;var c=this._renderToast(e,s,l);return this.root.appendChild(c),this._toastMap[l]=c,setTimeout((function(){r.remove(l)}),o),l}},{key:"remove",value:function(e){var t=this._toastMap[e];t&&(this.root.contains(t)&&this.root.removeChild(t),delete this._toastMap[e])}},{key:"render",value:function(){return'<veplayer-toast class="veplayer-toast"></veplayer-toast>'}},{key:"_renderToast",value:function(e,t,r){var n=this,i=util$1.createDom("div","",void 0,"veplayer-toast-container"),o=util$1.checkIsObject(e)?e:util$1.createDom("div",e,void 0,"veplayer-toast-txt");if(i.appendChild(o),t){var a=util$1.createDom("span","×",void 0,"veplayer-toast-close");a.addEventListener("click",(function(){n.remove(r)})),i.appendChild(a)}return i}}],[{key:"pluginName",get:function(){return"toast"}},{key:"defaultConfig",get:function(){return{index:5}}}]),r}();function SourceIcon(){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 mobilePanel="",MobilePlayerPanel=function(){function e(t){_classCallCheck$1(this,e),_defineProperty$2(this,"_root",void 0),_defineProperty$2(this,"_config",void 0),_defineProperty$2(this,"_parent",void 0),_defineProperty$2(this,"_listDom",void 0),_defineProperty$2(this,"_container",void 0),_defineProperty$2(this,"_titleDom",void 0),_defineProperty$2(this,"_player",void 0),_defineProperty$2(this,"_delegates",void 0),_defineProperty$2(this,"_listType",void 0);var r=t.config,n=t.root,i=t.player;this._config=r,this._parent=n,this._player=i,this._listType=r.listType,this.renderPanel(),this._initEvents(),this._bindDomEvent()}return _createClass$2(e,[{key:"changeMode",value:function(e){this.updatePanel(e),this._listType=e}},{key:"renderItemList",value:function(e){var t,r=this,n=this._config;return e&&(n.list=e),this._listDom||(this._listDom=util$1.createDom("div","",{},"item-list-panel-content")),this._listDom.innerHTML="",null===(t=n.list)||void 0===t||_mapInstanceProperty(t).call(t,(function(e,t){var n,i,o=e.selected?"panel-item select-in":"panel-item ".concat(null!==(n=e.className)&&void 0!==n?n:"");e["data-index"]=t;var a=util$1.createDom("div","",e,o);e.showText&&("string"==typeof e.showText?a.innerHTML=e.showText:a.appendChild(e.showText)),null===(i=r._listDom)||void 0===i||i.appendChild(a)})),this._listDom}},{key:"renderTitle",value:function(){var e,t,r=this._player.config.i18nManager;if(null!==(e=this._config.panel)&&void 0!==e&&e.title&&this._listType!==ListType.Inner)return this._titleDom||(this._titleDom=util$1.createDom("div","",{},"xg-mobile-panel-title")),this._titleDom.innerHTML=r.normalize(null===(t=this._config.panel)||void 0===t?void 0:t.title),this._titleDom}},{key:"updatePanel",value:function(e){this._root&&util$1.removeClass(this._root,"panel-".concat(this._listType)),this._root&&util$1.addClass(this._root,"panel-".concat(e));var t="mobile"===sniffer$1.device?"touchend":"click";e===ListType.Inner?this._container&&this._bind(this._container,t,this._handleHide.bind(this)):this._container&&this._unbind(this._container,t,this._handleHide.bind(this))}},{key:"renderPanel",value:function(){var e,t,r,n=_concatInstanceProperty(e="xg-mobile-panel panel-".concat(this._config.listType," ")).call(e,null!==(t=null===(r=this._config)||void 0===r||null===(r=r.panel)||void 0===r?void 0:r.className)&&void 0!==t?t:"");this._root=util$1.createDom("div","",{},n),this._parent&&this._parent.appendChild(this._root);var i=this.renderTitle(),o=this.renderItemList();this._container=util$1.createDom("div","",{},"xg-mobile-panel-content"),this._root.appendChild(this._container),i&&this._container.appendChild(i),o&&this._container.appendChild(o)}},{key:"show",value:function(){this._root&&(util$1.removeClass(this._root,"hide"),util$1.addClass(this._root,"active"))}},{key:"hide",value:function(){this._root&&(util$1.removeClass(this._root,"active"),util$1.addClass(this._root,"hide"))}},{key:"destroy",value:function(){this._parent&&this._root&&this._parent.removeChild(this._root),this._unbindDomEvent(),this._unbindEvents()}},{key:"_bind",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e&&"on".concat(t)in e&&"function"==typeof r&&e.addEventListener(t,r,n)}},{key:"_unbind",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e&&"on".concat(t)in e&&"function"==typeof r&&e.removeEventListener(t,r,n)}},{key:"_initEvents",value:function(){var e;this._config.isAutoChange&&(window.addEventListener("orientationchange",this._handleOrientationChange.bind(this)),null===(e=this._player)||void 0===e||e.on(FULLSCREEN_CHANGE,this._handleOrientationChange.bind(this)))}},{key:"_unbindEvents",value:function(){var e;window.removeEventListener("orientationchange",this._handleOrientationChange.bind(this)),null===(e=this._player)||void 0===e||e.off(FULLSCREEN_CHANGE,this._handleOrientationChange.bind(this))}},{key:"_handleOrientationChange",value:function(){var e,t,r,n=_includesInstanceProperty(e=[90,-90,"90","-90"]).call(e,window.orientation);if(null!==(t=this._player)&&void 0!==t&&t.fullscreen&&n)this.changeMode(ListType.Fullscreen);else if(this._listType!==(null===(r=this._config)||void 0===r?void 0:r.listType)){var i;this.changeMode(null===(i=this._config)||void 0===i?void 0:i.listType)}}},{key:"_bindDomEvent",value:function(){var e="mobile"===sniffer$1.device?"touchend":"click";this._listType===ListType.Inner&&this._container&&this._bind(this._container,e,this._handleHide.bind(this)),this._root&&this._bind(this._root,e,this._handleHide.bind(this)),this._container&&this._bind(this._container,e,this._stopPropagation),this._listDom&&(this._delegates=Plugin.delegate.call(this,this._listDom,".panel-item",e,this._onItemClick.bind(this),!0))}},{key:"_unbindDomEvent",value:function(){var e,t="mobile"===sniffer$1.device?"touchend":"click";(this._root&&this._unbind(this._root,t,this._handleHide.bind(this)),this._container&&this._unbind(this._container,t,this._handleHide.bind(this)),this._container&&this._unbind(this._container,t,this._stopPropagation),this._delegates)&&(_mapInstanceProperty(e=this._delegates).call(e,(function(e){e.destroy&&e.destroy()})),this._delegates=null)}},{key:"_stopPropagation",value:function(e){e.stopPropagation(),e.preventDefault()}},{key:"_onItemClick",value:function(e){var t,r,n,i,o=e.delegateTarget,a="function"==typeof this._config.onOptionClick?this._config.onOptionClick:null,s="function"==typeof this._config.onItemClick?this._config.onItemClick:null,l=null===(t=this._root)||void 0===t?void 0:t.querySelector(".selected");util$1.addClass(o,"selected"),l&&(util$1.removeClass(l,"selected"),i=Number(l.getAttribute("data-index")));var c=Number(o.getAttribute("data-index")),u={from:void 0!==_typeof$1(i)?null===(r=this._config.list)||void 0===r?void 0:r[i]:void 0,to:null===(n=this._config.list)||void 0===n?void 0:n[c]};null==a||a(e,u),o&&i===c||null==s||s(e,u)}},{key:"_handleHide",value:function(e){var t,r;e.stopPropagation(),e.preventDefault(),null===(t=(r=this._config).hide)||void 0===t||t.call(r)}}]),e}(),optionsIcon="",ListType=function(e){return e.Middle="middle",e.Bottom="bottom",e.Fullscreen="fullscreen",e.Inner="inner",e}(ListType||{}),RenderType=function(e){return e.Icon="Icon",e.Text="Text",e}(RenderType||{}),isMobile$1="mobile"===sniffer$1.device,MOBILE_LIST_TYPES=["bottom","fullscreen","inner"],PC_LIST_TYPES=["middle"],MODAL_TYPES=["bottom","inner","fullscreen"],CUSTOM_TYPES=["bottom","inner","fullscreen"],OptionsIcon=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(e){var n;return _classCallCheck$1(this,r),_defineProperty$2(_assertThisInitialized(n=t.call(this,e)),"optionsList",void 0),_defineProperty$2(_assertThisInitialized(n),"_isIcon",void 0),_defineProperty$2(_assertThisInitialized(n),"_isActive",void 0),_defineProperty$2(_assertThisInitialized(n),"_curIndex",void 0),_defineProperty$2(_assertThisInitialized(n),"activeEvent",void 0),_defineProperty$2(_assertThisInitialized(n),"onEnter",(function(e){e.preventDefault(),e.stopPropagation(),n.emit("icon_mouseenter",{pluginName:n.pluginName}),n.toggle(!0)})),_defineProperty$2(_assertThisInitialized(n),"onLeave",(function(e){e.preventDefault(),e.stopPropagation(),n.emit("icon_mouseleave",{pluginName:n.pluginName}),n._isActive&&n.toggle(!1)})),n._isIcon=!1,n._isActive=!1,n._curIndex=0,n}return _createClass$2(r,[{key:"updateLang",value:function(){this.config.list&&this.renderItemList(this.config.list,this._curIndex)}},{key:"afterCreate",value:function(){var e=this,t=this.config;this.config.listType=this._getListType(),this.initIcons(),t.hidePortrait&&util$1.addClass(this.root,"portrait"),isMobile$1&&this.on(PLAYER_FOCUS,(function(){e._isActive&&(e.optionsList&&e.optionsList.hide(),e._isActive=!1)})),t.list&&this.renderItemList(t.list),this.activeEvent=isMobile$1?"touchend":"mouseenter",this.bind(this.activeEvent,this.onEnter),this.bind("mouseleave",this.onLeave)}},{key:"initIcons",value:function(){var e=this,t=this.icons,r=_Object$keys(t);if(r.length>0&&"Icon"===this.config.renderType)return r.forEach((function(r){e.appendChild(".xgplayer-icon",t[r])})),void(this._isIcon=!0);var n=this.appendChild(".xgplayer-icon",util$1.createDom("span","",{},"icon-text"));n&&util$1.addClass(n,"btn-text")}},{key:"show",value:function(){!this.config.list||this.config.list.length<1||this.config.hideOnSingleOption&&1===this.config.list.length||util$1.addClass(this.root,"show")}},{key:"hide",value:function(){util$1.removeClass(this.root,"show")}},{key:"toggle",value:function(e){if(e!==this._isActive){var t=this.player.controls,r=this.config.listType;e?(r&&_includesInstanceProperty(MODAL_TYPES).call(MODAL_TYPES,r)?t.blur():t.focus(),this.optionsList&&this.optionsList.show()):(r&&_includesInstanceProperty(MODAL_TYPES).call(MODAL_TYPES,r)?t.focus():t.focusAwhile(),this.optionsList&&this.optionsList.hide()),this._isActive=e}}},{key:"onItemClick",value:function(e,t){var r;e.preventDefault(),e.stopPropagation();var n=this.config.listType;this._curIndex=null===(r=t.to)||void 0===r?void 0:r.index,this.changeCurrentText(),(this.config.isItemClickHide||n&&_includesInstanceProperty(MODAL_TYPES).call(MODAL_TYPES,n))&&this.toggle(!1)}},{key:"onOptionClick",value:function(e,t){e.preventDefault(),e.stopPropagation()}},{key:"changeCurrentText",value:function(){if(!this._isIcon){var e=this.config.list,t=e&&this._curIndex<e.length?this._curIndex:0,r=null==e?void 0:e[t];if(r){var n,i=_findInstanceProperty(this).call(this,".icon-text"),o=this.player.config.i18nManager;if(i)i.innerHTML=o.normalize(null!==(n=null==r?void 0:r.iconText)&&void 0!==n?n:null==r?void 0:r.text)}}}},{key:"renderItemList",value:function(e,t){var n,i=this,o=this.config,a=this.optionsList,s=this.player;if("number"==typeof t&&(this._curIndex=t),a)return a.renderItemList(e),this.changeCurrentText(),void(a instanceof MobilePlayerPanel&&a.renderTitle());this.config.isShowIcon&&(this.optionsList=o.listType&&_includesInstanceProperty(CUSTOM_TYPES).call(CUSTOM_TYPES,o.listType)?new MobilePlayerPanel({config:{list:e||[],onItemClick:function(e,t){i.onItemClick(e,t)},onOptionClick:function(e,t){i.onOptionClick(e,t)},panel:this.config.panel,listType:null!==(n=o.listType)&&void 0!==n?n:r.defaultConfig.listType,isAutoChange:o.isAutoChange,hide:function(){return i.toggle(!1)}},root:s.root,player:s}):new OptionList({config:{data:e||[],onItemClick:function(e,t){i.onItemClick(e,t)}},root:this.root}),this.changeCurrentText(),this.show())}},{key:"destroy",value:function(){this.activeEvent&&this.unbind(this.activeEvent,this.onEnter),this.unbind("mouseleave",this.onLeave),this.optionsList&&(this.optionsList.destroy(),this.optionsList=void 0)}},{key:"render",value:function(){return this.config.isShowIcon?'<xg-icon class="xg-options-icon '.concat(this.config.className||"",'">\n <div class="xgplayer-icon">\n </div>\n </xg-icon>'):""}},{key:"_getListType",value:function(){var e,t=this.config.listType;return null!==(e=this.player)&&void 0!==e&&null!==(e=e.config)&&void 0!==e&&e.listType&&(t=this.player.config.listType),isMobile$1||t&&_includesInstanceProperty(MOBILE_LIST_TYPES).call(MOBILE_LIST_TYPES,t)||(t="bottom"),isMobile$1||t&&_includesInstanceProperty(PC_LIST_TYPES).call(PC_LIST_TYPES,t)||(t="middle"),t}}],[{key:"pluginName",get:function(){return"optionsIcon"}},{key:"defaultConfig",get:function(){return{position:isMobile$1?POSITIONS$1.ROOT_TOP_RIGHT:POSITIONS$1.CONTROLS_RIGHT,listType:isMobile$1?"bottom":"middle",index:100,list:[],listStyle:{},hidePortrait:!0,isShowIcon:!1,renderType:isMobile$1?"Icon":"Text",isItemClickHide:!0,hideOnSingleOption:!0,isAutoChange:!0}}}]),r}(),Sources=function(e){_inherits(r,OptionsIcon);var t=_createSuper(r);function r(){return _classCallCheck$1(this,r),t.apply(this,arguments)}return _createClass$2(r,[{key:"updateLang",value:function(){this.renderItemList()}},{key:"beforeCreate",value:function(e){var t=e.player.config.sources.sourceManager;e.config.list=t.sources}},{key:"afterCreate",value:function(){_get(_getPrototypeOf(r.prototype),"afterCreate",this).call(this),this.config.sourceManager.sources.length<2?this.hide():this.renderItemList()}},{key:"registerIcons",value:function(){return{source:{icon:SourceIcon}}}},{key:"renderItemList",value:function(){var e=this.config.sourceManager,t=e.sources,n=e.source,i=this.player.config.i18nManager,o=_mapInstanceProperty(t).call(t,(function(e){var t;return _objectSpread2$2(_objectSpread2$2({},e),{},{showText:null!==(t=i.normalize(e.text))&&void 0!==t?t:e.name,selected:!1})})),a=_findIndexInstanceProperty(o).call(o,(function(e){return e.name===(null==n?void 0:n.name)}));this.config.list=t,a>-1&&(o[a].selected=!0),_get(_getPrototypeOf(r.prototype),"renderItemList",this).call(this,o,a)}},{key:"onItemClick",value:function(e,t){var n,i=this;_get(_getPrototypeOf(r.prototype),"onItemClick",this).call(this,e,t),null===(n=this.player.config)||void 0===n||n.veplayer.switch({source:t.to.name},{fallbackToFirstDefinition:!0}).catch((function(){i.renderItemList()}))}}],[{key:"pluginName",get:function(){return"sources"}},{key:"defaultConfig",get:function(){return _objectSpread2$2(_objectSpread2$2({},OptionsIcon.defaultConfig),{},{index:4,panel:{title:{jp:"ライン選ぶ",en:"Line Choose","zh-cn":"线路选择","zh-hk":"線路選擇"}},list:[],className:"xgplayer-sources",hidePortrait:!1,isShowIcon:!0})}},{key:"textTips",get:function(){return{jp:"ライン",en:"Line","zh-cn":"线路","zh-hk":"線路"}}}]),r}();function DefinitionIcon(){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 lodash_clonedeep={exports:{}};lodash_clonedeep.exports,function(e,t){var r="__lodash_hash_undefined__",n=9007199254740991,i="[object Arguments]",o="[object Boolean]",a="[object Date]",s="[object Function]",l="[object GeneratorFunction]",c="[object Map]",u="[object Number]",p="[object Object]",f="[object Promise]",d="[object RegExp]",h="[object Set]",y="[object String]",g="[object Symbol]",_="[object WeakMap]",v="[object ArrayBuffer]",m="[object DataView]",$="[object Float32Array]",b="[object Float64Array]",S="[object Int8Array]",E="[object Int16Array]",P="[object Int32Array]",T="[object Uint8Array]",I="[object Uint8ClampedArray]",O="[object Uint16Array]",C="[object Uint32Array]",w=/\w*$/,A=/^\[object .+?Constructor\]$/,R=/^(?:0|[1-9]\d*)$/,k={};k[i]=k["[object Array]"]=k[v]=k[m]=k[o]=k[a]=k[$]=k[b]=k[S]=k[E]=k[P]=k[c]=k[u]=k[p]=k[d]=k[h]=k[y]=k[g]=k[T]=k[I]=k[O]=k[C]=!0,k["[object Error]"]=k[s]=k[_]=!1;var D="object"==_typeof$1(commonjsGlobal$1)&&commonjsGlobal$1&&commonjsGlobal$1.Object===Object&&commonjsGlobal$1,x="object"==("undefined"==typeof self?"undefined":_typeof$1(self))&&self&&self.Object===Object&&self,N=D||x||Function("return this")(),L=t&&!t.nodeType&&t,M=L&&e&&!e.nodeType&&e,F=M&&M.exports===L;function j(e,t){return e.set(t[0],t[1]),e}function U(e,t){return e.add(t),e}function B(e,t,r,n){var i=-1,o=e?e.length:0;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function G(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function H(e,t){return function(r){return e(t(r))}}function K(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var z,W=Array.prototype,Y=Function.prototype,q=Object.prototype,X=N["__core-js_shared__"],J=(z=/[^.]+$/.exec(X&&_keysInstanceProperty(X)&&_keysInstanceProperty(X).IE_PROTO||""))?"Symbol(src)_1."+z:"",Z=Y.toString,Q=q.hasOwnProperty,ee=q.toString,te=RegExp("^"+Z.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=F?N.Buffer:void 0,ne=N.Symbol,ie=N.Uint8Array,oe=H(_Object$getPrototypeOf,Object),ae=Object.create,se=q.propertyIsEnumerable,le=_spliceInstanceProperty(W),ce=_Object$getOwnPropertySymbols,ue=re?re.isBuffer:void 0,pe=H(_Object$keys,Object),fe=Me(N,"DataView"),de=Me(N,"Map"),he=Me(N,"Promise"),ye=Me(N,"Set"),ge=Me(N,"WeakMap"),_e=Me(Object,"create"),ve=Ve(fe),me=Ve(de),$e=Ve(he),be=Ve(ye),Se=Ve(ge),Ee=ne?ne.prototype:void 0,Pe=Ee?Ee.valueOf:void 0;function Te(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ie(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Oe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ce(e){this.__data__=new Ie(e)}function we(e,t){var r=He(e)||function(e){return function(e){return function(e){return!!e&&"object"==_typeof$1(e)}(e)&&Ke(e)}(e)&&Q.call(e,"callee")&&(!se.call(e,"callee")||ee.call(e)==i)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,o=!!n;for(var a in e)!t&&!Q.call(e,a)||o&&("length"==a||Ue(a,n))||r.push(a);return r}function Ae(e,t,r){var n=e[t];Q.call(e,t)&&Ge(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function Re(e,t){for(var r=e.length;r--;)if(Ge(e[r][0],t))return r;return-1}function ke(e,t,r,n,f,_,A){var R;if(n&&(R=_?n(e,f,_,A):n(e)),void 0!==R)return R;if(!Ye(e))return e;var D=He(e);if(D){if(R=function(e){var t=e.length,r=e.constructor(t);t&&"string"==typeof e[0]&&Q.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!t)return function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r<n;)t[r]=e[r];return t}(e,R)}else{var x=je(e),N=x==s||x==l;if(ze(e))return function(e,t){if(t)return _sliceInstanceProperty(e).call(e);var r=new e.constructor(e.length);return e.copy(r),r}(e,t);if(x==p||x==i||N&&!_){if(V(e))return _?e:{};if(R=function(e){return"function"!=typeof e.constructor||Be(e)?{}:function(e){return Ye(e)?ae(e):{}}(oe(e))}(N?{}:e),!t)return function(e,t){return Ne(e,Fe(e),t)}(e,function(e,t){return e&&Ne(t,qe(t),e)}(R,e))}else{if(!k[x])return _?e:{};R=function(e,t,r,n){var i=e.constructor;switch(t){case v:return xe(e);case o:case a:return new i(+e);case m:return function(e,t){var r=t?xe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,n);case $:case b:case S:case E:case P:case T:case I:case O:case C:return function(e,t){var r=t?xe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,n);case c:return function(e,t,r){var n=t?r(G(e),!0):G(e);return B(n,j,new e.constructor)}(e,n,r);case u:case y:return new i(e);case d:return function(e){var t=new e.constructor(e.source,w.exec(e));return t.lastIndex=e.lastIndex,t}(e);case h:return function(e,t,r){var n=t?r(K(e),!0):K(e);return B(n,U,new e.constructor)}(e,n,r);case g:return s=e,Pe?Object(Pe.call(s)):{}}var s}(e,x,ke,t)}}A||(A=new Ce);var L=A.get(e);if(L)return L;if(A.set(e,R),!D)var M=r?function(e){return function(e,t,r){var n=t(e);return He(e)?n:function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}(n,r(e))}(e,qe,Fe)}(e):qe(e);return function(e,t){for(var r=-1,n=e?e.length:0;++r<n&&!1!==t(e[r],r,e););}(M||e,(function(i,o){M&&(i=e[o=i]),Ae(R,o,ke(i,t,r,n,o,e,A))})),R}function De(e){return!(!Ye(e)||(t=e,J&&J in t))&&(We(e)||V(e)?te:A).test(Ve(e));var t}function xe(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Ne(e,t,r,n){r||(r={});for(var i=-1,o=t.length;++i<o;){var a=t[i],s=n?n(r[a],e[a],a,r,e):void 0;Ae(r,a,void 0===s?e[a]:s)}return r}function Le(e,t){var r,n,i=e.__data__;return("string"==(n=_typeof$1(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:_mapInstanceProperty(i)}function Me(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return De(r)?r:void 0}Te.prototype.clear=function(){this.__data__=_e?_e(null):{}},Te.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Te.prototype.get=function(e){var t=this.__data__;if(_e){var n=t[e];return n===r?void 0:n}return Q.call(t,e)?t[e]:void 0},Te.prototype.has=function(e){var t=this.__data__;return _e?void 0!==t[e]:Q.call(t,e)},Te.prototype.set=function(e,t){return this.__data__[e]=_e&&void 0===t?r:t,this},Ie.prototype.clear=function(){this.__data__=[]},Ie.prototype.delete=function(e){var t=this.__data__,r=Re(t,e);return!(r<0)&&(r==t.length-1?t.pop():le.call(t,r,1),!0)},Ie.prototype.get=function(e){var t=this.__data__,r=Re(t,e);return r<0?void 0:t[r][1]},Ie.prototype.has=function(e){return Re(this.__data__,e)>-1},Ie.prototype.set=function(e,t){var r=this.__data__,n=Re(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Oe.prototype.clear=function(){this.__data__={hash:new Te,map:new(de||Ie),string:new Te}},Oe.prototype.delete=function(e){return Le(this,e).delete(e)},Oe.prototype.get=function(e){return Le(this,e).get(e)},Oe.prototype.has=function(e){return Le(this,e).has(e)},Oe.prototype.set=function(e,t){return Le(this,e).set(e,t),this},Ce.prototype.clear=function(){this.__data__=new Ie},Ce.prototype.delete=function(e){return this.__data__.delete(e)},Ce.prototype.get=function(e){return this.__data__.get(e)},Ce.prototype.has=function(e){return this.__data__.has(e)},Ce.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ie){var n=r.__data__;if(!de||n.length<199)return n.push([e,t]),this;r=this.__data__=new Oe(n)}return r.set(e,t),this};var Fe=ce?H(ce,Object):function(){return[]},je=function(e){return ee.call(e)};function Ue(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||R.test(e))&&e>-1&&e%1==0&&e<t}function Be(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||q)}function Ve(e){if(null!=e){try{return Z.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ge(e,t){return e===t||e!=e&&t!=t}(fe&&je(new fe(new ArrayBuffer(1)))!=m||de&&je(new de)!=c||he&&je(he.resolve())!=f||ye&&je(new ye)!=h||ge&&je(new ge)!=_)&&(je=function(e){var t=ee.call(e),r=t==p?e.constructor:void 0,n=r?Ve(r):void 0;if(n)switch(n){case ve:return m;case me:return c;case $e:return f;case be:return h;case Se:return _}return t});var He=Array.isArray;function Ke(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}(e.length)&&!We(e)}var ze=ue||function(){return!1};function We(e){var t=Ye(e)?ee.call(e):"";return t==s||t==l}function Ye(e){var t=_typeof$1(e);return!!e&&("object"==t||"function"==t)}function qe(e){return Ke(e)?we(e):function(e){if(!Be(e))return pe(e);var t=[];for(var r in Object(e))Q.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function(e){return ke(e,!0,!0)}}(lodash_clonedeep,lodash_clonedeep.exports);var lodash_clonedeepExports=lodash_clonedeep.exports,clonedeep=getDefaultExportFromCjs(lodash_clonedeepExports),DefinitionPlugin=function(e){_inherits(n,OptionsIcon);var t,r=_createSuper(n);function n(){var e,t;_classCallCheck$1(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$2(_assertThisInitialized(t=r.call.apply(r,_concatInstanceProperty(e=[this]).call(e,o))),"_waitingStartTime",0),_defineProperty$2(_assertThisInitialized(t),"_timer",void 0),_defineProperty$2(_assertThisInitialized(t),"_toastId",void 0),t}return _createClass$2(n,[{key:"updateLang",value:function(){this.renderItemList()}},{key:"beforeCreate",value:function(e){var t,r=e.player.config.sources.sourceManager;e.config.list=null===(t=r.source)||void 0===t?void 0:t.definitions}},{key:"afterCreate",value:function(){var e,t;_get(_getPrototypeOf(n.prototype),"afterCreate",this).call(this),(null!==(e=null===(t=this.player.config.sourceManager.source)||void 0===t?void 0:t.definitions)&&void 0!==e?e:[]).length<2?this.hide():(this.renderItemList(),this.on(Events$1.WAITING,this._waiting.bind(this)),this.on(Events$1.PLAYING,this._clearTimer.bind(this)),this.on(Events$1.PAUSE,this._clearTimer.bind(this)),this.on(Events$1.PLAY,this._clearTimer.bind(this)),this._initTimeUpdateEvent())}},{key:"registerIcons",value:function(){return{source:{icon:DefinitionIcon}}}},{key:"renderItemList",value:function(){var e,t,r,i=this,o=this.player.config.sourceManager,a=null!==(e=null===(t=o.source)||void 0===t?void 0:t.definitions)&&void 0!==e?e:[],s=_mapInstanceProperty(a).call(a,(function(e){var t;return{url:e.url,definition:e.definition||"",showText:null!==(t=i.player.config.i18nManager.normalize(e.text))&&void 0!==t?t:e.definition,selected:!1}})),l=_findIndexInstanceProperty(a).call(a,(function(e){var t;return e.definition===(null===(t=o.definition)||void 0===t?void 0:t.definition)}));this.config.list=null===(r=o.source)||void 0===r?void 0:r.definitions,l>-1&&(s[l].selected=!0),_get(_getPrototypeOf(n.prototype),"renderItemList",this).call(this,s,l)}},{key:"onItemClick",value:function(e,t){var r,i=this;this._showToast(t.to),_get(_getPrototypeOf(n.prototype),"onItemClick",this).call(this,e,t),null===(r=this.player.config)||void 0===r||r.veplayer.switch({definition:t.to.definition}).catch((function(){i.renderItemList()}))}},{key:"fallback",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r,n,i,o,a,s,l=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=l.length>0&&void 0!==l[0]?l[0]:{toast:!0},i=this.player.config.sourceManager,!((o=_findIndexInstanceProperty(t=this.config.demotePriority).call(t,(function(e){var t;return e===(null===(t=i.definition)||void 0===t?void 0:t.definition)})))<0)){e.next=5;break}return e.abrupt("return");case 5:if(a=clonedeep(i.definition),s=this._getNextDefinition(o)){e.next=9;break}return e.abrupt("return");case 9:if(!n.toast){e.next=15;break}return e.next=12,this._toast(s);case 12:if(e.sent){e.next=15;break}return e.abrupt("return");case 15:this.player.emit(Events$1.DEFINITION_FALLBACK,{from:a,to:s}),null===(r=this.player.config)||void 0===r||r.veplayer.switch({definition:s.definition}).catch((function(){}));case 17:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_waiting",value:function(){var e=this;if(!this._timer){this._waitingStartTime=Date.now();var t=this.player.currentTime;this._timer=window.setTimeout((function(){e.player&&e.player.currentTime<=t+.1&&(e.player.emit(Events$1.LONG_WAITING),e.config.needFallback&&e.fallback({toast:!0}),e._clearTimer())}),this.config.longWaitingTime)}}},{key:"_clearTimer",value:function(){this._timer&&(clearTimeout(this._timer),this._timer=void 0),this._waitingStartTime&&(this._waitingStartTime=0)}},{key:"_toast",value:function(e){var t=this,r=this.player.config.i18nManager;return new _Promise((function(n){var i,o,a=null===(i=t.player)||void 0===i?void 0:i.getPlugin("toast");if(a){var s=util$1.createDom("div",r.getText("DEFINITION_FALLBACK_TOAST"),void 0,"veplayer-toast-txt"),l=null!==(o=t.player.config.i18nManager.normalize(e.text))&&void 0!==o?o:e.definition,c=util$1.createDom("span",l,void 0,"veplayer-toast-txt-bt");s.appendChild(c);var u=a.toast(s,{duration:5e3,closable:!0});c.addEventListener("click",(function(){a.remove(u),n(!0)}))}else n(!1)}))}},{key:"_getNextDefinition",value:function(e){var t,r=this.player.config.sourceManager;if(null!==(t=r.source)&&void 0!==t&&t.definitions.length&&!(e+1>=this.config.demotePriority.length)){var n=e+1,i=_findInstanceProperty(r).call(r,{definition:this.config.demotePriority[n]});return i||this._getNextDefinition(n)}}},{key:"_initTimeUpdateEvent",value:function(){var e=this,t=this.player.currentTime;this.on(Events$1.TIME_UPDATE,(function(){var r=e.player.currentTime;r!==t?(t=r,e._clearTimer()):t=r}))}},{key:"_showToast",value:function(e){var t,r,n,i=this,o=null===(t=this.player)||void 0===t?void 0:t.getPlugin("toast"),a=this.player.config.i18nManager;o&&(this._toastId&&o.remove(this._toastId),this._toastId=o.toast(_concatInstanceProperty(r="".concat(a.getText("DEFINITION_SWITCHING")," ")).call(r,null!==(n=e.showText)&&void 0!==n?n:e.definition," ..."),{duration:2e3,closable:!0}),this.player.once(Events$1.AFTER_DEFINITION_CHANGE,(function(){void 0!==i._toastId&&o.remove(i._toastId)})))}}],[{key:"pluginName",get:function(){return"definition"}},{key:"defaultConfig",get:function(){return _objectSpread2$2(_objectSpread2$2({},OptionsIcon.defaultConfig),{},{index:3,list:[],panel:{title:{jp:"クラリティセレクション",en:"Definition Choose","zh-cn":"清晰度选择","zh-hk":"清晰度選擇"}},className:"xgplayer-definition",hidePortrait:!1,isShowIcon:!0,longWaitingTime:5e3,needFallback:!1,demotePriority:["uhd","hd","sd","ld","ao"]})}},{key:"textTips",get:function(){return{jp:"明快さ",en:"Definition","zh-cn":"清晰度","zh-hk":"清晰度"}}}]),n}(),NAME_MAP={"biz:vod":"veplayer.biz.vod.[env].[ext]","biz:live":"veplayer.biz.live.[env].[ext]","plugin:flv":"veplayer.plugin.flv.[env].[ext]","plugin:mp4":"veplayer.plugin.mp4.[env].[ext]","plugin:hls":"veplayer.plugin.hls.[env].[ext]","plugin:shaka":"veplayer.plugin.shaka.[env].[ext]","plugin:rtm":"veplayer.plugin.rtm.[env].[ext]","plugin:xgvideo":"veplayer.plugin.xgvideo.[env].[ext]","plugin:drm":"veplayer.plugin.drm.[env].[ext]","plugin:abr":"veplayer.plugin.abr.[env].[ext]"},DynamicModule=function(e){return e.BizVod="biz:vod",e.BizLive="biz:live",e.PluginFlv="plugin:flv",e.PluginMp4="plugin:mp4",e.PluginHls="plugin:hls",e.PluginShaka="plugin:shaka",e.PluginRtm="plugin:rtm",e.PluginXgvideo="plugin:xgvideo",e.PluginDrm="plugin:drm",e.PluginAbr="plugin:abr",e}(DynamicModule||{}),Loader=function(){function e(t){var r=this;_classCallCheck$1(this,e),_defineProperty$2(this,"modules",{}),_defineProperty$2(this,"mountPromiseMap",{}),_defineProperty$2(this,"_baseUrl",void 0),_defineProperty$2(this,"_moduleSystem",void 0),_defineProperty$2(this,"load",function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var i,o,a,s,l;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r._moduleSystem){e.next=2;break}throw new Error('You have to specify moduleSystem first, call "setModuleSystem(moduleSystem)" to set module system');case 2:if(NAME_MAP[t]){e.next=4;break}throw new Error('Invalid module name: "'.concat(t,'"'));case 4:if("esm"!==r._moduleSystem){e.next=11;break}if(r.modules[t]){e.next=9;break}throw new Error('Dynamic module "'.concat(t,'" not found, you have to register it first under ESM'));case 9:return o=r.modules[t].exports,e.abrupt("return",null!==(i=o.default)&&void 0!==i?i:o);case 11:if(!r.modules[t]){e.next=21;break}if(1!==r.modules[t].state){e.next=16;break}return e.abrupt("return",r.modules[t].exports);case 16:if(0!==r.modules[t].state){e.next=20;break}return e.abrupt("return",r.mountPromiseMap[t].then((function(e){var t;return null!==(t=e.default)&&void 0!==t?t:e})));case 20:throw null!==(a=r.modules[t].error)&&void 0!==a?a:new Error('Dynamic module "'.concat(t,'" load failed.'));case 21:return s=[r._baseUrl,NAME_MAP[t]].join("/").replace("[env]","production").replace("[ext]","js"),l={src:null!=n?n:s,name:t,state:0,exports:{__PLUGIN_NAME__:t}},r.modules[t]=l,r.mountPromiseMap[t]=r._mount(l),e.abrupt("return",r.mountPromiseMap[t]);case 26:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),_defineProperty$2(this,"registerPlugin",(function(e,t){if(!r._moduleSystem)throw new Error("You have to specify moduleSystem first, call setModuleSystem(moduleSystem) to set module system");return"esm"===r._moduleSystem?(r.modules[e]={src:"esm:".concat(e),name:e,state:1,exports:t},r.modules[e].exports):(r.modules[e]?r.modules[e].exports=t:r.modules[e]={src:"umd:".concat(e),name:e,state:1,exports:t},r.modules[e].exports)})),_defineProperty$2(this,"register",(function(e){return _mapInstanceProperty(e).call(e,(function(e){return r.registerPlugin(e.__PLUGIN_NAME__,e)}))})),this._baseUrl=t.baseUrl}return _createClass$2(e,[{key:"baseUrl",get:function(){return this._baseUrl}},{key:"moduleSystem",get:function(){return this._moduleSystem}},{key:"setModuleSystem",value:function(e){this._moduleSystem=e}},{key:"setBaseUrl",value:function(e){this._baseUrl=e}},{key:"_mount",value:function(e){var t=this.modules;return new _Promise((function(r,n){var i=document.createElement("script");i.src=e.src,i.onload=function(){e.state=1,r(t[e.name].exports),i.onload=null},i.onerror=function(t){e.state=2,e.error=t,n(t),i.onerror=null},document.body.appendChild(i)}))}}]),e}(),apply=functionApply,toIndexedObject=toIndexedObject$c,toIntegerOrInfinity=toIntegerOrInfinity$6,lengthOfArrayLike=lengthOfArrayLike$d,arrayMethodIsStrict=arrayMethodIsStrict$5,min=Math.min,$lastIndexOf=[].lastIndexOf,NEGATIVE_ZERO=!!$lastIndexOf&&1/[1].lastIndexOf(1,-0)<0,STRICT_METHOD=arrayMethodIsStrict("lastIndexOf"),FORCED=NEGATIVE_ZERO||!STRICT_METHOD,arrayLastIndexOf=FORCED?function(e){if(NEGATIVE_ZERO)return apply($lastIndexOf,this,arguments)||0;var t=toIndexedObject(this),r=lengthOfArrayLike(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,$$7=_export,lastIndexOf$7=arrayLastIndexOf;$$7({target:"Array",proto:!0,forced:arrayLastIndexOf!==[].lastIndexOf},{lastIndexOf:arrayLastIndexOf});var _document$currentScri,_document$currentScri2,entryVirtual$2=entryVirtual$p,lastIndexOf$6=entryVirtual$2("Array").lastIndexOf,isPrototypeOf$4=objectIsPrototypeOf,method$2=lastIndexOf$6,ArrayPrototype$1=Array.prototype,lastIndexOf$5=function(e){var t=e.lastIndexOf;return e===ArrayPrototype$1||isPrototypeOf$4(ArrayPrototype$1,e)&&t===ArrayPrototype$1.lastIndexOf?method$2:t},parent$w=lastIndexOf$5,lastIndexOf$4=parent$w,parent$v=lastIndexOf$4,lastIndexOf$3=parent$v,parent$u=lastIndexOf$3,lastIndexOf$2=parent$u,lastIndexOf$1=lastIndexOf$2,lastIndexOf2=lastIndexOf$1,_lastIndexOfInstanceProperty=getDefaultExportFromCjs(lastIndexOf2),src$1=null!==(_document$currentScri=null===(_document$currentScri2=document.currentScript)||void 0===_document$currentScri2?void 0:_document$currentScri2.src)&&void 0!==_document$currentScri?_document$currentScri:"https://tosv.byted.org/obj/lux/sdk/@byted/veplayer/".concat("2.4.2-rc.4","/object/umd/"),baseUrl=_sliceInstanceProperty(src$1).call(src$1,0,_lastIndexOfInstanceProperty(src$1).call(src$1,"/")),loader=new Loader({baseUrl:baseUrl}),registerPlugin=loader.registerPlugin,register2=loader.register;function setModuleSystem(e){loader.setModuleSystem(e)}function load(e,t){return _load.apply(this,arguments)}function _load(){return(_load=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,loader.load(t,r);case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),create$2(ErrorCode$1.MODULE_LOAD_ERROR,{ext:{name:t,cdn:null===e.t0||void 0===e.t0||null===(n=e.t0.target)||void 0===n?void 0:n.src},error:e.t0});case 9:case"end":return e.stop()}}),e,null,[[0,6]])})))).apply(this,arguments)}var appendSearchParams=function(e,t){var r,n=getUrlObject(e);if(!e||!n)return null!==(r=e)&&void 0!==r?r:"";var i,o=_startsWithInstanceProperty(e).call(e,"//");for(var a in t){var s,l,c=t[a];if(null!=n&&n.searchParams.has(a))null==n||null===(s=n.searchParams)||void 0===s||s.set(a,c);else null==n||null===(l=n.searchParams)||void 0===l||l.append(a,c)}return e=n.toString(),o?null===(i=e)||void 0===i?void 0:i.replace(location.protocol,""):e},getUrlObject=function(e){if(e){_startsWithInstanceProperty(e).call(e,"//")&&(e=location.protocol+e);try{return new _URL(e)}catch(e){return}}};function isType(e){return function(t){var r;return null==t?void 0:_includesInstanceProperty(r=t.split("?")[0].toLowerCase()).call(r,e)}}var isHls=isType(".m3u8"),isMp4=isType(".mp4"),isFlv=isType(".flv"),isRtm=isType(".sdp"),isDash=isType(".mpd");function getStreamType(e){return isHls(e)?"hls":isFlv(e)?"flv":isRtm(e)?"rtm":isMp4(e)?"mp4":isDash(e)?"dash":"unknown"}function isMseSupported(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Codec.H264)===Codec.H265?sniffer$1.isHevcSupported():sniffer$1.isMSESupport()}function isSoftDecodeSupported(){return _isSoftDecodeSupported.apply(this,arguments)}function _isSoftDecodeSupported(){return(_isSoftDecodeSupported=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,load(DynamicModule.PluginXgvideo);case 2:return t=e.sent,r=t.XGVideoPlugin,e.abrupt("return",null==r?void 0:r.isSupported());case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var util=_objectSpread2$2(_objectSpread2$2({},util$1),{},{getStreamType:getStreamType,isMseSupported:isMseSupported,isSoftDecodeSupported:isSoftDecodeSupported,appendSearchParams:appendSearchParams,getUrlObject:getUrlObject}),autoplay="",isWeixin=sniffer$1.isWeixin,os=sniffer$1.os,device=sniffer$1.device,isAndroid$1=os.isAndroid,isIos=os.isIos,isMobile="mobile"===device,last=0,USER_AUTOPLAY_TRIGGERED=!1,Autoplay=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(e){var n;return _classCallCheck$1(this,r),_defineProperty$2(_assertThisInitialized(n=t.call(this,e)),"_hasSetUserAutoplay",void 0),_defineProperty$2(_assertThisInitialized(n),"_timer",void 0),_defineProperty$2(_assertThisInitialized(n),"_wxTimer",void 0),_defineProperty$2(_assertThisInitialized(n),"_state",{mode:0,showUnmuteBt:!1}),_defineProperty$2(_assertThisInitialized(n),"userClickPlay",(function(){if(!USER_AUTOPLAY_TRIGGERED){var e=n.player.play();e&&e.then?e.then((function(){console.log("user action autoplay success"),USER_AUTOPLAY_TRIGGERED=!0})).catch((function(e){console.warn("user action autoplay fail:",e)})):(console.warn("no play promise"),USER_AUTOPLAY_TRIGGERED=!0)}})),n}return _createClass$2(r,[{key:"afterCreate",value:function(){this.initState(),this.initEvents(),this.setWXAutoPlay()}},{key:"updateLang",value:function(){this.renderUnmuteBt()}},{key:"initState",value:function(){this._state.mode=this.player.muted?1:0}},{key:"initEvents",value:function(){this.player.on(AUTOPLAY_PREVENTED,this.handleAutoplayPrevented.bind(this)),this.player.on(AUTOPLAY_STARTED,this.handleAutoplayStart.bind(this)),this.player.on(VOLUME_CHANGE,this.handleVolumechange.bind(this)),this.setUserActionAutoPlay()}},{key:"setWXAutoPlay",value:function(){isWeixin&&this.player.config.autoplay&&this.config.enableWxJsBridgeAutoplay&&(window.WeixinJSBridge?this.wxPlay():document.addEventListener("WeixinJSBridgeReady",this.wxPlay.bind(this),!1))}},{key:"wxCanPlayFn",value:function(){var e=this;window.WeixinJSBridge&&window.WeixinJSBridge.invoke("getNetworkType",{},(function(){e._wxTimer=window.setTimeout((function(){e._wxTimer&&clearTimeout(e._wxTimer);var t=e.player.play();t&&t.then?t.then((function(){console.log("wechat autoplay success")})).catch((function(t){console.warn("wechat autoplay fail:",t),e._state.showUnmuteBt=!1,e.renderUnmuteBt()})):console.warn("wechat browser no play promise")}))}))}},{key:"wxPlay",value:function(){this.player.readyState>=2?this.wxCanPlayFn():isAndroid$1?this.player.once(CANPLAY,this.wxCanPlayFn.bind(this)):isIos&&this.player.once(COMPLETE,this.wxCanPlayFn.bind(this))}},{key:"setUserActionAutoPlay",value:function(){var e=this;this.config.enableUserActionAutoplay&&this.player.once(BaseEvents.AUTOPLAY_FAIL,(function(){e._hasSetUserAutoplay=!0,(e.config.userActionDom instanceof window.Node?e.config.userActionDom:window.document.body).addEventListener("click",e.userClickPlay,!1)}))}},{key:"handleAutoplayPrevented",value:function(){return 0===this._state.mode?(console.warn("unmute autoplay fail"),this.player.emit(BaseEvents.AUTOPLAY_FAIL,{mode:"unmute"}),isAndroid$1&&isWeixin?void(this._state.mode=2):void(this.config.enableDegradeMuteAutoplay&&this.changeMuteMode())):1===this._state.mode?(console.warn("mute autoplay fail"),this.player.emit(BaseEvents.AUTOPLAY_FAIL,{mode:"mute"}),void(this._state.mode=2)):2===this._state.mode?(this.player.emit(BaseEvents.AUTOPLAY_FAIL,{mode:"noSupport"}),void console.warn("not support autoplay")):void 0}},{key:"changeMuteMode",value:function(){var e=this;this.player.muted=!0,this._state.showUnmuteBt=!0,this._state.mode=1,this.renderUnmuteBt(),this._timer=window.setTimeout((function(){e._timer&&window.clearTimeout(e._timer);var t=e.player.play();t&&t.then?t.then((function(){console.log("degrade mute autoplay success")})).catch((function(t){console.warn("degrade mute autoplay fail:",t),e.player.muted=!1,e._state.showUnmuteBt=!1,e.renderUnmuteBt()})):console.warn("no play promise")}))}},{key:"handleAutoplayStart",value:function(){if(0!==this._state.mode)return 1===this._state.mode?(this.player.emit(BaseEvents.AUTOPLAY_SUCCESS,{mode:"mute"}),this._state.showUnmuteBt=!0,void this.renderUnmuteBt()):2===this._state.mode?(this.player.emit(BaseEvents.AUTOPLAY_SUCCESS,{mode:"click"}),this.player.muted=!1,this._state.showUnmuteBt=!1,void this.renderUnmuteBt()):void 0;this.player.emit(BaseEvents.AUTOPLAY_SUCCESS,{mode:"unmute"})}},{key:"handleVolumechange",value:function(){this._state.showUnmuteBt&&(this._state.showUnmuteBt=!1,this.renderUnmuteBt(),this.player.paused&&this.player.readyState>=1&&this.player.play())}},{key:"renderUnmuteBt",value:function(){var e=this.root,t=this.player.config.i18nManager;if(e&&(e.innerHTML="",this._state.showUnmuteBt)){var r=t.getText("UNMUTE"),n=util$1.createDom("div",r,void 0,"veplayer-unmute-bt");e.appendChild(n),this.bind(".veplayer-unmute-bt","click",this.cancelUnmute.bind(this)),this.bind(".veplayer-unmute-bt","touchend",this.cancelUnmute.bind(this))}}},{key:"cancelUnmute",value:function(){var e=Date.now();if(e-last>200){last=e,this.player.muted=!1,this._state.showUnmuteBt=!1,this.renderUnmuteBt(),this.emit(BaseEvents.AUTOPLAY_UNMUTE);var t="mobile"===sniffer$1.device,r=isRtm(this.player.config.url);t&&r&&(this.player.volume>.5?this.player.volume=this.player.volume-.1:this.player.volume=this.player.volume+.1)}}},{key:"destroy",value:function(){if(this.player.off(AUTOPLAY_PREVENTED,this.handleAutoplayPrevented.bind(this)),this.player.off(AUTOPLAY_STARTED,this.handleAutoplayStart.bind(this)),this.player.off(VOLUME_CHANGE,this.handleVolumechange.bind(this)),this._timer&&window.clearTimeout(this._timer),this._wxTimer&&window.clearTimeout(this._wxTimer),document.removeEventListener("WeixinJSBridgeReady",this.wxPlay.bind(this),!1),this._hasSetUserAutoplay){var e=isMobile?"touch":"click";(this.config.userActionDom instanceof window.Node?this.config.userActionDom:window.document.body).removeEventListener(e,this.userClickPlay,!1)}}},{key:"render",value:function(){return'<div class="veplayer-unmute"></div>'}}],[{key:"pluginName",get:function(){return"autoplayPlugin"}},{key:"defaultConfig",get:function(){return{position:Plugin.POSITIONS.ROOT,enableDegradeMuteAutoplay:!1,enableWxJsBridgeAutoplay:!1,userActionDom:window.document.body,enableUserActionAutoplay:!1}}}]),r}(),$$6=_export,$values=objectToArray.values;$$6({target:"Object",stat:!0},{values:function(e){return $values(e)}});var path$5=path$x,values$5=path$5.Object.values,parent$t=values$5,values$4=parent$t,parent$s=values$4,values$3=parent$s,parent$r=values$3,values$2=parent$r,values$1=values$2,values3=values$1,_Object$values=getDefaultExportFromCjs(values3),topRightBar="";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 _context$2,_context2,More=function(e){_inherits(r,OptionsIcon);var t=_createSuper(r);function r(){return _classCallCheck$1(this,r),t.apply(this,arguments)}return _createClass$2(r,[{key:"onItemClick",value:function(){}},{key:"onOptionClick",value:function(){this.toggle(!1)}},{key:"updateLang",value:function(){var e,t=this,r=this.player.config.i18nManager;null===(e=this.config.plugins)||void 0===e||e.forEach((function(e){var n,i=null!==(n=r.normalize(e.textTips))&&void 0!==n?n:e.pluginName;if(t.player.root){var o=util$1.findDom(t.player.root,".panel-plugin-".concat(e.pluginName," .panel-icon-bt-text"));o&&(o.innerHTML=i)}}))}},{key:"beforeCreate",value:function(e){var t,r=e.player.config.i18nManager;e.config.list=null===(t=e.config.plugins)||void 0===t?void 0:_mapInstanceProperty(t).call(t,(function(t,n){var i,o=util$1.createDom("div","",{},"panel-icon-bt panel-plugin-".concat(t.pluginName)),a=util$1.createDom("div","",{},"panel-icon-svg"),s=null!==(i=r.normalize(t.textTips))&&void 0!==i?i:t.pluginName;return o.appendChild(a),o.appendChild(util$1.createDom("span",s,{"plugin-index":n},"panel-icon-bt-text")),{showText:o,plugin:e.player.registerPlugin({plugin:t,options:{root:a}})}}))}},{key:"hideChild",value:function(e){if(e){var t;null===(t=e.hide)||void 0===t||t.call(e);var r=document.querySelector(".panel-plugin-".concat(e.pluginName));r&&util$1.addClass(r,"hide")}}},{key:"showChild",value:function(e){if(e){var t;null===(t=e.show)||void 0===t||t.call(e);var r=document.querySelector(".panel-plugin-".concat(e.pluginName));r&&util$1.removeClass(r,"hide")}}},{key:"registerIcons",value:function(){return{more:{icon:MoreIconSVG}}}}],[{key:"pluginName",get:function(){return"more"}},{key:"defaultConfig",get:function(){return _objectSpread2$2(_objectSpread2$2({},OptionsIcon.defaultConfig),{},{index:1,plugins:[],list:[],hideOnSingleOption:!1,isShowIcon:!0,hidePortrait:!1,renderType:RenderType.Icon,panel:{className:"more-panel-content"}})}}]),r}(),TOP_RIGHT_POSITIONS=function(e){return e.ROOT_TOP_RIGHT="rootTopRight",e.ROOT_TOP_RIGHT_COLLAPSE="rootTopRightCollapse",e}(TOP_RIGHT_POSITIONS||{}),TopRightBar=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(){return _classCallCheck$1(this,r),t.apply(this,arguments)}return _createClass$2(r,[{key:"registerIcons",value:function(){return{more:{icon:MoreIconSVG,class:"xgplayer-more-svg"}}}},{key:"children",value:function(){var e=this,t=this._getPlugins(),r=t.plugins,n=t.collapsePlugins,i={};return r.forEach((function(t){i[t.pluginName]={plugin:t,options:{root:e.root}}})),n.length&&(i[More.pluginName]={plugin:More,options:{root:this.root,plugins:n}}),i}},{key:"render",value:function(){return'<xg-right-grid class="xg-right-grid xgplayer-rightTop-iconList"></xg-right-grid>'}},{key:"_getPlugins",value:function(){var e,t=this,r=[],n=[],i=null===(e=this.player.config.ignores)||void 0===e?void 0:_mapInstanceProperty(e).call(e,(function(e){return e.toLowerCase()}));return this.config.plugins.forEach((function(e){var o,a=e.pluginName.toLowerCase();null!=i&&_includesInstanceProperty(i).call(i,a)||("rootTopRight"===(null!==(o=t.player.config[a].position)&&void 0!==o?o:e.defaultConfig.position)?r.push(e):n.push(e))})),{plugins:null!=r?r:[],collapsePlugins:null!=n?n:[]}}}],[{key:"pluginName",get:function(){return"topRightBar"}},{key:"defaultConfig",get:function(){return{position:Plugin.POSITIONS.ROOT_TOP,plugins:[]}}},{key:"isTopRightPlugin",value:function(e,t){var r,n,i,o,a,s=null!==(n=null===(i=t[null==e||null===(r=e.pluginName)||void 0===r?void 0:r.toLowerCase()])||void 0===i?void 0:i.position)&&void 0!==n?n:null==e||null===(o=e.defaultConfig)||void 0===o?void 0:o.position;return!!_includesInstanceProperty(a=_Object$values(TOP_RIGHT_POSITIONS)).call(a,s)}}]),r}(),BASE_PLUGINS=[Play$1,Fullscreen,Volume,MiniScreen,PIP,Poster,Start,Loading,Enter,Error$1,Toast,Sources,DefinitionPlugin,Autoplay],DEFAULT_PC_PLUGINS=_concatInstanceProperty(_context$2=[]).call(_context$2,BASE_PLUGINS,[Keyboard,PCPlugin,TopRightBar]),DEFAULT_MOBILE_PLUGINS=_concatInstanceProperty(_context2=[]).call(_context2,BASE_PLUGINS,[MobilePlugin,TopRightBar]),DEFAULT_PLUGINS="pc"===sniffer$1.device?DEFAULT_PC_PLUGINS:DEFAULT_MOBILE_PLUGINS;function FullscreenActive(){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 FullscreenActiveMobile(){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 FullscreenDefault(){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 FullscreenDefaultMobile(){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 Pause(){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 Play(){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 Replay(){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 StartPlay(){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 VolumeLarge(){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 VolumeMuted(){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 VolumeSmall(){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 DEFAULT_BASE_ICONS={startPlay:StartPlay,play:Play,pause:Pause,fullscreen:FullscreenDefault,exitFullscreen:FullscreenActive,replay:Replay,volumeLarge:VolumeLarge,volumeMuted:VolumeMuted,volumeSmall:VolumeSmall},DEFAULT_PC_ICONS=_objectSpread2$2(_objectSpread2$2({},DEFAULT_BASE_ICONS),{},{fullscreen:FullscreenDefault,exitFullscreen:FullscreenActive}),DEFAULT_MOBILE_ICONS=_objectSpread2$2(_objectSpread2$2({},DEFAULT_BASE_ICONS),{},{fullscreen:FullscreenDefaultMobile,exitFullscreen:FullscreenActiveMobile}),DEFAULT_ICONS="pc"===sniffer$1.device?DEFAULT_PC_ICONS:DEFAULT_MOBILE_ICONS,EN$1=_objectSpread2$2(_objectSpread2$2({},EN$2.TEXT),{},{DEFINITION_FALLBACK_TOAST:"The current network is unstable, it is recommended to switch to ",DEFINITION_SWITCHING:"Switching to",ERROR_REFRESH:"Refresh",UNMUTE:"Click to unmute",MANIFEST:"Video parsing error",NETWORK:"Network error",NETWORK_TIMEOUT:"Network timeout",NETWORK_FORBIDDEN:"Authentication error",NETWORK_NOTFOUND:"Stream does not exist",DEMUX:"Video parsing error",REMUX:"Video parsing error",MEDIA:"An error occurred, Please try again",MEDIA_ERR_CODEC_NOT_SUPPORTED:"Audio/video codec is not supported",MEDIA_ERR_URL_EMPTY:"The stream address is not specified",DRM:"Permission verification failed",DRM_LICENSE:"Commercial DRM Permission verification failed",OTHER:"Unknown error",RUNTIME:"An error occurred, Please try again",MODULE_LOAD_ERROR:"CDN fetch error",UNKNOWN:"Unknown error"}),ZH_CN$1=_objectSpread2$2(_objectSpread2$2({},ZH.TEXT),{},{DEFINITION_FALLBACK_TOAST:"当前网络不稳定,建议切换到",DEFINITION_SWITCHING:"正在切换至",ERROR_REFRESH:"刷新",UNMUTE:"点击取消静音",MANIFEST:"视频解析错误",NETWORK:"网络错误",NETWORK_TIMEOUT:"网络超时",NETWORK_FORBIDDEN:"鉴权异常",NETWORK_NOTFOUND:"播放地址不存在",DEMUX:"视频解析错误",REMUX:"视频解析错误",MEDIA:"播放异常,请重试",MEDIA_ERR_CODEC_NOT_SUPPORTED:"不支持的音频/视频格式",MEDIA_ERR_URL_EMPTY:"当前播放地址为空",DRM:"权限验证失败",DRM_LICENSE:"商业 DRM LICENSE 鉴权失败",OTHER:"其他报错",RUNTIME:"播放异常,请重试",MODULE_LOAD_ERROR:"插件模块加载异常",UNKNOWN:"未知报错"}),VeI18n=function(){function e(t){var r;if(_classCallCheck$1(this,e),_defineProperty$2(this,"_lang",void 0),this._lang=(null==t?void 0:t.lang)||getLang()||"en","zh"===this._lang&&(this._lang="zh-cn"),null!=t&&null!==(r=t.i18n)&&void 0!==r&&r.texts){var n,i,o=_mapInstanceProperty(n=_Object$entries(null==t||null===(i=t.i18n)||void 0===i?void 0:i.texts)).call(n,(function(e){var t=_slicedToArray(e,2);return{LANG:t[0],TEXT:t[1]}}));e.extend(o)}}return _createClass$2(e,[{key:"setLang",value:function(e){this._lang=e}},{key:"getLang",value:function(){return this._lang}},{key:"normalize",value:function(e){return e?"string"==typeof e?e:e[this._lang]:""}},{key:"getText",value:function(e){var t,r,n;if(e){var i=null==I18N?void 0:I18N.lang;return null!==(t=null==i||null===(r=i[this._lang])||void 0===r?void 0:r[e])&&void 0!==t?t:null==i||null===(n=i.en)||void 0===n?void 0:n[e]}}}],[{key:"langKeys",get:function(){return I18N.langKeys}},{key:"isLangValid",value:function(e){var t;return _includesInstanceProperty(t=I18N.langKeys).call(t,e)||"zh"===e}},{key:"extend",value:function(e,t){I18N.extend(e,t)}}]),e}(),veplayerBase="",_excluded$2=["autoplay"],XGPosition=Plugin.POSITIONS,POSITIONS$1=_objectSpread2$2(_objectSpread2$2({},XGPosition),TOP_RIGHT_POSITIONS),DEFAULT_OPTIONS={id:"veplayer",width:"100%",height:"100%",decodeType:DecodeType.Hardware,fullscreen:{useCssFullscreen:!1}},transformOption=function(e){var t,r=e.autoplay,n=_objectWithoutProperties(e,_excluded$2);(n.poster&&(n.poster=escapeHtml(n.poster)),n.icons=_objectSpread2$2(_objectSpread2$2({},DEFAULT_ICONS),n.icons?escapeIcons(n.icons):{}),n.autoplay=Boolean(r),r&&"boolean"!=typeof r)&&(n.autoplayMuted=null==r?void 0:r.muted,n.videoAttributes=_objectSpread2$2(_objectSpread2$2({},null!==(t=n.videoAttributes)&&void 0!==t?t:{}),{},{muted:null==r?void 0:r.muted}),n.autoplayPlugin=r);return delete n.i18n,n},VePlayerBase=function(){function e(){var t,r,n,i,o,a,s,l,c,u,p,f,d=this,h=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck$1(this,e),_defineProperty$2(this,"_player",void 0),_defineProperty$2(this,"_sourceManager",void 0),_defineProperty$2(this,"_preparePlugins",void 0),_defineProperty$2(this,"_previousPrepareResult",void 0),_defineProperty$2(this,"_i18nManager",void 0),_defineProperty$2(this,"_events",{}),_defineProperty$2(this,"_errorCallback",void 0),this._sourceManager=h.sourceManager,this._preparePlugins=h.preparePlugins,this._previousPrepareResult=h.prepareResult,this._i18nManager=null!==(t=h.i18nManager)&&void 0!==t?t:new VeI18n({i18n:h.i18n});var y=transformOption(_objectSpread2$2(_objectSpread2$2({},h),null===(r=this._previousPrepareResult)||void 0===r?void 0:r.options)),g=_concatInstanceProperty(n=[]).call(n,_toConsumableArray$1(null!==(i=null===(o=this._previousPrepareResult)||void 0===o?void 0:o.plugins)&&void 0!==i?i:[]),_toConsumableArray$1(null!==(a=h.plugins)&&void 0!==a?a:DEFAULT_PLUGINS)),_=[],v=[];g.forEach((function(e){TopRightBar.isTopRightPlugin(e,h)?_.push(e):v.push(e)})),this._player=new Player(_objectSpread2$2(_objectSpread2$2(_objectSpread2$2({},DEFAULT_OPTIONS),y),{},{definition:_objectSpread2$2({list:null!==(s=null===(l=this._sourceManager.source)||void 0===l?void 0:l.definitions)&&void 0!==s?s:[],defaultDefinition:null===(c=this._sourceManager.definition)||void 0===c?void 0:c.definition},null!==(u=h.definition)&&void 0!==u?u:{}),url:null===(p=this._sourceManager.definition)||void 0===p?void 0:p.url,sources:_objectSpread2$2(_objectSpread2$2({},null!==(f=h.sources)&&void 0!==f?f:{}),{},{sourceManager:this._sourceManager}),topRightBar:{plugins:_},plugins:v,i18nManager:this._i18nManager,veplayer:this})),this.emit(Events$1.PLAYER_CREATE_FINISH,this._player),this._errorCallback=function(e){return d._handleFallback(e)},this._player.on(ERROR$2,this._errorCallback)}var t,r,n,i,o,a;return _createClass$2(e,[{key:"readyState",get:function(){return this._player.readyState}},{key:"buffered",get:function(){return this._player.buffered}},{key:"played",get:function(){return this._player.played}},{key:"cumulateTime",get:function(){return this._player.cumulateTime}},{key:"isFocused",get:function(){return this._player.isActive}},{key:"isFullscreen",get:function(){return this._player.isFullscreen}},{key:"isCssFullscreen",get:function(){return this._player.isCssfullScreen}},{key:"networkState",get:function(){return this._player.networkState}},{key:"paused",get:function(){return this._player.paused}},{key:"ended",get:function(){return this._player.ended}},{key:"state",get:function(){return this._player.state}},{key:"url",get:function(){return this._player.config.url}},{key:"source",get:function(){var e;return null===(e=this._sourceManager.source)||void 0===e?void 0:e.name}},{key:"playerVersion",get:function(){return"2.4.2-rc.4"}},{key:"definition",get:function(){var e;return null===(e=this._sourceManager.definition)||void 0===e?void 0:e.definition}},{key:"crossOrigin",get:function(){return this._player.crossOrigin},set:function(e){this._player.crossOrigin=e}},{key:"volume",get:function(){return this._player.volume},set:function(e){this._player.volume=e}},{key:"muted",get:function(){return this._player.muted},set:function(e){this._player.muted=e}},{key:"lang",get:function(){return this._i18nManager.getLang()},set:function(e){if(this._player.lang!==e)if(VeI18n.isLangValid(e))this._i18nManager.setLang(e),this._player.lang=e;else{var t,r,n,i,o=VeI18n.langKeys.join(","),a={en:_concatInstanceProperty(t="Sorry, we couldn't set the language to ".concat(e," because it's not currently supported. The list of supported languages includes ")).call(t,o,"."),"zh-cn":_concatInstanceProperty(r="不支持当前设置的语言".concat(e,", 支持的语言有")).call(r,o,", 请重新设置")};console.error((null===(n=this._i18nManager)||void 0===n||null===(i=n.normalize)||void 0===i?void 0:i.call(n,a))||a.en)}}},{key:"_src",get:function(){return this._player.currentSrc}},{key:"switch",value:(a=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i,o,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t||1!==this._sourceManager.sources.length||1!==(null===(n=this._sourceManager.sources)||void 0===n||null===(n=n[0].definitions)||void 0===n?void 0:n.length)){e.next=5;break}return this._sourceManager.updateSources(t),e.next=4,this._switchUrl(t,{seamless:null==r?void 0:r.seamless});case 4:return e.abrupt("return",this._sourceManager.definition);case 5:if(o=_findInstanceProperty(i=this._sourceManager).call(i,t,r)){e.next=8;break}throw new Error("string"==typeof t?"No definition found for url: ".concat(t):_concatInstanceProperty(a="No definition found for source: ".concat(t.source,", definition: ")).call(a,t.definition));case 8:return e.next=10,this._switch(o);case 10:return e.abrupt("return",o);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"updatePlaylist",value:function(e,t){var r=this._sourceManager.updateSources(e,t);return this._switch(r.definition)}},{key:"once",value:function(e,t){var r,n=this._transformEvent(e,t),i=n.xgCallback,o=n.xgEventName;i&&(null!==(r=this._events)&&void 0!==r&&r[e]||(this._events[e]=new _Map),this._events[e].set(t,i),this._player.once(o,i))}},{key:"off",value:function(e,t){var r,n=null===(r=this._events[e])||void 0===r?void 0:r.get(t),i=this._transformEvent(e).xgEventName;n&&(this._player.off(i,n),this._events[e].delete(t))}},{key:"emit",value:function(e,t){var r=this._transformEvent(e).xgEventName;this._player.emit(r,t)}},{key:"offAll",value:function(){this._events={},this._player.offAll()}},{key:"on",value:function(e,t){var r,n=this._transformEvent(e,t),i=n.xgCallback,o=n.xgEventName;i&&(null!==(r=this._events)&&void 0!==r&&r[e]||(this._events[e]=new _Map),this._events[e].set(t,i),this._player.on(o,i))}},{key:"play",value:function(){
2
+ /* istanbul ignore next -- @preserve */return e&&(this._currentUrlRef=e),this._currentUrlRef}}]),e}(),Source=function(){function e(t,r,n){var i=this;_classCallCheck$1(this,e),_defineProperty$2(this,"name",void 0),_defineProperty$2(this,"text",void 0),_defineProperty$2(this,"definitions",void 0),this.definitions=_mapInstanceProperty(t).call(t,(function(e){return new Definition(_Object$assign({},e,{source:i}))})),this.name=r,this.text=n}return _createClass$2(e,[{key:"defaultDefinition",get:function(){return this.definitions[0]}},{key:"add",value:function(e){this.definitions.push(e)}}],[{key:"normalize",value:function(t){if(void 0===t)throw new Error('"input" cannot be undefined');var r=void 0,n=void 0,i=void 0;if("string"==typeof t?r=t:Array.isArray(t)?i=t:(r=t.url,n=t.fallbackUrls,i=t.sources),"string"==typeof r)return e.normalizeUrl(r,n);if(Array.isArray(i)){if(0===i.length)throw new Error('"sources" cannot be an empty array');return _mapInstanceProperty(i).call(i,(function(t){var r;return new e(_mapInstanceProperty(r=t.definitions).call(r,(function(e){return"string"==typeof e?{url:e,definition:"unknown"}:e})),t.name,t.text)}))}return[]}},{key:"normalizeUrl",value:function(t,r){var n=new e([],"unknown");return n.add(new Definition({definition:"unknown",url:t,source:n,fallbackUrls:r})),[n]}}]),e}(),SourceManager=function(){function e(t){var r,n,i,o;_classCallCheck$1(this,e),_defineProperty$2(this,"defaultSource",void 0),_defineProperty$2(this,"defaultDefinition",void 0),_defineProperty$2(this,"maxFallbackRound",void 0),_defineProperty$2(this,"_currentDefinition",void 0),_defineProperty$2(this,"_sources",void 0),_defineProperty$2(this,"_fallbackCount",0);var a=t.url,s=t.defaultDefinition,l=t.defaultSource,c=t.sources,u=t.maxFallbackRound;this.defaultDefinition=s,this.defaultSource=l,this.maxFallbackRound=null!=u?u:1,this._sources=c;var p=a?_findInstanceProperty(this).call(this,a):null===(r=_findInstanceProperty(n=this.sources).call(n,(function(e){return void 0===l||e.name===l})))||void 0===r?void 0:_findInstanceProperty(i=r.definitions).call(i,(function(e){return void 0===s||e.definition===s}));this._currentDefinition=null!=p?p:null===(o=this._sources)||void 0===o||null===(o=o[0])||void 0===o||null===(o=o.definitions)||void 0===o?void 0:o[0]}return _createClass$2(e,[{key:"sources",get:function(){return this._sources}},{key:"definition",get:function(){return this._currentDefinition}},{key:"source",get:function(){var e;return null===(e=this.definition)||void 0===e?void 0:e.source}},{key:"url",get:function(){var e;return null===(e=this.definition)||void 0===e?void 0:e.url},set:function(e){this.definition&&(this.definition.url=e)}},{key:"find",value:function(e,t){var r,n,i,o,a,s=this;if("string"==typeof e)return _findInstanceProperty(o=_reduceInstanceProperty(a=this.sources).call(a,(function(e,t){return _concatInstanceProperty(e).call(e,t.definitions)}),[])).call(o,(function(t){return t.url===e}));var l=_findInstanceProperty(r=this.sources).call(r,(function(t){var r,n;return t.name===(null!==(r=null==e?void 0:e.source)&&void 0!==r?r:null===(n=s.source)||void 0===n?void 0:n.name)})),c=null==l?void 0:_findInstanceProperty(n=l.definitions).call(n,(function(t){var r,n;return t.definition===(null!==(r=null==e?void 0:e.definition)&&void 0!==r?r:null===(n=s.definition)||void 0===n?void 0:n.definition)}));return c||(null!=t&&t.fallbackToFirstDefinition&&null!=l&&null!==(i=l.definitions)&&void 0!==i&&i.length?null==l?void 0:l.definitions[0]:void 0)}},{key:"fallback",value:function(){var e;if(this._fallbackCount++,!(this._fallbackCount>=this.maxFallbackRound*this.definition.urls.length)){var t=null===(e=this._currentDefinition)||void 0===e?void 0:e.next();return null==t?void 0:t.url}this.resetFallback()}},{key:"switch",value:function(e){return this._currentDefinition=e,this.resetFallback(),e}},{key:"updateSources",value:function(e,t){var r,n,i,o,a;return this._sources=Source.normalize(e),this._currentDefinition=null!==(r=_findInstanceProperty(this).call(this,null!=t?t:{source:null!==(n=this.defaultSource)&&void 0!==n?n:null===(i=this._currentDefinition)||void 0===i?void 0:i.source.name,definition:null!==(o=this.defaultDefinition)&&void 0!==o?o:null===(a=this._currentDefinition)||void 0===a?void 0:a.definition}))&&void 0!==r?r:this._sources[0].definitions[0],this.resetFallback(),this}},{key:"resetFallback",value:function(){this._fallbackCount=0}}]),e}();function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _get(){var e;"undefined"!=typeof Reflect&&_Reflect$get$1?_get=_bindInstanceProperty(e=_Reflect$get$1).call(e):_get=function(e,t,r){var n=_superPropBase(e,t);if(n){var i=_Object$getOwnPropertyDescriptor$1(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}};return _get.apply(this,arguments)}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 error="",Error$1=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(){var e,n;_classCallCheck$1(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$2(_assertThisInitialized(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,o))),"_error",void 0),n}return _createClass$2(r,[{key:"_errorTip",get:function(){var e,t,r,n=this.player.config.i18nManager,i=null===(e=this._error)||void 0===e?void 0:e.errorCode;return this.config.errorTipsText?n.normalize(this.config.errorTipsText):_concatInstanceProperty(t="".concat(i?"[".concat(i,"] "):"")).call(t,null===(r=this._error)||void 0===r?void 0:r.message)}},{key:"afterCreate",value:function(){this._handleRefresh=this._handleRefresh.bind(this),this._focus=this._focus.bind(this),this._initEvents(),this._initIcons(),"mobile"===sniffer$1.device&&this.bind("touchend",this._focus),this.bind(".veplayer-error-refresh","click",this._handleRefresh)}},{key:"registerIcons",value:function(){return{error:{icon:ErrorImg,class:"veplayer-error-svg"}}}},{key:"updateLang",value:function(){this.config.showRefresh&&this._renderRefresh(),this._renderExtraTips()}},{key:"showError",value:function(e){this._error=e instanceof VeError$1?e:transform$1(e),this.config.showErrorTip&&this._renderText(this._errorTip),this._renderExtraTips(),_get(_getPrototypeOf(r.prototype),"show",this).call(this)}},{key:"hideError",value:function(){_get(_getPrototypeOf(r.prototype),"hide",this).call(this)}},{key:"destroy",value:function(){"mobile"===sniffer$1.device&&this.unbind("touchend",this._focus),this.unbind(".veplayer-error-refresh","click",this._handleRefresh),this.off(Events$1.FALLBACK_ERROR,this.showError.bind(this)),this.off(CANPLAY,this.hideError.bind(this))}},{key:"render",value:function(){var e,t=this.player.config.i18nManager;return _concatInstanceProperty(e='<veplayer-error class="veplayer-error">\n <div class="veplayer-error-cover">\n '.concat(this.config.showErrorImg?'<div class="veplayer-error-img"></div>':"",'\n <div class="veplayer-error-tips"></div>\n ')).call(e,this.config.showRefresh?'<div class="veplayer-error-refresh">'.concat(t.getText("ERROR_REFRESH"),"</div>"):"",'\n <div class="veplayer-error-extra"></div>\n </div>\n </veplayer-error>')}},{key:"_focus",value:function(){this.player.focus({autoHide:!0})}},{key:"_initIcons",value:function(){this.config.showErrorImg&&this.appendChild(".veplayer-error-img",this.icons.error)}},{key:"_initEvents",value:function(){this.on(Events$1.FALLBACK_ERROR,this.showError.bind(this)),this.on(CANPLAY,this.hideError.bind(this)),this.on(PLAY,this.hideError.bind(this)),this.on(RETRY,this.hideError.bind(this))}},{key:"_renderText",value:function(e){var t=_findInstanceProperty(this).call(this,".veplayer-error-tips");t&&(t.innerText=e)}},{key:"_renderExtraTips",value:function(){var e,t=this,r=_findInstanceProperty(this).call(this,".veplayer-error-extra");r&&(r.innerHTML="");var n=this.player.config.i18nManager;null===(e=this.config.extraTips)||void 0===e||e.forEach((function(e){if(e){var r,i=util$1.createDom("div",_concatInstanceProperty(r="".concat(n.normalize(e.label),": ")).call(r,n.normalize(e.value)),void 0,"veplayer-error-detail-info");t.appendChild(".veplayer-error-extra",i)}}))}},{key:"_handleRefresh",value:function(){var e,t;null===(e=this.player)||void 0===e||e.emit(Events$1.ERROR_REFRESH_CLICK),null===(t=this.player)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.veplayer)||void 0===t||t.retry(),this.hideError()}},{key:"_renderRefresh",value:function(){var e,t=this.player.config.i18nManager,r=_findInstanceProperty(this).call(this,".veplayer-error-refresh");r&&(r.innerHTML=null!==(e=t.getText("ERROR_REFRESH"))&&void 0!==e?e:"")}}],[{key:"pluginName",get:function(){return"error"}},{key:"defaultConfig",get:function(){return{showErrorImg:!0,showErrorTip:!0,showRefresh:!0,errorTipsText:"",extraTips:[],position:Plugin.POSITIONS.ROOT}}}]),r}(),toast="",DURATION=2e3,Toast=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(){var e,n;_classCallCheck$1(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$2(_assertThisInitialized(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,o))),"_toastNumber",0),_defineProperty$2(_assertThisInitialized(n),"_toastMap",{}),n}return _createClass$2(r,[{key:"toast",value:function(e,t){var r=this,n=t||{},i=n.duration,o=void 0===i?DURATION:i,a=n.closable,s=void 0!==a&&a,l=this._toastNumber+1;this._toastNumber=l;var c=this._renderToast(e,s,l);return this.root.appendChild(c),this._toastMap[l]=c,setTimeout((function(){r.remove(l)}),o),l}},{key:"remove",value:function(e){var t=this._toastMap[e];t&&(this.root.contains(t)&&this.root.removeChild(t),delete this._toastMap[e])}},{key:"render",value:function(){return'<veplayer-toast class="veplayer-toast"></veplayer-toast>'}},{key:"_renderToast",value:function(e,t,r){var n=this,i=util$1.createDom("div","",void 0,"veplayer-toast-container"),o=util$1.checkIsObject(e)?e:util$1.createDom("div",e,void 0,"veplayer-toast-txt");if(i.appendChild(o),t){var a=util$1.createDom("span","×",void 0,"veplayer-toast-close");a.addEventListener("click",(function(){n.remove(r)})),i.appendChild(a)}return i}}],[{key:"pluginName",get:function(){return"toast"}},{key:"defaultConfig",get:function(){return{index:5}}}]),r}();function SourceIcon(){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 mobilePanel="",MobilePlayerPanel=function(){function e(t){_classCallCheck$1(this,e),_defineProperty$2(this,"_root",void 0),_defineProperty$2(this,"_config",void 0),_defineProperty$2(this,"_parent",void 0),_defineProperty$2(this,"_listDom",void 0),_defineProperty$2(this,"_container",void 0),_defineProperty$2(this,"_titleDom",void 0),_defineProperty$2(this,"_player",void 0),_defineProperty$2(this,"_delegates",void 0),_defineProperty$2(this,"_listType",void 0);var r=t.config,n=t.root,i=t.player;this._config=r,this._parent=n,this._player=i,this._listType=r.listType,this.renderPanel(),this._initEvents(),this._bindDomEvent()}return _createClass$2(e,[{key:"changeMode",value:function(e){this.updatePanel(e),this._listType=e}},{key:"renderItemList",value:function(e){var t,r=this,n=this._config;return e&&(n.list=e),this._listDom||(this._listDom=util$1.createDom("div","",{},"item-list-panel-content")),this._listDom.innerHTML="",null===(t=n.list)||void 0===t||_mapInstanceProperty(t).call(t,(function(e,t){var n,i,o=e.selected?"panel-item select-in":"panel-item ".concat(null!==(n=e.className)&&void 0!==n?n:"");e["data-index"]=t;var a=util$1.createDom("div","",e,o);e.showText&&("string"==typeof e.showText?a.innerHTML=e.showText:a.appendChild(e.showText)),null===(i=r._listDom)||void 0===i||i.appendChild(a)})),this._listDom}},{key:"renderTitle",value:function(){var e,t,r=this._player.config.i18nManager;if(null!==(e=this._config.panel)&&void 0!==e&&e.title&&this._listType!==ListType.Inner)return this._titleDom||(this._titleDom=util$1.createDom("div","",{},"xg-mobile-panel-title")),this._titleDom.innerHTML=r.normalize(null===(t=this._config.panel)||void 0===t?void 0:t.title),this._titleDom}},{key:"updatePanel",value:function(e){this._root&&util$1.removeClass(this._root,"panel-".concat(this._listType)),this._root&&util$1.addClass(this._root,"panel-".concat(e));var t="mobile"===sniffer$1.device?"touchend":"click";e===ListType.Inner?this._container&&this._bind(this._container,t,this._handleHide.bind(this)):this._container&&this._unbind(this._container,t,this._handleHide.bind(this))}},{key:"renderPanel",value:function(){var e,t,r,n=_concatInstanceProperty(e="xg-mobile-panel panel-".concat(this._config.listType," ")).call(e,null!==(t=null===(r=this._config)||void 0===r||null===(r=r.panel)||void 0===r?void 0:r.className)&&void 0!==t?t:"");this._root=util$1.createDom("div","",{},n),this._parent&&this._parent.appendChild(this._root);var i=this.renderTitle(),o=this.renderItemList();this._container=util$1.createDom("div","",{},"xg-mobile-panel-content"),this._root.appendChild(this._container),i&&this._container.appendChild(i),o&&this._container.appendChild(o)}},{key:"show",value:function(){this._root&&(util$1.removeClass(this._root,"hide"),util$1.addClass(this._root,"active"))}},{key:"hide",value:function(){this._root&&(util$1.removeClass(this._root,"active"),util$1.addClass(this._root,"hide"))}},{key:"destroy",value:function(){this._parent&&this._root&&this._parent.removeChild(this._root),this._unbindDomEvent(),this._unbindEvents()}},{key:"_bind",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e&&"on".concat(t)in e&&"function"==typeof r&&e.addEventListener(t,r,n)}},{key:"_unbind",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e&&"on".concat(t)in e&&"function"==typeof r&&e.removeEventListener(t,r,n)}},{key:"_initEvents",value:function(){var e;this._config.isAutoChange&&(window.addEventListener("orientationchange",this._handleOrientationChange.bind(this)),null===(e=this._player)||void 0===e||e.on(FULLSCREEN_CHANGE,this._handleOrientationChange.bind(this)))}},{key:"_unbindEvents",value:function(){var e;window.removeEventListener("orientationchange",this._handleOrientationChange.bind(this)),null===(e=this._player)||void 0===e||e.off(FULLSCREEN_CHANGE,this._handleOrientationChange.bind(this))}},{key:"_handleOrientationChange",value:function(){var e,t,r,n=_includesInstanceProperty(e=[90,-90,"90","-90"]).call(e,window.orientation);if(null!==(t=this._player)&&void 0!==t&&t.fullscreen&&n)this.changeMode(ListType.Fullscreen);else if(this._listType!==(null===(r=this._config)||void 0===r?void 0:r.listType)){var i;this.changeMode(null===(i=this._config)||void 0===i?void 0:i.listType)}}},{key:"_bindDomEvent",value:function(){var e="mobile"===sniffer$1.device?"touchend":"click";this._listType===ListType.Inner&&this._container&&this._bind(this._container,e,this._handleHide.bind(this)),this._root&&this._bind(this._root,e,this._handleHide.bind(this)),this._container&&this._bind(this._container,e,this._stopPropagation),this._listDom&&(this._delegates=Plugin.delegate.call(this,this._listDom,".panel-item",e,this._onItemClick.bind(this),!0))}},{key:"_unbindDomEvent",value:function(){var e,t="mobile"===sniffer$1.device?"touchend":"click";(this._root&&this._unbind(this._root,t,this._handleHide.bind(this)),this._container&&this._unbind(this._container,t,this._handleHide.bind(this)),this._container&&this._unbind(this._container,t,this._stopPropagation),this._delegates)&&(_mapInstanceProperty(e=this._delegates).call(e,(function(e){e.destroy&&e.destroy()})),this._delegates=null)}},{key:"_stopPropagation",value:function(e){e.stopPropagation(),e.preventDefault()}},{key:"_onItemClick",value:function(e){var t,r,n,i,o=e.delegateTarget,a="function"==typeof this._config.onOptionClick?this._config.onOptionClick:null,s="function"==typeof this._config.onItemClick?this._config.onItemClick:null,l=null===(t=this._root)||void 0===t?void 0:t.querySelector(".selected");util$1.addClass(o,"selected"),l&&(util$1.removeClass(l,"selected"),i=Number(l.getAttribute("data-index")));var c=Number(o.getAttribute("data-index")),u={from:void 0!==_typeof$1(i)?null===(r=this._config.list)||void 0===r?void 0:r[i]:void 0,to:null===(n=this._config.list)||void 0===n?void 0:n[c]};null==a||a(e,u),o&&i===c||null==s||s(e,u)}},{key:"_handleHide",value:function(e){var t,r;e.stopPropagation(),e.preventDefault(),null===(t=(r=this._config).hide)||void 0===t||t.call(r)}}]),e}(),optionsIcon="",ListType=function(e){return e.Middle="middle",e.Bottom="bottom",e.Fullscreen="fullscreen",e.Inner="inner",e}(ListType||{}),RenderType=function(e){return e.Icon="Icon",e.Text="Text",e}(RenderType||{}),isMobile$1="mobile"===sniffer$1.device,MOBILE_LIST_TYPES=["bottom","fullscreen","inner"],PC_LIST_TYPES=["middle"],MODAL_TYPES=["bottom","inner","fullscreen"],CUSTOM_TYPES=["bottom","inner","fullscreen"],OptionsIcon=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(e){var n;return _classCallCheck$1(this,r),_defineProperty$2(_assertThisInitialized(n=t.call(this,e)),"optionsList",void 0),_defineProperty$2(_assertThisInitialized(n),"_isIcon",void 0),_defineProperty$2(_assertThisInitialized(n),"_isActive",void 0),_defineProperty$2(_assertThisInitialized(n),"_curIndex",void 0),_defineProperty$2(_assertThisInitialized(n),"activeEvent",void 0),_defineProperty$2(_assertThisInitialized(n),"onEnter",(function(e){e.preventDefault(),e.stopPropagation(),n.emit("icon_mouseenter",{pluginName:n.pluginName}),n.toggle(!0)})),_defineProperty$2(_assertThisInitialized(n),"onLeave",(function(e){e.preventDefault(),e.stopPropagation(),n.emit("icon_mouseleave",{pluginName:n.pluginName}),n._isActive&&n.toggle(!1)})),n._isIcon=!1,n._isActive=!1,n._curIndex=0,n}return _createClass$2(r,[{key:"updateLang",value:function(){this.config.list&&this.renderItemList(this.config.list,this._curIndex)}},{key:"afterCreate",value:function(){var e=this,t=this.config;this.config.listType=this._getListType(),this.initIcons(),t.hidePortrait&&util$1.addClass(this.root,"portrait"),isMobile$1&&this.on(PLAYER_FOCUS,(function(){e._isActive&&(e.optionsList&&e.optionsList.hide(),e._isActive=!1)})),t.list&&this.renderItemList(t.list),this.activeEvent=isMobile$1?"touchend":"mouseenter",this.bind(this.activeEvent,this.onEnter),this.bind("mouseleave",this.onLeave)}},{key:"initIcons",value:function(){var e=this,t=this.icons,r=_Object$keys(t);if(r.length>0&&"Icon"===this.config.renderType)return r.forEach((function(r){e.appendChild(".xgplayer-icon",t[r])})),void(this._isIcon=!0);var n=this.appendChild(".xgplayer-icon",util$1.createDom("span","",{},"icon-text"));n&&util$1.addClass(n,"btn-text")}},{key:"show",value:function(){!this.config.list||this.config.list.length<1||this.config.hideOnSingleOption&&1===this.config.list.length||util$1.addClass(this.root,"show")}},{key:"hide",value:function(){util$1.removeClass(this.root,"show")}},{key:"toggle",value:function(e){if(e!==this._isActive){var t=this.player.controls,r=this.config.listType;e?(r&&_includesInstanceProperty(MODAL_TYPES).call(MODAL_TYPES,r)?t.blur():t.focus(),this.optionsList&&this.optionsList.show()):(r&&_includesInstanceProperty(MODAL_TYPES).call(MODAL_TYPES,r)?t.focus():t.focusAwhile(),this.optionsList&&this.optionsList.hide()),this._isActive=e}}},{key:"onItemClick",value:function(e,t){var r;e.preventDefault(),e.stopPropagation();var n=this.config.listType;this._curIndex=null===(r=t.to)||void 0===r?void 0:r.index,this.changeCurrentText(),(this.config.isItemClickHide||n&&_includesInstanceProperty(MODAL_TYPES).call(MODAL_TYPES,n))&&this.toggle(!1)}},{key:"onOptionClick",value:function(e,t){e.preventDefault(),e.stopPropagation()}},{key:"changeCurrentText",value:function(){if(!this._isIcon){var e=this.config.list,t=e&&this._curIndex<e.length?this._curIndex:0,r=null==e?void 0:e[t];if(r){var n,i=_findInstanceProperty(this).call(this,".icon-text"),o=this.player.config.i18nManager;if(i)i.innerHTML=o.normalize(null!==(n=null==r?void 0:r.iconText)&&void 0!==n?n:null==r?void 0:r.text)}}}},{key:"renderItemList",value:function(e,t){var n,i=this,o=this.config,a=this.optionsList,s=this.player;if("number"==typeof t&&(this._curIndex=t),a)return a.renderItemList(e),this.changeCurrentText(),void(a instanceof MobilePlayerPanel&&a.renderTitle());this.config.isShowIcon&&(this.optionsList=o.listType&&_includesInstanceProperty(CUSTOM_TYPES).call(CUSTOM_TYPES,o.listType)?new MobilePlayerPanel({config:{list:e||[],onItemClick:function(e,t){i.onItemClick(e,t)},onOptionClick:function(e,t){i.onOptionClick(e,t)},panel:this.config.panel,listType:null!==(n=o.listType)&&void 0!==n?n:r.defaultConfig.listType,isAutoChange:o.isAutoChange,hide:function(){return i.toggle(!1)}},root:s.root,player:s}):new OptionList({config:{data:e||[],onItemClick:function(e,t){i.onItemClick(e,t)}},root:this.root}),this.changeCurrentText(),this.show())}},{key:"destroy",value:function(){this.activeEvent&&this.unbind(this.activeEvent,this.onEnter),this.unbind("mouseleave",this.onLeave),this.optionsList&&(this.optionsList.destroy(),this.optionsList=void 0)}},{key:"render",value:function(){return this.config.isShowIcon?'<xg-icon class="xg-options-icon '.concat(this.config.className||"",'">\n <div class="xgplayer-icon">\n </div>\n </xg-icon>'):""}},{key:"_getListType",value:function(){var e,t=this.config.listType;return null!==(e=this.player)&&void 0!==e&&null!==(e=e.config)&&void 0!==e&&e.listType&&(t=this.player.config.listType),isMobile$1||t&&_includesInstanceProperty(MOBILE_LIST_TYPES).call(MOBILE_LIST_TYPES,t)||(t="bottom"),isMobile$1||t&&_includesInstanceProperty(PC_LIST_TYPES).call(PC_LIST_TYPES,t)||(t="middle"),t}}],[{key:"pluginName",get:function(){return"optionsIcon"}},{key:"defaultConfig",get:function(){return{position:isMobile$1?POSITIONS$1.ROOT_TOP_RIGHT:POSITIONS$1.CONTROLS_RIGHT,listType:isMobile$1?"bottom":"middle",index:100,list:[],listStyle:{},hidePortrait:!0,isShowIcon:!1,renderType:isMobile$1?"Icon":"Text",isItemClickHide:!0,hideOnSingleOption:!0,isAutoChange:!0}}}]),r}(),Sources=function(e){_inherits(r,OptionsIcon);var t=_createSuper(r);function r(){return _classCallCheck$1(this,r),t.apply(this,arguments)}return _createClass$2(r,[{key:"updateLang",value:function(){this.renderItemList()}},{key:"beforeCreate",value:function(e){var t=e.player.config.sources.sourceManager;e.config.list=t.sources}},{key:"afterCreate",value:function(){_get(_getPrototypeOf(r.prototype),"afterCreate",this).call(this),this.config.sourceManager.sources.length<2?this.hide():this.renderItemList()}},{key:"registerIcons",value:function(){return{source:{icon:SourceIcon}}}},{key:"renderItemList",value:function(){var e=this.config.sourceManager,t=e.sources,n=e.source,i=this.player.config.i18nManager,o=_mapInstanceProperty(t).call(t,(function(e){var t;return _objectSpread2$2(_objectSpread2$2({},e),{},{showText:null!==(t=i.normalize(e.text))&&void 0!==t?t:e.name,selected:!1})})),a=_findIndexInstanceProperty(o).call(o,(function(e){return e.name===(null==n?void 0:n.name)}));this.config.list=t,a>-1&&(o[a].selected=!0),_get(_getPrototypeOf(r.prototype),"renderItemList",this).call(this,o,a)}},{key:"onItemClick",value:function(e,t){var n,i=this;_get(_getPrototypeOf(r.prototype),"onItemClick",this).call(this,e,t),null===(n=this.player.config)||void 0===n||n.veplayer.switch({source:t.to.name},{fallbackToFirstDefinition:!0}).catch((function(){i.renderItemList()}))}}],[{key:"pluginName",get:function(){return"sources"}},{key:"defaultConfig",get:function(){return _objectSpread2$2(_objectSpread2$2({},OptionsIcon.defaultConfig),{},{index:4,panel:{title:{jp:"ライン選ぶ",en:"Line Choose","zh-cn":"线路选择","zh-hk":"線路選擇"}},list:[],className:"xgplayer-sources",hidePortrait:!1,isShowIcon:!0})}},{key:"textTips",get:function(){return{jp:"ライン",en:"Line","zh-cn":"线路","zh-hk":"線路"}}}]),r}();function DefinitionIcon(){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 lodash_clonedeep={exports:{}};lodash_clonedeep.exports,function(e,t){var r="__lodash_hash_undefined__",n=9007199254740991,i="[object Arguments]",o="[object Boolean]",a="[object Date]",s="[object Function]",l="[object GeneratorFunction]",c="[object Map]",u="[object Number]",p="[object Object]",f="[object Promise]",d="[object RegExp]",h="[object Set]",y="[object String]",g="[object Symbol]",_="[object WeakMap]",v="[object ArrayBuffer]",m="[object DataView]",$="[object Float32Array]",b="[object Float64Array]",S="[object Int8Array]",E="[object Int16Array]",P="[object Int32Array]",T="[object Uint8Array]",I="[object Uint8ClampedArray]",O="[object Uint16Array]",C="[object Uint32Array]",w=/\w*$/,A=/^\[object .+?Constructor\]$/,R=/^(?:0|[1-9]\d*)$/,k={};k[i]=k["[object Array]"]=k[v]=k[m]=k[o]=k[a]=k[$]=k[b]=k[S]=k[E]=k[P]=k[c]=k[u]=k[p]=k[d]=k[h]=k[y]=k[g]=k[T]=k[I]=k[O]=k[C]=!0,k["[object Error]"]=k[s]=k[_]=!1;var D="object"==_typeof$1(commonjsGlobal$1)&&commonjsGlobal$1&&commonjsGlobal$1.Object===Object&&commonjsGlobal$1,x="object"==("undefined"==typeof self?"undefined":_typeof$1(self))&&self&&self.Object===Object&&self,N=D||x||Function("return this")(),L=t&&!t.nodeType&&t,M=L&&e&&!e.nodeType&&e,F=M&&M.exports===L;function j(e,t){return e.set(t[0],t[1]),e}function U(e,t){return e.add(t),e}function B(e,t,r,n){var i=-1,o=e?e.length:0;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function G(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function H(e,t){return function(r){return e(t(r))}}function K(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var z,W=Array.prototype,Y=Function.prototype,q=Object.prototype,X=N["__core-js_shared__"],J=(z=/[^.]+$/.exec(X&&_keysInstanceProperty(X)&&_keysInstanceProperty(X).IE_PROTO||""))?"Symbol(src)_1."+z:"",Z=Y.toString,Q=q.hasOwnProperty,ee=q.toString,te=RegExp("^"+Z.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=F?N.Buffer:void 0,ne=N.Symbol,ie=N.Uint8Array,oe=H(_Object$getPrototypeOf,Object),ae=Object.create,se=q.propertyIsEnumerable,le=_spliceInstanceProperty(W),ce=_Object$getOwnPropertySymbols,ue=re?re.isBuffer:void 0,pe=H(_Object$keys,Object),fe=Me(N,"DataView"),de=Me(N,"Map"),he=Me(N,"Promise"),ye=Me(N,"Set"),ge=Me(N,"WeakMap"),_e=Me(Object,"create"),ve=Ve(fe),me=Ve(de),$e=Ve(he),be=Ve(ye),Se=Ve(ge),Ee=ne?ne.prototype:void 0,Pe=Ee?Ee.valueOf:void 0;function Te(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ie(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Oe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ce(e){this.__data__=new Ie(e)}function we(e,t){var r=He(e)||function(e){return function(e){return function(e){return!!e&&"object"==_typeof$1(e)}(e)&&Ke(e)}(e)&&Q.call(e,"callee")&&(!se.call(e,"callee")||ee.call(e)==i)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,o=!!n;for(var a in e)!t&&!Q.call(e,a)||o&&("length"==a||Ue(a,n))||r.push(a);return r}function Ae(e,t,r){var n=e[t];Q.call(e,t)&&Ge(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function Re(e,t){for(var r=e.length;r--;)if(Ge(e[r][0],t))return r;return-1}function ke(e,t,r,n,f,_,A){var R;if(n&&(R=_?n(e,f,_,A):n(e)),void 0!==R)return R;if(!Ye(e))return e;var D=He(e);if(D){if(R=function(e){var t=e.length,r=e.constructor(t);t&&"string"==typeof e[0]&&Q.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!t)return function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r<n;)t[r]=e[r];return t}(e,R)}else{var x=je(e),N=x==s||x==l;if(ze(e))return function(e,t){if(t)return _sliceInstanceProperty(e).call(e);var r=new e.constructor(e.length);return e.copy(r),r}(e,t);if(x==p||x==i||N&&!_){if(V(e))return _?e:{};if(R=function(e){return"function"!=typeof e.constructor||Be(e)?{}:function(e){return Ye(e)?ae(e):{}}(oe(e))}(N?{}:e),!t)return function(e,t){return Ne(e,Fe(e),t)}(e,function(e,t){return e&&Ne(t,qe(t),e)}(R,e))}else{if(!k[x])return _?e:{};R=function(e,t,r,n){var i=e.constructor;switch(t){case v:return xe(e);case o:case a:return new i(+e);case m:return function(e,t){var r=t?xe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,n);case $:case b:case S:case E:case P:case T:case I:case O:case C:return function(e,t){var r=t?xe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,n);case c:return function(e,t,r){var n=t?r(G(e),!0):G(e);return B(n,j,new e.constructor)}(e,n,r);case u:case y:return new i(e);case d:return function(e){var t=new e.constructor(e.source,w.exec(e));return t.lastIndex=e.lastIndex,t}(e);case h:return function(e,t,r){var n=t?r(K(e),!0):K(e);return B(n,U,new e.constructor)}(e,n,r);case g:return s=e,Pe?Object(Pe.call(s)):{}}var s}(e,x,ke,t)}}A||(A=new Ce);var L=A.get(e);if(L)return L;if(A.set(e,R),!D)var M=r?function(e){return function(e,t,r){var n=t(e);return He(e)?n:function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}(n,r(e))}(e,qe,Fe)}(e):qe(e);return function(e,t){for(var r=-1,n=e?e.length:0;++r<n&&!1!==t(e[r],r,e););}(M||e,(function(i,o){M&&(i=e[o=i]),Ae(R,o,ke(i,t,r,n,o,e,A))})),R}function De(e){return!(!Ye(e)||(t=e,J&&J in t))&&(We(e)||V(e)?te:A).test(Ve(e));var t}function xe(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Ne(e,t,r,n){r||(r={});for(var i=-1,o=t.length;++i<o;){var a=t[i],s=n?n(r[a],e[a],a,r,e):void 0;Ae(r,a,void 0===s?e[a]:s)}return r}function Le(e,t){var r,n,i=e.__data__;return("string"==(n=_typeof$1(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:_mapInstanceProperty(i)}function Me(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return De(r)?r:void 0}Te.prototype.clear=function(){this.__data__=_e?_e(null):{}},Te.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Te.prototype.get=function(e){var t=this.__data__;if(_e){var n=t[e];return n===r?void 0:n}return Q.call(t,e)?t[e]:void 0},Te.prototype.has=function(e){var t=this.__data__;return _e?void 0!==t[e]:Q.call(t,e)},Te.prototype.set=function(e,t){return this.__data__[e]=_e&&void 0===t?r:t,this},Ie.prototype.clear=function(){this.__data__=[]},Ie.prototype.delete=function(e){var t=this.__data__,r=Re(t,e);return!(r<0)&&(r==t.length-1?t.pop():le.call(t,r,1),!0)},Ie.prototype.get=function(e){var t=this.__data__,r=Re(t,e);return r<0?void 0:t[r][1]},Ie.prototype.has=function(e){return Re(this.__data__,e)>-1},Ie.prototype.set=function(e,t){var r=this.__data__,n=Re(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Oe.prototype.clear=function(){this.__data__={hash:new Te,map:new(de||Ie),string:new Te}},Oe.prototype.delete=function(e){return Le(this,e).delete(e)},Oe.prototype.get=function(e){return Le(this,e).get(e)},Oe.prototype.has=function(e){return Le(this,e).has(e)},Oe.prototype.set=function(e,t){return Le(this,e).set(e,t),this},Ce.prototype.clear=function(){this.__data__=new Ie},Ce.prototype.delete=function(e){return this.__data__.delete(e)},Ce.prototype.get=function(e){return this.__data__.get(e)},Ce.prototype.has=function(e){return this.__data__.has(e)},Ce.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ie){var n=r.__data__;if(!de||n.length<199)return n.push([e,t]),this;r=this.__data__=new Oe(n)}return r.set(e,t),this};var Fe=ce?H(ce,Object):function(){return[]},je=function(e){return ee.call(e)};function Ue(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||R.test(e))&&e>-1&&e%1==0&&e<t}function Be(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||q)}function Ve(e){if(null!=e){try{return Z.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ge(e,t){return e===t||e!=e&&t!=t}(fe&&je(new fe(new ArrayBuffer(1)))!=m||de&&je(new de)!=c||he&&je(he.resolve())!=f||ye&&je(new ye)!=h||ge&&je(new ge)!=_)&&(je=function(e){var t=ee.call(e),r=t==p?e.constructor:void 0,n=r?Ve(r):void 0;if(n)switch(n){case ve:return m;case me:return c;case $e:return f;case be:return h;case Se:return _}return t});var He=Array.isArray;function Ke(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}(e.length)&&!We(e)}var ze=ue||function(){return!1};function We(e){var t=Ye(e)?ee.call(e):"";return t==s||t==l}function Ye(e){var t=_typeof$1(e);return!!e&&("object"==t||"function"==t)}function qe(e){return Ke(e)?we(e):function(e){if(!Be(e))return pe(e);var t=[];for(var r in Object(e))Q.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function(e){return ke(e,!0,!0)}}(lodash_clonedeep,lodash_clonedeep.exports);var lodash_clonedeepExports=lodash_clonedeep.exports,clonedeep=getDefaultExportFromCjs(lodash_clonedeepExports),DefinitionPlugin=function(e){_inherits(n,OptionsIcon);var t,r=_createSuper(n);function n(){var e,t;_classCallCheck$1(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$2(_assertThisInitialized(t=r.call.apply(r,_concatInstanceProperty(e=[this]).call(e,o))),"_waitingStartTime",0),_defineProperty$2(_assertThisInitialized(t),"_timer",void 0),_defineProperty$2(_assertThisInitialized(t),"_toastId",void 0),t}return _createClass$2(n,[{key:"updateLang",value:function(){this.renderItemList()}},{key:"beforeCreate",value:function(e){var t,r=e.player.config.sources.sourceManager;e.config.list=null===(t=r.source)||void 0===t?void 0:t.definitions}},{key:"afterCreate",value:function(){var e,t;_get(_getPrototypeOf(n.prototype),"afterCreate",this).call(this),(null!==(e=null===(t=this.player.config.sourceManager.source)||void 0===t?void 0:t.definitions)&&void 0!==e?e:[]).length<2?this.hide():(this.renderItemList(),this.on(Events$1.WAITING,this._waiting.bind(this)),this.on(Events$1.PLAYING,this._clearTimer.bind(this)),this.on(Events$1.PAUSE,this._clearTimer.bind(this)),this.on(Events$1.PLAY,this._clearTimer.bind(this)),this._initTimeUpdateEvent())}},{key:"registerIcons",value:function(){return{source:{icon:DefinitionIcon}}}},{key:"renderItemList",value:function(){var e,t,r,i=this,o=this.player.config.sourceManager,a=null!==(e=null===(t=o.source)||void 0===t?void 0:t.definitions)&&void 0!==e?e:[],s=_mapInstanceProperty(a).call(a,(function(e){var t;return{url:e.url,definition:e.definition||"",showText:null!==(t=i.player.config.i18nManager.normalize(e.text))&&void 0!==t?t:e.definition,selected:!1}})),l=_findIndexInstanceProperty(a).call(a,(function(e){var t;return e.definition===(null===(t=o.definition)||void 0===t?void 0:t.definition)}));this.config.list=null===(r=o.source)||void 0===r?void 0:r.definitions,l>-1&&(s[l].selected=!0),_get(_getPrototypeOf(n.prototype),"renderItemList",this).call(this,s,l)}},{key:"onItemClick",value:function(e,t){var r,i=this;this._showToast(t.to),_get(_getPrototypeOf(n.prototype),"onItemClick",this).call(this,e,t),null===(r=this.player.config)||void 0===r||r.veplayer.switch({definition:t.to.definition}).catch((function(){i.renderItemList()}))}},{key:"fallback",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r,n,i,o,a,s,l=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=l.length>0&&void 0!==l[0]?l[0]:{toast:!0},i=this.player.config.sourceManager,!((o=_findIndexInstanceProperty(t=this.config.demotePriority).call(t,(function(e){var t;return e===(null===(t=i.definition)||void 0===t?void 0:t.definition)})))<0)){e.next=5;break}return e.abrupt("return");case 5:if(a=clonedeep(i.definition),s=this._getNextDefinition(o)){e.next=9;break}return e.abrupt("return");case 9:if(!n.toast){e.next=15;break}return e.next=12,this._toast(s);case 12:if(e.sent){e.next=15;break}return e.abrupt("return");case 15:this.player.emit(Events$1.DEFINITION_FALLBACK,{from:a,to:s}),null===(r=this.player.config)||void 0===r||r.veplayer.switch({definition:s.definition}).catch((function(){}));case 17:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_waiting",value:function(){var e=this;if(!this._timer){this._waitingStartTime=Date.now();var t=this.player.currentTime;this._timer=window.setTimeout((function(){e.player&&e.player.currentTime<=t+.1&&(e.player.emit(Events$1.LONG_WAITING),e.config.needFallback&&e.fallback({toast:!0}),e._clearTimer())}),this.config.longWaitingTime)}}},{key:"_clearTimer",value:function(){this._timer&&(clearTimeout(this._timer),this._timer=void 0),this._waitingStartTime&&(this._waitingStartTime=0)}},{key:"_toast",value:function(e){var t=this,r=this.player.config.i18nManager;return new _Promise((function(n){var i,o,a=null===(i=t.player)||void 0===i?void 0:i.getPlugin("toast");if(a){var s=util$1.createDom("div",r.getText("DEFINITION_FALLBACK_TOAST"),void 0,"veplayer-toast-txt"),l=null!==(o=t.player.config.i18nManager.normalize(e.text))&&void 0!==o?o:e.definition,c=util$1.createDom("span",l,void 0,"veplayer-toast-txt-bt");s.appendChild(c);var u=a.toast(s,{duration:5e3,closable:!0});c.addEventListener("click",(function(){a.remove(u),n(!0)}))}else n(!1)}))}},{key:"_getNextDefinition",value:function(e){var t,r=this.player.config.sourceManager;if(null!==(t=r.source)&&void 0!==t&&t.definitions.length&&!(e+1>=this.config.demotePriority.length)){var n=e+1,i=_findInstanceProperty(r).call(r,{definition:this.config.demotePriority[n]});return i||this._getNextDefinition(n)}}},{key:"_initTimeUpdateEvent",value:function(){var e=this,t=this.player.currentTime;this.on(Events$1.TIME_UPDATE,(function(){var r=e.player.currentTime;r!==t?(t=r,e._clearTimer()):t=r}))}},{key:"_showToast",value:function(e){var t,r,n,i=this,o=null===(t=this.player)||void 0===t?void 0:t.getPlugin("toast"),a=this.player.config.i18nManager;o&&(this._toastId&&o.remove(this._toastId),this._toastId=o.toast(_concatInstanceProperty(r="".concat(a.getText("DEFINITION_SWITCHING")," ")).call(r,null!==(n=e.showText)&&void 0!==n?n:e.definition," ..."),{duration:2e3,closable:!0}),this.player.once(Events$1.AFTER_DEFINITION_CHANGE,(function(){void 0!==i._toastId&&o.remove(i._toastId)})))}}],[{key:"pluginName",get:function(){return"definition"}},{key:"defaultConfig",get:function(){return _objectSpread2$2(_objectSpread2$2({},OptionsIcon.defaultConfig),{},{index:3,list:[],panel:{title:{jp:"クラリティセレクション",en:"Definition Choose","zh-cn":"清晰度选择","zh-hk":"清晰度選擇"}},className:"xgplayer-definition",hidePortrait:!1,isShowIcon:!0,longWaitingTime:5e3,needFallback:!1,demotePriority:["uhd","hd","sd","ld","ao"]})}},{key:"textTips",get:function(){return{jp:"明快さ",en:"Definition","zh-cn":"清晰度","zh-hk":"清晰度"}}}]),n}(),NAME_MAP={"biz:vod":"veplayer.biz.vod.[env].[ext]","biz:live":"veplayer.biz.live.[env].[ext]","plugin:flv":"veplayer.plugin.flv.[env].[ext]","plugin:mp4":"veplayer.plugin.mp4.[env].[ext]","plugin:hls":"veplayer.plugin.hls.[env].[ext]","plugin:shaka":"veplayer.plugin.shaka.[env].[ext]","plugin:rtm":"veplayer.plugin.rtm.[env].[ext]","plugin:xgvideo":"veplayer.plugin.xgvideo.[env].[ext]","plugin:drm":"veplayer.plugin.drm.[env].[ext]","plugin:abr":"veplayer.plugin.abr.[env].[ext]"},DynamicModule=function(e){return e.BizVod="biz:vod",e.BizLive="biz:live",e.PluginFlv="plugin:flv",e.PluginMp4="plugin:mp4",e.PluginHls="plugin:hls",e.PluginShaka="plugin:shaka",e.PluginRtm="plugin:rtm",e.PluginXgvideo="plugin:xgvideo",e.PluginDrm="plugin:drm",e.PluginAbr="plugin:abr",e}(DynamicModule||{}),Loader=function(){function e(t){var r=this;_classCallCheck$1(this,e),_defineProperty$2(this,"modules",{}),_defineProperty$2(this,"mountPromiseMap",{}),_defineProperty$2(this,"_baseUrl",void 0),_defineProperty$2(this,"_moduleSystem",void 0),_defineProperty$2(this,"load",function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var i,o,a,s,l;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r._moduleSystem){e.next=2;break}throw new Error('You have to specify moduleSystem first, call "setModuleSystem(moduleSystem)" to set module system');case 2:if(NAME_MAP[t]){e.next=4;break}throw new Error('Invalid module name: "'.concat(t,'"'));case 4:if("esm"!==r._moduleSystem){e.next=11;break}if(r.modules[t]){e.next=9;break}throw new Error('Dynamic module "'.concat(t,'" not found, you have to register it first under ESM'));case 9:return o=r.modules[t].exports,e.abrupt("return",null!==(i=o.default)&&void 0!==i?i:o);case 11:if(!r.modules[t]){e.next=21;break}if(1!==r.modules[t].state){e.next=16;break}return e.abrupt("return",r.modules[t].exports);case 16:if(0!==r.modules[t].state){e.next=20;break}return e.abrupt("return",r.mountPromiseMap[t].then((function(e){var t;return null!==(t=e.default)&&void 0!==t?t:e})));case 20:throw null!==(a=r.modules[t].error)&&void 0!==a?a:new Error('Dynamic module "'.concat(t,'" load failed.'));case 21:return s=[r._baseUrl,NAME_MAP[t]].join("/").replace("[env]","production").replace("[ext]","js"),l={src:null!=n?n:s,name:t,state:0,exports:{__PLUGIN_NAME__:t}},r.modules[t]=l,r.mountPromiseMap[t]=r._mount(l),e.abrupt("return",r.mountPromiseMap[t]);case 26:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),_defineProperty$2(this,"registerPlugin",(function(e,t){if(!r._moduleSystem)throw new Error("You have to specify moduleSystem first, call setModuleSystem(moduleSystem) to set module system");return"esm"===r._moduleSystem?(r.modules[e]={src:"esm:".concat(e),name:e,state:1,exports:t},r.modules[e].exports):(r.modules[e]?r.modules[e].exports=t:r.modules[e]={src:"umd:".concat(e),name:e,state:1,exports:t},r.modules[e].exports)})),_defineProperty$2(this,"register",(function(e){return _mapInstanceProperty(e).call(e,(function(e){return r.registerPlugin(e.__PLUGIN_NAME__,e)}))})),this._baseUrl=t.baseUrl}return _createClass$2(e,[{key:"baseUrl",get:function(){return this._baseUrl}},{key:"moduleSystem",get:function(){return this._moduleSystem}},{key:"setModuleSystem",value:function(e){this._moduleSystem=e}},{key:"setBaseUrl",value:function(e){this._baseUrl=e}},{key:"_mount",value:function(e){var t=this.modules;return new _Promise((function(r,n){var i=document.createElement("script");i.src=e.src,i.onload=function(){e.state=1,r(t[e.name].exports),i.onload=null},i.onerror=function(t){e.state=2,e.error=t,n(t),i.onerror=null},document.body.appendChild(i)}))}}]),e}(),apply=functionApply,toIndexedObject=toIndexedObject$c,toIntegerOrInfinity=toIntegerOrInfinity$6,lengthOfArrayLike=lengthOfArrayLike$d,arrayMethodIsStrict=arrayMethodIsStrict$5,min=Math.min,$lastIndexOf=[].lastIndexOf,NEGATIVE_ZERO=!!$lastIndexOf&&1/[1].lastIndexOf(1,-0)<0,STRICT_METHOD=arrayMethodIsStrict("lastIndexOf"),FORCED=NEGATIVE_ZERO||!STRICT_METHOD,arrayLastIndexOf=FORCED?function(e){if(NEGATIVE_ZERO)return apply($lastIndexOf,this,arguments)||0;var t=toIndexedObject(this),r=lengthOfArrayLike(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,$$7=_export,lastIndexOf$7=arrayLastIndexOf;$$7({target:"Array",proto:!0,forced:arrayLastIndexOf!==[].lastIndexOf},{lastIndexOf:arrayLastIndexOf});var _document$currentScri,_document$currentScri2,entryVirtual$2=entryVirtual$p,lastIndexOf$6=entryVirtual$2("Array").lastIndexOf,isPrototypeOf$4=objectIsPrototypeOf,method$2=lastIndexOf$6,ArrayPrototype$1=Array.prototype,lastIndexOf$5=function(e){var t=e.lastIndexOf;return e===ArrayPrototype$1||isPrototypeOf$4(ArrayPrototype$1,e)&&t===ArrayPrototype$1.lastIndexOf?method$2:t},parent$w=lastIndexOf$5,lastIndexOf$4=parent$w,parent$v=lastIndexOf$4,lastIndexOf$3=parent$v,parent$u=lastIndexOf$3,lastIndexOf$2=parent$u,lastIndexOf$1=lastIndexOf$2,lastIndexOf2=lastIndexOf$1,_lastIndexOfInstanceProperty=getDefaultExportFromCjs(lastIndexOf2),src$1=null!==(_document$currentScri=null===(_document$currentScri2=document.currentScript)||void 0===_document$currentScri2?void 0:_document$currentScri2.src)&&void 0!==_document$currentScri?_document$currentScri:"https://tosv.byted.org/obj/lux/sdk/@byted/veplayer/".concat("2.4.2-rc.5","/object/umd/"),baseUrl=_sliceInstanceProperty(src$1).call(src$1,0,_lastIndexOfInstanceProperty(src$1).call(src$1,"/")),loader=new Loader({baseUrl:baseUrl}),registerPlugin=loader.registerPlugin,register2=loader.register;function setModuleSystem(e){loader.setModuleSystem(e)}function load(e,t){return _load.apply(this,arguments)}function _load(){return(_load=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,loader.load(t,r);case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),create$2(ErrorCode$1.MODULE_LOAD_ERROR,{ext:{name:t,cdn:null===e.t0||void 0===e.t0||null===(n=e.t0.target)||void 0===n?void 0:n.src},error:e.t0});case 9:case"end":return e.stop()}}),e,null,[[0,6]])})))).apply(this,arguments)}var appendSearchParams=function(e,t){var r,n=getUrlObject(e);if(!e||!n)return null!==(r=e)&&void 0!==r?r:"";var i,o=_startsWithInstanceProperty(e).call(e,"//");for(var a in t){var s,l,c=t[a];if(null!=n&&n.searchParams.has(a))null==n||null===(s=n.searchParams)||void 0===s||s.set(a,c);else null==n||null===(l=n.searchParams)||void 0===l||l.append(a,c)}return e=n.toString(),o?null===(i=e)||void 0===i?void 0:i.replace(location.protocol,""):e},getUrlObject=function(e){if(e){_startsWithInstanceProperty(e).call(e,"//")&&(e=location.protocol+e);try{return new _URL(e)}catch(e){return}}};function isType(e){return function(t){var r;return null==t?void 0:_includesInstanceProperty(r=t.split("?")[0].toLowerCase()).call(r,e)}}var isHls=isType(".m3u8"),isMp4=isType(".mp4"),isFlv=isType(".flv"),isRtm=isType(".sdp"),isDash=isType(".mpd");function getStreamType(e){return isHls(e)?"hls":isFlv(e)?"flv":isRtm(e)?"rtm":isMp4(e)?"mp4":isDash(e)?"dash":"unknown"}function isMseSupported(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Codec.H264)===Codec.H265?sniffer$1.isHevcSupported():sniffer$1.isMSESupport()}function isSoftDecodeSupported(){return _isSoftDecodeSupported.apply(this,arguments)}function _isSoftDecodeSupported(){return(_isSoftDecodeSupported=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,load(DynamicModule.PluginXgvideo);case 2:return t=e.sent,r=t.XGVideoPlugin,e.abrupt("return",null==r?void 0:r.isSupported());case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var util=_objectSpread2$2(_objectSpread2$2({},util$1),{},{getStreamType:getStreamType,isMseSupported:isMseSupported,isSoftDecodeSupported:isSoftDecodeSupported,appendSearchParams:appendSearchParams,getUrlObject:getUrlObject}),autoplay="",isWeixin=sniffer$1.isWeixin,os=sniffer$1.os,device=sniffer$1.device,isAndroid$1=os.isAndroid,isIos=os.isIos,isMobile="mobile"===device,last=0,USER_AUTOPLAY_TRIGGERED=!1,Autoplay=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(e){var n;return _classCallCheck$1(this,r),_defineProperty$2(_assertThisInitialized(n=t.call(this,e)),"_hasSetUserAutoplay",void 0),_defineProperty$2(_assertThisInitialized(n),"_timer",void 0),_defineProperty$2(_assertThisInitialized(n),"_wxTimer",void 0),_defineProperty$2(_assertThisInitialized(n),"_state",{mode:0,showUnmuteBt:!1}),_defineProperty$2(_assertThisInitialized(n),"userClickPlay",(function(){if(!USER_AUTOPLAY_TRIGGERED){var e=n.player.play();e&&e.then?e.then((function(){console.log("user action autoplay success"),USER_AUTOPLAY_TRIGGERED=!0})).catch((function(e){console.warn("user action autoplay fail:",e)})):(console.warn("no play promise"),USER_AUTOPLAY_TRIGGERED=!0)}})),n}return _createClass$2(r,[{key:"afterCreate",value:function(){this.initState(),this.initEvents(),this.setWXAutoPlay()}},{key:"updateLang",value:function(){this.renderUnmuteBt()}},{key:"initState",value:function(){this._state.mode=this.player.muted?1:0}},{key:"initEvents",value:function(){this.player.on(AUTOPLAY_PREVENTED,this.handleAutoplayPrevented.bind(this)),this.player.on(AUTOPLAY_STARTED,this.handleAutoplayStart.bind(this)),this.player.on(VOLUME_CHANGE,this.handleVolumechange.bind(this)),this.setUserActionAutoPlay()}},{key:"setWXAutoPlay",value:function(){isWeixin&&this.player.config.autoplay&&this.config.enableWxJsBridgeAutoplay&&(window.WeixinJSBridge?this.wxPlay():document.addEventListener("WeixinJSBridgeReady",this.wxPlay.bind(this),!1))}},{key:"wxCanPlayFn",value:function(){var e=this;window.WeixinJSBridge&&window.WeixinJSBridge.invoke("getNetworkType",{},(function(){e._wxTimer=window.setTimeout((function(){e._wxTimer&&clearTimeout(e._wxTimer);var t=e.player.play();t&&t.then?t.then((function(){console.log("wechat autoplay success")})).catch((function(t){console.warn("wechat autoplay fail:",t),e._state.showUnmuteBt=!1,e.renderUnmuteBt()})):console.warn("wechat browser no play promise")}))}))}},{key:"wxPlay",value:function(){this.player.readyState>=2?this.wxCanPlayFn():isAndroid$1?this.player.once(CANPLAY,this.wxCanPlayFn.bind(this)):isIos&&this.player.once(COMPLETE,this.wxCanPlayFn.bind(this))}},{key:"setUserActionAutoPlay",value:function(){var e=this;this.config.enableUserActionAutoplay&&this.player.once(BaseEvents.AUTOPLAY_FAIL,(function(){e._hasSetUserAutoplay=!0,(e.config.userActionDom instanceof window.Node?e.config.userActionDom:window.document.body).addEventListener("click",e.userClickPlay,!1)}))}},{key:"handleAutoplayPrevented",value:function(){return 0===this._state.mode?(console.warn("unmute autoplay fail"),this.player.emit(BaseEvents.AUTOPLAY_FAIL,{mode:"unmute"}),isAndroid$1&&isWeixin?void(this._state.mode=2):void(this.config.enableDegradeMuteAutoplay&&this.changeMuteMode())):1===this._state.mode?(console.warn("mute autoplay fail"),this.player.emit(BaseEvents.AUTOPLAY_FAIL,{mode:"mute"}),void(this._state.mode=2)):2===this._state.mode?(this.player.emit(BaseEvents.AUTOPLAY_FAIL,{mode:"noSupport"}),void console.warn("not support autoplay")):void 0}},{key:"changeMuteMode",value:function(){var e=this;this.player.muted=!0,this._state.showUnmuteBt=!0,this._state.mode=1,this.renderUnmuteBt(),this._timer=window.setTimeout((function(){e._timer&&window.clearTimeout(e._timer);var t=e.player.play();t&&t.then?t.then((function(){console.log("degrade mute autoplay success")})).catch((function(t){console.warn("degrade mute autoplay fail:",t),e.player.muted=!1,e._state.showUnmuteBt=!1,e.renderUnmuteBt()})):console.warn("no play promise")}))}},{key:"handleAutoplayStart",value:function(){if(0!==this._state.mode)return 1===this._state.mode?(this.player.emit(BaseEvents.AUTOPLAY_SUCCESS,{mode:"mute"}),this._state.showUnmuteBt=!0,void this.renderUnmuteBt()):2===this._state.mode?(this.player.emit(BaseEvents.AUTOPLAY_SUCCESS,{mode:"click"}),this.player.muted=!1,this._state.showUnmuteBt=!1,void this.renderUnmuteBt()):void 0;this.player.emit(BaseEvents.AUTOPLAY_SUCCESS,{mode:"unmute"})}},{key:"handleVolumechange",value:function(){this._state.showUnmuteBt&&(this._state.showUnmuteBt=!1,this.renderUnmuteBt(),this.player.paused&&this.player.readyState>=1&&this.player.play())}},{key:"renderUnmuteBt",value:function(){var e=this.root,t=this.player.config.i18nManager;if(e&&(e.innerHTML="",this._state.showUnmuteBt)){var r=t.getText("UNMUTE"),n=util$1.createDom("div",r,void 0,"veplayer-unmute-bt");e.appendChild(n),this.bind(".veplayer-unmute-bt","click",this.cancelUnmute.bind(this)),this.bind(".veplayer-unmute-bt","touchend",this.cancelUnmute.bind(this))}}},{key:"cancelUnmute",value:function(){var e=Date.now();if(e-last>200){last=e,this.player.muted=!1,this._state.showUnmuteBt=!1,this.renderUnmuteBt(),this.emit(BaseEvents.AUTOPLAY_UNMUTE);var t="mobile"===sniffer$1.device,r=isRtm(this.player.config.url);t&&r&&(this.player.volume>.5?this.player.volume=this.player.volume-.1:this.player.volume=this.player.volume+.1)}}},{key:"destroy",value:function(){if(this.player.off(AUTOPLAY_PREVENTED,this.handleAutoplayPrevented.bind(this)),this.player.off(AUTOPLAY_STARTED,this.handleAutoplayStart.bind(this)),this.player.off(VOLUME_CHANGE,this.handleVolumechange.bind(this)),this._timer&&window.clearTimeout(this._timer),this._wxTimer&&window.clearTimeout(this._wxTimer),document.removeEventListener("WeixinJSBridgeReady",this.wxPlay.bind(this),!1),this._hasSetUserAutoplay){var e=isMobile?"touch":"click";(this.config.userActionDom instanceof window.Node?this.config.userActionDom:window.document.body).removeEventListener(e,this.userClickPlay,!1)}}},{key:"render",value:function(){return'<div class="veplayer-unmute"></div>'}}],[{key:"pluginName",get:function(){return"autoplayPlugin"}},{key:"defaultConfig",get:function(){return{position:Plugin.POSITIONS.ROOT,enableDegradeMuteAutoplay:!1,enableWxJsBridgeAutoplay:!1,userActionDom:window.document.body,enableUserActionAutoplay:!1}}}]),r}(),$$6=_export,$values=objectToArray.values;$$6({target:"Object",stat:!0},{values:function(e){return $values(e)}});var path$5=path$x,values$5=path$5.Object.values,parent$t=values$5,values$4=parent$t,parent$s=values$4,values$3=parent$s,parent$r=values$3,values$2=parent$r,values$1=values$2,values3=values$1,_Object$values=getDefaultExportFromCjs(values3),topRightBar="";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 _context$2,_context2,More=function(e){_inherits(r,OptionsIcon);var t=_createSuper(r);function r(){return _classCallCheck$1(this,r),t.apply(this,arguments)}return _createClass$2(r,[{key:"onItemClick",value:function(){}},{key:"onOptionClick",value:function(){this.toggle(!1)}},{key:"updateLang",value:function(){var e,t=this,r=this.player.config.i18nManager;null===(e=this.config.plugins)||void 0===e||e.forEach((function(e){var n,i=null!==(n=r.normalize(e.textTips))&&void 0!==n?n:e.pluginName;if(t.player.root){var o=util$1.findDom(t.player.root,".panel-plugin-".concat(e.pluginName," .panel-icon-bt-text"));o&&(o.innerHTML=i)}}))}},{key:"beforeCreate",value:function(e){var t,r=e.player.config.i18nManager;e.config.list=null===(t=e.config.plugins)||void 0===t?void 0:_mapInstanceProperty(t).call(t,(function(t,n){var i,o=util$1.createDom("div","",{},"panel-icon-bt panel-plugin-".concat(t.pluginName)),a=util$1.createDom("div","",{},"panel-icon-svg"),s=null!==(i=r.normalize(t.textTips))&&void 0!==i?i:t.pluginName;return o.appendChild(a),o.appendChild(util$1.createDom("span",s,{"plugin-index":n},"panel-icon-bt-text")),{showText:o,plugin:e.player.registerPlugin({plugin:t,options:{root:a}})}}))}},{key:"hideChild",value:function(e){if(e){var t;null===(t=e.hide)||void 0===t||t.call(e);var r=document.querySelector(".panel-plugin-".concat(e.pluginName));r&&util$1.addClass(r,"hide")}}},{key:"showChild",value:function(e){if(e){var t;null===(t=e.show)||void 0===t||t.call(e);var r=document.querySelector(".panel-plugin-".concat(e.pluginName));r&&util$1.removeClass(r,"hide")}}},{key:"registerIcons",value:function(){return{more:{icon:MoreIconSVG}}}}],[{key:"pluginName",get:function(){return"more"}},{key:"defaultConfig",get:function(){return _objectSpread2$2(_objectSpread2$2({},OptionsIcon.defaultConfig),{},{index:1,plugins:[],list:[],hideOnSingleOption:!1,isShowIcon:!0,hidePortrait:!1,renderType:RenderType.Icon,panel:{className:"more-panel-content"}})}}]),r}(),TOP_RIGHT_POSITIONS=function(e){return e.ROOT_TOP_RIGHT="rootTopRight",e.ROOT_TOP_RIGHT_COLLAPSE="rootTopRightCollapse",e}(TOP_RIGHT_POSITIONS||{}),TopRightBar=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(){return _classCallCheck$1(this,r),t.apply(this,arguments)}return _createClass$2(r,[{key:"registerIcons",value:function(){return{more:{icon:MoreIconSVG,class:"xgplayer-more-svg"}}}},{key:"children",value:function(){var e=this,t=this._getPlugins(),r=t.plugins,n=t.collapsePlugins,i={};return r.forEach((function(t){i[t.pluginName]={plugin:t,options:{root:e.root}}})),n.length&&(i[More.pluginName]={plugin:More,options:{root:this.root,plugins:n}}),i}},{key:"render",value:function(){return'<xg-right-grid class="xg-right-grid xgplayer-rightTop-iconList"></xg-right-grid>'}},{key:"_getPlugins",value:function(){var e,t=this,r=[],n=[],i=null===(e=this.player.config.ignores)||void 0===e?void 0:_mapInstanceProperty(e).call(e,(function(e){return e.toLowerCase()}));return this.config.plugins.forEach((function(e){var o,a=e.pluginName.toLowerCase();null!=i&&_includesInstanceProperty(i).call(i,a)||("rootTopRight"===(null!==(o=t.player.config[a].position)&&void 0!==o?o:e.defaultConfig.position)?r.push(e):n.push(e))})),{plugins:null!=r?r:[],collapsePlugins:null!=n?n:[]}}}],[{key:"pluginName",get:function(){return"topRightBar"}},{key:"defaultConfig",get:function(){return{position:Plugin.POSITIONS.ROOT_TOP,plugins:[]}}},{key:"isTopRightPlugin",value:function(e,t){var r,n,i,o,a,s=null!==(n=null===(i=t[null==e||null===(r=e.pluginName)||void 0===r?void 0:r.toLowerCase()])||void 0===i?void 0:i.position)&&void 0!==n?n:null==e||null===(o=e.defaultConfig)||void 0===o?void 0:o.position;return!!_includesInstanceProperty(a=_Object$values(TOP_RIGHT_POSITIONS)).call(a,s)}}]),r}(),BASE_PLUGINS=[Play$1,Fullscreen,Volume,MiniScreen,PIP,Poster,Start,Loading,Enter,Error$1,Toast,Sources,DefinitionPlugin,Autoplay],DEFAULT_PC_PLUGINS=_concatInstanceProperty(_context$2=[]).call(_context$2,BASE_PLUGINS,[Keyboard,PCPlugin,TopRightBar]),DEFAULT_MOBILE_PLUGINS=_concatInstanceProperty(_context2=[]).call(_context2,BASE_PLUGINS,[MobilePlugin,TopRightBar]),DEFAULT_PLUGINS="pc"===sniffer$1.device?DEFAULT_PC_PLUGINS:DEFAULT_MOBILE_PLUGINS;function FullscreenActive(){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 FullscreenActiveMobile(){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 FullscreenDefault(){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 FullscreenDefaultMobile(){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 Pause(){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 Play(){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 Replay(){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 StartPlay(){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 VolumeLarge(){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 VolumeMuted(){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 VolumeSmall(){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 DEFAULT_BASE_ICONS={startPlay:StartPlay,play:Play,pause:Pause,fullscreen:FullscreenDefault,exitFullscreen:FullscreenActive,replay:Replay,volumeLarge:VolumeLarge,volumeMuted:VolumeMuted,volumeSmall:VolumeSmall},DEFAULT_PC_ICONS=_objectSpread2$2(_objectSpread2$2({},DEFAULT_BASE_ICONS),{},{fullscreen:FullscreenDefault,exitFullscreen:FullscreenActive}),DEFAULT_MOBILE_ICONS=_objectSpread2$2(_objectSpread2$2({},DEFAULT_BASE_ICONS),{},{fullscreen:FullscreenDefaultMobile,exitFullscreen:FullscreenActiveMobile}),DEFAULT_ICONS="pc"===sniffer$1.device?DEFAULT_PC_ICONS:DEFAULT_MOBILE_ICONS,EN$1=_objectSpread2$2(_objectSpread2$2({},EN$2.TEXT),{},{DEFINITION_FALLBACK_TOAST:"The current network is unstable, it is recommended to switch to ",DEFINITION_SWITCHING:"Switching to",ERROR_REFRESH:"Refresh",UNMUTE:"Click to unmute",MANIFEST:"Video parsing error",NETWORK:"Network error",NETWORK_TIMEOUT:"Network timeout",NETWORK_FORBIDDEN:"Authentication error",NETWORK_NOTFOUND:"Stream does not exist",DEMUX:"Video parsing error",REMUX:"Video parsing error",MEDIA:"An error occurred, Please try again",MEDIA_ERR_CODEC_NOT_SUPPORTED:"Audio/video codec is not supported",MEDIA_ERR_URL_EMPTY:"The stream address is not specified",DRM:"Permission verification failed",DRM_LICENSE:"Commercial DRM Permission verification failed",OTHER:"Unknown error",RUNTIME:"An error occurred, Please try again",MODULE_LOAD_ERROR:"CDN fetch error",UNKNOWN:"Unknown error"}),ZH_CN$1=_objectSpread2$2(_objectSpread2$2({},ZH.TEXT),{},{DEFINITION_FALLBACK_TOAST:"当前网络不稳定,建议切换到",DEFINITION_SWITCHING:"正在切换至",ERROR_REFRESH:"刷新",UNMUTE:"点击取消静音",MANIFEST:"视频解析错误",NETWORK:"网络错误",NETWORK_TIMEOUT:"网络超时",NETWORK_FORBIDDEN:"鉴权异常",NETWORK_NOTFOUND:"播放地址不存在",DEMUX:"视频解析错误",REMUX:"视频解析错误",MEDIA:"播放异常,请重试",MEDIA_ERR_CODEC_NOT_SUPPORTED:"不支持的音频/视频格式",MEDIA_ERR_URL_EMPTY:"当前播放地址为空",DRM:"权限验证失败",DRM_LICENSE:"商业 DRM LICENSE 鉴权失败",OTHER:"其他报错",RUNTIME:"播放异常,请重试",MODULE_LOAD_ERROR:"插件模块加载异常",UNKNOWN:"未知报错"}),VeI18n=function(){function e(t){var r;if(_classCallCheck$1(this,e),_defineProperty$2(this,"_lang",void 0),this._lang=(null==t?void 0:t.lang)||getLang()||"en","zh"===this._lang&&(this._lang="zh-cn"),null!=t&&null!==(r=t.i18n)&&void 0!==r&&r.texts){var n,i,o=_mapInstanceProperty(n=_Object$entries(null==t||null===(i=t.i18n)||void 0===i?void 0:i.texts)).call(n,(function(e){var t=_slicedToArray(e,2);return{LANG:t[0],TEXT:t[1]}}));e.extend(o)}}return _createClass$2(e,[{key:"setLang",value:function(e){this._lang=e}},{key:"getLang",value:function(){return this._lang}},{key:"normalize",value:function(e){return e?"string"==typeof e?e:e[this._lang]:""}},{key:"getText",value:function(e){var t,r,n;if(e){var i=null==I18N?void 0:I18N.lang;return null!==(t=null==i||null===(r=i[this._lang])||void 0===r?void 0:r[e])&&void 0!==t?t:null==i||null===(n=i.en)||void 0===n?void 0:n[e]}}}],[{key:"langKeys",get:function(){return I18N.langKeys}},{key:"isLangValid",value:function(e){var t;return _includesInstanceProperty(t=I18N.langKeys).call(t,e)||"zh"===e}},{key:"extend",value:function(e,t){I18N.extend(e,t)}}]),e}(),veplayerBase="",_excluded$2=["autoplay"],XGPosition=Plugin.POSITIONS,POSITIONS$1=_objectSpread2$2(_objectSpread2$2({},XGPosition),TOP_RIGHT_POSITIONS),DEFAULT_OPTIONS={id:"veplayer",width:"100%",height:"100%",decodeType:DecodeType.Hardware,fullscreen:{useCssFullscreen:!1}},transformOption=function(e){var t,r=e.autoplay,n=_objectWithoutProperties(e,_excluded$2);(n.poster&&(n.poster=escapeHtml(n.poster)),n.icons=_objectSpread2$2(_objectSpread2$2({},DEFAULT_ICONS),n.icons?escapeIcons(n.icons):{}),n.autoplay=Boolean(r),r&&"boolean"!=typeof r)&&(n.autoplayMuted=null==r?void 0:r.muted,n.videoAttributes=_objectSpread2$2(_objectSpread2$2({},null!==(t=n.videoAttributes)&&void 0!==t?t:{}),{},{muted:null==r?void 0:r.muted}),n.autoplayPlugin=r);return delete n.i18n,n},VePlayerBase=function(){function e(){var t,r,n,i,o,a,s,l,c,u,p,f,d=this,h=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck$1(this,e),_defineProperty$2(this,"_player",void 0),_defineProperty$2(this,"_sourceManager",void 0),_defineProperty$2(this,"_preparePlugins",void 0),_defineProperty$2(this,"_previousPrepareResult",void 0),_defineProperty$2(this,"_i18nManager",void 0),_defineProperty$2(this,"_events",{}),_defineProperty$2(this,"_errorCallback",void 0),this._sourceManager=h.sourceManager,this._preparePlugins=h.preparePlugins,this._previousPrepareResult=h.prepareResult,this._i18nManager=null!==(t=h.i18nManager)&&void 0!==t?t:new VeI18n({i18n:h.i18n});var y=transformOption(_objectSpread2$2(_objectSpread2$2({},h),null===(r=this._previousPrepareResult)||void 0===r?void 0:r.options)),g=_concatInstanceProperty(n=[]).call(n,_toConsumableArray$1(null!==(i=null===(o=this._previousPrepareResult)||void 0===o?void 0:o.plugins)&&void 0!==i?i:[]),_toConsumableArray$1(null!==(a=h.plugins)&&void 0!==a?a:DEFAULT_PLUGINS)),_=[],v=[];g.forEach((function(e){TopRightBar.isTopRightPlugin(e,h)?_.push(e):v.push(e)})),this._player=new Player(_objectSpread2$2(_objectSpread2$2(_objectSpread2$2({},DEFAULT_OPTIONS),y),{},{definition:_objectSpread2$2({list:null!==(s=null===(l=this._sourceManager.source)||void 0===l?void 0:l.definitions)&&void 0!==s?s:[],defaultDefinition:null===(c=this._sourceManager.definition)||void 0===c?void 0:c.definition},null!==(u=h.definition)&&void 0!==u?u:{}),url:null===(p=this._sourceManager.definition)||void 0===p?void 0:p.url,sources:_objectSpread2$2(_objectSpread2$2({},null!==(f=h.sources)&&void 0!==f?f:{}),{},{sourceManager:this._sourceManager}),topRightBar:{plugins:_},plugins:v,i18nManager:this._i18nManager,veplayer:this})),this.emit(Events$1.PLAYER_CREATE_FINISH,this._player),this._errorCallback=function(e){return d._handleFallback(e)},this._player.on(ERROR$2,this._errorCallback)}var t,r,n,i,o,a;return _createClass$2(e,[{key:"readyState",get:function(){return this._player.readyState}},{key:"buffered",get:function(){return this._player.buffered}},{key:"played",get:function(){return this._player.played}},{key:"cumulateTime",get:function(){return this._player.cumulateTime}},{key:"isFocused",get:function(){return this._player.isActive}},{key:"isFullscreen",get:function(){return this._player.isFullscreen}},{key:"isCssFullscreen",get:function(){return this._player.isCssfullScreen}},{key:"networkState",get:function(){return this._player.networkState}},{key:"paused",get:function(){return this._player.paused}},{key:"ended",get:function(){return this._player.ended}},{key:"state",get:function(){return this._player.state}},{key:"url",get:function(){return this._player.config.url}},{key:"source",get:function(){var e;return null===(e=this._sourceManager.source)||void 0===e?void 0:e.name}},{key:"playerVersion",get:function(){return"2.4.2-rc.5"}},{key:"definition",get:function(){var e;return null===(e=this._sourceManager.definition)||void 0===e?void 0:e.definition}},{key:"crossOrigin",get:function(){return this._player.crossOrigin},set:function(e){this._player.crossOrigin=e}},{key:"volume",get:function(){return this._player.volume},set:function(e){this._player.volume=e}},{key:"muted",get:function(){return this._player.muted},set:function(e){this._player.muted=e}},{key:"lang",get:function(){return this._i18nManager.getLang()},set:function(e){if(this._player.lang!==e)if(VeI18n.isLangValid(e))this._i18nManager.setLang(e),this._player.lang=e;else{var t,r,n,i,o=VeI18n.langKeys.join(","),a={en:_concatInstanceProperty(t="Sorry, we couldn't set the language to ".concat(e," because it's not currently supported. The list of supported languages includes ")).call(t,o,"."),"zh-cn":_concatInstanceProperty(r="不支持当前设置的语言".concat(e,", 支持的语言有")).call(r,o,", 请重新设置")};console.error((null===(n=this._i18nManager)||void 0===n||null===(i=n.normalize)||void 0===i?void 0:i.call(n,a))||a.en)}}},{key:"_src",get:function(){return this._player.currentSrc}},{key:"switch",value:(a=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i,o,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t||1!==this._sourceManager.sources.length||1!==(null===(n=this._sourceManager.sources)||void 0===n||null===(n=n[0].definitions)||void 0===n?void 0:n.length)){e.next=5;break}return this._sourceManager.updateSources(t),e.next=4,this._switchUrl(t,{seamless:null==r?void 0:r.seamless});case 4:return e.abrupt("return",this._sourceManager.definition);case 5:if(o=_findInstanceProperty(i=this._sourceManager).call(i,t,r)){e.next=8;break}throw new Error("string"==typeof t?"No definition found for url: ".concat(t):_concatInstanceProperty(a="No definition found for source: ".concat(t.source,", definition: ")).call(a,t.definition));case 8:return e.next=10,this._switch(o);case 10:return e.abrupt("return",o);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"updatePlaylist",value:function(e,t){var r=this._sourceManager.updateSources(e,t);return this._switch(r.definition)}},{key:"once",value:function(e,t){var r,n=this._transformEvent(e,t),i=n.xgCallback,o=n.xgEventName;i&&(null!==(r=this._events)&&void 0!==r&&r[e]||(this._events[e]=new _Map),this._events[e].set(t,i),this._player.once(o,i))}},{key:"off",value:function(e,t){var r,n=null===(r=this._events[e])||void 0===r?void 0:r.get(t),i=this._transformEvent(e).xgEventName;n&&(this._player.off(i,n),this._events[e].delete(t))}},{key:"emit",value:function(e,t){var r=this._transformEvent(e).xgEventName;this._player.emit(r,t)}},{key:"offAll",value:function(){this._events={},this._player.offAll()}},{key:"on",value:function(e,t){var r,n=this._transformEvent(e,t),i=n.xgCallback,o=n.xgEventName;i&&(null!==(r=this._events)&&void 0!==r&&r[e]||(this._events[e]=new _Map),this._events[e].set(t,i),this._player.on(o,i))}},{key:"play",value:function(){
3
3
  /* istanbul ignore next -- @preserve */
4
4
  return this._player.play()}},{key:"pause",value:function(){
5
5
  /* istanbul ignore next -- @preserve */
6
6
  return this._player.pause()}},{key:"requestPIP",value:function(){var e;
7
7
  /* istanbul ignore next -- @preserve */null===(e=this._player.plugins.pip)||void 0===e||e.requestPIP()}},{key:"exitPIP",value:function(){var e;
8
- /* istanbul ignore next -- @preserve */null===(e=this._player.plugins.pip)||void 0===e||e.exitPIP()}},{key:"retry",value:function(){return this._player.retry()}},{key:"focus",value:function(e){return this._player.focus(e)}},{key:"blur",value:function(e){return this._player.blur(e)}},{key:"canPlayType",value:function(e){return this._player.canPlayType(e)}},{key:"requestFullscreen",value:function(e){return this._player.getFullscreen(e)}},{key:"exitFullscreen",value:function(e){return this._player.exitFullscreen(e)}},{key:"requestCssFullscreen",value:function(e){return this._player.getCssFullscreen(e)}},{key:"exitCssFullscreen",value:function(){return this._player.exitCssFullscreen()}},{key:"registerPlugin",value:function(e,t){return this._player.registerPlugin(e,t)}},{key:"unRegisterPlugin",value:function(e){return this._player.unRegisterPlugin(e)}},{key:"showIcon",value:function(e){var t=this,r=this._player.getPlugin("more");e.forEach((function(e){var n=t._player.getPlugin(e);n&&null!=n&&n.root&&(n.config.position===POSITIONS$1.ROOT_TOP_RIGHT_COLLAPSE?null==r||r.showChild(n):n.show())}))}},{key:"hideIcon",value:function(e){var t=this,r=this._player.getPlugin("more");e.forEach((function(e){var n=t._player.getPlugin(e);n&&null!=n&&n.root&&(n.config.position===POSITIONS$1.ROOT_TOP_RIGHT_COLLAPSE?null==r||r.hideChild(n):n.hide())}))}},{key:"destroy",value:function(){this._player.off(ERROR$2,this._errorCallback),this._player.destroy()}},{key:"prepare",value:(o=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o,a,s,l,c,u=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this._preparePlugins)||void 0===r?void 0:r.call(this,t);case 2:return a=e.sent,s=this._diffPlugins(null!==(n=null===(i=this._previousPrepareResult)||void 0===i?void 0:i.plugins)&&void 0!==n?n:[],null!==(o=null==a?void 0:a.plugins)&&void 0!==o?o:[]),l=s.removedPlugins,c=s.addedPlugins,null==l||l.forEach((function(e){
8
+ /* istanbul ignore next -- @preserve */null===(e=this._player.plugins.pip)||void 0===e||e.exitPIP()}},{key:"retry",value:function(){return this._player.retry()}},{key:"focus",value:function(e){return this._player.focus(e)}},{key:"blur",value:function(e){return this._player.blur(e)}},{key:"canPlayType",value:function(e){return this._player.canPlayType(e)}},{key:"requestFullscreen",value:function(e){return this._player.getFullscreen(e)}},{key:"exitFullscreen",value:function(e){return this._player.exitFullscreen(e)}},{key:"requestCssFullscreen",value:function(e){return this._player.getCssFullscreen(e)}},{key:"exitCssFullscreen",value:function(){return this._player.exitCssFullscreen()}},{key:"registerPlugin",value:function(e,t){return this._player.registerPlugin(e,t)}},{key:"unRegisterPlugin",value:function(e){return this._player.unRegisterPlugin(e)}},{key:"showIcon",value:function(e){var t=this,r=this._player.getPlugin("more");e.forEach((function(e){var n=t._player.getPlugin(e);n&&null!=n&&n.root&&(n.config.position===POSITIONS$1.ROOT_TOP_RIGHT_COLLAPSE?null==r||r.showChild(n):n.show())}))}},{key:"hideIcon",value:function(e){var t=this,r=this._player.getPlugin("more");e.forEach((function(e){var n=t._player.getPlugin(e);n&&null!=n&&n.root&&(n.config.position===POSITIONS$1.ROOT_TOP_RIGHT_COLLAPSE?null==r||r.hideChild(n):n.hide())}))}},{key:"destroy",value:function(){this._player.off(ERROR$2,this._errorCallback),this._player.controls=null,this._player.destroy()}},{key:"prepare",value:(o=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o,a,s,l,c,u=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this._preparePlugins)||void 0===r?void 0:r.call(this,t);case 2:return a=e.sent,s=this._diffPlugins(null!==(n=null===(i=this._previousPrepareResult)||void 0===i?void 0:i.plugins)&&void 0!==n?n:[],null!==(o=null==a?void 0:a.plugins)&&void 0!==o?o:[]),l=s.removedPlugins,c=s.addedPlugins,null==l||l.forEach((function(e){
9
9
  /* istanbul ignore next -- @preserve */
10
- u._player.unRegisterPlugin(e)})),this._previousPrepareResult=a,null!=a&&a.options&&this._player.setConfig(a.options),e.abrupt("return",{plugins:_mapInstanceProperty(c).call(c,(function(e){return u._player.registerPlugin(e)})),options:null==a?void 0:a.options});case 8:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"_handleFallback",value:(i=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._player.addClass(STATE_CLASS.ENTER),r=this._sourceManager.url,n=this._sourceManager.fallback()){e.next=7;break}return this._player.removeClass(STATE_CLASS.ENTER),this.emit(Events$1.FALLBACK_ERROR,transform$1(t,this._i18nManager)),e.abrupt("return");case 7:this._player.once("canplay",(function(){i._sourceManager.resetFallback()})),this.emit(Events$1.FALLBACK,{from:{url:r},to:{url:n}}),this._switchUrl(n);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_transformEvent",value:function(e,t){var r=this;return e===ERROR$2?{xgCallback:t?function(e){t(transform$1(e,r._i18nManager))}:void 0,xgEventName:e}:transform(e,t)}},{key:"_switch",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o,a,s,l,c;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=clonedeep(this._sourceManager.definition),e.next=3,this.prepare(t.url);case 3:if(e.t0=e.sent,e.t0){e.next=6;break}e.t0={};case 6:if(s=e.t0,l=s.plugins,null!=(c=s.options)&&c.url&&(t.url=null==c?void 0:c.url),this._sourceManager.switch(t),null===(r=this._player)||void 0===r||null===(r=r.plugins)||void 0===r||r.sources.renderItemList(),null===(n=this._player)||void 0===n||null===(n=n.plugins)||void 0===n||n.definition.renderItemList(),(null==t||null===(i=t.source)||void 0===i?void 0:i.name)!==(null==a||null===(o=a.source)||void 0===o?void 0:o.name)&&this.emit(Events$1.SOURCE_CHANGE),null==l||!l.length){e.next=21;break}return this.emit(Events$1.DEFINITION_CHANGE),e.next=18,this._callBeforePlayerInitForUrl(l,t.url);case 18:this.emit(Events$1.AFTER_DEFINITION_CHANGE),e.next=22;break;case 21:this._player.changeDefinition(t,a);case 22:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_switchUrl",value:(r=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i,o,a,s,l,c,u=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.prepare(t);case 2:if(e.t0=e.sent,e.t0){e.next=5;break}e.t0={};case 5:if(i=e.t0,o=i.plugins,a=i.options,s=null!==(n=null==a?void 0:a.url)&&void 0!==n?n:t,this._sourceManager.url=s,null==o||!o.length){e.next=14;break}this._callBeforePlayerInitForUrl(o,s),e.next=21;break;case 14:if(l=this._player.switchURL(s,{seamless:null==r?void 0:r.seamless}),c=this._player.currentTime,!l||!l.then){e.next=20;break}return e.abrupt("return",l);case 20:return e.abrupt("return",new _Promise((function(e){var t=u._player.paused&&!u._player.isError,r=function(){u._player.currentTime=c,t&&u._player.once(CANPLAY,(function(){u._player.pause()})),e()};sniffer$1.os.isAndroid?u.once(TIME_UPDATE,(function(){r()})):u.once(CANPLAY,(function(){r()})),u._player.play()})));case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_diffPlugins",value:function(e,t){var r=_mapInstanceProperty(e).call(e,(function(e){return e.pluginName})),n=_mapInstanceProperty(t).call(t,(function(e){return e.pluginName}));return{removedPlugins:_filterInstanceProperty(r).call(r,(function(e){return!_includesInstanceProperty(n).call(n,e)})),addedPlugins:_filterInstanceProperty(t).call(t,(function(e){return!_includesInstanceProperty(r).call(r,e.pluginName)}))}}},{key:"_callBeforePlayerInitForUrl",value:function(e,t){var r=this;return new _Promise((function(n){r._player.config.url=t,null==e||e.forEach((function(e){e.beforePlayerInit()})),r._player.on(Events$1.CANPLAY,(function(){n(void 0)}))}))}}],[{key:"create",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function t(){var r,n,i,o,a,s,l,c,u=arguments;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=u.length>0&&void 0!==u[0]?u[0]:{},a=u.length>1?u[1]:void 0,s=new SourceManager({sources:Source.normalize({url:o.url,fallbackUrls:o.fallbackUrls,sources:o.playlist}),url:o.url,defaultSource:o.defaultSource,defaultDefinition:o.defaultDefinition,maxFallbackRound:o.maxFallbackRound}),t.next=5,null==o||null===(r=o.preparePlugins)||void 0===r?void 0:r.call(o,null!==(n=s.url)&&void 0!==n?n:"");case 5:return null!=(l=t.sent)&&null!==(i=l.options)&&void 0!==i&&i.url&&(s.url=null==l||null===(c=l.options)||void 0===c?void 0:c.url),o.url=s.url,t.abrupt("return",new(null!=a?a:e)(_objectSpread2$2(_objectSpread2$2({},o),{},{prepareResult:l,sourceManager:s})));case 9:case"end":return t.stop()}}),t)}))),function(){return t.apply(this,arguments)})}]),e}();function concatBuffer(e){var t=_reduceInstanceProperty(e).call(e,(function(e,t){return e+t.byteLength}),0),r=new Uint8Array(t),n=0;return e.forEach((function(e){r.set(e,n),n+=e.byteLength})),r}function timeFixed(e,t){return _parseFloat$7(null==e?void 0:e.toFixed(t||4))}var __defProp$6=_Object$defineProperty,__defNormalProp$6=function(e,t,r){return t in e?__defProp$6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},__publicField$6=function(e,t,r){return __defNormalProp$6(e,"symbol"!==_typeof$1(t)?t+"":t,r),r},PACKET_TYPE={SCRIPT:"ScriptData",SEQUENCE:"Sequence_Header",RAW:"RawData"},AUDIO_RATE=[5500,11e3,22e3,44e3],AUDIO_CODEC_TYPE={AAC:"aac",PCMA:"pcma",PCMU:"pcmu"},VIDEO_CODEC_TYPE={AVC:"avc",HEVC:"bytevc1"},FlvTagView=function(){function e(t){var r=this;_classCallCheck$1(this,e),__publicField$6(this,"type",0),__publicField$6(this,"tagSize",0),__publicField$6(this,"timestamp",0),__publicField$6(this,"duration",0),__publicField$6(this,"header",null),__publicField$6(this,"body",null),__publicField$6(this,"bodyView",null),__publicField$6(this,"tailsize",null),_Object$keys(t).forEach((function(e){r[e]=t[e]}))}return _createClass$2(e,[{key:"streamType",get:function(){switch(this.type){case 18:return"scriptData";case 9:return"video";case 8:return"audio"}}},{key:"packetType",get:function(){var e;return null==(e=this.bodyView)?void 0:e.packetType}},{key:"frameType",get:function(){var e;return null==(e=this.bodyView)?void 0:e.frameType},set:function(e){this.bodyView.frameType=e}},{key:"dts",get:function(){return this.timestamp}},{key:"pts",get:function(){var e;return((null==(e=this.bodyView)?void 0:e.cts)||0)+this.timestamp}},{key:"ptsTime",get:function(){return this.pts?timeFixed(this.pts/1e3):0}},{key:"dtsTime",get:function(){return this.dts?timeFixed(this.dts/1e3):0}},{key:"sampleView",get:function(){var e,t,r;if("Sequence_Header"!==(null==(e=this.bodyView)?void 0:e.packetType)&&18!==this.type)return{dts:this.timestamp,pts:((null==(t=this.bodyView)?void 0:t.cts)||0)+this.timestamp,data:this._getSampleData(),units:null==(r=this.bodyView)?void 0:r.units}}},{key:"size",get:function(){var e,t;return null==(t=null==(e=this.sampleView)?void 0:e.data)?void 0:t.length}},{key:"data",get:function(){return this._getSampleData()}},{key:"nalTypes",get:function(){var e,t;return null==(t=null==(e=this.bodyView)?void 0:e.units)?void 0:_mapInstanceProperty(t).call(t,(function(e){return e.type}))}},{key:"nalSizes",get:function(){var e,t;return null==(t=null==(e=this.bodyView)?void 0:e.units)?void 0:_mapInstanceProperty(t).call(t,(function(e){return e.unit.length}))}},{key:"keyframe",get:function(){return"I"===this.frameType}},{key:"isSample",get:function(){return"scriptData"!==this.streamType&&"Sequence_Header"!==this.packetType}},{key:"isVideo",get:function(){return this.isSample&&"video"===this.streamType}},{key:"isAudio",get:function(){return this.isSample&&"audio"===this.streamType}},{key:"isSqHeader",get:function(){return"Sequence_Header"===this.packetType}},{key:"timescale",get:function(){return 1e3}},{key:"isHevc",get:function(){var e;return"bytevc1"===(null==(e=this.bodyView)?void 0:e.codecType)}},{key:"_getSampleData",value:function(){var e,t;if("audio"===this.streamType)return this.bodyView.sample;var r=(null==(t=this.bodyView)?void 0:_filterInstanceProperty(e=t.units).call(e,(function(e){return!e.isSei})))||[],n=_reduceInstanceProperty(r).call(r,(function(e,t){return e+(t.unit.byteLength+4)}),0),i=new Uint8Array(n),o=0;return r.forEach((function(e){i.set([0,0,0,1],o),o+=4,i.set(e.unit,o),o+=e.unit.byteLength})),i}}]),e}(),UTF8=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,null,[{key:"decode",value:function(t){for(var r=[],n=t,i=0,o=t.length;i<o;)if(n[i]<128)r.push(String.fromCharCode(n[i])),++i;else{if(n[i]<192);else if(n[i]<224){if(e._checkContinuation(n,i,1)){var a=(31&n[i])<<6|63&n[i+1];if(a>=128){r.push(String.fromCharCode(65535&a)),i+=2;continue}}}else if(n[i]<240){if(e._checkContinuation(n,i,2)){var s=(15&n[i])<<12|(63&n[i+1])<<6|63&n[i+2];if(s>=2048&&55296!=(63488&s)){r.push(String.fromCharCode(65535&s)),i+=3;continue}}}else if(n[i]<248&&e._checkContinuation(n,i,3)){var l=(7&n[i])<<18|(63&n[i+1])<<12|(63&n[i+2])<<6|63&n[i+3];if(l>65536&&l<1114112){l-=65536,r.push(String.fromCharCode(l>>>10|55296)),r.push(String.fromCharCode(1023&l|56320)),i+=4;continue}}r.push(String.fromCharCode(65533)),++i}return r.join("")}},{key:"_checkContinuation",value:function(e,t,r){var n=e;if(t+r<n.length){for(;r--;)if(128!=(192&n[++t]))return!1;return!0}return!1}}]),e}(),AMF=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,null,[{key:"parse",value:function(t){if(!(t.length<3)){var r={},n=e._parseValue(new DataView(t.buffer,t.byteOffset,t.byteLength));try{var i=e._parseValue(new DataView(t.buffer,t.byteOffset+n.size,t.byteLength-n.size));r[n.data]=i.data}catch(e){}return r}}},{key:"_parseValue",value:function(t){var r,n=t.byteLength,i=1,o=!1;switch(t.getUint8(0)){case 0:r=t.getFloat64(1),i+=8;break;case 1:r=!!t.getUint8(1),i+=1;break;case 2:var a=e._parseString(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i));r=a.data,i+=a.size;break;case 3:r={};var s=0;for(9==(16777215&t.getUint32(n-4))&&(s=3);i<n-4;){var l=e._parseObject(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i-s)),c=l.size,u=l.data;if(l.isEnd)break;r[u.name]=u.value,i+=c}if(i<=n-3)9===(16777215&t.getUint32(i-1))&&(i+=3);break;case 8:r={},i+=4;var p=0;for(9==(16777215&t.getUint32(n-4))&&(p=3);i<n-8;){var f=e._parseObject(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i-p)),d=f.size,h=f.data;if(f.isEnd)break;r[h.name]=h.value,i+=d}if(i<=n-3)9===(16777215&t.getUint32(i-1))&&(i+=3);break;case 9:r=void 0,i=1,o=!0;break;case 10:r=[];var y=t.getUint32(1);i+=4;for(var g=0;g<y;g++){var _=e._parseValue(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i)),v=_.data,m=_.size;r.push(v),i+=m}break;case 11:var $=t.getFloat64(i)+6e4*t.getInt16(i+8);r=new Date($),i+=10;break;case 12:var b=t.getUint32(1);i+=4,r="",b>0&&(r=UTF8.decode(new Uint8Array(t.buffer,t.byteOffset+i,b))),i+=b;break;default:i=n}return{data:r,size:i,isEnd:o}}},{key:"_parseString",value:function(e){var t=e.getUint16(0),r="";return t>0&&(r=UTF8.decode(new Uint8Array(e.buffer,e.byteOffset+2,t))),{data:r,size:2+t}}},{key:"_parseObject",value:function(t){if(!(t.byteLength<3)){var r=e._parseString(t),n=e._parseValue(new DataView(t.buffer,t.byteOffset+r.size,t.byteLength-r.size));return{data:{name:r.data,value:n.data},size:r.size+n.size,isEnd:n.isEnd}}}}]),e}(),isBrowser="undefined"!=typeof window,ua=isBrowser&&navigator.userAgent.toLocaleLowerCase(),isFirefox=isBrowser&&_includesInstanceProperty(ua).call(ua,"firefox"),isAndroid=isBrowser&&_includesInstanceProperty(ua).call(ua,"android"),__defProp$5=_Object$defineProperty,__defNormalProp$5=function(e,t,r){return t in e?__defProp$5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},__publicField$5=function(e,t,r){return __defNormalProp$5(e,"symbol"!==_typeof$1(t)?t+"":t,r),r},_AAC=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,null,[{key:"parseADTS",value:function(t,r){for(var n=t.length,i=0;i+2<n&&(255!==t[i]||240!=(246&t[i+1]));)i++;if(!(i>=n)){var o=i,a=[],s=(60&t[i+2])>>>2,l=e.FREQ[s];if(!l)throw new Error("Invalid sampling index: ".concat(s));for(var c,u,p=1+((192&t[i+2])>>>6),f=(1&t[i+2])<<2|(192&t[i+3])>>>6,d=e._getConfig(s,f,p),h=d.config,y=d.codec,g=0,_=e.getFrameDuration(l);i+7<n;)if(255===t[i]&&240==(246&t[i+1])){if(n-i<(u=(3&t[i+3])<<11|t[i+4]<<3|(224&t[i+5])>>5))break;c=2*(1&~t[i+1]);var v=timeFixed(r+g*_);a.push({pts:v,dts:v,ptsTime:timeFixed(v/9e4),dtsTime:timeFixed(v/9e4),data:t.subarray(i+7+c,i+u)}),g++,i+=u}else i++;return{skip:o,remaining:i>=n?void 0:t.subarray(i),frames:a,nbFrame:a.length,samplingFrequencyIndex:s,sampleRate:l,objectType:p,channelCount:f,codec:y,config:h,originCodec:"mp4a.40.".concat(p)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var r=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,i=(120&t[1])>>>3,o=e.FREQ[n];if(!o)throw new Error("Invalid sampling index: ".concat(n));var a=e._getConfig(n,i,r);return{samplingFrequencyIndex:n,sampleRate:o,objectType:r,channelCount:i,config:a.config,codec:a.codec,originCodec:"mp4a.40.".concat(r)}}}},{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,r){var n,i,o=[];return isFirefox?e>=6?(n=5,i=e-3):(n=2,i=e):isAndroid?(n=2,i=e):(n=r,i=e,e>=6?i=e-3:1===t&&(n=2,i=e)),o[0]=n<<3,o[0]|=(14&e)>>1,o[1]=(1&e)<<7,o[1]|=t<<3,5===n&&(o[1]|=(14&i)>>1,o[2]=(1&i)<<7,o[2]|=8,o[3]=0),{config:o,codec:"mp4a.40.".concat(n)}}},{key:"getSilentFrame",value:function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}]),e}(),AAC=_AAC;__publicField$5(AAC,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var __defProp$4=_Object$defineProperty,__defNormalProp$4=function(e,t,r){return t in e?__defProp$4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},__publicField$4=function(e,t,r){return __defNormalProp$4(e,"symbol"!==_typeof$1(t)?t+"":t,r),r},ExpGolomb=function(){function e(t){if(_classCallCheck$1(this,e),__publicField$4(this,"_bytesAvailable"),__publicField$4(this,"_bitsAvailable",0),__publicField$4(this,"_word",0),!t)throw new Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}return _createClass$2(e,[{key:"_loadWord",value:function(){var e=this._data.byteLength-this._bytesAvailable,t=Math.min(4,this._bytesAvailable);if(0===t)throw new Error("No bytes available");var r=new Uint8Array(4);r.set(this._data.subarray(e,e+t)),this._word=new DataView(r.buffer).getUint32(0),this._bitsAvailable=8*t,this._bytesAvailable-=t}},{key:"skipBits",value:function(e){if(this._bitsAvailable>e)this._word<<=e,this._bitsAvailable-=e;else{e-=this._bitsAvailable;var t=Math.floor(e/8);e-=8*t,this._bytesAvailable-=t,this._loadWord(),this._word<<=e,this._bitsAvailable-=e}}},{key:"readBits",value:function(e){if(e>32)throw new Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,e),r=this._word>>>32-t;return this._bitsAvailable-=t,this._bitsAvailable>0?this._word<<=t:this._bytesAvailable>0&&this._loadWord(),(t=e-t)>0&&this._bitsAvailable?r<<t|this.readBits(t):r}},{key:"skipLZ",value:function(){var e;for(e=0;e<this._bitsAvailable;++e)if(0!=(this._word&2147483648>>>e))return this._word<<=e,this._bitsAvailable-=e,e;return this._loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(e){for(var t=8,r=8,n=0;n<e;n++)0!==r&&(r=(t+this.readEG()+256)%256),t=0===r?t:r}},{key:"readSliceType",value:function(){return this.readUByte(),this.readUEG(),this.readUEG()}},{key:"firstMbInSlice",value:function(){return this.readUByte(),this.readUEG()}}]),e}();function readBig32(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function getFrameTypeFor264(e){var t=new ExpGolomb(e).readSliceType();return 2===t||4===t||7===t||9===t?"I":0===t||3===t||5===t||8===t?"P":1===t||6===t?"B":void 0}var NALu=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,null,[{key:"parseAnnexB",value:function(e){for(var t=e.length,r=2,n=0;null!==e[r]&&1!==e[r];)r++;if((n=++r+2)>=t)return[];for(var i=[];n<t;)switch(e[n]){case 0:if(0!==e[n-1]){n+=2;break}if(0!==e[n-2]){n++;break}r!==n-2&&i.push(e.subarray(r,n-2));do{n++}while(1!==e[n]&&n<t);n=(r=n+1)+2;break;case 1:if(0!==e[n-1]||0!==e[n-2]){n+=3;break}r!==n-2&&i.push(e.subarray(r,n-2)),n=(r=n+1)+2;break;default:n+=3}return r<t&&i.push(e.subarray(r)),i}},{key:"parseNalu",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(!(e.length<4)){for(var r,n=e.length,i=[],o=0;o+t<n;)if(r=readBig32(e,o),3===t&&(r>>>=8),o+=t,r){if(o+r>n)break;i.push(e.subarray(o,o+r)),o+=r}return i}}},{key:"parseNaluType",value:function(e,t){return null==e?void 0:_mapInstanceProperty(e).call(e,(function(e){var r=t?e[0]>>>1&63:31&e[0],n=t&&(39===r||40===r),i={type:r,unit:e,isSei:n=n||!t&&6===r};switch(r){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!t&&5!==r||t&&5===r)break;i.frameType="I"}return t||1!==r||(i.frameType=getFrameTypeFor264(e)),!t||0!==r&&1!==r||(i.frameType="P"),!t&&r<=5&&(i.firstMbInSlice=new ExpGolomb(e).firstMbInSlice()),t&&r<=21&&(i.firstMbInSlice=128==(128&e[2])),i}))}},{key:"parseSEI",value:function(e){for(var t=e.length,r=1,n=0,i=0,o="";255===e[r];)n+=255,r++;for(n+=e[r++];255===e[r];)i+=255,r++;if(i+=e[r++],5===n&&t>r+16)for(var a=0;a<16;a++)o+=e[r].toString(16),r++;return{payload:e.subarray(r),type:n,size:i,uuid:o}}},{key:"removeEPB",value:function(e){for(var t=e.byteLength,r=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(r.push(n+2),n+=2):n++;if(!r.length)return e;var i=t-r.length,o=new Uint8Array(i),a=0;for(n=0;n<i;a++,n++)a===r[0]&&(a++,r.shift()),o[n]=e[a];return o}}]),e}(),AVC=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,null,[{key:"parseAVCDecoderConfigurationRecord",value:function(t){if(!(t.length<7)){for(var r,n,i=1+(3&t[4]),o=[],a=[],s=6,l=31&t[5],c=0;c<l;c++)if(n=t[s]<<8|t[s+1],s+=2,n){var u=t.subarray(s,s+n);s+=n,o.push(u),r||(r=e.parseSPS(NALu.removeEPB(u)))}var p,f=t[s];s++;for(var d=0;d<f;d++)p=t[s]<<8|t[s+1],s+=2,p&&(a.push(t.subarray(s,s+p)),s+=p);return{sps:r,spsArr:o,ppsArr:a,nalUnitSize:i}}}},{key:"parseSPS",value:function(e){var t=new ExpGolomb(e);t.readUByte();var r=t.readUByte(),n=t.readUByte(),i=t.readUByte();t.skipUEG();var o=420;if(100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r){var a=t.readUEG();if(a<=3&&(o=[0,420,422,444][a]),3===a&&t.skipBits(1),t.skipUEG(),t.skipUEG(),t.skipBits(1),t.readBool())for(var s=3!==a?8:12,l=0;l<s;l++)t.readBool()&&(l<6?t.skipScalingList(16):t.skipScalingList(64))}t.skipUEG();var c=t.readUEG();if(0===c)t.readUEG();else if(1===c){t.skipBits(1),t.skipUEG(),t.skipUEG();for(var u=t.readUEG(),p=0;p<u;p++)t.skipUEG()}t.skipUEG(),t.skipBits(1);var f=t.readUEG(),d=t.readUEG(),h=t.readBits(1);0===h&&t.skipBits(1),t.skipBits(1);var y,g,_,v,m,$=0,b=0,S=0,E=0;if(t.readBool()&&($=t.readUEG(),b=t.readUEG(),S=t.readUEG(),E=t.readUEG()),t.readBool()){if(t.readBool())switch(t.readUByte()){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:y=[t.readUByte()<<8|t.readUByte(),t.readUByte()<<8|t.readUByte()]}if(t.readBool()&&t.readBool(),t.readBool()&&(t.readBits(4),t.readBool()&&t.readBits(24)),t.readBool()&&(t.readUEG(),t.readUEG()),t.readBool()){var P=t.readBits(32),T=t.readBits(32);g=t.readBool(),m=(_=T)/(v=2*P)}}for(var I=e.subarray(1,4),O="avc1.",C=0;C<3;C++){var w=I[C].toString(16);w.length<2&&(w="0".concat(w)),O+=w}return{codec:O,profileIdc:r,profileCompatibility:n,levelIdc:i,chromaFormat:o,width:Math.ceil(16*(f+1)-2*($+b)),height:(2-h)*(d+1)*16-(h?2:4)*(S+E),sarRatio:y,fpsNum:_,fpsDen:v,fps:m,fixedFrame:g}}}]),e}(),HEVC=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,null,[{key:"parseHEVCDecoderConfigurationRecord",value:function(t){if(!(t.length<23)){for(var r,n,i,o,a=1+(3&t[21]),s=[],l=[],c=[],u=23,p=t[22],f=0;f<p;f++){n=63&t[u],i=t[u+1]<<8|t[u+2],u+=3;for(var d=0;d<i;d++)if(o=t[u]<<8|t[u+1],u+=2,o){switch(n){case 32:c.push(t.subarray(u,u+o));break;case 33:var h=t.subarray(u,u+o);r||(r=e.parseSPS(NALu.removeEPB(h))),s.push(h);break;case 34:l.push(t.subarray(u,u+o))}u+=o}}return{sps:r,spsArr:s,ppsArr:l,vpsArr:c,nalUnitSize:a}}}},{key:"parseSPS",value:function(e){var t=new ExpGolomb(e);t.readUByte(),t.readUByte(),t.readBits(4);var r=t.readBits(3);t.readBits(1);var n=this._parseProfileTierLevel(t,r);t.readUEG();var i=t.readUEG(),o=420;i<=3&&(o=[0,420,422,444][i]);var a=0;3===i&&(a=t.readBits(1));var s,l,c,u,p=t.readUEG(),f=t.readUEG(),d=t.readBits(1);(1===d&&(s=t.readUEG(),l=t.readUEG(),c=t.readUEG(),u=t.readUEG()),1===d)&&(p-=(1!==i&&2!==i||0!==a?1:2)*(l+s),f-=(1===i&&0===a?2:1)*(u+c));return{codec:"hev1.1.6.L93.B0",width:p,height:f,chromaFormat:o,bitDepthLumaMinus8:t.readUEG(),bitDepthChromaMinus8:t.readUEG(),generalProfileSpace:n.generalProfileSpace,generalTierFlag:n.generalTierFlag,generalProfileIdc:n.generalProfileIdc,generalLevelIdc:n.generalLevelIdc}}},{key:"_parseProfileTierLevel",value:function(e,t){var r,n,i;(arguments.length>2&&void 0!==arguments[2]?arguments[2]:1)&&(r=e.readBits(2),n=e.readBits(1),i=e.readBits(5)),e.readBits(32),e.readBits(1),e.readBits(1),e.readBits(1),e.readBits(1),e.readBits(16),e.readBits(16),e.readBits(12);for(var o=e.readUByte(),a=[],s=[],l=0;l<t;l++)a[l]=e.readBits(1),s[l]=e.readBits(1);t>0&&e.readBits(2*(8-t));for(var c=0;c<t;c++)0!==a[c]&&(e.readBits(2),e.readBits(1),e.readBits(5),e.readBits(16),e.readBits(16),e.readBits(4),e.readBits(16),e.readBits(16),e.readBits(12)),0!==s[c]&&e.readBits(8);return{generalProfileSpace:r,generalTierFlag:n,generalProfileIdc:i,generalLevelIdc:o}}}]),e}();function addRelativeTime(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=_filterInstanceProperty(t=e.items).call(t,(function(e){return e.isSample&&e.isVideo}))[0],o=_filterInstanceProperty(r=e.items).call(r,(function(e){return e.isSample&&e.isAudio}))[0],a=Math.min((null==o?void 0:o.dtsTime)||0,(null==i?void 0:i.dtsTime)||0);return a-=n,e.items.forEach((function(e){e.time=timeFixed(e.dtsTime-a)})),e}function getRates(e){var t,r=_filterInstanceProperty(t=e.items).call(t,(function(e){return e.isVideo})),n=[],i=-1,o={},a={};return r.forEach((function(e,t){(e.keyframe||t===r.length-1)&&(i=-1===i?e.time:i,n.push({time:e.time,value:timeFixed(e.time-i)}),i=e.time);var s=Math.ceil(e.time+1e-5);o[s]?o[s]++:o[s]=1,a[s]?a[s]+=8*e.size:a[s]=8*e.size})),{bitRates:_adapter(a),gops:_filterInstanceProperty(n).call(n,(function(e){return e.value})),frameRates:_adapter(o)}}function _adapter(e){var t=_Object$keys(e);return _mapInstanceProperty(t).call(t,(function(t){return{time:Number(t),value:e[t]}}))}function topThreeFrameSize(e){var t,r,n,i,o=_reduceInstanceProperty(t=_sliceInstanceProperty(r=_sortInstanceProperty(n=_filterInstanceProperty(i=_sliceInstanceProperty(e).call(e)).call(i,(function(e){return e.isSample}))).call(n,(function(e,t){return e.time>t.time?1:-1}))).call(r,0,3)).call(t,(function(e,t){return e+t.size}),0);return o>1e3?timeFixed(o/1e3)+"KB":o+"B"}function avgBitrate(e){return _reduceInstanceProperty(e).call(e,(function(e,t){return e+t.size}),0)/_reduceInstanceProperty(e).call(e,(function(e,t){return e+t.duration}),0)*8e3}function getProfile(e){if(null==e?void 0:e.profileIdc)switch(e.profileIdc){case 66:return"66(Baseline)";case 77:return"77(Main)";case 100:return"100(High)"}}var __defProp$3=_Object$defineProperty,__defNormalProp$3=function(e,t,r){return t in e?__defProp$3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},__publicField$3=function(e,t,r){return __defNormalProp$3(e,"symbol"!==_typeof$1(t)?t+"":t,r),r},Flv$1=function(){function e(){_classCallCheck$1(this,e),__publicField$3(this,"_nalUnitSize",0),__publicField$3(this,"_lastAudio",null),__publicField$3(this,"_lastVideo",null),__publicField$3(this,"_videoStartDts",-1),__publicField$3(this,"_audioStartDts",-1)}return _createClass$2(e,[{key:"parse",value:function(e){for(var t=e.byteLength,r=e.subarray(0,13),n=13,i=_objectSpread2$2(_objectSpread2$2({header:r},this._parseHeader(r)),{},{items:[]});n+11<t;){var o=e.subarray(n,n+11),a=o[1]<<16|o[2]<<8|o[3],s=n+11+a;if(s>t)break;var l=e.subarray(n+11,s),c=new FlvTagView(_objectSpread2$2({tagSize:11+a+4,header:o,body:l,tailsize:e.subarray(s,s+4)},this._parseTag(o,l)));c.isAudio&&(this._lastAudio&&(this._lastAudio.duration=c.dts-this._lastAudio.dts),this._lastAudio=c),c.isVideo&&(this._lastVideo&&(this._lastVideo.duration=c.dts-this._lastVideo.dts),this._lastVideo=c),i.items.push(c),n=s+4}var u=addRelativeTime(i);return u.rates=getRates(u),this._addMetadataToFirstKeyFrame(u),u}},{key:"getSnapshoot",value:function(t,r){var n,i,o,a,s=_filterInstanceProperty(n=t.items).call(n,(function(e){return 8===e.type}))[0],l=_filterInstanceProperty(i=t.items).call(i,(function(e){return 9===e.type}))[0],c=s&&s.bodyView||s,u=l&&l.bodyView||l,p=_filterInstanceProperty(o=t.items).call(o,(function(e){return e.isVideo})).length,f=this._getNbFrame(t,"I"),d=this._getNbFrame(t,"P"),h=this._getNbFrame(t,"B"),y=0;if(null==r?void 0:r.gopCacheBuffer){var g,_=(new e).parse(r.gopCacheBuffer),v=_filterInstanceProperty(g=_.items).call(g,(function(e){return e.isVideo})),m=null==(a=v[v.length-1])?void 0:a.time;m&&(y=m-r.take/1e3)}return{rates:t.rates,audio:c?_Object$assign({},c,this._getExt(t,"audio")):null,video:u?_Object$assign({},u,this._getExt(t,"video"),{topThreeFrameSize:topThreeFrameSize(t.items),gopCache:timeFixed(y),profile:getProfile(u.sps),iFrames:f,pFrames:d,bFrames:h,iPercent:timeFixed(f/p*100),pPercent:timeFixed(d/p*100),bPercent:timeFixed(h/p*100)}):null}}},{key:"_addMetadataToFirstKeyFrame",value:function(e){var t,r,n,i=_filterInstanceProperty(t=e.items).call(t,(function(e){return 9===e.type}))[0];if(i&&(null==(n=i.bodyView)?void 0:n.sps)){var o=_filterInstanceProperty(r=e.items).call(r,(function(e){return e.isVideo&&e.keyframe}))[0];o&&(o.bodyView.sps=i.bodyView.sps,o.bodyView.vpsArr=i.bodyView.vpsArr,o.bodyView.spsArr=i.bodyView.spsArr,o.bodyView.ppsArr=i.bodyView.ppsArr)}}},{key:"_getExt",value:function(e,t){var r,n,i,o=_filterInstanceProperty(r=e.items).call(r,(function(e){return e.streamType===t&&e.isSample})),a=_filterInstanceProperty(n=e.items).call(n,(function(e){var r;return e.streamType===t&&(null==(r=e.bodyView)?void 0:r.packetType)===PACKET_TYPE.SEQUENCE}))[0];if(!o.length)return 0;var s=o[0],l=o[o.length-1],c=0;return"audio"===t&&(c=a&&1024/(null==(i=a.bodyView)?void 0:i.sampleRate)*1e3),"video"===t&&(c=s.duration),{avgBits:avgBitrate(o),startDts:o[0].dts,duration:(l.timestamp-s.timestamp)/1e3,refDuration:c,frameLength:o.length}}},{key:"_getNbFrame",value:function(e,t){var r;return _filterInstanceProperty(r=e.items).call(r,(function(e){return e.isVideo&&e.frameType===t})).length}},{key:"_parseHeader",value:function(e){return{hasAudio:!!(e[4]>>2&1),hasVideo:!!(1&e[4])}}},{key:"_parseTag",value:function(e,t){var r,n=31&e[0],i=(e[7]<<24>>>0)+(e[4]<<16)+(e[5]<<8)+e[6];switch(n){case 18:r=_Object$assign({packetType:PACKET_TYPE.SCRIPT},AMF.parse(t));break;case 9:r=this._parseVideo(t,i);break;case 8:r=this._parseAudio(t,i)}return{type:n,timestamp:i,bodyView:r}}},{key:"_parseAudio",value:function(e){if(e.length){var t=(240&e[0])>>>4;if(10===t||7===t||8===t){if(10!==t){var r=(12&e[0])>>2,n=(2&e[0])>>1,i=1&e[0];return _objectSpread2$2({format:t,sampleRate:AUDIO_RATE[r],sampleSize:n?2:1,channelCount:i+1},this._parseG711(e))}return this._parseAac(e,t)}console.warn("Unsupported sound format: ".concat(t))}}},{key:"_parseG711",value:function(e,t){return{codecType:7===t?AUDIO_CODEC_TYPE.PCMA:AUDIO_CODEC_TYPE.PCMU,sampleRate:8e3,sample:e.subarray(1),packetType:PACKET_TYPE.RAW}}},{key:"_parseAac",value:function(e,t){if(0===e[1]){var r=e.subarray(2);return _objectSpread2$2(_objectSpread2$2({},AAC.parseAudioSpecificConfig(r)),{},{format:t,timescale:1e3,codecType:AUDIO_CODEC_TYPE.AAC,packetType:PACKET_TYPE.SEQUENCE,sequenceData:[r],frameType:"A"})}if(1===e[1])return{sample:e.subarray(2),format:t,codecType:AUDIO_CODEC_TYPE.AAC,packetType:PACKET_TYPE.RAW,frameType:"A"}}},{key:"_parseVideo",value:function(e,t){if(!(e.length<6)){var r=(240&e[0])>>>4,n=15&e[0];if(7===n||12===n){var i=12===n,o=e[1],a=(e[2]<<16|e[3]<<8|e[4])<<8>>8;if(0===o){var s=e.subarray(5),l=i?HEVC.parseHEVCDecoderConfigurationRecord(s):AVC.parseAVCDecoderConfigurationRecord(s);return this._nalUnitSize=l.nalUnitSize,_objectSpread2$2({codecId:n,codecType:i?VIDEO_CODEC_TYPE.HEVC:VIDEO_CODEC_TYPE.AVC,packetType:PACKET_TYPE.SEQUENCE,timescale:1e3,sequenceData:[s]},l)}if(1===o){var c=NALu.parseNalu(e.subarray(5),this._nalUnitSize);if(!c||!c.length)return;var u={dts:t,cts:a,units:c=NALu.parseNaluType(c,i)};return 1===r&&(u.keyframe=!0),c.forEach((function(e){var t=e.type,r=e.unit,n=e.frameType;switch(t){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!i&&5!==t||i&&5===t)break;u.keyframe=!0,u.frameType="I";break;case 6:case 39:case 40:if(!i&&6!==t||i&&6===t)break;u.seis?u.seis.push(NALu.parseSEI(NALu.removeEPB(r))):u.seis=[NALu.parseSEI(NALu.removeEPB(r))];break;case 32:if(!i)break;u.vpsArr?u.vpsArr.push(r):u.vpsArr=[r];break;case 7:case 33:if(!i&&7!==t||i&&7===t)break;u.spsArr?u.spsArr.push(r):u.spsArr=[r];var o=NALu.removeEPB(r);u.sps=i?HEVC.parseSPS(o):AVC.parseSPS(o);break;case 8:case 34:if(!i&&8!==t||i&&8===t)break;u.ppsArr?u.ppsArr.push(r):u.ppsArr=[r];break;case 1:case 0:u.frameType=n}})),_objectSpread2$2({codecId:n,codecType:i?VIDEO_CODEC_TYPE.HEVC:VIDEO_CODEC_TYPE.AVC,packetType:PACKET_TYPE.RAW},u)}}else console.warn("Unsupported codecId: ".concat(n))}}}]),e}(),FORMAT={FLV:"FLV",TS:"MPEG-TS",MP4:"MP4",RAW264:"RAW264",NOSUPPORT:"NOSUPPORT"};function tsProbe(e){for(var t=Math.min(1e3,e.byteLength-564),r=0;r<t;r++)if(71===e[r]&&71===e[r+188]&&71===e[r+376])return r;return-1}function getBoxType(e,t){var r;return _mapInstanceProperty(r=[e[t],e[t+1],e[t+2],e[t+3]]).call(r,(function(e){return String.fromCharCode(e)})).join("")}var __defProp$2=_Object$defineProperty,__defNormalProp$2=function(e,t,r){return t in e?__defProp$2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},__publicField$2=function(e,t,r){return __defNormalProp$2(e,"symbol"!==_typeof$1(t)?t+"":t,r),r},PacketHeaderView=_createClass$2((function e(t){var r=t.startIndictor,n=t.packetType,i=t.pid,o=t.afc;_classCallCheck$1(this,e),__publicField$2(this,"startIndictor",0),__publicField$2(this,"pid",0),__publicField$2(this,"afc",0),__publicField$2(this,"eleInfo",null),__publicField$2(this,"packetType",""),this.startIndictor=r,this.packetType=n,this.pid=i,this.afc=o})),TsPacketView=function(){function e(t){var r=t.header,n=t.headerObject,i=t.body,o=t.eleInfo,a=t.bodyView,s=t.headerView;_classCallCheck$1(this,e),__publicField$2(this,"header",null),__publicField$2(this,"headerView",null),__publicField$2(this,"body",null),__publicField$2(this,"bodyView",null),__publicField$2(this,"eleInfo",null),__publicField$2(this,"duration",0),this.header=r,this.headerView=s||new PacketHeaderView(n),this.eleInfo=o,this.body=i,this.bodyView=a}return _createClass$2(e,[{key:"type",get:function(){var e;return null==(e=this.headerView)?void 0:e.packetType}},{key:"streamType",get:function(){return this.eleInfo?this.eleInfo[this.headerView.pid]:""}},{key:"packetType",get:function(){var e;return null==(e=this.headerView)?void 0:e.packetType}},{key:"frameType",get:function(){var e;return null==(e=this.bodyView)?void 0:e.frameType}},{key:"pts",get:function(){var e;return null==(e=this.bodyView)?void 0:e.pts}},{key:"ptsTime",get:function(){return this.pts?timeFixed(this.pts/9e4):0}},{key:"dtsTime",get:function(){return this.dts?timeFixed(this.dts/9e4):0}},{key:"dts",get:function(){var e;return null==(e=this.bodyView)?void 0:e.dts}},{key:"keyframe",get:function(){return"I"===this.frameType}},{key:"nalTypes",get:function(){var e,t;return null==(t=null==(e=this.bodyView)?void 0:e.units)?void 0:_mapInstanceProperty(t).call(t,(function(e){return e.type}))}},{key:"nalSizes",get:function(){var e,t;return null==(t=null==(e=this.bodyView)?void 0:e.units)?void 0:_mapInstanceProperty(t).call(t,(function(e){return e.unit.length}))}},{key:"isSample",get:function(){return"PES"===this.packetType}},{key:"timescale",get:function(){return 9e4}},{key:"isHevc",get:function(){var e,t;return"bytevc1"===(null==(t=null==(e=this.eleInfo)?void 0:e.video)?void 0:t.codecType)}},{key:"sampleView",get:function(){var e;if("PES"===this.type)return{dts:this.dts,pts:this.pts,units:null==(e=this.bodyView)?void 0:e.units,data:this._getSampleData()}}},{key:"data",get:function(){return this._getSampleData()}},{key:"size",get:function(){var e,t;return null==(t=null==(e=this.sampleView)?void 0:e.data)?void 0:t.length}},{key:"isVideo",get:function(){return this.isSample&&"video"===this.streamType}},{key:"isAudio",get:function(){return this.isSample&&"audio"===this.streamType}},{key:"_getSampleData",value:function(){var e,t;if("audio"===this.streamType)return this.bodyView.data;var r=(null==(t=this.bodyView)?void 0:_filterInstanceProperty(e=t.units).call(e,(function(e){return!e.isSei&&!e.isDivision})))||[],n=_reduceInstanceProperty(r).call(r,(function(e,t){return e+(t.unit.byteLength+4)}),0),i=new Uint8Array(n),o=0;return r.forEach((function(e){i.set([0,0,0,1],o),o+=4,i.set(e.unit,o),o+=e.unit.byteLength})),i}}]),e}(),TsParser=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"parse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=tsProbe(e);if(-1===r)throw new Error("invalid ts file");var n=e.byteLength;n-=(n-r)%188;for(var i,o=[],a=[],s=[],l=0,c=r;c<n;){var u=e.subarray(c,c+188),p=u.subarray(0,4),f=this._parseTsHeader(u.subarray(0,4));c+=188;var d=void 0,h=void 0,y=4,g="";switch((null==f?void 0:f.afc)>1&&(y+=1+Math.min(u[y],183)),f.pid){case 0:y+=1+u[y],d=u.subarray(y),g="PAT",h={pmtId:l=this._parsePAT(d)};break;default:if(f.pid===l){y+=1+u[y],d=u.subarray(y),h=i=this._parsePMT(d),g="PMT";break}if(!i||!i[f.pid])continue;d=u.subarray(y),g="PES"}if(f.packetType=g,"PES"===g){var _="video"===i[f.pid]?a:s;f.startIndictor&&_.length&&(o.push(new TsPacketView(_objectSpread2$2(_objectSpread2$2({},this._concatPesChunk(_)),{},{eleInfo:i}))),_="video"===i[f.pid]?a=[]:s=[]),_.push({header:p,headerObject:f,body:d})}else o.push(new TsPacketView({header:p,headerObject:f,body:d,eleInfo:i,bodyView:h}))}a.length&&(o.push(new TsPacketView(_objectSpread2$2(_objectSpread2$2({},this._concatPesChunk(a)),{},{eleInfo:i}))),a=[]),s.length&&(o.push(new TsPacketView(_objectSpread2$2(_objectSpread2$2({},this._concatPesChunk(s)),{},{eleInfo:i}))),s=[]);var v=addRelativeTime({items:this._parsePES(o)},t);return v.rates=getRates(v),v}},{key:"getSnapshoot",value:function(e){var t,r,n,i=e.items,o=e.rates,a=_filterInstanceProperty(i).call(i,(function(e){return"video"===e.streamType})),s=_filterInstanceProperty(i).call(i,(function(e){return"audio"===e.streamType})),l=_findInstanceProperty(i).call(i,(function(e){return"PMT"===e.type})),c=a[0],u=s[0],p=a.length,f=this._getNbFrame(a,"I"),d=this._getNbFrame(a,"P"),h=this._getNbFrame(a,"B"),y={rates:o,video:c?_Object$assign({},null==c?void 0:c.bodyView,{codecType:c.eleInfo.video.codecType,frameLength:p,topThreeFrameSize:topThreeFrameSize(i),avgBits:avgBitrate(a),profile:getProfile(null==(t=null==c?void 0:c.bodyView)?void 0:t.sps),iFrames:f,pFrames:d,bFrames:h,iPercent:timeFixed(f/p*100),pPercent:timeFixed(d/p*100),bPercent:timeFixed(h/p*100),timescale:9e4},this._getDuration(a,"video")):null,audio:u?_Object$assign({},null==u?void 0:u.bodyView,{codecType:u.eleInfo.audio.codecType,frameLength:s.length,timescale:9e4,avgBits:avgBitrate(s)},this._getDuration(s,"audio")):null};return l&&(null==(r=l.bodyView)?void 0:r.noSupported)&&(y.noSupported=null==(n=l.bodyView)?void 0:n.noSupported),y}},{key:"getRates",value:function(e){return getRates(e)}},{key:"_getDuration",value:function(e,t){var r,n=e[0],i=e[e.length-1],o=0;return"audio"===t&&(o=1024/(null==(r=n.bodyView)?void 0:r.sampleRate)*1e3),"video"===t&&(o=n.duration),{duration:(i.pts-n.pts)/9e4,refDuration:o}}},{key:"_getNbKeyFrame",value:function(e){return _filterInstanceProperty(e).call(e,(function(e){var t;return null==(t=e.bodyView)?void 0:t.keyframe})).length}},{key:"_getNbFrame",value:function(e,t){return _filterInstanceProperty(e).call(e,(function(e){return e.frameType===t})).length}},{key:"_parseTsHeader",value:function(e){if(71===e[0]){var t={};return t.startIndictor=(64&e[1])>>6,t.pid=((31&e[1])<<8)+e[2],t.afc=(48&e[3])>>4,t}return null}},{key:"_parsePAT",value:function(e){return(31&e[10])<<8|e[11]}},{key:"_parsePMT",value:function(e){var t=0,r=3+((15&e[1])<<8|e[2])-4;e[3],e[4],t=t+11+((15&e[10])<<8|e[11])+1;for(var n,i={video:null,audio:null,noSupported:0};t<r;){n=e[t];var o=(31&e[t+1])<<8|e[t+2];switch(n){case 27:case 36:i.video={elePid:o,streamType:n,codecType:27===n?"avc":"bytevc1"},i[o]="video";break;case 15:i.audio={elePid:o,streamType:n,codecType:"aac"},i[o]="audio";break;default:i.noSupported=n,console.warn("unsupported streamType,",n)}t+=5+((15&e[t+3])<<8|e[t+4])}return i}},{key:"_concatPesChunk",value:function(e){var t=_reduceInstanceProperty(e).call(e,(function(e,t){return e+t.body.byteLength}),0),r=new Uint8Array(t),n=0;return e.forEach((function(e){var t=e.body;r.set(t,n),n+=t.byteLength})),_objectSpread2$2(_objectSpread2$2({},e[0]),{},{body:r,packetType:"PES"})}},{key:"_parsePES",value:function(e){var t=this,r=[];return e.forEach((function(e,n){if(e.isSample){var i=e,o=t._parsePESInternal(i.body)||{},a=o.data,s=o.pts,l=o.dts;if(a){if(e.isVideo&&(i.bodyView=t._parseVideoFrame(a,s,l,"bytevc1"===i.eleInfo.video.codecType),t._lastVideo&&(t._lastVideo.duration=1e3*(e.dtsTime-t._lastVideo.dtsTime)),t._lastVideo=i),e.isAudio){var c=AAC.parseADTS(a,s),u=c.frames;return delete c.frames,void(null==u||u.forEach((function(e){var n=new TsPacketView(_Object$assign({},i,{bodyView:_objectSpread2$2(_objectSpread2$2(_objectSpread2$2({},c),e),{},{frameType:"A"})}));r.push(n),t._lastAudio&&(t._lastAudio.duration=1e3*(n.dtsTime-t._lastAudio.dtsTime)),t._lastAudio=n})))}r.push(e)}}else r.push(e)})),r}},{key:"_parsePESInternal",value:function(e){var t=e[8];if(!(0===t||e.length<t+9)&&1===(e[0]<<16|e[1]<<8|e[2])){var r=(e[4]<<8)+e[5];if(!(r&&r>e.length-6)){var n,i,o=e[7];return 192&o&&(n=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&o?n-(i=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2)>54e5&&(n=i):i=n),i=i||n,{data:e.subarray(9+t),pts:n,dts:i}}}}},{key:"_parseVideoFrame",value:function(e,t,r,n){var i=NALu.parseAnnexB(e);if(i.length){var o={units:i=NALu.parseNaluType(i,n),pts:t,dts:r};return i.forEach((function(e){var t=e.unit,r=e.type,i=e.frameType;switch(r){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!n&&5!==r||n&&5===r)break;o.keyframe=!0,o.frameType="I";break;case 6:case 39:case 40:if(!n&&6!==r||n&&6===r)break;o.seis?o.seis.push(NALu.parseSEI(NALu.removeEPB(t))):o.seis=[NALu.parseSEI(NALu.removeEPB(t))];break;case 32:if(!n)break;o.vpsArr?o.vpsArr.push(t):o.vpsArr=[t];break;case 7:case 33:if(!n&&7!==r||n&&7===r)break;o.spsArr?o.spsArr.push(t):o.spsArr=[t];var a=NALu.removeEPB(t);o.sps=n?HEVC.parseSPS(a):AVC.parseSPS(a);break;case 8:case 34:if(!n&&8!==r||n&&8===r)break;o.ppsArr?o.ppsArr.push(t):o.ppsArr=[t];break;case 9:case 35:break;case 0:case 1:o.frameType=i}})),o}}}]),e}(),entryVirtual$1=entryVirtual$p,entries$6=entryVirtual$1("Array").entries,parent$q=entries$6,entries$5=parent$q,classof=classof$e,hasOwn$1=hasOwnProperty_1,isPrototypeOf$3=objectIsPrototypeOf,method$1=entries$5,ArrayPrototype=Array.prototype,DOMIterables={DOMTokenList:!0,NodeList:!0},entries$4=function(e){var t=e.entries;return e===ArrayPrototype||isPrototypeOf$3(ArrayPrototype,e)&&t===ArrayPrototype.entries||hasOwn$1(DOMIterables,classof(e))?method$1:t},parent$p=entries$4,entries$3=parent$p,parent$o=entries$3,entries$2=parent$o,entries$1=entries$2,entries3=entries$1,_entriesInstanceProperty=getDefaultExportFromCjs(entries3),ByteReader=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;_classCallCheck$1(this,e),this._offset=r,this._buffer=t,this._length=t.byteLength}return _createClass$2(e,[{key:"offset",get:function(){return this._offset},set:function(e){this._offset=e}},{key:"forward",value:function(e){this._offset+=e}},{key:"subarray",value:function(e){return e?this._buffer.subarray(this._offset,this._offset+e):this._buffer.subarray(this._offset,e)}},{key:"slice",value:function(e){for(var t=this._offset,r=this._buffer,n=[],i=0;i<e;i++)n.push(r[t+i]);return new Uint8Array(n)}},{key:"readU8",value:function(){return this._buffer[this._offset]}},{key:"readU16",value:function(){var e=this._offset,t=this._buffer;return t[e]<<8|t[e+1]}},{key:"readU24",value:function(){var e=this._offset,t=this._buffer;return t[e]<<16|t[e+1]<<8|t[e+12]}},{key:"readU32",value:function(){var e=this._offset,t=this._buffer;return t[e]*(1<<24)+65536*t[e+1]+256*t[e+2]+t[e+3]}},{key:"read32",value:function(){var e=this._offset,t=this._buffer;return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}}]),e}(),__defProp$1=_Object$defineProperty,__defNormalProp$1=function(e,t,r){return t in e?__defProp$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},__publicField$1=function(e,t,r){return __defNormalProp$1(e,"symbol"!==_typeof$1(t)?t+"":t,r),r},Mp4View=function(){function e(t,r,n,i,o,a,s,l,c,u){_classCallCheck$1(this,e),__publicField$1(this,"dts",0),__publicField$1(this,"pts",0),__publicField$1(this,"units",null),__publicField$1(this,"timescale",0),__publicField$1(this,"offset",0),__publicField$1(this,"duration",0),__publicField$1(this,"data",null),__publicField$1(this,"size",0),__publicField$1(this,"streamType",""),__publicField$1(this,"_frameType",""),__publicField$1(this,"isHevc",!1),this.dts=t,this.pts=r,this.units=n,this.timescale=i,this.offset=o,this.data=a,this.size=s,this.duration=l,this.streamType=c,this.isHevc=u}return _createClass$2(e,[{key:"isSample",get:function(){return!0}},{key:"dtsTime",get:function(){return this.dts/this.timescale}},{key:"ptsTime",get:function(){return this.pts/this.timescale}},{key:"frameType",get:function(){var e,t;return"audio"===this.streamType?"A":this._frameType||(null==(t=this.units)?void 0:_filterInstanceProperty(e=_mapInstanceProperty(t).call(t,(function(e){return e.frameType}))).call(e,Boolean)[0])},set:function(e){this._frameType=e}},{key:"nalTypes",get:function(){var e;return null==(e=this.units)?void 0:_mapInstanceProperty(e).call(e,(function(e){return e.type}))}},{key:"nalSizes",get:function(){var e;return null==(e=this.units)?void 0:_mapInstanceProperty(e).call(e,(function(e){return e.unit.length}))}},{key:"keyframe",get:function(){return"I"===this.frameType}},{key:"isVideo",get:function(){return"video"===this.streamType}},{key:"isAudio",get:function(){return"audio"===this.streamType}}]),e}(),BOX_TYPE_DESC={ftyp:"file type and compatibility",free:"free box",moov:"container for all metadata",mvhd:"movie header,overall declarations",trak:"container for an individual track or stream",tkhd:"track header,overall information about the track",tref:"track reference container",mdia:"container for the media information in a track",mdhd:"media header,oervall information about the media",hdlr:"declares the media type",minf:"media information container",vmhd:"video media header",smhd:"sound media header",dinf:"data information box",stbl:"sample table box",stsd:"sample descriptions(codec types, etc)",stts:"decoding time to sample",ctts:"compostion time to sample",cslg:"compostion to decode timeline mapping",stsc:"sample to chunk",stsz:"sample size",stco:"chunk offset",stss:"sync sample table",sdtp:"independent abd disposable samples",sbgp:"sample to group",mvex:"movid extends box",moof:"movie fragment",mfhd:"movie fragment header",traf:"track fragment",tfhd:"track fragment header",trun:"track fragment run",tfdt:"track fragment decode time",mdat:"media data",meta:"metadata",avc1:"h264 codec info box",hev1:"hevc codec info box"};function parseSampleFlag(e,t){return{isLeading:(12&e[t])>>2,dependsOn:3&e[t],isDenpendedOn:(192&e[t+1])>>6,hasRedundancy:(48&e[t+1])>>4,padding:(14&e[t+1])>>1,nonSync:1&e[t+1],degradationPriority:e[t+2]<<8|e[t+3]}}function parseTfFlags(e){var t=_slicedToArray(e,3),r=t[1],n=t[2];return{dataOffsetPresent:!!(1&n),firstSampleFlagsPresent:!!(4&n),sampleDurationPresent:!!(1&r),sampleSizePresent:!!((2&r)>>1),sampleFlagsPresent:!!((4&r)>>2),sampleCompositionTimeOffsetPresent:!!((8&r)>>3)}}function _getBoxType(e,t){var r;return _mapInstanceProperty(r=[e[t],e[t+1],e[t+2],e[t+3]]).call(r,(function(e){return String.fromCharCode(e)})).join("")}function splitBox(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],n=0;n<e.byteLength;){var i,o=e[n]*(1<<24)+65536*e[n+1]+256*e[n+2]+e[n+3];if(1===o){var a=_getBoxType(e,n+4);if("mdat"===a){var s,l=new DataView(e.buffer),c=l.getUint32(n+8)*Math.pow(2,32)+l.getUint32(n+12);console.log(_concatInstanceProperty(s="".concat(a,": largesize=")).call(s,c)),o=c}}if(o){var u=e.subarray(n,n+o),p=_getBoxType(u,4);r.push({size:o,length:u.byteLength,start:n+t,type:p,sizetypeRepresent:_sliceInstanceProperty(i=u.subarray(0,8)).call(i),body:u.subarray(8),typeDes:BOX_TYPE_DESC[p]||""}),n+=o}else n+=4}return r}function findBox(e,t,r){if(e)for(var n=0;n<e.length;n++){var i=e[n];if(i.type===t){if(!r)return i;if(r(i))return i}if(i.bodyView instanceof Array){var o=findBox(i.bodyView,t,r);if(o){if(!r)return o;if(r(o))return o}}}}function _getTrack(e,t){return findBox(e,"trak",(function(e){var r=findBox(e.bodyView,"hdlr");return r&&r.bodyView.handlerType===t}))}function extractMp4Samples(e,t,r){var n,i,o,a,s,l,c,u,p,f,d,h,y,g,_,v,m,$,b,S=_getTrack(e,t);if(!S)return null;var E=findBox(S.bodyView,"stbl"),P=findBox(S.bodyView,"mdhd")||{},T=(null==(u=null==(c=_filterInstanceProperty(n=E.bodyView).call(n,(function(e){return"stts"===e.type}))[0])?void 0:c.bodyView)?void 0:_entriesInstanceProperty(u))||[];null==(f=null==(p=_filterInstanceProperty(i=E.bodyView).call(i,(function(e){return"stss"===e.type}))[0])?void 0:p.bodyView)||_entriesInstanceProperty(f);var I=(null==(h=null==(d=_filterInstanceProperty(o=E.bodyView).call(o,(function(e){return"ctts"===e.type}))[0])?void 0:d.bodyView)?void 0:_entriesInstanceProperty(h))||[],O=(null==(g=null==(y=_filterInstanceProperty(a=E.bodyView).call(a,(function(e){return"stsc"===e.type}))[0])?void 0:y.bodyView)?void 0:_entriesInstanceProperty(g))||[],C=(null==(v=null==(_=_filterInstanceProperty(s=E.bodyView).call(s,(function(e){return"stsz"===e.type}))[0])?void 0:_.bodyView)?void 0:_entriesInstanceProperty(v))||[],w=(null==($=null==(m=_filterInstanceProperty(l=E.bodyView).call(l,(function(e){return"stco"===e.type}))[0])?void 0:m.bodyView)?void 0:_entriesInstanceProperty($))||[],A=!!findBox(E.bodyView,"hvcC"),R="vide"===t;if(!O.length||!w.length||!C.length)return[];for(var k,D=P.bodyView,x=D.timescale,N=void 0===x?1:x,L=D.duration,M=C.length,F=w.length,j=1,U=0,B=[],V=_assemblyTimestamp(M,T,I);j<=F;){var G=O[U];(null==G?void 0:G.firstChunk)!==j?(B.push(_Object$assign({},k,{firstChunk:j,offset:w[j-1]})),j++):(B.push(_objectSpread2$2(_objectSpread2$2({},G),{},{offset:w[j-1]})),k=G,j++,U++)}var H=_mapInstanceProperty(C).call(C,(function(e,t){var n=B[0],i=n.offset;n.offset+=e,n.samplesPreChunk--,n.samplesPreChunk||B.shift();var o=V[t],a=r.subarray(i,i+e);if(R){var s=NALu.parseNalu(a);return new Mp4View(o.dts,o.pts,NALu.parseNaluType(s,A),N,i,a,e,0,"video",A)}return new Mp4View(o.dts,o.pts,null,N,i,a,e,0,"audio")}));_reduceInstanceProperty(H).call(H,(function(e,t){return e?(e.duration=(t.dts-e.dts)/N*1e3,t):t}),null);var K=null==(b=findBox(null==S?void 0:S.bodyView,"vide"===t?A?"hvcC":"avcC":"mp4a"))?void 0:b.bodyView;return _objectSpread2$2(_objectSpread2$2(_objectSpread2$2({samples:H,iFrames:_filterInstanceProperty(H).call(H,(function(e){return"I"===e.frameType})).length,pFrames:_filterInstanceProperty(H).call(H,(function(e){return"P"===e.frameType})).length,bFrames:_filterInstanceProperty(H).call(H,(function(e){return"B"===e.frameType})).length},P.bodyView),{},{frameLength:M,duration:L/N,timescale:N},K),null==K?void 0:K.ests)}function _assemblyTimestamp(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=0,i=0,o=0,a=0,s=0,l=[];for(t=_mapInstanceProperty(t).call(t,(function(e){return _objectSpread2$2({},e)})),r=_mapInstanceProperty(r).call(r,(function(e){return _objectSpread2$2({},e)}));o<e;){var c=t[n],u=r[i];c.sampleCount&&(a+=c.sampleDelta),c.sampleCount--,c.sampleCount||n++,u&&(s=u.sampleOffset,u.sampleCount--,u.sampleCount||i++),l.push({dts:a,pts:a+s}),o++}return l}function _getTrackInfo(e){var t,r,n,i,o=_getTrack(e,"vide"),a=_getTrack(e,"soun"),s=findBox(null==o?void 0:o.bodyView,"tkhd"),l=findBox(null==a?void 0:a.bodyView,"tkhd"),c=findBox(null==o?void 0:o.bodyView,"mdhd"),u=findBox(null==a?void 0:a.bodyView,"mdhd"),p=findBox(null==o?void 0:o.bodyView,"avcC")||findBox(null==o?void 0:o.bodyView,"hvcC"),f=findBox(null==a?void 0:a.bodyView,"mp4a"),d=a?_objectSpread2$2(_objectSpread2$2(_objectSpread2$2({type:"audio",trackId:null==(r=l.bodyView)?void 0:r.trackId},u.bodyView),null==f?void 0:f.bodyView),null==(n=null==f?void 0:f.bodyView)?void 0:n.ests):null,h=o?_objectSpread2$2(_objectSpread2$2({type:"video",trackId:null==(i=s.bodyView)?void 0:i.trackId},null==c?void 0:c.bodyView),null==p?void 0:p.bodyView):null;return _defineProperty$2(t={},(null==d?void 0:d.trackId)||0,d),_defineProperty$2(t,(null==h?void 0:h.trackId)||0,h),t}function extractFmp4Samples(e,t){var r=_getTrackInfo(e),n=_findIndexInstanceProperty(e).call(e,(function(e){return"moof"===e.type}));if(-1===n)return!1;r.lastVdts=-1,r.lastAdts=-1;for(var i=n;i<e.length&&"moof"===e[i].type;i+=2){var o=e[i];e[i+1].bodyView=_moofMdatPair(o,t,r)}return!0}function _moofMdatPair(e,t,r){var n,i,o=_filterInstanceProperty(n=e.bodyView).call(n,(function(e){return"traf"===e.type})),a=_filterInstanceProperty(i=_mapInstanceProperty(o).call(o,(function(e){var t=findBox(e.bodyView,"tfhd"),n=findBox(e.bodyView,"tfdt"),i=findBox(e.bodyView,"trun");if(t&&i){var o=t.bodyView.trackId;return _objectSpread2$2({trackId:o,baseDataOffset:t.bodyView.baseDataOffset,defaultSampleDuration:t.bodyView.defaultSampleDuration,defaultSampleSize:t.bodyView.defaultSampleSize,baseMediaDecodeTime:n.bodyView.baseMediaDecodeTime,dataOffset:i.bodyView.dataOffset,samples:i.bodyView.samples,sampleCount:i.bodyView.sampleCount},r[o])}}))).call(i,Boolean);return _mapInstanceProperty(a).call(a,(function(e){var r,n,i,o=e.baseDataOffset,a=e.defaultSampleDuration,s=void 0===a?0:a,l=e.defaultSampleSize,c=void 0===l?0:l,u=e.dataOffset,p=e.baseMediaDecodeTime,f=void 0===p?0:p,d=e.samples,h=e.sps,y=e.timescale,g=e.type,_=o+u,v=0;return e.samples=_mapInstanceProperty(d).call(d,(function(e){var r=t.subarray(_,_+e.size);v+=e.duration||s;var n=f+v;if("video"===g){var i="hev1.1.6.L93.B0"===(null==h?void 0:h.codec),o=NALu.parseNalu(r);return _+=e.size,new Mp4View(n,n+(e.ctOffset||0),NALu.parseNaluType(o,i),y,_,r,e.size||c,(e.duration||s)/y*1e3,"video",i)}return _+=e.size,new Mp4View(n,n+(e.ctOffset||0),null,y,_,r,e.size||c,(e.duration||s)/y*1e3,"audio")})),e.frameLength=e.samples.length,e.duration=v/y,e.iFrames=_filterInstanceProperty(r=e.samples).call(r,(function(e){return"I"===e.frameType})).length,e.pFrames=_filterInstanceProperty(n=e.samples).call(n,(function(e){return"P"===e.frameType})).length,e.bFrames=_filterInstanceProperty(i=e.samples).call(i,(function(e){return"B"===e.frameType})).length,e}))}function avc1(e){var t=e.body,r=e.start,n=new ByteReader(t);return 16,4,50,n.forward(78),splitBox(n.subarray(),r+78+8)}function avcC$1(e){var t=e.body,r={spsArr:[],ppsArr:[]},n=new ByteReader(t);r.configVersion=t[0],r.avcProfile=t[1],r.profileComptibility=t[2],r.avcLevel=t[3],n.forward(4),n.forward(1);var i=31&_sliceInstanceProperty(n).call(n,1);n.forward(1);for(var o=0;o<i;o++){var a=n.readU16();n.forward(2),r.spsArr.push(n.subarray(a)),n.forward(a)}var s=_sliceInstanceProperty(n).call(n,1);n.forward(1);for(var l=0;l<s;l++){var c=n.readU16();n.forward(2),r.ppsArr.push(n.subarray(c)),n.forward(c)}return r}function avcC(e){var t=e.body;if(!(t.length<23)){t[21];for(var r,n,i,o=[],a=[],s=[],l=23,c=t[22],u=0;u<c;u++){r=63&t[l],n=t[l+1]<<8|t[l+2],l+=3;for(var p=0;p<n;p++)if(i=t[l]<<8|t[l+1],l+=2,i){switch(r){case 32:s.push(t.subarray(l,l+i));break;case 33:o.push(t.subarray(l,l+i));break;case 34:a.push(t.subarray(l,l+i))}l+=i}}return{spsArr:o,ppsArr:a,vpsArr:s}}}function btrt(e){var t=e.body,r=new ByteReader(t),n=r.readU32();r.forward(4);var i=r.readU32();return r.forward(4),{bufferSizeDB:n,maxBitrate:i,avgBitrate:r.readU32()}}function cslg(e){var t,r,n,i,o=e.body,a=new ByteReader(o);return a.forward(4),t=a.read32(),a.forward(4),r=a.read32(),a.forward(4),n=a.read32(),a.forward(4),i=a.read32(),a.forward(4),{compositionToDTSShift:t,leastDecodeToDisplayDelta:r,greatestDecodeToDisplayDelta:n,compositionStartTime:i,compositionEndTime:a.read32()}}function ftyp(e){var t=e.body,r=e.length,n=new ByteReader(t),i={compatible:[]};i.major=getBoxType(t,0),n.forward(4),i.version=n.readU32(),n.forward(4);for(var o=n.offset;o<r-8;)i.compatible.push(getBoxType(t,o)),o+=4;return i}function hdlr(e){return{handlerType:getBoxType(e.body,8)}}var MAX_UINT32_COUNT$2=Math.pow(2,32);function mdhd(e){var t=e.body,r={},n=new ByteReader(t),i=t[0];return n.forward(4),1===i?(n.forward(16),r.timescale=n.readU32(),n.forward(4),r.duration=n.readU32()*MAX_UINT32_COUNT$2,n.forward(4),r.duration+=n.readU32()):(n.forward(8),r.timescale=n.readU32(),n.forward(4),r.duration=n.readU32()),r}function mehd(e){var t,r=e.body,n=new ByteReader(r);if(n.forward(4),1===r[0]){var i=n.readU32();n.forward(4),t=i*(1<<30)*2+n.readU32()}else t=n.readU32();return{fragDuration:t}}function mfhd(e){var t=e.body,r=new ByteReader(t);return r.forward(4),{seqNumber:r.readU32()}}var anObject=anObject$h,regexpFlags=function(){var e=anObject(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},call=functionCall,hasOwn2=hasOwnProperty_1,isPrototypeOf$2=objectIsPrototypeOf,regExpFlags=regexpFlags,RegExpPrototype$1=RegExp.prototype,regexpGetFlags=function(e){var t=e.flags;return void 0!==t||"flags"in RegExpPrototype$1||hasOwn2(e,"flags")||!isPrototypeOf$2(RegExpPrototype$1,e)?t:call(regExpFlags,e)},getRegExpFlags=regexpGetFlags,flags$6=getRegExpFlags,isPrototypeOf$1=objectIsPrototypeOf,flags$5=flags$6,RegExpPrototype=RegExp.prototype,flags_1=function(e){return e===RegExpPrototype||isPrototypeOf$1(RegExpPrototype,e)?flags$5(e):e.flags},parent$n=flags_1,flags$4=parent$n,parent$m=flags$4,flags$3=parent$m,parent$l=flags$3,flags$2=parent$l,flags$1=flags$2,flags=flags$1,_flagsInstanceProperty=getDefaultExportFromCjs(flags),MPEG4DescriptorParser=function(){var e=[];e[3]="ES_Descriptor",e[4]="DecoderConfigDescriptor",e[5]="DecoderSpecificInfo",e[6]="SLConfigDescriptor",this.getDescriptorName=function(t){return e[t]};var t=this,r={};return this.parseOneDescriptor=function(t){var n,i,o=0,a=t.readU8();for(t.forward(1),i=t.readU8(),t.forward(1);128&i;)o=(127&i)<<7,i=t.readU8(),t.forward(1);return o+=127&i,(n=e[a]?new r[e[a]](o):new r.Descriptor(o)).parse(t),n},r.Descriptor=function(e,t){this.tag=e,this.size=t,this.descs=[]},r.Descriptor.prototype.parse=function(e){this.data=_sliceInstanceProperty(e).call(e,this.size),e.forward(this.size)},r.Descriptor.prototype.findDescriptor=function(e){for(var t=0;t<this.descs.length;t++)if(this.descs[t].tag===e)return this.descs[t];return null},r.Descriptor.prototype.parseRemainingDescriptors=function(e){for(var r=e.offset;e.offset<r+this.size;){var n=t.parseOneDescriptor(e);this.descs.push(n)}},r.ES_Descriptor=function(e){r.Descriptor.call(this,3,e)},r.ES_Descriptor.prototype=new r.Descriptor,r.ES_Descriptor.prototype.parse=function(e){if(this.ES_ID=e.readU16(),e.forward(2),this.flags=e.readU8(),e.forward(1),this.size-=3,128&_flagsInstanceProperty(this)?(this.dependsOn_ES_ID=e.readU16(),e.forward(2),this.size-=2):this.dependsOn_ES_ID=0,64&_flagsInstanceProperty(this)){var t,r=e.readU8();e.forward(1),this.URL=_mapInstanceProperty(t=_Array$from(_sliceInstanceProperty(e).call(e,r))).call(t,(function(e){return String.fromCharCode(e)})),e.forward(r),this.size-=r+1}else this.URL="";32&_flagsInstanceProperty(this)?(this.OCR_ES_ID=e.readU16(),e.forward(2),this.size-=2):this.OCR_ES_ID=0,this.parseRemainingDescriptors(e)},r.ES_Descriptor.prototype.getOTI=function(e){var t=this.findDescriptor(4);return t?t.oti:0},r.ES_Descriptor.prototype.getAudioConfig=function(e){var t=this.findDescriptor(4);if(!t)return null;var r=t.findDescriptor(5);if(r&&r.data){var n=(248&r.data[0])>>3;return 31===n&&r.data.length>=2&&(n=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),n}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readU8(),e.forward(1),this.streamType=e.readU8(),e.forward(1),this.bufferSize=e.readU24(),e.forward(3),this.maxBitrate=e.readU32(),e.forward(4),this.avgBitrate=e.readU32(),e.forward(4),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};function _adapterEstsInfo(e){var t,r,n,i=_findInstanceProperty(t=e.descs).call(t,(function(e){return 4===e.tag}));i&&(r=_findInstanceProperty(n=i.descs).call(n,(function(e){return 5===e.tag})));var o=_Object$assign({},i);return delete o.descs,o.config=(null==r?void 0:r.data.length)?_Array$from(null==r?void 0:r.data):[],o}function mp4a(e){var t=e.body,r=_sliceInstanceProperty(t).call(t,28),n=(new MPEG4DescriptorParser).parseOneDescriptor(new ByteReader(_sliceInstanceProperty(r).call(r,12),0)),i=(null==n?void 0:n.getAudioConfig)&&n.getAudioConfig();return{channelCount:t[17],samplesize:t[19],sampleRate:t[24]<<8|t[25],objectType:i,codec:"mp4a.40."+i,ests:_adapterEstsInfo(n)}}function mvhd(e){var t=e.body,r=new ByteReader(t),n={};return r.forward(4),n.createTime=r.readU32(),r.forward(4),n.modifyTime=r.readU32(),r.forward(4),n.timescale=r.readU32(),r.forward(4),n.duration=r.readU32(),r.forward(4),n.rate=r.readU32(),r.forward(4),r.forward(2),r.forward(70),n.nextTrackId=r.readU32(),n}function _bytesToHex(e){return _mapInstanceProperty(e).call(e,(function(e){return e.toString(16)})).join("")}function _bytesToStr(e){return _mapInstanceProperty(e).call(e,(function(e){return String.fromCharCode(e)})).join("")}function pssh(e){var t=e.body,r={},n=t[0],i=new ByteReader(t);if(i.forward(4),r.systemId=_bytesToHex(_sliceInstanceProperty(i).call(i,16)),i.forward(16),n>0){var o=i.readU32();r.kids=[];var a=0;for(i.forward(4);a<o;)r.kids.push(_bytesToHex(_sliceInstanceProperty(i).call(i,16))),i.forward(16),a++}var s=i.readU32();return i.forward(4),r.dataSize=s,r.data=_sliceInstanceProperty(i).call(i,s),r.dataToBase64=btoa(_bytesToStr(r.data)),r}function sdtp(e,t){var r=e.body,n=new ByteReader(r);n.forward(4);for(var i,o,a,s,l=[],c=0;c<t;c++){var u=n.readU8();i=(192&u)>>6,o=(48&u)>>4,a=(12&u)>>2,s=3&u,l.push({isLeading:i,dependsOn:o,isDenpendedOn:a,hasRedundancy:s}),n.forward(1)}return{entries:l}}function stco(e){var t=e.body,r=new ByteReader(t);r.forward(4);var n=r.readU32(),i=[];r.forward(4);for(var o=0;o<n;o++){var a=r.readU32();i.push(a),r.forward(4)}return{entries:i,count:i.length}}function stsc(e){var t=e.body,r=new ByteReader(t);r.forward(4);var n=[],i=r.readU32();r.forward(4);for(var o=0;o<i;o++){var a=r.readU32();r.forward(4);var s=r.readU32();r.forward(4);var l=r.readU32();r.forward(4),n.push({firstChunk:a,samplesPreChunk:s,sampleDesIndex:l})}return{entries:n,count:n.length}}function ctts(e){var t=e.body,r=new ByteReader(t);r.forward(4);var n=r.readU32(),i=[];r.forward(4);for(var o=0;o<n;o++){var a=r.readU32();r.forward(4);var s=r.readU32();r.forward(4),i.push({sampleCount:a,sampleOffset:s})}return{entries:i,count:i.length}}function stss(e){var t=e.body,r=new ByteReader(t);r.forward(4);var n=[],i=r.readU32();r.forward(4);for(var o=0;o<i;o++){var a=r.readU32();n.push(a),r.forward(4)}return{entries:n,count:n.length}}function stsz(e){var t=e.body,r=new ByteReader(t);r.forward(4);var n=[],i=r.readU32();r.forward(4);var o=r.readU32();if(r.forward(4),0===i)for(var a=0;a<o;a++){var s=r.readU32();n.push(s),r.forward(4)}else console.warn("parse stsz, sample size not equal 0");return{entries:n,count:n.length}}function stts(e){var t=e.body,r=new ByteReader(t);r.forward(4);var n=r.readU32(),i=[];r.forward(4);for(var o=0;o<n;o++){var a=r.readU32();r.forward(4);var s=r.readU32();r.forward(4),i.push({sampleCount:a,sampleDelta:s})}return{entries:i,count:i.length}}var MAX_UINT32_COUNT$1=Math.pow(2,32);function tfdt(e){var t=e.body,r=new ByteReader(t),n=0;return r.forward(4),1===t[0]?(n=r.readU32()*MAX_UINT32_COUNT$1,r.forward(4),n+=r.readU32()):n=r.readU32(),{baseMediaDecodeTime:n}}function tfhd(e){var t=e.body,r=new ByteReader(t);r.forward(1);var n=_sliceInstanceProperty(r).call(r,3),i=n[0]<<16|n[1]<<8|n[2],o={flags:n},a={baseDataOffsetPresent:!!(1&i),sampleDescriptionIndexPresent:!!(2&i),defaultSampleDurationPresent:!!(8&i),defaultSampleSizePresent:!!(16&i),defaultSampleFlagsPresent:!!(32&i),durationIsEmpty:!!(65536&i),defaultBaseIsMoof:!!(131072&i)};if(o.tfFlags=a,r.forward(3),o.trackId=r.readU32(),a.baseDataOffsetPresent){r.forward(4);var s=r.readU32();r.forward(4);var l=r.readU32();o.baseDataOffset=s<<32|l}else o.baseDataOffset=0,console.warn("base data offset not detected in tfhd");return a.sampleDescriptionIndexPresent&&(r.forward(4),o.sampleDescriptionIndex=r.readU32()),a.defaultSampleDurationPresent&&(r.forward(4),o.defaultSampleDuration=r.readU32()),a.defaultSampleSizePresent&&(r.forward(4),o.defaultSampleSize=r.readU32()),a.defaultSampleFlagsPresent&&(r.forward(4),o.defaultSampleFlags=r.readU32()),o}var MAX_UINT32_COUNT=Math.pow(2,32);function tkhd(e){var t=e.body,r=new ByteReader(t,4),n={},i=r.readU8();n.version=i,1===i?r.forward(16):r.forward(8),n.trackId=r.readU32(),r.forward(4),1===i?(n.duration=r.readU32()*MAX_UINT32_COUNT,r.forward(4),n.duration+=r.readU32()):n.duration=r.readU32();var o=t.byteLength;return o-=8,r.offset=o,n.width=r.readU32()>>16,r.forward(4),n.height=r.readU32()>>16,n}function trex(e){var t=e.body,r={},n=new ByteReader(t);return n.forward(4),r.trackId=n.readU32(),n.forward(4),r.defaultSdescriptionIndex=n.readU32(),n.forward(4),r.defaultSampleDuration=n.readU32(),n.forward(4),r.defaultSampleSize=n.readU32(),n.forward(4),r.defaultSampleFlags=parseSampleFlag(t,n.offset),r}function trun(e){var t=e.body,r={samples:[]},n=new ByteReader(t);r.version=n.readU8(),n.forward(1),r.flags=_sliceInstanceProperty(n).call(n,3);var i=parseTfFlags(_flagsInstanceProperty(r)),o=i.dataOffsetPresent,a=i.firstSampleFlagsPresent,s=i.sampleDurationPresent,l=i.sampleSizePresent,c=i.sampleFlagsPresent,u=i.sampleCompositionTimeOffsetPresent;r.trFlags=i,n.forward(3),r.sampleCount=n.readU32(),n.forward(4),o&&(r.dataOffset=n.readU32(),n.forward(4)),a&&(r.firstSampleFlags=parseSampleFlag(t,n.offset),n.forward(4));for(var p=0;p<r.sampleCount;){var f={};s&&(f.duration=n.readU32(),n.forward(4)),l&&(f.size=n.readU32(),n.forward(4)),c&&(f.flags=parseSampleFlag(t,n.offset),n.forward(4)),u&&(f.ctOffset=n.readU32(),n.forward(4)),r.samples.push(f),p++}return r}function stsd(e){var t=e.body,r=e.start,n=new ByteReader(t);n.forward(4);var i=n.readU32();return n.forward(4),{entryCount:i,childData:splitBox(n.subarray(),r+8+8)}}function mp4Parser(e){var t=splitBox(e instanceof ArrayBuffer?new Uint8Array(e):e,0);if(_parseChildrenRecursion(t),!extractFmp4Samples(t,e)){var r,n=findBox(t,"mdat");if(n)n.bodyView=_filterInstanceProperty(r=[_objectSpread2$2({type:"video"},extractMp4Samples(t,"vide",e)),_objectSpread2$2({type:"audio"},extractMp4Samples(t,"soun",e))]).call(r,(function(e){return!!e.samples}))}return t}function _parseChildrenRecursion(e){var t=0;e.forEach((function(e){switch(e.type){case"ftyp":case"styp":e.bodyView=ftyp(e);break;case"moov":case"trak":case"mvex":case"mdia":case"minf":case"dinf":case"moof":case"traf":case"stbl":e.bodyView=splitBox(e.body,e.start+8),_parseChildrenRecursion(e.bodyView);break;case"stsd":var r=stsd(e),n=r.entryCount,i=r.childData;e.entryCount=n,e.bodyView=i,_parseChildrenRecursion(e.bodyView);break;case"mvhd":e.bodyView=mvhd(e);break;case"tkhd":e.bodyView=tkhd(e);break;case"mehd":e.bodyView=mehd(e);break;case"mdhd":e.bodyView=mdhd(e);break;case"hdlr":e.bodyView=hdlr(e);break;case"trex":e.bodyView=trex(e);break;case"trun":e.bodyView=trun(e),t=e.bodyView.samples.length;break;case"tfdt":e.bodyView=tfdt(e);break;case"avc1":case"hvc1":case"hev1":e.bodyView=avc1(e),_parseChildrenRecursion(e.bodyView);break;case"mp4a":e.bodyView=mp4a(e),e.bodyView&&(e.bodyView.codecType="aac");break;case"avcC":e.bodyView=avcC$1(e);var o=e.bodyView;if(o.codecType="avc",!(null==o?void 0:o.sps)){var a=o.spsArr[0],s=NALu.removeEPB(a);o.sps=AVC.parseSPS(s)}break;case"hvcC":e.bodyView=avcC(e);var l=e.bodyView;if(l.codecType="bytevc1",!(null==l?void 0:l.sps)){var c=l.spsArr[0],u=NALu.removeEPB(c);l.sps=HEVC.parseSPS(u)}break;case"btrt":e.bodyView=btrt(e);break;case"stts":e.bodyView=stts(e),_entriesInstanceProperty(e.bodyView).length&&(t=_entriesInstanceProperty(e.bodyView)[0].sampleCount);break;case"ctts":e.bodyView=ctts(e);break;case"cslg":e.bodyView=cslg(e);break;case"stss":e.bodyView=stss(e);break;case"stsz":e.bodyView=stsz(e);break;case"stsc":e.bodyView=stsc(e);break;case"stco":e.bodyView=stco(e);break;case"sdtp":e.bodyView=sdtp(e,t);break;case"mfhd":e.bodyView=mfhd(e);break;case"tfhd":e.bodyView=tfhd(e);break;case"pssh":e.bodyView=pssh(e)}}))}function getSnapshoot(e){var t,r,n,i,o,a,s=_filterInstanceProperty(e).call(e,(function(e){return"mdat"===e.type}));if(!s.length){var l=_getTrack(e,"vide"),c=_getTrack(e,"soun"),u=null==(r=findBox(null==l?void 0:l.bodyView,"mdhd"))?void 0:r.bodyView,p=(null==(n=findBox(null==l?void 0:l.bodyView,"avcC"))?void 0:n.bodyView)||(null==(i=findBox(null==l?void 0:l.bodyView,"hvcC"))?void 0:i.bodyView),f=null==(o=findBox(null==c?void 0:c.bodyView,"mdhd"))?void 0:o.bodyView,d=null==(a=findBox(null==c?void 0:c.bodyView,"mp4a"))?void 0:a.bodyView;try{return{video:_objectSpread2$2(_objectSpread2$2({},u),{},{duration:(null==u?void 0:u.duration)/u.timescale},p),audio:_objectSpread2$2(_objectSpread2$2(_objectSpread2$2({},f),{},{duration:(null==f?void 0:f.duration)/f.timescale},d),d.ests)}}catch(e){}return{}}var h=_reduceInstanceProperty(t=_mapInstanceProperty(s).call(s,(function(e){return e.bodyView}))).call(t,(function(e,t){return e=_concatInstanceProperty(e).call(e,t)}),[]),y=_reduceInstanceProperty(h).call(h,(function(e,t){var r,n=t.type,i=t.frameLength,o=t.iFrames,a=t.pFrames,s=t.bFrames,l=t.duration;return e[n]?(e[n].frameLength+=i,e[n].iFrames+=o,e[n].pFrames+=a,e[n].bFrames+=s,e[n].duration+=l,e):(e[n]=_Object$assign({},t),e[n].refDuration||(e[n].refDuration=null==(r=t.samples[0])?void 0:r.duration),e)}),{}),g=y.video;if(g){var _=g.frameLength,v=g.iFrames,m=g.pFrames,$=g.bFrames;g.iPercent=timeFixed(v/_*100),g.pPercent=timeFixed(m/_*100),g.bPercent=timeFixed($/_*100)}return y}var Mp4Parser=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"parse",value:function(e){return mp4Parser(e)}},{key:"parseV2",value:function(e,t){var r,n,i,o,a,s,l=_filterInstanceProperty(e).call(e,(function(e){return"mdat"===e.type})),c=[],u=null==(n=null==(r=l[0])?void 0:r.bodyView)?void 0:_filterInstanceProperty(n).call(n,(function(e){return"video"===e.type}))[0],p=null==(o=null==(i=l[0])?void 0:i.bodyView)?void 0:_filterInstanceProperty(o).call(o,(function(e){return"audio"===e.type}))[0],f=Math.min((null==(a=null==p?void 0:p.samples[0])?void 0:a.dtsTime)||0,(null==(s=null==u?void 0:u.samples[0])?void 0:s.dtsTime)||0);l.forEach((function(e){e.bodyView.forEach((function(e){e.samples.forEach((function(e){e.time=timeFixed(e.dtsTime-f),c.push(e)}))}))}));var d={items:_sortInstanceProperty(c).call(c,(function(e,t){return e.time>t.time?1:-1}))};return this._addMetadataToFirstKeyFrame(u),d.rates=getRates(d),d}},{key:"getSnapshoot",value:function(e){return getSnapshoot(e)}},{key:"_addMetadataToFirstKeyFrame",value:function(e){var t;if(e){var r=_filterInstanceProperty(t=e.samples).call(t,(function(e){return e.keyframe}))[0];r&&(r.sps=e.sps,r.vpsArr=e.vpsArr,r.spsArr=e.spsArr,r.ppsArr=e.ppsArr)}}}]),e}(),Config={maxFirstAVDtsGap:.2,minAudioFrameSize:40,maxAVDuationGap:.3,dtsBreakGap:.5,consecutiveFrameGap:.1},AVGapFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e){var t=null==e?void 0:_findInstanceProperty(e).call(e,(function(e){return e.isSample&&"video"===e.streamType})),r=null==e?void 0:_findInstanceProperty(e).call(e,(function(e){return e.isSample&&"audio"===e.streamType}));if(t&&r){var n,i,o,a=t.pts-r.pts,s=timeFixed(a/t.timescale);if(a/t.timescale>=Config.maxFirstAVDtsGap)return[{description:_concatInstanceProperty(n=_concatInstanceProperty(i=_concatInstanceProperty(o="【音视频首帧gap差距过大】视频首帧pts: ".concat(t.pts,", 音频首帧pts: ")).call(o,r.pts,", delta: ")).call(i,a,"(")).call(n,s,"s)"),tips:"".concat(s>10?"可能造成无法起播问题":"")}]}}}]),e}(),TimestampFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e){var t=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"video"===e.streamType})),r=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"audio"===e.streamType})),n=!!e[0]&&e[0]instanceof FlvTagView;return[this._checkBreak(t,"video"),this._checkBreak(r,"audio"),n&&this._checkConsecutiveFrameBreak(null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample})))]}},{key:"_checkBreak",value:function(e,t){var r=e.length;if(r)for(var n=0;n<r-1;n++){var i,o,a,s;if(Math.abs(e[n].dtsTime-e[n+1].dtsTime)>Config.dtsBreakGap)return{description:_concatInstanceProperty(i=_concatInstanceProperty(o=_concatInstanceProperty(a=_concatInstanceProperty(s="【".concat(t,"时间戳发生跳变】,当前帧dts: ")).call(s,e[n].dts,", time:")).call(a,e[n].time,", 后一帧dts: ")).call(o,e[n+1].dts,", time:")).call(i,e[n+1].time)}}}},{key:"_checkConsecutiveFrameBreak",value:function(e){var t=e.length;if(t)for(var r=0;r<t-1;r++)if(Math.abs(e[r].dtsTime-e[r+1].dtsTime)>Config.consecutiveFrameGap){var n,i,o,a,s,l=e[r],c=e[r+1];return{description:_concatInstanceProperty(n=_concatInstanceProperty(i=_concatInstanceProperty(o=_concatInstanceProperty(a=_concatInstanceProperty(s="【前后帧dts差距过大】,当前帧(".concat(l.streamType,")dts: ")).call(s,l.dts,", time:")).call(a,l.time,", 后一帧(")).call(o,c.streamType,")dts: ")).call(i,c.dts,", time:")).call(n,c.time),tips:"可能造成播放画面卡顿或者声音卡顿"}}}}]),e}(),SampleFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e){return[this._checkKeyFrame(e),this._checkAudioFrameDataFull(e)]}},{key:"_checkKeyFrame",value:function(e){var t=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"video"===e.streamType}))[0];if(t&&"I"!==t.frameType)return{description:"【视频首帧非关键帧】",tips:"可能播放花屏或者报解码错误"}}},{key:"_checkAudioFrameDataFull",value:function(e){var t=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"audio"===e.streamType})),r=t.length;if(r)for(var n=0;n<r;n++){var i,o=t[n].data;if((null==o?void 0:o.length)<Config.minAudioFrameSize)return{description:_concatInstanceProperty(i="【音频帧数据较少】 pts=".concat(t[n].pts,", time=")).call(i,t[n].time),tips:"可能由于音频数据原因导致解码报错"}}}}]),e}(),MetadataFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e,t){return[this._hasVideoMetadata(e),this._hasAudioMetadata(e),this._checkRepeatedSps(e),this._metadataOnlyInSequeceHeader(e,t)]}},{key:"_hasVideoMetadata",value:function(e){var t,r=null==(t=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return"video"===e.streamType}))[0])?void 0:t.bodyView;if(r&&!r.sps)return{description:"【未检测到视频metadata信息】",tips:"可能视频无法播放或者报解码错误"}}},{key:"_hasAudioMetadata",value:function(e){var t,r=null==(t=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return"audio"===e.streamType}))[0])?void 0:t.bodyView;if(r&&(!r.config||!r.sampleRate||!r.channelCount))return{description:"【未检测到音频metadata信息】",tips:"可能视频无法播放或者报解码错误"}}},{key:"_checkRepeatedSps",value:function(e){var t,r=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return"video"===e.streamType}))[0],n=(null==(t=null==r?void 0:r.bodyView)?void 0:t.spsArr)||[];if(r&&n.length>1&&n[0].join(",")!==n[1].join(","))return{description:"【关键帧前包含多个sps信息】"}}},{key:"_metadataOnlyInSequeceHeader",value:function(e,t){var r;if("FLV"===t){var n=null==e?void 0:_findInstanceProperty(e).call(e,(function(e){return e.keyframe}));if(n){var i=n.isHevc;return-1===_indexOfInstanceProperty(r=n.nalTypes).call(r,i?33:7)?{description:"【sps、pps信息只存在于Sequence Header中】"}:void 0}}}}]),e}(),HevcFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e){var t=null==e?void 0:_findInstanceProperty(e).call(e,(function(e){return e.isSample&&"video"===e.streamType}));if(t)return t.isHevc?[{id:1,description:"【H265编码格式】",tips:"对于不支持H265解码的设备无法播放"}]:void 0}}]),e}(),HasBFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e){if(null==e?void 0:_findInstanceProperty(e).call(e,(function(e){return e.isSample&&"B"===e.frameType})))return[{description:"【存在B帧】"}]}}]),e}(),DurationFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e){var t=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"video"===e.streamType})),r=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"audio"===e.streamType}));if(t.length&&r.length){var n,i,o=t[t.length-1].ptsTime-t[0].ptsTime,a=r[r.length-1].ptsTime-r[0].ptsTime;if(Math.abs(o-a)>=Config.maxAVDuationGap)return[{description:_concatInstanceProperty(n=_concatInstanceProperty(i="【音视频时长存在差距】, video=".concat(o,"s, audio=")).call(i,a,"s, delta=")).call(n,timeFixed(o-a),"s"),tips:"可能造成播放画面卡顿或者声音卡顿"}]}}}]),e}(),OnlyOneTrackFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e){var t=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"video"===e.streamType})),r=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"audio"===e.streamType}));if(t.length||r.length)return t.length&&r.length?void 0:[{description:"【流开始只包含".concat(t.length?"音频":"视频","】"),tips:"可能播放没有声音或者没有画面"}]}}]),e}();function checkExceptions(e,t){var r,n,i;return _filterInstanceProperty(r=_reduceInstanceProperty(n=_mapInstanceProperty(i=[new HevcFilter,new AVGapFilter,new TimestampFilter,new SampleFilter,new MetadataFilter,new DurationFilter,new HasBFilter,new OnlyOneTrackFilter]).call(i,(function(r){return r.detect(e,t)}))).call(n,(function(e,t){return _concatInstanceProperty(e).call(e,t)}),[])).call(r,Boolean)}var __defProp=_Object$defineProperty,__defNormalProp7=function(e,t,r){return t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},__publicField7=function(e,t,r){return __defNormalProp7(e,"symbol"!==_typeof$1(t)?t+"":t,r),r},Net=function(){function e(t){var r=this;_classCallCheck$1(this,e),__publicField7(this,"_opts",null),__publicField7(this,"_controller",null),__publicField7(this,"_reader",null),__publicField7(this,"_loading",!1),__publicField7(this,"_chunks",[]),__publicField7(this,"_readStream",(function(e,t){var n=0;r._reader=e.getReader();var i=r._chunks;return function e(){var o;return null==(o=r._reader)?void 0:o.read().then((function(r){var o=r.value,a=r.done;return i.push(o),t(n,o),a?_Promise.resolve(concatBuffer(_filterInstanceProperty(i).call(i,Boolean))):(n+=o.byteLength,e())}))}()})),this._opts=t}return _createClass$2(e,[{key:"request",value:function(){var e=this,t=this._opts,r=t.url,n=t.onProgress,i=t.contentType,o=void 0===i?"ArrayBuffer":i,a=t.loadTimeout,s=void 0===a?5e3:a,l=t.headers;return this._controller=new AbortController,_Promise.race([fetch(r,{signal:this._controller.signal,headers:l}),new _Promise((function(t,r){setTimeout((function(){var t;e._loading||(r({code:0,message:"timeout"}),null==(t=e._controller)||t.abort())}),s)}))]).then((function(t){return t.ok&&t.status>=200&&t.status<300?(e._loading=!0,t):_Promise.reject({code:t.status,message:t.statusText})})).then((function(t){switch(o){case"TEXT":return t.text();case"JSON":return t.json();case"ArrayBuffer":return n?e._readStream(t.clone().body,n):t.arrayBuffer()}})).catch((function(t){if(e._loading=!1,"AbortError"!==t.name)return _Promise.reject({code:t.code||0,message:t.message})}))}},{key:"cancel",value:function(){var e,t;try{null==(e=this._reader)||e.cancel(),null==(t=this._controller)||t.abort(),this._reader=null,this._controller=null}catch(e){}}}]),e}(),Flv=function(){function e(){_classCallCheck$1(this,e)}var t;return _createClass$2(e,[{key:"parse",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i,o,a,s,l,c,u,p,f,d,h=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=[],this._loader=new Net(_objectSpread2$2(_objectSpread2$2({url:t},r),{},{onProgress:function(e,t){c.push(t),e>r.probeSize&&h._loader.cancel()}})),e.next=4,this._loader.request();case 4:return u=new Flv$1,p=u.parse(concatBuffer(c)),f=u.getSnapshoot(p),d=null==(n=f.video)?void 0:n.sps,e.abrupt("return",{codec:null==(i=f.video)?void 0:i.codecType,codecStr:null==d?void 0:d.codec,width:null==d?void 0:d.width,height:null==d?void 0:d.height,vDration:null==(o=null==f?void 0:f.video)?void 0:o.duration,aDuration:null==(a=null==f?void 0:f.audio)?void 0:a.duration,sampleRate:null==(s=null==f?void 0:f.audio)?void 0:s.sampleRate,channelCount:null==(l=null==f?void 0:f.audio)?void 0:l.channelCount,views:p,snap:f});case 9:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),e}(),vparser_min={exports:{}};vparser_min.exports=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){void 0!==_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$1(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=0)}([function(e,t,r){function n(e,t){var r=_Object$keys(e);if(_Object$getOwnPropertySymbols){var n=_Object$getOwnPropertySymbols(e);t&&(n=_filterInstanceProperty(n).call(n,(function(t){return _Object$getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){return(i="function"==typeof _Symbol&&"symbol"==_typeof$1(_Symbol$iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof _Symbol&&e.constructor===_Symbol&&e!==_Symbol.prototype?"symbol":_typeof$1(e)})(e)}function o(e,t,r){return t in e?_Object$defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.r(t),r.d(t,"m3u8Parser",(function(){return p})),r.d(t,"mpdParser",(function(){return g}));var a=/EXT(?:-X-)?([^:]+):?(.*)$/,s=/([^,="]+)((="[^"]+")|(=[^,]+))*/g;function l(e){var t;return _reduceInstanceProperty(t=e.split("-")).call(t,(function(e,t){return e+(e?t.charAt(0)+_sliceInstanceProperty(t).call(t,1).toLowerCase():t.toLowerCase())}),"")}function c(e){if(!/^#EXT/.test(e)&&/^\s*#/.test(e))return null;var t,r,c=a.exec(e);return c?(t=l(c[1]),r=function(e,t){if(!e)return null;var r=_mapInstanceProperty(t=e.match(s)).call(t,(function(e){return function(e){var t=_trimInstanceProperty(e).call(e).replace("=","|").split("|");if(2==t.length)return o({},l(t[0]),t[1].replace(/("|')/g,""));var r=_parseFloat$7(t[0]);return _Number$isNaN(r)?t[0]:r}(e)}));return 1===r.length?r[0]:0===_filterInstanceProperty(r).call(r,(function(e){return"object"===i(e)})).length?r:_reduceInstanceProperty(r).call(r,(function(e,t){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){o(e,t,r[t])})):_Object$getOwnPropertyDescriptors?_Object$defineProperties(e,_Object$getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){_Object$defineProperty(e,t,_Object$getOwnPropertyDescriptor(r,t))}))}return e}({},e,{},t)}),{})}(c[2])):(t="url",r=e),o({},t,r)}function u(e,t){if(/^https?/.test(e)||/^data:/.test(e)||/^sdk:/.test(e))return e;for(t=_sliceInstanceProperty(r=t.split("/")).call(r,0,-1),e=e.split("/");e.length;){var r,n=e.shift();-1==_indexOfInstanceProperty(t).call(t,n)&&t.push(n)}return t.join("/")}var p=function(e,t,r){var n,i,o;if(!e||!t)return{error:1,msg:"invalid input"};var a,s=_filterInstanceProperty(n=_mapInstanceProperty(i=_filterInstanceProperty(o=e.split("\n")).call(o,Boolean)).call(i,(function(e){return c(_trimInstanceProperty(e).call(e))}))).call(n,Boolean);if(!s.length)return{error:1,msg:"invalid m3u8"};a=0!==_filterInstanceProperty(s).call(s,(function(e){return!!e.streamInf})).length?{master:!0,m3u8Url:t,levels:[],medias:[]}:{master:!1,m3u8Url:t,duration:0,startSN:0,endSN:0,segments:[],live:!0};try{a=function(e,t,r){for(var n=t.master,i=e.length,o=0,a=0,s=0,l=0,c=0,p=-1,f=0;f<i;f++){var d=e[f];for(var h in d){var y=d[h];switch(y&&y.uri&&(y.url=u(y.uri,t.m3u8Url)),h){case"inf":var g={start:a,end:a+(Array.isArray(y)?y[0]:y),cc:o,sn:s+l};p>=0&&(g.keyIndex=p),l++,a=g.end,t.segments.push(g);break;case"start":a=y;break;case"discontinuity":o++;break;case"mediaSequence":s=y;break;case"streamInf":c++,y.levelId=c,t.levels.push(y);break;case"media":t.medias.push(y);break;case"endlist":t.live=!1;break;case"key":p++,t.key?t.key.push(y):t.key=[y];break;case"url":var _=n?t.levels:t.segments;if(!_.length)throw new Error("invalid m3u8");n?_[c-1].url=u(y,t.m3u8Url):_[l-1].url=u(y,t.m3u8Url);break;default:y&&(t[h]=y)}}r&&(t=r(d,t))}return n||(t.startSN=s,t.endSN=s+l-1,t.duration=a),t}(s,a,r)}catch(e){return{error:1,msg:e.message}}return a},f=/\s*(<\/?[^>]+>)/,d=/\s*(?:<\/?([^\s>]+))?\s*([^>]+)*(?:\/?>)?/,h=/\s*([^=]+)="([^"]+)"/g;function y(e,t){for(var r,n,i,o=[],a=e.length,s=0;s<a;s++)if((r=e[s]).closed)if(n=o.pop(),"pureValue"!==r.tagName){if(n&&n.tagName===r.tagName?i=o.pop():(i=n,n=r),!i){o.push(n);break}var l=n,c=l.tagName,u=l.attrs,p=i.attrs[c];t&&(u=t(c,u)),i.attrs[c]=p?Array.isArray(p)?_concatInstanceProperty(p).call(p,u):[p,u]:u,o.push(i)}else n.attrs?n.attrs.value=r.attrs.value:n.attrs=r.attrs,o.push(n);else o.push(r);var f,d,h,y=o[0];return y?"undefined"!=y.tagName?(f={},d=y.tagName,h=y.attrs,d in f?_Object$defineProperty(f,d,{value:h,enumerable:!0,configurable:!0,writable:!0}):f[d]=h,f):y.tagName:null}var g=function(e,t){if(!e)return{error:1,msg:"invalid input"};try{var r,n,i;return y(_filterInstanceProperty(r=_mapInstanceProperty(n=_filterInstanceProperty(i=e.split(f)).call(i,Boolean)).call(n,(function(e){return function(e){var t,r,n=e.match(d),i={},o=(t=n&&n[1])?_reduceInstanceProperty(r=t.split("_")).call(r,(function(e,t){return e?e+=t.charAt(0).toUpperCase()+_sliceInstanceProperty(t).call(t,1):e=t.charAt(0).toLowerCase()+_sliceInstanceProperty(t).call(t,1)}),""):"";if(n&&n[1]&&n[2]){for(var a,s={};null!=(a=h.exec(n[2]));)s[a[1]]=a[2];return"?xml"===o?null:(i.tagName=o,i.attrs=s,i.closed=/\/$/.test(n[2]),i)}return n?/^<\//.test(n[0])?(i.tagName=o,i.closed=!0,i):/^</.test(n[0])?(i.tagName=o,i.attrs={},i):(i.tagName="pureValue",i.attrs={value:n[2]},i.closed=!0,i):null}(e)}))).call(r,Boolean),t)}catch(e){return{error:1,msg:e.message}}}}]);var vparser_minExports=vparser_min.exports;function loadM3u8(e){return _loadM3u.apply(this,arguments)}function _loadM3u(){return _loadM3u=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new Net(_objectSpread2$2(_objectSpread2$2({url:t},o.length>1&&void 0!==o[1]?o[1]:{}),{},{contentType:"TEXT"})),e.next=4,r.request();case 4:return n=e.sent,i=vparser_minExports.m3u8Parser(n,t,(function(e,t){var r;if(!e.url||!/^\//.test(e.url))return t;var n=e.url,i=t.segments[t.segments.length-1];return i.url=_sliceInstanceProperty(r=i.url.split("/")).call(r,0,3).join("/")+n,t})),e.abrupt("return",i);case 7:case"end":return e.stop()}}),e)}))),_loadM3u.apply(this,arguments)}var Hls=function(){function e(){_classCallCheck$1(this,e)}var t;return _createClass$2(e,[{key:"parse",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i,o,a,s,l,c,u,p,f,d,h,y,g,_,v;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,loadM3u8(t,r);case 2:if(!(c=e.sent).master){e.next=7;break}return e.next=6,loadM3u8(c.levels[0].url);case 6:c=e.sent;case 7:if(null==c?void 0:c.segments.length){e.next=9;break}throw new Error("invalid m3u8");case 9:u=[],p=r.nbSegment,f=0,d=_regeneratorRuntime().mark((function e(){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new Net(_objectSpread2$2(_objectSpread2$2({url:c.segments[f].url},r),{},{onProgress:function(e,n){u.push(n),e>r.probeSize&&t.cancel()}})),e.next=3,t.request();case 3:p--,f++;case 5:case"end":return e.stop()}}),e)}));case 13:if(!p){e.next=17;break}return e.delegateYield(d(),"t0",15);case 15:e.next=13;break;case 17:return h=new Uint8Array(concatBuffer(_filterInstanceProperty(u).call(u,Boolean))),y=new TsParser,g=y.parse(h),_=y.getSnapshoot(g),v=null==(n=_.video)?void 0:n.sps,e.abrupt("return",{codec:null==(i=_.video)?void 0:i.codecType,codecStr:null==v?void 0:v.codec,width:null==v?void 0:v.width,height:null==v?void 0:v.height,vDration:null==(o=null==_?void 0:_.video)?void 0:o.duration,aDuration:null==(a=null==_?void 0:_.audio)?void 0:a.duration,sampleRate:null==(s=null==_?void 0:_.audio)?void 0:s.sampleRate,channelCount:null==(l=null==_?void 0:_.audio)?void 0:l.channelCount,views:g,snap:_});case 23:case"end":return e.stop()}}),e)}))),function(e,r){return t.apply(this,arguments)})}]),e}(),Mp4=function(){function e(){_classCallCheck$1(this,e)}var t;return _createClass$2(e,[{key:"parse",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i,o,a,s,l,c,u,p,f,d,h,y,g,_,v,m,$,b;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=new Net(_objectSpread2$2(_objectSpread2$2({url:t},r),{},{contentType:"ArrayBuffer",headers:{Range:"bytes=0-1499"}})),p=[],e.next=4,u.request();case 4:return f=e.sent,d=new Uint8Array(f),h=(new Mp4Parser).parse(d),y=_findInstanceProperty(h).call(h,(function(e){return"mdat"===e.type})),(g=_findInstanceProperty(h).call(h,(function(e){return"moov"===e.type})))?(p.push(g.start),p.push(g.start+g.size)):y&&p.push(y.start+y.size),u=new Net(_objectSpread2$2(_objectSpread2$2({url:t},r),{},{contentType:"ArrayBuffer",headers:{Range:_concatInstanceProperty(n="bytes=".concat(p[0],"-")).call(n,p[1]||"")}})),e.next=13,u.request();case 13:return _=e.sent,v=new Mp4Parser,m=v.parse(_),$=v.getSnapshoot(m),b=null==(i=$.video)?void 0:i.sps,e.abrupt("return",{codec:null==(o=$.video)?void 0:o.codecType,codecStr:null==b?void 0:b.codec,width:null==b?void 0:b.width,height:null==b?void 0:b.height,vDration:null==(a=null==$?void 0:$.video)?void 0:a.duration,aDuration:null==(s=null==$?void 0:$.audio)?void 0:s.duration,sampleRate:null==(l=null==$?void 0:$.audio)?void 0:l.sampleRate,channelCount:null==(c=null==$?void 0:$.audio)?void 0:c.channelCount,views:v.parseV2(m,!0),snap:$});case 19:case"end":return e.stop()}}),e)}))),function(e,r){return t.apply(this,arguments)})}]),e}(),Lite=function(){function e(){_classCallCheck$1(this,e)}var t;return _createClass$2(e,[{key:"parseUrl",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=_Object$assign({timeout:5e3,probeSize:8e4,nbSegment:1},n=a.length>1&&void 0!==a[1]?a[1]:{}),!/flv/.test(t)){e.next=9;break}return e.next=5,(new Flv).parse(t,n);case 5:i=e.sent,o=FORMAT.FLV,e.next=20;break;case 9:if(!/m3u8?/.test(t)){e.next=16;break}return e.next=12,(new Hls).parse(t,n);case 12:i=e.sent,o=FORMAT.TS,e.next=20;break;case 16:return e.next=18,(new Mp4).parse(t,n);case 18:i=e.sent,o=FORMAT.MP4;case 20:return i.exceps=_filterInstanceProperty(r=checkExceptions(i.views.items,o)).call(r,(function(e){return 1!==e.id})),e.abrupt("return",i);case 22:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),e}(),getFlvStrategy=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o,a,s,l,c,u,p,f,d,h,y,g,_,v,m,$,b,S;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d=(null==t||null===(r=t.flv)||void 0===r?void 0:r.enableLowLatency)&&"pc"===sniffer$1.device,h=null===(n=null==t||null===(i=t.flv)||void 0===i||null===(i=i.lowLatency)||void 0===i?void 0:i.enableFrameChasing)||void 0===n||n,y=null!==(o=null==t||null===(a=t.flv)||void 0===a||null===(a=a.lowLatency)||void 0===a?void 0:a.abrPts)&&void 0!==o?o:"-800",e.next=5,getCodec(t);case 5:return g=e.sent,e.next=8,isSoftDecode(t,g);case 8:if(e.sent&&(f=g===Codec.H265?createSoftDecodeH265Strategy():createSoftDecodeH264Strategy(),p=createFlvMseStrategy(t)),isMseSupported("unknown"===g?Codec.H264:g)&&(p=createFlvMseStrategy(t)),p||f){e.next=13;break}return e.abrupt("return",{});case 13:return e.next=15,_Promise.all([(null===(s=p)||void 0===s?void 0:s.module)&&load(p.module).catch((function(){})),(null===(l=f)||void 0===l?void 0:l.module)&&load(f.module).catch((function(){}))]);case 15:return _=e.sent,v=_slicedToArray(_,2),m=v[0],(null==($=v[1])?void 0:$.XGVideoPlugin)&&(null===(c=f)||void 0===c||null===(u=c.afterLoad)||void 0===u||u.call(c,null==$?void 0:$.XGVideoPlugin)),b=combineOptions([p,f]),S=[],d&&(b.url=appendSearchParams(t.url,{abr_pts:y})),m&&(S.push(m.FlvPlugin),d&&h&&S.push(m.Adaptive)),e.abrupt("return",{options:b,plugins:S});case 25:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),getHlsStrategy=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o,a,s,l,c,u,p,f,d,h;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,getCodec(t);case 2:return c=e.sent,e.next=5,isSoftDecode(t,c);case 5:if(e.sent&&(l=c===Codec.H265?createSoftDecodeH265Strategy():createSoftDecodeH264Strategy(),s=createHlsMseStrategy(t)),("mobile"!==sniffer$1.device||null!=t&&null!==(r=t.hls)&&void 0!==r&&r.enableMSE)&&isMseSupported("unknown"===c?Codec.H264:c)&&(s=createHlsMseStrategy(t)),s||l){e.next=10;break}return e.abrupt("return",{});case 10:return e.next=12,_Promise.all([(null===(n=s)||void 0===n?void 0:n.module)&&load(s.module).catch((function(){})),(null===(i=l)||void 0===i?void 0:i.module)&&load(l.module).catch((function(){}))]);case 12:return u=e.sent,p=_slicedToArray(u,2),f=p[0],(null==(d=p[1])?void 0:d.XGVideoPlugin)&&(null===(o=l)||void 0===o||null===(a=o.afterLoad)||void 0===a||a.call(o,null==d?void 0:d.XGVideoPlugin)),h=combineOptions([s,l]),e.abrupt("return",{options:h,plugins:null!=f&&f.HlsPlugin?[f.HlsPlugin]:[]});case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),createFlvMseStrategy=function(e){var t,r,n;return{options:{flv:_objectSpread2$2({retryCount:0,disconnectRetryCount:null!==(t=null==e||null===(r=e.flv)||void 0===r?void 0:r.retryCount)&&void 0!==t?t:void 0},null!==(n=null==e?void 0:e.flv)&&void 0!==n?n:{})},module:DynamicModule.PluginFlv}},createHlsMseStrategy=function(e){var t;return{options:{hls:_objectSpread2$2({retryCount:0,pollRetryCount:0},null!==(t=null==e?void 0:e.hls)&&void 0!==t?t:{})},module:DynamicModule.PluginHls}},createSoftDecodeH264Strategy=function(){return{options:{mediaType:"xg-video",innerDegrade:1,codecType:Codec.H264},module:DynamicModule.PluginXgvideo,afterLoad:function(e){e.isSupported()&&e.setDecodeCapacity({preloadDecoder:Codec.H264,wasmFallbackToAsm:!1,reuseWasmDecoder:!1,disabledWhenErrorOccur:!1})}}},createSoftDecodeH265Strategy=function(){return{options:{mediaType:"xg-video",innerDegrade:1,codecType:Codec.H265},module:DynamicModule.PluginXgvideo,afterLoad:function(e){e.isSupported()&&e.setDecodeCapacity({preloadDecoder:Codec.H265,wasmFallbackToAsm:!1,reuseWasmDecoder:!1})}}};function getCodec(e){return _getCodec.apply(this,arguments)}function _getCodec(){return(_getCodec=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.codec){e.next=2;break}return e.abrupt("return",t.codec);case 2:if(t.degradation!==Degradation.SoftFirst||!t.url){e.next=6;break}return e.next=5,detectCodec(t.url);case 5:return e.abrupt("return",e.sent);case 6:return e.abrupt("return","unknown");case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function detectCodec(e){return _detectCodec.apply(this,arguments)}function _detectCodec(){return(_detectCodec=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(new Lite).parseUrl(t);case 3:if(r=e.sent,"bytevc1"!==(n=r.codec)){e.next=9;break}return e.abrupt("return",Codec.H265);case 9:if("avc"!==n){e.next=11;break}return e.abrupt("return",Codec.H264);case 11:return e.abrupt("return","unknown");case 14:return e.prev=14,e.t0=e.catch(0),console.error("detect codec error: ",e.t0),e.abrupt("return","unknown");case 18:case"end":return e.stop()}}),e,null,[[0,14]])})))).apply(this,arguments)}function isSoftDecode(e,t){return _isSoftDecode.apply(this,arguments)}function _isSoftDecode(){return(_isSoftDecode=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.decodeType!==DecodeType.Software){e.next=2;break}return e.abrupt("return",!0);case 2:if("unknown"!==r){e.next=4;break}return e.abrupt("return",!1);case 4:return e.next=6,getCodec(t);case 6:if(e.sent!==Codec.H265){e.next=12;break}if(!sniffer$1.isHevcSupported()){e.next=10;break}return e.abrupt("return",!1);case 10:if(t.degradation!==Degradation.SoftFirst){e.next=12;break}return e.abrupt("return",!0);case 12:return e.abrupt("return",!1);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function combineOptions(e){return _reduceInstanceProperty(e).call(e,(function(e,t){return _Object$assign(e,null==t?void 0:t.options)}),{})}var VeError=VeError$1,LiveErrorCode=function(e){return e[e.INVALID_PARAMETER=210]="INVALID_PARAMETER",e}(LiveErrorCode||{}),ErrorCode=_objectSpread2$2(_objectSpread2$2({},LiveErrorCode),ErrorCode$1),ERRORS=_objectSpread2$2(_objectSpread2$2({},ERROR_INFO),{},_defineProperty$2({},210,{messageTextKey:"INVALID_PARAMETER",level:Level.Fatal}));function create4(e,t){return new VeError(ERRORS[e],t)}function isRTMSupported(){return _isRTMSupported.apply(this,arguments)}function _isRTMSupported(){return(_isRTMSupported=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,load(DynamicModule.PluginRtm);case 2:return t=e.sent,r=t.RtmPlugin,e.abrupt("return",r.isSupported());case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function isRTMSupportCodec(){return _isRTMSupportCodec.apply(this,arguments)}function _isRTMSupportCodec(){return _isRTMSupportCodec=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r,n,i=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:RTMCodec.H264,e.next=3,load(DynamicModule.PluginRtm);case 3:if(r=e.sent,n=r.RtmPlugin,t!==RTMCodec.H264){e.next=7;break}return e.abrupt("return",n.isSupportedH264());case 7:return e.abrupt("return",!1);case 8:case"end":return e.stop()}}),e)}))),_isRTMSupportCodec.apply(this,arguments)}var _excluded$1=["fallbackUrl","enableFallback","enableRTMAutoTranscode"],rtmStrategy={options:{},module:DynamicModule.PluginRtm},generateFallbackUrl=function(e){return"pc"===sniffer$1.device?e.replace(".sdp",".flv"):e.replace(".sdp",".m3u8")},getRtmStrategy=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i,o,a,s,l,c,u,p,f,d,h,y,g,_,v,m,$,b,S,E;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.url,s=t.rtm||{},l=s.fallbackUrl,c=s.enableFallback,u=void 0===c||c,p=s.enableRTMAutoTranscode,f=_objectWithoutProperties(s,_excluded$1),d=u?!l&&a?generateFallbackUrl(a):l:"","flv"===(h=d&&util.getStreamType(d))&&util.isMseSupported(Codec.H264)?o=createFlvMseStrategy(t):"hls"===h&&("mobile"!==sniffer$1.device||null!=t&&null!==(n=t.hls)&&void 0!==n&&n.enableMSE)&&util.isMseSupported(Codec.H264)&&(o=createHlsMseStrategy(t)),e.next=7,_Promise.all([load(rtmStrategy.module).then((function(e){return e.RtmPlugin})).catch((function(){})),o&&load(o.module).then((function(e){var t,r;return(null===(t=o)||void 0===t?void 0:t.module)===DynamicModule.PluginFlv?e.FlvPlugin:(null===(r=o)||void 0===r?void 0:r.module)===DynamicModule.PluginHls?e.HlsPlugin:void 0})).catch((function(){}))]);case 7:return y=e.sent,g=_slicedToArray(y,2),_=g[0],v=g[1],e.next=13,_Promise.all([isRTMSupported(),isRTMSupportCodec()]);case 13:if(m=e.sent,$=_slicedToArray(m,2),b=$[0],S=$[1],b&&S){e.next=20;break}return r&&r.emit("degrade",{url:d,originRtmUrl:a,code:"NOT_SUPPORT",message:"not support rtm or h264",isRTMSupported:b,isRTMSupportCodec:S}),e.abrupt("return",{options:_objectSpread2$2(_objectSpread2$2({},(null===(E=o)||void 0===E?void 0:E.options)||{}),{},{url:d,_RTMdegrade:{_originRtmUrl:a,_isRTMSupported:b,_isRTMSupportCodec:S}}),plugins:v?[v]:[]});case 20:return e.abrupt("return",{options:_objectSpread2$2(_objectSpread2$2({},(null===(i=o)||void 0===i?void 0:i.options)||{}),{},{url:p?util.appendSearchParams(a,{enableRTMAutoTranscode:"true"}):void 0,_RTMdegrade:void 0,rts:_objectSpread2$2(_objectSpread2$2({retryCount:0},f),{},{backupURL:d,backupConstruct:v})}),plugins:_?[_]:[]});case 21:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),DrmType=function(e){return e.Fairplay="fairplay",e}(DrmType||{});function getDrmType(e){if(null!=e&&e.fairplay&&("safari"===sniffer$1.browser||sniffer$1.os.isIos))return"fairplay"}function isMseSupportedWithDrm(e){var t=e.drm,r=e.streamType,n=getDrmType(t);return!n||("fairplay"!==n||"hls"!==r)}var getTypeStrategy=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=t.url?util.getStreamType(t.url):"")&&"unknown"!==n){e.next=3;break}return e.abrupt("return",{options:{},plugins:[]});case 3:if("rtm"!==n){e.next=7;break}return e.next=6,getRtmStrategy(t,r);case 6:case 10:case 16:return e.abrupt("return",e.sent);case 7:if("flv"!==n){e.next=11;break}return e.next=10,getFlvStrategy(t);case 11:if("hls"!==n){e.next=17;break}if(isMseSupportedWithDrm({drm:t.drm,streamType:n})){e.next=14;break}return e.abrupt("return",{options:{},plugins:[]});case 14:return e.next=16,getHlsStrategy(t);case 17:return e.abrupt("return",{options:{},plugins:[]});case 18:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),FUNC_ERROR_TEXT="Expected a function",NAN=NaN,symbolTag="[object Symbol]",reTrim=/^\s+|\s+$/g,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=_parseInt$7,freeGlobal="object"==_typeof$1(commonjsGlobal$1)&&commonjsGlobal$1&&commonjsGlobal$1.Object===Object&&commonjsGlobal$1,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof$1(self))&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),objectProto=Object.prototype,objectToString=objectProto.toString,nativeMax=Math.max,nativeMin=Math.min,now=function(){return root.Date.now()};function debounce(e,t,r){var n,i,o,a,s,l,c=0,u=!1,p=!1,f=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT);function d(t){var r=n,o=i;return n=i=void 0,c=t,a=e.apply(o,r)}function h(e){var r=e-l;return void 0===l||r>=t||r<0||p&&e-c>=o}function y(){var e=now();if(h(e))return g(e);s=setTimeout(y,function(e){var r=t-(e-l);return p?nativeMin(r,o-(e-c)):r}(e))}function g(e){return s=void 0,f&&n?d(e):(n=i=void 0,a)}function _(){var e=now(),r=h(e);if(n=arguments,i=this,l=e,r){if(void 0===s)return function(e){return c=e,s=setTimeout(y,t),u?d(e):a}(l);if(p)return s=setTimeout(y,t),d(l)}return void 0===s&&(s=setTimeout(y,t)),a}return t=toNumber(t)||0,isObject$2(r)&&(u=!!r.leading,o=(p="maxWait"in r)?nativeMax(toNumber(r.maxWait)||0,t):o,f="trailing"in r?!!r.trailing:f),_.cancel=function(){void 0!==s&&clearTimeout(s),c=0,n=l=i=s=void 0},_.flush=function(){return void 0===s?a:g(now())},_}function isObject$2(e){var t=_typeof$1(e);return!!e&&("object"==t||"function"==t)}function isObjectLike(e){return!!e&&"object"==_typeof$1(e)}function isSymbol(e){return"symbol"==_typeof$1(e)||isObjectLike(e)&&objectToString.call(e)==symbolTag}function toNumber(e){if("number"==typeof e)return e;if(isSymbol(e))return NAN;if(isObject$2(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=isObject$2(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(reTrim,"");var r=reIsBinary.test(e);return r||reIsOctal.test(e)?freeParseInt(_sliceInstanceProperty(e).call(e,2),r?2:8):reIsBadHex.test(e)?NAN:+e}var lodash_debounce=debounce,debounce$1=getDefaultExportFromCjs(lodash_debounce),Events=_objectSpread2$2(_objectSpread2$2({},Events$1),{},{TIME_SHIFT_CHANGE:"timeShiftChange",REFRESH_CLICK:"refreshClick"});function RefreshIcon(){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 refresh="",POSITIONS=Plugin.POSITIONS,Refresh=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(){return _classCallCheck$1(this,r),t.apply(this,arguments)}return _createClass$2(r,[{key:"afterCreate",value:function(){this.config.disable||(this.appendChild(".xgplayer-icon",this.icons.refresh),this._initEvents())}},{key:"registerIcons",value:function(){return{refresh:{icon:RefreshIcon,class:"xgplayer-refresh-svg"}}}},{key:"destroy",value:function(){this.unbind(["touchend","click"],this._handleRefresh)}},{key:"render",value:function(){var e=this.player.config.i18nManager;return'\n <xg-icon class="veplayer-refresh">\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="refresh">'.concat(e.getText("REFRESH"),"</div>\n </xg-icon>\n ")}},{key:"_handleRefresh",value:function(e){var t=this.player;if(t){var r,n;if(e.preventDefault(),e.stopPropagation(),t.addClass("xgplayer-is-enter"),t.pause(),t)t.emit(Events.REFRESH_CLICK),null===(r=this.player)||void 0===r||null===(r=r.config)||void 0===r||null===(r=r.veplayer)||void 0===r||r.retry(),null===(n=this.player)||void 0===n||null===(n=n.plugins)||void 0===n||null===(n=n.error)||void 0===n||n.hideError();t.once(CANPLAY,(function(){t.removeClass("xgplayer-is-enter")}))}}},{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:"pluginName",get:function(){return"refresh"}},{key:"defaultConfig",get:function(){return{position:POSITIONS.CONTROLS_LEFT,index:1,disable:!1}}}]),r}(),path$4=path$x,urlSearchParams$5=path$4.URLSearchParams,parent$k=urlSearchParams$5,urlSearchParams$4=parent$k,parent$j=urlSearchParams$4,urlSearchParams$3=parent$j,parent$i=urlSearchParams$3,urlSearchParams$2=parent$i,urlSearchParams$1=urlSearchParams$2,urlSearchParams=urlSearchParams$1,_URLSearchParams=getDefaultExportFromCjs(urlSearchParams),$$5=_export,parseInt$1=numberParseInt;$$5({target:"Number",stat:!0,forced:Number.parseInt!=parseInt$1},{parseInt:parseInt$1});var path$3=path$x,_parseInt$5=path$3.Number.parseInt,parent$h=_parseInt$5,_parseInt$4=parent$h,parent$g=_parseInt$4,_parseInt$3=parent$g,parent$f=_parseInt$3,_parseInt$2=parent$f,_parseInt$1=_parseInt$2,_parseInt=_parseInt$1,_Number$parseInt=getDefaultExportFromCjs(_parseInt),$$4=_export,parseFloat$1=numberParseFloat;$$4({target:"Number",stat:!0,forced:Number.parseFloat!=parseFloat$1},{parseFloat:parseFloat$1});var path$2=path$x,_parseFloat$5=path$2.Number.parseFloat,parent$e=_parseFloat$5,_parseFloat$4=parent$e,parent$d=_parseFloat$4,_parseFloat$3=parent$d,parent$c=_parseFloat$3,_parseFloat$2=parent$c,_parseFloat$1=_parseFloat$2,_parseFloat=_parseFloat$1,_Number$parseFloat=getDefaultExportFromCjs(_parseFloat);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 ownKeys2(e,t){var r=_Object$keys(e);if(_Object$getOwnPropertySymbols){var n=_Object$getOwnPropertySymbols(e);t&&(n=_filterInstanceProperty(n).call(n,(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?ownKeys2(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):_Object$getOwnPropertyDescriptors?_Object$defineProperties(e,_Object$getOwnPropertyDescriptors(r)):ownKeys2(Object(r)).forEach((function(t){_Object$defineProperty(e,t,_Object$getOwnPropertyDescriptor(r,t))}))}return e}var 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,o=t[r];if(_indexOfInstanceProperty(i=t[r]).call(i,e)>=0)return o.split("=")[1]||null}},genRandomID$1=function(e){return String(Math.floor(Math.random()*Math.pow(10,e)))},getDeviceID$1=function(){var e=getCookie(device_id_key);if(e)return e;var t=genRandomID$1(11);return document.cookie=device_id_key+"="+t+";max-age=31536000;path=/",t},getUserId$1=function(){var e=getCookie(user_id_key);if(e)return e;var t=genRandomID$1(12);return document.cookie=user_id_key+"="+t+";max-age=31536000;path=/",t},getLogId=function(){return genRandomID$1(12)};function getBrowser(){var e=navigator.userAgent.toLowerCase(),t={},r={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:_indexOfInstanceProperty(e).call(e,"chrome")>-1&&_indexOfInstanceProperty(e).call(e,"safari")>-1,Firefox:_indexOfInstanceProperty(e).call(e,"firefox")>-1,Opera:_indexOfInstanceProperty(e).call(e,"opera")>-1,Safari:_indexOfInstanceProperty(e).call(e,"safari")>-1&&-1==_indexOfInstanceProperty(e).call(e,"chrome"),Edge:_indexOfInstanceProperty(e).call(e,"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 p=e.match(/qqbrowser\/([\d.]+)/);i=p?p[1]:"-1"}t.type=n,t.versions=_parseInt$7(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 Date.now()}function getPlayFormat(e){var t="unknown";return"string"!=typeof e?t:_indexOfInstanceProperty(e).call(e,".flv")>-1?"flv":_indexOfInstanceProperty(e).call(e,".m3u8")>-1?"m3u8":_indexOfInstanceProperty(e).call(e,".mp4")>-1?"mp4":_indexOfInstanceProperty(e).call(e,".sdp")>-1?"rts":t}function isCodecSupport(e){return"undefined"!=typeof MediaSource?+MediaSource.isTypeSupported("video/mp4; codecs="+e):0}function getUrlQuery(e,t,r){var n=new _URLSearchParams(e.split("?")[1]);return n.get(t)||n.get(r)}function getDeviceInfo(){var e={cpu_core_number:-1,memory_usage:-1,network_downlink:-1};try{e.cpu_core_number=navigator.hardwareConcurrency||-1,e.memory_usage=navigator.deviceMemory||-1,e.network_downlink=navigator.connection&&navigator.connection.downlink,null==e.network_downlink&&(e.network_downlink=-1)}catch(e){}return e}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.rtm)return e.plugins.rtm}return null}function getDefaultOptions(e){return{device_id:e.device_id||getDeviceID$1(),user_id:e.user_id||getUserId$1(),error_report_stop:!!e.error_report_stop,project_key:e.project_key||"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:{}},rtcstatechange:{event_key:"rtcstatechange"}}}function getCommonLog(e){var t,r=e.player,n=r.config.mediaType;return _objectSpread2({project_key:e.project_key,live_sdk_version:getPlayerCore(r)||r.hlsOps?"2":"-1",player_sdk_version:r.version,logger_version:"1.1.0-alpha.10",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:+(!!n&&"video"!==n),review_is_live:r.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(r.config.width),height:Math.floor(r.config.height),browser:sniffer.browser,ua:navigator.userAgent,href:window.location.href,timestamp:0,fps:-1,logger_init_time:Date.now(),play_current_time:0,cdn_play_url:r.config.url&&_startsWithInstanceProperty(t=r.config.url).call(t,"//")?window.location.protocol+r.config.url:r.config.url,play_format:getPlayFormat(r.config.url),codec_support:-1},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,r=_filterInstanceProperty(t=performance.getEntriesByType("resource")).call(t,(function(t){return t.name===e}));if(r.length){var n=r[0],i=r[r.length-1];return{dns_parse_time:_Number$parseInt(n.domainLookupEnd-n.domainLookupStart),redirect:_Number$parseInt(n.redirectEnd-n.redirectStart),ttfb:_Number$parseInt(i.responseStart-i.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"},Manage=function(){function e(e){var t=e.Tea;if(!t)throw new Error("lack Tea option");t.event?this.Tea=t.event.bind(t):this.Tea=t,this.logOptions=e,this._player=e.player}_createClass(e,[{key:"videoSize",get:function(){return this._player&&this._player.video?{width:this._player.video.videoWidth,height:this._player.video.videoHeight}:{width:0,height:0}}}]);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),this.core&&this.core.loader&&this.core.loader.finnalUrl?e.cdn_play_url=this.core.loader.finnalUrl:e.cdn_play_url=t&&_startsWithInstanceProperty(t).call(t,"//")?window.location.protocol+t:t,e.live_stream_session_id=getUrlQuery(e.cdn_play_url,"_session_id","session_id"),e.play_format=getPlayFormat(e.cdn_play_url),e.timestamp=getCurrentTime();var r=getDeviceInfo(),n=r.cpu_core_number,i=r.memory_usage,o=r.network_downlink;e.cpu_core_number=n,e.memory_usage=i,e.network_downlink=o,_Object$assign(e,_objectSpread2({},this.videoSize)),this.send(e)},t.send=function(e){e.event_key&&(this.logOptions.onReport&&this.logOptions.onReport(e.event_key,e),this.Tea(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"],LoggerControl=function(){function e(e){var t;this.options=e,this.logger=new XgLiveLogger(e),this.restart=this.restart.bind(this),this.bindUrlChange(),_includesInstanceProperty(t=sniffer.browser).call(t,"Chrome")}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||"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._logmanager=new Manage(this.options),this.init(),this.started=!1,this.destroyed=!1,this.completed=!1,this.firstFrameViewed=!1,this.cacheRtcStats={}}_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}}]);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?_sliceInstanceProperty(e).call(e,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.core=getPlayerCore(this.player),this.core&&(this.commonParams.live_sdk_version="2",this.logmanager.core=this.core),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,c=e.state;switch(t){case"core.ttfb":this.handleTTFB(e);break;case"core.loadresponseheaders":var u=r.get("X-Server-Ip");void 0!==this.player.hlsOps&&(this.log.play_stop.review_ts_count+=1),u&&(this.commonParams.cdn_ip=u);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(e),this.reportStartPlay();break;case"core.loadcomplete":this.handlePlayerLoadedStream(e);break;case"core.streamexception":this.handleStreamException(e);break;case"core.rtcstatechange":this.logmanager.push(_Object$assign({url:l,state:c},this.log.rtcstatechange))}},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,_sliceInstanceProperty(Array.prototype).call(e,0))}catch(e){}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),this.stallEnd()},t.handlePlayerError=function(e){this.errorNumber=1;var t=e.errorType,r=e.errorCode;_Object$assign(this.log.play_error,_objectSpread2({timestamp:getCurrentTime(),code:e.httpCode||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.log.play_result.code=this.log.play_error.code,this.logmanager.push(this.log.play_result,!0))),this.options.error_report_stop?this.handleUserLeave():this.updatePlayStopParams())},t.handlePlayerLoadStream=function(e){var t=e.url,r=e.offersdp,n=e.sessionId;if("string"==typeof t){var i=this.log.play_loadstream;i.timestamp=getCurrentTime(),i.loadstream_url=t,i.offersdp=r,i.sessionId=n,this.logmanager.push(i)}},t.handlePlayerLoadedStream=function(e){var t=this.log.play_stream_loaded;t.timestamp=getCurrentTime(),_Object$assign(t,e),this.logmanager.push(t)},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=_sliceInstanceProperty(i).call(i,_indexOfInstanceProperty(i).call(i,"{"),_lastIndexOfInstanceProperty(i).call(i,"}")+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(e){}}},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,"video"===e&&(this.commonParams.codec_type=t.codec,this.commonParams.codec_support=isCodecSupport(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.logmanager.core=this.core),(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(e){return 0}}},t.getPlayerDownloadSpeed=function(){if(this.core&&this.core.core&&"function"==typeof this.core.core.speedInfo)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.getRtcStats=function(e,t){try{var r=this,n=r.player.plugins.rts||r.player.plugins.rtm,i=n&&n.pc,o={};return i?_Promise.resolve(i.getStats()).then((function(t){return t.forEach((function(t){var n=t.type,i=t.mediaType,a=t.bytesReceived,s=t.packetsReceived,l=t.audioLevel,c=t.concealmentEvents,u=t.remoteTimestamp,p=t.timestamp,f=t.framesDropped,d=t.keyFramesDecoded,h=t.totalDecodeTime,y=t.framesDecoded,g=t.frameHeight,_=t.frameWidth,v=t.framesReceived,m=t.jitterBufferDelay,$=t.jitterBufferEmittedCount,b=t.jitter,S=t.nackCount,E=t.packetsLost,P=t.pliCount,T=t.totalSamplesReceived,I=t.concealedSamples,O=t.currentRoundTripTime,C=t.decoderImplementation,w=t.mimeType,A=t.freezeCount,R=t.totalFreezesDuration,k=t.totalPausesDuration;switch(n){case"inbound-rtp":"audio"===i?(o.audio_bytes_received=a-(r.cacheRtcStats.audioBytesReceived||0),r.cacheRtcStats.audioBytesReceived=a,o.audio_packets_lost=E-(r.cacheRtcStats.audioPacketsLost||0),o.audio_packets_received=s-(r.cacheRtcStats.audioPacketsReceived||0),r.cacheRtcStats.audioPacketsLost=E,r.cacheRtcStats.audioPacketsReceived=s,o.audio_level=l,o.concealment_event=c,o.audio_fraction_lost=o.audio_packets_lost/o.audio_packets_received,void 0!==r.cacheRtcStats.totalSamplesReceived&&(o.audio_rec_sample_rate=(T-r.cacheRtcStats.totalSamplesReceived)/e),r.cacheRtcStats.totalSamplesReceived=T,o.concealed_samples=I,o.total_samples_received=T):(o.frames_dropped=f,o.iframes_decoded=d,o.video_bytes_received=a-(r.cacheRtcStats.videoBytesReceived||0),r.cacheRtcStats.videoBytesReceived=a,o.video_dec_time=h,o.video_decoded_delay_ms=o.video_dec_elapse/y,o.video_frame_height=g,o.video_frame_width=_,void 0!==r.cacheRtcStats.framesDecoded&&(o.video_decode_framerate=(y-r.cacheRtcStats.framesDecoded)/e),r.cacheRtcStats.framesDecoded=y,void 0!==r.cacheRtcStats.framesReceived&&(o.video_recv_framerate=(v-r.cacheRtcStats.framesReceived)/e),void 0!==r.cacheRtcStats.freezeCount&&(o.freeze_count=A-r.cacheRtcStats.freezeCount,o.freeze_duration=R-r.cacheRtcStats.totalFreezesDuration),r.cacheRtcStats.freezeCount=A,r.cacheRtcStats.totalFreezesDuration=R,r.cacheRtcStats.framesReceived=v,o.total_pauses_duration=k,o.video_jb_delay=m/$*1e3,o.video_jitter=1e3*b,o.video_nack_count=S,o.video_packets_lost=E-(r.cacheRtcStats.videoPacketsLost||0),o.video_packets_received=s-(r.cacheRtcStats.videoPacketsReceived||0),o.video_fraction_lost=o.video_packets_lost/o.video_packets_received,r.cacheRtcStats.videoPacketsLost=E,r.cacheRtcStats.videoPacketsReceived=s,o.video_pli_count=P,o.decoder_name=C);break;case"remote-outbound-rtp":o.e2e_delay_ms=p-u;break;case"track":void 0!==_&&(o.video_frame_width=_,o.video_frame_height=g);break;case"candidate-pair":o.rtt=1e3*O;break;case"codec":_includesInstanceProperty(w).call(w,"video")?o.video_codec=w:o.audio_codec=i}o.total_delay=o.e2e_delay_ms+(o.video_decoded_delay_ms||0)+(o.video_jb_delay||0)})),_Object$assign(r.log.playing,{video_download_size:o.video_bytes_received,decode_fps:o.video_decode_framerate,sei_delay:o.total_delay,sei_network_delay:o.e2e_delay_ms,width:o.video_frame_width,height:o.video_frame_height,current_speed:(o.audio_bytes_received+o.video_bytes_received)/e}),o})):_Promise.resolve(o)}catch(e){return _Promise.reject(e)}},t.reportPlaying=function(e){try{var t=this;t.commonParams.is_wasm&&(t.commonParams.fps=t.player.video.fps,t.log.playing.render_fps=t.player.video.fps,t.log.playing.decode_fps=t.player.video.decodeFps),t.log.playing.index++;var r,n=t.log.playing.timestamp;t.inWaitingStart&&t.inWaitingStart<getCurrentTime()&&(r=Math.min(t.options.playingInterval||t.log.playing.play_time,getCurrentTime()-Math.max(t.inWaitingStart,n))),t.getPlayerQuality(),t.getPlayerBuffer(),t.options.downloadSpeedInterval||(t.log.playing.current_speed=t.getPlayerDownloadSpeed());var i=getCurrentTime(),o=i-n,a=(r>200?r:0)+t.log.playing.stall_time,s=(r>200?1:0)+t.log.playing.stall_count;return t.options.aggregationDowngradeStallTime&&(t.log.playing.aggregation_downgrade_stall=(r>t.options.aggregationDowngradeStallTime?r:0)+(t.log.playing.aggregation_downgrade_stall||0)),_Object$assign(t.log.playing,_objectSpread2({timestamp:i,stop_time:i,duration:e?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:t.player.currentTime},t.videoSize)),_Promise.resolve(t.getRtcStats(o,e)).then((function(r){var n={};if(t.core){if(t.core.getStats){var i=t.core.getStats()||{},a=i.bitrate,s=i.avgSpeed;_Object$assign(n,{bitrate:a,avg_speed:s,rate:s/a})}if(t.core.getNetWorkInfo){var l,c=(t.core.getNetWorkInfo()||{}).lostRate,u=((null===(l=t.core.core)||void 0===l?void 0:l._opts)||{}).networkEvaluateInterval;_Object$assign(n,{lostRate:c,networkEvaluateInterval:u})}}t.logmanager.push(_Object$assign({},t.log.playing,_objectSpread2(_objectSpread2({play_time:e?0:o},r),n)),!0),t.log.playing.download_speed_array=[],t.log.playing.stall_time=0,t.log.playing.stall_count=0,t.options.aggregationDowngradeStallTime&&(t.log.playing.aggregation_downgrade_stall=0)}))}catch(e){return _Promise.reject(e)}},t.handlePlayerPlaying=function(){try{var e=this;if(e.player&&e.player.video.readyState<3)return _Promise.resolve();if(e.player.off("playing",e.handlePlayerPlaying),e.player.off("timeupdate",e.handlePlayerPlaying),e.core){var t=(e.core.getStats()||{}).fps;e.commonParams.fps=t}return _Promise.resolve(e.reportPlaying(!0)).then((function(){e.clearPlayingInterval();var t=e.options.playingInterval||e.log.playing.play_time;e.intervalId=setInterval((function(){try{var r=function(){if(Math.abs(Date.now()-e.log.playing.timestamp-t)<100||Date.now()-e.log.playing.timestamp>=t){var r=function(){if(e.player&&e.player.video){var t=function(){if(!e.player.paused)return _Promise.resolve(e.reportPlaying()).then((function(){}));e.handleVideopause()}();if(t&&t.then)return t.then((function(){}))}else e.destroyFunc()}();if(r&&r.then)return r.then((function(){}))}}();return _Promise.resolve(r&&r.then?r.then((function(){})):void 0)}catch(e){return _Promise.reject(e)}}),1e3),e.clearStallTimer(),e.handleVideoplaying(),e.started||e.reportStartPlay(),e.saveBuffered()}))}catch(e){return _Promise.reject(e)}},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.log.play_result.start=getCurrentTime(),this.playResultTimer=setTimeout((function(){e.log.play_result.timestamp>=e.log.play_result.start||(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.log.play_result.code=t.code,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._player=null),this.clearPlayingInterval(),this.clearStallTimer(),this.clearPlayResultTimer(),clearTimeout(this.collectDownloadSpeedTimer))},t.handleUserLeave=function(){try{var e=this;return e.destroyed||!e.started?_Promise.resolve():(e.destroyed=!0,_Promise.resolve(e.updatePlayStopParams()).then((function(){e.reportPlayStop(),e.clearPlayingInterval(),e.clearStallTimer(),clearTimeout(e.collectDownloadSpeedTimer),e.removeWindowListener()})))}catch(e){return _Promise.reject(e)}},t.saveBuffered=function(){try{var e=this.getBuffered();e&&e.length&&(this.log.play_stop.buffered=e)}catch(e){}},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(e){}},t.reportPlayStop=function(){this.player&&(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){if(this.core){var e=(this.core.getStats()||{}).fps;this.commonParams.fps=e}this.firstFrameViewed=!0;var t=getCurrentTime();_Object$assign(this.log.first_frame,_objectSpread2({first_frame_view:t-this.log.start_play.start_play_time||t,timestamp:t},this.videoSize)),this.log.first_frame.ttfb_end&&(this.log.first_frame.ttdb=t-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(){try{var e,t=function(){_Object$assign(o,_objectSpread2({timestamp:i,stop_time:i,duration:r.playedTime/1e3,play_time:r.playedTime/1e3},r.videoSize)),0===r.errorNumber&&(o.play_time_on_no_frame=o.stop_time-r.log.start_play.start_play_time)},r=this,n=getResourceTiming(r._url),i=getCurrentTime();r.playedTime=i-r.log.start_play.start_play_time;var o=r.log.play_stop;if(_Object$assign(o,_objectSpread2({},0===o.stall_count&&{stall_time:0})),r.inWaitingStart&&i-r.inWaitingStart>200&&(o.stall_time+=i-r.inWaitingStart),r.inWaitingStart=0,_Object$assign(o,_objectSpread2({stall_time_per_100sec:o.stall_time/r.playedTime*100,stall_count_per_100sec:1e3*o.stall_count/r.playedTime*100},n)),0===r.log.play_stop.stall_count_per_100sec&&(r.log.play_stop.stall_time_per_100sec=0),r.log.play_stop.stall_time_per_100sec>100||r.log.play_stop.stall_time_per_100sec<0)return _Promise.resolve();if(r.log.playing.index?(_Object$assign(r.log.playing,_objectSpread2({timestamp:getCurrentTime(),is_last:1},r.videoSize)),r.logmanager.push(r.log.playing,!0)):(r.log.play_stop.error_code=r.log.play_error.code,r.log.play_stop.error_info=r.log.play_error.info),i=getCurrentTime(),null===(e=r.core)||void 0===e?void 0:e.getStats){var a=r.core.getStats()||{},s=a.totalReceivedByte,l=a.totalReceivedCost;_Object$assign(r.log.play_stop,{totalReceivedByte:s,totalReceivedCost:l,totalAverageSpeed:8*s/(l/1e3)})}var c=function(){var e;if(null===(e=r.core)||void 0===e?void 0:e.getStatsSnapshoot)return _Promise.resolve(r.core.getStatsSnapshoot()).then((function(e){var t=e.video||{},r=t.packetsLost,n=t.packetsReceived;_Object$assign(o,{packetsLost:r,packetsReceived:n,totalLostRate:r/(r+n)})}))}();return _Promise.resolve(c&&c.then?c.then(t):t())}catch(e){return _Promise.reject(e)}},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)},e}(),$$3=_export,global$1=global$p;$$3({global:!0,forced:global$1.globalThis!==global$1},{globalThis:global$1});var globalThis$6=global$p,parent$b=globalThis$6,globalThis$5=parent$b,parent$a=globalThis$5,globalThis$4=parent$a,parent$9=globalThis$4,globalThis$3=parent$9,globalThis$2=globalThis$3,globalThis$1=globalThis$2,_globalThis=getDefaultExportFromCjs(globalThis$1),$$2=_export,FREEZING=freezing,fails=fails$B,isObject$1=isObject$o,onFreeze=internalMetadataExports.onFreeze,$freeze=Object.freeze,FAILS_ON_PRIMITIVES=fails((function(){$freeze(1)}));$$2({target:"Object",stat:!0,forced:FAILS_ON_PRIMITIVES,sham:!FREEZING},{freeze:function(e){return $freeze&&isObject$1(e)?$freeze(onFreeze(e)):e}});var path$1=path$x,freeze$5=path$1.Object.freeze,parent$8=freeze$5,freeze$4=parent$8,parent$7=freeze$4,freeze$3=parent$7,parent$6=freeze$3,freeze$2=parent$6,freeze$1=freeze$2,freeze2=freeze$1,_Object$freeze=getDefaultExportFromCjs(freeze2),reverse2=reverse$1,_reverseInstanceProperty=getDefaultExportFromCjs(reverse2),$$1=_export,codeAt=stringMultibyte.codeAt;$$1({target:"String",proto:!0},{codePointAt:function(e){return codeAt(this,e)}});var entryVirtual=entryVirtual$p,codePointAt$6=entryVirtual("String").codePointAt,isPrototypeOf=objectIsPrototypeOf,method=codePointAt$6,StringPrototype=String.prototype,codePointAt$5=function(e){var t=e.codePointAt;return"string"==typeof e||e===StringPrototype||isPrototypeOf(StringPrototype,e)&&t===StringPrototype.codePointAt?method:t},parent$5=codePointAt$5,codePointAt$4=parent$5,parent$4=codePointAt$4,codePointAt$3=parent$4,parent$3=codePointAt$3,codePointAt$2=parent$3,codePointAt$1=codePointAt$2,codePointAt2=codePointAt$1,_codePointAtInstanceProperty=getDefaultExportFromCjs(codePointAt2),$=_export,uncurryThis=functionUncurryThis,toAbsoluteIndex=toAbsoluteIndex$6,$RangeError=RangeError,fromCharCode=String.fromCharCode,$fromCodePoint=String.fromCodePoint,join=uncurryThis([].join),INCORRECT_LENGTH=!!$fromCodePoint&&1!=$fromCodePoint.length;$({target:"String",stat:!0,arity:1,forced:INCORRECT_LENGTH},{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,i=0;n>i;){if(t=+arguments[i++],toAbsoluteIndex(t,1114111)!==t)throw $RangeError(t+" is not a valid code point");r[i]=t<65536?fromCharCode(t):fromCharCode(55296+((t-=65536)>>10),t%1024+56320)}return join(r,"")}});var path=path$x,fromCodePoint$5=path.String.fromCodePoint,parent$2=fromCodePoint$5,fromCodePoint$4=parent$2,parent$1=fromCodePoint$4,fromCodePoint$3=parent$1,parent=fromCodePoint$3,fromCodePoint$2=parent,fromCodePoint$1=fromCodePoint$2,fromCodePoint2=fromCodePoint$1,_String$fromCodePoint=getDefaultExportFromCjs(fromCodePoint2),_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},_assign.apply(this,arguments)};function __rest(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&_indexOfInstanceProperty(t).call(t,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++)_indexOfInstanceProperty(t).call(t,n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function __read(e,t){var r="function"==typeof _Symbol&&_getIteratorMethod(e);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(e){i={error:e}}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=_concatInstanceProperty(e).call(e,__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;if(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,n,i=_indexOfInstanceProperty(r=this._hooks[e]).call(r,t);if(-1!==i)_spliceInstanceProperty(n=this._hooks[e]).call(n,i,1)}else this._hooks[e]=[]},e.prototype.emit=function(e,t,r){if(r){var n;if(!e)return;-1!==_indexOfInstanceProperty(n=this._cache).call(n,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(e){}}))},e.prototype.set=function(e){var t;e&&-1===_indexOfInstanceProperty(t=this._cache).call(t,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},isArray2=function(e){return Array.isArray(e)},getIndex=function(e){var t=+Date.now()+Number(_sliceInstanceProperty(e=""+Math.random()).call(e,2,8));return function(){return t+=1}}(),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$7(n[a],r);s=1*s^t;var l=String.fromCharCode(s);i.push(l)}return i.join("")}},encodeBase64=function(e){return window.btoa?window.btoa(encodeURIComponent(e)):encodeURIComponent(e)},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)},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=_sliceInstanceProperty(r).call(r,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(e){t[r]=n}}))}catch(e){}return t},hashCode$1=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 leftPad$2(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e}var hexToArray$3=function(e){var t=[],r=e.length;r%2!=0&&(e=leftPad$2(e,r+1)),r=e.length;for(var n=0;n<r;n+=2)t.push(_parseInt$7(e.substr(n,2),16));return t},commonjsGlobal=void 0!==_globalThis?_globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var js_cookie=createCommonjsModule((function(e,t){e.exports=function(){function e(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}function t(r,n){function i(t,i,o){if("undefined"!=typeof document){"number"==typeof(o=e({},n,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var s in o)o[s]&&(a+="; "+s,!0!==o[s]&&(a+="="+o[s].split(";")[0]));return document.cookie=t+"="+r.write(i,t)+a}}function o(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],n={},i=0;i<t.length;i++){var o=t[i].split("="),a=_sliceInstanceProperty(o).call(o,1).join("=");try{var s=decodeURIComponent(o[0]);if(n[s]=r.read(a,s),e===s)break}catch(e){}}return e?n[e]:n}}return Object.create({set:i,get:o,remove:function(t,r){i(t,"",e({},r,{expires:-1}))},withAttributes:function(r){return t(this.converter,e({},this.attributes,r))},withConverter:function(r){return t(e({},this.converter,r),this.attributes)}},{attributes:{value:_Object$freeze(n)},converter:{value:_Object$freeze(r)}})}return t({read:function(e){return'"'===e[0]&&(e=_sliceInstanceProperty(e).call(e,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)}},{path:"/"})}()})),jsCookie=js_cookie,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){this.getItem(e)},e.prototype.setCookie=function(e,t){this.setItem(e,t)},e}();function isSupportLS(){try{return localStorage.setItem("_ranger-test-key","hi"),localStorage.getItem("_ranger-test-key"),localStorage.removeItem("_ranger-test-key"),!0}catch(e){return!1}}function isSupportSession(){try{return sessionStorage.setItem("_ranger-test-key","hi"),sessionStorage.getItem("_ranger-test-key"),sessionStorage.removeItem("_ranger-test-key"),!0}catch(e){return!1}}var LOG,Types,DebuggerMesssge,local={getItem:function(e){try{var t=localStorage.getItem(e),r=t;try{t&&"string"==typeof t&&(r=JSON.parse(t))}catch(e){}return r||{}}catch(e){}return{}},setItem:function(e,t){try{var r="string"==typeof t?t:_JSON$stringify(t);localStorage.setItem(e,r)}catch(e){}},removeItem:function(e){try{localStorage.removeItem(e)}catch(e){}},getCookie:function(e,t){try{return jsCookie.get(e,{domain:t||document.domain})}catch(e){return""}},setCookie:function(e,t,r,n){try{var i=n||document.domain,o=+new Date+r;jsCookie.set(e,t,{expires:new Date(o),path:"/",domain:i})}catch(e){}},isSupportLS:isSupportLS()},session={getItem:function(e){try{var t=sessionStorage.getItem(e),r=t;try{t&&"string"==typeof t&&(r=JSON.parse(t))}catch(e){}return r||{}}catch(e){}return{}},setItem:function(e,t){try{var r="string"==typeof t?t:_JSON$stringify(t);sessionStorage.setItem(e,r)}catch(e){}},removeItem:function(e){try{sessionStorage.removeItem(e)}catch(e){}},getCookie:function(e){this.getItem(e)},setCookie:function(e,t){this.setItem(e,t)},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 p=!1;for(var f in u)u[f]&&(-1!==_indexOfInstanceProperty(c).call(c,f)?(l.hasOwnProperty("tracer_data")||(l.tracer_data={}),l.tracer_data[f]=u[f]):l[f]=u[f],p=!0);if(p)o.setItem(s,"1"),i.setCookie(a,_JSON$stringify(l),n,r);else{var d=i.getCookie(a,r);d&&(l=JSON.parse(d))}o.getItem(s)&&(l.hasOwnProperty("tracer_data")||(l.tracer_data={}),l.tracer_data.$utm_from_url=1)}catch(e){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$7(this.appVersion),i=this.userAgent;return-1!==_indexOfInstanceProperty(i).call(i,"Edge")||-1!==_indexOfInstanceProperty(i).call(i,"Edg")?(r="Microsoft Edge",-1!==_indexOfInstanceProperty(i).call(i,"Edge")?(e=_indexOfInstanceProperty(i).call(i,"Edge"),n=i.substring(e+5)):(e=_indexOfInstanceProperty(i).call(i,"Edg"),n=i.substring(e+4))):-1!==(e=_indexOfInstanceProperty(i).call(i,"MSIE"))?(r="Microsoft Internet Explorer",n=i.substring(e+5)):-1!==(e=_indexOfInstanceProperty(i).call(i,"Lark"))?(r="Lark",n=i.substring(e+5,e+11)):-1!==(e=_indexOfInstanceProperty(i).call(i,"MetaSr"))?(r="sougoubrowser",n=i.substring(e+7,e+10)):-1!==_indexOfInstanceProperty(i).call(i,"MQQBrowser")||-1!==_indexOfInstanceProperty(i).call(i,"QQBrowser")?(r="qqbrowser",-1!==_indexOfInstanceProperty(i).call(i,"MQQBrowser")?(e=_indexOfInstanceProperty(i).call(i,"MQQBrowser"),n=i.substring(e+11,e+15)):-1!==_indexOfInstanceProperty(i).call(i,"QQBrowser")&&(e=_indexOfInstanceProperty(i).call(i,"QQBrowser"),n=i.substring(e+10,e+17))):-1!==_indexOfInstanceProperty(i).call(i,"Chrome")?-1!==(e=_indexOfInstanceProperty(i).call(i,"MicroMessenger"))?(r="weixin",n=i.substring(e+15,e+20)):-1!==(e=_indexOfInstanceProperty(i).call(i,"360"))?(r="360browser",n=i.substring(_indexOfInstanceProperty(i).call(i,"Chrome")+7)):-1!==_indexOfInstanceProperty(i).call(i,"baidubrowser")||-1!==_indexOfInstanceProperty(i).call(i,"BIDUBrowser")?(-1!==_indexOfInstanceProperty(i).call(i,"baidubrowser")?(e=_indexOfInstanceProperty(i).call(i,"baidubrowser"),n=i.substring(e+13,e+16)):-1!==_indexOfInstanceProperty(i).call(i,"BIDUBrowser")&&(e=_indexOfInstanceProperty(i).call(i,"BIDUBrowser"),n=i.substring(e+12,e+15)),r="baidubrowser"):-1!==(e=_indexOfInstanceProperty(i).call(i,"xiaomi"))?-1!==_indexOfInstanceProperty(i).call(i,"openlanguagexiaomi")?(r="openlanguage xiaomi",n=i.substring(e+7,e+13)):(r="xiaomi",n=i.substring(e-7,e-1)):-1!==(e=_indexOfInstanceProperty(i).call(i,"TTWebView"))?(r="TTWebView",n=i.substring(e+10,e+23)):(-1!==(e=_indexOfInstanceProperty(i).call(i,"Chrome"))||-1!==(e=_indexOfInstanceProperty(i).call(i,"Chrome")))&&(r="Chrome",n=i.substring(e+7)):-1!==_indexOfInstanceProperty(i).call(i,"Safari")?-1!==(e=_indexOfInstanceProperty(i).call(i,"QQ"))?(r="qqbrowser",n=i.substring(e+10,e+16)):-1!==(e=_indexOfInstanceProperty(i).call(i,"Safari"))&&(r="Safari",n=i.substring(e+7),-1!==(e=_indexOfInstanceProperty(i).call(i,"Version"))&&(n=i.substring(e+8))):-1!==(e=_indexOfInstanceProperty(i).call(i,"Firefox"))?(r="Firefox",n=i.substring(e+8)):-1!==(e=_indexOfInstanceProperty(i).call(i,"MicroMessenger"))?(r="weixin",n=i.substring(e+15,e+20)):-1!==(e=_indexOfInstanceProperty(i).call(i,"QQ"))?(r="qqbrowser",n=i.substring(e+3,e+8)):-1!==(e=_indexOfInstanceProperty(i).call(i,"Opera"))&&(r="Opera",n=i.substring(e+6),-1!==(e=_indexOfInstanceProperty(i).call(i,"Version"))&&(n=i.substring(e+8))),-1!==(t=_indexOfInstanceProperty(n).call(n,";"))&&(n=n.substring(0,t)),-1!==(t=_indexOfInstanceProperty(n).call(n," "))&&(n=n.substring(0,t)),-1!==(t=_indexOfInstanceProperty(n).call(n,")"))&&(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=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-)(?:"+e+")","i").exec(t);return r?_sliceInstanceProperty(r).call(r,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))?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){_indexOfInstanceProperty(e).call(e,"Build/")>-1&&(t=_sliceInstanceProperty(e).call(e,0,_indexOfInstanceProperty(e).call(e,"Build/")))}));else if("ios"===e||"mac"===e||"windows"===e)if(this.isNewIpad())t="iPad";else{var r=navigator.userAgent.replace("Mozilla/5.0 (",""),n=_indexOfInstanceProperty(r).call(r,";");t=_sliceInstanceProperty(r).call(r,0,n)}}catch(e){return _trimInstanceProperty(t).call(t)}return _trimInstanceProperty(t).call(t)},e.prototype.isNewIpad=function(){return void 0!==this.userAgent&&"MacIntel"===navigator.platform&&"number"==typeof navigator.maxTouchPoints&&navigator.maxTouchPoints>1},e}(),LOG_URL=LOG={cn:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z4az24z1mz1jz1az1cz18z1nz1nz1jz1mz1ez4az1az1mz1k",va:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z4az1gz22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k",sg:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z4az22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k"},SDK_VERSION="0.1.0",SDK_USE_TYPE="npm",SDK_TYPE=SDK_USE_TYPE,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","_be_active","$bav2b_slide"],this.paramsNameWhiteList=["$inactive","$inline","$target_uuid_list","$source_uuid","$is_spider","$source_id","$is_first_time","$user_unique_id_type","_staging_flag","$exposure_type","$direction","$offsetY","$offsetX"],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){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;"string"==typeof e&&(t=JSON.parse(t));var r=!0;if(!_Object$keys(t).length)return r;for(var n in t){if(!this.calculate(n,"params")){r=!1;break}if("string"==typeof t[n]&&t[n].length>1024){console.warn("params: "+n+" can not over 1024 byte, please check;"),r=!1;break}}return r},e.prototype.calculate=function(e,t){var r="event"===t?this.eventNameWhiteList:"params"===t?this.paramsNameWhiteList:[];return-1!==_indexOfInstanceProperty(r).call(r,e)||(!new RegExp("^\\$").test(e)&&!new RegExp("^__").test(e)||(console.warn(t+" name: "+e+" can not start with $ or __, pleace check;"),!1))},e}();!function(e){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.AnonymousId="anonymous-id",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.SubmitVerifyH="submit-verify-h5",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.TrackDuration="track-duration",e.TrackDurationStart="track-duration-start",e.TrackDurationEnd="track-duration-end",e.TrackDurationPause="track-duration-pause",e.TrackDurationResume="tracl-duration-resume",e.Autotrack="autotrack",e.AutotrackReady="autotrack-ready",e.CepReady="cep-ready",e.TracerReady="tracer-ready"}(Types||(Types={})),function(e){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"}(DebuggerMesssge||(DebuggerMesssge={}));var Types$1=Types,undef=void 0,date=new Date,timeZoneMin=date.getTimezoneOffset(),timezone=_parseInt$7(""+-timeZoneMin/60,10),tz_offset=60*timeZoneMin,WEBID_URL="/webid",TOB_URL="/tobid",REPORT_URL="/list",PROFILE_URL="/profile/list",EXPIRE_TIME=7776e6,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||EXPIRE_TIME).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"),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,anonymous_id: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(){var e=this.initConfig.channel_domain;if(e)this.domain=e;else{var t=this.initConfig.channel;this.domain=decodeUrl(LOG_URL[t])}},e.prototype.setDomain=function(e){this.domain=e},e.prototype.getDomain=function(){return 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.clearAbCache=function(){this.ab_cache={},this.ab_version=""},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=REPORT_URL;break;case"webid":t=WEBID_URL;break;case"tobid":t=TOB_URL;break;case"profile":t=PROFILE_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.initConfig.enable_encryption&&"event"===e&&"sm"!==this.initConfig.encryption_type&&(r=this.initConfig.caller?r+"&encryption=1":r+"?encryption=1"),this.initConfig.report_url?""+this.initConfig.report_url+r:""+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(e){}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(_indexOfInstanceProperty(r).call(r,".")>-1){var o=r.split(".");n=o[0],i=o[1]}if(n)"user"===n||"header"===n?t.envInfo[n][i]=e[r]:t.envInfo.header.custom[i]=e[r];else if(Object.hasOwnProperty.call(t.envInfo.user,r)){var a,s,l;_indexOfInstanceProperty(a=["user_type","ip_addr_id"]).call(a,r)>-1?t.envInfo.user[r]=e[r]?Number(e[r]):e[r]:_indexOfInstanceProperty(s=["user_id","web_id","user_unique_id","user_unique_id_type","anonymous_id"]).call(s,r)>-1?t.envInfo.user[r]=e[r]?String(e[r]):e[r]:_indexOfInstanceProperty(l=["user_is_auth","user_is_login"]).call(l,r)>-1?t.envInfo.user[r]=Boolean(e[r]):"device_id"===r&&(t.envInfo.user[r]=e[r])}else 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(e){console.log("get config stringify error "),this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.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(e){console.log("setStore error"),this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.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(e){return this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.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(e){this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.message}),console.log("delete error")}},e}(),Logger$1=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("%c %s","color: yellow; background-color: black;","[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){var r;this.native=e.enable_native||e[_reverseInstanceProperty(r="evitaN".split("")).call(r).join("")],this.os=t.get("os_name")}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(e){console.log("AppLogBridge, error:"+_JSON$stringify(e.stack)),r(!1)}}))},t.setNativeAppId=function(e){try{AppLogBridge.setNativeAppId(_JSON$stringify(e)),console.log("change bridge appid, event report with appid: "+e)}catch(e){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(e){console.error("setConfig error")}},t.setUserUniqueId=function(e){try{AppLogBridge.setUserUniqueId(e)}catch(e){console.error("setUserUniqueId error")}},t.addHeaderInfo=function(e,t){try{AppLogBridge.addHeaderInfo(e,t)}catch(e){console.error("addHeaderInfo error")}},t.setHeaderInfo=function(e){try{AppLogBridge.setHeaderInfo(_JSON$stringify(e))}catch(e){console.error("setHeaderInfo error")}},t.removeHeaderInfo=function(e){try{AppLogBridge.removeHeaderInfo(e)}catch(e){console.error("removeHeaderInfo error")}},t.reportPv=function(e){this.onEventV3("predefine_pageview",e)},t.onEventV3=function(e,t){try{AppLogBridge.onEventV3(e,t)}catch(e){console.error("onEventV3 error")}},t.profileSet=function(e){try{AppLogBridge.profileSet(e)}catch(e){console.error("profileSet error")}},t.profileSetOnce=function(e){try{AppLogBridge.profileSetOnce(e)}catch(e){console.error("profileSetOnce error")}},t.profileIncrement=function(e){try{AppLogBridge.profileIncrement(e)}catch(e){console.error("profileIncrement error")}},t.profileUnset=function(e){try{AppLogBridge.profileUnset(e)}catch(e){console.error("profileUnset error")}},t.profileAppend=function(e){try{AppLogBridge.profileAppend(e)}catch(e){console.error("profileAppend error")}},t.setExternalAbVersion=function(e){try{AppLogBridge.setExternalAbVersion(e)}catch(e){console.error("setExternalAbVersion error")}},t.getVar=function(e,t,r){try{"android"===this.os?r(AppLogBridge.getABTestConfigValueForKey(e,t)):AppLogBridge.getABTestConfigValueForKey(e,t,(function(e){r(e)}))}catch(e){console.error("getVar error"),r(t)}},t.getAllVars=function(e){try{"android"===this.os?e(AppLogBridge.getAllAbTestConfigs()):AppLogBridge.getAllAbTestConfigs((function(t){e(t)}))}catch(t){console.error("getAllVars error"),e(null)}},t.getAbSdkVersion=function(e){try{"android"===this.os?e(AppLogBridge.getAbSdkVersion()):AppLogBridge.getAbSdkVersion((function(t){e(t)}))}catch(t){console.error("getAbSdkVersion error"),e("")}},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,c){try{var u=new XMLHttpRequest,p=s||"POST";u.open(p,""+e,!0),l&&c?u.setRequestHeader("Content-Type","application/octet-stream;tt-data="+c):u.setRequestHeader("Content-Type","application/json; charset=utf-8"),a&&u.setRequestHeader("X-MCS-AppKey",""+a),n&&(u.withCredentials=!0),r&&(u.timeout=r,u.ontimeout=function(){o&&o(t,ERROR$1.TIMEOUT)}),u.onload=function(){if(i){var e=null;if(u.responseText){try{e=JSON.parse(u.responseText)}catch(t){e={}}i(e,t)}}},u.onerror=function(){u.abort(),o&&o(t,ERROR$1.XHR_ON)},l?u.send(t):u.send(_JSON$stringify(t))}catch(e){}}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+="&"+r+"="+encodeURIComponent(_JSON$stringify(e[r])));return t="&"===t[0]?_sliceInstanceProperty(t).call(t,1):t},sendByImg=function(e,t,r,n){try{var i=e.match(/\/v\d\//),o="";o=i?i[0]:-1!==_indexOfInstanceProperty(e).call(e,"/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=""+a+GIF_URL+"?"+o}))}catch(r){n&&n(e,t,ERROR.IMG_CATCH,r.message)}},request=function(e,t,r,n,i,o,a,s,l){var c=window.navigator.userAgent,u=window.navigator.appName;if(-1===_indexOfInstanceProperty(u).call(u,"Microsoft Internet Explorer")||-1===_indexOfInstanceProperty(c).call(c,"MSIE 8.0")&&-1===_indexOfInstanceProperty(c).call(c,"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,l)},Event$1=function(){function e(){this.eventLimit=50,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.cacheStorgae=new Storage(!0),this.localStorage=new Storage(!1),this.eventCheck=new EventCheck(e,t),this.maxReport=t.max_report||20,this.reportTime=t.reportTime||30,this.timeout=t.timeout||1e5,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.refer_key="__tea_cache_refer_"+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(e){this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.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(){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=_sliceInstanceProperty(e).call(e,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.handleRefer=function(){var e="";try{if(this.config.spa||this.config.autotrack){var t=this.localStorage.getItem(this.refer_key)||{};e=t.routeChange?t.refer_key:this.configManager.get("referrer")}else e=this.configManager.get("referrer")}catch(t){e=document.referrer}return e},e.prototype.merge=function(e,t){var r=this,n=this.configManager.get(),i=n.header,o=n.user;i.referrer=this.handleRefer(),i.custom=_JSON$stringify(i.custom);var a=this.configManager.get("evtParams"),s=this.configManager.get("user_unique_id_type"),l=_mapInstanceProperty(e).call(e,(function(e){try{if(_Object$keys(a).length&&!t&&(e.params=_assign({},e.params,a)),r.collect.dynamicParamsFilter){var n=r.collect.dynamicParamsFilter();_Object$keys(n).length&&(e.params=_assign({},e.params,n))}s&&(e.params.$user_unique_id_type=s);var i=r.configManager.getAbCache(),l=r.configManager.getAbVersion();return l&&i&&(r.config.disable_ab_reset||i.uuid===o.user_unique_id)&&(e.ab_sdk_version=l),e.session_id=r.collect.sessionManager.getSessionId(),e.params=_JSON$stringify(e.params),e}catch(t){return r.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:t.message}),e}})),c=[];if(!_Object$keys(o).length)return console.warn("user info error,cant report"),c;this.config.enable_anonymousid&&delete o.web_id;var u=JSON.parse(_JSON$stringify({events:l,user:o,header:i}));return u.local_time=Math.floor(Date.now()/1e3),u.verbose=1,u.user_unique_type=this.config.enable_ttwebid?this.config.user_unique_type:void 0,c.push(u),c},e.prototype.split=function(e){return e=_mapInstanceProperty(e).call(e,(function(e){var t=[];return t.push(e),t}))},e.prototype.send=function(e,t){var r=this;e.length&&e.forEach((function(e){try{var n,i=JSON.parse(_JSON$stringify(e));if(_filterInstanceProperty(r.config))(i=_filterInstanceProperty(n=r.config).call(n,i))||console.warn("filter must return data !!");r.collect.eventFilter&&i&&((i=r.collect.eventFilter(i))||console.warn("filterEvent api must return data !!"));var o=i||e,a=JSON.parse(_JSON$stringify(o));if(r.eventCheck.checkVerify(a),!o.length)return;r.collect.emit(Types$1.SubmitBefore,o);var s=r.collect.cryptoData(o);request(r.reportUrl,s,r.timeout,!1,(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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_EVENT,info:"埋点上报失败",time:Date.now(),data:a,code:e.e,failType:"数据异常",status:"fail"})):(r.collect.emit(Types$1.SubmitScuess,{eventData:t,res:e}),r.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_EVENT,info:"埋点上报成功",time:Date.now(),data:a,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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_EVENT,info:"埋点上报网络异常",time:Date.now(),data:a,code:t,failType:"网络异常",status:"fail"})}),t,r.config.enable_encryption,r.config.encryption_header),r.eventCheck.checkVerify(o),r.collect.emit(Types$1.SubmitVerifyH,o),r.collect.emit(Types$1.SubmitAfter,o)}catch(e){console.warn("something error, "+_JSON$stringify(e.stack)),r.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.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(){var e;return _sliceInstanceProperty(e=b().replace(/-/g,"")).call(e,0,19)},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}(),Token=function(){function e(){this.cacheToken={},this.enableCookie=!1,this.enableTTwebid=!1,this.enableCustomWebid=!1,this.enableAnonymousid=!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.enableAnonymousid=t.enable_anonymousid,this.enableTTwebid=t.enable_ttwebid,this.enableCustomWebid=t.enable_custom_webid,this.collect.on(Types$1.AnonymousId,(function(e){r.setAnonymousId(e)})),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.enableAnonymousid?this.enableAnonymousid?this.completeAnonymous(this.cacheToken):this.enableCustomWebid?this.collect.on(Types$1.CustomWebId,(function(){e.tokenReady=!0,e.collect.emit(Types$1.TokenComplete)})):this.checkEnv()||(this.enableTTwebid?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!==_indexOfInstanceProperty(e).call(e,"miniProgram")||-1!==_indexOfInstanceProperty(e).call(e,"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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"SDK 发起WEBID请求",logType:"fetch",level:"info",time:Date.now(),data:r});var n=localWebId();fetch$1(t,this.collect.cryptoData(r),3e5,!1,(function(t){var r;t&&0===t.e?(r=t.web_id,e.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"WEBID请求成功",logType:"fetch",level:"info",time:Date.now(),data:t})):(r=n,e.collect.configManager.set({localWebId:n}),e.collect.emit(Types$1.TokenError),e.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"WEBID请求返回值异常",logType:"fetch",level:"warn",time:Date.now(),data:t}),e.collect.logger.warn("appid: "+e.config.app_id+" get webid error, use local webid~")),e.complete({web_id:e.configManager.get("web_id")||r,user_unique_id:e.configManager.get("user_unique_id")||r})}),(function(){e.complete({web_id:e.configManager.get("web_id")||n,user_unique_id:e.configManager.get("user_unique_id")||n}),e.collect.configManager.set({localWebId:n}),e.collect.emit(Types$1.TokenError),e.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"WEBID请求网络异常",logType:"fetch",level:"error",time:Date.now(),data:null}),e.collect.logger.warn("appid: "+e.config.app_id+", get webid error, use local webid~")}),"","",this.config.enable_encryption,this.config.encryption_header)},e.prototype.complete=function(e){var t=e.web_id,r=e.user_unique_id;if(!t&&!r)return this.collect.emit(Types$1.TokenError),void console.warn("token error");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.completeAnonymous=function(e){var t=e.anonymous_id||sessionId(),r=e.user_unique_id||this.configManager.get("user_unique_id");this.collect.configManager.set({anonymous_id:t,user_unique_id:r||t}),e.anonymous_id=t,e.user_unique_id=r||t,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");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){var t;if(e&&-1===_indexOfInstanceProperty(t=["null","undefined","Null","None"]).call(t,e)){var r=String(e),n=this.configManager.get("user_unique_id"),i=this.cacheToken&&this.cacheToken.user_unique_id;if(r===n&&r===i)return;this.configManager.set({user_unique_id:r}),this.cacheToken||(this.cacheToken={}),this.cacheToken.user_unique_id=r,this.cacheToken.timestamp=Date.now(),this.setStorage(this.cacheToken),this.collect.emit(Types$1.TokenChange,{type:"uuid",id:e}),this.collect.emit(Types$1.SessionReset)}else this.clearUuid()},e.prototype.clearUuid=function(){if(!this.config.enable_ttwebid){var e=this.enableAnonymousid?this.configManager.get("anonymous_id"):this.configManager.get("web_id");this.configManager.get("user_unique_id")!==e&&(this.configManager.set({user_unique_id:e}),this.cacheToken.user_unique_id=e,this.cacheToken.timestamp=Date.now(),this.setStorage(this.cacheToken),this.collect.emit(Types$1.TokenReset))}},e.prototype.setAnonymousId=function(e){if(e&&this.enableAnonymousid){var t=this.configManager.get("anonymous_id"),r=this.configManager.get("user_unique_id");t!==e&&(t!==r&&r||(this.configManager.set({user_unique_id:e}),this.cacheToken.user_unique_id=e,this.collect.emit(Types$1.TokenChange,{type:"uuid",id:e})),this.configManager.set({anonymous_id:e}),this.cacheToken.anonymous_id=e,this.collect.emit(Types$1.TokenChange,{type:"anonymous_id",id:e}),this.setStorage(this.cacheToken))}},e.prototype.setWebId=function(e){if(e&&!this.config.enable_ttwebid&&!this.enableAnonymousid){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.cacheToken.user_unique_id=e,this.collect.emit(Types$1.TokenChange,{type:"uuid",id:e})),t!==e&&(this.configManager.set({web_id:e}),this.cacheToken.web_id=e,this.collect.emit(Types$1.TokenChange,{type:"webid",id:e})),this.cacheToken.timestamp=Date.now(),this.setStorage(this.cacheToken)}},e.prototype.setStorage=function(e){var t;e._type_=this.enableCustomWebid?"custom":"default",delete e[_reverseInstanceProperty(t="diss".split("")).call(t).join("")],this.enableCookie||this.enableTTwebid?this.storage.setCookie(this.tokenKey,e,this.expiresTime,this.cookieDomain):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"),r={app_id:this.config.app_id,user_unique_id:this.configManager.get("user_unique_id"),user_unique_id_type:this.configManager.get("user_unique_id_type")};this.enableAnonymousid?r.anonymous_id=this.configManager.get("anonymous_id"):r.web_id=this.configManager.get("web_id");var n=this.collect.cryptoData(r);return new _Promise((function(r){fetch$1(t,n,3e4,e.enableTTwebid,(function(e){e&&0===e.e?r(e.tobid):r("")}),(function(){r("")}),"","",e.config.enable_encryption,e.config.encryption_header)}))},e}(),jsbn=createCommonjsModule((function(e,t){(function(){var t;function r(e,t,r){null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function n(){return new r(null)}var i="undefined"!=typeof navigator;i&&"Microsoft Internet Explorer"==navigator.appName?(r.prototype.am=function(e,t,r,n,i,o){for(var a=32767&t,s=t>>15;--o>=0;){var l=32767&this[e],c=this[e++]>>15,u=s*l+c*a;i=((l=a*l+((32767&u)<<15)+r[n]+(1073741823&i))>>>30)+(u>>>15)+s*c+(i>>>30),r[n++]=1073741823&l}return i},t=30):i&&"Netscape"!=navigator.appName?(r.prototype.am=function(e,t,r,n,i,o){for(;--o>=0;){var a=t*this[e++]+r[n]+i;i=Math.floor(a/67108864),r[n++]=67108863&a}return i},t=26):(r.prototype.am=function(e,t,r,n,i,o){for(var a=16383&t,s=t>>14;--o>=0;){var l=16383&this[e],c=this[e++]>>14,u=s*l+c*a;i=((l=a*l+((16383&u)<<14)+r[n]+i)>>28)+(u>>14)+s*c,r[n++]=268435455&l}return i},t=28),r.prototype.DB=t,r.prototype.DM=(1<<t)-1,r.prototype.DV=1<<t;r.prototype.FV=Math.pow(2,52),r.prototype.F1=52-t,r.prototype.F2=2*t-52;var o,a,s="0123456789abcdefghijklmnopqrstuvwxyz",l=new Array;for(o="0".charCodeAt(0),a=0;a<=9;++a)l[o++]=a;for(o="a".charCodeAt(0),a=10;a<36;++a)l[o++]=a;for(o="A".charCodeAt(0),a=10;a<36;++a)l[o++]=a;function c(e){return s.charAt(e)}function u(e,t){var r=l[e.charCodeAt(t)];return null==r?-1:r}function p(e){var t=n();return t.fromInt(e),t}function f(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function d(e){this.m=e}function h(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function y(e,t){return e&t}function g(e,t){return e|t}function _(e,t){return e^t}function v(e,t){return e&~t}function m(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function $(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function b(){}function S(e){return e}function E(e){this.r2=n(),this.q3=n(),r.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}d.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},d.prototype.revert=function(e){return e},d.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},d.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),_reduceInstanceProperty(this).call(this,r)},d.prototype.sqrTo=function(e,t){e.squareTo(t),_reduceInstanceProperty(this).call(this,t)},h.prototype.convert=function(e){var t=n();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(r.ZERO)>0&&this.m.subTo(t,t),t},h.prototype.revert=function(e){var t=n();return e.copyTo(t),_reduceInstanceProperty(this).call(this,t),t},h.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e[t],n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[r=t+this.m.t]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},h.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),_reduceInstanceProperty(this).call(this,r)},h.prototype.sqrTo=function(e,t){e.squareTo(t),_reduceInstanceProperty(this).call(this,t)},r.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},r.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},r.prototype.fromString=function(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var i=e.length,o=!1,a=0;--i>=0;){var s=8==n?255&e[i]:u(e,i);s<0?"-"==e.charAt(i)&&(o=!0):(o=!1,0==a?this[this.t++]=s:a+n>this.DB?(this[this.t-1]|=(s&(1<<this.DB-a)-1)<<a,this[this.t++]=s>>this.DB-a):this[this.t-1]|=s<<a,(a+=n)>=this.DB&&(a-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),o&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},r.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s},r.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s},r.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,o=(1<<i)-1,a=Math.floor(e/this.DB),s=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t[r+a+1]=this[r]>>i|s,s=(this[r]&o)<<n;for(r=a-1;r>=0;--r)t[r]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()},r.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<<n)-1;t[0]=this[r]>>n;for(var a=r+1;a<this.t;++a)t[a-r-1]|=(this[a]&o)<<i,t[a-r]=this[a]>>n;n>0&&(t[this.t-r-1]|=(this.s&o)<<i),t.t=this.t-r,t.clamp()}},r.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()},r.prototype.multiplyTo=function(e,t){var n=this.abs(),i=e.abs(),o=n.t;for(t.t=o+i.t;--o>=0;)t[o]=0;for(o=0;o<i.t;++o)t[o+n.t]=n.am(0,i[o],t,o,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&r.ZERO.subTo(t,t)},r.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()},r.prototype.divRemTo=function(e,t,i){var o=e.abs();if(!(o.t<=0)){var a=this.abs();if(a.t<o.t)return null!=t&&t.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=n());var s=n(),l=this.s,c=e.s,u=this.DB-f(o[o.t-1]);u>0?(o.lShiftTo(u,s),a.lShiftTo(u,i)):(o.copyTo(s),a.copyTo(i));var p=s.t,d=s[p-1];if(0!=d){var h=d*(1<<this.F1)+(p>1?s[p-2]>>this.F2:0),y=this.FV/h,g=(1<<this.F1)/h,_=1<<this.F2,v=i.t,m=v-p,$=null==t?n():t;for(s.dlShiftTo(m,$),i.compareTo($)>=0&&(i[i.t++]=1,i.subTo($,i)),r.ONE.dlShiftTo(p,$),$.subTo(s,s);s.t<p;)s[s.t++]=0;for(;--m>=0;){var b=i[--v]==d?this.DM:Math.floor(i[v]*y+(i[v-1]+_)*g);if((i[v]+=s.am(0,b,i,m,0,p))<b)for(s.dlShiftTo(m,$),i.subTo($,i);i[v]<--b;)i.subTo($,i)}null!=t&&(i.drShiftTo(p,t),l!=c&&r.ZERO.subTo(t,t)),i.t=p,i.clamp(),u>0&&i.rShiftTo(u,i),l<0&&r.ZERO.subTo(i,i)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},r.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},r.prototype.exp=function(e,t){if(e>4294967295||e<1)return r.ONE;var i=n(),o=n(),a=t.convert(this),s=f(e)-1;for(a.copyTo(i);--s>=0;)if(t.sqrTo(i,o),(e&1<<s)>0)t.mulTo(o,a,i);else{var l=i;i=o,o=l}return t.revert(i)},r.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,i=!1,o="",a=this.t,s=this.DB-a*this.DB%t;if(a-- >0)for(s<this.DB&&(r=this[a]>>s)>0&&(i=!0,o=c(r));a>=0;)s<t?(r=(this[a]&(1<<s)-1)<<t-s,r|=this[--a]>>(s+=this.DB-t)):(r=this[a]>>(s-=t)&n,s<=0&&(s+=this.DB,--a)),r>0&&(i=!0),i&&(o+=c(r));return i?o:"0"},r.prototype.negate=function(){var e=n();return r.ZERO.subTo(this,e),e},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+f(this[this.t-1]^this.s&this.DM)},r.prototype.mod=function(e){var t=n();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(r.ZERO)>0&&e.subTo(t,t),t},r.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new d(t):new h(t),this.exp(e,r)},r.ZERO=p(0),r.ONE=p(1),b.prototype.convert=S,b.prototype.revert=S,b.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},b.prototype.sqrTo=function(e,t){e.squareTo(t)},E.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=n();return e.copyTo(t),_reduceInstanceProperty(this).call(this,t),t},E.prototype.revert=function(e){return e},E.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},E.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),_reduceInstanceProperty(this).call(this,r)},E.prototype.sqrTo=function(e,t){e.squareTo(t),_reduceInstanceProperty(this).call(this,t)};var P,T,I,O=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],C=(1<<26)/O[O.length-1];function w(){var e;e=(new Date).getTime(),T[I++]^=255&e,T[I++]^=e>>8&255,T[I++]^=e>>16&255,T[I++]^=e>>24&255,I>=L&&(I-=L)}if(r.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},r.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),i=p(r),o=n(),a=n(),s="";for(this.divRemTo(i,o,a);o.signum()>0;)s=(r+a.intValue()).toString(e).substr(1)+s,o.divRemTo(i,o,a);return a.intValue().toString(e)+s},r.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),i=Math.pow(t,n),o=!1,a=0,s=0,l=0;l<e.length;++l){var c=u(e,l);c<0?"-"==e.charAt(l)&&0==this.signum()&&(o=!0):(s=t*s+c,++a>=n&&(this.dMultiply(i),this.dAddOffset(s,0),a=0,s=0))}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(s,0)),o&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(r.ONE.shiftLeft(e-1),g,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(r.ONE.shiftLeft(e-1),this);else{var i=new Array,o=7&e;i.length=1+(e>>3),t.nextBytes(i),o>0?i[0]&=(1<<o)-1:i[0]=0,this.fromString(i,256)}},r.prototype.bitwiseTo=function(e,t,r){var n,i,o=Math.min(e.t,this.t);for(n=0;n<o;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(i=e.s&this.DM,n=o;n<this.t;++n)r[n]=t(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<e.t;++n)r[n]=t(i,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},r.prototype.changeBit=function(e,t){var n=r.ONE.shiftLeft(e);return this.bitwiseTo(n,t,n),n},r.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()},r.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},r.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i<n;++i)r[i+this.t]=this.am(0,e[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e[i],r,i,0,t-i);r.clamp()},r.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},r.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r},r.prototype.millerRabin=function(e){var t=this.subtract(r.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var o=t.shiftRight(i);(e=e+1>>1)>O.length&&(e=O.length);for(var a=n(),s=0;s<e;++s){a.fromInt(O[Math.floor(Math.random()*O.length)]);var l=a.modPow(o,this);if(0!=l.compareTo(r.ONE)&&0!=l.compareTo(t)){for(var c=1;c++<i&&0!=l.compareTo(t);)if(0==(l=l.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=l.compareTo(t))return!1}}return!0},r.prototype.clone=function(){var e=n();return this.copyTo(e),e},r.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},r.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},r.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},r.prototype.equals=function(e){return 0==this.compareTo(e)},r.prototype.min=function(e){return this.compareTo(e)<0?this:e},r.prototype.max=function(e){return this.compareTo(e)>0?this:e},r.prototype.and=function(e){var t=n();return this.bitwiseTo(e,y,t),t},r.prototype.or=function(e){var t=n();return this.bitwiseTo(e,g,t),t},r.prototype.xor=function(e){var t=n();return this.bitwiseTo(e,_,t),t},r.prototype.andNot=function(e){var t=n();return this.bitwiseTo(e,v,t),t},r.prototype.not=function(){for(var e=n(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},r.prototype.shiftLeft=function(e){var t=n();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},r.prototype.shiftRight=function(e){var t=n();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},r.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+m(this[e]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=$(this[r]^t);return e},r.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)},r.prototype.setBit=function(e){return this.changeBit(e,g)},r.prototype.clearBit=function(e){return this.changeBit(e,v)},r.prototype.flipBit=function(e){return this.changeBit(e,_)},r.prototype.add=function(e){var t=n();return this.addTo(e,t),t},r.prototype.subtract=function(e){var t=n();return this.subTo(e,t),t},r.prototype.multiply=function(e){var t=n();return this.multiplyTo(e,t),t},r.prototype.divide=function(e){var t=n();return this.divRemTo(e,t,null),t},r.prototype.remainder=function(e){var t=n();return this.divRemTo(e,null,t),t},r.prototype.divideAndRemainder=function(e){var t=n(),r=n();return this.divRemTo(e,t,r),new Array(t,r)},r.prototype.modPow=function(e,t){var r,i,o=e.bitLength(),a=p(1);if(o<=0)return a;r=o<18?1:o<48?3:o<144?4:o<768?5:6,i=o<8?new d(t):t.isEven()?new E(t):new h(t);var s=new Array,l=3,c=r-1,u=(1<<r)-1;if(s[1]=i.convert(this),r>1){var y=n();for(i.sqrTo(s[1],y);l<=u;)s[l]=n(),i.mulTo(y,s[l-2],s[l]),l+=2}var g,_,v=e.t-1,m=!0,$=n();for(o=f(e[v])-1;v>=0;){for(o>=c?g=e[v]>>o-c&u:(g=(e[v]&(1<<o+1)-1)<<c-o,v>0&&(g|=e[v-1]>>this.DB+o-c)),l=r;0==(1&g);)g>>=1,--l;if((o-=l)<0&&(o+=this.DB,--v),m)s[g].copyTo(a),m=!1;else{for(;l>1;)i.sqrTo(a,$),i.sqrTo($,a),l-=2;l>0?i.sqrTo(a,$):(_=a,a=$,$=_),i.mulTo($,s[g],a)}for(;v>=0&&0==(e[v]&1<<o);)i.sqrTo(a,$),_=a,a=$,$=_,--o<0&&(o=this.DB-1,--v)}return i.revert(a)},r.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return r.ZERO;for(var n=e.clone(),i=this.clone(),o=p(1),a=p(0),s=p(0),l=p(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(o.isEven()&&a.isEven()||(o.addTo(this,o),a.subTo(e,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);for(;i.isEven();)i.rShiftTo(1,i),t?(s.isEven()&&l.isEven()||(s.addTo(this,s),l.subTo(e,l)),s.rShiftTo(1,s)):l.isEven()||l.subTo(e,l),l.rShiftTo(1,l);n.compareTo(i)>=0?(n.subTo(i,n),t&&o.subTo(s,o),a.subTo(l,a)):(i.subTo(n,i),t&&s.subTo(o,s),l.subTo(a,l))}return 0!=i.compareTo(r.ONE)?r.ZERO:l.compareTo(e)>=0?l.subtract(e):l.signum()<0?(l.addTo(e,l),l.signum()<0?l.add(e):l):l},r.prototype.pow=function(e){return this.exp(e,new b)},r.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},r.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r[0]<=O[O.length-1]){for(t=0;t<O.length;++t)if(r[0]==O[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<O.length;){for(var n=O[t],i=t+1;i<O.length&&n<C;)n*=O[i++];for(n=r.modInt(n);t<i;)if(n%O[t++]==0)return!1}return r.millerRabin(e)},r.prototype.square=function(){var e=n();return this.squareTo(e),e},r.prototype.Barrett=E,null==T){var A;if(T=new Array,I=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var R=new Uint8Array(32);for(window.crypto.getRandomValues(R),A=0;A<32;++A)T[I++]=R[A]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var k=window.crypto.random(32);for(A=0;A<k.length;++A)T[I++]=255&k.charCodeAt(A)}for(;I<L;)A=Math.floor(65536*Math.random()),T[I++]=A>>>8,T[I++]=255&A;I=0,w()}function D(){if(null==P){for(w(),(P=new N).init(T),I=0;I<T.length;++I)T[I]=0;I=0}return P.next()}function x(){}function N(){this.i=0,this.j=0,this.S=new Array}x.prototype.nextBytes=function(e){var t;for(t=0;t<e.length;++t)e[t]=D()},N.prototype.init=function(e){var t,r,n;for(t=0;t<256;++t)this.S[t]=t;for(r=0,t=0;t<256;++t)r=r+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[r],this.S[r]=n;this.i=0,this.j=0},N.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]};var L=256;e.exports={default:r,BigInteger:r,SecureRandom:x}}).call(commonjsGlobal)}));jsbn.BigInteger,jsbn.SecureRandom;var BigInteger$3=jsbn.BigInteger;function bigintToValue(e){var t=e.toString(16);if("-"!==t[0])t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var r=(t=t.substr(1)).length;r%2==1?r+=1:t.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i<r;i++)n+="f";t=(t=(n=new BigInteger$3(n,16)).xor(e).add(BigInteger$3.ONE)).toString(16).replace(/^-/,"")}return t}var ASN1Object=function(){function e(){_classCallCheck$1(this,e),this.tlv=null,this.t="00",this.l="00",this.v=""}return _createClass$2(e,[{key:"getEncodedHex",value:function(){return this.tlv||(this.v=this.getValue(),this.l=this.getLength(),this.tlv=this.t+this.l+this.v),this.tlv}},{key:"getLength",value:function(){var e=this.v.length/2,t=e.toString(16);return t.length%2==1&&(t="0"+t),e<128?t:(128+t.length/2).toString(16)+t}},{key:"getValue",value:function(){return""}}]),e}(),DERInteger=function(e){_inherits(r,ASN1Object);var t=_createSuper(r);function r(e){var n;return _classCallCheck$1(this,r),(n=t.call(this)).t="02",e&&(n.v=bigintToValue(e)),n}return _createClass$2(r,[{key:"getValue",value:function(){return this.v}}]),r}(),DERSequence=function(e){_inherits(r,ASN1Object);var t=_createSuper(r);function r(e){var n;return _classCallCheck$1(this,r),(n=t.call(this)).t="30",n.asn1Array=e,n}return _createClass$2(r,[{key:"getValue",value:function(){var e;return this.v=_mapInstanceProperty(e=this.asn1Array).call(e,(function(e){return e.getEncodedHex()})).join(""),this.v}}]),r}();function getLenOfL(e,t){return+e[t+2]<8?1:128&+e.substr(t+2,2)}function getL(e,t){var r=getLenOfL(e,t),n=e.substr(t+2,2*r);return n?(+n[0]<8?new BigInteger$3(n,16):new BigInteger$3(n.substr(2),16)).intValue():-1}function getStartOfV(e,t){return t+2*(getLenOfL(e,t)+1)}var asn1={encodeDer:function(e,t){var r=new DERInteger(e),n=new DERInteger(t);return new DERSequence([r,n]).getEncodedHex()},decodeDer:function(e){var t=getStartOfV(e,0),r=getStartOfV(e,t),n=getL(e,t),i=e.substr(r,2*n),o=r+i.length,a=getStartOfV(e,o),s=getL(e,o),l=e.substr(a,2*s);return{r:new BigInteger$3(i,16),s:new BigInteger$3(l,16)}}},BigInteger$2=jsbn.BigInteger,TWO=new BigInteger$2("2"),THREE=new BigInteger$2("3"),ECFieldElementFp=function(){function e(t,r){_classCallCheck$1(this,e),this.x=r,this.q=t}return _createClass$2(e,[{key:"equals",value:function(e){return e===this||this.q.equals(e.q)&&this.x.equals(e.x)}},{key:"toBigInteger",value:function(){return this.x}},{key:"negate",value:function(){return new e(this.q,this.x.negate().mod(this.q))}},{key:"add",value:function(t){return new e(this.q,this.x.add(t.toBigInteger()).mod(this.q))}},{key:"subtract",value:function(t){return new e(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))}},{key:"multiply",value:function(t){return new e(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))}},{key:"divide",value:function(t){return new e(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))}},{key:"square",value:function(){return new e(this.q,this.x.square().mod(this.q))}}]),e}(),ECPointFp=function(){function e(t,r,n,i){_classCallCheck$1(this,e),this.curve=t,this.x=r,this.y=n,this.z=null==i?BigInteger$2.ONE:i,this.zinv=null}return _createClass$2(e,[{key:"getX",value:function(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}},{key:"getY",value:function(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}},{key:"equals",value:function(e){return e===this||(this.isInfinity()?e.isInfinity():e.isInfinity()?this.isInfinity():!!e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(BigInteger$2.ZERO)&&e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(BigInteger$2.ZERO))}},{key:"isInfinity",value:function(){return null===this.x&&null===this.y||this.z.equals(BigInteger$2.ZERO)&&!this.y.toBigInteger().equals(BigInteger$2.ZERO)}},{key:"negate",value:function(){return new e(this.curve,this.x,this.y.negate(),this.z)}},{key:"add",value:function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=this.x.toBigInteger(),n=this.y.toBigInteger(),i=this.z,o=t.x.toBigInteger(),a=t.y.toBigInteger(),s=t.z,l=this.curve.q,c=r.multiply(s).mod(l),u=o.multiply(i).mod(l),p=c.subtract(u),f=n.multiply(s).mod(l),d=a.multiply(i).mod(l),h=f.subtract(d);if(BigInteger$2.ZERO.equals(p))return BigInteger$2.ZERO.equals(h)?this.twice():this.curve.infinity;var y=c.add(u),g=i.multiply(s).mod(l),_=p.square().mod(l),v=p.multiply(_).mod(l),m=g.multiply(h.square()).subtract(y.multiply(_)).mod(l),$=p.multiply(m).mod(l),b=h.multiply(_.multiply(c).subtract(m)).subtract(f.multiply(v)).mod(l),S=v.multiply(g).mod(l);return new e(this.curve,this.curve.fromBigInteger($),this.curve.fromBigInteger(b),S)}},{key:"twice",value:function(){if(this.isInfinity())return this;if(!this.y.toBigInteger().signum())return this.curve.infinity;var t=this.x.toBigInteger(),r=this.y.toBigInteger(),n=this.z,i=this.curve.q,o=this.curve.a.toBigInteger(),a=t.square().multiply(THREE).add(o.multiply(n.square())).mod(i),s=r.shiftLeft(1).multiply(n).mod(i),l=r.square().mod(i),c=l.multiply(t).multiply(n).mod(i),u=s.square().mod(i),p=a.square().subtract(c.shiftLeft(3)).mod(i),f=s.multiply(p).mod(i),d=a.multiply(c.shiftLeft(2).subtract(p)).subtract(u.shiftLeft(1).multiply(l)).mod(i),h=s.multiply(u).mod(i);return new e(this.curve,this.curve.fromBigInteger(f),this.curve.fromBigInteger(d),h)}},{key:"multiply",value:function(e){if(this.isInfinity())return this;if(!e.signum())return this.curve.infinity;for(var t=e.multiply(THREE),r=this.negate(),n=this,i=t.bitLength()-2;i>0;i--){n=n.twice();var o=t.testBit(i);o!==e.testBit(i)&&(n=n.add(o?this:r))}return n}}]),e}(),ECCurveFp$1=function(){function e(t,r,n){_classCallCheck$1(this,e),this.q=t,this.a=this.fromBigInteger(r),this.b=this.fromBigInteger(n),this.infinity=new ECPointFp(this,null,null)}return _createClass$2(e,[{key:"equals",value:function(e){return e===this||this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}},{key:"fromBigInteger",value:function(e){return new ECFieldElementFp(this.q,e)}},{key:"decodePointHex",value:function(e){switch(_parseInt$7(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var t=this.fromBigInteger(new BigInteger$2(e.substr(2),16)),r=this.fromBigInteger(t.multiply(t.square()).add(t.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new BigInteger$2("4")).add(BigInteger$2.ONE),this.q));return r.toBigInteger().mod(TWO).equals(new BigInteger$2(e.substr(0,2),16).subtract(TWO))||(r=r.negate()),new ECPointFp(this,t,r);case 4:case 6:case 7:var n=(e.length-2)/2,i=e.substr(2,n),o=e.substr(n+2,n);return new ECPointFp(this,this.fromBigInteger(new BigInteger$2(i,16)),this.fromBigInteger(new BigInteger$2(o,16)));default:return null}}}]),e}(),ec={ECPointFp:ECPointFp,ECCurveFp:ECCurveFp$1},BigInteger$1=jsbn.BigInteger,SecureRandom=jsbn.SecureRandom,ECCurveFp=ec.ECCurveFp,rng$1=new SecureRandom,_generateEcparam=generateEcparam(),curve$1=_generateEcparam.curve,G$1=_generateEcparam.G,n$1=_generateEcparam.n;function getGlobalCurve(){return curve$1}function generateEcparam(){var e=new BigInteger$1("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF",16),t=new BigInteger$1("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC",16),r=new BigInteger$1("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93",16),n=new ECCurveFp(e,t,r),i=n.decodePointHex("0432C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0");return{curve:n,G:i,n:new BigInteger$1("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123",16)}}function generateKeyPairHex(e,t,r){var n=(e?new BigInteger$1(e,t,r):new BigInteger$1(n$1.bitLength(),rng$1)).mod(n$1.subtract(BigInteger$1.ONE)).add(BigInteger$1.ONE),i=leftPad$1(n.toString(16),64),o=G$1.multiply(n);return{privateKey:i,publicKey:"04"+leftPad$1(o.getX().toBigInteger().toString(16),64)+leftPad$1(o.getY().toBigInteger().toString(16),64)}}function compressPublicKeyHex(e){if(130!==e.length)throw new Error("Invalid public key to compress");var t=(e.length-2)/2,r=e.substr(2,t),n="03";return new BigInteger$1(e.substr(t+2,t),16).mod(new BigInteger$1("2")).equals(BigInteger$1.ZERO)&&(n="02"),n+r}function utf8ToHex(e){for(var t=(e=unescape(encodeURIComponent(e))).length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;for(var i=[],o=0;o<t;o++){var a=r[o>>>2]>>>24-o%4*8&255;i.push((a>>>4).toString(16)),i.push((15&a).toString(16))}return i.join("")}function leftPad$1(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e}function arrayToHex(e){return _mapInstanceProperty(e).call(e,(function(e){return 1===(e=e.toString(16)).length?"0"+e:e})).join("")}function arrayToUtf8$1(e){for(var t=[],r=0,n=0;n<2*e.length;n+=2)t[n>>>3]|=_parseInt$7(e[r],10)<<24-n%8*4,r++;try{for(var i=[],o=0;o<e.length;o++){var a=t[o>>>2]>>>24-o%4*8&255;i.push(String.fromCharCode(a))}return decodeURIComponent(escape(i.join("")))}catch(e){throw new Error("Malformed UTF-8 data")}}function hexToArray$2(e){var t=[],r=e.length;r%2!=0&&(e=leftPad$1(e,r+1)),r=e.length;for(var n=0;n<r;n+=2)t.push(_parseInt$7(e.substr(n,2),16));return t}function verifyPublicKey(e){var t=curve$1.decodePointHex(e);if(!t)return!1;var r=t.getX();return t.getY().square().equals(r.multiply(r.square()).add(r.multiply(curve$1.a)).add(curve$1.b))}function comparePublicKeyHex(e,t){var r=curve$1.decodePointHex(e);if(!r)return!1;var n=curve$1.decodePointHex(t);return!!n&&r.equals(n)}var utils={getGlobalCurve:getGlobalCurve,generateEcparam:generateEcparam,generateKeyPairHex:generateKeyPairHex,compressPublicKeyHex:compressPublicKeyHex,utf8ToHex:utf8ToHex,leftPad:leftPad$1,arrayToHex:arrayToHex,arrayToUtf8:arrayToUtf8$1,hexToArray:hexToArray$2,verifyPublicKey:verifyPublicKey,comparePublicKeyHex:comparePublicKeyHex},W=new Uint32Array(68),M=new Uint32Array(64);function rotl$1(e,t){var r=31&t;return e<<r|e>>>32-r}function xor(e,t){for(var r=[],n=e.length-1;n>=0;n--)r[n]=255&(e[n]^t[n]);return r}function P0(e){return e^rotl$1(e,9)^rotl$1(e,17)}function P1(e){return e^rotl$1(e,15)^rotl$1(e,23)}function sm3$2(e){var t,r=8*e.length,n=r%512;n=n>=448?512-n%448-1:448-n-1;for(var i=new Array((n-7)/8),o=new Array(8),a=0,s=i.length;a<s;a++)i[a]=0;for(var l=0,c=o.length;l<c;l++)o[l]=0;r=r.toString(2);for(var u=7;u>=0;u--)if(r.length>8){var p=r.length-8;o[u]=_parseInt$7(r.substr(p),2),r=r.substr(0,p)}else r.length>0&&(o[u]=_parseInt$7(r,2),r="");for(var f=new Uint8Array(_concatInstanceProperty(t=[]).call(t,_toConsumableArray$1(e),[128],i,o)),d=new DataView(f.buffer,0),h=f.length/64,y=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]),g=0;g<h;g++){_fillInstanceProperty(W).call(W,0),_fillInstanceProperty(M).call(M,0);for(var _=16*g,v=0;v<16;v++)W[v]=d.getUint32(4*(_+v),!1);for(var m=16;m<68;m++)W[m]=P1(W[m-16]^W[m-9]^rotl$1(W[m-3],15))^rotl$1(W[m-13],7)^W[m-6];for(var $=0;$<64;$++)M[$]=W[$]^W[$+4];for(var b=y[0],S=y[1],E=y[2],P=y[3],T=y[4],I=y[5],O=y[6],C=y[7],w=void 0,A=void 0,R=void 0,k=void 0,D=0;D<64;D++)k=D>=0&&D<=15?2043430169:2055708042,A=(D>=0&&D<=15?b^S^E:b&S|b&E|S&E)+P+((w=rotl$1(rotl$1(b,12)+T+rotl$1(k,D),7))^rotl$1(b,12))+M[D],R=(D>=0&&D<=15?T^I^O:T&I|~T&O)+C+w+W[D],P=E,E=rotl$1(S,9),S=b,b=A,C=O,O=rotl$1(I,19),I=T,T=P0(R);y[0]^=b,y[1]^=S,y[2]^=E,y[3]^=P,y[4]^=T,y[5]^=I,y[6]^=O,y[7]^=C}for(var x=[],N=0,L=y.length;N<L;N++){var F=y[N];x.push((4278190080&F)>>>24,(16711680&F)>>>16,(65280&F)>>>8,255&F)}return x}for(var blockLen=64,iPad=new Uint8Array(blockLen),oPad=new Uint8Array(blockLen),i$1=0;i$1<blockLen;i$1++)iPad[i$1]=54,oPad[i$1]=92;function hmac$1(e,t){var r,n;for(t.length>blockLen&&(t=sm3$2(t));t.length<blockLen;)t.push(0);var i=xor(t,iPad),o=xor(t,oPad),a=sm3$2(_concatInstanceProperty(r=[]).call(r,_toConsumableArray$1(i),_toConsumableArray$1(e)));return sm3$2(_concatInstanceProperty(n=[]).call(n,_toConsumableArray$1(o),_toConsumableArray$1(a)))}var sm3_1$1={sm3:sm3$2,hmac:hmac$1},BigInteger=jsbn.BigInteger,encodeDer2=asn1.encodeDer,decodeDer2=asn1.decodeDer,sm3$1=sm3_1$1.sm3,_utils$generateEcpara=utils.generateEcparam(),G=_utils$generateEcpara.G,curve=_utils$generateEcpara.curve,n=_utils$generateEcpara.n,C1C2C3=0;function doEncrypt(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e="string"==typeof e?utils.hexToArray(utils.utf8ToHex(e)):_sliceInstanceProperty(Array.prototype).call(e),t=utils.getGlobalCurve().decodePointHex(t);var o=utils.generateKeyPairHex(),a=new BigInteger(o.privateKey,16),s=o.publicKey;s.length>128&&(s=s.substr(s.length-128));var l=t.multiply(a),c=utils.hexToArray(utils.leftPad(l.getX().toBigInteger().toRadix(16),64)),u=utils.hexToArray(utils.leftPad(l.getY().toBigInteger().toRadix(16),64)),p=utils.arrayToHex(sm3$1(_concatInstanceProperty(r=[]).call(r,c,e,u))),f=1,d=0,h=[],y=_concatInstanceProperty(n=[]).call(n,c,u),g=function(){var e;h=sm3$1(_concatInstanceProperty(e=[]).call(e,_toConsumableArray$1(y),[f>>24&255,f>>16&255,f>>8&255,255&f])),f++,d=0};g();for(var _=0,v=e.length;_<v;_++)d===h.length&&g(),e[_]^=255&h[d++];var m=utils.arrayToHex(e);return i===C1C2C3?s+m+p:s+p+m}function doDecrypt(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).output,a=void 0===o?"string":o;t=new BigInteger(t,16);var s=e.substr(128,64),l=e.substr(192);i===C1C2C3&&(s=e.substr(e.length-64),l=e.substr(128,e.length-128-64));var c=utils.hexToArray(l),u=utils.getGlobalCurve().decodePointHex("04"+e.substr(0,128)).multiply(t),p=utils.hexToArray(utils.leftPad(u.getX().toBigInteger().toRadix(16),64)),f=utils.hexToArray(utils.leftPad(u.getY().toBigInteger().toRadix(16),64)),d=1,h=0,y=[],g=_concatInstanceProperty(r=[]).call(r,p,f),_=function(){var e;y=sm3$1(_concatInstanceProperty(e=[]).call(e,_toConsumableArray$1(g),[d>>24&255,d>>16&255,d>>8&255,255&d])),d++,h=0};_();for(var v=0,m=c.length;v<m;v++)h===y.length&&_(),c[v]^=255&y[h++];return utils.arrayToHex(sm3$1(_concatInstanceProperty(n=[]).call(n,p,c,f)))===s.toLowerCase()?"array"===a?c:utils.arrayToUtf8(c):"array"===a?[]:""}function doSignature(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.pointPool,o=r.der,a=r.hash,s=r.publicKey,l=r.userId,c="string"==typeof e?utils.utf8ToHex(e):utils.arrayToHex(e);a&&(c=getHash(c,s=s||getPublicKeyFromPrivateKey(t),l));var u=new BigInteger(t,16),p=new BigInteger(c,16),f=null,d=null,h=null;do{do{var y=void 0;f=(y=i&&i.length?i.pop():getPoint()).k,d=p.add(y.x1).mod(n)}while(d.equals(BigInteger.ZERO)||d.add(f).equals(n));h=u.add(BigInteger.ONE).modInverse(n).multiply(f.subtract(d.multiply(u))).mod(n)}while(h.equals(BigInteger.ZERO));return o?encodeDer2(d,h):utils.leftPad(d.toString(16),64)+utils.leftPad(h.toString(16),64)}function doVerifySignature(e,t,r){var i,o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=a.der,l=a.hash,c=a.userId,u="string"==typeof e?utils.utf8ToHex(e):utils.arrayToHex(e);if(l&&(u=getHash(u,r,c)),s){var p=decodeDer2(t);i=p.r,o=p.s}else i=new BigInteger(t.substring(0,64),16),o=new BigInteger(t.substring(64),16);var f=curve.decodePointHex(r),d=new BigInteger(u,16),h=i.add(o).mod(n);if(h.equals(BigInteger.ZERO))return!1;var y=G.multiply(o).add(f.multiply(h)),g=d.add(y.getX().toBigInteger()).mod(n);return i.equals(g)}function getHash(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"1234567812345678";r=utils.utf8ToHex(r);var n,i,o=utils.leftPad(G.curve.a.toBigInteger().toRadix(16),64),a=utils.leftPad(G.curve.b.toBigInteger().toRadix(16),64),s=utils.leftPad(G.getX().toBigInteger().toRadix(16),64),l=utils.leftPad(G.getY().toBigInteger().toRadix(16),64);if(128===t.length)n=t.substr(0,64),i=t.substr(64,64);else{var c=G.curve.decodePointHex(t);n=utils.leftPad(c.getX().toBigInteger().toRadix(16),64),i=utils.leftPad(c.getY().toBigInteger().toRadix(16),64)}var u=utils.hexToArray(r+o+a+s+l+n+i),p=4*r.length;u.unshift(255&p),u.unshift(p>>8&255);var f=sm3$1(u);return utils.arrayToHex(sm3$1(_concatInstanceProperty(f).call(f,utils.hexToArray(e))))}function getPublicKeyFromPrivateKey(e){var t=G.multiply(new BigInteger(e,16));return"04"+utils.leftPad(t.getX().toBigInteger().toString(16),64)+utils.leftPad(t.getY().toBigInteger().toString(16),64)}function getPoint(){var e=utils.generateKeyPairHex(),t=curve.decodePointHex(e.publicKey);return e.k=new BigInteger(e.privateKey,16),e.x1=t.getX().toBigInteger(),e}var sm2={generateKeyPairHex:utils.generateKeyPairHex,compressPublicKeyHex:utils.compressPublicKeyHex,comparePublicKeyHex:utils.comparePublicKeyHex,doEncrypt:doEncrypt,doDecrypt:doDecrypt,doSignature:doSignature,doVerifySignature:doVerifySignature,getPoint:getPoint,verifyPublicKey:utils.verifyPublicKey},sm3=sm3_1$1.sm3,hmac=sm3_1$1.hmac;function leftPad(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e}function ArrayToHex$1(e){return _mapInstanceProperty(e).call(e,(function(e){return 1===(e=e.toString(16)).length?"0"+e:e})).join("")}function hexToArray$1(e){var t=[],r=e.length;r%2!=0&&(e=leftPad(e,r+1)),r=e.length;for(var n=0;n<r;n+=2)t.push(_parseInt$7(e.substr(n,2),16));return t}function utf8ToArray$1(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=_codePointAtInstanceProperty(e).call(e,r);if(i<=127)t.push(i);else if(i<=2047)t.push(192|i>>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}var sm3_1=function(e,t){if(e="string"==typeof e?utf8ToArray$1(e):_sliceInstanceProperty(Array.prototype).call(e),t){if("hmac"!==(t.mode||"hmac"))throw new Error("invalid mode");var r=t.key;if(!r)throw new Error("invalid key");return r="string"==typeof r?hexToArray$1(r):_sliceInstanceProperty(Array.prototype).call(r),ArrayToHex$1(hmac(e,r))}return ArrayToHex$1(sm3(e))},DECRYPT=0,ROUND=32,BLOCK=16,Sbox=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],CK=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function hexToArray2(e){for(var t=[],r=0,n=e.length;r<n;r+=2)t.push(_parseInt$7(e.substr(r,2),16));return t}function ArrayToHex(e){return _mapInstanceProperty(e).call(e,(function(e){return 1===(e=e.toString(16)).length?"0"+e:e})).join("")}function utf8ToArray(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=_codePointAtInstanceProperty(e).call(e,r);if(i<=127)t.push(i);else if(i<=2047)t.push(192|i>>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function arrayToUtf8(e){for(var t=[],r=0,n=e.length;r<n;r++)e[r]>=240&&e[r]<=247?(t.push(_String$fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(_String$fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(_String$fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(_String$fromCodePoint(e[r]));return t.join("")}function rotl(e,t){return e<<t|e>>>32-t}function byteSub(e){return(255&Sbox[e>>>24&255])<<24|(255&Sbox[e>>>16&255])<<16|(255&Sbox[e>>>8&255])<<8|255&Sbox[255&e]}function l1(e){return e^rotl(e,2)^rotl(e,10)^rotl(e,18)^rotl(e,24)}function l2(e){return e^rotl(e,13)^rotl(e,23)}function sms4Crypt(e,t,r){for(var n=new Array(4),i=new Array(4),o=0;o<4;o++)i[0]=255&e[4*o],i[1]=255&e[4*o+1],i[2]=255&e[4*o+2],i[3]=255&e[4*o+3],n[o]=i[0]<<24|i[1]<<16|i[2]<<8|i[3];for(var a,s=0;s<32;s+=4)a=n[1]^n[2]^n[3]^r[s+0],n[0]^=l1(byteSub(a)),a=n[2]^n[3]^n[0]^r[s+1],n[1]^=l1(byteSub(a)),a=n[3]^n[0]^n[1]^r[s+2],n[2]^=l1(byteSub(a)),a=n[0]^n[1]^n[2]^r[s+3],n[3]^=l1(byteSub(a));for(var l=0;l<16;l+=4)t[l]=n[3-l/4]>>>24&255,t[l+1]=n[3-l/4]>>>16&255,t[l+2]=n[3-l/4]>>>8&255,t[l+3]=255&n[3-l/4]}function sms4KeyExt(e,t,r){for(var n=new Array(4),i=new Array(4),o=0;o<4;o++)i[0]=255&e[0+4*o],i[1]=255&e[1+4*o],i[2]=255&e[2+4*o],i[3]=255&e[3+4*o],n[o]=i[0]<<24|i[1]<<16|i[2]<<8|i[3];n[0]^=2746333894,n[1]^=1453994832,n[2]^=1736282519,n[3]^=2993693404;for(var a,s=0;s<32;s+=4)a=n[1]^n[2]^n[3]^CK[s+0],t[s+0]=n[0]^=l2(byteSub(a)),a=n[2]^n[3]^n[0]^CK[s+1],t[s+1]=n[1]^=l2(byteSub(a)),a=n[3]^n[0]^n[1]^CK[s+2],t[s+2]=n[2]^=l2(byteSub(a)),a=n[0]^n[1]^n[2]^CK[s+3],t[s+3]=n[3]^=l2(byteSub(a));if(r===DECRYPT)for(var l,c=0;c<16;c++)l=t[c],t[c]=t[31-c],t[31-c]=l}function sm4(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=n.padding,o=void 0===i?"pkcs#7":i,a=n.mode,s=n.iv,l=void 0===s?[]:s,c=n.output,u=void 0===c?"string":c;if("cbc"===a&&("string"==typeof l&&(l=hexToArray2(l)),16!==l.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=hexToArray2(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?r!==DECRYPT?utf8ToArray(e):hexToArray2(e):_toConsumableArray$1(e),("pkcs#5"===o||"pkcs#7"===o)&&r!==DECRYPT)for(var p=BLOCK-e.length%BLOCK,f=0;f<p;f++)e.push(p);var d=new Array(ROUND);sms4KeyExt(t,d,r);for(var h=[],y=l,g=e.length,_=0;g>=BLOCK;){var v=_sliceInstanceProperty(e).call(e,_,_+16),m=new Array(16);if("cbc"===a)for(var $=0;$<BLOCK;$++)r!==DECRYPT&&(v[$]^=y[$]);sms4Crypt(v,m,d);for(var b=0;b<BLOCK;b++)"cbc"===a&&r===DECRYPT&&(m[b]^=y[b]),h[_+b]=m[b];"cbc"===a&&(y=r!==DECRYPT?m:v),g-=BLOCK,_+=BLOCK}if(("pkcs#5"===o||"pkcs#7"===o)&&r===DECRYPT){for(var S=h.length,E=h[S-1],P=1;P<=E;P++)if(h[S-P]!==E)throw new Error("padding is invalid");_spliceInstanceProperty(h).call(h,S-E,E)}return"array"!==u?r!==DECRYPT?ArrayToHex(h):arrayToUtf8(h):h}var sm4_1={encrypt:function(e,t,r){return sm4(e,t,1,r)},decrypt:function(e,t,r){return sm4(e,t,0,r)}},src={sm2:sm2,sm3:sm3_1,sm4:sm4_1},src_1=src.sm2;function Encrypt(e,t,r){return void 0===r&&(r=1),"04"+src_1.doEncrypt(e,t,r)}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.adapters={},this.sdkReady=!1,this.name=e,this.hook=new Hook,this.logger=new Logger$1(e),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.init=function(t){var r,n=this;this.inited?console.log("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!==_indexOfInstanceProperty(r=["cn","sg","va"]).call(r,t.channel)||(console.warn("channel must be `cn`, `sg`,`va` !!!"),t.channel="cn"),this.logger=new Logger$1(this.name,t.log),this.configManager=new ConfigManager(this,t),this.appBridge=new AppBridge(t,this.configManager),this.bridgeReport=this.appBridge.bridgeInject(),this.initConfig=t,this.env=t.channel_domain?"self":"public",this.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"SDK 执行INIT",data:t,level:"info",time:Date.now()}),t.disable_auto_pv&&(this.disableAutoPageView=!0),this.bridgeReport?(this.inited=!0,this.emit(Types$1.Init)):(t.enable_encryption&&"sm"===t.encryption_type&&this.initCrypto(),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){n.once(Types$1.TokenComplete,(function(){e(!0)}))})),new _Promise((function(e){n.once(Types$1.Start,(function(){e(!0)}))}))]).then((function(){try{var r;_reduceInstanceProperty(r=e.plugins).call(r,(function(e,t){var r=t.plugin,i=t.options,o=_Object$assign(n.initConfig,i),a=new r;return a.apply(n,o),e.push(a),e}),n.pluginInstances)}catch(e){console.log("load plugin error, "+e.message),n.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.message})}n.sdkReady=!0,n.emit(Types$1.Ready),n.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"SDK 初始化完成",time:Date.now(),level:"info",data:n.configManager.get("user")}),n.logger.info("appid: "+t.app_id+", userInfo:"+_JSON$stringify(n.configManager.get("user"))),n.logger.info("appid: "+t.app_id+", sdk is ready, version is "+SDK_VERSION+", you can report now !!!");try{(window.opener||window.parent).postMessage("[tea-sdk]ready","*")}catch(e){n.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.message})}n.pageView(),n.on(Types$1.TokenChange,(function(e){"webid"!==e.type&&"anonymous_id"!==e.type||n.pageView(),n.logger.info("appid: "+t.app_id+" token change, new userInfo:"+_JSON$stringify(n.configManager.get("user"))),n.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"SDK 设置了用户信息",time:Date.now(),secType:"USER",level:"info",data:n.configManager.get("user")})})),n.on(Types$1.TokenReset,(function(){n.logger.info("appid: "+t.app_id+" token reset, new userInfo:"+_JSON$stringify(n.configManager.get("user"))),n.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"SDK 重置了用户信息",time:Date.now(),secType:"USER",level:"info",data:n.configManager.get("user")})})),n.on(Types$1.RouteChange,(function(e){e.init||t.disable_route_report||n.pageView()}))})),this.tokenManager.apply(this,t),this.eventManager.apply(this,t),this.sessionManager.apply(this,t),this.inited=!0,this.emit(Types$1.Init))):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")},e.prototype.config=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=_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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"SDK 执行CONFIG",level:"info",time:Date.now(),data:t})}else this.logger.warn("config params is error, please check");else this.logger.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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.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{if(this.initConfig&&this.initConfig.disable_track_event)return;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(e){this.logger.warn("something error, please check"),this.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.message})}},e.prototype.beconEvent=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=[],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=_sliceInstanceProperty(e).call(e,6));var n=t;"object"!==_typeof$1(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(r){return this.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:r.message}),{event:e,params:t}}},e.prototype.dynamicParams=function(e){this.dynamicParamsFilter=e},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){if(void 0===e&&(e={}),this.inited){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&&this.configManager.is_first_time||!1)},r=_assign({},t,e);this.event("predefine_pageview",r)}else console.warn("predefinePageView should call after init")},e.prototype.clearEventCache=function(){this.emit(Types$1.CleanEvents)},e.prototype.setWebIDviaUnionID=function(e){if(e){var t=hashCode$1(e);this.config({web_id:""+t,wechat_unionid:e}),this.emit(Types$1.CustomWebId)}},e.prototype.setWebIDviaOpenID=function(e){if(e){var t=hashCode$1(e);this.config({web_id:""+t,wechat_openid:e}),this.emit(Types$1.CustomWebId)}},e.prototype.setAnonymousId=function(e){this.emit(Types$1.AnonymousId,e)},e.prototype.setNativeAppId=function(e){this.bridgeReport&&this.appBridge.setNativeAppId(e)},e.prototype.resetStayDuration=function(e,t,r){void 0===e&&(e=""),void 0===t&&(t=""),void 0===r&&(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;if(this.inited){var n=!1,i=function(t){if(!n){n=!0;var i,o=r.configManager.get().user;if(t)o.tobid=t,o[_reverseInstanceProperty(i="diss".split("")).call(i).join("")]=t;return e(_assign({},o))}},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()})))}else this.logger.warn("getToken must be use after function init")},e.prototype.startTrackEvent=function(e){e&&this.emit(Types$1.TrackDurationStart,e,Types$1.TrackDuration)},e.prototype.endTrackEvent=function(e,t){void 0===t&&(t={}),e&&this.emit(Types$1.TrackDurationEnd,{eventName:e,params:t},Types$1.TrackDuration)},e.prototype.pauseTrackEvent=function(e){e&&this.emit(Types$1.TrackDurationPause,e,Types$1.TrackDuration)},e.prototype.resumeTrackEvent=function(e){e&&this.emit(Types$1.TrackDurationResume,e,Types$1.TrackDuration)},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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"SDK 执行profileAppend",level:"info",time:Date.now(),data:e})},e.prototype.setExternalAbVersion=function(e){var t;this.bridgeReport?this.appBridge.setExternalAbVersion(e):this.emit(Types$1.AbExternalVersion,"string"==typeof e&&e?_trimInstanceProperty(t=""+e).call(t):null,Types$1.Ab)},e.prototype.getVar=function(e,t,r){this.bridgeReport?this.appBridge.getVar(e,t,r):this.emit(Types$1.AbVar,{name:e,defaultValue:t,callback:r},Types$1.Ab)},e.prototype.getAllVars=function(e){this.bridgeReport?this.appBridge.getAllVars(e):this.emit(Types$1.AbAllVars,e,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(e){if(!this.bridgeReport||!e)return this.configManager.getAbVersion()||"";this.appBridge.getAbSdkVersion(e)},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.initCrypto=function(){this.publicKey=this.initConfig.crypto_publicKey||"04BA9E229380DC0E41E10839B0C52A4763D3EDFE8903F3B8E81395523381E03AA995D295BD4A4088792E4785B224F7837EB4D2C7C05973C7AE8687A35ACAE470A0"},e.prototype.cryptoData=function(e){try{if(!this.initConfig.enable_encryption)return e;var t=void 0;if("sm"===this.initConfig.encryption_type){var r=Encrypt(_JSON$stringify(e),this.publicKey,1),n=hexToArray$3(r);t=new Uint8Array(n)}else t="data="+encodeBase64(_JSON$stringify(e));return t}catch(t){return e}},e.prototype.destoryInstace=function(){this.destroyInstance||(this.destroyInstance=!0,this.off(Types$1.TokenComplete))},e.plugins=[],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,!0),i=this.collect.cryptoData(n),o=this.collect.configManager.getUrl("profile");this.fetch(o,i,1e5,!1,(function(){}),(function(){}),"","POST",this.config.enable_encryption,this.config.encryption_header),this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_EVENT,info:"埋点上报成功",time:Date.now(),data:n,code:200,status:"success"})}catch(e){this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.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){var n;"string"==typeof e[r]||"Array"===_sliceInstanceProperty(n=Object.prototype.toString.call(e[r])).call(n,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{var n;if(!e||"[object Object]"!==Object.prototype.toString.call(e))return void console.warn("please check the params type, must be object !!!");var i={};for(var o in e){var a;"string"==typeof e[o]||"number"==typeof e[o]||"Array"===_sliceInstanceProperty(a=Object.prototype.toString.call(e[o])).call(a,8,-1)?i[o]=e[o]:console.warn("please check the value of params:"+o+", must be string,number,Array !!!")}var s=_Object$keys(i);if(!s.length)return;var l=Date.now();return _reduceInstanceProperty(n=_filterInstanceProperty(s).call(s,(function(n){var i=r.cache[n];return t?!i:!(i&&r.compare(i.val,e[n])&&l-i.timestamp<r.duration)}))).call(n,(function(e,t){return e[t]=i[t],e}),{})}catch(e){this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.message}),console.log("error")}},e.prototype.compare=function(e,t){try{return _JSON$stringify(e)===_JSON$stringify(t)}catch(e){return this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.message}),!1}},e.prototype.clone=function(e){try{return JSON.parse(_JSON$stringify(e))}catch(t){return this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.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&&!this.config.disable_track_event&&!this.config.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:"TOB"}),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(e){}},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:_mapInstanceProperty(a).call(a,(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(e){}},e}(),VerifyH=function(){function e(){this.verifyReady=!1,this.cleanStatus=!1}return e.prototype.apply=function(e,t){var r=this;this.collector=e,this.config=t,this.eventStorage=[],this.collector.on("submit-verify-h5",(function(e){e&&e.length&&r.eventStore(e[0])})),this.checkUrl(),this.heartbeat()},e.prototype.checkUrl=function(){var e=window.location.href,t=parseUrlQuery(e);t._r_d_&&t._r_c_k_?(this.verifyReady=!0,this.domain=t._r_d_,this.key=t._r_c_k_,this.checkCache()):this.collector.off("submit-verify-h5")},e.prototype.checkCache=function(){this.eventStorage.length&&this.postVerify(this.eventStorage)},e.prototype.heartbeat=function(){var e=this;this.heart=setInterval((function(){var t={event:"simulator_test__",local_time_ms:Date.now()},r=e.collector.configManager.get(),n=r.header,i={events:[t],user:r.user,header:n};e.eventStore(i)}),6e4)},e.prototype.eventStore=function(e){this.cleanStatus||(this.verifyReady?this.postVerify(e):this.eventStorage.push(e))},e.prototype.cleanVerify=function(){this.cleanStatus=!0,this.eventStorage=[],clearInterval(this.heart)},e.prototype.postVerify=function(e){var t=this;try{var r=JSON.parse(_JSON$stringify(e));isArray2(e)?r.forEach((function(e){t.fetchLog(e)})):this.fetchLog(r)}catch(e){console.log("web verify post error ~")}},e.prototype.fetchLog=function(e){fetch$1(this.domain+"/simulator/h5/log?connection_key="+this.key,e,2e4,!1)},e.prototype.leave=function(){var e=this;document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e.cleanVerify()})),beforePageUnload((function(){e.cleanVerify()}))},e}();Collector$1.usePlugin(VerifyH,"verifyH"),Collector$1.usePlugin(Profile,"profile"),Collector$1.usePlugin(HeartBeat,"heartbeat"),Collector$1.usePlugin(Monitor,"monitor");var getRandomValues,SDK=new Collector$1("default"),rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&!(getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}for(var byteToHex=[],i=0;i<256;++i){var _context$1;byteToHex.push(_sliceInstanceProperty(_context$1=(i+256).toString(16)).call(_context$1,1))}function unsafeStringify(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return byteToHex[e[t+0]]+byteToHex[e[t+1]]+byteToHex[e[t+2]]+byteToHex[e[t+3]]+"-"+byteToHex[e[t+4]]+byteToHex[e[t+5]]+"-"+byteToHex[e[t+6]]+byteToHex[e[t+7]]+"-"+byteToHex[e[t+8]]+byteToHex[e[t+9]]+"-"+byteToHex[e[t+10]]+byteToHex[e[t+11]]+byteToHex[e[t+12]]+byteToHex[e[t+13]]+byteToHex[e[t+14]]+byteToHex[e[t+15]]}var randomUUID="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),native={randomUUID:randomUUID};function v4(e,t,r){if(native.randomUUID&&!t&&!e)return native.randomUUID();var n=(e=e||{}).random||(e.rng||rng)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return unsafeStringify(n)}var DEVICE_ID_KEY="veplayer_live_device_id",USER_ID_Key="veplayer_live_user_id",genRandomID2=function(e){return Math.floor((9*Math.random()+1)*Math.pow(10,e-1)).toString()},getDeviceID2=function(){var e=localStorage.getItem(DEVICE_ID_KEY);return e||(e=genRandomID2(11),localStorage.setItem(DEVICE_ID_KEY,e),e)},getUserId2=function(){var e=localStorage.getItem(USER_ID_Key);return e||(e=genRandomID2(12),localStorage.setItem(USER_ID_Key,e),e)},generateUrlWithSessionId=function(e){var t=util.getUrlObject(e);return t?null!=t&&t.searchParams.get("_session_id")?e:util.appendSearchParams(e,{_session_id:generateSessionId()}):null!=e?e:""},hashCode2=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},generateSessionId=function(){return v4().replace(/-/g,"")+"."+Date.now()+"."+hashCode2(v4().replace(/-/g,""))},Logger=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(){var e,n;_classCallCheck$1(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$2(_assertThisInitialized(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,o))),"_userId",void 0),_defineProperty$2(_assertThisInitialized(n),"_deviceId",void 0),_defineProperty$2(_assertThisInitialized(n),"_liveLogger",void 0),n}return _createClass$2(r,[{key:"afterCreate",value:function(){var e,t;this.config.enable&&(this.config.appId?(this._userId=(null===(e=this.config)||void 0===e?void 0:e.userId)||getUserId2(),this._deviceId=(null===(t=this.config)||void 0===t?void 0:t.deviceId)||getDeviceID2(),this.open()):console.info("not found appId, please generate an appId"))}},{key:"destroy",value:function(){this.close()}},{key:"close",value:function(){var e;null===(e=this._liveLogger)||void 0===e||e.destroy(!1),this._liveLogger=void 0}},{key:"open",value:function(){this._liveLogger||(this._start(),this.config.showUserIdInErrorPanel&&this.player.plugins.error&&(this.player.plugins.error.config.extraTips=[{label:"userId",value:null==SDK?void 0:SDK.getConfig("user_unique_id")}]))}},{key:"_createTea",value:function(){SDK.init(_objectSpread2$2(_objectSpread2$2({},this.config),{},{app_id:468759,channel:"cn"})),SDK.start(),SDK.config({user_unique_id:this._userId,device_id:this._deviceId})}},{key:"_start",value:function(){this._createTea(),this._liveLogger=new LoggerControl({Tea:SDK,player:this.player,aid:this.config.appId,project_key:this.config.appId,app_name:this.config.appName||this.config.appId,user_id:this._userId,device_id:this._deviceId,ext:{veplayer_version:"2.4.2-rc.4",flv_version:"3.0.19-rc.0",hls_version:"3.0.19-rc.0",rts_version:"0.2.1-alpha.6"}})}}],[{key:"pluginName",get:function(){return"logger"}},{key:"defaultConfig",get:function(){return{appId:"",enable:!0,showUserIdInErrorPanel:!0}}}]),r}();function normalizeNumber(e,t){return"number"!=typeof e?"-":t?t(e):e.toString()}function getDefaultRow(e){var t,r,n;return{rows:[{key:"format",labelTextKey:"FORMAT",value:null!==(t=null==e?void 0:e.format)&&void 0!==t?t:"-"},{key:"fps",labelTextKey:"FPS",value:normalizeNumber(e.fps,(function(e){return"".concat(e," fps")}))},{key:"bitrate",labelTextKey:"BITRATE",value:normalizeNumber(e.bitrate,(function(e){return"".concat(e/1e3," kbps")}))},{key:"gop",labelTextKey:"GOP",value:normalizeNumber(e.gop,(function(e){return"".concat(e," frames")}))},{key:"resolution",labelTextKey:"RESOLUTION",value:_concatInstanceProperty(r="".concat(normalizeNumber(e.height)," * ")).call(r,normalizeNumber(e.height))},{key:"encodeType",labelTextKey:"ENCODE_TYPE",value:null!==(n=e.encodeType)&&void 0!==n?n:"-"},{key:"bufferEnd",labelTextKey:"BUFFER_END",value:normalizeNumber(e.bufferEnd)},{key:"currentTime",labelTextKey:"CURRENT_TIME",value:normalizeNumber(e.currentTime,(function(e){return e.toFixed(6)+"s"}))}]}}function getSoftDecodeRow(e){return{titleTextKey:"DECODE_INFO",rows:[{key:"decodeEfficiency",labelTextKey:"DECODE_EFFICIENCY",value:normalizeNumber(e.decodeFps,(function(e){return e+"frames/s"}))},{key:"decodeCost",labelTextKey:"DECODE_COST",value:normalizeNumber(e.decodeFps,(function(e){return(e?(1e3/e).toFixed():0)+"ms"}))}]}}var _context,infoPanel="",InfoPanel=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(){var e,n;_classCallCheck$1(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$2(_assertThisInitialized(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,o))),"_pollTimer",void 0),_defineProperty$2(_assertThisInitialized(n),"_visible",void 0),_defineProperty$2(_assertThisInitialized(n),"_playPlugin",void 0),n}return _createClass$2(r,[{key:"_streamType",get:function(){return util.getStreamType(this.player.config.url)}},{key:"afterCreate",value:function(){var e=this;this._playPlugin=this.player.plugins[this._streamType],this.player.on(Events.ERROR,(function(){return e.close()})),this.config.visible&&this.player.once(Events.LOADED_DATA,(function(){return e.open()}))}},{key:"open",value:function(){var e;this._visible||(_includesInstanceProperty(e=["flv","hls"]).call(e,this._streamType)?this.player.plugins[this._streamType]?(this.root.style.display="block",this._tick(),this._visible=!0):console.warn("不支持或未加载".concat(this._streamType,"插件")):console.warn("仅支持flv和hls格式的信息展示"))}},{key:"close",value:function(){this._visible&&(clearTimeout(this._pollTimer),this.root.innerHTML="",this.root.style.display="none",this._visible=!1)}},{key:"destroy",value:function(){var e=this;this.close(),this.player.off(Events.LOADED_DATA,(function(){return e.open()})),this.player.off(Events.ERROR,(function(){return e.close()}))}},{key:"render",value:function(){return'\n <xg-live-panel class="veplayer-live-panel">\n </xg-live-panel>\n '}},{key:"_tick",value:function(){var e=this;clearTimeout(this._pollTimer),this._renderPanel(),this._pollTimer=window.setTimeout((function(){e._tick()}),this.config.interval)}},{key:"_getStats",value:function(){var e;return null===(e=this._playPlugin)||void 0===e?void 0:e.getStats()}},{key:"_getPanelData",value:function(){var e=this._getStats()||{},t="".concat(this._streamType,"_live"),r=this._playPlugin.softDecode,n=[getDefaultRow(_objectSpread2$2(_objectSpread2$2({},e),{},{format:t}))];return r&&n.push(getSoftDecodeRow(e)),n}},{key:"_renderPanel",value:function(){var e=this,t=this._getPanelData(),r=this.root;r&&(r.innerHTML="",t.forEach((function(t){e._renderGroup(r,t)})))}},{key:"_renderGroup",value:function(e,t){var r=this,n=t.title,i=t.titleTextKey,o=t.rows,a=this.player.config.i18nManager;if(n||i){var s,l=this._genTitleDom(null!==(s=a.getText(i))&&void 0!==s?s:n);e.appendChild(l)}o.forEach((function(t){var n=r._genRowDom(t);e.appendChild(n)}))}},{key:"_genTitleDom",value:function(e){var t=util$1.createDom("xg-live-panel","",void 0,"veplayer-live-panel-row"),r=util$1.createDom("xg-live-panel",e,void 0,"veplayer-live-panel-row-title");return t.appendChild(r),t}},{key:"_genRowDom",value:function(e){var t=this.player.config.i18nManager,r=util$1.createDom("veplayer-live-panel-row","",void 0,"veplayer-live-panel-row"),n=util$1.createDom("xg-live-panel",t.getText(e.labelTextKey),void 0,"veplayer-live-panel-row-label");r.appendChild(n);var i=util$1.createDom("xg-live-panel",e.value);return r.appendChild(i),r}}],[{key:"pluginName",get:function(){return"infoPanel"}},{key:"defaultConfig",get:function(){return{visible:!1,interval:500}}}]),r}(),EN=_objectSpread2$2(_objectSpread2$2({},EN$1),{},{INVALID_PARAMETER:"The imported parameter is empty, please pass in necessary parameters such as the stream address",FORMAT:"format",FPS:"fps",BITRATE:"bitrate",GOP:"gop",RESOLUTION:"resolution",ENCODE_TYPE:"encodeType",BUFFER_END:"bufferEnd",CURRENT_TIME:"currentTime",DECODE_EFFICIENCY:"efficiency",DECODE_COST:"cost",DECODE_INFO:"decodeInfo",REFRESH:"refresh"}),ZH_CN=_objectSpread2$2(_objectSpread2$2({},ZH_CN$1),{},{INVALID_PARAMETER:"入参为空,请传入流地址等必要参数",FORMAT:"格式",FPS:"帧率",BITRATE:"码率",GOP:"GOP",RESOLUTION:"视频分辨率",ENCODE_TYPE:"编码方式",BUFFER_END:"Buffer 水位",CURRENT_TIME:"播放进度",DECODE_EFFICIENCY:"解码效率",DECODE_COST:"解码消耗",DECODE_INFO:"软解信息",REFRESH:"刷新"}),_excluded=["getDrmConfig"],getDrmStrategy=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i,o,a,s,l,c,u,p,f,d;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=getDrmType(t.drm),!t.url||n!==DrmType.Fairplay){e.next=18;break}return e.prev=2,a=null!==(i=null==t||null===(o=t.drm)||void 0===o?void 0:o.fairplay)&&void 0!==i?i:{},s=a.getDrmConfig,l=_objectWithoutProperties(a,_excluded),e.next=6,_Promise.all([load(DynamicModule.PluginDrm).then((function(e){return e.DrmPlugin})).catch((function(){})),null==s?void 0:s({url:t.url})]);case 6:return c=e.sent,u=_slicedToArray(c,2),p=u[0],f=u[1],d=_Object$assign({},l,null==t?void 0:t.drm,f),f&&(null==r||r.updateDrmConfig(f)),e.abrupt("return",{options:{drm:d},plugins:p?[p]:[]});case 15:e.prev=15,e.t0=e.catch(2),console.log(e.t0);case 18:return e.abrupt("return",{});case 19:case"end":return e.stop()}}),e,null,[[2,15]])})));return function(t,r){return e.apply(this,arguments)}}(),getAbrStrategy=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o,a,s;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("rtm"!==(o=t.url&&getStreamType(t.url))){e.next=3;break}return e.abrupt("return",{});case 3:if(a="flv"===o?null==t||null===(r=t.flv)||void 0===r?void 0:r.abr:null==t||null===(n=t.hls)||void 0===n?void 0:n.abr){e.next=6;break}return e.abrupt("return",{});case 6:return e.next=8,load(DynamicModule.PluginAbr).catch((function(){}));case 8:return s=e.sent,e.abrupt("return",{options:_defineProperty$2({},"flv"===o?"abr":"hlsabr",_objectSpread2$2(_objectSpread2$2({},a),{},{open:null===(i=a.enable)||void 0===i||i})),plugins:["flv"===o?null==s?void 0:s.AbrPlugin:null==s?void 0:s.HlsAbrPlugin]});case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();VeI18n.extend([{LANG:"zh-cn",TEXT:ZH_CN},{LANG:"en",TEXT:EN}]);var LIVE_DEFAULT_OPTIONS={autoplay:{muted:!0}},LIVE_DEFAULT_PLUGINS=_concatInstanceProperty(_context=[]).call(_context,_toConsumableArray$1(DEFAULT_PLUGINS),[Refresh,Logger,InfoPanel]),RTMCodec=function(e){return e.H264="h264",e}(RTMCodec||{}),VePlayerLive=function(e){_inherits(n,VePlayerBase);var t,r=_createSuper(n);function n(e){return _classCallCheck$1(this,n),r.call(this,e)}return _createClass$2(n,[{key:"playTime",get:function(){var e;if(null===(e=this._player)||void 0===e||null===(e=e.played)||void 0===e||!e.length)return 0;for(var t=this._player.played.length,r=0,n=0;n<t;n++){var i,o,a=null===(i=this._player)||void 0===i?void 0:i.played.start(n);r+=(null===(o=this._player)||void 0===o?void 0:o.played.end(n))-a}return r}},{key:"openLog",value:function(){var e;null===(e=this._player.plugins)||void 0===e||e.logger.open()}},{key:"closeLog",value:function(){var e;null===(e=this._player.plugins)||void 0===e||e.logger.close()}},{key:"openInfoPanel",value:function(){var e;null===(e=this._player.plugins)||void 0===e||e.infopanel.open()}},{key:"closeInfoPanel",value:function(){var e;null===(e=this._player.plugins)||void 0===e||e.infopanel.close()}},{key:"openAbr",value:function(){var e,t,r=this.url&&getStreamType(this.url);"flv"!==r?"hls"===r&&(null===(e=this._player.plugins)||void 0===e||null===(e=e.hlsabr)||void 0===e||e.switchAbr(!0)):null===(t=this._player.plugins)||void 0===t||null===(t=t.abr)||void 0===t||t.switchAbr(!0)}},{key:"closeAbr",value:function(){var e,t,r=this.url&&getStreamType(this.url);"flv"!==r?"hls"===r&&(null===(e=this._player.plugins)||void 0===e||null===(e=e.hlsabr)||void 0===e||e.switchAbr(!1)):null===(t=this._player.plugins)||void 0===t||null===(t=t.abr)||void 0===t||t.switchAbr(!1)}},{key:"updateDrmConfig",value:function(e){var t;null===(t=this._player)||void 0===t||null===(t=t.plugins)||void 0===t||null===(t=t.drm)||void 0===t||t.updateDrmConfig(e)}},{key:"switchAbr",value:function(e){var t;if(null!==(t=this._player.plugins)&&void 0!==t&&t.abr){if(void 0!==(null==e?void 0:e.bitrate)){var r=this._player.plugins.abr.config.urls[e.bitrate];if(!r)return;this.switch(r,{seamless:!0}),this._player.plugins.abr.bitrate=e.bitrate}var n;if(void 0!==(null==e?void 0:e.enable))null===(n=this._player.plugins)||void 0===n||n.abr.switchAbr(e.enable)}}},{key:"getRTMNetWorkInfo",value:function(){var e;return null===(e=this._player)||void 0===e||null===(e=e.plugins)||void 0===e||null===(e=e.rts)||void 0===e?void 0:e.getNetWorkInfo()}},{key:"getRTMStats",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null===(t=this._player)||void 0===t||null===(t=t.plugins)||void 0===t||null===(t=t.rts)||void 0===t?void 0:t.getStatsSnapshoot());case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getFLVStats",value:function(){var e;return null===(e=this._player)||void 0===e||null===(e=e.plugins)||void 0===e||null===(e=e.flv)||void 0===e?void 0:e.getStats()}}]),n}();function createLivePlayer(e){return _createLivePlayer.apply(this,arguments)}function _createLivePlayer(){return(_createLivePlayer=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o,a,s,l;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=void 0,t&&(t.url||t.playlist)){e.next=3;break}throw create4(ErrorCode.INVALID_PARAMETER,new VeI18n);case 3:return o=new VeI18n({lang:null==t?void 0:t.lang,i18n:null==t?void 0:t.i18n}),a=_objectSpread2$2(_objectSpread2$2({},t),{},{plugins:_concatInstanceProperty(r=[]).call(r,_toConsumableArray$1(LIVE_DEFAULT_PLUGINS),_toConsumableArray$1(null!==(n=t.plugins)&&void 0!==n?n:[]))}),e.next=7,VePlayerBase.create(_objectSpread2$2(_objectSpread2$2(_objectSpread2$2({},LIVE_DEFAULT_OPTIONS),a),{},{isLive:!0,i18nManager:o,preProcessUrl:function(e){return{url:generateUrlWithSessionId(e)}},preparePlugins:function(e){return _asyncToGenerator(_regeneratorRuntime().mark((function t(){var r,n,o,s,l,c,u,p,f,d,h,y,g,_,v;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,_Promise.all([getTypeStrategy(_objectSpread2$2(_objectSpread2$2({},a),{},{url:e}),i),getDrmStrategy(_objectSpread2$2(_objectSpread2$2({},a),{},{url:e}),i),getAbrStrategy(_objectSpread2$2(_objectSpread2$2({},a),{},{url:e}))]);case 2:return n=t.sent,o=_slicedToArray(n,3),s=o[0],l=o[1],c=o[2],p=(u=null!=s?s:{}).options,f=u.plugins,h=(d=null!=l?l:{}).options,y=d.plugins,_=(g=null!=c?c:{}).options,v=g.plugins,t.abrupt("return",{options:_Object$assign({},p,h,_),plugins:_concatInstanceProperty(r=[]).call(r,_toConsumableArray$1(null!=f?f:[]),_toConsumableArray$1(null!=y?y:[]),_toConsumableArray$1(null!=v?v:[]))});case 11:case"end":return t.stop()}}),t)})))()}}),VePlayerLive);case 7:return(i=e.sent)&&(l=null===(s=i)||void 0===s||null===(s=s._player)||void 0===s||null===(s=s.config)||void 0===s?void 0:s._RTMdegrade)&&i.emit("degrade",{originRtmUrl:l._originRtmUrl,code:"NOT_SUPPORT",message:"not support rtm or h264",isRTMSupported:l._isRTMSupported,isRTMSupportCodec:l._isRTMSupportCodec}),e.abrupt("return",i);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var live=Object.freeze({__proto__:null,ErrorCode:ErrorCode,Events:Events});setModuleSystem("esm"),util.isMseSupported,util.isSoftDecodeSupported,setModuleSystem("esm");export{Codec,DecodeType,Degradation,DynamicModule,EN$1 as EN,ListType,POSITIONS$1 as POSITIONS,Plugin,RTMCodec,sniffer$1 as Sniffer,ZH_CN$1 as ZH_CN,createLivePlayer,isMseSupported,isRTMSupportCodec,isRTMSupported,isSoftDecodeSupported,live,load,register2 as register,registerPlugin,util};
10
+ u._player.unRegisterPlugin(e)})),this._previousPrepareResult=a,null!=a&&a.options&&this._player.setConfig(a.options),e.abrupt("return",{plugins:_mapInstanceProperty(c).call(c,(function(e){return u._player.registerPlugin(e)})),options:null==a?void 0:a.options});case 8:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"_handleFallback",value:(i=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._player.addClass(STATE_CLASS.ENTER),r=this._sourceManager.url,n=this._sourceManager.fallback()){e.next=7;break}return this._player.removeClass(STATE_CLASS.ENTER),this.emit(Events$1.FALLBACK_ERROR,transform$1(t,this._i18nManager)),e.abrupt("return");case 7:this._player.once("canplay",(function(){i._sourceManager.resetFallback()})),this.emit(Events$1.FALLBACK,{from:{url:r},to:{url:n}}),this._switchUrl(n);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_transformEvent",value:function(e,t){var r=this;return e===ERROR$2?{xgCallback:t?function(e){t(transform$1(e,r._i18nManager))}:void 0,xgEventName:e}:transform(e,t)}},{key:"_switch",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o,a,s,l,c;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=clonedeep(this._sourceManager.definition),e.next=3,this.prepare(t.url);case 3:if(e.t0=e.sent,e.t0){e.next=6;break}e.t0={};case 6:if(s=e.t0,l=s.plugins,null!=(c=s.options)&&c.url&&(t.url=null==c?void 0:c.url),this._sourceManager.switch(t),null===(r=this._player)||void 0===r||null===(r=r.plugins)||void 0===r||r.sources.renderItemList(),null===(n=this._player)||void 0===n||null===(n=n.plugins)||void 0===n||n.definition.renderItemList(),(null==t||null===(i=t.source)||void 0===i?void 0:i.name)!==(null==a||null===(o=a.source)||void 0===o?void 0:o.name)&&this.emit(Events$1.SOURCE_CHANGE),null==l||!l.length){e.next=21;break}return this.emit(Events$1.DEFINITION_CHANGE),e.next=18,this._callBeforePlayerInitForUrl(l,t.url);case 18:this.emit(Events$1.AFTER_DEFINITION_CHANGE),e.next=22;break;case 21:this._player.changeDefinition(t,a);case 22:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_switchUrl",value:(r=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i,o,a,s,l,c,u=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.prepare(t);case 2:if(e.t0=e.sent,e.t0){e.next=5;break}e.t0={};case 5:if(i=e.t0,o=i.plugins,a=i.options,s=null!==(n=null==a?void 0:a.url)&&void 0!==n?n:t,this._sourceManager.url=s,null==o||!o.length){e.next=14;break}this._callBeforePlayerInitForUrl(o,s),e.next=21;break;case 14:if(l=this._player.switchURL(s,{seamless:null==r?void 0:r.seamless}),c=this._player.currentTime,!l||!l.then){e.next=20;break}return e.abrupt("return",l);case 20:return e.abrupt("return",new _Promise((function(e){var t=u._player.paused&&!u._player.isError,r=function(){u._player.currentTime=c,t&&u._player.once(CANPLAY,(function(){u._player.pause()})),e()};sniffer$1.os.isAndroid?u.once(TIME_UPDATE,(function(){r()})):u.once(CANPLAY,(function(){r()})),u._player.play()})));case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_diffPlugins",value:function(e,t){var r=_mapInstanceProperty(e).call(e,(function(e){return e.pluginName})),n=_mapInstanceProperty(t).call(t,(function(e){return e.pluginName}));return{removedPlugins:_filterInstanceProperty(r).call(r,(function(e){return!_includesInstanceProperty(n).call(n,e)})),addedPlugins:_filterInstanceProperty(t).call(t,(function(e){return!_includesInstanceProperty(r).call(r,e.pluginName)}))}}},{key:"_callBeforePlayerInitForUrl",value:function(e,t){var r=this;return new _Promise((function(n){r._player.config.url=t,null==e||e.forEach((function(e){e.beforePlayerInit()})),r._player.on(Events$1.CANPLAY,(function(){n(void 0)}))}))}}],[{key:"create",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function t(){var r,n,i,o,a,s,l,c,u=arguments;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=u.length>0&&void 0!==u[0]?u[0]:{},a=u.length>1?u[1]:void 0,s=new SourceManager({sources:Source.normalize({url:o.url,fallbackUrls:o.fallbackUrls,sources:o.playlist}),url:o.url,defaultSource:o.defaultSource,defaultDefinition:o.defaultDefinition,maxFallbackRound:o.maxFallbackRound}),t.next=5,null==o||null===(r=o.preparePlugins)||void 0===r?void 0:r.call(o,null!==(n=s.url)&&void 0!==n?n:"");case 5:return null!=(l=t.sent)&&null!==(i=l.options)&&void 0!==i&&i.url&&(s.url=null==l||null===(c=l.options)||void 0===c?void 0:c.url),o.url=s.url,t.abrupt("return",new(null!=a?a:e)(_objectSpread2$2(_objectSpread2$2({},o),{},{prepareResult:l,sourceManager:s})));case 9:case"end":return t.stop()}}),t)}))),function(){return t.apply(this,arguments)})}]),e}();function concatBuffer(e){var t=_reduceInstanceProperty(e).call(e,(function(e,t){return e+t.byteLength}),0),r=new Uint8Array(t),n=0;return e.forEach((function(e){r.set(e,n),n+=e.byteLength})),r}function timeFixed(e,t){return _parseFloat$7(null==e?void 0:e.toFixed(t||4))}var __defProp$6=_Object$defineProperty,__defNormalProp$6=function(e,t,r){return t in e?__defProp$6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},__publicField$6=function(e,t,r){return __defNormalProp$6(e,"symbol"!==_typeof$1(t)?t+"":t,r),r},PACKET_TYPE={SCRIPT:"ScriptData",SEQUENCE:"Sequence_Header",RAW:"RawData"},AUDIO_RATE=[5500,11e3,22e3,44e3],AUDIO_CODEC_TYPE={AAC:"aac",PCMA:"pcma",PCMU:"pcmu"},VIDEO_CODEC_TYPE={AVC:"avc",HEVC:"bytevc1"},FlvTagView=function(){function e(t){var r=this;_classCallCheck$1(this,e),__publicField$6(this,"type",0),__publicField$6(this,"tagSize",0),__publicField$6(this,"timestamp",0),__publicField$6(this,"duration",0),__publicField$6(this,"header",null),__publicField$6(this,"body",null),__publicField$6(this,"bodyView",null),__publicField$6(this,"tailsize",null),_Object$keys(t).forEach((function(e){r[e]=t[e]}))}return _createClass$2(e,[{key:"streamType",get:function(){switch(this.type){case 18:return"scriptData";case 9:return"video";case 8:return"audio"}}},{key:"packetType",get:function(){var e;return null==(e=this.bodyView)?void 0:e.packetType}},{key:"frameType",get:function(){var e;return null==(e=this.bodyView)?void 0:e.frameType},set:function(e){this.bodyView.frameType=e}},{key:"dts",get:function(){return this.timestamp}},{key:"pts",get:function(){var e;return((null==(e=this.bodyView)?void 0:e.cts)||0)+this.timestamp}},{key:"ptsTime",get:function(){return this.pts?timeFixed(this.pts/1e3):0}},{key:"dtsTime",get:function(){return this.dts?timeFixed(this.dts/1e3):0}},{key:"sampleView",get:function(){var e,t,r;if("Sequence_Header"!==(null==(e=this.bodyView)?void 0:e.packetType)&&18!==this.type)return{dts:this.timestamp,pts:((null==(t=this.bodyView)?void 0:t.cts)||0)+this.timestamp,data:this._getSampleData(),units:null==(r=this.bodyView)?void 0:r.units}}},{key:"size",get:function(){var e,t;return null==(t=null==(e=this.sampleView)?void 0:e.data)?void 0:t.length}},{key:"data",get:function(){return this._getSampleData()}},{key:"nalTypes",get:function(){var e,t;return null==(t=null==(e=this.bodyView)?void 0:e.units)?void 0:_mapInstanceProperty(t).call(t,(function(e){return e.type}))}},{key:"nalSizes",get:function(){var e,t;return null==(t=null==(e=this.bodyView)?void 0:e.units)?void 0:_mapInstanceProperty(t).call(t,(function(e){return e.unit.length}))}},{key:"keyframe",get:function(){return"I"===this.frameType}},{key:"isSample",get:function(){return"scriptData"!==this.streamType&&"Sequence_Header"!==this.packetType}},{key:"isVideo",get:function(){return this.isSample&&"video"===this.streamType}},{key:"isAudio",get:function(){return this.isSample&&"audio"===this.streamType}},{key:"isSqHeader",get:function(){return"Sequence_Header"===this.packetType}},{key:"timescale",get:function(){return 1e3}},{key:"isHevc",get:function(){var e;return"bytevc1"===(null==(e=this.bodyView)?void 0:e.codecType)}},{key:"_getSampleData",value:function(){var e,t;if("audio"===this.streamType)return this.bodyView.sample;var r=(null==(t=this.bodyView)?void 0:_filterInstanceProperty(e=t.units).call(e,(function(e){return!e.isSei})))||[],n=_reduceInstanceProperty(r).call(r,(function(e,t){return e+(t.unit.byteLength+4)}),0),i=new Uint8Array(n),o=0;return r.forEach((function(e){i.set([0,0,0,1],o),o+=4,i.set(e.unit,o),o+=e.unit.byteLength})),i}}]),e}(),UTF8=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,null,[{key:"decode",value:function(t){for(var r=[],n=t,i=0,o=t.length;i<o;)if(n[i]<128)r.push(String.fromCharCode(n[i])),++i;else{if(n[i]<192);else if(n[i]<224){if(e._checkContinuation(n,i,1)){var a=(31&n[i])<<6|63&n[i+1];if(a>=128){r.push(String.fromCharCode(65535&a)),i+=2;continue}}}else if(n[i]<240){if(e._checkContinuation(n,i,2)){var s=(15&n[i])<<12|(63&n[i+1])<<6|63&n[i+2];if(s>=2048&&55296!=(63488&s)){r.push(String.fromCharCode(65535&s)),i+=3;continue}}}else if(n[i]<248&&e._checkContinuation(n,i,3)){var l=(7&n[i])<<18|(63&n[i+1])<<12|(63&n[i+2])<<6|63&n[i+3];if(l>65536&&l<1114112){l-=65536,r.push(String.fromCharCode(l>>>10|55296)),r.push(String.fromCharCode(1023&l|56320)),i+=4;continue}}r.push(String.fromCharCode(65533)),++i}return r.join("")}},{key:"_checkContinuation",value:function(e,t,r){var n=e;if(t+r<n.length){for(;r--;)if(128!=(192&n[++t]))return!1;return!0}return!1}}]),e}(),AMF=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,null,[{key:"parse",value:function(t){if(!(t.length<3)){var r={},n=e._parseValue(new DataView(t.buffer,t.byteOffset,t.byteLength));try{var i=e._parseValue(new DataView(t.buffer,t.byteOffset+n.size,t.byteLength-n.size));r[n.data]=i.data}catch(e){}return r}}},{key:"_parseValue",value:function(t){var r,n=t.byteLength,i=1,o=!1;switch(t.getUint8(0)){case 0:r=t.getFloat64(1),i+=8;break;case 1:r=!!t.getUint8(1),i+=1;break;case 2:var a=e._parseString(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i));r=a.data,i+=a.size;break;case 3:r={};var s=0;for(9==(16777215&t.getUint32(n-4))&&(s=3);i<n-4;){var l=e._parseObject(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i-s)),c=l.size,u=l.data;if(l.isEnd)break;r[u.name]=u.value,i+=c}if(i<=n-3)9===(16777215&t.getUint32(i-1))&&(i+=3);break;case 8:r={},i+=4;var p=0;for(9==(16777215&t.getUint32(n-4))&&(p=3);i<n-8;){var f=e._parseObject(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i-p)),d=f.size,h=f.data;if(f.isEnd)break;r[h.name]=h.value,i+=d}if(i<=n-3)9===(16777215&t.getUint32(i-1))&&(i+=3);break;case 9:r=void 0,i=1,o=!0;break;case 10:r=[];var y=t.getUint32(1);i+=4;for(var g=0;g<y;g++){var _=e._parseValue(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i)),v=_.data,m=_.size;r.push(v),i+=m}break;case 11:var $=t.getFloat64(i)+6e4*t.getInt16(i+8);r=new Date($),i+=10;break;case 12:var b=t.getUint32(1);i+=4,r="",b>0&&(r=UTF8.decode(new Uint8Array(t.buffer,t.byteOffset+i,b))),i+=b;break;default:i=n}return{data:r,size:i,isEnd:o}}},{key:"_parseString",value:function(e){var t=e.getUint16(0),r="";return t>0&&(r=UTF8.decode(new Uint8Array(e.buffer,e.byteOffset+2,t))),{data:r,size:2+t}}},{key:"_parseObject",value:function(t){if(!(t.byteLength<3)){var r=e._parseString(t),n=e._parseValue(new DataView(t.buffer,t.byteOffset+r.size,t.byteLength-r.size));return{data:{name:r.data,value:n.data},size:r.size+n.size,isEnd:n.isEnd}}}}]),e}(),isBrowser="undefined"!=typeof window,ua=isBrowser&&navigator.userAgent.toLocaleLowerCase(),isFirefox=isBrowser&&_includesInstanceProperty(ua).call(ua,"firefox"),isAndroid=isBrowser&&_includesInstanceProperty(ua).call(ua,"android"),__defProp$5=_Object$defineProperty,__defNormalProp$5=function(e,t,r){return t in e?__defProp$5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},__publicField$5=function(e,t,r){return __defNormalProp$5(e,"symbol"!==_typeof$1(t)?t+"":t,r),r},_AAC=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,null,[{key:"parseADTS",value:function(t,r){for(var n=t.length,i=0;i+2<n&&(255!==t[i]||240!=(246&t[i+1]));)i++;if(!(i>=n)){var o=i,a=[],s=(60&t[i+2])>>>2,l=e.FREQ[s];if(!l)throw new Error("Invalid sampling index: ".concat(s));for(var c,u,p=1+((192&t[i+2])>>>6),f=(1&t[i+2])<<2|(192&t[i+3])>>>6,d=e._getConfig(s,f,p),h=d.config,y=d.codec,g=0,_=e.getFrameDuration(l);i+7<n;)if(255===t[i]&&240==(246&t[i+1])){if(n-i<(u=(3&t[i+3])<<11|t[i+4]<<3|(224&t[i+5])>>5))break;c=2*(1&~t[i+1]);var v=timeFixed(r+g*_);a.push({pts:v,dts:v,ptsTime:timeFixed(v/9e4),dtsTime:timeFixed(v/9e4),data:t.subarray(i+7+c,i+u)}),g++,i+=u}else i++;return{skip:o,remaining:i>=n?void 0:t.subarray(i),frames:a,nbFrame:a.length,samplingFrequencyIndex:s,sampleRate:l,objectType:p,channelCount:f,codec:y,config:h,originCodec:"mp4a.40.".concat(p)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var r=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,i=(120&t[1])>>>3,o=e.FREQ[n];if(!o)throw new Error("Invalid sampling index: ".concat(n));var a=e._getConfig(n,i,r);return{samplingFrequencyIndex:n,sampleRate:o,objectType:r,channelCount:i,config:a.config,codec:a.codec,originCodec:"mp4a.40.".concat(r)}}}},{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,r){var n,i,o=[];return isFirefox?e>=6?(n=5,i=e-3):(n=2,i=e):isAndroid?(n=2,i=e):(n=r,i=e,e>=6?i=e-3:1===t&&(n=2,i=e)),o[0]=n<<3,o[0]|=(14&e)>>1,o[1]=(1&e)<<7,o[1]|=t<<3,5===n&&(o[1]|=(14&i)>>1,o[2]=(1&i)<<7,o[2]|=8,o[3]=0),{config:o,codec:"mp4a.40.".concat(n)}}},{key:"getSilentFrame",value:function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}]),e}(),AAC=_AAC;__publicField$5(AAC,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var __defProp$4=_Object$defineProperty,__defNormalProp$4=function(e,t,r){return t in e?__defProp$4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},__publicField$4=function(e,t,r){return __defNormalProp$4(e,"symbol"!==_typeof$1(t)?t+"":t,r),r},ExpGolomb=function(){function e(t){if(_classCallCheck$1(this,e),__publicField$4(this,"_bytesAvailable"),__publicField$4(this,"_bitsAvailable",0),__publicField$4(this,"_word",0),!t)throw new Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}return _createClass$2(e,[{key:"_loadWord",value:function(){var e=this._data.byteLength-this._bytesAvailable,t=Math.min(4,this._bytesAvailable);if(0===t)throw new Error("No bytes available");var r=new Uint8Array(4);r.set(this._data.subarray(e,e+t)),this._word=new DataView(r.buffer).getUint32(0),this._bitsAvailable=8*t,this._bytesAvailable-=t}},{key:"skipBits",value:function(e){if(this._bitsAvailable>e)this._word<<=e,this._bitsAvailable-=e;else{e-=this._bitsAvailable;var t=Math.floor(e/8);e-=8*t,this._bytesAvailable-=t,this._loadWord(),this._word<<=e,this._bitsAvailable-=e}}},{key:"readBits",value:function(e){if(e>32)throw new Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,e),r=this._word>>>32-t;return this._bitsAvailable-=t,this._bitsAvailable>0?this._word<<=t:this._bytesAvailable>0&&this._loadWord(),(t=e-t)>0&&this._bitsAvailable?r<<t|this.readBits(t):r}},{key:"skipLZ",value:function(){var e;for(e=0;e<this._bitsAvailable;++e)if(0!=(this._word&2147483648>>>e))return this._word<<=e,this._bitsAvailable-=e,e;return this._loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(e){for(var t=8,r=8,n=0;n<e;n++)0!==r&&(r=(t+this.readEG()+256)%256),t=0===r?t:r}},{key:"readSliceType",value:function(){return this.readUByte(),this.readUEG(),this.readUEG()}},{key:"firstMbInSlice",value:function(){return this.readUByte(),this.readUEG()}}]),e}();function readBig32(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function getFrameTypeFor264(e){var t=new ExpGolomb(e).readSliceType();return 2===t||4===t||7===t||9===t?"I":0===t||3===t||5===t||8===t?"P":1===t||6===t?"B":void 0}var NALu=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,null,[{key:"parseAnnexB",value:function(e){for(var t=e.length,r=2,n=0;null!==e[r]&&1!==e[r];)r++;if((n=++r+2)>=t)return[];for(var i=[];n<t;)switch(e[n]){case 0:if(0!==e[n-1]){n+=2;break}if(0!==e[n-2]){n++;break}r!==n-2&&i.push(e.subarray(r,n-2));do{n++}while(1!==e[n]&&n<t);n=(r=n+1)+2;break;case 1:if(0!==e[n-1]||0!==e[n-2]){n+=3;break}r!==n-2&&i.push(e.subarray(r,n-2)),n=(r=n+1)+2;break;default:n+=3}return r<t&&i.push(e.subarray(r)),i}},{key:"parseNalu",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(!(e.length<4)){for(var r,n=e.length,i=[],o=0;o+t<n;)if(r=readBig32(e,o),3===t&&(r>>>=8),o+=t,r){if(o+r>n)break;i.push(e.subarray(o,o+r)),o+=r}return i}}},{key:"parseNaluType",value:function(e,t){return null==e?void 0:_mapInstanceProperty(e).call(e,(function(e){var r=t?e[0]>>>1&63:31&e[0],n=t&&(39===r||40===r),i={type:r,unit:e,isSei:n=n||!t&&6===r};switch(r){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!t&&5!==r||t&&5===r)break;i.frameType="I"}return t||1!==r||(i.frameType=getFrameTypeFor264(e)),!t||0!==r&&1!==r||(i.frameType="P"),!t&&r<=5&&(i.firstMbInSlice=new ExpGolomb(e).firstMbInSlice()),t&&r<=21&&(i.firstMbInSlice=128==(128&e[2])),i}))}},{key:"parseSEI",value:function(e){for(var t=e.length,r=1,n=0,i=0,o="";255===e[r];)n+=255,r++;for(n+=e[r++];255===e[r];)i+=255,r++;if(i+=e[r++],5===n&&t>r+16)for(var a=0;a<16;a++)o+=e[r].toString(16),r++;return{payload:e.subarray(r),type:n,size:i,uuid:o}}},{key:"removeEPB",value:function(e){for(var t=e.byteLength,r=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(r.push(n+2),n+=2):n++;if(!r.length)return e;var i=t-r.length,o=new Uint8Array(i),a=0;for(n=0;n<i;a++,n++)a===r[0]&&(a++,r.shift()),o[n]=e[a];return o}}]),e}(),AVC=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,null,[{key:"parseAVCDecoderConfigurationRecord",value:function(t){if(!(t.length<7)){for(var r,n,i=1+(3&t[4]),o=[],a=[],s=6,l=31&t[5],c=0;c<l;c++)if(n=t[s]<<8|t[s+1],s+=2,n){var u=t.subarray(s,s+n);s+=n,o.push(u),r||(r=e.parseSPS(NALu.removeEPB(u)))}var p,f=t[s];s++;for(var d=0;d<f;d++)p=t[s]<<8|t[s+1],s+=2,p&&(a.push(t.subarray(s,s+p)),s+=p);return{sps:r,spsArr:o,ppsArr:a,nalUnitSize:i}}}},{key:"parseSPS",value:function(e){var t=new ExpGolomb(e);t.readUByte();var r=t.readUByte(),n=t.readUByte(),i=t.readUByte();t.skipUEG();var o=420;if(100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r){var a=t.readUEG();if(a<=3&&(o=[0,420,422,444][a]),3===a&&t.skipBits(1),t.skipUEG(),t.skipUEG(),t.skipBits(1),t.readBool())for(var s=3!==a?8:12,l=0;l<s;l++)t.readBool()&&(l<6?t.skipScalingList(16):t.skipScalingList(64))}t.skipUEG();var c=t.readUEG();if(0===c)t.readUEG();else if(1===c){t.skipBits(1),t.skipUEG(),t.skipUEG();for(var u=t.readUEG(),p=0;p<u;p++)t.skipUEG()}t.skipUEG(),t.skipBits(1);var f=t.readUEG(),d=t.readUEG(),h=t.readBits(1);0===h&&t.skipBits(1),t.skipBits(1);var y,g,_,v,m,$=0,b=0,S=0,E=0;if(t.readBool()&&($=t.readUEG(),b=t.readUEG(),S=t.readUEG(),E=t.readUEG()),t.readBool()){if(t.readBool())switch(t.readUByte()){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:y=[t.readUByte()<<8|t.readUByte(),t.readUByte()<<8|t.readUByte()]}if(t.readBool()&&t.readBool(),t.readBool()&&(t.readBits(4),t.readBool()&&t.readBits(24)),t.readBool()&&(t.readUEG(),t.readUEG()),t.readBool()){var P=t.readBits(32),T=t.readBits(32);g=t.readBool(),m=(_=T)/(v=2*P)}}for(var I=e.subarray(1,4),O="avc1.",C=0;C<3;C++){var w=I[C].toString(16);w.length<2&&(w="0".concat(w)),O+=w}return{codec:O,profileIdc:r,profileCompatibility:n,levelIdc:i,chromaFormat:o,width:Math.ceil(16*(f+1)-2*($+b)),height:(2-h)*(d+1)*16-(h?2:4)*(S+E),sarRatio:y,fpsNum:_,fpsDen:v,fps:m,fixedFrame:g}}}]),e}(),HEVC=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,null,[{key:"parseHEVCDecoderConfigurationRecord",value:function(t){if(!(t.length<23)){for(var r,n,i,o,a=1+(3&t[21]),s=[],l=[],c=[],u=23,p=t[22],f=0;f<p;f++){n=63&t[u],i=t[u+1]<<8|t[u+2],u+=3;for(var d=0;d<i;d++)if(o=t[u]<<8|t[u+1],u+=2,o){switch(n){case 32:c.push(t.subarray(u,u+o));break;case 33:var h=t.subarray(u,u+o);r||(r=e.parseSPS(NALu.removeEPB(h))),s.push(h);break;case 34:l.push(t.subarray(u,u+o))}u+=o}}return{sps:r,spsArr:s,ppsArr:l,vpsArr:c,nalUnitSize:a}}}},{key:"parseSPS",value:function(e){var t=new ExpGolomb(e);t.readUByte(),t.readUByte(),t.readBits(4);var r=t.readBits(3);t.readBits(1);var n=this._parseProfileTierLevel(t,r);t.readUEG();var i=t.readUEG(),o=420;i<=3&&(o=[0,420,422,444][i]);var a=0;3===i&&(a=t.readBits(1));var s,l,c,u,p=t.readUEG(),f=t.readUEG(),d=t.readBits(1);(1===d&&(s=t.readUEG(),l=t.readUEG(),c=t.readUEG(),u=t.readUEG()),1===d)&&(p-=(1!==i&&2!==i||0!==a?1:2)*(l+s),f-=(1===i&&0===a?2:1)*(u+c));return{codec:"hev1.1.6.L93.B0",width:p,height:f,chromaFormat:o,bitDepthLumaMinus8:t.readUEG(),bitDepthChromaMinus8:t.readUEG(),generalProfileSpace:n.generalProfileSpace,generalTierFlag:n.generalTierFlag,generalProfileIdc:n.generalProfileIdc,generalLevelIdc:n.generalLevelIdc}}},{key:"_parseProfileTierLevel",value:function(e,t){var r,n,i;(arguments.length>2&&void 0!==arguments[2]?arguments[2]:1)&&(r=e.readBits(2),n=e.readBits(1),i=e.readBits(5)),e.readBits(32),e.readBits(1),e.readBits(1),e.readBits(1),e.readBits(1),e.readBits(16),e.readBits(16),e.readBits(12);for(var o=e.readUByte(),a=[],s=[],l=0;l<t;l++)a[l]=e.readBits(1),s[l]=e.readBits(1);t>0&&e.readBits(2*(8-t));for(var c=0;c<t;c++)0!==a[c]&&(e.readBits(2),e.readBits(1),e.readBits(5),e.readBits(16),e.readBits(16),e.readBits(4),e.readBits(16),e.readBits(16),e.readBits(12)),0!==s[c]&&e.readBits(8);return{generalProfileSpace:r,generalTierFlag:n,generalProfileIdc:i,generalLevelIdc:o}}}]),e}();function addRelativeTime(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=_filterInstanceProperty(t=e.items).call(t,(function(e){return e.isSample&&e.isVideo}))[0],o=_filterInstanceProperty(r=e.items).call(r,(function(e){return e.isSample&&e.isAudio}))[0],a=Math.min((null==o?void 0:o.dtsTime)||0,(null==i?void 0:i.dtsTime)||0);return a-=n,e.items.forEach((function(e){e.time=timeFixed(e.dtsTime-a)})),e}function getRates(e){var t,r=_filterInstanceProperty(t=e.items).call(t,(function(e){return e.isVideo})),n=[],i=-1,o={},a={};return r.forEach((function(e,t){(e.keyframe||t===r.length-1)&&(i=-1===i?e.time:i,n.push({time:e.time,value:timeFixed(e.time-i)}),i=e.time);var s=Math.ceil(e.time+1e-5);o[s]?o[s]++:o[s]=1,a[s]?a[s]+=8*e.size:a[s]=8*e.size})),{bitRates:_adapter(a),gops:_filterInstanceProperty(n).call(n,(function(e){return e.value})),frameRates:_adapter(o)}}function _adapter(e){var t=_Object$keys(e);return _mapInstanceProperty(t).call(t,(function(t){return{time:Number(t),value:e[t]}}))}function topThreeFrameSize(e){var t,r,n,i,o=_reduceInstanceProperty(t=_sliceInstanceProperty(r=_sortInstanceProperty(n=_filterInstanceProperty(i=_sliceInstanceProperty(e).call(e)).call(i,(function(e){return e.isSample}))).call(n,(function(e,t){return e.time>t.time?1:-1}))).call(r,0,3)).call(t,(function(e,t){return e+t.size}),0);return o>1e3?timeFixed(o/1e3)+"KB":o+"B"}function avgBitrate(e){return _reduceInstanceProperty(e).call(e,(function(e,t){return e+t.size}),0)/_reduceInstanceProperty(e).call(e,(function(e,t){return e+t.duration}),0)*8e3}function getProfile(e){if(null==e?void 0:e.profileIdc)switch(e.profileIdc){case 66:return"66(Baseline)";case 77:return"77(Main)";case 100:return"100(High)"}}var __defProp$3=_Object$defineProperty,__defNormalProp$3=function(e,t,r){return t in e?__defProp$3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},__publicField$3=function(e,t,r){return __defNormalProp$3(e,"symbol"!==_typeof$1(t)?t+"":t,r),r},Flv$1=function(){function e(){_classCallCheck$1(this,e),__publicField$3(this,"_nalUnitSize",0),__publicField$3(this,"_lastAudio",null),__publicField$3(this,"_lastVideo",null),__publicField$3(this,"_videoStartDts",-1),__publicField$3(this,"_audioStartDts",-1)}return _createClass$2(e,[{key:"parse",value:function(e){for(var t=e.byteLength,r=e.subarray(0,13),n=13,i=_objectSpread2$2(_objectSpread2$2({header:r},this._parseHeader(r)),{},{items:[]});n+11<t;){var o=e.subarray(n,n+11),a=o[1]<<16|o[2]<<8|o[3],s=n+11+a;if(s>t)break;var l=e.subarray(n+11,s),c=new FlvTagView(_objectSpread2$2({tagSize:11+a+4,header:o,body:l,tailsize:e.subarray(s,s+4)},this._parseTag(o,l)));c.isAudio&&(this._lastAudio&&(this._lastAudio.duration=c.dts-this._lastAudio.dts),this._lastAudio=c),c.isVideo&&(this._lastVideo&&(this._lastVideo.duration=c.dts-this._lastVideo.dts),this._lastVideo=c),i.items.push(c),n=s+4}var u=addRelativeTime(i);return u.rates=getRates(u),this._addMetadataToFirstKeyFrame(u),u}},{key:"getSnapshoot",value:function(t,r){var n,i,o,a,s=_filterInstanceProperty(n=t.items).call(n,(function(e){return 8===e.type}))[0],l=_filterInstanceProperty(i=t.items).call(i,(function(e){return 9===e.type}))[0],c=s&&s.bodyView||s,u=l&&l.bodyView||l,p=_filterInstanceProperty(o=t.items).call(o,(function(e){return e.isVideo})).length,f=this._getNbFrame(t,"I"),d=this._getNbFrame(t,"P"),h=this._getNbFrame(t,"B"),y=0;if(null==r?void 0:r.gopCacheBuffer){var g,_=(new e).parse(r.gopCacheBuffer),v=_filterInstanceProperty(g=_.items).call(g,(function(e){return e.isVideo})),m=null==(a=v[v.length-1])?void 0:a.time;m&&(y=m-r.take/1e3)}return{rates:t.rates,audio:c?_Object$assign({},c,this._getExt(t,"audio")):null,video:u?_Object$assign({},u,this._getExt(t,"video"),{topThreeFrameSize:topThreeFrameSize(t.items),gopCache:timeFixed(y),profile:getProfile(u.sps),iFrames:f,pFrames:d,bFrames:h,iPercent:timeFixed(f/p*100),pPercent:timeFixed(d/p*100),bPercent:timeFixed(h/p*100)}):null}}},{key:"_addMetadataToFirstKeyFrame",value:function(e){var t,r,n,i=_filterInstanceProperty(t=e.items).call(t,(function(e){return 9===e.type}))[0];if(i&&(null==(n=i.bodyView)?void 0:n.sps)){var o=_filterInstanceProperty(r=e.items).call(r,(function(e){return e.isVideo&&e.keyframe}))[0];o&&(o.bodyView.sps=i.bodyView.sps,o.bodyView.vpsArr=i.bodyView.vpsArr,o.bodyView.spsArr=i.bodyView.spsArr,o.bodyView.ppsArr=i.bodyView.ppsArr)}}},{key:"_getExt",value:function(e,t){var r,n,i,o=_filterInstanceProperty(r=e.items).call(r,(function(e){return e.streamType===t&&e.isSample})),a=_filterInstanceProperty(n=e.items).call(n,(function(e){var r;return e.streamType===t&&(null==(r=e.bodyView)?void 0:r.packetType)===PACKET_TYPE.SEQUENCE}))[0];if(!o.length)return 0;var s=o[0],l=o[o.length-1],c=0;return"audio"===t&&(c=a&&1024/(null==(i=a.bodyView)?void 0:i.sampleRate)*1e3),"video"===t&&(c=s.duration),{avgBits:avgBitrate(o),startDts:o[0].dts,duration:(l.timestamp-s.timestamp)/1e3,refDuration:c,frameLength:o.length}}},{key:"_getNbFrame",value:function(e,t){var r;return _filterInstanceProperty(r=e.items).call(r,(function(e){return e.isVideo&&e.frameType===t})).length}},{key:"_parseHeader",value:function(e){return{hasAudio:!!(e[4]>>2&1),hasVideo:!!(1&e[4])}}},{key:"_parseTag",value:function(e,t){var r,n=31&e[0],i=(e[7]<<24>>>0)+(e[4]<<16)+(e[5]<<8)+e[6];switch(n){case 18:r=_Object$assign({packetType:PACKET_TYPE.SCRIPT},AMF.parse(t));break;case 9:r=this._parseVideo(t,i);break;case 8:r=this._parseAudio(t,i)}return{type:n,timestamp:i,bodyView:r}}},{key:"_parseAudio",value:function(e){if(e.length){var t=(240&e[0])>>>4;if(10===t||7===t||8===t){if(10!==t){var r=(12&e[0])>>2,n=(2&e[0])>>1,i=1&e[0];return _objectSpread2$2({format:t,sampleRate:AUDIO_RATE[r],sampleSize:n?2:1,channelCount:i+1},this._parseG711(e))}return this._parseAac(e,t)}console.warn("Unsupported sound format: ".concat(t))}}},{key:"_parseG711",value:function(e,t){return{codecType:7===t?AUDIO_CODEC_TYPE.PCMA:AUDIO_CODEC_TYPE.PCMU,sampleRate:8e3,sample:e.subarray(1),packetType:PACKET_TYPE.RAW}}},{key:"_parseAac",value:function(e,t){if(0===e[1]){var r=e.subarray(2);return _objectSpread2$2(_objectSpread2$2({},AAC.parseAudioSpecificConfig(r)),{},{format:t,timescale:1e3,codecType:AUDIO_CODEC_TYPE.AAC,packetType:PACKET_TYPE.SEQUENCE,sequenceData:[r],frameType:"A"})}if(1===e[1])return{sample:e.subarray(2),format:t,codecType:AUDIO_CODEC_TYPE.AAC,packetType:PACKET_TYPE.RAW,frameType:"A"}}},{key:"_parseVideo",value:function(e,t){if(!(e.length<6)){var r=(240&e[0])>>>4,n=15&e[0];if(7===n||12===n){var i=12===n,o=e[1],a=(e[2]<<16|e[3]<<8|e[4])<<8>>8;if(0===o){var s=e.subarray(5),l=i?HEVC.parseHEVCDecoderConfigurationRecord(s):AVC.parseAVCDecoderConfigurationRecord(s);return this._nalUnitSize=l.nalUnitSize,_objectSpread2$2({codecId:n,codecType:i?VIDEO_CODEC_TYPE.HEVC:VIDEO_CODEC_TYPE.AVC,packetType:PACKET_TYPE.SEQUENCE,timescale:1e3,sequenceData:[s]},l)}if(1===o){var c=NALu.parseNalu(e.subarray(5),this._nalUnitSize);if(!c||!c.length)return;var u={dts:t,cts:a,units:c=NALu.parseNaluType(c,i)};return 1===r&&(u.keyframe=!0),c.forEach((function(e){var t=e.type,r=e.unit,n=e.frameType;switch(t){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!i&&5!==t||i&&5===t)break;u.keyframe=!0,u.frameType="I";break;case 6:case 39:case 40:if(!i&&6!==t||i&&6===t)break;u.seis?u.seis.push(NALu.parseSEI(NALu.removeEPB(r))):u.seis=[NALu.parseSEI(NALu.removeEPB(r))];break;case 32:if(!i)break;u.vpsArr?u.vpsArr.push(r):u.vpsArr=[r];break;case 7:case 33:if(!i&&7!==t||i&&7===t)break;u.spsArr?u.spsArr.push(r):u.spsArr=[r];var o=NALu.removeEPB(r);u.sps=i?HEVC.parseSPS(o):AVC.parseSPS(o);break;case 8:case 34:if(!i&&8!==t||i&&8===t)break;u.ppsArr?u.ppsArr.push(r):u.ppsArr=[r];break;case 1:case 0:u.frameType=n}})),_objectSpread2$2({codecId:n,codecType:i?VIDEO_CODEC_TYPE.HEVC:VIDEO_CODEC_TYPE.AVC,packetType:PACKET_TYPE.RAW},u)}}else console.warn("Unsupported codecId: ".concat(n))}}}]),e}(),FORMAT={FLV:"FLV",TS:"MPEG-TS",MP4:"MP4",RAW264:"RAW264",NOSUPPORT:"NOSUPPORT"};function tsProbe(e){for(var t=Math.min(1e3,e.byteLength-564),r=0;r<t;r++)if(71===e[r]&&71===e[r+188]&&71===e[r+376])return r;return-1}function getBoxType(e,t){var r;return _mapInstanceProperty(r=[e[t],e[t+1],e[t+2],e[t+3]]).call(r,(function(e){return String.fromCharCode(e)})).join("")}var __defProp$2=_Object$defineProperty,__defNormalProp$2=function(e,t,r){return t in e?__defProp$2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},__publicField$2=function(e,t,r){return __defNormalProp$2(e,"symbol"!==_typeof$1(t)?t+"":t,r),r},PacketHeaderView=_createClass$2((function e(t){var r=t.startIndictor,n=t.packetType,i=t.pid,o=t.afc;_classCallCheck$1(this,e),__publicField$2(this,"startIndictor",0),__publicField$2(this,"pid",0),__publicField$2(this,"afc",0),__publicField$2(this,"eleInfo",null),__publicField$2(this,"packetType",""),this.startIndictor=r,this.packetType=n,this.pid=i,this.afc=o})),TsPacketView=function(){function e(t){var r=t.header,n=t.headerObject,i=t.body,o=t.eleInfo,a=t.bodyView,s=t.headerView;_classCallCheck$1(this,e),__publicField$2(this,"header",null),__publicField$2(this,"headerView",null),__publicField$2(this,"body",null),__publicField$2(this,"bodyView",null),__publicField$2(this,"eleInfo",null),__publicField$2(this,"duration",0),this.header=r,this.headerView=s||new PacketHeaderView(n),this.eleInfo=o,this.body=i,this.bodyView=a}return _createClass$2(e,[{key:"type",get:function(){var e;return null==(e=this.headerView)?void 0:e.packetType}},{key:"streamType",get:function(){return this.eleInfo?this.eleInfo[this.headerView.pid]:""}},{key:"packetType",get:function(){var e;return null==(e=this.headerView)?void 0:e.packetType}},{key:"frameType",get:function(){var e;return null==(e=this.bodyView)?void 0:e.frameType}},{key:"pts",get:function(){var e;return null==(e=this.bodyView)?void 0:e.pts}},{key:"ptsTime",get:function(){return this.pts?timeFixed(this.pts/9e4):0}},{key:"dtsTime",get:function(){return this.dts?timeFixed(this.dts/9e4):0}},{key:"dts",get:function(){var e;return null==(e=this.bodyView)?void 0:e.dts}},{key:"keyframe",get:function(){return"I"===this.frameType}},{key:"nalTypes",get:function(){var e,t;return null==(t=null==(e=this.bodyView)?void 0:e.units)?void 0:_mapInstanceProperty(t).call(t,(function(e){return e.type}))}},{key:"nalSizes",get:function(){var e,t;return null==(t=null==(e=this.bodyView)?void 0:e.units)?void 0:_mapInstanceProperty(t).call(t,(function(e){return e.unit.length}))}},{key:"isSample",get:function(){return"PES"===this.packetType}},{key:"timescale",get:function(){return 9e4}},{key:"isHevc",get:function(){var e,t;return"bytevc1"===(null==(t=null==(e=this.eleInfo)?void 0:e.video)?void 0:t.codecType)}},{key:"sampleView",get:function(){var e;if("PES"===this.type)return{dts:this.dts,pts:this.pts,units:null==(e=this.bodyView)?void 0:e.units,data:this._getSampleData()}}},{key:"data",get:function(){return this._getSampleData()}},{key:"size",get:function(){var e,t;return null==(t=null==(e=this.sampleView)?void 0:e.data)?void 0:t.length}},{key:"isVideo",get:function(){return this.isSample&&"video"===this.streamType}},{key:"isAudio",get:function(){return this.isSample&&"audio"===this.streamType}},{key:"_getSampleData",value:function(){var e,t;if("audio"===this.streamType)return this.bodyView.data;var r=(null==(t=this.bodyView)?void 0:_filterInstanceProperty(e=t.units).call(e,(function(e){return!e.isSei&&!e.isDivision})))||[],n=_reduceInstanceProperty(r).call(r,(function(e,t){return e+(t.unit.byteLength+4)}),0),i=new Uint8Array(n),o=0;return r.forEach((function(e){i.set([0,0,0,1],o),o+=4,i.set(e.unit,o),o+=e.unit.byteLength})),i}}]),e}(),TsParser=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"parse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=tsProbe(e);if(-1===r)throw new Error("invalid ts file");var n=e.byteLength;n-=(n-r)%188;for(var i,o=[],a=[],s=[],l=0,c=r;c<n;){var u=e.subarray(c,c+188),p=u.subarray(0,4),f=this._parseTsHeader(u.subarray(0,4));c+=188;var d=void 0,h=void 0,y=4,g="";switch((null==f?void 0:f.afc)>1&&(y+=1+Math.min(u[y],183)),f.pid){case 0:y+=1+u[y],d=u.subarray(y),g="PAT",h={pmtId:l=this._parsePAT(d)};break;default:if(f.pid===l){y+=1+u[y],d=u.subarray(y),h=i=this._parsePMT(d),g="PMT";break}if(!i||!i[f.pid])continue;d=u.subarray(y),g="PES"}if(f.packetType=g,"PES"===g){var _="video"===i[f.pid]?a:s;f.startIndictor&&_.length&&(o.push(new TsPacketView(_objectSpread2$2(_objectSpread2$2({},this._concatPesChunk(_)),{},{eleInfo:i}))),_="video"===i[f.pid]?a=[]:s=[]),_.push({header:p,headerObject:f,body:d})}else o.push(new TsPacketView({header:p,headerObject:f,body:d,eleInfo:i,bodyView:h}))}a.length&&(o.push(new TsPacketView(_objectSpread2$2(_objectSpread2$2({},this._concatPesChunk(a)),{},{eleInfo:i}))),a=[]),s.length&&(o.push(new TsPacketView(_objectSpread2$2(_objectSpread2$2({},this._concatPesChunk(s)),{},{eleInfo:i}))),s=[]);var v=addRelativeTime({items:this._parsePES(o)},t);return v.rates=getRates(v),v}},{key:"getSnapshoot",value:function(e){var t,r,n,i=e.items,o=e.rates,a=_filterInstanceProperty(i).call(i,(function(e){return"video"===e.streamType})),s=_filterInstanceProperty(i).call(i,(function(e){return"audio"===e.streamType})),l=_findInstanceProperty(i).call(i,(function(e){return"PMT"===e.type})),c=a[0],u=s[0],p=a.length,f=this._getNbFrame(a,"I"),d=this._getNbFrame(a,"P"),h=this._getNbFrame(a,"B"),y={rates:o,video:c?_Object$assign({},null==c?void 0:c.bodyView,{codecType:c.eleInfo.video.codecType,frameLength:p,topThreeFrameSize:topThreeFrameSize(i),avgBits:avgBitrate(a),profile:getProfile(null==(t=null==c?void 0:c.bodyView)?void 0:t.sps),iFrames:f,pFrames:d,bFrames:h,iPercent:timeFixed(f/p*100),pPercent:timeFixed(d/p*100),bPercent:timeFixed(h/p*100),timescale:9e4},this._getDuration(a,"video")):null,audio:u?_Object$assign({},null==u?void 0:u.bodyView,{codecType:u.eleInfo.audio.codecType,frameLength:s.length,timescale:9e4,avgBits:avgBitrate(s)},this._getDuration(s,"audio")):null};return l&&(null==(r=l.bodyView)?void 0:r.noSupported)&&(y.noSupported=null==(n=l.bodyView)?void 0:n.noSupported),y}},{key:"getRates",value:function(e){return getRates(e)}},{key:"_getDuration",value:function(e,t){var r,n=e[0],i=e[e.length-1],o=0;return"audio"===t&&(o=1024/(null==(r=n.bodyView)?void 0:r.sampleRate)*1e3),"video"===t&&(o=n.duration),{duration:(i.pts-n.pts)/9e4,refDuration:o}}},{key:"_getNbKeyFrame",value:function(e){return _filterInstanceProperty(e).call(e,(function(e){var t;return null==(t=e.bodyView)?void 0:t.keyframe})).length}},{key:"_getNbFrame",value:function(e,t){return _filterInstanceProperty(e).call(e,(function(e){return e.frameType===t})).length}},{key:"_parseTsHeader",value:function(e){if(71===e[0]){var t={};return t.startIndictor=(64&e[1])>>6,t.pid=((31&e[1])<<8)+e[2],t.afc=(48&e[3])>>4,t}return null}},{key:"_parsePAT",value:function(e){return(31&e[10])<<8|e[11]}},{key:"_parsePMT",value:function(e){var t=0,r=3+((15&e[1])<<8|e[2])-4;e[3],e[4],t=t+11+((15&e[10])<<8|e[11])+1;for(var n,i={video:null,audio:null,noSupported:0};t<r;){n=e[t];var o=(31&e[t+1])<<8|e[t+2];switch(n){case 27:case 36:i.video={elePid:o,streamType:n,codecType:27===n?"avc":"bytevc1"},i[o]="video";break;case 15:i.audio={elePid:o,streamType:n,codecType:"aac"},i[o]="audio";break;default:i.noSupported=n,console.warn("unsupported streamType,",n)}t+=5+((15&e[t+3])<<8|e[t+4])}return i}},{key:"_concatPesChunk",value:function(e){var t=_reduceInstanceProperty(e).call(e,(function(e,t){return e+t.body.byteLength}),0),r=new Uint8Array(t),n=0;return e.forEach((function(e){var t=e.body;r.set(t,n),n+=t.byteLength})),_objectSpread2$2(_objectSpread2$2({},e[0]),{},{body:r,packetType:"PES"})}},{key:"_parsePES",value:function(e){var t=this,r=[];return e.forEach((function(e,n){if(e.isSample){var i=e,o=t._parsePESInternal(i.body)||{},a=o.data,s=o.pts,l=o.dts;if(a){if(e.isVideo&&(i.bodyView=t._parseVideoFrame(a,s,l,"bytevc1"===i.eleInfo.video.codecType),t._lastVideo&&(t._lastVideo.duration=1e3*(e.dtsTime-t._lastVideo.dtsTime)),t._lastVideo=i),e.isAudio){var c=AAC.parseADTS(a,s),u=c.frames;return delete c.frames,void(null==u||u.forEach((function(e){var n=new TsPacketView(_Object$assign({},i,{bodyView:_objectSpread2$2(_objectSpread2$2(_objectSpread2$2({},c),e),{},{frameType:"A"})}));r.push(n),t._lastAudio&&(t._lastAudio.duration=1e3*(n.dtsTime-t._lastAudio.dtsTime)),t._lastAudio=n})))}r.push(e)}}else r.push(e)})),r}},{key:"_parsePESInternal",value:function(e){var t=e[8];if(!(0===t||e.length<t+9)&&1===(e[0]<<16|e[1]<<8|e[2])){var r=(e[4]<<8)+e[5];if(!(r&&r>e.length-6)){var n,i,o=e[7];return 192&o&&(n=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&o?n-(i=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2)>54e5&&(n=i):i=n),i=i||n,{data:e.subarray(9+t),pts:n,dts:i}}}}},{key:"_parseVideoFrame",value:function(e,t,r,n){var i=NALu.parseAnnexB(e);if(i.length){var o={units:i=NALu.parseNaluType(i,n),pts:t,dts:r};return i.forEach((function(e){var t=e.unit,r=e.type,i=e.frameType;switch(r){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!n&&5!==r||n&&5===r)break;o.keyframe=!0,o.frameType="I";break;case 6:case 39:case 40:if(!n&&6!==r||n&&6===r)break;o.seis?o.seis.push(NALu.parseSEI(NALu.removeEPB(t))):o.seis=[NALu.parseSEI(NALu.removeEPB(t))];break;case 32:if(!n)break;o.vpsArr?o.vpsArr.push(t):o.vpsArr=[t];break;case 7:case 33:if(!n&&7!==r||n&&7===r)break;o.spsArr?o.spsArr.push(t):o.spsArr=[t];var a=NALu.removeEPB(t);o.sps=n?HEVC.parseSPS(a):AVC.parseSPS(a);break;case 8:case 34:if(!n&&8!==r||n&&8===r)break;o.ppsArr?o.ppsArr.push(t):o.ppsArr=[t];break;case 9:case 35:break;case 0:case 1:o.frameType=i}})),o}}}]),e}(),entryVirtual$1=entryVirtual$p,entries$6=entryVirtual$1("Array").entries,parent$q=entries$6,entries$5=parent$q,classof=classof$e,hasOwn$1=hasOwnProperty_1,isPrototypeOf$3=objectIsPrototypeOf,method$1=entries$5,ArrayPrototype=Array.prototype,DOMIterables={DOMTokenList:!0,NodeList:!0},entries$4=function(e){var t=e.entries;return e===ArrayPrototype||isPrototypeOf$3(ArrayPrototype,e)&&t===ArrayPrototype.entries||hasOwn$1(DOMIterables,classof(e))?method$1:t},parent$p=entries$4,entries$3=parent$p,parent$o=entries$3,entries$2=parent$o,entries$1=entries$2,entries3=entries$1,_entriesInstanceProperty=getDefaultExportFromCjs(entries3),ByteReader=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;_classCallCheck$1(this,e),this._offset=r,this._buffer=t,this._length=t.byteLength}return _createClass$2(e,[{key:"offset",get:function(){return this._offset},set:function(e){this._offset=e}},{key:"forward",value:function(e){this._offset+=e}},{key:"subarray",value:function(e){return e?this._buffer.subarray(this._offset,this._offset+e):this._buffer.subarray(this._offset,e)}},{key:"slice",value:function(e){for(var t=this._offset,r=this._buffer,n=[],i=0;i<e;i++)n.push(r[t+i]);return new Uint8Array(n)}},{key:"readU8",value:function(){return this._buffer[this._offset]}},{key:"readU16",value:function(){var e=this._offset,t=this._buffer;return t[e]<<8|t[e+1]}},{key:"readU24",value:function(){var e=this._offset,t=this._buffer;return t[e]<<16|t[e+1]<<8|t[e+12]}},{key:"readU32",value:function(){var e=this._offset,t=this._buffer;return t[e]*(1<<24)+65536*t[e+1]+256*t[e+2]+t[e+3]}},{key:"read32",value:function(){var e=this._offset,t=this._buffer;return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}}]),e}(),__defProp$1=_Object$defineProperty,__defNormalProp$1=function(e,t,r){return t in e?__defProp$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},__publicField$1=function(e,t,r){return __defNormalProp$1(e,"symbol"!==_typeof$1(t)?t+"":t,r),r},Mp4View=function(){function e(t,r,n,i,o,a,s,l,c,u){_classCallCheck$1(this,e),__publicField$1(this,"dts",0),__publicField$1(this,"pts",0),__publicField$1(this,"units",null),__publicField$1(this,"timescale",0),__publicField$1(this,"offset",0),__publicField$1(this,"duration",0),__publicField$1(this,"data",null),__publicField$1(this,"size",0),__publicField$1(this,"streamType",""),__publicField$1(this,"_frameType",""),__publicField$1(this,"isHevc",!1),this.dts=t,this.pts=r,this.units=n,this.timescale=i,this.offset=o,this.data=a,this.size=s,this.duration=l,this.streamType=c,this.isHevc=u}return _createClass$2(e,[{key:"isSample",get:function(){return!0}},{key:"dtsTime",get:function(){return this.dts/this.timescale}},{key:"ptsTime",get:function(){return this.pts/this.timescale}},{key:"frameType",get:function(){var e,t;return"audio"===this.streamType?"A":this._frameType||(null==(t=this.units)?void 0:_filterInstanceProperty(e=_mapInstanceProperty(t).call(t,(function(e){return e.frameType}))).call(e,Boolean)[0])},set:function(e){this._frameType=e}},{key:"nalTypes",get:function(){var e;return null==(e=this.units)?void 0:_mapInstanceProperty(e).call(e,(function(e){return e.type}))}},{key:"nalSizes",get:function(){var e;return null==(e=this.units)?void 0:_mapInstanceProperty(e).call(e,(function(e){return e.unit.length}))}},{key:"keyframe",get:function(){return"I"===this.frameType}},{key:"isVideo",get:function(){return"video"===this.streamType}},{key:"isAudio",get:function(){return"audio"===this.streamType}}]),e}(),BOX_TYPE_DESC={ftyp:"file type and compatibility",free:"free box",moov:"container for all metadata",mvhd:"movie header,overall declarations",trak:"container for an individual track or stream",tkhd:"track header,overall information about the track",tref:"track reference container",mdia:"container for the media information in a track",mdhd:"media header,oervall information about the media",hdlr:"declares the media type",minf:"media information container",vmhd:"video media header",smhd:"sound media header",dinf:"data information box",stbl:"sample table box",stsd:"sample descriptions(codec types, etc)",stts:"decoding time to sample",ctts:"compostion time to sample",cslg:"compostion to decode timeline mapping",stsc:"sample to chunk",stsz:"sample size",stco:"chunk offset",stss:"sync sample table",sdtp:"independent abd disposable samples",sbgp:"sample to group",mvex:"movid extends box",moof:"movie fragment",mfhd:"movie fragment header",traf:"track fragment",tfhd:"track fragment header",trun:"track fragment run",tfdt:"track fragment decode time",mdat:"media data",meta:"metadata",avc1:"h264 codec info box",hev1:"hevc codec info box"};function parseSampleFlag(e,t){return{isLeading:(12&e[t])>>2,dependsOn:3&e[t],isDenpendedOn:(192&e[t+1])>>6,hasRedundancy:(48&e[t+1])>>4,padding:(14&e[t+1])>>1,nonSync:1&e[t+1],degradationPriority:e[t+2]<<8|e[t+3]}}function parseTfFlags(e){var t=_slicedToArray(e,3),r=t[1],n=t[2];return{dataOffsetPresent:!!(1&n),firstSampleFlagsPresent:!!(4&n),sampleDurationPresent:!!(1&r),sampleSizePresent:!!((2&r)>>1),sampleFlagsPresent:!!((4&r)>>2),sampleCompositionTimeOffsetPresent:!!((8&r)>>3)}}function _getBoxType(e,t){var r;return _mapInstanceProperty(r=[e[t],e[t+1],e[t+2],e[t+3]]).call(r,(function(e){return String.fromCharCode(e)})).join("")}function splitBox(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],n=0;n<e.byteLength;){var i,o=e[n]*(1<<24)+65536*e[n+1]+256*e[n+2]+e[n+3];if(1===o){var a=_getBoxType(e,n+4);if("mdat"===a){var s,l=new DataView(e.buffer),c=l.getUint32(n+8)*Math.pow(2,32)+l.getUint32(n+12);console.log(_concatInstanceProperty(s="".concat(a,": largesize=")).call(s,c)),o=c}}if(o){var u=e.subarray(n,n+o),p=_getBoxType(u,4);r.push({size:o,length:u.byteLength,start:n+t,type:p,sizetypeRepresent:_sliceInstanceProperty(i=u.subarray(0,8)).call(i),body:u.subarray(8),typeDes:BOX_TYPE_DESC[p]||""}),n+=o}else n+=4}return r}function findBox(e,t,r){if(e)for(var n=0;n<e.length;n++){var i=e[n];if(i.type===t){if(!r)return i;if(r(i))return i}if(i.bodyView instanceof Array){var o=findBox(i.bodyView,t,r);if(o){if(!r)return o;if(r(o))return o}}}}function _getTrack(e,t){return findBox(e,"trak",(function(e){var r=findBox(e.bodyView,"hdlr");return r&&r.bodyView.handlerType===t}))}function extractMp4Samples(e,t,r){var n,i,o,a,s,l,c,u,p,f,d,h,y,g,_,v,m,$,b,S=_getTrack(e,t);if(!S)return null;var E=findBox(S.bodyView,"stbl"),P=findBox(S.bodyView,"mdhd")||{},T=(null==(u=null==(c=_filterInstanceProperty(n=E.bodyView).call(n,(function(e){return"stts"===e.type}))[0])?void 0:c.bodyView)?void 0:_entriesInstanceProperty(u))||[];null==(f=null==(p=_filterInstanceProperty(i=E.bodyView).call(i,(function(e){return"stss"===e.type}))[0])?void 0:p.bodyView)||_entriesInstanceProperty(f);var I=(null==(h=null==(d=_filterInstanceProperty(o=E.bodyView).call(o,(function(e){return"ctts"===e.type}))[0])?void 0:d.bodyView)?void 0:_entriesInstanceProperty(h))||[],O=(null==(g=null==(y=_filterInstanceProperty(a=E.bodyView).call(a,(function(e){return"stsc"===e.type}))[0])?void 0:y.bodyView)?void 0:_entriesInstanceProperty(g))||[],C=(null==(v=null==(_=_filterInstanceProperty(s=E.bodyView).call(s,(function(e){return"stsz"===e.type}))[0])?void 0:_.bodyView)?void 0:_entriesInstanceProperty(v))||[],w=(null==($=null==(m=_filterInstanceProperty(l=E.bodyView).call(l,(function(e){return"stco"===e.type}))[0])?void 0:m.bodyView)?void 0:_entriesInstanceProperty($))||[],A=!!findBox(E.bodyView,"hvcC"),R="vide"===t;if(!O.length||!w.length||!C.length)return[];for(var k,D=P.bodyView,x=D.timescale,N=void 0===x?1:x,L=D.duration,M=C.length,F=w.length,j=1,U=0,B=[],V=_assemblyTimestamp(M,T,I);j<=F;){var G=O[U];(null==G?void 0:G.firstChunk)!==j?(B.push(_Object$assign({},k,{firstChunk:j,offset:w[j-1]})),j++):(B.push(_objectSpread2$2(_objectSpread2$2({},G),{},{offset:w[j-1]})),k=G,j++,U++)}var H=_mapInstanceProperty(C).call(C,(function(e,t){var n=B[0],i=n.offset;n.offset+=e,n.samplesPreChunk--,n.samplesPreChunk||B.shift();var o=V[t],a=r.subarray(i,i+e);if(R){var s=NALu.parseNalu(a);return new Mp4View(o.dts,o.pts,NALu.parseNaluType(s,A),N,i,a,e,0,"video",A)}return new Mp4View(o.dts,o.pts,null,N,i,a,e,0,"audio")}));_reduceInstanceProperty(H).call(H,(function(e,t){return e?(e.duration=(t.dts-e.dts)/N*1e3,t):t}),null);var K=null==(b=findBox(null==S?void 0:S.bodyView,"vide"===t?A?"hvcC":"avcC":"mp4a"))?void 0:b.bodyView;return _objectSpread2$2(_objectSpread2$2(_objectSpread2$2({samples:H,iFrames:_filterInstanceProperty(H).call(H,(function(e){return"I"===e.frameType})).length,pFrames:_filterInstanceProperty(H).call(H,(function(e){return"P"===e.frameType})).length,bFrames:_filterInstanceProperty(H).call(H,(function(e){return"B"===e.frameType})).length},P.bodyView),{},{frameLength:M,duration:L/N,timescale:N},K),null==K?void 0:K.ests)}function _assemblyTimestamp(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=0,i=0,o=0,a=0,s=0,l=[];for(t=_mapInstanceProperty(t).call(t,(function(e){return _objectSpread2$2({},e)})),r=_mapInstanceProperty(r).call(r,(function(e){return _objectSpread2$2({},e)}));o<e;){var c=t[n],u=r[i];c.sampleCount&&(a+=c.sampleDelta),c.sampleCount--,c.sampleCount||n++,u&&(s=u.sampleOffset,u.sampleCount--,u.sampleCount||i++),l.push({dts:a,pts:a+s}),o++}return l}function _getTrackInfo(e){var t,r,n,i,o=_getTrack(e,"vide"),a=_getTrack(e,"soun"),s=findBox(null==o?void 0:o.bodyView,"tkhd"),l=findBox(null==a?void 0:a.bodyView,"tkhd"),c=findBox(null==o?void 0:o.bodyView,"mdhd"),u=findBox(null==a?void 0:a.bodyView,"mdhd"),p=findBox(null==o?void 0:o.bodyView,"avcC")||findBox(null==o?void 0:o.bodyView,"hvcC"),f=findBox(null==a?void 0:a.bodyView,"mp4a"),d=a?_objectSpread2$2(_objectSpread2$2(_objectSpread2$2({type:"audio",trackId:null==(r=l.bodyView)?void 0:r.trackId},u.bodyView),null==f?void 0:f.bodyView),null==(n=null==f?void 0:f.bodyView)?void 0:n.ests):null,h=o?_objectSpread2$2(_objectSpread2$2({type:"video",trackId:null==(i=s.bodyView)?void 0:i.trackId},null==c?void 0:c.bodyView),null==p?void 0:p.bodyView):null;return _defineProperty$2(t={},(null==d?void 0:d.trackId)||0,d),_defineProperty$2(t,(null==h?void 0:h.trackId)||0,h),t}function extractFmp4Samples(e,t){var r=_getTrackInfo(e),n=_findIndexInstanceProperty(e).call(e,(function(e){return"moof"===e.type}));if(-1===n)return!1;r.lastVdts=-1,r.lastAdts=-1;for(var i=n;i<e.length&&"moof"===e[i].type;i+=2){var o=e[i];e[i+1].bodyView=_moofMdatPair(o,t,r)}return!0}function _moofMdatPair(e,t,r){var n,i,o=_filterInstanceProperty(n=e.bodyView).call(n,(function(e){return"traf"===e.type})),a=_filterInstanceProperty(i=_mapInstanceProperty(o).call(o,(function(e){var t=findBox(e.bodyView,"tfhd"),n=findBox(e.bodyView,"tfdt"),i=findBox(e.bodyView,"trun");if(t&&i){var o=t.bodyView.trackId;return _objectSpread2$2({trackId:o,baseDataOffset:t.bodyView.baseDataOffset,defaultSampleDuration:t.bodyView.defaultSampleDuration,defaultSampleSize:t.bodyView.defaultSampleSize,baseMediaDecodeTime:n.bodyView.baseMediaDecodeTime,dataOffset:i.bodyView.dataOffset,samples:i.bodyView.samples,sampleCount:i.bodyView.sampleCount},r[o])}}))).call(i,Boolean);return _mapInstanceProperty(a).call(a,(function(e){var r,n,i,o=e.baseDataOffset,a=e.defaultSampleDuration,s=void 0===a?0:a,l=e.defaultSampleSize,c=void 0===l?0:l,u=e.dataOffset,p=e.baseMediaDecodeTime,f=void 0===p?0:p,d=e.samples,h=e.sps,y=e.timescale,g=e.type,_=o+u,v=0;return e.samples=_mapInstanceProperty(d).call(d,(function(e){var r=t.subarray(_,_+e.size);v+=e.duration||s;var n=f+v;if("video"===g){var i="hev1.1.6.L93.B0"===(null==h?void 0:h.codec),o=NALu.parseNalu(r);return _+=e.size,new Mp4View(n,n+(e.ctOffset||0),NALu.parseNaluType(o,i),y,_,r,e.size||c,(e.duration||s)/y*1e3,"video",i)}return _+=e.size,new Mp4View(n,n+(e.ctOffset||0),null,y,_,r,e.size||c,(e.duration||s)/y*1e3,"audio")})),e.frameLength=e.samples.length,e.duration=v/y,e.iFrames=_filterInstanceProperty(r=e.samples).call(r,(function(e){return"I"===e.frameType})).length,e.pFrames=_filterInstanceProperty(n=e.samples).call(n,(function(e){return"P"===e.frameType})).length,e.bFrames=_filterInstanceProperty(i=e.samples).call(i,(function(e){return"B"===e.frameType})).length,e}))}function avc1(e){var t=e.body,r=e.start,n=new ByteReader(t);return 16,4,50,n.forward(78),splitBox(n.subarray(),r+78+8)}function avcC$1(e){var t=e.body,r={spsArr:[],ppsArr:[]},n=new ByteReader(t);r.configVersion=t[0],r.avcProfile=t[1],r.profileComptibility=t[2],r.avcLevel=t[3],n.forward(4),n.forward(1);var i=31&_sliceInstanceProperty(n).call(n,1);n.forward(1);for(var o=0;o<i;o++){var a=n.readU16();n.forward(2),r.spsArr.push(n.subarray(a)),n.forward(a)}var s=_sliceInstanceProperty(n).call(n,1);n.forward(1);for(var l=0;l<s;l++){var c=n.readU16();n.forward(2),r.ppsArr.push(n.subarray(c)),n.forward(c)}return r}function avcC(e){var t=e.body;if(!(t.length<23)){t[21];for(var r,n,i,o=[],a=[],s=[],l=23,c=t[22],u=0;u<c;u++){r=63&t[l],n=t[l+1]<<8|t[l+2],l+=3;for(var p=0;p<n;p++)if(i=t[l]<<8|t[l+1],l+=2,i){switch(r){case 32:s.push(t.subarray(l,l+i));break;case 33:o.push(t.subarray(l,l+i));break;case 34:a.push(t.subarray(l,l+i))}l+=i}}return{spsArr:o,ppsArr:a,vpsArr:s}}}function btrt(e){var t=e.body,r=new ByteReader(t),n=r.readU32();r.forward(4);var i=r.readU32();return r.forward(4),{bufferSizeDB:n,maxBitrate:i,avgBitrate:r.readU32()}}function cslg(e){var t,r,n,i,o=e.body,a=new ByteReader(o);return a.forward(4),t=a.read32(),a.forward(4),r=a.read32(),a.forward(4),n=a.read32(),a.forward(4),i=a.read32(),a.forward(4),{compositionToDTSShift:t,leastDecodeToDisplayDelta:r,greatestDecodeToDisplayDelta:n,compositionStartTime:i,compositionEndTime:a.read32()}}function ftyp(e){var t=e.body,r=e.length,n=new ByteReader(t),i={compatible:[]};i.major=getBoxType(t,0),n.forward(4),i.version=n.readU32(),n.forward(4);for(var o=n.offset;o<r-8;)i.compatible.push(getBoxType(t,o)),o+=4;return i}function hdlr(e){return{handlerType:getBoxType(e.body,8)}}var MAX_UINT32_COUNT$2=Math.pow(2,32);function mdhd(e){var t=e.body,r={},n=new ByteReader(t),i=t[0];return n.forward(4),1===i?(n.forward(16),r.timescale=n.readU32(),n.forward(4),r.duration=n.readU32()*MAX_UINT32_COUNT$2,n.forward(4),r.duration+=n.readU32()):(n.forward(8),r.timescale=n.readU32(),n.forward(4),r.duration=n.readU32()),r}function mehd(e){var t,r=e.body,n=new ByteReader(r);if(n.forward(4),1===r[0]){var i=n.readU32();n.forward(4),t=i*(1<<30)*2+n.readU32()}else t=n.readU32();return{fragDuration:t}}function mfhd(e){var t=e.body,r=new ByteReader(t);return r.forward(4),{seqNumber:r.readU32()}}var anObject=anObject$h,regexpFlags=function(){var e=anObject(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},call=functionCall,hasOwn2=hasOwnProperty_1,isPrototypeOf$2=objectIsPrototypeOf,regExpFlags=regexpFlags,RegExpPrototype$1=RegExp.prototype,regexpGetFlags=function(e){var t=e.flags;return void 0!==t||"flags"in RegExpPrototype$1||hasOwn2(e,"flags")||!isPrototypeOf$2(RegExpPrototype$1,e)?t:call(regExpFlags,e)},getRegExpFlags=regexpGetFlags,flags$6=getRegExpFlags,isPrototypeOf$1=objectIsPrototypeOf,flags$5=flags$6,RegExpPrototype=RegExp.prototype,flags_1=function(e){return e===RegExpPrototype||isPrototypeOf$1(RegExpPrototype,e)?flags$5(e):e.flags},parent$n=flags_1,flags$4=parent$n,parent$m=flags$4,flags$3=parent$m,parent$l=flags$3,flags$2=parent$l,flags$1=flags$2,flags=flags$1,_flagsInstanceProperty=getDefaultExportFromCjs(flags),MPEG4DescriptorParser=function(){var e=[];e[3]="ES_Descriptor",e[4]="DecoderConfigDescriptor",e[5]="DecoderSpecificInfo",e[6]="SLConfigDescriptor",this.getDescriptorName=function(t){return e[t]};var t=this,r={};return this.parseOneDescriptor=function(t){var n,i,o=0,a=t.readU8();for(t.forward(1),i=t.readU8(),t.forward(1);128&i;)o=(127&i)<<7,i=t.readU8(),t.forward(1);return o+=127&i,(n=e[a]?new r[e[a]](o):new r.Descriptor(o)).parse(t),n},r.Descriptor=function(e,t){this.tag=e,this.size=t,this.descs=[]},r.Descriptor.prototype.parse=function(e){this.data=_sliceInstanceProperty(e).call(e,this.size),e.forward(this.size)},r.Descriptor.prototype.findDescriptor=function(e){for(var t=0;t<this.descs.length;t++)if(this.descs[t].tag===e)return this.descs[t];return null},r.Descriptor.prototype.parseRemainingDescriptors=function(e){for(var r=e.offset;e.offset<r+this.size;){var n=t.parseOneDescriptor(e);this.descs.push(n)}},r.ES_Descriptor=function(e){r.Descriptor.call(this,3,e)},r.ES_Descriptor.prototype=new r.Descriptor,r.ES_Descriptor.prototype.parse=function(e){if(this.ES_ID=e.readU16(),e.forward(2),this.flags=e.readU8(),e.forward(1),this.size-=3,128&_flagsInstanceProperty(this)?(this.dependsOn_ES_ID=e.readU16(),e.forward(2),this.size-=2):this.dependsOn_ES_ID=0,64&_flagsInstanceProperty(this)){var t,r=e.readU8();e.forward(1),this.URL=_mapInstanceProperty(t=_Array$from(_sliceInstanceProperty(e).call(e,r))).call(t,(function(e){return String.fromCharCode(e)})),e.forward(r),this.size-=r+1}else this.URL="";32&_flagsInstanceProperty(this)?(this.OCR_ES_ID=e.readU16(),e.forward(2),this.size-=2):this.OCR_ES_ID=0,this.parseRemainingDescriptors(e)},r.ES_Descriptor.prototype.getOTI=function(e){var t=this.findDescriptor(4);return t?t.oti:0},r.ES_Descriptor.prototype.getAudioConfig=function(e){var t=this.findDescriptor(4);if(!t)return null;var r=t.findDescriptor(5);if(r&&r.data){var n=(248&r.data[0])>>3;return 31===n&&r.data.length>=2&&(n=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),n}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readU8(),e.forward(1),this.streamType=e.readU8(),e.forward(1),this.bufferSize=e.readU24(),e.forward(3),this.maxBitrate=e.readU32(),e.forward(4),this.avgBitrate=e.readU32(),e.forward(4),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};function _adapterEstsInfo(e){var t,r,n,i=_findInstanceProperty(t=e.descs).call(t,(function(e){return 4===e.tag}));i&&(r=_findInstanceProperty(n=i.descs).call(n,(function(e){return 5===e.tag})));var o=_Object$assign({},i);return delete o.descs,o.config=(null==r?void 0:r.data.length)?_Array$from(null==r?void 0:r.data):[],o}function mp4a(e){var t=e.body,r=_sliceInstanceProperty(t).call(t,28),n=(new MPEG4DescriptorParser).parseOneDescriptor(new ByteReader(_sliceInstanceProperty(r).call(r,12),0)),i=(null==n?void 0:n.getAudioConfig)&&n.getAudioConfig();return{channelCount:t[17],samplesize:t[19],sampleRate:t[24]<<8|t[25],objectType:i,codec:"mp4a.40."+i,ests:_adapterEstsInfo(n)}}function mvhd(e){var t=e.body,r=new ByteReader(t),n={};return r.forward(4),n.createTime=r.readU32(),r.forward(4),n.modifyTime=r.readU32(),r.forward(4),n.timescale=r.readU32(),r.forward(4),n.duration=r.readU32(),r.forward(4),n.rate=r.readU32(),r.forward(4),r.forward(2),r.forward(70),n.nextTrackId=r.readU32(),n}function _bytesToHex(e){return _mapInstanceProperty(e).call(e,(function(e){return e.toString(16)})).join("")}function _bytesToStr(e){return _mapInstanceProperty(e).call(e,(function(e){return String.fromCharCode(e)})).join("")}function pssh(e){var t=e.body,r={},n=t[0],i=new ByteReader(t);if(i.forward(4),r.systemId=_bytesToHex(_sliceInstanceProperty(i).call(i,16)),i.forward(16),n>0){var o=i.readU32();r.kids=[];var a=0;for(i.forward(4);a<o;)r.kids.push(_bytesToHex(_sliceInstanceProperty(i).call(i,16))),i.forward(16),a++}var s=i.readU32();return i.forward(4),r.dataSize=s,r.data=_sliceInstanceProperty(i).call(i,s),r.dataToBase64=btoa(_bytesToStr(r.data)),r}function sdtp(e,t){var r=e.body,n=new ByteReader(r);n.forward(4);for(var i,o,a,s,l=[],c=0;c<t;c++){var u=n.readU8();i=(192&u)>>6,o=(48&u)>>4,a=(12&u)>>2,s=3&u,l.push({isLeading:i,dependsOn:o,isDenpendedOn:a,hasRedundancy:s}),n.forward(1)}return{entries:l}}function stco(e){var t=e.body,r=new ByteReader(t);r.forward(4);var n=r.readU32(),i=[];r.forward(4);for(var o=0;o<n;o++){var a=r.readU32();i.push(a),r.forward(4)}return{entries:i,count:i.length}}function stsc(e){var t=e.body,r=new ByteReader(t);r.forward(4);var n=[],i=r.readU32();r.forward(4);for(var o=0;o<i;o++){var a=r.readU32();r.forward(4);var s=r.readU32();r.forward(4);var l=r.readU32();r.forward(4),n.push({firstChunk:a,samplesPreChunk:s,sampleDesIndex:l})}return{entries:n,count:n.length}}function ctts(e){var t=e.body,r=new ByteReader(t);r.forward(4);var n=r.readU32(),i=[];r.forward(4);for(var o=0;o<n;o++){var a=r.readU32();r.forward(4);var s=r.readU32();r.forward(4),i.push({sampleCount:a,sampleOffset:s})}return{entries:i,count:i.length}}function stss(e){var t=e.body,r=new ByteReader(t);r.forward(4);var n=[],i=r.readU32();r.forward(4);for(var o=0;o<i;o++){var a=r.readU32();n.push(a),r.forward(4)}return{entries:n,count:n.length}}function stsz(e){var t=e.body,r=new ByteReader(t);r.forward(4);var n=[],i=r.readU32();r.forward(4);var o=r.readU32();if(r.forward(4),0===i)for(var a=0;a<o;a++){var s=r.readU32();n.push(s),r.forward(4)}else console.warn("parse stsz, sample size not equal 0");return{entries:n,count:n.length}}function stts(e){var t=e.body,r=new ByteReader(t);r.forward(4);var n=r.readU32(),i=[];r.forward(4);for(var o=0;o<n;o++){var a=r.readU32();r.forward(4);var s=r.readU32();r.forward(4),i.push({sampleCount:a,sampleDelta:s})}return{entries:i,count:i.length}}var MAX_UINT32_COUNT$1=Math.pow(2,32);function tfdt(e){var t=e.body,r=new ByteReader(t),n=0;return r.forward(4),1===t[0]?(n=r.readU32()*MAX_UINT32_COUNT$1,r.forward(4),n+=r.readU32()):n=r.readU32(),{baseMediaDecodeTime:n}}function tfhd(e){var t=e.body,r=new ByteReader(t);r.forward(1);var n=_sliceInstanceProperty(r).call(r,3),i=n[0]<<16|n[1]<<8|n[2],o={flags:n},a={baseDataOffsetPresent:!!(1&i),sampleDescriptionIndexPresent:!!(2&i),defaultSampleDurationPresent:!!(8&i),defaultSampleSizePresent:!!(16&i),defaultSampleFlagsPresent:!!(32&i),durationIsEmpty:!!(65536&i),defaultBaseIsMoof:!!(131072&i)};if(o.tfFlags=a,r.forward(3),o.trackId=r.readU32(),a.baseDataOffsetPresent){r.forward(4);var s=r.readU32();r.forward(4);var l=r.readU32();o.baseDataOffset=s<<32|l}else o.baseDataOffset=0,console.warn("base data offset not detected in tfhd");return a.sampleDescriptionIndexPresent&&(r.forward(4),o.sampleDescriptionIndex=r.readU32()),a.defaultSampleDurationPresent&&(r.forward(4),o.defaultSampleDuration=r.readU32()),a.defaultSampleSizePresent&&(r.forward(4),o.defaultSampleSize=r.readU32()),a.defaultSampleFlagsPresent&&(r.forward(4),o.defaultSampleFlags=r.readU32()),o}var MAX_UINT32_COUNT=Math.pow(2,32);function tkhd(e){var t=e.body,r=new ByteReader(t,4),n={},i=r.readU8();n.version=i,1===i?r.forward(16):r.forward(8),n.trackId=r.readU32(),r.forward(4),1===i?(n.duration=r.readU32()*MAX_UINT32_COUNT,r.forward(4),n.duration+=r.readU32()):n.duration=r.readU32();var o=t.byteLength;return o-=8,r.offset=o,n.width=r.readU32()>>16,r.forward(4),n.height=r.readU32()>>16,n}function trex(e){var t=e.body,r={},n=new ByteReader(t);return n.forward(4),r.trackId=n.readU32(),n.forward(4),r.defaultSdescriptionIndex=n.readU32(),n.forward(4),r.defaultSampleDuration=n.readU32(),n.forward(4),r.defaultSampleSize=n.readU32(),n.forward(4),r.defaultSampleFlags=parseSampleFlag(t,n.offset),r}function trun(e){var t=e.body,r={samples:[]},n=new ByteReader(t);r.version=n.readU8(),n.forward(1),r.flags=_sliceInstanceProperty(n).call(n,3);var i=parseTfFlags(_flagsInstanceProperty(r)),o=i.dataOffsetPresent,a=i.firstSampleFlagsPresent,s=i.sampleDurationPresent,l=i.sampleSizePresent,c=i.sampleFlagsPresent,u=i.sampleCompositionTimeOffsetPresent;r.trFlags=i,n.forward(3),r.sampleCount=n.readU32(),n.forward(4),o&&(r.dataOffset=n.readU32(),n.forward(4)),a&&(r.firstSampleFlags=parseSampleFlag(t,n.offset),n.forward(4));for(var p=0;p<r.sampleCount;){var f={};s&&(f.duration=n.readU32(),n.forward(4)),l&&(f.size=n.readU32(),n.forward(4)),c&&(f.flags=parseSampleFlag(t,n.offset),n.forward(4)),u&&(f.ctOffset=n.readU32(),n.forward(4)),r.samples.push(f),p++}return r}function stsd(e){var t=e.body,r=e.start,n=new ByteReader(t);n.forward(4);var i=n.readU32();return n.forward(4),{entryCount:i,childData:splitBox(n.subarray(),r+8+8)}}function mp4Parser(e){var t=splitBox(e instanceof ArrayBuffer?new Uint8Array(e):e,0);if(_parseChildrenRecursion(t),!extractFmp4Samples(t,e)){var r,n=findBox(t,"mdat");if(n)n.bodyView=_filterInstanceProperty(r=[_objectSpread2$2({type:"video"},extractMp4Samples(t,"vide",e)),_objectSpread2$2({type:"audio"},extractMp4Samples(t,"soun",e))]).call(r,(function(e){return!!e.samples}))}return t}function _parseChildrenRecursion(e){var t=0;e.forEach((function(e){switch(e.type){case"ftyp":case"styp":e.bodyView=ftyp(e);break;case"moov":case"trak":case"mvex":case"mdia":case"minf":case"dinf":case"moof":case"traf":case"stbl":e.bodyView=splitBox(e.body,e.start+8),_parseChildrenRecursion(e.bodyView);break;case"stsd":var r=stsd(e),n=r.entryCount,i=r.childData;e.entryCount=n,e.bodyView=i,_parseChildrenRecursion(e.bodyView);break;case"mvhd":e.bodyView=mvhd(e);break;case"tkhd":e.bodyView=tkhd(e);break;case"mehd":e.bodyView=mehd(e);break;case"mdhd":e.bodyView=mdhd(e);break;case"hdlr":e.bodyView=hdlr(e);break;case"trex":e.bodyView=trex(e);break;case"trun":e.bodyView=trun(e),t=e.bodyView.samples.length;break;case"tfdt":e.bodyView=tfdt(e);break;case"avc1":case"hvc1":case"hev1":e.bodyView=avc1(e),_parseChildrenRecursion(e.bodyView);break;case"mp4a":e.bodyView=mp4a(e),e.bodyView&&(e.bodyView.codecType="aac");break;case"avcC":e.bodyView=avcC$1(e);var o=e.bodyView;if(o.codecType="avc",!(null==o?void 0:o.sps)){var a=o.spsArr[0],s=NALu.removeEPB(a);o.sps=AVC.parseSPS(s)}break;case"hvcC":e.bodyView=avcC(e);var l=e.bodyView;if(l.codecType="bytevc1",!(null==l?void 0:l.sps)){var c=l.spsArr[0],u=NALu.removeEPB(c);l.sps=HEVC.parseSPS(u)}break;case"btrt":e.bodyView=btrt(e);break;case"stts":e.bodyView=stts(e),_entriesInstanceProperty(e.bodyView).length&&(t=_entriesInstanceProperty(e.bodyView)[0].sampleCount);break;case"ctts":e.bodyView=ctts(e);break;case"cslg":e.bodyView=cslg(e);break;case"stss":e.bodyView=stss(e);break;case"stsz":e.bodyView=stsz(e);break;case"stsc":e.bodyView=stsc(e);break;case"stco":e.bodyView=stco(e);break;case"sdtp":e.bodyView=sdtp(e,t);break;case"mfhd":e.bodyView=mfhd(e);break;case"tfhd":e.bodyView=tfhd(e);break;case"pssh":e.bodyView=pssh(e)}}))}function getSnapshoot(e){var t,r,n,i,o,a,s=_filterInstanceProperty(e).call(e,(function(e){return"mdat"===e.type}));if(!s.length){var l=_getTrack(e,"vide"),c=_getTrack(e,"soun"),u=null==(r=findBox(null==l?void 0:l.bodyView,"mdhd"))?void 0:r.bodyView,p=(null==(n=findBox(null==l?void 0:l.bodyView,"avcC"))?void 0:n.bodyView)||(null==(i=findBox(null==l?void 0:l.bodyView,"hvcC"))?void 0:i.bodyView),f=null==(o=findBox(null==c?void 0:c.bodyView,"mdhd"))?void 0:o.bodyView,d=null==(a=findBox(null==c?void 0:c.bodyView,"mp4a"))?void 0:a.bodyView;try{return{video:_objectSpread2$2(_objectSpread2$2({},u),{},{duration:(null==u?void 0:u.duration)/u.timescale},p),audio:_objectSpread2$2(_objectSpread2$2(_objectSpread2$2({},f),{},{duration:(null==f?void 0:f.duration)/f.timescale},d),d.ests)}}catch(e){}return{}}var h=_reduceInstanceProperty(t=_mapInstanceProperty(s).call(s,(function(e){return e.bodyView}))).call(t,(function(e,t){return e=_concatInstanceProperty(e).call(e,t)}),[]),y=_reduceInstanceProperty(h).call(h,(function(e,t){var r,n=t.type,i=t.frameLength,o=t.iFrames,a=t.pFrames,s=t.bFrames,l=t.duration;return e[n]?(e[n].frameLength+=i,e[n].iFrames+=o,e[n].pFrames+=a,e[n].bFrames+=s,e[n].duration+=l,e):(e[n]=_Object$assign({},t),e[n].refDuration||(e[n].refDuration=null==(r=t.samples[0])?void 0:r.duration),e)}),{}),g=y.video;if(g){var _=g.frameLength,v=g.iFrames,m=g.pFrames,$=g.bFrames;g.iPercent=timeFixed(v/_*100),g.pPercent=timeFixed(m/_*100),g.bPercent=timeFixed($/_*100)}return y}var Mp4Parser=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"parse",value:function(e){return mp4Parser(e)}},{key:"parseV2",value:function(e,t){var r,n,i,o,a,s,l=_filterInstanceProperty(e).call(e,(function(e){return"mdat"===e.type})),c=[],u=null==(n=null==(r=l[0])?void 0:r.bodyView)?void 0:_filterInstanceProperty(n).call(n,(function(e){return"video"===e.type}))[0],p=null==(o=null==(i=l[0])?void 0:i.bodyView)?void 0:_filterInstanceProperty(o).call(o,(function(e){return"audio"===e.type}))[0],f=Math.min((null==(a=null==p?void 0:p.samples[0])?void 0:a.dtsTime)||0,(null==(s=null==u?void 0:u.samples[0])?void 0:s.dtsTime)||0);l.forEach((function(e){e.bodyView.forEach((function(e){e.samples.forEach((function(e){e.time=timeFixed(e.dtsTime-f),c.push(e)}))}))}));var d={items:_sortInstanceProperty(c).call(c,(function(e,t){return e.time>t.time?1:-1}))};return this._addMetadataToFirstKeyFrame(u),d.rates=getRates(d),d}},{key:"getSnapshoot",value:function(e){return getSnapshoot(e)}},{key:"_addMetadataToFirstKeyFrame",value:function(e){var t;if(e){var r=_filterInstanceProperty(t=e.samples).call(t,(function(e){return e.keyframe}))[0];r&&(r.sps=e.sps,r.vpsArr=e.vpsArr,r.spsArr=e.spsArr,r.ppsArr=e.ppsArr)}}}]),e}(),Config={maxFirstAVDtsGap:.2,minAudioFrameSize:40,maxAVDuationGap:.3,dtsBreakGap:.5,consecutiveFrameGap:.1},AVGapFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e){var t=null==e?void 0:_findInstanceProperty(e).call(e,(function(e){return e.isSample&&"video"===e.streamType})),r=null==e?void 0:_findInstanceProperty(e).call(e,(function(e){return e.isSample&&"audio"===e.streamType}));if(t&&r){var n,i,o,a=t.pts-r.pts,s=timeFixed(a/t.timescale);if(a/t.timescale>=Config.maxFirstAVDtsGap)return[{description:_concatInstanceProperty(n=_concatInstanceProperty(i=_concatInstanceProperty(o="【音视频首帧gap差距过大】视频首帧pts: ".concat(t.pts,", 音频首帧pts: ")).call(o,r.pts,", delta: ")).call(i,a,"(")).call(n,s,"s)"),tips:"".concat(s>10?"可能造成无法起播问题":"")}]}}}]),e}(),TimestampFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e){var t=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"video"===e.streamType})),r=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"audio"===e.streamType})),n=!!e[0]&&e[0]instanceof FlvTagView;return[this._checkBreak(t,"video"),this._checkBreak(r,"audio"),n&&this._checkConsecutiveFrameBreak(null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample})))]}},{key:"_checkBreak",value:function(e,t){var r=e.length;if(r)for(var n=0;n<r-1;n++){var i,o,a,s;if(Math.abs(e[n].dtsTime-e[n+1].dtsTime)>Config.dtsBreakGap)return{description:_concatInstanceProperty(i=_concatInstanceProperty(o=_concatInstanceProperty(a=_concatInstanceProperty(s="【".concat(t,"时间戳发生跳变】,当前帧dts: ")).call(s,e[n].dts,", time:")).call(a,e[n].time,", 后一帧dts: ")).call(o,e[n+1].dts,", time:")).call(i,e[n+1].time)}}}},{key:"_checkConsecutiveFrameBreak",value:function(e){var t=e.length;if(t)for(var r=0;r<t-1;r++)if(Math.abs(e[r].dtsTime-e[r+1].dtsTime)>Config.consecutiveFrameGap){var n,i,o,a,s,l=e[r],c=e[r+1];return{description:_concatInstanceProperty(n=_concatInstanceProperty(i=_concatInstanceProperty(o=_concatInstanceProperty(a=_concatInstanceProperty(s="【前后帧dts差距过大】,当前帧(".concat(l.streamType,")dts: ")).call(s,l.dts,", time:")).call(a,l.time,", 后一帧(")).call(o,c.streamType,")dts: ")).call(i,c.dts,", time:")).call(n,c.time),tips:"可能造成播放画面卡顿或者声音卡顿"}}}}]),e}(),SampleFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e){return[this._checkKeyFrame(e),this._checkAudioFrameDataFull(e)]}},{key:"_checkKeyFrame",value:function(e){var t=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"video"===e.streamType}))[0];if(t&&"I"!==t.frameType)return{description:"【视频首帧非关键帧】",tips:"可能播放花屏或者报解码错误"}}},{key:"_checkAudioFrameDataFull",value:function(e){var t=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"audio"===e.streamType})),r=t.length;if(r)for(var n=0;n<r;n++){var i,o=t[n].data;if((null==o?void 0:o.length)<Config.minAudioFrameSize)return{description:_concatInstanceProperty(i="【音频帧数据较少】 pts=".concat(t[n].pts,", time=")).call(i,t[n].time),tips:"可能由于音频数据原因导致解码报错"}}}}]),e}(),MetadataFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e,t){return[this._hasVideoMetadata(e),this._hasAudioMetadata(e),this._checkRepeatedSps(e),this._metadataOnlyInSequeceHeader(e,t)]}},{key:"_hasVideoMetadata",value:function(e){var t,r=null==(t=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return"video"===e.streamType}))[0])?void 0:t.bodyView;if(r&&!r.sps)return{description:"【未检测到视频metadata信息】",tips:"可能视频无法播放或者报解码错误"}}},{key:"_hasAudioMetadata",value:function(e){var t,r=null==(t=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return"audio"===e.streamType}))[0])?void 0:t.bodyView;if(r&&(!r.config||!r.sampleRate||!r.channelCount))return{description:"【未检测到音频metadata信息】",tips:"可能视频无法播放或者报解码错误"}}},{key:"_checkRepeatedSps",value:function(e){var t,r=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return"video"===e.streamType}))[0],n=(null==(t=null==r?void 0:r.bodyView)?void 0:t.spsArr)||[];if(r&&n.length>1&&n[0].join(",")!==n[1].join(","))return{description:"【关键帧前包含多个sps信息】"}}},{key:"_metadataOnlyInSequeceHeader",value:function(e,t){var r;if("FLV"===t){var n=null==e?void 0:_findInstanceProperty(e).call(e,(function(e){return e.keyframe}));if(n){var i=n.isHevc;return-1===_indexOfInstanceProperty(r=n.nalTypes).call(r,i?33:7)?{description:"【sps、pps信息只存在于Sequence Header中】"}:void 0}}}}]),e}(),HevcFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e){var t=null==e?void 0:_findInstanceProperty(e).call(e,(function(e){return e.isSample&&"video"===e.streamType}));if(t)return t.isHevc?[{id:1,description:"【H265编码格式】",tips:"对于不支持H265解码的设备无法播放"}]:void 0}}]),e}(),HasBFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e){if(null==e?void 0:_findInstanceProperty(e).call(e,(function(e){return e.isSample&&"B"===e.frameType})))return[{description:"【存在B帧】"}]}}]),e}(),DurationFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e){var t=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"video"===e.streamType})),r=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"audio"===e.streamType}));if(t.length&&r.length){var n,i,o=t[t.length-1].ptsTime-t[0].ptsTime,a=r[r.length-1].ptsTime-r[0].ptsTime;if(Math.abs(o-a)>=Config.maxAVDuationGap)return[{description:_concatInstanceProperty(n=_concatInstanceProperty(i="【音视频时长存在差距】, video=".concat(o,"s, audio=")).call(i,a,"s, delta=")).call(n,timeFixed(o-a),"s"),tips:"可能造成播放画面卡顿或者声音卡顿"}]}}}]),e}(),OnlyOneTrackFilter=function(){function e(){_classCallCheck$1(this,e)}return _createClass$2(e,[{key:"detect",value:function(e){var t=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"video"===e.streamType})),r=null==e?void 0:_filterInstanceProperty(e).call(e,(function(e){return e.isSample&&"audio"===e.streamType}));if(t.length||r.length)return t.length&&r.length?void 0:[{description:"【流开始只包含".concat(t.length?"音频":"视频","】"),tips:"可能播放没有声音或者没有画面"}]}}]),e}();function checkExceptions(e,t){var r,n,i;return _filterInstanceProperty(r=_reduceInstanceProperty(n=_mapInstanceProperty(i=[new HevcFilter,new AVGapFilter,new TimestampFilter,new SampleFilter,new MetadataFilter,new DurationFilter,new HasBFilter,new OnlyOneTrackFilter]).call(i,(function(r){return r.detect(e,t)}))).call(n,(function(e,t){return _concatInstanceProperty(e).call(e,t)}),[])).call(r,Boolean)}var __defProp=_Object$defineProperty,__defNormalProp7=function(e,t,r){return t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},__publicField7=function(e,t,r){return __defNormalProp7(e,"symbol"!==_typeof$1(t)?t+"":t,r),r},Net=function(){function e(t){var r=this;_classCallCheck$1(this,e),__publicField7(this,"_opts",null),__publicField7(this,"_controller",null),__publicField7(this,"_reader",null),__publicField7(this,"_loading",!1),__publicField7(this,"_chunks",[]),__publicField7(this,"_readStream",(function(e,t){var n=0;r._reader=e.getReader();var i=r._chunks;return function e(){var o;return null==(o=r._reader)?void 0:o.read().then((function(r){var o=r.value,a=r.done;return i.push(o),t(n,o),a?_Promise.resolve(concatBuffer(_filterInstanceProperty(i).call(i,Boolean))):(n+=o.byteLength,e())}))}()})),this._opts=t}return _createClass$2(e,[{key:"request",value:function(){var e=this,t=this._opts,r=t.url,n=t.onProgress,i=t.contentType,o=void 0===i?"ArrayBuffer":i,a=t.loadTimeout,s=void 0===a?5e3:a,l=t.headers;return this._controller=new AbortController,_Promise.race([fetch(r,{signal:this._controller.signal,headers:l}),new _Promise((function(t,r){setTimeout((function(){var t;e._loading||(r({code:0,message:"timeout"}),null==(t=e._controller)||t.abort())}),s)}))]).then((function(t){return t.ok&&t.status>=200&&t.status<300?(e._loading=!0,t):_Promise.reject({code:t.status,message:t.statusText})})).then((function(t){switch(o){case"TEXT":return t.text();case"JSON":return t.json();case"ArrayBuffer":return n?e._readStream(t.clone().body,n):t.arrayBuffer()}})).catch((function(t){if(e._loading=!1,"AbortError"!==t.name)return _Promise.reject({code:t.code||0,message:t.message})}))}},{key:"cancel",value:function(){var e,t;try{null==(e=this._reader)||e.cancel(),null==(t=this._controller)||t.abort(),this._reader=null,this._controller=null}catch(e){}}}]),e}(),Flv=function(){function e(){_classCallCheck$1(this,e)}var t;return _createClass$2(e,[{key:"parse",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i,o,a,s,l,c,u,p,f,d,h=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=[],this._loader=new Net(_objectSpread2$2(_objectSpread2$2({url:t},r),{},{onProgress:function(e,t){c.push(t),e>r.probeSize&&h._loader.cancel()}})),e.next=4,this._loader.request();case 4:return u=new Flv$1,p=u.parse(concatBuffer(c)),f=u.getSnapshoot(p),d=null==(n=f.video)?void 0:n.sps,e.abrupt("return",{codec:null==(i=f.video)?void 0:i.codecType,codecStr:null==d?void 0:d.codec,width:null==d?void 0:d.width,height:null==d?void 0:d.height,vDration:null==(o=null==f?void 0:f.video)?void 0:o.duration,aDuration:null==(a=null==f?void 0:f.audio)?void 0:a.duration,sampleRate:null==(s=null==f?void 0:f.audio)?void 0:s.sampleRate,channelCount:null==(l=null==f?void 0:f.audio)?void 0:l.channelCount,views:p,snap:f});case 9:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),e}(),vparser_min={exports:{}};vparser_min.exports=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){void 0!==_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$1(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=0)}([function(e,t,r){function n(e,t){var r=_Object$keys(e);if(_Object$getOwnPropertySymbols){var n=_Object$getOwnPropertySymbols(e);t&&(n=_filterInstanceProperty(n).call(n,(function(t){return _Object$getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){return(i="function"==typeof _Symbol&&"symbol"==_typeof$1(_Symbol$iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof _Symbol&&e.constructor===_Symbol&&e!==_Symbol.prototype?"symbol":_typeof$1(e)})(e)}function o(e,t,r){return t in e?_Object$defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.r(t),r.d(t,"m3u8Parser",(function(){return p})),r.d(t,"mpdParser",(function(){return g}));var a=/EXT(?:-X-)?([^:]+):?(.*)$/,s=/([^,="]+)((="[^"]+")|(=[^,]+))*/g;function l(e){var t;return _reduceInstanceProperty(t=e.split("-")).call(t,(function(e,t){return e+(e?t.charAt(0)+_sliceInstanceProperty(t).call(t,1).toLowerCase():t.toLowerCase())}),"")}function c(e){if(!/^#EXT/.test(e)&&/^\s*#/.test(e))return null;var t,r,c=a.exec(e);return c?(t=l(c[1]),r=function(e,t){if(!e)return null;var r=_mapInstanceProperty(t=e.match(s)).call(t,(function(e){return function(e){var t=_trimInstanceProperty(e).call(e).replace("=","|").split("|");if(2==t.length)return o({},l(t[0]),t[1].replace(/("|')/g,""));var r=_parseFloat$7(t[0]);return _Number$isNaN(r)?t[0]:r}(e)}));return 1===r.length?r[0]:0===_filterInstanceProperty(r).call(r,(function(e){return"object"===i(e)})).length?r:_reduceInstanceProperty(r).call(r,(function(e,t){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){o(e,t,r[t])})):_Object$getOwnPropertyDescriptors?_Object$defineProperties(e,_Object$getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){_Object$defineProperty(e,t,_Object$getOwnPropertyDescriptor(r,t))}))}return e}({},e,{},t)}),{})}(c[2])):(t="url",r=e),o({},t,r)}function u(e,t){if(/^https?/.test(e)||/^data:/.test(e)||/^sdk:/.test(e))return e;for(t=_sliceInstanceProperty(r=t.split("/")).call(r,0,-1),e=e.split("/");e.length;){var r,n=e.shift();-1==_indexOfInstanceProperty(t).call(t,n)&&t.push(n)}return t.join("/")}var p=function(e,t,r){var n,i,o;if(!e||!t)return{error:1,msg:"invalid input"};var a,s=_filterInstanceProperty(n=_mapInstanceProperty(i=_filterInstanceProperty(o=e.split("\n")).call(o,Boolean)).call(i,(function(e){return c(_trimInstanceProperty(e).call(e))}))).call(n,Boolean);if(!s.length)return{error:1,msg:"invalid m3u8"};a=0!==_filterInstanceProperty(s).call(s,(function(e){return!!e.streamInf})).length?{master:!0,m3u8Url:t,levels:[],medias:[]}:{master:!1,m3u8Url:t,duration:0,startSN:0,endSN:0,segments:[],live:!0};try{a=function(e,t,r){for(var n=t.master,i=e.length,o=0,a=0,s=0,l=0,c=0,p=-1,f=0;f<i;f++){var d=e[f];for(var h in d){var y=d[h];switch(y&&y.uri&&(y.url=u(y.uri,t.m3u8Url)),h){case"inf":var g={start:a,end:a+(Array.isArray(y)?y[0]:y),cc:o,sn:s+l};p>=0&&(g.keyIndex=p),l++,a=g.end,t.segments.push(g);break;case"start":a=y;break;case"discontinuity":o++;break;case"mediaSequence":s=y;break;case"streamInf":c++,y.levelId=c,t.levels.push(y);break;case"media":t.medias.push(y);break;case"endlist":t.live=!1;break;case"key":p++,t.key?t.key.push(y):t.key=[y];break;case"url":var _=n?t.levels:t.segments;if(!_.length)throw new Error("invalid m3u8");n?_[c-1].url=u(y,t.m3u8Url):_[l-1].url=u(y,t.m3u8Url);break;default:y&&(t[h]=y)}}r&&(t=r(d,t))}return n||(t.startSN=s,t.endSN=s+l-1,t.duration=a),t}(s,a,r)}catch(e){return{error:1,msg:e.message}}return a},f=/\s*(<\/?[^>]+>)/,d=/\s*(?:<\/?([^\s>]+))?\s*([^>]+)*(?:\/?>)?/,h=/\s*([^=]+)="([^"]+)"/g;function y(e,t){for(var r,n,i,o=[],a=e.length,s=0;s<a;s++)if((r=e[s]).closed)if(n=o.pop(),"pureValue"!==r.tagName){if(n&&n.tagName===r.tagName?i=o.pop():(i=n,n=r),!i){o.push(n);break}var l=n,c=l.tagName,u=l.attrs,p=i.attrs[c];t&&(u=t(c,u)),i.attrs[c]=p?Array.isArray(p)?_concatInstanceProperty(p).call(p,u):[p,u]:u,o.push(i)}else n.attrs?n.attrs.value=r.attrs.value:n.attrs=r.attrs,o.push(n);else o.push(r);var f,d,h,y=o[0];return y?"undefined"!=y.tagName?(f={},d=y.tagName,h=y.attrs,d in f?_Object$defineProperty(f,d,{value:h,enumerable:!0,configurable:!0,writable:!0}):f[d]=h,f):y.tagName:null}var g=function(e,t){if(!e)return{error:1,msg:"invalid input"};try{var r,n,i;return y(_filterInstanceProperty(r=_mapInstanceProperty(n=_filterInstanceProperty(i=e.split(f)).call(i,Boolean)).call(n,(function(e){return function(e){var t,r,n=e.match(d),i={},o=(t=n&&n[1])?_reduceInstanceProperty(r=t.split("_")).call(r,(function(e,t){return e?e+=t.charAt(0).toUpperCase()+_sliceInstanceProperty(t).call(t,1):e=t.charAt(0).toLowerCase()+_sliceInstanceProperty(t).call(t,1)}),""):"";if(n&&n[1]&&n[2]){for(var a,s={};null!=(a=h.exec(n[2]));)s[a[1]]=a[2];return"?xml"===o?null:(i.tagName=o,i.attrs=s,i.closed=/\/$/.test(n[2]),i)}return n?/^<\//.test(n[0])?(i.tagName=o,i.closed=!0,i):/^</.test(n[0])?(i.tagName=o,i.attrs={},i):(i.tagName="pureValue",i.attrs={value:n[2]},i.closed=!0,i):null}(e)}))).call(r,Boolean),t)}catch(e){return{error:1,msg:e.message}}}}]);var vparser_minExports=vparser_min.exports;function loadM3u8(e){return _loadM3u.apply(this,arguments)}function _loadM3u(){return _loadM3u=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new Net(_objectSpread2$2(_objectSpread2$2({url:t},o.length>1&&void 0!==o[1]?o[1]:{}),{},{contentType:"TEXT"})),e.next=4,r.request();case 4:return n=e.sent,i=vparser_minExports.m3u8Parser(n,t,(function(e,t){var r;if(!e.url||!/^\//.test(e.url))return t;var n=e.url,i=t.segments[t.segments.length-1];return i.url=_sliceInstanceProperty(r=i.url.split("/")).call(r,0,3).join("/")+n,t})),e.abrupt("return",i);case 7:case"end":return e.stop()}}),e)}))),_loadM3u.apply(this,arguments)}var Hls=function(){function e(){_classCallCheck$1(this,e)}var t;return _createClass$2(e,[{key:"parse",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i,o,a,s,l,c,u,p,f,d,h,y,g,_,v;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,loadM3u8(t,r);case 2:if(!(c=e.sent).master){e.next=7;break}return e.next=6,loadM3u8(c.levels[0].url);case 6:c=e.sent;case 7:if(null==c?void 0:c.segments.length){e.next=9;break}throw new Error("invalid m3u8");case 9:u=[],p=r.nbSegment,f=0,d=_regeneratorRuntime().mark((function e(){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new Net(_objectSpread2$2(_objectSpread2$2({url:c.segments[f].url},r),{},{onProgress:function(e,n){u.push(n),e>r.probeSize&&t.cancel()}})),e.next=3,t.request();case 3:p--,f++;case 5:case"end":return e.stop()}}),e)}));case 13:if(!p){e.next=17;break}return e.delegateYield(d(),"t0",15);case 15:e.next=13;break;case 17:return h=new Uint8Array(concatBuffer(_filterInstanceProperty(u).call(u,Boolean))),y=new TsParser,g=y.parse(h),_=y.getSnapshoot(g),v=null==(n=_.video)?void 0:n.sps,e.abrupt("return",{codec:null==(i=_.video)?void 0:i.codecType,codecStr:null==v?void 0:v.codec,width:null==v?void 0:v.width,height:null==v?void 0:v.height,vDration:null==(o=null==_?void 0:_.video)?void 0:o.duration,aDuration:null==(a=null==_?void 0:_.audio)?void 0:a.duration,sampleRate:null==(s=null==_?void 0:_.audio)?void 0:s.sampleRate,channelCount:null==(l=null==_?void 0:_.audio)?void 0:l.channelCount,views:g,snap:_});case 23:case"end":return e.stop()}}),e)}))),function(e,r){return t.apply(this,arguments)})}]),e}(),Mp4=function(){function e(){_classCallCheck$1(this,e)}var t;return _createClass$2(e,[{key:"parse",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i,o,a,s,l,c,u,p,f,d,h,y,g,_,v,m,$,b;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=new Net(_objectSpread2$2(_objectSpread2$2({url:t},r),{},{contentType:"ArrayBuffer",headers:{Range:"bytes=0-1499"}})),p=[],e.next=4,u.request();case 4:return f=e.sent,d=new Uint8Array(f),h=(new Mp4Parser).parse(d),y=_findInstanceProperty(h).call(h,(function(e){return"mdat"===e.type})),(g=_findInstanceProperty(h).call(h,(function(e){return"moov"===e.type})))?(p.push(g.start),p.push(g.start+g.size)):y&&p.push(y.start+y.size),u=new Net(_objectSpread2$2(_objectSpread2$2({url:t},r),{},{contentType:"ArrayBuffer",headers:{Range:_concatInstanceProperty(n="bytes=".concat(p[0],"-")).call(n,p[1]||"")}})),e.next=13,u.request();case 13:return _=e.sent,v=new Mp4Parser,m=v.parse(_),$=v.getSnapshoot(m),b=null==(i=$.video)?void 0:i.sps,e.abrupt("return",{codec:null==(o=$.video)?void 0:o.codecType,codecStr:null==b?void 0:b.codec,width:null==b?void 0:b.width,height:null==b?void 0:b.height,vDration:null==(a=null==$?void 0:$.video)?void 0:a.duration,aDuration:null==(s=null==$?void 0:$.audio)?void 0:s.duration,sampleRate:null==(l=null==$?void 0:$.audio)?void 0:l.sampleRate,channelCount:null==(c=null==$?void 0:$.audio)?void 0:c.channelCount,views:v.parseV2(m,!0),snap:$});case 19:case"end":return e.stop()}}),e)}))),function(e,r){return t.apply(this,arguments)})}]),e}(),Lite=function(){function e(){_classCallCheck$1(this,e)}var t;return _createClass$2(e,[{key:"parseUrl",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=_Object$assign({timeout:5e3,probeSize:8e4,nbSegment:1},n=a.length>1&&void 0!==a[1]?a[1]:{}),!/flv/.test(t)){e.next=9;break}return e.next=5,(new Flv).parse(t,n);case 5:i=e.sent,o=FORMAT.FLV,e.next=20;break;case 9:if(!/m3u8?/.test(t)){e.next=16;break}return e.next=12,(new Hls).parse(t,n);case 12:i=e.sent,o=FORMAT.TS,e.next=20;break;case 16:return e.next=18,(new Mp4).parse(t,n);case 18:i=e.sent,o=FORMAT.MP4;case 20:return i.exceps=_filterInstanceProperty(r=checkExceptions(i.views.items,o)).call(r,(function(e){return 1!==e.id})),e.abrupt("return",i);case 22:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),e}(),getFlvStrategy=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o,a,s,l,c,u,p,f,d,h,y,g,_,v,m,$,b,S;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d=(null==t||null===(r=t.flv)||void 0===r?void 0:r.enableLowLatency)&&"pc"===sniffer$1.device,h=null===(n=null==t||null===(i=t.flv)||void 0===i||null===(i=i.lowLatency)||void 0===i?void 0:i.enableFrameChasing)||void 0===n||n,y=null!==(o=null==t||null===(a=t.flv)||void 0===a||null===(a=a.lowLatency)||void 0===a?void 0:a.abrPts)&&void 0!==o?o:"-800",e.next=5,getCodec(t);case 5:return g=e.sent,e.next=8,isSoftDecode(t,g);case 8:if(e.sent&&(f=g===Codec.H265?createSoftDecodeH265Strategy():createSoftDecodeH264Strategy(),p=createFlvMseStrategy(t)),isMseSupported("unknown"===g?Codec.H264:g)&&(p=createFlvMseStrategy(t)),p||f){e.next=13;break}return e.abrupt("return",{});case 13:return e.next=15,_Promise.all([(null===(s=p)||void 0===s?void 0:s.module)&&load(p.module).catch((function(){})),(null===(l=f)||void 0===l?void 0:l.module)&&load(f.module).catch((function(){}))]);case 15:return _=e.sent,v=_slicedToArray(_,2),m=v[0],(null==($=v[1])?void 0:$.XGVideoPlugin)&&(null===(c=f)||void 0===c||null===(u=c.afterLoad)||void 0===u||u.call(c,null==$?void 0:$.XGVideoPlugin)),b=combineOptions([p,f]),S=[],d&&(b.url=appendSearchParams(t.url,{abr_pts:y})),m&&(S.push(m.FlvPlugin),d&&h&&S.push(m.Adaptive)),e.abrupt("return",{options:b,plugins:S});case 25:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),getHlsStrategy=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o,a,s,l,c,u,p,f,d,h;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,getCodec(t);case 2:return c=e.sent,e.next=5,isSoftDecode(t,c);case 5:if(e.sent&&(l=c===Codec.H265?createSoftDecodeH265Strategy():createSoftDecodeH264Strategy(),s=createHlsMseStrategy(t)),("mobile"!==sniffer$1.device||null!=t&&null!==(r=t.hls)&&void 0!==r&&r.enableMSE)&&isMseSupported("unknown"===c?Codec.H264:c)&&(s=createHlsMseStrategy(t)),s||l){e.next=10;break}return e.abrupt("return",{});case 10:return e.next=12,_Promise.all([(null===(n=s)||void 0===n?void 0:n.module)&&load(s.module).catch((function(){})),(null===(i=l)||void 0===i?void 0:i.module)&&load(l.module).catch((function(){}))]);case 12:return u=e.sent,p=_slicedToArray(u,2),f=p[0],(null==(d=p[1])?void 0:d.XGVideoPlugin)&&(null===(o=l)||void 0===o||null===(a=o.afterLoad)||void 0===a||a.call(o,null==d?void 0:d.XGVideoPlugin)),h=combineOptions([s,l]),e.abrupt("return",{options:h,plugins:null!=f&&f.HlsPlugin?[f.HlsPlugin]:[]});case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),createFlvMseStrategy=function(e){var t,r,n;return{options:{flv:_objectSpread2$2({retryCount:0,disconnectRetryCount:null!==(t=null==e||null===(r=e.flv)||void 0===r?void 0:r.retryCount)&&void 0!==t?t:void 0},null!==(n=null==e?void 0:e.flv)&&void 0!==n?n:{})},module:DynamicModule.PluginFlv}},createHlsMseStrategy=function(e){var t;return{options:{hls:_objectSpread2$2({retryCount:0,pollRetryCount:0},null!==(t=null==e?void 0:e.hls)&&void 0!==t?t:{})},module:DynamicModule.PluginHls}},createSoftDecodeH264Strategy=function(){return{options:{mediaType:"xg-video",innerDegrade:1,codecType:Codec.H264},module:DynamicModule.PluginXgvideo,afterLoad:function(e){e.isSupported()&&e.setDecodeCapacity({preloadDecoder:Codec.H264,wasmFallbackToAsm:!1,reuseWasmDecoder:!1,disabledWhenErrorOccur:!1})}}},createSoftDecodeH265Strategy=function(){return{options:{mediaType:"xg-video",innerDegrade:1,codecType:Codec.H265},module:DynamicModule.PluginXgvideo,afterLoad:function(e){e.isSupported()&&e.setDecodeCapacity({preloadDecoder:Codec.H265,wasmFallbackToAsm:!1,reuseWasmDecoder:!1})}}};function getCodec(e){return _getCodec.apply(this,arguments)}function _getCodec(){return(_getCodec=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.codec){e.next=2;break}return e.abrupt("return",t.codec);case 2:if(t.degradation!==Degradation.SoftFirst||!t.url){e.next=6;break}return e.next=5,detectCodec(t.url);case 5:return e.abrupt("return",e.sent);case 6:return e.abrupt("return","unknown");case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function detectCodec(e){return _detectCodec.apply(this,arguments)}function _detectCodec(){return(_detectCodec=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(new Lite).parseUrl(t);case 3:if(r=e.sent,"bytevc1"!==(n=r.codec)){e.next=9;break}return e.abrupt("return",Codec.H265);case 9:if("avc"!==n){e.next=11;break}return e.abrupt("return",Codec.H264);case 11:return e.abrupt("return","unknown");case 14:return e.prev=14,e.t0=e.catch(0),console.error("detect codec error: ",e.t0),e.abrupt("return","unknown");case 18:case"end":return e.stop()}}),e,null,[[0,14]])})))).apply(this,arguments)}function isSoftDecode(e,t){return _isSoftDecode.apply(this,arguments)}function _isSoftDecode(){return(_isSoftDecode=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.decodeType!==DecodeType.Software){e.next=2;break}return e.abrupt("return",!0);case 2:if("unknown"!==r){e.next=4;break}return e.abrupt("return",!1);case 4:return e.next=6,getCodec(t);case 6:if(e.sent!==Codec.H265){e.next=12;break}if(!sniffer$1.isHevcSupported()){e.next=10;break}return e.abrupt("return",!1);case 10:if(t.degradation!==Degradation.SoftFirst){e.next=12;break}return e.abrupt("return",!0);case 12:return e.abrupt("return",!1);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function combineOptions(e){return _reduceInstanceProperty(e).call(e,(function(e,t){return _Object$assign(e,null==t?void 0:t.options)}),{})}var VeError=VeError$1,LiveErrorCode=function(e){return e[e.INVALID_PARAMETER=210]="INVALID_PARAMETER",e}(LiveErrorCode||{}),ErrorCode=_objectSpread2$2(_objectSpread2$2({},LiveErrorCode),ErrorCode$1),ERRORS=_objectSpread2$2(_objectSpread2$2({},ERROR_INFO),{},_defineProperty$2({},210,{messageTextKey:"INVALID_PARAMETER",level:Level.Fatal}));function create4(e,t){return new VeError(ERRORS[e],t)}function isRTMSupported(){return _isRTMSupported.apply(this,arguments)}function _isRTMSupported(){return(_isRTMSupported=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,load(DynamicModule.PluginRtm);case 2:return t=e.sent,r=t.RtmPlugin,e.abrupt("return",r.isSupported());case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function isRTMSupportCodec(){return _isRTMSupportCodec.apply(this,arguments)}function _isRTMSupportCodec(){return _isRTMSupportCodec=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r,n,i=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:RTMCodec.H264,e.next=3,load(DynamicModule.PluginRtm);case 3:if(r=e.sent,n=r.RtmPlugin,t!==RTMCodec.H264){e.next=7;break}return e.abrupt("return",n.isSupportedH264());case 7:return e.abrupt("return",!1);case 8:case"end":return e.stop()}}),e)}))),_isRTMSupportCodec.apply(this,arguments)}var _excluded$1=["fallbackUrl","enableFallback","enableRTMAutoTranscode"],rtmStrategy={options:{},module:DynamicModule.PluginRtm},generateFallbackUrl=function(e){return"pc"===sniffer$1.device?e.replace(".sdp",".flv"):e.replace(".sdp",".m3u8")},getRtmStrategy=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i,o,a,s,l,c,u,p,f,d,h,y,g,_,v,m,$,b,S,E;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.url,s=t.rtm||{},l=s.fallbackUrl,c=s.enableFallback,u=void 0===c||c,p=s.enableRTMAutoTranscode,f=_objectWithoutProperties(s,_excluded$1),d=u?!l&&a?generateFallbackUrl(a):l:"","flv"===(h=d&&util.getStreamType(d))&&util.isMseSupported(Codec.H264)?o=createFlvMseStrategy(t):"hls"===h&&("mobile"!==sniffer$1.device||null!=t&&null!==(n=t.hls)&&void 0!==n&&n.enableMSE)&&util.isMseSupported(Codec.H264)&&(o=createHlsMseStrategy(t)),e.next=7,_Promise.all([load(rtmStrategy.module).then((function(e){return e.RtmPlugin})).catch((function(){})),o&&load(o.module).then((function(e){var t,r;return(null===(t=o)||void 0===t?void 0:t.module)===DynamicModule.PluginFlv?e.FlvPlugin:(null===(r=o)||void 0===r?void 0:r.module)===DynamicModule.PluginHls?e.HlsPlugin:void 0})).catch((function(){}))]);case 7:return y=e.sent,g=_slicedToArray(y,2),_=g[0],v=g[1],e.next=13,_Promise.all([isRTMSupported(),isRTMSupportCodec()]);case 13:if(m=e.sent,$=_slicedToArray(m,2),b=$[0],S=$[1],b&&S){e.next=20;break}return r&&r.emit("degrade",{url:d,originRtmUrl:a,code:"NOT_SUPPORT",message:"not support rtm or h264",isRTMSupported:b,isRTMSupportCodec:S}),e.abrupt("return",{options:_objectSpread2$2(_objectSpread2$2({},(null===(E=o)||void 0===E?void 0:E.options)||{}),{},{url:d,_RTMdegrade:{_originRtmUrl:a,_isRTMSupported:b,_isRTMSupportCodec:S}}),plugins:v?[v]:[]});case 20:return e.abrupt("return",{options:_objectSpread2$2(_objectSpread2$2({},(null===(i=o)||void 0===i?void 0:i.options)||{}),{},{url:p?util.appendSearchParams(a,{enableRTMAutoTranscode:"true"}):void 0,_RTMdegrade:void 0,rts:_objectSpread2$2(_objectSpread2$2({retryCount:0},f),{},{backupURL:d,backupConstruct:v})}),plugins:_?[_]:[]});case 21:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),DrmType=function(e){return e.Fairplay="fairplay",e}(DrmType||{});function getDrmType(e){if(null!=e&&e.fairplay&&("safari"===sniffer$1.browser||sniffer$1.os.isIos))return"fairplay"}function isMseSupportedWithDrm(e){var t=e.drm,r=e.streamType,n=getDrmType(t);return!n||("fairplay"!==n||"hls"!==r)}var getTypeStrategy=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=t.url?util.getStreamType(t.url):"")&&"unknown"!==n){e.next=3;break}return e.abrupt("return",{options:{},plugins:[]});case 3:if("rtm"!==n){e.next=7;break}return e.next=6,getRtmStrategy(t,r);case 6:case 10:case 16:return e.abrupt("return",e.sent);case 7:if("flv"!==n){e.next=11;break}return e.next=10,getFlvStrategy(t);case 11:if("hls"!==n){e.next=17;break}if(isMseSupportedWithDrm({drm:t.drm,streamType:n})){e.next=14;break}return e.abrupt("return",{options:{},plugins:[]});case 14:return e.next=16,getHlsStrategy(t);case 17:return e.abrupt("return",{options:{},plugins:[]});case 18:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),FUNC_ERROR_TEXT="Expected a function",NAN=NaN,symbolTag="[object Symbol]",reTrim=/^\s+|\s+$/g,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=_parseInt$7,freeGlobal="object"==_typeof$1(commonjsGlobal$1)&&commonjsGlobal$1&&commonjsGlobal$1.Object===Object&&commonjsGlobal$1,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof$1(self))&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),objectProto=Object.prototype,objectToString=objectProto.toString,nativeMax=Math.max,nativeMin=Math.min,now=function(){return root.Date.now()};function debounce(e,t,r){var n,i,o,a,s,l,c=0,u=!1,p=!1,f=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT);function d(t){var r=n,o=i;return n=i=void 0,c=t,a=e.apply(o,r)}function h(e){var r=e-l;return void 0===l||r>=t||r<0||p&&e-c>=o}function y(){var e=now();if(h(e))return g(e);s=setTimeout(y,function(e){var r=t-(e-l);return p?nativeMin(r,o-(e-c)):r}(e))}function g(e){return s=void 0,f&&n?d(e):(n=i=void 0,a)}function _(){var e=now(),r=h(e);if(n=arguments,i=this,l=e,r){if(void 0===s)return function(e){return c=e,s=setTimeout(y,t),u?d(e):a}(l);if(p)return s=setTimeout(y,t),d(l)}return void 0===s&&(s=setTimeout(y,t)),a}return t=toNumber(t)||0,isObject$2(r)&&(u=!!r.leading,o=(p="maxWait"in r)?nativeMax(toNumber(r.maxWait)||0,t):o,f="trailing"in r?!!r.trailing:f),_.cancel=function(){void 0!==s&&clearTimeout(s),c=0,n=l=i=s=void 0},_.flush=function(){return void 0===s?a:g(now())},_}function isObject$2(e){var t=_typeof$1(e);return!!e&&("object"==t||"function"==t)}function isObjectLike(e){return!!e&&"object"==_typeof$1(e)}function isSymbol(e){return"symbol"==_typeof$1(e)||isObjectLike(e)&&objectToString.call(e)==symbolTag}function toNumber(e){if("number"==typeof e)return e;if(isSymbol(e))return NAN;if(isObject$2(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=isObject$2(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(reTrim,"");var r=reIsBinary.test(e);return r||reIsOctal.test(e)?freeParseInt(_sliceInstanceProperty(e).call(e,2),r?2:8):reIsBadHex.test(e)?NAN:+e}var lodash_debounce=debounce,debounce$1=getDefaultExportFromCjs(lodash_debounce),Events=_objectSpread2$2(_objectSpread2$2({},Events$1),{},{TIME_SHIFT_CHANGE:"timeShiftChange",REFRESH_CLICK:"refreshClick"});function RefreshIcon(){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 refresh="",POSITIONS=Plugin.POSITIONS,Refresh=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(){return _classCallCheck$1(this,r),t.apply(this,arguments)}return _createClass$2(r,[{key:"afterCreate",value:function(){this.config.disable||(this.appendChild(".xgplayer-icon",this.icons.refresh),this._initEvents())}},{key:"registerIcons",value:function(){return{refresh:{icon:RefreshIcon,class:"xgplayer-refresh-svg"}}}},{key:"destroy",value:function(){this.unbind(["touchend","click"],this._handleRefresh)}},{key:"render",value:function(){var e=this.player.config.i18nManager;return'\n <xg-icon class="veplayer-refresh">\n <div class="xgplayer-icon">\n </div>\n <div class="xg-tips" lang-key="refresh">'.concat(e.getText("REFRESH"),"</div>\n </xg-icon>\n ")}},{key:"_handleRefresh",value:function(e){var t=this.player;if(t){var r,n;if(e.preventDefault(),e.stopPropagation(),t.addClass("xgplayer-is-enter"),t.pause(),t)t.emit(Events.REFRESH_CLICK),null===(r=this.player)||void 0===r||null===(r=r.config)||void 0===r||null===(r=r.veplayer)||void 0===r||r.retry(),null===(n=this.player)||void 0===n||null===(n=n.plugins)||void 0===n||null===(n=n.error)||void 0===n||n.hideError();t.once(CANPLAY,(function(){t.removeClass("xgplayer-is-enter")}))}}},{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:"pluginName",get:function(){return"refresh"}},{key:"defaultConfig",get:function(){return{position:POSITIONS.CONTROLS_LEFT,index:1,disable:!1}}}]),r}(),path$4=path$x,urlSearchParams$5=path$4.URLSearchParams,parent$k=urlSearchParams$5,urlSearchParams$4=parent$k,parent$j=urlSearchParams$4,urlSearchParams$3=parent$j,parent$i=urlSearchParams$3,urlSearchParams$2=parent$i,urlSearchParams$1=urlSearchParams$2,urlSearchParams=urlSearchParams$1,_URLSearchParams=getDefaultExportFromCjs(urlSearchParams),$$5=_export,parseInt$1=numberParseInt;$$5({target:"Number",stat:!0,forced:Number.parseInt!=parseInt$1},{parseInt:parseInt$1});var path$3=path$x,_parseInt$5=path$3.Number.parseInt,parent$h=_parseInt$5,_parseInt$4=parent$h,parent$g=_parseInt$4,_parseInt$3=parent$g,parent$f=_parseInt$3,_parseInt$2=parent$f,_parseInt$1=_parseInt$2,_parseInt=_parseInt$1,_Number$parseInt=getDefaultExportFromCjs(_parseInt),$$4=_export,parseFloat$1=numberParseFloat;$$4({target:"Number",stat:!0,forced:Number.parseFloat!=parseFloat$1},{parseFloat:parseFloat$1});var path$2=path$x,_parseFloat$5=path$2.Number.parseFloat,parent$e=_parseFloat$5,_parseFloat$4=parent$e,parent$d=_parseFloat$4,_parseFloat$3=parent$d,parent$c=_parseFloat$3,_parseFloat$2=parent$c,_parseFloat$1=_parseFloat$2,_parseFloat=_parseFloat$1,_Number$parseFloat=getDefaultExportFromCjs(_parseFloat);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 ownKeys2(e,t){var r=_Object$keys(e);if(_Object$getOwnPropertySymbols){var n=_Object$getOwnPropertySymbols(e);t&&(n=_filterInstanceProperty(n).call(n,(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?ownKeys2(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):_Object$getOwnPropertyDescriptors?_Object$defineProperties(e,_Object$getOwnPropertyDescriptors(r)):ownKeys2(Object(r)).forEach((function(t){_Object$defineProperty(e,t,_Object$getOwnPropertyDescriptor(r,t))}))}return e}var 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,o=t[r];if(_indexOfInstanceProperty(i=t[r]).call(i,e)>=0)return o.split("=")[1]||null}},genRandomID$1=function(e){return String(Math.floor(Math.random()*Math.pow(10,e)))},getDeviceID$1=function(){var e=getCookie(device_id_key);if(e)return e;var t=genRandomID$1(11);return document.cookie=device_id_key+"="+t+";max-age=31536000;path=/",t},getUserId$1=function(){var e=getCookie(user_id_key);if(e)return e;var t=genRandomID$1(12);return document.cookie=user_id_key+"="+t+";max-age=31536000;path=/",t},getLogId=function(){return genRandomID$1(12)};function getBrowser(){var e=navigator.userAgent.toLowerCase(),t={},r={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:_indexOfInstanceProperty(e).call(e,"chrome")>-1&&_indexOfInstanceProperty(e).call(e,"safari")>-1,Firefox:_indexOfInstanceProperty(e).call(e,"firefox")>-1,Opera:_indexOfInstanceProperty(e).call(e,"opera")>-1,Safari:_indexOfInstanceProperty(e).call(e,"safari")>-1&&-1==_indexOfInstanceProperty(e).call(e,"chrome"),Edge:_indexOfInstanceProperty(e).call(e,"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 p=e.match(/qqbrowser\/([\d.]+)/);i=p?p[1]:"-1"}t.type=n,t.versions=_parseInt$7(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 Date.now()}function getPlayFormat(e){var t="unknown";return"string"!=typeof e?t:_indexOfInstanceProperty(e).call(e,".flv")>-1?"flv":_indexOfInstanceProperty(e).call(e,".m3u8")>-1?"m3u8":_indexOfInstanceProperty(e).call(e,".mp4")>-1?"mp4":_indexOfInstanceProperty(e).call(e,".sdp")>-1?"rts":t}function isCodecSupport(e){return"undefined"!=typeof MediaSource?+MediaSource.isTypeSupported("video/mp4; codecs="+e):0}function getUrlQuery(e,t,r){var n=new _URLSearchParams(e.split("?")[1]);return n.get(t)||n.get(r)}function getDeviceInfo(){var e={cpu_core_number:-1,memory_usage:-1,network_downlink:-1};try{e.cpu_core_number=navigator.hardwareConcurrency||-1,e.memory_usage=navigator.deviceMemory||-1,e.network_downlink=navigator.connection&&navigator.connection.downlink,null==e.network_downlink&&(e.network_downlink=-1)}catch(e){}return e}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.rtm)return e.plugins.rtm}return null}function getDefaultOptions(e){return{device_id:e.device_id||getDeviceID$1(),user_id:e.user_id||getUserId$1(),error_report_stop:!!e.error_report_stop,project_key:e.project_key||"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:{}},rtcstatechange:{event_key:"rtcstatechange"}}}function getCommonLog(e){var t,r=e.player,n=r.config.mediaType;return _objectSpread2({project_key:e.project_key,live_sdk_version:getPlayerCore(r)||r.hlsOps?"2":"-1",player_sdk_version:r.version,logger_version:"1.1.0-alpha.10",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:+(!!n&&"video"!==n),review_is_live:r.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(r.config.width),height:Math.floor(r.config.height),browser:sniffer.browser,ua:navigator.userAgent,href:window.location.href,timestamp:0,fps:-1,logger_init_time:Date.now(),play_current_time:0,cdn_play_url:r.config.url&&_startsWithInstanceProperty(t=r.config.url).call(t,"//")?window.location.protocol+r.config.url:r.config.url,play_format:getPlayFormat(r.config.url),codec_support:-1},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,r=_filterInstanceProperty(t=performance.getEntriesByType("resource")).call(t,(function(t){return t.name===e}));if(r.length){var n=r[0],i=r[r.length-1];return{dns_parse_time:_Number$parseInt(n.domainLookupEnd-n.domainLookupStart),redirect:_Number$parseInt(n.redirectEnd-n.redirectStart),ttfb:_Number$parseInt(i.responseStart-i.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"},Manage=function(){function e(e){var t=e.Tea;if(!t)throw new Error("lack Tea option");t.event?this.Tea=t.event.bind(t):this.Tea=t,this.logOptions=e,this._player=e.player}_createClass(e,[{key:"videoSize",get:function(){return this._player&&this._player.video?{width:this._player.video.videoWidth,height:this._player.video.videoHeight}:{width:0,height:0}}}]);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),this.core&&this.core.loader&&this.core.loader.finnalUrl?e.cdn_play_url=this.core.loader.finnalUrl:e.cdn_play_url=t&&_startsWithInstanceProperty(t).call(t,"//")?window.location.protocol+t:t,e.live_stream_session_id=getUrlQuery(e.cdn_play_url,"_session_id","session_id"),e.play_format=getPlayFormat(e.cdn_play_url),e.timestamp=getCurrentTime();var r=getDeviceInfo(),n=r.cpu_core_number,i=r.memory_usage,o=r.network_downlink;e.cpu_core_number=n,e.memory_usage=i,e.network_downlink=o,_Object$assign(e,_objectSpread2({},this.videoSize)),this.send(e)},t.send=function(e){e.event_key&&(this.logOptions.onReport&&this.logOptions.onReport(e.event_key,e),this.Tea(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"],LoggerControl=function(){function e(e){var t;this.options=e,this.logger=new XgLiveLogger(e),this.restart=this.restart.bind(this),this.bindUrlChange(),_includesInstanceProperty(t=sniffer.browser).call(t,"Chrome")}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||"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._logmanager=new Manage(this.options),this.init(),this.started=!1,this.destroyed=!1,this.completed=!1,this.firstFrameViewed=!1,this.cacheRtcStats={}}_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}}]);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?_sliceInstanceProperty(e).call(e,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.core=getPlayerCore(this.player),this.core&&(this.commonParams.live_sdk_version="2",this.logmanager.core=this.core),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,c=e.state;switch(t){case"core.ttfb":this.handleTTFB(e);break;case"core.loadresponseheaders":var u=r.get("X-Server-Ip");void 0!==this.player.hlsOps&&(this.log.play_stop.review_ts_count+=1),u&&(this.commonParams.cdn_ip=u);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(e),this.reportStartPlay();break;case"core.loadcomplete":this.handlePlayerLoadedStream(e);break;case"core.streamexception":this.handleStreamException(e);break;case"core.rtcstatechange":this.logmanager.push(_Object$assign({url:l,state:c},this.log.rtcstatechange))}},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,_sliceInstanceProperty(Array.prototype).call(e,0))}catch(e){}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),this.stallEnd()},t.handlePlayerError=function(e){this.errorNumber=1;var t=e.errorType,r=e.errorCode;_Object$assign(this.log.play_error,_objectSpread2({timestamp:getCurrentTime(),code:e.httpCode||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.log.play_result.code=this.log.play_error.code,this.logmanager.push(this.log.play_result,!0))),this.options.error_report_stop?this.handleUserLeave():this.updatePlayStopParams())},t.handlePlayerLoadStream=function(e){var t=e.url,r=e.offersdp,n=e.sessionId;if("string"==typeof t){var i=this.log.play_loadstream;i.timestamp=getCurrentTime(),i.loadstream_url=t,i.offersdp=r,i.sessionId=n,this.logmanager.push(i)}},t.handlePlayerLoadedStream=function(e){var t=this.log.play_stream_loaded;t.timestamp=getCurrentTime(),_Object$assign(t,e),this.logmanager.push(t)},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=_sliceInstanceProperty(i).call(i,_indexOfInstanceProperty(i).call(i,"{"),_lastIndexOfInstanceProperty(i).call(i,"}")+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(e){}}},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,"video"===e&&(this.commonParams.codec_type=t.codec,this.commonParams.codec_support=isCodecSupport(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.logmanager.core=this.core),(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(e){return 0}}},t.getPlayerDownloadSpeed=function(){if(this.core&&this.core.core&&"function"==typeof this.core.core.speedInfo)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.getRtcStats=function(e,t){try{var r=this,n=r.player.plugins.rts||r.player.plugins.rtm,i=n&&n.pc,o={};return i?_Promise.resolve(i.getStats()).then((function(t){return t.forEach((function(t){var n=t.type,i=t.mediaType,a=t.bytesReceived,s=t.packetsReceived,l=t.audioLevel,c=t.concealmentEvents,u=t.remoteTimestamp,p=t.timestamp,f=t.framesDropped,d=t.keyFramesDecoded,h=t.totalDecodeTime,y=t.framesDecoded,g=t.frameHeight,_=t.frameWidth,v=t.framesReceived,m=t.jitterBufferDelay,$=t.jitterBufferEmittedCount,b=t.jitter,S=t.nackCount,E=t.packetsLost,P=t.pliCount,T=t.totalSamplesReceived,I=t.concealedSamples,O=t.currentRoundTripTime,C=t.decoderImplementation,w=t.mimeType,A=t.freezeCount,R=t.totalFreezesDuration,k=t.totalPausesDuration;switch(n){case"inbound-rtp":"audio"===i?(o.audio_bytes_received=a-(r.cacheRtcStats.audioBytesReceived||0),r.cacheRtcStats.audioBytesReceived=a,o.audio_packets_lost=E-(r.cacheRtcStats.audioPacketsLost||0),o.audio_packets_received=s-(r.cacheRtcStats.audioPacketsReceived||0),r.cacheRtcStats.audioPacketsLost=E,r.cacheRtcStats.audioPacketsReceived=s,o.audio_level=l,o.concealment_event=c,o.audio_fraction_lost=o.audio_packets_lost/o.audio_packets_received,void 0!==r.cacheRtcStats.totalSamplesReceived&&(o.audio_rec_sample_rate=(T-r.cacheRtcStats.totalSamplesReceived)/e),r.cacheRtcStats.totalSamplesReceived=T,o.concealed_samples=I,o.total_samples_received=T):(o.frames_dropped=f,o.iframes_decoded=d,o.video_bytes_received=a-(r.cacheRtcStats.videoBytesReceived||0),r.cacheRtcStats.videoBytesReceived=a,o.video_dec_time=h,o.video_decoded_delay_ms=o.video_dec_elapse/y,o.video_frame_height=g,o.video_frame_width=_,void 0!==r.cacheRtcStats.framesDecoded&&(o.video_decode_framerate=(y-r.cacheRtcStats.framesDecoded)/e),r.cacheRtcStats.framesDecoded=y,void 0!==r.cacheRtcStats.framesReceived&&(o.video_recv_framerate=(v-r.cacheRtcStats.framesReceived)/e),void 0!==r.cacheRtcStats.freezeCount&&(o.freeze_count=A-r.cacheRtcStats.freezeCount,o.freeze_duration=R-r.cacheRtcStats.totalFreezesDuration),r.cacheRtcStats.freezeCount=A,r.cacheRtcStats.totalFreezesDuration=R,r.cacheRtcStats.framesReceived=v,o.total_pauses_duration=k,o.video_jb_delay=m/$*1e3,o.video_jitter=1e3*b,o.video_nack_count=S,o.video_packets_lost=E-(r.cacheRtcStats.videoPacketsLost||0),o.video_packets_received=s-(r.cacheRtcStats.videoPacketsReceived||0),o.video_fraction_lost=o.video_packets_lost/o.video_packets_received,r.cacheRtcStats.videoPacketsLost=E,r.cacheRtcStats.videoPacketsReceived=s,o.video_pli_count=P,o.decoder_name=C);break;case"remote-outbound-rtp":o.e2e_delay_ms=p-u;break;case"track":void 0!==_&&(o.video_frame_width=_,o.video_frame_height=g);break;case"candidate-pair":o.rtt=1e3*O;break;case"codec":_includesInstanceProperty(w).call(w,"video")?o.video_codec=w:o.audio_codec=i}o.total_delay=o.e2e_delay_ms+(o.video_decoded_delay_ms||0)+(o.video_jb_delay||0)})),_Object$assign(r.log.playing,{video_download_size:o.video_bytes_received,decode_fps:o.video_decode_framerate,sei_delay:o.total_delay,sei_network_delay:o.e2e_delay_ms,width:o.video_frame_width,height:o.video_frame_height,current_speed:(o.audio_bytes_received+o.video_bytes_received)/e}),o})):_Promise.resolve(o)}catch(e){return _Promise.reject(e)}},t.reportPlaying=function(e){try{var t=this;t.commonParams.is_wasm&&(t.commonParams.fps=t.player.video.fps,t.log.playing.render_fps=t.player.video.fps,t.log.playing.decode_fps=t.player.video.decodeFps),t.log.playing.index++;var r,n=t.log.playing.timestamp;t.inWaitingStart&&t.inWaitingStart<getCurrentTime()&&(r=Math.min(t.options.playingInterval||t.log.playing.play_time,getCurrentTime()-Math.max(t.inWaitingStart,n))),t.getPlayerQuality(),t.getPlayerBuffer(),t.options.downloadSpeedInterval||(t.log.playing.current_speed=t.getPlayerDownloadSpeed());var i=getCurrentTime(),o=i-n,a=(r>200?r:0)+t.log.playing.stall_time,s=(r>200?1:0)+t.log.playing.stall_count;return t.options.aggregationDowngradeStallTime&&(t.log.playing.aggregation_downgrade_stall=(r>t.options.aggregationDowngradeStallTime?r:0)+(t.log.playing.aggregation_downgrade_stall||0)),_Object$assign(t.log.playing,_objectSpread2({timestamp:i,stop_time:i,duration:e?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:t.player.currentTime},t.videoSize)),_Promise.resolve(t.getRtcStats(o,e)).then((function(r){var n={};if(t.core){if(t.core.getStats){var i=t.core.getStats()||{},a=i.bitrate,s=i.avgSpeed;_Object$assign(n,{bitrate:a,avg_speed:s,rate:s/a})}if(t.core.getNetWorkInfo){var l,c=(t.core.getNetWorkInfo()||{}).lostRate,u=((null===(l=t.core.core)||void 0===l?void 0:l._opts)||{}).networkEvaluateInterval;_Object$assign(n,{lostRate:c,networkEvaluateInterval:u})}}t.logmanager.push(_Object$assign({},t.log.playing,_objectSpread2(_objectSpread2({play_time:e?0:o},r),n)),!0),t.log.playing.download_speed_array=[],t.log.playing.stall_time=0,t.log.playing.stall_count=0,t.options.aggregationDowngradeStallTime&&(t.log.playing.aggregation_downgrade_stall=0)}))}catch(e){return _Promise.reject(e)}},t.handlePlayerPlaying=function(){try{var e=this;if(e.player&&e.player.video.readyState<3)return _Promise.resolve();if(e.player.off("playing",e.handlePlayerPlaying),e.player.off("timeupdate",e.handlePlayerPlaying),e.core){var t=(e.core.getStats()||{}).fps;e.commonParams.fps=t}return _Promise.resolve(e.reportPlaying(!0)).then((function(){e.clearPlayingInterval();var t=e.options.playingInterval||e.log.playing.play_time;e.intervalId=setInterval((function(){try{var r=function(){if(Math.abs(Date.now()-e.log.playing.timestamp-t)<100||Date.now()-e.log.playing.timestamp>=t){var r=function(){if(e.player&&e.player.video){var t=function(){if(!e.player.paused)return _Promise.resolve(e.reportPlaying()).then((function(){}));e.handleVideopause()}();if(t&&t.then)return t.then((function(){}))}else e.destroyFunc()}();if(r&&r.then)return r.then((function(){}))}}();return _Promise.resolve(r&&r.then?r.then((function(){})):void 0)}catch(e){return _Promise.reject(e)}}),1e3),e.clearStallTimer(),e.handleVideoplaying(),e.started||e.reportStartPlay(),e.saveBuffered()}))}catch(e){return _Promise.reject(e)}},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.log.play_result.start=getCurrentTime(),this.playResultTimer=setTimeout((function(){e.log.play_result.timestamp>=e.log.play_result.start||(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.log.play_result.code=t.code,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._player=null),this.clearPlayingInterval(),this.clearStallTimer(),this.clearPlayResultTimer(),clearTimeout(this.collectDownloadSpeedTimer))},t.handleUserLeave=function(){try{var e=this;return e.destroyed||!e.started?_Promise.resolve():(e.destroyed=!0,_Promise.resolve(e.updatePlayStopParams()).then((function(){e.reportPlayStop(),e.clearPlayingInterval(),e.clearStallTimer(),clearTimeout(e.collectDownloadSpeedTimer),e.removeWindowListener()})))}catch(e){return _Promise.reject(e)}},t.saveBuffered=function(){try{var e=this.getBuffered();e&&e.length&&(this.log.play_stop.buffered=e)}catch(e){}},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(e){}},t.reportPlayStop=function(){this.player&&(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){if(this.core){var e=(this.core.getStats()||{}).fps;this.commonParams.fps=e}this.firstFrameViewed=!0;var t=getCurrentTime();_Object$assign(this.log.first_frame,_objectSpread2({first_frame_view:t-this.log.start_play.start_play_time||t,timestamp:t},this.videoSize)),this.log.first_frame.ttfb_end&&(this.log.first_frame.ttdb=t-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(){try{var e,t=function(){_Object$assign(o,_objectSpread2({timestamp:i,stop_time:i,duration:r.playedTime/1e3,play_time:r.playedTime/1e3},r.videoSize)),0===r.errorNumber&&(o.play_time_on_no_frame=o.stop_time-r.log.start_play.start_play_time)},r=this,n=getResourceTiming(r._url),i=getCurrentTime();r.playedTime=i-r.log.start_play.start_play_time;var o=r.log.play_stop;if(_Object$assign(o,_objectSpread2({},0===o.stall_count&&{stall_time:0})),r.inWaitingStart&&i-r.inWaitingStart>200&&(o.stall_time+=i-r.inWaitingStart),r.inWaitingStart=0,_Object$assign(o,_objectSpread2({stall_time_per_100sec:o.stall_time/r.playedTime*100,stall_count_per_100sec:1e3*o.stall_count/r.playedTime*100},n)),0===r.log.play_stop.stall_count_per_100sec&&(r.log.play_stop.stall_time_per_100sec=0),r.log.play_stop.stall_time_per_100sec>100||r.log.play_stop.stall_time_per_100sec<0)return _Promise.resolve();if(r.log.playing.index?(_Object$assign(r.log.playing,_objectSpread2({timestamp:getCurrentTime(),is_last:1},r.videoSize)),r.logmanager.push(r.log.playing,!0)):(r.log.play_stop.error_code=r.log.play_error.code,r.log.play_stop.error_info=r.log.play_error.info),i=getCurrentTime(),null===(e=r.core)||void 0===e?void 0:e.getStats){var a=r.core.getStats()||{},s=a.totalReceivedByte,l=a.totalReceivedCost;_Object$assign(r.log.play_stop,{totalReceivedByte:s,totalReceivedCost:l,totalAverageSpeed:8*s/(l/1e3)})}var c=function(){var e;if(null===(e=r.core)||void 0===e?void 0:e.getStatsSnapshoot)return _Promise.resolve(r.core.getStatsSnapshoot()).then((function(e){var t=e.video||{},r=t.packetsLost,n=t.packetsReceived;_Object$assign(o,{packetsLost:r,packetsReceived:n,totalLostRate:r/(r+n)})}))}();return _Promise.resolve(c&&c.then?c.then(t):t())}catch(e){return _Promise.reject(e)}},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)},e}(),$$3=_export,global$1=global$p;$$3({global:!0,forced:global$1.globalThis!==global$1},{globalThis:global$1});var globalThis$6=global$p,parent$b=globalThis$6,globalThis$5=parent$b,parent$a=globalThis$5,globalThis$4=parent$a,parent$9=globalThis$4,globalThis$3=parent$9,globalThis$2=globalThis$3,globalThis$1=globalThis$2,_globalThis=getDefaultExportFromCjs(globalThis$1),$$2=_export,FREEZING=freezing,fails=fails$B,isObject$1=isObject$o,onFreeze=internalMetadataExports.onFreeze,$freeze=Object.freeze,FAILS_ON_PRIMITIVES=fails((function(){$freeze(1)}));$$2({target:"Object",stat:!0,forced:FAILS_ON_PRIMITIVES,sham:!FREEZING},{freeze:function(e){return $freeze&&isObject$1(e)?$freeze(onFreeze(e)):e}});var path$1=path$x,freeze$5=path$1.Object.freeze,parent$8=freeze$5,freeze$4=parent$8,parent$7=freeze$4,freeze$3=parent$7,parent$6=freeze$3,freeze$2=parent$6,freeze$1=freeze$2,freeze2=freeze$1,_Object$freeze=getDefaultExportFromCjs(freeze2),reverse2=reverse$1,_reverseInstanceProperty=getDefaultExportFromCjs(reverse2),$$1=_export,codeAt=stringMultibyte.codeAt;$$1({target:"String",proto:!0},{codePointAt:function(e){return codeAt(this,e)}});var entryVirtual=entryVirtual$p,codePointAt$6=entryVirtual("String").codePointAt,isPrototypeOf=objectIsPrototypeOf,method=codePointAt$6,StringPrototype=String.prototype,codePointAt$5=function(e){var t=e.codePointAt;return"string"==typeof e||e===StringPrototype||isPrototypeOf(StringPrototype,e)&&t===StringPrototype.codePointAt?method:t},parent$5=codePointAt$5,codePointAt$4=parent$5,parent$4=codePointAt$4,codePointAt$3=parent$4,parent$3=codePointAt$3,codePointAt$2=parent$3,codePointAt$1=codePointAt$2,codePointAt2=codePointAt$1,_codePointAtInstanceProperty=getDefaultExportFromCjs(codePointAt2),$=_export,uncurryThis=functionUncurryThis,toAbsoluteIndex=toAbsoluteIndex$6,$RangeError=RangeError,fromCharCode=String.fromCharCode,$fromCodePoint=String.fromCodePoint,join=uncurryThis([].join),INCORRECT_LENGTH=!!$fromCodePoint&&1!=$fromCodePoint.length;$({target:"String",stat:!0,arity:1,forced:INCORRECT_LENGTH},{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,i=0;n>i;){if(t=+arguments[i++],toAbsoluteIndex(t,1114111)!==t)throw $RangeError(t+" is not a valid code point");r[i]=t<65536?fromCharCode(t):fromCharCode(55296+((t-=65536)>>10),t%1024+56320)}return join(r,"")}});var path=path$x,fromCodePoint$5=path.String.fromCodePoint,parent$2=fromCodePoint$5,fromCodePoint$4=parent$2,parent$1=fromCodePoint$4,fromCodePoint$3=parent$1,parent=fromCodePoint$3,fromCodePoint$2=parent,fromCodePoint$1=fromCodePoint$2,fromCodePoint2=fromCodePoint$1,_String$fromCodePoint=getDefaultExportFromCjs(fromCodePoint2),_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},_assign.apply(this,arguments)};function __rest(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&_indexOfInstanceProperty(t).call(t,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++)_indexOfInstanceProperty(t).call(t,n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function __read(e,t){var r="function"==typeof _Symbol&&_getIteratorMethod(e);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(e){i={error:e}}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=_concatInstanceProperty(e).call(e,__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;if(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,n,i=_indexOfInstanceProperty(r=this._hooks[e]).call(r,t);if(-1!==i)_spliceInstanceProperty(n=this._hooks[e]).call(n,i,1)}else this._hooks[e]=[]},e.prototype.emit=function(e,t,r){if(r){var n;if(!e)return;-1!==_indexOfInstanceProperty(n=this._cache).call(n,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(e){}}))},e.prototype.set=function(e){var t;e&&-1===_indexOfInstanceProperty(t=this._cache).call(t,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},isArray2=function(e){return Array.isArray(e)},getIndex=function(e){var t=+Date.now()+Number(_sliceInstanceProperty(e=""+Math.random()).call(e,2,8));return function(){return t+=1}}(),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$7(n[a],r);s=1*s^t;var l=String.fromCharCode(s);i.push(l)}return i.join("")}},encodeBase64=function(e){return window.btoa?window.btoa(encodeURIComponent(e)):encodeURIComponent(e)},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)},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=_sliceInstanceProperty(r).call(r,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(e){t[r]=n}}))}catch(e){}return t},hashCode$1=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 leftPad$2(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e}var hexToArray$3=function(e){var t=[],r=e.length;r%2!=0&&(e=leftPad$2(e,r+1)),r=e.length;for(var n=0;n<r;n+=2)t.push(_parseInt$7(e.substr(n,2),16));return t},commonjsGlobal=void 0!==_globalThis?_globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var js_cookie=createCommonjsModule((function(e,t){e.exports=function(){function e(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}function t(r,n){function i(t,i,o){if("undefined"!=typeof document){"number"==typeof(o=e({},n,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var s in o)o[s]&&(a+="; "+s,!0!==o[s]&&(a+="="+o[s].split(";")[0]));return document.cookie=t+"="+r.write(i,t)+a}}function o(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],n={},i=0;i<t.length;i++){var o=t[i].split("="),a=_sliceInstanceProperty(o).call(o,1).join("=");try{var s=decodeURIComponent(o[0]);if(n[s]=r.read(a,s),e===s)break}catch(e){}}return e?n[e]:n}}return Object.create({set:i,get:o,remove:function(t,r){i(t,"",e({},r,{expires:-1}))},withAttributes:function(r){return t(this.converter,e({},this.attributes,r))},withConverter:function(r){return t(e({},this.converter,r),this.attributes)}},{attributes:{value:_Object$freeze(n)},converter:{value:_Object$freeze(r)}})}return t({read:function(e){return'"'===e[0]&&(e=_sliceInstanceProperty(e).call(e,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)}},{path:"/"})}()})),jsCookie=js_cookie,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){this.getItem(e)},e.prototype.setCookie=function(e,t){this.setItem(e,t)},e}();function isSupportLS(){try{return localStorage.setItem("_ranger-test-key","hi"),localStorage.getItem("_ranger-test-key"),localStorage.removeItem("_ranger-test-key"),!0}catch(e){return!1}}function isSupportSession(){try{return sessionStorage.setItem("_ranger-test-key","hi"),sessionStorage.getItem("_ranger-test-key"),sessionStorage.removeItem("_ranger-test-key"),!0}catch(e){return!1}}var LOG,Types,DebuggerMesssge,local={getItem:function(e){try{var t=localStorage.getItem(e),r=t;try{t&&"string"==typeof t&&(r=JSON.parse(t))}catch(e){}return r||{}}catch(e){}return{}},setItem:function(e,t){try{var r="string"==typeof t?t:_JSON$stringify(t);localStorage.setItem(e,r)}catch(e){}},removeItem:function(e){try{localStorage.removeItem(e)}catch(e){}},getCookie:function(e,t){try{return jsCookie.get(e,{domain:t||document.domain})}catch(e){return""}},setCookie:function(e,t,r,n){try{var i=n||document.domain,o=+new Date+r;jsCookie.set(e,t,{expires:new Date(o),path:"/",domain:i})}catch(e){}},isSupportLS:isSupportLS()},session={getItem:function(e){try{var t=sessionStorage.getItem(e),r=t;try{t&&"string"==typeof t&&(r=JSON.parse(t))}catch(e){}return r||{}}catch(e){}return{}},setItem:function(e,t){try{var r="string"==typeof t?t:_JSON$stringify(t);sessionStorage.setItem(e,r)}catch(e){}},removeItem:function(e){try{sessionStorage.removeItem(e)}catch(e){}},getCookie:function(e){this.getItem(e)},setCookie:function(e,t){this.setItem(e,t)},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 p=!1;for(var f in u)u[f]&&(-1!==_indexOfInstanceProperty(c).call(c,f)?(l.hasOwnProperty("tracer_data")||(l.tracer_data={}),l.tracer_data[f]=u[f]):l[f]=u[f],p=!0);if(p)o.setItem(s,"1"),i.setCookie(a,_JSON$stringify(l),n,r);else{var d=i.getCookie(a,r);d&&(l=JSON.parse(d))}o.getItem(s)&&(l.hasOwnProperty("tracer_data")||(l.tracer_data={}),l.tracer_data.$utm_from_url=1)}catch(e){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$7(this.appVersion),i=this.userAgent;return-1!==_indexOfInstanceProperty(i).call(i,"Edge")||-1!==_indexOfInstanceProperty(i).call(i,"Edg")?(r="Microsoft Edge",-1!==_indexOfInstanceProperty(i).call(i,"Edge")?(e=_indexOfInstanceProperty(i).call(i,"Edge"),n=i.substring(e+5)):(e=_indexOfInstanceProperty(i).call(i,"Edg"),n=i.substring(e+4))):-1!==(e=_indexOfInstanceProperty(i).call(i,"MSIE"))?(r="Microsoft Internet Explorer",n=i.substring(e+5)):-1!==(e=_indexOfInstanceProperty(i).call(i,"Lark"))?(r="Lark",n=i.substring(e+5,e+11)):-1!==(e=_indexOfInstanceProperty(i).call(i,"MetaSr"))?(r="sougoubrowser",n=i.substring(e+7,e+10)):-1!==_indexOfInstanceProperty(i).call(i,"MQQBrowser")||-1!==_indexOfInstanceProperty(i).call(i,"QQBrowser")?(r="qqbrowser",-1!==_indexOfInstanceProperty(i).call(i,"MQQBrowser")?(e=_indexOfInstanceProperty(i).call(i,"MQQBrowser"),n=i.substring(e+11,e+15)):-1!==_indexOfInstanceProperty(i).call(i,"QQBrowser")&&(e=_indexOfInstanceProperty(i).call(i,"QQBrowser"),n=i.substring(e+10,e+17))):-1!==_indexOfInstanceProperty(i).call(i,"Chrome")?-1!==(e=_indexOfInstanceProperty(i).call(i,"MicroMessenger"))?(r="weixin",n=i.substring(e+15,e+20)):-1!==(e=_indexOfInstanceProperty(i).call(i,"360"))?(r="360browser",n=i.substring(_indexOfInstanceProperty(i).call(i,"Chrome")+7)):-1!==_indexOfInstanceProperty(i).call(i,"baidubrowser")||-1!==_indexOfInstanceProperty(i).call(i,"BIDUBrowser")?(-1!==_indexOfInstanceProperty(i).call(i,"baidubrowser")?(e=_indexOfInstanceProperty(i).call(i,"baidubrowser"),n=i.substring(e+13,e+16)):-1!==_indexOfInstanceProperty(i).call(i,"BIDUBrowser")&&(e=_indexOfInstanceProperty(i).call(i,"BIDUBrowser"),n=i.substring(e+12,e+15)),r="baidubrowser"):-1!==(e=_indexOfInstanceProperty(i).call(i,"xiaomi"))?-1!==_indexOfInstanceProperty(i).call(i,"openlanguagexiaomi")?(r="openlanguage xiaomi",n=i.substring(e+7,e+13)):(r="xiaomi",n=i.substring(e-7,e-1)):-1!==(e=_indexOfInstanceProperty(i).call(i,"TTWebView"))?(r="TTWebView",n=i.substring(e+10,e+23)):(-1!==(e=_indexOfInstanceProperty(i).call(i,"Chrome"))||-1!==(e=_indexOfInstanceProperty(i).call(i,"Chrome")))&&(r="Chrome",n=i.substring(e+7)):-1!==_indexOfInstanceProperty(i).call(i,"Safari")?-1!==(e=_indexOfInstanceProperty(i).call(i,"QQ"))?(r="qqbrowser",n=i.substring(e+10,e+16)):-1!==(e=_indexOfInstanceProperty(i).call(i,"Safari"))&&(r="Safari",n=i.substring(e+7),-1!==(e=_indexOfInstanceProperty(i).call(i,"Version"))&&(n=i.substring(e+8))):-1!==(e=_indexOfInstanceProperty(i).call(i,"Firefox"))?(r="Firefox",n=i.substring(e+8)):-1!==(e=_indexOfInstanceProperty(i).call(i,"MicroMessenger"))?(r="weixin",n=i.substring(e+15,e+20)):-1!==(e=_indexOfInstanceProperty(i).call(i,"QQ"))?(r="qqbrowser",n=i.substring(e+3,e+8)):-1!==(e=_indexOfInstanceProperty(i).call(i,"Opera"))&&(r="Opera",n=i.substring(e+6),-1!==(e=_indexOfInstanceProperty(i).call(i,"Version"))&&(n=i.substring(e+8))),-1!==(t=_indexOfInstanceProperty(n).call(n,";"))&&(n=n.substring(0,t)),-1!==(t=_indexOfInstanceProperty(n).call(n," "))&&(n=n.substring(0,t)),-1!==(t=_indexOfInstanceProperty(n).call(n,")"))&&(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=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-)(?:"+e+")","i").exec(t);return r?_sliceInstanceProperty(r).call(r,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))?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){_indexOfInstanceProperty(e).call(e,"Build/")>-1&&(t=_sliceInstanceProperty(e).call(e,0,_indexOfInstanceProperty(e).call(e,"Build/")))}));else if("ios"===e||"mac"===e||"windows"===e)if(this.isNewIpad())t="iPad";else{var r=navigator.userAgent.replace("Mozilla/5.0 (",""),n=_indexOfInstanceProperty(r).call(r,";");t=_sliceInstanceProperty(r).call(r,0,n)}}catch(e){return _trimInstanceProperty(t).call(t)}return _trimInstanceProperty(t).call(t)},e.prototype.isNewIpad=function(){return void 0!==this.userAgent&&"MacIntel"===navigator.platform&&"number"==typeof navigator.maxTouchPoints&&navigator.maxTouchPoints>1},e}(),LOG_URL=LOG={cn:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z4az24z1mz1jz1az1cz18z1nz1nz1jz1mz1ez4az1az1mz1k",va:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z4az1gz22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k",sg:"1fz22z22z1nz21z4mz4bz4bz1kz1az21z4az22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k"},SDK_VERSION="0.1.0",SDK_USE_TYPE="npm",SDK_TYPE=SDK_USE_TYPE,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","_be_active","$bav2b_slide"],this.paramsNameWhiteList=["$inactive","$inline","$target_uuid_list","$source_uuid","$is_spider","$source_id","$is_first_time","$user_unique_id_type","_staging_flag","$exposure_type","$direction","$offsetY","$offsetX"],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){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;"string"==typeof e&&(t=JSON.parse(t));var r=!0;if(!_Object$keys(t).length)return r;for(var n in t){if(!this.calculate(n,"params")){r=!1;break}if("string"==typeof t[n]&&t[n].length>1024){console.warn("params: "+n+" can not over 1024 byte, please check;"),r=!1;break}}return r},e.prototype.calculate=function(e,t){var r="event"===t?this.eventNameWhiteList:"params"===t?this.paramsNameWhiteList:[];return-1!==_indexOfInstanceProperty(r).call(r,e)||(!new RegExp("^\\$").test(e)&&!new RegExp("^__").test(e)||(console.warn(t+" name: "+e+" can not start with $ or __, pleace check;"),!1))},e}();!function(e){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.AnonymousId="anonymous-id",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.SubmitVerifyH="submit-verify-h5",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.TrackDuration="track-duration",e.TrackDurationStart="track-duration-start",e.TrackDurationEnd="track-duration-end",e.TrackDurationPause="track-duration-pause",e.TrackDurationResume="tracl-duration-resume",e.Autotrack="autotrack",e.AutotrackReady="autotrack-ready",e.CepReady="cep-ready",e.TracerReady="tracer-ready"}(Types||(Types={})),function(e){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"}(DebuggerMesssge||(DebuggerMesssge={}));var Types$1=Types,undef=void 0,date=new Date,timeZoneMin=date.getTimezoneOffset(),timezone=_parseInt$7(""+-timeZoneMin/60,10),tz_offset=60*timeZoneMin,WEBID_URL="/webid",TOB_URL="/tobid",REPORT_URL="/list",PROFILE_URL="/profile/list",EXPIRE_TIME=7776e6,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||EXPIRE_TIME).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"),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,anonymous_id: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(){var e=this.initConfig.channel_domain;if(e)this.domain=e;else{var t=this.initConfig.channel;this.domain=decodeUrl(LOG_URL[t])}},e.prototype.setDomain=function(e){this.domain=e},e.prototype.getDomain=function(){return 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.clearAbCache=function(){this.ab_cache={},this.ab_version=""},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=REPORT_URL;break;case"webid":t=WEBID_URL;break;case"tobid":t=TOB_URL;break;case"profile":t=PROFILE_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.initConfig.enable_encryption&&"event"===e&&"sm"!==this.initConfig.encryption_type&&(r=this.initConfig.caller?r+"&encryption=1":r+"?encryption=1"),this.initConfig.report_url?""+this.initConfig.report_url+r:""+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(e){}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(_indexOfInstanceProperty(r).call(r,".")>-1){var o=r.split(".");n=o[0],i=o[1]}if(n)"user"===n||"header"===n?t.envInfo[n][i]=e[r]:t.envInfo.header.custom[i]=e[r];else if(Object.hasOwnProperty.call(t.envInfo.user,r)){var a,s,l;_indexOfInstanceProperty(a=["user_type","ip_addr_id"]).call(a,r)>-1?t.envInfo.user[r]=e[r]?Number(e[r]):e[r]:_indexOfInstanceProperty(s=["user_id","web_id","user_unique_id","user_unique_id_type","anonymous_id"]).call(s,r)>-1?t.envInfo.user[r]=e[r]?String(e[r]):e[r]:_indexOfInstanceProperty(l=["user_is_auth","user_is_login"]).call(l,r)>-1?t.envInfo.user[r]=Boolean(e[r]):"device_id"===r&&(t.envInfo.user[r]=e[r])}else 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(e){console.log("get config stringify error "),this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.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(e){console.log("setStore error"),this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.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(e){return this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.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(e){this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.message}),console.log("delete error")}},e}(),Logger$1=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("%c %s","color: yellow; background-color: black;","[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){var r;this.native=e.enable_native||e[_reverseInstanceProperty(r="evitaN".split("")).call(r).join("")],this.os=t.get("os_name")}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(e){console.log("AppLogBridge, error:"+_JSON$stringify(e.stack)),r(!1)}}))},t.setNativeAppId=function(e){try{AppLogBridge.setNativeAppId(_JSON$stringify(e)),console.log("change bridge appid, event report with appid: "+e)}catch(e){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(e){console.error("setConfig error")}},t.setUserUniqueId=function(e){try{AppLogBridge.setUserUniqueId(e)}catch(e){console.error("setUserUniqueId error")}},t.addHeaderInfo=function(e,t){try{AppLogBridge.addHeaderInfo(e,t)}catch(e){console.error("addHeaderInfo error")}},t.setHeaderInfo=function(e){try{AppLogBridge.setHeaderInfo(_JSON$stringify(e))}catch(e){console.error("setHeaderInfo error")}},t.removeHeaderInfo=function(e){try{AppLogBridge.removeHeaderInfo(e)}catch(e){console.error("removeHeaderInfo error")}},t.reportPv=function(e){this.onEventV3("predefine_pageview",e)},t.onEventV3=function(e,t){try{AppLogBridge.onEventV3(e,t)}catch(e){console.error("onEventV3 error")}},t.profileSet=function(e){try{AppLogBridge.profileSet(e)}catch(e){console.error("profileSet error")}},t.profileSetOnce=function(e){try{AppLogBridge.profileSetOnce(e)}catch(e){console.error("profileSetOnce error")}},t.profileIncrement=function(e){try{AppLogBridge.profileIncrement(e)}catch(e){console.error("profileIncrement error")}},t.profileUnset=function(e){try{AppLogBridge.profileUnset(e)}catch(e){console.error("profileUnset error")}},t.profileAppend=function(e){try{AppLogBridge.profileAppend(e)}catch(e){console.error("profileAppend error")}},t.setExternalAbVersion=function(e){try{AppLogBridge.setExternalAbVersion(e)}catch(e){console.error("setExternalAbVersion error")}},t.getVar=function(e,t,r){try{"android"===this.os?r(AppLogBridge.getABTestConfigValueForKey(e,t)):AppLogBridge.getABTestConfigValueForKey(e,t,(function(e){r(e)}))}catch(e){console.error("getVar error"),r(t)}},t.getAllVars=function(e){try{"android"===this.os?e(AppLogBridge.getAllAbTestConfigs()):AppLogBridge.getAllAbTestConfigs((function(t){e(t)}))}catch(t){console.error("getAllVars error"),e(null)}},t.getAbSdkVersion=function(e){try{"android"===this.os?e(AppLogBridge.getAbSdkVersion()):AppLogBridge.getAbSdkVersion((function(t){e(t)}))}catch(t){console.error("getAbSdkVersion error"),e("")}},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,c){try{var u=new XMLHttpRequest,p=s||"POST";u.open(p,""+e,!0),l&&c?u.setRequestHeader("Content-Type","application/octet-stream;tt-data="+c):u.setRequestHeader("Content-Type","application/json; charset=utf-8"),a&&u.setRequestHeader("X-MCS-AppKey",""+a),n&&(u.withCredentials=!0),r&&(u.timeout=r,u.ontimeout=function(){o&&o(t,ERROR$1.TIMEOUT)}),u.onload=function(){if(i){var e=null;if(u.responseText){try{e=JSON.parse(u.responseText)}catch(t){e={}}i(e,t)}}},u.onerror=function(){u.abort(),o&&o(t,ERROR$1.XHR_ON)},l?u.send(t):u.send(_JSON$stringify(t))}catch(e){}}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+="&"+r+"="+encodeURIComponent(_JSON$stringify(e[r])));return t="&"===t[0]?_sliceInstanceProperty(t).call(t,1):t},sendByImg=function(e,t,r,n){try{var i=e.match(/\/v\d\//),o="";o=i?i[0]:-1!==_indexOfInstanceProperty(e).call(e,"/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=""+a+GIF_URL+"?"+o}))}catch(r){n&&n(e,t,ERROR.IMG_CATCH,r.message)}},request=function(e,t,r,n,i,o,a,s,l){var c=window.navigator.userAgent,u=window.navigator.appName;if(-1===_indexOfInstanceProperty(u).call(u,"Microsoft Internet Explorer")||-1===_indexOfInstanceProperty(c).call(c,"MSIE 8.0")&&-1===_indexOfInstanceProperty(c).call(c,"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,l)},Event$1=function(){function e(){this.eventLimit=50,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.cacheStorgae=new Storage(!0),this.localStorage=new Storage(!1),this.eventCheck=new EventCheck(e,t),this.maxReport=t.max_report||20,this.reportTime=t.reportTime||30,this.timeout=t.timeout||1e5,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.refer_key="__tea_cache_refer_"+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(e){this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.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(){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=_sliceInstanceProperty(e).call(e,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.handleRefer=function(){var e="";try{if(this.config.spa||this.config.autotrack){var t=this.localStorage.getItem(this.refer_key)||{};e=t.routeChange?t.refer_key:this.configManager.get("referrer")}else e=this.configManager.get("referrer")}catch(t){e=document.referrer}return e},e.prototype.merge=function(e,t){var r=this,n=this.configManager.get(),i=n.header,o=n.user;i.referrer=this.handleRefer(),i.custom=_JSON$stringify(i.custom);var a=this.configManager.get("evtParams"),s=this.configManager.get("user_unique_id_type"),l=_mapInstanceProperty(e).call(e,(function(e){try{if(_Object$keys(a).length&&!t&&(e.params=_assign({},e.params,a)),r.collect.dynamicParamsFilter){var n=r.collect.dynamicParamsFilter();_Object$keys(n).length&&(e.params=_assign({},e.params,n))}s&&(e.params.$user_unique_id_type=s);var i=r.configManager.getAbCache(),l=r.configManager.getAbVersion();return l&&i&&(r.config.disable_ab_reset||i.uuid===o.user_unique_id)&&(e.ab_sdk_version=l),e.session_id=r.collect.sessionManager.getSessionId(),e.params=_JSON$stringify(e.params),e}catch(t){return r.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:t.message}),e}})),c=[];if(!_Object$keys(o).length)return console.warn("user info error,cant report"),c;this.config.enable_anonymousid&&delete o.web_id;var u=JSON.parse(_JSON$stringify({events:l,user:o,header:i}));return u.local_time=Math.floor(Date.now()/1e3),u.verbose=1,u.user_unique_type=this.config.enable_ttwebid?this.config.user_unique_type:void 0,c.push(u),c},e.prototype.split=function(e){return e=_mapInstanceProperty(e).call(e,(function(e){var t=[];return t.push(e),t}))},e.prototype.send=function(e,t){var r=this;e.length&&e.forEach((function(e){try{var n,i=JSON.parse(_JSON$stringify(e));if(_filterInstanceProperty(r.config))(i=_filterInstanceProperty(n=r.config).call(n,i))||console.warn("filter must return data !!");r.collect.eventFilter&&i&&((i=r.collect.eventFilter(i))||console.warn("filterEvent api must return data !!"));var o=i||e,a=JSON.parse(_JSON$stringify(o));if(r.eventCheck.checkVerify(a),!o.length)return;r.collect.emit(Types$1.SubmitBefore,o);var s=r.collect.cryptoData(o);request(r.reportUrl,s,r.timeout,!1,(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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_EVENT,info:"埋点上报失败",time:Date.now(),data:a,code:e.e,failType:"数据异常",status:"fail"})):(r.collect.emit(Types$1.SubmitScuess,{eventData:t,res:e}),r.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_EVENT,info:"埋点上报成功",time:Date.now(),data:a,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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_EVENT,info:"埋点上报网络异常",time:Date.now(),data:a,code:t,failType:"网络异常",status:"fail"})}),t,r.config.enable_encryption,r.config.encryption_header),r.eventCheck.checkVerify(o),r.collect.emit(Types$1.SubmitVerifyH,o),r.collect.emit(Types$1.SubmitAfter,o)}catch(e){console.warn("something error, "+_JSON$stringify(e.stack)),r.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.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(){var e;return _sliceInstanceProperty(e=b().replace(/-/g,"")).call(e,0,19)},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}(),Token=function(){function e(){this.cacheToken={},this.enableCookie=!1,this.enableTTwebid=!1,this.enableCustomWebid=!1,this.enableAnonymousid=!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.enableAnonymousid=t.enable_anonymousid,this.enableTTwebid=t.enable_ttwebid,this.enableCustomWebid=t.enable_custom_webid,this.collect.on(Types$1.AnonymousId,(function(e){r.setAnonymousId(e)})),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.enableAnonymousid?this.enableAnonymousid?this.completeAnonymous(this.cacheToken):this.enableCustomWebid?this.collect.on(Types$1.CustomWebId,(function(){e.tokenReady=!0,e.collect.emit(Types$1.TokenComplete)})):this.checkEnv()||(this.enableTTwebid?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!==_indexOfInstanceProperty(e).call(e,"miniProgram")||-1!==_indexOfInstanceProperty(e).call(e,"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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"SDK 发起WEBID请求",logType:"fetch",level:"info",time:Date.now(),data:r});var n=localWebId();fetch$1(t,this.collect.cryptoData(r),3e5,!1,(function(t){var r;t&&0===t.e?(r=t.web_id,e.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"WEBID请求成功",logType:"fetch",level:"info",time:Date.now(),data:t})):(r=n,e.collect.configManager.set({localWebId:n}),e.collect.emit(Types$1.TokenError),e.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"WEBID请求返回值异常",logType:"fetch",level:"warn",time:Date.now(),data:t}),e.collect.logger.warn("appid: "+e.config.app_id+" get webid error, use local webid~")),e.complete({web_id:e.configManager.get("web_id")||r,user_unique_id:e.configManager.get("user_unique_id")||r})}),(function(){e.complete({web_id:e.configManager.get("web_id")||n,user_unique_id:e.configManager.get("user_unique_id")||n}),e.collect.configManager.set({localWebId:n}),e.collect.emit(Types$1.TokenError),e.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"WEBID请求网络异常",logType:"fetch",level:"error",time:Date.now(),data:null}),e.collect.logger.warn("appid: "+e.config.app_id+", get webid error, use local webid~")}),"","",this.config.enable_encryption,this.config.encryption_header)},e.prototype.complete=function(e){var t=e.web_id,r=e.user_unique_id;if(!t&&!r)return this.collect.emit(Types$1.TokenError),void console.warn("token error");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.completeAnonymous=function(e){var t=e.anonymous_id||sessionId(),r=e.user_unique_id||this.configManager.get("user_unique_id");this.collect.configManager.set({anonymous_id:t,user_unique_id:r||t}),e.anonymous_id=t,e.user_unique_id=r||t,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");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){var t;if(e&&-1===_indexOfInstanceProperty(t=["null","undefined","Null","None"]).call(t,e)){var r=String(e),n=this.configManager.get("user_unique_id"),i=this.cacheToken&&this.cacheToken.user_unique_id;if(r===n&&r===i)return;this.configManager.set({user_unique_id:r}),this.cacheToken||(this.cacheToken={}),this.cacheToken.user_unique_id=r,this.cacheToken.timestamp=Date.now(),this.setStorage(this.cacheToken),this.collect.emit(Types$1.TokenChange,{type:"uuid",id:e}),this.collect.emit(Types$1.SessionReset)}else this.clearUuid()},e.prototype.clearUuid=function(){if(!this.config.enable_ttwebid){var e=this.enableAnonymousid?this.configManager.get("anonymous_id"):this.configManager.get("web_id");this.configManager.get("user_unique_id")!==e&&(this.configManager.set({user_unique_id:e}),this.cacheToken.user_unique_id=e,this.cacheToken.timestamp=Date.now(),this.setStorage(this.cacheToken),this.collect.emit(Types$1.TokenReset))}},e.prototype.setAnonymousId=function(e){if(e&&this.enableAnonymousid){var t=this.configManager.get("anonymous_id"),r=this.configManager.get("user_unique_id");t!==e&&(t!==r&&r||(this.configManager.set({user_unique_id:e}),this.cacheToken.user_unique_id=e,this.collect.emit(Types$1.TokenChange,{type:"uuid",id:e})),this.configManager.set({anonymous_id:e}),this.cacheToken.anonymous_id=e,this.collect.emit(Types$1.TokenChange,{type:"anonymous_id",id:e}),this.setStorage(this.cacheToken))}},e.prototype.setWebId=function(e){if(e&&!this.config.enable_ttwebid&&!this.enableAnonymousid){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.cacheToken.user_unique_id=e,this.collect.emit(Types$1.TokenChange,{type:"uuid",id:e})),t!==e&&(this.configManager.set({web_id:e}),this.cacheToken.web_id=e,this.collect.emit(Types$1.TokenChange,{type:"webid",id:e})),this.cacheToken.timestamp=Date.now(),this.setStorage(this.cacheToken)}},e.prototype.setStorage=function(e){var t;e._type_=this.enableCustomWebid?"custom":"default",delete e[_reverseInstanceProperty(t="diss".split("")).call(t).join("")],this.enableCookie||this.enableTTwebid?this.storage.setCookie(this.tokenKey,e,this.expiresTime,this.cookieDomain):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"),r={app_id:this.config.app_id,user_unique_id:this.configManager.get("user_unique_id"),user_unique_id_type:this.configManager.get("user_unique_id_type")};this.enableAnonymousid?r.anonymous_id=this.configManager.get("anonymous_id"):r.web_id=this.configManager.get("web_id");var n=this.collect.cryptoData(r);return new _Promise((function(r){fetch$1(t,n,3e4,e.enableTTwebid,(function(e){e&&0===e.e?r(e.tobid):r("")}),(function(){r("")}),"","",e.config.enable_encryption,e.config.encryption_header)}))},e}(),jsbn=createCommonjsModule((function(e,t){(function(){var t;function r(e,t,r){null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function n(){return new r(null)}var i="undefined"!=typeof navigator;i&&"Microsoft Internet Explorer"==navigator.appName?(r.prototype.am=function(e,t,r,n,i,o){for(var a=32767&t,s=t>>15;--o>=0;){var l=32767&this[e],c=this[e++]>>15,u=s*l+c*a;i=((l=a*l+((32767&u)<<15)+r[n]+(1073741823&i))>>>30)+(u>>>15)+s*c+(i>>>30),r[n++]=1073741823&l}return i},t=30):i&&"Netscape"!=navigator.appName?(r.prototype.am=function(e,t,r,n,i,o){for(;--o>=0;){var a=t*this[e++]+r[n]+i;i=Math.floor(a/67108864),r[n++]=67108863&a}return i},t=26):(r.prototype.am=function(e,t,r,n,i,o){for(var a=16383&t,s=t>>14;--o>=0;){var l=16383&this[e],c=this[e++]>>14,u=s*l+c*a;i=((l=a*l+((16383&u)<<14)+r[n]+i)>>28)+(u>>14)+s*c,r[n++]=268435455&l}return i},t=28),r.prototype.DB=t,r.prototype.DM=(1<<t)-1,r.prototype.DV=1<<t;r.prototype.FV=Math.pow(2,52),r.prototype.F1=52-t,r.prototype.F2=2*t-52;var o,a,s="0123456789abcdefghijklmnopqrstuvwxyz",l=new Array;for(o="0".charCodeAt(0),a=0;a<=9;++a)l[o++]=a;for(o="a".charCodeAt(0),a=10;a<36;++a)l[o++]=a;for(o="A".charCodeAt(0),a=10;a<36;++a)l[o++]=a;function c(e){return s.charAt(e)}function u(e,t){var r=l[e.charCodeAt(t)];return null==r?-1:r}function p(e){var t=n();return t.fromInt(e),t}function f(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function d(e){this.m=e}function h(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function y(e,t){return e&t}function g(e,t){return e|t}function _(e,t){return e^t}function v(e,t){return e&~t}function m(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function $(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function b(){}function S(e){return e}function E(e){this.r2=n(),this.q3=n(),r.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}d.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},d.prototype.revert=function(e){return e},d.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},d.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),_reduceInstanceProperty(this).call(this,r)},d.prototype.sqrTo=function(e,t){e.squareTo(t),_reduceInstanceProperty(this).call(this,t)},h.prototype.convert=function(e){var t=n();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(r.ZERO)>0&&this.m.subTo(t,t),t},h.prototype.revert=function(e){var t=n();return e.copyTo(t),_reduceInstanceProperty(this).call(this,t),t},h.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e[t],n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[r=t+this.m.t]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},h.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),_reduceInstanceProperty(this).call(this,r)},h.prototype.sqrTo=function(e,t){e.squareTo(t),_reduceInstanceProperty(this).call(this,t)},r.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},r.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},r.prototype.fromString=function(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var i=e.length,o=!1,a=0;--i>=0;){var s=8==n?255&e[i]:u(e,i);s<0?"-"==e.charAt(i)&&(o=!0):(o=!1,0==a?this[this.t++]=s:a+n>this.DB?(this[this.t-1]|=(s&(1<<this.DB-a)-1)<<a,this[this.t++]=s>>this.DB-a):this[this.t-1]|=s<<a,(a+=n)>=this.DB&&(a-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),o&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},r.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s},r.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s},r.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,o=(1<<i)-1,a=Math.floor(e/this.DB),s=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t[r+a+1]=this[r]>>i|s,s=(this[r]&o)<<n;for(r=a-1;r>=0;--r)t[r]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()},r.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<<n)-1;t[0]=this[r]>>n;for(var a=r+1;a<this.t;++a)t[a-r-1]|=(this[a]&o)<<i,t[a-r]=this[a]>>n;n>0&&(t[this.t-r-1]|=(this.s&o)<<i),t.t=this.t-r,t.clamp()}},r.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()},r.prototype.multiplyTo=function(e,t){var n=this.abs(),i=e.abs(),o=n.t;for(t.t=o+i.t;--o>=0;)t[o]=0;for(o=0;o<i.t;++o)t[o+n.t]=n.am(0,i[o],t,o,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&r.ZERO.subTo(t,t)},r.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()},r.prototype.divRemTo=function(e,t,i){var o=e.abs();if(!(o.t<=0)){var a=this.abs();if(a.t<o.t)return null!=t&&t.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=n());var s=n(),l=this.s,c=e.s,u=this.DB-f(o[o.t-1]);u>0?(o.lShiftTo(u,s),a.lShiftTo(u,i)):(o.copyTo(s),a.copyTo(i));var p=s.t,d=s[p-1];if(0!=d){var h=d*(1<<this.F1)+(p>1?s[p-2]>>this.F2:0),y=this.FV/h,g=(1<<this.F1)/h,_=1<<this.F2,v=i.t,m=v-p,$=null==t?n():t;for(s.dlShiftTo(m,$),i.compareTo($)>=0&&(i[i.t++]=1,i.subTo($,i)),r.ONE.dlShiftTo(p,$),$.subTo(s,s);s.t<p;)s[s.t++]=0;for(;--m>=0;){var b=i[--v]==d?this.DM:Math.floor(i[v]*y+(i[v-1]+_)*g);if((i[v]+=s.am(0,b,i,m,0,p))<b)for(s.dlShiftTo(m,$),i.subTo($,i);i[v]<--b;)i.subTo($,i)}null!=t&&(i.drShiftTo(p,t),l!=c&&r.ZERO.subTo(t,t)),i.t=p,i.clamp(),u>0&&i.rShiftTo(u,i),l<0&&r.ZERO.subTo(i,i)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},r.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},r.prototype.exp=function(e,t){if(e>4294967295||e<1)return r.ONE;var i=n(),o=n(),a=t.convert(this),s=f(e)-1;for(a.copyTo(i);--s>=0;)if(t.sqrTo(i,o),(e&1<<s)>0)t.mulTo(o,a,i);else{var l=i;i=o,o=l}return t.revert(i)},r.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,i=!1,o="",a=this.t,s=this.DB-a*this.DB%t;if(a-- >0)for(s<this.DB&&(r=this[a]>>s)>0&&(i=!0,o=c(r));a>=0;)s<t?(r=(this[a]&(1<<s)-1)<<t-s,r|=this[--a]>>(s+=this.DB-t)):(r=this[a]>>(s-=t)&n,s<=0&&(s+=this.DB,--a)),r>0&&(i=!0),i&&(o+=c(r));return i?o:"0"},r.prototype.negate=function(){var e=n();return r.ZERO.subTo(this,e),e},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+f(this[this.t-1]^this.s&this.DM)},r.prototype.mod=function(e){var t=n();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(r.ZERO)>0&&e.subTo(t,t),t},r.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new d(t):new h(t),this.exp(e,r)},r.ZERO=p(0),r.ONE=p(1),b.prototype.convert=S,b.prototype.revert=S,b.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},b.prototype.sqrTo=function(e,t){e.squareTo(t)},E.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=n();return e.copyTo(t),_reduceInstanceProperty(this).call(this,t),t},E.prototype.revert=function(e){return e},E.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},E.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),_reduceInstanceProperty(this).call(this,r)},E.prototype.sqrTo=function(e,t){e.squareTo(t),_reduceInstanceProperty(this).call(this,t)};var P,T,I,O=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],C=(1<<26)/O[O.length-1];function w(){var e;e=(new Date).getTime(),T[I++]^=255&e,T[I++]^=e>>8&255,T[I++]^=e>>16&255,T[I++]^=e>>24&255,I>=L&&(I-=L)}if(r.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},r.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),i=p(r),o=n(),a=n(),s="";for(this.divRemTo(i,o,a);o.signum()>0;)s=(r+a.intValue()).toString(e).substr(1)+s,o.divRemTo(i,o,a);return a.intValue().toString(e)+s},r.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),i=Math.pow(t,n),o=!1,a=0,s=0,l=0;l<e.length;++l){var c=u(e,l);c<0?"-"==e.charAt(l)&&0==this.signum()&&(o=!0):(s=t*s+c,++a>=n&&(this.dMultiply(i),this.dAddOffset(s,0),a=0,s=0))}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(s,0)),o&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(r.ONE.shiftLeft(e-1),g,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(r.ONE.shiftLeft(e-1),this);else{var i=new Array,o=7&e;i.length=1+(e>>3),t.nextBytes(i),o>0?i[0]&=(1<<o)-1:i[0]=0,this.fromString(i,256)}},r.prototype.bitwiseTo=function(e,t,r){var n,i,o=Math.min(e.t,this.t);for(n=0;n<o;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(i=e.s&this.DM,n=o;n<this.t;++n)r[n]=t(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<e.t;++n)r[n]=t(i,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},r.prototype.changeBit=function(e,t){var n=r.ONE.shiftLeft(e);return this.bitwiseTo(n,t,n),n},r.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()},r.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},r.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i<n;++i)r[i+this.t]=this.am(0,e[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e[i],r,i,0,t-i);r.clamp()},r.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},r.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r},r.prototype.millerRabin=function(e){var t=this.subtract(r.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var o=t.shiftRight(i);(e=e+1>>1)>O.length&&(e=O.length);for(var a=n(),s=0;s<e;++s){a.fromInt(O[Math.floor(Math.random()*O.length)]);var l=a.modPow(o,this);if(0!=l.compareTo(r.ONE)&&0!=l.compareTo(t)){for(var c=1;c++<i&&0!=l.compareTo(t);)if(0==(l=l.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=l.compareTo(t))return!1}}return!0},r.prototype.clone=function(){var e=n();return this.copyTo(e),e},r.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},r.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},r.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},r.prototype.equals=function(e){return 0==this.compareTo(e)},r.prototype.min=function(e){return this.compareTo(e)<0?this:e},r.prototype.max=function(e){return this.compareTo(e)>0?this:e},r.prototype.and=function(e){var t=n();return this.bitwiseTo(e,y,t),t},r.prototype.or=function(e){var t=n();return this.bitwiseTo(e,g,t),t},r.prototype.xor=function(e){var t=n();return this.bitwiseTo(e,_,t),t},r.prototype.andNot=function(e){var t=n();return this.bitwiseTo(e,v,t),t},r.prototype.not=function(){for(var e=n(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},r.prototype.shiftLeft=function(e){var t=n();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},r.prototype.shiftRight=function(e){var t=n();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},r.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+m(this[e]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=$(this[r]^t);return e},r.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)},r.prototype.setBit=function(e){return this.changeBit(e,g)},r.prototype.clearBit=function(e){return this.changeBit(e,v)},r.prototype.flipBit=function(e){return this.changeBit(e,_)},r.prototype.add=function(e){var t=n();return this.addTo(e,t),t},r.prototype.subtract=function(e){var t=n();return this.subTo(e,t),t},r.prototype.multiply=function(e){var t=n();return this.multiplyTo(e,t),t},r.prototype.divide=function(e){var t=n();return this.divRemTo(e,t,null),t},r.prototype.remainder=function(e){var t=n();return this.divRemTo(e,null,t),t},r.prototype.divideAndRemainder=function(e){var t=n(),r=n();return this.divRemTo(e,t,r),new Array(t,r)},r.prototype.modPow=function(e,t){var r,i,o=e.bitLength(),a=p(1);if(o<=0)return a;r=o<18?1:o<48?3:o<144?4:o<768?5:6,i=o<8?new d(t):t.isEven()?new E(t):new h(t);var s=new Array,l=3,c=r-1,u=(1<<r)-1;if(s[1]=i.convert(this),r>1){var y=n();for(i.sqrTo(s[1],y);l<=u;)s[l]=n(),i.mulTo(y,s[l-2],s[l]),l+=2}var g,_,v=e.t-1,m=!0,$=n();for(o=f(e[v])-1;v>=0;){for(o>=c?g=e[v]>>o-c&u:(g=(e[v]&(1<<o+1)-1)<<c-o,v>0&&(g|=e[v-1]>>this.DB+o-c)),l=r;0==(1&g);)g>>=1,--l;if((o-=l)<0&&(o+=this.DB,--v),m)s[g].copyTo(a),m=!1;else{for(;l>1;)i.sqrTo(a,$),i.sqrTo($,a),l-=2;l>0?i.sqrTo(a,$):(_=a,a=$,$=_),i.mulTo($,s[g],a)}for(;v>=0&&0==(e[v]&1<<o);)i.sqrTo(a,$),_=a,a=$,$=_,--o<0&&(o=this.DB-1,--v)}return i.revert(a)},r.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return r.ZERO;for(var n=e.clone(),i=this.clone(),o=p(1),a=p(0),s=p(0),l=p(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(o.isEven()&&a.isEven()||(o.addTo(this,o),a.subTo(e,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);for(;i.isEven();)i.rShiftTo(1,i),t?(s.isEven()&&l.isEven()||(s.addTo(this,s),l.subTo(e,l)),s.rShiftTo(1,s)):l.isEven()||l.subTo(e,l),l.rShiftTo(1,l);n.compareTo(i)>=0?(n.subTo(i,n),t&&o.subTo(s,o),a.subTo(l,a)):(i.subTo(n,i),t&&s.subTo(o,s),l.subTo(a,l))}return 0!=i.compareTo(r.ONE)?r.ZERO:l.compareTo(e)>=0?l.subtract(e):l.signum()<0?(l.addTo(e,l),l.signum()<0?l.add(e):l):l},r.prototype.pow=function(e){return this.exp(e,new b)},r.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},r.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r[0]<=O[O.length-1]){for(t=0;t<O.length;++t)if(r[0]==O[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<O.length;){for(var n=O[t],i=t+1;i<O.length&&n<C;)n*=O[i++];for(n=r.modInt(n);t<i;)if(n%O[t++]==0)return!1}return r.millerRabin(e)},r.prototype.square=function(){var e=n();return this.squareTo(e),e},r.prototype.Barrett=E,null==T){var A;if(T=new Array,I=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var R=new Uint8Array(32);for(window.crypto.getRandomValues(R),A=0;A<32;++A)T[I++]=R[A]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var k=window.crypto.random(32);for(A=0;A<k.length;++A)T[I++]=255&k.charCodeAt(A)}for(;I<L;)A=Math.floor(65536*Math.random()),T[I++]=A>>>8,T[I++]=255&A;I=0,w()}function D(){if(null==P){for(w(),(P=new N).init(T),I=0;I<T.length;++I)T[I]=0;I=0}return P.next()}function x(){}function N(){this.i=0,this.j=0,this.S=new Array}x.prototype.nextBytes=function(e){var t;for(t=0;t<e.length;++t)e[t]=D()},N.prototype.init=function(e){var t,r,n;for(t=0;t<256;++t)this.S[t]=t;for(r=0,t=0;t<256;++t)r=r+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[r],this.S[r]=n;this.i=0,this.j=0},N.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]};var L=256;e.exports={default:r,BigInteger:r,SecureRandom:x}}).call(commonjsGlobal)}));jsbn.BigInteger,jsbn.SecureRandom;var BigInteger$3=jsbn.BigInteger;function bigintToValue(e){var t=e.toString(16);if("-"!==t[0])t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var r=(t=t.substr(1)).length;r%2==1?r+=1:t.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i<r;i++)n+="f";t=(t=(n=new BigInteger$3(n,16)).xor(e).add(BigInteger$3.ONE)).toString(16).replace(/^-/,"")}return t}var ASN1Object=function(){function e(){_classCallCheck$1(this,e),this.tlv=null,this.t="00",this.l="00",this.v=""}return _createClass$2(e,[{key:"getEncodedHex",value:function(){return this.tlv||(this.v=this.getValue(),this.l=this.getLength(),this.tlv=this.t+this.l+this.v),this.tlv}},{key:"getLength",value:function(){var e=this.v.length/2,t=e.toString(16);return t.length%2==1&&(t="0"+t),e<128?t:(128+t.length/2).toString(16)+t}},{key:"getValue",value:function(){return""}}]),e}(),DERInteger=function(e){_inherits(r,ASN1Object);var t=_createSuper(r);function r(e){var n;return _classCallCheck$1(this,r),(n=t.call(this)).t="02",e&&(n.v=bigintToValue(e)),n}return _createClass$2(r,[{key:"getValue",value:function(){return this.v}}]),r}(),DERSequence=function(e){_inherits(r,ASN1Object);var t=_createSuper(r);function r(e){var n;return _classCallCheck$1(this,r),(n=t.call(this)).t="30",n.asn1Array=e,n}return _createClass$2(r,[{key:"getValue",value:function(){var e;return this.v=_mapInstanceProperty(e=this.asn1Array).call(e,(function(e){return e.getEncodedHex()})).join(""),this.v}}]),r}();function getLenOfL(e,t){return+e[t+2]<8?1:128&+e.substr(t+2,2)}function getL(e,t){var r=getLenOfL(e,t),n=e.substr(t+2,2*r);return n?(+n[0]<8?new BigInteger$3(n,16):new BigInteger$3(n.substr(2),16)).intValue():-1}function getStartOfV(e,t){return t+2*(getLenOfL(e,t)+1)}var asn1={encodeDer:function(e,t){var r=new DERInteger(e),n=new DERInteger(t);return new DERSequence([r,n]).getEncodedHex()},decodeDer:function(e){var t=getStartOfV(e,0),r=getStartOfV(e,t),n=getL(e,t),i=e.substr(r,2*n),o=r+i.length,a=getStartOfV(e,o),s=getL(e,o),l=e.substr(a,2*s);return{r:new BigInteger$3(i,16),s:new BigInteger$3(l,16)}}},BigInteger$2=jsbn.BigInteger,TWO=new BigInteger$2("2"),THREE=new BigInteger$2("3"),ECFieldElementFp=function(){function e(t,r){_classCallCheck$1(this,e),this.x=r,this.q=t}return _createClass$2(e,[{key:"equals",value:function(e){return e===this||this.q.equals(e.q)&&this.x.equals(e.x)}},{key:"toBigInteger",value:function(){return this.x}},{key:"negate",value:function(){return new e(this.q,this.x.negate().mod(this.q))}},{key:"add",value:function(t){return new e(this.q,this.x.add(t.toBigInteger()).mod(this.q))}},{key:"subtract",value:function(t){return new e(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))}},{key:"multiply",value:function(t){return new e(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))}},{key:"divide",value:function(t){return new e(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))}},{key:"square",value:function(){return new e(this.q,this.x.square().mod(this.q))}}]),e}(),ECPointFp=function(){function e(t,r,n,i){_classCallCheck$1(this,e),this.curve=t,this.x=r,this.y=n,this.z=null==i?BigInteger$2.ONE:i,this.zinv=null}return _createClass$2(e,[{key:"getX",value:function(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}},{key:"getY",value:function(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}},{key:"equals",value:function(e){return e===this||(this.isInfinity()?e.isInfinity():e.isInfinity()?this.isInfinity():!!e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(BigInteger$2.ZERO)&&e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(BigInteger$2.ZERO))}},{key:"isInfinity",value:function(){return null===this.x&&null===this.y||this.z.equals(BigInteger$2.ZERO)&&!this.y.toBigInteger().equals(BigInteger$2.ZERO)}},{key:"negate",value:function(){return new e(this.curve,this.x,this.y.negate(),this.z)}},{key:"add",value:function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=this.x.toBigInteger(),n=this.y.toBigInteger(),i=this.z,o=t.x.toBigInteger(),a=t.y.toBigInteger(),s=t.z,l=this.curve.q,c=r.multiply(s).mod(l),u=o.multiply(i).mod(l),p=c.subtract(u),f=n.multiply(s).mod(l),d=a.multiply(i).mod(l),h=f.subtract(d);if(BigInteger$2.ZERO.equals(p))return BigInteger$2.ZERO.equals(h)?this.twice():this.curve.infinity;var y=c.add(u),g=i.multiply(s).mod(l),_=p.square().mod(l),v=p.multiply(_).mod(l),m=g.multiply(h.square()).subtract(y.multiply(_)).mod(l),$=p.multiply(m).mod(l),b=h.multiply(_.multiply(c).subtract(m)).subtract(f.multiply(v)).mod(l),S=v.multiply(g).mod(l);return new e(this.curve,this.curve.fromBigInteger($),this.curve.fromBigInteger(b),S)}},{key:"twice",value:function(){if(this.isInfinity())return this;if(!this.y.toBigInteger().signum())return this.curve.infinity;var t=this.x.toBigInteger(),r=this.y.toBigInteger(),n=this.z,i=this.curve.q,o=this.curve.a.toBigInteger(),a=t.square().multiply(THREE).add(o.multiply(n.square())).mod(i),s=r.shiftLeft(1).multiply(n).mod(i),l=r.square().mod(i),c=l.multiply(t).multiply(n).mod(i),u=s.square().mod(i),p=a.square().subtract(c.shiftLeft(3)).mod(i),f=s.multiply(p).mod(i),d=a.multiply(c.shiftLeft(2).subtract(p)).subtract(u.shiftLeft(1).multiply(l)).mod(i),h=s.multiply(u).mod(i);return new e(this.curve,this.curve.fromBigInteger(f),this.curve.fromBigInteger(d),h)}},{key:"multiply",value:function(e){if(this.isInfinity())return this;if(!e.signum())return this.curve.infinity;for(var t=e.multiply(THREE),r=this.negate(),n=this,i=t.bitLength()-2;i>0;i--){n=n.twice();var o=t.testBit(i);o!==e.testBit(i)&&(n=n.add(o?this:r))}return n}}]),e}(),ECCurveFp$1=function(){function e(t,r,n){_classCallCheck$1(this,e),this.q=t,this.a=this.fromBigInteger(r),this.b=this.fromBigInteger(n),this.infinity=new ECPointFp(this,null,null)}return _createClass$2(e,[{key:"equals",value:function(e){return e===this||this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}},{key:"fromBigInteger",value:function(e){return new ECFieldElementFp(this.q,e)}},{key:"decodePointHex",value:function(e){switch(_parseInt$7(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var t=this.fromBigInteger(new BigInteger$2(e.substr(2),16)),r=this.fromBigInteger(t.multiply(t.square()).add(t.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new BigInteger$2("4")).add(BigInteger$2.ONE),this.q));return r.toBigInteger().mod(TWO).equals(new BigInteger$2(e.substr(0,2),16).subtract(TWO))||(r=r.negate()),new ECPointFp(this,t,r);case 4:case 6:case 7:var n=(e.length-2)/2,i=e.substr(2,n),o=e.substr(n+2,n);return new ECPointFp(this,this.fromBigInteger(new BigInteger$2(i,16)),this.fromBigInteger(new BigInteger$2(o,16)));default:return null}}}]),e}(),ec={ECPointFp:ECPointFp,ECCurveFp:ECCurveFp$1},BigInteger$1=jsbn.BigInteger,SecureRandom=jsbn.SecureRandom,ECCurveFp=ec.ECCurveFp,rng$1=new SecureRandom,_generateEcparam=generateEcparam(),curve$1=_generateEcparam.curve,G$1=_generateEcparam.G,n$1=_generateEcparam.n;function getGlobalCurve(){return curve$1}function generateEcparam(){var e=new BigInteger$1("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF",16),t=new BigInteger$1("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC",16),r=new BigInteger$1("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93",16),n=new ECCurveFp(e,t,r),i=n.decodePointHex("0432C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0");return{curve:n,G:i,n:new BigInteger$1("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123",16)}}function generateKeyPairHex(e,t,r){var n=(e?new BigInteger$1(e,t,r):new BigInteger$1(n$1.bitLength(),rng$1)).mod(n$1.subtract(BigInteger$1.ONE)).add(BigInteger$1.ONE),i=leftPad$1(n.toString(16),64),o=G$1.multiply(n);return{privateKey:i,publicKey:"04"+leftPad$1(o.getX().toBigInteger().toString(16),64)+leftPad$1(o.getY().toBigInteger().toString(16),64)}}function compressPublicKeyHex(e){if(130!==e.length)throw new Error("Invalid public key to compress");var t=(e.length-2)/2,r=e.substr(2,t),n="03";return new BigInteger$1(e.substr(t+2,t),16).mod(new BigInteger$1("2")).equals(BigInteger$1.ZERO)&&(n="02"),n+r}function utf8ToHex(e){for(var t=(e=unescape(encodeURIComponent(e))).length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;for(var i=[],o=0;o<t;o++){var a=r[o>>>2]>>>24-o%4*8&255;i.push((a>>>4).toString(16)),i.push((15&a).toString(16))}return i.join("")}function leftPad$1(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e}function arrayToHex(e){return _mapInstanceProperty(e).call(e,(function(e){return 1===(e=e.toString(16)).length?"0"+e:e})).join("")}function arrayToUtf8$1(e){for(var t=[],r=0,n=0;n<2*e.length;n+=2)t[n>>>3]|=_parseInt$7(e[r],10)<<24-n%8*4,r++;try{for(var i=[],o=0;o<e.length;o++){var a=t[o>>>2]>>>24-o%4*8&255;i.push(String.fromCharCode(a))}return decodeURIComponent(escape(i.join("")))}catch(e){throw new Error("Malformed UTF-8 data")}}function hexToArray$2(e){var t=[],r=e.length;r%2!=0&&(e=leftPad$1(e,r+1)),r=e.length;for(var n=0;n<r;n+=2)t.push(_parseInt$7(e.substr(n,2),16));return t}function verifyPublicKey(e){var t=curve$1.decodePointHex(e);if(!t)return!1;var r=t.getX();return t.getY().square().equals(r.multiply(r.square()).add(r.multiply(curve$1.a)).add(curve$1.b))}function comparePublicKeyHex(e,t){var r=curve$1.decodePointHex(e);if(!r)return!1;var n=curve$1.decodePointHex(t);return!!n&&r.equals(n)}var utils={getGlobalCurve:getGlobalCurve,generateEcparam:generateEcparam,generateKeyPairHex:generateKeyPairHex,compressPublicKeyHex:compressPublicKeyHex,utf8ToHex:utf8ToHex,leftPad:leftPad$1,arrayToHex:arrayToHex,arrayToUtf8:arrayToUtf8$1,hexToArray:hexToArray$2,verifyPublicKey:verifyPublicKey,comparePublicKeyHex:comparePublicKeyHex},W=new Uint32Array(68),M=new Uint32Array(64);function rotl$1(e,t){var r=31&t;return e<<r|e>>>32-r}function xor(e,t){for(var r=[],n=e.length-1;n>=0;n--)r[n]=255&(e[n]^t[n]);return r}function P0(e){return e^rotl$1(e,9)^rotl$1(e,17)}function P1(e){return e^rotl$1(e,15)^rotl$1(e,23)}function sm3$2(e){var t,r=8*e.length,n=r%512;n=n>=448?512-n%448-1:448-n-1;for(var i=new Array((n-7)/8),o=new Array(8),a=0,s=i.length;a<s;a++)i[a]=0;for(var l=0,c=o.length;l<c;l++)o[l]=0;r=r.toString(2);for(var u=7;u>=0;u--)if(r.length>8){var p=r.length-8;o[u]=_parseInt$7(r.substr(p),2),r=r.substr(0,p)}else r.length>0&&(o[u]=_parseInt$7(r,2),r="");for(var f=new Uint8Array(_concatInstanceProperty(t=[]).call(t,_toConsumableArray$1(e),[128],i,o)),d=new DataView(f.buffer,0),h=f.length/64,y=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]),g=0;g<h;g++){_fillInstanceProperty(W).call(W,0),_fillInstanceProperty(M).call(M,0);for(var _=16*g,v=0;v<16;v++)W[v]=d.getUint32(4*(_+v),!1);for(var m=16;m<68;m++)W[m]=P1(W[m-16]^W[m-9]^rotl$1(W[m-3],15))^rotl$1(W[m-13],7)^W[m-6];for(var $=0;$<64;$++)M[$]=W[$]^W[$+4];for(var b=y[0],S=y[1],E=y[2],P=y[3],T=y[4],I=y[5],O=y[6],C=y[7],w=void 0,A=void 0,R=void 0,k=void 0,D=0;D<64;D++)k=D>=0&&D<=15?2043430169:2055708042,A=(D>=0&&D<=15?b^S^E:b&S|b&E|S&E)+P+((w=rotl$1(rotl$1(b,12)+T+rotl$1(k,D),7))^rotl$1(b,12))+M[D],R=(D>=0&&D<=15?T^I^O:T&I|~T&O)+C+w+W[D],P=E,E=rotl$1(S,9),S=b,b=A,C=O,O=rotl$1(I,19),I=T,T=P0(R);y[0]^=b,y[1]^=S,y[2]^=E,y[3]^=P,y[4]^=T,y[5]^=I,y[6]^=O,y[7]^=C}for(var x=[],N=0,L=y.length;N<L;N++){var F=y[N];x.push((4278190080&F)>>>24,(16711680&F)>>>16,(65280&F)>>>8,255&F)}return x}for(var blockLen=64,iPad=new Uint8Array(blockLen),oPad=new Uint8Array(blockLen),i$1=0;i$1<blockLen;i$1++)iPad[i$1]=54,oPad[i$1]=92;function hmac$1(e,t){var r,n;for(t.length>blockLen&&(t=sm3$2(t));t.length<blockLen;)t.push(0);var i=xor(t,iPad),o=xor(t,oPad),a=sm3$2(_concatInstanceProperty(r=[]).call(r,_toConsumableArray$1(i),_toConsumableArray$1(e)));return sm3$2(_concatInstanceProperty(n=[]).call(n,_toConsumableArray$1(o),_toConsumableArray$1(a)))}var sm3_1$1={sm3:sm3$2,hmac:hmac$1},BigInteger=jsbn.BigInteger,encodeDer2=asn1.encodeDer,decodeDer2=asn1.decodeDer,sm3$1=sm3_1$1.sm3,_utils$generateEcpara=utils.generateEcparam(),G=_utils$generateEcpara.G,curve=_utils$generateEcpara.curve,n=_utils$generateEcpara.n,C1C2C3=0;function doEncrypt(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e="string"==typeof e?utils.hexToArray(utils.utf8ToHex(e)):_sliceInstanceProperty(Array.prototype).call(e),t=utils.getGlobalCurve().decodePointHex(t);var o=utils.generateKeyPairHex(),a=new BigInteger(o.privateKey,16),s=o.publicKey;s.length>128&&(s=s.substr(s.length-128));var l=t.multiply(a),c=utils.hexToArray(utils.leftPad(l.getX().toBigInteger().toRadix(16),64)),u=utils.hexToArray(utils.leftPad(l.getY().toBigInteger().toRadix(16),64)),p=utils.arrayToHex(sm3$1(_concatInstanceProperty(r=[]).call(r,c,e,u))),f=1,d=0,h=[],y=_concatInstanceProperty(n=[]).call(n,c,u),g=function(){var e;h=sm3$1(_concatInstanceProperty(e=[]).call(e,_toConsumableArray$1(y),[f>>24&255,f>>16&255,f>>8&255,255&f])),f++,d=0};g();for(var _=0,v=e.length;_<v;_++)d===h.length&&g(),e[_]^=255&h[d++];var m=utils.arrayToHex(e);return i===C1C2C3?s+m+p:s+p+m}function doDecrypt(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).output,a=void 0===o?"string":o;t=new BigInteger(t,16);var s=e.substr(128,64),l=e.substr(192);i===C1C2C3&&(s=e.substr(e.length-64),l=e.substr(128,e.length-128-64));var c=utils.hexToArray(l),u=utils.getGlobalCurve().decodePointHex("04"+e.substr(0,128)).multiply(t),p=utils.hexToArray(utils.leftPad(u.getX().toBigInteger().toRadix(16),64)),f=utils.hexToArray(utils.leftPad(u.getY().toBigInteger().toRadix(16),64)),d=1,h=0,y=[],g=_concatInstanceProperty(r=[]).call(r,p,f),_=function(){var e;y=sm3$1(_concatInstanceProperty(e=[]).call(e,_toConsumableArray$1(g),[d>>24&255,d>>16&255,d>>8&255,255&d])),d++,h=0};_();for(var v=0,m=c.length;v<m;v++)h===y.length&&_(),c[v]^=255&y[h++];return utils.arrayToHex(sm3$1(_concatInstanceProperty(n=[]).call(n,p,c,f)))===s.toLowerCase()?"array"===a?c:utils.arrayToUtf8(c):"array"===a?[]:""}function doSignature(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.pointPool,o=r.der,a=r.hash,s=r.publicKey,l=r.userId,c="string"==typeof e?utils.utf8ToHex(e):utils.arrayToHex(e);a&&(c=getHash(c,s=s||getPublicKeyFromPrivateKey(t),l));var u=new BigInteger(t,16),p=new BigInteger(c,16),f=null,d=null,h=null;do{do{var y=void 0;f=(y=i&&i.length?i.pop():getPoint()).k,d=p.add(y.x1).mod(n)}while(d.equals(BigInteger.ZERO)||d.add(f).equals(n));h=u.add(BigInteger.ONE).modInverse(n).multiply(f.subtract(d.multiply(u))).mod(n)}while(h.equals(BigInteger.ZERO));return o?encodeDer2(d,h):utils.leftPad(d.toString(16),64)+utils.leftPad(h.toString(16),64)}function doVerifySignature(e,t,r){var i,o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=a.der,l=a.hash,c=a.userId,u="string"==typeof e?utils.utf8ToHex(e):utils.arrayToHex(e);if(l&&(u=getHash(u,r,c)),s){var p=decodeDer2(t);i=p.r,o=p.s}else i=new BigInteger(t.substring(0,64),16),o=new BigInteger(t.substring(64),16);var f=curve.decodePointHex(r),d=new BigInteger(u,16),h=i.add(o).mod(n);if(h.equals(BigInteger.ZERO))return!1;var y=G.multiply(o).add(f.multiply(h)),g=d.add(y.getX().toBigInteger()).mod(n);return i.equals(g)}function getHash(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"1234567812345678";r=utils.utf8ToHex(r);var n,i,o=utils.leftPad(G.curve.a.toBigInteger().toRadix(16),64),a=utils.leftPad(G.curve.b.toBigInteger().toRadix(16),64),s=utils.leftPad(G.getX().toBigInteger().toRadix(16),64),l=utils.leftPad(G.getY().toBigInteger().toRadix(16),64);if(128===t.length)n=t.substr(0,64),i=t.substr(64,64);else{var c=G.curve.decodePointHex(t);n=utils.leftPad(c.getX().toBigInteger().toRadix(16),64),i=utils.leftPad(c.getY().toBigInteger().toRadix(16),64)}var u=utils.hexToArray(r+o+a+s+l+n+i),p=4*r.length;u.unshift(255&p),u.unshift(p>>8&255);var f=sm3$1(u);return utils.arrayToHex(sm3$1(_concatInstanceProperty(f).call(f,utils.hexToArray(e))))}function getPublicKeyFromPrivateKey(e){var t=G.multiply(new BigInteger(e,16));return"04"+utils.leftPad(t.getX().toBigInteger().toString(16),64)+utils.leftPad(t.getY().toBigInteger().toString(16),64)}function getPoint(){var e=utils.generateKeyPairHex(),t=curve.decodePointHex(e.publicKey);return e.k=new BigInteger(e.privateKey,16),e.x1=t.getX().toBigInteger(),e}var sm2={generateKeyPairHex:utils.generateKeyPairHex,compressPublicKeyHex:utils.compressPublicKeyHex,comparePublicKeyHex:utils.comparePublicKeyHex,doEncrypt:doEncrypt,doDecrypt:doDecrypt,doSignature:doSignature,doVerifySignature:doVerifySignature,getPoint:getPoint,verifyPublicKey:utils.verifyPublicKey},sm3=sm3_1$1.sm3,hmac=sm3_1$1.hmac;function leftPad(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e}function ArrayToHex$1(e){return _mapInstanceProperty(e).call(e,(function(e){return 1===(e=e.toString(16)).length?"0"+e:e})).join("")}function hexToArray$1(e){var t=[],r=e.length;r%2!=0&&(e=leftPad(e,r+1)),r=e.length;for(var n=0;n<r;n+=2)t.push(_parseInt$7(e.substr(n,2),16));return t}function utf8ToArray$1(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=_codePointAtInstanceProperty(e).call(e,r);if(i<=127)t.push(i);else if(i<=2047)t.push(192|i>>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}var sm3_1=function(e,t){if(e="string"==typeof e?utf8ToArray$1(e):_sliceInstanceProperty(Array.prototype).call(e),t){if("hmac"!==(t.mode||"hmac"))throw new Error("invalid mode");var r=t.key;if(!r)throw new Error("invalid key");return r="string"==typeof r?hexToArray$1(r):_sliceInstanceProperty(Array.prototype).call(r),ArrayToHex$1(hmac(e,r))}return ArrayToHex$1(sm3(e))},DECRYPT=0,ROUND=32,BLOCK=16,Sbox=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],CK=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function hexToArray2(e){for(var t=[],r=0,n=e.length;r<n;r+=2)t.push(_parseInt$7(e.substr(r,2),16));return t}function ArrayToHex(e){return _mapInstanceProperty(e).call(e,(function(e){return 1===(e=e.toString(16)).length?"0"+e:e})).join("")}function utf8ToArray(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=_codePointAtInstanceProperty(e).call(e,r);if(i<=127)t.push(i);else if(i<=2047)t.push(192|i>>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function arrayToUtf8(e){for(var t=[],r=0,n=e.length;r<n;r++)e[r]>=240&&e[r]<=247?(t.push(_String$fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(_String$fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(_String$fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(_String$fromCodePoint(e[r]));return t.join("")}function rotl(e,t){return e<<t|e>>>32-t}function byteSub(e){return(255&Sbox[e>>>24&255])<<24|(255&Sbox[e>>>16&255])<<16|(255&Sbox[e>>>8&255])<<8|255&Sbox[255&e]}function l1(e){return e^rotl(e,2)^rotl(e,10)^rotl(e,18)^rotl(e,24)}function l2(e){return e^rotl(e,13)^rotl(e,23)}function sms4Crypt(e,t,r){for(var n=new Array(4),i=new Array(4),o=0;o<4;o++)i[0]=255&e[4*o],i[1]=255&e[4*o+1],i[2]=255&e[4*o+2],i[3]=255&e[4*o+3],n[o]=i[0]<<24|i[1]<<16|i[2]<<8|i[3];for(var a,s=0;s<32;s+=4)a=n[1]^n[2]^n[3]^r[s+0],n[0]^=l1(byteSub(a)),a=n[2]^n[3]^n[0]^r[s+1],n[1]^=l1(byteSub(a)),a=n[3]^n[0]^n[1]^r[s+2],n[2]^=l1(byteSub(a)),a=n[0]^n[1]^n[2]^r[s+3],n[3]^=l1(byteSub(a));for(var l=0;l<16;l+=4)t[l]=n[3-l/4]>>>24&255,t[l+1]=n[3-l/4]>>>16&255,t[l+2]=n[3-l/4]>>>8&255,t[l+3]=255&n[3-l/4]}function sms4KeyExt(e,t,r){for(var n=new Array(4),i=new Array(4),o=0;o<4;o++)i[0]=255&e[0+4*o],i[1]=255&e[1+4*o],i[2]=255&e[2+4*o],i[3]=255&e[3+4*o],n[o]=i[0]<<24|i[1]<<16|i[2]<<8|i[3];n[0]^=2746333894,n[1]^=1453994832,n[2]^=1736282519,n[3]^=2993693404;for(var a,s=0;s<32;s+=4)a=n[1]^n[2]^n[3]^CK[s+0],t[s+0]=n[0]^=l2(byteSub(a)),a=n[2]^n[3]^n[0]^CK[s+1],t[s+1]=n[1]^=l2(byteSub(a)),a=n[3]^n[0]^n[1]^CK[s+2],t[s+2]=n[2]^=l2(byteSub(a)),a=n[0]^n[1]^n[2]^CK[s+3],t[s+3]=n[3]^=l2(byteSub(a));if(r===DECRYPT)for(var l,c=0;c<16;c++)l=t[c],t[c]=t[31-c],t[31-c]=l}function sm4(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=n.padding,o=void 0===i?"pkcs#7":i,a=n.mode,s=n.iv,l=void 0===s?[]:s,c=n.output,u=void 0===c?"string":c;if("cbc"===a&&("string"==typeof l&&(l=hexToArray2(l)),16!==l.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=hexToArray2(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?r!==DECRYPT?utf8ToArray(e):hexToArray2(e):_toConsumableArray$1(e),("pkcs#5"===o||"pkcs#7"===o)&&r!==DECRYPT)for(var p=BLOCK-e.length%BLOCK,f=0;f<p;f++)e.push(p);var d=new Array(ROUND);sms4KeyExt(t,d,r);for(var h=[],y=l,g=e.length,_=0;g>=BLOCK;){var v=_sliceInstanceProperty(e).call(e,_,_+16),m=new Array(16);if("cbc"===a)for(var $=0;$<BLOCK;$++)r!==DECRYPT&&(v[$]^=y[$]);sms4Crypt(v,m,d);for(var b=0;b<BLOCK;b++)"cbc"===a&&r===DECRYPT&&(m[b]^=y[b]),h[_+b]=m[b];"cbc"===a&&(y=r!==DECRYPT?m:v),g-=BLOCK,_+=BLOCK}if(("pkcs#5"===o||"pkcs#7"===o)&&r===DECRYPT){for(var S=h.length,E=h[S-1],P=1;P<=E;P++)if(h[S-P]!==E)throw new Error("padding is invalid");_spliceInstanceProperty(h).call(h,S-E,E)}return"array"!==u?r!==DECRYPT?ArrayToHex(h):arrayToUtf8(h):h}var sm4_1={encrypt:function(e,t,r){return sm4(e,t,1,r)},decrypt:function(e,t,r){return sm4(e,t,0,r)}},src={sm2:sm2,sm3:sm3_1,sm4:sm4_1},src_1=src.sm2;function Encrypt(e,t,r){return void 0===r&&(r=1),"04"+src_1.doEncrypt(e,t,r)}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.adapters={},this.sdkReady=!1,this.name=e,this.hook=new Hook,this.logger=new Logger$1(e),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.init=function(t){var r,n=this;this.inited?console.log("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!==_indexOfInstanceProperty(r=["cn","sg","va"]).call(r,t.channel)||(console.warn("channel must be `cn`, `sg`,`va` !!!"),t.channel="cn"),this.logger=new Logger$1(this.name,t.log),this.configManager=new ConfigManager(this,t),this.appBridge=new AppBridge(t,this.configManager),this.bridgeReport=this.appBridge.bridgeInject(),this.initConfig=t,this.env=t.channel_domain?"self":"public",this.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"SDK 执行INIT",data:t,level:"info",time:Date.now()}),t.disable_auto_pv&&(this.disableAutoPageView=!0),this.bridgeReport?(this.inited=!0,this.emit(Types$1.Init)):(t.enable_encryption&&"sm"===t.encryption_type&&this.initCrypto(),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){n.once(Types$1.TokenComplete,(function(){e(!0)}))})),new _Promise((function(e){n.once(Types$1.Start,(function(){e(!0)}))}))]).then((function(){try{var r;_reduceInstanceProperty(r=e.plugins).call(r,(function(e,t){var r=t.plugin,i=t.options,o=_Object$assign(n.initConfig,i),a=new r;return a.apply(n,o),e.push(a),e}),n.pluginInstances)}catch(e){console.log("load plugin error, "+e.message),n.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.message})}n.sdkReady=!0,n.emit(Types$1.Ready),n.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"SDK 初始化完成",time:Date.now(),level:"info",data:n.configManager.get("user")}),n.logger.info("appid: "+t.app_id+", userInfo:"+_JSON$stringify(n.configManager.get("user"))),n.logger.info("appid: "+t.app_id+", sdk is ready, version is "+SDK_VERSION+", you can report now !!!");try{(window.opener||window.parent).postMessage("[tea-sdk]ready","*")}catch(e){n.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.message})}n.pageView(),n.on(Types$1.TokenChange,(function(e){"webid"!==e.type&&"anonymous_id"!==e.type||n.pageView(),n.logger.info("appid: "+t.app_id+" token change, new userInfo:"+_JSON$stringify(n.configManager.get("user"))),n.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"SDK 设置了用户信息",time:Date.now(),secType:"USER",level:"info",data:n.configManager.get("user")})})),n.on(Types$1.TokenReset,(function(){n.logger.info("appid: "+t.app_id+" token reset, new userInfo:"+_JSON$stringify(n.configManager.get("user"))),n.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"SDK 重置了用户信息",time:Date.now(),secType:"USER",level:"info",data:n.configManager.get("user")})})),n.on(Types$1.RouteChange,(function(e){e.init||t.disable_route_report||n.pageView()}))})),this.tokenManager.apply(this,t),this.eventManager.apply(this,t),this.sessionManager.apply(this,t),this.inited=!0,this.emit(Types$1.Init))):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")},e.prototype.config=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=_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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"SDK 执行CONFIG",level:"info",time:Date.now(),data:t})}else this.logger.warn("config params is error, please check");else this.logger.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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.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{if(this.initConfig&&this.initConfig.disable_track_event)return;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(e){this.logger.warn("something error, please check"),this.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.message})}},e.prototype.beconEvent=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=[],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=_sliceInstanceProperty(e).call(e,6));var n=t;"object"!==_typeof$1(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(r){return this.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:r.message}),{event:e,params:t}}},e.prototype.dynamicParams=function(e){this.dynamicParamsFilter=e},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){if(void 0===e&&(e={}),this.inited){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&&this.configManager.is_first_time||!1)},r=_assign({},t,e);this.event("predefine_pageview",r)}else console.warn("predefinePageView should call after init")},e.prototype.clearEventCache=function(){this.emit(Types$1.CleanEvents)},e.prototype.setWebIDviaUnionID=function(e){if(e){var t=hashCode$1(e);this.config({web_id:""+t,wechat_unionid:e}),this.emit(Types$1.CustomWebId)}},e.prototype.setWebIDviaOpenID=function(e){if(e){var t=hashCode$1(e);this.config({web_id:""+t,wechat_openid:e}),this.emit(Types$1.CustomWebId)}},e.prototype.setAnonymousId=function(e){this.emit(Types$1.AnonymousId,e)},e.prototype.setNativeAppId=function(e){this.bridgeReport&&this.appBridge.setNativeAppId(e)},e.prototype.resetStayDuration=function(e,t,r){void 0===e&&(e=""),void 0===t&&(t=""),void 0===r&&(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;if(this.inited){var n=!1,i=function(t){if(!n){n=!0;var i,o=r.configManager.get().user;if(t)o.tobid=t,o[_reverseInstanceProperty(i="diss".split("")).call(i).join("")]=t;return e(_assign({},o))}},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()})))}else this.logger.warn("getToken must be use after function init")},e.prototype.startTrackEvent=function(e){e&&this.emit(Types$1.TrackDurationStart,e,Types$1.TrackDuration)},e.prototype.endTrackEvent=function(e,t){void 0===t&&(t={}),e&&this.emit(Types$1.TrackDurationEnd,{eventName:e,params:t},Types$1.TrackDuration)},e.prototype.pauseTrackEvent=function(e){e&&this.emit(Types$1.TrackDurationPause,e,Types$1.TrackDuration)},e.prototype.resumeTrackEvent=function(e){e&&this.emit(Types$1.TrackDurationResume,e,Types$1.TrackDuration)},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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.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.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"SDK 执行profileAppend",level:"info",time:Date.now(),data:e})},e.prototype.setExternalAbVersion=function(e){var t;this.bridgeReport?this.appBridge.setExternalAbVersion(e):this.emit(Types$1.AbExternalVersion,"string"==typeof e&&e?_trimInstanceProperty(t=""+e).call(t):null,Types$1.Ab)},e.prototype.getVar=function(e,t,r){this.bridgeReport?this.appBridge.getVar(e,t,r):this.emit(Types$1.AbVar,{name:e,defaultValue:t,callback:r},Types$1.Ab)},e.prototype.getAllVars=function(e){this.bridgeReport?this.appBridge.getAllVars(e):this.emit(Types$1.AbAllVars,e,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(e){if(!this.bridgeReport||!e)return this.configManager.getAbVersion()||"";this.appBridge.getAbSdkVersion(e)},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.initCrypto=function(){this.publicKey=this.initConfig.crypto_publicKey||"04BA9E229380DC0E41E10839B0C52A4763D3EDFE8903F3B8E81395523381E03AA995D295BD4A4088792E4785B224F7837EB4D2C7C05973C7AE8687A35ACAE470A0"},e.prototype.cryptoData=function(e){try{if(!this.initConfig.enable_encryption)return e;var t=void 0;if("sm"===this.initConfig.encryption_type){var r=Encrypt(_JSON$stringify(e),this.publicKey,1),n=hexToArray$3(r);t=new Uint8Array(n)}else t="data="+encodeBase64(_JSON$stringify(e));return t}catch(t){return e}},e.prototype.destoryInstace=function(){this.destroyInstance||(this.destroyInstance=!0,this.off(Types$1.TokenComplete))},e.plugins=[],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,!0),i=this.collect.cryptoData(n),o=this.collect.configManager.getUrl("profile");this.fetch(o,i,1e5,!1,(function(){}),(function(){}),"","POST",this.config.enable_encryption,this.config.encryption_header),this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_EVENT,info:"埋点上报成功",time:Date.now(),data:n,code:200,status:"success"})}catch(e){this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.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){var n;"string"==typeof e[r]||"Array"===_sliceInstanceProperty(n=Object.prototype.toString.call(e[r])).call(n,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{var n;if(!e||"[object Object]"!==Object.prototype.toString.call(e))return void console.warn("please check the params type, must be object !!!");var i={};for(var o in e){var a;"string"==typeof e[o]||"number"==typeof e[o]||"Array"===_sliceInstanceProperty(a=Object.prototype.toString.call(e[o])).call(a,8,-1)?i[o]=e[o]:console.warn("please check the value of params:"+o+", must be string,number,Array !!!")}var s=_Object$keys(i);if(!s.length)return;var l=Date.now();return _reduceInstanceProperty(n=_filterInstanceProperty(s).call(s,(function(n){var i=r.cache[n];return t?!i:!(i&&r.compare(i.val,e[n])&&l-i.timestamp<r.duration)}))).call(n,(function(e,t){return e[t]=i[t],e}),{})}catch(e){this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.message}),console.log("error")}},e.prototype.compare=function(e,t){try{return _JSON$stringify(e)===_JSON$stringify(t)}catch(e){return this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.DEBUGGER_MESSAGE_SDK,info:"发生了异常",level:"error",time:Date.now(),data:e.message}),!1}},e.prototype.clone=function(e){try{return JSON.parse(_JSON$stringify(e))}catch(t){return this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE,{type:DebuggerMesssge.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&&!this.config.disable_track_event&&!this.config.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:"TOB"}),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(e){}},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:_mapInstanceProperty(a).call(a,(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(e){}},e}(),VerifyH=function(){function e(){this.verifyReady=!1,this.cleanStatus=!1}return e.prototype.apply=function(e,t){var r=this;this.collector=e,this.config=t,this.eventStorage=[],this.collector.on("submit-verify-h5",(function(e){e&&e.length&&r.eventStore(e[0])})),this.checkUrl(),this.heartbeat()},e.prototype.checkUrl=function(){var e=window.location.href,t=parseUrlQuery(e);t._r_d_&&t._r_c_k_?(this.verifyReady=!0,this.domain=t._r_d_,this.key=t._r_c_k_,this.checkCache()):this.collector.off("submit-verify-h5")},e.prototype.checkCache=function(){this.eventStorage.length&&this.postVerify(this.eventStorage)},e.prototype.heartbeat=function(){var e=this;this.heart=setInterval((function(){var t={event:"simulator_test__",local_time_ms:Date.now()},r=e.collector.configManager.get(),n=r.header,i={events:[t],user:r.user,header:n};e.eventStore(i)}),6e4)},e.prototype.eventStore=function(e){this.cleanStatus||(this.verifyReady?this.postVerify(e):this.eventStorage.push(e))},e.prototype.cleanVerify=function(){this.cleanStatus=!0,this.eventStorage=[],clearInterval(this.heart)},e.prototype.postVerify=function(e){var t=this;try{var r=JSON.parse(_JSON$stringify(e));isArray2(e)?r.forEach((function(e){t.fetchLog(e)})):this.fetchLog(r)}catch(e){console.log("web verify post error ~")}},e.prototype.fetchLog=function(e){fetch$1(this.domain+"/simulator/h5/log?connection_key="+this.key,e,2e4,!1)},e.prototype.leave=function(){var e=this;document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e.cleanVerify()})),beforePageUnload((function(){e.cleanVerify()}))},e}();Collector$1.usePlugin(VerifyH,"verifyH"),Collector$1.usePlugin(Profile,"profile"),Collector$1.usePlugin(HeartBeat,"heartbeat"),Collector$1.usePlugin(Monitor,"monitor");var getRandomValues,SDK=new Collector$1("default"),rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&!(getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}for(var byteToHex=[],i=0;i<256;++i){var _context$1;byteToHex.push(_sliceInstanceProperty(_context$1=(i+256).toString(16)).call(_context$1,1))}function unsafeStringify(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return byteToHex[e[t+0]]+byteToHex[e[t+1]]+byteToHex[e[t+2]]+byteToHex[e[t+3]]+"-"+byteToHex[e[t+4]]+byteToHex[e[t+5]]+"-"+byteToHex[e[t+6]]+byteToHex[e[t+7]]+"-"+byteToHex[e[t+8]]+byteToHex[e[t+9]]+"-"+byteToHex[e[t+10]]+byteToHex[e[t+11]]+byteToHex[e[t+12]]+byteToHex[e[t+13]]+byteToHex[e[t+14]]+byteToHex[e[t+15]]}var randomUUID="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),native={randomUUID:randomUUID};function v4(e,t,r){if(native.randomUUID&&!t&&!e)return native.randomUUID();var n=(e=e||{}).random||(e.rng||rng)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return unsafeStringify(n)}var DEVICE_ID_KEY="veplayer_live_device_id",USER_ID_Key="veplayer_live_user_id",genRandomID2=function(e){return Math.floor((9*Math.random()+1)*Math.pow(10,e-1)).toString()},getDeviceID2=function(){var e=localStorage.getItem(DEVICE_ID_KEY);return e||(e=genRandomID2(11),localStorage.setItem(DEVICE_ID_KEY,e),e)},getUserId2=function(){var e=localStorage.getItem(USER_ID_Key);return e||(e=genRandomID2(12),localStorage.setItem(USER_ID_Key,e),e)},generateUrlWithSessionId=function(e){var t=util.getUrlObject(e);return t?null!=t&&t.searchParams.get("_session_id")?e:util.appendSearchParams(e,{_session_id:generateSessionId()}):null!=e?e:""},hashCode2=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},generateSessionId=function(){return v4().replace(/-/g,"")+"."+Date.now()+"."+hashCode2(v4().replace(/-/g,""))},Logger=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(){var e,n;_classCallCheck$1(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$2(_assertThisInitialized(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,o))),"_userId",void 0),_defineProperty$2(_assertThisInitialized(n),"_deviceId",void 0),_defineProperty$2(_assertThisInitialized(n),"_liveLogger",void 0),n}return _createClass$2(r,[{key:"afterCreate",value:function(){var e,t;this.config.enable&&(this.config.appId?(this._userId=(null===(e=this.config)||void 0===e?void 0:e.userId)||getUserId2(),this._deviceId=(null===(t=this.config)||void 0===t?void 0:t.deviceId)||getDeviceID2(),this.open()):console.info("not found appId, please generate an appId"))}},{key:"destroy",value:function(){this.close()}},{key:"close",value:function(){var e;null===(e=this._liveLogger)||void 0===e||e.destroy(!1),this._liveLogger=void 0}},{key:"open",value:function(){this._liveLogger||(this._start(),this.config.showUserIdInErrorPanel&&this.player.plugins.error&&(this.player.plugins.error.config.extraTips=[{label:"userId",value:null==SDK?void 0:SDK.getConfig("user_unique_id")}]))}},{key:"_createTea",value:function(){SDK.init(_objectSpread2$2(_objectSpread2$2({},this.config),{},{app_id:468759,channel:"cn"})),SDK.start(),SDK.config({user_unique_id:this._userId,device_id:this._deviceId})}},{key:"_start",value:function(){this._createTea(),this._liveLogger=new LoggerControl({Tea:SDK,player:this.player,aid:this.config.appId,project_key:this.config.appId,app_name:this.config.appName||this.config.appId,user_id:this._userId,device_id:this._deviceId,ext:{veplayer_version:"2.4.2-rc.5",flv_version:"3.0.19-rc.0",hls_version:"3.0.19-rc.0",rts_version:"0.2.1-alpha.8"}})}}],[{key:"pluginName",get:function(){return"logger"}},{key:"defaultConfig",get:function(){return{appId:"",enable:!0,showUserIdInErrorPanel:!0}}}]),r}();function normalizeNumber(e,t){return"number"!=typeof e?"-":t?t(e):e.toString()}function getDefaultRow(e){var t,r,n;return{rows:[{key:"format",labelTextKey:"FORMAT",value:null!==(t=null==e?void 0:e.format)&&void 0!==t?t:"-"},{key:"fps",labelTextKey:"FPS",value:normalizeNumber(e.fps,(function(e){return"".concat(e," fps")}))},{key:"bitrate",labelTextKey:"BITRATE",value:normalizeNumber(e.bitrate,(function(e){return"".concat(e/1e3," kbps")}))},{key:"gop",labelTextKey:"GOP",value:normalizeNumber(e.gop,(function(e){return"".concat(e," frames")}))},{key:"resolution",labelTextKey:"RESOLUTION",value:_concatInstanceProperty(r="".concat(normalizeNumber(e.height)," * ")).call(r,normalizeNumber(e.height))},{key:"encodeType",labelTextKey:"ENCODE_TYPE",value:null!==(n=e.encodeType)&&void 0!==n?n:"-"},{key:"bufferEnd",labelTextKey:"BUFFER_END",value:normalizeNumber(e.bufferEnd)},{key:"currentTime",labelTextKey:"CURRENT_TIME",value:normalizeNumber(e.currentTime,(function(e){return e.toFixed(6)+"s"}))}]}}function getSoftDecodeRow(e){return{titleTextKey:"DECODE_INFO",rows:[{key:"decodeEfficiency",labelTextKey:"DECODE_EFFICIENCY",value:normalizeNumber(e.decodeFps,(function(e){return e+"frames/s"}))},{key:"decodeCost",labelTextKey:"DECODE_COST",value:normalizeNumber(e.decodeFps,(function(e){return(e?(1e3/e).toFixed():0)+"ms"}))}]}}var _context,infoPanel="",InfoPanel=function(e){_inherits(r,Plugin);var t=_createSuper(r);function r(){var e,n;_classCallCheck$1(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return _defineProperty$2(_assertThisInitialized(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,o))),"_pollTimer",void 0),_defineProperty$2(_assertThisInitialized(n),"_visible",void 0),_defineProperty$2(_assertThisInitialized(n),"_playPlugin",void 0),n}return _createClass$2(r,[{key:"_streamType",get:function(){return util.getStreamType(this.player.config.url)}},{key:"afterCreate",value:function(){var e=this;this._playPlugin=this.player.plugins[this._streamType],this.player.on(Events.ERROR,(function(){return e.close()})),this.config.visible&&this.player.once(Events.LOADED_DATA,(function(){return e.open()}))}},{key:"open",value:function(){var e;this._visible||(_includesInstanceProperty(e=["flv","hls"]).call(e,this._streamType)?this.player.plugins[this._streamType]?(this.root.style.display="block",this._tick(),this._visible=!0):console.warn("不支持或未加载".concat(this._streamType,"插件")):console.warn("仅支持flv和hls格式的信息展示"))}},{key:"close",value:function(){this._visible&&(clearTimeout(this._pollTimer),this.root.innerHTML="",this.root.style.display="none",this._visible=!1)}},{key:"destroy",value:function(){var e=this;this.close(),this.player.off(Events.LOADED_DATA,(function(){return e.open()})),this.player.off(Events.ERROR,(function(){return e.close()}))}},{key:"render",value:function(){return'\n <xg-live-panel class="veplayer-live-panel">\n </xg-live-panel>\n '}},{key:"_tick",value:function(){var e=this;clearTimeout(this._pollTimer),this._renderPanel(),this._pollTimer=window.setTimeout((function(){e._tick()}),this.config.interval)}},{key:"_getStats",value:function(){var e;return null===(e=this._playPlugin)||void 0===e?void 0:e.getStats()}},{key:"_getPanelData",value:function(){var e=this._getStats()||{},t="".concat(this._streamType,"_live"),r=this._playPlugin.softDecode,n=[getDefaultRow(_objectSpread2$2(_objectSpread2$2({},e),{},{format:t}))];return r&&n.push(getSoftDecodeRow(e)),n}},{key:"_renderPanel",value:function(){var e=this,t=this._getPanelData(),r=this.root;r&&(r.innerHTML="",t.forEach((function(t){e._renderGroup(r,t)})))}},{key:"_renderGroup",value:function(e,t){var r=this,n=t.title,i=t.titleTextKey,o=t.rows,a=this.player.config.i18nManager;if(n||i){var s,l=this._genTitleDom(null!==(s=a.getText(i))&&void 0!==s?s:n);e.appendChild(l)}o.forEach((function(t){var n=r._genRowDom(t);e.appendChild(n)}))}},{key:"_genTitleDom",value:function(e){var t=util$1.createDom("xg-live-panel","",void 0,"veplayer-live-panel-row"),r=util$1.createDom("xg-live-panel",e,void 0,"veplayer-live-panel-row-title");return t.appendChild(r),t}},{key:"_genRowDom",value:function(e){var t=this.player.config.i18nManager,r=util$1.createDom("veplayer-live-panel-row","",void 0,"veplayer-live-panel-row"),n=util$1.createDom("xg-live-panel",t.getText(e.labelTextKey),void 0,"veplayer-live-panel-row-label");r.appendChild(n);var i=util$1.createDom("xg-live-panel",e.value);return r.appendChild(i),r}}],[{key:"pluginName",get:function(){return"infoPanel"}},{key:"defaultConfig",get:function(){return{visible:!1,interval:500}}}]),r}(),EN=_objectSpread2$2(_objectSpread2$2({},EN$1),{},{INVALID_PARAMETER:"The imported parameter is empty, please pass in necessary parameters such as the stream address",FORMAT:"format",FPS:"fps",BITRATE:"bitrate",GOP:"gop",RESOLUTION:"resolution",ENCODE_TYPE:"encodeType",BUFFER_END:"bufferEnd",CURRENT_TIME:"currentTime",DECODE_EFFICIENCY:"efficiency",DECODE_COST:"cost",DECODE_INFO:"decodeInfo",REFRESH:"refresh"}),ZH_CN=_objectSpread2$2(_objectSpread2$2({},ZH_CN$1),{},{INVALID_PARAMETER:"入参为空,请传入流地址等必要参数",FORMAT:"格式",FPS:"帧率",BITRATE:"码率",GOP:"GOP",RESOLUTION:"视频分辨率",ENCODE_TYPE:"编码方式",BUFFER_END:"Buffer 水位",CURRENT_TIME:"播放进度",DECODE_EFFICIENCY:"解码效率",DECODE_COST:"解码消耗",DECODE_INFO:"软解信息",REFRESH:"刷新"}),_excluded=["getDrmConfig"],getDrmStrategy=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i,o,a,s,l,c,u,p,f,d;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=getDrmType(t.drm),!t.url||n!==DrmType.Fairplay){e.next=18;break}return e.prev=2,a=null!==(i=null==t||null===(o=t.drm)||void 0===o?void 0:o.fairplay)&&void 0!==i?i:{},s=a.getDrmConfig,l=_objectWithoutProperties(a,_excluded),e.next=6,_Promise.all([load(DynamicModule.PluginDrm).then((function(e){return e.DrmPlugin})).catch((function(){})),null==s?void 0:s({url:t.url})]);case 6:return c=e.sent,u=_slicedToArray(c,2),p=u[0],f=u[1],d=_Object$assign({},l,null==t?void 0:t.drm,f),f&&(null==r||r.updateDrmConfig(f)),e.abrupt("return",{options:{drm:d},plugins:p?[p]:[]});case 15:e.prev=15,e.t0=e.catch(2),console.log(e.t0);case 18:return e.abrupt("return",{});case 19:case"end":return e.stop()}}),e,null,[[2,15]])})));return function(t,r){return e.apply(this,arguments)}}(),getAbrStrategy=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o,a,s;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("rtm"!==(o=t.url&&getStreamType(t.url))){e.next=3;break}return e.abrupt("return",{});case 3:if(a="flv"===o?null==t||null===(r=t.flv)||void 0===r?void 0:r.abr:null==t||null===(n=t.hls)||void 0===n?void 0:n.abr){e.next=6;break}return e.abrupt("return",{});case 6:return e.next=8,load(DynamicModule.PluginAbr).catch((function(){}));case 8:return s=e.sent,e.abrupt("return",{options:_defineProperty$2({},"flv"===o?"abr":"hlsabr",_objectSpread2$2(_objectSpread2$2({},a),{},{open:null===(i=a.enable)||void 0===i||i})),plugins:["flv"===o?null==s?void 0:s.AbrPlugin:null==s?void 0:s.HlsAbrPlugin]});case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();VeI18n.extend([{LANG:"zh-cn",TEXT:ZH_CN},{LANG:"en",TEXT:EN}]);var LIVE_DEFAULT_OPTIONS={autoplay:{muted:!0}},LIVE_DEFAULT_PLUGINS=_concatInstanceProperty(_context=[]).call(_context,_toConsumableArray$1(DEFAULT_PLUGINS),[Refresh,Logger,InfoPanel]),RTMCodec=function(e){return e.H264="h264",e}(RTMCodec||{}),VePlayerLive=function(e){_inherits(n,VePlayerBase);var t,r=_createSuper(n);function n(e){return _classCallCheck$1(this,n),r.call(this,e)}return _createClass$2(n,[{key:"playTime",get:function(){var e;if(null===(e=this._player)||void 0===e||null===(e=e.played)||void 0===e||!e.length)return 0;for(var t=this._player.played.length,r=0,n=0;n<t;n++){var i,o,a=null===(i=this._player)||void 0===i?void 0:i.played.start(n);r+=(null===(o=this._player)||void 0===o?void 0:o.played.end(n))-a}return r}},{key:"openLog",value:function(){var e;null===(e=this._player.plugins)||void 0===e||e.logger.open()}},{key:"closeLog",value:function(){var e;null===(e=this._player.plugins)||void 0===e||e.logger.close()}},{key:"openInfoPanel",value:function(){var e;null===(e=this._player.plugins)||void 0===e||e.infopanel.open()}},{key:"closeInfoPanel",value:function(){var e;null===(e=this._player.plugins)||void 0===e||e.infopanel.close()}},{key:"openAbr",value:function(){var e,t,r=this.url&&getStreamType(this.url);"flv"!==r?"hls"===r&&(null===(e=this._player.plugins)||void 0===e||null===(e=e.hlsabr)||void 0===e||e.switchAbr(!0)):null===(t=this._player.plugins)||void 0===t||null===(t=t.abr)||void 0===t||t.switchAbr(!0)}},{key:"closeAbr",value:function(){var e,t,r=this.url&&getStreamType(this.url);"flv"!==r?"hls"===r&&(null===(e=this._player.plugins)||void 0===e||null===(e=e.hlsabr)||void 0===e||e.switchAbr(!1)):null===(t=this._player.plugins)||void 0===t||null===(t=t.abr)||void 0===t||t.switchAbr(!1)}},{key:"updateDrmConfig",value:function(e){var t;null===(t=this._player)||void 0===t||null===(t=t.plugins)||void 0===t||null===(t=t.drm)||void 0===t||t.updateDrmConfig(e)}},{key:"switchAbr",value:function(e){var t;if(null!==(t=this._player.plugins)&&void 0!==t&&t.abr){if(void 0!==(null==e?void 0:e.bitrate)){var r=this._player.plugins.abr.config.urls[e.bitrate];if(!r)return;this.switch(r,{seamless:!0}),this._player.plugins.abr.bitrate=e.bitrate}var n;if(void 0!==(null==e?void 0:e.enable))null===(n=this._player.plugins)||void 0===n||n.abr.switchAbr(e.enable)}}},{key:"getRTMNetWorkInfo",value:function(){var e;return null===(e=this._player)||void 0===e||null===(e=e.plugins)||void 0===e||null===(e=e.rts)||void 0===e?void 0:e.getNetWorkInfo()}},{key:"getRTMStats",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null===(t=this._player)||void 0===t||null===(t=t.plugins)||void 0===t||null===(t=t.rts)||void 0===t?void 0:t.getStatsSnapshoot());case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getFLVStats",value:function(){var e;return null===(e=this._player)||void 0===e||null===(e=e.plugins)||void 0===e||null===(e=e.flv)||void 0===e?void 0:e.getStats()}}]),n}();function createLivePlayer(e){return _createLivePlayer.apply(this,arguments)}function _createLivePlayer(){return(_createLivePlayer=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o,a,s,l;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=void 0,t&&(t.url||t.playlist)){e.next=3;break}throw create4(ErrorCode.INVALID_PARAMETER,new VeI18n);case 3:return o=new VeI18n({lang:null==t?void 0:t.lang,i18n:null==t?void 0:t.i18n}),a=_objectSpread2$2(_objectSpread2$2({},t),{},{plugins:_concatInstanceProperty(r=[]).call(r,_toConsumableArray$1(LIVE_DEFAULT_PLUGINS),_toConsumableArray$1(null!==(n=t.plugins)&&void 0!==n?n:[]))}),e.next=7,VePlayerBase.create(_objectSpread2$2(_objectSpread2$2(_objectSpread2$2({},LIVE_DEFAULT_OPTIONS),a),{},{isLive:!0,i18nManager:o,preProcessUrl:function(e){return{url:generateUrlWithSessionId(e)}},preparePlugins:function(e){return _asyncToGenerator(_regeneratorRuntime().mark((function t(){var r,n,o,s,l,c,u,p,f,d,h,y,g,_,v;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,_Promise.all([getTypeStrategy(_objectSpread2$2(_objectSpread2$2({},a),{},{url:e}),i),getDrmStrategy(_objectSpread2$2(_objectSpread2$2({},a),{},{url:e}),i),getAbrStrategy(_objectSpread2$2(_objectSpread2$2({},a),{},{url:e}))]);case 2:return n=t.sent,o=_slicedToArray(n,3),s=o[0],l=o[1],c=o[2],p=(u=null!=s?s:{}).options,f=u.plugins,h=(d=null!=l?l:{}).options,y=d.plugins,_=(g=null!=c?c:{}).options,v=g.plugins,t.abrupt("return",{options:_Object$assign({},p,h,_),plugins:_concatInstanceProperty(r=[]).call(r,_toConsumableArray$1(null!=f?f:[]),_toConsumableArray$1(null!=y?y:[]),_toConsumableArray$1(null!=v?v:[]))});case 11:case"end":return t.stop()}}),t)})))()}}),VePlayerLive);case 7:return(i=e.sent)&&(l=null===(s=i)||void 0===s||null===(s=s._player)||void 0===s||null===(s=s.config)||void 0===s?void 0:s._RTMdegrade)&&i.emit("degrade",{originRtmUrl:l._originRtmUrl,code:"NOT_SUPPORT",message:"not support rtm or h264",isRTMSupported:l._isRTMSupported,isRTMSupportCodec:l._isRTMSupportCodec}),e.abrupt("return",i);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var live=Object.freeze({__proto__:null,ErrorCode:ErrorCode,Events:Events});setModuleSystem("esm"),util.isMseSupported,util.isSoftDecodeSupported,setModuleSystem("esm");export{Codec,DecodeType,Degradation,DynamicModule,EN$1 as EN,ListType,POSITIONS$1 as POSITIONS,Plugin,RTMCodec,sniffer$1 as Sniffer,ZH_CN$1 as ZH_CN,createLivePlayer,isMseSupported,isRTMSupportCodec,isRTMSupported,isSoftDecodeSupported,live,load,register2 as register,registerPlugin,util};
11
11
  //# sourceMappingURL=esm/veplayer.production.js.map