/*! For license information please see player-2.b3c9446a.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,i=arguments.length;n/g,o=/&#([a-zA-Z0-9]*);?/gim,s=/"/g,u=/:?/gim,c=/&newline;?/gim,l=/((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,d=/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,g=function(e){return e.replace(r,"<").replace(a,">")},v={indexOf:function(e,t){var n,i;for(n=0,i=e.length;n127&&i<2048?t+=String.fromCharCode(i>>6|192)+String.fromCharCode(63&i|128):t+=String.fromCharCode(i>>12|224)+String.fromCharCode(i>>6&63|128)+String.fromCharCode(63&i|128)}return t}(e);l>2,a=(3&t)<<4|(n=e.charCodeAt(l++))>>4,o=(15&n)<<2|(i=e.charCodeAt(l++))>>6,s=63&i,isNaN(n)?o=s=64:isNaN(i)&&(s=64),c=c+u.charAt(r)+u.charAt(a)+u.charAt(o)+u.charAt(s);return c}function y(e){var t,n,i,r,a,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",c=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");c>4,n=(15&r)<<4|(a=s.indexOf(e.charAt(c++)))>>2,i=(3&a)<<6|(o=s.indexOf(e.charAt(c++))),u+=String.fromCharCode(t),64!==a&&(u+=String.fromCharCode(n)),64!==o&&(u+=String.fromCharCode(i));return function(e){for(var t="",n=0,i=0,r=0,a=0;n191&&i<224?(t+=String.fromCharCode((31&i)<<6|63&(a=e.charCodeAt(n+1))),n+=2):(a=e.charCodeAt(n+1),t+=String.fromCharCode((15&i)<<12|(63&a)<<6|63&(r=e.charCodeAt(n+2))),n+=3);return t}(u)}function I(e,t,n){var i="",r=0,a=!1,o=!1,s=0,u=e.length,c="",l="";e:for(s=0;s"===d||s===u-1){i+=n(e.slice(r,a)),c=function(e){var t,n=v.spaceIndex(e);return t=-1===n?e.slice(1,-1):e.slice(1,n+1),"/"===(t=v.trim(t).toLowerCase()).slice(0,1)&&(t=t.slice(1)),"/"===t.slice(-1)&&(t=t.slice(0,-1)),t}(l=e.slice(a,s+1)),i+=t(a,i.length,c,l,"0;t--){var n=e[t];if(" "!==n)return"="===n?t:-1}return -1}(e,c-1))){u(o,m(v.trim(e.slice(n,c)))),o=!1,n=c+1;continue}}}else{if(-1===(d=e.indexOf(l,c+1)))break;u(o,v.trim(e.slice(r+1,d))),o=!1,n=(c=d)+1}}else o=e.slice(n,c),n=c+1,r='"'===e.charAt(n)||"'"===e.charAt(n)?n:function(e,t){for(;te.charCodeAt(n)?" ":e.charAt(n);return v.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=v.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(l.lastIndex=0,l.test(n))return""}else if("style"===t&&(f.lastIndex=0,f.test(n)||(d.lastIndex=0,d.test(n)&&(l.lastIndex=0,l.test(n)))))return"";return n=function(e){return e=g(e=e.replace(h,"""))}(n)}var b=function(e){return"string"==typeof e?e.replace(/'/g,'"').replace('=""',"").replace(/\s+/g,"").toLowerCase():""},S=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=g,this.options=Object.assign(t,e)}return e.prototype.process=function(e){if(!(e=(e=e||"").toString()))return"";var t,n,i,r,a,o,s=this.options,u=s.whiteList,c=s.onTag,l=s.onIgnoreTag,d=s.onTagAttr,f=s.onIgnoreTagAttr,h=s.safeAttrValue,g=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=v.spaceIndex(e);if(-1===t)return{html:"",closing:"/"===e[e.length-2]};var n="/"===(e=v.trim(e.slice(t+1,-1)))[e.length-1];return n&&(e=v.trim(e.slice(0,-1))),{html:e,closing:n}}(i),p=u[n],m=A(s.html,function(e,t){var i=-1!==v.indexOf(p,e),r=d(n,e,t,i);return null==r?i?(t=h(n,e,t,null))?"".concat(e,'="').concat(t,'"'):e:null==(r=f(n,e,t,i))?void 0:r:r});return i="<".concat(n),m&&(i+=" ".concat(m)),s.closing&&(i+=" /"),i+=">"}return null==(o=l(n,i,a))?g(i):o},g);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")(),k=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,i="douyin_web";if(!v.includes(i,"bid"))return i;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 r=(x.slardar.config()||{}).bid;if(r)return r}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 v.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 i={age:Math.floor(Date.now()),type:"xss",url:n,body:e,"user-agent":""};"enforce"===e.disposition&&"SSR"!==n||(i.url=t),"SSR"===n&&(i.url="SSR___".concat(i.url),i.body.ssr=!0),this.push(i)}},e}()),E=function(e){for(var t=0,n=function(n){Array.isArray(e[n])?0===e[n].length?delete e[n]:(e[n]=v.from(v.uniq(e[n])),t+=e[n].length):0===v.keys(e[n]).length?delete e[n]:v.keys(e[n]).forEach(function(i){e[n][i]=v.from(v.uniq(e[n][i])),t+=e[n][i].length})},i=0,r=v.keys(e);i0)return t&&t("javascript:"),!1;if(/^javascript:/i.test(e)){var r=e.slice(11).replace(/\s/g,"").trim();return!!v.some(["void","void(0)","void0","false","undefined",";"],function(e){return e===r})||(t&&t("javascript:"),!1)}return!0}var Z=function(e,t){var n,i,r="<%= isSaveValidUrl =>";if("string"!=typeof e||(i=Number("<%= urlLimit =>"),void 0!==n&&(i=n),"NaN"!==e.toString()&&-1!==i&&e.length>=i)||L(e,t))return e;try{if(!0===(r=JSON.parse(r))||"true"===r){var a=new URL(e);return a.origin+a.pathname}}catch(e){}return"#"};function O(e,t,i){if(void 0===e&&(e=""),void 0===t&&(t=[]),"string"!=typeof e)return!0;if(!L(e=R(e)))return!1;var r,a={url:(r=e.match(/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/)||[])[0],scheme:r[1],slash:r[2],host:r[3],port:r[4],path:r[5],query:r[6],hash:r[7]},o=a.scheme,s=a.host;return i?!!i(e):!(!o||!s)&&(!v.includes(["http","https","file"],o)||("object"==typeof window&&window&&(t=n(n([],t,!0),[location.host],!1)),v.some(t,function(e){return!!(e instanceof RegExp&&e.test(s))||e===s})))}var B={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:[]},P={collect:null,initCollect:function(){this.collect={whiteList:{},filterProtocol:[]}},removeCollect:function(){var e=E(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,i){return e&&v.indexOf(["href","src"],t)>-1?P.domainWhiteList&&Array.isArray(P.domainWhiteList)&&P.domainWhiteList.length>0&&!O(i,n([],P.domainWhiteList,!0))?"":"".concat(t,'="').concat(Z(i,function(e){var t;null===(t=P.collect)||void 0===t||t.filterProtocol.push(e)}),'"'):e&&(v.indexOf(["style","class","id"],t)>-1||t.indexOf("data-")>-1)?"".concat(t,'="').concat(i,'"'):(P.collect.whiteList[e]=P.collect.whiteList[e]||[],void P.collect.whiteList[e].push(t))},onIgnoreTag:function(e,t){if("style"===e)return t;I(t,function(e,t,n,i){A(w(i).html.replace("/",""),function(e){P.collect.whiteList[n]=P.collect.whiteList[n]||[],P.collect.whiteList[n].push(e)})},g)},whiteList:B,mergeWhiteList:function(e){for(var t,n={},i=0,r=v.keys(B);i");var a=w(i),o=A(a.html,function(e,t){var i,r=0;if(D.blackList[n]&&v.includes(D.blackList[n],e)&&(U.collect.blackList[n]=U.collect.blackList[n]||[],U.collect.blackList[n].push(e),r++),D.blackAttrRegExps.length&&D.blackAttrRegExps.some(function(t){return t.test(e)})&&v.forEach(D.blackAttrRegExps,function(t){t.test(e)&&(U.collect.blackAttrRegExps.push("".concat(t.toString(),"->").concat(e)),r++)}),D.blackAttrs.length&&v.includes(D.blackAttrs,e)&&(D.blackAttrs.push(e),r++),!r){if(D.filterList&&D.filterList[n]&&v.includes(D.filterList[n],e)){var a=Z(t,function(e){var t;null===(t=U.collect)||void 0===t||t.filterProtocol.push(e)});return a!==t&&(U.collect.filterList[n]=U.collect.filterList[n]||[],U.collect.filterList[n].push(e)),t?"".concat(e,"='").concat(a,"'"):e}return D.filterAttrs&&v.includes(D.filterAttrs,e)?((a=Z(t,function(e){var t;null===(t=U.collect)||void 0===t||t.filterProtocol.push(e)}))!==t&&(null===(i=U.collect)||void 0===i||i.filterAttrs.push(e)),t?"".concat(e,"='").concat(a,"'"):e):t?"".concat(e,"='").concat(t,"'"):e}});return i="<".concat(n),o&&(i+=" ".concat(o)),a.closing&&(i+=" /"),i+=">"},g);null===(n=U.collect)||void 0===n||n.blackTags.push(e)}},j=function(e){var t=e.reportOnly,n=void 0===t||t,i=e.block;return n&&"all"===n?"report":("string"==typeof n&&("true"===n&&(n=!0),"false"===n&&(n=!1)),i?"enforce":n?"report":"enforce")},W=function(e){return function(n,i,r){if(!n||"string"!=typeof n)return n;var a=i;e===T&&(a=P).initCollect();var o=e(n,a);if(b(o)===b(n))return n;if(!r)return o;var s=r.logType,u=j(r),c=a.removeCollect();return k.report(t(t({type:s,disposition:u},c),{sourceText:_(n),filterText:_(o)})),"enforce"===u?o:n}},Y=W(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 S(t).process(e)}),F=W(T),H=function(e,t,n){var i=[],r=Z(e,function(e){i.push(e)});if(r===e)return e;i=v.from(v.uniq(i));var a=t||n||{};if(!a)return r;var o=a.logType,s=j(n);return k.report({type:o,disposition:s,collectKey:i.join("___"),collectData:JSON.stringify(i),collectMode:"black",sourceText:_(e),filterText:_(r)}),"enforce"===s?r:e},X=x._xssProject||{},J=x.xssNamespace||{},Q="3.0.26",z={FilterXSS:S,version:Q,webpackPluginVersion:"<%= webpackPluginVersion =>",reportOnly:"<%= reportOnly =>",filterXSS:Y,_filterXSS:F,filterUrl:H,Config:P,BlackConfig:U,project:X,setProjectName:function(e){X[e]=this,x._xssProjectName=e}};J.douyin_web=z,x.xssNamespace=J,x.Math&&!x.Math.xssNamespace&&(x.Math.xssNamespace=J),X[Q]=z,x.globalThis=x,x.getFilterXss=function(){return void 0!==this._xssProjectName?this._xssProject[this._xssProjectName]:z},x.xss=z,x.isSafeUrl=O,x.isSafeDomain=O,x.isSafeProtocol=L,x._xssProject=X,x._xssProjectName&&(X[x._xssProjectName]=z);var q=z.setProjectName.bind(z);e.BlackConfig=U,e.Config=P,e.FilterXSS=S,e._filterXSS=F,e.filterUrl=H,e.filterXSS=Y,e.isSafeDomain=O,e.isSafeProtocol=L,e.isSafeUrl=O,e.project=X,e.setProjectName=q,e.setXssNamespace=function(e){var t=e.appId,n=e.bid,i=e.region;J[t]=z;P.bid=n,P.region=i,P.enabled=!0},e.xssNamespace=J,Object.defineProperty(e,"__esModule",{value:!0})}),(self.webpackChunkdouyin_web=self.webpackChunkdouyin_web||[]).push([["13815"],{861504:function(e,t,n){n.d(t,{Ef:function(){return d},Im:function(){return g},Iv:function(){return y},TJ:function(){return h},XZ:function(){return l},Z1:function(){return A},_X:function(){return p},a1:function(){return u},eT:function(){return o},fD:function(){return r},fp:function(){return _},he:function(){return m},kW:function(){return a},of:function(){return s},sW:function(){return v},tE:function(){return c},zK:function(){return f},zb:function(){return I}}),n(232070);var i,r={MEDIA_EXPIRED:"MEDIA_EXPIRED",INIT_FAIL:"INIT_FAIL",PARSE_ERROR:"PARSE_ERROR",PLAYER_LOG:"PLAYER_LOG",BUFFERED_RESET:"BUFFERED_RESET",MEDIA_LIST:"MEDIA_LIST",FIRST_MET_MUX_NOT_CONTINUE:"FIRST_MET_MUX_NOT_CONTINUE"},a="real_time_speed",o="is unsupported",s="buffer_control",u={WAITING:"waiting",PLAYING:"playing"},c={app_id:6383,sid:5,task_type:1},l=10,d=2,f=10;var h=((i=h||{}).GOP="gop",i.SIZE="size",i.UNMUX="un_mux",i.ONLY_SIZE="only_size",i),g={BUFFER_CONTROLS:"buffer_control"},v="timer_update",p=.2,m=5,_={PRELOAD_ERROR:"PRELOAD_ERROR",PRELOAD_CHECK:"PRELOAD_CHECK",PRELOAD_OK:"PRELOAD_OK",PRELOAD_MATCH:"PRELOAD_MATCH",USER_DEFI_CHECK:"USER_DEFI_CHECK"},y={META_READY:"meta_ready",INIT:"init"},I=[{range:[0,1800],time:5e3},{range:[1800,3600],time:1e4},{range:[3600,7200],time:15e3},{range:[7200,18e3],time:2e4},{range:[18e3,Number.MAX_VALUE],time:3e4}],A="progress dataLen not match"},980275:function(e,t,n){function i(e,t){try{if(!t||e.startsWith("blob"))return e;var n=e.indexOf("?"),i=n===e.length-1,r="";Object.keys(t).forEach(function(e){var n=t[e];if(null!=n&&""!==n)r+="".concat(r?"&":"").concat(e,"=").concat(t[e])});return e+=(n<0?"?":i?"":"&")+r}catch(t){return e}}n.d(t,{v:function(){return i}}),n(346984),n(2885),n(248385),n(968336),n(663030)},608215:function(e,t,n){n.d(t,{Z:function(){return p}});var i=n(648955);n(346984),n(705574),n(124300),n(9498),n(117232),n(173757),n(2885),n(248385),n(759943),n(414931),n(683656),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 r=n(358506),a=n.n(r),o=n(405762),s=n(874768),u=n(731751),c=n(298757),l=n(521323),d=n(204961),f=n(829594),h=n(516968),g=n(525231);function v(e,t,n,i){return e[t]?i?i(e[t]):e[t]:n}let p=function(){var e;function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;(0,i.PA)(this,t),a()(this),this.url=e,this.options=r,this.dash=o,this.useSeparationMode=null===(n=this.dash.config)||void 0===n?void 0:n.useSeparationMode,this.mediaList={video:[],audio:[]},this.mediaList.audio.selectedIdx=0,this.retryMax=10,this.retry=0,this.type="live",this.isEnd=!1,this.duration=0,this.hasSync=!1,this._readyPromise=new c.XK,this._loadStates={video:this._createLoadingState(),audio:this._createLoadingState()},this.majorCodecType=null}return(0,i.qH)(t,[{key:"_createLoadingState",value:function(){return{currentIndex:0,isLoading:!1}}},{key:"readyPromise",get:function(){return this._readyPromise}},{key:"setLoadingState",value:function(e,t){this._loadStates[e].isLoading=t}},{key:"calcVideoCodeType",value:function(e,t){if(!!e||!!t){var n=null;t?n=t.split(".")[0]:e&&(n=e.split(".")[0]);for(var i=null,r=null,a=Object.keys(d.$V),o=0;o-1){i=s,"hevc"===s?i="h265":"bvc2"===s?i="h266":"avc"===s&&(i="h264"),r=u.codecs;break}}return l.ZP.log("mpd dataType:",e,"codecs:",t,"cal type:",i,"videoCodecs",r),!i&&(i="h264",r=d.$V[d.d0.AVC].codecs),this.dash&&this.dash._pluginInst&&this.dash._pluginInst.setCodeInfo(i),{videoCodecType:i,videoCodecs:r}}}},{key:"fetch",value:(e=(0,i.x)((0,i.l5)().mark(function e(n){var r,a,o,u,c,l,d,f;return(0,i.l5)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=this,a={TYPE:"LIVE",ENDLIST:""},o=[],e.prev=3,u=new h.mf({}),e.next=7,u.load(n);case 7:if(!(c=e.sent.data)){e.next=21;break}if(l=t.parseMPD(c)){e.next=13;break}throw Error("parse mpd error");case 13:return this._parseMeta(a,l),this._parseSegments(l,n),["video","audio"].forEach(function(e){r.mediaList[e].length>0&&(r.mediaList[e].selectedIdx="video"===e&&r.dash.selectedIdx||0,r.mediaList[e].sort(function(t,n){return"video"===e?n.height-t.height:n.bandwidth-t.bandwidth}))}),0===r.mediaList.video.length&&0===r.mediaList.audio.length&&(null===(d=r.dash)||void 0===d||d.emit("error",new s.Z(g.wb.MANIFEST,g.wb.SUB_TYPES.DASH,{url:n,message:"NO_MEDIALIST fetch"}))),e.abrupt("return",{meta:a,segments:o});case 21:throw r.dash.emit("error",new s.Z(g.wb.MANIFEST,g.wb.SUB_TYPES.DASH,{url:n,message:"mpd parse error"})),Error("MPD_PARSE_ERROR");case 23:e.next=29;break;case 25:throw e.prev=25,e.t0=e.catch(3),r.dash.emit("error",new s.Z(g.wb.RUNTIME,s.Z.MPD_INIT_ERROR,{httpCode:null===(f=e.t0.response)||void 0===f?void 0:f.status,url:n,message:null===e.t0||void 0===e.t0?void 0:e.t0.message})),Error(e.t0);case 29:case"end":return e.stop()}},e,this,[[3,25]])})),function(t){return e.apply(this,arguments)})},{key:"_parseMeta",value:function(e,t){"static"===t.type&&(e.TYPE="VOD"),t.minBufferTime&&(e.minBufferTime=o.Z.durationConvert(t.minBufferTime)),t.maxSegmentDuration&&(e.maxSegmentDuration=o.Z.durationConvert(t.maxSegmentDuration)),t.mediaPresentationDuration&&(this.duration=o.Z.durationConvert(t.mediaPresentationDuration));var n=t.Period[0];!this.duration&&n&&n.duration&&(this.duration=o.Z.durationConvert(n.duration)),e.duration=this.duration}},{key:"_parseST",value:function(e,t,n,i,r){for(var a=parseFloat(e.timescale),s=Math.round(parseFloat(e.duration)/a),u=parseInt(e.startNumber,10),c=u+Math.ceil(this.duration/s)-1,l=u;l<=c;l++){var d=s*(l-u),f=s*(l-u+1);l===c&&(s=this.duration-s*(c-u),f=this.duration),t.push({idx:l,start:Math.round(d),end:Math.round(f),url:i+e.media.replace("$RepresentationID$",n).replace("$Number%04d$",o.Z.preFixInterge(l,4)),downloaded:0,segmentDuration:s,height:r})}}},{key:"_getVideoSegments",value:function(e){var t,n,i,r,a,o=e.bandwidth,s=e.id,u=e.baseURL,c=e.initSegment,l=e.mediaSegments,d=e.mimeType,f=e.codecs,h=e.width,g=e.height,v=e.frameRate,p=e.sar,m=e.startWithSAP,_=e.timescale,y=e.duration,I=e.encrypted,A=!1;if(this.options.dynamic_video&&this.options.dynamic_video.dynamic_video_list)for(var C=0;C1&&a.AdaptationSet.forEach(function(e){var a="video/mp4",o="avc1.64001E",s="640",u="360",c="25",l="1:1",d="1",f="588633";e.mimeType&&("video/mp4"===(a=e.mimeType)?(o=e.codecs,s=parseFloat(e.width),u=parseFloat(e.height),c=parseFloat(e.frameRate),l=e.sar,d=e.startWithSAP,f=parseFloat(e.bandwidth),n.calcVideoCodeType(null,o)):"audio/mp4"===a&&(o=e.codecs,d=e.startWithSAP,f=parseFloat(e.bandwidth))),e.Representation.forEach(function(h){i.indexOf(h.id)>-1&&(h.id=(parseInt(i[i.length-1],10)+1).toString()),i.push(h.id);var g,p="",m=[],_=0,y=t.slice(0,t.lastIndexOf("/")+1)+r;"video/mp4"===(a=v(h,"mimeType",a))?(h.codecs&&(o=h.codecs,n.calcVideoCodeType(null,o)),s=v(h,"width",s,parseFloat),u=v(h,"height",u,parseFloat),c=v(h,"frameRate",c,parseFloat),l=v(h,"sar",l)):"audio/mp4"===a&&(o=v(h,"codecs",o)),d=v(h,"startWithSAP",d),f=v(h,"bandwidth",f,parseFloat),h.BaseURL&&h.BaseURL.length>0&&(y+=h.BaseURL[0]),e.SegmentTemplate&&e.SegmentTemplate.length>0&&(g=e.SegmentTemplate[0]),h.SegmentTemplate&&h.SegmentTemplate.length>0&&(g=h.SegmentTemplate[0]);var I=!1;(e.ContentProtection||h.ContentProtection)&&(I=!0),g&&(p=g.initialization,_=parseFloat(g.duration),n._parseST(g,m,h.id,y,u)),f=parseInt(f),"video/mp4"===a?n._getVideoSegments({id:h.id,bandwidth:f,baseURL:y,initSegment:p,mediaSegments:m,mimeType:a,codecs:o,width:s,height:u,frameRate:c,sar:l,startWithSAP:d,timescale:0,duration:_,encrypted:I}):"audio/mp4"===a&&n._getAudioSegments({id:h.id,baseURL:y,bandwidth:f,initSegment:p,mediaSegments:m,mimeType:a,codecs:o,startWithSAP:d,timescale:0,duration:_,encrypted:I})})})}},{key:"getCurrDefition",value:function(){var e=this.mediaList,t=e.video,n=e.audio,r={all:{},videoFileId:t[t.selectedIdx].fileId,audioFileId:n[n.selectedIdx].fileId},a,o=(0,i.sf)(t);try{for(o.s();!(a=o.n()).done;){var s=a.value;r.all[s.fileId]=s}}catch(e){o.e(e)}finally{o.f()}var u,c=(0,i.sf)(n);try{for(c.s();!(u=c.n()).done;){var l=u.value;r.all[l.fileId]=l}}catch(e){c.e(e)}finally{c.f()}return r}},{key:"init",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this;this.mediaList={video:[],audio:[]};var i=n.options;if(i.dynamic_video.dynamic_type&&"segment_template"!==i.dynamic_video.dynamic_type){n.dashType="segment_base",i.duration;var r,a=i.dynamic_video;["dynamic_video_list","dynamic_audio_list"].forEach(function(e){var r="dynamic_audio_list"===e,o=0;a[e].forEach(function(a,s){var u,c,l=parseInt(a.init_range.split("-")[0],10),d=parseInt(a.init_range.split("-")[1],10),f=parseInt(a.index_range.split("-")[0],10),h=parseInt(a.index_range.split("-")[1],10),g=a.first_segment_range,v=g?[parseInt(g.split("-")[0],10),parseInt(g.split("-")[1],10)]:null;if(r)c=n.majorCodecType||a.codec_type;else{var p=n.calcVideoCodeType(a.codec_type);u=null==p?void 0:p.videoCodecs,c=null==p?void 0:p.videoCodecType,!n.majorCodecType&&!a.isExtra&&(n.majorCodecType=c)}var m=a.fileId||a.file_id,_="dynamic_audio_list"===e?"audio":"video",y="video"===_?t&&t.videoFileId:t&&t.audioFileId,I=t&&t.all,A=I&&I[m];m===y&&(n.mediaList[_].selectedIdx=s,A.wrapperData&&(A.wrapperData.newIdx=s),A.mediaSegments&&A.mediaSegments.forEach(function(e){e.selectedIdx=s})),n.mediaList[_].push({id:(o++).toString(),baseURL:a.main_url,initSegment:a.main_url,initSegmentRange:[l,d],backupUrlList:[a.main_url,a.backup_url_1||a.backup_url,a.fallback_url].filter(function(e){return e}),sidxRange:[f,h],firstMoofMdatRange:v,inited:!1,hasSidx:!1,mediaSegments:A?A.mediaSegments:[],mimeType:r?"audio/mp4":"video/mp4",codecs:r?"mp4a.40.2":u,width:a.vwidth,height:a.vheight,bandwidth:parseInt(a.bitrate),avg_bitrate:a.avg_bitrate,size:a.size,timescale:-1,duration:i.duration,encrypted:a.encrypt,kid:a.kid,definition:a.definition,sidxRes:void 0,fileId:a.file_id,audioFileId:a.audio_file_id,fallbackUrl:a.fallback_url,hasFallback:!1,backupUrl:a.backup_url_1,hasBackup:!1,wrapperData:A?A.wrapperData:null,codecType:c,isExtra:a.isExtra||!1})})}),n.type="vod",["video","audio"].forEach(function(e){n.mediaList[e].length>0&&(!t&&(n.mediaList[e].selectedIdx="video"===e&&n.dash.selectedIdx||0),"video"===e&&n.mediaList[e].sort(function(t,n){return"video"===e?n.height-t.height:n.bandwidth-t.bandwidth}))}),0===n.mediaList.video.length&&0===n.mediaList.audio.length&&(l.ZP.log("medaiList is null",JSON.stringify(n.options.dynamic_video)),null===(r=n.dash)||void 0===r||r.emit("error",new s.Z(g.wb.MANIFEST,g.wb.SUB_TYPES.DASH,{message:"NO_MEDIALIST"}))),e&&n.emit("ready"),n._readyPromise.resolve()}else n.dashType="segment_template",n.fetch(i.dynamic_video.main_url).then(function(e){n.type=e.meta.TYPE.toLocaleLowerCase(),n.emit("ready"),n._readyPromise.resolve()},function(){["video","audio"].forEach(function(e){n.mediaList[e]=[]}),n.retry++,n.retry,n.retryMax})}},{key:"getSidx",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"video",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0,a=this.mediaList[n][i],o=a.sidxRange[1];try{var u=e instanceof ArrayBuffer?e:e.buffer,c=new Uint8Array(u),d=String.fromCharCode.apply(null,c.subarray(4,8));if("sidx"!==d)throw l.ZP.log("mpd sdix parse err"),Error("topLevel ".concat(d,", index:").concat(i,", res:").concat(e.byteLength,", range:").concat(JSON.stringify(a.sidxRange)));var h=(t=f.I.sidx(f.I.findBox(new Uint8Array(u),[])[0])).timescale,v=[],p=0,m=0,_=o+1,y=_-1,I=a.cancelFirstSegmentReq,A=a.firstMoofMdatRange,C=a.codecType;t.references.forEach(function(e,t){m+=e.subsegment_duration,y+=e.referenced_size,v.push({idx:t+1,url:a.initSegment,start:Math.round(p/h),end:Math.round(m/h),startRaw:p/h,endRaw:m/h,range:[_,y],downloaded:!I&&A&&0===p?1:0,segmentDuration:Math.round(e.subsegment_duration/h),reference_type:e.reference_type,starts_with_SAP:e.starts_with_SAP,SAP_type:e.SAP_type,SAP_delta_time:e.SAP_delta_time,codecType:C,mediaType:n,selectedIdx:i,fileId:a.fileId}),p=m+1,_=y+1}),v[0].startTime_=0,a.mediaDuration=0,v.forEach(function(e,t){a.mediaDuration+=e.segmentDuration,t>0&&(e.startTime_=v[t-1].startTime_+v[t-1].segmentDuration),t===v.length-1&&r&&(e.end=r)}),a.hasSidx=!0,a.mediaSegments=v,a.timescale=h,a.sidxRes=e}catch(e){if(this.sidxHanded)return;throw this.sidxHanded=!0,new s.Z(g.wb.DEMUX,g.wb.SUB_TYPES.SIDX,{line:398,handle:"[MPD] getSidx",message:"mpd segment base Parse getSidx error ".concat(n," err: ").concat(e.message)})}}},{key:"getCodecType",value:function(e){return(!e&&(e=this.majorCodecType),"bvc2"===e)?"h266":"hevc"===e?"h265":e?e:"h264"}},{key:"checkInBuffered",value:function(e,t,n){return 0!==e.length&&this._inBufferd(t,n,e)}},{key:"_inBufferd",value:function(e,t,n){for(var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,r=0;ro)){if(a-i0){for(var r=this._getBuffered(t),a=e;a=f.length)continue;var h=d.currentIndex,g=f[h];if(!g)continue;var v=g.end-g.start;if((null==s?void 0:s[1])===0||(null==s?void 0:s[1])>0&&g.start-s[1]>v+1){var p=this._findSegmentIndexByTime(o,e);if(p!==h-1||i){var m,_,y,I=p;(null==s?void 0:s[1])>0&&(I=this._adjustSegIndex(p,o),l.ZP.log("getMediaResults adjust1",o,h,"new",p,"adjustIdx",I,"buf",null==s?void 0:s[1])),this.setNextSegmentIndex(o,I),g=f[d.currentIndex],l.ZP.log("getMediaResults",o,h,"new",p,"adjustIdx",I,"buf",null==s?void 0:s[1],"gap",(null===(_=g)||void 0===_?void 0:_.start)-s[1],"mediaBuffers",JSON.stringify(c),"seg downloaded",null===(y=g)||void 0===y?void 0:y.downloaded)}else l.ZP.log("getMediaResults seq",o,"nsegIndex",p)}if(!!g){if(g.start-e>t){l.ZP.log("outof time");continue}var A=this.checkInBuffered(c,g.startRaw,g.endRaw);if((null==s?void 0:s[1])===0&&A&&(l.ZP.log("_getMediaResults buffer gap fix",o),d.currentIndex0&&g.end0){for(var r=0;r=a.start&&tMath.abs(t-(null==o?void 0:o.end)))return i.length-1}return -1}},{key:"_getCurBuffered",value:function(e){var t,n=this._getMseBuffered(e);return Array.isArray(n)?[0,0]:null===(t=this.dash.player)||void 0===t?void 0:t.getBufferedRange(n)}},{key:"_isItemBufferRemoved",value:function(e,t,n){if(n&&n.downloaded===u.Kc.APPEND)return!this.checkInBuffered(t,n.startRaw,n.endRaw)&&(l.ZP.log("".concat(e," start:").concat(n.start," end:").concat(n.end," segment downloaded to set false")),n.downloaded=u.Kc.NO_START,!0);return n&&n.downloaded===u.Kc.NO_START&&this.checkInBuffered(t,n.startRaw,n.endRaw)&&(n.downloaded=u.Kc.APPEND,l.ZP.log("".concat(e," start:").concat(n.start," end:").concat(n.end," segment downloaded to append"))),!1}},{key:"clearBuffer",value:function(e,t,n){if(!(e>t)){l.ZP.log("mpd clearBuffer ".concat(n," start:").concat(e," end:").concat(t));var i=this;"vod"===i.type&&(n?[n]:["video","audio"]).forEach(function(n){if(i.mediaList[n].length>0){var r=i.mediaList[n][i.mediaList[n].selectedIdx],a=[];r.mediaSegments.forEach(function(n,i){!(n.endt)&&(n.downloaded=u.Kc.NO_START,n.extRange=void 0,a.push(i))});var o=a.length>0?a[0]:void 0,s=a.length>1?a[a.length-1]:o;l.ZP.log("".concat(n," start:").concat(e," end:").concat(t,",\n startId:").concat(o," , endId:").concat(s,", segment downloaded set false"))}})}}},{key:"isLastSegmentAndAppend",value:function(e,t){if(!this.mediaList[e])return!0;var n,i=t-1,r=this.mediaList[e].selectedIdx,a=null===(n=this.mediaList[e][r])||void 0===n?void 0:n.mediaSegments;return!!a&&(!a[i]||this._isSegmentAppend(a[i])&&a.length-1===i)}},{key:"_isSegmentAppend",value:function(e){return e.downloaded===u.Kc.APPEND}},{key:"isSegmentAppendFromIdx",value:function(e,t){if(!this.mediaList[e])return{res:!0,emptyTrack:!0};var n,i=0,r=this.mediaList[e].selectedIdx,a=(null===(n=this.mediaList[e][r])||void 0===n?void 0:n.mediaSegments)||[];if(0===a.length)return{res:!0,emptySegments:!0};for(var o=0;o=a[a.length-1].end&&(i=a.length-1);var s=!0;if(a)for(var u=i;i0){if(o+1===d)u=(0,a.gJ)(u,new Uint8Array(l.res));else break}else u=(0,a.gJ)(u,new Uint8Array(l.res));r=d,o=f,t=l}var h=t.cacheKey.split("#"),g=(0,i.ZQ)(h,9),v=g[0],p=g[1],m=g[2],_=g[3],y=g[4],I=g[5],A=g[6],C=g[7],b=g[8],S=n[0].range[0],x={vid:v,mediaType:p,codecType:m,vtype:_,definition:y,start:I,end:A,fileId:b,range:[S,o],bitrate:C},k=s.generateRequestUniqueKey(x);return delete t.cacheKey,(0,i._x)({},k,(0,i.Zj)((0,i.Zj)({},t),{},{res:u.buffer,range:[S,o],memory:u.buffer.byteLength}))}function l(e){for(var t=Object.keys(e),n={},i=0;i1&&void 0!==arguments[1]&&arguments[1],n=window.atob(e.replace(/-/g,"+").replace(/_/g,"/"));if(t){for(var i=[],r=0;r>0,a=Math.ceil(r/i.length),o=[],s=String(e);a--;)o.push(i);return o.join("").substring(0,r-s.length)+s},s.durationConvert=function(e){var t=0,n=0,i=0;return(e=e.slice(e.indexOf("PT")+2)).indexOf("H")>-1&&e.indexOf("M")>-1&&e.indexOf("S")>-1?(t=parseFloat(e.slice(0,e.indexOf("H"))),n=parseFloat(e.slice(e.indexOf("H")+1,e.indexOf("M"))),i=parseFloat(e.slice(e.indexOf("M")+1,e.indexOf("S")))):e.indexOf("H")>-1&&e.indexOf("M")>-1&&0>e.indexOf("S")?(t=parseFloat(e.slice(0,e.indexOf("H"))),n=parseFloat(e.slice(e.indexOf("H")+1,e.indexOf("M")))):0>e.indexOf("H")&&e.indexOf("M")>-1&&e.indexOf("S")>-1?(n=parseFloat(e.slice(0,e.indexOf("M"))),i=parseFloat(e.slice(e.indexOf("M")+1,e.indexOf("S")))):e.indexOf("H")>-1&&0>e.indexOf("M")&&e.indexOf("S")>-1?(t=parseFloat(e.slice(0,e.indexOf("H"))),i=parseFloat(e.slice(e.indexOf("H")+1,e.indexOf("S")))):0>e.indexOf("H")&&0>e.indexOf("M")&&e.indexOf("S")>-1?i=parseFloat(e.slice(0,e.indexOf("S"))):0>e.indexOf("H")&&e.indexOf("M")>-1&&0>e.indexOf("S")&&(n=parseFloat(e.slice(0,e.indexOf("M")))),3600*t+60*n+i},s.preFixInterge=function(e,t){return(Array(t).join(0)+e).slice(-t)},s.toHex=function(){for(var e=[],t=arguments.length,n=Array(t),i=0;i1&&void 0!==arguments[1]?arguments[1]:0;return Number(e.toFixed(t))},s.isEdge=function(){var e=window.navigator.userAgent.toLowerCase();return e.indexOf("edge")>-1||e.indexOf("edg/")>-1},s.offInDestroy=function(e,t,n,i){e.once(i,function r(){e.off(t,n),e.off(i,r)})},s.on=function(e,t,n,i){if(i)e.on(t,n),s.offInDestroy(e,t,n,i);else{var r=function(i){n(i),e.off(t,r)};e.on(t,r)}},s.once=function(e,t,n,i){if(i)e.once(t,n),s.offInDestroy(e,t,n,i);else{var r=function(i){n(i),e.off(t,r)};e.once(t,r)}},s.promisePolyfill=function(){!Promise.prototype.finally&&(Promise.prototype.finally=({finally:function(e){var t=function(t){return Promise.resolve(e()).then(t)};return this.then(function(e){return t(function(){return e})},function(e){return t(function(){return Promise.reject(e)})})}}).finally)},s.transformHeaders=function(e,t){var n=Object.assign({},e);return Object.keys(t).forEach(function(i){var r=t[i];e&&e[i]&&(n[r]=e[i],delete n[i])}),n},s.generateRequestUniqueKey=function(e){var t=e.vid,n=e.start,i=e.end,a=e.mediaType,o=e.definition,s=e.codecType,u=e.vtype,c=e.bitrate,l=e.fileId,d=e.range;if(d&&d.length>0?(n=d[0],i=d[1]):(n=n||0,i=i||0),s="hevc"===s?"h265":s||"h264",u=u||r.l0.DASH,!t||!a)return null;var f=o?"".concat(t,"#").concat(a,"#").concat(s,"#").concat(u,"#").concat(o,"#").concat(n,"#").concat(i,"#").concat(c):"".concat(t,"#").concat(a,"#").concat(s,"#").concat(u,"##").concat(n,"#").concat(i,"#").concat(c);return l?"".concat(f,"#").concat(l):f},s.getDefinition=function(e){if(!e)return null;var t=e.split("#");return t.length>2?t[2]:null},s.exchangeListUrl=function(e){if(!!e&&0!==e.length)for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:[];if(!(e instanceof ArrayBuffer))return!1;try{var n=new Uint8Array(e,4,4),i=String.fromCharCode.apply(null,n),r=!0;if(2===t.length){var a=t[1]-t[0]+1;if(!(r=e.byteLength===a))return}if("moof"!==i&&"styp"!==i&&"ftyp"!==i)return!1}catch(e){return!1}return!0},s.validateUrlRange=function(e,t){if((e=e||[]).length>0&&t)for(var n=0;n-1)return!0}return!1},s.nowTime=function(){try{return parseInt(performance.now(),10)}catch(e){return new Date().getTime()}},s.getBitrateItem=function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=s.getSelectorList(e,n);return t.getSuitableBitrate?t.getSuitableBitrate(r,i):t.bitRateAdapter.select(r)},s.getSelectorList=function(e,t){for(var n=e.dynamic_video_list,r=[],a=0;a3&&t[2]&&(n=t[2]),n},s.checkValidTopBox=function(e){var t=s.getTopBoxType(e);return("moof"===t||"styp"===t)&&!0},s.getTopBoxType=function(e){if(s.isArrayBuffer(e)){var t=e.subarray(4,8);return String.fromCharCode.apply(null,t)}return null},s.isArrayBuffer=function(e){return!!(e instanceof ArrayBuffer||e instanceof Uint8Array)||!1},s.getBufferData=function(e,t){var n=0,i=0,r=0,a=0,o=0;if(!e||0===e.length)return{beforeBufLen:n,afterBufLen:i,beforeLastBuffEnd:r,afterFirstBuffEnd:a,afterFirstBuffStart:o};a=1/0,o=1/0;for(var s=0,u=e.length;s2&&void 0!==arguments[2]?arguments[2]:null,i=0,r=0;return function(){for(var a=arguments.length,o=Array(a),s=0;s0){var a=t.slice(0,n);i=t.slice(n);for(var o=0;o0&&(this._maxCache=e)}},{key:"getMemoryInfo",value:function(){return{memory:this._memory,cnt:this._cnt}}}])},917343:function(e,t,n){n.d(t,{Z:function(){return s}});var i=n(330124);n(124300),n(171655),n(248385),n(496423),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 r=n(75740),a=["vid","loadType","size","speed","cacheKey","vtype","duration","bitrate"],o=0,s=(0,i.qH)(function e(t){var n=this;(0,i.PA)(this,e),this._preload_bandwith_map=new Map,this._usepreload_info=new Map,this._pcdn_info_map=new Map,this._updateRealTimeSpeed=function(e){o=e.speed,n.emit(r.kW,e)},this._manager=t},[{key:"setPreloadBandwidth",value:function(e,t){this._preload_bandwith_map.set(e,t)}},{key:"getPreloadBandwidth",value:function(e){return this._preload_bandwith_map.get(e)}},{key:"_updateLoadInfo",value:function(e,t,n){var i=this._pcdn_info_map.get(e);i||(i={}),!i[t]&&(i[t]={},i[t].loadLen=0),i[t].loadLen=i[t].loadLen+n,this._pcdn_info_map.set(e,i)}},{key:"getLoadInfoAndDelete",value:function(e){var t=this._pcdn_info_map.get(e);return this._pcdn_info_map.delete(e),t}},{key:"getPreloadUnuseInfo",value:function(){var e={},t,n=(0,i.sf)(this._preload_bandwith_map);try{for(n.s();!(t=n.n()).done;){var r=(0,i.ZQ)(t.value,2),a=r[0],o=r[1];if(this._usepreload_info.get(a))this._preload_bandwith_map.delete(a);else{var s=a.split("#"),u=s.length>0?s[0]:a;e[u]?(e[u].bw+=o.bw||0,e[u].pbw+=o.pbw||0):e[u]={vid:u,bw:o.bw||0,pbw:o.pbw||0,bitrate:o.bitrate||0,duration:o.duration||0}}}}catch(e){n.e(e)}finally{n.f()}return Object.values(e)}},{key:"bwEventEmit",value:function(e){var t=e.vid,n=e.loadType,o=e.size,s=e.speed,u=e.cacheKey,c=e.vtype,l=e.duration,d=e.bitrate,f=(0,i.Kd)(e,a),h=this.getPreloadBandwidth(u)||{bw:0,pbw:0,vid:t,duration:l,bitrate:d};n&&n!==r._R.CDN?(h.pbw=h.pbw+o,this.emit("prf_data_size",(0,i.Zj)({vid:t,task_type:2,pcdn_size:o,pcdn_speed:s,vtype:c,bitrate:d,duration:l},f))):(h.bw=h.bw+o,this.emit("prf_data_size",(0,i.Zj)({vid:t,task_type:2,cdn_size:o,cdn_speed:s,vtype:c,duration:l,bitrate:d},f))),this.setPreloadBandwidth(u,h),this._updateRealTimeSpeed({speed:s,type:n||r._R.CDN}),this._updateLoadInfo(u,n,o)}},{key:"setUsePreloadInfo",value:function(e,t){this._usepreload_info.set(e,t)}},{key:"realTimeSpeed",get:function(){return o}},{key:"emit",value:function(e,t){var n;null===(n=this._manager)||void 0===n||n.emit(e,t)}},{key:"destroy",value:function(){this._preload_bandwith_map=new Map,this._usepreload_info=new Map,this._pcdn_info_map=new Map,this._manager=null}}])},298757:function(e,t,n){n.d(t,{v8:function(){return S},vI:function(){return p},Ds:function(){return r.Z},Xb:function(){return s.Z},E8:function(){return a.Z},zh:function(){return o.Z},XK:function(){return u.Z},Ic:function(){return g}});var i=n("510142"),r=n("929352"),a=n("737742"),o=n("786933"),s=n("428235"),u=n("165436");n("248385"),n("679308");var c=n("382983"),l,d={},f=0;function h(){do 2147483647===f?f=0:f++;while(f in d);return f}if("undefined"!=typeof Worker){var g,v,p,m,_,y=!1,I=!1,A=function(){if(!_){var e=Promise.withResolvers(),t=e.promise,n=e.resolve,i=e.reject;_=t;try{(l=new c.Z).addEventListener("message",function(e){var t=e.data,r=t.event,a=t.data;switch(r){case"error":I=!0,i(a.error);break;case"ready":y=!0,n();break;default:var o=a.fakeId;if(o in d){var s=d[o]||{},u=s.cb,c=s.param,l=s.keepAlive,f=s.type;if("setInterval"!==f&&delete d[o],!l&&document.hidden)return;if("function"==typeof u)try{u.apply(window,c)}catch(e){}}}}),l.addEventListener("error",function(e){I=!0,i(e)})}catch(e){I=!0,i(e)}}return _},C=function(e,t){I?t&&t():y?e():A().then(e,t)};g=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"!=typeof e)throw Error("cb must be a function");for(var i=h(),r=arguments.length,a=Array(r>3?r-3:0),o=3;o0&&(t=null)}catch(e){t=null}return t}},{key:"parseDOMChildren",value:function(t,n){if(t.nodeType===Node.DOCUMENT_NODE){for(var i={},r=t.childNodes,a=0;a1&&(t._timeRange._duration+=i/1e3,g.kg.log(t.TAG,"_decodeAAC","audio data dts is not continue, last end dts:",o,",now start Dts:",n.dts,"delay:",i))}t._lastAudioBufferInfo={duration:Math.floor(1e3*r.duration),dts:n.dts};var s=t._timeRange.append(r,r.duration,n.dts,i/1e3);if(!t._ready){var u=.5>Math.abs(s+r.duration-t.currentTime);(t.isLive||!u)&&(t._ready=!0,g.kg.log(t.TAG,"_decodeAAC","set ready true start=",s),t.emit(v.ZP.AUDIO.AUDIO_READY,s))}t._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.PROGRESS),t._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.DURATION_CHANGE),e()}},r);o.catch&&o.catch(r)})}},{key:"_decodeG711",value:function(){var e=this._sampleQueue.length,t=this._sampleQueue[0];if(!((this._sampleQueue[e-1].dts-t.dts)/this.timescale<.5)){var n=new Uint8Array(this._sampleQueue.reduce(function(e,t){return e+=t.data.byteLength},0)),i=0,r=0;this._sampleQueue.forEach(function(e,t){0===t&&(i=e.dts),n.set(e.data,r),r+=e.data.byteLength}),this._sampleQueue=[];try{var a=this._meta,o=a.codecType,s=a.channelCount,u=a.sampleSize,c=a.sampleRate,l=y.Z.decodeG711(n,o),d=y.Z.createAudioBufferFromPcm(this._audioCtx,l.buffer,s,c,u/8),f=d.audioBuffer,h=d.duration,p=this._timeRange.append(f,h,i,0);!this._ready&&(this._ready=!0,g.kg.log(this.TAG,"_decodeG711","set ready true"),this.emit(v.ZP.AUDIO.AUDIO_READY,p)),this._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.PROGRESS),this._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.DURATION_CHANGE)}catch(e){this._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.ERROR,this._assembleErr("ERROR_MSG.DECODE_ERR:".concat(e&&e.message)))}}}},{key:"_onSourceBufferEnded",value:function(){this._isSourceBufferEnd=!0,g.kg.long&&g.kg.log(this.TAG,"source play end! currentTime:".concat(this.currentTime," , duration:").concat(this.duration)),this._startRender()}},{key:"_ajustSeekTime",value:function(e){var t=this._timeRange.getBuffer(e,0);t&&(g.kg.log(this.TAG,"ajust seek time to:",t.start),this._lastTimeLineTime=t.start)}},{key:"_getAudioBuffer",value:function(e){var t=this;if(this._timeRange){var n=this._timeRange.getBuffer(this._lastBuffer?this._lastBuffer.end:this.currentTime,0);if(!n){if((this._endOfStream||!this._isLive)&&this.currentTime-this.duration>-.5){this._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.TIMEUPDATE),this._emitTimelineEvents(v.ZP.TIMELINE.PLAY_EVENT,v.ZP.VIDEO_EVENTS.ENDED);return}this._ready=!1,this._audioCtx.suspend(),this.emit(v.ZP.AUDIO.AUDIO_WAITING),e&&(!this._onAudioReady&&(this._onAudioReady=function(e){t._ajustSeekTime(e)}),this.removeListener(v.ZP.AUDIO.AUDIO_READY,this._onAudioReady),this.once(v.ZP.AUDIO.AUDIO_READY,this._onAudioReady));return}if(e){this._ajustSeekTime(n.start),this.emit(v.ZP.AUDIO.AUDIO_READY);return}return n}}},{key:"_startRender",value:function(e){if(!this.noAudio){if("video"===e&&this.isLive&&this._ready&&!this._isSourceBufferEnd){this._doPlay();return}var t=this._getAudioBuffer();if(t){"suspended"===this._audioCtx.state&&(this._audioCtx.resume().catch(function(e){}),(0,_.fC)()),this._lastBuffer=t,this._source=null;var n=this._audioCtx.createBufferSource();n.buffer=t.source,n.loop=!1,this._source=n,n.addEventListener("ended",this._onSourceBufferEnded),n.connect(this._gainNode),t.delay&&t.delay>.001&&(this._delay+=t.delay),this.startDts=t.startDts;try{this._isSourceBufferEnd=!1,n.start()}catch(e){}t.startDts&&this._emitTimelineEvents(v.ZP.TIMELINE.SYNC_DTS,t.startDts)}}}},{key:"_destroy",value:function(){g.kg.log(this.TAG,"destroy audio..."),this._source&&this._source.removeEventListener("ended",this._onSourceBufferEnded),this._audioCtx&&"closed"!==this.ctxState&&this._audioCtx.close(),this._audioCtx=null,this._sampleQueue=null,this._timeRange=null,this._parent=null,this.removeAllListeners()}}]),C}(p.Z)},368166:function(e,t,n){n.d(t,{C:function(){return r}});var i=n(548814),r=function(){function e(){(0,i.PA)(this,e),(0,i._x)(this,"_data",Object.create(null))}return(0,i.qH)(e,[{key:"set",value:function(e,t){this._data[e]=t}},{key:"get",value:function(e){return this._data[e]}},{key:"clear",value:function(){this._data=Object.create(null)}}]),e}()},279981:function(e,t,n){n.d(t,{Z:function(){return r}});var i=n(548814),r=function(){function e(){(0,i.PA)(this,e),this.frames=[],this.dur=0,this.minPts=Number.MAX_VALUE,this.maxPts=0}return(0,i.qH)(e,[{key:"appendFrame",value:function(e){this.frames.push(e),this.dur+=e.duration}},{key:"calMinMaxPts",value:function(e){e.ptsthis.maxPts&&(this.maxPts=t)}}]),e}()},958281:function(e,t,n){n.d(t,{c:function(){return c}});var i=n(182432),r=n(801700),a=n(587220),o=n(275764),s=n(654175),u=n(942155),c=function(e){(0,i.XW)(n,e);var t=(0,i.WY)(n);function n(){var e;return(0,i.PA)(this,n),e=t.call(this),(0,i._x)((0,i.Lc)(e),"_xhr",null),(0,i._x)((0,i.Lc)(e),"_aborted",!1),(0,i._x)((0,i.Lc)(e),"_timeoutTimer",null),(0,i._x)((0,i.Lc)(e),"_range",null),(0,i._x)((0,i.Lc)(e),"_receivedLength",0),(0,i._x)((0,i.Lc)(e),"_url",null),(0,i._x)((0,i.Lc)(e),"_onProgress",null),(0,i._x)((0,i.Lc)(e),"_index",-1),(0,i._x)((0,i.Lc)(e),"_headers",null),(0,i._x)((0,i.Lc)(e),"_currentChunkSizeKB",384),(0,i._x)((0,i.Lc)(e),"_timeout",null),(0,i._x)((0,i.Lc)(e),"_xhr",null),(0,i._x)((0,i.Lc)(e),"_withCredentials",null),(0,i._x)((0,i.Lc)(e),"_startTime",-1),(0,i._x)((0,i.Lc)(e),"_loadCompleteResolve",null),(0,i._x)((0,i.Lc)(e),"_loadCompleteReject",null),(0,i._x)((0,i.Lc)(e),"_runing",!1),(0,i._x)((0,i.Lc)(e),"_logger",!1),(0,i._x)((0,i.Lc)(e),"_vid",""),(0,i._x)((0,i.Lc)(e),"_responseType",void 0),(0,i._x)((0,i.Lc)(e),"_credentials",void 0),(0,i._x)((0,i.Lc)(e),"_method",void 0),(0,i._x)((0,i.Lc)(e),"_transformResponse",void 0),(0,i._x)((0,i.Lc)(e),"_firstRtt",void 0),(0,i._x)((0,i.Lc)(e),"_onCancel",null),(0,i._x)((0,i.Lc)(e),"_priOptions",null),e}return(0,i.qH)(n,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=(0,a.G7)(e.url,e.params);var n=Date.now();return new Promise(function(e,n){t._loadCompleteResolve=e,t._loadCompleteReject=n,t._startLoad()}).catch(function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof r.C?e:new r.C(t._url,t._request)).startTime=n,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e})}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===o.U.ARRAY_BUFFER&&this._range&&this._range.length>1){if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,n=this._range[0]+this._receivedLength,i=this._range[1];t],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e)}this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var n=this._xhr=new XMLHttpRequest;n.open(this._method||"GET",this._url,!0),n.responseType=this._responseType,this._timeout&&(n.timeout=this._timeout),n.withCredentials=this._withCredentials,n.onload=this._onLoad.bind(this),n.onreadystatechange=this._onReadyStatechange.bind(this),n.onerror=function(e){t._running=!1;var n,i,a,o=new r.C(t._url,t._request,null==e?void 0:null===(n=e.currentTarget)||void 0===n?void 0:n.response,"xhr.onerror.status:"+(null==e?void 0:null===(i=e.currentTarget)||void 0===i?void 0:i.status)+",statusText,"+(null==e?void 0:null===(a=e.currentTarget)||void 0===a?void 0:a.statusText));o.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(o)},n.ontimeout=function(e){t.cancel();var n=new r.C(t._url,t._request,{status:408},"timeout");t._onTimeout&&(n.isTimeout=!0,t._onTimeout(n,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),n.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(n)};var i=this._headers||{},o=(0,a.Gu)(e);o&&(i.Range=o),i&&Object.keys(i).forEach(function(e){n.setRequestHeader(e,i[e])}),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),n.send(this._body)}catch(t){t.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t=e.target.status;if(t<200||t>299){var n=new r.C(this._url,null,(0,i.Zj)((0,i.Zj)({},e.target.response),{},{status:t}),"bad response,status:"+t);return n.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(n)}var u=null,c=!1,l=(null===(d=this._range)||void 0===d?void 0:d.length)>0?this._range[0]:0;if(this._responseType===o.U.ARRAY_BUFFER){var d,f,h,g=new Uint8Array(e.target.response);if(f=l+this._receivedLength,g&&g.byteLength>0){this._receivedLength+=g.byteLength;var v=Date.now()-this._startTime,p=(0,a.pl)(this._receivedLength,v);this.emit(s.K.REAL_TIME_SPEED,{speed:p,len:this._receivedLength,time:v,vid:this._vid,index:this._index,range:[f,l+this._receivedLength],priOptions:this._priOptions})}u=g,c=(!((null===(h=this._range)||void 0===h?void 0:h.length)>1)||!this._range[1]||!(this._receivedLength], tast :",this._range,", start",f,"end ",l+this._receivedLength,",dataLen,",g?g.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",c)}else c=!0,u=e.target.response;var m={ok:t>=200&&t<300,status:t,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(m=this._transformResponse(m,this._url)||m),this._onProgress&&this._onProgress(u,c,{index:this._index,vid:this._vid,range:[f,l+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},m),c?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve((0,a.rO)(this._onProgress?null:u,c,m,m.headers["content-length"],m.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted&&(this._aborted=!0,this._runing=!1,(0,i.U2)((0,i.IP)(n.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr))return this._xhr.abort()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t=e.getAllResponseHeaders().trim().split("\r\n"),n={},r,a=(0,i.sf)(t);try{for(a.s();!(r=a.n()).done;){var o=r.value.split(": ");n[o[0].toLowerCase()]=o.slice(1).join(": ")}}catch(e){a.e(e)}finally{a.f()}return n}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),n}(n.n(u)())},309324:function(e,t,n){n.d(t,{d1:function(){return f}});var i=n(70427),r=n(720357),a=n(908483),o=n(525231),s=n(338726),u=n(699694);function c(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];try{if(!a.j)return null;if(e&&"undefined"!=typeof ManagedMediaSource)return ManagedMediaSource;return window.MediaSource}catch(e){}}function l(e){return/ManagedMediaSource/gi.test(Object.prototype.toString.call(e))}var d={APPEND:"appendBuffer",REMOVE:"removeBuffer",UPDATE_DURATION:"updateDuration"},f=function(){var e,t,n;function a(e,t){var n=this;(0,i.PA)(this,a),(0,i._x)(this,"media",null),(0,i._x)(this,"mediaSource",null),(0,i._x)(this,"_openPromise",(0,u.Qo)()),(0,i._x)(this,"_queue",Object.create(null)),(0,i._x)(this,"_sourceBuffer",Object.create(null)),(0,i._x)(this,"_mseFullFlag",{}),(0,i._x)(this,"_st",0),(0,i._x)(this,"_opst",0),(0,i._x)(this,"_logger",null),(0,i._x)(this,"_config",null),(0,i._x)(this,"_url",null),(0,i._x)(this,"_onStartStreaming",function(){n._logger.debug("startstreaming")}),(0,i._x)(this,"_onEndStreaming",function(){n._logger.debug("endstreaming")}),(0,i._x)(this,"_onSBUpdateEnd",function(e){var t=n._queue[e];if(t){var i=t[0];if((null==i?void 0:i.opName)!==d.UPDATE_DURATION&&t.shift(),i){var r,a,o=(0,u.je)()-n._opst;n._logger.debug("UpdateEnd(".concat(e,"/").concat(i.opName,")"),u.Kp.stringify(function(e){var t=[];if(e instanceof TimeRanges)for(var n=0;n0))}),t}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return(null===(e=this.mediaSource)||void 0===e?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"streaming",get:function(){return!l(this.mediaSource)||this.mediaSource.streaming}},{key:"isFull",value:function(e){return e?this._mseFullFlag[e]:this._mseFullFlag[a.VIDEO]}},{key:"updateDuration",value:function(e){var t=this,n=this.mediaSource&&this.mediaSource.duration>e;if(this.mediaSource&&this.mediaSource.duration>e){var i=0;if(Object.keys(this._sourceBuffer).forEach(function(e){try{i=Math.max(t.bufferEnd(e)||0,i)}catch(e){}}),e=1,r="open"===t.readyState,n&&r)try{t.endOfStream()}catch(e){}Object.keys(this._sourceBuffer).forEach(function(e){try{t.removeSourceBuffer(a._sourceBuffer[e])}catch(e){}}),l(t)&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming))}if(this.media){this.media.disableRemotePlayback=!1,this.media.removeAttribute("src");try{this.media.load()}catch(e){}this.media=null}this.mediaSource=null,this._openPromise=(0,u.Qo)(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})},{key:"createSource",value:function(e,t){var n;if(!this._sourceBuffer[e]&&this.mediaSource){try{n=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(e){throw new o.Fc(o.wb.MEDIA,o.wb.SUB_TYPES.MSE_ADD_SB,e)}n.mimeType=t,n.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),n.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,t){var n=this,i=this._sourceBuffer[e];return this.mediaSource&&i&&i.mimeType!==t?"function"!=typeof i.changeType?Promise.reject(new o.Fc(o.wb.MEDIA,o.wb.SUB_TYPES.MSE_CHANGE_TYPE,Error("changeType is not a function"))):this._enqueueOp(e,function(){try{i.changeType(t)}catch(e){throw new o.Fc(o.wb.MEDIA,o.wb.SUB_TYPES.MSE_CHANGE_TYPE,e)}i.mimeType=t,n._onSBUpdateEnd(e)},"changeType",{mimeType:t}):Promise.resolve()}},{key:"createOrChangeSource",value:function(e,t){return this.createSource(e,t),this.changeType(e,t)}},{key:"append",value:function(e,t,n){var i=this;return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,function(){var r;i.mediaSource&&!i.media.error&&(i._logger.debug("MSE APPEND START",n),i._opst=(0,u.je)(),null===(r=i._sourceBuffer[e])||void 0===r||r.appendBuffer(t))},d.APPEND,n):Promise.resolve()}},{key:"remove",value:function(e,t,n,i){var r=this,a=!1;return this._mseFullFlag[e]&&(a=!0),this._enqueueOp(e,function(){if(r.mediaSource&&!r.media.error){var a=r._sourceBuffer[e];if(t>=n||!a){r._onSBUpdateEnd(e);return}r._opst=(0,u.je)(),r._logger.debug("MSE REMOVE START",e,t,n,i),a.remove(t,n)}},d.REMOVE,i,a)}},{key:"clearBuffer",value:function(e,t){var n,i=this;return Object.keys(this._sourceBuffer).forEach(function(r){n=i.remove(r,e,t)}),n||Promise.resolve()}},{key:"clearAllBuffer",value:function(){var e,t=this;return Object.keys(this._sourceBuffer).forEach(function(n){var i=t._sourceBuffer[n];e=t.remove(n,0,r.l.end(r.l.get(i)))}),e}},{key:"clearOpQueues",value:function(e,t){this._logger.debug("MSE clearOpQueue START");var n,i=this._queue[e];if(t&&i){this._queue[e]=[];return}if(i&&i[e]&&!(i.length<5)){var r=[];i.forEach(function(e){e.context&&e.context.isinit&&r.push(e)}),this._queue[e]=i.slice(0,2),r.length>0&&(n=this._queue[e]).push.apply(n,r)}}},{key:"endOfStream",value:function(e){var t=this;return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp(function(){var n=t.mediaSource;n&&"open"===n.readyState&&(t._logger.debug("MSE endOfStream START"),e?n.endOfStream(e):n.endOfStream())},"endOfStream"):Promise.resolve()}},{key:"setLiveSeekableRange",value:function(e,t){var n=this.mediaSource;!(e<0)&&!(t=0?(this._mseFullFlag[e]=!0,a.context&&"object"===(0,i.Ac)(a.context)&&(a.context.isFull=!0),this._logger.error("[MSE error], context,",a.context," ,name,",a.opName,",err,SourceBuffer is full"),null==a||null===(n=a.promise)||void 0===n||n.reject(new o.Fc(o.wb.MEDIA,o.wb.SUB_TYPES.MSE_FULL,s))):(this._logger.error(s),null==a||null===(r=a.promise)||void 0===r||r.reject(s.constructor===o.Fc?s:new o.Fc(o.wb.MEDIA,o.wb.SUB_TYPES.MSE_OTHER,s)),t.shift(),this._startQueue(e))}}}},{key:"setTimeoffset",value:function(e,t,n){var i=this;return this._enqueueOp(e,function(){t<0&&(t+=.001),i._sourceBuffer[e].timestampOffset=t,i._onSBUpdateEnd(e)},"setTimeoffset",n)}},{key:"abort",value:function(e,t){var n=this;return this.isOpened?this._enqueueOp(e,function(){n._sourceBuffer[e].abort(),n._onSBUpdateEnd(e)},"abort",t):Promise.resolve()}}],[{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"',t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=c(t);if(!n)return!1;try{return n.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}}},{key:"isMMSOnly",value:function(){return"undefined"!=typeof ManagedMediaSource&&"undefined"==typeof MediaSource}},{key:"getDefaultConfig",value:function(){return{openLog:!1,preferMMS:!1}}}]),a}();(0,i._x)(f,"VIDEO","video"),(0,i._x)(f,"AUDIO","audio")},408746:function(e,t,n){n.d(t,{G7:function(){return o},Gu:function(){return r},pl:function(){return u},rO:function(){return s}});var i=n(673747);function r(e){if(!!e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function a(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function o(e,t){if(e){if(!t)return e;var n,r=Object.keys(t).map(function(e){if(null!=(n=t[e]))return Array.isArray(n)?e+="[]":n=[n],n.map(function(t){return(0,i.J_)(t)?t=t.toISOString():(0,i.Kn)(t)&&(t=JSON.stringify(t)),"".concat(a(e),"=").concat(a(t))}).join("&")}).filter(Boolean).join("&");if(r){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e}}function s(e,t,n,i,r,a,o,s,u,c,l){return r=null!=r?parseFloat(r):null,Number.isNaN(i=parseInt(i||"0",10))&&(i=0),{data:e,done:t,options:{range:u,vid:c,index:s,contentLength:i,age:r,startTime:a,firstByteTime:o,endTime:Date.now(),priOptions:l},response:n}}function u(e,t){return Math.round(8e3*e/t/1024)}},364812:function(e,t,n){n.d(t,{l:function(){return r}});var i=n(570783),r=function(){function e(){(0,i.PA)(this,e)}return(0,i.qH)(e,null,[{key:"start",value:function(e){return!e||!e.length||1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&0>e.start(0)?0:e.start(0)}},{key:"end",value:function(e){return!e||!e.length||1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1)}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(e){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var n=[],i=0,r=e.length;is&&(o[1]=u)}else n.push([e.start(i),e.end(i)])}else n.push([e.start(i),e.end(i)])}return n}},{key:"totalLength",value:function(e){return e&&e.length?e.reduce(function(e,t){return e+(t[1]-t[0])},0):0}},{key:"info",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t||!t.length)return{start:0,end:0,buffers:[]};for(var r=0,a=0,o=0,s=0,u=0,c=0,l=0,d=e.buffers(t,i),f=0,h=d.length;f=g[0]&&n<=g[1])r=g[0],a=g[1],o=f;else if(n+ig[1]&&(c=g[0],l=g[1])}return{start:r,end:a,index:o,buffers:d,nextStart:s,nextEnd:u,prevStart:c,prevEnd:l,currentTime:n,behind:n-r,remaining:a?a-n:0,length:e.totalLength&&e.totalLength(d)}}},{key:"isBuffered",value:function(t,n){if(t){var i=e.get(t);if(null!=i&&i.length){for(var r=0;r=i.start(r)&&n<=i.end(r))return!0}}return!1}}]),e}()},828792:function(e,t,n){n.d(t,{i:function(){return u}});var i=n("697946"),r=n("662439"),a=n("585104"),o=function(){function e(t){if((0,i.PA)(this,e),this._bitsAvailable=0,this._word=0,!t)throw Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}return(0,i.qH)(e,[{key:"bitsAvailable",get:function(){return this._bitsAvailable}},{key:"bitsPos",value:function(){return 8*this._bytesAvailable-this._bitsAvailable}},{key:"bitsLeft",value:function(){return 8*this._data.length-this.bitsPos()}},{key:"byteAligned",value:function(){return 0===this.bitsPos()||this.bitsPos()%8==0}},{key:"_loadWord",value:function(){var e=this._data.byteLength-this._bytesAvailable,t=Math.min(4,this._bytesAvailable);if(0===t)throw Error("No bytes available");var n=new Uint8Array(4);n.set(this._data.subarray(e,e+t)),this._word=new DataView(n.buffer).getUint32(0),this._bitsAvailable=8*t,this._bytesAvailable-=t}},{key:"skipBits",value:function(e){if(this._bitsAvailable>e)this._word<<=e,this._bitsAvailable-=e;else{var t=Math.floor((e-=this._bitsAvailable)/8);e-=8*t,this._bytesAvailable-=t,this._loadWord(),this._word<<=e,this._bitsAvailable-=e}}},{key:"readBits",value:function(e){if(e>32)throw Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,e),n=this._word>>>32-t;return(this._bitsAvailable-=t,this._bitsAvailable>0?this._word<<=t:this._bytesAvailable>0&&this._loadWord(),(t=e-t)>0&&this._bitsAvailable)?n<>>e)!=0)return this._word<<=e,this._bitsAvailable-=e,e;return this._loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(e){for(var t=8,n=8,i=0;i>3}},{key:"getNalTypes",value:function(t){return null!=t&&t.length?t.map(function(t){return e.getNalType(t)}).filter(function(e){return"number"==typeof e}):[]}},{key:"getNalInfo",value:function(t){var n=e.getNalTypes(t);if(!!n.length){var i="";return n.includes(7)||n.includes(8)?i="idr":n.includes(9)&&(i="cra"),{nalTypes:n,randomAccessType:i,rasl:n.includes(3)}}}},{key:"buildCodecString",value:function(e,t){var n=e||"vvc1";if(!t)return"".concat(n,".1.L93");var i=t.generalProfileIdc||1,r=t.generalTierFlag?"H":"L",a=t.generalLevelIdc||93;return"".concat(n,".").concat(i,".").concat(r).concat(a)}},{key:"parseVVCDecoderConfigurationRecord",value:function(t,n){return e._parseStandardVvcConfigurationRecord(t,n||"vvc1")}},{key:"_parseStandardVvcConfigurationRecord",value:function(t,n){var i,o,s,u,c,l,d,f=t;f.length>=5&&f[0]<248&&(f=f.subarray(4));var h=a.J.fromUint8(f),g=r.A.fromByte(h,1);g.read(5);var v=g.read(2),p=g.read(1),m=1,_={};if(p){var y=r.A.fromByte(h,2);i=y.read(9),m=y.read(3),o=y.read(2),s=y.read(2);var I=r.A.fromByte(h,1);u=I.read(3),I.read(5),_=e.parseVVCPTLRecord(h,m),c=h.read(2),l=h.read(2),d=h.read(2)}var A=e._parseVVCNalArrays(h);return{data:t,codec:e.buildCodecString(n,_),sampleEntryType:n||"vvc1",nalUnitSize:v+1,ptlPresentFlag:p,olsIdx:i,numSublayers:m,constantFrameRate:o,chromaFormatIdc:s,bitDepthLumaMinus8:u,ptlRecord:_,width:c,height:l,sampleRate:d,numOfArrays:A.numOfArrays,vps:A.vps,sps:A.sps,pps:A.pps,spsParsed:A.spsParsed}}},{key:"_parseVVCNalArrays",value:function(t){for(var n=t.read(1),i=[],a=[],o=[],u=null,c=0;c1){for(var p=r.A.fromByte(e,1),m=0,_=t-2;_>=0;--_)m|=p.read(1)<<_;for(var y=t;y<=8&&t>1;++y)p.read(1);for(var I=t-2;I>=0;--I)m&1<=n){var i=e.buffer.slice(e.position,e.position+4);e.skip(4);var r=new Uint8Array(e.buffer.slice(e.position,e.position+n));e.skip(n),t.push({header:i,body:r});continue}break}return t}},{key:"analyseNal",value:function(e){var t=(248&e.body[1])>>3;switch(e.type=t,t){case 23:case 24:break;case 7:case 8:e.key=!0;break;case 14:e.vps=!0;break;case 15:e.sps=!0;break;case 16:e.pps=!0;break;case 17:e.aps=!0}}},{key:"removeEPB",value:function(e){for(var t=e.byteLength,n=[],i=1;i=0;--g)d[g]=t.readBits(1);for(;!t.byteAligned();)t.readBits(1);for(var v=l;v>=0;--v)d[v]&&(f[v]=t.readUByte());if(n){for(var p=t.readUByte(),m=0;m0){var e=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-e.dts+t.duration}return 0}}]),e}()},481784:function(e,t,n){n.d(t,{Dt:function(){return o},vU:function(){return a}});var i="undefined"!=typeof window,r=i&&navigator.userAgent.toLocaleLowerCase();i&&/^((?!chrome|android).)*safari/.test(r);var a=i&&r.includes("firefox"),o=i&&r.includes("android")}}]);