/*! For license information please see npm-d801507b.ee61b10fe7f816aead93.js.LICENSE.txt */ "use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[6534],{26456:(e,t,n)=>{n.d(t,{Ay:()=>D,wA:()=>E});var i=n(22523),r=n(2303),s=n(4408),a=n.n(s),o=n(64821),l=n.n(o),c=n(12969),u=n.n(c),d=n(7569);function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function p(e){for(var t=1;t2&&void 0!==arguments[2]&&arguments[2];return e<12?n?"am":"AM":n?"pm":"PM"}}),g="second",m="zero",v="one",y="few",_="many",T="other",b=[{relativeTimeKey:"y",num:11,unit:"month"},{relativeTimeKey:"M",num:3.5,unit:"week"},{relativeTimeKey:"w",num:6.5,unit:"day"},{relativeTimeKey:"d",num:22,unit:"hour"},{relativeTimeKey:"h",num:45,unit:"minute"},{relativeTimeKey:"m",num:45,unit:g},{relativeTimeKey:"s",num:0,unit:g}],S=new Set(["af","ar","az","bg","bn","ca","ceb","cs","da","de","el","en-GB","en","es-419","es","et","fi","fil","fr-CA","fr","ga","gu","he","hi","hr","hu","id","is","it","ja","jv","kk","km","kn","ko","lt","lv","ml","mr","ms","my","nb","nl","or","pa","pl","pt-BR","pt-PT","pt","ro","ru","sk","sl","sq","sv","sw","ta","te","th","tr","uk","ur","uz","vi","zh-Hans","zh-Hant"]),P=f.formats,M=function(e,t){switch(t){case"ar":return 0===e?m:1===e?v:2===e?"two":e%100>=3&&e%100<=10?y:e%100>10?_:T;case"bn":case"nl":case"en":case"fil":case"fi":case"de":case"el":case"hu":case"it":case"pt":case"es":case"sv":case"ta":case"tr":case"et":case"af":case"bg":case"ml":case"mr":case"or":case"sw":case"te":case"ur":case"uz":case"da":case"nb":return 1===e?v:T;case"ceb":return e%10==4||e%10==6||e%10==9?v:T;case"cs":return 1===e?v:e%10>=2&&e%10<=4?y:Number.isInteger(e)?T:_;case"fr":case"gu":case"hi":case"pa":case"kn":return 0===e||1===e?v:T;case"he":return 1===e?v:2===e?"two":0!==e&&e%10==0?_:T;case"pl":case"ru":case"uk":return 1===e?v:e%10>=2&&e%10<=4?y:Number.isInteger(e)?_:T;case"ro":return 1===e?v:0===e||e%100>=2&&e%100<=19?y:T;case"hr":return e%10==1?v:e%10==2||e%10==3||e%10==4?y:T;case"lt":return e%10==1?v:e%10==0?T:Number.isInteger(e)?y:_;case"lv":return e%10==0?m:e%10==1?v:T;case"sk":return e%10==1?v:e%10==2||e%10==3||e%10==4?y:Number.isInteger(e)?T:_;default:return T}},w=function(e,t,n){var i=t.prototype,r=e.justNowThreshold;i.getTimeExpression=function(e,t){var i=n(e),s=n(t),a=s.$locale(),o=a.justNow,l=a.today,c=a.tomorrow,u=a.yesterday;return Math.abs(i.diff(s,"ms",!0))<=r?o:i.isSame(s,"day")?l:i.add(1,"day").isSame(s,"day")?c:i.subtract(1,"day").isSame(s,"day")?u:""}};function E(e){var t,n=e.toLowerCase();if(S.forEach((function(e){e.toLowerCase()===n&&(t=e)})),t)return t;var i=n.split("-")[0];return S.has(i)?i:"en"}w.$i=!1,a().extend(u()),a().extend(l()),a().extend((function(e,t,n){var i=t.prototype,r=i.format;n.Ls.en.formats=P,i.format=function(){var e,t,n=(e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"YYYY-MM-DDTHH:mm:ssZ",t=this.$locale().formats,e.replace(/(\[[^\]]+])|(LTS?|lts?|L{2,4}\-Y|l{1,4}\-Y|LL\-D|l{1,4}|L{1,4})/g,(function(e,n,i){return n||t[i]||P[i]})));return r.call(this,n)}})),a().extend((function(e,t,n){t.prototype.to=function(t){return function(t,i,r){for(var s=i.$locale(),a=e.thresholds,o=e.rounding,l="",c=0;c=h){var g=o(Math.abs(n(t).diff(i,d,!0))),m=M(g,i.$locale().name),v=f>0?"future":"past";l=((r?s.abbr[d]:s[v][d])[m]||"").replace("%s","".concat(g));break}}return l}(t,this,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}}),{thresholds:b,rounding:Math.round}),a().extend(w,{justNowThreshold:1e3}),a().locale(f.name,f);var k=function(){function e(){(0,i.A)(this,e),this.currentLocale=f.name}return(0,r.A)(e,[{key:"currentLocaleConfig",get:function(){return this.protectMultiThreadedRender(),a()().$locale()}},{key:"format",value:function(e,t){this.protectMultiThreadedRender();var n=this.getDate(e);return a()(n).format(t)}},{key:"setLocale",value:function(e){this.currentLocale=E(e),a().locale(E(e))}},{key:"setLocaleConfig",value:function(e){return this.currentLocale=E(e.name),a().locale(e.name,e),this}},{key:"utcFormat",value:function(e,t){this.protectMultiThreadedRender();var n=this.getDate(e);return a()(n).utc().format(t)}},{key:"getRelativeTime",value:function(e,t){return this.protectMultiThreadedRender(),a()(a()(e).utc()).to(a()(t).utc())}},{key:"getRelativeTimeAbbr",value:function(e,t){return this.protectMultiThreadedRender(),a()(a()(e).utc()).to(a()(t).utc(),!0)}},{key:"configureTimeExpression",value:function(e){this.protectMultiThreadedRender(),w.$i=!1,a().extend(w,e)}},{key:"getTimeExpression",value:function(e,t){return this.protectMultiThreadedRender(),a().prototype.getTimeExpression(e,t)}},{key:"getDate",value:function(e){return"number"==typeof e?new Date(e):e}},{key:"protectMultiThreadedRender",value:function(){var e=a().locale();this.currentLocale!==e&&this.setLocale(this.currentLocale)}}]),e}(),D=new k},71615:(e,t,n)=>{n.d(t,{A:()=>r});var i=n(40099);function r(e){var t=e.width,n=void 0===t?"1em":t,r=e.height,s=void 0===r?"1em":r,a=e.fill,o=void 0===a?"currentColor":a,l=e.style,c=e.className,u=e.e2eTag,d=void 0===u?"":u;return i.createElement("svg",{className:c,style:l,width:n,"data-e2e":d,height:s,viewBox:"0 0 72 72",fill:o,xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.8531 13.6612C31.0541 12.975 28.9695 10.4434 28.9695 7.43671C28.9695 3.90499 31.8457 1.02881 35.3774 1.02881C38.9091 1.02881 41.7853 3.90499 41.7853 7.43671C41.7853 10.4433 39.7008 12.9748 36.902 13.6611V24.499H55.0788C59.7539 24.499 63.56 28.3052 63.56 32.9802V62.4891C63.5549 67.1641 59.7539 70.9703 55.0737 70.9703H15.6812C11.0061 70.9703 7.19998 67.1641 7.19998 62.4891V32.9802C7.19998 28.3052 11.0061 24.499 15.6812 24.499H33.8531V13.6612ZM35.3776 4.07761C33.5279 4.07761 32.0187 5.58684 32.0187 7.43655C32.0187 9.28625 33.5228 10.7955 35.3776 10.7955C37.2324 10.7955 38.7366 9.28625 38.7366 7.43655C38.7366 5.58684 37.2324 4.07761 35.3776 4.07761ZM15.6812 27.5475C12.6881 27.5475 10.2489 29.9816 10.2489 32.9797V62.4886C10.2489 65.4816 12.683 67.9208 15.6812 67.9208H55.0788C58.0719 67.9208 60.5111 65.4867 60.5111 62.4886V32.9797C60.5111 29.9866 58.077 27.5475 55.0788 27.5475H15.6812ZM22.6884 44.4865C22.6884 45.33 23.3694 46.011 24.2129 46.011C25.0565 46.011 25.7374 45.3249 25.7374 44.4865V39.8521C25.7374 39.0085 25.0565 38.3276 24.2129 38.3276C23.3694 38.3276 22.6884 39.0085 22.6884 39.8521V44.4865ZM46.7351 59.1878C46.3031 59.1878 45.8763 59.0048 45.5714 58.6491C43.0479 55.6833 39.3857 53.9656 35.4998 53.9289C35.4611 53.9319 35.422 53.9333 35.3826 53.9333C31.4494 53.9333 27.7347 55.6509 25.1838 58.6541C24.8789 59.0048 24.452 59.1877 24.0201 59.1877C23.6695 59.1877 23.3188 59.0708 23.0343 58.8269C22.394 58.2832 22.3127 57.3177 22.8615 56.6774C25.961 53.0295 30.4655 50.926 35.2403 50.885C35.2839 50.8813 35.328 50.8794 35.3726 50.8794C40.2001 50.8794 44.7634 52.9933 47.8937 56.6724C48.4374 57.3127 48.3612 58.2782 47.7209 58.8219C47.4363 59.0709 47.0857 59.1878 46.7351 59.1878ZM46.5417 46.011C45.6981 46.011 45.0172 45.33 45.0172 44.4865V39.8521C45.0172 39.0085 45.6981 38.3276 46.5417 38.3276C47.3852 38.3276 48.0662 39.0085 48.0662 39.8521V44.4865C48.0662 45.3249 47.3852 46.011 46.5417 46.011Z"}))}},81825:(e,t,n)=>{n.d(t,{A:()=>r});var i=n(40099);function r(e){var t=e.width,n=void 0===t?"1em":t,r=e.height,s=void 0===r?"1em":r,a=e.fill,o=void 0===a?"currentColor":a,l=e.style,c=e.className,u=e.e2eTag,d=void 0===u?"":u;return i.createElement("svg",{className:c,style:l,width:n,"data-e2e":d,height:s,viewBox:"0 0 48 48",fill:o,xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22 10C15.3726 10 10 15.3726 10 22C10 28.6274 15.3726 34 22 34C28.6274 34 34 28.6274 34 22C34 15.3726 28.6274 10 22 10ZM6 22C6 13.1634 13.1634 6 22 6C30.8366 6 38 13.1634 38 22C38 25.6974 36.7458 29.1019 34.6397 31.8113L43.3809 40.5565C43.7712 40.947 43.7712 41.5801 43.3807 41.9705L41.9665 43.3847C41.5759 43.7753 40.9426 43.7752 40.5521 43.3846L31.8113 34.6397C29.1019 36.7458 25.6974 38 22 38C13.1634 38 6 30.8366 6 22Z"}))}},70873:(e,t,n)=>{n.d(t,{A:()=>r});var i=n(40099);function r(e){var t=e.width,n=void 0===t?"1em":t,r=e.height,s=void 0===r?"1em":r,a=e.fill,o=void 0===a?"currentColor":a,l=e.style,c=e.className,u=e.e2eTag,d=void 0===u?"":u;return i.createElement("svg",{className:c,style:l,width:n,"data-e2e":d,height:s,viewBox:"0 0 72 72",fill:o,xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{d:"M36.2544 66.8965C38.3507 66.8965 40.05 65.1971 40.05 63.1008C40.05 61.0045 38.3507 59.3052 36.2544 59.3052C34.1581 59.3052 32.4587 61.0045 32.4587 63.1008C32.4587 65.1971 34.1581 66.8965 36.2544 66.8965Z"}),i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M44.0911 16.0463L41.8628 18.7804C39.935 18.56 37.9871 18.4349 36.0341 18.4349C24.1665 18.4349 12.6093 22.5961 3.48571 30.1523C3.20529 30.3826 2.86479 30.4978 2.52929 30.4978C2.09865 30.4978 1.66801 30.3125 1.37257 29.952C0.846784 29.3161 0.931911 28.3696 1.57286 27.8389C11.2322 19.8369 23.4755 15.4304 36.0392 15.4304C38.7482 15.4304 41.4372 15.6457 44.0911 16.0463ZM32.779 29.9221C25.0625 30.5381 17.8117 33.3573 11.6475 38.1594C10.9915 38.6702 10.8764 39.6116 11.3871 40.2675C11.8979 40.9235 12.8393 41.0387 13.4953 40.5279C18.3926 36.7123 24.0309 34.2536 30.0449 33.2771L32.779 29.9221ZM50.2049 48.4843C46.0137 45.6501 41.1114 44.1528 36.0338 44.1528C34.8821 44.1528 33.7454 44.233 32.6187 44.3832L29.5892 48.0987C31.6623 47.4778 33.8255 47.1523 36.0338 47.1523C40.5105 47.1523 44.8269 48.4693 48.5224 50.968C49.2134 51.4337 50.1448 51.2534 50.6105 50.5624C51.0762 49.8814 50.8909 48.95 50.2049 48.4843ZM60.4207 38.1653C55.4934 34.3245 49.875 31.7607 43.8811 30.5689L41.7079 33.2379C47.842 34.1793 53.5906 36.653 58.573 40.5338C58.8484 40.7491 59.1739 40.8493 59.4943 40.8493C59.94 40.8493 60.3857 40.649 60.6811 40.2684C61.1969 39.6174 61.0767 38.676 60.4207 38.1653ZM53.7655 18.4401C59.7944 20.5282 65.4529 23.6729 70.4253 27.779C71.0662 28.3048 71.1563 29.2512 70.6255 29.8972C70.0998 30.5331 69.1534 30.6232 68.5124 30.0975C63.53 25.9863 57.8215 22.8967 51.7374 20.9288L53.7655 18.4401Z"}),i.createElement("path",{d:"M14.4869 61.0034C14.1514 61.0034 13.8159 60.8932 13.5405 60.6679C12.8996 60.1421 12.7994 59.1957 13.3252 58.5547L56.3993 5.69607C56.9251 5.05512 57.8715 4.95497 58.5125 5.48075C59.1534 6.00653 59.2536 6.95294 58.7278 7.5939L15.6537 60.4526C15.3532 60.8181 14.9226 61.0034 14.4869 61.0034Z"}))}},54622:(e,t,n)=>{n.d(t,{A:()=>r});var i=n(40099);function r(e){var t=e.width,n=void 0===t?"1em":t,r=e.height,s=void 0===r?"1em":r,a=e.fill,o=void 0===a?"currentColor":a,l=e.style,c=e.className,u=e.e2eTag,d=void 0===u?"":u;return i.createElement("svg",{className:c,style:l,width:n,"data-e2e":d,height:s,viewBox:"0 0 9 10",fill:o,xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{d:"M1.35299 0.792837L4.49961 3.93944L7.64545 0.792566C7.8407 0.597249 8.15733 0.597223 8.35262 0.792508L8.70669 1.14658C8.90195 1.34184 8.90195 1.65842 8.70669 1.85368L5.56027 5.0001L8.70672 8.14655C8.90198 8.34181 8.90198 8.65839 8.70672 8.85366L8.35316 9.20721C8.1579 9.40247 7.84132 9.40247 7.64606 9.20721L4.49961 6.06076L1.35319 9.20719C1.15793 9.40245 0.841345 9.40245 0.646083 9.20719L0.292629 8.85373C0.0973708 8.65847 0.0973653 8.3419 0.292617 8.14664L3.43895 5.0001L0.292432 1.85357C0.0972034 1.65834 0.0971656 1.34182 0.292347 1.14655L0.645801 0.792924C0.841049 0.597582 1.1577 0.597543 1.35299 0.792837Z"}))}},94810:(e,t,n)=>{function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=s.call(n)).done)&&(o.push(i.value),o.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return o}}(e,t)||s(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||s(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){var n;if(e)return"string"==typeof e?a(e,t):"Map"===(n="Object"===(n=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n:;\{\}?,。·!¥……()+{}【】、|《》]|(?!\s)'\s+|\s+'(?!\s))/gi,"").trim().replace(/(\s+)-(\s+)/gi," ").replace(/\s+|・/gi,"-"):""}function h(){function e(e){return d.test(e)}function t(){var e=0:;\{\}?,。·!¥……()+{}【】、|《》]|(?!\s)'\s+|\s+'(?!\s))/gi,c=/^(.*)\s?-\s?(.*)?/,u=/^(.*)\((.*)?\)/,d=/^(.*)(ft\.|feat\.)(.*)/;return a=o,(u.test(a)?r(s(o,u)):(a=o,c.test(a)?r(s(o,c)):e(o)?r(s(o)):[t(o)])).join("-")}n.d(t,{A:()=>p,h:()=>f});var p=Object.freeze({__proto__:null,isPureNumber:o,hasIllegalText:l,isRealUniqueId:c,getPureUniqueId:u,purifyPlainText:d,purifyMusicName:h}),f=Object.freeze({__proto__:null,getPureUserPath:function(e){var t=e.uniqueId,n=e.secUid,i=1{n.d(t,{A:()=>E});var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},i(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(e,t){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},s(e,t)},a=function(){return a=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]=300||!a)return function(e,t,n,i){var r=(i||{}).message||"";r=r?", reason is: ".concat(r):"",t(new M("Request failed with status code "+e.status+r,n,null,e,{data:{}},!0))}(r,i,e,s),void(r=null);var o={data:a,status:r.status,statusText:r.statusText,request:r};t(o),r=null}},r.onerror=function(){i(new M("Network Error",e,null,r,{data:{}},!0)),r=null},r.timeout=n,r.ontimeout=function(){i(new M("timeout of "+n+"ms exceeded",e,"ECONNABORTED",r,{data:{}},!0)),r=null},r.send()}))}var E=function(e){function t(t){return t.store||(t.store=P),t.request||(t.request=w),e.call(this,t)||this}return r(t,e),t}(S)},17283:(e,t,n)=>{n.d(t,{A:()=>i});const i=class{constructor(e){this.type="afterLoad",this.condition={},this.tccUrl=e.tccUrl,this.condition=e.condition,this.tccKey=e.tccKey||"text_custom_config",this.expiredTime=e.expiredTime||1e4}createRequest(e,t){const{timeout:n}=t,i=this.tccKey;return new Promise((function(t,r){e||r("[@ies/starling_client_text_replace_plugin]: tccUrl is required");const s=new XMLHttpRequest;s.open("GET",e),s.withCredentials=!1,s.onreadystatechange=function(){if(!s||4!==s.readyState)return;let e=[];try{const t=JSON.parse(s.responseText);e=JSON.parse(t.data[i])}catch(e){r(e)}s.status<200||s.status>=300?r("server error"):t({data:e})},s.onerror=function(e){r(e)},s.timeout=n,s.ontimeout=function(e){r(e)},s.send()}))}async getWithCache(e){const t=`starling_tcc_${e}`,n=(e=>{try{return JSON.parse(localStorage.getItem(e)||"")}catch(e){return{}}})(t);try{if(n&&n.data&&n.expiredTime&&Date.now()-+n.expiredTime{try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.log(e)}})(t,{data:e.data,expiredTime:Date.now()}),e.data}catch(e){return n&&n.data?n.data:(console.error(e),[])}}validate(e){return Array.isArray(e)?!(!this.condition||"object"!=typeof this.condition||!Object.keys(this.condition).length)||(console.warn("condition should be an object"),!1):(console.warn("tcc error: tcc config should be an array"),!1)}createRule(e){return e.reduce(((e,t)=>{if(!Array.isArray(t.condition))return e;const n=t.condition.reduce(((e,t)=>e||this.condition[t.type]==t.value),!1),i=Object.assign({},e.replace,t.rule.replace||{}),r=e.whitelist.concat(t.rule.whitelist||[]);return n?{replace:i,whitelist:r}:e}),{replace:{},whitelist:[]})}replaceByRule(e,t){let n="";if(Object.keys(e).forEach((e=>{RegExp(e,"i").test(t)&&(n=e.length>n.length?e:n)})),n){const i=RegExp(n,"ig");t=t.replace(i,e[n])}return t}async process(e,t){const n=await this.getWithCache(t.apiKey||"");if(!this.validate(n))return e;const{replace:i,whitelist:r}=this.createRule(n);return Object.keys(e).reduce(((t,n)=>{let s=e[n];return r.includes(n)||(s=this.replaceByRule(i,s)),t[n]=s,t}),{})}processSync(e,t,n){if(!this.validate(t))return e;const{replace:i,whitelist:r}=this.createRule(t);return r.includes(n)||(e=this.replaceByRule(i,e)),e}}},77966:(e,t,n)=>{n.d(t,{F2:()=>Re,OV:()=>De,Ay:()=>xe});var i=n(30878),r=n(451),s=n(22523),a=n(2303),o=n(17480),l=n(69236),c=n(76439),u=n(28803),d={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},h=new(function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,s.A)(this,e),this.init(t,n)}return(0,a.A)(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||d,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n1?t-1:0),i=1;i-1?e.replace(/###/g,"."):e}function r(){return!e||"string"==typeof e}for(var s="string"!=typeof t?[].concat(t):t.split(".");s.length>1;){if(r())return{};var a=i(s.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return r()?{}:{obj:e,k:i(s.shift())}}function v(e,t,n){var i=m(e,t,Object);i.obj[i.k]=n}function y(e,t){var n=m(e,t),i=n.obj,r=n.k;if(i)return i[r]}function _(e,t,n){var i=y(e,n);return void 0!==i?i:y(t,n)}function T(e,t,n){for(var i in t)"__proto__"!==i&&"constructor"!==i&&(i in e?"string"==typeof e[i]||e[i]instanceof String||"string"==typeof t[i]||t[i]instanceof String?n&&(e[i]=t[i]):T(e[i],t[i],n):e[i]=t[i]);return e}function b(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var S={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function P(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return S[e]})):e}var M="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,w=function(e){function t(e){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return(0,s.A)(this,t),n=(0,o.A)(this,(0,l.A)(t).call(this)),M&&p.call((0,c.A)(n)),n.data=e||{},n.options=i,void 0===n.options.keySeparator&&(n.options.keySeparator="."),n}return(0,u.A)(t,e),(0,a.A)(t,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,s=[e,t];return n&&"string"!=typeof n&&(s=s.concat(n)),n&&"string"==typeof n&&(s=s.concat(r?n.split(r):n)),e.indexOf(".")>-1&&(s=e.split(".")),y(this.data,s)}},{key:"addResource",value:function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},s=this.options.keySeparator;void 0===s&&(s=".");var a=[e,t];n&&(a=a.concat(s?n.split(s):n)),e.indexOf(".")>-1&&(i=t,t=(a=e.split("."))[1]),this.addNamespaces(t),v(this.data,a,i),r.silent||this.emit("added",e,t,n,i)}},{key:"addResources",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var r in n)"string"!=typeof n[r]&&"[object Array]"!==Object.prototype.toString.apply(n[r])||this.addResource(e,t,r,n[r],{silent:!0});i.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,i,s){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},o=[e,t];e.indexOf(".")>-1&&(i=n,n=t,t=(o=e.split("."))[1]),this.addNamespaces(t);var l=y(this.data,o)||{};i?T(l,n,s):l=(0,r.A)({},l,n),v(this.data,o,l),a.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?(0,r.A)({},{},this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"toJSON",value:function(){return this.data}}]),t}(p),E={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,i,r){var s=this;return e.forEach((function(e){s.processors[e]&&(t=s.processors[e].process(t,n,i,r))})),t}},k={},D=function(e){function t(e){var n,i,r,a,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,s.A)(this,t),n=(0,o.A)(this,(0,l.A)(t).call(this)),M&&p.call((0,c.A)(n)),i=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r=e,a=(0,c.A)(n),i.forEach((function(e){r[e]&&(a[e]=r[e])})),n.options=u,void 0===n.options.keySeparator&&(n.options.keySeparator="."),n.logger=h.create("translator"),n}return(0,u.A)(t,e),(0,a.A)(t,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var i=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,r=t.ns||this.options.defaultNS;if(n&&e.indexOf(n)>-1){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:r};var a=e.split(n);(n!==i||n===i&&this.options.ns.indexOf(a[0])>-1)&&(r=a.shift()),e=a.join(i)}return"string"==typeof r&&(r=[r]),{key:e,namespaces:r}}},{key:"translate",value:function(e,n,s){var a=this;if("object"!==(0,i.A)(n)&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),n||(n={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var o=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,l=this.extractFromKey(e[e.length-1],n),c=l.key,u=l.namespaces,d=u[u.length-1],h=n.lng||this.language,p=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(h&&"cimode"===h.toLowerCase()){if(p){var f=n.nsSeparator||this.options.nsSeparator;return d+f+c}return c}var g=this.resolve(e,n),m=g&&g.res,v=g&&g.usedKey||c,y=g&&g.exactUsedKey||c,_=Object.prototype.toString.apply(m),T=void 0!==n.joinArrays?n.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject;if(b&&m&&"string"!=typeof m&&"boolean"!=typeof m&&"number"!=typeof m&&["[object Number]","[object Function]","[object RegExp]"].indexOf(_)<0&&("string"!=typeof T||"[object Array]"!==_)){if(!n.returnObjects&&!this.options.returnObjects)return this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(v,m,n):"key '".concat(c," (").concat(this.language,")' returned an object instead of string.");if(o){var S="[object Array]"===_,P=S?[]:{},M=S?y:v;for(var w in m)if(Object.prototype.hasOwnProperty.call(m,w)){var E="".concat(M).concat(o).concat(w);P[w]=this.translate(E,(0,r.A)({},n,{joinArrays:!1,ns:u})),P[w]===E&&(P[w]=m[w])}m=P}}else if(b&&"string"==typeof T&&"[object Array]"===_)(m=m.join(T))&&(m=this.extendTranslation(m,e,n,s));else{var k=!1,D=!1,R=void 0!==n.count&&"string"!=typeof n.count,x=t.hasDefaultValue(n),C=R?this.pluralResolver.getSuffix(h,n.count):"",I=n["defaultValue".concat(C)]||n.defaultValue;!this.isValidLookup(m)&&x&&(k=!0,m=I),this.isValidLookup(m)||(D=!0,m=c);var L=x&&I!==m&&this.options.updateMissing;if(D||k||L){if(this.logger.log(L?"updateKey":"missingKey",h,d,c,L?I:m),o){var O=this.resolve(c,(0,r.A)({},n,{keySeparator:!1}));O&&O.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var A=[],G=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if("fallback"===this.options.saveMissingTo&&G&&G[0])for(var $=0;$1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var l=a.extractFromKey(e,o),c=l.key;n=c;var u=l.namespaces;a.options.fallbackNS&&(u=u.concat(a.options.fallbackNS));var d=void 0!==o.count&&"string"!=typeof o.count,h=void 0!==o.context&&"string"==typeof o.context&&""!==o.context,p=o.lngs?o.lngs:a.languageUtils.toResolveHierarchy(o.lng||a.language,o.fallbackLng);u.forEach((function(e){a.isValidLookup(t)||(s=e,!k["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(s)&&(k["".concat(p[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(p.join(", "),'" won\'t get resolved as namespace "').concat(s,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach((function(n){if(!a.isValidLookup(t)){r=n;var s,l,u=c,p=[u];for(a.i18nFormat&&a.i18nFormat.addLookupKeys?a.i18nFormat.addLookupKeys(p,c,n,e,o):(d&&(s=a.pluralResolver.getSuffix(n,o.count)),d&&h&&p.push(u+s),h&&p.push(u+="".concat(a.options.contextSeparator).concat(o.context)),d&&p.push(u+=s));l=p.pop();)a.isValidLookup(t)||(i=l,t=a.getResource(n,e,l,o))}})))}))}})),{res:t,usedKey:n,exactUsedKey:i,usedLng:r,usedNS:s}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,i):this.resourceStore.getResource(e,t,n,i)}}],[{key:"hasDefaultValue",value:function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&"defaultValue"===t.substring(0,12)&&void 0!==e[t])return!0;return!1}}]),t}(p);function R(e){return e.charAt(0).toUpperCase()+e.slice(1)}var x=function(){function e(t){(0,s.A)(this,e),this.options=t,this.whitelist=this.options.supportedLngs||!1,this.supportedLngs=this.options.supportedLngs||!1,this.logger=h.create("languageUtils")}return(0,a.A)(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=R(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=R(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=R(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isWhitelisted",value:function(e){return this.logger.deprecate("languageUtils.isWhitelisted",'function "isWhitelisted" will be renamed to "isSupportedCode" in the next major - please make sure to rename it\'s usage asap.'),this.isSupportedCode(e)}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var i=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(i)||(t=i)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var i=n.getLanguagePartFromCode(e);if(n.isSupportedCode(i))return t=i;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(i))return e}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,i=this.getFallbackCodes(t||this.options.fallbackLng||[],e),r=[],s=function(e){e&&(n.isSupportedCode(e)?r.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&s(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&s(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&s(this.getLanguagePartFromCode(e))):"string"==typeof e&&s(this.formatLanguageCode(e)),i.forEach((function(e){r.indexOf(e)<0&&s(n.formatLanguageCode(e))})),r}}]),e}(),C=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","kk","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],I={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},L=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,s.A)(this,e),this.languageUtils=t,this.options=i,this.logger=h.create("pluralResolver"),this.rules=(n={},C.forEach((function(e){e.lngs.forEach((function(t){n[t]={numbers:e.nr,plurals:I[e.fc]}}))})),n)}return(0,a.A)(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=this.getRule(e);return t&&t.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){return this.getSuffixes(e).map((function(e){return t+e}))}},{key:"getSuffixes",value:function(e){var t=this,n=this.getRule(e);return n?n.numbers.map((function(n){return t.getSuffix(e,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=this,i=this.getRule(e);if(i){var r=i.noAbs?i.plurals(t):i.plurals(Math.abs(t)),s=i.numbers[r];this.options.simplifyPluralSuffix&&2===i.numbers.length&&1===i.numbers[0]&&(2===s?s="plural":1===s&&(s=""));var a=function(){return n.options.prepend&&s.toString()?n.options.prepend+s.toString():s.toString()};return"v1"===this.options.compatibilityJSON?1===s?"":"number"==typeof s?"_plural_".concat(s.toString()):a():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===i.numbers.length&&1===i.numbers[0]?a():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}return this.logger.warn("no plural rule found for: ".concat(e)),""}}]),e}(),O=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,s.A)(this,e),this.logger=h.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return(0,a.A)(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:P,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?b(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?b(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?b(t.nestingPrefix):t.nestingPrefixEscaped||b("$t("),this.nestingSuffix=t.nestingSuffix?b(t.nestingSuffix):t.nestingSuffixEscaped||b(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,i){var r,s,a,o=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(e){return e.replace(/\$/g,"$$$$")}var u=function(e){if(e.indexOf(o.formatSeparator)<0){var r=_(t,l,e);return o.alwaysFormat?o.format(r,void 0,n):r}var s=e.split(o.formatSeparator),a=s.shift().trim(),c=s.join(o.formatSeparator).trim();return o.format(_(t,l,a),c,n,i)};this.resetRegExp();var d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,h=i&&i.interpolation&&i.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return c(e)}},{regex:this.regexp,safeValue:function(e){return o.escapeValue?c(o.escape(e)):c(e)}}].forEach((function(t){for(a=0;r=t.regex.exec(e);){if(void 0===(s=u(r[1].trim())))if("function"==typeof d){var n=d(e,r,i);s="string"==typeof n?n:""}else{if(h){s=r[0];continue}o.logger.warn("missed to pass in variable ".concat(r[1]," for interpolating ").concat(e)),s=""}else"string"==typeof s||o.useRawValueToEscape||(s=g(s));if(e=e.replace(r[0],t.safeValue(s)),t.regex.lastIndex=0,++a>=o.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,i,s=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=(0,r.A)({},a);function l(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var i=e.split(new RegExp("".concat(n,"[ ]*{"))),s="{".concat(i[1]);e=i[0],s=(s=this.interpolate(s,o)).replace(/'/g,'"');try{o=JSON.parse(s),t&&(o=(0,r.A)({},t,o))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(s)}return delete o.defaultValue,e}for(o.applyPostProcessor=!1,delete o.defaultValue;n=this.nestingRegexp.exec(e);){var c=[],u=!1;if(n[0].includes(this.formatSeparator)&&!/{.*}/.test(n[1])){var d=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=d.shift(),c=d,u=!0}if((i=t(l.call(this,n[1].trim(),o),o))&&n[0]===e&&"string"!=typeof i)return i;"string"!=typeof i&&(i=g(i)),i||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),i=""),u&&(i=c.reduce((function(e,t){return s.format(e,t,a.lng,a)}),i.trim())),e=e.replace(n[0],i),this.regexp.lastIndex=0}return e}}]),e}(),A=function(e){function t(e,n,i){var r,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,s.A)(this,t),r=(0,o.A)(this,(0,l.A)(t).call(this)),M&&p.call((0,c.A)(r)),r.backend=e,r.store=n,r.services=i,r.languageUtils=i.languageUtils,r.options=a,r.logger=h.create("backendConnector"),r.state={},r.queue=[],r.backend&&r.backend.init&&r.backend.init(i,a.backend,a),r}return(0,u.A)(t,e),(0,a.A)(t,[{key:"queueLoad",value:function(e,t,n,i){var r=this,s=[],a=[],o=[],l=[];return e.forEach((function(e){var i=!0;t.forEach((function(t){var o="".concat(e,"|").concat(t);!n.reload&&r.store.hasResourceBundle(e,t)?r.state[o]=2:r.state[o]<0||(1===r.state[o]?a.indexOf(o)<0&&a.push(o):(r.state[o]=1,i=!1,a.indexOf(o)<0&&a.push(o),s.indexOf(o)<0&&s.push(o),l.indexOf(t)<0&&l.push(t)))})),i||o.push(e)})),(s.length||a.length)&&this.queue.push({pending:a,loaded:{},errors:[],callback:i}),{toLoad:s,pending:a,toLoadLanguages:o,toLoadNamespaces:l}}},{key:"loaded",value:function(e,t,n){var i=e.split("|"),r=i[0],s=i[1];t&&this.emit("failedLoading",r,s,t),n&&this.store.addResourceBundle(r,s,n),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(n){var i,o,l,c,u;i=n.loaded,o=s,(c=(l=m(i,[r],Object)).obj)[u=l.k]=c[u]||[],c[u].push(o),function(e,t){for(var n=e.indexOf(t);-1!==n;)e.splice(n,1),n=e.indexOf(t)}(n.pending,e),t&&n.errors.push(t),0!==n.pending.length||n.done||(Object.keys(n.loaded).forEach((function(e){a[e]||(a[e]=[]),n.loaded[e].length&&n.loaded[e].forEach((function(t){a[e].indexOf(t)<0&&a[e].push(t)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var i=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:350,a=arguments.length>5?arguments[5]:void 0;return e.length?this.backend[n](e,t,(function(o,l){o&&l&&r<5?setTimeout((function(){i.read.call(i,e,t,n,r+1,2*s,a)}),s):a(o,l)})):a(null,{})}},{key:"prepareLoading",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var s=this.queueLoad(e,t,i,r);if(!s.toLoad.length)return s.pending.length||r(),null;s.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=e.split("|"),r=i[0],s=i[1];this.read(r,s,"read",void 0,void 0,(function(i,a){i&&t.logger.warn("".concat(n,"loading namespace ").concat(s," for language ").concat(r," failed"),i),!i&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(s," for language ").concat(r),a),t.loaded(e,i,a)}))}},{key:"saveMissing",value:function(e,t,n,i,s){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=n&&""!==n&&(this.backend&&this.backend.create&&this.backend.create(e,t,n,i,null,(0,r.A)({},a,{isUpdate:s})),e&&e[0]&&this.store.addResource(e[0],t,n,i))}}]),t}(p);function G(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.whitelist&&(e.whitelist&&e.whitelist.indexOf("cimode")<0&&(e.whitelist=e.whitelist.concat(["cimode"])),e.supportedLngs=e.whitelist),e.nonExplicitWhitelist&&(e.nonExplicitSupportedLngs=e.nonExplicitWhitelist),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function $(){}const N=new(function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;if((0,s.A)(this,t),e=(0,o.A)(this,(0,l.A)(t).call(this)),M&&p.call((0,c.A)(e)),e.options=G(n),e.services={},e.logger=h,e.modules={external:[]},i&&!e.isInitialized&&!n.isClone){if(!e.options.initImmediate)return e.init(n,i),(0,o.A)(e,(0,c.A)(e));setTimeout((function(){e.init(n,i)}),0)}return e}return(0,u.A)(t,e),(0,a.A)(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;function s(e){return e?"function"==typeof e?new e:e:null}if("function"==typeof t&&(n=t,t={}),t.whitelist&&!t.supportedLngs&&this.logger.deprecate("whitelist",'option "whitelist" will be renamed to "supportedLngs" in the next major - please make sure to rename this option asap.'),t.nonExplicitWhitelist&&!t.nonExplicitSupportedLngs&&this.logger.deprecate("whitelist",'options "nonExplicitWhitelist" will be renamed to "nonExplicitSupportedLngs" in the next major - please make sure to rename this option asap.'),this.options=(0,r.A)({},{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,whitelist:!1,nonExplicitWhitelist:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===(0,i.A)(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===(0,i.A)(e[2])||"object"===(0,i.A)(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!1}},this.options,G(t)),this.format=this.options.interpolation.format,n||(n=$),!this.options.isClone){this.modules.logger?h.init(s(this.modules.logger),this.options):h.init(null,this.options);var a=new x(this.options);this.store=new w(this.options.resources,this.options);var o=this.services;o.logger=h,o.resourceStore=this.store,o.languageUtils=a,o.pluralResolver=new L(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),o.interpolator=new O(this.options),o.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},o.backendConnector=new A(s(this.modules.backend),o.resourceStore,o,this.options),o.backendConnector.on("*",(function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r1?n-1:0),r=1;r0&&"dev"!==l[0]&&(this.options.lng=l[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}})),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var c=f(),u=function(){var t=function(t,i){e.isInitialized&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),c.resolve(i),n(t,i)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),c}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$,i="string"==typeof e?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&"cimode"===i.toLowerCase())return n();var r=[],s=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){r.indexOf(e)<0&&r.push(e)}))};i?s(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((function(e){return s(e)})),this.options.preload&&this.options.preload.forEach((function(e){return s(e)})),this.services.backendConnector.load(r,this.options.ns,n)}else n(null)}},{key:"reloadResources",value:function(e,t,n){var i=f();return e||(e=this.languages),t||(t=this.options.ns),n||(n=$),this.services.backendConnector.reload(e,t,(function(e){i.resolve(),n(e)})),i}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&E.addPostProcessor(e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var i=f();this.emit("languageChanging",e);var r=function(e){var r="string"==typeof e?e:n.services.languageUtils.getBestMatchFromCodes(e);r&&(n.language||(n.language=r,n.languages=n.services.languageUtils.toResolveHierarchy(r)),n.translator.language||n.translator.changeLanguage(r),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(r)),n.loadResources(r,(function(e){!function(e,r){r?(n.language=r,n.languages=n.services.languageUtils.toResolveHierarchy(r),n.translator.changeLanguage(r),n.isLanguageChangingTo=void 0,n.emit("languageChanged",r),n.logger.log("languageChanged",r)):n.isLanguageChangingTo=void 0,i.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}))}(e,r)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(r):r(e):r(this.services.languageDetector.detect()),i}},{key:"getFixedT",value:function(e,t){var n=this,s=function e(t,s){var a;if("object"!==(0,i.A)(s)){for(var o=arguments.length,l=new Array(o>2?o-2:0),c=2;c1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var i=this.languages[0],r=!!this.options&&this.options.fallbackLng,s=this.languages[this.languages.length-1];if("cimode"===i.toLowerCase())return!0;var a=function(e,n){var i=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===i||2===i};if(n.precheck){var o=n.precheck(this,a);if(void 0!==o)return o}return!!this.hasResourceBundle(i,e)||!this.services.backendConnector.backend||!(!a(i,e)||r&&!a(s,e))}},{key:"loadNamespaces",value:function(e,t){var n=this,i=f();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){i.resolve(),t&&t(e)})),i):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=f();"string"==typeof e&&(e=[e]);var i=this.options.preload||[],r=e.filter((function(e){return i.indexOf(e)<0}));return r.length?(this.options.preload=i.concat(r),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){return e||(e=this.languages&&this.languages.length>0?this.languages[0]:this.language),e?["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>=0?"rtl":"ltr":"rtl"}},{key:"createInstance",value:function(){return new t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}},{key:"cloneInstance",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$,s=(0,r.A)({},this.options,n,{isClone:!0}),a=new t(s);return["store","services","language"].forEach((function(t){a[t]=e[t]})),a.services=(0,r.A)({},this.services),a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a.translator=new D(a.services,a.options),a.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i-1?e.replace(/###/g,"."):e}function r(){return!e||"string"==typeof e}void 0===n&&(n=null);for(var s="string"!=typeof t?[].concat(t):t.split(".");s.length>1;){if(r())return{};var a=i(s.shift());!e[a]&&n&&(e[a]=new n),e=e[a]}return r()?{}:{obj:e,k:i(s.shift())}}!function(e){e.keepRaw="keepRaw",e.replaceAnyway="replaceAnyway"}(J||(J={})),J.replaceAnyway;var te={memoize:!1,memoizeFallback:!1,bindI18n:!1,bindI18nStore:!1,onParseError:J.replaceAnyway},ne=function(){function e(){this.mem={}}return e.staticInit=function(t){e._i18nextInstance=t},e.prototype.init=function(t,n){var i=this;void 0===t&&(t=e._i18nextInstance);var r={};if((null==t?void 0:t.options)&&(t.options.i18nFormat&&(r=t.options.i18nFormat),r.onParseError=t.options.onParseError,r.missingInterpolationHandler=t.options.missingInterpolationHandler,r.icuConfig=t.options.icuConfig,r.ignoreWarning=!!t.options.ignoreWarning),this.options=Object.assign(te,n,r),this.formats=this.options.formats,t){var s=this.options,a=s.bindI18n,o=s.bindI18nStore,l=s.memoize;t.IntlMessageFormat=Y,this.IntlMessageFormat=Y,t.ICU=this,l&&(a&&t.on(a,(function(){return i.clearCache()})),o&&t.store.on(o,(function(){return i.clearCache()})))}this.options.localeData&&("[object Array]"===Object.prototype.toString.apply(this.options.localeData)?this.options.localeData.forEach((function(e){return i.addLocaleData(e)})):this.addLocaleData(this.options.localeData))},e.prototype.addLocaleData=function(e){("[object Array]"===Object.prototype.toString.apply(e)?e:[e]).forEach((function(e){e&&e.locale&&Y.__addLocaleData(e)}))},e.prototype.addUserDefinedFormats=function(e){this.formats=this.formats?Z(Z({},this.formats),e):e},e.prototype.checkMissingInterpolation=function(e,t,n,i,r){if(!1===(this.options.icuConfig||{}).strict)return n;for(var s={},a=0,o=e;a-1?(window.__STARLING_INCONTEXT_GLOBAL__HOOK__.payload[t][a].default=e,s=a):s=window.__STARLING_INCONTEXT_GLOBAL__HOOK__.payload[t].push({options:n,default:e})-1}else window.__STARLING_INCONTEXT_GLOBAL__HOOK__.payload[t]=[{options:n,default:e}],s=0;return"[[__starling_"+s+"_"+t+"__]]"}return e}};function ae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,i=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,s=!0,a=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return s=e.done,e},e:function(e){a=!0,r=e},f:function(){try{s||null==t.return||t.return()}finally{if(a)throw r}}}}(e._waitingToAddResourceBundle);try{for(a.s();!(s=a.n()).done;){var o,l=s.value;(o=e.instance).addResourceBundle.apply(o,ce(l))}}catch(i){a.e(i)}finally{a.f()}e._waitingToAddResourceBundle=[]}catch(i){}i||(e._updateLanguages(),t({t:r,err:i})),e.init=!0,n({t:r,err:i})}))}))}},{key:"_updateLanguages",value:function(){this.languages=this.instance?Array.from(new Set([this.instance.language].concat(ce(this.instance.languages)))):null}},{key:"getLanguages",value:function(){return this.languages}},{key:"changeLanguage",value:function(e,t){var n=this;this.config.lng=e,this.instance.changeLanguage(e,(function(e,i){e||n._updateLanguages(),t&&t(e,i)}))}},{key:"changeLanguageWithPromise",value:function(e){var t=this;return new Promise((function(n,i){t.config.lng=e,t.instance.changeLanguage(e,(function(e,r){e&&i({err:e,t:r}),t._updateLanguages(),n({err:e,t:r})}))}))}},{key:"getDir",value:function(e){return this.instance.dir(e)}},{key:"addResourceBundle",value:function(e,t,n,i,r){return this.instance.isInitialized?this.instance.addResourceBundle(e,t,n,i,r):(this._waitingToAddResourceBundle.push([e,t,n,!!i,!!r]),this.instance)}}]),e}(),Pe="Starling_intl:",Me=function(){for(var e,t="".concat(Pe," [ERROR]"),n=arguments.length,i=new Array(n),r=0;r{n.d(t,{A:()=>V});var i=n(55371),r=n(95689),s=n(57923),a=n(78647),o=n(51611),l=n(16960),c=n(14444),u=n(40099),d=n(18499);function h(e){var t=[];return u.Children.forEach(e,(function(e){t.push(e)})),t}function p(e,t){var n=null;return e&&e.forEach((function(e){n||e&&e.key===t&&(n=e)})),n}function f(e,t,n){var i=null;return e&&e.forEach((function(e){if(e&&e.key===t&&e.props[n]){if(i)throw new Error("two child with same key for children");i=e}})),i}var g=n(33726);const m=function(e){return e.transitionName&&e.transitionAppear||e.animation.appear},v=function(e){return e.transitionName&&e.transitionEnter||e.animation.enter},y=function(e){return e.transitionName&&e.transitionLeave||e.animation.leave},_=function(e){return e.transitionAppear||e.animation.appear},T=function(e){return e.transitionEnter||e.animation.enter},b=function(e){return e.transitionLeave||e.animation.leave};var S=function(){function e(e,t){for(var n=0;n children");return u.createElement(M,{key:n.key,ref:function(t){e.childrenRefs[n.key]=t},animation:t.animation,transitionName:t.transitionName,transitionEnter:t.transitionEnter,transitionAppear:t.transitionAppear,transitionLeave:t.transitionLeave},n)})));var r=t.component;if(r){var s=t;return"string"==typeof r&&(s=w({className:t.className,style:t.style},t.componentProps)),u.createElement(r,s,i)}return i[0]||null}}]),t}(u.Component);x.isAnimate=!0,x.defaultProps={animation:{},component:"span",componentProps:{},transitionEnter:!0,transitionLeave:!0,transitionAppear:!1,onEnd:R,onEnter:R,onLeave:R,onAppear:R};var C=function(){var e=this;this.performEnter=function(t){e.childrenRefs[t]&&(e.currentlyAnimatingKeys[t]=!0,e.childrenRefs[t].componentWillEnter(e.handleDoneAdding.bind(e,t,"enter")))},this.performAppear=function(t){e.childrenRefs[t]&&(e.currentlyAnimatingKeys[t]=!0,e.childrenRefs[t].componentWillAppear(e.handleDoneAdding.bind(e,t,"appear")))},this.handleDoneAdding=function(t,n){var i=e.props;if(delete e.currentlyAnimatingKeys[t],!i.exclusive||i===e.nextProps){var r=h(D(i));e.isValidChildByKey(r,t)?"appear"===n?_(i)&&(i.onAppear(t),i.onEnd(t,!0)):T(i)&&(i.onEnter(t),i.onEnd(t,!0)):e.performLeave(t)}},this.performLeave=function(t){e.childrenRefs[t]&&(e.currentlyAnimatingKeys[t]=!0,e.childrenRefs[t].componentWillLeave(e.handleDoneLeaving.bind(e,t)))},this.handleDoneLeaving=function(t){var n=e.props;if(delete e.currentlyAnimatingKeys[t],!n.exclusive||n===e.nextProps){var i,r,s,a,o=h(D(n));if(e.isValidChildByKey(o,t))e.performEnter(t);else{var l=function(){b(n)&&(n.onLeave(t),n.onEnd(t,!1))};i=e.state.children,r=o,s=n.showProp,(a=i.length===r.length)&&i.forEach((function(e,t){var n=r[t];e&&n&&(e&&!n||!e&&n||e.key!==n.key||s&&e.props[s]!==n.props[s])&&(a=!1)})),a?l():e.setState({children:o},l)}}}};const I=function(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");return"function"!=typeof t.componentWillReceiveProps?e:u.Profiler?(t.UNSAFE_componentWillReceiveProps=t.componentWillReceiveProps,delete t.componentWillReceiveProps,e):e}(x);var L=n(61978),O=n.n(L);var A=function(e){(0,o.A)(h,e);var t,n,i=(t=h,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,i=(0,c.A)(t);if(n){var r=(0,c.A)(this).constructor;e=Reflect.construct(i,arguments,r)}else e=i.apply(this,arguments);return(0,l.A)(this,e)});function h(){var e;return(0,s.A)(this,h),(e=i.apply(this,arguments)).closeTimer=null,e.close=function(t){t&&t.stopPropagation(),e.clearCloseTimer();var n=e.props.onClose;n&&n()},e.startCloseTimer=function(){e.props.duration&&(e.closeTimer=window.setTimeout((function(){e.close()}),1e3*e.props.duration))},e.clearCloseTimer=function(){e.closeTimer&&(clearTimeout(e.closeTimer),e.closeTimer=null)},e}return(0,a.A)(h,[{key:"componentDidMount",value:function(){this.startCloseTimer()}},{key:"componentDidUpdate",value:function(e){(this.props.duration!==e.duration||this.props.update)&&this.restartCloseTimer()}},{key:"componentWillUnmount",value:function(){this.clearCloseTimer()}},{key:"restartCloseTimer",value:function(){this.clearCloseTimer(),this.startCloseTimer()}},{key:"render",value:function(){var e=this,t=this.props,n=t.prefixCls,i=t.className,s=t.closable,a=t.closeIcon,o=t.style,l=t.onClick,c=t.children,h=t.holder,p="".concat(n,"-notice"),f=Object.keys(this.props).reduce((function(t,n){return"data-"!==n.substr(0,5)&&"aria-"!==n.substr(0,5)&&"role"!==n||(t[n]=e.props[n]),t}),{}),g=u.createElement("div",Object.assign({className:O()(p,i,(0,r.A)({},"".concat(p,"-closable"),s)),style:o,onMouseEnter:this.clearCloseTimer,onMouseLeave:this.startCloseTimer,onClick:l},f),u.createElement("div",{className:"".concat(p,"-content")},c),s?u.createElement("a",{tabIndex:0,onClick:this.close,className:"".concat(p,"-close")},a||u.createElement("span",{className:"".concat(p,"-close-x")})):null);return h?d.createPortal(g,h):g}}]),h}(u.Component);A.defaultProps={onClose:function(){},duration:1.5,style:{right:"50%"}};var G=n(83100),$=n(54042);function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function B(e){for(var t=1;t=s&&(t.updateKey=o[0].notice.updateKey||o[0].notice.key,o.shift()),o.push({notice:t,holderCallback:n})),{notices:o}}))},e.remove=function(t){e.setState((function(e){return{notices:e.notices.filter((function(e){return e.notice.key!==t}))}}))},e}return(0,a.A)(r,[{key:"getTransitionName",value:function(){var e=this.props,t=e.prefixCls,n=e.animation,i=this.props.transitionName;return!i&&n&&(i="".concat(t,"-").concat(n)),i}},{key:"render",value:function(){var e=this,t=this.state.notices,n=this.props,i=n.prefixCls,r=n.className,s=n.closeIcon,a=n.style,o=t.map((function(n,r){var a=n.notice,o=n.holderCallback,l=Boolean(r===t.length-1&&a.updateKey),c=a.updateKey?a.updateKey:a.key,d=function(){var e=[].slice.call(arguments,0);return 1===e.length?e[0]:function(){for(var t=0;t{function i(e){return"object"==typeof e&&"[object Object]"===Object.prototype.toString.call(e)}function r(){const e=arguments.length;let t=arguments[0];i(t)||(t={});for(let n=1;ns,a:()=>a,d:()=>r});const s="g_ven",a="g_exp"},6607:(e,t,n)=>{n.d(t,{V:()=>h,_:()=>y,a:()=>_,b:()=>v,g:()=>m,p:()=>f});var i=n(94982);const r=/ANGLE\s+\((?:[^,]+,\s+)?(?:[^:]*:)?([^,/]+)?(?:[^,]*)(?:[,\s]+)(Direct\S+|OpenGL[\d.\s]+|Unspecified)/,s=/ANGLE\s+\((?:[^,]+,\s+)?([^,]+)?(?:[,\s]+)(Direct\S+|OpenGL[\d.\s]+)/,a=/ANGLE\s+\((?:[^,]+,\s+)?(?:[^:]+:\s+)?([^,]+)?(?:[,\s]+)(Direct\S+|OpenGL[\d.\s]+)?/,o="OpenGL Engine",l="Unknow",c=4318,u=32902,d=4098;var h=(e=>(e.CpuDeriver="CpuDeriver",e.Intel="Intel",e.Nvidia="NVIDIA",e.Amd="AMD",e.Apple="Apple",e.Adreno="Adreno",e[e.Unknow=l]="Unknow",e))(h||{});function p(e){return"NVIDIA"===e?c:"AMD"===e?d:"Intel"===e?u:0}function f(e){const t=function(e){const t=/(SwiftShader|Intel|NVIDIA|AMD|Radeon|Apple|Adreno)/.exec(e);return t?"Radeon"===t[0]?"AMD":"SwiftShader"===t[0]?"CpuDeriver":t[0]:h.Unknow}(e);return t===h.Unknow||"CpuDeriver"===t?{vendor:t,vendorId:0,model:e,backupModel:e,api:l,origin:e}:/^ANGLE/.test(e)?function(e,t){let n,i=l,c=l,u=l;return("Intel"===e||"NVIDIA"===e)&&(n=r.exec(t)),("AMD"===e||"Adreno"===e)&&(n=s.exec(t)),"Apple"===e&&(n=a.exec(t)),null!=n&&n[1]&&(i=n[1].replace(/(AMD|NVIDIA)/,"").trim()),null!=n&&n[2]&&(u=n[2].trim()),i=i.split("(0x00")[0].trim(),c="Intel"===e?i=i.split(o)[0].trim():i.split(o)[0].trim(),{vendor:e,vendorId:p(e),model:i,backupModel:c,api:u,origin:t}}(t,e):"Intel"===t?{vendor:t,vendorId:p(t),model:e.split(o)[0].trim(),backupModel:e.split(o)[0].trim(),api:l,origin:e}:{vendor:t,vendorId:p(t),model:e.replace(/(AMD|NVIDIA)/,"").trim(),backupModel:e.split(o)[0].replace(/(AMD|NVIDIA)/,"").trim(),api:l,origin:e}}let g="";function m(e){if(g)return g;g=localStorage.getItem(i.C)||"";const t=Number(localStorage.getItem(i.a));if(g){const n=t?Date.now()-t:0;if(null==e||!e.expiration||ne.expiration&&(localStorage.removeItem(i.C),localStorage.removeItem(i.a))}return g=function(){try{let e,t;const n=document.createElement("canvas").getContext("webgl");if(n)return t=n.getExtension("WEBGL_debug_renderer_info"),e=t?n.getParameter(t.UNMASKED_RENDERER_WEBGL):"",e}catch{}return""}(),localStorage.setItem(i.C,g),localStorage.setItem(i.a,""+Date.now()),g}function v(e,t){let n=[];switch(t){case h.Intel:n=e.split("\n").map((e=>`Intel(R) ${e}`.replace("#","Graphics").replace("*","HD")));break;case h.Amd:n=e.split("\n").map((e=>e.replace("@","Radeon").replace("*","HD").replace("^","RX")));break;case h.Nvidia:n=e.split("\n").map((e=>e.replace("$","GeForce").replace("%","RTX").replace("&","GTX")))}return n.map((e=>e.split("|")))}function y(e,t){let n=e.filter((e=>e[0]===t.model));n.length||(n=e.filter((e=>e[0]===t.backupModel))),!n.length&&t.vendor===h.Intel&&!/^Intel(R)/.test(t.model)&&(n=e.filter((e=>e[0]==="Intel(R) "+t.model)));let i="-1";if(n.length){const e=n[0][1];i="-1"===e?"0":e}return parseInt(i)}function _(e){return 0===e?0:-1===e?-1:parseFloat(Math.log2(e).toFixed(2))}},24220:(e,t,n)=>{n.d(t,{r:()=>H});var i=n(94982),r=Object.defineProperty,s=(e,t,n)=>((e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class a{constructor(e){s(this,"options"),s(this,"nodes"),this.options=e,this.nodes=[],this._init()}_init(){this.options.plugins&&Object.keys(this.options.plugins).forEach((e=>{const t=this.options.plugins&&this.options.plugins[e];if(t&&!t.ignore&&(!t.instance&&t.plugins&&Object.keys(t.plugins).length>0?t.instance=new a(t):t.cls&&(t.instance=new t.cls(t)),t.instance)){const n=typeof t.weight>"u"?1:t.weight;this.nodes.push({key:e,weight:n,instance:t.instance})}}))}getScore(){return new Promise((e=>{const t=[];this.nodes.forEach((e=>{t.push(new Promise((t=>{e.instance.getScore().then((n=>{t({key:e.key,weight:e.weight,val:n})}))})))})),Promise.all(t).then((t=>{const n={};let i=0,r=0;t.forEach((({weight:e,val:t})=>{t.score>0&&(r+=e)})),r=0===r?1:r;for(let e=0;e0&&(i+=s.weight/r*s.val.score),n[s.key]=s.val}n.score=i,e(n)})).catch(console.log)}))}getScoreSync(e){const t={};let n=0,i=0;const{nodes:r}=this;r.forEach((t=>{const{weight:n,instance:r}=t,{score:s}=t.val=r.getScoreSync(e);s>0&&(i+=n)})),i=0===i?1:i;for(let e=0;e0&&(n+=s.weight/i*s.val.score),t[s.key]=s.val}return t.score=n,t}}class o extends a{get version(){return"0.1.11"}constructor(e){super((0,i.d)({},e))}setPlayer(e,t){var n,i,r;null!=(i=null==(n=this.options.plugins)?void 0:n.render)&&i.instance&&(null==(r=this.options.plugins.render)||r.instance.setPlayer(e,t))}scoreAsync(){return this.getScore()}scoreSync(){return this.getScoreSync()}}var l=Object.defineProperty,c=(e,t,n)=>((e,t,n)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class u{constructor(e){c(this,"mappingFn"),this.mappingFn=e.mapping}getScore(){return new Promise((e=>{e(this.getScoreSync())}))}getScoreSync(){try{const e=navigator.hardwareConcurrency;let t=0;return this.mappingFn&&(t=this.mappingFn(e)),{score:t,origin:e}}catch{return{score:0,origin:-1}}}}class d{constructor(e){c(this,"mappingFn"),c(this,"score",0),c(this,"origin",-1),c(this,"url"),c(this,"_getScoreCallback",(()=>{})),this.url=e.url,this.mappingFn=e.mapping}getScore(){return new Promise((e=>{if(this.url)try{const t=new Image;t.src=this.url,t.onload=()=>{const n=Date.now();"function"==typeof t.decode?t.decode().then((()=>{const t=1e3/(Date.now()-n);let i=0;this.mappingFn&&(i=this.mappingFn(t)),this.score=i,this.origin=t,e({score:i,origin:t})})):e(this.getScoreSync())},t.onerror=()=>{e(this.getScoreSync())}}catch{e(this.getScoreSync())}else e(this.getScoreSync())}))}getScoreSync(e){let t=0;return this.mappingFn&&(t=this.mappingFn(-1,null==e?void 0:e.ignoreCachedImg)),t>0?{score:t,origin:-1}:{score:this.score,origin:this.origin}}}class h{constructor(e){c(this,"mappingFn"),c(this,"score",0),c(this,"origin",-1),this.mappingFn=e.mapping}getScore(){return new Promise((e=>{const t=performance.now();setTimeout((()=>{const n=performance.now()-t;let i=0;this.mappingFn&&(i=this.mappingFn(n)),this.origin=n,this.score=i,e({score:i,origin:n})}),0)}))}getScoreSync(){let e=0;return this.mappingFn&&(e=this.mappingFn(-1)),e>0?{score:e,origin:-1}:{score:this.score,origin:this.origin}}}var p=n(6607),f=Object.defineProperty;const g="Arc(TM) A770M #|995\nArc(TM) A770 #|980\nArc(TM) A770 #|970\nArc(TM) A580 #|940\nArc(TM) A730M #|820\nArc(TM) A750 #|770\nArc(TM) A750 #|770\nArc(TM) A550M #|660\nArc(TM) A550M #|630\nXe # ReleaseInternal|560\nArc(TM) A770M #|500\nArc(TM) A380 #|470\nArc(TM) A380 #|470\nArc(TM) A370M #|340\nArc(TM) A370M #|340\nXe #|320\nHD # 630 GT2|310\nArc(TM) A350M #|280\nIris(R) Xe MAX #|210\nIris(R) Xe # RI|205\nIris(R) Xe # ReleaseInternal|180\nIris(R) Xe #|180\nGen12 Desktop # Controller|180\nIris(R) Xe #|180\nIris(R) Xe MAX #|170\nCorporation Iris Xe #|170\nCorporation TigerLake-LP GT2 [Iris Xe #]|160\nXe #|160\nArc(TM) A350M #|150\nCorporation TigerLake GT2 [Iris Xe #]|150\nUHD # 770|140\nUHD # ReleaseInternal|140\nIris(R) Pro # P580|140\nIris(R) Plus #|130\nIris Plus #|130\nIris(R) Pro # 580|130\nUHD # 770|125\nUHD # 750|125\nRadeong 0.4 on AMD TONGA (DRM 3.1.0, LLVM 3.9.0)|120\nCorporation Iris Plus # G7|120\nIris(R) Plus #|120\nIris(R) Plus # 940|120\nIris(R) Plus # 650|120\nIris(R) Plus # 655|120\nIris(R) Plus # 655|120\nHD # P4600|120\nIris(TM) Pro # 6200|120\nIris(R) Plus #|120\nIris(R) Plus # 650|120\nIris(R) Plus # 655|115\nIris(R) Pro # 580|110\nCorporation Iris Pro # 580|110\nIris(R) Plus # 645|110\nIris(TM) Pro # 6200|110\nIris(TM) Pro # P580|110\nCorporation Iris Plus # 655|110\nArc(TM) # RI|110\nIris(R) Plus # 655|110\nIris(R) Plus # 655|110\nIris(R) Plus #|110\nUHD #|110\nIris Plus # 655|110\nIris(R) Plus # 650|110\nIris(R) Plus # 650|110\nIris(TM) Pro # 580|110\nIris(TM) Pro # 6200|110\nIris # 6100|110\nIris(TM) Pro # 6200|110\nIris(R) Plus # 645|110\nUHD # 730|110\nIris(TM) Pro # 6200|100\nIris Pro # 580|100\nCorporation Iris Pro # 6200|100\nIris(R) Plus # gfx-driver-user-comp_media-21486 DC ReleaseInternal|100\nIris(R) Pro # 580|100\nIris Plus # 645|100\nUHD # 750|100\nIris(TM) Pro # 580|100\nIris(TM) # 550|100\nIris(TM) Pro # P6300|100\nIris(R) Plus # 650|100\nIris(TM) Pro # 5200|100\nIris(R) # 550|100\nIris(R) Plus #|100\nIris(R) Plus # 650|100\nIris(R) Plus # 655|100\nIris(R) # 550|100\nIris(R) Plus # 645|95\nIris Plus # 650|95\nIris(R) # 550|95\nIris # 550|90\nIris(R) Plus # 650|90\nIris(R) Pro # 580|90\nIris(TM) Plus # 650|90\nIris(TM) # 550|90\nIris(R) Plus # 640|90\nIris(TM) Plus # 650|90\nIris(TM) Pro # P6300|90\nIris(TM) Plus # 650|90\nIris(TM) # 550|90\nUHD # 730|90\nCorporation Iris Plus # 650|90\nIris(TM) Pro # 5200|90\nCorporation CometLake-H GT2 [UHD #]|90\nIris(R) # 540|90\nUHD # P630|90\nUHD # 630|85\nIris(TM) # 540|85\nIris(TM) Plus # 640|80\nIris(TM) # 540|80\nUHD # 630|80\nUHD # 630|80\nUHD # P630|80\nIris(TM) Plus # 640|80\nUHD # 630|80\nUHD # 630|80\nIris Plus # 640|80\nIris(TM) # 540|80\nUHD # 630|80\nUHD # 630|80\nIris(TM) Pro # 5200|80\nUHD # 630|80\nHD # 630|80\nUHD # 630|80\nUHD # 630|80\nUHD # 630|80\nUHD # 630|80\nUHD # 630|80\nIris Pro # 6200|80\nUHD # 630|80\nIris # 540|80\nHD # 630|80\nIris(TM) # 540|80\nIris(TM) Pro # 5200|79\nUHD # 630|79\nUHD # 630|79\nUHD # 630|79\nIris # 540|79\nUHD # 630|79\nUHD #|78\nCorporation Sky Lake Integrated #|78\nIris(TM) Pro # 6200|78\nCorporation WhiskeyLake-U GT2 [UHD # 620]|78\nRadeong 0.4 on AMD BONAIRE (DRM 2.43.0, LLVM 3.8.0)|78\nUHD # 710|78\nUHD # 630|78\nUHD # P630|77\nUHD # 630|77\nUHD # 630 (Desktop 9 Series)|77\nUHD # 630|77\nCoffee Lake UHD #|77\nIris(TM) Pro # 5200|77\nUHD # 630|76\nIris(R) Plus # 640|76\nIris(TM) Pro # 5200|76\nUHD # 630|76\nUHD #|76\nUHD # 630|76\nIris(TM) Pro # 5200|75\nUHD # 630|75\nUHD # P630|75\nHD # P530|75\nHD # 630|75\nIris(TM) Pro # 5200|75\nUHD # 630|75\nIris(TM) Pro # 5200|75\nHD # 620|74\nUHD # 630|74\nHD # 630|74\nHD # 630|74\nCoffee Lake HD #|74\nUHD # 630|74\nIris(TM) # 540|74\nUHD 630|74\nIris(R) # 540|73\nUHD # 620|73\nIris # 6200|73\nCorporation CoffeeLake-H GT2 [UHD # 630]|73\nUHD # 630 (Desktop)|73\nHD # ICL RVP|73\nUHD # 630|73\nHD # 630|72\nIris Pro|72\nKBL Unknown|72\nUHD # 630|72\nIris(TM) Pro # 5200|72\nHD # 530|72\nCorporation UHD # 630 (Desktop 9 Series)|72\nRadeon Pro Vega 16|72\nIris(TM) # 540|72\nIris(R) # 540|72\nUHD # 630|71\nHD # 630|71\nIris(TM) Pro # 5200|71\nUHD # 630|71\nIris Pro|71\nCometLake UHD # 630|71\nHD # 630|71\nUHD #|71\nIris(TM) Plus # 640|71\nUHD #|71\nCorporation UHD #|70\nIris Pro # 6200|70\nIris(R) # 540|70\n#|70\nUHD # 630|70\nHD # ICL RVP BigSur|70\nUHD # ReleaseInternal|70\nHD # 530|70\nUHD # 630|70\nUHD #|70\nUHD # gfx-driver-user-comp_core-23599|70\nUHD # 630|69\nUHD #|69\nIris(TM) Pro # 5200|69\nCorporation Iris Plus # G1 (Ice Lake)|69\nHD # 630|69\nHD # 630|69\nIris(R) Plus #|69\nIris(TM) Pro # 5200|69\nUHD # 620|69\nUHD #|69\nIris(R) Plus # 640|69\nIris Pro # 6200|69\nHD # 630|69\nUHD # 630 (Mobile)|68\nIris(TM) Pro # 5200|68\nCorporation UHD # 630 (Desktop)|68\nHD # 630|68\nUHD # 630|68\nUHD # 620|68\nUHD # 630|68\nIris(TM) Plus # 640|68\nUHD #|67\nIris Pro # 580|67\nIris(TM) # 540|67\nUHD # 620|67\nIris(TM) Pro # 5200|67\nUHD #|66\nHD # P530|66\nCorporation UHD # 630 (Mobile)|66\nIris(R) Plus # 640|66\nUHD # 630|66\nIris(R) Plus # 640|65\nHD # 630|65\nHD 530|65\nUHD # 620|65\nSKL Unknown|65\nHD # 630|64\nIris(TM) # 540|64\nMesa DRI Intel(R) UHD # 620 (Kabylake GT2)|64\nUHD # 630|64\nHD # 530|63\nHD # 530|63\nHD # 530|63\nMesa Intel(R) HD # 530 (SKL GT2)|63\nUHD #|63\nHD # 530|63\nIris # 550|63\nHD # 530|63\nIris Plus # 655|63\nHD # 630|63\nUHD #, Gen11 LP|63\nCorporation 8th Gen Core Processor Gaussian Mixture Model|63\nUHD # 630|63\nIris(TM) # 650|63\nIris(R) Plus # 640|62\nHD # 530|62\nMesa DRI Intel(R) Iris # 540 (Skylake GT3e)|62\nIris(R) Plus #|61\nIris(TM) Pro # 5200|61\nIris Pro|61\nHD # 620|61\nUHD # 620|61\nUHD # 630|61\nUHD #|61\nHD # 530|60\nIris Plus # G1|60\nIris(TM) Pro # 5200|60\nIris Plus # 650|60\nUHD #|60\nHD # 620|60\nUHD # 620|60\nUHD # 630|60\nMesa DRI Intel(R) HD # 630 (Kaby Lake GT2)|60\nUHD # 620|60\nHD # 630|60\nHD # 630|59\nIris # 540|59\nIris Plus # 640|59\nCoffeeLake-H GT2 [UHD # 630]|59\nHD # 630|59\nUHD #|59\nHD # 620|59\nUHD # 620|59\nHD # 630|59\nCorporation UHD # 620 (Whiskey Lake)|59\nIris(R) Plus # 650|59\nUHD # 620|59\nMesa Intel(R) HD # 520 (SKL GT2)|58\nHD # 630|58\nHD # P530|58\nIris(TM) Plus # 640|58\nCorporation HD # 630|58\nUHD # 620|58\nUHD # 630|58\nHD # P630|58\nMesa DRI Intel(R) UHD # 630 (Coffeelake 3x8 GT2)|58\nCorporation CometLake-S GT2 [UHD # 630]|58\nHD # 530|58\nIris # 540|58\nHD # 530|58\nCorporation Device|58\nHD # CFL CRB|57\nHD # 620 macOS Edition|57\nHD # 530|57\nMesa DRI Intel(R) HD # 520 (SKL GT2)|57\nIris Pro #|56\nIris(TM) Pro # 5200|56\nIris(R) Plus # 655|56\nCoffee Lake UHD #|56\nIris(TM) # 640|55\nIris Pro|55\nUHD # 630|55\nUHD # 620|55\nHD # 530|55\nHD # 520|54\nHD # 530|54\nUHD # 620|54\nHD # 530|54\nCorporation UHD # 620|54\nUHD #|54\nIris Plus # G7|54\nCorporation Skylake GT2 [HD # 520]|53\nUHD # 630|53\nHD # 630|53\nCorporation HD # 530|53\nUHD # 617|53\nHD # 520|52\nHD # 620|52\nHD # 620|52\nHD # 620|52\nHD # 620|52\nHD # 630|52\nHD # 630|52\nHD # 5600|51\nHD # 530|51\nHD # 630|51\nUHD # 615|51\nMesa DRI Intel(R) HD # 520 (Skylake GT2)|51\nHD # 630|50\nHD # 620|50\nUHD #|50\nHD # P4600/P4700|50\nHD # 520|50\nHD # 530|50\nHD # 620|50\nHD # 530|50\nCorporation HD # 620|50\nHD # 530|50\nUHD # 620|49\nUHD # 620|49\nHD # 530|49\nIris(TM) # 6100|49\nHD # 4600|49\nHD # 630|49\nUHD # 617|49\nUHD # RI|48\nHD # 520|48\nUHD # 617|48\nHD # 5600|48\nHD # 620|48\nUHD #, Gen11 LP|47\nUHD # 617|47\nMesa DRI Intel(R) HD # 620 (Kaby Lake GT2)|47\nHD # 615|47\nUHD # RI|47\nHD # 630|47\nHD # 4600|46\nHD # 520|46\nCorporation Skylake GT2 [HD # 520]|46\nHD # 520|46\nCorporation Device|46\nHD # 4600|46\nHD # 615|45\nHD # 4600|45\nIris(TM) # 6100|45\nHD # 615|45\nUHD # 615|45\nHD # 630 GT2|45\nHD # 4600|45\nHD # 630|45\nIris(TM) # 6100|45\nHD # 4600|45\nHD # 620|45\nIris(TM) # 6100|45\nHD # 520|45\nHD # 4600|45\nIris(TM) # 540|44\nHD # 530|44\nHD # 4600|44\nIris(TM) # 5100|44\nKabylake HD # ULT GT2|44\nIris # 6100|44\nUHD # 630|44\nHD # 520|44\nHD # KBL CRB|44\nHD # 530 (Skylake GT2)|44\nCorporation HD # 620|44\nHD # 515|44\nUHD #|44\nUHD # 620|44\nIris(TM) Pro # P580|43\nUHD # 615|43\nHD # 4600|43\nHD # 4600|43\nCorporation Skylake Integrated #|43\nHD # 530|43\nUHD # 615|43\nUHD # 630|43\nHD # 615|42\nHD # 620|42\nHD # 4600|42\nHD # 615|42\nHD # 4600|42\nHD # 4600|42\nMesa DRI Intel(R) Kabylake GT2|42\nHD # 620|42\nCorporation HD # 6000|42\nUHD # 615|42\nHD # 4600|41\nCorporation HD # 520|41\nHD # P4600/P4700|41\nCorporation, Series Chipset Iris Plus # 655|41\nHD # 4600|41\nMesa DRI Intel(R) HD # 530 (Skylake GT2)|41\nHD # 4600|41\nIris(TM) # 640|41\nHD # 4600|41\nHD # 630|40\nIris(TM) # 5100|40\nIris(TM) # 6100|40\nUHD # 610|40\nHD # 4600|40\nHD # 4600|40\nUHD # 615|40\nUHD # 610|40\nHD # 530|40\nUHD # 605|40\nHD # 615|40\nHD # 4600|40\nUHD # 615|40\nHD # 505|39\nPHDGD Ivy 4|39\nUnknown|39\nIris(TM) # 5100|39\nIris|39\nCorporation Iris # 6100|39\nHD # 6000|39\nIris(TM) # 5100|39\nHD # 615|39\nHD # 5500|39\nSkylake GT2 [HD # 520]|39\nCorporation Broadwell-U Integrated #|38\nHD # 615|38\nHD # 5500|38\nHD # 4600|38\nMesa DRI Intel(R) HD # P4000 (IVB GT2)|38\nHD # 4600|38\nHD # 615|38\nCorporation HD # 610|38\nHD # 4600|38\nHD # 4600|38\nIris(TM) # 5100|38\nIris # 6100|38\nHD # 515|38\nHD # 6000|38\nUHD #, Gen11 LP|38\nIris(TM) # 5100|38\nHD # 4600|37\nHD # 610|37\nHD # 4600|37\nHD # 515|37\nHD # 4600|37\nHD # 4600|37\nIris # P580|37\nIris(TM) Pro # P6300|37\nHD # 5500|37\nHD # 4600|37\nIris # 6100|37\nUHD # 610|37\nHD # 4600|37\nHD # 4600|37\nUHD # 610|37\nHD # 530|37\nHD # 5500|37\nHD # 515|36\nHD # P4600/P4700|36\nHD # 515|36\nHD # 4600|36\nUHD # 615|36\nIris # 6100|36\nHD # 4600|36\nHD # 4600|36\nHD # 4600|36\nHD # 520|36\nHD # 520|36\nHD # 5500|36\nCorporation HD # 5500|35\nIris|35\nHD5500 # PG7|35\nHD # 515|35\nIris|35\n# gfx-driver-user-feature_dg1_poweron-27723 DCH ReleaseInternal|35\nHD # 615|35\nHD # P630|35\nHD # 510|35\nHD # 6000|35\nHD # 5000|35\nCorporation HD # 5300|35\nHD # 6000|35\nHD # 4600|35\nHD5500 Broadwell PG7|35\n# HD 4600|35\nHD # 6000|35\nHD # 510|34\nHD # 610|34\nHD # 4600|34\nHD # Family (PHDGD Skylake v2.9)|34\nCorporation Device|34\nHD # 610|34\nUHD # 610|34\nHD # 5300|34\nHD # 5000|34\nHD # 4600|34\nUHD # 610|33\nHD # 4600|33\nUHD # 620|33\nCorporation UHD # 615|33\nHD # 5000|33\nKabylake HD # ULX GT2|33\nHD # 620|33\nUHD # 615|33\nHD # 4600|33\nHD # 5500|33\nHD # 515|33\nUHD #|33\nHD # 4600|33\nHD # 520|33\nHD # 6000|33\nHD # 615|33\nHD # KBL CRB|33\nHD # 4600|33\nUHD # 610|33\nIris # 6100|33\nHD # 515|33\nIris|32\nIris|32\nHD # 5000|32\nIris|32\nHD # 5000|32\nIris(TM) # 5100|32\nHD # 4600|32\nHD # 4600|32\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|32\nHD # 5500 (PHDGD Skylake v2.9)|32\nHD # 610|32\nHD # 6000|31\nHD # 5500|31\nIris|31\nHD # 6000|31\nUHD # 610|31\nHD # 510|31\nHD #|31\nHD # 6000|31\nHD # 4400|31\nHD # 5000|31\nHD # 4600|30\nHD # 515|30\nHD # 5600|30\nHD # 4600|30\nHD # 4400|30\nHD # 530|30\nGeForce GTX 960|30\nUHD # 610|30\nGeForce GTX 960|30\nHD # 510|30\nHD # 6000|30\nCorporation HD # 515|30\nHD # 610|29\nHD # 510|29\nHD # 5000|29\nHD # 4600|29\nIris(TM) Pro # 6200|29\nHD # 510|29\nHD # 5000|29\nHD # 6000|29\nIris|29\nHD # 4400|29\nHD # 4400|29\nHD # 4000|29\nHD # 510|29\nHD # 5000|29\nHD # 4400|28\nHD # 610|28\nHD # 5300|28\nHD # 510|28\nHD #|28\nHD # 610|28\nHD # 4400|28\nHD # 610|28\nHD # 4600|28\nHD # 4600|28\nHD # 5000|28\nHD # 4400|28\nHD # 4400|28\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|28\nHD # 4400|28\nHD # 5300|28\nHD # 5000|28\nUHD # 605|28\nHD # 4400|28\nHD # 5500|28\nHD # 4000|28\nHD # 4400|27\nHD # 615|27\nHD # Family(PHDGD Skylake v2.0)|27\nHD # 4400|27\nHD # 4400|27\nHD # 610|27\nCorporation HD # 510|27\nIris|27\nHD # 520|27\nHD # 5000|27\nHD # 5300|27\nHD # 6000|27\nHD # 4000|27\nHD # 610|27\nHD # 5000|27\nHD # 4600|27\nMesa DRI Intel(R) HD # 505 (Broxton)|27\nHD # 5500|27\nHD #|27\nHD # 5000|26\nUHD # 600|26\nHD # 4600|26\nMesa DRI Intel(R) Haswell Mobile|26\nHD # 4000|26\nHD # 5300|26\nIris(TM) # 540|26\nHD # 4000|26\nHD # 4600|26\nHD #|26\nHD # 4400|26\nHD # 4600|26\nHD # 6000|26\nCorporation Celeron N3350/Pentium N4200/Atom E3900 Series Integrated # Controller|26\nHD # 530|26\nHD # 5500|25\nBroxton-P HD #|25\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|25\nHD 4000|25\nHD # 4400|25\nHD # 4600|25\nHD # 5500|25\nHD 4000|25\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|25\nCorporation HD #|25\nHD # 4400|25\nMesa DRI Intel(R) HD # 5500 (Broadwell GT2)|25\nHD # 4400|25\nHD #|25\nUHD # 600|24\nArc(TM) #|24\nHD # 4600|24\nHD # 5300|24\nHD # 4400|24\nHD # 4400|24\nHD # 4400|24\nHD # 4000|24\nUHD # 605|24\nHD # 5000|23\nCorporation Xeon E3-1200 v2/3rd Gen Core processor # Controller|23\nUHD #, LKF|23\nUHD # 605|23\nHD # 4400|23\nHD # 4400|23\nHD # 4000|23\nHD # 4400|23\nMesa DRI Intel(R) Ivybridge Desktop|23\n0x496e74656c2048442047726170686963000732034343|23\nHD # 5300|22\nHD # 615|22\nKabylake HD # ULX GT2|22\nHD # 5300|22\nHD #|22\nHD #|22\nHD # 4000|22\nHD #|22\nHD # 515|22\nHD #|22\nHD # 5300|22\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|22\nHD # 5300|22\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|22\nHD # 4000|21\nUHD # 605|21\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|21\nHD # 4400|21\nHD #|21\nHD # 4400|21\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|21\nHD #|21\nHD # 5300|21\nHD # 4400|21\nHD # 5300|21\nHD # P4600/P4700|21\nHD #|21\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|21\nCorporation UHD # 605|20\nUHD # 600|20\nHD # 4000|20\nHD #|20\nUHD # 600 Universal|20\nHD # 4600|20\nHD # 500|20\nUHD # 600|20\nHD #|20\nHD # 5000|20\nHD # 4400|20\nHD # 5300|19\nHD # 4000|19\nMesa DRI Intel(R) Sandybridge Mobile|19\nHD # 505|19\nHD # 4000|19\nHD # 4400|19\nUHD # 600|19\nHD # 3000|19\nHD # 615|19\nHD #|19\nCorporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series Integrated # Controller|19\nHD # 4000|19\nHD #|19\nUHD # 600|19\nHD #|19\nCorporation Haswell-ULT Integrated # Controller|19\nHD # 4400|19\nCorporation GeminiLake [UHD # 600]|19\nHD # 4000|18\nHD #|18\nHD #|18\nHD # 500|18\nHD # 4000|18\nCherryView HD #|17\nCorporation Xeon E3-1200 v2/3rd Gen Core processor # Controller|17\nXeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|17\nCorporation Xeon E3-1200 v3/4th Gen Core Processor Integrated # Controller|17\nUHD # 600|17\nUHD # 600|17\nCorporation Xeon E3-1200 v2/3rd Gen Core processor # Controller|16\nHD #|16\nUHD # 600|16\nHD #|16\nHD # 5000 (Android)|16\nHD #|16\nUHD # 600|16\nHD #|16\nHD #, Gen10|16\nHD # (PHDGD IvyDrive 3.0)|16\nHD #|15\nUHD # 600|15\nCorporation Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated # Controller|15\nHD # 500|15\nHD # 505|15\nHD #|15\nCorporation 3rd Gen Core processor # Controller|15\nHD # 4400|15\nHD #|14\nHD #|14\nHD #|14\nHD # 505|14\nHD #|14\nHD #|14\nHD #|14\nHD #|13\nHD # 530|13\nHD # 500|13\nCorporation 3rd Gen Core processor # Controller|13\nHD # 4400|12\nHD # 5500|12\nHD #|12\nHD #|12\nCorporation HD # 500|12\nHD # 500|12\n3rd Gen Core processor # Controller|12\nHD #|11\nCorporation Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series PCI Configuration Registers|11\nCorporation 2nd Gen Core Processor Family Integrated # Controller|11\nHD # 510|11\nHD # 4600 (PHDGD Skylake v2.9)|9\nCorporation Atom Processor Z36xxx/Z37xxx Series # & Display|8\nCorporation Atom Processor Z36xxx/Z37xxx Series # & Display|8\nMesa DRI Intel(R) Bay Trail|8\nUHD #, Gen12 LP ReleaseInternal|5\nCorporation D3D12 (Intel(R) UHD # 630)|3\nHD # 3000|2\n(PE64) Intel(R) 4th Generation Haswell HD # Family|-1\n4 Series Internal Chipset|-1\n7 Series/C216 Chipset Family MEI Controller #1|-1\nB43 Express Chipset|-1\nCometLake-S GT2 [UHD # 630]|-1\nHD # 5500|-1\nHD # 620|-1\nG35 Express Chipset Family|-1\nG41 Express Chipset|-1\nG45/G43 Express Chipset|-1\n# Media Accelerator HD|-1\nHD # (PHDGD Omega 5.0)|-1\nHD # 4400|-1\nHD # P3000|-1\nHD # P3000 (PHDGD Omega 5.0)|-1\nIncrediblE HD # 3000|-1\nIris Pro # 5200|-1\nMesa DRI Intel(R) HD # (CHV)|-1\nMesa DRI Intel(R) Ivybridge Mobile|-1\nMobile Intel(R) 4 Series Express Chipset Family|-1\nMobile Intel(R) 965 Express Chipset Family|-1\nMobile Intel(R) HD #|-1\nPHDGD Quantic C3|-1\nQ45/Q43 Express Chipset|-1\nRadeong 0.4 on AMD CAPE VERDE (DRM 2.43.0, LLVM 3.7.0)|-1\nRadeong 0.4 on AMD CAPE VERDE (DRM 3.9.0 / 4.9.0-rc1+, LLVM 4.0.0)|-1\nRadeong 0.4 on AMD FIJI (DRM 3.2.0 / 4.7.0-rc5+, LLVM 4.0.0)|-1\nUHD #, Gen12 LP ReleaseInternal|-1",m="\n$ % 4090|1950\n$ % 4090 Laptop GPU|1790\n$ % 4070 Ti|1520\n$ % 3090 Ti|1465\n$ % 4080|1430\n$ % 4060 Laptop GPU|1410\n$ % 3080 Ti Laptop GPU|1390\n$ % 3080|1325\n$ % 3080 Ti|1300\n% A5500 Laptop GPU|1240\n$ % 3090|1235\n$ % 3070 Ti|1230\n$ % 3070|1230\n$ % 3060 Ti|1160\n$ % 3080 Laptop GPU|1140\n% A4000 Laptop GPU|1130\n$ % 2080 Ti|1120\n$ % 3070 Laptop GPU|1080\nTITAN V|1070\n$ % 2080 SUPER|1060\nQuadro % 8000|1050\n% A6000|1050\nTITAN %|1050\n$ % 3070 Ti Laptop GPU|1030\n% A5000 Laptop GPU|1030\n$ % 4090 Laptop GPU|1020\n$ % 3060|1015\nTITAN X (Pascal)|1010\nTITAN Xp|995\n$ & 1080 Ti|990\n$ % 4070 Laptop GPU|990\n$ % 4090|980\n$ % 2070 SUPER|980\n$ % 4080|975\n$ % 3060|970\n$ % 2080|970\n$ % 4080 Laptop GPU|970\n$ % 3060 Laptop GPU|910\n$ % 2060 SUPER|890\n$ % 4060 Laptop GPU|880\n$ % 2070|880\n$ % 2080 Super with Max-Q Design|870\n$ % 2080 with Max-Q Design|870\nQuadro % 5000|870\n$ % 3080 Ti Laptop GPU|860\nQuadro % 5000 with Max-Q Design|840\nAsus $ & 1080|840\n$ & 1080|840\n$ % 2070 Super with Max-Q Design|840\n% A3000 Laptop GPU|835\nQuadro % 4000 with Max-Q Design|830\n$ % 3070 Ti Laptop GPU|830\nQuadro % 4000|820\n% A6000|810\n$ & 1070 Ti|785\n$ % 4070 Ti|784\n$ % 4050 Laptop GPU|784\n% A5500 Laptop GPU|780\nTITAN Xp COLLECTORS EDITION|770\n$ % 2070 with Max-Q Design|765\n$ % 3050|760\n$ % 2060|760\n$ & 980 Ti|755\nQuadro P6000|750\n$ & 1080|750\nQuadro % 6000|744\n$ & 1070|740\n% A4000|740\n$ % 3090|740\n$ % 3080 Ti|730\n$ & 1080 Ti|730\nQuadro P4200|710\n$ & 1080 with Max-Q Design|707\n$ % 3060 Lite Hash Rate|705\nEIZO MED-XN83|700\n$ % 3080 Ti|700\n$ & 1660 SUPER|700\nTITAN Xp|700\nEVGA $ & 1070|700\n$ % 3090 Ti|700\nQuadro GV100|695\nQuadro P4000|695\n$ & 1660 Ti|690\n$ % 3070 Ti|690\n% 6000 Ada Generation|690\n$ % 3070|690\nQuadro % 8000|685\n% A2000 12GB|680\n$ % 2080|680\n$ & TITAN X|680\nQuadro M6000 24GB|680\n$ & 1660 SUPER|670\nTITAN V|670\nQuadro % 3000|670\nGraphics Device|670\n% A5000|670\n$ % 3090|670\nTITAN Xp COLLECTORS EDITION|670\n$ & 1070 A17|670\n$ % 3080 Laptop GPU|667\n% A4500 Embedded GPU|660\n% A5000 Laptop GPU|660\n$ % 3080|660\n$ % 3050 Ti Laptop GPU|650\n$ & 1070 with Max-Q Design|650\n$ % 3060 Ti|650\nQuadro P4200 with Max-Q Design|650\n$ % 3080|650\n$ % 2080 SUPER|650\n$ & 1070 Ti|648\n$ & 1070 with MaxQ Design|642\n% A3000 Laptop GPU|641\n$ % 3070 Laptop GPU|641\n$ & 1070|640\nGA104GL [% A4000]|639\n$ & 980 Ti|637\n$ % 2070 Mobile / Max-Q Refresh|637\n% A4000 Laptop GPU|634\n$ % 3060|633\nMicrosoft Virtual Render Driver|633\n$ % 3050 Laptop GPU|631\n% A2000|629\n$ % 2070 Mobile / Max-Q|626\n$ % 3070|625\nQuadro P5000|625\nQuadro P4000|621\n$ % 3060 Laptop GPU|621\n$ % 2060 with Max-Q Design|618\nGV102|614\n$ % 2070 SUPER|612\n$ & 1660|606\n$ % 2070|604\n$ & 1660 Ti with Max-Q Design|601\n$ & TITAN X|598\n% A2000 8GB Laptop GPU|598\n$ & TITAN Xp|595\n$ & 980|593\n$ % 2080 SUPER|591\n& 1060 HL|589\nTesla T4|589\nGRID P4-1Q|585\n% A4000|581\n$ % 2080 Ti|577\n$ % 2080 Super with Max-Q Design|576\nQuadro % 4000 Mobile / Max-Q|576\nTU102 [TITAN %]|574\n$ & 1060 with Max-Q Design|571\n$ % 2070 SUPER|570\n$ & 1060 6GB|570\n$ % 2080 Mobile|568\n$ % 2060|568\nQuadro P3200|565\nP106-100|564\nGRID V100DX-1Q|564\n% A2000|562\n$ % 2080 Ti Rev. A|561\n$ % 2080 Rev. A|559\nGV100 [TITAN V]|557\n$ % 2080|556\n$ & 1650 SUPER|554\nP106-100 Custom|553\n$ % 2070 Super with Max-Q Design|553\nGV100|553\n$ % 2070 Mobile|550\nGP102 [TITAN X]|548\n% A2000 12GB|546\n$ & 1060 5GB|542\nMSI $ & 1060|542\n$ % 2060 SUPER|542\nGRID T4-1Q|539\nQuadro % 5000 Mobile / Max-Q|538\n$ % 3050|538\n$ & 1060 3GB|538\nQuadro % 5000 with Max-Q Design|537\nQuadro M6000|536\n% A2000 Laptop GPU|536\n$ & 1660 SUPER|533\nA10-2B|530\nTITAN X (Pascal)|530\nQuadro P5000|527\n$ % 2070|526\n$ & 1080|525\n$ % 2060 Mobile|524\nPNY $ & 980|524\n$ & 1080 Mobile|523\n$ % 2060 SUPER|520\n$ & 780 Ti|518\n% A4500|516\n$ % 2060 Rev. A|515\nMSI $ & 980|515\nQuadro P3200 with Max-Q Design|513\n$ % 2070 with Max-Q Design|513\n$ % 3050 Ti Laptop GPU|510\nQuadro % 3000 Mobile / Max-Q|509\n$ & 1660 SUPER|508\nQuadro % 4000|508\n$ & 1060|506\n$ % 2080 with Max-Q Design|505\n$ & 1080 Ti|505\n$ & 1660 Ti Rev. A|504\n$ & 1660 Ti Mobile|504\n$ % 3050 Laptop GPU|503\n$ % 2060|503\nQuadro % 4000 with Max-Q Design|500\nEIZO MED-XN83|499\n$ & 970|499\n$ & 1080|495\n$ & 1070 Ti|492\n$ & 980|491\nA100-PCIE-40GB|489\n$ & 1070|487\n$ & 1660 Ti|487\nQuadro P2200|485\n$ & TITAN Black|484\nTITAN Xp COLLECTORS EDITION|483\nTITAN %|482\nQuadro P5200|482\n$ & 1060 with Max-Q Design|480\n% A1000 Laptop GPU|479\n$ & 1060 6GB|479\nQuadro % 5000|475\nTITAN V|475\nGRID P100-4Q|474\nEVGA $ & 970|472\n$ & 1650 SUPER|471\n$ & 1650 Ti|470\nQuadro % 3000|470\nQuadro M5000|469\nQuadro % 3000 with Max-Q Design|468\n$ & 980 Ti|467\n$ & TITAN|467\nQuadro P4200|466\n$ & 1070 with Max-Q Design|466\nQuadro M5000|466\n$ & 1080 Ti|466\nTesla M60|462\n$ & 1660|457\n$ & 1660|455\n$ % 2050|453\n$ & 1060|453\n$ % 2060 with Max-Q Design|453\nQuadro P3200 with Max-Q Design|452\nQuadro P4000|450\n$ & 1060 3GB|449\n$ & 1070|448\n$ & 1060 6GB Rev. 2|447\nGigabyte $ & 780 Ti|447\nTITAN Xp|444\n$ & 980M|440\nA10-4Q|439\n$ & 1080 with Max-Q Design|437\n$ & 1650 SUPER|435\nQuadro P5000|435\nQuadro P3000|434\n% A6000|434\n$ & 1060 3GB|433\n$ & 1070 Ti|432\n$ & 780|432\n$ & 1060 Mobile|432\nGigabyte $ & 970|431\n$ & TITAN Z|431\nQuadro K6000|429\n$ & 1650|425\n$ & 970|421\nTesla K20m|420\nQuadro GV100|419\nQuadro P4000|419\nQuadro P3200|417\n& 1060 HL|415\n% A2000 Laptop GPU|415\n$ & 780 by St3Phl3|414\nP102-100|412\nT1200 Laptop GPU|412\n$ & 780 Ti|411\n$ & 1060 6GB|408\n$ & 1650 Ti with Max-Q Design|407\nQuadro T2000 with Max-Q Design|407\nQuadro P2000|406\nQuadro P2200|406\n$ % 2060 Max-Q|405\n$ & 1650 Ti Mobile|403\n$ & 1060 Mobile 6GB|403\n$ & 1060 with Max-Q Design|401\n$ & 980|398\n$ % 2070 Rev. A|397\n$ & TITAN X|397\nTesla T4|395\nQuadro P6000|394\n$ & 1060 3GB|394\nQuadro M5000|393\n$ & 1060 with Max-Q Design|392\nPNY $ & 970|392\nQuadro T2000|391\nQuadro T1000 with Max-Q Design|391\nGRID P40-8Q|390\n$ & 780 Rev. 2|389\nQuadro GP100|387\n$ & 980|387\nP104-100|387\n$ & 1650 Ti|386\nGRID P40-4Q|384\n$ & 780 Ti|383\nDevice|383\nTU117M|381\nQuadro P2000|380\nQuadro % 6000|379\n$ & 1070 Mobile|378\nQuadro T1000|377\n$ % 3070 Mobile / Max-Q|376\n$ & 1060|376\nGRID V100-1Q|375\n$ & 780 Rev. 2|372\n$ % 2050|370\n$ & 770|370\n$ & 970|368\n$ & 1650 Ti|368\nGRID T4-2B4|368\nAsus $ & 780|366\nP106-100|365\nQuadro % 8000|365\n$ & TITAN Black|365\nGRID RTX6000-2Q|365\n$ & TITAN Black|363\nQuadro M4000|363\n$ & 1060 6GB|362\nQuadro P5000|361\n$ & 1650|361\nQuadro M5500|361\n$ & 780|360\n$ & 780|360\n$ & 980M|358\n$ & 1650|358\n$ & 1050 Ti|357\nQuadro P3200 Mobile|357\n$ & 1650 with Max-Q Design|356\nTesla T4|356\nQuadro P2000|356\n$ & TITAN|355\n$ & 970|355\n$ & 980 Ti|354\n$ & 1660 Ti with Max-Q Design|354\n$ & 780 Rev. 2|352\nGRID P4-4Q|351\n$ & TITAN X|351\nT1200 Laptop GPU|350\nGRID T4-8Q|350\n$ & 1060|349\n$ & 1050 Ti with Max-Q Design|348\n$ & 970M|346\nT1000 8GB|346\n$ % 3080 Mobile / Max-Q 8GB/16GB|346\n$ & 780 Ti|346\n$ & 680|346\n$ & 1660 Ti|345\n$ & 780|345\nQuadro M6000|344\nGRID T4-16Q|344\n$ % 2080 Ti|344\nGRID T4-1B|343\nQuadro K5200|342\nQuadro P2200|341\nT1000 8GB|341\nTesla K80|341\nQuadro T2000 Mobile / Max-Q|338\nTU107|337\n$ & 780 Mac|336\n$ & TITAN|336\n$ & 980M|335\nGRID P40-2Q|335\nEVGA $ & 780|334\n$ & TITAN Z|334\nTITAN X (Pascal)|332\n$ & 960|331\nTesla P40|331\n$ & 1650 Ti with Max-Q Design|330\nTesla P40|330\n$ & 1060se 3GB|329\n$ & 1650 Mobile / Max-Q|329\nQuadro T2000 with Max-Q Design|328\nT1000|327\n% A5500|326\nA40-8Q|326\n$ % 3060 Mobile / Max-Q|326\n$ & 690|326\nTesla V100-SXM2-16GB|326\nQuadro M5000|325\nA16-2B|323\n$ & 1050 Ti with Max-Q Design|321\n$ & 1050 Ti Mobile|321\n$ & 980M|319\nQuadro M3000M|318\n$ & 1650 with Max-Q Design|318\n$ & 670|316\nQuadro P3000|316\nT600 Laptop GPU|315\nQuadro T1000 with Max-Q Design|313\nTesla K80|312\nTesla K20m|311\n$ & 770|311\nTesla P100-PCIE-16GB|311\nQuadro M5000M|311\nTesla K80|309\nEVGA $ & 1070|309\nQuadro T1000|309\n$ & 1050 Ti|309\n$ & TITAN Z|308\nQuadro T2000|308\nQuadro M6000 24GB|308\n$ & 760 Ti|308\n$ % 2080 SUPER Mobile / Max-Q|308\n$ & 1050 Ti|307\nQuadro P2000|304\nQuadro P6000|304\n$ & 770 Mac Edition|303\nMSi $ & 1050 Ti|303\nA40|303\nT600|303\nP106-090|302\nP106-090|301\nQuadro K5200|300\n$ & 770|299\n$ & 680|299\n$ & TITAN|299\n$ & 680|297\nGRID M60-4Q|296\nQuadro M4000|296\nGRID M60-2Q|295\n$ & 760|294\nGRID V100DX-16Q|293\nQuadro % 6000/8000|293\n$ & 770|293\nGP104|292\n$ & 780 Rev. 2|290\n$ & 1050 Ti|288\n$ & 950|288\nEVGA $ & 1050 Ti|288\n$ & 1650 with Max-Q Design|286\n$ & 880M|285\n%NVIDIA_DEV.13D7.0580.1028%|283\nGP104GL|283\nGigabyte $ & 960|282\nQuadro K5200|281\n$ & 660 Ti|281\n$ & 670|281\nQuadro M4000|280\n$ & 580|280\nMSi $ & 960|280\nTesla M6|278\nPNY $ & 680|278\nT500|277\n$ & 1050|276\n$ & 1050 Ti with Max-Q Design|276\n$ & 690|276\n$ & 680|276\n$ & 670|275\n$ & 760 Ti|274\n$ & 1050 3GB|272\n$ & 880M|272\nTesla M60|272\nAsus $ & 960|271\nQuadro M4000|269\nT600|268\nTesla K20m|268\n$ & 760|268\nGP102 [TITAN Xp]|267\n$ & 960|267\n$ & 670|265\nQuadro T1000 Mobile|265\n$ & 1050|264\nTesla M60|264\nEVGA $ & 1080 Ti|263\n$ & 970M|263\n$ & 780M|262\n$ & 690|262\nAsus $ & 770|261\n$ & 1070 with MaxQ Design|261\nEVGA $ & 960|261\n$ & 960|260\nGRID T4-2Q|259\n$ & 970M|259\n$ & 960|259\nQuadro M3000M|258\n$ & 1060se 3GB|257\nTesla K10|257\nQuadro M3000M|257\nQuadro M2200|256\n$ & 690|255\n$ & 760|254\n$ & 880M|254\nQuadro K4200|253\nQuadro P2000 with Max-Q Design|253\nT550 Laptop GPU|253\nQuadro K5200|252\nMSI $ & 760|250\n$ & 580|249\n$ & 780M Mac Edition|249\n$ & 570|249\nTesla V100-PCIE-16GB|248\n$ GTX880M|248\n$ & 760|247\n$ & 570 Rev. 2|247\nAsus $ & 670|246\n$ & 580|246\n$ & 1050|245\nTesla P4|244\n$ & 680MX|244\n$ & 480|242\n$ & 1050|242\nQuadro 7000|241\nQuadro M4000M|241\n$ & 1050 Mobile|240\n$ & 660|240\n$ & 760 (192-bit)|239\nQuadro K5000|239\n$ & 760 OEM|238\n$ & 660 Ti|238\n$ & 775M Mac Edition|238\n$ & 965M|237\n$ & 870M|236\n$ & 950|236\n$ & 560 Ti 448 Cores|236\n$ & 780M|236\nQuadro P2000 with Max-Q Design|234\nMSI $ & 980 TI|234\nGRID K2|233\n$ & 1060 6GB OpenGL Engine|233\nPNY $ & 1060|233\nEVGA $ & 980|232\nGRID RTX6000P-6Q|232\n$ & 950|232\n$ & 950|232\n$ & 590|231\n$ & 1070 OpenGL Engine|231\nTITAN X (Pascal)|229\n$ & 1050 with Max-Q Design|229\n$ & TITAN Black|228\nQuadro K4200|227\n$ & 660 OEM|227\n$ MX450|225\n$ & 1050 with Max-Q Design|225\nQuadro P1000|225\nGraphics Device|225\nQuadro M2000|222\n$ & 1630|222\nQuadro M4000M|221\nQuadro K5100M|221\nEVGA $ & 760|221\n$ & 1070 Ti|221\n$ & 660 Ti|220\n$ & 570|220\n$ & 660 Ti|219\nQuadro K6000|219\n$ & 570 Rev. 2|219\n$ & 1050 with Max-Q Design|219\nTesla M40|218\n$ & 680M|217\n$ & 780M by Nick[D]vB|217\nAsus $ & 980 TI|217\n$ & 1060 3GB|217\nGraphics Device|217\n$ & 570 Rev. 2|216\n$ & 1060 3GB OpenGL Engine|216\n$ & 660|215\nPoint of View $ & 660 Ti|214\nGigabyte $ & 980|214\nQuadro K5000|213\nQuadro P1000|213\n$ & 480|213\n$ MX450|212\nQuadro K4200|211\nGRID K280Q|211\nAsus $ & 760|210\nQuadro P1000|210\n$ & 680MX|209\n$ & 1060 6GB|209\n$ & 660|209\n$ & 750 Ti|208\n$ & 780M Mac Edition|208\n$ & 775M Mac Edition|208\nGRID K520|208\nQuadro M2200|207\nGRID M60-8Q|207\nGRID K2|207\n$ & 775M Mac Edition|206\n$ & 560 Ti 448 Cores|205\n$ & 760 (192-bit)|205\nQuadro K5000|205\nGigabyte $ & 980 TI|204\n$ & 780M Mac Edition|204\nAsus $ & 660|204\nGRID M60-1B|202\n$ & 650 Ti BOOST|202\n$ & 480|202\n$ & 960M|201\n$ & 660 OEM|201\n$ & 780 Ti|201\nQuadro K5000|201\n$ & 780M Mac Edition|201\n$ & 870M|200\n$ & 680MX|200\n$ & 680MX|199\nQuadro P1000|198\nTesla P100 PCIe 16GB|198\nQuadro K5100M|198\n$ & 470|198\nQuadro P620|197\nAsus $ & 780|197\nQuadro 6000|196\nQuadro M1200|195\nQuadro K2200|195\n$ & 590|195\nQuadro M2000M|194\nQuadro M4000 OpenGL Engine|194\n$ & 870M|194\n$ & 1070|194\nEVGA $ & 750 Ti|194\nZotac $ & 680|193\nQuadro % 3000 with Max-Q Design|193\nT400|193\nQuadro M2200|193\nQuadro K4100M by nikey22|192\nGRID K2|192\n& 865M by iMacGFX|191\nQuadro M2000|191\n$ & 980M|190\n$ & 560 Ti|190\nPalit $ & 660|190\nGRID K260Q|189\nGRID M10-2Q|189\n$ & 660|189\n$ & 965M|189\n$ & 650 Ti BOOST|188\n$ & 675MX Mac Edition|188\nQuadro K5100M by nikey22|187\n$ & 680M|187\nZotac $ & 660|186\n$ & 650 Ti BOOST|186\n$ & 760 (192-bit)|185\nGRID M60-1Q|184\nGigabyte $ & 960|184\nQuadro M2000M Special Edition|184\n$ & 560 Ti|184\nInno3D $ GTX660|183\n$ & 1060|183\n$ & 675MX Mac Edition|182\nQuadro P600|181\n$ & 1080|181\n$ & 675MX Mac Edition|181\nQuadro P620|180\nGK104 Board - 20530501|180\nAshley|180\nQuadro M2000|179\n$ & 860M|179\nMSi $ & 1050 Ti|179\nAsus $ & 750 Ti|178\n$ & 750 Ti|178\n$ & 750 Ti|177\nEVGA $ & 980 TI|177\nAsus $ & 770|177\n$ & 760 OEM|176\n$ & 750|176\nQuadro P2000 Mobile|176\nQuadro K4100M|175\nT400 4GB|174\n$ & 1080 Ti OpenGL Engine|174\nQuadro K5000M|173\n$ & 960A|173\n$ & 560 Ti|172\nTesla M10|172\n$ & 1080 Ti|172\nGRID RTX6000P-6|172\nGK104 Board - 2051b502|172\n$ & 770M|172\n$ & 960M|172\n$ & 970|172\nGRID M10-2Q|171\n$ & 560 Ti OEM|171\nMSi $ & 970|171\nGK104GL [GRID K2]|171\n$ & 470|170\n$ & 560 Ti|170\nTITAN Xp|170\n$ & 870M|170\n$ MX350|169\nMSi $ & 580|169\n$ & 960M|169\nEVGA $ & 760|169\nQuadro K4000M|169\nT400|169\n$ MX350|168\n$ & 470|168\n$ & 560|167\nQuadro 6000|167\n$ & 1050 Ti OpenGL Engine|167\nQuadro M1200|167\nGigabyte $ & 970|166\n$ GT 1030|166\n$ GTX780M by nikey22|166\n$ GTX870M by nikey22|166\nTesla V100-PCIE-32GB|165\nQuadro K2200|165\nQuadro M1000M|165\nQuadro K2200|165\nAsus $ & 970|164\n$ & 750 Ti|164\nQuadro M2000M|164\n$ & 1050|164\n$ & 1050 Ti|163\nQuadro K5000|163\nGraphics Device|162\n$ MX250|162\nT500|161\nEVGA $ & 570|161\nQuadro M2000M|161\nQuadro K1200|159\n$ & 860M|159\n$ & 770M|159\nQuadro M1200|158\n$ & 675MX|158\n$ MX330|158\nQuadro K2200M|157\nQuadro K4000|157\n$ & 690|157\n$ & 860M|157\nMSi $ & 670|156\nQuadro K2200|156\nQuadro K4100M|156\n$ & 770M by Nick[D]vB|155\nTesla V100-SXM2-32GB|155\n$ & 1080 OpenGL Engine|155\nGigabyte $ & 670|155\nEVGA $ & 960|155\n$ & 750|155\n$ Pre-Release TITAN X (Pascal) OpenGL Engine|154\n$ & TITAN Xp|154\nAsus $ & 950|154\nQuadro K4100M|153\n$ & 960|153\n$ & 770M|153\n$ MX330|153\nQuadro M2200 Mobile|153\n$ MX250|153\n$ Pre-Release TITAN Xp OpenGL Engine|153\nQuadro P600|153\nQuadro M620|152\n$ & 1070 Ti OpenGL Engine|152\n$ & 770|152\n$ GT 1030|152\nTesla C2070|152\n$ & 650 Ti|152\nGRID K240Q|151\n$ & 480 OpenGL Engine|151\n$ & 750|151\n$ & TITAN|151\n$ & 760 (192-bit)|151\n$ & 560|151\n$ GT 1030|151\nQuadro K5000M|151\nQuadro P1000 Mobile|151\nZotac $ & 660|151\n$ & 460 v2|150\nGRID & P40-6|150\nMSi $ & 660|149\n$ & 780M|149\nMSI $ & 760|149\nP106-090|149\n$ & 950A|149\n$ MX150|149\nAsus $ & 1060|149\nUnknown|149\n$ & 980 Ti|148\nGRID T4-4Q|148\n$ & 465|147\nColorful $ & 960|147\nGigabyte $ & 750|147\nQuadro M1000M|147\n$ & 780 Mac|147\n$ & 460|146\nMSi $ & 960|146\n$ & 560|146\nQuadro K4000|145\n$ & 970M|145\nQuadro M1000M|145\nUnknown|145\n$ & 980|144\n$ & 950|144\n$ & 675M|144\nZotac $ & 960|144\n$ Pre-Release Graphics Device|144\n$ & 670 OpenGL Engine|143\nQuadro K4000|143\nEVGA $ & 580|143\n$ & 950M|143\n$ & TITAN Black OpenGL Engine|142\n$ & 760|142\nQuadro 5000|142\nMSI $ & 570 HD|142\n$ Pre-Release TITAN Xp COLLECTORS EDITION OpenGL E|142\n$ & 1050 OpenGL Engine|142\n$ & TITAN X|142\n$ & 880M|141\nGV-N660OC-2GD|141\n$ & 750|141\nQuadro M5000M|140\n$ & 970 OpenGL Engine|140\n$ & 675MX|140\nAsus $ & 760|140\nQuadro P5000 OpenGL Engine|139\n$ & 580|139\n$ & 675MX|139\nZotac $ & 750|139\nQuadro K1200|139\n$ MX150|139\n$ & 650 Ti|139\nQuadro K1200|139\n$ & 980 Ti OpenGL Engine|139\n$ & 580M|138\nAsus $ & 580|138\n$ & 770 OpenGL Engine|138\n$ GT 1010|138\n$ & 780 Rev. 2|138\nQuadro P2000 OpenGL Engine|138\n$ MX250|138\nQuadro K4000|137\n$ & 460 v2|137\n$ & 770M|137\nGigabyte $ & 570 HD|136\n$ & 465|136\n$ & 460 v2|136\n$ & 670|136\n$ & 590 OpenGL Engine|136\n$ & 780|135\n$ & TITAN Black|135\n$ & 660 Ti|135\nZotac $ & 560 Ti|134\n$ & 880M OpenGL Engine|134\n$ & 650 Ti|134\n$ & 760 OpenGL Engine|134\nnull Graphics Device|134\nQuadro M620|133\n$ & 780M Mac Edition|133\n$ MX150|132\nAsus $ & 570 HD|132\n$ & 775M OpenGL Engine|132\n$ & 850M|132\nAsus $ & 570|132\nQuadro K6000 OpenGL Engine|131\n$ & 850M|131\n$ & 460|131\n$ & 950A|130\n$ & 780M OpenGL Engine|130\nPoint of View $ & 660 Ti|130\n$ & 775M Mac Edition|130\nEVGA $ & 650 Ti|130\nEVGA $ & 750 Ti|129\n$ & 460|129\nQuadro P520|129\nGainward $ & 570|129\nAsus $ & 750 Ti|129\nQuadro K3100M|128\nQuadro K2200|128\nAsus $ & 560 Ti|127\n$ & 680|127\n$ & 680 OpenGL Engine|127\n$ & 950M|127\nGRID V100-2B|127\nGigabyte $ & 660 Ti|127\nN15E-GT|126\nQuadro K1200|126\n$ & 650 Ti|126\nGigabyte $ & 770|126\n$ & 660|126\nQuadro 5000|125\n$ GT 1030|125\n$ & 950M|125\n$ & 765M|125\nQuadro M5000|125\nGigabyte $ & 560 Ti|125\n$ & 580M|125\nQuadro M2000|124\n$ & 850M|124\n$ & 570 OpenGL Engine|123\nGainward $ & 750 Ti|123\nQuadro K2200M|123\n$ & 780M Mac Edition|123\n$ & 680MX OpenGL Engine|123\nQuadro K4200|123\n$ & 460 OEM|122\n$ & 670MX|122\nMSi $ & 560 Ti|122\n$ & 460 SE|122\nQuadro M4000|122\n$ GTX880M OpenGL Engine|122\nQuadro P620|121\n$ & 560 SE|121\n$ GTX880M by nikey22|121\n$ & 555|121\n$ & 965M OpenGL Engine|121\n$ & 850A|121\nQuadro K5000 OpenGL Engine|120\n$ & 580 OpenGL Engine|120\nQuadro K3100M|120\n$ & 650 Ti BOOST|119\n$ & 570M|119\n$ & 675MX OpenGL Engine|119\n$ & 775M Mac Edition|119\nZotac $ & 1050 Ti|118\n$ & 965M|117\nQuadro M600M|117\n$ & 780M by Nick[D]vB|117\n$ & 460 SE|117\n$ & 555|116\n$ & 670M|116\nQuadro K3000M|116\n$ & 780 Ti OpenGL Engine|116\nQuadro K4000M|115\n$ & 860M|115\nAsus $ & 660|115\nTesla C2075|114\n$ & 675MX Mac Edition|114\nZotac $ & 770|114\nGigabyte $ & 750 Ti|114\n$ MX330|114\n$ GT 1030|113\n$ & TITAN OpenGL Engine|113\n$ & 590|113\nQuadro K620|113\n$ & 780M|112\n$ & 560 Ti|112\nQuadro 6000|112\nEVGA $ & 560 Ti|112\nAsus $ & 960|112\nQuadro K5000|112\nPoint of View $ & 470|111\nPNY $ & 580|111\n$ & 770M|111\n$ GT 120|111\nMSi $ & 660|111\nGigabyte $ & 560|111\n$ & 680MX|110\n$ 945M|110\n$ & 765M|110\n$ & 950 OpenGL Engine|110\n$ Pre-Release Tesla C2075 OpenGL Engine|109\n$ & 550 Ti|109\n$ & 765M|108\nPNY $ & 750|108\n$ & 560 Ti 448 Cores|108\nQuadro P500|108\n$ & 670MX|108\n$ & 680MX|107\n$ & 460 SE|107\n$ & 675MX Mac Edition|107\n$ & 770M OpenGL Engine|107\n$ 945M|107\n$ & 675MX|107\nPNY $ & 570 HD|106\n$ & 745|106\n$ MX230|106\n$ & 670MX|106\n$ 845M|106\nQuadro K3100M OpenGL Engine|105\nQuadro P2000|105\n$ MX570 A|105\n$ & 750 Ti|104\n$ & 660 OEM|104\nQuadro M600M|104\n$ & 750|104\n$ & 645|104\nGP108|104\nQuadro P520|104\nZotac $ & 460|103\nChip Model|103\n$ & 670M|103\nQuadro T1000|103\n$ & 670M|103\n$ & 650|103\nZotac $ & 750|102\n$ & 460 OpenGL Engine|102\n$ & 860M OpenGL Engine|102\nQuadro 4000|102\nAsus $ & 480|102\nZotac $ & 650 Ti|102\n$ GT 755M|101\nGF100 Board - 10220000|101\n$ & 470M|101\n$ & 570 Rev. 2|101\n$ & 775M by iDopt Mac|101\n$ & 765M by Nick[D]vB|101\n$ & 570|101\n$ & 645|101\n$ & 550 Ti|100\n$ & 760M|100\n$ GT 1030 OpenGL Engine|100\n$ & 650|100\nQuadro P400|100\n$ & 480|99\nEVGA $ & 650|99\nEVGA $ & 560|99\n$ MX130|99\n$ MX130|98\nAsus $ & 460|98\nElitegroup $ & 460|98\nTesla V100-SXM2-32GB|98\n$ GT 755M|98\n$ & 760 Ti OpenGL Engine|98\nQuadro P520|97\n$ GT 755M Mac Edition|97\n$ & 1060 5GB|97\nPalit $ & 650 Ti|97\nMSi $ & 460|96\n$ & 650|96\nGigabyte $ & 580|96\nGigabyte $ & 460|96\n$ & 745|96\nEVGA $ & 550 Ti|96\n$ & 465|96\n$ & 460 SE|96\n$ & 765M|96\n$ GT 755M Mac Edition|96\nQuadro M520|95\nQuadro K620|95\nT1000|95\n$ & 745|95\nQuadro K620|95\n$ GT 755M|94\n$ & 660 Ti OpenGL Engine|94\nQuadro K3000M|94\nQuadro K4000|94\nQuadro K4000 OpenGL Engine|94\n$ & 560|94\n$ & 650 Ti OpenGL Engine|94\nZotac $ & 560|94\nAsus $ & 560|93\n$ & 650 Ti|93\n$ GPU|92\n$ & 460|92\nMSi $ & 650 Ti|92\n$ & 645|92\nGigabyte $ & 760|92\n$ & 660M|92\n$ GTS 450|92\n$ & 765M|92\nQuadro K2000D|92\nQuadro K2000|91\n$ GT 740|91\n$ & 650|91\nGRID M6-0B|91\nHP Quadro K620|91\n$ MX130|91\nQuadro K3000M by ST3PHL3|91\nQuadro 4000|90\n$ MX230|90\nQuadro K620|90\nQuadro K2100M by Nick[D]vB|90\nQuadro K3000M by nikey22|89\n$ GT 650M OpenGL Engine|89\nQuadro 4000|89\nQuadro K3000M|88\n$ & 660M|88\nQuadro K6000|87\n$ GT 755M Mac Edition|87\nPalit $ & 650|87\nQuadro P500|87\n$ & 570M|86\nGainward $ & 460|86\n$ & 950M|86\nQuadro K2000D|86\n$ & 650 Ti BOOST|86\nQuadro K2100M|86\n$ & 470|85\nQuadro K2000|85\nQuadro K2000|85\n$ GT 750M Mac Edition|85\n$ & 745|85\nGRID K220Q|85\n$ & 750 OpenGL Engine|85\nQuadro 5000M|84\nQuadro P400|84\n$ GTS 450|84\n$ GT 640 Rev. 2|84\n$ & 660M Mac Edition|84\nQuadro P400|84\nAsus $ & 560 SE|84\nPNY $ & 460|83\n$ GT 640 Rev. 2|83\n$ GTS 450 Rev. 2|83\n$ GTS 450|83\n$ GTS 450 Rev. 2|83\n$ & 645|82\n$ GPU|82\n$ & 560M|82\nQuadro K3000M|82\nQuadro K2100M by nikey22|82\nGigabyte $ & 750|82\n$ GT 740|82\n$ GT 750M Mac Edition|82\n$ & 765M OpenGL Engine|82\n$ & 645 OpenGL Engine|82\nQuadro K620|81\n$ & 550 Ti OpenGL Engine|81\nQuadro 4000M|81\nPNY $ & 550 Ti|81\n$ MX110|80\n$ & 760M|80\nMSi $ & 745|80\nQuadro K2100M OpenGL Engine|80\nQuadro K2000|80\nQuadro 5000|80\nQuadro K620 OpenGL Engine|80\nMSi $ & 745|80\n$ GT 755M OpenGL Engine|80\n$ & 660M|79\nGigabyte $ & 550 Ti|79\nMSi $ & 650|79\n$ & 560M|79\nQuadro P400|78\nQuadro K2100M|78\nQuadro K2100M|78\nZotac $ & 1050 Ti|78\nQuadro 3000M|77\n$ 940A|77\n$ & 460M|77\n$ & 550 Ti|77\n$ GT 545|77\n$ GT 650M Mac Edition|77\n$ 940MX|76\n$ & 650 OEM|76\n$ & 550 Ti|76\n$ GT 755M Mac Edition|76\n$ GT 740 OpenGL Engine|75\nGainward $ & 550 Ti|75\nQuadro K1200|75\n$ GT 650M Mac Edition|75\nEVGA $ & 650|75\n$ GT 750M Mac Edition|74\n$ & 745|73\n$ & 555|73\n$ & 650|73\nGainward $ GTS 450|73\n$ GT 650M|73\n$ GT 755M Mac Edition|73\n$ & 460M|72\n$ 930A|72\n$ 930MX|72\n$ 940MX|72\n$ MX110|72\n$ GT 750M Mac Edition|72\nQuadro 2000|72\n$ 845M|71\nQuadro 2000D|71\n$ GT 640 Rev. 2|71\n$ MX110|71\n$ GT 1010|71\n$ GT 545|71\nQuadro K1200 OpenGL Engine|71\n$ 940MX|71\n$ & 650 OpenGL Engine|71\nEVGA $ & 650 Ti BOOST|71\nQuadro K2100M|70\n$ GT 1010|70\nQuadro M500M|70\n$ GT 650M Mac Edition|70\n$ GT 640 OEM|70\nQuadro K2000D|70\nQuadro K2000 OpenGL Engine|70\n$ GT 750M Mac Edition|70\n$ GT 650M|69\nQuadro K1100M by Nick[D]vB|69\n$ GT 650M|69\n$ 940M|69\n$ GT 650M|69\nQuadro 4000|69\n$ GT 650M Mac Edition|69\n$ GT 745M|69\nGainward $ & 560 Ti|68\n$ 920MX|68\nQuadro M520|68\n$ GT 640|68\n$ 840M|68\n$ 9800 & / 9800 &+|68\n$ & 770M by Nick[D]vB|67\nZotac $ & 650|67\nAsus $ & 550 Ti|67\n$ GT 750M|67\nQuadro K3100M by nikey22|67\n$ GT 750M|67\n$ & 760 (192-bit) OpenGL Engine|67\nHP Quadro 4000|67\nQuadro K2000|67\n$ GTS 450 Rev. 2|67\n$ 930MX|67\n$ & 660M Mac Edition|66\n$ & 570|66\n$ GT 750M|66\n$ GT 650M Mac Edition|66\n$ GT 650M OpenGL Engine|65\n$ & 660M OpenGL Engine|65\n$ 930M|65\nPalit $ & 650|65\n$ & 760M|65\n$ GT 650M Mac Edition|65\n$ 940M|65\n$ GT 750M Mac Edition|64\n$ 940M|64\n$ GT 740|63\n$ 930MX|63\nQuadro 3000M|63\n$ GT 730|63\nQuadro K1100M|63\n$ GT 750M|63\n$ 840M|63\n$ GT 640 OEM|63\n$ 840M|63\n$ GT 640 Rev. 2|62\n$ GTS 450|62\nQuadro 2000|62\n$ GT 745M|62\n$ GT 740|62\n$ GT 640|62\nQuadro 2000|62\n$ & 660M Mac Edition|62\nQuadro K1100M OpenGL Engine|62\nQuadro K2000M|62\n$ & 680MX OpenGL Engine|61\nEVGA $ GT 730|61\nQuadro 2000D|61\n$ 840A|61\nMSi $ & 660 Ti|61\nQuadro K1100M|61\n$ GT 645M|61\n$ & 780M OpenGL Engine|61\nHP $ GT 730|61\nQuadro K5000M OpenGL Engine|61\nEVGA $ GT 640|61\n$ 920MX|60\nQuadro M500M|60\nQuadro K620M|60\n$ 930M|60\n$ 930A|60\n$ GT 640 OEM|60\n$ GT 640|60\nQuadro 2000M|60\n$ GT 640|60\n$ GT 640M Mac Edition|60\n$ GT 640M Mac Edition|60\n$ GT 640M Mac Edition|59\n$ GT 645M|59\n$ 930M|59\nGigabyte $ & 650 Ti|59\n$ GT 640 OEM|59\n$ 830M|59\nAsus $ GT 640|58\nMSI $ & 1070|58\n$ GT 555M|58\nQuadro K2000M|58\nQuadro K1100M|57\n$ GT 650M Mac Edition|57\nQuadro K2000M by Nick[D]vB|57\nEVGA $ & 650 Ti|57\n$ GT 640M|56\n$ GT 650M Mac Edition|56\n$ GT 445M|56\n$ 830A|56\n$ 9800 GT|56\nAsus $ GTS 450|55\n$ 830M|55\n$ 920MX|55\nQuadro 2000|55\nEVGA $ GT 545|54\nQuadro K2000M|54\n$ GT 650M Mac Edition|54\n$ & 280|54\n$ GT 640|53\nQuadro FX 2800M|53\nQuadro 3000M OpenGL Engine|53\n$ GT 740|53\nnull $ 920A|53\n$ GT 640M Mac Edition|52\n$ GT 635|52\nGraphics Device|52\n$ GT 640M|52\n$ & 660M Mac Edition|52\nQuadro 2000M|52\nQuadro 5010M|52\n$ GTS 250|52\n$ GT 445M|51\n$ GT 640M OpenGL Engine|51\n$ GT 640M|50\nEVGA $ GT 740|50\n$ GT 640M Mac Edition|50\n$ 730A|50\n$ 920M|49\nHP Quadro 2000|49\n$ GT 730M|49\nnull $ 920A|49\n$ GT 555M|49\n$ GT 640M LE|49\n$ GT 730M|49\n$ GT 730M|48\n$ GT 640M Mac Edition|48\nQuadro K2000M OpenGL Engine|48\n$ GT 640M LE|48\n$ GT 740M|47\n$ & 460M|47\n$ GT 440|47\n$ GT 440|46\n$ GT 640M Mac Edition|46\nQuadro P400|46\n$ GT 730|46\nDell Quadro 2000M|45\n$ GT 740M|45\n$ GT 740M|45\n$ GTS 450 Rev. 2|45\n$ 920M|45\n$ 920M|45\n$ 910M|44\n$ & 680M|44\n$ GT 730|44\nQuadro 2000M|44\n$ GT 635|43\n$ GT 720 OpenGL Engine|43\n$ GT 635|43\nQuadro K5200 OpenGL Engine|43\nZotac $ & 650|43\n$ GT 440|43\n$ GT 435M|42\n$ GT 735M|42\nGainward $ GT 630|42\nQuadro 1000M|42\n$ 820M|41\n$ & 680M OpenGL Engine|41\nMSI $ GT 635|41\n$ 820A|41\nTesla M10|41\nAsus $ GT 440|40\nAsus $ GT 630|40\n$ GT 820M|40\n$ 910M|40\n$ GT 820M|40\n$ GT 730|40\n$ GT 550M|40\n$ GT 430|40\n$ GT 540M|39\nAsus $ GT 720|39\n$ GT 630|39\n$ GT 530|39\n$ GT 635M|39\n$ GT 620M/630M/635M/640M LE|39\nNVS 5400M|39\nQuadro K600|39\nQuadro K610M|39\nAsus $ GT 730|39\n$ GT 630|39\n$ GT 440|39\n$ GT 630M|38\n$ 820M|38\nQuadro K420|38\nQuadro K610M|38\n$ GT 625M|38\nQuadro K1000M|38\nNVS 5200M|38\nGRID K1|38\nQuadro K600|38\nQuadro K420|38\n$ GT 630|38\nQuadro K600|37\nQuadro 600|37\nHP Quadro 600|37\nQuadro K1000M|37\nQuadro K610M|37\nGRID K180Q|37\nGRID K160Q|37\n$ GT 635M|37\nGigabyte $ GT 440|37\n$ 820M|37\n$ GT 530|37\n$ GT 540M|37\n$ GT 630 OEM|37\nQuadro K610M by Nick[D]vB|37\nNVS 510|37\n$ GT 630M|37\nQuadro 1000M|37\n$ GT 540M|37\n$ GT 530|37\nQuadro K1100M|37\nQuadro K620M|37\nQuadro 1000M|36\n$ GT 730|36\n$ 820M|36\n$ GT 430|36\nGRID K1|36\n$ GT 525M|36\nNVS 5200M|36\nNVS 510|36\nZotac $ GT 430|36\nQuadro K600|36\nAsus $ GT 730|36\nHP Quadro K4000|35\n$ GT 755M Mac Edition|35\n$ GT 630|35\nNVS 5400M|35\nNVS 5400M|35\n$ GT 640 OpenGL Engine|35\n$ GT 625M|35\n$ GT 630|35\n$ GT 430|35\nQuadro K600 OpenGL Engine|35\nQuadro K1000M|35\nZotac $ GT 630|35\nGigabyte $ GT 630|35\nGRID K140Q vGPU|35\n$ GT 710M|35\n$ GT 620M|35\n$ GT 720M|34\n$ 710M|34\nQuadro 1000M,|34\nQuadro K510M|34\n$ 9400 GT|34\nQuadro K1000M|34\n$ GT 635M|34\nQuadro K420|34\nGRID K180Q|34\nAsus $ GT 430|34\nQuadro K4100M|34\nGigabyte $ GT 730|34\n$ GT 620M|34\n$ GT 525M|34\nQuadro K420|34\nDell NVS 5200M|34\n$ 710A|34\n$ GT 425M|33\n$ GT 710B|33\n$ GT 525M|33\nQuadro 600|33\n$ GT 620M|33\nQuadro K600|33\nQuadro 600|33\n$ 610M/710M/810M/820M / GT 620M/625M/630M/720M|33\nMSI $ GT 730|33\n$ GT 710|33\n$ GT 435M|33\nNVS 510|33\nAsus $ GT 710|33\nNVS 510|32\n$ 710M|32\n$ GT 720M|32\n$ GT 730A|32\n$ GT 710M|32\nGIGABYTE $ & 660|31\nEVGA $ GT 710|31\n$ GT 710|31\n$ GT 710|31\n$ GT 425M|31\n$ GT 720|31\nEVGA $ GT 710|31\nQuadro K1000M by Nick[D]vB|31\nAsus $ GT 710|31\n$ GT 720|31\n$ GT 420M|30\n$ GT 710|30\nnull Graphics Device|30\n$ GT 240|30\n$ 810M|29\n$ GT 720M|29\n$ GT 710|29\nQuadro 600|29\n$ 810M|29\n$ GT 420M|28\nQuadro 410|28\n$ & 660M|28\nMSI $ GT 710|28\n$ GT 720|28\n$ GT 735M|27\n$ GT 720|27\n$ GT 720|27\n$ GT 630 OpenGL Engine|27\nQuadro 410|27\n$ GT 330M|26\n$ GT 420M|26\n$ GT 430|26\n$ 615|25\n$ & 760A|25\nToshiba $ GT 525M|25\n$ GT 520MX|25\n$ GT 620|25\n$ GT 625|25\n$ GT 710|24\nQuadro NVS 4200M|24\n$ 840A|24\n$ 610M|24\n$ 800M|24\n$ GT 420|24\n$ 705M|23\n$ GT 705|23\n$ 800M|23\n$ 610M|23\n$ GT 620 OEM|23\n$ GT 625|23\n$ GT 420|23\nQuadro NVS 4200M|23\n$ GT 520M|22\nNVS 4200M|22\n$ GT 620 OEM|22\nNVS 5200M|22\n$ GT 620 OEM|22\n$ GT 620|22\n$ GT 705|21\n$ GT 620|21\n$ GT 630 Rev. 2|21\nQuadro NVS 4200M|21\n$ GT 520M|20\n& 980M SLI|20\n$ GT 620|20\n$ GT 520M|20\n$ GT 520|19\n$ 410M|19\n$ 730A|19\n$ GT 520|19\n$ GT 610|19\nAsus $ GT 610|19\nNVS 310|18\n$ 410M|18\nNVS 315|18\n$ 605|18\n$ GT 610|18\n$ GT 520|17\n$ MX550|17\nNVS 4200M|17\nNVS 315|17\nNVS 310|17\n$ 410M|17\nPalit $ & 660|17\n$ 605|17\nNVS 310|17\n$ GT 415M|17\nZotac $ GT 610|17\n$ & 675M|17\n$ GT 610|16\nQuadro 4000M|16\nPNY $ GT 610|16\n$ GT 610|16\n$ 510|15\nMSi $ GT 610|15\n$ GT 735M|15\n$ GT 520|15\n$ 510|15\n$ GT 320M|14\n$ 9600M GT|14\n$ & 570M|14\nCorporation D3D12 (NVIDIA $ % 3080 Ti)|13\n$ 510|13\nQuadro FX 1800M|12\nAsus $ GT 520|12\n$ GT 705|12\nMSi $ GT 630|11\nQuadro 3000M|10\nGigabyte $ GT 610|10\nPegatron $ GT 420|9\n$ 210|8\n$ 9300 / nForce 730i|7\nNVS 3100M|7\n$ 8600 GT|5\n$ 8400 GS Rev. 3|4\n$ 8400 GS|3\n$ 9600 GT|2\n$ GT 550M|-1\n$ 8600 GTS|-1\n$ GT 520MX|-1\nEVGA $ & 460|-1\nEVGA $ & 970|-1\nGP106|-1\nGRID P4-2B|-1\nGainward $ & 650|-1\n$ 210|-1\n$ 310|-1\n$ 310M|-1\n$ 315|-1\n$ 315M|-1\n$ 320M|-1\n$ 405|-1\n$ 610M|-1\n$ 820A|-1\n$ 8300 GS|-1\n$ 8400 GS|-1\n$ 8400 GS Rev. 2|-1\n$ 8400 GS Rev. 3|-1\n$ 8400M GS|-1\n$ 8400M GT|-1\n$ 8500 GT|-1\n$ 8600 GT|-1\n$ 8600M GS|-1\n$ 8600M GT|-1\n$ 8700M GT|-1\n$ 8800 GT|-1\n$ 8800 GTS|-1\n$ 8800 GTS 512|-1\n$ 8800 &|-1\n$ 8800M &|-1\n$ 9200M GE|-1\n$ 9200M GS|-1\n$ 9300 / nForce 730i|-1\n$ 9300 GE|-1\n$ 9300 GS|-1\n$ 9300M GS|-1\n$ 9400|-1\n$ 9400M|-1\n$ 9500 GT|-1\n$ 9500M GS|-1\n$ 9600 GS|-1\n$ 9600 GSO|-1\n$ 9600 GSO 512|-1\n$ 9600 GT|-1\n$ 9600M GS|-1\n$ 9600M GT|-1\n$ 9600M GT / $ GT 220M|-1\n$ 9800 GT|-1\n$ 9800 &+|-1\n$ 9800 &/9800 &+|-1\n$ 9800M GTS|-1\n$ G 103M|-1\n$ G 105M|-1\n$ G105M|-1\n$ G205M|-1\n$ G210|-1\n$ G210M|-1\n$ GT 120|-1\n$ GT 120M|-1\n$ GT 130|-1\n$ GT 130M|-1\n$ GT 220|-1\n$ GT 220M|-1\n$ GT 230|-1\n$ GT 230M|-1\n$ GT 240|-1\n$ GT 240M|-1\n$ GT 240M|-1\n$ GT 320|-1\n$ GT 320M|-1\n$ GT 325M|-1\n$ GT 330|-1\n$ GT 330M|-1\n$ GT 335M|-1\n$ GT 435M|-1\n$ GT 520M|-1\n$ GT 525M|-1\n$ GT 555M/635M|-1\n$ GTS 240|-1\n$ GTS 250|-1\n$ GTS 360M|-1\n$ & 1180|-1\n$ & 260|-1\n$ & 260M|-1\n$ & 275|-1\n$ & 280|-1\n$ & 285|-1\n$ & 295|-1\n$ & 560 SE|-1\n$ & 750 v2|-1\n$ % T10-16|-1\n$ % T10-8|-1\nGigabyte $ & 1050 Ti|-1\nION|-1\nMSI $ GT 710|-1\nNVS 300|-1\nNVS 3100M|-1\nNVS 4200M|-1\nNVS 5100M|-1\nPalit & 680 JetStream|-1\nQuadro FX 1700|-1\nQuadro FX 1700M|-1\nQuadro FX 1800|-1\nQuadro FX 1800M|-1\nQuadro FX 2700M|-1\nQuadro FX 2800M|-1\nQuadro FX 3600M|-1\nQuadro FX 360M|-1\nQuadro FX 370|-1\nQuadro FX 3700|-1\nQuadro FX 3700M|-1\nQuadro FX 380 LP|-1\nQuadro FX 3800|-1\nQuadro FX 3800M|-1\nQuadro FX 4600|-1\nQuadro FX 4800|-1\nQuadro FX 4800|-1\nQuadro FX 5600|-1\nQuadro FX 570M|-1\nQuadro FX 580|-1\nQuadro FX 770M|-1\nQuadro FX 880M|-1\nQuadro K1100M by Nick[D]vB|-1\nQuadro K2000D|-1\nQuadro K2000M|-1\nQuadro K2100M by Nick[D]vB|-1\nQuadro NVS 135M|-1\nQuadro NVS 140M|-1\nQuadro NVS 160M|-1\nQuadro NVS 290|-1\nQuadro NVS 295|-1\nQuadro NVS 4200M|-1\nQuadro P4000 OpenGL Engine|-1\nSony $ 410M|-1\nZotac $ & 780|-1\n",v="\n@ ^ 7900 XT|2200\n@ ^ 7900 XT|1970\n^ 6800 XT|1960\n@ ^ 6900 XT (XTXH)|1930\n@ ^ 6900XT|1925\n@ PRO W6900X|1890\n^ 6900 XT|1850\n@ ^ 6900|1810\n@ ^ 7900 XTX|1770\nRX6800|1690\nFreddyVGA|1600\n@ PRO W6800|1560\n@ ^ 7900 XTX|1430\n@ ^ 6950 XT|1380\n@ ^ 6800 XT|1360\n@ ^ 6750 XT|1310\n@(TM) ^ 6850M XT|1290\n@ ^ 6700|1290\n@ ^ 6900 XT|1270\nSapphire Nitro+ ^ 6800|1260\n@ PRO W6800X|1250\n@ PRO W6800X Duo|1220\n@ ^ 6700|1210\n@ ^ 6800 XT|1180\nSapphire Nitro @ RX6650XT|1180\n@(TM) ^ 6750 XT|1160\n@ ^ 6800|1160\n@ ^ 6900 XT|1160\nASRock ^ 6650 XT Phantom Gaming|1160\n@ Navi23|1140\n@ ^ 6650 XT|1130\n@ ^ 6950 XT|1130\n@ 6800|1120\n@ ^ 6700 XT|1110\n@ Pro W6600X|1100\n@ ^ 6700M|1080\n@ ^ 6800M|1080\n@ ^ 5700 XT PJM|1060\n@ ^ 6800|1050\n@ ^ 6600 XT|1040\n@ ^ 6600 XT|1030\nASUS ^ 6600XT macOS Edition|1020\n@ ^ 6800M|1020\n@ Pro Vega II Duo|1015\n@ ^ 5700 Series|960\n@ ^ 6800/6800 XT / 6900 XT|960\n@ ^ 6600 XT|960\n@ Pro Vega II|955\n@ ^ 6650 XT|950\nNavi 10 5700 XT|950\n@ Pro Vega II|950\n@ ^ 5700 Series|950\n@ Pro W5700X|930\n@ ^ 6600|930\nASUS @ ^ 5700 XT|930\n@ Pro W5700X|920\n@ Pro 5700 XT|920\n@ ^ 6900 XT|920\n@ ^ 5700 XT|910\n@ Pro W5700|895\n@ ^ 6600/6600 XT/6600M|890\n@ ^ 6750 XT|880\n@ ^ 6600|870\n@ ^ 5700|855\n@ ^ 5700 XT 50th Anniversary|850\n@ VII|850\n@ ^ 5700 XT 50th Anniversary|840\n@ PRO W6800|840\n@ Pro Vega 64|820\n@ Navi10|820\n@ ^ 5600 XT|820\n@ ^ 6600M|800\n@ ^ 6800S|790\n@ Pro 5700 XT|780\n@ ^ Vega 64 8GB|770\n@ Pro 5700|770\n@ Vega Frontier Edition|770\n@ ^ Vega|760\n@ ^ Vega 56/64|760\n@(TM) ^ Vega|760\n@ Pro Vega 64X|740\n@ ^ 5600 XT|740\n@ PRO W6600|740\n@ Vega 64 LC|735\n@ ^ Vega 64.1|730\n@ ^ 6600M|730\n@ Pro 5700|720\n@ Vega Frontier Edition|710\n@ Vega Frontier|700\n@ Vega FE|700\n@ ^ 5700 XT|690\n@ Pro Vega 64|670\n@ Vega 64|670\n@ VII|660\n@ Pro WX9100|660\nSapphire @ ^ Vega 64 8GB|650\n@(TM) PRO W6600M|650\n@ ^ 5700 XT 50th Anniversary|650\n@ ^ 5700|640\n@ Pro W5700|640\n@(TM) Pro WX 9100|635\n@ ^ Vega 56|630\n@ ^ Vega 56|620\n@ Pro 5500 XT|620\n@ ^ 5600 OEM/5600 XT / 5700/5700 XT|620\n@ ^ 5500|620\n@ ^ 5500 XT|620\n@ Vega Frontier Edition|620\n@ ^ 5500M Series|610\n^ xxx|610\n@ Pro Vega 64X|610\n@ ^ Vega 64|610\n@ ^ 5600 XT|610\n@ Pro Vega 64|610\n@ ^ 6500 XT|600\n@ Vega|600\n@ Pro W5500|600\n@ ^ 5600M|600\n@ Pro Vega 56|600\n@ Pro Vega 64|590\n@ Pro 5600M|590\n@ Pro Vega 48|590\n@ Pro Vega II Duo|590\n@ ^ 590 Series|590\n@ ^ Vega 56 8GB|590\n@ Pro 5600M|590\n@ Pro WX 9100|590\n@ Pro 5300|580\n@(TM) R9 Fury Series|580\n@ ^ 6800 XT 16GB|570\n@ Pro 5600M|570\n@ Pro W5500X|560\n@(TM) ^ 5500M|560\n@ * 7870|560\n@ Pro W5500|550\n@ ^ 5500M|550\n@ R9 290X Series|550\n66AF:F0|550\n@ Pro 5500 XT|550\n@ ^ 580 Series|550\n@ ^ 5500XT|550\n@(TM) ^ 580X|540\n@ Pro 5500 XT|540\n@(TM) Pro W5500M|540\n@ Pro W5500X|540\n@ Pro W5500|540\nRadeonT ^ 5300|540\n@(TM) ^ 570 Graphics|520\n@ Pro 5300|520\n@(TM) ^ 6500M|520\n@ ^ Vega M GL|520\nASUS @ ^ 570 Series|520\nASUS @ ^ 580 Series|520\n@(TM) ^ 580|520\n@(TM) Pro V7350x2|520\n@(TM) ^ 480 Graphics|520\n@(TM) ^ 570 Graphics|515\n@ ^ 6400|510\n@ Pro 580X|510\n@(TM) R9 390 Series|500\n@ Pro 5300|500\n@ ^ 580 2048SP|500\n@ PRO W6400|500\n@ ^ 570 Series|500\n@ PRO W6800X Duo|500\n@ Pro 580|500\n@ ^ 5500 XT|500\n@ ^ 6400|490\n@ Pro 580|485\n@(TM) Pro WX 7100 Graphics|485\n@(TM) R9 290X|480\nSapphire @ ^ 580 Pulse|480\n@ ^ 6700/6700 XT / 6800M|470\n@(TM) ^ 580|475\n@ ^ 6700S|475\n@ R9 290X|470\n@(TM) ^ 470 Graphics|470\n@ R9 FURY / NANO Series|470\n@ Embedded E9560|470\nKamen Rider Black ^|460\n@(TM) E9550|460\n@(TM) ^ 580 Graphics|460\n@ ^ Vega 56/64|460\n@(TM) ^ 480|460\n@ ^ 6800 XT|460\n@ ^ 470 Series|460\n@ RX480|455\n66AF:F1|455\n@ Pro 480/575|455\n@ Embedded E9560|450\n@ FURY|450\n@ ^ 5600 OEM/5600 XT / 5700/5700 XT|450\n@ ^ 6600 XT|450\n@ * 6800 Series|445\n@ Pro 570X|440\n@(TM) ^ 470 Graphics|440\n@ Pro 575X|440\n@ ^ 470/480/570/570X/580/580X/590|440\n@ ^ 6600|440\n@ ^ Vega M GH Graphics|440\n^ 580|440\n@ ^ 570|440\n@ Pro 570|440\n@ ^ 590|440\n@(TM) ^ 470 Series|435\n@ ^ 6900 XT|435\n@ FURY X|430\n^ 590|430\n@ Pro 5500M|430\n???|430\n@(TM) ^ 570|430\n@ ^ 580|430\n@ * 8xxx|430\n@ R9 290|425\n@ Pro 5500M|420\n@ Pro 580X|420\n@ ^ 6700 XT|420\n@ ^ 480|420\n@ R9 290/390|420\n@ Pro 580X|420\n@(TM) Pro Duo|415\nEllesmere @ ^ 570|410\n@ R9-290X|410\n@ Pro 580|410\n@ R9 200 Series|400\n@ ^ 570|400\n@ Pro 470/570|400\n@ ^ 6800M|400\n@ ^ 5300M|400\n@ ^ 580 Series (POLARIS10, DRM 3.40.0, 5.11.9-141-tkg-pds, LLVM 11.1.0)|400\n@ Pro 5300M|400\n@ R9 285|400\n@ ^ 470|400\n@ Pro 575|390\n@ Pro 575X|390\n@ Pro WX 7100|390\n@ ^ 6700M|390\n@ ^ 470/480/570/570X/580/580X/590|380\n@ PRO W6600|380\n@ Polaris|370\n@ ^ 6500 XT|370\n@ Pro Vega 20|370\n@ * 7970|370\n@ Pro Vega 16|370\n@ ^ 6800|370\n@ Pro Vega 64 OpenGL Engine|370\n@(TM) R9 380 Series|360\n@ ^ 5700XT|360\nFirePro W8100|360\n@ Pro Vega 64|365\n@ Pro 570|365\n@ Pro 570X|360\n@ Pro Vega 64 OpenGL Engine|360\n@ R9 280x|360\n@ R9 380|360\n@ R9 280x|360\n@ R9 280x|360\n@ Pro Vega 56|360\nR9 280X Dual-X|360\n@ Pro Vega 56 OpenGL Engine|350\n@ * 7970|350\n@ * 7970X/8970/R9 280X|350\n@ R9 285|350\n@ R9 380X|350\n@ ^ 480|350\n@ ^ 5700 XT Series|350\nASUS @ ^ 470 Series|350\n@ Pro Vega 64|350\n@ R9 200 / * 7900 Series|340\nASUS @ ^ 470 Series|340\n@ Vega 56|340\n@ ^ 580 Series (AMD POLARIS10 / DRM 3.15.0 / 4.12.0-1-amd64, LLVM 4.0.1)|340\n@ Pro Vega 20|340\nR9 380|340\n@ * 7970|340\n@ ^ 5700 XT|330\n@ D700|330\nAsus @ R9 280|330\n@ R9 285|330\n@ R9 M395X|330\n@ ^ 5600 XT|330\nPowerColor @ R9 280|330\n@ R9 280|330\nFirePro W7100 Graphics Adapter|330\n@ R9 M295X Mac Edition|330\nASUS @ ^ 5700|330\n@ R9 380|330\n@ Pro Vega 16|325\n@ R9 290X|325\n@ RX5600|320\nASUS @ ^ 5500 XT|320\n@ R9 280|320\n@ * 7950/8950 / R9 280|320\n@ R9 M395|320\n@ ^ 6800/6800 XT / 6900 XT|320\nFirePro D700 (FireGL V)|320\n@ ^ 5500/5500M / Pro 5500M|320\nMSI @ ^ 6600 XT Gaming X|320\nFirePro W8000|315\n@ * 7950|315\n@ Pro W5700|315\nFirePro W7170M|310\n@ PRO W6800|310\n@ ^ 5500|310\n@ ^ 580 Special Edition|310\nRadeonT ^ 5500M|310\n@ R9 M395 (Bootcamp XG edition by bootcampdrivers.com)|310\n@ R9 360|310\n@ Pro WX 7100|310\n@ Pro WX 7100 Mobile|310\n@ ^ 5700 XT 50th Anniversary|310\nR9 xxx|300\n@ ^ 5700XT|300\n@ PRO W6400|300\n@(TM) R9 370 Series|300\n@ ^ 470/480/570/570X/580/580X/590|300\n@(TM) PRO W6600M|300\n@ * 8950|300\n@ R9 M395X|300\n@ R9 M395X|300\n^ Vega 64|300\n@ ^ Vega 11 Graphics|295\n@ Pro 270X|290\n@ ^ 580 2048SP|290\n@ * 7950|290\nVideo Controller (VGA Compatible)|290\n@(TM) R7 370 Series Graphics|290\n@ * 7950|290\nAsus @ R9 270X|290\n@ ^ 580X Series|290\n@(TM) ^ 5500M|285\n@ R9 270X|285\n^ xxx|285\nASUS R7 265 Series|280\n@(TM) R9 270|280\n731F:C1|280\n@ R9 M395X|280\n@(TM) R7 370 Series|280\n@ Pro V520 MxGPU|280\n@ R9 M395|280\nFirePro D700|280\n@ R9 270X|280\n@(TM) R9 200 Series|270\n@ ^ 5700|275\nRadeong 0.4 on AMD POLARIS10 (DRM 3.8.0 / 4.9.11-1-ARCH, LLVM 3.9.1)|270\n@ * 7870 XT|270\n@ R9 390X|270\n@(TM) ^ 570 Graphics|270\n@ * 7870 GHz Edition|270\n@ R9 390|270\nFirePro D700|270\n@ R9 M395|270\n@ R9 270|270\n@ ^ 5700 / 5700 XT|270\nASUS R7 370 Series|270\nFirePro W7000|270\n@(TM) Pro V7350x2|270\n@(TM) ^ 470 Series|270\n@ ^ Vega 64 OpenGL Engine|270\n@ ^ 5500M|265\n@ * 7950/8950 OEM / R9 280|265\n@ Vega Frontier Edition OpenGL Engine|265\n@ 7950 x2|263\n@ R9 270|263\n@ VII|263\n@ * 7xxx|262\nVideo Controller (VGA Compatible)|262\n@(TM) ^ 570|261\n@ ^ 5500 XT|261\n@ R9 M295X|261\nFirePro W7000 (FireGL V) Graphics Adapter|260\n@ R9 M390|260\n@ * 7870 GHz Edition|260\n@ R9 M390 (Bootcamp edition by bootcampdrivers.com)|260\n@ R9 370|259\nMetal|259\n@ * 7870|259\n@ ^ 470/570|258\n@(TM) R9 370|257\n@(TM) ^ 460|257\n@ ^ 560 Series|256\n@ R9 290|255\n@(TM) ^ 560 Series|255\n@ ^ 5300M|254\nFirePro W7000|254\n@ R9 290X|253\n67EF:E7|253\n@ * 7850|253\n@(TM) ^ 460 Graphics|253\nMSI @ ^ 580|251\n@ R9 290/390|250\nFirePro W8100 (FireGL V)|249\n@ Pro WX 9100 OpenGL Engine|248\n@(TM) ^ 560|247\n@(TM) ^ 560 Series|247\n@ Pro Vega II Duo|247\n@ * 7970M|246\n@ R9 290|245\n@ ^ 5600M|245\nFirePro D300|245\n@(TM) ^ 5600M Series|244\n@ ^ 590 Series|244\n@ R7 370 Series|244\n@(TM) ^ 560|243\nFirePro D300|243\n@ R9 390|243\n@ ^ 470/480/570/570X/580/580X|243\nFirePro D300|243\n@(TM) R7 370 Series|242\n@ R9 M390|241\n@ ^ 560X Series|241\nFirePro D300|241\n@ ^ 560|240\n@ R9 M290X|240\nGigabyte Vega 64 macOS Edition|239\n@ Pro 580|238\n@ Pro WX 4100|236\n@ Pro WX 7100 OpenGL Engine|236\n@ * - FirePro D300|235\nFirePro D500|234\n@ Pro 580 OpenGL Engine|234\n@(TM) E9260|234\n@ Pro WX 2100|233\nFirePro D500|232\nFirePro D500|232\n@(TM) ^ 6500 XT|232\n@ Pro 580X|231\n@ * 7850|231\n@ Pro 575|231\n@ Pro Vega 64X|231\nASUS R9 270 Series|230\n@ Pro 450|230\n@(TM) ^ 560 Graphics|230\n@ R9 M290|229\n@ Pro 560X|228\n@ Pro 480/575|228\nPitcairn PRO @ * 7850|228\nASUS @ ^ 5700 XT|227\n@ * 7870|227\n@(TM) Pro WX 5100 Graphics|226\n@ R9 370X|225\n@(TM) ^ 480|224\n@ HD7970M|224\nFirePro S9000 (FireGL V)|223\n@ ^ 550 640SP / ^ 560/560X|222\nMSI / AMD ^ 560 4G|222\n@ ^ 570 OpenGL Engine|222\nMSI RX650|222\n^ 480|221\nMSI / AMD ^ 560|221\nBaffin AMD @ ^ 560|221\nMSI Baffin RX650|220\n@ Pro 5700 XT|220\n@ Pro 570|220\n@ Pro 575 OpenGL Engine|219\nAsus @ R9 270X|219\n@ ^ ^ 560|218\n@ ^ 560 [Baffin]|218\n^ 460|218\n@ R9 370X|218\n@(TM) Pro WX 4100|217\nASUS R9 390 Series|217\n@ Pro 5600M|217\nR9 xxx|217\n@ * 7870 Series|217\n@ Pro ^ 560|216\nR9 280X Dual-X|215\n@ Pro 570 OpenGL Engine|214\n^ 560|213\n@ Pro WX 5100|213\nFirePro D700|213\n@(TM) R9 390 Series|213\n@ ^ 480|212\n@ ^ 560|212\n@ ^ 5500/5500M / Pro 5500M|212\n@ ^ 550 640SP / ^ 560/560X|211\n@ R9 FURY / NANO Series|211\nSapphire @ ^ 560|211\n@ ^ 460|210\n@ RX550/550 Series|210\ninc. @ ^ 480|209\n@(TM) ^ 550|208\n@ R9 M290X|206\n@ Pro 560 (Bootcamp XG edition by bootcampdrivers.com)|206\n@ RX460|206\n@ ^ 550 Series|205\nCustom GPU 0405|204\n@(TM) ^ 460|204\nASUS AMD @ R9-990X|204\n@ Pro 555X|203\n@ ^ 460/560|203\n@ * 7970X/8970/R9 280X|202\nASUS @ ^ 550 Series|201\n@ * 8950|201\nFirePro D500 (FireGL V)|201\n^ 5700XT|200\n@ 550 Series|200\n@ * 8470 + 7660D Dual Graphics|200\n@ * 7990|200\n@ ^ 560X|199\n@ ^ Vega|199\n@ * 7950 Series|198\n@(TM) ^ 540|197\n@ * 6970|197\n@ * 7970/8970 / R9 280X|197\n@ Navi14|197\n@ Pro 560|197\n@ ^ 550|197\n@ R9 285|196\n@ Pro W5500|195\n@ Pro Vega 56|195\n@ Pro 460|195\n@ ^ 470/480|194\n@ PRO Graphics|194\n@(TM) RX550|194\n@ Pro 560X|193\n@ Pro 570X|192\n66AF:F1|192\n@ ^ Vega M GH|190\n@ R9 M280X|190\n@ ^ 460/560D / Pro 450/455/460/555/555X/560/560X|189\n@ R9 280,|188\nCustom GPU 0405|188\n@ * 7790|187\n@(TM) ^ 480 Graphics|187\n@ Pro 455|186\n@ R9 260|186\n@ ^ 580 Series|186\n@ * 7950/8950 OEM / R9 280|186\n@ R9 290X|185\n@ R9 M290X|184\n@(TM) R9 370 Series|184\n@ Pro 555|184\n@ R7 260X|184\n@ * 6950|183\nFirePro W5000|183\n@(TM) R9 390X|182\nR9 270X Devil|182\n@(TM) ^ 470 Graphics (AMD POLARIS10 / DRM 3.23.0 / 4.15.0-1-MANJARO, LLVM 5.0.0)|182\n@ R9 380|182\n@(TM) Pro WX 9100|182\n@(TM) R7 360 Series|181\n@ ^ 570 Series|181\n@(TM) R9 M470X|181\n@(TM) R7 360 Series|181\n@ RX480|180\n@ R7 200 Series|180\n@ Pro WX 4150|180\n@ Pro WX 4100|179\n@ * 8xxx|179\nASUS R9 295X2 Series|179\n@ R9 390X|178\n@ * 5870|176\n@ Pro 560|176\n@ ^ 580 OpenGL Engine|175\n@ * 8950|175\nFirePro V(FireGL V) Graphics Adapter|175\nASUS @ ^ 580 Series|174\n@ Pro WX 4100|174\n@ Pro 460|173\n@ * 2600 XT|173\n@ Pro WX 4100|172\n@ * 8280|172\n@ Pro 575|171\n@ Pro 555X|171\n@ Pro WX 4130/4150|170\n@ ^ Vega M GH Graphics|170\nFirePro W5100|170\n@(TM) PRO WX 8200|169\n@ Vega Frontier Edition|169\n@ Pro 555X|168\nFirePro D700|168\n@ * 6990|167\n@ ^ 470 OpenGL Engine|167\n@ * 7870 XT|167\n@ ^ 580|167\n@ Polaris|167\nFirePro V8800 (FireGL V)|166\n@ ^ 550|165\n@ * 6900 Series|165\nFirePro W9100 (FireGL V)|164\n^ 580|163\n@(TM) ^ 580X|163\n@ ^ 550|163\n@ * 6870|163\n@ R9 M395X OpenGL Engine|163\n@(TM) R9 360|163\n@(TM) * 8490|162\n@ R9 M295X|162\n@ * 7970M|162\n@ R9 M380|161\nFirePro W5100 (FireGL V) Graphics Adapter|161\nASUS HD7850 Series|161\nFirePro M6100 FireGL V|161\n@ Pro 455|160\n@ ^ 460/560D / Pro 450/455/460/555/555X/560/560X|160\n@ R9 M395X|159\n@ ^ 560X|159\n@ Pro 555|158\nRadeonT ^ 560X|158\n@ Pro Vega 48|158\nASUS @ ^ Vega|158\n@ Pro WX 9100|158\n@ Pro Vega 64|157\nPowered By QiongB A9999999999|157\n@(TM) Pro Duo|157\nFirePro D700|157\n@ Pro WX 7100|156\n@ ^ 460|156\n@ * - FirePro D700 OpenGL Engine|156\n@ R9 M290X|156\n@ R9 M395 OpenGL Engine|155\n@ Pro SSG|155\nFirePro D300|155\nASUS R9 380 Series|155\n@(TM) R9 Series|153\n@ ^ 470/480/570/580|153\nFirePro W8000|153\nCezanne|153\n@(TM) Graphics|153\nFirePro D300|153\n@(TM) R9 Fury Series|153\n@ R9 M395|152\n@ ^ 570|152\n@ R9 270X Series|152\n@ Pro 5300M|152\nR9 xxx|152\n@ Pro 555|152\nFirePro D500|151\n@ * 5850|151\nFirePro D300|150\n@(TM) R9 290X|150\n66AF:F0|149\n@(TM) ^ 560|149\n@ R9 M290|148\n@ Instinct MI25 MxGPU|148\nFirePro V7800 (FireGL) Graphics Adapter|148\n@(TM) R9 M470|147\nAdvanced Micro Devices, Inc. [AMD/ATI] Fiji [@ R9 FURY / NANO Series]|147\n@ * 5870 Series|147\n@(TM) E9550|147\n@ * 7850|147\n@ * 7770|147\n@ Pro Vega 20|146\n@ R9 290/390|146\n@ Pro 450|146\n@ ^ 560X Series|146\n@ * 6850|146\n@ R9 270 1024SP|145\nASUS R9 280X Series|145\n@ Pro 450|145\n@(TM) R9 390 Series|145\nFirePro V7900 (FireGL V)|145\n@ R9 370X|145\n@(TM) ^ 560 Series|144\nASUS R7 250X|144\n@ ^ 480 OpenGL Engine|144\n@ R9 290X|144\n@ ^ 550X|144\n@(TM) ^ 580|144\nASUS @(TM) ^ 470 Series|143\nBaffin @ ^ 560|143\n@ R9 M295X (Bootcamp edition by bootcampdrivers.com)|143\n@ R9 M295X Mac Edition|143\n@ R7 Series / * 9000 Series|142\nAdvanced Micro Devices [AMD] nee ATI Device|142\n@(TM) Pro WX 7100 Graphics|142\n@ ^ 640|142\nFirePro D500|141\n@ * 7900 Series|141\n@ R9 290|141\n@ R7 250X|141\n@(TM) ^ Vega|140\n@ 630 Series|140\nFirePro W8100 Graphic Adapter|140\n@ R9 FURY / NANO Series|140\n@ R9 M390|140\n@ Pro WX 3100|140\n@ R9 290|140\n@(TM) R9 370|140\nFirePro V7900|139\n@ * 7970|139\n@ * - FirePro D500 OpenGL Engine|139\n@ * - FirePro D300 OpenGL Engine|139\n@ Pro 580|139\n@ * 7770|139\n@ * - FirePro D500 OpenGL Engine|139\n@ 540/540X/550/550X / ^ 540X/550/550X|138\nFirePro S9050|138\n@(TM) ^ 480 Graphics|138\n@(TM) R9 M390X|137\n@ Vega 64|137\n@(TM) Graphics|137\nTonga PRO GL [FirePro W7100]|136\nHD7950 Martin Ver.|136\n@ * 7990|135\n@ R9 280x|135\n@ RX550/550 Series|135\nHD7950 MARTIN REV.|134\n@ RX560|134\n@ R7 250X Series|134\n@ R9 M390 OpenGL Engine|134\nASUS R7 250X|134\n@ HD6870|134\n@ R9 270X|134\n@ Pro 5500 XT|134\n@(TM) ^ 480|133\n@ R9 270|133\nASUS HD7970 Series|133\n@ ^ 540|133\n@ 500 Series|132\n@ * 5970|132\n@ * 7770 GHz Edition|132\n@ * 5870|132\n@ 540X Series|132\n@ * 6870 Series|132\n@(TM) ^ 470 Graphics|132\n@ * - FirePro D300 OpenGL Engine|132\n@ * 7xxx|131\n@ * 5970|131\nRadeonT 540X|131\n@ R7 Graphics + R7 350 Dual Graphics|131\n@ R9 M295X Mac Edition / R9 380X|131\nFirepro M5100|131\n@(TM) R9 M375X|131\n@ R9 280x|130\n@(TM) ^ 560X|130\n@ * 6990|130\n@ Pro 5500M|130\n@ Pro WX 5100 OpenGL Engine|129\n@ R9 M395X (Bootcamp edition by bootcampdrivers.com)|129\n@ R9 M380|128\nFirePro W5170M|128\n@ R9 280|128\nFirePro W5000 (FireGL V)|128\n@(TM) ^ 5600M Series|128\n@ ^ 560D|128\nFirePro D500 (FireGL V)|128\n@(TM) Pro WX 5100 Graphics|128\n@(TM) ^ Vega 11 Graphics|128\n@ * 7970|127\n@ R9 370|127\n@ * 7770|127\n@ R9 M395X|126\n@ * 7660D|126\n@ * 8970|126\n@ R9 200 Series|126\n@ Pro WX 3200 Series|126\n@ * 7800 Series|125\n@ R9 285/380|125\n@ R9 270X|124\nFirePro W2100|124\nFirePro W7170M|124\n@ * 7870 GHz Edition|123\nRadeong 0.4 on AMD TONGA (DRM 3.1.0, LLVM 3.9.0)|123\n@ ^ 460|123\n@ * 5970 Series|123\n@ R9 M380|122\n@ R9 M395|122\nAsus @ R9 280|122\n@ * 6850 Series|122\n@(TM) ^ 540|122\n@ * 6900 Series|122\nDevice|122\n67DF:C4|121\n@ * 6950|121\nFirePro D300 (FireGL V)|121\n@ ^ 570|121\n@ * 5850 Series|121\n@ * 7870 XT|121\n@ * 7950|121\nFirePro V7800 (FireGL) Graphics Adapter|121\n@ * 6850|121\n@ * 7950|120\n@ * 7870 GHz Edition|120\n@ R7 370 / R9 270X/370X|120\n@ * 6870|120\n@ Pro V340|120\nASUS @ ^ 570 Series|119\n@(TM) R7 370 Series Graphics|119\n@(TM) ^ 580 Graphics|119\n@(TM) ^ 470 Graphics|119\n@ * 5870|119\n@ * 7950/8950 / R9 280|119\n@ * 6790|119\n@(TM) RX580|119\nASUS ARES2|119\n@(TM) R9 380 Series|118\n@ * 7750|118\n@ Pro 560X|118\n@ R7 250E|118\n@ 550 Series|118\n@ ^ 560|118\n@ Pro WX 5100|117\n@ R7 370 / R9 270X/370|117\n@ * 7800 Series|117\nFirePro W5000 (FireGL V) Graphics Adapter|117\n@ * 7750 Series|116\n@ * 5870|116\n@ R7 450|115\nFirePro R5000|115\n@ R7 370 Series|115\nFirePro W9100|114\n@ R7 370 / R9 270/370|114\n@(TM) 540 Graphics|114\n@ * 6510 Series|114\n@(TM) R7 370 Series|113\nSapphire @ HD6870|113\nFirepro M5100|113\n@(TM) ^ 550|113\n@(TM) Pro Duo|113\n@ 540/540X/550/550X / ^ 540X/550/550X|113\n@ Pro 570|112\n@ R9 280|112\nFirePro D700 (FireGL V)|112\n(ATI) FirePro M6000 (FireGL V) Mobility Pro Graphics|112\nRenoir|112\n@ 540X Series (POLARIS12, DRM 3.40.0, 5.10.56-1-MANJARO, LLVM 12.0.1)|112\n@ * 6970|112\n@ * 8770|112\n@ Pro WX3200 Graphics|112\n@(TM) R9 270|111\n@ R9 270X|111\n@ R9 285|111\n@ * 7800M Series|111\n@(TM) R7 370 Series|111\n@ * 7870M Series|111\n@ Pro 450/550|110\n@ * 7000 series|110\n@ * 7870|110\n@ Pro 555X|110\n@ RX590 GME|109\nFirePro S10000|109\n@ * 7870M|109\n@ * 5800 Series|109\n@ * 6970M|108\nASUS HD7770 Series|108\n@(TM) R9 M360|108\n@(TM) ^ 550X|107\n@ R9 285|107\n@ * 6900M Series|107\n@ * 7870 GHz Edition|107\nFirePro S7000|107\n@ R9 M370X|106\n@ Pro WX 4100|106\n@ * 6800 Series|106\n@ * 7750|106\n@ Pro 455 OpenGL Engine|106\nASUS R7 370 Series|106\n@ Pro 560|105\n@ * 6870|105\nFirePro D300 (FireGL V)|105\n@ * 6970M|105\n@ * 7850|105\n@(TM) R9 200 Series|104\nASUS HD7750 Series|104\n@ * 6970M OpenGL Engine|104\nAsus @ R7 250|104\n@ R7 370 / R9 270X/370|104\n@ R9 M395X (Bootcamp XG edition by bootcampdrivers.com)|103\n@(TM) ^ 560|103\n@ ^ Vega|103\n@(TM) Pro W5500M|103\n@ R9 270|103\n@ Pro 560X|103\n@ * 5850|103\nFirePro S7150|103\n@(TM) ^ 580|103\n@(TM) R9 370 Series|103\nASUS @(TM) ^ 480 Series|102\n@ Graphics Processor|102\n@ R9 M370X|102\nFirePro W7100|102\n@ R9 M370X|101\n@ Pro 460 OpenGL Engine|101\n@ ^ 580 Series|101\n@ 500 Series|100\n@ Pro 555|100\n@(TM) Pro WX 4100|100\nAsus @ R7 260X|100\n@(TM) ^ Vega 10 Graphics|100\n@ * 7790|99\n@ Pro 450 OpenGL Engine|99\n@ * 7790/8770 / R7 360 / R9 260/360|99\nFirePro M4000 Mobility Pro Graphics|99\n@ * 7970M|99\n@ R9 M270X|99\n@ ^ 550|98\n@ * 6850|98\n@(TM) ^ 460|98\n@(TM) ^ Vega11 Graphics|98\n@(TM) ^ 460 Graphics|98\n@ Pro 460|97\n@ * 7800 Series|97\nMatrox C680 PCIe x16|97\n@(TM) ^ 550|97\n@ * 5770|96\n@ * 8670D + 7700 Dual Graphics|96\n@ * 7790|96\n@ 630 Series|96\n@ ^ 560 Series|96\nFirepro M6100|95\n@ * 6700 Series|95\n67EF:E7|95\n@(TM) Vega 10 Graphics|95\n@ * 6900M Series|94\n@ Pro 455|94\nFirePro M4000|94\n@ R9 260|94\nFirePro W7000|94\n@ Instinct MI25|93\n@ * 8870M|93\n@(TM) Vega 11 Graphics|93\n@ Pro 450|93\nFirePro W5000|92\n@ * 6770|92\n@(TM) RX560|92\n@(TM) Graphics|91\nASUS @(TM) ^ 460 Series|91\n@(TM) Vega 8 Graphics|91\n@(TM) Graphics|91\nFirePro W5100 Graphics Adapter|90\n@(TM) Pro WX Series|90\nRenoir|90\nSTRATO XT (6646)|89\n@(TM) Pro WX 4150 Graphics|89\n@ E8870MXM|89\n@ * 8970M|89\nFirePro M6100 FireGL V|89\n@ * 7770|89\nFirePro W5100 (FireGL V) Graphics Adapter|89\n@ * 6970M|89\n@ Pro 460|88\n@ ^ Vega 8 Graphics|88\n@ * 7700 Series|88\n@(TM) R9 M360|88\nASUS R7 265 Series|88\n@ ^ Vega M GL Graphics|88\nASUS @ ^ 550 Series|88\n@ R7 360 / R9 360|88\n@ * 6950|86\n@ * 6790|86\n@ Pro WX 2100|86\nASUS @ ^ 560 Series|86\n@ * 5750|86\n@(TM) ^ 640|86\n@ * 8870M|85\n@ R7 260X|85\n@ Pro WX 7100|85\n@(TM) R7 360 Series|85\n@ Infoshock™ ^ 460 Graphics|85\nFirePro W5170M|85\n@ R9 M295X|85\nFirePro W8100|85\n@ * 6750|85\nFirePro W5170M|85\nFirePro V5800 (FireGL) Graphics Adapter|84\nASUS R7 250X|84\n67E8:00|84\n@(TM) ^ 550X|84\n@(TM) R7 350|84\n@(TM) E9260|84\n@ Sky 500|84\n@ R9 M270X|83\n@(TM) R9 350|83\n@(TM) ^ Vega 11 Graphics|83\nFirepro M6100|83\n@ R9 360|82\nFirePro V7900|82\nFirePro V5800 (FireGL V)|82\n@ * 8830M|82\n@ Pro 450|82\n@ * 8950|82\n6980:00|82\nFirePro W5100 (FireGL V)|81\n@ E8870|81\n@ * 7750 Series|81\n@ * 7850 / R7 265 / R9 270 1024SP|81\nFirePro™ W4190M|80\n@ * 5770|80\n@(TM) R7 360 Series|80\nFirePro M5100 FireGL V|80\n@ ^ 470/480/580|80\n@(TM) ^ 460 Graphics|79\n@ * 6700 Series|79\nMobility @ * 5870|79\n@ R9 255|79\n@ 535 Series|79\n@ R9 M380 OpenGL Engine|78\n@(TM) ^ 550|78\n@ R9 M380|78\n@ R7 250X|78\nSaphire @ ^ 580|78\nRadeong 0.4 on AMD BONAIRE (DRM 2.43.0, LLVM 3.8.0)|78\n@ * 5000|78\n@ * 5770|77\n@ ^ 460|77\nFirePro W4300|77\n@ 530 Series|77\n@(TM) 540X|77\n@ R9 M370X OpenGL Engine|77\nFirePro V5900 (FireGL V)|77\n@ Pro WX 4100|77\nSAPPHIRE * 5770|77\n@ Pro WX 3100|76\nFirePro W5100|76\n@(TM) Pro Graphics|76\n@ Pro WX 3100|76\n67FF:C8|76\n@(TM) HD8970M|76\nFirepro M5100|76\n@(TM) R9 M375X|75\n@ 550X Series|75\n@ R9 M390|75\n@(TM) Vega 9 Graphics|75\nFirePro V5900 (FireGL V) Graphics Adapter|74\n@ * 8570|74\n@(TM) ^ 475M|74\n@ * 6770|74\n@ ^ 550 Series|74\n@ ^ 550|74\nFirePro M4000|74\n@ ^ 460/560D / Pro 450/455/460/560|74\n@ Pro 560|74\n@ Vega Series / @ Vega Mobile Series|74\n@ Pro 455|74\n@ * 7870M Series|74\n@(TM) R7 430|74\n@ 620 Series|73\n@ * 7770 GHz Edition|73\n@ * 7770|73\n@(TM) R9 360 Series|73\n@ * 7770/8760 / R7 250X|73\n@(TM) 530|73\n15DD Graphics|73\n@ ^ Vega M GL Graphics|73\n@(TM) R9 380|72\n@(TM) 530 series|72\n@ R7 200 Series|72\nEmbedded @ E9171|72\n@ Pro WX3200 Graphics|71\n@ * 8800M Series|71\n@ R9 M375|70\n@ * 5770|70\n@ Pro 555|70\n@ R7 250E|70\n@ * 7750|70\n@ Pro 555X|70\n@(TM) Vega 8 Mobile Graphics|70\n@(TM) R9 M380|69\n@ R7 260X/360|69\nBarco MXRT 7600 (WDDM)|69\n@(TM) Vega 10 Graphics|69\n@ * 7750|69\n@ R9 M370X|69\n@(TM) R2E Graphics|69\n@ R9™ M370X|68\nFirePro V4900 (FireGL V)|68\n@(TM) ^ Vega11 Graphics|68\n@ * 5770|68\n@(TM) Renoir Graphics D1|68\n@ * 7600 Series|67\n@ R5 340|67\n@(TM) Vega 9 Graphics|67\nFirePro W4100 (FireGL V) Graphics Adapter|67\n694E:C0|67\n694C:C0|67\n@ R7 250|66\n@ * 6750|66\nRAVEN (DRM 3.36.0, 5.6.5-AMD, LLVM 9.0.1)|66\nFirePro W600|66\n@ R9 255|66\n@ ^ 470|66\n@(TM) R7 250|66\nFirePro V5900|65\n@(TM) 530|65\n@ Pro WX Vega M GL Graphics|65\n@ ^ 470/480|65\n@ * 5750|65\n@ R7 260X|65\nFirePro V5900 (FireGL V) Graphics Adapter|65\nFirePro W4100 Graphics Adapter|65\n@ * 6700 Green Edition|65\n@ R9 M370X|65\n@(TM) R7 350X|64\n@(TM) R7 350X|64\n@ * 7670|64\n@ R9 M200X Series|64\n@ R9 M370X|64\n@ * 6670|63\n@(TM) * 8350|63\n@ 530X Series|63\n@(TM) R9 360|63\n@(TM) Pro WX 4150 Graphics|63\n67EF:C5|63\n@ R7 Graphics + R5 340 Dual Graphics|62\n@ * 5670|62\n@ ^ 470/570|62\n@ 530 Series|62\n@ R7 250 Series|62\n@ R7 430|62\n@ * 6750 Graphics|62\n@(TM) R9 M385X|62\n@(TM) Vega 10 Mobile Graphics|62\nFirePro V5900 (FireGL V)|61\nFirePro V5800 (FireGL V)|61\n@(TM) Vega 8 Graphics|61\nFirePro V4800 (FireGL V)|61\n@ * 7600 Series|61\n@(TM) Vega 6 Graphics|61\n@(TM) R9 200 Series|61\n@ * 8850M|61\n@ RX460|61\n@ R7 M460|61\n@ ^ 640 Series|60\n@ 530|60\n@ * 5600/5700|60\n@ * 5750 Series|60\n@ R7 Graphics + R7 200 Dual Graphics|60\n@ R7 450|60\nFirePro V4900|60\nFirepro W6150M|60\nASUS R7 250 Series|60\n@(TM) ^ 560 Graphics|60\n@(TM) R7 M370|59\nFirePro M4000 Mobility Pro Graphics|59\n@ R5 430|59\n@ R9 M275X|59\nFirePro V5800 (FireGL) Graphics Adapter|59\nMobility @ * 5870|59\n@(TM) R9 M385X|58\n@ * 7750M|58\n@ * 5670|58\n@ * 8850M|58\n@ * 7700M Series|58\n@ * 8670D + R7 200 Dual Graphics|58\n@ R7 Series / * 9000 Series|57\n@ * 6730M/6770M|57\n@(TM) 625|57\n@(TM) R9 M385|57\n@ * 5870M|56\n@ 610 Series|56\nFirePro W4100|56\nFirePro M6000 Mobility Pro Graphics|56\n@ ^ 540 Series|56\n@ R7 240|56\n@ * 7560D + * 7700 Dual Graphics|56\n@ R9 M370X (Bootcamp XG edition by bootcampdrivers.com)|56\nFirePro V4900 (ATI FireGL)|55\n@(TM) R7 M350|55\nFirePro M6000 Mobility Pro Graphics|55\n67FF:08|55\n@ * 5750|55\n@ * 7570|55\n@(TM) Vega 11 Graphics|55\n@ R7 M460|55\n@ * 5750 OpenGL Engine|55\n@(TM) R7 M370|55\n@ * 6730M/6770M/7690M XT|55\n@ E8860|55\n@ * 8790M|54\n@ * 6770M|54\n@ R7 M440|54\n@(TM) R7 350|54\n@(TM) R7 350X|54\n@ * 7870 XT|54\n@ * 7800M Series|54\n@ 520|54\n@ R7 M370|53\nFirePro W4150M FireGL V|53\n(ATI) FirePro M4000 (FireGL V) Mobility Pro Graphics|53\n@ R9 M200X Series|53\n@ * 6700M/7700M/7900M Series|53\n@(TM) 620|53\nPicasso|53\n@(TM) ^ Vega 10 Graphics|53\n67EF:CF|53\n@(TM) Vega 3 Graphics|53\n@ R7 250|53\nFirePro W4190M|53\n@(TM) Vega 8 Graphics|53\n694C:C0|52\n@ * 5670 Series|52\n@(TM) ^ Vega 11 Graphics|52\n@ * 6770M OpenGL Engine|52\n@(TM) M535DX|52\nFirePro V4800 (FireGL V)|52\n@ R7 350 Series|52\nBarco MXRT 5600 (WDDM)|51\n@ 630|51\nFirePro V4900 (FireGL V)|51\nFirePro V4900 (FireGL V) Graphics Adapter|51\n@(TM) Vega 3 Mobile Graphics|51\n@ 535 Series|51\n@ R7 Graphics|51\n@ * 5670|51\nFirePro W4170M|50\n@ * 8700M Series|50\n@ * 8670 / R7 250/350|50\nPicasso|50\nFirePro V4800 (FireGL) Graphics Adapter|50\nMobility @ * 5850|49\nOPAL XT/GL (6604)|49\n@ R5 M335|49\nMatrox C900 PCIe x16|49\n@ * 7670|49\n@ * 6750M|49\n@(TM) 535|49\n@ 540X Series|49\n@ R9 M275|49\n@(TM) ^ 640|49\n@ * 5700 Series|48\n@ R5 M230 Series|48\nFirepro M6100|48\n@(TM) R9 M375|48\n@ R5 430|48\n@(TM) R7 250|47\n@ R9 M265X|47\n@ * 6730M/6770M|47\n@ * 8670D|47\n@ R5 340|47\n@ 520|47\n@(TM) 520|47\nFirePro V (FireGL V) Graphics Adapter|47\nFirePro M5100 FireGL V|46\n@ * 6670|46\n@ R7 M260X|46\n@ * 8550|46\nFirePro M4150|46\n@ * 6670|46\n@ * 7700 Series|46\nFirePro M4170|46\n@ * 7570|46\n@ * 8670D + * 6670 Dual Graphics|45\n699F:C1|45\n@ R7 Graphics|45\n@(TM) R7 M340|45\nFirePro W4170M (FireGL V)|45\n@(TM) * 8500M/8700M|45\n@ R7 M340|44\nFirePro M5950|44\n@ * 8570D + R7 240 Dual Graphics|44\n@ * 6770M|44\n@ * 7730M|44\n@ * 8790M|44\n@ * 7750|44\n@ * 8690A|44\nMobility @ * 5730 / 6570M|44\n@ R9 A375|44\n@(TM) R8 M445DX|43\nFirePro V (FireGL V) Graphics Adapter|43\n@ * 7750/8740 / R7 250E|43\nFirePro V3900|43\n@ * 7600A Series|43\n@(TM) R7 200 Series Graphics|43\n@ R7 Graphics|43\n@ * 6770M|43\n@ R7 M260 Series|43\n@ R7 M360|43\n@ * 8970M|43\n@(TM) Vega 6 Graphics|43\n@ * 8570|42\n@ R7 M440|42\n@ * 8670A/8670M/8750M|42\nMobility @ * 5850|42\n@ * 8750M|42\nEmbedded @ E9173|42\n@(TM) R7 M440|42\n@ * 8730M|42\n@ R7 240 + * 8570D Dual Graphics|42\nFirePro V3900|42\n@(TM) 535DX|42\n@(TM) 520|42\n@(TM) Vega 8 Mobile Graphics|42\n@(TM) Vega 8 Graphics|42\n@(TM) Vega 2 Graphics|42\n@(TM) R9 M375|42\n@(TM) R8 M445DX|41\n@ * 6750M|41\nRadeonT 540X|41\n@(TM) 530|41\n@ * 7560D + * 6670 Dual Graphics|41\n@ R7 240|41\n@(TM) R7 M360|41\n@ R9 M280X|41\n@ * 7520G + * 7600M Dual Graphics|41\n@(TM) R7 M445|41\n@ Vega 8 Mobile|40\n@(TM) R9 255|40\n@ R7 M260X|40\n@ R8 M535DX|40\n@ R7 240/340|40\n@(TM) R9 M375|40\n@(TM) R7 Graphics|40\n@(TM) R5 M420|40\n@ * 6750M|40\n@ R9 M265X|40\n@ R7 M340|40\n@ * 6570|40\n@ * 7500/7600 Series|39\n@ R7 430|39\nFirePro W2100|39\n@ * 7730M|39\n@ * 8670D|39\n@ R5 M255|39\n@ * 7560D + * 6570 Dual Graphics|39\n@ ^ Vega|39\n@ R7 240 Series|39\n@(TM) R7 M445|39\n@ * 6800M Series|39\n@ * 8690M|39\n@ * 7660D + * 6570 Dual Graphics|39\n@ R7 M370|39\n@(TM) * 6650M|38\n@ R5 M435|38\n@ * 6500 Series|38\n@ R7 Graphics|38\nFirePro M7820|38\n@(TM) R8 M445DX Graphics|38\n@ * 5570|38\n@ * 8650G + 8750M Dual Graphics|38\n@ * 8670A/8670M/8750M|38\n@ * 6650M|38\n@ R7 M260 Series|38\n@ * 7660G + 7600M Dual Graphics|38\n@ * 7600M Series|38\n@ * 7670M|37\n@. * 7670M|37\n@(TM) R7 M265|37\nMobility @ * 5000|37\n@ * 7500M/7600M Series|37\n@ R5/R6/R7 Graphics|37\n@ R7 M270|37\n@ * 8650G + * 7600M Dual Graphics|37\nFirepro M5100|37\n@ * 7730M|37\n@ * 8570D|37\n@(TM) * 7650A Graphics|37\n@ R7 Graphics|37\n@(TM) ^ Vega 10 Graphics|37\n@ * 7600A Series|36\n@ R7 M270|36\n@ * 7660D + * 6670 Dual Graphics|36\n@ * 7570M/* 7670M Graphics|36\n@ 6600M and 6700M Series|36\n@ R7 Graphics + R7 200 Dual Graphics|36\n@ * 7570 Series|36\n@ * 8750M|36\n@ * 6550D|36\nFirePro M5950|36\n@ * 7660G + 7600M Dual Graphics|36\n@ * 6550D|36\n@ * 7600M/7700M Series|36\n@(TM) Vega 3 Graphics|36\n@(TM) 625|36\nMobility @ * 5570|36\n@ HD8730|36\n@(TM) R9 M380|36\n@(TM) R5 240|36\n@ * 7650M|35\n@ * 7560D|35\n@ * 8690M|35\n@ * 8650G + 8750M Dual Graphics|35\n@ * 8650G + * 8750M Dual Graphics|35\n@ * 8650G + * 8570M Dual Graphics|35\n@ * 6570|35\n@ * 7650M|35\n@ * 6630M/6650M/6750M/7670M/7690M|35\n@ * 6500 Series|35\n@(TM) 520|35\n@ * 8570D|35\n@ * 7600M Series|35\n@ R7 Graphics|35\n@ * 7660G + 8670M Dual Graphics|35\n@ R7 200 Series|35\n@ * 6630M/6650M/6750M/7670M/7690M|35\n@ R7 M265|35\n@ * 8650G + * 8750M Dual Graphics|35\n@ * 8650G + 8670M Dual Graphics|35\n@ R7 Graphics|34\n@ * 6630M Series|34\n@(TM) 520|34\n@ * 7660D|34\nASUS R7 240 Series|34\n@ R9 M280X|34\n@(TM) R5 340|34\n@ * 8550G + 8600/8700M Dual Graphics|34\n@ R7 Graphics|34\n@(TM) * 8500M/8700M|34\n@ * 7660G + * 7600M Dual Graphics|34\n@ * 7670M|34\n@(TM) R5 M430|34\n@ * 8650G + 8500M Dual Graphics|34\n@(TM) R5 340X|34\n@(TM) R5 230 series|34\n@ * 8550|34\nFirePro W2100 (FireGL V)|34\nFirepro M4100 FireGL V|34\n@ * 6550D|34\n@ * 6630M|34\n@(TM) R9 M375|34\n@ * 5670 OpenGL Engine|33\n@ * 5670|33\n@ R7 Graphics|33\n@ * 7660G|33\n@ * 5570|33\n@ * 7550M/7650M Graphics|33\n@ * 7660D|33\n@ * 7560D|33\n@ * 7560D|33\n@ R5 M445 Series|33\n@ R5 M315|33\n@ * 8570D|33\n@ R7 M265|33\n@ * 7640G + * 7500/7600 Dual Graphics|33\n@ R7 Graphics|33\n@ * 8500M Series|33\nMobility @ * 5000|33\n@(TM) R7 M360|33\nFirepro M4100|33\n@(TM) Vega 10 Graphics|32\n@ * 7500M/7600M Series|32\n@ * 8550G + * 8600/8700M Dual Graphics|32\n@ * 7660G|32\n@ * 7350|32\n@ * 8470D + * 6450 Dual Graphics|32\n@ R7 Graphics|32\n@ * 8730M|32\n@ * 7640G + * 7400M Dual Graphics|32\n@ * 8690A|32\n@ * 8650G + 8600/8700M Dual Graphics|32\n@ R7|32\n@(TM) Vega 11 Graphics|32\n@(TM) Vega 8 Graphics|32\n@ R5 M200 Series|32\n@(TM) R5 M335|32\n@(TM) R5 M430|32\n@ * 8550G + * 8570M Dual Graphics|32\n@ * 7650M Series|32\n@ R7 250 Series|32\n@(TM) R7 M460|32\n@ * 6550D|32\n@ * 7660G + * 7600M Dual Graphics|32\n@(TM) Vega 3 Graphics|32\n@ * 8470D|32\n@ R8 M365DX|31\nMadison [Mobility @ * 5650/5750 / 6530M/6550M]|31\n@ * 6630M/6650M/6750M/7670M/7690M|31\n@ R7 Graphics|31\n@ E6760|31\n@ R7 Graphics|31\n@(TM) Vega 8 Graphics|31\n@(TM) R5 M330|31\n@ * 8670A/8670M/8690M|31\n@ R7 A360|31\n@ * 8650G + * 8600M Dual Graphics|31\n@ R5 M200 / * 8500M Series|31\n@(TM) R8 M435DX|30\n@ * 7640G + * 7670M Dual Graphics|30\n@(TM) Vega 10 Mobile Graphics|30\n@ R7 Graphics|30\n@ Pro 450/550|30\n@ * 8800M Series|30\n@ * 8470D|30\n@ * 7660D|30\n@ * 8610G + * 8600M Dual Graphics|30\n@ * 7660G + 7670M Dual Graphics|30\n@(TM) Vega 8 Mobile Graphics|30\n@ 610 Series|30\n@(TM) R5 M330|30\n@ * 7660G|30\n@ * 7640G|30\n@ R8 M365DX|30\n@ * 8550G|29\n@ * 7540D|29\n@ * 7640G|29\n@ * 8650G|29\n@(TM) R7 Graphics|29\n@(TM) ^ Vega 11 Graphics|29\n@ * 6650M|29\n@ * 7660G|29\n@ 6600M and 6700M Series|29\n@ * 7640G + * 7400M Dual Graphics|29\n@(TM) R5 340X|29\n@ R5 435|29\n@ * 6500M/5600/5700 Series|29\nFirepro M4100 FireGL V|29\n@ R7 Graphics|29\n@(TM) 535|29\n@ R7 240 Series|29\n@(TM) R7|29\n@ * 8550G + 8500M Dual Graphics|28\n@(TM) 530|28\n@ * 5650 Series|28\n@ * 7570M|28\n@ * 7570M|28\nASUS R7 240 Series|28\n@ * 6570|28\n@(TM) Vega 8 Graphics|28\n@ E8860|28\n@(TM) 530 series|28\n@(TM) R5 M315|28\n@ * 5500 Series|28\n@ * 8610G + * 8670M Dual Graphics|28\n@(TM) R6|28\n@ R9 M275X|28\n@ * 8550G + R5 M230 Dual Graphics|28\n@ * 8470D|28\n@ * 8670D|28\n@ * 7620G|28\n@(TM) R8 M350DX|28\n@ * 8470D|27\n@(TM) R8 M445DX|27\n@(TM) R7 Graphics|27\n@(TM) R5 Graphics|27\n@(TM) R7 M340|27\n@(TM) R6 Graphics|27\n@ R6 Graphics|27\n@ R5 M230 Series|27\n@ * 8650G|27\n@ * 7480D|27\n@(TM) R8 M445DX Graphics|27\n@(TM) R6 Graphics|27\n@ R7 Graphics|27\n@ R6|27\n@ R5 M255|27\n@(TM) Vega 3 Graphics|27\n@ 550X|27\n@(TM) Vega 3 Graphics|27\n@ * 7500/7600 Series|27\n@ * 8650G|27\n@ * 5500 Series|27\n@ * 7610M|27\n@ Instinct MI25 MxGPU|27\n@(TM) HD8530M|27\n@ R7 M260|27\n@(TM) R8 M445DX|27\n@ R7 Graphics|26\n@ * 8500M|26\n@(TM) R7 M260DX|26\n@ * 8410G|26\n@ * 8670A/8670M/8690M|26\n@(TM) R7 M360|26\n@(TM) R7 M360|26\n@ * 8670D|26\n@ R9 M275|26\n@ * 7640G|26\n@(TM) R7 Graphics|26\nMxGPU|26\n@ * 8370D|26\n@ * 6620G|25\n@ * 7560D|25\n@ * 8570 / R5 430 / R7 240/340 / @ 520|25\n@ R4 Graphics|25\n@ R6 Graphics|25\n@ R7 Graphics|25\n@(TM) 535DX|25\n@(TM) 540 Graphics|25\n@(TM) R5 M330|25\n@ * 6530D|25\n@ R6 Graphics|25\n@ * 8510G|25\n@ * 6620G|25\n@ R7 M360|24\n@(TM) R6 Graphics|24\n@ R7 M260|24\n@ * 8610G + * 8600M Dual Graphics|24\n@(TM) R6 Graphics|24\n@ R5 M200 / * 8500M Series|24\n@ R7 Graphics|24\n@ * 7600G|24\n@ R7 Graphics|24\n@ * 6620G|24\n@ R5 M330|24\n@(TM) R5 240|24\n@(TM) * 6620G|24\nFirePro V3800 (FireGL V)|24\n@ * 6520G|24\n@ R7 Graphics|24\n@ * 7520G|24\n@(TM) R6 Graphics|24\n@(TM) R7 M260|24\n@ ^ 540 Series|24\n@(TM) R5 M320|24\n@ * 8500M|23\n@ R5 M230|23\n@ * 8670M|23\n@ * 8550G + * 8750M Dual Graphics|23\n@ * 8600M Series (HAINAN, DRM 3.40.0, 5.11.13-arch1-1, LLVM 11.1.0)|23\n@ * 8550G|23\n@ R5 M240|23\n@ R5 M240 Series|23\n@ * 7540D|23\n@(TM) R5 M430|23\n@ R5 Graphics|23\n@(TM) R5 M430|23\n@ R6 Graphics|23\n@ * 7520G|23\n@ R7 Graphics|23\n@ * 8610G|22\nFirePro 3800 (FireGL) Graphics Adapter|22\n@ * 7570M/* 7670M Graphics|22\n@ * 7480D|22\n@(TM) R7 Graphics|22\n@ * 8650G + * 8600M Dual Graphics|22\n@(TM) Vega 6 Graphics|22\n@ R7 Graphics|22\n@ R5 Graphics|22\n@ * 7660G + * 8600M Dual Graphics|22\nFirePro M2000|22\n@ R7 Graphics|22\n@ * 7870M|22\n@ R5 M335|22\n@ R5|22\n@ * 8500M Series|22\n@(TM) * 8490|22\n@ * 8670M|22\n@ * 7660G + * 7670M Dual Graphics|22\n@ 7500M/7600M Series|22\n@ R5 Graphics|21\n@(TM) R4 Graphics|21\n@ * 8490|21\n@ * 8490|21\n@ R7 Graphics|21\n@ * 8570M|21\n@(TM) R5 M320|21\n@ R2|21\n@ * 6530D|21\n@(TM) * 6470M|21\nMxGPU|21\n@ * 7000 series|21\n@ * 7470|21\n@(TM) R8 M350DX|21\n@ R7 Graphics|21\n@ * 7520G + * 7400M Dual Graphics|21\n@(TM) R5 M335|21\n@ * 7400G|21\n@ * 7640G + * 8500M Dual Graphics|21\n@ * 7000 series|21\n@(TM) R5 Graphics|20\n@(TM) R7 M520 (R17M-M1-30)|20\n@ * 8470|20\n@ * 7480D|20\n@ * 6400M/7400M Series|20\n@(TM) R3 Graphics|20\n@ R6 M255DX|20\n@ * 8370D|20\n@ R5 Graphics|20\n@ R7 Graphics|20\n@ * 6410D|20\n@(TM) R5 Graphics|20\n@ R5 M330|20\n@ R7 M260DX|20\n@(TM) R5 Graphics|20\n@ * 7480D|20\n@ * 6470M|20\n@ Hybrid (Blocked)|20\n@(TM) R7 Graphics|20\n@(TM) R6 M340DX|20\n@ R5 235|20\n@ * 7520G|19\n@(TM) R6 M255DX|19\n@ R5 M240|19\n@(TM) R3 Graphics|19\n@ R7E Graphics|19\n@ R5 M200 Series|19\n@ * 7470|19\n@ * 7640G + 8500M Dual Graphics|19\n@(TM) R5 M330|19\n@ * 6470M|19\n@ R3 Graphics|19\n@ * 8400E|19\n@ * 7640G + * 8570M Dual Graphics|19\n@ * 8400|19\n@ * 8400 / R3 Series|19\n@ R5 Graphics|19\n@(TM) R7 M265|19\n@ R5 M230|19\n@ R5 Graphics|19\n@ * 7620G|19\n@ R5 Graphics|19\n@(TM) * 6470M|19\n@ * 7480D|18\n@ R7 Graphics|18\n@(TM) R5 Graphics|18\n@ * 8550G|18\n@ * 8370D|18\n@ R5 Graphics|18\n@(TM) * 7450|18\n@ * 6530D|18\n@ * 8570M|18\n@ R6 Graphics|18\n@ * 7650A|18\n@ * 8450G|18\n@ * 8550G + R5 M230 Dual Graphics|18\n@ * 7640G + 7470M Dual Graphics|18\n@ * 8370D|18\n@ * 7400M Series|18\n@ * 8670D + R5 200 Dual Graphics|17\n@ * 7500G|17\n@ * 7790|17\n@ * 7450M|17\n@(TM) * 7450A Graphics|17\n@(TM) R5 Graphics|17\n@(TM) R6 Graphics|17\n@(TM) R4 Graphics|17\n@ * 8650G + * 8500M Dual Graphics|17\n@ * 7400M Series|17\n@ * 8450G|17\n@ * 6520G|17\n@ * 8470D|17\n@(TM) R5 Graphics|17\n@(TM) R4E Graphics|17\n@ * 8330|17\n@ * 8400|17\n@(TM) * 8510G|17\n@(TM) R5 Graphics|17\n@ * 8650G|17\n@ * 6490M|17\n@ R7 Graphics|16\n@ * 6400 Series|16\n@ * 8510G|16\n@ * 7400 Series|16\n@ * 7400 Series|16\n@(TM) * 8510G|16\n@ * 6370D|16\n@ * 7420G|16\n@ * 7520G + * 7600M Dual Graphics|16\n@ R9 260|16\n@ * 7640G + 7600M Dual Graphics|16\n@ * 7470M|16\n@(TM) R2 Graphics|16\nRADEON * 6450|16\n@(TM) R1E Graphics|16\n@ R5 Graphics|16\n@ * 7420G|16\n@(TM) R4 Graphics|16\n@(TM) R4 Graphics|16\n@(TM) R4 Graphics|16\n@ * 7480D|16\n@ * 6490M|15\nRADEON * 6450|15\n@(TM) * 8610G|15\n@(TM) * 8610G|15\n@ * 8610G + 8600M Dual Graphics|15\n@ * 7350|15\n@(TM) * 6480G|15\n@ * 8650G + 8600M Dual Graphics|15\n@ * 8570D|15\n@ * 6370M|15\nMobility @ * 5000 Series|15\n@ R2 Graphics|15\n@ * 8240 / R3 Series|15\n@ * 8650G + R5 M200 Dual Graphics|15\n@ * 8400E|15\n@(TM) R4 Graphics|15\n@ R5 Graphics|15\n@ * 8610G|15\n@ * 8650G + * 8500M Dual Graphics|15\n@(TM) R7 M260|15\nASUS EAH6450 Series|15\n@ R3 Graphics|15\n@(TM) R6 M340DX|15\n@ R6E Graphics|15\n@ R5 Graphics|15\n@ R2 Series|14\n@ * 6450/7450/8450/R5 230|14\n@ * 8200 / R3 Series|14\n@(TM) R3 Graphics|14\n@ R5 230|14\n@(TM) * 8510G|14\n@(TM) R4 Graphics|14\n@ R5 M435|14\n@ * 8240|14\nASUS R5 230 Series|14\nFirePro M2000|14\n@ * 7500G|14\n@ * 7450|14\nRADEON * 6450|14\n@ * 8400E|14\nRADEON * 6350|14\n@ * 6480G|14\n@(TM) R5E Graphics|14\nCARRIZO 9874|14\nMobility @ * 5000 Series|14\n@ * 6630M|14\n@ * 6370M|14\n@ * 8400 / R3 Series|14\n@(TM) R2 Graphics|14\nASUS EAH6450 Series|14\n@ * 7470M|13\nMobility @ * 5470|13\nMobility @ * 5400 Series|13\n@(TM) R5E Graphics|13\n@(TM) R2 Graphics|13\n@ * 6540|13\n@ * 7450|13\n@ * 5450|13\n@ * 8600M Series|13\n@ * 8400 / R3 Series|13\nKaveri|13\n@(TM) * 6480G|13\n@ * 5400 Series|13\n@ * 8330|13\nRADEON * 6350|13\n@ R4/R5 Graphics|13\n@ * 7600G +™ * Dual Graphics|13\n@ R3 Graphics|13\nASUS R5 230 Series|13\n@(TM) R7 Graphics|13\n@ * 7620G|13\n@ * 8250|13\n@(TM) R7 Graphics|12\n@ * 6450/7450/8450 / R5 230|12\n@ * 6480G|12\n@(TM) R7 Graphics|12\n@ * 5450 Series|12\n@ * 8400 / R3 Series|12\n@(TM) * 6400 Series|12\n@(TM) R4 Graphics|12\nRADEON HD5450|12\n@ R5 Graphics|12\n@ R5 Graphics|12\n@(TM) R6 Graphics|12\n@(TM) R4 Graphics|12\n@(TM) R2 Graphics|12\n@ * 8210|12\n@ R5 230|12\n@ R3 Graphics|12\nFirePro 2270|12\n@(TM) R2E Graphics|12\n@ * 8400 / R3 Series|12\n@ * 8350G|12\n@ * 8400|12\n@ R2 Graphics|12\n@ * 8210 Graphics|12\n@ E6460|12\n@(TM) * 8280E|12\n@ R2 Graphics|11\n@ * 8450G + * 8750M Dual Graphics|11\n@ * 8330|11\n@ * 5470|11\n@ * 7600G + 7500M/7600M Dual Graphics|11\n@ R5 220|11\n@ * 8200 / R3 Series|11\n@ * 8240|11\n@ * 8400 / R3 Series|11\n@ * 8200 / R3 Series|11\n@ * 5450|11\n@(TM) 620|11\n@(TM) Vega 8 Mobile Graphics|11\n@ * 6530D|11\n@(TM) * 6520G|11\n@ * 6300M Series|11\nASUS EAH5450|11\n@ R5 220|11\n@ * 8250|11\n@ * 7340|11\n@ * 7340M|11\n@ * 8210|11\n@ * 7700 Series|10\n@ * 6380G|10\n@ * 5400 Series|10\n@ * 8240|10\n@ * 7640G + 7670M Dual Graphics|10\n@(TM) R6 Graphics|10\nASUS EAH5450 Series|10\n@ * 6320|10\n@ * 7340G|10\n@ * 6410D|10\n@ * 7340|10\n@ * 6320|10\n@(TM) R2 Graphics|10\n@ * 8180|9\nMobility @ * 5430|9\n@ R2 Graphics|9\n@ R2 Series|9\n@ * 8210|9\nFirePro 2270|9\n@ R2E Graphics|9\n@ * 7340|9\n@ * 6320|9\n@ * 7310|9\n@ * 6310|9\n@ R7 Graphics|9\n@ * 7310|8\n@ * 8250|8\n@ * 8180|8\n@ * 6630M|8\n@ * 6230|8\n@ * 6320|8\n@ * 6400M Series|8\n@ * 7290 Graphics|7\n@ * 6290|7\n@ * 6310|7\n@ * 8180|7\nASUS EAH5450 Series|7\n@(TM) R2 Graphics|6\n@ * 6310|6\n@ * 7500G|6\n@ * 8240 / R3 Series|6\n@ * 6250|6\n@ * 6380G|6\n@ * 6300M Series|5\n@ * 7310|5\n@ R3 Graphics|5\n@(TM) R6 Graphics|5\n@ * 6250|5\n@ * 6290|5\n@ * 6250|5\n@ * 7290 Graphics|4\n@ * 5000/6000/7350/8350 Series|3\n@ ^ Vega 56 OpenGL Engine|-1\nFirePro V4800 (FireGL) Graphics Adapter|-1\n@ * 7670M|-1\n@ * 8570D|-1\n7340:C5|-1\n@ * 8550G|-1\n@ R5 Graphics|-1\nASUS R7 360 Series|-1\nBonaire [FirePro W5100]|-1\n@ * 6380G|-1\n@ R7 Graphics|-1\nFireGL V8650|-1\nFirePro S7150|-1\nFirePro V3900 (FireGL V)|-1\nFirePro V7800 (FireGL V)|-1\nFirePro W4100 Graphics Adapter|-1\nFirePro W4170M (FireGL V)|-1\nGigabyte @ ^ 580|-1\nMobility FireGL V5700|-1\nMobility @ 4100|-1\nMobility @ * 2400|-1\nMobility @ * 2400 XT|-1\nMobility @ * 2600|-1\nMobility @ * 2600 XT|-1\nMobility @ * 3200|-1\nMobility @ * 3400 Series|-1\nMobility @ * 3430|-1\nMobility @ * 3470|-1\nMobility @ * 3650|-1\nMobility @ * 4200 Series|-1\nMobility @ * 4250|-1\nMobility @ * 4300 Series|-1\nMobility @ * 4500 Series|-1\nMobility @ * 4500/5100 Series|-1\nMobility @ * 4650|-1\nMobility @ * 4670|-1\nMobility @ * 4850|-1\nR9 270X Devil|-1\n^ 560X|-1\n@|-1\n@(TM) HD8530M|-1\n@ 3000|-1\n@ 3100 Graphics|-1\n@ * 2400 PRO|-1\n@ * 2400 XT|-1\n@ * 2600 Pro|-1\n@ * 2600 XT|-1\n@ * 2900 GT|-1\n@ * 3200 Graphics|-1\n@ * 3300|-1\n@ * 3450|-1\n@ * 3470|-1\n@ * 3600 Series|-1\n@ * 3650|-1\n@ * 3850|-1\n@ * 3870|-1\n@ * 3870 X2|-1\n@ * 4200|-1\n@ * 4250|-1\n@ * 4290|-1\n@ * 4300/4500 Series|-1\n@ * 4550|-1\n@ * 4600 Series|-1\n@ * 4650|-1\n@ * 4670|-1\n@ * 4830|-1\n@ * 4850|-1\n@ * 4870|-1\n@ * 4890|-1\n@ * 5670 640SP Edition|-1\n@ * 5800 Series|-1\n@ * 5850|-1\n@ * 6490M|-1\n@ * 6730M/6770M|-1\n@ * 6750|-1\n@ * 6800M Series|-1\n@ * 7540D + * 6670 Dual Graphics|-1\n@ * 7700M Series|-1\n@ * 7800 Series|-1\n@ * 8350|-1\n@ * 8370D|-1\n@ * 8600/8700M|-1\n@ Pro WX Vega M GL Graphics|-1\n@ R5 200 Series|-1\n@ R7 A370|-1\n@ R9 200 Series|-1\n@ R9 290X/390X|-1\n@ R9 380X|-1\n@ ^ 480|-1\n@ ^ 550X|-1\n@ ^ 6650M|-1\n@ RX6600XT|-1\n@(TM) R8 M435DX|-1\n@(TM) R9 290X|-1\n@(TM) RX540|-1\ninc. @ * 7970|-1\nRadeong 0.4 on AMD CAPE VERDE (DRM 2.43.0, LLVM 3.7.0)|-1\nRadeong 0.4 on AMD CAPE VERDE (DRM 3.9.0 / 4.9.0-rc1+, LLVM 4.0.0)|-1\nRadeong 0.4 on AMD FIJI (DRM 3.2.0 / 4.7.0-rc5+, LLVM 4.0.0)|-1\nRadeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1\n";let y=[],_=[],T=[];function b(e){if(!e)return 0;const t=function(e){if(e===p.V.Intel&&y.length)return y;if(e===p.V.Nvidia&&_.length)return _;if(e===p.V.Amd&&T.length)return T;try{const t=function(e){return e===p.V.Intel?g:e===p.V.Nvidia?m:e===p.V.Amd?v:""}(e),n=(0,p.b)(t,e);return e===p.V.Intel&&(y=n),e===p.V.Nvidia&&(_=n),e===p.V.Amd&&(T=n),n}catch{}return[]}(e.vendor);return(0,p.a)((0,p._)(t,e))}const S=class e{static setConfig(t){e.cfg=t}static getGPUVendor(){return(0,p.g)(e.cfg)}static getGPUParsedVendor(t){return(0,p.p)(t||e.getGPUVendor())}static parseVendor(t){try{const n=e.getGPUParsedVendor(t);return n?{...n,score:b(n)}:null}catch{}return null}};(e=>{"cfg"in e?f(e,"cfg",{enumerable:!0,configurable:!0,writable:!0,value:null}):e.cfg=null})(S);let P=S;var M=Object.defineProperty,w=(e,t,n)=>((e,t,n)=>t in e?M(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class E{constructor(){w(this,"origin",""),w(this,"score",0)}getScore(){return new Promise((e=>{e(this.getScoreSync())}))}getScoreSync(){const e=P.parseVendor();return e?(this.score=e.score,this.origin=e.origin,{origin:this.origin,score:this.score,vendorParsedInfo:e}):{origin:this.origin,score:this.score}}}var k=Object.defineProperty;class D{constructor(e){((e,t,n)=>{((e,t,n)=>{t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n)})(this,"mappingFn"),this.mappingFn=e.mapping}getScore(){return new Promise((e=>{e(this.getScoreSync())}))}getScoreSync(){try{const e=navigator.deviceMemory;let t=0;return this.mappingFn&&(t=this.mappingFn(e)),{score:t,origin:e}}catch{return{score:0,origin:-1}}}}var R=Object.defineProperty,x=(e,t,n)=>((e,t,n)=>t in e?R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class C{constructor(e){x(this,"mappingFn"),this.mappingFn=e.mapping}getScore(){return new Promise((e=>{e(this.getScoreSync())}))}getScoreSync(){var e;try{const t=null==(e=null==navigator?void 0:navigator.connection)?void 0:e.downlink;let n=0;return this.mappingFn&&(n=this.mappingFn(t)),{score:n,origin:t}}catch{return{score:0,origin:-1}}}}class I{constructor(e){x(this,"mappingFn"),this.mappingFn=e.mapping}_getBandwidth(){if(!performance.getEntries)return-1;const e=performance.getEntries().filter((({initiatorType:e,decodedBodySize:t,responseEnd:n,responseStart:i})=>("img"===e||"script"===e)&&t>0&&n!==i)),t=e.reduce(((e,{decodedBodySize:t,responseEnd:n,responseStart:i})=>{const r=8e3*t/(n-i)/1024/1024;return e+(r<1e5?r:0)}),0);return e.length?t/e.length:-1}getScore(){return new Promise((e=>{e(this.getScoreSync())}))}getScoreSync(){try{const e=this._getBandwidth();let t=0;return this.mappingFn&&(t=this.mappingFn(e)),{origin:e,score:t}}catch{return{score:0,origin:-1}}}}const L="xg-decodeimg-scores-map",O=()=>{let e={};try{const t=localStorage.getItem(L);t&&(e=JSON.parse(t))}catch{}return e},A=(e,t)=>{let n=[];return t&&e[t]&&(n=e[t]),n},G=e=>{let t=0;return e>0&&(t=e<=1?0:e<4?3*Math.log2(e):e<8?1.6*(Math.log2(e)-2)+6:.523*(Math.log2(e)-3)+7.6),t},$=e=>(t,n)=>{let i=0;if(!e)return i;const r=(e=>{const t=new URL(e);return t.origin+t.pathname})(e);if(t>0){const e=Math.log10(t+1);i=e<=1?6*e:e<=2?1.6*(e-1)+6:2.4*(e-2)+7.6,i=Math.round(100*i)/100,i=((e,t)=>{try{let n=e;const i=O(),r=A(i,t);return r.length>0?(r.push(e),n=r.reduce(((e,t)=>e+t),0)/r.length,r.length>10&&r.shift()):r.push(e),t&&(i[t]=r),(e=>{try{localStorage.setItem(L,JSON.stringify(e))}catch{}})(i),n}catch{return e}})(i,r)}else!0!==n&&(i=(e=>{const t=O(),n=A(t,e);let i=0;return n.length>0&&(i=n.reduce(((e,t)=>e+t),0)/n.length),i})(r));return i},N=e=>{let t=0;return e>0&&e<1e6&&(t=e>64?6-1.5*(Math.log2(e)-6):e>8?7.6-.533*(Math.log2(e)-3):7.6+.03*(8-e)),t},B=e=>{let t=0;return e>1&&(t=e<=4?3*Math.log2(e):e<8?2*(Math.log2(e)-2)+6:.65*(Math.log2(e)-3)+8),t},F=e=>{let t=0;return e>0&&e<1e6&&(t=e<=1?0:e<10?6*Math.log10(e):10),t},U=e=>{let t=0;return e>0&&e<1e6&&(t=e<=1?0:e<40?3.745*Math.log10(e):e<100?4.02*(Math.log10(e)-1.602)+6:5.03*(Math.log10(e)-2)+7.6),t};class H extends o{constructor(e){var t;super((t=e.decodeImgUrl,{plugins:{performance:{plugins:{cpu:{plugins:{cpuCoreNumber:{instance:new u({mapping:G})},decodeImg:{instance:new d({url:t,mapping:$(t)})},timer:{instance:new h({mapping:N})}}},memory:{instance:new D({mapping:B})},gpu:{instance:new E}}},net:{plugins:{downlink:{instance:new C({mapping:F})},performanceNet:{instance:new I({mapping:U})}}}}}))}scoreAsync(){return this.getScore()}scoreSync(e){return this.getScoreSync(e)}}},4629:(e,t,n)=>{n.d(t,{lg:()=>d,Zo:()=>u});var i=n(6607),r=Object.defineProperty;let s=[],a=[],o=[];const l=class e{static setConfig(t){e.cfg=t}static getGPUVendor(){return(0,i.g)(e.cfg)}static getGPUParsedVendor(t){return(0,i.p)(t||e.getGPUVendor())}static parseVendorAsync(t){const n=e.getGPUParsedVendor(t);if(!n)return Promise.resolve(null);if(!e.cfg)throw new Error("need specify config, call setConfig() method");return function(e,t){return e?async function(e,t){let n;if(e===i.V.Intel){if(s.length)return s;n=t.intelPath}if(e===i.V.Nvidia){if(a.length)return a;n=t.nvidiaPath}if(e===i.V.Amd){if(o.length)return o;n=t.amdPath}if(!n)return Promise.resolve([]);try{const t=await fetch(n).then((e=>e.text())),r=(0,i.b)(t,e);return e===i.V.Intel&&(s=r),e===i.V.Nvidia&&(a=r),e===i.V.Amd&&(o=r),r}catch{}return[]}(e.vendor,t).then((t=>(0,i._)(t,e))).then(i.a):Promise.resolve(0)}(n,e.cfg).then((e=>({...n||{},score:e}))).catch((()=>null))}};((e,t)=>{t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:null}):e[t]=null})(l,"cfg");let c=l;function u(){let e=!1;if(typeof MediaSource>"u"||!MediaSource.isTypeSupported||function(){if(typeof navigator>"u")return!1;const e=navigator.userAgent.match(/Edg\/(\d+)\./);if(e&&e.length>=2){const t=parseInt(e[1]);return t>=117&&t<=122}return!1}())return e;if(e=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"'),e){const t=c.getGPUParsedVendor();e=!!t&&t.vendor!==i.V.CpuDeriver}return e}async function d(e){const{url:t,minDroppedFramesRate:n,minTotalVideoFrames:i}=Object.assign({url:"",minDroppedFramesRate:0,minTotalVideoFrames:0},e);let r,s,a,o;const l=new Promise((e=>{function l(t=1001,n){e({status:!1,errCode:t,robustErr:2101===t||2001===t||3e3===t,...n||{}})}!t||0===n&&0===i?l(1e3):(s=()=>{let t="";try{if(!r.getVideoPlaybackQuality)return l(2001);const{totalVideoFrames:t,droppedVideoFrames:s}=r.getVideoPlaybackQuality(),a=s/t,o={droppedFrameRate:a,droppedVideoFrames:s,totalVideoFrames:t};return void((n?a<=n:i&&t>i)?e({status:!0,...o}):l(3e3,o))}catch(e){t=(null==e?void 0:e.message)||e||"empty err msg"}l(2200,{errMsg:t})},a=()=>{const e=r.error;l(2e3,{errMsg:`${e.code}-${e.message}`})},o=()=>{const e=r.play();e&&e.then((e=>{})).catch((e=>{const t=e.message;let n=2100;/no supported source/gi.test(t)||/The media resource indicated by the src attribute or assigned media provider object was not suitable/gi.test(t)||/NotSupportedError/gi.test(t)?n=2101:/video-only background media was paused to save power/gi.test(t)?n=2103:(/the user didn't interact with the document first/gi.test(t)||/user denied permission/gi.test(t))&&(n=2102),l(n,{errMsg:t})}))},r=function(e){const t=document.createElement("video");return t.style.cssText="width:50px;height:50px;position:absolute;top:0;left:0;z-index:999999;opacity:.001;pointer-events:none;",t.muted=!0,t.autoplay=!1,t.src=e,t}(t),r.addEventListener("loadedmetadata",o,!1),r.addEventListener("ended",s,!1),r.addEventListener("error",a,!1),r.load(),document.body.append(r))}));return l.finally((()=>{r&&(s&&a&&o&&(r.removeEventListener("loadedmetadata",o,!1),r.removeEventListener("ended",s,!1),r.removeEventListener("error",a,!1),s=null,a=null,o=null),document.body.removeChild(r),r=null)})),await l}},57206:(e,t,n)=>{n.d(t,{M:()=>C,a:()=>P,b:()=>E,m:()=>R});var i=n(9141),r=n(28334),s=n(4629),a=n(69805),o=n(24220);function l(){return void 0===typeof window}function c(e,t=2){return Math.floor(e*Math.pow(10,t))/Math.pow(10,t)}const u=['video/mp4; codecs="hvc1.1.L0.0"','video/mp4;codecs="hev1.1.6.L120.90"','video/mp4;codecs="hev1.2.4.L120.90"','video/mp4;codecs="hev1.3.E.L120.90"','video/mp4;codecs="hev1.4.10.L120.90"'];function d(){if(l())return!1;const e=window.navigator.userAgent;if(!/iPad|iPhone|iPod/.test(e)){if(null==window||!window.MediaSource)return!1;let e=!1;return u.forEach((t=>{e=e||(null==window?void 0:window.MediaSource.isTypeSupported(t))})),e}try{const e=document.createElement("video");return u.map((t=>e.canPlayType(t))).some((e=>"probably"===e||"maybe"===e))}catch{return console.error("check hevc error"),!1}}const h="ttplayer_focus_disable_hevc",p=6048e5,f="ttplayer_hevc_result",g=["CpuDeriver","Unknow"],m="MultiMediaHevcPloy",v=["video_detail","one_column","browser_mode"],y=["video_detail","homepage_hot","homepage_follow","others_homepage"],_=["Intel","AMD","NVIDIA","Apple"];function T(e,t=1,n=[]){return!(!e||"unknown"===e)&&((!n||n.length<1)&&(n=2===t?y:v),n.filter((t=>e===t)).length>0)}function b(e,t=[]){return!(t.length<1||!e)&&t.filter((t=>e===t)).length>0}function S(e,t,n,i){const r=T(e,2,n),s=T(t,1,i);return r&&s}class P{constructor(){this.softResultLocal=!1,this.dropedRate=0,this.hevcDropedRate=0,this.minDif=10,this.minFrames=60,this.maxDropedRate=10,this.forceNotHevc=!1,this._needPersist=!0,this.hevcDisableInfo={hevcMsg:"",hevcCode:0,hevcF:0,softMsg:"",softCode:0,softF:0},this.effectiveConditions={},this.robustnessTestResult=!1,this.configure={url:"",minDroppedFramesRate:.1,minTotalVideoFrames:10},this.hevcRobustnessResult={isSupportBase:!1,supportRobustness:"unknown",droppedFrameRate:0,droppedVideoFrames:0,totalVideoFrames:0,status:!1,errCode:0,errMsg:"",robustErr:!1,date:0};const e=this.getLocalDisableInfo();if((0,a.l)(m,"localDisableInfo",e),e)if(this.forceNotHevc=0!==e.hevcCode,this.softResultLocal)this.hevcDisableInfo={...e,hevcF:3,softF:3};else{const{softMsg:t,softCode:n}=this.hevcDisableInfo;this.hevcDisableInfo={...e,hevcF:3,softCode:n,softMsg:t,softF:0}}this.detectCallBack=null}getLocalDisableInfo(){try{const e=(0,a.g)(h);if(e){const t=e;return{hevcMsg:t.hevcMsg||"",hevcCode:t.hevcCode||0,hevcF:t.hevcF||0,softMsg:t.softMsg||"",softCode:t.softCode||0,softF:t.softF||0}}return null}catch{return null}}getLocalHevcResult(){const e=(0,a.g)(f);if(!e)return null;try{return e}catch{return null}}set needPersist(e){this._needPersist=e,e||(0,a.r)(f)}get needPersist(){return this._needPersist}setRobustnessResult(e){const{hevcRobustnessResult:t}=this;if(e.errCode?(t.errCode=e.errCode,t.errMsg=e.errMsg,t.robustErr=e.robustErr,t.status=e.status,t.supportRobustness="error"):(t.droppedFrameRate=e.droppedFrameRate,t.droppedVideoFrames=e.droppedVideoFrames,t.totalVideoFrames=e.totalVideoFrames,t.status=e.status,t.supportRobustness=e.status?"supported":"unSupported"),t.date=(new Date).getTime(),this.detectCallBack){const{forceNotHevc:e,hevcRobustnessResult:t}=this,n=(function(){if(typeof navigator>"u")return!1;try{if("1"===localStorage.getItem("isSoftwareDecoding"))return!0}catch{return!1}}()||(0,s.Zo)())&&d()&&!e&&!!t.status;this.detectCallBack(n)}}static getInstance(){return P.instance||(P.instance=new P),P.instance}static setDropRate(e,t,n){(0,a.l)(m,"setDropRate",e,t,n);const i=P.getInstance();if(t<1||nl||s>c)&&(i.forceNotHevc=!0)}static useHevc(e=1){const{forceNotHevc:t,hevcRobustnessResult:n}=P.getInstance(),i=(0,s.Zo)()&&d()&&!t;return e<2?i:i&&n.status}static focusDisableHevc(e,t=!0){const n=P.getInstance();if(!n||n.forceNotHevc)return void(n.hevcDisableInfo.hevcF=2);n.forceNotHevc=!0;const{hevcDisableInfo:i}=n;i.hevcCode=e.hevcCode,i.hevcMsg=e.hevcMsg,i.hevcF=1,(0,a.l)(m,"focusDisableHevc",t,n.forceNotHevc,e),t&&(0,a.s)(h,{...n.hevcDisableInfo,timestamp:(new Date).getTime()},p)}static setDetectCallback(e){P.getInstance().detectCallBack=e}static setEffectiveConditions(e){const t=P.getInstance();Object.keys(e).forEach((n=>{t.effectiveConditions[n]=e[n]}))}static getHevcDisableInfo(){const e=P.getInstance();if(!e)return null;const{hevcDisableInfo:t,hevcRobustnessResult:n}=e;return{...t,rcode:n.errCode||0,rmsg:n.errMsg||"",rstatus:n.status?1:0}}static forceDisableSoftHevc(e){const{hevcDisableInfo:t,softResultLocal:n}=P.getInstance();0===t.softCode?(t.softCode=e.code,t.softMsg=e.message,t.softF=1,(0,a.l)(m,"forceDisableSoftHevc",e),n&&(0,a.s)(h,{...t,timestamp:(new Date).getTime()},p)):t.softF=2}static async hevcDeviceDetect(e,t=2,n){const i=P.getInstance();let r=i.needPersist;void 0!==n&&(i.needPersist=n,r=n);const{configure:o,hevcRobustnessResult:l}=i;l.isSupportBase=(0,s.Zo)(),r||(0,a.r)(f);const c=i.getLocalHevcResult();if(l.date>0)return l;if(c)return i.setRobustnessResult(c),l;const u=e?"https://lf16-tiktok-web.tiktokcdn-us.com/obj/tiktok-web-tx/tiktok/webapp/main/webapp-desktop/playback1.mp4":"https://sf16-website-login.neutral.ttwstatic.com/obj/tiktok_web_login_static/tiktok/webapp/main/webapp-desktop/playback1.mp4";return void 0===typeof window?l:t<2||!u?(l.isSupportBase=(0,s.Zo)(),l):(l.date=(new Date).getTime(),o.url=u,void(0,s.lg)(o).then((e=>(i.setRobustnessResult(e),r&&e.status&&(0,a.s)(f,l,6048e5),l))).catch((e=>(i.setRobustnessResult(e),l))))}}function M(e){const{performance:t,net:n}=e;if(!t&&!n)return{score:0};const i={score:0};try{if(n){const{downlink:e={},performanceNet:t={},score:r=0}=n;i.link_s=c((null==e?void 0:e.score)||0),i.link_o=c((null==e?void 0:e.origin)||0),i.netper_s=c((null==t?void 0:t.score)||0),i.netper_o=c((null==t?void 0:t.origin)||0),i.net_s=c(r)}if(t){const{cpu:e,memory:n,gpu:r,score:s}=t,a=null==r?void 0:r.vendorParsedInfo;i.memory_s=c((null==n?void 0:n.score)||0),i.gpu_s=c((null==r?void 0:r.score)||0),i.gpu=(null==r?void 0:r.origin)||"",i.vendor=(null==a?void 0:a.vendor)||"",i.gpu_m=(null==a?void 0:a.model)||"",i.cpu_s=c((null==e?void 0:e.score)||0);const{cpuCoreNumber:o,decodeImg:l,timer:u}=e;i.core_s=c((null==o?void 0:o.score)||0),i.decdeimg_s=c((null==l?void 0:l.score)||0),i.decdeimg_o=c((null==l?void 0:l.origin)||0),i.timer_s=c((null==u?void 0:u.score)||0),i.timer_o=c((null==u?void 0:u.origin)||0),i.score=c(s||0)}return i}catch{return i}}function w(e){var t;const n=null==(t=null==e?void 0:e.performance)?void 0:t.gpu;if(!n)return null;const{vendorParsedInfo:i}=n;return{score:n.score||-2,gpu:n.origin||"",vendor:(null==i?void 0:i.vendor)||""}}class E{constructor(){this._asyncDate=0,this._syncDate=0,this.deviceScore=0,this.score=0,this.netScore=0,this.markData={},this.shortData={},this._mark=null,this.curImgUrl="",this.gpuScoreData={score:-2,vendor:"",gpu:""},!l()&&this.syncMark()}syncMark(){var e;if(0!==this._syncDate)return;this._mark||(this._mark=new o.r({decodeImgUrl:this.curImgUrl})),this._syncDate=(new Date).getTime(),this.markData=this._mark.scoreSync({ignoreCachedImg:!0});const t=M(this.markData);this.deviceScore=t.score,this.score=t.score,this.netScore=c(0|(null==(e=this.markData.net)?void 0:e.score)),this.shortData={...t,d_score:this.deviceScore};const n=w(this.markData);n&&(this.gpuScoreData=n)}async asyncMark(e){if(0!==this._asyncDate)return;this.curImgUrl=e?"https://lf16-tiktok-web.tiktokcdn-us.com/obj/tiktok-web-tx/tiktok/webapp/main/assets/perf_images/performance.jpeg":"https://sf16-website-login.neutral.ttwstatic.com/obj/tiktok_web_login_static/tiktok/webapp/main/assets/perf_images/performance.jpeg";const t=new o.r({decodeImgUrl:this.curImgUrl});this._mark=t,this._asyncDate=(new Date).getTime();const n=await(null==t?void 0:t.scoreAsync());this.markData=n;const i=M(n);this.shortData={...i,d_score:this.deviceScore},this.score=this.shortData.score;const r=w(n);r&&(this.gpuScoreData=r)}get markScore(){const{score:e,deviceScore:t,gpuScoreData:n,shortData:i}=this;return{score:e,deviceScore:t,gpuScoreData:n,shortData:i}}static getInstance(){return E.instance||(E.instance=new E),E.instance}static syncMark(){return E.getInstance().syncMark()}static async asyncMark(e){return E.getInstance().asyncMark(e)}static get shortData(){return E.getInstance().shortData}static get gpuScoreData(){return E.getInstance().gpuScoreData}static get markScore(){return E.getInstance().markScore}static markData(){return E.getInstance().markData}}class k{constructor(){this.config={t1:5,t2:20,minWeight:.2,maxCount:25,minSize:20480,maxSize:10485760},this._record=[]}updateConfig(e){this.config={...this.config,...e}}setSpeed(e){const{speed:t,size:n,duration:i}=e,{maxSize:r,minSize:s,maxCount:a}=this.config;!t||n<=0||i<=1||nr||(this._record.push({speed:t,size:n,duration:i,t:Date.now()}),this._record.length>a&&this._record.shift())}getTimeWeight(e,t){const{t1:n=5,t2:i=20,minWeight:r=.2}=this.config,s=Math.round((t-e)/1e3);return s<=n?1:s>=i?r:Math.round((100-100*r)/(i-n)*(i-s))/100}getSpeed(){const e=Date.now(),{_record:t}=this;let n=0;const i=t.map((t=>{const i=t.size*this.getTimeWeight(t.t||0,e);return n+=n,{weight:i,speed:t.speed}}));i.sort(((e,t)=>e.speed-t.speed));const r=n/2;let s=-1,a=-1;for(let e=0;e=0?i[s].speed:0}getAvgSpeed(){const{_record:e}=this;let t=0;for(let n=0;n0?Math.round(t/e.length):0}}const D="unknown",R=new r.A,x=class e{constructor(){this.isTTP=null,this.abTestVersion="",this.hevcAbVersion="",this.logInitInfo={},this.logConfig={},this.dropCount=0,this.totalCount=0,this.deviceMark=E.getInstance(),this.networkSpeed=new k,this.channelInfo={channel:"",domain:"",type:""},this.regionInfo={region:"",uid:"",isLogin:!1},this.hevcTestData={vid:"v0",open:!1,onlySrc:!1,score:-2,playModes:[],pageNames:[],qualityType:20,hevcQualityType:28,closePreload:!1,level:2},this.abTestData={},this.prePlayMode=D,this.curPlayMode=D,this.curPageName=D,this.prePageName=D}static get version(){return i.v}static set channelInfo(t){e.getInstance().channelInfo=t}static get channelInfo(){return e.getInstance().channelInfo}static set regionInfo(t){e.getInstance().regionInfo=t}static get regionInfo(){return e.getInstance().regionInfo}static set playMode(t){const{instance:n}=e;n.prePlayMode=n.curPlayMode,n.curPlayMode=t}static get playMode(){return e.getInstance().curPlayMode}static get prePlayMode(){return e.getInstance().prePlayMode}static set pageName(t){const n=e.getInstance();t!==n.curPageName&&(n.prePageName=n.curPageName,n.curPageName=t)}static get pageName(){return e.getInstance().curPageName}static get prePageName(){return e.getInstance().prePageName}static getInstance(){return e.instance||(e.instance=new e),e.instance}static checkHevcResult(t=!1){const{hevcTestData:n,curPageName:i,curPlayMode:r,deviceMark:s}=e.getInstance(),{gpuScoreData:a,score:o,deviceScore:l}=s,{device:c}=e;return function(e,t,n=!1){const{curPlayMode:i,curPageName:r,browser:s}=t,a=t.score||-2,o=t.vendor||"",l=t.dScore||-1,c={qualityType:20,hevcQualityType:28,open:!1,openSrc:!1,closePreload:!1,vid:(null==e?void 0:e.vid)||"v0",data:e},{effectiveConditions:u}=P.getInstance(),d=u[s];if(d||!e||"v1"===e.vid||"v0"===e.vid){const e=function(e,t,n){const i={open:!1,openSrc:!1,hevcQualityType:28},{score:r,dScore:s,deviceScore:a,curPageName:o,curPlayMode:l,cpuCore:c,vendor:u}=e,d=n,h=P.useHevc((null==d?void 0:d.checkLevel)||2);if(i.hevcQualityType=(null==d?void 0:d.hevcQualityType)||28,!h||!d||!c||c0&&d.score&&s>=d.score||a>0&&d.dScore>0&&a>=d.dScore||d.gpuScore>0&&r>=d.gpuScore||r<0&&b(u,_))&&(i.open=!0,i.openSrc=!0),i}(t,n,d);if(e.open)return{...c,...e}}const h=(null==e?void 0:e.level)||2;if(!P.useHevc(h)||!e||!e.open||a<-1||!o)return c;c.closePreload=e.closePreload;const{playModes:p=[],pageNames:f=[],closePreload:g=!1,onlySrc:m=!1}=e;let{qualityType:v,hevcQualityType:y}=e;28===v&&!y&&(v=20,y=28);const T=!!n||S(r,i,f,p);if(!T)return c;const M=function(e,t,n,i){const{score:r=-2,dScore:s=-2,vendor0:a=[],vendor1:o=[]}=i;return t>0&&s>=0?!t||s<=t:e>0?!r||r<=e:b(n,0===e?a:o)}(a,l,o,e)&&T;return{...c,qualityType:v,hevcQualityType:y||28,closePreload:g||!1,open:M&&!m,openSrc:M}}(n,{curPageName:i,curPlayMode:r,score:a.score||-2,vendor:a.vendor||"",dScore:o,deviceScore:l,cpuCore:c.cpu,browser:c.browserType},t)}static forceDisableHevc(e){var t;t=e,(0,a.l)(m,"forceDisableHevc",t),P.focusDisableHevc(t)}static checkSoftHevcResult(t,n=!1){const{curPageName:i,curPlayMode:r,deviceMark:a}=e.getInstance(),{gpuScoreData:o,score:l,deviceScore:c}=a,{device:u}=e;return function(e,t,n=!1){if(!e)return{open:!1};const{curPageName:i,curPlayMode:r,browser:a,dScore:o=0,vendor:l=""}=t,{pageNames:c=[],playModes:u=[],browsers:d=[],enableSoftwareH265:h=!1,deviceScore:p=0,needLocal:f=0,vendors:m=[]}=e||{},v=(0,s.Zo)(),y=P.getInstance();if(0===h||!n&&v)return{open:!1,hardware:v};y.softResultLocal=f>0;const{softCode:_}=y.hevcDisableInfo,T=0===d.length||d.includes(a),b=0===c.length||c.includes(i),S=0===u.length||u.includes(r),M=0===p||o>=p,w=!!l&&!g.includes(l)&&(m.length>0||!m.includes(l));return{open:0===_&&T&&b&&S&&M&&w,softCode:_,browser:T,pageName:b,playMode:S,deviceScore:M,hardware:v,vendor:w}}(t,{curPageName:i,curPlayMode:r,score:o.score||-2,vendor:o.vendor||"",dScore:l,deviceScore:c,cpuCore:u.cpu,browser:u.browserType},n)}static setHevcTestData(t){const{hevcTestData:n}=e.getInstance();Object.keys(t).forEach((e=>{n[e]=t[e]}))}static getHevcTestData(){const{hevcTestData:t}=e.getInstance();return t}static setABTest(t){const{abTestData:n}=e.getInstance();Object.keys(t).forEach((e=>{n[e]=t[e]}))}static getABTest(){const{abTestData:t}=e.getInstance();return t}static reset(){this.instance.abTestVersion=""}static setHevcAbVersion(t){const n=e.getInstance();n&&(n.hevcAbVersion=t)}static getAbVersions(){const t=e.getInstance();return t?`${t.hevcAbVersion},${t.abTestVersion}`:""}static setHevcEffectiveConditions(e){var t;t=e,P.setEffectiveConditions(t)}static getDeviceScore(){const{deviceMark:t}=e.getInstance();return{dScore:t.deviceScore,score:t.score,netScore:t.netScore}}static setSpeed(t){e.getInstance().networkSpeed.setSpeed(t)}static getSpeed(){return e.getInstance().networkSpeed.getSpeed()}static updateSpeedConfig(t){e.getInstance().networkSpeed.updateConfig(t)}static getAvgSpeed(){return e.getInstance().networkSpeed.getAvgSpeed()}};x.device=R;let C=x},28334:(e,t,n)=>{n.d(t,{A:()=>o});var i=n(9141),r=n(4629);const s=['video/mp4;codecs="hvc1.1.L0.0"','video/mp4;codecs="hvc1.1.6.L120"','video/mp4;codecs="hev1.1.6.L120.90"','video/mp4;codecs="hev1.1.6.L120.90"','video/mp4;codecs="hev1.2.4.L120.90"','video/mp4;codecs="hev1.3.E.L120.90"','video/mp4;codecs="hev1.4.10.L120.90"'];class a{constructor(e=""){this.rawUA=e,this.platformType=null,this.platformVersion=0,this.browserType=null,this.browserVersion=0,this.isChromium=!1,this.chromiumVersion=0,this.isMobile=!1,this.parseRowUA(this.rawUA)}parseRowPlatform(e=""){if(/Windows NT 10\.0/.test(e))this.platformType="Windows",this.platformVersion=10;else if(/Windows NT 6\.3/.test(e))this.platformType="Windows",this.platformVersion=8.1;else if(/Windows NT 6\.2/.test(e))this.platformType="Windows",this.platformVersion=8;else if(/Windows NT 6\.1/.test(e))this.platformType="Windows",this.platformVersion=7;else if(/Windows NT 6\.0/.test(e))this.platformType="Windows";else if(/Windows NT 5\.1/.test(e))this.platformType="Windows";else if(/Windows NT 5\.0/.test(e))this.platformType="Windows";else if(/Windows Phone/.test(e))this.platformType="Windows",this.isMobile=!0;else if(/Android/.test(e)){this.platformType="Android";const t=e.match(/Android\s([0-9\.]+)/);t&&t.length>1&&(this.platformVersion=parseFloat(t[1])),this.isMobile=!0}else if(/Linux/.test(e))this.platformType="Linux";else if(/CrOS/.test(e)){this.platformType="ChromeOS";const t=e.match(/CrOS ([a-zA-Z0-9_]+) (\d+\.\d+\.\d+\.\d+)/);t&&t.length>2&&(this.platformVersion=parseFloat(t[2]))}else if(/iPad|iPhone|iPod/.test(e)){this.platformType="iOS";const t=e.match(/OS (\d+)_(\d+)_?(\d+)?/);t&&t.length>2&&(this.platformVersion=parseFloat(t[1]+"."+t[2]+"."+(t[3]||"0"))),this.isMobile=!0}else if(/Mac OS X|Macintosh/.test(e)){this.platformType="MacOS";const t=e.match(/Mac OS X (10[._]\d+(?:[._]\d+)?)/);t&&t.length>1&&(this.platformVersion=parseFloat(t[1].replace(/_/g,".")))}}parseTVPlatform(e=""){e.toLowerCase&&(e=e.toLowerCase()),/tizen/.test(e)?this.platformType="Tizen":/webos/.test(e)?this.platformType="WebOS":/vstvb/.test(e)?this.platformType="VSTVB":/fetchtv/.test(e)?this.platformType="FetchTV":/netgemtv/.test(e)?this.platformType="NetGemTV":/vizio/.test(e)?this.platformType="VIZIO":/wpe/.test(e)?this.platformType="WPE":/vodafone/.test(e)?this.platformType="VODAFONE":/philips/.test(e)?this.platformType="Philips":/netrangemmh/.test(e)?this.platformType="NETRANGEMMH":/cva/.test(e)?this.platformType="CVA":/tlc/.test(e)?this.platformType="TLC":/openmw/.test(e)?this.platformType="OpenMW":/totalplay/.test(e)?this.platformType="Totalplay":/vidaa/.test(e)?this.platformType="VIDAA":/megacable/.test(e)?this.platformType="megacable":/lge/.test(e)&&(this.platformType="LGE")}parseRowBrowser(e=""){if(/MSIE|Trident/.test(e))this.browserType="IE";else if(/Edg|Edge/.test(e)){this.browserType="Edge";const t=e.match(/(?:Edg|Edge)\/(\d+\.?\d*)/);t&&t.length>1&&(this.browserVersion=parseFloat(t[1]))}else if(/Opera|OPR/.test(e)){this.browserType="Opera";const t=e.match(/(?:Opera|OPR)\/(\d+\.?\d*)/);t&&t.length>1&&(this.browserVersion=parseFloat(t[1]))}else if(/Firefox/.test(e)){this.browserType="Firefox";const t=e.match(/Firefox\/(\d+\.?\d*)/);t&&t.length>1&&(this.browserVersion=parseFloat(t[1]))}else if(/Safari/.test(e)&&!/Chrome/.test(e)){this.browserType="Safari";const t=e.match(/Version\/(\d+(\.\d+)+).*Safari/);t&&t.length>1&&(this.browserVersion=parseFloat(t[1]))}else if(/Chrome/.test(e)){this.browserType="Chrome";const t=e.match(/(?:CriOS|Chrome)\/(\d+\.?\d*)/);t&&t.length>1&&(this.browserVersion=parseFloat(t[1]))}if(/Chrome/.test(e)){this.isChromium=!0;const t=e.match(/(?:CriOS|Chrome)\/(\d+\.?\d*)/);t&&t.length>1&&(this.chromiumVersion=parseFloat(t[1]))}}parseRowUA(e=""){this.parseRowPlatform(e),this.parseTVPlatform(e),this.parseRowBrowser(e)}}class o extends i.C{constructor(){super(),this._isMSEAvailable=()=>!(typeof window>"u")&&"MediaSource"in window,this._checkUA=()=>{if("Linux"==this.ua.platformType||"ChromeOS"==this.ua.platformType||"Firefox"==this.ua.browserType||"Opera"==this.ua.browserType||"Edge"==this.ua.browserType&&this.ua.browserVersion<107)return!1;if(this.ua.isChromium){if(this.ua.chromiumVersion<107||"Chrome"==this.ua.browserType&&("Android"==this.ua.platformType&&(this.ua.platformVersion<5||this.ua.browserVersion<117)||"Windows"==this.ua.platformType&&this.ua.platformVersion<8))return!1}else if("Safari"==this.ua.browserType&&this.ua.browserVersion<13)return!1;return!0},this._isHEVCAvailable=()=>!(typeof window>"u"||!window.MediaSource)&&s.reduce(((e,t)=>e||window.MediaSource.isTypeSupported(t)),!1),this.ua=new a(this.userAgent),this.isMSESupported=this._isMSEAvailable(),this.isHEVCSupported=this._isHEVCAvailable()&&(0,r.Zo)(),this.shouldUseHEVC=this.isHEVCSupported&&this._checkUA()}static get version(){return i.v}static getInstance(){return o.instance||(o.instance=new o),o.instance}get cpu(){return typeof navigator>"u"||!navigator.hardwareConcurrency?0:navigator.hardwareConcurrency}get memory(){return typeof navigator>"u"||!navigator.deviceMemory?0:navigator.deviceMemory}get userAgent(){return typeof navigator>"u"||!navigator.userAgent?"":navigator.userAgent}get bandwidth(){return typeof navigator>"u"||!navigator.connection?0:navigator.connection.downlink||0}get networkType(){return typeof navigator>"u"||!navigator.connection?"":navigator.connection.effectiveType||""}get platformType(){return this.ua.platformType||""}get platformVersion(){return this.ua.platformVersion}get browserType(){return this.ua.browserType||""}get browserVersion(){return this.ua.browserVersion}get isChromium(){return this.ua.isChromium}get chromiumVersion(){return this.ua.chromiumVersion}}},58935:(e,t,n)=>{n.d(t,{Tz:()=>jh,IH:()=>tp,Vb:()=>Pp,SX:()=>Cp,SN:()=>Ep,mx:()=>Np});var i=n(1530),r=n(9141),s=n(28334),a=n(69805),o=Object.defineProperty,l=(e,t,n)=>((e,t,n)=>t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);const c=[new RegExp("(\\?|&)expire=([^&]*)(&|$)"),new RegExp("(\\?|&)x-tos-expires=([^&]*)(&|$)"),new RegExp("(\\?|&)x-expires=([^&]*)(&|$)")];function u(e){if(!e||"string"!=typeof e)return 0;let t=0;try{const n=[];if(c.forEach((t=>{const i=e.match(t);i&&n.push(i)})),n.length>0)t=parseInt(n[0][2],10);else{const n=e.split("/");n.length>5&&8===n[4].length&&(t=parseInt(n[4],16))}if(t>0){const e=new Date;return t<=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),0)/1e3?1:2}return 0}catch{return 0}}const d={v360:{width:640,height:360},v480:{width:800,height:480},v540:{width:960,height:540},v720:{width:1280,height:720},v864:{width:1536,height:864},v960:{width:1706,height:960},v1080:{width:1920,height:1080},v2k:{width:2560,height:1440},v4k:{width:3840,height:2160}};class h{constructor(){this.ladder=null,this._mvmaf="",this._vqscore=0,this.width=0,this.height=0,this.playedDuration=0}set mvmaf(e){if(e)try{this._mvmaf=e;let t=JSON.parse(e);t["v2.0"]&&(this.ladder=t["v2.0"])}catch{}}get mvmaf(){return this._mvmaf}set vqscore(e){e&&(this._vqscore=e)}get vqscore(){return this._vqscore}_findNearestPlaybackScore(){let e=0;if(!this.ladder)return 0;let t=this.width*this.height,n="v540",i=Number.MAX_VALUE;for(let e in d){const r=d[e];let s=t-r.width*r.height;Math.abs(s){this.playEnded.paused&&this.playEnded.stopPauseTimer()})),l(this,"_onPause",(()=>{this.block.started&&this.block.reset(),this.playEnded.startPauseTimer()})),l(this,"_onPlaying",(()=>{if(this.status=3,this.block.started){this.block.stopTimer();const{blockType:e}=this.blockStart;this.trigger(this.block.name,this.block.exportData(this._player,{blockType:e}))}this._player.element&&(this.playEnded.width=this._player.element.videoWidth,this.playEnded.height=this._player.element.videoHeight)})),l(this,"_onTimeupdate",(()=>{!this._player||!this._player.element||(this.playEnded.currentTime=this._player.element.currentTime)})),l(this,"_onEnded",(()=>{this.status=2})),l(this,"_onWaiting",(()=>{!this._player||!this._player.element||3==this._status&&(this._player.element.paused||this._player.state!==a.R.ACTIVE||(this.blockStart.setBlockType(this._player),this.trigger(this.blockStart.name,this.blockStart.exportData()),this.block.startTimer()))})),l(this,"_onError",(e=>{this.trigger(this.playFailed.name,this.playFailed.exportData(this._player,e,this._status))})),l(this,"_onSourceError",(e=>{const{host:t,errorCode:n,message:i,src:r}=e;this.playFailed.loadStartRetry.push({host:t,code:n,message:i,isExpired:u(r)})})),l(this,"_onLoadstart",(()=>{this.status=1,this.trigger(this.videoRequest.name,this.videoRequest.exportData()),this.playQuality.startTimer(),this.videoRequestResponse.startTimer(),this.firstFrame.startTimer()})),l(this,"_onLoadeddata",(()=>{this.videoRequestResponse.stopTimer(),this._loadedTime=window.performance?window.performance.now():Date.now(),this.playQuality.durationWithLoaded=this._loadedTime-this.playQuality.startTime,this.trigger(this.videoRequestResponse.name,this.videoRequestResponse.exportData())})),l(this,"_onPlayCatch",(()=>{this.xgDowngraded=!0})),l(this,"_onDownloaderChunkReady",(e=>{this.trigger(this.videoDataSize.name,e)})),l(this,"_onProgress",(()=>{if(!this._player||!this.xgDowngraded&&"RAW"!=this._player.type||!this.config||!this.config.bitrate)return;const e=this._player.element.buffered;let t=0;for(let n=0;n{const t=e||this.event;t&&(t.on("play",this._onPlay),t.on("pause",this._onPause),t.on("playing",this._onPlaying),t.on("timeupdate",this._onTimeupdate),t.on("ended",this._onEnded),t.on("waiting",this._onWaiting),t.on("error",this._onError),t.on("source_error",this._onSourceError),t.on("loadstart",this._onLoadstart),t.on("loadeddata",this._onLoadeddata),t.on("playCatch",this._onPlayCatch),t.on("downloaderChunkReady",this._onDownloaderChunkReady),t.on("progress",this._onProgress))})),l(this,"removeEvent",(e=>{const t=e||this.event;t&&(t.off("play",this._onPlay),t.off("pause",this._onPause),t.off("playing",this._onPlaying),t.off("timeupdate",this._onTimeupdate),t.off("ended",this._onEnded),t.off("waiting",this._onWaiting),t.off("error",this._onError),t.off("source_error",this._onSourceError),t.off("loadstart",this._onLoadstart),t.off("loadeddata",this._onLoadeddata),t.off("playCatch",this._onPlayCatch),t.off("downloaderChunkReady",this._onDownloaderChunkReady),t.off("progress",this._onProgress))})),l(this,"stop",(()=>{-1!=this._status&&(this.reset(),this.lastPlayEnded&&(this.trigger(this.lastPlayEnded.name,this.lastPlayEnded.exportData()),this.lastPlayEnded=null))})),l(this,"reset",(()=>{(0,a.l)(P,"reset"),this.playEnded.started&&this.playEnded.stopTimer(),this.lastPlayEnded=new _(this._status),this.lastPlayEnded.copy(this.playEnded),this.status=-1,this.xgDowngraded=!1,this.videoRequest.reset(),this.videoRequestResponse.reset(),this.blockStart.reset(),this.block.reset(),this.playQuality.reset(),this.playEnded.reset(),this.playFailed.reset(),this.firstFrame.reset(),this._loadedTime=0})),this.event=e,this.config=t,this._status=-1,this.initEvent(),this._player=null,this.xgDowngraded=!1,this.videoRequest=new f,this.videoRequestResponse=new g,this.blockStart=new m,this.block=new v,this.playQuality=new y,this.lastPlayEnded=null,this.playEnded=new _(this._status),this.playFailed=new T,this.firstFrame=new b,this.videoDataSize=new S,this.events=[this.videoDataSize.name,this.videoRequest.name,this.videoRequestResponse.name,this.blockStart.name,this.block.name,this.playQuality.name,this.playEnded.name,this.playFailed.name,this.firstFrame.name],this.startInitInfo={},this._loadedTime=0}static get version(){return r.v}getCommonData(e){const{element:t,config:n,type:i,state:r}=e;return{currentTime:(null==t?void 0:t.currentTime)||0,videoDuration:(null==t?void 0:t.duration)||0,codecType:(null==n?void 0:n.codecType)||"h264",vtype:(null==n?void 0:n.vtype)||"MP4",playerType:i||"default",renderState:r||a.R.ACTIVE}}setConfig(e){e&&e.bitrate&&(this.config.bitrate=e.bitrate)}set player(e){this._player=e,e&&(this._player.mvmaf&&(this.playEnded.mvmaf=this._player.mvmaf),this._player.vqscore&&(this.playEnded.vqscore=this._player.vqscore))}set status(e){if(1===this._status&&3===e){this.playQuality.stopTimer(),this.playEnded.startTimer(),this.firstFrame.stopTimer(),this.playQuality.durationFromLoaded=this.playQuality.endTime-this._loadedTime;const{durationWithLoaded:e,durationFromLoaded:t}=this.playQuality,n={...this.playQuality.exportData(),...this.playFailed.getRetryData(),durationWithLoaded:e,durationFromLoaded:t};this.trigger(this.playQuality.name,n),this.trigger(this.firstFrame.name,n)}this._status=e}setStartInitInfo(e){(0,a.l)(P,"setStartInitInfo",e),this.startInitInfo=e}trigger(e,t){const n=this.getCommonData(this._player);super.trigger(e,{...n,...t,startInfo:this.startInitInfo||{}})}release(){const{_callbacks:e}=this;Object.keys(e).forEach((t=>{(e[t]||[]).forEach((e=>{this.off(t,e)}))})),this.removeEvent(),this._player=null,this._events=[],this.event=null}}var w=n(80249);function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n-1,K={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},W="%c[xgplayer]",Q={config:{debug:X?3:0},logInfo:function(e){for(var t,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r=3&&(t=console).log.apply(t,[W,K.info,e].concat(i))},logWarn:function(e){for(var t,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r=1&&(t=console).warn.apply(t,[W,K.warn,e].concat(i))},logError:function(e){var t;if(!(this.config.debug<1)){for(var n=this.config.debug>=2?"trace":"error",i=arguments.length,r=new Array(i>1?i-1:0),s=1;s0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=document.createElement(e);return r.className=i,r.innerHTML=t,Object.keys(n).forEach((function(t){var i=t,s=n[t];"video"===e||"audio"===e||"live-video"===e?s&&r.setAttribute(i,s):r.setAttribute(i,s)})),r},Y.createDomFromHtml=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";try{var i=document.createElement("div");i.innerHTML=e;var r=i.children;return i=null,r.length>0?(r=r[0],n&&Y.addClass(r,n),t&&Object.keys(t).forEach((function(e){r.setAttribute(e,t[e])})),r):null}catch(e){return Q.logError("util.createDomFromHtml",e),null}},Y.hasClass=function(e,t){if(!e||!t)return!1;try{return Array.prototype.some.call(e.classList,(function(e){return e===t}))}catch(i){var n=e.className&&"object"===V(e.className)?e.getAttribute("class"):e.className;return n&&!!n.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},Y.addClass=function(e,t){if(e&&t)try{t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.add(t)}))}catch(n){Y.hasClass(e,t)||(e.className&&"object"===V(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},Y.removeClass=function(e,t){if(e&&t)try{t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.remove(t)}))}catch(n){Y.hasClass(e,t)&&t.split(/\s+/g).forEach((function(t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===V(e.className)?e.setAttribute("class",e.getAttribute("class").replace(n," ")):e.className=e.className.replace(n," ")}))}},Y.toggleClass=function(e,t){e&&t.split(/\s+/g).forEach((function(t){Y.hasClass(e,t)?Y.removeClass(e,t):Y.addClass(e,t)}))},Y.classNames=function(){for(var e=arguments,t=[],n=function(n){"String"===Y.typeOf(e[n])?t.push(e[n]):"Object"===Y.typeOf(e[n])&&Object.keys(e[n]).map((function(i){e[n][i]&&t.push(i)}))},i=0;i0&&void 0!==arguments[0]?arguments[0]:document,n=arguments.length>1?arguments[1]:void 0;try{e=t.querySelector(n)}catch(i){Q.logError("util.findDom",i),0===n.indexOf("#")&&(e=t.getElementById(n.slice(1)))}return e},Y.getCss=function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},Y.padStart=function(e,t,n){for(var i=String(n),r=0|t,s=Math.ceil(r/i.length),a=[],o=String(e);s--;)a.push(i);return a.join("").substring(0,r-o.length)+o},Y.format=function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=Y.padStart(Math.floor(e/3600),2,0),n=Y.padStart(Math.floor((e-3600*t)/60),2,0),i=Y.padStart(Math.floor(e-3600*t-60*n),2,0);return("00"===t?[n,i]:[t,n,i]).join(":")},Y.event=function(e){if(e.touches){var t=e.touches[0]||e.changedTouches[0];e.clientX=t.clientX||0,e.clientY=t.clientY||0,e.offsetX=t.pageX-t.target.offsetLeft,e.offsetY=t.pageY-t.target.offsetTop}e._target=e.target||e.srcElement},Y.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},Y.deepCopy=function(e,t){if("Object"===Y.typeOf(t)&&"Object"===Y.typeOf(e))return Object.keys(t).forEach((function(n){"Object"!==Y.typeOf(t[n])||t[n]instanceof Node?"Array"===Y.typeOf(t[n])?e[n]="Array"===Y.typeOf(e[n])?e[n].concat(t[n]):t[n]:e[n]=t[n]:void 0===e[n]||void 0===e[n]?e[n]=t[n]:Y.deepCopy(e[n],t[n])})),e},Y.deepMerge=function(e,t){return Object.keys(t).map((function(n){var i;"Array"===Y.typeOf(t[n])&&"Array"===Y.typeOf(e[n])?"Array"===Y.typeOf(e[n])&&(i=e[n]).push.apply(i,U(t[n])):Y.typeOf(e[n])!==Y.typeOf(t[n])||null===e[n]||"Object"!==Y.typeOf(e[n])||t[n]instanceof window.Node?null!==t[n]&&(e[n]=t[n]):Y.deepMerge(e[n],t[n])})),e},Y.getBgImage=function(e){var t=(e.currentStyle||window.getComputedStyle(e,null)).backgroundImage;if(!t||"none"===t)return"";var n=document.createElement("a");return n.href=t.replace(/url\("|"\)/g,""),n.href},Y.copyDom=function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return Array.prototype.forEach.call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},Y.setInterval=function(e,t,n,i){e._interval[t]||(e._interval[t]=window.setInterval(n.bind(e),i))},Y.clearInterval=function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},Y.setTimeout=function(e,t,n){e._timers||(e._timers=[]);var i=setTimeout((function(){t(),Y.clearTimeout(e,i)}),n);return e._timers.push(i),i},Y.clearTimeout=function(e,t){var n=e._timers;if("Array"===Y.typeOf(n)){for(var i=0;i-1&&i.indexOf(e)>-1&&(r=parseFloat(n.slice(0,n.indexOf(e)).trim()),s=parseFloat(i.slice(0,i.indexOf(e)).trim()),a=e,1))})),o.style.width="".concat(r).concat(a),o.style.height="".concat(s).concat(a),o.style.backgroundSize="".concat(r).concat(a," ").concat(s).concat(a),o.style.margin="start"===e?"-".concat(s/2).concat(a," auto auto -").concat(r/2).concat(a):"auto 5px auto 5px"),o},Y.Hex2RGBA=function(e,t){var n=[];if(/^\#[0-9A-F]{3}$/i.test(e)){var i="#";e.replace(/[0-9A-F]/gi,(function(e){i+=e+e})),e=i}return/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,(function(e){n.push(parseInt(e,16))})),"rgba(".concat(n.join(","),", ").concat(t,")")):"rgba(255, 255, 255, 0.1)"},Y.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},Y.checkIsFunction=function(e){return e&&"function"==typeof e},Y.checkIsObject=function(e){return null!==e&&"object"===V(e)},Y.hide=function(e){e.style.display="none"},Y.show=function(e,t){e.style.display=t||"block"},Y.isUndefined=function(e){if(null==e)return!0},Y.isNotNull=function(e){return!(null==e)},Y.setStyleFromCsstext=function(e,t){t&&("String"===Y.typeOf(t)?t.replace(/\s+/g,"").split(";").map((function(t){if(t){var n=t.split(":");n.length>1&&(e.style[n[0]]=n[1])}})):Object.keys(t).map((function(n){e.style[n]=t[n]})))},Y.filterStyleFromText=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],n=e.style.cssText;if(!n)return{};var i=n.replace(/\s+/g,"").split(";"),r={},s={};return i.map((function(e){if(e){var n=e.split(":");n.length>1&&(function(e,t){for(var n=0,i=t.length;n-1)return!0;return!1}(n[0],t)?r[n[0]]=n[1]:s[n[0]]=n[1])}})),e.setAttribute("style",""),Object.keys(s).map((function(t){e.style[t]=s[t]})),r},Y.getStyleFromCsstext=function(e){var t=e.style.cssText;if(!t)return{};var n=t.replace(/\s+/g,"").split(";"),i={};return n.map((function(e){if(e){var t=e.split(":");t.length>1&&(i[t[0]]=t[1])}})),i},Y.preloadImg=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(e){var i=new window.Image;i.onload=function(e){i=null,t&&t(e)},i.onerror=function(e){i=null,n&&n(e)},i.src=e}},Y.stopPropagation=function(e){e&&e.stopPropagation()},Y.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},Y.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},Y.checkTouchSupport=function(){return"ontouchstart"in window},Y.getBuffered2=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,n=[],i=0;io&&(r[a-1].end=n[s].end):r.push(n[s])}else r.push(n[s])}else r=n;return new q(r)},Y.getEventPos=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.touches&&e.touches.length>0&&(e=e.touches[0]),{x:e.x/t,y:e.y/t,clientX:e.clientX/t,clientY:e.clientY/t,offsetX:e.offsetX/t,offsetY:e.offsetY/t,pageX:e.pageX/t,pageY:e.pageY/t}},Y.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},Y.getHostFromUrl=function(e){if("String"!==Y.typeOf(e))return"";var t=e.split("/"),n="";return t.length>3&&t[2]&&(n=t[2]),n},Y.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},Y.isMSE=function(e){return e.media&&(e=e.media),!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},Y.isBlob=function(e){return"string"==typeof e&&/^blob/.test(e)},Y.generateSessionId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=(new Date).getTime();try{e=parseInt(e)}catch(t){e=0}t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=parseInt(window.performance.now()));var n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}));return n},Y.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},Y.adjustTimeByDuration=function(e,t,n){return t&&e&&(e>t||n&&e0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n={scale:"".concat(e.scale||1),translate:"".concat(e.x||0,"%, ").concat(e.y||0,"%"),rotate:"".concat(e.rotate||0,"deg")};return Object.keys(n).forEach((function(e){var i=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),r="".concat(e,"(").concat(n[e],")");i.test(t)?(i.lastIndex=-1,t=t.replace(i,r)):t+="".concat(r," ")})),t},Y.convertDeg=function(e){return Math.abs(e)<=1?360*e:e%360},Y.getIndexByTime=function(e,t){var n=t.length,i=-1;if(n<1)return i;if(e<=t[0].end||n<2)i=0;else if(e>t[n-1].end)i=n-1;else for(var r=1;rt[r-1].end&&e<=t[r].end){i=r;break}return i},Y.getOffsetCurrentTime=function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if((n=i>=0&&i=a&&e<=o?e-c:e>o&&n>=r-1?o:-1},Y.getCurrentTimeByOffset=function(e,t){var n=-1;if(!t||t.length<0)return e;for(var i=0;i1,a=s||i&&!/(?:Mobile)/.test(e)||r&&/(?:Tablet)/.test(e),o=/(?:iPhone)/.test(e)&&!a;return{isTablet:a,isPhone:o,isIpad:s,isIos:o||s,isAndroid:i,isPc:!(o||i||n||a),isSymbian:n,isWindowsPhone:t,isFireFox:r}},get osVersion(){if("undefined"==typeof navigator)return 0;var e=navigator.userAgent,t="",n=(t=/(?:iPhone)|(?:iPad|PlayBook)/.test(e)?ee:Z)?t.exec(e):[];if(n&&n.length>=3){var i=n[2].split(".");return i.length>0?parseInt(i[0]):0}return 0},get isWeixin(){return"undefined"!=typeof navigator&&!!/(micromessenger)\/([\d.]+)/.exec(navigator.userAgent.toLocaleLowerCase())},isSupportMP4:function(){var e={isSupport:!1,mime:""};if("undefined"==typeof document)return e;if(this.supportResult)return this.supportResult;var t=document.createElement("video");return"function"==typeof t.canPlayType&&te.map((function(n){"probably"===t.canPlayType('video/mp4; codecs="'.concat(n,'"'))&&(e.isSupport=!0,e.mime+="||".concat(n))})),this.supportResult=e,t=null,e},isMSESupport:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if("undefined"==typeof MediaSource||!MediaSource)return!1;try{return MediaSource.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}},isHevcSupported:function(){return!("undefined"==typeof MediaSource||!MediaSource.isTypeSupported)&&(MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"'))},probeConfigSupported:function(e){var t={supported:!1,smooth:!1,powerEfficient:!1};if(!e||"undefined"==typeof navigator)return Promise.resolve(t);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(e);var n=e.video||{},i=e.audio||{};try{var r=MediaSource.isTypeSupported(n.contentType),s=MediaSource.isTypeSupported(i.contentType);return Promise.resolve({supported:r&&s,smooth:!1,powerEfficient:!1})}catch(e){return Promise.resolve(t)}}},ie="3.0.21",re={1:"media",2:"media",3:"media",4:"media",5:"media",6:"media"},se={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},ae=x((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};D(this,e);var i=t&&t.i18n?t.i18n.ERROR_TYPES:null;if(t.media){var r=n.mediaError?n.mediaError:t.media.error||{},s=t.duration,a=t.currentTime,o=t.ended,l=t.src,c=t.currentSrc,u=t.media,d=u.readyState,h=u.networkState,p=n.errorCode||r.code;se[p]&&(p=se[p]);var f={playerVersion:ie,currentTime:a,duration:s,ended:o,readyState:d,networkState:h,src:l||c,errorType:n.errorType,errorCode:p,message:n.errorMessage||r.message,mediaError:r,originError:n.originError?n.originError.stack:"",host:Y.getHostFromUrl(l||c)};return n.ext&&Object.keys(n.ext).map((function(e){f[e]=n.ext[e]})),f}if(arguments.length>1){for(var g={playerVersion:ie,domain:document.domain},m=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],v=0;v0&&void 0!==arguments[0]?arguments[0]:this.media;this._evHandlers||(this._evHandlers=ye.map((function(t){var n="on".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));return"function"==typeof e[n]&&e.on(t,e[n]),C({},t,function(e,t){return function(n,i){var r={player:t,eventName:e,originalEvent:n,detail:n.detail||{},timeStamp:n.timeStamp,currentTime:t.currentTime,duration:t.duration,paused:t.paused,ended:t.ended,isInternalOp:!!t._internalOp[n.type],muted:t.muted,volume:t.volume,host:Y.getHostFromUrl(t.currentSrc),vtype:t.vtype};if(t.removeInnerOP(n.type),"timeupdate"===e&&(t._currentTime=t.media&&t.media.currentTime),"ratechange"===e){var s=t.media?t.media.playbackRate:0;if(s&&t._rate===s)return;t._rate=t.media&&t.media.playbackRate}if("durationchange"===e&&(t._duration=t.media.duration),"volumechange"===e&&(r.isMutedChange=t._lastMuted!==t.muted,t._lastMuted=t.muted),"error"===e&&(r.error=i||t.video.error),t.mediaEventMiddleware[e]){var a=_e.bind(t,e,r);try{t.mediaEventMiddleware[e].call(t,r,a)}catch(n){throw _e.call(t,e,r),n}}else _e.call(t,e,r)}}(t,e))}))),this._evHandlers.forEach((function(e){var n=Object.keys(e)[0];t.addEventListener(n,e[n],!1)}))}},{key:"detachVideoEvents",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.media;this._evHandlers.forEach((function(e){var n=Object.keys(e)[0];t.removeEventListener(n,e[n],!1)})),this._evHandlers.forEach((function(t){var n=Object.keys(t)[0],i="on".concat(n.charAt(0).toUpperCase()).concat(n.slice(1));"function"==typeof e[i]&&e.off(n,e[i])})),this._evHandlers=null}},{key:"_attachSourceEvents",value:function(e,t){var n=this;e.removeAttribute("src"),e.load(),t.forEach((function(e,t){n.media.appendChild(Y.createDom("source","",{src:"".concat(e.src),type:"".concat(e.type||""),"data-index":t+1}))}));var i=e.children;if(i){this._videoSourceCount=i.length,this._videoSourceIndex=i.length,this._vLoadeddata=function(e){n.emit("source_success",{src:e.target.currentSrc,host:Y.getHostFromUrl(e.target.currentSrc)})};for(var r=null,s=0;s=n._videoSourceCount){var i={code:4,message:"sources_load_error"};r?r.error(e,i):n.errorHandler("error",i)}var s=re[4];n.emit("source_error",new ae(n,{errorType:s,errorCode:4,errorMessage:"sources_load_error",mediaError:{code:4,message:"sources_load_error"},src:e.target.src}))});for(var a=0;a0;)e.removeChild(t[0]);this._vLoadeddata&&e.removeEventListener("loadeddata",this._vLoadeddata)}}},{key:"errorHandler",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.media&&(this.media.error||t)){var n=this.media.error||t,i=n.code?re[n.code]:"other";n.message,this.media.currentSrc||(n={code:6,message:"empty_src"}),this.emit(e,new ae(this,{errorType:i,errorCode:n.code,errorMessage:n.message||"",mediaError:n}))}}},{key:"destroy",value:function(){for(var e in this.media&&(this.media.pause&&(this.media.pause(),this.media.muted=!0),this.media.removeAttribute("src"),this.media.load()),this._currentTime=0,this._duration=0,this.mediaConfig=null,this._interval)Object.prototype.hasOwnProperty.call(this._interval,e)&&(clearInterval(this._interval[e]),this._interval[e]=null);this.detachVideoEvents(),this.media=null,this.mediaEventMiddleware={},this.removeAllListeners()}},{key:"video",get:function(){return this.media},set:function(e){this.media=e}},{key:"play",value:function(){return this.media?this.media.play():null}},{key:"pause",value:function(){this.media&&this.media.pause()}},{key:"load",value:function(){this.media&&this.media.load()}},{key:"canPlayType",value:function(e){return!!this.media&&this.media.canPlayType(e)}},{key:"getBufferedRange",value:function(e){var t=[0,0];if(!this.media)return t;e||(e=this.media.buffered);var n=this.media.currentTime;if(e)for(var i=0,r=e.length;i=this.currentTime)return{start:t.start(n),end:t.end(n)};return e}},{key:"crossOrigin",get:function(){return this.media?this.media.crossOrigin:""},set:function(e){this.media&&(this.media.crossOrigin=e)}},{key:"currentSrc",get:function(){return this.media?this.media.currentSrc:""},set:function(e){this.media&&(this.media.currentSrc=e)}},{key:"currentTime",get:function(){return this.media?void 0!==this.media.currentTime?this.media.currentTime:this._currentTime:0},set:function(e){this.media&&(this.media.currentTime=e)}},{key:"defaultMuted",get:function(){return!!this.media&&this.media.defaultMuted},set:function(e){this.media&&(this.media.defaultMuted=e)}},{key:"duration",get:function(){return this._duration}},{key:"ended",get:function(){return!!this.media&&this.media.ended}},{key:"error",get:function(){return this.media.error}},{key:"errorNote",get:function(){return this.media.error?["MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED"][this.media.error.code-1]:""}},{key:"loop",get:function(){return!!this.media&&this.media.loop},set:function(e){this.media&&(this.media.loop=e)}},{key:"muted",get:function(){return!!this.media&&this.media.muted},set:function(e){this.media&&this.media.muted!==e&&(this._lastMuted=this.media.muted,this.media.muted=e)}},{key:"networkState",get:function(){return this.media.networkState}},{key:"paused",get:function(){return!this.media||this.media.paused}},{key:"playbackRate",get:function(){return this.media?this.media.playbackRate:0},set:function(e){this.media&&e!==1/0&&(this.media.defaultPlaybackRate=e,this.media.playbackRate=e)}},{key:"played",get:function(){return this.media?this.media.played:null}},{key:"preload",get:function(){return!!this.media&&this.media.preload},set:function(e){this.media&&(this.media.preload=e)}},{key:"readyState",get:function(){return this.media.readyState}},{key:"seekable",get:function(){return!!this.media&&this.media.seekable}},{key:"seeking",get:function(){return!!this.media&&this.media.seeking}},{key:"src",get:function(){return this.media?this.media.src:""},set:function(e){this.media&&(this.emit("urlchange",e),this.emit("waiting"),this._currentTime=0,this._duration=0,Y.isMSE(this.media)?this.onWaiting():(this._detachSourceEvents(this.media),"Array"===Y.typeOf(e)?this._attachSourceEvents(this.media,e):e?this.media.src=e:this.media.removeAttribute("src"),this.load()))}},{key:"volume",get:function(){return this.media?this.media.volume:0},set:function(e){e!==1/0&&this.media&&(this.media.volume=e)}},{key:"aspectRatio",get:function(){return this.media?this.media.videoWidth/this.media.videoHeight:0}},{key:"addInnerOP",value:function(e){this._internalOp[e]=!0}},{key:"removeInnerOP",value:function(e){delete this._internalOp[e]}},{key:"emit",value:function(e,n){for(var i=arguments.length,r=new Array(i>2?i-2:0),s=2;s2?i-2:0),s=2;s2?i-2:0),s=2;s2?i-2:0),s=2;s0&&void 0!==arguments[0]?arguments[0]:{name:"xgplayer",version:1,db:null,ojstore:{name:"xg-m4a",keypath:"vid"}};D(this,e),this.indexedDB=window.indexedDB||window.webkitindexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange,this.myDB=t}),[{key:"openDB",value:function(e){var t=this,n=this,i=this.myDB.version||1,r=n.indexedDB.open(n.myDB.name,i);r.onerror=function(e){},r.onsuccess=function(i){t.myDB.db=i.target.result,e.call(n)},r.onupgradeneeded=function(e){var t=e.target.result;e.target.transaction,t.objectStoreNames.contains(n.myDB.ojstore.name)||t.createObjectStore(n.myDB.ojstore.name,{keyPath:n.myDB.ojstore.keypath})}}},{key:"deletedb",value:function(){this.indexedDB.deleteDatabase(this.myDB.name)}},{key:"closeDB",value:function(){this.myDB.db.close()}},{key:"addData",value:function(e,t){for(var n,i=this.myDB.db.transaction(e,"readwrite").objectStore(e),r=0;r3?i-3:0),s=3;s2&&void 0!==arguments[2]?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),!this.__hooks[e]&&(this.__hooks[e]=null),function(){var i=arguments,r=this;if(n.pre)try{var s;(s=n.pre).call.apply(s,[this].concat(Array.prototype.slice.call(arguments)))}catch(t){throw t.message="[pluginName: ".concat(this.pluginName,":").concat(e,":pre error] >> ").concat(t.message),t}if(this.__hooks&&this.__hooks[e])try{var a,o=(a=this.__hooks[e]).call.apply(a,[this,this].concat(Array.prototype.slice.call(arguments)));o?o.then?o.then((function(e){!1!==e&&Ee.apply(void 0,[r,t,n.next].concat(U(i)))})).catch((function(e){throw e})):Ee.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments))):void 0===o&&Ee.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments)))}catch(t){throw t.message="[pluginName: ".concat(this.pluginName,":").concat(e,"] >> ").concat(t.message),t}else Ee.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments)))}.bind(this)}function De(e,t){var n=this.__hooks;if(n)return n.hasOwnProperty(e)?(n&&(n[e]=t),!0):(console.warn("has no supported hook which name [".concat(e,"]")),!1)}function Re(e,t){var n=this.__hooks;n&&delete n[e]}function xe(e){if(this.plugins&&this.plugins[e.toLowerCase()]){for(var t=this.plugins[e.toLowerCase()],n=arguments.length,i=new Array(n>1?n-1:0),r=1;r1?n-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:[];e.__hooks={},t&&t.map((function(t){e.__hooks[t]=null})),Object.defineProperty(e,"hooks",{get:function(){return e.__hooks&&Object.keys(e.__hooks).map((function(t){if(e.__hooks[t])return t}))}})}function Le(e){e.__hooks=null}function Oe(e,t,n){for(var i=arguments.length,r=new Array(i>3?i-3:0),s=3;s1?n-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:{};if(this.player){var i=$($({},n),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,i)}}},{key:"hook",value:function(e,t){return ke.call.apply(ke,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r2?n-2:0),r=2;r1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.player)return n&&(t.pluginName=n),this.player.registerPlugin({plugin:e,options:t})}},{key:"getPlugin",value:function(e){return this.player?this.player.getPlugin(e):null}},{key:"__destroy",value:function(){var e=this,t=this.player,n=this.pluginName;this.offAll(),Y.clearAllTimers(this),Y.checkIsFunction(this.destroy)&&this.destroy(),["player","playerConfig","pluginName","logger","__args","__hooks"].map((function(t){e[t]=null})),t.unRegisterPlugin(n),Le(this)}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&Object.defineProperty(e,n,t[n])}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}])}(),$e=n(36922),Ne=n.n($e),Be={CONTROLS:"controls",ROOT:"root"},Fe={ROOT:"root",ROOT_LEFT:"rootLeft",ROOT_RIGHT:"rootRight",ROOT_TOP:"rootTop",CONTROLS_LEFT:"controlsLeft",CONTROLS_RIGTH:"controlsRight",CONTROLS_RIGHT:"controlsRight",CONTROLS_CENTER:"controlsCenter",CONTROLS:"controls"},Ue="xg-icon-disable";function He(e){return!!e&&e.indexOf&&/^(?:http|data:|\/)/.test(e)}function Ve(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",s=null;if(e instanceof window.Element)return Y.addClass(e,n),Object.keys(i).map((function(t){e.setAttribute(t,i[t])})),e;if(He(e)||He(e.url))return i.src=He(e)?e:e.url||"",s=Y.createDom(e.tag||"img","",i,"xg-img ".concat(n));if("function"==typeof e)try{return(s=e())instanceof window.Element?(Y.addClass(s,n),Object.keys(i).map((function(e){s.setAttribute(e,i[e])})),s):(Q.logWarn("warn>>icons.".concat(t," in config of plugin named [").concat(r,"] is a function mast return an Element Object")),null)}catch(e){return Q.logError("Plugin named [".concat(r,"]:createIcon"),e),null}return"string"==typeof e?Y.createDomFromHtml(e,i,n):(Q.logWarn("warn>>icons.".concat(t," in config of plugin named [").concat(r,"] is invalid")),null)}var je=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return D(this,t),(e=k(this,t,[n])).__delegates=[],e}return O(t,e),x(t,[{key:"__init",value:function(e){F(t,"__init",this,3)([e]);var n=e.root,i=null;if(this.icons={},this.root=null,this.parent=null,e.root){(function(e,t){var n=t.config.icons||t.playerConfig.icons;Object.keys(e).map((function(i){var r=e[i],s=r&&r.class?r.class:"",a=r&&r.attr?r.attr:{},o=null;n&&n[i]&&(s=function(e,t){return"object"===V(e)&&e.class&&"string"==typeof e.class?"".concat(t," ").concat(e.class):t}(n[i],s),a=function(e,t){return"object"===V(e)&&e.attr&&"object"===V(e.attr)&&Object.keys(e.attr).map((function(n){t[n]=e.attr[n]})),t}(n[i],a),o=Ve(n[i],i,s,a,t.pluginName)),!o&&r&&(o=Ve(r.icon?r.icon:r,a,s,{},t.pluginName)),t.icons[i]=o}))})(this.registerIcons()||{},this),this.langText={};var r,s,a=this.registerLanguageTexts()||{};r=a,s=this,Object.keys(r).map((function(e){Object.defineProperty(s.langText,e,{get:function(){var t=s.lang,n=s.i18n;return n[e]?n[e]:r[e]&&r[e][t]||""}})}));var o="";try{o=this.render()}catch(e){throw Q.logError("Plugin:".concat(this.pluginName,":render"),e),new Error("Plugin:".concat(this.pluginName,":render:").concat(e.message))}if(o)(i=t.insert(o,n,e.index)).setAttribute("data-index",e.index);else{if(!e.tag)return;(i=Y.createDom(e.tag,"",e.attr,e.name)).setAttribute("data-index",e.index),n.appendChild(i)}this.root=i,this.parent=n;var l=this.config.attr||{},c=this.config.style||{};this.setAttr(l),this.setStyle(c),this.config.index&&this.root.setAttribute("data-index",this.config.index),this.__registerChildren()}}},{key:"__registerChildren",value:function(){var e=this;if(this.root){this._children=[];var t=this.children();t&&"object"===V(t)&&Object.keys(t).length>0&&Object.keys(t).map((function(n){var i,r,s=n,a=t[s],o={root:e.root};"function"==typeof a?(i=e.config[s]||{},r=a):"object"===V(a)&&"function"==typeof a.plugin&&(i=a.options?Y.deepCopy(e.config[s]||{},a.options):e.config[s]||{},r=a.plugin),o.config=i,void 0!==i.index&&(o.index=i.index),i.root&&(o.root=i.root),e.registerPlugin(r,o,s)}))}}},{key:"updateLang",value:function(e){e||(e=this.lang);var t=this.root,n=this.i18n,i=this.langText;t&&function e(t,n){for(var i=0;i0?e(t.children[i],n):n(t.children[i])}(t,(function(t){var r=t.getAttribute&&t.getAttribute("lang-key");if(r){var s=n[r.toUpperCase()]||i[r];s&&(t.innerHTML="function"==typeof s?s(e):s)}}))}},{key:"lang",get:function(){return this.player.lang}},{key:"changeLangTextKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=this.i18n||{},i=this.langText;e.setAttribute&&e.setAttribute("lang-key",t);var r=n[t]||i[t]||"";r&&(e.innerHTML=r)}},{key:"plugins",value:function(){return this._children}},{key:"disable",value:function(){this.config.disable=!0,Y.addClass(this.find(".xgplayer-icon"),Ue)}},{key:"enable",value:function(){this.config.disable=!1,Y.removeClass(this.find(".xgplayer-icon"),Ue)}},{key:"children",value:function(){return{}}},{key:"registerPlugin",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";n.root=n.root||this.root;var r=F(t,"registerPlugin",this,3)([e,n,i]);return this._children.push(r),r}},{key:"registerIcons",value:function(){return{}}},{key:"registerLanguageTexts",value:function(){return{}}},{key:"find",value:function(e){if(this.root)return this.root.querySelector(e)}},{key:"bind",value:function(e,n,i){var r=this;if(arguments.length<3&&"function"==typeof n)Array.isArray(e)?e.forEach((function(e){r.bindEL(e,n)})):this.bindEL(e,n);else{var s=t.delegate.call(this,this.root,e,n,i);this.__delegates=this.__delegates.concat(s)}}},{key:"unbind",value:function(e,t){var n=this;if(arguments.length<3&&"function"==typeof t)Array.isArray(e)?e.forEach((function(e){n.unbindEL(e,t)})):this.unbindEL(e,t);else for(var i="".concat(e,"_").concat(t),r=0;r2&&void 0!==arguments[2]&&arguments[2];this.root&&"on".concat(e)in this.root&&"function"==typeof t&&this.root.addEventListener(e,t,n)}},{key:"unbindEL",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.root&&"on".concat(e)in this.root&&"function"==typeof t&&this.root.removeEventListener(e,t,n)}},{key:"show",value:function(e){if(this.root)return this.root.style.display=void 0!==e?e:"block","none"===window.getComputedStyle(this.root,null).getPropertyValue("display")?this.root.style.display="block":void 0}},{key:"hide",value:function(){this.root&&(this.root.style.display="none")}},{key:"appendChild",value:function(e,t){if(!this.root)return null;if(arguments.length<2&&arguments[0]instanceof window.Element)return this.root.appendChild(arguments[0]);if(!(t&&t instanceof window.Element))return null;try{return"string"==typeof e?this.find(e).appendChild(t):e.appendChild(t)}catch(e){return Q.logError("Plugin:appendChild",e),null}}},{key:"render",value:function(){return""}},{key:"destroy",value:function(){}},{key:"__destroy",value:function(){var e=this,n=this.player;this.__delegates.map((function(e){e.destroy()})),this.__delegates=[],this._children instanceof Array&&(this._children.map((function(e){n.unRegisterPlugin(e.pluginName)})),this._children=null),this.root&&(this.root.hasOwnProperty("remove")?this.root.remove():this.root.parentNode&&this.root.parentNode.removeChild(this.root)),F(t,"__destroy",this,3)([]),this.icons={},["root","parent"].map((function(t){e[t]=null}))}}],[{key:"insert",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=t.children.length,r=Number(n),s=e instanceof window.Node;if(i){for(var a=0,o=null,l="";a=r){l="beforebegin";break}c4&&void 0!==arguments[4]&&arguments[4],s=[];if(e instanceof window.Node&&"function"==typeof i)if(Array.isArray(n))n.forEach((function(n){var a=Ne()(e,t,n,i,r);a.key="".concat(t,"_").concat(n),s.push(a)}));else{var a=Ne()(e,t,n,i,r);a.key="".concat(t,"_").concat(n),s.push(a)}return s}},{key:"ROOT_TYPES",get:function(){return Be}},{key:"POSITIONS",get:function(){return Fe}}])}(Ge),ze=function(){return x((function e(){var t=this;if(D(this,e),C(this,"__trigger",(function(e){var n=(new Date).getTime();t.timeStamp=n;for(var i=0;i=t||n<0||d&&e-c>=s}function v(){var e=Date.now();if(m(e))return y(e);o=g(v,function(e){var n=e-c,i=t-(e-l);return d?Math.min(i,s-n):i}(e))}function y(e){return o=void 0,h&&i?f(e):(i=r=void 0,a)}function _(){for(var e=Date.now(),n=m(e),s=arguments.length,h=new Array(s),p=0;p-1?this.__handlers[r].handler=t:this.__handlers.push({target:e,handler:t,playerId:n})}}},{key:"unObserver",value:function(e){var t=-1;this.__handlers.map((function(n,i){e===n.target&&(t=i)}));try{this.observer&&this.observer.unobserve(e)}catch(e){}this.observer&&this.observer.unobserve(e),t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e){for(var t=this.__handlers,n=0;n2&&void 0!==arguments[2]?arguments[2]:{};if(e&&t&&"function"==typeof t&&void 0!==t.prototype){var i=e._pluginInfoId;if(i&&this.pluginGroup[i]){this.pluginGroup[i]._plugins||(this.pluginGroup[i]._plugins={});var r=this.pluginGroup[i]._plugins,s=this.pluginGroup[i]._originalOptions;n.player=e;var a=n.pluginName||t.pluginName;if(!a)throw new Error("The property pluginName is necessary");if(!t.isSupported||t.isSupported(e.config.mediaType,e.config.codecType)){n.config||(n.config={});for(var o=Object.keys(s),l=0;l1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(this.root){var r=e.defaultConfig||{};if(!n.root){switch(n.position?n.position:n.config&&n.config.position?n.config.position:r.position){case Fe.CONTROLS_LEFT:n.root=this.left;break;case Fe.CONTROLS_RIGHT:n.root=this.right;break;case Fe.CONTROLS_CENTER:n.root=this.center;break;case Fe.CONTROLS:n.root=this.root;break;default:n.root=this.left}return F(t,"registerPlugin",this,3)([e,n,i])}}}},{key:"destroy",value:function(){"mobile"!==ne.device&&(this.unbind("mouseenter",this.onMouseEnter),this.unbind("mouseleave",this.onMouseLeave))}},{key:"render",value:function(){var e=this.config,t=e.mode,n=e.autoHide,i=e.initShow;if(!e.disable){var r=Y.classNames({"xgplayer-controls":!0},{"flex-controls":"flex"===t},{"bottom-controls":"bottom"===t},C({},ct,n),{"xgplayer-controls-initshow":i||!n});return'\n \n \n \n \n \n \n \n ')}}}],[{key:"pluginName",get:function(){return"controls"}},{key:"defaultConfig",get:function(){return{disable:!1,autoHide:!0,mode:"",initShow:!1}}}])}(je),gt={lang:{},langKeys:[],textKeys:[]};function mt(e,t){return Object.keys(t).forEach((function(n){var i,r=Y.typeOf(t[n]),s=Y.typeOf(e[n]);"Array"===r?("Array"!==s&&(e[n]=[]),(i=e[n]).push.apply(i,U(t[n]))):"Object"===r?("Object"!==s&&(e[n]={}),mt(e[n],t[n])):e[n]=t[n]})),e}function vt(){Object.keys(gt.lang.en).map((function(e){gt.textKeys[e]=e}))}function yt(e,t){var n=e.LANG;if(t||(t=gt),t.lang){var i=e.TEXT||{};"zh"===n&&(n="zh-cn"),t.lang[n]?mt(t.lang[n],i):(t.langKeys.push(n),t.lang[n]=i),vt()}}yt({LANG:"en",TEXT:{ERROR_TYPES:{network:{code:1,msg:"video download error"},mse:{code:2,msg:"stream append error"},parse:{code:3,msg:"parsing error"},format:{code:4,msg:"wrong format"},decoder:{code:5,msg:"decoding error"},runtime:{code:6,msg:"grammatical errors"},timeout:{code:7,msg:"play timeout"},other:{code:8,msg:"other errors"}},HAVE_NOTHING:"There is no information on whether audio/video is ready",HAVE_METADATA:"Audio/video metadata is ready ",HAVE_CURRENT_DATA:"Data about the current play location is available, but there is not enough data to play the next frame/millisecond",HAVE_FUTURE_DATA:"Current and at least one frame of data is available",HAVE_ENOUGH_DATA:"The available data is sufficient to start playing",NETWORK_EMPTY:"Audio/video has not been initialized",NETWORK_IDLE:"Audio/video is active and has been selected for resources, but no network is used",NETWORK_LOADING:"The browser is downloading the data",NETWORK_NO_SOURCE:"No audio/video source was found",MEDIA_ERR_ABORTED:"The fetch process is aborted by the user",MEDIA_ERR_NETWORK:"An error occurred while downloading",MEDIA_ERR_DECODE:"An error occurred while decoding",MEDIA_ERR_SRC_NOT_SUPPORTED:"Audio/video is not supported",REPLAY:"Replay",ERROR:"Network is offline",PLAY_TIPS:"Play",PAUSE_TIPS:"Pause",PLAYNEXT_TIPS:"Play next",DOWNLOAD_TIPS:"Download",ROTATE_TIPS:"Rotate",RELOAD_TIPS:"Reload",FULLSCREEN_TIPS:"Fullscreen",EXITFULLSCREEN_TIPS:"Exit fullscreen",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"Exit cssfullscreen",TEXTTRACK:"Caption",PIP:"PIP",SCREENSHOT:"Screenshot",LIVE:"LIVE",OFF:"Off",OPEN:"Open",MINI_DRAG:"Click and hold to drag",MINISCREEN:"Miniscreen",REFRESH_TIPS:"Please Try",REFRESH:"Refresh",FORWARD:"forward",LIVE_TIP:"Live"}});var _t={get textKeys(){return gt.textKeys},get langKeys(){return gt.langKeys},get lang(){var e={};return gt.langKeys.map((function(t){e[t]=gt.lang[t]})),gt.lang["zh-cn"]&&(e.zh=gt.lang["zh-cn"]||{}),e},extend:function(e,t){var n=[];if(t||(t=gt),t.lang){n="Array"!==Y.typeOf(e)?Object.keys(e).map((function(t){return{LANG:"zh"===t?"zh-cn":t,TEXT:e[t]}})):e;var i=t.lang;n.map((function(e){"zh"===e.LANG&&(e.LANG="zh-cn"),i[e.LANG]?mt(i[e.LANG]||{},e.TEXT||{}):yt(e,t)})),vt()}},use:yt,init:function(e){var t,n={lang:{},langKeys:[],textKeys:{},pId:e};return mt(n.lang,gt.lang),(t=n.langKeys).push.apply(t,U(gt.langKeys)),mt(n.textKeys,gt.textKeys),n}},Tt=["ERROR","INITIAL","READY","ATTACHING","ATTACHED","NOTALLOW","RUNNING","ENDED","DESTROYED"],bt={},St=null,Pt=function(e){function t(){return D(this,t),k(this,t,arguments)}return O(t,e),x(t,[{key:"add",value:function(e){e&&(bt[e.playerId]=e,1===Object.keys(bt).length&&this.setActive(e.playerId,!0))}},{key:"remove",value:function(e){e&&(e.isUserActive,delete bt[e.playerId])}},{key:"_iterate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(var n in bt)if(Object.prototype.hasOwnProperty.call(bt,n)){var i=bt[n];if(t){if(e(i))break}else e(i)}}},{key:"forEach",value:function(e){this._iterate(e)}},{key:"find",value:function(e){var t=null;return this._iterate((function(n){var i=e(n);return i&&(t=n),i}),!0),t}},{key:"findAll",value:function(e){var t=[];return this._iterate((function(n){e(n)&&t.push(n)})),t}},{key:"setActive",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(bt[e])return t?this.forEach((function(t){e===t.playerId?(t.isUserActive=!0,t.isInstNext=!1):t.isUserActive=!1})):bt[e].isUserActive=t,e}},{key:"getActiveId",value:function(){for(var e=Object.keys(bt),t=0;t1&&void 0!==arguments[1])||arguments[1];if(bt[e])return t?this.forEach((function(t){e===t.playerId?(t.isUserActive=!1,t.isInstNext=!0):t.isInstNext=!1})):bt[e].isInstNext=t,e}}],[{key:"getInstance",value:function(){return St||(St=new t),St}}])}(j.EventEmitter),Mt=["play","pause","replay","retry"],wt=0,Et=0,kt=null,Dt=function(e){function t(e){var n;D(this,t);var i,r=Y.deepMerge(pt(),e);C(n=k(this,t,[r]),"canPlayFunc",(function(){if(n.config){var e=n.config,t=e.autoplay,i=e.defaultPlaybackRate;Q.logInfo("player","canPlayFunc, startTime",n.__startTime),n._seekToStartTime(),n.playbackRate=i,(t||n._useAutoplay)&&n.mediaPlay(),n.off(ce,n.canPlayFunc),n.removeClass(We)}})),C(n,"onFullscreenChange",(function(e,t){var i=function(){Y.setTimeout(n,(function(){n.resize()}),100)},r=Y.getFullScreenEl();n._fullActionFrom?n._fullActionFrom="":n.emit(ve,{eventType:"system",action:"switch_fullscreen",pluginName:"player",currentTime:n.currentTime,duration:n.duration,props:[{prop:"fullscreen",from:!0,to:!1}]});var s=function(e,t,n){if(e){var i=e.getAttribute(n);return!(!i||i!==t||"VIDEO"!==e.tagName&&"AUDIO"!==e.tagName)}}(r,n.playerId,we);if(t||r&&(r===n._fullscreenEl||s))i(),!n.config.closeFocusVideoFocus&&n.media.focus(),n.fullscreen=!0,n.changeFullStyle(n.root,r,it),n.emit(fe,!0,n._fullScreenOffset),n.cssfullscreen&&n.exitCssFullscreen();else if(n.fullscreen){i();var a=n,o=a._fullScreenOffset;if(a.config.needFullscreenScroll?(window.scrollTo(o.left,o.top),Y.setTimeout(n,(function(){n.fullscreen=!1,n._fullScreenOffset=null}),100)):(!n.config.closeFocusVideoFocus&&n.media.focus(),n.fullscreen=!1,n._fullScreenOffset=null),n.cssfullscreen)n.removeClass(it);else{var l=n._fullscreenEl;l||!n.root.contains(e.target)&&e.target!==n.root||(l=e.target),n.recoverFullStyle(n.root,l,it)}n._fullscreenEl=null,n.emit(fe,!1)}})),C(n,"_onWebkitbeginfullscreen",(function(e){n._fullscreenEl=n.media,n.onFullscreenChange(e,!0)})),C(n,"_onWebkitendfullscreen",(function(e){n.onFullscreenChange(e,!1)})),Ie(n,Mt),n.config=r,n._pluginInfoId=Y.generateSessionId(),(i=n).logInfo=Q.logInfo.bind(i),i.logWarn=Q.logWarn.bind(i),i.logError=Q.logError.bind(i);var s=n.constructor.defaultPreset,a=n.config.presets;if(a.length){var o=a.indexOf("default");o>=0&&s&&(a[o]=s)}else s&&a.push(s);n.userTimer=null,n.waitTimer=null,n.handleSource=!0,n._state=1,n.isError=!1,n._hasStart=!1,n.isSeeking=!1,n.isCanplay=!1,n._useAutoplay=!1,n.__startTime=-1,n.rotateDeg=0,n.isActive=!1,n.fullscreen=!1,n.cssfullscreen=!1,n.isRotateFullscreen=!1,n._fullscreenEl=null,n.timeSegments=[],n._cssfullscreenEl=null,n.curDefinition=null,n._orgCss="",n._fullScreenOffset=null,n._videoHeight=0,n._videoWidth=0,n.videoPos={pi:1,scale:0,rotate:-1,x:0,y:0,h:-1,w:-1,vy:0,vx:0},n.sizeInfo={width:0,height:0,left:0,top:0},n._accPlayed={t:0,acc:0,loopAcc:0},n._offsetInfo={currentTime:-1,duration:0},n.innerContainer=null,n.controls=null,n.topBar=null,n.root=null,n.__i18n=_t.init(n._pluginInfoId),ne.os.isAndroid&&ne.osVersion>0&&ne.osVersion<6&&(n.config.autoplay=!1),n.database=new be,n.isUserActive=!1,n._onceSeekCanplay=null,n._isPauseBeforeSeek=0,n.innerStates={isActiveLocked:!1},n.instManager=kt,n._initMedia();var l=n.config.isNoRoot,c=!l&&n._initDOM();if(!l&&!c)return console.error(new Error("can't find the dom which id is ".concat(n.config.id," or this.config.el does not exist"))),N(n);Ke.init(n);var u=n.config,d=u.definition,h=void 0===d?{}:d;if(!u.url&&h.list&&h.list.length>0){var p=h.list.find((function(e){return e.definition&&e.definition===h.defaultDefinition}));p||(h.defaultDefinition=h.list[0].definition,p=h.list[0]),n.config.url=p.url,n.curDefinition=p}return n._bindEvents(),n._registerPresets(),n._registerPlugins(),Ke.onPluginsReady(n),n.getInitDefinition(),n.setState(2),Y.setTimeout(n,(function(){n.emit("ready")}),0),n.onReady&&n.onReady(),(n.config.videoInit||n.config.autoplay)&&(!n.hasStart||n.state<4)&&n.start(),n}return O(t,e),x(t,[{key:"_initMedia",value:function(){var e=this.constructor.XgVideoProxy;if(e&&this.mediaConfig.mediaType===e.mediaType){var t=this.innerContainer||this.root;this.detachVideoEvents(this.media);var n=new e(t,this.config,this.mediaConfig);this.attachVideoEvents(n),this.media=n}this.media.setAttribute(we,this.playerId)}},{key:"_initDOM",value:function(){var e,t=this,n=this.config,i=n.id,r=n.el,s=n.isCustomRoot,a=n.controls,o=n.autoplay,l=n.isMobileSimulateMode;if(this.root=i?document.getElementById(i):null,!this.root)if(r&&1===r.nodeType)this.root=r;else{if(s)return this.emit("error",new ae("use",this.config.vid,{line:32,handle:"Constructor",msg:"container id can't be empty"})),console.error("this.confg.id or this.config.el can't be empty"),!1;this.root=Y.createDom("div","",{id:i,class:ht})}var c=function(e){for(var t=Object.keys(bt),n=0;n0?this._attachSourceEvents(this.media,e):this.media.src&&this.media.src===e?e||this.media.removeAttribute("src"):this.media.src=e),"Number"===Y.typeOf(this.config.volume)&&(this.volume=this.config.volume);var n=this.innerContainer?this.innerContainer:this.root;n&&this.media instanceof window.Element&&!n.contains(this.media)&&n.insertBefore(this.media,n.firstChild);var i=this.media.readyState;Q.logInfo("_startInit readyState",i),this.config.autoplay&&(!Y.isMSE(this.media)&&this.load(),(ne.os.isIpad||ne.os.isPhone)&&this.mediaPlay());var r=this.config.startTime;this.__startTime=r>0?r:-1,this.config.startTime=0,i>=2&&this.duration>0?this.canPlayFunc():this.on(ce,this.canPlayFunc),(!this.hasStart||this.state<4)&&Ke.afterInit(this),this.hasStart=!0,this.setState(4),Y.setTimeout(this,(function(){t.emit("complete")}),0)}}},{key:"_registerPlugins",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._loadingPlugins=[];var n=this.config.ignores||[],i=this.config.plugins||[],r=this.config.i18n||[];t&&_t.extend(r,this.__i18n);var s=n.join("||").toLowerCase().split("||"),a=this.plugins;i.forEach((function(n){try{var i=n.plugin?n.plugin.pluginName:n.pluginName;if(i&&s.indexOf(i.toLowerCase())>-1)return null;if(!t&&a[i.toLowerCase()])return;if(n.lazy&&n.loader){var r=Ke.lazyRegister(e,n);return void(n.forceBeforeInit&&(r.then((function(){e._loadingPlugins.splice(e._loadingPlugins.indexOf(r),1)})).catch((function(t){Q.logError("_registerPlugins:loadingPlugin",t),e._loadingPlugins.splice(e._loadingPlugins.indexOf(r),1)})),e._loadingPlugins.push(r)))}return e.registerPlugin(n)}catch(e){Q.logError("_registerPlugins:",e)}}))}},{key:"_registerPresets",value:function(){var e=this;this.config.presets.forEach((function(t){!function(e,t){var n,i,r=t.preset&&t.options?new t.preset(t.options,e.config):new t({},e.config),s=r.plugins,a=void 0===s?[]:s,o=r.ignores,l=void 0===o?[]:o,c=r.icons,u=void 0===c?{}:c,d=r.i18n,h=void 0===d?[]:d;e.config.plugins||(e.config.plugins=[]),e.config.ignores||(e.config.ignores=[]),(n=e.config.plugins).push.apply(n,U(a)),(i=e.config.ignores).push.apply(i,U(l)),Object.keys(u).map((function(t){e.config.icons[t]||(e.config.icons[t]=u[t])}));var p=e.config.i18n||[];h.push.apply(h,U(p)),e.config.i18n=h}(e,t)}))}},{key:"_getRootByPosition",value:function(e){var t=null;switch(e){case Fe.ROOT_RIGHT:this.rightBar||(this.rightBar=Y.createPositionBar("xg-right-bar",this.root)),t=this.rightBar;break;case Fe.ROOT_LEFT:this.leftBar||(this.leftBar=Y.createPositionBar("xg-left-bar",this.root)),t=this.leftBar;break;case Fe.ROOT_TOP:this.topBar||(this.topBar=Y.createPositionBar("xg-top-bar",this.root),this.config.topBarAutoHide&&Y.addClass(this.topBar,"top-bar-autohide")),t=this.topBar;break;default:t=this.innerContainer||this.root}return t}},{key:"registerPlugin",value:function(e,t){var n=Ke.formatPluginInfo(e,t),i=n.PLUFGIN,r=n.options,s=this.config.plugins;!Ke.checkPluginIfExits(i.pluginName,s)&&s.push(i);var a=Ke.getRootByConfig(i.pluginName,this.config);a.root&&(r.root=a.root),a.position&&(r.position=a.position);var o=r.position?r.position:r.config&&r.config.position||i.defaultConfig&&i.defaultConfig.position;return!r.root&&"string"==typeof o&&o.indexOf("controls")>-1?this.controls&&this.controls.registerPlugin(i,r,i.pluginName):(r.root||(r.root="controls"===i.pluginName?this.root:this._getRootByPosition(o)),Ke.register(this,i,r))}},{key:"deregister",value:function(e){"string"==typeof e?Ke.unRegister(this,e):e instanceof Ge&&Ke.unRegister(this,e.pluginName)}},{key:"unRegisterPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.deregister(e),t&&this.removePluginFromConfig(e)}},{key:"removePluginFromConfig",value:function(e){var t;if("string"==typeof e?t=e:e instanceof Ge&&(t=e.pluginName),t)for(var n=this.config.plugins.length-1;n>-1;n--)if(this.config.plugins[n].pluginName.toLowerCase()===t.toLowerCase()){this.config.plugins.splice(n,1);break}}},{key:"plugins",get:function(){return Ke.getPlugins(this)}},{key:"getPlugin",value:function(e){var t=Ke.findPlugin(this,e);return t&&t.pluginName?t:null}},{key:"addClass",value:function(e){this.root&&(Y.hasClass(this.root,e)||Y.addClass(this.root,e))}},{key:"removeClass",value:function(e){this.root&&Y.removeClass(this.root,e)}},{key:"hasClass",value:function(e){if(this.root)return Y.hasClass(this.root,e)}},{key:"setAttribute",value:function(e,t){this.root&&this.root.setAttribute(e,t)}},{key:"removeAttribute",value:function(e,t){this.root&&this.root.removeAttribute(e,t)}},{key:"start",value:function(e){var t=this;if(!(this.state>3))return e||this.config.url||this.getInitDefinition(),this.hasStart=!0,this.setState(3),this._registerPlugins(!1),Ke.beforeInit(this).then((function(){if(t.config){e||(e=t.url||t.config.url);var n=t._preProcessUrl(e);return t._startInit(n.url)}})).catch((function(e){throw e.fileName="player",e.lineNumber="236",Q.logError("start:beforeInit:",e),e}))}},{key:"switchURL",value:function(e,t){var n=this,i=e;"Object"===Y.typeOf(e)&&(i=e.url),i=this._preProcessUrl(i).url;var r=this.currentTime;this.__startTime=r;var s=this.paused&&!this.isError;return this.src=i,new Promise((function(e,t){var r=function(e){n.off("timeupdate",a),n.off("canplay",a),t(e)},a=function(){n._seekToStartTime(),s&&n.pause(),n.off("error",r),e(!0)};n.once("error",r),i?(ne.os.isAndroid?n.once("timeupdate",a):n.once("canplay",a),n.play()):n.errorHandler("error",{code:6,message:"empty_src"})}))}},{key:"videoPlay",value:function(){this.mediaPlay()}},{key:"mediaPlay",value:function(){var e=this;if(!this.hasStart&&this.state<4)return this.removeClass(tt),this.addClass(We),this.start(),void(this._useAutoplay=!0);this.state<6&&(this.removeClass(tt),!this.isCanplay&&this.addClass(We));var n=F(t,"play",this,3)([]);return void 0!==n&&n&&n.then?n.then((function(){e.removeClass(ut),e.addClass(qe),e.state<6&&(Q.logInfo(">>>>playPromise.then"),e.setState(6),e.emit(pe))})).catch((function(t){if(Q.logWarn(">>>>playPromise.catch",t.name),e.media&&e.media.error)return e.onError(),void e.removeClass(We);"NotAllowedError"===t.name&&(e._errorTimer=Y.setTimeout(e,(function(){e._errorTimer=null,e.emit("autoplay_was_prevented"),e.addClass(ut),e.removeClass(We),e.pause(),e.setState(5)}),0))})):(Q.logWarn("video.play not return promise"),this.state<6&&(this.setState(6),this.removeClass(ut),this.removeClass(tt),this.removeClass(We),this.addClass(qe),this.emit(pe))),n}},{key:"mediaPause",value:function(){F(t,"pause",this,3)([])}},{key:"videoPause",value:function(){F(t,"pause",this,3)([])}},{key:"play",value:function(){var e=this;return this.removeClass(Qe),Oe(this,"play",(function(){return e.mediaPlay()}))}},{key:"pause",value:function(){var e=this;Oe(this,"pause",(function(){F(t,"pause",e,3)([])}))}},{key:"seek",value:function(e,t){var n=this;if(this.media&&!Number.isNaN(Number(e))&&this.hasStart){var i=this.config,r=i.isSeekedPlay,s=i.seekedStatus,a=t||(r?"play":s);e=e<0?0:e>this.duration?parseInt(this.duration,10):e,!this._isPauseBeforeSeek&&(this._isPauseBeforeSeek=this.paused?2:1),this._onceSeekCanplay&&this.off(le,this._onceSeekCanplay),this._onceSeekCanplay=function(){switch(n.removeClass(We),n.isSeeking=!1,a){case"play":n.play();break;case"pause":n.pause();break;default:n._isPauseBeforeSeek>1||n.paused?n.pause():n.play()}n._isPauseBeforeSeek=0,n._onceSeekCanplay=null},this.once(le,this._onceSeekCanplay),this.state<6?(this.removeClass(tt),this.currentTime=e,this.play()):this.currentTime=e}}},{key:"getInitDefinition",value:function(){var e=this,t=this.config,n=t.definition;!t.url&&n&&n.list&&n.list.length>0&&n.defaultDefinition&&n.list.map((function(t){t.definition===n.defaultDefinition&&(e.config.url=t.url,e.curDefinition=t)}))}},{key:"changeDefinition",value:function(e,t){var n=this,i=this.config.definition;if(Array.isArray(null==i?void 0:i.list)&&i.list.forEach((function(t){(null==e?void 0:e.definition)===t.definition&&(n.curDefinition=t)})),null!=e&&e.bitrate&&"number"!=typeof e.bitrate&&(e.bitrate=parseInt(e.bitrate,10)||0),this.emit("definition_change",{from:t,to:e}),this.hasStart){var r=this.switchURL(e.url,$({seamless:!1!==i.seamless&&"undefined"!=typeof MediaSource&&"function"==typeof MediaSource.isTypeSupported},e));r&&r.then?r.then((function(){n.emit(me,{from:t,to:e})})):this.emit(me,{from:t,to:e})}else this.config.url=e.url}},{key:"reload",value:function(){this.load(),this.reloadFunc=function(){this.play()},this.once(ue,this.reloadFunc)}},{key:"resetState",value:function(){var e=this,t=[ut,qe,tt,Qe,et,We,Ye,Ze,Je];this.hasStart=!1,this.isError=!1,this._useAutoplay=!1,this.mediaPause(),this._accPlayed.acc=0,this._accPlayed.t=0,this._accPlayed.loopAcc=0,t.forEach((function(t){e.removeClass(t)})),this.addClass(tt),this.emit("reset")}},{key:"reset",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;if(this.resetState(),this.plugins&&(t.map((function(t){e.deregister(t)})),n)){var i=pt();Object.keys(this.config).keys((function(t){"undefined"===e.config[t]||"plugins"!==t&&"presets"!==t&&"el"!==t&&"id"!==t||(e.config[t]=i[t])}))}}},{key:"destroy",value:function(){var e,n=this,i=this.innerContainer,r=this.root,s=this.media;if(s){if(this.hasStart=!1,this._useAutoplay=!1,r&&r.removeAttribute(we),this.updateAcc("destroy"),this._unbindEvents(),this._detachSourceEvents(this.media),Y.clearAllTimers(this),this.emit("destroy"),null===(e=kt)||void 0===e||e.remove(this),Ke.destroy(this),Le(this),F(t,"destroy",this,3)([]),this.fullscreen&&this._fullscreenEl===r&&this.exitFullscreen(),i)for(var a=i.children,o=0;o0?r.className=l.filter((function(e){return e.indexOf("xgplayer")<0})).join(" "):r&&(r.className=""),this.removeAttribute("data-xgfill"),["isSeeking","isCanplay","isActive","cssfullscreen","fullscreen"].forEach((function(e){n[e]=!1})),c&&this.root.parentNode&&this.root.parentNode.removeChild(this.root)}}},{key:"replay",value:function(){var e=this;this.removeClass(Ye),this.currentTime=0,this.isSeeking=!1,Oe(this,"replay",(function(){e.once(le,(function(){var t=e.mediaPlay();t&&t.catch&&t.catch((function(e){console.log(e)}))})),e.emit("replay"),e.onPlay()}))}},{key:"retry",value:function(){var e=this;this.removeClass(Ze),this.addClass(Je),Oe(this,"retry",(function(){var t=e.currentTime,n=e.config.url,i=Y.isMSE(e.media)?{url:n}:e._preProcessUrl(n);e.src=i.url,!e.config.isLive&&(e.currentTime=t),e.once(ce,(function(){e.mediaPlay()}))}))}},{key:"changeFullStyle",value:function(e,t,n,i){e&&(i||(i=ot),this._orgCss||(this._orgCss=Y.filterStyleFromText(e)),Y.addClass(e,n),t&&t!==e&&!this._orgPCss&&(this._orgPCss=Y.filterStyleFromText(t),Y.addClass(t,i),t.setAttribute(we,this.playerId)))}},{key:"recoverFullStyle",value:function(e,t,n,i){i||(i=ot),this._orgCss&&(Y.setStyleFromCsstext(e,this._orgCss),this._orgCss=""),Y.removeClass(e,n),t&&t!==e&&this._orgPCss&&(Y.setStyleFromCsstext(t,this._orgPCss),this._orgPCss="",Y.removeClass(t,i),t.removeAttribute(we))}},{key:"getFullscreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget,t=this.root,n=this.media;if("video"!==e&&"media"!==e||(e=this[e]),e||(e=t),this._fullScreenOffset={top:Y.scrollTop(),left:Y.scrollLeft()},this._fullscreenEl=e,this._fullActionFrom="get",Y.getFullScreenEl()===this._fullscreenEl)return this.onFullscreenChange(),Promise.resolve();try{for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget;this.isRotateFullscreen?this.exitRotateFullscreen():this.fullscreen&&this.exitFullscreen();var t=e?"".concat(lt," ").concat(rt):rt;this.changeFullStyle(this.root,e,t);var n=this.config.fullscreen,i=void 0===n?{}:n;(!0===i.useCssFullscreen||"function"==typeof i.useCssFullscreen&&i.useCssFullscreen())&&(this.fullscreen=!0,this.emit(fe,!0)),this._cssfullscreenEl=e,this.cssfullscreen=!0,this.emit(ge,!0)}},{key:"exitCssFullscreen",value:function(){var e=this._cssfullscreenEl?"".concat(lt," ").concat(rt):rt;if(this.fullscreen){var t=this.config.fullscreen,n=void 0===t?{}:t;!0===n.useCssFullscreen||"function"==typeof n.useCssFullscreen&&n.useCssFullscreen()?(this.recoverFullStyle(this.root,this._cssfullscreenEl,e),this.fullscreen=!1,this.emit(fe,!1)):this.removeClass(e)}else this.recoverFullStyle(this.root,this._cssfullscreenEl,e);this._cssfullscreenEl=null,this.cssfullscreen=!1,this.emit(ge,!1)}},{key:"getRotateFullscreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget;this.cssfullscreen&&this.exitCssFullscreen(e);var t=e?"".concat(lt," ").concat(st):st;this._fullscreenEl=e||this.root,this.changeFullStyle(this.root,e,t,at),this.isRotateFullscreen=!0,this.fullscreen=!0,this.setRotateDeg(90),this._rootStyle=this.root.getAttribute("style"),this.root.style.width="".concat(window.innerHeight,"px"),this.emit(fe,!0)}},{key:"exitRotateFullscreen",value:function(e){var t=this._fullscreenEl!==this.root?"".concat(lt," ").concat(st):st;this.recoverFullStyle(this.root,this._fullscreenEl,t,at),this.isRotateFullscreen=!1,this.fullscreen=!1,this.setRotateDeg(0),this.emit(fe,!1),this._rootStyle&&(this.root.style.style=this._rootStyle,this._rootStyle=!1)}},{key:"setRotateDeg",value:function(e){90===window.orientation||-90===window.orientation?this.rotateDeg=0:this.rotateDeg=e}},{key:"focus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{autoHide:!this.config.closeDelayBlur,delay:this.config.inactive};this.isActive?this.onFocus(e):this.emit(de,$({paused:this.paused,ended:this.ended},e))}},{key:"blur",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{ignorePaused:!1};this.isActive?(this._clearUserTimer(),this.emit(he,$({paused:this.paused,ended:this.ended},e))):this.onBlur(e)}},{key:"onFocus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{autoHide:!0,delay:3e3},n=this.innerStates;if(this.isActive=!0,this.removeClass(nt),this._clearUserTimer(),void 0!==t.isLock&&(n.isActiveLocked=t.isLock),!1===t.autoHide||!0===t.isLock||n.isActiveLocked)this._clearUserTimer();else{var i=t&&t.delay?t.delay:this.config.inactive;this.userTimer=Y.setTimeout(this,(function(){e.userTimer=null,e.blur()}),i)}}},{key:"onBlur",value:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).ignorePaused,t=void 0!==e&&e;if(!this.innerStates.isActiveLocked){var n=this.config.closePauseVideoFocus;this.isActive=!1,(t||n||!this.paused&&!this.ended)&&this.addClass(nt)}}},{key:"onEmptied",value:function(){this.updateAcc("emptied")}},{key:"onCanplay",value:function(){this.removeClass(We),this.removeClass(Ze),this.removeClass(Je),this.isCanplay=!0,this.waitTimer&&Y.clearTimeout(this,this.waitTimer)}},{key:"onLoadeddata",value:function(){var e=this;this.isError=!1,this.isSeeking=!1,this.__startTime>0&&(this.duration>0?this._seekToStartTime():this.once("durationchange",(function(){e._seekToStartTime()})))}},{key:"onLoadstart",value:function(){this.removeClass(Ze),this.isCanplay=!1}},{key:"onPlay",value:function(){7===this.state&&this.setState(6),this.removeClass(Qe),this.ended&&this.removeClass(Ye),!this.config.closePlayVideoFocus&&this.focus()}},{key:"onPause",value:function(){this.addClass(Qe),this.updateAcc("pause"),this.config.closePauseVideoFocus||(this._clearUserTimer(),this.focus())}},{key:"onEnded",value:function(){this.updateAcc("ended"),this.addClass(Ye),this.setState(7)}},{key:"onError",value:function(){this.isError=!0,this.updateAcc("error"),this.removeClass(ut),this.removeClass(tt),this.removeClass(We),this.removeClass(Je),this.addClass(Ze)}},{key:"onSeeking",value:function(){this.isSeeking||this.updateAcc("seeking"),this.isSeeking=!0,this.addClass(dt)}},{key:"onSeeked",value:function(){this.isSeeking=!1,this.waitTimer&&Y.clearTimeout(this,this.waitTimer),this.removeClass(Je),this.removeClass(dt)}},{key:"onWaiting",value:function(){var e=this;this.waitTimer&&Y.clearTimeout(this,this.waitTimer),this.updateAcc("waiting"),this.waitTimer=Y.setTimeout(this,(function(){e.addClass(Je),e.emit("loading"),Y.clearTimeout(e,e.waitTimer),e.waitTimer=null}),this.config.minWaitDelay)}},{key:"onPlaying",value:function(){var e=this;this.isError=!1,[tt,Qe,Ye,Ze,et,Je].forEach((function(t){e.removeClass(t)})),this._accPlayed.t||this.paused||this.ended||(this._accPlayed.t=(new Date).getTime())}},{key:"onTimeupdate",value:function(){!this._videoHeight&&this.media.videoHeight&&this.resize(),(this.waitTimer||this.hasClass(Je))&&this.media.readyState>2&&(this.removeClass(Je),Y.clearTimeout(this,this.waitTimer),this.waitTimer=null),!this.paused&&5===this.state&&this.duration&&(this.setState(6),this.emit(pe)),this._accPlayed.t||this.paused||this.ended||(this._accPlayed.t=(new Date).getTime())}},{key:"onVolumechange",value:function(){"Number"===Y.typeOf(this.config.volume)&&(this.config.volume=this.volume)}},{key:"onRatechange",value:function(){this.config.defaultPlaybackRate=this.playbackRate}},{key:"emitUserAction",value:function(e,t,n){if(this.media&&t&&e){var i="String"===Y.typeOf(e)?e:e.type||"";n.props&&"Array"!==Y.typeOf(n.props)&&(n.props=[n.props]),this.emit(ve,$({eventType:i,action:t,currentTime:this.currentTime,duration:this.duration,ended:this.ended,event:e},n))}}},{key:"updateAcc",value:function(e){if(this._accPlayed.t){var t=(new Date).getTime()-this._accPlayed.t;this._accPlayed.acc+=t,this._accPlayed.t=0,("ended"===e||this.ended)&&(this._accPlayed.loopAcc=this._accPlayed.acc)}}},{key:"checkBuffer",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{startDiff:0,endDiff:0})||{},n=t.startDiff,i=void 0===n?0:n,r=t.endDiff,s=void 0===r?0:r,a=this.media.buffered;if(!a||0===a.length||!this.duration)return!0;for(var o=e||this.media.currentTime||.2,l=a.length,c=0;co)return!0;return!1}},{key:"resizePosition",value:function(){var e=this.videoPos,t=e.vy,n=e.vx,i=e.h,r=e.w,s=this.videoPos.rotate;if(!(s<0&&i<0&&r<0)){var a=this.videoPos._pi;if(!a&&this.media.videoHeight&&(a=this.media.videoWidth/this.media.videoHeight*100),a){this.videoPos.pi=a;var o={rotate:s=s<0?0:s},l=0,c=0,u=1,d=Math.abs(s/90),h=this.root,p=this.innerContainer,f=h.offsetWidth,g=p?p.offsetHeight:h.offsetHeight,m=g,v=f;if(d%2==0)u=i>0?100/i:r>0?100/r:1,o.scale=u,l=t>0?(100-i)/2-t:0,o.y=2===d?0-l:l,c=n>0?(100-r)/2-n:0,o.x=2===d?0-c:c,this.media.style.width="".concat(v,"px"),this.media.style.height="".concat(m,"px");else if(d%2==1){m=f;var y=g-f;c=-y/2/(v=g)*100,o.x=3===d?c+t/2:c-t/2,l=y/2/m*100,o.y=3===d?l+n/2:l-n/2,o.scale=u,this.media.style.width="".concat(v,"px"),this.media.style.height="".concat(m,"px")}var _=Y.getTransformStyle(o,this.media.style.transform||this.media.style.webkitTransform);this.media.style.transform=_,this.media.style.webkitTransform=_}}}},{key:"position",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{h:0,y:0,x:0,w:0};if(this.media&&e&&e.h){var t=this.videoPos;t.h=100*e.h||0,t.w=100*e.w||0,t.vx=100*e.x||0,t.vy=100*e.y||0,this.resizePosition()}}},{key:"setConfig",value:function(e){var t=this;e&&Object.keys(e).map((function(n){if("plugins"!==n){t.config[n]=e[n];var i=t.plugins[n.toLowerCase()];i&&"Function"===Y.typeOf(i.setConfig)&&i.setConfig(e[n])}}))}},{key:"playNext",value:function(e){var t=this;this.resetState(),this.setConfig(e),this._currentTime=0,this._duration=0,Oe(this,"playnext",(function(){t.start(),t.emit("playnext",e)}))}},{key:"resize",value:function(){var e=this;if(this.media&&this.root){var t=this.root.getBoundingClientRect();this.sizeInfo.width=t.width,this.sizeInfo.height=t.height,this.sizeInfo.left=t.left,this.sizeInfo.top=t.top;var n=this.media,i=n.videoWidth,r=n.videoHeight,s=this.config,a=s.fitVideoSize,o=s.videoFillMode;if("fill"!==o&&"cover"!==o&&"contain"!==o||this.setAttribute("data-xgfill",o),r&&i){this._videoHeight=r,this._videoWidth=i;var l=this.controls&&this.innerContainer?this.controls.root.getBoundingClientRect().height:0,c=t.width,u=t.height-l,d=parseInt(i/r*1e3,10),h=parseInt(c/u*1e3,10),p=c,f=u,g={};"auto"===a&&h>d||"fixWidth"===a?(f=c/d*1e3,this.config.fluid?g.paddingTop="".concat(100*f/p,"%"):g.height="".concat(f+l,"px")):("auto"===a&&hd)&&this.setAttribute("data-xgfill","cover");var m={videoScale:d,vWidth:p,vHeight:f,cWidth:p,cHeight:f+l};this.resizePosition(),this.emit("video_resize",m)}}}},{key:"updateObjectPosition",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.media.updateObjectPosition?this.media.updateObjectPosition(e,t):this.media.style.objectPosition="".concat(100*e,"% ").concat(100*t,"%")}},{key:"setState",value:function(e){Q.logInfo("setState","state from:".concat(Tt[this.state]," to:").concat(Tt[e])),this._state=e}},{key:"_preProcessUrl",value:function(e,t){var n=this.config,i=n.preProcessUrl,r=n.preProcessUrlOptions,s=Object.assign({},r,t);return Y.isBlob(e)||"function"!=typeof i?{url:e}:i(e,s)}},{key:"_seekToStartTime",value:function(){this.__startTime>0&&this.duration>0&&(this.currentTime=this.__startTime>this.duration?this.duration:this.__startTime,this.__startTime=-1)}},{key:"state",get:function(){return this._state}},{key:"isFullscreen",get:function(){return this.fullscreen}},{key:"isCssfullScreen",get:function(){return this.cssfullscreen}},{key:"hasStart",get:function(){return this._hasStart},set:function(e){"boolean"==typeof e&&(this._hasStart=e,!1===e&&this.setState(2),this.emit("hasstart"))}},{key:"isPlaying",get:function(){return 6===this._state||7===this._state},set:function(e){e?this.setState(6):this._state>=6&&this.setState(4)}},{key:"definitionList",get:function(){return this.config&&this.config.definition&&this.config.definition.list||[]},set:function(e){var t=this,n=this.config.definition,i=null,r=null;n.list=e,this.emit("resourceReady",e),e.forEach((function(e){var s;(null===(s=t.curDefinition)||void 0===s?void 0:s.definition)===e.definition&&(i=e),n.defaultDefinition===e.definition&&(r=e)})),!r&&e.length>0&&(r=e[0]),i?this.changeDefinition(i):r&&this.changeDefinition(r)}},{key:"videoFrameInfo",get:function(){var e={total:0,dropped:0,corrupted:0,droppedRate:0,droppedDuration:0};if(!this.media||!this.media.getVideoPlaybackQuality)return e;var t=this.media.getVideoPlaybackQuality();return e.dropped=t.droppedVideoFrames||0,e.total=t.totalVideoFrames||0,e.corrupted=t.corruptedVideoFrames||0,e.total>0&&(e.droppedRate=e.dropped/e.total*100,e.droppedDuration=parseInt(this.cumulateTime/e.total*e.dropped,0)),e}},{key:"lang",get:function(){return this.config.lang},set:function(e){0!==_t.langKeys.filter((function(t){return t===e})).length||"zh"===e?(this.config.lang=e,Ke.setLang(e,this)):console.error("Sorry, set lang fail, because the language [".concat(e,"] is not supported now, list of all supported languages is [").concat(_t.langKeys.join(),"] "))}},{key:"i18n",get:function(){var e=this.config.lang;return"zh"===e&&(e="zh-cn"),this.__i18n.lang[e]||this.__i18n.lang.en}},{key:"i18nKeys",get:function(){return this.__i18n.textKeys||{}}},{key:"version",get:function(){return ie}},{key:"playerId",get:function(){return this._pluginInfoId}},{key:"url",get:function(){return this.__url||this.config.url},set:function(e){this.__url=e}},{key:"poster",get:function(){return this.plugins.poster?this.plugins.poster.config.poster:this.config.poster},set:function(e){this.plugins.poster&&this.plugins.poster.update(e)}},{key:"readyState",get:function(){return F(t,"readyState",this,1)}},{key:"error",get:function(){var e=F(t,"error",this,1);return this.i18n[e]||e}},{key:"networkState",get:function(){return F(t,"networkState",this,1)}},{key:"fullscreenChanging",get:function(){return!(null===this._fullScreenOffset)}},{key:"cumulateTime",get:function(){var e=this._accPlayed,t=e.acc,n=e.t;return n?(new Date).getTime()-n+t:t}},{key:"zoom",get:function(){return this.config.zoom},set:function(e){this.config.zoom=e}},{key:"videoRotateDeg",get:function(){return this.videoPos.rotate},set:function(e){(e=Y.convertDeg(e))%90==0&&e!==this.videoPos.rotate&&(this.videoPos.rotate=e,this.resizePosition())}},{key:"avgSpeed",get:function(){return Et},set:function(e){Et=e}},{key:"realTimeSpeed",get:function(){return wt},set:function(e){wt=e}},{key:"offsetCurrentTime",get:function(){return this._offsetInfo.currentTime||0},set:function(e){this._offsetInfo.currentTime=e}},{key:"offsetDuration",get:function(){return this._offsetInfo.duration||0},set:function(e){this._offsetInfo.duration=e||0}},{key:"hook",value:function(e,t){return ke.call.apply(ke,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){return De.call.apply(De,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,t){return Re.call.apply(Re,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"usePluginHooks",value:function(e,t,n){for(var i=arguments.length,r=new Array(i>3?i-3:0),s=3;s3?i-3:0),s=3;s((e,t,n)=>t in e?Rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class Ct{constructor(){this.__handlers=[],window.ResizeObserver&&(this.observer=new window.ResizeObserver((e=>{this.__trigger(e)})))}addObserver(e,t){if(!this.observer)return;this.observer&&this.observer.observe(e);const{__handlers:n}=this;let i=-1;for(let t=0;t-1?this.__handlers[i].handler.push(t):this.__handlers.push({target:e,handler:[t]})}unObserver(e){let t=-1;this.__handlers.map(((n,i)=>{e===n.target&&(t=i)})),this.observer&&this.observer.unobserve(e),t>-1&&this.__handlers.splice(t,1)}destroyObserver(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=[]}__runHandler(e,t){const{__handlers:n}=this;for(let i=0;i{try{n(e,t)}catch(e){console.error(e)}}));break}}__trigger(e){e.map((e=>{const t=e.contentRect;this.__runHandler(e.target,t)}))}}let It=null;const Lt="change",Ot="update",At="error",Gt=[{code:0,msg:"SUCCESS"},{code:1,msg:"LOAD_ERROR",type:"LOAD_ERROR"},{code:2,msg:"PARSER_ERROR",type:"PARSER_ERROR"},{code:3,msg:"FORMAT_NOT_SUPPORTED",type:"FORMAT_NOT_SUPPORTED"},{code:4,msg:"ID_OR_LANGUAGE_NOT_EXIST",type:"ID_OR_LANGUAGE_NOT_EXIST"},{code:5,msg:"PARAMETERS_ERROR",type:"PARAMETERS_ERROR"},{code:6,msg:"ABORT",type:"ABORT"},{code:7,msg:"UNKNOWN",type:"UNKNOWN"},{code:8,msg:"DATA_ERROR:subtitle.url is null",type:"DATA_ERROR"},{code:9,msg:"DATA_ERROR:subtitle.url length is 0",type:"DATA_ERROR"}];class $t extends Error{constructor(e,t,n,i){e||(e=Gt[t||7].msg),super(e),this.message="",this.code=t||7,this.message=e,this.type=Gt[t||7].msg,this.orgError=n||null,this.data=i||null}}function Nt(e,t={},n){const i={code:Gt[e].code,message:Gt[e].msg,id:"",language:""};return Object.keys(t).map((e=>{i[e]=t[e]})),i}class Bt{constructor(){let e,t;const n=new Promise(((n,i)=>{e=n,t=i}));return n.resolve=function(t){e(t),n.state="fulfilled"},n.reject=function(e){t(e),n.state="rejected",n.isBreak="DESTROYED"===e},n.state="pending",n}resolve(e){}reject(e){}}function Ft(e,t){if(!e)return!1;if(e.classList)return Array.prototype.some.call(e.classList,(e=>e===t));{const n=e.className&&"object"==typeof e.className?e.getAttribute("class"):e.className;return n&&!!n.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}}function Ut(e,t){e&&(e.classList?t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((t=>{t&&e.classList.add(t)})):Ft(e,t)||(e.className&&"object"==typeof e.className?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t))}function Ht(e){const t=Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g);return t?t[0]:""}function Vt(e="div",t="",n={},i=""){const r=document.createElement(e);return r.className=i,r.innerHTML=t,Object.keys(n).forEach((t=>{const i=t,s=n[t];"video"===e||"audio"===e||"live-video"===e?s&&r.setAttribute(i,s):r.setAttribute(i,s)})),r}function jt(e){return e&&e instanceof window.HTMLMediaElement}function zt(e){const t=[];if(e&&"String"===Ht(e))t.push({url:[e],index:0,start:-1,end:-1});else if("Array"===Ht(e)){const n=e;if(0===n.length)return t;"String"===Ht(n[0])?t.push({url:e,index:0,start:-1,end:-1}):n.forEach(((e,n)=>{const i=e;t.push({url:i.url||i.src||"",index:n,start:i.start||-1,end:i.end||-1})}))}return t}function Xt(e,t,n){const i=t.length;if(i<1)return-1;if(t[n=n<0?0:n>=i?i-1:n].start<=e&&et[r].end&&r+1t[r].end&&r+1>=i)return-1}return-1}}function Kt(e,t,n){const i=t.length;if(i<1)return[];const r=[];if((n=n<0?0:n>=i?i-1:n)[0-9]{1,3}:[0-9]{2}:[0-9]{2}\.[0-9]{1,3}/,/[0-9]{1,3}:[0-9]{2}\.[0-9]{1,3}-->[0-9]{1,3}:[0-9]{2}\.[0-9]{1,3}/,/[0-9]{1,2}\.[0-9]{1,3}-->[0-9]{1,2}\.[0-9]{1,3}/],sn=/^Format:\s/,an=/^Style:\s/,on=/^Dialogue:\s/;function ln(e){const t=e.length;return 3===t?(60*(60*Number(e[0])+Number(e[1]))*1e3+1e3*Number(e[2]))/1e3:2===t?(60*Number(e[0])*1e3+1e3*Number(e[1]))/1e3:Number(e[0])}function cn(e,t){return e>=0&&e=50&&(n=0),0===n){const n={start:e[i].start,list:[e[i]],end:e[i].end};t.push(n)}else t[t.length-1].list.push(e[i]),t[t.length-1].end=e[i].end;n++}return t}static parse(e,t){const n=un.checkFormat(e);if(n)try{let i={list:[],styles:[]};"ass"===n?i=un.parseASS(e):"vtt"===n&&(i=un.parseVTT(e)),t({format:n,list:i.list,styles:i.styles})}catch(e){console.error(e),t({format:n},new $t(`parse_error_${e.message}`,2,e))}else t({format:"unknown"},new $t("unknown_format",3))}static parseASSItem(e="",t=[]){const n=e.split(","),i={};let r="";try{const e=n.length-t.length;return r=e>0?n.splice(t.length-1,e+1).join(",")+"":n[n.length-1]+"",r=r.replace(/\\n+/g,""),n[t.length-1]=r,t.map(((e,t)=>{"end"===e||"start"===e?i[e]=ln(n[t].split(":")):"text"===e?i[e]=[n[t]]:"layer"===e?(i[e]=[n[t]],i.textTag=[n[t]]):i[e]="style"===e?[n[t]]:Number(n[t])?Number(n[t]):n[t]})),i}catch(e){return console.error(e),{}}}static parseASS(e){const t=e.split("\n"),n=[];let i=0,r=0;const s=[];let a=[],o=null;for(;ie.toLocaleLowerCase()));else if(an.test(t[i]))s.push(t[i].replace(an,"").replace(/\s+/g,""));else if(on.test(t[i])){const e=un.parseASSItem(t[i].replace(on,""),a);if(o&&e.start===o.start&&e.end===o.end)try{const{text:t=[],textTag:n=[],style:i}=o;e.text.length>0&&t.push(e.text[0]),e.textTag.length>0&&n.push(e.textTag[0]),i&&i.push(e.style[0])}catch(e){console.error(e)}else{o=e;let t=null;r%50==0?(t={start:o.start,end:o.end,list:[]},t.list.push(o),n.push(t)):(t=n[n.length-1],t.end=o.end,t.list.push(o)),r++}}i++}return{list:n,styles:[]}}static parseVTTStyle(e,t){const n=e.split(":");if(n.length>1){const e=n[0].trim().split("-");let i="";e.length>1?e.map(((e,t)=>{i+=0===t?e:e.charAt(0).toUpperCase()+e.slice(1)})):i=e[0],t[i]=n[1].trim().replace(/;$/,"")}return t}static parseVTT(e){const t=(e=e.replace(Jt,"")).split("\n"),n=[];let i=0,r=0,s=null,a=!1,o=!1,l=null,c=null;const u=[];for(;i)/g.exec(e);let n="",i="default";if(t){i=t[0].replace(/\<|\>|\&/g,"");const r=RegExp(`^<${i}>(([\\s\\S])*?)$`).exec(e);r?n=r[1]:(n=e,i="")}else n=e;const r=/<(\w+).(\w+)>/g;let s=r.exec(n);for(;s&&s.length>2;)n=n.replace(s[0],`<${s[1]} class="${s[2]}">`),s=r.exec(n);return{tag:i,text:n.replace(/\\n+/g,"
")}}static parseVttTime(e){const t=e.split("--\x3e");let n=0,i=0;if(2===t.length){const e=t[0].split(":"),r=t[1].split(":");n=ln(e),i=ln(r)}return{start:n,end:i,time:e}}static isVTT(e){return Jt.test(e)}static isASS(e){return nn.test(e)}static checkFormat(e){return e?Jt.test(e)?"vtt":nn.test(e)?"ass":"":""}}function dn(e,t){const{status:n="",statusText:i=""}=e;return`${t}_${n}_${i}`}function hn(e,t,n){const{url:i="",method:r="GET",type:s="arraybuffer",timeout:a=1e4,data:o={}}=e,l=new window.XMLHttpRequest,c=r.toUpperCase(),u=[];if(s&&(l.responseType=s),a&&(l.timeout=a),Object.keys(o).forEach((e=>{u.push(`k=${o[e]}`)})),l.onload=()=>{200===l.status||206===l.status?n({context:t,res:l,type:"success"}):n({context:t,res:l,type:"error",error:new $t(dn(l,"response_error"),1)})},l.onerror=e=>{n({context:t,res:l,type:"error",error:new $t("loaderror",1)})},l.ontimeout=e=>{n({context:t,res:l,type:"error",error:new $t("timeout",1)})},l.onabort=()=>{n({context:t,res:l,type:"error",error:new $t("abort",1)})},"GET"===c)l.open(c,`${i}`),l.send();else{if("post"!==c)throw n({context:t,res:l,type:"error",error:new $t(`xhr ${c} is not supported`,1)}),new $t(`xhr ${c} is not supported`,1);l.open(c,i),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.send(u.join("&"))}}function pn(e,t,n){"json"===t?n({styles:[],list:un.parseJson(e),format:"json"}):"string"===t&&un.parse(e,n)}function fn(e,t,n){let i=[];n||(n=new Bt),i="String"===Ht(e)?[e]:[...e];const r=i.shift()||"",s=e=>{const{res:r,error:a}=e;if(a)i.length>0?hn({url:i.shift()||"",type:"text"},t,s):n.reject(a);else if(r){const{response:e}=r;pn(e,"string",((e,t)=>{t?n.reject(t):n.resolve(e)}))}};return hn({url:r,type:"text"},t,s),n}let gn=!1;class mn extends j{constructor(e){super(),xt(this,"_onPause",(()=>{this.stopRender()})),xt(this,"_onPlay",(()=>{this._curRenderTask.length>0&&this.startRender(-1)})),xt(this,"_onTimeupdate",(()=>{if(!this._isOpen)return;if(this.config.domRender){const e=this.player.video?this.player.video:this.player,{videoWidth:t,videoHeight:n}=e;!this._videoMeta.scale&&t&&n&&this._onResize(this.player.root)}const e=this._getPlayerCurrentTime();Math.round(Math.abs(1e3*e-this._ctime))<200||(this._ctime=1e3*e,this.currentText&&this.currentText.list&&("live"===this.config.updateMode?this._liveUpdate(e):this._update(e)))})),xt(this,"_onResize",(e=>{const{_videoMeta:t,config:n}=this;if(n.domRender){if((!e||!(e instanceof window.Element))&&(e=this.player.root),this._iId&&(window.clearTimeout(this._iId),this._iId=null),!t.scale){if(!this.player.video)return;const{videoWidth:e,videoHeight:n}=this.player.video;if(!e||!n)return;t.videoWidth=e,t.videoHeight=n,t.scale=parseInt(n/e*100,10)}this.__startResize(e)}})),xt(this,"_onCoreEvents",(e=>{try{switch(e.eventName){case"core.subtitlesegments":this._onSubtitleSegment(e.list||[]);break;case"core.subtitleplaylist":this._onSubtitlePlaylist(e.list||[]);break;case"core.seipayloadtime":this._onCoreSeiintime(e)}}catch(e){console.error(e)}})),xt(this,"startRender",(e=>{if(e>0&&this._renderIntervalId&&(window.cancelAnimationFrame(this._renderIntervalId),this._renderIntervalId=-1),!this.textTrack)return;const{_curRenderTask:t}=this;this._lastTimeStamp=(new Date).getTime();const n=[];t.forEach(((t,i)=>{const{lastTime:r,wordList:s,interval:a,dom:o,ids:l}=t;if(e<0||this._lastTimeStamp<0||this._lastTimeStamp-r>=a){const e=s.shift();e&&o.appendData(e),t.lastTime=this._lastTimeStamp}s.length<1&&n.push({index:i,ids:l})})),this._log(">>>>_renderByWords emptyArr",n.length,t.length),n.forEach((e=>{t.splice(e.index,1),this._log(">>>_renderByWords remove emptyArr",e.index,t.length)})),t.length>0&&(this._renderIntervalId=window.requestAnimationFrame(this.startRender))})),xt(this,"destroy",(()=>{this.detachPlayer(),this.removeAllListeners(),this.player=null,this.textTrack=null,this._curRenderTask=[],this.stopRender()})),gn=function(){const e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),n=/(?:SymbianOS)/.test(e)||t,i=/(?:Android)/.test(e),r=/(?:Firefox)/.test(e),s=/(?:iPad|PlayBook)/.test(e)||i&&!/(?:Mobile)/.test(e)||r&&/(?:Tablet)/.test(e);return/(?:iPhone)/.test(e)&&!s||i||n||s}(),this.currentText=null,this.currentExtText=null,this.textTrack=[],this._cid=-1,this._gid=-1,this._cids=[],this._iId=null,this._iC=0,this.player=null,this.root=null,this.config={line:"double",bottom:0,mode:"stroke",defaultOpen:!1,baseSizeX:49,baseSizeY:28,minSize:16,minMobileSize:13,fitVideo:!0,offsetBottom:2,fontColor:"#fff",domRender:!1,updateMode:"vod",renderMode:"",debugger:!1},this._ctime=0,this._loadingTrack={},this.seiTime=0,this.lastSeiTime=0,this._curTexts=[],this._curRenderTask=[],this._renderIntervalId=-1,this._lastTimeStamp=-1,Object.keys(this.config).map((t=>{void 0!==e[t]&&null!==e[t]&&(this.config[t]=e[t])})),this._isOpen=this.config.defaultOpen||!1,this._videoMeta={scale:0,videoHeight:0,videoWidth:0,lwidth:0,lheight:0,vWidth:0,vHeight:0,vBottom:0,vLeft:0,marginBottom:0},e.subTitles&&"Array"===Ht(e.subTitles)&&(e.player&&this.attachPlayer(e.player),this.setSubTitles(e.subTitles,this.config.defaultOpen))}get version(){return"0.2.17"}setSubTitles(e=[],t=!1,n=!0){const i=this._isOpen||t;n&&this.innerRoot&&this.switchOff(),!e||e.length<1?this.switchOff():(this.currentText=null,this.textTrack=[],e.forEach((e=>{const t={};Object.keys(e).map((n=>{t[n]=e[n]})),t.url=zt(t.url),t.isDefault&&(this.currentText=t),this.textTrack.push(t)})),this._log("setSubTitles",i,this.textTrack),i&&(this.currentText||(this.currentText=this.textTrack[0]),this.switch().catch((e=>{this.emitError(e),this._log("[switch]",e)}))),this._log(">>>this.currentText",i,this.currentText),this.currentText&&this._loadTrack(this.currentText).then((e=>{this.addStyles(e)})).catch((e=>{this.emitError(e),this._log("[_loadTrack] errorsss",e)})),this.emit("reset",{type:"reset",list:this.textTrack,isOpen:i}))}updateSubTitle(e){let t=-1;for(let n=0;n-1){const n=Wt(this.currentText,this.textTrack[t]);if(this._log("updateSubTitle","_isCurrent",n,"this.isOpen",this.isOpen,this.currentText),!n)return;const i=zt(e.url);this.isOpen?(i.forEach((e=>{this.textTrack[t].url.push(e)})),this._log("updateSubTitle _loadTrackUrls",this.textTrack[t]),this._loadTrackUrls(this.currentText,2)):this.textTrack[t].url=i}}addStyles(e){const{styles:t,format:n}=e;t&&"vtt"===n&&(t.map((e=>{e.key||(e.key="xg-text-track-span")})),function(e,t=""){let n="";e.map((e=>{n+=` ${t} ${e.key} {${e.style}}`}));const i=document.createElement("style"),r=document.head||document.getElementsByTagName("head")[0];if(i.type="text/css",i.id="ssss",i.styleSheet){const e=function(){try{i.styleSheet.cssText=n}catch{}};i.styleSheet.disabled?setTimeout(e,10):e()}else{const e=document.createTextNode(n);i.appendChild(e)}r.appendChild(i)}(t,"xg-text-track"))}attachPlayer(e){if(this._log("attachPlayer"),!e||e===this.player)return;this.player&&this.detachPlayer();const{fontColor:t,mode:n,fitVideo:i,domRender:r}=this.config;var s,a;this.player=e,r&&(this.root=document.createElement("xg-text-track"),this.root.className="xg-text-track",!this._isOpen&&Ut(this.root,"text-track-hide"),!i&&Ut(this.root,"text-track-no-fitvideo"),n&&Ut(this.root,`text-track-${n}`),this.innerRoot=document.createElement("xg-text-track-inner"),this.root.appendChild(this.innerRoot),t&&(this.root.style.color=t),this.currentText&&["language","id","label"].map((e=>{this.root.setAttribute(`data-${e}`,this.currentText[e]||"")})),this.player.root.appendChild(this.root),s=e.root,a=this._onResize,It||(It=new Ct),It.addObserver(s,a)),jt(e)?(e.addEventListener("timeupdate",this._onTimeupdate),e.addEventListener("pause",this._onPause),e.addEventListener("play",this._onPlay)):(this.player.on("destroy",this.destroy),this.player.on("timeupdate",this._onTimeupdate),this.player.on("pause",this._onPause),this.player.on("play",this._onPlay),this.player.on("core_event",this._onCoreEvents)),this._isOpen&&this.switch().catch((e=>{this._log("[switch]",e)}))}detachPlayer(){const{player:e,config:t}=this;var n;e&&(jt(e)?(e.removeEventListener("timeupdate",this._onTimeupdate),e.removeEventListener("pause",this._onPause),e.removeEventListener("play",this._onPlay)):(this.player.off("destroy",this.destroy),this.player.off("timeupdate",this._onTimeupdate),this.player.off("pause",this._onPause),this.player.off("play",this._onPlay),this.player.off("core_event",this._onCoreEvents)),t.domRender&&(e.root&&(n=e.root,this._onResize,It&&It.unObserver(n),e.root.removeChild(this.root)),this.innerRoot=null,this.root=null),this.player=null)}switch(e={id:"",language:""}){return this._log("switch",e),this._loadingTrack=e,new Promise(((t,n)=>{if(!e.id&&!e.language){if(this.currentText)return this._loadingTrack={},this._updateCurrent(this.currentText),this.switchOn(),void t({message:"switch default subtitle success",code:0});{const e=new $t("no default subtitle",5);return this.emitError(e),void n(e)}}if(this.currentText&&Wt(e,this.currentText))this._loadingTrack={},this._updateCurrent(this.currentText),this.switchOn(),t(Nt(0));else{let i=null;this.__removeByTime(this._curTexts,0);for(let t=0;t{if(this.addStyles(r),this._loadingTrack.id===i.id||this._loadingTrack.language===r.language)this._loadingTrack={},this._updateCurrent(r),this.switchOn(),t(Nt(0));else{const t=new $t(`check _loadingTrack fail id: ${this._loadingTrack.id} nextSubtitle:${r.id}`,6,null,e);this.emitError(t),n(t)}})).catch((e=>{this.emitError(e),n(e)})));else{const t=new $t(`The is no subtitle with id:[{${e.id}}] or language:[${e.language}]`,4,null,e);this.emitError(t),n(t)}}}))}switchExt(e={id:"",language:""}){return new Promise(((t,n)=>{if(e.id||e.language){let n=null;for(let t=0;t{this.currentExtText=e,t(Nt(0))})).catch((e=>{this.emitError(e)}))}else this.currentExtText=null,t(Nt(0))}))}emitError(e){this.emit(At,{type:At,error:e})}switchOn(){this._log("switchOn"),this._isOpen=!0,this.show();const{id:e,language:t}=this.currentText;this.emit(Lt,{type:Lt,isOpen:!0,id:e,language:t,texts:[]})}switchOff(){if(this._isOpen=!1,this.hide(),!this.currentText)return;const{id:e,language:t}=this.currentText;this.emit("off",{type:"off",id:e,language:t,texts:[],isOpen:!1})}get isOpen(){return this._isOpen}_log(...e){this.config.debugger&&console.log("[xgSubtitle]",...e)}_loadTrack(e){this._log("_loadTrack",e.language,e);const t=new Bt;let n="",i="";if(e.json?(n="json",i=e.json):e.stringContent&&(!e.url||0===e.url.length)&&(n="string",i=e.stringContent),i)return pn(i,n,((n,i)=>{i?(this.emitError(i),t.reject(i)):(e.format=n.format,e.styles=n.styles,e.list=n.list,t.resolve(e))})),t;const r=[...e.url];return 0===r.length?(t.resolve(e),t):(fn(r.splice(0,1)[0].url,e).then((n=>{e.format=n.format,e.styles=n.styles,e.list||(e.list=[]),this._pushList(e.list,n.list),r.length>1&&this._loadTrackUrls(e,2),t.resolve(e)})).catch((e=>{t.reject(e)})),t)}_emitPlayerSwitch(e,t){e&&"live"===this.config.updateMode&&(e.list=[],e.url=[]);const n={lang:t.language,...t};this._log("emit subtile_switch ",t,n),this.emit(Lt,{type:Lt,error:null})}_loadTrackUrls(e,t,n){const i=e.url.length,r=i>t?e.url.splice(0,t):e.url.splice(0,i);let s=r.length;this._log("_loadTrackUrls",e.language,i,r.length,s),r.forEach(((t,i)=>{fn({...t}.url,t).then((t=>{e.format=t.format,e.styles=t.format,e.list||(e.list=[]),this._pushList(e.list,t.list),s--})).catch((e=>{s--})).finally((t=>{0===s&&(n&&n.resolve(e),this._loadTrackUrls(e,2))}))}))}_freshUrl(e,t={url:""}){let n=-1;e.url.forEach(((e,i)=>{e.url===t.url&&(n=i)})),n>-1&&e.url.splice(n,1)}_pushList(e,t){const n=t[0].start,i=t[t.length-1].end;if(0===e.length||n>=e[e.length-1].end)t.forEach((t=>{e.push(t)}));else{let n=-1;for(let t=0;ti){n=t;break}n>-1&&t.forEach(((t,i)=>{e.splice(n+i,0,t)}))}return e}_updateCurrent(e){this.currentText=e,this.config.domRender&&this.root&&(["language","id","label"].map((e=>{this.root.setAttribute(`data-${e}`,this.currentText[e]||"")})),this.__remove(this._cids)),this._cids=[],this._gid=-1,this._cid=-1,this._curTexts=[];const t=this._getPlayerCurrentTime();t&&("live"===this.config.updateMode?this._liveUpdate(t):this._update(t))}__loadAll(){this.textTrack.forEach((e=>{this._loadTrack(e)}))}getDelCid(e,t){const n=[];for(let i=0;i-1&&(t=Kt(e,this.currentText.list[n].list,this._cid)),this.__removeByTime(this._curTexts,e),this._log("_liveUpdate",e,n,t,this.currentText.list[0].list[0].start,this.currentText.list[0].list[0].end),t.length>0){const e=function(e,t,n){if(0===e.length||t<0||t>e.length-1)return[];const i=e[t].list;if(0===n.length)return[];const r=i.splice(n[0],n.length);return t>0&&e.splice(0,t),0===i.length&&e.splice(0,1),r}(this.currentText.list,n,t),i=this._curTexts.length,r=i>0?this._curTexts[i-1].index:0;e.forEach(((e,t)=>{e.index=t+r,this._curTexts.push(e)})),this.__render(e)}this.emit(Ot,this.getUpdateData(this._curTexts,0,this.currentText))}_update(e){if(!this.currentText||!this.currentText.list||!this.currentText.list.length)return;const t=Xt(e,this.currentText.list,this._gid);let n=[];if(t>-1&&(n=Kt(e,this.currentText.list[t].list,this._cid)),this._log("update1",`currentTime:${e}`,t,this._gid,n,this._cids,this._cids.join(",")===n.join(","),t===this._gid),n.length<1)return this._cids.length>0&&this.config.domRender&&this.__remove(this._cids),this._cids=[],this._curTexts.length>0&&this.emit(Ot,this.getUpdateData([],e,this.currentText)),void(this._curTexts=[]);if(this._cids.join("")===n.join("")&&t===this._gid)return;this._gid=t,this._cid=n[0];const i=this.getDelCid(this._cids,n),r=this.getNewCid(this._cids,n);this._cids=n,this.config.domRender&&this.__remove(i);const s=[];r.map((e=>{const n=this.currentText.list[t].list[e];n.index=e,s.push(n)})),this.currentExtText&&r.map((e=>{const n=this.currentText.list[t].list[e];n.index=e,s.push(n)})),this._log("update",`currentTime:${e}`,s.length>0?`start:${s[0].start} end:${s[0].end}`:"",`delCids:${i.length} newCids:${r.length}`),this._curTexts=s,this.emit(Ot,this.getUpdateData(s,e,this.currentText)),this.__render(s,e)}getUpdateData(e,t,n){const{id:i,language:r}=n;return{type:Ot,currentTime:0|t,id:i,language:r,texts:e,isOpen:this._isOpen}}_getPlayerCurrentTime(){if(!this.player)return 0;const{currentTime:e}=this.player;return parseInt(1e3*e+1e3*this.seiTime-1e3*this.lastSeiTime,10)/1e3}_onSubtitlePlaylist(e){this._log("_onSubtitlePlaylist",e);const t=e.map((e=>({label:e.name,language:e.lang,id:e.id,isDefault:e.default,url:[],mUrl:e.url})));this.setSubTitles(t)}_onSubtitleSegment(e){if(this._log("_onSubtitleSegment",e.length,e[0].lang,e[0].sn,e[e.length-1].sn,e[0].start,e[e.length-1].end),!e||0===e.length)return;const t={language:e[0].lang,url:e.map((e=>({id:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end})))};Wt(t,this.currentText)&&this.updateSubTitle(t)}_onCoreSeiintime(e){try{const t=e.time/1e3;this._log("_onCoreSeiintime sei",t,this.seiTime,this.lastSeiTime),this.seiTime=t,this.lastSeiTime=this.player?this.player.currentTime:0}catch{}}resize(e,t){const{baseSizeX:n,baseSizeY:i,minMobileSize:r,minSize:s,fitVideo:a,offsetBottom:o}=this.config,{scale:l}=this._videoMeta;this._videoMeta.lwidth=e,this._videoMeta.lheight=t;let c,u=0;t/e*100>=l?(u=parseInt(l*e,10)/100,c=e):(u=t,c=parseInt(t/l*100,10)),this._videoMeta.vWidth=c,this._videoMeta.vHeight=u;let d=0,h=0;l>120?(d=i,h=parseInt(d*u/1080,10)):(d=n,h=parseInt(d*c/1920,10));const p=gn?r:s;h=hd?d:h;const f={fontSize:h},g=parseInt((t-u)/2,10),m=parseInt((e-c)/2,10),v=parseInt(u*o,10)/100;this._videoMeta.vBottom=g,this._videoMeta.vLeft=m,this._videoMeta.marginBottom=v,a&&(f.bottom=g+v,f.left=f.right=m),Object.keys(f).map((e=>{this.root.style[e]=`${f[e]}px`})),this.emit("resize",{vLeft:m,vBottom:g,marginBottom:v,vWidth:c,vHeight:u,fontSize:h,scale:l})}__startResize(e){const t=e.getBoundingClientRect(),{_videoMeta:n}=this,{width:i,height:r}=t;if(this._iId&&(clearTimeout(this._iId),this._iId=null),i>0&&r>0&&(i!==n.lwidth||r!==n.lheight))this._iC=0,this.resize(i,r);else{if(this._iC>=5)return void(this._iC=0);this._iC++,this._iId=setTimeout((()=>{this.__startResize(e)}),50)}}__removeByTime(e,t){const n=[];for(let i=0;i>>>_renderByWords__remove",e);const t=this.innerRoot.children,n=[];for(let i=0;i{this.innerRoot.removeChild(e)}))}__render(e=[]){const{renderMode:t,domRender:n}=this.config;e.length>0&&n&&e.forEach((e=>{let n=`text-track-${this.config.line}`;e.text.forEach(((i,r)=>{r>0&&(n+=" text-track-deputy");const s={"data-start":e.start,"data-end":e.end,"data-index":e.index},a=Vt("xg-text-track-span","",s,n);if(this.innerRoot.appendChild(a),"step"===t){const t=Vt("xg-text-track-span","",s,`${n} text-track-space`);this.innerRoot.appendChild(t),t.innerHTML=i,window.setTimeout((()=>{this._renderByWords(a,r,e.start,e.end,i)}),600)}else a.innerHTML=i}))}))}_renderByWords(e,t,n,i,r){const s=document.createTextNode("");e.appendChild(s);const a=function(e){const t=e.split(""),n=[];let i=!1;for(let e=0;e=i)return;n>=o&&(o=n),l>300&&(l-=50);const c={dom:s,ids:t,wordList:a,interval:l/a.length,start:o,end:i,duration:l,lastTime:0};this._log(">>>>_renderByWords",l,c);const{_curRenderTask:u}=this;let d=-1;for(let e=0;e-1&&u.slice(d,1),u.push(c),this.startRender(-1)}stopRender(){this._renderIntervalId&&window.cancelAnimationFrame(this._renderIntervalId)}show(){var e,t;this.config.domRender&&(t="text-track-hide",(e=this.root)&&(e.classList?t.split(/\s+/g).forEach((t=>{e.classList.remove(t)})):Ft(e,t)&&t.split(/\s+/g).forEach((t=>{const n=new RegExp("(\\s|^)"+t+"(\\s|$)");if(e.className&&"object"==typeof e.className){const t=e.getAttribute("class")||"";e.setAttribute("class",t.replace(n," "))}else e.className=e.className.replace(n," ")}))))}hide(){this.config.domRender&&(Ut(this.root,"text-track-hide"),this.innerRoot.innerHTML="")}emit(e,t,...n){super.emit(e,t,...n)}on(e,t,...n){super.on(e,t,...n)}once(e,t,...n){super.once(e,t,...n)}off(e,t,...n){super.off(e,t,...n)}offAll(){super.removeAllListeners()}get marginBottom(){const{bottom:e,marginBottom:t}=this._videoMeta;return this.config.fitVideo?e+t:t}}var vn=function(e){function t(){var e;D(this,t);for(var n=arguments.length,i=new Array(n),r=0;r0?e.text[0]:"",textTag:e.textTag}}));e._updateCallback&&e._updateCallback(n[0]),e.emit("subtitle_update",n[0])}})),C(e,"_onListReset",(function(t){e.updateList(t)})),e}return O(t,e),x(t,[{key:"afterCreate",value:function(){this._initExtSubTitle(),this._updateCallback=null}},{key:"_initExtSubTitle",value:function(e){var t=this.config,n=t.list,i=t.style,r=t.isDefaultOpen,s=t.updateMode,a=t.renderMode;r&&e<0&&n.length>0&&(e=0,n[0].isDefault=!0);var o={subTitles:n,defaultOpen:r,updateMode:s,renderMode:a,debugger:this.config.debugger,domRender:!1};Object.keys(i).map((function(e){o[e]=i[e]}));var l=this.player.controls;!this.playerConfig.marginControls&&l&&l.root&&(this.on(de,this.onPlayerFocus),this.on(he,this.onPlayerBlur));var c=this.player;c._subTitles?c._subTitles._isOpen&&(e=this.getSubTitleIndex(this.config.list,c._subTitles.currentText)):(c._subTitles=new mn(o),c._subTitles.attachPlayer(this.player)),this.subTitles=c._subTitles,this.subTitles.on("off",this._onOff),this.subTitles.on("change",this._onChange),this.subTitles.on("update",this._onUpdate),this.subTitles.on("reset",this._onListReset),i.follow&&this.subTitles.root&&Y.addClass(this.subTitles.root,"follow-control")}},{key:"show",value:function(e){!this.config.list||this.config.list.length<1||Y.addClass(this.root,"show")}},{key:"getSubTitleIndex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{id:"",language:""},n=-1;return t&&(t.id||t.language)?(e.forEach((function(e,i){var r,s,a,o;r=e,s=t,a=Y.isNotNull(r.id)&&Y.isNotNull(s.id)&&r.id===s.id,o=Y.isNotNull(r.language)&&Y.isNotNull(s.language)&&r.language===s.language,(a||o)&&(n=i)})),n):n}},{key:"updateSubtitles",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e&&("String"===Y.typeOf(e)&&(e=[{id:parseInt(100*Math.random()),isDefault:!0,url:e}]),t&&(this._updateCallback=t),this.updateList({list:e}),this.subTitles&&this.subTitles.setSubTitles(this.config.list,this.curIndex>-1,n))}},{key:"updateList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.list){var t=[];e.list.forEach((function(e){t.push(e)}));var n=function(e){var t=-1;return e.forEach((function(e,n){e.id||e.language||(e.id=n),e.id=String(e.id),!e.url&&(e.url=e.src),!e.text&&(e.text=e.label),!e.language&&(e.language=e.srclang),void 0===e.isDefault&&(e.isDefault=e.default||!1),(e.isDefault||e.default)&&(t<0?t=n:e.isDefault=e.default=!1)})),t}(t);e.isOpen?(this.curIndex=n,this.curItem=n>-1?t[n]:null):(this.curIndex=-1,this.curItem=null),this.config.list=t,0===t.length&&this.switchOffSubtitle()}}},{key:"switchSubTitle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:"",language:""};this.getSubTitleIndex(this.config.list,e)<0||this.subTitles.switch(e).catch((function(e){}))}},{key:"switchOffSubtitle",value:function(e){this.emit("subtitle_change",{off:!0,isListUpdate:!1,list:[]}),this.lastIndex=this.curIndex,this.curIndex=-1,this.curItem=null,this.switchIconState(!1)}},{key:"switchOnSubtitle",value:function(){var e=this.config.list[this.lastIndex>-1?this.lastIndex:0];this.switchIconState(!0),this.switchSubTitle(e)}},{key:"destroy",value:function(){this.subTitles&&(this.subTitles.destroy(),this.subTitles=null),F(t,"destroy",this,3)([])}}],[{key:"pluginName",get:function(){return"texttrack"}},{key:"defaultConfig",get:function(){return{index:6,list:[],isDefaultOpen:!0,style:{follow:!0,mode:"stroke",followBottom:50,fitVideo:!0,offsetBottom:2,baseSizeX:49,baseSizeY:28,minSize:16,minMobileSize:13,line:"double",fontColor:"#fff"},closeText:{text:"不开启",iconText:"字幕"},needCloseText:!0,className:"xgplayer-texttrack",hidePortrait:!1,isShowIcon:!0,renderMode:"normal",mode:"external",debugger:!1}}}])}(je),yn=Object.defineProperty,_n=(e,t,n)=>((e,t,n)=>t in e?yn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class Tn{static getDefaultConfig(){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}}constructor(e,t,n,i){this.config=Tn.getDefaultConfig(),Object.keys(i).map((e=>{void 0!==i[e]&&null!==i[e]&&(this.config[e]=i[e])})),this.duration=n,this.player=e,this.updateBitrate(t)}updateBitrate(e){this.bitrate=e,this.bitrate||(this.bitrate=this.config.minBandwidth)}getAdaptLoadDuration(){const{player:e,config:t}=this;if(!t.rangeControl)return-1;const n=(null==e?void 0:e.bufferedPoint)||null,i=n&&n.end?n.end-e.currentTime:0;return Math.max(t.rangeMaxDuration-i,t.rangeMinDuration)}getAdaptCacheBuffer(){const{player:e,config:t,bitrate:n}=this;if(!t.targetCacheControl)return-1;const{estPlayTime:i}=t;let r=i;t.estPTcontrol&&(r=Math.min(i,this.duration-((null==e?void 0:e.currentTime)||0)));const s=1024*(null==e?void 0:e.avgSpeed)||0;let a=Math.max(t.safeFactor*s,t.minBandwidth);e&&e.avgSpeed&&(a=t.safeFactor*s);let o=n>0?Math.floor((1-a/n)*r):0;return o=t.minDangerThreshold+Math.max(o,0),Math.min(Math.max(t.cacheSafeFactor*o,t.minTargetCacheDur),t.maxTargetCacheDur)}}class bn{static getDefaultConfig(){return{rangeControl:!1,rangeMaxDuration:20,rangeMinDuration:5,rangeMinSize:409600,rangeFloatSize:10240,safeFactor:.1,cacheSafeFactor:3,minDangerThreshold:5,estPlayTime:12,minBandwidth:1e6,estPTcontrol:!1,minTargetCacheDur:30,maxTargetCacheDur:60,targetCacheControl:!1}}constructor(e,t,n,i){this.config=bn.getDefaultConfig(),Object.keys(i).map((e=>{void 0!==i[e]&&null!==i[e]&&(this.config[e]=i[e])})),this.duration=n,this.player=e,this.updateBitrate(t)}updateBitrate(e){this.bitrate=e,this.bitrate||(this.bitrate=this.config.minBandwidth)}getBuffer(){const{player:e}=this,t=(null==e?void 0:e.bufferedPoint)||null;return t&&t.end?t.end-e.currentTime:0}getAdaptLoadDuration(){const{config:e,duration:t}=this;if(!e.rangeControl)return-1;const n=this.getBuffer(),i=t-n,r=Math.min(i,e.rangeMaxDuration-n);return Math.max(r,e.rangeMinDuration)}getAdaptRangeSize(e){const{config:t,bitrate:n,duration:i}=this;if(!t.rangeControl)return-1;e||(e=this.getAdaptLoadDuration());const r=i-this.getBuffer();let s=Math.max(t.rangeMinSize,e*n/8);const a=r*n/8;return s+t.rangeFloatSize>=a&&(s=a),Math.ceil(s)}getAdaptCacheBuffer(){const{player:e,config:t,bitrate:n}=this;if(!t.targetCacheControl)return-1;const{estPlayTime:i}=t;let r=i;t.estPTcontrol&&(r=Math.min(i,this.duration-((null==e?void 0:e.currentTime)||0)));const s=1024*(null==e?void 0:e.avgSpeed)||0;let a=Math.max(t.safeFactor*s,t.minBandwidth);e&&e.avgSpeed&&(a=t.safeFactor*s);let o=n>0?Math.floor((1-a/n)*r):0;o=t.minDangerThreshold+Math.max(o,0);const l=Math.max(t.cacheSafeFactor*o,t.minTargetCacheDur);return Math.min(l,t.maxTargetCacheDur)}}var Sn=(e=>(e.CHANGE_FLYING_PLUGIN_CONFIG="CHANGE_FLYING_PLUGIN_CONFIG",e))(Sn||{});function Pn(e,t,n){return t=wn(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,En()?Reflect.construct(t,n||[],wn(e).constructor):t.apply(e,n))}function Mn(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1];for(var n in Ln)if(Object.prototype.hasOwnProperty.call(Ln,n)){var i=Ln[n];if(t){if(e(i))break}else e(i)}}},{key:"forEach",value:function(e){this._iterate(e)}},{key:"find",value:function(e){var t=null;return this._iterate((function(n){var i=e(n);return i&&(t=n),i}),!0),t}},{key:"findAll",value:function(e){var t=[];return this._iterate((function(n){e(n)&&t.push(n)})),t}},{key:"setActive",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(Ln[e])return t?this.forEach((function(t){e===t.playerId?(t.isUserActive=!0,t.isInstNext=!1):t.isUserActive=!1})):Ln[e].isUserActive=t,e}},{key:"getActiveId",value:function(){for(var e=Object.keys(Ln),t=0;t1&&void 0!==arguments[1])||arguments[1];if(Ln[e])return t?this.forEach((function(t){e===t.playerId?(t.isUserActive=!1,t.isInstNext=!0):t.isInstNext=!1})):Ln[e].isInstNext=t,e}}],[{key:"getInstance",value:function(){return On||(On=new t),On}}])}(Cn.EventEmitter);function Gn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function $n(e){for(var t=1;t=0;--r){var s=this.tryEntries[r],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var o=n.call(s,"catchLoc"),l=n.call(s,"finallyLoc");if(o&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),M(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;M(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function Bn(e){return(Bn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Fn(e,t,n,i,r,s,a){try{var o=e[s](a),l=o.value}catch(e){return void n(e)}o.done?t(l):Promise.resolve(l).then(i,r)}function Un(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var s=e.apply(t,n);function a(e){Fn(s,i,r,a,o,"next",e)}function o(e){Fn(s,i,r,a,o,"throw",e)}a(void 0)}))}}function Hn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vn(e,t){for(var n=0;n"u"||!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{return!1}}function qn(e,t,n){return qn=Qn()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&Wn(r,n.prototype),r},qn.apply(null,arguments)}function Yn(e){var t="function"==typeof Map?new Map:void 0;return Yn=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return qn(e,arguments,Kn(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Wn(n,e)},Yn(e)}function Jn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zn(e){var t=Qn();return function(){var n,i=Kn(e);if(t){var r=Kn(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Jn(e)}(this,n)}}function ei(){return ei=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Kn(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},ei.apply(this,arguments)}function ti(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n1?n-1:0),r=1;r=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var a=this.logTextArray.shift();this.logSize-=a.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function oi(){return(new Date).toLocaleString()}function li(e){if("object"!==Bn(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function ci(e,t,n){n||(n=1),t||(t=2);var i={};if(!e||"object"!==Bn(e))return e;var r=Object.prototype.toString.call(e).slice(8,-1);if(!si.includes(r))return r;if(!(n>t)){for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n===t?i[s]=li(e[s]):"object"===Bn(e[s])?i[s]=ci(e[s],t,n+1):i[s]=e[s]);return i}}zn(ai,"disabled",!0);var ui="fetch",di="arraybuffer",hi="text",pi="json",fi=function(e){Xn(n,e);var t=Zn(n);function n(e,i,r,s){var a;return Hn(this,n),zn(Jn(a=t.call(this,s)),"retryCount",0),zn(Jn(a),"isTimeout",!1),zn(Jn(a),"loaderType",ui),zn(Jn(a),"startTime",0),zn(Jn(a),"endTime",0),zn(Jn(a),"options",{}),a.url=e,a.request=i,a.response=r,a}return jn(n)}(Yn(Error)),gi=Object.prototype.toString;function mi(e){if("[object Object]"!==gi.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function vi(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 yi(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function _i(e,t){if(e){if(!t)return e;var n,i=Object.keys(t).map((function(e){if(null!=(n=t[e]))return Array.isArray(n)?e+="[]":n=[n],n.map((function(t){return function(e){return"[object Date]"===gi.call(e)}(t)?t=t.toISOString():function(e){return null!==e&&"object"===Bn(e)}(t)&&(t=JSON.stringify(t)),"".concat(yi(e),"=").concat(yi(t))})).join("&")})).filter(Boolean).join("&");if(i){var r=e.indexOf("#");-1!==r&&(e=e.slice(0,r)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}}function Ti(e,t,n,i,r,s,a,o,l,c,u){return r=null!=r?parseFloat(r):null,i=parseInt(i||"0",10),Number.isNaN(i)&&(i=0),{data:e,done:t,options:{range:l,vid:c,index:o,contentLength:i,age:r,startTime:s,firstByteTime:a,endTime:Date.now(),priOptions:u},response:n}}function bi(e,t){return Math.round(8*e*1e3/t/1024)}var Si="real_time_speed",Pi=2097152,Mi=function(e){Xn(i,e);var t,n=Zn(i);function i(){var e;return Hn(this,i),zn(Jn(e=n.call(this)),"_abortController",null),zn(Jn(e),"_timeoutTimer",null),zn(Jn(e),"_reader",null),zn(Jn(e),"_response",null),zn(Jn(e),"_aborted",!1),zn(Jn(e),"_index",-1),zn(Jn(e),"_range",null),zn(Jn(e),"_receivedLength",0),zn(Jn(e),"_running",!1),zn(Jn(e),"_logger",null),zn(Jn(e),"_vid",""),zn(Jn(e),"_onProcessMinLen",0),zn(Jn(e),"_onCancel",null),zn(Jn(e),"_priOptions",null),e}return jn(i,[{key:"load",value:function(e){var t,n=this,i=e.url,r=e.vid,s=e.timeout,a=e.responseType,o=e.onProgress,l=e.index,c=e.onTimeout,u=e.onCancel,d=e.range,h=e.transformResponse,p=e.request,f=e.params,g=e.logger,m=e.method,v=e.headers,y=e.body,_=e.mode,T=e.credentials,b=e.cache,S=e.redirect,P=e.referrer,M=e.referrerPolicy,w=e.onProcessMinLen,E=e.priOptions;this._logger=g,this._aborted=!1,this._onProcessMinLen=w,this._onCancel=u,this._abortController=typeof AbortController<"u"&&new AbortController,this._running=!0,this._index=l,this._range=d||[0,0],this._vid=r||i,this._priOptions=E||{};var k={method:m,headers:v,body:y,mode:_,credentials:T,cache:b,redirect:S,referrer:P,referrerPolicy:M,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},D=!1;clearTimeout(this._timeoutTimer),i=_i(i,f);var R=vi(d);R&&(v=p?p.headers:k.headers=k.headers||(Headers?new Headers:{}),Headers&&v instanceof Headers?v.append("Range",R):v.Range=R),s&&(this._timeoutTimer=setTimeout((function(){if(D=!0,n.cancel(),c){var e=new fi(i,k,null,"timeout");e.isTimeout=!0,c(e,{index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions})}}),s));var x=Date.now();return this._logger.debug("[fetch load start], index,",l,",range,",d),new Promise((function(e,t){fetch(p||i,p?void 0:k).then(function(){var r=Un(Nn().mark((function r(s){var c,u,p,f;return Nn().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(clearTimeout(n._timeoutTimer),n._response=s,!n._aborted&&n._running){r.next=4;break}return r.abrupt("return");case 4:if(h&&(s=h(s,i)||s),s.ok){r.next=7;break}throw new fi(i,k,s,"bad network response");case 7:if(c=Date.now(),a!==hi){r.next=15;break}return r.next=11,s.text();case 11:u=r.sent,n._running=!1,r.next=37;break;case 15:if(a!==pi){r.next=22;break}return r.next=18,s.json();case 18:u=r.sent,n._running=!1,r.next=37;break;case 22:if(!o){r.next=29;break}return n.resolve=e,n.reject=t,n._loadChunk(s,o,x,c),r.abrupt("return");case 29:return r.next=31,s.arrayBuffer();case 31:u=r.sent,u=new Uint8Array(u),n._running=!1,p=Date.now()-x,f=bi(u.byteLength,p),n.emit(Si,{speed:f,len:u.byteLength,time:p,vid:n._vid,index:n._index,range:n._range,priOptions:n._priOptions});case 37:n._logger.debug("[fetch load end], index,",l,",range,",d),e(Ti(u,!0,s,s.headers.get("Content-Length"),s.headers.get("age"),x,c,l,d,n._vid,n._priOptions));case 39:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}()).catch((function(e){var r;clearTimeout(n._timeoutTimer),n._running=!1,(!n._aborted||D)&&((e=e instanceof fi?e:new fi(i,k,null,null===(r=e)||void 0===r?void 0:r.message)).startTime=x,e.endTime=Date.now(),e.isTimeout=D,e.options={index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions},t(e))}))}))}},{key:"cancel",value:(t=Un(Nn().mark((function e(){return Nn().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{}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,i){var r=this;if(!e.body||!e.body.getReader){this._running=!1;var s=new fi(e.url,"",e,"onProgress of bad response.body.getReader");return s.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(s)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(Pi),this._writeIdx=0);var a,o,l,c=this._reader=e.body.getReader(),u=function(){var s=Un(Nn().mark((function s(){var d,h,p,f,g,m,v,y;return Nn().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return o=Date.now(),s.prev=1,s.next=4,c.read();case 4:a=s.sent,l=Date.now(),s.next=13;break;case 8:return s.prev=8,s.t0=s.catch(1),l=Date.now(),r._aborted||(r._running=!1,s.t0.options={index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions},r.reject(s.t0)),s.abrupt("return");case 13:if(h=(null===(d=r._range)||void 0===d?void 0:d.length)>0?r._range[0]:0,p=h+r._receivedLength,!r._aborted){s.next=19;break}return r._running=!1,t(void 0,!1,{range:[p,p],vid:r._vid,index:r._index,startTime:o,endTime:l,st:n,firstByteTime:i,priOptions:r._priOptions},e),s.abrupt("return");case 19:f=a.value?a.value.byteLength:0,r._receivedLength+=f,r._logger.debug("【fetchLoader,onProgress call】,task,",r._range,", start,",p,", end,",h+r._receivedLength,", done,",a.done),r._onProcessMinLen>0?r._writeIdx+f>=r._onProcessMinLen||a.done?((g=new Uint8Array(r._writeIdx+f)).set(r._cache.slice(0,r._writeIdx),0),f>0&&g.set(a.value,r._writeIdx),r._writeIdx=0,r._logger.debug("【fetchLoader,onProgress enough】,done,",a.done,",len,",g.byteLength,", writeIdx,",r._writeIdx)):f>0&&r._writeIdx+f0&&(m=new Uint8Array(r._writeIdx+f+2048),r._logger.debug("【fetchLoader,onProgress extra start】,size,",r._writeIdx+f+2048,", datalen,",f,", writeIdx,",r._writeIdx),m.set(r._cache.slice(0,r._writeIdx),0),f>0&&m.set(a.value,r._writeIdx),r._writeIdx+=f,delete r._cache,r._cache=m,r._logger.debug("【fetchLoader,onProgress extra end】,len,",f,", writeIdx,",r._writeIdx)):g=a.value,(g&&g.byteLength>0||a.done)&&t(g,a.done,{range:[r._range[0]+r._receivedLength-(g?g.byteLength:0),r._range[0]+r._receivedLength],vid:r._vid,index:r._index,startTime:o,endTime:l,st:n,firstByteTime:i,priOptions:r._priOptions},e),a.done?(v=Date.now()-n,y=bi(r._receivedLength,v),r.emit(Si,{speed:y,len:r._receivedLength,time:v,vid:r._vid,index:r._index,range:r._range,priOptions:r._priOptions}),r._running=!1,r._logger.debug("[fetchLoader onProgress end],task,",r._range,",done,",a.done),r.resolve(Ti(a,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),n,i,r._index,r._range,r._vid,r._priOptions))):u();case 25:case"end":return s.stop()}}),s,null,[[1,8]])})));return function(){return s.apply(this,arguments)}}();u()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return typeof fetch<"u"}}]),i}(In),wi=function(e){Xn(n,e);var t=Zn(n);function n(){var e;return Hn(this,n),zn(Jn(e=t.call(this)),"_xhr",null),zn(Jn(e),"_aborted",!1),zn(Jn(e),"_timeoutTimer",null),zn(Jn(e),"_range",null),zn(Jn(e),"_receivedLength",0),zn(Jn(e),"_url",null),zn(Jn(e),"_onProgress",null),zn(Jn(e),"_index",-1),zn(Jn(e),"_headers",null),zn(Jn(e),"_currentChunkSizeKB",384),zn(Jn(e),"_timeout",null),zn(Jn(e),"_xhr",null),zn(Jn(e),"_withCredentials",null),zn(Jn(e),"_startTime",-1),zn(Jn(e),"_loadCompleteResolve",null),zn(Jn(e),"_loadCompleteReject",null),zn(Jn(e),"_runing",!1),zn(Jn(e),"_logger",!1),zn(Jn(e),"_vid",""),zn(Jn(e),"_responseType",void 0),zn(Jn(e),"_credentials",void 0),zn(Jn(e),"_method",void 0),zn(Jn(e),"_transformResponse",void 0),zn(Jn(e),"_firstRtt",void 0),zn(Jn(e),"_onCancel",null),zn(Jn(e),"_priOptions",null),e}return jn(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=_i(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 fi?e:new fi(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===di&&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){var n,i,r;t._running=!1;var s=new fi(t._url,t._request,null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.response,"xhr.onerror.status:"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.status)+",statusText,"+(null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.statusText));s.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(s)},n.ontimeout=function(e){t.cancel();var n=new fi(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||{},r=vi(e);r&&(i.Range=r),i&&Object.keys(i).forEach((function(e){n.setRequestHeader(e,i[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),n.send(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,n=e.target.status;if(n<200||n>299){var i=new fi(this._url,null,$n($n({},e.target.response),{},{status:n}),"bad response,status:"+n);return i.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(i)}var r,s=null,a=!1,o=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===di){var l,c=new Uint8Array(e.target.response);if(r=o+this._receivedLength,c&&c.byteLength>0){this._receivedLength+=c.byteLength;var u=Date.now()-this._startTime,d=bi(this._receivedLength,u);this.emit(Si,{speed:d,len:this._receivedLength,time:u,vid:this._vid,index:this._index,range:[r,o+this._receivedLength],priOptions:this._priOptions})}s=c,a=!((null===(l=this._range)||void 0===l?void 0:l.length)>1&&this._range[1]&&this._receivedLength], tast :",this._range,", start",r,"end ",o+this._receivedLength,",dataLen,",c?c.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",a)}else a=!0,s=e.target.response;var h={ok:n>=200&&n<300,status:n,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(h=this._transformResponse(h,this._url)||h),this._onProgress&&this._onProgress(s,a,{index:this._index,vid:this._vid,range:[r,o+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},h),a?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(Ti(this._onProgress?null:s,a,h,h.headers["content-length"],h.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted&&(this._aborted=!0,this._runing=!1,ei(Kn(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,n={},i=function(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return ti(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ti(e,t)}}(e))||t){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&null!=n.return&&n.return()}finally{if(o)throw s}}}}(e.getAllResponseHeaders().trim().split("\r\n"));try{for(i.s();!(t=i.n()).done;){var r=t.value.split(": ");n[r[0].toLowerCase()]=r.slice(1).join(": ")}}catch(e){i.e(e)}finally{i.f()}return n}}],[{key:"isSupported",value:function(){return typeof XMLHttpRequest<"u"}}]),n}(In),Ei=["retry","retryDelay","onRetryError","transformError"],ki=function(){function e(t,n){Hn(this,e),this.promise=ii(),this.alive=!!n.onProgress,!n.logger&&(n.logger=new ai("Loader")),this._loaderType=t,this._loader=t===ui&&window.fetch?new Mi:new wi,this._config=n,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=n.retryCheckFunc,this._logger=n.logger}return jn(e,[{key:"exec",value:function(){var e=this,t=this._config,n=t.retry,i=t.retryDelay,r=t.onRetryError,s=t.transformError,a=function(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},s=Object.keys(e);for(i=0;i=0)&&(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(t,Ei),o=function(){var t=Un(Nn().mark((function t(){var l,c,u;return Nn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(a);case 3:l=t.sent,e.promise.resolve(l),t.next=27;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,c=t.t0,s&&(c=s(c)||c),r&&e._retryCount>0&&r(c,e._retryCount,{index:a.index,vid:a.vid,range:a.range,priOptions:a.priOptions}),e._retryCount++,u=!0,e._retryCheckFunc&&(u=e._retryCheckFunc(t.t0)),!(u&&e._retryCount<=n)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",a.range),e._retryTimer=setTimeout(o,i),t.abrupt("return");case 26:e.promise.reject(c);case 27:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return o(),this.promise}},{key:"cancel",value:(t=Un(Nn().mark((function e(){return Nn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),e;var t}();function Di(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var Ri=function(e){Xn(i,e);var t,n=Zn(i);function i(e){var t;return Hn(this,i),zn(Jn(t=n.call(this,e)),"type",ui),zn(Jn(t),"_queue",[]),zn(Jn(t),"_alive",[]),zn(Jn(t),"_currentTask",null),zn(Jn(t),"_config",void 0),t._config=function(e){return $n({loaderType:ui,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:hi,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0},e)}(e),("xhr"===t._config.loaderType||!Mi.isSupported())&&(t.type="xhr"),t.log=e.logger,t}return jn(i,[{key:"isFetch",value:function(){return this.type===ui}},{key:"load",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?n=e:n.url=e||n.url||this._config.url,(n=Object.assign({},this._config,n)).params&&(n.params=Object.assign({},n.params)),n.headers&&mi(n.headers)&&(n.headers=Object.assign({},n.headers)),n.body&&mi(n.body)&&(n.body=Object.assign({},n.body)),n.transformRequest&&(n=n.transformRequest(n)||n),n.logger=this.log;var i=new ki(this.type,n);return i.loader.on(Si,(function(e){t.emit(Si,e)})),this._queue.push(i),1===this._queue.length&&(!this._currentTask||!this._currentTask.running)&&this._processTask(),i.promise}},{key:"cancel",value:(t=Un(Nn().mark((function e(){var t;return Nn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,Di();case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,n;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(n=e._alive)||void 0===n?void 0:n.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return Mi.isSupported()}}]),i}(In);class xi{static getDefaultConfig(){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}}constructor(e,t,n,i){this.config=xi.getDefaultConfig(),Object.keys(i).map((e=>{void 0!==i[e]&&null!==i[e]&&(this.config[e]=i[e])})),this.duration=n,this.player=e,this.updateBitrate(t),this.curPCDNInBuffer=this.config.maxPCDNInBuffer,this.curPCDNOutBuffer=this.config.maxPCDNOutBuffer,this.PCDNChangeCnt=0}updateBitrate(e){this.bitrate=e,this.bitrate||(this.bitrate=this.config.minBandwidth)}getPCDNInBuffer(){const{config:e,player:t,bitrate:n}=this;if(!e.PCDNBufferControl)return null;const{estPlayTime:i}=e;let r=i;e.estPTcontrol&&(r=Math.min(i,Math.max(0,this.duration-((null==t?void 0:t.currentTime)||0))));const{safePCDNInFactor:s,minBandwidth:a,maxPCDNInBuffer:o,minPCDNInBuffer:l}=e,c=s*Math.max(1024*(null==t?void 0:t.avgSpeedPCDN)||0,a),u=n>0?(1-c/n)*r:0;return this.curPCDNInBuffer=Math.min(o,Math.max(l,u)),this.curPCDNInBuffer}getPCDNOutBuffer(){const{config:e,player:t,bitrate:n}=this;if(!e.PCDNBufferControl)return null;const{estPlayTime:i}=e;let r=i;e.estPTcontrol&&(r=Math.min(i,Math.max(0,this.duration-((null==t?void 0:t.currentTime)||0))));const{safePCDNOutFactor:s,minBandwidth:a,maxPCDNOutBuffer:o,minPCDNOutBuffer:l}=e,c=s*Math.max(1024*(null==t?void 0:t.avgSpeedPCDN)||0,a),u=n>0?(1-c/n)*r:0;return this.curPCDNOutBuffer=Math.min(o,Math.max(l,u)),this.curPCDNOutBuffer}getPCDNChangeCnt(){const{PCDNCntControl:e,alpha:t}=this.config,{curPCDNInBuffer:n,player:i}=this,r=(null==i?void 0:i.bufferedPoint)||null,s=r&&r.end?r.end-i.currentTime:0;return e?s>n+(this.PCDNChangeCnt-1)*t&&this.PCDNChangeCnt++:s>=n&&this.PCDNChangeCnt<2&&this.PCDNChangeCnt++,this.PCDNChangeCnt}}const Ci=new Map,Ii=class e{static get pluginName(){return"PCDN"}static get pcdnReqCnt(){const{pcdn_tracker_request_cnt:t,pcdn_tracker_success_cnt:n}=e;return e.pcdn_tracker_request_cnt=0,e.pcdn_tracker_success_cnt=0,{pcdn_tracker_request_cnt:t,pcdn_tracker_failed_cnt:t-n}}static getDefaultConfig(){return{trackerUrl:"",loaderType:ui,responseType:pi,mode:"cors",method:"POST",retry:0,retryDelay:3e3,timeout:5e3,node_num:5,client_info:null,maxCnt:30,withReferer:0,NULLNodeTimeStep:6e4,ErrorTimeStep:15e3}}constructor(t,n,i,r){var s,a;this.options=e.getDefaultConfig(),Object.keys(t).map((e=>{void 0!==t[e]&&null!==t[e]&&(this.options[e]=t[e])})),(!this.options.productConfig||!this.options.productConfig.app_id)&&console.error("productConfig must has"),this.loader=new Ri(this.options),this.resetTrackeArgs(),this._lastFileInfo=null,this.lastfetchNodeTime=-1,this._lastRetFileKey=null,this._minUpdateNodeStep=this.options.ErrorTimeStep,null!=(a=null==(s=this.options)?void 0:s.adaptPCDNConfig)&&a.PCDNBufferControl&&(this.pcdnAdapt=new xi(n,i,r,this.options.adaptPCDNConfig))}get isOpenAdaptPCDN(){return!!this.pcdnAdapt}get curPCDNInBuffer(){return this.pcdnAdapt.curPCDNInBuffer}getPCDNInBuffer(){var e;return null==(e=this.pcdnAdapt)?void 0:e.getPCDNInBuffer()}get curPCDNOutBuffer(){return this.pcdnAdapt.curPCDNOutBuffer}getPCDNOutBuffer(){var e;return null==(e=this.pcdnAdapt)?void 0:e.getPCDNOutBuffer()}get curPCDNChangeCnt(){return this.pcdnAdapt.PCDNChangeCnt}getPCDNChangeCnt(){var e;return null==(e=this.pcdnAdapt)?void 0:e.getPCDNChangeCnt()}resetTrackeArgs(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}}static async gainPCDNNode(t,n,i,r){var s,a,o;const l=e.getDefaultConfig();Object.keys(n).map((e=>{void 0!==n[e]&&null!==n[e]&&(l[e]=n[e])})),(!r||!r.app_id)&&console.error("productConfig must has");const c=new ii;i?(i.byterate=Oi(i.bitrate),delete i.bitrate):c.reject("video fileInfo need set");const u=Object.assign(r,{file_info:i},{node_num:(null==n?void 0:n.node_num)||3}),d=JSON.stringify(u),h=new Ri(l);try{e.pcdn_tracker_request_cnt++;const n=await h.load(t,{body:d});n.done&&(null==(o=null==(a=null==(s=n.data)?void 0:s.Result)?void 0:a.nodes)?void 0:o.length)>0&&e.pcdn_tracker_success_cnt++,c.resolve(n)}catch(e){c.reject((null==e?void 0:e.message)||"get pcdnNode error")}return c}getPCDNNode(e,t,n){var i;const r=Oi(t),s=Ci.get(Li(e,r)),a=new ii;return null==s||!s.nodes||(null==(i=null==s?void 0:s.nodes)?void 0:i.length)<1?this.fetchPCDNNode(null,null,n).then((e=>{a.resolve(e)})).catch((e=>{a.reject(e)})):(s.fromCache=!0,a.resolve(s)),a}removePCDNNode(e,t,n){const i=Oi(t),r=Ci.get(Li(e,i)),s=null==r?void 0:r.nodes;s&&(n?r.nodes=s.filter((e=>e&&n.indexOf(e.url)<0)):s.shift(),Ci.set(Li(e,i),r)),(!s||!s.length)&&this.fetchPCDNNode().then().catch((()=>{}))}async fetchPCDNNode(t,n,i){var r,s;const a=new ii;if(n){n.byterate=Oi(n.bitrate);const e=Ci.get(Li(n.vid,n.byterate));if((null==(r=null==e?void 0:e.nodes)?void 0:r.length)>0)return e.fromCache=!0,a.resolve(e),a;delete n.bitrate,this._lastFileInfo=n}else n=this._lastFileInfo;if(!n)return a.resolve(null),a;let o=!1;const l=Li(n.vid,n.byterate);if(this._lastRetFileKey!==l&&(this.resetTrackeArgs(),o=!0),Date.now()-this.lastfetchNodeTime=this.options.maxCnt)return a.resolve(null),a;this.loader||(this.loader=new Ri(this.options)),this.trackeArgs.req_times+=1;try{e.pcdn_tracker_request_cnt++;const i=await this.loader.load(t||this.options.trackerUrl,{body:u});let r=null;if(i){this.trackeArgs.resp_times+=1;const t=8*n.byterate;if(i.done&&null!=(s=i.data)&&s.Result){const s=i.data.Result;r=s.nodes,r&&r.length>0?e.pcdn_tracker_success_cnt++:this._minUpdateNodeStep=this.options.NULLNodeTimeStep,r.map((e=>{e.vid=n.vid,e.bitrate=t}));const{fid:o,trace_id:l,req_id:c}=s,u={nodes:r,fid:o,vid:n.vid,trace_id:l,req_id:c,bitrate:t},d=Li(n.vid,n.byterate);Ci.set(d,u),this.trackeArgs.fid=s.fid,this.trackeArgs.trace_id=s.trace_id,this.trackeArgs.token=s.token,a.resolve(u)}else this._minUpdateNodeStep=this.options.ErrorTimeStep,a.reject(i)}}catch(e){this._minUpdateNodeStep=this.options.ErrorTimeStep,console.warn("tracker catch ERR,",e),a.reject(e)}return a}};function Li(e,t){return`${e}-${t}`}function Oi(e){return Math.floor(e/8)}function Ai(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n=0;--r){var s=this.tryEntries[r],a=s[4],o=this.prev,l=s[1],c=s[2];if(-1===s[0])return i("end"),!1;if(!l&&!c)throw Error("try statement without catch or finally");if(null!=s[0]&&s[0]<=o){if(o=0;--n){var i=this.tryEntries[n];if(i[0]>-1&&i[0]<=this.prev&&this.prev=0;--t){var n=this.tryEntries[t];if(n[2]===e)return this.complete(n[4],n[3]),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[0]===e){var i=n[4];if("throw"===i.type){var r=i.arg;P(n)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={i:w(t),r:n,n:i},"next"===this.method&&(this.arg=e),d}},t}function qi(e,t){return(qi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Yi(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}function Ji(e){return(Ji="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Zi(e){var t="function"==typeof Map?new Map:void 0;return Zi=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(Xi())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,t);var r=new(e.bind.apply(e,i));return n&&qi(r,n.prototype),r}(e,arguments,ji(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),qi(n,e)},Zi(e)}_n(Ii,"pcdn_tracker_request_cnt",0),_n(Ii,"pcdn_tracker_success_cnt",0);var er={DEBUG:1,LOG:2,WARN:3,ERROR:4},tr=["Boolean","Number","String","Undefined","Null","Date","Object"],nr=function(){function e(t,n){Bi(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),this.logCacheLevel=(null==n?void 0:n.logCacheLevel)||3,this.logMaxSize=(null==n?void 0:n.logMaxSize)||204800,this.logSize=0,this.logTextArray=[]}return Ui(e,[{key:"debug",value:function(){for(var t,n=arguments.length,i=new Array(n),r=0;r1?n-1:0),r=1;r=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var a=this.logTextArray.shift();this.logSize-=a.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}])}();function ir(){return(new Date).toLocaleString()}function rr(e){if("object"!==Ji(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function sr(e,t,n){n||(n=1),t||(t=2);var i={};if(!e||"object"!==Ji(e))return e;var r=Object.prototype.toString.call(e).slice(8,-1);if(!tr.includes(r))return r;if(!(n>t)){for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n===t?i[s]=rr(e[s]):"object"===Ji(e[s])?i[s]=sr(e[s],t,n+1):i[s]=e[s]);return i}}Hi(nr,"disabled",!0);var ar,or=function(){function e(){Bi(this,e)}return Ui(e,null,[{key:"start",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&e.start(0)<0?0:e.start(0):0}},{key:"end",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1):0}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(e){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var n=[],i=0,r=e.length;io&&(a[1]=l)}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,s=0,a=0,o=0,l=0,c=0,u=0,d=e.buffers(t,i),h=0,p=d.length;h=f[0]&&n<=f[1])r=f[0],s=f[1],a=h;else{if(n+if[1]&&(c=f[0],u=f[1])}}return{start:r,end:s,index:a,buffers:d,nextStart:o,nextEnd:l,prevStart:c,prevEnd:u,currentTime:n,behind:n-r,remaining:s?s-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}}])}(),lr={MANIFEST:"manifest",NETWORK:"network",NETWORK_TIMEOUT:"network_timeout",NETWORK_FORBIDDEN:"network_forbidden",NETWORK_NOTFOUND:"network_notfound",NETWROK_RANGE_NOT_SATISFIABLE:"network_range_not_satisfiable",DEMUX:"demux",REMUX:"remux",MEDIA:"media",DRM:"drm",OTHER:"other",RUNTIME:"runtime",SUB_TYPES:{FLV:"FLV",HLS:"HLS",MP4:"MP4",FMP4:"FMP4",MSE_ADD_SB:"MSE_ADD_SB",MSE_APPEND_BUFFER:"MSE_APPEND_BUFFER",MSE_OTHER:"MSE_OTHER",MSE_FULL:"MSE_FULL",MSE_CHANGE_TYPE:"MSE_CHANGE_TYPE",OPTION:"OPTION",DASH:"DASH",LICENSE:"LICENSE",CUSTOM_LICENSE:"CUSTOM_LICENSE",MSE_HIJACK:"MSE_HIJACK",EME_HIJACK:"EME_HIJACK",SIDX:"SIDX",NO_CANPLAY_ERROR:"NO_CANPLAY_ERROR",BUFFERBREAK_ERROR:"BUFFERBREAK_ERROR",WAITING_TIMEOUT_ERROR:"WAITING_TIMEOUT_ERROR",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_CODEC_NOT_SUPPORTED:"MEDIA_ERR_CODEC_NOT_SUPPORTED",MEDIA_ERR_URL_EMPTY:"MEDIA_ERR_URL_EMPTY"}},cr=(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(ar={},lr.MANIFEST,{HLS:1100,DASH:1200}),lr.NETWORK,2100),lr.NETWORK_TIMEOUT,2101),lr.NETWORK_FORBIDDEN,2103),lr.NETWORK_NOTFOUND,2104),lr.NETWROK_RANGE_NOT_SATISFIABLE,2116),lr.DEMUX,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),lr.REMUX,{FMP4:4100,MP4:4200}),lr.MEDIA,{MEDIA_ERR_ABORTED:5101,MEDIA_ERR_NETWORK:5102,MEDIA_ERR_DECODE:5103,MEDIA_ERR_SRC_NOT_SUPPORTED:5104,MEDIA_ERR_CODEC_NOT_SUPPORTED:5105,MEDIA_ERR_URL_EMPTY:5106,MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203,MSE_HIJACK:5204,MSE_CHANGE_TYPE:5205,EME_HIJACK:5301}),lr.DRM,{LICENSE:7100,CUSTOM_LICENSE:7200}),Hi(Hi(ar,lr.OTHER,8e3),lr.RUNTIME,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002,WAITING_TIMEOUT_ERROR:9003})),ur=function(e){function t(e,n,i,r,s){var a;return Bi(this,t),(a=Ni(this,t,[s||(null==i?void 0:i.message)])).errorType=e===lr.NETWORK_TIMEOUT?lr.NETWORK:e,a.originError=i,a.ext=r,a.errorCode=cr[e][n]||cr[e],a.errorMessage=a.message,a.errorCode||(a.errorType=lr.OTHER,a.errorCode=cr[a.errorType]),a}return zi(t,e),Ui(t,null,[{key:"create",value:function(e,n,i,r,s){return e instanceof t?e:(e instanceof Error&&(i=e,e=""),e||(e=lr.OTHER),new t(e,n,i,r,s))}},{key:"network",value:function(e){var n;return new t(null!=e&&e.isTimeout?lr.NETWORK_TIMEOUT:lr.NETWORK,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(n=e.response)||void 0===n?void 0:n.status})}}])}(Zi(Error));function dr(){var e,t,n=new Promise((function(n,i){e=n,t=i}));return n.used=!1,n.resolve=function(){return n.used=!0,e.apply(void 0,arguments)},n.reject=function(){return n.used=!0,t.apply(void 0,arguments)},n}function hr(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}function pr(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];try{if(e&&"undefined"!=typeof ManagedMediaSource)return ManagedMediaSource;if("undefined"!=typeof MediaSource)return MediaSource;throw new Error("MediaSource no defined")}catch(e){}}function fr(e){return/ManagedMediaSource/gi.test(Object.prototype.toString.call(e))}var gr="updateDuration",mr=function(){function e(t,n){var i=this;Bi(this,e),Hi(this,"media",null),Hi(this,"mediaSource",null),Hi(this,"_openPromise",dr()),Hi(this,"_queue",Object.create(null)),Hi(this,"_sourceBuffer",Object.create(null)),Hi(this,"_mseFullFlag",{}),Hi(this,"_st",0),Hi(this,"_opst",0),Hi(this,"_logger",null),Hi(this,"_config",null),Hi(this,"_url",null),Hi(this,"_onStartStreaming",(function(){i._logger.debug("startstreaming")})),Hi(this,"_onEndStreaming",(function(){i._logger.debug("endstreaming")})),Hi(this,"_onSBUpdateEnd",(function(e){var t=i._queue[e];if(t){var n=t[0];if((null==n?void 0:n.opName)!==gr&&t.shift(),n){var r,s,a=hr()-i._opst;i.media&&i._logger.debug("UpdateEnd(".concat(e,"/").concat(n.opName,")"),function(e){try{return JSON.stringify(e)}catch(e){return""}}(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!fr(this.mediaSource)||this.mediaSource.streaming}},{key:"handle",get:function(){var e;return null===(e=this.mediaSource)||void 0===e?void 0:e.handle}},{key:"liveEdge",get:function(){var e=this.bufferEnd("video"),t=this.bufferEnd("audio");return e&&t?Math.min(e,t):0}},{key:"videoMimeType",get:function(){var e;return null===(e=this._sourceBuffer.video)||void 0===e?void 0:e.mimeType}},{key:"isFull",value:function(t){return t?this._mseFullFlag[t]:this._mseFullFlag[e.VIDEO]}},{key:"getBlobUrl",value:function(){return this._url||(this._url=URL.createObjectURL(this.mediaSource)),this._url}},{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,i="open"===t.readyState,n&&i)try{t.endOfStream()}catch(e){}Object.keys(this._sourceBuffer).forEach((function(e){try{t.removeSourceBuffer(r._sourceBuffer[e])}catch(e){}})),fr(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=dr(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"unbind",value:(n=$i(Qi().mark((function e(t){var n,i=this;return Qi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._openPromise.used||this._openPromise.resolve(),n=this.mediaSource){if(Object.keys(this._queue).forEach((function(e){var t=i._queue[e];t&&t.forEach((function(e){var t,n;return null===(t=e.promise)||void 0===t||null===(n=t.resolve)||void 0===n?void 0:n.call(t)}))})),t&&this.isOpened)try{n.endOfStream()}catch(e){}Object.keys(this._sourceBuffer).forEach((function(e){try{n.removeSourceBuffer(i._sourceBuffer[e])}catch(e){}}))}fr(n)&&(n.removeEventListener("startstreaming",this._onStartStreaming),n.removeEventListener("endstreaming",this._onEndStreaming)),this._url&&(URL.revokeObjectURL(this._url),this._url=""),this.mediaSource=null,this._openPromise=dr(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"createSource",value:function(e,t){if(!this._sourceBuffer[e]&&this.mediaSource){var n;try{n=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(e){throw new ur(lr.MEDIA,lr.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 ur(lr.MEDIA,lr.SUB_TYPES.MSE_CHANGE_TYPE,new Error("changeType is not a function"))):this._enqueueOp(e,(function(){try{i.changeType(t)}catch(e){throw new ur(lr.MEDIA,lr.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,s;!i.mediaSource||null!==(r=i.media)&&void 0!==r&&r.error||(i._logger.debug("MSE APPEND START",n),i._opst=hr(),null===(s=i._sourceBuffer[e])||void 0===s||s.appendBuffer(t))}),"appendBuffer",n):Promise.resolve()}},{key:"remove",value:function(e,t,n,i){var r=this,s=!1;return this._mseFullFlag[e]&&(s=!0),this._enqueueOp(e,(function(){var s;if(r.mediaSource&&(null===(s=r.media)||void 0===s||!s.error)){var a=r._sourceBuffer[e];t>=n||!a?r._onSBUpdateEnd(e):(r._opst=hr(),r._logger.debug("MSE REMOVE START",e,t,n,i),a.remove(t,n))}}),"removeBuffer",i,s)}},{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,or.end(or.get(i)))})),e}},{key:"clearOpQueues",value:function(e,t){var n;this._logger.debug("MSE clearOpQueue START");var i=this._queue[e];if(t&&i)this._queue[e]=[];else 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,n.context&&"object"===Ji(n.context)&&(n.context.isFull=!0),this._logger.error("[MSE error], context,",n.context," ,name,",n.opName,",err,SourceBuffer is full"),n.promise.reject(new ur(lr.MEDIA,lr.SUB_TYPES.MSE_FULL,i))):(this._logger.error(i),n.promise.reject(i.constructor===ur?i:new ur(lr.MEDIA,lr.SUB_TYPES.MSE_OTHER,i)),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=pr();if(!t)return!1;try{return t.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}}}]);var t,n,i,r}();Hi(mr,"VIDEO","video"),Hi(mr,"AUDIO","audio");const vr=function(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}&&!function(){const e="_localstorage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return!0}}();vr&&localStorage.length;class yr{constructor(){let e,t;const n=new Promise(((n,i)=>{e=n,t=i}));return n.resolve=e,n.reject=t,n}resolve(e){}reject(e){}}const _r="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IHQ9e30se2hhc093blByb3BlcnR5OmN9PU9iamVjdC5wcm90b3R5cGU7cG9zdE1lc3NhZ2Uoe2V2ZW50OiJyZWFkeSJ9KTtmdW5jdGlvbiBvKHMsYSl7dFtzXT1zZXRUaW1lb3V0KCgpPT57cG9zdE1lc3NhZ2Uoe2RhdGE6e2Zha2VJZDpzfX0pLG8ocyxhKX0sYSl9YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24ocyl7dHJ5e2NvbnN0e2RhdGE6YT17fX09cyx7YWN0aW9uOm4sZmFrZUlkOmUsdGltZTpyfT1hO3N3aXRjaChuKXtjYXNlInNldEludGVydmFsIjpvKGUscik7YnJlYWs7Y2FzZSJjbGVhckludGVydmFsIjpjLmNhbGwodCxlKSYmKGNsZWFyVGltZW91dCh0W2VdKSxkZWxldGUgdFtlXSk7YnJlYWs7Y2FzZSJzZXRUaW1lb3V0Ijp0W2VdPXNldFRpbWVvdXQoZnVuY3Rpb24oKXtwb3N0TWVzc2FnZSh7ZGF0YTp7ZmFrZUlkOmV9fSksYy5jYWxsKHQsZSkmJmRlbGV0ZSB0W2VdfSxyKTticmVhaztjYXNlImNsZWFyVGltZW91dCI6Yy5jYWxsKHQsZSkmJihjbGVhclRpbWVvdXQodFtlXSksZGVsZXRlIHRbZV0pO2JyZWFrO2RlZmF1bHQ6YnJlYWt9fWNhdGNoKGEpe3Bvc3RNZXNzYWdlKHtldmVudDoiZXJyb3IiLGRhdGE6e2Vycm9yOmF9fSl9fSl9KSgpOwo=",Tr=typeof self<"u"&&self.Blob&&new Blob([(br=_r,Uint8Array.from(atob(br),(e=>e.charCodeAt(0))))],{type:"text/javascript;charset=utf-8"});var br;function Sr(e){let t;try{if(t=Tr&&(self.URL||self.webkitURL).createObjectURL(Tr),!t)throw"";const n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(t)})),n}catch{return new Worker("data:text/javascript;base64,"+_r,{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}let Pr,Mr,wr,Er,kr,Dr={},Rr=0;function xr(){do{2147483647===Rr?Rr=0:Rr++}while(Rr in Dr);return Rr}if(typeof Worker<"u"){let e,t=!1,n=!1;const i=()=>{if(!e){const{promise:i,resolve:r,reject:s}=Promise.withResolvers();e=i;try{Pr=new Sr,Pr.addEventListener("message",(e=>{const{event:i,data:a}=e.data;switch(i){case"error":n=!0,s(a.error);break;case"ready":t=!0,r();break;default:{const{fakeId:e}=a;if(e in Dr){const{cb:t,param:n,keepAlive:i,type:r}=Dr[e]||{};if("setInterval"!==r&&delete Dr[e],!i&&document.hidden)return;if("function"==typeof t)try{t.apply(window,n)}catch(e){console.error("Error when parse callback function, code %s",e)}}}}})),Pr.addEventListener("error",(function(e){console.error(e),n=!0,s(e)}))}catch(e){n=!0,s(e)}}return e},r=(e,r)=>{n?r&&r():t?e():i().then(e,r)};Mr=function(e,t,n=!1,...i){if("function"!=typeof e)throw new Error("cb must be a function");const s=xr();return Dr[s]={cb:e,param:i,keepAlive:!!n,type:"setInterval"},r((()=>{Pr.postMessage({action:"setInterval",fakeId:s,time:t})}),(()=>{s in Dr&&(Dr[s].degradeId=setInterval(e,t))})),s},Er=function(e){if("number"==typeof e&&e in Dr){const{degradeId:t}=Dr[e];delete Dr[e],r((()=>{Pr.postMessage({action:"clearInterval",fakeId:e})}),(()=>{t&&clearInterval(t)}))}},wr=function(e,t,n=!0,...i){if("function"!=typeof e)throw new Error("cb must be a function");const s=xr();return Dr[s]={cb:e,param:i,keepAlive:!!n,type:"setTimeout"},r((()=>{Pr.postMessage({action:"setTimeout",fakeId:s,time:t})}),(()=>{s in Dr&&(Dr[s].degradeId=setTimeout(e,t))})),s},kr=function(e){if("number"==typeof e&&e in Dr){const{degradeId:t}=Dr[e];delete Dr[e],r((()=>{Pr.postMessage({action:"clearTimeout",fakeId:e})}),(()=>{t&&clearTimeout(t)}))}}}else Mr=setInterval,wr=setTimeout,Er=clearInterval,kr=clearTimeout,console.error("the browser not support web worker, fallback to unWarp function!");Promise.withResolvers||(Promise.withResolvers=function(){const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e});const Cr="PRELOAD_NEXT",Ir="PRELOAD_SEG_DONE",Lr={PREPARE:"PREPARE",IDLE:"IDLE",PRELOADING:"PRELOADING",FINISH:"FINISH"},Or="ONE_STEP_DONE",Ar={INDEXDB:0,MEMORY:1},Gr={FAIL:-1,SUCCESS:0,DOWNLOADING:1},$r={MP4:"MP4",DASH:"DASH",HLS:"HLS"},Nr=Object.freeze(Object.defineProperty({__proto__:null,CACHE_TYPES:Ar,DOWN_STATES:Gr,MEDIA_FORMAT:{DASH:0,MP4:1},MEDIA_TYPES:{VIDEO:0,AUDIO:1,MIXED:2},ONE_STEP_DONE:Or,PRELOAD_NEXT:Cr,PRELOAD_SEG_DONE:Ir,PRELOAD_TYPES:{DURATION:0,SIZE:1},STATES:Lr,VTYPES:$r},Symbol.toStringTag,{value:"Module"}));class Br extends j{constructor(e,t,n,i,r){super(),this.state=Lr.PREPARE,this.options=e||{},this.logger=e.logger||function(){},this._preloadManager=t,this.player=t.player;const{handlers:s,predictInst:a,readyPromise:o}=n;this._predictInst=a,this._handlers=s,this._predictInstReadyPromise=o,this._toLoadList=[],this.retryCount=0,this._cachedHandler=i,this._cachedDataHandler=r,this.cnt=0}start(){const e=new yr;return this._handlers.start(this.options).then((t=>{t.onObtain().then((n=>{this._predictInstReadyPromise.then((()=>{this._predictInst.updateMediaInfos(n);const i=this._predictInst.preloadPredict(this.options),{cachedData:r}=this._predictInst;this._cachedDataHandler(Object.assign({vid:this.options.vid},{data:r}));const s=Object.assign(i,this.options);t.onTransform(s).then((t=>{this._toLoadList=t,e.resolve(t)}))}))}))})).catch((()=>{e.reject(new Error("preload unit start error"))})),e}preloadSeg(){if(0===this._toLoadList.length)return this.state=Lr.FINISH,void this.emit(Ir,!0);this.state="PRELOADING";const e=this._toLoadList.shift();this._handlers.onRequest(e,(t=>{const n=Object.assign({},e.extData,t);this._cachedHandler(n)})).then((()=>{this.state=Lr.IDLE,this.emit(Ir)})).catch((()=>{this.requestError(),this.emit(Ir,!1)}))}requestError(){this.retryCount++,this.state=Lr.IDLE,this.retryCount>=10&&(this.state=Lr.FINISH),this.emit(Or),this.logger("preload request error")}cancelLoading(){this._toLoadList=[]}destroy(){this.removeAllListeners()}}const Fr=function(){try{if(typeof indexedDB<"u")return indexedDB}catch{}}();function Ur(e,t){t||(t=()=>{}),t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function Hr(e){return"string"!=typeof e&&(console.warn(`${e} used as a key, but it is not a string.`),e=String(e)),e}const Vr={},jr="readonly",zr="readwrite";function Xr(e){const t=Vr[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 Kr(e,t){return new Promise((function(n,i){if(Vr[e.name]=Vr[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);Xr(e),e.db.close()}const r=[e.name];t&&r.push(e.version);const s=null==Fr?void 0:Fr.open.apply(Fr,r);t&&(s.onupgradeneeded=function(t){const n=s.result;try{n.createObjectStore(e.storeName)}catch(t){const n=t;if("ConstraintError"!==n.name)throw t;{const{oldVersion:t,newVersion:i}=n;console.warn(`The database "${e.name}" has been upgraded from version ${t} to\n version ${i}, but the storage "${e.storeName}" already exists.`)}}}),s.onerror=function(e){e.preventDefault(),i(s.error)},s.onsuccess=function(){n(s.result),function(e){const t=Vr[e.name].deferredOperations.pop();t&&(t.resolve(),t.promise)}(e)}}))}function Wr(e){return Kr(e,!1)}function Qr(e){return Kr(e,!0)}function qr(e,t){if(!e.db)return!0;const n=!e.db.objectStoreNames.contains(e.storeName),i=e.versione.db.version;if(i&&(e.version!==t&&console.warn(`The database "${e.name}" can't be downgraded from version ${e.db.version} to\n version ${e.version}.`),e.version=e.db.version),r||n){if(n){const t=e.db.version+1;t>e.version&&(e.version=t)}return!0}return!1}function Yr(e,t,n,i){var r;void 0===i&&(i=1);try{const i=null==(r=e.db)?void 0:r.transaction(e.storeName,t);n(null,i)}catch(r){const s=r;if(i>0&&(!e.db||"InvalidStateError"===s.name||"NotFoundError"===s.name))return Promise.resolve().then((()=>{if(!e.db||"NotFoundError"===s.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),Qr(e)})).then((()=>function(e){Xr(e);const t=Vr[e.name],{forages:n}=t;for(let e=0;e(e.db=t,qr(e)?Qr(e):t))).then((i=>{e.db=t.db=i;for(let e=0;e{throw function(e,t){const n=Vr[e.name].deferredOperations.pop();n&&(n.reject(t),n.promise)}(e,t),t}))}(e).then((()=>{Yr(e,t,n,i-1)})))).catch(n);n(s)}}class Jr{ready(){return this._ready}_initStorage(e){const t=this;t._defaultConfig=e;const n={db:null,name:"",version:"",storeName:""};if(e)for(const t in e)n[t]=e[t];let i=Vr[n.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},Vr[n.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t._ready=t._fullyReady);const r=[];function s(){return Promise.resolve()}for(let e=0;e{})),this._hasIdbForbidden=!1,this._maxCache=!e||e<=0?200:e,this.setMaxCache(this._maxCache),this._allCachedKeys={},this._allCachedTimeKeys={},this.getCachedKeysFromLocal(),this._readyPromise=new yr,this.init()}getCachedKeysFromLocal(){const e=(e=>{try{return localStorage.getItem(e)}catch{return null}})(ts);if(e){const t=e.split("|");for(let e=0;e{try{localStorage.setItem(e,t)}catch{}})(ts,n)}init(){this._driver.setItem("test","test").then((()=>{})).catch((()=>{this._hasIdbForbidden=!0})).finally((()=>{this._driver.removeItem("test").catch((()=>{})),this._hasIdbForbidden&&(this._driver=new Zr,this._driver._initStorage(es)),this._getAll(),this._readyPromise.resolve()}))}_getAll(){this._driver.all().then((e=>{const t=e.length-this._maxCache;let n=e;if(t>0){const i=e.slice(0,t);n=e.slice(t);for(let e=0;e{}))}this.writeCachedKeysToLocal(n)})).catch((()=>{}))}getItem(e,t){if(!this.hasItem(e))return Promise.resolve(!1);const{timeKey:n}=this._getTimeKey(e);return this._driver.getItem(n,t)}setItem(e,t,n){const{timeKey:i}=this._getTimeKey(e);i&&this.removeItem(e);const r=(new Date).getTime();this._allCachedKeys[e]=1,this._allCachedTimeKeys[e]=r;const s=this._genTimeKey(e,r);return n=n?()=>{this._getAll(),n()}:()=>{this._getAll()},this._driver.setItem(s,t,n)}_getTimeKey(e){const t=this._allCachedTimeKeys[e];let n=e;return t&&(n=this._genTimeKey(e,t)),{timeKey:n,time:t}}_genTimeKey(e,t){return`${t}$${e}`}removeItem(e,t){const{timeKey:n}=this._getTimeKey(e),i=this._driver.removeItem(n,t);return delete this._allCachedKeys[e],delete this._allCachedTimeKeys[e],i}hasItem(e){return!!this._allCachedKeys[e]}clear(e){return this._driver.clear(e)}length(e){return this._driver.length(e)}setMaxCache(e){"number"==typeof e&&e>0&&(this._maxCache=e)}}const is=class e extends j{constructor(e,t,n=null){super(),this._preloadDataList=[],this._currentPreloadInst=null,this.autoPreload=e.autoPreload||!1,this._autoCheck=e.autoCheck||{enable:!1,interval:1e3},this._onPreloadNext=this.onPreloadNextReady.bind(this),this.on(Cr,this._onPreloadNext),this._preloaderConfigs={},this.update(e,t,n),this._cacheInst=new ns(e.preloadMaxCacheCount,e.preloadCacheType||0),this._preloadCacheProgress={},this._ptag_=!0,this._cachedDatas={},this._taskIntervalId=null}setMaxCache(e){var t;null==(t=this._cacheInst)||t.setMaxCache(e)}startCheckTask(){const{_autoCheck:e,_preloadDataList:t}=this;this._taskIntervalId&&(window.clearTimeout(this._taskIntervalId),this._taskIntervalId=null),0!==t.length&&(this._checkIfCanPreload()&&this.onPreloadNext(),this._taskIntervalId=window.setTimeout((()=>{this.startCheckTask()}),e.interval||1e3))}stopCheckTask(){this._taskIntervalId&&(window.clearTimeout(this._taskIntervalId),this._taskIntervalId=null)}_checkIfCanPreload(){if(null==this._currentPreloadInst&&this._preloadDataList.length>0){const e=this._preloadDataList[0].data;if(e.payload){const t=this._getPreloaderKey(e),n=this._preloaderConfigs[t];if(null!=n&&n.handlers){const{checkIfCanPreload:t}=n.handlers;return t?t(e):(this.stopCheckTask(),!1)}return console.warn("need to set vtype, no preloader",e),this.stopCheckTask(),!1}}return!1}_getPreloaderKey(e){return e.vtype?e.vtype:"DEFAULT"}update(e,t,n){if(!n)throw new Error("PreloaderManager predictInst is null");const i=this._getPreloaderKey(e);this._preloaderConfigs[i]={predictInst:n,readyPromise:n.init(e),handlers:t}}get cachedDatas(){return this._cachedDatas}onCacheSegment(e){const{vid:t,format:n,cacheKey:i,total:r,loaded:s,isInitSegment:a,mediaType:o}=e,l=this.getProgressCacheKey(t,n,o);let c=this._preloadCacheProgress[l];c||(c=this._preloadCacheProgress[l]={}),c[i]={total:r,loaded:s,isInitSegment:a}}onCachePredict(e){const{vid:t,data:n}=e;t&&n&&(this._cachedDatas[t]=n)}getProgressCacheKey(e,t,n){return`${e}-${t}-${n}`}onPreloadNextReady(){this.onPreloadNext()}onPreloadSegDone(){this.autoPreload&&this.emit(Cr)}onPreloadNext(){if(null==this._currentPreloadInst&&this._preloadDataList.length>0){if(this._preloadDataList.length>0){const e=this._preloadDataList.shift(),t=null==e?void 0:e.data;if(null!=t&&t.payload){const e=this._getPreloaderKey(t),n=this._preloaderConfigs[e];if(!n)return void console.warn("need to set vtype, no preloader",t);this._currentPreloadInst=new Br(t,this,n,(e=>{this.onCacheSegment(e)}),(e=>{this.onCachePredict(e)})),this._currentPreloadInst.on(Ir,this.onPreloadSegDone.bind(this)),this._currentPreloadInst.start().then((()=>{this._currentPreloadInst.preloadSeg()})).catch((()=>{this._currentPreloadInst=null}))}}}else null!=this._currentPreloadInst&&(this._currentPreloadInst.state===Lr.IDLE?this._currentPreloadInst.preloadSeg():this._currentPreloadInst.state===Lr.FINISH?(this._currentPreloadInst.destroy(),this._currentPreloadInst=null):this._currentPreloadInst.state===Lr.PREPARE&&(this._currentPreloadInst.cnt++,this._currentPreloadInst.cnt>2&&(this._currentPreloadInst.destroy(),this._currentPreloadInst=null)))}addDashPreloader(e){e.data&&(this._preloadDataList.push(e),this.sort(this._preloadDataList),this.autoPreload&&this.emit(Cr),this._autoCheck.enable&&!this._taskIntervalId&&this.startCheckTask())}_addDashPreloader(e){e.data&&this._preloadDataList.push(e)}addDashPreloaderList(e=[]){this.sort(e);for(let t=0;tvoid 0===e.order&&void 0===e.order||"number"==typeof e.order&&"number"==typeof t.order&&e.orderPromise.resolve(e()).then(t);return this.then((e=>t((()=>e))),(e=>t((()=>Promise.reject(e)))))}}.finally)}before(){throw new Error("need")}check(){if(!this.handlers)throw new Error("handlers null");if(!this.handlers.start||!this.handlers.onRequest)throw new Error("handlers callback null");if(!this.predictInst)throw new Error("predictInst null");if(!this.predictInst.__p__)throw new Error("predictInst need extends predictbase")}preloadNext(){this._preloadManager.emit(Cr)}get preloadManager(){return this._preloadManager}start(){throw new Error("start need implment, return Promise")}cancelLoading(){for(let e=0;e{for(let t=this.loadingTasks.length-1;t>-1;t--)if(this.loadingTasks[t]===e){this.loadingTasks.splice(t,1);break}}))}addDashPreloader(e){this._preloadManager.addDashPreloader(e)}addDashPreloaderList(e=[]){this._preloadManager.addDashPreloaderList(e)}}class as{constructor(){this.bandwidth2item={},this._mediaInfos=void 0,this.__p__=!0}init(){throw new Error("init func not implement, return promise")}preloadPredict(e){throw new Error(`preloadPredict error: ${e}`)}updateMediaInfos(e){if(this._mediaInfos=e,this.bandwidth2item={},this.dynamic_video=e.dynamic_video_list,this.dynamic_video.length>0)for(let e=0;e{e.definition===t&&(n=i)})),n}get cachedData(){return null}}const os=$r;var ls=n(23722);function cs(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n=0;--r){var s=this.tryEntries[r],a=s[4],o=this.prev,l=s[1],c=s[2];if(-1===s[0])return i("end"),!1;if(!l&&!c)throw Error("try statement without catch or finally");if(null!=s[0]&&s[0]<=o){if(o=0;--n){var i=this.tryEntries[n];if(i[0]>-1&&i[0]<=this.prev&&this.prev=0;--t){var n=this.tryEntries[t];if(n[2]===e)return this.complete(n[4],n[3]),P(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[0]===e){var i=n[4];if("throw"===i.type){var r=i.arg;P(n)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={i:w(t),r:n,n:i},"next"===this.method&&(this.arg=e),d}},t}function Ps(e,t){return(Ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ms(e){return function(e){if(Array.isArray(e))return cs(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Es(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ws(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}function Es(e,t){if(e){if("string"==typeof e)return cs(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cs(e,t):void 0}}var ks="fetch",Ds="arraybuffer",Rs="text",xs=function(e){function t(e,n,i,r){var s;return Bi(this,t),Hi(s=Ni(this,t,[r]),"retryCount",0),Hi(s,"isTimeout",!1),Hi(s,"loaderType",ks),Hi(s,"startTime",0),Hi(s,"endTime",0),Hi(s,"options",{}),s.url=e,s.request=n,s.response=i,s}return zi(t,e),Ui(t)}(Zi(Error)),Cs=Object.prototype.toString;function Is(e){if("[object Object]"!==Cs.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function Ls(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 Os(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function As(e,t){if(e){if(!t)return e;var n,i=Object.keys(t).map((function(e){if(null!=(n=t[e]))return Array.isArray(n)?e+="[]":n=[n],n.map((function(t){return function(e){return"[object Date]"===Cs.call(e)}(t)?t=t.toISOString():function(e){return null!==e&&"object"===Ji(e)}(t)&&(t=JSON.stringify(t)),"".concat(Os(e),"=").concat(Os(t))})).join("&")})).filter(Boolean).join("&");if(i){var r=e.indexOf("#");-1!==r&&(e=e.slice(0,r)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}}function Gs(e,t,n,i,r,s,a,o,l,c,u){return r=null!=r?parseFloat(r):null,i=parseInt(i||"0",10),Number.isNaN(i)&&(i=0),{data:e,done:t,options:{range:l,vid:c,index:o,contentLength:i,age:r,startTime:s,firstByteTime:a,endTime:Date.now(),priOptions:u},response:n}}function $s(e,t){return Math.round(8*e*1e3/t/1024)}var Ns="real_time_speed",Bs=2097152,Fs=function(e){function t(){var e;return Bi(this,t),Hi(e=Ni(this,t),"_abortController",null),Hi(e,"_timeoutTimer",null),Hi(e,"_reader",null),Hi(e,"_response",null),Hi(e,"_aborted",!1),Hi(e,"_index",-1),Hi(e,"_range",null),Hi(e,"_receivedLength",0),Hi(e,"_running",!1),Hi(e,"_logger",null),Hi(e,"_vid",""),Hi(e,"_onProcessMinLen",0),Hi(e,"_onCancel",null),Hi(e,"_priOptions",null),Hi(e,"_processMaxGapTime",1/0),e}return zi(t,e),Ui(t,[{key:"load",value:function(e){var t,n=this,i=e.url,r=e.vid,s=e.timeout,a=e.responseType,o=e.onProgress,l=e.index,c=e.onTimeout,u=e.onCancel,d=e.range,h=e.transformResponse,p=e.request,f=e.params,g=e.logger,m=e.method,v=e.headers,y=e.body,_=e.mode,T=e.credentials,b=e.cache,S=e.redirect,P=e.referrer,M=e.referrerPolicy,w=e.onProcessMinLen,E=e.processMaxGapTime,k=e.priOptions;this._logger=g,this._aborted=!1,this._onProcessMinLen=w,this._onCancel=u,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._receivedLength=0,this._index=l,this._range=d||[0,0],this._vid=r||i,this._priOptions=k||{},this._processMaxGapTime=E;var D={method:m,headers:v,body:y,mode:_,credentials:T,cache:b,redirect:S,referrer:P,referrerPolicy:M,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},R=!1;clearTimeout(this._timeoutTimer),i=As(i,f);var x=Ls(d);x&&(v=p?p.headers:D.headers=D.headers||(Headers?new Headers:{}),Headers&&v instanceof Headers?v.append("Range",x):v.Range=x),s&&(this._timeoutTimer=setTimeout($i(Qi().mark((function e(){var t;return Qi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R=!0,e.next=3,n.cancel();case 3:c&&((t=new xs(i,D,null,"timeout")).isTimeout=!0,c(t,{index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions}));case 4:case"end":return e.stop()}}),e)}))),s));var C=Date.now();return this._logger.debug("[fetch load start], index,",l,",range,",d),new Promise((function(e,t){fetch(p||i,p?void 0:D).then(function(){var r=$i(Qi().mark((function r(s){var c,u,p,f;return Qi().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(clearTimeout(n._timeoutTimer),n._response=s,!n._aborted&&n._running){r.next=4;break}return r.abrupt("return");case 4:if(h&&(s=h(s,i)||s),s.ok){r.next=7;break}throw new xs(i,D,s,"bad network response");case 7:if(c=Date.now(),a!==Rs){r.next=15;break}return r.next=11,s.text();case 11:u=r.sent,n._running=!1,r.next=37;break;case 15:if("json"!==a){r.next=22;break}return r.next=18,s.json();case 18:u=r.sent,n._running=!1,r.next=37;break;case 22:if(!o){r.next=29;break}return n.resolve=e,n.reject=t,n._loadChunk(s,o,C,c),r.abrupt("return");case 29:return r.next=31,s.arrayBuffer();case 31:u=r.sent,u=new Uint8Array(u),n._running=!1,p=Date.now()-C,f=$s(u.byteLength,p),n.emit(Ns,{speed:f,len:u.byteLength,time:p,vid:n._vid,index:n._index,range:n._range,priOptions:n._priOptions});case 37:n._logger.debug("[fetch load end], index,",l,",range,",d),e(Gs(u,!0,s,s.headers.get("Content-Length"),s.headers.get("age"),C,c,l,d,n._vid,n._priOptions));case 39:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}()).catch((function(e){var r;clearTimeout(n._timeoutTimer),n._running=!1,n._aborted&&!R||((e=e instanceof xs?e:new xs(i,D,null,null===(r=e)||void 0===r?void 0:r.message)).startTime=C,e.endTime=Date.now(),e.isTimeout=R,e.options={index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions},t(e))}))}))}},{key:"cancel",value:(n=$i(Qi().mark((function e(){return Qi().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 n.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,n,i){var r=this;if(!e.body||!e.body.getReader){this._running=!1;var s=new xs(e.url,"",e,"onProgress of bad response.body.getReader");return s.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(s)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(Bs),this._writeIdx=0);var a,o,l,c=this._reader=e.body.getReader(),u=Date.now(),d=function(){var s=$i(Qi().mark((function s(){var h,p,f,g,m,v,y,_,T;return Qi().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return o=Date.now(),s.prev=1,s.next=4,c.read();case 4:a=s.sent,l=Date.now(),s.next=13;break;case 8:return s.prev=8,s.t0=s.catch(1),l=Date.now(),r._aborted||(r._running=!1,s.t0.options={index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions},r.reject(s.t0)),s.abrupt("return");case 13:if(p=(null===(h=r._range)||void 0===h?void 0:h.length)>0?r._range[0]:0,f=p+r._receivedLength,!r._aborted){s.next=19;break}return r._running=!1,t(void 0,!1,{range:[f,f],vid:r._vid,index:r._index,startTime:o,endTime:l,st:n,firstByteTime:i,priOptions:r._priOptions},e),s.abrupt("return");case 19:if(g=a.value?a.value.byteLength:0,r._receivedLength+=g,r._onProcessMinLen>0?r._writeIdx+g>=r._onProcessMinLen||a.done?((m=new Uint8Array(r._writeIdx+g)).set(r._cache.subarray(0,r._writeIdx),0),g>0&&m.set(a.value,r._writeIdx),r._writeIdx=0,r._logger.debug("【fetchLoader,onProgress enough】,done,",a.done,",len,",m.byteLength,", writeIdx,",r._writeIdx)):g>0&&r._writeIdx+g0&&(v=new Uint8Array(r._writeIdx+g+2048),r._logger.debug("【fetchLoader,onProgress extra start】,size,",r._writeIdx+g+2048,", datalen,",g,", writeIdx,",r._writeIdx),v.set(r._cache.subarray(0,r._writeIdx),0),g>0&&v.set(a.value,r._writeIdx),r._writeIdx+=g,delete r._cache,r._cache=v,r._logger.debug("【fetchLoader,onProgress extra end】,len,",g,", writeIdx,",r._writeIdx)):m=a.value,!(m&&m.byteLength>0||a.done)){s.next=28;break}r._logger.debug("【fetchLoader,onProgress call】,task,",r._range,", start,",f,", end,",p+r._receivedLength,", done,",a.done,n),t(m,a.done,{range:[r._range[0]+r._receivedLength-(m?m.byteLength:0),r._range[0]+r._receivedLength],vid:r._vid,index:r._index,startTime:o,endTime:l,st:n,firstByteTime:i,priOptions:r._priOptions},e),u=Date.now(),s.next=37;break;case 28:if(!(Date.now()-u>=r._processMaxGapTime)){s.next=37;break}return r._logger.debug("[onProgress timeout],task: ".concat(JSON.stringify(r._range)," done: ").concat(a.done," processMaxGapTime: ").concat(r._processMaxGapTime)),(y=new xs(e.url,null,e,"process timeout")).options={index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions},r.running=!1,s.next=35,r.cancel();case 35:return r.reject(y),s.abrupt("return");case 37:a.done?(_=Date.now()-n,T=$s(r._receivedLength,_),r.emit(Ns,{speed:T,len:r._receivedLength,time:_,vid:r._vid,index:r._index,range:r._range,priOptions:r._priOptions}),r._running=!1,r._logger.debug("[fetchLoader onProgress end],task,",r._range,",done,",a.done),r.resolve(Gs(a,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),n,i,r._index,r._range,r._vid,r._priOptions))):d();case 38:case"end":return s.stop()}}),s,null,[[1,8]])})));return function(){return s.apply(this,arguments)}}();d()}},{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)}}]);var n}(z()),Us=function(e){function t(){var e;return Bi(this,t),Hi(e=Ni(this,t),"_xhr",null),Hi(e,"_aborted",!1),Hi(e,"_timeoutTimer",null),Hi(e,"_range",null),Hi(e,"_receivedLength",0),Hi(e,"_url",null),Hi(e,"_onProgress",null),Hi(e,"_index",-1),Hi(e,"_headers",null),Hi(e,"_currentChunkSizeKB",384),Hi(e,"_timeout",null),Hi(e,"_xhr",null),Hi(e,"_withCredentials",null),Hi(e,"_startTime",-1),Hi(e,"_loadCompleteResolve",null),Hi(e,"_loadCompleteReject",null),Hi(e,"_runing",!1),Hi(e,"_logger",!1),Hi(e,"_vid",""),Hi(e,"_responseType",void 0),Hi(e,"_credentials",void 0),Hi(e,"_method",void 0),Hi(e,"_transformResponse",void 0),Hi(e,"_firstRtt",void 0),Hi(e,"_onCancel",null),Hi(e,"_priOptions",null),e}return zi(t,e),Ui(t,[{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=As(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 xs?e:new xs(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===Ds&&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){var n,i,r;t._running=!1;var s=new xs(t._url,t._request,null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.response,"xhr.onerror.status:"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.status)+",statusText,"+(null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.statusText));s.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(s)},n.ontimeout=function(e){t.cancel();var n=new xs(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||{},r=Ls(e);r&&(i.Range=r),i&&Object.keys(i).forEach((function(e){n.setRequestHeader(e,i[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),n.send(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,n=e.target.status;if(n<200||n>299){var i=new xs(this._url,null,Wi(Wi({},e.target.response),{},{status:n}),"bad response,status:"+n);return i.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(i)}var r,s=null,a=!1,o=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===Ds){var l,c=new Uint8Array(e.target.response);if(r=o+this._receivedLength,c&&c.byteLength>0){this._receivedLength+=c.byteLength;var u=Date.now()-this._startTime,d=$s(this._receivedLength,u);this.emit(Ns,{speed:d,len:this._receivedLength,time:u,vid:this._vid,index:this._index,range:[r,o+this._receivedLength],priOptions:this._priOptions})}s=c,a=!((null===(l=this._range)||void 0===l?void 0:l.length)>1&&this._range[1]&&this._receivedLength], tast :",this._range,", start",r,"end ",o+this._receivedLength,",dataLen,",c?c.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",a)}else a=!0,s=e.target.response;var h={ok:n>=200&&n<300,status:n,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(h=this._transformResponse(h,this._url)||h),this._onProgress&&this._onProgress(s,a,{index:this._index,vid:this._vid,range:[r,o+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},h),a?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(Gs(this._onProgress?null:s,a,h,h.headers["content-length"],h.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,(e=this,"function"==typeof(n=Vi(ji(t.prototype),"removeAllListeners",e))?function(t){return n.apply(e,t)}:n)([]),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0;var e,n}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,n={},i=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Ai(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ai(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw s}}}}(e.getAllResponseHeaders().trim().split("\r\n"));try{for(i.s();!(t=i.n()).done;){var r=t.value.split(": ");n[r[0].toLowerCase()]=r.slice(1).join(": ")}}catch(e){i.e(e)}finally{i.f()}return n}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}])}(z()),Hs=["retry","retryDelay","onRetryError","transformError"],Vs=function(){return Ui((function e(t,n){Bi(this,e),this.promise=dr(),this.alive=!!n.onProgress,!n.logger&&(n.logger=new nr("Loader")),this._loaderType=t,this._loader=t===ks&&"undefined"!=typeof fetch?new Fs:new Us,this._config=n,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=n.retryCheckFunc,this._logger=n.logger}),[{key:"exec",value:function(){var e=this,t=this._config,n=t.retry,i=t.retryDelay,r=t.onRetryError,s=t.transformError,a=function(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;n[i]=e[i]}return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i0&&r(c,e._retryCount,{index:a.index,vid:a.vid,range:a.range,priOptions:a.priOptions}),e._retryCount++,u=!0,e._retryCheckFunc&&(u=e._retryCheckFunc(t.t0)),!(u&&e._retryCount<=n)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",a.range),e._retryTimer=setTimeout(o,i),t.abrupt("return");case 26:e.promise.reject(c);case 27:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return o(),this.promise}},{key:"cancel",value:(e=$i(Qi().mark((function e(){return Qi().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}}]);var e}(),js=10;function zs(){for(var e=arguments.length,t=new Array(e),n=0;n0)break;n++}catch(e){if(!(n0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var Ws=function(e){function t(e){var n;return Bi(this,t),Hi(n=Ni(this,t,[e]),"type",ks),Hi(n,"_queue",[]),Hi(n,"_alive",[]),Hi(n,"_currentTask",null),Hi(n,"_finnalUrl",""),Hi(n,"_config",void 0),n._config=function(e){return Wi({loaderType:ks,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:Rs,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0,processMaxGapTime:1/0},e)}(e),"xhr"!==n._config.loaderType&&Fs.isSupported()||(n.type="xhr"),n.log=e.logger,n}return zi(t,e),Ui(t,[{key:"isFetch",value:function(){return this.type===ks}},{key:"load",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?n=e:n.url=e||n.url||this._config.url,(n=Object.assign({},this._config,n)).params&&(n.params=Object.assign({},n.params)),n.headers&&Is(n.headers)&&(n.headers=Object.assign({},n.headers)),n.body&&Is(n.body)&&(n.body=Object.assign({},n.body)),n.transformRequest&&(n=n.transformRequest(n)||n),n.logger=this.log;var i=new Vs(this.type,n);return i.loader.on(Ns,(function(e){t.emit(Ns,e)})),this._queue.push(i),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),i.promise}},{key:"cancel",value:(n=$i(Qi().mark((function e(){var t;return Qi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,Ks();case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,n;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(n=e._alive)||void 0===n?void 0:n.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return Fs.isSupported()}}]);var n}(z());function Qs(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function aa(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 oa(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 la(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return aa(e,t)*ra+aa(e,t+4)}function ca(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 ua(e){if(!Array.isArray(e)){for(var t=[],n="",i=0;i=i)){var s=r,a=[],o=(60&t[r+2])>>>2,l=e.FREQ[o];if(!l)throw new Error("Invalid sampling index: ".concat(o));for(var c,u,d=1+((192&t[r+2])>>>6),h=(1&t[r+2])<<2|(192&t[r+3])>>>6,p=e._getConfig(o,h,d),f=p.config,g=p.codec,m=0,v=e.getFrameDuration(l);r+7>5)||i-r=i?void 0:t.subarray(r),frames:a,samplingFrequencyIndex:o,sampleRate:l,objectType:d,channelCount:h,codec:g,config:f,originCodec:"mp4a.40.".concat(d)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var n=t[0]>>>3,i=(7&t[0])<<1|t[1]>>>7,r=(120&t[1])>>>3,s=e.FREQ[i];if(s){var a=e._getConfig(i,r,n),o=a.config,l=a.codec;return t.length>=4&&695==(t[2]<<3|(224&t[3])>>5)&&(128&t[4])>>7&&(n=31&t[3]),{samplingFrequencyIndex:i,sampleRate:s,objectType:n,channelCount:r,config:o,codec:l,originCodec:"mp4a.40.".concat(n)}}}}},{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,n){var i,r,s=[];return fa?e>=6?(i=5,r=e-3):(i=2,r=e):ga?(i=2,r=e):(i=2===n||5===n?n:5,r=e,e>=6?r=e-3:1===t&&(i=2,r=e)),s[0]=i<<3,s[0]|=(14&e)>>1,s[1]=(1&e)<<7,s[1]|=t<<3,5===i&&(s[1]|=(14&r)>>1,s[2]=(1&r)<<7,s[2]|=8,s[3]=0),{config:s,codec:"mp4a.40.".concat(i)}}},{key:"getSilentFrame",value:function(e,t,n){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if("mp4a.40.5"===e&&2===t&&22050===n)return new Uint8Array([33,17,69,0,20,80,1,70,173,200,65,117,0,0,0,28,96,24,13,230,66,20,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,188]);if("mp40.40.5"===e&&2===t&&24e3===n)return new Uint8Array([33,17,69,0,20,80,1,70,173,200,65,117,0,0,0,28,96,24,13,229,98,20,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,188]);if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}])}();Zs(ma,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var va=function(){return Js((function e(t){if(qs(this,e),Zs(this,"_bytesAvailable",void 0),Zs(this,"_bitsAvailable",0),Zs(this,"_word",0),!t)throw new Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}),[{key:"_loadWord",value:function(){var e=this._data.byteLength-this._bytesAvailable,t=Math.min(4,this._bytesAvailable);if(0===t)throw new Error("No bytes available");var n=new Uint8Array(4);n.set(this._data.subarray(e,e+t)),this._word=new DataView(n.buffer).getUint32(0),this._bitsAvailable=8*t,this._bytesAvailable-=t}},{key:"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:"skipBits",value:function(e){if(this._bitsAvailable>e)this._word<<=e,this._bitsAvailable-=e;else{e-=this._bitsAvailable;var t=Math.floor(e/8);e-=8*t,this._bytesAvailable-=t,this._loadWord(),this._word<<=e,this._bitsAvailable-=e}}},{key:"readBits",value:function(e){if(e>32)throw new Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,e),n=this._word>>>32-t;return this._bitsAvailable-=t,this._bitsAvailable>0?this._word<<=t:this._bytesAvailable>0&&this._loadWord(),(t=e-t)>0&&this._bitsAvailable?n<>>e)return this._word<<=e,this._bitsAvailable-=e,e;return this._loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(e){for(var t=8,n=8,i=0;i>this._numHeldBits-e&(1<1){e.streamRead1Bytes();for(var p=0,f=t-2;f>=0;--f)p|=e.extractBits(1)<1;++g)e.extractBits(1);for(var m=t-2;m>=0;--m)p&1<=n))break;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})}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;--f)d[f]=t.readBits(1);for(;!t.byteAligned();)t.readBits(1);for(var g=u;g>=0;--g)d[g]&&(h[g]=t.readUByte());if(n)for(var m=t.readUByte(),v=0;v>>16),this.dv.setUint16(n+1,65535&t);case 4:return this.dv.setUint32(n,t);default:throw new Error("write ".concat(e,"-byte integers is not supported"))}}},{key:"readToBuffer",value:function(e){var t;return t=this.offset||e?this.dv.buffer.slice(this.offset,e?this.offset+e:this.end):this.dv.buffer,this.offset+=t.byteLength,t}},{key:"readToUint8",value:function(e){var t=new Uint8Array(this.dv.buffer,this.offset,e||this.unreadLength);return this.offset+=t.byteLength,t}},{key:"readString",value:function(e){for(var t=0,n="";t=0){var n=0,i=0;if(this.offset+=e,this.size>31){for(;i>>t&n}throw new 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)}}])}(),wa=function(){function e(){qs(this,e)}return Js(e,null,[{key:"findBox",value:function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[];if(!t)return r;for(var s=0,a="",o=0;t.length>7;){if(s=aa(t),a=String.fromCharCode.apply(null,t.subarray(4,8)),o=8,1===s?(s=la(t,8),o+=8):s||(s=t.length),!n[0]||a===n[0]){var l=t.subarray(0,s);if(!(n.length<2))return e.findBox(l.subarray(o),n.slice(1),i+o);r.push({start:i,size:s,headerSize:o,type:a,data:l})}i+=s,t=t.subarray(s)}return r}},{key:"tfhd",value:function(e){return Ra(e,!0,(function(e,t){e.trackId=aa(t);var n=4,i=1&e.flags,r=2&e.flags,s=8&e.flags,a=16&e.flags,o=32&e.flags;i&&(n+=4,e.baseDataOffset=aa(t,n),n+=4),r&&(e.sampleDescriptionIndex=aa(t,n),n+=4),s&&(e.defaultSampleDuration=aa(t,n),n+=4),a&&(e.defaultSampleSize=aa(t,n),n+=4),o&&(e.defaultSampleFlags=aa(t,n))}))}},{key:"sidx",value:function(e){return Ra(e,!0,(function(e,t){var n=0;e.reference_ID=aa(t,n),n+=4,e.timescale=aa(t,n),n+=4,0===e.version?(e.earliest_presentation_time=aa(t,n),n+=4,e.first_offset=aa(t,n),n+=4):(e.earliest_presentation_time=la(t,n),n+=8,e.first_offset=la(t,n),n+=8),n+=2,e.references=[];var i=sa(t,n);n+=2;for(var r=0;r>31&1,s.referenced_size=2147483647&a,s.subsegment_duration=aa(t,n),a=aa(t,n+=4),n+=4,s.starts_with_SAP=a>>31&1,s.SAP_type=a>>28&7,s.SAP_delta_time=268435455&a}}))}},{key:"moov",value:function(t){return Ra(t,!1,(function(t,n,i){t.mvhd=e.mvhd(e.findBox(n,["mvhd"],i)[0]),t.trak=e.findBox(n,["trak"],i).map((function(t){return e.trak(t)})),t.pssh=e.pssh(e.findBox(n,["pssh"],i)[0])}))}},{key:"mvhd",value:function(e){return Ra(e,!0,(function(e,t){var n=0;1===e.version?(e.timescale=aa(t,16),e.duration=la(t,20),n+=28):(e.timescale=aa(t,8),e.duration=aa(t,12),n+=16),e.nextTrackId=aa(t,n+76)}))}},{key:"trak",value:function(t){return Ra(t,!1,(function(t,n,i){t.tkhd=e.tkhd(e.findBox(n,["tkhd"],i)[0]),t.mdia=e.mdia(e.findBox(n,["mdia"],i)[0]),t.edts=e.edts(e.findBox(n,["edts"],i)[0])}))}},{key:"tkhd",value:function(e){return Ra(e,!0,(function(e,t){var n=Pa.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 i=0;i<36;i++)e.matrix.push(n.read(1));n.back(36);for(var r,s=[],a=0;a<3;a++)s.push(da(n.readInt(2),n.readInt(2))),s.push(da(n.readInt(2),n.readInt(2))),r=n.readInt(4),s.push(da(r>>30,1073741823&r));e.rotation=function(e){if(e.length<5)return 0;var t=Math.hypot(e[0],e[3]),n=Math.hypot(e[1],e[4]);return 0===t||0===n?0:180*Math.atan2(e[1]/n,e[0]/t)/Math.PI}(s),e.width=n.read(4),e.height=n.read(4)}))}},{key:"mdia",value:function(t){return Ra(t,!1,(function(t,n,i){t.mdhd=e.mdhd(e.findBox(n,["mdhd"],i)[0]),t.hdlr=e.hdlr(e.findBox(n,["hdlr"],i)[0]),t.minf=e.minf(e.findBox(n,["minf"],i)[0])}))}},{key:"edts",value:function(t){return Ra(t,!1,(function(t,n,i){t.elst=e.elst(e.findBox(n,["elst"],i)[0])}))}},{key:"elst",value:function(e){return Ra(e,!0,(function(e,t,n){e.entries=[],e.entriesData=t;var i=0,r=aa(t,i);i+=4;for(var s=0;s>10&31),96+(i>>5&31),96+(31&i))}))}},{key:"hdlr",value:function(e){return Ra(e,!0,(function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}},{key:"minf",value:function(t){return Ra(t,!1,(function(t,n,i){t.vmhd=e.vmhd(e.findBox(n,["vmhd"],i)[0]),t.smhd=e.smhd(e.findBox(n,["smhd"],i)[0]),t.stbl=e.stbl(e.findBox(n,["stbl"],i)[0])}))}},{key:"vmhd",value:function(e){return Ra(e,!0,(function(e,t){e.graphicsmode=sa(t),e.opcolor=[sa(t,2),sa(t,4),sa(t,6)]}))}},{key:"smhd",value:function(e){return Ra(e,!0,(function(e,t){e.balance=sa(t)}))}},{key:"stbl",value:function(t){return Ra(t,!1,(function(t,n,i){var r;t.stsd=e.stsd(e.findBox(n,["stsd"],i)[0]),t.stts=e.stts(e.findBox(n,["stts"],i)[0]),t.ctts=e.ctts(e.findBox(n,["ctts"],i)[0]),t.stsc=e.stsc(e.findBox(n,["stsc"],i)[0]),t.stsz=e.stsz(e.findBox(n,["stsz"],i)[0]),t.stco=e.stco(e.findBox(n,["stco"],i)[0]),t.stco||(t.co64=e.co64(e.findBox(n,["co64"],i)[0]),t.stco=t.co64);var s=null===(r=t.stsd.entries[0])||void 0===r||null===(r=r.sinf)||void 0===r||null===(r=r.schi)||void 0===r?void 0:r.tenc.default_IV_size;t.stss=e.stss(e.findBox(n,["stss"],i)[0]),t.senc=e.senc(e.findBox(n,["senc"],i)[0],s)}))}},{key:"senc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return Ra(e,!0,(function(e,n){var i=0,r=aa(n,i);i+=4,e.samples=[];for(var s=0;s0){var a=aa(t,r);r+=4;for(var o=0;o<(""+a).length;o++)for(var l=0;l<16;l++){var c=t[r];r+=1,n.push(xa(c))}}var u=aa(t,r);e.data_size=u,r+=4,e.kid=n,e.system_id=i,e.buffer=t}))}},{key:"bvc2",value:function(t){return Ra(t,!1,(function(t,n,i){var r=ka(t,n),s=n.subarray(r);i+=r,t.vvcC=e.bv2C(e.findBox(s,["bv2C"],i)[0]),t.pasp=e.pasp(e.findBox(s,["pasp"],i)[0])}))}},{key:"bv2C",value:function(e){return Ra(e,!1,(function(e,t,n){var i=_a.parseVVCDecoderConfigurationRecord(t);for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}))}},{key:"stsd",value:function(t){return Ra(t,!0,(function(t,n,i){t.entryCount=aa(n),t.entries=e.findBox(n.subarray(4),[],i+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"bvc2":return e.bvc2(t);case"mp4a":return e.mp4a(t);case"alaw":case"ulaw":return e.alaw(t);case"enca":return Ra(t,!1,(function(t,n,i){t.channelCount=sa(n,16),t.samplesize=sa(n,18),t.sampleRate=aa(n,24)/65536,n=n.subarray(28),t.sinf=e.sinf(e.findBox(n,["sinf"],i)[0]),t.esds=e.esds(e.findBox(n,["esds"],i)[0])}));case"encv":return Ra(t,!1,(function(t,n,i){t.width=sa(n,24),t.height=sa(n,26),t.horizresolution=aa(n,28),t.vertresolution=aa(n,32),n=n.subarray(78),t.sinf=e.sinf(e.findBox(n,["sinf"],i)[0]),t.avcC=e.avcC(e.findBox(n,["avcC"],i)[0]),t.hvcC=e.hvcC(e.findBox(n,["hvcC"],i)[0]),t.pasp=e.pasp(e.findBox(n,["pasp"],i)[0])}))}})).filter(Boolean)}))}},{key:"tenc",value:function(e){return Ra(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 i=0;i<16;i++)e.default_KID.push(xa(t[n])),n+=1}))}},{key:"schi",value:function(t){return Ra(t,!1,(function(t,n,i){t.tenc=e.tenc(e.findBox(n,["tenc"],i)[0])}))}},{key:"sinf",value:function(t){return Ra(t,!1,(function(t,n,i){t.schi=e.schi(e.findBox(n,["schi"],i)[0]),t.frma=e.frma(e.findBox(n,["frma"],i)[0])}))}},{key:"frma",value:function(e){return Ra(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 Ra(e,!1,(function(t,n){var i=Pa.fromUint8(n);t.data=e.data,t.colorType=i.readString(4),"nclx"===t.colorType?(t.colorPrimaries=i.read(2),t.transferCharacteristics=i.read(2),t.matrixCoefficients=i.read(2),t.fullRangeFlag=i.read(1)>>7):"rICC"!==t.colorType&&"prof"!==t.colorType||(t.iccProfile=n.readToUint8())}))}},{key:"av01",value:function(t){return Ra(t,!1,(function(t,n,i){var r=ka(t,n),s=n.subarray(r);i+=r,t.av1C=e.av1C(e.findBox(s,["av1C"],i)[0]),t.colr=e.colr(e.findBox(s,["colr"],i)[0])}))}},{key:"av1C",value:function(e){return Ra(e,!1,(function(t,n){t.data=e.data;var i,r=Pa.fromUint8(n),s=Ma.fromByte(r,4);t.marker=s.read(1),t.version=s.read(7),t.seqProfile=s.read(3),t.seqLevelIdx0=s.read(5),t.seqTier0=s.read(1),t.highBitdepth=s.read(1),t.twelveBit=s.read(1),t.monochrome=s.read(1),t.chromaSubsamplingX=s.read(1),t.chromaSubsamplingY=s.read(1),t.chromaSamplePosition=s.read(2),t.reserved=s.read(3),t.initialPresentationDelayPresent=s.read(1),t.initialPresentationDelayPresent?t.initialPresentationDelayMinusOne=s.read(4):t.initialPresentationDelayMinusOne=0,t.configOBUs=r.readToUint8(),2===t.seqLevelIdx0&&1===t.highBitdepth?i=1===t.twelveBit?"12":"10":t.seqProfile<=2&&(i=1===t.highBitdepth?"10":"08"),t.codec=["av01",t.seqProfile,(t.seqLevelIdx0<10?"0"+t.seqLevelIdx0:t.seqLevelIdx0)+(t.seqTier0?"H":"M"),i].join(".")}))}},{key:"avc1",value:function(t){return Ra(t,!1,(function(t,n,i){var r=ka(t,n),s=n.subarray(r);i+=r,t.avcC=e.avcC(e.findBox(s,["avcC"],i)[0]),t.pasp=e.pasp(e.findBox(s,["pasp"],i)[0])}))}},{key:"avcC",value:function(e){return Ra(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=function(e){for(var t,n="avc1.",i=0;i<3;i++)(t=e[i].toString(16)).length<2&&(t="0".concat(t)),n+=t;return n}([n[1],n[2],n[3]]),t.lengthSizeMinusOne=3&n[4],t.spsLength=31&n[5],t.sps=[];for(var i=6,r=0;r>6,t.generalTierFlag=(32&i)>>5,t.generalProfileIdc=31&i,t.generalProfileCompatibility=aa(n,2),t.generalConstraintIndicatorFlags=n.subarray(6,12),t.generalLevelIdc=n[12],t.avgFrameRate=sa(n,19),t.numOfArrays=n[22],t.vps=[],t.sps=[],t.pps=[];for(var r=23,s=0,a=0,o=0,l=0;l>3;return 31===o&&a.length>=2&&(o=32+((7&a[0])<<3)+((224&a[1])>>5)),e.objectType=o,e.codec+=o.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[n].toString(16)+".").padStart(3,"0"),t=t.subarray(n+13)}}}))}},{key:"alaw",value:function(e){return Ra(e,!1,(function(e,t){Da(e,t)}))}},{key:"stts",value:function(e){return Ra(e,!0,(function(e,t){for(var n=aa(t),i=[],r=4,s=0;sa&&1&i&&(e.dataOffset=-(1+~aa(t,a)),a+=4),r>a&&4&i&&(e.firstSampleFlags=aa(t,a),a+=4),r>a){var o;e.samples=new Array(s);for(var l=0;l>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}},{key:"moovToTrack",value:function(e,t,n){var i,r,s=e.trak;if(s&&s.length){var a=s.find((function(e){var t;return"vide"===(null===(t=e.mdia)||void 0===t||null===(t=t.hdlr)||void 0===t?void 0:t.handlerType)})),o=s.find((function(e){var t;return"soun"===(null===(t=e.mdia)||void 0===t||null===(t=t.hdlr)||void 0===t?void 0:t.handlerType)}));if(a&&t){var l,c,u,d,h=t;null!=(null===(l=a.tkhd)||void 0===l?void 0:l.trackId)&&(h.id=a.tkhd.trackId),h.tkhdDuration=a.tkhd.duration,h.mvhdDurtion=e.mvhd.duration,h.mvhdTimecale=e.mvhd.timescale,h.timescale=h.formatTimescale=a.mdia.mdhd.timescale,h.duration=a.mdia.mdhd.duration||h.mvhdDurtion/h.mvhdTimecale*h.timescale,h.rotation=a.tkhd.rotation,h.matrix=a.tkhd.matrix,null!==(c=a.edts)&&void 0!==c&&c.elst&&(h.editList=a.edts.elst,h.editListApplied=a.editListApplied);var p,f,g,m,v=a.mdia.minf.stbl.stsd.entries[0];if(h.width=v.width,h.height=v.height,v.pasp&&(h.sarRatio=[v.pasp.hSpacing,v.pasp.vSpacing]),v.av1C)h.codecType="av1",h.codec=v.av1C.codec,h.av1C=v.av1C.data,h.colr=v.colr.data;else if(v.hvcC)h.codecType=ba,h.codec=v.hvcC.codec,h.vps=v.hvcC.vps,h.sps=v.hvcC.sps,h.pps=v.hvcC.pps,h.hvcC=v.hvcC.data;else if(v.avcC)h.codec=v.avcC.codec,h.sps=v.avcC.sps,h.pps=v.avcC.pps;else{if(!v.vvcC)throw new Error("unknown video stsd entry");h.codecType=Sa,h.codec=v.vvcC.codec,h.sps=v.vvcC.sps,h.pps=v.vvcC.pps,h.vps=v.vvcC.vps,h.vvcC=v.vvcC.data}h.present=!0,h.ext={},h.ext.stss=null===(u=a.mdia)||void 0===u||null===(u=u.minf)||void 0===u||null===(u=u.stbl)||void 0===u?void 0:u.stss,h.ext.ctts=null===(d=a.mdia)||void 0===d||null===(d=d.minf)||void 0===d||null===(d=d.stbl)||void 0===d?void 0:d.ctts,v&&"encv"===v.type&&(h.isVideoEncryption=!0,v.default_KID=null===(p=v.sinf)||void 0===p||null===(p=p.schi)||void 0===p?void 0:p.tenc.default_KID,v.default_IsEncrypted=null===(f=v.sinf)||void 0===f||null===(f=f.schi)||void 0===f?void 0:f.tenc.default_IsEncrypted,v.default_IV_size=null===(g=v.sinf)||void 0===g||null===(g=g.schi)||void 0===g?void 0:g.tenc.default_IV_size,h.videoSenc=a.mdia.minf.stbl.senc&&a.mdia.minf.stbl.senc.samples,v.data_format=null===(m=v.sinf)||void 0===m||null===(m=m.frma)||void 0===m?void 0:m.data_format,h.useEME=e.useEME,h.kidValue=e.kidValue,h.pssh=e.pssh,h.encv=v)}if(o&&n){var y,_,T,b,S,P,M=n;null!=(null===(y=o.tkhd)||void 0===y?void 0:y.trackId)&&(M.id=o.tkhd.trackId),M.tkhdDuration=o.tkhd.duration,M.mvhdDurtion=e.mvhd.duration,M.mvhdTimecale=e.mvhd.timescale,M.timescale=M.formatTimescale=o.mdia.mdhd.timescale,M.duration=o.mdia.mdhd.duration||M.mvhdDurtion/M.mvhdTimecale*M.timescale,null!==(_=o.edts)&&void 0!==_&&_.elst&&(M.editList=o.edts.elst,M.editListApplied=o.editListApplied);var w,E,k,D,R=o.mdia.minf.stbl.stsd.entries[0];switch(M.sampleSize=R.sampleSize,M.sampleRate=R.sampleRate,M.channelCount=R.channelCount,M.present=!0,R.type){case"alaw":M.codecType=M.codec="g7110a",M.sampleRate=8e3;break;case"ulaw":M.codecType=M.codec="g7110m",M.sampleRate=8e3;break;default:M.sampleDuration=ma.getFrameDuration(M.sampleRate,M.timescale),M.sampleRateIndex=ma.getRateIndexByRate(M.sampleRate),M.objectType=(null===(i=R.esds)||void 0===i?void 0:i.objectType)||2,R.esds&&(M.config=Array.from(R.esds.config)),M.codec=(null===(r=R.esds)||void 0===r?void 0:r.codec)||"mp4a.40.2"}M.sampleDuration=ma.getFrameDuration(M.sampleRate,M.timescale),M.objectType=(null===(T=R.esds)||void 0===T?void 0:T.objectType)||2,R.esds&&(R.esds.config?M.config=Array.from(R.esds.config):console.warn("esds config is null")),M.codec=(null===(b=R.esds)||void 0===b?void 0:b.codec)||"mp4a.40.2",M.sampleRateIndex=ma.getRateIndexByRate(M.sampleRate),M.ext={},M.ext.stss=null===(S=o.mdia)||void 0===S||null===(S=S.minf)||void 0===S||null===(S=S.stbl)||void 0===S?void 0:S.stss,M.ext.ctts=null===(P=o.mdia)||void 0===P||null===(P=P.minf)||void 0===P||null===(P=P.stbl)||void 0===P?void 0:P.ctts,M.present=!0,R&&"enca"===R.type&&(M.isAudioEncryption=!0,R.data_format=null===(w=R.sinf)||void 0===w||null===(w=w.frma)||void 0===w?void 0:w.data_format,R.default_KID=null===(E=R.sinf)||void 0===E||null===(E=E.schi)||void 0===E?void 0:E.tenc.default_KID,R.default_IsEncrypted=null===(k=R.sinf)||void 0===k||null===(k=k.schi)||void 0===k?void 0:k.tenc.default_IsEncrypted,R.default_IV_size=null===(D=R.sinf)||void 0===D||null===(D=D.schi)||void 0===D?void 0:D.tenc.default_IV_size,M.audioSenc=o.mdia.minf.stbl.senc&&o.mdia.minf.stbl.senc.samples,M.useEME=e.useEME,M.kidValue=e.kidValue,M.enca=R)}if(n&&(n.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!n&&n.isAudioEncryption),null!=t&&t.encv||null!=n&&n.enca){var x,C,I=null==t||null===(x=t.encv)||void 0===x?void 0:x.default_KID,L=null==n||null===(C=n.enca)||void 0===C?void 0:C.default_KID,O=I||L?(I||L).join(""):null;t&&(t.kid=O),n&&(n.kid=O)}return t&&(t.flags=3841),n&&(n.flags=1793),{videoTrack:t,audioTrack:n}}}},{key:"evaluateDefaultDuration",value:function(e,t,n){var i,r=null==t||null===(i=t.samples)||void 0===i?void 0:i.length;return r?1024*r/t.timescale*e.timescale/n:1024}},{key:"moofToSamples",value:function(t,n,i){var r={};return t.mfhd&&(n&&(n.sequenceNumber=t.mfhd.sequenceNumber),i&&(i.sequenceNumber=t.mfhd.sequenceNumber)),t.traf.forEach((function(t){var s=t.tfhd,a=t.tfdt,o=t.trun;if(s&&o){a&&(n&&n.id===s.trackId&&(n.baseMediaDecodeTime=a.baseMediaDecodeTime),i&&i.id===s.trackId&&(i.baseMediaDecodeTime=a.baseMediaDecodeTime));var l=s.defaultSampleSize||0,c=s.defaultSampleDuration||e.evaluateDefaultDuration(n,i,o.samples.length||o.sampleCount),u=o.dataOffset||0,d=0,h=-1;if(!o.samples.length&&o.sampleCount){r[s.trackId]=new Array(o.sampleCount);for(var p=0;p>>0!=65536}).keyframe&&(h++,e.gopId=h),d+=e.duration,u+=e.size,e}))}})),r}},{key:"moovToSamples",value:function(e){var t=e.trak;if(t&&t.length){var n=t.find((function(e){var t;return"vide"===(null===(t=e.mdia)||void 0===t||null===(t=t.hdlr)||void 0===t?void 0:t.handlerType)})),i=t.find((function(e){var t;return"soun"===(null===(t=e.mdia)||void 0===t||null===(t=t.hdlr)||void 0===t?void 0:t.handlerType)}));if(n||i){var r,s;if(n){var a,o=null===(a=n.mdia)||void 0===a||null===(a=a.minf)||void 0===a?void 0:a.stbl;if(!o)return;var l=o.stts,c=o.stsc,u=o.stsz,d=o.stco,h=o.stss,p=o.ctts;if(!(l&&c&&u&&d&&h))return;r=Ea(l,c,u,d,p,h)}if(i){var f,g,m=null===(f=i.mdia)||void 0===f||null===(f=f.minf)||void 0===f?void 0:f.stbl;if(!m)return;var v=null===(g=i.mdia.mdhd)||void 0===g?void 0:g.timescale,y=m.stts,_=m.stsc,T=m.stsz,b=m.stco;if(!(v&&y&&_&&T&&b))return;s=Ea(y,_,T,b)}return{videoSamples:r,audioSamples:s}}}}}])}();function Ea(e,t,n,i,r,s){var a,o,l,c=[],u=null==r?void 0:r.entries,d=t.entries,h=i.entries,p=n.entrySizes,f=null==s?void 0:s.entries;f&&(a={},f.forEach((function(e){a[e-1]=!0}))),u&&(o=[],u.forEach((function(e){for(var t=e.count,n=e.offset,i=0;i=S&&(_++,S=d[_+1]?d[_+1].firstChunk-1:1/0),b+=d[_].samplesPerChunk)})),c}function ka(e,t){return e.dataReferenceIndex=sa(t,6),e.width=sa(t,24),e.height=sa(t,26),e.horizresolution=aa(t,28),e.vertresolution=aa(t,32),e.frameCount=sa(t,40),e.depth=sa(t,74),78}function Da(e,t){return e.dataReferenceIndex=sa(t,6),e.channelCount=sa(t,16),e.sampleSize=sa(t,18),e.sampleRate=aa(t,24)/65536,28}function Ra(e,t,n){if(e){if(e.size!==e.data.length)throw new Error("box ".concat(e.type," size !== data.length"));var i={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(i.version=e.data[e.headerSize],i.flags=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),i.headerSize+=4),n(i,e.data.subarray(i.headerSize),i.start+i.headerSize),i}}var xa=function(){for(var e=[],t=arguments.length,n=new Array(t),i=0;ithis.maxPts&&(this.maxPts=t)}}])}();function Oa(e,t){var n=e.trak;if(n&&n.length){var i=n.find((function(e){var t;return"vide"===(null===(t=e.mdia)||void 0===t||null===(t=t.hdlr)||void 0===t?void 0:t.handlerType)})),r=n.find((function(e){var t;return"soun"===(null===(t=e.mdia)||void 0===t||null===(t=t.hdlr)||void 0===t?void 0:t.handlerType)}));if(i||r){var s=[],a=[];if(t){var o=[],l=0,c=t.start+t.size;t.references.forEach((function(e,n){o.push({index:n,startTime:l,endTime:l+e.subsegment_duration/t.timescale,duration:e.subsegment_duration/t.timescale,range:[c,c+e.referenced_size],frames:[]}),l+=e.subsegment_duration/t.timescale,c+=e.referenced_size})),s=o,a=o}else{var u,d,h=function(t){return t?[{index:0,startTime:0,endTime:t.duration/t.timescale,duration:t.duration/t.timescale,range:[e.start+e.size,""],frames:[]}]:[]};a=h(e.mvhd.duration?e.mvhd:null===(u=i.mdia)||void 0===u?void 0:u.mdhd),s=h(e.mvhd.duration?e.mvhd:null===(d=r.mdia)||void 0===d?void 0:d.mdhd)}return{videoSegments:a,audioSegments:s}}}}function Aa(e,t){var n=t.segmentDuration,i=e.trak;if(i&&i.length){var r=i.find((function(e){var t;return"vide"===(null===(t=e.mdia)||void 0===t||null===(t=t.hdlr)||void 0===t?void 0:t.handlerType)})),s=i.find((function(e){var t;return"soun"===(null===(t=e.mdia)||void 0===t||null===(t=t.hdlr)||void 0===t?void 0:t.handlerType)}));if(r||s){var a,o=[],l=[];return r&&(a=(o=Ga("video",r,n,t)).map((function(e){return e.duration}))),s&&(l=Ga("audio",s,n,t,a,o)),{videoSegments:o,audioSegments:l}}}}function Ga(e,t,n,i){var r,s,a,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],l=arguments.length>5?arguments[5]:void 0,c=i.fixEditListOffset,u=i.fixEditListOffsetThreshold,d=i.audioGroupingStrategy,h=i.memoryOpt,p=null===(r=t.mdia)||void 0===r||null===(r=r.minf)||void 0===r?void 0:r.stbl;if(!p)return[];var f=null===(s=t.mdia.mdhd)||void 0===s?void 0:s.timescale,g=p.stts,m=p.stsc,v=p.stsz,y=p.stco,_=p.stss,T=p.ctts;if(!(f&&g&&m&&v&&y)||"video"===e&&!_)return[];var b=0,S=null===(a=t.edts)||void 0===a||null===(a=a.elst)||void 0===a?void 0:a.entries;if(c&&function(){var e=!0,t=navigator.userAgent||"";if(/Chrome/gi.test(t)&&!/Edge\//gi.test(t)){var n=t.match(/Chrome\/(\d+)/i),i=n?parseInt(n[1],10):0;e=!!i&&i>=75}return e}()&&Array.isArray(S)&&S.length>0){var P=S[0].media_time;P>0&&P<(u?u*f:5*f)&&(b=P)}var M,w,E=[],k=[],D=[],R=[],x=[],C=m.entries,I=y.entries,L=v.entrySizes,O=null==_?void 0:_.entries,A=null==T?void 0:T.entries,G=[],$={};h||(A&&A.forEach((function(e){for(var t=e.count,n=e.offset,i=0;i0?C[0].samplesPerChunk:0,j=C.length>1&&C[1]?C[1].firstChunk-1:1/0,z=0,X=-1,K=!1,W={};(null==A?void 0:A.length)>0&&b>0&&(z-=b,K=!0),t.editListApplied=K,h&&(N=null==O?void 0:O.shift()),g.entries.forEach((function(e){var t=e.count,n=e.delta;w=n;for(var i=0;i0&&void 0!==x[k.length-1]){var s,a=null===(s=E[x[k.length-1]])||void 0===s?void 0:s.pts;void 0!==a&&M.pts>a&&(x[k.length-1]=M.index)}E[E.length]=M,z+=n,++B=j&&(U++,j=C[U+1]?C[U+1].firstChunk-1:1/0),V+=C[U].samplesPerChunk)}}));var Q=E.length;if(!Q||_&&!E[0].keyframe)return[];var q,Y,J=[],Z=[],ee=0,te=0,ne=0,ie=0,re=function(e,t,n){q=Z[Z.length-1],h?(ne=(null==k?void 0:k.length)>0?k[t].minPts:Z[0].pts,ie=(null==k?void 0:k.length)>0?k[n].maxPts:q.pts+q.duration):(ne=R[t],Y=E[x[n]],ie=Y.pts+Y.duration),0===J.length&&(e=(ie-ne)/f),J.push({index:J.length,startTime:ne/f,endTime:ie/f,duration:e,range:[Z[0].offset,q.offset+q.size-1],frames:Z}),1!==d&&(ee=0),Z=[]},se=0;if(_)for(var ae=n*f,oe=0,le=k.length;oeae)&&(re(ee/f,se,oe),ee=0,se=oe+1):(re(ee/f,se,oe),ee=0,se=oe+1)}else{h||(R=[],x=[]);var de=o[0]||n;if(1===d)for(var he,pe=0;pel[J.length].endTime:he-Z[0].pts/f>=de))&&(h||(R.push(Z[0].pts),x.push(Z[Z.length-1].index)),re(ve,J.length,J.length),de=o[J.length]||n)}else for(var ye,_e=0;_e=de)&&(te+=2===d?ee/f-de:ye-de,h||(R.push(Z[0].pts),x.push(Z[Z.length-1].index)),re(Pe,J.length,J.length),de=o[J.length]||n)}}return J}function $a(e,t,n){n.offset=0;var i=(null==n?void 0:n.beforeFrameNum)||0,r=(null==n?void 0:n.usedCttsIdx)||0;if(!e||(null==e?void 0:e.length)<=0||(null==n?void 0:n.usedCttsIdx)>=e.length)n.offset=0,n.usedCttsIdx=r,n.beforeFrameNum=i;else{var s=e[r];if(t=((null===(t=this.videoSegments[this.videoSegments.length-1])||void 0===t?void 0:t.index)||(null===(n=this.audioSegments[this.audioSegments.length-1])||void 0===n?void 0:n.index)||0)}},{key:"isSegmentLoading",value:function(e){return e===this._currentLoadingSegmentIndex}},{key:"changeUrl",value:(h=ds(Ss().mark((function e(t){var n,i,r,s=arguments;return Ss().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:t,i=s.length>2?s[2]:void 0,r=s.length>3?s[3]:void 0,e.next=5,this.reset(r);case 5:t&&(this.url=t),n&&(this.vid=n),i&&(this._config.moovEnd=i);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getOrLoadMeta",value:(d=ds(Ss().mark((function e(t){return Ss().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMetaLoaded){e.next=3;break}return e.next=3,this.loadMeta(t);case 3:return e.abrupt("return",this.meta);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"newBufferArray",value:function(e,t){var n;if(this.buffer){if(t||(null===(n=this.buffer)||void 0===n?void 0:n.byteLength)3&&void 0!==d[3]?d[3]:{},this._error=!1,this.logger.debug("[loadMetaProcess start], range,",[a,o]),null!==(r=this._config)&&void 0!==r&&r.memoryOpt&&(!this.buffer||null!=l&&l.isExp))try{this.newBufferArray(o-a+1,null==l?void 0:l.isExp)}catch(p){i(null,!0,{},new Ca(null==p?void 0:p.message),{})}return c=function(){var e=ds(Ss().mark((function e(n,r,s,c){var d,h,p,f,g,m,v,y,_,T,b,S,P,M,w,E;return Ss().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u.meta&&null!=s&&s.range&&s.range.length>0&&s.range[1]>=o&&(r=!0,u.logger.debug("[loadMetaProcess],data done,setstate true,[",a,o,"]")),r&&null!=s&&s.range&&s.range.length>0&&s.range[1]0&&i(n,r,s,null,c),!u.meta.moov&&!u._error){e.next=6;break}return e.abrupt("return");case 6:if(!(n&&n.byteLength>0)){e.next=59;break}e.prev=7,null!==(h=u._config)&&void 0!==h&&h.memoryOpt?(u.buffer.set(n,u.bufferDataLen),u.bufferDataLen+=(null==n?void 0:n.byteLength)||0,d=u.buffer.subarray(0,u.bufferDataLen)):(u.buffer=zs(u.buffer,n),d=u.buffer),e.next=15;break;case 11:return e.prev=11,e.t0=e.catch(7),i(null,r,s,new Ca(null===e.t0||void 0===e.t0?void 0:e.t0.message),c),e.abrupt("return");case 15:if(p=wa.findBox(d,["moov"])[0]){e.next=30;break}if(f=wa.findBox(d,["mdat"])[0],!r){e.next=30;break}if(f){e.next=25;break}return u._error=!0,i(null,r,s,new Ca("cannot find moov or mdat box"),c),e.abrupt("return");case 25:return g=f.start+f.size,e.next=28,u.loadData([g,""],t,l);case 28:(m=e.sent)&&(p=wa.findBox(m.data,["moov"])[0]);case 30:if(!(p&&r&&p.size>p.data.length)){e.next=34;break}return u.logger.debug("[loadMetaProcess],moov not all, range,",s.range[1],",dataLen,",u.bufferDataLen,", state,",r),e.next=34,u.loadMetaProcess(t,[s.range[1],p.start+p.size-1],i,{isExp:!0});case 34:if(!(p&&p.size<=p.data.length)||u.meta.moov){e.next=59;break}if(y=wa.moov(p)){e.next=40;break}return u._error=!0,i(null,r,s,new Ca("cannot parse moov box"),c),e.abrupt("return");case 40:if(_=Aa(y,u._config),T=function(){var e=ds(Ss().mark((function e(n){var i,r;return Ss().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=wa.findBox(u.buffer,[n])[0])){e.next=11;break}if(!(i.size>i.data.length)){e.next=10;break}return e.next=5,u.loadData([i.start,i.start+i.size-1],t,l);case 5:if(!(r=e.sent)){e.next=8;break}return e.abrupt("return",wa.findBox(r.data,[n])[0]);case 8:e.next=11;break;case 10:return e.abrupt("return",i);case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),b=!1,_&&_.videoSegments.length&&_.audioSegments.length){e.next=48;break}return e.next=46,T("sidx");case 46:(S=e.sent)&&(P=wa.sidx(S))&&(Oa(y,P),bs("segments"),b=!0);case 48:if(Fa(_)){e.next=52;break}return u._error=!0,i(null,r,s,new Ca("cannot parse segments"),c),e.abrupt("return");case 52:u.meta=Na(y,b),w=(M=_).videoSegments,E=M.audioSegments,u.videoSegments=w,u.audioSegments=E,null!==(v=u._config)&&void 0!==v&&v.memoryOpt&&(delete u.buffer,u.bufferDataLen=0),u.logger.debug("[loadMetaProcess] moov ok"),i(void 0,r,{meta:{meta:u.meta,videoSegments:w,audioSegments:E}},null,c);case 59:case"end":return e.stop()}}),e,null,[[7,11]])})));return function(t,n,i,r){return e.apply(this,arguments)}}(),e.next=8,this.loadData([a,o||this._config.moovEnd],t,Ts({onProgress:c},l));case 8:case"end":return e.stop()}var h,p}),e,this)}))),function(e,t,n){return u.apply(this,arguments)})},{key:"loadMeta",value:(c=ds(Ss().mark((function e(t,n){var i,r,s,a,o,l,c,u,d,h,p,f,g,m,v,y=arguments;return Ss().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=y.length>2&&void 0!==y[2]?y[2]:{},r=[],this.logger.debug("[loadMeta start]"),e.next=5,this.loadData([0,n||this._config.moovEnd],t,i);case 5:if(s=e.sent){e.next=8;break}return e.abrupt("return");case 8:if(r.push(s),a=wa.findBox(s.data,["moov"])[0]){e.next=24;break}if(o=wa.findBox(s.data,["mdat"])[0]){e.next=14;break}throw new Ca("cannot find moov or mdat box",s.data);case 14:return l=o.start+o.size,e.next=17,this.loadData([l],t,i);case 17:if(s=e.sent){e.next=20;break}return e.abrupt("return");case 20:if(r.push(s),a=wa.findBox(s.data,["moov"],l)[0]){e.next=24;break}throw new Ca("cannot find moov box",s.data);case 24:if(!(a.size>a.data.length)){e.next=32;break}return e.next=27,this.loadData([s.data.length,a.start+a.size-1],t,i);case 27:if(s=e.sent){e.next=30;break}return e.abrupt("return");case 30:r.push(s),a.data=zs(a.data,s.data);case 32:if(c=wa.moov(a)){e.next=35;break}throw new Ca("cannot parse moov box",a.data);case 35:if(Fa(u=Aa(c,this._config))){e.next=38;break}throw new Ca("cannot parse segments",a.data);case 38:return u.videoSegments.length&&u.audioSegments.length||(h=wa.findBox(this.buffer,["moof"])[0],p=wa.findBox(this.buffer,["sidx"])[0],h&&h.size<=h.data.length&&p&&(f=wa.moof(h),d=wa.sidx(p),f&&d&&(Oa(c,d),bs("segments")))),this.meta=Na(c,d),m=(g=u).videoSegments,v=g.audioSegments,this.videoSegments=m,this.audioSegments=v,delete this.buffer,this.bufferDataLen=0,this.logger.debug("[load moov end!!!!!]"),e.abrupt("return",{meta:this.meta,videoSegments:m,audioSegments:v,responses:r});case 47:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"loadCacheMeta",value:function(e,t){var n=Aa(e.moov,this._config),i=n.videoSegments,r=n.audioSegments;this.videoSegments=i,this.audioSegments=r,this._currentSegmentIndex=t,this.meta=e}},{key:"getSegmentByTime",value:function(e){var t,n;return this.videoSegments.length?(t=this.videoSegments.find((function(t){return t.startTime<=e&&t.endTime>e})),t&&(n=this.audioSegments[t.index])):n=this.audioSegments.find((function(t){return t.startTime<=e&&t.endTime>e})),{video:t,audio:n}}},{key:"loadSegmentByTime",value:(l=ds(Ss().mark((function e(t,n){var i,r,s,a,o,l=arguments;return Ss().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=!(l.length>2&&void 0!==l[2])||l[2],r=l.length>3&&void 0!==l[3]?l[3]:{},this.isMetaLoaded){e.next=5;break}return e.next=5,this.loadMeta(n);case 5:return s=this.getSegmentByTime(t),a=s.video,o=s.audio,e.abrupt("return",this._loadSegment(a,o,n,i,r));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"loadNextSegment",value:(o=ds(Ss().mark((function e(t){var n,i,r,s,a=arguments;return Ss().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(a.length>1&&void 0!==a[1])||a[1],i=a.length>2&&void 0!==a[2]?a[2]:{},this.isMetaLoaded){e.next=5;break}return e.next=5,this.loadMeta();case 5:return r=this.videoSegments[this._currentSegmentIndex+1],s=this.audioSegments[this._currentSegmentIndex+1],e.abrupt("return",this._loadSegment(r,s,t,n,i));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"preload",value:(a=ds(Ss().mark((function e(t){var n,i,r,s,a,o,l,c=this;return Ss().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMetaLoaded){e.next=3;break}return e.next=3,this.loadMeta(!0);case 3:if(t&&!(t<0)){e.next=5;break}return e.abrupt("return");case 5:if(n=this.getSegmentByTime(t),i=n.video,r=n.audio,s=Math.max((null==i?void 0:i.index)||0,(null==r?void 0:r.index)||0)){e.next=9;break}return e.abrupt("return");case 9:return a=this.videoSegments.slice(0,s),o=this.audioSegments.slice(0,s),l=function(){var e=ds(Ss().mark((function e(t){return Ss().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t>s)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,c._loadSegment(a[t],o[t],!0,!1);case 4:return e.next=6,l(t+1);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e.next=14,l(0);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"cancel",value:function(){return this._loader.cancel()}},{key:"reset",value:(s=ds(Ss().mark((function e(){var t,n=arguments;return Ss().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.length>0&&void 0!==n[0]&&n[0]){e.next=5;break}return this.logger.debug("[MP4loader reset func call loader.cancel]"),e.next=5,this._loader.cancel();case 5:this.vid=this.url="",this.meta={},this.downloadInfo=[],this.videoSegments=[],this.audioSegments=[],this._currentSegmentIndex=-1,this._currentLoadingSegmentIndex=-1,null!==(t=this._config)&&void 0!==t&&t.memoryOpt&&(delete this.buffer,this.bufferDataLen=0);case 13:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"destroy",value:(r=ds(Ss().mark((function e(){return Ss().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.reset();case 2:this.cache.clear();case 3:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_loadSegment",value:(i=ds(Ss().mark((function e(t,n,i,r,s){var a,o;return Ss().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t||n){e.next=2;break}return e.abrupt("return");case 2:return a=(null==t?void 0:t.index)||(null==n?void 0:n.index)||0,this._currentLoadingSegmentIndex=a,e.prev=4,e.next=7,this.loadData([Math.min((null==t?void 0:t.range[0])||1/0,(null==n?void 0:n.range[0])||1/0),Math.max((null==t?void 0:t.range[1])||0,(null==n?void 0:n.range[1])||0)],i,s);case 7:o=e.sent;case 8:return e.prev=8,this._currentLoadingSegmentIndex=-1,e.finish(8);case 11:if(o){e.next=13;break}return e.abrupt("return");case 13:return r&&(this._currentSegmentIndex=a),o.video=t,o.audio=n,e.abrupt("return",o);case 17:case"end":return e.stop()}}),e,this,[[4,,8,11]])}))),function(e,t,n,r,s){return i.apply(this,arguments)})},{key:"loadData",value:(n=ds(Ss().mark((function e(t,n){var i,r,s,a,o,l=arguments;return Ss().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=l.length>2&&void 0!==l[2]?l[2]:{},r=this._getCacheKey(t),e.next=4,this.cache.get(r);case 4:if(s=e.sent){e.next=12;break}return o=null!=i&&i.url?i.url:this.url,e.next=9,this._loader.load(o,Ts({range:t,vid:this.vid},i));case 9:a=e.sent,e.next=13;break;case 12:a={data:s,state:!0,options:{fromCache:!0,range:t,vid:this.vid}};case 13:if(a){e.next=15;break}return e.abrupt("return");case 15:return s||(a.data&&this.downloadInfo.push({startTime:a.startTime,endTime:a.endTime,size:a.data.byteLength,range:t}),this.downloadInfo&&this.downloadInfo.length>this._config.maxDownloadInfoSize&&(this.downloadInfo=this.downloadInfo.slice(-this._config.maxDownloadInfoSize))),e.abrupt("return",a);case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"_getCacheKey",value:function(e){return(this.vid||this.url)+":"+e}}]);var n,i,r,s,a,o,l,c,u,d,h}(z()),Va=function(){return Js((function e(){qs(this,e),Zs(this,"id",1),Zs(this,"type",Ta),Zs(this,"codecType","avc"),Zs(this,"pid",-1),Zs(this,"hvcC",void 0),Zs(this,"codec",""),Zs(this,"timescale",0),Zs(this,"formatTimescale",0),Zs(this,"sequenceNumber",0),Zs(this,"baseMediaDecodeTime",0),Zs(this,"baseDts",0),Zs(this,"duration",0),Zs(this,"warnings",[]),Zs(this,"samples",[]),Zs(this,"pps",[]),Zs(this,"sps",[]),Zs(this,"vps",[]),Zs(this,"fpsNum",0),Zs(this,"fpsDen",0),Zs(this,"sarRatio",[]),Zs(this,"width",0),Zs(this,"height",0),Zs(this,"nalUnitSize",4),Zs(this,"present",!1),Zs(this,"isVideoEncryption",!1),Zs(this,"isAudioEncryption",!1),Zs(this,"isVideo",!0),Zs(this,"kid",null),Zs(this,"pssh",null),Zs(this,"ext",void 0)}),[{key:"reset",value:function(){this.sequenceNumber=this.width=this.height=this.fpsDen=this.fpsNum=this.duration=this.baseMediaDecodeTime=this.timescale=0,this.codec="",this.present=!1,this.pid=-1,this.pps=[],this.sps=[],this.vps=[],this.sarRatio=[],this.samples=[],this.warnings=[],this.hvcC=null}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var e=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-e.dts+t.duration}return 0}},{key:"exist",value:function(){return!!/av01/.test(this.codec)||!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isVideoEncryption}}])}(),ja=function(){return Js((function e(){qs(this,e),Zs(this,"id",2),Zs(this,"type","audio"),Zs(this,"codecType","aac"),Zs(this,"pid",-1),Zs(this,"codec",""),Zs(this,"sequenceNumber",0),Zs(this,"sampleDuration",0),Zs(this,"timescale",0),Zs(this,"formatTimescale",0),Zs(this,"baseMediaDecodeTime",0),Zs(this,"duration",0),Zs(this,"warnings",[]),Zs(this,"samples",[]),Zs(this,"baseDts",0),Zs(this,"sampleSize",16),Zs(this,"sampleRate",0),Zs(this,"channelCount",0),Zs(this,"objectType",0),Zs(this,"sampleRateIndex",0),Zs(this,"config",[]),Zs(this,"present",!1),Zs(this,"isVideoEncryption",!1),Zs(this,"isAudioEncryption",!1),Zs(this,"kid",null),Zs(this,"isHeAACExt",!1),Zs(this,"ext",void 0)}),[{key:"reset",value:function(){this.sequenceNumber=0,this.timescale=0,this.sampleDuration=0,this.sampleRate=0,this.channelCount=0,this.baseMediaDecodeTime=0,this.present=!1,this.isHeAACExt=!1,this.pid=-1,this.codec="",this.samples=[],this.config=[],this.warnings=[]}},{key:"exist",value:function(){return!!(this.sampleRate&&this.channelCount&&this.codec&&"aac"===this.codecType)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}},{key:"firstDts",get:function(){return this.samples.length?this.samples[0].dts:null}},{key:"firstPts",get:function(){return this.samples.length?this.samples[0].pts:null}},{key:"samplesDuration",get:function(){if(this.samples.length>0){var e=this.samples[0],t=this.samples[this.samples.length-1];return t.dts-e.dts+t.duration}return 0}}])}(),za=function(){return Js((function e(t,n,i){qs(this,e),Zs(this,"flag",{}),Zs(this,"keyframe",!1),Zs(this,"gopId",0),Zs(this,"duration",0),Zs(this,"size",0),Zs(this,"units",[]),Zs(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=n,i&&(this.units=i)}),[{key:"cts",get:function(){return this.pts-this.dts}},{key:"setToKeyframe",value:function(){this.keyframe=!0,this.flag.dependsOn=2,this.flag.isNonSyncSample=0}}])}(),Xa=Js((function e(t,n,i,r){qs(this,e),Zs(this,"duration",1024),Zs(this,"flag",{dependsOn:2,isNonSyncSample:0}),Zs(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=n,this.size=n.byteLength,this.sampleOffset=r,i&&(this.duration=i)})),Ka=function(){return Js((function e(){qs(this,e),Zs(this,"id",3),Zs(this,"type","metadata"),Zs(this,"timescale",0),Zs(this,"flvScriptSamples",[]),Zs(this,"seiSamples",[])}),[{key:"exist",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length||!this.timescale)}},{key:"reset",value:function(){this.timescale=0,this.flvScriptSamples=[],this.seiSamples=[]}},{key:"hasSample",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length)}}])}(),Wa=function(){function e(t,n){qs(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=n}return Js(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var n=arguments.length,i=new Array(n),r=0;r0){var l=this.videoSegmnents[this.videoSegmnents.length-1].frames;this.videoMaxFrameIdx=l[l.length-1].index}if((null===(a=this.audioSegmnents)||void 0===a?void 0:a.length)>0){var c=this.audioSegmnents[this.audioSegmnents.length-1].frames;this.audioMaxFrameIdx=c[c.length-1].index}}return Js(e,[{key:"parseSamples",value:function(e){if(!e)throw new Error("moov is required");this.videoTrack.codec||this.audioTrack.codec||(wa.moovToTrack(e,this.videoTrack,this.audioTrack),this.videoSenc=this.videoTrack.videoSenc,this.audioSenc=this.audioTrack.audioSenc,this.memoryOpt&&this.clearBoxEntries(e))}},{key:"demux",value:function(e,t,n,i,r){this.parseSamples(r);var s,a,o,l=this.videoTrack,c=this.audioTrack;l.samples=[],c.samples=[];var u={};if(n){var d,h=0;if(this.memoryOpt&&this.videoSegmnents&&!(u=this.getFramePosByIdx("video",n[0])))throw new Error("cannot found video frame #".concat(n[0]));for(var p=u,f=p.frameIdx,g=p.segmentIdx,m=n[0],v=n[1];m<=v;m++){if(!this._videoSamples.length&&this.videoSegmnents){var y=this.getFrameInfo("video",g,f);s=y.sample,g=y.segmentIdx,f=y.frameIdx}else s=this._videoSamples[m];if(!s)throw new Error("cannot found video frame #".concat(m));o=s.offset-t,a=e.subarray(o,o+s.size),(d=new za("number"==typeof s.pts?s.pts:s.dts,s.dts)).duration=s.duration,d.gopId=s.gopId,s.keyframe&&d.setToKeyframe();for(var _=0,T=a.length-1;_0&&t>this._lastRemainBufferStartPos&&t<=this._lastRemainBufferStartPos+this._lastRemainBuffer.byteLength)for(var l=0;l<20;)try{var c=this._lastRemainBuffer.subarray(0,t-this._lastRemainBufferStartPos),u=new Uint8Array(e.byteLength+c.byteLength);u.set(c,0),u.set(new Uint8Array(e),c.byteLength),e=u,t-=c.byteLength,this._lastRemainBuffer=null,this._lastRemainBufferStartPos=0;break}catch(e){if(!(l<20))throw new Error("new Uint8Array error:,"+e.errorMessage);l++}var d,h,p,f=this.videoTrack,g=this.audioTrack;f.samples=[],g.samples=[],f.videoSenc=null,g.audioSenc=null,(null==n?void 0:n[1])>this.videoMaxFrameIdx&&this.videoMaxFrameIdx>0&&(n[1]=this.videoMaxFrameIdx),(null==i?void 0:i[1])>this.audioMaxFrameIdx&&this.audioMaxFrameIdx>0&&(i[1]=this.audioMaxFrameIdx);var m=0,v=0,y={},_=e.byteLength+t;if(n.length>0){var T;if(this.memoryOpt&&this.videoSegmnents&&!(y=this.getFramePosByIdx("video",n[0])))throw new Error("cannot found video frame #".concat(n[0]));for(var b=y,S=b.frameIdx,P=b.segmentIdx,M=n[0];M<=n[1];M++){if(!this._videoSamples.length&&this.videoSegmnents){var w=this.getFrameInfo("video",P,S);d=w.sample,P=w.segmentIdx,S=w.frameIdx}else d=this._videoSamples[M];if(!d)throw new Error("cannot found video frame #".concat(M));if(this.memoryOpt&&d.offset+d.size>_)break;d.offset>=t&&d.offset+d.size<=_&&(m=(p=d.offset-t)+d.size,h=e.subarray(p,m),(T=new za("number"==typeof d.pts?d.pts:d.dts,d.dts)).duration=d.duration,T.gopId=d.gopId,T.sampleOffset=d.index,d.keyframe&&T.setToKeyframe(),T.data=h,T.size=d.size,f.samples.push(T))}f.samples.length>0&&(f.gopId=f.samples[0].gopId,f.baseMediaDecodeTime=f.samples[0].dts,f.startPts=f.samples[0].pts/f.timescale,f.endPts=f.samples[f.samples.length-1].pts/f.timescale,f.startDts=f.samples[0].dts/f.timescale,f.endDts=f.samples[f.samples.length-1].dts/f.timescale,this.videoSenc&&(f.videoSenc=this.videoSenc.slice(f.samples[0].sampleOffset,f.samples[0].sampleOffset+f.samples.length),f.kidValue=a))}if(i.length>0){if(this.memoryOpt&&this.audioSegmnents&&!(y=this.getFramePosByIdx("audio",i[0])))throw new Error("cannot found video frame #".concat(i[0]));for(var E=y,k=E.frameIdx,D=E.segmentIdx,R=i[0];R<=i[1];R++){if(!this._audioSamples.length&&this.audioSegmnents){var x=this.getFrameInfo("audio",D,k);d=x.sample,D=x.segmentIdx,k=x.frameIdx}else d=this._audioSamples[R];if(!d)throw new Error("cannot found video frame #".concat(R));if(this.memoryOpt&&d.offset+d.size>_)break;d.offset>=t&&d.offset+d.size<=_&&(v=(p=d.offset-t)+d.size,h=e.subarray(p,v),g.samples.push(new Xa(d.dts,h,d.duration,d.index)))}g.samples.length>0&&(g.gopId=g.samples[0].gopId||f.gopId,g.baseMediaDecodeTime=g.samples[0].dts,g.startPts=g.samples[0].pts/g.timescale,g.endPts=g.samples[g.samples.length-1].pts/g.timescale,this.audioSenc&&(g.audioSenc=this.audioSenc.slice(g.samples[0].sampleOffset,g.samples[0].sampleOffset+g.samples.length),g.kidValue=a))}this.decoderData(f,g,o);for(var C=0,I=0;I0?this._lastRemainBufferStartPos=t+e.byteLength-this._lastRemainBuffer.byteLength:this._lastRemainBufferStartPos=0,{videoTrack:f,audioTrack:g,metadataTrack:this.metadataTrack,lastRemainBufferInfo:{data:this._lastRemainBuffer,pos:this._lastRemainBufferStartPos}}}},{key:"setLastRemainBufferInfo",value:function(e,t){this._lastRemainBuffer=e,this._lastRemainBufferStartPos=t}},{key:"reset",value:function(){this._lastRemainBuffer=null,this._lastRemainBufferStartPos=0,this.videoTrack.reset(),this.audioTrack.reset(),this.metadataTrack.reset()}},{key:"decoderData",value:function(t,n,i){if(!t.useEME&&!n.useEME&&(null!=t&&t.videoSenc||null!=n&&n.audioSenc)){if(!e.Crypto)throw new Error("Crypto is not defined");e.Crypto.decoderAESCTRData(t,n,i)}}},{key:"getFramePosByIdx",value:function(e,t){var n="video"===e?this.videoSegmnents:this.audioSegmnents;if(!n||null==n||!n.length)return null;for(var i,r=0,s=0;s1?n-1:0),r=1;r>8&255,255&e])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}])}(),eo=Math.pow(2,32)-1,to=function(){function e(){qs(this,e)}return Js(e,null,[{key:"box",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i>24&255,s[1]=r>>16&255,s[2]=r>>8&255,s[3]=255&r,s.set(e,4);var a=8;return n.forEach((function(e){s.set(e,a),a+=e.byteLength})),s}},{key:"FullBox",value:function(t,n,i){for(var r=arguments.length,s=new Array(r>3?r-3:0),a=3;a>16&255,i>>8&255,255&i])].concat(s))}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===Ta&&e.codecType===ba}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return ia(e.ftyp(t),e.moov(t))}},{key:"pssh",value:function(t){var n=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],ua(t.kid),[0,0,0,0]));return e.box(e.types.pssh,n)}},{key:"moov",value:function(t){if(t[0].useEME&&(t[0].encv||t[0].enca)){t[0].pssh||(t[0].pssh={kid:t[0].kid});var n=this.pssh(t[0].pssh);return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale),e.mvex(t)].concat(ea(t.map((function(t){return e.trak(t)}))),[n]))}return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale)].concat(ea(t.map((function(t){return e.trak(t)}))),[e.mvex(t)]))}},{key:"mvhd",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n,t>>24&255,t>>16&255,t>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.tkhdDuration||0,t.width,t.height),e.mdia(t))}},{key:"tkhd",value:function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,r>>8&255,255&r,0,0]))}},{key:"edts",value:function(t){return e.box(e.types.edts,e.elst(t))}},{key:"elst",value:function(t){t.entries;var n=t.entriesData,i=t.version;return e.FullBox(e.types.elst,i,0,n)}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minf(t))}},{key:"mdhd",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n,t>>24&255,t>>16&255,t>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"minf",value:function(t){return e.box(e.types.minf,t.type===Ta?e.VMHD:e.SMHD,e.DINF,e.stbl(t))}},{key:"stbl",value:function(t){return t&&t.ext,e.box(e.types.stbl,e.stsd(t),e.STTS,[][0],e.STSC,e.STSZ,e.STCO)}},{key:"stsd",value:function(t){var n;return n="audio"===t.type?t.useEME&&t.enca?e.enca(t):e.mp4a(t):t.useEME&&t.encv?e.encv(t):t.av1C?e.av01(t):e.avc1hev1vvc1(t),e.box(e.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),n)}},{key:"enca",value:function(t){var n=t.enca.channelCount,i=t.enca.sampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,i>>8&255,255&i,0,0]),s=e.esds(t.config),a=e.sinf(t.enca);return e.box(e.types.enca,r,s,a)}},{key:"encv",value:function(t){var n,i,r=t.sps.length>0?t.sps[0]:[],s=t.pps.length>0?t.pps[0]:[],a=t.width,o=t.height,l=t.sarRatio[0],c=t.sarRatio[1],u=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,a>>8&255,255&a,o>>8&255,255&o,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),d=new Uint8Array((n=(i=[1,r[1],r[2],r[3],255,225,r.length>>>8&255,255&r.length]).concat.apply(i,ea(r)).concat([1,s.length>>>8&255,255&s.length])).concat.apply(n,ea(s))),h=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),p=e.sinf(t.encv),f=new Uint8Array([l>>24,l>>16&255,l>>8&255,255&l,c>>24,c>>16&255,c>>8&255,255&c]);return e.box(e.types.encv,u,e.box(e.types.avcC,d),e.box(e.types.btrt,h),p,e.box(e.types.pasp,f))}},{key:"schi",value:function(t){var n=new Uint8Array([]),i=e.tenc(t);return e.box(e.types.schi,n,i)}},{key:"tenc",value:function(t){var n=new Uint8Array([0,0,0,0,0,0,255&t.default_IsEncrypted,255&t.default_IV_size].concat(ua(t.default_KID)));return e.box(e.types.tenc,n)}},{key:"sinf",value:function(t){var n=new Uint8Array([]),i=new Uint8Array([t.data_format.charCodeAt(0),t.data_format.charCodeAt(1),t.data_format.charCodeAt(2),t.data_format.charCodeAt(3)]),r=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),s=e.schi(t);return e.box(e.types.sinf,n,e.box(e.types.frma,i),e.box(e.types.schm,r),s)}},{key:"av01",value:function(t){return e.box(e.types.av01,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t.av1C,t.colr)}},{key:"avc1hev1vvc1",value:function(t){var n,i;t.codecType===ba?(n=e.hvcC(t),i=e.types.hvc1):t.codecType===Sa?(n=e.vvcC(t),i=e.types.bvc2):(n=e.avcC(t),i=e.types.avc1);var r=[new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),n];return t.codecType===ba?r.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&r.push(e.pasp(t.sarRatio)),e.box.apply(e,[i].concat(r))}},{key:"avcC",value:function(t){var n,i,r,s=[],a=[];return t.sps.forEach((function(e){r=e.byteLength,s.push(r>>>8&255),s.push(255&r),s.push.apply(s,ea(e))})),t.pps.forEach((function(e){r=e.byteLength,a.push(r>>>8&255),a.push(255&r),a.push.apply(a,ea(e))})),e.box(e.types.avcC,new Uint8Array((n=(i=[1,s[3],s[4],s[5],255,224|t.sps.length]).concat.apply(i,s).concat([t.pps.length])).concat.apply(n,a)))}},{key:"vvcC",value:function(t){var n=t.vvcC;return e.box(e.types.bv2C,new Uint8Array(n))}},{key:"hvcC",value:function(t){var n=t.hvcC;if(n instanceof ArrayBuffer||n instanceof Uint8Array)return n;var i,r=t.vps,s=t.sps,a=t.pps;if(n){var o=n.generalProfileCompatibilityFlags,l=n.generalConstraintIndicatorFlags,c=(r.length&&1)+(s.length&&1)+(a.length&&1);i=[1,n.generalProfileSpace<<6|n.generalTierFlag<<5|n.generalProfileIdc,o>>>24,o>>>16,o>>>8,o,l[0],l[1],l[2],l[3],l[4],l[5],n.generalLevelIdc,240,0,252,252|n.chromaFormatIdc,248|n.bitDepthLumaMinus8,248|n.bitDepthChromaMinus8,0,0,n.numTemporalLayers<<3|n.temporalIdNested<<2|3,c];var u=function(e){var t;i.push(e.length>>8,e.length),(t=i).push.apply(t,ea(e))};r.length&&(i.push(160,0,r.length),r.forEach(u)),s.length&&(i.push(161,0,s.length),s.forEach(u)),a.length&&(i.push(162,0,a.length),a.forEach(u))}else i=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return e.box(e.types.hvcC,new Uint8Array(i))}},{key:"pasp",value:function(t){var n,i,r=(i=2,function(e){if(Array.isArray(e))return e}(n=t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,s,a,o=[],l=!0,c=!1;try{if(s=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=s.call(n)).done)&&(o.push(i.value),o.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return o}}(n,i)||na(n,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=r[0],a=r[1];return e.box(e.types.pasp,new Uint8Array([s>>24,s>>16&255,s>>8&255,255&s,a>>24,a>>16&255,a>>8&255,255&a]))}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),t.config.length?e.esds(t.config):void 0)}},{key:"esds",value:function(t){var n=t.length;return e.box(e.types.esds,new Uint8Array([0,0,0,0,3,23+n,0,0,0,4,15+n,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([n]).concat(t).concat([6,1,2])))}},{key:"mvex",value:function(t){return e.box.apply(e,[e.types.mvex].concat(ea(t.map((function(t){return e.trex(t.id)})))))}},{key:"trex",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trex1",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]))}},{key:"trex2",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]))}},{key:"moof",value:function(t){return e.box.apply(e,[e.types.moof,e.mfhd(t[0].samples?t[0].samples[0].gopId:0)].concat(ea(t.map((function(t){return e.traf(t)})))))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"traf",value:function(t){var n=e.tfhd(t.id),i=e.tfdt(t.baseMediaDecodeTime),r=0;if(t.isVideo&&t.videoSenc&&t.videoSenc.forEach((function(e){r+=8,e.subsamples&&e.subsamples.length&&(r+=2,r+=6*e.subsamples.length)})),t.videoSencLength=r,t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)){if(t.isVideoEncryption){if(t.isVideo){var s=e.saiz(t),a=e.saio(t),o=e.trun1(t),l=e.senc(t);return e.box(e.types.traf,n,i,s,a,o,l)}if(t.isAudioEncryption){var c=e.sbgp(),u=e.saiz(t),d=e.saio(t),h=e.senc(t),p=e.trun1(t);return e.box(e.types.traf,n,i,c,u,d,h,p)}var f=e.sbgp(),g=e.trun1(t);return e.box(e.types.traf,n,i,f,g)}if(t.isVideo){var m=e.trun1(t);return e.box(e.types.traf,n,i,m)}var v=e.sbgp(),y=e.saiz(t),_=e.saio(t),T=e.senc(t),b=e.trun1(t);return e.box(e.types.traf,n,i,v,y,_,T,b)}var S=e.sdtp(t);return e.box(e.types.traf,n,i,S,e.trun(t.samples,S.byteLength+76))}},{key:"sdtp",value:function(t){var n=new Za;return t.samples.forEach((function(e){n.write(new Uint8Array(t.isVideo?[e.keyframe?32:16]:[16]))})),e.box(e.types.sdtp,this.extension(0,0),n.buffer)}},{key:"trun1",value:function(t){var n=new Za,i=Za.writeUint32(t.samples.length),r=null;if(t.isVideo){var s=t.videoSencLength;r=Za.writeUint32(76+16*t.samples.length+s+77),!t.isVideoEncryption&&t.isAudioEncryption&&(r=Za.writeUint32(76+16*t.samples.length+20))}else{var a=76+12*t.samples.length+52;t.isAudioEncryption&&(a=76+12*t.samples.length+8*t.audioSenc.length+105),r=Za.writeUint32(a)}return t.samples.forEach((function(e){n.write(Za.writeUint32(e.duration)),n.write(Za.writeUint32(e.size)),n.write(Za.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&n.write(Za.writeUint32(e.cts?e.cts:0))})),e.box(e.types.trun,this.extension(0,t.flags),i,r,n.buffer)}},{key:"senc",value:function(t){var n=new Za,i=t.samples.length,r=t.isVideo?16:8,s=t.isVideo?2:0,a=[],o=0;return t.isVideo?(a=t.videoSenc,o=t.videoSencLength):a=t.audioSenc,o=o||r*i,n.write(Za.writeUint32(16+o),e.types.senc,this.extension(0,s)),n.write(Za.writeUint32(i)),a.forEach((function(e){for(var t=0;t>24&255,n>>16&255,n>>8&255,255&n]);return e.box(e.types.saio,i)}},{key:"saiz",value:function(t){var n=t.samples.length,i=new Uint8Array([0,0,0,0,16,n>>24&255,n>>16&255,n>>8&255,255&n]);return e.box(e.types.saiz,i)}},{key:"sbgp",value:function(){var t=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return e.box(e.types.sbgp,this.extension(0,0),t)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"tfhd",value:function(t){return e.box(e.types.tfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"tfdt",value:function(t){var n=Math.floor(t/(eo+1)),i=Math.floor(t%(eo+1));return e.box(e.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"trun",value:function(t,n){var i=t.length,r=12+16*i;n+=8+r;var s=new Uint8Array(r);s.set([0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0);for(var a=0;a>>24&255,l>>>16&255,l>>>8&255,255&l,c>>>24&255,c>>>16&255,c>>>8&255,255&c,d.isLeading<<2|(null===d.dependsOn||void 0===d.dependsOn?1:d.dependsOn),d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|(null===d.isNonSyncSample||void 0===d.isNonSyncSample?1:d.isNonSyncSample),61440&d.degradationPriority,15&d.degradationPriority,p>>>24&255,p>>>16&255,p>>>8&255,255&p],12+16*a)}return e.box(e.types.trun,s)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(ea(t.map((function(t){return e.trackMP4(t)})))))}},{key:"trackMP4",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.duration,t.width,t.height),e.mdiaMP4(t))}},{key:"mdiaMP4",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minfMP4(t))}},{key:"minfMP4",value:function(t){return e.box(e.types.minf,t.type===Ta?e.VMHD:e.SMHD,e.DINF,e.stblMP4(t))}},{key:"stblMP4",value:function(t){var n=t.ext,i=[e.stsd(t),e.stts(n.stts),e.stsc(n.stsc),e.stsz(n.stsz),e.stco(n.stco)];return n.stss.length&&i.push(e.stss(n.stss)),n.ctts.length&&i.push(e.ctts(n.ctts)),e.box.apply(e,[e.types.stbl].concat(i))}},{key:"stts",value:function(t){var n=t.length,i=new Uint8Array(8*n),r=0;return t.forEach((function(e){var t=e.value,n=e.count;i.set([n>>24,n>>16&255,n>>8&255,255&n,t>>24,t>>16&255,t>>8&255,255&t],r),r+=8})),e.box(e.types.stts,ia(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),i))}},{key:"stsc",value:function(t){var n=t.length,i=new Uint8Array(12*n),r=0;return t.forEach((function(e){var t=e.firstChunk,n=e.samplesPerChunk,s=e.sampleDescIndex;i.set([t>>24,t>>16&255,t>>8&255,255&t,n>>24,n>>16&255,n>>8&255,255&n,s>>24,s>>16&255,s>>8&255,255&s],r),r+=12})),e.box(e.types.stsc,ia(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),i))}},{key:"stsz",value:function(t){var n=t.length,i=new Uint8Array(4*n),r=0;return t.forEach((function(e){i.set([e>>24,e>>16&255,e>>8&255,255&e],r),r+=4})),e.box(e.types.stsz,ia(new Uint8Array([0,0,0,0,0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),i))}},{key:"stco",value:function(t){var n=t.length,i=new Uint8Array(4*n),r=0;return t.forEach((function(e){i.set([e>>24,e>>16&255,e>>8&255,255&e],r),r+=4})),e.box(e.types.stco,ia(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),i))}},{key:"stss",value:function(t){var n=t.length,i=new Uint8Array(4*n),r=0;return t.forEach((function(e){i.set([e>>24,e>>16&255,e>>8&255,255&e],r),r+=4})),e.box(e.types.stss,ia(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),i))}},{key:"ctts",value:function(t){var n=t.length,i=new Uint8Array(8*n),r=0;return t.forEach((function(e){var t=e.value,n=e.count;i.set([n>>24,n>>16&255,n>>8&255,255&n,t>>24,t>>16&255,t>>8&255,255&t],r),r+=8})),e.box(e.types.ctts,ia(new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]),i))}},{key:"styp",value:function(){return e.box(e.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(t){var n=t.timescale,i=t.samples[0].duration,r=i*t.samples.length,s=t.samples[0].sampleOffset*i,a=8;t.samples.forEach((function(e){a+=e.size}));var o=0;if(t.isVideo){var l,c=0;t.videoSenc&&(l=t.videoSenc),t.isVideo&&l.forEach((function(e){c+=8,e.subsamples&&e.subsamples.length&&(c+=2,c+=6*e.subsamples.length)})),t.videoSencLength=c,o=a+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(o=a+16*t.samples.length+84)}else o=a+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(o=a+169+12*t.samples.length+8*t.audioSenc.length);var u=new Uint8Array([0,0,0,0,0,0,0,255&t.id,n>>24&255,n>>16&255,n>>8&255,255&n,s>>24&255,s>>16&255,s>>8&255,255&s,0,0,0,0,0,0,0,1,0,o>>16&255,o>>8&255,255&o,r>>24&255,r>>16&255,r>>8&255,255&r,144,0,0,0]);return e.box(e.types.sidx,u)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}])}();Qa=to,Zs(to,"types",["av01","av1C","avc1","avcC","hvc1","hvcC","dinf","dref","edts","elst","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp","bvc2","bv2C"].reduce((function(e,t){return e[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)],e}),Object.create(null))),Zs(to,"HDLR_TYPES",{video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])}),Zs(to,"FTYPAVC1",Qa.box(Qa.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),Zs(to,"FTYPHEV1",Qa.box(Qa.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),Zs(to,"DINF",Qa.box(Qa.types.dinf,Qa.box(Qa.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),Zs(to,"VMHD",Qa.box(Qa.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),Zs(to,"SMHD",Qa.box(Qa.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),Zs(to,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),Zs(to,"STTS",Qa.box(Qa.types.stts,Qa.StblTable)),Zs(to,"STSC",Qa.box(Qa.types.stsc,Qa.StblTable)),Zs(to,"STSZ",Qa.box(Qa.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),Zs(to,"STCO",Qa.box(Qa.types.stco,Qa.StblTable));var no=function(){return Js((function e(t,n,i){qs(this,e),this.videoTrack=t,this.audioTrack=n;var r=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=r&&Number(r[1])<50,this.log=new Wa("FMP4Remuxer",!i||!i.openLog||!i.openLog)}),[{key:"remux",value:function(){var e,t,n,i,r,s=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=this.videoTrack,l=this.audioTrack,c=o.exist(),u=l.exist(),d=[];return s&&(a&&a.initMerge?(c&&d.push(this.videoTrack),u&&d.push(this.audioTrack),n=to.initSegment(d)):(c&&(e=to.initSegment([this.videoTrack])),u&&(t=to.initSegment([this.audioTrack])))),c&&o.hasSample()&&(i=this._remuxVideo()),u&&l.hasSample()&&(r=this._remuxAudio()),o.samples=[],l.samples=[],{initSegment:n,videoInitSegment:e,audioInitSegment:t,videoSegment:i,audioSegment:r}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack;this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0});var t=e.samples,n=/av01/.test(e.codec),i=0;n?t.forEach((function(e){i+=e.data.byteLength})):t.forEach((function(e){i+=e.units.reduce((function(e,t){return e+t.byteLength}),0),i+=4*e.units.length}));var r=new Uint8Array(i);if(n)for(var s,a=0,o=t.length,l=0;a((e,t,n)=>t in e?io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);const so={MEDIA_EXPIRED:"MEDIA_EXPIRED",INIT_FAIL:"INIT_FAIL",PARSE_ERROR:"PARSE_ERROR",PLAYER_LOG:"PLAYER_LOG",BUFFERED_RESET:"BUFFERED_RESET"},ao="real_time_speed",oo="is unsupported",lo="buffer_control",co="cdn",uo="pcdn",ho=new Map,po=new Map,fo=new Map,go="gop",mo="size",vo={BUFFER_CONTROLS:"buffer_control"},yo="timer_update",_o="h264",To="h265",bo="h266",So="0.3.10",Po={416:cr[lr.NETWROK_RANGE_NOT_SATISFIABLE],403:cr[lr.NETWORK_FORBIDDEN],404:cr[lr.NETWORK_NOTFOUND],timeout:cr[lr.NETWORK_TIMEOUT],"4xx":`${cr[lr.NETWORK]}4XX`,"5xx":`${cr[lr.NETWORK]}5XX`,networkError:cr[lr.NETWORK],contentError:`${cr[lr.NETWORK]}contentError`,mse:cr[lr.MEDIA][lr.SUB_TYPES.MSE_OTHER],mseOpen:cr[lr.MEDIA][lr.SUB_TYPES.MSE_ADD_SB],mseAppend:cr[lr.MEDIA][lr.SUB_TYPES.MSE_APPEND_BUFFER],mse_hijack:cr[lr.MEDIA][lr.SUB_TYPES.MSE_HIJACK],eme_hijack:cr[lr.MEDIA][lr.SUB_TYPES.EME_HIJACK],metaError:cr[lr.DEMUX][lr.SUB_TYPES.MP4],muxError:cr[lr.REMUX][lr.SUB_TYPES.FMP4],other:cr[lr.OTHER],waitTimeout:cr[lr.RUNTIME][lr.SUB_TYPES.BUFFERBREAK_ERROR],waitTimeoutWithHidden:cr[lr.RUNTIME][lr.SUB_TYPES.WAITING_TIMEOUT_ERROR],drm:cr[lr.DRM][lr.SUB_TYPES.LICENSE]},Mo=lr;class wo{constructor(e,t,n){let i=0,r=0;n&&n.range&&n.range.length>1&&(i=n.range[0],r=n.range[1]);const s=function(e){return Po[e]||e}(t);return{errorCode:s,errorType:e,errorMessage:(null==n?void 0:n.httpText)||(null==n?void 0:n.message),url:null==n?void 0:n.url,httpCode:t,version:So,rangeStart:i,rangeEnd:r,ext:n,mediaError:{code:s,message:(null==n?void 0:n.httpText)||(null==n?void 0:n.message)}}}}class Eo{constructor(e,t,n){return{errorCode:t,errorType:e,version:So,errorMessage:n.msg,ext:n,mediaError:{code:t,message:n.msg}}}}const ko=[{range:[0,90],size:614400},{range:[90,120],size:819200},{range:[120,Number.MAX_VALUE],size:1024e3}];function Do(e,t,n){let i=n>51200?Math.min(n,t):t;if(!e)return i;for(let r=0;r=ko[r].range[0]&&e0?n:t);break}return i}const Ro=function(){try{return typeof localStorage<"u"&&"setItem"in window.localStorage&&!!window.localStorage.setItem}catch{return!1}}()&&!function(){const e="_localstorage_support_test";try{return window.localStorage.setItem(e,!0),window.localStorage.removeItem(e),!1}catch{return!0}}(),xo=Lo(),Co=function(){if(Ro)try{return!!window.localStorage.getItem("playertestlog")}catch{return!1}return!1}(),Io={1:"debug",2:"log",3:"warn",4:"error"};function Lo(){if(Ro)try{return!!window.localStorage.getItem("playerlog")}catch{return!1}return!1}function Oo(e,t,n,...i){const r=Io[t];r&&e&&e[r]&&e[r](n,...i)}function Ao(e="div",t="",n={},i=""){const r=document.createElement(e);return r.className=i,r.innerHTML=t,Object.keys(n).forEach((t=>{const i=t,s=n[t];"video"===e||"audio"===e||"live-video"===e?s&&r.setAttribute(i,s):r.setAttribute(i,s)})),r}function Go(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}function $o(){try{return parseInt(performance.now(),10)}catch{return(new Date).getTime()}}function No(e,t){try{const n=e.indexOf("?");return n<0?Object.keys(t).forEach(((n,i)=>{e+=0===i?`?${n}=${t[n]}`:`&${n}=${t[n]}`})):Object.keys(t).forEach((i=>{n===e.length-1?e+=`${i}=${t[i]}`:e+=`&${i}=${t[i]}`})),e}catch{return e}}function Bo(e,t){return Object.keys(t).forEach((n=>{const i=Go(t[n]),r=Go(e[n]);"Array"===i?("Array"!==r&&(e[n]=[]),e[n].push(...t[n])):"Object"===i?("Object"!==r&&(e[n]={}),Bo(e[n],t[n])):e[n]=t[n]})),e}function Fo(e,t){try{return e&&t?parseInt(t*e/8,10):0}catch{return 0}}function Uo(e,t){const n=[];let i=0;e&&n.push(e),t&&n.push(t),n.every((e=>(e&&(i+=e.byteLength),!0)));const r=new Uint8Array(i);let s=0;return n.every((e=>(e&&(r.set(e,s),s+=e.byteLength),!0))),r}function Ho(e,t,n){let i=null,r=null;return i=e3&&t[2]&&(n=t[2]),n}function jo(e){let t,n=0;for(;n<10;)try{if(t=new Uint8Array(e),t&&t.byteLength>0)break;n++}catch{n<10?n++:console.error("repeat data cache new array failed final",10)}return t}const zo={playBtnClick:(e,t,n,i)=>{e.paused||e.waitingMoreBuffer&&(e.waitingMoreBuffer=!1),i.call(e,t,n)}},Xo={waiting:(e,t)=>{const{player:n,eventName:i}=e;n.waitingMoreBuffer=!0,t(i,e)},play:(e,t)=>{const{player:n,eventName:i}=e;n.waitingMoreBuffer||t(i,e)},pause:(e,t)=>{const{player:n,eventName:i}=e;n.waitingMoreBuffer||t(i,e)},seeking:(e,t)=>{const{player:n,eventName:i}=e;n.isSeekingStart=!0,t(i,e)},progress:(e,t)=>{Oo(">>>>progress");const{player:n,eventName:i}=e;if(n.waitingMoreBuffer){const e=n.getBufferedRange(n.buffered2);0===e[0]&&0===e[1]||(void 0===n.inWaitingStart||n.isSeekingStart?(Oo("progress startplay or seek ended"),e[1]-n.currentTime>=(n.config.canplayWaterLevel||1)||e[1]>n.duration-1?(Oo("progress out bufferWaterLevel"),n.play()):(Oo("progress not out bufferWaterLevel"),n.emit("waiting"))):(Oo("progress video waiting end"),e[1]-n.currentTime>=(n.config.bufferWaterLevel||5)||e[1]>n.duration-1?(Oo("progress out bufferWaterLevel"),n.play()):(Oo("progress not out bufferWaterLevel"),n.emit("waiting"))))}t(i,e)},playing:(e,t)=>{const{player:n,eventName:i}=e;Oo("playing");const r=n.getBufferedRange(n.buffered2);if(0===r[0]&&0===r[1])return Oo("playing currentTime no buffer, not out bufferWaterLevel"),n.waitingMoreBuffer=!0,n.pause(),void t.call("waiting",e);void 0===n.inWaitingStart||n.isSeekingStart?(Oo("playing startplay or seek ended"),r[1]-n.currentTime>=(n.config.canplayWaterLevel||1)||r[1]>n.duration-1?(Oo("playing out bufferWaterLevel"),n.waitingMoreBuffer=!1,n.isSeekingStart=!1,t(i,e)):(Oo("playing not out bufferWaterLevel"),n.waitingMoreBuffer=!0,n.pause(),t.call("waiting",e))):(Oo("playing video waiting ended"),r[1]-n.currentTime>=(n.config.bufferWaterLevel||5)||r[1]>n.duration-1?(Oo("playing out bufferWaterLevel"),n.waitingMoreBuffer=!1,t(i,e)):(Oo("playing not out bufferWaterLevel"),n.waitingMoreBuffer=!0,n.pause(),t.call("waiting",e)))}};function Ko(e,t){return Math.round(8*e*1e3/t/1024)}function Wo(e){var t,n;return!((null==(t=null==e?void 0:e.message)?void 0:t.indexOf("Failed to fetch"))>=0||null!=e&&e.response&&(null==(n=e.response)?void 0:n.status)>=400&&e.response.status<=599)}function Qo(e,t,n){e.video&&e.video.addEventListener(t,n)}function qo(e,t,n){e.video&&e.video.removeEventListener(t,n)}function Yo(e){return e&&e.video&&"function"==typeof e.video.getStats?e.video.getStats():null}function Jo(e){const{kid:t,drmKeyToken:n,secretKey:i,keyValue:r,drm:s}=e;return t||n||i||r||s}function Zo(e){const{cachedBufferDur:t,loadTarDuration:n,loadDuration:i,forceSetMin:r}=e,{PCDNInBuffer:s,PCDNOutBuffer:a,loadSize:o}=e;return{buffer_dur:t||-1,load_tar_dur:n||-1,load_dur:i||-1,force_set_min:r,in_buf:s||-1,out_buf:a||-1,load_size:o||-1}}const el={"x-cache":"x_cache","x-response-sinfo":"server_ip","x-response-cinfo":"x-response-cinfo","content-range":"content-range","content-length":"content-length","content-type":"content-type"};function tl(e){const t={};return!e||!e.get||Object.keys(el).forEach((n=>{const i=el[n];e.get(n)&&(t[i]=e.get(n))})),t}function nl(e){const t=el["content-range"];if(e&&e.get&&e.get(t)){const n=e.get(t).split("/");if(2===(null==n?void 0:n.length))return n[1]}return null}const il="error",rl="metaReady",sl="moov_request_Progress",al="progress_event",ol="updateEME",ll="init_MSE",cl="chaneg_url",ul="update_load_fragmentIdx",dl="remove_pcdn_node",hl="load_error",pl="cancel_loaded_len",fl="load_len_not_match_error",gl="close",ml="forbidden",vl={},yl=class e extends j{constructor(t,n,i,r=[],s){var a;super(),ro(this,"markErrHost",(e=>{e&&(vl[e]=!0,this.log(er.WARN,"[mp4loader markErrHost]",e))})),ro(this,"onprogressDataArrive",(async(e,t,n,i)=>{var r;const s=(null==(r=null==n?void 0:n.priOptions)?void 0:r.type)||co,a=this.adaptTimeRange[n.index].range;if(e&&e.byteLength>0?(!this._optionDataLenInfo[s]&&(this._optionDataLenInfo[s]=0),this._optionDataLenInfo[s]+=e.byteLength,this._receiveDataPos=null==n?void 0:n.range[1],a&&n.range[1]>a[1]&&!t&&(t=!0,this.log(er.LOG,"[onprogressDataArrive] receive data, check state set true >>> index,",n.index,",range,",JSON.stringify(n.range))),this.cacheRepeatData(this.adaptTimeRange[n.index].repeatRange,n.range,e),this.log(er.LOG,"[onprogressDataArrive] receive data, >>> index,",n.index,",range,",JSON.stringify(n.range),", dataLen,",e.byteLength,",loadType,",s,t),this._mux(e,n.range[0],n.index,t)):this.log(er.LOG,"[onprogressDataArrive] receive data null, >>> index,",n.index,",range,",JSON.stringify(n.range),", dataLen,",null==e?void 0:e.byteLength,",loadType,",s,t),t){this._optionDataLenInfo[s]=0;const e=tl(i.headers);this.totalSize||(this.totalSize=function(e){try{const t=Object.keys(e).filter((e=>"content-range"===e));if(t.length>0){const n=e[t[0]].split("/");if(2===(null==n?void 0:n.length))return parseInt(n[1],10)}return 0}catch(e){return console.error(e),0}}(e));const t=a&&a.length>=0?Number(a[1]):0;if((null==a?void 0:a.length)>0&&(!t||t&&((null==n?void 0:n.range[1])===t+1||this.totalSize===t)))this.adaptTimeRange[n.index].downloaded=!0,this.log(er.LOG,"[FragLoadDowned],fragmentIdx,",n.index,",rangeEnd,",n.range[1]);else{await this.cancelLoading();const{startTime:t,endTime:r}=this.adaptTimeRange[n.index];this.emit(fl,[t,r]);const o=s===co?this.url:this._pcdnNodeList[0].url,l=Vo(o);this.emit(hl,{src:o,host:l,errorCode:Po.contentError,message:"progress dataLen not match",range:JSON.stringify(a),headers:e}),this.log(er.LOG,"[FragLoadDowned check false, len is not match],fragmentIdx,",n.index,",rangeEnd,",n.range[1],JSON.stringify(a),JSON.stringify(e),o,null==i?void 0:i.url),await this.loadAllFragmentData(this._curLoadSegIdx,this._loadSuccessCallBack)}}})),this.timeRecord={startMuxTime:-1,startLoadTime:-1,newMP4Time:$o(),startLoadMetaTime:-1},this.updateUrl(t,r||[]),this._bitRate=n||0,this.options=e.getDefaultConfig(),Object.keys(i).map((e=>{void 0!==i[e]&&null!==i[e]&&(this.options[e]=i[e])})),this.logger=i.logger,this.timeRange=[],this.adaptTimeRange=[],this.firstFrameTime=s||{},this.fileSize=null==i?void 0:i.fileSize,this.totalSize=0,this.CHUNK_SIZE=(null==(a=this.options)?void 0:a.firstLoadSize)||Do(i.duration,this.options.chunkSize,this.fileSize),this._firstLoadSize=this.CHUNK_SIZE,this.log(er.LOG,"[getFirstLoadSize], firstLoadSize ",this._firstLoadSize,",dur,",i.duration,",chunkSize,",this.CHUNK_SIZE,",fileSize,",this.fileSize),this._repeatInfo={startPos:-1,curDataPos:0,usedPos:0,data:jo(1048576)},this.meta=null,this.preloadCache=null,this.videoTrak=null,this.audioTrak=null,this._loadSuccessCallBack=null,this._isPending=!1,this.metaLoading=!1,this.MP4Loader=new Ha({url:t,vid:`${i.vid}-${n}`,retry:i.retryCount||2,retryDelay:i.retryDelay||1e3,timeout:i.timeout||3e3,segmentDuration:i.segmentDuration,fixEditListOffset:i.fixEditListOffset,...i.reqOptions,loaderType:i.loaderType,retryCheckFunc:Wo,openLog:xo}),this.MP4Demuxer=null,this.FMP4Remuxer=null,this._needInitSegment=!0,this._bitRateInfoMap=new Map,this._switchBitRate=!1,this._segmentToBitRateMap=new Map,this.useEME=!1,this.secretKey=null,this.decryptKey=null,this.keyValue=null,this.initTransMuxWorker(),this.seekTime=-1,this.changeBitRateTime=-1,this._PCDNState=gl,this._pcdnNodeList=[],this.loadInfo={},this.pcdnTraceInfo=null,this._loadedDataState=!1,this._PCDNSwitchCnt=0,this._isUseCDN=!0,this._curLoadSegIdx=0,this._receiveDataPos=-1,this._optionDataLenInfo={},this._lastPCDNUrl="",this._lastTargetDur=0,this.pcdnVVStat=this.resetPCDNVVStat(),this.pSCCancelCnt=0,this._lastDemuxSampleIdxRange={video:0,audio:0},this._mediaEndTime=-1}static get pcdnDownLoadReqCnt(){const{pcdn_download_request_cnt:t,pcdn_download_failed_cnt:n}=e;return e.pcdn_download_request_cnt=0,e.pcdn_download_failed_cnt=0,{pcdn_download_request_cnt:t,pcdn_download_failed_cnt:n}}static getDefaultConfig(){return{onProcessMinLen:1024,xhrSetup:null,chunkSize:8e5,isCache:!1,playerId:"",vid:"",afterLoadeddataCallBackLen:0,ext:{}}}get size(){return this.fileSize}initTransMuxWorker(){}updateSecretKey(e,t,n,i){var r;this.useEME=e,!e&&t?(this.log(er.LOG,"[updateSecretKey] ,force enableWorker"),this.options.enableWorker=!0,this.transmuxerWorkerControl||this.initTransMuxWorker()):!e&&i&&(this.keyValue=i),this.log(er.LOG,"[updateSecretKey] ,useEME, ",e,",secretKey,",t,",decryptKey",n),null==(r=this.transmuxerWorkerControl)||r.updateValue({secretKey:t,decryptKey:n})}updateLoadedDataDone(){this._loadedDataState=!0}get PCDNSwitchCnt(){return this._PCDNSwitchCnt}updateLoadInfo(e,t){this.loadInfo||(this.loadInfo={}),this.loadInfo[e]||(this.loadInfo[e]={},this.loadInfo[e].loadLen=0),this.loadInfo[e].loadLen+=t}async updatePCDNState(e){if(this._PCDNState!==ml&&this._PCDNState!==e&&this.log(er.LOG,"[pcdn state update]",this._PCDNState," - ",e),e===ml)this._PCDNState=e;else if(this._PCDNState!==ml&&this._PCDNState!==e){if(this._isUseCDN||e!==gl)this._PCDNState=e;else{if(this._PCDNState=e,this.adaptTimeRange[this._curLoadSegIdx].downloaded||this._switchBitRate)return void this.log(er.LOG,"[pcdn] switch cdn ",this._curLoadSegIdx,"downloaded",",switchBitRate, ",this._switchBitRate);await this.cancelLoading(),this.pSCCancelCnt++;const t=this._curLoadSegIdx;this.log(er.LOG,"[pcdn] cancelLoading ",t,"switch cdn load");const n=this.getFragRange(t);if(this._receiveDataPos&&this._receiveDataPos>=n[0]&&this._receiveDataPos<=n[1]){const e=n[0];n[0]=this._receiveDataPos,this.log(er.LOG,"[pcdn] switch cdn, adject range",t,JSON.stringify(n),",oldRange,",`${e} - ${n[1]}`)}this._receiveDataPos=-1,await this.startLoad(n,t)}this.log(er.LOG,"[pcdn] openPCDN ",e)}}updateNode(e){if(e&&e.length>0){const t=e.filter((e=>{if(!Object.prototype.hasOwnProperty.call(vl,Vo(null==e?void 0:e.url)))return e}));this._pcdnNodeList=t}}clearPCDNNodeList(){this.log(er.LOG,"[pcdn] clearPCDNNodeList"),this._pcdnNodeList=[]}get isUpdateNode(){return!this._pcdnNodeList||!this._pcdnNodeList.length}isUsePCDN(){var e;return"open"===this._PCDNState&&(null==(e=this._pcdnNodeList)?void 0:e.length)>0}async changeBitRate(e){e.bitrate!==this._bitRate&&(this.updateUrl(e._mainURL,e._backupURL),this._bitRate=e.bitrate,this._receiveDataPos=-1,await this.MP4Loader.changeUrl(this.url,`${this.options.vid}-${this._bitRate}`,this.CHUNK_SIZE),this._pcdnNodeList=null,this.emit(cl,this.url),this._switchBitRate=!0,this._mediaEndTime=-1,this.log(er.LOG,"[switchBitrate] changeUrl, bitRate,",this._bitRate,"url",this.url))}_getByPreload(e,t,n,i){try{if(e&&e.byteLength>=t){const r={endTime:(new Date).getTime(),startTime:(new Date).getTime(),index:i,range:[],vid:this.options.vid,from:"local"};if(n<=e.byteLength){const i=e.slice(t,n);return r.range=[t,n],r.state=!0,{buffer:i,context:r,state:!0}}{const n=e.byteLength-1,i=e.slice(t,n);return r.range=[t,n],{context:r,buffer:i,state:!1}}}return null}catch(e){return console.error("[MP4] _getByPreload",t,n,e),null}}log(e,t,...n){const{options:i}=this,r=i&&i.vid?`[MP4]${this._logTag} ${i.vid} ${t}`:`[MP4]${this._logTag} ${t}`;Oo(this.logger,e,r,...n)}async errorHandler(e,t,n={}){const{response:i,message:r}=e,s=this.options?this.options.vid:"";let a=null;if(this._isPending=!0,i){const o=tl(i.headers);if(a=new wo("network",i.status,{httpText:i.httpText,message:r,url:i.url,range:n.range,headers:o}),this.log(er.LOG,`[MP4] [${s}] errorHandler error state:[${t}],\n _isPending:[${this._isPending}] `,null==i?void 0:i.status,r),this.backUrl&&this.backUrl.length>0){const i=this.backUrl.shift();if(this.updateUrl(i,this.backUrl),this.log(er.LOG,`[${s}] errorHandler start backUpUrl retry`,this.backUrl.length,i),this._isPending=!1,this.MP4Loader&&(await this.MP4Loader.changeUrl(this.url,`${this.url}-${this._bitRate}`,this.CHUNK_SIZE),this.emit(cl,this.url)),this.emit(al,{type:"error",error:e}),"getMetaInfo"===t)return void this.getMetaInfo();if("loadFragment"===t){const{fragIndex:e,range:t}=n;if(null!==e&&e>=0&&t)return this.resetFragmentLoadState(e),void this.loadFragment(e,t)}}a.context=n,a.response=i,this.log(er.LOG,`errorHandler end, ${JSON.stringify(n)}`),this.emit(il,a,t)}else this.log(er.LOG,`errorHandler other end, ${t},${null==i?void 0:i.status}, ${r}`),a=e,a.context=n,this.emit(il,a,t)}async init(e){var t,n,i;this.url&&await this.MP4Loader.changeUrl(this.url,`${this.options.vid}-${this._bitRate}`,this.CHUNK_SIZE),this.emit(cl,this.url),this.meta=null;const{meta:r,mediaSegList:s,buffer:a,fileSize:o,initSeg:l,bitrate:c,adaptTimeRange:u,repeatData:d}=e;if(r&&r.ext){o&&(this.fileSize=o),this.meta=r,this.videoTrak=r.ext.videoTrak,this.audioTrak=r.ext.audioTrak,this.meta.videoSamplesLen=this.videoTrak.reduce(((e,t)=>e+t.frames.length),0),this.meta.audioSamplesLen=this.audioTrak.reduce(((e,t)=>e+t.frames.length),0),this._bitRate=c,this.timeRange=this.getTimeRange(),this.adaptTimeRange=function(e){const t=[];if(!e||!e.length||0===e.length)return t;for(let n=0;n0&&(null==d?void 0:d.byteLength)>0&&this.cacheRepeatData(this.adaptTimeRange[0].repeatRange,this.adaptTimeRange[0].repeatRange,d)):a&&(null==(n=this.adaptTimeRange)?void 0:n.length)>0&&(null==a?void 0:a.byteLength)>0&&this.cacheRepeatData(this.adaptTimeRange[0].range,this.adaptTimeRange[0].range,a),this.adaptTimeRange.map((e=>{e.downloaded=!1,e.isLoading=!1}));for(let e=0;ee.length)for(let n=e.length;n{var o;if(s){await this.cancelLoading();const e=new Eo(Mo.DEMUX,Po.metaError,{msg:JSON.stringify(s)});return void this.errorHandler(e,"getMetaInfo",{range:[0,this._firstLoadSize]})}!this.fileSize&&a&&(this.fileSize=Number(nl(a.headers)));const l=(null==(o=null==r?void 0:r.priOptions)?void 0:o.type)||co;if(n&&(this.cacheRepeatData([0,this._firstLoadSize],r.range,n),!this._optionDataLenInfo[l]&&(this._optionDataLenInfo[l]=0),this._optionDataLenInfo[l]+=n.byteLength),i&&this._optionDataLenInfo[l]&&(this._optionDataLenInfo[l]=0),r.meta&&!this.meta){this.firstFrameTime.metaload=$o()-t;const n=r.meta;this.videoTrak=n.videoSegments,this.audioTrak=n.audioSegments,this.timeRange=this.getTimeRange();const i=this.videoTrak.reduce(((e,t)=>e+t.frames.length),0),s=this.audioTrak.reduce(((e,t)=>e+t.frames.length),0);this.meta={...n.meta,ext:{videoTrak:this.videoTrak,audioTrak:this.audioTrak},videoSamplesLen:i,audioSamplesLen:s,fileSize:this.fileSize},this._bitRateInfoMap.set(this._bitRate,n),this.log(er.LOG,"meta reach, bitRate,",this._bitRate,this._repeatInfo.curDataPos),e&&this.emit(rl,this.meta)}if(this.meta&&i&&(this.log(er.LOG,"[getMetaInfo req end]",this._repeatInfo.curDataPos),this.metaLoading=!1),this._loadedDataState){let e=!1;this._repeatInfo.curDataPos-this._repeatInfo.usedPos>=this.options.afterLoadeddataCallBackLen&&(e=!0),this.meta&&(e||i)&&(this.log(er.LOG,"emit moov_req_progress loadeddata after",JSON.stringify(r.range)),this.emit(sl))}else this.meta&&(n||i)&&(this.log(er.LOG,"emit moov_req_progress loadeddata before",JSON.stringify(r.range)),this.emit(sl))},i=this._firstLoadSize-1;await this.MP4Loader.loadMetaProcess(this.MP4Loader.cache,[0,i],n)}catch(e){this.log(er.ERROR,"[MP4] trigger errorHandler getMetaInfo",null==(t=null==e?void 0:e.response)?void 0:t.status,null==e?void 0:e.message),this.loadError(e,"getMetaInfo",!1,{url:e.url||this.url,range:[0,this._firstLoadSize]})}}getFragmentIdx(e){let t,n;if(this.videoTrak.length){if(t=this.videoTrak.find((t=>t.startTime<=e&&t.endTime>e)),n=this.audioTrak.find((t=>t.startTime<=e&&t.endTime>e)),t&&n)return Math.min(t.index,n.index);if(t||n)return t?t.index:n.index;{let e=Number.MAX_VALUE;return this.videoTrak&&this.videoTrak.length>0&&(e=this.videoTrak.length-1),this.audioTrak&&this.audioTrak.length>0&&(e=Math.min(this.audioTrak.length-1,e)),e}}return n=this.audioTrak.find((t=>t.startTime<=e&&t.endTime>e)),n?n.index:0}async _checkHasMeta(){var e,t,n,i;let r=this._bitRateInfoMap.get(this._bitRate);if(r)this.log(er.LOG,"[switchBitrate], not need load InitSegment, bitRate, ",this._bitRate),this.meta=r.meta;else{this.log(er.LOG,"[switchBitrate], need load InitSegment, bitRate, ",this._bitRate),this.metaLoading=!0;const i=await this.MP4Loader.loadMeta(this.MP4Loader.cache,Math.round(this.CHUNK_SIZE/2));this.log(er.LOG,"[switchBitrate], loadMeta end, ",this._bitRate),this.metaLoading=!1;const{videoTrak:s,audioTrak:a}=this,o=s.reduce(((e,t)=>e+t.frames.length),0),l=a.reduce(((e,t)=>e+t.frames.length),0),c=Number(nl(null==(n=null==(t=null==(e=null==i?void 0:i.responses)?void 0:e[0])?void 0:t.response)?void 0:n.headers));this.fileSize=c,this.log(er.LOG,"[switchBitrate], fileSize set , ",c),this.meta={...i.meta,ext:{videoTrak:i.videoSegments,audioTrak:i.videoSegments},videoSamplesLen:o,audioSamplesLen:l,fileSize:c},r=i,r.fileSize=c,this._bitRateInfoMap.set(this._bitRate,i)}this.videoTrak=r.videoSegments,this.audioTrak=r.audioSegments,this.fileSize=r.fileSize,this.emit(ol,this.meta),this.emit(ll,this.meta),this.timeRange=this.getTimeRange();for(let e=0;e0){this.resetFragmentLoadState(e,!0),this.resetRepeatInfo();const t=this.getFragmentIdx(this.changeBitRateTime),n=e;if((e=this.getAdaptIdxBySrcIdx(t))<0)return void this.log(er.ERROR,"[switchBitrate] start new bitrate fragIndex error");n!==e&&this.resetFragmentLoadState(e),this._curLoadSegIdx=e;const i=this.adaptTimeRange[e];this.log(er.LOG,"[switchBitrate], need update load fragIndex",e,",oldFragIndex",n,",stTime,",this.changeBitRateTime,",newBitrateadaptTimeRange,",i.startTime,"-",i.endTime),this.emit(ul,e),this.seekTime=this.changeBitRateTime,this.changeBitRateTime=-1}this.log(er.LOG,"[switchBitrate], reset adaptTimeRange state,",e),this._needInitSegment=!0,this.resetTansmuxer(),t&&(this._switchBitRate=!1)}if(this._switchBitRate&&this.metaLoading)return;const i=this.getFragRange(e);let r=this.getFragmentFromCache(e,i);if(r&&this._needInitSegment&&!r.initSeg&&(r=null,this.log(er.LOG,"[mp4.load], segment ,",e,"Data In Cache but not has init, so not use cacheData")),r){const{video:t,audio:n}=r.muxSampleIdxRange;this._lastDemuxSampleIdxRange.video=t,this._lastDemuxSampleIdxRange.audio=n,this.log(er.LOG,"[mp4.load], segment ,",e,"Data In Cache",JSON.stringify(i),", needInit,",this._needInitSegment,",muxSampleIdxRange,",JSON.stringify(r.muxSampleIdxRange));const s=this.adaptTimeRange[e];s.downloaded=!0,s.isLoading=!0,this._needInitSegment=!1,this._loadSuccessCallBack&&this._loadSuccessCallBack(r)}else if(this.log(er.LOG,"loadFragment,",e,",bitRate,",this._bitRate,",range,",JSON.stringify(i)),this.seekTime>0){const t=this.getSubRange(e,this.seekTime,i);null==(n=this.resetDemuxSampleIdx)||n.call(this,this.seekTime,t),this.loadFragment(e,t),this.seekTime=-1}else this.loadFragment(e,i)}getFragmentFromCache(e,t){const{preloadCache:n}=this;if(!n||!n.segList)return null;let i=-1;const{segList:r,initSeg:s}=n;for(let t=0;t=t[1]){const{startTime:i=0,endTime:r=0}=this.adaptTimeRange[e],a=[i,r];return{buffer:n.buffer,range:t,muxSampleIdxRange:n.muxSampleIdxRange,context:{range:t,fragIndex:e,state:!0,adaptTimeRange:[a[0],a[1]]},state:!0,initSeg:this._needInitSegment?s:void 0}}return null}}cacheRepeatData(e,t,n){var i;if(e&&null!=e&&e.length&&null!=(i=this._repeatInfo.data)&&i.byteLength&&(this._repeatInfo.startPos<0&&t[0]+n.byteLength>=e[0]&&t[0]+n.byteLength<=e[1]+1&&(this._repeatInfo.startPos=e[0]),this._repeatInfo.startPos>=0&&t[0]+n.byteLength>=e[0]&&t[0]+n.byteLength<=e[1]+1)){const i=this._repeatInfo.startPos+this._repeatInfo.curDataPos-t[0];if(i<0)return;const r=n.slice(i);if(this._repeatInfo.curDataPos+r.byteLength0?h[0].sampleOffset:-1,f=(null==h?void 0:h.length)>0?h[h.length-1].sampleOffset:-1,g=null==d?void 0:d.samples,m=(null==g?void 0:g.length)>0?g[0].sampleOffset:-1,v=(null==g?void 0:g.length)>0?g[g.length-1].sampleOffset:-1;let y;this.updateDemuxSampleIdxRange([p,f],[m,v]),this.log(er.LOG,"[mux],videoTimeRange,",null==u?void 0:u.startPts,"-",null==u?void 0:u.endPts,",videoSampleIdx",p,"-",f,",audioTimeRange,",null==d?void 0:d.startPts,"-",null==d?void 0:d.endPts,",audioSampleIdx",m,"-",v,n,JSON.stringify(l),i);const _=i||(null==h?void 0:h.length)>0?null==u?void 0:u.startPts:-1,T=i||(null==h?void 0:h.length)>0?null==u?void 0:u.endPts:-1,b=i||(null==g?void 0:g.length)>0?null==d?void 0:d.startPts:-1,S=i||(null==g?void 0:g.length)>0?null==d?void 0:d.endPts:-1,P=[Math.min(_,b),Math.max(T,S)];if(this.FMP4Remuxer){const e=this.FMP4Remuxer.remux(this._needInitSegment,{initMerge:!0,range:l});e.initSegment&&(this._needInitSegment=!1),y={buffer:Uo(e.audioSegment,e.videoSegment),range:l,state:i,context:{range:l,fragIndex:n,timeRange:P},initSeg:e.initSegment}}else y={videoTrack:u,audioTrack:d,buffer:null,range:l,state:i,context:{range:l,fragIndex:n,timeRange:P}};r.firstmux<0&&s.startMuxTime>0&&(r.firstmux=$o()-s.startMuxTime),this._loadSuccessCallBack&&this._loadSuccessCallBack(y)}catch(i){const r=null==i?void 0:i.message;this.log(er.ERROR,"mux err:",r);const s=new Eo(Mo.REMUX,Po.muxError,{msg:r});this.errorHandler(s,"mux",{fragIndex:n,range:[t,t+e.byteLength]})}}updateDemuxSampleIdxRange(e,t){(null==e?void 0:e[1])>=0&&(this._lastDemuxSampleIdxRange.video=e[1]),(null==t?void 0:t[1])>=0&&(this._lastDemuxSampleIdxRange.audio=t[1]),this.log(er.LOG,"updateDemuxSampleIdxRange",JSON.stringify(this._lastDemuxSampleIdxRange))}async loadFragment(e,t){this._curLoadSegIdx=e;const n=this.adaptTimeRange[e];if(this._isPending||0===(null==t?void 0:t[1])||!n||n.isLoading||0===(null==t?void 0:t.length))return;this._segmentToBitRateMap.set(e,this._bitRate),this.timeRecord.startLoadTime<0&&(this.timeRecord.startLoadTime=$o());const{startPos:i,curDataPos:r}=this._repeatInfo,{usedPos:s}=this._repeatInfo;if(t.length>=2&&t[1]&&t[1]>0&&t[0]>=i&&t[1]=2&&t[0]&&t[0]>=i&&t[0]<=i+r){if(!n.isLoading){const a=Math.max(t[0],i+s),o=Math.min(t[1]+1,i+r),l=new Uint8Array(this._repeatInfo.data.slice(a-i,o-i));if(l.byteLength>0){this._repeatInfo.usedPos=o-this._repeatInfo.startPos;const n=this._repeatInfo.usedPos;return this.log(er.LOG,"[mp4.loadFragment] has part data: ",a,a+l.byteLength),this.log(er.LOG,"[mp4.loadFragment] ",",repeatInfo, startPos,",i,", usedPos,",i+n,",curDataPos, ",i+r),void this._mux(l,a,e,t[1]<=i+n)}if(!this.metaLoading&&!n.isLoading){this.log(er.LOG,"[mp4.loadFragment] load part data >>> ",i+r,t[1]),n.isLoading=!0;const a=[i+s,t[1]],o=null==n?void 0:n.repeatRange;if(o&&o[0]i)&&!n.isLoading&&(n.isLoading=!0,this.log(er.LOG,"[mp4.loadFragment],ready to load all data ,segmentIdx, ",e,",range >>> ",t),this.resetRepeatInfo(),await this.startLoad(t,e))}resetRepeatInfo(){this.log(er.LOG,", resetRepeatInfo"),this._repeatInfo.startPos=-1,this._repeatInfo.curDataPos=0,this._repeatInfo.usedPos=0}setSwitchPCDNCallBack(e){this._switchPCDNCallBack=e}updateChangeBitRateTime(e){this.changeBitRateTime=e}async startLoad(t,n,i=!1){var r,s,a,o;const{firstFrameTime:l}=this;0===n&&(null==l?void 0:l.first_gop_req_cnt)<0?l.first_gop_req_cnt=1:n>0&&(null==l?void 0:l.first_gop_req_cnt)<0&&(l.first_gop_req_cnt=0);const c=this.selectedPCDN(i),u=c||this.url;this.log(er.LOG,"[startLoad], ",n,JSON.stringify(t),u);try{await this.MP4Loader.loadData(t,this.MP4Loader.cache,{index:n,onProgress:this.onprogressDataArrive,onProcessMinLen:this.options.onProcessMinLen,url:u,headers:c?{"X-Origin-Server-Host":this._domain}:null,priOptions:{type:c?uo:co}})}catch(i){const l=(null==(s=null==(r=null==i?void 0:i.options)?void 0:r.priOptions)?void 0:s.type)===uo||!!c;let u=null;const d=i.url||(l?c:this.url);l?(this.pcdnVVStat.conn_fail_num++,e.pcdn_download_failed_cnt++,u=this._pcdnNodeList.shift(),this.emit(dl,u),this.log(er.ERROR,"pcdn load err, retry use cdn,range",t,",fragIndex",n,(null==i?void 0:i.isTimeout)||(null==(a=null==i?void 0:i.response)?void 0:a.status),null==i?void 0:i.message,d),await this.startLoad(t,n,!0)):this.log(er.ERROR,"cdn load err,range",JSON.stringify(t),",fragIndex",n,(null==i?void 0:i.isTimeout)||(null==(o=null==i?void 0:i.response)?void 0:o.status),null==i?void 0:i.message,d),this.loadError(i,"loadFragment",l,{range:t,fragIndex:n,url:d})}}loadError(e,t,n,i){var r,s;!e.response&&(e.response={}),e.isTimeout?e.response.status=Po.timeout:null!=(r=null==e?void 0:e.response)&&r.status||(e.response.status=Po.networkError);const a=Vo(null==i?void 0:i.url);this.markErrHost(a),this.emit(hl,{src:null==i?void 0:i.url,host:a,errorCode:null==(s=null==e?void 0:e.response)?void 0:s.status,message:null==e?void 0:e.message,range:(null==i?void 0:i.range)&&JSON.stringify(i.range),headers:null==i?void 0:i.headers}),n||this.errorHandler(e,t,i)}async loadAllFragmentData(t,n,i,r=!1){var s,a,o,l,c,u;if(this.hasDestroyed)return;this.resetRepeatInfo();const d=(null==(s=this.adaptTimeRange[t])?void 0:s.range)||this.getFragRange(t);this._curLoadSegIdx=t;const h=this.selectedPCDN(r),p=No(h||this.url,{__rand:(new Date).getTime()});try{this.log(er.LOG,",[loadAllFragmentData], index,",t,",rang,",JSON.stringify(d),", use-pcdn,",!!h);const e=await this.MP4Loader.loadData(d,this.MP4Loader.cache,{index:t,url:p,headers:h?{"X-Origin-Server-Host":this._domain}:null,priOptions:{type:h?uo:co}});if(this.log(er.LOG,"loadAllFragmentData after",t,JSON.stringify(d)),!e||!e.data){const e=new Error("response null");return void(i?i(e):this.loadError(e,"loadFragment",!!h,{range:d,fragIndex:t,url:h||this.url}))}const{data:r}=e;if((null==r?void 0:r.byteLength)>0&&d&&d.length>=2)this._receiveDataPos=d[0]+(null==r?void 0:r.byteLength),this._loadSuccessCallBack=n,this.adaptTimeRange[t].downloaded=!0,this.cacheRepeatData(this.adaptTimeRange[t].repeatRange,d,r),this._mux(r,d[0],t,!0);else{const n=tl(null==(a=null==e?void 0:e.response)?void 0:a.headers);this.log(er.LOG,"[FragLoadDowned check false, retry load],fragmentIdx,",t,",dataLen,",null==r?void 0:r.byteLength,JSON.stringify(d),JSON.stringify(n),p);const i=new Error("dataLen not match");this.resetRepeatInfo();const s=this.adaptTimeRange[t];this.emit(fl,[s.startTime,s.endTime]),this.loadError(i,"loadFragment",!!h,{range:d,fragIndex:t,url:p,headers:n})}}catch(r){const s=(null==(l=null==(o=null==r?void 0:r.options)?void 0:o.priOptions)?void 0:l.type)===uo||!!h;s?(e.pcdn_download_failed_cnt++,this._pcdnNodeList.shift(),this.log(er.ERROR,"[loadAllFragmentData] ,pcdn load err, retry use cdn,fragIndex",t,r.isTimeout||(null==(c=null==r?void 0:r.response)?void 0:c.status),null==r?void 0:r.message),await this.loadAllFragmentData(t,n,i,!0)):this.log(er.ERROR,"[MP4] loadAllFragmentData error",{fragIndex:t,range:JSON.stringify(d)},r.isTimeout||(null==(u=null==r?void 0:r.response)?void 0:u.status),null==r?void 0:r.message),this.loadError(r,"loadFragment",s,{range:d,fragIndex:t,url:r.url||(s?h:this.url)})}}currentLoadUseUrl(){var e;return this._isUseCDN?this.url:(null==(e=this._pcdnNodeList)?void 0:e.length)>0?this._pcdnNodeList[0].url:""}getCurSwitchPCDNCnt(){return this._PCDNSwitchCnt}selectedPCDN(t){if(this._PCDNState===ml||t)return void(this._isUseCDN=!0);let n;if(this.isUsePCDN()){if(this._isUseCDN){if(this._switchPCDNCallBack){const e=this._switchPCDNCallBack();e>0&&(this.options.switchPCDNMaxCnt=e)}if(this._PCDNSwitchCnt>=this.options.switchPCDNMaxCnt)return this._isUseCDN=!0,this.log(er.LOG,"cdn switch pcdn outlimit, curSwitchCnt ,",this._PCDNSwitchCnt,",maxCnt,",this.options.switchPCDNMaxCnt),null;this._PCDNSwitchCnt++,this.log(er.LOG,"cdn switch pcdn, curSwitchCnt,",this._PCDNSwitchCnt,",maxCnt,",this.options.switchPCDNMaxCnt)}this._isUseCDN=!1,n=No(this._pcdnNodeList[0].url,{__vid:this.options.vid}),this._lastPCDNUrl!==n&&(this.emit(cl,n),this._lastPCDNUrl=n,this.pcdnVVStat.conn_req_num+=1),e.pcdn_download_request_cnt++}else this._isUseCDN||(this.log(er.LOG,"pcdn switch cdn PCDNSwitchCnt,",this._PCDNSwitchCnt,",maxCnt,",this.options.switchPCDNMaxCnt),this.pcdnVVStat.conn_jump_num+=1),this._isUseCDN=!0;return n}async cancelLoading(){this.MP4Loader&&await this.MP4Loader.cancel(),this._optionDataLenInfo[uo]&&this._optionDataLenInfo[uo]>0&&(this.emit(pl,{load_type:uo,len:this._optionDataLenInfo[uo]}),this._optionDataLenInfo[uo]=0),this._optionDataLenInfo[co]&&this._optionDataLenInfo[co]>0&&(this.emit(pl,{load_type:co,len:this._optionDataLenInfo[co]}),this._optionDataLenInfo[co]=0)}updateUrl(e,t){const n=Vo(e);this._defaultDomain||(this._defaultDomain=n),n.indexOf("www.")<0?this._domain=n:this._domain=this._defaultDomain,this.url=e,this.backUrl=t||[]}getDataBitRate(e){return this._segmentToBitRateMap.get(e)}checkCodecH265(){return this.meta&&(this.meta.videoCodec.indexOf("hvc1")>-1||this.meta.videoCodec.indexOf("hev1")>-1)}checkCodecH266(){return this.meta&&this.meta.videoCodec.indexOf("bvc2")>-1}destroy(){this.hasDestroyed||(this.resetTansmuxer(),this.transmuxerWorkerControl&&this.transmuxerWorkerControl.destroy(),this.fileSize=0,this.totalSize=0,this._isPending=!1,this.metaLoading=!1,this.resetRepeatInfo(),delete this._repeatInfo.data,this._bitRateInfoMap.clear(),this._segmentToBitRateMap.clear(),this.MP4Loader&&(this.MP4Loader.cancel(),this.MP4Loader.destroy()),this.removeAllListeners(),this.hasDestroyed=!0,this.pcdnVVStat=this.resetPCDNVVStat())}resetPCDNVVStat(){return{try_req_node:0,req_node_succ:0,has_ret_node:0,conn_req_num:0,conn_fail_num:0,conn_jump_num:0}}resetTansmuxer(){var e;null==(e=this.resetDemuxSampleIdx)||e.call(this),this.MP4Demuxer&&this.MP4Demuxer.reset(),this.MP4Demuxer=null,this.FMP4Remuxer&&this.FMP4Remuxer.reset(),this.FMP4Remuxer=null,this.transmuxerWorkerControl&&this.transmuxerWorkerControl.reset()}getMediaEndTime(){if(this._mediaEndTime>0)return this._mediaEndTime;const{videoTrak:e,audioTrak:t}=this;if((null==e?void 0:e.length)>0){const{endTime:t}=e[e.length-1];this._mediaEndTime=this._mediaEndTime<0?t:Math.min(t,this._mediaEndTime)}if((null==t?void 0:t.length)>0){const{endTime:e}=t[t.length-1];this._mediaEndTime=this._mediaEndTime<0?e:Math.min(e,this._mediaEndTime)}return this._mediaEndTime}};ro(yl,"pcdn_download_request_cnt",0),ro(yl,"pcdn_download_failed_cnt",0);let _l=yl;class Tl extends _l{constructor(e,t,n,i=[],r,s){super(e,t,n,i,r,s),this._logTag=`${s}_${go}`}updateAdaptTimeRange(e,t){this._lastTargetDur=t;const n=this.adaptTimeRange;for(let i=0;i=r[0]&&e0?n[n.length-1].timeRangeIdx[1]:0;if(i>=this.timeRange.length)return n.length-1;for(;i=(null==(n=this.adaptTimeRange[i-1])?void 0:n.timeRangeIdx[1])){const t=this._lastTargetDur||5;this.updateAdaptTimeRange(e,t)}for(let t=0;t=n[0]&&et.startTime<=e&&t.endTime>e)),n=this.audioTrak.find((t=>t.startTime<=e&&t.endTime>e)),t&&n)return Math.min(t.index,n.index);if(t||n)return t?t.index:n.index;{let e=Number.MAX_VALUE;return this.videoTrak&&this.videoTrak.length>0&&(e=this.videoTrak.length-1),this.audioTrak&&this.audioTrak.length>0&&(e=Math.min(this.audioTrak.length-1,e)),e}}return n=this.audioTrak.find((t=>t.startTime<=e&&t.endTime>e)),n?n.index:0}resetFragmentLoadState(e,t=!1){this.log(er.LOG,", resetFragmentLoadState, fragIndex, ",e,",changeBitrate,",t);for(let n=0;n=this.timeRange.length){this.log(er.WARN,"fix adaptTimeRange fragIndex",e," ,timeRangeIdx[0] >= this.timeRange.length, so end",t[0],this.timeRange.length,",endFragment,",n),this.adaptTimeRange=this.adaptTimeRange.slice(0,n);break}t[1]>=this.timeRange.length&&(this.log(er.WARN,"fix adaptTimeRange fragIndex",e," ,timeRangeIdx[1],",t[1],">>>>",this.timeRange.length,",endFragment,",n),t[1]=this.timeRange.length,this.adaptTimeRange=this.adaptTimeRange.slice(0,n+1)),this.adaptTimeRange[n].startTime=this.timeRange[t[0]].startTime,this.adaptTimeRange[n].endTime=t[1]>=this.timeRange.length?this.timeRange[this.timeRange.length-1].endTime:this.timeRange[t[1]].endTime,this.adaptTimeRange[n].range=this.getFragRange(n)}}calculateRange(e){let t=null,n=null,i=null,r=null;const s=e1&&i[0]i[0]&&(this.adaptTimeRange[e].repeatRange=[i[0],n[1]])}}return n}getSubRange(e,t,n){const i=this.adaptTimeRange[e].timeRangeIdx;let r=i[0];for(let e=i[0];e=this.timeRange[e].startTime&&t>>>>getSubRange finalRange ",JSON.stringify(s),",oldRange,",JSON.stringify(n)),s}getSrcFragRange(e){let t=null,n=null;this.log(er.LOG,"getFragRange, timeRangeIdx, srcFragment,",JSON.stringify(e));const i=this.videoTrak;i&&(t=e0||n>0}function Sl(){return!!navigator.requestMediaKeySystemAccess&&!function(){const e=/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent),t=bl(),n=function(){const{mimeTypes:e}=navigator,t=navigator.userAgent;let n=!1;return e&&t.indexOf("Chrome")>1&&(n=Object.keys(e).some((t=>!!(e[t].type&&e[t].type.indexOf("360")>-1||e[t].type&&e[t].type.indexOf("application/vnd.chromium.remoting-viewer")>-1||e[t].description&&e[t].description.indexOf("360")>-1)))),n}(),i=navigator.userAgent.indexOf("Firefox")>0,r=navigator.userAgent.indexOf("Edge")>0;return e||t||n||i||r}()}function Pl(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const 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){console.log(e)}return!1}function Ml(){const e=window.MediaSource=window.MediaSource||window.WebKitMediaSource;return e&&"function"==typeof e.isTypeSupported}class wl{constructor(){let e,t;const n=new Promise(((n,i)=>{e=n,t=i}));return n.id=`${(new Date).getTime()}_${parseInt(100*Math.random())}`,n.resolve=function(t){e(t),n.state="fulfilled"},n.reject=function(e){t(e),n.state="rejected",n.isBreak="DESTROYED"===e},n.state="pending",n}resolve(e){}reject(e){}}class El extends as{init(){return Promise.resolve()}preloadPredict(e){return e}}const kl="h264";function Dl(e){let{mediaType:t,definition:n,codecType:i,vtype:r}=e;const{vid:s}=e;return t=t||"video",n=n||"-1",i=i||kl,r=r||os.MP4,s?`${s}#${t}#${i}#${r}#${n}`:null}function Rl(e,t){return function(e,t){let n=-1;for(let i=0;i=0}function xl(e,t){for(let n=0;n=0}const{PRELOAD_TYPES:Il}=Nr,Ll="preload_ended";let Ol=0,Al=!0,Gl=null;class $l extends ss{constructor(e,t){var n;const i=$l.getDefaultConfig(e);Object.keys(e).forEach((t=>{i[t]=e[t]})),super(i),ro(this,"_updateRealTimeSpeed",(e=>{Ol=e.speed,this.emit(ao,e)})),this.video=null,this._mp4=null,this._pendingPromise=null,this.playerId=t.playerId||"default",this._nextPreloadCount=0,this.isActive=!0,this.MP4Loader=null,this.playingVids=[],this.playingVids1=[],this.loadingCount=0;const{logCacheLevel:r,logMaxSize:s}=this.options.logCacheConfig;this.logger=new nr("[Mp4Preloader]",{logCacheLevel:r,logMaxSize:s}),void 0===e.supportHevc&&!(typeof MediaSource>"u"||!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"'))&&(this.options.supportHevc=!0),this.loadRangeType=(null==(n=this.options)?void 0:n.loadRangeType)||go,Oo(er.DEBUG,"[Preloader] new preloader, playerId",this.playerId),this.update({preloadMaxCacheCount:this.options.preloadMaxCacheCount})}static get PRELOAD_TYPES(){return Il}static get BitRateAdapter(){return Gl}static set BitRateAdapter(e){Gl=e}static getDefaultConfig(){return{supportHevc:!1,preloadTime:5,preloadSize:0,preloadType:0,segmentMinDuration:5,vtype:"MP4",codecType:"h264",preloadCacheType:1,preloadMaxCacheCount:5,globalKey:null,autoPreload:!1,reqOptions:null,getRequestOptionsCallback:null,minBufferLength:5,timeout:3e3,autoCheck:{enable:!0,interval:1e3},logCacheConfig:{logCacheLevel:2,logMaxSize:204800},pcdnConfig:{openPreloadPCDN:!1,enterMinBuffer:10,outMaxBuffer:5,pcdn_duration:2,pcdn_open:!0,openPCDN:!0,minDuration:25,trackerUrl:""},switchPCDNMaxCnt:2,retryCount:1,retryDelay:1e3,loaderType:"fetch"}}static registerPreloader(e,t){return e.vtype=os.MP4,$l.BitRateAdapter=t,new $l(e,this)}static getInfoByUniqueKey(e){return function(e){const t=e.split("#"),n=["vid","mediaType","codecType","vtype","definition"],i={};return t.forEach(((e,t)=>{i[n[t]]=e})),i}(e)}static generateUniqueKey(e){return Dl(e)}static disable(){Al=!1}static enable(){Al=!0}set codecType(e){this.options.codecType=e}get codecType(){return this.options.codecType}get vtype(){return this.options.vtype}log(e,t,...n){Oo(this.logger,e,t,...n)}update(e){Object.keys(e).forEach((t=>{this.options[t]=e[t]})),this.preloadManager.setMaxCache?this.preloadManager.setMaxCache(this.options.preloadMaxCacheCount):this.preloadManager._cacheInst._maxCache=this.options.preloadMaxCacheCount}get currentPreloadInst(){return this.preloadManager._currentPreloadInst}startCheckTask(){this.preloadManager.startCheckTask()}stopCheckTask(){this.preloadManager.stopCheckTask()}getPreloadMetaByVid(e){const{allCachedKeys:t,allCachedTimeKeys:n}=this;return function(e,t,n){const i=[];let r="";Object.keys(t).forEach((t=>{const n=function(e){if(!e)throw new Error(`key ${e} is empty`);const t=e.split("#");if(t.length<5)throw new Error(`key ${e} is not right format`);return{vid:t[0],mediaType:t[1],codecType:t[2],vtype:t[3],definition:t[4],order:-1,timeStamp:0,total:0}}(t);n.vid===e&&(i.push(n),r=t)}));let s=null;if(r){const e=function(e){const t=[];return Object.keys(e).forEach((n=>{t.push(Number(e[n]))})),t.sort(((e,t)=>e-t))}(n),t=Number(n[r]),a=function(e,t){for(let n=0;n0?i[0]:t;e.push({vid:r,bw:(null==n?void 0:n.bw)||0,pbw:(null==n?void 0:n.pbw)||0})}return e}generateUniqueKey(e){return Dl(e)}addPlayingItem(e,t){const n=this.checkPlaying("_playerId",e);n>-1?this.playingVids[n].vid=t:this.playingVids.push({vid:t,_playerId:e}),this.log(er.LOG,"addPlayingItem",n,e,t,this.playingVids)}delPlayingItem(e){const t=this.checkPlaying("_playerId",e);this.log(er.LOG,"delPlayingItem",t,e,this.playingVids),t>-1&&this.playingVids.splice(t,1)}checkPlaying(e,t){const n=this.playingVids;for(let i=0;ithis.checkIfCanPreload(),start:e=>{const t=e.payload||[];if(0===t.length)return Promise.reject(new Error("preload_is_null"));const{vid:n}=e;let i=e.vtype||os.MP4,r=e.codecType||kl;const s=this.getUserSelectDefinition(),a=this.checkCacheKey(n,t,s,i,r);if(this.log(er.LOG,`${this.playerId} ${n}`,`codecType:${r} vtype:${i} hasCache:${a}`),a||"MP3"===i)return Promise.reject(new Error(`vtype_${i}`));const o=this.getInitDefinition(t,this.options.definition,s);if(this.log(er.LOG,` ${this.playerId} ${n} getInitDefinition`,null==o?void 0:o.definition),!o)return Promise.reject(new Error("definition_error"));const{definition:l,orgDefinition:c}=o,u=o.vtype||i,d=o.codecType||r,h=e.preloadTime||this.options.preloadTime,p=e.preloadSize||this.options.preloadSize||Math.pow(25,4)-1,f=this.generateUniqueKey({vid:n,definition:l,vtype:u,codecType:d});this._nextPreloadCount>0&&this._nextPreloadCount--,Oo(er.LOG,`${n} start duration:${o.duration} preloadTime:${h} cacheKey:${f},playerId:${this.playerId}`);const g={vid:n,definition:l,orgDefinition:c,preloadTime:h,preloadSize:p,cacheKey:f,codecType:d,vtype:u,...o};return e.reqOptions&&(g.reqOptions=e.reqOptions),this.loadingCount++,this.log(er.LOG,`start preload,${n} loadingCount:${this.loadingCount},playerId:${this.playerId}`),this.start(g)},onRequest:({url:e,range:t,extData:n},i)=>this.getData(e,t,n,i)},this.loggerConfig={logger:()=>{},openLog:!1},this.predictInst=new El(this.loggerConfig)}start(e){const t={mediaInfos:{dynamic_video_list:[],dynamic_audio_list:[]},onObtain:()=>{const e=new wl;return e.resolve(t.mediaInfos),e},onTransform:()=>{const t=new wl;this._pendingPromise=t;const{preloadType:n}=this.options;return this.emit("preload_start",{...e,type:n}),n===Il.DURATION?this.loadByPreloadTime(e,t):this.loadByChunkSize(e,t),t}};return Promise.resolve(t)}getInitDefinition(e,t,n=null){let i=null;return $l.BitRateAdapter?(i=$l.BitRateAdapter.select(e,this.codecType,this.vtype),this.log(er.DEBUG,"Mp4Preloader.BitRateAdapter",null==i?void 0:i.type,null==i?void 0:i.definition,null==i?void 0:i.bitrate)):i=function(e,t){let n=null;if(!e||e.length<1)return n;for(let i=0;i{if(this.log(er.DEBUG,"[Preloader] getPreLoadData",!!e.value),e.value){const{mediaSegList:n,meta:i,type:r,buffer:s,preloadTime:a,vid:o,cacheKey:l,definition:c,orgDefinition:u,byteLength:d,duration:h,fileSize:p,from:f,vtype:g,codecType:m,initSeg:v,bitrate:y,adaptTimeRange:_,repeatData:T,memory:b}=e.value,S={vid:o,type:r,vtype:g,codecType:m,definition:c,orgDefinition:u,bitrate:y,cacheKey:l,duration:h||0,byteLength:d,from:f,adaptTimeRange:_,repeatData:T,memory:b,meta:i,preloadTime:a};r===Il.SIZE?(S.buffer=s,S.fileSize=p||0):(S.mediaSegList=n,S.fileSize=p||0,S.initSeg=v),t.resolve(S)}else t.resolve(null)})).catch((e=>{t.reject(e)})),t}async setPreLoadData(e,t){var n,i;const r=new wl,{mediaSegList:s,meta:a,vid:o,definition:l,orgDefinition:c,type:u,buffer:d,duration:h,byteLength:p,preloadTime:f,fileSize:g,from:m,vtype:v,codecType:y,initSeg:_,bitrate:T,adaptTimeRange:b,repeatData:S}=t,P={codecType:y,vtype:v,vid:o,definition:l,orgDefinition:c,cacheKey:e,type:u,from:m,meta:a,fileSize:g,adaptTimeRange:b,repeatData:S,bitrate:T,memory:0};if(P.memory+=(null==S?void 0:S.byteLength)||0,u===Il.SIZE)P.buffer=d,P.byteLength=p||0,P.preloadSize=p||0,P.preloadTime=f||0,P.fileSize=g,P.buffer&&P.buffer.byteLength>0&&(P.memory+=(null==d?void 0:d.byteLength)||0,this.setItem(e,P),r.resolve(!0));else if(P.mediaSegList=[],P.duration=h,P.byteLength=p||0,P.preloadTime=f||0,P.initSeg=_,P.memory+=(null==_?void 0:_.byteLength)||0,P.fileSize=g,s.forEach((e=>{var t;P.memory+=(null==(t=null==e?void 0:e.buffer)?void 0:t.byteLength)||0,P.mediaSegList.push(e)})),a&&0===s.length)this.log(er.LOG,"[Preloader] meta setPreLoadData1 success",e,null==(n=null==P?void 0:P.mediaSegList)?void 0:n.length),this.setItem(e,P),r.resolve(!0);else{const t=s.every((e=>!!e.buffer&&e.state));this.log(er.LOG,"[Preloader] mediaSegList setPreLoadData1 success",e,null==(i=null==P?void 0:P.mediaSegList)?void 0:i.length,t),t||r.resolve(!1),this.setItem(e,P).then((()=>{this.log(er.LOG,"[Preloader] setPreLoadData1 success",e)})),r.resolve(!0)}return r}getInitCacheData(e,t){const n={type:e,meta:null,byteLength:0,fileSize:0,bitrate:0,preloadTime:0};return e===Il.DURATION?(n.mediaSegList=[],n.initSeg=null,n.duration=0):n.buffer=null,Object.keys(t).map((e=>{n[e]=t[e]})),n}updatePreCacheData(e,t,n,i,r,s,a,o,l){const{mediaSegList:c,type:u}=e;if(u===Il.SIZE||-1===r)return e.buffer=ls(Uint8Array,e.buffer.buffer||[],new Uint8Array(t)),e;let d=-1;for(let e=0;e-1)t&&(c[d].buffer=ls(Uint8Array,c[d].buffer||[],new Uint8Array(t))),n.length>1&&(c[d].range.length>1?c[d].range[1]=n[1]:c[d].range=n),-1!==a[1]&&(i=c[d].range[1]>=a[1]),c[d].state=i;else{const{video:l,audio:u}=o;e.duration=h[1],c.push({buffer:t,range:n||[],index:r,totalRange:a||[],timeRange:[h[0],h[1]],muxSampleIdxRange:{video:l,audio:u},state:i});const d=`${null==t?void 0:t.byteLength},${JSON.stringify(n)},${r},${JSON.stringify(a)},${JSON.stringify(s)}`;this.log(er.DEBUG,`[Preloader] ${e.cacheKey} mediaSegList set, dataLen`,d)}return i&&(e.byteLength+=n[1]-n[0],e.preloadTime+=l),i}checkCacheKey(e,t,n,i=os.MP4,r=kl){const s=this.getPreloadMetaByVid(e);if(s)return this.generateUniqueKey(s);if(n){const t=this.generateUniqueKey({vid:e,definition:n,vtype:i,codecType:r});return this.hasItemSameVid(t)?t:null}for(let n=0;n=1||!this.isActive)return e=!1,e;if(this.video){const{minBufferLength:t,startPreloadControl:n,startPreloadMinBuffer:i,startPreloadMinPosTime:r}=this.options;e=function(e,t){if(!e)return!1;const n=function(e,t){const n=[0,0];if(e)for(let i=0,r=e.length;ir){if(e.currentTime>s)return!0;if(e.currentTime>e.duration/2)return!0}else if(e.currentTime+r+1>e.duration&&e.currentTime+t>e.duration-1)return!0}else{const t=e.duration>a+5?a:e.duration/2,i=Math.min(e.currentTime+a,e.duration),r=n[1]-i;if(e.currentTime>t&&(r>0||Math.abs(r)<1))return!0}return!1}(this.video,{startPreloadControl:n,startPreloadMinBuffer:i,startPreloadMinPosTime:r,minBufferLength:t})}else e=this._nextPreloadCount>0;return Oo(er.DEBUG,"[Preloader] checkIfCanPreload",!!this.video,`nextPreloadCount:${this._nextPreloadCount} ret:${e}`),e}startPreloadNext(e=1){let t=!0;return this._nextPreloadCount=e,(this.loadingCount>=1||!this.isActive)&&(t=!1),t&&this.preloadNext(),t}get realTimeSpeed(){return Ol}getRequestOption(e){const{getRequestOptionsCallback:t,reqOptions:n}=this.options;let i=null;return i=e.reqOptions?e.reqOptions:"Function"===Go(t)?t(e):n,i||{}}loadByPreloadTime(e,t){var n;const{vid:i,cacheKey:r,preloadTime:s,definition:a,orgDefinition:o,duration:l,bitrate:c}=e,{codecType:u,vtype:d,size:h}=e;let p="Array"===Go(e.url)?e.url[0].src:e.url;if(!p)return void this._endLoadFragments();p=No(p,{__vid:i});const{segmentMinDuration:f}=this.options,g=s>=f?f:s,m=this.getRequestOption({...e,url:p});this.log(er.DEBUG,"[Preloader] loadByPreloadTime",`${e.cacheKey}, definition:${e.definition},segmentMinDuration:${g}`);const v=h||Fo(c,l),y=null==(n=null==e?void 0:e.pktOffsetMap)?void 0:n.find((e=>{var t;return(null==e?void 0:e.time)===((null==(t=this.options)?void 0:t.firstLoadTimePos)||5)})),_=null==y?void 0:y.offset;this._mp4=new Tl(p,c,{segmentDuration:g,codecType:this.codecType,chunkSize:this.options.preloadSize,firstLoadSize:_,duration:l,fileSize:v,playerId:this.playerId,vid:i,useUrlRange:!1,retryCount:1,retryDelay:1e3,supportHevc:this.options.supportHevc,retryCheckFunc:Wo,switchPCDNMaxCnt:Number.MAX_VALUE,logger:this.logger,reqOptions:m,fixEditListOffset:this.options.fixEditListOffset},[],this.firstFrameTime,"[Preloader]");const T=this.getInitCacheData(Il.DURATION,{vid:i,definition:a,orgDefinition:o,cacheKey:r,codecType:u,vtype:d,bitrate:c||0});this._mp4.once("metaReady",(async n=>{var s;const a=this._mp4;a&&(this.log(er.DEBUG,`[Preloader] ${i} metaReady ${null==(s=null==T?void 0:T.mediaSegList)?void 0:s.length}`),T.meta=n,T.from=2,T.fileSize=a.size,await a.cancelLoading(),!a.hasDestroyed&&(a.metaLoading=!1,this.emit("prf_meta_ready",{...T}),await this.setPreLoadData(r,T),!a.hasDestroyed&&this.startLoadByFragments(T,e,t)))})),this._mp4.on(il,(e=>{this.log(er.ERROR,`[Preloader] ${i} loadByPreloadTime error`),this._endLoadFragments(),this.emit("error",e)})),this._mp4.on(pl,(e=>{this.bwEventEmit(i,e.load_type,e.len,null,r,e)})),this._mp4.MP4Loader.on(ao,(e=>{var t;if((null==e?void 0:e.len)>0){const n=(null==(t=null==e?void 0:e.priOptions)?void 0:t.type)||co,s=Ko(e.len,e.time);this.bwEventEmit(i,n,e.len,s,r,e)}})),this._mp4.init({})}bwEventEmit(e,t,n,i,r,s){const a=po.get(r)||{bw:0,pbw:0};(!t||t===co)&&(a.bw=a.bw+n,this.emit("prf_data_size",{vid:e,task_type:2,cdn_size:n,cdn_speed:i,...s})),po.set(r,a),this._updateRealTimeSpeed({speed:i,type:t||co})}async loadByChunkSize(e){var t;const{vid:n,cacheKey:i,definition:r,orgDefinition:s,duration:a,bitrate:o,codecType:l,vtype:c,size:u}=e,{options:d}=this;let h="Array"===Go(e.url)?e.url[0].src:e.url;if(!h)return void this._endLoadChunk();h=No(h,{__vid:n});const p=u||Fo(o,a),f=null==(t=null==e?void 0:e.pktOffsetMap)?void 0:t.find((e=>(null==e?void 0:e.time)===((null==d?void 0:d.firstLoadTimePos)||5))),g=null==f?void 0:f.offset,m=Do(a,8e5,p);this.log(er.LOG,`${n} loadByChunkSize`,e.cacheKey,e.definition,g||m);const v=this.getInitCacheData(Il.SIZE,{vid:n,definition:r,orgDefinition:s,cacheKey:i,codecType:l,vtype:c,fileSize:u,bitrate:o||0}),y=this.getRequestOption({...e,url:h});this.MP4Loader=new Ha({url:h,vid:`${n}-${o}`,retry:d.retryCount||2,retryDelay:d.retryDelay||1e3,timeout:d.timeout||3e3,...y,loaderType:d.loaderType,retryCheckFunc:Wo,openLog:Lo(),fixEditListOffset:d.fixEditListOffset}),this.MP4Loader.on(ao,(e=>{var t;if((null==e?void 0:e.len)>0){const r=(null==(t=null==e?void 0:e.priOptions)?void 0:t.type)||co,s=Ko(e.len,e.time);this.bwEventEmit(n,r,e.len,s,i)}}));try{let e=new Uint8Array(0),t=0,r=null,s=null;const a=async(a,o,l,c,u)=>{var d;if(v.fileSize||(v.fileSize=Number(nl(u.headers))),a&&l.range&&l.range[0]===t&&(e=ls(Uint8Array,e,new Uint8Array(a)),t+=a.byteLength),l.meta){await this.MP4Loader.cancel();const c=(null==(d=null==a?void 0:a.priOptions)?void 0:d.type)||co;this.bwEventEmit(n,c,e.byteLength,null,i);const u=l.meta,p=u.videoSegments,f=u.audioSegments;s={...u.meta,ext:{videoTrak:p,audioTrak:f}},v.meta=s,r=Ho(0,p,f),v.buffer=e.slice(r[0]),v.byteLength=v.buffer.byteLength;const g=Ho(1,p,f);let m=[];g[0]g[0]&&(m=[g[0],r[1]]);const y=(null==p?void 0:p.length)>0?p:f,{startTime:_}=y[0],{endTime:T}=y[0],b={startTime:_,endTime:T,range:[...r],repeatRange:m,duration:T-_,downloaded:!1,isLoading:!1,timeRangeIdx:[0,1]};v.adaptTimeRange=[b],this.log(er.LOG,`${n} loadMetaProcess ret`,i,e.byteLength,JSON.stringify(r),v.buffer.byteLength,JSON.stringify(m)),this.setPreLoadData(i,v);const S=[t,r[1]];this.log(er.LOG,`${i} loadMetaProcess end, loadOneChunk start`,o,JSON.stringify(S),t,e.byteLength),this._loadOneChunk(v,S,h,b.duration)}};await this.MP4Loader.loadMetaProcess(this.MP4Loader.cache,[0,g||m],a)}catch(e){console.error(`[Preloader] ${i} loadByChunkSize error`,e),this._endLoadChunk()}}async _loadOneChunk(e,t,n,i){if((null==t?void 0:t.length)>0&&t[0]>=t[1])return this._endLoadChunk(),void this.emit(Ll,e);const r=n,{vid:s,cacheKey:a,buffer:o}=e;try{const n=await this.MP4Loader.loadData(t,this.MP4Loader.cache,{index:0,url:r,priOptions:{}});this.log(er.LOG,`${s} _loadOneChunk`,JSON.stringify(t),a);const{response:l,data:c}=n;if(c){if(this._endLoadChunk(),l&&l.headers){const t=Fo(l.headers);t&&(e.fileSize=t)}e.buffer=Uo(o,c),e.byteLength=e.buffer.byteLength,e.preloadTime+=i,this.log(er.LOG,`${s} _loadOneChunk ret`,a,e.buffer.byteLength,null==c?void 0:c.byteLength),e.from=4,this.setPreLoadData(a,e)}else this._endLoadChunk()}catch(e){this.log(er.ERROR,`[Preloader] ${s} loadByChunkSize error`,null==e?void 0:e.message),this._endLoadChunk()}}_endLoadChunk(){this.log(er.LOG,`_endLoadChunk loadingCount:${this.loadingCount}`,this._pendingPromise?this._pendingPromise.state:null),this._pendingPromise&&(this._pendingPromise.resolve(),this._pendingPromise=null),this.loadingCount>0&&this.loadingCount--,this.MP4Loader&&(this.MP4Loader.cancel(),this.MP4Loader.destroy(),this.MP4Loader=null)}getAdaptRanges(e,t){const{timeRange:n}=e;for(let i=0;i{this.log(er.ERROR,`[Preloader] ${i} _failedCallback error`,null==e?void 0:e.message),this.emit("error",e),this._endLoadFragments()},a=async t=>{var n;if(!this._mp4)return;const{buffer:i,context:o,state:l,initSeg:c}=t,{fragIndex:u,range:d,timeRange:h}=o,{_repeatInfo:p,adaptTimeRange:f}=this._mp4,g=f[u],m=null==g?void 0:g.range,v=null==g?void 0:g.duration;!e.initSeg&&c&&(e.initSeg=c,e.adaptTimeRange=f);const y=this._mp4._lastDemuxSampleIdxRange;e.repeatData=(null==(n=p.data)?void 0:n.slice(0,p.curDataPos))||[];const _=this.updatePreCacheData(e,i,d,l,u,h,m,y,v);this.log(er.LOG,`[Preloader] ${e.cacheKey} _successCallback`,u,l,_,e),e.from=3,_&&(await this.setPreLoadData(e.cacheKey,e),u>=r.length-1?(this.log(er.LOG,`[Preloader] ${e.cacheKey} mp4.load end`,u),this.emit(Ll,e),this._endLoadFragments()):(this.log(er.LOG,`[Preloader] ${e.cacheKey} mp4.load start`,u+1),await this._mp4.loadAllFragmentData(u+1,a,s)))};await this._mp4.loadAllFragmentData(0,a,s)}_endLoadFragments(){this.log(er.LOG,`[Preloader] _endLoadFragments loadingCount:${this.loadingCount},${this.playerId}`,this._pendingPromise?this._pendingPromise.state:null),this._pendingPromise&&(this._pendingPromise.resolve(),this._pendingPromise=null),this.loadingCount>0&&this.loadingCount--,this._mp4&&(this._mp4.cancelLoading(),this._mp4.destroy(),this._mp4=null)}getFragment(e,t,n,i,r,s={}){const a=new wl;return this.getData(e,t,s,!1).then((e=>{i.createFragment(new Uint8Array(e.res),t[0]-i.mdatStart,n,{range:t,context:e.context}).then((e=>{a.resolve(e)}))})),a}getPreloadUrl({url:e,range:t,definition:n,vid:i}){return[{url:e,range:t,extData:{cacheKey:$l.generateUniqueKey({vid:i,start:t[0],end:t[1],definition:n}),vid:i,format:"mp4"}}]}getRangeList(e){const{allCachedKeys:t}=this,n={timeRange:[],contentRange:[]};for(const i in t)if(t.hasOwnProperty(i)&&i.indexOf(e)>-1){const e=i.split("#");0===e[2].indexOf("pretime")?n.timeRange.push([0,parseFloat(e[2].slice(7))]):n.contentRange.push([parseInt(e[2]),parseInt(e[3])])}return n}hasItemSameVid(e){if(!e)return null;const t=e.split("#"),n=Object.keys(this.allCachedKeys);for(let i=0;i=4&&t.length>=4&&s[0]===t[0]){if(0===s[2].indexOf("pretime")&&0===t[2].indexOf("pretime"))return r;{const e=[parseInt(s[2]),parseInt(s[3])],n=[parseInt(t[2]),parseInt(t[3])];if(n[0]>=e[0]&&n[1]>n[0]&&n[1]<=e[1])return r}}}return null}removeOthers(e=[]){const{allCachedKeys:t}=this;for(const n in t)if(t.hasOwnProperty(n)&&n.split("#").length>=1){const t=n.split("#")[0];e.every((e=>e.split("#").length>=1&&e.split("#")[0]!==t))&&(this.log(er.LOG,`remove cache:${n}`),this.cacheInst.removeItem(n))}}removeAll(){const{allCachedKeys:e}=this;for(const t in e)e.hasOwnProperty(t)&&(this.log(er.DEBUG,`remove cache:${t}`),this.cacheInst.removeItem(t))}removeAllPreloadTask(){this.preloadManager._preloadDataList=[],this.playingVids=[]}getItemSameVid(e,t){const n=this.hasItemSameVid(e);return this.log(er.DEBUG,`getItemSameVid: key:${e} checkResult:${n}`),n?this.cacheInst.getItem(n,t).then((e=>({value:e,key:n}))):Promise.resolve({})}setItem(e,t){return this.cacheInst.setItem(e,t)}removeItem(e,t){return this.cacheInst.removeItem(e,t)}get allCachedKeys(){return this.cacheInst._allCachedKeys||{}}get allCachedTimeKeys(){return this.cacheInst._allCachedTimeKeys||{}}get cacheInst(){return this.preloadManager._cacheInst}get preloadQueueList(){return this.preloadManager._preloadDataList||[]}cancelPreloadByVid(e,t){if(!e)return;const{_preloadDataList:n}=this.preloadManager,i=[];for(let t=0;te.data.vid!==t))}(t,e);this.preloadManager._preloadDataList=n;const i=this.currentPreloadInst,r=i&&i.options?i.options:{};this.log(er.LOG,"cancelPreloadByVid",e,e===r.vid,r),r.vid===e&&this.cancelLoading(),Cl(this.playingVids1,e)||this.playingVids1.push(e)}removePlayingVid(e){const t=xl(this.playingVids1,e);t>=0&&this.playingVids1.splice(t,1)}cancelLoading(){this.log(er.LOG,"cancelLoading"),this._endLoadFragments(),this._endLoadChunk()}clearTaskItem(e){const{preloadManager:t}=this;if(t._currentPreloadInst){const{_toLoadList:n}=t._currentPreloadInst,i=[];n.map((t=>(t._playerId!==e&&i.push(t),t))),t._currentPreloadInst._toLoadList=i}const n=[],i=[];this.log(er.LOG,"clearTaskItem before",e,t._preloadDataList.length),t._preloadDataList.map((t=>(t._playerId!==e?n.push(t):i.push(t.data.vid),t))),this.log(er.LOG,"clearTaskItem",e,i.join(","),t._preloadDataList.length),t._preloadDataList=n}clearTask(){const{preloadManager:e}=this;e._preloadDataList=[]}addPreloader(e){if(!e.data)return;const{_preloadDataList:t}=this.preloadManager,{vid:n}=e.data,i=Rl(t||[],n),r=Cl(this.playingVids1,n);if(this.log(er.LOG,"[Preloader] addPreloader checkIfVidInList",n,i),i||r)return;const s=Bo({},e);s.vtype||(s.vtype=os.MP4),this.addDashPreloader(s)}addPreloaderList(e=[]){const t=[],{_preloadDataList:n}=this.preloadManager;for(let i=0;i((e,t,n)=>t in e?Nl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);function Fl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n-1,Yl={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},Jl="%c[xgplayer]",Zl={config:{debug:ql?3:0},logInfo:function(e){for(var t,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r=3&&(t=console).log.apply(t,[Jl,Yl.info,e].concat(i))},logWarn:function(e){for(var t,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r=1&&(t=console).warn.apply(t,[Jl,Yl.warn,e].concat(i))},logError:function(e){var t;if(!(this.config.debug<1)){for(var n=this.config.debug>=2?"trace":"error",i=arguments.length,r=new Array(i>1?i-1:0),s=1;s0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=document.createElement(e);return r.className=i,r.innerHTML=t,Object.keys(n).forEach((function(t){var i=t,s=n[t];"video"===e||"audio"===e||"live-video"===e?s&&r.setAttribute(i,s):r.setAttribute(i,s)})),r},createDomFromHtml:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";try{var i=document.createElement("div");i.innerHTML=e;var r=i.children;return i=null,r.length>0?(r=r[0],n&&tc.addClass(r,n),t&&Object.keys(t).forEach((function(e){r.setAttribute(e,t[e])})),r):null}catch(e){return Zl.logError("util.createDomFromHtml",e),null}},hasClass:function(e,t){if(!e||!t)return!1;try{return Array.prototype.some.call(e.classList,(function(e){return e===t}))}catch{var n=e.className&&"object"===Ql(e.className)?e.getAttribute("class"):e.className;return n&&!!n.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},addClass:function(e,t){if(e&&t)try{t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.add(t)}))}catch{tc.hasClass(e,t)||(e.className&&"object"===Ql(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},removeClass:function(e,t){if(e&&t)try{t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.remove(t)}))}catch{tc.hasClass(e,t)&&t.split(/\s+/g).forEach((function(t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===Ql(e.className)?e.setAttribute("class",e.getAttribute("class").replace(n," ")):e.className=e.className.replace(n," ")}))}},toggleClass:function(e,t){e&&t.split(/\s+/g).forEach((function(t){tc.hasClass(e,t)?tc.removeClass(e,t):tc.addClass(e,t)}))},classNames:function(){for(var e=arguments,t=[],n=function(n){"String"===tc.typeOf(e[n])?t.push(e[n]):"Object"===tc.typeOf(e[n])&&Object.keys(e[n]).map((function(i){e[n][i]&&t.push(i)}))},i=0;i0&&void 0!==arguments[0]?arguments[0]:document,n=arguments.length>1?arguments[1]:void 0;try{e=t.querySelector(n)}catch(i){Zl.logError("util.findDom",i),0===n.indexOf("#")&&(e=t.getElementById(n.slice(1)))}return e},getCss:function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},padStart:function(e,t,n){for(var i=String(n),r=0|t,s=Math.ceil(r/i.length),a=[],o=String(e);s--;)a.push(i);return a.join("").substring(0,r-o.length)+o},format:function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=tc.padStart(Math.floor(e/3600),2,0),n=tc.padStart(Math.floor((e-3600*t)/60),2,0),i=tc.padStart(Math.floor(e-3600*t-60*n),2,0);return("00"===t?[n,i]:[t,n,i]).join(":")},event:function(e){if(e.touches){var t=e.touches[0]||e.changedTouches[0];e.clientX=t.clientX||0,e.clientY=t.clientY||0,e.offsetX=t.pageX-t.target.offsetLeft,e.offsetY=t.pageY-t.target.offsetTop}e._target=e.target||e.srcElement},typeOf:function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},deepCopy:function(e,t){if("Object"===tc.typeOf(t)&&"Object"===tc.typeOf(e))return Object.keys(t).forEach((function(n){"Object"!==tc.typeOf(t[n])||t[n]instanceof Node?"Array"===tc.typeOf(t[n])?e[n]="Array"===tc.typeOf(e[n])?e[n].concat(t[n]):t[n]:e[n]=t[n]:void 0===e[n]||void 0===e[n]?e[n]=t[n]:tc.deepCopy(e[n],t[n])})),e},deepMerge:function(e,t){return Object.keys(t).map((function(n){var i;"Array"===tc.typeOf(t[n])&&"Array"===tc.typeOf(e[n])?"Array"===tc.typeOf(e[n])&&(i=e[n]).push.apply(i,Kl(t[n])):tc.typeOf(e[n])!==tc.typeOf(t[n])||null===e[n]||"Object"!==tc.typeOf(e[n])||t[n]instanceof window.Node?null!==t[n]&&(e[n]=t[n]):tc.deepMerge(e[n],t[n])})),e},getBgImage:function(e){var t=(e.currentStyle||window.getComputedStyle(e,null)).backgroundImage;if(!t||"none"===t)return"";var n=document.createElement("a");return n.href=t.replace(/url\("|"\)/g,""),n.href},copyDom:function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return Array.prototype.forEach.call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},setInterval:function(e,t,n,i){e._interval[t]||(e._interval[t]=window.setInterval(n.bind(e),i))},clearInterval:function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},setTimeout:function(e,t,n){e._timers||(e._timers=[]);var i=setTimeout((function(){t(),tc.clearTimeout(e,i)}),n);return e._timers.push(i),i},clearTimeout:function(e,t){var n=e._timers;if("Array"===tc.typeOf(n)){for(var i=0;i-1&&i.indexOf(e)>-1&&(r=parseFloat(n.slice(0,n.indexOf(e)).trim()),s=parseFloat(i.slice(0,i.indexOf(e)).trim()),a=e,1))})),o.style.width="".concat(r).concat(a),o.style.height="".concat(s).concat(a),o.style.backgroundSize="".concat(r).concat(a," ").concat(s).concat(a),o.style.margin="start"===e?"-".concat(s/2).concat(a," auto auto -").concat(r/2).concat(a):"auto 5px auto 5px"),o},Hex2RGBA:function(e,t){var n=[];if(/^\#[0-9A-F]{3}$/i.test(e)){var i="#";e.replace(/[0-9A-F]/gi,(function(e){i+=e+e})),e=i}return/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,(function(e){n.push(parseInt(e,16))})),"rgba(".concat(n.join(","),", ").concat(t,")")):"rgba(255, 255, 255, 0.1)"},getFullScreenEl:function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},checkIsFunction:function(e){return e&&"function"==typeof e},checkIsObject:function(e){return null!==e&&"object"===Ql(e)},hide:function(e){e.style.display="none"},show:function(e,t){e.style.display=t||"block"},isUndefined:function(e){if(typeof e>"u"||null===e)return!0},isNotNull:function(e){return null!=e},setStyleFromCsstext:function(e,t){t&&("String"===tc.typeOf(t)?t.replace(/\s+/g,"").split(";").map((function(t){if(t){var n=t.split(":");n.length>1&&(e.style[n[0]]=n[1])}})):Object.keys(t).map((function(n){e.style[n]=t[n]})))},filterStyleFromText:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],n=e.style.cssText;if(!n)return{};var i=n.replace(/\s+/g,"").split(";"),r={},s={};return i.map((function(e){if(e){var n=e.split(":");n.length>1&&(function(e,t){for(var n=0,i=t.length;n-1)return!0;return!1}(n[0],t)?r[n[0]]=n[1]:s[n[0]]=n[1])}})),e.setAttribute("style",""),Object.keys(s).map((function(t){e.style[t]=s[t]})),r},getStyleFromCsstext:function(e){var t=e.style.cssText;if(!t)return{};var n=t.replace(/\s+/g,"").split(";"),i={};return n.map((function(e){if(e){var t=e.split(":");t.length>1&&(i[t[0]]=t[1])}})),i},preloadImg:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(e){var i=new window.Image;i.onload=function(e){i=null,t&&t(e)},i.onerror=function(e){i=null,n&&n(e)},i.src=e}},stopPropagation:function(e){e&&e.stopPropagation()},scrollTop:function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},scrollLeft:function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},checkTouchSupport:function(){return"ontouchstart"in window},getBuffered2:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,n=[],i=0;io&&(r[a-1].end=n[s].end):r.push(n[s])}else r.push(n[s])}else r=n;return new ec(r)},getEventPos:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.touches&&e.touches.length>0&&(e=e.touches[0]),{x:e.x/t,y:e.y/t,clientX:e.clientX/t,clientY:e.clientY/t,offsetX:e.offsetX/t,offsetY:e.offsetY/t,pageX:e.pageX/t,pageY:e.pageY/t}},requestAnimationFrame:function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},getHostFromUrl:function(e){if("String"!==tc.typeOf(e))return"";var t=e.split("/"),n="";return t.length>3&&t[2]&&(n=t[2]),n},cancelAnimationFrame:function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},isMSE:function(e){return e.media&&(e=e.media),!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},isBlob:function(e){return"string"==typeof e&&/^blob/.test(e)},generateSessionId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=(new Date).getTime();try{e=parseInt(e)}catch{e=0}return t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=parseInt(window.performance.now())),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))},createEvent:function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},adjustTimeByDuration:function(e,t,n){return t&&e&&(e>t||n&&e0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n={scale:"".concat(e.scale||1),translate:"".concat(e.x||0,"%, ").concat(e.y||0,"%"),rotate:"".concat(e.rotate||0,"deg")};return Object.keys(n).forEach((function(e){var i=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),r="".concat(e,"(").concat(n[e],")");i.test(t)?(i.lastIndex=-1,t=t.replace(i,r)):t+="".concat(r," ")})),t},convertDeg:function(e){return Math.abs(e)<=1?360*e:e%360},getCurrentTimeByOffset:function(e,t){var n=-1;if(!t||t.length<0)return e;for(var i=0;it[n-1].end)i=n-1;else for(var r=1;rt[r-1].end&&e<=t[r].end){i=r;break}return i},getOffsetCurrentTime:function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if((n=i>=0&&i=a&&e<=o?e-c:e>o&&n>=r-1?o-c:-1}},nc=/(Android)\s([\d.]+)/,ic=/(Version)\/([\d.]+)/,rc=["avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","avc1.42E01E","mp4v.20.8","mp4v.20.8, mp4a.40.2","mp4v.20.240, mp4a.40.2"],sc={get device(){return sc.os.isPc?"pc":"mobile"},get browser(){if(typeof navigator>"u")return"";var e=navigator.userAgent.toLowerCase(),t={ie:/rv:([\d.]+)\) like gecko/,firefox:/firefox\/([\d.]+)/,chrome:/chrome\/([\d.]+)/,opera:/opera.([\d.]+)/,safari:/version\/([\d.]+).*safari/};return[].concat(Object.keys(t).filter((function(n){return t[n].test(e)})))[0]},get os(){if(typeof navigator>"u")return{};var e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),n=/(?:SymbianOS)/.test(e)||t,i=/(?:Android)/.test(e),r=/(?:Firefox)/.test(e),s=/(?:iPad|PlayBook)/.test(e)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,a=s||i&&!/(?:Mobile)/.test(e)||r&&/(?:Tablet)/.test(e),o=/(?:iPhone)/.test(e)&&!a;return{isTablet:a,isPhone:o,isIpad:s,isIos:o||s,isAndroid:i,isPc:!(o||i||n||a),isSymbian:n,isWindowsPhone:t,isFireFox:r}},get osVersion(){if(typeof navigator>"u")return 0;var e=navigator.userAgent,t="",n=(t=/(?:iPhone)|(?:iPad|PlayBook)/.test(e)?ic:nc)?t.exec(e):[];if(n&&n.length>=3){var i=n[2].split(".");return i.length>0?parseInt(i[0]):0}return 0},get isWeixin(){return!(typeof navigator>"u")&&!!/(micromessenger)\/([\d.]+)/.exec(navigator.userAgent.toLocaleLowerCase())},isSupportMP4:function(){var e={isSupport:!1,mime:""};if(typeof document>"u")return e;if(this.supportResult)return this.supportResult;var t=document.createElement("video");return"function"==typeof t.canPlayType&&rc.map((function(n){"probably"===t.canPlayType('video/mp4; codecs="'.concat(n,'"'))&&(e.isSupport=!0,e.mime+="||".concat(n))})),this.supportResult=e,t=null,e},isMSESupport:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if(typeof MediaSource>"u"||!MediaSource)return!1;try{return MediaSource.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}},isHevcSupported:function(){return!(typeof MediaSource>"u"||!MediaSource.isTypeSupported)&&(MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"'))},probeConfigSupported:function(e){var t={supported:!1,smooth:!1,powerEfficient:!1};if(!e||typeof navigator>"u")return Promise.resolve(t);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(e);var n=e.video||{},i=e.audio||{};try{var r=MediaSource.isTypeSupported(n.contentType),s=MediaSource.isTypeSupported(i.contentType);return Promise.resolve({supported:r&&s,smooth:!1,powerEfficient:!1})}catch{return Promise.resolve(t)}}},ac="3.0.28",oc={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},lc=Vl((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};Ul(this,e);var i=t&&t.i18n?t.i18n.ERROR_TYPES:null;if(t.media){var r=n.mediaError?n.mediaError:t.media.error||{},s=t.duration,a=t.currentTime,o=t.ended,l=t.src,c=t.currentSrc,u=t.media,d=u.readyState,h=u.networkState,p=n.errorCode||r.code;oc[p]&&(p=oc[p]);var f={playerVersion:ac,currentTime:a,duration:s,ended:o,readyState:d,networkState:h,src:l||c,errorType:n.errorType,errorCode:p,message:n.errorMessage||r.message,mediaError:r,originError:n.originError?n.originError.stack:"",host:tc.getHostFromUrl(l||c)};return n.ext&&Object.keys(n.ext).map((function(e){f[e]=n.ext[e]})),f}if(arguments.length>1){for(var g={playerVersion:ac,domain:document.domain},m=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],v=0;v3?i-3:0),s=3;s2&&void 0!==arguments[2]?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),!this.__hooks[e]&&(this.__hooks[e]=null),function(){var i=arguments,r=this;if(n.pre)try{var s;(s=n.pre).call.apply(s,[this].concat(Array.prototype.slice.call(arguments)))}catch(t){throw t.message="[pluginName: ".concat(this.pluginName,":").concat(e,":pre error] >> ").concat(t.message),t}if(this.__hooks&&this.__hooks[e])try{var a,o=(a=this.__hooks[e]).call.apply(a,[this,this].concat(Array.prototype.slice.call(arguments)));o?o.then?o.then((function(e){!1!==e&&pc.apply(void 0,[r,t,n.next].concat(Kl(i)))})).catch((function(e){throw e})):pc.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments))):void 0===o&&pc.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments)))}catch(t){throw t.message="[pluginName: ".concat(this.pluginName,":").concat(e,"] >> ").concat(t.message),t}else pc.apply(void 0,[this,t,n.next].concat(Array.prototype.slice.call(arguments)))}.bind(this)}function gc(e,t){var n=this.__hooks;if(n)return n.hasOwnProperty(e)?(n&&(n[e]=t),!0):(console.warn("has no supported hook which name [".concat(e,"]")),!1)}function mc(e,t){var n=this.__hooks;n&&delete n[e]}function vc(e,t){Zl.logError("[".concat(e,"] event or callback cant be undefined or null when call ").concat(t))}var yc=function(){return Vl((function e(t){Ul(this,e),tc.checkIsFunction(this.beforeCreate)&&this.beforeCreate(t),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e.__hooks={},t&&t.map((function(t){e.__hooks[t]=null})),Object.defineProperty(e,"hooks",{get:function(){return e.__hooks&&Object.keys(e.__hooks).map((function(t){if(e.__hooks[t])return t}))}})}(this),this.__args=t,this.__events={},this.__onceEvents={},this.config=t.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(t)}),[{key:"beforeCreate",value:function(e){}},{key:"afterCreate",value:function(){}},{key:"beforePlayerInit",value:function(){}},{key:"onPluginsReady",value:function(){}},{key:"afterPlayerInit",value:function(){}},{key:"destroy",value:function(){}},{key:"__init",value:function(e){this.player=e.player,this.playerConfig=e.player&&e.player.config,this.pluginName=e.pluginName?e.pluginName.toLowerCase():this.constructor.pluginName.toLowerCase(),this.logger=e.player&&e.player.logger}},{key:"updateLang",value:function(e){e||(e=this.lang)}},{key:"lang",get:function(){return this.player.lang}},{key:"i18n",get:function(){return this.player.i18n}},{key:"i18nKeys",get:function(){return this.player.i18nKeys}},{key:"domEventType",get:function(){var e=tc.checkTouchSupport()?"touch":"mouse";return this.playerConfig&&("touch"===this.playerConfig.domEventType||"mouse"===this.playerConfig.domEventType)&&(e=this.playerConfig.domEventType),e}},{key:"on",value:function(e,t){var n=this;e&&t&&this.player?"string"==typeof e?(this.__events[e]=t,this.player.on(e,t)):Array.isArray(e)&&e.forEach((function(e){n.__events[e]=t,n.player.on(e,t)})):vc(this.pluginName,"plugin.on(event, callback)")}},{key:"once",value:function(e,t){var n=this;e&&t&&this.player?"string"==typeof e?(this.__onceEvents[e]=t,this.player.once(e,t)):Array.isArray(e)&&e.forEach((function(i){n.__onceEvents[i]=t,n.player.once(e,t)})):vc(this.pluginName,"plugin.once(event, callback)")}},{key:"off",value:function(e,t){var n=this;e&&t&&this.player?"string"==typeof e?(delete this.__events[e],this.player.off(e,t)):Array.isArray(e)&&e.forEach((function(i){delete n.__events[e],n.player.off(i,t)})):vc(this.pluginName,"plugin.off(event, callback)")}},{key:"offAll",value:function(){var e=this;["__events","__onceEvents"].forEach((function(t){Object.keys(e[t]).forEach((function(n){e[t][n]&&e.off(n,e[t][n]),n&&delete e[t][n]}))})),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(e){var t;if(this.player){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:{};if(this.player){var i=Xl(Xl({},n),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,i)}}},{key:"hook",value:function(e,t){return fc.call.apply(fc,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r2?n-2:0),r=2;r1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.player)return n&&(t.pluginName=n),this.player.registerPlugin({plugin:e,options:t})}},{key:"getPlugin",value:function(e){return this.player?this.player.getPlugin(e):null}},{key:"__destroy",value:function(){var e=this,t=this.player,n=this.pluginName;this.offAll(),tc.clearAllTimers(this),tc.checkIsFunction(this.destroy)&&this.destroy(),["player","playerConfig","pluginName","logger","__args","__hooks"].map((function(t){e[t]=null})),t.unRegisterPlugin(n),this.__hooks=null}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&Object.defineProperty(e,n,t[n])}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}])}();class _c{constructor(e){Bl(this,"onTick",(e=>{this&&(this.cancelPending&&this.cancelPending(),this.alive&&(this.onTick_&&this.onTick_(),e&&e()))})),this.onTick_=e,this.timeoutId=null,this.alive=!0}tickAfter(e,t=null){return this.cancelPending?this.cancelPending():this.cancelPending=()=>{clearTimeout(this.timeoutId),this.timeoutId=null},this.alive=!0,this.timeoutId=setTimeout(this.onTick,1e3*e,t),this}tickEvery(e){this.tickAfter(e,(()=>{this.tickEvery(e)}))}stop(){this.alive=!1,this.cancelPending&&(this.cancelPending(),this.cancelPending=null)}}class Tc extends j.EventEmitter{constructor(e){super(),this.masterTimer=void 0,this.onVisibleChange=()=>{const e=this.masterTimer||this.workerTimer;this.stop(),e&&this.start()},this.options=e,document.addEventListener("visibilitychange",this.onVisibleChange)}start(){const{frequency:e}=this.options;this.stop(),this.masterTimer=new _c((()=>{try{(this.masterTimer||this.workerTimer)&&this.emit(yo)}catch{}})),this.masterTimer.tickEvery(e)}stop(){this.workerTimer&&(this.workerTimer=void 0),this.masterTimer&&(this.masterTimer.stop(),this.masterTimer=void 0)}destroy(){this.removeAllListeners(),document.removeEventListener("visibilitychange",this.onVisibleChange),this.stop()}}const bc="DESTROYED",Sc="xglog_cache",Pc="degrade",Mc="fps_stuck";let wc=null,Ec=null,kc=null,Dc=null,Rc=null,xc=0,Cc=null;class Ic extends yc{constructor(e){var t,n;super(e),Bl(this,"_onChangeConfig",(e=>{if(e){const t=e.nextBufferLength===this.config.minBufferLength;if(this.setConfig(e),e.nextBufferLength&&!t)try{this._onTimeUpdate()}catch{}}})),Bl(this,"fpsStuckHandle",(e=>{const{player:t,mse:n}=this;if(this.fpsStuckTime||(this.fpsStuckTime=e.currentTime,this.log(er.LOG,"fpsStuckHandle, currentTime,",e.currentTime)),this.fpsStuckTime>0){const e=t.bufferedPoint;n.clearOpQueues(mr.VIDEO),this.log(er.LOG,"fpsStuckHandle, remove,",e.start,"-",e.end,",seekTime,",this.fpsStuckTime),null==n||n.remove(mr.VIDEO,e.start,e.end).then((()=>{t.currentTime=this.fpsStuckTime,this.fpsStuckTime=null}))}})),Bl(this,"_retryHook",(()=>{const{player:e,playerConfig:t}=this,{paused:n}=e;this.softDecode?e.vtype="MP4_MSE_SOFT":e.vtype="MP4_MSE",this._defInited=!1;const i=e.currentTime||0;return this.log(er.LOG,"retryHook ",t.vid,this.codecType,i),this._addMetaDataEvent((()=>{i&&(e.currentTime=i,this.log(er.LOG,"retryHook update currentTime",t.vid,this.codecType,i)),n?e.pause():e.play(),this._removeMetaDataEvent()})),this.destroyMSE(),this._reset(),this.playerStartInit(t.url),!1})),Bl(this,"_playHook",((e,...t)=>{this._usePaused=!1,this._canceLoading=!1,this.log(er.LOG,"playHook"),this._startProgress()})),Bl(this,"_pauseHook",((e,...t)=>{var n,i;this._usePaused=!0,this.log(er.LOG,"pauseHook",t[0],null==(n=this.player)?void 0:n.currentTime),t.indexOf(null==(i=vo)?void 0:i.BUFFER_CONTROLS)<0&&(clearTimeout(this.checkResumePlayTimer),this.checkResumePlayTimer=null,this.log(er.LOG,"pause hook clear buffer_control state")),this._loadStuckCheck()})),Bl(this,"abrSwitchURL",(async e=>{const{playerConfig:t}=this,n=t.definition.list;let i=0;for(let t=0;t{this._requestTimer&&this._onTimeUpdate()})),Bl(this,"changeDefineCanPlay",((e,t,n,i)=>{const{player:r}=this;if(r.ended)return void(r.currentTime=0);const{_changeDefState:s}=this;r.currentTime=s?s.currentTime:e,(s?s.paused:t)?r.pause():r.play(),this._changeDefState=null,r.emit(hc,{from:n,to:i})})),Bl(this,"changeDefinition",((e,t,n)=>{var i,r;const{player:s,playerConfig:a,mp4:o,config:l}=this;if(t||(t=s.curDefinition),this._MSEError=!1,this._isReceiveEndedEvent=!1,this.useVideoLoad)return"__auto__"===e.url&&(e.url=a.definition.list[0].url),void kc.call(this.player,e,t);const{definitionList:c}=s,u=c.filter((t=>t.definition===e.definition));u.length>0&&(e=u[0]);const d=this._handlerUrl(e.url);if(!d)return;if(l._mainURL=d.main,l._backupURL=d.backup,e._mainURL=l._mainURL,e._backupURL=l._backupURL,l.switchBitRateWay&&!n)return void this.oldChangeDefinition(e,t);const h="自动"===e.definition||"auto"===e.definition;if(n)this.log(er.LOG,"[switchBitrate:ABR], ready to switch bitRate, ",e.bitrate,e.definition);else{let n=!1;if(h)this._abrService&&this._abrService.enable(),n=!0;else{this._abrService&&this._abrService.disable();const n=null==(i=a.definition)?void 0:i.list;if(n&&(!e.bitrate||!e.uri||!e.size||!e.duration))for(let i=0;i{this._abrService&&this._abrService.updateAutoDefiDesc(s.curDefinition.definition,!h)})),n&&(e=s.curDefinition),this.log(er.LOG,"[switchBitrate:CBS],switch bitRate, ",e.bitrate,e.definition)}if(s.curDefinition=e,this.mp4.clearPCDNNodeList(),this.checkPCDN(),!o)return;["keyValue","kid","secretKey","drm","getLicenseUrl","drmKeyToken","sessionId"].forEach((t=>{l[t]=e[t]}));let p=null;Jo(this.config)?(this._initSecret(),p=this._secretkey.getLicenseSecret()):(p=new wl,p.resolve()),p.then((async i=>{var r;null!=i&&i.secretKey&&(!l.keyValue&&(l.secretKey=i.secretKey),l.decryptKey=i.decryptKey),a.url=e.url;let c=0,u=!1;if(this._abrService&&this._abrService.isCurrentInAbr()){const e=s.getBufferedRange(s.buffered2);c=e[1],c0&&f[1]-s.currentTime>5&&(!this._abrService||!g)&&(this.mse.clearOpQueues(mr.VIDEO),this.removeBuffer(mr.VIDEO,s.currentTime+5,f[1])),this.log(er.LOG,"switchBitrate: resetFragmentLoadState,",h),o.resetFragmentLoadState(h),this._curLoadSegmentIdx=h,await this.mp4.changeBitRate(e),this._setCurrentDefinition(e.bitrate),this._emitDefinitionChangeDetailEvent(c),this.canDownload=!0,this._onTimeUpdate();const m={width:e.width||e.vwidth,height:e.height||e.vheight};s.emit("RESOLUTION_UPDATE",m)})).catch((t=>{this.log(er.ERROR,"switchBitrate: GET_LICENSE_ERROR,",null==t?void 0:t.message);const n=new lc(this.player,{errorType:Mo.DRM,errorCode:Po.drm,errorMessage:(null==t?void 0:t.message)||"GET_LICENSE_ERROR",vid:a.vid});t.errorType="GET_LICENSE_ERROR",this.emit("GET_LICENSE_ERROR",n),this.changeState("LICENSE_ERROR",{d:e.definition})}))})),Bl(this,"_onVideoError",(e=>{var t,n,i,r;const{player:s}=this;this.changeState("video_error",{code:e.code||(null==(n=null==(t=null==s?void 0:s.video)?void 0:t.error)?void 0:n.code),message:e.message||(null==(r=null==(i=null==s?void 0:s.video)?void 0:i.error)?void 0:r.message),videoType:this.useVideoLoad})})),Bl(this,"removeBuffer",((e,t,n,i)=>{var r;const s=this.getBufferDur();null==(r=this.mse)||r.remove(e,t,n).then((()=>{const e=this.getBufferDur(),t=s-e;t>0&&(this.emit("removeBuffer",{removeDur:t}),this.log(er.LOG,"removeBuffer dur,",t)),i&&i()}))})),Bl(this,"_onPause",(()=>{this._loadStuckCheck()})),Bl(this,"_onPlaying",(()=>{var e,t,n;this.changeState("playing",{curtime:this.player.currentTime,buffer:JSON.stringify(null==(t=null==(e=this.player)?void 0:e.buffered2)?void 0:t.bufferedList)}),this._waitAdjustTimeCnt>0&&this._waitInBufferTimer&&(this._waitAdjustTimeCnt-=1,this.changeState("waitInBuffer_resume"),this.log(er.WARN,"[waitInBuffer resume play], waitAdjustTimeCnt,",this._waitAdjustTimeCnt)),clearTimeout(this._waitInBufferTimer),this._waitInBufferTimer=null;const{mp4:i,player:r}=this,{resumePlayWaterLevel:s}=this.config;if(i){if(!(i&&i.meta&&i.meta.duration-r.currentTime<=s)&&(this.waitLevelStartTime<0&&(this.waitLevelStartTime=r.currentTime),this.playFlag||(this.playFlag=!0),s>0&&r.currentTime-this.waitLevelStartTime>=2)){const e=r.getBufferedRange(r.buffered2);e[1]>0&&e[1]-r.currentTime0&&(clearTimeout(this.checkResumePlayTimer),this.checkResumePlayTimer=null,r.isBufferControlPaused&&(r.isBufferControlPaused=!1),r.paused&&r.play())})),Bl(this,"_lowDecoder",(e=>{var t,n;const i=Yo(this.player);this.log(er.WARN,`H265 lowdecode: ${this.playerConfig.vid} `,i,", h265Degrade, ",this.config.h265Degrade),this.config.h265Degrade&&this._onDegrade({errorCode:null==(t=null==e?void 0:e.detail)?void 0:t.code,errorMessage:null==(n=null==e?void 0:e.detail)?void 0:n.message,...e.detail})})),Bl(this,"_onError",(e=>{this._onDegrade(e)})),Bl(this,"_onDegrade",((e,t=!1)=>{var n;const{player:i,playerConfig:r,config:s}=this;qo(i,"warning",this._onDegrade),qo(i,"error",this._onError),null==(n=this.mp4)||n.destroy();const{currentTime:a}=i;this.log(er.WARN,"[h265 degrade], vid,",r.vid,",currtime,",a);const o=(null==e?void 0:e.errorCode)||-1;if(this.emit(Pc,{errorCode:o,errorMessage:(null==e?void 0:e.errorMessage)||(null==e?void 0:e.message),codecType:this.codecType,mediaType:r.mediaType,passive:t?1:0,isSoftWareDecodeError:o>1e4}),null!=s&&s.H264Config){const{H264Config:e}=s;["drm","getLicenseUrl","kid","keyValue","secretKey","isEncrypt","useEME"].forEach((t=>{s[t]=e[t]||null}))}const l={mp4encryptplayer:s,mediaType:"video",codecType:_o},c=(null==r?void 0:r.H264DefinitionList)||[];if(c.length>0){r.definition.list=c,r.url=c[0].url,r.defaultBitrate=c[0].bitrate,r.defaultDefinition=c[0].definition,this.config.needPreloadCheck=!0,this.isH265DegradeH264=!0,i.playNext(l,!1);const e=()=>{i.currentTime=a,this.isH265DegradeH264=!1,this.log(er.LOG,"H265DegradeH264 update currentTime",a),this._removeMetaDataEvent()};this._addMetaDataEvent(e)}else i.pause(),this._reset(),this.checkReUseMSE(!1),this.log(er.ERROR,"H265 error,degrade h264 but no h264 url"),this.emit("error",e)})),Bl(this,"_onMp4MetaReady",(e=>{var t,n;if(!this.mp4)return;const i=this.firstFrameTime;i.metaload=this.mp4.firstFrameTime.metaload,i.bitrate=this.player.curDefinition.bitrate;const r=this._checkMetaInfo(e);if(this.emit(rl,{...e,error:r,timeRange:(null==(t=this.mp4)?void 0:t.timeRange)||[]}),r)this._errorHandler(r);else{try{this._initEME(this.mp4,e),this.softDecode?(this.log(er.LOG,"initH265MseProxy"),this._initH265MseProxy()):this.player.video instanceof HTMLVideoElement&&(this.log(er.LOG,"initMse"),this._initMse(e)),null==(n=this._initPromise)||n.resolve()}catch(e){return void this._errorHandler(new lc(this.player,{errorType:Mo.MEDIA,errorCode:Po.eme_hijack,errorMessage:(null==e?void 0:e.message)||"eme or mse catch err",vid:this.playerConfig.vid}))}if(this.mp4&&this.mp4.timeRange){const e=[];this.mp4.timeRange.every((t=>(e.push({startTime:t.startTime,endTime:t.endTime}),!0))),this.emit("KEYFRAMETIME",e)}this._loadData()}})),Bl(this,"_onMp4Error",(async(e,t)=>{const{vid:n}=this.playerConfig;console.error("[Index] _onMp4Error",n,e),this.changeState("MP4_ERROR",{state:t,errmsg:(null==e?void 0:e.errorMessage)||(null==e?void 0:e.message),errorType:null==e?void 0:e.errorType,code:null==e?void 0:e.errorCode,httpCode:null==e?void 0:e.httpCode}),this._errorHandler(e)})),Bl(this,"_onMp4Progress",(e=>{this.emit("progress_event",e)})),Bl(this,"_onMp4DataCallBack",(()=>{this._isMseInit&&this._onTimeUpdate()})),Bl(this,"_updateDrmConfig",(e=>{const{config:t,mp4:n}=this;n.updateSecretKey(t.useEME,t.secretKey,t.decryptKey,t.keyValue),this._secretkey&&e.kid&&this._secretkey.updateKid(e.kid)})),Bl(this,"_updateMSE",(e=>{const{player:t}=this;t.video instanceof HTMLVideoElement&&(this.log(er.LOG,"updateMse",e.videoCodec),this._initMse(e))})),Bl(this,"_onVideoTimeUpdate",(()=>{var e,t;const{mse:n,player:i}=this;this.waitLevelStartTime<0&&(this.waitLevelStartTime=i.currentTime),this.checkReStartTimer(),this._isEnded(),i.isSeeking&&(i.isSeeking=!1),!this.useVideoLoad&&n&&this._removeBuffeEndTime>0&&i.currentTime>this._removeBuffeEndTime+1&&(this.log(er.LOG,"remove old bitrate buffer",this._removeBuffeEndTime),this.removeBuffer(mr.VIDEO,0,this._removeBuffeEndTime-1),this._removeBuffeEndTime=0);const r=this._definitionChangePointInfo;if(r&&i.currentTime>r.changeStartTime){i.emit(hc,r.changeInfo);const n=r.changeInfo||{};this.log(er.LOG,hc,", currentTime,",i.currentTime,",from ",null==(e=null==n?void 0:n.from)?void 0:e.definition," to ",null==(t=null==n?void 0:n.to)?void 0:t.definition),this._definitionChangePointInfo=null}!this.useVideoLoad&&null===this._requestTimer&&!this._offineLine&&!this._canceLoading&&this._startProgress()})),Bl(this,"_onBufferedReset",(()=>{this.mp4&&this.mp4.videoTrak&&this.mp4.resetFragmentLoadState(0)})),Bl(this,"_onOnlineHandler",(()=>{this._offineLine=!1;const{playerConfig:e,player:t}=this,{currentTime:n,paused:i}=t;if(this.log(er.LOG,"online useVideoLoad:",this.useVideoLoad,this._hasStartProgressBack),this.useVideoLoad){const r=()=>{n&&(t.currentTime=n),this.log(er.LOG,"onOnlineHandler update currentTime",e.vid,this.codecType,this._currentTime),i?t.pause():t.play(),this._removeMetaDataEvent()};this._addMetaDataEvent(r),this._setPlayerSrc(e.url)}else this._hasStartProgressBack&&this._startProgress(),this._hasStartProgressBack=!1})),Bl(this,"_onOfflineHandler",(()=>{this._offineLine=!0,this.log(er.LOG,"offline, ",this._hasStartProgress),this._hasStartProgress&&(this._stopProgress(),this._hasStartProgressBack=!0)})),Bl(this,"_loadDataSuccess",(e=>{var t,n,i;if(this.isDestroy||!this.mse&&!this.mseProxy)return;const r=this.firstFrameTime;if(r.startload_stmux<0){const{startMuxTime:e,firstmux:t}=this.mp4.firstFrameTime;r.startload_stmux=e,r.firstmux=t}r.loadst_loadeddata<0&&(r.loaddata=$o()-this.loadstart);try{e.initSeg&&(this._appendInitSeg(e.initSeg),(!e.buffer||e.buffer.byteLength<1)&&this._onTimeUpdate());const{buffer:r,state:s,context:a,videoTrack:o,audioTrack:l}=e;this.debugInfo.loadIndx=a?a.fragIndex:-1;const c=null==(i=null==(n=null==(t=this.mp4)?void 0:t.adaptTimeRange[a.fragIndex])?void 0:n.timeRangeIdx)?void 0:i[1];if(this.mse&&s&&(!r||r.byteLength<=0)&&c>=this.mp4.timeRange.length){const{buffered:e}=this.player;e&&(null==e?void 0:e.length)>0&&(this.bufferEndTime=e.end(e.length-1)),this._isEnded(),this.log(er.LOG,"loaded ended !!!==>>>",JSON.stringify(a.range),", fragIndex,",a.fragIndex,", bufferEndTime,",this.bufferEndTime,",meta_duration,",this.mp4.meta.duration)}if(r&&this.mse){if(r&&r.byteLength>0){this._appendBuffer(mr.VIDEO,r,a,s);const e=this.getDataBitRate(a.fragIndex);this.player.emit("addVideoBufferEnd",{start:Math.floor(a.startPts),end:a.endPts,bandwidth:e.bitrate})}}else this.mseProxy&&(o&&o.samples.length>0||l&&l.samples.length>0)&&(this.log(er.LOG,"[livevideo] append,index,",a.fragIndex,",range,",JSON.stringify(e.context.range),", timeRange,",a.timeRange),this.mseProxy.appendBuffer(o,l))}catch(e){this.changeState("APPEND_DATA_ERROR",{errMsg:null==e?void 0:e.message});const t=new lc(this.player,{errorType:Mo.MEDIA,errorCode:Po.mseAppend,vid:this.playerConfig.vid,errorMessage:e.message,mediaError:{code:Po.mseAppend,message:e.message}});this._errorHandler(t)}null!=e&&e.state&&this._onTimeUpdate()})),Bl(this,"_onResumePlaying",(()=>{this._resumePlay=!0})),Bl(this,"_seekOnce",(e=>{const{player:t}=this;t&&(t.currentTime=e+.1*Math.pow(2,this._currentSeekTimes||0),this._currentSeekTimes++,this.log(er.LOG,`当前第${this._currentSeekTimes}次Seek,currentTime=${null==t?void 0:t.currentTime}`))})),Bl(this,"_onWaiting",(()=>{var e,t,n;this.checkReStartTimer(),this._isEnded();const i=null==(t=null==(e=this.player)?void 0:e.buffered2)?void 0:t.bufferedList;this.changeState("waiting",{curtime:this.player.currentTime,buffer:JSON.stringify(i)});const{player:r,config:s,playerConfig:a,mp4:o}=this;clearTimeout(this._waitInBufferTimer),this._waitInBufferTimer=null;const l=r.currentTime;this.log(er.LOG,",[onWaiting],curTime, ",l,",buffer,",JSON.stringify(i),",dur,",null==(n=null==o?void 0:o.meta)?void 0:n.duration);const c=r.bufferedPoint;c.end>0&&c.end-l>=2?this._waitAdjustTimeCnt{this._waitAdjustTimeCnt++,this.changeState("waitInBuffer_seek",{waitAdjustTimeCnt:this._waitAdjustTimeCnt,curTime:l}),r.currentTime=r.currentTime+.5}),s.waitingInBufferTimeOut):this._errorHandler(new lc(this.player,{errorType:Mo.RUNTIME,errorCode:Po.waitTimeout,errorMessage:"onWaitTimeout_in_buffer",vid:a.vid})):this._loadStuckCheck()})),Bl(this,"_onEnded",(()=>{this.log(er.LOG,"[player.onEnded], stopProgress"),this._stopProgress()})),Bl(this,"_errorHandler",(e=>{const{player:t,playerConfig:n,preLoadData:i}=this;if(!t||this.useVideoLoad)return;if(e.errorCode===Po[403]&&this._emitExpireEvent(e)&&this.config.urlExpireDisableErrorEvent)return this.log(er.LOG,"_errorHandler urlExpireDisableErrorEvent",this.config.urlExpireDisableErrorEvent,",errorCode,",e.errorCode),this._stopProgress(),void this.emit(Sc);if("object"!=typeof e){const t={};t.err=e,e=t}e.ext||(e.ext={});const r=t.paused;if(e.ext.vid=n.vid,e.ext.preloadHit=this.hitpreload?1:0,e.ext.preloadCached=i?i.duration:0,e.ext.timerStep=Math.max(...this.timerStepList),e.ext.codectype=this.codecType,e.errorMessage=e.message,e=new lc(t,e),this.log(er.ERROR,"_errorHandle",`preState is ${r}`,null==e?void 0:e.errorCode,(null==e?void 0:e.message)||(null==e?void 0:e.errorMessage)),!e.url&&(e.url=t.src),e.errd&&"object"==typeof e.errd&&this.mp4&&(e.errd.url=this.mp4.url,e.url=this.mp4.url),this.player.emit("playCatch",this.player.vtype,e),this.emit("DATA_REPORT",e),this.mp4&&this.mp4.cancelLoading(),this._abrService&&this._abrService.disable(),this.canDownload=!1,this.mp4&&this.mp4.bufferCache&&this.mp4.bufferCache.clear(),this.checkIsDegraded(e))this.player.vtype="MP4_2",this._initPromise&&this.removeAndRejectInitPromise(e),this.startDegradedPlayback(e,r);else{this.log(er.ERROR,"final error !!!!, ",n.vid,null==e?void 0:e.errorCode,(null==e?void 0:e.errorMessage)||(null==e?void 0:e.message)),this.player.pause(),this._reset();const{currentTime:i}=t;this.destroyMSE(),t.currentTime=i,this.emit("error",e)}this.emit(Sc)})),Bl(this,"_onSeeking",(async()=>{var e,t,n;if(this._isReceiveEndedEvent=!1,this.useVideoLoad)return;const{player:i,mp4:r}=this;this.waitLevelStartTime=i.currentTime;const s=i.currentTime;if(this.changeState("seeking",{curTime:s}),this.log(er.LOG,"[seeking], curTime,",s,",buffer,",JSON.stringify(i.buffered2.bufferedList)),!r||!r.meta)return;this._startProgress(),this.endofstream=!1,r.bufferUsedPos=0,r.metaLoading=!1,this._definitionChangePointInfo&&(this._definitionChangePointInfo.changeStartTime=s,this.log("[seeking update definitionChangePointInfo.changeStartTime]",s)),r.changeBitRateTime>0&&(r.updateChangeBitRateTime(s),this.log("[seeking update changeBitRateTime]",s));const a=i.bufferedPoint;let o=!1,l=0;if(a.end>0){if(o=!0,r.meta.duration-a.end<.5)return void this.log("[seeking in buffered range], buffer end,",a.end,", duration,",null==(e=null==r?void 0:r.meta)?void 0:e.duration);const t=r.getFragmentIdx(a.end);l=this.getAdaptTimeRangeIdx(t),r.seekTime=a.end,l<0&&(l=this._curLoadSegmentIdx),this.log(er.LOG,"[seeking in buffered range], seekTime ",s,",bufferRange,",a.start,"-",a.end,", fragIndex,",l)}if(!o){r.seekTime=s;const e=r.getFragmentIdx(s);l=this.getAdaptTimeRangeIdx(e),this.log(er.LOG,"[seekTime out buffer range], srcFragIndex,",e,", fragIndex,",l),l<0&&(l=this._curLoadSegmentIdx),this.log(er.LOG,"[seekTime out buffer range], curTime,",s,", srcFragIndex,",e,", adaptIdx,",l);const{mse:t}=this;if(t&&null!=t&&t.isFull()){const e=i.buffered2.bufferedList,t=e[e.length-1];this._checkRemoveSourceBuffer([t.start,t.end],i.currentTime,!0,!0)}}this._curLoadSegmentIdx===l&&null!=(t=r.adaptTimeRange[l])&&t.isLoading?this.log(er.LOG,"[seeking in buffered range], seek fragIndex is current load segmentIdx",l):(r.canDownload=!1,await r.cancelLoading(),r.resetFragmentLoadState(l),this.log(er.LOG,"[seekTime resetFragmentLoadState],adaptIdx,",l,"mp4.seekTime",r.seekTime,JSON.stringify(r.adaptTimeRange)),null==(n=this.mse)||n.clearOpQueues(mr.VIDEO),this._curLoadSegmentIdx=l,this.canDownload=!0,this._onTimeUpdate(),this._isEnded())})),this.initLog(null==(n=null==(t=this.player.playerId)?void 0:t.toString())?void 0:n.slice(-4)),this._pendingPromises=[],this._allInitPromise=new wl,this._isInit=!1,this._isEventInit=!1,this.playerId=this.player.playerId,this.preloader=null,this.log(er.LOG,"playerId",this.playerId,this.playerConfig.vid),this._useVideoLoad=!1,this.mse=null,this.mp4=null,this.eme=null,this._isMseInit=!1,this._corePromise=null,this._initPromise=null,this._hasStartProgress=!1,this._hasStartProgressBack=!1,this._curLoadSegmentIdx=0,this._abrService=null,this._checkRemoveBufferLastTime=$o(),this.playFlag=!1,this.config.resumePlayWaterLevel=Math.min(this.config.minBufferLength,this.config.resumePlayWaterLevel),this.checkResumePlayTimer=null,this._MSEError=!1,this.loadstart=-1,this._loadStartEventTime=-1,this._waitAdjustTimeCnt=0,this._waitInBufferTimer=null,this.codecType=this.playerConfig.codecType?this.playerConfig.codecType.toLowerCase():_o,this.playerConfig.vtype&&(this._vtype=this.playerConfig.vtype.toUpperCase()),this.isActive=!0,this.firstFrameTime={newplayer:$o(),initmse_sbopen:-1,mseopen:-1,metaload:-1,metaready_initsegend:-1,startload_stmux:-1,firstmux:-1,apcnt:0,aplen:0,data_ap:-1,loaded_data:-1,loadst_loadeddata:-1,new_loadeddata:-1,bitrate:-1,hitpreload:-1,first_gop_req_cnt:-1},this.debugInfo={},this.states=[],this.removeVideoList=[],this._lastCheckTime=$o(),this._lastCheckLagTime=$o(),this._changeDefState=null,this._defInited=!1,this._removeBuffeEndTime=0,this._isChangeDefinition=!1,this._lastTimeupdateTime2=0,this.waitLevelStartTime=-1,this.preLoadData=null,this.forPreloadTimeCache=null,this._usePaused=!1,this.endofstream=!1,this.bufferEndTime=-1,this.hitpreload=!1,this.isH265DegradeH264=!1,this.loadstartTimer=null,this.loadeddataTimer=null,this.canplayTimer=null,this.adaptRangeRes=[],this._isReceiveEndedEvent=!1,this._checkEndedTimer=null,this._definitionChangePointInfo=null,Rc&&(this.player.preloader=Rc),this._lastTimeupdateTime2=0,this.waitLevelStartTime=-1,this.timerStepList=[],window&&window.location.href.indexOf("playerInstance=true")>-1&&(void 0===window.mp4PlayerInstanceList&&(window.mp4PlayerInstanceList=[]),window.mp4PlayerInstanceList.push(void 0)),this._isH265SoftDecoder=!1,this._beforeLoadStartCostTime=0,this._requestTimer=null,this.mseEndInfo={mseEndType:0,mseEndTime:0}}static get pluginName(){return"Mp4EncryptPlayer"}static get defaultConfig(){return{onlyInit:!1,useWaterLevel:!1,maxBufferLength:10,minBufferLength:5,tickInSeconds:.2,getLicenseUrl:"",xhrSetup:{},chunkSize:209715,retryCount:1,retryDelay:1e3,timeout:3e3,needPreloadCheck:!1,needAutoBitrate:!0,keyValue:null,drm:null,switchBitRateWay:!1,enableWorker:!1,bufferThreshold:10,removeBufferLen:60,focusUserDefinition:!1,resumePlayWaterLevel:2,waitJampBufferMaxCnt:3,waitingInBufferTimeOut:5e3,waitingTimeOut:1e4,notDegradeErrorList:[],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:er.LOG,logMaxSize:204800},noPreloadAddBufferLen:0,enableFPSStuckHandle:!1,loadRangeType:go,timerInWorker:!1}}static registerPreloader(e){Rc=e}static set ENCRYPT_SECRET(e){Cc=e}static get speed(){return xc}static get realTimeSpeed(){return xc}static get version(){return So}setConfig(e){this.config=Object.assign(this.config,e)}initLog(e){const{logCacheLevel:t,logMaxSize:n}=this.config.logCacheConfig;this.logger=new nr(Ic.pluginName+e,{logCacheLevel:t,logMaxSize:n}),xo&&nr.enable()}playerlogger(e){e?nr.enable():nr.disable()}afterCreate(){const{playerConfig:e,config:t,player:n}=this;t.width=e.width||0,t.height=e.height||0,e.vid=e.vid||t.vid,mr.isSupported('video/mp4; codecs="avc1.64001f, mp4a.40.5"')&&!bl()&&(void 0===t.supportHevc&&null!=sc&&sc.isHevcSupported&&sc.isHevcSupported()&&this.player.video instanceof HTMLVideoElement&&(t.supportHevc=!0),t.supportVvcc=!(typeof MediaSource>"u"||!MediaSource.isTypeSupported)&&MediaSource.isTypeSupported("video/mp4;codecs=bvc2.1.6.L93.B0"),this.softDecode?n.vtype="MP4_MSE_SOFT":n.vtype="MP4_MSE",(!Sl()||this.softDecode)&&(t.useEME=!1),t.useEME=!1!==t.useEME,this.checkConfig(),t.onlyInit&&(e.autoplay=!1,e.videoInit=!1,this._hasStartProgress=!1,this._hasStartProgressBack=!1),e.useWaterLevel&&(!e.userGestureEventMiddleware&&(e.userGestureEventMiddleware=zo),!e.videoEventMiddleware&&n.setEventsMiddleware(Xo)),this._proxyPlayer(),n.useHooks("play",this._playHook),n.useHooks("pause",this._pauseHook),n.useHooks("retry",this._retryHook),Qo(n,so.BUFFERED_RESET,this._onBufferedReset),this._bindNetworkStateChange(),this.on("timeupdate",this._onVideoTimeUpdate),this.on(cc,(()=>{var e;this.changeState("LOADED_DATA"),this.deleteVideo(),this.mp4&&this.mp4.updateLoadedDataDone(),this._firstFrameTime(),this._onTimeUpdate(),this.firstFrameTime.loaded_data=this._loadStartEventTime>0?$o()-this._loadStartEventTime:-1,null!=(e=this.config)&&e.enableFPSStuckHandle&&this.on(Mc,this.fpsStuckHandle)})),this.on(uc,(()=>{this.changeState("LOAD_START"),this._loadStartEventTime=$o(),this._beforeLoadStartCostTime=(new Date).getTime()-this._tm,this.codecType===To&&!this.config.supportHevc&&(this._isMseInit=!0,this._onTimeUpdate())})),this.on("ended",(()=>{this.log(er.LOG,"mp4plugin receive player video ended event"),this._onEnded()})),this.on("pause",(()=>{this._usePaused=!0})),this.on("play",(()=>{this._usePaused=!1})),this.on("xglog",(e=>{if("firstFrame"===e.eventType){const t=this.preLoadData&&this.preLoadData.definition?this.preLoadData.definition:-1,{player:n,firstFrameTime:i}=this;xo&&console.log(`[xgplayer-encrypt-mp4]>>>>firstFrame ${this.playerConfig.vid}, ${e.fvt}, codecType: ${this.codecType}`,`hitPreload: ${this.hitpreload}, video: ${this._useVideoLoad}, preloadBitrate: ${t}`,` metaLoad: ${i.metaload}, mseOpen: ${i.mseopen}`,`curDefinition: ${n.curDefinition.definition},appendInit: ${i.metaready_initsegend}`)}})),n.mp4MseFlag=!0)}_startBufferCheck(){const{player:e}=this;if(!e.video)return;const t=[];if(e.video.buffered){for(let n=0,i=e.video.buffered.length;n=t.bufferThreshold&&!this._hasTriggerBufferThreshold&&(this._hasTriggerBufferThreshold=!0,e.emit("BUFFER_THRESHOLD",s-i))}}_startUrlExpiredCheck(){const{definition:e}=this.playerConfig;e&&e.list&&e.list.length>0&&(this.urlExpireTimestamp=e.list[0].url_expire||0,this._handleUrlExpire())}async cancelLoading(){this.mp4&&(this._canceLoading=!0,this.log(er.LOG,"player cancelLoading",this.playerConfig.vid),this._stopProgress(),this.cancelPreloadTask(),await this.mp4.cancelLoading())}checkConfig(){const{playerConfig:e,config:t}=this;let n=e.defaultDefinition,i=e.defaultBitrate;if(!n){const{definition:e}=this.playerConfig;n=e&&e.defaultDefinition?e.defaultDefinition:t.definition}!i&&t.bitrate&&(i=t.bitrate),e.defaultDefinition=n,e.defaultBitrate=i}_addMetaDataEvent(e){const{player:t}=this;this.__mHandler=e,Qo(t,"loadedmetadata",this.__mHandler)}_removeMetaDataEvent(){if(!this.__mHandler)return;const{player:e}=this;qo(e,"loadedmetadata",this.__mHandler),this.__mHandler=null}beforePlayerInit(){const{player:e}=this,t=this;this._isInit||(yc.defineGetterOrSetter(e,{__url:{get:()=>t.mse?t.mse.url:e.config.url,configurable:!0},downloadSpeed:{get:()=>xc/8,configurable:!0},playerVersion:{get:()=>So,configurable:!0},menuCodeType:{get:()=>t.mp4&&t.mp4.meta?t.mp4.meta.videoCodec:t.codecType===_o?"avc":"hevc",configurable:!0},playerType:{get:()=>"MP4",configurable:!0},supportMenus:{get:()=>({speed:null==e?void 0:e.mp4MseFlag,cdn:null==e?void 0:e.mp4MseFlag,resolution:null==e?void 0:e.mp4MseFlag}),configurable:!0},preloadActive:{get:()=>this.isActive,set:e=>{this.isActive=e,this.isActive&&this._startProgress()},configurable:!0},performance:{get:()=>this.firstFrameTime,configurable:!0},domain:{get:()=>t.domain,configurable:!0},loadURL:{get:()=>t.loadURL,configurable:!0},abrInstance:{get:()=>t.abrInstance,configurable:!0},pcdnReq:{get:()=>{},configurable:!0},retryInfo:{get:()=>vl,configurable:!0},softDecoder:{get:()=>this._isH265SoftDecoder,configurable:!0},logCache:{get:()=>{if(t.logger)return t.log(er.LOG,`,version:${So},timerStepList,`,JSON.stringify(this.timerStepList)),t.logger.getLogCache()},configurable:!0},pcdnVVStat:{get:()=>{var e;const{mp4:n,pcdn:i}=t;return n?{...n.pcdnVVStat,trace_id:null==(e=n.pcdnTraceInfo)?void 0:e.trace_id,cancelCnt:(null==n?void 0:n.pSCCancelCnt)||0,is_try_open:i?1:0}:null},configurable:!0},beforeLoadStartCostTime:{get:()=>this.useVideoLoad?0:this._beforeLoadStartCostTime,configurable:!0},bandwidth:{get:()=>{const{mp4:e,playerConfig:n}=t;return function(e,t){const n=e?e.loadInfo:null,i=n?n[co]:null,r=n?n[uo]:null;return{vid:t,cdn:{speed:null==i?void 0:i.loadSpeed,size:i?i.loadLen:0},pcdn:{size:r?r.loadLen:0,...null==e?void 0:e.pcdnTraceInfo}}}(e,null==n?void 0:n.vid)},configurable:!0},ext:{get:()=>t?function(e){var t,n;const i=[],{video:r,currentTime:s,duration:a}=e.player,{playerConfig:o,mp4:l,mse:c,debugInfo:u,_curLoadSegmentIdx:d,states:h,_requestTimer:p,timerStepList:f}=e,g=r?r.buffered:[];if(g.length>0)for(let e=0,t=(null==g?void 0:g.length)||0;et.abrInstance&&t.abrInstance.isCurrentInAbr?e._currentDefitionFromPlayer:e.curDefinition,configurable:!0}}),this._isInit=!0)}destroy(){var e,t;const{player:n}=this;n.preloader&&n.preloader.cancel(this.playerId),n.removeHooks("play",this._playHook),n.removeHooks("pause",this._pauseHook),n.removeHooks("retry",this._retryHook),null==(e=this._requestTimer)||e.destroy(),this._requestTimer=null,this._reset(),this.checkReUseMSE(!1),this._secretkey&&Cc.destroySecretKey(this._secretkey,this._errorHandler),this.player.playNext=wc,this.player._startInit=Ec,this.player.changeDefinition=kc,this.player.switchURL=Dc,this._unbindNetworkStateChange(),this._unbindEvents(),qo(n,so.BUFFERED_RESET,this._onBufferedReset),this._bufferCheckTimer&&clearInterval(this._bufferCheckTimer),this._removeBufferTimer&&(clearTimeout(this._removeBufferTimer),this._removeBufferTimer=null),null!=(t=this.logger)&&t.reset&&this.logger.reset(),this._removeMetaDataEvent(),this.timerStepList=[]}_proxyPlayer(){"function"==typeof this.player.playNext&&(wc=this.player.playNext),this.player.playNext=(...e)=>{this.playNext(...e)},Ec=this.player._startInit,Dc=this.player.switchURL,kc=this.player.changeDefinition,this.player._startInit=this.playerStartInit.bind(this),this.player.switchURL=this.switchURL.bind(this),this.player.changeDefinition=this.changeDefinition.bind(this)}getInitBitrate(){const{player:e,config:t,playerConfig:n}=this;let i=null;const{definitionList:r}=e;if(r&&r.length>0){const{preloader:s}=e;s&&r.forEach((e=>{const t=s.generateUniqueKey({vid:n.vid,definition:e.definition||-1,vtype:n.vtype,codecType:n.codecType});e.cacheKey=t,t&&!i&&s&&s.hasItemSameVid(t)&&(i=e,i.type="preload")}));const{userSelectDefinition:a}=n;i&&a&&t.focusUserDefinition&&n.userSelectDefinition!==i.definition&&(i=null),!i&&this.bitRateAdapter&&(this.bitRateAdapter.speed=_l.speed,i=this.getDefinitonFromAdapter(r,a),i&&(i.type="bitRateAdapter"))}if(!i||!i.url){const{url:e,definition:t,defaultDefinition:s}=n,a=(null==t?void 0:t.defaultDefinition)||s;if("Array"===Go(e)&&e.length>0||"String"===Go(e)&&e){const t=this._getDefinitionItem(a),r=n.defaultBitrate||n.bitrate||(null==t?void 0:t.bitrate);i={url:e,definition:(null==t?void 0:t.definition)||a||-1,duration:(null==t?void 0:t.duration)||n.duration||this.config.duration||0,bitrate:r,uri:n.uri||(null==t?void 0:t.uri),file_id:null==t?void 0:t.file_id,size:(null==t?void 0:t.size)||n.size,type:"default"}}else i=r[r.length-1]}return i&&(n.url=i.url,i.networkSpeed=_l.speed),e.curDefinition=i,i}_setPlayerSrc(e){const{player:t}=this;this._removeVideoSource(),"Array"===Go(e)?(t.video.removeAttribute("src"),!t._detachSourceEvents&&e.forEach((e=>{t.video.appendChild(Ao("source","",{src:`${e.src}`,type:`${e.type||""}`}))})),t._attachSourceEvents(t.video,e),t.play()):(t.video.src=e,t.play()),t.mp4MseFlag=!1,t.emit("playertypechange")}_removeVideoSource(e){const{player:t}=this;e=e||t.video;const{children:n}=e;if(n.length>0)for(t._detachSourceEvents(e);n.length>0;)e.removeChild(n[0])}_getDefinitionItem(e){const{definition:t}=this.playerConfig;if(!t||!t.list)return null;for(let n=0;n{if(this.isDestroy)return void n.reject(new Error("destroy"));let r=null;if(e&&e.length>0&&(e.length>1&&(!t.keyValue&&(t.secretKey=e[0].secretKey),t.decryptKey=e[0].decryptKey),r=e[e.length-1].data,this.firstFrameTime&&(this.firstFrameTime.hitpreload=r?1:0)),r||!t.needPreloadCheck||this.codecType===To&&!t.supportHevc)if(this._vtype&&"MP3"===this._vtype)this.useVideoLoad=!0,this.log(er.LOG,"vtype_not_MP4"),n.reject(new Error("vtype_not_MP4"));else{const e=t._mainURL;this.player.rawSrc=e,this._initMp4(e,r,{fileSize:i?i.size:0}),this.updateLoadInfo(null==r?void 0:r.cacheKey),this.checkPCDN(),this.initAdaptRange(),this._initAbrService()}else this.useVideoLoad=!0,this.log(er.LOG,"no_preload"),n.reject(new Error("no_preload"))})).catch((t=>{this.log(er.ERROR,"getLicense or checkPreloader reject",null==t?void 0:t.message);const r=new lc(this.player,{errorType:Mo.DRM,errorCode:Po.drm,errorMessage:(null==t?void 0:t.message)||"getLicense or checkPreloader reject",vid:e.vid});this.emit("GET_LICENSE_ERROR",r),this.changeState("LICENSE_ERROR",{d:i?i.definition:0}),n.reject(r)}))}catch(e){n.reject(e)}return n}updateLoadInfo(e){!e||!this.mp4||(this.mp4.loadInfo=ho.get(e),ho.delete(e))}initAdaptRange(){const{config:e,player:t,playerConfig:n}=this,{bitrate:i,duration:r}=t.curDefinition;if(null!=e&&e.adaptRange){let s=null;s=(null==e?void 0:e.loadRangeType)===mo?bn:Tn,this.adaptRange=new s(t,i,r||n.duration,e.adaptRange)}}checkPCDN(){const{config:e,player:t,playerConfig:n}=this;t.curDefinition,this.pcdn=null}isOpenPCDN(e){}_pcdnReqSuccess(e,t){const{playerConfig:n,player:i,mp4:r}=this;if(!r||!e)return;const s=null.getPCDNReqId(i.curDefinition,n.vid);if(e.req_id&&s!==e.req_id)return void this.log(er.LOG,`,${t} is not match curDefinition reqId', reqId, ', pcdnRet.req_id`,e.req_id);const a=e.nodes||[];this.log(er.LOG,`${n.vid} get peer end,pcdn node update,`,a.length),r.updateNode(a),r.pcdnTraceInfo={uri:e.vid,fid:e.fid,trace_id:e.trace_id},r.pcdnVVStat&&(r.pcdnVVStat.try_req_node+=1,r.pcdnVVStat.req_node_succ+=1,r.pcdnVVStat.has_ret_node+=a.length>0?1:0)}_pcdnReqFail(e,t){const{mp4:n}=this;null!=n&&n.pcdnVVStat&&(n.pcdnVVStat.try_req_node+=1),this.checkURLExpired(e,t)}initTimer(){if(!this._requestTimer){const{timerInWorker:e,tickInSeconds:t}=this.config;this._requestTimer=new Tc({frequency:t,timerInWorker:e}),this._requestTimer.on(yo,this.timerHandle)}}playerStartInit(e){var t;if(this.log(er.LOG,"playerStartInit",this.player.hasStart,this.playerId,e),this.isDestroy)return;const{playerConfig:n,player:i}=this;if(this._usePaused=!1,this.isActive&&0!==(null==i?void 0:i.currentTime)&&!this.config.frameFreeze&&(this.log(er.LOG,"[playerStartInit] reset current = 0 ,buffer,",JSON.stringify(null==(t=null==i?void 0:i.buffered2)?void 0:t.bufferedList)),this.player.currentTime=0),this._isH265SoftDecoder=this.softDecode,this.config.reUseMSE&&this.mse&&"String"===Go(e)&&/^blob/.test(e)&&e!==this.mse.url&&(e=n.url,this.destroyMSE()),!e||"__auto__"===e||"anytext"===e){const{definition:e}=n,t=function(e){let t="",n=null;const i=e?e.list:[];if(i&&i.length>0&&e.defaultDefinition&&(i.forEach((i=>{i.definition===e.defaultDefinition&&(t=i.url,n=i)})),!t)){const r=i[0];t=r.url,e.defaultDefinition=r.definition,n=r}return n}(e);t&&(n.url=t.url,e.defaultDefinition=t.definition,i.curDefinition=t)}const r=this._defInited?null:this.getInitBitrate();if(n.nullUrlStart&&!r&&!n.url)return;this.initTimer(),Jo(this.config)?this._initSecret():this._secretkey=null,this._defInited=!0,this.log(er.LOG,`[playerStartInit] ${n.vid} curDefinition`,r||this.player.curDefinition);const{config:s}=this,{preloader:a}=this.player;a&&a.addPlayingVid(n.vid);const o=!this.softDecode;if(s.needPreloadCheck&&o&&!this._secretkey){let e,t=!1;const{curDefinition:i}=this.player;if(a&&i&&(e=i.cacheKey?i.cacheKey:a.generateUniqueKey({vid:n.vid,definition:i.definition||-1,vtype:n.vtype,codecType:n.codecType}),t=a.hasItemSameVid(e)),!t){this.useVideoLoad=!0,this.player.vtype="MP4_0",this.log(er.LOG,`[playerStartInit] ${n.vid} no_preload`,!!a,e);const t=new lc(this.player,{errorType:"runtime",errorTypeCode:Mo.runtime,errorCode:Po.other,vid:this.playerConfig.vid,errorMessage:"no preload"});this.player.emit("playCatch",this.player.vtype,t)}}if(this.useVideoLoad){if(e=this.playerConfig.url,s.closeDowngrade)return;return this._sTime=$o(),Ec.call(this.player,e),void this._startProgress()}if(this.isDestroy)return;if(this.player.mp4MseFlag=!0,this.bufferEndTime=-1,this._tm=(new Date).getTime(),this._initPromise&&"pending"===this._initPromise.state){const e=this._handlerUrl(n.url);if(e&&e.main===s._mainURL)return}this._reset();const{vid:l}=this.playerConfig;this.changeState("PLAYER_START_INIT");const c=this._initMp4Kernel();this._initPromise=c,this._addPendingPromise(this._initPromise),c.then((()=>{this.isDestroy||(this.mse&&(e=this.mse.url),this.changeState("PLAY_INIT_OK"),this._bindEvents(),this._startProgress())})).catch((t=>{let n=!1;if(this._initPromise&&(n=this._initPromise.id!==c.id||this._initPromise.isBreak),this.isDestroy||n||t===bc)return;if(this.log(er.LOG,`_initMp4Kernel.catch: ${l} isDestroy:${this.isDestroy},\n errorCode:${(null==t?void 0:t.errorCode)||Po.other},errMsg:${(null==t?void 0:t.errorMessage)||(null==t?void 0:t.message)}`),(null==t?void 0:t.errorCode)===Po[403]&&this._emitExpireEvent(t)&&s.urlExpireDisableErrorEvent)return this._initPromise=null,this.log(er.LOG,"initMp4Kernel urlExpireDisableErrorEvent",s.urlExpireDisableErrorEvent,",errorCode,",t.errorCode),this._stopProgress(),void this.emit(Sc);let i=t;i.errorCode||(i=new lc(this.player,{errorType:Mo.RUNTIME,errorCode:(null==t?void 0:t.errorCode)||Po.other,vid:this.playerConfig.vid,errorMessage:(null==t?void 0:t.errorMessage)||(null==t?void 0:t.message),mediaError:{code:(null==t?void 0:t.httpCode)||Po.other,message:(null==t?void 0:t.errorMessage)||(null==t?void 0:t.message),errorType:null==t?void 0:t.errorType}}),i.url=e),this.changeState("PLAY_INIT_CATCH",{c:i.errorCode,m:(null==t?void 0:t.errorMessage)||(null==t?void 0:t.message),t:null==t?void 0:t.errorType}),this.useVideoLoad=!0,this.player.vtype="MP4_1",this.player.emit("playCatch",this.player.vtype,i);const r=this.checkIsDegraded(i);return this.log(er.WARN,"PLAY_INIT_CATCH final error !!!!, ",l,null==i?void 0:i.errorCode,null==i?void 0:i.errorMessage,",degrade:",r),this.emit(Sc),r?void 0:(this.player.pause(),this._reset(),this.emit("error",i),void(this._initPromise=null))})).finally((()=>{var t;if(!this._initPromise)return;const{isBreak:n,id:i}=this._initPromise;if(i!==c.id)return;this._removePendingPromise(this._initPromise),this._initPromise=null,this._usePaused&&(this.playerConfig.autoplay=!1),this.softDecode&&"Array"===Go(e)&&(e=e[0].src),"String"===Go(e)&&!/^blob/.test(e)&&!this.config.frameFreeze&&this.destroyMSE();const r=(null==(t=this.player)?void 0:t.currentSrc)===e;this.changeState("PLAY_INIT_FINALLY",{isDestroy:this.isDestroy,isBreak:n,reUseSrc:r}),!this.isDestroy&&!n&&Ec.call(this.player,e),this.reUseMSEEmitEvents(r),this._abrService&&this._abrService.isCurrentInAbr()&&(this._abrService.enable(),this._abrService.execute())}))}async destroyMSE(){var e;await(null==(e=this.mse)?void 0:e.unbindMedia()),this.mse&&this.log(er.LOG,"destroyMSE ",this.playerConfig.vid),this.mse=null}reUseMSEEmitEvents(e){var t;e&&/^blob/.test(null==(t=this.player)?void 0:t.currentSrc)&&(clearTimeout(this.loadstartTimer),clearTimeout(this.loadeddataTimer),clearTimeout(this.canplayTimer),this.loadstartTimer=setTimeout((()=>{clearTimeout(this.loadstartTimer),this.loadstartTimer=null,this.emit(uc),this.log(er.LOG,"reUseMSE add emit loadstart event")}),10),this.loadeddataTimer=setTimeout((()=>{clearTimeout(this.loadeddataTimer),this.loadeddataTimer=null,this.emit(cc),this.log(er.LOG,"reUseMSE add emit loadeddataevent")}),50),this.canplayTimer=setTimeout((()=>{clearTimeout(this.canplayTimer),this.canplayTimer=null,this.emit("canplay"),this.log(er.LOG,"reUseMSE add emit canplayevent")}),90))}playNext(e,t=!0){const{player:n}=this,i=!!this.isActive;i&&(e.autoplay=i),this._defInited=!1,this._hasTriggerBufferThreshold=!1,n.resetState(),n._currentTime=0,n._duration=0,n.isPlaying=!1,this.preloader&&this.preloader.clearTask(),this._useVideoLoad=!1,this._MSEError=!1;const r=this.softDecode;n.pause(),this._reset(),e.vtype&&(this._vtype=e.vtype.toUpperCase()),n.setConfig(e),this.config.frameFreeze||this.checkReUseMSE(this.config.reUseMSE,!0),this.softDecode?n.vtype="MP4_MSE_SOFT":n.vtype="MP4_MSE";const{codecType:s,mediaType:a}=this.playerConfig;if(this.codecType=s?s.toLowerCase():_o,r!==this.softDecode&&this.h265_h264_switch(a||"video"),this.checkConfig(),this.log(er.LOG,"[Index] playNext",e.vtype,e.vid),n.resetState(),n.start(),n.play(),this.config.reUseMSE&&!this.isH265DegradeH264){const e=()=>{this.log(er.LOG,"[Index] playNext metadata update currentTime = 0"),0!==n.currentTime&&(n.currentTime=0),this._removeMetaDataEvent()};this._addMetaDataEvent(e)}t&&this.emit("playnext")}h265_h264_switch(e){this.log(er.LOG,"[Index],h265_switch_h264",e);const{player:t}=this,{mediaConfig:n}=t,i=Ao(e,"",n,`xgplayer-${e}-img`),r=t.media.parentElement;this.removeVideoList.push(t.media),t.detachVideoEvents(t.media);const{muted:s,volume:a}=t.media;i.muted=s,i.volume=a,i.setAttribute("media_type","video"),t.media=i,t.attachVideoEvents(i),r.appendChild(i)}next(e){this.playNext(e)}oldChangeDefinition(e,t){const{config:n,player:i,playerConfig:r}=this;i.emit(dc,{from:t,to:e}),i.emit("waiting");const s=i.definitionList,a=s.filter((t=>t.definition===e.definition||t.definition===Number(e.definition))),o=s.filter((e=>e.definition===t.definition||e.definition===Number(t.definition)));if(o.length>0&&(o[0].selected=!1),!(a.length>0))return;(e=a[0]).selected=!0,i.curDefinition=e,this.log(er.LOG,"[oldChangeDefinition],currentTime,",i.currentTime,",from,",t,",to,",e);const{currentTime:l,paused:c}=i;this._changeDefState||(this._changeDefState={currentTime:l,paused:c}),n.definition=e.definition,["keyValue","kid","secretKey","drm","getLicenseUrl","drmKeyToken","sessionId"].forEach((t=>{n[t]=e[t]})),r.url=e.url,r.userSelectDefinition=e.definition,r.defaultDefinition=e.definition,n.focusUserDefinition=!0,i.currentTime=0,i.pause(),this._reset(),this.checkReUseMSE(),this._isMseInit=!1,this.eme=null;const u=this._handlerUrl(e.url);n._mainURL=u.main,n._backupURL=u.backup,this._changeDefineCanPlay&&i.off("canplay",this._changeDefineCanPlay),this._changeDefineCanPlay=()=>{this.changeDefineCanPlay(l,c,t,e),this._changeDefineCanPlay=null},i.once("canplay",this._changeDefineCanPlay),this.player.video.load(),this.playerStartInit(r.url)}_emitDefinitionChangeDetailEvent(e){const{bitrate:t,definition:n,file_id:i,width:r,vwidth:s,height:a,vheight:o}=this._currDefinition;this.player.emit("definitionChangeDetail",{start:e,bitrate:t,definition:n,mediaType:"video",url:this.config._mainURL,fileid:i});const l={width:r||s,height:a||o};this.player.emit("RESOLUTION_UPDATE",l)}_setCurrentDefinition(e){const{config:t}=this.player;if(t.definition&&t.definition.list){const n=t.definition.list.filter((t=>t.bitrate===e));this._currDefinition=n&&n[0]}this._currDefinition||(this._currDefinition={bitrate:e}),e&&(this._currDefinition.bitrate=e)}switchURL(e){if(this.useVideoLoad)return void Dc.call(this.player,e);const{player:t,playerConfig:n,config:i}=this;n.definition.list=[e],n.url=e.url,n.defaultBitrate=e.bitrate,n.defaultDefinition=e.definition,["keyValue","kid","secretKey","drm","getLicenseUrl","drmKeyToken","sessionId"].forEach((t=>{i[t]=e[t]})),this._addMetaDataEvent((()=>{t.currentTime=0,this._removeMetaDataEvent()})),this.playNext(i)}_handlerUrl(e){const{playerConfig:t}=this;if(!e)return null;let n;const i=[];if("String"===Go(e))n=e,t.backupURL&&i.push(t.backupURL);else if("Array"===Go(e)&&e.length>0&&(n=e[0].src,e.length>1))for(let n=1;n{e.gapDegrade&&e.useEME&&(e.useEME=!1,this._replay())})),this.on(Sn.CHANGE_FLYING_PLUGIN_CONFIG,this._onChangeConfig),t.setEventsMiddleware({error:(e,n)=>{var i;const r=null==e?void 0:e.error,s={errorCode:null==r?void 0:r.code,errorMessage:null==r?void 0:r.message,videoType:this.useVideoLoad};if(this.changeState("video_error.Middleware",s),this.codecType===To&&(null==r?void 0:r.message.indexOf("video decoder initialization failed"))>=0&&this.emit("DECODER_FAILED",{codecType:this.config.codecType,vid:this.playerConfig.vid}),this.log(er.ERROR,"error middleware",JSON.stringify(s),", isDegrade,",!this._MSEError&&!this.useVideoLoad,t.currentTime),!this._MSEError&&!this.useVideoLoad)return t.vtype="MP4_2",this._MSEError=!0,null==(i=this.mp4)||i.cancelLoading(),this.startDegradedPlayback(s,t.paused),void this.emit(Sc);this.emit(Sc),this.useVideoLoad&&n(e.eventName,null==e?void 0:e.error)}})),this._isEventInit=!0}getBufferDur(){var e;if(null==(e=this.player)||!e.buffered)return 0;const{buffered:t}=this.player;let n=0;for(let e=0,i=t.length;e0){for(let e=0;e>>changeState[${e}]`,n,i,JSON.stringify(t)),this.states.push({state:e,t1:n,t2:i,data:t}),this._pTime=$o()}get softDecode(){var e,t;return"tt-video"===(null==(t=null==(e=this.player)?void 0:e.config)?void 0:t.mediaType)}_initH265MseProxy(){const{player:e}=this;e.video instanceof HTMLVideoElement&&this.h265_h264_switch(this.playerConfig.mediaType);const t=e.video;this.softDecode&&t.setPlayMode&&t.setPlayMode("VOD"),this.mseProxy=t,this.softDecode&&(e.forceDegradeToVideo=()=>{},Qo(e,"warning",this._lowDecoder),Qo(e,"error",this._onError))}notSupportError(e){return this.log(er.LOG,e,oo),new lc(this.player,{errorType:Mo.MEDIA,errorCode:Po.mse,errorMessage:`${e} ${oo}`,vid:this.playerConfig.vid})}removeAndRejectInitPromise(e){this._initPromise&&(this._removePendingPromise(this._initPromise),this._initPromise.reject(e))}_initMp4(e,t={},n={}){var i,r,s,a,o,l,c;const{config:u,player:d,playerConfig:h}=this;this.mp4&&(this.mp4.destroy(),this.mp4=null),this.changeState("MP4_NEW",{});let p=0;null!=(i=null==u?void 0:u.pcdnConfig)&&i.openPCDN&&(p=(null==(r=null==u?void 0:u.pcdnConfig)?void 0:r.switchPCDNMaxCnt)||2),null!=(s=null==u?void 0:u.pcdnConfig)&&s.adaptPCDNConfig&&(p=0),this._setCurrentDefinition(d.curDefinition.bitrate);let f=Tl;null==u||u.loadRangeType;const g=null==(o=null==(a=d.curDefinition)?void 0:a.pktOffsetMap)?void 0:o.find((e=>(null==e?void 0:e.time)===((null==u?void 0:u.firstLoadTimePos)||5))),m=null==g?void 0:g.offset,v=function(e,t){const{getRequestOptionsCallback:n,reqOptions:i}=e;let r=null;return r=t.reqOptions?t.reqOptions:"Function"===Go(n)?n(t):i,{...i,...r}}(this.config,{url:e});this.mp4=new f(e,d.curDefinition.bitrate,{segmentDuration:u.segmentMinDuration,enableWorker:u.enableWorker,codecType:this.codecType,chunkSize:u.chunkSize,firstLoadSize:m,duration:h.duration||0,fileSize:n.fileSize||0,playerId:this.playerId,vid:h.vid,useUrlRange:u.useUrlRange,retryCount:u.retryCount,retryDelay:u.retryDelay,timeout:u.timeout,onProcessMinLen:u.onProcessMinLen,supportHevc:u.supportHevc,afterLoadeddataCallBackLen:u.afterLoadeddataCallBackLen,firstLoadBuffer:u.firstLoadBuffer,logger:this.logger,switchPCDNMaxCnt:p,reqOptions:v,fixEditListOffset:u.fixEditListOffset},this.config._backupURL,this.firstFrameTime,""),this.mp4.once(rl,this._onMp4MetaReady),this.mp4.on(il,this._onMp4Error),this.mp4.on(ol,this._updateDrmConfig),this.mp4.on(ll,this._updateMSE),this.mp4.on(al,this._onMp4Progress),this.mp4.on(sl,this._onMp4DataCallBack),this.mp4.on(hl,(e=>{this.player&&this.player.emit("source_error",e)})),this.mp4.on(fl,(e=>{var t,n;const{player:i,config:r}=this;this.emit(Sc),this.log(er.LOG,"not match remove buffer start,buffer,",JSON.stringify(null==(t=null==i?void 0:i.buffered2)?void 0:t.bufferedList),", removeRange,",JSON.stringify(e)),null==(n=this.mse)||n.remove(mr.VIDEO,e[0]+.1,e[1]-.1).then((()=>{var e;this.log(er.LOG,"not match remove buffer end,",JSON.stringify(null==(e=null==i?void 0:i.buffered2)?void 0:e.bufferedList));const{currentTime:t}=i;(null==r?void 0:r.loadRangeType)===mo&&(i.currentTime=t,this.log(er.LOG,"not match remove buffer end, fix currentTime",i.currentTime))})).catch((()=>{}))})),this.mp4.on(dl,(e=>{this.pcdn&&e&&this.pcdn.removePCDNNode(e.vid,e.bitrate,e.url)})),this.mp4.on(cl,(e=>{this.player&&(this.player.rawSrc=e,this.player.emit("initialUrl",{url:e}),this.player.emit("changeHost",Vo(e)))})),this.mp4.on(ul,(async e=>{var t;await(null==(t=this.mp4)?void 0:t.cancelLoading()),this._curLoadSegmentIdx=e,this.log(er.LOG,"[update curLoadSegmentIdx]",e)})),this.mp4.on(pl,(e=>{var t,n,i;if(!this.player)return;const{vid:r}=h,s={vid:r,taskType:1,changeCnt:null==(t=this.mp4)?void 0:t.getCurSwitchPCDNCnt(),traceId:null==(i=null==(n=this.mp4)?void 0:n.pcdnTraceInfo)?void 0:i.trace_id},a=function(e,t,n={}){const{vid:i,taskType:r,changeCnt:s,traceId:a}=n,{bitrate:o,definition:l,file_id:c}=t,u={vid:i,task_type:r,change_cnt:s,definition:l,bitrate:o,fileid:c};return((null==e?void 0:e.load_type)||co)===co?u.cdn_size=e.len:(u.pcdn_size=e.len,u.trace_id=a),u}(e,this._currDefinition,s);this.player.emit("prf_data_size",a);const o=(null==e?void 0:e.load_type)||co;this.mp4&&this.mp4.updateLoadInfo(o,e.len),Co&&console.log("prf_data_size emit, vid,",r,",loadType,",o,", task_type, 1",",len,",e.len)})),this.mp4.MP4Loader.on(ao,(e=>{var t,n,i,r,s,a,o,l,c,u;xc=e.speed,function(e,t){e.speed||(e.speed=[]);const{speed:n}=e;n.push(t),n.length>10&&n.shift()}(this.debugInfo,e.speed);const d=(null==(t=null==e?void 0:e.priOptions)?void 0:t.type)||co;this.emit(ao,{speed:e.speed,type:d,...e});const h=(null==(n=this.playerConfig)?void 0:n.vid)||(null==e?void 0:e.vid);if((null==e?void 0:e.len)>0){if(!this.player)return;const t=(null==(i=null==e?void 0:e.priOptions)?void 0:i.type)||co,n=(null==(r=this.adaptRangeRes)?void 0:r.length)>0?this.adaptRangeRes.shift():{},d=null==(s=this.mp4)?void 0:s.getCurSwitchPCDNCnt(),{bitrate:p,definition:f,file_id:g}=this._currDefinition,m={vid:h,task_type:1,change_cnt:d,bitrate:p,definition:f,fileid:g},v=Zo(n),y=function(e,t){const n=Ko(t.len,t.time),i={cdn_size:0,cdn_speed:0,pcdn_size:0,pcdn_speed:0};return e===co?(i.cdn_size=t.len,i.cdn_speed=n):(i.pcdn_size=t.len,i.pcdn_speed=n),i}(t,e),_={...m,...v,...y},{idx:T}=n;this.player.emit("prf_data_size",_),Co&&console.log("prf_data_size emit,",T,JSON.stringify(_));const b=e.index?null==(l=null==(o=null==(a=this.mp4)?void 0:a.adaptTimeRange[e.index])?void 0:o.timeRangeIdx)?void 0:l[1]:null;if(b&&b>=this.mp4.timeRange.length-1)for(;(null==(c=this.adaptRangeRes)?void 0:c.length)>0;){const e=this.adaptRangeRes.shift(),t=null==(u=this.mp4)?void 0:u.getCurSwitchPCDNCnt(),n={...m,...y,...Zo(e)};n.change_cnt=t,this.player.emit("prf_data_size",n),Co&&console.log("prf_data_size emit,",T,JSON.stringify(n))}this.mp4&&this.mp4.updateLoadInfo(t,e.len)}})),null!=(l=null==u?void 0:u.pcdnConfig)&&l.adaptPCDNConfig&&(null==(c=this.mp4)||c.setSwitchPCDNCallBack((()=>{const{pcdn:e}=this;if(!e)return-1;const t=e.getPCDNChangeCnt()||-1;return this.log(er.LOG,"[updateSwitchPCDNMaxCnt]",t),t}))),this.changeState("MP4_INIT",{}),this.emit("loadstart_mse"),t||(t={}),this.mp4.init(t),this._emitDefinitionChangeDetailEvent(0)}_checkPreloader(){const{playerConfig:e}=this,t=new wl,n={method:"checkPreloader",success:0,type:"error",cacheKey:""};this.changeState("CHECK_PRELOAD");const{curDefinition:i,preloader:r}=this.player;if(!r)return this.changeState("PRELOAD_ERROR",{t:2}),n.success=0,n.error=new Error("no_preloader"),t.resolve(n),t;const s=i.cacheKey?i.cacheKey:r.generateUniqueKey({vid:e.vid,definition:i.definition||-1,vtype:e.vtype,codecType:e.codecType});return n.cacheKey=s,s?r.getPreLoadData(s).then((e=>{if(e){const{bitrate:r,orgDefinition:a}=e;if(r&&i.bitrate&&r!==i.bitrate)return this.preLoadData=null,n.success=0,n.error=new Error(`bitrate_not_match_cut_${i.bitrate}_cache_${r}`),this.changeState("PRELOAD_ERROR",{bitrate:r,ck:s}),t.resolve(n),void this.log(er.LOG,`>>>check Preloader bitrate_not_match cacheKey${s}\n curDefinition:${i.bitrate} cache:${r}`);i.orgDefinition=a,xo&&console.log(">>>>[mp4]check Preloader result",s,e),this.preLoadData=e,this.emit("PRELOAD_INFO",this.preLoadData),this.emit("hitCache",e),n.success=1,n.data=e,fo.set(s,!0),this.changeState("PRELOAD_OK",{l:this.preLoadData.byteLength,ck:s}),e.mediaSegList&&e.mediaSegList.length>0||e.buffer&&e.buffer.byteLength>0?this.hitpreload=!0:this.hitpreload=!1,t.resolve(n)}else this.preLoadData=null,this.changeState("PRELOAD_ERROR",{t:0}),n.success=0,n.error=new Error("none_preload"),t.resolve(n)})):(this.changeState("PRELOAD_ERROR",{t:2}),n.success=0,n.error=new Error("none_preload"),t.resolve(n)),t}_initEME(e,t){var n,i;const r=Jo(this.config),{useEME:s}=this.config;if(r&&s&&!Cc.checkEMEValid())return this.log(er.ERROR,"checkEMEInValid"),void this._errorHandler(new lc(this.player,{errorType:Mo.MEDIA,errorCode:Po.eme_hijack,errorMessage:"checkEMEInValid",vid:this.playerConfig.vid}));const{player:a,config:o}=this;this._updateDrmConfig(t),this.log(er.LOG,"useEME: ",o.useEME),null==(n=this._secretkey)||n.setOptions('video/mp4; codecs="avc1.64001E"','audio/mp4; codecs="mp4a.40.2"'),null==(i=this._secretkey)||i.setupEME(a.video)}async _initMse(e,t=!1){var n;const{useEME:i}=this.config;if(Jo(this.config)&&i&&!Cc.checkMSEValid())return this.log(er.ERROR,"checkMSEInValid "),void this._errorHandler(new lc(this.player,{errorType:Mo.MEDIA,errorCode:Po.mse_hijack,errorMessage:"checkMSEInValid",vid:this.playerConfig.vid}));if(null==(n=this.player)||n.emit("codecsupdate",e.videoCodec),this.config.frameFreeze){if(this.log(er.LOG,"release freezed frame"),this.mse){const e=this.mse;this.mse=null,await e.unbindMedia()}this.player&&this.player.src&&(this.player.removeAttribute("src"),this.player.load())}else this.updateMSEDuration();const r=function(e,t){const n=e&&e.checkCodecH265(),i=e&&e.checkCodecH266(),r=!!t.videoCodec,s=!!t.audioCodec;let a;return a=r&&s?n?'video/mp4; codecs="hev1.1.6.L93.B0, mp4a.40.5"':i?'video/mp4; codecs="bvc2.1.6.L93.B0, mp4a.40.5"':'video/mp4; codecs="avc1.64001E, mp4a.40.5"':r?n?'video/mp4; codecs="hev1.1.6.L93.B0"':i?'video/mp4; codecs="bvc2.1.6.L93.B0"':'video/mp4; codecs="avc1.64001E"':'video/mp4; codecs="mp4a.40.5"',a}(this.mp4,e),s={[mr.VIDEO]:{mimeType:"video/mp4",codec:r}};let a;this.mse?(this.log(er.LOG,"MSE exit"),a=new wl,a.resolve()):(this.log(er.LOG,"new MSE"),this.mse=new mr,a=this.mse.bindMedia(this.player.video)),a.then((e=>{var n;this.changeState("MSE_OPEN");const{firstFrameTime:i}=this;i.initmse_sbopen=null==e?void 0:e.costtime,this._loadStartEventTime>0&&(i.mseopen=$o()-this._loadStartEventTime);const r=Object.keys(s);try{for(let e=0;e{this.changeState("MSE_OPEN_DONE"),this._isMseInit=!0,this._onTimeUpdate()})).catch((async e=>{var n;this.config.reUseMSE=!1,this.log(er.WARN,"MSE createOrChangeSource catch err: ",null==e?void 0:e.message),await(null==(n=this.mse)?void 0:n.unbindMedia()),this.mse=null,this._isMseInit=!1,t?this.MSEErrorHandle(e):this._initMse(this.mp4.meta,!0)}))}}catch(e){this.MSEErrorHandle(e)}})).catch((e=>this.MSEErrorHandle(e))),this.changeState("MSE_INIT")}MSEErrorHandle(e){const t=new lc(this.player,{errorType:Mo.mse,errorCode:Po.mse,vid:this.playerConfig.vid,errorMessage:e.message,mediaError:{code:Po.mse,message:e.message}});this.log(er.ERROR,"initMse error: ",null==e?void 0:e.message),this._errorHandler(t)}_appendInitSeg(e){!this.mse||this._MSEError||(this.changeState("MSE_INITSEG"),this.mse.append(mr.VIDEO,e,{vid:this.playerConfig.vid,range:null,dataLen:e.byteLength,isinit:!0}).then((e=>{this.firstFrameTime.metaready_initsegend=null==e?void 0:e.costtime,this.changeState("MSE_INITSEG_OK",{costtime:null==e?void 0:e.costtime})})),this.config.useEME&&this._secretkey&&this._secretkey.encryptHandle())}_checkMetaInfo(e){if(!e)return new lc(this.player,{errorType:Mo.DEMUX,errorCode:Po.metaError,errorMessage:"meta is null",vid:this.playerConfig.vid});const t=this.mp4.checkCodecH265(),n=this.mp4.checkCodecH266();return this.changeState("MP4_META_READY",{isH265:t,isH266:n}),!t||(this.codecType!==To&&(this.codecType=To,this.log(er.LOG,"codecType fix ",this.codecType)),this.softDecode||this.config.supportHevc)?n&&(this.codecType!==bo&&(this.codecType=bo,this.log(er.LOG,"codecType fix ",this.codecType)),!this.config.supportVvcc)?this.notSupportError(this.codecType):null:this.notSupportError(this.codecType)}_stopProgress(){this.log(er.LOG,"stopProgress",this._hasStartProgress),this._hasStartProgress=!1,this._requestTimer&&this._requestTimer.stop(),this._bufferBreakTimer&&(clearTimeout(this._bufferBreakTimer),this._bufferBreakTimer=null,this._bufferBreakFlag=void 0),this._seekResumTimer&&(clearTimeout(this._seekResumTimer),this._seekResumTimer=null)}checkReStartTimer(){const e=$o()-this._lastTimeupdateTime2;e>2*this.config.tickInSeconds*1e3&&!this._offineLine&&(this.log(er.LOG,"checkReStartTimer reStart timer",e,$o()),this._stopProgress(),this._startProgress(),this._lastTimeupdateTime2=$o())}_bindNetworkStateChange(){window.addEventListener("online",this._onOnlineHandler),window.addEventListener("offline",this._onOfflineHandler)}_unbindNetworkStateChange(){window.removeEventListener("online",this._onOnlineHandler),window.removeEventListener("offline",this._onOfflineHandler)}_onSuperStart(e){const{player:t}=this;Oo(`_onSuperStart:${e}`,this.mse),t.video.src=e,this.once("canplay",(()=>{t.play(),this.on("waiting",this._onWaiting)}))}_appendBuffer(e,t,n={},i){const{mse:r,playerConfig:s,player:a}=this,{vid:o}=s;this.log(er.LOG,"appendStart",o,n.fragIndex,JSON.stringify(n.range)),this._MSEError?this.log(er.ERROR,"_MSEError, not append return"):r.append(e,t,{vid:o,fragIndex:n.fragIndex,range:n.range,dataLen:t.byteLength,state:i}).then((e=>{var t,r,s,o,l,c,u;const d=a.getBufferedRange();this.log(er.LOG,"appendEnd ",null==(t=null==e?void 0:e.context)?void 0:t.fragIndex,JSON.stringify(null==(r=null==e?void 0:e.context)?void 0:r.range),null==(s=null==e?void 0:e.context)?void 0:s.dataLen,", costTime,",null==e?void 0:e.costtime,", opt,",null==e?void 0:e.name,",buffer,",JSON.stringify(d),a.currentTime),this.checkBufferArriveEndTime();const h=this.firstFrameTime;if(h.loadst_loadeddata<0){h.apcnt++;const t=(null==(o=null==e?void 0:e.context)?void 0:o.dataLen)||0,n=(null==e?void 0:e.costtime)||0;h.aplen+=t,h.data_ap+=n;let i=!1;for(let e=this.states.length-1;e>=0;e--)if("APPEND_DATA_OK"===this.states[e].state){this.states[e].data.cnt+=1,this.states[e].data.costime+=n,this.states[e].data.dataLen+=t,i=!0;break}i||this.changeState("APPEND_DATA_OK",{costime:n,dataLen:t,cnt:1})}const p=null==(u=null==(c=null==(l=this.mp4)?void 0:l.adaptTimeRange[n.fragIndex])?void 0:c.timeRangeIdx)?void 0:u[1];if(this.mse&&i&&p>=this.mp4.timeRange.length){const{buffered:e}=this.player;e&&(null==e?void 0:e.length)>0&&(this.bufferEndTime=e.end(e.length-1)),this._isEnded(),this.log(er.LOG,"loaded ended !!!==>>>",JSON.stringify(n.range),", fragIndex,",n.fragIndex,", bufferEndTime,",this.bufferEndTime,",meta_duration,",this.mp4.meta.duration)}})).catch((e=>{const{player:t,mse:i}=this;if(this._MSEError||!t)return;const r=t.media||t.video;if(e&&null!=i&&i.isFull()){this.log(er.WARN,"[MSE is full]");const e=t.getBufferedRange(t.buffered2);this._checkRemoveSourceBuffer(e,t.currentTime,!0)}else{const i=`${null!=r&&r.error?[r.error.code,r.error.message].join("-"):"MEDIA_EMPTY"}`,s=`${(null==e?void 0:e.errorCode)||""}-${(null==e?void 0:e.errorMessage)||(null==e?void 0:e.message)||"MSE_EMPTY"}|${i}`;this._MSEError=!0,this.changeState("_MSEError",{fragIndex:null==n?void 0:n.fragIndex,range:null==n?void 0:n.range}),this.log(er.LOG,"MSE append error",null==n?void 0:n.fragIndex,null==n?void 0:n.range);const a=new lc(t,{errorType:Mo.MEDIA,errorCode:Po.mseAppend,vid:o,errorMessage:s,mediaError:{code:Po.mseAppend,message:s}});this._errorHandler(a)}}))}async _loadData(){if(this.mp4&&this._isMseInit){this.loadstart<0&&(this.loadstart=$o());try{await this.mp4.load(this._curLoadSegmentIdx,this._loadDataSuccess)}catch(e){this.log(er.ERROR,"[Index] _loadData error",this.playerConfig.vid,null==e?void 0:e.message)}}}getDataBitRate(e){const{mp4:t,playerConfig:n}=this,{definition:i}=n;if(!t||!i||i.list)return 0;const r=t.getDataBitRate(e),{list:s}=i;let a=0;for(let e=0;s&&e.1||!i&&n.paused||i&&this.playFlag&&n.paused)(1===this._bufferBreakFlag||2===this._bufferBreakFlag)&&(this.log(er.LOG,"视频没有卡死,重置卡死标记,curtime,",n.currentTime),this._bufferBreakFlag=0,clearTimeout(this._bufferBreakTimer),this._bufferBreakFlag=null);else if(!this._bufferBreakFlag){this._bufferBreakFlag=1;const r=JSON.stringify(null==(e=null==n?void 0:n.buffered2)?void 0:e.bufferedList);this.log(er.LOG,`卡死计时开始! ${t.waitingTimeOut}ms后确认卡死,`,n.currentTime,r),this._bufferBreakTimer=setTimeout((()=>{if(!(this.isDestroy||t.disableInactiveWaitingCheck&&(!i||null!=n&&n.paused))){if(1===this._bufferBreakFlag){const e=n.currentTime,t=n.bufferedPoint;if(t.end>0&&t.end-e>=2)return void this.retrySeekResum(e)}this._bufferBreakFlag=2,this.waitTimeoutDegrade()}}),t.waitingTimeOut)}this._lastCurrentTime=n.currentTime}}waitTimeoutDegrade(){var e,t,n;const{player:i}=this;this.changeState("wait_timeout"),this.log(er.LOG,"确认卡死!!!,curtime,",i.currentTime,JSON.stringify(null==(e=null==i?void 0:i.buffered2)?void 0:e.bufferedList),",duration,",null==(n=null==(t=this.mp4)?void 0:t.meta)?void 0:n.duration),this.emit("waittimeout");const r=document.hidden||"hidden"===document.visibilityState,s=new lc(this.player,{errorType:Mo.RUNTIME,errorCode:r?Po.waitTimeoutWithHidden:Po.waitTimeout,errorMessage:"wait_timeout",vid:this.playerConfig.vid});this._errorHandler(s)}async retrySeekResum(e){const{player:t,config:n}=this;if(this.changeState("retrySeek"),this.log(er.LOG,"卡死但有超过2s的buffer,seek下!!!"),clearTimeout(this._seekResumTimer),this._resumePlay=!1,n.waitingRetrySeekTimes>0&&n.waitingRetryDuration){const i=Math.min(n.waitingRetrySeekTimes,3);this._currentSeekTimes=0,this.off("playing",this._onResumePlaying),this.once("playing",this._onResumePlaying);const r=()=>{if(t&&!this._resumePlay&&!t.paused)return this._currentSeekTimes{this._resumePlay=!0})),this._seekResumTimer=setTimeout((()=>{this._resumePlay||this.waitTimeoutDegrade(),this._seekResumTimer=null}),Math.ceil(n.waitingTimeOut/2))}_isInBuffer(e,t=0){let n=!1;const{buffered:i}=this.player.video;for(let r=0;rt.currentTime&&t.video&&t.video.buffered))return!0;const{buffered:n}=t.video;return 1===n.length||this._isInBuffer(e,.2)}checkURLExpired(e,t){var n,i,r,s;const a=function(e){if(!e||"String"!==Go(e))return 0;let t=0;try{const n=new RegExp("(\\?|&)x-tos-expires=([^&]*)(&|$)"),i=e.match(n);if(null!==i)t=parseInt(i[2],10);else{const n=e.split("/");n.length>5&&8===n[4].length&&(t=parseInt(n[4],16))}return t>0?t10&&this.timerStepList.shift(),this._lastTimeupdateTime2>0&&this.timerStepList.push($o()-this._lastTimeupdateTime2)}_onTimeUpdate(){this.pushTimerStep(),this._lastTimeupdateTime2=$o();const{mse:e,mp4:t,player:n,config:i}=this;if(!n||this.useVideoLoad||!t)return;this.checkBufferArriveEndTime();const r=n.getBufferedRange();$o()-this._lastCheckTime>1e3&&(this._lastCheckTime=$o(),this._loadStuckCheck(),this._startUrlExpiredCheck(),this._checkRemoveSourceBuffer(r,n.currentTime));const{timeRange:s}=t;if(s&&!(s.length<1)&&(e||this.mseProxy)&&this.canDownload){let e=i.maxBufferLength,t=!1;(this.playFlag&&n.paused||!this.isActive)&&(t=!0);const{nextBufferLength:s,minBufferLength:a,adaptRange:o,noPreloadAddBufferLen:l}=i,c=null==o?void 0:o.targetCacheControl;t?e=n.isInstNext&&s>=0?s:a:c&&(e=this.adaptRange.getAdaptCacheBuffer()),!this.preLoadData&&c&&(e+=l);const u=n.currentTime+e;r[1]-u<0&&(this.isOpenPCDN(r[1]),(null==i?void 0:i.loadRangeType)===mo?this.sizeRangeCheckLoad(t,e,r[1]-n.currentTime):this.gopRangeCheckLoad(t,u,e)),this.playFlag&&!this._hasTriggerBufferThreshold&&this._startBufferCheck()}}sizeRangeCheckLoad(e,t,n){var i,r,s;const{player:a,mp4:o}=this,{adaptTimeRange:l}=o,c=l.length;if(!c||(null==(i=l[c-1])?void 0:i.range[1])<(o.size-1||a.curDefinition.size-1)||!l[c-1].downloaded){const i=l.findIndex((e=>!e.isLoading));if(null==l||!l.length||i>=0||l[c-1].downloaded){const{adaptRangeRes:c,loadDuration:u}=this.calculateAdaptRange(e,t),d=null==(r=this.adaptRange)?void 0:r.getAdaptRangeSize(u);d>0&&(c.loadSize=d),c.loadDuration=u,this._curLoadSegmentIdx=i<0?o.updateAdaptTimeRange(null,u,d):i;let h=this._curLoadSegmentIdx;l[h].downloaded||(h=Math.max(h-1,0));const p=l[h];if(n>0&&(null==p?void 0:p.endTime)-a.currentTime>=t)return;const f=l[this._curLoadSegmentIdx];if(this._curLoadSegmentIdx>=0&&this._isInBuffer(f)&&!this._isChangeDefinition&&this._curLoadSegmentIdx>=0&&f.endTime-f.startTime>1){const e=l[this._curLoadSegmentIdx];return e.downloaded=!0,e.isLoading=!0,this.log(er.LOG,`onTimeUpdate, ${this._curLoadSegmentIdx} download segment, has buffer`,f.startTime,f.endTime,a.currentTime),void(o.seekTime=f.endTime)}c.idx=this._curLoadSegmentIdx,(!this.adaptRangeRes.length||(null==(s=this.adaptRangeRes[c.length-1])?void 0:s.idx)!==this._curLoadSegmentIdx)&&(this.adaptRangeRes.push(c),this.log(er.LOG,"adaptRangeRes>>>>",c)),this.log(er.LOG,"[onTimeUpdate],load index==>>>, ",this._curLoadSegmentIdx,JSON.stringify(l[this._curLoadSegmentIdx])),this._loadData()}}}gopRangeCheckLoad(e,t,n){const{timeRange:i,adaptTimeRange:r}=this.mp4,{player:s}=this;i.every(((i,a)=>{var o,l,c,u;if(void 0!==i.adaptTimeRangeIdx&&i.adaptTimeRangeIdx>=0&&r&&r[i.adaptTimeRangeIdx].downloaded)return!0;const d=this.mp4.getAdaptIdxBySrcIdx(a,!0),h=d>=0?r[d]:null,p=d>=0&&this._isInBuffer(h);if(!this._isChangeDefinition&&d>=0&&h.endTime-h.startTime>1&&p)return r[d].downloaded=!0,r[d].isLoading=!0,this.log(er.LOG,`onTimeUpdate, ${d} download segment, has buffer`,h.startTime,h.endTime,s.currentTime),!0;if(i.startTime-s.currentTime>>>",t));const h=r[this._curLoadSegmentIdx];if(this._isInBuffer(h))return h.downloaded=!0,h.isLoading=!0,this.log(er.LOG,`onTimeUpdate_, ${this._curLoadSegmentIdx} download segment, has buffer`,h.startTime,h.endTime,s.currentTime),!0;this.log(er.LOG,"[onTimeUpdate],load index==>>>, ",this._curLoadSegmentIdx,JSON.stringify(this.mp4.adaptTimeRange[this._curLoadSegmentIdx])),this._loadData()}}))}checkBufferArriveEndTime(){const{player:e,mse:t,mp4:n}=this;if(!e||!t||!n)return;const i=e.getBufferedRange(),r=n.getMediaEndTime();r>0&&i[1]>=r&&!t.isEnded&&(this.log(er.LOG,"checkBufferArriveEndTime endOfStream, enfTime",r,", bufferRange,",JSON.stringify(i),",currentTime,",e.currentTime),this.mseEndInfo.mseEndType=1,this.mseEndInfo.mseEndTime=parseInt(1e3*r,10),t.endOfStream())}calculateAdaptRange(e,t){var n,i;let r;const s={forceSetMin:e};null!=(n=this.pcdn)&&n.isOpenAdaptPCDN&&(s.PCDNInBuffer=this.pcdn.curPCDNInBuffer,s.PCDNOutBuffer=this.pcdn.curPCDNOutBuffer);const a=null==(i=this.config)?void 0:i.adaptRange;return!this.playFlag||e?r=this.config.minBufferLength:null!=a&&a.rangeControl?(r=this.adaptRange.getAdaptLoadDuration(),s.loadTarDuration=r):r=this.config.rangeMaxDuration,null!=a&&a.targetCacheControl&&(s.cachedBufferDur=t),!this.playFlag&&null!=a&&a.rangeControl&&(s.loadTarDuration=r),{adaptRangeRes:s,loadDuration:r}}checkReUseMSE(e,t){var n;const{mse:i}=this;if(i)if(e||this.config.reUseMSE){i.clearOpQueues(mr.VIDEO,t),i.abort(mr.VIDEO);const e=null==(n=this.player)?void 0:n.buffered;if((null==e?void 0:e.length)>0){const t=e.end(e.length-1);this.log(er.LOG,"reUseMSE remove buffer, 0-",t),this._canUpdateDuration=!1,this.removeBuffer(mr.VIDEO,0,t,(()=>{var e,t;this._canUpdateDuration=!0,null!=(t=null==(e=this.mp4)?void 0:e.meta)&&t.duration&&this.updateMSEDuration()}))}}else i.unbindMedia(),this.mse=null,this._unloadVideo()}updateMSEDuration(){var e;const{mse:t,mp4:n}=this,i=null==(e=null==n?void 0:n.meta)?void 0:e.duration;this._canUpdateDuration&&i&&i!==t.duration&&(this.log(er.LOG,"updateMSEDuration ",i,",oldDuration,",t.duration),t.updateDuration(i),this._canUpdateDuration=null)}_reset(){this._definitionChangePointInfo=null,this._isReceiveEndedEvent=!1,this.adaptRangeRes=[],this.states=[],this.hitpreload=!1,this._sTime=$o(),this._isChangeDefinition=!1,this._removeBuffeEndTime=0,this._usePaused=!1,this.useVideoLoad=!1,this._isMseInit=!1,this.endofstream=!1,this._curLoadSegmentIdx=0,this.emitExpireTimestamp=null,this.preLoadData=null,this.forPreloadTimeCache=null,this.playFlag=!1,this.waitLevelStartTime=-1,this._waitAdjustTimeCnt=0,this._initPromise&&"pending"===this._initPromise.state&&this._initPromise.reject(bc),clearTimeout(this.checkResumePlayTimer),this.checkResumePlayTimer=null,this._stopProgress(),this.mp4&&(this.mp4.destroy(),this.mp4=null),this.mseProxy&&(qo(this.player,"warning",this._onDegrade),qo(this.player,this._onError)),this.config.frameFreeze||this._unloadVideo(),this._cancelPendingPromises(),this._abrService&&(this._abrService.destroy(),this._abrService=null);const e=this.firstFrameTime;Object.keys(e).forEach((t=>{e[t]="apcnt"===t||"aplen"===t?0:"newplayer"===t?$o():-1})),clearTimeout(this._waitInBufferTimer),this._waitInBufferTimer=null,this.canDownload=!0,this.loadstart=-1,this._loadStartEventTime=-1,this.startLoadData=-1}removeErrorUrls(e,t,n){return e.errorCode===Po[403]&&this._emitExpireEvent(e),n}checkIsDegraded(e){const{notDegradeErrorList:t}=this.config;return!((null==t?void 0:t.length)>0&&(e.errorCode===Po.timeout&&t.indexOf("timeout")>=0||e.errorCode===Po[403]&&(t.indexOf(403)>=0||t.indexOf("403")>=0)||e.errorCode===Po[404]&&(t.indexOf(404)>=0||t.indexOf("404")>=0)))}startDegradedPlayback(e,t,n){this.canDownload=!1;const{player:i,playerConfig:r,config:s}=this;this.endofstream=!1,this._currentTime=i.currentTime||0,this.player.pause(),this._reset(),this._replay=null;const{H264DefinitionList:a}=r;if(this.codecType===To&&this.softDecode)this.log(er.LOG,"h265 softDecode err,degrade use 264 play",r.vid),this._onDegrade(e,n);else if(this.codecType===_o||s.supportHevc||s.supportVvcc||(null==a?void 0:a.length)>0){const{drm:n,kid:o,drmKeyToken:l,keyValue:c,secretKey:u}=s;if(n||o||l||c||u)n&&Object.keys(n).map((t=>{n&&(e[t]=n[t])})),this.log(er.ERROR,"final error !!!!, ",r.vid,null==e?void 0:e.errorCode,null==e?void 0:e.errorMessage),this.emit("error",e);else{this.log(er.LOG,this.codecType,"MSE degrade video,",r.vid,i.currentTime),this.emit(Pc,{errorCode:null==e?void 0:e.errorCode,errorMessage:(null==e?void 0:e.errorMessage)||(null==e?void 0:e.message),codecType:this.codecType,mediaType:r.mediaType}),this.useVideoLoad=!0,this.destroyMSE();const n=()=>{this._currentTime&&(i.currentTime=this._currentTime),this.log(er.LOG,"DegradedPlayback update currentTime",r.vid,this.codecType,this._currentTime),t?this.player.pause():this.player.play(),this._removeMetaDataEvent()};this._addMetaDataEvent(n);let s=r.url;if((null==a?void 0:a.length)>0){const e=a.length,t=this.player.curDefinition.definition;let n=t&&a.find((e=>e.definition===t));n||(r.H264DefinitionList.sort(((e,t)=>e.bitrate-t.bitrate)),n=r.H264DefinitionList[Math.floor(e/2)]),n&&(s=n.url,this.playerConfig.codecType=_o,this.codecType=_o)}this._setPlayerSrc(s)}}else this.log(er.ERROR,"degrade player failed"),this.emit("error",e)}getAdaptTimeRangeIdx(e){var t,n;const{config:i,adaptRange:r}=this;let s=i.segmentMinDuration;return r&&null!=(t=null==i?void 0:i.adaptRange)&&t.rangeControl&&(s=r.getAdaptLoadDuration()),null==(n=this.mp4)?void 0:n.updateAdaptTimeRange(e,s)}_startProgress(){this.initTimer(),this._requestTimer.start(),this._hasStartProgress=!0}_unloadVideo(){this.log(er.LOG,"unloadVideo");const{player:e}=this;try{e.video&&e.video.src&&!/^blob/.test(e.currentSrc)&&!/^blob/.test(e.video.src)&&(this.log(er.LOG,"unloadVideo src"),e.video.removeAttribute("src"),e.video.load())}catch(e){this.log(er.ERROR,"unloadVideo error",null==e?void 0:e.message)}}_addPendingPromise(e){this._pendingPromises.push(e)}_removePendingPromise(e){this.log(er.LOG,"removePendingPromise",null==e?void 0:e.id);const t=this._pendingPromises.indexOf(e);t>-1&&this._pendingPromises.splice(t,1)}_cancelPendingPromises(){this._pendingPromises.length>0&&this._pendingPromises.forEach((e=>{e.reject(bc)})),this._pendingPromises=[]}_onMediaExpired(){this.log(er.LOG,"MediaExpired stopProgress"),this._stopProgress(),this.emit(so.MEDIA_EXPIRED)}_isEnded(){var e,t;const{player:n,mp4:i}=this,r=n.bufferedPoint,s=r?r.end:0,a=n.currentTime;a>1&&s>a&&(s-a>=2||n.duration-a<1)&&2===n.video.readyState?$o()-this._lastCheckLagTime>=3e3&&(this.log(er.LOG,"[has buffer but waiting,seek 0.2 adjust],curTime,",a,", bufferend,",s,", duration,",null==(e=null==i?void 0:i.meta)?void 0:e.duration),n.currentTime=a+.2,this._lastCheckLagTime=$o()):this._lastCheckLagTime=$o();const{seeking:o}=n.video;return!this.endofstream&&this.bufferEndTime>0&&this.mse&&!o&&this.bufferEndTime-a<.5&&(this.log(er.LOG,"[isEnded endOfStream],curTime,",n.currentTime,", bufferend,",s,", duration,",null==(t=null==i?void 0:i.meta)?void 0:t.duration),this.endofstream=!0,this.mseEndInfo.mseEndType=2,this.mseEndInfo.mseEndTime=parseInt(1e3*this.bufferEndTime,10),this.mse.endOfStream().then((()=>{}))),!!(i&&i.meta&&!o&&i.meta.duration-a<.5)&&(this._stopProgress(),this.log(er.LOG,"[isEnded],stopProgress and endOfStream,curTime, ",n.currentTime,", bufferend,",s,", duration,",i.meta.duration),this.mse&&(this.mseEndInfo.mseEndType=3,this.mseEndInfo.mseEndTime=parseInt(1e3*i.meta.duration,10),this.mse.endOfStream().then((()=>{}))),!0)}emitVideoEvent(e){if(this._checkEndedTimer)return;const{player:t,mp4:n}=this;this._checkEndedTimer=setTimeout((()=>{this._checkEndedTimer=null,!this._isReceiveEndedEvent&&n.meta.duration-t.currentTime<.5&&(this.log(er.LOG,"[ do emit video ended event],curTime,",t.currentTime,", bufferend,",e,", duration,",n.meta.duration),this.emit("ended"))}),2e3)}_clearMediaKeys(){const{player:e}=this;e.video&&"function"==typeof e.video.setMediaKeys&&e.video.setMediaKeys(null).catch((()=>{}))}_checkRemoveSourceBuffer(e,t,n,i){const{mse:r,mp4:s,player:a}=this;if(r&&s&&a&&(n&&(clearTimeout(this._removeBufferTimer),this._removeBufferTimer=null),e||(e=a.getBufferedRange(a.buffered2)),t||(t=a.currentTime),!(!n&&$o()-this._checkRemoveBufferLastTime<=this.config.removeBufferLen||this.endofstream)&&(this._checkRemoveBufferLastTime=$o(),e&&e[0]>=0&&(t-e[0]>this.config.removeBufferLen||r.isFull())))){const n=i?e[1]:t-(r.isFull()?0:15),a=s.getFragmentIdx(n);if(a>0&&(i||s.timeRange[a].startTime>>",i,n,t),this.removeBuffer(mr.VIDEO,i,n)):r.isFull()&&!this._removeBufferTimer&&(this._removeBufferTimer=setTimeout((()=>{this._checkRemoveSourceBuffer(null,null,!0)}),1e4))}}}onMediaUpdate(e){const{vid:t,kid:n,url:i}=e,{player:r,config:s,playerConfig:a}=this;if(t===a.vid&&n===s.kid&&i){this.playerConfig.url=i;const e=this._handlerUrl(i);s._mainURL=e.main,s._backupURL=e.backup;const t=s._mainURL;return r.rawSrc=i,this.useVideoLoad?r.src=i:this.mp4&&this.mp4.updateUrl(t),!0}return!1}enableAutoBuffer(e){if(e){if(!this._allInitPromise)return void this.log(er.LOG,"player destroyed!!");this._allInitPromise.then((()=>{this.log(er.LOG,"enableAutoBuffer true"),this._startProgress()}))}else this._stopProgress(),this.log(er.LOG,"enableAutoBuffer false")}get bitRateAdapter(){if(!this.player||!this.player.plugins)return null;if(this.config.needAutoBitrate){const{bitrateselector:e}=this.player.plugins;return e}return null}getDefinitonFromAdapter(e,t){if(!this.bitRateAdapter)return null;const n=this.bitRateAdapter;return n.getSuitableBitrate?n.getSuitableBitrate(e,t):n.bitRateAdapter?n.bitRateAdapter.select(e):null}addPreloader(e={}){e.playerId=this.playerId;const{preloader:t}=this.player;t?t.addPreloader(e,this.playerConfig.vid,this.playerId):this.log(er.LOG,"preloader has destroyed")}addPreloaderList(e=[]){const{preloader:t}=this.player;t?t.addPreloaderList(e,this.playerConfig.vid,this.playerId):this.log(er.LOG,"preloader has destroyed")}log(e,t,...n){const{vid:i}=this.playerConfig||{},r=i?`[Index]${i} ${t}`:`[Index] ${t}`;Oo(this.logger,e,r,...n)}_emitInitFail(e){this.log(er.ERROR,"initFail, reason:",e),this.emit(so.INIT_FAIL,e)}set useVideoLoad(e){this._useVideoLoad=e}get useVideoLoad(){return this._useVideoLoad}get ready(){return this._allInitPromise}get speed(){return parseInt(_l.speed,10)}get version(){return So}get realTimeSpeed(){return xc}get opQueueLen(){const e=this.mse&&this.mse._queue?this.mse._queue[mr.VIDEO]:[];return e?e.length:0}get loadSegmentTimeRange(){if(!this.mp4)return[0,0,0,0];const e=this.mp4.adaptTimeRange;if(e&&e.length>0&&this._curLoadSegmentIdx>=0&&this._curLoadSegmentIdx=this.urlExpireTimestamp&&this.urlExpireTimestamp>0&&!n&&e.getServerTime&&(t.serverTimeDiffPromise=t.serverTimeDiffPromise||e.getServerTime().catch((()=>0)),t.serverTimeDiffPromise.then((e=>{if(e&&(t.serverTimeDiff=(new Date).getTime()/1e3-e),(new Date).getTime()/1e3>=this.urlExpireTimestamp+t.serverTimeDiff){this.urlExpireTimestamp=(new Date).getTime()/1e3+86400;const e=new wo("network",Po[403]);this._emitExpireEvent(e)}})))}_emitExpireEvent(e){const{player:t}=this,n=(new Date).getTime()/1e3;return this.emitExpireTimestamp?n-this.emitExpireTimestamp>300&&(this.emitExpireTimestamp=n,t.emit("MEDIA_EXPIRED",e),!0):(this.emitExpireTimestamp=n,t.emit("MEDIA_EXPIRED",e),!0)}reportBugPostPlayerLog(){this.emit(Sc)}}Ic.isSupported=function(){return Ml()&&Pl()&&!bl()},Ic.isEMESupported=Sl,Ic.isSupportedWithXgmse=function(){return Pl()&&!bl()},Ic.isMediaSourceSupported=Ml,Ic.isWebAssemblySupported=Pl,Ic.CUSTOM_EVENTS=so;var Lc=n(57206);const Oc=Object.freeze(Object.defineProperty({__proto__:null,getFilename:function(e){const t=e.split("?")[0],n=t&&t.split("/");let i;for(;n&&n.length;)if(i=n.pop(),i)return i}},Symbol.toStringTag,{value:"Module"})),Ac=e=>e<10?"0"+e:e,Gc=(e,t=!1)=>{const n=[];let i=Math.floor(e/1e3),r=Math.floor(i/60);const s=Math.floor(r/24);return i-=60*r,r-=24*s,s&&n.push(Ac(s)),n.push(Ac(r)),n.push(Ac(i)),t?n.join(":")+"."+(e/1e3).toFixed(3).split(".").pop():n.join(":")},$c=Date.now(),Nc=()=>window.performance?performance.now():Date.now()-$c,Bc=(Symbol.toStringTag,e=>"[object Object]"===Object.prototype.toString.call(e)),Fc=(e,t)=>{const n=Object.assign({},e);return Object.keys(t).forEach((i=>{if(void 0===e[i]){const e=t[i];Bc(n[i])&&Bc(e)?n[i]=Fc(n[i],e):n[i]=e}})),n},Uc=Object.freeze(Object.defineProperty({__proto__:null,combineDefaultOptions:Fc,isObject:Bc,isString:e=>"string"==typeof e},Symbol.toStringTag,{value:"Module"})),Hc=()=>!!(typeof window<"u"&&window.document),Vc={trace:0,debug:1,log:2,info:3,warn:4,error:5},jc={0:"",1:"gray",2:"",3:"lightblue",4:"",5:""},zc=[];let Xc=4,Kc=0,Wc=!1,Qc=2e3,qc=[],Yc=0;const Jc=Object.keys(Vc);class Zc{constructor(e){this.__level=Xc,this.__mode=Kc,this.__styled=Wc,this.__name=e,this.__apply(),zc.push(this)}formatArgs(e,t,n){if(!this.__styled)return n.unshift(t),n;const i=[`%c${t}`],r=[`color:${jc[e]}`];return n.forEach((e=>{"number"==typeof e?(e%1==0?i.push("%d"):i.push("%f"),r.push(e)):e instanceof Node?(i.push("%o"),r.push(e)):"object"==typeof e?(i.push("%O"),r.push(e)):i.push(e)})),r.unshift(i.join(" ")),r}__apply(){1===this.__mode?Jc.forEach((e=>{Vc[e]>=this.__level&&(this[e]=(...t)=>{const n=`[${e}][${this.__name}][${Gc(Nc(),!0)}]`;qc.push({id:Yc++,level:e,name:this.__name,prefix:n,timestamp:Date.now(),message:t.join(" ")}),qc.length>Qc&&qc.shift()})})):0===this.__mode&&Jc.forEach((e=>{const t=Vc[e];t>=this.__level&&(this[e]=(...n)=>{var i;const r=`[${Gc(Nc(),!0)}][${e}][${this.__name}]`;null==(i=console[e])||i.apply(console,this.formatArgs(t,r,n))})}))}trace(...e){}debug(...e){}log(...e){}info(...e){}warn(...e){}error(...e){}setName(e){this.__name=e}setMode(e){this.__mode=e,this.__apply()}setLevel(e){this.__level=e,this.__apply()}setStyled(e){this.__styled=e}reset(){this.__level=4,this.__mode=0}}const eu={createLogger:e=>new Zc(e),getLogs:()=>qc,setSize(e){Qc=e},setMode(e){Kc=e,zc.forEach((t=>t.setMode(e)))},setLevel(e){Xc=e,zc.forEach((t=>t.setLevel(e)))},setStyled(e){Wc=e,zc.forEach((t=>t.setStyled(e)))},reset(){zc.forEach((e=>e.reset())),qc=[]}};try{const e=Hc(),t=e?localStorage.getItem("ttplayer_logger_level"):"",n=e?localStorage.getItem("ttplayer_logger_mode"):"",i=e?localStorage.getItem("ttplayer_logger_styled"):"";"string"==typeof t&&eu.setLevel(parseInt(t,10)),"string"==typeof n&&eu.setMode(parseInt(n,10)),("1"===i||"true"===i)&&eu.setStyled(!0)}catch{}const tu=class{constructor(){this._eventMap=new Map,this._blockMap=new Map}emit(e,...t){const n=this._eventMap.get(e);let i=!0;if(n)for(let e=0,r=n.length;e(this.off(e,n),t.apply(this,i));this.on(e,n)}dedup(e,t){const n=this._eventMap.get(e);n?n.every((e=>e!==t))&&n.push(t):this._eventMap.set(e,[t])}on(e,t){this._eventMap.has(e)?this._eventMap.get(e).push(t):this._eventMap.set(e,[t])}off(e,t){this._eventMap.has(e)&&(t?this._eventMap.set(e,this._eventMap.get(e).filter((e=>e!==t))):this._eventMap.delete(e))}removeAllListeners(){this._eventMap.clear()}block(...e){e.forEach((e=>{const t=this._eventMap.get(e);t&&(this._blockMap.set(e,t),this._eventMap.delete(e))}))}unblock(...e){e.forEach((e=>{const t=this._blockMap.get(e);t&&(this._eventMap.set(e,t),this._blockMap.delete(e))}))}};tu.remap=(e,t,n)=>Object.keys(n).map((i=>{const r=(...e)=>t.emit(n[i],...e);return e.on(i,r),()=>e.off(i,r)}));let nu=tu;class iu extends nu{constructor(e={}){super(),this._lastUpdateTime=0,this._cacheSpeeds=[],this._logger=eu.createLogger("network-speed"),this._timeout=6e5,this._unit=1024,this._timeout=e.timeout||this._timeout}_calculateSpeed(e,t){const n=e/this._unit/t;n<=0||n===1/0?this._logger.debug(`invalid speed: ${n}`):(this._cacheSpeeds.push(n),this._cacheSpeeds.length>10&&this._cacheSpeeds.shift(),this.emit("downloaded",{byteSpeed:n,byteLength:e,duration:t,timescale:1}))}start(){this._lastUpdateTime=Nc()}download(e){const t=Nc(),n=(t-this._lastUpdateTime)/1e3;this._lastUpdateTime=t,n>this._timeout?this._logger.warn(`time diff: ${n}`):this._calculateSpeed(e,n)}getAverageSpeed(){return this._cacheSpeeds.reduce(((e,t)=>e+t),0)/this._cacheSpeeds.length}getLatestSpeed(){return this._cacheSpeeds[this._cacheSpeeds.length-1]}reset(){this._cacheSpeeds=[],this._lastUpdateTime=0}}var ru=n(67975),su=n(61978);const au="ttplayer-poster";class ou{constructor(e){this.__timer=-1,this.__faded=!1,this.__src="",this.__objectFit="contain",this.visible=!1;const t=document.createElement("div");t.className=au,this.__el=t,this.src=e}get src(){return this.__src}set src(e){this.__src=e,this.__el.style.backgroundImage=`url(${e})`}set objectFit(e){const t="fill"===e?"100% 100%":e;this.__el.style.backgroundSize=t,this.__objectFit=e}get objectFit(){return this.__objectFit}updateStyle(e){Object.keys(e).forEach((t=>{"objectFit"===t?this.objectFit=e[t]:this.__el.style[t]=e[t]}))}show(e){this.visible||(this.visible=!0,this.__el.className=su(au,"ttplayer-show"),null==e||e())}hide(e={},t){const n=!0===e.fade;if(this.visible){const i=su(au,n&&"ttplayer-fade");this.__timer>=0&&window.clearTimeout(this.__timer),e.delay?this.__timer=window.setTimeout((()=>{this.__timer=-1,this.visible=!1,this.__el.className=i,this.__faded=n,null==t||t()}),e.delay):(this.visible=!1,this.__el.className=i,this.__faded=n,null==t||t())}else this.__faded&&!n&&(this.__faded=!1,this.__el.className=au)}attach(e){e.appendChild(this.__el)}detach(){var e;this.__faded=!1,window.clearTimeout(this.__timer),null==(e=this.__el.parentNode)||e.removeChild(this.__el)}}class lu{static isEqual(e,t){return e===t||Array.isArray(e)&&Array.isArray(t)&&e.map((e=>e.cacheKey||e.url)).join("")===t.map((e=>e.cacheKey||e.url)).join("")||Uc.isObject(e)&&Uc.isObject(t)&&(e.cacheKey||e.url)===(t.cacheKey||t.url)}static isContainCacheKey(e,t){return"string"==typeof e?e===t:Array.isArray(e)?e.some((e=>(e.cacheKey||e.url)===t)):!!Uc.isObject(e)&&(e.cacheKey||e.url)===t}static getDefaultSource(e){if(!Uc.isString(e)){if(Array.isArray(e))return e[0];if(Uc.isObject(e))return e}}static getDefaultUrl(e){return Uc.isString(e)?e:Array.isArray(e)?e.length?e[0].url:"":Uc.isObject(e)?e.url:""}static getUrls(e){return Uc.isString(e)?[e]:Array.isArray(e)?e.map((e=>e.url)):Uc.isObject(e)?[e.url]:[]}static getCacheKeys(e){return Uc.isString(e)?[e]:Array.isArray(e)?Array.from(new Set(e.map((e=>e.cacheKey||e.url)))):Uc.isObject(e)?[e.cacheKey||e.url]:[]}}const cu="ttplayer-videohide";var uu=(e=>(e.CANPLAY="canplay",e.TIMEUPDATE="timeupdate",e))(uu||{});class du extends nu{constructor(e){super(),this.HideTrigger=uu,this.__logger=eu.createLogger("poster"),this.__updatedStyle={},this.__posters=[],this.__src="",this.__visible=!1,this.__autoPause=!1,this.__autoMute=!0,this.__hideOptions={fade:!0,delay:0,trigger:"canplay"},this.__selfCallPaused=!1,this.__handleSrcPreSetter=(e,t,n)=>{var i;null!=(i=lu.getDefaultSource(n))&&i.inherit||this.show()},this.__handleSeekPreSetter=()=>{this.__controller.removePreSetter("currentTime",this.__handleSeekPreSetter),this.hide()},this.__handlePausePreGetter=(e,t)=>()=>{t(),this.__selfCallPaused=!1,this.__controller.replaceGetter("pause",null)},this.__handleMutePreSetter=(e,t,n)=>{this.__reservedMuted=n},this.__handleLoadedData=()=>{const{trigger:e}=this.__tempHideOptions||this.__hideOptions;"timeupdate"===e?this.__controller.dedup("timeupdate",this.__handleTimeUpdateWithPoster):"canplay"===e&&this.__controller.dedup("canplay",this.__handleCanplay),this.__video.autoplay&&this.__togglePauseVideo(!1)},this.__handleCanplay=()=>{this.__controller.off("canplay",this.__handleCanplay),this.hide()},this.__handleTimeUpdateWithPoster=()=>{this.__controller.paused&&0===this.__controller.currentTime||(this.__controller.off("timeupdate",this.__handleTimeUpdateWithPoster),this.hide())};const{controller:t}=e;this.__controller=t,this.__video=t.getElement(),this.__container=document.createElement("div"),this.__styleContainer=document.createElement("style"),this.__styleContainer.innerHTML=".ttplayer-poster-enhance{position:static!important}.ttplayer-poster{position:absolute;top:0;left:0;width:100%;height:100%;background-position:center center;background-repeat:no-repeat;background-size:contain;pointer-events:none;z-index:1;opacity:0}.ttplayer-poster.ttplayer-fade{transition:opacity .3s ease-out 0s}.ttplayer-poster.ttplayer-hide{opacity:0}.ttplayer-poster.ttplayer-show{opacity:1}.ttplayer-videohide{visibility:hidden}",document.head.appendChild(this.__styleContainer),t.addPreSetter("src",this.__handleSrcPreSetter)}__togglePauseVideo(e){const{delay:t}=this.__hideOptions;if(!(this.__autoPause&&t>0))return;const n=this.__video;e?(n.paused||(n.pause(),this.__selfCallPaused=!0,this.__logger.info("since autoPause=true, the video is paused automatically")),this.__controller.replaceGetter("pause",this.__handlePausePreGetter)):n.paused&&this.__selfCallPaused&&(this.__controller.replaceGetter("pause",null),n.play(),this.__selfCallPaused=!1,this.__logger.info("resume playback automatically when the poster is hidden",n.paused))}__toggleMuteVideo(e){const{delay:t}=this.__hideOptions;if(!(this.__autoMute&&t>0))return;const n=this.__video;e?(void 0===this.__reservedMuted&&(this.__reservedMuted=n.muted),n.muted=!0,this.__controller.removePreSetter("muted",this.__handleMutePreSetter),this.__controller.addPreSetter("muted",this.__handleMutePreSetter),this.__logger.info("since autoMute=true, the video is muted automatically")):void 0!==this.__reservedMuted&&(this.__controller.removePreSetter("muted",this.__handleMutePreSetter),n.muted=this.__reservedMuted,this.__reservedMuted=void 0,this.__logger.info("restore the muted state of the video",n.muted))}__setVideoVisible(e){const t=this.__video;this.src&&(e?t.className=t.className.replace(new RegExp("\\s*?"+cu,"g"),""):-1===t.className.indexOf(cu)&&(t.className=su(t.className,cu)))}__createPoster(e){const t=new ou(e);return this.__updatedStyle&&t.updateStyle(this.__updatedStyle),t.attach(this.__container),t}__appendToCache(e){this.__posters.some((t=>t.src===e))||(this.__posters.length?this.__posters[0].src=e:this.__posters.push(this.__createPoster(e)))}__forceShow(e){this.__posters.forEach((t=>{t.src===this.__src?t.show(e):t.hide()}));try{this.emit("show")}catch(e){console.error(e)}}set hideTrigger(e){this.__hideOptions.trigger=e}get hideTrigger(){return this.__hideOptions.trigger}set fade(e){this.__hideOptions.fade=e}get fade(){return this.__hideOptions.fade}set delay(e){this.__hideOptions.delay=e}get delay(){return this.__hideOptions.delay}set autoPause(e){this.__autoPause=e}set autoMute(e){this.__autoMute=e}get visible(){return this.__visible}set src(e){this.__src=e,this.__appendToCache(e),this.__visible&&this.__forceShow()}get src(){return this.__src}set objectFit(e){this.__updatedStyle.objectFit=e,this.__posters.forEach((t=>{t.objectFit=e}))}get objectFit(){return this.__updatedStyle.objectFit}set cache(e){const t=new Set(e),n=[],i=this.__posters.filter((e=>t.has(e.src)?(t.delete(e.src),!0):!!e.visible||void n.push(e)));this.__posters=i.concat(Array.from(t).map((e=>{const t=n.pop();return t?(t.src=e,t):this.__createPoster(e)}))),n.forEach((e=>e.detach()))}get cache(){return this.__posters.map((e=>e.src))}show(e){this.__tempHideOptions=void 0,this.__controller.removePreSetter("currentTime",this.__handleSeekPreSetter),this.__controller.addPreSetter("currentTime",this.__handleSeekPreSetter),this.__controller.off("loadeddata",this.__handleLoadedData),this.__controller.once("loadeddata",this.__handleLoadedData),this.__src&&!this.__visible&&(this.__visible=!0,this.__forceShow(e),this.__toggleMuteVideo(!0),this.__setVideoVisible(!1),this.__logger.info("poster showed, src:",this.__src))}hide(e){if(!this.__visible)return;this.__setVideoVisible(!0),this.__visible=!1,this.__togglePauseVideo(!0);const t=[];this.__posters.forEach((e=>{e.src===this.__src?t.push(e):e.hide()}));const n=()=>{this.__toggleMuteVideo(!1),this.__togglePauseVideo(!1),null==e||e(),this.__logger.info("poster hided, src:",this.__src,this.__tempHideOptions);try{this.emit("hide")}catch(e){console.error(e)}};t.length?t.forEach((e=>{e.hide(this.__tempHideOptions||this.__hideOptions,n)})):n()}setTempHideOptions(e){this.__tempHideOptions=Uc.combineDefaultOptions(e,this.__hideOptions)}preventDefault(){this.__controller.removePreSetter("src",this.__handleSrcPreSetter)}attach(e){e.appendChild(this.__container)}destroy(){var e;document.head.removeChild(this.__styleContainer),this.__posters.forEach((e=>e.detach())),this.__controller.off("canplay",this.__handleCanplay),this.__controller.off("timeupdate",this.__handleTimeUpdateWithPoster),this.__controller.off("loadeddata",this.__handleLoadedData),this.__controller.replaceGetter("paused",null),this.__controller.removePreSetter("muted",this.__handleMutePreSetter),this.__controller.removePreSetter("src",this.__handleSrcPreSetter),this.__controller.removePreSetter("currentTime",this.__handleSeekPreSetter),null==(e=this.__container.parentNode)||e.removeChild(this.__container)}}var hu=(e=>(e.POSTER="poster",e))(hu||{}),pu=(e=>(e[e.NETWORK=2100]="NETWORK",e[e.NETWORK_TIMEOUT=2101]="NETWORK_TIMEOUT",e[e.NETWORK_FORBIDDEN=2103]="NETWORK_FORBIDDEN",e[e.DEMUX_MP4=3300]="DEMUX_MP4",e[e.REMUX_FMP4=4100]="REMUX_FMP4",e[e.MEDIA_ABORTED=5101]="MEDIA_ABORTED",e[e.MEDIA_NETWORK=5102]="MEDIA_NETWORK",e[e.MEDIA_DECODE=5103]="MEDIA_DECODE",e[e.MEDIA_SRC_NOT_SUPPORTED=5104]="MEDIA_SRC_NOT_SUPPORTED",e[e.MEDIA_UNSUPPORT=5105]="MEDIA_UNSUPPORT",e[e.MEDIA_EMPTY_SRC=5106]="MEDIA_EMPTY_SRC",e[e.MEDIA_MSE_ADD_SB=5200]="MEDIA_MSE_ADD_SB",e[e.MEDIA_MSE_SB_APPEND=5201]="MEDIA_MSE_SB_APPEND",e[e.MEDIA_MSE_OTHER=5202]="MEDIA_MSE_OTHER",e[e.MEDIA_MSE_OVERFLOW=5203]="MEDIA_MSE_OVERFLOW",e[e.MEDIA_MSE_HIJACKED=5204]="MEDIA_MSE_HIJACKED",e[e.MEDIA_MSE_SB_CHANGE_TYPE=5205]="MEDIA_MSE_SB_CHANGE_TYPE",e[e.MEDIA_MSE_SB_REMOVE=5206]="MEDIA_MSE_SB_REMOVE",e[e.OTHER=8e3]="OTHER",e[e.OTHER_PARAMS=8100]="OTHER_PARAMS",e[e.RUNTIME_NO_CANPLAY=9001]="RUNTIME_NO_CANPLAY",e[e.RUNTIME_BUFFER_BREAK=9002]="RUNTIME_BUFFER_BREAK",e[e.RUNTIME_WAITING_TIMEOUT=9003]="RUNTIME_WAITING_TIMEOUT",e))(pu||{});const fu=class e extends Error{constructor(e,t){super(t),this.name="PlayerError",this.code=e,this.category=pu[e],this.message=t||this.category}static fromMediaError(t){switch(t.code){case 1:return new e(5101,t.message);case 2:return new e(5102,t.message);case 3:return new e(5103,t.message);case 4:return new e(5104,t.message);default:return new e(8e3,t.message)}}};fu.Code=pu;let gu=fu;const mu=["playnext","exception"],vu=["canplay","canplaythrough","durationchange","emptied","ended","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","stalled","suspend","seeked","seeking","resize","timeupdate","volumechange","waiting"];class yu extends nu{constructor(e){super(),this._logger=eu.createLogger("controller"),this.__replacedGetterMap=new Map,this.__replacedSetterMap=new Map,this.__preSetterMap=new Map,this.__videoOffCallbackMap=new Map,this.__remapOffCallbacks=[],this.__videoEventProxyMap=new Map,this.__currSourceIndex=0,this.willEmitEventNameSet=new Set,this.__handleSrcPreSetter=(e,t,n)=>{Array.isArray(n)?(this.__sources=n,this.__currSourceIndex=0):this.__sources=void 0},this.processError=()=>{const e=this.__core.error?gu.fromMediaError(this.__core.error):new gu(gu.Code.OTHER,"The error event was triggered, but video.error is null");if(this.__sources)if(this.__currSourceIndex++,this.__currSourceIndexnew Promise((e=>{this.__core.play().then((()=>{e(null)})).catch((t=>{this._logger.warn(t),e(t)}))})),this.pause=()=>this.__core.pause(),this.reset=()=>{this.__core.removeAttribute("src"),this.__core.load()};const t=ru(e,{objectFit:"contain"}),{objectFit:n,attributes:i,...r}=t,s=document.createElement("video");return s instanceof HTMLVideoElement&&(i&&Object.keys(i).forEach((e=>{s.setAttribute(e,i[e])})),s.setAttribute("data-version","0.3.10"),s.style.width="100%",s.style.height="100%",s.style.verticalAlign="middle"),this.coreName="video-element",this.coreVersion="",this.__core=s,this.__bindEvents(),Object.assign(this,r),e.container.appendChild(s),this.__posterManager=new du({controller:this}),this.__posterManager.attach(t.container),this.addPreSetter("src",this.__handleSrcPreSetter),new Proxy(this,{set:(e,t,n)=>{if(0===t.indexOf("_"))return e[t]=n,!0;const i=this.__preSetterMap.get(t);if(i&&i.some((i=>!1===i(e,e[t],n))))return!0;const r=this.__replacedSetterMap.get(t);return r?r(e,e[t],n):e[t]!==n&&(e[t]=n,this.emit("update",t,e[t],n)),!0},get:(e,t)=>{if(0===t.indexOf("_"))return e[t];const n=this.__replacedGetterMap.get(t);return n?n(e,e[t]):e[t]}})}__bindVideoEvent(e,t){this.__videoOffCallbackMap.has(e)||(this.__core.addEventListener(e,t,!1),this.__videoOffCallbackMap.set(e,(()=>{this.__core.removeEventListener(e,t,!1)})))}__bindEvents(){vu.forEach((e=>{this.__bindVideoEvent(e,(()=>this.emit(e))),this.willEmitEventNameSet.add(e)})),mu.forEach((e=>{this.willEmitEventNameSet.add(e)})),[{onName:"error",emitName:"error",callback:this.processError}].forEach((e=>{this.__videoEventProxyMap.set(e.onName,e),this.__bindVideoEvent(e.onName,e.callback),this.willEmitEventNameSet.add(e.emitName)})),nu.remap(this,this,{loadedmetadata:"update",play:"update",pause:"update",volumechange:"update",ratechange:"update"}).forEach((e=>{this.__remapOffCallbacks.push(e)}))}getInternalModule(e){if(e===hu.POSTER)return this.__posterManager;throw new gu(gu.Code.OTHER_PARAMS,`Module [${e}] not found, please use InternalModuleName as parameter`)}getElement(){return this.__core}getCore(){return this.__core}addPreSetter(e,t){const n=this.__preSetterMap.get(e);n?n.push(t):this.__preSetterMap.set(e,[t])}removePreSetter(e,t){const n=this.__preSetterMap.get(e);n&&n.length&&this.__preSetterMap.set(e,n.filter((e=>e!==t)))}replaceSetter(e,t){t?this.__replacedSetterMap.set(e,t):this.__replacedSetterMap.delete(e)}replaceGetter(e,t){t?this.__replacedGetterMap.set(e,t):this.__replacedGetterMap.delete(e)}disableEvents(e){e.forEach((e=>{const t=this.__videoOffCallbackMap.get(e);t&&(t(),this.__videoOffCallbackMap.delete(e))}))}enableEvents(e){e.forEach((e=>{const t=this.__videoEventProxyMap.get(e);t?this.__bindVideoEvent(e,t.callback):this.__bindVideoEvent(e,(()=>this.emit(e)))}))}_switchUrl(e,t){let n=0,i=!1;t?(n=this.__core.currentTime,i=this.__core.paused):this.emit("playnext"),this.__core.src=e,t&&(this.__core.currentTime=n,i?this.__core.pause():this.__core.play())}get videoWidth(){return this.__core.videoWidth}get videoHeight(){return this.__core.videoHeight}get objectFit(){return this.__core.style.objectFit}set objectFit(e){this.__core.style.objectFit=e}get error(){return this.__core.error}get buffered(){return this.__core.buffered}get duration(){return this.__core.duration}get paused(){return this.__core.paused}get ended(){return this.__core.ended}get rawSrc(){return this.currentSrc}get currentSrc(){return this.__core.currentSrc}set src(e){if("string"==typeof e)this._switchUrl(e,!1);else if(Array.isArray(e)){if(e.length){const t=e[this.__currSourceIndex];this._switchUrl(t.url,!!t.inherit)}}else this._switchUrl(e.url,!!e.inherit)}get src(){return this.__core.src||""}set sources(e){this.__sources=e,this.__currSourceIndex=0}get sources(){return this.__sources}set sourceIndex(e){this.__currSourceIndex=e}get sourceIndex(){return this.__currSourceIndex}set poster(e){this.__posterManager.src=e}get poster(){return this.__posterManager.src}set autoplay(e){this.__core.autoplay=e}get autoplay(){return this.__core.autoplay}set crossOrigin(e){this.__core.crossOrigin=e}get crossOrigin(){return this.__core.crossOrigin}set currentTime(e){this.__core.currentTime=e}get currentTime(){return this.__core.currentTime}set volume(e){this.__core.volume=e}get volume(){return this.__core.volume}set muted(e){this.__core.muted=e}get muted(){return this.__core.muted}set playbackRate(e){this.__core.playbackRate=e}get playbackRate(){return this.__core.playbackRate}set loop(e){this.__core.loop=e}get loop(){return this.__core.loop}set lang(e){this.__core.lang=e}get lang(){return this.__core.lang}set preload(e){this.__core.preload=e}get preload(){return this.__core.preload}get readyState(){return this.__core.readyState}get networkState(){return this.__core.networkState}destroy(){var e;this.__remapOffCallbacks.forEach((e=>e())),this.__remapOffCallbacks=[],this.__videoOffCallbackMap.forEach((e=>e())),this.__videoOffCallbackMap.clear(),this.__videoEventProxyMap.clear(),this.removeAllListeners(),this.__posterManager.destroy(),this.__preSetterMap.clear(),this.__replacedSetterMap.clear(),this.__replacedGetterMap.clear(),this.reset(),null==(e=this.__core.parentNode)||e.removeChild(this.__core)}}class _u{constructor(e){var t;this.__logger=eu.createLogger("plugin-manager"),this.__map=new Map,this.__context={...e.context,pluginManager:this},null==(t=e.plugins)||t.forEach((e=>{e&&this.register(e)}))}get(e){return this.__map.get(e)}register(e){this.__map.has(e.name)?this.__logger.warn(`[${e.name}] already exists`):(e.install(this.__context),this.__map.set(e.name,e),this.__logger.info(`[${e.name}] has been registered`))}unregister(e){const t="string"==typeof e?e:e.name,n=this.__map.get(t);n&&(this.__map.delete(t),n.uninstall(this.__context),this.__logger.info(`[${n.name}] has been unregistered`))}reset(){var e;const t=this.__map.values();for(const n of t)null==(e=n.reset)||e.call(n)}destroy(){this.__map.forEach((e=>{e.uninstall(this.__context),this.__logger.info(`[${e.name}] has been uninstalled`)})),this.__map.clear()}}const Tu=typeof window<"u"&&window.document,bu=eu.createLogger("ttplayer"),Su=!!Tu&&"true"===localStorage.getItem("ttplayer_record_event"),Pu=class extends nu{constructor(e){super(),this.getInternalModule=e=>this.__controller.getInternalModule(e);const t=[];if(e.plugins)for(const n of e.plugins)n&&n.name&&n.install&&t.push(n);const{src:n,...i}=e;this.__controller=new yu(Object.assign(i)),this.__controller.willEmitEventNameSet.forEach((e=>{this.__controller.on(e,((...t)=>{this.emit(e,...t)}))})),Su&&this._enableDebugLog(),this.__pluginManager=new _u({context:{container:e.container,controller:this.__controller},plugins:t}),n&&(this.__controller.src=n)}_enableDebugLog(){const e=["timeupdate","progress","durationchange"];let t="",n=0;this.__controller.willEmitEventNameSet.forEach((i=>{this.__controller.on(i,(()=>{t!==i&&(e.includes(i)?n++:n=0,ne+t.byteLength),0));let n=0;return e.forEach((e=>{t.set(e,n),n+=e.byteLength})),t}static concatUint8(...e){return this.concatUint8s(e)}get buffer(){return this.dv.buffer}get unreadLength(){return Math.max(this.end-this.offset,0)}get size(){return this.end-this.start}readFloat(e){let t=0;switch(e){case 4:t=this.dv.getFloat32(this.offset);break;case 8:t=this.dv.getFloat64(this.offset);break;default:throw new Error(`read ${e}-byte float is not supported`)}return this.offset+=e,t}back(e){this.offset-=e}skip(e){this.offset+=e}readInt(e){const t=this.offset;switch(this.offset+=e,e){case 1:return this.dv.getInt8(t);case 2:return this.dv.getInt16(t);case 4:return this.dv.getInt32(t);default:throw new Error(`read ${e}-byte integers is not supported`)}}read(e){const t=this.offset;switch(this.offset+=e,e){case 1:return this.dv.getUint8(t);case 2:return this.dv.getUint16(t);case 3:return(this.dv.getUint16(t)<<8)+this.dv.getUint8(t+2);case 4:return this.dv.getUint32(t);default:return this.back(e-4),this.read(e-4)+this.dv.getUint32(t)*Math.pow(256,e-4)}}write(e,t){const n=this.offset;switch(this.offset+=e,e){case 1:return this.dv.setUint8(n,t);case 2:return this.dv.setUint16(n,t);case 3:return this.dv.setUint8(n,t>>>16),this.dv.setUint16(n+1,65535&t);case 4:return this.dv.setUint32(n,t);default:throw new Error(`write ${e}-byte integers is not supported`)}}writeString(e){const t=e.length;for(let n=0;n(e[e.IDLE=0]="IDLE",e[e.LOADING=1]="LOADING",e[e.LOAD_END=2]="LOAD_END",e[e.SUSPENDED=3]="SUSPENDED",e[e.ERROR=4]="ERROR",e))(Eu||{});class ku extends nu{constructor(e={}){super(),this._status=0,this._timer=-1,this.network=new iu,this.pos=0,this.url="",this.$options=Uc.combineDefaultOptions(e,{timeout:6e4}),this.total=e.total||1/0}$processError(e){"AbortError"!==e.name&&(this.abort(),this.$changeStatus(4),this.$logger.error(e),this.emit("error",e))}$useSegments(e){this.$changeStatus(1);const t=e&&e.length;if(t){const t=wu.concatUint8s(e.map((e=>e.data))),n=e[0].pos;for(;e.length;)e.pop();this.pos=n+t.byteLength,this.emit("loadeddata",{pos:n,data:t})}return 1!==this.status?{break:!0,used:t}:{break:!1,used:t}}$waitForNextTick(e=0){return new Promise((t=>{this._timer=window.setTimeout(t,e)}))}$changeStatus(e){this._status=e}async $getFinalRequestParams(e,t){const{onBeforeRequest:n}=this.$options;if(n){const i=await n(this.url,t);i&&(e=i.url||e,t=i.params||t)}return{requestURL:e,requestParams:t}}changeName(e){this.$logger.setName(e)}changeOptions(e){e&&(this.$options=Uc.combineDefaultOptions(e,this.$options))}changeUrl(e){this.url!==e&&(this.$logger.info(`change url: ${this.url} -> ${e}`),this.url=e,this.$changeStatus(3))}getOptions(){return this.$options}get status(){return this._status}jump(e){this.pos=e}load(e,t,n){return this.reset(),this.url=e,this.loadRange(t,n)}reset(){this.abort(),window.clearTimeout(this._timer),this.pos=0,this.total=1/0,this.url="",this.network.reset()}destroy(){this.network.removeAllListeners(),this.removeAllListeners(),this.reset()}}class Du extends ku{constructor(){super(...arguments),this.$logger=eu.createLogger("fetch-loader"),this.__timer=-1,this.__handleTimeout=()=>{this.abort(),this.$processError(new gu(gu.Code.NETWORK_TIMEOUT,"Request timed out, please try again"))},this.__read=async e=>{for(this.__reader=e;;){const t=await e.read();if(!this.__reader)return;if(t.done)return this.__reader=void 0,this.__abortController=void 0,this.$changeStatus(Eu.LOAD_END),void this.emit("loadend");{const e=this.pos;this.pos+=t.value.byteLength,this.network.download(t.value.byteLength),this.emit("loadeddata",{pos:e,data:t.value})}}}}static isSupported(){return typeof AbortController<"u"&&typeof ReadableStream<"u"}__cancel(){clearTimeout(this.__timer),this.__reader&&(this.__reader.cancel(),this.__reader=void 0),this.__abortController&&!this.__abortController.signal.aborted&&(this.__abortController.abort(),this.__abortController=void 0)}async loadRange(e=0,t=1/0){if(this.status===Eu.LOADING)return;if(e>this.total)return void this.$logger.warn(`loadRange, start > total, start=${e} total=${this.total}`);if(e===this.total)return;const{segments:n,timeout:i,credentials:r}=this.$options,s=this.$useSegments(n);if(s.break)return;s.used&&(e=this.pos);const a={},o=e>0||t<1/0;if(o){const n=this.total-1,i=Math.min(n,t);a.Range=`bytes=${e}-${i===n?"":i}`}this.__abortController=new AbortController,this.emit("loadstart"),void 0!==i&&(this.__timer=window.setTimeout(this.__handleTimeout,i));const{requestURL:l,requestParams:c}=await this.$getFinalRequestParams(this.url,{method:"GET",headers:a,credentials:r,signal:this.__abortController.signal});return this.$logger.info(`load, range=${a.Range||""}, credentials=${r}, filename=${Oc.getFilename(l)}, url=${l}`),this.network.start(),fetch(l,c).then((t=>{var n,i;if(window.clearTimeout(this.__timer),403===t.status)throw new gu(gu.Code.NETWORK_FORBIDDEN,t.statusText);if(!o||416!==t.status&&200!==t.status||this.total!==1/0){if(t.status>=200&&t.status<300){if(this.pos=e,this.total=o?Number(null==(i=null==(n=t.headers.get("Content-Range"))?void 0:n.split("/"))?void 0:i[1])||this.total:Number(t.headers.get("Content-Length"))||this.total,t.body)return this.__read(t.body.getReader());throw new gu(gu.Code.NETWORK,"media stream data does not exist")}throw new gu(gu.Code.NETWORK,t.statusText)}this.$logger.warn(`loadRange, ${t.status}, pos=${this.pos}`),this.total=this.pos,this.emit("loadeddata",{pos:this.pos,data:new Uint8Array})})).catch((e=>{window.clearTimeout(this.__timer),this.$processError(e)}))}resume(){return this.status===Eu.SUSPENDED||this.status===Eu.LOAD_END?this.loadRange(this.pos):Promise.resolve()}suspend(){this.status===Eu.LOADING&&(this.$logger.info(`suspend, url=${this.url}`),this.__cancel(),this.$changeStatus(Eu.SUSPENDED))}abort(){this.status!==Eu.IDLE&&(this.$logger.info(`abort, url=${this.url}`),this.__cancel(),this.$changeStatus(Eu.IDLE))}}const Ru=512e3;class xu extends ku{constructor(){super(...arguments),this.$logger=eu.createLogger("xhr-loader"),this.__requestSeg=async(e,t)=>{const{credentials:n,timeout:i}=this.$options,r=e>0||t<1/0,s={};if(r){const n=this.total-1,i=Math.min(n,t);s.Range=`bytes=${e}-${i===n?"":i}`}const{requestURL:a,requestParams:o}=await this.$getFinalRequestParams(this.url,{credentials:n,headers:s});return new Promise(((e,t)=>{const n=this.__xhr=new XMLHttpRequest;n.open("GET",a,!0),n.withCredentials="include"===o.credentials,n.responseType="arraybuffer",n.onreadystatechange=()=>{n.readyState===XMLHttpRequest.HEADERS_RECEIVED&&(n.status>=200&&n.status<300?this.total===1/0&&(r||(this.total=Number(n.getResponseHeader("Content-Length"))||this.total)):403===n.status?t(new gu(gu.Code.NETWORK_FORBIDDEN,n.statusText)):t(new gu(gu.Code.NETWORK,n.statusText)))},n.onload=()=>{e(new Uint8Array(n.response))},n.onerror=()=>{t(new gu(gu.Code.NETWORK,n.statusText))},n.ontimeout=()=>{t(new gu(gu.Code.NETWORK_TIMEOUT,"Request timed out, please try again"))},n.onabort=()=>{const e=new Error("Request aborted");e.name="AbortError",t(e)},n.timeout=i||0,this.network.start(),n.send()}))},this.__read=async(e,t)=>{let n=e;for(;;){if(n>=t)return;const e=await this.__requestSeg(n,Math.min(t,n+Ru-1));if(!this.__xhr)return;if(this.network.download(e.byteLength),n+=e.byteLength,this.total===1/0&&e.byteLength=this.total||n>=t||0===e.byteLength)return this.$changeStatus(Eu.LOAD_END),void this.emit("loadend");if(await this.$waitForNextTick(10),!this.__xhr)return}}}__cancel(){this.__xhr&&(window.clearTimeout(this.__timer),this.__timer=void 0,this.__xhr.abort(),this.__xhr=void 0)}async loadRange(e=0,t=1/0){if(this.status===Eu.LOADING)return;if(e>this.total)return void this.$logger.warn(`loadRange, start > total, start=${e} total=${this.total}`);if(e===this.total)return;const{segments:n}=this.$options,i=this.$useSegments(n);return i.break?void 0:(i.used&&(e=this.pos),this.emit("loadstart"),this.$logger.info(`load, start=${e} end=${t} url=${this.url}`),this.__read(e,t).catch(this.$processError))}resume(){return this.status===Eu.SUSPENDED||this.status===Eu.LOAD_END?this.loadRange(this.pos):Promise.resolve()}suspend(){this.status===Eu.LOADING&&(this.$logger.info(`suspend, url=${this.url}`),this.__cancel(),this.$changeStatus(Eu.SUSPENDED))}abort(){this.status!==Eu.IDLE&&(this.$logger.info(`abort, url=${this.url}`),this.__cancel(),this.$changeStatus(Eu.IDLE))}}const Cu=Du.isSupported()?Du:xu;let Iu=Cu;const Lu=e=>{Iu=e||Cu},Ou=eu.createLogger("mutex"),Au=[],Gu=!!Hc()&&location.search.indexOf("debug_mutex")>-1;Hc()&&(window.__mutex_cache__=Au);class $u{constructor(e){this._resolves=[],this._rejects=[],this.name=e,Gu&&Au.push(this)}get locked(){return this._resolves.length>0}lock(){return new Promise(((e,t)=>{this._resolves.push(e),this._rejects.push(t)}))}unlock(e){this._resolves.length&&(this._rejects.shift(),this._resolves.shift()(e))}unlockAll(e){for(;this._resolves.length;)this._rejects.shift(),this._resolves.shift()(e)}throw(e){this._rejects.length&&(this._resolves.shift(),this._rejects.shift()(e))}releaseLock(){this._resolves.length&&Ou.log(`releaseLock, name=${this.name}`),this._resolves=[],this._rejects=[]}}var Nu=(e=>(e[e.EMPTY=0]="EMPTY",e[e.LOW=1]="LOW",e[e.NORMAL=2]="NORMAL",e[e.HIGH=3]="HIGH",e[e.FULL=4]="FULL",e))(Nu||{});class Bu extends nu{constructor(e,t){super(),this._queue=[],this._changeLevel=e=>{if(this.level!==e){const t=this.level;this.level=e,this.emit("levelchange",e,t)}},this._estimatedMaxSize=t,this.level=0,this._algorithm=this._defaultLevelAlgorithm,this._readMutex=new $u(e+".queue.read"),this._writeMutex=new $u(e+".queue.write")}_defaultLevelAlgorithm(e,t){const n=this._queue.length;return t?n>=this._estimatedMaxSize?4:n>=.7*this._estimatedMaxSize?3:n>=.3*this._estimatedMaxSize?2:n>0?1:0:0===n?0:n<=.3*this._estimatedMaxSize?1:n<=.7*this._estimatedMaxSize?2:nPromise.resolve().then(e);class Vu{static microTask(e){return Hu(e)}static create(e){const{type:t="macro",title:n,onLoop:i,onError:r}=e;let s=!0,a=-1;const o=Fu++,l=`(${o}) ${n}`,c={title:n,id:o,get running(){return s},cancel(){Uu.log(l,a,"canceled"),s=!1,window.clearTimeout(a)}},u=e=>{c.cancel(),Uu.error(l,a,"onLoop error",e),r(e instanceof gu?e:new gu(gu.Code.OTHER,e.message))};return"macro"===t?(Uu.log(l,"created with macro task"),function e(){s&&(a=window.setTimeout((()=>i(c).then(e).catch(u)),0))}()):(Uu.log(l,"created with micro task"),function e(){s&&Hu((()=>i(c).then(e).catch(u)))}()),c}}class ju extends nu{constructor(e){super(),this._pipeTargets=[],this.name=e}changeName(e){this.name=e}_unsetPipeCoroutine(){var e;null==(e=this._pipeCoroutine)||e.cancel(),this._pipeCoroutine=void 0}pipe(e,t){return this._pipeTargets.push(e),this._pipeCoroutine||(this._pipeCoroutine=Vu.create({title:this.name+" --pipe--\x3e "+this._pipeTargets.map((e=>e.name)).join("/"),onLoop:async()=>{const e=await this.read();for(const n of this._pipeTargets)await n.write(t?t(e):e)},onError:e=>this.emit("error",e)})),e}unpipe(e){return this._pipeTargets=this._pipeTargets.filter((t=>t!==e)),0===this._pipeTargets.length&&this._unsetPipeCoroutine(),e}destroy(){this.removeAllListeners(),this._pipeTargets=[],this._unsetPipeCoroutine()}}let zu=class extends ju{constructor(e){super(e),this.size=1,this.stdout=new Bu(this.name,this.size)}read(){return this.stdout.read()}flush(){this.stdout.clear()}destroy(){super.destroy(),this.stdout.removeAllListeners(),this.stdout.reset(),this.flush()}};class Xu extends nu{constructor(e){super(),this.size=1,this.name=e,this.stdin=new Bu(this.name,this.size)}write(e){return this.stdin.write(e)}flush(){this.stdin.clear()}destroy(){this.removeAllListeners(),this.stdin.removeAllListeners(),this.stdin.reset(),this.flush()}}class Ku extends ju{constructor(e){super(e),this.size=1,this.stdin=new Bu(this.name,this.size),this.stdout=new Bu(this.name,this.size)}_unsetCoroutine(){var e;null==(e=this._coroutine)||e.cancel(),this._coroutine=void 0}write(e){return this.stdin.write(e)}read(){return this.stdout.read()}suspend(){this.stdin.releaseRead(),this.stdout.releaseWrite(),this._unsetCoroutine()}resume(){this._unsetCoroutine(),this._coroutine=Vu.create({title:this.name+".transform",onLoop:async()=>{const e=await this.stdin.read(),t=await this.$transform(e);t&&await this.stdout.write(t)},onError:e=>this.emit("error",e)})}flush(){this.stdin.clear(),this.stdout.clear()}destroy(){super.destroy(),this.stdin.removeAllListeners(),this.stdout.removeAllListeners(),this.stdin.reset(),this.stdout.reset(),this._unsetCoroutine(),this.flush()}}var Wu=(e=>(e.LoadedMetadata="loadedmetadata",e.LoadedPackets="loadedpacket",e))(Wu||{});class Qu extends zu{constructor(e){super(e.name),this._parsers=[],this._reservedSeekTime=0,this._handleError=e=>{this.emit("error",e)},this._handleFirstLoadData=e=>{var t;const n=this._parsers.find((t=>t.probe(e.data)));if(n)this._activeParser?this._activeParser.constructor===n.constructor||(this._logger.info(`parserchange, ${(null==(t=this._activeParser)?void 0:t.name)||"N/A"} -> ${n.name}`),this._unbindParserEvents(this._activeParser),this._bindParserEvents(n)):this._bindParserEvents(n),this._activeParser=n,this._activeParser.setLoader(this._loader),this._activeParser.parse(e.data,e.pos),this._reservedSeekTime>0&&(this._activeParser.seek(this._reservedSeekTime),this._reservedSeekTime=0);else{const e="no parser can probe the data";this._logger.error(e),this.emit("error",new gu(gu.Code.DEMUX_MP4,e))}},this._handleParserLoadedMetadata=e=>{this._logger.info("metadata loaded",e),this.stdout.write({done:!1,value:{type:Wu.LoadedMetadata,payload:e}})},this._handleParserLoadedPacket=({data:e})=>{this._logger.debug("packets loaded",e.length),this.stdout.write({done:!1,value:{type:Wu.LoadedPackets,payload:e}})},this._handleParserEos=()=>{this.stdout.write({done:!0})},this._logger=eu.createLogger(e.name),this._loader=new Iu(e.loaderOptions),this._loader.changeName(e.name),this._parsers=e.parsers,this._resetLoaderEventListeners()}_resetLoaderEventListeners(){this._loader.removeAllListeners(),this._loader.on("error",this._handleError),this._loader.once("loadeddata",this._handleFirstLoadData)}_bindParserEvents(e){e.on("eos",this._handleParserEos),e.on("loadedpackets",this._handleParserLoadedPacket),e.on("loadedmetadata",this._handleParserLoadedMetadata)}_unbindParserEvents(e){e.off("eos",this._handleParserEos),e.off("loadedpackets",this._handleParserLoadedPacket),e.off("loadedmetadata",this._handleParserLoadedMetadata)}changeName(e){super.changeName(e),this._loader.changeName(e),this._logger.setName(e)}changeOptions(e){this._parsers=e.parsers||this._parsers,this._loader.changeOptions(e.loaderOptions)}getLoader(){return this._loader}load(e){this._reservedSeekTime=0,this._activeParser&&this._activeParser.reset(),this._resetLoaderEventListeners(),this.emit("beforeload"),this._loader.load(e)}seek(e){this._activeParser?this._activeParser.seek(e):this._reservedSeekTime=e}suspend(){this._loader.suspend()}resume(){this._loader.resume()}abort(){this._loader.abort()}reset(){super.flush(),this._reservedSeekTime=0,this._loader.reset()}destroy(){super.destroy(),this._parsers.forEach((e=>e.destroy())),this._loader.destroy()}}var qu=(e=>(e.FLV="FLV",e.MP4="MP4",e.HLS="HLS",e.DASH="DASH",e))(qu||{}),Yu=(e=>(e.VIDEO="video",e.AUDIO="audio",e.UNKNOWN="unknown",e))(Yu||{});class Ju{constructor(e,t){this.offset=0,this.val=e,this.size=t}static fromByte(e,t){return new Ju(e.read(t),t<<3)}toUint8(){const e=this.size/8,t=new Uint8Array(e),n=this.offset;this.offset=0;for(let n=0;n=0){let n=0,i=0;if(this.offset+=e,this.size>31){for(;i>>t&n}throw new Error("the number of the read operation exceeds the total length limit of bits")}write(e,t){const n=this.size-this.offset-e;if(!(n>=0))throw new Error("the number of the write operation exceeds the total length limit of bits");this.offset+=e,this.size>31?this.val+=t<(e[e.UNUSED=0]="UNUSED",e[e.NON_IDR_SLICE=1]="NON_IDR_SLICE",e[e.DP_A=2]="DP_A",e[e.DP_B=3]="DP_B",e[e.DP_C=4]="DP_C",e[e.IDR=5]="IDR",e[e.SEI=6]="SEI",e[e.SPS=7]="SPS",e[e.PPS=8]="PPS",e[e.DIVIDER=9]="DIVIDER",e[e.SEQUENCE_END=10]="SEQUENCE_END",e[e.STREAM_END=11]="STREAM_END",e[e.FILL=12]="FILL",e))(Zu||{});class ed{constructor(e){const t=Ju.fromByte(e,1);this.forbiddenZeroBit=t.read(1),this.refIdc=t.read(2),this.type=t.read(5)}static extractType(e,t=0){return 31&e[t]}static isSlice(e){const t=this.extractType(e);return t>=1&&t<=5}}var td=(e=>(e[e.TRAIL_N=0]="TRAIL_N",e[e.TRAIL_R=1]="TRAIL_R",e[e.TSA_N=2]="TSA_N",e[e.TSA_R=3]="TSA_R",e[e.STSA_N=4]="STSA_N",e[e.STSA_R=5]="STSA_R",e[e.RADL_N=6]="RADL_N",e[e.RADL_R=7]="RADL_R",e[e.RASL_N=8]="RASL_N",e[e.RASL_R=9]="RASL_R",e[e.VCL_N10=10]="VCL_N10",e[e.VCL_R11=11]="VCL_R11",e[e.VCL_N12=12]="VCL_N12",e[e.VCL_R13=13]="VCL_R13",e[e.VCL_N14=14]="VCL_N14",e[e.VCL_R15=15]="VCL_R15",e[e.BLA_W_LP=16]="BLA_W_LP",e[e.BLA_W_RADL=17]="BLA_W_RADL",e[e.BLA_N_LP=18]="BLA_N_LP",e[e.IDR_W_RADL=19]="IDR_W_RADL",e[e.IDR_N_LP=20]="IDR_N_LP",e[e.CRA=21]="CRA",e[e.VPS=32]="VPS",e[e.SPS=33]="SPS",e[e.PPS=34]="PPS",e[e.ACCESS_UNIT_DELIMITER=35]="ACCESS_UNIT_DELIMITER",e[e.EOS=36]="EOS",e[e.EOB=37]="EOB",e[e.FILLER_DATA=38]="FILLER_DATA",e[e.SEI=39]="SEI",e[e.SEI_SUFFIX=40]="SEI_SUFFIX",e[e.INVALID=64]="INVALID",e))(td||{});class nd{constructor(e){const t=Ju.fromByte(e,2);this.forbiddenZeroBit=t.read(1),this.type=t.read(6),this.nuhLayerId=t.read(6),this.temporalId=t.read(3)-1}static extractType(e,t=0){return(126&e[t])>>1}static isSlice(e){const t=this.extractType(e);return t>=0&&t<=21}}class id{create(e,...t){const n=new Uint8Array(8),i=wu.fromUint8(n),r=[n,...t.map((e=>new Uint8Array(e)))],s=r.reduce(((e,t)=>e+t.byteLength),0);return i.write(4,s),i.writeString(e),wu.concatUint8s(r)}avc1(e){const t=e.sar,n=e.naluDatas.some((e=>nd.extractType(e)===td.VPS)),i=new ArrayBuffer(78),r=new wu(i);r.write(4,0),r.write(2,0),r.write(2,1),r.write(4,0),r.write(4,0),r.write(4,0),r.write(4,0),r.write(2,e.width),r.write(2,e.height),r.write(4,4718592),r.write(4,4718592),r.write(4,0),r.write(2,1);r.write(1,15),r.writeString("@byted/ttplayer"),r.skip(16),r.write(2,24),r.write(2,65535);const s=2===t.length?this.pasp(t[0],t[1]):new Uint8Array;return n?this.create("hvc1",i,this.hvcC(e),s):this.create("avc1",i,this.avcC(e),s)}avcC(e){const{naluDatas:t}=e,n=[],i=[];t.forEach((e=>{const t=ed.extractType(e);t===Zu.SPS?n.push(e):t===Zu.PPS&&i.push(e)}));const r=e=>{const t=[e.length];return e.forEach((e=>{t.push(e.byteLength>>>8&255),t.push(255&e.byteLength),e.forEach((e=>t.push(e)))})),t},s=r(n),a=r(i),o=n[0]||[],l=new ArrayBuffer(5),c=new wu(l);return c.write(1,1),c.write(1,o[1]||0),c.write(1,o[2]||0),c.write(1,o[3]||0),c.write(1,255),this.create("avcC",l,s,a)}btrt(){const e=new ArrayBuffer(12),t=new wu(e);return t.write(4,1875072),t.write(4,3e6),t.write(4,3e6),this.create("btrt",e)}pasp(e,t){const n=new ArrayBuffer(8),i=new wu(n);return i.write(4,e),i.write(4,t),this.create("pasp",n)}dinf(){return this.create("dinf",this.dref())}dref(){const e=new ArrayBuffer(8),t=new wu(e);return t.write(4,0),t.write(4,1),this.create("dref",e,this.url())}esds(e){const{dsiData:t=new Uint8Array}=e,n=new ArrayBuffer(29+t.byteLength),i=new wu(n);return i.write(4,0),i.write(1,3),i.write(1,23+t.byteLength),i.write(2,1),i.write(1,0),i.write(1,4),i.write(1,15+t.byteLength),i.write(1,64),i.write(1,21),i.write(3,0),i.write(4,96e3),i.write(4,96e3),t.byteLength>0&&(i.write(1,5),i.write(1,t.byteLength),t.forEach((e=>i.write(1,e)))),i.write(1,6),i.write(1,1),i.write(1,2),this.create("esds",n)}ftyp(){const e=new ArrayBuffer(16),t=new wu(e);return t.writeString("isom"),t.write(4,1),t.writeString("isom"),t.writeString("avc1"),this.create("ftyp",e)}hdlr(e){const t=new ArrayBuffer(37),n=new wu(t);return n.skip(8),e===Yu.VIDEO?n.writeString("vide"):e===Yu.AUDIO&&n.writeString("soun"),n.skip(12),e===Yu.VIDEO?n.writeString("VideoHandler"):e===Yu.AUDIO&&n.writeString("SoundHandler"),n.write(1,0),this.create("hdlr",t)}hvcC(e){const{naluDatas:t}=e,n=[],i=[],r=[];t.forEach((e=>{const t=nd.extractType(e);t===td.VPS?n.push(e):t===td.SPS?i.push(e):t===td.PPS&&r.push(e)}));const s=(e,t)=>{const n=[128|e,t.length>>>8&255,255&t.length];return t.forEach((e=>{n.push(e.byteLength>>>8&255),n.push(255&e.byteLength),e.forEach((e=>n.push(e)))})),n},a=s(td.VPS,n),o=s(td.SPS,i),l=s(td.PPS,r),c=new ArrayBuffer(23),u=new wu(c),d=i.length?i[0]:[];u.write(1,1);for(let e=1;e<17;e++)u.write(1,d[e]||0);return u.write(1,248),u.write(1,248),u.write(2,0),u.write(1,15),u.write(1,3),this.create("hvcC",c,a,o,l)}mdat(e){return this.create("mdat",e)}mdhd(e){const t=new ArrayBuffer(24),n=new wu(t);return n.write(4,0),n.write(4,0),n.write(4,0),n.write(4,e.timescale),n.write(4,0),n.write(2,21956),n.write(2,0),this.create("mdhd",t)}mdia(e){return this.create("mdia",this.mdhd(e),this.hdlr(e.type),this.minf(e))}mfhd(e){const t=new ArrayBuffer(8),n=new wu(t);return n.write(4,0),n.write(4,e),this.create("mfhd",t)}minf(e){const t=e.type===Yu.VIDEO?this.vmhd():this.smhd();return this.create("minf",t,this.dinf(),this.stbl(e))}moof(e,t,n){const i=this.mfhd(t),r=new Map;let s=0;e.tracks.forEach((e=>r.set(e.type,[]))),n.forEach((e=>{const t=r.get(e.type);t&&(t.push(e),s++)}));const a=Array.from(r.values()).reduce(((e,t)=>t.length?e+1:e),0);let o=8+i.byteLength+60*a+16*s+8;const l=e.tracks.map((e=>{const t=r.get(e.type);if(t&&t.length){const n=this.traf(e,t,o);return o+=t.reduce(((e,t)=>e+t.data.byteLength),0),n}})).filter((e=>!!e));return this.create("moof",i,...l)}moov(e){const t=e.tracks.map((e=>this.trak(e)));return this.create("moov",this.mvhd(e),...t,this.mvex(e))}mp4a(e){const t=new ArrayBuffer(28),n=new wu(t);return n.write(4,0),n.write(2,0),n.write(2,1),n.write(4,0),n.write(4,0),n.write(2,e.channelCount),n.write(2,e.sampleSize),n.write(4,0),n.write(2,e.sampleRate),n.write(2,0),this.create("mp4a",t,this.esds(e))}mvex(e){return this.create("mvex",...e.tracks.map((e=>this.trex(e))))}mvhd(e){const t=new ArrayBuffer(100),n=new wu(t);return n.write(4,0),n.write(4,0),n.write(4,0),n.write(4,e.timescale),n.write(4,e.duration),n.write(2,1),n.skip(2),n.write(1,1),n.skip(1),n.skip(10),[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0].forEach((e=>n.write(1,e))),n.skip(24),n.write(4,4294967295),this.create("mvhd",t)}sdtp(e){const t=e.length,n=new ArrayBuffer(4+t),i=new wu(n);i.write(4,0);for(let n=0;nr.write(1,e))),r.write(2,t),r.write(2,0),r.write(2,n),r.write(2,0),this.create("tkhd",i)}tfdt(e){const t=new ArrayBuffer(8),n=new wu(t);return n.write(4,0),n.write(4,e),this.create("tfdt",t)}tfhd(e){const t=new ArrayBuffer(8),n=new wu(t);return n.write(4,0),n.write(4,e),this.create("tfhd",t)}traf(e,t,n){const i=t.length?t[0].dts:0;return this.create("traf",this.tfhd(e.id),this.tfdt(i),this.trun(t,n))}trak(e){return this.create("trak",this.tkhd(e),this.mdia(e))}trex(e){const t=new ArrayBuffer(24),n=new wu(t);return n.write(4,0),n.write(4,e.id),n.write(4,1),n.write(4,0),n.write(4,0),n.write(4,65535),this.create("trex",t)}trun(e,t){const n=e.length,i=new ArrayBuffer(12+16*n),r=new wu(i);r.write(4,3841),r.write(4,e.length),r.write(4,t);for(let t=0;t(e.InitSegmentCreated="init-segment-created",e.DataSegmentCreated="data-segment-created",e))(rd||{});const sd=()=>({formatType:qu.MP4,tracks:[],timescale:1e3,duration:0});class ad extends Ku{constructor(e){super(e.name),this._generator=new id,this._metadata=sd(),this._sequenceNumber=0,this._logger=eu.createLogger(e.name)}_patchMetadata(e){this._metadata=Object.assign(this._metadata,e)}_getMetadataWithOneTrack(e){const t=this._metadata.tracks.find((t=>t.type===e));if(t)return Object.assign({},this._metadata,{tracks:[t]})}_createInitSegment(e){return wu.concatUint8(this._generator.ftyp(),this._generator.moov(e))}_createDataSegment(e,t){if(!t.length)return new Uint8Array;const n=[],i=e.tracks.map((e=>t.filter((t=>t.type===e.type)))),r=Array.prototype.concat.apply([],i);return n.push(this._generator.moof(e,++this._sequenceNumber,r)),n.push(this._generator.mdat(wu.concatUint8s(r.map((e=>e.data))))),wu.concatUint8s(n)}_getVideoRandomAccessPoints(e){const t=[];return e.forEach((e=>{e.isKeyframe&&e.type===Yu.VIDEO&&t.push(e.pts/e.timescale)})),t}createDataSegmentAction(e){return{type:rd.DataSegmentCreated,payloads:this._metadata.tracks.map((t=>{const n=e.filter((e=>e.type===t.type));if(t.type===Yu.VIDEO){const e=n[0],i=n[n.length-1],r=e?e.dts/e.timescale:0,s=i?(i.dts+i.duration)/i.timescale:e?e.dts+e.duration/e.timescale:0;return this._logger.debug("$transform, type:",rd.DataSegmentCreated,r,"-",s),{type:Yu.VIDEO,raps:this._getVideoRandomAccessPoints(n),sdt:r,edt:s,data:this._createDataSegment(this._getMetadataWithOneTrack(t.type),n)}}return{type:t.type,data:this._createDataSegment(this._getMetadataWithOneTrack(t.type),n)}}))}}$transform(e){const{value:t,done:n}=e;let i;if(n)return{done:n};if(t)switch(t.type){case Wu.LoadedMetadata:{this._patchMetadata(t.payload);const e=this._metadata.tracks.filter((e=>e.type===Yu.VIDEO||e.type===Yu.AUDIO));i={type:rd.InitSegmentCreated,metadata:this._metadata,payloads:e.map((e=>({type:e.type,codec:e.codec,data:this._createInitSegment(this._getMetadataWithOneTrack(e.type))})))},this._logger.debug("$transform, type:",i.type);break}case Wu.LoadedPackets:i=this.createDataSegmentAction(t.payload)}return i?{done:n,value:i}:void 0}changeName(e){super.changeName(e),this._logger.setName(e)}flush(){super.flush()}reset(){this.flush(),this._sequenceNumber=0,this._metadata=sd()}}function od(e,t){const n=e.length;if(0!==n)for(let i,r,s=0;s=t)return{start:i,end:r}}function ld(e){const t=e.tracks.find((e=>e.type===Yu.VIDEO));return t?t.codec.split(".")[0]:NaN}function cd(e){const t=e.tracks.find((e=>e.type===Yu.VIDEO));return t?t.width/t.height:NaN}class ud{constructor(){this._bufs=[],this._timer=-1,this._called=!1}append(e){this._bufs.push(e)}download(e,t){this._called||(window.clearTimeout(this._timer),this._timer=window.setTimeout((()=>{const t=new Blob(this._bufs),n=window.URL.createObjectURL(t),i=document.createElement("a");i.href=n,i.download=e,i.click(),window.URL.revokeObjectURL(n)}),t),this._called=!0)}}const dd=typeof SourceBuffer<"u"&&!!SourceBuffer.prototype.changeType,hd=!!Hc()&&"1"===localStorage.getItem("ttplayer_debug_download")&&location.search.indexOf("debug_download")>-1;class pd extends nu{constructor(e,t){super(),this._logger=eu.createLogger("sbp"),this._pendingOperates=[],this._asyncOperateMutexes=[],this._asyncOperateCallbacks=[],this._allUpdatedCallbacks=[],this._handleError=e=>{this._emitError(new gu(gu.Code.MEDIA_MSE_OTHER,"mse source buffer error"))},this._emitError=e=>{this._logger.error(e),Vu.microTask((()=>this.emit("error",e)))},this._handleUpdateEnd=()=>{try{if(!this._sb.updating){for(;this._asyncOperateMutexes.length;)this._asyncOperateMutexes.shift().unlock();for(;this._asyncOperateCallbacks.length;)this._asyncOperateCallbacks.shift()();if(!this._pendingOperates.length)for(;this._allUpdatedCallbacks.length;)this._allUpdatedCallbacks.shift()()}}catch(e){return void(e instanceof gu?this._emitError(e):this._emitError(new gu(gu.Code.MEDIA_MSE_OTHER,e.message||"unknown error")))}this._prepareOperate(),this.emit("updateend")},this._processAsyncOpereateProperties=e=>{const{mutex:t,callback:n}=e;t&&this._asyncOperateMutexes.push(t),n&&this._asyncOperateCallbacks.push(n)},this._processSyncOpereateProperties=e=>{const{mutex:t,callback:n}=e;t&&t.unlock(),n&&n()},this._prepareOperate=()=>{var e;if(this._sb.updating||null!=(e=this._video)&&e.error)return;const t=this._pendingOperates.shift();if(t){const{mutex:e,type:n}=t;this._runningOperateType=n;try{switch(t.type){case"append":this._prepareAppend(t);break;case"flush":case"remove":this._prepareRemoveOrFlush(t);break;case"changeType":this._prepareChangeType(t);break;case"timestampOffset":this._prepareTimestampOffset(t)}}catch(t){null!=e&&e.locked?e.throw(t):this._emitError(new gu(gu.Code.MEDIA_MSE_OTHER,t.message))}}},this._prepareRemoveOrFlush=e=>{const{start:t,end:n}=e;try{this._processAsyncOpereateProperties(e),this._logger.debug("remove buffer:",t,"-",n),this._sb.remove(t,n)}catch(e){throw new gu(gu.Code.MEDIA_MSE_SB_REMOVE,e.message)}},this._prepareAppend=e=>{const{data:t}=e;try{this._processAsyncOpereateProperties(e),this._logger.debug("append buffer:",t.byteLength,this.mimeType),this._sb.appendBuffer(t.buffer),this.downloader&&(this.downloader.append(t.buffer),this.downloader.download(this.mimeType+".mp4",5e3))}catch(e){throw new gu(gu.Code.MEDIA_MSE_SB_APPEND,e.message)}},this._prepareChangeType=e=>{const{mimeType:t}=e;try{this._sb.changeType(t),this._logger.info(`mimeType changed, ${this._extra.mimeType} -> ${t}`),this._processSyncOpereateProperties(e),this._extra={mimeType:t}}catch(e){throw new gu(gu.Code.MEDIA_MSE_SB_CHANGE_TYPE,e.message)}},this._prepareTimestampOffset=e=>{const{timestampOffset:t}=e;try{this._sb.timestampOffset=t,this._processSyncOpereateProperties(e)}catch(e){throw new gu(gu.Code.MEDIA_MSE_OTHER,e.message)}},this._sb=e,this._extra={mimeType:t},hd&&(this.downloader=new ud),this._sb.addEventListener("updateend",this._handleUpdateEnd),this._sb.addEventListener("error",this._handleError)}static isSupportChangeType(){return dd}get mimeType(){return this._extra.mimeType}getSourceBuffer(){return this._sb}abort(){if(this._sb.updating&&"append"===this._runningOperateType)try{this._sb.abort()}catch(e){this._logger.warn(e)}}seek(e){const t=!!od(this._sb.buffered,e);t||(this._pendingOperates=[]);const n=this._sb.buffered;for(let t,i,r=0,s=n.length;ri)&&this._pendingOperates.push({type:"remove",start:t,end:i});return this._prepareOperate(),t}remove(e,t,n){const i=new $u("sbp.remove"),r=i.lock();return this._pendingOperates.push({type:"remove",start:e,end:t,mutex:i,callback:n}),this._prepareOperate(),r}append(e,t){const n=new $u("sbp.append"),i=n.lock();return this._pendingOperates.push({type:"append",data:e,mutex:n,callback:t}),this._prepareOperate(),i}changeMimeType(e,t){const n=new $u("sbp.changeType"),i=n.lock();return this._pendingOperates.push({type:"changeType",mimeType:e,mutex:n,callback:t}),this._prepareOperate(),i}setTimestampOffset(e,t){this.abort();const n=new $u("sbp.setTimestampOffset"),i=n.lock();return this._pendingOperates.push({type:"timestampOffset",timestampOffset:e,mutex:n,callback:t}),this._prepareOperate(),i}async flush(){let e;this.abort();try{e=this._sb.buffered}catch{}if(e&&e.length){this._logger.info("buffered range:",0,"-",e.end(e.length-1));const t=new $u("sbp.flush"),n=t.lock();return this._pendingOperates.push({type:"flush",mutex:t,start:0,end:1/0}),this._prepareOperate(),n}}waitForAllUpdated(e){this._sb.updating||this._pendingOperates.length?this._allUpdatedCallbacks.push(e):e()}clearWaitOperates(){this._logger.info("clear wait operates",this._pendingOperates.length,this._pendingOperates.map((e=>e.type)).join(",")),this._pendingOperates=this._pendingOperates.filter((e=>"flush"===e.type)),this._asyncOperateCallbacks=[],this._asyncOperateMutexes=[],this._allUpdatedCallbacks=[],this._prepareOperate()}releaseLock(){this._pendingOperates.forEach((e=>{var t;return null==(t=e.mutex)?void 0:t.releaseLock()}))}attach(e){this._video=e}detach(){this._video=void 0}destroy(){this.detach(),this._sb.removeEventListener("updateend",this._handleUpdateEnd),this.removeAllListeners(),this.clearWaitOperates(),this.releaseLock()}}var fd=(e=>(e[e.LOW=0]="LOW",e[e.NORMAL=1]="NORMAL",e[e.HIGH=2]="HIGH",e))(fd||{}),gd=(e=>(e[e.TIMEUPDATE=0]="TIMEUPDATE",e[e.UPDATEEND=1]="UPDATEEND",e[e.PROGRESS=2]="PROGRESS",e))(gd||{});class md extends nu{constructor(e,t){super(),this._logger=eu.createLogger("video-buffer-manager"),this._appendOutOfRangeTimes=0,this._startupRap=0,this._level=0,this._autoLevelCheck=!1,this._offTriggers=()=>{this._video.removeEventListener("timeupdate",this._handleTimeupdate),this._video.removeEventListener("progress",this._handleProgress)},this._handleProgress=()=>{this._checkBuffer(2)},this._handleTimeupdate=()=>{this._checkBuffer(0),this._checkBufferOverflow()},this._handleUpdateEnd=()=>{this._checkBuffer(1),this._checkBufferOutOfRange()},this._handleCustomError=e=>{this._logger.error(e),this.emit("error",e)},this._video=e,this._options=Uc.combineDefaultOptions(t,{maxBackwardBufferDuration:10,minBackwardBufferDuration:5,maxForwardBufferDuration:10,minForwardBufferDuration:5})}get level(){return this._level}setTriggers(e){this._offTriggers(),e.forEach((e=>{switch(e){case 2:return this._video.addEventListener("progress",this._handleProgress);case 0:return this._video.addEventListener("timeupdate",this._handleTimeupdate)}}))}dispatch(e){if(1===e)return this._handleUpdateEnd()}setAutoLevelCheck(e){this._autoLevelCheck=e}_changeWaterLevel(e){if(this._level!==e){const t=this._level;this._level=e,this.emit("levelchange",e,t)}}_checkBuffer(e){if(!this._autoLevelCheck)return;const{maxForwardBufferDuration:t,minForwardBufferDuration:n}=this._options,{currentTime:i,buffered:r}=this._video,s=od(r,this.getRefineCurrentTime(i));s&&(s.end-i>t?this._changeWaterLevel(2):s.end-i>n?this._changeWaterLevel(1):this._changeWaterLevel(0),this.emit("bufferchecking",e,s))}_checkBufferOverflow(){const{minBackwardBufferDuration:e,maxBackwardBufferDuration:t}=this._options,{currentTime:n,buffered:i}=this._video,r=[];for(let s,a,o=0,l=i.length;ot&&(a=n-e,r.push({start:s,end:a}));r.length&&this.emit("bufferoverflow",r)}_checkBufferOutOfRange(){const{buffered:e,currentTime:t}=this._video;if(!e.length)return;const n=function(e,t){const n=e.length;if(0!==n){let i,r;for(let s=0;st));s++);if(void 0!==i)return{start:i,end:r}}}(e,this.getRefineCurrentTime(t));!!n&&this._lastHitRange&&this._lastHitRange.end===n.end&&this._lastHitRange.start===n.start||this.emit("bufferchange"),this._lastHitRange=n}getRefineCurrentTime(e){return this._startupRap>0&&e(e.DEFAULT="default",e.NEXT_VIDEO_READY="next-video-ready",e))(vd||{}),yd=(e=>(e.DEFAULT="default",e.REUSE="reuse",e.REUSE_EXCEPT_CODEC_CHANGE="reuse-except-codec-change",e))(yd||{});class _d extends Xu{constructor(e={}){super("ms.stream"),this._logger=eu.createLogger("mse"),this._rapSet=new Set,this._firstRap=-1,this._eos=!1,this._skipSeeking=!1,this._clearIsPending=!1,this._metadataAppended=!1,this._handleBufferOverflow=e=>{const t=this._activeMse.sbpMap;t.size||e.forEach((({start:e,end:n})=>{const i=this._findBackwardRandomAccessPoint(n);i-.1>e&&!this._eos&&t.forEach((t=>t.remove(e,i-.1)))}))},this._handleSeeking=()=>{var e;if(this._logger.info("seeking event is fired, currenTime=",null==(e=this._video)?void 0:e.currentTime,"skipSeeking=",this._skipSeeking),this._skipSeeking)return void(this._skipSeeking=!1);const t=this._activeMse.sbpMap,n=this._video;if(!t.size||!n||!this._metadataAppended)return;const i=this._detector?this._detector.getRefineCurrentTime(n.currentTime):n.currentTime;Array.from(t.values()).every((e=>e.seek(i)))||this.emit("msestalled")},this._handleSbpUpdateEnd=()=>{var e;const t=this._video;if(t){if(0===t.currentTime){const e=function(e){const t=e.length;if(0!==t){let n,i;for(let r=0;r0)return{start:n,end:i};if(i>0)return{start:n,end:i}}}}(t.buffered);e&&e.start>0&&this._internalSeek(e.start)}if(this._options.eosFallback){const e=this.metadata?this.metadata.duration/this.metadata.timescale:0;e>0&&this._activeMse.sbpMap.size&&Array.from(this._activeMse.sbpMap.values()).every((t=>{const n=t.getSourceBuffer().buffered;return n.length>0&&n.end(n.length-1)>=e}))&&this._endOfStream()}}null==(e=this._detector)||e.dispatch(gd.UPDATEEND)},this._handleSbpError=e=>{this.emit("error",e),this.suspend()},this._processLoop=async()=>{var e,t;let n=await this.stdin.read();if(this._clearIsPending){let i;if((null==(e=n.value)?void 0:e.type)===rd.InitSegmentCreated)i=n;else do{i=await this.stdin.read()}while((null==(t=i.value)?void 0:t.type)!==rd.InitSegmentCreated);i&&(n=i,this._clearIsPending=!1,this._clearImmediately(this._options.clearStrategy))}if(n.done){if(this._eos)return void this._logger.debug("already endOfStream");const e=this._activeMse.sbpMap.size;let t=0;Array.from(this._activeMse.sbpMap.values()).map((n=>{n.waitForAllUpdated((()=>{++t{},sbpMap:new Map},r=()=>{this._logger.info("mse sourceclose")},s=()=>{this._logger.info("mse sourceopen"),n.unlockAll()};return e.addEventListener("sourceopen",s),e.addEventListener("sourceclose",r),i.destroy=()=>{n.releaseLock(),URL.revokeObjectURL(t),e.removeEventListener("sourceopen",s),e.removeEventListener("sourceclose",r)},i}_destroyMse(e){const t=this._activeMse.sbpMap;if(t.size){t.forEach((e=>e.destroy()));try{t.forEach((t=>e.mediaSource.removeSourceBuffer(t.getSourceBuffer())))}catch{}}e.destroy()}_reallocMse(){const e=this._video,t=this._activeMse;return(t.sbpMap.size||e&&e.src!==t.url&&t.used)&&(this._destroyMse(t),this._backupMse?(this._activeMse=this._backupMse,this._backupMse=this._createMse()):this._activeMse=this._createMse()),e&&e.src!==this._activeMse.url&&(this._logger.info(`change to mse, ${e.src||"empty"} -> ${this._activeMse.url}`),e.src=this._activeMse.url,this._activeMse.used=!0),this._activeMse}_setMseDuration(e){try{this._activeMse.mediaSource.duration=e,this._logger.info("mse duration changed to",e,"successfully")}catch(e){this.emit("error",new gu(gu.Code.MEDIA_MSE_OTHER,e.message))}}_endOfStream(){this._eos||(this._activeMse.mediaSource.endOfStream(),this._eos=!0,this._logger.info("endOfStream"))}_printMetadata(e){e.tracks.forEach((e=>{e.type===Yu.AUDIO?this._logger.info(`track:${e.type}(${e.id})`,"codec:",e.codec,"duration:",e.duration,"timescale:",e.timescale,"objectType:",e.audioObjectType,"channels:",e.channelCount,"sampleRate:",e.sampleRate,"sampleSize:",e.sampleSize):e.type===Yu.VIDEO?this._logger.info(`track:${e.type}(${e.id})`,"codec:",e.codec,"duration:",e.duration,"timescale:",e.timescale,"width:",e.width,"height:",e.height,"rotation:",e.rotation):this._logger.info(`track: ${e.type}(${e.id})`)}))}async _processInitSegment(e){this._logger.debug("mss-stdin, type:",e.type,e.payloads),this._printMetadata(e.metadata),this._metadata=e.metadata;const{clearStrategy:t}=this._options,n=e.metadata.duration/e.metadata.timescale;let i=!1;const r=()=>{if(i||"open"!==this._activeMse.mediaSource.readyState)return;const e=Array.from(this._activeMse.sbpMap.values());(!e.length||e.every((e=>!e.getSourceBuffer().updating)))&&(i=!0,this._setMseDuration(n))};r();const s=[];for(const r of e.payloads){const e=`video/mp4; codecs="${r.codec}"`;if(r.type===Yu.VIDEO&&"reuse-except-codec-change"===t){const t=this._activeMse.sbpMap.get(Yu.VIDEO);t&&t.mimeType!==e&&(this._reallocMse(),"open"!==this._activeMse.mediaSource.readyState&&await this._activeMse.mutex.lock(),this._setMseDuration(n),i=!0,this._logger.info("realloc mse, codec changed"))}const a=this._activeMse.sbpMap.get(r.type);if(a)a.abort(),await a.flush(),pd.isSupportChangeType()&&await a.changeMimeType(e),s.push(a.append(r.data));else{let t;"open"!==this._activeMse.mediaSource.readyState&&(await this._activeMse.mutex.lock(),this._setMseDuration(n),i=!0);try{t=this._activeMse.mediaSource.addSourceBuffer(e)}catch(e){throw new gu(gu.Code.MEDIA_MSE_ADD_SB,e.message)}const a=new pd(t,e);a.attach(this._video),a.on("error",this._handleSbpError),a.on("updateend",this._handleSbpUpdateEnd),this._activeMse.sbpMap.set(r.type,a),s.push(a.append(r.data))}}return Promise.all(s).then((()=>{r(),this._metadataAppended=!0,this._internalSeek(0),this._logger.info("seek to the start point")}))}async _processDataSegment(e){var t;let n=!1;const i=[];for(const r of e.payloads){const s=this._activeMse.sbpMap.get(r.type);if(!s)throw new gu(gu.Code.MEDIA_MSE_SB_APPEND,"no sourcebuffer");if(r.type===Yu.VIDEO){if(this._logger.debug("mss-stdin, type:",e.type,r.data.byteLength,",",r.sdt,"-",r.edt),r.raps.forEach((e=>this._rapSet.add(e))),this._eos){this._logger.warn("append cannot be called after endOfStream");break}n=this._firstRap<0&&!!r.raps.length,n&&(this._firstRap=r.raps[0],null==(t=this._detector)||t.setStartupRandomAccessPoint(this._firstRap))}i.push(s.append(r.data))}return Promise.all(i)}_internalSeek(e){const t=this._video;t&&(this._skipSeeking=!0,t.currentTime=e)}_resetContinuityStates(){this._skipSeeking=!1,this._eos=!1}_resetAllStates(){this._rapSet.clear(),this._metadata=void 0,this._metadataAppended=!1,this._firstRap=-1,this._resetContinuityStates()}_clearImmediately(e){if(super.flush(),this._resetAllStates(),"reuse"===e||"reuse-except-codec-change"===e){const e=this._activeMse.sbpMap;e.size&&(e.forEach((e=>{e.abort(),e.clearWaitOperates()})),Promise.all(Array.from(e.values()).map((e=>e.flush()))).then((()=>{const e=this._video;e&&e.autoplay&&e.paused&&(e.play(),this._logger.log("automatically resume the previously paused playback state due to autoplay=true"))})))}else this._reallocMse()}get metadata(){return this._metadata}get url(){return this._activeMse.url}attach(e,t){this._video!==e&&(this.detach(),t.on("bufferoverflow",this._handleBufferOverflow),e.addEventListener("seeking",this._handleSeeking),this._detector=t,this._video=e,this._reallocMse())}detach(){this._activeMse.sbpMap.forEach((e=>e.detach())),this._video&&(this._video.removeEventListener("seeking",this._handleSeeking),this._video=void 0),this._detector&&(this._detector.off("bufferoverflow",this._handleBufferOverflow),this._detector=void 0)}suspend(){var e;this._activeMse.sbpMap.forEach((e=>e.releaseLock())),this.stdin.releaseRead(),this._activeMse.mutex.releaseLock(),null==(e=this._coroutine)||e.cancel(),this._coroutine=void 0}resume(){this._coroutine?this._logger.debug(`coroutine (${this._coroutine.id}) is running, cannot resume`):this._coroutine=Vu.create({title:"mse.stream",onLoop:this._processLoop,onError:e=>this.emit("error",e)})}async flush(){super.flush(),this._resetContinuityStates();const e=this._activeMse.sbpMap;if(e.size)return e.forEach((e=>e.abort())),Promise.all(Array.from(e.values()).map((e=>e.flush())))}reset(e){var t;if(this.suspend(),null!=(t=this._video)&&t.error&&this._reallocMse(),"next-video-ready"===((null==e?void 0:e.clearTiming)||this._options.clearTiming))this._clearIsPending=!0;else{const t=(null==e?void 0:e.clearStrategy)||this._options.clearStrategy;this._clearImmediately(t)}}destroy(){super.destroy(),this.reset({clearStrategy:"default",clearTiming:"default"}),this.suspend(),this._destroyMse(this._activeMse),this._backupMse&&this._destroyMse(this._backupMse)}}const Td=eu.createLogger("multiplex"),bd=["error"],Sd=["progress"],Pd="demux",Md={delay:0};class wd extends nu{constructor(e,t){super(),this._handleVideoError=()=>{const e=this._video.error,t=e?gu.fromMediaError(e):new gu(gu.Code.OTHER,"unknown video error");this._downgrade(t)},this._handleError=e=>{const t=e instanceof gu?e:new gu(gu.Code.OTHER,e.message);this._downgrade(t)},this._downgrade=e=>{this._prevMeta=void 0;const t=this._demuxStream.getLoader().url,n=this._video;if(!_d.isBlob(n.src)||n.src===t)return void this._controller.processError();const i=n.currentTime;Td.warn("downgrade to h5 caused by multiplex error:",e.message),window.clearTimeout(this._levelTimer),this._demuxStream.abort(),this._remuxStream.reset(),this._mediaSourceStream.reset({clearTiming:vd.DEFAULT}),this._mediaSourceStream.detach(),this._controller.enableEvents(Sd),this._videoBufferDetector.setTriggers([gd.PROGRESS,gd.TIMEUPDATE]),0===i&&this._controller.getInternalModule(hu.POSTER).show(),this.emit("downgrade",e)&&(n.src=t,n.currentTime=i,Td.info("downgrade done, currentTime",n.currentTime))},this._handleControllerLoadedMetadata=()=>{this._videoBufferDetector.setAutoLevelCheck(!0)},this._handleVideoBufferChecking=(e,t)=>{const n=this._videoBufferDetector;if(n.level===fd.LOW){if(this._demuxStream.stdout.size>0||this._remuxStream.stdin.size>0||this._remuxStream.stdout.size>0||this._mediaSourceStream.stdin.size>0)return;window.clearTimeout(this._levelTimer),this._demuxStream.resume()}else n.level===fd.HIGH&&(window.clearTimeout(this._levelTimer),this._demuxStream.suspend());const i=this._preloader;if(!i)return;const r=this._video;if(r.autoplay&&!r.played.length)return;const s=r.currentTime,a=Math.max(t.end-s,0),o=Math.min(i.triggerBufferDuration,r.duration),l=Math.min(i.triggerPlayTime,r.duration/2),c=a>=o&&s>=l,u=s+a>=r.duration-1&&s+o>=r.duration-1;c||u?(this.emit("canpreload"),i.preload()):i.suspend(),(e===gd.UPDATEEND||e===gd.PROGRESS)&&this._controller.emit("progress")},this._handleDemuxLevelChange=e=>{e===Nu.FULL&&(window.clearTimeout(this._levelTimer),this._levelTimer=window.setTimeout((()=>{this._demuxStream.stdout.level===Nu.FULL&&(this._demuxStream.suspend(),Td.warn("demux waterlevel change to full, abort request"))}),1e3))},this._handleVideoLevelChange=(e,t)=>{const n=this._mediaSourceStream;Td.info("video levelchange",t,"->",e),e===fd.HIGH?n.suspend():e===fd.LOW&&n.resume()},this._handleMseStalled=()=>{const e=this._video.currentTime;Td.info("video mse seek stalled, currentTime:",e),this.reset(),this._demuxStream.seek(e)},this._options=t,this._context=e;const n=this._controller=e.controller;n.on("loadedmetadata",this._handleControllerLoadedMetadata),this._demuxStream=new Qu({name:Pd,parsers:this._options.parsers,loaderOptions:this._options.loaderOptions}),this._demuxStream.stdout.on("levelchange",this._handleDemuxLevelChange),this._demuxStream.on("error",this._handleError),this._remuxStream=new ad({name:"remux"}),this._remuxStream.on("error",this._handleError);const i=this._video=n.getElement();i.addEventListener("error",this._handleVideoError);const r=new md(i,this._options);r.on("levelchange",this._handleVideoLevelChange),r.on("bufferchecking",this._handleVideoBufferChecking),r.on("error",this._handleError),nu.remap(r,this._controller,{bufferchange:"progress"}),this._videoBufferDetector=r;const s=new _d(this._options);s.on("msestalled",this._handleMseStalled),s.on("error",this._handleError),s.attach(i,r),this._mediaSourceStream=s,this._setup()}_customizePosterBehavior(e){const{clearStrategy:t,clearTiming:n}=this._options;return n===vd.NEXT_VIDEO_READY?(e.preventDefault(),t===yd.REUSE?void 0:t===yd.REUSE_EXCEPT_CODEC_CHANGE?t=>{var n;if((null==(n=t.value)?void 0:n.type)===Wu.LoadedMetadata){const n=this._prevMeta,i=t.value.payload;(!n||ld(i)!==ld(n)||cd(i)!==cd(n))&&e.show(),this._prevMeta=i}return t}:t=>{var n;return(null==(n=t.value)?void 0:n.type)===Wu.LoadedMetadata&&e.show(),t}):t===yd.REUSE?t=>{var n;return(null==(n=t.value)?void 0:n.type)===Wu.LoadedMetadata&&e.setTempHideOptions(Md),t}:t===yd.REUSE_EXCEPT_CODEC_CHANGE?t=>{var n;if((null==(n=t.value)?void 0:n.type)===Wu.LoadedMetadata){const n=this._prevMeta,i=t.value.payload;n&&ld(i)===ld(n)&&cd(i)===cd(n)&&e.setTempHideOptions(Md),this._prevMeta=i}return t}:void 0}_setup(){const{controller:e}=this._context,t=e.getInternalModule(hu.POSTER),n=this._customizePosterBehavior(t);this._remuxStream.resume(),this._mediaSourceStream.resume(),this._demuxStream.pipe(this._remuxStream,n).pipe(this._mediaSourceStream),e.disableEvents(bd),e.replaceGetter("rawSrc",(()=>this._demuxStream.getLoader().url||this._video.currentSrc||"")),e.replaceSetter("src",((e,t,n)=>{n!==t&&this._load(n)}))}_load(e){const{_video:t,_mediaSourceStream:n,_videoBufferDetector:i}=this,{controller:r}=this._context,s=lu.getDefaultUrl(e);if(Td.log("------------------------------ divider ------------------------------"),Td.info("url changed to",s),!s)return r.emit("error",new gu(gu.Code.MEDIA_EMPTY_SRC,"no empty src"));const{inherit:a}=lu.getDefaultSource(e)||{},o=r.getInternalModule(hu.POSTER),l=this._customizePosterBehavior(o);window.clearTimeout(this._levelTimer);const c=this._video.currentTime,u=a?{clearTiming:vd.DEFAULT,clearStrategy:yd.REUSE}:void 0;let d;a||r.emit("playnext"),this._preloader&&(this._preloader.cancel(),d=this._preloader.pull(e)),Td.info("preloader pull, source.config=",null==d?void 0:d.config),i.reset();try{const e=null==d?void 0:d.error;if(d&&!e){const e=d.stats;e.duration>0&&this.emit("hitcache",d),Td.info(`preloader hitcache:${e.duration>0}, reused:${d.reused}, done:${d.done}, duration:${e.duration.toFixed(2)}, dataSize:${e.dataSize}`),this._demuxStream.unpipe(this._remuxStream),this._demuxStream.destroy(),this._demuxStream=d.demuxStream,this._demuxStream.changeName(Pd),this._demuxStream.stdout.on("levelchange",this._handleDemuxLevelChange),this._demuxStream.on("error",this._handleError),this._remuxStream.on("error",this._handleError),this._remuxStream.reset(),r.disableEvents(Sd),i.setTriggers([gd.UPDATEEND,gd.TIMEUPDATE]),n.reset(u),n.attach(t,i),n.resume(),d.done&&d.demuxStream.stdout.size>0||this._demuxStream.resume(),this.emit("loadstart"),this._demuxStream.pipe(this._remuxStream,l),a&&c>0&&this._demuxStream.seek(c)}else this._options.fallback||e?(e&&this.emit("downgrade",e),Td.info("use pure