/*! For license information please see player-6.9bffae5c.js.LICENSE.txt */ "use strict";!function(e,t){"object"==typeof module&&"object"==typeof module.exports?t():"function"==typeof define&&define.amd?define([],t):(e="undefined"!=typeof globalThis?globalThis:e||self)&&t()}(this,function(){"use strict";"object"==typeof window&&(window.openRedirect={version:"1.2.20",webpackPluginVersion:"3.4.22",reportOnly:!1})}),!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).xss={})}(this,function(e){"use strict";var t=function(){return(t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n/g,o=/&#([a-zA-Z0-9]*);?/gim,s=/"/g,u=/:?/gim,c=/&newline;?/gim,d=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,l=/u\s*r\s*l\s*\(.*/gi,f=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,h=/"/g,v=function(e){return e.replace(i,"<").replace(a,">")},g={indexOf:function(e,t){var n,r;for(n=0,r=e.length;n127&&r<2048?t+=String.fromCharCode(r>>6|192)+String.fromCharCode(63&r|128):t+=String.fromCharCode(r>>12|224)+String.fromCharCode(r>>6&63|128)+String.fromCharCode(63&r|128)}return t}(e);d>2,a=(3&t)<<4|(n=e.charCodeAt(d++))>>4,o=(15&n)<<2|(r=e.charCodeAt(d++))>>6,s=63&r,isNaN(n)?o=s=64:isNaN(r)&&(s=64),c=c+u.charAt(i)+u.charAt(a)+u.charAt(o)+u.charAt(s);return c}function y(e){var t,n,r,i,a,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",c=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");c>4,n=(15&i)<<4|(a=s.indexOf(e.charAt(c++)))>>2,r=(3&a)<<6|(o=s.indexOf(e.charAt(c++))),u+=String.fromCharCode(t),64!==a&&(u+=String.fromCharCode(n)),64!==o&&(u+=String.fromCharCode(r));return function(e){for(var t="",n=0,r=0,i=0,a=0;n191&&r<224?(t+=String.fromCharCode((31&r)<<6|63&(a=e.charCodeAt(n+1))),n+=2):(a=e.charCodeAt(n+1),t+=String.fromCharCode((15&r)<<12|(63&a)<<6|63&(i=e.charCodeAt(n+2))),n+=3);return t}(u)}function b(e,t,n){var r="",i=0,a=!1,o=!1,s=0,u=e.length,c="",d="";e:for(s=0;s"===l||s===u-1){r+=n(e.slice(i,a)),c=function(e){var t,n=g.spaceIndex(e);return t=-1===n?e.slice(1,-1):e.slice(1,n+1),"/"===(t=g.trim(t).toLowerCase()).slice(0,1)&&(t=t.slice(1)),"/"===t.slice(-1)&&(t=t.slice(0,-1)),t}(d=e.slice(a,s+1)),r+=t(a,r.length,c,d,"0;t--){var n=e[t];if(" "!==n)return"="===n?t:-1}return -1}(e,c-1))){u(o,m(g.trim(e.slice(n,c)))),o=!1,n=c+1;continue}}}else{if(-1===(l=e.indexOf(d,c+1)))break;u(o,g.trim(e.slice(i+1,l))),o=!1,n=(c=l)+1}}else o=e.slice(n,c),n=c+1,i='"'===e.charAt(n)||"'"===e.charAt(n)?n:function(e,t){for(;te.charCodeAt(n)?" ":e.charAt(n);return g.trim(t)}(e=(e=(e=e.replace(s,'"')).replace(o,function(e,t){return"x"===t[0]||"X"===t[0]?String.fromCharCode(parseInt(t.substr(1),16)):String.fromCharCode(parseInt(t,10))})).replace(u,":").replace(c," "))}(n),"href"===t||"src"===t){if("#"===(n=g.trim(n)))return"#";if("http://"!==n.substr(0,7)&&"https://"!==n.substr(0,8)&&"mailto:"!==n.substr(0,7)&&"tel:"!==n.substr(0,4)&&"data:image/"!==n.substr(0,11)&&"ftp://"!==n.substr(0,6)&&"./"!==n.substr(0,2)&&"../"!==n.substr(0,3)&&"#"!==n[0]&&"/"!==n[0])return""}else if("background"===t){if(d.lastIndex=0,d.test(n))return""}else if("style"===t&&(f.lastIndex=0,f.test(n)||(l.lastIndex=0,l.test(n)&&(d.lastIndex=0,d.test(n)))))return"";return n=function(e){return e=v(e=e.replace(h,"""))}(n)}var w=function(e){return"string"==typeof e?e.replace(/'/g,'"').replace('=""',"").replace(/\s+/g,"").toLowerCase():""},T=function(){function e(e){var t=function(e){var t={};for(var n in e)t[n]=e[n];return t}(e||{});t.stripIgnoreTag&&(t.onIgnoreTag,t.onIgnoreTag=function(){return""}),t.whiteList={},t.onTag=function(){},t.onTagAttr=function(){},t.onIgnoreTag=function(){},t.onIgnoreTagAttr=function(){},t.safeAttrValue=C,t.escapeHtml=v,this.options=Object.assign(t,e)}return e.prototype.process=function(e){if(!(e=(e=e||"").toString()))return"";var t,n,r,i,a,o,s=this.options,u=s.whiteList,c=s.onTag,d=s.onIgnoreTag,l=s.onTagAttr,f=s.onIgnoreTagAttr,h=s.safeAttrValue,v=s.escapeHtml;s.stripBlankChar&&(e=(t=(t=e.split("")).filter(function(e){var t=e.charCodeAt(0);return!(127===t||t<=31&&10!==t&&13!==t)})).join("")),s.allowCommentTag||(e=function(e){for(var t="",n=0;n");var s=function(e){var t=g.spaceIndex(e);if(-1===t)return{html:"",closing:"/"===e[e.length-2]};var n="/"===(e=g.trim(e.slice(t+1,-1)))[e.length-1];return n&&(e=g.trim(e.slice(0,-1))),{html:e,closing:n}}(r),p=u[n],m=k(s.html,function(e,t){var r=-1!==g.indexOf(p,e),i=l(n,e,t,r);return null==i?r?(t=h(n,e,t,null))?"".concat(e,'="').concat(t,'"'):e:null==(i=f(n,e,t,r))?void 0:i:i});return r="<".concat(n),m&&(r+=" ".concat(m)),s.closing&&(r+=" /"),r+=">"}return null==(o=d(n,r,a))?v(r):o},v);return p&&(m=p.remove(m)),m},e}(),x=Function("\nvar _checkXSS = function (it) {\n return it && it.Math == Math && it;\n};\nreturn _checkXSS(typeof globalThis === 'object' && globalThis) ||\n_checkXSS(typeof window === 'object' && window) ||\n_checkXSS(typeof self === 'object' && self) ||\n_checkXSS(typeof global === 'object' && global) ||\nFunction('return this')();\n")(),E=new(function(){function e(){var e=this;this.batchData=[],this.uniqKeys=new Set,this.timeout=2e3,this.lock=!1,this.getSlardarBid=function(){var t,n,r="douyin_web";if(!g.includes(r,"bid"))return r;if(e.config&&e.config.bid)return e.config.bid;if(x&&x._xssBid)return x._xssBid;if(x&&x.slardar&&"function"==typeof x.slardar.config){var i=(x.slardar.config()||{}).bid;if(i)return i}if(x&&x.Slardar&&"function"==typeof x.Slardar.config){var a=(x.Slardar.config()||{}).bid;if(a)return a}return(null===(n=null===(t=null==x?void 0:x.Slardar)||void 0===t?void 0:t._baseParams)||void 0===n?void 0:n.bid)||"argus"},this.getConfigRegion=function(){var t;return g.includes("cn","region")?e.config&&e.config.region?e.config.region:((null===(t=null==x?void 0:x.gfdatav1)||void 0===t?void 0:t.region)||"cn").toLowerCase():"cn"},this.gerReportUrl=function(){var t={cn:y("aHR0cHM6Ly9tb24uemlqaWVhcGkuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9"),boe:y("aHR0cHM6Ly9tb24uemlqaWVhcGkuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9"),ttp:y("aHR0cHM6Ly9tb24udXMudGlrdG9rdi5jb20vbW9uaXRvcl9icm93c2VyL2NvbGxlY3QvYmF0Y2gvc2VjdXJpdHkvP2JpZD0="),va:y("aHR0cHM6Ly9tb24tdmEuYnl0ZW92ZXJzZWEuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9"),maliva:y("aHR0cHM6Ly9tb24tdmEuYnl0ZW92ZXJzZWEuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9"),sg:y("aHR0cHM6Ly9tb24tdmEuYnl0ZW92ZXJzZWEuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9"),boei18n:y("aHR0cHM6Ly9tb24tdmEuYnl0ZW92ZXJzZWEuY29tL21vbml0b3JfYnJvd3Nlci9jb2xsZWN0L2JhdGNoL3NlY3VyaXR5Lz9iaWQ9")}[e.getConfigRegion()];if(t)return t+e.getSlardarBid()}}return e.prototype.setConfig=function(e){this.config=e},e.prototype.upload=function(){var e=this,t=this.gerReportUrl();!this.lock&&t&&0!==this.batchData.length&&(this.lock=!0,setTimeout(function(){var n=e.batchData.slice(0,100);e.batchData=e.batchData.slice(100),x.fetch(t,{method:"post",body:JSON.stringify(n),headers:{"Content-Type":"application/json"}}).catch(function(e){}),e.lock=!1,e.upload()},this.timeout))},e.prototype.generateKey=function(e){return e.collectKey?[e.collectMode,e.collectKey].join("___"):""},e.prototype.push=function(e){this.batchData.push(e),this.upload()},e.prototype.report=function(e){var t=this.generateKey(e);if(x.fetch&&e.collectKey){var n="object"==typeof window?window.location.href:"SSR";e.documentUrl=n;var r={age:Math.floor(Date.now()),type:"xss",url:n,body:e,"user-agent":""};"enforce"===e.disposition&&"SSR"!==n||(r.url=t),"SSR"===n&&(r.url="SSR___".concat(r.url),r.body.ssr=!0),this.push(r)}},e}()),D=function(e){for(var t=0,n=function(n){Array.isArray(e[n])?0===e[n].length?delete e[n]:(e[n]=g.from(g.uniq(e[n])),t+=e[n].length):0===g.keys(e[n]).length?delete e[n]:g.keys(e[n]).forEach(function(r){e[n][r]=g.from(g.uniq(e[n][r])),t+=e[n][r].length})},r=0,i=g.keys(e);r0)return t&&t("javascript:"),!1;if(/^javascript:/i.test(e)){var i=e.slice(11).replace(/\s/g,"").trim();return!!g.some(["void","void(0)","void0","false","undefined",";"],function(e){return e===i})||(t&&t("javascript:"),!1)}return!0}var L=function(e,t){var n,r,i="<%= isSaveValidUrl =>";if("string"!=typeof e||(r=Number("<%= urlLimit =>"),void 0!==n&&(r=n),"NaN"!==e.toString()&&-1!==r&&e.length>=r)||I(e,t))return e;try{if(!0===(i=JSON.parse(i))||"true"===i){var a=new URL(e);return a.origin+a.pathname}}catch(e){}return"#"};function B(e,t,r){if(void 0===e&&(e=""),void 0===t&&(t=[]),"string"!=typeof e)return!0;if(!I(e=A(e)))return!1;var i,a={url:(i=e.match(/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/)||[])[0],scheme:i[1],slash:i[2],host:i[3],port:i[4],path:i[5],query:i[6],hash:i[7]},o=a.scheme,s=a.host;return r?!!r(e):!(!o||!s)&&(!g.includes(["http","https","file"],o)||("object"==typeof window&&window&&(t=n(n([],t,!0),[location.host],!1)),g.some(t,function(e){return!!(e instanceof RegExp&&e.test(s))||e===s})))}var P={a:["target","title","spellcheck","rel"],canvas:[],abbr:["title"],address:[],area:["shape","coords","alt"],article:[],aside:[],audio:["autoplay","controls","loop","preload"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:["dir"],dl:[],dt:[],em:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["alt","title","width","height","decoding"],ins:["datetime"],li:[],mark:[],nav:[],ol:["start"],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],sup:[],delete:[],form:[],strong:[],mask:["maskunits","x","y","width","height","fill"],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],wbr:[],video:["autoplay","controls","loop","preload","height","width"],svg:["viewBox","version","xmlns","fill","width","height","stroke","stroke-width","style"],path:["d","fill","opacity","stroke","p-id","fill-rule","clip-rule","stroke-width","stroke-linecap","stroke-linejoin","fill-opacity","mask"],rect:["x","y","width","height","fill","stroke","rx"],g:[]},N={collect:null,initCollect:function(){this.collect={whiteList:{},filterProtocol:[]}},removeCollect:function(){var e=D(this.collect),t=e.count,n=e.ret;return this.collect=null,{collectKey:0===t?null:JSON.stringify(n),collectMode:"white"}},onIgnoreTagAttr:function(e,t,r){return e&&g.indexOf(["href","src"],t)>-1?N.domainWhiteList&&Array.isArray(N.domainWhiteList)&&N.domainWhiteList.length>0&&!B(r,n([],N.domainWhiteList,!0))?"":"".concat(t,'="').concat(L(r,function(e){var t;null===(t=N.collect)||void 0===t||t.filterProtocol.push(e)}),'"'):e&&(g.indexOf(["style","class","id"],t)>-1||t.indexOf("data-")>-1)?"".concat(t,'="').concat(r,'"'):(N.collect.whiteList[e]=N.collect.whiteList[e]||[],void N.collect.whiteList[e].push(t))},onIgnoreTag:function(e,t){if("style"===e)return t;b(t,function(e,t,n,r){k(R(r).html.replace("/",""),function(e){N.collect.whiteList[n]=N.collect.whiteList[n]||[],N.collect.whiteList[n].push(e)})},v)},whiteList:P,mergeWhiteList:function(e){for(var t,n={},r=0,i=g.keys(P);r");var a=R(r),o=k(a.html,function(e,t){var r,i=0;if(W.blackList[n]&&g.includes(W.blackList[n],e)&&(z.collect.blackList[n]=z.collect.blackList[n]||[],z.collect.blackList[n].push(e),i++),W.blackAttrRegExps.length&&W.blackAttrRegExps.some(function(t){return t.test(e)})&&g.forEach(W.blackAttrRegExps,function(t){t.test(e)&&(z.collect.blackAttrRegExps.push("".concat(t.toString(),"->").concat(e)),i++)}),W.blackAttrs.length&&g.includes(W.blackAttrs,e)&&(W.blackAttrs.push(e),i++),!i){if(W.filterList&&W.filterList[n]&&g.includes(W.filterList[n],e)){var a=L(t,function(e){var t;null===(t=z.collect)||void 0===t||t.filterProtocol.push(e)});return a!==t&&(z.collect.filterList[n]=z.collect.filterList[n]||[],z.collect.filterList[n].push(e)),t?"".concat(e,"='").concat(a,"'"):e}return W.filterAttrs&&g.includes(W.filterAttrs,e)?((a=L(t,function(e){var t;null===(t=z.collect)||void 0===t||t.filterProtocol.push(e)}))!==t&&(null===(r=z.collect)||void 0===r||r.filterAttrs.push(e)),t?"".concat(e,"='").concat(a,"'"):e):t?"".concat(e,"='").concat(t,"'"):e}});return r="<".concat(n),o&&(r+=" ".concat(o)),a.closing&&(r+=" /"),r+=">"},v);null===(n=z.collect)||void 0===n||n.blackTags.push(e)}},U=function(e){var t=e.reportOnly,n=void 0===t||t,r=e.block;return n&&"all"===n?"report":("string"==typeof n&&("true"===n&&(n=!0),"false"===n&&(n=!1)),r?"enforce":n?"report":"enforce")},j=function(e){return function(n,r,i){if(!n||"string"!=typeof n)return n;var a=r;e===S&&(a=N).initCollect();var o=e(n,a);if(w(o)===w(n))return n;if(!i)return o;var s=i.logType,u=U(i),c=a.removeCollect();return E.report(t(t({type:s,disposition:u},c),{sourceText:_(n),filterText:_(o)})),"enforce"===u?o:n}},G=j(function(e,t){return void 0===t&&(t={}),t&&t.whiteList||(t.whiteList={a:["target","href","title"],abbr:["title"],address:[],area:["shape","coords","href","alt"],article:[],aside:[],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:[],dl:[],dt:[],em:[],figcaption:[],figure:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["src","alt","title","width","height"],ins:["datetime"],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],summary:[],sup:[],strong:[],strike:[],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],video:["autoplay","controls","crossorigin","loop","muted","playsinline","poster","preload","src","height","width"]}),new T(t).process(e)}),H=j(S),Y=function(e,t,n){var r=[],i=L(e,function(e){r.push(e)});if(i===e)return e;r=g.from(g.uniq(r));var a=t||n||{};if(!a)return i;var o=a.logType,s=U(n);return E.report({type:o,disposition:s,collectKey:r.join("___"),collectData:JSON.stringify(r),collectMode:"black",sourceText:_(e),filterText:_(i)}),"enforce"===s?i:e},J=x._xssProject||{},q=x.xssNamespace||{},X="3.0.26",Q={FilterXSS:T,version:X,webpackPluginVersion:"<%= webpackPluginVersion =>",reportOnly:"<%= reportOnly =>",filterXSS:G,_filterXSS:H,filterUrl:Y,Config:N,BlackConfig:z,project:J,setProjectName:function(e){J[e]=this,x._xssProjectName=e}};q.douyin_web=Q,x.xssNamespace=q,x.Math&&!x.Math.xssNamespace&&(x.Math.xssNamespace=q),J[X]=Q,x.globalThis=x,x.getFilterXss=function(){return void 0!==this._xssProjectName?this._xssProject[this._xssProjectName]:Q},x.xss=Q,x.isSafeUrl=B,x.isSafeDomain=B,x.isSafeProtocol=I,x._xssProject=J,x._xssProjectName&&(J[x._xssProjectName]=Q);var K=Q.setProjectName.bind(Q);e.BlackConfig=z,e.Config=N,e.FilterXSS=T,e._filterXSS=H,e.filterUrl=Y,e.filterXSS=G,e.isSafeDomain=B,e.isSafeProtocol=I,e.isSafeUrl=B,e.project=J,e.setProjectName=K,e.setXssNamespace=function(e){var t=e.appId,n=e.bid,r=e.region;q[t]=Q;N.bid=n,N.region=r,N.enabled=!0},e.xssNamespace=q,Object.defineProperty(e,"__esModule",{value:!0})}),(self.webpackChunkdouyin_web=self.webpackChunkdouyin_web||[]).push([["67316"],{861962:function(e,t,n){n.d(t,{Z:function(){return r}});let r="0.12.13-rc.7"},631144:function(e,t,n){n.d(t,{g:function(){return a}});var r=n(403826),i=n(861504),a={onlyInit:!1,useWaterLevel:!1,maxBufferLength:10,minBufferLength:5,tickInSeconds:.2,getLicenseUrl:"",xhrSetup:{},retryCount:1,retryDelay:1e3,timeout:3e3,processMaxGapTime:1/0,preloadCacheType:1,needPreloadRangeList:!1,isOpenPreload:!0,needPreloadCheck:!1,preloadTime:0,preloadMaxCacheCount:0,needAutoBitrate:!0,keyValue:null,drm:null,switchBitRateWay:!1,enableWorker:!1,bufferThreshold:10,removeBufferLen:60,removeBufferAtSeek:!0,resumePlayWaterLevel:2,waitJampBufferMaxCnt:3,waitingInBufferTimeOut:5e3,waitingTimeOut:1e4,notDegradeErrorList:["timeout",403,404],h265Degrade:!1,forceVideoPlay:!1,segmentMinDuration:3,supportHevc:void 0,H264Config:null,reqOptions:{},rangeMaxDuration:15,getRequestOptionsCallback:null,closeDowngrade:!1,loaderType:"fetch",reUseMSE:!1,urlExpireDisableErrorEvent:!1,logCacheConfig:{logCacheLevel:r._.LOG,logMaxSize:204800},noPreloadAddBufferLen:0,enableFPSStuckHandle:!1,loadRangeType:i.TJ.SIZE,timerInWorker:!1,waitingRetrySeekTimes:null,waitingRetryDuration:null,disableInactiveWaitingCheck:!1,alwaysStreamingLoad:!0,enableCusExpiryCheck:!1,enableCheckTrackGap:!1,trackGap:1,reqParams:{},isAddRange:!1,disableRepeatRange:!1,audioGroupingStrategy:2,reuseSecretKey:!1,bindSrcTiming:i.Iv.META_READY,enableMsePatches:!1,enableFixPreloadRepatLoad:!1,enablePreloadCache:!1}},937049:function(e,t,n){n.d(t,{O1:function(){return o},iR:function(){return s},oO:function(){return u},zO:function(){return c}});var r=n(61072),i=n(674495),a=n(144144),o={416:i.WE[i.wb.NETWROK_RANGE_NOT_SATISFIABLE],403:i.WE[i.wb.NETWORK_FORBIDDEN],404:i.WE[i.wb.NETWORK_NOTFOUND],timeout:i.WE[i.wb.NETWORK_TIMEOUT],networkError:i.WE[i.wb.NETWORK],lenNotMatch:2130,mse:i.WE[i.wb.MEDIA][i.wb.SUB_TYPES.MSE_OTHER],mseOpen:i.WE[i.wb.MEDIA][i.wb.SUB_TYPES.MSE_ADD_SB],mseAppend:i.WE[i.wb.MEDIA][i.wb.SUB_TYPES.MSE_APPEND_BUFFER],mse_hijack:i.WE[i.wb.MEDIA][i.wb.SUB_TYPES.MSE_HIJACK],eme_hijack:i.WE[i.wb.MEDIA][i.wb.SUB_TYPES.EME_HIJACK],metaError:i.WE[i.wb.DEMUX][i.wb.SUB_TYPES.MP4],muxError:i.WE[i.wb.REMUX][i.wb.SUB_TYPES.FMP4],other:i.WE[i.wb.OTHER],waitTimeout:i.WE[i.wb.RUNTIME][i.wb.SUB_TYPES.BUFFERBREAK_ERROR],waitTimeoutWithHidden:i.WE[i.wb.RUNTIME][i.wb.SUB_TYPES.WAITING_TIMEOUT_ERROR],drm:i.WE[i.wb.DRM][i.wb.SUB_TYPES.LICENSE],custom_drm:i.WE[i.wb.DRM][i.wb.SUB_TYPES.CUSTOM_LICENSE]},s=i.wb,u=(0,r.qH)(function e(t,n,i){(0,r.PA)(this,e);var s,u=0,c=0;null!=i&&i.range&&i.range.length>1&&(u=i.range[0],c=i.range[1]);var d=o[s=n]||s;this.headers=(null==i?void 0:i.headers)||null,this.errorCode=d,this.errorType=t,this.errorMessage=(null==i?void 0:i.httpText)||(null==i?void 0:i.message),this.url=null==i?void 0:i.url,this.httpCode=n,this.version=a.i,this.rangeStart=u,this.rangeEnd=c,this.ext=i,this.mediaError={code:d,message:(null==i?void 0:i.httpText)||(null==i?void 0:i.message)}}),c=(0,r.qH)(function e(t,n,i){(0,r.PA)(this,e),this.version=a.i,this.errorCode=n,this.errorType=t,this.errorMessage=i.msg,this.ext=i,this.mediaError={code:n,message:i.msg}})},588984:function(e,t,n){n.d(t,{Z:function(){return s}});var r=n(61072);n(346984),n(941533),n(451236),n(162093),n(503e3),n(232070),n(248385);var i=n(403826),a=n(861504),o=n(107093),s=function(e){function t(e,n,i,o,s){var u;return(0,r.PA)(this,t),(u=(0,r.$w)(this,t,[e,n,i,o,s])).logTag="".concat(s,"_").concat(a.TJ.SIZE)||"",u.fillGopDataInfo=null,u}return(0,r.XW)(t,e),(0,r.qH)(t,[{key:"updateAdaptTimeRange",value:function(e,t){this.lastTargetDur=t,!this.adaptTimeRange&&(this.adaptTimeRange=[]);var n=this.adaptTimeRange,r=this.timeRange;if(null!==e&&e>=0){var a=this.getAdaptIdxBySrcIdx(e,!0);if(null!==a&&a>=0)return this.log(i._.LOG," adaptTimeRange find range of timeRange,timeRangeIdx,",e,JSON.stringify(r[e])," ,addaptIdx,",a,JSON.stringify(n[a])),a}this.fillAdadptTimeRange(e,t);var o=this.createAdaptTimeRange(t);return o&&(n.push(o),this.log(i._.LOG,"update adaptTimeRange,startIdx",this.adaptTimeRange.length-1,JSON.stringify(o))),this.adaptTimeRange.length-1}},{key:"fillAdadptTimeRange",value:function(e,t){var n=this.adaptTimeRange,r=this.timeRange;if(null!==e&&e>=0){!(null!==(u=r[e])&&void 0!==u&&u.range)&&(r[e].range=this.calculateRange(e),this.log(i._.LOG,"adaptTimeRange update timeRange.range ,fragmentIdx",e,JSON.stringify(r[e])));for(var a=null===(c=n[n.length-1])||void 0===c?void 0:c.range,o=(null==a?void 0:a[1])||0;o<(null===(d=r[e])||void 0===d?void 0:d.range[0]);){var s=this.createAdaptTimeRange(t);if(s){if((null==s?void 0:s.range[1])>=(null===(l=r[e])||void 0===l?void 0:l.range[0])){this.log(i._.LOG,"gap adaptTimeRange ignore,adaptTimeRangeIdx",JSON.stringify(s));break}n.push(s);var u,c,d,l,f=n.length;n[f-1].isLoading=!0,n[f-1].downloaded=!0,o=n[n.length-1].range[1],this.log(i._.LOG,"gap adaptTimeRange,adaptTimeRangeIdx",this.adaptTimeRange.length-1,JSON.stringify(s))}}}}},{key:"calculateSize",value:function(e,t){var n,r,i,a,o=this.adaptTimeRange,s=this.timeRange,u=this.videoTrak,c=this.audioTrak;!(null!==(p=s[0])&&void 0!==p&&p.range)&&(s[0].range=this.calculateRange(0));var d=(null==o?void 0:o.length)||0,l=d>0&&o[d-1].range?o[d-1].range[1]:s[0].range[0],f=null;u&&u.length>0&&(f=this.getEndFrame("video",e));var h=null===(m=f)||void 0===m?void 0:m.endFrame,v=null;c&&c.length>0&&(v=this.getEndFrame("audio",e));var g=null===(_=v)||void 0===_?void 0:_.endFrame;if(h&&g){var p,m,_,y,b,k,C=h.offset+h.size,w=g.offset+g.size;C>w?(y=this.getFrameByPos("audio",null===(b=v)||void 0===b?void 0:b.newSegmentIdx,g.index,C))&&(g=y):(y=this.getFrameByPos("video",null===(k=f)||void 0===k?void 0:k.newSegmentIdx,h.index,w))&&(h=y)}if(h&&g)return{endAudioFrame:g,endVideoFrame:h,segmentIdx:Math.min(null===(n=f)||void 0===n?void 0:n.newSegmentIdx,null===(r=v)||void 0===r?void 0:r.newSegmentIdx),size:Math.max(h.offset+h.size,g.offset+g.size)-l};if(h)return{segmentIdx:null===(i=f)||void 0===i?void 0:i.newSegmentIdx,size:h.offset+h.size-l,endVideoFrame:h};if(g)return{segmentIdx:null===(a=v)||void 0===a?void 0:a.newSegmentIdx,endAudioFrame:g,size:g.offset+g.size-l}}},{key:"getFrameByPos",value:function(e,t,n,r){var i="video"===e?this.videoTrak:this.audioTrak;if(!(null!=i&&i.length))return null;for(var a=!1,o=n+1,s=t;s0?u[u.length-1]:null,f=(null===(r="video"===e?null==l?void 0:l.endVideoFrame:null==l?void 0:l.endAudioFrame)||void 0===r?void 0:r.index)||0,h=(null==l?void 0:l.segmentIdx)||0,v=Math.round(s/o[0].frames[0].duration),g=h;g0&&(p[p.length-1].index-f>=v||g===o.length-1)){var m=o[o.length-1].frames,_=Math.min(m[m.length-1].index,f+v)-p[0].index;c=p[_],d=d<0?g:Math.min(d,g);break}}return this.log(i._.LOG,"calculateSize, type: ".concat(e,", frameNum: ").concat(v,", idx: ").concat(f,"-").concat(null===(a=c)||void 0===a?void 0:a.index)),{newSegmentIdx:d,endFrame:c}}},{key:"createAdaptTimeRange",value:function(e,t){var n,r,a,o=this.calculateSize(e,t),s=o.size-1;if(this.log(i._.LOG,"createAdaptTimeRange, mergeDuration: ".concat(e,", adaptIdx:").concat(t,", loadSize:").concat(s)),0===s)return null;var u=this.adaptTimeRange,c=!t||t<=0?u.length-1:t-1,d=c>=0?u[c]:null,l=(null==d||null===(n=d.range)||void 0===n?void 0:n[1])+1||this.timeRange[0].range[0];if(l>=this.fileSize)return null;var f=Math.min(l+s-1,this.fileSize-1),h=(null==d?void 0:d.endTime)||this.timeRange[0].startTime,v=Math.min(null!=o&&null!==(r=o.endVideoFrame)&&void 0!==r&&r.pts?o.endVideoFrame.pts/this.meta.videoTimescale:Number.MAX_VALUE,null!=o&&null!==(a=o.endAudioFrame)&&void 0!==a&&a.pts?o.endAudioFrame.pts/this.meta.audioTimescale:Number.MAX_VALUE),g=o.endAudioFrame,p=o.endVideoFrame;return{startTime:h,endTime:v,range:[l,f],duration:e,downloaded:!1,isLoading:!1,endAudioFrame:g,endVideoFrame:p,segmentIdx:o.segmentIdx}}},{key:"getCurLoadSize",value:function(e){return(!e||e<=0)&&(e=5),Math.ceil(e*Math.floor(this._bitRate/8||this.fileSize/this.meta.duration))}},{key:"getFragRange",value:function(e){var t,n=this.adaptTimeRange;if(e=0)return this.log(i._.LOG,",getAdaptIdxBySrcIdx, fragIndex, ",e,",adaptIdx,",o),o;if(n[a-1].range[1]=(null===(u=n[n.length-1].range)||void 0===u?void 0:u[1]);){this.updateAdaptTimeRange(e,this.lastTargetDur||5);var s,u,c=this.getAdaptIdx(e);if(c>0)return this.log(i._.LOG,"new make, getAdaptIdxBySrcIdx, fragIndex: ",e,",adaptIdx: ",o),c}return this.adaptTimeRange.length-1}},{key:"getAdaptIdx",value:function(e){var t,n=this.adaptTimeRange,r=this.timeRange,a=null===(t=r[e])||void 0===t?void 0:t.range;!a&&(a=o.Z.getFragRange(e,this.videoTrak,this.audioTrak),r[e].range=a,this.log(i._.LOG,",updateTimeRange.range, fragIndex: ",e,JSON.stringify(r[e])));var s=n.findIndex(function(e){var t,n;return(null==e?void 0:e.range[0])<=(null===(t=a)||void 0===t?void 0:t[0])&&(null==e?void 0:e.range[1])>=(null===(n=a)||void 0===n?void 0:n[0])});return this.log(i._.LOG,",getAdaptIdx, srcIdx: ",e,JSON.stringify(r[e]),", adaptIdx: ",JSON.stringify(n[s])),s}},{key:"resetFragmentLoadState",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.log(i._.LOG,", resetFragmentLoadState, fragIndex: ",e,",changeBitrate: ",n),n){var r=this.adaptTimeRange.length;this.adaptTimeRange.splice(e+1,r-e-1),t=this.adaptTimeRange.map(function(e){return e.duration}),this.adaptTimeRange=[]}else t=this.adaptTimeRange;for(var a=this.adaptTimeRange,o=0;o>>>>getSubRange finalRange ",JSON.stringify(d),",oldRange,",JSON.stringify(n),",adaptIdx,",e,",srcFragIndex,",c,JSON.stringify(s[c])),d}},{key:"calculateRange",value:function(e){return o.Z.getFragRange(e,this.videoTrak,this.audioTrak)}},{key:"fillGopData",value:function(e){var t=-1,n=-1,r=-1;if(this.videoTrak.length){var a=this.getEndFrameByTime("video",e);t=(null==a?void 0:a.index)||-1,r=a.offset+a.size;var o=this.getEndFrameByTime("audio",e);n=(null==o?void 0:o.index)||-1,r=Math.max(r,o.offset+o.size)}else{var s=this.getEndFrameByTime("audio",e);n=(null==s?void 0:s.index)||-1,r=s.offset+s.size}this.fillGopDataInfo={endVFrameIdx:t,endAFrameIdx:n,endRange:r},this.log(i._.LOG,"fillGopDataInfo: ".concat(t,", ").concat(n,", ").concat(r))}},{key:"getEndFrameByTime",value:function(e,t){var n="video"===e?this.videoTrak:this.audioTrak;if(n){var r=n.find(function(e){return e.startTime<=t&&e.endTime>t});if(r)return r.frames[r.frames.length-1]}}}])}(n(614184).Yx)},858985:function(e,t,n){n.d(t,{F5:function(){return d},Pj:function(){return o},Ru:function(){return i},Vh:function(){return l},Wp:function(){return c},f4:function(){return a},mH:function(){return u},pl:function(){return s}}),n(232070),n(759943);var r=n(718828),i={playBtnClick:function(e,t,n,r){!e.paused&&e.waitingMoreBuffer&&(e.waitingMoreBuffer=!1),r.call(e,t,n)}},a={waiting:function(e,t){var n=e.player,r=e.eventName;n.waitingMoreBuffer=!0,t(r,e)},play:function(e,t){var n=e.player,r=e.eventName;!n.waitingMoreBuffer&&t(r,e)},pause:function(e,t){var n=e.player,r=e.eventName;!n.waitingMoreBuffer&&t(r,e)},seeking:function(e,t){var n=e.player,r=e.eventName;n.isSeekingStart=!0,t(r,e)},progress:function(e,t){(0,r.cM)(">>>>progress");var n=e.player,i=e.eventName;if(n.waitingMoreBuffer){var a=n.getBufferedRange(n.buffered2);0===a[0]&&0===a[1]||(void 0===n.inWaitingStart||n.isSeekingStart?((0,r.cM)("progress startplay or seek ended"),a[1]-n.currentTime>=(n.config.canplayWaterLevel||1)||a[1]>n.duration-1?((0,r.cM)("progress out bufferWaterLevel"),n.play()):((0,r.cM)("progress not out bufferWaterLevel"),n.emit("waiting"))):((0,r.cM)("progress video waiting end"),a[1]-n.currentTime>=(n.config.bufferWaterLevel||5)||a[1]>n.duration-1?((0,r.cM)("progress out bufferWaterLevel"),n.play()):((0,r.cM)("progress not out bufferWaterLevel"),n.emit("waiting"))))}t(i,e)},playing:function(e,t){var n=e.player,i=e.eventName;(0,r.cM)("playing");var a=n.getBufferedRange(n.buffered2);if(0===a[0]&&0===a[1]){(0,r.cM)("playing currentTime no buffer, not out bufferWaterLevel"),n.waitingMoreBuffer=!0,n.pause(),t.call("waiting",e);return}void 0===n.inWaitingStart||n.isSeekingStart?((0,r.cM)("playing startplay or seek ended"),a[1]-n.currentTime>=(n.config.canplayWaterLevel||1)||a[1]>n.duration-1?((0,r.cM)("playing out bufferWaterLevel"),n.waitingMoreBuffer=!1,n.isSeekingStart=!1,t(i,e)):((0,r.cM)("playing not out bufferWaterLevel"),n.waitingMoreBuffer=!0,n.pause(),t.call("waiting",e))):((0,r.cM)("playing video waiting ended"),a[1]-n.currentTime>=(n.config.bufferWaterLevel||5)||a[1]>n.duration-1?((0,r.cM)("playing out bufferWaterLevel"),n.waitingMoreBuffer=!1,t(i,e)):((0,r.cM)("playing not out bufferWaterLevel"),n.waitingMoreBuffer=!0,n.pause(),t.call("waiting",e)))}};function o(e){return/^http(s)?:\/\/.+/.test(e)}function s(e,t){return Math.round(8e3*e/t/1024)}function u(e){var t,n;return!((null==e||null===(t=e.message)||void 0===t?void 0:t.indexOf("Failed to fetch"))>=0)&&(null==e||!e.isTimeout)&&(null==e||!e.response||!((null===(n=e.response)||void 0===n?void 0:n.status)>=400)||!(e.response.status<=599))&&!0}function c(e){var t,n;return!((null==e||null===(t=e.message)||void 0===t?void 0:t.indexOf("Failed to fetch"))>=0)&&(null==e||!e.response||!((null===(n=e.response)||void 0===n?void 0:n.status)>=400)||!(e.response.status<=599))&&!0}function d(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.preLoadMeta||t}function l(e,t){for(var n=e.vtype,r=e.codecType,i=e.definition,a=e.bitrate,o=null,s,u=0;s=t[u];u++){var c=s.vtype===n;if(c&&(c=s.codecType===r),c&&(c=s.definition===i||s.definition===Number(i)),c&&(c=!s.bitrate||!a||Number(s.bitrate)===Number(a)),c){o=s;break}}return o}},235154:function(e,t,n){n.d(t,{E0:function(){return h},G9:function(){return f},Gb:function(){return d},Hs:function(){return c},KI:function(){return s},pU:function(){return l},qK:function(){return u},u8:function(){return o},yx:function(){return a}});var r=n(61072);n(936553),n(313036),n(124300),n(173757),n(2885),n(248385),n(759943),n(240148),n(832674),n(905442),n(446336),n(808483),n(840938),n(118438),n(325598),n(92999),n(611067),n(273723),n(724016),n(803903),n(214604),n(901250),n(318922),n(755006),n(437048),n(488336),n(825666),n(177162),n(286633),n(943281),n(810658),n(82726),n(224727);function i(){var e=window.navigator.userAgent,t=e.indexOf("MSIE "),n=e.indexOf("Trident/");return t>0||n>0}function a(){return/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)}function o(){var e=window.chrome,t=window.navigator,n=t.vendor,r=void 0!==window.opr,i=t.userAgent.indexOf("Edge")>-1;return t.userAgent.match("CriOS")||null!=e&&"Google Inc."===n&&!1===r&&!1===i}function s(){var e,t,n,r,o,s,u,c,d;return!!navigator.requestMediaKeySystemAccess&&(e=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/);if(e&&e[1]){var t=parseInt(e[1],10);if(t>0)return t}return null}(),t=a(),n=i(),u=(r=navigator.mimeTypes,o=navigator.userAgent,s=!1,r&&o.indexOf("Chrome")>1&&(s=Object.keys(r).some(function(e){return!!(r[e].type&&r[e].type.indexOf("360")>-1||r[e].type&&r[e].type.indexOf("application/vnd.chromium.remoting-viewer")>-1||r[e].description&&r[e].description.indexOf("360")>-1)||!1})),s&&(null===e||e<=100)),c=navigator.userAgent.indexOf("Firefox")>0,d=navigator.userAgent.indexOf("Edge")>0,!t&&!n&&!u&&!c&&!d)}function u(){try{if(("undefined"==typeof WebAssembly?"undefined":(0,r.Ac)(WebAssembly))==="object"&&"function"==typeof WebAssembly.instantiate){var e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e) instanceof WebAssembly.Instance}}catch(e){}return!1}function c(){if("undefined"==typeof self)return!1;var e=function(){if("undefined"!=typeof self)return self.MediaSource||self.WebKitMediaSource}(),t=!!e&&"function"==typeof e.isTypeSupported;return t&&void 0===self.MediaSource&&(self.MediaSource=e),t}function d(){return c()&&u()&&!i()}function l(){return u()&&!i()}function f(){return"undefined"!=typeof MediaSource&&!!MediaSource.isTypeSupported&&(MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"'))}function h(){return"undefined"!=typeof MediaSource&&!!MediaSource.isTypeSupported&&MediaSource.isTypeSupported("video/mp4;codecs=bvc2.1.6.L93.B0")}},441226:function(e,t,n){n.d(t,{Z:function(){return i}});var r=n(61072);n(248385),n(679308);var i=(0,r.qH)(function e(){(0,r.PA)(this,e);var t,n,i=new Promise(function(e,r){t=e,n=r});return i.resolve=function(e){t(e),i.state="fulfilled"},i.reject=function(e){n(e),i.state="rejected",i.isBreak="DESTROYED"===e},i.state="pending",i},[{key:"resolve",value:function(e){}},{key:"reject",value:function(e){}}])},358452:function(e,t,n){n.d(t,{Z:function(){return a}});var r=n(648955);n(918016);var i=n(340343),a=(0,r.qH)(function e(t,n,a,o){(0,r.PA)(this,e),this.adaptRangeRes=[],o&&(this.adaptRange=new i.Q(t,n,a,o))},[{key:"push",value:function(e){var t;null===(t=this.adaptRangeRes)||void 0===t||t.push(e)}},{key:"pop",value:function(){var e;return null===(e=this.adaptRangeRes)||void 0===e?void 0:e.shift()}},{key:"updateBitrate",value:function(e){var t;null===(t=this.adaptRange)||void 0===t||t.updateBitrate(e)}},{key:"getAdaptCacheBuffer",value:function(e){var t,n=null===(t=this.adaptRange)||void 0===t?void 0:t.getAdaptCacheBuffer();return(Number.isNaN(n)||!n)&&(n=e),n}},{key:"destroy",value:function(){this.adaptRange=null,this.adaptRangeRes=[]}}])},655675:function(e,t,n){n.d(t,{Z:function(){return y}});var r=n(6055);n(346984),n(124300),n(9498),n(497397),n(248385),n(679308),n(591111),n(490629);var i=n(867348),a=n(832567),o=n(99020),s=n(494742),u=n(129966),c={},d="readonly",l="readwrite";function f(e){var t=c[e.name],n={};n.promise=new Promise(function(e,t){n.resolve=e,n.reject=t}),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then(function(){return n.promise}):t.dbReady=n.promise}function h(e,t){return new Promise(function(n,r){if(c[e.name]=c[e.name]||_(),e.db){if(!t)return n(e.db);f(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var o=null===a.Z||void 0===a.Z?void 0:a.Z.open.apply(a.Z,i);t&&(o.onupgradeneeded=function(t){var n=o.result;try{n.createObjectStore(e.storeName)}catch(e){if("ConstraintError"===e.name);else throw e}}),o.onerror=function(e){e.preventDefault(),r(o.error)},o.onsuccess=function(){n(o.result),!function(e){var t=c[e.name].deferredOperations.pop();if(t)t.resolve(),t.promise}(e)}})}function v(e){return h(e,!1)}function g(e){return h(e,!0)}function p(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.versione.db.version;if(r&&(e.version,e.version=e.db.version),i||n){if(n){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function m(e,t,n,r){void 0===r&&(r=1);try{var i=e.db.transaction(e.storeName,t);n(null,i)}catch(i){if(r>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return Promise.resolve().then(function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),h(e,!0)}).then(function(){return(function(e){f(e);for(var t=c[e.name],n=t.forages,r=0;rthis.lastAdaptCacheBuffer&&(a=this.lastAdaptCacheBuffer);var o=0;return re.duration&&(o=e.duration-r),(0,i.uZ)(o,t.rangeMinDuration,t.rangeMaxDuration)}return Math.max(t.rangeMaxDuration-r,t.rangeMinDuration)}},{key:"getAdaptCacheBuffer",value:function(){var e=this.player,t=this.config,n=this.bitrate;if(!t.targetCacheControl)return this.lastAdaptCacheBuffer=-1,-1;var r=t.estPlayTime,i=(null==e?void 0:e.currentTime)||0,a=r;t.use_weibull?a=this.calcToPlayDurationMs(t.cdf_for_playing_media_buffer)/1e3:t.estPTcontrol&&(a=Math.min(r,(this.duration||(null==e?void 0:e.duration)||0)-i));var o=t.playbackRateControl&&e?e.playbackRate:1,s=e&&1024*e.avgSpeed/o||0,u=Math.max(t.safeFactor*s,t.minBandwidth);null!=e&&e.avgSpeed&&(u=t.safeFactor*s);var c=n>0?Math.floor((1-u/n)*a):0;return c=t.minDangerThreshold+Math.max(c,0),this.lastAdaptCacheBuffer=Math.min(Math.max(t.cacheSafeFactor*c,t.minTargetCacheDur),t.maxTargetCacheDur),this.lastAdaptCacheBuffer}},{key:"calcToPlayDurationMs",value:function(e){var t,n=this.player,r=this.config,a=null==n||null===(t=n.config)||void 0===t||null===(t=t.mediaInfo)||void 0===t?void 0:t.play_time_prob_dist,o=(0,i.eq)(a,r.default_weibull_param||i.XB),s=1e3*(this.duration||(null==n?void 0:n.duration)||0),u=1e3*((null==n?void 0:n.currentTime)||0),c=(0,i.cF)(o,e,s,u)-u;return c=(0,i.uZ)(c,r.min_to_play_ms,r.max_to_play_ms)}}],[{key:"getDefaultConfig",value:function(){return{rangeMaxDuration:15,rangeMinDuration:5,rangeMinSize:409600,safeFactor:.1,cacheSafeFactor:3,minDangerThreshold:5,estPlayTime:12,minBandwidth:1e6,estPTcontrol:!1,minTargetCacheDur:30,maxTargetCacheDur:60,targetCacheControl:!1,rangeControl:!1,playbackRateControl:!1,use_weibull:!1,default_weibull_param:i.XB,cdf_for_playing_media_buffer:.5,cdf_for_playing_media_low:.25,min_to_play_ms:1e3,max_to_play_ms:5e3}}}])},804870:function(e,t,n){n.d(t,{e:function(){return c}});var r=n("137263");n("346984"),n("705574"),n("124300"),n("162093"),n("171655"),n("932651"),n("2885"),n("248385"),n("591111"),n("437545"),n("630361"),n("497736"),n("954018"),n("506442"),n("795434"),n("664089"),n("863063"),n("478782"),n("866124"),n("378508"),n("70698"),n("669689"),n("490629");var i=n("55743"),a=n("479248"),o=n("275764"),s=(0,r.qH)(function e(t,n,i,a){var o=this;(0,r.PA)(this,e),this.config=e.getDefaultConfig(),Object.keys(a).map(function(e){void 0!==a[e]&&null!==a[e]&&(o.config[e]=a[e])}),this.duration=i,this.player=t,this.updateBitrate(n),this.curPCDNInBuffer=this.config.maxPCDNInBuffer,this.curPCDNOutBuffer=this.config.maxPCDNOutBuffer,this.PCDNChangeCnt=0},[{key:"updateBitrate",value:function(e){this.bitrate=e,!this.bitrate&&(this.bitrate=this.config.minBandwidth)}},{key:"getPCDNInBuffer",value:function(){var e=this.config,t=this.player,n=this.bitrate;if(!e.PCDNBufferControl)return null;var r=e.estPlayTime,i=r;e.estPTcontrol&&(i=Math.min(r,Math.max(0,this.duration-((null==t?void 0:t.currentTime)||0))));var a=e.safePCDNInFactor,o=e.minBandwidth,s=e.maxPCDNInBuffer,u=e.minPCDNInBuffer,c=a*Math.max((null==t?void 0:t.avgSpeedPCDN)*1024||0,o),d=n>0?(1-c/n)*i:0;return this.curPCDNInBuffer=Math.min(s,Math.max(u,d)),this.curPCDNInBuffer}},{key:"getPCDNOutBuffer",value:function(){var e=this.config,t=this.player,n=this.bitrate;if(!e.PCDNBufferControl)return null;var r=e.estPlayTime,i=r;e.estPTcontrol&&(i=Math.min(r,Math.max(0,this.duration-((null==t?void 0:t.currentTime)||0))));var a=e.safePCDNOutFactor,o=e.minBandwidth,s=e.maxPCDNOutBuffer,u=e.minPCDNOutBuffer,c=a*Math.max((null==t?void 0:t.avgSpeedPCDN)*1024||0,o),d=n>0?(1-c/n)*i:0;return this.curPCDNOutBuffer=Math.min(s,Math.max(u,d)),this.curPCDNOutBuffer}},{key:"getPCDNChangeCnt",value:function(){var e=this.config,t=e.PCDNCntControl,n=e.alpha,r=this.curPCDNInBuffer,i=this.player,a=(null==i?void 0:i.bufferedPoint)||null,o=a&&a.end?a.end-i.currentTime:0;return t?o>r+(this.PCDNChangeCnt-1)*n&&this.PCDNChangeCnt++:o>=r&&this.PCDNChangeCnt<2&&this.PCDNChangeCnt++,this.PCDNChangeCnt}}],[{key:"getDefaultConfig",value:function(){return{PCDNBufferControl:!1,PCDNCntControl:!1,estPTcontrol:!1,minPCDNInBuffer:8,maxPCDNInBuffer:12,minPCDNOutBuffer:3,maxPCDNOutBuffer:6,safePCDNInFactor:.1,safePCDNOutFactor:.4,alpha:.5,estPlayTime:12,minBandwidth:1e6}}}]),u=new Map,c=function(){var e,t;function n(e,t,a,o){var u,c=this;(0,r.PA)(this,n),this.options=n.getDefaultConfig(),Object.keys(e).map(function(t){void 0!==e[t]&&null!==e[t]&&(c.options[t]=e[t])}),!this.options.productConfig||this.options.productConfig.app_id,this.loader=new i.mf(this.options),this.resetTrackeArgs(),this._lastFileInfo=null,this.lastfetchNodeTime=-1,this._lastRetFileKey=null,this._minUpdateNodeStep=this.options.ErrorTimeStep,null!==(u=this.options)&&void 0!==u&&null!==(u=u.adaptPCDNConfig)&&void 0!==u&&u.PCDNBufferControl&&(this.pcdnAdapt=new s(t,a,o,this.options.adaptPCDNConfig))}return(0,r.qH)(n,[{key:"isOpenAdaptPCDN",get:function(){return!!this.pcdnAdapt}},{key:"curPCDNInBuffer",get:function(){return this.pcdnAdapt.curPCDNInBuffer}},{key:"getPCDNInBuffer",value:function(){var e;return null===(e=this.pcdnAdapt)||void 0===e?void 0:e.getPCDNInBuffer()}},{key:"curPCDNOutBuffer",get:function(){return this.pcdnAdapt.curPCDNOutBuffer}},{key:"getPCDNOutBuffer",value:function(){var e;return null===(e=this.pcdnAdapt)||void 0===e?void 0:e.getPCDNOutBuffer()}},{key:"curPCDNChangeCnt",get:function(){return this.pcdnAdapt.PCDNChangeCnt}},{key:"getPCDNChangeCnt",value:function(){var e;return null===(e=this.pcdnAdapt)||void 0===e?void 0:e.getPCDNChangeCnt()}},{key:"updatePCDNBitrate",value:function(e){var t;return null===(t=this.pcdnAdapt)||void 0===t?void 0:t.updateBitrate(e)}},{key:"resetTrackeArgs",value:function(e){this.trackeArgs={fid:null,trace_id:null,req_times:(null==e?void 0:e.req_times)||0,resp_times:(null==e?void 0:e.resp_times)||0,token:null,node_num:this.options.node_num,client_info:this.options.client_info}}},{key:"getPCDNNode",value:function(e,t,n){var r,i=l(t),o=u.get(d(e,i)),s=new a.Q;return!(null!=o&&o.nodes)||(null==o||null===(r=o.nodes)||void 0===r?void 0:r.length)<1?this.fetchPCDNNode(null,null,n).then(function(e){s.resolve(e)}).catch(function(e){s.reject(e)}):(o.fromCache=!0,s.resolve(o)),s}},{key:"removePCDNNode",value:function(e,t,n){var r=l(t),i=u.get(d(e,r)),a=null==i?void 0:i.nodes;a&&(n?i.nodes=a.filter(function(e){return e&&0>n.indexOf(e.url)}):a.shift(),u.set(d(e,r),i)),(!a||!a.length)&&this.fetchPCDNNode().then().catch(function(){})}},{key:"fetchPCDNNode",value:(e=(0,r.x)((0,r.l5)().mark(function e(t,o,s){var c,f,h,v,g,p,m,_,y,b,k,C,w,T,x,E;return(0,r.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(c=new a.Q,o){e.next=5;break}o=this._lastFileInfo,e.next=15;break;case 5:if(o.byterate=l(o.bitrate),this.options.trackerOptions&&Object.assign(o,this.options.trackerOptions),this._lastFileInfo=Object.assign({},o,{byterate:o.byterate}),!((null==(h=u.get(d(o.vid,o.byterate)))||null===(f=h.nodes)||void 0===f?void 0:f.length)>0)){e.next=13;break}return h.fromCache=!0,c.resolve(h),e.abrupt("return",c);case 13:delete o.bitrate,this._lastFileInfo=o;case 15:if(o){e.next=18;break}return c.resolve(null),e.abrupt("return",c);case 18:if(v=!1,g=d(o.vid,o.byterate),this._lastRetFileKey!==g&&(this.resetTrackeArgs(),v=!0),!(Date.now()-this.lastfetchNodeTime=this.options.maxCnt)){e.next=33;break}return c.resolve(null),e.abrupt("return",c);case 33:return!this.loader&&(this.loader=new i.mf(this.options)),this.trackeArgs.req_times+=1,e.prev=35,n.pcdn_tracker_request_cnt++,e.next=39,this.loader.load(t||this.options.trackerUrl,{body:p});case 39:m=e.sent,_=null,m&&(this.trackeArgs.resp_times+=1,b=8*o.byterate,m.done&&null!==(y=m.data)&&void 0!==y&&y.Result?((_=(k=m.data.Result).nodes)&&_.length>0?n.pcdn_tracker_success_cnt++:this._minUpdateNodeStep=this.options.NULLNodeTimeStep,_.map(function(e){e.vid=o.vid,e.bitrate=b}),C=k.fid,w=k.trace_id,T=k.req_id,x={nodes:_,fid:C,vid:o.vid,trace_id:w,req_id:T,bitrate:b},E=d(o.vid,o.byterate),u.set(E,x),this.trackeArgs.fid=k.fid,this.trackeArgs.trace_id=k.trace_id,this.trackeArgs.token=k.token,c.resolve(x)):(this._minUpdateNodeStep=this.options.ErrorTimeStep,c.reject(m))),e.next=49;break;case 44:e.prev=44,e.t0=e.catch(35),this._minUpdateNodeStep=this.options.ErrorTimeStep,c.reject(e.t0);case 49:return e.abrupt("return",c);case 50:case"end":return e.stop()}},e,this,[[35,44]])})),function(t,n,r){return e.apply(this,arguments)})}],[{key:"pluginName",get:function(){return"PCDN"}},{key:"pcdnReqCnt",get:function(){var e=n.pcdn_tracker_request_cnt,t=n.pcdn_tracker_success_cnt;return n.pcdn_tracker_request_cnt=0,n.pcdn_tracker_success_cnt=0,{pcdn_tracker_request_cnt:e,pcdn_tracker_failed_cnt:e-t}}},{key:"getDefaultConfig",value:function(){return{trackerUrl:"",loaderType:o.t.FETCH,responseType:o.U.JSON,mode:"cors",method:"POST",retry:0,retryDelay:3e3,timeout:5e3,node_num:5,client_info:null,maxCnt:30,withReferer:0,NULLNodeTimeStep:6e4,ErrorTimeStep:15e3}}},{key:"gainPCDNNode",value:(t=(0,r.x)((0,r.l5)().mark(function e(t,o,s,u){var c,d,f,h,v,g;return(0,r.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return c=n.getDefaultConfig(),Object.keys(o).map(function(e){void 0!==o[e]&&null!==o[e]&&(c[e]=o[e])}),!u||u.app_id,d=new a.Q,s?(s.byterate=l(s.bitrate),this.options.trackerOptions&&Object.assign(s,this.options.trackerOptions),delete s.bitrate):d.reject("video fileInfo need set"),f=JSON.stringify(Object.assign(u,{file_info:s},{node_num:(null==o?void 0:o.node_num)||3})),h=new i.mf(c),e.prev=8,n.pcdn_tracker_request_cnt++,e.next=12,h.load(t,{body:f});case 12:(g=e.sent).done&&(null===(v=g.data)||void 0===v||null===(v=v.Result)||void 0===v||null===(v=v.nodes)||void 0===v?void 0:v.length)>0&&n.pcdn_tracker_success_cnt++,d.resolve(g),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(8),d.reject((null===e.t0||void 0===e.t0?void 0:e.t0.message)||"get pcdnNode error");case 20:return e.abrupt("return",d);case 21:case"end":return e.stop()}},e,this,[[8,17]])})),function(e,n,r,i){return t.apply(this,arguments)})}])}();function d(e,t){return"".concat(e,"-").concat(t)}function l(e){return Math.floor(e/8)}(0,r._x)(c,"pcdn_tracker_request_cnt",0),(0,r._x)(c,"pcdn_tracker_success_cnt",0)},382983:function(e,t,n){n.d(t,{Z:function(){return a}}),n(124300),n(248385),n(591111),n(490629),n(656562),n(992871);var r="IWZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBlPXt9LHQ9T2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eTtmdW5jdGlvbiBhKHQscyl7ZVt0XT1zZXRUaW1lb3V0KChmdW5jdGlvbigpe3Bvc3RNZXNzYWdlKHtkYXRhOntmYWtlSWQ6dH19KSxhKHQscyl9KSxzKX1wb3N0TWVzc2FnZSh7ZXZlbnQ6InJlYWR5In0pLGFkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLChmdW5jdGlvbihzKXt0cnl7dmFyIHI9cy5kYXRhLG89dm9pZCAwPT09cj97fTpyLGM9by5hY3Rpb24sbj1vLmZha2VJZCxpPW8udGltZTtzd2l0Y2goYyl7Y2FzZSJzZXRJbnRlcnZhbCI6YShuLGkpO2JyZWFrO2Nhc2UiY2xlYXJJbnRlcnZhbCI6Y2FzZSJjbGVhclRpbWVvdXQiOnQuY2FsbChlLG4pJiYoY2xlYXJUaW1lb3V0KGVbbl0pLGRlbGV0ZSBlW25dKTticmVhaztjYXNlInNldFRpbWVvdXQiOmVbbl09c2V0VGltZW91dCgoZnVuY3Rpb24oKXtwb3N0TWVzc2FnZSh7ZGF0YTp7ZmFrZUlkOm59fSksdC5jYWxsKGUsbikmJmRlbGV0ZSBlW25dfSksaSl9fWNhdGNoKGQpe3Bvc3RNZXNzYWdlKHtldmVudDoiZXJyb3IiLGRhdGE6e2Vycm9yOmR9fSl9fSkpfSgpOwo=",i="undefined"!=typeof window&&window.Blob&&new Blob([atob(r)],{type:"text/javascript;charset=utf-8"});function a(){var e;try{if(!(e=i&&(window.URL||window.webkitURL).createObjectURL(i)))throw"";return new Worker(e)}catch(e){return new Worker("data:application/javascript;base64,"+r)}finally{!("undefined"!=typeof window&&navigator.userAgent.indexOf("Trident/")>0)&&e&&(window.URL||window.webkitlRL).revokeObjectURL(e)}}},874668:function(e,t,n){n.d(t,{Bo:function(){return v},HX:function(){return c},MP:function(){return m},P_:function(){return f},lF:function(){return p},mv:function(){return u},rM:function(){return d},tT:function(){return l},yJ:function(){return h}}),n(124300),n(248385),n(832674),n(905442),n(446336),n(808483),n(840938),n(118438),n(325598),n(92999),n(611067),n(273723),n(724016),n(803903),n(214604),n(901250),n(755006),n(437048),n(488336),n(825666),n(177162),n(286633),n(943281),n(810658),n(82726),n(224727),n(932651);var r,i,a="xg-video",o=!1;try{o=WebAssembly&&WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))}catch(e){}var s={preloadDecoder:!1,reuseWasmDecoder:!0,reuseMseForAudio:!1,preciseSeekLimit:120,h264WithWebcodec:!0,lowDecodeThreshold:75,lowDecodeFpsDelta:10,tempDisabledThreshold:40,wasmFallbackToAsm:!1,audioWithMse:!0,canUseThreadMode:!1,offscreenCanvas:!1,disabledDuration:43200,longDisabledDuration:432e3,evaluateVVCount:0,disabledByLowdecodePrecent:.5,maxDecodeOnceWasm:o?6:8,maxDecodeOnceFirstTime:8,maxDecodeOnceWebcodec:20};function u(){return a}function c(e){a=e}function d(e){s=Object.assign({},s,e,{offscreenCanvas:e.offscreenCanvas&&!!window.OffscreenCanvas})}function l(){return s}function f(){var e="undefined"!=typeof customElements&&customElements.get(a);return e?{H264_DECODER_URL:e.h264Url,ASM_H264_DECODER_URL:e.h264AsmUrl,H265_DECODER_URL:e.h265Url,H265_THREAD_DECODER_URL:e.h265ThreadUrl,H265_SIMD_DECODER_URL:e.h265SimdUrl,ASM_H265_DECODER_URL:e.h265AsmUrl}:{}}function h(){if("undefined"==typeof customElements)return!1;var e=customElements.get(a);return o&&!!(null!=e&&e.h265SimdUrl)}function v(){if("undefined"==typeof customElements)return!1;var e=customElements.get(a);return!!window.SharedArrayBuffer&&!!(null!=e&&e.h265ThreadUrl)}var g=!1;try{g=(null===(r=localStorage)||void 0===r?void 0:null===(i=r.getItem)||void 0===i?void 0:i.call(r,"_sds"))==="y"}catch(e){}function p(){if("undefined"==typeof customElements)return!1;if(g)return!0;var e=!1,t=!1;try{var n=new(window.AudioContext||window.webkitAudioContext);n.close(),n=null,e=!0}catch(e){}try{for(var r=document.createElement("canvas"),i=["webgl","experimental-webgl","moz-webgl","webkit-3d"],a=0;a=e}),this._buffers[0]}},{key:"canSeek",value:function(e){var t=this._buffers[this._buffers.length-1];return!!t&&!(t.startt.start?1:-1}),t=e.length,n=[];if(!t)return n;for(var r={start:e[0].start,end:e[0].end},i=1;iMath.abs(r.end-a.start)?r.end=a.end:(n.push(r),r={start:a.start,end:a.end})}return n.push(r),n}},{key:"getBuffer",value:function(e){if(this.isLive)return this._buffers.shift();var t=this._buffers.filter(function(t){return t.starte+.5})[0];return(a.kg.log(this.TAG,"get audio buffer , currentTime:".concat(e," ,buffer:[").concat(t&&t.start," , ").concat(t&&t.end,"]")),0!==e||t)?t:this._buffers[0]}},{key:"hasBuffer",value:function(){var e;return!!(null!==(e=this._buffers)&&void 0!==e&&e.length)}}]),e}()},651668:function(e,t,n){n.d(t,{Z:function(){return R}}),n("149336");var r=n("315355"),i=n("919209"),a=n("732905"),o=n("64505"),s=n("625813"),u=n("278997"),c=n("508881"),d=n("272787");n("346984"),n("932651");var l=n("597931");n("104882");var f=n("383943"),h=n("906918"),v=n("685290"),g=n("534611"),p=n("874668"),m=function(){function e(t){(0,r.Z)(this,e),this.TAG="DecodeEstimate",this._lowDecodeThreshold=(0,p.tT)().lowDecodeThreshold/5,this._lowDecodeFpsDelta=(0,p.tT)().lowDecodeFpsDelta,this._needEstimate=!0,this._parent=t,this._lastDecodeDot=0,this._lastDecodeCost=0,this._lastFrameDts=0,this._dtsDeltas=[],this._decodeCosts=[],this._lowDecodeQueue=[],this._fps=0,this._decodeFps=0,this._gopLength=0,this._webcodec=!1}return(0,i.Z)(e,[{key:"fps",get:function(){return this._fps}},{key:"decodeFps",get:function(){return this._decodeFps}},{key:"decodeCost",get:function(){return this._lastDecodeCost}},{key:"gopLength",get:function(){return this._gopLength}},{key:"webcodec",set:function(e){this._webcodec=e}},{key:"updateGopCount",value:function(){this._gopLength++}},{key:"needEstimateFps",value:function(){this._needEstimate=!0}},{key:"addDecodeInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{dts:0};this._estimateDecodeFps(e),this._estimateFps(e)}},{key:"resetDecodeDot",value:function(e){this._lastDecodeDot=e||0}},{key:"reset",value:function(){this._decodeCosts=[],this._lowDecodeQueue=[]}},{key:"_estimateFps",value:function(e){if(!this._needEstimate)return;if(!this._lastFrameDts){this._lastFrameDts=e.dts;return}var t=e.dts-this._lastFrameDts;if(this._lastFrameDts=e.dts,!(Math.abs(t)>200)){this._dtsDeltas.push(t);var n=this._dtsDeltas.length;!(n<5)&&(this._fps=Math.ceil(1e3/this._avg(this._dtsDeltas,n)),l.kg.log(this.TAG,"estimate fps:",this._fps),this._needEstimate=!1)}}},{key:"_estimateDecodeFps",value:function(e){if(!this._lastDecodeDot){this._lastDecodeDot=performance.now();return}var t=performance.now(),n=t-this._lastDecodeDot;this._lastDecodeDot=t,e.cost=n,this._lastDecodeCost=n,this._decodeCosts.push(n);var r=this._decodeCosts.length;if(!(r<5)){var i=this._avg(this._decodeCosts,r);this._decodeFps=Math.floor(1e3/i),this._decodeCosts=[],this._lowDecodeDetect()}}},{key:"_avg",value:function(e,t){return Math.floor(e.reduce(function(e,t){return e+=t},0)/t)||1}},{key:"_lowDecodeDetect",value:function(){if(!this._decodeFps){this._parent.emit(g.ZP.VIDEO.DECODE_LOW_FPS,0);return}this._decodeFpsthis._lowDecodeThreshold&&(this._lowDecodeQueue=[],l.kg.log(this.TAG,"解码效率过低,应该降级"),this._parent.emit(g.ZP.VIDEO.DECODE_LOW_FPS,this._decodeFps))}},{key:"destroy",value:function(){this._parent=null}}]),e}(),_=n("830361"),y=function(e){(0,s.Z)(f,e);var t,n,d=(t=f,n=function(){if("undefined"==typeof Reflect||!Reflect.construct||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(){var e,r=(0,c.Z)(t);return e=n?Reflect.construct(r,arguments,(0,c.Z)(this).constructor):r.apply(this,arguments),(0,u.Z)(this,e)});function f(e,t){var n;return(0,r.Z)(this,f),(n=d.call(this,e,t))._timeRange=new h.Z((0,a.Z)(n)),n._decodeEstimate=new m((0,a.Z)(n)),n._frameQueue=new v.Z((0,a.Z)(n)),n._lastTimeupdate=0,n._renderCost=0,n._canAutoPlay=!0,n._videoDecode=!1,n._inSeeking=!1,n._frameRender=null,n._configuration=null,n._canvasLayoutDone=!1,n._render=n._render.bind((0,a.Z)(n)),n._renderWorker=new _.Z(n._render,e,(0,a.Z)(n)),n._canvas=n._renderWorker.canvas,n._bindEvents(),n}return(0,i.Z)(f,[{key:"canAutoPlay",get:function(){return this._canAutoPlay}},{key:"canvas",get:function(){return this._canvas}},{key:"timescale",get:function(){return 1e3}},{key:"fps",get:function(){return this._decodeEstimate.fps||this._meta&&this._meta.fpsNum/this._meta.fpsDen||24}},{key:"decodeFps",get:function(){return this._decodeEstimate.decodeFps}},{key:"decodeCost",get:function(){return this._decodeEstimate.decodeCost}},{key:"renderCost",get:function(){return this._renderCost}},{key:"totalSize",get:function(){return this._timeRange.totalSize}},{key:"bitrate",get:function(){return this._timeRange.bitrate},set:function(e){this._timeRange.bitrate=e}},{key:"gopLength",get:function(){return this._decodeEstimate.gopLength}},{key:"is540p",get:function(){return this._canvas.height<720}},{key:"buffered",get:function(){return this._timeRange.buffered}},{key:"inSeeking",get:function(){return this._inSeeking}},{key:"interval",get:function(){return Math.floor(1e3/this.fps/this.playbackRate)}},{key:"playbackRate",get:function(){return this._playbackRate||1}},{key:"baseDts",get:function(){return this._timeRange.baseDts}},{key:"currentTime",get:function(){return this._timeRange.getCurrentTime(this.preciseVideoDts)}},{key:"timelinePosition",get:function(){return this._parent.timelinePosition}},{key:"lastTimelinePosition",get:function(){return this._lastTimelinePosition||0},set:function(e){this._lastTimelinePosition=e}},{key:"audioSyncDts",get:function(){return this._audioDts||this.baseDts},set:function(e){this._audioDts=e}},{key:"preciseVideoDts",get:function(){return this.audioSyncDts+Math.floor((this.timelinePosition-this.lastTimelinePosition)*1e3)}},{key:"readyState",get:function(){var e=this._frameQueue.length||(this.currentTime?1:0);return e?e>=8?4:e>=4?3:e>=2?2:1:0}},{key:"isHevc",get:function(){return!("hev1.1.6.L93.B0"!==(this._meta||{}).codec)}},{key:"videoDecode",get:function(){return this._videoDecode}},{key:"decoderMode",get:function(){var e;return null===(e=this._decodeController)||void 0===e?void 0:e.decoderMode}},{key:"configuration",get:function(){var e,t;return this._configuration?this._configuration:(this._configuration=this._meta.configuration||(0,l.Mv)(null===(e=this._meta)||void 0===e?void 0:e.sps[0],null===(t=this._meta)||void 0===t?void 0:t.pps[0]),this._configuration)},set:function(e){this._configuration=e.configuration||(0,l.Mv)(e.sps[0],e.pps[0])}},{key:"setSeekingStatus",value:function(e){this._inSeeking=e}},{key:"getDtsOfTime",value:function(e){return this._timeRange.getDtsOfTime(e)}},{key:"updateReady",value:function(){this._whenReady()}},{key:"forceRender",value:function(){this._render(!0)}},{key:"getSeekStartPosition",value:function(e,t){return this._timeRange.getSeekStartPosition(e,t)}},{key:"getSeekStartPositionBehind",value:function(e,t){return this._timeRange.getSeekStartPositionBehind(e,t)}},{key:"canSeek",value:function(){throw Error("need override by children")}},{key:"emitResizeEvent",value:function(){this===null||void 0===this||this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.RESIZE)}},{key:"_assembleErr",value:function(e,t){var n=Error(e);return n.code=3,n.subCode=t,n}},{key:"_emitError",value:function(e,t){this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.ERROR,this._assembleErr(e,t))}},{key:"_emitTimelineEvents",value:function(e,t,n){var r;null===(r=this._parent)||void 0===r||r.emit(e,t,n)}},{key:"_bindEvents",value:function(){var e=this;(0,o.Z)((0,c.Z)(f.prototype),"_bindEvents",this).call(this);var t=function(t){var n=t.width,r=t.height,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=e._canvas,s=o.width,u=o.height,c=r*s/u,d=n*u/s,f=n-c,h=r-d,v=f*i+"px",g=h*a+"px";e._canvas.style.left=v,e._canvas.style.top=g,l.kg.warn(e.TAG,"cvsWidth=".concat(s,", cvsHeight=").concat(u,", scaleCvsWidth=").concat(c,", scaleCvsHeight=").concat(d)),l.kg.warn(e.TAG,"cover position: deltaX=".concat(f,", deltaY=").concat(h,", width=").concat(n,", height=").concat(r,", pX=").concat(v,", pY=").concat(g))};this._parent.on(g.ZP.VIDEO.UPDATE_VIDEO_FILLTYPE,function(n,r){var i=r.width,a=r.height,o=e._canvas,s=o.width,u=o.height,c=!i||i/a>s/u;if(l.kg.warn(e.TAG,"UPDATE_VIDEO_FILLTYPE isGapX =",c,"type =",n,s,u,i,a),e._canvas.style.maxWidth="initial",e._canvas.style.maxHeight="initial","cover"===n){if(c){e._canvas.style.left=0,e._canvas.style.top=0,e._canvas.style.height="auto",e._canvas.style.width="100%",t({width:i,height:a},0,.5);return}e._canvas.style.left=0,e._canvas.style.top=0,e._canvas.style.width="auto",e._canvas.style.height="100%",t({width:i,height:a},.5,0);return}if("fill"===n){e._canvas.style.width="100%",e._canvas.style.height="100%";return}e._canvas.style.top=0,e._canvas.style.bottom=0,e._canvas.style.left=0,e._canvas.style.right=0,e._canvas.style.maxWidth="100%",e._canvas.style.maxHeight="100%",e._canvas.style.width="initial",e._canvas.style.height="initial",su/a?e._canvas.style.width="100%":e._canvas.style.height="100%")}),this._parent.on(g.ZP.VIDEO.UPDATE_VIDEO_COVER_POSITION,t),this._parent.on(g.ZP.TIMELINE.SYNC_DTS,function(t){var n,r=e._frameQueue.nextFrame(),i=r&&r.info&&r.info.dts;if(e.lastTimelinePosition=e.timelinePosition,e.noAudio){var a=e._timeRange.nextFrame();t=t||i||a&&a.dts||0}if(e.audioSyncDts=t,i&&i-t>500&&e._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.LARGE_AV_GAP,{aDts:t,vDts:i,frameLength:e._frameQueue.length,currentTime:e._parent.currentTime,duration:e._parent.duration}),l.kg.log(e.TAG,"audio current buffer play finish, next buffer dts=",t,"currentTime:",e._parent.currentTime,"preciseVideoDts:",e.preciseVideoDts,"next video frame dts:",i,"frame length:",e._frameQueue.length),!e._isLive&&!(null!==(n=e._parent)&&void 0!==n&&n.seeking)){var o=e._timeRange.nextFrame();if(o){var s=(o.dts-o.baseDts)/1e3;e._parent.currentTime-s>1&&(l.kg.warn(e.TAG,"丢帧!"),e.ajustSeekTime(e._parent.currentTime))}}}),this._parent.on(g.ZP.TIMELINE.UPDATE_GL_OPTIONS,function(t){e._config.glCtxOptions=t}),this._parent.on(g.ZP.TIMELINE.UPDATE_SEGMENT_END,this._updateSegmentEnd.bind(this)),this.on(g.ZP.VIDEO.AUTO_RUN,this._startRender.bind(this)),this._parent.on(g.ZP.TIMELINE.SET_PLAYBACKRATE,function(t){e._playbackRate=t,e._startRender()})}},{key:"ajustSeekTime",value:function(){throw Error("need override by children")}},{key:"_resetDts",value:function(e,t){"audio"!==t&&this._timeRange.resetDts(e)}},{key:"_setMetadata",value:function(e,t){if("audio"!==e){l.kg.warn(this.TAG,"video set metadata"),this._meta=t;var n=t&&t.frameRate&&t.frameRate.fps;n?l.kg.log(this.TAG,"detect fps:",n):l.kg.warn(this.TAG,"no detect fps,start estimate"),this._initDecoder()}}},{key:"_initDecoder",value:function(){throw Error("need override by children")}},{key:"_whenDecoderReady",value:function(){throw Error("need override by children")}},{key:"_appendChunk",value:function(){throw Error("need override by children")}},{key:"_startDecode",value:function(){throw Error("need override by children")}},{key:"_receiveFrame",value:function(e,t){if(!!this._parent&&!!this._timeRange){var n=e.info||{};if(this._decodeEstimate.addDecodeInfo(n),this._checkCanvasLayout(e),!this._isLive&&((n.output||n.keyframe)&&(this.setSeekingStatus(!1),l.kg.warn(this.TAG,"set seeking status=",!1)),this.inSeeking)){l.kg.log(this.TAG,"drop frame"),(0,v.s)(e);return}this._isLive?this._frameQueue.append(e):this._frameQueue.appendVodFrame(e),t&&t(),!this._ready&&this.readyState>=1&&this._whenReady()}}},{key:"_checkCanvasLayout",value:function(e){!this._canvasLayoutDone&&e.width===this._canvas.width&&(e.width/e.height).toFixed(2)===(this._canvas.width/this._canvas.height).toFixed(2)&&(this===null||void 0===this||this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.CANVAS_LAYOUT),this._canvasLayoutDone=!0)}},{key:"_startRender",value:function(){l.kg.log(this.TAG,"start render"),this._renderWorker.startLoop(this.interval)}},{key:"_render",value:function(){throw Error("need override by children")}},{key:"_updateSegmentEnd",value:function(){throw Error("need override by children")}},{key:"_whenReady",value:function(){this._ready=!0,this.emit(g.ZP.VIDEO.VIDEO_READY),this.noAudio&&this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.PLAYING)}},{key:"_doPlay",value:function(){this._renderWorker.startLoop()}},{key:"_doPause",value:function(){this._renderWorker.stopLoop()}},{key:"_doSeek",value:function(){this._ready=!1,this._frameQueue.destroy()}},{key:"_doChaseFrame",value:function(){throw Error("need override by children")}},{key:"destroy",value:function(e){var t,n,r,i,a,o;null===(t=this._renderWorker)||void 0===t||t.destroy(e),null===(n=this._timeRange)||void 0===n||n.destroy(),null===(r=this._frameQueue)||void 0===r||r.destroy(),null===(i=this._frameRender)||void 0===i||null===(a=i.destroy)||void 0===a||a.call(i),null===(o=this._decodeEstimate)||void 0===o||o.destroy(),this._renderWorker=null,this._canvas=null,this._timeRange=null,this._frameQueue=null,this._frameRender=null,this._decodeEstimate=null,this._parent=null,this.removeAllListeners()}}]),f}(f.Z),b=n("845905");n("705574"),n("124300"),n("248385"),n("832674"),n("905442"),n("446336"),n("808483"),n("840938"),n("118438"),n("325598"),n("92999"),n("611067"),n("273723"),n("724016"),n("803903"),n("214604"),n("901250"),n("755006"),n("437048"),n("488336"),n("825666"),n("177162"),n("286633"),n("943281"),n("810658"),n("82726"),n("224727"),n("663030");var k=n("636692"),C=n("126980"),w=n("30222"),T=n("548872"),x=n("856894"),E=(0,p.tT)().maxDecodeOnceWasm,D=function(e){(0,s.Z)(f,e);var t,n,o=(t=f,n=function(){if("undefined"==typeof Reflect||!Reflect.construct||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(){var e,r=(0,c.Z)(t);return e=n?Reflect.construct(r,arguments,(0,c.Z)(this).constructor):r.apply(this,arguments),(0,u.Z)(this,e)});function f(){var e;(0,r.Z)(this,f);for(var t=arguments.length,n=Array(t),i=0;i ").concat(e.width,", height: ").concat(this._recentMeta.height," -> ").concat(e.height));var t=e.samples[0];t&&(this._recentMeta=t.meta=Object.assign({},e,{samples:null}))}}else{this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.LOADEDMETADATA),this._recentMeta=this._meta=Object.assign({},e,{samples:null}),l.kg.warn(this.TAG,"video set metadata",this._meta,"configuration:",this.configuration);var n,r,i=e.fpsNum/e.fpsDen;i?l.kg.log(this.TAG,"detect fps:",i):l.kg.warn(this.TAG,"no detect fps,start estimate"),this._selectDecoder(),this._initDecoder(),this._initFrameRender()}this._timeRange.append(e.samples,this._isLive&&this.noAudio,!this.videoDecode),e.samples=[],!this.inSeeking&&(!this.isLive&&!this._timeRange.frameLength&&this._switchVideoBuffer(this._parent.currentTime),!this._ready&&null!==(n=this._decodeController)&&void 0!==n&&n.decoderReady&&(this.noAudio||!(null!==(r=this._decodeController)&&void 0!==r&&r.inDecoding))&&this._startDecode(),this.noAudio&&this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.DURATION_CHANGE))}}},{key:"_selectDecoder",value:function(){if(!this.isHevc&&b.Z.isSupported()){this._decodeController=new b.Z(this),this._decodeEstimate.webcodec=!0;return}this._decodeController=new D(this)}},{key:"_initDecoder",value:function(){var e;null===(e=this._decodeController)||void 0===e||e.init(this._decoderMessageCallback,this._decoderErrorCallback)}},{key:"_initFrameRender",value:function(){try{if(this.offscreenUsed){this._renderWorker.initRenderContext({meta:this._meta,type:this._decodeController.webcodec?"2d":""}),this._frameRender=function(){};return}var e=Object.assign(this._config,{meta:this._meta,canvas:this._canvas,type:this._decodeController.webcodec?"2d":""});this._frameRender=new S.S(e,this),l.kg.log(this.TAG,"create frameRender with config",e)}catch(e){this._emitError(e&&e.message,2)}}},{key:"_startDecode",value:function(){var e;null===(e=this._decodeController)||void 0===e||e.doDecode()}},{key:"_switchVideoBuffer",value:function(e,t){var n,r=this._timeRange.switchBuffer(e);if(r){if(this.noAudio&&this._parent.emit(g.ZP.TIMELINE.SYNC_DTS,this.getDtsOfTime(r.start)),t){null===(n=this._decodeController)||void 0===n||n.preciseSeek(e);return}this._startDecode(t)}}},{key:"_checkToDecode",value:function(){var e;!this.inSeeking&&(null===(e=this._decodeController)||void 0===e||e.checkToDecode(this._frameQueue.length))}},{key:"_render",value:function(e){if(!this.noVideo){var t,n,r,i=this._frameQueue&&this._frameQueue.nextFrame();if(!i){if(l.kg.log(this.TAG,"lack frame, ","inDecoding:",null===(n=this._decodeController)||void 0===n?void 0:n.inDecoding),this._checkToDecode(),this.noAudio){if(!this.isLive&&.5>Math.abs(this.currentTime-this.duration)){this===null||void 0===this||this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.TIMEUPDATE),this===null||void 0===this||this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.ENDED),null===(r=this._timeRange)||void 0===r||r.clean();return}!this._timeRange.frameLength&&(this._ready=!1,this.emit(g.ZP.VIDEO.VIDEO_WAITING))}return}var a=i.info;if(!a){this._frameQueue.shift();return}this._renderDts=a.dts;var o=a.dts-this.preciseVideoDts;if(!!e||!(o>0)||!(o<6e4)){this._frameQueue.shift(this.preciseVideoDts),Math.abs(this._lastTimeupdate-a.dts)>250&&(this._emitTimelineEvents(g.ZP.TIMELINE.PLAY_EVENT,g.ZP.VIDEO_EVENTS.TIMEUPDATE,{pts:a.originPts/90}),this._lastTimeupdate=a.dts),l.kg.long&&l.kg.log(this.TAG,"render delay:".concat(o," , timelinePosition:").concat(this.preciseVideoDts," , dts:").concat(a.dts," , cost:").concat(a.cost," , gopID:").concat(a.gopId," , rest:").concat(this._frameQueue.length,", buffer frame:").concat(this._timeRange.frameLength));var s=performance.now();this._hideRenderFlag++,"visible"===document.visibilityState?this.offscreenUsed?this._renderWorker.render(i.buffer,i.width,i.height,i.yLinesize,i.uvLinesize):this._frameRender.render(i.buffer,i.width,i.height,i.yLinesize,i.uvLinesize):this._hideRenderFlag%15&&(this.offscreenUsed?this._renderWorker.render(i.buffer,i.width,i.height,i.yLinesize,i.uvLinesize):this._frameRender.render(i.buffer,i.width,i.height,i.yLinesize,i.uvLinesize)),null!==(t=this._decodeController)&&void 0!==t&&t.webcodec&&i.buffer.close(),this._renderCost=performance.now()-s,this._checkToDecode()}}}},{key:"_updateSegmentEnd",value:function(e){var t;null===(t=this._timeRange)||void 0===t||t.updateSegmentEnd(e)}},{key:"_doChaseFrame",value:function(e){var t=e.frame;this._inChaseFrame=!0,this._timeRange.deletePassed(t.dts),this._frameQueue.empty(),this.noAudio&&this._parent.emit(g.ZP.TIMELINE.SYNC_DTS,t.dts)}},{key:"_destroy",value:function(e){var t;l.kg.log(this.TAG,"destroy video render"),(0,o.Z)((0,c.Z)(h.prototype),"destroy",this).call(this,e),null===(t=this._decodeController)||void 0===t||t.destroy(),this._decodeController=null}}]),h}(y)},656775:function(e,t,n){n.d(t,{i:function(){return d}});var r=n(182432),i=n(210359),a=n(958281),o=n(275764),s=n(479248),u=n(918532),c=["retry","retryDelay","onRetryError","transformError"],d=function(){var e;function t(e,n){(0,r.PA)(this,t),this.promise=(0,s.Q)(),this.alive=!!n.onProgress,n.logger||(n.logger=new u.Y("Loader")),this._loaderType=e,this._loader=e===o.t.FETCH&&"undefined"!=typeof fetch?new i.j:new a.c,this._config=n,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=n.retryCheckFunc,this._logger=n.logger}return(0,r.qH)(t,[{key:"exec",value:function(){var e,t=this,n=this._config,i=n.retry,a=n.retryDelay,o=n.onRetryError,s=n.transformError,u=(0,r.Kd)(n,c);var d=(e=(0,r.x)((0,r.l5)().mark(function e(){var n,c,l;return(0,r.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t._loader.load(u);case 3:n=e.sent,t.promise.resolve(n),e.next=27;break;case 7:if(e.prev=7,e.t0=e.catch(0),t._loader.running=!1,t._logger.debug("[task request catch err]",e.t0),!t._canceled){e.next=13;break}return e.abrupt("return");case 13:if(e.t0.loaderType=t._loaderType,e.t0.retryCount=t._retryCount,c=e.t0,s&&(c=s(c)||c),o&&t._retryCount>0&&o(c,t._retryCount,{index:u.index,vid:u.vid,range:u.range,priOptions:u.priOptions}),t._retryCount++,l=!0,t._retryCheckFunc&&(l=t._retryCheckFunc(e.t0)),!(l&&t._retryCount<=i)){e.next=26;break}return clearTimeout(t._retryTimer),t._logger.debug("[task request setTimeout],retry",t._retryCount,",retry range,",u.range),t._retryTimer=setTimeout(d,a),e.abrupt("return");case 26:t.promise.reject(c);case 27:case"end":return e.stop()}},e,null,[[0,7]])})),function(){return e.apply(this,arguments)});return d(),this.promise}},{key:"cancel",value:(e=(0,r.x)((0,r.l5)().mark(function e(){return(0,r.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),t}()},521488:function(e,t,n){n.d(t,{wN:function(){return o}});var r=n(70427),i=["algorithm","type"];function a(e,t,n){return"number"!=typeof e||Number.isNaN(e)?t:Math.min(n,Math.max(t,e))}function o(e){if(!!e){if(e&&"object"===(0,r.Ac)(e)){e.algorithm;var t=e.type,n=(0,r.Kd)(e,i);return 1===t?new s(n):new u(n)}}}var s=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,r.PA)(this,e);var n=t.alpha,i=t.minTimeout,a=t.maxTimeout,o=t.initialTimeout;this._alpha=void 0===n?.8:n,this._min=void 0===i?0:i,this._max=void 0===a?1/0:a,this._initial=o,this._ewma=void 0}return(0,r.qH)(e,[{key:"getTimeout",value:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return a(Math.round(null!==(e=null!==(t=this._ewma)&&void 0!==t?t:this._initial)&&void 0!==e?e:n),this._min,this._max)}},{key:"update",value:function(e){if("number"!=typeof e||Number.isNaN(e)||e<0)return this.getTimeout();var t=this._ewma||3e3;return this._ewma=this._alpha*e+(1-this._alpha)*t,this.getTimeout()}},{key:"reset",value:function(){this._ewma=void 0}}]),e}(),u=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,r.PA)(this,e);var n=t.alpha,i=t.beta,a=t.k,o=t.minTimeout,s=t.maxTimeout,u=t.initialTimeout;this._alpha=void 0===n?.125:n,this._beta=void 0===i?.25:i,this._k=void 0===a?4:a,this._min=void 0===o?0:o,this._max=void 0===s?1/0:s,this._initial=u||1e3,this._srtt=void 0,this._rttvar=void 0}return(0,r.qH)(e,[{key:"getTimeout",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return a(Math.round(void 0!==this._srtt&&void 0!==this._rttvar?this._srtt+this._k*this._rttvar:null!=e?e:this._initial),this._min,this._max)}},{key:"update",value:function(e){if("number"!=typeof e||Number.isNaN(e)||e<0)return this.getTimeout();if(void 0===this._srtt||void 0===this._rttvar)return this._srtt=e,this._rttvar=e/2,this.getTimeout();var t=this._srtt;return this._srtt=t+this._alpha*(e-t),this._rttvar=this._rttvar+this._beta*(Math.abs(e-t)-this._rttvar),this.getTimeout()}},{key:"reset",value:function(){this._srtt=void 0,this._rttvar=void 0}}]),e}()},261237:function(e,t,n){n.d(t,{j:function(){return d}});var r=n(70427),i=n(430517),a=n(408746),o=n(265614),s=n(982143),u=n(942155),c=n.n(u),d=function(e){(0,r.XW)(u,e);var t,n=(0,r.WY)(u);function u(){var e;return(0,r.PA)(this,u),e=n.call(this),(0,r._x)((0,r.Lc)(e),"_abortController",null),(0,r._x)((0,r.Lc)(e),"_timeoutTimer",null),(0,r._x)((0,r.Lc)(e),"_reader",null),(0,r._x)((0,r.Lc)(e),"_response",null),(0,r._x)((0,r.Lc)(e),"_aborted",!1),(0,r._x)((0,r.Lc)(e),"_index",-1),(0,r._x)((0,r.Lc)(e),"_range",null),(0,r._x)((0,r.Lc)(e),"_receivedLength",0),(0,r._x)((0,r.Lc)(e),"_running",!1),(0,r._x)((0,r.Lc)(e),"_logger",null),(0,r._x)((0,r.Lc)(e),"_vid",""),(0,r._x)((0,r.Lc)(e),"_firtstByte",0),(0,r._x)((0,r.Lc)(e),"_onProcessMinLen",0),(0,r._x)((0,r.Lc)(e),"_onCancel",null),(0,r._x)((0,r.Lc)(e),"_priOptions",null),e}return(0,r.qH)(u,[{key:"load",value:function(e){var t,n=this,u=e.url,c=e.vid,d=e.timeout,l=e.dynamicTimeoutIns,f=e.responseType,h=e.onProgress,v=e.index,g=e.onTimeout,p=e.onCancel,m=e.range,_=e.transformResponse,y=e.request,b=e.params,k=e.logger,C=e.method,w=e.headers,T=e.body,x=e.mode,E=e.credentials,D=e.cache,S=e.redirect,R=e.referrer,A=e.referrerPolicy,I=e.onProcessMinLen,L=e.priOptions,B=e.streamRes,P=e.firstMaxChunkSize;this._logger=k,this._aborted=!1,this._onProcessMinLen=I,this._onCancel=p,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=v,this._range=m||[0,0],this._vid=c||u,this._priOptions=L||{},this._firstMaxChunkSize=P;var N={method:C,headers:w,body:T,mode:x,credentials:E,cache:D,redirect:S,referrer:R,referrerPolicy:A,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},O=!1;clearTimeout(this._timeoutTimer),u=(0,a.G7)(u,b);var M=(0,a.Gu)(m);M&&(w=y?y.headers:N.headers=N.headers||(Headers?new Headers:{}),Headers&&w instanceof Headers?w.append("Range",M):w.Range=M);var Z=l&&"function"==typeof l.getTimeout?l.getTimeout(d):d;Z&&(this._timeoutTimer=setTimeout(function(){if(O=!0,l&&"function"==typeof l.update&&(n._logger.debug("[dytimeout], fetch timeout update rtt,",5*Z),l.update(5*Z)),n.cancel(),g){var e=new i.C(u,N,null,"timeout");e.isTimeout=!0,g(e,{index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions})}},Z));var W=Date.now();return this._logger.debug("[fetch load start], index,",v,",range,",m,",[dytimeout]",Z),new Promise(function(e,t){var c;(B?new Promise(function(e){e(B)}):fetch(y||u,y?void 0:N)).then((c=(0,r.x)((0,r.l5)().mark(function c(d){var g,p,y,b;return(0,r.l5)().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(clearTimeout(n._timeoutTimer),n._response=d,!(n._aborted||!n._running)){r.next=4;break}return r.abrupt("return");case 4:if(_&&(d=_(d,u)||d),d.ok){r.next=7;break}throw new i.C(u,N,d,"bad network response");case 7:if(g=Date.now(),n._priOptions.rtt=g-W,l&&"function"==typeof l.update&&(n._logger.debug("[dytimeout] fetch update rtt,",n._priOptions.rtt),l.update(n._priOptions.rtt)),f!==o.U.TEXT){r.next=17;break}return r.next=13,d.text();case 13:case 20:p=r.sent,n._running=!1,r.next=39;break;case 17:if(f!==o.U.JSON){r.next=24;break}return r.next=20,d.json();case 24:if(!h){r.next=31;break}return n.resolve=e,n.reject=t,n._loadChunk(d,h,W,g),r.abrupt("return");case 31:return r.next=33,d.arrayBuffer();case 33:p=new Uint8Array(p=r.sent),n._running=!1,y=Date.now()-W,b=(0,a.pl)(p.byteLength,y),n.emit(s.K.REAL_TIME_SPEED,{speed:b,len:p.byteLength,time:y,vid:n._vid,index:n._index,range:n._range,priOptions:n._priOptions});case 39:n._logger.debug("[fetch load end], index,",v,",range,",m),e((0,a.rO)(p,!0,d,d.headers.get("Content-Length"),d.headers.get("age"),W,g,v,m,n._vid,n._priOptions));case 41:case"end":return r.stop()}},c)})),function(e){return c.apply(this,arguments)})).catch(function(e){var r;clearTimeout(n._timeoutTimer),n._running=!1,(!n._aborted||O)&&((e=e instanceof i.C?e:new i.C(u,N,null,null===(r=e)||void 0===r?void 0:r.message)).startTime=W,e.endTime=Date.now(),e.isTimeout=O,e.options={index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions},t(e))})})}},{key:"cancel",value:(t=(0,r.x)((0,r.l5)().mark(function e(){return(0,r.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch(e){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return e.stop()}},e,this,[[5,11]])})),function(){return t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,n,o){var u,c,d,l,f=this;if(!e.body||!e.body.getReader){this._running=!1;var h=new i.C(e.url,"",e,"onProgress of bad response.body.getReader");h.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this.reject(h);return}this._onProcessMinLen>0&&(this._cache=new Uint8Array(2097152),this._writeIdx=0);var v=this._reader=e.body.getReader();var g=(u=(0,r.x)((0,r.l5)().mark(function i(){var u,h,p,m,_,y,b,k,C,w;return(0,r.l5)().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return d=Date.now(),r.prev=1,r.next=4,v.read();case 4:c=r.sent,l=Date.now(),r.next=13;break;case 8:return r.prev=8,r.t0=r.catch(1),l=Date.now(),!f._aborted&&(f._running=!1,r.t0.options={index:f._index,range:f._range,vid:f._vid,priOptions:f._priOptions},f.reject(r.t0)),r.abrupt("return");case 13:if(p=(h=(null===(u=f._range)||void 0===u?void 0:u.length)>0?f._range[0]:0)+f._receivedLength,!f._aborted){r.next=19;break}return f._running=!1,t(void 0,!1,{range:[p,p],vid:f._vid,index:f._index,startTime:d,endTime:l,st:n,firstByteTime:o,priOptions:f._priOptions},e),r.abrupt("return");case 19:m=c.value?c.value.byteLength:0,f._receivedLength+=m,f._logger.debug("【fetchLoader,onProgress call】,task,",f._range,", start,",p,", end,",h+f._receivedLength,", done,",c.done),f._onProcessMinLen>0?f._writeIdx+m>=f._onProcessMinLen||c.done?((_=new Uint8Array(f._writeIdx+m)).set(f._cache.slice(0,f._writeIdx),0),m>0&&_.set(c.value,f._writeIdx),f._writeIdx=0,f._logger.debug("【fetchLoader,onProgress enough】,done,",c.done,",len,",_.byteLength,", writeIdx,",f._writeIdx)):m>0&&f._writeIdx+m<2097152?(f._cache.set(c.value,f._writeIdx),f._writeIdx+=m,f._logger.debug("【fetchLoader,onProgress cache】,len,",m,", writeIdx,",f._writeIdx)):m>0&&(y=new Uint8Array(f._writeIdx+m+2048),f._logger.debug("【fetchLoader,onProgress extra start】,size,",f._writeIdx+m+2048,", datalen,",m,", writeIdx,",f._writeIdx),y.set(f._cache.slice(0,f._writeIdx),0),m>0&&y.set(c.value,f._writeIdx),f._writeIdx+=m,delete f._cache,f._cache=y,f._logger.debug("【fetchLoader,onProgress extra end】,len,",m,", writeIdx,",f._writeIdx)):_=c.value,(_&&_.byteLength>0||c.done)&&(f._firstMaxChunkSize&&(f._firtstByte?f._cacheData&&((k=new Uint8Array(f._cacheData.byteLength+_.byteLength)).set(f._cacheData,0),k.set(_,f._cacheData.byteLength),_=k,f._cacheData=null):(f._firtstByte++,b=_.slice(0,f._firstMaxChunkSize),f._cacheData=_.slice(f._firstMaxChunkSize),_=b)),t(_,c.done,{range:[f._range[0]+f._receivedLength-(_?_.byteLength:0),f._range[0]+f._receivedLength],vid:f._vid,index:f._index,startTime:d,endTime:l,st:n,firstByteTime:o,priOptions:f._priOptions},e)),c.done?(C=Date.now()-n,w=(0,a.pl)(f._receivedLength,C),f.emit(s.K.REAL_TIME_SPEED,{speed:w,len:f._receivedLength,time:C,vid:f._vid,index:f._index,range:f._range,priOptions:f._priOptions}),f._running=!1,f._logger.debug("[fetchLoader onProgress end],task,",f._range,",done,",c.done),f.resolve((0,a.rO)(c,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),n,o,f._index,f._range,f._vid,f._priOptions))):f._firstMaxChunkSize?setTimeout(function(){g()},0):g();case 25:case"end":return r.stop()}},i,null,[[1,8]])})),function(){return u.apply(this,arguments)});g()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return"undefined"!=typeof fetch}}]),u}(c())},924515:function(e,t,n){function r(){for(var e=arguments.length,t=Array(e),n=0;n>>24,i===t)break;if(r[i++]=(16711680&o)>>>16,i===t)break;if(r[i++]=(65280&o)>>>8,i===t)break;r[i++]=255&o}return r},decoderAESCTRData:function(e,t,n){if(e.videoSenc){var r=e.kidValue,i=e.videoSenc;e.samples.forEach(function(t,a){var o=i[a],s=t.data,u=[],l=[],f=o.InitializationVector;if(o.subsamples&&o.subsamples.length)o.subsamples.forEach(function(e){var t=e.BytesOfClearData+e.BytesOfProtectedData,n=s.slice(0,t);u.push(n.slice(0,e.BytesOfClearData)),l.push(n.slice(e.BytesOfClearData)),s=s.slice(t)});else{var h=t.size;u.push(s.slice(0,0)),l.push(s.slice(0,h)),s=s.slice(h)}var v=new c.Z;v.write.apply(v,l);var g=n?n(v.buffer,r,f):d.decryptWordArray(v.buffer,r,f),p=new c.Z;u.forEach(function(e,t){var n=l[t].length,r=g.slice(0,n);p.write(e),p.write(r),g=g.slice(n)}),e.samples[a].data=p.buffer})}if(t.audioSenc){var a=t.kidValue,o=t.audioSenc;t.samples.forEach(function(e,r){var i=o[r],s=n?n(e.data,a,i.InitializationVector):d.decryptWordArray(e.data,a,i.InitializationVector);t.samples[r].data=s})}}}},500395:function(e,t,n){n.d(t,{I:function(){return l}});var r=n(697946),i=n(269497),a=n(578548),o=n(662439),s=n(585104),u=n(461449),c=n(745740);function d(e){return(e||[]).filter(Boolean)}var l=function(){function e(){(0,r.PA)(this,e)}return(0,r.qH)(e,null,[{key:"findBox",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[];if(!t)return i;for(var o=0,s="",u=0;t.length>7;){if(o=(0,a.Bh)(t),s=String.fromCharCode.apply(null,t.subarray(4,8)),u=8,1===o?(o=(0,a.h9)(t,8),u+=8):!o&&(o=t.length),!n[0]||s===n[0]){var c=t.subarray(0,o);if(!(n.length<2))return e.findBox(c.subarray(u),n.slice(1),r+u);i.push({start:r,size:o,headerSize:u,type:s,data:c})}r+=o,t=t.subarray(o)}return i}},{key:"tfhd",value:function(e){return g(e,!0,function(e,t){e.trackId=(0,a.Bh)(t);var n=4,r=1&e.flags,i=2&e.flags,o=8&e.flags,s=16&e.flags,u=32&e.flags;r&&(n+=4,e.baseDataOffset=(0,a.Bh)(t,n),n+=4),i&&(e.sampleDescriptionIndex=(0,a.Bh)(t,n),n+=4),o&&(e.defaultSampleDuration=(0,a.Bh)(t,n),n+=4),s&&(e.defaultSampleSize=(0,a.Bh)(t,n),n+=4),u&&(e.defaultSampleFlags=(0,a.Bh)(t,n))})}},{key:"sidx",value:function(e){return g(e,!0,function(e,t){var n=0;e.reference_ID=(0,a.Bh)(t,n),n+=4,e.timescale=(0,a.Bh)(t,n),n+=4,0===e.version?(e.earliest_presentation_time=(0,a.Bh)(t,n),n+=4,e.first_offset=(0,a.Bh)(t,n),n+=4):(e.earliest_presentation_time=(0,a.h9)(t,n),n+=8,e.first_offset=(0,a.h9)(t,n),n+=8),n+=2,e.references=[];var r=(0,a.i4)(t,n);n+=2;for(var i=0;i>31&1,o.referenced_size=2147483647&s,o.subsegment_duration=(0,a.Bh)(t,n),n+=4,s=(0,a.Bh)(t,n),n+=4,o.starts_with_SAP=s>>31&1,o.SAP_type=s>>28&7,o.SAP_delta_time=268435455&s}})}},{key:"moov",value:function(t){return g(t,!1,function(t,n,r){t.mvhd=e.mvhd(e.findBox(n,["mvhd"],r)[0]),t.trak=e.findBox(n,["trak"],r).map(function(t){return e.trak(t)}),t.pssh=e.pssh(e.findBox(n,["pssh"],r)[0])})}},{key:"mvhd",value:function(e){return g(e,!0,function(e,t){var n=0;1===e.version?(e.timescale=(0,a.Bh)(t,16),e.duration=(0,a.h9)(t,20),n+=28):(e.timescale=(0,a.Bh)(t,8),e.duration=(0,a.Bh)(t,12),n+=16),e.nextTrackId=(0,a.Bh)(t,n+76)})}},{key:"trak",value:function(t){return g(t,!1,function(t,n,r){t.tkhd=e.tkhd(e.findBox(n,["tkhd"],r)[0]),t.mdia=e.mdia(e.findBox(n,["mdia"],r)[0]),t.edts=e.edts(e.findBox(n,["edts"],r)[0])})}},{key:"tkhd",value:function(e){return g(e,!0,function(e,t){var n=s.J.fromUint8(t);1===e.version?(n.read(8),n.read(8),e.trackId=n.read(4),n.read(4),e.duration=n.read(8)):(n.read(4),n.read(4),e.trackId=n.read(4),n.read(4),e.duration=n.read(4)),n.skip(16),e.matrix=[];for(var r=0;r<36;r++)e.matrix.push(n.read(1));n.back(36);for(var i=[],o,u=0;u<3;u++)i.push((0,a.Wp)(n.readInt(2),n.readInt(2))),i.push((0,a.Wp)(n.readInt(2),n.readInt(2))),o=n.readInt(4),i.push((0,a.Wp)(o>>30,1073741823&o));e.rotation=(0,a.Dc)(i),e.width=n.read(4),e.height=n.read(4)})}},{key:"mdia",value:function(t){return g(t,!1,function(t,n,r){t.mdhd=e.mdhd(e.findBox(n,["mdhd"],r)[0]),t.hdlr=e.hdlr(e.findBox(n,["hdlr"],r)[0]),t.minf=e.minf(e.findBox(n,["minf"],r)[0])})}},{key:"edts",value:function(t){return g(t,!1,function(t,n,r){t.elst=e.elst(e.findBox(n,["elst"],r)[0])})}},{key:"elst",value:function(e){return g(e,!0,function(e,t,n){e.entries=[],e.entriesData=t;var r=0,i=(0,a.Bh)(t,r);r+=4;for(var o=0;o>10&31)+96,(r>>5&31)+96,(31&r)+96)})}},{key:"hdlr",value:function(e){return g(e,!0,function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))})}},{key:"minf",value:function(t){return g(t,!1,function(t,n,r){t.vmhd=e.vmhd(e.findBox(n,["vmhd"],r)[0]),t.smhd=e.smhd(e.findBox(n,["smhd"],r)[0]),t.stbl=e.stbl(e.findBox(n,["stbl"],r)[0])})}},{key:"vmhd",value:function(e){return g(e,!0,function(e,t){e.graphicsmode=(0,a.i4)(t),e.opcolor=[(0,a.i4)(t,2),(0,a.i4)(t,4),(0,a.i4)(t,6)]})}},{key:"smhd",value:function(e){return g(e,!0,function(e,t){e.balance=(0,a.i4)(t)})}},{key:"stbl",value:function(t){return g(t,!1,function(t,n,r){t.stsd=e.stsd(e.findBox(n,["stsd"],r)[0]),t.stts=e.stts(e.findBox(n,["stts"],r)[0]),t.ctts=e.ctts(e.findBox(n,["ctts"],r)[0]),t.stsc=e.stsc(e.findBox(n,["stsc"],r)[0]),t.stsz=e.stsz(e.findBox(n,["stsz"],r)[0]),t.stco=e.stco(e.findBox(n,["stco"],r)[0]),!t.stco&&(t.co64=e.co64(e.findBox(n,["co64"],r)[0]),t.stco=t.co64);var i,a,o,s=null===(i=t.stsd.entries[0])||void 0===i?void 0:null===(a=i.sinf)||void 0===a?void 0:null===(o=a.schi)||void 0===o?void 0:o.tenc.default_IV_size;t.stss=e.stss(e.findBox(n,["stss"],r)[0]),t.senc=e.senc(e.findBox(n,["senc"],r)[0],s)})}},{key:"senc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return g(e,!0,function(e,n){var r=0,i=(0,a.Bh)(n,r);r+=4,e.samples=[];for(var o=0;o0){var s=(0,a.Bh)(t,i);i+=4;for(var u=0;u<(""+s).length;u++)for(var c=0;c<16;c++){var d=t[i];i+=1,n.push(m(d))}}var l=(0,a.Bh)(t,i);e.data_size=l,i+=4,e.kid=n,e.system_id=r,e.buffer=t})}},{key:"vvc1",value:function(t){return e.videoSampleEntry(t)}},{key:"vvcC",value:function(t,n){return e.videoConfigBox(t,n||"vvc1")}},{key:"videoConfigBox",value:function(t,n){if(!!t){var r=(0,u.YW)({configBox:t.type});if(null!=r&&r.parseConfigBox)return g(t,!1,function(i,a){var o=r.parseConfigBox({data:a,box:t,sampleEntryType:n,parser:e});for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(i[s]=o[s])})}}},{key:"videoSampleEntry",value:function(t){var n=(0,u.YW)({sampleEntry:null==t?void 0:t.type});if(n)return g(t,!1,function(t,r,i){var a=h(t,r),o=r.subarray(a);i+=a,d(n.configBoxes).some(function(r){var a=e.findBox(o,[r],i)[0],s=e.videoConfigBox(a,t.type);return!!s&&(t[n.trackConfigKey||r]=s,!0)}),t.pasp=e.pasp(e.findBox(o,["pasp"],i)[0])})}},{key:"stsd",value:function(t){return g(t,!0,function(t,n,r){t.entryCount=(0,a.Bh)(n),t.entries=e.findBox(n.subarray(4),[],r+4).map(function(t){switch(t.type){case"av01":return e.av01(t);case"avc1":case"avc2":case"avc3":case"avc4":return e.avc1(t);case"hvc1":case"hev1":return e.hvc1(t);case"vvc1":case"vvi1":return e.vvc1(t);case"mp4a":return e.mp4a(t);case"alaw":case"ulaw":return e.alaw(t);case"enca":return g(t,!1,function(t,n,r){t.channelCount=(0,a.i4)(n,16),t.samplesize=(0,a.i4)(n,18),t.sampleRate=(0,a.Bh)(n,24)/65536,n=n.subarray(28),t.sinf=e.sinf(e.findBox(n,["sinf"],r)[0]),t.esds=e.esds(e.findBox(n,["esds"],r)[0])});case"encv":return g(t,!1,function(t,n,r){t.width=(0,a.i4)(n,24),t.height=(0,a.i4)(n,26),t.horizresolution=(0,a.Bh)(n,28),t.vertresolution=(0,a.Bh)(n,32),n=n.subarray(78),t.sinf=e.sinf(e.findBox(n,["sinf"],r)[0]),t.avcC=e.avcC(e.findBox(n,["avcC"],r)[0]),t.hvcC=e.hvcC(e.findBox(n,["hvcC"],r)[0]);var i,o,s=null===(i=t.sinf)||void 0===i?void 0:null===(o=i.frma)||void 0===o?void 0:o.data_format,c=(0,u.YW)({sampleEntry:s});(c?[c]:u.mA.list()).some(function(i){return d(i.configBoxes).some(function(a){var o=e.videoConfigBox(e.findBox(n,[a],r)[0],s);return!!o&&(t[i.trackConfigKey||a]=o,!0)})}),t.pasp=e.pasp(e.findBox(n,["pasp"],r)[0])});default:if((0,u.YW)({sampleEntry:t.type}))return e.videoSampleEntry(t)}}).filter(Boolean)})}},{key:"tenc",value:function(e){return g(e,!1,function(e,t){var n=6;e.default_IsEncrypted=t[n],n+=1,e.default_IV_size=t[n],n+=1,e.default_KID=[];for(var r=0;r<16;r++)e.default_KID.push(m(t[n])),n+=1})}},{key:"schi",value:function(t){return g(t,!1,function(t,n,r){t.tenc=e.tenc(e.findBox(n,["tenc"],r)[0])})}},{key:"sinf",value:function(t){return g(t,!1,function(t,n,r){t.schi=e.schi(e.findBox(n,["schi"],r)[0]),t.frma=e.frma(e.findBox(n,["frma"],r)[0])})}},{key:"frma",value:function(e){return g(e,!1,function(e,t){e.data_format="";for(var n=0;n<4;n++)e.data_format+=String.fromCharCode(t[n])})}},{key:"colr",value:function(e){return g(e,!1,function(t,n){var r=s.J.fromUint8(n);t.data=e.data,t.colorType=r.readString(4),"nclx"===t.colorType||"nclc"===t.colorType?(t.colorPrimaries=r.read(2),t.transferCharacteristics=r.read(2),t.matrixCoefficients=r.read(2),"nclx"===t.colorType&&(t.fullRangeFlag=r.read(1)>>7)):("rICC"===t.colorType||"prof"===t.colorType)&&(t.iccProfile=r.readToUint8())})}},{key:"av01",value:function(t){return g(t,!1,function(t,n,r){var i=h(t,n),a=n.subarray(i);r+=i,t.av1C=e.av1C(e.findBox(a,["av1C"],r)[0]),t.colr=e.colr(e.findBox(a,["colr"],r)[0])})}},{key:"av1C",value:function(e){return g(e,!1,function(t,n){t.data=e.data;var r,i=s.J.fromUint8(n),a=o.A.fromByte(i,4);t.marker=a.read(1),t.version=a.read(7),t.seqProfile=a.read(3),t.seqLevelIdx0=a.read(5),t.seqTier0=a.read(1),t.highBitdepth=a.read(1),t.twelveBit=a.read(1),t.monochrome=a.read(1),t.chromaSubsamplingX=a.read(1),t.chromaSubsamplingY=a.read(1),t.chromaSamplePosition=a.read(2),t.reserved=a.read(3),t.initialPresentationDelayPresent=a.read(1),t.initialPresentationDelayPresent?t.initialPresentationDelayMinusOne=a.read(4):t.initialPresentationDelayMinusOne=0,t.configOBUs=i.readToUint8(),2===t.seqProfile&&1===t.highBitdepth?r=1===t.twelveBit?"12":"10":t.seqProfile<=2&&(r=1===t.highBitdepth?"10":"08"),t.codec=["av01",t.seqProfile,(t.seqLevelIdx0<10?"0"+t.seqLevelIdx0:t.seqLevelIdx0)+(t.seqTier0?"H":"M"),r].join(".")})}},{key:"avc1",value:function(t){return g(t,!1,function(t,n,r){var i=h(t,n),a=n.subarray(i);r+=i,t.avcC=e.avcC(e.findBox(a,["avcC"],r)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],r)[0])})}},{key:"avcC",value:function(e){return g(e,!1,function(t,n){t.data=e.data,t.configurationVersion=n[0],t.AVCProfileIndication=n[1],t.profileCompatibility=n[2],t.AVCLevelIndication=n[3],t.codec=(0,a.dB)([n[1],n[2],n[3]]),t.lengthSizeMinusOne=3&n[4],t.spsLength=31&n[5],t.sps=[];for(var r=6,i=0;i>6,t.generalTierFlag=(32&r)>>5,t.generalProfileIdc=31&r,t.generalProfileCompatibility=(0,a.Bh)(n,2),t.generalConstraintIndicatorFlags=n.subarray(6,12),t.generalLevelIdc=n[12],t.avgFrameRate=(0,a.i4)(n,19),t.numOfArrays=n[22],t.vps=[],t.sps=[],t.pps=[];for(var i=23,o=0,s=0,u=0,c=0;c>3;if(31===u&&s.length>=2&&(u=32+((7&s[0])<<3)+((224&s[1])>>5)),e.objectType=u,e.codec+=u.toString(16),/^mp4a/ig.test(e.codec)&&s.length>=2){var c=(7&s[0])<<1|(128&s[1])>>7;e.samplingFrequencyIndex=c,c4&&1&r&&(e.dataOffset=-(~(0,a.Bh)(t,s)+1),s+=4),i>s&&4&r&&(e.firstSampleFlags=(0,a.Bh)(t,s),s+=4),i>s){e.samples=Array(o);for(var u,c=0;c>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}},{key:"moovToTrack",value:function(t,n,r){var a=t.trak;if(a&&a.length){var o=a.find(function(e){var t,n;return(null===(t=e.mdia)||void 0===t?void 0:null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)==="vide"}),s=a.find(function(e){var t,n;return(null===(t=e.mdia)||void 0===t?void 0:null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)==="soun"});if(o&&n){var d=null===(E=o.tkhd)||void 0===E?void 0:E.trackId;null!=d&&(n.id=o.tkhd.trackId),n.tkhdDuration=o.tkhd.duration,n.mvhdDurtion=t.mvhd.duration,n.mvhdTimecale=t.mvhd.timescale,n.timescale=n.formatTimescale=o.mdia.mdhd.timescale,n.duration=o.mdia.mdhd.duration||n.mvhdDurtion/n.mvhdTimecale*n.timescale,n.rotation=o.tkhd.rotation,n.matrix=o.tkhd.matrix,null!==(D=o.edts)&&void 0!==D&&D.elst&&(n.editList=o.edts.elst,n.editListApplied=o.editListApplied);var l=o.mdia.minf.stbl.stsd.entries[0];if(!l)throw Error("unknown video stsd entry");if(n.width=l.width,n.height=l.height,l.pasp&&(n.sarRatio=[l.pasp.hSpacing,l.pasp.vSpacing]),l.av1C)n.codecType=c._e.AV1,n.codec=l.av1C.codec,n.av1C=l.av1C.data,l.colr&&(n.colr=l.colr.data);else if(l.hvcC)n.codecType=c._e.HEVC,n.codec=l.hvcC.codec,n.vps=l.hvcC.vps,n.sps=l.hvcC.sps,n.pps=l.hvcC.pps,n.hvcC=l.hvcC.data;else if(l.avcC)n.codec=l.avcC.codec,n.sps=l.avcC.sps,n.pps=l.avcC.pps;else if(l.vvcC){var f,h,v,g,p,m,_,y,b,k,C,w,T,x,E,D,S,R,A,I,L,B,P,N,O="encv"===l.type?null===(P=l.sinf)||void 0===P?void 0:null===(N=P.frma)||void 0===N?void 0:N.data_format:l.type,M=(0,u.YW)({sampleEntry:O})||(0,u.YW)({configBox:"vvcC"});if(!(null!=M&&M.applyTrackConfig))throw Error("video codec parser is not registered: ".concat(O||"vvcC"));M.applyTrackConfig({track:n,entry:l,config:l.vvcC,parser:e})}else throw Error("unknown video stsd entry");n.present=!0,n.ext={},n.ext.stss=null===(S=o.mdia)||void 0===S?void 0:null===(R=S.minf)||void 0===R?void 0:null===(A=R.stbl)||void 0===A?void 0:A.stss,n.ext.ctts=null===(I=o.mdia)||void 0===I?void 0:null===(L=I.minf)||void 0===L?void 0:null===(B=L.stbl)||void 0===B?void 0:B.ctts,l&&"encv"===l.type&&(n.isVideoEncryption=!0,l.default_KID=null===(v=l.sinf)||void 0===v?void 0:null===(g=v.schi)||void 0===g?void 0:g.tenc.default_KID,l.default_IsEncrypted=null===(p=l.sinf)||void 0===p?void 0:null===(m=p.schi)||void 0===m?void 0:m.tenc.default_IsEncrypted,l.default_IV_size=null===(_=l.sinf)||void 0===_?void 0:null===(y=_.schi)||void 0===y?void 0:y.tenc.default_IV_size,n.videoSenc=null===(b=o.mdia)||void 0===b?void 0:null===(k=b.minf)||void 0===k?void 0:null===(C=k.stbl)||void 0===C?void 0:null===(w=C.senc)||void 0===w?void 0:w.samples,l.data_format=null===(T=l.sinf)||void 0===T?void 0:null===(x=T.frma)||void 0===x?void 0:x.data_format,n.useEME=t.useEME,n.kidValue=t.kidValue,n.pssh=t.pssh,n.encv=l)}if(s&&r){var Z,W,F,V,z,U,j,G,H,Y,J,q,X,Q,K,$,ee,et,en=null===(Z=s.tkhd)||void 0===Z?void 0:Z.trackId;null!=en&&(r.id=s.tkhd.trackId),r.tkhdDuration=s.tkhd.duration,r.mvhdDurtion=t.mvhd.duration,r.mvhdTimecale=t.mvhd.timescale,r.timescale=r.formatTimescale=s.mdia.mdhd.timescale,r.duration=s.mdia.mdhd.duration||r.mvhdDurtion/r.mvhdTimecale*r.timescale,null!==(W=s.edts)&&void 0!==W&&W.elst&&(r.editList=s.edts.elst,r.editListApplied=s.editListApplied);var er=s.mdia.minf.stbl.stsd.entries[0];switch(r.sampleSize=er.sampleSize,r.sampleRate=function(e){var t,n=0;return(n="mp4a"===e.type?e.sampleRate>0?e.sampleRate:null===(t=e.esds)||void 0===t?void 0:t.sampleRate:e.sampleRate)||0}(er),r.channelCount=er.channelCount,r.present=!0,er.type){case"alaw":r.codecType=r.codec=c.yQ.G711PCMA,r.sampleRate=8e3;break;case"ulaw":r.codecType=r.codec=c.yQ.G711PCMU,r.sampleRate=8e3;break;default:r.sampleDuration=i.W.getFrameDuration(r.sampleRate,r.timescale),r.sampleRateIndex=i.W.getRateIndexByRate(r.sampleRate),r.objectType=(null===(f=er.esds)||void 0===f?void 0:f.objectType)||2,er.esds&&(r.config=Array.from(er.esds.config)),r.codec=(null===(h=er.esds)||void 0===h?void 0:h.codec)||"mp4a.40.2"}r.sampleDuration=i.W.getFrameDuration(r.sampleRate,r.timescale),r.objectType=(null===(F=er.esds)||void 0===F?void 0:F.objectType)||2,er.esds&&er.esds.config&&(r.config=Array.from(er.esds.config)),r.codec=(null===(V=er.esds)||void 0===V?void 0:V.codec)||"mp4a.40.2",r.sampleRateIndex=i.W.getRateIndexByRate(r.sampleRate),r.ext={},r.ext.stss=null===(z=s.mdia)||void 0===z?void 0:null===(U=z.minf)||void 0===U?void 0:null===(j=U.stbl)||void 0===j?void 0:j.stss,r.ext.ctts=null===(G=s.mdia)||void 0===G?void 0:null===(H=G.minf)||void 0===H?void 0:null===(Y=H.stbl)||void 0===Y?void 0:Y.ctts,r.present=!0,er&&"enca"===er.type&&(r.isAudioEncryption=!0,er.data_format=null===(J=er.sinf)||void 0===J?void 0:null===(q=J.frma)||void 0===q?void 0:q.data_format,er.default_KID=null===(X=er.sinf)||void 0===X?void 0:null===(Q=X.schi)||void 0===Q?void 0:Q.tenc.default_KID,er.default_IsEncrypted=null===(K=er.sinf)||void 0===K?void 0:null===($=K.schi)||void 0===$?void 0:$.tenc.default_IsEncrypted,er.default_IV_size=null===(ee=er.sinf)||void 0===ee?void 0:null===(et=ee.schi)||void 0===et?void 0:et.tenc.default_IV_size,r.audioSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,r.useEME=t.useEME,r.kidValue=t.kidValue,r.enca=er)}if(r&&(r.isVideoEncryption=!!n&&n.isVideoEncryption),n&&(n.isAudioEncryption=!!r&&r.isAudioEncryption),null!=n&&n.encv||null!=r&&r.enca){var ei,ea,eo=null==n?void 0:null===(ei=n.encv)||void 0===ei?void 0:ei.default_KID,es=null==r?void 0:null===(ea=r.enca)||void 0===ea?void 0:ea.default_KID,eu=eo||es?(eo||es).join(""):null;n&&(n.kid=eu),r&&(r.kid=eu)}return n&&(n.flags=3841),r&&(r.flags=1793),{videoTrack:n,audioTrack:r}}}},{key:"evaluateDefaultDuration",value:function(e,t,n){var r,i=null==t?void 0:null===(r=t.samples)||void 0===r?void 0:r.length;return i?1024*i/t.timescale*e.timescale/n:1024}},{key:"moofToSamples",value:function(t,n,r){var i={};return t.mfhd&&(n&&(n.sequenceNumber=t.mfhd.sequenceNumber),r&&(r.sequenceNumber=t.mfhd.sequenceNumber)),t.traf.forEach(function(t){var a=t.tfhd,o=t.tfdt,s=t.trun;if(a&&s){o&&(n&&n.id===a.trackId&&(n.baseMediaDecodeTime=o.baseMediaDecodeTime),r&&r.id===a.trackId&&(r.baseMediaDecodeTime=o.baseMediaDecodeTime));var u=a.defaultSampleSize||0,c=a.defaultSampleDuration||e.evaluateDefaultDuration(n,r,s.samples.length||s.sampleCount),d=s.dataOffset||0,l=0,f=-1;if(!s.samples.length&&s.sampleCount){i[a.trackId]=Array(s.sampleCount);for(var h=0;h>>0!=65536}).keyframe&&(f++,e.gopId=f),l+=e.duration,d+=e.size,e})}}),i}},{key:"moovToSamples",value:function(e){var t=e.trak;if(!!t&&!!t.length){var n=t.find(function(e){var t,n;return(null===(t=e.mdia)||void 0===t?void 0:null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)==="vide"}),r=t.find(function(e){var t,n;return(null===(t=e.mdia)||void 0===t?void 0:null===(n=t.hdlr)||void 0===n?void 0:n.handlerType)==="soun"});if(n||r){if(n){var i,a,o,s,u=null===(o=n.mdia)||void 0===o?void 0:null===(s=o.minf)||void 0===s?void 0:s.stbl;if(!u)return;var c=u.stts,d=u.stsc,l=u.stsz,h=u.stco,v=u.stss,g=u.ctts;if(!c||!d||!l||!h||!v)return;i=f(c,d,l,h,g,v)}if(r){var p,m,_,y=null===(p=r.mdia)||void 0===p?void 0:null===(m=p.minf)||void 0===m?void 0:m.stbl;if(!y)return;var b=null===(_=r.mdia.mdhd)||void 0===_?void 0:_.timescale,k=y.stts,C=y.stsc,w=y.stsz,T=y.stco;if(!b||!k||!C||!w||!T)return;a=f(k,C,w,T)}return{videoSamples:i,audioSamples:a}}}}}]),e}();function f(e,t,n,r,i,a){var o,s,u,c=[],d=null==i?void 0:i.entries,l=t.entries,f=r.entries,h=n.entrySizes,v=null==a?void 0:a.entries;v&&(o={},v.forEach(function(e){o[e-1]=!0})),d&&(s=[],d.forEach(function(e){for(var t=e.count,n=e.offset,r=0;r=C&&(C=l[++y+1]?l[y+1].firstChunk-1:1/0),k+=l[y].samplesPerChunk)}),c}function h(e,t){return e.dataReferenceIndex=(0,a.i4)(t,6),e.width=(0,a.i4)(t,24),e.height=(0,a.i4)(t,26),e.horizresolution=(0,a.Bh)(t,28),e.vertresolution=(0,a.Bh)(t,32),e.frameCount=(0,a.i4)(t,40),e.depth=(0,a.i4)(t,74),78}function v(e,t){return e.dataReferenceIndex=(0,a.i4)(t,6),e.channelCount=(0,a.i4)(t,16),e.sampleSize=(0,a.i4)(t,18),e.sampleRate=(0,a.Bh)(t,24)/65536,28}function g(e,t,n){if(e){if(e.size!==e.data.length)throw Error("box ".concat(e.type," size !== data.length"));var r={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(r.version=e.data[e.headerSize],r.flags=(0,a.sV)(e.data,e.headerSize+1),r.headerSize+=4),n(r,e.data.subarray(r.headerSize),r.start+r.headerSize),r}}var p=function(e,t,n){for(var r=String(n),i=t>>0,a=Math.ceil(i/r.length),o=[],s=String(e);a--;)o.push(r);return o.join("").substring(0,i-s.length)+s},m=function(){for(var e=[],t=arguments.length,n=Array(t),r=0;r=0){var n=0,r=0;if(this.offset+=e,this.size>31){for(;r>>t&n}throw Error("the number of the read operation exceeds the total length limit of bits")}}],[{key:"fromByte",value:function(t,n){return new e(t.read(n),n<<3)}}]),e}()},578548:function(e,t,n){function r(){for(var e=arguments.length,t=Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}function o(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 s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt32(t)}function u(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return 4294967296*o(e,t)+o(e,t+4)}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getUint32(t)<<32|n.getUint32(t+4)}function d(e){for(var t,n="avc1.",r=0;r<3;r++)(t=e[r].toString(16)).length<2&&(t="0".concat(t)),n+=t;return n}function l(e){var t="";if(e.forEach(function(e){t+=function(e){return("0"+Number(e).toString(16)).slice(-2).toUpperCase()}(e)}),t.length<=32){for(var n=32-t.length,r=0;r